diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/assets/index-Bk0P5m_Z.js b/assets/index-Bk0P5m_Z.js new file mode 100644 index 0000000..3ce614a --- /dev/null +++ b/assets/index-Bk0P5m_Z.js @@ -0,0 +1,609 @@ +(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))n(c);new MutationObserver(c=>{for(const f of c)if(f.type==="childList")for(const m of f.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&n(m)}).observe(document,{childList:!0,subtree:!0});function a(c){const f={};return c.integrity&&(f.integrity=c.integrity),c.referrerPolicy&&(f.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?f.credentials="include":c.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function n(c){if(c.ep)return;c.ep=!0;const f=a(c);fetch(c.href,f)}})();const Jv=(g,s)=>g===s,gu={equals:Jv};let ey=sy;const no=1,yu=2,ty={owned:null,cleanups:null,context:null,owner:null};var mr=null;let sp=null,Kv=null,Si=null,rr=null,hs=null,zu=0;function Yv(g,s){const a=Si,n=mr,c=g.length===0,f=s===void 0?n:s,m=c?ty:{owned:null,cleanups:null,context:f?f.context:null,owner:f},h=c?g:()=>g(()=>qh(()=>ku(m)));mr=m,Si=null;try{return Gh(h,!0)}finally{Si=a,mr=n}}function Oo(g,s){s=s?Object.assign({},gu,s):gu;const a={value:g,observers:null,observerSlots:null,comparator:s.equals||void 0},n=c=>(typeof c=="function"&&(c=c(a.value)),ny(a,c));return[ry.bind(a),n]}function Hs(g,s,a){const n=qp(g,s,!1,no);Zh(n)}function iy(g,s,a){ey=r0;const n=qp(g,s,!1,no);n.user=!0,hs?hs.push(n):Zh(n)}function Qv(g,s,a){a=a?Object.assign({},gu,a):gu;const n=qp(g,s,!0,0);return n.observers=null,n.observerSlots=null,n.comparator=a.equals||void 0,Zh(n),ry.bind(n)}function qh(g){if(Si===null)return g();const s=Si;Si=null;try{return g()}finally{Si=s}}function e0(g){iy(()=>qh(g))}function ry(){if(this.sources&&this.state)if(this.state===no)Zh(this);else{const g=rr;rr=null,Gh(()=>vu(this),!1),rr=g}if(Si){const g=this.observers?this.observers.length:0;Si.sources?(Si.sources.push(this),Si.sourceSlots.push(g)):(Si.sources=[this],Si.sourceSlots=[g]),this.observers?(this.observers.push(Si),this.observerSlots.push(Si.sources.length-1)):(this.observers=[Si],this.observerSlots=[Si.sources.length-1])}return this.value}function ny(g,s,a){let n=g.value;return(!g.comparator||!g.comparator(n,s))&&(g.value=s,g.observers&&g.observers.length&&Gh(()=>{for(let c=0;c1e6)throw rr=[],new Error},!1)),s}function Zh(g){if(!g.fn)return;ku(g);const s=zu;t0(g,g.value,s)}function t0(g,s,a){let n;const c=mr,f=Si;Si=mr=g;try{n=g.fn(s)}catch(m){return g.pure&&(g.state=no,g.owned&&g.owned.forEach(ku),g.owned=null),g.updatedAt=a+1,ay(m)}finally{Si=f,mr=c}(!g.updatedAt||g.updatedAt<=a)&&(g.updatedAt!=null&&"observers"in g?ny(g,n):g.value=n,g.updatedAt=a)}function qp(g,s,a,n=no,c){const f={fn:g,state:n,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:s,owner:mr,context:mr?mr.context:null,pure:a};return mr===null||mr!==ty&&(mr.owned?mr.owned.push(f):mr.owned=[f]),f}function _u(g){if(g.state===0)return;if(g.state===yu)return vu(g);if(g.suspense&&qh(g.suspense.inFallback))return g.suspense.effects.push(g);const s=[g];for(;(g=g.owner)&&(!g.updatedAt||g.updatedAt=0;a--)if(g=s[a],g.state===no)Zh(g);else if(g.state===yu){const n=rr;rr=null,Gh(()=>vu(g,s[0]),!1),rr=n}}function Gh(g,s){if(rr)return g();let a=!1;s||(rr=[]),hs?a=!0:hs=[],zu++;try{const n=g();return i0(a),n}catch(n){a||(hs=null),rr=null,ay(n)}}function i0(g){if(rr&&(sy(rr),rr=null),g)return;const s=hs;hs=null,s.length&&Gh(()=>ey(s),!1)}function sy(g){for(let s=0;s=0;s--)ku(g.owned[s]);g.owned=null}if(g.cleanups){for(s=g.cleanups.length-1;s>=0;s--)g.cleanups[s]();g.cleanups=null}g.state=0}function n0(g){return g instanceof Error?g:new Error(typeof g=="string"?g:"Unknown error",{cause:g})}function ay(g,s=mr){throw n0(g)}function s0(g,s){return qh(()=>g(s||{}))}function o0(g,s,a){let n=a.length,c=s.length,f=n,m=0,h=0,P=s[c-1].nextSibling,L=null;for(;mV-h){const ye=s[m];for(;h{c=f,s===document?g():fu(s,g(),s.firstChild?null:void 0,a)},n.owner),()=>{c(),s.textContent=""}}function Zp(g,s,a){let n;const c=()=>{const m=document.createElement("template");return m.innerHTML=g,m.content.firstChild},f=()=>(n||(n=c())).cloneNode(!0);return f.cloneNode=f,f}function l0(g,s=window.document){const a=s[Qm]||(s[Qm]=new Set);for(let n=0,c=g.length;ng(s,a))}function fu(g,s,a,n){if(a!==void 0&&!n&&(n=[]),typeof s!="function")return xu(g,s,n,a);Hs(c=>xu(g,s(),c,a),n)}function c0(g){const s=`$$${g.type}`;let a=g.composedPath&&g.composedPath()[0]||g.target;for(g.target!==a&&Object.defineProperty(g,"target",{configurable:!0,value:a}),Object.defineProperty(g,"currentTarget",{configurable:!0,get(){return a||document}});a;){const n=a[s];if(n&&!a.disabled){const c=a[`${s}Data`];if(c!==void 0?n.call(a,c,g):n.call(a,g),g.cancelBubble)return}a=a._$host||a.parentNode||a.host}}function xu(g,s,a,n,c){for(;typeof a=="function";)a=a();if(s===a)return a;const f=typeof s,m=n!==void 0;if(g=m&&a[0]&&a[0].parentNode||g,f==="string"||f==="number"){if(f==="number"&&(s=s.toString(),s===a))return a;if(m){let h=a[0];h&&h.nodeType===3?h.data!==s&&(h.data=s):h=document.createTextNode(s),a=Za(g,a,n,h)}else a!==""&&typeof a=="string"?a=g.firstChild.data=s:a=g.textContent=s}else if(s==null||f==="boolean")a=Za(g,a,n);else{if(f==="function")return Hs(()=>{let h=s();for(;typeof h=="function";)h=h();a=xu(g,h,a,n)}),()=>a;if(Array.isArray(s)){const h=[],P=a&&Array.isArray(a);if(wp(h,s,a,c))return Hs(()=>a=xu(g,h,a,n,!0)),()=>a;if(h.length===0){if(a=Za(g,a,n),m)return a}else P?a.length===0?tg(g,h,n):o0(g,a,h):(a&&Za(g),tg(g,h));a=h}else if(s.nodeType){if(Array.isArray(a)){if(m)return a=Za(g,a,n,s);Za(g,a,null,s)}else a==null||a===""||!g.firstChild?g.appendChild(s):g.replaceChild(s,g.firstChild);a=s}}return a}function wp(g,s,a,n){let c=!1;for(let f=0,m=s.length;f=0;m--){const h=s[m];if(c!==h){const P=h.parentNode===g;!f&&!m?P?g.replaceChild(c,h):g.insertBefore(c,a):P&&h.remove()}else f=!0}}else g.insertBefore(c,a);return[c]}var u0=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function d0(g){return g&&g.__esModule&&Object.prototype.hasOwnProperty.call(g,"default")?g.default:g}var ly={exports:{}};/** + * MapLibre GL JS + * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.7.0/LICENSE.txt + */(function(g,s){(function(a,n){g.exports=n()})(u0,function(){var a={},n={};function c(m,h,P){if(n[m]=P,m==="index"){var L="var sharedModule = {}; ("+n.shared+")(sharedModule); ("+n.worker+")(sharedModule);",V={};return n.shared(V),n.index(a,V),typeof window<"u"&&a.setWorkerUrl(window.URL.createObjectURL(new Blob([L],{type:"text/javascript"}))),a}}c("shared",["exports"],function(m){function h(i,t,r,l){return new(r||(r=Promise))(function(p,v){function x(M){try{I(l.next(M))}catch(E){v(E)}}function b(M){try{I(l.throw(M))}catch(E){v(E)}}function I(M){var E;M.done?p(M.value):(E=M.value,E instanceof r?E:new r(function(A){A(E)})).then(x,b)}I((l=l.apply(i,t||[])).next())})}function P(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}typeof SuppressedError=="function"&&SuppressedError;var L=V;function V(i,t){this.x=i,this.y=t}V.prototype={clone:function(){return new V(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,t){return this.clone()._rotateAround(i,t)},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 t=i.x-this.x,r=i.y-this.y;return t*t+r*r},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,t){return Math.atan2(this.x*t-this.y*i,this.x*i+this.y*t)},_matMult:function(i){var t=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=t,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 t=Math.cos(i),r=Math.sin(i),l=r*this.x+t*this.y;return this.x=t*this.x-r*this.y,this.y=l,this},_rotateAround:function(i,t){var r=Math.cos(i),l=Math.sin(i),p=t.y+l*(this.x-t.x)+r*(this.y-t.y);return this.x=t.x+r*(this.x-t.x)-l*(this.y-t.y),this.y=p,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},V.convert=function(i){return i instanceof V?i:Array.isArray(i)?new V(i[0],i[1]):i};var B=P(L),U=ue;function ue(i,t,r,l){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(l-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=t,this.p2x=r,this.p2y=l}ue.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,t){if(t===void 0&&(t=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,l=0;l<8;l++){var p=this.sampleCurveX(r)-i;if(Math.abs(p)p?x=r:b=r,r=.5*(b-x)+x;return r},solve:function(i,t){return this.sampleCurveY(this.solveCurveX(i,t))}};var ye=P(U);let Se,Ne;function Re(){return Se==null&&(Se=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Se}function it(){if(Ne==null&&(Ne=!1,Re())){const t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let l=0;l<5*5;l++){const p=4*l;t.fillStyle=`rgb(${p},${p+1},${p+2})`,t.fillRect(l%5,Math.floor(l/5),1,1)}const r=t.getImageData(0,0,5,5).data;for(let l=0;l<5*5*4;l++)if(l%4!=3&&r[l]!==l){Ne=!0;break}}}return Ne||!1}function Ue(i,t,r,l){const p=new ye(i,t,r,l);return v=>p.solve(v)}const ut=Ue(.25,.1,.25,1);function nt(i,t,r){return Math.min(r,Math.max(t,i))}function bt(i,t,r){const l=r-t,p=((i-t)%l+l)%l+t;return p===t?r:p}function Ke(i,...t){for(const r of t)for(const l in r)i[l]=r[l];return i}let _t=1;function kt(i,t,r){const l={};for(const p in i)l[p]=t.call(this,i[p],p,i);return l}function Rt(i,t,r){const l={};for(const p in i)t.call(this,i[p],p,i)&&(l[p]=i[p]);return l}function Ye(i){return Array.isArray(i)?i.map(Ye):typeof i=="object"&&i?kt(i,Ye):i}const St={};function ct(i){St[i]||(typeof console<"u"&&console.warn(i),St[i]=!0)}function wt(i,t,r){return(r.y-i.y)*(t.x-i.x)>(t.y-i.y)*(r.x-i.x)}function qt(i){return typeof WorkerGlobalScope<"u"&&i!==void 0&&i instanceof WorkerGlobalScope}let Ti=null;function fi(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const nr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Zi(i,t,r,l,p){return h(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const v=new VideoFrame(i,{timestamp:0});try{const x=v==null?void 0:v.format;if(!x||!x.startsWith("BGR")&&!x.startsWith("RGB"))throw new Error(`Unrecognized format ${x}`);const b=x.startsWith("BGR"),I=new Uint8ClampedArray(l*p*4);if(yield v.copyTo(I,function(M,E,A,D,O){const j=4*Math.max(-E,0),$=(Math.max(0,A)-A)*D*4+j,W=4*D,Y=Math.max(0,E),ce=Math.max(0,A);return{rect:{x:Y,y:ce,width:Math.min(M.width,E+D)-Y,height:Math.min(M.height,A+O)-ce},layout:[{offset:$,stride:W}]}}(i,t,r,l,p)),b)for(let M=0;Mqt(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,_r=function(i,t){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){const l=sr(i.url);if(l)return l(i,t);if(qt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,targetMapId:dn},t)}if(!(/^file:/.test(r=i.url)||/^file:/.test(ci())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(l,p){return h(this,void 0,void 0,function*(){const v=new Request(l.url,{method:l.method||"GET",body:l.body,credentials:l.credentials,headers:l.headers,cache:l.cache,referrer:ci(),signal:p.signal});l.type!=="json"||v.headers.has("Accept")||v.headers.set("Accept","application/json");const x=yield fetch(v);if(!x.ok){const M=yield x.blob();throw new Zt(x.status,x.statusText,l.url,M)}let b;b=l.type==="arrayBuffer"||l.type==="image"?x.arrayBuffer():l.type==="json"?x.json():x.text();const I=yield b;if(p.signal.aborted)throw zr();return{data:I,cacheControl:x.headers.get("Cache-Control"),expires:x.headers.get("Expires")}})}(i,t);if(qt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,mustQueue:!0,targetMapId:dn},t)}var r;return function(l,p){return new Promise((v,x)=>{var b;const I=new XMLHttpRequest;I.open(l.method||"GET",l.url,!0),l.type!=="arrayBuffer"&&l.type!=="image"||(I.responseType="arraybuffer");for(const M in l.headers)I.setRequestHeader(M,l.headers[M]);l.type==="json"&&(I.responseType="text",!((b=l.headers)===null||b===void 0)&&b.Accept||I.setRequestHeader("Accept","application/json")),I.withCredentials=l.credentials==="include",I.onerror=()=>{x(new Error(I.statusText))},I.onload=()=>{if(!p.signal.aborted)if((I.status>=200&&I.status<300||I.status===0)&&I.response!==null){let M=I.response;if(l.type==="json")try{M=JSON.parse(I.response)}catch(E){return void x(E)}v({data:M,cacheControl:I.getResponseHeader("Cache-Control"),expires:I.getResponseHeader("Expires")})}else{const M=new Blob([I.response],{type:I.getResponseHeader("Content-Type")});x(new Zt(I.status,I.statusText,l.url,M))}},p.signal.addEventListener("abort",()=>{I.abort(),x(zr())}),I.send(l.body)})}(i,t)};function $n(i){if(!i||i.indexOf("://")<=0||i.indexOf("data:image/")===0||i.indexOf("blob:")===0)return!0;const t=new URL(i),r=window.location;return t.protocol===r.protocol&&t.host===r.host}function oo(i,t,r){r[i]&&r[i].indexOf(t)!==-1||(r[i]=r[i]||[],r[i].push(t))}function pn(i,t,r){if(r&&r[i]){const l=r[i].indexOf(t);l!==-1&&r[i].splice(l,1)}}class In{constructor(t,r={}){Ke(this,r),this.type=t}}class Cn extends In{constructor(t,r={}){super("error",Ke({error:t},r))}}class ds{on(t,r){return this._listeners=this._listeners||{},oo(t,r,this._listeners),this}off(t,r){return pn(t,r,this._listeners),pn(t,r,this._oneTimeListeners),this}once(t,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},oo(t,r,this._oneTimeListeners),this):new Promise(l=>this.once(t,l))}fire(t,r){typeof t=="string"&&(t=new In(t,r||{}));const l=t.type;if(this.listens(l)){t.target=this;const p=this._listeners&&this._listeners[l]?this._listeners[l].slice():[];for(const b of p)b.call(this,t);const v=this._oneTimeListeners&&this._oneTimeListeners[l]?this._oneTimeListeners[l].slice():[];for(const b of v)pn(l,b,this._oneTimeListeners),b.call(this,t);const x=this._eventedParent;x&&(Ke(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),x.fire(t))}else t instanceof Cn&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,r){return this._eventedParent=t,this._eventedParentData=r,this}}var fe={$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 qn=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function ao(i,t){const r={};for(const l in i)l!=="ref"&&(r[l]=i[l]);return qn.forEach(l=>{l in t&&(r[l]=t[l])}),r}function Et(i,t){if(Array.isArray(i)){if(!Array.isArray(t)||i.length!==t.length)return!1;for(let r=0;r`:i.itemType.kind==="value"?"array":`array<${t}>`}return i.kind}const Z=[Mn,Te,pt,rt,Xi,mn,Dr,R(lt),Pn,en,K];function H(i,t){if(t.kind==="error")return null;if(i.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!H(i.itemType,t.itemType))&&(typeof i.N!="number"||i.N===t.N))return null}else{if(i.kind===t.kind)return null;if(i.kind==="value"){for(const r of Z)if(!H(r,t))return null}}return`Expected ${F(i)} but found ${F(t)} instead.`}function ne(i,t){return t.some(r=>r.kind===i.kind)}function oe(i,t){return t.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}function he(i,t){return i.kind==="array"&&t.kind==="array"?i.itemType.kind===t.itemType.kind&&typeof i.N=="number":i.kind===t.kind}const te=.96422,ge=.82521,be=4/29,pe=6/29,Me=3*pe*pe,Je=pe*pe*pe,Qe=Math.PI/180,It=180/Math.PI;function ht(i){return(i%=360)<0&&(i+=360),i}function Ct([i,t,r,l]){let p,v;const x=mi((.2225045*(i=gt(i))+.7168786*(t=gt(t))+.0606169*(r=gt(r)))/1);i===t&&t===r?p=v=x:(p=mi((.4360747*i+.3850649*t+.1430804*r)/te),v=mi((.0139322*i+.0971045*t+.7141733*r)/ge));const b=116*x-16;return[b<0?0:b,500*(p-x),200*(x-v),l]}function gt(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function mi(i){return i>Je?Math.pow(i,1/3):i/Me+be}function ni([i,t,r,l]){let p=(i+16)/116,v=isNaN(t)?p:p+t/500,x=isNaN(r)?p:p-r/200;return p=1*Dt(p),v=te*Dt(v),x=ge*Dt(x),[ft(3.1338561*v-1.6168667*p-.4906146*x),ft(-.9787684*v+1.9161415*p+.033454*x),ft(.0719453*v-.2289914*p+1.4052427*x),l]}function ft(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function Dt(i){return i>pe?i*i*i:Me*(i-be)}function ti(i){return parseInt(i.padEnd(2,i),16)/255}function bi(i,t){return Mi(t?i/100:i,0,1)}function Mi(i,t,r){return Math.min(Math.max(t,i),r)}function Ni(i){return!i.some(Number.isNaN)}const fs={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 Lt{constructor(t,r,l,p=1,v=!0){this.r=t,this.g=r,this.b=l,this.a=p,v||(this.r*=p,this.g*=p,this.b*=p,p||this.overwriteGetter("rgb",[t,r,l,p]))}static parse(t){if(t instanceof Lt)return t;if(typeof t!="string")return;const r=function(l){if((l=l.toLowerCase().trim())==="transparent")return[0,0,0,0];const p=fs[l];if(p){const[x,b,I]=p;return[x/255,b/255,I/255,1]}if(l.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(l)){const x=l.length<6?1:2;let b=1;return[ti(l.slice(b,b+=x)),ti(l.slice(b,b+=x)),ti(l.slice(b,b+=x)),ti(l.slice(b,b+x)||"ff")]}if(l.startsWith("rgb")){const x=l.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(x){const[b,I,M,E,A,D,O,j,$,W,Y,ce]=x,re=[E||" ",O||" ",W].join("");if(re===" "||re===" /"||re===",,"||re===",,,"){const le=[M,D,$].join(""),me=le==="%%%"?100:le===""?255:0;if(me){const we=[Mi(+I/me,0,1),Mi(+A/me,0,1),Mi(+j/me,0,1),Y?bi(+Y,ce):1];if(Ni(we))return we}}return}}const v=l.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(v){const[x,b,I,M,E,A,D,O,j]=v,$=[I||" ",E||" ",D].join("");if($===" "||$===" /"||$===",,"||$===",,,"){const W=[+b,Mi(+M,0,100),Mi(+A,0,100),O?bi(+O,j):1];if(Ni(W))return function([Y,ce,re,le]){function me(we){const Be=(we+Y/30)%12,et=ce*Math.min(re,1-re);return re-et*Math.max(-1,Math.min(Be-3,9-Be,1))}return Y=ht(Y),ce/=100,re/=100,[me(0),me(8),me(4),le]}(W)}}}(t);return r?new Lt(...r,!1):void 0}get rgb(){const{r:t,g:r,b:l,a:p}=this,v=p||1/0;return this.overwriteGetter("rgb",[t/v,r/v,l/v,p])}get hcl(){return this.overwriteGetter("hcl",function(t){const[r,l,p,v]=Ct(t),x=Math.sqrt(l*l+p*p);return[Math.round(1e4*x)?ht(Math.atan2(p,l)*It):NaN,x,r,v]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Ct(this.rgb))}overwriteGetter(t,r){return Object.defineProperty(this,t,{value:r}),r}toString(){const[t,r,l,p]=this.rgb;return`rgba(${[t,r,l].map(v=>Math.round(255*v)).join(",")},${p})`}}Lt.black=new Lt(0,0,0,1),Lt.white=new Lt(1,1,1,1),Lt.transparent=new Lt(0,0,0,0),Lt.red=new Lt(1,0,0,1);class gl{constructor(t,r,l){this.sensitivity=t?r?"variant":"case":r?"accent":"base",this.locale=l,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,r){return this.collator.compare(t,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class yl{constructor(t,r,l,p,v){this.text=t,this.image=r,this.scale=l,this.fontStack=p,this.textColor=v}}class or{constructor(t){this.sections=t}static fromString(t){return new or([new yl(t,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(t=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof or?t:or.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}}class ar{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ar)return t;if(typeof t=="number")return new ar([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const r of t)if(typeof r!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new ar(t)}}toString(){return JSON.stringify(this.values)}}const qu=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class xr{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof xr)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let r=0;r=0&&i<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof r=="number"&&r>=0&&r<=255?l===void 0||typeof l=="number"&&l>=0&&l<=1?null:`Invalid rgba value [${[i,t,r,l].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof l=="number"?[i,t,r,l]:[i,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Zn(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof Lt||i instanceof gl||i instanceof or||i instanceof ar||i instanceof xr||i instanceof lr)return!0;if(Array.isArray(i)){for(const t of i)if(!Zn(t))return!1;return!0}if(typeof i=="object"){for(const t in i)if(!Zn(i[t]))return!1;return!0}return!1}function gi(i){if(i===null)return Mn;if(typeof i=="string")return pt;if(typeof i=="boolean")return rt;if(typeof i=="number")return Te;if(i instanceof Lt)return Xi;if(i instanceof gl)return Qr;if(i instanceof or)return mn;if(i instanceof ar)return Pn;if(i instanceof xr)return K;if(i instanceof lr)return en;if(Array.isArray(i)){const t=i.length;let r;for(const l of i){const p=gi(l);if(r){if(r===p)continue;r=lt;break}r=p}return R(r||lt,t)}return Dr}function uo(i){const t=typeof i;return i===null?"":t==="string"||t==="number"||t==="boolean"?String(i):i instanceof Lt||i instanceof or||i instanceof ar||i instanceof xr||i instanceof lr?i.toString():JSON.stringify(i)}class Lr{constructor(t,r){this.type=t,this.value=r}static parse(t,r){if(t.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Zn(t[1]))return r.error("invalid value");const l=t[1];let p=gi(l);const v=r.expectedType;return p.kind!=="array"||p.N!==0||!v||v.kind!=="array"||typeof v.N=="number"&&v.N!==0||(p=v),new Lr(p,l)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class ui{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const Ko={string:pt,number:Te,boolean:rt,object:Dr};class Br{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let l,p=1;const v=t[0];if(v==="array"){let b,I;if(t.length>2){const M=t[1];if(typeof M!="string"||!(M in Ko)||M==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);b=Ko[M],p++}else b=lt;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return r.error('The length argument to "array" must be a positive integer literal',2);I=t[2],p++}l=R(b,I)}else{if(!Ko[v])throw new Error(`Types doesn't contain name = ${v}`);l=Ko[v]}const x=[];for(;pt.outputDefined())}}const _l={"to-boolean":rt,"to-color":Xi,"to-number":Te,"to-string":pt};class Fr{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");const l=t[0];if(!_l[l])throw new Error(`Can't parse ${l} as it is not part of the known types`);if((l==="to-boolean"||l==="to-string")&&t.length!==2)return r.error("Expected one argument.");const p=_l[l],v=[];for(let x=1;x4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:ms(r[0],r[1],r[2],r[3]),!l))return new Lt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new ui(l||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(const l of this.args){r=l.evaluate(t);const p=ar.parse(r);if(p)return p}throw new ui(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(const l of this.args){r=l.evaluate(t);const p=xr.parse(r);if(p)return p}throw new ui(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(const l of this.args){if(r=l.evaluate(t),r===null)return 0;const p=Number(r);if(!isNaN(p))return p}throw new ui(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return or.fromString(uo(this.args[0].evaluate(t)));case"resolvedImage":return lr.fromString(uo(this.args[0].evaluate(t)));default:return uo(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const Zu=["Unknown","Point","LineString","Polygon"];class Yo{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Zu[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let r=this._parseColorCache[t];return r||(r=this._parseColorCache[t]=Lt.parse(t)),r}}class Gn{constructor(t,r,l=[],p,v=new Yr,x=[]){this.registry=t,this.path=l,this.key=l.map(b=>`[${b}]`).join(""),this.scope=v,this.errors=x,this.expectedType=p,this._isConstant=r}parse(t,r,l,p,v={}){return r?this.concat(r,l,p)._parse(t,v):this._parse(t,v)}_parse(t,r){function l(p,v,x){return x==="assert"?new Br(v,[p]):x==="coerce"?new Fr(v,[p]):p}if(t!==null&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"||(t=["literal",t]),Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const p=t[0];if(typeof p!="string")return this.error(`Expression name must be a string, but found ${typeof p} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const v=this.registry[p];if(v){let x=v.parse(t,this);if(!x)return null;if(this.expectedType){const b=this.expectedType,I=x.type;if(b.kind!=="string"&&b.kind!=="number"&&b.kind!=="boolean"&&b.kind!=="object"&&b.kind!=="array"||I.kind!=="value")if(b.kind!=="color"&&b.kind!=="formatted"&&b.kind!=="resolvedImage"||I.kind!=="value"&&I.kind!=="string")if(b.kind!=="padding"||I.kind!=="value"&&I.kind!=="number"&&I.kind!=="array")if(b.kind!=="variableAnchorOffsetCollection"||I.kind!=="value"&&I.kind!=="array"){if(this.checkSubtype(b,I))return null}else x=l(x,b,r.typeAnnotation||"coerce");else x=l(x,b,r.typeAnnotation||"coerce");else x=l(x,b,r.typeAnnotation||"coerce");else x=l(x,b,r.typeAnnotation||"assert")}if(!(x instanceof Lr)&&x.type.kind!=="resolvedImage"&&this._isConstant(x)){const b=new Yo;try{x=new Lr(x.type,x.evaluate(b))}catch(I){return this.error(I.message),null}}return x}return this.error(`Unknown expression "${p}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(t===void 0?"'undefined' value invalid. Use null instead.":typeof t=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,r,l){const p=typeof t=="number"?this.path.concat(t):this.path,v=l?this.scope.concat(l):this.scope;return new Gn(this.registry,this._isConstant,p,r||null,v,this.errors)}error(t,...r){const l=`${this.key}${r.map(p=>`[${p}]`).join("")}`;this.errors.push(new Vi(l,t))}checkSubtype(t,r){const l=H(t,r);return l&&this.error(l),l}}class En{constructor(t,r){this.type=r.type,this.bindings=[].concat(t),this.result=r}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const r of this.bindings)t(r[1]);t(this.result)}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const l=[];for(let v=1;v=l.length)throw new ui(`Array index out of bounds: ${r} > ${l.length-1}.`);if(r!==Math.floor(r))throw new ui(`Array index must be an integer, but found ${r} instead.`);return l[r]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class xl{constructor(t,r){this.type=rt,this.needle=t,this.haystack=r}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const l=r.parse(t[1],1,lt),p=r.parse(t[2],2,lt);return l&&p?ne(l.type,[rt,pt,Te,Mn,lt])?new xl(l,p):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${F(l.type)} instead`):null}evaluate(t){const r=this.needle.evaluate(t),l=this.haystack.evaluate(t);if(!l)return!1;if(!oe(r,["boolean","string","number","null"]))throw new ui(`Expected first argument to be of type boolean, string, number or null, but found ${F(gi(r))} instead.`);if(!oe(l,["string","array"]))throw new ui(`Expected second argument to be of type array or string, but found ${F(gi(l))} instead.`);return l.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class gs{constructor(t,r,l){this.type=Te,this.needle=t,this.haystack=r,this.fromIndex=l}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const l=r.parse(t[1],1,lt),p=r.parse(t[2],2,lt);if(!l||!p)return null;if(!ne(l.type,[rt,pt,Te,Mn,lt]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${F(l.type)} instead`);if(t.length===4){const v=r.parse(t[3],3,Te);return v?new gs(l,p,v):null}return new gs(l,p)}evaluate(t){const r=this.needle.evaluate(t),l=this.haystack.evaluate(t);if(!oe(r,["boolean","string","number","null"]))throw new ui(`Expected first argument to be of type boolean, string, number or null, but found ${F(gi(r))} instead.`);let p;if(this.fromIndex&&(p=this.fromIndex.evaluate(t)),oe(l,["string"])){const v=l.indexOf(r,p);return v===-1?-1:[...l.slice(0,v)].length}if(oe(l,["array"]))return l.indexOf(r,p);throw new ui(`Expected second argument to be of type array or string, but found ${F(gi(l))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class bl{constructor(t,r,l,p,v,x){this.inputType=t,this.type=r,this.input=l,this.cases=p,this.outputs=v,this.otherwise=x}static parse(t,r){if(t.length<5)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return r.error("Expected an even number of arguments.");let l,p;r.expectedType&&r.expectedType.kind!=="value"&&(p=r.expectedType);const v={},x=[];for(let M=2;MNumber.MAX_SAFE_INTEGER)return D.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof j=="number"&&Math.floor(j)!==j)return D.error("Numeric branch labels must be integer values.");if(l){if(D.checkSubtype(l,gi(j)))return null}else l=gi(j);if(v[String(j)]!==void 0)return D.error("Branch labels must be unique.");v[String(j)]=x.length}const O=r.parse(A,M,p);if(!O)return null;p=p||O.type,x.push(O)}const b=r.parse(t[1],1,lt);if(!b)return null;const I=r.parse(t[t.length-1],t.length-1,p);return I?b.type.kind!=="value"&&r.concat(1).checkSubtype(l,b.type)?null:new bl(l,p,b,v,x,I):null}evaluate(t){const r=this.input.evaluate(t);return(gi(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}}class Qo{constructor(t,r,l){this.type=t,this.branches=r,this.otherwise=l}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return r.error("Expected an odd number of arguments.");let l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);const p=[];for(let x=1;xr.outputDefined())&&this.otherwise.outputDefined()}}class po{constructor(t,r,l,p){this.type=t,this.input=r,this.beginIndex=l,this.endIndex=p}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const l=r.parse(t[1],1,lt),p=r.parse(t[2],2,Te);if(!l||!p)return null;if(!ne(l.type,[R(lt),pt,lt]))return r.error(`Expected first argument to be of type array or string, but found ${F(l.type)} instead`);if(t.length===4){const v=r.parse(t[3],3,Te);return v?new po(l.type,l,p,v):null}return new po(l.type,l,p)}evaluate(t){const r=this.input.evaluate(t),l=this.beginIndex.evaluate(t);let p;if(this.endIndex&&(p=this.endIndex.evaluate(t)),oe(r,["string"]))return[...r].slice(l,p).join("");if(oe(r,["array"]))return r.slice(l,p);throw new ui(`Expected first argument to be of type array or string, but found ${F(gi(r))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function ea(i,t){const r=i.length-1;let l,p,v=0,x=r,b=0;for(;v<=x;)if(b=Math.floor((v+x)/2),l=i[b],p=i[b+1],l<=t){if(b===r||tt))throw new ui("Input is not a number.");x=b-1}return 0}class ys{constructor(t,r,l){this.type=t,this.input=r,this.labels=[],this.outputs=[];for(const[p,v]of l)this.labels.push(p),this.outputs.push(v)}static parse(t,r){if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");const l=r.parse(t[1],1,Te);if(!l)return null;const p=[];let v=null;r.expectedType&&r.expectedType.kind!=="value"&&(v=r.expectedType);for(let x=1;x=b)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',M);const A=r.parse(I,E,v);if(!A)return null;v=v||A.type,p.push([b,A])}return new ys(v,l,p)}evaluate(t){const r=this.labels,l=this.outputs;if(r.length===1)return l[0].evaluate(t);const p=this.input.evaluate(t);if(p<=r[0])return l[0].evaluate(t);const v=r.length;return p>=r[v-1]?l[v-1].evaluate(t):l[ea(r,p)].evaluate(t)}eachChild(t){t(this.input);for(const r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function rc(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Gu=nc;function nc(i,t,r,l){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(l-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=t,this.p2x=r,this.p2y=l}nc.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,t){if(t===void 0&&(t=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,l=0;l<8;l++){var p=this.sampleCurveX(r)-i;if(Math.abs(p)p?x=r:b=r,r=.5*(b-x)+x;return r},solve:function(i,t){return this.sampleCurveY(this.solveCurveX(i,t))}};var Xu=rc(Gu);function Xn(i,t,r){return i+r*(t-i)}function fo(i,t,r){return i.map((l,p)=>Xn(l,t[p],r))}const Wi={number:Xn,color:function(i,t,r,l="rgb"){switch(l){case"rgb":{const[p,v,x,b]=fo(i.rgb,t.rgb,r);return new Lt(p,v,x,b,!1)}case"hcl":{const[p,v,x,b]=i.hcl,[I,M,E,A]=t.hcl;let D,O;if(isNaN(p)||isNaN(I))isNaN(p)?isNaN(I)?D=NaN:(D=I,x!==1&&x!==0||(O=M)):(D=p,E!==1&&E!==0||(O=v));else{let ce=I-p;I>p&&ce>180?ce-=360:I180&&(ce+=360),D=p+r*ce}const[j,$,W,Y]=function([ce,re,le,me]){return ce=isNaN(ce)?0:ce*Qe,ni([le,Math.cos(ce)*re,Math.sin(ce)*re,me])}([D,O??Xn(v,M,r),Xn(x,E,r),Xn(b,A,r)]);return new Lt(j,$,W,Y,!1)}case"lab":{const[p,v,x,b]=ni(fo(i.lab,t.lab,r));return new Lt(p,v,x,b,!1)}}},array:fo,padding:function(i,t,r){return new ar(fo(i.values,t.values,r))},variableAnchorOffsetCollection:function(i,t,r){const l=i.values,p=t.values;if(l.length!==p.length)throw new ui(`Cannot interpolate values of different length. from: ${i.toString()}, to: ${t.toString()}`);const v=[];for(let x=0;xtypeof E!="number"||E<0||E>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);p={name:"cubic-bezier",controlPoints:M}}}if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(v=r.parse(v,2,Te),!v)return null;const b=[];let I=null;l==="interpolate-hcl"||l==="interpolate-lab"?I=Xi:r.expectedType&&r.expectedType.kind!=="value"&&(I=r.expectedType);for(let M=0;M=E)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',D);const j=r.parse(A,O,I);if(!j)return null;I=I||j.type,b.push([E,j])}return he(I,Te)||he(I,Xi)||he(I,Pn)||he(I,K)||he(I,R(Te))?new Hi(I,l,p,v,b):r.error(`Type ${F(I)} is not interpolatable.`)}evaluate(t){const r=this.labels,l=this.outputs;if(r.length===1)return l[0].evaluate(t);const p=this.input.evaluate(t);if(p<=r[0])return l[0].evaluate(t);const v=r.length;if(p>=r[v-1])return l[v-1].evaluate(t);const x=ea(r,p),b=Hi.interpolationFactor(this.interpolation,p,r[x],r[x+1]),I=l[x].evaluate(t),M=l[x+1].evaluate(t);switch(this.operator){case"interpolate":return Wi[this.type.kind](I,M,b);case"interpolate-hcl":return Wi.color(I,M,b,"hcl");case"interpolate-lab":return Wi.color(I,M,b,"lab")}}eachChild(t){t(this.input);for(const r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function ta(i,t,r,l){const p=l-r,v=i-r;return p===0?0:t===1?v/p:(Math.pow(t,v)-1)/(Math.pow(t,p)-1)}class ia{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expectected at least one argument.");let l=null;const p=r.expectedType;p&&p.kind!=="value"&&(l=p);const v=[];for(const b of t.slice(1)){const I=r.parse(b,1+v.length,l,void 0,{typeAnnotation:"omit"});if(!I)return null;l=l||I.type,v.push(I)}if(!l)throw new Error("No output type");const x=p&&v.some(b=>H(p,b.type));return new ia(x?lt:l,v)}evaluate(t){let r,l=null,p=0;for(const v of this.args)if(p++,l=v.evaluate(t),l&&l instanceof lr&&!l.available&&(r||(r=l.name),l=null,p===this.args.length&&(l=r)),l!==null)break;return l}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function ra(i,t){return i==="=="||i==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function sc(i,t,r,l){return l.compare(t,r)===0}function _s(i,t,r){const l=i!=="=="&&i!=="!=";return class hy{constructor(v,x,b){this.type=rt,this.lhs=v,this.rhs=x,this.collator=b,this.hasUntypedArgument=v.type.kind==="value"||x.type.kind==="value"}static parse(v,x){if(v.length!==3&&v.length!==4)return x.error("Expected two or three arguments.");const b=v[0];let I=x.parse(v[1],1,lt);if(!I)return null;if(!ra(b,I.type))return x.concat(1).error(`"${b}" comparisons are not supported for type '${F(I.type)}'.`);let M=x.parse(v[2],2,lt);if(!M)return null;if(!ra(b,M.type))return x.concat(2).error(`"${b}" comparisons are not supported for type '${F(M.type)}'.`);if(I.type.kind!==M.type.kind&&I.type.kind!=="value"&&M.type.kind!=="value")return x.error(`Cannot compare types '${F(I.type)}' and '${F(M.type)}'.`);l&&(I.type.kind==="value"&&M.type.kind!=="value"?I=new Br(M.type,[I]):I.type.kind!=="value"&&M.type.kind==="value"&&(M=new Br(I.type,[M])));let E=null;if(v.length===4){if(I.type.kind!=="string"&&M.type.kind!=="string"&&I.type.kind!=="value"&&M.type.kind!=="value")return x.error("Cannot use collator to compare non-string types.");if(E=x.parse(v[3],3,Qr),!E)return null}return new hy(I,M,E)}evaluate(v){const x=this.lhs.evaluate(v),b=this.rhs.evaluate(v);if(l&&this.hasUntypedArgument){const I=gi(x),M=gi(b);if(I.kind!==M.kind||I.kind!=="string"&&I.kind!=="number")throw new ui(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${I.kind}, ${M.kind}) instead.`)}if(this.collator&&!l&&this.hasUntypedArgument){const I=gi(x),M=gi(b);if(I.kind!=="string"||M.kind!=="string")return t(v,x,b)}return this.collator?r(v,x,b,this.collator.evaluate(v)):t(v,x,b)}eachChild(v){v(this.lhs),v(this.rhs),this.collator&&v(this.collator)}outputDefined(){return!0}}}const Wu=_s("==",function(i,t,r){return t===r},sc),oc=_s("!=",function(i,t,r){return t!==r},function(i,t,r,l){return!sc(0,t,r,l)}),ac=_s("<",function(i,t,r){return t",function(i,t,r){return t>r},function(i,t,r,l){return l.compare(t,r)>0}),Ju=_s("<=",function(i,t,r){return t<=r},function(i,t,r,l){return l.compare(t,r)<=0}),lc=_s(">=",function(i,t,r){return t>=r},function(i,t,r,l){return l.compare(t,r)>=0});class mo{constructor(t,r,l){this.type=Qr,this.locale=l,this.caseSensitive=t,this.diacriticSensitive=r}static parse(t,r){if(t.length!==2)return r.error("Expected one argument.");const l=t[1];if(typeof l!="object"||Array.isArray(l))return r.error("Collator options argument must be an object.");const p=r.parse(l["case-sensitive"]!==void 0&&l["case-sensitive"],1,rt);if(!p)return null;const v=r.parse(l["diacritic-sensitive"]!==void 0&&l["diacritic-sensitive"],1,rt);if(!v)return null;let x=null;return l.locale&&(x=r.parse(l.locale,1,pt),!x)?null:new mo(p,v,x)}evaluate(t){return new gl(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class wl{constructor(t,r,l,p,v){this.type=pt,this.number=t,this.locale=r,this.currency=l,this.minFractionDigits=p,this.maxFractionDigits=v}static parse(t,r){if(t.length!==3)return r.error("Expected two arguments.");const l=r.parse(t[1],1,Te);if(!l)return null;const p=t[2];if(typeof p!="object"||Array.isArray(p))return r.error("NumberFormat options argument must be an object.");let v=null;if(p.locale&&(v=r.parse(p.locale,1,pt),!v))return null;let x=null;if(p.currency&&(x=r.parse(p.currency,1,pt),!x))return null;let b=null;if(p["min-fraction-digits"]&&(b=r.parse(p["min-fraction-digits"],1,Te),!b))return null;let I=null;return p["max-fraction-digits"]&&(I=r.parse(p["max-fraction-digits"],1,Te),!I)?null:new wl(l,v,x,b,I)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class na{constructor(t){this.type=mn,this.sections=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");const l=t[1];if(!Array.isArray(l)&&typeof l=="object")return r.error("First argument must be an image or text section.");const p=[];let v=!1;for(let x=1;x<=t.length-1;++x){const b=t[x];if(v&&typeof b=="object"&&!Array.isArray(b)){v=!1;let I=null;if(b["font-scale"]&&(I=r.parse(b["font-scale"],1,Te),!I))return null;let M=null;if(b["text-font"]&&(M=r.parse(b["text-font"],1,R(pt)),!M))return null;let E=null;if(b["text-color"]&&(E=r.parse(b["text-color"],1,Xi),!E))return null;const A=p[p.length-1];A.scale=I,A.font=M,A.textColor=E}else{const I=r.parse(t[x],1,lt);if(!I)return null;const M=I.type.kind;if(M!=="string"&&M!=="value"&&M!=="null"&&M!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");v=!0,p.push({content:I,scale:null,font:null,textColor:null})}}return new na(p)}evaluate(t){return new or(this.sections.map(r=>{const l=r.content.evaluate(t);return gi(l)===en?new yl("",l,null,null,null):new yl(uo(l),null,r.scale?r.scale.evaluate(t):null,r.font?r.font.evaluate(t).join(","):null,r.textColor?r.textColor.evaluate(t):null)}))}eachChild(t){for(const r of this.sections)t(r.content),r.scale&&t(r.scale),r.font&&t(r.font),r.textColor&&t(r.textColor)}outputDefined(){return!1}}class Il{constructor(t){this.type=en,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected two arguments.");const l=r.parse(t[1],1,pt);return l?new Il(l):r.error("No image name provided.")}evaluate(t){const r=this.input.evaluate(t),l=lr.fromString(r);return l&&t.availableImages&&(l.available=t.availableImages.indexOf(r)>-1),l}eachChild(t){t(this.input)}outputDefined(){return!1}}class Cl{constructor(t){this.type=Te,this.input=t}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);const l=r.parse(t[1],1);return l?l.type.kind!=="array"&&l.type.kind!=="string"&&l.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${F(l.type)} instead.`):new Cl(l):null}evaluate(t){const r=this.input.evaluate(t);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new ui(`Expected value to be of type string or array, but found ${F(gi(r))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const tn=8192;function Ku(i,t){const r=(180+i[0])/360,l=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,p=Math.pow(2,t.z);return[Math.round(r*p*tn),Math.round(l*p*tn)]}function Sl(i,t){const r=Math.pow(2,t.z);return[(p=(i[0]/tn+t.x)/r,360*p-180),(l=(i[1]/tn+t.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*l)*Math.PI/180))-90)];var l,p}function Wn(i,t){i[0]=Math.min(i[0],t[0]),i[1]=Math.min(i[1],t[1]),i[2]=Math.max(i[2],t[0]),i[3]=Math.max(i[3],t[1])}function Tn(i,t){return!(i[0]<=t[0]||i[2]>=t[2]||i[1]<=t[1]||i[3]>=t[3])}function At(i,t,r){const l=i[0]-t[0],p=i[1]-t[1],v=i[0]-r[0],x=i[1]-r[1];return l*x-v*p==0&&l*v<=0&&p*x<=0}function sa(i,t,r,l){return(p=[l[0]-r[0],l[1]-r[1]])[0]*(v=[t[0]-i[0],t[1]-i[1]])[1]-p[1]*v[0]!=0&&!(!cc(i,t,r,l)||!cc(r,l,i,t));var p,v}function Yu(i,t,r){for(const l of r)for(let p=0;p(p=i)[1]!=(x=b[I+1])[1]>p[1]&&p[0]<(x[0]-v[0])*(p[1]-v[1])/(x[1]-v[1])+v[0]&&(l=!l)}var p,v,x;return l}function Qu(i,t){for(const r of t)if(vs(i,r))return!0;return!1}function hc(i,t){for(const r of i)if(!vs(r,t))return!1;for(let r=0;r0&&b<0||x<0&&b>0}function Ml(i,t,r){const l=[];for(let p=0;pr[2]){const p=.5*l;let v=i[0]-r[0]>p?-l:r[0]-i[0]>p?l:0;v===0&&(v=i[0]-r[2]>p?-l:r[2]-i[0]>p?l:0),i[0]+=v}Wn(t,i)}function pc(i,t,r,l){const p=Math.pow(2,l.z)*tn,v=[l.x*tn,l.y*tn],x=[];for(const b of i)for(const I of b){const M=[I.x+v[0],I.y+v[1]];dc(M,t,r,p),x.push(M)}return x}function fc(i,t,r,l){const p=Math.pow(2,l.z)*tn,v=[l.x*tn,l.y*tn],x=[];for(const I of i){const M=[];for(const E of I){const A=[E.x+v[0],E.y+v[1]];Wn(t,A),M.push(A)}x.push(M)}if(t[2]-t[0]<=p/2){(b=t)[0]=b[1]=1/0,b[2]=b[3]=-1/0;for(const I of x)for(const M of I)dc(M,t,r,p)}var b;return x}class Hn{constructor(t,r){this.type=rt,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Zn(t[1])){const l=t[1];if(l.type==="FeatureCollection"){const p=[];for(const v of l.features){const{type:x,coordinates:b}=v.geometry;x==="Polygon"&&p.push(b),x==="MultiPolygon"&&p.push(...b)}if(p.length)return new Hn(l,{type:"MultiPolygon",coordinates:p})}else if(l.type==="Feature"){const p=l.geometry.type;if(p==="Polygon"||p==="MultiPolygon")return new Hn(l,l.geometry)}else if(l.type==="Polygon"||l.type==="MultiPolygon")return new Hn(l,l)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(r,l){const p=[1/0,1/0,-1/0,-1/0],v=[1/0,1/0,-1/0,-1/0],x=r.canonicalID();if(l.type==="Polygon"){const b=Ml(l.coordinates,v,x),I=pc(r.geometry(),p,v,x);if(!Tn(p,v))return!1;for(const M of I)if(!vs(M,b))return!1}if(l.type==="MultiPolygon"){const b=uc(l.coordinates,v,x),I=pc(r.geometry(),p,v,x);if(!Tn(p,v))return!1;for(const M of I)if(!Qu(M,b))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,l){const p=[1/0,1/0,-1/0,-1/0],v=[1/0,1/0,-1/0,-1/0],x=r.canonicalID();if(l.type==="Polygon"){const b=Ml(l.coordinates,v,x),I=fc(r.geometry(),p,v,x);if(!Tn(p,v))return!1;for(const M of I)if(!hc(M,b))return!1}if(l.type==="MultiPolygon"){const b=uc(l.coordinates,v,x),I=fc(r.geometry(),p,v,x);if(!Tn(p,v))return!1;for(const M of I)if(!ed(M,b))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let mc=class{constructor(i=[],t=(r,l)=>rl?1:0){if(this.data=i,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(i){this.data.push(i),this._up(this.length++)}pop(){if(this.length===0)return;const i=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),i}peek(){return this.data[0]}_up(i){const{data:t,compare:r}=this,l=t[i];for(;i>0;){const p=i-1>>1,v=t[p];if(r(l,v)>=0)break;t[i]=v,i=p}t[i]=l}_down(i){const{data:t,compare:r}=this,l=this.length>>1,p=t[i];for(;i=0)break;t[i]=t[v],i=v}t[i]=p}};function td(i,t,r,l,p){gc(i,t,r,l||i.length-1,p||id)}function gc(i,t,r,l,p){for(;l>r;){if(l-r>600){var v=l-r+1,x=t-r+1,b=Math.log(v),I=.5*Math.exp(2*b/3),M=.5*Math.sqrt(b*I*(v-I)/v)*(x-v/2<0?-1:1);gc(i,t,Math.max(r,Math.floor(t-x*I/v+M)),Math.min(l,Math.floor(t+(v-x)*I/v+M)),p)}var E=i[t],A=r,D=l;for(go(i,r,t),p(i[l],E)>0&&go(i,r,l);A0;)D--}p(i[r],E)===0?go(i,r,D):go(i,++D,l),D<=t&&(r=D+1),t<=D&&(l=D-1)}}function go(i,t,r){var l=i[t];i[t]=i[r],i[r]=l}function id(i,t){return it?1:0}function oa(i,t){if(i.length<=1)return[i];const r=[];let l,p;for(const v of i){const x=nd(v);x!==0&&(v.area=Math.abs(x),p===void 0&&(p=x<0),p===x<0?(l&&r.push(l),l=[v]):l.push(v))}if(l&&r.push(l),t>1)for(let v=0;v1?(M=t[I+1][0],E=t[I+1][1]):O>0&&(M+=A/this.kx*O,E+=D/this.ky*O)),A=this.wrap(r[0]-M)*this.kx,D=(r[1]-E)*this.ky;const j=A*A+D*D;j180;)t-=360;return t}}function xc(i,t){return t[0]-i[0]}function aa(i){return i[1]-i[0]+1}function gn(i,t){return i[1]>=i[0]&&i[1]i[1])return[null,null];const r=aa(i);if(t){if(r===2)return[i,null];const p=Math.floor(r/2);return[[i[0],i[0]+p],[i[0]+p,i[1]]]}if(r===1)return[i,null];const l=Math.floor(r/2)-1;return[[i[0],i[0]+l],[i[0]+l+1,i[1]]]}function Tl(i,t){if(!gn(t,i.length))return[1/0,1/0,-1/0,-1/0];const r=[1/0,1/0,-1/0,-1/0];for(let l=t[0];l<=t[1];++l)Wn(r,i[l]);return r}function Al(i){const t=[1/0,1/0,-1/0,-1/0];for(const r of i)for(const l of r)Wn(t,l);return t}function la(i){return i[0]!==-1/0&&i[1]!==-1/0&&i[2]!==1/0&&i[3]!==1/0}function zl(i,t,r){if(!la(i)||!la(t))return NaN;let l=0,p=0;return i[2]t[2]&&(l=i[0]-t[2]),i[1]>t[3]&&(p=i[1]-t[3]),i[3]=l)return l;if(Tn(p,v)){if(ha(i,t))return 0}else if(ha(t,i))return 0;let x=1/0;for(const b of i)for(let I=0,M=b.length,E=M-1;I0;){const I=x.pop();if(I[0]>=v)continue;const M=I[1],E=t?50:100;if(aa(M)<=E){if(!gn(M,i.length))return NaN;if(t){const A=mt(i,M,r,l);if(isNaN(A)||A===0)return A;v=Math.min(v,A)}else for(let A=M[0];A<=M[1];++A){const D=od(i[A],r,l);if(v=Math.min(v,D),v===0)return 0}}else{const A=El(M,t);Ot(x,v,l,i,b,A[0]),Ot(x,v,l,i,b,A[1])}}return v}function _o(i,t,r,l,p,v=1/0){let x=Math.min(v,p.distance(i[0],r[0]));if(x===0)return x;const b=new mc([[0,[0,i.length-1],[0,r.length-1]]],xc);for(;b.length>0;){const I=b.pop();if(I[0]>=x)continue;const M=I[1],E=I[2],A=t?50:100,D=l?50:100;if(aa(M)<=A&&aa(E)<=D){if(!gn(M,i.length)&&gn(E,r.length))return NaN;let O;if(t&&l)O=sd(i,M,r,E,p),x=Math.min(x,O);else if(t&&!l){const j=i.slice(M[0],M[1]+1);for(let $=E[0];$<=E[1];++$)if(O=Jn(r[$],j,p),x=Math.min(x,O),x===0)return x}else if(!t&&l){const j=r.slice(E[0],E[1]+1);for(let $=M[0];$<=M[1];++$)if(O=Jn(i[$],j,p),x=Math.min(x,O),x===0)return x}else O=ai(i,M,r,E,p),x=Math.min(x,O)}else{const O=El(M,t),j=El(E,l);Kn(b,x,p,i,r,O[0],j[0]),Kn(b,x,p,i,r,O[0],j[1]),Kn(b,x,p,i,r,O[1],j[0]),Kn(b,x,p,i,r,O[1],j[1])}}return x}function Dl(i){return i.type==="MultiPolygon"?i.coordinates.map(t=>({type:"Polygon",coordinates:t})):i.type==="MultiLineString"?i.coordinates.map(t=>({type:"LineString",coordinates:t})):i.type==="MultiPoint"?i.coordinates.map(t=>({type:"Point",coordinates:t})):[i]}class Yn{constructor(t,r){this.type=Te,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Zn(t[1])){const l=t[1];if(l.type==="FeatureCollection")return new Yn(l,l.features.map(p=>Dl(p.geometry)).flat());if(l.type==="Feature")return new Yn(l,Dl(l.geometry));if("type"in l&&"coordinates"in l)return new Yn(l,Dl(l))}return r.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(r,l){const p=r.geometry(),v=p.flat().map(I=>Sl([I.x,I.y],r.canonical));if(p.length===0)return NaN;const x=new Pl(v[0][1]);let b=1/0;for(const I of l){switch(I.type){case"Point":b=Math.min(b,_o(v,!1,[I.coordinates],!1,x,b));break;case"LineString":b=Math.min(b,_o(v,!1,I.coordinates,!0,x,b));break;case"Polygon":b=Math.min(b,yo(v,!1,I.coordinates,x,b))}if(b===0)return b}return b}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,l){const p=r.geometry(),v=p.flat().map(I=>Sl([I.x,I.y],r.canonical));if(p.length===0)return NaN;const x=new Pl(v[0][1]);let b=1/0;for(const I of l){switch(I.type){case"Point":b=Math.min(b,_o(v,!0,[I.coordinates],!1,x,b));break;case"LineString":b=Math.min(b,_o(v,!0,I.coordinates,!0,x,b));break;case"Polygon":b=Math.min(b,yo(v,!0,I.coordinates,x,b))}if(b===0)return b}return b}(t,this.geometries);if(t.geometryType()==="Polygon")return function(r,l){const p=r.geometry();if(p.length===0||p[0].length===0)return NaN;const v=oa(p,0).map(I=>I.map(M=>M.map(E=>Sl([E.x,E.y],r.canonical)))),x=new Pl(v[0][0][0][1]);let b=1/0;for(const I of l)for(const M of v){switch(I.type){case"Point":b=Math.min(b,yo([I.coordinates],!1,M,x,b));break;case"LineString":b=Math.min(b,yo(I.coordinates,!0,M,x,b));break;case"Polygon":b=Math.min(b,Gt(M,I.coordinates,x,b))}if(b===0)return b}return b}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const xs={"==":Wu,"!=":oc,">":Hu,"<":ac,">=":lc,"<=":Ju,array:Br,at:vl,boolean:Br,case:Qo,coalesce:ia,collator:mo,format:na,image:Il,in:xl,"index-of":gs,interpolate:Hi,"interpolate-hcl":Hi,"interpolate-lab":Hi,length:Cl,let:En,literal:Lr,match:bl,number:Br,"number-format":wl,object:Br,slice:po,step:ys,string:Br,"to-boolean":Fr,"to-color":Fr,"to-number":Fr,"to-string":Fr,var:Tt,within:Hn,distance:Yn};class br{constructor(t,r,l,p){this.name=t,this.type=r,this._evaluate=l,this.args=p}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,r){const l=t[0],p=br.definitions[l];if(!p)return r.error(`Unknown expression "${l}". If you wanted a literal array, use ["literal", [...]].`,0);const v=Array.isArray(p)?p[0]:p.type,x=Array.isArray(p)?[[p[1],p[2]]]:p.overloads,b=x.filter(([M])=>!Array.isArray(M)||M.length===t.length-1);let I=null;for(const[M,E]of b){I=new Gn(r.registry,vo,r.path,null,r.scope);const A=[];let D=!1;for(let O=1;O{return D=A,Array.isArray(D)?`(${D.map(F).join(", ")})`:`(${F(D.type)}...)`;var D}).join(" | "),E=[];for(let A=1;A{r=t?r&&vo(l):r&&l instanceof Lr}),!!r&&xo(i)&&bo(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function xo(i){if(i instanceof br&&(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 Hn||i instanceof Yn)return!1;let t=!0;return i.eachChild(r=>{t&&!xo(r)&&(t=!1)}),t}function bs(i){if(i instanceof br&&i.name==="feature-state")return!1;let t=!0;return i.eachChild(r=>{t&&!bs(r)&&(t=!1)}),t}function bo(i,t){if(i instanceof br&&t.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(l=>{r&&!bo(l,t)&&(r=!1)}),r}function ca(i){return{result:"success",value:i}}function ws(i){return{result:"error",value:i}}function Is(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function bc(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function Rl(i){return!!i.expression&&i.expression.interpolated}function Mt(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function ua(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function ad(i){return i}function wc(i,t){const r=t.type==="color",l=i.stops&&typeof i.stops[0][0]=="object",p=l||!(l||i.property!==void 0),v=i.type||(Rl(t)?"exponential":"interval");if(r||t.type==="padding"){const E=r?Lt.parse:ar.parse;(i=Kr({},i)).stops&&(i.stops=i.stops.map(A=>[A[0],E(A[1])])),i.default=E(i.default?i.default:t.default)}if(i.colorSpace&&(x=i.colorSpace)!=="rgb"&&x!=="hcl"&&x!=="lab")throw new Error(`Unknown color space: "${i.colorSpace}"`);var x;let b,I,M;if(v==="exponential")b=Cc;else if(v==="interval")b=da;else if(v==="categorical"){b=Ic,I=Object.create(null);for(const E of i.stops)I[E[0]]=E[1];M=typeof i.stops[0][0]}else{if(v!=="identity")throw new Error(`Unknown function type "${v}"`);b=Sc}if(l){const E={},A=[];for(let j=0;jj[0]),evaluate:({zoom:j},$)=>Cc({stops:D,base:i.base},t,j).evaluate(j,$)}}if(p){const E=v==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:E,interpolationFactor:Hi.interpolationFactor.bind(void 0,E),zoomStops:i.stops.map(A=>A[0]),evaluate:({zoom:A})=>b(i,t,A,I,M)}}return{kind:"source",evaluate(E,A){const D=A&&A.properties?A.properties[i.property]:void 0;return D===void 0?Cs(i.default,t.default):b(i,t,D,I,M)}}}function Cs(i,t,r){return i!==void 0?i:t!==void 0?t:r!==void 0?r:void 0}function Ic(i,t,r,l,p){return Cs(typeof r===p?l[r]:void 0,i.default,t.default)}function da(i,t,r){if(Mt(r)!=="number")return Cs(i.default,t.default);const l=i.stops.length;if(l===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[l-1][0])return i.stops[l-1][1];const p=ea(i.stops.map(v=>v[0]),r);return i.stops[p][1]}function Cc(i,t,r){const l=i.base!==void 0?i.base:1;if(Mt(r)!=="number")return Cs(i.default,t.default);const p=i.stops.length;if(p===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[p-1][0])return i.stops[p-1][1];const v=ea(i.stops.map(E=>E[0]),r),x=function(E,A,D,O){const j=O-D,$=E-D;return j===0?0:A===1?$/j:(Math.pow(A,$)-1)/(Math.pow(A,j)-1)}(r,l,i.stops[v][0],i.stops[v+1][0]),b=i.stops[v][1],I=i.stops[v+1][1],M=Wi[t.type]||ad;return typeof b.evaluate=="function"?{evaluate(...E){const A=b.evaluate.apply(void 0,E),D=I.evaluate.apply(void 0,E);if(A!==void 0&&D!==void 0)return M(A,D,x,i.colorSpace)}}:M(b,I,x,i.colorSpace)}function Sc(i,t,r){switch(t.type){case"color":r=Lt.parse(r);break;case"formatted":r=or.fromString(r.toString());break;case"resolvedImage":r=lr.fromString(r.toString());break;case"padding":r=ar.parse(r);break;default:Mt(r)===t.type||t.type==="enum"&&t.values[r]||(r=void 0)}return Cs(r,i.default,t.default)}br.register(xs,{error:[{kind:"error"},[pt],(i,[t])=>{throw new ui(t.evaluate(i))}],typeof:[pt,[lt],(i,[t])=>F(gi(t.evaluate(i)))],"to-rgba":[R(Te,4),[Xi],(i,[t])=>{const[r,l,p,v]=t.evaluate(i).rgb;return[255*r,255*l,255*p,v]}],rgb:[Xi,[Te,Te,Te],Ll],rgba:[Xi,[Te,Te,Te,Te],Ll],has:{type:rt,overloads:[[[pt],(i,[t])=>Bl(t.evaluate(i),i.properties())],[[pt,Dr],(i,[t,r])=>Bl(t.evaluate(i),r.evaluate(i))]]},get:{type:lt,overloads:[[[pt],(i,[t])=>Fl(t.evaluate(i),i.properties())],[[pt,Dr],(i,[t,r])=>Fl(t.evaluate(i),r.evaluate(i))]]},"feature-state":[lt,[pt],(i,[t])=>Fl(t.evaluate(i),i.featureState||{})],properties:[Dr,[],i=>i.properties()],"geometry-type":[pt,[],i=>i.geometryType()],id:[lt,[],i=>i.id()],zoom:[Te,[],i=>i.globals.zoom],"heatmap-density":[Te,[],i=>i.globals.heatmapDensity||0],"line-progress":[Te,[],i=>i.globals.lineProgress||0],accumulated:[lt,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Te,Qn(Te),(i,t)=>{let r=0;for(const l of t)r+=l.evaluate(i);return r}],"*":[Te,Qn(Te),(i,t)=>{let r=1;for(const l of t)r*=l.evaluate(i);return r}],"-":{type:Te,overloads:[[[Te,Te],(i,[t,r])=>t.evaluate(i)-r.evaluate(i)],[[Te],(i,[t])=>-t.evaluate(i)]]},"/":[Te,[Te,Te],(i,[t,r])=>t.evaluate(i)/r.evaluate(i)],"%":[Te,[Te,Te],(i,[t,r])=>t.evaluate(i)%r.evaluate(i)],ln2:[Te,[],()=>Math.LN2],pi:[Te,[],()=>Math.PI],e:[Te,[],()=>Math.E],"^":[Te,[Te,Te],(i,[t,r])=>Math.pow(t.evaluate(i),r.evaluate(i))],sqrt:[Te,[Te],(i,[t])=>Math.sqrt(t.evaluate(i))],log10:[Te,[Te],(i,[t])=>Math.log(t.evaluate(i))/Math.LN10],ln:[Te,[Te],(i,[t])=>Math.log(t.evaluate(i))],log2:[Te,[Te],(i,[t])=>Math.log(t.evaluate(i))/Math.LN2],sin:[Te,[Te],(i,[t])=>Math.sin(t.evaluate(i))],cos:[Te,[Te],(i,[t])=>Math.cos(t.evaluate(i))],tan:[Te,[Te],(i,[t])=>Math.tan(t.evaluate(i))],asin:[Te,[Te],(i,[t])=>Math.asin(t.evaluate(i))],acos:[Te,[Te],(i,[t])=>Math.acos(t.evaluate(i))],atan:[Te,[Te],(i,[t])=>Math.atan(t.evaluate(i))],min:[Te,Qn(Te),(i,t)=>Math.min(...t.map(r=>r.evaluate(i)))],max:[Te,Qn(Te),(i,t)=>Math.max(...t.map(r=>r.evaluate(i)))],abs:[Te,[Te],(i,[t])=>Math.abs(t.evaluate(i))],round:[Te,[Te],(i,[t])=>{const r=t.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Te,[Te],(i,[t])=>Math.floor(t.evaluate(i))],ceil:[Te,[Te],(i,[t])=>Math.ceil(t.evaluate(i))],"filter-==":[rt,[pt,lt],(i,[t,r])=>i.properties()[t.value]===r.value],"filter-id-==":[rt,[lt],(i,[t])=>i.id()===t.value],"filter-type-==":[rt,[pt],(i,[t])=>i.geometryType()===t.value],"filter-<":[rt,[pt,lt],(i,[t,r])=>{const l=i.properties()[t.value],p=r.value;return typeof l==typeof p&&l{const r=i.id(),l=t.value;return typeof r==typeof l&&r":[rt,[pt,lt],(i,[t,r])=>{const l=i.properties()[t.value],p=r.value;return typeof l==typeof p&&l>p}],"filter-id->":[rt,[lt],(i,[t])=>{const r=i.id(),l=t.value;return typeof r==typeof l&&r>l}],"filter-<=":[rt,[pt,lt],(i,[t,r])=>{const l=i.properties()[t.value],p=r.value;return typeof l==typeof p&&l<=p}],"filter-id-<=":[rt,[lt],(i,[t])=>{const r=i.id(),l=t.value;return typeof r==typeof l&&r<=l}],"filter->=":[rt,[pt,lt],(i,[t,r])=>{const l=i.properties()[t.value],p=r.value;return typeof l==typeof p&&l>=p}],"filter-id->=":[rt,[lt],(i,[t])=>{const r=i.id(),l=t.value;return typeof r==typeof l&&r>=l}],"filter-has":[rt,[lt],(i,[t])=>t.value in i.properties()],"filter-has-id":[rt,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[rt,[R(pt)],(i,[t])=>t.value.indexOf(i.geometryType())>=0],"filter-id-in":[rt,[R(lt)],(i,[t])=>t.value.indexOf(i.id())>=0],"filter-in-small":[rt,[pt,R(lt)],(i,[t,r])=>r.value.indexOf(i.properties()[t.value])>=0],"filter-in-large":[rt,[pt,R(lt)],(i,[t,r])=>function(l,p,v,x){for(;v<=x;){const b=v+x>>1;if(p[b]===l)return!0;p[b]>l?x=b-1:v=b+1}return!1}(i.properties()[t.value],r.value,0,r.value.length-1)],all:{type:rt,overloads:[[[rt,rt],(i,[t,r])=>t.evaluate(i)&&r.evaluate(i)],[Qn(rt),(i,t)=>{for(const r of t)if(!r.evaluate(i))return!1;return!0}]]},any:{type:rt,overloads:[[[rt,rt],(i,[t,r])=>t.evaluate(i)||r.evaluate(i)],[Qn(rt),(i,t)=>{for(const r of t)if(r.evaluate(i))return!0;return!1}]]},"!":[rt,[rt],(i,[t])=>!t.evaluate(i)],"is-supported-script":[rt,[pt],(i,[t])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(t.evaluate(i))}],upcase:[pt,[pt],(i,[t])=>t.evaluate(i).toUpperCase()],downcase:[pt,[pt],(i,[t])=>t.evaluate(i).toLowerCase()],concat:[pt,Qn(lt),(i,t)=>t.map(r=>uo(r.evaluate(i))).join("")],"resolved-locale":[pt,[Qr],(i,[t])=>t.evaluate(i).resolvedLocale()]});class pa{constructor(t,r){var l;this.expression=t,this._warningHistory={},this._evaluator=new Yo,this._defaultValue=r?(l=r).type==="color"&&ua(l.default)?new Lt(0,0,0,0):l.type==="color"?Lt.parse(l.default)||null:l.type==="padding"?ar.parse(l.default)||null:l.type==="variableAnchorOffsetCollection"?xr.parse(l.default)||null:l.default===void 0?null:l.default:null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(t,r,l,p,v,x){return this._evaluator.globals=t,this._evaluator.feature=r,this._evaluator.featureState=l,this._evaluator.canonical=p,this._evaluator.availableImages=v||null,this._evaluator.formattedSection=x,this.expression.evaluate(this._evaluator)}evaluate(t,r,l,p,v,x){this._evaluator.globals=t,this._evaluator.feature=r||null,this._evaluator.featureState=l||null,this._evaluator.canonical=p,this._evaluator.availableImages=v||null,this._evaluator.formattedSection=x||null;try{const b=this.expression.evaluate(this._evaluator);if(b==null||typeof b=="number"&&b!=b)return this._defaultValue;if(this._enumValues&&!(b in this._enumValues))throw new ui(`Expected value to be one of ${Object.keys(this._enumValues).map(I=>JSON.stringify(I)).join(", ")}, but found ${JSON.stringify(b)} instead.`);return b}catch(b){return this._warningHistory[b.message]||(this._warningHistory[b.message]=!0,typeof console<"u"&&console.warn(b.message)),this._defaultValue}}}function fa(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in xs}function Ss(i,t){const r=new Gn(xs,vo,[],t?function(p){const v={color:Xi,string:pt,number:Te,enum:pt,boolean:rt,formatted:mn,padding:Pn,resolvedImage:en,variableAnchorOffsetCollection:K};return p.type==="array"?R(v[p.value]||lt,p.length):v[p.type]}(t):void 0),l=r.parse(i,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return l?ca(new pa(l,t)):ws(r.errors)}class Ms{constructor(t,r){this.kind=t,this._styleExpression=r,this.isStateDependent=t!=="constant"&&!bs(r.expression)}evaluateWithoutErrorHandling(t,r,l,p,v,x){return this._styleExpression.evaluateWithoutErrorHandling(t,r,l,p,v,x)}evaluate(t,r,l,p,v,x){return this._styleExpression.evaluate(t,r,l,p,v,x)}}class Ps{constructor(t,r,l,p){this.kind=t,this.zoomStops=l,this._styleExpression=r,this.isStateDependent=t!=="camera"&&!bs(r.expression),this.interpolationType=p}evaluateWithoutErrorHandling(t,r,l,p,v,x){return this._styleExpression.evaluateWithoutErrorHandling(t,r,l,p,v,x)}evaluate(t,r,l,p,v,x){return this._styleExpression.evaluate(t,r,l,p,v,x)}interpolationFactor(t,r,l){return this.interpolationType?Hi.interpolationFactor(this.interpolationType,t,r,l):0}}function Ol(i,t){const r=Ss(i,t);if(r.result==="error")return r;const l=r.value.expression,p=xo(l);if(!p&&!Is(t))return ws([new Vi("","data expressions not supported")]);const v=bo(l,["zoom"]);if(!v&&!bc(t))return ws([new Vi("","zoom expressions not supported")]);const x=wo(l);return x||v?x instanceof Vi?ws([x]):x instanceof Hi&&!Rl(t)?ws([new Vi("",'"interpolate" expressions cannot be used with this property')]):ca(x?new Ps(p?"camera":"composite",r.value,x.labels,x instanceof Hi?x.interpolation:void 0):new Ms(p?"constant":"source",r.value)):ws([new Vi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Es{constructor(t,r){this._parameters=t,this._specification=r,Kr(this,wc(this._parameters,this._specification))}static deserialize(t){return new Es(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function wo(i){let t=null;if(i instanceof En)t=wo(i.result);else if(i instanceof ia){for(const r of i.args)if(t=wo(r),t)break}else(i instanceof ys||i instanceof Hi)&&i.input instanceof br&&i.input.name==="zoom"&&(t=i);return t instanceof Vi||i.eachChild(r=>{const l=wo(r);l instanceof Vi?t=l:!t&&l?t=new Vi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&l&&t!==l&&(t=new Vi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function ma(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 t of i.slice(1))if(!ma(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}const ga={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Vl(i){if(i==null)return{filter:()=>!0,needGeometry:!1};ma(i)||(i=ya(i));const t=Ss(i,ga);if(t.result==="error")throw new Error(t.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,l,p)=>t.value.evaluate(r,l,{},p),needGeometry:Mc(i)}}function ld(i,t){return it?1:0}function Mc(i){if(!Array.isArray(i))return!1;if(i[0]==="within"||i[0]==="distance")return!0;for(let t=1;t"||t==="<="||t===">="?Nl(i[1],i[2],t):t==="any"?(r=i.slice(1),["any"].concat(r.map(ya))):t==="all"?["all"].concat(i.slice(1).map(ya)):t==="none"?["all"].concat(i.slice(1).map(ya).map(zi)):t==="in"?Io(i[1],i.slice(2)):t==="!in"?zi(Io(i[1],i.slice(2))):t==="has"?Co(i[1]):t!=="!has"||zi(Co(i[1]));var r}function Nl(i,t,r){switch(i){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,i,t]}}function Io(i,t){if(t.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(r=>typeof r!=typeof t[0])?["filter-in-large",i,["literal",t.sort(ld)]]:["filter-in-small",i,["literal",t]]}}function Co(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function zi(i){return["!",i]}function es(i){const t=typeof i;if(t==="number"||t==="boolean"||t==="string"||i==null)return JSON.stringify(i);if(Array.isArray(i)){let p="[";for(const v of i)p+=`${es(v)},`;return`${p}]`}const r=Object.keys(i).sort();let l="{";for(let p=0;pl.maximum?[new Ce(t,r,`${r} is greater than the maximum value ${l.maximum}`)]:[]}function _a(i){const t=i.valueSpec,r=li(i.value.type);let l,p,v,x={};const b=r!=="categorical"&&i.value.property===void 0,I=!b,M=Mt(i.value.stops)==="array"&&Mt(i.value.stops[0])==="array"&&Mt(i.value.stops[0][0])==="object",E=hr({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(O){if(r==="identity")return[new Ce(O.key,O.value,'identity function may not have a "stops" property')];let j=[];const $=O.value;return j=j.concat(So({key:O.key,value:$,valueSpec:O.valueSpec,validateSpec:O.validateSpec,style:O.style,styleSpec:O.styleSpec,arrayElementValidator:A})),Mt($)==="array"&&$.length===0&&j.push(new Ce(O.key,$,"array must have at least one stop")),j},default:function(O){return O.validateSpec({key:O.key,value:O.value,valueSpec:t,validateSpec:O.validateSpec,style:O.style,styleSpec:O.styleSpec})}}});return r==="identity"&&b&&E.push(new Ce(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||E.push(new Ce(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!Rl(i.valueSpec)&&E.push(new Ce(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(I&&!Is(i.valueSpec)?E.push(new Ce(i.key,i.value,"property functions not supported")):b&&!bc(i.valueSpec)&&E.push(new Ce(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!M||i.value.property!==void 0||E.push(new Ce(i.key,i.value,'"property" property is required')),E;function A(O){let j=[];const $=O.value,W=O.key;if(Mt($)!=="array")return[new Ce(W,$,`array expected, ${Mt($)} found`)];if($.length!==2)return[new Ce(W,$,`array length 2 expected, length ${$.length} found`)];if(M){if(Mt($[0])!=="object")return[new Ce(W,$,`object expected, ${Mt($[0])} found`)];if($[0].zoom===void 0)return[new Ce(W,$,"object stop key must have zoom")];if($[0].value===void 0)return[new Ce(W,$,"object stop key must have value")];if(v&&v>li($[0].zoom))return[new Ce(W,$[0].zoom,"stop zoom values must appear in ascending order")];li($[0].zoom)!==v&&(v=li($[0].zoom),p=void 0,x={}),j=j.concat(hr({key:`${W}[0]`,value:$[0],valueSpec:{zoom:{}},validateSpec:O.validateSpec,style:O.style,styleSpec:O.styleSpec,objectElementValidators:{zoom:Ul,value:D}}))}else j=j.concat(D({key:`${W}[0]`,value:$[0],valueSpec:{},validateSpec:O.validateSpec,style:O.style,styleSpec:O.styleSpec},$));return fa(Rr($[1]))?j.concat([new Ce(`${W}[1]`,$[1],"expressions are not allowed in function stops.")]):j.concat(O.validateSpec({key:`${W}[1]`,value:$[1],valueSpec:t,validateSpec:O.validateSpec,style:O.style,styleSpec:O.styleSpec}))}function D(O,j){const $=Mt(O.value),W=li(O.value),Y=O.value!==null?O.value:j;if(l){if($!==l)return[new Ce(O.key,Y,`${$} stop domain type must match previous stop domain type ${l}`)]}else l=$;if($!=="number"&&$!=="string"&&$!=="boolean")return[new Ce(O.key,Y,"stop domain value must be a number, string, or boolean")];if($!=="number"&&r!=="categorical"){let ce=`number expected, ${$} found`;return Is(t)&&r===void 0&&(ce+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ce(O.key,Y,ce)]}return r!=="categorical"||$!=="number"||isFinite(W)&&Math.floor(W)===W?r!=="categorical"&&$==="number"&&p!==void 0&&Wnew Ce(`${i.key}${l.key}`,i.value,l.message));const r=t.value.expression||t.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new Ce(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"&&!bs(r))return[new Ce(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!bs(r))return[new Ce(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!bo(r,["zoom","feature-state"]))return[new Ce(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!xo(r))return[new Ce(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function yn(i){const t=i.key,r=i.value,l=i.valueSpec,p=[];return Array.isArray(l.values)?l.values.indexOf(li(r))===-1&&p.push(new Ce(t,r,`expected one of [${l.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(l.values).indexOf(li(r))===-1&&p.push(new Ce(t,r,`expected one of [${Object.keys(l.values).join(", ")}], ${JSON.stringify(r)} found`)),p}function jl(i){return ma(Rr(i.value))?Ts(Kr({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):va(i)}function va(i){const t=i.value,r=i.key;if(Mt(t)!=="array")return[new Ce(r,t,`array expected, ${Mt(t)} found`)];const l=i.styleSpec;let p,v=[];if(t.length<1)return[new Ce(r,t,"filter array must have at least 1 element")];switch(v=v.concat(yn({key:`${r}[0]`,value:t[0],valueSpec:l.filter_operator,style:i.style,styleSpec:i.styleSpec})),li(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&li(t[1])==="$type"&&v.push(new Ce(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&v.push(new Ce(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(p=Mt(t[1]),p!=="string"&&v.push(new Ce(`${r}[1]`,t[1],`string expected, ${p} found`)));for(let x=2;x{M in r&&t.push(new Ce(l,r[M],`"${M}" is prohibited for ref layers`))}),p.layers.forEach(M=>{li(M.id)===b&&(I=M)}),I?I.ref?t.push(new Ce(l,r.ref,"ref cannot reference another ref layer")):x=li(I.type):t.push(new Ce(l,r.ref,`ref layer "${b}" not found`))}else if(x!=="background")if(r.source){const I=p.sources&&p.sources[r.source],M=I&&li(I.type);I?M==="vector"&&x==="raster"?t.push(new Ce(l,r.source,`layer "${r.id}" requires a raster source`)):M!=="raster-dem"&&x==="hillshade"?t.push(new Ce(l,r.source,`layer "${r.id}" requires a raster-dem source`)):M==="raster"&&x!=="raster"?t.push(new Ce(l,r.source,`layer "${r.id}" requires a vector source`)):M!=="vector"||r["source-layer"]?M==="raster-dem"&&x!=="hillshade"?t.push(new Ce(l,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):x!=="line"||!r.paint||!r.paint["line-gradient"]||M==="geojson"&&I.lineMetrics||t.push(new Ce(l,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new Ce(l,r,`layer "${r.id}" must specify a "source-layer"`)):t.push(new Ce(l,r.source,`source "${r.source}" not found`))}else t.push(new Ce(l,r,'missing required property "source"'));return t=t.concat(hr({key:l,value:r,valueSpec:v.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${l}.type`,value:r.type,valueSpec:v.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:jl,layout:I=>hr({layer:r,key:I.key,value:I.value,style:I.style,styleSpec:I.styleSpec,validateSpec:I.validateSpec,objectElementValidators:{"*":M=>ql(Kr({layerType:x},M))}}),paint:I=>hr({layer:r,key:I.key,value:I.value,style:I.style,styleSpec:I.styleSpec,validateSpec:I.validateSpec,objectElementValidators:{"*":M=>xa(Kr({layerType:x},M))}})}})),t}function ts(i){const t=i.value,r=i.key,l=Mt(t);return l!=="string"?[new Ce(r,t,`string expected, ${l} found`)]:[]}const ba={promoteId:function({key:i,value:t}){if(Mt(t)==="string")return ts({key:i,value:t});{const r=[];for(const l in t)r.push(...ts({key:`${i}.${l}`,value:t[l]}));return r}}};function Mo(i){const t=i.value,r=i.key,l=i.styleSpec,p=i.style,v=i.validateSpec;if(!t.type)return[new Ce(r,t,'"type" is required')];const x=li(t.type);let b;switch(x){case"vector":case"raster":return b=hr({key:r,value:t,valueSpec:l[`source_${x.replace("-","_")}`],style:i.style,styleSpec:l,objectElementValidators:ba,validateSpec:v}),b;case"raster-dem":return b=function(I){var M;const E=(M=I.sourceName)!==null&&M!==void 0?M:"",A=I.value,D=I.styleSpec,O=D.source_raster_dem,j=I.style;let $=[];const W=Mt(A);if(A===void 0)return $;if(W!=="object")return $.push(new Ce("source_raster_dem",A,`object expected, ${W} found`)),$;const Y=li(A.encoding)==="custom",ce=["redFactor","greenFactor","blueFactor","baseShift"],re=I.value.encoding?`"${I.value.encoding}"`:"Default";for(const le in A)!Y&&ce.includes(le)?$.push(new Ce(le,A[le],`In "${E}": "${le}" is only valid when "encoding" is set to "custom". ${re} encoding found`)):O[le]?$=$.concat(I.validateSpec({key:le,value:A[le],valueSpec:O[le],validateSpec:I.validateSpec,style:j,styleSpec:D})):$.push(new Ce(le,A[le],`unknown property "${le}"`));return $}({sourceName:r,value:t,style:i.style,styleSpec:l,validateSpec:v}),b;case"geojson":if(b=hr({key:r,value:t,valueSpec:l.source_geojson,style:p,styleSpec:l,validateSpec:v,objectElementValidators:ba}),t.cluster)for(const I in t.clusterProperties){const[M,E]=t.clusterProperties[I],A=typeof M=="string"?[M,["accumulated"],["get",I]]:M;b.push(...Ts({key:`${r}.${I}.map`,value:E,validateSpec:v,expressionContext:"cluster-map"})),b.push(...Ts({key:`${r}.${I}.reduce`,value:A,validateSpec:v,expressionContext:"cluster-reduce"}))}return b;case"video":return hr({key:r,value:t,valueSpec:l.source_video,style:p,validateSpec:v,styleSpec:l});case"image":return hr({key:r,value:t,valueSpec:l.source_image,style:p,validateSpec:v,styleSpec:l});case"canvas":return[new Ce(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return yn({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:p,validateSpec:v,styleSpec:l})}}function Gl(i){const t=i.value,r=i.styleSpec,l=r.light,p=i.style;let v=[];const x=Mt(t);if(t===void 0)return v;if(x!=="object")return v=v.concat([new Ce("light",t,`object expected, ${x} found`)]),v;for(const b in t){const I=b.match(/^(.*)-transition$/);v=v.concat(I&&l[I[1]]&&l[I[1]].transition?i.validateSpec({key:b,value:t[b],valueSpec:r.transition,validateSpec:i.validateSpec,style:p,styleSpec:r}):l[b]?i.validateSpec({key:b,value:t[b],valueSpec:l[b],validateSpec:i.validateSpec,style:p,styleSpec:r}):[new Ce(b,t[b],`unknown property "${b}"`)])}return v}function Xl(i){const t=i.value,r=i.styleSpec,l=r.sky,p=i.style,v=Mt(t);if(t===void 0)return[];if(v!=="object")return[new Ce("sky",t,`object expected, ${v} found`)];let x=[];for(const b in t)x=x.concat(l[b]?i.validateSpec({key:b,value:t[b],valueSpec:l[b],style:p,styleSpec:r}):[new Ce(b,t[b],`unknown property "${b}"`)]);return x}function Wl(i){const t=i.value,r=i.styleSpec,l=r.terrain,p=i.style;let v=[];const x=Mt(t);if(t===void 0)return v;if(x!=="object")return v=v.concat([new Ce("terrain",t,`object expected, ${x} found`)]),v;for(const b in t)v=v.concat(l[b]?i.validateSpec({key:b,value:t[b],valueSpec:l[b],validateSpec:i.validateSpec,style:p,styleSpec:r}):[new Ce(b,t[b],`unknown property "${b}"`)]);return v}function Hl(i){let t=[];const r=i.value,l=i.key;if(Array.isArray(r)){const p=[],v=[];for(const x in r)r[x].id&&p.includes(r[x].id)&&t.push(new Ce(l,r,`all the sprites' ids must be unique, but ${r[x].id} is duplicated`)),p.push(r[x].id),r[x].url&&v.includes(r[x].url)&&t.push(new Ce(l,r,`all the sprites' URLs must be unique, but ${r[x].url} is duplicated`)),v.push(r[x].url),t=t.concat(hr({key:`${l}[${x}]`,value:r[x],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return t}return ts({key:l,value:r})}const wa={"*":()=>[],array:So,boolean:function(i){const t=i.value,r=i.key,l=Mt(t);return l!=="boolean"?[new Ce(r,t,`boolean expected, ${l} found`)]:[]},number:Ul,color:function(i){const t=i.key,r=i.value,l=Mt(r);return l!=="string"?[new Ce(t,r,`color expected, ${l} found`)]:Lt.parse(String(r))?[]:[new Ce(t,r,`color expected, "${r}" found`)]},constants:Ec,enum:yn,filter:jl,function:_a,layer:Zl,object:hr,source:Mo,light:Gl,sky:Xl,terrain:Wl,projection:function(i){const t=i.value,r=i.styleSpec,l=r.projection,p=i.style,v=Mt(t);if(t===void 0)return[];if(v!=="object")return[new Ce("projection",t,`object expected, ${v} found`)];let x=[];for(const b in t)x=x.concat(l[b]?i.validateSpec({key:b,value:t[b],valueSpec:l[b],style:p,styleSpec:r}):[new Ce(b,t[b],`unknown property "${b}"`)]);return x},string:ts,formatted:function(i){return ts(i).length===0?[]:Ts(i)},resolvedImage:function(i){return ts(i).length===0?[]:Ts(i)},padding:function(i){const t=i.key,r=i.value;if(Mt(r)==="array"){if(r.length<1||r.length>4)return[new Ce(t,r,`padding requires 1 to 4 values; ${r.length} values found`)];const l={type:"number"};let p=[];for(let v=0;v[]}})),i.constants&&(r=r.concat(Ec({key:"constants",value:i.constants,style:i,styleSpec:t,validateSpec:As}))),Jl(r)}function rn(i){return function(t){return i({...t,validateSpec:As})}}function Jl(i){return[].concat(i).sort((t,r)=>t.line-r.line)}function Or(i){return function(...t){return Jl(i.apply(this,t))}}wr.source=Or(rn(Mo)),wr.sprite=Or(rn(Hl)),wr.glyphs=Or(rn(Tc)),wr.light=Or(rn(Gl)),wr.sky=Or(rn(Xl)),wr.terrain=Or(rn(Wl)),wr.layer=Or(rn(Zl)),wr.filter=Or(rn(jl)),wr.paintProperty=Or(rn(xa)),wr.layoutProperty=Or(rn(ql));const is=wr,hd=is.light,cd=is.sky,Ac=is.paintProperty,zc=is.layoutProperty;function Kl(i,t){let r=!1;if(t&&t.length)for(const l of t)i.fire(new Cn(new Error(l.message))),r=!0;return r}class zs{constructor(t,r,l){const p=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const x=new Int32Array(this.arrayBuffer);t=x[0],this.d=(r=x[1])+2*(l=x[2]);for(let I=0;I=A[j+0]&&p>=A[j+1])?(b[O]=!0,x.push(E[O])):b[O]=!1}}}}_forEachCell(t,r,l,p,v,x,b,I){const M=this._convertToCellCoord(t),E=this._convertToCellCoord(r),A=this._convertToCellCoord(l),D=this._convertToCellCoord(p);for(let O=M;O<=A;O++)for(let j=E;j<=D;j++){const $=this.d*j+O;if((!I||I(this._convertFromCellCoord(O),this._convertFromCellCoord(j),this._convertFromCellCoord(O+1),this._convertFromCellCoord(j+1)))&&v.call(this,t,r,l,p,$,x,b,I))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,r=3+this.cells.length+1+1;let l=0;for(let x=0;x=0)continue;const x=i[v];p[v]=Ir[r].shallow.indexOf(v)>=0?x:ks(x,t)}i instanceof Error&&(p.message=i.message)}if(p.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(p.$name=r),p}function Ds(i){if(kc(i))return i;if(Array.isArray(i))return i.map(Ds);if(typeof i!="object")throw new Error("can't deserialize object of type "+typeof i);const t=Yl(i)||"Object";if(!Ir[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:r}=Ir[t];if(!r)throw new Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(i);const l=Object.create(r.prototype);for(const p of Object.keys(i)){if(p==="$name")continue;const v=i[p];l[p]=Ir[t].shallow.indexOf(p)>=0?v:Ds(v)}return l}class Ql{constructor(){this.first=!0}update(t,r){const l=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=l,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=l,!0):(this.lastFloorZoom>l?(this.lastIntegerZoom=l+1,this.lastIntegerZoomTime=r):this.lastFloorZoomi>=128&&i<=255,"Hangul Jamo":i=>i>=4352&&i<=4607,Khmer:i=>i>=6016&&i<=6143,"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,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Katakana:i=>i>=12448&&i<=12543,Kanbun:i=>i>=12688&&i<=12703,"CJK Strokes":i=>i>=12736&&i<=12783,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"Private Use Area":i=>i>=57344&&i<=63743,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function eh(i){for(const t of i)if(ih(t.charCodeAt(0)))return!0;return!1}function ud(i){for(const t of i)if(!Ls(t.charCodeAt(0)))return!1;return!0}function th(i){const t=i.map(r=>{try{return new RegExp(`\\p{sc=${r}}`,"u").source}catch{return null}}).filter(r=>r);return new RegExp(t.join("|"),"u")}const dd=th(["Arab","Dupl","Mong","Ougr","Syrc"]);function Ls(i){return!dd.test(String.fromCodePoint(i))}const Dc=th(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function ih(i){return!(i!==746&&i!==747&&(i<4352||!(vt["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||vt["CJK Compatibility"](i)||vt["CJK Strokes"](i)||!(!vt["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||vt["Enclosed CJK Letters and Months"](i)||vt["Ideographic Description Characters"](i)||vt.Kanbun(i)||vt.Katakana(i)&&i!==12540||!(!vt["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)||!(!vt["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||vt["Vertical Forms"](i)||vt["Yijing Hexagram Symbols"](i)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(i))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(i))||Dc.test(String.fromCodePoint(i)))))}function Lc(i){return!(ih(i)||function(t){return!!(vt["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||vt["General Punctuation"](t)&&(t===8214||t===8224||t===8225||t===8240||t===8241||t===8251||t===8252||t===8258||t===8263||t===8264||t===8265||t===8273)||vt["Letterlike Symbols"](t)||vt["Number Forms"](t)||vt["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||t===9003||t>=9085&&t<=9114||t>=9150&&t<=9165||t===9167||t>=9169&&t<=9179||t>=9186&&t<=9215)||vt["Control Pictures"](t)&&t!==9251||vt["Optical Character Recognition"](t)||vt["Enclosed Alphanumerics"](t)||vt["Geometric Shapes"](t)||vt["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||vt["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||vt["CJK Symbols and Punctuation"](t)||vt.Katakana(t)||vt["Private Use Area"](t)||vt["CJK Compatibility Forms"](t)||vt["Small Form Variants"](t)||vt["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}(i))}const pd=th(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function rh(i){return pd.test(String.fromCodePoint(i))}function fd(i,t){return!(!t&&rh(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||vt.Khmer(i))}function md(i){for(const t of i)if(rh(t.charCodeAt(0)))return!0;return!1}const cr=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 Jt{constructor(t,r){this.zoom=t,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ql,this.transition={})}isSupportedScript(t){return function(r,l){for(const p of r)if(!fd(p.charCodeAt(0),l))return!1;return!0}(t,cr.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,r=t-Math.floor(t),l=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*l}:{fromScale:.5,toScale:1,t:1-(1-l)*r}}}class Bs{constructor(t,r){this.property=t,this.value=r,this.expression=function(l,p){if(ua(l))return new Es(l,p);if(fa(l)){const v=Ol(l,p);if(v.result==="error")throw new Error(v.value.map(x=>`${x.key}: ${x.message}`).join(", "));return v.value}{let v=l;return p.type==="color"&&typeof l=="string"?v=Lt.parse(l):p.type!=="padding"||typeof l!="number"&&!Array.isArray(l)?p.type==="variableAnchorOffsetCollection"&&Array.isArray(l)&&(v=xr.parse(l)):v=ar.parse(l),{kind:"constant",evaluate:()=>v}}}(r===void 0?t.specification.default:r,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(t,r,l){return this.property.possiblyEvaluate(this,t,r,l)}}class Ca{constructor(t){this.property=t,this.value=new Bs(t,void 0)}transitioned(t,r){return new Bc(this.property,this.value,r,Ke({},t.transition,this.transition),t.now)}untransitioned(){return new Bc(this.property,this.value,null,{},0)}}class Sa{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return Ye(this._values[t].value.value)}setValue(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Ca(this._values[t].property)),this._values[t].value=new Bs(this._values[t].property,r===null?void 0:Ye(r))}getTransition(t){return Ye(this._values[t].transition)}setTransition(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Ca(this._values[t].property)),this._values[t].transition=Ye(r)||void 0}serialize(){const t={};for(const r of Object.keys(this._values)){const l=this.getValue(r);l!==void 0&&(t[r]=l);const p=this.getTransition(r);p!==void 0&&(t[`${r}-transition`]=p)}return t}transitioned(t,r){const l=new Po(this._properties);for(const p of Object.keys(this._values))l._values[p]=this._values[p].transitioned(t,r._values[p]);return l}untransitioned(){const t=new Po(this._properties);for(const r of Object.keys(this._values))t._values[r]=this._values[r].untransitioned();return t}}class Bc{constructor(t,r,l,p,v){this.property=t,this.value=r,this.begin=v+p.delay||0,this.end=this.begin+p.duration||0,t.specification.transition&&(p.delay||p.duration)&&(this.prior=l)}possiblyEvaluate(t,r,l){const p=t.now||0,v=this.value.possiblyEvaluate(t,r,l),x=this.prior;if(x){if(p>this.end)return this.prior=null,v;if(this.value.isDataDriven())return this.prior=null,v;if(p=1)return 1;const M=I*I,E=M*I;return 4*(I<.5?E:3*(I-M)+E-.75)}(b))}}return v}}class Po{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,r,l){const p=new To(this._properties);for(const v of Object.keys(this._values))p._values[v]=this._values[v].possiblyEvaluate(t,r,l);return p}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Eo{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return this._values[t].value!==void 0}getValue(t){return Ye(this._values[t].value)}setValue(t,r){this._values[t]=new Bs(this._values[t].property,r===null?void 0:Ye(r))}serialize(){const t={};for(const r of Object.keys(this._values)){const l=this.getValue(r);l!==void 0&&(t[r]=l)}return t}possiblyEvaluate(t,r,l){const p=new To(this._properties);for(const v of Object.keys(this._values))p._values[v]=this._values[v].possiblyEvaluate(t,r,l);return p}}class nn{constructor(t,r,l){this.property=t,this.value=r,this.parameters=l}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,r,l,p){return this.property.evaluate(this.value,this.parameters,t,r,l,p)}}class To{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class qe{constructor(t){this.specification=t}possiblyEvaluate(t,r){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(r)}interpolate(t,r,l){const p=Wi[this.specification.type];return p?p(t,r,l):t}}class tt{constructor(t,r){this.specification=t,this.overrides=r}possiblyEvaluate(t,r,l,p){return new nn(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(r,null,{},l,p)}:t.expression,r)}interpolate(t,r,l){if(t.value.kind!=="constant"||r.value.kind!=="constant")return t;if(t.value.value===void 0||r.value.value===void 0)return new nn(this,{kind:"constant",value:void 0},t.parameters);const p=Wi[this.specification.type];if(p){const v=p(t.value.value,r.value.value,l);return new nn(this,{kind:"constant",value:v},t.parameters)}return t}evaluate(t,r,l,p,v,x){return t.kind==="constant"?t.value:t.evaluate(r,l,p,v,x)}}class Ma extends tt{possiblyEvaluate(t,r,l,p){if(t.value===void 0)return new nn(this,{kind:"constant",value:void 0},r);if(t.expression.kind==="constant"){const v=t.expression.evaluate(r,null,{},l,p),x=t.property.specification.type==="resolvedImage"&&typeof v!="string"?v.name:v,b=this._calculate(x,x,x,r);return new nn(this,{kind:"constant",value:b},r)}if(t.expression.kind==="camera"){const v=this._calculate(t.expression.evaluate({zoom:r.zoom-1}),t.expression.evaluate({zoom:r.zoom}),t.expression.evaluate({zoom:r.zoom+1}),r);return new nn(this,{kind:"constant",value:v},r)}return new nn(this,t.expression,r)}evaluate(t,r,l,p,v,x){if(t.kind==="source"){const b=t.evaluate(r,l,p,v,x);return this._calculate(b,b,b,r)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(r.zoom)-1},l,p),t.evaluate({zoom:Math.floor(r.zoom)},l,p),t.evaluate({zoom:Math.floor(r.zoom)+1},l,p),r):t.value}_calculate(t,r,l,p){return p.zoom>p.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:l,to:r}}interpolate(t){return t}}class Pa{constructor(t){this.specification=t}possiblyEvaluate(t,r,l,p){if(t.value!==void 0){if(t.expression.kind==="constant"){const v=t.expression.evaluate(r,null,{},l,p);return this._calculate(v,v,v,r)}return this._calculate(t.expression.evaluate(new Jt(Math.floor(r.zoom-1),r)),t.expression.evaluate(new Jt(Math.floor(r.zoom),r)),t.expression.evaluate(new Jt(Math.floor(r.zoom+1),r)),r)}}_calculate(t,r,l,p){return p.zoom>p.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:l,to:r}}interpolate(t){return t}}class nh{constructor(t){this.specification=t}possiblyEvaluate(t,r,l,p){return!!t.expression.evaluate(r,null,{},l,p)}interpolate(){return!1}}class _{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in t){const l=t[r];l.specification.overridable&&this.overridableProperties.push(r);const p=this.defaultPropertyValues[r]=new Bs(l,void 0),v=this.defaultTransitionablePropertyValues[r]=new Ca(l);this.defaultTransitioningPropertyValues[r]=v.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=p.possiblyEvaluate({})}}}Ve("DataDrivenProperty",tt),Ve("DataConstantProperty",qe),Ve("CrossFadedDataDrivenProperty",Ma),Ve("CrossFadedProperty",Pa),Ve("ColorRampProperty",nh);const e="-transition";class o extends ds{constructor(t,r){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},t.type!=="custom"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),r.layout&&(this._unevaluatedLayout=new Eo(r.layout)),r.paint)){this._transitionablePaint=new Sa(r.paint);for(const l in t.paint)this.setPaintProperty(l,t.paint[l],{validate:!1});for(const l in t.layout)this.setLayoutProperty(l,t.layout[l],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new To(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,r,l={}){r!=null&&this._validate(zc,`layers.${this.id}.layout.${t}`,t,r,l)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,r):this.visibility=r)}getPaintProperty(t){return t.endsWith(e)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,r,l={}){if(r!=null&&this._validate(Ac,`layers.${this.id}.paint.${t}`,t,r,l))return!1;if(t.endsWith(e))return this._transitionablePaint.setTransition(t.slice(0,-11),r||void 0),!1;{const p=this._transitionablePaint._values[t],v=p.property.specification["property-type"]==="cross-faded-data-driven",x=p.value.isDataDriven(),b=p.value;this._transitionablePaint.setValue(t,r),this._handleSpecialPaintPropertyUpdate(t);const I=this._transitionablePaint._values[t].value;return I.isDataDriven()||x||v||this._handleOverridablePaintPropertyUpdate(t,b,I)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,r,l){return!1}isHidden(t){return!!(this.minzoom&&t=this.maxzoom)||this.visibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,r){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,r)}serialize(){const t={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&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),Rt(t,(r,l)=>!(r===void 0||l==="layout"&&!Object.keys(r).length||l==="paint"&&!Object.keys(r).length))}_validate(t,r,l,p,v={}){return(!v||v.validate!==!1)&&Kl(this,t.call(is,{key:r,layerType:this.type,objectKey:l,value:p,styleSpec:fe,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const r=this.paint.get(t);if(r instanceof nn&&Is(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const u={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class d{constructor(t,r){this._structArray=t,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class y{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,r){return t._trim(),r&&(t.isTransferred=!0,r.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const r=Object.create(this.prototype);return r.arrayBuffer=t.arrayBuffer,r.length=t.length,r.capacity=t.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_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(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function w(i,t=1){let r=0,l=0;return{members:i.map(p=>{const v=u[p.type].BYTES_PER_ELEMENT,x=r=C(r,Math.max(t,v)),b=p.components||1;return l=Math.max(l,v),r+=v*b,{name:p.name,type:p.type,components:b,offset:x}}),size:C(r,Math.max(l,t)),alignment:t}}function C(i,t){return Math.ceil(i/t)*t}class S extends y{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r){const l=this.length;return this.resize(l+1),this.emplace(l,t,r)}emplace(t,r,l){const p=2*t;return this.int16[p+0]=r,this.int16[p+1]=l,t}}S.prototype.bytesPerElement=4,Ve("StructArrayLayout2i4",S);class T extends y{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,l){const p=this.length;return this.resize(p+1),this.emplace(p,t,r,l)}emplace(t,r,l,p){const v=3*t;return this.int16[v+0]=r,this.int16[v+1]=l,this.int16[v+2]=p,t}}T.prototype.bytesPerElement=6,Ve("StructArrayLayout3i6",T);class z extends y{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,l,p){const v=this.length;return this.resize(v+1),this.emplace(v,t,r,l,p)}emplace(t,r,l,p,v){const x=4*t;return this.int16[x+0]=r,this.int16[x+1]=l,this.int16[x+2]=p,this.int16[x+3]=v,t}}z.prototype.bytesPerElement=8,Ve("StructArrayLayout4i8",z);class k extends y{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,l,p,v,x){const b=this.length;return this.resize(b+1),this.emplace(b,t,r,l,p,v,x)}emplace(t,r,l,p,v,x,b){const I=6*t;return this.int16[I+0]=r,this.int16[I+1]=l,this.int16[I+2]=p,this.int16[I+3]=v,this.int16[I+4]=x,this.int16[I+5]=b,t}}k.prototype.bytesPerElement=12,Ve("StructArrayLayout2i4i12",k);class N extends y{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,l,p,v,x){const b=this.length;return this.resize(b+1),this.emplace(b,t,r,l,p,v,x)}emplace(t,r,l,p,v,x,b){const I=4*t,M=8*t;return this.int16[I+0]=r,this.int16[I+1]=l,this.uint8[M+4]=p,this.uint8[M+5]=v,this.uint8[M+6]=x,this.uint8[M+7]=b,t}}N.prototype.bytesPerElement=8,Ve("StructArrayLayout2i4ub8",N);class q extends y{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r){const l=this.length;return this.resize(l+1),this.emplace(l,t,r)}emplace(t,r,l){const p=2*t;return this.float32[p+0]=r,this.float32[p+1]=l,t}}q.prototype.bytesPerElement=8,Ve("StructArrayLayout2f8",q);class G extends y{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,l,p,v,x,b,I,M,E){const A=this.length;return this.resize(A+1),this.emplace(A,t,r,l,p,v,x,b,I,M,E)}emplace(t,r,l,p,v,x,b,I,M,E,A){const D=10*t;return this.uint16[D+0]=r,this.uint16[D+1]=l,this.uint16[D+2]=p,this.uint16[D+3]=v,this.uint16[D+4]=x,this.uint16[D+5]=b,this.uint16[D+6]=I,this.uint16[D+7]=M,this.uint16[D+8]=E,this.uint16[D+9]=A,t}}G.prototype.bytesPerElement=20,Ve("StructArrayLayout10ui20",G);class J extends y{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,l,p,v,x,b,I,M,E,A,D){const O=this.length;return this.resize(O+1),this.emplace(O,t,r,l,p,v,x,b,I,M,E,A,D)}emplace(t,r,l,p,v,x,b,I,M,E,A,D,O){const j=12*t;return this.int16[j+0]=r,this.int16[j+1]=l,this.int16[j+2]=p,this.int16[j+3]=v,this.uint16[j+4]=x,this.uint16[j+5]=b,this.uint16[j+6]=I,this.uint16[j+7]=M,this.int16[j+8]=E,this.int16[j+9]=A,this.int16[j+10]=D,this.int16[j+11]=O,t}}J.prototype.bytesPerElement=24,Ve("StructArrayLayout4i4ui4i24",J);class Q extends y{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,l){const p=this.length;return this.resize(p+1),this.emplace(p,t,r,l)}emplace(t,r,l,p){const v=3*t;return this.float32[v+0]=r,this.float32[v+1]=l,this.float32[v+2]=p,t}}Q.prototype.bytesPerElement=12,Ve("StructArrayLayout3f12",Q);class ee extends y{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint32[1*t+0]=r,t}}ee.prototype.bytesPerElement=4,Ve("StructArrayLayout1ul4",ee);class ie extends y{_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(t,r,l,p,v,x,b,I,M){const E=this.length;return this.resize(E+1),this.emplace(E,t,r,l,p,v,x,b,I,M)}emplace(t,r,l,p,v,x,b,I,M,E){const A=10*t,D=5*t;return this.int16[A+0]=r,this.int16[A+1]=l,this.int16[A+2]=p,this.int16[A+3]=v,this.int16[A+4]=x,this.int16[A+5]=b,this.uint32[D+3]=I,this.uint16[A+8]=M,this.uint16[A+9]=E,t}}ie.prototype.bytesPerElement=20,Ve("StructArrayLayout6i1ul2ui20",ie);class X extends y{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,l,p,v,x){const b=this.length;return this.resize(b+1),this.emplace(b,t,r,l,p,v,x)}emplace(t,r,l,p,v,x,b){const I=6*t;return this.int16[I+0]=r,this.int16[I+1]=l,this.int16[I+2]=p,this.int16[I+3]=v,this.int16[I+4]=x,this.int16[I+5]=b,t}}X.prototype.bytesPerElement=12,Ve("StructArrayLayout2i2i2i12",X);class se extends y{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,l,p,v){const x=this.length;return this.resize(x+1),this.emplace(x,t,r,l,p,v)}emplace(t,r,l,p,v,x){const b=4*t,I=8*t;return this.float32[b+0]=r,this.float32[b+1]=l,this.float32[b+2]=p,this.int16[I+6]=v,this.int16[I+7]=x,t}}se.prototype.bytesPerElement=16,Ve("StructArrayLayout2f1f2i16",se);class ae extends y{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,l,p,v,x){const b=this.length;return this.resize(b+1),this.emplace(b,t,r,l,p,v,x)}emplace(t,r,l,p,v,x,b){const I=16*t,M=4*t,E=8*t;return this.uint8[I+0]=r,this.uint8[I+1]=l,this.float32[M+1]=p,this.float32[M+2]=v,this.int16[E+6]=x,this.int16[E+7]=b,t}}ae.prototype.bytesPerElement=16,Ve("StructArrayLayout2ub2f2i16",ae);class de extends y{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,l){const p=this.length;return this.resize(p+1),this.emplace(p,t,r,l)}emplace(t,r,l,p){const v=3*t;return this.uint16[v+0]=r,this.uint16[v+1]=l,this.uint16[v+2]=p,t}}de.prototype.bytesPerElement=6,Ve("StructArrayLayout3ui6",de);class xe extends y{_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(t,r,l,p,v,x,b,I,M,E,A,D,O,j,$,W,Y){const ce=this.length;return this.resize(ce+1),this.emplace(ce,t,r,l,p,v,x,b,I,M,E,A,D,O,j,$,W,Y)}emplace(t,r,l,p,v,x,b,I,M,E,A,D,O,j,$,W,Y,ce){const re=24*t,le=12*t,me=48*t;return this.int16[re+0]=r,this.int16[re+1]=l,this.uint16[re+2]=p,this.uint16[re+3]=v,this.uint32[le+2]=x,this.uint32[le+3]=b,this.uint32[le+4]=I,this.uint16[re+10]=M,this.uint16[re+11]=E,this.uint16[re+12]=A,this.float32[le+7]=D,this.float32[le+8]=O,this.uint8[me+36]=j,this.uint8[me+37]=$,this.uint8[me+38]=W,this.uint32[le+10]=Y,this.int16[re+22]=ce,t}}xe.prototype.bytesPerElement=48,Ve("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",xe);class Ie extends y{_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(t,r,l,p,v,x,b,I,M,E,A,D,O,j,$,W,Y,ce,re,le,me,we,Be,et,De,ze,Xe,je){const Oe=this.length;return this.resize(Oe+1),this.emplace(Oe,t,r,l,p,v,x,b,I,M,E,A,D,O,j,$,W,Y,ce,re,le,me,we,Be,et,De,ze,Xe,je)}emplace(t,r,l,p,v,x,b,I,M,E,A,D,O,j,$,W,Y,ce,re,le,me,we,Be,et,De,ze,Xe,je,Oe){const _e=32*t,We=16*t;return this.int16[_e+0]=r,this.int16[_e+1]=l,this.int16[_e+2]=p,this.int16[_e+3]=v,this.int16[_e+4]=x,this.int16[_e+5]=b,this.int16[_e+6]=I,this.int16[_e+7]=M,this.uint16[_e+8]=E,this.uint16[_e+9]=A,this.uint16[_e+10]=D,this.uint16[_e+11]=O,this.uint16[_e+12]=j,this.uint16[_e+13]=$,this.uint16[_e+14]=W,this.uint16[_e+15]=Y,this.uint16[_e+16]=ce,this.uint16[_e+17]=re,this.uint16[_e+18]=le,this.uint16[_e+19]=me,this.uint16[_e+20]=we,this.uint16[_e+21]=Be,this.uint16[_e+22]=et,this.uint32[We+12]=De,this.float32[We+13]=ze,this.float32[We+14]=Xe,this.uint16[_e+30]=je,this.uint16[_e+31]=Oe,t}}Ie.prototype.bytesPerElement=64,Ve("StructArrayLayout8i15ui1ul2f2ui64",Ie);class ke extends y{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.float32[1*t+0]=r,t}}ke.prototype.bytesPerElement=4,Ve("StructArrayLayout1f4",ke);class Fe extends y{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,l){const p=this.length;return this.resize(p+1),this.emplace(p,t,r,l)}emplace(t,r,l,p){const v=3*t;return this.uint16[6*t+0]=r,this.float32[v+1]=l,this.float32[v+2]=p,t}}Fe.prototype.bytesPerElement=12,Ve("StructArrayLayout1ui2f12",Fe);class Ee extends y{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,l){const p=this.length;return this.resize(p+1),this.emplace(p,t,r,l)}emplace(t,r,l,p){const v=4*t;return this.uint32[2*t+0]=r,this.uint16[v+2]=l,this.uint16[v+3]=p,t}}Ee.prototype.bytesPerElement=8,Ve("StructArrayLayout1ul2ui8",Ee);class Pe extends y{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r){const l=this.length;return this.resize(l+1),this.emplace(l,t,r)}emplace(t,r,l){const p=2*t;return this.uint16[p+0]=r,this.uint16[p+1]=l,t}}Pe.prototype.bytesPerElement=4,Ve("StructArrayLayout2ui4",Pe);class Ze extends y{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint16[1*t+0]=r,t}}Ze.prototype.bytesPerElement=2,Ve("StructArrayLayout1ui2",Ze);class at extends y{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,l,p){const v=this.length;return this.resize(v+1),this.emplace(v,t,r,l,p)}emplace(t,r,l,p,v){const x=4*t;return this.float32[x+0]=r,this.float32[x+1]=l,this.float32[x+2]=p,this.float32[x+3]=v,t}}at.prototype.bytesPerElement=16,Ve("StructArrayLayout4f16",at);class Ae extends d{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 B(this.anchorPointX,this.anchorPointY)}}Ae.prototype.size=20;class Le extends ie{get(t){return new Ae(this,t)}}Ve("CollisionBoxArray",Le);class st extends d{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(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}st.prototype.size=48;class Kt extends xe{get(t){return new st(this,t)}}Ve("PlacedSymbolArray",Kt);class dt extends d{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(t){this._structArray.uint32[this._pos4+12]=t}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]}}dt.prototype.size=64;class yt extends Ie{get(t){return new dt(this,t)}}Ve("SymbolInstanceArray",yt);class Yt extends ke{getoffsetX(t){return this.float32[1*t+0]}}Ve("GlyphOffsetArray",Yt);class ki extends T{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Ve("SymbolLineVertexArray",ki);class Vr extends d{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]}}Vr.prototype.size=12;class Qt extends Fe{get(t){return new Vr(this,t)}}Ve("TextAnchorOffsetArray",Qt);class Ji extends d{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]}}Ji.prototype.size=8;class Ui extends Ee{get(t){return new Ji(this,t)}}Ve("FeatureIndexArray",Ui);class Di extends S{}class ji extends S{}class sn extends S{}class Fs extends k{}class Ea extends N{}class Rs extends q{}class Cr extends G{}class Ta extends J{}class sh extends Q{}class Sr extends ee{}class Mr extends X{}class An extends ae{}class Nr extends de{}class Pi extends Pe{}const Li=w([{name:"a_pos",components:2,type:"Int16"}],4),{members:ur}=Li;class xt{constructor(t=[]){this.segments=t}prepareSegment(t,r,l,p){let v=this.segments[this.segments.length-1];return t>xt.MAX_VERTEX_ARRAY_LENGTH&&ct(`Max vertices per segment is ${xt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!v||v.vertexLength+t>xt.MAX_VERTEX_ARRAY_LENGTH||v.sortKey!==p)&&(v={vertexOffset:r.length,primitiveOffset:l.length,vertexLength:0,primitiveLength:0},p!==void 0&&(v.sortKey=p),this.segments.push(v)),v}get(){return this.segments}destroy(){for(const t of this.segments)for(const r in t.vaos)t.vaos[r].destroy()}static simpleSegment(t,r,l,p){return new xt([{vertexOffset:t,primitiveOffset:r,vertexLength:l,primitiveLength:p,vaos:{},sortKey:0}])}}function rs(i,t){return 256*(i=nt(Math.floor(i),0,255))+nt(Math.floor(t),0,255)}xt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ve("SegmentVector",xt);const Os=w([{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 Vs={exports:{}},Fc={exports:{}};Fc.exports=function(i,t){var r,l,p,v,x,b,I,M;for(l=i.length-(r=3&i.length),p=t,x=3432918353,b=461845907,M=0;M>>16)*x&65535)<<16)&4294967295)<<15|I>>>17))*b+(((I>>>16)*b&65535)<<16)&4294967295)<<13|p>>>19))+((5*(p>>>16)&65535)<<16)&4294967295))+((58964+(v>>>16)&65535)<<16);switch(I=0,r){case 3:I^=(255&i.charCodeAt(M+2))<<16;case 2:I^=(255&i.charCodeAt(M+1))<<8;case 1:p^=I=(65535&(I=(I=(65535&(I^=255&i.charCodeAt(M)))*x+(((I>>>16)*x&65535)<<16)&4294967295)<<15|I>>>17))*b+(((I>>>16)*b&65535)<<16)&4294967295}return p^=i.length,p=2246822507*(65535&(p^=p>>>16))+((2246822507*(p>>>16)&65535)<<16)&4294967295,p=3266489909*(65535&(p^=p>>>13))+((3266489909*(p>>>16)&65535)<<16)&4294967295,(p^=p>>>16)>>>0};var gd=Fc.exports,Rc={exports:{}};Rc.exports=function(i,t){for(var r,l=i.length,p=t^l,v=0;l>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(v)|(255&i.charCodeAt(++v))<<8|(255&i.charCodeAt(++v))<<16|(255&i.charCodeAt(++v))<<24))+((1540483477*(r>>>16)&65535)<<16),p=1540483477*(65535&p)+((1540483477*(p>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),l-=4,++v;switch(l){case 3:p^=(255&i.charCodeAt(v+2))<<16;case 2:p^=(255&i.charCodeAt(v+1))<<8;case 1:p=1540483477*(65535&(p^=255&i.charCodeAt(v)))+((1540483477*(p>>>16)&65535)<<16)}return p=1540483477*(65535&(p^=p>>>13))+((1540483477*(p>>>16)&65535)<<16),(p^=p>>>15)>>>0};var zn=gd,Oc=Rc.exports;Vs.exports=zn,Vs.exports.murmur3=zn,Vs.exports.murmur2=Oc;var Aa=P(Vs.exports);class Ao{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,r,l,p){this.ids.push(za(t)),this.positions.push(r,l,p)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=za(t);let l=0,p=this.ids.length-1;for(;l>1;this.ids[x]>=r?p=x:l=x+1}const v=[];for(;this.ids[l]===r;)v.push({index:this.positions[3*l],start:this.positions[3*l+1],end:this.positions[3*l+2]}),l++;return v}static serialize(t,r){const l=new Float64Array(t.ids),p=new Uint32Array(t.positions);return ka(l,p,0,l.length-1),r&&r.push(l.buffer,p.buffer),{ids:l,positions:p}}static deserialize(t){const r=new Ao;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}}function za(i){const t=+i;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:Aa(String(i))}function ka(i,t,r,l){for(;r>1];let v=r-1,x=l+1;for(;;){do v++;while(i[v]p);if(v>=x)break;Ns(i,v,x),Ns(t,3*v,3*x),Ns(t,3*v+1,3*x+1),Ns(t,3*v+2,3*x+2)}x-r`u_${p}`),this.type=l}setUniform(t,r,l){t.set(l.constantOr(this.value))}getBinding(t,r,l){return this.type==="color"?new yf(t,r):new Vc(t,r)}}class Da{constructor(t,r){this.uniformNames=r.map(l=>`u_${l}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=t.tlbr}setUniform(t,r,l,p){const v=p==="u_pattern_to"?this.patternTo:p==="u_pattern_from"?this.patternFrom:p==="u_pixel_ratio_to"?this.pixelRatioTo:p==="u_pixel_ratio_from"?this.pixelRatioFrom:null;v&&t.set(v)}getBinding(t,r,l){return l.substr(0,9)==="u_pattern"?new gf(t,r):new Vc(t,r)}}class ns{constructor(t,r,l,p){this.expression=t,this.type=l,this.maxValue=0,this.paintVertexAttributes=r.map(v=>({name:`a_${v}`,type:"Float32",components:l==="color"?2:1,offset:0})),this.paintVertexArray=new p}populatePaintArray(t,r,l,p,v){const x=this.paintVertexArray.length,b=this.expression.evaluate(new Jt(0),r,{},p,[],v);this.paintVertexArray.resize(t),this._setPaintValue(x,t,b)}updatePaintArray(t,r,l,p){const v=this.expression.evaluate({zoom:0},l,p);this._setPaintValue(t,r,v)}_setPaintValue(t,r,l){if(this.type==="color"){const p=yd(l);for(let v=t;v`u_${b}_t`),this.type=l,this.useIntegerZoom=p,this.zoom=v,this.maxValue=0,this.paintVertexAttributes=r.map(b=>({name:`a_${b}`,type:"Float32",components:l==="color"?4:2,offset:0})),this.paintVertexArray=new x}populatePaintArray(t,r,l,p,v){const x=this.expression.evaluate(new Jt(this.zoom),r,{},p,[],v),b=this.expression.evaluate(new Jt(this.zoom+1),r,{},p,[],v),I=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(I,t,x,b)}updatePaintArray(t,r,l,p){const v=this.expression.evaluate({zoom:this.zoom},l,p),x=this.expression.evaluate({zoom:this.zoom+1},l,p);this._setPaintValue(t,r,v,x)}_setPaintValue(t,r,l,p){if(this.type==="color"){const v=yd(l),x=yd(p);for(let b=t;b`#define HAS_UNIFORM_${p}`))}return t}getBinderAttributes(){const t=[];for(const r in this.binders){const l=this.binders[r];if(l instanceof ns||l instanceof _n)for(let p=0;p!0){this.programConfigurations={};for(const p of t)this.programConfigurations[p.id]=new _f(p,r,l);this.needsUpload=!1,this._featureMap=new Ao,this._bufferOffset=0}populatePaintArrays(t,r,l,p,v,x){for(const b in this.programConfigurations)this.programConfigurations[b].populatePaintArrays(t,r,p,v,x);r.id!==void 0&&this._featureMap.add(r.id,l,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,r,l,p){for(const v of l)this.needsUpload=this.programConfigurations[v.id].updatePaintArrays(t,this._featureMap,r,v,p)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function s_(i,t){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(`${t}-`,"").replace(/-/g,"_")]}function vf(i,t,r){const l={color:{source:q,composite:at},number:{source:ke,composite:q}},p=function(v){return{"line-pattern":{source:Cr,composite:Cr},"fill-pattern":{source:Cr,composite:Cr},"fill-extrusion-pattern":{source:Cr,composite:Cr}}[v]}(i);return p&&p[r]||l[t][r]}Ve("ConstantBinder",oh),Ve("CrossFadedConstantBinder",Da),Ve("SourceExpressionBinder",ns),Ve("CrossFadedCompositeBinder",Us),Ve("CompositeExpressionBinder",_n),Ve("ProgramConfiguration",_f,{omit:["_buffers"]}),Ve("ProgramConfigurationSet",ko);const yi=8192,_d=Math.pow(2,14)-1,xf=-_d-1;function Do(i){const t=yi/i.extent,r=i.loadGeometry();for(let l=0;lx.x+1||Ix.y+1)&&ct("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Lo(i,t){return{type:i.type,id:i.id,properties:i.properties,geometry:t?Do(i):[]}}function Nc(i,t,r,l,p){i.emplaceBack(2*t+(l+1)/2,2*r+(p+1)/2)}class vd{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new ji,this.indexArray=new Nr,this.segments=new xt,this.programConfigurations=new ko(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,l){const p=this.layers[0],v=[];let x=null,b=!1;p.type==="circle"&&(x=p.layout.get("circle-sort-key"),b=!x.isConstant());for(const{feature:I,id:M,index:E,sourceLayerIndex:A}of t){const D=this.layers[0]._featureFilter.needGeometry,O=Lo(I,D);if(!this.layers[0]._featureFilter.filter(new Jt(this.zoom),O,l))continue;const j=b?x.evaluate(O,{},l):void 0,$={id:M,properties:I.properties,type:I.type,sourceLayerIndex:A,index:E,geometry:D?O.geometry:Do(I),patterns:{},sortKey:j};v.push($)}b&&v.sort((I,M)=>I.sortKey-M.sortKey);for(const I of v){const{geometry:M,index:E,sourceLayerIndex:A}=I,D=t[E].feature;this.addFeature(I,M,E,l),r.featureIndex.insert(D,M,E,A,this.index)}}update(t,r,l){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,l)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ur),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,r,l,p){for(const v of r)for(const x of v){const b=x.x,I=x.y;if(b<0||b>=yi||I<0||I>=yi)continue;const M=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),E=M.vertexLength;Nc(this.layoutVertexArray,b,I,-1,-1),Nc(this.layoutVertexArray,b,I,1,-1),Nc(this.layoutVertexArray,b,I,1,1),Nc(this.layoutVertexArray,b,I,-1,1),this.indexArray.emplaceBack(E,E+1,E+2),this.indexArray.emplaceBack(E,E+3,E+2),M.vertexLength+=4,M.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,l,{},p)}}function bf(i,t){for(let r=0;r1){if(xd(i,t))return!0;for(let l=0;l1?r:r.sub(t)._mult(p)._add(t))}function Cf(i,t){let r,l,p,v=!1;for(let x=0;xt.y!=p.y>t.y&&t.x<(p.x-l.x)*(t.y-l.y)/(p.y-l.y)+l.x&&(v=!v)}return v}function La(i,t){let r=!1;for(let l=0,p=i.length-1;lt.y!=x.y>t.y&&t.x<(x.x-v.x)*(t.y-v.y)/(x.y-v.y)+v.x&&(r=!r)}return r}function h_(i,t,r){const l=r[0],p=r[2];if(i.xp.x&&t.x>p.x||i.yp.y&&t.y>p.y)return!1;const v=wt(i,t,r[0]);return v!==wt(i,t,r[1])||v!==wt(i,t,r[2])||v!==wt(i,t,r[3])}function ah(i,t,r){const l=t.paint.get(i).value;return l.kind==="constant"?l.value:r.programConfigurations.get(t.id).getMaxValue(i)}function Uc(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function jc(i,t,r,l,p){if(!t[0]&&!t[1])return i;const v=B.convert(t)._mult(p);r==="viewport"&&v._rotate(-l);const x=[];for(let b=0;bEf(W,$))}(M,I),O=A?E*b:E;for(const j of p)for(const $ of j){const W=A?$:Ef($,I);let Y=O;const ce=$c([],[$.x,$.y,0,1],I);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?Y*=ce[3]/x.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(Y*=x.cameraToCenterDistance/ce[3]),o_(D,W,Y))return!0}return!1}}function Ef(i,t){const r=$c([],[i.x,i.y,0,1],t);return new B(r[0]/r[3],r[1]/r[3])}class Tf extends vd{}let Af;Ve("HeatmapBucket",Tf,{omit:["layers"]});var p_={get paint(){return Af=Af||new _({"heatmap-radius":new tt(fe.paint_heatmap["heatmap-radius"]),"heatmap-weight":new tt(fe.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new qe(fe.paint_heatmap["heatmap-intensity"]),"heatmap-color":new nh(fe.paint_heatmap["heatmap-color"]),"heatmap-opacity":new qe(fe.paint_heatmap["heatmap-opacity"])})}};function Id(i,{width:t,height:r},l,p){if(p){if(p instanceof Uint8ClampedArray)p=new Uint8Array(p.buffer);else if(p.length!==t*r*l)throw new RangeError(`mismatched image size. expected: ${p.length} but got: ${t*r*l}`)}else p=new Uint8Array(t*r*l);return i.width=t,i.height=r,i.data=p,i}function zf(i,{width:t,height:r},l){if(t===i.width&&r===i.height)return;const p=Id({},{width:t,height:r},l);Cd(i,p,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,t),height:Math.min(i.height,r)},l),i.width=t,i.height=r,i.data=p.data}function Cd(i,t,r,l,p,v){if(p.width===0||p.height===0)return t;if(p.width>i.width||p.height>i.height||r.x>i.width-p.width||r.y>i.height-p.height)throw new RangeError("out of range source coordinates for image copy");if(p.width>t.width||p.height>t.height||l.x>t.width-p.width||l.y>t.height-p.height)throw new RangeError("out of range destination coordinates for image copy");const x=i.data,b=t.data;if(x===b)throw new Error("srcData equals dstData, so image is already copied");for(let I=0;I{t[i.evaluationKey]=I;const M=i.expression.evaluate(t);p.data[x+b+0]=Math.floor(255*M.r/M.a),p.data[x+b+1]=Math.floor(255*M.g/M.a),p.data[x+b+2]=Math.floor(255*M.b/M.a),p.data[x+b+3]=Math.floor(255*M.a)};if(i.clips)for(let x=0,b=0;x80*r){b=1/0,I=1/0;let E=-1/0,A=-1/0;for(let D=r;DE&&(E=O),j>A&&(A=j)}M=Math.max(E-b,A-I),M=M!==0?32767/M:0}return ch(v,x,r,b,I,M,0),x}function Bf(i,t,r,l,p){let v;if(p===function(x,b,I,M){let E=0;for(let A=b,D=I-M;A0)for(let x=t;x=t;x-=l)v=Of(x/l|0,i[x],i[x+1],v);return v&&qc(v,v.next)&&(dh(v),v=v.next),v}function Bo(i,t){if(!i)return i;t||(t=i);let r,l=i;do if(r=!1,l.steiner||!qc(l,l.next)&&di(l.prev,l,l.next)!==0)l=l.next;else{if(dh(l),l=t=l.prev,l===l.next)break;r=!0}while(r||l!==t);return t}function ch(i,t,r,l,p,v,x){if(!i)return;!x&&v&&function(I,M,E,A){let D=I;do D.z===0&&(D.z=Md(D.x,D.y,M,E,A)),D.prevZ=D.prev,D.nextZ=D.next,D=D.next;while(D!==I);D.prevZ.nextZ=null,D.prevZ=null,function(O){let j,$=1;do{let W,Y=O;O=null;let ce=null;for(j=0;Y;){j++;let re=Y,le=0;for(let we=0;we<$&&(le++,re=re.nextZ,re);we++);let me=$;for(;le>0||me>0&&re;)le!==0&&(me===0||!re||Y.z<=re.z)?(W=Y,Y=Y.nextZ,le--):(W=re,re=re.nextZ,me--),ce?ce.nextZ=W:O=W,W.prevZ=ce,ce=W;Y=re}ce.nextZ=null,$*=2}while(j>1)}(D)}(i,l,p,v);let b=i;for(;i.prev!==i.next;){const I=i.prev,M=i.next;if(v?x_(i,l,p,v):v_(i))t.push(I.i,i.i,M.i),dh(i),i=M.next,b=M.next;else if((i=M)===b){x?x===1?ch(i=b_(Bo(i),t),t,r,l,p,v,2):x===2&&w_(i,t,r,l,p,v):ch(Bo(i),t,r,l,p,v,1);break}}}function v_(i){const t=i.prev,r=i,l=i.next;if(di(t,r,l)>=0)return!1;const p=t.x,v=r.x,x=l.x,b=t.y,I=r.y,M=l.y,E=pv?p>x?p:x:v>x?v:x,O=b>I?b>M?b:M:I>M?I:M;let j=l.next;for(;j!==t;){if(j.x>=E&&j.x<=D&&j.y>=A&&j.y<=O&&Fa(p,b,v,I,x,M,j.x,j.y)&&di(j.prev,j,j.next)>=0)return!1;j=j.next}return!0}function x_(i,t,r,l){const p=i.prev,v=i,x=i.next;if(di(p,v,x)>=0)return!1;const b=p.x,I=v.x,M=x.x,E=p.y,A=v.y,D=x.y,O=bI?b>M?b:M:I>M?I:M,W=E>A?E>D?E:D:A>D?A:D,Y=Md(O,j,t,r,l),ce=Md($,W,t,r,l);let re=i.prevZ,le=i.nextZ;for(;re&&re.z>=Y&&le&&le.z<=ce;){if(re.x>=O&&re.x<=$&&re.y>=j&&re.y<=W&&re!==p&&re!==x&&Fa(b,E,I,A,M,D,re.x,re.y)&&di(re.prev,re,re.next)>=0||(re=re.prevZ,le.x>=O&&le.x<=$&&le.y>=j&&le.y<=W&&le!==p&&le!==x&&Fa(b,E,I,A,M,D,le.x,le.y)&&di(le.prev,le,le.next)>=0))return!1;le=le.nextZ}for(;re&&re.z>=Y;){if(re.x>=O&&re.x<=$&&re.y>=j&&re.y<=W&&re!==p&&re!==x&&Fa(b,E,I,A,M,D,re.x,re.y)&&di(re.prev,re,re.next)>=0)return!1;re=re.prevZ}for(;le&&le.z<=ce;){if(le.x>=O&&le.x<=$&&le.y>=j&&le.y<=W&&le!==p&&le!==x&&Fa(b,E,I,A,M,D,le.x,le.y)&&di(le.prev,le,le.next)>=0)return!1;le=le.nextZ}return!0}function b_(i,t){let r=i;do{const l=r.prev,p=r.next.next;!qc(l,p)&&Ff(l,r,r.next,p)&&uh(l,p)&&uh(p,l)&&(t.push(l.i,r.i,p.i),dh(r),dh(r.next),r=i=p),r=r.next}while(r!==i);return Bo(r)}function w_(i,t,r,l,p,v){let x=i;do{let b=x.next.next;for(;b!==x.prev;){if(x.i!==b.i&&P_(x,b)){let I=Rf(x,b);return x=Bo(x,x.next),I=Bo(I,I.next),ch(x,t,r,l,p,v,0),void ch(I,t,r,l,p,v,0)}b=b.next}x=x.next}while(x!==i)}function I_(i,t){return i.x-t.x}function C_(i,t){const r=function(p,v){let x=v;const b=p.x,I=p.y;let M,E=-1/0;do{if(I<=x.y&&I>=x.next.y&&x.next.y!==x.y){const $=x.x+(I-x.y)*(x.next.x-x.x)/(x.next.y-x.y);if($<=b&&$>E&&(E=$,M=x.x=x.x&&x.x>=D&&b!==x.x&&Fa(IM.x||x.x===M.x&&S_(M,x)))&&(M=x,j=$)}x=x.next}while(x!==A);return M}(i,t);if(!r)return t;const l=Rf(r,i);return Bo(l,l.next),Bo(r,r.next)}function S_(i,t){return di(i.prev,i,t.prev)<0&&di(t.next,i,i.next)<0}function Md(i,t,r,l,p){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*p|0)|i<<8))|i<<4))|i<<2))|i<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-l)*p|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function M_(i){let t=i,r=i;do(t.x=(i-x)*(v-b)&&(i-x)*(l-b)>=(r-x)*(t-b)&&(r-x)*(v-b)>=(p-x)*(l-b)}function P_(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!function(r,l){let p=r;do{if(p.i!==r.i&&p.next.i!==r.i&&p.i!==l.i&&p.next.i!==l.i&&Ff(p,p.next,r,l))return!0;p=p.next}while(p!==r);return!1}(i,t)&&(uh(i,t)&&uh(t,i)&&function(r,l){let p=r,v=!1;const x=(r.x+l.x)/2,b=(r.y+l.y)/2;do p.y>b!=p.next.y>b&&p.next.y!==p.y&&x<(p.next.x-p.x)*(b-p.y)/(p.next.y-p.y)+p.x&&(v=!v),p=p.next;while(p!==r);return v}(i,t)&&(di(i.prev,i,t.prev)||di(i,t.prev,t))||qc(i,t)&&di(i.prev,i,i.next)>0&&di(t.prev,t,t.next)>0)}function di(i,t,r){return(t.y-i.y)*(r.x-t.x)-(t.x-i.x)*(r.y-t.y)}function qc(i,t){return i.x===t.x&&i.y===t.y}function Ff(i,t,r,l){const p=Gc(di(i,t,r)),v=Gc(di(i,t,l)),x=Gc(di(r,l,i)),b=Gc(di(r,l,t));return p!==v&&x!==b||!(p!==0||!Zc(i,r,t))||!(v!==0||!Zc(i,l,t))||!(x!==0||!Zc(r,i,l))||!(b!==0||!Zc(r,t,l))}function Zc(i,t,r){return t.x<=Math.max(i.x,r.x)&&t.x>=Math.min(i.x,r.x)&&t.y<=Math.max(i.y,r.y)&&t.y>=Math.min(i.y,r.y)}function Gc(i){return i>0?1:i<0?-1:0}function uh(i,t){return di(i.prev,i,i.next)<0?di(i,t,i.next)>=0&&di(i,i.prev,t)>=0:di(i,t,i.prev)<0||di(i,i.next,t)<0}function Rf(i,t){const r=Pd(i.i,i.x,i.y),l=Pd(t.i,t.x,t.y),p=i.next,v=t.prev;return i.next=t,t.prev=i,r.next=p,p.prev=r,l.next=r,r.prev=l,v.next=l,l.prev=v,l}function Of(i,t,r,l){const p=Pd(i,t,r);return l?(p.next=l.next,p.prev=l,l.next.prev=p,l.next=p):(p.prev=p,p.next=p),p}function dh(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 Pd(i,t,r){return{i,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Ed(i,t,r){const l=r.patternDependencies;let p=!1;for(const v of t){const x=v.paint.get(`${i}-pattern`);x.isConstant()||(p=!0);const b=x.constantOr(null);b&&(p=!0,l[b.to]=!0,l[b.from]=!0)}return p}function Td(i,t,r,l,p){const v=p.patternDependencies;for(const x of t){const b=x.paint.get(`${i}-pattern`).value;if(b.kind!=="constant"){let I=b.evaluate({zoom:l-1},r,{},p.availableImages),M=b.evaluate({zoom:l},r,{},p.availableImages),E=b.evaluate({zoom:l+1},r,{},p.availableImages);I=I&&I.name?I.name:I,M=M&&M.name?M.name:M,E=E&&E.name?E.name:E,v[I]=!0,v[M]=!0,v[E]=!0,r.patterns[x.id]={min:I,mid:M,max:E}}}return r}class Ad{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new sn,this.indexArray=new Nr,this.indexArray2=new Pi,this.programConfigurations=new ko(t.layers,t.zoom),this.segments=new xt,this.segments2=new xt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,l){this.hasPattern=Ed("fill",this.layers,r);const p=this.layers[0].layout.get("fill-sort-key"),v=!p.isConstant(),x=[];for(const{feature:b,id:I,index:M,sourceLayerIndex:E}of t){const A=this.layers[0]._featureFilter.needGeometry,D=Lo(b,A);if(!this.layers[0]._featureFilter.filter(new Jt(this.zoom),D,l))continue;const O=v?p.evaluate(D,{},l,r.availableImages):void 0,j={id:I,properties:b.properties,type:b.type,sourceLayerIndex:E,index:M,geometry:A?D.geometry:Do(b),patterns:{},sortKey:O};x.push(j)}v&&x.sort((b,I)=>b.sortKey-I.sortKey);for(const b of x){const{geometry:I,index:M,sourceLayerIndex:E}=b;if(this.hasPattern){const A=Td("fill",this.layers,b,this.zoom,r);this.patternFeatures.push(A)}else this.addFeature(b,I,M,l,{});r.featureIndex.insert(t[M].feature,I,M,E,this.index)}}update(t,r,l){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,l)}addFeatures(t,r,l){for(const p of this.patternFeatures)this.addFeature(p,p.geometry,p.index,r,l)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,__),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),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(t,r,l,p,v){for(const x of oa(r,500)){let b=0;for(const O of x)b+=O.length;const I=this.segments.prepareSegment(b,this.layoutVertexArray,this.indexArray),M=I.vertexLength,E=[],A=[];for(const O of x){if(O.length===0)continue;O!==x[0]&&A.push(E.length/2);const j=this.segments2.prepareSegment(O.length,this.layoutVertexArray,this.indexArray2),$=j.vertexLength;this.layoutVertexArray.emplaceBack(O[0].x,O[0].y),this.indexArray2.emplaceBack($+O.length-1,$),E.push(O[0].x),E.push(O[0].y);for(let W=1;W>3}if(p--,l===1||l===2)v+=i.readSVarint(),x+=i.readSVarint(),l===1&&(t&&b.push(t),t=[]),t.push(new D_(v,x));else{if(l!==7)throw new Error("unknown command "+l);t&&t.push(t[0].clone())}}return t&&b.push(t),b},Ra.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var t=i.readVarint()+i.pos,r=1,l=0,p=0,v=0,x=1/0,b=-1/0,I=1/0,M=-1/0;i.pos>3}if(l--,r===1||r===2)(p+=i.readSVarint())b&&(b=p),(v+=i.readSVarint())M&&(M=v);else if(r!==7)throw new Error("unknown command "+r)}return[x,I,b,M]},Ra.prototype.toGeoJSON=function(i,t,r){var l,p,v=this.extent*Math.pow(2,r),x=this.extent*i,b=this.extent*t,I=this.loadGeometry(),M=Ra.types[this.type];function E(O){for(var j=0;j>3;p=x===1?l.readString():x===2?l.readFloat():x===3?l.readDouble():x===4?l.readVarint64():x===5?l.readVarint():x===6?l.readSVarint():x===7?l.readBoolean():null}return p}(r))}$f.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 t=this._pbf.readVarint()+this._pbf.pos;return new F_(this._pbf,t,this.extent,this._keys,this._values)};var O_=jf;function V_(i,t,r){if(i===3){var l=new O_(r,r.readVarint()+r.pos);l.length&&(t[l.name]=l)}}js.VectorTile=function(i,t){this.layers=i.readFields(V_,{},t)},js.VectorTileFeature=Uf,js.VectorTileLayer=jf;const N_=js.VectorTileFeature.types,zd=Math.pow(2,13);function ph(i,t,r,l,p,v,x,b){i.emplaceBack(t,r,2*Math.floor(l*zd)+x,p*zd*2,v*zd*2,Math.round(b))}class kd{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Fs,this.centroidVertexArray=new Di,this.indexArray=new Nr,this.programConfigurations=new ko(t.layers,t.zoom),this.segments=new xt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,l){this.features=[],this.hasPattern=Ed("fill-extrusion",this.layers,r);for(const{feature:p,id:v,index:x,sourceLayerIndex:b}of t){const I=this.layers[0]._featureFilter.needGeometry,M=Lo(p,I);if(!this.layers[0]._featureFilter.filter(new Jt(this.zoom),M,l))continue;const E={id:v,sourceLayerIndex:b,index:x,geometry:I?M.geometry:Do(p),properties:p.properties,type:p.type,patterns:{}};this.hasPattern?this.features.push(Td("fill-extrusion",this.layers,E,this.zoom,r)):this.addFeature(E,E.geometry,x,l,{}),r.featureIndex.insert(p,E.geometry,x,b,this.index,!0)}}addFeatures(t,r,l){for(const p of this.features){const{geometry:v}=p;this.addFeature(p,v,p.index,r,l)}}update(t,r,l){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,l)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,k_),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,z_.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,r,l,p,v){for(const x of oa(r,500)){const b={x:0,y:0,vertexCount:0};let I=0;for(const j of x)I+=j.length;let M=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const j of x){if(j.length===0||j_(j))continue;let $=0;for(let W=0;W=1){const ce=j[W-1];if(!U_(Y,ce)){M.vertexLength+4>xt.MAX_VERTEX_ARRAY_LENGTH&&(M=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const re=Y.sub(ce)._perp()._unit(),le=ce.dist(Y);$+le>32768&&($=0),ph(this.layoutVertexArray,Y.x,Y.y,re.x,re.y,0,0,$),ph(this.layoutVertexArray,Y.x,Y.y,re.x,re.y,0,1,$),b.x+=2*Y.x,b.y+=2*Y.y,b.vertexCount+=2,$+=le,ph(this.layoutVertexArray,ce.x,ce.y,re.x,re.y,0,0,$),ph(this.layoutVertexArray,ce.x,ce.y,re.x,re.y,0,1,$),b.x+=2*ce.x,b.y+=2*ce.y,b.vertexCount+=2;const me=M.vertexLength;this.indexArray.emplaceBack(me,me+2,me+1),this.indexArray.emplaceBack(me+1,me+2,me+3),M.vertexLength+=4,M.primitiveLength+=2}}}}if(M.vertexLength+I>xt.MAX_VERTEX_ARRAY_LENGTH&&(M=this.segments.prepareSegment(I,this.layoutVertexArray,this.indexArray)),N_[t.type]!=="Polygon")continue;const E=[],A=[],D=M.vertexLength;for(const j of x)if(j.length!==0){j!==x[0]&&A.push(E.length/2);for(let $=0;$yi)||i.y===t.y&&(i.y<0||i.y>yi)}function j_(i){return i.every(t=>t.x<0)||i.every(t=>t.x>yi)||i.every(t=>t.y<0)||i.every(t=>t.y>yi)}let qf;Ve("FillExtrusionBucket",kd,{omit:["layers","features"]});var $_={get paint(){return qf=qf||new _({"fill-extrusion-opacity":new qe(fe["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new tt(fe["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new qe(fe["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new qe(fe["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Ma(fe["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new tt(fe["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new tt(fe["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new qe(fe["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class q_ extends o{constructor(t){super(t,$_)}createBucket(t){return new kd(t)}queryRadius(){return Uc(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(t,r,l,p,v,x,b,I){const M=jc(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),x.angle,b),E=this.paint.get("fill-extrusion-height").evaluate(r,l),A=this.paint.get("fill-extrusion-base").evaluate(r,l),D=function(j,$,W,Y){const ce=[];for(const re of j){const le=[re.x,re.y,0,1];$c(le,le,$),ce.push(new B(le[0]/le[3],le[1]/le[3]))}return ce}(M,I),O=function(j,$,W,Y){const ce=[],re=[],le=Y[8]*$,me=Y[9]*$,we=Y[10]*$,Be=Y[11]*$,et=Y[8]*W,De=Y[9]*W,ze=Y[10]*W,Xe=Y[11]*W;for(const je of j){const Oe=[],_e=[];for(const We of je){const Ge=We.x,ot=We.y,Ut=Y[0]*Ge+Y[4]*ot+Y[12],Nt=Y[1]*Ge+Y[5]*ot+Y[13],wi=Y[2]*Ge+Y[6]*ot+Y[14],on=Y[3]*Ge+Y[7]*ot+Y[15],Fi=wi+we,Ii=on+Be,Yi=Ut+et,Qi=Nt+De,er=wi+ze,hi=on+Xe,Ci=new B((Ut+le)/Ii,(Nt+me)/Ii);Ci.z=Fi/Ii,Oe.push(Ci);const $i=new B(Yi/hi,Qi/hi);$i.z=er/hi,_e.push($i)}ce.push(Oe),re.push(_e)}return[ce,re]}(p,A,E,I);return function(j,$,W){let Y=1/0;wf(W,$)&&(Y=Zf(W,$[0]));for(let ce=0;ce<$.length;ce++){const re=$[ce],le=j[ce];for(let me=0;mer.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new Ea,this.layoutVertexArray2=new Rs,this.indexArray=new Nr,this.programConfigurations=new ko(t.layers,t.zoom),this.segments=new xt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,l){this.hasPattern=Ed("line",this.layers,r);const p=this.layers[0].layout.get("line-sort-key"),v=!p.isConstant(),x=[];for(const{feature:b,id:I,index:M,sourceLayerIndex:E}of t){const A=this.layers[0]._featureFilter.needGeometry,D=Lo(b,A);if(!this.layers[0]._featureFilter.filter(new Jt(this.zoom),D,l))continue;const O=v?p.evaluate(D,{},l):void 0,j={id:I,properties:b.properties,type:b.type,sourceLayerIndex:E,index:M,geometry:A?D.geometry:Do(b),patterns:{},sortKey:O};x.push(j)}v&&x.sort((b,I)=>b.sortKey-I.sortKey);for(const b of x){const{geometry:I,index:M,sourceLayerIndex:E}=b;if(this.hasPattern){const A=Td("line",this.layers,b,this.zoom,r);this.patternFeatures.push(A)}else this.addFeature(b,I,M,l,{});r.featureIndex.insert(t[M].feature,I,M,E,this.index)}}update(t,r,l){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,l)}addFeatures(t,r,l){for(const p of this.patternFeatures)this.addFeature(p,p.geometry,p.index,r,l)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,W_)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,G_),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,r,l,p,v){const x=this.layers[0].layout,b=x.get("line-join").evaluate(t,{}),I=x.get("line-cap"),M=x.get("line-miter-limit"),E=x.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const A of r)this.addLine(A,t,b,I,M,E);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,l,v,p)}addLine(t,r,l,p,v,x){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let Y=0;Y=2&&t[I-1].equals(t[I-2]);)I--;let M=0;for(;M0;if(Be&&Y>M){const Xe=D.dist(O);if(Xe>2*E){const je=D.sub(D.sub(O)._mult(E/Xe)._round());this.updateDistance(O,je),this.addCurrentVertex(je,$,0,0,A),O=je}}const De=O&&j;let ze=De?l:b?"butt":p;if(De&&ze==="round"&&(mev&&(ze="bevel"),ze==="bevel"&&(me>2&&(ze="flipbevel"),me100)ce=W.mult(-1);else{const Xe=me*$.add(W).mag()/$.sub(W).mag();ce._perp()._mult(Xe*(et?-1:1))}this.addCurrentVertex(D,ce,0,0,A),this.addCurrentVertex(D,ce.mult(-1),0,0,A)}else if(ze==="bevel"||ze==="fakeround"){const Xe=-Math.sqrt(me*me-1),je=et?Xe:0,Oe=et?0:Xe;if(O&&this.addCurrentVertex(D,$,je,Oe,A),ze==="fakeround"){const _e=Math.round(180*we/Math.PI/20);for(let We=1;We<_e;We++){let Ge=We/_e;if(Ge!==.5){const Ut=Ge-.5;Ge+=Ge*Ut*(Ge-1)*((1.0904+re*(re*(3.55645-1.43519*re)-3.2452))*Ut*Ut+(.848013+re*(.215638*re-1.06021)))}const ot=W.sub($)._mult(Ge)._add($)._unit()._mult(et?-1:1);this.addHalfVertex(D,ot.x,ot.y,!1,et,0,A)}}j&&this.addCurrentVertex(D,W,-je,-Oe,A)}else if(ze==="butt")this.addCurrentVertex(D,ce,0,0,A);else if(ze==="square"){const Xe=O?1:-1;this.addCurrentVertex(D,ce,Xe,Xe,A)}else ze==="round"&&(O&&(this.addCurrentVertex(D,$,0,0,A),this.addCurrentVertex(D,$,1,1,A,!0)),j&&(this.addCurrentVertex(D,W,-1,-1,A,!0),this.addCurrentVertex(D,W,0,0,A)));if(Be&&Y2*E){const je=D.add(j.sub(D)._mult(E/Xe)._round());this.updateDistance(D,je),this.addCurrentVertex(je,W,0,0,A),D=je}}}}addCurrentVertex(t,r,l,p,v,x=!1){const b=r.y*p-r.x,I=-r.y-r.x*p;this.addHalfVertex(t,r.x+r.y*l,r.y-r.x*l,x,!1,l,v),this.addHalfVertex(t,b,I,x,!0,-p,v),this.distance>Gf/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,r,l,p,v,x))}addHalfVertex({x:t,y:r},l,p,v,x,b,I){const M=.5*(this.lineClips?this.scaledDistance*(Gf-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(v?1:0),(r<<1)+(x?1:0),Math.round(63*l)+128,Math.round(63*p)+128,1+(b===0?0:b<0?-1:1)|(63&M)<<2,M>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const E=I.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,E),I.primitiveLength++),x?this.e2=E:this.e1=E}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,r){this.distance+=t.dist(r),this.updateScaledDistance()}}let Xf,Wf;Ve("LineBucket",Dd,{omit:["layers","patternFeatures"]});var Hf={get paint(){return Wf=Wf||new _({"line-opacity":new tt(fe.paint_line["line-opacity"]),"line-color":new tt(fe.paint_line["line-color"]),"line-translate":new qe(fe.paint_line["line-translate"]),"line-translate-anchor":new qe(fe.paint_line["line-translate-anchor"]),"line-width":new tt(fe.paint_line["line-width"]),"line-gap-width":new tt(fe.paint_line["line-gap-width"]),"line-offset":new tt(fe.paint_line["line-offset"]),"line-blur":new tt(fe.paint_line["line-blur"]),"line-dasharray":new Pa(fe.paint_line["line-dasharray"]),"line-pattern":new Ma(fe.paint_line["line-pattern"]),"line-gradient":new nh(fe.paint_line["line-gradient"])})},get layout(){return Xf=Xf||new _({"line-cap":new qe(fe.layout_line["line-cap"]),"line-join":new tt(fe.layout_line["line-join"]),"line-miter-limit":new qe(fe.layout_line["line-miter-limit"]),"line-round-limit":new qe(fe.layout_line["line-round-limit"]),"line-sort-key":new tt(fe.layout_line["line-sort-key"])})}};class K_ extends tt{possiblyEvaluate(t,r){return r=new Jt(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(t,r)}evaluate(t,r,l,p){return r=Ke({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(t,r,l,p)}}let Xc;class Y_ extends o{constructor(t){super(t,Hf),this.gradientVersion=0,Xc||(Xc=new K_(Hf.paint.properties["line-width"].specification),Xc.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){const r=this.gradientExpression();this.stepInterpolant=!!function(l){return l._styleExpression!==void 0}(r)&&r._styleExpression.expression instanceof ys,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,r){super.recalculate(t,r),this.paint._values["line-floorwidth"]=Xc.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Dd(t)}queryRadius(t){const r=t,l=Jf(ah("line-width",this,r),ah("line-gap-width",this,r)),p=ah("line-offset",this,r);return l/2+Math.abs(p)+Uc(this.paint.get("line-translate"))}queryIntersectsFeature(t,r,l,p,v,x,b){const I=jc(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),x.angle,b),M=b/2*Jf(this.paint.get("line-width").evaluate(r,l),this.paint.get("line-gap-width").evaluate(r,l)),E=this.paint.get("line-offset").evaluate(r,l);return E&&(p=function(A,D){const O=[];for(let j=0;j=3){for(let W=0;W<$.length;W++)if(La(A,$[W]))return!0}if(a_(A,$,O))return!0}return!1}(I,p,M)}isTileClipped(){return!0}}function Jf(i,t){return t>0?t+2*i:i}const Q_=w([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),ev=w([{name:"a_projected_pos",components:3,type:"Float32"}],4);w([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const tv=w([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);w([{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 Kf=w([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),iv=w([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function rv(i,t,r){return i.sections.forEach(l=>{l.text=function(p,v,x){const b=v.layout.get("text-transform").evaluate(x,{});return b==="uppercase"?p=p.toLocaleUpperCase():b==="lowercase"&&(p=p.toLocaleLowerCase()),cr.applyArabicShaping&&(p=cr.applyArabicShaping(p)),p}(l.text,t,r)}),i}w([{name:"triangle",components:3,type:"Uint16"}]),w([{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"}]),w([{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"}]),w([{type:"Float32",name:"offsetX"}]),w([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),w([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const mh={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var vi=24,Yf=Vt,Qf=function(i,t,r,l,p){var v,x,b=8*p-l-1,I=(1<>1,E=-7,A=p-1,D=-1,O=i[t+A];for(A+=D,v=O&(1<<-E)-1,O>>=-E,E+=b;E>0;v=256*v+i[t+A],A+=D,E-=8);for(x=v&(1<<-E)-1,v>>=-E,E+=l;E>0;x=256*x+i[t+A],A+=D,E-=8);if(v===0)v=1-M;else{if(v===I)return x?NaN:1/0*(O?-1:1);x+=Math.pow(2,l),v-=M}return(O?-1:1)*x*Math.pow(2,v-l)},em=function(i,t,r,l,p,v){var x,b,I,M=8*v-p-1,E=(1<>1,D=p===23?Math.pow(2,-24)-Math.pow(2,-77):0,O=0,j=1,$=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(b=isNaN(t)?1:0,x=E):(x=Math.floor(Math.log(t)/Math.LN2),t*(I=Math.pow(2,-x))<1&&(x--,I*=2),(t+=x+A>=1?D/I:D*Math.pow(2,1-A))*I>=2&&(x++,I/=2),x+A>=E?(b=0,x=E):x+A>=1?(b=(t*I-1)*Math.pow(2,p),x+=A):(b=t*Math.pow(2,A-1)*Math.pow(2,p),x=0));p>=8;i[r+O]=255&b,O+=j,b/=256,p-=8);for(x=x<0;i[r+O]=255&x,O+=j,x/=256,M-=8);i[r+O-j]|=128*$};function Vt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}Vt.Varint=0,Vt.Fixed64=1,Vt.Bytes=2,Vt.Fixed32=5;var Ld=4294967296,tm=1/Ld,im=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function ss(i){return i.type===Vt.Bytes?i.readVarint()+i.pos:i.pos+1}function Oa(i,t,r){return r?4294967296*t+(i>>>0):4294967296*(t>>>0)+(i>>>0)}function rm(i,t,r){var l=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));r.realloc(l);for(var p=r.pos-1;p>=i;p--)r.buf[p+l]=r.buf[p]}function nv(i,t){for(var r=0;r>>8,i[r+2]=t>>>16,i[r+3]=t>>>24}function nm(i,t){return(i[t]|i[t+1]<<8|i[t+2]<<16)+(i[t+3]<<24)}Vt.prototype={destroy:function(){this.buf=null},readFields:function(i,t,r){for(r=r||this.length;this.pos>3,v=this.pos;this.type=7&l,i(p,t,this),this.pos===v&&this.skip(l)}return t},readMessage:function(i,t){return this.readFields(i,t,this.readVarint()+this.pos)},readFixed32:function(){var i=Wc(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=nm(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=Wc(this.buf,this.pos)+Wc(this.buf,this.pos+4)*Ld;return this.pos+=8,i},readSFixed64:function(){var i=Wc(this.buf,this.pos)+nm(this.buf,this.pos+4)*Ld;return this.pos+=8,i},readFloat:function(){var i=Qf(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Qf(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var t,r,l=this.buf;return t=127&(r=l[this.pos++]),r<128?t:(t|=(127&(r=l[this.pos++]))<<7,r<128?t:(t|=(127&(r=l[this.pos++]))<<14,r<128?t:(t|=(127&(r=l[this.pos++]))<<21,r<128?t:function(p,v,x){var b,I,M=x.buf;if(b=(112&(I=M[x.pos++]))>>4,I<128||(b|=(127&(I=M[x.pos++]))<<3,I<128)||(b|=(127&(I=M[x.pos++]))<<10,I<128)||(b|=(127&(I=M[x.pos++]))<<17,I<128)||(b|=(127&(I=M[x.pos++]))<<24,I<128)||(b|=(1&(I=M[x.pos++]))<<31,I<128))return Oa(p,b,v);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(r=l[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,t=this.pos;return this.pos=i,i-t>=12&&im?function(r,l,p){return im.decode(r.subarray(l,p))}(this.buf,t,i):function(r,l,p){for(var v="",x=l;x239?4:E>223?3:E>191?2:1;if(x+D>p)break;D===1?E<128&&(A=E):D===2?(192&(b=r[x+1]))==128&&(A=(31&E)<<6|63&b)<=127&&(A=null):D===3?(I=r[x+2],(192&(b=r[x+1]))==128&&(192&I)==128&&((A=(15&E)<<12|(63&b)<<6|63&I)<=2047||A>=55296&&A<=57343)&&(A=null)):D===4&&(I=r[x+2],M=r[x+3],(192&(b=r[x+1]))==128&&(192&I)==128&&(192&M)==128&&((A=(15&E)<<18|(63&b)<<12|(63&I)<<6|63&M)<=65535||A>=1114112)&&(A=null)),A===null?(A=65533,D=1):A>65535&&(A-=65536,v+=String.fromCharCode(A>>>10&1023|55296),A=56320|1023&A),v+=String.fromCharCode(A),x+=D}return v}(this.buf,t,i)},readBytes:function(){var i=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,i);return this.pos=i,t},readPackedVarint:function(i,t){if(this.type!==Vt.Bytes)return i.push(this.readVarint(t));var r=ss(this);for(i=i||[];this.pos127;);else if(t===Vt.Bytes)this.pos=this.readVarint()+this.pos;else if(t===Vt.Fixed32)this.pos+=4;else{if(t!==Vt.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(i,t){this.writeVarint(i<<3|t)},realloc:function(i){for(var t=this.length||16;t268435455||i<0?function(t,r){var l,p;if(t>=0?(l=t%4294967296|0,p=t/4294967296|0):(p=~(-t/4294967296),4294967295^(l=~(-t%4294967296))?l=l+1|0:(l=0,p=p+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(v,x,b){b.buf[b.pos++]=127&v|128,v>>>=7,b.buf[b.pos++]=127&v|128,v>>>=7,b.buf[b.pos++]=127&v|128,v>>>=7,b.buf[b.pos++]=127&v|128,b.buf[b.pos]=127&(v>>>=7)}(l,0,r),function(v,x){var b=(7&v)<<4;x.buf[x.pos++]|=b|((v>>>=3)?128:0),v&&(x.buf[x.pos++]=127&v|((v>>>=7)?128:0),v&&(x.buf[x.pos++]=127&v|((v>>>=7)?128:0),v&&(x.buf[x.pos++]=127&v|((v>>>=7)?128:0),v&&(x.buf[x.pos++]=127&v|((v>>>=7)?128:0),v&&(x.buf[x.pos++]=127&v)))))}(p,r)}(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 t=this.pos;this.pos=function(l,p,v){for(var x,b,I=0;I55295&&x<57344){if(!b){x>56319||I+1===p.length?(l[v++]=239,l[v++]=191,l[v++]=189):b=x;continue}if(x<56320){l[v++]=239,l[v++]=191,l[v++]=189,b=x;continue}x=b-55296<<10|x-56320|65536,b=null}else b&&(l[v++]=239,l[v++]=191,l[v++]=189,b=null);x<128?l[v++]=x:(x<2048?l[v++]=x>>6|192:(x<65536?l[v++]=x>>12|224:(l[v++]=x>>18|240,l[v++]=x>>12&63|128),l[v++]=x>>6&63|128),l[v++]=63&x|128)}return v}(this.buf,i,this.pos);var r=this.pos-t;r>=128&&rm(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),em(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),em(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var t=i.length;this.writeVarint(t),this.realloc(t);for(var r=0;r=128&&rm(r,l,this),this.pos=r-1,this.writeVarint(l),this.pos+=l},writeMessage:function(i,t,r){this.writeTag(i,Vt.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(i,t){t.length&&this.writeMessage(i,nv,t)},writePackedSVarint:function(i,t){t.length&&this.writeMessage(i,sv,t)},writePackedBoolean:function(i,t){t.length&&this.writeMessage(i,lv,t)},writePackedFloat:function(i,t){t.length&&this.writeMessage(i,ov,t)},writePackedDouble:function(i,t){t.length&&this.writeMessage(i,av,t)},writePackedFixed32:function(i,t){t.length&&this.writeMessage(i,hv,t)},writePackedSFixed32:function(i,t){t.length&&this.writeMessage(i,cv,t)},writePackedFixed64:function(i,t){t.length&&this.writeMessage(i,uv,t)},writePackedSFixed64:function(i,t){t.length&&this.writeMessage(i,dv,t)},writeBytesField:function(i,t){this.writeTag(i,Vt.Bytes),this.writeBytes(t)},writeFixed32Field:function(i,t){this.writeTag(i,Vt.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(i,t){this.writeTag(i,Vt.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(i,t){this.writeTag(i,Vt.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(i,t){this.writeTag(i,Vt.Fixed64),this.writeSFixed64(t)},writeVarintField:function(i,t){this.writeTag(i,Vt.Varint),this.writeVarint(t)},writeSVarintField:function(i,t){this.writeTag(i,Vt.Varint),this.writeSVarint(t)},writeStringField:function(i,t){this.writeTag(i,Vt.Bytes),this.writeString(t)},writeFloatField:function(i,t){this.writeTag(i,Vt.Fixed32),this.writeFloat(t)},writeDoubleField:function(i,t){this.writeTag(i,Vt.Fixed64),this.writeDouble(t)},writeBooleanField:function(i,t){this.writeVarintField(i,!!t)}};var Bd=P(Yf);const Fd=3;function pv(i,t,r){i===1&&r.readMessage(fv,t)}function fv(i,t,r){if(i===3){const{id:l,bitmap:p,width:v,height:x,left:b,top:I,advance:M}=r.readMessage(mv,{});t.push({id:l,bitmap:new hh({width:v+2*Fd,height:x+2*Fd},p),metrics:{width:v,height:x,left:b,top:I,advance:M}})}}function mv(i,t,r){i===1?t.id=r.readVarint():i===2?t.bitmap=r.readBytes():i===3?t.width=r.readVarint():i===4?t.height=r.readVarint():i===5?t.left=r.readSVarint():i===6?t.top=r.readSVarint():i===7&&(t.advance=r.readVarint())}const sm=Fd;function om(i){let t=0,r=0;for(const x of i)t+=x.w*x.h,r=Math.max(r,x.w);i.sort((x,b)=>b.h-x.h);const l=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}];let p=0,v=0;for(const x of i)for(let b=l.length-1;b>=0;b--){const I=l[b];if(!(x.w>I.w||x.h>I.h)){if(x.x=I.x,x.y=I.y,v=Math.max(v,x.y+x.h),p=Math.max(p,x.x+x.w),x.w===I.w&&x.h===I.h){const M=l.pop();b=0&&l>=t&&Jc[this.text.charCodeAt(l)];l--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)}substring(t,r){const l=new Na;return l.text=this.text.substring(t,r),l.sectionIndex=this.sectionIndex.slice(t,r),l.sections=this.sections,l}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,r)=>Math.max(t,this.sections[r].scale),0)}addTextSection(t,r){this.text+=t.text,this.sections.push(yh.forText(t.scale,t.fontStack||r));const l=this.sections.length-1;for(let p=0;p=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Hc(i,t,r,l,p,v,x,b,I,M,E,A,D,O,j){const $=Na.fromFeature(i,p);let W;A===m.ah.vertical&&$.verticalizePunctuation();const{processBidirectionalText:Y,processStyledBidirectionalText:ce}=cr;if(Y&&$.sections.length===1){W=[];const me=Y($.toString(),Od($,M,v,t,l,O));for(const we of me){const Be=new Na;Be.text=we,Be.sections=$.sections;for(let et=0;et0&&os>Oi&&(Oi=os)}else{const qr=Be[Pt.fontStack],Ei=qr&&qr[ei];if(Ei&&Ei.rect)qa=Ei.rect,si=Ei.metrics;else{const os=we[Pt.fontStack],Ih=os&&os[ei];if(!Ih)continue;si=Ih.metrics}Pr=(Ci-Pt.scale)*vi}an?(me.verticalizable=!0,tr.push({glyph:ei,imageName:Dn,x:ot,y:Ut+Pr,vertical:an,scale:Pt.scale,fontStack:Pt.fontStack,sectionIndex:Xt,metrics:si,rect:qa}),ot+=Ln*Pt.scale+_e):(tr.push({glyph:ei,imageName:Dn,x:ot,y:Ut+Pr,vertical:an,scale:Pt.scale,fontStack:Pt.fontStack,sectionIndex:Xt,metrics:si,rect:qa}),ot+=si.advance*Pt.scale+_e)}tr.length!==0&&(Nt=Math.max(ot-_e,Nt),vv(tr,0,tr.length-1,on,Oi)),ot=0;const $r=ze*Ci+Oi;Ri.lineOffset=Math.max(Oi,$i),Ut+=$r,wi=Math.max($r,wi),++Fi}var Ii;const Yi=Ut-gh,{horizontalAlign:Qi,verticalAlign:er}=Vd(Xe);(function(hi,Ci,$i,Ri,tr,Oi,$r,pr,Pt){const Xt=(Ci-$i)*tr;let ei=0;ei=Oi!==$r?-pr*Ri-gh:(-Ri*Pt+.5)*$r;for(const Pr of hi)for(const si of Pr.positionedGlyphs)si.x+=Xt,si.y+=ei})(me.positionedLines,on,Qi,er,Nt,wi,ze,Yi,De.length),me.top+=-er*Yi,me.bottom=me.top+Yi,me.left+=-Qi*Nt,me.right=me.left+Nt}(le,t,r,l,W,x,b,I,A,M,D,j),!function(me){for(const we of me)if(we.positionedGlyphs.length!==0)return!1;return!0}(re)&&le}const Jc={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},gv={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},yv={40:!0};function lm(i,t,r,l,p,v){if(t.imageName){const x=l[t.imageName];return x?x.displaySize[0]*t.scale*vi/v+p:0}{const x=r[t.fontStack],b=x&&x[i];return b?b.metrics.advance*t.scale+p:0}}function hm(i,t,r,l){const p=Math.pow(i-t,2);return l?i=0;let M=0;for(let A=0;AM){const E=Math.ceil(v/M);p*=E/x,x=E}return{x1:l,y1:p,x2:l+v,y2:p+x}}function pm(i,t,r,l,p,v){const x=i.image;let b;if(x.content){const W=x.content,Y=x.pixelRatio||1;b=[W[0]/Y,W[1]/Y,x.displaySize[0]-W[2]/Y,x.displaySize[1]-W[3]/Y]}const I=t.left*v,M=t.right*v;let E,A,D,O;r==="width"||r==="both"?(O=p[0]+I-l[3],A=p[0]+M+l[1]):(O=p[0]+(I+M-x.displaySize[0])/2,A=O+x.displaySize[0]);const j=t.top*v,$=t.bottom*v;return r==="height"||r==="both"?(E=p[1]+j-l[0],D=p[1]+$+l[2]):(E=p[1]+(j+$-x.displaySize[1])/2,D=E+x.displaySize[1]),{image:x,top:E,right:A,bottom:D,left:O,collisionPadding:b}}const _h=255,kn=128,qs=_h*kn;function fm(i,t){const{expression:r}=t;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Jt(i+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:l,interpolationType:p}=r;let v=0;for(;vx.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=wd([]),this.placementViewportMatrix=wd([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=fm(this.zoom,r["text-size"]),this.iconSizeData=fm(this.zoom,r["icon-size"]);const l=this.layers[0].layout,p=l.get("symbol-sort-key"),v=l.get("symbol-z-order");this.canOverlap=Nd(l,"text-overlap","text-allow-overlap")!=="never"||Nd(l,"icon-overlap","icon-allow-overlap")!=="never"||l.get("text-ignore-placement")||l.get("icon-ignore-placement"),this.sortFeaturesByKey=v!=="viewport-y"&&!p.isConstant(),this.sortFeaturesByY=(v==="viewport-y"||v==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,l.get("symbol-placement")==="point"&&(this.writingModes=l.get("text-writing-mode").map(x=>m.ah[x])),this.stateDependentLayerIds=this.layers.filter(x=>x.isStateDependent()).map(x=>x.id),this.sourceID=t.sourceID}createArrays(){this.text=new jd(new ko(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new jd(new ko(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new Yt,this.lineVertexArray=new ki,this.symbolInstances=new yt,this.textAnchorOffsets=new Qt}calculateGlyphDependencies(t,r,l,p,v){for(let x=0;x0)&&(x.value.kind!=="constant"||x.value.value.length>0),E=I.value.kind!=="constant"||!!I.value.value||Object.keys(I.parameters).length>0,A=v.get("symbol-sort-key");if(this.features=[],!M&&!E)return;const D=r.iconDependencies,O=r.glyphDependencies,j=r.availableImages,$=new Jt(this.zoom);for(const{feature:W,id:Y,index:ce,sourceLayerIndex:re}of t){const le=p._featureFilter.needGeometry,me=Lo(W,le);if(!p._featureFilter.filter($,me,l))continue;let we,Be;if(le||(me.geometry=Do(W)),M){const De=p.getValueAndResolveTokens("text-field",me,l,j),ze=or.factory(De),Xe=this.hasRTLText=this.hasRTLText||Iv(ze);(!Xe||cr.getRTLTextPluginStatus()==="unavailable"||Xe&&cr.isParsed())&&(we=rv(ze,p,me))}if(E){const De=p.getValueAndResolveTokens("icon-image",me,l,j);Be=De instanceof lr?De:lr.fromString(De)}if(!we&&!Be)continue;const et=this.sortFeaturesByKey?A.evaluate(me,{},l):void 0;if(this.features.push({id:Y,text:we,icon:Be,index:ce,sourceLayerIndex:re,geometry:me.geometry,properties:W.properties,type:bv[W.type],sortKey:et}),Be&&(D[Be.name]=!0),we){const De=x.evaluate(me,{},l).join(","),ze=v.get("text-rotation-alignment")!=="viewport"&&v.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(m.ah.vertical)>=0;for(const Xe of we.sections)if(Xe.image)D[Xe.image.name]=!0;else{const je=eh(we.toString()),Oe=Xe.fontStack||De,_e=O[Oe]=O[Oe]||{};this.calculateGlyphDependencies(Xe.text,_e,ze,this.allowVerticalPlacement,je)}}}v.get("symbol-placement")==="line"&&(this.features=function(W){const Y={},ce={},re=[];let le=0;function me(De){re.push(W[De]),le++}function we(De,ze,Xe){const je=ce[De];return delete ce[De],ce[ze]=je,re[je].geometry[0].pop(),re[je].geometry[0]=re[je].geometry[0].concat(Xe[0]),je}function Be(De,ze,Xe){const je=Y[ze];return delete Y[ze],Y[De]=je,re[je].geometry[0].shift(),re[je].geometry[0]=Xe[0].concat(re[je].geometry[0]),je}function et(De,ze,Xe){const je=Xe?ze[0][ze[0].length-1]:ze[0][0];return`${De}:${je.x}:${je.y}`}for(let De=0;DeDe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((W,Y)=>W.sortKey-Y.sortKey)}update(t,r,l){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,r,this.layers,l),this.icon.programConfigurations.updatePaintArrays(t,r,this.layers,l))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,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(t,r){const l=this.lineVertexArray.length;if(t.segment!==void 0){let p=t.dist(r[t.segment+1]),v=t.dist(r[t.segment]);const x={};for(let b=t.segment+1;b=0;b--)x[b]={x:r[b].x,y:r[b].y,tileUnitDistanceFromAnchor:v},b>0&&(v+=r[b-1].dist(r[b]));for(let b=0;b0}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(t,r){const l=t.placedSymbolArray.get(r),p=l.vertexStartIndex+4*l.numGlyphs;for(let v=l.vertexStartIndex;vp[b]-p[I]||v[I]-v[b]),x}addToSortKeyRanges(t,r){const l=this.sortKeyRanges[this.sortKeyRanges.length-1];l&&l.sortKey===r?l.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const l=this.symbolInstances.get(r);this.featureSortOrder.push(l.featureIndex),[l.rightJustifiedTextSymbolIndex,l.centerJustifiedTextSymbolIndex,l.leftJustifiedTextSymbolIndex].forEach((p,v,x)=>{p>=0&&x.indexOf(p)===v&&this.addIndicesForPlacedSymbol(this.text,p)}),l.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,l.verticalPlacedTextSymbolIndex),l.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,l.placedIconSymbolIndex),l.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,l.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let mm,gm;Ve("SymbolBucket",Ua,{omit:["layers","collisionBoxArray","features","compareText"]}),Ua.MAX_GLYPHS=65535,Ua.addDynamicAttributes=Ud;var qd={get paint(){return gm=gm||new _({"icon-opacity":new tt(fe.paint_symbol["icon-opacity"]),"icon-color":new tt(fe.paint_symbol["icon-color"]),"icon-halo-color":new tt(fe.paint_symbol["icon-halo-color"]),"icon-halo-width":new tt(fe.paint_symbol["icon-halo-width"]),"icon-halo-blur":new tt(fe.paint_symbol["icon-halo-blur"]),"icon-translate":new qe(fe.paint_symbol["icon-translate"]),"icon-translate-anchor":new qe(fe.paint_symbol["icon-translate-anchor"]),"text-opacity":new tt(fe.paint_symbol["text-opacity"]),"text-color":new tt(fe.paint_symbol["text-color"],{runtimeType:Xi,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new tt(fe.paint_symbol["text-halo-color"]),"text-halo-width":new tt(fe.paint_symbol["text-halo-width"]),"text-halo-blur":new tt(fe.paint_symbol["text-halo-blur"]),"text-translate":new qe(fe.paint_symbol["text-translate"]),"text-translate-anchor":new qe(fe.paint_symbol["text-translate-anchor"])})},get layout(){return mm=mm||new _({"symbol-placement":new qe(fe.layout_symbol["symbol-placement"]),"symbol-spacing":new qe(fe.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new qe(fe.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new tt(fe.layout_symbol["symbol-sort-key"]),"symbol-z-order":new qe(fe.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new qe(fe.layout_symbol["icon-allow-overlap"]),"icon-overlap":new qe(fe.layout_symbol["icon-overlap"]),"icon-ignore-placement":new qe(fe.layout_symbol["icon-ignore-placement"]),"icon-optional":new qe(fe.layout_symbol["icon-optional"]),"icon-rotation-alignment":new qe(fe.layout_symbol["icon-rotation-alignment"]),"icon-size":new tt(fe.layout_symbol["icon-size"]),"icon-text-fit":new qe(fe.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new qe(fe.layout_symbol["icon-text-fit-padding"]),"icon-image":new tt(fe.layout_symbol["icon-image"]),"icon-rotate":new tt(fe.layout_symbol["icon-rotate"]),"icon-padding":new tt(fe.layout_symbol["icon-padding"]),"icon-keep-upright":new qe(fe.layout_symbol["icon-keep-upright"]),"icon-offset":new tt(fe.layout_symbol["icon-offset"]),"icon-anchor":new tt(fe.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new qe(fe.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new qe(fe.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new qe(fe.layout_symbol["text-rotation-alignment"]),"text-field":new tt(fe.layout_symbol["text-field"]),"text-font":new tt(fe.layout_symbol["text-font"]),"text-size":new tt(fe.layout_symbol["text-size"]),"text-max-width":new tt(fe.layout_symbol["text-max-width"]),"text-line-height":new qe(fe.layout_symbol["text-line-height"]),"text-letter-spacing":new tt(fe.layout_symbol["text-letter-spacing"]),"text-justify":new tt(fe.layout_symbol["text-justify"]),"text-radial-offset":new tt(fe.layout_symbol["text-radial-offset"]),"text-variable-anchor":new qe(fe.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new tt(fe.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new tt(fe.layout_symbol["text-anchor"]),"text-max-angle":new qe(fe.layout_symbol["text-max-angle"]),"text-writing-mode":new qe(fe.layout_symbol["text-writing-mode"]),"text-rotate":new tt(fe.layout_symbol["text-rotate"]),"text-padding":new qe(fe.layout_symbol["text-padding"]),"text-keep-upright":new qe(fe.layout_symbol["text-keep-upright"]),"text-transform":new tt(fe.layout_symbol["text-transform"]),"text-offset":new tt(fe.layout_symbol["text-offset"]),"text-allow-overlap":new qe(fe.layout_symbol["text-allow-overlap"]),"text-overlap":new qe(fe.layout_symbol["text-overlap"]),"text-ignore-placement":new qe(fe.layout_symbol["text-ignore-placement"]),"text-optional":new qe(fe.layout_symbol["text-optional"])})}};class ym{constructor(t){if(t.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:Mn,this.defaultValue=t}evaluate(t){if(t.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(t.formattedSection))return r.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Ve("FormatSectionOverride",ym,{omit:["defaultValue"]});class Yc extends o{constructor(t){super(t,qd)}recalculate(t,r){if(super.recalculate(t,r),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 l=this.layout.get("text-writing-mode");if(l){const p=[];for(const v of l)p.indexOf(v)<0&&p.push(v);this.layout._values["text-writing-mode"]=p}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,r,l,p){const v=this.layout.get(t).evaluate(r,{},l,p),x=this._unevaluatedLayout._values[t];return x.isDataDriven()||fa(x.value)||!v?v:function(b,I){return I.replace(/{([^{}]+)}/g,(M,E)=>b&&E in b?String(b[E]):"")}(r.properties,v)}createBucket(t){return new Ua(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of qd.paint.overridableProperties){if(!Yc.hasPaintOverride(this.layout,t))continue;const r=this.paint.get(t),l=new ym(r),p=new pa(l,r.property.specification);let v=null;v=r.value.kind==="constant"||r.value.kind==="source"?new Ms("source",p):new Ps("composite",p,r.value.zoomStops),this.paint._values[t]=new nn(r.property,v,r.parameters)}}_handleOverridablePaintPropertyUpdate(t,r,l){return!(!this.layout||r.isDataDriven()||l.isDataDriven())&&Yc.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,r){const l=t.get("text-field"),p=qd.paint.properties[r];let v=!1;const x=b=>{for(const I of b)if(p.overrides&&p.overrides.hasOverride(I))return void(v=!0)};if(l.value.kind==="constant"&&l.value.value instanceof or)x(l.value.value.sections);else if(l.value.kind==="source"){const b=M=>{v||(M instanceof Lr&&gi(M.value)===mn?x(M.value.sections):M instanceof na?x(M.sections):M.eachChild(b))},I=l.value;I._styleExpression&&b(I._styleExpression.expression)}return v}}let _m;var Cv={get paint(){return _m=_m||new _({"background-color":new qe(fe.paint_background["background-color"]),"background-pattern":new Pa(fe.paint_background["background-pattern"]),"background-opacity":new qe(fe.paint_background["background-opacity"])})}};class Sv extends o{constructor(t){super(t,Cv)}}let vm;var Mv={get paint(){return vm=vm||new _({"raster-opacity":new qe(fe.paint_raster["raster-opacity"]),"raster-hue-rotate":new qe(fe.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new qe(fe.paint_raster["raster-brightness-min"]),"raster-brightness-max":new qe(fe.paint_raster["raster-brightness-max"]),"raster-saturation":new qe(fe.paint_raster["raster-saturation"]),"raster-contrast":new qe(fe.paint_raster["raster-contrast"]),"raster-resampling":new qe(fe.paint_raster["raster-resampling"]),"raster-fade-duration":new qe(fe.paint_raster["raster-fade-duration"])})}};class Pv extends o{constructor(t){super(t,Mv)}}class Ev extends o{constructor(t){super(t,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=t}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 Tv{constructor(t){this._methodToThrottle=t,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 Zd=63710088e-1;class Zs{constructor(t,r){if(isNaN(t)||isNaN(r))throw new Error(`Invalid LngLat object: (${t}, ${r})`);if(this.lng=+t,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Zs(bt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const r=Math.PI/180,l=this.lat*r,p=t.lat*r,v=Math.sin(l)*Math.sin(p)+Math.cos(l)*Math.cos(p)*Math.cos((t.lng-this.lng)*r);return Zd*Math.acos(Math.min(v,1))}static convert(t){if(t instanceof Zs)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new Zs(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new Zs(Number("lng"in t?t.lng:t.lon),Number(t.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 xm=2*Math.PI*Zd;function bm(i){return xm*Math.cos(i*Math.PI/180)}function wm(i){return(180+i)/360}function Im(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function Cm(i,t){return i/bm(t)}function Gd(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class vh{constructor(t,r,l=0){this.x=+t,this.y=+r,this.z=+l}static fromLngLat(t,r=0){const l=Zs.convert(t);return new vh(wm(l.lng),Im(l.lat),Cm(r,l.lat))}toLngLat(){return new Zs(360*this.x-180,Gd(this.y))}toAltitude(){return this.z*bm(Gd(this.y))}meterInMercatorCoordinateUnits(){return 1/xm*(t=Gd(this.y),1/Math.cos(t*Math.PI/180));var t}}function Sm(i,t,r){var l=2*Math.PI*6378137/256/Math.pow(2,r);return[i*l-2*Math.PI*6378137/2,t*l-2*Math.PI*6378137/2]}class Xd{constructor(t,r,l){if(!function(p,v,x){return!(p<0||p>25||x<0||x>=Math.pow(2,p)||v<0||v>=Math.pow(2,p))}(t,r,l))throw new Error(`x=${r}, y=${l}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=r,this.y=l,this.key=xh(0,t,t,r,l)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,r,l){const p=(x=this.y,b=this.z,I=Sm(256*(v=this.x),256*(x=Math.pow(2,b)-x-1),b),M=Sm(256*(v+1),256*(x+1),b),I[0]+","+I[1]+","+M[0]+","+M[1]);var v,x,b,I,M;const E=function(A,D,O){let j,$="";for(let W=A;W>0;W--)j=1<1?"@2x":"").replace(/{quadkey}/g,E).replace(/{bbox-epsg-3857}/g,p)}isChildOf(t){const r=this.z-t.z;return r>0&&t.x===this.x>>r&&t.y===this.y>>r}getTilePoint(t){const r=Math.pow(2,this.z);return new B((t.x*r-this.x)*yi,(t.y*r-this.y)*yi)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Mm{constructor(t,r){this.wrap=t,this.canonical=r,this.key=xh(t,r.z,r.z,r.x,r.y)}}class jr{constructor(t,r,l,p,v){if(t= z; overscaledZ = ${t}; z = ${l}`);this.overscaledZ=t,this.wrap=r,this.canonical=new Xd(l,+p,+v),this.key=xh(r,t,l,p,v)}clone(){return new jr(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-t;return t>this.canonical.z?new jr(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new jr(t,this.wrap,t,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(t,r){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const l=this.canonical.z-t;return t>this.canonical.z?xh(this.wrap*+r,t,this.canonical.z,this.canonical.x,this.canonical.y):xh(this.wrap*+r,t,t,this.canonical.x>>l,this.canonical.y>>l)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const r=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ>r&&t.canonical.y===this.canonical.y>>r}children(t){if(this.overscaledZ>=t)return[new jr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,l=2*this.canonical.x,p=2*this.canonical.y;return[new jr(r,this.wrap,r,l,p),new jr(r,this.wrap,r,l+1,p),new jr(r,this.wrap,r,l,p+1),new jr(r,this.wrap,r,l+1,p+1)]}isLessThan(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.ythis.max&&(this.max=A),A=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(t+1)}unpack(t,r,l){return t*this.redFactor+r*this.greenFactor+l*this.blueFactor-this.baseShift}getPixels(){return new Ur({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,r,l){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let p=r*this.dim,v=r*this.dim+this.dim,x=l*this.dim,b=l*this.dim+this.dim;switch(r){case-1:p=v-1;break;case 1:v=p+1}switch(l){case-1:x=b-1;break;case 1:b=x+1}const I=-r*this.dim,M=-l*this.dim;for(let E=x;E=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class Tm{constructor(t,r,l,p,v){this.type="Feature",this._vectorTileFeature=t,t._z=r,t._x=l,t._y=p,this.properties=t.properties,this.id=v}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(t[r]=this[r]);return t}}class Am{constructor(t,r){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new zs(yi,16,0),this.grid3D=new zs(yi,16,0),this.featureIndexArray=new Ui,this.promoteId=r}insert(t,r,l,p,v,x){const b=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(l,p,v);const I=x?this.grid3D:this.grid;for(let M=0;M=0&&A[3]>=0&&I.insert(b,A[0],A[1],A[2],A[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new js.VectorTile(new Bd(this.rawTileData)).layers,this.sourceLayerCoder=new Em(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,r,l,p){this.loadVTLayers();const v=t.params||{},x=yi/t.tileSize/t.scale,b=Vl(v.filter),I=t.queryGeometry,M=t.queryPadding*x,E=km(I),A=this.grid.query(E.minX-M,E.minY-M,E.maxX+M,E.maxY+M),D=km(t.cameraQueryGeometry),O=this.grid3D.query(D.minX-M,D.minY-M,D.maxX+M,D.maxY+M,(W,Y,ce,re)=>function(le,me,we,Be,et){for(const ze of le)if(me<=ze.x&&we<=ze.y&&Be>=ze.x&&et>=ze.y)return!0;const De=[new B(me,we),new B(me,et),new B(Be,et),new B(Be,we)];if(le.length>2){for(const ze of De)if(La(le,ze))return!0}for(let ze=0;ze(re||(re=Do(le)),me.queryIntersectsFeature(I,le,we,re,this.z,t.transform,x,t.pixelPosMatrix)))}return j}loadMatchingFeature(t,r,l,p,v,x,b,I,M,E,A){const D=this.bucketLayerIDs[r];if(x&&!function(W,Y){for(let ce=0;ce=0)return!0;return!1}(x,D))return;const O=this.sourceLayerCoder.decode(l),j=this.vtLayers[O].feature(p);if(v.needGeometry){const W=Lo(j,!0);if(!v.filter(new Jt(this.tileID.overscaledZ),W,this.tileID.canonical))return}else if(!v.filter(new Jt(this.tileID.overscaledZ),j))return;const $=this.getId(j,O);for(let W=0;W{const b=t instanceof To?t.get(x):null;return b&&b.evaluate?b.evaluate(r,l,p):b})}function km(i){let t=1/0,r=1/0,l=-1/0,p=-1/0;for(const v of i)t=Math.min(t,v.x),r=Math.min(r,v.y),l=Math.max(l,v.x),p=Math.max(p,v.y);return{minX:t,minY:r,maxX:l,maxY:p}}function Av(i,t){return t-i}function Dm(i,t,r,l,p){const v=[];for(let x=0;x=l&&A.x>=l||(E.x>=l?E=new B(l,E.y+(l-E.x)/(A.x-E.x)*(A.y-E.y))._round():A.x>=l&&(A=new B(l,E.y+(l-E.x)/(A.x-E.x)*(A.y-E.y))._round()),E.y>=p&&A.y>=p||(E.y>=p?E=new B(E.x+(p-E.y)/(A.y-E.y)*(A.x-E.x),p)._round():A.y>=p&&(A=new B(E.x+(p-E.y)/(A.y-E.y)*(A.x-E.x),p)._round()),I&&E.equals(I[I.length-1])||(I=[E],v.push(I)),I.push(A)))))}}return v}Ve("FeatureIndex",Am,{omit:["rawTileData","sourceLayerCoder"]});class Gs extends B{constructor(t,r,l,p){super(t,r),this.angle=l,p!==void 0&&(this.segment=p)}clone(){return new Gs(this.x,this.y,this.angle,this.segment)}}function Lm(i,t,r,l,p){if(t.segment===void 0||r===0)return!0;let v=t,x=t.segment+1,b=0;for(;b>-r/2;){if(x--,x<0)return!1;b-=i[x].dist(v),v=i[x]}b+=i[x].dist(i[x+1]),x++;const I=[];let M=0;for(;bl;)M-=I.shift().angleDelta;if(M>p)return!1;x++,b+=E.dist(A)}return!0}function Bm(i){let t=0;for(let r=0;rM){const j=(M-I)/O,$=Wi.number(A.x,D.x,j),W=Wi.number(A.y,D.y,j),Y=new Gs($,W,D.angleTo(A),E);return Y._round(),!x||Lm(i,Y,b,x,t)?Y:void 0}I+=O}}function kv(i,t,r,l,p,v,x,b,I){const M=Fm(l,v,x),E=Rm(l,p),A=E*x,D=i[0].x===0||i[0].x===I||i[0].y===0||i[0].y===I;return t-A=0&&le=0&&me=0&&D+M<=E){const we=new Gs(le,me,ce,j);we._round(),l&&!Lm(i,we,v,l,p)||O.push(we)}}A+=Y}return b||O.length||x||(O=Om(i,A/2,r,l,p,v,x,!0,I)),O}Ve("Anchor",Gs);const ja=dr;function Vm(i,t,r,l){const p=[],v=i.image,x=v.pixelRatio,b=v.paddedRect.w-2*ja,I=v.paddedRect.h-2*ja;let M={x1:i.left,y1:i.top,x2:i.right,y2:i.bottom};const E=v.stretchX||[[0,b]],A=v.stretchY||[[0,I]],D=(_e,We)=>_e+We[1]-We[0],O=E.reduce(D,0),j=A.reduce(D,0),$=b-O,W=I-j;let Y=0,ce=O,re=0,le=j,me=0,we=$,Be=0,et=W;if(v.content&&l){const _e=v.content,We=_e[2]-_e[0],Ge=_e[3]-_e[1];(v.textFitWidth||v.textFitHeight)&&(M=dm(i)),Y=Qc(E,0,_e[0]),re=Qc(A,0,_e[1]),ce=Qc(E,_e[0],_e[2]),le=Qc(A,_e[1],_e[3]),me=_e[0]-Y,Be=_e[1]-re,we=We-ce,et=Ge-le}const De=M.x1,ze=M.y1,Xe=M.x2-De,je=M.y2-ze,Oe=(_e,We,Ge,ot)=>{const Ut=eu(_e.stretch-Y,ce,Xe,De),Nt=tu(_e.fixed-me,we,_e.stretch,O),wi=eu(We.stretch-re,le,je,ze),on=tu(We.fixed-Be,et,We.stretch,j),Fi=eu(Ge.stretch-Y,ce,Xe,De),Ii=tu(Ge.fixed-me,we,Ge.stretch,O),Yi=eu(ot.stretch-re,le,je,ze),Qi=tu(ot.fixed-Be,et,ot.stretch,j),er=new B(Ut,wi),hi=new B(Fi,wi),Ci=new B(Fi,Yi),$i=new B(Ut,Yi),Ri=new B(Nt/x,on/x),tr=new B(Ii/x,Qi/x),Oi=t*Math.PI/180;if(Oi){const Pt=Math.sin(Oi),Xt=Math.cos(Oi),ei=[Xt,-Pt,Pt,Xt];er._matMult(ei),hi._matMult(ei),$i._matMult(ei),Ci._matMult(ei)}const $r=_e.stretch+_e.fixed,pr=We.stretch+We.fixed;return{tl:er,tr:hi,bl:$i,br:Ci,tex:{x:v.paddedRect.x+ja+$r,y:v.paddedRect.y+ja+pr,w:Ge.stretch+Ge.fixed-$r,h:ot.stretch+ot.fixed-pr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Ri,pixelOffsetBR:tr,minFontScaleX:we/x/Xe,minFontScaleY:et/x/je,isSDF:r}};if(l&&(v.stretchX||v.stretchY)){const _e=Nm(E,$,O),We=Nm(A,W,j);for(let Ge=0;Ge<_e.length-1;Ge++){const ot=_e[Ge],Ut=_e[Ge+1];for(let Nt=0;Nt0&&($=Math.max(10,$),this.circleDiameter=$)}else{const D=!((A=x.image)===null||A===void 0)&&A.content&&(x.image.textFitWidth||x.image.textFitHeight)?dm(x):{x1:x.left,y1:x.top,x2:x.right,y2:x.bottom};D.y1=D.y1*b-I[0],D.y2=D.y2*b+I[2],D.x1=D.x1*b-I[3],D.x2=D.x2*b+I[1];const O=x.collisionPadding;if(O&&(D.x1-=O[0]*b,D.y1-=O[1]*b,D.x2+=O[2]*b,D.y2+=O[3]*b),E){const j=new B(D.x1,D.y1),$=new B(D.x2,D.y1),W=new B(D.x1,D.y2),Y=new B(D.x2,D.y2),ce=E*Math.PI/180;j._rotate(ce),$._rotate(ce),W._rotate(ce),Y._rotate(ce),D.x1=Math.min(j.x,$.x,W.x,Y.x),D.x2=Math.max(j.x,$.x,W.x,Y.x),D.y1=Math.min(j.y,$.y,W.y,Y.y),D.y2=Math.max(j.y,$.y,W.y,Y.y)}t.emplaceBack(r.x,r.y,D.x1,D.y1,D.x2,D.y2,l,p,v)}this.boxEndIndex=t.length}}class Dv{constructor(t=[],r=(l,p)=>lp?1:0){if(this.data=t,this.length=this.data.length,this.compare=r,this.length>0)for(let l=(this.length>>1)-1;l>=0;l--)this._down(l)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;const t=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:r,compare:l}=this,p=r[t];for(;t>0;){const v=t-1>>1,x=r[v];if(l(p,x)>=0)break;r[t]=x,t=v}r[t]=p}_down(t){const{data:r,compare:l}=this,p=this.length>>1,v=r[t];for(;t=0)break;r[t]=r[x],t=x}r[t]=v}}function Lv(i,t=1,r=!1){let l=1/0,p=1/0,v=-1/0,x=-1/0;const b=i[0];for(let O=0;Ov)&&(v=j.x),(!O||j.y>x)&&(x=j.y)}const I=Math.min(v-l,x-p);let M=I/2;const E=new Dv([],Bv);if(I===0)return new B(l,p);for(let O=l;OA.d||!A.d)&&(A=O,r&&console.log("found best %d after %d probes",Math.round(1e4*O.d)/1e4,D)),O.max-A.d<=t||(M=O.h/2,E.push(new $a(O.p.x-M,O.p.y-M,M,i)),E.push(new $a(O.p.x+M,O.p.y-M,M,i)),E.push(new $a(O.p.x-M,O.p.y+M,M,i)),E.push(new $a(O.p.x+M,O.p.y+M,M,i)),D+=4)}return r&&(console.log(`num probes: ${D}`),console.log(`best distance: ${A.d}`)),A.p}function Bv(i,t){return t.max-i.max}function $a(i,t,r,l){this.p=new B(i,t),this.h=r,this.d=function(p,v){let x=!1,b=1/0;for(let I=0;Ip.y!=j.y>p.y&&p.x<(j.x-O.x)*(p.y-O.y)/(j.y-O.y)+O.x&&(x=!x),b=Math.min(b,If(p,O,j))}}return(x?1:-1)*Math.sqrt(b)}(this.p,l),this.max=this.d+this.h*Math.SQRT2}var Bi;m.aq=void 0,(Bi=m.aq||(m.aq={}))[Bi.center=1]="center",Bi[Bi.left=2]="left",Bi[Bi.right=3]="right",Bi[Bi.top=4]="top",Bi[Bi.bottom=5]="bottom",Bi[Bi["top-left"]=6]="top-left",Bi[Bi["top-right"]=7]="top-right",Bi[Bi["bottom-left"]=8]="bottom-left",Bi[Bi["bottom-right"]=9]="bottom-right";const Xs=7,Wd=Number.POSITIVE_INFINITY;function Um(i,t){return t[1]!==Wd?function(r,l,p){let v=0,x=0;switch(l=Math.abs(l),p=Math.abs(p),r){case"top-right":case"top-left":case"top":x=p-Xs;break;case"bottom-right":case"bottom-left":case"bottom":x=-p+Xs}switch(r){case"top-right":case"bottom-right":case"right":v=-l;break;case"top-left":case"bottom-left":case"left":v=l}return[v,x]}(i,t[0],t[1]):function(r,l){let p=0,v=0;l<0&&(l=0);const x=l/Math.SQRT2;switch(r){case"top-right":case"top-left":v=x-Xs;break;case"bottom-right":case"bottom-left":v=-x+Xs;break;case"bottom":v=-l+Xs;break;case"top":v=l-Xs}switch(r){case"top-right":case"bottom-right":p=-x;break;case"top-left":case"bottom-left":p=x;break;case"left":p=l;break;case"right":p=-l}return[p,v]}(i,t[0])}function jm(i,t,r){var l;const p=i.layout,v=(l=p.get("text-variable-anchor-offset"))===null||l===void 0?void 0:l.evaluate(t,{},r);if(v){const b=v.values,I=[];for(let M=0;MD*vi);E.startsWith("top")?A[1]-=Xs:E.startsWith("bottom")&&(A[1]+=Xs),I[M+1]=A}return new xr(I)}const x=p.get("text-variable-anchor");if(x){let b;b=i._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[p.get("text-radial-offset").evaluate(t,{},r)*vi,Wd]:p.get("text-offset").evaluate(t,{},r).map(M=>M*vi);const I=[];for(const M of x)I.push(M,Um(M,b));return new xr(I)}return null}function Hd(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 Fv(i,t,r,l,p,v,x,b,I,M,E){let A=v.textMaxSize.evaluate(t,{});A===void 0&&(A=x);const D=i.layers[0].layout,O=D.get("icon-offset").evaluate(t,{},E),j=qm(r.horizontal),$=x/24,W=i.tilePixelRatio*$,Y=i.tilePixelRatio*A/24,ce=i.tilePixelRatio*b,re=i.tilePixelRatio*D.get("symbol-spacing"),le=D.get("text-padding")*i.tilePixelRatio,me=function(_e,We,Ge,ot=1){const Ut=_e.get("icon-padding").evaluate(We,{},Ge),Nt=Ut&&Ut.values;return[Nt[0]*ot,Nt[1]*ot,Nt[2]*ot,Nt[3]*ot]}(D,t,E,i.tilePixelRatio),we=D.get("text-max-angle")/180*Math.PI,Be=D.get("text-rotation-alignment")!=="viewport"&&D.get("symbol-placement")!=="point",et=D.get("icon-rotation-alignment")==="map"&&D.get("symbol-placement")!=="point",De=D.get("symbol-placement"),ze=re/2,Xe=D.get("icon-text-fit");let je;l&&Xe!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(je=pm(l,r.vertical,Xe,D.get("icon-text-fit-padding"),O,$)),j&&(l=pm(l,j,Xe,D.get("icon-text-fit-padding"),O,$)));const Oe=(_e,We)=>{We.x<0||We.x>=yi||We.y<0||We.y>=yi||function(Ge,ot,Ut,Nt,wi,on,Fi,Ii,Yi,Qi,er,hi,Ci,$i,Ri,tr,Oi,$r,pr,Pt,Xt,ei,Pr,si,qa){const Dn=Ge.addToLineVertexArray(ot,Ut);let Ln,an,qr,Ei,os=0,Ih=0,Wm=0,Hm=0,rp=-1,np=-1;const as={};let Jm=Aa("");if(Ge.allowVerticalPlacement&&Nt.vertical){const qi=Ii.layout.get("text-rotate").evaluate(Xt,{},si)+90;qr=new iu(Yi,ot,Qi,er,hi,Nt.vertical,Ci,$i,Ri,qi),Fi&&(Ei=new iu(Yi,ot,Qi,er,hi,Fi,Oi,$r,Ri,qi))}if(wi){const qi=Ii.layout.get("icon-rotate").evaluate(Xt,{}),Zr=Ii.layout.get("icon-text-fit")!=="none",Fo=Vm(wi,qi,Pr,Zr),xn=Fi?Vm(Fi,qi,Pr,Zr):void 0;an=new iu(Yi,ot,Qi,er,hi,wi,Oi,$r,!1,qi),os=4*Fo.length;const Ro=Ge.iconSizeData;let Bn=null;Ro.kind==="source"?(Bn=[kn*Ii.layout.get("icon-size").evaluate(Xt,{})],Bn[0]>qs&&ct(`${Ge.layerIds[0]}: Value for "icon-size" is >= ${_h}. Reduce your "icon-size".`)):Ro.kind==="composite"&&(Bn=[kn*ei.compositeIconSizes[0].evaluate(Xt,{},si),kn*ei.compositeIconSizes[1].evaluate(Xt,{},si)],(Bn[0]>qs||Bn[1]>qs)&&ct(`${Ge.layerIds[0]}: Value for "icon-size" is >= ${_h}. Reduce your "icon-size".`)),Ge.addSymbols(Ge.icon,Fo,Bn,Pt,pr,Xt,m.ah.none,ot,Dn.lineStartIndex,Dn.lineLength,-1,si),rp=Ge.icon.placedSymbolArray.length-1,xn&&(Ih=4*xn.length,Ge.addSymbols(Ge.icon,xn,Bn,Pt,pr,Xt,m.ah.vertical,ot,Dn.lineStartIndex,Dn.lineLength,-1,si),np=Ge.icon.placedSymbolArray.length-1)}const Km=Object.keys(Nt.horizontal);for(const qi of Km){const Zr=Nt.horizontal[qi];if(!Ln){Jm=Aa(Zr.text);const xn=Ii.layout.get("text-rotate").evaluate(Xt,{},si);Ln=new iu(Yi,ot,Qi,er,hi,Zr,Ci,$i,Ri,xn)}const Fo=Zr.positionedLines.length===1;if(Wm+=$m(Ge,ot,Zr,on,Ii,Ri,Xt,tr,Dn,Nt.vertical?m.ah.horizontal:m.ah.horizontalOnly,Fo?Km:[qi],as,rp,ei,si),Fo)break}Nt.vertical&&(Hm+=$m(Ge,ot,Nt.vertical,on,Ii,Ri,Xt,tr,Dn,m.ah.vertical,["vertical"],as,np,ei,si));const Vv=Ln?Ln.boxStartIndex:Ge.collisionBoxArray.length,Nv=Ln?Ln.boxEndIndex:Ge.collisionBoxArray.length,Uv=qr?qr.boxStartIndex:Ge.collisionBoxArray.length,jv=qr?qr.boxEndIndex:Ge.collisionBoxArray.length,$v=an?an.boxStartIndex:Ge.collisionBoxArray.length,qv=an?an.boxEndIndex:Ge.collisionBoxArray.length,Zv=Ei?Ei.boxStartIndex:Ge.collisionBoxArray.length,Gv=Ei?Ei.boxEndIndex:Ge.collisionBoxArray.length;let vn=-1;const nu=(qi,Zr)=>qi&&qi.circleDiameter?Math.max(qi.circleDiameter,Zr):Zr;vn=nu(Ln,vn),vn=nu(qr,vn),vn=nu(an,vn),vn=nu(Ei,vn);const Ym=vn>-1?1:0;Ym&&(vn*=qa/vi),Ge.glyphOffsetArray.length>=Ua.MAX_GLYPHS&&ct("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Xt.sortKey!==void 0&&Ge.addToSortKeyRanges(Ge.symbolInstances.length,Xt.sortKey);const Xv=jm(Ii,Xt,si),[Wv,Hv]=function(qi,Zr){const Fo=qi.length,xn=Zr==null?void 0:Zr.values;if((xn==null?void 0:xn.length)>0)for(let Ro=0;Ro=0?as.right:-1,as.center>=0?as.center:-1,as.left>=0?as.left:-1,as.vertical||-1,rp,np,Jm,Vv,Nv,Uv,jv,$v,qv,Zv,Gv,Qi,Wm,Hm,os,Ih,Ym,0,Ci,vn,Wv,Hv)}(i,We,_e,r,l,p,je,i.layers[0],i.collisionBoxArray,t.index,t.sourceLayerIndex,i.index,W,[le,le,le,le],Be,I,ce,me,et,O,t,v,M,E,x)};if(De==="line")for(const _e of Dm(t.geometry,0,0,yi,yi)){const We=kv(_e,re,we,r.vertical||j,l,24,Y,i.overscaling,yi);for(const Ge of We)j&&Rv(i,j.text,ze,Ge)||Oe(_e,Ge)}else if(De==="line-center"){for(const _e of t.geometry)if(_e.length>1){const We=zv(_e,we,r.vertical||j,l,24,Y);We&&Oe(_e,We)}}else if(t.type==="Polygon")for(const _e of oa(t.geometry,0)){const We=Lv(_e,16);Oe(_e[0],new Gs(We.x,We.y,0))}else if(t.type==="LineString")for(const _e of t.geometry)Oe(_e,new Gs(_e[0].x,_e[0].y,0));else if(t.type==="Point")for(const _e of t.geometry)for(const We of _e)Oe([We],new Gs(We.x,We.y,0))}function $m(i,t,r,l,p,v,x,b,I,M,E,A,D,O,j){const $=function(ce,re,le,me,we,Be,et,De){const ze=me.layout.get("text-rotate").evaluate(Be,{})*Math.PI/180,Xe=[];for(const je of re.positionedLines)for(const Oe of je.positionedGlyphs){if(!Oe.rect)continue;const _e=Oe.rect||{};let We=sm+1,Ge=!0,ot=1,Ut=0;const Nt=(we||De)&&Oe.vertical,wi=Oe.metrics.advance*Oe.scale/2;if(De&&re.verticalizable&&(Ut=je.lineOffset/2-(Oe.imageName?-(vi-Oe.metrics.width*Oe.scale)/2:(Oe.scale-1)*vi)),Oe.imageName){const Pt=et[Oe.imageName];Ge=Pt.sdf,ot=Pt.pixelRatio,We=dr/ot}const on=we?[Oe.x+wi,Oe.y]:[0,0];let Fi=we?[0,0]:[Oe.x+wi+le[0],Oe.y+le[1]-Ut],Ii=[0,0];Nt&&(Ii=Fi,Fi=[0,0]);const Yi=Oe.metrics.isDoubleResolution?2:1,Qi=(Oe.metrics.left-We)*Oe.scale-wi+Fi[0],er=(-Oe.metrics.top-We)*Oe.scale+Fi[1],hi=Qi+_e.w/Yi*Oe.scale/ot,Ci=er+_e.h/Yi*Oe.scale/ot,$i=new B(Qi,er),Ri=new B(hi,er),tr=new B(Qi,Ci),Oi=new B(hi,Ci);if(Nt){const Pt=new B(-wi,wi-gh),Xt=-Math.PI/2,ei=vi/2-wi,Pr=new B(5-gh-ei,-(Oe.imageName?ei:0)),si=new B(...Ii);$i._rotateAround(Xt,Pt)._add(Pr)._add(si),Ri._rotateAround(Xt,Pt)._add(Pr)._add(si),tr._rotateAround(Xt,Pt)._add(Pr)._add(si),Oi._rotateAround(Xt,Pt)._add(Pr)._add(si)}if(ze){const Pt=Math.sin(ze),Xt=Math.cos(ze),ei=[Xt,-Pt,Pt,Xt];$i._matMult(ei),Ri._matMult(ei),tr._matMult(ei),Oi._matMult(ei)}const $r=new B(0,0),pr=new B(0,0);Xe.push({tl:$i,tr:Ri,bl:tr,br:Oi,tex:_e,writingMode:re.writingMode,glyphOffset:on,sectionIndex:Oe.sectionIndex,isSDF:Ge,pixelOffsetTL:$r,pixelOffsetBR:pr,minFontScaleX:0,minFontScaleY:0})}return Xe}(0,r,b,p,v,x,l,i.allowVerticalPlacement),W=i.textSizeData;let Y=null;W.kind==="source"?(Y=[kn*p.layout.get("text-size").evaluate(x,{})],Y[0]>qs&&ct(`${i.layerIds[0]}: Value for "text-size" is >= ${_h}. Reduce your "text-size".`)):W.kind==="composite"&&(Y=[kn*O.compositeTextSizes[0].evaluate(x,{},j),kn*O.compositeTextSizes[1].evaluate(x,{},j)],(Y[0]>qs||Y[1]>qs)&&ct(`${i.layerIds[0]}: Value for "text-size" is >= ${_h}. Reduce your "text-size".`)),i.addSymbols(i.text,$,Y,b,v,x,M,t,I.lineStartIndex,I.lineLength,D,j);for(const ce of E)A[ce]=i.text.placedSymbolArray.length-1;return 4*$.length}function qm(i){for(const t in i)return i[t];return null}function Rv(i,t,r,l){const p=i.compareText;if(t in p){const v=p[t];for(let x=v.length-1;x>=0;x--)if(l.dist(v[x])>4;if(p!==1)throw new Error(`Got v${p} data when expected v1.`);const v=Zm[15&l];if(!v)throw new Error("Unrecognized array type.");const[x]=new Uint16Array(t,2,1),[b]=new Uint32Array(t,4,1);return new Jd(b,x,v,t)}constructor(t,r=64,l=Float64Array,p){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=l,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const v=Zm.indexOf(this.ArrayType),x=2*t*this.ArrayType.BYTES_PER_ELEMENT,b=t*this.IndexArrayType.BYTES_PER_ELEMENT,I=(8-b%8)%8;if(v<0)throw new Error(`Unexpected typed array class: ${l}.`);p&&p instanceof ArrayBuffer?(this.data=p,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+b+I,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+x+b+I),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+b+I,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+v]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=t)}add(t,r){const l=this._pos>>1;return this.ids[l]=l,this.coords[this._pos++]=t,this.coords[this._pos++]=r,l}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Kd(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,r,l,p){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:v,coords:x,nodeSize:b}=this,I=[0,v.length-1,0],M=[];for(;I.length;){const E=I.pop()||0,A=I.pop()||0,D=I.pop()||0;if(A-D<=b){for(let W=D;W<=A;W++){const Y=x[2*W],ce=x[2*W+1];Y>=t&&Y<=l&&ce>=r&&ce<=p&&M.push(v[W])}continue}const O=D+A>>1,j=x[2*O],$=x[2*O+1];j>=t&&j<=l&&$>=r&&$<=p&&M.push(v[O]),(E===0?t<=j:r<=$)&&(I.push(D),I.push(O-1),I.push(1-E)),(E===0?l>=j:p>=$)&&(I.push(O+1),I.push(A),I.push(1-E))}return M}within(t,r,l){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:p,coords:v,nodeSize:x}=this,b=[0,p.length-1,0],I=[],M=l*l;for(;b.length;){const E=b.pop()||0,A=b.pop()||0,D=b.pop()||0;if(A-D<=x){for(let W=D;W<=A;W++)Xm(v[2*W],v[2*W+1],t,r)<=M&&I.push(p[W]);continue}const O=D+A>>1,j=v[2*O],$=v[2*O+1];Xm(j,$,t,r)<=M&&I.push(p[O]),(E===0?t-l<=j:r-l<=$)&&(b.push(D),b.push(O-1),b.push(1-E)),(E===0?t+l>=j:r+l>=$)&&(b.push(O+1),b.push(A),b.push(1-E))}return I}}function Kd(i,t,r,l,p,v){if(p-l<=r)return;const x=l+p>>1;Gm(i,t,x,l,p,v),Kd(i,t,r,l,x-1,1-v),Kd(i,t,r,x+1,p,1-v)}function Gm(i,t,r,l,p,v){for(;p>l;){if(p-l>600){const M=p-l+1,E=r-l+1,A=Math.log(M),D=.5*Math.exp(2*A/3),O=.5*Math.sqrt(A*D*(M-D)/M)*(E-M/2<0?-1:1);Gm(i,t,r,Math.max(l,Math.floor(r-E*D/M+O)),Math.min(p,Math.floor(r+(M-E)*D/M+O)),v)}const x=t[2*r+v];let b=l,I=p;for(bh(i,t,l,r),t[2*p+v]>x&&bh(i,t,l,p);bx;)I--}t[2*l+v]===x?bh(i,t,l,I):(I++,bh(i,t,I,p)),I<=r&&(l=I+1),r<=I&&(p=I-1)}}function bh(i,t,r,l){Yd(i,r,l),Yd(t,2*r,2*l),Yd(t,2*r+1,2*l+1)}function Yd(i,t,r){const l=i[t];i[t]=i[r],i[r]=l}function Xm(i,t,r,l){const p=i-r,v=t-l;return p*p+v*v}var Qd;m.bg=void 0,(Qd=m.bg||(m.bg={})).create="create",Qd.load="load",Qd.fullLoad="fullLoad";let ru=null,wh=[];const ep=1e3/60,tp="loadTime",ip="fullLoadTime",Ov={mark(i){performance.mark(i)},frame(i){const t=i;ru!=null&&wh.push(t-ru),ru=t},clearMetrics(){ru=null,wh=[],performance.clearMeasures(tp),performance.clearMeasures(ip);for(const i in m.bg)performance.clearMarks(m.bg[i])},getPerformanceMetrics(){performance.measure(tp,m.bg.create,m.bg.load),performance.measure(ip,m.bg.create,m.bg.fullLoad);const i=performance.getEntriesByName(tp)[0].duration,t=performance.getEntriesByName(ip)[0].duration,r=wh.length,l=1/(wh.reduce((v,x)=>v+x,0)/r/1e3),p=wh.filter(v=>v>ep).reduce((v,x)=>v+(x-ep)/ep,0);return{loadTime:i,fullLoadTime:t,fps:l,percentDroppedFrames:p/(r+p)*100,totalFrames:r}}};m.$=class extends z{},m.A=Ba,m.B=cd,m.C=function(i){if(Ti==null){const t=i.navigator?i.navigator.userAgent:null;Ti=!!i.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Ti},m.D=qe,m.E=ds,m.F=class{constructor(i,t){this.target=i,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Tv(()=>this.process()),this.subscription=function(r,l,p,v){return r.addEventListener(l,p,!1),{unsubscribe:()=>{r.removeEventListener(l,p,!1)}}}(this.target,"message",r=>this.receive(r)),this.globalScope=qt(self)?i:window}registerMessageHandler(i,t){this.messageHandlers[i]=t}sendAsync(i,t){return new Promise((r,l)=>{const p=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[p]={resolve:r,reject:l},t&&t.signal.addEventListener("abort",()=>{delete this.resolveRejects[p];const b={id:p,type:"",origin:location.origin,targetMapId:i.targetMapId,sourceMapId:this.mapId};this.target.postMessage(b)},{once:!0});const v=[],x=Object.assign(Object.assign({},i),{id:p,sourceMapId:this.mapId,origin:location.origin,data:ks(i.data,v)});this.target.postMessage(x,{transfer:v})})}receive(i){const t=i.data,r=t.id;if(!(t.origin!=="file://"&&location.origin!=="file://"&&t.origin!=="resource://android"&&location.origin!=="resource://android"&&t.origin!==location.origin||t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type===""){delete this.tasks[r];const l=this.abortControllers[r];return delete this.abortControllers[r],void(l&&l.abort())}if(qt(self)||t.mustQueue)return this.tasks[r]=t,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,t)}}process(){if(this.taskQueue.length===0)return;const i=this.taskQueue.shift(),t=this.tasks[i];delete this.tasks[i],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(i,t)}processTask(i,t){return h(this,void 0,void 0,function*(){if(t.type===""){const p=this.resolveRejects[i];return delete this.resolveRejects[i],p?void(t.error?p.reject(Ds(t.error)):p.resolve(Ds(t.data))):void 0}if(!this.messageHandlers[t.type])return void this.completeTask(i,new Error(`Could not find a registered handler for ${t.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const r=Ds(t.data),l=new AbortController;this.abortControllers[i]=l;try{const p=yield this.messageHandlers[t.type](t.sourceMapId,r,l);this.completeTask(i,null,p)}catch(p){this.completeTask(i,p)}})}completeTask(i,t,r){const l=[];delete this.abortControllers[i];const p={id:i,type:"",sourceMapId:this.mapId,origin:location.origin,error:t?ks(t):null,data:ks(r,l)};this.target.postMessage(p,{transfer:l})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},m.G=dn,m.H=function(){var i=new Ba(16);return Ba!=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},m.I=Rd,m.J=function(i,t,r){var l,p,v,x,b,I,M,E,A,D,O,j,$=r[0],W=r[1],Y=r[2];return t===i?(i[12]=t[0]*$+t[4]*W+t[8]*Y+t[12],i[13]=t[1]*$+t[5]*W+t[9]*Y+t[13],i[14]=t[2]*$+t[6]*W+t[10]*Y+t[14],i[15]=t[3]*$+t[7]*W+t[11]*Y+t[15]):(p=t[1],v=t[2],x=t[3],b=t[4],I=t[5],M=t[6],E=t[7],A=t[8],D=t[9],O=t[10],j=t[11],i[0]=l=t[0],i[1]=p,i[2]=v,i[3]=x,i[4]=b,i[5]=I,i[6]=M,i[7]=E,i[8]=A,i[9]=D,i[10]=O,i[11]=j,i[12]=l*$+b*W+A*Y+t[12],i[13]=p*$+I*W+D*Y+t[13],i[14]=v*$+M*W+O*Y+t[14],i[15]=x*$+E*W+j*Y+t[15]),i},m.K=function(i,t,r){var l=r[0],p=r[1],v=r[2];return i[0]=t[0]*l,i[1]=t[1]*l,i[2]=t[2]*l,i[3]=t[3]*l,i[4]=t[4]*p,i[5]=t[5]*p,i[6]=t[6]*p,i[7]=t[7]*p,i[8]=t[8]*v,i[9]=t[9]*v,i[10]=t[10]*v,i[11]=t[11]*v,i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15],i},m.L=Pf,m.M=function(i,t){const r={};for(let l=0;l{const t=window.document.createElement("video");return t.muted=!0,new Promise(r=>{t.onloadstart=()=>{r(t)};for(const l of i){const p=window.document.createElement("source");$n(l)||(t.crossOrigin="Anonymous"),p.src=l,t.appendChild(p)}})},m.a4=function(){return _t++},m.a5=Le,m.a6=Ua,m.a7=Vl,m.a8=Lo,m.a9=Tm,m.aA=function(i){if(i.type==="custom")return new Ev(i);switch(i.type){case"background":return new Sv(i);case"circle":return new d_(i);case"fill":return new T_(i);case"fill-extrusion":return new q_(i);case"heatmap":return new f_(i);case"hillshade":return new g_(i);case"line":return new Y_(i);case"raster":return new Pv(i);case"symbol":return new Yc(i)}},m.aB=Ye,m.aC=function(i,t){if(!i)return[{command:"setStyle",args:[t]}];let r=[];try{if(!Et(i.version,t.version))return[{command:"setStyle",args:[t]}];Et(i.center,t.center)||r.push({command:"setCenter",args:[t.center]}),Et(i.zoom,t.zoom)||r.push({command:"setZoom",args:[t.zoom]}),Et(i.bearing,t.bearing)||r.push({command:"setBearing",args:[t.bearing]}),Et(i.pitch,t.pitch)||r.push({command:"setPitch",args:[t.pitch]}),Et(i.sprite,t.sprite)||r.push({command:"setSprite",args:[t.sprite]}),Et(i.glyphs,t.glyphs)||r.push({command:"setGlyphs",args:[t.glyphs]}),Et(i.transition,t.transition)||r.push({command:"setTransition",args:[t.transition]}),Et(i.light,t.light)||r.push({command:"setLight",args:[t.light]}),Et(i.terrain,t.terrain)||r.push({command:"setTerrain",args:[t.terrain]}),Et(i.sky,t.sky)||r.push({command:"setSky",args:[t.sky]}),Et(i.projection,t.projection)||r.push({command:"setProjection",args:[t.projection]});const l={},p=[];(function(x,b,I,M){let E;for(E in b=b||{},x=x||{})Object.prototype.hasOwnProperty.call(x,E)&&(Object.prototype.hasOwnProperty.call(b,E)||Sn(E,I,M));for(E in b)Object.prototype.hasOwnProperty.call(b,E)&&(Object.prototype.hasOwnProperty.call(x,E)?Et(x[E],b[E])||(x[E].type==="geojson"&&b[E].type==="geojson"&&ps(x,b,E)?ri(I,{command:"setGeoJSONSourceData",args:[E,b[E].data]}):fn(E,b,I,M)):lo(E,b,I))})(i.sources,t.sources,p,l);const v=[];i.layers&&i.layers.forEach(x=>{"source"in x&&l[x.source]?r.push({command:"removeLayer",args:[x.id]}):v.push(x)}),r=r.concat(p),function(x,b,I){b=b||[];const M=(x=x||[]).map(ho),E=b.map(ho),A=x.reduce(co,{}),D=b.reduce(co,{}),O=M.slice(),j=Object.create(null);let $,W,Y,ce,re;for(let le=0,me=0;le@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,l,p,v)=>{const x=p||v;return t[l]=!x||x.toLowerCase(),""}),t["max-age"]){const r=parseInt(t["max-age"],10);isNaN(r)?delete t["max-age"]:t["max-age"]=r}return t},m.ab=function(i,t){const r=[];for(const l in i)l in t||r.push(l);return r},m.ac=nt,m.ad=function(i,t,r){var l=Math.sin(r),p=Math.cos(r),v=t[0],x=t[1],b=t[2],I=t[3],M=t[4],E=t[5],A=t[6],D=t[7];return t!==i&&(i[8]=t[8],i[9]=t[9],i[10]=t[10],i[11]=t[11],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15]),i[0]=v*p+M*l,i[1]=x*p+E*l,i[2]=b*p+A*l,i[3]=I*p+D*l,i[4]=M*p-v*l,i[5]=E*p-x*l,i[6]=A*p-b*l,i[7]=D*p-I*l,i},m.ae=function(i){var t=new Ba(16);return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],t},m.af=$c,m.ag=function(i,t){let r=0,l=0;if(i.kind==="constant")l=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:p,minZoom:v,maxZoom:x}=i,b=p?nt(Hi.interpolationFactor(p,t,v,x),0,1):0;i.kind==="camera"?l=Wi.number(i.minSize,i.maxSize,b):r=b}return{uSizeT:r,uSize:l}},m.ai=function(i,{uSize:t,uSizeT:r},{lowerSize:l,upperSize:p}){return i.kind==="source"?l/kn:i.kind==="composite"?Wi.number(l/kn,p/kn,r):t},m.aj=Ud,m.ak=function(i,t,r,l){const p=t.y-i.y,v=t.x-i.x,x=l.y-r.y,b=l.x-r.x,I=x*v-b*p;if(I===0)return null;const M=(b*(i.y-r.y)-x*(i.x-r.x))/I;return new B(i.x+M*v,i.y+M*p)},m.al=Dm,m.am=bf,m.an=wd,m.ao=function(i){let t=1/0,r=1/0,l=-1/0,p=-1/0;for(const v of i)t=Math.min(t,v.x),r=Math.min(r,v.y),l=Math.max(l,v.x),p=Math.max(p,v.y);return[t,r,l,p]},m.ap=vi,m.ar=Nd,m.as=function(i,t){var r=t[0],l=t[1],p=t[2],v=t[3],x=t[4],b=t[5],I=t[6],M=t[7],E=t[8],A=t[9],D=t[10],O=t[11],j=t[12],$=t[13],W=t[14],Y=t[15],ce=r*b-l*x,re=r*I-p*x,le=r*M-v*x,me=l*I-p*b,we=l*M-v*b,Be=p*M-v*I,et=E*$-A*j,De=E*W-D*j,ze=E*Y-O*j,Xe=A*W-D*$,je=A*Y-O*$,Oe=D*Y-O*W,_e=ce*Oe-re*je+le*Xe+me*ze-we*De+Be*et;return _e?(i[0]=(b*Oe-I*je+M*Xe)*(_e=1/_e),i[1]=(p*je-l*Oe-v*Xe)*_e,i[2]=($*Be-W*we+Y*me)*_e,i[3]=(D*we-A*Be-O*me)*_e,i[4]=(I*ze-x*Oe-M*De)*_e,i[5]=(r*Oe-p*ze+v*De)*_e,i[6]=(W*le-j*Be-Y*re)*_e,i[7]=(E*Be-D*le+O*re)*_e,i[8]=(x*je-b*ze+M*et)*_e,i[9]=(l*ze-r*je-v*et)*_e,i[10]=(j*we-$*le+Y*ce)*_e,i[11]=(A*le-E*we-O*ce)*_e,i[12]=(b*De-x*Xe-I*et)*_e,i[13]=(r*Xe-l*De+p*et)*_e,i[14]=($*re-j*me-W*ce)*_e,i[15]=(E*me-A*re+D*ce)*_e,i):null},m.at=Hd,m.au=Vd,m.av=Jd,m.aw=function(){const i={},t=fe.$version;for(const r in fe.$root){const l=fe.$root[r];if(l.required){let p=null;p=r==="version"?t:l.type==="array"?[]:{},p!=null&&(i[r]=p)}}return i},m.ax=Ql,m.ay=ci,m.az=function(i){i=i.slice();const t=Object.create(null);for(let r=0;r25||l<0||l>=1||r<0||r>=1)},m.bc=function(i,t){return i[0]=t[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=t[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=t[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},m.bd=class extends T{},m.be=Zd,m.bf=Ov,m.bh=Zt,m.bi=function(i,t){kr.REGISTERED_PROTOCOLS[i]=t},m.bj=function(i){delete kr.REGISTERED_PROTOCOLS[i]},m.bk=function(i,t){const r={};for(let p=0;pOe*vi)}let De=x?"center":r.get("text-justify").evaluate(M,{},i.canonical);const ze=r.get("symbol-placement")==="point"?r.get("text-max-width").evaluate(M,{},i.canonical)*vi:1/0,Xe=()=>{i.bucket.allowVerticalPlacement&&eh(le)&&(j.vertical=Hc($,i.glyphMap,i.glyphPositions,i.imagePositions,E,ze,v,Be,"left",we,Y,m.ah.vertical,!0,D,A))};if(!x&&et){const je=new Set;if(De==="auto")for(let _e=0;_eh(void 0,void 0,void 0,function*(){if(i.byteLength===0)return createImageBitmap(new ImageData(1,1));const t=new Blob([new Uint8Array(i)],{type:"image/png"});try{return createImageBitmap(t)}catch(r){throw new Error(`Could not load image because of ${r.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),m.e=Ke,m.f=i=>new Promise((t,r)=>{const l=new Image;l.onload=()=>{t(l),URL.revokeObjectURL(l.src),l.onload=null,window.requestAnimationFrame(()=>{l.src=nr})},l.onerror=()=>r(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 p=new Blob([new Uint8Array(i)],{type:"image/png"});l.src=i.byteLength?URL.createObjectURL(p):nr}),m.g=sr,m.h=(i,t)=>_r(Ke(i,{type:"json"}),t),m.i=qt,m.j=Cn,m.k=In,m.l=(i,t)=>_r(Ke(i,{type:"arrayBuffer"}),t),m.m=_r,m.n=function(i){return new Bd(i).readFields(pv,[])},m.o=hh,m.p=om,m.q=_,m.r=hd,m.s=$n,m.t=Kl,m.u=is,m.v=fe,m.w=ct,m.x=function([i,t,r]){return t+=90,t*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(t)*Math.sin(r),y:i*Math.sin(t)*Math.sin(r),z:i*Math.cos(r)}},m.y=Wi,m.z=Jt}),c("worker",["./shared"],function(m){class h{constructor(R){this.keyCache={},R&&this.replace(R)}replace(R){this._layerConfigs={},this._layers={},this.update(R,[])}update(R,F){for(const H of R){this._layerConfigs[H.id]=H;const ne=this._layers[H.id]=m.aA(H);ne._featureFilter=m.a7(ne.filter),this.keyCache[H.id]&&delete this.keyCache[H.id]}for(const H of F)delete this.keyCache[H],delete this._layerConfigs[H],delete this._layers[H];this.familiesBySource={};const Z=m.bk(Object.values(this._layerConfigs),this.keyCache);for(const H of Z){const ne=H.map(pe=>this._layers[pe.id]),oe=ne[0];if(oe.visibility==="none")continue;const he=oe.source||"";let te=this.familiesBySource[he];te||(te=this.familiesBySource[he]={});const ge=oe.sourceLayer||"_geojsonTileLayer";let be=te[ge];be||(be=te[ge]=[]),be.push(ne)}}}class P{constructor(R){const F={},Z=[];for(const he in R){const te=R[he],ge=F[he]={};for(const be in te){const pe=te[+be];if(!pe||pe.bitmap.width===0||pe.bitmap.height===0)continue;const Me={x:0,y:0,w:pe.bitmap.width+2,h:pe.bitmap.height+2};Z.push(Me),ge[be]={rect:Me,metrics:pe.metrics}}}const{w:H,h:ne}=m.p(Z),oe=new m.o({width:H||1,height:ne||1});for(const he in R){const te=R[he];for(const ge in te){const be=te[+ge];if(!be||be.bitmap.width===0||be.bitmap.height===0)continue;const pe=F[he][ge].rect;m.o.copy(be.bitmap,oe,{x:0,y:0},{x:pe.x+1,y:pe.y+1},be.bitmap)}}this.image=oe,this.positions=F}}m.bl("GlyphAtlas",P);class L{constructor(R){this.tileID=new m.S(R.tileID.overscaledZ,R.tileID.wrap,R.tileID.canonical.z,R.tileID.canonical.x,R.tileID.canonical.y),this.uid=R.uid,this.zoom=R.zoom,this.pixelRatio=R.pixelRatio,this.tileSize=R.tileSize,this.source=R.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=R.showCollisionBoxes,this.collectResourceTiming=!!R.collectResourceTiming,this.returnDependencies=!!R.returnDependencies,this.promoteId=R.promoteId,this.inFlightDependencies=[]}parse(R,F,Z,H){return m._(this,void 0,void 0,function*(){this.status="parsing",this.data=R,this.collisionBoxArray=new m.a5;const ne=new m.bm(Object.keys(R.layers).sort()),oe=new m.bn(this.tileID,this.promoteId);oe.bucketLayerIDs=[];const he={},te={featureIndex:oe,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:Z},ge=F.familiesBySource[this.source];for(const ft in ge){const Dt=R.layers[ft];if(!Dt)continue;Dt.version===1&&m.w(`Vector tile source "${this.source}" layer "${ft}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const ti=ne.encode(ft),bi=[];for(let Mi=0;Mi=Ni.maxzoom||Ni.visibility!=="none"&&(V(Mi,this.zoom,Z),(he[Ni.id]=Ni.createBucket({index:oe.bucketLayerIDs.length,layers:Mi,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:ti,sourceID:this.source})).populate(bi,te,this.tileID.canonical),oe.bucketLayerIDs.push(Mi.map(fs=>fs.id)))}}const be=m.aF(te.glyphDependencies,ft=>Object.keys(ft).map(Number));this.inFlightDependencies.forEach(ft=>ft==null?void 0:ft.abort()),this.inFlightDependencies=[];let pe=Promise.resolve({});if(Object.keys(be).length){const ft=new AbortController;this.inFlightDependencies.push(ft),pe=H.sendAsync({type:"GG",data:{stacks:be,source:this.source,tileID:this.tileID,type:"glyphs"}},ft)}const Me=Object.keys(te.iconDependencies);let Je=Promise.resolve({});if(Me.length){const ft=new AbortController;this.inFlightDependencies.push(ft),Je=H.sendAsync({type:"GI",data:{icons:Me,source:this.source,tileID:this.tileID,type:"icons"}},ft)}const Qe=Object.keys(te.patternDependencies);let It=Promise.resolve({});if(Qe.length){const ft=new AbortController;this.inFlightDependencies.push(ft),It=H.sendAsync({type:"GI",data:{icons:Qe,source:this.source,tileID:this.tileID,type:"patterns"}},ft)}const[ht,Ct,gt]=yield Promise.all([pe,Je,It]),mi=new P(ht),ni=new m.bo(Ct,gt);for(const ft in he){const Dt=he[ft];Dt instanceof m.a6?(V(Dt.layers,this.zoom,Z),m.bp({bucket:Dt,glyphMap:ht,glyphPositions:mi.positions,imageMap:Ct,imagePositions:ni.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Dt.hasPattern&&(Dt instanceof m.bq||Dt instanceof m.br||Dt instanceof m.bs)&&(V(Dt.layers,this.zoom,Z),Dt.addFeatures(te,this.tileID.canonical,ni.patternPositions))}return this.status="done",{buckets:Object.values(he).filter(ft=>!ft.isEmpty()),featureIndex:oe,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:mi.image,imageAtlas:ni,glyphMap:this.returnDependencies?ht:null,iconMap:this.returnDependencies?Ct:null,glyphPositions:this.returnDependencies?mi.positions:null}})}}function V(K,R,F){const Z=new m.z(R);for(const H of K)H.recalculate(Z,F)}class B{constructor(R,F,Z){this.actor=R,this.layerIndex=F,this.availableImages=Z,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(R,F){return m._(this,void 0,void 0,function*(){const Z=yield m.l(R.request,F);try{return{vectorTile:new m.bt.VectorTile(new m.bu(Z.data)),rawData:Z.data,cacheControl:Z.cacheControl,expires:Z.expires}}catch(H){const ne=new Uint8Array(Z.data);let oe=`Unable to parse the tile at ${R.request.url}, `;throw oe+=ne[0]===31&&ne[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${H.message}`,new Error(oe)}})}loadTile(R){return m._(this,void 0,void 0,function*(){const F=R.uid,Z=!!(R&&R.request&&R.request.collectResourceTiming)&&new m.bv(R.request),H=new L(R);this.loading[F]=H;const ne=new AbortController;H.abort=ne;try{const oe=yield this.loadVectorTile(R,ne);if(delete this.loading[F],!oe)return null;const he=oe.rawData,te={};oe.expires&&(te.expires=oe.expires),oe.cacheControl&&(te.cacheControl=oe.cacheControl);const ge={};if(Z){const pe=Z.finish();pe&&(ge.resourceTiming=JSON.parse(JSON.stringify(pe)))}H.vectorTile=oe.vectorTile;const be=H.parse(oe.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[F]=H,this.fetching[F]={rawTileData:he,cacheControl:te,resourceTiming:ge};try{const pe=yield be;return m.e({rawTileData:he.slice(0)},pe,te,ge)}finally{delete this.fetching[F]}}catch(oe){throw delete this.loading[F],H.status="done",this.loaded[F]=H,oe}})}reloadTile(R){return m._(this,void 0,void 0,function*(){const F=R.uid;if(!this.loaded||!this.loaded[F])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const Z=this.loaded[F];if(Z.showCollisionBoxes=R.showCollisionBoxes,Z.status==="parsing"){const H=yield Z.parse(Z.vectorTile,this.layerIndex,this.availableImages,this.actor);let ne;if(this.fetching[F]){const{rawTileData:oe,cacheControl:he,resourceTiming:te}=this.fetching[F];delete this.fetching[F],ne=m.e({rawTileData:oe.slice(0)},H,he,te)}else ne=H;return ne}if(Z.status==="done"&&Z.vectorTile)return Z.parse(Z.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(R){return m._(this,void 0,void 0,function*(){const F=this.loading,Z=R.uid;F&&F[Z]&&F[Z].abort&&(F[Z].abort.abort(),delete F[Z])})}removeTile(R){return m._(this,void 0,void 0,function*(){this.loaded&&this.loaded[R.uid]&&delete this.loaded[R.uid]})}}class U{constructor(){this.loaded={}}loadTile(R){return m._(this,void 0,void 0,function*(){const{uid:F,encoding:Z,rawImageData:H,redFactor:ne,greenFactor:oe,blueFactor:he,baseShift:te}=R,ge=H.width+2,be=H.height+2,pe=m.b(H)?new m.R({width:ge,height:be},yield m.bw(H,-1,-1,ge,be)):H,Me=new m.bx(F,pe,Z,ne,oe,he,te);return this.loaded=this.loaded||{},this.loaded[F]=Me,Me})}removeTile(R){const F=this.loaded,Z=R.uid;F&&F[Z]&&delete F[Z]}}function ue(K,R){if(K.length!==0){ye(K[0],R);for(var F=1;F=Math.abs(he)?F-te+he:he-te+F,F=te}F+Z>=0!=!!R&&K.reverse()}var Se=m.by(function K(R,F){var Z,H=R&&R.type;if(H==="FeatureCollection")for(Z=0;Z>31}function qt(K,R){for(var F=K.loadGeometry(),Z=K.type,H=0,ne=0,oe=F.length,he=0;heK},Zi=Math.fround||(yr=new Float32Array(1),K=>(yr[0]=+K,yr[0]));var yr;const Ai=3,Gi=5,zr=6;class kr{constructor(R){this.options=Object.assign(Object.create(nr),R),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(R){const{log:F,minZoom:Z,maxZoom:H}=this.options;F&&console.time("total time");const ne=`prepare ${R.length} points`;F&&console.time(ne),this.points=R;const oe=[];for(let te=0;te=Z;te--){const ge=+Date.now();he=this.trees[te]=this._createTree(this._cluster(he,te)),F&&console.log("z%d: %d clusters in %dms",te,he.numItems,+Date.now()-ge)}return F&&console.timeEnd("total time"),this}getClusters(R,F){let Z=((R[0]+180)%360+360)%360-180;const H=Math.max(-90,Math.min(90,R[1]));let ne=R[2]===180?180:((R[2]+180)%360+360)%360-180;const oe=Math.max(-90,Math.min(90,R[3]));if(R[2]-R[0]>=360)Z=-180,ne=180;else if(Z>ne){const pe=this.getClusters([Z,H,180,oe],F),Me=this.getClusters([-180,H,ne,oe],F);return pe.concat(Me)}const he=this.trees[this._limitZoom(F)],te=he.range(Zt(Z),ci(oe),Zt(ne),ci(H)),ge=he.data,be=[];for(const pe of te){const Me=this.stride*pe;be.push(ge[Me+Gi]>1?sr(ge,Me,this.clusterProps):this.points[ge[Me+Ai]])}return be}getChildren(R){const F=this._getOriginId(R),Z=this._getOriginZoom(R),H="No cluster with the specified id.",ne=this.trees[Z];if(!ne)throw new Error(H);const oe=ne.data;if(F*this.stride>=oe.length)throw new Error(H);const he=this.options.radius/(this.options.extent*Math.pow(2,Z-1)),te=ne.within(oe[F*this.stride],oe[F*this.stride+1],he),ge=[];for(const be of te){const pe=be*this.stride;oe[pe+4]===R&&ge.push(oe[pe+Gi]>1?sr(oe,pe,this.clusterProps):this.points[oe[pe+Ai]])}if(ge.length===0)throw new Error(H);return ge}getLeaves(R,F,Z){const H=[];return this._appendLeaves(H,R,F=F||10,Z=Z||0,0),H}getTile(R,F,Z){const H=this.trees[this._limitZoom(R)],ne=Math.pow(2,R),{extent:oe,radius:he}=this.options,te=he/oe,ge=(Z-te)/ne,be=(Z+1+te)/ne,pe={features:[]};return this._addTileFeatures(H.range((F-te)/ne,ge,(F+1+te)/ne,be),H.data,F,Z,ne,pe),F===0&&this._addTileFeatures(H.range(1-te/ne,ge,1,be),H.data,ne,Z,ne,pe),F===ne-1&&this._addTileFeatures(H.range(0,ge,te/ne,be),H.data,-1,Z,ne,pe),pe.features.length?pe:null}getClusterExpansionZoom(R){let F=this._getOriginZoom(R)-1;for(;F<=this.options.maxZoom;){const Z=this.getChildren(R);if(F++,Z.length!==1)break;R=Z[0].properties.cluster_id}return F}_appendLeaves(R,F,Z,H,ne){const oe=this.getChildren(F);for(const he of oe){const te=he.properties;if(te&&te.cluster?ne+te.point_count<=H?ne+=te.point_count:ne=this._appendLeaves(R,te.cluster_id,Z,H,ne):ne1;let be,pe,Me;if(ge)be=dn(F,te,this.clusterProps),pe=F[te],Me=F[te+1];else{const It=this.points[F[te+Ai]];be=It.properties;const[ht,Ct]=It.geometry.coordinates;pe=Zt(ht),Me=ci(Ct)}const Je={type:1,geometry:[[Math.round(this.options.extent*(pe*ne-Z)),Math.round(this.options.extent*(Me*ne-H))]],tags:be};let Qe;Qe=ge||this.options.generateId?F[te+Ai]:this.points[F[te+Ai]].id,Qe!==void 0&&(Je.id=Qe),oe.features.push(Je)}}_limitZoom(R){return Math.max(this.options.minZoom,Math.min(Math.floor(+R),this.options.maxZoom+1))}_cluster(R,F){const{radius:Z,extent:H,reduce:ne,minPoints:oe}=this.options,he=Z/(H*Math.pow(2,F)),te=R.data,ge=[],be=this.stride;for(let pe=0;peF&&(ht+=te[gt+Gi])}if(ht>It&&ht>=oe){let Ct,gt=Me*It,mi=Je*It,ni=-1;const ft=((pe/be|0)<<5)+(F+1)+this.points.length;for(const Dt of Qe){const ti=Dt*be;if(te[ti+2]<=F)continue;te[ti+2]=F;const bi=te[ti+Gi];gt+=te[ti]*bi,mi+=te[ti+1]*bi,te[ti+4]=ft,ne&&(Ct||(Ct=this._map(te,pe,!0),ni=this.clusterProps.length,this.clusterProps.push(Ct)),ne(Ct,this._map(te,ti)))}te[pe+4]=ft,ge.push(gt/ht,mi/ht,1/0,ft,-1,ht),ne&&ge.push(ni)}else{for(let Ct=0;Ct1)for(const Ct of Qe){const gt=Ct*be;if(!(te[gt+2]<=F)){te[gt+2]=F;for(let mi=0;mi>5}_getOriginZoom(R){return(R-this.points.length)%32}_map(R,F,Z){if(R[F+Gi]>1){const oe=this.clusterProps[R[F+zr]];return Z?Object.assign({},oe):oe}const H=this.points[R[F+Ai]].properties,ne=this.options.map(H);return Z&&ne===H?Object.assign({},ne):ne}}function sr(K,R,F){return{type:"Feature",id:K[R+Ai],properties:dn(K,R,F),geometry:{type:"Point",coordinates:[(Z=K[R],360*(Z-.5)),_r(K[R+1])]}};var Z}function dn(K,R,F){const Z=K[R+Gi],H=Z>=1e4?`${Math.round(Z/1e3)}k`:Z>=1e3?Math.round(Z/100)/10+"k":Z,ne=K[R+zr],oe=ne===-1?{}:Object.assign({},F[ne]);return Object.assign(oe,{cluster:!0,cluster_id:K[R+Ai],point_count:Z,point_count_abbreviated:H})}function Zt(K){return K/360+.5}function ci(K){const R=Math.sin(K*Math.PI/180),F=.5-.25*Math.log((1+R)/(1-R))/Math.PI;return F<0?0:F>1?1:F}function _r(K){const R=(180-360*K)*Math.PI/180;return 360*Math.atan(Math.exp(R))/Math.PI-90}function $n(K,R,F,Z){let H=Z;const ne=R+(F-R>>1);let oe,he=F-R;const te=K[R],ge=K[R+1],be=K[F],pe=K[F+1];for(let Me=R+3;MeH)oe=Me,H=Je;else if(Je===H){const Qe=Math.abs(Me-ne);QeZ&&(oe-R>3&&$n(K,R,oe,Z),K[oe+2]=H,F-oe>3&&$n(K,oe,F,Z))}function oo(K,R,F,Z,H,ne){let oe=H-F,he=ne-Z;if(oe!==0||he!==0){const te=((K-F)*oe+(R-Z)*he)/(oe*oe+he*he);te>1?(F=H,Z=ne):te>0&&(F+=oe*te,Z+=he*te)}return oe=K-F,he=R-Z,oe*oe+he*he}function pn(K,R,F,Z){const H={id:K??null,type:R,geometry:F,tags:Z,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(R==="Point"||R==="MultiPoint"||R==="LineString")In(H,F);else if(R==="Polygon")In(H,F[0]);else if(R==="MultiLineString")for(const ne of F)In(H,ne);else if(R==="MultiPolygon")for(const ne of F)In(H,ne[0]);return H}function In(K,R){for(let F=0;F0&&(oe+=Z?(H*be-ge*ne)/2:Math.sqrt(Math.pow(ge-H,2)+Math.pow(be-ne,2))),H=ge,ne=be}const he=R.length-3;R[2]=1,$n(R,0,he,F),R[he+2]=1,R.size=Math.abs(oe),R.start=0,R.end=R.size}function qn(K,R,F,Z){for(let H=0;H1?1:F}function ri(K,R,F,Z,H,ne,oe,he){if(Z/=R,ne>=(F/=R)&&oe=Z)return null;const te=[];for(const ge of K){const be=ge.geometry;let pe=ge.type;const Me=H===0?ge.minX:ge.minY,Je=H===0?ge.maxX:ge.maxY;if(Me>=F&&Je=Z)continue;let Qe=[];if(pe==="Point"||pe==="MultiPoint")lo(be,Qe,F,Z,H);else if(pe==="LineString")Sn(be,Qe,F,Z,H,!1,he.lineMetrics);else if(pe==="MultiLineString")ps(be,Qe,F,Z,H,!1);else if(pe==="Polygon")ps(be,Qe,F,Z,H,!0);else if(pe==="MultiPolygon")for(const It of be){const ht=[];ps(It,ht,F,Z,H,!0),ht.length&&Qe.push(ht)}if(Qe.length){if(he.lineMetrics&&pe==="LineString"){for(const It of Qe)te.push(pn(ge.id,pe,It,ge.tags));continue}pe!=="LineString"&&pe!=="MultiLineString"||(Qe.length===1?(pe="LineString",Qe=Qe[0]):pe="MultiLineString"),pe!=="Point"&&pe!=="MultiPoint"||(pe=Qe.length===3?"Point":"MultiPoint"),te.push(pn(ge.id,pe,Qe,ge.tags))}}return te.length?te:null}function lo(K,R,F,Z,H){for(let ne=0;ne=F&&oe<=Z&&vr(R,K[ne],K[ne+1],K[ne+2])}}function Sn(K,R,F,Z,H,ne,oe){let he=fn(K);const te=H===0?ho:co;let ge,be,pe=K.start;for(let ht=0;htF&&(be=te(he,Ct,gt,ni,ft,F),oe&&(he.start=pe+ge*be)):Dt>Z?ti=F&&(be=te(he,Ct,gt,ni,ft,F),bi=!0),ti>Z&&Dt<=Z&&(be=te(he,Ct,gt,ni,ft,Z),bi=!0),!ne&&bi&&(oe&&(he.end=pe+ge*be),R.push(he),he=fn(K)),oe&&(pe+=ge)}let Me=K.length-3;const Je=K[Me],Qe=K[Me+1],It=H===0?Je:Qe;It>=F&&It<=Z&&vr(he,Je,Qe,K[Me+2]),Me=he.length-3,ne&&Me>=3&&(he[Me]!==he[0]||he[Me+1]!==he[1])&&vr(he,he[0],he[1],he[2]),he.length&&R.push(he)}function fn(K){const R=[];return R.size=K.size,R.start=K.start,R.end=K.end,R}function ps(K,R,F,Z,H,ne){for(const oe of K)Sn(oe,R,F,Z,H,ne,!1)}function vr(K,R,F,Z){K.push(R,F,Z)}function ho(K,R,F,Z,H,ne){const oe=(ne-R)/(Z-R);return vr(K,ne,F+(H-F)*oe,1),oe}function co(K,R,F,Z,H,ne){const oe=(ne-F)/(H-F);return vr(K,R+(Z-R)*oe,ne,1),oe}function Ce(K,R){const F=[];for(let Z=0;Z0&&R.size<(H?oe:Z))return void(F.numPoints+=R.length/3);const he=[];for(let te=0;teoe)&&(F.numSimplified++,he.push(R[te],R[te+1])),F.numPoints++;H&&function(te,ge){let be=0;for(let pe=0,Me=te.length,Je=Me-2;pe0===ge)for(let pe=0,Me=te.length;pe24)throw new Error("maxZoom should be in the 0-24 range");if(F.promoteId&&F.generateId)throw new Error("promoteId and generateId cannot be used together.");let H=function(ne,oe){const he=[];if(ne.type==="FeatureCollection")for(let te=0;te1&&console.time("creation"),Je=this.tiles[Me]=Mn(R,F,Z,H,ge),this.tileCoords.push({z:F,x:Z,y:H}),be)){be>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",F,Z,H,Je.numFeatures,Je.numPoints,Je.numSimplified),console.timeEnd("creation"));const bi=`z${F}`;this.stats[bi]=(this.stats[bi]||0)+1,this.total++}if(Je.source=R,ne==null){if(F===ge.indexMaxZoom||Je.numPoints<=ge.indexMaxPoints)continue}else{if(F===ge.maxZoom||F===ne)continue;if(ne!=null){const bi=ne-F;if(Z!==oe>>bi||H!==he>>bi)continue}}if(Je.source=null,R.length===0)continue;be>1&&console.time("clipping");const Qe=.5*ge.buffer/ge.extent,It=.5-Qe,ht=.5+Qe,Ct=1+Qe;let gt=null,mi=null,ni=null,ft=null,Dt=ri(R,pe,Z-Qe,Z+ht,0,Je.minX,Je.maxX,ge),ti=ri(R,pe,Z+It,Z+Ct,0,Je.minX,Je.maxX,ge);R=null,Dt&&(gt=ri(Dt,pe,H-Qe,H+ht,1,Je.minY,Je.maxY,ge),mi=ri(Dt,pe,H+It,H+Ct,1,Je.minY,Je.maxY,ge),Dt=null),ti&&(ni=ri(ti,pe,H-Qe,H+ht,1,Je.minY,Je.maxY,ge),ft=ri(ti,pe,H+It,H+Ct,1,Je.minY,Je.maxY,ge),ti=null),be>1&&console.timeEnd("clipping"),te.push(gt||[],F+1,2*Z,2*H),te.push(mi||[],F+1,2*Z,2*H+1),te.push(ni||[],F+1,2*Z+1,2*H),te.push(ft||[],F+1,2*Z+1,2*H+1)}}getTile(R,F,Z){R=+R,F=+F,Z=+Z;const H=this.options,{extent:ne,debug:oe}=H;if(R<0||R>24)return null;const he=1<1&&console.log("drilling down to z%d-%d-%d",R,F,Z);let ge,be=R,pe=F,Me=Z;for(;!ge&&be>0;)be--,pe>>=1,Me>>=1,ge=this.tiles[Dr(be,pe,Me)];return ge&&ge.source?(oe>1&&(console.log("found parent tile z%d-%d-%d",be,pe,Me),console.time("drilling down")),this.splitTile(ge.source,be,pe,Me,R,F,Z),oe>1&&console.timeEnd("drilling down"),this.tiles[te]?Vi(this.tiles[te],ne):null):null}}function Dr(K,R,F){return 32*((1<{pe.properties=Je;const Qe={};for(const It of Me)Qe[It]=te[It].evaluate(be,pe);return Qe},oe.reduce=(Je,Qe)=>{pe.properties=Qe;for(const It of Me)be.accumulated=Je[It],Je[It]=ge[It].evaluate(be,pe)},oe}(R)).load((yield this._pendingData).features):(H=yield this._pendingData,new Xi(H,R.geojsonVtOptions)),this.loaded={};const ne={};if(Z){const oe=Z.finish();oe&&(ne.resourceTiming={},ne.resourceTiming[R.source]=JSON.parse(JSON.stringify(oe)))}return ne}catch(ne){if(delete this._pendingRequest,m.bB(ne))return{abandoned:!0};throw ne}var H})}getData(){return m._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(R){const F=this.loaded;return F&&F[R.uid]?super.reloadTile(R):this.loadTile(R)}loadAndProcessGeoJSON(R,F){return m._(this,void 0,void 0,function*(){let Z=yield this.loadGeoJSON(R,F);if(delete this._pendingRequest,typeof Z!="object")throw new Error(`Input data given to '${R.source}' is not a valid GeoJSON object.`);if(Se(Z,!0),R.filter){const H=m.bC(R.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(H.result==="error")throw new Error(H.value.map(oe=>`${oe.key}: ${oe.message}`).join(", "));Z={type:"FeatureCollection",features:Z.features.filter(oe=>H.value.evaluate({zoom:0},oe))}}return Z})}loadGeoJSON(R,F){return m._(this,void 0,void 0,function*(){const{promoteId:Z}=R;if(R.request){const H=yield m.h(R.request,F);return this._dataUpdateable=Qr(H.data,Z)?mn(H.data,Z):void 0,H.data}if(typeof R.data=="string")try{const H=JSON.parse(R.data);return this._dataUpdateable=Qr(H,Z)?mn(H,Z):void 0,H}catch{throw new Error(`Input data given to '${R.source}' is not a valid GeoJSON object.`)}if(!R.dataDiff)throw new Error(`Input data given to '${R.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${R.source}`);return function(H,ne,oe){var he,te,ge,be;if(ne.removeAll&&H.clear(),ne.remove)for(const pe of ne.remove)H.delete(pe);if(ne.add)for(const pe of ne.add){const Me=lt(pe,oe);Me!=null&&H.set(Me,pe)}if(ne.update)for(const pe of ne.update){let Me=H.get(pe.id);if(Me==null)continue;const Je=!pe.removeAllProperties&&(((he=pe.removeProperties)===null||he===void 0?void 0:he.length)>0||((te=pe.addOrUpdateProperties)===null||te===void 0?void 0:te.length)>0);if((pe.newGeometry||pe.removeAllProperties||Je)&&(Me=Object.assign({},Me),H.set(pe.id,Me),Je&&(Me.properties=Object.assign({},Me.properties))),pe.newGeometry&&(Me.geometry=pe.newGeometry),pe.removeAllProperties)Me.properties={};else if(((ge=pe.removeProperties)===null||ge===void 0?void 0:ge.length)>0)for(const Qe of pe.removeProperties)Object.prototype.hasOwnProperty.call(Me.properties,Qe)&&delete Me.properties[Qe];if(((be=pe.addOrUpdateProperties)===null||be===void 0?void 0:be.length)>0)for(const{key:Qe,value:It}of pe.addOrUpdateProperties)Me.properties[Qe]=It}}(this._dataUpdateable,R.dataDiff,Z),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(R){return m._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(R){return this._geoJSONIndex.getClusterExpansionZoom(R.clusterId)}getClusterChildren(R){return this._geoJSONIndex.getChildren(R.clusterId)}getClusterLeaves(R){return this._geoJSONIndex.getLeaves(R.clusterId,R.limit,R.offset)}}class en{constructor(R){this.self=R,this.actor=new m.F(R),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(F,Z)=>{if(this.externalWorkerSourceTypes[F])throw new Error(`Worker source with name "${F}" already registered.`);this.externalWorkerSourceTypes[F]=Z},this.self.addProtocol=m.bi,this.self.removeProtocol=m.bj,this.self.registerRTLTextPlugin=F=>{if(m.bD.isParsed())throw new Error("RTL text plugin already registered.");m.bD.setMethods(F)},this.actor.registerMessageHandler("LDT",(F,Z)=>this._getDEMWorkerSource(F,Z.source).loadTile(Z)),this.actor.registerMessageHandler("RDT",(F,Z)=>m._(this,void 0,void 0,function*(){this._getDEMWorkerSource(F,Z.source).removeTile(Z)})),this.actor.registerMessageHandler("GCEZ",(F,Z)=>m._(this,void 0,void 0,function*(){return this._getWorkerSource(F,Z.type,Z.source).getClusterExpansionZoom(Z)})),this.actor.registerMessageHandler("GCC",(F,Z)=>m._(this,void 0,void 0,function*(){return this._getWorkerSource(F,Z.type,Z.source).getClusterChildren(Z)})),this.actor.registerMessageHandler("GCL",(F,Z)=>m._(this,void 0,void 0,function*(){return this._getWorkerSource(F,Z.type,Z.source).getClusterLeaves(Z)})),this.actor.registerMessageHandler("LD",(F,Z)=>this._getWorkerSource(F,Z.type,Z.source).loadData(Z)),this.actor.registerMessageHandler("GD",(F,Z)=>this._getWorkerSource(F,Z.type,Z.source).getData()),this.actor.registerMessageHandler("LT",(F,Z)=>this._getWorkerSource(F,Z.type,Z.source).loadTile(Z)),this.actor.registerMessageHandler("RT",(F,Z)=>this._getWorkerSource(F,Z.type,Z.source).reloadTile(Z)),this.actor.registerMessageHandler("AT",(F,Z)=>this._getWorkerSource(F,Z.type,Z.source).abortTile(Z)),this.actor.registerMessageHandler("RMT",(F,Z)=>this._getWorkerSource(F,Z.type,Z.source).removeTile(Z)),this.actor.registerMessageHandler("RS",(F,Z)=>m._(this,void 0,void 0,function*(){if(!this.workerSources[F]||!this.workerSources[F][Z.type]||!this.workerSources[F][Z.type][Z.source])return;const H=this.workerSources[F][Z.type][Z.source];delete this.workerSources[F][Z.type][Z.source],H.removeSource!==void 0&&H.removeSource(Z)})),this.actor.registerMessageHandler("RM",F=>m._(this,void 0,void 0,function*(){delete this.layerIndexes[F],delete this.availableImages[F],delete this.workerSources[F],delete this.demWorkerSources[F]})),this.actor.registerMessageHandler("SR",(F,Z)=>m._(this,void 0,void 0,function*(){this.referrer=Z})),this.actor.registerMessageHandler("SRPS",(F,Z)=>this._syncRTLPluginState(F,Z)),this.actor.registerMessageHandler("IS",(F,Z)=>m._(this,void 0,void 0,function*(){this.self.importScripts(Z)})),this.actor.registerMessageHandler("SI",(F,Z)=>this._setImages(F,Z)),this.actor.registerMessageHandler("UL",(F,Z)=>m._(this,void 0,void 0,function*(){this._getLayerIndex(F).update(Z.layers,Z.removedIds)})),this.actor.registerMessageHandler("SL",(F,Z)=>m._(this,void 0,void 0,function*(){this._getLayerIndex(F).replace(Z)}))}_setImages(R,F){return m._(this,void 0,void 0,function*(){this.availableImages[R]=F;for(const Z in this.workerSources[R]){const H=this.workerSources[R][Z];for(const ne in H)H[ne].availableImages=F}})}_syncRTLPluginState(R,F){return m._(this,void 0,void 0,function*(){if(m.bD.isParsed())return m.bD.getState();if(F.pluginStatus!=="loading")return m.bD.setState(F),F;const Z=F.pluginURL;if(this.self.importScripts(Z),m.bD.isParsed()){const H={pluginStatus:"loaded",pluginURL:Z};return m.bD.setState(H),H}throw m.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${Z}`)})}_getAvailableImages(R){let F=this.availableImages[R];return F||(F=[]),F}_getLayerIndex(R){let F=this.layerIndexes[R];return F||(F=this.layerIndexes[R]=new h),F}_getWorkerSource(R,F,Z){if(this.workerSources[R]||(this.workerSources[R]={}),this.workerSources[R][F]||(this.workerSources[R][F]={}),!this.workerSources[R][F][Z]){const H={sendAsync:(ne,oe)=>(ne.targetMapId=R,this.actor.sendAsync(ne,oe))};switch(F){case"vector":this.workerSources[R][F][Z]=new B(H,this._getLayerIndex(R),this._getAvailableImages(R));break;case"geojson":this.workerSources[R][F][Z]=new Pn(H,this._getLayerIndex(R),this._getAvailableImages(R));break;default:this.workerSources[R][F][Z]=new this.externalWorkerSourceTypes[F](H,this._getLayerIndex(R),this._getAvailableImages(R))}}return this.workerSources[R][F][Z]}_getDEMWorkerSource(R,F){return this.demWorkerSources[R]||(this.demWorkerSources[R]={}),this.demWorkerSources[R][F]||(this.demWorkerSources[R][F]=new U),this.demWorkerSources[R][F]}}return m.i(self)&&(self.worker=new en(self)),en}),c("index",["exports","./shared"],function(m,h){var P="4.7.0";let L,V;const B={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:_=>new Promise((e,o)=>{const u=requestAnimationFrame(e);_.signal.addEventListener("abort",()=>{cancelAnimationFrame(u),o(h.c())})}),getImageData(_,e=0){return this.getImageCanvasContext(_).getImageData(-e,-e,_.width+2*e,_.height+2*e)},getImageCanvasContext(_){const e=window.document.createElement("canvas"),o=e.getContext("2d",{willReadFrequently:!0});if(!o)throw new Error("failed to create canvas 2d context");return e.width=_.width,e.height=_.height,o.drawImage(_,0,0,_.width,_.height),o},resolveURL:_=>(L||(L=document.createElement("a")),L.href=_,L.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(V==null&&(V=matchMedia("(prefers-reduced-motion: reduce)")),V.matches)}};class U{static testProp(e){if(!U.docStyle)return e[0];for(let o=0;o{window.removeEventListener("click",U.suppressClickInternal,!0)},0)}static getScale(e){const o=e.getBoundingClientRect();return{x:o.width/e.offsetWidth||1,y:o.height/e.offsetHeight||1,boundingClientRect:o}}static getPoint(e,o,u){const d=o.boundingClientRect;return new h.P((u.clientX-d.left)/o.x-e.clientLeft,(u.clientY-d.top)/o.y-e.clientTop)}static mousePos(e,o){const u=U.getScale(e);return U.getPoint(e,u,o)}static touchPos(e,o){const u=[],d=U.getScale(e);for(let y=0;y{ye&&it(ye),ye=null,Re=!0},Se.onerror=()=>{Ne=!0,ye=null},Se.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(_){let e,o,u,d;_.resetRequestQueue=()=>{e=[],o=0,u=0,d={}},_.addThrottleControl=S=>{const T=u++;return d[T]=S,T},_.removeThrottleControl=S=>{delete d[S],w()},_.getImage=(S,T,z=!0)=>new Promise((k,N)=>{ue.supported&&(S.headers||(S.headers={}),S.headers.accept="image/webp,*/*"),h.e(S,{type:"image"}),e.push({abortController:T,requestParameters:S,supportImageRefresh:z,state:"queued",onError:q=>{N(q)},onSuccess:q=>{k(q)}}),w()});const y=S=>h._(this,void 0,void 0,function*(){S.state="running";const{requestParameters:T,supportImageRefresh:z,onError:k,onSuccess:N,abortController:q}=S,G=z===!1&&!h.i(self)&&!h.g(T.url)&&(!T.headers||Object.keys(T.headers).reduce((ee,ie)=>ee&&ie==="accept",!0));o++;const J=G?C(T,q):h.m(T,q);try{const ee=yield J;delete S.abortController,S.state="completed",ee.data instanceof HTMLImageElement||h.b(ee.data)?N(ee):ee.data&&N({data:yield(Q=ee.data,typeof createImageBitmap=="function"?h.d(Q):h.f(Q)),cacheControl:ee.cacheControl,expires:ee.expires})}catch(ee){delete S.abortController,k(ee)}finally{o--,w()}var Q}),w=()=>{const S=(()=>{for(const T of Object.keys(d))if(d[T]())return!0;return!1})()?h.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:h.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let T=o;T0;T++){const z=e.shift();z.abortController.signal.aborted?T--:y(z)}},C=(S,T)=>new Promise((z,k)=>{const N=new Image,q=S.url,G=S.credentials;G&&G==="include"?N.crossOrigin="use-credentials":(G&&G==="same-origin"||!h.s(q))&&(N.crossOrigin="anonymous"),T.signal.addEventListener("abort",()=>{N.src="",k(h.c())}),N.fetchPriority="high",N.onload=()=>{N.onerror=N.onload=null,z({data:N})},N.onerror=()=>{N.onerror=N.onload=null,T.signal.aborted||k(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."))},N.src=q})}(Ue||(Ue={})),Ue.resetRequestQueue();class ut{constructor(e){this._transformRequestFn=e}transformRequest(e,o){return this._transformRequestFn&&this._transformRequestFn(e,o)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function nt(_){var e=new h.A(3);return e[0]=_[0],e[1]=_[1],e[2]=_[2],e}var bt,Ke=function(_,e,o){return _[0]=e[0]-o[0],_[1]=e[1]-o[1],_[2]=e[2]-o[2],_};bt=new h.A(3),h.A!=Float32Array&&(bt[0]=0,bt[1]=0,bt[2]=0);var _t=function(_){var e=_[0],o=_[1];return e*e+o*o};function kt(_){const e=[];if(typeof _=="string")e.push({id:"default",url:_});else if(_&&_.length>0){const o=[];for(const{id:u,url:d}of _){const y=`${u}${d}`;o.indexOf(y)===-1&&(o.push(y),e.push({id:u,url:d}))}}return e}function Rt(_,e,o){const u=_.split("?");return u[0]+=`${e}${o}`,u.join("?")}(function(){var _=new h.A(2);h.A!=Float32Array&&(_[0]=0,_[1]=0)})();class Ye{constructor(e,o,u,d){this.context=e,this.format=u,this.texture=e.gl.createTexture(),this.update(o,d)}update(e,o,u){const{width:d,height:y}=e,w=!(this.size&&this.size[0]===d&&this.size[1]===y||u),{context:C}=this,{gl:S}=C;if(this.useMipmap=!!(o&&o.useMipmap),S.bindTexture(S.TEXTURE_2D,this.texture),C.pixelStoreUnpackFlipY.set(!1),C.pixelStoreUnpack.set(1),C.pixelStoreUnpackPremultiplyAlpha.set(this.format===S.RGBA&&(!o||o.premultiply!==!1)),w)this.size=[d,y],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||h.b(e)?S.texImage2D(S.TEXTURE_2D,0,this.format,this.format,S.UNSIGNED_BYTE,e):S.texImage2D(S.TEXTURE_2D,0,this.format,d,y,0,this.format,S.UNSIGNED_BYTE,e.data);else{const{x:T,y:z}=u||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||h.b(e)?S.texSubImage2D(S.TEXTURE_2D,0,T,z,S.RGBA,S.UNSIGNED_BYTE,e):S.texSubImage2D(S.TEXTURE_2D,0,T,z,d,y,S.RGBA,S.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&S.generateMipmap(S.TEXTURE_2D)}bind(e,o,u){const{context:d}=this,{gl:y}=d;y.bindTexture(y.TEXTURE_2D,this.texture),u!==y.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(u=y.LINEAR),e!==this.filter&&(y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MAG_FILTER,e),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MIN_FILTER,u||e),this.filter=e),o!==this.wrap&&(y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_S,o),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_T,o),this.wrap=o)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function St(_){const{userImage:e}=_;return!!(e&&e.render&&e.render())&&(_.data.replace(new Uint8Array(e.data.buffer)),!0)}class ct extends h.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new h.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(const{ids:o,promiseResolve:u}of this.requestors)u(this._getImagesForIds(o));this.requestors=[]}}getImage(e){const o=this.images[e];if(o&&!o.data&&o.spriteData){const u=o.spriteData;o.data=new h.R({width:u.width,height:u.height},u.context.getImageData(u.x,u.y,u.width,u.height).data),o.spriteData=null}return o}addImage(e,o){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,o)&&(this.images[e]=o)}_validate(e,o){let u=!0;const d=o.data||o.spriteData;return this._validateStretch(o.stretchX,d&&d.width)||(this.fire(new h.j(new Error(`Image "${e}" has invalid "stretchX" value`))),u=!1),this._validateStretch(o.stretchY,d&&d.height)||(this.fire(new h.j(new Error(`Image "${e}" has invalid "stretchY" value`))),u=!1),this._validateContent(o.content,o)||(this.fire(new h.j(new Error(`Image "${e}" has invalid "content" value`))),u=!1),u}_validateStretch(e,o){if(!e)return!0;let u=0;for(const d of e){if(d[0]{let d=!0;if(!this.isLoaded())for(const y of e)this.images[y]||(d=!1);this.isLoaded()||d?o(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:o})})}_getImagesForIds(e){const o={};for(const u of e){let d=this.getImage(u);d||(this.fire(new h.k("styleimagemissing",{id:u})),d=this.getImage(u)),d?o[u]={data:d.data.clone(),pixelRatio:d.pixelRatio,sdf:d.sdf,version:d.version,stretchX:d.stretchX,stretchY:d.stretchY,content:d.content,textFitWidth:d.textFitWidth,textFitHeight:d.textFitHeight,hasRenderCallback:!!(d.userImage&&d.userImage.render)}:h.w(`Image "${u}" 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 o}getPixelSize(){const{width:e,height:o}=this.atlasImage;return{width:e,height:o}}getPattern(e){const o=this.patterns[e],u=this.getImage(e);if(!u)return null;if(o&&o.position.version===u.version)return o.position;if(o)o.position.version=u.version;else{const d={w:u.data.width+2,h:u.data.height+2,x:0,y:0},y=new h.I(d,u);this.patterns[e]={bin:d,position:y}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){const o=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Ye(e,this.atlasImage,o.RGBA),this.atlasTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const y in this.patterns)e.push(this.patterns[y].bin);const{w:o,h:u}=h.p(e),d=this.atlasImage;d.resize({width:o||1,height:u||1});for(const y in this.patterns){const{bin:w}=this.patterns[y],C=w.x+1,S=w.y+1,T=this.getImage(y).data,z=T.width,k=T.height;h.R.copy(T,d,{x:0,y:0},{x:C,y:S},{width:z,height:k}),h.R.copy(T,d,{x:0,y:k-1},{x:C,y:S-1},{width:z,height:1}),h.R.copy(T,d,{x:0,y:0},{x:C,y:S+k},{width:z,height:1}),h.R.copy(T,d,{x:z-1,y:0},{x:C-1,y:S},{width:1,height:k}),h.R.copy(T,d,{x:0,y:0},{x:C+z,y:S},{width:1,height:k})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(const o of e){if(this.callbackDispatchedThisFrame[o])continue;this.callbackDispatchedThisFrame[o]=!0;const u=this.getImage(o);u||h.w(`Image with ID: "${o}" was not found`),St(u)&&this.updateImage(o,u)}}}const wt=1e20;function qt(_,e,o,u,d,y,w,C,S){for(let T=e;T-1);S++,y[S]=C,w[S]=T,w[S+1]=wt}for(let C=0,S=0;C65535)throw new Error("glyphs > 65535 not supported");if(u.ranges[y])return{stack:e,id:o,glyph:d};if(!this.url)throw new Error("glyphsUrl is not set");if(!u.requests[y]){const C=fi.loadGlyphRange(e,y,this.url,this.requestManager);u.requests[y]=C}const w=yield u.requests[y];for(const C in w)this._doesCharSupportLocalGlyph(+C)||(u.glyphs[+C]=w[+C]);return u.ranges[y]=!0,{stack:e,id:o,glyph:w[o]||null}})}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(e))}_tinySDF(e,o,u){const d=this.localIdeographFontFamily;if(!d||!this._doesCharSupportLocalGlyph(u))return;let y=e.tinySDF;if(!y){let C="400";/bold/i.test(o)?C="900":/medium/i.test(o)?C="500":/light/i.test(o)&&(C="200"),y=e.tinySDF=new fi.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:d,fontWeight:C})}const w=y.draw(String.fromCharCode(u));return{id:u,bitmap:new h.o({width:w.width||60,height:w.height||60},w.data),metrics:{width:w.glyphWidth/2||24,height:w.glyphHeight/2||24,left:w.glyphLeft/2+.5||0,top:w.glyphTop/2-27.5||-8,advance:w.glyphAdvance/2||24,isDoubleResolution:!0}}}}fi.loadGlyphRange=function(_,e,o,u){return h._(this,void 0,void 0,function*(){const d=256*e,y=d+255,w=u.transformRequest(o.replace("{fontstack}",_).replace("{range}",`${d}-${y}`),"Glyphs"),C=yield h.l(w,new AbortController);if(!C||!C.data)throw new Error(`Could not load glyph range. range: ${e}, ${d}-${y}`);const S={};for(const T of h.n(C.data))S[T.id]=T;return S})},fi.TinySDF=class{constructor({fontSize:_=24,buffer:e=3,radius:o=8,cutoff:u=.25,fontFamily:d="sans-serif",fontWeight:y="normal",fontStyle:w="normal"}={}){this.buffer=e,this.cutoff=u,this.radius=o;const C=this.size=_+4*e,S=this._createCanvas(C),T=this.ctx=S.getContext("2d",{willReadFrequently:!0});T.font=`${w} ${y} ${_}px ${d}`,T.textBaseline="alphabetic",T.textAlign="left",T.fillStyle="black",this.gridOuter=new Float64Array(C*C),this.gridInner=new Float64Array(C*C),this.f=new Float64Array(C),this.z=new Float64Array(C+1),this.v=new Uint16Array(C)}_createCanvas(_){const e=document.createElement("canvas");return e.width=e.height=_,e}draw(_){const{width:e,actualBoundingBoxAscent:o,actualBoundingBoxDescent:u,actualBoundingBoxLeft:d,actualBoundingBoxRight:y}=this.ctx.measureText(_),w=Math.ceil(o),C=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(y-d))),S=Math.min(this.size-this.buffer,w+Math.ceil(u)),T=C+2*this.buffer,z=S+2*this.buffer,k=Math.max(T*z,0),N=new Uint8ClampedArray(k),q={data:N,width:T,height:z,glyphWidth:C,glyphHeight:S,glyphTop:w,glyphLeft:0,glyphAdvance:e};if(C===0||S===0)return q;const{ctx:G,buffer:J,gridInner:Q,gridOuter:ee}=this;G.clearRect(J,J,C,S),G.fillText(_,J,J+w);const ie=G.getImageData(J,J,C,S);ee.fill(wt,0,k),Q.fill(0,0,k);for(let X=0;X0?xe*xe:0,Q[de]=xe<0?xe*xe:0}}qt(ee,0,0,T,z,T,this.f,this.v,this.z),qt(Q,J,J,C,S,T,this.f,this.v,this.z);for(let X=0;X1&&(S=e[++C]);const z=Math.abs(T-S.left),k=Math.abs(T-S.right),N=Math.min(z,k);let q;const G=y/u*(d+1);if(S.isDash){const J=d-Math.abs(G);q=Math.sqrt(N*N+J*J)}else q=d-Math.sqrt(N*N+G*G);this.data[w+T]=Math.max(0,Math.min(255,q+128))}}}addRegularDash(e){for(let C=e.length-1;C>=0;--C){const S=e[C],T=e[C+1];S.zeroLength?e.splice(C,1):T&&T.isDash===S.isDash&&(T.left=S.left,e.splice(C,1))}const o=e[0],u=e[e.length-1];o.isDash===u.isDash&&(o.left=u.left-this.width,u.right=o.right+this.width);const d=this.width*this.nextRow;let y=0,w=e[y];for(let C=0;C1&&(w=e[++y]);const S=Math.abs(C-w.left),T=Math.abs(C-w.right),z=Math.min(S,T);this.data[d+C]=Math.max(0,Math.min(255,(w.isDash?z:-z)+128))}}addDash(e,o){const u=o?7:0,d=2*u+1;if(this.nextRow+d>this.height)return h.w("LineAtlas out of space"),null;let y=0;for(let C=0;C{o.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[kr]}numActive(){return Object.keys(this.active).length}}const dn=Math.floor(B.hardwareConcurrency/2);let Zt,ci;function _r(){return Zt||(Zt=new sr),Zt}sr.workerCount=h.C(globalThis)?Math.max(Math.min(dn,3),1):1;class $n{constructor(e,o){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=o;const u=this.workerPool.acquire(o);for(let d=0;d{o.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,o){for(const u of this.actors)u.registerMessageHandler(e,o)}}function oo(){return ci||(ci=new $n(_r(),h.G),ci.registerMessageHandler("GR",(_,e,o)=>h.m(e,o))),ci}function pn(_,e){const o=h.H();return h.J(o,o,[1,1,0]),h.K(o,o,[.5*_.width,.5*_.height,1]),h.L(o,o,_.calculatePosMatrix(e.toUnwrapped()))}function In(_,e,o,u,d,y){const w=function(k,N,q){if(k)for(const G of k){const J=N[G];if(J&&J.source===q&&J.type==="fill-extrusion")return!0}else for(const G in N){const J=N[G];if(J.source===q&&J.type==="fill-extrusion")return!0}return!1}(d&&d.layers,e,_.id),C=y.maxPitchScaleFactor(),S=_.tilesIn(u,C,w);S.sort(Cn);const T=[];for(const k of S)T.push({wrappedTileID:k.tileID.wrapped().key,queryResults:k.tile.queryRenderedFeatures(e,o,_._state,k.queryGeometry,k.cameraQueryGeometry,k.scale,d,y,C,pn(_.transform,k.tileID))});const z=function(k){const N={},q={};for(const G of k){const J=G.queryResults,Q=G.wrappedTileID,ee=q[Q]=q[Q]||{};for(const ie in J){const X=J[ie],se=ee[ie]=ee[ie]||{},ae=N[ie]=N[ie]||[];for(const de of X)se[de.featureIndex]||(se[de.featureIndex]=!0,ae.push(de))}}return N}(T);for(const k in z)z[k].forEach(N=>{const q=N.feature,G=_.getFeatureState(q.layer["source-layer"],q.id);q.source=q.layer.source,q.layer["source-layer"]&&(q.sourceLayer=q.layer["source-layer"]),q.state=G});return z}function Cn(_,e){const o=_.tileID,u=e.tileID;return o.overscaledZ-u.overscaledZ||o.canonical.y-u.canonical.y||o.wrap-u.wrap||o.canonical.x-u.canonical.x}function ds(_,e,o){return h._(this,void 0,void 0,function*(){let u=_;if(_.url?u=(yield h.h(e.transformRequest(_.url,"Source"),o)).data:yield B.frameAsync(o),!u)return null;const d=h.M(h.e(u,_),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in u&&u.vector_layers&&(d.vectorLayerIds=u.vector_layers.map(y=>y.id)),d})}class fe{constructor(e,o){e&&(o?this.setSouthWest(e).setNorthEast(o):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof h.N?new h.N(e.lng,e.lat):h.N.convert(e),this}setSouthWest(e){return this._sw=e instanceof h.N?new h.N(e.lng,e.lat):h.N.convert(e),this}extend(e){const o=this._sw,u=this._ne;let d,y;if(e instanceof h.N)d=e,y=e;else{if(!(e instanceof fe))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(fe.convert(e)):this.extend(h.N.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(h.N.convert(e)):this;if(d=e._sw,y=e._ne,!d||!y)return this}return o||u?(o.lng=Math.min(d.lng,o.lng),o.lat=Math.min(d.lat,o.lat),u.lng=Math.max(y.lng,u.lng),u.lat=Math.max(y.lat,u.lat)):(this._sw=new h.N(d.lng,d.lat),this._ne=new h.N(y.lng,y.lat)),this}getCenter(){return new h.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 h.N(this.getWest(),this.getNorth())}getSouthEast(){return new h.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(e){const{lng:o,lat:u}=h.N.convert(e);let d=this._sw.lng<=o&&o<=this._ne.lng;return this._sw.lng>this._ne.lng&&(d=this._sw.lng>=o&&o>=this._ne.lng),this._sw.lat<=u&&u<=this._ne.lat&&d}static convert(e){return e instanceof fe?e:e&&new fe(e)}static fromLngLat(e,o=0){const u=360*o/40075017,d=u/Math.cos(Math.PI/180*e.lat);return new fe(new h.N(e.lng-d,e.lat-u),new h.N(e.lng+d,e.lat+u))}adjustAntiMeridian(){const e=new h.N(this._sw.lng,this._sw.lat),o=new h.N(this._ne.lng,this._ne.lat);return new fe(e,e.lng>o.lng?new h.N(o.lng+360,o.lat):o)}}class qn{constructor(e,o,u){this.bounds=fe.convert(this.validateBounds(e)),this.minzoom=o||0,this.maxzoom=u||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){const o=Math.pow(2,e.z),u=Math.floor(h.O(this.bounds.getWest())*o),d=Math.floor(h.Q(this.bounds.getNorth())*o),y=Math.ceil(h.O(this.bounds.getEast())*o),w=Math.ceil(h.Q(this.bounds.getSouth())*o);return e.x>=u&&e.x=d&&e.y{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return h.e({},this._options)}loadTile(e){return h._(this,void 0,void 0,function*(){const o=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),u={request:this.map._requestManager.transformRequest(o,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};u.request.collectResourceTiming=this._collectResourceTiming;let d="RT";if(e.actor&&e.state!=="expired"){if(e.state==="loading")return new Promise((y,w)=>{e.reloadPromise={resolve:y,reject:w}})}else e.actor=this.dispatcher.getActor(),d="LT";e.abortController=new AbortController;try{const y=yield e.actor.sendAsync({type:d,data:u},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,y)}catch(y){if(delete e.abortController,e.aborted)return;if(y&&y.status!==404)throw y;this._afterTileLoadWorkerResponse(e,null)}})}_afterTileLoadWorkerResponse(e,o){if(o&&o.resourceTiming&&(e.resourceTiming=o.resourceTiming),o&&this.map._refreshExpiredTiles&&e.setExpiryData(o),e.loadVectorData(o,this.map.painter),e.reloadPromise){const u=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(u.resolve).catch(u.reject)}}abortTile(e){return h._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}}))})}unloadTile(e){return h._(this,void 0,void 0,function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Et extends h.E{constructor(e,o,u,d){super(),this.id=e,this.dispatcher=u,this.setEventedParent(d),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=h.e({type:"raster"},o),h.e(this,h.M(o,["url","scheme","tileSize"]))}load(){return h._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new h.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const e=yield ds(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,e&&(h.e(this,e),e.bounds&&(this.tileBounds=new qn(e.bounds,this.minzoom,this.maxzoom)),this.fire(new h.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new h.k("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new h.j(e))}})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return h.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return h._(this,void 0,void 0,function*(){const o=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{const u=yield Ue.getImage(this.map._requestManager.transformRequest(o,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(u&&u.data){this.map._refreshExpiredTiles&&u.cacheControl&&u.expires&&e.setExpiryData({cacheControl:u.cacheControl,expires:u.expires});const d=this.map.painter.context,y=d.gl,w=u.data;e.texture=this.map.painter.getTileTexture(w.width),e.texture?e.texture.update(w,{useMipmap:!0}):(e.texture=new Ye(d,w,y.RGBA,{useMipmap:!0}),e.texture.bind(y.LINEAR,y.CLAMP_TO_EDGE,y.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(u){if(delete e.abortController,e.aborted)e.state="unloaded";else if(u)throw e.state="errored",u}})}abortTile(e){return h._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)})}unloadTile(e){return h._(this,void 0,void 0,function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)})}hasTransition(){return!1}}class ri extends Et{constructor(e,o,u,d){super(e,o,u,d),this.type="raster-dem",this.maxzoom=22,this._options=h.e({type:"raster-dem"},o),this.encoding=o.encoding||"mapbox",this.redFactor=o.redFactor,this.greenFactor=o.greenFactor,this.blueFactor=o.blueFactor,this.baseShift=o.baseShift}loadTile(e){return h._(this,void 0,void 0,function*(){const o=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),u=this.map._requestManager.transformRequest(o,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{const d=yield Ue.getImage(u,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(d&&d.data){const y=d.data;this.map._refreshExpiredTiles&&d.cacheControl&&d.expires&&e.setExpiryData({cacheControl:d.cacheControl,expires:d.expires});const w=h.b(y)&&h.U()?y:yield this.readImageNow(y),C={type:this.type,uid:e.uid,source:this.id,rawImageData:w,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();const S=yield e.actor.sendAsync({type:"LDT",data:C});e.dem=S,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(d){if(delete e.abortController,e.aborted)e.state="unloaded";else if(d)throw e.state="errored",d}})}readImageNow(e){return h._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&h.V()){const o=e.width+2,u=e.height+2;try{return new h.R({width:o,height:u},yield h.W(e,-1,-1,o,u))}catch{}}return B.getImageData(e,1)})}_getNeighboringTiles(e){const o=e.canonical,u=Math.pow(2,o.z),d=(o.x-1+u)%u,y=o.x===0?e.wrap-1:e.wrap,w=(o.x+1+u)%u,C=o.x+1===u?e.wrap+1:e.wrap,S={};return S[new h.S(e.overscaledZ,y,o.z,d,o.y).key]={backfilled:!1},S[new h.S(e.overscaledZ,C,o.z,w,o.y).key]={backfilled:!1},o.y>0&&(S[new h.S(e.overscaledZ,y,o.z,d,o.y-1).key]={backfilled:!1},S[new h.S(e.overscaledZ,e.wrap,o.z,o.x,o.y-1).key]={backfilled:!1},S[new h.S(e.overscaledZ,C,o.z,w,o.y-1).key]={backfilled:!1}),o.y+10&&h.e(y,{resourceTiming:d}),this.fire(new h.k("data",Object.assign(Object.assign({},y),{sourceDataType:"metadata"}))),this.fire(new h.k("data",Object.assign(Object.assign({},y),{sourceDataType:"content"})))}catch(u){if(this._pendingLoads--,this._removed)return void this.fire(new h.k("dataabort",{dataType:"source"}));this.fire(new h.j(u))}})}loaded(){return this._pendingLoads===0}loadTile(e){return h._(this,void 0,void 0,function*(){const o=e.actor?"RT":"LT";e.actor=this.actor;const u={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};e.abortController=new AbortController;const d=yield this.actor.sendAsync({type:o,data:u},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(d,this.map.painter,o==="RT")})}abortTile(e){return h._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0})}unloadTile(e){return h._(this,void 0,void 0,function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.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 h.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Sn=h.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class fn extends h.E{constructor(e,o,u,d){super(),this.id=e,this.dispatcher=u,this.coordinates=o.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(d),this.options=o}load(e){return h._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new h.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const o=yield Ue.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,o&&o.data&&(this.image=o.data,e&&(this.coordinates=e),this._finishLoading())}catch(o){this._request=null,this._loaded=!0,this.fire(new h.j(o))}})}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new h.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;const o=e.map(h.Z.fromLngLat);this.tileID=function(d){let y=1/0,w=1/0,C=-1/0,S=-1/0;for(const N of d)y=Math.min(y,N.x),w=Math.min(w,N.y),C=Math.max(C,N.x),S=Math.max(S,N.y);const T=Math.max(C-y,S-w),z=Math.max(0,Math.floor(-Math.log(T)/Math.LN2)),k=Math.pow(2,z);return new h.a1(z,Math.floor((y+C)/2*k),Math.floor((w+S)/2*k))}(o),this.minzoom=this.maxzoom=this.tileID.z;const u=o.map(d=>this.tileID.getTilePoint(d)._round());return this._boundsArray=new h.$,this._boundsArray.emplaceBack(u[0].x,u[0].y,0,0),this._boundsArray.emplaceBack(u[1].x,u[1].y,h.X,0),this._boundsArray.emplaceBack(u[3].x,u[3].y,0,h.X),this._boundsArray.emplaceBack(u[2].x,u[2].y,h.X,h.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new h.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const e=this.map.painter.context,o=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Sn.members)),this.boundsSegments||(this.boundsSegments=h.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Ye(e,this.image,o.RGBA),this.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE));let u=!1;for(const d in this.tiles){const y=this.tiles[d];y.state!=="loaded"&&(y.state="loaded",y.texture=this.texture,u=!0)}u&&this.fire(new h.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return h._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class ps extends fn{constructor(e,o,u,d){super(e,o,u,d),this.roundZoom=!0,this.type="video",this.options=o}load(){return h._(this,void 0,void 0,function*(){this._loaded=!1;const e=this.options;this.urls=[];for(const o of e.urls)this.urls.push(this.map._requestManager.transformRequest(o,"Source").url);try{const o=yield h.a3(this.urls);if(this._loaded=!0,!o)return;this.video=o,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(o){this.fire(new h.j(o))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const o=this.video.seekable;eo.end(0)?this.fire(new h.j(new h.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${o.start(0)} and ${o.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,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 e=this.map.painter.context,o=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Sn.members)),this.boundsSegments||(this.boundsSegments=h.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE),o.texSubImage2D(o.TEXTURE_2D,0,0,0,o.RGBA,o.UNSIGNED_BYTE,this.video)):(this.texture=new Ye(e,this.video,o.RGBA),this.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE));let u=!1;for(const d in this.tiles){const y=this.tiles[d];y.state!=="loaded"&&(y.state="loaded",y.texture=this.texture,u=!0)}u&&this.fire(new h.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 vr extends fn{constructor(e,o,u,d){super(e,o,u,d),o.coordinates?Array.isArray(o.coordinates)&&o.coordinates.length===4&&!o.coordinates.some(y=>!Array.isArray(y)||y.length!==2||y.some(w=>typeof w!="number"))||this.fire(new h.j(new h.a2(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new h.j(new h.a2(`sources.${e}`,null,'missing required property "coordinates"'))),o.animate&&typeof o.animate!="boolean"&&this.fire(new h.j(new h.a2(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),o.canvas?typeof o.canvas=="string"||o.canvas instanceof HTMLCanvasElement||this.fire(new h.j(new h.a2(`sources.${e}`,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 h.j(new h.a2(`sources.${e}`,null,'missing required property "canvas"'))),this.options=o,this.animate=o.animate===void 0||o.animate}load(){return h._(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 h.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(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const o=this.map.painter.context,u=o.gl;this.boundsBuffer||(this.boundsBuffer=o.createVertexBuffer(this._boundsArray,Sn.members)),this.boundsSegments||(this.boundsSegments=h.a0.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Ye(o,this.canvas,u.RGBA,{premultiply:!0});let d=!1;for(const y in this.tiles){const w=this.tiles[y];w.state!=="loaded"&&(w.state="loaded",w.texture=this.texture,d=!0)}d&&this.fire(new h.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}const ho={},co=_=>{switch(_){case"geojson":return lo;case"image":return fn;case"raster":return Et;case"raster-dem":return ri;case"vector":return ao;case"video":return ps;case"canvas":return vr}return ho[_]},Ce="RTLPluginLoaded";class Kr extends h.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=oo()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(o=>{throw this.status="error",o})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return h._(this,arguments,void 0,function*(o,u=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=B.resolveURL(o),!this.url)throw new Error(`requested url ${o} is invalid`);if(this.status==="unavailable"){if(!u)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return h._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new h.k(Ce))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Vi=null;function Yr(){return Vi||(Vi=new Kr),Vi}class Mn{constructor(e,o){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=h.a4(),this.uses=0,this.tileSize=o,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(e){const o=e+this.timeAdded;oy.getLayer(T)).filter(Boolean);if(S.length!==0){C.layers=S,C.stateDependentLayerIds&&(C.stateDependentLayers=C.stateDependentLayerIds.map(T=>S.filter(z=>z.id===T)[0]));for(const T of S)w[T.id]=C}}return w}(e.buckets,o.style),this.hasSymbolBuckets=!1;for(const d in this.buckets){const y=this.buckets[d];if(y instanceof h.a6){if(this.hasSymbolBuckets=!0,!u)break;y.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const d in this.buckets){const y=this.buckets[d];if(y instanceof h.a6&&y.hasRTLText){this.hasRTLText=!0,Yr().lazyLoad();break}}this.queryPadding=0;for(const d in this.buckets){const y=this.buckets[d];this.queryPadding=Math.max(this.queryPadding,o.style.getLayer(d).queryRadius(y))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new h.a5}unloadVectorData(){for(const e in this.buckets)this.buckets[e].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(e){return this.buckets[e.id]}upload(e){for(const u in this.buckets){const d=this.buckets[u];d.uploadPending()&&d.upload(e)}const o=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Ye(e,this.imageAtlas.image,o.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Ye(e,this.glyphAtlasImage,o.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,o,u,d,y,w,C,S,T,z){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:d,cameraQueryGeometry:y,scale:w,tileSize:this.tileSize,pixelPosMatrix:z,transform:S,params:C,queryPadding:this.queryPadding*T},e,o,u):{}}querySourceFeatures(e,o){const u=this.latestFeatureIndex;if(!u||!u.rawTileData)return;const d=u.loadVTLayers(),y=o&&o.sourceLayer?o.sourceLayer:"",w=d._geojsonTileLayer||d[y];if(!w)return;const C=h.a7(o&&o.filter),{z:S,x:T,y:z}=this.tileID.canonical,k={z:S,x:T,y:z};for(let N=0;Nu)d=!1;else if(o)if(this.expirationTime{this.remove(e,y)},u)),this.data[d].push(y),this.order.push(d),this.order.length>this.max){const w=this._getAndRemoveByKey(this.order[0]);w&&this.onRemove(w)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const o=this.data[e].shift();return o.timeout&&clearTimeout(o.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),o.value}getByKey(e){const o=this.data[e];return o?o[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,o){if(!this.has(e))return this;const u=e.wrapped().key,d=o===void 0?0:this.data[u].indexOf(o),y=this.data[u][d];return this.data[u].splice(d,1),y.timeout&&clearTimeout(y.timeout),this.data[u].length===0&&delete this.data[u],this.onRemove(y.value),this.order.splice(this.order.indexOf(u),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const o=this._getAndRemoveByKey(this.order[0]);o&&this.onRemove(o)}return this}filter(e){const o=[];for(const u in this.data)for(const d of this.data[u])e(d.value)||o.push(d);for(const u of o)this.remove(u.value.tileID,u)}}class pt{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,o,u){const d=String(o);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][d]=this.stateChanges[e][d]||{},h.e(this.stateChanges[e][d],u),this.deletedStates[e]===null){this.deletedStates[e]={};for(const y in this.state[e])y!==d&&(this.deletedStates[e][y]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][d]===null){this.deletedStates[e][d]={};for(const y in this.state[e][d])u[y]||(this.deletedStates[e][d][y]=null)}else for(const y in u)this.deletedStates[e]&&this.deletedStates[e][d]&&this.deletedStates[e][d][y]===null&&delete this.deletedStates[e][d][y]}removeFeatureState(e,o,u){if(this.deletedStates[e]===null)return;const d=String(o);if(this.deletedStates[e]=this.deletedStates[e]||{},u&&o!==void 0)this.deletedStates[e][d]!==null&&(this.deletedStates[e][d]=this.deletedStates[e][d]||{},this.deletedStates[e][d][u]=null);else if(o!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][d])for(u in this.deletedStates[e][d]={},this.stateChanges[e][d])this.deletedStates[e][d][u]=null;else this.deletedStates[e][d]=null;else this.deletedStates[e]=null}getState(e,o){const u=String(o),d=h.e({},(this.state[e]||{})[u],(this.stateChanges[e]||{})[u]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){const y=this.deletedStates[e][o];if(y===null)return{};for(const w in y)delete d[w]}return d}initializeTileState(e,o){e.setFeatureState(this.state,o)}coalesceChanges(e,o){const u={};for(const d in this.stateChanges){this.state[d]=this.state[d]||{};const y={};for(const w in this.stateChanges[d])this.state[d][w]||(this.state[d][w]={}),h.e(this.state[d][w],this.stateChanges[d][w]),y[w]=this.state[d][w];u[d]=y}for(const d in this.deletedStates){this.state[d]=this.state[d]||{};const y={};if(this.deletedStates[d]===null)for(const w in this.state[d])y[w]={},this.state[d][w]={};else for(const w in this.deletedStates[d]){if(this.deletedStates[d][w]===null)this.state[d][w]={};else for(const C of Object.keys(this.deletedStates[d][w]))delete this.state[d][w][C];y[w]=this.state[d][w]}u[d]=u[d]||{},h.e(u[d],y)}if(this.stateChanges={},this.deletedStates={},Object.keys(u).length!==0)for(const d in e)e[d].setFeatureState(u,o)}}class rt extends h.E{constructor(e,o,u){super(),this.id=e,this.dispatcher=u,this.on("data",d=>this._dataHandler(d)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((d,y,w,C)=>{const S=new(co(y.type))(d,y,w,C);if(S.id!==d)throw new Error(`Expected Source id to be ${d} instead of ${S.id}`);return S})(e,o,u,this),this._tiles={},this._cache=new Te(0,d=>this._unloadTile(d)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new pt,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}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 e in this._tiles){const o=this._tiles[e];if(o.state!=="loaded"&&o.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,o,u){return h._(this,void 0,void 0,function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,o,u)}catch(d){e.state="errored",d.status!==404?this._source.fire(new h.j(d,{tile:e})):this.update(this.transform,this.terrain)}})}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new h.k("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const o in this._tiles){const u=this._tiles[o];u.upload(e),u.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(Xi).map(e=>e.key)}getRenderableIds(e){const o=[];for(const u in this._tiles)this._isIdRenderable(u,e)&&o.push(this._tiles[u]);return e?o.sort((u,d)=>{const y=u.tileID,w=d.tileID,C=new h.P(y.canonical.x,y.canonical.y)._rotate(this.transform.angle),S=new h.P(w.canonical.x,w.canonical.y)._rotate(this.transform.angle);return y.overscaledZ-w.overscaledZ||S.y-C.y||S.x-C.x}).map(u=>u.tileID.key):o.map(u=>u.tileID).sort(Xi).map(u=>u.key)}hasRenderableParent(e){const o=this.findLoadedParent(e,0);return!!o&&this._isIdRenderable(o.tileID.key)}_isIdRenderable(e,o){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(o||!this._tiles[e].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const e in this._tiles)this._tiles[e].state!=="errored"&&this._reloadTile(e,"reloading")}}_reloadTile(e,o){return h._(this,void 0,void 0,function*(){const u=this._tiles[e];u&&(u.state!=="loading"&&(u.state=o),yield this._loadTile(u,e,o))})}_tileLoaded(e,o,u){e.timeAdded=B.now(),u==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(o,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new h.k("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){const o=this.getRenderableIds();for(let d=0;d1||(Math.abs(w)>1&&(Math.abs(w+S)===1?w+=S:Math.abs(w-S)===1&&(w-=S)),y.dem&&d.dem&&(d.dem.backfillBorder(y.dem,w,C),d.neighboringTiles&&d.neighboringTiles[T]&&(d.neighboringTiles[T].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,o,u,d){for(const y in this._tiles){let w=this._tiles[y];if(d[y]||!w.hasData()||w.tileID.overscaledZ<=o||w.tileID.overscaledZ>u)continue;let C=w.tileID;for(;w&&w.tileID.overscaledZ>o+1;){const T=w.tileID.scaledTo(w.tileID.overscaledZ-1);w=this._tiles[T.key],w&&w.hasData()&&(C=T)}let S=C;for(;S.overscaledZ>o;)if(S=S.scaledTo(S.overscaledZ-1),e[S.key]){d[C.key]=C;break}}}findLoadedParent(e,o){if(e.key in this._loadedParentTiles){const u=this._loadedParentTiles[e.key];return u&&u.tileID.overscaledZ>=o?u:null}for(let u=e.overscaledZ-1;u>=o;u--){const d=e.scaledTo(u),y=this._getLoadedTile(d);if(y)return y}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){const o=this._tiles[e.key];return o&&o.hasData()?o:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){const o=Math.ceil(e.width/this._source.tileSize)+1,u=Math.ceil(e.height/this._source.tileSize)+1,d=Math.floor(o*u*(this._maxTileCacheZoomLevels===null?h.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),y=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,d):d;this._cache.setMaxSize(y)}handleWrapJump(e){const o=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,o){const u={};for(const d in this._tiles){const y=this._tiles[d];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+o),u[y.tileID.key]=y}this._tiles=u;for(const d in this._timers)clearTimeout(this._timers[d]),delete this._timers[d];for(const d in this._tiles)this._setTileReloadTimer(d,this._tiles[d])}}_updateCoveredAndRetainedTiles(e,o,u,d,y,w){const C={},S={},T=Object.keys(e),z=B.now();for(const k of T){const N=e[k],q=this._tiles[k];if(!q||q.fadeEndTime!==0&&q.fadeEndTime<=z)continue;const G=this.findLoadedParent(N,o),J=this.findLoadedSibling(N),Q=G||J||null;Q&&(this._addTile(Q.tileID),C[Q.tileID.key]=Q.tileID),S[k]=N}this._retainLoadedChildren(S,d,u,e);for(const k in C)e[k]||(this._coveredTiles[k]=!0,e[k]=C[k]);if(w){const k={},N={};for(const q of y)this._tiles[q.key].hasData()?k[q.key]=q:N[q.key]=q;for(const q in N){const G=N[q].children(this._source.maxzoom);this._tiles[G[0].key]&&this._tiles[G[1].key]&&this._tiles[G[2].key]&&this._tiles[G[3].key]&&(k[G[0].key]=e[G[0].key]=G[0],k[G[1].key]=e[G[1].key]=G[1],k[G[2].key]=e[G[2].key]=G[2],k[G[3].key]=e[G[3].key]=G[3],delete N[q])}for(const q in N){const G=N[q],J=this.findLoadedParent(G,this._source.minzoom),Q=this.findLoadedSibling(G),ee=J||Q||null;if(ee){k[ee.tileID.key]=e[ee.tileID.key]=ee.tileID;for(const ie in k)k[ie].isChildOf(ee.tileID)&&delete k[ie]}}for(const q in this._tiles)k[q]||(this._coveredTiles[q]=!0)}}update(e,o){if(!this._sourceLoaded||this._paused)return;let u;this.transform=e,this.terrain=o,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?u=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(z=>new h.S(z.canonical.z,z.wrap,z.canonical.z,z.canonical.x,z.canonical.y)):(u=e.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:o}),this._source.hasTile&&(u=u.filter(z=>this._source.hasTile(z)))):u=[];const d=e.coveringZoomLevel(this._source),y=Math.max(d-rt.maxOverzooming,this._source.minzoom),w=Math.max(d+rt.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const z={};for(const k of u)if(k.canonical.z>this._source.minzoom){const N=k.scaledTo(k.canonical.z-1);z[N.key]=N;const q=k.scaledTo(Math.max(this._source.minzoom,Math.min(k.canonical.z,5)));z[q.key]=q}u=u.concat(Object.values(z))}const C=u.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,C&&this.fire(new h.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const S=this._updateRetainedTiles(u,d);Dr(this._source.type)&&this._updateCoveredAndRetainedTiles(S,y,w,d,u,o);for(const z in S)this._tiles[z].clearFadeHold();const T=h.ab(this._tiles,S);for(const z of T){const k=this._tiles[z];k.hasSymbolBuckets&&!k.holdingForFade()?k.setHoldDuration(this.map._fadeDuration):k.hasSymbolBuckets&&!k.symbolFadeFinished()||this._removeTile(z)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,o){var u;const d={},y={},w=Math.max(o-rt.maxOverzooming,this._source.minzoom),C=Math.max(o+rt.maxUnderzooming,this._source.minzoom),S={};for(const T of e){const z=this._addTile(T);d[T.key]=T,z.hasData()||othis._source.maxzoom){const N=T.children(this._source.maxzoom)[0],q=this.getTile(N);if(q&&q.hasData()){d[N.key]=N;continue}}else{const N=T.children(this._source.maxzoom);if(d[N[0].key]&&d[N[1].key]&&d[N[2].key]&&d[N[3].key])continue}let k=z.wasRequested();for(let N=T.overscaledZ-1;N>=w;--N){const q=T.scaledTo(N);if(y[q.key])break;if(y[q.key]=!0,z=this.getTile(q),!z&&k&&(z=this._addTile(q)),z){const G=z.hasData();if((G||!(!((u=this.map)===null||u===void 0)&&u.cancelPendingTileRequestsWhileZooming)||k)&&(d[q.key]=q),k=z.wasRequested(),G)break}}}return d}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const o=[];let u,d=this._tiles[e].tileID;for(;d.overscaledZ>0;){if(d.key in this._loadedParentTiles){u=this._loadedParentTiles[d.key];break}o.push(d.key);const y=d.scaledTo(d.overscaledZ-1);if(u=this._getLoadedTile(y),u)break;d=y}for(const y of o)this._loadedParentTiles[y]=u}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const e in this._tiles){const o=this._tiles[e].tileID,u=this._getLoadedTile(o);this._loadedSiblingTiles[o.key]=u}}_addTile(e){let o=this._tiles[e.key];if(o)return o;o=this._cache.getAndRemove(e),o&&(this._setTileReloadTimer(e.key,o),o.tileID=e,this._state.initializeTileState(o,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,o)));const u=o;return o||(o=new Mn(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(o,e.key,o.state)),o.uses++,this._tiles[e.key]=o,u||this._source.fire(new h.k("dataloading",{tile:o,coord:o.tileID,dataType:"source"})),o}_setTileReloadTimer(e,o){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const u=o.getExpiryTimeout();u&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},u))}_removeTile(e){const o=this._tiles[e];o&&(o.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),o.uses>0||(o.hasData()&&o.state!=="reloading"?this._cache.add(o.tileID,o,o.getExpiryTimeout()):(o.aborted=!0,this._abortTile(o),this._unloadTile(o))))}_dataHandler(e){const o=e.sourceDataType;e.dataType==="source"&&o==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&o==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,o,u){const d=[],y=this.transform;if(!y)return d;const w=u?y.getCameraQueryGeometry(e):e,C=e.map(G=>y.pointCoordinate(G,this.terrain)),S=w.map(G=>y.pointCoordinate(G,this.terrain)),T=this.getIds();let z=1/0,k=1/0,N=-1/0,q=-1/0;for(const G of S)z=Math.min(z,G.x),k=Math.min(k,G.y),N=Math.max(N,G.x),q=Math.max(q,G.y);for(let G=0;G=0&&X[1].y+ie>=0){const se=C.map(de=>Q.getTilePoint(de)),ae=S.map(de=>Q.getTilePoint(de));d.push({tile:J,tileID:Q,queryGeometry:se,cameraQueryGeometry:ae,scale:ee})}}return d}getVisibleCoordinates(e){const o=this.getRenderableIds(e).map(u=>this._tiles[u].tileID);for(const u of o)u.posMatrix=this.transform.calculatePosMatrix(u.toUnwrapped());return o}hasTransition(){if(this._source.hasTransition())return!0;if(Dr(this._source.type)){const e=B.now();for(const o in this._tiles)if(this._tiles[o].fadeEndTime>=e)return!0}return!1}setFeatureState(e,o,u){this._state.updateState(e=e||"_geojsonTileLayer",o,u)}removeFeatureState(e,o,u){this._state.removeFeatureState(e=e||"_geojsonTileLayer",o,u)}getFeatureState(e,o){return this._state.getState(e=e||"_geojsonTileLayer",o)}setDependencies(e,o,u){const d=this._tiles[e];d&&d.setDependencies(o,u)}reloadTilesForDependencies(e,o){for(const u in this._tiles)this._tiles[u].hasDependency(e,o)&&this._reloadTile(u,"reloading");this._cache.filter(u=>!u.hasDependency(e,o))}}function Xi(_,e){const o=Math.abs(2*_.wrap)-+(_.wrap<0),u=Math.abs(2*e.wrap)-+(e.wrap<0);return _.overscaledZ-e.overscaledZ||u-o||e.canonical.y-_.canonical.y||e.canonical.x-_.canonical.x}function Dr(_){return _==="raster"||_==="image"||_==="video"}rt.maxOverzooming=10,rt.maxUnderzooming=3;class lt{constructor(e,o){this.reset(e,o)}reset(e,o){this.points=e||[],this._distances=[0];for(let u=1;u0?(d-w)/C:0;return this.points[y].mult(1-S).add(this.points[o].mult(S))}}function Qr(_,e){let o=!0;return _==="always"||_!=="never"&&e!=="never"||(o=!1),o}class mn{constructor(e,o,u){const d=this.boxCells=[],y=this.circleCells=[];this.xCellCount=Math.ceil(e/u),this.yCellCount=Math.ceil(o/u);for(let w=0;wthis.width||d<0||o>this.height)return[];const S=[];if(e<=0&&o<=0&&this.width<=u&&this.height<=d){if(y)return[{key:null,x1:e,y1:o,x2:u,y2:d}];for(let T=0;T0}hitTestCircle(e,o,u,d,y){const w=e-u,C=e+u,S=o-u,T=o+u;if(C<0||w>this.width||T<0||S>this.height)return!1;const z=[];return this._forEachCell(w,S,C,T,this._queryCellCircle,z,{hitTest:!0,overlapMode:d,circle:{x:e,y:o,radius:u},seenUids:{box:{},circle:{}}},y),z.length>0}_queryCell(e,o,u,d,y,w,C,S){const{seenUids:T,hitTest:z,overlapMode:k}=C,N=this.boxCells[y];if(N!==null){const G=this.bboxes;for(const J of N)if(!T.box[J]){T.box[J]=!0;const Q=4*J,ee=this.boxKeys[J];if(e<=G[Q+2]&&o<=G[Q+3]&&u>=G[Q+0]&&d>=G[Q+1]&&(!S||S(ee))&&(!z||!Qr(k,ee.overlapMode))&&(w.push({key:ee,x1:G[Q],y1:G[Q+1],x2:G[Q+2],y2:G[Q+3]}),z))return!0}}const q=this.circleCells[y];if(q!==null){const G=this.circles;for(const J of q)if(!T.circle[J]){T.circle[J]=!0;const Q=3*J,ee=this.circleKeys[J];if(this._circleAndRectCollide(G[Q],G[Q+1],G[Q+2],e,o,u,d)&&(!S||S(ee))&&(!z||!Qr(k,ee.overlapMode))){const ie=G[Q],X=G[Q+1],se=G[Q+2];if(w.push({key:ee,x1:ie-se,y1:X-se,x2:ie+se,y2:X+se}),z)return!0}}}return!1}_queryCellCircle(e,o,u,d,y,w,C,S){const{circle:T,seenUids:z,overlapMode:k}=C,N=this.boxCells[y];if(N!==null){const G=this.bboxes;for(const J of N)if(!z.box[J]){z.box[J]=!0;const Q=4*J,ee=this.boxKeys[J];if(this._circleAndRectCollide(T.x,T.y,T.radius,G[Q+0],G[Q+1],G[Q+2],G[Q+3])&&(!S||S(ee))&&!Qr(k,ee.overlapMode))return w.push(!0),!0}}const q=this.circleCells[y];if(q!==null){const G=this.circles;for(const J of q)if(!z.circle[J]){z.circle[J]=!0;const Q=3*J,ee=this.circleKeys[J];if(this._circlesCollide(G[Q],G[Q+1],G[Q+2],T.x,T.y,T.radius)&&(!S||S(ee))&&!Qr(k,ee.overlapMode))return w.push(!0),!0}}}_forEachCell(e,o,u,d,y,w,C,S){const T=this._convertToXCellCoord(e),z=this._convertToYCellCoord(o),k=this._convertToXCellCoord(u),N=this._convertToYCellCoord(d);for(let q=T;q<=k;q++)for(let G=z;G<=N;G++)if(y.call(this,e,o,u,d,this.xCellCount*G+q,w,C,S))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,o,u,d,y,w){const C=d-e,S=y-o,T=u+w;return T*T>C*C+S*S}_circleAndRectCollide(e,o,u,d,y,w,C){const S=(w-d)/2,T=Math.abs(e-(d+S));if(T>S+u)return!1;const z=(C-y)/2,k=Math.abs(o-(y+z));if(k>z+u)return!1;if(T<=S||k<=z)return!0;const N=T-S,q=k-z;return N*N+q*q<=u*u}}function Pn(_,e,o,u,d){const y=h.H();return e?(h.K(y,y,[1/d,1/d,1]),o||h.ad(y,y,u.angle)):h.L(y,u.labelPlaneMatrix,_),y}function en(_,e,o,u,d){if(e){const y=h.ae(_);return h.K(y,y,[d,d,1]),o||h.ad(y,y,-u.angle),y}return u.glCoordMatrix}function K(_,e,o,u){let d;u?(d=[_,e,u(_,e),1],h.af(d,d,o)):(d=[_,e,0,1],It(d,d,o));const y=d[3];return{point:new h.P(d[0]/y,d[1]/y),signedDistanceFromCamera:y,isOccluded:!1}}function R(_,e){return .5+_/e*.5}function F(_,e){return _.x>=-e[0]&&_.x<=e[0]&&_.y>=-e[1]&&_.y<=e[1]}function Z(_,e,o,u,d,y,w,C,S,T,z,k,N,q,G){const J=u?_.textSizeData:_.iconSizeData,Q=h.ag(J,o.transform.zoom),ee=[256/o.width*2+1,256/o.height*2+1],ie=u?_.text.dynamicLayoutVertexArray:_.icon.dynamicLayoutVertexArray;ie.clear();const X=_.lineVertexArray,se=u?_.text.placedSymbolArray:_.icon.placedSymbolArray,ae=o.transform.width/o.transform.height;let de=!1;for(let xe=0;xeMath.abs(o.x-e.x)*u?{useVertical:!0}:(_===h.ah.vertical?e.yo.x)?{needsFlipping:!0}:null}function oe(_,e,o,u,d,y,w,C,S,T,z){const k=o/24,N=e.lineOffsetX*k,q=e.lineOffsetY*k;let G;if(e.numGlyphs>1){const J=e.glyphStartIndex+e.numGlyphs,Q=e.lineStartIndex,ee=e.lineStartIndex+e.lineLength,ie=H(k,C,N,q,u,e,z,_);if(!ie)return{notEnoughRoom:!0};const X=K(ie.first.point.x,ie.first.point.y,w,_.getElevation).point,se=K(ie.last.point.x,ie.last.point.y,w,_.getElevation).point;if(d&&!u){const ae=ne(e.writingMode,X,se,T);if(ae)return ae}G=[ie.first];for(let ae=e.glyphStartIndex+1;ae0?X.point:function(de,xe,Ie,ke,Fe,Ee){return he(de,xe,Ie,1,Fe,Ee)}(_.tileAnchorPoint,ie,Q,0,y,_),ae=ne(e.writingMode,Q,se,T);if(ae)return ae}const J=Me(k*C.getoffsetX(e.glyphStartIndex),N,q,u,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,_,z);if(!J||_.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};G=[J]}for(const J of G)h.aj(S,J.point,J.angle);return{}}function he(_,e,o,u,d,y){const w=_.add(_.sub(e)._unit()),C=d!==void 0?K(w.x,w.y,d,y.getElevation).point:ge(w.x,w.y,y).point,S=o.sub(C);return o.add(S._mult(u/S.mag()))}function te(_,e,o){const u=e.projectionCache;if(u.projections[_])return u.projections[_];const d=new h.P(e.lineVertexArray.getx(_),e.lineVertexArray.gety(_)),y=ge(d.x,d.y,e);if(y.signedDistanceFromCamera>0)return u.projections[_]=y.point,u.anyProjectionOccluded=u.anyProjectionOccluded||y.isOccluded,y.point;const w=_-o.direction;return function(C,S,T,z,k){return he(C,S,T,z,void 0,k)}(o.distanceFromAnchor===0?e.tileAnchorPoint:new h.P(e.lineVertexArray.getx(w),e.lineVertexArray.gety(w)),d,o.previousVertex,o.absOffsetX-o.distanceFromAnchor+1,e)}function ge(_,e,o){const u=_+o.translation[0],d=e+o.translation[1];let y;return!o.pitchWithMap&&o.projection.useSpecialProjectionForSymbols?(y=o.projection.projectTileCoordinates(u,d,o.unwrappedTileID,o.getElevation),y.point.x=(.5*y.point.x+.5)*o.width,y.point.y=(.5*-y.point.y+.5)*o.height):(y=K(u,d,o.labelPlaneMatrix,o.getElevation),y.isOccluded=!1),y}function be(_,e,o){return _._unit()._perp()._mult(e*o)}function pe(_,e,o,u,d,y,w,C,S){if(C.projectionCache.offsets[_])return C.projectionCache.offsets[_];const T=o.add(e);if(_+S.direction=d)return C.projectionCache.offsets[_]=T,T;const z=te(_+S.direction,C,S),k=be(z.sub(o),w,S.direction),N=o.add(k),q=z.add(k);return C.projectionCache.offsets[_]=h.ak(y,T,N,q)||T,C.projectionCache.offsets[_]}function Me(_,e,o,u,d,y,w,C,S){const T=u?_-e:_+e;let z=T>0?1:-1,k=0;u&&(z*=-1,k=Math.PI),z<0&&(k+=Math.PI);let N,q=z>0?y+d:y+d+1;C.projectionCache.cachedAnchorPoint?N=C.projectionCache.cachedAnchorPoint:(N=ge(C.tileAnchorPoint.x,C.tileAnchorPoint.y,C).point,C.projectionCache.cachedAnchorPoint=N);let G,J,Q=N,ee=N,ie=0,X=0;const se=Math.abs(T),ae=[];let de;for(;ie+X<=se;){if(q+=z,q=w)return null;ie+=X,ee=Q,J=G;const ke={absOffsetX:se,direction:z,distanceFromAnchor:ie,previousVertex:ee};if(Q=te(q,C,ke),o===0)ae.push(ee),de=Q.sub(ee);else{let Fe;const Ee=Q.sub(ee);Fe=Ee.mag()===0?be(te(q+z,C,ke).sub(Q),o,z):be(Ee,o,z),J||(J=ee.add(Fe)),G=pe(q,Fe,Q,y,w,J,o,C,ke),ae.push(J),de=G.sub(J)}X=de.mag()}const xe=de._mult((se-ie)/X)._add(J||ee),Ie=k+Math.atan2(Q.y-ee.y,Q.x-ee.x);return ae.push(xe),{point:xe,angle:S?Ie:0,path:ae}}const Je=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Qe(_,e){for(let o=0;o<_;o++){const u=e.length;e.resize(u+4),e.float32.set(Je,3*u)}}function It(_,e,o){const u=e[0],d=e[1];return _[0]=o[0]*u+o[4]*d+o[12],_[1]=o[1]*u+o[5]*d+o[13],_[3]=o[3]*u+o[7]*d+o[15],_}const ht=100;class Ct{constructor(e,o,u=new mn(e.width+200,e.height+200,25),d=new mn(e.width+200,e.height+200,25)){this.transform=e,this.mapProjection=o,this.grid=u,this.ignoredGrid=d,this.pitchFactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+ht,this.screenBottomBoundary=e.height+ht,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,o,u,d,y,w,C,S,T,z,k){const N=e.anchorPointX+S[0],q=e.anchorPointY+S[1],G=this.projectAndGetPerspectiveRatio(d,N,q,y,z),J=u*G.perspectiveRatio;let Q;if(w||C)Q=this._projectCollisionBox(e,J,d,y,w,C,S,G,z,k);else{const ae=G.point.x+(k?k.x*J:0),de=G.point.y+(k?k.y*J:0);Q={allPointsOccluded:!1,box:[ae+e.x1*J,de+e.y1*J,ae+e.x2*J,de+e.y2*J]}}const[ee,ie,X,se]=Q.box;return this.mapProjection.useSpecialProjectionForSymbols&&(w?Q.allPointsOccluded:this.mapProjection.isOccluded(N,q,y))||G.perspectiveRatio=1;dt--)Le.push(at.path[dt]);for(let dt=1;dtyt.signedDistanceFromCamera<=0)?[]:dt.map(yt=>yt.point)}let Kt=[];if(Le.length>0){const dt=Le[0].clone(),yt=Le[0].clone();for(let Yt=1;Yt=Ee.x&&yt.x<=Pe.x&&dt.y>=Ee.y&&yt.y<=Pe.y?[Le]:yt.xPe.x||yt.yPe.y?[]:h.al([Le],Ee.x,Ee.y,Pe.x,Pe.y)}for(const dt of Kt){Ze.reset(dt,.25*Fe);let yt=0;yt=Ze.length<=.5*Fe?1:Math.ceil(Ze.paddedLength/st)+1;for(let Yt=0;YtK(d.x,d.y,u,o.getElevation))}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const o=[];let u=1/0,d=1/0,y=-1/0,w=-1/0;for(const z of e){const k=new h.P(z.x+ht,z.y+ht);u=Math.min(u,k.x),d=Math.min(d,k.y),y=Math.max(y,k.x),w=Math.max(w,k.y),o.push(k)}const C=this.grid.query(u,d,y,w).concat(this.ignoredGrid.query(u,d,y,w)),S={},T={};for(const z of C){const k=z.key;if(S[k.bucketInstanceId]===void 0&&(S[k.bucketInstanceId]={}),S[k.bucketInstanceId][k.featureIndex])continue;const N=[new h.P(z.x1,z.y1),new h.P(z.x2,z.y1),new h.P(z.x2,z.y2),new h.P(z.x1,z.y2)];h.am(o,N)&&(S[k.bucketInstanceId][k.featureIndex]=!0,T[k.bucketInstanceId]===void 0&&(T[k.bucketInstanceId]=[]),T[k.bucketInstanceId].push(k.featureIndex))}return T}insertCollisionBox(e,o,u,d,y,w){(u?this.ignoredGrid:this.grid).insert({bucketInstanceId:d,featureIndex:y,collisionGroupID:w,overlapMode:o},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,o,u,d,y,w){const C=u?this.ignoredGrid:this.grid,S={bucketInstanceId:d,featureIndex:y,collisionGroupID:w,overlapMode:o};for(let T=0;T=this.screenRightBoundary||dthis.screenBottomBoundary}isInsideGrid(e,o,u,d){return u>=0&&e=0&&othis.projectAndGetPerspectiveRatio(u,Fe.x,Fe.y,d,T));Ie=ke.some(Fe=>!Fe.isOccluded),xe=ke.map(Fe=>Fe.point)}else Ie=!0;return{box:h.ao(xe),allPointsOccluded:!Ie}}}function gt(_,e,o){return e*(h.X/(_.tileSize*Math.pow(2,o-_.tileID.overscaledZ)))}class mi{constructor(e,o,u,d){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?o:-o))):d&&u?1:0,this.placed=u}isHidden(){return this.opacity===0&&!this.placed}}class ni{constructor(e,o,u,d,y){this.text=new mi(e?e.text:null,o,u,y),this.icon=new mi(e?e.icon:null,o,d,y)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class ft{constructor(e,o,u){this.text=e,this.icon=o,this.skipFade=u}}class Dt{constructor(){this.invProjMatrix=h.H(),this.viewportMatrix=h.H(),this.circles=[]}}class ti{constructor(e,o,u,d,y){this.bucketInstanceId=e,this.featureIndex=o,this.sourceLayerIndex=u,this.bucketIndex=d,this.tileID=y}}class bi{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){const o=++this.maxGroupID;this.collisionGroups[e]={ID:o,predicate:u=>u.collisionGroupID===o}}return this.collisionGroups[e]}}function Mi(_,e,o,u,d){const{horizontalAlign:y,verticalAlign:w}=h.au(_);return new h.P(-(y-.5)*e+u[0]*d,-(w-.5)*o+u[1]*d)}class Ni{constructor(e,o,u,d,y,w){this.transform=e.clone(),this.terrain=u,this.collisionIndex=new Ct(this.transform,o),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=d,this.retainedQueryData={},this.collisionGroups=new bi(y),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=w,w&&(w.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){const o=this.terrain;return o?(u,d)=>o.getElevation(e,u,d):null}getBucketParts(e,o,u,d){const y=u.getBucket(o),w=u.latestFeatureIndex;if(!y||!w||o.id!==y.layerIds[0])return;const C=u.collisionBoxArray,S=y.layers[0].layout,T=y.layers[0].paint,z=Math.pow(2,this.transform.zoom-u.tileID.overscaledZ),k=u.tileSize/h.X,N=u.tileID.toUnwrapped(),q=this.transform.calculatePosMatrix(N),G=S.get("text-pitch-alignment")==="map",J=S.get("text-rotation-alignment")==="map",Q=gt(u,1,this.transform.zoom),ee=this.collisionIndex.mapProjection.translatePosition(this.transform,u,T.get("text-translate"),T.get("text-translate-anchor")),ie=this.collisionIndex.mapProjection.translatePosition(this.transform,u,T.get("icon-translate"),T.get("icon-translate-anchor")),X=Pn(q,G,J,this.transform,Q);let se=null;if(G){const de=en(q,G,J,this.transform,Q);se=h.L([],this.transform.labelPlaneMatrix,de)}this.retainedQueryData[y.bucketInstanceId]=new ti(y.bucketInstanceId,w,y.sourceLayerIndex,y.index,u.tileID);const ae={bucket:y,layout:S,translationText:ee,translationIcon:ie,posMatrix:q,unwrappedTileID:N,textLabelPlaneMatrix:X,labelToScreenMatrix:se,scale:z,textPixelRatio:k,holdingForFade:u.holdingForFade(),collisionBoxArray:C,partiallyEvaluatedTextSize:h.ag(y.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(y.sourceID)};if(d)for(const de of y.sortKeyRanges){const{sortKey:xe,symbolInstanceStart:Ie,symbolInstanceEnd:ke}=de;e.push({sortKey:xe,symbolInstanceStart:Ie,symbolInstanceEnd:ke,parameters:ae})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:y.symbolInstances.length,parameters:ae})}attemptAnchorPlacement(e,o,u,d,y,w,C,S,T,z,k,N,q,G,J,Q,ee,ie,X){const se=h.aq[e.textAnchor],ae=[e.textOffset0,e.textOffset1],de=Mi(se,u,d,ae,y),xe=this.collisionIndex.placeCollisionBox(o,N,S,T,z,C,w,Q,k.predicate,X,de);if((!ie||this.collisionIndex.placeCollisionBox(ie,N,S,T,z,C,w,ee,k.predicate,X,de).placeable)&&xe.placeable){let Ie;if(this.prevPlacement&&this.prevPlacement.variableOffsets[q.crossTileID]&&this.prevPlacement.placements[q.crossTileID]&&this.prevPlacement.placements[q.crossTileID].text&&(Ie=this.prevPlacement.variableOffsets[q.crossTileID].anchor),q.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[q.crossTileID]={textOffset:ae,width:u,height:d,anchor:se,textBoxScale:y,prevAnchor:Ie},this.markUsedJustification(G,se,q,J),G.allowVerticalPlacement&&(this.markUsedOrientation(G,J,q),this.placedOrientations[q.crossTileID]=J),{shift:de,placedGlyphBoxes:xe}}}placeLayerBucketPart(e,o,u){const{bucket:d,layout:y,translationText:w,translationIcon:C,posMatrix:S,unwrappedTileID:T,textLabelPlaneMatrix:z,labelToScreenMatrix:k,textPixelRatio:N,holdingForFade:q,collisionBoxArray:G,partiallyEvaluatedTextSize:J,collisionGroup:Q}=e.parameters,ee=y.get("text-optional"),ie=y.get("icon-optional"),X=h.ar(y,"text-overlap","text-allow-overlap"),se=X==="always",ae=h.ar(y,"icon-overlap","icon-allow-overlap"),de=ae==="always",xe=y.get("text-rotation-alignment")==="map",Ie=y.get("text-pitch-alignment")==="map",ke=y.get("icon-text-fit")!=="none",Fe=y.get("symbol-z-order")==="viewport-y",Ee=se&&(de||!d.hasIconData()||ie),Pe=de&&(se||!d.hasTextData()||ee);!d.collisionArrays&&G&&d.deserializeCollisionBoxes(G);const Ze=this._getTerrainElevationFunc(this.retainedQueryData[d.bucketInstanceId].tileID),at=(Ae,Le,st)=>{var Kt,dt;if(o[Ae.crossTileID])return;if(q)return void(this.placements[Ae.crossTileID]=new ft(!1,!1,!1));let yt=!1,Yt=!1,ki=!0,Vr=null,Qt={box:null,placeable:!1,offscreen:null},Ji={box:null,placeable:!1,offscreen:null},Ui=null,Di=null,ji=null,sn=0,Fs=0,Ea=0;Le.textFeatureIndex?sn=Le.textFeatureIndex:Ae.useRuntimeCollisionCircles&&(sn=Ae.featureIndex),Le.verticalTextFeatureIndex&&(Fs=Le.verticalTextFeatureIndex);const Rs=Le.textBox;if(Rs){const Sr=Pi=>{let Li=h.ah.horizontal;if(d.allowVerticalPlacement&&!Pi&&this.prevPlacement){const ur=this.prevPlacement.placedOrientations[Ae.crossTileID];ur&&(this.placedOrientations[Ae.crossTileID]=ur,Li=ur,this.markUsedOrientation(d,Li,Ae))}return Li},Mr=(Pi,Li)=>{if(d.allowVerticalPlacement&&Ae.numVerticalGlyphVertices>0&&Le.verticalTextBox){for(const ur of d.writingModes)if(ur===h.ah.vertical?(Qt=Li(),Ji=Qt):Qt=Pi(),Qt&&Qt.placeable)break}else Qt=Pi()},An=Ae.textAnchorOffsetStartIndex,Nr=Ae.textAnchorOffsetEndIndex;if(Nr===An){const Pi=(Li,ur)=>{const xt=this.collisionIndex.placeCollisionBox(Li,X,N,S,T,Ie,xe,w,Q.predicate,Ze);return xt&&xt.placeable&&(this.markUsedOrientation(d,ur,Ae),this.placedOrientations[Ae.crossTileID]=ur),xt};Mr(()=>Pi(Rs,h.ah.horizontal),()=>{const Li=Le.verticalTextBox;return d.allowVerticalPlacement&&Ae.numVerticalGlyphVertices>0&&Li?Pi(Li,h.ah.vertical):{box:null,offscreen:null}}),Sr(Qt&&Qt.placeable)}else{let Pi=h.aq[(dt=(Kt=this.prevPlacement)===null||Kt===void 0?void 0:Kt.variableOffsets[Ae.crossTileID])===null||dt===void 0?void 0:dt.anchor];const Li=(xt,rs,Os)=>{const Vs=xt.x2-xt.x1,Fc=xt.y2-xt.y1,gd=Ae.textBoxScale,Rc=ke&&ae==="never"?rs:null;let zn=null,Oc=X==="never"?1:2,Aa="never";Pi&&Oc++;for(let Ao=0;AoLi(Rs,Le.iconBox,h.ah.horizontal),()=>{const xt=Le.verticalTextBox;return d.allowVerticalPlacement&&(!Qt||!Qt.placeable)&&Ae.numVerticalGlyphVertices>0&&xt?Li(xt,Le.verticalIconBox,h.ah.vertical):{box:null,occluded:!0,offscreen:null}}),Qt&&(yt=Qt.placeable,ki=Qt.offscreen);const ur=Sr(Qt&&Qt.placeable);if(!yt&&this.prevPlacement){const xt=this.prevPlacement.variableOffsets[Ae.crossTileID];xt&&(this.variableOffsets[Ae.crossTileID]=xt,this.markUsedJustification(d,xt.anchor,Ae,ur))}}}if(Ui=Qt,yt=Ui&&Ui.placeable,ki=Ui&&Ui.offscreen,Ae.useRuntimeCollisionCircles){const Sr=d.text.placedSymbolArray.get(Ae.centerJustifiedTextSymbolIndex),Mr=h.ai(d.textSizeData,J,Sr),An=y.get("text-padding");Di=this.collisionIndex.placeCollisionCircles(X,Sr,d.lineVertexArray,d.glyphOffsetArray,Mr,S,T,z,k,u,Ie,Q.predicate,Ae.collisionCircleDiameter,An,w,Ze),Di.circles.length&&Di.collisionDetected&&!u&&h.w("Collisions detected, but collision boxes are not shown"),yt=se||Di.circles.length>0&&!Di.collisionDetected,ki=ki&&Di.offscreen}if(Le.iconFeatureIndex&&(Ea=Le.iconFeatureIndex),Le.iconBox){const Sr=Mr=>this.collisionIndex.placeCollisionBox(Mr,ae,N,S,T,Ie,xe,C,Q.predicate,Ze,ke&&Vr?Vr:void 0);Ji&&Ji.placeable&&Le.verticalIconBox?(ji=Sr(Le.verticalIconBox),Yt=ji.placeable):(ji=Sr(Le.iconBox),Yt=ji.placeable),ki=ki&&ji.offscreen}const Cr=ee||Ae.numHorizontalGlyphVertices===0&&Ae.numVerticalGlyphVertices===0,Ta=ie||Ae.numIconVertices===0;Cr||Ta?Ta?Cr||(Yt=Yt&&yt):yt=Yt&&yt:Yt=yt=Yt&&yt;const sh=Yt&&ji.placeable;if(yt&&Ui.placeable&&this.collisionIndex.insertCollisionBox(Ui.box,X,y.get("text-ignore-placement"),d.bucketInstanceId,Ji&&Ji.placeable&&Fs?Fs:sn,Q.ID),sh&&this.collisionIndex.insertCollisionBox(ji.box,ae,y.get("icon-ignore-placement"),d.bucketInstanceId,Ea,Q.ID),Di&&yt&&this.collisionIndex.insertCollisionCircles(Di.circles,X,y.get("text-ignore-placement"),d.bucketInstanceId,sn,Q.ID),u&&this.storeCollisionData(d.bucketInstanceId,st,Le,Ui,ji,Di),Ae.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(d.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Ae.crossTileID]=new ft(yt||Ee,Yt||Pe,ki||d.justReloaded),o[Ae.crossTileID]=!0};if(Fe){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ae=d.getSortedSymbolIndexes(this.transform.angle);for(let Le=Ae.length-1;Le>=0;--Le){const st=Ae[Le];at(d.symbolInstances.get(st),d.collisionArrays[st],st)}}else for(let Ae=e.symbolInstanceStart;Ae=0&&(e.text.placedSymbolArray.get(C).crossTileID=y>=0&&C!==y?0:u.crossTileID)}markUsedOrientation(e,o,u){const d=o===h.ah.horizontal||o===h.ah.horizontalOnly?o:0,y=o===h.ah.vertical?o:0,w=[u.leftJustifiedTextSymbolIndex,u.centerJustifiedTextSymbolIndex,u.rightJustifiedTextSymbolIndex];for(const C of w)e.text.placedSymbolArray.get(C).placedOrientation=d;u.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(u.verticalPlacedTextSymbolIndex).placedOrientation=y)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const o=this.prevPlacement;let u=!1;this.prevZoomAdjustment=o?o.zoomAdjustment(this.transform.zoom):0;const d=o?o.symbolFadeChange(e):1,y=o?o.opacities:{},w=o?o.variableOffsets:{},C=o?o.placedOrientations:{};for(const S in this.placements){const T=this.placements[S],z=y[S];z?(this.opacities[S]=new ni(z,d,T.text,T.icon),u=u||T.text!==z.text.placed||T.icon!==z.icon.placed):(this.opacities[S]=new ni(null,d,T.text,T.icon,T.skipFade),u=u||T.text||T.icon)}for(const S in y){const T=y[S];if(!this.opacities[S]){const z=new ni(T,d,!1,!1);z.isHidden()||(this.opacities[S]=z,u=u||T.text.placed||T.icon.placed)}}for(const S in w)this.variableOffsets[S]||!this.opacities[S]||this.opacities[S].isHidden()||(this.variableOffsets[S]=w[S]);for(const S in C)this.placedOrientations[S]||!this.opacities[S]||this.opacities[S].isHidden()||(this.placedOrientations[S]=C[S]);if(o&&o.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");u?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=o?o.lastPlacementChangeTime:e)}updateLayerOpacities(e,o){const u={};for(const d of o){const y=d.getBucket(e);y&&d.latestFeatureIndex&&e.id===y.layerIds[0]&&this.updateBucketOpacities(y,d.tileID,u,d.collisionBoxArray)}}updateBucketOpacities(e,o,u,d){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const y=e.layers[0],w=y.layout,C=new ni(null,0,!1,!1,!0),S=w.get("text-allow-overlap"),T=w.get("icon-allow-overlap"),z=y._unevaluatedLayout.hasValue("text-variable-anchor")||y._unevaluatedLayout.hasValue("text-variable-anchor-offset"),k=w.get("text-rotation-alignment")==="map",N=w.get("text-pitch-alignment")==="map",q=w.get("icon-text-fit")!=="none",G=new ni(null,0,S&&(T||!e.hasIconData()||w.get("icon-optional")),T&&(S||!e.hasTextData()||w.get("text-optional")),!0);!e.collisionArrays&&d&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(d);const J=(ee,ie,X)=>{for(let se=0;se0,Ie=this.placedOrientations[ie.crossTileID],ke=Ie===h.ah.vertical,Fe=Ie===h.ah.horizontal||Ie===h.ah.horizontalOnly;if(X>0||se>0){const Pe=lr(de.text);J(e.text,X,ke?ms:Pe),J(e.text,se,Fe?ms:Pe);const Ze=de.text.isHidden();[ie.rightJustifiedTextSymbolIndex,ie.centerJustifiedTextSymbolIndex,ie.leftJustifiedTextSymbolIndex].forEach(Le=>{Le>=0&&(e.text.placedSymbolArray.get(Le).hidden=Ze||ke?1:0)}),ie.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(ie.verticalPlacedTextSymbolIndex).hidden=Ze||Fe?1:0);const at=this.variableOffsets[ie.crossTileID];at&&this.markUsedJustification(e,at.anchor,ie,Ie);const Ae=this.placedOrientations[ie.crossTileID];Ae&&(this.markUsedJustification(e,"left",ie,Ae),this.markUsedOrientation(e,Ae,ie))}if(xe){const Pe=lr(de.icon),Ze=!(q&&ie.verticalPlacedIconSymbolIndex&&ke);ie.placedIconSymbolIndex>=0&&(J(e.icon,ie.numIconVertices,Ze?Pe:ms),e.icon.placedSymbolArray.get(ie.placedIconSymbolIndex).hidden=de.icon.isHidden()),ie.verticalPlacedIconSymbolIndex>=0&&(J(e.icon,ie.numVerticalIconVertices,Ze?ms:Pe),e.icon.placedSymbolArray.get(ie.verticalPlacedIconSymbolIndex).hidden=de.icon.isHidden())}const Ee=Q&&Q.has(ee)?Q.get(ee):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const Pe=e.collisionArrays[ee];if(Pe){let Ze=new h.P(0,0);if(Pe.textBox||Pe.verticalTextBox){let at=!0;if(z){const Ae=this.variableOffsets[ae];Ae?(Ze=Mi(Ae.anchor,Ae.width,Ae.height,Ae.textOffset,Ae.textBoxScale),k&&Ze._rotate(N?this.transform.angle:-this.transform.angle)):at=!1}if(Pe.textBox||Pe.verticalTextBox){let Ae;Pe.textBox&&(Ae=ke),Pe.verticalTextBox&&(Ae=Fe),fs(e.textCollisionBox.collisionVertexArray,de.text.placed,!at||Ae,Ee.text,Ze.x,Ze.y)}}if(Pe.iconBox||Pe.verticalIconBox){const at=!!(!Fe&&Pe.verticalIconBox);let Ae;Pe.iconBox&&(Ae=at),Pe.verticalIconBox&&(Ae=!at),fs(e.iconCollisionBox.collisionVertexArray,de.icon.placed,Ae,Ee.icon,q?Ze.x:0,q?Ze.y:0)}}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);if(e.bucketInstanceId in this.collisionCircleArrays){const ee=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=ee.invProjMatrix,e.placementViewportMatrix=ee.viewportMatrix,e.collisionCircleArray=ee.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTimee}setStale(){this.stale=!0}}function fs(_,e,o,u,d,y){u&&u.length!==0||(u=[0,0,0,0]);const w=u[0]-ht,C=u[1]-ht,S=u[2]-ht,T=u[3]-ht;_.emplaceBack(e?1:0,o?1:0,d||0,y||0,w,C),_.emplaceBack(e?1:0,o?1:0,d||0,y||0,S,C),_.emplaceBack(e?1:0,o?1:0,d||0,y||0,S,T),_.emplaceBack(e?1:0,o?1:0,d||0,y||0,w,T)}const Lt=Math.pow(2,25),gl=Math.pow(2,24),yl=Math.pow(2,17),or=Math.pow(2,16),ar=Math.pow(2,9),qu=Math.pow(2,8),xr=Math.pow(2,1);function lr(_){if(_.opacity===0&&!_.placed)return 0;if(_.opacity===1&&_.placed)return 4294967295;const e=_.placed?1:0,o=Math.floor(127*_.opacity);return o*Lt+e*gl+o*yl+e*or+o*ar+e*qu+o*xr+e}const ms=0;function Zn(){return{isOccluded:(_,e,o)=>!1,getPitchedTextCorrection:(_,e,o)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(_,e,o,u){throw new Error("Not implemented.")},translatePosition:(_,e,o,u)=>function(d,y,w,C,S=!1){if(!w[0]&&!w[1])return[0,0];const T=S?C==="map"?d.angle:0:C==="viewport"?-d.angle:0;if(T){const z=Math.sin(T),k=Math.cos(T);w=[w[0]*k-w[1]*z,w[0]*z+w[1]*k]}return[S?w[0]:gt(y,w[0],d.zoom),S?w[1]:gt(y,w[1],d.zoom)]}(_,e,o,u),getCircleRadiusCorrection:_=>1}}class gi{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,o,u,d,y){const w=this._bucketParts;for(;this._currentTileIndexC.sortKey-S.sortKey));this._currentPartIndex!this._forceFullPlacement&&B.now()-d>2;for(;this._currentPlacementIndex>=0;){const w=o[e[this._currentPlacementIndex]],C=this.placement.collisionIndex.transform.zoom;if(w.type==="symbol"&&(!w.minzoom||w.minzoom<=C)&&(!w.maxzoom||w.maxzoom>C)){if(this._inProgressLayer||(this._inProgressLayer=new gi(w)),this._inProgressLayer.continuePlacement(u[w.source],this.placement,this._showCollisionBoxes,w,y))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const Lr=512/h.X/2;class ui{constructor(e,o,u){this.tileID=e,this.bucketInstanceId=u,this._symbolsByKey={};const d=new Map;for(let y=0;y({x:Math.floor(S.anchorX*Lr),y:Math.floor(S.anchorY*Lr)})),crossTileIDs:w.map(S=>S.crossTileID)};if(C.positions.length>128){const S=new h.av(C.positions.length,16,Uint16Array);for(const{x:T,y:z}of C.positions)S.add(T,z);S.finish(),delete C.positions,C.index=S}this._symbolsByKey[y]=C}}getScaledCoordinates(e,o){const{x:u,y:d,z:y}=this.tileID.canonical,{x:w,y:C,z:S}=o.canonical,T=Lr/Math.pow(2,S-y),z=(C*h.X+e.anchorY)*T,k=d*h.X*Lr;return{x:Math.floor((w*h.X+e.anchorX)*T-u*h.X*Lr),y:Math.floor(z-k)}}findMatches(e,o,u){const d=this.tileID.canonical.ze)}}class Ko{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Br{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const o=Math.round((e-this.lng)/360);if(o!==0)for(const u in this.indexes){const d=this.indexes[u],y={};for(const w in d){const C=d[w];C.tileID=C.tileID.unwrapTo(C.tileID.wrap+o),y[C.tileID.key]=C}this.indexes[u]=y}this.lng=e}addBucket(e,o,u){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===o.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let y=0;ye.overscaledZ)for(const C in w){const S=w[C];S.tileID.isChildOf(e)&&S.findMatches(o.symbolInstances,e,d)}else{const C=w[e.scaledTo(Number(y)).key];C&&C.findMatches(o.symbolInstances,e,d)}}for(let y=0;y{o[u]=!0});for(const u in this.layerIndexes)o[u]||delete this.layerIndexes[u]}}const Fr=(_,e)=>h.t(_,e&&e.filter(o=>o.identifier!=="source.canvas")),Zu=h.aw();class Yo extends h.E{constructor(e,o={}){super(),this._rtlPluginLoaded=()=>{for(const u in this.sourceCaches){const d=this.sourceCaches[u].getSource().type;d!=="vector"&&d!=="geojson"||this.sourceCaches[u].reload()}},this.map=e,this.dispatcher=new $n(_r(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(u,d)=>this.getGlyphs(u,d)),this.dispatcher.registerMessageHandler("GI",(u,d)=>this.getImages(u,d)),this.imageManager=new ct,this.imageManager.setEventedParent(this),this.glyphManager=new fi(e._requestManager,o.localIdeographFontFamily),this.lineAtlas=new zr(256,512),this.crossTileSymbolIndex=new _l,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new h.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",h.ay()),Yr().on(Ce,this._rtlPluginLoaded),this.on("data",u=>{if(u.dataType!=="source"||u.sourceDataType!=="metadata")return;const d=this.sourceCaches[u.sourceId];if(!d)return;const y=d.getSource();if(y&&y.vectorLayerIds)for(const w in this._layers){const C=this._layers[w];C.source===y.id&&this._validateLayer(C)}})}loadURL(e,o={},u){this.fire(new h.k("dataloading",{dataType:"style"})),o.validate=typeof o.validate!="boolean"||o.validate;const d=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;const y=this._loadStyleRequest;h.h(d,this._loadStyleRequest).then(w=>{this._loadStyleRequest=null,this._load(w.data,o,u)}).catch(w=>{this._loadStyleRequest=null,w&&!y.signal.aborted&&this.fire(new h.j(w))})}loadJSON(e,o={},u){this.fire(new h.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,B.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,o.validate=o.validate!==!1,this._load(e,o,u)}).catch(()=>{})}loadEmpty(){this.fire(new h.k("dataloading",{dataType:"style"})),this._load(Zu,{validate:!1})}_load(e,o,u){var d;const y=o.transformStyle?o.transformStyle(u,e):e;if(!o.validate||!Fr(this,h.u(y))){this._loaded=!0,this.stylesheet=y;for(const w in y.sources)this.addSource(w,y.sources[w],{validate:!1});y.sprite?this._loadSprite(y.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(y.glyphs),this._createLayers(),this.light=new yr(this.stylesheet.light),this.sky=new Gi(this.stylesheet.sky),this.map.setTerrain((d=this.stylesheet.terrain)!==null&&d!==void 0?d:null),this.fire(new h.k("data",{dataType:"style"})),this.fire(new h.k("style.load"))}}_createLayers(){const e=h.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",e),this._order=e.map(o=>o.id),this._layers={},this._serializedLayers=null;for(const o of e){const u=h.aA(o);u.setEventedParent(this,{layer:{id:o.id}}),this._layers[o.id]=u}}_loadSprite(e,o=!1,u=void 0){let d;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(y,w,C,S){return h._(this,void 0,void 0,function*(){const T=kt(y),z=C>1?"@2x":"",k={},N={};for(const{id:q,url:G}of T){const J=w.transformRequest(Rt(G,z,".json"),"SpriteJSON");k[q]=h.h(J,S);const Q=w.transformRequest(Rt(G,z,".png"),"SpriteImage");N[q]=Ue.getImage(Q,S)}return yield Promise.all([...Object.values(k),...Object.values(N)]),function(q,G){return h._(this,void 0,void 0,function*(){const J={};for(const Q in q){J[Q]={};const ee=B.getImageCanvasContext((yield G[Q]).data),ie=(yield q[Q]).data;for(const X in ie){const{width:se,height:ae,x:de,y:xe,sdf:Ie,pixelRatio:ke,stretchX:Fe,stretchY:Ee,content:Pe,textFitWidth:Ze,textFitHeight:at}=ie[X];J[Q][X]={data:null,pixelRatio:ke,sdf:Ie,stretchX:Fe,stretchY:Ee,content:Pe,textFitWidth:Ze,textFitHeight:at,spriteData:{width:se,height:ae,x:de,y:xe,context:ee}}}}return J})}(k,N)})}(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(y=>{if(this._spriteRequest=null,y)for(const w in y){this._spritesImagesIds[w]=[];const C=this._spritesImagesIds[w]?this._spritesImagesIds[w].filter(S=>!(S in y)):[];for(const S of C)this.imageManager.removeImage(S),this._changedImages[S]=!0;for(const S in y[w]){const T=w==="default"?S:`${w}:${S}`;this._spritesImagesIds[w].push(T),T in this.imageManager.images?this.imageManager.updateImage(T,y[w][S],!1):this.imageManager.addImage(T,y[w][S]),o&&(this._changedImages[T]=!0)}}}).catch(y=>{this._spriteRequest=null,d=y,this.fire(new h.j(d))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),o&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new h.k("data",{dataType:"style"})),u&&u(d)})}_unloadSprite(){for(const e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new h.k("data",{dataType:"style"}))}_validateLayer(e){const o=this.sourceCaches[e.source];if(!o)return;const u=e.sourceLayer;if(!u)return;const d=o.getSource();(d.type==="geojson"||d.vectorLayerIds&&d.vectorLayerIds.indexOf(u)===-1)&&this.fire(new h.j(new Error(`Source layer "${u}" does not exist on source "${d.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,o=!1){const u=this._serializedAllLayers();if(!e||e.length===0)return Object.values(o?h.aB(u):u);const d=[];for(const y of e)if(u[y]){const w=o?h.aB(u[y]):u[y];d.push(w)}return d}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};const o=Object.keys(this._layers);for(const u of o){const d=this._layers[u];d.type!=="custom"&&(e[u]=d.serialize())}return e}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(const e in this.sourceCaches)if(this.sourceCaches[e].hasTransition())return!0;for(const e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;const o=this._changed;if(o){const d=Object.keys(this._updatedLayers),y=Object.keys(this._removedLayers);(d.length||y.length)&&this._updateWorkerLayers(d,y);for(const w in this._updatedSources){const C=this._updatedSources[w];if(C==="reload")this._reloadSource(w);else{if(C!=="clear")throw new Error(`Invalid action ${C}`);this._clearSource(w)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const w in this._updatedPaintProps)this._layers[w].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}const u={};for(const d in this.sourceCaches){const y=this.sourceCaches[d];u[d]=y.used,y.used=!1}for(const d of this._order){const y=this._layers[d];y.recalculate(e,this._availableImages),!y.isHidden(e.zoom)&&y.source&&(this.sourceCaches[y.source].used=!0)}for(const d in u){const y=this.sourceCaches[d];!!u[d]!=!!y.used&&y.fire(new h.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:d}))}this.light.recalculate(e),this.sky.recalculate(e),this.z=e.zoom,o&&this.fire(new h.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const e=Object.keys(this._changedImages);if(e.length){for(const o in this.sourceCaches)this.sourceCaches[o].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,o){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:o})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,o={}){var u;this._checkLoaded();const d=this.serialize();if(e=o.transformStyle?o.transformStyle(d,e):e,((u=o.validate)===null||u===void 0||u)&&Fr(this,h.u(e)))return!1;(e=h.aB(e)).layers=h.az(e.layers);const y=h.aC(d,e),w=this._getOperationsToPerform(y);if(w.unimplemented.length>0)throw new Error(`Unimplemented: ${w.unimplemented.join(", ")}.`);if(w.operations.length===0)return!1;for(const C of w.operations)C();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){const o=[],u=[];for(const d of e)switch(d.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":o.push(()=>this.addLayer.apply(this,d.args));break;case"removeLayer":o.push(()=>this.removeLayer.apply(this,d.args));break;case"setPaintProperty":o.push(()=>this.setPaintProperty.apply(this,d.args));break;case"setLayoutProperty":o.push(()=>this.setLayoutProperty.apply(this,d.args));break;case"setFilter":o.push(()=>this.setFilter.apply(this,d.args));break;case"addSource":o.push(()=>this.addSource.apply(this,d.args));break;case"removeSource":o.push(()=>this.removeSource.apply(this,d.args));break;case"setLayerZoomRange":o.push(()=>this.setLayerZoomRange.apply(this,d.args));break;case"setLight":o.push(()=>this.setLight.apply(this,d.args));break;case"setGeoJSONSourceData":o.push(()=>this.setGeoJSONSourceData.apply(this,d.args));break;case"setGlyphs":o.push(()=>this.setGlyphs.apply(this,d.args));break;case"setSprite":o.push(()=>this.setSprite.apply(this,d.args));break;case"setSky":o.push(()=>this.setSky.apply(this,d.args));break;case"setTerrain":o.push(()=>this.map.setTerrain.apply(this,d.args));break;case"setTransition":o.push(()=>{});break;default:u.push(d.command)}return{operations:o,unimplemented:u}}addImage(e,o){if(this.getImage(e))return this.fire(new h.j(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,o),this._afterImageUpdated(e)}updateImage(e,o){this.imageManager.updateImage(e,o)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new h.j(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new h.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,o,u={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw new Error(`Source "${e}" already exists.`);if(!o.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(o).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(o.type)>=0&&this._validate(h.u.source,`sources.${e}`,o,null,u))return;this.map&&this.map._collectResourceTiming&&(o.collectResourceTiming=!0);const d=this.sourceCaches[e]=new rt(e,o,this.dispatcher);d.style=this,d.setEventedParent(this,()=>({isSourceLoaded:d.loaded(),source:d.serialize(),sourceId:e})),d.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID");for(const u in this._layers)if(this._layers[u].source===e)return this.fire(new h.j(new Error(`Source "${e}" cannot be removed while layer "${u}" is using it.`)));const o=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],o.fire(new h.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),o.setEventedParent(null),o.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,o){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error(`There is no source with this ID=${e}`);const u=this.sourceCaches[e].getSource();if(u.type!=="geojson")throw new Error(`geojsonSource.type is ${u.type}, which is !== 'geojson`);u.setData(o),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,o,u={}){this._checkLoaded();const d=e.id;if(this.getLayer(d))return void this.fire(new h.j(new Error(`Layer "${d}" already exists on this map.`)));let y;if(e.type==="custom"){if(Fr(this,h.aD(e)))return;y=h.aA(e)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(d,e.source),e=h.aB(e),e=h.e(e,{source:d})),this._validate(h.u.layer,`layers.${d}`,e,{arrayIndex:-1},u))return;y=h.aA(e),this._validateLayer(y),y.setEventedParent(this,{layer:{id:d}})}const w=o?this._order.indexOf(o):this._order.length;if(o&&w===-1)this.fire(new h.j(new Error(`Cannot add layer "${d}" before non-existing layer "${o}".`)));else{if(this._order.splice(w,0,d),this._layerOrderChanged=!0,this._layers[d]=y,this._removedLayers[d]&&y.source&&y.type!=="custom"){const C=this._removedLayers[d];delete this._removedLayers[d],C.type!==y.type?this._updatedSources[y.source]="clear":(this._updatedSources[y.source]="reload",this.sourceCaches[y.source].pause())}this._updateLayer(y),y.onAdd&&y.onAdd(this.map)}}moveLayer(e,o){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new h.j(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===o)return;const u=this._order.indexOf(e);this._order.splice(u,1);const d=o?this._order.indexOf(o):this._order.length;o&&d===-1?this.fire(new h.j(new Error(`Cannot move layer "${e}" before non-existing layer "${o}".`))):(this._order.splice(d,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const o=this._layers[e];if(!o)return void this.fire(new h.j(new Error(`Cannot remove non-existing layer "${e}".`)));o.setEventedParent(null);const u=this._order.indexOf(e);this._order.splice(u,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=o,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],o.onRemove&&o.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,o,u){this._checkLoaded();const d=this.getLayer(e);d?d.minzoom===o&&d.maxzoom===u||(o!=null&&(d.minzoom=o),u!=null&&(d.maxzoom=u),this._updateLayer(d)):this.fire(new h.j(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,o,u={}){this._checkLoaded();const d=this.getLayer(e);if(d){if(!h.aE(d.filter,o))return o==null?(d.filter=void 0,void this._updateLayer(d)):void(this._validate(h.u.filter,`layers.${d.id}.filter`,o,null,u)||(d.filter=h.aB(o),this._updateLayer(d)))}else this.fire(new h.j(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return h.aB(this.getLayer(e).filter)}setLayoutProperty(e,o,u,d={}){this._checkLoaded();const y=this.getLayer(e);y?h.aE(y.getLayoutProperty(o),u)||(y.setLayoutProperty(o,u,d),this._updateLayer(y)):this.fire(new h.j(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,o){const u=this.getLayer(e);if(u)return u.getLayoutProperty(o);this.fire(new h.j(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,o,u,d={}){this._checkLoaded();const y=this.getLayer(e);y?h.aE(y.getPaintProperty(o),u)||(y.setPaintProperty(o,u,d)&&this._updateLayer(y),this._changed=!0,this._updatedPaintProps[e]=!0,this._serializedLayers=null):this.fire(new h.j(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(e,o){return this.getLayer(e).getPaintProperty(o)}setFeatureState(e,o){this._checkLoaded();const u=e.source,d=e.sourceLayer,y=this.sourceCaches[u];if(y===void 0)return void this.fire(new h.j(new Error(`The source '${u}' does not exist in the map's style.`)));const w=y.getSource().type;w==="geojson"&&d?this.fire(new h.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):w!=="vector"||d?(e.id===void 0&&this.fire(new h.j(new Error("The feature id parameter must be provided."))),y.setFeatureState(d,e.id,o)):this.fire(new h.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,o){this._checkLoaded();const u=e.source,d=this.sourceCaches[u];if(d===void 0)return void this.fire(new h.j(new Error(`The source '${u}' does not exist in the map's style.`)));const y=d.getSource().type,w=y==="vector"?e.sourceLayer:void 0;y!=="vector"||w?o&&typeof e.id!="string"&&typeof e.id!="number"?this.fire(new h.j(new Error("A feature id is required to remove its specific state property."))):d.removeFeatureState(w,e.id,o):this.fire(new h.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const o=e.source,u=e.sourceLayer,d=this.sourceCaches[o];if(d!==void 0)return d.getSource().type!=="vector"||u?(e.id===void 0&&this.fire(new h.j(new Error("The feature id parameter must be provided."))),d.getFeatureState(u,e.id)):void this.fire(new h.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new h.j(new Error(`The source '${o}' does not exist in the map's style.`)))}getTransition(){return h.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const e=h.aF(this.sourceCaches,y=>y.serialize()),o=this._serializeByIds(this._order,!0),u=this.map.getTerrain()||void 0,d=this.stylesheet;return h.aG({version:d.version,name:d.name,metadata:d.metadata,light:d.light,sky:d.sky,center:d.center,zoom:d.zoom,bearing:d.bearing,pitch:d.pitch,sprite:d.sprite,glyphs:d.glyphs,transition:d.transition,sources:e,layers:o,terrain:u},y=>y!==void 0)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.sourceCaches[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){const o=w=>this._layers[w].type==="fill-extrusion",u={},d=[];for(let w=this._order.length-1;w>=0;w--){const C=this._order[w];if(o(C)){u[C]=w;for(const S of e){const T=S[C];if(T)for(const z of T)d.push(z)}}}d.sort((w,C)=>C.intersectionZ-w.intersectionZ);const y=[];for(let w=this._order.length-1;w>=0;w--){const C=this._order[w];if(o(C))for(let S=d.length-1;S>=0;S--){const T=d[S].feature;if(u[T.layer.id]{const Ie=ee.featureSortOrder;if(Ie){const ke=Ie.indexOf(de.featureIndex);return Ie.indexOf(xe.featureIndex)-ke}return xe.featureIndex-de.featureIndex});for(const de of ae)se.push(de)}}for(const ee in G)G[ee].forEach(ie=>{const X=ie.feature,se=T[C[ee].source].getFeatureState(X.layer["source-layer"],X.id);X.source=X.layer.source,X.layer["source-layer"]&&(X.sourceLayer=X.layer["source-layer"]),X.state=se});return G}(this._layers,w,this.sourceCaches,e,o,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(y)}querySourceFeatures(e,o){o&&o.filter&&this._validate(h.u.filter,"querySourceFeatures.filter",o.filter,null,o);const u=this.sourceCaches[e];return u?function(d,y){const w=d.getRenderableIds().map(T=>d.getTileByID(T)),C=[],S={};for(let T=0;TN.getTileByID(q)).sort((q,G)=>G.tileID.overscaledZ-q.tileID.overscaledZ||(q.tileID.isLessThan(G.tileID)?-1:1))}const k=this.crossTileSymbolIndex.addLayer(z,S[z.source],e.center.lng);w=w||k}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((y=y||this._layerOrderChanged||u===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(B.now(),e.zoom))&&(this.pauseablePlacement=new uo(e,this.map.terrain,this._order,y,o,u,d,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,S),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(B.now()),C=!0),w&&this.pauseablePlacement.placement.setStale()),C||w)for(const T of this._order){const z=this._layers[T];z.type==="symbol"&&this.placement.updateLayerOpacities(z,S[z.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(B.now())}_releaseSymbolFadeTiles(){for(const e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,o){return h._(this,void 0,void 0,function*(){const u=yield this.imageManager.getImages(o.icons);this._updateTilesForChangedImages();const d=this.sourceCaches[o.source];return d&&d.setDependencies(o.tileID.key,o.type,o.icons),u})}getGlyphs(e,o){return h._(this,void 0,void 0,function*(){const u=yield this.glyphManager.getGlyphs(o.stacks),d=this.sourceCaches[o.source];return d&&d.setDependencies(o.tileID.key,o.type,[""]),u})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,o={}){this._checkLoaded(),e&&this._validate(h.u.glyphs,"glyphs",e,null,o)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,o,u={},d){this._checkLoaded();const y=[{id:e,url:o}],w=[...kt(this.stylesheet.sprite),...y];this._validate(h.u.sprite,"sprite",w,null,u)||(this.stylesheet.sprite=w,this._loadSprite(y,!0,d))}removeSprite(e){this._checkLoaded();const o=kt(this.stylesheet.sprite);if(o.find(u=>u.id===e)){if(this._spritesImagesIds[e])for(const u of this._spritesImagesIds[e])this.imageManager.removeImage(u),this._changedImages[u]=!0;o.splice(o.findIndex(u=>u.id===e),1),this.stylesheet.sprite=o.length>0?o:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new h.k("data",{dataType:"style"}))}else this.fire(new h.j(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return kt(this.stylesheet.sprite)}setSprite(e,o={},u){this._checkLoaded(),e&&this._validate(h.u.sprite,"sprite",e,null,o)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,u):(this._unloadSprite(),u&&u(null)))}}var Gn=h.Y([{name:"a_pos",type:"Int16",components:2}]);const En={prelude:Tt(`#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:Tt(`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:Tt(`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:Tt(`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:Tt("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:Tt(`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,get_elevation(floor(a_pos*0.5)),1);gl_Position=u_matrix*pos;}`),heatmapTexture:Tt(`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:Tt("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:Tt("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:Tt("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:Tt(`#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:Tt(`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:Tt(`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:Tt(`#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:Tt(`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:Tt(`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:Tt(`#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:Tt(`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:Tt(`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:Tt(`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:Tt(`#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:Tt(`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:Tt(`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:Tt(`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:Tt(`#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:Tt(`#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:Tt("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:Tt("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:Tt("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:Tt("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 Tt(_,e){const o=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,u=e.match(/attribute ([\w]+) ([\w]+)/g),d=_.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),y=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),w=y?y.concat(d):d,C={};return{fragmentSource:_=_.replace(o,(S,T,z,k,N)=>(C[N]=!0,T==="define"?` +#ifndef HAS_UNIFORM_u_${N} +varying ${z} ${k} ${N}; +#else +uniform ${z} ${k} u_${N}; +#endif +`:` +#ifdef HAS_UNIFORM_u_${N} + ${z} ${k} ${N} = u_${N}; +#endif +`)),vertexSource:e=e.replace(o,(S,T,z,k,N)=>{const q=k==="float"?"vec2":"vec4",G=N.match(/color/)?"color":q;return C[N]?T==="define"?` +#ifndef HAS_UNIFORM_u_${N} +uniform lowp float u_${N}_t; +attribute ${z} ${q} a_${N}; +varying ${z} ${k} ${N}; +#else +uniform ${z} ${k} u_${N}; +#endif +`:G==="vec4"?` +#ifndef HAS_UNIFORM_u_${N} + ${N} = a_${N}; +#else + ${z} ${k} ${N} = u_${N}; +#endif +`:` +#ifndef HAS_UNIFORM_u_${N} + ${N} = unpack_mix_${G}(a_${N}, u_${N}_t); +#else + ${z} ${k} ${N} = u_${N}; +#endif +`:T==="define"?` +#ifndef HAS_UNIFORM_u_${N} +uniform lowp float u_${N}_t; +attribute ${z} ${q} a_${N}; +#else +uniform ${z} ${k} u_${N}; +#endif +`:G==="vec4"?` +#ifndef HAS_UNIFORM_u_${N} + ${z} ${k} ${N} = a_${N}; +#else + ${z} ${k} ${N} = u_${N}; +#endif +`:` +#ifndef HAS_UNIFORM_u_${N} + ${z} ${k} ${N} = unpack_mix_${G}(a_${N}, u_${N}_t); +#else + ${z} ${k} ${N} = u_${N}; +#endif +`}),staticAttributes:u,staticUniforms:w}}class vl{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,o,u,d,y,w,C,S,T){this.context=e;let z=this.boundPaintVertexBuffers.length!==d.length;for(let k=0;!z&&k({u_matrix:_,u_texture:0,u_ele_delta:e,u_fog_matrix:o,u_fog_color:u?u.properties.get("fog-color"):h.aM.white,u_fog_ground_blend:u?u.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:u?u.calculateFogBlendOpacity(d):0,u_horizon_color:u?u.properties.get("horizon-color"):h.aM.white,u_horizon_fog_blend:u?u.properties.get("horizon-fog-blend"):1});function gs(_){const e=[];for(let o=0;o<_.length;o++){if(_[o]===null)continue;const u=_[o].split(" ");e.push(u.pop())}return e}class bl{constructor(e,o,u,d,y,w){const C=e.gl;this.program=C.createProgram();const S=gs(o.staticAttributes),T=u?u.getBinderAttributes():[],z=S.concat(T),k=En.prelude.staticUniforms?gs(En.prelude.staticUniforms):[],N=o.staticUniforms?gs(o.staticUniforms):[],q=u?u.getBinderUniforms():[],G=k.concat(N).concat(q),J=[];for(const de of G)J.indexOf(de)<0&&J.push(de);const Q=u?u.defines():[];y&&Q.push("#define OVERDRAW_INSPECTOR;"),w&&Q.push("#define TERRAIN3D;");const ee=Q.concat(En.prelude.fragmentSource,o.fragmentSource).join(` +`),ie=Q.concat(En.prelude.vertexSource,o.vertexSource).join(` +`),X=C.createShader(C.FRAGMENT_SHADER);if(C.isContextLost())return void(this.failedToCreate=!0);if(C.shaderSource(X,ee),C.compileShader(X),!C.getShaderParameter(X,C.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${C.getShaderInfoLog(X)}`);C.attachShader(this.program,X);const se=C.createShader(C.VERTEX_SHADER);if(C.isContextLost())return void(this.failedToCreate=!0);if(C.shaderSource(se,ie),C.compileShader(se),!C.getShaderParameter(se,C.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${C.getShaderInfoLog(se)}`);C.attachShader(this.program,se),this.attributes={};const ae={};this.numAttributes=z.length;for(let de=0;de({u_depth:new h.aH(de,xe.u_depth),u_terrain:new h.aH(de,xe.u_terrain),u_terrain_dim:new h.aI(de,xe.u_terrain_dim),u_terrain_matrix:new h.aJ(de,xe.u_terrain_matrix),u_terrain_unpack:new h.aK(de,xe.u_terrain_unpack),u_terrain_exaggeration:new h.aI(de,xe.u_terrain_exaggeration)}))(e,ae),this.binderUniforms=u?u.getUniforms(e,ae):[]}draw(e,o,u,d,y,w,C,S,T,z,k,N,q,G,J,Q,ee,ie){const X=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(u),e.setStencilMode(d),e.setColorMode(y),e.setCullFace(w),S){e.activeTexture.set(X.TEXTURE2),X.bindTexture(X.TEXTURE_2D,S.depthTexture),e.activeTexture.set(X.TEXTURE3),X.bindTexture(X.TEXTURE_2D,S.texture);for(const ae in this.terrainUniforms)this.terrainUniforms[ae].set(S[ae])}for(const ae in this.fixedUniforms)this.fixedUniforms[ae].set(C[ae]);J&&J.setUniforms(e,this.binderUniforms,q,{zoom:G});let se=0;switch(o){case X.LINES:se=2;break;case X.TRIANGLES:se=3;break;case X.LINE_STRIP:se=1}for(const ae of N.get()){const de=ae.vaos||(ae.vaos={});(de[T]||(de[T]=new vl)).bind(e,this,z,J?J.getPaintVertexBuffers():[],k,ae.vertexOffset,Q,ee,ie),X.drawElements(o,ae.primitiveLength*se,X.UNSIGNED_SHORT,ae.primitiveOffset*se*2)}}}function Qo(_,e,o){const u=1/gt(o,1,e.transform.tileZoom),d=Math.pow(2,o.tileID.overscaledZ),y=o.tileSize*Math.pow(2,e.transform.tileZoom)/d,w=y*(o.tileID.canonical.x+o.tileID.wrap*d),C=y*o.tileID.canonical.y;return{u_image:0,u_texsize:o.imageAtlasTexture.size,u_scale:[u,_.fromScale,_.toScale],u_fade:_.t,u_pixel_coord_upper:[w>>16,C>>16],u_pixel_coord_lower:[65535&w,65535&C]}}const po=(_,e,o,u)=>{const d=e.style.light,y=d.properties.get("position"),w=[y.x,y.y,y.z],C=function(){var T=new h.A(9);return h.A!=Float32Array&&(T[1]=0,T[2]=0,T[3]=0,T[5]=0,T[6]=0,T[7]=0),T[0]=1,T[4]=1,T[8]=1,T}();d.properties.get("anchor")==="viewport"&&function(T,z){var k=Math.sin(z),N=Math.cos(z);T[0]=N,T[1]=k,T[2]=0,T[3]=-k,T[4]=N,T[5]=0,T[6]=0,T[7]=0,T[8]=1}(C,-e.transform.angle),function(T,z,k){var N=z[0],q=z[1],G=z[2];T[0]=N*k[0]+q*k[3]+G*k[6],T[1]=N*k[1]+q*k[4]+G*k[7],T[2]=N*k[2]+q*k[5]+G*k[8]}(w,w,C);const S=d.properties.get("color");return{u_matrix:_,u_lightpos:w,u_lightintensity:d.properties.get("intensity"),u_lightcolor:[S.r,S.g,S.b],u_vertical_gradient:+o,u_opacity:u}},ea=(_,e,o,u,d,y,w)=>h.e(po(_,e,o,u),Qo(y,e,w),{u_height_factor:-Math.pow(2,d.overscaledZ)/w.tileSize/8}),ys=_=>({u_matrix:_}),rc=(_,e,o,u)=>h.e(ys(_),Qo(o,e,u)),Gu=(_,e)=>({u_matrix:_,u_world:e}),nc=(_,e,o,u,d)=>h.e(rc(_,e,o,u),{u_world:d}),Xu=(_,e,o,u)=>{const d=_.transform;let y,w;if(u.paint.get("circle-pitch-alignment")==="map"){const C=gt(o,1,d.zoom);y=!0,w=[C,C]}else y=!1,w=d.pixelsToGLUnits;return{u_camera_to_center_distance:d.cameraToCenterDistance,u_scale_with_map:+(u.paint.get("circle-pitch-scale")==="map"),u_matrix:_.translatePosMatrix(e.posMatrix,o,u.paint.get("circle-translate"),u.paint.get("circle-translate-anchor")),u_pitch_with_map:+y,u_device_pixel_ratio:_.pixelRatio,u_extrude_scale:w}},Xn=(_,e,o)=>({u_matrix:_,u_inv_matrix:e,u_camera_to_center_distance:o.cameraToCenterDistance,u_viewport_size:[o.width,o.height]}),fo=(_,e,o=1)=>({u_matrix:_,u_color:e,u_overlay:0,u_overlay_scale:o}),Wi=_=>({u_matrix:_}),Hi=(_,e,o,u)=>({u_matrix:_,u_extrude_scale:gt(e,1,o),u_intensity:u}),ta=(_,e,o,u)=>{const d=h.H();h.aP(d,0,_.width,_.height,0,0,1);const y=_.context.gl;return{u_matrix:d,u_world:[y.drawingBufferWidth,y.drawingBufferHeight],u_image:o,u_color_ramp:u,u_opacity:e.paint.get("heatmap-opacity")}};function ia(_,e){const o=Math.pow(2,e.canonical.z),u=e.canonical.y;return[new h.Z(0,u/o).toLngLat().lat,new h.Z(0,(u+1)/o).toLngLat().lat]}const ra=(_,e,o,u)=>{const d=_.transform;return{u_matrix:ac(_,e,o,u),u_ratio:1/gt(e,1,d.zoom),u_device_pixel_ratio:_.pixelRatio,u_units_to_pixels:[1/d.pixelsToGLUnits[0],1/d.pixelsToGLUnits[1]]}},sc=(_,e,o,u,d)=>h.e(ra(_,e,o,d),{u_image:0,u_image_height:u}),_s=(_,e,o,u,d)=>{const y=_.transform,w=oc(e,y);return{u_matrix:ac(_,e,o,d),u_texsize:e.imageAtlasTexture.size,u_ratio:1/gt(e,1,y.zoom),u_device_pixel_ratio:_.pixelRatio,u_image:0,u_scale:[w,u.fromScale,u.toScale],u_fade:u.t,u_units_to_pixels:[1/y.pixelsToGLUnits[0],1/y.pixelsToGLUnits[1]]}},Wu=(_,e,o,u,d,y)=>{const w=_.lineAtlas,C=oc(e,_.transform),S=o.layout.get("line-cap")==="round",T=w.getDash(u.from,S),z=w.getDash(u.to,S),k=T.width*d.fromScale,N=z.width*d.toScale;return h.e(ra(_,e,o,y),{u_patternscale_a:[C/k,-T.height/2],u_patternscale_b:[C/N,-z.height/2],u_sdfgamma:w.width/(256*Math.min(k,N)*_.pixelRatio)/2,u_image:0,u_tex_y_a:T.y,u_tex_y_b:z.y,u_mix:d.t})};function oc(_,e){return 1/gt(_,1,e.tileZoom)}function ac(_,e,o,u){return _.translatePosMatrix(u?u.posMatrix:e.tileID.posMatrix,e,o.paint.get("line-translate"),o.paint.get("line-translate-anchor"))}const Hu=(_,e,o,u,d)=>{return{u_matrix:_,u_tl_parent:e,u_scale_parent:o,u_buffer_scale:1,u_fade_t:u.mix,u_opacity:u.opacity*d.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:d.paint.get("raster-brightness-min"),u_brightness_high:d.paint.get("raster-brightness-max"),u_saturation_factor:(w=d.paint.get("raster-saturation"),w>0?1-1/(1.001-w):-w),u_contrast_factor:(y=d.paint.get("raster-contrast"),y>0?1/(1-y):1+y),u_spin_weights:Ju(d.paint.get("raster-hue-rotate"))};var y,w};function Ju(_){_*=Math.PI/180;const e=Math.sin(_),o=Math.cos(_);return[(2*o+1)/3,(-Math.sqrt(3)*e-o+1)/3,(Math.sqrt(3)*e-o+1)/3]}const lc=(_,e,o,u,d,y,w,C,S,T,z,k,N,q)=>{const G=w.transform;return{u_is_size_zoom_constant:+(_==="constant"||_==="source"),u_is_size_feature_constant:+(_==="constant"||_==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:G.cameraToCenterDistance,u_pitch:G.pitch/360*2*Math.PI,u_rotate_symbol:+o,u_aspect_ratio:G.width/G.height,u_fade_change:w.options.fadeDuration?w.symbolFadeChange:1,u_matrix:C,u_label_plane_matrix:S,u_coord_matrix:T,u_is_text:+k,u_pitch_with_map:+u,u_is_along_line:d,u_is_variable_anchor:y,u_texsize:N,u_texture:0,u_translation:z,u_pitched_scale:q}},mo=(_,e,o,u,d,y,w,C,S,T,z,k,N,q,G)=>{const J=w.transform;return h.e(lc(_,e,o,u,d,y,w,C,S,T,z,k,N,G),{u_gamma_scale:u?Math.cos(J._pitch)*J.cameraToCenterDistance:1,u_device_pixel_ratio:w.pixelRatio,u_is_halo:+q})},wl=(_,e,o,u,d,y,w,C,S,T,z,k,N,q)=>h.e(mo(_,e,o,u,d,y,w,C,S,T,z,!0,k,!0,q),{u_texsize_icon:N,u_texture_icon:1}),na=(_,e,o)=>({u_matrix:_,u_opacity:e,u_color:o}),Il=(_,e,o,u,d,y)=>h.e(function(w,C,S,T){const z=S.imageManager.getPattern(w.from.toString()),k=S.imageManager.getPattern(w.to.toString()),{width:N,height:q}=S.imageManager.getPixelSize(),G=Math.pow(2,T.tileID.overscaledZ),J=T.tileSize*Math.pow(2,S.transform.tileZoom)/G,Q=J*(T.tileID.canonical.x+T.tileID.wrap*G),ee=J*T.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:z.tl,u_pattern_br_a:z.br,u_pattern_tl_b:k.tl,u_pattern_br_b:k.br,u_texsize:[N,q],u_mix:C.t,u_pattern_size_a:z.displaySize,u_pattern_size_b:k.displaySize,u_scale_a:C.fromScale,u_scale_b:C.toScale,u_tile_units_to_pixels:1/gt(T,1,S.transform.tileZoom),u_pixel_coord_upper:[Q>>16,ee>>16],u_pixel_coord_lower:[65535&Q,65535&ee]}}(u,y,o,d),{u_matrix:_,u_opacity:e}),Cl={fillExtrusion:(_,e)=>({u_matrix:new h.aJ(_,e.u_matrix),u_lightpos:new h.aN(_,e.u_lightpos),u_lightintensity:new h.aI(_,e.u_lightintensity),u_lightcolor:new h.aN(_,e.u_lightcolor),u_vertical_gradient:new h.aI(_,e.u_vertical_gradient),u_opacity:new h.aI(_,e.u_opacity)}),fillExtrusionPattern:(_,e)=>({u_matrix:new h.aJ(_,e.u_matrix),u_lightpos:new h.aN(_,e.u_lightpos),u_lightintensity:new h.aI(_,e.u_lightintensity),u_lightcolor:new h.aN(_,e.u_lightcolor),u_vertical_gradient:new h.aI(_,e.u_vertical_gradient),u_height_factor:new h.aI(_,e.u_height_factor),u_image:new h.aH(_,e.u_image),u_texsize:new h.aO(_,e.u_texsize),u_pixel_coord_upper:new h.aO(_,e.u_pixel_coord_upper),u_pixel_coord_lower:new h.aO(_,e.u_pixel_coord_lower),u_scale:new h.aN(_,e.u_scale),u_fade:new h.aI(_,e.u_fade),u_opacity:new h.aI(_,e.u_opacity)}),fill:(_,e)=>({u_matrix:new h.aJ(_,e.u_matrix)}),fillPattern:(_,e)=>({u_matrix:new h.aJ(_,e.u_matrix),u_image:new h.aH(_,e.u_image),u_texsize:new h.aO(_,e.u_texsize),u_pixel_coord_upper:new h.aO(_,e.u_pixel_coord_upper),u_pixel_coord_lower:new h.aO(_,e.u_pixel_coord_lower),u_scale:new h.aN(_,e.u_scale),u_fade:new h.aI(_,e.u_fade)}),fillOutline:(_,e)=>({u_matrix:new h.aJ(_,e.u_matrix),u_world:new h.aO(_,e.u_world)}),fillOutlinePattern:(_,e)=>({u_matrix:new h.aJ(_,e.u_matrix),u_world:new h.aO(_,e.u_world),u_image:new h.aH(_,e.u_image),u_texsize:new h.aO(_,e.u_texsize),u_pixel_coord_upper:new h.aO(_,e.u_pixel_coord_upper),u_pixel_coord_lower:new h.aO(_,e.u_pixel_coord_lower),u_scale:new h.aN(_,e.u_scale),u_fade:new h.aI(_,e.u_fade)}),circle:(_,e)=>({u_camera_to_center_distance:new h.aI(_,e.u_camera_to_center_distance),u_scale_with_map:new h.aH(_,e.u_scale_with_map),u_pitch_with_map:new h.aH(_,e.u_pitch_with_map),u_extrude_scale:new h.aO(_,e.u_extrude_scale),u_device_pixel_ratio:new h.aI(_,e.u_device_pixel_ratio),u_matrix:new h.aJ(_,e.u_matrix)}),collisionBox:(_,e)=>({u_matrix:new h.aJ(_,e.u_matrix),u_pixel_extrude_scale:new h.aO(_,e.u_pixel_extrude_scale)}),collisionCircle:(_,e)=>({u_matrix:new h.aJ(_,e.u_matrix),u_inv_matrix:new h.aJ(_,e.u_inv_matrix),u_camera_to_center_distance:new h.aI(_,e.u_camera_to_center_distance),u_viewport_size:new h.aO(_,e.u_viewport_size)}),debug:(_,e)=>({u_color:new h.aL(_,e.u_color),u_matrix:new h.aJ(_,e.u_matrix),u_overlay:new h.aH(_,e.u_overlay),u_overlay_scale:new h.aI(_,e.u_overlay_scale)}),clippingMask:(_,e)=>({u_matrix:new h.aJ(_,e.u_matrix)}),heatmap:(_,e)=>({u_extrude_scale:new h.aI(_,e.u_extrude_scale),u_intensity:new h.aI(_,e.u_intensity),u_matrix:new h.aJ(_,e.u_matrix)}),heatmapTexture:(_,e)=>({u_matrix:new h.aJ(_,e.u_matrix),u_world:new h.aO(_,e.u_world),u_image:new h.aH(_,e.u_image),u_color_ramp:new h.aH(_,e.u_color_ramp),u_opacity:new h.aI(_,e.u_opacity)}),hillshade:(_,e)=>({u_matrix:new h.aJ(_,e.u_matrix),u_image:new h.aH(_,e.u_image),u_latrange:new h.aO(_,e.u_latrange),u_light:new h.aO(_,e.u_light),u_shadow:new h.aL(_,e.u_shadow),u_highlight:new h.aL(_,e.u_highlight),u_accent:new h.aL(_,e.u_accent)}),hillshadePrepare:(_,e)=>({u_matrix:new h.aJ(_,e.u_matrix),u_image:new h.aH(_,e.u_image),u_dimension:new h.aO(_,e.u_dimension),u_zoom:new h.aI(_,e.u_zoom),u_unpack:new h.aK(_,e.u_unpack)}),line:(_,e)=>({u_matrix:new h.aJ(_,e.u_matrix),u_ratio:new h.aI(_,e.u_ratio),u_device_pixel_ratio:new h.aI(_,e.u_device_pixel_ratio),u_units_to_pixels:new h.aO(_,e.u_units_to_pixels)}),lineGradient:(_,e)=>({u_matrix:new h.aJ(_,e.u_matrix),u_ratio:new h.aI(_,e.u_ratio),u_device_pixel_ratio:new h.aI(_,e.u_device_pixel_ratio),u_units_to_pixels:new h.aO(_,e.u_units_to_pixels),u_image:new h.aH(_,e.u_image),u_image_height:new h.aI(_,e.u_image_height)}),linePattern:(_,e)=>({u_matrix:new h.aJ(_,e.u_matrix),u_texsize:new h.aO(_,e.u_texsize),u_ratio:new h.aI(_,e.u_ratio),u_device_pixel_ratio:new h.aI(_,e.u_device_pixel_ratio),u_image:new h.aH(_,e.u_image),u_units_to_pixels:new h.aO(_,e.u_units_to_pixels),u_scale:new h.aN(_,e.u_scale),u_fade:new h.aI(_,e.u_fade)}),lineSDF:(_,e)=>({u_matrix:new h.aJ(_,e.u_matrix),u_ratio:new h.aI(_,e.u_ratio),u_device_pixel_ratio:new h.aI(_,e.u_device_pixel_ratio),u_units_to_pixels:new h.aO(_,e.u_units_to_pixels),u_patternscale_a:new h.aO(_,e.u_patternscale_a),u_patternscale_b:new h.aO(_,e.u_patternscale_b),u_sdfgamma:new h.aI(_,e.u_sdfgamma),u_image:new h.aH(_,e.u_image),u_tex_y_a:new h.aI(_,e.u_tex_y_a),u_tex_y_b:new h.aI(_,e.u_tex_y_b),u_mix:new h.aI(_,e.u_mix)}),raster:(_,e)=>({u_matrix:new h.aJ(_,e.u_matrix),u_tl_parent:new h.aO(_,e.u_tl_parent),u_scale_parent:new h.aI(_,e.u_scale_parent),u_buffer_scale:new h.aI(_,e.u_buffer_scale),u_fade_t:new h.aI(_,e.u_fade_t),u_opacity:new h.aI(_,e.u_opacity),u_image0:new h.aH(_,e.u_image0),u_image1:new h.aH(_,e.u_image1),u_brightness_low:new h.aI(_,e.u_brightness_low),u_brightness_high:new h.aI(_,e.u_brightness_high),u_saturation_factor:new h.aI(_,e.u_saturation_factor),u_contrast_factor:new h.aI(_,e.u_contrast_factor),u_spin_weights:new h.aN(_,e.u_spin_weights)}),symbolIcon:(_,e)=>({u_is_size_zoom_constant:new h.aH(_,e.u_is_size_zoom_constant),u_is_size_feature_constant:new h.aH(_,e.u_is_size_feature_constant),u_size_t:new h.aI(_,e.u_size_t),u_size:new h.aI(_,e.u_size),u_camera_to_center_distance:new h.aI(_,e.u_camera_to_center_distance),u_pitch:new h.aI(_,e.u_pitch),u_rotate_symbol:new h.aH(_,e.u_rotate_symbol),u_aspect_ratio:new h.aI(_,e.u_aspect_ratio),u_fade_change:new h.aI(_,e.u_fade_change),u_matrix:new h.aJ(_,e.u_matrix),u_label_plane_matrix:new h.aJ(_,e.u_label_plane_matrix),u_coord_matrix:new h.aJ(_,e.u_coord_matrix),u_is_text:new h.aH(_,e.u_is_text),u_pitch_with_map:new h.aH(_,e.u_pitch_with_map),u_is_along_line:new h.aH(_,e.u_is_along_line),u_is_variable_anchor:new h.aH(_,e.u_is_variable_anchor),u_texsize:new h.aO(_,e.u_texsize),u_texture:new h.aH(_,e.u_texture),u_translation:new h.aO(_,e.u_translation),u_pitched_scale:new h.aI(_,e.u_pitched_scale)}),symbolSDF:(_,e)=>({u_is_size_zoom_constant:new h.aH(_,e.u_is_size_zoom_constant),u_is_size_feature_constant:new h.aH(_,e.u_is_size_feature_constant),u_size_t:new h.aI(_,e.u_size_t),u_size:new h.aI(_,e.u_size),u_camera_to_center_distance:new h.aI(_,e.u_camera_to_center_distance),u_pitch:new h.aI(_,e.u_pitch),u_rotate_symbol:new h.aH(_,e.u_rotate_symbol),u_aspect_ratio:new h.aI(_,e.u_aspect_ratio),u_fade_change:new h.aI(_,e.u_fade_change),u_matrix:new h.aJ(_,e.u_matrix),u_label_plane_matrix:new h.aJ(_,e.u_label_plane_matrix),u_coord_matrix:new h.aJ(_,e.u_coord_matrix),u_is_text:new h.aH(_,e.u_is_text),u_pitch_with_map:new h.aH(_,e.u_pitch_with_map),u_is_along_line:new h.aH(_,e.u_is_along_line),u_is_variable_anchor:new h.aH(_,e.u_is_variable_anchor),u_texsize:new h.aO(_,e.u_texsize),u_texture:new h.aH(_,e.u_texture),u_gamma_scale:new h.aI(_,e.u_gamma_scale),u_device_pixel_ratio:new h.aI(_,e.u_device_pixel_ratio),u_is_halo:new h.aH(_,e.u_is_halo),u_translation:new h.aO(_,e.u_translation),u_pitched_scale:new h.aI(_,e.u_pitched_scale)}),symbolTextAndIcon:(_,e)=>({u_is_size_zoom_constant:new h.aH(_,e.u_is_size_zoom_constant),u_is_size_feature_constant:new h.aH(_,e.u_is_size_feature_constant),u_size_t:new h.aI(_,e.u_size_t),u_size:new h.aI(_,e.u_size),u_camera_to_center_distance:new h.aI(_,e.u_camera_to_center_distance),u_pitch:new h.aI(_,e.u_pitch),u_rotate_symbol:new h.aH(_,e.u_rotate_symbol),u_aspect_ratio:new h.aI(_,e.u_aspect_ratio),u_fade_change:new h.aI(_,e.u_fade_change),u_matrix:new h.aJ(_,e.u_matrix),u_label_plane_matrix:new h.aJ(_,e.u_label_plane_matrix),u_coord_matrix:new h.aJ(_,e.u_coord_matrix),u_is_text:new h.aH(_,e.u_is_text),u_pitch_with_map:new h.aH(_,e.u_pitch_with_map),u_is_along_line:new h.aH(_,e.u_is_along_line),u_is_variable_anchor:new h.aH(_,e.u_is_variable_anchor),u_texsize:new h.aO(_,e.u_texsize),u_texsize_icon:new h.aO(_,e.u_texsize_icon),u_texture:new h.aH(_,e.u_texture),u_texture_icon:new h.aH(_,e.u_texture_icon),u_gamma_scale:new h.aI(_,e.u_gamma_scale),u_device_pixel_ratio:new h.aI(_,e.u_device_pixel_ratio),u_is_halo:new h.aH(_,e.u_is_halo),u_translation:new h.aO(_,e.u_translation),u_pitched_scale:new h.aI(_,e.u_pitched_scale)}),background:(_,e)=>({u_matrix:new h.aJ(_,e.u_matrix),u_opacity:new h.aI(_,e.u_opacity),u_color:new h.aL(_,e.u_color)}),backgroundPattern:(_,e)=>({u_matrix:new h.aJ(_,e.u_matrix),u_opacity:new h.aI(_,e.u_opacity),u_image:new h.aH(_,e.u_image),u_pattern_tl_a:new h.aO(_,e.u_pattern_tl_a),u_pattern_br_a:new h.aO(_,e.u_pattern_br_a),u_pattern_tl_b:new h.aO(_,e.u_pattern_tl_b),u_pattern_br_b:new h.aO(_,e.u_pattern_br_b),u_texsize:new h.aO(_,e.u_texsize),u_mix:new h.aI(_,e.u_mix),u_pattern_size_a:new h.aO(_,e.u_pattern_size_a),u_pattern_size_b:new h.aO(_,e.u_pattern_size_b),u_scale_a:new h.aI(_,e.u_scale_a),u_scale_b:new h.aI(_,e.u_scale_b),u_pixel_coord_upper:new h.aO(_,e.u_pixel_coord_upper),u_pixel_coord_lower:new h.aO(_,e.u_pixel_coord_lower),u_tile_units_to_pixels:new h.aI(_,e.u_tile_units_to_pixels)}),terrain:(_,e)=>({u_matrix:new h.aJ(_,e.u_matrix),u_texture:new h.aH(_,e.u_texture),u_ele_delta:new h.aI(_,e.u_ele_delta),u_fog_matrix:new h.aJ(_,e.u_fog_matrix),u_fog_color:new h.aL(_,e.u_fog_color),u_fog_ground_blend:new h.aI(_,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new h.aI(_,e.u_fog_ground_blend_opacity),u_horizon_color:new h.aL(_,e.u_horizon_color),u_horizon_fog_blend:new h.aI(_,e.u_horizon_fog_blend)}),terrainDepth:(_,e)=>({u_matrix:new h.aJ(_,e.u_matrix),u_ele_delta:new h.aI(_,e.u_ele_delta)}),terrainCoords:(_,e)=>({u_matrix:new h.aJ(_,e.u_matrix),u_texture:new h.aH(_,e.u_texture),u_terrain_coords_id:new h.aI(_,e.u_terrain_coords_id),u_ele_delta:new h.aI(_,e.u_ele_delta)}),sky:(_,e)=>({u_sky_color:new h.aL(_,e.u_sky_color),u_horizon_color:new h.aL(_,e.u_horizon_color),u_horizon:new h.aI(_,e.u_horizon),u_sky_horizon_blend:new h.aI(_,e.u_sky_horizon_blend)})};class tn{constructor(e,o,u){this.context=e;const d=e.gl;this.buffer=d.createBuffer(),this.dynamicDraw=!!u,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?d.DYNAMIC_DRAW:d.STATIC_DRAW),this.dynamicDraw||delete o.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){const o=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),o.bufferSubData(o.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ku={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Sl{constructor(e,o,u,d){this.length=o.length,this.attributes=u,this.itemSize=o.bytesPerElement,this.dynamicDraw=d,this.context=e;const y=e.gl;this.buffer=y.createBuffer(),e.bindVertexBuffer.set(this.buffer),y.bufferData(y.ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?y.DYNAMIC_DRAW:y.STATIC_DRAW),this.dynamicDraw||delete o.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);const o=this.context.gl;this.bind(),o.bufferSubData(o.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,o){for(let u=0;u0){const de=h.H();h.aQ(de,X.placementInvProjMatrix,_.transform.glCoordMatrix),h.aQ(de,de,X.placementViewportMatrix),S.push({circleArray:ae,circleOffset:z,transform:ie.posMatrix,invTransform:de,coord:ie}),T+=ae.length/4,z=T}se&&C.draw(y,w.LINES,mt.disabled,Gt.disabled,_.colorModeForRenderPass(),Ot.disabled,{u_matrix:ie.posMatrix,u_pixel_extrude_scale:[1/(k=_.transform).width,1/k.height]},_.style.map.terrain&&_.style.map.terrain.getTerrainData(ie),o.id,se.layoutVertexBuffer,se.indexBuffer,se.segments,null,_.transform.zoom,null,null,se.collisionVertexBuffer)}var k;if(!d||!S.length)return;const N=_.useProgram("collisionCircle"),q=new h.aR;q.resize(4*T),q._trim();let G=0;for(const ee of S)for(let ie=0;ie=0&&(ee[X.associatedIconIndex]={shiftedAnchor:st,angle:Kt})}else Qe(X.numGlyphs,J)}if(T){Q.clear();const ie=_.icon.placedSymbolArray;for(let X=0;X_.style.map.terrain.getElevation(Ee,Os,Vs):null,rs=o.layout.get("text-rotation-alignment")==="map";Z(Ze,Ee.posMatrix,_,d,Fs,Rs,ee,T,rs,J,Ee.toUnwrapped(),G.width,G.height,Cr,xt)}const Sr=Ee.posMatrix,Mr=d&&Ie||sh,An=ie||Mr?_o:Fs,Nr=Ea,Pi=Le&&o.paint.get(d?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Li;Li=Le?Ze.iconsInText?wl(st.kind,yt,X,ee,ie,Mr,_,Sr,An,Nr,Cr,ki,Ui,Fe):mo(st.kind,yt,X,ee,ie,Mr,_,Sr,An,Nr,Cr,d,ki,!0,Fe):lc(st.kind,yt,X,ee,ie,Mr,_,Sr,An,Nr,Cr,d,ki,Fe);const ur={program:dt,buffers:at,uniformValues:Li,atlasTexture:Vr,atlasTextureIcon:Di,atlasInterpolation:Qt,atlasInterpolationIcon:Ji,isSDF:Le,hasHalo:Pi};if(ae&&Ze.canOverlap){de=!0;const xt=at.segments.get();for(const rs of xt)ke.push({segments:new h.a0([rs]),sortKey:rs.sortKey,state:ur,terrainData:Yt})}else ke.push({segments:at.segments,sortKey:0,state:ur,terrainData:Yt})}de&&ke.sort((Ee,Pe)=>Ee.sortKey-Pe.sortKey);for(const Ee of ke){const Pe=Ee.state;if(N.activeTexture.set(q.TEXTURE0),Pe.atlasTexture.bind(Pe.atlasInterpolation,q.CLAMP_TO_EDGE),Pe.atlasTextureIcon&&(N.activeTexture.set(q.TEXTURE1),Pe.atlasTextureIcon&&Pe.atlasTextureIcon.bind(Pe.atlasInterpolationIcon,q.CLAMP_TO_EDGE)),Pe.isSDF){const Ze=Pe.uniformValues;Pe.hasHalo&&(Ze.u_is_halo=1,Bl(Pe.buffers,Ee.segments,o,_,Pe.program,xe,z,k,Ze,Ee.terrainData)),Ze.u_is_halo=0}Bl(Pe.buffers,Ee.segments,o,_,Pe.program,xe,z,k,Pe.uniformValues,Ee.terrainData)}}function Bl(_,e,o,u,d,y,w,C,S,T){const z=u.context;d.draw(z,z.gl.TRIANGLES,y,w,C,Ot.disabled,S,T,o.id,_.layoutVertexBuffer,_.indexBuffer,e,o.paint,u.transform.zoom,_.programConfigurations.get(o.id),_.dynamicLayoutVertexBuffer,_.opacityVertexBuffer)}function Fl(_,e,o,u){const d=_.context,y=d.gl,w=Gt.disabled,C=new ai([y.ONE,y.ONE],h.aM.transparent,[!0,!0,!0,!0]),S=e.getBucket(o);if(!S)return;const T=u.key;let z=o.heatmapFbos.get(T);z||(z=vo(d,e.tileSize,e.tileSize),o.heatmapFbos.set(T,z)),d.bindFramebuffer.set(z.framebuffer),d.viewport.set([0,0,e.tileSize,e.tileSize]),d.clear({color:h.aM.transparent});const k=S.programConfigurations.get(o.id),N=_.useProgram("heatmap",k),q=_.style.map.terrain.getTerrainData(u);N.draw(d,y.TRIANGLES,mt.disabled,w,C,Ot.disabled,Hi(u.posMatrix,e,_.transform.zoom,o.paint.get("heatmap-intensity")),q,o.id,S.layoutVertexBuffer,S.indexBuffer,S.segments,o.paint,_.transform.zoom,k)}function Qn(_,e,o){const u=_.context,d=u.gl;u.setColorMode(_.colorModeForRenderPass());const y=xo(u,e),w=o.key,C=e.heatmapFbos.get(w);C&&(u.activeTexture.set(d.TEXTURE0),d.bindTexture(d.TEXTURE_2D,C.colorAttachment.get()),u.activeTexture.set(d.TEXTURE1),y.bind(d.LINEAR,d.CLAMP_TO_EDGE),_.useProgram("heatmapTexture").draw(u,d.TRIANGLES,mt.disabled,Gt.disabled,_.colorModeForRenderPass(),Ot.disabled,ta(_,e,0,1),null,e.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments,e.paint,_.transform.zoom),C.destroy(),e.heatmapFbos.delete(w))}function vo(_,e,o){var u,d;const y=_.gl,w=y.createTexture();y.bindTexture(y.TEXTURE_2D,w),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_S,y.CLAMP_TO_EDGE),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_T,y.CLAMP_TO_EDGE),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MIN_FILTER,y.LINEAR),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MAG_FILTER,y.LINEAR);const C=(u=_.HALF_FLOAT)!==null&&u!==void 0?u:y.UNSIGNED_BYTE,S=(d=_.RGBA16F)!==null&&d!==void 0?d:y.RGBA;y.texImage2D(y.TEXTURE_2D,0,S,e,o,0,y.RGBA,C,null);const T=_.createFramebuffer(e,o,!1,!1);return T.colorAttachment.set(w),T}function xo(_,e){return e.colorRampTexture||(e.colorRampTexture=new Ye(_,e.colorRamp,_.gl.RGBA)),e.colorRampTexture}function bs(_,e,o,u,d){if(!o||!u||!u.imageAtlas)return;const y=u.imageAtlas.patternPositions;let w=y[o.to.toString()],C=y[o.from.toString()];if(!w&&C&&(w=C),!C&&w&&(C=w),!w||!C){const S=d.getPaintProperty(e);w=y[S],C=y[S]}w&&C&&_.setConstantPatternPositions(w,C)}function bo(_,e,o,u,d,y,w){const C=_.context.gl,S="fill-pattern",T=o.paint.get(S),z=T&&T.constantOr(1),k=o.getCrossfadeParameters();let N,q,G,J,Q;w?(q=z&&!o.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",N=C.LINES):(q=z?"fillPattern":"fill",N=C.TRIANGLES);const ee=T.constantOr(null);for(const ie of u){const X=e.getTile(ie);if(z&&!X.patternsLoaded())continue;const se=X.getBucket(o);if(!se)continue;const ae=se.programConfigurations.get(o.id),de=_.useProgram(q,ae),xe=_.style.map.terrain&&_.style.map.terrain.getTerrainData(ie);z&&(_.context.activeTexture.set(C.TEXTURE0),X.imageAtlasTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),ae.updatePaintBuffers(k)),bs(ae,S,ee,X,o);const Ie=xe?ie:null,ke=_.translatePosMatrix(Ie?Ie.posMatrix:ie.posMatrix,X,o.paint.get("fill-translate"),o.paint.get("fill-translate-anchor"));if(w){J=se.indexBuffer2,Q=se.segments2;const Fe=[C.drawingBufferWidth,C.drawingBufferHeight];G=q==="fillOutlinePattern"&&z?nc(ke,_,k,X,Fe):Gu(ke,Fe)}else J=se.indexBuffer,Q=se.segments,G=z?rc(ke,_,k,X):ys(ke);de.draw(_.context,N,d,_.stencilModeForClipping(ie),y,Ot.disabled,G,xe,o.id,se.layoutVertexBuffer,J,Q,o.paint,_.transform.zoom,ae)}}function ca(_,e,o,u,d,y,w){const C=_.context,S=C.gl,T="fill-extrusion-pattern",z=o.paint.get(T),k=z.constantOr(1),N=o.getCrossfadeParameters(),q=o.paint.get("fill-extrusion-opacity"),G=z.constantOr(null);for(const J of u){const Q=e.getTile(J),ee=Q.getBucket(o);if(!ee)continue;const ie=_.style.map.terrain&&_.style.map.terrain.getTerrainData(J),X=ee.programConfigurations.get(o.id),se=_.useProgram(k?"fillExtrusionPattern":"fillExtrusion",X);k&&(_.context.activeTexture.set(S.TEXTURE0),Q.imageAtlasTexture.bind(S.LINEAR,S.CLAMP_TO_EDGE),X.updatePaintBuffers(N)),bs(X,T,G,Q,o);const ae=_.translatePosMatrix(J.posMatrix,Q,o.paint.get("fill-extrusion-translate"),o.paint.get("fill-extrusion-translate-anchor")),de=o.paint.get("fill-extrusion-vertical-gradient"),xe=k?ea(ae,_,de,q,J,N,Q):po(ae,_,de,q);se.draw(C,C.gl.TRIANGLES,d,y,w,Ot.backCCW,xe,ie,o.id,ee.layoutVertexBuffer,ee.indexBuffer,ee.segments,o.paint,_.transform.zoom,X,_.style.map.terrain&&ee.centroidVertexBuffer)}}function ws(_,e,o,u,d,y,w){const C=_.context,S=C.gl,T=o.fbo;if(!T)return;const z=_.useProgram("hillshade"),k=_.style.map.terrain&&_.style.map.terrain.getTerrainData(e);C.activeTexture.set(S.TEXTURE0),S.bindTexture(S.TEXTURE_2D,T.colorAttachment.get()),z.draw(C,S.TRIANGLES,d,y,w,Ot.disabled,((N,q,G,J)=>{const Q=G.paint.get("hillshade-shadow-color"),ee=G.paint.get("hillshade-highlight-color"),ie=G.paint.get("hillshade-accent-color");let X=G.paint.get("hillshade-illumination-direction")*(Math.PI/180);G.paint.get("hillshade-illumination-anchor")==="viewport"&&(X-=N.transform.angle);const se=!N.options.moving;return{u_matrix:J?J.posMatrix:N.transform.calculatePosMatrix(q.tileID.toUnwrapped(),se),u_image:0,u_latrange:ia(0,q.tileID),u_light:[G.paint.get("hillshade-exaggeration"),X],u_shadow:Q,u_highlight:ee,u_accent:ie}})(_,o,u,k?e:null),k,u.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments)}function Is(_,e,o,u,d,y){const w=_.context,C=w.gl,S=e.dem;if(S&&S.data){const T=S.dim,z=S.stride,k=S.getPixels();if(w.activeTexture.set(C.TEXTURE1),w.pixelStoreUnpackPremultiplyAlpha.set(!1),e.demTexture=e.demTexture||_.getTileTexture(z),e.demTexture){const q=e.demTexture;q.update(k,{premultiply:!1}),q.bind(C.NEAREST,C.CLAMP_TO_EDGE)}else e.demTexture=new Ye(w,k,C.RGBA,{premultiply:!1}),e.demTexture.bind(C.NEAREST,C.CLAMP_TO_EDGE);w.activeTexture.set(C.TEXTURE0);let N=e.fbo;if(!N){const q=new Ye(w,{width:T,height:T,data:null},C.RGBA);q.bind(C.LINEAR,C.CLAMP_TO_EDGE),N=e.fbo=w.createFramebuffer(T,T,!0,!1),N.colorAttachment.set(q.texture)}w.bindFramebuffer.set(N.framebuffer),w.viewport.set([0,0,T,T]),_.useProgram("hillshadePrepare").draw(w,C.TRIANGLES,u,d,y,Ot.disabled,((q,G)=>{const J=G.stride,Q=h.H();return h.aP(Q,0,h.X,-h.X,0,0,1),h.J(Q,Q,[0,-h.X,0]),{u_matrix:Q,u_image:1,u_dimension:[J,J],u_zoom:q.overscaledZ,u_unpack:G.getUnpackVector()}})(e.tileID,S),null,o.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments),e.needsHillshadePrepare=!1}}function bc(_,e,o,u,d,y){const w=u.paint.get("raster-fade-duration");if(!y&&w>0){const C=B.now(),S=(C-_.timeAdded)/w,T=e?(C-e.timeAdded)/w:-1,z=o.getSource(),k=d.coveringZoomLevel({tileSize:z.tileSize,roundZoom:z.roundZoom}),N=!e||Math.abs(e.tileID.overscaledZ-k)>Math.abs(_.tileID.overscaledZ-k),q=N&&_.refreshedUponExpiration?1:h.ac(N?S:1-T,0,1);return _.refreshedUponExpiration&&S>=1&&(_.refreshedUponExpiration=!1),e?{opacity:1,mix:1-q}:{opacity:q,mix:0}}return{opacity:1,mix:0}}const Rl=new h.aM(1,0,0,1),Mt=new h.aM(0,1,0,1),ua=new h.aM(0,0,1,1),ad=new h.aM(1,0,1,1),wc=new h.aM(0,1,1,1);function Cs(_,e,o,u){da(_,0,e+o/2,_.transform.width,o,u)}function Ic(_,e,o,u){da(_,e-o/2,0,o,_.transform.height,u)}function da(_,e,o,u,d,y){const w=_.context,C=w.gl;C.enable(C.SCISSOR_TEST),C.scissor(e*_.pixelRatio,o*_.pixelRatio,u*_.pixelRatio,d*_.pixelRatio),w.clear({color:y}),C.disable(C.SCISSOR_TEST)}function Cc(_,e,o){const u=_.context,d=u.gl,y=o.posMatrix,w=_.useProgram("debug"),C=mt.disabled,S=Gt.disabled,T=_.colorModeForRenderPass(),z="$debug",k=_.style.map.terrain&&_.style.map.terrain.getTerrainData(o);u.activeTexture.set(d.TEXTURE0);const N=e.getTileByID(o.key).latestRawTileData,q=Math.floor((N&&N.byteLength||0)/1024),G=e.getTile(o).tileSize,J=512/Math.min(G,512)*(o.overscaledZ/_.transform.zoom)*.5;let Q=o.canonical.toString();o.overscaledZ!==o.canonical.z&&(Q+=` => ${o.overscaledZ}`),function(ee,ie){ee.initDebugOverlayCanvas();const X=ee.debugOverlayCanvas,se=ee.context.gl,ae=ee.debugOverlayCanvas.getContext("2d");ae.clearRect(0,0,X.width,X.height),ae.shadowColor="white",ae.shadowBlur=2,ae.lineWidth=1.5,ae.strokeStyle="white",ae.textBaseline="top",ae.font="bold 36px Open Sans, sans-serif",ae.fillText(ie,5,5),ae.strokeText(ie,5,5),ee.debugOverlayTexture.update(X),ee.debugOverlayTexture.bind(se.LINEAR,se.CLAMP_TO_EDGE)}(_,`${Q} ${q}kB`),w.draw(u,d.TRIANGLES,C,S,ai.alphaBlended,Ot.disabled,fo(y,h.aM.transparent,J),null,z,_.debugBuffer,_.quadTriangleIndexBuffer,_.debugSegments),w.draw(u,d.LINE_STRIP,C,S,T,Ot.disabled,fo(y,h.aM.red),k,z,_.debugBuffer,_.tileBorderIndexBuffer,_.debugSegments)}function Sc(_,e,o){const u=_.context,d=u.gl,y=_.colorModeForRenderPass(),w=new mt(d.LEQUAL,mt.ReadWrite,_.depthRangeFor3D),C=_.useProgram("terrain"),S=e.getTerrainMesh();u.bindFramebuffer.set(null),u.viewport.set([0,0,_.width,_.height]);for(const T of o){const z=_.renderToTexture.getTexture(T),k=e.getTerrainData(T.tileID);u.activeTexture.set(d.TEXTURE0),d.bindTexture(d.TEXTURE_2D,z.texture);const N=_.transform.calculatePosMatrix(T.tileID.toUnwrapped()),q=e.getMeshFrameDelta(_.transform.zoom),G=_.transform.calculateFogMatrix(T.tileID.toUnwrapped()),J=xl(N,q,G,_.style.sky,_.transform.pitch);C.draw(u,d.TRIANGLES,w,Gt.disabled,y,Ot.backCCW,J,k,"terrain",S.vertexBuffer,S.indexBuffer,S.segments)}}class pa{constructor(e,o,u){this.vertexBuffer=e,this.indexBuffer=o,this.segments=u}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class fa{constructor(e,o){this.context=new od(e),this.transform=o,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:h.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=rt.maxUnderzooming+rt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new _l}resize(e,o,u){if(this.width=Math.floor(e*u),this.height=Math.floor(o*u),this.pixelRatio=u,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const d of this.style._order)this.style._layers[d].resize()}setup(){const e=this.context,o=new h.aX;o.emplaceBack(0,0),o.emplaceBack(h.X,0),o.emplaceBack(0,h.X),o.emplaceBack(h.X,h.X),this.tileExtentBuffer=e.createVertexBuffer(o,Gn.members),this.tileExtentSegments=h.a0.simpleSegment(0,0,4,2);const u=new h.aX;u.emplaceBack(0,0),u.emplaceBack(h.X,0),u.emplaceBack(0,h.X),u.emplaceBack(h.X,h.X),this.debugBuffer=e.createVertexBuffer(u,Gn.members),this.debugSegments=h.a0.simpleSegment(0,0,4,5);const d=new h.$;d.emplaceBack(0,0,0,0),d.emplaceBack(h.X,0,h.X,0),d.emplaceBack(0,h.X,0,h.X),d.emplaceBack(h.X,h.X,h.X,h.X),this.rasterBoundsBuffer=e.createVertexBuffer(d,Sn.members),this.rasterBoundsSegments=h.a0.simpleSegment(0,0,4,2);const y=new h.aX;y.emplaceBack(0,0),y.emplaceBack(1,0),y.emplaceBack(0,1),y.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(y,Gn.members),this.viewportSegments=h.a0.simpleSegment(0,0,4,2);const w=new h.aZ;w.emplaceBack(0),w.emplaceBack(1),w.emplaceBack(3),w.emplaceBack(2),w.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(w);const C=new h.aY;C.emplaceBack(0,1,2),C.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(C);const S=this.context.gl;this.stencilClearMode=new Gt({func:S.ALWAYS,mask:0},0,255,S.ZERO,S.ZERO,S.ZERO)}clearStencil(){const e=this.context,o=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const u=h.H();h.aP(u,0,this.width,this.height,0,0,1),h.K(u,u,[o.drawingBufferWidth,o.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,o.TRIANGLES,mt.disabled,this.stencilClearMode,ai.disabled,Ot.disabled,Wi(u),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,o){if(this.currentStencilSource===e.source||!e.isTileClipped()||!o||!o.length)return;this.currentStencilSource=e.source;const u=this.context,d=u.gl;this.nextStencilID+o.length>256&&this.clearStencil(),u.setColorMode(ai.disabled),u.setDepthMode(mt.disabled);const y=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const w of o){const C=this._tileClippingMaskIDs[w.key]=this.nextStencilID++,S=this.style.map.terrain&&this.style.map.terrain.getTerrainData(w);y.draw(u,d.TRIANGLES,mt.disabled,new Gt({func:d.ALWAYS,mask:0},C,255,d.KEEP,d.KEEP,d.REPLACE),ai.disabled,Ot.disabled,Wi(w.posMatrix),S,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,o=this.context.gl;return new Gt({func:o.NOTEQUAL,mask:255},e,255,o.KEEP,o.KEEP,o.REPLACE)}stencilModeForClipping(e){const o=this.context.gl;return new Gt({func:o.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,o.KEEP,o.KEEP,o.REPLACE)}stencilConfigForOverlap(e){const o=this.context.gl,u=e.sort((w,C)=>C.overscaledZ-w.overscaledZ),d=u[u.length-1].overscaledZ,y=u[0].overscaledZ-d+1;if(y>1){this.currentStencilSource=void 0,this.nextStencilID+y>256&&this.clearStencil();const w={};for(let C=0;C({u_sky_color:ee.properties.get("sky-color"),u_horizon_color:ee.properties.get("horizon-color"),u_horizon:(ie.height/2+ie.getHorizon())*X,u_sky_horizon_blend:ee.properties.get("sky-horizon-blend")*ie.height/2*X}))(T,S.style.map.transform,S.pixelRatio),q=new mt(k.LEQUAL,mt.ReadWrite,[0,1]),G=Gt.disabled,J=S.colorModeForRenderPass(),Q=S.useProgram("sky");if(!T.mesh){const ee=new h.aX;ee.emplaceBack(-1,-1),ee.emplaceBack(1,-1),ee.emplaceBack(1,1),ee.emplaceBack(-1,1);const ie=new h.aY;ie.emplaceBack(0,1,2),ie.emplaceBack(0,2,3),T.mesh=new pa(z.createVertexBuffer(ee,Gn.members),z.createIndexBuffer(ie),h.a0.simpleSegment(0,0,ee.length,ie.length))}Q.draw(z,k.TRIANGLES,q,G,J,Ot.disabled,N,void 0,"sky",T.mesh.vertexBuffer,T.mesh.indexBuffer,T.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=o.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=u.length-1;this.currentLayer>=0;this.currentLayer--){const S=this.style._layers[u[this.currentLayer]],T=d[S.source],z=y[S.source];this._renderTileClippingMasks(S,z),this.renderLayer(this,T,S,z)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerQ.source&&!Q.isHidden(z)?[T.sourceCaches[Q.source]]:[]),q=N.filter(Q=>Q.getSource().type==="vector"),G=N.filter(Q=>Q.getSource().type!=="vector"),J=Q=>{(!k||k.getSource().maxzoomJ(Q)),k||G.forEach(Q=>J(Q)),k}(this.style,this.transform.zoom);S&&function(T,z,k){for(let N=0;N0),d&&(h.b0(o,u),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(y,w){const C=y.context,S=C.gl,T=ai.unblended,z=new mt(S.LEQUAL,mt.ReadWrite,[0,1]),k=w.getTerrainMesh(),N=w.sourceCache.getRenderableTiles(),q=y.useProgram("terrainDepth");C.bindFramebuffer.set(w.getFramebuffer("depth").framebuffer),C.viewport.set([0,0,y.width/devicePixelRatio,y.height/devicePixelRatio]),C.clear({color:h.aM.transparent,depth:1});for(const G of N){const J=w.getTerrainData(G.tileID),Q={u_matrix:y.transform.calculatePosMatrix(G.tileID.toUnwrapped()),u_ele_delta:w.getMeshFrameDelta(y.transform.zoom)};q.draw(C,S.TRIANGLES,z,Gt.disabled,T,Ot.backCCW,Q,J,"terrain",k.vertexBuffer,k.indexBuffer,k.segments)}C.bindFramebuffer.set(null),C.viewport.set([0,0,y.width,y.height])}(this,this.style.map.terrain),function(y,w){const C=y.context,S=C.gl,T=ai.unblended,z=new mt(S.LEQUAL,mt.ReadWrite,[0,1]),k=w.getTerrainMesh(),N=w.getCoordsTexture(),q=w.sourceCache.getRenderableTiles(),G=y.useProgram("terrainCoords");C.bindFramebuffer.set(w.getFramebuffer("coords").framebuffer),C.viewport.set([0,0,y.width/devicePixelRatio,y.height/devicePixelRatio]),C.clear({color:h.aM.transparent,depth:1}),w.coordsIndex=[];for(const J of q){const Q=w.getTerrainData(J.tileID);C.activeTexture.set(S.TEXTURE0),S.bindTexture(S.TEXTURE_2D,N.texture);const ee={u_matrix:y.transform.calculatePosMatrix(J.tileID.toUnwrapped()),u_terrain_coords_id:(255-w.coordsIndex.length)/255,u_texture:0,u_ele_delta:w.getMeshFrameDelta(y.transform.zoom)};G.draw(C,S.TRIANGLES,z,Gt.disabled,T,Ot.backCCW,ee,Q,"terrain",k.vertexBuffer,k.indexBuffer,k.segments),w.coordsIndex.push(J.tileID.key)}C.bindFramebuffer.set(null),C.viewport.set([0,0,y.width,y.height])}(this,this.style.map.terrain))}renderLayer(e,o,u,d){if(!u.isHidden(this.transform.zoom)&&(u.type==="background"||u.type==="custom"||(d||[]).length))switch(this.id=u.id,u.type){case"symbol":(function(y,w,C,S,T){if(y.renderPass!=="translucent")return;const z=Gt.disabled,k=y.colorModeForRenderPass();(C._unevaluatedLayout.hasValue("text-variable-anchor")||C._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(N,q,G,J,Q,ee,ie,X,se){const ae=q.transform,de=Zn(),xe=Q==="map",Ie=ee==="map";for(const ke of N){const Fe=J.getTile(ke),Ee=Fe.getBucket(G);if(!Ee||!Ee.text||!Ee.text.segments.get().length)continue;const Pe=h.ag(Ee.textSizeData,ae.zoom),Ze=gt(Fe,1,q.transform.zoom),at=Pn(ke.posMatrix,Ie,xe,q.transform,Ze),Ae=G.layout.get("icon-text-fit")!=="none"&&Ee.hasIconData();if(Pe){const Le=Math.pow(2,ae.zoom-Fe.tileID.overscaledZ),st=q.style.map.terrain?(dt,yt)=>q.style.map.terrain.getElevation(ke,dt,yt):null,Kt=de.translatePosition(ae,Fe,ie,X);xs(Ee,xe,Ie,se,ae,at,ke.posMatrix,Le,Pe,Ae,de,Kt,ke.toUnwrapped(),st)}}}(S,y,C,w,C.layout.get("text-rotation-alignment"),C.layout.get("text-pitch-alignment"),C.paint.get("text-translate"),C.paint.get("text-translate-anchor"),T),C.paint.get("icon-opacity").constantOr(1)!==0&&Ll(y,w,C,S,!1,C.paint.get("icon-translate"),C.paint.get("icon-translate-anchor"),C.layout.get("icon-rotation-alignment"),C.layout.get("icon-pitch-alignment"),C.layout.get("icon-keep-upright"),z,k),C.paint.get("text-opacity").constantOr(1)!==0&&Ll(y,w,C,S,!0,C.paint.get("text-translate"),C.paint.get("text-translate-anchor"),C.layout.get("text-rotation-alignment"),C.layout.get("text-pitch-alignment"),C.layout.get("text-keep-upright"),z,k),w.map.showCollisionBoxes&&(yo(y,w,C,S,!0),yo(y,w,C,S,!1))})(e,o,u,d,this.style.placement.variableOffsets);break;case"circle":(function(y,w,C,S){if(y.renderPass!=="translucent")return;const T=C.paint.get("circle-opacity"),z=C.paint.get("circle-stroke-width"),k=C.paint.get("circle-stroke-opacity"),N=!C.layout.get("circle-sort-key").isConstant();if(T.constantOr(1)===0&&(z.constantOr(1)===0||k.constantOr(1)===0))return;const q=y.context,G=q.gl,J=y.depthModeForSublayer(0,mt.ReadOnly),Q=Gt.disabled,ee=y.colorModeForRenderPass(),ie=[];for(let X=0;XX.sortKey-se.sortKey);for(const X of ie){const{programConfiguration:se,program:ae,layoutVertexBuffer:de,indexBuffer:xe,uniformValues:Ie,terrainData:ke}=X.state;ae.draw(q,G.TRIANGLES,J,Q,ee,Ot.disabled,Ie,ke,C.id,de,xe,X.segments,C.paint,y.transform.zoom,se)}})(e,o,u,d);break;case"heatmap":(function(y,w,C,S){if(C.paint.get("heatmap-opacity")===0)return;const T=y.context;if(y.style.map.terrain){for(const z of S){const k=w.getTile(z);w.hasRenderableParent(z)||(y.renderPass==="offscreen"?Fl(y,k,C,z):y.renderPass==="translucent"&&Qn(y,C,z))}T.viewport.set([0,0,y.width,y.height])}else y.renderPass==="offscreen"?function(z,k,N,q){const G=z.context,J=G.gl,Q=Gt.disabled,ee=new ai([J.ONE,J.ONE],h.aM.transparent,[!0,!0,!0,!0]);(function(ie,X,se){const ae=ie.gl;ie.activeTexture.set(ae.TEXTURE1),ie.viewport.set([0,0,X.width/4,X.height/4]);let de=se.heatmapFbos.get(h.aU);de?(ae.bindTexture(ae.TEXTURE_2D,de.colorAttachment.get()),ie.bindFramebuffer.set(de.framebuffer)):(de=vo(ie,X.width/4,X.height/4),se.heatmapFbos.set(h.aU,de))})(G,z,N),G.clear({color:h.aM.transparent});for(let ie=0;ie20&&z.texParameterf(z.TEXTURE_2D,T.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,T.extTextureFilterAnisotropicMax);const Ee=y.style.map.terrain&&y.style.map.terrain.getTerrainData(ie),Pe=Ee?ie:null,Ze=Pe?Pe.posMatrix:y.transform.calculatePosMatrix(ie.toUnwrapped(),ee),at=Hu(Ze,ke||[0,0],Ie||1,xe,C);k instanceof fn?N.draw(T,z.TRIANGLES,X,Gt.disabled,q,Ot.disabled,at,Ee,C.id,k.boundsBuffer,y.quadTriangleIndexBuffer,k.boundsSegments):N.draw(T,z.TRIANGLES,X,G[ie.overscaledZ],q,Ot.disabled,at,Ee,C.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments)}})(e,o,u,d);break;case"background":(function(y,w,C,S){const T=C.paint.get("background-color"),z=C.paint.get("background-opacity");if(z===0)return;const k=y.context,N=k.gl,q=y.transform,G=q.tileSize,J=C.paint.get("background-pattern");if(y.isPatternMissing(J))return;const Q=!J&&T.a===1&&z===1&&y.opaquePassEnabledForLayer()?"opaque":"translucent";if(y.renderPass!==Q)return;const ee=Gt.disabled,ie=y.depthModeForSublayer(0,Q==="opaque"?mt.ReadWrite:mt.ReadOnly),X=y.colorModeForRenderPass(),se=y.useProgram(J?"backgroundPattern":"background"),ae=S||q.coveringTiles({tileSize:G,terrain:y.style.map.terrain});J&&(k.activeTexture.set(N.TEXTURE0),y.imageManager.bind(y.context));const de=C.getCrossfadeParameters();for(const xe of ae){const Ie=S?xe.posMatrix:y.transform.calculatePosMatrix(xe.toUnwrapped()),ke=J?Il(Ie,z,y,J,{tileID:xe,tileSize:G},de):na(Ie,z,T),Fe=y.style.map.terrain&&y.style.map.terrain.getTerrainData(xe);se.draw(k,N.TRIANGLES,ie,ee,X,Ot.disabled,ke,Fe,C.id,y.tileExtentBuffer,y.quadTriangleIndexBuffer,y.tileExtentSegments)}})(e,0,u,d);break;case"custom":(function(y,w,C){const S=y.context,T=C.implementation;if(y.renderPass==="offscreen"){const z=T.prerender;z&&(y.setCustomLayerDefaults(),S.setColorMode(y.colorModeForRenderPass()),z.call(T,S.gl,y.transform.customLayerMatrix()),S.setDirty(),y.setBaseState())}else if(y.renderPass==="translucent"){y.setCustomLayerDefaults(),S.setColorMode(y.colorModeForRenderPass()),S.setStencilMode(Gt.disabled);const z=T.renderingMode==="3d"?new mt(y.context.gl.LEQUAL,mt.ReadWrite,y.depthRangeFor3D):y.depthModeForSublayer(0,mt.ReadOnly);S.setDepthMode(z),T.render(S.gl,y.transform.customLayerMatrix(),{farZ:y.transform.farZ,nearZ:y.transform.nearZ,fov:y.transform._fov,modelViewProjectionMatrix:y.transform.modelViewProjectionMatrix,projectionMatrix:y.transform.projectionMatrix}),S.setDirty(),y.setBaseState(),S.bindFramebuffer.set(null)}})(e,0,u)}}translatePosMatrix(e,o,u,d,y){if(!u[0]&&!u[1])return e;const w=y?d==="map"?this.transform.angle:0:d==="viewport"?-this.transform.angle:0;if(w){const T=Math.sin(w),z=Math.cos(w);u=[u[0]*z-u[1]*T,u[0]*T+u[1]*z]}const C=[y?u[0]:gt(o,u[0],this.transform.zoom),y?u[1]:gt(o,u[1],this.transform.zoom),0],S=new Float32Array(16);return h.J(S,e,C),S}saveTileTexture(e){const o=this._tileTextures[e.size[0]];o?o.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const o=this._tileTextures[e];return o&&o.length>0?o.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const o=this.imageManager.getPattern(e.from.toString()),u=this.imageManager.getPattern(e.to.toString());return!o||!u}useProgram(e,o){this.cache=this.cache||{};const u=e+(o?o.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[u]||(this.cache[u]=new bl(this.context,En[e],o,Cl[e],this._showOverdrawInspector,this.style.map.terrain)),this.cache[u]}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 e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Ye(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:e,drawingBufferHeight:o}=this.context.gl;return this.width!==e||this.height!==o}}class Ss{constructor(e,o){this.points=e,this.planes=o}static fromInvProjectionMatrix(e,o,u){const d=Math.pow(2,u),y=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(C=>{const S=1/(C=h.af([],C,e))[3]/o*d;return h.b1(C,C,[S,S,1/C[3],S])}),w=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(C=>{const S=function(N,q){var G=q[0],J=q[1],Q=q[2],ee=G*G+J*J+Q*Q;return ee>0&&(ee=1/Math.sqrt(ee)),N[0]=q[0]*ee,N[1]=q[1]*ee,N[2]=q[2]*ee,N}([],function(N,q,G){var J=q[0],Q=q[1],ee=q[2],ie=G[0],X=G[1],se=G[2];return N[0]=Q*se-ee*X,N[1]=ee*ie-J*se,N[2]=J*X-Q*ie,N}([],Ke([],y[C[0]],y[C[1]]),Ke([],y[C[2]],y[C[1]]))),T=-((z=S)[0]*(k=y[C[1]])[0]+z[1]*k[1]+z[2]*k[2]);var z,k;return S.concat(T)});return new Ss(y,w)}}class Ms{constructor(e,o){this.min=e,this.max=o,this.center=function(u,d,y){return u[0]=.5*d[0],u[1]=.5*d[1],u[2]=.5*d[2],u}([],function(u,d,y){return u[0]=d[0]+y[0],u[1]=d[1]+y[1],u[2]=d[2]+y[2],u}([],this.min,this.max))}quadrant(e){const o=[e%2==0,e<2],u=nt(this.min),d=nt(this.max);for(let y=0;y=0&&w++;if(w===0)return 0;w!==o.length&&(u=!1)}if(u)return 2;for(let d=0;d<3;d++){let y=Number.MAX_VALUE,w=-Number.MAX_VALUE;for(let C=0;Cthis.max[d]-this.min[d])return 0}return 1}}class Ps{constructor(e=0,o=0,u=0,d=0){if(isNaN(e)||e<0||isNaN(o)||o<0||isNaN(u)||u<0||isNaN(d)||d<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=o,this.left=u,this.right=d}interpolate(e,o,u){return o.top!=null&&e.top!=null&&(this.top=h.y.number(e.top,o.top,u)),o.bottom!=null&&e.bottom!=null&&(this.bottom=h.y.number(e.bottom,o.bottom,u)),o.left!=null&&e.left!=null&&(this.left=h.y.number(e.left,o.left,u)),o.right!=null&&e.right!=null&&(this.right=h.y.number(e.right,o.right,u)),this}getCenter(e,o){const u=h.ac((this.left+e-this.right)/2,0,e),d=h.ac((this.top+o-this.bottom)/2,0,o);return new h.P(u,d)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new Ps(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Ol=85.051129;class Es{constructor(e,o,u,d,y){this.tileSize=512,this._renderWorldCopies=y===void 0||!!y,this._minZoom=e||0,this._maxZoom=o||22,this._minPitch=u??0,this._maxPitch=d??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new h.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Ps,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const e=new Es(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return e.apply(this),e}apply(e){this.tileSize=e.tileSize,this.latRange=e.latRange,this.lngRange=e.lngRange,this.width=e.width,this.height=e.height,this._center=e._center,this._elevation=e._elevation,this.minElevationForCurrentTile=e.minElevationForCurrentTile,this.zoom=e.zoom,this.angle=e.angle,this._fov=e._fov,this._pitch=e._pitch,this._unmodified=e._unmodified,this._edgeInsets=e._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new h.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){const o=-h.b3(e,-180,180)*Math.PI/180;this.angle!==o&&(this._unmodified=!1,this.angle=o,this._calcMatrices(),this.rotationMatrix=function(){var u=new h.A(4);return h.A!=Float32Array&&(u[1]=0,u[2]=0),u[0]=1,u[3]=1,u}(),function(u,d,y){var w=d[0],C=d[1],S=d[2],T=d[3],z=Math.sin(y),k=Math.cos(y);u[0]=w*k+S*z,u[1]=C*k+T*z,u[2]=w*-z+S*k,u[3]=C*-z+T*k}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){const o=h.ac(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==o&&(this._unmodified=!1,this._pitch=o,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(e){e=Math.max(.01,Math.min(60,e)),this._fov!==e&&(this._unmodified=!1,this._fov=e/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(e){const o=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==o&&(this._unmodified=!1,this._zoom=o,this.tileZoom=Math.max(0,Math.floor(o)),this.scale=this.zoomScale(o),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,o,u){this._unmodified=!1,this._edgeInsets.interpolate(e,o,u),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){const o=(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,o)}getVisibleUnwrappedCoordinates(e){const o=[new h.b4(0,e)];if(this._renderWorldCopies){const u=this.pointCoordinate(new h.P(0,0)),d=this.pointCoordinate(new h.P(this.width,0)),y=this.pointCoordinate(new h.P(this.width,this.height)),w=this.pointCoordinate(new h.P(0,this.height)),C=Math.floor(Math.min(u.x,d.x,y.x,w.x)),S=Math.floor(Math.max(u.x,d.x,y.x,w.x)),T=1;for(let z=C-T;z<=S+T;z++)z!==0&&o.push(new h.b4(z,e))}return o}coveringTiles(e){var o,u;let d=this.coveringZoomLevel(e);const y=d;if(e.minzoom!==void 0&&de.maxzoom&&(d=e.maxzoom);const w=this.pointCoordinate(this.getCameraPoint()),C=h.Z.fromLngLat(this.center),S=Math.pow(2,d),T=[S*w.x,S*w.y,0],z=[S*C.x,S*C.y,0],k=Ss.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,d);let N=e.minzoom||0;!e.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(N=d);const q=e.terrain?2/Math.min(this.tileSize,e.tileSize)*this.tileSize:3,G=X=>({aabb:new Ms([X*S,0,0],[(X+1)*S,S,0]),zoom:0,x:0,y:0,wrap:X,fullyVisible:!1}),J=[],Q=[],ee=d,ie=e.reparseOverscaled?y:d;if(this._renderWorldCopies)for(let X=1;X<=3;X++)J.push(G(-X)),J.push(G(X));for(J.push(G(0));J.length>0;){const X=J.pop(),se=X.x,ae=X.y;let de=X.fullyVisible;if(!de){const Ee=X.aabb.intersects(k);if(Ee===0)continue;de=Ee===2}const xe=e.terrain?T:z,Ie=X.aabb.distanceX(xe),ke=X.aabb.distanceY(xe),Fe=Math.max(Math.abs(Ie),Math.abs(ke));if(X.zoom===ee||Fe>q+(1<=N){const Ee=ee-X.zoom,Pe=T[0]-.5-(se<>1),at=X.zoom+1;let Ae=X.aabb.quadrant(Ee);if(e.terrain){const Le=new h.S(at,X.wrap,at,Pe,Ze),st=e.terrain.getMinMaxElevation(Le),Kt=(o=st.minElevation)!==null&&o!==void 0?o:this.elevation,dt=(u=st.maxElevation)!==null&&u!==void 0?u:this.elevation;Ae=new Ms([Ae.min[0],Ae.min[1],Kt],[Ae.max[0],Ae.max[1],dt])}J.push({aabb:Ae,zoom:at,x:Pe,y:Ze,wrap:X.wrap,fullyVisible:de})}}return Q.sort((X,se)=>X.distanceSq-se.distanceSq).map(X=>X.tileID)}resize(e,o){this.width=e,this.height=o,this.pixelsToGLUnits=[2/e,-2/o],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(e){const o=h.ac(e.lat,-85.051129,Ol);return new h.P(h.O(e.lng)*this.worldSize,h.Q(o)*this.worldSize)}unproject(e){return new h.Z(e.x/this.worldSize,e.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(e){const o=this.elevation,u=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,d=this.pointLocation(this.centerPoint,e),y=e.getElevationForLngLatZoom(d,this.tileZoom);if(!(this.elevation-y))return;const w=u+o-y,C=Math.cos(this._pitch)*this.cameraToCenterDistance/w/h.b5(1,d.lat),S=this.scaleZoom(C/this.tileSize);this._elevation=y,this._center=d,this.zoom=S}setLocationAtPoint(e,o){const u=this.pointCoordinate(o),d=this.pointCoordinate(this.centerPoint),y=this.locationCoordinate(e),w=new h.Z(y.x-(u.x-d.x),y.y-(u.y-d.y));this.center=this.coordinateLocation(w),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(e,o){return o?this.coordinatePoint(this.locationCoordinate(e),o.getElevationForLngLatZoom(e,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(e))}pointLocation(e,o){return this.coordinateLocation(this.pointCoordinate(e,o))}locationCoordinate(e){return h.Z.fromLngLat(e)}coordinateLocation(e){return e&&e.toLngLat()}pointCoordinate(e,o){if(o){const N=o.pointCoordinate(e);if(N!=null)return N}const u=[e.x,e.y,0,1],d=[e.x,e.y,1,1];h.af(u,u,this.pixelMatrixInverse),h.af(d,d,this.pixelMatrixInverse);const y=u[3],w=d[3],C=u[1]/y,S=d[1]/w,T=u[2]/y,z=d[2]/w,k=T===z?0:(0-T)/(z-T);return new h.Z(h.y.number(u[0]/y,d[0]/w,k)/this.worldSize,h.y.number(C,S,k)/this.worldSize)}coordinatePoint(e,o=0,u=this.pixelMatrix){const d=[e.x*this.worldSize,e.y*this.worldSize,o,1];return h.af(d,d,u),new h.P(d[0]/d[3],d[1]/d[3])}getBounds(){const e=Math.max(0,this.height/2-this.getHorizon());return new fe().extend(this.pointLocation(new h.P(0,e))).extend(this.pointLocation(new h.P(this.width,e))).extend(this.pointLocation(new h.P(this.width,this.height))).extend(this.pointLocation(new h.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new fe([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(e){e?(this.lngRange=[e.getWest(),e.getEast()],this.latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,Ol])}calculateTileMatrix(e){const o=e.canonical,u=this.worldSize/this.zoomScale(o.z),d=o.x+Math.pow(2,o.z)*e.wrap,y=h.an(new Float64Array(16));return h.J(y,y,[d*u,o.y*u,0]),h.K(y,y,[u/h.X,u/h.X,1]),y}calculatePosMatrix(e,o=!1){const u=e.key,d=o?this._alignedPosMatrixCache:this._posMatrixCache;if(d[u])return d[u];const y=this.calculateTileMatrix(e);return h.L(y,o?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,y),d[u]=new Float32Array(y),d[u]}calculateFogMatrix(e){const o=e.key,u=this._fogMatrixCache;if(u[o])return u[o];const d=this.calculateTileMatrix(e);return h.L(d,this.fogMatrix,d),u[o]=new Float32Array(d),u[o]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(e,o){o=h.ac(+o,this.minZoom,this.maxZoom);const u={center:new h.N(e.lng,e.lat),zoom:o};let d=this.lngRange;if(!this._renderWorldCopies&&d===null){const X=179.9999999999;d=[-X,X]}const y=this.tileSize*this.zoomScale(u.zoom);let w=0,C=y,S=0,T=y,z=0,k=0;const{x:N,y:q}=this.size;if(this.latRange){const X=this.latRange;w=h.Q(X[1])*y,C=h.Q(X[0])*y,C-wC&&(ee=C-X)}if(d){const X=(S+T)/2;let se=G;this._renderWorldCopies&&(se=h.b3(G,X-y/2,X+y/2));const ae=N/2;se-aeT&&(Q=T-ae)}if(Q!==void 0||ee!==void 0){const X=new h.P(Q??G,ee??J);u.center=this.unproject.call({worldSize:y},X).wrap()}return u}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const e=this._unmodified,{center:o,zoom:u}=this.getConstrained(this.center,this.zoom);this.center=o,this.zoom=u,this._unmodified=e,this._constraining=!1}_calcMatrices(){if(!this.height)return;const e=this.centerOffset,o=this.point.x,u=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=h.b5(1,this.center.lat)*this.worldSize;let d=h.an(new Float64Array(16));h.K(d,d,[this.width/2,-this.height/2,1]),h.J(d,d,[1,-1,0]),this.labelPlaneMatrix=d,d=h.an(new Float64Array(16)),h.K(d,d,[1,-1,1]),h.J(d,d,[-1,-1,0]),h.K(d,d,[2/this.width,2/this.height,1]),this.glCoordMatrix=d;const y=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),w=Math.min(this.elevation,this.minElevationForCurrentTile),C=y-w*this._pixelPerMeter/Math.cos(this._pitch),S=w<0?C:y,T=Math.PI/2+this._pitch,z=this._fov*(.5+e.y/this.height),k=Math.sin(z)*S/Math.sin(h.ac(Math.PI-T-z,.01,Math.PI-.01)),N=this.getHorizon(),q=2*Math.atan(N/this.cameraToCenterDistance)*(.5+e.y/(2*N)),G=Math.sin(q)*S/Math.sin(h.ac(Math.PI-T-q,.01,Math.PI-.01)),J=Math.min(k,G);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*J+S),this.nearZ=this.height/50,d=new Float64Array(16),h.b6(d,this._fov,this.width/this.height,this.nearZ,this.farZ),d[8]=2*-e.x/this.width,d[9]=2*e.y/this.height,this.projectionMatrix=h.ae(d),h.K(d,d,[1,-1,1]),h.J(d,d,[0,0,-this.cameraToCenterDistance]),h.b7(d,d,this._pitch),h.ad(d,d,this.angle),h.J(d,d,[-o,-u,0]),this.mercatorMatrix=h.K([],d,[this.worldSize,this.worldSize,this.worldSize]),h.K(d,d,[1,1,this._pixelPerMeter]),this.pixelMatrix=h.L(new Float64Array(16),this.labelPlaneMatrix,d),h.J(d,d,[0,0,-this.elevation]),this.modelViewProjectionMatrix=d,this.invModelViewProjectionMatrix=h.as([],d),this.fogMatrix=new Float64Array(16),h.b6(this.fogMatrix,this._fov,this.width/this.height,y,this.farZ),this.fogMatrix[8]=2*-e.x/this.width,this.fogMatrix[9]=2*e.y/this.height,h.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),h.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),h.b7(this.fogMatrix,this.fogMatrix,this._pitch),h.ad(this.fogMatrix,this.fogMatrix,this.angle),h.J(this.fogMatrix,this.fogMatrix,[-o,-u,0]),h.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),h.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=h.L(new Float64Array(16),this.labelPlaneMatrix,d);const Q=this.width%2/2,ee=this.height%2/2,ie=Math.cos(this.angle),X=Math.sin(this.angle),se=o-Math.round(o)+ie*Q+X*ee,ae=u-Math.round(u)+ie*ee+X*Q,de=new Float64Array(d);if(h.J(de,de,[se>.5?se-1:se,ae>.5?ae-1:ae,0]),this.alignedModelViewProjectionMatrix=de,d=h.as(new Float64Array(16),this.pixelMatrix),!d)throw new Error("failed to invert matrix");this.pixelMatrixInverse=d,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const e=this.pointCoordinate(new h.P(0,0)),o=[e.x*this.worldSize,e.y*this.worldSize,0,1];return h.af(o,o,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new h.P(0,e))}getCameraQueryGeometry(e){const o=this.getCameraPoint();if(e.length===1)return[e[0],o];{let u=o.x,d=o.y,y=o.x,w=o.y;for(const C of e)u=Math.min(u,C.x),d=Math.min(d,C.y),y=Math.max(y,C.x),w=Math.max(w,C.y);return[new h.P(u,d),new h.P(y,d),new h.P(y,w),new h.P(u,w),new h.P(u,d)]}}lngLatToCameraDepth(e,o){const u=this.locationCoordinate(e),d=[u.x*this.worldSize,u.y*this.worldSize,o,1];return h.af(d,d,this.modelViewProjectionMatrix),d[2]/d[3]}}function wo(_,e){let o,u=!1,d=null,y=null;const w=()=>{d=null,u&&(_.apply(y,o),d=setTimeout(w,e),u=!1)};return(...C)=>(u=!0,y=this,o=C,d||w(),d)}class ma{constructor(e){this._getCurrentHash=()=>{const o=window.location.hash.replace("#","");if(this._hashName){let u;return o.split("&").map(d=>d.split("=")).forEach(d=>{d[0]===this._hashName&&(u=d)}),(u&&u[1]||"").split("/")}return o.split("/")},this._onHashChange=()=>{const o=this._getCurrentHash();if(o.length>=3&&!o.some(u=>isNaN(u))){const u=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(o[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+o[2],+o[1]],zoom:+o[0],bearing:u,pitch:+(o[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const o=window.location.href.replace(/(#.+)?$/,this.getHashString());window.history.replaceState(window.history.state,null,o)},this._removeHash=()=>{const o=this._getCurrentHash();if(o.length===0)return;const u=o.join("/");let d=u;d.split("&").length>0&&(d=d.split("&")[0]),this._hashName&&(d=`${this._hashName}=${u}`);let y=window.location.hash.replace(d,"");y.startsWith("#&")?y=y.slice(0,1)+y.slice(2):y==="#"&&(y="");let w=window.location.href.replace(/(#.+)?$/,y);w=w.replace("&&","&"),window.history.replaceState(window.history.state,null,w)},this._updateHash=wo(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,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(e){const o=this._map.getCenter(),u=Math.round(100*this._map.getZoom())/100,d=Math.ceil((u*Math.LN2+Math.log(512/360/.5))/Math.LN10),y=Math.pow(10,d),w=Math.round(o.lng*y)/y,C=Math.round(o.lat*y)/y,S=this._map.getBearing(),T=this._map.getPitch();let z="";if(z+=e?`/${w}/${C}/${u}`:`${u}/${C}/${w}`,(S||T)&&(z+="/"+Math.round(10*S)/10),T&&(z+=`/${Math.round(T)}`),this._hashName){const k=this._hashName;let N=!1;const q=window.location.hash.slice(1).split("&").map(G=>{const J=G.split("=")[0];return J===k?(N=!0,`${J}=${z}`):G}).filter(G=>G);return N||q.push(`${k}=${z}`),`#${q.join("&")}`}return`#${z}`}}const ga={linearity:.3,easing:h.b8(0,0,.3,1)},Vl=h.e({deceleration:2500,maxSpeed:1400},ga),ld=h.e({deceleration:20,maxSpeed:1400},ga),Mc=h.e({deceleration:1e3,maxSpeed:360},ga),ya=h.e({deceleration:1e3,maxSpeed:90},ga);class Nl{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:B.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,o=B.now();for(;e.length>0&&o-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const o={zoom:0,bearing:0,pitch:0,pan:new h.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:y}of this._inertiaBuffer)o.zoom+=y.zoomDelta||0,o.bearing+=y.bearingDelta||0,o.pitch+=y.pitchDelta||0,y.panDelta&&o.pan._add(y.panDelta),y.around&&(o.around=y.around),y.pinchAround&&(o.pinchAround=y.pinchAround);const u=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,d={};if(o.pan.mag()){const y=Co(o.pan.mag(),u,h.e({},Vl,e||{}));d.offset=o.pan.mult(y.amount/o.pan.mag()),d.center=this._map.transform.center,Io(d,y)}if(o.zoom){const y=Co(o.zoom,u,ld);d.zoom=this._map.transform.zoom+y.amount,Io(d,y)}if(o.bearing){const y=Co(o.bearing,u,Mc);d.bearing=this._map.transform.bearing+h.ac(y.amount,-179,179),Io(d,y)}if(o.pitch){const y=Co(o.pitch,u,ya);d.pitch=this._map.transform.pitch+y.amount,Io(d,y)}if(d.zoom||d.bearing){const y=o.pinchAround===void 0?o.around:o.pinchAround;d.around=y?this._map.unproject(y):this._map.getCenter()}return this.clear(),h.e(d,{noMoveStart:!0})}}function Io(_,e){(!_.duration||_.durationo.unproject(S)),C=y.reduce((S,T,z,k)=>S.add(T.div(k.length)),new h.P(0,0));super(e,{points:y,point:C,lngLats:w,lngLat:o.unproject(C),originalEvent:u}),this._defaultPrevented=!1}}class Pc extends h.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,o,u){super(e,{originalEvent:u}),this._defaultPrevented=!1}}class Ec{constructor(e,o){this._map=e,this._clickTolerance=o.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new Pc(e.type,this._map,e))}mousedown(e,o){return this._mousedownPos=o,this._firePreventable(new zi(e.type,this._map,e))}mouseup(e){this._map.fire(new zi(e.type,this._map,e))}click(e,o){this._mousedownPos&&this._mousedownPos.dist(o)>=this._clickTolerance||this._map.fire(new zi(e.type,this._map,e))}dblclick(e){return this._firePreventable(new zi(e.type,this._map,e))}mouseover(e){this._map.fire(new zi(e.type,this._map,e))}mouseout(e){this._map.fire(new zi(e.type,this._map,e))}touchstart(e){return this._firePreventable(new es(e.type,this._map,e))}touchmove(e){this._map.fire(new es(e.type,this._map,e))}touchend(e){this._map.fire(new es(e.type,this._map,e))}touchcancel(e){this._map.fire(new es(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class li{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new zi(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new zi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new zi(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Rr{constructor(e){this._map=e}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(e){return this.transform.pointLocation(h.P.convert(e),this._map.terrain)}}class hr{constructor(e,o){this._map=e,this._tr=new Rr(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=o.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,o){this.isEnabled()&&e.shiftKey&&e.button===0&&(U.disableDrag(),this._startPos=this._lastPos=o,this._active=!0)}mousemoveWindow(e,o){if(!this._active)return;const u=o;if(this._lastPos.equals(u)||!this._box&&u.dist(this._startPos)y.fitScreenCoordinates(u,d,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(U.remove(this._box),this._box=null),U.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,o){return this._map.fire(new h.k(e,{originalEvent:o}))}}function So(_,e){if(_.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${_.length}, points ${e.length}`);const o={};for(let u=0;u<_.length;u++)o[_[u].identifier]=e[u];return o}class Ul{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,o,u){(this.centroid||u.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),u.length===this.numTouches&&(this.centroid=function(d){const y=new h.P(0,0);for(const w of d)y._add(w);return y.div(d.length)}(o),this.touches=So(u,o)))}touchmove(e,o,u){if(this.aborted||!this.centroid)return;const d=So(u,o);for(const y in this.touches){const w=d[y];(!w||w.dist(this.touches[y])>30)&&(this.aborted=!0)}}touchend(e,o,u){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),u.length===0){const d=!this.aborted&&this.centroid;if(this.reset(),d)return d}}}class _a{constructor(e){this.singleTap=new Ul(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,o,u){this.singleTap.touchstart(e,o,u)}touchmove(e,o,u){this.singleTap.touchmove(e,o,u)}touchend(e,o,u){const d=this.singleTap.touchend(e,o,u);if(d){const y=e.timeStamp-this.lastTime<500,w=!this.lastTap||this.lastTap.dist(d)<30;if(y&&w||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=d,this.count===this.numTaps)return this.reset(),d}}}class Ts{constructor(e){this._tr=new Rr(e),this._zoomIn=new _a({numTouches:1,numTaps:2}),this._zoomOut=new _a({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,o,u){this._zoomIn.touchstart(e,o,u),this._zoomOut.touchstart(e,o,u)}touchmove(e,o,u){this._zoomIn.touchmove(e,o,u),this._zoomOut.touchmove(e,o,u)}touchend(e,o,u){const d=this._zoomIn.touchend(e,o,u),y=this._zoomOut.touchend(e,o,u),w=this._tr;return d?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:C=>C.easeTo({duration:300,zoom:w.zoom+1,around:w.unproject(d)},{originalEvent:e})}):y?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:C=>C.easeTo({duration:300,zoom:w.zoom-1,around:w.unproject(y)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class yn{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){const o=this._moveFunction(...e);if(o.bearingDelta||o.pitchDelta||o.around||o.panDelta)return this._active=!0,o}dragStart(e,o){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=o.length?o[0]:o,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,o){if(!this.isEnabled())return;const u=this._lastPoint;if(!u)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const d=o.length?o[0]:o;return!this._moved&&d.dist(u){_.mousedown=_.dragStart,_.mousemoveWindow=_.dragMove,_.mouseup=_.dragEnd,_.contextmenu=e=>{e.preventDefault()}},ql=({enable:_,clickTolerance:e,bearingDegreesPerPixelMoved:o=.8})=>{const u=new va({checkCorrectEvent:d=>U.mouseButton(d)===0&&d.ctrlKey||U.mouseButton(d)===2});return new yn({clickTolerance:e,move:(d,y)=>({bearingDelta:(y.x-d.x)*o}),moveStateManager:u,enable:_,assignEvents:xa})},Zl=({enable:_,clickTolerance:e,pitchDegreesPerPixelMoved:o=-.5})=>{const u=new va({checkCorrectEvent:d=>U.mouseButton(d)===0&&d.ctrlKey||U.mouseButton(d)===2});return new yn({clickTolerance:e,move:(d,y)=>({pitchDelta:(y.y-d.y)*o}),moveStateManager:u,enable:_,assignEvents:xa})};class ts{constructor(e,o){this._clickTolerance=e.clickTolerance||1,this._map=o,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new h.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,o,u){return this._calculateTransform(e,o,u)}touchmove(e,o,u){if(this._active){if(!this._shouldBePrevented(u.length))return e.preventDefault(),this._calculateTransform(e,o,u);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,o,u){this._calculateTransform(e,o,u),this._active&&this._shouldBePrevented(u.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,o,u){u.length>0&&(this._active=!0);const d=So(u,o),y=new h.P(0,0),w=new h.P(0,0);let C=0;for(const T in d){const z=d[T],k=this._touches[T];k&&(y._add(z),w._add(z.sub(k)),C++,d[T]=z)}if(this._touches=d,this._shouldBePrevented(C)||!w.mag())return;const S=w.div(C);return this._sum._add(S),this._sum.mag()Math.abs(_.x)}class As extends ba{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,o,u){super.touchstart(e,o,u),this._currentTouchCount=u.length}_start(e){this._lastPoints=e,wa(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,o,u){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const d=e[0].sub(this._lastPoints[0]),y=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(d,y,u.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(d.y+y.y)/2*-.5}):void 0}gestureBeginsVertically(e,o,u){if(this._valid!==void 0)return this._valid;const d=e.mag()>=2,y=o.mag()>=2;if(!d&&!y)return;if(!d||!y)return this._firstMove===void 0&&(this._firstMove=u),u-this._firstMove<100&&void 0;const w=e.y>0==o.y>0;return wa(e)&&wa(o)&&w}}const Tc={panStep:100,bearingStep:15,pitchStep:10};class wr{constructor(e){this._tr=new Rr(e);const o=Tc;this._panStep=o.panStep,this._bearingStep=o.bearingStep,this._pitchStep=o.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let o=0,u=0,d=0,y=0,w=0;switch(e.keyCode){case 61:case 107:case 171:case 187:o=1;break;case 189:case 109:case 173:o=-1;break;case 37:e.shiftKey?u=-1:(e.preventDefault(),y=-1);break;case 39:e.shiftKey?u=1:(e.preventDefault(),y=1);break;case 38:e.shiftKey?d=1:(e.preventDefault(),w=-1);break;case 40:e.shiftKey?d=-1:(e.preventDefault(),w=1);break;default:return}return this._rotationDisabled&&(u=0,d=0),{cameraAnimation:C=>{const S=this._tr;C.easeTo({duration:300,easeId:"keyboardHandler",easing:rn,zoom:o?Math.round(S.zoom)+o*(e.shiftKey?2:1):S.zoom,bearing:S.bearing+u*this._bearingStep,pitch:S.pitch+d*this._pitchStep,offset:[-y*this._panStep,-w*this._panStep],center:S.center},{originalEvent:e})}}}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 rn(_){return _*(2-_)}const Jl=4.000244140625;class Or{constructor(e,o){this._onTimeout=u=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(u)},this._map=e,this._tr=new Rr(e),this._triggerRenderFrame=o,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let o=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const u=B.now(),d=u-(this._lastWheelEventTime||0);this._lastWheelEventTime=u,o!==0&&o%Jl==0?this._type="wheel":o!==0&&Math.abs(o)<4?this._type="trackpad":d>400?(this._type=null,this._lastValue=o,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(d*o)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,o+=this._lastValue)),e.shiftKey&&o&&(o/=4),this._type&&(this._lastWheelEvent=e,this._delta-=o,this._active||this._start(e)),e.preventDefault()}_start(e){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 o=U.mousePos(this._map.getCanvas(),e),u=this._tr;this._around=o.y>u.transform.height/2-u.transform.getHorizon()?h.N.convert(this._aroundCenter?u.center:u.unproject(o)):h.N.convert(u.center),this._aroundPoint=u.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const e=this._tr.transform;if(this._delta!==0){const S=this._type==="wheel"&&Math.abs(this._delta)>Jl?this._wheelZoomRate:this._defaultZoomRate;let T=2/(1+Math.exp(-Math.abs(this._delta*S)));this._delta<0&&T!==0&&(T=1/T);const z=typeof this._targetZoom=="number"?e.zoomScale(this._targetZoom):e.scale;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(z*T))),this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const o=typeof this._targetZoom=="number"?this._targetZoom:e.zoom,u=this._startZoom,d=this._easing;let y,w=!1;const C=B.now()-this._lastWheelEventTime;if(this._type==="wheel"&&u&&d&&C){const S=Math.min(C/200,1),T=d(S);y=h.y.number(u,o,T),S<1?this._frameId||(this._frameId=!0):w=!0}else y=o,w=!0;return this._active=!0,w&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!w,zoomDelta:y-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let o=h.b9;if(this._prevEase){const u=this._prevEase,d=(B.now()-u.start)/u.duration,y=u.easing(d+.01)-u.easing(d),w=.27/Math.sqrt(y*y+1e-4)*.01,C=Math.sqrt(.0729-w*w);o=h.b8(w,C,.25,1)}return this._prevEase={start:B.now(),duration:e,easing:o},o}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class is{constructor(e,o){this._clickZoom=e,this._tapZoom=o}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 hd{constructor(e){this._tr=new Rr(e),this.reset()}reset(){this._active=!1}dblclick(e,o){return e.preventDefault(),{cameraAnimation:u=>{u.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(o)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class cd{constructor(){this._tap=new _a({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(e,o,u){if(!this._swipePoint)if(this._tapTime){const d=o[0],y=e.timeStamp-this._tapTime<500,w=this._tapPoint.dist(d)<30;y&&w?u.length>0&&(this._swipePoint=d,this._swipeTouch=u[0].identifier):this.reset()}else this._tap.touchstart(e,o,u)}touchmove(e,o,u){if(this._tapTime){if(this._swipePoint){if(u[0].identifier!==this._swipeTouch)return;const d=o[0],y=d.y-this._swipePoint.y;return this._swipePoint=d,e.preventDefault(),this._active=!0,{zoomDelta:y/128}}}else this._tap.touchmove(e,o,u)}touchend(e,o,u){if(this._tapTime)this._swipePoint&&u.length===0&&this.reset();else{const d=this._tap.touchend(e,o,u);d&&(this._tapTime=e.timeStamp,this._tapPoint=d)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ac{constructor(e,o,u){this._el=e,this._mousePan=o,this._touchPan=u}enable(e){this._inertiaOptions=e||{},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 zc{constructor(e,o,u){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=o,this._mousePitch=u}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 Kl{constructor(e,o,u,d){this._el=e,this._touchZoom=o,this._touchRotate=u,this._tapDragZoom=d,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),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 zs{constructor(e,o){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=o,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=U.create("div","maplibregl-cooperative-gesture-screen",e);let o=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(o=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const u=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),d=document.createElement("div");d.className="maplibregl-desktop-message",d.textContent=o,this._container.appendChild(d);const y=document.createElement("div");y.className="maplibregl-mobile-message",y.textContent=u,this._container.appendChild(y),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(U.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._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,o){this._enabled&&(this._map.fire(new h.k("cooperativegestureprevented",{gestureType:e,originalEvent:o})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Ir=_=>_.zoom||_.drag||_.pitch||_.rotate;class Ve extends h.k{}function Ia(_){return _.panDelta&&_.panDelta.mag()||_.zoomDelta||_.bearingDelta||_.pitchDelta}class Yl{constructor(e,o){this.handleWindowEvent=d=>{this.handleEvent(d,`${d.type}Window`)},this.handleEvent=(d,y)=>{if(d.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const w=d.type==="renderFrame"?void 0:d,C={needsRenderFrame:!1},S={},T={},z=d.touches,k=z?this._getMapTouches(z):void 0,N=k?U.touchPos(this._map.getCanvas(),k):U.mousePos(this._map.getCanvas(),d);for(const{handlerName:J,handler:Q,allowed:ee}of this._handlers){if(!Q.isEnabled())continue;let ie;this._blockedByActive(T,ee,J)?Q.reset():Q[y||d.type]&&(ie=Q[y||d.type](d,N,k),this.mergeHandlerResult(C,S,ie,J,w),ie&&ie.needsRenderFrame&&this._triggerRenderFrame()),(ie||Q.isActive())&&(T[J]=Q)}const q={};for(const J in this._previousActiveHandlers)T[J]||(q[J]=w);this._previousActiveHandlers=T,(Object.keys(q).length||Ia(C))&&(this._changes.push([C,S,q]),this._triggerRenderFrame()),(Object.keys(T).length||Ia(C))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:G}=C;G&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],G(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Nl(e),this._bearingSnap=o.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(o);const u=this._el;this._listeners=[[u,"touchstart",{passive:!0}],[u,"touchmove",{passive:!1}],[u,"touchend",void 0],[u,"touchcancel",void 0],[u,"mousedown",void 0],[u,"mousemove",void 0],[u,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[u,"mouseover",void 0],[u,"mouseout",void 0],[u,"dblclick",void 0],[u,"click",void 0],[u,"keydown",{capture:!1}],[u,"keyup",void 0],[u,"wheel",{passive:!1}],[u,"contextmenu",void 0],[window,"blur",void 0]];for(const[d,y,w]of this._listeners)U.addEventListener(d,y,d===document?this.handleWindowEvent:this.handleEvent,w)}destroy(){for(const[e,o,u]of this._listeners)U.removeEventListener(e,o,e===document?this.handleWindowEvent:this.handleEvent,u)}_addDefaultHandlers(e){const o=this._map,u=o.getCanvasContainer();this._add("mapEvent",new Ec(o,e));const d=o.boxZoom=new hr(o,e);this._add("boxZoom",d),e.interactive&&e.boxZoom&&d.enable();const y=o.cooperativeGestures=new zs(o,e.cooperativeGestures);this._add("cooperativeGestures",y),e.cooperativeGestures&&y.enable();const w=new Ts(o),C=new hd(o);o.doubleClickZoom=new is(C,w),this._add("tapZoom",w),this._add("clickZoom",C),e.interactive&&e.doubleClickZoom&&o.doubleClickZoom.enable();const S=new cd;this._add("tapDragZoom",S);const T=o.touchPitch=new As(o);this._add("touchPitch",T),e.interactive&&e.touchPitch&&o.touchPitch.enable(e.touchPitch);const z=ql(e),k=Zl(e);o.dragRotate=new zc(e,z,k),this._add("mouseRotate",z,["mousePitch"]),this._add("mousePitch",k,["mouseRotate"]),e.interactive&&e.dragRotate&&o.dragRotate.enable();const N=(({enable:ie,clickTolerance:X})=>{const se=new va({checkCorrectEvent:ae=>U.mouseButton(ae)===0&&!ae.ctrlKey});return new yn({clickTolerance:X,move:(ae,de)=>({around:de,panDelta:de.sub(ae)}),activateOnStart:!0,moveStateManager:se,enable:ie,assignEvents:xa})})(e),q=new ts(e,o);o.dragPan=new Ac(u,N,q),this._add("mousePan",N),this._add("touchPan",q,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&o.dragPan.enable(e.dragPan);const G=new Hl,J=new Xl;o.touchZoomRotate=new Kl(u,J,G,S),this._add("touchRotate",G,["touchPan","touchZoom"]),this._add("touchZoom",J,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&o.touchZoomRotate.enable(e.touchZoomRotate);const Q=o.scrollZoom=new Or(o,()=>this._triggerRenderFrame());this._add("scrollZoom",Q,["mousePan"]),e.interactive&&e.scrollZoom&&o.scrollZoom.enable(e.scrollZoom);const ee=o.keyboard=new wr(o);this._add("keyboard",ee),e.interactive&&e.keyboard&&o.keyboard.enable(),this._add("blockableMapEvent",new li(o))}_add(e,o,u){this._handlers.push({handlerName:e,handler:o,allowed:u}),this._handlersById[e]=o}stop(e){if(!this._updatingCamera){for(const{handler:o}of this._handlers)o.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Ir(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,o,u){for(const d in e)if(d!==u&&(!o||o.indexOf(d)<0))return!0;return!1}_getMapTouches(e){const o=[];for(const u of e)this._el.contains(u.target)&&o.push(u);return o}mergeHandlerResult(e,o,u,d,y){if(!u)return;h.e(e,u);const w={handlerName:d,originalEvent:u.originalEvent||y};u.zoomDelta!==void 0&&(o.zoom=w),u.panDelta!==void 0&&(o.drag=w),u.pitchDelta!==void 0&&(o.pitch=w),u.bearingDelta!==void 0&&(o.rotate=w)}_applyChanges(){const e={},o={},u={};for(const[d,y,w]of this._changes)d.panDelta&&(e.panDelta=(e.panDelta||new h.P(0,0))._add(d.panDelta)),d.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+d.zoomDelta),d.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+d.bearingDelta),d.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+d.pitchDelta),d.around!==void 0&&(e.around=d.around),d.pinchAround!==void 0&&(e.pinchAround=d.pinchAround),d.noInertia&&(e.noInertia=d.noInertia),h.e(o,y),h.e(u,w);this._updateMapTransform(e,o,u),this._changes=[]}_updateMapTransform(e,o,u){const d=this._map,y=d._getTransformForUpdate(),w=d.terrain;if(!(Ia(e)||w&&this._terrainMovement))return this._fireEvents(o,u,!0);let{panDelta:C,zoomDelta:S,bearingDelta:T,pitchDelta:z,around:k,pinchAround:N}=e;N!==void 0&&(k=N),d._stop(!0),k=k||d.transform.centerPoint;const q=y.pointLocation(C?k.sub(C):k);T&&(y.bearing+=T),z&&(y.pitch+=z),S&&(y.zoom+=S),w?this._terrainMovement||!o.drag&&!o.zoom?o.drag&&this._terrainMovement?y.center=y.pointLocation(y.centerPoint.sub(C)):y.setLocationAtPoint(q,k):(this._terrainMovement=!0,this._map._elevationFreeze=!0,y.setLocationAtPoint(q,k)):y.setLocationAtPoint(q,k),d._applyUpdatedTransform(y),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(o,u,!0)}_fireEvents(e,o,u){const d=Ir(this._eventsInProgress),y=Ir(e),w={};for(const k in e){const{originalEvent:N}=e[k];this._eventsInProgress[k]||(w[`${k}start`]=N),this._eventsInProgress[k]=e[k]}!d&&y&&this._fireEvent("movestart",y.originalEvent);for(const k in w)this._fireEvent(k,w[k]);y&&this._fireEvent("move",y.originalEvent);for(const k in e){const{originalEvent:N}=e[k];this._fireEvent(k,N)}const C={};let S;for(const k in this._eventsInProgress){const{handlerName:N,originalEvent:q}=this._eventsInProgress[k];this._handlersById[N].isActive()||(delete this._eventsInProgress[k],S=o[N]||q,C[`${k}end`]=S)}for(const k in C)this._fireEvent(k,C[k]);const T=Ir(this._eventsInProgress),z=(d||y)&&!T;if(z&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const k=this._map._getTransformForUpdate();k.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(k)}if(u&&z){this._updatingCamera=!0;const k=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),N=q=>q!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new Ve("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class kc extends h.E{constructor(e,o){super(),this._renderFrameCallback=()=>{const u=Math.min((B.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(u)),u<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=o.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new h.N(this.transform.center.lng,this.transform.center.lat)}setCenter(e,o){return this.jumpTo({center:e},o)}panBy(e,o,u){return e=h.P.convert(e).mult(-1),this.panTo(this.transform.center,h.e({offset:e},o),u)}panTo(e,o,u){return this.easeTo(h.e({center:e},o),u)}getZoom(){return this.transform.zoom}setZoom(e,o){return this.jumpTo({zoom:e},o),this}zoomTo(e,o,u){return this.easeTo(h.e({zoom:e},o),u)}zoomIn(e,o){return this.zoomTo(this.getZoom()+1,e,o),this}zoomOut(e,o){return this.zoomTo(this.getZoom()-1,e,o),this}getBearing(){return this.transform.bearing}setBearing(e,o){return this.jumpTo({bearing:e},o),this}getPadding(){return this.transform.padding}setPadding(e,o){return this.jumpTo({padding:e},o),this}rotateTo(e,o,u){return this.easeTo(h.e({bearing:e},o),u)}resetNorth(e,o){return this.rotateTo(0,h.e({duration:1e3},e),o),this}resetNorthPitch(e,o){return this.easeTo(h.e({bearing:0,pitch:0,duration:1e3},e),o),this}snapToNorth(e,o){return Math.abs(this.getBearing()){if(this._zooming&&(d.zoom=h.y.number(y,Q,xe)),this._rotating&&(d.bearing=h.y.number(w,T,xe)),this._pitching&&(d.pitch=h.y.number(C,z,xe)),this._padding&&(d.interpolatePadding(S,k,xe),q=d.centerPoint.add(N)),this.terrain&&!e.freezeElevation&&this._updateElevation(xe),se)d.setLocationAtPoint(se,ae);else{const Ie=d.zoomScale(d.zoom-y),ke=Q>y?Math.min(2,X):Math.max(.5,X),Fe=Math.pow(ke,1-xe),Ee=d.unproject(ee.add(ie.mult(xe*Fe)).mult(Ie));d.setLocationAtPoint(d.renderWorldCopies?Ee.wrap():Ee,q)}this._applyUpdatedTransform(d),this._fireMoveEvents(o)},xe=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(o,xe)},e),this}_prepareEase(e,o,u={}){this._moving=!0,o||u.moving||this.fire(new h.k("movestart",e)),this._zooming&&!u.zooming&&this.fire(new h.k("zoomstart",e)),this._rotating&&!u.rotating&&this.fire(new h.k("rotatestart",e)),this._pitching&&!u.pitching&&this.fire(new h.k("pitchstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const o=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&o!==this._elevationTarget){const u=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(u-(o-(u*e+this._elevationStart))/(1-e)),this._elevationTarget=o}this.transform.elevation=h.y.number(this._elevationStart,this._elevationTarget,e)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){const o=e.getCameraPosition(),u=this.terrain.getElevationForLngLatZoom(o.lngLat,e.zoom);if(o.altitudethis._elevateCameraIfInsideTerrain(d)),this.transformCameraUpdate&&o.push(d=>this.transformCameraUpdate(d)),!o.length)return;const u=e.clone();for(const d of o){const y=u.clone(),{center:w,zoom:C,pitch:S,bearing:T,elevation:z}=d(y);w&&(y.center=w),C!==void 0&&(y.zoom=C),S!==void 0&&(y.pitch=S),T!==void 0&&(y.bearing=T),z!==void 0&&(y.elevation=z),u.apply(y)}this.transform.apply(u)}_fireMoveEvents(e){this.fire(new h.k("move",e)),this._zooming&&this.fire(new h.k("zoom",e)),this._rotating&&this.fire(new h.k("rotate",e)),this._pitching&&this.fire(new h.k("pitch",e))}_afterEase(e,o){if(this._easeId&&o&&this._easeId===o)return;delete this._easeId;const u=this._zooming,d=this._rotating,y=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,u&&this.fire(new h.k("zoomend",e)),d&&this.fire(new h.k("rotateend",e)),y&&this.fire(new h.k("pitchend",e)),this.fire(new h.k("moveend",e))}flyTo(e,o){var u;if(!e.essential&&B.prefersReducedMotion){const Le=h.M(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Le,o)}this.stop(),e=h.e({offset:[0,0],speed:1.2,curve:1.42,easing:h.b9},e);const d=this._getTransformForUpdate(),y=d.zoom,w=d.bearing,C=d.pitch,S=d.padding,T="bearing"in e?this._normalizeBearing(e.bearing,w):w,z="pitch"in e?+e.pitch:C,k="padding"in e?e.padding:d.padding,N=h.P.convert(e.offset);let q=d.centerPoint.add(N);const G=d.pointLocation(q),{center:J,zoom:Q}=d.getConstrained(h.N.convert(e.center||G),(u=e.zoom)!==null&&u!==void 0?u:y);this._normalizeCenter(J,d);const ee=d.zoomScale(Q-y),ie=d.project(G),X=d.project(J).sub(ie);let se=e.curve;const ae=Math.max(d.width,d.height),de=ae/ee,xe=X.mag();if("minZoom"in e){const Le=h.ac(Math.min(e.minZoom,y,Q),d.minZoom,d.maxZoom),st=ae/d.zoomScale(Le-y);se=Math.sqrt(st/xe*2)}const Ie=se*se;function ke(Le){const st=(de*de-ae*ae+(Le?-1:1)*Ie*Ie*xe*xe)/(2*(Le?de:ae)*Ie*xe);return Math.log(Math.sqrt(st*st+1)-st)}function Fe(Le){return(Math.exp(Le)-Math.exp(-Le))/2}function Ee(Le){return(Math.exp(Le)+Math.exp(-Le))/2}const Pe=ke(!1);let Ze=function(Le){return Ee(Pe)/Ee(Pe+se*Le)},at=function(Le){return ae*((Ee(Pe)*(Fe(st=Pe+se*Le)/Ee(st))-Fe(Pe))/Ie)/xe;var st},Ae=(ke(!0)-Pe)/se;if(Math.abs(xe)<1e-6||!isFinite(Ae)){if(Math.abs(ae-de)<1e-6)return this.easeTo(e,o);const Le=de0,Ze=st=>Math.exp(Le*se*st)}return e.duration="duration"in e?+e.duration:1e3*Ae/("screenSpeed"in e?+e.screenSpeed/se:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=w!==T,this._pitching=z!==C,this._padding=!d.isPaddingEqual(k),this._prepareEase(o,!1),this.terrain&&this._prepareElevation(J),this._ease(Le=>{const st=Le*Ae,Kt=1/Ze(st);d.zoom=Le===1?Q:y+d.scaleZoom(Kt),this._rotating&&(d.bearing=h.y.number(w,T,Le)),this._pitching&&(d.pitch=h.y.number(C,z,Le)),this._padding&&(d.interpolatePadding(S,k,Le),q=d.centerPoint.add(N)),this.terrain&&!e.freezeElevation&&this._updateElevation(Le);const dt=Le===1?J:d.unproject(ie.add(X.mult(at(st))).mult(Kt));d.setLocationAtPoint(d.renderWorldCopies?dt.wrap():dt,q),this._applyUpdatedTransform(d),this._fireMoveEvents(o)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(o)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,o){var u;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const d=this._onEaseEnd;delete this._onEaseEnd,d.call(this,o)}return e||(u=this.handlers)===null||u===void 0||u.stop(!1),this}_ease(e,o,u){u.animate===!1||u.duration===0?(e(1),o()):(this._easeStart=B.now(),this._easeOptions=u,this._onEaseFrame=e,this._onEaseEnd=o,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,o){e=h.b3(e,-180,180);const u=Math.abs(e-o);return Math.abs(e-360-o)180?-360:u<-180?360:0}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(h.N.convert(e),this.transform.tileZoom)-this.transform.elevation:null}}const ks={compact:!0,customAttribution:'MapLibre'};class Ds{constructor(e=ks){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=o=>{!o||o.sourceDataType!=="metadata"&&o.sourceDataType!=="visibility"&&o.dataType!=="style"&&o.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=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=U.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=U.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=U.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(){U.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(e,o){const u=this._map._getUIString(`AttributionControl.${o}`);e.title=u,e.setAttribute("aria-label",u)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(d=>typeof d!="string"?"":d)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const d=this._map.style.stylesheet;this.styleOwner=d.owner,this.styleId=d.id}const o=this._map.style.sourceCaches;for(const d in o){const y=o[d];if(y.used||y.usedForTerrain){const w=y.getSource();w.attribution&&e.indexOf(w.attribution)<0&&e.push(w.attribution)}}e=e.filter(d=>String(d).trim()),e.sort((d,y)=>d.length-y.length),e=e.filter((d,y)=>{for(let w=y+1;w=0)return!1;return!0});const u=e.join(" | ");u!==this._attribHTML&&(this._attribHTML=u,e.length?(this._innerContainer.innerHTML=u,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Ql{constructor(e={}){this._updateCompact=()=>{const o=this._container.children;if(o.length){const u=o[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&u.classList.add("maplibregl-compact"):u.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=U.create("div","maplibregl-ctrl");const o=U.create("a","maplibregl-ctrl-logo");return o.target="_blank",o.rel="noopener nofollow",o.href="https://maplibre.org/",o.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),o.setAttribute("rel","noopener nofollow"),this._container.appendChild(o),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){U.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class vt{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const o=++this._id;return this._queue.push({callback:e,id:o,cancelled:!1}),o}remove(e){const o=this._currentlyRunning,u=o?this._queue.concat(o):this._queue;for(const d of u)if(d.id===e)return void(d.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const o=this._currentlyRunning=this._queue;this._queue=[];for(const u of o)if(!u.cancelled&&(u.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var eh=h.Y([{name:"a_pos3d",type:"Int16",components:3}]);class ud extends h.E{constructor(e){super(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,e.usedForTerrain=!0,e.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,o){this.sourceCache.update(e,o),this._renderableTilesKeys=[];const u={};for(const d of e.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:o}))u[d.key]=!0,this._renderableTilesKeys.push(d.key),this._tiles[d.key]||(d.posMatrix=new Float64Array(16),h.aP(d.posMatrix,0,h.X,0,h.X,0,1),this._tiles[d.key]=new Mn(d,this.tileSize));for(const d in this._tiles)u[d]||delete this._tiles[d]}freeRtt(e){for(const o in this._tiles){const u=this._tiles[o];(!e||u.tileID.equals(e)||u.tileID.isChildOf(e)||e.isChildOf(u.tileID))&&(u.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e){const o={};for(const u of this._renderableTilesKeys){const d=this._tiles[u].tileID;if(d.canonical.equals(e.canonical)){const y=e.clone();y.posMatrix=new Float64Array(16),h.aP(y.posMatrix,0,h.X,0,h.X,0,1),o[u]=y}else if(d.canonical.isChildOf(e.canonical)){const y=e.clone();y.posMatrix=new Float64Array(16);const w=d.canonical.z-e.canonical.z,C=d.canonical.x-(d.canonical.x>>w<>w<>w;h.aP(y.posMatrix,0,T,0,T,0,1),h.J(y.posMatrix,y.posMatrix,[-C*T,-S*T,0]),o[u]=y}else if(e.canonical.isChildOf(d.canonical)){const y=e.clone();y.posMatrix=new Float64Array(16);const w=e.canonical.z-d.canonical.z,C=e.canonical.x-(e.canonical.x>>w<>w<>w;h.aP(y.posMatrix,0,h.X,0,h.X,0,1),h.J(y.posMatrix,y.posMatrix,[C*T,S*T,0]),h.K(y.posMatrix,y.posMatrix,[1/2**w,1/2**w,0]),o[u]=y}}return o}getSourceTile(e,o){const u=this.sourceCache._source;let d=e.overscaledZ-this.deltaZoom;if(d>u.maxzoom&&(d=u.maxzoom),d=u.minzoom&&(!y||!y.dem);)y=this.sourceCache.getTileByID(e.scaledTo(d--).key);return y}tilesAfterTime(e=Date.now()){return Object.values(this._tiles).filter(o=>o.timeAdded>=e)}}class th{constructor(e,o,u){this.painter=e,this.sourceCache=new ud(o),this.options=u,this.exaggeration=typeof u.exaggeration=="number"?u.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,o,u,d=h.X){var y;if(!(o>=0&&o=0&&ue.canonical.z&&(e.canonical.z>=d?y=e.canonical.z-d:h.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const w=e.canonical.x-(e.canonical.x>>y<>y<>8<<4|y>>8,o[w+3]=0;const u=new h.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(o.buffer)),d=new Ye(e,u,e.gl.RGBA,{premultiply:!1});return d.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=d,d}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const o=new Uint8Array(4),u=this.painter.context,d=u.gl,y=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),w=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),C=Math.round(this.painter.height/devicePixelRatio);u.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),d.readPixels(y,C-w-1,1,1,d.RGBA,d.UNSIGNED_BYTE,o),u.bindFramebuffer.set(null);const S=o[0]+(o[2]>>4<<8),T=o[1]+((15&o[2])<<8),z=this.coordsIndex[255-o[3]],k=z&&this.sourceCache.getTileByID(z);if(!k)return null;const N=this._coordsTextureSize,q=(1<e.id!==o),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(const o of this._recentlyUsed)if(!this._objects[o].inUse)return this._objects[o];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(const e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length!e.inUse)===!1}}const Ls={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Dc{constructor(e,o){this.painter=e,this.terrain=o,this.pool=new dd(e.context,30,o.sourceCache.tileSize*o.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,o){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(u=>!e._layers[u].isHidden(o)),this._coordsDescendingInv={};for(const u in e.sourceCaches){this._coordsDescendingInv[u]={};const d=e.sourceCaches[u].getVisibleCoordinates();for(const y of d){const w=this.terrain.sourceCache.getTerrainCoords(y);for(const C in w)this._coordsDescendingInv[u][C]||(this._coordsDescendingInv[u][C]=[]),this._coordsDescendingInv[u][C].push(w[C])}}this._coordsDescendingInvStr={};for(const u of e._order){const d=e._layers[u],y=d.source;if(Ls[d.type]&&!this._coordsDescendingInvStr[y]){this._coordsDescendingInvStr[y]={};for(const w in this._coordsDescendingInv[y])this._coordsDescendingInvStr[y][w]=this._coordsDescendingInv[y][w].map(C=>C.key).sort().join()}}for(const u of this._renderableTiles)for(const d in this._coordsDescendingInvStr){const y=this._coordsDescendingInvStr[d][u.tileID.key];y&&y!==u.rttCoords[d]&&(u.rtt=[])}}renderLayer(e){if(e.isHidden(this.painter.transform.zoom))return!1;const o=e.type,u=this.painter,d=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(Ls[o]&&(this._prevType&&Ls[this._prevType]||this._stacks.push([]),this._prevType=o,this._stacks[this._stacks.length-1].push(e.id),!d))return!0;if(Ls[this._prevType]||Ls[o]&&d){this._prevType=o;const y=this._stacks.length-1,w=this._stacks[y]||[];for(const C of this._renderableTiles){if(this.pool.isFull()&&(Sc(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(C),C.rtt[y]){const T=this.pool.getObjectForId(C.rtt[y].id);if(T.stamp===C.rtt[y].stamp){this.pool.useObject(T);continue}}const S=this.pool.getOrCreateFreeObject();this.pool.useObject(S),this.pool.stampObject(S),C.rtt[y]={id:S.id,stamp:S.stamp},u.context.bindFramebuffer.set(S.fbo.framebuffer),u.context.clear({color:h.aM.transparent,stencil:0}),u.currentStencilSource=void 0;for(let T=0;T{_.touchstart=_.dragStart,_.touchmoveWindow=_.dragMove,_.touchend=_.dragEnd},fd={showCompass:!0,showZoom:!0,visualizePitch:!1};class md{constructor(e,o,u=!1){this.mousedown=w=>{this.startMouse(h.e({},w,{ctrlKey:!0,preventDefault:()=>w.preventDefault()}),U.mousePos(this.element,w)),U.addEventListener(window,"mousemove",this.mousemove),U.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=w=>{this.moveMouse(w,U.mousePos(this.element,w))},this.mouseup=w=>{this.mouseRotate.dragEnd(w),this.mousePitch&&this.mousePitch.dragEnd(w),this.offTemp()},this.touchstart=w=>{w.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=U.touchPos(this.element,w.targetTouches)[0],this.startTouch(w,this._startPos),U.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),U.addEventListener(window,"touchend",this.touchend))},this.touchmove=w=>{w.targetTouches.length!==1?this.reset():(this._lastPos=U.touchPos(this.element,w.targetTouches)[0],this.moveTouch(w,this._lastPos))},this.touchend=w=>{w.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 d=e.dragRotate._mouseRotate.getClickTolerance(),y=e.dragRotate._mousePitch.getClickTolerance();this.element=o,this.mouseRotate=ql({clickTolerance:d,enable:!0}),this.touchRotate=(({enable:w,clickTolerance:C,bearingDegreesPerPixelMoved:S=.8})=>{const T=new $l;return new yn({clickTolerance:C,move:(z,k)=>({bearingDelta:(k.x-z.x)*S}),moveStateManager:T,enable:w,assignEvents:rh})})({clickTolerance:d,enable:!0}),this.map=e,u&&(this.mousePitch=Zl({clickTolerance:y,enable:!0}),this.touchPitch=(({enable:w,clickTolerance:C,pitchDegreesPerPixelMoved:S=-.5})=>{const T=new $l;return new yn({clickTolerance:C,move:(z,k)=>({pitchDelta:(k.y-z.y)*S}),moveStateManager:T,enable:w,assignEvents:rh})})({clickTolerance:y,enable:!0})),U.addEventListener(o,"mousedown",this.mousedown),U.addEventListener(o,"touchstart",this.touchstart,{passive:!1}),U.addEventListener(o,"touchcancel",this.reset)}startMouse(e,o){this.mouseRotate.dragStart(e,o),this.mousePitch&&this.mousePitch.dragStart(e,o),U.disableDrag()}startTouch(e,o){this.touchRotate.dragStart(e,o),this.touchPitch&&this.touchPitch.dragStart(e,o),U.disableDrag()}moveMouse(e,o){const u=this.map,{bearingDelta:d}=this.mouseRotate.dragMove(e,o)||{};if(d&&u.setBearing(u.getBearing()+d),this.mousePitch){const{pitchDelta:y}=this.mousePitch.dragMove(e,o)||{};y&&u.setPitch(u.getPitch()+y)}}moveTouch(e,o){const u=this.map,{bearingDelta:d}=this.touchRotate.dragMove(e,o)||{};if(d&&u.setBearing(u.getBearing()+d),this.touchPitch){const{pitchDelta:y}=this.touchPitch.dragMove(e,o)||{};y&&u.setPitch(u.getPitch()+y)}}off(){const e=this.element;U.removeEventListener(e,"mousedown",this.mousedown),U.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),U.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),U.removeEventListener(window,"touchend",this.touchend),U.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){U.enableDrag(),U.removeEventListener(window,"mousemove",this.mousemove),U.removeEventListener(window,"mouseup",this.mouseup),U.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),U.removeEventListener(window,"touchend",this.touchend)}}let cr;function Jt(_,e,o){const u=new h.N(_.lng,_.lat);if(_=new h.N(_.lng,_.lat),e){const d=new h.N(_.lng-360,_.lat),y=new h.N(_.lng+360,_.lat),w=o.locationPoint(_).distSqr(e);o.locationPoint(d).distSqr(e)180;){const d=o.locationPoint(_);if(d.x>=0&&d.y>=0&&d.x<=o.width&&d.y<=o.height)break;_.lng>o.center.lng?_.lng-=360:_.lng+=360}return _.lng!==u.lng&&o.locationPoint(_).y>o.height/2-o.getHorizon()?_:u}const Bs={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 Ca(_,e,o){const u=_.classList;for(const d in Bs)u.remove(`maplibregl-${o}-anchor-${d}`);u.add(`maplibregl-${o}-anchor-${e}`)}class Sa extends h.E{constructor(e){if(super(),this._onKeyPress=o=>{const u=o.code,d=o.charCode||o.keyCode;u!=="Space"&&u!=="Enter"&&d!==32&&d!==13||this.togglePopup()},this._onMapClick=o=>{const u=o.originalEvent.target,d=this._element;this._popup&&(u===d||d.contains(u))&&this.togglePopup()},this._update=o=>{var u;if(!this._map)return;const d=this._map.loaded()&&!this._map.isMoving();((o==null?void 0:o.type)==="terrain"||(o==null?void 0:o.type)==="render"&&!d)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Jt(this._lngLat,this._flatPos,this._map.transform):(u=this._lngLat)===null||u===void 0?void 0:u.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let y="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?y=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(y=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let w="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?w="rotateX(0deg)":this._pitchAlignment==="map"&&(w=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||o&&o.type!=="moveend"||(this._pos=this._pos.round()),U.setTransform(this._element,`${Bs[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${w} ${y}`),B.frameAsync(new AbortController).then(()=>{this._updateOpacity(o&&o.type==="moveend")}).catch(()=>{})},this._onMove=o=>{if(!this._isDragging){const u=this._clickTolerance||this._map._clickTolerance;this._isDragging=o.point.dist(this._pointerdownPos)>=u}this._isDragging&&(this._pos=o.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 h.k("dragstart"))),this.fire(new h.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 h.k("dragend")),this._state="inactive"},this._addDragHandler=o=>{this._element.contains(o.originalEvent.target)&&(o.preventDefault(),this._positionDelta=o.point.sub(this._pos).add(this._offset),this._pointerdownPos=o.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=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(e==null?void 0:e.opacity,e==null?void 0:e.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=h.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=U.create("div");const o=U.createNS("http://www.w3.org/2000/svg","svg"),u=41,d=27;o.setAttributeNS(null,"display","block"),o.setAttributeNS(null,"height",`${u}px`),o.setAttributeNS(null,"width",`${d}px`),o.setAttributeNS(null,"viewBox",`0 0 ${d} ${u}`);const y=U.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"stroke","none"),y.setAttributeNS(null,"stroke-width","1"),y.setAttributeNS(null,"fill","none"),y.setAttributeNS(null,"fill-rule","evenodd");const w=U.createNS("http://www.w3.org/2000/svg","g");w.setAttributeNS(null,"fill-rule","nonzero");const C=U.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"transform","translate(3.0, 29.0)"),C.setAttributeNS(null,"fill","#000000");const S=[{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 ee of S){const ie=U.createNS("http://www.w3.org/2000/svg","ellipse");ie.setAttributeNS(null,"opacity","0.04"),ie.setAttributeNS(null,"cx","10.5"),ie.setAttributeNS(null,"cy","5.80029008"),ie.setAttributeNS(null,"rx",ee.rx),ie.setAttributeNS(null,"ry",ee.ry),C.appendChild(ie)}const T=U.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill",this._color);const z=U.createNS("http://www.w3.org/2000/svg","path");z.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),T.appendChild(z);const k=U.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"opacity","0.25"),k.setAttributeNS(null,"fill","#000000");const N=U.createNS("http://www.w3.org/2000/svg","path");N.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"),k.appendChild(N);const q=U.createNS("http://www.w3.org/2000/svg","g");q.setAttributeNS(null,"transform","translate(6.0, 7.0)"),q.setAttributeNS(null,"fill","#FFFFFF");const G=U.createNS("http://www.w3.org/2000/svg","g");G.setAttributeNS(null,"transform","translate(8.0, 8.0)");const J=U.createNS("http://www.w3.org/2000/svg","circle");J.setAttributeNS(null,"fill","#000000"),J.setAttributeNS(null,"opacity","0.25"),J.setAttributeNS(null,"cx","5.5"),J.setAttributeNS(null,"cy","5.5"),J.setAttributeNS(null,"r","5.4999962");const Q=U.createNS("http://www.w3.org/2000/svg","circle");Q.setAttributeNS(null,"fill","#FFFFFF"),Q.setAttributeNS(null,"cx","5.5"),Q.setAttributeNS(null,"cy","5.5"),Q.setAttributeNS(null,"r","5.4999962"),G.appendChild(J),G.appendChild(Q),w.appendChild(C),w.appendChild(T),w.appendChild(k),w.appendChild(q),w.appendChild(G),o.appendChild(w),o.setAttributeNS(null,"height",u*this._scale+"px"),o.setAttributeNS(null,"width",d*this._scale+"px"),this._element.appendChild(o),this._offset=h.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",o=>{o.preventDefault()}),this._element.addEventListener("mousedown",o=>{o.preventDefault()}),Ca(this._element,this._anchor,"marker"),e&&e.className)for(const o of e.className.split(" "))this._element.classList.add(o);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.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),U.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=h.N.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const d=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[d,-1*(38.1-13.5+d)],"bottom-right":[-d,-1*(38.1-13.5+d)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){const e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var o,u;if(!(!((o=this._map)===null||o===void 0)&&o.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const d=this._map,y=d.terrain.depthAtPoint(this._pos),w=d.terrain.getElevationForLngLatZoom(this._lngLat,d.transform.tileZoom);if(d.transform.lngLatToCameraDepth(this._lngLat,w)-y<.006)return void(this._element.style.opacity=this._opacity);const C=-this._offset.y/d.transform._pixelPerMeter,S=Math.sin(d.getPitch()*Math.PI/180)*C,T=d.terrain.depthAtPoint(new h.P(this._pos.x,this._pos.y-this._offset.y)),z=d.transform.lngLatToCameraDepth(this._lngLat,w+S)-T>.006;!((u=this._popup)===null||u===void 0)&&u.isOpen()&&z&&this._popup.remove(),this._element.style.opacity=z?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=h.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(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(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,o){return e===void 0&&o===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),o!==void 0&&(this._opacityWhenCovered=o),this._map&&this._updateOpacity(!0),this}}const Bc={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Po=0,Eo=!1;const nn={maxWidth:100,unit:"metric"};function To(_,e,o){const u=o&&o.maxWidth||100,d=_._container.clientHeight/2,y=_.unproject([0,d]),w=_.unproject([u,d]),C=y.distanceTo(w);if(o&&o.unit==="imperial"){const S=3.2808*C;S>5280?qe(e,u,S/5280,_._getUIString("ScaleControl.Miles")):qe(e,u,S,_._getUIString("ScaleControl.Feet"))}else o&&o.unit==="nautical"?qe(e,u,C/1852,_._getUIString("ScaleControl.NauticalMiles")):C>=1e3?qe(e,u,C/1e3,_._getUIString("ScaleControl.Kilometers")):qe(e,u,C,_._getUIString("ScaleControl.Meters"))}function qe(_,e,o,u){const d=function(y){const w=Math.pow(10,`${Math.floor(y)}`.length-1);let C=y/w;return C=C>=10?10:C>=5?5:C>=3?3:C>=2?2:C>=1?1:function(S){const T=Math.pow(10,Math.ceil(-Math.log(S)/Math.LN10));return Math.round(S*T)/T}(C),w*C}(o);_.style.width=e*(d/o)+"px",_.innerHTML=`${d} ${u}`}const tt={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Ma=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Pa(_){if(_){if(typeof _=="number"){const e=Math.round(Math.abs(_)/Math.SQRT2);return{center:new h.P(0,0),top:new h.P(0,_),"top-left":new h.P(e,e),"top-right":new h.P(-e,e),bottom:new h.P(0,-_),"bottom-left":new h.P(e,-e),"bottom-right":new h.P(-e,-e),left:new h.P(_,0),right:new h.P(-_,0)}}if(_ instanceof h.P||Array.isArray(_)){const e=h.P.convert(_);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:h.P.convert(_.center||[0,0]),top:h.P.convert(_.top||[0,0]),"top-left":h.P.convert(_["top-left"]||[0,0]),"top-right":h.P.convert(_["top-right"]||[0,0]),bottom:h.P.convert(_.bottom||[0,0]),"bottom-left":h.P.convert(_["bottom-left"]||[0,0]),"bottom-right":h.P.convert(_["bottom-right"]||[0,0]),left:h.P.convert(_.left||[0,0]),right:h.P.convert(_.right||[0,0])}}return Pa(new h.P(0,0))}const nh=P;m.AJAXError=h.bh,m.Evented=h.E,m.LngLat=h.N,m.MercatorCoordinate=h.Z,m.Point=h.P,m.addProtocol=h.bi,m.config=h.a,m.removeProtocol=h.bj,m.AttributionControl=Ds,m.BoxZoomHandler=hr,m.CanvasSource=vr,m.CooperativeGesturesHandler=zs,m.DoubleClickZoomHandler=is,m.DragPanHandler=Ac,m.DragRotateHandler=zc,m.EdgeInsets=Ps,m.FullscreenControl=class extends h.E{constructor(_={}){super(),this._onFullscreenChange=()=>{var e;let o=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((e=o==null?void 0:o.shadowRoot)===null||e===void 0)&&e.fullscreenElement;)o=o.shadowRoot.fullscreenElement;o===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,_&&_.container&&(_.container instanceof HTMLElement?this._container=_.container:h.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(_){return this._map=_,this._container||(this._container=this._map.getContainer()),this._controlContainer=U.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){U.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const _=this._fullscreenButton=U.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);U.create("span","maplibregl-ctrl-icon",_).setAttribute("aria-hidden","true"),_.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const _=this._getTitle();this._fullscreenButton.setAttribute("aria-label",_),this._fullscreenButton.title=_}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new h.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new h.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()}},m.GeoJSONSource=lo,m.GeolocateControl=class extends h.E{constructor(_){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new h.k("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,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(e),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new h.k("geolocate",e)),this._finish()}},this._updateCamera=e=>{const o=new h.N(e.coords.longitude,e.coords.latitude),u=e.coords.accuracy,d=this._map.getBearing(),y=h.e({bearing:d},this.options.fitBoundsOptions),w=fe.fromLngLat(o,u);this._map.fitBounds(w,y,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const o=new h.N(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(o).addTo(this._map),this._userLocationDotMarker.setLngLat(o).addTo(this._map),this._accuracy=e.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=e=>{if(this._map){if(this.options.trackUserLocation)if(e.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 o=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&Eo)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new h.k("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=U.create("button","maplibregl-ctrl-geolocate",this._container),U.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(e===!1){h.w("Geolocation support is not available so the GeolocateControl will be disabled.");const o=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o)}else{const o=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=U.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Sa({element:this._dotElement}),this._circleElement=U.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Sa({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",o=>{o.geolocateSource||this._watchState!=="ACTIVE_LOCK"||o.originalEvent&&o.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 h.k("trackuserlocationend")),this.fire(new h.k("userlocationlostfocus")))})}},this.options=h.e({},Bc,_)}onAdd(_){return this._map=_,this._container=U.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return h._(this,arguments,void 0,function*(e=!1){if(cr!==void 0&&!e)return cr;if(window.navigator.permissions===void 0)return cr=!!window.navigator.geolocation,cr;try{cr=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{cr=!!window.navigator.geolocation}return cr})}().then(e=>this._finishSetupUI(e)),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(),U.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Po=0,Eo=!1}_isOutOfMapMaxBounds(_){const e=this._map.getMaxBounds(),o=_.coords;return e&&(o.longitudee.getEast()||o.latitudee.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const _=this._map.getBounds(),e=_.getSouthEast(),o=_.getNorthEast(),u=e.distanceTo(o),d=Math.ceil(this._accuracy/(u/this._map._container.clientHeight)*2);this._circleElement.style.width=`${d}px`,this._circleElement.style.height=`${d}px`}trigger(){if(!this._setup)return h.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 h.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Po--,Eo=!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 h.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 h.k("trackuserlocationstart")),this.fire(new h.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 _;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Po++,Po>1?(_={maximumAge:6e5,timeout:0},Eo=!0):(_=this.options.positionOptions,Eo=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,_)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},m.Hash=ma,m.ImageSource=fn,m.KeyboardHandler=wr,m.LngLatBounds=fe,m.LogoControl=Ql,m.Map=class extends kc{constructor(_){h.bf.mark(h.bg.create);const e=Object.assign(Object.assign({},pd),_);if(e.minZoom!=null&&e.maxZoom!=null&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(e.minPitch!=null&&e.maxPitch!=null&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(e.minPitch!=null&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(e.maxPitch!=null&&e.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Es(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies),{bearingSnap:e.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new vt,this._controls=[],this._mapId=h.a4(),this._contextLost=o=>{o.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new h.k("webglcontextlost",{originalEvent:o}))},this._contextRestored=o=>{this._setupPainter(),this.resize(),this._update(),this.fire(new h.k("webglcontextrestored",{originalEvent:o}))},this._onMapScroll=o=>{if(o.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._maxTileCacheZoomLevels=e.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=e.preserveDrawingBuffer===!0,this._antialias=e.antialias===!0,this._trackResize=e.trackResize===!0,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles===!0,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions===!0,this._collectResourceTiming=e.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},ih),e.locale),this._clickTolerance=e.clickTolerance,this._overridePixelRatio=e.pixelRatio,this._maxCanvasSize=e.maxCanvasSize,this.transformCameraUpdate=e.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=e.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=Ue.addThrottleControl(()=>this.isMoving()),this._requestManager=new ut(e.transformRequest),typeof e.container=="string"){if(this._container=document.getElementById(e.container),!this._container)throw new Error(`Container '${e.container}' not found.`)}else{if(!(e.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.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 o=!1;const u=wo(d=>{this._trackResize&&!this._removed&&(this.resize(d),this.redraw())},50);this._resizeObserver=new ResizeObserver(d=>{o?u(d):o=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Yl(this,e),this._hash=e.hash&&new ma(typeof e.hash=="string"&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,h.e({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,this._validateStyle=e.validateStyle,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new Ds(typeof e.attributionControl=="boolean"?void 0:e.attributionControl)),e.maplibreLogo&&this.addControl(new Ql,e.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",o=>{this._update(o.dataType==="style"),this.fire(new h.k(`${o.dataType}data`,o))}),this.on("dataloading",o=>{this.fire(new h.k(`${o.dataType}dataloading`,o))}),this.on("dataabort",o=>{this.fire(new h.k("sourcedataabort",o))})}_getMapId(){return this._mapId}addControl(_,e){if(e===void 0&&(e=_.getDefaultPosition?_.getDefaultPosition():"top-right"),!_||!_.onAdd)return this.fire(new h.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const o=_.onAdd(this);this._controls.push(_);const u=this._controlPositions[e];return e.indexOf("bottom")!==-1?u.insertBefore(o,u.firstChild):u.appendChild(o),this}removeControl(_){if(!_||!_.onRemove)return this.fire(new h.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const e=this._controls.indexOf(_);return e>-1&&this._controls.splice(e,1),_.onRemove(this),this}hasControl(_){return this._controls.indexOf(_)>-1}calculateCameraOptionsFromTo(_,e,o,u){return u==null&&this.terrain&&(u=this.terrain.getElevationForLngLatZoom(o,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(_,e,o,u)}resize(_){var e;const o=this._containerDimensions(),u=o[0],d=o[1],y=this._getClampedPixelRatio(u,d);if(this._resizeCanvas(u,d,y),this.painter.resize(u,d,y),this.painter.overLimit()){const C=this.painter.context.gl;this._maxCanvasSize=[C.drawingBufferWidth,C.drawingBufferHeight];const S=this._getClampedPixelRatio(u,d);this._resizeCanvas(u,d,S),this.painter.resize(u,d,S)}this.transform.resize(u,d),(e=this._requestedCameraState)===null||e===void 0||e.resize(u,d);const w=!this._moving;return w&&(this.stop(),this.fire(new h.k("movestart",_)).fire(new h.k("move",_))),this.fire(new h.k("resize",_)),w&&this.fire(new h.k("moveend",_)),this}_getClampedPixelRatio(_,e){const{0:o,1:u}=this._maxCanvasSize,d=this.getPixelRatio(),y=_*d,w=e*d;return Math.min(y>o?o/y:1,w>u?u/w:1)*d}getPixelRatio(){var _;return(_=this._overridePixelRatio)!==null&&_!==void 0?_:devicePixelRatio}setPixelRatio(_){this._overridePixelRatio=_,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(_){return this.transform.setMaxBounds(fe.convert(_)),this._update()}setMinZoom(_){if((_=_??-2)>=-2&&_<=this.transform.maxZoom)return this.transform.minZoom=_,this._update(),this.getZoom()<_&&this.setZoom(_),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(_){if((_=_??22)>=this.transform.minZoom)return this.transform.maxZoom=_,this._update(),this.getZoom()>_&&this.setZoom(_),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(_){if((_=_??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(_>=0&&_<=this.transform.maxPitch)return this.transform.minPitch=_,this._update(),this.getPitch()<_&&this.setPitch(_),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(_){if((_=_??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(_>=this.transform.minPitch)return this.transform.maxPitch=_,this._update(),this.getPitch()>_&&this.setPitch(_),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(_){return this.transform.renderWorldCopies=_,this._update()}project(_){return this.transform.locationPoint(h.N.convert(_),this.style&&this.terrain)}unproject(_){return this.transform.pointLocation(h.P.convert(_),this.terrain)}isMoving(){var _;return this._moving||((_=this.handlers)===null||_===void 0?void 0:_.isMoving())}isZooming(){var _;return this._zooming||((_=this.handlers)===null||_===void 0?void 0:_.isZooming())}isRotating(){var _;return this._rotating||((_=this.handlers)===null||_===void 0?void 0:_.isRotating())}_createDelegatedListener(_,e,o){if(_==="mouseenter"||_==="mouseover"){let u=!1;return{layers:e,listener:o,delegates:{mousemove:y=>{const w=e.filter(S=>this.getLayer(S)),C=w.length!==0?this.queryRenderedFeatures(y.point,{layers:w}):[];C.length?u||(u=!0,o.call(this,new zi(_,this,y.originalEvent,{features:C}))):u=!1},mouseout:()=>{u=!1}}}}if(_==="mouseleave"||_==="mouseout"){let u=!1;return{layers:e,listener:o,delegates:{mousemove:w=>{const C=e.filter(S=>this.getLayer(S));(C.length!==0?this.queryRenderedFeatures(w.point,{layers:C}):[]).length?u=!0:u&&(u=!1,o.call(this,new zi(_,this,w.originalEvent)))},mouseout:w=>{u&&(u=!1,o.call(this,new zi(_,this,w.originalEvent)))}}}}{const u=d=>{const y=e.filter(C=>this.getLayer(C)),w=y.length!==0?this.queryRenderedFeatures(d.point,{layers:y}):[];w.length&&(d.features=w,o.call(this,d),delete d.features)};return{layers:e,listener:o,delegates:{[_]:u}}}}_saveDelegatedListener(_,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[_]=this._delegatedListeners[_]||[],this._delegatedListeners[_].push(e)}_removeDelegatedListener(_,e,o){if(!this._delegatedListeners||!this._delegatedListeners[_])return;const u=this._delegatedListeners[_];for(let d=0;de.includes(w))){for(const w in y.delegates)this.off(w,y.delegates[w]);return void u.splice(d,1)}}}on(_,e,o){if(o===void 0)return super.on(_,e);const u=this._createDelegatedListener(_,typeof e=="string"?[e]:e,o);this._saveDelegatedListener(_,u);for(const d in u.delegates)this.on(d,u.delegates[d]);return this}once(_,e,o){if(o===void 0)return super.once(_,e);const u=typeof e=="string"?[e]:e,d=this._createDelegatedListener(_,u,o);for(const y in d.delegates){const w=d.delegates[y];d.delegates[y]=(...C)=>{this._removeDelegatedListener(_,u,o),w(...C)}}this._saveDelegatedListener(_,d);for(const y in d.delegates)this.once(y,d.delegates[y]);return this}off(_,e,o){return o===void 0?super.off(_,e):(this._removeDelegatedListener(_,typeof e=="string"?[e]:e,o),this)}queryRenderedFeatures(_,e){if(!this.style)return[];let o;const u=_ instanceof h.P||Array.isArray(_),d=u?_:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(u?{}:_)||{},d instanceof h.P||typeof d[0]=="number")o=[h.P.convert(d)];else{const y=h.P.convert(d[0]),w=h.P.convert(d[1]);o=[y,new h.P(w.x,y.y),w,new h.P(y.x,w.y),y]}return this.style.queryRenderedFeatures(o,e,this.transform)}querySourceFeatures(_,e){return this.style.querySourceFeatures(_,e)}setStyle(_,e){return(e=h.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&_?(this._diffStyle(_,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(_,e))}setTransformRequest(_){return this._requestManager.setTransformRequest(_),this}_getUIString(_){const e=this._locale[_];if(e==null)throw new Error(`Missing UI string '${_}'`);return e}_updateStyle(_,e){if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(_,e));const o=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!_)),_?(this.style=new Yo(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof _=="string"?this.style.loadURL(_,e,o):this.style.loadJSON(_,e,o),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Yo(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(_,e){if(typeof _=="string"){const o=this._requestManager.transformRequest(_,"Style");h.h(o,new AbortController).then(u=>{this._updateDiff(u.data,e)}).catch(u=>{u&&this.fire(new h.j(u))})}else typeof _=="object"&&this._updateDiff(_,e)}_updateDiff(_,e){try{this.style.setState(_,e)&&this._update(!0)}catch(o){h.w(`Unable to perform style diff: ${o.message||o.error||o}. Rebuilding the style from scratch.`),this._updateStyle(_,e)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():h.w("There is no style added to the map.")}addSource(_,e){return this._lazyInitEmptyStyle(),this.style.addSource(_,e),this._update(!0)}isSourceLoaded(_){const e=this.style&&this.style.sourceCaches[_];if(e!==void 0)return e.loaded();this.fire(new h.j(new Error(`There is no source with ID '${_}'`)))}setTerrain(_){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),_){const e=this.style.sourceCaches[_.source];if(!e)throw new Error(`cannot load terrain, because there exists no source with ID: ${_.source}`);this.terrain===null&&e.reload();for(const o in this.style._layers){const u=this.style._layers[o];u.type==="hillshade"&&u.source===_.source&&h.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 th(this.painter,e,_),this.painter.renderToTexture=new Dc(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=o=>{o.dataType==="style"?this.terrain.sourceCache.freeRtt():o.dataType==="source"&&o.tile&&(o.sourceId!==_.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(o.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 h.k("terrain",{terrain:_})),this}getTerrain(){var _,e;return(e=(_=this.terrain)===null||_===void 0?void 0:_.options)!==null&&e!==void 0?e:null}areTilesLoaded(){const _=this.style&&this.style.sourceCaches;for(const e in _){const o=_[e]._tiles;for(const u in o){const d=o[u];if(d.state!=="loaded"&&d.state!=="errored")return!1}}return!0}removeSource(_){return this.style.removeSource(_),this._update(!0)}getSource(_){return this.style.getSource(_)}addImage(_,e,o={}){const{pixelRatio:u=1,sdf:d=!1,stretchX:y,stretchY:w,content:C,textFitWidth:S,textFitHeight:T}=o;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||h.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new h.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:z,height:k,data:N}=e,q=e;return this.style.addImage(_,{data:new h.R({width:z,height:k},new Uint8Array(N)),pixelRatio:u,stretchX:y,stretchY:w,content:C,textFitWidth:S,textFitHeight:T,sdf:d,version:0,userImage:q}),q.onAdd&&q.onAdd(this,_),this}}{const{width:z,height:k,data:N}=B.getImageData(e);this.style.addImage(_,{data:new h.R({width:z,height:k},N),pixelRatio:u,stretchX:y,stretchY:w,content:C,textFitWidth:S,textFitHeight:T,sdf:d,version:0})}}updateImage(_,e){const o=this.style.getImage(_);if(!o)return this.fire(new h.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const u=e instanceof HTMLImageElement||h.b(e)?B.getImageData(e):e,{width:d,height:y,data:w}=u;if(d===void 0||y===void 0)return this.fire(new h.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(d!==o.data.width||y!==o.data.height)return this.fire(new h.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const C=!(e instanceof HTMLImageElement||h.b(e));return o.data.replace(w,C),this.style.updateImage(_,o),this}getImage(_){return this.style.getImage(_)}hasImage(_){return _?!!this.style.getImage(_):(this.fire(new h.j(new Error("Missing required image id"))),!1)}removeImage(_){this.style.removeImage(_)}loadImage(_){return Ue.getImage(this._requestManager.transformRequest(_,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(_,e){return this._lazyInitEmptyStyle(),this.style.addLayer(_,e),this._update(!0)}moveLayer(_,e){return this.style.moveLayer(_,e),this._update(!0)}removeLayer(_){return this.style.removeLayer(_),this._update(!0)}getLayer(_){return this.style.getLayer(_)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(_,e,o){return this.style.setLayerZoomRange(_,e,o),this._update(!0)}setFilter(_,e,o={}){return this.style.setFilter(_,e,o),this._update(!0)}getFilter(_){return this.style.getFilter(_)}setPaintProperty(_,e,o,u={}){return this.style.setPaintProperty(_,e,o,u),this._update(!0)}getPaintProperty(_,e){return this.style.getPaintProperty(_,e)}setLayoutProperty(_,e,o,u={}){return this.style.setLayoutProperty(_,e,o,u),this._update(!0)}getLayoutProperty(_,e){return this.style.getLayoutProperty(_,e)}setGlyphs(_,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(_,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(_,e,o={}){return this._lazyInitEmptyStyle(),this.style.addSprite(_,e,o,u=>{u||this._update(!0)}),this}removeSprite(_){return this._lazyInitEmptyStyle(),this.style.removeSprite(_),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(_,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(_,e,o=>{o||this._update(!0)}),this}setLight(_,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(_,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(_){return this._lazyInitEmptyStyle(),this.style.setSky(_),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(_,e){return this.style.setFeatureState(_,e),this._update()}removeFeatureState(_,e){return this.style.removeFeatureState(_,e),this._update()}getFeatureState(_){return this.style.getFeatureState(_)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let _=0,e=0;return this._container&&(_=this._container.clientWidth||400,e=this._container.clientHeight||300),[_,e]}_setupContainer(){const _=this._container;_.classList.add("maplibregl-map");const e=this._canvasContainer=U.create("div","maplibregl-canvas-container",_);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=U.create("canvas","maplibregl-canvas",e),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 o=this._containerDimensions(),u=this._getClampedPixelRatio(o[0],o[1]);this._resizeCanvas(o[0],o[1],u);const d=this._controlContainer=U.create("div","maplibregl-control-container",_),y=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(w=>{y[w]=U.create("div",`maplibregl-ctrl-${w} `,d)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(_,e,o){this._canvas.width=Math.floor(o*_),this._canvas.height=Math.floor(o*e),this._canvas.style.width=`${_}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const _={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let e=null;this._canvas.addEventListener("webglcontextcreationerror",u=>{e={requestedAttributes:_},u&&(e.statusMessage=u.statusMessage,e.type=u.type)},{once:!0});const o=this._canvas.getContext("webgl2",_)||this._canvas.getContext("webgl",_);if(!o){const u="Failed to initialize WebGL";throw e?(e.message=u,new Error(JSON.stringify(e))):new Error(u)}this.painter=new fa(o,this.transform),ue.testSupport(o)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(_){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||_,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(_){return this._update(),this._renderTaskQueue.add(_)}_cancelRenderFrame(_){this._renderTaskQueue.remove(_)}_render(_){const e=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(_),this._removed)return;let o=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const d=this.transform.zoom,y=B.now();this.style.zoomHistory.update(d,y);const w=new h.z(d,{now:y,fadeDuration:e,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),C=w.crossFadingFactor();C===1&&C===this._crossFadingFactor||(o=!0,this._crossFadingFactor=C),this.style.update(w)}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,e,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:e,showPadding:this.showPadding}),this.fire(new h.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,h.bf.mark(h.bg.load),this.fire(new h.k("load"))),this.style&&(this.style.hasTransitions()||o)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const u=this._sourcesDirty||this._styleDirty||this._placementDirty;return u||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new h.k("idle")),!this._loaded||this._fullyLoaded||u||(this._fullyLoaded=!0,h.bf.mark(h.bg.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var _;this._hash&&this._hash.remove();for(const o of this._controls)o.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),Ue.removeThrottleControl(this._imageQueueHandle),(_=this._resizeObserver)===null||_===void 0||_.disconnect();const e=this.painter.context.gl.getExtension("WEBGL_lose_context");e!=null&&e.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),U.remove(this._canvasContainer),U.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),h.bf.clearMetrics(),this._removed=!0,this.fire(new h.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,B.frameAsync(this._frameRequest).then(_=>{h.bf.frame(_),this._frameRequest=null,this._render(_)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(_){this._showTileBoundaries!==_&&(this._showTileBoundaries=_,this._update())}get showPadding(){return!!this._showPadding}set showPadding(_){this._showPadding!==_&&(this._showPadding=_,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(_){this._showCollisionBoxes!==_&&(this._showCollisionBoxes=_,_?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(_){this._showOverdrawInspector!==_&&(this._showOverdrawInspector=_,this._update())}get repaint(){return!!this._repaint}set repaint(_){this._repaint!==_&&(this._repaint=_,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(_){this._vertices=_,this._update()}get version(){return Lc}getCameraTargetElevation(){return this.transform.elevation}},m.MapMouseEvent=zi,m.MapTouchEvent=es,m.MapWheelEvent=Pc,m.Marker=Sa,m.NavigationControl=class{constructor(_){this._updateZoomButtons=()=>{const e=this._map.getZoom(),o=e===this._map.getMaxZoom(),u=e===this._map.getMinZoom();this._zoomInButton.disabled=o,this._zoomOutButton.disabled=u,this._zoomInButton.setAttribute("aria-disabled",o.toString()),this._zoomOutButton.setAttribute("aria-disabled",u.toString())},this._rotateCompassArrow=()=>{const e=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=e},this._setButtonTitle=(e,o)=>{const u=this._map._getUIString(`NavigationControl.${o}`);e.title=u,e.setAttribute("aria-label",u)},this.options=h.e({},fd,_),this._container=U.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),U.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),U.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=U.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(_){return this._map=_,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new md(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){U.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(_,e){const o=U.create("button",_,this._container);return o.type="button",o.addEventListener("click",e),o}},m.Popup=class extends h.E{constructor(_){super(),this.remove=()=>(this._content&&U.remove(this._content),this._container&&(U.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 h.k("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{var o;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=U.create("div","maplibregl-popup",this._map.getContainer()),this._tip=U.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const C of this.options.className.split(" "))this._container.classList.add(C);this._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?Jt(this._lngLat,this._flatPos,this._map.transform):(o=this._lngLat)===null||o===void 0?void 0:o.wrap(),this._trackPointer&&!e)return;const u=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationPoint(this._lngLat));let d=this.options.anchor;const y=Pa(this.options.offset);if(!d){const C=this._container.offsetWidth,S=this._container.offsetHeight;let T;T=u.y+y.bottom.ythis._map.transform.height-S?["bottom"]:[],u.xthis._map.transform.width-C/2&&T.push("right"),d=T.length===0?"bottom":T.join("-")}let w=u.add(y[d]);this.options.subpixelPositioning||(w=w.round()),U.setTransform(this._container,`${Bs[d]} translate(${w.x}px,${w.y}px)`),Ca(this._container,d,"popup")},this._onClose=()=>{this.remove()},this.options=h.e(Object.create(tt),_)}addTo(_){return this._map&&this.remove(),this._map=_,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new h.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(_){return this._lngLat=h.N.convert(_),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(_){return this.setDOMContent(document.createTextNode(_))}setHTML(_){const e=document.createDocumentFragment(),o=document.createElement("body");let u;for(o.innerHTML=_;u=o.firstChild,u;)e.appendChild(u);return this.setDOMContent(e)}getMaxWidth(){var _;return(_=this._container)===null||_===void 0?void 0:_.style.maxWidth}setMaxWidth(_){return this.options.maxWidth=_,this._update(),this}setDOMContent(_){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=U.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(_),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(_){return this._container&&this._container.classList.add(_),this}removeClassName(_){return this._container&&this._container.classList.remove(_),this}setOffset(_){return this.options.offset=_,this._update(),this}toggleClassName(_){if(this._container)return this._container.classList.toggle(_)}setSubpixelPositioning(_){this.options.subpixelPositioning=_}_createCloseButton(){this.options.closeButton&&(this._closeButton=U.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 _=this._container.querySelector(Ma);_&&_.focus()}},m.RasterDEMTileSource=ri,m.RasterTileSource=Et,m.ScaleControl=class{constructor(_){this._onMove=()=>{To(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,To(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},nn),_)}getDefaultPosition(){return"bottom-left"}onAdd(_){return this._map=_,this._container=U.create("div","maplibregl-ctrl maplibregl-ctrl-scale",_.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){U.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},m.ScrollZoomHandler=Or,m.Style=Yo,m.TerrainControl=class{constructor(_){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=_}onAdd(_){return this._map=_,this._container=U.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=U.create("button","maplibregl-ctrl-terrain",this._container),U.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(){U.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},m.TwoFingersTouchPitchHandler=As,m.TwoFingersTouchRotateHandler=Hl,m.TwoFingersTouchZoomHandler=Xl,m.TwoFingersTouchZoomRotateHandler=Kl,m.VectorTileSource=ao,m.VideoSource=ps,m.addSourceType=(_,e)=>h._(void 0,void 0,void 0,function*(){if(co(_))throw new Error(`A source type called "${_}" already exists.`);((o,u)=>{ho[o]=u})(_,e)}),m.clearPrewarmedResources=function(){const _=Zt;_&&(_.isPreloaded()&&_.numActive()===1?(_.release(kr),Zt=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()"))},m.getMaxParallelImageRequests=function(){return h.a.MAX_PARALLEL_IMAGE_REQUESTS},m.getRTLTextPluginStatus=function(){return Yr().getRTLTextPluginStatus()},m.getVersion=function(){return nh},m.getWorkerCount=function(){return sr.workerCount},m.getWorkerUrl=function(){return h.a.WORKER_URL},m.importScriptInWorkers=function(_){return oo().broadcast("IS",_)},m.prewarm=function(){_r().acquire(kr)},m.setMaxParallelImageRequests=function(_){h.a.MAX_PARALLEL_IMAGE_REQUESTS=_},m.setRTLTextPlugin=function(_,e){return Yr().setRTLTextPlugin(_,e)},m.setWorkerCount=function(_){sr.workerCount=_},m.setWorkerUrl=function(_){h.a.WORKER_URL=_}});var f=a;return f})})(ly);var p0=ly.exports;const su=d0(p0);var jo=Math.pow(2,32),ou=Math.pow(2,-32),f0=Math.log(10)/(32*Math.log(2));function m0(g){return new Array(g+1).join("0")}var op=function(){function g(s){this.base=s,this.limbDigitsExact=Math.log(jo)/Math.log(this.base),this.limbDigits=~~this.limbDigitsExact,this.limbBase=Math.pow(this.base,this.limbDigits),this.pad=m0(this.limbDigits)}return g.init=function(s){return g.baseTbl[s]||(g.baseTbl[s]=new g(s))},g.baseTbl={},g}();function g0(g){return g.replace(/^(-?)0+([1-9a-z]|0(\.|$))/,"$1$2").replace(/(\.|(\.[0-9a-z]*[1-9a-z]))0+$/,"$2")}var Hr=function(){function g(s,a){this.limbList=[],s?this.setValue(s,a):this.setZero()}return g.prototype.clone=function(){return new g().setBig(this)},g.prototype.setZero=function(){return this.sign=1,this.fractionLen=0,this.len=0,this},g.prototype.setValue=function(s,a){return typeof s=="number"?this.setNumber(s):s instanceof g?this.setBig(s):this.setString(s.toString(),a||10)},g.prototype.setBig=function(s){var a=s.len;this.sign=s.sign,this.fractionLen=s.fractionLen,this.len=a;for(var n=0;n>>0,n-=m,f[h++]=m,++c;for(var P=0;--h>P;)m=f[P],f[P++]=f[h],f[h]=m;for(h+=P+1;a;)m=a%jo,a=(a-m)/jo,f[h++]=m;return this.limbList=f,this.fractionLen=c,this.len=h,this},g.prototype.parseFraction=function(s,a,n,c,f,m){for(var h=this.limbList,P=s.length,L=c-1;L;)h[--L]=0;var V=P-((P-n+m-1)%m+1);for(h[c-1]=parseInt(s.substr(V,P-V),a),this.divInt(Math.pow(a,P-V),c),P=V;P>n;)P-=m,h[c-1]=parseInt(s.substr(P,m),a),this.divInt(f,c)},g.prototype.setString=function(s,a){var n=op.init(a),c=n.limbBase,f=n.limbDigits,m=n.limbDigitsExact,h=this.limbList,P=-1,L;for(this.sign=1;;){switch(L=s.charAt(++P),L){case"-":this.sign=-1;case"+":case"0":continue}break}var V=(s.indexOf(".",P)+1||s.length+1)-1;if(VP){var ue=P+(V-P+f-1)%f+1;for(++this.len,h[U]=parseInt(s.substr(P,ue-P),a),P=ue;Pa&&!s[n-1];)--n;this.len=n},g.prototype.trimLeast=function(){for(var s=this.limbList,a=this.fractionLen,n=0;n>>16),L|=V<<16,P=(a[c]&f)+L>>>0,a[c++]=P,V=V/65536>>>0,V+=(L^(P-L^L)&~(P^L))>>>31;return V&&(a[c]=V),V},g.prototype.mulBig=function(s,a){if(this.isZero()||s.isZero())return a.setZero();var n=s.limbList,c=s.len,f=a.limbList,m=this.len+c;for(a.len=m;m--;)f[m]=0;this.mulInt(n[0],f,0,0,0);for(var h=1;hue&&(f=ue);V>>0,B=B-U&&1,m[L++]=U;var ye=L;for(f>>0,B=B-U&&1,m[ye++]=U;return B&&(m[ye++]=B),a.len=ye,a.trimLeast(),a},g.prototype.subBig=function(s,a){var n=this;a.sign=this.sign,n.absDeltaFrom(s)<0&&(n=s,s=this,a.sign=-this.sign);var c=n.fractionLen,f=c-s.fractionLen,m=a.limbList,h=n.limbList,P=s.limbList,L=n.len,V=s.len,B=L,U=0,ue=0,ye=0,Se=0,Ne;if(f>=0){for(;UL&&(f=L),ye=U}else{for(f=-f,c+=f,B+=f;ue>>0,Se=-(Se<0),m[ue++]=Ne;f+=L,f>V&&(f=V),ye=ue}for(a.fractionLen=c;ye>>0,Se=-(Se<0),m[ye++]=Ne;for(;ye>>0,Se=-(Se<0),m[ye++]=Ne;return a.len=ye,a.trimMost(),a.trimLeast(),a},g.prototype.addSub=function(s,a,n){if(n=n||new g,n==this)throw new Error("Addition and subtraction in place is unsupported");return typeof s=="number"&&(s=Ga.setNumber(s)),this.sign*s.sign*a<0?this.subBig(s,n):this.addBig(s,n)},g.prototype.add=function(s,a){return this.addSub(s,1,a)},g.prototype.sub=function(s,a){return this.addSub(s,-1,a)},g.prototype.truncate=function(s){var a=this.fractionLen-s;if(a>0){this.fractionLen=s,this.len-=a;for(var n=this.len,c=this.limbList,f=0;f>>16),f=h/s>>>0,h=h-f*s,h=h*65536+(c&65535),m=h/s>>>0,h=h-m*s,n[a]=(f<<16|m)>>>0;return h},g.prototype.fractionToString=function(s,a){var n=op.init(s),c=n.pad,f=n.limbBase,m=this.limbList,h=this.fractionLen,P=0,L;if(s&1)throw new Error("Conversion of floating point values to odd bases is unsupported");for(;P=h)){a.push(".");var V=Ga;for(V.limbList=m.slice(P,h),V.len=h-P,P=0;P1;)h=P.divInt(c,P.len).toString(s),f.push(n.substr(h.length)+h);f.push(""+(P.limbList[0]||0)),this.sign<0&&f.push("-"),f.reverse(),this.fractionToString(s,f)}else{var L=this.len,V=this.fractionLen;for(this.sign<0&&f.push("-"),L==V&&f.push("0");L--;)h=m[L].toString(s),L==V-1&&f.push("."),f.push(n.substr(h.length)+h)}return g0(f.join(""))},g}();Hr.prototype.cmp=Hr.prototype.deltaFrom;var Ga=new Hr,ig=(1<<27)+1,y0=Math.log(10)/(53*Math.log(2));function _0(g,s,a){var n=g+s,c=n-g,f=n-c;return a[0]=g-f+(s-c),a[1]=n,a}function ap(g,s){el=g*s;var a=g*ig,n=a-(a-g),c=g-n,f=s*ig,m=f-(f-s),h=s-m;return c*h-(el-n*m-c*m-n*h)}var Xo=function(){function g(s,a){this.limbList=[],s&&this.setValue(s,a)}return g.prototype.clone=function(){return new g().setBig(this)},g.prototype.setZero=function(){return this.len=0,this},g.prototype.setValue=function(s,a){return typeof s=="number"?this.setNumber(s):s instanceof g?this.setBig(s):this.setString(s.toString(),a||10)},g.prototype.setBig=function(s){var a=s.len;this.len=a;for(var n=0;n0?1:-1)},g.prototype.deltaFrom=function(s){var a=this.len,n=this.getSign(),c=n;if(typeof s!="number"){if(a=s.len,c-=a&&(a=s.limbList[a-1])&&(a>0?1:-1),c||!n)return c;this.addBig(s,-1,Vo[0])}else{if(c-=s&&(s>0?1:-1),c||!n)return c;this.addSmall(-s,Vo[0])}return a=Vo[0].len,a&&Vo[0].limbList[a-1]},g.prototype.addSmall=function(s,a){for(var n=this.limbList,c=a.limbList,f=this.len,m,h,P,L,V=0,B=0;V>1,h=a[m],h>-1&&h<1?c=m+1:f=m;if(m&&(h<=-1||h>=1)&&(h=a[--m]),m-=s-1,m>0){this.len-=m,n=this.len;for(var P=0;Pg.length)&&(s=g.length);for(var a=0,n=Array(s);a=g.length?{done:!0}:{done:!1,value:g[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ip(g){return Ip=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(s){return s.__proto__||Object.getPrototypeOf(s)},Ip(g)}function Xh(g,s){g.prototype=Object.create(s.prototype),g.prototype.constructor=g,kh(g,s)}function b0(g){try{return Function.toString.call(g).indexOf("[native code]")!==-1}catch{return typeof g=="function"}}function dy(){try{var g=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(dy=function(){return!!g})()}function kh(g,s){return kh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,n){return a.__proto__=n,a},kh(g,s)}function w0(g,s){if(typeof g!="object"||!g)return g;var a=g[Symbol.toPrimitive];if(a!==void 0){var n=a.call(g,s);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(g)}function I0(g){var s=w0(g,"string");return typeof s=="symbol"?s:s+""}function C0(g,s){if(g){if(typeof g=="string")return rg(g,s);var a={}.toString.call(g).slice(8,-1);return a==="Object"&&g.constructor&&(a=g.constructor.name),a==="Map"||a==="Set"?Array.from(g):a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?rg(g,s):void 0}}function ll(g){var s=typeof Map=="function"?new Map:void 0;return ll=function(a){if(a===null||!b0(a))return a;if(typeof a!="function")throw new TypeError("Super expression must either be null or a function");if(s!==void 0){if(s.has(a))return s.get(a);s.set(a,n)}function n(){return zh(a,arguments,Ip(this).constructor)}return n.prototype=Object.create(a.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),kh(n,a)},ll(g)}var Ft=function(){function g(a,n){this.lo=0,this.hi=0,this.lo=a,this.hi=n}var s=g.prototype;return s.isEmpty=function(){return this.lo>this.hi},s.equals=function(n){return this.lo==n.lo&&this.hi==n.hi||this.isEmpty()&&n.isEmpty()},s.center=function(){return .5*(this.lo+this.hi)},s.length=function(){return this.hi-this.lo},s.contains=function(n){return this.lo<=n&&n<=this.hi},s.containsInterval=function(n){return n.isEmpty()?!0:this.lo<=n.lo&&n.hi<=this.hi},s.interiorContains=function(n){return this.lothis.hi?new g(this.lo,n):this},s.clampPoint=function(n){return Math.max(this.lo,Math.min(this.hi,n))},s.expanded=function(n){return this.isEmpty()?this:new g(this.lo-n,this.hi+n)},s.approxEqual=function(n,c){return c===void 0&&(c=1e-15),this.isEmpty()?n.length()<=2*c:n.isEmpty()?this.length()<=2*c:Math.abs(n.lo-this.lo)<=c&&Math.abs(n.hi-this.hi)<=c},s.directedHausdorffDistance=function(n){return this.isEmpty()?0:n.isEmpty()?1/0:Math.max(0,Math.max(this.hi-n.hi,n.lo-this.lo))},s.trunc=function(n){n===void 0&&(n=15);var c=+("1e"+n),f=function(h){return Math.round(h*c)/c};return new g(f(this.lo),f(this.hi))},s.toString=function(){var n=this.trunc(7);return"["+n.lo.toFixed(7)+", "+n.hi.toFixed(7)+"]"},g.empty=function(){return new g(1,0)},g.fromPoint=function(n){return new g(n,n)},g}(),Bt=function(){function g(a,n){a===void 0&&(a=0),n===void 0&&(n=0),this.x=0,this.y=0,this.x=a,this.y=n}var s=g.prototype;return s.add=function(n){return new g(this.x+n.x,this.y+n.y)},s.sub=function(n){return new g(this.x-n.x,this.y-n.y)},s.mul=function(n){return new g(this.x*n,this.y*n)},s.ortho=function(){return new g(-this.y,this.x)},s.dot=function(n){return this.x*n.x+this.y*n.y},s.cross=function(n){return this.x*n.y-this.y*n.x},s.norm=function(){return Math.hypot(this.x,this.y)},s.normalize=function(){return this.x==0&&this.y==0?this:this.mul(1/this.norm())},s.trunc=function(n){n===void 0&&(n=15);var c=+("1e"+n),f=function(h){return Math.round(h*c)/c};return new g(f(this.x),f(this.y))},s.equals=function(n){return this.x===n.x&&this.y===n.y},s.toString=function(){var n=this.trunc(12);return"("+n.x.toFixed(12)+", "+n.y.toFixed(12)+")"},g}(),pi=function(){function g(a,n){a===void 0&&(a=new Ft(0,0)),n===void 0&&(n=new Ft(0,0)),this.x=a,this.y=n}var s=g.prototype;return s.isValid=function(){return this.x.isEmpty()==this.y.isEmpty()},s.isEmpty=function(){return this.x.isEmpty()},s.vertices=function(){return[new Bt(this.x.lo,this.y.lo),new Bt(this.x.hi,this.y.lo),new Bt(this.x.hi,this.y.hi),new Bt(this.x.lo,this.y.hi)]},s.vertexIJ=function(n,c){var f=this.x.lo;n==1&&(f=this.x.hi);var m=this.y.lo;return c==1&&(m=this.y.hi),new Bt(f,m)},s.lo=function(){return new Bt(this.x.lo,this.y.lo)},s.hi=function(){return new Bt(this.x.hi,this.y.hi)},s.center=function(){return new Bt(this.x.center(),this.y.center())},s.size=function(){return new Bt(this.x.length(),this.y.length())},s.containsPoint=function(n){return this.x.contains(n.x)&&this.y.contains(n.y)},s.interiorContainsPoint=function(n){return this.x.interiorContains(n.x)&&this.y.interiorContains(n.y)},s.contains=function(n){return this.x.containsInterval(n.x)&&this.y.containsInterval(n.y)},s.interiorContains=function(n){return this.x.interiorContainsInterval(n.x)&&this.y.interiorContainsInterval(n.y)},s.intersects=function(n){return this.x.intersects(n.x)&&this.y.intersects(n.y)},s.interiorIntersects=function(n){return this.x.interiorIntersects(n.x)&&this.y.interiorIntersects(n.y)},s.addPoint=function(n){return new g(this.x.addPoint(n.x),this.y.addPoint(n.y))},s.addRect=function(n){return new g(this.x.union(n.x),this.y.union(n.y))},s.clampPoint=function(n){return new Bt(this.x.clampPoint(n.x),this.y.clampPoint(n.y))},s.expanded=function(n){var c=this.x.expanded(n.x),f=this.y.expanded(n.y);return c.isEmpty()||f.isEmpty()?g.empty():new g(c,f)},s.expandedByMargin=function(n){return this.expanded(new Bt(n,n))},s.union=function(n){return new g(this.x.union(n.x),this.y.union(n.y))},s.intersection=function(n){var c=this.x.intersection(n.x),f=this.y.intersection(n.y);return c.isEmpty()||f.isEmpty()?g.empty():new g(c,f)},s.approxEqual=function(n){return this.x.approxEqual(n.x)&&this.y.approxEqual(n.y)},s.string=function(){return"["+this.lo().toString()+", "+this.hi.toString()+"]"},g.fromPoints=function(){for(var n=arguments.length,c=new Array(n),f=0;fn.y?n.x>n.z?g.X_AXIS:g.Z_AXIS:n.y>n.z?g.Y_AXIS:g.Z_AXIS},s.smallestComponent=function(){var n=this.abs();return n.xn.x?1:this.yn.y?1:this.zn.z?1:0},g}();$e.X_AXIS=0;$e.Y_AXIS=1;$e.Z_AXIS=2;var lp=function(){function g(a,n,c){this.x=a,this.y=n,this.z=c}g.fromVector=function(n){return new g(new Hr(n.x),new Hr(n.y),new Hr(n.z))};var s=g.prototype;return s.vector=function(){return new $e(this.x.valueOf(),this.y.valueOf(),this.z.valueOf()).normalize()},s.equals=function(n){return this.x.cmp(n.x)===0&&this.y.cmp(n.y)===0&&this.z.cmp(n.z)===0},s.toString=function(){return"("+this.x.toString()+", "+this.y.toString()+", "+this.z.toString()+")"},s.norm2=function(){return this.dot(this)},s.isUnit=function(){return this.norm2().cmp(new Hr(1))===0},s.abs=function(){var n=this.x.mul(this.x.getSign()),c=this.y.mul(this.y.getSign()),f=this.z.mul(this.z.getSign());return new g(n,c,f)},s.add=function(n){return new g(this.x.add(n.x),this.y.add(n.y),this.z.add(n.z))},s.sub=function(n){return new g(this.x.sub(n.x),this.y.sub(n.y),this.z.sub(n.z))},s.mul=function(n){return new g(this.x.mul(n),this.y.mul(n),this.z.mul(n))},s.mulByFloat64=function(n){return this.mul(new Hr(n))},s.dot=function(n){return this.x.mul(n.x).add(this.y.mul(n.y).add(this.z.mul(n.z)))},s.cross=function(n){return new g(this.y.mul(n.z).sub(this.z.mul(n.y)),this.z.mul(n.x).sub(this.x.mul(n.z)),this.x.mul(n.y).sub(this.y.mul(n.x)))},s.largestComponent=function(){var n=this.abs();return n.x.cmp(n.y)>0?n.x.cmp(n.z)>0?$e.X_AXIS:$e.Z_AXIS:n.y.cmp(n.z)>0?$e.Y_AXIS:$e.Z_AXIS},s.smallestComponent=function(){var n=this.abs();return n.x.cmp(n.y)<0?n.x.cmp(n.z)<0?$e.X_AXIS:$e.Z_AXIS:n.y.cmp(n.z)<0?$e.Y_AXIS:$e.Z_AXIS},s.isZero=function(){return this.x.isZero()&&this.y.isZero()&&this.z.isZero()},g}(),$o=Math.PI/180,ls=function(s,a){if(isNaN(s)||isNaN(a)||!isFinite(s)||a===0)return NaN;var n=s/a,c=Math.round(n);Math.abs(n-c)===.5&&(c=2*Math.round(n/2));var f=s-c*a;return f||Math.sign(s)*0},Wp=function(s,a){if(isNaN(s)||isNaN(a))return NaN;if(s===a)return a;if(s===0)return a>0?Number.MIN_VALUE:-Number.MIN_VALUE;var n=new ArrayBuffer(8),c=new DataView(n);c.setFloat64(0,s,!0);var f=c.getBigUint64(0,!0);return s>0==a>s?f+=1n:f-=1n,c.setBigUint64(0,f,!0),c.getFloat64(0,!0)},S0=function(s){var a=s&-s&0xffffffffffffffffn;if(a===0n)return 64;var n=Math.clz32(Number(a&0xffffffffn));if(n<32)return 31-n;var c=Math.clz32(Number(a>>32n&0xffffffffn));return 63-c},py=function(s){var a=s&0xffffffffffffffffn;if(a===0n)return 64;var n=Math.clz32(Number(a>>32n&0xffffffffn));if(n<32)return 63-n;var c=Math.clz32(Number(a&0xffffffffn));return 31-c},Cp=function(s,a){return s*Math.pow(2,a)},ng=function(s){return isNaN(s)?NaN:s===0?-1/0:isFinite(s)?(s=Math.abs(s),sWh?Nn:s},gy=function(s,a){return Jp(s)?s:Math.max(0,Math.min(Wh,s+a))},Bh=function(s){return s<0?-1:Hp(s)?fy():2*Math.asin(.5*Math.sqrt(s))},Lu=function(){return 1/0},Hp=function(s){return s==1/0},Jp=function(s){return s<0||Hp(s)},k0=function(s){return s>=0&&s<=Wh||Jp(s)},D0=function(s){return s>=Wh?Lu():s<0?0:Wp(s,10)},L0=function(s){return s<=0?Dh:s>Wh?Nn:Wp(s,-10)},B0=function(s){return 4.5*ol*s+16*ol*ol},F0=function(s){return ol*s},Ya=function(s,a){return Ah(Bh(s)+Bh(a))},yy=function(s,a){if(a==0)return s;if(s<=a)return 0;var n=s*(1-.25*a),c=a*(1-.25*s);return Math.max(0,n+c-2*Math.sqrt(n*c))},Kp=function(s){return Math.sqrt(Yp(s))||0},Yp=function(s){return s*(1-.25*s)||0},_y=function(s){return 1-.5*s||0},R0=function(s){return Kp(s)/_y(s)||0},O0={__proto__:null,fromAngle:Ah,fromSquaredLength:bu,expanded:gy,angle:Bh,infChordAngle:Lu,isInfinity:Hp,isSpecial:Jp,isValid:k0,successor:D0,predecessor:L0,maxPointError:B0,maxAngleError:F0,add:Ya,sub:yy,sin:Kp,sin2:Yp,cos:_y,tan:R0},xi=function(){function g(a,n){this.lo=a,this.hi=n}g.fromEndpoints=function(n,c){var f=new g(n,c);return n===-Math.PI&&c!==Math.PI&&(f.lo=Math.PI),c===-Math.PI&&n!==Math.PI&&(f.hi=Math.PI),f},g.fromPointPair=function(n,c){return n===-Math.PI&&(n=Math.PI),c===-Math.PI&&(c=Math.PI),g.positiveDistance(n,c)<=Math.PI?new g(n,c):new g(c,n)},g.emptyInterval=function(){return new g(Math.PI,-Math.PI)},g.fullInterval=function(){return new g(-Math.PI,Math.PI)};var s=g.prototype;return s.isValid=function(){return Math.abs(this.lo)<=Math.PI&&Math.abs(this.hi)<=Math.PI&&!(this.lo===-Math.PI&&this.hi!==Math.PI)&&!(this.hi===-Math.PI&&this.lo!==Math.PI)},s.isFull=function(){return this.lo===-Math.PI&&this.hi===Math.PI},s.isEmpty=function(){return this.lo===Math.PI&&this.hi===-Math.PI},s.isInverted=function(){return this.lo>this.hi},s.equals=function(n){return this.lo==n.lo&&this.hi==n.hi||this.isEmpty()&&n.isEmpty()},s.invert=function(){return new g(this.hi,this.lo)},s.center=function(){var n=.5*(this.lo+this.hi);return this.isInverted()?n<=0?n+Math.PI:n-Math.PI:n},s.length=function(){var n=this.hi-this.lo;return n>=0||(n+=2*Math.PI,n>0)?n:-1},s.fastContains=function(n){return this.isInverted()?(n>=this.lo||n<=this.hi)&&!this.isEmpty():n>=this.lo&&n<=this.hi},s.contains=function(n){return n===-Math.PI&&(n=Math.PI),this.fastContains(n)},s.containsInterval=function(n){return this.isInverted()?n.isInverted()?n.lo>=this.lo&&n.hi<=this.hi:(n.lo>=this.lo||n.hi<=this.hi)&&!this.isEmpty():n.isInverted()?this.isFull()||n.isEmpty():n.lo>=this.lo&&n.hi<=this.hi},s.interiorContains=function(n){return n===-Math.PI&&(n=Math.PI),this.isInverted()?n>this.lo||nthis.lo&&nthis.lo&&n.hithis.lo||n.hithis.lo&&n.hi=this.lo:n.isInverted()?n.lo<=this.hi||n.hi>=this.lo:n.lo<=this.hi&&n.hi>=this.lo},s.interiorIntersects=function(n){return this.isEmpty()||n.isEmpty()||this.lo===this.hi?!1:this.isInverted()?n.isInverted()||n.lothis.lo:n.isInverted()?n.lothis.lo:n.lothis.lo||this.isFull()},g.positiveDistance=function(n,c){var f=c-n;return f>=0?f:c+Math.PI-(n-Math.PI)},s.union=function(n){return n.isEmpty()?this:this.fastContains(n.lo)?this.fastContains(n.hi)?this.containsInterval(n)?this:g.fullInterval():new g(this.lo,n.hi):this.fastContains(n.hi)?new g(n.lo,this.hi):this.isEmpty()||n.fastContains(this.lo)?n:g.positiveDistance(n.hi,this.lo)Math.PI?this:(n===-Math.PI&&(n=Math.PI),this.fastContains(n)?this:this.isEmpty()?new g(n,n):g.positiveDistance(n,this.lo)=0){if(this.isEmpty())return this;if(this.length()+2*n+2*ol>=2*Math.PI)return g.fullInterval()}else{if(this.isFull())return this;if(this.length()+2*n-2*ol<=0)return g.emptyInterval()}var c=g.fromEndpoints(ls(this.lo-n,2*Math.PI),ls(this.hi+n,2*Math.PI));return c.lo<=-Math.PI&&(c.lo=Math.PI),c},s.approxEqual=function(n){return this.isEmpty()?n.length()<=2*No:n.isEmpty()?this.length()<=2*No:this.isFull()?n.length()>=2*(Math.PI-No):n.isFull()?this.length()>=2*(Math.PI-No):Math.abs(ls(n.lo-this.lo,2*Math.PI))<=No&&Math.abs(ls(n.hi-this.hi,2*Math.PI))<=No&&Math.abs(this.length()-n.length())<=2*No},s.toString=function(){return"["+this.lo.toFixed(7)+", "+this.hi.toFixed(7)+"]"},s.complement=function(){return this.lo===this.hi?g.fullInterval():new g(this.hi,this.lo)},s.complementCenter=function(){return this.lo!==this.hi?this.complement().center():this.hi<=0?this.hi+Math.PI:this.hi-Math.PI},s.directedHausdorffDistance=function(n){if(n.containsInterval(this))return 0;if(n.isEmpty())return Math.PI;var c=n.complementCenter();if(this.contains(c))return g.positiveDistance(n.hi,c);var f=0;g.fromEndpoints(n.hi,c).contains(this.hi)&&(f=g.positiveDistance(n.hi,this.hi));var m=0;return g.fromEndpoints(c,n.lo).contains(this.lo)&&(m=g.positiveDistance(this.lo,n.lo)),Math.max(f,m)},s.project=function(n){if(n===-Math.PI&&(n=Math.PI),this.fastContains(n))return n;var c=g.positiveDistance(n,this.lo),f=g.positiveDistance(this.hi,n);return c>1),a+(h[0]&1),n,c,f^il[0]),Js(g,s+(h[1]>>1),a+(h[1]&1),n,c+1,f^il[1]),Js(g,s+(h[2]>>1),a+(h[2]&1),n,c+2,f^il[2]),Js(g,s+(h[3]>>1),a+(h[3]&1),n,c+3,f^il[3])}var N0=3,by=6,$t=30,Hh=2*$t+1,Tr=Number(1n<sg?1:s/sg},hn=function(s){return s>=.5?1/3*(4*s*s-1):1/3*(1-4*(1-s)*(1-s))},Fn=function(s){return s>=0?.5*Math.sqrt(1+3*s):1-.5*Math.sqrt(1-3*s)},Rh=function(s){var a=s.largestComponent();switch(a){case $e.X_AXIS:s.x<0&&(a+=3);break;case $e.Y_AXIS:s.y<0&&(a+=3);break;case $e.Z_AXIS:s.z<0&&(a+=3);break}return a},Wo=function(s,a){switch(s){case 0:return[a.y/a.x,a.z/a.x];case 1:return[-a.x/a.y,a.z/a.y];case 2:return[-a.x/a.z,-a.y/a.z];case 3:return[a.z/a.x,a.y/a.x];case 4:return[a.z/a.y,-a.x/a.y];default:return[-a.y/a.z,-a.x/a.z]}},wu=function(s){var a=Rh(s),n=Wo(a,s),c=n[0],f=n[1];return[a,c,f]},Un=function(s,a,n){switch(s){case 0:return new $e(1,a,n);case 1:return new $e(-a,1,n);case 2:return new $e(-a,-n,1);case 3:return new $e(-1,-n,-a);case 4:return new $e(n,-1,-a);default:return new $e(n,a,-1)}},U0=function(s,a){switch(s){case 0:if(a.x<=0)return[0,0,!1];break;case 1:if(a.y<=0)return[0,0,!1];break;case 2:if(a.z<=0)return[0,0,!1];break;case 3:if(a.x>=0)return[0,0,!1];break;case 4:if(a.y>=0)return[0,0,!1];break;default:if(a.z>=0)return[0,0,!1];break}var n=Wo(s,a),c=n[0],f=n[1];return[c,f,!0]},Qs=function(s,a){switch(s){case 0:return new $e(a.y,a.z,a.x);case 1:return new $e(-a.x,a.z,a.y);case 2:return new $e(-a.x,-a.y,a.z);case 3:return new $e(-a.z,-a.y,-a.x);case 4:return new $e(-a.z,a.x,-a.y);default:return new $e(a.y,a.x,-a.z)}},mu=function(s,a,n){return Un(s,hn(Ks(a)),hn(Ks(n)))},og=function(s,a){switch(s){case 0:return new $e(a,-1,0);case 1:return new $e(1,a,0);case 2:return new $e(1,0,a);case 3:return new $e(-a,0,1);case 4:return new $e(0,-a,1);default:return new $e(0,-1,-a)}},ag=function(s,a){switch(s){case 0:return new $e(-a,0,1);case 1:return new $e(0,-a,1);case 2:return new $e(0,-1,-a);case 3:return new $e(a,-1,0);case 4:return new $e(1,a,0);default:return new $e(1,0,a)}},j0=[[new $e(0,1,0),new $e(0,0,1),new $e(1,0,0)],[new $e(-1,0,0),new $e(0,0,1),new $e(0,1,0)],[new $e(-1,0,0),new $e(0,-1,0),new $e(0,0,1)],[new $e(0,0,-1),new $e(0,-1,0),new $e(-1,0,0)],[new $e(0,0,-1),new $e(1,0,0),new $e(0,-1,0)],[new $e(0,1,0),new $e(1,0,0),new $e(0,0,-1)]],$0=[[[4,1],[5,2],[3,0]],[[0,3],[5,2],[4,1]],[[0,3],[1,4],[5,2]],[[2,5],[1,4],[0,3]],[[2,5],[3,0],[1,4]],[[4,1],[3,0],[2,5]]],wy=function(s,a){return j0[s][a]},Iu=function(s,a,n){return $0[s][a][n]},q0=function(s){return wy(s,0)},Z0=function(s){return wy(s,1)},Pp=Math.PI/2,lg=-Pp,jt=function(){function g(a,n){this.lat=a,this.lng=n}g.fromDegrees=function(n,c){return new g(n*$o,c*$o)},g.latitude=function(n){var c=n.vector;return Math.atan2(c.z,Math.sqrt(c.x*c.x+c.y*c.y))},g.longitude=function(n){return Math.atan2(n.vector.y,n.vector.x)},g.fromPoint=function(n){return new g(this.latitude(n),this.longitude(n))};var s=g.prototype;return s.isValid=function(){return Math.abs(this.lat)<=Math.PI/2&&Math.abs(this.lng)<=Math.PI},s.normalized=function(){var n=this.lat;n>Pp?n=Pp:n0},qo=function(s,a,n){var c=Tp(s,a,n);return c===cs&&(c=Ap(s,a,n)),c},K0=function(s,a,n){var c=a.vector.sub(s.vector),f=c.norm2(),m=n.vector.sub(a.vector),h=m.norm2(),P=s.vector.sub(n.vector),L=P.norm2(),V,B,U;f>=h&&f>=L?(V=P,B=m,U=n.vector):h>=L?(V=c,B=P,U=s.vector):(V=m,B=c,U=a.vector);var ue=-V.cross(B).dot(U),ye=J0*Math.sqrt(V.norm2()*B.norm2());return ue>ye?pl:ue<-ye?Cu:cs},Tp=function(s,a,n){var c=s.vector.cross(a.vector).dot(n.vector);return c>hg?pl:c<-hg?Cu:cs},Ap=function(s,a,n){if(s.equals(a)||a.equals(n)||n.equals(s))return cs;var c=K0(s,a,n);return c!==cs?c:Y0(s,a,n,!0)},Y0=function(s,a,n,c){var f=pl,m=s,h=a,P=n;if(m.vector.cmp(h.vector)>0){var L=[h,m];m=L[0],h=L[1],f=-f}if(h.vector.cmp(P.vector)>0){var V=[P,h];h=V[0],P=V[1],f=-f}if(m.vector.cmp(h.vector)>0){var B=[h,m];m=B[0],h=B[1],f=-f}var U=lp.fromVector(m.vector),ue=lp.fromVector(h.vector),ye=lp.fromVector(P.vector),Se=ue.cross(ye),Ne=U.dot(Se),Re=Ne.getSign();return Re===cs&&c&&(Re=Q0(U,ue,ye,Se)),f*Re},Q0=function(s,a,n,c){var f=c.z.getSign();return f!==0||(f=c.y.getSign(),f!==0)||(f=c.x.getSign(),f!==0)||(f=n.x.mul(s.y).sub(n.y.mul(s.x)).getSign(),f!==0)||(f=n.x.getSign(),f!==0)||(f=-n.y.getSign(),f!==0)||(f=n.z.mul(s.x).sub(n.x.mul(s.z)).getSign(),f!==0)||(f=n.z.getSign(),f!==0)||(f=s.x.mul(a.y).sub(s.y.mul(a.x)).getSign(),f!==0)||(f=-a.x.getSign(),f!==0)||(f=a.y.getSign(),f!==0)||(f=s.x.getSign(),f!==0)?f:pl},ve=function(){function g(a,n,c){this.vector=new $e(a,n,c)}g.fromVector=function(n){return new g(n.x,n.y,n.z)},g.fromLatLng=function(n){var c=n.lat,f=n.lng,m=Math.cos(c);return new g(Math.cos(f)*m,Math.sin(f)*m,Math.sin(c))},g.fromCoords=function(n,c,f){return n===0&&c===0&&f===0?this.originPoint():g.fromVector(new $e(n,c,f).normalize())},g.originPoint=function(){return new g(-.00999946643502502,.002592454260932412,.999946643502502)};var s=g.prototype;return s.pointCross=function(n){var c=this.vector.add(n.vector).cross(n.vector.sub(this.vector));return c.x===0&&c.y===0&&c.z===0&&(c=this.vector.ortho()),g.fromVector(c)},g.orderedCCW=function(n,c,f,m){var h=0;return qo(c,m,n)!==Cu&&h++,qo(f,m,c)!==Cu&&h++,qo(n,m,f)===pl&&h++,h>=2},s.distance=function(n){return this.vector.angle(n.vector)},s.equals=function(n){return this.vector.equals(n.vector)},s.approxEqual=function(n,c){return c===void 0&&(c=Cy),this.vector.angle(n.vector)<=c},s.stableAngle=function(n){return 2*Math.atan2(this.vector.sub(n.vector).norm(),this.vector.add(n.vector).norm())},g.chordAngleBetweenPoints=function(n,c){return Math.min(4,n.vector.sub(c.vector).norm2())},g.regularPoints=function(n,c,f){return this.regularPointsForFrame(ef(n),c,f)},g.regularPointsForFrame=function(n,c,f){for(var m=Math.cos(c),h=Math.sin(c),P=2*Math.PI/f,L=[],V=0;Vn?n:s},ex=function(s){for(var a=s,n=arguments.length,c=new Array(n>1?n-1:0),f=1;fa&&(a=P)}return a},tx=function(s){for(var a=s,n=arguments.length,c=new Array(n>1?n-1:0),f=1;f1?a-1:0),c=1;c1?a-1:0),c=1;c>BigInt(Hh))},ix=function(s){return s&~0n>>BigInt(N0)},ir=function(s){return $t-(S0(s)>>>1)},oi=function(s,a){var n=Jo(a);return s&-n|n},tf=function(s){var a=_i(s)<<2n;return s&-a|a},Jh=function(s){return(s&Jo(0)-1n)===0n},Su=function(s){return typeof s!="bigint"||BigInt.asUintN(64,s)!=s?!1:Rn(s)<=by&&(_i(s)&0x1555555555555555n)!=0n},rf=function(s){return(s&1n)!=0n},_i=function(s){return s&-s},Jo=function(s){return 1n<>2n),n>>=1n,a[1]=a[0]+n,a[2]=a[1]+n,a[3]=a[2]+n,a},Sy=function(s,a){var n=[],c=so(s),f=c.f,m=c.i,h=c.j,P=gr(ir(s));m&=-P,h&=-P;for(var L=gr(a),V=-L;;V+=L){var B=void 0;if(V<0?B=h+V>=0:V>=P?B=h+V=0),a)),n.push(oi(Ys(f,m+V,h+P,h+P=0),a)),n.push(oi(Ys(f,m+P,h+V,B&&m+P=P)break}return n},Ht=function(s){return s-(_i(s)-1n)},Wt=function(s){return s+(_i(s)-1n)},Go=function(s,a){return Ht(s)<=a&&a<=Wt(s)},My=function(s,a){return Ht(a)<=Wt(s)&&Wt(a)>=Ht(s)},rx=function(s){var a=s.toString(16).replace(/0+$/,"");return a.length===0?"X":a},nx=function(s){if(s.length>16)return 0n;var a=BigInt("0x"+s);return s.length<16&&(a=a<$t)return 0n;var n=parseInt(s[0],10);if(n<0||n>5||s[1]!=="/")return 0n;for(var c=fl(n),f=2;f3)return 0n;c=Kh(c)[m]}return c},ox=function(s,a,n){return oi((BigInt(s)<=0;m--){var h=(1<>m*Er&h)<>m*Er&h)<<2,f=xy[f],c|=BigInt(f>>2)<=0;h--)n+=Number((s>>BigInt(h*2*Er+1)&(1n<>Er+2<>2&(1<>2n)&1n)!=0n&&(m=2),{face:n,si:2*c+m,ti:2*f+m}},Bu=function(s,a,n){var c=gr(n),f=s&-c,m=a&-c;return new pi(new Ft(hn(rl(f)),hn(rl(f+c))),new Ft(hn(rl(m)),hn(rl(m+c))))},Qh=function(s){var a=nf(s),n=a.face,c=a.si,f=a.ti;return mu(n,c,f)},sf=function(s){return ve.fromVector(Qh(s).normalize())},lx=function(s){return jt.fromPoint(ve.fromVector(Qh(s)))},hx=function(s){var a=ir(s),n=gr(a),c=so(s),f=c.f,m=c.i,h=c.j;return[oi(nl(f,m,h-n),a),oi(nl(f,m+n,h),a),oi(nl(f,m,h+n),a),oi(nl(f,m-n,h),a)]},Ay=function(s,a){var n=gr(a+1),c=n<<1,f=so(s),m=f.f,h=f.i,P=f.j,L=!1,V=!1,B=0,U=0;h&n?(B=c,L=h+c=0),P&n?(U=c,V=P+c=0);var ue=[oi(s,a),oi(Ys(m,h+B,P,L),a),oi(Ys(m,h,P+U,V),a)];return(L||V)&&ue.push(oi(Ys(m,h+B,P+U,L&&V),a)),ue},of=function(s){var a=_i(s);return s-a+(a>>2n)},Fu=function(s,a){return s-_i(s)+Jo(a)},zy=function(s){var a=_i(s);return s+a+(a>>2n)},af=function(s,a){return s+_i(s)+Jo(a)},Ar=function(s){return s+(_i(s)<<1n)},ky=function(s){return s-(_i(s)<<1n)},cx=function(s){var a=Ar(s);return a60?[0,!1]:[60-c>>1,!0]},Lp=function(s,a){var n=Ht(s);if(n>=Ht(a))return a;if(Wt(s)>=a){for(;s=Kh(s)[0],!(Wt(s)=a)break;s=c}return s},dx=function(s,a){if(a===0n)return s;var n=BigInt(2*($t-ir(s))+1);if(a<0n){var c=-(s>>n);a>n;a>f&&(a=f)}return s+(a<a?1:0},px=function(s,a){return s>a?-1:sf&&n.vector.dot(this.aTangent.vector)>f||this.c.vector.dot(this.bTangent.vector)>f&&n.vector.dot(this.bTangent.vector)>f)return this.c=n,this.acb=-c,Wr;if(this.a.equals(this.c)||this.a.equals(n)||this.b.equals(this.c)||this.b.equals(n))return this.c=n,this.acb=-c,Mu;if(this.a.equals(this.b)||this.c.equals(n))return this.c=n,this.acb=-c,Wr;if(this.acb===cs&&(this.acb=-Ap(this.a,this.b,this.c)),c===cs&&(c=Ap(this.a,this.b,n)),c!==this.acb)return this.c=n,this.acb=-c,Wr;var m=-qo(this.c,n,this.b);if(m!==this.acb)return this.c=n,this.acb=-c,Wr;var h=qo(this.c,n,this.a);return h!==this.acb?(this.c=n,this.acb=-c,Wr):(this.c=n,this.acb=-c,wn)},g}(),wn=0,Mu=1,Wr=2,mx=function(s,a,n,c){var f=Jr.newChainEdgeCrosser(s,a,n);return f.chainCrossingSign(c)},Dy=function(s,a,n,c){if(s.equals(a)||n.equals(c))return!1;switch(!0){case s.equals(n):return a.equals(c)||ve.orderedCCW(s.referenceDir(),c,a,s);case a.equals(c):return ve.orderedCCW(a.referenceDir(),n,s,a);case s.equals(c):return a.equals(n)||ve.orderedCCW(s.referenceDir(),n,a,s);case a.equals(n):return ve.orderedCCW(a.referenceDir(),c,s,a)}return!1},gx=function(s,a,n){return!ve.orderedCCW(a.referenceDir(),n,s,a)},zt=function(){function g(a,n){this.lat=a,this.lng=n}g.emptyRect=function(){return new g(Ft.empty(),xi.emptyInterval())},g.fullRect=function(){return new g(g.validRectLatRange,g.validRectLngRange)},g.fromLatLng=function(n){return new g(new Ft(Gr(n.lat),Gr(n.lat)),new xi(Gr(n.lng),Gr(n.lng)))},g.fromCenterSize=function(n,c){var f=new jt(c.lat/2,c.lng/2);return g.fromLatLng(n).expanded(f)};var s=g.prototype;return s.equals=function(n){return this.lat.equals(n.lat)&&this.lng.equals(n.lng)},s.isValid=function(){return Math.abs(this.lat.lo)<=Math.PI/2&&Math.abs(this.lat.hi)<=Math.PI/2&&this.lng.isValid()&&this.lat.isEmpty()===this.lng.isEmpty()},s.isEmpty=function(){return this.lat.isEmpty()},s.isFull=function(){return this.lat.equals(g.validRectLatRange)&&this.lng.isFull()},s.isPoint=function(){return this.lat.lo===this.lat.hi&&this.lng.lo===this.lng.hi},s.vertex=function(n){var c,f;switch(n){case 0:c=this.lat.lo,f=this.lng.lo;break;case 1:c=this.lat.lo,f=this.lng.hi;break;case 2:c=this.lat.hi,f=this.lng.hi;break;default:c=this.lat.hi,f=this.lng.lo;break}return new jt(c,f)},s.lo=function(){return new jt(this.lat.lo,this.lng.lo)},s.hi=function(){return new jt(this.lat.hi,this.lng.hi)},s.center=function(){return new jt(this.lat.center(),this.lng.center())},s.size=function(){return new jt(this.lat.length(),this.lng.length())},s.area=function(){if(this.isEmpty())return 0;var n=Math.abs(Math.sin(this.lat.hi)-Math.sin(this.lat.lo));return this.lng.length()*n},s.addPoint=function(n){return n.isValid()?new g(this.lat.addPoint(Gr(n.lat)),this.lng.addPoint(Gr(n.lng))):this},s.expanded=function(n){var c=this.lat.expanded(Gr(n.lat)),f=this.lng.expanded(Gr(n.lng));return c.isEmpty()||f.isEmpty()?g.emptyRect():new g(c.intersection(g.validRectLatRange),f)},s.toString=function(){return"[Lo"+this.lo()+", Hi"+this.hi()+"]"},s.polarClosure=function(){return this.lat.lo===-Math.PI/2||this.lat.hi===Math.PI/2?new g(this.lat,xi.fullInterval()):this},s.union=function(n){return new g(this.lat.union(n.lat),this.lng.union(n.lng))},s.intersection=function(n){var c=this.lat.intersection(n.lat),f=this.lng.intersection(n.lng);return c.isEmpty()||f.isEmpty()?g.emptyRect():new g(c,f)},s.intersects=function(n){return this.lat.intersects(n.lat)&&this.lng.intersects(n.lng)},s.capBound=function(){if(this.isEmpty())return eo.emptyCap();var n,c;this.lat.hi+this.lat.lo<0?(n=-1,c=Math.PI/2+this.lat.hi):(n=1,c=Math.PI/2-this.lat.lo);var f=eo.fromCenterAngle(new ve(0,0,n),c);if(ls(this.lng.hi-this.lng.lo,2*Math.PI)>=0&&this.lng.hi-this.lng.lo<2*Math.PI){var m=eo.fromPoint(ve.fromLatLng(this.center())).addPoint(ve.fromLatLng(this.lo())).addPoint(ve.fromLatLng(this.hi()));if(m.height()=h.z)return!1;var L=P/h.z,V=Math.sqrt(1-L*L),B=Math.atan2(V,L),U=xi.fromPointPair(Math.atan2(s.vector.dot(m),s.vector.dot(h)),Math.atan2(a.vector.dot(m),a.vector.dot(h)));if(U.contains(B)){var ue=h.mul(L).add(m.mul(V));if(c.contains(Math.atan2(ue.y,ue.x)))return!0}if(U.contains(-B)){var ye=h.mul(L).sub(m.mul(V));if(c.contains(Math.atan2(ye.y,ye.x)))return!0}return!1},ug=function(s,a,n,c){return mx(s,a,ve.fromLatLng(new jt(n.lo,c)),ve.fromLatLng(new jt(n.hi,c)))===wn},lf=function(){function g(a,n){this.dim=a,this.deriv=n}var s=g.prototype;return s.value=function(n){return Cp(this.deriv,-this.dim*n)},s.minLevel=function(n){if(n<=0)return $t;var c=-(ng(n/this.deriv)>>this.dim-1);return c>$t&&(c=$t),c<0&&(c=0),c||0},s.maxLevel=function(n){if(n<=0)return $t;var c=ng(this.deriv/n)>>this.dim-1;return c>$t&&(c=$t),c<0&&(c=0),c||0},s.closestLevel=function(n){var c=Math.SQRT2;return this.dim===2&&(c=2),this.minLevel(c*n)},g}(),Fp=new lf(1,2*Math.SQRT2/3),yx=new lf(1,1.4592137463861061),Rp=new lf(2,4*Math.PI/6),_x=function(s,a,n){return Bh(hf(s,a,n,0,!0).dist)},up=function(s,a,n,c){return hf(s,a,n,c,!1)},dg=function(s,a,n,c){var f=kp(ve.chordAngleBetweenPoints(s,a),ve.chordAngleBetweenPoints(s,n));if(f>Lh){var m=hf(ve.fromVector(s.vector.mul(-1)),a,n,f,!0);f=m.dist,f=Nn-f}return c=c?{dist:c,less:!1}:{dist:B,less:!0}},xx=function(s,a,n,c,f){var m=s.vector.sub(a.vector).norm2(),h=s.vector.sub(n.vector).norm2(),P=a.vector.sub(n.vector).norm2(),L=4.75*ii*(m+h+P)+8*ii*ii;if(Math.abs(m-h)>=P+L)return{dist:c,less:!1};var V=a.pointCross(n),B=V.vector.norm2(),U=s.vector.dot(V.vector),ue=U*U;if(!f&&ue>B*c)return{dist:c,less:!1};var ye=V.vector.cross(s.vector);if(a.vector.sub(s.vector).dot(ye)>=0||n.vector.sub(s.vector).dot(ye)<=0)return{dist:c,less:!1};var Se=1-Math.sqrt(ye.norm2()/B),Ne=ue/B+Se*Se;return!f&&Ne>=c?{dist:c,less:!1}:{dist:Ne,less:!0}},pg=ve.fromCoords(1,0,0),eo=function(){function g(a,n){this.center=a,this.rad=n}g.fromPoint=function(n){return g.fromCenterChordAngle(n,0)},g.fromCenterAngle=function(n,c){return g.fromCenterChordAngle(n,Ah(c))},g.fromCenterChordAngle=function(n,c){return new g(n,c)},g.fromCenterHeight=function(n,c){return g.fromCenterChordAngle(n,bu(2*c))},g.fromCenterArea=function(n,c){return g.fromCenterChordAngle(n,bu(c/Math.PI))},g.fromCap=function(n){return new g(ve.fromVector(n.center.vector),n.rad)},g.emptyCap=function(){return g.fromCenterChordAngle(pg,Dh)},g.fullCap=function(){return g.fromCenterChordAngle(pg,Nn)};var s=g.prototype;return s.isValid=function(){return this.center.vector.isUnit()&&this.rad<=Nn},s.isEmpty=function(){return this.rad<0},s.isFull=function(){return this.rad==Nn},s.centerPoint=function(){return this.center},s.height=function(){return .5*this.rad},s.radius=function(){return Bh(this.rad)},s.area=function(){return 2*Math.PI*Math.max(0,this.height())},s.contains=function(n){return this.isFull()||n.isEmpty()?!0:this.rad>=Ya(ve.chordAngleBetweenPoints(this.center,n.center),n.rad)},s.intersects=function(n){return this.isEmpty()||n.isEmpty()?!1:Ya(this.rad,n.rad)>=ve.chordAngleBetweenPoints(this.center,n.center)},s.interiorIntersects=function(n){return this.rad<=0||n.isEmpty()?!1:Ya(this.rad,n.rad)>ve.chordAngleBetweenPoints(this.center,n.center)},s.intersectsCell=function(n){for(var c=[],f=0;f<4;f++)if(c[f]=n.vertex(f),this.containsPoint(c[f]))return!0;return this._intersects(n,c)},s._intersects=function(n,c){if(this.rad>=Lh||this.isEmpty())return!1;if(n.containsPoint(this.center))return!0;for(var f=Yp(this.rad),m=0;m<4;m++){var h=n.edge(m).vector,P=this.center.vector.dot(h);if(!(P>0)){if(P*P>f*h.norm2())return!1;var L=h.cross(this.center.vector);if(L.dot(c[m].vector)<0&&L.dot(c[m+1&3].vector)>0)return!0}}return!1},s.containsPoint=function(n){return ve.chordAngleBetweenPoints(this.center,n)<=this.rad},s.containsCell=function(n){for(var c=[],f=0;f<4;f++)if(c[f]=n.vertex(f),!this.containsPoint(c[f]))return!1;return!this.complement()._intersects(n,c)},s.interiorContainsPoint=function(n){return this.isFull()||ve.chordAngleBetweenPoints(this.center,n)=Math.PI/2&&(f.hi=Math.PI/2,c=!0),!c){var h=Kp(this.rad),P=Math.cos(jt.latitude(this.center));if(h<=P){var L=Math.asin(h/P);m.lo=ls(jt.longitude(this.center)-L,Math.PI*2),m.hi=ls(jt.longitude(this.center)+L,Math.PI*2)}}return new zt(f,m)},s.equals=function(n){return this.rad===n.rad&&this.center.equals(n.center)||this.isEmpty()&&n.isEmpty()||this.isFull()&&n.isFull()},s.approxEqual=function(n){var c=1e-14,f=this.rad,m=n.rad;return this.center.approxEqual(n.center)&&Math.abs(f-m)<=c||this.isEmpty()&&m<=c||n.isEmpty()&&f<=c||this.isFull()&&m>=2-c||n.isFull()&&f>=2-c},s.addPoint=function(n){if(this.isEmpty())return new g(n,0);var c=ve.chordAngleBetweenPoints(this.center,n);return c>this.rad&&(this.rad=c),this},s.addCap=function(n){if(this.isEmpty())return n;if(n.isEmpty())return this;var c=Ya(ve.chordAngleBetweenPoints(this.center,n.center),n.rad),f=gy(c,ii*c);return f>this.rad&&(this.rad=f),this},s.expanded=function(n){return this.isEmpty()?g.emptyCap():g.fromCenterChordAngle(this.center,Ya(this.rad,Ah(n)))},s.toString=function(){return"[Center="+this.center.vector+", Radius="+io(this.radius())+"]"},g.radiusToHeight=function(n){return n<0?Dh:n>=Math.PI?Lh:.5*Ah(n)},s.cellUnionBound=function(){var n=Fp.maxLevel(this.radius())-1;if(n<0){for(var c=[],f=0;f<6;f++)c[f]=fl(f);return c}return Ay(ml(this.center),n)},s.centroid=function(){if(this.isEmpty())return new ve(0,0,0);var n=1-.5*this.height();return ve.fromVector(this.center.vector.mul(n*this.area()))},s.union=function(n){var c=this;if(c.rad=P+h)return c;var L=.5*(P+m+h),V=Ly(.5*(P-m+h),c.center,n.center);return g.fromCenterAngle(V,L)},g}(),Op=function(s,a,n){var c=a.stableAngle(n),f=n.stableAngle(s),m=s.stableAngle(a),h=.5*(c+f+m);if(h>=3e-4){var P=h-Math.max(c,f,m);if(P<.01*h*h*h*h*h){var L=bx(s,a,n);if(P>1,V=P&1;L===1?(h.uv.x.hi=this.uv.x.hi,h.uv.x.lo=c.x):(h.uv.x.lo=this.uv.x.lo,h.uv.x.hi=c.x),V===1?(h.uv.y.hi=this.uv.y.hi,h.uv.y.lo=c.y):(h.uv.y.lo=this.uv.y.lo,h.uv.y.hi=c.y),f=Ar(f),n.push(h)}return n},s.exactArea=function(){var n=this.vertex(0),c=this.vertex(1),f=this.vertex(2),m=this.vertex(3);return Op(n,c,f)+Op(n,f,m)},s.approxArea=function(){if(this.level<2)return this.averageArea();var n=.5*this.vertex(2).vector.sub(this.vertex(0).vector).cross(this.vertex(3).vector.sub(this.vertex(1).vector)).norm();return n*2/(1+Math.sqrt(1-Math.min(1/Math.PI*n,1)))},s.averageArea=function(){return Rp.value(this.level)},s.intersectsCell=function(n){return My(this.id,n.id)},s.containsCell=function(n){return Go(this.id,n.id)},s.cellUnionBound=function(){return this.capBound().cellUnionBound()},s.latitude=function(n,c){var f,m;switch(!0){case(n===0&&c===0):f=this.uv.x.lo,m=this.uv.y.lo;break;case(n===0&&c===1):f=this.uv.x.lo,m=this.uv.y.hi;break;case(n===1&&c===0):f=this.uv.x.hi,m=this.uv.y.lo;break;case(n===1&&c===1):f=this.uv.x.hi,m=this.uv.y.hi;break;default:throw new Error("i and/or j is out of bounds")}return jt.latitude(ve.fromVector(Un(this.face,f,m)))},s.longitude=function(n,c){var f,m;switch(!0){case(n===0&&c===0):f=this.uv.x.lo,m=this.uv.y.lo;break;case(n===0&&c===1):f=this.uv.x.lo,m=this.uv.y.hi;break;case(n===1&&c===0):f=this.uv.x.hi,m=this.uv.y.lo;break;case(n===1&&c===1):f=this.uv.x.hi,m=this.uv.y.hi;break;default:throw new Error("i and/or j is out of bounds")}return jt.longitude(ve.fromVector(Un(this.face,f,m)))},s.rectBound=function(){if(this.level>0){var n=this.uv.x.lo+this.uv.x.hi,c=this.uv.y.lo+this.uv.y.hi,f,m;q0(this.face).z===0?f=n<0?1:0:f=n>0?1:0,Z0(this.face).z===0?m=c<0?1:0:m=c>0?1:0;var h=Ft.fromPoint(this.latitude(f,m)).addPoint(this.latitude(1-f,1-m)),P=xi.emptyInterval().addPoint(this.longitude(f,1-m)).addPoint(this.longitude(1-f,m));return new zt(h,P).expanded(new jt(2*ii,2*ii)).polarClosure()}var L;switch(this.face){case 0:L=new zt(new Ft(-Math.PI/4,Math.PI/4),new xi(-Math.PI/4,Math.PI/4));break;case 1:L=new zt(new Ft(-Math.PI/4,Math.PI/4),new xi(Math.PI/4,3*Math.PI/4));break;case 2:L=new zt(new Ft(mg,Math.PI/2),xi.fullInterval());break;case 3:L=new zt(new Ft(-Math.PI/4,Math.PI/4),new xi(3*Math.PI/4,-3*Math.PI/4));break;case 4:L=new zt(new Ft(-Math.PI/4,Math.PI/4),new xi(-3*Math.PI/4,-Math.PI/4));break;default:L=new zt(new Ft(-Math.PI/2,-mg),xi.fullInterval())}return L.expanded(new jt(ii,0))},s.capBound=function(){for(var n=eo.fromPoint(ve.fromVector(Un(this.face,this.uv.center().x,this.uv.center().y).normalize())),c=0;c<4;c++)n=n.addPoint(this.vertex(c));return n},s.containsPoint=function(n){var c=U0(this.face,n.vector),f=c[0],m=c[1],h=c[2];return h?this.uv.expandedByMargin(ii).containsPoint(new Bt(f,m)):!1},s.vertexChordDist2=function(n,c,f){var m=this.uv.x.lo,h=this.uv.y.lo;return c&&(m=this.uv.x.hi),f&&(h=this.uv.y.hi),ve.chordAngleBetweenPoints(n,ve.fromCoords(m,h,1))},s.uEdgeIsClosest=function(n,c){var f=this.uv.x.lo,m=this.uv.x.hi,h=this.uv.y.lo;c&&(h=this.uv.y.hi);var P=new $e(h*h+1,-f*h,-f),L=new $e(h*h+1,-m*h,-m);return n.vector.dot(P)>0&&n.vector.dot(L)<0},s.vEdgeIsClosest=function(n,c){var f=this.uv.y.lo,m=this.uv.y.hi,h=this.uv.x.lo;c&&(h=this.uv.x.hi);var P=new $e(-h*f,h*h+1,-f),L=new $e(-h*m,h*h+1,-m);return n.vector.dot(P)>0&&n.vector.dot(L)<0},g.edgeDistance=function(n,c){var f=n*n/(1+c*c),m=1-Math.sqrt(1-f);return bu(f+m*m)},s.distanceInternal=function(n,c){var f=ve.fromVector(Qs(this.face,n.vector)),m=f.x-f.z*this.uv.x.lo,h=f.x-f.z*this.uv.x.hi,P=f.y-f.z*this.uv.y.lo,L=f.y-f.z*this.uv.y.hi,V=!0;return m<0&&(V=!1,this.vEdgeIsClosest(f,!1))?g.edgeDistance(-m,this.uv.x.lo):h>0&&(V=!1,this.vEdgeIsClosest(f,!0))?g.edgeDistance(h,this.uv.x.hi):P<0&&(V=!1,this.uEdgeIsClosest(f,!1))?g.edgeDistance(-P,this.uv.y.lo):L>0&&(V=!1,this.uEdgeIsClosest(f,!0))?g.edgeDistance(L,this.uv.y.hi):V?c?0:cp(g.edgeDistance(-m,this.uv.x.lo),g.edgeDistance(h,this.uv.x.hi),g.edgeDistance(-P,this.uv.y.lo),g.edgeDistance(L,this.uv.y.hi)):cp(this.vertexChordDist2(f,!1,!1),this.vertexChordDist2(f,!0,!1),this.vertexChordDist2(f,!1,!0),this.vertexChordDist2(f,!0,!0))},s.distance=function(n){return this.distanceInternal(n,!0)},s.maxDistance=function(n){var c=ve.fromVector(Qs(this.face,n.vector)),f=kp(this.vertexChordDist2(c,!1,!1),this.vertexChordDist2(c,!0,!1),this.vertexChordDist2(c,!1,!0),this.vertexChordDist2(c,!0,!0));return f<=Lh?f:Nn-this.distance(ve.fromVector(n.vector.mul(-1)))},s.boundaryDistance=function(n){return this.distanceInternal(n,!1)},s.distanceToEdge=function(n,c){var f=cp(this.distance(n),this.distance(c));if(f===0)return f;for(var m=Jr.newChainEdgeCrosser(n,c,this.vertex(3)),h=0;h<4;h++)if(m.chainCrossingSign(this.vertex(h))!==Wr)return 0;for(var P=0;P<4;P++)f=up(this.vertex(P),n,c,f).dist;return f},s.maxDistanceToEdge=function(n,c){var f=kp(this.maxDistance(n),this.maxDistance(c));return f<=Lh?f:Nn-this.distanceToEdge(ve.fromVector(n.vector.mul(-1)),ve.fromVector(c.vector.mul(-1)))},s.distanceToCell=function(n){if(this.face===n.face&&this.uv.intersects(n.uv))return 0;for(var c=[],f=[],m=0;m<4;m++)c.push(this.vertex(m)),f.push(n.vertex(m));for(var h=Lu(),P=0;P<4;P++)for(var L=0;L<4;L++)h=up(c[P],f[L],f[L+1&3],h).dist,h=up(f[P],c[L],c[L+1&3],h).dist;return h},s.maxDistanceToCell=function(n){var c=new pi(n.uv.y,n.uv.x);if(this.face===g.oppositeFace(n.face)&&this.uv.intersects(c))return Nn;for(var f=[],m=[],h=0;h<4;h++)f.push(this.vertex(h)),m.push(n.vertex(h));for(var P=Dh,L=0;L<4;L++)for(var V=0;V<4;V++)P=dg(f[L],m[V],m[V+1&3],P).dist,P=dg(m[L],f[V],f[V+1&3],P).dist;return P},g}(),ro=function(g){function s(){return g.apply(this,arguments)||this}Xh(s,g),s.fromRange=function(c,f){for(var m=new s,h=Lp(c,f);h!==f;h=Lp(Ar(h),f))m.push(h);return m},s.fromUnion=function(){for(var c=arguments.length,f=new Array(c),m=0;mV?c[h]<=Wt(f[P])?(m.push(c[h]),h++):(P=f.lowerBound(P+1,f.length,L),c[h]<=Wt(f[P-1])&&P--):V>L?f[P]<=Wt(c[h])?(m.push(f[P]),P++):(h=c.lowerBound(h+1,c.length,V),f[P]<=Wt(c[h-1])&&h--):c[h]0&&Wt(this[c-1])>=Ht(f))return!1}return!0},a.isNormalized=function(){for(var c=0;c0&&Wt(this[c-1])>=Ht(f)||c>=3&&s.areSiblings(this[c-3],this[c-2],this[c-1],f))return!1}return!0},a.normalize=function(){this.sort(Bp);for(var c=[],f=He(this),m;!(m=f()).done;){var h=m.value;if(!(c.length>0&&Go(c[c.length-1],h))){for(var P=c.length-1;P>=0&&Go(h,c[P]);)P--;for(c.length=P+1;c.length>=3&&s.areSiblings(c[c.length-3],c[c.length-2],c[c.length-1],h);)c.length-=3,h=tf(h);c.push(h)}}this.length=0,this.push.apply(this,c)},a.intersectsCellID=function(c){var f=this.lowerBound(0,this.length,c);return f!==this.length&&Ht(this[f])<=Wt(c)?!0:f!==0&&Wt(this[f-1])>=Ht(c)},a.containsCellID=function(c){var f=this.lowerBound(0,this.length,c);return f!==this.length&&Ht(this[f])<=c?!0:f!==0&&Wt(this[f-1])>=c},a.denormalize=function(c,f){for(var m=new s,h=He(this),P;!(P=h()).done;){var L=P.value,V=ir(L),B=V;if(B1&&(B+=($t-(B-c))%f,B>$t&&(B=$t)),B===V)m.push(L);else for(var U=af(L,B),ue=Fu(L,B);ue!==U;ue=Ar(ue))m.push(ue)}this.length=0,this.push.apply(this,m)},a.rectBound=function(){for(var c=zt.emptyRect(),f=He(this),m;!(m=f()).done;){var h=m.value;c=c.union(bn.fromCellID(h).rectBound())}return c},a.capBound=function(){if(this.length===0)return eo.emptyCap();for(var c=new ve(0,0,0),f=He(this),m;!(m=f()).done;){var h=m.value,P=Rp.value(ir(h));c=ve.fromVector(c.vector.add(sf(h).vector.mul(P)))}c.equals(new ve(0,0,0))?c=ve.fromCoords(1,0,0):c=ve.fromVector(c.vector.normalize());for(var L=eo.fromPoint(c),V=He(this),B;!(B=V()).done;){var U=B.value;L=L.addCap(bn.fromCellID(U).capBound())}return L},a.containsCell=function(c){return this.containsCellID(c.id)},a.intersectsCell=function(c){return this.intersectsCellID(c.id)},a.containsPoint=function(c){return this.containsCell(bn.fromPoint(c))},a.cellUnionBound=function(){return this.capBound().cellUnionBound()},a.leafCellsCovered=function(){for(var c=0n,f=He(this),m;!(m=f()).done;){var h=m.value;c+=1n<=m)return h;return f},a.cellUnionDifferenceInternal=function(c,f){if(!f.intersectsCellID(c)){this.push(c);return}if(!f.containsCellID(c))for(var m=He(Kh(c)),h;!(h=m()).done;){var P=h.value;this.cellUnionDifferenceInternal(P,f)}},a.expandAtLevel=function(c){for(var f=new s,m=Jo(c),h=this.length-1;h>=0;h--){var P=this[h];if(_i(P)0&&Go(P,this[h-1]);)h--;f.push(P),f.push.apply(f,Sy(P,c))}f.sort(Bp),this.length=0,this.push.apply(this,f),this.normalize()},a.expandByRadius=function(c,f){for(var m=$t,h=He(this),P;!(P=h()).done;){var L=P.value;m=Math.min(m,ir(L))}var V=Fp.maxLevel(c);V===0&&c>Fp.value(0)&&this.expandAtLevel(0),this.expandAtLevel(Math.min(m+f,V))},a.equals=function(c){if(this.length!==c.length)return!1;for(var f=0;f=Math.PI-2*ii&&(h=xi.fullInterval());var P=Ft.fromPoint(this.aLL.lat).addPoint(c.lat),L=f.cross(new $e(0,0,1)),V=L.dot(this.a.vector),B=L.dot(n.vector),U=606638e-21*m+683174e-36;if(V*B<0||Math.abs(V)<=U||Math.abs(B)<=U){var ue=Math.min(Math.atan2(Math.sqrt(f.x*f.x+f.y*f.y),Math.abs(f.z))+3*ii,Math.PI/2),ye=2*Math.asin(.5*this.a.vector.sub(n.vector).norm()*Math.sin(ue)),Se=.5*(ye-P.length())+ii;V<=U&&B>=-U&&(P.hi=Math.min(ue,P.hi+Se)),B<=U&&V>=-U&&(P.lo=Math.max(-ue,P.lo-Se))}this.a=n,this.aLL=c,this.bound=this.bound.union(new zt(P,h))},s.rectBound=function(){return this.bound.expanded(new jt(2*ii,0)).polarClosure()},g}();hl.expandForSubregions=function(g){if(g.isEmpty())return g;var s=Math.max(0,Math.PI-g.lng.length()-2.5*ii),a=Math.max(g.lat.lo,-g.lat.hi),n=Math.PI/2+g.lat.lo,c=Math.PI/2-g.lat.hi;if(a>=0){if(2*a+s<1354e-18)return zt.fullRect()}else if(s>=Math.PI/2){if(n+c<1687e-18)return zt.fullRect()}else if(Math.max(n,c)*s<1765e-18)return zt.fullRect();var f=9*ii,m=0;return s<=0&&(m=Math.PI),g.expanded(new jt(f,m)).polarClosure()};var jn=function(){function g(a,n){this.v0=a,this.v1=n}var s=g.prototype;return s.cmp=function(n){var c=this.v0.vector.cmp(n.v0.vector);return c!==0?c:this.v1.vector.cmp(n.v1.vector)},s.equals=function(n){return this.v0.equals(n.v0)&&this.v1.equals(n.v1)},g}(),al=function(s,a){this.start=s,this.length=a},Ru=function(s,a){this.chainID=s,this.offset=a},Ix=function(s,a){this.point=s,this.contained=a},Ou=function(s){return new Ix(ve.originPoint(),s)},By=0,Cx=1,Sx=2,Mx=function(s){return s.numEdges()===0&&(s.dimension()!==2||s.numChains()===0)},Px=function(s){return s.numEdges()===0&&s.dimension()===2&&s.numChains()>0},Mh=function(){function g(){}var s=g.prototype;return s.numEdges=function(){return 0},s.edge=function(n){return new jn(ve.originPoint(),ve.originPoint())},s.referencePoint=function(){return Ou(!1)},s.numChains=function(){return 0},s.chain=function(n){return new al(0,0)},s.chainEdge=function(n,c){return new jn(ve.originPoint(),ve.originPoint())},s.chainPosition=function(n){return new Ru(0,0)},s.dimension=function(){return-1},s.isEmpty=function(){return!0},s.isFull=function(){return!1},s.typeTag=function(){return By},s.privateInterface=function(){},g}(),gg=function(){function g(a,n){this.containsCenter=!1,this.shapeID=a,this.containsCenter=!1,this.edges=new Array(n)}var s=g.prototype;return s.numEdges=function(){return this.edges.length},s.containsEdge=function(n){for(var c=He(this.edges),f;!(f=c()).done;){var m=f.value;if(m===n)return!0}return!1},g}(),Fy=function(){function g(){this.shapeID=0,this.containsCenter=!1,this.edges=[]}var s=g.prototype;return s.numEdges=function(){return 0},s.containsEdge=function(n){return!1},g}(),Ex=function(){function g(a){this.shapes=new Array(a)}var s=g.prototype;return s.numEdges=function(){for(var n=0,c=He(this.shapes),f;!(f=c()).done;){var m=f.value;n+=m.numEdges()}return n},s.add=function(n){this.shapes.push(n)},s.findByShapeID=function(n){for(var c=He(this.shapes),f;!(f=c()).done;){var m=f.value;if(m.shapeID===n)return m}return new Fy},g}(),dp=function(){function g(){this.shapes=[]}var s=g.prototype;return s.numEdges=function(){return 0},s.add=function(n){},s.findByShapeID=function(n){return new Fy},g}(),Vp=0,Ry=0,pp=function(){function g(a,n){if(this.index=a,this.position=0,this.id=Zo,this.cell=new dp,n!==void 0)switch(n){case Vp:this.begin();break;case Ry:this.end();break;default:throw new Error("unknown ShapeIndexIteratorPos value")}}var s=g.prototype;return s.clone=function(){var n=new g(this.index);return n.position=this.position,n.id=this.id,n.cell=this.cell,n},s.cellID=function(){return this.id},s.indexCell=function(){return this.cell},s.center=function(){return sf(this.cellID())},s.begin=function(){this.index.isFresh()||this.index.maybeApplyUpdates(),this.position=0,this.refresh()},s.next=function(){this.position++,this.refresh()},s.prev=function(){return this.position<=0?!1:(this.position--,this.refresh(),!0)},s.end=function(){this.position=this.index.cells.length,this.refresh()},s.done=function(){return this.id===Zo},s.refresh=function(){this.position=n}),this.refresh()},s.locatePoint=function(n){var c=ml(n);return this.seek(c),!!(!this.done()&&Ht(this.cellID())<=c||this.prev()&&Wt(this.cellID())>=c)},s.locateCellID=function(n){if(this.seek(Ht(n)),!this.done()){if(this.cellID()>=n&&Ht(this.cellID())<=n)return Ho;if(this.cellID()<=Wt(n))return Nu}return this.prev()&&Wt(this.cellID())>=n?Ho:Uu},g}(),Tx=function(){function g(){this.isActive=!1,this.a=this.b=g.trackerOrigin(),this.nextCellID=Fu(fl(0),$t),this.crosser=null,this.shapeIDs=[],this.savedIDs=[],this.drawTo(ve.fromVector(Un(0,-1,-1).normalize()))}g.trackerOrigin=function(){return ve.fromVector(Un(0,-1,-1).normalize())};var s=g.prototype;return s.focus=function(){return this.b},s.addShape=function(n,c){this.isActive=!0,c&&this.toggleShape(n)},s.moveTo=function(n){this.b=n},s.drawTo=function(n){this.a=this.b,this.b=n,this.crosser=new Jr(this.a,this.b)},s.testEdge=function(n,c){var f;(f=this.crosser)!=null&&f.edgeOrVertexCrossing(c.v0,c.v1)&&this.toggleShape(n)},s.setNextCellID=function(n){this.nextCellID=Ht(n)},s.atCellID=function(n){return Ht(n)===this.nextCellID},s.toggleShape=function(n){if(this.shapeIDs.length===0){this.shapeIDs.push(n);return}if(this.shapeIDs[0]===n){this.shapeIDs.shift();return}for(var c=0;c=n)return c;return this.shapeIDs.length},g}(),Vu=1,yg=2,cf=function(){function g(a,n){this.index=a,this.model=n,this.iter=a.iterator()}var s=g.prototype;return s.contains=function(n){if(!this.iter.locatePoint(n))return!1;for(var c=this.iter.indexCell(),f=He(c.shapes),m;!(m=f()).done;){var h=m.value;if(this._shapeContains(h,this.iter.center(),n))return!0}return!1},s._shapeContains=function(n,c,f){var m=n.containsCenter,h=n.numEdges();if(h<=0)return m;var P=this.index.shape(n.shapeID);if(P.dimension()!==2){if(this.model!==yg)return!1;for(var L=He(n.edges),V;!(V=L()).done;){var B=V.value,U=P.edge(B);if(U.v0.equals(f)||U.v1.equals(f))return!0}return!1}for(var ue=new Jr(c,f),ye=He(n.edges),Se;!(Se=ye()).done;){var Ne=Se.value,Re=P.edge(Ne),it=ue.crossingSign(Re.v0,Re.v1);if(it!==Wr){if(it===Mu){if(this.model!==Vu&&(Re.v0.equals(f)||Re.v1.equals(f)))return this.model===yg;Dy(ue.a,ue.b,Re.v0,Re.v1)?it=wn:it=Wr}m=m!==(it===wn)}}return m},s.shapeContains=function(n,c){if(!n||n instanceof Mh||!this.iter.locatePoint(c))return!1;var f=this.iter.indexCell(),m=f.findByShapeID(this.index.idForShape(n));return m?this._shapeContains(m,this.iter.center(),c):!1},s.shapeVisitorFunc=function(n){return!0},s.visitContainingShapes=function(n,c){if(!this.iter.locatePoint(n))return!0;for(var f=this.iter.indexCell(),m=He(f.shapes),h;!(h=m()).done;){var P=h.value;if(this._shapeContains(P,this.iter.center(),n)&&!c(this.index.shape(P.shapeID)))return!1}return!0},s.containingShapes=function(n){var c=[];return this.visitContainingShapes(n,function(f){return c.push(f),!0}),c},g}(),Ax=function(){function g(a,n){n===void 0&&(n=new cf(a,Vu)),this.index=a,this.containsQuery=n,this.iter=a.iterator()}var s=g.prototype;return s.capBound=function(){var n=zh(ro,this.cellUnionBound());return n.capBound()},s.rectBound=function(){var n=zh(ro,this.cellUnionBound());return n.rectBound()},s.cellUnionBound=function(){var n=[];if(this.iter.end(),!this.iter.prev())return n;var c=this.iter.cellID();if(this.iter.begin(),this.iter.cellID()!==c){var f=Oh(this.iter.cellID(),c),m=f[0];m===void 0&&(m=-1),m++;for(var h=oi(c,m),P=oi(this.iter.cellID(),m);P!=h;P=Ar(P))if(!(Wt(P)=m-c&&c>=m-f},a.intersectsOppositeEdges=function(){var c=Math.abs(this.x),f=Math.abs(this.y),m=Math.abs(this.z);return Math.abs(c-f)!==m?Math.abs(c-f)>=m:c>=f?c-m>=f:f-m>=c},a.exitAxis=function(){if(this.intersectsOppositeEdges())return Math.abs(this.x)>=Math.abs(this.y)?Np:fp;var c=0,f=0,m=0;return Math.sign(this.x)<0&&(c=1),Math.sign(this.y)<0&&(f=1),Math.sign(this.z)<0&&(m=1),c^f^m?fp:Np},a.exitPoint=function(c){if(c===fp){var f=this.y>0?1:-1;return new Bt(f,(-f*this.x-this.z)/this.y)}var m=this.x<0?1:-1;return new Bt((-m*this.y-this.z)/this.x,m)},s}(ve),_g=function(s,a,n,c,f,m){var h=1-ec;if(a.z>0){var P=new Bt(a.x/a.z,a.y/a.z);if(Math.max(Math.abs(P.x),Math.abs(P.y))<=h)return[P,0]}var L=n.exitPoint(n.exitAxis()).mul(m),V=new ln(new ve(L.x,L.y,1)),B=0;return V.vector.sub(s.vector).dot(c.vector)<0?B=2:V.vector.sub(a.vector).dot(f.vector)<0&&(B=1),B>0&&(a.z<=0?B=3:L=new Bt(a.x/a.z,a.y/a.z)),[L,B]},vg=function(s,a,n){return a?s.lo>n?[s,!1]:(s.hi>n&&(s.hi=n),[s,!0]):s.hiP.hi){if(n.lo>P.hi)return[n,m,!1];n.hi=P.hi;var B=vg(m,!h,cl(P.hi,s,a,c,f));if(m=B[0],L=B[1],!L)return[n,m,!1]}return[n,m,!0]},Vy=function(s,a,n){if(!n.intersects(pi.fromPoints(s,a)))return!1;var c=a.sub(s).ortho(),f=c.x>=0?1:0,m=c.y>=0?1:0,h=c.dot(n.vertexIJ(f,m).sub(s)),P=c.dot(n.vertexIJ(1-f,1-m).sub(s));return h>=0&&P<=0},Bx=function(s,a,n){var c=pi.fromPoints(s,a),f=Fx(s,a,n,c),m=f[0],h=f[1];return h?m:pi.empty()},Fx=function(s,a,n,c){var f=s.x>a.x!=s.y>a.y,m=xg(s.x,a.x,c.x,s.y,a.y,c.y,f,n.x),h=m[0],P=m[1],L=m[2];if(!L)return[c,!1];var V=xg(s.y,a.y,P,s.x,a.x,h,f,n.y),B=V[0],U=V[1],ue=V[2];return ue?[new pi(U,B),!0]:[new pi(h,P),!1]},cl=function(s,a,n,c,f){return Math.abs(a-s)<=Math.abs(n-s)?c+(f-c)*(s-a)/(n-a):f+(c-f)*(s-n)/(a-n)},Rx=function(){function g(a,n,c){this.face=a,this.a=n,this.b=c}var s=g.prototype;return s.clone=function(){return new g(this.face,new Bt(this.a.x,this.a.y),new Bt(this.b.x,this.b.y))},g}(),Ox=function(s,a){var n=new Rx(0,new Bt(0,0),new Bt(0,0)),c=wu(s.vector),f=c[0],m=c[1],h=c[2],P=wu(a.vector),L=P[0],V=P[1],B=P[2];if(n.a.x=m,n.a.y=h,n.b.x=V,n.b.y=B,f===L)return n.face=f,[n];var U=s.pointCross(a),ue=bg(f,s,U,n.a),ye=ue[0],Se=ue[1],Ne=bg(L,a,ve.fromVector(U.vector.mul(-1)),n.b),Re=Ne[0],it=Ne[1];n.a=Se,n.b=it;var Ue=[];n.face=ye;for(var ut=n.b,nt=ye;nt!==Re;){var bt=Qs(nt,U.vector),Ke=new ln(bt),_t=Ke.exitAxis();n.b=Ke.exitPoint(_t),Ue.push(n.clone());var kt=Un(nt,n.b.x,n.b.y);nt=Vx(nt,n.b,_t,Ke,Re);var Rt=Qs(nt,kt);n.face=nt,n.a=new Bt(Rt.x,Rt.y)}return n.b=ut,Ue.push(n),Ue},bg=function(s,a,n,c){var f=1-ec;if(Math.max(Math.abs(c.x),Math.abs(c.y))<=f)return[s,c];var m=Qs(s,n.vector),h=new ln(m);if(h.intersectsFace()){var P=h.exitPoint(h.exitAxis()),L=Un(s,P.x,P.y),V=n.vector.normalize().cross(a.vector);if(L.sub(a.vector).dot(V)>=-kx)return[s,c]}var B=0;Math.abs(c.x)>=Math.abs(c.y)?(c.x>0&&(B=1),s=Iu(s,0,B)):(c.y>0&&(B=1),s=Iu(s,1,B));var U=Wo(s,a.vector);return c.x=U[0],c.y=U[1],c.x=Math.max(-1,Math.min(1,c.x)),c.y=Math.max(-1,Math.min(1,c.y)),[s,c]},Vx=function(s,a,n,c,f){var m=a.x,h=a.y;n==Np&&(m=a.y,h=a.x);var P=0;m>0&&(P=1);var L=0;return h>0&&(L=1),Math.abs(h)===1&&Iu(s,1-n,L)===f&&Lx(a.x*c.x,a.y*c.y,-c.z)?f:Iu(s,n,P)},au=1,wg=function(){function g(a){this.rangeMin=Zo,this.rangeMax=Zo,this.it=a.iterator(),this.refresh()}var s=g.prototype;return s.cellID=function(){return this.it.cellID()},s.indexCell=function(){return this.it.indexCell()},s.next=function(){this.it.next(),this.refresh()},s.done=function(){return this.it.done()},s.seekTo=function(n){this.it.seek(n.rangeMin),(this.it.done()||Ht(this.it.cellID())>n.rangeMax)&&this.it.prev()&&Wt(this.it.cellID())>1,c&1]},s.entryVertex=function(){var n=this.iLo,c=this.jLo;if(this.orientation&us){var f=gr(this.level);n+=f,c+=f}return ve.fromVector(mu(Rn(this.id),2*n,2*c).normalize())},s.exitVertex=function(){var n=this.iLo,c=this.jLo,f=gr(this.level);return this.orientation===0||this.orientation===cn+us?n+=f:c+=f,ve.fromVector(mu(Rn(this.id),2*n,2*c).normalize())},s.shrinkToFit=function(n){if(this.level===0&&(n.x.contains(0)||n.y.contains(0)))return this.id;var c=gr(this.level);if(n.x.contains(hn(Ks(2*this.iLo+c)))||n.y.contains(hn(Ks(2*this.jLo+c))))return this.id;var f=n.expandedByMargin(this.padding+1.5*ii),m=this.iLo,h=this.jLo,P=0,L=0;m=n))break}return c},this.shape=function(n){return a.shapes.get(n)||new Mh},this.idForShape=function(n){for(var c=He(a.shapes.entries()),f;!(f=c()).done;){var m=f.value,h=m[0],P=m[1];if(P===n)return h}return-1},this.add=function(n){return a.shapes.set(a.nextID,n),a.nextID++,a.status=Ig,a.nextID-1},this.remove=function(n){var c=a.idForShape(n);if(a.shapes.has(c)&&(a.shapes.delete(c),!(c>=a.pendingAdditionsPos))){for(var f=n.numEdges(),m=new jx(c,n.dimension()===2,n.referencePoint().contained,new Array(f)),h=0;h0){var ye=a.shrinkToFit(U,P);if(ye!==U.id){a.skipCellRange(Ht(B),Ht(ye),f,ue),U=fr.fromCellID(ye,Wa),a.updateEdges(U,h,f,ue),a.skipCellRange(Ar(Wt(ye)),Ar(Wt(B)),f,ue);return}}a.updateEdges(U,h,f,ue)}},this.shrinkToFit=function(n,c){var f=n.shrinkToFit(c);if(!a.isFirstUpdate()&&f!==n.id){var m=a.iterator();m.locateCellID(f)===Ho&&(f=m.cellID())}return f},this.skipCellRange=function(n,c,f,m){if(f.shapeIDs.length!==0)for(var h=ro.fromRange(n,c),P=He(h),L;!(L=P()).done;){var V=L.value,B=[];a.updateEdges(fr.fromCellID(V,Wa),B,f,m)}},this.updateEdges=function(n,c,f,m){var h=!1;if(!m){var P=a.iterator(),L=P.locateCellID(n.id);L===Uu?m=!0:L===Ho&&(a.absorbIndexCell(n,P,c,f),h=!0,m=!0)}if(!m||!a.makeIndexCell(n,c,f)){for(var V=[[[],[]],[[],[]]],B=n.middle(),U=He(c),ue;!(ue=U()).done;){var ye=ue.value;if(ye.bound.x.hi<=B.x.lo){var Se=a.clipVAxis(ye,B.y),Ne=Se[0],Re=Se[1];Ne&&V[0][0].push(Ne),Re&&V[0][1].push(Re)}else if(ye.bound.x.lo>=B.x.hi){var it=a.clipVAxis(ye,B.y),Ue=it[0],ut=it[1];Ue&&V[1][0].push(Ue),ut&&V[1][1].push(ut)}else if(ye.bound.y.hi<=B.y.lo){var nt=a.clipUBound(ye,1,B.x.hi);nt&&V[0][0].push(nt);var bt=a.clipUBound(ye,0,B.x.lo);bt&&V[1][0].push(bt)}else if(ye.bound.y.lo>=B.y.hi){var Ke=a.clipUBound(ye,1,B.x.hi);Ke&&V[0][1].push(Ke);var _t=a.clipUBound(ye,0,B.x.lo);_t&&V[1][1].push(_t)}else{var kt=a.clipUBound(ye,1,B.x.hi),Rt=a.clipVAxis(kt,B.y),Ye=Rt[0],St=Rt[1];Ye&&V[0][0].push(Ye),St&&V[0][1].push(St);var ct=a.clipUBound(ye,0,B.x.lo),wt=a.clipVAxis(ct,B.y);Ye=wt[0],St=wt[1],Ye&&V[1][0].push(Ye),St&&V[1][1].push(St)}}for(var qt=0;qt<4;qt++){var Ti=n.childIJ(qt),fi=Ti[0],nr=Ti[1];(V[fi][nr].length>0||f.shapeIDs.length>0)&&a.updateEdges(fr.fromParentIJ(n,fi,nr),V[fi][nr],f,m)}}h&&f.restoreStateBefore(a.pendingAdditionsPos)},this.makeIndexCell=function(n,c,f){if(c.length===0&&f.shapeIDs.length===0)return!0;for(var m=0,h=He(c),P;!(P=h()).done;){var L=P.value;if(n.levela.maxEdgesPerCell)return!1}f.isActive&&c.length!==0&&(f.atCellID(n.id)||f.moveTo(n.entryVertex()),f.drawTo(n.center()),a.testAllEdges(c,f));for(var V=f.shapeIDs,B=a.countShapes(c,V),U=new Ex(B),ue=0,ye=0,Se=0;Se=f||c===1&&n.bound.x.hi<=f)return n;var m=n.faceEdge,h=n.bound.y.clampPoint(cl(f,m.a.x,m.b.x,m.a.y,m.b.y)),P=m.a.x>m.b.x==m.a.y>m.b.y,L=c===1===P?1:0;return a.updateBound(n,c,f,L,h)},this.clipVBound=function(n,c,f){if(c===0&&n.bound.y.lo>=f||c===1&&n.bound.y.hi<=f)return n;var m=n.faceEdge,h=n.bound.x.clampPoint(cl(f,m.a.y,m.b.y,m.a.x,m.b.x)),P=m.a.x>m.b.x==m.a.y>m.b.y,L=c===1===P?1:0;return a.updateBound(n,L,h,c,f)},this.clipVAxis=function(n,c){return n.bound.y.hi<=c.lo?[n,void 0]:n.bound.y.lo>=c.hi?[void 0,n]:[a.clipVBound(n,1,c.hi),a.clipVBound(n,0,c.lo)]},this.absorbIndexCell=function(n,c,f,m){if(m.isActive&&f.length!==0&&a.isShapeBeingRemoved(f[0].faceEdge.shapeID)){m.atCellID(n.id)||m.moveTo(n.entryVertex()),m.drawTo(n.exitVertex()),m.setNextCellID(Ar(n.id));for(var h=He(f),P;!(P=h()).done;){var L=P.value,V=L.faceEdge;if(!a.isShapeBeingRemoved(V.shapeID))break;V.hasInterior&&m.testEdge(V.shapeID,V.edge)}}m.saveAndClearStateBefore(a.pendingAdditionsPos);var B=[],U=!1,ue=c.indexCell();if(ue)for(var ye=He(ue.shapes),Se;!(Se=ye()).done;){var Ne=Se.value,Re=Ne.shapeID,it=a.shape(Re);if(it){var Ue=Ne.numEdges(),ut=new Cg(Re,void 0,void 0,it.dimension()===2);ut.hasInterior&&(m.addShape(Re,Ne.containsCenter),!U&&Ue>0&&(m.moveTo(n.center()),m.drawTo(n.entryVertex()),m.setNextCellID(n.id),U=!0));for(var nt=0;ntm));)h1&&(m=g.uniqueInts(m)),m},g.uniqueInts=function(n){for(var c=[],f={},m=He(n),h;!(h=m()).done;){var P=h.value;f[P]||(f[P]=!0,c.push(P))}return c.sort(function(L,V){return L-V}),c},s.candidatesEdgeMap=function(n,c){var f=new Zx;if(this.index.shapes.size===1){var m=this.index.shape(0);return f.set(m,this.candidates(n,c,m)),f}if(this.getCellsForEdge(n,c),this.cells.length===0)return f;for(var h=He(this.cells),P;!(P=h()).done;)for(var L=P.value,V=He(L.shapes),B;!(B=V()).done;)for(var U=B.value,ue=this.index.shape(U.shapeID),ye=0;ye1&&f.forEach(function(Se,Ne){f.set(Ne,g.uniqueInts(Se))}),f},s.getCells=function(n,c,f){var m=Dx(n,c,Rn(f.id)),h=m[0],P=m[1],L=m[2];if(L){this.a=h,this.b=P;var V=pi.fromPoints(this.a,this.b);f.bound().intersects(V)&&this.computeCellsIntersected(f,V)}return this.cells.length===0?[]:this.cells},s.getCellsForEdge=function(n,c){this.cells=[];for(var f=Ox(n,c),m=He(f),h;!(h=m()).done;){var P=h.value;this.a=P.a,this.b=P.b;var L=pi.fromPoints(this.a,this.b),V=fr.fromCellID(fl(P.face),0),B=V.shrinkToFit(L),U=this.iter.locateCellID(B);U===Ho?this.cells.push(this.iter.indexCell()):U===Nu&&(Jh(B)||(V=fr.fromCellID(B,0)),this.computeCellsIntersected(V,L))}},s.computeCellsIntersected=function(n,c){if(this.iter.seek(Ht(n.id)),!(this.iter.done()||this.iter.cellID()>Wt(n.id))){if(this.iter.cellID()===n.id){this.cells.push(this.iter.indexCell());return}var f=n.middle().lo();if(c.x.hi=f.x){this.clipVAxis(c,f.y,1,n);return}var m=this.splitUBound(c,f.x);c.y.hi=f.y?(this.computeCellsIntersected(fr.fromParentIJ(n,0,1),m[0]),this.computeCellsIntersected(fr.fromParentIJ(n,1,1),m[1])):(this.clipVAxis(m[0],f.y,0,n),this.clipVAxis(m[1],f.y,1,n))}},s.clipVAxis=function(n,c,f,m){if(n.y.hi=c)this.computeCellsIntersected(fr.fromParentIJ(m,f,1),n);else{var h=this.splitVBound(n,c);this.computeCellsIntersected(fr.fromParentIJ(m,f,0),h[0]),this.computeCellsIntersected(fr.fromParentIJ(m,f,1),h[1])}},s.splitUBound=function(n,c){var f=n.y.clampPoint(cl(c,this.a.x,this.b.x,this.a.y,this.b.y)),m=this.a.x>this.b.x!=this.a.y>this.b.y?1:0;return this.splitBound(n,0,m,c,f)},s.splitVBound=function(n,c){var f=n.x.clampPoint(cl(c,this.a.y,this.b.y,this.a.x,this.b.x)),m=this.a.x>this.b.x!=this.a.y>this.b.y?1:0;return this.splitBound(n,m,0,f,c)},s.splitBound=function(n,c,f,m,h){var P=[pi.fromRect(n),pi.fromRect(n)];return c===1?(P[0].x.lo=m,P[1].x.hi=m):(P[0].x.hi=m,P[1].x.lo=m),f===1?(P[0].y.lo=h,P[1].y.hi=h):(P[0].y.hi=h,P[1].y.lo=h),P},g}(),Zx=function(g){function s(){return g.apply(this,arguments)||this}return Xh(s,g),s}(ll(Map)),Gx=function(s,a,n){var c=1,f=a.distance(n);f!==0&&(c=f/Math.sin(f));var m=1,h=n.distance(s);h!==0&&(m=h/Math.sin(h));var P=1,L=s.distance(a);L!==0&&(P=L/Math.sin(L));var V=new $e(s.x,a.x-s.x,n.x-s.x),B=new $e(s.y,a.y-s.y,n.y-s.y),U=new $e(s.z,a.z-s.z,n.z-s.z),ue=new $e(c,m-c,P-c);return ve.fromVector(new $e(B.cross(U).dot(ue),U.cross(V).dot(ue),V.cross(B).dot(ue)).mul(.5))},Mg=new ve(0,0,1),Pg=new ve(0,0,-1),Nh=function(){function g(a){this.originInside=!1,this.depth=0,this.bound=zt.emptyRect(),this.subregionBound=zt.emptyRect(),this.vertices=a,this.index=new Pu,this.initOriginAndBound()}g.fromCell=function(n){var c=[n.vertex(0),n.vertex(1),n.vertex(2),n.vertex(3)];return new g(c)},g.fromLoop=function(n){return new g(n.vertices.map(function(c){return ve.fromVector(c.vector)}))},g.emptyLoop=function(){return new g([Mg])},g.fullLoop=function(){return new g([Pg])};var s=g.prototype;return s.initOriginAndBound=function(){if(this.vertices.length<3){if(!this.isEmptyOrFull()){this.originInside=!1;return}this.originInside=this.vertices[0].z<0}else{var n=this.vertices[0]!==this.vertices[1]&&this.vertices[2]!==this.vertices[1]&&gx(this.vertices[0],this.vertices[1],this.vertices[2]);this.originInside=!1,n!==this.containsPoint(this.vertices[1])&&(this.originInside=!0)}this.initBound(),this.index.add(this)},s.copyFrom=function(n){this.vertices=n.vertices,this.originInside=n.originInside,this.depth=n.depth,this.bound=n.bound,this.subregionBound=n.subregionBound,this.index=n.index},s.initBound=function(){if(this.vertices.length===0){this.copyFrom(g.emptyLoop());return}if(this.isEmptyOrFull()){this.isEmpty()?this.bound=zt.emptyRect():this.bound=zt.fullRect(),this.subregionBound=this.bound;return}for(var n=new hl,c=0;c<=this.vertices.length;c++)n.addPoint(this.vertex(c));var f=n.rectBound();this.containsPoint(new ve(0,0,1))&&(f=new zt(new Ft(f.lat.lo,Math.PI/2),xi.fullInterval())),f.lng.isFull()&&this.containsPoint(new ve(0,0,-1))&&(f.lat.lo=-Math.PI/2),this.bound=f,this.subregionBound=hl.expandForSubregions(this.bound)},s.validate=function(){var n=this.findValidationErrorNoIndex();return n||null},s.findValidationErrorNoIndex=function(){for(var n=0;n0)for(var P=n.center(),L=new Jr(P,c),V=-2,B=He(m.edges),U;!(U=B()).done;){var ue=U.value;ue!==V+1&&L.restartAt(this.vertex(ue)),V=ue,h=h!==L.edgeOrVertexChainCrossing(this.vertex(ue+1))}return h},g.regularLoop=function(n,c,f){return g.regularLoopForFrame(ef(n),c,f)},g.regularLoopForFrame=function(n,c,f){return new g(ve.regularPointsForFrame(n,c,f))},s.canonicalFirstVertex=function(){for(var n=0,c=this.vertices.length,f=1;f0;P--){c+=f;var L=fg(this.vertex(c-f),this.vertex(c),this.vertex(c+f)),V=m;m+=L+h,h=V-m+L}var B=2*Math.PI-4*ii;return Math.max(-B,Math.min(B,f*(m+h)))},s.turningAngleMaxError=function(){var n=11.25*ii;return n*this.vertices.length},s.isHole=function(){return(this.depth&1)!==0},s.sign=function(){return this.isHole()?-1:1},s.isNormalized=function(){return this.bound.lng.length()=-this.turningAngleMaxError()},s.normalize=function(){this.isNormalized()||this.invert()},s.invert=function(){if(this.index.reset(),this.isEmptyOrFull())this.vertices[0]=this.isFull()?Mg:Pg;else for(var n=Math.floor(this.vertices.length/2)-1;n>=0;n--){var c=this.vertices.length-1-n,f=[this.vertices[c],this.vertices[n]];this.vertices[n]=f[0],this.vertices[c]=f[1]}this.originInside=!this.originInside,this.bound.lat.lo>-Math.PI/2&&this.bound.lat.hi=0;P--){var L=h.edges[P];if(this.vertex(L).equals(n))return L===0?[this.vertices.length,!0]:[L,!0];if(this.vertex(L+1).equals(n))return[L+1,!0]}return[c,!1]},s.containsNested=function(n){if(!this.subregionBound.contains(n.bound))return!1;if(this.isEmptyOrFull()||n.numVertices()<2)return this.isFull()||n.isEmpty();var c=this.findVertex(n.vertex(1)),f=c[0],m=c[1];return m?Ny(this.vertex(f-1),this.vertex(f),this.vertex(f+1),n.vertex(0),n.vertex(2)):this.containsPoint(n.vertex(1))},s.surfaceIntegralFloat64=function(n){for(var c=Math.PI-1e-5,f=0,m=this.vertex(0),h=1;h+1c){var P=m;m.equals(this.vertex(0))?m=ve.fromVector(this.vertex(0).pointCross(this.vertex(h)).vector.normalize()):this.vertex(h).vector.angle(this.vertex(0).vector)c){var P=m;m.equals(this.vertex(0))?m=ve.fromVector(this.vertex(0).pointCross(this.vertex(h)).vector.normalize()):this.vertex(h).vector.angle(this.vertex(0).vector)4*Math.PI&&(n=4*Math.PI),n<0&&(n=0),n4*Math.PI-c&&this.isNormalized()?0:n},s.centroid=function(){return this.surfaceIntegralPoint(Gx)},s.containsNonCrossingBoundary=function(n,c){if(!this.bound.intersects(n.bound))return!1;if(this.isFull())return!0;if(n.isFull())return!1;var f=this.findVertex(n.vertex(0)),m=f[0],h=f[1];return h?jy(this.vertex(m-1),this.vertex(m),this.vertex(m+1),n.vertex(1),c):this.containsPoint(n.vertex(0))},g}(),Eu=function(s,a){return!s.containsCenter&&a===Uy||s.containsCenter&&a===Tu},gp=function(s,a,n){for(var c=new wg(s.index),f=new wg(a.index),m=new Tg(s,a,n,!1),h=new Tg(a,s,n,!0);!c.done()||!f.done();)if(c.rangeMax0){if(m.hasCrossingRelation(c,f))return!0}else if(P<0){if(h.hasCrossingRelation(f,c))return!0}else{var L=c.it.indexCell().shapes[0],V=f.it.indexCell().shapes[0];if(Eu(L,m.aCrossingTarget)&&Eu(V,m.bCrossingTarget)||L.numEdges()>0&&V.numEdges()>0&&m.cellCrossesCell(L,V))return!0;c.next(),f.next()}}return!1},Eg=0,Uy=1,Tu=2,Xx=function(){function g(){this.foundSharedVertex=!1}var s=g.prototype;return s.aCrossingTarget=function(){return Uy},s.bCrossingTarget=function(){return Tu},s.wedgesCross=function(n,c,f,m,h){return this.foundSharedVertex=!0,!Ny(n,c,f,m,h)},g}(),Wx=function(){function g(){this.foundSharedVertex=!1}var s=g.prototype;return s.aCrossingTarget=function(){return Tu},s.bCrossingTarget=function(){return Tu},s.wedgesCross=function(n,c,f,m,h){return this.foundSharedVertex=!0,$x(n,c,f,m,h)},g}(),Hx=function(){function g(a){this.foundSharedVertex=!1,this.containsEdge=!1,this.excludesEdge=!1,this.reverse=a}var s=g.prototype;return s.aCrossingTarget=function(){return Eg},s.bCrossingTarget=function(){return Eg},s.wedgesCross=function(n,c,f,m,h){return this.foundSharedVertex=!0,jy(n,c,f,h,this.reverse)?this.containsEdge=!0:this.excludesEdge=!0,this.containsEdge&&this.excludesEdge},g}(),jy=function(s,a,n,c,f){return c.equals(s)||c.equals(n)?c.equals(s)===f:ve.orderedCCW(s,n,c,a)},Tg=function(){function g(a,n,c,f){if(this.crosser=null,this.aj=0,this.bjPrev=-2,this.bCells=[],this.a=a,this.b=n,this.relation=c,this.swapped=f,this.aCrossingTarget=c.aCrossingTarget(),this.bCrossingTarget=c.bCrossingTarget(),this.bQuery=new qx(n.index),f){var m=[this.bCrossingTarget,this.aCrossingTarget];this.aCrossingTarget=m[0],this.bCrossingTarget=m[1]}}var s=g.prototype;return s.startEdge=function(n){this.crosser=new Jr(this.a.vertex(n),this.a.vertex(n+1)),this.aj=n,this.bjPrev=-2},s.edgeCrossesCell=function(n){for(var c=n.numEdges(),f=0;f0){if(m+=h,m>=f)return this.cellCrossesAnySubcell(n.it.indexCell().shapes[0],n.cellID())?!0:(c.seekBeyond(n),!1);this.bCells.push(c.indexCell())}if(c.next(),c.cellID()>n.rangeMax)break}for(var P=He(this.bCells),L;!(L=P()).done;){var V=L.value;if(this.cellCrossesCell(n.it.indexCell().shapes[0],V.shapes[0]))return!0}return!1},s.hasCrossingRelation=function(n,c){var f=n.it.indexCell().shapes[0];if(f.numEdges()!==0)return this.hasCrossing(n,c)?!0:(n.next(),!1);if(Eu(f,this.aCrossingTarget))return c.seekBeyond(n),n.next(),!1;for(;c.cellID()<=n.rangeMax;){var m=c.it.indexCell().shapes[0];if(Eu(m,this.bCrossingTarget))return!0;c.next()}return n.next(),!1},g}(),to=function(){function g(a){var n=this;if(a===void 0&&(a=[]),this.loops=[],this.index=new Pu,this.hasHoles=!1,this.numVertices=0,this.nEdges=0,this.bound=zt.emptyRect(),this.subregionBound=zt.emptyRect(),this.cumulativeEdges=[],this.initLoops=function(c){var f=new Array;f.push(null);for(var m=-1;f.length>0;){var h=f.pop();h!=null&&(m=h.depth,n.loops.push(h));for(var P=c.get(h)||[],L=P.length-1;L>=0;L--){var V=P[L];V.depth=m+1,f.push(V)}}},a.length===1&&a[0].isEmpty()){this.initLoopProperties();return}this.loops=a,this.initNested()}g.fromOrientedLoops=function(n){for(var c=new Map,f=He(n),m;!(m=f()).done;){var h=m.value;c.set(h,h.containsOrigin())}for(var P=He(n),L;!(L=P()).done;){var V=L.value,B=V.turningAngle();Math.abs(B)>V.turningAngleMaxError()?B<0&&V.invert():V.containsOrigin()&&V.invert()}var U=new g(n);if(U.numLoops()>0){for(var ue=U.loop(0),ye=!1,Se=He(U.loops),Ne;!(Ne=Se()).done;){var Re=Ne.value;Re.containsOrigin()&&(ye=!ye,ue=Re)}c.get(ue)!==ye&&U.invert()}return U};var s=g.prototype;return s.invert=function(){if(this.isEmpty()){Object.assign(this,g.fullPolygon()),this.initLoopProperties();return}if(this.isFull()){Object.assign(this,new g),this.initLoopProperties();return}for(var n=0,c=10,f=c,m=1;mL)&&(this.loop(V).depth++,P.push(this.loop(V)));for(var B=0;Bn&&B<=L&&(this.loop(B).depth--,P.push(this.loop(B)));this.loops=P,this.initLoopProperties()},s.compareLoops=function(n,c){if(n.numVertices()!==c.numVertices())return n.numVertices()-c.numVertices();var f=n.canonicalFirstVertex(),m=f[0],h=f[1],P=c.canonicalFirstVertex(),L=P[0],V=P[1];if(h!==V)return h-V;for(var B=n.numVertices()-1;B>=0;B--,m+=h,L+=V){var U=n.vertex(m).vector.cmp(c.vertex(L).vector);if(U!==0)return U}return 0},g.fromCell=function(n){return new g([Nh.fromCell(n)])},s.initNested=function(){if(this.loops.length===1){this.initOneLoop();return}var n=new Jx;this.loops.forEach(function(c){n.insertLoop(c,null)}),this.loops=[],this.initLoops(n),this.initLoopProperties()},s.initOneLoop=function(){this.hasHoles=!1,this.numVertices=this.loops[0].vertices.length,this.bound=this.loops[0].rectBound(),this.subregionBound=hl.expandForSubregions(this.bound),this.loops[0].depth=0,this.initEdgesAndIndex()},s.initLoopProperties=function(){this.numVertices=0,this.bound=zt.emptyRect(),this.hasHoles=!1;for(var n=He(this.loops),c;!(c=n()).done;){var f=c.value;f.isHole()?this.hasHoles=!0:this.bound=this.bound.union(f.rectBound()),this.numVertices+=f.numVertices()}this.subregionBound=hl.expandForSubregions(this.bound),this.initEdgesAndIndex()},s.initEdgesAndIndex=function(){if(this.nEdges=0,this.cumulativeEdges=[],!this.isFull()){var n=12;this.loops.length>n&&(this.cumulativeEdges=[]);for(var c=He(this.loops),f;!(f=c()).done;){var m=f.value;this.cumulativeEdges.length>0&&this.cumulativeEdges.push(this.nEdges),this.nEdges+=m.vertices.length}this.index=new Pu,this.index.add(this)}},g.fullPolygon=function(){var n=Nh.fullLoop(),c=new g;return c.loops=[n],c.numVertices=n.vertices.length,c.bound=zt.fullRect(),c.subregionBound=zt.fullRect(),c.initEdgesAndIndex(),c},s.validate=function(){for(var n=0;n1)return new Error("loop "+n+": full loop appears in non-full polygon")}return this.findLoopNestingError()},s.findLoopNestingError=function(){for(var n=-1,c=0;cn+1)return new Error("loop "+c+": invalid loop depth ("+f+")");n=f}for(var m=0;m=m+1&&L<=P,B=!1;if(h.containsNonCrossingBoundary(this.loops[L],B)!==V){var U=V?"":"not ";return new Error("invalid nesting: loop "+m+" should "+U+"contain loop "+L)}}return null},s.isEmpty=function(){return this.loops.length===0},s.isFull=function(){return this.loops.length===1&&this.loops[0].isFull()},s.numLoops=function(){return this.loops.length},s.loop=function(n){return this.loops[n]},s.parent=function(n){var c,f=((c=this.loops[n])==null?void 0:c.depth)||0;if(f===0)return[-1,!1];for(n--;n>=0&&this.loops[n].depth<=f;n--);return[n,!0]},s.lastDescendant=function(n){var c;if(n<0)return this.loops.length-1;var f=((c=this.loops[n])==null?void 0:c.depth)||0;for(n++;nf;n++);return n-1},s.capBound=function(){return this.bound.capBound()},s.rectBound=function(){return this.bound},s.containsPoint=function(n){if(!this.index.isFresh()&&!this.bound.containsPoint(n))return!1;var c=32;if(this.numVertices0){for(c=0;c=this.cumulativeEdges.length||n=this.loop(c).vertices.length;c++)n-=this.loop(c).vertices.length;return new jn(this.loop(c).orientedVertex(n),this.loop(c).orientedVertex(n+1))},s.referencePoint=function(){for(var n=!1,c=He(this.loops),f;!(f=c()).done;){var m=f.value;n=n!==m.containsOrigin()}return Ou(n)},s.numChains=function(){return this.numLoops()},s.chain=function(n){if(this.cumulativeEdges.length>0)return new al(this.cumulativeEdges[n],this.loop(n).vertices.length);for(var c=0,f=0;f0){for(c=0;c=this.cumulativeEdges.length||n=this.loop(c).vertices.length;c++)n-=this.loop(c).vertices.length;return new Ru(c,n)},s.dimension=function(){return 2},s.typeTag=function(){return Cx},s.privateInterface=function(){},s.contains=function(n){if(this.loops.length===1&&n.loops.length===1)return this.loops[0].contains(n.loops[0]);if(!this.subregionBound.contains(n.bound)&&!this.bound.lng.union(n.bound.lng).isFull())return!1;if(!this.hasHoles&&!n.hasHoles){for(var c=He(n.loops),f;!(f=c()).done;){var m=f.value;if(!this.anyLoopContains(m))return!1}return!0}return this.containsBoundary(n)&&n.excludesNonCrossingComplementShells(this)},s.intersects=function(n){if(this.loops.length===1&&n.loops.length===1)return this.loops[0].intersects(n.loops[0]);if(!this.bound.intersects(n.bound))return!1;if(!this.hasHoles&&!n.hasHoles){for(var c=He(n.loops),f;!(f=c()).done;){var m=f.value;if(this.anyLoopIntersects(m))return!0}return!1}return!this.excludesBoundary(n)||!n.excludesNonCrossingShells(this)},s.compareBoundary=function(n){for(var c=-1,f=0;f=0)return!1}return!0},s.containsNonCrossingBoundary=function(n,c){for(var f=!1,m=He(this.loops),h;!(h=m()).done;){var P=h.value,L=P.containsNonCrossingBoundary(n,c);f=f!=L}return f},s.excludesNonCrossingShells=function(n){for(var c=He(n.loops),f;!(f=c()).done;){var m=f.value;if(!m.isHole()&&this.containsNonCrossingBoundary(m,!1))return!1}return!0},s.excludesNonCrossingComplementShells=function(n){if(n.isEmpty())return!this.isFull();if(n.isFull())return!0;for(var c=0;c0&&!f.isHole())&&this.containsNonCrossingBoundary(f,c===0))return!1}return!0},s.anyLoopContains=function(n){for(var c=He(this.loops),f;!(f=c()).done;){var m=f.value;if(m.contains(n))return!0}return!1},s.anyLoopIntersects=function(n){for(var c=He(this.loops),f;!(f=c()).done;){var m=f.value;if(m.intersects(n))return!0}return!1},s.area=function(){for(var n=0,c=He(this.loops),f;!(f=c()).done;){var m=f.value;n+=m.sign()*m.area()}return n},s.centroid=function(){for(var n=new ve(0,0,0).vector,c=He(this.loops),f;!(f=c()).done;){var m=f.value,h=m.centroid().vector;m.sign()<0?n=n.sub(h):n=n.add(h)}return ve.fromVector(n)},g}(),Jx=function(g){function s(){return g.apply(this,arguments)||this}Xh(s,g);var a=s.prototype;return a.insertLoop=function(c,f){for(var m=[],h=!1;!h;){m=g.prototype.get.call(this,f)||[],h=!0;for(var P=He(m),L;!(L=P()).done;){var V=L.value;if(V.containsNested(c)){f=V,h=!1;break}}}for(var B=g.prototype.get.call(this,c)||[],U=0;UMath.PI/2&&L>0||Bc)break;if(L=B,!(B<=c)){var U=W0(h,V),ue=Math.atan2(U.y,U.x);if(!P.contains(ue))break;var ye=Math.asin(Math.sin(c)/Math.sin(B)),Se=xi.fromPointPair(ue,ue).expanded(ye);P=P.intersection(Se)}}return f-1},s.subsampleVertices=function(n){var c=[];if(this.points.length<1)return c;c.push(0);for(var f=Math.max(n,0),m=0;m+11&&m=this.minLevel)if(this.interiorCovering){if(this.region.containsCell(n))c.terminal=!0;else if(f+this.levelMod>this.maxLevel)return new Ph}else(f+this.levelMod>this.maxLevel||this.region.containsCell(n))&&(c.terminal=!0);return c},s.expandChildren=function(n,c,f){f--;for(var m=0,h=zy(c.id),P=of(c.id);P!==h;P=Ar(P)){var L=bn.fromCellID(P);if(f>0){this.region.intersectsCell(L)&&(m+=this.expandChildren(n,L,f));continue}var V=this.newCandidate(L);V instanceof Ph||(n.children.push(V),n.numChildren++,V.terminal&&m++)}return m},s.addCandidate=function(n){if(!(n instanceof Ph)){if(n.terminal){this.result.push(n.cell.id);return}var c=this.levelMod,f=n.cell.level;f=this.minLevel?(n.terminal=!0,this.addCandidate(n)):(n.priority=-((f<1&&n>this.minLevel&&(n-=(n-this.minLevel)%this.levelMod),n},s.adjustCellLevels=function(n){if(this.levelMod!==1){for(var c=0,f=He(n),m;!(m=f()).done;){var h=m.value,P=ir(h),L=this.adjustLevel(P);if(L!==P&&(h=oi(h,L)),!(c>0&&Go(n[c-1],h))){for(;c>0&&Go(h,n[c-1]);)c--;n[c]=h,c++}}n.length=c}},s.initialCandidates=function(n){var c=new Uh;c.maxLevel=this.maxLevel,c.levelMod=1,c.maxCells=Math.min(4,this.maxCells);var f=c.fastCovering(n);this.adjustCellLevels(f);for(var m=He(f),h;!(h=m()).done;){var P=h.value;this.addCandidate(this.newCandidate(bn.fromCellID(P)))}},s.coveringInternal=function(n){for(this.region=n,this.initialCandidates(n);this.pq.length>0&&(!this.interiorCovering||this.result.length0||this.levelMod>1)&&this.result.denormalize(this.minLevel,this.levelMod)},s.normalizeCovering=function(n){if(this.maxLevel<$t||this.levelMod>1)for(var c=0;c0||this.levelMod>1)&&n.denormalize(this.minLevel,this.levelMod);var h=n.length-this.maxCells;if(!(h<=0||this.isCanonical(n))){if(h*n.length>1e4){var P=new Uh,L=P.covering(n);n.length=0,n.push.apply(n,L);return}for(;n.length>this.maxCells;){for(var V=-1,B=-1,U=0;U+1B&&(B=Ne,V=U)}}if(Bthis.minLevel&&(B-=this.levelMod,Re=oi(Re,B),!!this.containsAllChildren(n,Re));){var Ue=this.replaceCellsWithAncestor(n,Re);n.length=0,n.push.apply(n,Ue)}}}},s.isCanonical=function(n){var c=this.maxLevel;this.levelMod!==1&&(c=this.maxLevel-(this.maxLevel-this.minLevel)%this.levelMod);for(var f=n.length>this.maxCells,m=1,h=0n,P=He(n),L;!(L=P()).done;){var V=L.value;if(!Su(V))return!1;var B=ir(V);if(Bc||this.levelMod>1&&(B-this.minLevel)%this.levelMod!==0)return!1;if(h!==0n){if(Wt(h)>=Ht(V))return!1;var U=Oh(V,h),ue=U[0],ye=U[1];if(f&&ye&&ue>=this.minLevel)return!1;var Se=B-this.levelMod;if(Se=Ht(c)}),m=ir(c)+this.levelMod,h=Fu(c,m);h!==af(c,m);h=Ar(h)){if(f===-1||n[f]!==h)return!1;f++}return!0},s.replaceCellsWithAncestor=function(n,c){var f=Dp(n.length,function(h){return n[h]>Ht(c)}),m=Dp(n.length,function(h){return n[h]>Wt(c)});return[].concat(n.slice(0,f),[c],n.slice(m))},g}(),Kx=function(s){this.terminal=!1,this.numChildren=0,this.children=[],this.priority=0,this.cell=s},Ph=function(){this.cell=bn.fromCellID(Zo),this.terminal=!1,this.numChildren=0,this.children=[],this.priority=0},Yx=function(g){function s(){return g.apply(this,arguments)||this}Xh(s,g);var a=s.prototype;return a.len=function(){return this.length},a.swap=function(c,f){var m=[this[f],this[c]];this[c]=m[0],this[f]=m[1]},a.push=function(){for(var c,f=arguments.length,m=new Array(f),h=0;hf.priority?1:0},s}(ll(Array)),On={__proto__:null,cellid:fx,Cap:eo,Cell:bn,CellUnion:ro,LatLng:jt,Loop:Nh,Point:ve,Polygon:to,Polyline:ul,Rect:zt,RegionCoverer:Uh,Coverer:$y,ShapeIndex:Pu},tc=function(s){var a=jt.fromPoint(s);return[io(a.lng),io(a.lat)]},ic=function(s){return ve.fromLatLng(jt.fromDegrees(s[1],s[0]))},Qx=function(s,a,n){return Math.abs(s[0]-a[0])<=n&&Math.abs(s[1]-a[1])<=n},e1=function(s){return{type:"Point",coordinates:tc(s)}},t1=function(s){return ic(s.coordinates)},i1=function(s){return{type:"MultiPoint",coordinates:s.map(tc)}},r1=function(s){return s.coordinates.map(ic)},n1=function(s){return{type:"LineString",coordinates:s.points.map(tc)}},s1=function(s){return new ul(s.coordinates.map(ic))},o1=function(s){return{type:"MultiLineString",coordinates:s.map(function(a){return a.points.map(tc)})}},a1=function(s){return s.coordinates.map(function(a){return new ul(a.map(ic))})},qy=function(s,a){var n=s.vertices.map(tc);return a>0&&n.reverse(),n.push(n[0]),n},Zy=function(s,a){return s=s.slice(),s.length-=1,s=s.filter(function(n,c){return!c||!Qx(s.at(c-1),n,0)}),a>0&&s.reverse(),new Nh(s.map(ic))},l1=function(s){if(Array.isArray(s))return s;if(s.type==="Feature"){if(s.geometry!==null)return s.geometry.coordinates}else if(s.coordinates)return s.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")},zg=function(s){for(var a=l1(s),n=0,c=1,f,m;c0},Gy=function(s,a){zg(s[0])!==a&&s[0].reverse();for(var n=1;n=c.memberCoverer.maxCells&&g.area(m)=c.compactAt&&(f=c.coverer.covering(f))}),this.coverer.covering(f)},s.covering=function(n){var c=Wy(n);return Array.isArray(c)?this.mutliMemberCovering(c):this.coverer.covering(c)},g.area=function(n){return n instanceof to?n.area():(n instanceof ul&&n.capBound().area(),0)},g}(),Hy={__proto__:null,toGeoJSON:g1,fromGeoJSON:Wy,RegionCoverer:y1};function kg(g,s,a={}){const n={type:"Feature"};return(a.id===0||a.id)&&(n.id=a.id),a.bbox&&(n.bbox=a.bbox),n.properties=s||{},n.geometry=g,n}function _1(g,s={}){const a={type:"FeatureCollection"};return s.id&&(a.id=s.id),s.bbox&&(a.bbox=s.bbox),a.features=g,a}function Dg(g){if(!g)throw new Error("coord is required");if(!Array.isArray(g)){if(g.type==="Feature"&&g.geometry!==null&&g.geometry.type==="Point")return[...g.geometry.coordinates];if(g.type==="Point")return[...g.coordinates]}if(Array.isArray(g)&&g.length>=2&&!Array.isArray(g[0])&&!Array.isArray(g[1]))return[...g];throw new Error("coord must be GeoJSON Point or an Array of numbers")}var Lg=Math.PI/180,Bg=180/Math.PI,jh=function(g,s){this.lon=g,this.lat=s,this.x=Lg*g,this.y=Lg*s};jh.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)};jh.prototype.antipode=function(){var g=-1*this.lat,s=this.lon<0?180+this.lon:(180-this.lon)*-1;return new jh(s,g)};var Jy=function(){this.coords=[],this.length=0};Jy.prototype.move_to=function(g){this.length++,this.coords.push(g)};var uf=function(g){this.properties=g||{},this.geometries=[]};uf.prototype.json=function(){if(this.geometries.length<=0)return{geometry:{type:"LineString",coordinates:null},type:"Feature",properties:this.properties};if(this.geometries.length===1)return{geometry:{type:"LineString",coordinates:this.geometries[0].coords},type:"Feature",properties:this.properties};for(var g=[],s=0;sU&&(Se>V&&yeV&&SeP&&(P=Ne)}var Re=[];if(h&&P0&&Math.abs(ut-a[Ue-1][0])>U){var nt=parseFloat(a[Ue-1][0]),bt=parseFloat(a[Ue-1][1]),Ke=parseFloat(a[Ue][0]),_t=parseFloat(a[Ue][1]);if(nt>-180&&nt-180&&a[Ue-1][0]V&&nt<180&&Ke===-180&&Ue+1V&&a[Ue-1][0]<180){it.push([180,a[Ue][1]]),Ue++,it.push([a[Ue][0],a[Ue][1]]);continue}if(ntV){var kt=nt;nt=Ke,Ke=kt;var Rt=bt;bt=_t,_t=Rt}if(nt>V&&Ke=180&&ntV?180:-180,St]),it=[],it.push([a[Ue-1][0]>V?-180:180,St]),Re.push(it)}else it=[],Re.push(it);it.push([ut,a[Ue][1]])}else it.push([a[Ue][0],a[Ue][1]])}}else{var ct=[];Re.push(ct);for(var wt=0;wt{const{x:a,y:n}=g,{x:c,y:f}=s,m=c-a,h=f-n;return Math.sqrt(h*h+m*m)};class Ha{constructor({name:s,callback:a,unregister:n,register:c}){this.name=void 0,this.callback=void 0,this.registered=!1,this.register=void 0,this.unregister=void 0,this.name=s,this.register=()=>{this.registered||(this.registered=!0,c(a))},this.unregister=()=>{this.register&&(this.registered=!1,n(a))},this.callback=a}}class Ky{constructor(s){this._minPixelDragDistance=void 0,this._minPixelDragDistanceDrawing=void 0,this._minPixelDragDistanceSelecting=void 0,this._lastDrawEvent=void 0,this._coordinatePrecision=void 0,this._heldKeys=new Set,this._listeners=[],this._dragState="not-dragging",this._currentModeCallbacks=void 0,this._minPixelDragDistance=typeof s.minPixelDragDistance=="number"?s.minPixelDragDistance:1,this._minPixelDragDistanceSelecting=typeof s.minPixelDragDistanceSelecting=="number"?s.minPixelDragDistanceSelecting:1,this._minPixelDragDistanceDrawing=typeof s.minPixelDragDistanceDrawing=="number"?s.minPixelDragDistanceDrawing:8,this._coordinatePrecision=typeof s.coordinatePrecision=="number"?s.coordinatePrecision:9}getButton(s){return s.button===-1?"neither":s.button===0?"left":s.button===1?"middle":s.button===2?"right":"neither"}getMapElementXYPosition(s){const a=this.getMapEventElement(),{left:n,top:c}=a.getBoundingClientRect();return{containerX:s.clientX-n,containerY:s.clientY-c}}getDrawEventFromEvent(s){const a=this.getLngLatFromEvent(s);if(!a)return null;const{lng:n,lat:c}=a,{containerX:f,containerY:m}=this.getMapElementXYPosition(s),h=this.getButton(s),P=Array.from(this._heldKeys);return{lng:Fg(n,this._coordinatePrecision),lat:Fg(c,this._coordinatePrecision),containerX:f,containerY:m,button:h,heldKeys:P}}register(s){this._currentModeCallbacks=s,this._listeners=this.getAdapterListeners(),this._listeners.forEach(a=>{a.register()})}getCoordinatePrecision(){return this._coordinatePrecision}getAdapterListeners(){return[new Ha({name:"pointerdown",callback:s=>{if(!this._currentModeCallbacks||!s.isPrimary)return;const a=this.getDrawEventFromEvent(s);a&&(this._dragState="pre-dragging",this._lastDrawEvent=a)},register:s=>{this.getMapEventElement().addEventListener("pointerdown",s)},unregister:s=>{this.getMapEventElement().removeEventListener("pointerdown",s)}}),new Ha({name:"pointermove",callback:s=>{if(!this._currentModeCallbacks||!s.isPrimary)return;s.preventDefault();const a=this.getDrawEventFromEvent(s);if(a)if(this._dragState==="not-dragging")this._currentModeCallbacks.onMouseMove(a),this._lastDrawEvent=a;else if(this._dragState==="pre-dragging"){if(!this._lastDrawEvent)return;const n={x:this._lastDrawEvent.containerX,y:this._lastDrawEvent.containerY},c={x:a.containerX,y:a.containerY},f=this._currentModeCallbacks.getState(),m=pf(n,c);let h=!1;if(h=f==="drawing"?m{this.setDraggability.bind(this)(P)})}else this._dragState==="dragging"&&this._currentModeCallbacks.onDrag(a,n=>{this.setDraggability.bind(this)(n)})},register:s=>{this.getMapEventElement().addEventListener("pointermove",s)},unregister:s=>{this.getMapEventElement().removeEventListener("pointermove",s)}}),new Ha({name:"contextmenu",callback:s=>{this._currentModeCallbacks&&s.preventDefault()},register:s=>{this.getMapEventElement().addEventListener("contextmenu",s)},unregister:s=>{this.getMapEventElement().removeEventListener("contextmenu",s)}}),new Ha({name:"pointerup",callback:s=>{if(!this._currentModeCallbacks||s.target!==this.getMapEventElement()||!s.isPrimary)return;const a=this.getDrawEventFromEvent(s);a&&(this._dragState==="dragging"?this._currentModeCallbacks.onDragEnd(a,n=>{this.setDraggability.bind(this)(n)}):this._dragState!=="not-dragging"&&this._dragState!=="pre-dragging"||this._currentModeCallbacks.onClick(a),this._dragState="not-dragging",this.setDraggability(!0))},register:s=>{this.getMapEventElement().addEventListener("pointerup",s)},unregister:s=>{this.getMapEventElement().removeEventListener("pointerup",s)}}),new Ha({name:"keyup",callback:s=>{this._currentModeCallbacks&&(this._heldKeys.delete(s.key),this._currentModeCallbacks.onKeyUp({key:s.key,heldKeys:Array.from(this._heldKeys),preventDefault:()=>s.preventDefault()}))},register:s=>{this.getMapEventElement().addEventListener("keyup",s)},unregister:s=>{this.getMapEventElement().removeEventListener("keyup",s)}}),new Ha({name:"keydown",callback:s=>{this._currentModeCallbacks&&(this._heldKeys.add(s.key),this._currentModeCallbacks.onKeyDown({key:s.key,heldKeys:Array.from(this._heldKeys),preventDefault:()=>s.preventDefault()}))},register:s=>{this.getMapEventElement().addEventListener("keydown",s)},unregister:s=>{this.getMapEventElement().removeEventListener("keydown",s)}})]}unregister(){this._listeners.forEach(s=>{s.unregister()}),this.clear()}}class b1 extends Ky{constructor(s){super(s),this._nextRender=void 0,this._map=void 0,this._container=void 0,this._rendered=!1,this.changedIds={deletion:!1,points:!1,linestrings:!1,polygons:!1,styling:!1},this._map=s.map,this._container=this._map.getContainer()}clearLayers(){this._rendered&&(["point","linestring","polygon"].forEach(s=>{const a=`td-${s.toLowerCase()}`;this._map.removeLayer(a),s==="polygon"&&this._map.removeLayer(a+"-outline"),this._map.removeSource(a)}),this._rendered=!1,this._nextRender&&(cancelAnimationFrame(this._nextRender),this._nextRender=void 0))}_addGeoJSONSource(s,a){this._map.addSource(s,{type:"geojson",data:{type:"FeatureCollection",features:a},tolerance:0})}_addFillLayer(s){return this._map.addLayer({id:s,source:s,type:"fill",paint:{"fill-color":["get","polygonFillColor"],"fill-opacity":["get","polygonFillOpacity"]}})}_addFillOutlineLayer(s,a){const n=this._map.addLayer({id:s+"-outline",source:s,type:"line",paint:{"line-width":["get","polygonOutlineWidth"],"line-color":["get","polygonOutlineColor"]}});return a&&this._map.moveLayer(s,a),n}_addLineLayer(s,a){const n=this._map.addLayer({id:s,source:s,type:"line",paint:{"line-width":["get","lineStringWidth"],"line-color":["get","lineStringColor"]}});return a&&this._map.moveLayer(s,a),n}_addPointLayer(s,a){const n=this._map.addLayer({id:s,source:s,type:"circle",paint:{"circle-stroke-color":["get","pointOutlineColor"],"circle-stroke-width":["get","pointOutlineWidth"],"circle-radius":["get","pointWidth"],"circle-color":["get","pointColor"]}});return a&&this._map.moveLayer(s,a),n}_addLayer(s,a,n){a==="Point"&&this._addPointLayer(s,n),a==="LineString"&&this._addLineLayer(s,n),a==="Polygon"&&(this._addFillLayer(s),this._addFillOutlineLayer(s,n))}_addGeoJSONLayer(s,a){const n=`td-${s.toLowerCase()}`;return this._addGeoJSONSource(n,a),this._addLayer(n,s),n}_setGeoJSONLayerData(s,a){const n=`td-${s.toLowerCase()}`;return this._map.getSource(n).setData({type:"FeatureCollection",features:a}),n}getEmptyGeometries(){return{points:[],linestrings:[],polygons:[]}}updateChangedIds(s){[...s.updated,...s.created].forEach(a=>{a.geometry.type==="Point"?this.changedIds.points=!0:a.geometry.type==="LineString"?this.changedIds.linestrings=!0:a.geometry.type==="Polygon"&&(this.changedIds.polygons=!0)}),s.deletedIds.length>0&&(this.changedIds.deletion=!0),s.created.length===0&&s.updated.length===0&&s.deletedIds.length===0&&(this.changedIds.styling=!0)}getLngLatFromEvent(s){const{left:a,top:n}=this._container.getBoundingClientRect();return this.unproject(s.clientX-a,s.clientY-n)}getMapEventElement(){return this._map.getCanvas()}setDraggability(s){s?(this._map.dragRotate.enable(),this._map.dragPan.enable()):(this._map.dragRotate.disable(),this._map.dragPan.disable())}project(s,a){const{x:n,y:c}=this._map.project({lng:s,lat:a});return{x:n,y:c}}unproject(s,a){const{lng:n,lat:c}=this._map.unproject({x:s,y:a});return{lng:n,lat:c}}setCursor(s){const a=this._map.getCanvas();s==="unset"?a.style.removeProperty("cursor"):a.style.cursor=s}setDoubleClickToZoom(s){s?this._map.doubleClickZoom.enable():this._map.doubleClickZoom.disable()}render(s,a){this.updateChangedIds(s),this._nextRender&&cancelAnimationFrame(this._nextRender),this._nextRender=requestAnimationFrame(()=>{const n=[...s.created,...s.updated,...s.unchanged],c=this.getEmptyGeometries();for(let P=0;P{const{properties:B}=L;if(B.mode!==V)return;const U=a[V](L);L.geometry.type==="Point"?(B.pointColor=U.pointColor,B.pointOutlineColor=U.pointOutlineColor,B.pointOutlineWidth=U.pointOutlineWidth,B.pointWidth=U.pointWidth,c.points.push(L)):L.geometry.type==="LineString"?(B.lineStringColor=U.lineStringColor,B.lineStringWidth=U.lineStringWidth,c.linestrings.push(L)):L.geometry.type==="Polygon"&&(B.polygonFillColor=U.polygonFillColor,B.polygonFillOpacity=U.polygonFillOpacity,B.polygonOutlineColor=U.polygonOutlineColor,B.polygonOutlineWidth=U.polygonOutlineWidth,c.polygons.push(L))})}const{points:f,linestrings:m,polygons:h}=c;if(this._rendered){const P=this.changedIds.deletion||this.changedIds.styling,L=P||this.changedIds.linestrings,V=P||this.changedIds.polygons;let B;(P||this.changedIds.points)&&(B=this._setGeoJSONLayerData("Point",f)),L&&this._setGeoJSONLayerData("LineString",m),V&&this._setGeoJSONLayerData("Polygon",h),B&&this._map.moveLayer(B)}else{const P=this._addGeoJSONLayer("Point",f);this._addGeoJSONLayer("LineString",m),this._addGeoJSONLayer("Polygon",h),this._rendered=!0,P&&this._map.moveLayer(P)}this.changedIds={points:!1,linestrings:!1,polygons:!1,deletion:!1,styling:!1}})}clear(){this._currentModeCallbacks&&(this._currentModeCallbacks.onClear(),this.clearLayers())}getCoordinatePrecision(){return super.getCoordinatePrecision()}unregister(){return super.unregister()}register(s){super.register(s),this._currentModeCallbacks&&this._currentModeCallbacks.onReady&&this._currentModeCallbacks.onReady()}}class w1 extends Ky{constructor(s){super(s),this.mapboxglAdapter=void 0,this.mapboxglAdapter=new b1(s)}register(s){this.mapboxglAdapter.register(s)}unregister(){this.mapboxglAdapter.unregister()}getCoordinatePrecision(){return this.mapboxglAdapter.getCoordinatePrecision()}getLngLatFromEvent(s){return this.mapboxglAdapter.getLngLatFromEvent(s)}getMapEventElement(){return this.mapboxglAdapter.getMapEventElement()}setDraggability(s){this.mapboxglAdapter.setDraggability(s)}project(s,a){return this.mapboxglAdapter.project(s,a)}unproject(s,a){return this.mapboxglAdapter.unproject(s,a)}setCursor(s){this.mapboxglAdapter.setCursor(s)}setDoubleClickToZoom(s){this.mapboxglAdapter.setDoubleClickToZoom(s)}render(s,a){this.mapboxglAdapter.render(s,a)}clear(){this.mapboxglAdapter.clear()}}let I1=0;const Ws=typeof navigator<"u"&&navigator.userAgent!==void 0?navigator.userAgent.toLowerCase():"";Ws.includes("firefox"),Ws.includes("safari")&&!Ws.includes("chrom")&&(Ws.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(Ws)),Ws.includes("webkit")&&Ws.includes("edge"),Ws.includes("macintosh");typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope;(function(){let g=!1;try{const s=Object.defineProperty({},"passive",{get:function(){g=!0}});window.addEventListener("_",null,s),window.removeEventListener("_",null,s)}catch{}})();var C1=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},Yy=class{constructor(g){this.type=g,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};function Rg(){}function Qy(g){for(const s in g)delete g[s]}var S1=class extends C1{constructor(g){super(),this.eventTarget_=g,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(g,s){if(!g||!s)return;const a=this.listeners_||(this.listeners_={}),n=a[g]||(a[g]=[]);n.includes(s)||n.push(s)}dispatchEvent(g){const s=typeof g=="string",a=s?g:g.type,n=this.listeners_&&this.listeners_[a];if(!n)return;const c=s?new Yy(g):g;c.target||(c.target=this.eventTarget_||this);const f=this.dispatching_||(this.dispatching_={}),m=this.pendingRemovals_||(this.pendingRemovals_={});let h;a in f||(f[a]=0,m[a]=0),++f[a];for(let P=0,L=n.length;P0)}removeEventListener(g,s){if(!this.listeners_)return;const a=this.listeners_[g];if(!a)return;const n=a.indexOf(s);n!==-1&&(this.pendingRemovals_&&g in this.pendingRemovals_?(a[n]=Rg,++this.pendingRemovals_[g]):(a.splice(n,1),a.length===0&&delete this.listeners_[g]))}},M1="change";function $p(g,s,a,n,c){if(c){const m=a;a=function(){g.removeEventListener(s,a),m.apply(this,arguments)}}const f={target:g,type:s,listener:a};return g.addEventListener(s,a),f}function Og(g,s,a,n){return $p(g,s,a,n,!0)}function Vg(g){g&&g.target&&(g.target.removeEventListener(g.type,g.listener),Qy(g))}var P1=class extends S1{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(M1)}getRevision(){return this.revision_}onInternal(g,s){if(Array.isArray(g)){const a=g.length,n=new Array(a);for(let c=0;c1?a:2,s===void 0&&(s=a>2?g.slice():new Array(n));for(let c=0;ccu?f=cu:f<-cu&&(f=-cu),s[c+1]=f}return s},Xg=function(g,s,a){const n=g.length;a=a>1?a:2,s===void 0&&(s=a>2?g.slice():new Array(n));for(let c=0;c0;function c(m){return m<0-s.epsilon||m>1+s.epsilon}function f(m,h,P,L){const V=a[m][h],B=a[m][h+1],U=a[P][L],ue=a[P][L+1],ye=function(Re,it,Ue,ut){if(uu(Re,Ue)||uu(Re,ut)||uu(it,Ue)||uu(ut,Ue))return null;const nt=Re[0],bt=Re[1],Ke=it[0],_t=it[1],kt=Ue[0],Rt=Ue[1],Ye=ut[0],St=ut[1],ct=(nt-Ke)*(Rt-St)-(bt-_t)*(kt-Ye);return ct===0?null:[((nt*_t-bt*Ke)*(kt-Ye)-(nt-Ke)*(kt*St-Rt*Ye))/ct,((nt*_t-bt*Ke)*(Rt-St)-(bt-_t)*(kt*St-Rt*Ye))/ct]}(V,B,U,ue);if(ye===null)return;let Se,Ne;Se=B[0]!==V[0]?(ye[0]-V[0])/(B[0]-V[0]):(ye[1]-V[1])/(B[1]-V[1]),Ne=ue[0]!==U[0]?(ye[0]-U[0])/(ue[0]-U[0]):(ye[1]-U[1])/(ue[1]-U[1]),c(Se)||c(Ne)||(ye.toString(),n.push(ye))}}function uu(g,s){return g[0]===s[0]&&g[1]===s[1]}function ff(g,s){return g.length===2&&typeof g[0]=="number"&&typeof g[1]=="number"&&g[0]!==1/0&&g[1]!==1/0&&(n=g[0])>=-180&&n<=180&&(a=g[1])>=-90&&a<=90&&Jg(g[0])<=s&&Jg(g[1])<=s;var a,n}function Jg(g){let s=1,a=0;for(;Math.round(g*s)/s!==g;)s*=10,a++;return a}function mf(g,s){return g.geometry.type==="Polygon"&&g.geometry.coordinates.length===1&&g.geometry.coordinates[0].length>=4&&g.geometry.coordinates[0].every(c=>ff(c,s))&&(a=g.geometry.coordinates[0][0])[0]===(n=g.geometry.coordinates[0][g.geometry.coordinates[0].length-1])[0]&&a[1]===n[1];var a,n}function F1(g,s){return mf(g,s)&&!B1(g)}class $u{constructor({store:s,mode:a,project:n,unproject:c,pointerDistance:f,coordinatePrecision:m,projection:h}){this.store=void 0,this.mode=void 0,this.project=void 0,this.unproject=void 0,this.pointerDistance=void 0,this.coordinatePrecision=void 0,this.projection=void 0,this.store=s,this.mode=a,this.project=n,this.unproject=c,this.pointerDistance=f,this.coordinatePrecision=m,this.projection=h}}function i_({unproject:g,point:s,pointerDistance:a}){const n=a/2,{x:c,y:f}=s;return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[g(c-n,f-n),g(c+n,f-n),g(c+n,f+n),g(c-n,f+n),g(c-n,f-n)].map(m=>[m.lng,m.lat])]}}}class R1 extends $u{constructor(s){super(s)}create(s){const{containerX:a,containerY:n}=s;return i_({unproject:this.unproject,point:{x:a,y:n},pointerDistance:this.pointerDistance})}}class O1 extends $u{constructor(s){super(s)}measure(s,a){const{x:n,y:c}=this.project(a[0],a[1]);return pf({x:n,y:c},{x:s.containerX,y:s.containerY})}}class V1 extends $u{constructor(s,a,n){super(s),this.config=void 0,this.pixelDistance=void 0,this.clickBoundingBox=void 0,this.getSnappableCoordinateFirstClick=c=>this.getSnappable(c,f=>!!(f.properties&&f.properties.mode===this.mode)),this.getSnappableCoordinate=(c,f)=>this.getSnappable(c,m=>!!(m.properties&&m.properties.mode===this.mode&&m.id!==f)),this.config=s,this.pixelDistance=a,this.clickBoundingBox=n}getSnappable(s,a){const n=this.clickBoundingBox.create(s),c=this.store.search(n,a),f={coord:void 0,minDist:1/0};return c.forEach(m=>{let h;if(m.geometry.type==="Polygon")h=m.geometry.coordinates[0];else{if(m.geometry.type!=="LineString")return;h=m.geometry.coordinates}h.forEach(P=>{const L=this.pixelDistance.measure(s,P);L0&&!this.mouseMove&&this.onMouseMove(s),this.mouseMove=!1,this.currentCoordinate===0){const a=this.snappingEnabled?this.snapping.getSnappableCoordinateFirstClick(s):void 0;a&&(s.lng=a[0],s.lat=a[1]);const[n]=this.store.create([{geometry:{type:"Polygon",coordinates:[[[s.lng,s.lat],[s.lng,s.lat],[s.lng,s.lat],[s.lng,s.lat]]]},properties:{mode:this.mode}}]);this.currentId=n,this.currentCoordinate++,this.setDrawing()}else if(this.currentCoordinate===1&&this.currentId){const a=this.snappingEnabled?this.snapping.getSnappableCoordinate(s,this.currentId):void 0;a&&(s.lng=a[0],s.lat=a[1]);const n=this.store.getGeometryCopy(this.currentId);if(vp([s.lng,s.lat],n.coordinates[0][0])||!this.updatePolygonGeometry([n.coordinates[0][0],[s.lng,s.lat],[s.lng,s.lat],n.coordinates[0][0]],Vn.Commit))return;this.currentCoordinate++}else if(this.currentCoordinate===2&&this.currentId){const a=this.snappingEnabled?this.snapping.getSnappableCoordinate(s,this.currentId):void 0;a&&(s.lng=a[0],s.lat=a[1]);const n=this.store.getGeometryCopy(this.currentId).coordinates[0];if(vp([s.lng,s.lat],n[1])||!this.updatePolygonGeometry([n[0],n[1],[s.lng,s.lat],[s.lng,s.lat],n[0]],Vn.Commit))return;this.currentCoordinate===2&&this.closingPoints.create(n,"polygon"),this.currentCoordinate++}else if(this.currentId){const a=this.snappingEnabled?this.snapping.getSnappableCoordinate(s,this.currentId):void 0,n=this.store.getGeometryCopy(this.currentId).coordinates[0],{isClosing:c,isPreviousClosing:f}=this.closingPoints.isClosingPoint(s);if(f||c)this.close();else{if(a&&(s.lng=a[0],s.lat=a[1]),vp([s.lng,s.lat],n[this.currentCoordinate-1]))return;const m=function(h=[[[0,0],[0,1],[1,1],[1,0],[0,0]]]){return{type:"Feature",geometry:{type:"Polygon",coordinates:h},properties:{}}}([[...n.slice(0,-1),[s.lng,s.lat],n[0]]]);if(!this.updatePolygonGeometry(m.geometry.coordinates[0],Vn.Commit))return;this.currentCoordinate++,this.closingPoints.ids.length&&this.closingPoints.update(m.geometry.coordinates[0])}}}onKeyUp(s){s.key===this.keyEvents.cancel?this.cleanUp():s.key===this.keyEvents.finish&&this.close()}onKeyDown(){}onDragStart(){this.setCursor("unset")}onDrag(){}onDragEnd(){this.setCursor(this.cursors.start)}cleanUp(){const s=this.currentId;this.currentId=void 0,this.currentCoordinate=0,this.state==="drawing"&&this.setStarted();try{s!==void 0&&this.store.delete([s]),this.closingPoints.ids.length&&this.closingPoints.delete()}catch{}}styleFeature(s){const a=un({},{polygonFillColor:"#3f97e0",polygonOutlineColor:"#3f97e0",polygonOutlineWidth:4,polygonFillOpacity:.3,pointColor:"#3f97e0",pointOutlineColor:"#ffffff",pointOutlineWidth:0,pointWidth:6,lineStringColor:"#3f97e0",lineStringWidth:4,zIndex:0});if(s.properties.mode===this.mode){if(s.geometry.type==="Polygon")return a.polygonFillColor=this.getHexColorStylingValue(this.styles.fillColor,a.polygonFillColor,s),a.polygonOutlineColor=this.getHexColorStylingValue(this.styles.outlineColor,a.polygonOutlineColor,s),a.polygonOutlineWidth=this.getNumericStylingValue(this.styles.outlineWidth,a.polygonOutlineWidth,s),a.polygonFillOpacity=this.getNumericStylingValue(this.styles.fillOpacity,a.polygonFillOpacity,s),a.zIndex=10,a;if(s.geometry.type==="Point")return a.pointWidth=this.getNumericStylingValue(this.styles.closingPointWidth,a.pointWidth,s),a.pointColor=this.getHexColorStylingValue(this.styles.closingPointColor,a.pointColor,s),a.pointOutlineColor=this.getHexColorStylingValue(this.styles.closingPointOutlineColor,a.pointOutlineColor,s),a.pointOutlineWidth=this.getNumericStylingValue(this.styles.closingPointOutlineWidth,2,s),a.zIndex=30,a}return a}validateFeature(s){return!!super.validateFeature(s)&&s.properties.mode===this.mode&&mf(s,this.coordinatePrecision)}}class $1 extends ju{constructor(s){super(s),this.mode="rectangle",this.center=void 0,this.clickCount=0,this.currentRectangleId=void 0,this.keyEvents=void 0,this.cursors=void 0;const a={start:"crosshair"};if(this.cursors=s&&s.cursors?un({},a,s.cursors):a,(s==null?void 0:s.keyEvents)===null)this.keyEvents={cancel:null,finish:null};else{const n={cancel:"Escape",finish:"Enter"};this.keyEvents=s&&s.keyEvents?un({},n,s.keyEvents):n}}updateRectangle(s,a){if(this.clickCount===1&&this.center&&this.currentRectangleId){const n=this.store.getGeometryCopy(this.currentRectangleId).coordinates[0][0],c={type:"Polygon",coordinates:[[n,[s.lng,n[1]],[s.lng,s.lat],[n[0],s.lat],n]]};if(this.validate&&!this.validate({id:this.currentRectangleId,geometry:c},{project:this.project,unproject:this.unproject,coordinatePrecision:this.coordinatePrecision,updateType:a}))return;this.store.updateGeometry([{id:this.currentRectangleId,geometry:c}])}}close(){const s=this.currentRectangleId;this.center=void 0,this.currentRectangleId=void 0,this.clickCount=0,this.state==="drawing"&&this.setStarted(),s&&this.onFinish(s,{mode:this.mode,action:"draw"})}start(){this.setStarted(),this.setCursor(this.cursors.start)}stop(){this.cleanUp(),this.setStopped(),this.setCursor("unset")}onClick(s){if(this.clickCount===0){this.center=[s.lng,s.lat];const[a]=this.store.create([{geometry:{type:"Polygon",coordinates:[[[s.lng,s.lat],[s.lng,s.lat],[s.lng,s.lat],[s.lng,s.lat]]]},properties:{mode:this.mode}}]);this.currentRectangleId=a,this.clickCount++,this.setDrawing()}else this.updateRectangle(s,Vn.Finish),this.close()}onMouseMove(s){this.updateRectangle(s,Vn.Provisional)}onKeyDown(){}onKeyUp(s){s.key===this.keyEvents.cancel?this.cleanUp():s.key===this.keyEvents.finish&&this.close()}onDragStart(){}onDrag(){}onDragEnd(){}cleanUp(){const s=this.currentRectangleId;this.center=void 0,this.currentRectangleId=void 0,this.clickCount=0,this.state==="drawing"&&this.setStarted(),s!==void 0&&this.store.delete([s])}styleFeature(s){const a=un({},{polygonFillColor:"#3f97e0",polygonOutlineColor:"#3f97e0",polygonOutlineWidth:4,polygonFillOpacity:.3,pointColor:"#3f97e0",pointOutlineColor:"#ffffff",pointOutlineWidth:0,pointWidth:6,lineStringColor:"#3f97e0",lineStringWidth:4,zIndex:0});return s.type==="Feature"&&s.geometry.type==="Polygon"&&s.properties.mode===this.mode&&(a.polygonFillColor=this.getHexColorStylingValue(this.styles.fillColor,a.polygonFillColor,s),a.polygonOutlineColor=this.getHexColorStylingValue(this.styles.outlineColor,a.polygonOutlineColor,s),a.polygonOutlineWidth=this.getNumericStylingValue(this.styles.outlineWidth,a.polygonOutlineWidth,s),a.polygonFillOpacity=this.getNumericStylingValue(this.styles.fillOpacity,a.polygonFillOpacity,s),a.zIndex=10),a}validateFeature(s){return!!super.validateFeature(s)&&s.properties.mode===this.mode&&F1(s,this.coordinatePrecision)}}class q1 extends ju{constructor(s){super({styles:s.styles}),this.type=dl.Render,this.mode="render",this.mode=s.modeName}registerBehaviors(s){this.mode=s.mode}start(){this.setStarted()}stop(){this.setStopped()}onKeyUp(){}onKeyDown(){}onClick(){}onDragStart(){}onDrag(){}onDragEnd(){}onMouseMove(){}cleanUp(){}styleFeature(s){return{pointColor:this.getHexColorStylingValue(this.styles.pointColor,"#3f97e0",s),pointWidth:this.getNumericStylingValue(this.styles.pointWidth,6,s),pointOutlineColor:this.getHexColorStylingValue(this.styles.pointOutlineColor,"#ffffff",s),pointOutlineWidth:this.getNumericStylingValue(this.styles.pointOutlineWidth,0,s),polygonFillColor:this.getHexColorStylingValue(this.styles.polygonFillColor,"#3f97e0",s),polygonFillOpacity:this.getNumericStylingValue(this.styles.polygonFillOpacity,.3,s),polygonOutlineColor:this.getHexColorStylingValue(this.styles.polygonOutlineColor,"#3f97e0",s),polygonOutlineWidth:this.getNumericStylingValue(this.styles.polygonOutlineWidth,4,s),lineStringWidth:this.getNumericStylingValue(this.styles.lineStringWidth,4,s),lineStringColor:this.getHexColorStylingValue(this.styles.lineStringColor,"#3f97e0",s),zIndex:this.getNumericStylingValue(this.styles.zIndex,0,s)}}validateFeature(s){return super.validateFeature(s)&&(N1(s,this.coordinatePrecision)||mf(s,this.coordinatePrecision)||function(a,n){return a.geometry.type==="LineString"&&a.geometry.coordinates.length>=2&&a.geometry.coordinates.every(c=>ff(c,n))}(s,this.coordinatePrecision))}}function Z1(g,s){let a=!1;for(let m=0,h=s.length;m(n=g)[1]!=(f=P[B])[1]>n[1]&&n[0]<(f[0]-c[0])*(n[1]-c[1])/(f[1]-c[1])+c[0]&&(a=!a)}var n,c,f;return a}const G1=(g,s,a)=>{const n=f=>f*f,c=(f,m)=>n(f.x-m.x)+n(f.y-m.y);return Math.sqrt(((f,m,h)=>{const P=c(m,h);if(P===0)return c(f,m);let L=((f.x-m.x)*(h.x-m.x)+(f.y-m.y)*(h.y-m.y))/P;return L=Math.max(0,Math.min(1,L)),c(f,{x:m.x+L*(h.x-m.x),y:m.y+L*(h.y-m.y)})})(g,s,a))};class X1 extends ju{constructor(...s){super(...s),this.type=dl.Static,this.mode="static"}start(){}stop(){}onKeyUp(){}onKeyDown(){}onClick(){}onDragStart(){}onDrag(){}onDragEnd(){}onMouseMove(){}cleanUp(){}styleFeature(){return un({},{polygonFillColor:"#3f97e0",polygonOutlineColor:"#3f97e0",polygonOutlineWidth:4,polygonFillOpacity:.3,pointColor:"#3f97e0",pointOutlineColor:"#ffffff",pointOutlineWidth:0,pointWidth:6,lineStringColor:"#3f97e0",lineStringWidth:4,zIndex:0})}}function r_(g,s,a,n,c){for(;n>a;){if(n-a>600){const P=n-a+1,L=s-a+1,V=Math.log(P),B=.5*Math.exp(2*V/3),U=.5*Math.sqrt(V*B*(P-B)/P)*(L-P/2<0?-1:1);r_(g,s,Math.max(a,Math.floor(s-L*B/P+U)),Math.min(n,Math.floor(s+(P-L)*B/P+U)),c)}const f=g[s];let m=a,h=n;for(Sh(g,a,s),c(g[n],f)>0&&Sh(g,a,n);m0;)h--}c(g[a],f)===0?Sh(g,a,h):(h++,Sh(g,h,n)),h<=s&&(a=h+1),s<=h&&(n=h-1)}}function Sh(g,s,a){const n=g[s];g[s]=g[a],g[a]=n}function Ka(g,s){Eh(g,0,g.children.length,s,g)}function Eh(g,s,a,n,c){c||(c=Qa([])),c.minX=1/0,c.minY=1/0,c.maxX=-1/0,c.maxY=-1/0;for(let f=s;f=g.minX&&s.maxY>=g.minY}function Qa(g){return{children:g,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Kg(g,s,a,n,c){const f=[s,a];for(;f.length;){if((a=f.pop())-(s=f.pop())<=n)continue;const m=s+Math.ceil((a-s)/n/2)*n;r_(g,m,s,a,c),f.push(s,m,m,a)}}class K1{constructor(s){this._maxEntries=void 0,this._minEntries=void 0,this.data=void 0,this._maxEntries=Math.max(4,s),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}search(s){let a=this.data;const n=[];if(!pu(s,a))return n;const c=this.toBBox,f=[];for(;a;){for(let m=0;m=0&&f[a].children.length>this._maxEntries;)this._split(f,a),a--;this._adjustParentBBoxes(c,f,a)}_split(s,a){const n=s[a],c=n.children.length,f=this._minEntries;this._chooseSplitAxis(n,f,c);const m=this._chooseSplitIndex(n,f,c),h=Qa(n.children.splice(m,n.children.length-m));h.height=n.height,h.leaf=n.leaf,Ka(n,this.toBBox),Ka(h,this.toBBox),a?s[a-1].children.push(h):this._splitRoot(n,h)}_splitRoot(s,a){this.data=Qa([s,a]),this.data.height=s.height+1,this.data.leaf=!1,Ka(this.data,this.toBBox)}_chooseSplitIndex(s,a,n){let c,f=1/0,m=1/0;for(let h=a;h<=n-a;h++){const P=Eh(s,0,h,this.toBBox),L=Eh(s,h,n,this.toBBox),V=J1(P,L),B=xp(P)+xp(L);V=a;L--){const V=s.children[L];Th(h,s.leaf?f(V):V),P+=du(h)}return P}_adjustParentBBoxes(s,a,n){for(let c=n;c>=0;c--)Th(a[c],s)}_condense(s){for(let a,n=s.length-1;n>=0;n--)s[n].children.length===0?n>0?(a=s[n-1].children,a.splice(a.indexOf(s[n]),1)):this.clear():Ka(s[n],this.toBBox)}}class Y1{constructor(s){this.tree=void 0,this.idToNode=void 0,this.nodeToId=void 0,this.tree=new K1(s&&s.maxEntries?s.maxEntries:9),this.idToNode=new Map,this.nodeToId=new Map}setMaps(s,a){this.idToNode.set(s.id,a),this.nodeToId.set(a,s.id)}toBBox(s){const a=[],n=[];let c;if(s.geometry.type==="Polygon")c=s.geometry.coordinates[0];else if(s.geometry.type==="LineString")c=s.geometry.coordinates;else{if(s.geometry.type!=="Point")throw new Error("Not a valid feature to turn into a bounding box");c=[s.geometry.coordinates]}for(let h=0;h{const f=this.toBBox(c);if(this.setMaps(c,f),n.has(String(c.id)))throw new Error(`Duplicate feature ID found ${c.id}`);n.add(String(c.id)),a.push(f)}),this.tree.load(a)}update(s){this.remove(s.id);const a=this.toBBox(s);this.setMaps(s,a),this.tree.insert(a)}remove(s){const a=this.idToNode.get(s);if(!a)throw new Error(`${s} not inserted into the spatial index`);this.tree.remove(a)}clear(){this.tree.clear()}search(s){return this.tree.search(this.toBBox(s)).map(a=>this.nodeToId.get(a))}collides(s){return this.tree.collides(this.toBBox(s))}}const Q1={getId:()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(g){const s=16*Math.random()|0;return(g=="x"?s:3&s|8).toString(16)}),isValidId:g=>typeof g=="string"&&g.length===36};class eb{constructor(s){this.idStrategy=void 0,this.tracked=void 0,this.spatialIndex=void 0,this.store=void 0,this._onChange=()=>{},this.store={},this.spatialIndex=new Y1,this.tracked=!s||s.tracked!==!1,this.idStrategy=s&&s.idStrategy?s.idStrategy:Q1}clone(s){return JSON.parse(JSON.stringify(s))}getId(){return this.idStrategy.getId()}has(s){return!!this.store[s]}load(s,a){if(s.length===0)return;const n=this.clone(s);n.forEach(f=>{f.id==null&&(f.id=this.idStrategy.getId()),this.tracked&&(f.properties.createdAt?Hg(f.properties.createdAt):f.properties.createdAt=+new Date,f.properties.updatedAt?Hg(f.properties.updatedAt):f.properties.updatedAt=+new Date)});const c=[];n.forEach(f=>{const m=f.id;if(a&&!a(f))throw new Error(`Feature is not ${m} valid: ${JSON.stringify(f)}`);if(this.has(m))throw new Error(`Feature already exists with this id: ${m}`);this.store[m]=f,c.push(m)}),this.spatialIndex.load(n),this._onChange(c,"create")}search(s,a){const n=this.spatialIndex.search(s).map(c=>this.store[c]);return this.clone(a?n.filter(a):n)}registerOnChange(s){this._onChange=(a,n)=>{s(a,n)}}getGeometryCopy(s){const a=this.store[s];if(!a)throw new Error(`No feature with this id (${s}), can not get geometry copy`);return this.clone(a.geometry)}getPropertiesCopy(s){const a=this.store[s];if(!a)throw new Error(`No feature with this id (${s}), can not get properties copy`);return this.clone(a.properties)}updateProperty(s){const a=[];s.forEach(({id:n,property:c,value:f})=>{const m=this.store[n];if(!m)throw new Error(`No feature with this (${n}), can not update geometry`);a.push(n),m.properties[c]=f,this.tracked&&(m.properties.updatedAt=+new Date)}),this._onChange&&this._onChange(a,"update")}updateGeometry(s){const a=[];s.forEach(({id:n,geometry:c})=>{a.push(n);const f=this.store[n];if(!f)throw new Error(`No feature with this (${n}), can not update geometry`);f.geometry=this.clone(c),this.spatialIndex.update(f),this.tracked&&(f.properties.updatedAt=+new Date)}),this._onChange&&this._onChange(a,"update")}create(s){const a=[];return s.forEach(({geometry:n,properties:c})=>{let f,m=un({},c);this.tracked&&(f=+new Date,c?(m.createdAt=typeof c.createdAt=="number"?c.createdAt:f,m.updatedAt=typeof c.updatedAt=="number"?c.updatedAt:f):m={createdAt:f,updatedAt:f});const h=this.getId(),P={id:h,type:"Feature",geometry:n,properties:m};this.store[h]=P,this.spatialIndex.insert(P),a.push(h)}),this._onChange&&this._onChange([...a],"create"),a}delete(s){s.forEach(a=>{if(!this.store[a])throw new Error("No feature with this id, can not delete");delete this.store[a],this.spatialIndex.remove(a)}),this._onChange&&this._onChange([...s],"delete")}copyAll(){return this.clone(Object.keys(this.store).map(s=>this.store[s]))}clear(){this.store={},this.spatialIndex.clear()}size(){return Object.keys(this.store).length}}class tb{constructor(s){this._modes=void 0,this._mode=void 0,this._adapter=void 0,this._enabled=!1,this._store=void 0,this._eventListeners=void 0,this._instanceSelectMode=void 0,this._adapter=s.adapter,this._mode=new X1;const a=new Set,n=s.modes.reduce((V,B)=>{if(a.has(B.mode))throw new Error(`There is already a ${B.mode} mode provided`);return a.add(B.mode),V[B.mode]=B,V},{}),c=Object.keys(n);if(c.length===0)throw new Error("No modes provided");c.forEach(V=>{if(n[V].type===dl.Select){if(this._instanceSelectMode)throw new Error("only one type of select mode can be provided");this._instanceSelectMode=V}}),this._modes=un({},n,{static:this._mode}),this._eventListeners={change:[],select:[],deselect:[],finish:[],ready:[]},this._store=new eb({tracked:!!s.tracked,idStrategy:s.idStrategy?s.idStrategy:void 0});const f=V=>{const B=[],U=this._store.copyAll().filter(ue=>!V.includes(ue.id)||(B.push(ue),!1));return{changed:B,unchanged:U}},m=(V,B)=>{this._enabled&&this._eventListeners.finish.forEach(U=>{U(V,B)})},h=(V,B)=>{if(!this._enabled)return;this._eventListeners.change.forEach(ye=>{ye(V,B)});const{changed:U,unchanged:ue}=f(V);B==="create"?this._adapter.render({created:U,deletedIds:[],unchanged:ue,updated:[]},this.getModeStyles()):B==="update"?this._adapter.render({created:[],deletedIds:[],unchanged:ue,updated:U},this.getModeStyles()):B==="delete"?this._adapter.render({created:[],deletedIds:V,unchanged:ue,updated:[]},this.getModeStyles()):B==="styling"&&this._adapter.render({created:[],deletedIds:[],unchanged:ue,updated:[]},this.getModeStyles())},P=V=>{if(!this._enabled)return;this._eventListeners.select.forEach(ue=>{ue(V)});const{changed:B,unchanged:U}=f([V]);this._adapter.render({created:[],deletedIds:[],unchanged:U,updated:B},this.getModeStyles())},L=V=>{if(!this._enabled)return;this._eventListeners.deselect.forEach(ue=>{ue()});const{changed:B,unchanged:U}=f([V]);B&&this._adapter.render({created:[],deletedIds:[],unchanged:U,updated:B},this.getModeStyles())};Object.keys(this._modes).forEach(V=>{this._modes[V].register({mode:V,store:this._store,setCursor:this._adapter.setCursor.bind(this._adapter),project:this._adapter.project.bind(this._adapter),unproject:this._adapter.unproject.bind(this._adapter),setDoubleClickToZoom:this._adapter.setDoubleClickToZoom.bind(this._adapter),onChange:h,onSelect:P,onDeselect:L,onFinish:m,coordinatePrecision:this._adapter.getCoordinatePrecision()})})}checkEnabled(){if(!this._enabled)throw new Error("Terra Draw is not enabled")}getModeStyles(){const s={};return Object.keys(this._modes).forEach(a=>{s[a]=n=>this._instanceSelectMode&&n.properties[D1]?this._modes[this._instanceSelectMode].styleFeature.bind(this._modes[this._instanceSelectMode])(n):this._modes[a].styleFeature.bind(this._modes[a])(n)}),s}featuresAtLocation({lng:s,lat:a},n){const c=n&&n.pointerDistance!==void 0?n.pointerDistance:30,f=!n||n.ignoreSelectFeatures===void 0||n.ignoreSelectFeatures,m=this._adapter.unproject.bind(this._adapter),h=this._adapter.project.bind(this._adapter),P=h(s,a),L=i_({unproject:m,point:P,pointerDistance:c});return this._store.search(L).filter(V=>{if(f&&(V.properties[L1]||V.properties.selectionPoint))return!1;if(V.geometry.type==="Point"){const B=V.geometry.coordinates,U=h(B[0],B[1]);return pf(P,U){if(a&&typeof a=="object"&&"properties"in a&&typeof a.properties=="object"&&a.properties!==null&&"mode"in a.properties){const n=this._modes[a.properties.mode];return!!n&&n.validateFeature.bind(n)(a)}return!1})}start(){this._enabled=!0,this._adapter.register({onReady:()=>{this._eventListeners.ready.forEach(s=>{s()})},getState:()=>this._mode.state,onClick:s=>{this._mode.onClick(s)},onMouseMove:s=>{this._mode.onMouseMove(s)},onKeyDown:s=>{this._mode.onKeyDown(s)},onKeyUp:s=>{this._mode.onKeyUp(s)},onDragStart:(s,a)=>{this._mode.onDragStart(s,a)},onDrag:(s,a)=>{this._mode.onDrag(s,a)},onDragEnd:(s,a)=>{this._mode.onDragEnd(s,a)},onClear:()=>{this._mode.cleanUp(),this._store.clear()}})}getFeaturesAtLngLat(s,a){const{lng:n,lat:c}=s;return this.featuresAtLocation({lng:n,lat:c},a)}getFeaturesAtPointerEvent(s,a){const n=this._adapter.getLngLatFromEvent.bind(this._adapter)(s);return n===null?[]:this.featuresAtLocation(n,a)}stop(){this._enabled=!1,this._adapter.unregister()}on(s,a){const n=this._eventListeners[s];n.includes(a)||n.push(a)}off(s,a){const n=this._eventListeners[s];n.includes(a)&&n.splice(n.indexOf(a),1)}}var ib=Zp("
"),rb=Zp(""),nb=Zp(" cells");const sb=()=>{},Yg=(g,s)=>{if(s.length>1)throw new Error("multi-feature unsupported");return g.covering(s[0].geometry)},ob=g=>{if(g.features.length<=4)return;const s=[];let a=!1,n=g.features.at(-1).geometry.coordinates.at(-1);g.features.forEach(c=>{const f=c.geometry.coordinates.at(0);(n[0]===180&&f[0]===-180||n[0]===-180&&f[0]===180)&&(a=!a),s.push(a),n=c.geometry.coordinates.at(-1)}),g.features.forEach((c,f)=>{s[f]&&c.geometry.coordinates.forEach(m=>m[0]+=360)})},ab=(g,s)=>{[On.cellid.fromFace(2),On.cellid.fromFace(5)].includes(g)&&s.forEach(n=>{if(n.geometry.type==="MultiLineString"){const c=n.geometry.coordinates[0].at(-1),f=n.geometry.coordinates[1].at(0);if(!c||Math.abs(c[0])!==180||!f||Math.abs(f[0])!==180)return;const m=Math.sign(c[0])*90;n.geometry.coordinates=[n.geometry.coordinates[0],[c,[c[0],m],[f[0],m],f],n.geometry.coordinates[1]]}})},lb=g=>{g.forEach((s,a)=>{Math.abs(s[1])===90&&(s[0]=g.at(a-1)[0])})},hb=g=>{const s=g.filter(n=>Math.abs(n[0])===180);if(s.length!==2||Math.sign(s[0][0])!==Math.sign(s[1][0]))return;const a=g.filter(n=>Math.abs(n[0])!==180);a.length===2&&Math.sign(a[0][0])===Math.sign(a[1][0])&&s.forEach(n=>n[0]=Math.sign(a[0][0])*180)},cb=g=>{g.forEach(s=>{s.geometry.type==="MultiLineString"&&s.geometry.coordinates.length===2&&(s.geometry.coordinates=s.geometry.coordinates.filter(a=>a.length!==2?!0:!(a[0][0]===a[1][0]&&a[0][1]===a[1][1])))})},Qg=g=>({type:"FeatureCollection",features:[...g].map(a=>{const n=On.Cell.fromCellID(a),f=Hy.toGeoJSON(n).coordinates[0];lb([f[0],f[1],f[2],f[3]]),hb([f[0],f[1],f[2],f[3]]);const h=20+(30-n.level)*3,P=lu(f[0],f[1],{npoints:h}),L=lu(f[1],f[2],{npoints:h}),V=lu(f[2],f[3],{npoints:h}),B=lu(f[3],f[0],{npoints:h});cb([P,L,V,B]),ab(a,[P,L,V,B]);const U={type:"FeatureCollection",features:[...hu(P).features,...hu(L).features,...hu(V).features,...hu(B).features]};ob(U);const ue=U.features.map(Se=>Se.geometry.coordinates).flat(1),ye=On.LatLng.fromPoint(n.center());return{type:"Feature",id:n.id.toString(),geometry:{type:"Polygon",coordinates:[ue]},properties:{level:n.level,token:On.cellid.toToken(n.id),centerLng:tl.angle.degrees(ye.lng),centerLat:tl.angle.degrees(ye.lat)}}})});function ub(){let g,s,a;const[n,c]=Oo(0),[f,m]=Oo(30),[h,P]=Oo(200),[L,V]=Oo(""),[B,U]=Oo(""),[ue,ye]=Oo(0),[Se,Ne]=Oo("");let Re;const it=()=>{const Ke=s.getSnapshot(),_t=Yg(a,Ke);Ue(_t)},Ue=Ke=>{g.getSource("covering").setData(Qg(Ke)),U([...Ke].map(_t=>On.cellid.toToken(_t)).join(", ")),ye(Ke.length)},ut=()=>{let Ke=On.Rect.emptyRect();if(s.clear(),!!Re)try{const _t=new On.CellUnion(...Re.value.split(", ").map(kt=>{const Rt=On.cellid.fromToken(kt),Ye=On.Cell.fromCellID(Rt);return Ke=Ke.union(Ye.rectBound()),Rt}));Ue(_t),g.fitBounds([[tl.angle.degrees(Ke.lng.lo),tl.angle.degrees(Ke.lat.lo)],[tl.angle.degrees(Ke.lng.hi),tl.angle.degrees(Ke.lat.hi)]],{padding:50}),Ne("")}catch(_t){Ne(_t.message)}};iy(()=>{a=new Hy.RegionCoverer({minLevel:n(),maxLevel:f(),maxCells:h()}),s&&it()});const nt=()=>{s.clear(),it(),bt("rectangle")},bt=Ke=>{s&&(s.setMode(Ke),V(Ke))};return e0(()=>{let Ke="white",_t="darkslategray";window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches&&(Ke="black",_t="yellow"),su.setRTLTextPlugin("https://unpkg.com/@mapbox/mapbox-gl-rtl-text@0.2.3/mapbox-gl-rtl-text.min.js",!0),g=new su.Map({container:"map",style:`https://api.protomaps.com/styles/v3/${Ke}.json?key=5b9c1298c2eef269`,maplibreLogo:!0});const kt={styles:{outlineWidth:0}};s=new tb({adapter:new w1({map:g,maplibregl:su}),modes:[new $1(kt),new q1({modeName:"render",styles:{}}),new j1(kt)]}),s.on("finish",()=>{bt("render"),it()}),s.start(),bt("rectangle"),g.on("load",()=>{g.addSource("covering",{type:"geojson",data:{type:"MultiPolygon",coordinates:[]}}),g.addLayer({id:"covering-fill",type:"fill",source:"covering",paint:{"fill-color":_t,"fill-opacity":["case",["boolean",["feature-state","hover"],!1],.7,.5]}}),g.addLayer({id:"covering-stroke",type:"line",source:"covering",paint:{"line-color":_t}}),g.addLayer({id:"covering-label",type:"symbol",source:"covering",filter:["<=",["get","level"],["+",["zoom"],3]],layout:{"text-font":["Noto Sans Medium"],"text-field":["get","level"],"text-size":10},paint:{"text-color":_t}});let Ye;g.on("mousemove","covering-fill",ct=>{ct.features&&ct.features.length>0&&(Ye&&g.setFeatureState({source:"covering",id:Ye},{hover:!1}),Ye=ct.features[0].id,g.setFeatureState({source:"covering",id:Ye},{hover:!0})),g.getCanvas().style.cursor=L()==="render"?"pointer":""}),g.on("mouseleave","covering-fill",()=>{g.getCanvas().style.cursor=""}),g.on("click","covering-fill",ct=>{if(!ct||!ct.features||ct.features.length===0)return;const wt=ct.features[0].properties,qt={lng:wt.centerLng,lat:wt.centerLat};for(;Math.abs(ct.lngLat.lng-qt.lng)>180;)qt.lng+=ct.lngLat.lng>qt.lng?360:-360;new su.Popup({closeButton:!1}).setLngLat(qt).setHTML(`
+
Level ${wt.level}
+
${wt.token}
+
`).addTo(g)});const St=sb();St&&St.length&&g.getSource("covering").setData(Qg(St))});var Rt={};window.onkeydown=window.onkeyup=async Ye=>{if(Rt[Ye.code]=Ye.type=="keydown",Ye.type=="keydown"&&["ControlLeft","ShiftLeft","KeyV"].every(St=>Rt[St]))try{if(console.error("secret keyboard shortcut activated!!"),!(navigator!=null&&navigator.clipboard))throw new Error("clipboard API unavailable");const St=await navigator.clipboard.readText(),ct=JSON.parse(St);if((ct==null?void 0:ct.type)!=="Feature")throw new Error("invalid feature");const wt=Yg(a,[ct]);Ue(wt)}catch(St){console.error("clipboard paste failed"),console.error(St)}}}),(()=>{var Ke=ib(),_t=Ke.firstChild,kt=_t.firstChild,Rt=kt.firstChild,Ye=Rt.firstChild,St=Ye.nextSibling,ct=St.nextSibling,wt=Rt.nextSibling,qt=wt.firstChild,Ti=qt.nextSibling,fi=wt.nextSibling,nr=fi.firstChild,Zi=nr.nextSibling,yr=fi.nextSibling,Ai=yr.firstChild,Gi=Ai.nextSibling,zr=yr.nextSibling,kr=zr.nextSibling,sr=kr.firstChild;Ye.$$click=()=>bt("rectangle"),St.$$click=()=>bt("polygon"),ct.$$click=nt,Ti.$$input=Zt=>{P(+Zt.target.value||1)},Zi.$$input=Zt=>{c(+Zt.target.value||1)},Gi.$$input=Zt=>{m(+Zt.target.value||1)};var dn=Re;return typeof dn=="function"?h0(dn,zr):Re=zr,fu(kr,(()=>{var Zt=Qv(()=>!!Se());return()=>Zt()?(()=>{var ci=rb();return fu(ci,Se),ci})():(()=>{var ci=nb(),_r=ci.firstChild;return fu(ci,ue,_r),ci})()})(),sr),sr.$$click=ut,Hs(Zt=>{var ci=L()==="rectangle"?"active":"",_r=L()==="polygon"?"active":"";return ci!==Zt.e&&eg(Ye,Zt.e=ci),_r!==Zt.t&&eg(St,Zt.t=_r),Zt},{e:void 0,t:void 0}),Hs(()=>Ti.value=h()),Hs(()=>Zi.value=n()),Hs(()=>Gi.value=f()),Hs(()=>zr.value=B()),Ke})()}l0(["click","input"]);const db=document.getElementById("root");a0(()=>s0(ub,{}),db); diff --git a/assets/index-DOacLtKB.css b/assets/index-DOacLtKB.css new file mode 100644 index 0000000..ee85e40 --- /dev/null +++ b/assets/index-DOacLtKB.css @@ -0,0 +1 @@ +:root{font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;color-scheme:light dark;color:#ffffffde;background-color:#242424;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}a{font-weight:500;color:#646cff;text-decoration:inherit}a:hover{color:#535bf2}body{margin:0}h1{font-size:3.2em;line-height:1.1}button{border-radius:8px;border:1px solid transparent;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;background-color:#1a1a1a;cursor:pointer;transition:border-color .25s}button:hover{border-color:#646cff}button:focus,button:focus-visible{outline:4px auto -webkit-focus-ring-color}@media (prefers-color-scheme: light){:root{color:#213547;background-color:#fff}a:hover{color:#747bff}button{background-color:#f9f9f9}}.maplibregl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgb(0 0 0/0)}.maplibregl-canvas{left:0;position:absolute;top:0}.maplibregl-map:fullscreen{height:100%;width:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px #0000001a}@media (forced-colors:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (forced-colors:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}.maplibregl-ctrl button:not(:disabled):hover{background-color:#0000000d}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%23333' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%2333b5e5' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23aaa' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23999' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23666' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}}@keyframes maplibregl-spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (forced-colors:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}.maplibregl-ctrl.maplibregl-ctrl-attrib{background-color:#ffffff80;margin:0;padding:0 5px}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{background-color:#fff;border-radius:12px;box-sizing:content-box;color:#000;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{background-color:#ffffff80;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E");border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;list-style:none}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker{display:none}.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:#0000000d}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (forced-colors:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23fff' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}@media screen and (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}.maplibregl-ctrl-attrib a{color:#000000bf;text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:#ffffffbf;border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px}.maplibregl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{flex-direction:column}.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{flex-direction:column-reverse}.maplibregl-popup-anchor-left{flex-direction:row}.maplibregl-popup-anchor-right{flex-direction:row-reverse}.maplibregl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.maplibregl-popup-anchor-left .maplibregl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.maplibregl-popup-anchor-right .maplibregl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.maplibregl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.maplibregl-popup-close-button:hover{background-color:#0000000d}.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px #0000001a;padding:15px 10px;pointer-events:auto;position:relative}.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.maplibregl-popup-track-pointer{display:none}.maplibregl-popup-track-pointer *{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{left:0;position:absolute;top:0;transition:opacity .2s;will-change:transform}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.maplibregl-user-location-dot:before{animation:maplibregl-user-location-dot-pulse 2s infinite;content:"";position:absolute}.maplibregl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px #00000059;box-sizing:border-box;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px}@keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}.maplibregl-cooperative-gesture-screen{align-items:center;background:#0006;color:#fff;display:flex;font-size:1.4em;top:0;right:0;bottom:0;left:0;justify-content:center;line-height:1.2;opacity:0;padding:1rem;pointer-events:none;position:absolute;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(width <= 480px){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999}body{height:100vh}#root{margin:0 auto;width:100%;height:100vh}h1{font-size:24px;margin:0}.container{display:flex;height:100vh}.controls{padding-top:10px}.sidebar{width:25%;min-width:250px;padding:10px}#map{height:100vh;width:75%}.faq{font-size:12px}.input{display:flex}.label{min-width:100px;width:30%;padding:10px}.text{padding:10px;border-top:solid 1px #f1f1f1;margin-top:10px}.input input,.input select{width:70%;text-align:center;margin-right:10px;box-sizing:border-box;border:solid 1px #d0d0d0;height:30px;display:flex;align-self:center}.draw{display:flex;justify-content:space-around;margin-bottom:20px}button.active{background-color:#2f4f4f;color:#fff}textarea{padding:0;border:none;width:100%;margin-top:10px}.textarealabel{display:flex;justify-content:space-between;align-items:center;font-size:.7rem}@media (prefers-color-scheme: dark){button.active{background-color:#ff0;color:#000}.maplibregl-popup-content{background:#242424}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{border-top-color:#242424}.maplibregl-popup-anchor-top .maplibregl-popup-tip{border-bottom-color:#242424}}@media screen and (max-width: 768px){.container{display:flex;flex-direction:column;flex-flow:column-reverse}#map{width:100%;height:50vh}.sidebar{width:calc(100% - 20px)}.faq{font-size:10px}.text{height:20vh;overflow:scroll}} diff --git a/index.html b/index.html new file mode 100644 index 0000000..a500426 --- /dev/null +++ b/index.html @@ -0,0 +1,14 @@ + + + + + + + s2js Region Coverer + + + + +
+ +