<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>GPX Renderer</title>
  <style>
    body {
      margin: 0;
      padding: 0;
    }
    #map {
      width: 800px;
      height: 600px;
    }
  </style>
  <script type="module" crossorigin>(function(){const Ft=document.createElement("link").relList;if(Ft&&Ft.supports&&Ft.supports("modulepreload"))return;for(const Ut of document.querySelectorAll('link[rel="modulepreload"]'))Bt(Ut);new MutationObserver(Ut=>{for(const ee of Ut)if(ee.type==="childList")for(const A of ee.addedNodes)A.tagName==="LINK"&&A.rel==="modulepreload"&&Bt(A)}).observe(document,{childList:!0,subtree:!0});function Gt(Ut){const ee={};return Ut.integrity&&(ee.integrity=Ut.integrity),Ut.referrerPolicy&&(ee.referrerPolicy=Ut.referrerPolicy),Ut.crossOrigin==="use-credentials"?ee.credentials="include":Ut.crossOrigin==="anonymous"?ee.credentials="omit":ee.credentials="same-origin",ee}function Bt(Ut){if(Ut.ep)return;Ut.ep=!0;const ee=Gt(Ut);fetch(Ut.href,ee)}})();var Tg=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Sg(kt){return kt&&kt.__esModule&&Object.prototype.hasOwnProperty.call(kt,"default")?kt.default:kt}var Qp={exports:{}};/**
 * MapLibre GL JS
 * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.13.0/LICENSE.txt
 */(function(kt,Ft){(function(Gt,Bt){kt.exports=Bt()})(Tg,function(){var Gt={},Bt={};function Ut(A,h,Pt){if(Bt[A]=Pt,A==="index"){var ke="var sharedModule = {}; ("+Bt.shared+")(sharedModule); ("+Bt.worker+")(sharedModule);",Ve={};return Bt.shared(Ve),Bt.index(Gt,Ve),typeof window<"u"&&Gt.setWorkerUrl(window.URL.createObjectURL(new Blob([ke],{type:"text/javascript"}))),Gt}}Ut("shared",["exports"],function(A){function h(r,t,i,s){return new(i||(i=Promise))(function(a,l){function u(y){try{g(s.next(y))}catch(v){l(v)}}function f(y){try{g(s.throw(y))}catch(v){l(v)}}function g(y){var v;y.done?a(y.value):(v=y.value,v instanceof i?v:new i(function(w){w(v)})).then(u,f)}g((s=s.apply(r,t||[])).next())})}function Pt(r,t){this.x=r,this.y=t}function ke(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Ve,Ki;typeof SuppressedError=="function"&&SuppressedError,Pt.prototype={clone(){return new Pt(this.x,this.y)},add(r){return this.clone()._add(r)},sub(r){return this.clone()._sub(r)},multByPoint(r){return this.clone()._multByPoint(r)},divByPoint(r){return this.clone()._divByPoint(r)},mult(r){return this.clone()._mult(r)},div(r){return this.clone()._div(r)},rotate(r){return this.clone()._rotate(r)},rotateAround(r,t){return this.clone()._rotateAround(r,t)},matMult(r){return this.clone()._matMult(r)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(r){return this.x===r.x&&this.y===r.y},dist(r){return Math.sqrt(this.distSqr(r))},distSqr(r){const t=r.x-this.x,i=r.y-this.y;return t*t+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(r){return Math.atan2(this.y-r.y,this.x-r.x)},angleWith(r){return this.angleWithSep(r.x,r.y)},angleWithSep(r,t){return Math.atan2(this.x*t-this.y*r,this.x*r+this.y*t)},_matMult(r){const t=r[2]*this.x+r[3]*this.y;return this.x=r[0]*this.x+r[1]*this.y,this.y=t,this},_add(r){return this.x+=r.x,this.y+=r.y,this},_sub(r){return this.x-=r.x,this.y-=r.y,this},_mult(r){return this.x*=r,this.y*=r,this},_div(r){return this.x/=r,this.y/=r,this},_multByPoint(r){return this.x*=r.x,this.y*=r.y,this},_divByPoint(r){return this.x/=r.x,this.y/=r.y,this},_unit(){return this._div(this.mag()),this},_perp(){const r=this.y;return this.y=this.x,this.x=-r,this},_rotate(r){const t=Math.cos(r),i=Math.sin(r),s=i*this.x+t*this.y;return this.x=t*this.x-i*this.y,this.y=s,this},_rotateAround(r,t){const i=Math.cos(r),s=Math.sin(r),a=t.y+s*(this.x-t.x)+i*(this.y-t.y);return this.x=t.x+i*(this.x-t.x)-s*(this.y-t.y),this.y=a,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Pt},Pt.convert=function(r){if(r instanceof Pt)return r;if(Array.isArray(r))return new Pt(+r[0],+r[1]);if(r.x!==void 0&&r.y!==void 0)return new Pt(+r.x,+r.y);throw new Error("Expected [x, y] or {x, y} point format")};var Nr=function(){if(Ki)return Ve;function r(t,i,s,a){this.cx=3*t,this.bx=3*(s-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(a-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=i,this.p2x=s,this.p2y=a}return Ki=1,Ve=r,r.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,i){if(i===void 0&&(i=1e-6),t<0)return 0;if(t>1)return 1;for(var s=t,a=0;a<8;a++){var l=this.sampleCurveX(s)-t;if(Math.abs(l)<i)return s;var u=this.sampleCurveDerivativeX(s);if(Math.abs(u)<1e-6)break;s-=l/u}var f=0,g=1;for(s=t,a=0;a<20&&(l=this.sampleCurveX(s),!(Math.abs(l-t)<i));a++)t>l?f=s:g=s,s=.5*(g-f)+f;return s},solve:function(t,i){return this.sampleCurveY(this.solveCurveX(t,i))}},Ve}(),Qe=ke(Nr);let jr,ne;function dt(){return jr==null&&(jr=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),jr}function hn(){if(ne==null&&(ne=!1,dt())){const t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let s=0;s<5*5;s++){const a=4*s;t.fillStyle=`rgb(${a},${a+1},${a+2})`,t.fillRect(s%5,Math.floor(s/5),1,1)}const i=t.getImageData(0,0,5,5).data;for(let s=0;s<5*5*4;s++)if(s%4!=3&&i[s]!==s){ne=!0;break}}}return ne||!1}var Re=1e-6,Pe=typeof Float32Array<"u"?Float32Array:Array;function Un(){var r=new Pe(9);return Pe!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function Gn(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function Ss(){var r=new Pe(3);return Pe!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function Ci(r){var t=r[0],i=r[1],s=r[2];return Math.sqrt(t*t+i*i+s*s)}function va(r,t,i){var s=new Pe(3);return s[0]=r,s[1]=t,s[2]=i,s}function Pr(r,t,i){return r[0]=t[0]+i[0],r[1]=t[1]+i[1],r[2]=t[2]+i[2],r}function Ur(r,t,i){return r[0]=t[0]*i,r[1]=t[1]*i,r[2]=t[2]*i,r}function dn(r,t,i){var s=t[0],a=t[1],l=t[2],u=i[0],f=i[1],g=i[2];return r[0]=a*g-l*f,r[1]=l*u-s*g,r[2]=s*f-a*u,r}var Gr,pn=Ci;function Ps(r,t,i){var s=t[0],a=t[1],l=t[2],u=t[3];return r[0]=i[0]*s+i[4]*a+i[8]*l+i[12]*u,r[1]=i[1]*s+i[5]*a+i[9]*l+i[13]*u,r[2]=i[2]*s+i[6]*a+i[10]*l+i[14]*u,r[3]=i[3]*s+i[7]*a+i[11]*l+i[15]*u,r}function Ms(){var r=new Pe(4);return Pe!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function Is(r,t,i,s){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"zyx",l=Math.PI/360;t*=l,s*=l,i*=l;var u=Math.sin(t),f=Math.cos(t),g=Math.sin(i),y=Math.cos(i),v=Math.sin(s),w=Math.cos(s);switch(a){case"xyz":r[0]=u*y*w+f*g*v,r[1]=f*g*w-u*y*v,r[2]=f*y*v+u*g*w,r[3]=f*y*w-u*g*v;break;case"xzy":r[0]=u*y*w-f*g*v,r[1]=f*g*w-u*y*v,r[2]=f*y*v+u*g*w,r[3]=f*y*w+u*g*v;break;case"yxz":r[0]=u*y*w+f*g*v,r[1]=f*g*w-u*y*v,r[2]=f*y*v-u*g*w,r[3]=f*y*w+u*g*v;break;case"yzx":r[0]=u*y*w+f*g*v,r[1]=f*g*w+u*y*v,r[2]=f*y*v-u*g*w,r[3]=f*y*w-u*g*v;break;case"zxy":r[0]=u*y*w-f*g*v,r[1]=f*g*w+u*y*v,r[2]=f*y*v+u*g*w,r[3]=f*y*w-u*g*v;break;case"zyx":r[0]=u*y*w-f*g*v,r[1]=f*g*w+u*y*v,r[2]=f*y*v-u*g*w,r[3]=f*y*w+u*g*v;break;default:throw new Error("Unknown angle order "+a)}return r}function Ji(){var r=new Pe(2);return Pe!=Float32Array&&(r[0]=0,r[1]=0),r}function ba(r,t){var i=new Pe(2);return i[0]=r,i[1]=t,i}Ss(),Gr=new Pe(4),Pe!=Float32Array&&(Gr[0]=0,Gr[1]=0,Gr[2]=0,Gr[3]=0),Ss(),va(1,0,0),va(0,1,0),Ms(),Ms(),Un(),Ji();const le=8192;function Zn(r,t,i){return t*(le/(r.tileSize*Math.pow(2,i-r.tileID.overscaledZ)))}function hr(r,t){return(r%t+t)%t}function fn(r,t,i){return r*(1-i)+t*i}function wa(r){if(r<=0)return 0;if(r>=1)return 1;const t=r*r,i=t*r;return 4*(r<.5?i:3*(r-t)+i-.75)}function Zr(r,t,i,s){const a=new Qe(r,t,i,s);return l=>a.solve(l)}const $r=Zr(.25,.1,.25,1);function wi(r,t,i){return Math.min(i,Math.max(t,r))}function Qi(r,t,i){const s=i-t,a=((r-t)%s+s)%s+t;return a===t?i:a}function di(r,...t){for(const i of t)for(const s in i)r[s]=i[s];return r}let $n=1;function qr(r,t,i){const s={};for(const a in r)s[a]=t.call(this,r[a],a,r);return s}function mn(r,t,i){const s={};for(const a in r)t.call(this,r[a],a,r)&&(s[a]=r[a]);return s}function Zi(r){return Array.isArray(r)?r.map(Zi):typeof r=="object"&&r?qr(r,Zi):r}const Es={};function Me(r){Es[r]||(typeof console<"u"&&console.warn(r),Es[r]=!0)}function tr(r,t,i){return(i.y-r.y)*(t.x-r.x)>(t.y-r.y)*(i.x-r.x)}function dr(r){return typeof WorkerGlobalScope<"u"&&r!==void 0&&r instanceof WorkerGlobalScope}let Ie=null;function pr(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap}const fr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function qn(r,t,i,s,a){return h(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const l=new VideoFrame(r,{timestamp:0});try{const u=l?.format;if(!u||!u.startsWith("BGR")&&!u.startsWith("RGB"))throw new Error(`Unrecognized format ${u}`);const f=u.startsWith("BGR"),g=new Uint8ClampedArray(s*a*4);if(yield l.copyTo(g,function(y,v,w,S,P){const M=4*Math.max(-v,0),C=(Math.max(0,w)-w)*S*4+M,z=4*S,F=Math.max(0,v),Z=Math.max(0,w);return{rect:{x:F,y:Z,width:Math.min(y.width,v+S)-F,height:Math.min(y.height,w+P)-Z},layout:[{offset:C,stride:z}]}}(r,t,i,s,a)),f)for(let y=0;y<g.length;y+=4){const v=g[y];g[y]=g[y+2],g[y+2]=v}return g}finally{l.close()}})}let Wr,mr;function Hr(r,t,i,s){return r.addEventListener(t,i,s),{unsubscribe:()=>{r.removeEventListener(t,i,s)}}}function gn(r){return r*Math.PI/180}function Ai(r){return r/Math.PI*180}const Cs={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},As={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},_n="AbortError";function Wn(){return new Error(_n)}const Xr={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Hn(r){return Xr.REGISTERED_PROTOCOLS[r.substring(0,r.indexOf("://"))]}const yn="global-dispatcher";class er extends Error{constructor(t,i,s,a){super(`AJAXError: ${i} (${t}): ${s}`),this.status=t,this.statusText=i,this.url=s,this.body=a}}const Oi=()=>dr(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,tt=function(r,t){if(/:\/\//.test(r.url)&&!/^https?:|^file:/.test(r.url)){const s=Hn(r.url);if(s)return s(r,t);if(dr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,targetMapId:yn},t)}if(!(/^file:/.test(i=r.url)||/^file:/.test(Oi())&&!/^\w+:/.test(i))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(s,a){return h(this,void 0,void 0,function*(){const l=new Request(s.url,{method:s.method||"GET",body:s.body,credentials:s.credentials,headers:s.headers,cache:s.cache,referrer:Oi(),signal:a.signal});let u,f;s.type!=="json"||l.headers.has("Accept")||l.headers.set("Accept","application/json");try{u=yield fetch(l)}catch(y){throw new er(0,y.message,s.url,new Blob)}if(!u.ok){const y=yield u.blob();throw new er(u.status,u.statusText,s.url,y)}f=s.type==="arrayBuffer"||s.type==="image"?u.arrayBuffer():s.type==="json"?u.json():u.text();const g=yield f;if(a.signal.aborted)throw Wn();return{data:g,cacheControl:u.headers.get("Cache-Control"),expires:u.headers.get("Expires")}})}(r,t);if(dr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,mustQueue:!0,targetMapId:yn},t)}var i;return function(s,a){return new Promise((l,u)=>{var f;const g=new XMLHttpRequest;g.open(s.method||"GET",s.url,!0),s.type!=="arrayBuffer"&&s.type!=="image"||(g.responseType="arraybuffer");for(const y in s.headers)g.setRequestHeader(y,s.headers[y]);s.type==="json"&&(g.responseType="text",!((f=s.headers)===null||f===void 0)&&f.Accept||g.setRequestHeader("Accept","application/json")),g.withCredentials=s.credentials==="include",g.onerror=()=>{u(new Error(g.statusText))},g.onload=()=>{if(!a.signal.aborted)if((g.status>=200&&g.status<300||g.status===0)&&g.response!==null){let y=g.response;if(s.type==="json")try{y=JSON.parse(g.response)}catch(v){return void u(v)}l({data:y,cacheControl:g.getResponseHeader("Cache-Control"),expires:g.getResponseHeader("Expires")})}else{const y=new Blob([g.response],{type:g.getResponseHeader("Content-Type")});u(new er(g.status,g.statusText,s.url,y))}},a.signal.addEventListener("abort",()=>{g.abort(),u(Wn())}),g.send(s.body)})}(r,t)};function k(r){if(!r||r.indexOf("://")<=0||r.indexOf("data:image/")===0||r.indexOf("blob:")===0)return!0;const t=new URL(r),i=window.location;return t.protocol===i.protocol&&t.host===i.host}function R(r,t,i){i[r]&&i[r].indexOf(t)!==-1||(i[r]=i[r]||[],i[r].push(t))}function B(r,t,i){if(i&&i[r]){const s=i[r].indexOf(t);s!==-1&&i[r].splice(s,1)}}class W{constructor(t,i={}){di(this,i),this.type=t}}class X extends W{constructor(t,i={}){super("error",di({error:t},i))}}class nt{on(t,i){return this._listeners=this._listeners||{},R(t,i,this._listeners),{unsubscribe:()=>{this.off(t,i)}}}off(t,i){return B(t,i,this._listeners),B(t,i,this._oneTimeListeners),this}once(t,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},R(t,i,this._oneTimeListeners),this):new Promise(s=>this.once(t,s))}fire(t,i){typeof t=="string"&&(t=new W(t,i||{}));const s=t.type;if(this.listens(s)){t.target=this;const a=this._listeners&&this._listeners[s]?this._listeners[s].slice():[];for(const f of a)f.call(this,t);const l=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(const f of l)B(s,f,this._oneTimeListeners),f.call(this,t);const u=this._eventedParent;u&&(di(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),u.fire(t))}else t instanceof X&&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,i){return this._eventedParent=t,this._eventedParentData=i,this}}var U={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"array",value:"fontFaces"},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},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{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:{},"color-relief":{},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_color-relief","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"}},"layout_color-relief":{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:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","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","feature"]},"property-type":"cross-faded-data-driven"},"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:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,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:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",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"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},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 rt=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function ut(r,t){const i={};for(const s in r)s!=="ref"&&(i[s]=r[s]);return rt.forEach(s=>{s in t&&(i[s]=t[s])}),i}function ht(r,t){if(Array.isArray(r)){if(!Array.isArray(t)||r.length!==t.length)return!1;for(let i=0;i<r.length;i++)if(!ht(r[i],t[i]))return!1;return!0}if(typeof r=="object"&&r!==null&&t!==null){if(typeof t!="object"||Object.keys(r).length!==Object.keys(t).length)return!1;for(const i in r)if(!ht(r[i],t[i]))return!1;return!0}return r===t}function pt(r,t){r.push(t)}function Et(r,t,i){pt(i,{command:"addSource",args:[r,t[r]]})}function Ot(r,t,i){pt(t,{command:"removeSource",args:[r]}),i[r]=!0}function Wt(r,t,i,s){Ot(r,i,s),Et(r,t,i)}function Le(r,t,i){let s;for(s in r[i])if(Object.prototype.hasOwnProperty.call(r[i],s)&&s!=="data"&&!ht(r[i][s],t[i][s]))return!1;for(s in t[i])if(Object.prototype.hasOwnProperty.call(t[i],s)&&s!=="data"&&!ht(r[i][s],t[i][s]))return!1;return!0}function Kt(r,t,i,s,a,l){r=r||{},t=t||{};for(const u in r)Object.prototype.hasOwnProperty.call(r,u)&&(ht(r[u],t[u])||i.push({command:l,args:[s,u,t[u],a]}));for(const u in t)Object.prototype.hasOwnProperty.call(t,u)&&!Object.prototype.hasOwnProperty.call(r,u)&&(ht(r[u],t[u])||i.push({command:l,args:[s,u,t[u],a]}))}function ae(r){return r.id}function pe(r,t){return r[t.id]=t,r}class xt{constructor(t,i,s,a){this.message=(t?`${t}: `:"")+s,a&&(this.identifier=a),i!=null&&i.__line__&&(this.line=i.__line__)}}function ve(r,...t){for(const i of t)for(const s in i)r[s]=i[s];return r}class fe extends Error{constructor(t,i){super(i),this.message=i,this.key=t}}class qe{constructor(t,i=[]){this.parent=t,this.bindings={};for(const[s,a]of i)this.bindings[s]=a}concat(t){return new qe(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const me={kind:"null"},bt={kind:"number"},Dt={kind:"string"},jt={kind:"boolean"},Di={kind:"color"},xn={kind:"projectionDefinition"},ii={kind:"object"},Zt={kind:"value"},Mr={kind:"collator"},Xn={kind:"formatted"},Yn={kind:"padding"},ir={kind:"colorArray"},vn={kind:"numberArray"},Kn={kind:"resolvedImage"},Jn={kind:"variableAnchorOffsetCollection"};function Vi(r,t){return{kind:"array",itemType:r,N:t}}function ge(r){if(r.kind==="array"){const t=ge(r.itemType);return typeof r.N=="number"?`array<${t}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${t}>`}return r.kind}const Pu=[me,bt,Dt,jt,Di,xn,Xn,ii,Vi(Zt),Yn,vn,ir,Kn,Jn];function gr(r,t){if(t.kind==="error")return null;if(r.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!gr(r.itemType,t.itemType))&&(typeof r.N!="number"||r.N===t.N))return null}else{if(r.kind===t.kind)return null;if(r.kind==="value"){for(const i of Pu)if(!gr(i,t))return null}}return`Expected ${ge(r)} but found ${ge(t)} instead.`}function Ds(r,t){return t.some(i=>i.kind===r.kind)}function Ee(r,t){return t.some(i=>i==="null"?r===null:i==="array"?Array.isArray(r):i==="object"?r&&!Array.isArray(r)&&typeof r=="object":i===typeof r)}function Yr(r,t){return r.kind==="array"&&t.kind==="array"?r.itemType.kind===t.itemType.kind&&typeof r.N=="number":r.kind===t.kind}const Eo=.96422,Qn=.82521,Co=4/29,ts=6/29,Hl=3*ts*ts,Xl=ts*ts*ts,Mu=Math.PI/180,Yl=180/Math.PI;function Kl(r){return(r%=360)<0&&(r+=360),r}function Jl([r,t,i,s]){let a,l;const u=Do((.2225045*(r=Ao(r))+.7168786*(t=Ao(t))+.0606169*(i=Ao(i)))/1);r===t&&t===i?a=l=u:(a=Do((.4360747*r+.3850649*t+.1430804*i)/Eo),l=Do((.0139322*r+.0971045*t+.7141733*i)/Qn));const f=116*u-16;return[f<0?0:f,500*(a-u),200*(u-l),s]}function Ao(r){return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function Do(r){return r>Xl?Math.pow(r,1/3):r/Hl+Co}function Ql([r,t,i,s]){let a=(r+16)/116,l=isNaN(t)?a:a+t/500,u=isNaN(i)?a:a-i/200;return a=1*ko(a),l=Eo*ko(l),u=Qn*ko(u),[zo(3.1338561*l-1.6168667*a-.4906146*u),zo(-.9787684*l+1.9161415*a+.033454*u),zo(.0719453*l-.2289914*a+1.4052427*u),s]}function zo(r){return(r=r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055)<0?0:r>1?1:r}function ko(r){return r>ts?r*r*r:Hl*(r-Co)}const tc=Object.hasOwn||function(r,t){return Object.prototype.hasOwnProperty.call(r,t)};function Ir(r,t){return tc(r,t)?r[t]:void 0}function Ta(r){return parseInt(r.padEnd(2,r),16)/255}function ec(r,t){return _r(t?r/100:r,0,1)}function _r(r,t,i){return Math.min(Math.max(t,r),i)}function ic(r){return!r.some(Number.isNaN)}const Iu={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]};function Kr(r,t,i){return r+i*(t-r)}function bn(r,t,i){return r.map((s,a)=>Kr(s,t[a],i))}class Jt{constructor(t,i,s,a=1,l=!0){this.r=t,this.g=i,this.b=s,this.a=a,l||(this.r*=a,this.g*=a,this.b*=a,a||this.overwriteGetter("rgb",[t,i,s,a]))}static parse(t){if(t instanceof Jt)return t;if(typeof t!="string")return;const i=function(s){if((s=s.toLowerCase().trim())==="transparent")return[0,0,0,0];const a=Ir(Iu,s);if(a){const[u,f,g]=a;return[u/255,f/255,g/255,1]}if(s.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(s)){const u=s.length<6?1:2;let f=1;return[Ta(s.slice(f,f+=u)),Ta(s.slice(f,f+=u)),Ta(s.slice(f,f+=u)),Ta(s.slice(f,f+u)||"ff")]}if(s.startsWith("rgb")){const u=s.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(u){const[f,g,y,v,w,S,P,M,C,z,F,Z]=u,O=[v||" ",P||" ",z].join("");if(O==="  "||O==="  /"||O===",,"||O===",,,"){const j=[y,S,C].join(""),Q=j==="%%%"?100:j===""?255:0;if(Q){const et=[_r(+g/Q,0,1),_r(+w/Q,0,1),_r(+M/Q,0,1),F?ec(+F,Z):1];if(ic(et))return et}}return}}const l=s.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(l){const[u,f,g,y,v,w,S,P,M]=l,C=[g||" ",v||" ",S].join("");if(C==="  "||C==="  /"||C===",,"||C===",,,"){const z=[+f,_r(+y,0,100),_r(+w,0,100),P?ec(+P,M):1];if(ic(z))return function([F,Z,O,j]){function Q(et){const ot=(et+F/30)%12,_t=Z*Math.min(O,1-O);return O-_t*Math.max(-1,Math.min(ot-3,9-ot,1))}return F=Kl(F),Z/=100,O/=100,[Q(0),Q(8),Q(4),j]}(z)}}}(t);return i?new Jt(...i,!1):void 0}get rgb(){const{r:t,g:i,b:s,a}=this,l=a||1/0;return this.overwriteGetter("rgb",[t/l,i/l,s/l,a])}get hcl(){return this.overwriteGetter("hcl",function(t){const[i,s,a,l]=Jl(t),u=Math.sqrt(s*s+a*a);return[Math.round(1e4*u)?Kl(Math.atan2(a,s)*Yl):NaN,u,i,l]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Jl(this.rgb))}overwriteGetter(t,i){return Object.defineProperty(this,t,{value:i}),i}toString(){const[t,i,s,a]=this.rgb;return`rgba(${[t,i,s].map(l=>Math.round(255*l)).join(",")},${a})`}static interpolate(t,i,s,a="rgb"){switch(a){case"rgb":{const[l,u,f,g]=bn(t.rgb,i.rgb,s);return new Jt(l,u,f,g,!1)}case"hcl":{const[l,u,f,g]=t.hcl,[y,v,w,S]=i.hcl;let P,M;if(isNaN(l)||isNaN(y))isNaN(l)?isNaN(y)?P=NaN:(P=y,f!==1&&f!==0||(M=v)):(P=l,w!==1&&w!==0||(M=u));else{let O=y-l;y>l&&O>180?O-=360:y<l&&l-y>180&&(O+=360),P=l+s*O}const[C,z,F,Z]=function([O,j,Q,et]){return O=isNaN(O)?0:O*Mu,Ql([Q,Math.cos(O)*j,Math.sin(O)*j,et])}([P,M??Kr(u,v,s),Kr(f,w,s),Kr(g,S,s)]);return new Jt(C,z,F,Z,!1)}case"lab":{const[l,u,f,g]=Ql(bn(t.lab,i.lab,s));return new Jt(l,u,f,g,!1)}}}}Jt.black=new Jt(0,0,0,1),Jt.white=new Jt(1,1,1,1),Jt.transparent=new Jt(0,0,0,0),Jt.red=new Jt(1,0,0,1);class $i{constructor(t,i,s){this.sensitivity=t?i?"variant":"case":i?"accent":"base",this.locale=s,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,i){return this.collator.compare(t,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const ie=["bottom","center","top"];class Jr{constructor(t,i,s,a,l,u){this.text=t,this.image=i,this.scale=s,this.fontStack=a,this.textColor=l,this.verticalAlign=u}}class We{constructor(t){this.sections=t}static fromString(t){return new We([new Jr(t,null,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 We?t:We.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}}class pi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof pi)return t;if(typeof t=="number")return new pi([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const i of t)if(typeof i!="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 pi(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,i,s){return new pi(bn(t.values,i.values,s))}}class fi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof fi)return t;if(typeof t=="number")return new fi([t]);if(Array.isArray(t)){for(const i of t)if(typeof i!="number")return;return new fi(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,i,s){return new fi(bn(t.values,i.values,s))}}class ti{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ti)return t;if(typeof t=="string"){const s=Jt.parse(t);return s?new ti([s]):void 0}if(!Array.isArray(t))return;const i=[];for(const s of t){if(typeof s!="string")return;const a=Jt.parse(s);if(!a)return;i.push(a)}return new ti(i)}toString(){return JSON.stringify(this.values)}static interpolate(t,i,s,a="rgb"){const l=[];if(t.values.length!=i.values.length)throw new Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${i.values.length}), cannot interpolate.`);for(let u=0;u<t.values.length;u++)l.push(Jt.interpolate(t.values[u],i.values[u],s,a));return new ti(l)}}class _e extends Error{constructor(t){super(t),this.name="RuntimeError"}toJSON(){return this.message}}const Sa=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Ti{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Ti)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let i=0;i<t.length;i+=2){const s=t[i],a=t[i+1];if(typeof s!="string"||!Sa.has(s)||!Array.isArray(a)||a.length!==2||typeof a[0]!="number"||typeof a[1]!="number")return}return new Ti(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,i,s){const a=t.values,l=i.values;if(a.length!==l.length)throw new _e(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${i.toString()}`);const u=[];for(let f=0;f<a.length;f+=2){if(a[f]!==l[f])throw new _e(`Cannot interpolate values containing mismatched anchors. from[${f}]: ${a[f]}, to[${f}]: ${l[f]}`);u.push(a[f]);const[g,y]=a[f+1],[v,w]=l[f+1];u.push([Kr(g,v,s),Kr(y,w,s)])}return new Ti(u)}}class zi{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new zi({name:t,available:!1}):null}}class mi{constructor(t,i,s){this.from=t,this.to=i,this.transition=s}static interpolate(t,i,s){return new mi(t,i,s)}static parse(t){return t instanceof mi?t:Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"?new mi(t[0],t[1],t[2]):typeof t=="object"&&typeof t.from=="string"&&typeof t.to=="string"&&typeof t.transition=="number"?new mi(t.from,t.to,t.transition):typeof t=="string"?new mi(t,t,1):void 0}}function rc(r,t,i,s){return typeof r=="number"&&r>=0&&r<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof i=="number"&&i>=0&&i<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[r,t,i,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[r,t,i,s]:[r,t,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Qr(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof mi||r instanceof Jt||r instanceof $i||r instanceof We||r instanceof pi||r instanceof fi||r instanceof ti||r instanceof Ti||r instanceof zi)return!0;if(Array.isArray(r)){for(const t of r)if(!Qr(t))return!1;return!0}if(typeof r=="object"){for(const t in r)if(!Qr(r[t]))return!1;return!0}return!1}function be(r){if(r===null)return me;if(typeof r=="string")return Dt;if(typeof r=="boolean")return jt;if(typeof r=="number")return bt;if(r instanceof Jt)return Di;if(r instanceof mi)return xn;if(r instanceof $i)return Mr;if(r instanceof We)return Xn;if(r instanceof pi)return Yn;if(r instanceof fi)return vn;if(r instanceof ti)return ir;if(r instanceof Ti)return Jn;if(r instanceof zi)return Kn;if(Array.isArray(r)){const t=r.length;let i;for(const s of r){const a=be(s);if(i){if(i===a)continue;i=Zt;break}i=a}return Vi(i||Zt,t)}return ii}function es(r){const t=typeof r;return r===null?"":t==="string"||t==="number"||t==="boolean"?String(r):r instanceof Jt||r instanceof mi||r instanceof We||r instanceof pi||r instanceof fi||r instanceof ti||r instanceof Ti||r instanceof zi?r.toString():JSON.stringify(r)}class tn{constructor(t,i){this.type=t,this.value=i}static parse(t,i){if(t.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Qr(t[1]))return i.error("invalid value");const s=t[1];let a=be(s);const l=i.expectedType;return a.kind!=="array"||a.N!==0||!l||l.kind!=="array"||typeof l.N=="number"&&l.N!==0||(a=l),new tn(a,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const zs={string:Dt,number:bt,boolean:jt,object:ii};class ki{constructor(t,i){this.type=t,this.args=i}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let s,a=1;const l=t[0];if(l==="array"){let f,g;if(t.length>2){const y=t[1];if(typeof y!="string"||!(y in zs)||y==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);f=zs[y],a++}else f=Zt;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return i.error('The length argument to "array" must be a positive integer literal',2);g=t[2],a++}s=Vi(f,g)}else{if(!zs[l])throw new Error(`Types doesn't contain name = ${l}`);s=zs[l]}const u=[];for(;a<t.length;a++){const f=i.parse(t[a],a,Zt);if(!f)return null;u.push(f)}return new ki(s,u)}evaluate(t){for(let i=0;i<this.args.length;i++){const s=this.args[i].evaluate(t);if(!gr(this.type,be(s)))return s;if(i===this.args.length-1)throw new _e(`Expected value to be of type ${ge(this.type)}, but found ${ge(be(s))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const we={"to-boolean":jt,"to-color":Di,"to-number":bt,"to-string":Dt};class yr{constructor(t,i){this.type=t,this.args=i}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");const s=t[0];if(!we[s])throw new Error(`Can't parse ${s} as it is not part of the known types`);if((s==="to-boolean"||s==="to-string")&&t.length!==2)return i.error("Expected one argument.");const a=we[s],l=[];for(let u=1;u<t.length;u++){const f=i.parse(t[u],u,Zt);if(!f)return null;l.push(f)}return new yr(a,l)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let i,s;for(const a of this.args){if(i=a.evaluate(t),s=null,i instanceof Jt)return i;if(typeof i=="string"){const l=t.parseColor(i);if(l)return l}else if(Array.isArray(i)&&(s=i.length<3||i.length>4?`Invalid rgba value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:rc(i[0],i[1],i[2],i[3]),!s))return new Jt(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new _e(s||`Could not parse color from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"padding":{let i;for(const s of this.args){i=s.evaluate(t);const a=pi.parse(i);if(a)return a}throw new _e(`Could not parse padding from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"numberArray":{let i;for(const s of this.args){i=s.evaluate(t);const a=fi.parse(i);if(a)return a}throw new _e(`Could not parse numberArray from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"colorArray":{let i;for(const s of this.args){i=s.evaluate(t);const a=ti.parse(i);if(a)return a}throw new _e(`Could not parse colorArray from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"variableAnchorOffsetCollection":{let i;for(const s of this.args){i=s.evaluate(t);const a=Ti.parse(i);if(a)return a}throw new _e(`Could not parse variableAnchorOffsetCollection from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"number":{let i=null;for(const s of this.args){if(i=s.evaluate(t),i===null)return 0;const a=Number(i);if(!isNaN(a))return a}throw new _e(`Could not convert ${JSON.stringify(i)} to number.`)}case"formatted":return We.fromString(es(this.args[0].evaluate(t)));case"resolvedImage":return zi.fromString(es(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return es(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const se=["Unknown","Point","LineString","Polygon"];class Xt{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,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"?se[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 i=this._parseColorCache.get(t);return i||(i=Jt.parse(t),this._parseColorCache.set(t,i)),i}}class is{constructor(t,i,s=[],a,l=new qe,u=[]){this.registry=t,this.path=s,this.key=s.map(f=>`[${f}]`).join(""),this.scope=l,this.errors=u,this.expectedType=a,this._isConstant=i}parse(t,i,s,a,l={}){return i?this.concat(i,s,a)._parse(t,l):this._parse(t,l)}_parse(t,i){function s(a,l,u){return u==="assert"?new ki(l,[a]):u==="coerce"?new yr(l,[a]):a}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 a=t[0];if(typeof a!="string")return this.error(`Expression name must be a string, but found ${typeof a} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const l=this.registry[a];if(l){let u=l.parse(t,this);if(!u)return null;if(this.expectedType){const f=this.expectedType,g=u.type;if(f.kind!=="string"&&f.kind!=="number"&&f.kind!=="boolean"&&f.kind!=="object"&&f.kind!=="array"||g.kind!=="value"){if(f.kind==="projectionDefinition"&&["string","array"].includes(g.kind)||["color","formatted","resolvedImage"].includes(f.kind)&&["value","string"].includes(g.kind)||["padding","numberArray"].includes(f.kind)&&["value","number","array"].includes(g.kind)||f.kind==="colorArray"&&["value","string","array"].includes(g.kind)||f.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(g.kind))u=s(u,f,i.typeAnnotation||"coerce");else if(this.checkSubtype(f,g))return null}else u=s(u,f,i.typeAnnotation||"assert")}if(!(u instanceof tn)&&u.type.kind!=="resolvedImage"&&this._isConstant(u)){const f=new Xt;try{u=new tn(u.type,u.evaluate(f))}catch(g){return this.error(g.message),null}}return u}return this.error(`Unknown expression "${a}". 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,i,s){const a=typeof t=="number"?this.path.concat(t):this.path,l=s?this.scope.concat(s):this.scope;return new is(this.registry,this._isConstant,a,i||null,l,this.errors)}error(t,...i){const s=`${this.key}${i.map(a=>`[${a}]`).join("")}`;this.errors.push(new fe(s,t))}checkSubtype(t,i){const s=gr(t,i);return s&&this.error(s),s}}class re{constructor(t,i){this.type=i.type,this.bindings=[].concat(t),this.result=i}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const i of this.bindings)t(i[1]);t(this.result)}static parse(t,i){if(t.length<4)return i.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const s=[];for(let l=1;l<t.length-1;l+=2){const u=t[l];if(typeof u!="string")return i.error(`Expected string, but found ${typeof u} instead.`,l);if(/[^a-zA-Z0-9_]/.test(u))return i.error("Variable names must contain only alphanumeric characters or '_'.",l);const f=i.parse(t[l+1],l+1);if(!f)return null;s.push([u,f])}const a=i.parse(t[t.length-1],t.length-1,i.expectedType,s);return a?new re(s,a):null}outputDefined(){return this.result.outputDefined()}}class rs{constructor(t,i){this.type=i.type,this.name=t,this.boundExpression=i}static parse(t,i){if(t.length!==2||typeof t[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");const s=t[1];return i.scope.has(s)?new rs(s,i.scope.get(s)):i.error(`Unknown variable "${s}". Make sure "${s}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class rr{constructor(t,i,s){this.type=t,this.index=i,this.input=s}static parse(t,i){if(t.length!==3)return i.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const s=i.parse(t[1],1,bt),a=i.parse(t[2],2,Vi(i.expectedType||Zt));return s&&a?new rr(a.type.itemType,s,a):null}evaluate(t){const i=this.index.evaluate(t),s=this.input.evaluate(t);if(i<0)throw new _e(`Array index out of bounds: ${i} < 0.`);if(i>=s.length)throw new _e(`Array index out of bounds: ${i} > ${s.length-1}.`);if(i!==Math.floor(i))throw new _e(`Array index must be an integer, but found ${i} instead.`);return s[i]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class ks{constructor(t,i){this.type=jt,this.needle=t,this.haystack=i}static parse(t,i){if(t.length!==3)return i.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const s=i.parse(t[1],1,Zt),a=i.parse(t[2],2,Zt);return s&&a?Ds(s.type,[jt,Dt,bt,me,Zt])?new ks(s,a):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${ge(s.type)} instead`):null}evaluate(t){const i=this.needle.evaluate(t),s=this.haystack.evaluate(t);if(!s)return!1;if(!Ee(i,["boolean","string","number","null"]))throw new _e(`Expected first argument to be of type boolean, string, number or null, but found ${ge(be(i))} instead.`);if(!Ee(s,["string","array"]))throw new _e(`Expected second argument to be of type array or string, but found ${ge(be(s))} instead.`);return s.indexOf(i)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class wn{constructor(t,i,s){this.type=bt,this.needle=t,this.haystack=i,this.fromIndex=s}static parse(t,i){if(t.length<=2||t.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);const s=i.parse(t[1],1,Zt),a=i.parse(t[2],2,Zt);if(!s||!a)return null;if(!Ds(s.type,[jt,Dt,bt,me,Zt]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${ge(s.type)} instead`);if(t.length===4){const l=i.parse(t[3],3,bt);return l?new wn(s,a,l):null}return new wn(s,a)}evaluate(t){const i=this.needle.evaluate(t),s=this.haystack.evaluate(t);if(!Ee(i,["boolean","string","number","null"]))throw new _e(`Expected first argument to be of type boolean, string, number or null, but found ${ge(be(i))} instead.`);let a;if(this.fromIndex&&(a=this.fromIndex.evaluate(t)),Ee(s,["string"])){const l=s.indexOf(i,a);return l===-1?-1:[...s.slice(0,l)].length}if(Ee(s,["array"]))return s.indexOf(i,a);throw new _e(`Expected second argument to be of type array or string, but found ${ge(be(s))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class Pa{constructor(t,i,s,a,l,u){this.inputType=t,this.type=i,this.input=s,this.cases=a,this.outputs=l,this.otherwise=u}static parse(t,i){if(t.length<5)return i.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return i.error("Expected an even number of arguments.");let s,a;i.expectedType&&i.expectedType.kind!=="value"&&(a=i.expectedType);const l={},u=[];for(let y=2;y<t.length-1;y+=2){let v=t[y];const w=t[y+1];Array.isArray(v)||(v=[v]);const S=i.concat(y);if(v.length===0)return S.error("Expected at least one branch label.");for(const M of v){if(typeof M!="number"&&typeof M!="string")return S.error("Branch labels must be numbers or strings.");if(typeof M=="number"&&Math.abs(M)>Number.MAX_SAFE_INTEGER)return S.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof M=="number"&&Math.floor(M)!==M)return S.error("Numeric branch labels must be integer values.");if(s){if(S.checkSubtype(s,be(M)))return null}else s=be(M);if(l[String(M)]!==void 0)return S.error("Branch labels must be unique.");l[String(M)]=u.length}const P=i.parse(w,y,a);if(!P)return null;a=a||P.type,u.push(P)}const f=i.parse(t[1],1,Zt);if(!f)return null;const g=i.parse(t[t.length-1],t.length-1,a);return g?f.type.kind!=="value"&&i.concat(1).checkSubtype(s,f.type)?null:new Pa(s,a,f,l,u,g):null}evaluate(t){const i=this.input.evaluate(t);return(be(i)===this.inputType&&this.outputs[this.cases[i]]||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 Rs{constructor(t,i,s){this.type=t,this.branches=i,this.otherwise=s}static parse(t,i){if(t.length<4)return i.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return i.error("Expected an odd number of arguments.");let s;i.expectedType&&i.expectedType.kind!=="value"&&(s=i.expectedType);const a=[];for(let u=1;u<t.length-1;u+=2){const f=i.parse(t[u],u,jt);if(!f)return null;const g=i.parse(t[u+1],u+1,s);if(!g)return null;a.push([f,g]),s=s||g.type}const l=i.parse(t[t.length-1],t.length-1,s);if(!l)return null;if(!s)throw new Error("Can't infer output type");return new Rs(s,a,l)}evaluate(t){for(const[i,s]of this.branches)if(i.evaluate(t))return s.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[i,s]of this.branches)t(i),t(s);t(this.otherwise)}outputDefined(){return this.branches.every(([t,i])=>i.outputDefined())&&this.otherwise.outputDefined()}}class Ls{constructor(t,i,s,a){this.type=t,this.input=i,this.beginIndex=s,this.endIndex=a}static parse(t,i){if(t.length<=2||t.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);const s=i.parse(t[1],1,Zt),a=i.parse(t[2],2,bt);if(!s||!a)return null;if(!Ds(s.type,[Vi(Zt),Dt,Zt]))return i.error(`Expected first argument to be of type array or string, but found ${ge(s.type)} instead`);if(t.length===4){const l=i.parse(t[3],3,bt);return l?new Ls(s.type,s,a,l):null}return new Ls(s.type,s,a)}evaluate(t){const i=this.input.evaluate(t),s=this.beginIndex.evaluate(t);let a;if(this.endIndex&&(a=this.endIndex.evaluate(t)),Ee(i,["string"]))return[...i].slice(s,a).join("");if(Ee(i,["array"]))return i.slice(s,a);throw new _e(`Expected first argument to be of type array or string, but found ${ge(be(i))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function Ma(r,t){const i=r.length-1;let s,a,l=0,u=i,f=0;for(;l<=u;)if(f=Math.floor((l+u)/2),s=r[f],a=r[f+1],s<=t){if(f===i||t<a)return f;l=f+1}else{if(!(s>t))throw new _e("Input is not a number.");u=f-1}return 0}class ns{constructor(t,i,s){this.type=t,this.input=i,this.labels=[],this.outputs=[];for(const[a,l]of s)this.labels.push(a),this.outputs.push(l)}static parse(t,i){if(t.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return i.error("Expected an even number of arguments.");const s=i.parse(t[1],1,bt);if(!s)return null;const a=[];let l=null;i.expectedType&&i.expectedType.kind!=="value"&&(l=i.expectedType);for(let u=1;u<t.length;u+=2){const f=u===1?-1/0:t[u],g=t[u+1],y=u,v=u+1;if(typeof f!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',y);if(a.length&&a[a.length-1][0]>=f)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',y);const w=i.parse(g,v,l);if(!w)return null;l=l||w.type,a.push([f,w])}return new ns(l,s,a)}evaluate(t){const i=this.labels,s=this.outputs;if(i.length===1)return s[0].evaluate(t);const a=this.input.evaluate(t);if(a<=i[0])return s[0].evaluate(t);const l=i.length;return a>=i[l-1]?s[l-1].evaluate(t):s[Ma(i,a)].evaluate(t)}eachChild(t){t(this.input);for(const i of this.outputs)t(i)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function nc(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var xr,li,Ia=function(){if(li)return xr;function r(t,i,s,a){this.cx=3*t,this.bx=3*(s-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(a-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=i,this.p2x=s,this.p2y=a}return li=1,xr=r,r.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,i){if(i===void 0&&(i=1e-6),t<0)return 0;if(t>1)return 1;for(var s=t,a=0;a<8;a++){var l=this.sampleCurveX(s)-t;if(Math.abs(l)<i)return s;var u=this.sampleCurveDerivativeX(s);if(Math.abs(u)<1e-6)break;s-=l/u}var f=0,g=1;for(s=t,a=0;a<20&&(l=this.sampleCurveX(s),!(Math.abs(l-t)<i));a++)t>l?f=s:g=s,s=.5*(g-f)+f;return s},solve:function(t,i){return this.sampleCurveY(this.solveCurveX(t,i))}},xr}(),sc=nc(Ia);class ci{constructor(t,i,s,a,l){this.type=t,this.operator=i,this.interpolation=s,this.input=a,this.labels=[],this.outputs=[];for(const[u,f]of l)this.labels.push(u),this.outputs.push(f)}static interpolationFactor(t,i,s,a){let l=0;if(t.name==="exponential")l=He(i,t.base,s,a);else if(t.name==="linear")l=He(i,1,s,a);else if(t.name==="cubic-bezier"){const u=t.controlPoints;l=new sc(u[0],u[1],u[2],u[3]).solve(He(i,1,s,a))}return l}static parse(t,i){let[s,a,l,...u]=t;if(!Array.isArray(a)||a.length===0)return i.error("Expected an interpolation type expression.",1);if(a[0]==="linear")a={name:"linear"};else if(a[0]==="exponential"){const y=a[1];if(typeof y!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:y}}else{if(a[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(a[0])}`,1,0);{const y=a.slice(1);if(y.length!==4||y.some(v=>typeof v!="number"||v<0||v>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:y}}}if(t.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(l=i.parse(l,2,bt),!l)return null;const f=[];let g=null;s!=="interpolate-hcl"&&s!=="interpolate-lab"||i.expectedType==ir?i.expectedType&&i.expectedType.kind!=="value"&&(g=i.expectedType):g=Di;for(let y=0;y<u.length;y+=2){const v=u[y],w=u[y+1],S=y+3,P=y+4;if(typeof v!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',S);if(f.length&&f[f.length-1][0]>=v)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',S);const M=i.parse(w,P,g);if(!M)return null;g=g||M.type,f.push([v,M])}return Yr(g,bt)||Yr(g,xn)||Yr(g,Di)||Yr(g,Yn)||Yr(g,vn)||Yr(g,ir)||Yr(g,Jn)||Yr(g,Vi(bt))?new ci(g,s,a,l,f):i.error(`Type ${ge(g)} is not interpolatable.`)}evaluate(t){const i=this.labels,s=this.outputs;if(i.length===1)return s[0].evaluate(t);const a=this.input.evaluate(t);if(a<=i[0])return s[0].evaluate(t);const l=i.length;if(a>=i[l-1])return s[l-1].evaluate(t);const u=Ma(i,a),f=ci.interpolationFactor(this.interpolation,a,i[u],i[u+1]),g=s[u].evaluate(t),y=s[u+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Kr(g,y,f);case"color":return Jt.interpolate(g,y,f);case"padding":return pi.interpolate(g,y,f);case"colorArray":return ti.interpolate(g,y,f);case"numberArray":return fi.interpolate(g,y,f);case"variableAnchorOffsetCollection":return Ti.interpolate(g,y,f);case"array":return bn(g,y,f);case"projectionDefinition":return mi.interpolate(g,y,f)}case"interpolate-hcl":switch(this.type.kind){case"color":return Jt.interpolate(g,y,f,"hcl");case"colorArray":return ti.interpolate(g,y,f,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Jt.interpolate(g,y,f,"lab");case"colorArray":return ti.interpolate(g,y,f,"lab")}}}eachChild(t){t(this.input);for(const i of this.outputs)t(i)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function He(r,t,i,s){const a=s-i,l=r-i;return a===0?0:t===1?l/a:(Math.pow(t,l)-1)/(Math.pow(t,a)-1)}const nr={color:Jt.interpolate,number:Kr,padding:pi.interpolate,numberArray:fi.interpolate,colorArray:ti.interpolate,variableAnchorOffsetCollection:Ti.interpolate,array:bn};class ss{constructor(t,i){this.type=t,this.args=i}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let s=null;const a=i.expectedType;a&&a.kind!=="value"&&(s=a);const l=[];for(const f of t.slice(1)){const g=i.parse(f,1+l.length,s,void 0,{typeAnnotation:"omit"});if(!g)return null;s=s||g.type,l.push(g)}if(!s)throw new Error("No output type");const u=a&&l.some(f=>gr(a,f.type));return new ss(u?Zt:s,l)}evaluate(t){let i,s=null,a=0;for(const l of this.args)if(a++,s=l.evaluate(t),s&&s instanceof zi&&!s.available&&(i||(i=s.name),s=null,a===this.args.length&&(s=i)),s!==null)break;return s}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function Ro(r,t){return r==="=="||r==="!="?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 ac(r,t,i,s){return s.compare(t,i)===0}function sr(r,t,i){const s=r!=="=="&&r!=="!=";return class tf{constructor(l,u,f){this.type=jt,this.lhs=l,this.rhs=u,this.collator=f,this.hasUntypedArgument=l.type.kind==="value"||u.type.kind==="value"}static parse(l,u){if(l.length!==3&&l.length!==4)return u.error("Expected two or three arguments.");const f=l[0];let g=u.parse(l[1],1,Zt);if(!g)return null;if(!Ro(f,g.type))return u.concat(1).error(`"${f}" comparisons are not supported for type '${ge(g.type)}'.`);let y=u.parse(l[2],2,Zt);if(!y)return null;if(!Ro(f,y.type))return u.concat(2).error(`"${f}" comparisons are not supported for type '${ge(y.type)}'.`);if(g.type.kind!==y.type.kind&&g.type.kind!=="value"&&y.type.kind!=="value")return u.error(`Cannot compare types '${ge(g.type)}' and '${ge(y.type)}'.`);s&&(g.type.kind==="value"&&y.type.kind!=="value"?g=new ki(y.type,[g]):g.type.kind!=="value"&&y.type.kind==="value"&&(y=new ki(g.type,[y])));let v=null;if(l.length===4){if(g.type.kind!=="string"&&y.type.kind!=="string"&&g.type.kind!=="value"&&y.type.kind!=="value")return u.error("Cannot use collator to compare non-string types.");if(v=u.parse(l[3],3,Mr),!v)return null}return new tf(g,y,v)}evaluate(l){const u=this.lhs.evaluate(l),f=this.rhs.evaluate(l);if(s&&this.hasUntypedArgument){const g=be(u),y=be(f);if(g.kind!==y.kind||g.kind!=="string"&&g.kind!=="number")throw new _e(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${g.kind}, ${y.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const g=be(u),y=be(f);if(g.kind!=="string"||y.kind!=="string")return t(l,u,f)}return this.collator?i(l,u,f,this.collator.evaluate(l)):t(l,u,f)}eachChild(l){l(this.lhs),l(this.rhs),this.collator&&l(this.collator)}outputDefined(){return!0}}}const Ea=sr("==",function(r,t,i){return t===i},ac),Lo=sr("!=",function(r,t,i){return t!==i},function(r,t,i,s){return!ac(0,t,i,s)}),Eu=sr("<",function(r,t,i){return t<i},function(r,t,i,s){return s.compare(t,i)<0}),oc=sr(">",function(r,t,i){return t>i},function(r,t,i,s){return s.compare(t,i)>0}),Ca=sr("<=",function(r,t,i){return t<=i},function(r,t,i,s){return s.compare(t,i)<=0}),Aa=sr(">=",function(r,t,i){return t>=i},function(r,t,i,s){return s.compare(t,i)>=0});class Ri{constructor(t,i,s){this.type=Mr,this.locale=s,this.caseSensitive=t,this.diacriticSensitive=i}static parse(t,i){if(t.length!==2)return i.error("Expected one argument.");const s=t[1];if(typeof s!="object"||Array.isArray(s))return i.error("Collator options argument must be an object.");const a=i.parse(s["case-sensitive"]!==void 0&&s["case-sensitive"],1,jt);if(!a)return null;const l=i.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,jt);if(!l)return null;let u=null;return s.locale&&(u=i.parse(s.locale,1,Dt),!u)?null:new Ri(a,l,u)}evaluate(t){return new $i(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 Da{constructor(t,i,s,a,l){this.type=Dt,this.number=t,this.locale=i,this.currency=s,this.minFractionDigits=a,this.maxFractionDigits=l}static parse(t,i){if(t.length!==3)return i.error("Expected two arguments.");const s=i.parse(t[1],1,bt);if(!s)return null;const a=t[2];if(typeof a!="object"||Array.isArray(a))return i.error("NumberFormat options argument must be an object.");let l=null;if(a.locale&&(l=i.parse(a.locale,1,Dt),!l))return null;let u=null;if(a.currency&&(u=i.parse(a.currency,1,Dt),!u))return null;let f=null;if(a["min-fraction-digits"]&&(f=i.parse(a["min-fraction-digits"],1,bt),!f))return null;let g=null;return a["max-fraction-digits"]&&(g=i.parse(a["max-fraction-digits"],1,bt),!g)?null:new Da(s,l,u,f,g)}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 Tn{constructor(t){this.type=Xn,this.sections=t}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");const s=t[1];if(!Array.isArray(s)&&typeof s=="object")return i.error("First argument must be an image or text section.");const a=[];let l=!1;for(let u=1;u<=t.length-1;++u){const f=t[u];if(l&&typeof f=="object"&&!Array.isArray(f)){l=!1;let g=null;if(f["font-scale"]&&(g=i.parse(f["font-scale"],1,bt),!g))return null;let y=null;if(f["text-font"]&&(y=i.parse(f["text-font"],1,Vi(Dt)),!y))return null;let v=null;if(f["text-color"]&&(v=i.parse(f["text-color"],1,Di),!v))return null;let w=null;if(f["vertical-align"]){if(typeof f["vertical-align"]=="string"&&!ie.includes(f["vertical-align"]))return i.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${f["vertical-align"]}' instead.`);if(w=i.parse(f["vertical-align"],1,Dt),!w)return null}const S=a[a.length-1];S.scale=g,S.font=y,S.textColor=v,S.verticalAlign=w}else{const g=i.parse(t[u],1,Zt);if(!g)return null;const y=g.type.kind;if(y!=="string"&&y!=="value"&&y!=="null"&&y!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");l=!0,a.push({content:g,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Tn(a)}evaluate(t){return new We(this.sections.map(i=>{const s=i.content.evaluate(t);return be(s)===Kn?new Jr("",s,null,null,null,i.verticalAlign?i.verticalAlign.evaluate(t):null):new Jr(es(s),null,i.scale?i.scale.evaluate(t):null,i.font?i.font.evaluate(t).join(","):null,i.textColor?i.textColor.evaluate(t):null,i.verticalAlign?i.verticalAlign.evaluate(t):null)}))}eachChild(t){for(const i of this.sections)t(i.content),i.scale&&t(i.scale),i.font&&t(i.font),i.textColor&&t(i.textColor),i.verticalAlign&&t(i.verticalAlign)}outputDefined(){return!1}}class Fo{constructor(t){this.type=Kn,this.input=t}static parse(t,i){if(t.length!==2)return i.error("Expected two arguments.");const s=i.parse(t[1],1,Dt);return s?new Fo(s):i.error("No image name provided.")}evaluate(t){const i=this.input.evaluate(t),s=zi.fromString(i);return s&&t.availableImages&&(s.available=t.availableImages.indexOf(i)>-1),s}eachChild(t){t(this.input)}outputDefined(){return!1}}class Fs{constructor(t){this.type=bt,this.input=t}static parse(t,i){if(t.length!==2)return i.error(`Expected 1 argument, but found ${t.length-1} instead.`);const s=i.parse(t[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${ge(s.type)} instead.`):new Fs(s):null}evaluate(t){const i=this.input.evaluate(t);if(typeof i=="string")return[...i].length;if(Array.isArray(i))return i.length;throw new _e(`Expected value to be of type string or array, but found ${ge(be(i))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const vr=8192;function Cu(r,t){const i=(180+r[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,a=Math.pow(2,t.z);return[Math.round(i*a*vr),Math.round(s*a*vr)]}function Bo(r,t){const i=Math.pow(2,t.z);return[(a=(r[0]/vr+t.x)/i,360*a-180),(s=(r[1]/vr+t.y)/i,360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90)];var s,a}function Bs(r,t){r[0]=Math.min(r[0],t[0]),r[1]=Math.min(r[1],t[1]),r[2]=Math.max(r[2],t[0]),r[3]=Math.max(r[3],t[1])}function en(r,t){return!(r[0]<=t[0]||r[2]>=t[2]||r[1]<=t[1]||r[3]>=t[3])}function Au(r,t,i){const s=r[0]-t[0],a=r[1]-t[1],l=r[0]-i[0],u=r[1]-i[1];return s*u-l*a==0&&s*l<=0&&a*u<=0}function Os(r,t,i,s){return(a=[s[0]-i[0],s[1]-i[1]])[0]*(l=[t[0]-r[0],t[1]-r[1]])[1]-a[1]*l[0]!=0&&!(!hc(r,t,i,s)||!hc(i,s,r,t));var a,l}function lc(r,t,i){for(const s of i)for(let a=0;a<s.length-1;++a)if(Os(r,t,s[a],s[a+1]))return!0;return!1}function as(r,t,i=!1){let s=!1;for(const f of t)for(let g=0;g<f.length-1;g++){if(Au(r,f[g],f[g+1]))return i;(l=f[g])[1]>(a=r)[1]!=(u=f[g+1])[1]>a[1]&&a[0]<(u[0]-l[0])*(a[1]-l[1])/(u[1]-l[1])+l[0]&&(s=!s)}var a,l,u;return s}function cc(r,t){for(const i of t)if(as(r,i))return!0;return!1}function uc(r,t){for(const i of r)if(!as(i,t))return!1;for(let i=0;i<r.length-1;++i)if(lc(r[i],r[i+1],t))return!1;return!0}function Du(r,t){for(const i of t)if(uc(r,i))return!0;return!1}function hc(r,t,i,s){const a=s[0]-i[0],l=s[1]-i[1],u=(r[0]-i[0])*l-a*(r[1]-i[1]),f=(t[0]-i[0])*l-a*(t[1]-i[1]);return u>0&&f<0||u<0&&f>0}function Oo(r,t,i){const s=[];for(let a=0;a<r.length;a++){const l=[];for(let u=0;u<r[a].length;u++){const f=Cu(r[a][u],i);Bs(t,f),l.push(f)}s.push(l)}return s}function dc(r,t,i){const s=[];for(let a=0;a<r.length;a++){const l=Oo(r[a],t,i);s.push(l)}return s}function Vo(r,t,i,s){if(r[0]<i[0]||r[0]>i[2]){const a=.5*s;let l=r[0]-i[0]>a?-s:i[0]-r[0]>a?s:0;l===0&&(l=r[0]-i[2]>a?-s:i[2]-r[0]>a?s:0),r[0]+=l}Bs(t,r)}function No(r,t,i,s){const a=Math.pow(2,s.z)*vr,l=[s.x*vr,s.y*vr],u=[];for(const f of r)for(const g of f){const y=[g.x+l[0],g.y+l[1]];Vo(y,t,i,a),u.push(y)}return u}function jo(r,t,i,s){const a=Math.pow(2,s.z)*vr,l=[s.x*vr,s.y*vr],u=[];for(const g of r){const y=[];for(const v of g){const w=[v.x+l[0],v.y+l[1]];Bs(t,w),y.push(w)}u.push(y)}if(t[2]-t[0]<=a/2){(f=t)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const g of u)for(const y of g)Vo(y,t,i,a)}var f;return u}class Sn{constructor(t,i){this.type=jt,this.geojson=t,this.geometries=i}static parse(t,i){if(t.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Qr(t[1])){const s=t[1];if(s.type==="FeatureCollection"){const a=[];for(const l of s.features){const{type:u,coordinates:f}=l.geometry;u==="Polygon"&&a.push(f),u==="MultiPolygon"&&a.push(...f)}if(a.length)return new Sn(s,{type:"MultiPolygon",coordinates:a})}else if(s.type==="Feature"){const a=s.geometry.type;if(a==="Polygon"||a==="MultiPolygon")return new Sn(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new Sn(s,s)}return i.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(i,s){const a=[1/0,1/0,-1/0,-1/0],l=[1/0,1/0,-1/0,-1/0],u=i.canonicalID();if(s.type==="Polygon"){const f=Oo(s.coordinates,l,u),g=No(i.geometry(),a,l,u);if(!en(a,l))return!1;for(const y of g)if(!as(y,f))return!1}if(s.type==="MultiPolygon"){const f=dc(s.coordinates,l,u),g=No(i.geometry(),a,l,u);if(!en(a,l))return!1;for(const y of g)if(!cc(y,f))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(i,s){const a=[1/0,1/0,-1/0,-1/0],l=[1/0,1/0,-1/0,-1/0],u=i.canonicalID();if(s.type==="Polygon"){const f=Oo(s.coordinates,l,u),g=jo(i.geometry(),a,l,u);if(!en(a,l))return!1;for(const y of g)if(!uc(y,f))return!1}if(s.type==="MultiPolygon"){const f=dc(s.coordinates,l,u),g=jo(i.geometry(),a,l,u);if(!en(a,l))return!1;for(const y of g)if(!Du(y,f))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let pc=class{constructor(r=[],t=(i,s)=>i<s?-1:i>s?1:0){if(this.data=r,this.length=this.data.length,this.compare=t,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(r){this.data.push(r),this._up(this.length++)}pop(){if(this.length===0)return;const r=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),r}peek(){return this.data[0]}_up(r){const{data:t,compare:i}=this,s=t[r];for(;r>0;){const a=r-1>>1,l=t[a];if(i(s,l)>=0)break;t[r]=l,r=a}t[r]=s}_down(r){const{data:t,compare:i}=this,s=this.length>>1,a=t[r];for(;r<s;){let l=1+(r<<1);const u=l+1;if(u<this.length&&i(t[u],t[l])<0&&(l=u),i(t[l],a)>=0)break;t[r]=t[l],r=l}t[r]=a}};function fc(r,t,i=0,s=r.length-1,a=za){for(;s>i;){if(s-i>600){const g=s-i+1,y=t-i+1,v=Math.log(g),w=.5*Math.exp(2*v/3),S=.5*Math.sqrt(v*w*(g-w)/g)*(y-g/2<0?-1:1);fc(r,t,Math.max(i,Math.floor(t-y*w/g+S)),Math.min(s,Math.floor(t+(g-y)*w/g+S)),a)}const l=r[t];let u=i,f=s;for(Vs(r,i,t),a(r[s],l)>0&&Vs(r,i,s);u<f;){for(Vs(r,u,f),u++,f--;a(r[u],l)<0;)u++;for(;a(r[f],l)>0;)f--}a(r[i],l)===0?Vs(r,i,f):(f++,Vs(r,f,s)),f<=t&&(i=f+1),t<=f&&(s=f-1)}}function Vs(r,t,i){const s=r[t];r[t]=r[i],r[i]=s}function za(r,t){return r<t?-1:r>t?1:0}function Ns(r,t){if(r.length<=1)return[r];const i=[];let s,a;for(const l of r){const u=ku(l);u!==0&&(l.area=Math.abs(u),a===void 0&&(a=u<0),a===u<0?(s&&i.push(s),s=[l]):s.push(l))}if(s&&i.push(s),t>1)for(let l=0;l<i.length;l++)i[l].length<=t||(fc(i[l],t,1,i[l].length-1,zu),i[l]=i[l].slice(0,t));return i}function zu(r,t){return t.area-r.area}function ku(r){let t=0;for(let i,s,a=0,l=r.length,u=l-1;a<l;u=a++)i=r[a],s=r[u],t+=(s.x-i.x)*(i.y+s.y);return t}const mc=1/298.257223563,ka=mc*(2-mc),Uo=Math.PI/180;class Go{constructor(t){const i=6378.137*Uo*1e3,s=Math.cos(t*Uo),a=1/(1-ka*(1-s*s)),l=Math.sqrt(a);this.kx=i*l*s,this.ky=i*l*a*(1-ka)}distance(t,i){const s=this.wrap(t[0]-i[0])*this.kx,a=(t[1]-i[1])*this.ky;return Math.sqrt(s*s+a*a)}pointOnLine(t,i){let s,a,l,u,f=1/0;for(let g=0;g<t.length-1;g++){let y=t[g][0],v=t[g][1],w=this.wrap(t[g+1][0]-y)*this.kx,S=(t[g+1][1]-v)*this.ky,P=0;w===0&&S===0||(P=(this.wrap(i[0]-y)*this.kx*w+(i[1]-v)*this.ky*S)/(w*w+S*S),P>1?(y=t[g+1][0],v=t[g+1][1]):P>0&&(y+=w/this.kx*P,v+=S/this.ky*P)),w=this.wrap(i[0]-y)*this.kx,S=(i[1]-v)*this.ky;const M=w*w+S*S;M<f&&(f=M,s=y,a=v,l=g,u=P)}return{point:[s,a],index:l,t:Math.max(0,Math.min(1,u))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function gc(r,t){return t[0]-r[0]}function js(r){return r[1]-r[0]+1}function br(r,t){return r[1]>=r[0]&&r[1]<t}function Zo(r,t){if(r[0]>r[1])return[null,null];const i=js(r);if(t){if(i===2)return[r,null];const a=Math.floor(i/2);return[[r[0],r[0]+a],[r[0]+a,r[1]]]}if(i===1)return[r,null];const s=Math.floor(i/2)-1;return[[r[0],r[0]+s],[r[0]+s+1,r[1]]]}function $o(r,t){if(!br(t,r.length))return[1/0,1/0,-1/0,-1/0];const i=[1/0,1/0,-1/0,-1/0];for(let s=t[0];s<=t[1];++s)Bs(i,r[s]);return i}function qo(r){const t=[1/0,1/0,-1/0,-1/0];for(const i of r)for(const s of i)Bs(t,s);return t}function Wo(r){return r[0]!==-1/0&&r[1]!==-1/0&&r[2]!==1/0&&r[3]!==1/0}function Ho(r,t,i){if(!Wo(r)||!Wo(t))return NaN;let s=0,a=0;return r[2]<t[0]&&(s=t[0]-r[2]),r[0]>t[2]&&(s=r[0]-t[2]),r[1]>t[3]&&(a=r[1]-t[3]),r[3]<t[1]&&(a=t[1]-r[3]),i.distance([0,0],[s,a])}function Pn(r,t,i){const s=i.pointOnLine(t,r);return i.distance(r,s.point)}function Xo(r,t,i,s,a){const l=Math.min(Pn(r,[i,s],a),Pn(t,[i,s],a)),u=Math.min(Pn(i,[r,t],a),Pn(s,[r,t],a));return Math.min(l,u)}function Ru(r,t,i,s,a){if(!br(t,r.length)||!br(s,i.length))return 1/0;let l=1/0;for(let u=t[0];u<t[1];++u){const f=r[u],g=r[u+1];for(let y=s[0];y<s[1];++y){const v=i[y],w=i[y+1];if(Os(f,g,v,w))return 0;l=Math.min(l,Xo(f,g,v,w,a))}}return l}function oe(r,t,i,s,a){if(!br(t,r.length)||!br(s,i.length))return NaN;let l=1/0;for(let u=t[0];u<=t[1];++u)for(let f=s[0];f<=s[1];++f)if(l=Math.min(l,a.distance(r[u],i[f])),l===0)return l;return l}function Lu(r,t,i){if(as(r,t,!0))return 0;let s=1/0;for(const a of t){const l=a[0],u=a[a.length-1];if(l!==u&&(s=Math.min(s,Pn(r,[u,l],i)),s===0))return s;const f=i.pointOnLine(a,r);if(s=Math.min(s,i.distance(r,f.point)),s===0)return s}return s}function Fu(r,t,i,s){if(!br(t,r.length))return NaN;for(let l=t[0];l<=t[1];++l)if(as(r[l],i,!0))return 0;let a=1/0;for(let l=t[0];l<t[1];++l){const u=r[l],f=r[l+1];for(const g of i)for(let y=0,v=g.length,w=v-1;y<v;w=y++){const S=g[w],P=g[y];if(Os(u,f,S,P))return 0;a=Math.min(a,Xo(u,f,S,P,s))}}return a}function _c(r,t){for(const i of r)for(const s of i)if(as(s,t,!0))return!0;return!1}function Bu(r,t,i,s=1/0){const a=qo(r),l=qo(t);if(s!==1/0&&Ho(a,l,i)>=s)return s;if(en(a,l)){if(_c(r,t))return 0}else if(_c(t,r))return 0;let u=1/0;for(const f of r)for(let g=0,y=f.length,v=y-1;g<y;v=g++){const w=f[v],S=f[g];for(const P of t)for(let M=0,C=P.length,z=C-1;M<C;z=M++){const F=P[z],Z=P[M];if(Os(w,S,F,Z))return 0;u=Math.min(u,Xo(w,S,F,Z,i))}}return u}function yc(r,t,i,s,a,l){if(!l)return;const u=Ho($o(s,l),a,i);u<t&&r.push([u,l,[0,0]])}function Ra(r,t,i,s,a,l,u){if(!l||!u)return;const f=Ho($o(s,l),$o(a,u),i);f<t&&r.push([f,l,u])}function La(r,t,i,s,a=1/0){let l=Math.min(s.distance(r[0],i[0][0]),a);if(l===0)return l;const u=new pc([[0,[0,r.length-1],[0,0]]],gc),f=qo(i);for(;u.length>0;){const g=u.pop();if(g[0]>=l)continue;const y=g[1],v=t?50:100;if(js(y)<=v){if(!br(y,r.length))return NaN;if(t){const w=Fu(r,y,i,s);if(isNaN(w)||w===0)return w;l=Math.min(l,w)}else for(let w=y[0];w<=y[1];++w){const S=Lu(r[w],i,s);if(l=Math.min(l,S),l===0)return 0}}else{const w=Zo(y,t);yc(u,l,s,r,f,w[0]),yc(u,l,s,r,f,w[1])}}return l}function Fa(r,t,i,s,a,l=1/0){let u=Math.min(l,a.distance(r[0],i[0]));if(u===0)return u;const f=new pc([[0,[0,r.length-1],[0,i.length-1]]],gc);for(;f.length>0;){const g=f.pop();if(g[0]>=u)continue;const y=g[1],v=g[2],w=t?50:100,S=s?50:100;if(js(y)<=w&&js(v)<=S){if(!br(y,r.length)&&br(v,i.length))return NaN;let P;if(t&&s)P=Ru(r,y,i,v,a),u=Math.min(u,P);else if(t&&!s){const M=r.slice(y[0],y[1]+1);for(let C=v[0];C<=v[1];++C)if(P=Pn(i[C],M,a),u=Math.min(u,P),u===0)return u}else if(!t&&s){const M=i.slice(v[0],v[1]+1);for(let C=y[0];C<=y[1];++C)if(P=Pn(r[C],M,a),u=Math.min(u,P),u===0)return u}else P=oe(r,y,i,v,a),u=Math.min(u,P)}else{const P=Zo(y,t),M=Zo(v,s);Ra(f,u,a,r,i,P[0],M[0]),Ra(f,u,a,r,i,P[0],M[1]),Ra(f,u,a,r,i,P[1],M[0]),Ra(f,u,a,r,i,P[1],M[1])}}return u}function Yo(r){return r.type==="MultiPolygon"?r.coordinates.map(t=>({type:"Polygon",coordinates:t})):r.type==="MultiLineString"?r.coordinates.map(t=>({type:"LineString",coordinates:t})):r.type==="MultiPoint"?r.coordinates.map(t=>({type:"Point",coordinates:t})):[r]}class Mn{constructor(t,i){this.type=bt,this.geojson=t,this.geometries=i}static parse(t,i){if(t.length!==2)return i.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Qr(t[1])){const s=t[1];if(s.type==="FeatureCollection")return new Mn(s,s.features.map(a=>Yo(a.geometry)).flat());if(s.type==="Feature")return new Mn(s,Yo(s.geometry));if("type"in s&&"coordinates"in s)return new Mn(s,Yo(s))}return i.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(i,s){const a=i.geometry(),l=a.flat().map(g=>Bo([g.x,g.y],i.canonical));if(a.length===0)return NaN;const u=new Go(l[0][1]);let f=1/0;for(const g of s){switch(g.type){case"Point":f=Math.min(f,Fa(l,!1,[g.coordinates],!1,u,f));break;case"LineString":f=Math.min(f,Fa(l,!1,g.coordinates,!0,u,f));break;case"Polygon":f=Math.min(f,La(l,!1,g.coordinates,u,f))}if(f===0)return f}return f}(t,this.geometries);if(t.geometryType()==="LineString")return function(i,s){const a=i.geometry(),l=a.flat().map(g=>Bo([g.x,g.y],i.canonical));if(a.length===0)return NaN;const u=new Go(l[0][1]);let f=1/0;for(const g of s){switch(g.type){case"Point":f=Math.min(f,Fa(l,!0,[g.coordinates],!1,u,f));break;case"LineString":f=Math.min(f,Fa(l,!0,g.coordinates,!0,u,f));break;case"Polygon":f=Math.min(f,La(l,!0,g.coordinates,u,f))}if(f===0)return f}return f}(t,this.geometries);if(t.geometryType()==="Polygon")return function(i,s){const a=i.geometry();if(a.length===0||a[0].length===0)return NaN;const l=Ns(a,0).map(g=>g.map(y=>y.map(v=>Bo([v.x,v.y],i.canonical)))),u=new Go(l[0][0][0][1]);let f=1/0;for(const g of s)for(const y of l){switch(g.type){case"Point":f=Math.min(f,La([g.coordinates],!1,y,u,f));break;case"LineString":f=Math.min(f,La(g.coordinates,!0,y,u,f));break;case"Polygon":f=Math.min(f,Bu(y,g.coordinates,u,f))}if(f===0)return f}return f}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Us{constructor(t){this.type=Zt,this.key=t}static parse(t,i){if(t.length!==2)return i.error(`Expected 1 argument, but found ${t.length-1} instead.`);const s=t[1];return s==null?i.error("Global state property must be defined."):typeof s!="string"?i.error(`Global state property must be string, but found ${typeof t[1]} instead.`):new Us(s)}evaluate(t){var i;const s=(i=t.globals)===null||i===void 0?void 0:i.globalState;return s&&Object.keys(s).length!==0?Ir(s,this.key):null}eachChild(){}outputDefined(){return!1}}const os={"==":Ea,"!=":Lo,">":oc,"<":Eu,">=":Aa,"<=":Ca,array:ki,at:rr,boolean:ki,case:Rs,coalesce:ss,collator:Ri,format:Tn,image:Fo,in:ks,"index-of":wn,interpolate:ci,"interpolate-hcl":ci,"interpolate-lab":ci,length:Fs,let:re,literal:tn,match:Pa,number:ki,"number-format":Da,object:ki,slice:Ls,step:ns,string:ki,"to-boolean":yr,"to-color":yr,"to-number":yr,"to-string":yr,var:rs,within:Sn,distance:Mn,"global-state":Us};class qi{constructor(t,i,s,a){this.name=t,this.type=i,this._evaluate=s,this.args=a}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,i){const s=t[0],a=qi.definitions[s];if(!a)return i.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);const l=Array.isArray(a)?a[0]:a.type,u=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,f=u.filter(([y])=>!Array.isArray(y)||y.length===t.length-1);let g=null;for(const[y,v]of f){g=new is(i.registry,Ba,i.path,null,i.scope);const w=[];let S=!1;for(let P=1;P<t.length;P++){const M=t[P],C=Array.isArray(y)?y[P-1]:y.type,z=g.parse(M,1+w.length,C);if(!z){S=!0;break}w.push(z)}if(!S)if(Array.isArray(y)&&y.length!==w.length)g.error(`Expected ${y.length} arguments, but found ${w.length} instead.`);else{for(let P=0;P<w.length;P++){const M=Array.isArray(y)?y[P]:y.type,C=w[P];g.concat(P+1).checkSubtype(M,C.type)}if(g.errors.length===0)return new qi(s,l,v,w)}}if(f.length===1)i.errors.push(...g.errors);else{const y=(f.length?f:u).map(([w])=>{return S=w,Array.isArray(S)?`(${S.map(ge).join(", ")})`:`(${ge(S.type)}...)`;var S}).join(" | "),v=[];for(let w=1;w<t.length;w++){const S=i.parse(t[w],1+v.length);if(!S)return null;v.push(ge(S.type))}i.error(`Expected arguments of type ${y}, but found (${v.join(", ")}) instead.`)}return null}static register(t,i){qi.definitions=i;for(const s in i)t[s]=qi}}function xc(r,[t,i,s,a]){t=t.evaluate(r),i=i.evaluate(r),s=s.evaluate(r);const l=a?a.evaluate(r):1,u=rc(t,i,s,l);if(u)throw new _e(u);return new Jt(t/255,i/255,s/255,l,!1)}function vc(r,t){return r in t}function Ko(r,t){const i=t[r];return i===void 0?null:i}function In(r){return{type:r}}function Ba(r){if(r instanceof rs)return Ba(r.boundExpression);if(r instanceof qi&&r.name==="error"||r instanceof Ri||r instanceof Sn||r instanceof Mn||r instanceof Us)return!1;const t=r instanceof yr||r instanceof ki;let i=!0;return r.eachChild(s=>{i=t?i&&Ba(s):i&&s instanceof tn}),!!i&&Oa(r)&&Va(r,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function Oa(r){if(r instanceof qi&&(r.name==="get"&&r.args.length===1||r.name==="feature-state"||r.name==="has"&&r.args.length===1||r.name==="properties"||r.name==="geometry-type"||r.name==="id"||/^filter-/.test(r.name))||r instanceof Sn||r instanceof Mn)return!1;let t=!0;return r.eachChild(i=>{t&&!Oa(i)&&(t=!1)}),t}function Gs(r){if(r instanceof qi&&r.name==="feature-state")return!1;let t=!0;return r.eachChild(i=>{t&&!Gs(i)&&(t=!1)}),t}function Va(r,t){if(r instanceof qi&&t.indexOf(r.name)>=0)return!1;let i=!0;return r.eachChild(s=>{i&&!Va(s,t)&&(i=!1)}),i}function bc(r){return{result:"success",value:r}}function ls(r){return{result:"error",value:r}}function cs(r){return r["property-type"]==="data-driven"||r["property-type"]==="cross-faded-data-driven"}function wc(r){return!!r.expression&&r.expression.parameters.indexOf("zoom")>-1}function Jo(r){return!!r.expression&&r.expression.interpolated}function Qt(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}function Na(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&be(r)===ii}function Ou(r){return r}function Tc(r,t){const i=r.stops&&typeof r.stops[0][0]=="object",s=i||!(i||r.property!==void 0),a=r.type||(Jo(t)?"exponential":"interval"),l=function(v){switch(v.type){case"color":return Jt.parse;case"padding":return pi.parse;case"numberArray":return fi.parse;case"colorArray":return ti.parse;default:return null}}(t);if(l&&((r=ve({},r)).stops&&(r.stops=r.stops.map(v=>[v[0],l(v[1])])),r.default=l(r.default?r.default:t.default)),r.colorSpace&&(u=r.colorSpace)!=="rgb"&&u!=="hcl"&&u!=="lab")throw new Error(`Unknown color space: "${r.colorSpace}"`);var u;const f=function(v){switch(v){case"exponential":return Sc;case"interval":return Vu;case"categorical":return Qo;case"identity":return Nu;default:throw new Error(`Unknown function type "${v}"`)}}(a);let g,y;if(a==="categorical"){g=Object.create(null);for(const v of r.stops)g[v[0]]=v[1];y=typeof r.stops[0][0]}if(i){const v={},w=[];for(let M=0;M<r.stops.length;M++){const C=r.stops[M],z=C[0].zoom;v[z]===void 0&&(v[z]={zoom:z,type:r.type,property:r.property,default:r.default,stops:[]},w.push(z)),v[z].stops.push([C[0].value,C[1]])}const S=[];for(const M of w)S.push([v[M].zoom,Tc(v[M],t)]);const P={name:"linear"};return{kind:"composite",interpolationType:P,interpolationFactor:ci.interpolationFactor.bind(void 0,P),zoomStops:S.map(M=>M[0]),evaluate:({zoom:M},C)=>Sc({stops:S,base:r.base},t,M).evaluate(M,C)}}if(s){const v=a==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:v,interpolationFactor:ci.interpolationFactor.bind(void 0,v),zoomStops:r.stops.map(w=>w[0]),evaluate:({zoom:w})=>f(r,t,w,g,y)}}return{kind:"source",evaluate(v,w){const S=w&&w.properties?w.properties[r.property]:void 0;return S===void 0?Zs(r.default,t.default):f(r,t,S,g,y)}}}function Zs(r,t,i){return r!==void 0?r:t!==void 0?t:i!==void 0?i:void 0}function Qo(r,t,i,s,a){return Zs(typeof i===a?s[i]:void 0,r.default,t.default)}function Vu(r,t,i){if(Qt(i)!=="number")return Zs(r.default,t.default);const s=r.stops.length;if(s===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[s-1][0])return r.stops[s-1][1];const a=Ma(r.stops.map(l=>l[0]),i);return r.stops[a][1]}function Sc(r,t,i){const s=r.base!==void 0?r.base:1;if(Qt(i)!=="number")return Zs(r.default,t.default);const a=r.stops.length;if(a===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[a-1][0])return r.stops[a-1][1];const l=Ma(r.stops.map(v=>v[0]),i),u=function(v,w,S,P){const M=P-S,C=v-S;return M===0?0:w===1?C/M:(Math.pow(w,C)-1)/(Math.pow(w,M)-1)}(i,s,r.stops[l][0],r.stops[l+1][0]),f=r.stops[l][1],g=r.stops[l+1][1],y=nr[t.type]||Ou;return typeof f.evaluate=="function"?{evaluate(...v){const w=f.evaluate.apply(void 0,v),S=g.evaluate.apply(void 0,v);if(w!==void 0&&S!==void 0)return y(w,S,u,r.colorSpace)}}:y(f,g,u,r.colorSpace)}function Nu(r,t,i){switch(t.type){case"color":i=Jt.parse(i);break;case"formatted":i=We.fromString(i.toString());break;case"resolvedImage":i=zi.fromString(i.toString());break;case"padding":i=pi.parse(i);break;case"colorArray":i=ti.parse(i);break;case"numberArray":i=fi.parse(i);break;default:Qt(i)===t.type||t.type==="enum"&&t.values[i]||(i=void 0)}return Zs(i,r.default,t.default)}qi.register(os,{error:[{kind:"error"},[Dt],(r,[t])=>{throw new _e(t.evaluate(r))}],typeof:[Dt,[Zt],(r,[t])=>ge(be(t.evaluate(r)))],"to-rgba":[Vi(bt,4),[Di],(r,[t])=>{const[i,s,a,l]=t.evaluate(r).rgb;return[255*i,255*s,255*a,l]}],rgb:[Di,[bt,bt,bt],xc],rgba:[Di,[bt,bt,bt,bt],xc],has:{type:jt,overloads:[[[Dt],(r,[t])=>vc(t.evaluate(r),r.properties())],[[Dt,ii],(r,[t,i])=>vc(t.evaluate(r),i.evaluate(r))]]},get:{type:Zt,overloads:[[[Dt],(r,[t])=>Ko(t.evaluate(r),r.properties())],[[Dt,ii],(r,[t,i])=>Ko(t.evaluate(r),i.evaluate(r))]]},"feature-state":[Zt,[Dt],(r,[t])=>Ko(t.evaluate(r),r.featureState||{})],properties:[ii,[],r=>r.properties()],"geometry-type":[Dt,[],r=>r.geometryType()],id:[Zt,[],r=>r.id()],zoom:[bt,[],r=>r.globals.zoom],"heatmap-density":[bt,[],r=>r.globals.heatmapDensity||0],elevation:[bt,[],r=>r.globals.elevation||0],"line-progress":[bt,[],r=>r.globals.lineProgress||0],accumulated:[Zt,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[bt,In(bt),(r,t)=>{let i=0;for(const s of t)i+=s.evaluate(r);return i}],"*":[bt,In(bt),(r,t)=>{let i=1;for(const s of t)i*=s.evaluate(r);return i}],"-":{type:bt,overloads:[[[bt,bt],(r,[t,i])=>t.evaluate(r)-i.evaluate(r)],[[bt],(r,[t])=>-t.evaluate(r)]]},"/":[bt,[bt,bt],(r,[t,i])=>t.evaluate(r)/i.evaluate(r)],"%":[bt,[bt,bt],(r,[t,i])=>t.evaluate(r)%i.evaluate(r)],ln2:[bt,[],()=>Math.LN2],pi:[bt,[],()=>Math.PI],e:[bt,[],()=>Math.E],"^":[bt,[bt,bt],(r,[t,i])=>Math.pow(t.evaluate(r),i.evaluate(r))],sqrt:[bt,[bt],(r,[t])=>Math.sqrt(t.evaluate(r))],log10:[bt,[bt],(r,[t])=>Math.log(t.evaluate(r))/Math.LN10],ln:[bt,[bt],(r,[t])=>Math.log(t.evaluate(r))],log2:[bt,[bt],(r,[t])=>Math.log(t.evaluate(r))/Math.LN2],sin:[bt,[bt],(r,[t])=>Math.sin(t.evaluate(r))],cos:[bt,[bt],(r,[t])=>Math.cos(t.evaluate(r))],tan:[bt,[bt],(r,[t])=>Math.tan(t.evaluate(r))],asin:[bt,[bt],(r,[t])=>Math.asin(t.evaluate(r))],acos:[bt,[bt],(r,[t])=>Math.acos(t.evaluate(r))],atan:[bt,[bt],(r,[t])=>Math.atan(t.evaluate(r))],min:[bt,In(bt),(r,t)=>Math.min(...t.map(i=>i.evaluate(r)))],max:[bt,In(bt),(r,t)=>Math.max(...t.map(i=>i.evaluate(r)))],abs:[bt,[bt],(r,[t])=>Math.abs(t.evaluate(r))],round:[bt,[bt],(r,[t])=>{const i=t.evaluate(r);return i<0?-Math.round(-i):Math.round(i)}],floor:[bt,[bt],(r,[t])=>Math.floor(t.evaluate(r))],ceil:[bt,[bt],(r,[t])=>Math.ceil(t.evaluate(r))],"filter-==":[jt,[Dt,Zt],(r,[t,i])=>r.properties()[t.value]===i.value],"filter-id-==":[jt,[Zt],(r,[t])=>r.id()===t.value],"filter-type-==":[jt,[Dt],(r,[t])=>r.geometryType()===t.value],"filter-<":[jt,[Dt,Zt],(r,[t,i])=>{const s=r.properties()[t.value],a=i.value;return typeof s==typeof a&&s<a}],"filter-id-<":[jt,[Zt],(r,[t])=>{const i=r.id(),s=t.value;return typeof i==typeof s&&i<s}],"filter->":[jt,[Dt,Zt],(r,[t,i])=>{const s=r.properties()[t.value],a=i.value;return typeof s==typeof a&&s>a}],"filter-id->":[jt,[Zt],(r,[t])=>{const i=r.id(),s=t.value;return typeof i==typeof s&&i>s}],"filter-<=":[jt,[Dt,Zt],(r,[t,i])=>{const s=r.properties()[t.value],a=i.value;return typeof s==typeof a&&s<=a}],"filter-id-<=":[jt,[Zt],(r,[t])=>{const i=r.id(),s=t.value;return typeof i==typeof s&&i<=s}],"filter->=":[jt,[Dt,Zt],(r,[t,i])=>{const s=r.properties()[t.value],a=i.value;return typeof s==typeof a&&s>=a}],"filter-id->=":[jt,[Zt],(r,[t])=>{const i=r.id(),s=t.value;return typeof i==typeof s&&i>=s}],"filter-has":[jt,[Zt],(r,[t])=>t.value in r.properties()],"filter-has-id":[jt,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[jt,[Vi(Dt)],(r,[t])=>t.value.indexOf(r.geometryType())>=0],"filter-id-in":[jt,[Vi(Zt)],(r,[t])=>t.value.indexOf(r.id())>=0],"filter-in-small":[jt,[Dt,Vi(Zt)],(r,[t,i])=>i.value.indexOf(r.properties()[t.value])>=0],"filter-in-large":[jt,[Dt,Vi(Zt)],(r,[t,i])=>function(s,a,l,u){for(;l<=u;){const f=l+u>>1;if(a[f]===s)return!0;a[f]>s?u=f-1:l=f+1}return!1}(r.properties()[t.value],i.value,0,i.value.length-1)],all:{type:jt,overloads:[[[jt,jt],(r,[t,i])=>t.evaluate(r)&&i.evaluate(r)],[In(jt),(r,t)=>{for(const i of t)if(!i.evaluate(r))return!1;return!0}]]},any:{type:jt,overloads:[[[jt,jt],(r,[t,i])=>t.evaluate(r)||i.evaluate(r)],[In(jt),(r,t)=>{for(const i of t)if(i.evaluate(r))return!0;return!1}]]},"!":[jt,[jt],(r,[t])=>!t.evaluate(r)],"is-supported-script":[jt,[Dt],(r,[t])=>{const i=r.globals&&r.globals.isSupportedScript;return!i||i(t.evaluate(r))}],upcase:[Dt,[Dt],(r,[t])=>t.evaluate(r).toUpperCase()],downcase:[Dt,[Dt],(r,[t])=>t.evaluate(r).toLowerCase()],concat:[Dt,In(Zt),(r,t)=>t.map(i=>es(i.evaluate(r))).join("")],"resolved-locale":[Dt,[Mr],(r,[t])=>t.evaluate(r).resolvedLocale()]});class ja{constructor(t,i,s){this.expression=t,this._warningHistory={},this._evaluator=new Xt,this._defaultValue=i?function(a){if(a.type==="color"&&Na(a.default))return new Jt(0,0,0,0);switch(a.type){case"color":return Jt.parse(a.default)||null;case"padding":return pi.parse(a.default)||null;case"numberArray":return fi.parse(a.default)||null;case"colorArray":return ti.parse(a.default)||null;case"variableAnchorOffsetCollection":return Ti.parse(a.default)||null;case"projectionDefinition":return mi.parse(a.default)||null;default:return a.default===void 0?null:a.default}}(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this._globalState=s}evaluateWithoutErrorHandling(t,i,s,a,l,u){return this._globalState&&(t=us(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=i,this._evaluator.featureState=s,this._evaluator.canonical=a,this._evaluator.availableImages=l||null,this._evaluator.formattedSection=u,this.expression.evaluate(this._evaluator)}evaluate(t,i,s,a,l,u){this._globalState&&(t=us(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=i||null,this._evaluator.featureState=s||null,this._evaluator.canonical=a,this._evaluator.availableImages=l||null,this._evaluator.formattedSection=u||null;try{const f=this.expression.evaluate(this._evaluator);if(f==null||typeof f=="number"&&f!=f)return this._defaultValue;if(this._enumValues&&!(f in this._enumValues))throw new _e(`Expected value to be one of ${Object.keys(this._enumValues).map(g=>JSON.stringify(g)).join(", ")}, but found ${JSON.stringify(f)} instead.`);return f}catch(f){return this._warningHistory[f.message]||(this._warningHistory[f.message]=!0,typeof console<"u"&&console.warn(f.message)),this._defaultValue}}}function Ua(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in os}function Ga(r,t,i){const s=new is(os,Ba,[],t?function(l){const u={color:Di,string:Dt,number:bt,enum:Dt,boolean:jt,formatted:Xn,padding:Yn,numberArray:vn,colorArray:ir,projectionDefinition:xn,resolvedImage:Kn,variableAnchorOffsetCollection:Jn};return l.type==="array"?Vi(u[l.value]||Zt,l.length):u[l.type]}(t):void 0),a=s.parse(r,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?bc(new ja(a,t,i)):ls(s.errors)}class En{constructor(t,i,s){this.kind=t,this._styleExpression=i,this.isStateDependent=t!=="constant"&&!Gs(i.expression),this.globalStateRefs=Wa(i.expression),this._globalState=s}evaluateWithoutErrorHandling(t,i,s,a,l,u){return this._globalState&&(t=us(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,i,s,a,l,u)}evaluate(t,i,s,a,l,u){return this._globalState&&(t=us(t,this._globalState)),this._styleExpression.evaluate(t,i,s,a,l,u)}}class Za{constructor(t,i,s,a,l){this.kind=t,this.zoomStops=s,this._styleExpression=i,this.isStateDependent=t!=="camera"&&!Gs(i.expression),this.globalStateRefs=Wa(i.expression),this.interpolationType=a,this._globalState=l}evaluateWithoutErrorHandling(t,i,s,a,l,u){return this._globalState&&(t=us(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,i,s,a,l,u)}evaluate(t,i,s,a,l,u){return this._globalState&&(t=us(t,this._globalState)),this._styleExpression.evaluate(t,i,s,a,l,u)}interpolationFactor(t,i,s){return this.interpolationType?ci.interpolationFactor(this.interpolationType,t,i,s):0}}function Pc(r,t,i){const s=Ga(r,t,i);if(s.result==="error")return s;const a=s.value.expression,l=Oa(a);if(!l&&!cs(t))return ls([new fe("","data expressions not supported")]);const u=Va(a,["zoom"]);if(!u&&!wc(t))return ls([new fe("","zoom expressions not supported")]);const f=qa(a);return f||u?f instanceof fe?ls([f]):f instanceof ci&&!Jo(t)?ls([new fe("",'"interpolate" expressions cannot be used with this property')]):bc(f?new Za(l?"camera":"composite",s.value,f.labels,f instanceof ci?f.interpolation:void 0,i):new En(l?"constant":"source",s.value,i)):ls([new fe("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class $a{constructor(t,i){this._parameters=t,this._specification=i,ve(this,Tc(this._parameters,this._specification))}static deserialize(t){return new $a(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function qa(r){let t=null;if(r instanceof re)t=qa(r.result);else if(r instanceof ss){for(const i of r.args)if(t=qa(i),t)break}else(r instanceof ns||r instanceof ci)&&r.input instanceof qi&&r.input.name==="zoom"&&(t=r);return t instanceof fe||r.eachChild(i=>{const s=qa(i);s instanceof fe?t=s:!t&&s?t=new fe("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&s&&t!==s&&(t=new fe("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function Wa(r,t=new Set){return r instanceof Us&&t.add(r.key),r.eachChild(i=>{Wa(i,t)}),t}function us(r,t){const{zoom:i,heatmapDensity:s,elevation:a,lineProgress:l,isSupportedScript:u,accumulated:f}=r??{};return{zoom:i,heatmapDensity:s,elevation:a,lineProgress:l,isSupportedScript:u,accumulated:f,globalState:t}}function Ha(r){if(r===!0||r===!1)return!0;if(!Array.isArray(r)||r.length===0)return!1;switch(r[0]){case"has":return r.length>=2&&r[1]!=="$id"&&r[1]!=="$type";case"in":return r.length>=3&&(typeof r[1]!="string"||Array.isArray(r[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return r.length!==3||Array.isArray(r[1])||Array.isArray(r[2]);case"any":case"all":for(const t of r.slice(1))if(!Ha(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}const Mc={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function $s(r,t){if(r==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Ha(r)||(r=qs(r));const i=Ga(r,Mc,t);if(i.result==="error")throw new Error(i.value.map(s=>`${s.key}: ${s.message}`).join(", "));return{filter:(s,a,l)=>i.value.evaluate(s,a,{},l),needGeometry:tl(r),getGlobalStateRefs:()=>Wa(i.value.expression)}}function ju(r,t){return r<t?-1:r>t?1:0}function tl(r){if(!Array.isArray(r))return!1;if(r[0]==="within"||r[0]==="distance")return!0;for(let t=1;t<r.length;t++)if(tl(r[t]))return!0;return!1}function qs(r){if(!r)return!0;const t=r[0];return r.length<=1?t!=="any":t==="=="?Xa(r[1],r[2],"=="):t==="!="?Ya(Xa(r[1],r[2],"==")):t==="<"||t===">"||t==="<="||t===">="?Xa(r[1],r[2],t):t==="any"?(i=r.slice(1),["any"].concat(i.map(qs))):t==="all"?["all"].concat(r.slice(1).map(qs)):t==="none"?["all"].concat(r.slice(1).map(qs).map(Ya)):t==="in"?Ic(r[1],r.slice(2)):t==="!in"?Ya(Ic(r[1],r.slice(2))):t==="has"?Ec(r[1]):t!=="!has"||Ya(Ec(r[1]));var i}function Xa(r,t,i){switch(r){case"$type":return[`filter-type-${i}`,t];case"$id":return[`filter-id-${i}`,t];default:return[`filter-${i}`,r,t]}}function Ic(r,t){if(t.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(i=>typeof i!=typeof t[0])?["filter-in-large",r,["literal",t.sort(ju)]]:["filter-in-small",r,["literal",t]]}}function Ec(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function Ya(r){return["!",r]}function el(r){const t=typeof r;if(t==="number"||t==="boolean"||t==="string"||r==null)return JSON.stringify(r);if(Array.isArray(r)){let a="[";for(const l of r)a+=`${el(l)},`;return`${a}]`}const i=Object.keys(r).sort();let s="{";for(let a=0;a<i.length;a++)s+=`${JSON.stringify(i[a])}:${el(r[i[a]])},`;return`${s}}`}function Cc(r){let t="";for(const i of rt)t+=`/${el(r[i])}`;return t}function il(r){const t=r.value;return t?[new xt(r.key,t,"constants have been deprecated as of v8")]:[]}function Ce(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function Er(r){if(Array.isArray(r))return r.map(Er);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const t={};for(const i in r)t[i]=Er(r[i]);return t}return Ce(r)}function Li(r){const t=r.key,i=r.value,s=r.valueSpec||{},a=r.objectElementValidators||{},l=r.style,u=r.styleSpec,f=r.validateSpec;let g=[];const y=Qt(i);if(y!=="object")return[new xt(t,i,`object expected, ${y} found`)];for(const v in i){const w=v.split(".")[0],S=Ir(s,w)||s["*"];let P;if(Ir(a,w))P=a[w];else if(Ir(s,w))P=f;else if(a["*"])P=a["*"];else{if(!s["*"]){g.push(new xt(t,i[v],`unknown property "${v}"`));continue}P=f}g=g.concat(P({key:(t&&`${t}.`)+v,value:i[v],valueSpec:S,style:l,styleSpec:u,object:i,objectKey:v,validateSpec:f},i))}for(const v in s)a[v]||s[v].required&&s[v].default===void 0&&i[v]===void 0&&g.push(new xt(t,i,`missing required property "${v}"`));return g}function Ws(r){const t=r.value,i=r.valueSpec,s=r.style,a=r.styleSpec,l=r.key,u=r.arrayElementValidator||r.validateSpec;if(Qt(t)!=="array")return[new xt(l,t,`array expected, ${Qt(t)} found`)];if(i.length&&t.length!==i.length)return[new xt(l,t,`array length ${i.length} expected, length ${t.length} found`)];if(i["min-length"]&&t.length<i["min-length"])return[new xt(l,t,`array length at least ${i["min-length"]} expected, length ${t.length} found`)];let f={type:i.value,values:i.values};a.$version<7&&(f.function=i.function),Qt(i.value)==="object"&&(f=i.value);let g=[];for(let y=0;y<t.length;y++)g=g.concat(u({array:t,arrayIndex:y,value:t[y],valueSpec:f,validateSpec:r.validateSpec,style:s,styleSpec:a,key:`${l}[${y}]`}));return g}function Cn(r){const t=r.key,i=r.value,s=r.valueSpec;let a=Qt(i);return a==="number"&&i!=i&&(a="NaN"),a!=="number"?[new xt(t,i,`number expected, ${a} found`)]:"minimum"in s&&i<s.minimum?[new xt(t,i,`${i} is less than the minimum value ${s.minimum}`)]:"maximum"in s&&i>s.maximum?[new xt(t,i,`${i} is greater than the maximum value ${s.maximum}`)]:[]}function Ac(r){const t=r.valueSpec,i=Ce(r.value.type);let s,a,l,u={};const f=i!=="categorical"&&r.value.property===void 0,g=!f,y=Qt(r.value.stops)==="array"&&Qt(r.value.stops[0])==="array"&&Qt(r.value.stops[0][0])==="object",v=Li({key:r.key,value:r.value,valueSpec:r.styleSpec.function,validateSpec:r.validateSpec,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{stops:function(P){if(i==="identity")return[new xt(P.key,P.value,'identity function may not have a "stops" property')];let M=[];const C=P.value;return M=M.concat(Ws({key:P.key,value:C,valueSpec:P.valueSpec,validateSpec:P.validateSpec,style:P.style,styleSpec:P.styleSpec,arrayElementValidator:w})),Qt(C)==="array"&&C.length===0&&M.push(new xt(P.key,C,"array must have at least one stop")),M},default:function(P){return P.validateSpec({key:P.key,value:P.value,valueSpec:t,validateSpec:P.validateSpec,style:P.style,styleSpec:P.styleSpec})}}});return i==="identity"&&f&&v.push(new xt(r.key,r.value,'missing required property "property"')),i==="identity"||r.value.stops||v.push(new xt(r.key,r.value,'missing required property "stops"')),i==="exponential"&&r.valueSpec.expression&&!Jo(r.valueSpec)&&v.push(new xt(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(g&&!cs(r.valueSpec)?v.push(new xt(r.key,r.value,"property functions not supported")):f&&!wc(r.valueSpec)&&v.push(new xt(r.key,r.value,"zoom functions not supported"))),i!=="categorical"&&!y||r.value.property!==void 0||v.push(new xt(r.key,r.value,'"property" property is required')),v;function w(P){let M=[];const C=P.value,z=P.key;if(Qt(C)!=="array")return[new xt(z,C,`array expected, ${Qt(C)} found`)];if(C.length!==2)return[new xt(z,C,`array length 2 expected, length ${C.length} found`)];if(y){if(Qt(C[0])!=="object")return[new xt(z,C,`object expected, ${Qt(C[0])} found`)];if(C[0].zoom===void 0)return[new xt(z,C,"object stop key must have zoom")];if(C[0].value===void 0)return[new xt(z,C,"object stop key must have value")];if(l&&l>Ce(C[0].zoom))return[new xt(z,C[0].zoom,"stop zoom values must appear in ascending order")];Ce(C[0].zoom)!==l&&(l=Ce(C[0].zoom),a=void 0,u={}),M=M.concat(Li({key:`${z}[0]`,value:C[0],valueSpec:{zoom:{}},validateSpec:P.validateSpec,style:P.style,styleSpec:P.styleSpec,objectElementValidators:{zoom:Cn,value:S}}))}else M=M.concat(S({key:`${z}[0]`,value:C[0],validateSpec:P.validateSpec,style:P.style,styleSpec:P.styleSpec},C));return Ua(Er(C[1]))?M.concat([new xt(`${z}[1]`,C[1],"expressions are not allowed in function stops.")]):M.concat(P.validateSpec({key:`${z}[1]`,value:C[1],valueSpec:t,validateSpec:P.validateSpec,style:P.style,styleSpec:P.styleSpec}))}function S(P,M){const C=Qt(P.value),z=Ce(P.value),F=P.value!==null?P.value:M;if(s){if(C!==s)return[new xt(P.key,F,`${C} stop domain type must match previous stop domain type ${s}`)]}else s=C;if(C!=="number"&&C!=="string"&&C!=="boolean")return[new xt(P.key,F,"stop domain value must be a number, string, or boolean")];if(C!=="number"&&i!=="categorical"){let Z=`number expected, ${C} found`;return cs(t)&&i===void 0&&(Z+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new xt(P.key,F,Z)]}return i!=="categorical"||C!=="number"||isFinite(z)&&Math.floor(z)===z?i!=="categorical"&&C==="number"&&a!==void 0&&z<a?[new xt(P.key,F,"stop domain values must appear in ascending order")]:(a=z,i==="categorical"&&z in u?[new xt(P.key,F,"stop domain values must be unique")]:(u[z]=!0,[])):[new xt(P.key,F,`integer expected, found ${z}`)]}}function hs(r){const t=(r.expressionContext==="property"?Pc:Ga)(Er(r.value),r.valueSpec);if(t.result==="error")return t.value.map(s=>new xt(`${r.key}${s.key}`,r.value,s.message));const i=t.value.expression||t.value._styleExpression.expression;if(r.expressionContext==="property"&&r.propertyKey==="text-font"&&!i.outputDefined())return[new xt(r.key,r.value,`Invalid data expression for "${r.propertyKey}". Output values must be contained as literals within the expression.`)];if(r.expressionContext==="property"&&r.propertyType==="layout"&&!Gs(i))return[new xt(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if(r.expressionContext==="filter"&&!Gs(i))return[new xt(r.key,r.value,'"feature-state" data expressions are not supported with filters.')];if(r.expressionContext&&r.expressionContext.indexOf("cluster")===0){if(!Va(i,["zoom","feature-state"]))return[new xt(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(r.expressionContext==="cluster-initial"&&!Oa(i))return[new xt(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function rl(r){const t=r.key,i=r.value,s=Qt(i);return s!=="string"?[new xt(t,i,`color expected, ${s} found`)]:Jt.parse(String(i))?[]:[new xt(t,i,`color expected, "${i}" found`)]}function Hs(r){const t=r.key,i=r.value,s=r.valueSpec,a=[];return Array.isArray(s.values)?s.values.indexOf(Ce(i))===-1&&a.push(new xt(t,i,`expected one of [${s.values.join(", ")}], ${JSON.stringify(i)} found`)):Object.keys(s.values).indexOf(Ce(i))===-1&&a.push(new xt(t,i,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(i)} found`)),a}function nl(r){return Ha(Er(r.value))?hs(ve({},r,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Dc(r)}function Dc(r){const t=r.value,i=r.key;if(Qt(t)!=="array")return[new xt(i,t,`array expected, ${Qt(t)} found`)];const s=r.styleSpec;let a,l=[];if(t.length<1)return[new xt(i,t,"filter array must have at least 1 element")];switch(l=l.concat(Hs({key:`${i}[0]`,value:t[0],valueSpec:s.filter_operator,style:r.style,styleSpec:r.styleSpec})),Ce(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&Ce(t[1])==="$type"&&l.push(new xt(i,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&l.push(new xt(i,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(a=Qt(t[1]),a!=="string"&&l.push(new xt(`${i}[1]`,t[1],`string expected, ${a} found`)));for(let u=2;u<t.length;u++)a=Qt(t[u]),Ce(t[1])==="$type"?l=l.concat(Hs({key:`${i}[${u}]`,value:t[u],valueSpec:s.geometry_type,style:r.style,styleSpec:r.styleSpec})):a!=="string"&&a!=="number"&&a!=="boolean"&&l.push(new xt(`${i}[${u}]`,t[u],`string, number, or boolean expected, ${a} found`));break;case"any":case"all":case"none":for(let u=1;u<t.length;u++)l=l.concat(Dc({key:`${i}[${u}]`,value:t[u],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":a=Qt(t[1]),t.length!==2?l.push(new xt(i,t,`filter array for "${t[0]}" operator must have 2 elements`)):a!=="string"&&l.push(new xt(`${i}[1]`,t[1],`string expected, ${a} found`))}return l}function sl(r,t){const i=r.key,s=r.validateSpec,a=r.style,l=r.styleSpec,u=r.value,f=r.objectKey,g=l[`${t}_${r.layerType}`];if(!g)return[];const y=f.match(/^(.*)-transition$/);if(t==="paint"&&y&&g[y[1]]&&g[y[1]].transition)return s({key:i,value:u,valueSpec:l.transition,style:a,styleSpec:l});const v=r.valueSpec||g[f];if(!v)return[new xt(i,u,`unknown property "${f}"`)];let w;if(Qt(u)==="string"&&cs(v)&&!v.tokens&&(w=/^{([^}]+)}$/.exec(u)))return[new xt(i,u,`"${f}" does not support interpolation syntax
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(w[1])} }\`.`)];const S=[];return r.layerType==="symbol"&&f==="text-font"&&Na(Er(u))&&Ce(u.type)==="identity"&&S.push(new xt(i,u,'"text-font" does not support identity functions')),S.concat(s({key:r.key,value:u,valueSpec:v,style:a,styleSpec:l,expressionContext:"property",propertyType:t,propertyKey:f}))}function al(r){return sl(r,"paint")}function Xs(r){return sl(r,"layout")}function zc(r){let t=[];const i=r.value,s=r.key,a=r.style,l=r.styleSpec;if(Qt(i)!=="object")return[new xt(s,i,`object expected, ${Qt(i)} found`)];i.type||i.ref||t.push(new xt(s,i,'either "type" or "ref" is required'));let u=Ce(i.type);const f=Ce(i.ref);if(i.id){const g=Ce(i.id);for(let y=0;y<r.arrayIndex;y++){const v=a.layers[y];Ce(v.id)===g&&t.push(new xt(s,i.id,`duplicate layer id "${i.id}", previously used at line ${v.id.__line__}`))}}if("ref"in i){let g;["type","source","source-layer","filter","layout"].forEach(y=>{y in i&&t.push(new xt(s,i[y],`"${y}" is prohibited for ref layers`))}),a.layers.forEach(y=>{Ce(y.id)===f&&(g=y)}),g?g.ref?t.push(new xt(s,i.ref,"ref cannot reference another ref layer")):u=Ce(g.type):t.push(new xt(s,i.ref,`ref layer "${f}" not found`))}else if(u!=="background")if(i.source){const g=a.sources&&a.sources[i.source],y=g&&Ce(g.type);g?y==="vector"&&u==="raster"?t.push(new xt(s,i.source,`layer "${i.id}" requires a raster source`)):y!=="raster-dem"&&u==="hillshade"||y!=="raster-dem"&&u==="color-relief"?t.push(new xt(s,i.source,`layer "${i.id}" requires a raster-dem source`)):y==="raster"&&u!=="raster"?t.push(new xt(s,i.source,`layer "${i.id}" requires a vector source`)):y!=="vector"||i["source-layer"]?y==="raster-dem"&&u!=="hillshade"&&u!=="color-relief"?t.push(new xt(s,i.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):u!=="line"||!i.paint||!i.paint["line-gradient"]||y==="geojson"&&g.lineMetrics||t.push(new xt(s,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new xt(s,i,`layer "${i.id}" must specify a "source-layer"`)):t.push(new xt(s,i.source,`source "${i.source}" not found`))}else t.push(new xt(s,i,'missing required property "source"'));return t=t.concat(Li({key:s,value:i,valueSpec:l.layer,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,objectElementValidators:{"*":()=>[],type:()=>r.validateSpec({key:`${s}.type`,value:i.type,valueSpec:l.layer.type,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,object:i,objectKey:"type"}),filter:nl,layout:g=>Li({layer:i,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":y=>Xs(ve({layerType:u},y))}}),paint:g=>Li({layer:i,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":y=>al(ve({layerType:u},y))}})}})),t}function rn(r){const t=r.value,i=r.key,s=Qt(t);return s!=="string"?[new xt(i,t,`string expected, ${s} found`)]:[]}const ol={promoteId:function({key:r,value:t}){if(Qt(t)==="string")return rn({key:r,value:t});{const i=[];for(const s in t)i.push(...rn({key:`${r}.${s}`,value:t[s]}));return i}}};function kc(r){const t=r.value,i=r.key,s=r.styleSpec,a=r.style,l=r.validateSpec;if(!t.type)return[new xt(i,t,'"type" is required')];const u=Ce(t.type);let f;switch(u){case"vector":case"raster":return f=Li({key:i,value:t,valueSpec:s[`source_${u.replace("-","_")}`],style:r.style,styleSpec:s,objectElementValidators:ol,validateSpec:l}),f;case"raster-dem":return f=function(g){var y;const v=(y=g.sourceName)!==null&&y!==void 0?y:"",w=g.value,S=g.styleSpec,P=S.source_raster_dem,M=g.style;let C=[];const z=Qt(w);if(w===void 0)return C;if(z!=="object")return C.push(new xt("source_raster_dem",w,`object expected, ${z} found`)),C;const F=Ce(w.encoding)==="custom",Z=["redFactor","greenFactor","blueFactor","baseShift"],O=g.value.encoding?`"${g.value.encoding}"`:"Default";for(const j in w)!F&&Z.includes(j)?C.push(new xt(j,w[j],`In "${v}": "${j}" is only valid when "encoding" is set to "custom". ${O} encoding found`)):P[j]?C=C.concat(g.validateSpec({key:j,value:w[j],valueSpec:P[j],validateSpec:g.validateSpec,style:M,styleSpec:S})):C.push(new xt(j,w[j],`unknown property "${j}"`));return C}({sourceName:i,value:t,style:r.style,styleSpec:s,validateSpec:l}),f;case"geojson":if(f=Li({key:i,value:t,valueSpec:s.source_geojson,style:a,styleSpec:s,validateSpec:l,objectElementValidators:ol}),t.cluster)for(const g in t.clusterProperties){const[y,v]=t.clusterProperties[g],w=typeof y=="string"?[y,["accumulated"],["get",g]]:y;f.push(...hs({key:`${i}.${g}.map`,value:v,expressionContext:"cluster-map"})),f.push(...hs({key:`${i}.${g}.reduce`,value:w,expressionContext:"cluster-reduce"}))}return f;case"video":return Li({key:i,value:t,valueSpec:s.source_video,style:a,validateSpec:l,styleSpec:s});case"image":return Li({key:i,value:t,valueSpec:s.source_image,style:a,validateSpec:l,styleSpec:s});case"canvas":return[new xt(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Hs({key:`${i}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function ll(r){const t=r.value,i=r.styleSpec,s=i.light,a=r.style;let l=[];const u=Qt(t);if(t===void 0)return l;if(u!=="object")return l=l.concat([new xt("light",t,`object expected, ${u} found`)]),l;for(const f in t){const g=f.match(/^(.*)-transition$/);l=l.concat(g&&s[g[1]]&&s[g[1]].transition?r.validateSpec({key:f,value:t[f],valueSpec:i.transition,validateSpec:r.validateSpec,style:a,styleSpec:i}):s[f]?r.validateSpec({key:f,value:t[f],valueSpec:s[f],validateSpec:r.validateSpec,style:a,styleSpec:i}):[new xt(f,t[f],`unknown property "${f}"`)])}return l}function cl(r){const t=r.value,i=r.styleSpec,s=i.sky,a=r.style,l=Qt(t);if(t===void 0)return[];if(l!=="object")return[new xt("sky",t,`object expected, ${l} found`)];let u=[];for(const f in t)u=u.concat(s[f]?r.validateSpec({key:f,value:t[f],valueSpec:s[f],style:a,styleSpec:i}):[new xt(f,t[f],`unknown property "${f}"`)]);return u}function ds(r){const t=r.value,i=r.styleSpec,s=i.terrain,a=r.style;let l=[];const u=Qt(t);if(t===void 0)return l;if(u!=="object")return l=l.concat([new xt("terrain",t,`object expected, ${u} found`)]),l;for(const f in t)l=l.concat(s[f]?r.validateSpec({key:f,value:t[f],valueSpec:s[f],validateSpec:r.validateSpec,style:a,styleSpec:i}):[new xt(f,t[f],`unknown property "${f}"`)]);return l}function Rc(r){let t=[];const i=r.value,s=r.key;if(Array.isArray(i)){const a=[],l=[];for(const u in i)i[u].id&&a.includes(i[u].id)&&t.push(new xt(s,i,`all the sprites' ids must be unique, but ${i[u].id} is duplicated`)),a.push(i[u].id),i[u].url&&l.includes(i[u].url)&&t.push(new xt(s,i,`all the sprites' URLs must be unique, but ${i[u].url} is duplicated`)),l.push(i[u].url),t=t.concat(Li({key:`${s}[${u}]`,value:i[u],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:r.validateSpec}));return t}return rn({key:s,value:i})}function Lc(r){return t=r.value,t&&t.constructor===Object?[]:[new xt(r.key,r.value,`object expected, ${Qt(r.value)} found`)];var t}const Fc={"*":()=>[],array:Ws,boolean:function(r){const t=r.value,i=r.key,s=Qt(t);return s!=="boolean"?[new xt(i,t,`boolean expected, ${s} found`)]:[]},number:Cn,color:rl,constants:il,enum:Hs,filter:nl,function:Ac,layer:zc,object:Li,source:kc,light:ll,sky:cl,terrain:ds,projection:function(r){const t=r.value,i=r.styleSpec,s=i.projection,a=r.style,l=Qt(t);if(t===void 0)return[];if(l!=="object")return[new xt("projection",t,`object expected, ${l} found`)];let u=[];for(const f in t)u=u.concat(s[f]?r.validateSpec({key:f,value:t[f],valueSpec:s[f],style:a,styleSpec:i}):[new xt(f,t[f],`unknown property "${f}"`)]);return u},projectionDefinition:function(r){const t=r.key;let i=r.value;i=i instanceof String?i.valueOf():i;const s=Qt(i);return s!=="array"||function(a){return Array.isArray(a)&&a.length===3&&typeof a[0]=="string"&&typeof a[1]=="string"&&typeof a[2]=="number"}(i)||function(a){return!!["interpolate","step","literal"].includes(a[0])}(i)?["array","string"].includes(s)?[]:[new xt(t,i,`projection expected, invalid type "${s}" found`)]:[new xt(t,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]},string:rn,formatted:function(r){return rn(r).length===0?[]:hs(r)},resolvedImage:function(r){return rn(r).length===0?[]:hs(r)},padding:function(r){const t=r.key,i=r.value;if(Qt(i)==="array"){if(i.length<1||i.length>4)return[new xt(t,i,`padding requires 1 to 4 values; ${i.length} values found`)];const s={type:"number"};let a=[];for(let l=0;l<i.length;l++)a=a.concat(r.validateSpec({key:`${t}[${l}]`,value:i[l],validateSpec:r.validateSpec,valueSpec:s}));return a}return Cn({key:t,value:i,valueSpec:{}})},numberArray:function(r){const t=r.key,i=r.value;if(Qt(i)==="array"){const s={type:"number"};if(i.length<1)return[new xt(t,i,"array length at least 1 expected, length 0 found")];let a=[];for(let l=0;l<i.length;l++)a=a.concat(r.validateSpec({key:`${t}[${l}]`,value:i[l],validateSpec:r.validateSpec,valueSpec:s}));return a}return Cn({key:t,value:i,valueSpec:{}})},colorArray:function(r){const t=r.key,i=r.value;if(Qt(i)==="array"){if(i.length<1)return[new xt(t,i,"array length at least 1 expected, length 0 found")];let s=[];for(let a=0;a<i.length;a++)s=s.concat(rl({key:`${t}[${a}]`,value:i[a]}));return s}return rl({key:t,value:i})},variableAnchorOffsetCollection:function(r){const t=r.key,i=r.value,s=Qt(i),a=r.styleSpec;if(s!=="array"||i.length<1||i.length%2!=0)return[new xt(t,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let l=[];for(let u=0;u<i.length;u+=2)l=l.concat(Hs({key:`${t}[${u}]`,value:i[u],valueSpec:a.layout_symbol["text-anchor"]})),l=l.concat(Ws({key:`${t}[${u+1}]`,value:i[u+1],valueSpec:{length:2,value:"number"},validateSpec:r.validateSpec,style:r.style,styleSpec:a}));return l},sprite:Rc,state:Lc};function Ka(r){const t=r.value,i=r.valueSpec,s=r.styleSpec;return r.validateSpec=Ka,i.expression&&Na(Ce(t))?Ac(r):i.expression&&Ua(Er(t))?hs(r):i.type&&Fc[i.type]?Fc[i.type](r):Li(ve({},r,{valueSpec:i.type?s[i.type]:i}))}function Bc(r){const t=r.value,i=r.key,s=rn(r);return s.length||(t.indexOf("{fontstack}")===-1&&s.push(new xt(i,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&s.push(new xt(i,t,'"glyphs" url must include a "{range}" token'))),s}function Wi(r,t=U){let i=[];return i=i.concat(Ka({key:"",value:r,valueSpec:t.$root,styleSpec:t,style:r,validateSpec:Ka,objectElementValidators:{glyphs:Bc,"*":()=>[]}})),r.constants&&(i=i.concat(il({key:"constants",value:r.constants}))),ps(i)}function Si(r){return function(t){return r(Object.assign({},t,{validateSpec:Ka}))}}function ps(r){return[].concat(r).sort((t,i)=>t.line-i.line)}function Fe(r){return function(...t){return ps(r.apply(this,t))}}Wi.source=Fe(Si(kc)),Wi.sprite=Fe(Si(Rc)),Wi.glyphs=Fe(Si(Bc)),Wi.light=Fe(Si(ll)),Wi.sky=Fe(Si(cl)),Wi.terrain=Fe(Si(ds)),Wi.state=Fe(Si(Lc)),Wi.layer=Fe(Si(zc)),Wi.filter=Fe(Si(nl)),Wi.paintProperty=Fe(Si(al)),Wi.layoutProperty=Fe(Si(Xs));const Ys=U,An=Wi,Uu=An.light,Gu=An.sky,Ks=An.paintProperty,Oc=An.layoutProperty;function Ja(r,t){let i=!1;if(t&&t.length)for(const s of t)r.fire(new X(new Error(s.message))),i=!0;return i}class Js{constructor(t,i,s){const a=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const u=new Int32Array(this.arrayBuffer);t=u[0],this.d=(i=u[1])+2*(s=u[2]);for(let g=0;g<this.d*this.d;g++){const y=u[3+g],v=u[3+g+1];a.push(y===v?null:u.subarray(y,v))}const f=u[3+a.length+1];this.keys=u.subarray(u[3+a.length],f),this.bboxes=u.subarray(f),this.insert=this._insertReadonly}else{this.d=i+2*s;for(let u=0;u<this.d*this.d;u++)a.push([]);this.keys=[],this.bboxes=[]}this.n=i,this.extent=t,this.padding=s,this.scale=i/t,this.uid=0;const l=s/i*t;this.min=-l,this.max=t+l}insert(t,i,s,a,l){this._forEachCell(i,s,a,l,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(i),this.bboxes.push(s),this.bboxes.push(a),this.bboxes.push(l)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,i,s,a,l,u){this.cells[l].push(u)}query(t,i,s,a,l){const u=this.min,f=this.max;if(t<=u&&i<=u&&f<=s&&f<=a&&!l)return Array.prototype.slice.call(this.keys);{const g=[];return this._forEachCell(t,i,s,a,this._queryCell,g,{},l),g}}_queryCell(t,i,s,a,l,u,f,g){const y=this.cells[l];if(y!==null){const v=this.keys,w=this.bboxes;for(let S=0;S<y.length;S++){const P=y[S];if(f[P]===void 0){const M=4*P;(g?g(w[M+0],w[M+1],w[M+2],w[M+3]):t<=w[M+2]&&i<=w[M+3]&&s>=w[M+0]&&a>=w[M+1])?(f[P]=!0,u.push(v[P])):f[P]=!1}}}}_forEachCell(t,i,s,a,l,u,f,g){const y=this._convertToCellCoord(t),v=this._convertToCellCoord(i),w=this._convertToCellCoord(s),S=this._convertToCellCoord(a);for(let P=y;P<=w;P++)for(let M=v;M<=S;M++){const C=this.d*M+P;if((!g||g(this._convertFromCellCoord(P),this._convertFromCellCoord(M),this._convertFromCellCoord(P+1),this._convertFromCellCoord(M+1)))&&l.call(this,t,i,s,a,C,u,f,g))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,i=3+this.cells.length+1+1;let s=0;for(let u=0;u<this.cells.length;u++)s+=this.cells[u].length;const a=new Int32Array(i+s+this.keys.length+this.bboxes.length);a[0]=this.extent,a[1]=this.n,a[2]=this.padding;let l=i;for(let u=0;u<t.length;u++){const f=t[u];a[3+u]=l,a.set(f,l),l+=f.length}return a[3+t.length]=l,a.set(this.keys,l),l+=this.keys.length,a[3+t.length+1]=l,a.set(this.bboxes,l),l+=this.bboxes.length,a.buffer}static serialize(t,i){const s=t.toArrayBuffer();return i&&i.push(s),{buffer:s}}static deserialize(t){return new Js(t.buffer)}}const ar={};function It(r,t,i={}){if(ar[r])throw new Error(`${r} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:r,writeable:!1}),ar[r]={klass:t,omit:i.omit||[],shallow:i.shallow||[]}}It("Object",Object),It("Set",Set),It("TransferableGridIndex",Js),It("Color",Jt),It("Error",Error),It("AJAXError",er),It("ResolvedImage",zi),It("StylePropertyFunction",$a),It("StyleExpression",ja,{omit:["_evaluator"]}),It("ZoomDependentExpression",Za),It("ZoomConstantExpression",En),It("CompoundExpression",qi,{omit:["_evaluate"]});for(const r in os)os[r]._classRegistryKey||It(`Expression_${r}`,os[r]);function fs(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function ul(r){return r.$name||r.constructor._classRegistryKey}function Vc(r){return!function(t){if(t===null||typeof t!="object")return!1;const i=ul(t);return!(!i||i==="Object")}(r)&&(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||r instanceof Blob||r instanceof Error||fs(r)||pr(r)||ArrayBuffer.isView(r)||r instanceof ImageData)}function Qs(r,t){if(Vc(r))return(fs(r)||pr(r))&&t&&t.push(r),ArrayBuffer.isView(r)&&t&&t.push(r.buffer),r instanceof ImageData&&t&&t.push(r.data.buffer),r;if(Array.isArray(r)){const l=[];for(const u of r)l.push(Qs(u,t));return l}if(typeof r!="object")throw new Error("can't serialize object of type "+typeof r);const i=ul(r);if(!i)throw new Error(`can't serialize object of unregistered class ${r.constructor.name}`);if(!ar[i])throw new Error(`${i} is not registered.`);const{klass:s}=ar[i],a=s.serialize?s.serialize(r,t):{};if(s.serialize){if(t&&a===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const l in r){if(!r.hasOwnProperty(l)||ar[i].omit.indexOf(l)>=0)continue;const u=r[l];a[l]=ar[i].shallow.indexOf(l)>=0?u:Qs(u,t)}r instanceof Error&&(a.message=r.message)}if(a.$name)throw new Error("$name property is reserved for worker serialization logic.");return i!=="Object"&&(a.$name=i),a}function Cr(r){if(Vc(r))return r;if(Array.isArray(r))return r.map(Cr);if(typeof r!="object")throw new Error("can't deserialize object of type "+typeof r);const t=ul(r)||"Object";if(!ar[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:i}=ar[t];if(!i)throw new Error(`can't deserialize unregistered class ${t}`);if(i.deserialize)return i.deserialize(r);const s=Object.create(i.prototype);for(const a of Object.keys(r)){if(a==="$name")continue;const l=r[a];s[a]=ar[t].shallow.indexOf(a)>=0?l:Cr(l)}return s}class hl{constructor(){this.first=!0}update(t,i){const s=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=s,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=s,!0):(this.lastFloorZoom>s?(this.lastIntegerZoom=s+1,this.lastIntegerZoomTime=i):this.lastFloorZoom<s&&(this.lastIntegerZoom=s,this.lastIntegerZoomTime=i),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=s,!0))}}function Zu(r){return/[\u02EA\u02EB\u2E80-\u2FDF\u2FF0-\u303F\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FD-\u30FF\u3105-\u312F\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(r))}function ms(r){return/[\u02EA\u02EB\u1100-\u11FF\u1400-\u167F\u18B0-\u18F5\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u3007\u3012\u3013\u3020-\u302F\u3031-\u303F\u3041-\u3096\u309D-\u30FB\u30FD-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE48\uFE50-\uFE57\uFE5F-\uFE62\uFE67-\uFE6F\uFF00-\uFF07\uFF0A-\uFF0C\uFF0E-\uFF19\uFF1F-\uFF3A\uFF3C\uFF3E\uFF40-\uFF5A\uFFE0-\uFFE2\uFFE4-\uFFE7]|\uD802[\uDD80-\uDD9F]|\uD805[\uDD80-\uDDFF]|\uD806[\uDE00-\uDEBF]|\uD811[\uDC00-\uDE7F]|\uD81B[\uDFE0-\uDFE4\uDFF0-\uDFF6]|[\uD81C-\uD822\uD83D\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD30-\uDEFB]|\uD833[\uDEC0-\uDFCF]|\uD834[\uDC00-\uDDFF\uDEE0-\uDF7F]|\uD836[\uDC00-\uDEAF]|\uD83C[\uDC00-\uDE00\uDF00-\uDFFF]|\uD83E[\uDD00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(r))}function Nc(r){return/\s/u.test(String.fromCodePoint(r))}function ta(r){for(const t of r)if(ms(t.codePointAt(0)))return!0;return!1}function Qa(r){for(const t of r)if(!Uc(t.codePointAt(0)))return!1;return!0}function dl(r){const t=r.map(i=>{try{return new RegExp(`\\p{sc=${i}}`,"u").source}catch{return null}}).filter(i=>i);return new RegExp(t.join("|"),"u")}const jc=dl(["Arab","Dupl","Mong","Ougr","Syrc"]);function Uc(r){return!jc.test(String.fromCodePoint(r))}function pl(r){return!(ms(r)||(t=r,/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(t))));var t}const fl=dl(["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 ml(r){return fl.test(String.fromCodePoint(r))}function $u(r,t){return!(!t&&ml(r)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(r)))}function Gc(r){for(const t of r)if(ml(t.codePointAt(0)))return!0;return!1}const nn=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(r){this.pluginStatus=r.pluginStatus,this.pluginURL=r.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(r){if(nn.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=r.applyArabicShaping,this.processBidirectionalText=r.processBidirectionalText,this.processStyledBidirectionalText=r.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(r,t){return h(this,void 0,void 0,function*(){if(this.isParsed())return this.getState();if(r.pluginStatus!=="loading")return this.setState(r),r;const i=r.pluginURL,s=new Promise(l=>{this.loadScriptResolve=l});t(i);const a=new Promise(l=>setTimeout(()=>l(),this.TIMEOUT));if(yield Promise.race([s,a]),this.isParsed()){const l={pluginStatus:"loaded",pluginURL:i};return this.setState(l),l}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${i}`)})}};class ce{constructor(t,i){this.isSupportedScript=qu,this.zoom=t,i?(this.now=i.now||0,this.fadeDuration=i.fadeDuration||0,this.zoomHistory=i.zoomHistory||new hl,this.transition=i.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new hl,this.transition={})}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,i=t-Math.floor(t),s=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:i+(1-i)*s}:{fromScale:.5,toScale:1,t:1-(1-s)*i}}}function qu(r){return function(t,i){for(const s of t)if(!$u(s.codePointAt(0),i))return!1;return!0}(r,nn.getRTLTextPluginStatus()==="loaded")}const ea="-transition";class ia{constructor(t,i,s){this.property=t,this.value=i,this.expression=function(a,l,u){if(Na(a))return new $a(a,l);if(Ua(a)){const f=Pc(a,l,u);if(f.result==="error")throw new Error(f.value.map(g=>`${g.key}: ${g.message}`).join(", "));return f.value}{let f=a;return l.type==="color"&&typeof a=="string"?f=Jt.parse(a):l.type!=="padding"||typeof a!="number"&&!Array.isArray(a)?l.type!=="numberArray"||typeof a!="number"&&!Array.isArray(a)?l.type!=="colorArray"||typeof a!="string"&&!Array.isArray(a)?l.type==="variableAnchorOffsetCollection"&&Array.isArray(a)?f=Ti.parse(a):l.type==="projectionDefinition"&&typeof a=="string"&&(f=mi.parse(a)):f=ti.parse(a):f=fi.parse(a):f=pi.parse(a),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>f}}}(i===void 0?t.specification.default:i,t.specification,s)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(t,i,s){return this.property.possiblyEvaluate(this,t,i,s)}}class gl{constructor(t,i){this.property=t,this.value=new ia(t,void 0,i)}transitioned(t,i){return new _l(this.property,this.value,i,di({},t.transition,this.transition),t.now)}untransitioned(){return new _l(this.property,this.value,null,{},0)}}class Zc{constructor(t,i){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues),this._globalState=i}getValue(t){return Zi(this._values[t].value.value)}setValue(t,i){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new gl(this._values[t].property,this._globalState)),this._values[t].value=new ia(this._values[t].property,i===null?void 0:Zi(i),this._globalState)}getTransition(t){return Zi(this._values[t].transition)}setTransition(t,i){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new gl(this._values[t].property,this._globalState)),this._values[t].transition=Zi(i)||void 0}serialize(){const t={};for(const i of Object.keys(this._values)){const s=this.getValue(i);s!==void 0&&(t[i]=s);const a=this.getTransition(i);a!==void 0&&(t[`${i}${ea}`]=a)}return t}transitioned(t,i){const s=new yl(this._properties);for(const a of Object.keys(this._values))s._values[a]=this._values[a].transitioned(t,i._values[a]);return s}untransitioned(){const t=new yl(this._properties);for(const i of Object.keys(this._values))t._values[i]=this._values[i].untransitioned();return t}}class _l{constructor(t,i,s,a,l){this.property=t,this.value=i,this.begin=l+a.delay||0,this.end=this.begin+a.duration||0,t.specification.transition&&(a.delay||a.duration)&&(this.prior=s)}possiblyEvaluate(t,i,s){const a=t.now||0,l=this.value.possiblyEvaluate(t,i,s),u=this.prior;if(u){if(a>this.end)return this.prior=null,l;if(this.value.isDataDriven())return this.prior=null,l;if(a<this.begin)return u.possiblyEvaluate(t,i,s);{const f=(a-this.begin)/(this.end-this.begin);return this.property.interpolate(u.possiblyEvaluate(t,i,s),l,wa(f))}}return l}}class yl{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,i,s){const a=new Dn(this._properties);for(const l of Object.keys(this._values))a._values[l]=this._values[l].possiblyEvaluate(t,i,s);return a}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class $c{constructor(t,i){this._properties=t,this._values=Object.create(t.defaultPropertyValues),this._globalState=i}hasValue(t){return this._values[t].value!==void 0}getValue(t){return Zi(this._values[t].value)}setValue(t,i){this._values[t]=new ia(this._values[t].property,i===null?void 0:Zi(i),this._globalState)}serialize(){const t={};for(const i of Object.keys(this._values)){const s=this.getValue(i);s!==void 0&&(t[i]=s)}return t}possiblyEvaluate(t,i,s){const a=new Dn(this._properties);for(const l of Object.keys(this._values))a._values[l]=this._values[l].possiblyEvaluate(t,i,s);return a}}class or{constructor(t,i,s){this.property=t,this.value=i,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,i,s,a){return this.property.evaluate(this.value,this.parameters,t,i,s,a)}}class Dn{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class zt{constructor(t){this.specification=t}possiblyEvaluate(t,i){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(i)}interpolate(t,i,s){const a=nr[this.specification.type];return a?a(t,i,s):t}}class Vt{constructor(t,i){this.specification=t,this.overrides=i}possiblyEvaluate(t,i,s,a){return new or(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(i,null,{},s,a)}:t.expression,i)}interpolate(t,i,s){if(t.value.kind!=="constant"||i.value.kind!=="constant")return t;if(t.value.value===void 0||i.value.value===void 0)return new or(this,{kind:"constant",value:void 0},t.parameters);const a=nr[this.specification.type];if(a){const l=a(t.value.value,i.value.value,s);return new or(this,{kind:"constant",value:l},t.parameters)}return t}evaluate(t,i,s,a,l,u){return t.kind==="constant"?t.value:t.evaluate(i,s,a,l,u)}}class ra extends Vt{possiblyEvaluate(t,i,s,a){if(t.value===void 0)return new or(this,{kind:"constant",value:void 0},i);if(t.expression.kind==="constant"){const l=t.expression.evaluate(i,null,{},s,a),u=t.property.specification.type==="resolvedImage"&&typeof l!="string"?l.name:l,f=this._calculate(u,u,u,i);return new or(this,{kind:"constant",value:f},i)}if(t.expression.kind==="camera"){const l=this._calculate(t.expression.evaluate({zoom:i.zoom-1}),t.expression.evaluate({zoom:i.zoom}),t.expression.evaluate({zoom:i.zoom+1}),i);return new or(this,{kind:"constant",value:l},i)}return new or(this,t.expression,i)}evaluate(t,i,s,a,l,u){if(t.kind==="source"){const f=t.evaluate(i,s,a,l,u);return this._calculate(f,f,f,i)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(i.zoom)-1},s,a),t.evaluate({zoom:Math.floor(i.zoom)},s,a),t.evaluate({zoom:Math.floor(i.zoom)+1},s,a),i):t.value}_calculate(t,i,s,a){return a.zoom>a.zoomHistory.lastIntegerZoom?{from:t,to:i}:{from:s,to:i}}interpolate(t){return t}}class qc{constructor(t){this.specification=t}possiblyEvaluate(t,i,s,a){if(t.value!==void 0){if(t.expression.kind==="constant"){const l=t.expression.evaluate(i,null,{},s,a);return this._calculate(l,l,l,i)}return this._calculate(t.expression.evaluate(new ce(Math.floor(i.zoom-1),i)),t.expression.evaluate(new ce(Math.floor(i.zoom),i)),t.expression.evaluate(new ce(Math.floor(i.zoom+1),i)),i)}}_calculate(t,i,s,a){return a.zoom>a.zoomHistory.lastIntegerZoom?{from:t,to:i}:{from:s,to:i}}interpolate(t){return t}}class na{constructor(t){this.specification=t}possiblyEvaluate(t,i,s,a){return!!t.expression.evaluate(i,null,{},s,a)}interpolate(){return!1}}class gi{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const i in t){const s=t[i];s.specification.overridable&&this.overridableProperties.push(i);const a=this.defaultPropertyValues[i]=new ia(s,void 0,void 0),l=this.defaultTransitionablePropertyValues[i]=new gl(s,void 0);this.defaultTransitioningPropertyValues[i]=l.untransitioned(),this.defaultPossiblyEvaluatedValues[i]=a.possiblyEvaluate({})}}}It("DataDrivenProperty",Vt),It("DataConstantProperty",zt),It("CrossFadedDataDrivenProperty",ra),It("CrossFadedProperty",qc),It("ColorRampProperty",na);class Hi extends nt{constructor(t,i,s){if(super(),this.id=t.id,this.type=t.type,this._globalState=s,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},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,this._featureFilter=$s(t.filter,s)),i.layout&&(this._unevaluatedLayout=new $c(i.layout,s)),i.paint)){this._transitionablePaint=new Zc(i.paint,s);for(const a in t.paint)this.setPaintProperty(a,t.paint[a],{validate:!1});for(const a in t.layout)this.setLayoutProperty(a,t.layout[a],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Dn(i.paint)}}setFilter(t){this.filter=t,this._featureFilter=$s(t,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}getLayoutAffectingGlobalStateRefs(){const t=new Set;if(this._unevaluatedLayout)for(const i in this._unevaluatedLayout._values){const s=this._unevaluatedLayout._values[i];for(const a of s.getGlobalStateRefs())t.add(a)}for(const i of this._featureFilter.getGlobalStateRefs())t.add(i);return t}getPaintAffectingGlobalStateRefs(){var t;const i=new globalThis.Map;if(this._transitionablePaint)for(const s in this._transitionablePaint._values){const a=this._transitionablePaint._values[s].value;for(const l of a.getGlobalStateRefs()){const u=(t=i.get(l))!==null&&t!==void 0?t:[];u.push({name:s,value:a.value}),i.set(l,u)}}return i}setLayoutProperty(t,i,s={}){i!=null&&this._validate(Oc,`layers.${this.id}.layout.${t}`,t,i,s)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,i):this.visibility=i)}getPaintProperty(t){return t.endsWith(ea)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,i,s={}){if(i!=null&&this._validate(Ks,`layers.${this.id}.paint.${t}`,t,i,s))return!1;if(t.endsWith(ea))return this._transitionablePaint.setTransition(t.slice(0,-11),i||void 0),!1;{const a=this._transitionablePaint._values[t],l=a.property.specification["property-type"]==="cross-faded-data-driven",u=a.value.isDataDriven(),f=a.value;this._transitionablePaint.setValue(t,i),this._handleSpecialPaintPropertyUpdate(t);const g=this._transitionablePaint._values[t].value;return g.isDataDriven()||u||l||this._handleOverridablePaintPropertyUpdate(t,f,g)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,i,s){return!1}isHidden(t,i=!1){return!!(this.minzoom&&t<(i?Math.floor(this.minzoom):this.minzoom))||!!(this.maxzoom&&t>=this.maxzoom)||this.visibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,i){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,i)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,i)}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),mn(t,(i,s)=>!(i===void 0||s==="layout"&&!Object.keys(i).length||s==="paint"&&!Object.keys(i).length))}_validate(t,i,s,a,l={}){return(!l||l.validate!==!1)&&Ja(this,t.call(An,{key:i,layerType:this.type,objectKey:s,value:a,styleSpec:U,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const i=this.paint.get(t);if(i instanceof or&&cs(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}return!1}}let Wc;var Wu={get paint(){return Wc=Wc||new gi({"raster-opacity":new zt(U.paint_raster["raster-opacity"]),"raster-hue-rotate":new zt(U.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new zt(U.paint_raster["raster-brightness-min"]),"raster-brightness-max":new zt(U.paint_raster["raster-brightness-max"]),"raster-saturation":new zt(U.paint_raster["raster-saturation"]),"raster-contrast":new zt(U.paint_raster["raster-contrast"]),"raster-resampling":new zt(U.paint_raster["raster-resampling"]),"raster-fade-duration":new zt(U.paint_raster["raster-fade-duration"])})}};class Hu extends Hi{constructor(t,i){super(t,Wu,i)}}const Xu={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class sa{constructor(t,i){this._structArray=t,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class ue{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,i){return t._trim(),i&&(t.isTransferred=!0,i.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const i=Object.create(this.prototype);return i.arrayBuffer=t.arrayBuffer,i.length=t.length,i.capacity=t.arrayBuffer.byteLength/i.bytesPerElement,i._refreshViews(),i}_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 i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Ne(r,t=1){let i=0,s=0;return{members:r.map(a=>{const l=Xu[a.type].BYTES_PER_ELEMENT,u=i=Hc(i,Math.max(t,l)),f=a.components||1;return s=Math.max(s,l),i+=l*f,{name:a.name,type:a.type,components:f,offset:u}}),size:Hc(i,Math.max(s,t)),alignment:t}}function Hc(r,t){return Math.ceil(r/t)*t}class aa extends ue{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,i)}emplace(t,i,s){const a=2*t;return this.int16[a+0]=i,this.int16[a+1]=s,t}}aa.prototype.bytesPerElement=4,It("StructArrayLayout2i4",aa);class oa extends ue{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,i,s)}emplace(t,i,s,a){const l=3*t;return this.int16[l+0]=i,this.int16[l+1]=s,this.int16[l+2]=a,t}}oa.prototype.bytesPerElement=6,It("StructArrayLayout3i6",oa);class xl extends ue{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,s,a){const l=this.length;return this.resize(l+1),this.emplace(l,t,i,s,a)}emplace(t,i,s,a,l){const u=4*t;return this.int16[u+0]=i,this.int16[u+1]=s,this.int16[u+2]=a,this.int16[u+3]=l,t}}xl.prototype.bytesPerElement=8,It("StructArrayLayout4i8",xl);class vl extends ue{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,s,a,l,u){const f=this.length;return this.resize(f+1),this.emplace(f,t,i,s,a,l,u)}emplace(t,i,s,a,l,u,f){const g=6*t;return this.int16[g+0]=i,this.int16[g+1]=s,this.int16[g+2]=a,this.int16[g+3]=l,this.int16[g+4]=u,this.int16[g+5]=f,t}}vl.prototype.bytesPerElement=12,It("StructArrayLayout2i4i12",vl);class Ar extends ue{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,s,a,l,u){const f=this.length;return this.resize(f+1),this.emplace(f,t,i,s,a,l,u)}emplace(t,i,s,a,l,u,f){const g=4*t,y=8*t;return this.int16[g+0]=i,this.int16[g+1]=s,this.uint8[y+4]=a,this.uint8[y+5]=l,this.uint8[y+6]=u,this.uint8[y+7]=f,t}}Ar.prototype.bytesPerElement=8,It("StructArrayLayout2i4ub8",Ar);class gs extends ue{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,i)}emplace(t,i,s){const a=2*t;return this.float32[a+0]=i,this.float32[a+1]=s,t}}gs.prototype.bytesPerElement=8,It("StructArrayLayout2f8",gs);class la extends ue{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,s,a,l,u,f,g,y,v){const w=this.length;return this.resize(w+1),this.emplace(w,t,i,s,a,l,u,f,g,y,v)}emplace(t,i,s,a,l,u,f,g,y,v,w){const S=10*t;return this.uint16[S+0]=i,this.uint16[S+1]=s,this.uint16[S+2]=a,this.uint16[S+3]=l,this.uint16[S+4]=u,this.uint16[S+5]=f,this.uint16[S+6]=g,this.uint16[S+7]=y,this.uint16[S+8]=v,this.uint16[S+9]=w,t}}la.prototype.bytesPerElement=20,It("StructArrayLayout10ui20",la);class to extends ue{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,s,a,l,u,f,g){const y=this.length;return this.resize(y+1),this.emplace(y,t,i,s,a,l,u,f,g)}emplace(t,i,s,a,l,u,f,g,y){const v=8*t;return this.uint16[v+0]=i,this.uint16[v+1]=s,this.uint16[v+2]=a,this.uint16[v+3]=l,this.uint16[v+4]=u,this.uint16[v+5]=f,this.uint16[v+6]=g,this.uint16[v+7]=y,t}}to.prototype.bytesPerElement=16,It("StructArrayLayout8ui16",to);class ca extends ue{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,s,a,l,u,f,g,y,v,w,S){const P=this.length;return this.resize(P+1),this.emplace(P,t,i,s,a,l,u,f,g,y,v,w,S)}emplace(t,i,s,a,l,u,f,g,y,v,w,S,P){const M=12*t;return this.int16[M+0]=i,this.int16[M+1]=s,this.int16[M+2]=a,this.int16[M+3]=l,this.uint16[M+4]=u,this.uint16[M+5]=f,this.uint16[M+6]=g,this.uint16[M+7]=y,this.int16[M+8]=v,this.int16[M+9]=w,this.int16[M+10]=S,this.int16[M+11]=P,t}}ca.prototype.bytesPerElement=24,It("StructArrayLayout4i4ui4i24",ca);class bl extends ue{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,i,s)}emplace(t,i,s,a){const l=3*t;return this.float32[l+0]=i,this.float32[l+1]=s,this.float32[l+2]=a,t}}bl.prototype.bytesPerElement=12,It("StructArrayLayout3f12",bl);class _s extends ue{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const i=this.length;return this.resize(i+1),this.emplace(i,t)}emplace(t,i){return this.uint32[1*t+0]=i,t}}_s.prototype.bytesPerElement=4,It("StructArrayLayout1ul4",_s);class zn extends ue{_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,i,s,a,l,u,f,g,y){const v=this.length;return this.resize(v+1),this.emplace(v,t,i,s,a,l,u,f,g,y)}emplace(t,i,s,a,l,u,f,g,y,v){const w=10*t,S=5*t;return this.int16[w+0]=i,this.int16[w+1]=s,this.int16[w+2]=a,this.int16[w+3]=l,this.int16[w+4]=u,this.int16[w+5]=f,this.uint32[S+3]=g,this.uint16[w+8]=y,this.uint16[w+9]=v,t}}zn.prototype.bytesPerElement=20,It("StructArrayLayout6i1ul2ui20",zn);class wl extends ue{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,s,a,l,u){const f=this.length;return this.resize(f+1),this.emplace(f,t,i,s,a,l,u)}emplace(t,i,s,a,l,u,f){const g=6*t;return this.int16[g+0]=i,this.int16[g+1]=s,this.int16[g+2]=a,this.int16[g+3]=l,this.int16[g+4]=u,this.int16[g+5]=f,t}}wl.prototype.bytesPerElement=12,It("StructArrayLayout2i2i2i12",wl);class eo extends ue{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,s,a,l){const u=this.length;return this.resize(u+1),this.emplace(u,t,i,s,a,l)}emplace(t,i,s,a,l,u){const f=4*t,g=8*t;return this.float32[f+0]=i,this.float32[f+1]=s,this.float32[f+2]=a,this.int16[g+6]=l,this.int16[g+7]=u,t}}eo.prototype.bytesPerElement=16,It("StructArrayLayout2f1f2i16",eo);class kn extends ue{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,s,a,l,u){const f=this.length;return this.resize(f+1),this.emplace(f,t,i,s,a,l,u)}emplace(t,i,s,a,l,u,f){const g=16*t,y=4*t,v=8*t;return this.uint8[g+0]=i,this.uint8[g+1]=s,this.float32[y+1]=a,this.float32[y+2]=l,this.int16[v+6]=u,this.int16[v+7]=f,t}}kn.prototype.bytesPerElement=16,It("StructArrayLayout2ub2f2i16",kn);class io extends ue{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,i,s)}emplace(t,i,s,a){const l=3*t;return this.uint16[l+0]=i,this.uint16[l+1]=s,this.uint16[l+2]=a,t}}io.prototype.bytesPerElement=6,It("StructArrayLayout3ui6",io);class Tl extends ue{_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,i,s,a,l,u,f,g,y,v,w,S,P,M,C,z,F){const Z=this.length;return this.resize(Z+1),this.emplace(Z,t,i,s,a,l,u,f,g,y,v,w,S,P,M,C,z,F)}emplace(t,i,s,a,l,u,f,g,y,v,w,S,P,M,C,z,F,Z){const O=24*t,j=12*t,Q=48*t;return this.int16[O+0]=i,this.int16[O+1]=s,this.uint16[O+2]=a,this.uint16[O+3]=l,this.uint32[j+2]=u,this.uint32[j+3]=f,this.uint32[j+4]=g,this.uint16[O+10]=y,this.uint16[O+11]=v,this.uint16[O+12]=w,this.float32[j+7]=S,this.float32[j+8]=P,this.uint8[Q+36]=M,this.uint8[Q+37]=C,this.uint8[Q+38]=z,this.uint32[j+10]=F,this.int16[O+22]=Z,t}}Tl.prototype.bytesPerElement=48,It("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Tl);class ro extends ue{_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,i,s,a,l,u,f,g,y,v,w,S,P,M,C,z,F,Z,O,j,Q,et,ot,_t,ft,yt,Mt,wt){const Tt=this.length;return this.resize(Tt+1),this.emplace(Tt,t,i,s,a,l,u,f,g,y,v,w,S,P,M,C,z,F,Z,O,j,Q,et,ot,_t,ft,yt,Mt,wt)}emplace(t,i,s,a,l,u,f,g,y,v,w,S,P,M,C,z,F,Z,O,j,Q,et,ot,_t,ft,yt,Mt,wt,Tt){const mt=32*t,Rt=16*t;return this.int16[mt+0]=i,this.int16[mt+1]=s,this.int16[mt+2]=a,this.int16[mt+3]=l,this.int16[mt+4]=u,this.int16[mt+5]=f,this.int16[mt+6]=g,this.int16[mt+7]=y,this.uint16[mt+8]=v,this.uint16[mt+9]=w,this.uint16[mt+10]=S,this.uint16[mt+11]=P,this.uint16[mt+12]=M,this.uint16[mt+13]=C,this.uint16[mt+14]=z,this.uint16[mt+15]=F,this.uint16[mt+16]=Z,this.uint16[mt+17]=O,this.uint16[mt+18]=j,this.uint16[mt+19]=Q,this.uint16[mt+20]=et,this.uint16[mt+21]=ot,this.uint16[mt+22]=_t,this.uint32[Rt+12]=ft,this.float32[Rt+13]=yt,this.float32[Rt+14]=Mt,this.uint16[mt+30]=wt,this.uint16[mt+31]=Tt,t}}ro.prototype.bytesPerElement=64,It("StructArrayLayout8i15ui1ul2f2ui64",ro);class no extends ue{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const i=this.length;return this.resize(i+1),this.emplace(i,t)}emplace(t,i){return this.float32[1*t+0]=i,t}}no.prototype.bytesPerElement=4,It("StructArrayLayout1f4",no);class d extends ue{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,i,s)}emplace(t,i,s,a){const l=3*t;return this.uint16[6*t+0]=i,this.float32[l+1]=s,this.float32[l+2]=a,t}}d.prototype.bytesPerElement=12,It("StructArrayLayout1ui2f12",d);class e extends ue{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,i,s)}emplace(t,i,s,a){const l=4*t;return this.uint32[2*t+0]=i,this.uint16[l+2]=s,this.uint16[l+3]=a,t}}e.prototype.bytesPerElement=8,It("StructArrayLayout1ul2ui8",e);class n extends ue{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,i)}emplace(t,i,s){const a=2*t;return this.uint16[a+0]=i,this.uint16[a+1]=s,t}}n.prototype.bytesPerElement=4,It("StructArrayLayout2ui4",n);class o extends ue{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const i=this.length;return this.resize(i+1),this.emplace(i,t)}emplace(t,i){return this.uint16[1*t+0]=i,t}}o.prototype.bytesPerElement=2,It("StructArrayLayout1ui2",o);class c extends ue{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,s,a){const l=this.length;return this.resize(l+1),this.emplace(l,t,i,s,a)}emplace(t,i,s,a,l){const u=4*t;return this.float32[u+0]=i,this.float32[u+1]=s,this.float32[u+2]=a,this.float32[u+3]=l,t}}c.prototype.bytesPerElement=16,It("StructArrayLayout4f16",c);class p extends sa{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 Pt(this.anchorPointX,this.anchorPointY)}}p.prototype.size=20;class m extends zn{get(t){return new p(this,t)}}It("CollisionBoxArray",m);class _ extends sa{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]}}_.prototype.size=48;class x extends Tl{get(t){return new _(this,t)}}It("PlacedSymbolArray",x);class b extends sa{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]}}b.prototype.size=64;class T extends ro{get(t){return new b(this,t)}}It("SymbolInstanceArray",T);class E extends no{getoffsetX(t){return this.float32[1*t+0]}}It("GlyphOffsetArray",E);class I extends oa{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}It("SymbolLineVertexArray",I);class D extends sa{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]}}D.prototype.size=12;class L extends d{get(t){return new D(this,t)}}It("TextAnchorOffsetArray",L);class V extends sa{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]}}V.prototype.size=8;class N extends e{get(t){return new V(this,t)}}It("FeatureIndexArray",N);class G extends aa{}class q extends aa{}class Y extends aa{}class $ extends vl{}class K extends Ar{}class J extends gs{}class H extends la{}class it extends to{}class ct extends ca{}class st extends bl{}class at extends _s{}class lt extends wl{}class St extends kn{}class vt extends io{}class gt extends n{}const At=Ne([{name:"a_pos",components:2,type:"Int16"}],4),{members:qt}=At;class $t{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,i,s,a){const l=this.segments[this.segments.length-1];return t>$t.MAX_VERTEX_ARRAY_LENGTH&&Me(`Max vertices per segment is ${$t.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${$t.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!l||l.vertexLength+t>$t.MAX_VERTEX_ARRAY_LENGTH||l.sortKey!==a?this.createNewSegment(i,s,a):l}createNewSegment(t,i,s){const a={vertexOffset:t.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0,vaos:{}};return s!==void 0&&(a.sortKey=s),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(a),a}getOrCreateLatestSegment(t,i,s){return this.prepareSegment(0,t,i,s)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const t of this.segments)for(const i in t.vaos)t.vaos[i].destroy()}static simpleSegment(t,i,s,a){return new $t([{vertexOffset:t,primitiveOffset:i,vertexLength:s,primitiveLength:a,vaos:{},sortKey:0}])}}function ye(r,t){return 256*(r=wi(Math.floor(r),0,255))+wi(Math.floor(t),0,255)}$t.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,It("SegmentVector",$t);const xe=Ne([{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"}]),Ae=Ne([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var he,Xe,Te,Ge={exports:{}},je={exports:{}},Ze={exports:{}},Fi=function(){if(Te)return Ge.exports;Te=1;var r=(he||(he=1,je.exports=function(i,s){var a,l,u,f,g,y,v,w;for(l=i.length-(a=3&i.length),u=s,g=3432918353,y=461845907,w=0;w<l;)v=255&i.charCodeAt(w)|(255&i.charCodeAt(++w))<<8|(255&i.charCodeAt(++w))<<16|(255&i.charCodeAt(++w))<<24,++w,u=27492+(65535&(f=5*(65535&(u=(u^=v=(65535&(v=(v=(65535&v)*g+(((v>>>16)*g&65535)<<16)&4294967295)<<15|v>>>17))*y+(((v>>>16)*y&65535)<<16)&4294967295)<<13|u>>>19))+((5*(u>>>16)&65535)<<16)&4294967295))+((58964+(f>>>16)&65535)<<16);switch(v=0,a){case 3:v^=(255&i.charCodeAt(w+2))<<16;case 2:v^=(255&i.charCodeAt(w+1))<<8;case 1:u^=v=(65535&(v=(v=(65535&(v^=255&i.charCodeAt(w)))*g+(((v>>>16)*g&65535)<<16)&4294967295)<<15|v>>>17))*y+(((v>>>16)*y&65535)<<16)&4294967295}return u^=i.length,u=2246822507*(65535&(u^=u>>>16))+((2246822507*(u>>>16)&65535)<<16)&4294967295,u=3266489909*(65535&(u^=u>>>13))+((3266489909*(u>>>16)&65535)<<16)&4294967295,(u^=u>>>16)>>>0}),je.exports),t=(Xe||(Xe=1,Ze.exports=function(i,s){for(var a,l=i.length,u=s^l,f=0;l>=4;)a=1540483477*(65535&(a=255&i.charCodeAt(f)|(255&i.charCodeAt(++f))<<8|(255&i.charCodeAt(++f))<<16|(255&i.charCodeAt(++f))<<24))+((1540483477*(a>>>16)&65535)<<16),u=1540483477*(65535&u)+((1540483477*(u>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),l-=4,++f;switch(l){case 3:u^=(255&i.charCodeAt(f+2))<<16;case 2:u^=(255&i.charCodeAt(f+1))<<8;case 1:u=1540483477*(65535&(u^=255&i.charCodeAt(f)))+((1540483477*(u>>>16)&65535)<<16)}return u=1540483477*(65535&(u^=u>>>13))+((1540483477*(u>>>16)&65535)<<16),(u^=u>>>15)>>>0}),Ze.exports);return Ge.exports=r,Ge.exports.murmur3=r,Ge.exports.murmur2=t,Ge.exports}(),Dr=ke(Fi);class wr{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,i,s,a){this.ids.push(sn(t)),this.positions.push(i,s,a)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const i=sn(t);let s=0,a=this.ids.length-1;for(;s<a;){const u=s+a>>1;this.ids[u]>=i?a=u:s=u+1}const l=[];for(;this.ids[s]===i;)l.push({index:this.positions[3*s],start:this.positions[3*s+1],end:this.positions[3*s+2]}),s++;return l}static serialize(t,i){const s=new Float64Array(t.ids),a=new Uint32Array(t.positions);return an(s,a,0,s.length-1),i&&i.push(s.buffer,a.buffer),{ids:s,positions:a}}static deserialize(t){const i=new wr;return i.ids=t.ids,i.positions=t.positions,i.indexed=!0,i}}function sn(r){const t=+r;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:Dr(String(r))}function an(r,t,i,s){for(;i<s;){const a=r[i+s>>1];let l=i-1,u=s+1;for(;;){do l++;while(r[l]<a);do u--;while(r[u]>a);if(l>=u)break;Rn(r,l,u),Rn(t,3*l,3*u),Rn(t,3*l+1,3*u+1),Rn(t,3*l+2,3*u+2)}u-i<s-u?(an(r,t,i,u),i=u+1):(an(r,t,u+1,s),s=u)}}function Rn(r,t,i){const s=r[t];r[t]=r[i],r[i]=s}It("FeaturePositionMap",wr);class Xi{constructor(t,i){this.gl=t.gl,this.location=i}}class zr extends Xi{constructor(t,i){super(t,i),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class Ni extends Xi{constructor(t,i){super(t,i),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class kr extends Xi{constructor(t,i){super(t,i),this.current=Jt.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}const Ln=new Float32Array(16);function Fn(r){return[ye(255*r.r,255*r.g),ye(255*r.b,255*r.a)]}class Be{constructor(t,i,s){this.value=t,this.uniformNames=i.map(a=>`u_${a}`),this.type=s}setUniform(t,i,s){t.set(s.constantOr(this.value))}getBinding(t,i,s){return this.type==="color"?new kr(t,i):new zr(t,i)}}class De{constructor(t,i){this.uniformNames=i.map(s=>`u_${s}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,i){this.pixelRatioFrom=i.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=i.tlbr,this.patternTo=t.tlbr}setConstantDashPositions(t,i){this.dashTo=[0,t.y,t.height,t.width],this.dashFrom=[0,i.y,i.height,i.width]}setUniform(t,i,s,a){let l=null;a==="u_pattern_to"?l=this.patternTo:a==="u_pattern_from"?l=this.patternFrom:a==="u_dasharray_to"?l=this.dashTo:a==="u_dasharray_from"?l=this.dashFrom:a==="u_pixel_ratio_to"?l=this.pixelRatioTo:a==="u_pixel_ratio_from"&&(l=this.pixelRatioFrom),l!==null&&t.set(l)}getBinding(t,i,s){return s.substr(0,9)==="u_pattern"||s.substr(0,12)==="u_dasharray_"?new Ni(t,i):new zr(t,i)}}class Ye{constructor(t,i,s,a){this.expression=t,this.type=s,this.maxValue=0,this.paintVertexAttributes=i.map(l=>({name:`a_${l}`,type:"Float32",components:s==="color"?2:1,offset:0})),this.paintVertexArray=new a}populatePaintArray(t,i,s){const a=this.paintVertexArray.length,l=this.expression.evaluate(new ce(0,s),i,{},s.canonical,[],s.formattedSection);this.paintVertexArray.resize(t),this._setPaintValue(a,t,l)}updatePaintArray(t,i,s,a,l){const u=this.expression.evaluate(new ce(0,l),s,a);this._setPaintValue(t,i,u)}_setPaintValue(t,i,s){if(this.type==="color"){const a=Fn(s);for(let l=t;l<i;l++)this.paintVertexArray.emplace(l,a[0],a[1])}else{for(let a=t;a<i;a++)this.paintVertexArray.emplace(a,s);this.maxValue=Math.max(this.maxValue,Math.abs(s))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class de{constructor(t,i,s,a,l,u){this.expression=t,this.uniformNames=i.map(f=>`u_${f}_t`),this.type=s,this.useIntegerZoom=a,this.zoom=l,this.maxValue=0,this.paintVertexAttributes=i.map(f=>({name:`a_${f}`,type:"Float32",components:s==="color"?4:2,offset:0})),this.paintVertexArray=new u}populatePaintArray(t,i,s){const a=this.expression.evaluate(new ce(this.zoom,s),i,{},s.canonical,[],s.formattedSection),l=this.expression.evaluate(new ce(this.zoom+1,s),i,{},s.canonical,[],s.formattedSection),u=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(u,t,a,l)}updatePaintArray(t,i,s,a,l){const u=this.expression.evaluate(new ce(this.zoom,l),s,a),f=this.expression.evaluate(new ce(this.zoom+1,l),s,a);this._setPaintValue(t,i,u,f)}_setPaintValue(t,i,s,a){if(this.type==="color"){const l=Fn(s),u=Fn(a);for(let f=t;f<i;f++)this.paintVertexArray.emplace(f,l[0],l[1],u[0],u[1])}else{for(let l=t;l<i;l++)this.paintVertexArray.emplace(l,s,a);this.maxValue=Math.max(this.maxValue,Math.abs(s),Math.abs(a))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,i){const s=this.useIntegerZoom?Math.floor(i.zoom):i.zoom,a=wi(this.expression.interpolationFactor(s,this.zoom,this.zoom+1),0,1);t.set(a)}getBinding(t,i,s){return new zr(t,i)}}class on{constructor(t,i,s,a,l,u){this.expression=t,this.type=i,this.useIntegerZoom=s,this.zoom=a,this.layerId=u,this.zoomInPaintVertexArray=new l,this.zoomOutPaintVertexArray=new l}populatePaintArray(t,i,s){const a=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(a,t,this.getPositionIds(i),s)}updatePaintArray(t,i,s,a,l){this._setPaintValues(t,i,this.getPositionIds(s),l)}_setPaintValues(t,i,s,a){const l=this.getPositions(a);if(!l||!s)return;const u=l[s.min],f=l[s.mid],g=l[s.max];if(u&&f&&g)for(let y=t;y<i;y++)this.emplace(this.zoomInPaintVertexArray,y,f,u),this.emplace(this.zoomOutPaintVertexArray,y,f,g)}upload(t){if(this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer){const i=this.getVertexAttributes();this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,i,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,i,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Xc extends on{getPositions(t){return t.imagePositions}getPositionIds(t){return t.patterns&&t.patterns[this.layerId]}getVertexAttributes(){return xe.members}emplace(t,i,s,a){t.emplace(i,s.tlbr[0],s.tlbr[1],s.tlbr[2],s.tlbr[3],a.tlbr[0],a.tlbr[1],a.tlbr[2],a.tlbr[3],s.pixelRatio,a.pixelRatio)}}class Yc extends on{getPositions(t){return t.dashPositions}getPositionIds(t){return t.dashes&&t.dashes[this.layerId]}getVertexAttributes(){return Ae.members}emplace(t,i,s,a){t.emplace(i,0,s.y,s.height,s.width,0,a.y,a.height,a.width)}}class Kc{constructor(t,i,s){this.binders={},this._buffers=[];const a=[];for(const l in t.paint._values){if(!s(l))continue;const u=t.paint.get(l);if(!(u instanceof or&&cs(u.property.specification)))continue;const f=Yu(l,t.type),g=u.value,y=u.property.specification.type,v=u.property.useIntegerZoom,w=u.property.specification["property-type"],S=w==="cross-faded"||w==="cross-faded-data-driven";if(g.kind==="constant")this.binders[l]=S?new De(g.value,f):new Be(g.value,f,y),a.push(`/u_${l}`);else if(g.kind==="source"||S){const P=ln(l,y,"source");this.binders[l]=S?l==="line-dasharray"?new Yc(g,y,v,i,P,t.id):new Xc(g,y,v,i,P,t.id):new Ye(g,f,y,P),a.push(`/a_${l}`)}else{const P=ln(l,y,"composite");this.binders[l]=new de(g,f,y,v,i,P),a.push(`/z_${l}`)}}this.cacheKey=a.sort().join("")}getMaxValue(t){const i=this.binders[t];return i instanceof Ye||i instanceof de?i.maxValue:0}populatePaintArrays(t,i,s){for(const a in this.binders){const l=this.binders[a];(l instanceof Ye||l instanceof de||l instanceof on)&&l.populatePaintArray(t,i,s)}}setConstantPatternPositions(t,i){for(const s in this.binders){const a=this.binders[s];a instanceof De&&a.setConstantPatternPositions(t,i)}}setConstantDashPositions(t,i){for(const s in this.binders){const a=this.binders[s];a instanceof De&&a.setConstantDashPositions(t,i)}}updatePaintArrays(t,i,s,a,l){let u=!1;for(const f in t){const g=i.getPositions(f);for(const y of g){const v=s.feature(y.index);for(const w in this.binders){const S=this.binders[w];if((S instanceof Ye||S instanceof de||S instanceof on)&&S.expression.isStateDependent===!0){const P=a.paint.get(w);S.expression=P.value,S.updatePaintArray(y.start,y.end,v,t[f],l),u=!0}}}}return u}defines(){const t=[];for(const i in this.binders){const s=this.binders[i];(s instanceof Be||s instanceof De)&&t.push(...s.uniformNames.map(a=>`#define HAS_UNIFORM_${a}`))}return t}getBinderAttributes(){const t=[];for(const i in this.binders){const s=this.binders[i];if(s instanceof Ye||s instanceof de)for(let a=0;a<s.paintVertexAttributes.length;a++)t.push(s.paintVertexAttributes[a].name);else if(s instanceof on){const a=s.getVertexAttributes();for(const l of a)t.push(l.name)}}return t}getBinderUniforms(){const t=[];for(const i in this.binders){const s=this.binders[i];if(s instanceof Be||s instanceof De||s instanceof de)for(const a of s.uniformNames)t.push(a)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,i){const s=[];for(const a in this.binders){const l=this.binders[a];if(l instanceof Be||l instanceof De||l instanceof de){for(const u of l.uniformNames)if(i[u]){const f=l.getBinding(t,i[u],u);s.push({name:u,property:a,binding:f})}}}return s}setUniforms(t,i,s,a){for(const{name:l,property:u,binding:f}of i)this.binders[u].setUniform(f,a,s.get(u),l)}updatePaintBuffers(t){this._buffers=[];for(const i in this.binders){const s=this.binders[i];if(t&&s instanceof on){const a=t.fromScale===2?s.zoomInPaintVertexBuffer:s.zoomOutPaintVertexBuffer;a&&this._buffers.push(a)}else(s instanceof Ye||s instanceof de)&&s.paintVertexBuffer&&this._buffers.push(s.paintVertexBuffer)}}upload(t){for(const i in this.binders){const s=this.binders[i];(s instanceof Ye||s instanceof de||s instanceof on)&&s.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const i=this.binders[t];(i instanceof Ye||i instanceof de||i instanceof on)&&i.destroy()}}}class Bn{constructor(t,i,s=()=>!0){this.programConfigurations={};for(const a of t)this.programConfigurations[a.id]=new Kc(a,i,s);this.needsUpload=!1,this._featureMap=new wr,this._bufferOffset=0}populatePaintArrays(t,i,s,a){for(const l in this.programConfigurations)this.programConfigurations[l].populatePaintArrays(t,i,a);i.id!==void 0&&this._featureMap.add(i.id,s,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,i,s,a){for(const l of s)this.needsUpload=this.programConfigurations[l.id].updatePaintArrays(t,this._featureMap,i,l,a)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const i in this.programConfigurations)this.programConfigurations[i].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function Yu(r,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-dasharray":["dasharray_to","dasharray_from"],"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"]}[r]||[r.replace(`${t}-`,"").replace(/-/g,"_")]}function ln(r,t,i){const s={color:{source:gs,composite:c},number:{source:no,composite:gs}},a=function(l){return{"line-pattern":{source:H,composite:H},"fill-pattern":{source:H,composite:H},"fill-extrusion-pattern":{source:H,composite:H},"line-dasharray":{source:it,composite:it}}[l]}(r);return a&&a[i]||s[t][i]}It("ConstantBinder",Be),It("CrossFadedConstantBinder",De),It("SourceExpressionBinder",Ye),It("CrossFadedPatternBinder",Xc),It("CrossFadedDasharrayBinder",Yc),It("CompositeExpressionBinder",de),It("ProgramConfiguration",Kc,{omit:["_buffers"]}),It("ProgramConfigurationSet",Bn);const so=Math.pow(2,14)-1,Sl=-so-1;function cn(r){const t=le/r.extent,i=r.loadGeometry();for(let s=0;s<i.length;s++){const a=i[s];for(let l=0;l<a.length;l++){const u=a[l],f=Math.round(u.x*t),g=Math.round(u.y*t);u.x=wi(f,Sl,so),u.y=wi(g,Sl,so),(f<u.x||f>u.x+1||g<u.y||g>u.y+1)&&Me("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return i}function Rr(r,t){return{type:r.type,id:r.id,properties:r.properties,geometry:t?cn(r):[]}}const Pl=-32768;function Ml(r,t,i,s,a){r.emplaceBack(Pl+8*t+s,Pl+8*i+a)}class Ku{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(i=>i.id),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new q,this.indexArray=new vt,this.segments=new $t,this.programConfigurations=new Bn(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(t,i,s){const a=this.layers[0],l=[];let u=null,f=!1,g=a.type==="heatmap";if(a.type==="circle"){const v=a;u=v.layout.get("circle-sort-key"),f=!u.isConstant(),g=g||v.paint.get("circle-pitch-alignment")==="map"}const y=g?i.subdivisionGranularity.circle:1;for(const{feature:v,id:w,index:S,sourceLayerIndex:P}of t){const M=this.layers[0]._featureFilter.needGeometry,C=Rr(v,M);if(!this.layers[0]._featureFilter.filter(new ce(this.zoom),C,s))continue;const z=f?u.evaluate(C,{},s):void 0,F={id:w,properties:v.properties,type:v.type,sourceLayerIndex:P,index:S,geometry:M?C.geometry:cn(v),patterns:{},sortKey:z};l.push(F)}f&&l.sort((v,w)=>v.sortKey-w.sortKey);for(const v of l){const{geometry:w,index:S,sourceLayerIndex:P}=v,M=t[S].feature;this.addFeature(v,w,S,s,y),i.featureIndex.insert(M,w,S,P,this.index)}}update(t,i,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,i,this.stateDependentLayers,{imagePositions:s})}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,qt),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,i,s,a,l=1){let u;switch(l){case 1:u=[0,7];break;case 3:u=[0,2,5,7];break;case 5:u=[0,1,3,4,6,7];break;case 7:u=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${l}; valid values are 1, 3, 5, 7.`)}const f=u.length;for(const g of i)for(const y of g){const v=y.x,w=y.y;if(v<0||v>=le||w<0||w>=le)continue;const S=this.segments.prepareSegment(f*f,this.layoutVertexArray,this.indexArray,t.sortKey),P=S.vertexLength;for(let M=0;M<f;M++)for(let C=0;C<f;C++)Ml(this.layoutVertexArray,v,w,u[C],u[M]);for(let M=0;M<f-1;M++)for(let C=0;C<f-1;C++){const z=P+M*f+C,F=P+(M+1)*f+C;this.indexArray.emplaceBack(z,F+1,z+1),this.indexArray.emplaceBack(z,F,F+1)}S.vertexLength+=f*f,S.primitiveLength+=(f-1)*(f-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,s,{imagePositions:{},canonical:a})}}function Xh(r,t){for(let i=0;i<r.length;i++)if(ao(t,r[i]))return!0;for(let i=0;i<t.length;i++)if(ao(r,t[i]))return!0;return!!Ju(r,t)}function Jc(r,t,i){return!!ao(r,t)||!!Qu(t,r,i)}function Yh(r,t){if(r.length===1)return Jh(t,r[0]);for(let i=0;i<t.length;i++){const s=t[i];for(let a=0;a<s.length;a++)if(ao(r,s[a]))return!0}for(let i=0;i<r.length;i++)if(Jh(t,r[i]))return!0;for(let i=0;i<t.length;i++)if(Ju(r,t[i]))return!0;return!1}function lf(r,t,i){if(r.length>1){if(Ju(r,t))return!0;for(let s=0;s<t.length;s++)if(Qu(t[s],r,i))return!0}for(let s=0;s<r.length;s++)if(Qu(r[s],t,i))return!0;return!1}function Ju(r,t){if(r.length===0||t.length===0)return!1;for(let i=0;i<r.length-1;i++){const s=r[i],a=r[i+1];for(let l=0;l<t.length-1;l++)if(cf(s,a,t[l],t[l+1]))return!0}return!1}function cf(r,t,i,s){return tr(r,i,s)!==tr(t,i,s)&&tr(r,t,i)!==tr(r,t,s)}function Qu(r,t,i){const s=i*i;if(t.length===1)return r.distSqr(t[0])<s;for(let a=1;a<t.length;a++)if(Kh(r,t[a-1],t[a])<s)return!0;return!1}function Kh(r,t,i){const s=t.distSqr(i);if(s===0)return r.distSqr(t);const a=((r.x-t.x)*(i.x-t.x)+(r.y-t.y)*(i.y-t.y))/s;return r.distSqr(a<0?t:a>1?i:i.sub(t)._mult(a)._add(t))}function Jh(r,t){let i,s,a,l=!1;for(let u=0;u<r.length;u++){i=r[u];for(let f=0,g=i.length-1;f<i.length;g=f++)s=i[f],a=i[g],s.y>t.y!=a.y>t.y&&t.x<(a.x-s.x)*(t.y-s.y)/(a.y-s.y)+s.x&&(l=!l)}return l}function ao(r,t){let i=!1;for(let s=0,a=r.length-1;s<r.length;a=s++){const l=r[s],u=r[a];l.y>t.y!=u.y>t.y&&t.x<(u.x-l.x)*(t.y-l.y)/(u.y-l.y)+l.x&&(i=!i)}return i}function uf(r,t,i){const s=i[0],a=i[2];if(r.x<s.x&&t.x<s.x||r.x>a.x&&t.x>a.x||r.y<s.y&&t.y<s.y||r.y>a.y&&t.y>a.y)return!1;const l=tr(r,t,i[0]);return l!==tr(r,t,i[1])||l!==tr(r,t,i[2])||l!==tr(r,t,i[3])}function oo(r,t,i){const s=t.paint.get(r).value;return s.kind==="constant"?s.value:i.programConfigurations.get(t.id).getMaxValue(r)}function Qc(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function tu(r,t,i,s,a){if(!t[0]&&!t[1])return r;const l=Pt.convert(t)._mult(a);i==="viewport"&&l._rotate(-s);const u=[];for(let f=0;f<r.length;f++)u.push(r[f].sub(l));return u}function hf({queryGeometry:r,size:t},i){return Jc(r,i,t)}function df({queryGeometry:r,size:t,transform:i,unwrappedTileID:s,getElevation:a},l){return Jc(r,l,t*(i.projectTileCoordinates(l.x,l.y,s,a).signedDistanceFromCamera/i.cameraToCenterDistance))}function pf({queryGeometry:r,size:t,transform:i,unwrappedTileID:s,getElevation:a},l){const u=i.projectTileCoordinates(l.x,l.y,s,a).signedDistanceFromCamera,f=t*(i.cameraToCenterDistance/u);return Jc(r,th(l,i,s,a),f)}function ff({queryGeometry:r,size:t,transform:i,unwrappedTileID:s,getElevation:a},l){return Jc(r,th(l,i,s,a),t)}function Qh({queryGeometry:r,size:t,transform:i,unwrappedTileID:s,getElevation:a,pitchAlignment:l="map",pitchScale:u="map"},f){const g=l==="map"?u==="map"?hf:df:u==="map"?pf:ff,y={queryGeometry:r,size:t,transform:i,unwrappedTileID:s,getElevation:a};for(const v of f)for(const w of v)if(g(y,w))return!0;return!1}function th(r,t,i,s){const a=t.projectTileCoordinates(r.x,r.y,i,s).point;return new Pt((.5*a.x+.5)*t.width,(.5*-a.y+.5)*t.height)}let td,ed;It("CircleBucket",Ku,{omit:["layers"]});var mf={get paint(){return ed=ed||new gi({"circle-radius":new Vt(U.paint_circle["circle-radius"]),"circle-color":new Vt(U.paint_circle["circle-color"]),"circle-blur":new Vt(U.paint_circle["circle-blur"]),"circle-opacity":new Vt(U.paint_circle["circle-opacity"]),"circle-translate":new zt(U.paint_circle["circle-translate"]),"circle-translate-anchor":new zt(U.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new zt(U.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new zt(U.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Vt(U.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Vt(U.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Vt(U.paint_circle["circle-stroke-opacity"])})},get layout(){return td=td||new gi({"circle-sort-key":new Vt(U.layout_circle["circle-sort-key"])})}};class gf extends Hi{constructor(t,i){super(t,mf,i)}createBucket(t){return new Ku(t)}queryRadius(t){const i=t;return oo("circle-radius",this,i)+oo("circle-stroke-width",this,i)+Qc(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:i,featureState:s,geometry:a,transform:l,pixelsToTileUnits:u,unwrappedTileID:f,getElevation:g}){const y=tu(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-l.bearingInRadians,u),v=this.paint.get("circle-radius").evaluate(i,s)+this.paint.get("circle-stroke-width").evaluate(i,s),w=this.paint.get("circle-pitch-scale"),S=this.paint.get("circle-pitch-alignment");let P,M;return S==="map"?(P=y,M=v*u):(P=function(C,z,F,Z){return C.map(O=>th(O,z,F,Z))}(y,l,f,g),M=v),Qh({queryGeometry:P,size:M,transform:l,unwrappedTileID:f,getElevation:g,pitchAlignment:S,pitchScale:w},a)}}class id extends Ku{}let rd;It("HeatmapBucket",id,{omit:["layers"]});var _f={get paint(){return rd=rd||new gi({"heatmap-radius":new Vt(U.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Vt(U.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new zt(U.paint_heatmap["heatmap-intensity"]),"heatmap-color":new na(U.paint_heatmap["heatmap-color"]),"heatmap-opacity":new zt(U.paint_heatmap["heatmap-opacity"])})}};function eh(r,{width:t,height:i},s,a){if(a){if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==t*i*s)throw new RangeError(`mismatched image size. expected: ${a.length} but got: ${t*i*s}`)}else a=new Uint8Array(t*i*s);return r.width=t,r.height=i,r.data=a,r}function nd(r,{width:t,height:i},s){if(t===r.width&&i===r.height)return;const a=eh({},{width:t,height:i},s);ih(r,a,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,t),height:Math.min(r.height,i)},s),r.width=t,r.height=i,r.data=a.data}function ih(r,t,i,s,a,l){if(a.width===0||a.height===0)return t;if(a.width>r.width||a.height>r.height||i.x>r.width-a.width||i.y>r.height-a.height)throw new RangeError("out of range source coordinates for image copy");if(a.width>t.width||a.height>t.height||s.x>t.width-a.width||s.y>t.height-a.height)throw new RangeError("out of range destination coordinates for image copy");const u=r.data,f=t.data;if(u===f)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g<a.height;g++){const y=((i.y+g)*r.width+i.x)*l,v=((s.y+g)*t.width+s.x)*l;for(let w=0;w<a.width*l;w++)f[v+w]=u[y+w]}return t}class Il{constructor(t,i){eh(this,t,1,i)}resize(t){nd(this,t,1)}clone(){return new Il({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,i,s,a,l){ih(t,i,s,a,l,1)}}class ji{constructor(t,i){eh(this,t,4,i)}resize(t){nd(this,t,4)}replace(t,i){i?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new ji({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,i,s,a,l){ih(t,i,s,a,l,4)}setPixel(t,i,s){const a=4*(t*this.width+i);this.data[a+0]=Math.round(255*s.r/s.a),this.data[a+1]=Math.round(255*s.g/s.a),this.data[a+2]=Math.round(255*s.b/s.a),this.data[a+3]=Math.round(255*s.a)}}function sd(r){const t={},i=r.resolution||256,s=r.clips?r.clips.length:1,a=r.image||new ji({width:i,height:s});if(Math.log(i)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${i}`);const l=(u,f,g)=>{t[r.evaluationKey]=g;const y=r.expression.evaluate(t);a.setPixel(u/4/i,f/4,y)};if(r.clips)for(let u=0,f=0;u<s;++u,f+=4*i)for(let g=0,y=0;g<i;g++,y+=4){const v=g/(i-1),{start:w,end:S}=r.clips[u];l(f,y,w*(1-v)+S*v)}else for(let u=0,f=0;u<i;u++,f+=4)l(0,f,u/(i-1));return a}It("AlphaImage",Il),It("RGBAImage",ji);const rh="big-fb";class yf extends Hi{createBucket(t){return new id(t)}constructor(t,i){super(t,_f,i),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=sd({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(rh)&&this.heatmapFbos.delete(rh)}queryRadius(t){return oo("heatmap-radius",this,t)}queryIntersectsFeature({queryGeometry:t,feature:i,featureState:s,geometry:a,transform:l,pixelsToTileUnits:u,unwrappedTileID:f,getElevation:g}){return Qh({queryGeometry:t,size:this.paint.get("heatmap-radius").evaluate(i,s)*u,transform:l,unwrappedTileID:f,getElevation:g},a)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let ad;var xf={get paint(){return ad=ad||new gi({"hillshade-illumination-direction":new zt(U.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new zt(U.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new zt(U.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new zt(U.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new zt(U.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new zt(U.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new zt(U.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new zt(U.paint_hillshade["hillshade-method"])})}};class vf extends Hi{constructor(t,i){super(t,xf,i),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let t=this.paint.get("hillshade-illumination-direction").values,i=this.paint.get("hillshade-illumination-altitude").values,s=this.paint.get("hillshade-highlight-color").values,a=this.paint.get("hillshade-shadow-color").values;const l=Math.max(t.length,i.length,s.length,a.length);t=t.concat(Array(l-t.length).fill(t.at(-1))),i=i.concat(Array(l-i.length).fill(i.at(-1))),s=s.concat(Array(l-s.length).fill(s.at(-1))),a=a.concat(Array(l-a.length).fill(a.at(-1)));const u=i.map(gn);return{directionRadians:t.map(gn),altitudeRadians:u,shadowColor:a,highlightColor:s}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}let od;var bf={get paint(){return od=od||new gi({"color-relief-opacity":new zt(U["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new na(U["paint_color-relief"]["color-relief-color"])})}};class nh{constructor(t,i,s,a){this.context=t,this.format=s,this.texture=t.gl.createTexture(),this.update(i,a)}update(t,i,s){const{width:a,height:l}=t,u=!(this.size&&this.size[0]===a&&this.size[1]===l||s),{context:f}=this,{gl:g}=f;if(this.useMipmap=!!(i&&i.useMipmap),g.bindTexture(g.TEXTURE_2D,this.texture),f.pixelStoreUnpackFlipY.set(!1),f.pixelStoreUnpack.set(1),f.pixelStoreUnpackPremultiplyAlpha.set(this.format===g.RGBA&&(!i||i.premultiply!==!1)),u)this.size=[a,l],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||pr(t)?g.texImage2D(g.TEXTURE_2D,0,this.format,this.format,g.UNSIGNED_BYTE,t):g.texImage2D(g.TEXTURE_2D,0,this.format,a,l,0,this.format,g.UNSIGNED_BYTE,t.data);else{const{x:y,y:v}=s||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||pr(t)?g.texSubImage2D(g.TEXTURE_2D,0,y,v,g.RGBA,g.UNSIGNED_BYTE,t):g.texSubImage2D(g.TEXTURE_2D,0,y,v,a,l,g.RGBA,g.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&g.generateMipmap(g.TEXTURE_2D),f.pixelStoreUnpackFlipY.setDefault(),f.pixelStoreUnpack.setDefault(),f.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(t,i,s){const{context:a}=this,{gl:l}=a;l.bindTexture(l.TEXTURE_2D,this.texture),s!==l.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=l.LINEAR),t!==this.filter&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,t),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,s||t),this.filter=t),i!==this.wrap&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,i),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,i),this.wrap=i)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}class ld{constructor(t,i,s,a=1,l=1,u=1,f=0){if(this.uid=t,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(s&&!["mapbox","terrarium","custom"].includes(s))return void Me(`"${s}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=i.height;const g=this.dim=i.height-2;switch(this.data=new Uint32Array(i.data.buffer),s){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=a,this.greenFactor=l,this.blueFactor=u,this.baseShift=f;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let y=0;y<g;y++)this.data[this._idx(-1,y)]=this.data[this._idx(0,y)],this.data[this._idx(g,y)]=this.data[this._idx(g-1,y)],this.data[this._idx(y,-1)]=this.data[this._idx(y,0)],this.data[this._idx(y,g)]=this.data[this._idx(y,g-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(g,-1)]=this.data[this._idx(g-1,0)],this.data[this._idx(-1,g)]=this.data[this._idx(0,g-1)],this.data[this._idx(g,g)]=this.data[this._idx(g-1,g-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let y=0;y<g;y++)for(let v=0;v<g;v++){const w=this.get(y,v);w>this.max&&(this.max=w),w<this.min&&(this.min=w)}}get(t,i){const s=new Uint8Array(this.data.buffer),a=4*this._idx(t,i);return this.unpack(s[a],s[a+1],s[a+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,i){if(t<-1||t>=this.dim+1||i<-1||i>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(i+1)*this.stride+(t+1)}unpack(t,i,s){return t*this.redFactor+i*this.greenFactor+s*this.blueFactor-this.baseShift}pack(t){return cd(t,this.getUnpackVector())}getPixels(){return new ji({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,i,s){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let a=i*this.dim,l=i*this.dim+this.dim,u=s*this.dim,f=s*this.dim+this.dim;switch(i){case-1:a=l-1;break;case 1:l=a+1}switch(s){case-1:u=f-1;break;case 1:f=u+1}const g=-i*this.dim,y=-s*this.dim;for(let v=u;v<f;v++)for(let w=a;w<l;w++)this.data[this._idx(w,v)]=t.data[this._idx(w+g,v+y)]}}function cd(r,t){const i=t[0],s=t[1],a=t[2],l=t[3],u=Math.min(i,s,a),f=Math.round((r+l)/u);return{r:Math.floor(f*u/i)%256,g:Math.floor(f*u/s)%256,b:Math.floor(f*u/a)%256}}It("DEMData",ld);class wf extends Hi{constructor(t,i){super(t,bf,i)}_createColorRamp(t){const i={elevationStops:[],colorStops:[]},s=this._transitionablePaint._values["color-relief-color"].value.expression;if(s instanceof En&&s._styleExpression.expression instanceof ci){this.colorRampExpression=s;const u=s._styleExpression.expression;i.elevationStops=u.labels,i.colorStops=[];for(const f of i.elevationStops)i.colorStops.push(u.evaluate({globals:{elevation:f}}))}if(i.elevationStops.length<1&&(i.elevationStops=[0],i.colorStops=[Jt.transparent]),i.elevationStops.length<2&&(i.elevationStops.push(i.elevationStops[0]+1),i.colorStops.push(i.colorStops[0])),i.elevationStops.length<=t)return i;const a={elevationStops:[],colorStops:[]},l=(i.elevationStops.length-1)/(t-1);for(let u=0;u<i.elevationStops.length-.5;u+=l)a.elevationStops.push(i.elevationStops[Math.round(u)]),a.colorStops.push(i.colorStops[Math.round(u)]);return Me(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${t}, provided: ${i.elevationStops.length}`),a}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(t,i,s){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;const a=this._createColorRamp(i),l=new ji({width:a.colorStops.length,height:1}),u=new ji({width:a.colorStops.length,height:1});for(let f=0;f<a.elevationStops.length;f++){const g=cd(a.elevationStops[f],s);u.setPixel(0,f,new Jt(g.r/255,g.g/255,g.b/255,1)),l.setPixel(0,f,a.colorStops[f])}return this.colorRampTextures={elevationTexture:new nh(t,u,t.gl.RGBA),colorTexture:new nh(t,l,t.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return this.visibility!=="none"&&!!this.colorRampTextures}}const Tf=Ne([{name:"a_pos",components:2,type:"Int16"}],4),{members:Sf}=Tf;function eu(r,t,i){const s=i.patternDependencies;let a=!1;for(const l of t){const u=l.paint.get(`${r}-pattern`);u.isConstant()||(a=!0);const f=u.constantOr(null);f&&(a=!0,s[f.to]=!0,s[f.from]=!0)}return a}function sh(r,t,i,s,a){const{zoom:l}=s,u=a.patternDependencies;for(const f of t){const g=f.paint.get(`${r}-pattern`).value;if(g.kind!=="constant"){let y=g.evaluate({zoom:l-1},i,{},a.availableImages),v=g.evaluate({zoom:l},i,{},a.availableImages),w=g.evaluate({zoom:l+1},i,{},a.availableImages);y=y&&y.name?y.name:y,v=v&&v.name?v.name:v,w=w&&w.name?w.name:w,u[y]=!0,u[v]=!0,u[w]=!0,i.patterns[f.id]={min:y,mid:v,max:w}}}return i}function ud(r,t,i,s,a){let l;if(a===function(u,f,g,y){let v=0;for(let w=f,S=g-y;w<g;w+=y)v+=(u[S]-u[w])*(u[w+1]+u[S+1]),S=w;return v}(r,t,i,s)>0)for(let u=t;u<i;u+=s)l=fd(u/s|0,r[u],r[u+1],l);else for(let u=i-s;u>=t;u-=s)l=fd(u/s|0,r[u],r[u+1],l);return l&&lo(l,l.next)&&(Dl(l),l=l.next),l}function ua(r,t){if(!r)return r;t||(t=r);let i,s=r;do if(i=!1,s.steiner||!lo(s,s.next)&&$e(s.prev,s,s.next)!==0)s=s.next;else{if(Dl(s),s=t=s.prev,s===s.next)break;i=!0}while(i||s!==t);return t}function El(r,t,i,s,a,l,u){if(!r)return;!u&&l&&function(g,y,v,w){let S=g;do S.z===0&&(S.z=ah(S.x,S.y,y,v,w)),S.prevZ=S.prev,S.nextZ=S.next,S=S.next;while(S!==g);S.prevZ.nextZ=null,S.prevZ=null,function(P){let M,C=1;do{let z,F=P;P=null;let Z=null;for(M=0;F;){M++;let O=F,j=0;for(let et=0;et<C&&(j++,O=O.nextZ,O);et++);let Q=C;for(;j>0||Q>0&&O;)j!==0&&(Q===0||!O||F.z<=O.z)?(z=F,F=F.nextZ,j--):(z=O,O=O.nextZ,Q--),Z?Z.nextZ=z:P=z,z.prevZ=Z,Z=z;F=O}Z.nextZ=null,C*=2}while(M>1)}(S)}(r,s,a,l);let f=r;for(;r.prev!==r.next;){const g=r.prev,y=r.next;if(l?Mf(r,s,a,l):Pf(r))t.push(g.i,r.i,y.i),Dl(r),r=y.next,f=y.next;else if((r=y)===f){u?u===1?El(r=If(ua(r),t),t,i,s,a,l,2):u===2&&Ef(r,t,i,s,a,l):El(ua(r),t,i,s,a,l,1);break}}}function Pf(r){const t=r.prev,i=r,s=r.next;if($e(t,i,s)>=0)return!1;const a=t.x,l=i.x,u=s.x,f=t.y,g=i.y,y=s.y,v=Math.min(a,l,u),w=Math.min(f,g,y),S=Math.max(a,l,u),P=Math.max(f,g,y);let M=s.next;for(;M!==t;){if(M.x>=v&&M.x<=S&&M.y>=w&&M.y<=P&&Cl(a,f,l,g,u,y,M.x,M.y)&&$e(M.prev,M,M.next)>=0)return!1;M=M.next}return!0}function Mf(r,t,i,s){const a=r.prev,l=r,u=r.next;if($e(a,l,u)>=0)return!1;const f=a.x,g=l.x,y=u.x,v=a.y,w=l.y,S=u.y,P=Math.min(f,g,y),M=Math.min(v,w,S),C=Math.max(f,g,y),z=Math.max(v,w,S),F=ah(P,M,t,i,s),Z=ah(C,z,t,i,s);let O=r.prevZ,j=r.nextZ;for(;O&&O.z>=F&&j&&j.z<=Z;){if(O.x>=P&&O.x<=C&&O.y>=M&&O.y<=z&&O!==a&&O!==u&&Cl(f,v,g,w,y,S,O.x,O.y)&&$e(O.prev,O,O.next)>=0||(O=O.prevZ,j.x>=P&&j.x<=C&&j.y>=M&&j.y<=z&&j!==a&&j!==u&&Cl(f,v,g,w,y,S,j.x,j.y)&&$e(j.prev,j,j.next)>=0))return!1;j=j.nextZ}for(;O&&O.z>=F;){if(O.x>=P&&O.x<=C&&O.y>=M&&O.y<=z&&O!==a&&O!==u&&Cl(f,v,g,w,y,S,O.x,O.y)&&$e(O.prev,O,O.next)>=0)return!1;O=O.prevZ}for(;j&&j.z<=Z;){if(j.x>=P&&j.x<=C&&j.y>=M&&j.y<=z&&j!==a&&j!==u&&Cl(f,v,g,w,y,S,j.x,j.y)&&$e(j.prev,j,j.next)>=0)return!1;j=j.nextZ}return!0}function If(r,t){let i=r;do{const s=i.prev,a=i.next.next;!lo(s,a)&&dd(s,i,i.next,a)&&Al(s,a)&&Al(a,s)&&(t.push(s.i,i.i,a.i),Dl(i),Dl(i.next),i=r=a),i=i.next}while(i!==r);return ua(i)}function Ef(r,t,i,s,a,l){let u=r;do{let f=u.next.next;for(;f!==u.prev;){if(u.i!==f.i&&kf(u,f)){let g=pd(u,f);return u=ua(u,u.next),g=ua(g,g.next),El(u,t,i,s,a,l,0),void El(g,t,i,s,a,l,0)}f=f.next}u=u.next}while(u!==r)}function Cf(r,t){let i=r.x-t.x;return i===0&&(i=r.y-t.y,i===0)&&(i=(r.next.y-r.y)/(r.next.x-r.x)-(t.next.y-t.y)/(t.next.x-t.x)),i}function Af(r,t){const i=function(a,l){let u=l;const f=a.x,g=a.y;let y,v=-1/0;if(lo(a,u))return u;do{if(lo(a,u.next))return u.next;if(g<=u.y&&g>=u.next.y&&u.next.y!==u.y){const C=u.x+(g-u.y)*(u.next.x-u.x)/(u.next.y-u.y);if(C<=f&&C>v&&(v=C,y=u.x<u.next.x?u:u.next,C===f))return y}u=u.next}while(u!==l);if(!y)return null;const w=y,S=y.x,P=y.y;let M=1/0;u=y;do{if(f>=u.x&&u.x>=S&&f!==u.x&&hd(g<P?f:v,g,S,P,g<P?v:f,g,u.x,u.y)){const C=Math.abs(g-u.y)/(f-u.x);Al(u,a)&&(C<M||C===M&&(u.x>y.x||u.x===y.x&&Df(y,u)))&&(y=u,M=C)}u=u.next}while(u!==w);return y}(r,t);if(!i)return t;const s=pd(i,r);return ua(s,s.next),ua(i,i.next)}function Df(r,t){return $e(r.prev,r,t.prev)<0&&$e(t.next,r,r.next)<0}function ah(r,t,i,s,a){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-i)*a|0)|r<<8))|r<<4))|r<<2))|r<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-s)*a|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function zf(r){let t=r,i=r;do(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next;while(t!==r);return i}function hd(r,t,i,s,a,l,u,f){return(a-u)*(t-f)>=(r-u)*(l-f)&&(r-u)*(s-f)>=(i-u)*(t-f)&&(i-u)*(l-f)>=(a-u)*(s-f)}function Cl(r,t,i,s,a,l,u,f){return!(r===u&&t===f)&&hd(r,t,i,s,a,l,u,f)}function kf(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!function(i,s){let a=i;do{if(a.i!==i.i&&a.next.i!==i.i&&a.i!==s.i&&a.next.i!==s.i&&dd(a,a.next,i,s))return!0;a=a.next}while(a!==i);return!1}(r,t)&&(Al(r,t)&&Al(t,r)&&function(i,s){let a=i,l=!1;const u=(i.x+s.x)/2,f=(i.y+s.y)/2;do a.y>f!=a.next.y>f&&a.next.y!==a.y&&u<(a.next.x-a.x)*(f-a.y)/(a.next.y-a.y)+a.x&&(l=!l),a=a.next;while(a!==i);return l}(r,t)&&($e(r.prev,r,t.prev)||$e(r,t.prev,t))||lo(r,t)&&$e(r.prev,r,r.next)>0&&$e(t.prev,t,t.next)>0)}function $e(r,t,i){return(t.y-r.y)*(i.x-t.x)-(t.x-r.x)*(i.y-t.y)}function lo(r,t){return r.x===t.x&&r.y===t.y}function dd(r,t,i,s){const a=ru($e(r,t,i)),l=ru($e(r,t,s)),u=ru($e(i,s,r)),f=ru($e(i,s,t));return a!==l&&u!==f||!(a!==0||!iu(r,i,t))||!(l!==0||!iu(r,s,t))||!(u!==0||!iu(i,r,s))||!(f!==0||!iu(i,t,s))}function iu(r,t,i){return t.x<=Math.max(r.x,i.x)&&t.x>=Math.min(r.x,i.x)&&t.y<=Math.max(r.y,i.y)&&t.y>=Math.min(r.y,i.y)}function ru(r){return r>0?1:r<0?-1:0}function Al(r,t){return $e(r.prev,r,r.next)<0?$e(r,t,r.next)>=0&&$e(r,r.prev,t)>=0:$e(r,t,r.prev)<0||$e(r,r.next,t)<0}function pd(r,t){const i=oh(r.i,r.x,r.y),s=oh(t.i,t.x,t.y),a=r.next,l=t.prev;return r.next=t,t.prev=r,i.next=a,a.prev=i,s.next=i,i.prev=s,l.next=s,s.prev=l,s}function fd(r,t,i,s){const a=oh(r,t,i);return s?(a.next=s.next,a.prev=s,s.next.prev=a,s.next=a):(a.prev=a,a.next=a),a}function Dl(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function oh(r,t,i){return{i:r,x:t,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class co{constructor(t,i){if(i>t)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=i}getGranularityForZoomLevel(t){return Math.max(Math.floor(this._baseZoomGranularity/(1<<t)),this._minGranularity,1)}}class nu{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}}nu.noSubdivision=new nu({fill:new co(0,0),line:new co(0,0),tile:new co(0,0),stencil:new co(0,0),circle:1}),It("SubdivisionGranularityExpression",co),It("SubdivisionGranularitySetting",nu);const uo=-32768,zl=32767;class Rf{constructor(t,i){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=le/t,this._canonical=i}_getKey(t,i){return(t+=32768)<<16|i+32768}_vertexToIndex(t,i){if(t<-32768||i<-32768||t>32767||i>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const s=0|Math.round(t),a=0|Math.round(i),l=this._getKey(s,a);if(this._vertexDictionary.has(l))return this._vertexDictionary.get(l);const u=this._vertexBuffer.length/2;return this._vertexDictionary.set(l,u),this._vertexBuffer.push(s,a),u}_subdivideTrianglesScanline(t){if(this._granularity<2)return function(a,l){const u=[];for(let f=0;f<l.length;f+=3){const g=l[f],y=l[f+1],v=l[f+2],w=a[2*g],S=a[2*g+1];(a[2*y]-w)*(a[2*v+1]-S)-(a[2*y+1]-S)*(a[2*v]-w)>0?(u.push(g),u.push(v),u.push(y)):(u.push(g),u.push(y),u.push(v))}return u}(this._vertexBuffer,t);const i=[],s=t.length;for(let a=0;a<s;a+=3){const l=[t[a+0],t[a+1],t[a+2]],u=[this._vertexBuffer[2*t[a+0]+0],this._vertexBuffer[2*t[a+0]+1],this._vertexBuffer[2*t[a+1]+0],this._vertexBuffer[2*t[a+1]+1],this._vertexBuffer[2*t[a+2]+0],this._vertexBuffer[2*t[a+2]+1]];let f=1/0,g=1/0,y=-1/0,v=-1/0;for(let C=0;C<3;C++){const z=u[2*C],F=u[2*C+1];f=Math.min(f,z),y=Math.max(y,z),g=Math.min(g,F),v=Math.max(v,F)}if(f===y||g===v)continue;const w=Math.floor(f/this._granularityCellSize),S=Math.ceil(y/this._granularityCellSize),P=Math.floor(g/this._granularityCellSize),M=Math.ceil(v/this._granularityCellSize);if(w!==S||P!==M)for(let C=P;C<M;C++){const z=this._scanlineGenerateVertexRingForCellRow(C,u,l);Lf(this._vertexBuffer,z,i)}else i.push(...l)}return i}_scanlineGenerateVertexRingForCellRow(t,i,s){const a=t*this._granularityCellSize,l=a+this._granularityCellSize,u=[];for(let f=0;f<3;f++){const g=i[2*f],y=i[2*f+1],v=i[2*(f+1)%6],w=i[(2*(f+1)+1)%6],S=i[2*(f+2)%6],P=i[(2*(f+2)+1)%6],M=v-g,C=w-y,z=M===0,F=C===0,Z=(a-y)/C,O=(l-y)/C,j=Math.min(Z,O),Q=Math.max(Z,O);if(!F&&(j>=1||Q<=0)||F&&(y<a||y>l)){w>=a&&w<=l&&u.push(s[(f+1)%3]);continue}!F&&j>0&&u.push(this._vertexToIndex(g+M*j,y+C*j));const et=g+M*Math.max(j,0),ot=g+M*Math.min(Q,1);z||this._generateIntraEdgeVertices(u,g,y,v,w,et,ot),!F&&Q<1&&u.push(this._vertexToIndex(g+M*Q,y+C*Q)),(F||w>=a&&w<=l)&&u.push(s[(f+1)%3]),!F&&(w<=a||w>=l)&&this._generateInterEdgeVertices(u,g,y,v,w,S,P,ot,a,l)}return u}_generateIntraEdgeVertices(t,i,s,a,l,u,f){const g=a-i,y=l-s,v=y===0,w=v?Math.min(i,a):Math.min(u,f),S=v?Math.max(i,a):Math.max(u,f),P=Math.floor(w/this._granularityCellSize)+1,M=Math.ceil(S/this._granularityCellSize)-1;if(v?i<a:u<f)for(let C=P;C<=M;C++){const z=C*this._granularityCellSize;t.push(this._vertexToIndex(z,s+y*(z-i)/g))}else for(let C=M;C>=P;C--){const z=C*this._granularityCellSize;t.push(this._vertexToIndex(z,s+y*(z-i)/g))}}_generateInterEdgeVertices(t,i,s,a,l,u,f,g,y,v){const w=l-s,S=u-a,P=f-l,M=(y-l)/P,C=(v-l)/P,z=Math.min(M,C),F=Math.max(M,C),Z=a+S*z;let O=Math.floor(Math.min(Z,g)/this._granularityCellSize)+1,j=Math.ceil(Math.max(Z,g)/this._granularityCellSize)-1,Q=g<Z;const et=P===0;if(et&&(f===y||f===v))return;if(et||z>=1||F<=0){const _t=s-f,ft=u+(i-u)*Math.min((y-f)/_t,(v-f)/_t);O=Math.floor(Math.min(ft,g)/this._granularityCellSize)+1,j=Math.ceil(Math.max(ft,g)/this._granularityCellSize)-1,Q=g<ft}const ot=w>0?v:y;if(Q)for(let _t=O;_t<=j;_t++)t.push(this._vertexToIndex(_t*this._granularityCellSize,ot));else for(let _t=j;_t>=O;_t--)t.push(this._vertexToIndex(_t*this._granularityCellSize,ot))}_generateOutline(t){const i=[];for(const s of t){const a=ha(s,this._granularity,!0),l=this._pointArrayToIndices(a),u=[];for(let f=1;f<l.length;f++)u.push(l[f-1]),u.push(l[f]);i.push(u)}return i}_handlePoles(t){let i=!1,s=!1;this._canonical&&(this._canonical.y===0&&(i=!0),this._canonical.y===(1<<this._canonical.z)-1&&(s=!0)),(i||s)&&this._fillPoles(t,i,s)}_ensureNoPoleVertices(){const t=this._vertexBuffer;for(let i=0;i<t.length;i+=2){const s=t[i+1];s===uo&&(t[i+1]=-32767),s===zl&&(t[i+1]=32766)}}_generatePoleQuad(t,i,s,a,l,u){a>l!=(u===uo)?(t.push(i),t.push(s),t.push(this._vertexToIndex(a,u)),t.push(s),t.push(this._vertexToIndex(l,u)),t.push(this._vertexToIndex(a,u))):(t.push(s),t.push(i),t.push(this._vertexToIndex(a,u)),t.push(this._vertexToIndex(l,u)),t.push(s),t.push(this._vertexToIndex(a,u)))}_fillPoles(t,i,s){const a=this._vertexBuffer,l=le,u=t.length;for(let f=2;f<u;f+=3){const g=t[f-2],y=t[f-1],v=t[f],w=a[2*g],S=a[2*g+1],P=a[2*y],M=a[2*y+1],C=a[2*v],z=a[2*v+1];i&&(S===0&&M===0&&this._generatePoleQuad(t,g,y,w,P,uo),M===0&&z===0&&this._generatePoleQuad(t,y,v,P,C,uo),z===0&&S===0&&this._generatePoleQuad(t,v,g,C,w,uo)),s&&(S===l&&M===l&&this._generatePoleQuad(t,g,y,w,P,zl),M===l&&z===l&&this._generatePoleQuad(t,y,v,P,C,zl),z===l&&S===l&&this._generatePoleQuad(t,v,g,C,w,zl))}}_initializeVertices(t){for(let i=0;i<t.length;i+=2)this._vertexToIndex(t[i],t[i+1])}subdividePolygonInternal(t,i){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:s,holeIndices:a}=function(f){const g=[],y=[];for(const v of f)if(v.length!==0){v!==f[0]&&g.push(y.length/2);for(let w=0;w<v.length;w++)y.push(v[w].x),y.push(v[w].y)}return{flattened:y,holeIndices:g}}(t);let l;this._initializeVertices(s);try{const f=function(y,v,w=2){const S=v&&v.length,P=S?v[0]*w:y.length;let M=ud(y,0,P,w,!0);const C=[];if(!M||M.next===M.prev)return C;let z,F,Z;if(S&&(M=function(O,j,Q,et){const ot=[];for(let _t=0,ft=j.length;_t<ft;_t++){const yt=ud(O,j[_t]*et,_t<ft-1?j[_t+1]*et:O.length,et,!1);yt===yt.next&&(yt.steiner=!0),ot.push(zf(yt))}ot.sort(Cf);for(let _t=0;_t<ot.length;_t++)Q=Af(ot[_t],Q);return Q}(y,v,M,w)),y.length>80*w){z=y[0],F=y[1];let O=z,j=F;for(let Q=w;Q<P;Q+=w){const et=y[Q],ot=y[Q+1];et<z&&(z=et),ot<F&&(F=ot),et>O&&(O=et),ot>j&&(j=ot)}Z=Math.max(O-z,j-F),Z=Z!==0?32767/Z:0}return El(M,C,w,z,F,Z,0),C}(s,a),g=this._convertIndices(s,f);l=this._subdivideTrianglesScanline(g)}catch(f){console.error(f)}let u=[];return i&&(u=this._generateOutline(t)),this._ensureNoPoleVertices(),this._handlePoles(l),{verticesFlattened:this._vertexBuffer,indicesTriangles:l,indicesLineList:u}}_convertIndices(t,i){const s=[];for(let a=0;a<i.length;a++)s.push(this._vertexToIndex(t[2*i[a]],t[2*i[a]+1]));return s}_pointArrayToIndices(t){const i=[];for(let s=0;s<t.length;s++){const a=t[s];i.push(this._vertexToIndex(a.x,a.y))}return i}}function md(r,t,i,s=!0){return new Rf(i,t).subdividePolygonInternal(r,s)}function ha(r,t,i=!1){if(!r||r.length<1)return[];if(r.length<2)return[];const s=r[0],a=r[r.length-1],l=i&&(s.x!==a.x||s.y!==a.y);if(t<2)return l?[...r,r[0]]:[...r];const u=Math.floor(le/t),f=[];f.push(new Pt(r[0].x,r[0].y));const g=r.length,y=l?g:g-1;for(let v=0;v<y;v++){const w=r[v],S=v<g-1?r[v+1]:r[0],P=w.x,M=w.y,C=S.x,z=S.y,F=P!==C,Z=M!==z;if(!F&&!Z)continue;const O=C-P,j=z-M,Q=Math.abs(O),et=Math.abs(j);let ot=P,_t=M;for(;;){const yt=O>0?(Math.floor(ot/u)+1)*u:(Math.ceil(ot/u)-1)*u,Mt=j>0?(Math.floor(_t/u)+1)*u:(Math.ceil(_t/u)-1)*u,wt=Math.abs(ot-yt),Tt=Math.abs(_t-Mt),mt=Math.abs(ot-C),Rt=Math.abs(_t-z),Lt=F?wt/Q:Number.POSITIVE_INFINITY,Nt=Z?Tt/et:Number.POSITIVE_INFINITY;if((mt<=wt||!F)&&(Rt<=Tt||!Z))break;if(Lt<Nt&&F||!Z){ot=yt,_t+=j*Lt;const Ct=new Pt(ot,Math.round(_t));f[f.length-1].x===Ct.x&&f[f.length-1].y===Ct.y||f.push(Ct)}else{ot+=O*Nt,_t=Mt;const Ct=new Pt(Math.round(ot),_t);f[f.length-1].x===Ct.x&&f[f.length-1].y===Ct.y||f.push(Ct)}}const ft=new Pt(C,z);f[f.length-1].x===ft.x&&f[f.length-1].y===ft.y||f.push(ft)}return f}function Lf(r,t,i){if(t.length===0)throw new Error("Subdivision vertex ring is empty.");let s=0,a=r[2*t[0]];for(let g=1;g<t.length;g++){const y=r[2*t[g]];y<a&&(a=y,s=g)}const l=t.length;let u=s,f=(u+1)%l;for(;;){const g=u-1>=0?u-1:l-1,y=(f+1)%l,v=r[2*t[g]],w=r[2*t[y]],S=r[2*t[u]],P=r[2*t[u]+1],M=r[2*t[f]+1];let C=!1;if(v<w)C=!0;else if(v>w)C=!1;else{const z=M-P,F=-(r[2*t[f]]-S),Z=P<M?1:-1;((v-S)*z+(r[2*t[g]+1]-P)*F)*Z>((w-S)*z+(r[2*t[y]+1]-P)*F)*Z&&(C=!0)}if(C){const z=t[g],F=t[u],Z=t[f];z!==F&&z!==Z&&F!==Z&&i.push(Z,F,z),u--,u<0&&(u=l-1)}else{const z=t[y],F=t[u],Z=t[f];z!==F&&z!==Z&&F!==Z&&i.push(Z,F,z),f++,f>=l&&(f=0)}if(g===y)break}}function gd(r,t,i,s,a,l,u,f,g){const y=a.length/2,v=u&&f&&g;if(y<$t.MAX_VERTEX_ARRAY_LENGTH){const w=t.prepareSegment(y,i,s),S=w.vertexLength;for(let C=0;C<l.length;C+=3)s.emplaceBack(S+l[C],S+l[C+1],S+l[C+2]);let P,M;w.vertexLength+=y,w.primitiveLength+=l.length/3,v&&(M=u.prepareSegment(y,i,f),P=M.vertexLength,M.vertexLength+=y);for(let C=0;C<a.length;C+=2)r(a[C],a[C+1]);if(v)for(let C=0;C<g.length;C++){const z=g[C];for(let F=1;F<z.length;F+=2)f.emplaceBack(P+z[F-1],P+z[F]);M.primitiveLength+=z.length/2}}else(function(w,S,P,M,C,z){const F=[];for(let et=0;et<M.length/2;et++)F.push(-1);const Z={count:0};let O=0,j=w.getOrCreateLatestSegment(S,P),Q=j.vertexLength;for(let et=2;et<C.length;et+=3){const ot=C[et-2],_t=C[et-1],ft=C[et];let yt=F[ot]<O,Mt=F[_t]<O,wt=F[ft]<O;j.vertexLength+((yt?1:0)+(Mt?1:0)+(wt?1:0))>$t.MAX_VERTEX_ARRAY_LENGTH&&(j=w.createNewSegment(S,P),O=Z.count,yt=!0,Mt=!0,wt=!0,Q=0);const Tt=kl(F,M,z,Z,ot,yt,j),mt=kl(F,M,z,Z,_t,Mt,j),Rt=kl(F,M,z,Z,ft,wt,j);P.emplaceBack(Q+Tt-O,Q+mt-O,Q+Rt-O),j.primitiveLength++}})(t,i,s,a,l,r),v&&function(w,S,P,M,C,z){const F=[];for(let et=0;et<M.length/2;et++)F.push(-1);const Z={count:0};let O=0,j=w.getOrCreateLatestSegment(S,P),Q=j.vertexLength;for(let et=0;et<C.length;et++){const ot=C[et];for(let _t=1;_t<C[et].length;_t+=2){const ft=ot[_t-1],yt=ot[_t];let Mt=F[ft]<O,wt=F[yt]<O;j.vertexLength+((Mt?1:0)+(wt?1:0))>$t.MAX_VERTEX_ARRAY_LENGTH&&(j=w.createNewSegment(S,P),O=Z.count,Mt=!0,wt=!0,Q=0);const Tt=kl(F,M,z,Z,ft,Mt,j),mt=kl(F,M,z,Z,yt,wt,j);P.emplaceBack(Q+Tt-O,Q+mt-O),j.primitiveLength++}}}(u,i,f,a,g,r),t.forceNewSegmentOnNextPrepare(),u?.forceNewSegmentOnNextPrepare()}function kl(r,t,i,s,a,l,u){if(l){const f=s.count;return i(t[2*a],t[2*a+1]),r[a]=s.count,s.count++,u.vertexLength++,f}return r[a]}class lh{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(i=>i.id),this.index=t.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new Y,this.indexArray=new vt,this.indexArray2=new gt,this.programConfigurations=new Bn(t.layers,t.zoom),this.segments=new $t,this.segments2=new $t,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(t,i,s){this.hasDependencies=eu("fill",this.layers,i);const a=this.layers[0].layout.get("fill-sort-key"),l=!a.isConstant(),u=[];for(const{feature:f,id:g,index:y,sourceLayerIndex:v}of t){const w=this.layers[0]._featureFilter.needGeometry,S=Rr(f,w);if(!this.layers[0]._featureFilter.filter(new ce(this.zoom),S,s))continue;const P=l?a.evaluate(S,{},s,i.availableImages):void 0,M={id:g,properties:f.properties,type:f.type,sourceLayerIndex:v,index:y,geometry:w?S.geometry:cn(f),patterns:{},sortKey:P};u.push(M)}l&&u.sort((f,g)=>f.sortKey-g.sortKey);for(const f of u){const{geometry:g,index:y,sourceLayerIndex:v}=f;if(this.hasDependencies){const w=sh("fill",this.layers,f,{zoom:this.zoom},i);this.patternFeatures.push(w)}else this.addFeature(f,g,y,s,{},i.subdivisionGranularity);i.featureIndex.insert(t[y].feature,g,y,v,this.index)}}update(t,i,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,i,this.stateDependentLayers,{imagePositions:s})}addFeatures(t,i,s){for(const a of this.patternFeatures)this.addFeature(a,a.geometry,a.index,i,s,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Sf),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,i,s,a,l,u){for(const f of Ns(i,500)){const g=md(f,a,u.fill.getGranularityForZoomLevel(a.z)),y=this.layoutVertexArray;gd((v,w)=>{y.emplaceBack(v,w)},this.segments,this.layoutVertexArray,this.indexArray,g.verticesFlattened,g.indicesTriangles,this.segments2,this.indexArray2,g.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,s,{imagePositions:l,canonical:a})}}let _d,yd;It("FillBucket",lh,{omit:["layers","patternFeatures"]});var Ff={get paint(){return yd=yd||new gi({"fill-antialias":new zt(U.paint_fill["fill-antialias"]),"fill-opacity":new Vt(U.paint_fill["fill-opacity"]),"fill-color":new Vt(U.paint_fill["fill-color"]),"fill-outline-color":new Vt(U.paint_fill["fill-outline-color"]),"fill-translate":new zt(U.paint_fill["fill-translate"]),"fill-translate-anchor":new zt(U.paint_fill["fill-translate-anchor"]),"fill-pattern":new ra(U.paint_fill["fill-pattern"])})},get layout(){return _d=_d||new gi({"fill-sort-key":new Vt(U.layout_fill["fill-sort-key"])})}};class Bf extends Hi{constructor(t,i){super(t,Ff,i)}recalculate(t,i){super.recalculate(t,i);const s=this.paint._values["fill-outline-color"];s.value.kind==="constant"&&s.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new lh(t)}queryRadius(){return Qc(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:i,transform:s,pixelsToTileUnits:a}){return Yh(tu(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-s.bearingInRadians,a),i)}isTileClipped(){return!0}}const Of=Ne([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Vf=Ne([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Nf}=Of;class ho{constructor(t,i,s,a,l){this.properties={},this.extent=s,this.type=0,this.id=void 0,this._pbf=t,this._geometry=-1,this._keys=a,this._values=l,t.readFields(jf,this,i)}loadGeometry(){const t=this._pbf;t.pos=this._geometry;const i=t.readVarint()+t.pos,s=[];let a,l=1,u=0,f=0,g=0;for(;t.pos<i;){if(u<=0){const y=t.readVarint();l=7&y,u=y>>3}if(u--,l===1||l===2)f+=t.readSVarint(),g+=t.readSVarint(),l===1&&(a&&s.push(a),a=[]),a&&a.push(new Pt(f,g));else{if(l!==7)throw new Error(`unknown command ${l}`);a&&a.push(a[0].clone())}}return a&&s.push(a),s}bbox(){const t=this._pbf;t.pos=this._geometry;const i=t.readVarint()+t.pos;let s=1,a=0,l=0,u=0,f=1/0,g=-1/0,y=1/0,v=-1/0;for(;t.pos<i;){if(a<=0){const w=t.readVarint();s=7&w,a=w>>3}if(a--,s===1||s===2)l+=t.readSVarint(),u+=t.readSVarint(),l<f&&(f=l),l>g&&(g=l),u<y&&(y=u),u>v&&(v=u);else if(s!==7)throw new Error(`unknown command ${s}`)}return[f,y,g,v]}toGeoJSON(t,i,s){const a=this.extent*Math.pow(2,s),l=this.extent*t,u=this.extent*i,f=this.loadGeometry();function g(S){return[360*(S.x+l)/a-180,360/Math.PI*Math.atan(Math.exp((1-2*(S.y+u)/a)*Math.PI))-90]}function y(S){return S.map(g)}let v;if(this.type===1){const S=[];for(const M of f)S.push(M[0]);const P=y(S);v=S.length===1?{type:"Point",coordinates:P[0]}:{type:"MultiPoint",coordinates:P}}else if(this.type===2){const S=f.map(y);v=S.length===1?{type:"LineString",coordinates:S[0]}:{type:"MultiLineString",coordinates:S}}else{if(this.type!==3)throw new Error("unknown feature type");{const S=function(M){const C=M.length;if(C<=1)return[M];const z=[];let F,Z;for(let O=0;O<C;O++){const j=Uf(M[O]);j!==0&&(Z===void 0&&(Z=j<0),Z===j<0?(F&&z.push(F),F=[M[O]]):F&&F.push(M[O]))}return F&&z.push(F),z}(f),P=[];for(const M of S)P.push(M.map(y));v=P.length===1?{type:"Polygon",coordinates:P[0]}:{type:"MultiPolygon",coordinates:P}}}const w={type:"Feature",geometry:v,properties:this.properties};return this.id!=null&&(w.id=this.id),w}}function jf(r,t,i){r===1?t.id=i.readVarint():r===2?function(s,a){const l=s.readVarint()+s.pos;for(;s.pos<l;){const u=a._keys[s.readVarint()],f=a._values[s.readVarint()];a.properties[u]=f}}(i,t):r===3?t.type=i.readVarint():r===4&&(t._geometry=i.pos)}function Uf(r){let t=0;for(let i,s,a=0,l=r.length,u=l-1;a<l;u=a++)i=r[a],s=r[u],t+=(s.x-i.x)*(i.y+s.y);return t}ho.types=["Unknown","Point","LineString","Polygon"];class xd{constructor(t,i){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Gf,this,i),this.length=this._features.length}feature(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];const i=this._pbf.readVarint()+this._pbf.pos;return new ho(this._pbf,i,this.extent,this._keys,this._values)}}function Gf(r,t,i){r===15?t.version=i.readVarint():r===1?t.name=i.readString():r===5?t.extent=i.readVarint():r===2?t._features.push(i.pos):r===3?t._keys.push(i.readString()):r===4&&t._values.push(function(s){let a=null;const l=s.readVarint()+s.pos;for(;s.pos<l;){const u=s.readVarint()>>3;a=u===1?s.readString():u===2?s.readFloat():u===3?s.readDouble():u===4?s.readVarint64():u===5?s.readVarint():u===6?s.readSVarint():u===7?s.readBoolean():null}if(a==null)throw new Error("unknown feature value");return a}(i))}class vd{constructor(t,i){this.layers=t.readFields(Zf,{},i)}}function Zf(r,t,i){if(r===3){const s=new xd(i,i.readVarint()+i.pos);s.length&&(t[s.name]=s)}}const ch=Math.pow(2,13);function Rl(r,t,i,s,a,l,u,f){r.emplaceBack(t,i,2*Math.floor(s*ch)+u,a*ch*2,l*ch*2,Math.round(f))}class uh{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(i=>i.id),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new $,this.centroidVertexArray=new G,this.indexArray=new vt,this.programConfigurations=new Bn(t.layers,t.zoom),this.segments=new $t,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(t,i,s){this.features=[],this.hasDependencies=eu("fill-extrusion",this.layers,i);for(const{feature:a,id:l,index:u,sourceLayerIndex:f}of t){const g=this.layers[0]._featureFilter.needGeometry,y=Rr(a,g);if(!this.layers[0]._featureFilter.filter(new ce(this.zoom),y,s))continue;const v={id:l,sourceLayerIndex:f,index:u,geometry:g?y.geometry:cn(a),properties:a.properties,type:a.type,patterns:{}};this.hasDependencies?this.features.push(sh("fill-extrusion",this.layers,v,{zoom:this.zoom},i)):this.addFeature(v,v.geometry,u,s,{},i.subdivisionGranularity),i.featureIndex.insert(a,v.geometry,u,f,this.index,!0)}}addFeatures(t,i,s){for(const a of this.features){const{geometry:l}=a;this.addFeature(a,l,a.index,i,s,t.subdivisionGranularity)}}update(t,i,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,i,this.stateDependentLayers,{imagePositions:s})}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,Nf),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Vf.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,i,s,a,l,u){for(const f of Ns(i,500)){const g={x:0,y:0,sampleCount:0},y=this.layoutVertexArray.length;this.processPolygon(g,a,t,f,u);const v=this.layoutVertexArray.length-y,w=Math.floor(g.x/g.sampleCount),S=Math.floor(g.y/g.sampleCount);for(let P=0;P<v;P++)this.centroidVertexArray.emplaceBack(w,S)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,s,{imagePositions:l,canonical:a})}processPolygon(t,i,s,a,l){if(a.length<1||bd(a[0]))return;for(const w of a)w.length!==0&&$f(t,w);const u={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},f=l.fill.getGranularityForZoomLevel(i.z),g=ho.types[s.type]==="Polygon";for(const w of a){if(w.length===0||bd(w))continue;const S=ha(w,f,g);this._generateSideFaces(S,u)}if(!g)return;const y=md(a,i,f,!1),v=this.layoutVertexArray;gd((w,S)=>{Rl(v,w,S,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,y.verticesFlattened,y.indicesTriangles)}_generateSideFaces(t,i){let s=0;for(let a=1;a<t.length;a++){const l=t[a],u=t[a-1];if(qf(l,u))continue;i.segment.vertexLength+4>$t.MAX_VERTEX_ARRAY_LENGTH&&(i.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const f=l.sub(u)._perp()._unit(),g=u.dist(l);s+g>32768&&(s=0),Rl(this.layoutVertexArray,l.x,l.y,f.x,f.y,0,0,s),Rl(this.layoutVertexArray,l.x,l.y,f.x,f.y,0,1,s),s+=g,Rl(this.layoutVertexArray,u.x,u.y,f.x,f.y,0,0,s),Rl(this.layoutVertexArray,u.x,u.y,f.x,f.y,0,1,s);const y=i.segment.vertexLength;this.indexArray.emplaceBack(y,y+2,y+1),this.indexArray.emplaceBack(y+1,y+2,y+3),i.segment.vertexLength+=4,i.segment.primitiveLength+=2}}}function $f(r,t){for(let i=0;i<t.length;i++){const s=t[i];i===t.length-1&&t[0].x===s.x&&t[0].y===s.y||(r.x+=s.x,r.y+=s.y,r.sampleCount++)}}function qf(r,t){return r.x===t.x&&(r.x<0||r.x>le)||r.y===t.y&&(r.y<0||r.y>le)}function bd(r){return r.every(t=>t.x<0)||r.every(t=>t.x>le)||r.every(t=>t.y<0)||r.every(t=>t.y>le)}let wd;It("FillExtrusionBucket",uh,{omit:["layers","features"]});var Wf={get paint(){return wd=wd||new gi({"fill-extrusion-opacity":new zt(U["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Vt(U["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new zt(U["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new zt(U["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ra(U["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Vt(U["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Vt(U["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new zt(U["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Hf extends Hi{constructor(t,i){super(t,Wf,i)}createBucket(t){return new uh(t)}queryRadius(){return Qc(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:i,featureState:s,geometry:a,transform:l,pixelsToTileUnits:u,pixelPosMatrix:f}){const g=tu(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-l.bearingInRadians,u),y=this.paint.get("fill-extrusion-height").evaluate(i,s),v=this.paint.get("fill-extrusion-base").evaluate(i,s),w=function(P,M){const C=[];for(const z of P){const F=[z.x,z.y,0,1];Ps(F,F,M),C.push(new Pt(F[0]/F[3],F[1]/F[3]))}return C}(g,f),S=function(P,M,C,z){const F=[],Z=[],O=z[8]*M,j=z[9]*M,Q=z[10]*M,et=z[11]*M,ot=z[8]*C,_t=z[9]*C,ft=z[10]*C,yt=z[11]*C;for(const Mt of P){const wt=[],Tt=[];for(const mt of Mt){const Rt=mt.x,Lt=mt.y,Nt=z[0]*Rt+z[4]*Lt+z[12],Ct=z[1]*Rt+z[5]*Lt+z[13],Yt=z[2]*Rt+z[6]*Lt+z[14],Se=z[3]*Rt+z[7]*Lt+z[15],Ke=Yt+Q,xi=Se+et,Tr=Nt+ot,Bi=Ct+_t,ui=Yt+ft,vi=Se+yt,Ue=new Pt((Nt+O)/xi,(Ct+j)/xi);Ue.z=Ke/xi,wt.push(Ue);const hi=new Pt(Tr/vi,Bi/vi);hi.z=ui/vi,Tt.push(hi)}F.push(wt),Z.push(Tt)}return[F,Z]}(a,v,y,f);return function(P,M,C){let z=1/0;Yh(C,M)&&(z=Td(C,M[0]));for(let F=0;F<M.length;F++){const Z=M[F],O=P[F];for(let j=0;j<Z.length-1;j++){const Q=Z[j],et=[Q,Z[j+1],O[j+1],O[j],Q];Xh(C,et)&&(z=Math.min(z,Td(C,et)))}}return z!==1/0&&z}(S[0],S[1],w)}}function Ll(r,t){return r.x*t.x+r.y*t.y}function Td(r,t){if(r.length===1){let i=0;const s=t[i++];let a;for(;!a||s.equals(a);)if(a=t[i++],!a)return 1/0;for(;i<t.length;i++){const l=t[i],u=r[0],f=a.sub(s),g=l.sub(s),y=u.sub(s),v=Ll(f,f),w=Ll(f,g),S=Ll(g,g),P=Ll(y,f),M=Ll(y,g),C=v*S-w*w,z=(S*P-w*M)/C,F=(v*M-w*P)/C,Z=s.z*(1-z-F)+a.z*z+l.z*F;if(isFinite(Z))return Z}return 1/0}{let i=1/0;for(const s of t)i=Math.min(i,s.z);return i}}const Xf=Ne([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Yf}=Xf,Kf=Ne([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Jf}=Kf,Qf=Math.cos(Math.PI/180*37.5),Sd=Math.pow(2,14)/.5;class hh{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(i=>i.id),this.index=t.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(i=>{this.gradients[i.id]={}}),this.layoutVertexArray=new K,this.layoutVertexArray2=new J,this.indexArray=new vt,this.programConfigurations=new Bn(t.layers,t.zoom),this.segments=new $t,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(t,i,s){this.hasDependencies=eu("line",this.layers,i)||this.hasLineDasharray(this.layers);const a=this.layers[0].layout.get("line-sort-key"),l=!a.isConstant(),u=[];for(const{feature:f,id:g,index:y,sourceLayerIndex:v}of t){const w=this.layers[0]._featureFilter.needGeometry,S=Rr(f,w);if(!this.layers[0]._featureFilter.filter(new ce(this.zoom),S,s))continue;const P=l?a.evaluate(S,{},s):void 0,M={id:g,properties:f.properties,type:f.type,sourceLayerIndex:v,index:y,geometry:w?S.geometry:cn(f),patterns:{},dashes:{},sortKey:P};u.push(M)}l&&u.sort((f,g)=>f.sortKey-g.sortKey);for(const f of u){const{geometry:g,index:y,sourceLayerIndex:v}=f;this.hasDependencies?(eu("line",this.layers,i)?sh("line",this.layers,f,{zoom:this.zoom},i):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,f,this.zoom,i),this.patternFeatures.push(f)):this.addFeature(f,g,y,s,{},{},i.subdivisionGranularity),i.featureIndex.insert(t[y].feature,g,y,v,this.index)}}update(t,i,s,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,i,this.stateDependentLayers,{imagePositions:s,dashPositions:a})}addFeatures(t,i,s,a){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,i,s,a,t.subdivisionGranularity)}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,Jf)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Yf),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,i,s,a,l,u,f){const g=this.layers[0].layout,y=g.get("line-join").evaluate(t,{}),v=g.get("line-cap"),w=g.get("line-miter-limit"),S=g.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const P of i)this.addLine(P,t,y,v,w,S,a,f);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,s,{imagePositions:l,dashPositions:u,canonical:a})}addLine(t,i,s,a,l,u,f,g){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,t=ha(t,f?g.line.getGranularityForZoomLevel(f.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let O=0;O<t.length-1;O++)this.totalDistance+=t[O].dist(t[O+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const y=ho.types[i.type]==="Polygon";let v=t.length;for(;v>=2&&t[v-1].equals(t[v-2]);)v--;let w=0;for(;w<v-1&&t[w].equals(t[w+1]);)w++;if(v<(y?3:2))return;s==="bevel"&&(l=1.05);const S=this.overscaling<=16?122880/(512*this.overscaling):0,P=this.segments.prepareSegment(10*v,this.layoutVertexArray,this.indexArray);let M,C,z,F,Z;this.e1=this.e2=-1,y&&(M=t[v-2],Z=t[w].sub(M)._unit()._perp());for(let O=w;O<v;O++){if(z=O===v-1?y?t[w+1]:void 0:t[O+1],z&&t[O].equals(z))continue;Z&&(F=Z),M&&(C=M),M=t[O],Z=z?z.sub(M)._unit()._perp():F,F=F||Z;let j=F.add(Z);j.x===0&&j.y===0||j._unit();const Q=F.x*Z.x+F.y*Z.y,et=j.x*Z.x+j.y*Z.y,ot=et!==0?1/et:1/0,_t=2*Math.sqrt(2-2*et),ft=et<Qf&&C&&z,yt=F.x*Z.y-F.y*Z.x>0;if(ft&&O>w){const Tt=M.dist(C);if(Tt>2*S){const mt=M.sub(M.sub(C)._mult(S/Tt)._round());this.updateDistance(C,mt),this.addCurrentVertex(mt,F,0,0,P),C=mt}}const Mt=C&&z;let wt=Mt?s:y?"butt":a;if(Mt&&wt==="round"&&(ot<u?wt="miter":ot<=2&&(wt="fakeround")),wt==="miter"&&ot>l&&(wt="bevel"),wt==="bevel"&&(ot>2&&(wt="flipbevel"),ot<l&&(wt="miter")),C&&this.updateDistance(C,M),wt==="miter")j._mult(ot),this.addCurrentVertex(M,j,0,0,P);else if(wt==="flipbevel"){if(ot>100)j=Z.mult(-1);else{const Tt=ot*F.add(Z).mag()/F.sub(Z).mag();j._perp()._mult(Tt*(yt?-1:1))}this.addCurrentVertex(M,j,0,0,P),this.addCurrentVertex(M,j.mult(-1),0,0,P)}else if(wt==="bevel"||wt==="fakeround"){const Tt=-Math.sqrt(ot*ot-1),mt=yt?Tt:0,Rt=yt?0:Tt;if(C&&this.addCurrentVertex(M,F,mt,Rt,P),wt==="fakeround"){const Lt=Math.round(180*_t/Math.PI/20);for(let Nt=1;Nt<Lt;Nt++){let Ct=Nt/Lt;if(Ct!==.5){const Se=Ct-.5;Ct+=Ct*Se*(Ct-1)*((1.0904+Q*(Q*(3.55645-1.43519*Q)-3.2452))*Se*Se+(.848013+Q*(.215638*Q-1.06021)))}const Yt=Z.sub(F)._mult(Ct)._add(F)._unit()._mult(yt?-1:1);this.addHalfVertex(M,Yt.x,Yt.y,!1,yt,0,P)}}z&&this.addCurrentVertex(M,Z,-mt,-Rt,P)}else if(wt==="butt")this.addCurrentVertex(M,j,0,0,P);else if(wt==="square"){const Tt=C?1:-1;this.addCurrentVertex(M,j,Tt,Tt,P)}else wt==="round"&&(C&&(this.addCurrentVertex(M,F,0,0,P),this.addCurrentVertex(M,F,1,1,P,!0)),z&&(this.addCurrentVertex(M,Z,-1,-1,P,!0),this.addCurrentVertex(M,Z,0,0,P)));if(ft&&O<v-1){const Tt=M.dist(z);if(Tt>2*S){const mt=M.add(z.sub(M)._mult(S/Tt)._round());this.updateDistance(M,mt),this.addCurrentVertex(mt,Z,0,0,P),M=mt}}}}addCurrentVertex(t,i,s,a,l,u=!1){const f=i.y*a-i.x,g=-i.y-i.x*a;this.addHalfVertex(t,i.x+i.y*s,i.y-i.x*s,u,!1,s,l),this.addHalfVertex(t,f,g,u,!0,-a,l),this.distance>Sd/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,i,s,a,l,u))}addHalfVertex({x:t,y:i},s,a,l,u,f,g){const y=.5*(this.lineClips?this.scaledDistance*(Sd-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(l?1:0),(i<<1)+(u?1:0),Math.round(63*s)+128,Math.round(63*a)+128,1+(f===0?0:f<0?-1:1)|(63&y)<<2,y>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const v=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,v,this.e2),g.primitiveLength++),u?this.e2=v:this.e1=v}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,i){this.distance+=t.dist(i),this.updateScaledDistance()}hasLineDasharray(t){for(const i of t){const s=i.paint.get("line-dasharray");if(s&&!s.isConstant())return!0}return!1}addLineDashDependencies(t,i,s,a){for(const l of t){const u=l.paint.get("line-dasharray");if(!u||u.value.kind==="constant")continue;const f=l.layout.get("line-cap")==="round",g={dasharray:u.value.evaluate({zoom:s-1},i,{}),round:f},y={dasharray:u.value.evaluate({zoom:s},i,{}),round:f},v={dasharray:u.value.evaluate({zoom:s+1},i,{}),round:f},w=`${g.dasharray.join(",")},${g.round}`,S=`${y.dasharray.join(",")},${y.round}`,P=`${v.dasharray.join(",")},${v.round}`;a.dashDependencies[w]=g,a.dashDependencies[S]=y,a.dashDependencies[P]=v,i.dashes[l.id]={min:w,mid:S,max:P}}}}let Pd,Md;It("LineBucket",hh,{omit:["layers","patternFeatures"]});var Id={get paint(){return Md=Md||new gi({"line-opacity":new Vt(U.paint_line["line-opacity"]),"line-color":new Vt(U.paint_line["line-color"]),"line-translate":new zt(U.paint_line["line-translate"]),"line-translate-anchor":new zt(U.paint_line["line-translate-anchor"]),"line-width":new Vt(U.paint_line["line-width"]),"line-gap-width":new Vt(U.paint_line["line-gap-width"]),"line-offset":new Vt(U.paint_line["line-offset"]),"line-blur":new Vt(U.paint_line["line-blur"]),"line-dasharray":new ra(U.paint_line["line-dasharray"]),"line-pattern":new ra(U.paint_line["line-pattern"]),"line-gradient":new na(U.paint_line["line-gradient"])})},get layout(){return Pd=Pd||new gi({"line-cap":new zt(U.layout_line["line-cap"]),"line-join":new Vt(U.layout_line["line-join"]),"line-miter-limit":new zt(U.layout_line["line-miter-limit"]),"line-round-limit":new zt(U.layout_line["line-round-limit"]),"line-sort-key":new Vt(U.layout_line["line-sort-key"])})}};class tm extends Vt{possiblyEvaluate(t,i){return i=new ce(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,zoomHistory:i.zoomHistory,transition:i.transition}),super.possiblyEvaluate(t,i)}evaluate(t,i,s,a){return i=di({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(t,i,s,a)}}let su;class em extends Hi{constructor(t,i){super(t,Id,i),this.gradientVersion=0,su||(su=new tm(Id.paint.properties["line-width"].specification),su.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){const i=this.gradientExpression();this.stepInterpolant=!!function(s){return s._styleExpression!==void 0}(i)&&i._styleExpression.expression instanceof ns,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,i){super.recalculate(t,i),this.paint._values["line-floorwidth"]=su.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new hh(t)}queryRadius(t){const i=t,s=Ed(oo("line-width",this,i),oo("line-gap-width",this,i)),a=oo("line-offset",this,i);return s/2+Math.abs(a)+Qc(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:i,featureState:s,geometry:a,transform:l,pixelsToTileUnits:u}){const f=tu(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-l.bearingInRadians,u),g=u/2*Ed(this.paint.get("line-width").evaluate(i,s),this.paint.get("line-gap-width").evaluate(i,s)),y=this.paint.get("line-offset").evaluate(i,s);return y&&(a=function(v,w){const S=[];for(let P=0;P<v.length;P++){const M=v[P],C=[];for(let z=0;z<M.length;z++){const F=M[z-1],Z=M[z],O=M[z+1],j=z===0?new Pt(0,0):Z.sub(F)._unit()._perp(),Q=z===M.length-1?new Pt(0,0):O.sub(Z)._unit()._perp(),et=j._add(Q)._unit(),ot=et.x*Q.x+et.y*Q.y;ot!==0&&et._mult(1/ot),C.push(et._mult(w)._add(Z))}S.push(C)}return S}(a,y*u)),function(v,w,S){for(let P=0;P<w.length;P++){const M=w[P];if(v.length>=3){for(let C=0;C<M.length;C++)if(ao(v,M[C]))return!0}if(lf(v,M,S))return!0}return!1}(f,a,g)}isTileClipped(){return!0}}function Ed(r,t){return t>0?t+2*r:r}const im=Ne([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),rm=Ne([{name:"a_projected_pos",components:3,type:"Float32"}],4);Ne([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const nm=Ne([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);Ne([{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 Cd=Ne([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),sm=Ne([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function am(r,t,i){return r.sections.forEach(s=>{s.text=function(a,l,u){const f=l.layout.get("text-transform").evaluate(u,{});return f==="uppercase"?a=a.toLocaleUpperCase():f==="lowercase"&&(a=a.toLocaleLowerCase()),nn.applyArabicShaping&&(a=nn.applyArabicShaping(a)),a}(s.text,t,i)}),r}Ne([{name:"triangle",components:3,type:"Uint16"}]),Ne([{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"}]),Ne([{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"}]),Ne([{type:"Float32",name:"offsetX"}]),Ne([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Ne([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var ri=24;const Fl={"!":"︕","#":"＃",$:"＄","%":"％","&":"＆","(":"︵",")":"︶","*":"＊","+":"＋",",":"︐","-":"︲",".":"・","/":"／",":":"︓",";":"︔","<":"︿","=":"＝",">":"﹀","?":"︖","@":"＠","[":"﹇","\\":"＼","]":"﹈","^":"＾",_:"︳","`":"｀","{":"︷","|":"―","}":"︸","~":"～","¢":"￠","£":"￡","¥":"￥","¦":"￤","¬":"￢","¯":"￣","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","⋯":"︙","‧":"・","₩":"￦","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","！":"︕","（":"︵","）":"︶","，":"︐","－":"︲","．":"・","：":"︓","；":"︔","＜":"︿","＞":"﹀","？":"︖","［":"﹇","］":"﹈","＿":"︳","｛":"︷","｜":"―","｝":"︸","｟":"︵","｠":"︶","｡":"︒","｢":"﹁","｣":"﹂"},om={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},lm={40:!0};function Ad(r,t,i,s,a,l){if("fontStack"in t){const u=i[t.fontStack],f=u&&u[r];return f?f.metrics.advance*t.scale+a:0}{const u=s[t.imageName];return u?u.displaySize[0]*t.scale*ri/l+a:0}}function Dd(r,t,i,s){const a=Math.pow(r-t,2);return s?r<t?a/2:2*a:a+Math.abs(i)*i}function cm(r,t,i){let s=0;return r===10&&(s-=1e4),i&&(s+=150),r!==40&&r!==65288||(s+=50),t!==41&&t!==65289||(s+=50),s}function zd(r,t,i,s,a,l){let u=null,f=Dd(t,i,a,l);for(const g of s){const y=Dd(t-g.x,i,a,l)+g.badness;y<=f&&(u=g,f=y)}return{index:r,x:t,priorBreak:u,badness:f}}function kd(r){return r?kd(r.priorBreak).concat(r.index):[]}class po{constructor(t="",i=[],s=[]){this.text=t,this.sections=i,this.sectionIndex=s,this.imageSectionID=null}static fromFeature(t,i){const s=new po;for(let a=0;a<t.sections.length;a++){const l=t.sections[a];l.image?s.addImageSection(l):s.addTextSection(l,i)}return s}length(){return[...this.text].length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}verticalizePunctuation(){this.text=function(t){let i="",s={premature:!0,value:void 0};const a=t[Symbol.iterator]();let l=a.next();const u=t[Symbol.iterator]();u.next();let f=u.next();for(;!l.done;)i+=!f.done&&pl(f.value.codePointAt(0))&&!Fl[f.value]||!s.premature&&pl(s.value.codePointAt(0))&&!Fl[s.value]||!Fl[l.value]?l.value:Fl[l.value],s={value:l.value,premature:!1},l=a.next(),f=u.next();return i}(this.text)}hasZeroWidthSpaces(){return this.text.includes("​")}trim(){const t=this.text.match(/^\s*/),i=t?t[0].length:0,s=this.text.match(/\S\s*$/),a=s?s[0].length-1:0;this.text=this.text.substring(i,this.text.length-a),this.sectionIndex=this.sectionIndex.slice(i,this.sectionIndex.length-a)}substring(t,i){const s=[...this.text].slice(t,i).join(""),a=this.sectionIndex.slice(t,i);return new po(s,this.sections,a)}toCodeUnitIndex(t){return[...this.text].slice(0,t).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,i)=>Math.max(t,this.sections[i].scale),0)}getMaxImageSize(t){let i=0,s=0;for(let a=0;a<this.length();a++){const l=this.getSection(a);if("imageName"in l){const u=t[l.imageName];if(!u)continue;const f=u.displaySize;i=Math.max(i,f[0]),s=Math.max(s,f[1])}}return{maxImageWidth:i,maxImageHeight:s}}addTextSection(t,i){this.text+=t.text,this.sections.push({scale:t.scale||1,verticalAlign:t.verticalAlign||"bottom",fontStack:t.fontStack||i});const s=this.sections.length-1;this.sectionIndex.push(...[...t.text].map(()=>s))}addImageSection(t){const i=t.image?t.image.name:"";if(i.length===0)return void Me("Can't add FormattedSection with an empty image.");const s=this.getNextImageSectionCharCode();s?(this.text+=String.fromCharCode(s),this.sections.push({scale:1,verticalAlign:t.verticalAlign||"bottom",imageName:i}),this.sectionIndex.push(this.sections.length-1)):Me("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(t,i,s,a,l){const u=[],f=this.determineAverageLineWidth(t,i,s,a,l),g=this.hasZeroWidthSpaces();let y=0,v=0;const w=this.text[Symbol.iterator]();let S=w.next();const P=this.text[Symbol.iterator]();P.next();let M=P.next();const C=this.text[Symbol.iterator]();C.next(),C.next();let z=C.next();for(;!S.done;){const F=this.getSection(v),Z=S.value.codePointAt(0);if(Nc(Z)||(y+=Ad(Z,F,s,a,t,l)),!M.done){const O=Zu(Z),j=M.value.codePointAt(0);(om[Z]||O||"imageName"in F||!z.done&&lm[j])&&u.push(zd(v+1,y,f,u,cm(Z,j,O&&g),!1))}v++,S=w.next(),M=P.next(),z=C.next()}return kd(zd(this.length(),y,f,u,0,!0))}determineAverageLineWidth(t,i,s,a,l){let u=0,f=0;for(const g of this.text){const y=this.getSection(f);u+=Ad(g.codePointAt(0),y,s,a,t,l),f++}return u/Math.max(1,Math.ceil(u/i))}}const dh=4294967296,Rd=1/dh,Ld=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");class ph{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(t,i,s=this.length){for(;this.pos<s;){const a=this.readVarint(),l=a>>3,u=this.pos;this.type=7&a,t(l,i,this),this.pos===u&&this.skip(a)}return i}readMessage(t,i){return this.readFields(t,i,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*dh;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*dh;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const i=this.buf;let s,a;return a=i[this.pos++],s=127&a,a<128?s:(a=i[this.pos++],s|=(127&a)<<7,a<128?s:(a=i[this.pos++],s|=(127&a)<<14,a<128?s:(a=i[this.pos++],s|=(127&a)<<21,a<128?s:(a=i[this.pos],s|=(15&a)<<28,function(l,u,f){const g=f.buf;let y,v;if(v=g[f.pos++],y=(112&v)>>4,v<128||(v=g[f.pos++],y|=(127&v)<<3,v<128)||(v=g[f.pos++],y|=(127&v)<<10,v<128)||(v=g[f.pos++],y|=(127&v)<<17,v<128)||(v=g[f.pos++],y|=(127&v)<<24,v<128)||(v=g[f.pos++],y|=(1&v)<<31,v<128))return fo(l,y,u);throw new Error("Expected varint not more than 10 bytes")}(s,t,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return!!this.readVarint()}readString(){const t=this.readVarint()+this.pos,i=this.pos;return this.pos=t,t-i>=12&&Ld?Ld.decode(this.buf.subarray(i,t)):function(s,a,l){let u="",f=a;for(;f<l;){const g=s[f];let y,v,w,S=null,P=g>239?4:g>223?3:g>191?2:1;if(f+P>l)break;P===1?g<128&&(S=g):P===2?(y=s[f+1],(192&y)==128&&(S=(31&g)<<6|63&y,S<=127&&(S=null))):P===3?(y=s[f+1],v=s[f+2],(192&y)==128&&(192&v)==128&&(S=(15&g)<<12|(63&y)<<6|63&v,(S<=2047||S>=55296&&S<=57343)&&(S=null))):P===4&&(y=s[f+1],v=s[f+2],w=s[f+3],(192&y)==128&&(192&v)==128&&(192&w)==128&&(S=(15&g)<<18|(63&y)<<12|(63&v)<<6|63&w,(S<=65535||S>=1114112)&&(S=null))),S===null?(S=65533,P=1):S>65535&&(S-=65536,u+=String.fromCharCode(S>>>10&1023|55296),S=56320|1023&S),u+=String.fromCharCode(S),f+=P}return u}(this.buf,i,t)}readBytes(){const t=this.readVarint()+this.pos,i=this.buf.subarray(this.pos,t);return this.pos=t,i}readPackedVarint(t=[],i){const s=this.readPackedEnd();for(;this.pos<s;)t.push(this.readVarint(i));return t}readPackedSVarint(t=[]){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readFloat());return t}readPackedDouble(t=[]){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readSFixed64());return t}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(t){const i=7&t;if(i===0)for(;this.buf[this.pos++]>127;);else if(i===2)this.pos=this.readVarint()+this.pos;else if(i===5)this.pos+=4;else{if(i!==1)throw new Error(`Unimplemented type: ${i}`);this.pos+=8}}writeTag(t,i){this.writeVarint(t<<3|i)}realloc(t){let i=this.length||16;for(;i<this.pos+t;)i*=2;if(i!==this.length){const s=new Uint8Array(i);s.set(this.buf),this.buf=s,this.dataView=new DataView(s.buffer),this.length=i}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeSFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*Rd),!0),this.pos+=8}writeSFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*Rd),!0),this.pos+=8}writeVarint(t){(t=+t||0)>268435455||t<0?function(i,s){let a,l;if(i>=0?(a=i%4294967296|0,l=i/4294967296|0):(a=~(-i%4294967296),l=~(-i/4294967296),4294967295^a?a=a+1|0:(a=0,l=l+1|0)),i>=18446744073709552e3||i<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");s.realloc(10),function(u,f,g){g.buf[g.pos++]=127&u|128,u>>>=7,g.buf[g.pos++]=127&u|128,u>>>=7,g.buf[g.pos++]=127&u|128,u>>>=7,g.buf[g.pos++]=127&u|128,g.buf[g.pos]=127&(u>>>=7)}(a,0,s),function(u,f){const g=(7&u)<<4;f.buf[f.pos++]|=g|((u>>>=3)?128:0),u&&(f.buf[f.pos++]=127&u|((u>>>=7)?128:0),u&&(f.buf[f.pos++]=127&u|((u>>>=7)?128:0),u&&(f.buf[f.pos++]=127&u|((u>>>=7)?128:0),u&&(f.buf[f.pos++]=127&u|((u>>>=7)?128:0),u&&(f.buf[f.pos++]=127&u)))))}(l,s)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))}writeSVarint(t){this.writeVarint(t<0?2*-t-1:2*t)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(4*t.length),this.pos++;const i=this.pos;this.pos=function(a,l,u){for(let f,g,y=0;y<l.length;y++){if(f=l.charCodeAt(y),f>55295&&f<57344){if(!g){f>56319||y+1===l.length?(a[u++]=239,a[u++]=191,a[u++]=189):g=f;continue}if(f<56320){a[u++]=239,a[u++]=191,a[u++]=189,g=f;continue}f=g-55296<<10|f-56320|65536,g=null}else g&&(a[u++]=239,a[u++]=191,a[u++]=189,g=null);f<128?a[u++]=f:(f<2048?a[u++]=f>>6|192:(f<65536?a[u++]=f>>12|224:(a[u++]=f>>18|240,a[u++]=f>>12&63|128),a[u++]=f>>6&63|128),a[u++]=63&f|128)}return u}(this.buf,t,this.pos);const s=this.pos-i;s>=128&&Fd(i,s,this),this.pos=i-1,this.writeVarint(s),this.pos+=s}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){const i=t.length;this.writeVarint(i),this.realloc(i);for(let s=0;s<i;s++)this.buf[this.pos++]=t[s]}writeRawMessage(t,i){this.pos++;const s=this.pos;t(i,this);const a=this.pos-s;a>=128&&Fd(s,a,this),this.pos=s-1,this.writeVarint(a),this.pos+=a}writeMessage(t,i,s){this.writeTag(t,2),this.writeRawMessage(i,s)}writePackedVarint(t,i){i.length&&this.writeMessage(t,um,i)}writePackedSVarint(t,i){i.length&&this.writeMessage(t,hm,i)}writePackedBoolean(t,i){i.length&&this.writeMessage(t,fm,i)}writePackedFloat(t,i){i.length&&this.writeMessage(t,dm,i)}writePackedDouble(t,i){i.length&&this.writeMessage(t,pm,i)}writePackedFixed32(t,i){i.length&&this.writeMessage(t,mm,i)}writePackedSFixed32(t,i){i.length&&this.writeMessage(t,gm,i)}writePackedFixed64(t,i){i.length&&this.writeMessage(t,_m,i)}writePackedSFixed64(t,i){i.length&&this.writeMessage(t,ym,i)}writeBytesField(t,i){this.writeTag(t,2),this.writeBytes(i)}writeFixed32Field(t,i){this.writeTag(t,5),this.writeFixed32(i)}writeSFixed32Field(t,i){this.writeTag(t,5),this.writeSFixed32(i)}writeFixed64Field(t,i){this.writeTag(t,1),this.writeFixed64(i)}writeSFixed64Field(t,i){this.writeTag(t,1),this.writeSFixed64(i)}writeVarintField(t,i){this.writeTag(t,0),this.writeVarint(i)}writeSVarintField(t,i){this.writeTag(t,0),this.writeSVarint(i)}writeStringField(t,i){this.writeTag(t,2),this.writeString(i)}writeFloatField(t,i){this.writeTag(t,5),this.writeFloat(i)}writeDoubleField(t,i){this.writeTag(t,1),this.writeDouble(i)}writeBooleanField(t,i){this.writeVarintField(t,+i)}}function fo(r,t,i){return i?4294967296*t+(r>>>0):4294967296*(t>>>0)+(r>>>0)}function Fd(r,t,i){const s=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));i.realloc(s);for(let a=i.pos-1;a>=r;a--)i.buf[a+s]=i.buf[a]}function um(r,t){for(let i=0;i<r.length;i++)t.writeVarint(r[i])}function hm(r,t){for(let i=0;i<r.length;i++)t.writeSVarint(r[i])}function dm(r,t){for(let i=0;i<r.length;i++)t.writeFloat(r[i])}function pm(r,t){for(let i=0;i<r.length;i++)t.writeDouble(r[i])}function fm(r,t){for(let i=0;i<r.length;i++)t.writeBoolean(r[i])}function mm(r,t){for(let i=0;i<r.length;i++)t.writeFixed32(r[i])}function gm(r,t){for(let i=0;i<r.length;i++)t.writeSFixed32(r[i])}function _m(r,t){for(let i=0;i<r.length;i++)t.writeFixed64(r[i])}function ym(r,t){for(let i=0;i<r.length;i++)t.writeSFixed64(r[i])}function xm(r,t,i){r===1&&i.readMessage(vm,t)}function vm(r,t,i){if(r===3){const{id:s,bitmap:a,width:l,height:u,left:f,top:g,advance:y}=i.readMessage(bm,{});t.push({id:s,bitmap:new Il({width:l+6,height:u+6},a),metrics:{width:l,height:u,left:f,top:g,advance:y}})}}function bm(r,t,i){r===1?t.id=i.readVarint():r===2?t.bitmap=i.readBytes():r===3?t.width=i.readVarint():r===4?t.height=i.readVarint():r===5?t.left=i.readSVarint():r===6?t.top=i.readSVarint():r===7&&(t.advance=i.readVarint())}function Bd(r){let t=0,i=0;for(const u of r)t+=u.w*u.h,i=Math.max(i,u.w);r.sort((u,f)=>f.h-u.h);const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),i),h:1/0}];let a=0,l=0;for(const u of r)for(let f=s.length-1;f>=0;f--){const g=s[f];if(!(u.w>g.w||u.h>g.h)){if(u.x=g.x,u.y=g.y,l=Math.max(l,u.y+u.h),a=Math.max(a,u.x+u.w),u.w===g.w&&u.h===g.h){const y=s.pop();y&&f<s.length&&(s[f]=y)}else u.h===g.h?(g.x+=u.w,g.w-=u.w):u.w===g.w?(g.y+=u.h,g.h-=u.h):(s.push({x:g.x+u.w,y:g.y,w:g.w-u.w,h:u.h}),g.y+=u.h,g.h-=u.h);break}}return{w:a,h:l,fill:t/(a*l)||0}}class fh{constructor(t,{pixelRatio:i,version:s,stretchX:a,stretchY:l,content:u,textFitWidth:f,textFitHeight:g}){this.paddedRect=t,this.pixelRatio=i,this.stretchX=a,this.stretchY=l,this.content=u,this.version=s,this.textFitWidth=f,this.textFitHeight=g}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class Od{constructor(t,i){const s={},a={};this.haveRenderCallbacks=[];const l=[];this.addImages(t,s,l),this.addImages(i,a,l);const{w:u,h:f}=Bd(l),g=new ji({width:u||1,height:f||1});for(const y in t){const v=t[y],w=s[y].paddedRect;ji.copy(v.data,g,{x:0,y:0},{x:w.x+1,y:w.y+1},v.data)}for(const y in i){const v=i[y],w=a[y].paddedRect,S=w.x+1,P=w.y+1,M=v.data.width,C=v.data.height;ji.copy(v.data,g,{x:0,y:0},{x:S,y:P},v.data),ji.copy(v.data,g,{x:0,y:C-1},{x:S,y:P-1},{width:M,height:1}),ji.copy(v.data,g,{x:0,y:0},{x:S,y:P+C},{width:M,height:1}),ji.copy(v.data,g,{x:M-1,y:0},{x:S-1,y:P},{width:1,height:C}),ji.copy(v.data,g,{x:0,y:0},{x:S+M,y:P},{width:1,height:C})}this.image=g,this.iconPositions=s,this.patternPositions=a}addImages(t,i,s){for(const a in t){const l=t[a],u={x:0,y:0,w:l.data.width+2,h:l.data.height+2};s.push(u),i[a]=new fh(u,l),l.hasRenderCallback&&this.haveRenderCallbacks.push(a)}}patchUpdatedImages(t,i){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const s in t.updatedImages)this.patchUpdatedImage(this.iconPositions[s],t.getImage(s),i),this.patchUpdatedImage(this.patternPositions[s],t.getImage(s),i)}patchUpdatedImage(t,i,s){if(!t||!i||t.version===i.version)return;t.version=i.version;const[a,l]=t.tl;s.update(i.data,void 0,{x:a,y:l})}}var ys;function au(r,t,i,s,a,l,u,f,g,y,v,w,S,P,M){const C=po.fromFeature(r,a);let z;w===A.ay.vertical&&C.verticalizePunctuation();let F=C.determineLineBreaks(y,l,t,s,P);const{processBidirectionalText:Z,processStyledBidirectionalText:O}=nn;if(Z&&C.sections.length===1){z=[],F=F.map(ot=>C.toCodeUnitIndex(ot));const et=Z(C.toString(),F);for(const ot of et){const _t=[...ot].map(()=>0);z.push(new po(ot,C.sections,_t))}}else if(O){z=[],F=F.map(ft=>C.toCodeUnitIndex(ft));let et=0;const ot=[];for(const ft of C.text)ot.push(...Array(ft.length).fill(C.sectionIndex[et])),et++;const _t=O(C.text,ot,F);for(const ft of _t){const yt=[];let Mt="";for(const wt of ft[0])yt.push(ft[1][Mt.length]),Mt+=wt;z.push(new po(ft[0],C.sections,yt))}}else z=function(et,ot){const _t=[];let ft=0;for(const yt of ot)_t.push(et.substring(ft,yt)),ft=yt;return ft<et.length()&&_t.push(et.substring(ft,et.length())),_t}(C,F);const j=[],Q={positionedLines:j,text:C.toString(),top:v[1],bottom:v[1],left:v[0],right:v[0],writingMode:w,iconsInText:!1,verticalizable:!1};return function(et,ot,_t,ft,yt,Mt,wt,Tt,mt,Rt,Lt,Nt){let Ct=0,Yt=0,Se=0,Ke=0;const xi=Tt==="right"?1:Tt==="left"?0:.5,Tr=ri/Nt;let Bi=0;for(const Ue of yt){Ue.trim();const hi=Ue.getMaxScale(),Mi={positionedGlyphs:[],lineOffset:0};et.positionedLines[Bi]=Mi;const Ii=Mi.positionedGlyphs;let Ui=0;if(!Ue.length()){Yt+=Mt,++Bi;continue}const bi=wm(ft,Ue,Tr);let Gi=0;for(const ai of Ue.text){const ze=Ue.getSection(Gi),Je=ai.codePointAt(0),Oe=Tm(mt,Lt,Je),oi={glyph:Je,imageName:null,x:Ct,y:Yt+-17,vertical:Oe,scale:1,fontStack:"",sectionIndex:Ue.getSectionIndex(Gi),metrics:null,rect:null};let Nn;if("fontStack"in ze){if(Nn=Sm(ze,Je,Oe,bi,ot,_t),!Nn)continue;oi.fontStack=ze.fontStack}else{if(et.iconsInText=!0,ze.scale*=Tr,Nn=Pm(ze,Oe,hi,bi,ft),!Nn)continue;Ui=Math.max(Ui,Nn.imageOffset),oi.imageName=ze.imageName}const{rect:Br,metrics:Wl,baselineOffset:Ts}=Nn;oi.y+=Ts,oi.scale=ze.scale,oi.metrics=Wl,oi.rect=Br,Ii.push(oi),Oe?(et.verticalizable=!0,Ct+=("imageName"in ze?Wl.advance:ri)*ze.scale+Rt):Ct+=Wl.advance*ze.scale+Rt,Gi++}Ii.length!==0&&(Se=Math.max(Ct-Rt,Se),Mm(Ii,0,Ii.length-1,xi)),Ct=0,Mi.lineOffset=Math.max(Ui,(hi-1)*ri);const Sr=Mt*hi+Ui;Yt+=Sr,Ke=Math.max(Sr,Ke),++Bi}const{horizontalAlign:ui,verticalAlign:vi}=mh(wt);(function(Ue,hi,Mi,Ii,Ui,bi,Gi,Sr,ai){const ze=(hi-Mi)*Ui;let Je=0;Je=bi!==Gi?-Sr*Ii- -17:-Ii*ai*Gi+.5*Gi;for(const Oe of Ue)for(const oi of Oe.positionedGlyphs)oi.x+=ze,oi.y+=Je})(et.positionedLines,xi,ui,vi,Se,Ke,Mt,Yt,yt.length),et.top+=-vi*Yt,et.bottom=et.top+Yt,et.left+=-ui*Se,et.right=et.left+Se}(Q,t,i,s,z,u,f,g,w,y,S,M),!function(et){for(const ot of et)if(ot.positionedGlyphs.length!==0)return!1;return!0}(j)&&Q}function mh(r){let t=.5,i=.5;switch(r){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(r){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:t,verticalAlign:i}}function wm(r,t,i){const s=t.getMaxScale()*ri,{maxImageWidth:a,maxImageHeight:l}=t.getMaxImageSize(r),u=Math.max(s,l*i);return{verticalLineContentWidth:Math.max(s,a*i),horizontalLineContentHeight:u}}function Vd(r){switch(r){case"top":return 0;case"center":return .5;default:return 1}}function Tm(r,t,i){return!(r===A.ay.horizontal||!t&&!ms(i)||t&&(Nc(i)||(s=i,/\p{sc=Arab}/u.test(String.fromCodePoint(s)))));var s}function Sm(r,t,i,s,a,l){const u=l[r.fontStack],f=function(y,v,w,S){if(y&&y.rect)return y;const P=v[w.fontStack],M=P&&P[S];return M?{rect:null,metrics:M.metrics}:null}(u&&u[t],a,r,t);if(f===null)return null;let g;if(i)g=s.verticalLineContentWidth-r.scale*ri;else{const y=Vd(r.verticalAlign);g=(s.horizontalLineContentHeight-r.scale*ri)*y}return{rect:f.rect,metrics:f.metrics,baselineOffset:g}}function Pm(r,t,i,s,a){const l=a[r.imageName];if(!l)return null;const u=l.paddedRect,f=l.displaySize,g={width:f[0],height:f[1],left:1,top:-3,advance:t?f[1]:f[0]};let y;if(t)y=s.verticalLineContentWidth-f[1]*r.scale;else{const v=Vd(r.verticalAlign);y=(s.horizontalLineContentHeight-f[1]*r.scale)*v}return{rect:u,metrics:g,baselineOffset:y,imageOffset:(t?f[0]:f[1])*r.scale-ri*i}}function Mm(r,t,i,s){if(s===0)return;const a=r[i],l=(r[i].x+a.metrics.advance*a.scale)*s;for(let u=t;u<=i;u++)r[u].x-=l}function Im(r,t,i){const{horizontalAlign:s,verticalAlign:a}=mh(i),l=t[0]-r.displaySize[0]*s,u=t[1]-r.displaySize[1]*a;return{image:r,top:u,bottom:u+r.displaySize[1],left:l,right:l+r.displaySize[0]}}function Nd(r){var t,i;let s=r.left,a=r.top,l=r.right-s,u=r.bottom-a;const f=(t=r.image.textFitWidth)!==null&&t!==void 0?t:"stretchOrShrink",g=(i=r.image.textFitHeight)!==null&&i!==void 0?i:"stretchOrShrink",y=(r.image.content[2]-r.image.content[0])/(r.image.content[3]-r.image.content[1]);if(g==="proportional"){if(f==="stretchOnly"&&l/u<y||f==="proportional"){const v=Math.ceil(u*y);s*=v/l,l=v}}else if(f==="proportional"&&g==="stretchOnly"&&y!==0&&l/u>y){const v=Math.ceil(l/y);a*=v/u,u=v}return{x1:s,y1:a,x2:s+l,y2:a+u}}function jd(r,t,i,s,a,l){const u=r.image;let f;if(u.content){const z=u.content,F=u.pixelRatio||1;f=[z[0]/F,z[1]/F,u.displaySize[0]-z[2]/F,u.displaySize[1]-z[3]/F]}const g=t.left*l,y=t.right*l;let v,w,S,P;i==="width"||i==="both"?(P=a[0]+g-s[3],w=a[0]+y+s[1]):(P=a[0]+(g+y-u.displaySize[0])/2,w=P+u.displaySize[0]);const M=t.top*l,C=t.bottom*l;return i==="height"||i==="both"?(v=a[1]+M-s[0],S=a[1]+C+s[2]):(v=a[1]+(M+C-u.displaySize[1])/2,S=v+u.displaySize[1]),{image:u,top:v,right:w,bottom:S,left:P,collisionPadding:f}}It("ImagePosition",fh),It("ImageAtlas",Od),A.ay=void 0,(ys=A.ay||(A.ay={}))[ys.none=0]="none",ys[ys.horizontal=1]="horizontal",ys[ys.vertical=2]="vertical",ys[ys.horizontalOnly=3]="horizontalOnly";const On=128,xs=32640;function Ud(r,t){const{expression:i}=t;if(i.kind==="constant")return{kind:"constant",layoutSize:i.evaluate(new ce(r+1))};if(i.kind==="source")return{kind:"source"};{const{zoomStops:s,interpolationType:a}=i;let l=0;for(;l<s.length&&s[l]<=r;)l++;l=Math.max(0,l-1);let u=l;for(;u<s.length&&s[u]<r+1;)u++;u=Math.min(s.length-1,u);const f=s[l],g=s[u];return i.kind==="composite"?{kind:"composite",minZoom:f,maxZoom:g,interpolationType:a}:{kind:"camera",minZoom:f,maxZoom:g,minSize:i.evaluate(new ce(f)),maxSize:i.evaluate(new ce(g)),interpolationType:a}}}function gh(r,t,i){let s="never";const a=r.get(t);return a?s=a:r.get(i)&&(s="always"),s}const Em=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function ou(r,t,i,s,a,l,u,f,g,y,v,w,S){const P=f?Math.min(xs,Math.round(f[0])):0,M=f?Math.min(xs,Math.round(f[1])):0;r.emplaceBack(t,i,Math.round(32*s),Math.round(32*a),l,u,(P<<1)+(g?1:0),M,16*y,16*v,256*w,256*S)}function _h(r,t,i){r.emplaceBack(t.x,t.y,i),r.emplaceBack(t.x,t.y,i),r.emplaceBack(t.x,t.y,i),r.emplaceBack(t.x,t.y,i)}function Cm(r){for(const t of r.sections)if(Gc(t.text))return!0;return!1}class yh{constructor(t){this.layoutVertexArray=new ct,this.indexArray=new vt,this.programConfigurations=t,this.segments=new $t,this.dynamicLayoutVertexArray=new st,this.opacityVertexArray=new at,this.hasVisibleVertices=!1,this.placedSymbolArray=new x}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,i,s,a){this.isEmpty()||(s&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,im.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,rm.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Em,!0),this.opacityVertexBuffer.itemSize=1),(s||a)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}It("SymbolBuffers",yh);class xh{constructor(t,i,s){this.layoutVertexArray=new t,this.layoutAttributes=i,this.indexArray=new s,this.segments=new $t,this.collisionVertexArray=new St}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,nm.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}It("CollisionBuffers",xh);class mo{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(u=>u.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Ud(this.zoom,i["text-size"]),this.iconSizeData=Ud(this.zoom,i["icon-size"]);const s=this.layers[0].layout,a=s.get("symbol-sort-key"),l=s.get("symbol-z-order");this.canOverlap=gh(s,"text-overlap","text-allow-overlap")!=="never"||gh(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=l!=="viewport-y"&&!a.isConstant(),this.sortFeaturesByY=(l==="viewport-y"||l==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,s.get("symbol-placement")==="point"&&(this.writingModes=s.get("text-writing-mode").map(u=>A.ay[u])),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.sourceID=t.sourceID}createArrays(){this.text=new yh(new Bn(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new yh(new Bn(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new E,this.lineVertexArray=new I,this.symbolInstances=new T,this.textAnchorOffsets=new L}calculateGlyphDependencies(t,i,s,a,l){for(const u of t)if(i[u.codePointAt(0)]=!0,(s||a)&&l){const f=Fl[u];f&&(i[f.codePointAt(0)]=!0)}}populate(t,i,s){const a=this.layers[0],l=a.layout,u=l.get("text-font"),f=l.get("text-field"),g=l.get("icon-image"),y=(f.value.kind!=="constant"||f.value.value instanceof We&&!f.value.value.isEmpty()||f.value.value.toString().length>0)&&(u.value.kind!=="constant"||u.value.value.length>0),v=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,w=l.get("symbol-sort-key");if(this.features=[],!y&&!v)return;const S=i.iconDependencies,P=i.glyphDependencies,M=i.availableImages,C=new ce(this.zoom);for(const{feature:z,id:F,index:Z,sourceLayerIndex:O}of t){const j=a._featureFilter.needGeometry,Q=Rr(z,j);if(!a._featureFilter.filter(C,Q,s))continue;let et,ot;if(j||(Q.geometry=cn(z)),y){const ft=a.getValueAndResolveTokens("text-field",Q,s,M),yt=We.factory(ft),Mt=this.hasRTLText=this.hasRTLText||Cm(yt);(!Mt||nn.getRTLTextPluginStatus()==="unavailable"||Mt&&nn.isParsed())&&(et=am(yt,a,Q))}if(v){const ft=a.getValueAndResolveTokens("icon-image",Q,s,M);ot=ft instanceof zi?ft:zi.fromString(ft)}if(!et&&!ot)continue;const _t=this.sortFeaturesByKey?w.evaluate(Q,{},s):void 0;if(this.features.push({id:F,text:et,icon:ot,index:Z,sourceLayerIndex:O,geometry:Q.geometry,properties:z.properties,type:ho.types[z.type],sortKey:_t}),ot&&(S[ot.name]=!0),et){const ft=u.evaluate(Q,{},s).join(","),yt=l.get("text-rotation-alignment")!=="viewport"&&l.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(A.ay.vertical)>=0;for(const Mt of et.sections)if(Mt.image)S[Mt.image.name]=!0;else{const wt=ta(et.toString()),Tt=Mt.fontStack||ft,mt=P[Tt]=P[Tt]||{};this.calculateGlyphDependencies(Mt.text,mt,yt,this.allowVerticalPlacement,wt)}}}l.get("symbol-placement")==="line"&&(this.features=function(z){const F={},Z={},O=[];let j=0;function Q(ft){O.push(z[ft]),j++}function et(ft,yt,Mt){const wt=Z[ft];return delete Z[ft],Z[yt]=wt,O[wt].geometry[0].pop(),O[wt].geometry[0]=O[wt].geometry[0].concat(Mt[0]),wt}function ot(ft,yt,Mt){const wt=F[yt];return delete F[yt],F[ft]=wt,O[wt].geometry[0].shift(),O[wt].geometry[0]=Mt[0].concat(O[wt].geometry[0]),wt}function _t(ft,yt,Mt){const wt=Mt?yt[0][yt[0].length-1]:yt[0][0];return`${ft}:${wt.x}:${wt.y}`}for(let ft=0;ft<z.length;ft++){const yt=z[ft],Mt=yt.geometry,wt=yt.text?yt.text.toString():null;if(!wt){Q(ft);continue}const Tt=_t(wt,Mt),mt=_t(wt,Mt,!0);if(Tt in Z&&mt in F&&Z[Tt]!==F[mt]){const Rt=ot(Tt,mt,Mt),Lt=et(Tt,mt,O[Rt].geometry);delete F[Tt],delete Z[mt],Z[_t(wt,O[Lt].geometry,!0)]=Lt,O[Rt].geometry=null}else Tt in Z?et(Tt,mt,Mt):mt in F?ot(Tt,mt,Mt):(Q(ft),F[Tt]=j-1,Z[mt]=j-1)}return O.filter(ft=>ft.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((z,F)=>z.sortKey-F.sortKey)}update(t,i,s){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,i,this.layers,{imagePositions:s}),this.icon.programConfigurations.updatePaintArrays(t,i,this.layers,{imagePositions:s}))}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,i){const s=this.lineVertexArray.length;if(t.segment!==void 0){let a=t.dist(i[t.segment+1]),l=t.dist(i[t.segment]);const u={};for(let f=t.segment+1;f<i.length;f++)u[f]={x:i[f].x,y:i[f].y,tileUnitDistanceFromAnchor:a},f<i.length-1&&(a+=i[f+1].dist(i[f]));for(let f=t.segment||0;f>=0;f--)u[f]={x:i[f].x,y:i[f].y,tileUnitDistanceFromAnchor:l},f>0&&(l+=i[f-1].dist(i[f]));for(let f=0;f<i.length;f++){const g=u[f];this.lineVertexArray.emplaceBack(g.x,g.y,g.tileUnitDistanceFromAnchor)}}return{lineStartIndex:s,lineLength:this.lineVertexArray.length-s}}addSymbols(t,i,s,a,l,u,f,g,y,v,w,S){const P=t.indexArray,M=t.layoutVertexArray,C=t.segments.prepareSegment(4*i.length,M,P,this.canOverlap?u.sortKey:void 0),z=this.glyphOffsetArray.length,F=C.vertexLength,Z=this.allowVerticalPlacement&&f===A.ay.vertical?Math.PI/2:0,O=u.text&&u.text.sections;for(let j=0;j<i.length;j++){const{tl:Q,tr:et,bl:ot,br:_t,tex:ft,pixelOffsetTL:yt,pixelOffsetBR:Mt,minFontScaleX:wt,minFontScaleY:Tt,glyphOffset:mt,isSDF:Rt,sectionIndex:Lt}=i[j],Nt=C.vertexLength,Ct=mt[1];ou(M,g.x,g.y,Q.x,Ct+Q.y,ft.x,ft.y,s,Rt,yt.x,yt.y,wt,Tt),ou(M,g.x,g.y,et.x,Ct+et.y,ft.x+ft.w,ft.y,s,Rt,Mt.x,yt.y,wt,Tt),ou(M,g.x,g.y,ot.x,Ct+ot.y,ft.x,ft.y+ft.h,s,Rt,yt.x,Mt.y,wt,Tt),ou(M,g.x,g.y,_t.x,Ct+_t.y,ft.x+ft.w,ft.y+ft.h,s,Rt,Mt.x,Mt.y,wt,Tt),_h(t.dynamicLayoutVertexArray,g,Z),P.emplaceBack(Nt,Nt+2,Nt+1),P.emplaceBack(Nt+1,Nt+2,Nt+3),C.vertexLength+=4,C.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(mt[0]),j!==i.length-1&&Lt===i[j+1].sectionIndex||t.programConfigurations.populatePaintArrays(M.length,u,u.index,{imagePositions:{},canonical:S,formattedSection:O&&O[Lt]})}t.placedSymbolArray.emplaceBack(g.x,g.y,z,this.glyphOffsetArray.length-z,F,y,v,g.segment,s?s[0]:0,s?s[1]:0,a[0],a[1],f,0,!1,0,w)}_addCollisionDebugVertex(t,i,s,a,l,u){return i.emplaceBack(0,0),t.emplaceBack(s.x,s.y,a,l,Math.round(u.x),Math.round(u.y))}addCollisionDebugVertices(t,i,s,a,l,u,f){const g=l.segments.prepareSegment(4,l.layoutVertexArray,l.indexArray),y=g.vertexLength,v=l.layoutVertexArray,w=l.collisionVertexArray,S=f.anchorX,P=f.anchorY;this._addCollisionDebugVertex(v,w,u,S,P,new Pt(t,i)),this._addCollisionDebugVertex(v,w,u,S,P,new Pt(s,i)),this._addCollisionDebugVertex(v,w,u,S,P,new Pt(s,a)),this._addCollisionDebugVertex(v,w,u,S,P,new Pt(t,a)),g.vertexLength+=4;const M=l.indexArray;M.emplaceBack(y,y+1),M.emplaceBack(y+1,y+2),M.emplaceBack(y+2,y+3),M.emplaceBack(y+3,y),g.primitiveLength+=4}addDebugCollisionBoxes(t,i,s,a){for(let l=t;l<i;l++){const u=this.collisionBoxArray.get(l);this.addCollisionDebugVertices(u.x1,u.y1,u.x2,u.y2,a?this.textCollisionBox:this.iconCollisionBox,u.anchorPoint,s)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new xh(lt,Cd.members,gt),this.iconCollisionBox=new xh(lt,Cd.members,gt);for(let t=0;t<this.symbolInstances.length;t++){const i=this.symbolInstances.get(t);this.addDebugCollisionBoxes(i.textBoxStartIndex,i.textBoxEndIndex,i,!0),this.addDebugCollisionBoxes(i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i,!0),this.addDebugCollisionBoxes(i.iconBoxStartIndex,i.iconBoxEndIndex,i,!1),this.addDebugCollisionBoxes(i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex,i,!1)}}_deserializeCollisionBoxesForSymbol(t,i,s,a,l,u,f,g,y){const v={};for(let w=i;w<s;w++){const S=t.get(w);v.textBox={x1:S.x1,y1:S.y1,x2:S.x2,y2:S.y2,anchorPointX:S.anchorPointX,anchorPointY:S.anchorPointY},v.textFeatureIndex=S.featureIndex;break}for(let w=a;w<l;w++){const S=t.get(w);v.verticalTextBox={x1:S.x1,y1:S.y1,x2:S.x2,y2:S.y2,anchorPointX:S.anchorPointX,anchorPointY:S.anchorPointY},v.verticalTextFeatureIndex=S.featureIndex;break}for(let w=u;w<f;w++){const S=t.get(w);v.iconBox={x1:S.x1,y1:S.y1,x2:S.x2,y2:S.y2,anchorPointX:S.anchorPointX,anchorPointY:S.anchorPointY},v.iconFeatureIndex=S.featureIndex;break}for(let w=g;w<y;w++){const S=t.get(w);v.verticalIconBox={x1:S.x1,y1:S.y1,x2:S.x2,y2:S.y2,anchorPointX:S.anchorPointX,anchorPointY:S.anchorPointY},v.verticalIconFeatureIndex=S.featureIndex;break}return v}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){const s=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,s.textBoxStartIndex,s.textBoxEndIndex,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s.iconBoxStartIndex,s.iconBoxEndIndex,s.verticalIconBoxStartIndex,s.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}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,i){const s=t.placedSymbolArray.get(i),a=s.vertexStartIndex+4*s.numGlyphs;for(let l=s.vertexStartIndex;l<a;l+=4)t.indexArray.emplaceBack(l,l+2,l+1),t.indexArray.emplaceBack(l+1,l+2,l+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const i=Math.sin(t),s=Math.cos(t),a=[],l=[],u=[];for(let f=0;f<this.symbolInstances.length;++f){u.push(f);const g=this.symbolInstances.get(f);a.push(0|Math.round(i*g.anchorX+s*g.anchorY)),l.push(g.featureIndex)}return u.sort((f,g)=>a[f]-a[g]||l[g]-l[f]),u}addToSortKeyRanges(t,i){const s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===i?s.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:i,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 i of this.symbolInstanceIndexes){const s=this.symbolInstances.get(i);this.featureSortOrder.push(s.featureIndex),[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex].forEach((a,l,u)=>{a>=0&&u.indexOf(a)===l&&this.addIndicesForPlacedSymbol(this.text,a)}),s.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,s.verticalPlacedTextSymbolIndex),s.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.placedIconSymbolIndex),s.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Gd,Zd;It("SymbolBucket",mo,{omit:["layers","collisionBoxArray","features","compareText"]}),mo.MAX_GLYPHS=65535,mo.addDynamicAttributes=_h;var vh={get paint(){return Zd=Zd||new gi({"icon-opacity":new Vt(U.paint_symbol["icon-opacity"]),"icon-color":new Vt(U.paint_symbol["icon-color"]),"icon-halo-color":new Vt(U.paint_symbol["icon-halo-color"]),"icon-halo-width":new Vt(U.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Vt(U.paint_symbol["icon-halo-blur"]),"icon-translate":new zt(U.paint_symbol["icon-translate"]),"icon-translate-anchor":new zt(U.paint_symbol["icon-translate-anchor"]),"text-opacity":new Vt(U.paint_symbol["text-opacity"]),"text-color":new Vt(U.paint_symbol["text-color"],{runtimeType:Di,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new Vt(U.paint_symbol["text-halo-color"]),"text-halo-width":new Vt(U.paint_symbol["text-halo-width"]),"text-halo-blur":new Vt(U.paint_symbol["text-halo-blur"]),"text-translate":new zt(U.paint_symbol["text-translate"]),"text-translate-anchor":new zt(U.paint_symbol["text-translate-anchor"])})},get layout(){return Gd=Gd||new gi({"symbol-placement":new zt(U.layout_symbol["symbol-placement"]),"symbol-spacing":new zt(U.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new zt(U.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Vt(U.layout_symbol["symbol-sort-key"]),"symbol-z-order":new zt(U.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new zt(U.layout_symbol["icon-allow-overlap"]),"icon-overlap":new zt(U.layout_symbol["icon-overlap"]),"icon-ignore-placement":new zt(U.layout_symbol["icon-ignore-placement"]),"icon-optional":new zt(U.layout_symbol["icon-optional"]),"icon-rotation-alignment":new zt(U.layout_symbol["icon-rotation-alignment"]),"icon-size":new Vt(U.layout_symbol["icon-size"]),"icon-text-fit":new zt(U.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new zt(U.layout_symbol["icon-text-fit-padding"]),"icon-image":new Vt(U.layout_symbol["icon-image"]),"icon-rotate":new Vt(U.layout_symbol["icon-rotate"]),"icon-padding":new Vt(U.layout_symbol["icon-padding"]),"icon-keep-upright":new zt(U.layout_symbol["icon-keep-upright"]),"icon-offset":new Vt(U.layout_symbol["icon-offset"]),"icon-anchor":new Vt(U.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new zt(U.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new zt(U.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new zt(U.layout_symbol["text-rotation-alignment"]),"text-field":new Vt(U.layout_symbol["text-field"]),"text-font":new Vt(U.layout_symbol["text-font"]),"text-size":new Vt(U.layout_symbol["text-size"]),"text-max-width":new Vt(U.layout_symbol["text-max-width"]),"text-line-height":new zt(U.layout_symbol["text-line-height"]),"text-letter-spacing":new Vt(U.layout_symbol["text-letter-spacing"]),"text-justify":new Vt(U.layout_symbol["text-justify"]),"text-radial-offset":new Vt(U.layout_symbol["text-radial-offset"]),"text-variable-anchor":new zt(U.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Vt(U.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Vt(U.layout_symbol["text-anchor"]),"text-max-angle":new zt(U.layout_symbol["text-max-angle"]),"text-writing-mode":new zt(U.layout_symbol["text-writing-mode"]),"text-rotate":new Vt(U.layout_symbol["text-rotate"]),"text-padding":new zt(U.layout_symbol["text-padding"]),"text-keep-upright":new zt(U.layout_symbol["text-keep-upright"]),"text-transform":new Vt(U.layout_symbol["text-transform"]),"text-offset":new Vt(U.layout_symbol["text-offset"]),"text-allow-overlap":new zt(U.layout_symbol["text-allow-overlap"]),"text-overlap":new zt(U.layout_symbol["text-overlap"]),"text-ignore-placement":new zt(U.layout_symbol["text-ignore-placement"]),"text-optional":new zt(U.layout_symbol["text-optional"])})}};class $d{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:me,this.defaultValue=t}evaluate(t){if(t.formattedSection){const i=this.defaultValue.property.overrides;if(i&&i.hasOverride(t.formattedSection))return i.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}}It("FormatSectionOverride",$d,{omit:["defaultValue"]});class lu extends Hi{constructor(t,i){super(t,vh,i)}recalculate(t,i){if(super.recalculate(t,i),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 s=this.layout.get("text-writing-mode");if(s){const a=[];for(const l of s)a.indexOf(l)<0&&a.push(l);this.layout._values["text-writing-mode"]=a}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,i,s,a){const l=this.layout.get(t).evaluate(i,{},s,a),u=this._unevaluatedLayout._values[t];return u.isDataDriven()||Ua(u.value)||!l?l:function(f,g){return g.replace(/{([^{}]+)}/g,(y,v)=>f&&v in f?String(f[v]):"")}(i.properties,l)}createBucket(t){return new mo(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of vh.paint.overridableProperties){if(!lu.hasPaintOverride(this.layout,t))continue;const i=this.paint.get(t),s=new $d(i),a=new ja(s,i.property.specification);let l=null;l=i.value.kind==="constant"||i.value.kind==="source"?new En("source",a):new Za("composite",a,i.value.zoomStops),this.paint._values[t]=new or(i.property,l,i.parameters)}}_handleOverridablePaintPropertyUpdate(t,i,s){return!(!this.layout||i.isDataDriven()||s.isDataDriven())&&lu.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,i){const s=t.get("text-field"),a=vh.paint.properties[i];let l=!1;const u=f=>{for(const g of f)if(a.overrides&&a.overrides.hasOverride(g))return void(l=!0)};if(s.value.kind==="constant"&&s.value.value instanceof We)u(s.value.value.sections);else if(s.value.kind==="source"||s.value.kind==="composite"){const f=y=>{l||(y instanceof tn&&be(y.value)===Xn?u(y.value.sections):y instanceof Tn?u(y.sections):y.eachChild(f))},g=s.value;g._styleExpression&&f(g._styleExpression.expression)}return l}}let qd;var Am={get paint(){return qd=qd||new gi({"background-color":new zt(U.paint_background["background-color"]),"background-pattern":new qc(U.paint_background["background-pattern"]),"background-opacity":new zt(U.paint_background["background-opacity"])})}};class Dm extends Hi{constructor(t,i){super(t,Am,i)}}class zm extends Hi{constructor(t,i){super(t,{},i),this.onAdd=s=>{this.implementation.onAdd&&this.implementation.onAdd(s,s.painter.context.gl)},this.onRemove=s=>{this.implementation.onRemove&&this.implementation.onRemove(s,s.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 km{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 Rm={once:!0},bh=63710088e-1;class vs{constructor(t,i){if(isNaN(t)||isNaN(i))throw new Error(`Invalid LngLat object: (${t}, ${i})`);if(this.lng=+t,this.lat=+i,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new vs(Qi(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const i=Math.PI/180,s=this.lat*i,a=t.lat*i,l=Math.sin(s)*Math.sin(a)+Math.cos(s)*Math.cos(a)*Math.cos((t.lng-this.lng)*i);return bh*Math.acos(Math.min(l,1))}static convert(t){if(t instanceof vs)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new vs(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new vs(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: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const Wd=2*Math.PI*bh;function Hd(r){return Wd*Math.cos(r*Math.PI/180)}function Xd(r){return(180+r)/360}function Yd(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function Kd(r,t){return r/Hd(t)}function Jd(r){return 360*r-180}function cu(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function Qd(r,t){return r*Hd(cu(t))}class Bl{constructor(t,i,s=0){this.x=+t,this.y=+i,this.z=+s}static fromLngLat(t,i=0){const s=vs.convert(t);return new Bl(Xd(s.lng),Yd(s.lat),Kd(i,s.lat))}toLngLat(){return new vs(Jd(this.x),cu(this.y))}toAltitude(){return Qd(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Wd*(t=cu(this.y),1/Math.cos(t*Math.PI/180));var t}}function tp(r,t,i){var s=2*Math.PI*6378137/256/Math.pow(2,i);return[r*s-2*Math.PI*6378137/2,t*s-2*Math.PI*6378137/2]}class wh{constructor(t,i,s){if(!function(a,l,u){return!(a<0||a>25||u<0||u>=Math.pow(2,a)||l<0||l>=Math.pow(2,a))}(t,i,s))throw new Error(`x=${i}, y=${s}, 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=i,this.y=s,this.key=go(0,t,t,i,s)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,i,s){const a=(u=this.y,f=this.z,g=tp(256*(l=this.x),256*(u=Math.pow(2,f)-u-1),f),y=tp(256*(l+1),256*(u+1),f),g[0]+","+g[1]+","+y[0]+","+y[1]);var l,u,f,g,y;const v=function(w,S,P){let M,C="";for(let z=w;z>0;z--)M=1<<z-1,C+=(S&M?1:0)+(P&M?2:0);return C}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(s==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,i>1?"@2x":"").replace(/{quadkey}/g,v).replace(/{bbox-epsg-3857}/g,a)}isChildOf(t){const i=this.z-t.z;return i>0&&t.x===this.x>>i&&t.y===this.y>>i}getTilePoint(t){const i=Math.pow(2,this.z);return new Pt((t.x*i-this.x)*le,(t.y*i-this.y)*le)}toString(){return`${this.z}/${this.x}/${this.y}`}}class ep{constructor(t,i){this.wrap=t,this.canonical=i,this.key=go(t,i.z,i.z,i.x,i.y)}}class lr{constructor(t,i,s,a,l){if(this.terrainRttPosMatrix32f=null,t<s)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${s}`);this.overscaledZ=t,this.wrap=i,this.canonical=new wh(s,+a,+l),this.key=go(i,t,s,a,l)}clone(){return new lr(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 i=this.canonical.z-t;return t>this.canonical.z?new lr(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new lr(t,this.wrap,t,this.canonical.x>>i,this.canonical.y>>i)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(t,i){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const s=this.canonical.z-t;return t>this.canonical.z?go(this.wrap*+i,t,this.canonical.z,this.canonical.x,this.canonical.y):go(this.wrap*+i,t,t,this.canonical.x>>s,this.canonical.y>>s)}isChildOf(t){if(t.wrap!==this.wrap||this.overscaledZ-t.overscaledZ<=0)return!1;if(t.overscaledZ===0)return this.overscaledZ>0;const i=this.canonical.z-t.canonical.z;return!(i<0)&&t.canonical.x===this.canonical.x>>i&&t.canonical.y===this.canonical.y>>i}children(t){if(this.overscaledZ>=t)return[new lr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,s=2*this.canonical.x,a=2*this.canonical.y;return[new lr(i,this.wrap,i,s,a),new lr(i,this.wrap,i,s+1,a),new lr(i,this.wrap,i,s,a+1),new lr(i,this.wrap,i,s+1,a+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new lr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new lr(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new ep(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new Bl(t.x-this.wrap,t.y))}}function go(r,t,i,s,a){(r*=2)<0&&(r=-1*r-1);const l=1<<i;return(l*l*r+l*a+s).toString(36)+i.toString(36)+t.toString(36)}function Ol(r,t){return t?r.properties[t]:r.id}function Lm(r,t){const i={id:r.id};if(t.removeAllProperties&&(delete r.removeProperties,delete r.addOrUpdateProperties,delete t.removeProperties),t.removeProperties)for(const s of t.removeProperties){const a=r.addOrUpdateProperties.findIndex(l=>l.key===s);a>-1&&r.addOrUpdateProperties.splice(a,1)}return(r.removeAllProperties||t.removeAllProperties)&&(i.removeAllProperties=!0),(r.removeProperties||t.removeProperties)&&(i.removeProperties=[...r.removeProperties||[],...t.removeProperties||[]]),(r.addOrUpdateProperties||t.addOrUpdateProperties)&&(i.addOrUpdateProperties=[...r.addOrUpdateProperties||[],...t.addOrUpdateProperties||[]]),(r.newGeometry||t.newGeometry)&&(i.newGeometry=t.newGeometry||r.newGeometry),i}function ip(r){var t,i;if(!r)return{};const s={};return s.removeAll=r.removeAll,s.remove=new Set(r.remove||[]),s.add=new Map((t=r.add)===null||t===void 0?void 0:t.map(a=>[a.id,a])),s.update=new Map((i=r.update)===null||i===void 0?void 0:i.map(a=>[a.id,a])),s}It("CanonicalTileID",wh),It("OverscaledTileID",lr,{omit:["terrainRttPosMatrix32f"]});class rp{constructor(t){this._stringToNumber={},this._numberToString=[];for(let i=0;i<t.length;i++){const s=t[i];this._stringToNumber[s]=i,this._numberToString[i]=s}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=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 np{constructor(t,i,s,a,l){this.type="Feature",this._vectorTileFeature=t,t._z=i,t._x=s,t._y=a,this.properties=t.properties,this.id=l}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 i in this)i!=="_geometry"&&i!=="_vectorTileFeature"&&(t[i]=this[i]);return t}}class _o{_name;dataBuffer;nullabilityBuffer;_size;constructor(t,i,s){this._name=t,this.dataBuffer=i,typeof s=="number"?this._size=s:(this.nullabilityBuffer=s,this._size=s.size())}getValue(t){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(t)?null:this.getValueFromBuffer(t)}has(t){return this.nullabilityBuffer&&this.nullabilityBuffer.get(t)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class uu extends _o{}class Th extends uu{getValueFromBuffer(t){return this.dataBuffer[t]}}class Sh extends uu{getValueFromBuffer(t){return this.dataBuffer[t]}}class sp extends _o{delta;constructor(t,i,s,a){super(t,i,a),this.delta=s}}class Ph extends sp{constructor(t,i,s,a){super(t,Int32Array.of(i),s,a)}getValueFromBuffer(t){return this.dataBuffer[0]+t*this.delta}}class Mh extends _o{constructor(t,i,s){super(t,Int32Array.of(i),s)}getValueFromBuffer(t){return this.dataBuffer[0]}}class Fm{_name;_geometryVector;_idVector;_propertyVectors;_extent;propertyVectorsMap;constructor(t,i,s,a,l=4096){this._name=t,this._geometryVector=i,this._idVector=s,this._propertyVectors=a,this._extent=l}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(t){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this._propertyVectors.map(i=>[i.name,i]))),this.propertyVectorsMap.get(t)}*[Symbol.iterator](){const t=this.geometryVector[Symbol.iterator]();let i=0;for(;i<this.numFeatures;){let s;this.idVector&&(s=this.containsMaxSaveIntegerValues(this.idVector)?Number(this.idVector.getValue(i)):this.idVector.getValue(i));const a=t?.next().value,l={};for(const u of this.propertyVectors){if(!u)continue;const f=u.name,g=u.getValue(i);g!==null&&(l[f]=g)}i++,yield{id:s,geometry:a,properties:l}}}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){const t=[],i=this.geometryVector.getGeometries();for(let s=0;s<this.numFeatures;s++){let a;this.idVector&&(a=this.containsMaxSaveIntegerValues(this.idVector)?Number(this.idVector.getValue(s)):this.idVector.getValue(s));const l={coordinates:i[s],type:this.geometryVector.geometryType(s)},u={};for(const f of this.propertyVectors){if(!f)continue;const g=f.name,y=f.getValue(s);y!==null&&(u[g]=y)}t.push({id:a,geometry:l,properties:u})}return t}containsMaxSaveIntegerValues(t){return t instanceof Th||t instanceof Mh&&t instanceof Ph||t instanceof Sh}}class Bm{value;constructor(t){this.value=t}get(){return this.value}set(t){this.value=t}increment(){return this.value++}add(t){this.value+=t}}var _i,te,Vn,Lr,da,Yi,ni,si,ap,cr;(function(r){r.PRESENT="PRESENT",r.DATA="DATA",r.OFFSET="OFFSET",r.LENGTH="LENGTH"})(_i||(_i={}));class Ih{_dictionaryType;_offsetType;_lengthType;constructor(t,i,s){this._dictionaryType=t,this._offsetType=i,this._lengthType=s}get dictionaryType(){return this._dictionaryType}get offsetType(){return this._offsetType}get lengthType(){return this._lengthType}}function ei(r,t,i){const s=new Int32Array(i);let a=0,l=t.get();for(let u=0;u<s.length;u++){let f=r[l++],g=127&f;f<128||(f=r[l++],g|=(127&f)<<7,f<128||(f=r[l++],g|=(127&f)<<14,f<128||(f=r[l++],g|=(127&f)<<21,f<128||(f=r[l++],g|=(15&f)<<28)))),s[a++]=g}return t.set(l),s}function hu(r,t,i){const s=new BigInt64Array(i);for(let a=0;a<s.length;a++)s[a]=Vm(r,t);return s}function Om(r,t){let i,s;return s=r[t.get()],t.increment(),i=127&s,s<128?i:(s=r[t.get()],t.increment(),i|=(127&s)<<7,s<128?i:(s=r[t.get()],t.increment(),i|=(127&s)<<14,s<128?i:(s=r[t.get()],t.increment(),i|=(127&s)<<21,s<128?i:(s=r[t.get()],i|=(15&s)<<28,function(a,l,u){let f,g;if(g=l[u.get()],u.increment(),f=(112&g)>>4,g<128||(g=l[u.get()],u.increment(),f|=(127&g)<<3,g<128)||(g=l[u.get()],u.increment(),f|=(127&g)<<10,g<128)||(g=l[u.get()],u.increment(),f|=(127&g)<<17,g<128)||(g=l[u.get()],u.increment(),f|=(127&g)<<24,g<128)||(g=l[u.get()],u.increment(),f|=(1&g)<<31,g<128))return 4294967296*f+(a>>>0);throw new Error("Expected varint not more than 10 bytes")}(i,r,t)))))}function op(r,t,i,s){throw new Error("FastPFor is not implemented yet.")}function pa(r){return r>>>1^-(1&r)}function yo(r){return r>>1n^-(1n&r)}function Vm(r,t){let i=0n,s=0,a=t.get();for(;a<r.length;){const l=r[a++];if(i|=BigInt(127&l)<<BigInt(s),!(128&l))break;if(s+=7,s>=64)throw new Error("Varint too long")}return t.set(a),i}function lp(r,t,i){const s=new Int32Array(i);let a=0;for(let l=0;l<t;l++){const u=r[l];s.fill(r[l+t],a,a+u),a+=u}return s}function cp(r,t,i){const s=new BigInt64Array(i);let a=0;for(let l=0;l<t;l++){const u=Number(r[l]);s.fill(r[l+t],a,a+u),a+=u}return s}function up(r,t,i){const s=new Float64Array(i);let a=0;for(let l=0;l<t;l++){const u=r[l];s.fill(r[l+t],a,a+u),a+=u}return s}function Eh(r){const t=r.length/4*4;let i=1;if(t>=4)for(let s=r[0];i<t-4;i+=4)s=r[i]+=s,s=r[i+1]+=s,s=r[i+2]+=s,s=r[i+3]+=s;for(;i!=r.length;)r[i]+=r[i-1],++i}function hp(r){r[0]=r[0]>>>1^-(1&r[0]),r[1]=r[1]>>>1^-(1&r[1]);const t=r.length/4*4;let i=2;if(t>=4)for(;i<t-4;i+=4){const s=r[i],a=r[i+1],l=r[i+2],u=r[i+3];r[i]=(s>>>1^-(1&s))+r[i-2],r[i+1]=(a>>>1^-(1&a))+r[i-1],r[i+2]=(l>>>1^-(1&l))+r[i],r[i+3]=(u>>>1^-(1&u))+r[i+1]}for(;i!=r.length;i+=2)r[i]=(r[i]>>>1^-(1&r[i]))+r[i-2],r[i+1]=(r[i+1]>>>1^-(1&r[i+1]))+r[i-1]}function bs(r,t,i){return Math.min(i,Math.max(t,r))}(function(r){r.NONE="NONE",r.DELTA="DELTA",r.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",r.RLE="RLE",r.MORTON="MORTON",r.PDE="PDE"})(te||(te={})),function(r){r.NONE="NONE",r.FAST_PFOR="FAST_PFOR",r.VARINT="VARINT",r.ALP="ALP"}(Vn||(Vn={})),function(r){r.NONE="NONE",r.SINGLE="SINGLE",r.SHARED="SHARED",r.VERTEX="VERTEX",r.MORTON="MORTON",r.FSST="FSST"}(Lr||(Lr={})),function(r){r.VERTEX="VERTEX",r.INDEX="INDEX",r.STRING="STRING",r.KEY="KEY"}(da||(da={})),function(r){r.VAR_BINARY="VAR_BINARY",r.GEOMETRIES="GEOMETRIES",r.PARTS="PARTS",r.RINGS="RINGS",r.TRIANGLES="TRIANGLES",r.SYMBOL="SYMBOL",r.DICTIONARY="DICTIONARY"}(Yi||(Yi={}));class fa{_physicalStreamType;_logicalStreamType;_logicalLevelTechnique1;_logicalLevelTechnique2;_physicalLevelTechnique;_numValues;_byteLength;constructor(t,i,s,a,l,u,f){this._physicalStreamType=t,this._logicalStreamType=i,this._logicalLevelTechnique1=s,this._logicalLevelTechnique2=a,this._physicalLevelTechnique=l,this._numValues=u,this._byteLength=f}static decode(t,i){const s=t[i.get()],a=Object.values(_i)[s>>4];let l=null;switch(a){case _i.DATA:l=new Ih(Object.values(Lr)[15&s]);break;case _i.OFFSET:l=new Ih(null,Object.values(da)[15&s]);break;case _i.LENGTH:l=new Ih(null,null,Object.values(Yi)[15&s])}i.increment();const u=t[i.get()],f=Object.values(te)[u>>5],g=Object.values(te)[u>>2&7],y=Object.values(Vn)[3&u];i.increment();const v=ei(t,i,2);return new fa(a,l,f,g,y,v[0],v[1])}get physicalStreamType(){return this._physicalStreamType}get logicalStreamType(){return this._logicalStreamType}get logicalLevelTechnique1(){return this._logicalLevelTechnique1}get logicalLevelTechnique2(){return this._logicalLevelTechnique2}get physicalLevelTechnique(){return this._physicalLevelTechnique}get numValues(){return this._numValues}get byteLength(){return this._byteLength}getDecompressedCount(){return this._numValues}}class du extends fa{num_bits;coordinate_shift;constructor(t,i,s,a,l,u,f,g,y){super(t,i,s,a,l,u,f),this.num_bits=g,this.coordinate_shift=y}static decode(t,i){const s=fa.decode(t,i),a=ei(t,i,2);return new du(s.physicalStreamType,s.logicalStreamType,s.logicalLevelTechnique1,s.logicalLevelTechnique2,s.physicalLevelTechnique,s.numValues,s.byteLength,a[0],a[1])}static decodePartial(t,i,s){const a=ei(i,s,2);return new du(t.physicalStreamType,t.logicalStreamType,t.logicalLevelTechnique1,t.logicalLevelTechnique2,t.physicalLevelTechnique,t.numValues,t.byteLength,a[0],a[1])}numBits(){return this.num_bits}coordinateShift(){return this.coordinate_shift}}class Vl extends fa{_runs;_numRleValues;constructor(t,i,s,a,l,u,f,g,y){super(t,i,s,a,l,u,f),this._runs=g,this._numRleValues=y}static decode(t,i){const s=fa.decode(t,i),a=ei(t,i,2);return new Vl(s.physicalStreamType,s.logicalStreamType,s.logicalLevelTechnique1,s.logicalLevelTechnique2,s.physicalLevelTechnique,s.numValues,s.byteLength,a[0],a[1])}static decodePartial(t,i,s){const a=ei(i,s,2);return new Vl(t.physicalStreamType,t.logicalStreamType,t.logicalLevelTechnique1,t.logicalLevelTechnique2,t.physicalLevelTechnique,t.numValues,t.byteLength,a[0],a[1])}get runs(){return this._runs}get numRleValues(){return this._numRleValues}getDecompressedCount(){return this._numRleValues}}class Pi{static decode(t,i){const s=fa.decode(t,i);return s.logicalLevelTechnique1===te.MORTON?du.decodePartial(s,t,i):te.RLE!==s.logicalLevelTechnique1&&te.RLE!==s.logicalLevelTechnique2||Vn.NONE===s.physicalLevelTechnique?s:Vl.decodePartial(s,t,i)}}(function(r){r[r.FLAT=0]="FLAT",r[r.CONST=1]="CONST",r[r.SEQUENCE=2]="SEQUENCE",r[r.DICTIONARY=3]="DICTIONARY",r[r.FSST_DICTIONARY=4]="FSST_DICTIONARY"})(ni||(ni={}));class Fr{values;_size;constructor(t,i){this.values=t,this._size=i}get(t){const i=Math.floor(t/8);return(this.values[i]>>t%8&1)==1}set(t,i){const s=Math.floor(t/8);this.values[s]=this.values[s]|(i?1:0)<<t%8}getInt(t){const i=Math.floor(t/8);return this.values[i]>>t%8&1}size(){return this._size}getBuffer(){return this.values}}class Ht{constructor(){}static decodeIntStream(t,i,s,a,l){const u=Ht.decodePhysicalLevelTechnique(t,i,s);return this.decodeIntBuffer(u,s,a,l)}static decodeLengthStreamToOffsetBuffer(t,i,s){const a=Ht.decodePhysicalLevelTechnique(t,i,s);return this.decodeLengthToOffsetBuffer(a,s)}static decodePhysicalLevelTechnique(t,i,s){const a=s.physicalLevelTechnique;if(a===Vn.FAST_PFOR)return op();if(a===Vn.VARINT)return ei(t,i,s.numValues);if(a===Vn.NONE){const l=i.get();i.add(s.byteLength);const u=t.subarray(l,i.get());return new Int32Array(u)}throw new Error("Specified physicalLevelTechnique is not supported (yet).")}static decodeConstIntStream(t,i,s,a){const l=Ht.decodePhysicalLevelTechnique(t,i,s);if(l.length===1){const u=l[0];return a?pa(u):u}return a?function(u){return pa(u[1])}(l):function(u){return u[1]}(l)}static decodeSequenceIntStream(t,i,s){return function(a){if(a.length==2){const l=pa(a[1]);return[l,l]}return[pa(a[2]),pa(a[3])]}(Ht.decodePhysicalLevelTechnique(t,i,s))}static decodeSequenceLongStream(t,i,s){return function(a){if(a.length==2){const l=yo(a[1]);return[l,l]}return[yo(a[2]),yo(a[3])]}(hu(t,i,s.numValues))}static decodeLongStream(t,i,s,a){const l=hu(t,i,s.numValues);return this.decodeLongBuffer(l,s,a)}static decodeLongFloat64Stream(t,i,s,a){const l=function(u,f,g){const y=new Float64Array(f);for(let v=0;v<f;v++)y[v]=Om(u,g);return y}(t,s.numValues,i);return this.decodeFloat64Buffer(l,s,a)}static decodeConstLongStream(t,i,s,a){const l=hu(t,i,s.numValues);if(l.length===1){const u=l[0];return a?yo(u):u}return a?function(u){return yo(u[1])}(l):function(u){return u[1]}(l)}static decodeIntBuffer(t,i,s,a){switch(i.logicalLevelTechnique1){case te.DELTA:return i.logicalLevelTechnique2===te.RLE?function(l,u,f){const g=new Int32Array(f);let y=0,v=0;for(let w=0;w<u;w++){const S=l[w],P=pa(l[w+u]);for(let M=0;M<S;M++)v+=P,g[y++]=v}return g}(t,i.runs,i.numRleValues):(function(l){l[0]=l[0]>>>1^-(1&l[0]);const u=l.length/4*4;let f=1;if(u>=4)for(;f<u-4;f+=4){const g=l[f],y=l[f+1],v=l[f+2],w=l[f+3];l[f]=(g>>>1^-(1&g))+l[f-1],l[f+1]=(y>>>1^-(1&y))+l[f],l[f+2]=(v>>>1^-(1&v))+l[f+1],l[f+3]=(w>>>1^-(1&w))+l[f+2]}for(;f!=l.length;++f)l[f]=(l[f]>>>1^-(1&l[f]))+l[f-1]}(t),t);case te.RLE:return function(l,u,f){return f?function(g,y,v){const w=new Int32Array(v);let S=0;for(let P=0;P<y;P++){const M=g[P];let C=g[P+y];C=C>>>1^-(1&C),w.fill(C,S,S+M),S+=M}return w}(l,u.runs,u.numRleValues):lp(l,u.runs,u.numRleValues)}(t,i,s);case te.MORTON:return Eh(t),t;case te.COMPONENTWISE_DELTA:return a?(function(l,u,f,g){let y=l[0]>>>1^-(1&l[0]),v=l[1]>>>1^-(1&l[1]);l[0]=bs(Math.round(y*u),f,g),l[1]=bs(Math.round(v*u),f,g);const w=l.length/16;let S=2;if(w>=4)for(;S<w-4;S+=4){const P=l[S],M=l[S+1],C=(P>>>1^-(1&P))+y,z=(M>>>1^-(1&M))+v;l[S]=bs(Math.round(C*u),f,g),l[S+1]=bs(Math.round(z*u),f,g);const F=l[S+2],Z=l[S+3];y=(F>>>1^-(1&F))+C,v=(Z>>>1^-(1&Z))+z,l[S+2]=bs(Math.round(y*u),f,g),l[S+3]=bs(Math.round(v*u),f,g)}for(;S!=l.length;S+=2)y+=l[S]>>>1^-(1&l[S]),v+=l[S+1]>>>1^-(1&l[S+1]),l[S]=bs(Math.round(y*u),f,g),l[S+1]=bs(Math.round(v*u),f,g)}(t,a.scale,a.min,a.max),t):(hp(t),t);case te.NONE:return s&&function(l){for(let u=0;u<l.length;u++){const f=l[u];l[u]=f>>>1^-(1&f)}}(t),t;default:throw new Error(`The specified Logical level technique is not supported: ${i.logicalLevelTechnique1}`)}}static decodeLongBuffer(t,i,s){switch(i.logicalLevelTechnique1){case te.DELTA:return i.logicalLevelTechnique2===te.RLE?function(a,l,u){const f=new BigInt64Array(u);let g=0,y=0n;for(let v=0;v<l;v++){const w=Number(a[v]),S=yo(a[v+l]);for(let P=0;P<w;P++)y+=S,f[g++]=y}return f}(t,i.runs,i.numRleValues):(function(a){a[0]=a[0]>>1n^-(1n&a[0]);const l=a.length/4*4;let u=1;if(l>=4)for(;u<l-4;u+=4){const f=a[u],g=a[u+1],y=a[u+2],v=a[u+3];a[u]=(f>>1n^-(1n&f))+a[u-1],a[u+1]=(g>>1n^-(1n&g))+a[u],a[u+2]=(y>>1n^-(1n&y))+a[u+1],a[u+3]=(v>>1n^-(1n&v))+a[u+2]}for(;u!=a.length;++u)a[u]=(a[u]>>1n^-(1n&a[u]))+a[u-1]}(t),t);case te.RLE:return function(a,l,u){return u?function(f,g,y){const v=new BigInt64Array(y);let w=0;for(let S=0;S<g;S++){const P=Number(f[S]);let M=f[S+g];M=M>>1n^-(1n&M),v.fill(M,w,w+P),w+=P}return v}(a,l.runs,l.numRleValues):cp(a,l.runs,l.numRleValues)}(t,i,s);case te.NONE:return s&&function(a){for(let l=0;l<a.length;l++){const u=a[l];a[l]=u>>1n^-(1n&u)}}(t),t;default:throw new Error(`The specified Logical level technique is not supported: ${i.logicalLevelTechnique1}`)}}static decodeFloat64Buffer(t,i,s){switch(i.logicalLevelTechnique1){case te.DELTA:return i.logicalLevelTechnique2===te.RLE&&(t=up(t,i.runs,i.numRleValues)),function(a){a[0]=a[0]%2==1?(a[0]+1)/-2:a[0]/2;const l=a.length/4*4;let u=1;if(l>=4)for(;u<l-4;u+=4){const f=a[u],g=a[u+1],y=a[u+2],v=a[u+3];a[u]=(f%2==1?(f+1)/-2:f/2)+a[u-1],a[u+1]=(g%2==1?(g+1)/-2:g/2)+a[u],a[u+2]=(y%2==1?(y+1)/-2:y/2)+a[u+1],a[u+3]=(v%2==1?(v+1)/-2:v/2)+a[u+2]}for(;u!=a.length;++u)a[u]=(a[u]%2==1?(a[u]+1)/-2:a[u]/2)+a[u-1]}(t),t;case te.RLE:return function(a,l,u){return u?function(f,g,y){const v=new Float64Array(y);let w=0;for(let S=0;S<g;S++){const P=f[S];let M=f[S+g];M=M%2==1?(M+1)/-2:M/2,v.fill(M,w,w+P),w+=P}return v}(a,l.runs,l.numRleValues):up(a,l.runs,l.numRleValues)}(t,i,s);case te.NONE:return s&&function(a){for(let l=0;l<a.length;l++){const u=a[l];a[l]=u%2==1?(u+1)/-2:u/2}}(t),t;default:throw new Error(`The specified Logical level technique is not supported: ${i.logicalLevelTechnique1}`)}}static decodeLengthToOffsetBuffer(t,i){if(i.logicalLevelTechnique1===te.DELTA&&i.logicalLevelTechnique2===te.NONE)return function(s){const a=new Int32Array(s.length+1);a[0]=0,a[1]=pa(s[0]);let l=a[1],u=2;for(;u!=a.length;++u){const f=s[u-1];l+=f>>>1^-(1&f),a[u]=a[u-1]+l}return a}(t);if(i.logicalLevelTechnique1===te.RLE&&i.logicalLevelTechnique2===te.NONE)return function(s,a,l){const u=new Int32Array(l+1);u[0]=0;let f=1,g=u[0];for(let y=0;y<a;y++){const v=s[y],w=s[y+a];for(let S=f;S<f+v;S++)u[S]=w+g,g=u[S];f+=v}return u}(t,i.runs,i.numRleValues);if(i.logicalLevelTechnique1===te.NONE&&i.logicalLevelTechnique2===te.NONE){(function(a){let l=0;for(let u=0;u<a.length;u++)a[u]+=l,l=a[u]})(t);const s=new Int32Array(i.numValues+1);return s[0]=0,s.set(t,1),s}if(i.logicalLevelTechnique1===te.DELTA&&i.logicalLevelTechnique2===te.RLE){const s=function(a,l,u){const f=new Int32Array(u+1);f[0]=0;let g=1,y=f[0];for(let v=0;v<l;v++){const w=a[v];let S=a[v+l];S=S>>>1^-(1&S);for(let P=g;P<g+w;P++)f[P]=S+y,y=f[P];g+=w}return f}(t,i.runs,i.numRleValues);return Eh(s),s}throw new Error("Only delta encoding is supported for transforming length to offset streams yet.")}static decodeNullableIntStream(t,i,s,a,l){const u=s.physicalLevelTechnique===Vn.FAST_PFOR?op():ei(t,i,s.numValues);return this.decodeNullableIntBuffer(u,s,a,l)}static decodeNullableLongStream(t,i,s,a,l){const u=hu(t,i,s.numValues);return this.decodeNullableLongBuffer(u,s,a,l)}static decodeNullableIntBuffer(t,i,s,a){switch(i.logicalLevelTechnique1){case te.DELTA:return i.logicalLevelTechnique2===te.RLE&&(t=lp(t,i.runs,i.numRleValues)),function(l,u){const f=new Int32Array(l.size());let g=0;l.get(0)?(f[0]=l.get(0)?u[0]>>>1^-(1&u[0]):0,g=1):f[0]=0;let y=1;for(;y!=f.length;++y)f[y]=l.get(y)?f[y-1]+(u[g]>>>1^-(1&u[g++])):f[y-1];return f}(a,t);case te.RLE:return function(l,u,f,g){const y=u;return f?function(v,w,S){const P=new Int32Array(v.size());let M=0;for(let C=0;C<S;C++){const z=w[C];let F=w[C+S];F=F>>>1^-(1&F);for(let Z=M;Z<M+z;Z++)v.get(Z)?P[Z]=F:(P[Z]=0,M++);M+=z}return P}(g,l,y.runs):function(v,w,S){const P=new Int32Array(v.size());let M=0;for(let C=0;C<S;C++){const z=w[C],F=w[C+S];for(let Z=M;Z<M+z;Z++)v.get(Z)?P[Z]=F:(P[Z]=0,M++);M+=z}return P}(g,l,y.runs)}(t,i,s,a);case te.MORTON:return Eh(t),t;case te.COMPONENTWISE_DELTA:return hp(t),t;case te.NONE:return t=s?function(l,u){const f=new Int32Array(l.size());let g=0,y=0;for(;y!=f.length;++y)if(l.get(y)){const v=u[g++];f[y]=v>>>1^-(1&v)}else f[y]=0;return f}(a,t):function(l,u){const f=new Int32Array(l.size());let g=0,y=0;for(;y!=f.length;++y)f[y]=l.get(y)?u[g++]:0;return f}(a,t),t;default:throw new Error("The specified Logical level technique is not supported")}}static decodeNullableLongBuffer(t,i,s,a){switch(i.logicalLevelTechnique1){case te.DELTA:return i.logicalLevelTechnique2===te.RLE&&(t=cp(t,i.runs,i.numRleValues)),function(l,u){const f=new BigInt64Array(l.size());let g=0;l.get(0)?(f[0]=l.get(0)?u[0]>>1n^-(1n&u[0]):0n,g=1):f[0]=0n;let y=1;for(;y!=f.length;++y)f[y]=l.get(y)?f[y-1]+(u[g]>>1n^-(1n&u[g++])):f[y-1];return f}(a,t);case te.RLE:return function(l,u,f,g){const y=u;return f?function(v,w,S){const P=new BigInt64Array(v.size());let M=0;for(let C=0;C<S;C++){const z=Number(w[C]);let F=w[C+S];F=F>>1n^-(1n&F);for(let Z=M;Z<M+z;Z++)v.get(Z)?P[Z]=F:(P[Z]=0n,M++);M+=z}return P}(g,l,y.runs):function(v,w,S){const P=new BigInt64Array(v.size());let M=0;for(let C=0;C<S;C++){const z=Number(w[C]),F=w[C+S];for(let Z=M;Z<M+z;Z++)v.get(Z)?P[Z]=F:(P[Z]=0n,M++);M+=z}return P}(g,l,y.runs)}(t,i,s,a);case te.NONE:return t=s?function(l,u){const f=new BigInt64Array(l.size());let g=0,y=0;for(;y!=f.length;++y)if(l.get(y)){const v=u[g++];f[y]=v>>1n^-(1n&v)}else f[y]=0n;return f}(a,t):function(l,u){const f=new BigInt64Array(l.size());let g=0,y=0;for(;y!=f.length;++y)f[y]=l.get(y)?u[g++]:0n;return f}(a,t),t;default:throw new Error("The specified Logical level technique is not supported")}}static getVectorType(t,i,s,a){const l=t.logicalLevelTechnique1;if(l===te.RLE)return t.runs===1?ni.CONST:ni.FLAT;const u=i instanceof Fr?i.size():i;if(l===te.DELTA&&t.logicalLevelTechnique2===te.RLE){const f=t.runs,g=2;if(t.numRleValues!==u)return ni.FLAT;if(f===1)return ni.SEQUENCE;if(f===2){const y=a.get();let v;if(t.physicalLevelTechnique===Vn.VARINT)v=ei(s,a,4);else{const w=a.get();v=new Int32Array(s.buffer,s.byteOffset+w,4)}if(a.set(y),v[2]===g&&v[3]===g)return ni.SEQUENCE}}return t.numValues===1?ni.CONST:ni.FLAT}}class dp extends uu{getValueFromBuffer(t){return this.dataBuffer[t]}}class pp extends sp{constructor(t,i,s,a){super(t,BigInt64Array.of(i),s,a)}getValueFromBuffer(t){return this.dataBuffer[0]+BigInt(t)*this.delta}}class xo{_geometryOffsets;_partOffsets;_ringOffsets;constructor(t,i,s){this._geometryOffsets=t,this._partOffsets=i,this._ringOffsets=s}get geometryOffsets(){return this._geometryOffsets}get partOffsets(){return this._partOffsets}get ringOffsets(){return this._ringOffsets}}class Nm{tileExtent;_numBits;_coordinateShift;minBound;maxBound;constructor(t,i){this._coordinateShift=t<0?Math.abs(t):0,this.tileExtent=i+this._coordinateShift,this._numBits=Math.ceil(Math.log2(this.tileExtent)),this.minBound=t,this.maxBound=i}validateCoordinates(t){if(t.x<this.minBound||t.y<this.minBound||t.x>this.maxBound||t.y>this.maxBound)throw new Error("The specified tile buffer size is currently not supported.")}numBits(){return this._numBits}coordinateShift(){return this._coordinateShift}}class vo extends Nm{encode(t){this.validateCoordinates(t);const i=t.x+this._coordinateShift,s=t.y+this._coordinateShift;let a=0;for(let l=0;l<this._numBits;l++)a|=(i&1<<l)<<l|(s&1<<l)<<l+1;return a}decode(t){return{x:this.decodeMorton(t)-this._coordinateShift,y:this.decodeMorton(t>>1)-this._coordinateShift}}decodeMorton(t){let i=0;for(let s=0;s<this._numBits;s++)i|=(t&1<<2*s)>>s;return i}static decode(t,i,s){return{x:vo.decodeMorton(t,i)-s,y:vo.decodeMorton(t>>1,i)-s}}static decodeMorton(t,i){let s=0;for(let a=0;a<i;a++)s|=(t&1<<2*a)>>a;return s}}(function(r){r[r.POINT=0]="POINT",r[r.LINESTRING=1]="LINESTRING",r[r.POLYGON=2]="POLYGON",r[r.MULTIPOINT=3]="MULTIPOINT",r[r.MULTILINESTRING=4]="MULTILINESTRING",r[r.MULTIPOLYGON=5]="MULTIPOLYGON"})(si||(si={})),function(r){r[r.POINT=0]="POINT",r[r.LINESTRING=1]="LINESTRING",r[r.POLYGON=2]="POLYGON"}(ap||(ap={})),function(r){r[r.MORTON=0]="MORTON",r[r.VEC_2=1]="VEC_2",r[r.VEC_3=2]="VEC_3"}(cr||(cr={}));class jm{createPoint(t){return[[t]]}createMultiPoint(t){return t.map(i=>[i])}createLineString(t){return[t]}createMultiLineString(t){return t}createPolygon(t,i){return[t,...i]}createMultiPolygon(t){return t.flat()}}function fp(r){const t=new Array(r.numGeometries);let i=1,s=1,a=1,l=0;const u=new jm;let f=0,g=0;const y=r.mortonSettings,v=r.topologyVector,w=v.geometryOffsets,S=v.partOffsets,P=v.ringOffsets,M=r.vertexOffsets,C=r.containsPolygonGeometry(),z=r.vertexBuffer;for(let F=0;F<r.numGeometries;F++){const Z=r.geometryType(F);if(Z===si.POINT){if(M&&M.length!==0)if(r.vertexBufferType===cr.VEC_2){const O=2*M[g++],j=new Pt(z[O],z[O+1]);t[l++]=u.createPoint(j)}else{const O=M[g++],j=vo.decode(z[O],y.numBits,y.coordinateShift),Q=new Pt(j.x,j.y);t[l++]=u.createPoint(Q)}else{const O=new Pt(z[f++],z[f++]);t[l++]=u.createPoint(O)}w&&a++,S&&i++,P&&s++}else if(Z===si.MULTIPOINT){const O=w[a]-w[a-1];a++;const j=new Array(O);if(M&&M.length!==0){for(let Q=0;Q<O;Q++){const et=2*M[g++];j[Q]=new Pt(z[et],z[et+1])}t[l++]=u.createMultiPoint(j)}else{for(let Q=0;Q<O;Q++){const et=z[f++],ot=z[f++];j[Q]=new Pt(et,ot)}t[l++]=u.createMultiPoint(j)}}else if(Z===si.LINESTRING){let O,j=0;C?(j=P[s]-P[s-1],s++):j=S[i]-S[i-1],i++,M&&M.length!==0?(O=r.vertexBufferType===cr.VEC_2?Ah(z,M,g,j,!1):Dh(z,M,g,j,!1,y),g+=j):(O=Ch(z,f,j,!1),f+=2*j),t[l++]=u.createLineString(O),w&&a++}else if(Z===si.POLYGON){const O=S[i]-S[i-1];i++;const j=new Array(O-1);let Q=P[s]-P[s-1];if(s++,M&&M.length!==0){const et=r.vertexBufferType===cr.VEC_2?fu(z,M,g,Q):mu(z,M,g,Q,0,y);g+=Q;for(let ot=0;ot<j.length;ot++)Q=P[s]-P[s-1],s++,j[ot]=r.vertexBufferType===cr.VEC_2?fu(z,M,g,Q):mu(z,M,g,Q,0,y),g+=Q;t[l++]=u.createPolygon(et,j)}else{const et=pu(z,f,Q);f+=2*Q;for(let ot=0;ot<j.length;ot++)Q=P[s]-P[s-1],s++,j[ot]=pu(z,f,Q),f+=2*Q;t[l++]=u.createPolygon(et,j)}w&&a++}else if(Z===si.MULTILINESTRING){const O=w[a]-w[a-1];a++;const j=new Array(O);if(M&&M.length!==0){for(let Q=0;Q<O;Q++){let et=0;C?(et=P[s]-P[s-1],s++):et=S[i]-S[i-1],i++;const ot=r.vertexBufferType===cr.VEC_2?Ah(z,M,g,et,!1):Dh(z,M,g,et,!1,y);j[Q]=ot,g+=et}t[l++]=u.createMultiLineString(j)}else{for(let Q=0;Q<O;Q++){let et=0;C?(et=P[s]-P[s-1],s++):et=S[i]-S[i-1],i++,j[Q]=Ch(z,f,et,!1),f+=2*et}t[l++]=u.createMultiLineString(j)}}else{if(Z!==si.MULTIPOLYGON)throw new Error("The specified geometry type is currently not supported.");{const O=w[a]-w[a-1];a++;const j=new Array(O);let Q=0;if(M&&M.length!==0){for(let et=0;et<O;et++){const ot=S[i]-S[i-1];i++;const _t=new Array(ot-1);Q=P[s]-P[s-1],s++;const ft=r.vertexBufferType===cr.VEC_2?fu(z,M,g,Q):mu(z,M,g,Q,0,y);g+=Q;for(let yt=0;yt<_t.length;yt++)Q=P[s]-P[s-1],s++,_t[yt]=r.vertexBufferType===cr.VEC_2?fu(z,M,g,Q):mu(z,M,g,Q,0,y),g+=Q;j[et]=u.createPolygon(ft,_t)}t[l++]=u.createMultiPolygon(j)}else{for(let et=0;et<O;et++){const ot=S[i]-S[i-1];i++;const _t=new Array(ot-1);Q=P[s]-P[s-1],s++;const ft=pu(z,f,Q);f+=2*Q;for(let yt=0;yt<_t.length;yt++){const Mt=P[s]-P[s-1];s++,_t[yt]=pu(z,f,Mt),f+=2*Mt}j[et]=u.createPolygon(ft,_t)}t[l++]=u.createMultiPolygon(j)}}}}return t}function pu(r,t,i){return Ch(r,t,i,!0)}function fu(r,t,i,s){return Ah(r,t,i,s,!0)}function mu(r,t,i,s,a,l){return Dh(r,t,i,s,!0,l)}function Ch(r,t,i,s){const a=new Array(s?i+1:i);for(let l=0;l<2*i;l+=2)a[l/2]=new Pt(r[t+l],r[t+l+1]);return s&&(a[a.length-1]=a[0]),a}function Ah(r,t,i,s,a){const l=new Array(a?s+1:s);for(let u=0;u<2*s;u+=2){const f=2*t[i+u/2];l[u/2]=new Pt(r[f],r[f+1])}return a&&(l[l.length-1]=l[0]),l}function Dh(r,t,i,s,a,l){const u=new Array(a?s+1:s);for(let f=0;f<s;f++){const g=vo.decode(r[t[i+f]],l.numBits,l.coordinateShift);u[f]=new Pt(g.x,g.y)}return a&&(u[u.length-1]=u[0]),u}class mp{_vertexBufferType;_topologyVector;_vertexOffsets;_vertexBuffer;_mortonSettings;constructor(t,i,s,a,l){this._vertexBufferType=t,this._topologyVector=i,this._vertexOffsets=s,this._vertexBuffer=a,this._mortonSettings=l}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}*[Symbol.iterator](){const t=fp(this);let i=0;for(;i<this.numGeometries;)yield{coordinates:t[i],type:this.geometryType(i)},i++}getSimpleEncodedVertex(t){const i=this.vertexOffsets?2*this.vertexOffsets[t]:2*t;return[this.vertexBuffer[i],this.vertexBuffer[i+1]]}getVertex(t){if(this.vertexOffsets&&this.mortonSettings){const s=vo.decode(this.vertexBuffer[this.vertexOffsets[t]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[s.x,s.y]}const i=this.vertexOffsets?2*this.vertexOffsets[t]:2*t;return[this.vertexBuffer[i],this.vertexBuffer[i+1]]}getGeometries(){return fp(this)}get mortonSettings(){return this._mortonSettings}}class Nl extends mp{_numGeometries;_geometryType;constructor(t,i,s,a,l,u,f){super(s,a,l,u,f),this._numGeometries=t,this._geometryType=i}static createMortonEncoded(t,i,s,a,l,u){return new Nl(t,i,cr.MORTON,s,a,l,u)}static create(t,i,s,a,l){return new Nl(t,i,cr.VEC_2,s,a,l)}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===si.POLYGON||this._geometryType===si.MULTIPOLYGON}containsSingleGeometryType(){return!0}}class jl extends mp{_geometryTypes;constructor(t,i,s,a,l,u){super(t,s,a,l,u),this._geometryTypes=i}static createMortonEncoded(t,i,s,a,l){return new jl(cr.MORTON,t,i,s,a,l)}static create(t,i,s,a){return new jl(cr.VEC_2,t,i,s,a)}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let t=0;t<this.numGeometries;t++)if(this.geometryType(t)===si.POLYGON||this.geometryType(t)===si.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class gp{_triangleOffsets;_indexBuffer;_vertexBuffer;_topologyVector;constructor(t,i,s,a){this._triangleOffsets=t,this._indexBuffer=i,this._vertexBuffer=s,this._topologyVector=a}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw new Error("Cannot convert GpuVector to coordinates without topology information");const t=new Array(this.numGeometries),i=this._topologyVector,s=i.partOffsets,a=i.ringOffsets,l=i.geometryOffsets;let u=0,f=1,g=1,y=1;for(let v=0;v<this.numGeometries;v++)switch(this.geometryType(v)){case si.POLYGON:{const w=s[f]-s[f-1];f++;const S=[];for(let P=0;P<w;P++){const M=a[g]-a[g-1];g++;const C=[];for(let z=0;z<M;z++){const F=this._vertexBuffer[u++],Z=this._vertexBuffer[u++];C.push(new Pt(F,Z))}C.length>0&&C.push(C[0]),S.push(C)}t[v]=S,l&&y++}break;case si.MULTIPOLYGON:{const w=l[y]-l[y-1];y++;const S=[];for(let P=0;P<w;P++){const M=s[f]-s[f-1];f++;for(let C=0;C<M;C++){const z=a[g]-a[g-1];g++;const F=[];for(let Z=0;Z<z;Z++){const O=this._vertexBuffer[u++],j=this._vertexBuffer[u++];F.push(new Pt(O,j))}F.length>0&&F.push(F[0]),S.push(F)}}t[v]=S}}return t}[Symbol.iterator](){return null}}class gu extends gp{_numGeometries;_geometryType;constructor(t,i,s,a,l,u){super(s,a,l,u),this._numGeometries=t,this._geometryType=i}static create(t,i,s,a,l,u){return new gu(t,i,s,a,l,u)}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}class _u extends gp{_geometryTypes;constructor(t,i,s,a,l){super(i,s,a,l),this._geometryTypes=t}static create(t,i,s,a,l){return new _u(t,i,s,a,l)}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function Um(r,t,i,s,a){const l=Pi.decode(r,i);let u=null,f=null,g=null,y=null,v=null,w=null,S=null,P=null;if(Ht.getVectorType(l,s,r,i)===ni.CONST){const C=Ht.decodeConstIntStream(r,i,l,!1);for(let z=0;z<t-1;z++){const F=Pi.decode(r,i);switch(F.physicalStreamType){case _i.LENGTH:switch(F.logicalStreamType.lengthType){case Yi.GEOMETRIES:u=Ht.decodeLengthStreamToOffsetBuffer(r,i,F);break;case Yi.PARTS:f=Ht.decodeLengthStreamToOffsetBuffer(r,i,F);break;case Yi.RINGS:g=Ht.decodeLengthStreamToOffsetBuffer(r,i,F);break;case Yi.TRIANGLES:S=Ht.decodeLengthStreamToOffsetBuffer(r,i,F)}break;case _i.OFFSET:switch(F.logicalStreamType.offsetType){case da.VERTEX:y=Ht.decodeIntStream(r,i,F,!1);break;case da.INDEX:P=Ht.decodeIntStream(r,i,F,!1)}break;case _i.DATA:if(Lr.VERTEX===F.logicalStreamType.dictionaryType)v=Ht.decodeIntStream(r,i,F,!0,a);else{const Z=F;w={numBits:Z.numBits(),coordinateShift:Z.coordinateShift()},v=Ht.decodeIntStream(r,i,F,!1,a)}}}if(P!==null){if(u!=null||f!=null){const z=new xo(u,f,g);return gu.create(s,C,S,P,v,z)}return gu.create(s,C,S,P,v)}return w===null?Nl.create(s,C,new xo(u,f,g),y,v):Nl.createMortonEncoded(s,C,new xo(u,f,g),y,v,w)}const M=Ht.decodeIntStream(r,i,l,!1);for(let C=0;C<t-1;C++){const z=Pi.decode(r,i);switch(z.physicalStreamType){case _i.LENGTH:switch(z.logicalStreamType.lengthType){case Yi.GEOMETRIES:u=Ht.decodeIntStream(r,i,z,!1);break;case Yi.PARTS:f=Ht.decodeIntStream(r,i,z,!1);break;case Yi.RINGS:g=Ht.decodeIntStream(r,i,z,!1);break;case Yi.TRIANGLES:S=Ht.decodeLengthStreamToOffsetBuffer(r,i,z)}break;case _i.OFFSET:switch(z.logicalStreamType.offsetType){case da.VERTEX:y=Ht.decodeIntStream(r,i,z,!1);break;case da.INDEX:P=Ht.decodeIntStream(r,i,z,!1)}break;case _i.DATA:if(Lr.VERTEX===z.logicalStreamType.dictionaryType)v=Ht.decodeIntStream(r,i,z,!0,a);else{const F=z;w={numBits:F.numBits(),coordinateShift:F.coordinateShift()},v=Ht.decodeIntStream(r,i,z,!1,a)}}}return P!==null&&f===null?_u.create(M,S,P,v):(u!==null?(u=zh(M,u,2),f!==null&&g!==null?(f=_p(M,u,f,!1),g=function(C,z,F,Z){const O=new Int32Array(F[F.length-1]+1);let j=0;O[0]=j;let Q=1,et=1,ot=0;for(let _t=0;_t<C.length;_t++){const ft=C[_t],yt=z[_t+1]-z[_t];if(ft!==0&&ft!==3)for(let Mt=0;Mt<yt;Mt++){const wt=F[Q]-F[Q-1];Q++;for(let Tt=0;Tt<wt;Tt++)j=O[et++]=j+Z[ot++]}else for(let Mt=0;Mt<yt;Mt++)O[et++]=++j,Q++}return O}(M,u,f,g)):f!==null&&(f=function(C,z,F){const Z=new Int32Array(z[z.length-1]+1);let O=0;Z[0]=O;let j=1,Q=0;for(let et=0;et<C.length;et++){const ot=C[et],_t=z[et+1]-z[et];if(ot===4||ot===1)for(let ft=0;ft<_t;ft++)O=Z[j++]=O+F[Q++];else for(let ft=0;ft<_t;ft++)Z[j++]=++O}return Z}(M,u,f))):f!==null&&g!==null?(f=zh(M,f,1),g=_p(M,f,g,!0)):f!==null&&(f=zh(M,f,0)),P!==null?_u.create(M,S,P,v,new xo(u,f,g)):w===null?jl.create(M,new xo(u,f,g),y,v):jl.createMortonEncoded(M,new xo(u,f,g),y,v,w))}function zh(r,t,i){const s=new Int32Array(r.length+1);let a=0;s[0]=a;let l=0;for(let u=0;u<r.length;u++)a=s[u+1]=a+(r[u]>i?t[l++]:1);return s}function _p(r,t,i,s){const a=new Int32Array(t[t.length-1]+1);let l=0;a[0]=l;let u=1,f=0;for(let g=0;g<r.length;g++){const y=r[g],v=t[g+1]-t[g];if(y===5||y===2||s&&(y===4||y===1))for(let w=0;w<v;w++)l=a[u++]=l+i[f++];else for(let w=0;w<v;w++)a[u++]=++l}return a}class Gm extends _o{dataVector;constructor(t,i,s){super(t,i.getBuffer(),s),this.dataVector=i}getValueFromBuffer(t){return this.dataVector.get(t)}}class Zm extends uu{getValueFromBuffer(t){return this.dataBuffer[t]}}class yp extends _o{constructor(t,i,s){super(t,BigInt64Array.of(i),s)}getValueFromBuffer(t){return this.dataBuffer[0]}}function $m(r,t,i){for(let s=0;s<r;s++){const a=Pi.decode(t,i);i.add(a.byteLength)}}function Ul(r,t,i){return xp(r,Math.ceil(t/8),i)}function xp(r,t,i){const s=new Uint8Array(t);let a=0;for(;a<t;){const l=r[i.increment()];if(l<=127){const u=l+3,f=r[i.increment()],g=a+u;s.fill(f,a,g),a=g}else{const u=256-l;for(let f=0;f<u;f++)s[a++]=r[i.increment()]}}return s}const qm=new TextDecoder;function kh(r,t,i){return i-t>=12?qm.decode(r.subarray(t,i)):function(s,a,l){let u="",f=a;for(;f<l;){const g=s[f];let y,v,w,S=null,P=g>239?4:g>223?3:g>191?2:1;if(f+P>l)break;P===1?g<128&&(S=g):P===2?(y=s[f+1],(192&y)==128&&(S=(31&g)<<6|63&y,S<=127&&(S=null))):P===3?(y=s[f+1],v=s[f+2],(192&y)==128&&(192&v)==128&&(S=(15&g)<<12|(63&y)<<6|63&v,(S<=2047||S>=55296&&S<=57343)&&(S=null))):P===4&&(y=s[f+1],v=s[f+2],w=s[f+3],(192&y)==128&&(192&v)==128&&(192&w)==128&&(S=(15&g)<<18|(63&y)<<12|(63&v)<<6|63&w,(S<=65535||S>=1114112)&&(S=null))),S===null?(S=65533,P=1):S>65535&&(S-=65536,u+=String.fromCharCode(S>>>10&1023|55296),S=56320|1023&S),u+=String.fromCharCode(S),f+=P}return u}(r,t,i)}class Rh extends _o{offsetBuffer;constructor(t,i,s,a){super(t,s,a),this.offsetBuffer=i}}class vp extends Rh{textEncoder;constructor(t,i,s,a){super(t,i,s,a??i.length-1),this.textEncoder=new TextEncoder}getValueFromBuffer(t){return kh(this.dataBuffer,this.offsetBuffer[t],this.offsetBuffer[t+1])}}class bo extends Rh{indexBuffer;textEncoder;constructor(t,i,s,a,l){super(t,s,a,l??i.length),this.indexBuffer=i,this.indexBuffer=i,this.textEncoder=new TextEncoder}getValueFromBuffer(t){const i=this.indexBuffer[t];return kh(this.dataBuffer,this.offsetBuffer[i],this.offsetBuffer[i+1])}}class bp extends Rh{indexBuffer;symbolOffsetBuffer;symbolTableBuffer;textEncoder;symbolLengthBuffer;lengthBuffer;decodedDictionary;constructor(t,i,s,a,l,u,f){super(t,s,a,f),this.indexBuffer=i,this.symbolOffsetBuffer=l,this.symbolTableBuffer=u,this.textEncoder=new TextEncoder}getValueFromBuffer(t){this.decodedDictionary==null&&(this.symbolLengthBuffer==null&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer),this.lengthBuffer=this.offsetToLengthBuffer(this.offsetBuffer)),this.decodedDictionary=function(s,a,l){const u=[],f=new Array(a.length).fill(0);for(let g=1;g<a.length;g++)f[g]=f[g-1]+a[g-1];for(let g=0;g<l.length;g++)if(l[g]===255)u.push(l[++g]);else{const y=a[l[g]],v=f[l[g]];for(let w=0;w<y;w++)u.push(s[v+w])}return new Uint8Array(u)}(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));const i=this.indexBuffer[t];return kh(this.decodedDictionary,this.offsetBuffer[i],this.offsetBuffer[i+1])}offsetToLengthBuffer(t){const i=new Uint32Array(t.length-1);let s=t[0];for(let a=1;a<t.length;a++){const l=t[a];i[a-1]=l-s,s=l}return i}}class Gl{static ROOT_COLUMN_NAME="default";static NESTED_COLUMN_SEPARATOR=":";constructor(){}static decode(t,i,s,a,l){let u=null,f=null,g=null,y=null,v=null,w=null,S=null,P=null;for(let M=0;M<a;M++){const C=Pi.decode(i,s);if(C.byteLength!==0)switch(C.physicalStreamType){case _i.PRESENT:{const z=Ul(i,C.numValues,s);w=new Fr(z,C.numValues);break}case _i.OFFSET:f=l!=null||w!=null?Ht.decodeNullableIntStream(i,s,C,!1,l??w):Ht.decodeIntStream(i,s,C,!1);break;case _i.LENGTH:{const z=Ht.decodeLengthStreamToOffsetBuffer(i,s,C);Yi.DICTIONARY===C.logicalStreamType.lengthType?u=z:Yi.SYMBOL===C.logicalStreamType.lengthType?y=z:S=z;break}case _i.DATA:{const z=i.subarray(s.get(),s.get()+C.byteLength);s.add(C.byteLength);const F=C.logicalStreamType.dictionaryType;Lr.FSST===F?v=z:Lr.SINGLE===F||Lr.SHARED===F?g=z:Lr.NONE===F&&(P=z);break}}}return this.decodeFsstDictionaryVector(t,v,f,u,g,y,l??w)??this.decodeDictionaryVector(t,g,f,u,l??w)??this.decodePlainStringVector(t,S,P,f,l??w)}static decodeFsstDictionaryVector(t,i,s,a,l,u,f){return i?new bp(t,s,a,l,u,i,f):null}static decodeDictionaryVector(t,i,s,a,l){return i?l?new bo(t,s,a,i,l):new bo(t,s,a,i):null}static decodePlainStringVector(t,i,s,a,l){if(!i||!s)return null;if(a)return l?new bo(t,a,i,s,l):new bo(t,a,i,s);if(l&&l.size()!==i.length-1){const u=new Int32Array(l.size());let f=0;for(let g=0;g<l.size();g++)u[g]=l.get(g)?f++:0;return new bo(t,u,i,s,l)}return l?new vp(t,i,s,l):new vp(t,i,s)}static decodeSharedDictionary(t,i,s,a,l){let u=null,f=null,g=null,y=null,v=!1;for(;!v;){const M=Pi.decode(t,i);switch(M.physicalStreamType){case _i.LENGTH:Yi.DICTIONARY===M.logicalStreamType.lengthType?u=Ht.decodeLengthStreamToOffsetBuffer(t,i,M):g=Ht.decodeLengthStreamToOffsetBuffer(t,i,M);break;case _i.DATA:Lr.SINGLE===M.logicalStreamType.dictionaryType||Lr.SHARED===M.logicalStreamType.dictionaryType?(f=t.subarray(i.get(),i.get()+M.byteLength),v=!0):y=t.subarray(i.get(),i.get()+M.byteLength),i.add(M.byteLength)}}const w=s.complexType.children,S=[];let P=0;for(const M of w){const C=ei(t,i,1)[0];if(C==0)continue;const z=`${s.name}${M.name===Gl.ROOT_COLUMN_NAME?"":Gl.NESTED_COLUMN_SEPARATOR+M.name}`;if(l&&!l.has(z)){$m(C,t,i);continue}if(C!==2||M.type!=="scalarField"||M.scalarField.physicalType!==9)throw new Error("Currently only optional string fields are implemented for a struct.");const F=Pi.decode(t,i),Z=Ul(t,F.numValues,i),O=Pi.decode(t,i),j=(O instanceof Vl?O.numRleValues:O.numValues)!==a?Ht.decodeNullableIntStream(t,i,O,!1,new Fr(Z,F.numValues)):Ht.decodeIntStream(t,i,O,!1);S[P++]=y?new bp(z,j,u,f,g,y,new Fr(Z,F.numValues)):new bo(z,j,u,f,new Fr(Z,F.numValues))}return S}}function Wm(r,t,i,s,a,l){return i.type==="scalarType"?function(u,f,g,y,v,w){let S=null,P=0;if(u===0)return null;if(w.nullable){const C=Pi.decode(f,g);P=C.numValues;const z=g.get(),F=Ul(f,P,g);g.set(z+C.byteLength),S=new Fr(F,C.numValues)}const M=S??y;switch(v.physicalType){case 4:case 3:return function(C,z,F,Z,O){const j=Pi.decode(C,z),Q=Ht.getVectorType(j,O,C,z),et=Z.physicalType===3;if(Q===ni.FLAT){const ot=Zl(O)?Ht.decodeNullableIntStream(C,z,j,et,O):Ht.decodeIntStream(C,z,j,et);return new Th(F.name,ot,O)}if(Q===ni.SEQUENCE){const ot=Ht.decodeSequenceIntStream(C,z,j);return new Ph(F.name,ot[0],ot[1],j.numRleValues)}{const ot=Ht.decodeConstIntStream(C,z,j,et);return new Mh(F.name,ot,O)}}(f,g,w,v,M);case 9:return Gl.decode(w.name,f,g,w.nullable?u-1:u,S);case 0:return function(C,z,F,Z,O){const j=Pi.decode(C,z),Q=j.numValues,et=z.get(),ot=Zl(O)?function(ft,yt,Mt,wt){const Tt=xp(ft,Math.ceil(yt/8),Mt),mt=new Fr(Tt,yt),Rt=wt.size(),Lt=new Fr(new Uint8Array(Rt),Rt);let Nt=0;for(let Ct=0;Ct<wt.size();Ct++){const Yt=!!wt.get(Ct)&&mt.get(Nt++);Lt.set(Ct,Yt)}return Lt.getBuffer()}(C,Q,z,O):Ul(C,Q,z);z.set(et+j.byteLength);const _t=new Fr(ot,Q);return new Gm(F.name,_t,O)}(f,g,w,0,M);case 6:case 5:return function(C,z,F,Z,O){const j=Pi.decode(C,z),Q=Ht.getVectorType(j,Z,C,z),et=O.physicalType===5;if(Q===ni.FLAT){const ot=Zl(Z)?Ht.decodeNullableLongStream(C,z,j,et,Z):Ht.decodeLongStream(C,z,j,et);return new dp(F.name,ot,Z)}if(Q===ni.SEQUENCE){const ot=Ht.decodeSequenceLongStream(C,z,j);return new pp(F.name,ot[0],ot[1],j.numRleValues)}{const ot=Ht.decodeConstLongStream(C,z,j,et);return new yp(F.name,ot,Z)}}(f,g,w,M,v);case 7:return function(C,z,F,Z){const O=Pi.decode(C,z),j=Zl(Z)?function(Q,et,ot,_t){const ft=et.get(),yt=ft+_t*Float32Array.BYTES_PER_ELEMENT,Mt=new Uint8Array(Q.subarray(ft,yt)).buffer,wt=new Float32Array(Mt);et.set(yt);const Tt=ot.size(),mt=new Float32Array(Tt);let Rt=0;for(let Lt=0;Lt<Tt;Lt++)mt[Lt]=ot.get(Lt)?wt[Rt++]:0;return mt}(C,z,Z,O.numValues):function(Q,et,ot){const _t=et.get(),ft=_t+ot*Float32Array.BYTES_PER_ELEMENT,yt=new Uint8Array(Q.subarray(_t,ft)).buffer,Mt=new Float32Array(yt);return et.set(ft),Mt}(C,z,O.numValues);return new Zm(F.name,j,Z)}(f,g,w,M);case 8:return function(C,z,F,Z){const O=Pi.decode(C,z),j=Zl(Z)?function(Q,et,ot,_t){const ft=et.get(),yt=ft+_t*Float64Array.BYTES_PER_ELEMENT,Mt=new Uint8Array(Q.subarray(ft,yt)).buffer,wt=new Float64Array(Mt);et.set(yt);const Tt=ot.size(),mt=new Float64Array(Tt);let Rt=0;for(let Lt=0;Lt<Tt;Lt++)mt[Lt]=ot.get(Lt)?wt[Rt++]:0;return mt}(C,z,Z,O.numValues):function(Q,et,ot){const _t=et.get(),ft=_t+ot*Float64Array.BYTES_PER_ELEMENT,yt=new Uint8Array(Q.subarray(_t,ft)).buffer,Mt=new Float64Array(yt);return et.set(ft),Mt}(C,z,O.numValues);return new Sh(F.name,j,Z)}(f,g,w,M);default:throw new Error(`The specified data type for the field is currently not supported: ${v}`)}}(s,r,t,a,i.scalarType,i):s!=1?null:Gl.decodeSharedDictionary(r,t,i,a,l)}function Zl(r){return r instanceof Fr}class yu{static decodeColumnType(t){switch(t){case 0:case 1:case 2:case 3:{const i={};i.nullable=!!(1&t),i.columnScope=0;const s={};return s.physicalType=t>1?6:4,s.type="physicalType",i.scalarType=s,i.type="scalarType",i}case 4:{const i={nullable:!1,columnScope:0},s={type:"physicalType",physicalType:0};return i.type="complexType",i.complexType=s,i}case 30:{const i={nullable:!1,columnScope:0},s={type:"physicalType",physicalType:1};return i.type="complexType",i.complexType=s,i}default:return this.mapScalarType(t)}}static columnTypeHasName(t){return t>=10}static columnTypeHasChildren(t){return t===30}static hasStreamCount(t){if(t.name==="id")return!1;if(t.type==="scalarType"){const i=t.scalarType;if(i.type==="physicalType")switch(i.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:default:return!1;case 9:return!0}else if(i.type==="logicalType")return!1}else if(t.type==="complexType"){const i=t.complexType;if(i.type==="physicalType")switch(i.physicalType){case 0:case 1:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",t),!1}static mapScalarType(t){let i=null;switch(t){case 10:case 11:i=0;break;case 12:case 13:i=1;break;case 14:case 15:i=2;break;case 16:case 17:i=3;break;case 18:case 19:i=4;break;case 20:case 21:i=5;break;case 22:case 23:i=6;break;case 24:case 25:i=7;break;case 26:case 27:i=8;break;case 28:case 29:i=9;break;default:return null}const s={};s.nullable=!!(1&t),s.columnScope=0;const a={type:"physicalType"};return a.physicalType=i,s.type="scalarType",s.scalarType=a,s}}const Hm=new TextDecoder;function wp(r,t){const i=ei(r,t,1)[0];if(i===0)return"";const s=t.get(),a=r.subarray(s,s+i);return t.add(i),Hm.decode(a)}function Tp(r,t){const i=ei(r,t,1)[0]>>>0,s=!!(4&i),a=!!(2&i),l=ei(r,t,1)[0]>>>0,u={};if(1&i&&(u.nullable=!0),a){const f={};if(s?(f.type="logicalType",f.logicalType=l):(f.type="physicalType",f.physicalType=l),8&i){const g=ei(r,t,1)[0]>>>0;f.children=new Array(g);for(let y=0;y<g;y++)f.children[y]=Tp(r,t)}u.type="complexField",u.complexField=f}else{const f={};s?(f.type="logicalType",f.logicalType=l):(f.type="physicalType",f.physicalType=l),u.type="scalarField",u.scalarField=f}return u}function Xm(r,t){const i=ei(r,t,1)[0]>>>0,s=yu.decodeColumnType(i);if(!s)throw new Error(`Unsupported column type code: ${i}`);if(yu.columnTypeHasName(i)?s.name=wp(r,t):i>=0&&i<=3?s.name="id":i===4&&(s.name="geometry"),yu.columnTypeHasChildren(i)){const a=ei(r,t,1)[0]>>>0,l=s.complexType;l.children=new Array(a);for(let u=0;u<a;u++)l.children[u]=Tp(r,t)}return s}function Ym(r,t){const i={featureTables:[]},s={};s.name=wp(r,t);const a=ei(r,t,1)[0]>>>0,l=ei(r,t,1)[0]>>>0;s.columns=new Array(l);for(let u=0;u<l;u++)s.columns[u]=Xm(r,t);return i.featureTables.push(s),[i,a]}function Km(r,t,i,s,a,l,u=!1){const f=t.scalarType.physicalType,g=Ht.getVectorType(a,l,r,i);if(f===4)switch(g){case ni.FLAT:{const y=Ht.decodeIntStream(r,i,a,!1);return new Th(s,y,l)}case ni.SEQUENCE:{const y=Ht.decodeSequenceIntStream(r,i,a);return new Ph(s,y[0],y[1],a.numRleValues)}case ni.CONST:{const y=Ht.decodeConstIntStream(r,i,a,!1);return new Mh(s,y,l)}}else switch(g){case ni.FLAT:{if(u){const v=Ht.decodeLongFloat64Stream(r,i,a,!1);return new Sh(s,v,l)}const y=Ht.decodeLongStream(r,i,a,!1);return new dp(s,y,l)}case ni.SEQUENCE:{const y=Ht.decodeSequenceLongStream(r,i,a);return new pp(s,y[0],y[1],a.numRleValues)}case ni.CONST:{const y=Ht.decodeConstLongStream(r,i,a,!1);return new yp(s,y,l)}}throw new Error("Vector type not supported for id column.")}class Jm{constructor(t,i){var s;switch(this._featureData=t,this.properties=this._featureData.properties||{},(s=this._featureData.geometry)===null||s===void 0?void 0:s.type){case si.POINT:case si.MULTIPOINT:this.type=1;break;case si.LINESTRING:case si.MULTILINESTRING:this.type=2;break;case si.POLYGON:case si.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=i,this.id=Number(this._featureData.id)}projectPoint(t,i,s,a){return[360*(t.x+i)/a-180,360/Math.PI*Math.atan(Math.exp((1-2*(t.y+s)/a)*Math.PI))-90]}projectLine(t,i,s,a){return t.map(l=>this.projectPoint(l,i,s,a))}toGeoJSON(t,i,s){const a=this.extent*Math.pow(2,s),l=this.extent*t,u=this.extent*i,f=this.loadGeometry();let g;switch(this.type){case 1:{const v=[];for(const S of f)v.push(S[0]);const w=this.projectLine(v,l,u,a);g=v.length===1?{type:"Point",coordinates:w[0]}:{type:"MultiPoint",coordinates:w};break}case 2:{const v=f.map(w=>this.projectLine(w,l,u,a));g=v.length===1?{type:"LineString",coordinates:v[0]}:{type:"MultiLineString",coordinates:v};break}case 3:{const v=Ns(f),w=[];for(const S of v)w.push(S.map(P=>this.projectLine(P,l,u,a)));g=w.length===1?{type:"Polygon",coordinates:w[0]}:{type:"MultiPolygon",coordinates:w};break}default:throw new Error(`unknown feature type: ${this.type}`)}const y={type:"Feature",geometry:g,properties:this.properties};return this.id!=null&&(y.id=this.id),y}loadGeometry(){const t=[];for(const i of this._featureData.geometry.coordinates){const s=[];for(const a of i)s.push(new Pt(a.x,a.y));t.push(s)}return t}bbox(){return[0,0,0,0]}}class Qm{constructor(t){this.features=[],this.featureTable=t,this.name=t.name,this.extent=t.extent,this.version=2,this.features=t.getFeatures(),this.length=this.features.length}feature(t){return new Jm(this.features[t],this.extent)}}class Sp{constructor(t){this.layers={};const i=function(s,a,l=!0){const u=new Bm(0),f=[];for(;u.get()<s.length;){const g=ei(s,u,1)[0]>>>0,y=u.get()+g;if(y>s.length)throw new Error(`Block overruns tile: ${y} > ${s.length}`);if(ei(s,u,1)[0]>>>0!=1){u.set(y);continue}const v=Ym(s,u),w=v[1],S=v[0].featureTables[0];let P=null,M=null;const C=[];let z=0;for(const Z of S.columns){const O=Z.name;if(O==="id"){let j=null;if(Z.nullable){const et=Pi.decode(s,u),ot=u.get(),_t=Ul(s,et.numValues,u);u.set(ot+et.byteLength),j=new Fr(_t,et.numValues)}const Q=Pi.decode(s,u);z=Q.getDecompressedCount(),P=Km(s,Z,u,O,Q,j??z,l)}else if(O==="geometry"){const j=ei(s,u,1)[0];if(z===0){const Q=u.get();z=Pi.decode(s,u).getDecompressedCount(),u.set(Q)}M=Um(s,j,u,z,a)}else{const j=yu.hasStreamCount(Z)?ei(s,u,1)[0]:1;if(j===0&&Z.type==="scalarType")continue;const Q=Wm(s,u,Z,j,z,void 0);Q&&(Array.isArray(Q)?C.push(...Q):C.push(Q))}}const F=new Fm(S.name,M,P,C,w);f.push(F),u.set(y)}return f}(new Uint8Array(t));this.layers=i.reduce((s,a)=>Object.assign(Object.assign({},s),{[a.name]:new Qm(a)}),{})}}class ma{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(t){return this.minX=Math.min(this.minX,t.x),this.minY=Math.min(this.minY,t.y),this.maxX=Math.max(this.maxX,t.x),this.maxY=Math.max(this.maxY,t.y),this}expandBy(t){return this.minX-=t,this.minY-=t,this.maxX+=t,this.maxY+=t,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(t){return this.expandBy(-t)}map(t){const i=new ma;return i.extend(t(new Pt(this.minX,this.minY))),i.extend(t(new Pt(this.maxX,this.minY))),i.extend(t(new Pt(this.minX,this.maxY))),i.extend(t(new Pt(this.maxX,this.maxY))),i}static fromPoints(t){const i=new ma;for(const s of t)i.extend(s);return i}contains(t){return t.x>=this.minX&&t.x<=this.maxX&&t.y>=this.minY&&t.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(t){return!this.empty()&&!t.empty()&&t.minX>=this.minX&&t.maxX<=this.maxX&&t.minY>=this.minY&&t.maxY<=this.maxY}intersects(t){return!this.empty()&&!t.empty()&&t.minX<=this.maxX&&t.maxX>=this.minX&&t.minY<=this.maxY&&t.maxY>=this.minY}}const Lh="_geojsonTileLayer";class Pp{constructor(t,i){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Js(le,16,0),this.grid3D=new Js(le,16,0),this.featureIndexArray=new N,this.promoteId=i}insert(t,i,s,a,l,u){const f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,a,l);const g=u?this.grid3D:this.grid;for(let y=0;y<i.length;y++){const v=i[y],w=[1/0,1/0,-1/0,-1/0];for(let S=0;S<v.length;S++){const P=v[S];w[0]=Math.min(w[0],P.x),w[1]=Math.min(w[1],P.y),w[2]=Math.max(w[2],P.x),w[3]=Math.max(w[3],P.y)}w[0]<le&&w[1]<le&&w[2]>=0&&w[3]>=0&&g.insert(f,w[0],w[1],w[2],w[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=this.encoding!=="mlt"?new vd(new ph(this.rawTileData)).layers:new Sp(this.rawTileData).layers,this.sourceLayerCoder=new rp(this.vtLayers?Object.keys(this.vtLayers).sort():[Lh])),this.vtLayers}query(t,i,s,a){this.loadVTLayers();const l=t.params,u=le/t.tileSize/t.scale,f=$s(l.filter,l.globalState),g=t.queryGeometry,y=t.queryPadding*u,v=ma.fromPoints(g),w=this.grid.query(v.minX-y,v.minY-y,v.maxX+y,v.maxY+y),S=ma.fromPoints(t.cameraQueryGeometry).expandBy(y),P=this.grid3D.query(S.minX,S.minY,S.maxX,S.maxY,(z,F,Z,O)=>function(j,Q,et,ot,_t){for(const yt of j)if(Q<=yt.x&&et<=yt.y&&ot>=yt.x&&_t>=yt.y)return!0;const ft=[new Pt(Q,et),new Pt(Q,_t),new Pt(ot,_t),new Pt(ot,et)];if(j.length>2){for(const yt of ft)if(ao(j,yt))return!0}for(let yt=0;yt<j.length-1;yt++)if(uf(j[yt],j[yt+1],ft))return!0;return!1}(t.cameraQueryGeometry,z-y,F-y,Z+y,O+y));for(const z of P)w.push(z);w.sort(tg);const M={};let C;for(let z=0;z<w.length;z++){const F=w[z];if(F===C)continue;C=F;const Z=this.featureIndexArray.get(F);let O=null;this.loadMatchingFeature(M,Z.bucketIndex,Z.sourceLayerIndex,Z.featureIndex,f,l.layers,l.availableImages,i,s,a,(j,Q,et)=>(O||(O=cn(j)),Q.queryIntersectsFeature({queryGeometry:g,feature:j,featureState:et,geometry:O,zoom:this.z,transform:t.transform,pixelsToTileUnits:u,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation})))}return M}loadMatchingFeature(t,i,s,a,l,u,f,g,y,v,w){const S=this.bucketLayerIDs[i];if(u&&!S.some(z=>u.has(z)))return;const P=this.sourceLayerCoder.decode(s),M=this.vtLayers[P].feature(a);if(l.needGeometry){const z=Rr(M,!0);if(!l.filter(new ce(this.tileID.overscaledZ),z,this.tileID.canonical))return}else if(!l.filter(new ce(this.tileID.overscaledZ),M))return;const C=this.getId(M,P);for(let z=0;z<S.length;z++){const F=S[z];if(u&&!u.has(F))continue;const Z=g[F];if(!Z)continue;let O={};C&&v&&(O=v.getState(Z.sourceLayer||Lh,C));const j=di({},y[F]);j.paint=Mp(j.paint,Z.paint,M,O,f),j.layout=Mp(j.layout,Z.layout,M,O,f);const Q=!w||w(M,Z,O);if(!Q)continue;const et=new np(M,this.z,this.x,this.y,C);et.layer=j;let ot=t[F];ot===void 0&&(ot=t[F]=[]),ot.push({featureIndex:a,feature:et,intersectionZ:Q})}}lookupSymbolFeatures(t,i,s,a,l,u,f,g){const y={};this.loadVTLayers();const v=$s(l.filterSpec,l.globalState);for(const w of t)this.loadMatchingFeature(y,s,a,w,v,u,f,g,i);return y}hasLayer(t){for(const i of this.bucketLayerIDs)for(const s of i)if(t===s)return!0;return!1}getId(t,i){var s;let a=t.id;return this.promoteId&&(a=t.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[i]],typeof a=="boolean"&&(a=Number(a)),a===void 0&&(!((s=t.properties)===null||s===void 0)&&s.cluster)&&this.promoteId&&(a=Number(t.properties.cluster_id))),a}}function Mp(r,t,i,s,a){return qr(r,(l,u)=>{const f=t instanceof Dn?t.get(u):null;return f&&f.evaluate?f.evaluate(i,s,a):f})}function tg(r,t){return t-r}function Ip(r,t,i,s,a){const l=[];for(let u=0;u<r.length;u++){const f=r[u];let g;for(let y=0;y<f.length-1;y++){let v=f[y],w=f[y+1];v.x<t&&w.x<t||(v.x<t?v=new Pt(t,v.y+(t-v.x)/(w.x-v.x)*(w.y-v.y))._round():w.x<t&&(w=new Pt(t,v.y+(t-v.x)/(w.x-v.x)*(w.y-v.y))._round()),v.y<i&&w.y<i||(v.y<i?v=new Pt(v.x+(i-v.y)/(w.y-v.y)*(w.x-v.x),i)._round():w.y<i&&(w=new Pt(v.x+(i-v.y)/(w.y-v.y)*(w.x-v.x),i)._round()),v.x>=s&&w.x>=s||(v.x>=s?v=new Pt(s,v.y+(s-v.x)/(w.x-v.x)*(w.y-v.y))._round():w.x>=s&&(w=new Pt(s,v.y+(s-v.x)/(w.x-v.x)*(w.y-v.y))._round()),v.y>=a&&w.y>=a||(v.y>=a?v=new Pt(v.x+(a-v.y)/(w.y-v.y)*(w.x-v.x),a)._round():w.y>=a&&(w=new Pt(v.x+(a-v.y)/(w.y-v.y)*(w.x-v.x),a)._round()),g&&v.equals(g[g.length-1])||(g=[v],l.push(g)),g.push(w)))))}}return l}function Ep(r,t,i,s,a){switch(t){case 1:return function(l,u,f,g){const y=[];for(const v of l)for(const w of v){const S=g===0?w.x:w.y;S>=u&&S<=f&&y.push([w])}return y}(r,i,s,a);case 2:return Cp(r,i,s,a,!1);case 3:return Cp(r,i,s,a,!0)}return[]}function eg(r,t,i,s,a){const l=s===0?ig:rg;let u=[];const f=[];for(let v=0;v<r.length-1;v++){const w=r[v],S=r[v+1],P=s===0?w.x:w.y,M=s===0?S.x:S.y;let C=!1;P<t?M>t&&u.push(l(w,S,t)):P>i?M<i&&u.push(l(w,S,i)):u.push(w),M<t&&P>=t&&(u.push(l(w,S,t)),C=!0),M>i&&P<=i&&(u.push(l(w,S,i)),C=!0),!a&&C&&(f.push(u),u=[])}const g=r.length-1,y=s===0?r[g].x:r[g].y;return y>=t&&y<=i&&u.push(r[g]),a&&u.length>0&&!u[0].equals(u[u.length-1])&&u.push(new Pt(u[0].x,u[0].y)),u.length>0&&f.push(u),f}function Cp(r,t,i,s,a){const l=[];for(const u of r){const f=eg(u,t,i,s,a);f.length>0&&l.push(...f)}return l}function ig(r,t,i){return new Pt(i,r.y+(i-r.x)/(t.x-r.x)*(t.y-r.y))}function rg(r,t,i){return new Pt(r.x+(i-r.y)/(t.y-r.y)*(t.x-r.x),i)}It("FeatureIndex",Pp,{omit:["rawTileData","sourceLayerCoder"]});class ws extends Pt{constructor(t,i,s,a){super(t,i),this.angle=s,a!==void 0&&(this.segment=a)}clone(){return new ws(this.x,this.y,this.angle,this.segment)}}function Ap(r,t,i,s,a){if(t.segment===void 0||i===0)return!0;let l=t,u=t.segment+1,f=0;for(;f>-i/2;){if(u--,u<0)return!1;f-=r[u].dist(l),l=r[u]}f+=r[u].dist(r[u+1]),u++;const g=[];let y=0;for(;f<i/2;){const v=r[u],w=r[u+1];if(!w)return!1;let S=r[u-1].angleTo(v)-v.angleTo(w);for(S=Math.abs((S+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:f,angleDelta:S}),y+=S;f-g[0].distance>s;)y-=g.shift().angleDelta;if(y>a)return!1;u++,f+=v.dist(w)}return!0}function Dp(r){let t=0;for(let i=0;i<r.length-1;i++)t+=r[i].dist(r[i+1]);return t}function zp(r,t,i){return r?.6*t*i:0}function kp(r,t){return Math.max(r?r.right-r.left:0,t?t.right-t.left:0)}function ng(r,t,i,s,a,l){const u=zp(i,a,l),f=kp(i,s)*l;let g=0;const y=Dp(r)/2;for(let v=0;v<r.length-1;v++){const w=r[v],S=r[v+1],P=w.dist(S);if(g+P>y){const M=(y-g)/P,C=nr.number(w.x,S.x,M),z=nr.number(w.y,S.y,M),F=new ws(C,z,S.angleTo(w),v);return F._round(),!u||Ap(r,F,f,u,t)?F:void 0}g+=P}}function sg(r,t,i,s,a,l,u,f,g){const y=zp(s,l,u),v=kp(s,a),w=v*u,S=r[0].x===0||r[0].x===g||r[0].y===0||r[0].y===g;return t-w<t/4&&(t=w+t/4),Rp(r,S?t/2*f%t:(v/2+2*l)*u*f%t,t,y,i,w,S,!1,g)}function Rp(r,t,i,s,a,l,u,f,g){const y=l/2,v=Dp(r);let w=0,S=t-i,P=[];for(let M=0;M<r.length-1;M++){const C=r[M],z=r[M+1],F=C.dist(z),Z=z.angleTo(C);for(;S+i<w+F;){S+=i;const O=(S-w)/F,j=nr.number(C.x,z.x,O),Q=nr.number(C.y,z.y,O);if(j>=0&&j<g&&Q>=0&&Q<g&&S-y>=0&&S+y<=v){const et=new ws(j,Q,Z,M);et._round(),s&&!Ap(r,et,l,s,a)||P.push(et)}}w+=F}return f||P.length||u||(P=Rp(r,w/2,i,s,a,l,u,!0,g)),P}function Lp(r,t,i,s){const a=[],l=r.image,u=l.pixelRatio,f=l.paddedRect.w-2,g=l.paddedRect.h-2;let y={x1:r.left,y1:r.top,x2:r.right,y2:r.bottom};const v=l.stretchX||[[0,f]],w=l.stretchY||[[0,g]],S=(mt,Rt)=>mt+Rt[1]-Rt[0],P=v.reduce(S,0),M=w.reduce(S,0),C=f-P,z=g-M;let F=0,Z=P,O=0,j=M,Q=0,et=C,ot=0,_t=z;if(l.content&&s){const mt=l.content,Rt=mt[2]-mt[0],Lt=mt[3]-mt[1];(l.textFitWidth||l.textFitHeight)&&(y=Nd(r)),F=xu(v,0,mt[0]),O=xu(w,0,mt[1]),Z=xu(v,mt[0],mt[2]),j=xu(w,mt[1],mt[3]),Q=mt[0]-F,ot=mt[1]-O,et=Rt-Z,_t=Lt-j}const ft=y.x1,yt=y.y1,Mt=y.x2-ft,wt=y.y2-yt,Tt=(mt,Rt,Lt,Nt)=>{const Ct=vu(mt.stretch-F,Z,Mt,ft),Yt=bu(mt.fixed-Q,et,mt.stretch,P),Se=vu(Rt.stretch-O,j,wt,yt),Ke=bu(Rt.fixed-ot,_t,Rt.stretch,M),xi=vu(Lt.stretch-F,Z,Mt,ft),Tr=bu(Lt.fixed-Q,et,Lt.stretch,P),Bi=vu(Nt.stretch-O,j,wt,yt),ui=bu(Nt.fixed-ot,_t,Nt.stretch,M),vi=new Pt(Ct,Se),Ue=new Pt(xi,Se),hi=new Pt(xi,Bi),Mi=new Pt(Ct,Bi),Ii=new Pt(Yt/u,Ke/u),Ui=new Pt(Tr/u,ui/u),bi=t*Math.PI/180;if(bi){const ai=Math.sin(bi),ze=Math.cos(bi),Je=[ze,-ai,ai,ze];vi._matMult(Je),Ue._matMult(Je),Mi._matMult(Je),hi._matMult(Je)}const Gi=mt.stretch+mt.fixed,Sr=Rt.stretch+Rt.fixed;return{tl:vi,tr:Ue,bl:Mi,br:hi,tex:{x:l.paddedRect.x+1+Gi,y:l.paddedRect.y+1+Sr,w:Lt.stretch+Lt.fixed-Gi,h:Nt.stretch+Nt.fixed-Sr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Ii,pixelOffsetBR:Ui,minFontScaleX:et/u/Mt,minFontScaleY:_t/u/wt,isSDF:i}};if(s&&(l.stretchX||l.stretchY)){const mt=Fp(v,C,P),Rt=Fp(w,z,M);for(let Lt=0;Lt<mt.length-1;Lt++){const Nt=mt[Lt],Ct=mt[Lt+1];for(let Yt=0;Yt<Rt.length-1;Yt++)a.push(Tt(Nt,Rt[Yt],Ct,Rt[Yt+1]))}}else a.push(Tt({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:f+1},{fixed:0,stretch:g+1}));return a}function xu(r,t,i){let s=0;for(const a of r)s+=Math.max(t,Math.min(i,a[1]))-Math.max(t,Math.min(i,a[0]));return s}function Fp(r,t,i){const s=[{fixed:-1,stretch:0}];for(const[a,l]of r){const u=s[s.length-1];s.push({fixed:a-u.stretch,stretch:u.stretch}),s.push({fixed:a-u.stretch,stretch:u.stretch+(l-a)})}return s.push({fixed:t+1,stretch:i}),s}function vu(r,t,i,s){return r/t*i+s}function bu(r,t,i,s){return r-t*i/s}It("Anchor",ws);class wu{constructor(t,i,s,a,l,u,f,g,y,v){var w;if(this.boxStartIndex=t.length,y){let S=u.top,P=u.bottom;const M=u.collisionPadding;M&&(S-=M[1],P+=M[3]);let C=P-S;C>0&&(C=Math.max(10,C),this.circleDiameter=C)}else{const S=!((w=u.image)===null||w===void 0)&&w.content&&(u.image.textFitWidth||u.image.textFitHeight)?Nd(u):{x1:u.left,y1:u.top,x2:u.right,y2:u.bottom};S.y1=S.y1*f-g[0],S.y2=S.y2*f+g[2],S.x1=S.x1*f-g[3],S.x2=S.x2*f+g[1];const P=u.collisionPadding;if(P&&(S.x1-=P[0]*f,S.y1-=P[1]*f,S.x2+=P[2]*f,S.y2+=P[3]*f),v){const M=new Pt(S.x1,S.y1),C=new Pt(S.x2,S.y1),z=new Pt(S.x1,S.y2),F=new Pt(S.x2,S.y2),Z=v*Math.PI/180;M._rotate(Z),C._rotate(Z),z._rotate(Z),F._rotate(Z),S.x1=Math.min(M.x,C.x,z.x,F.x),S.x2=Math.max(M.x,C.x,z.x,F.x),S.y1=Math.min(M.y,C.y,z.y,F.y),S.y2=Math.max(M.y,C.y,z.y,F.y)}t.emplaceBack(i.x,i.y,S.x1,S.y1,S.x2,S.y2,s,a,l)}this.boxEndIndex=t.length}}class ag{constructor(t=[],i=(s,a)=>s<a?-1:s>a?1:0){if(this.data=t,this.length=this.data.length,this.compare=i,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;const t=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:i,compare:s}=this,a=i[t];for(;t>0;){const l=t-1>>1,u=i[l];if(s(a,u)>=0)break;i[t]=u,t=l}i[t]=a}_down(t){const{data:i,compare:s}=this,a=this.length>>1,l=i[t];for(;t<a;){let u=1+(t<<1);const f=u+1;if(f<this.length&&s(i[f],i[u])<0&&(u=f),s(i[u],l)>=0)break;i[t]=i[u],t=u}i[t]=l}}function og(r,t=1,i=!1){const s=ma.fromPoints(r[0]),a=Math.min(s.width(),s.height());let l=a/2;const u=new ag([],lg),{minX:f,minY:g,maxX:y,maxY:v}=s;if(a===0)return new Pt(f,g);for(let P=f;P<y;P+=a)for(let M=g;M<v;M+=a)u.push(new wo(P+l,M+l,l,r));let w=function(P){let M=0,C=0,z=0;const F=P[0];for(let Z=0,O=F.length,j=O-1;Z<O;j=Z++){const Q=F[Z],et=F[j],ot=Q.x*et.y-et.x*Q.y;C+=(Q.x+et.x)*ot,z+=(Q.y+et.y)*ot,M+=3*ot}return new wo(C/M,z/M,0,P)}(r),S=u.length;for(;u.length;){const P=u.pop();(P.d>w.d||!w.d)&&(w=P,i&&console.log("found best %d after %d probes",Math.round(1e4*P.d)/1e4,S)),P.max-w.d<=t||(l=P.h/2,u.push(new wo(P.p.x-l,P.p.y-l,l,r)),u.push(new wo(P.p.x+l,P.p.y-l,l,r)),u.push(new wo(P.p.x-l,P.p.y+l,l,r)),u.push(new wo(P.p.x+l,P.p.y+l,l,r)),S+=4)}return i&&(console.log(`num probes: ${S}`),console.log(`best distance: ${w.d}`)),w.p}function lg(r,t){return t.max-r.max}function wo(r,t,i,s){this.p=new Pt(r,t),this.h=i,this.d=function(a,l){let u=!1,f=1/0;for(let g=0;g<l.length;g++){const y=l[g];for(let v=0,w=y.length,S=w-1;v<w;S=v++){const P=y[v],M=y[S];P.y>a.y!=M.y>a.y&&a.x<(M.x-P.x)*(a.y-P.y)/(M.y-P.y)+P.x&&(u=!u),f=Math.min(f,Kh(a,P,M))}}return(u?1:-1)*Math.sqrt(f)}(this.p,s),this.max=this.d+this.h*Math.SQRT2}var yi;A.aO=void 0,(yi=A.aO||(A.aO={}))[yi.center=1]="center",yi[yi.left=2]="left",yi[yi.right=3]="right",yi[yi.top=4]="top",yi[yi.bottom=5]="bottom",yi[yi["top-left"]=6]="top-left",yi[yi["top-right"]=7]="top-right",yi[yi["bottom-left"]=8]="bottom-left",yi[yi["bottom-right"]=9]="bottom-right";const Fh=Number.POSITIVE_INFINITY;function Bp(r,t){return t[1]!==Fh?function(i,s,a){let l=0,u=0;switch(s=Math.abs(s),a=Math.abs(a),i){case"top-right":case"top-left":case"top":u=a-7;break;case"bottom-right":case"bottom-left":case"bottom":u=7-a}switch(i){case"top-right":case"bottom-right":case"right":l=-s;break;case"top-left":case"bottom-left":case"left":l=s}return[l,u]}(r,t[0],t[1]):function(i,s){let a=0,l=0;s<0&&(s=0);const u=s/Math.SQRT2;switch(i){case"top-right":case"top-left":l=u-7;break;case"bottom-right":case"bottom-left":l=7-u;break;case"bottom":l=7-s;break;case"top":l=s-7}switch(i){case"top-right":case"bottom-right":a=-u;break;case"top-left":case"bottom-left":a=u;break;case"left":a=s;break;case"right":a=-s}return[a,l]}(r,t[0])}function Op(r,t,i){var s;const a=r.layout,l=(s=a.get("text-variable-anchor-offset"))===null||s===void 0?void 0:s.evaluate(t,{},i);if(l){const f=l.values,g=[];for(let y=0;y<f.length;y+=2){const v=g[y]=f[y],w=f[y+1].map(S=>S*ri);v.startsWith("top")?w[1]-=7:v.startsWith("bottom")&&(w[1]+=7),g[y+1]=w}return new Ti(g)}const u=a.get("text-variable-anchor");if(u){let f;f=r._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[a.get("text-radial-offset").evaluate(t,{},i)*ri,Fh]:a.get("text-offset").evaluate(t,{},i).map(y=>y*ri);const g=[];for(const y of u)g.push(y,Bp(y,f));return new Ti(g)}return null}function Bh(r){switch(r){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function cg(r,t,i,s,a,l,u,f,g,y,v,w){let S=l.textMaxSize.evaluate(t,{});S===void 0&&(S=u);const P=r.layers[0].layout,M=P.get("icon-offset").evaluate(t,{},v),C=Np(i.horizontal),z=u/24,F=r.tilePixelRatio*z,Z=r.tilePixelRatio*S/24,O=r.tilePixelRatio*f,j=r.tilePixelRatio*P.get("symbol-spacing"),Q=P.get("text-padding")*r.tilePixelRatio,et=function(Lt,Nt,Ct,Yt=1){const Se=Lt.get("icon-padding").evaluate(Nt,{},Ct),Ke=Se&&Se.values;return[Ke[0]*Yt,Ke[1]*Yt,Ke[2]*Yt,Ke[3]*Yt]}(P,t,v,r.tilePixelRatio),ot=P.get("text-max-angle")/180*Math.PI,_t=P.get("text-rotation-alignment")!=="viewport"&&P.get("symbol-placement")!=="point",ft=P.get("icon-rotation-alignment")==="map"&&P.get("symbol-placement")!=="point",yt=P.get("symbol-placement"),Mt=j/2,wt=P.get("icon-text-fit");let Tt;s&&wt!=="none"&&(r.allowVerticalPlacement&&i.vertical&&(Tt=jd(s,i.vertical,wt,P.get("icon-text-fit-padding"),M,z)),C&&(s=jd(s,C,wt,P.get("icon-text-fit-padding"),M,z)));const mt=v?w.line.getGranularityForZoomLevel(v.z):1,Rt=(Lt,Nt)=>{Nt.x<0||Nt.x>=le||Nt.y<0||Nt.y>=le||function(Ct,Yt,Se,Ke,xi,Tr,Bi,ui,vi,Ue,hi,Mi,Ii,Ui,bi,Gi,Sr,ai,ze,Je,Oe,oi,Nn,Br,Wl){const Ts=Ct.addToLineVertexArray(Yt,Se);let ga,To,So,Po,Zp=0,$p=0,qp=0,Wp=0,$h=-1,qh=-1;const jn={};let Hp=Dr("");if(Ct.allowVerticalPlacement&&Ke.vertical){const Ei=ui.layout.get("text-rotate").evaluate(Oe,{},Br)+90;So=new wu(vi,Yt,Ue,hi,Mi,Ke.vertical,Ii,Ui,bi,Ei),Bi&&(Po=new wu(vi,Yt,Ue,hi,Mi,Bi,Sr,ai,bi,Ei))}if(xi){const Ei=ui.layout.get("icon-rotate").evaluate(Oe,{}),ur=ui.layout.get("icon-text-fit")!=="none",_a=Lp(xi,Ei,Nn,ur),Vr=Bi?Lp(Bi,Ei,Nn,ur):void 0;To=new wu(vi,Yt,Ue,hi,Mi,xi,Sr,ai,!1,Ei),Zp=4*_a.length;const ya=Ct.iconSizeData;let un=null;ya.kind==="source"?(un=[On*ui.layout.get("icon-size").evaluate(Oe,{})],un[0]>xs&&Me(`${Ct.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):ya.kind==="composite"&&(un=[On*oi.compositeIconSizes[0].evaluate(Oe,{},Br),On*oi.compositeIconSizes[1].evaluate(Oe,{},Br)],(un[0]>xs||un[1]>xs)&&Me(`${Ct.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),Ct.addSymbols(Ct.icon,_a,un,Je,ze,Oe,A.ay.none,Yt,Ts.lineStartIndex,Ts.lineLength,-1,Br),$h=Ct.icon.placedSymbolArray.length-1,Vr&&($p=4*Vr.length,Ct.addSymbols(Ct.icon,Vr,un,Je,ze,Oe,A.ay.vertical,Yt,Ts.lineStartIndex,Ts.lineLength,-1,Br),qh=Ct.icon.placedSymbolArray.length-1)}const Xp=Object.keys(Ke.horizontal);for(const Ei of Xp){const ur=Ke.horizontal[Ei];if(!ga){Hp=Dr(ur.text);const Vr=ui.layout.get("text-rotate").evaluate(Oe,{},Br);ga=new wu(vi,Yt,Ue,hi,Mi,ur,Ii,Ui,bi,Vr)}const _a=ur.positionedLines.length===1;if(qp+=Vp(Ct,Yt,ur,Tr,ui,bi,Oe,Gi,Ts,Ke.vertical?A.ay.horizontal:A.ay.horizontalOnly,_a?Xp:[Ei],jn,$h,oi,Br),_a)break}Ke.vertical&&(Wp+=Vp(Ct,Yt,Ke.vertical,Tr,ui,bi,Oe,Gi,Ts,A.ay.vertical,["vertical"],jn,qh,oi,Br));const dg=ga?ga.boxStartIndex:Ct.collisionBoxArray.length,pg=ga?ga.boxEndIndex:Ct.collisionBoxArray.length,fg=So?So.boxStartIndex:Ct.collisionBoxArray.length,mg=So?So.boxEndIndex:Ct.collisionBoxArray.length,gg=To?To.boxStartIndex:Ct.collisionBoxArray.length,_g=To?To.boxEndIndex:Ct.collisionBoxArray.length,yg=Po?Po.boxStartIndex:Ct.collisionBoxArray.length,xg=Po?Po.boxEndIndex:Ct.collisionBoxArray.length;let Or=-1;const Su=(Ei,ur)=>Ei&&Ei.circleDiameter?Math.max(Ei.circleDiameter,ur):ur;Or=Su(ga,Or),Or=Su(So,Or),Or=Su(To,Or),Or=Su(Po,Or);const Yp=Or>-1?1:0;Yp&&(Or*=Wl/ri),Ct.glyphOffsetArray.length>=mo.MAX_GLYPHS&&Me("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Oe.sortKey!==void 0&&Ct.addToSortKeyRanges(Ct.symbolInstances.length,Oe.sortKey);const vg=Op(ui,Oe,Br),[bg,wg]=function(Ei,ur){const _a=Ei.length,Vr=ur?.values;if(Vr?.length>0)for(let ya=0;ya<Vr.length;ya+=2){const un=Vr[ya+1];Ei.emplaceBack(A.aO[Vr[ya]],un[0],un[1])}return[_a,Ei.length]}(Ct.textAnchorOffsets,vg);Ct.symbolInstances.emplaceBack(Yt.x,Yt.y,jn.right>=0?jn.right:-1,jn.center>=0?jn.center:-1,jn.left>=0?jn.left:-1,jn.vertical||-1,$h,qh,Hp,dg,pg,fg,mg,gg,_g,yg,xg,Ue,qp,Wp,Zp,$p,Yp,0,Ii,Or,bg,wg)}(r,Nt,Lt,i,s,a,Tt,r.layers[0],r.collisionBoxArray,t.index,t.sourceLayerIndex,r.index,F,[Q,Q,Q,Q],_t,g,O,et,ft,M,t,l,y,v,u)};if(yt==="line")for(const Lt of Ip(t.geometry,0,0,le,le)){const Nt=ha(Lt,mt),Ct=sg(Nt,j,ot,i.vertical||C,s,24,Z,r.overscaling,le);for(const Yt of Ct)C&&ug(r,C.text,Mt,Yt)||Rt(Nt,Yt)}else if(yt==="line-center"){for(const Lt of t.geometry)if(Lt.length>1){const Nt=ha(Lt,mt),Ct=ng(Nt,ot,i.vertical||C,s,24,Z);Ct&&Rt(Nt,Ct)}}else if(t.type==="Polygon")for(const Lt of Ns(t.geometry,0)){const Nt=og(Lt,16);Rt(ha(Lt[0],mt,!0),new ws(Nt.x,Nt.y,0))}else if(t.type==="LineString")for(const Lt of t.geometry){const Nt=ha(Lt,mt);Rt(Nt,new ws(Nt[0].x,Nt[0].y,0))}else if(t.type==="Point")for(const Lt of t.geometry)for(const Nt of Lt)Rt([Nt],new ws(Nt.x,Nt.y,0))}function Vp(r,t,i,s,a,l,u,f,g,y,v,w,S,P,M){const C=function(Z,O,j,Q,et,ot,_t,ft){const yt=Q.layout.get("text-rotate").evaluate(ot,{})*Math.PI/180,Mt=[];for(const wt of O.positionedLines)for(const Tt of wt.positionedGlyphs){if(!Tt.rect)continue;const mt=Tt.rect||{};let Rt=4,Lt=!0,Nt=1,Ct=0;const Yt=(et||ft)&&Tt.vertical,Se=Tt.metrics.advance*Tt.scale/2;if(ft&&O.verticalizable&&(Ct=wt.lineOffset/2-(Tt.imageName?-(ri-Tt.metrics.width*Tt.scale)/2:(Tt.scale-1)*ri)),Tt.imageName){const ai=_t[Tt.imageName];Lt=ai.sdf,Nt=ai.pixelRatio,Rt=1/Nt}const Ke=et?[Tt.x+Se,Tt.y]:[0,0];let xi=et?[0,0]:[Tt.x+Se+j[0],Tt.y+j[1]-Ct],Tr=[0,0];Yt&&(Tr=xi,xi=[0,0]);const Bi=Tt.metrics.isDoubleResolution?2:1,ui=(Tt.metrics.left-Rt)*Tt.scale-Se+xi[0],vi=(-Tt.metrics.top-Rt)*Tt.scale+xi[1],Ue=ui+mt.w/Bi*Tt.scale/Nt,hi=vi+mt.h/Bi*Tt.scale/Nt,Mi=new Pt(ui,vi),Ii=new Pt(Ue,vi),Ui=new Pt(ui,hi),bi=new Pt(Ue,hi);if(Yt){const ai=new Pt(-Se,Se- -17),ze=-Math.PI/2,Je=12-Se,Oe=new Pt(22-Je,-(Tt.imageName?Je:0)),oi=new Pt(...Tr);Mi._rotateAround(ze,ai)._add(Oe)._add(oi),Ii._rotateAround(ze,ai)._add(Oe)._add(oi),Ui._rotateAround(ze,ai)._add(Oe)._add(oi),bi._rotateAround(ze,ai)._add(Oe)._add(oi)}if(yt){const ai=Math.sin(yt),ze=Math.cos(yt),Je=[ze,-ai,ai,ze];Mi._matMult(Je),Ii._matMult(Je),Ui._matMult(Je),bi._matMult(Je)}const Gi=new Pt(0,0),Sr=new Pt(0,0);Mt.push({tl:Mi,tr:Ii,bl:Ui,br:bi,tex:mt,writingMode:O.writingMode,glyphOffset:Ke,sectionIndex:Tt.sectionIndex,isSDF:Lt,pixelOffsetTL:Gi,pixelOffsetBR:Sr,minFontScaleX:0,minFontScaleY:0})}return Mt}(0,i,f,a,l,u,s,r.allowVerticalPlacement),z=r.textSizeData;let F=null;z.kind==="source"?(F=[On*a.layout.get("text-size").evaluate(u,{})],F[0]>xs&&Me(`${r.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):z.kind==="composite"&&(F=[On*P.compositeTextSizes[0].evaluate(u,{},M),On*P.compositeTextSizes[1].evaluate(u,{},M)],(F[0]>xs||F[1]>xs)&&Me(`${r.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),r.addSymbols(r.text,C,F,f,l,u,y,t,g.lineStartIndex,g.lineLength,S,M);for(const Z of v)w[Z]=r.text.placedSymbolArray.length-1;return 4*C.length}function Np(r){for(const t in r)return r[t];return null}function ug(r,t,i,s){const a=r.compareText;if(t in a){const l=a[t];for(let u=l.length-1;u>=0;u--)if(s.dist(l[u])<i)return!0}else a[t]=[];return a[t].push(s),!1}const jp=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Oh{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,s]=new Uint8Array(t,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const a=s>>4;if(a!==1)throw new Error(`Got v${a} data when expected v1.`);const l=jp[15&s];if(!l)throw new Error("Unrecognized array type.");const[u]=new Uint16Array(t,2,1),[f]=new Uint32Array(t,4,1);return new Oh(f,u,l,t)}constructor(t,i=64,s=Float64Array,a){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=s,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const l=jp.indexOf(this.ArrayType),u=2*t*this.ArrayType.BYTES_PER_ELEMENT,f=t*this.IndexArrayType.BYTES_PER_ELEMENT,g=(8-f%8)%8;if(l<0)throw new Error(`Unexpected typed array class: ${s}.`);a&&a instanceof ArrayBuffer?(this.data=a,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+f+g,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+u+f+g),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+f+g,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+l]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=t)}add(t,i){const s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=t,this.coords[this._pos++]=i,s}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Vh(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,i,s,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:u,nodeSize:f}=this,g=[0,l.length-1,0],y=[];for(;g.length;){const v=g.pop()||0,w=g.pop()||0,S=g.pop()||0;if(w-S<=f){for(let z=S;z<=w;z++){const F=u[2*z],Z=u[2*z+1];F>=t&&F<=s&&Z>=i&&Z<=a&&y.push(l[z])}continue}const P=S+w>>1,M=u[2*P],C=u[2*P+1];M>=t&&M<=s&&C>=i&&C<=a&&y.push(l[P]),(v===0?t<=M:i<=C)&&(g.push(S),g.push(P-1),g.push(1-v)),(v===0?s>=M:a>=C)&&(g.push(P+1),g.push(w),g.push(1-v))}return y}within(t,i,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:a,coords:l,nodeSize:u}=this,f=[0,a.length-1,0],g=[],y=s*s;for(;f.length;){const v=f.pop()||0,w=f.pop()||0,S=f.pop()||0;if(w-S<=u){for(let z=S;z<=w;z++)Gp(l[2*z],l[2*z+1],t,i)<=y&&g.push(a[z]);continue}const P=S+w>>1,M=l[2*P],C=l[2*P+1];Gp(M,C,t,i)<=y&&g.push(a[P]),(v===0?t-s<=M:i-s<=C)&&(f.push(S),f.push(P-1),f.push(1-v)),(v===0?t+s>=M:i+s>=C)&&(f.push(P+1),f.push(w),f.push(1-v))}return g}}function Vh(r,t,i,s,a,l){if(a-s<=i)return;const u=s+a>>1;Up(r,t,u,s,a,l),Vh(r,t,i,s,u-1,1-l),Vh(r,t,i,u+1,a,1-l)}function Up(r,t,i,s,a,l){for(;a>s;){if(a-s>600){const y=a-s+1,v=i-s+1,w=Math.log(y),S=.5*Math.exp(2*w/3),P=.5*Math.sqrt(w*S*(y-S)/y)*(v-y/2<0?-1:1);Up(r,t,i,Math.max(s,Math.floor(i-v*S/y+P)),Math.min(a,Math.floor(i+(y-v)*S/y+P)),l)}const u=t[2*i+l];let f=s,g=a;for($l(r,t,s,i),t[2*a+l]>u&&$l(r,t,s,a);f<g;){for($l(r,t,f,g),f++,g--;t[2*f+l]<u;)f++;for(;t[2*g+l]>u;)g--}t[2*s+l]===u?$l(r,t,s,g):(g++,$l(r,t,g,a)),g<=i&&(s=g+1),i<=g&&(a=g-1)}}function $l(r,t,i,s){Nh(r,i,s),Nh(t,2*i,2*s),Nh(t,2*i+1,2*s+1)}function Nh(r,t,i){const s=r[t];r[t]=r[i],r[i]=s}function Gp(r,t,i,s){const a=r-i,l=t-s;return a*a+l*l}var jh;A.cG=void 0,(jh=A.cG||(A.cG={})).create="create",jh.load="load",jh.fullLoad="fullLoad";let Tu=null,ql=[];const Uh=1e3/60,Gh="loadTime",Zh="fullLoadTime",hg={mark(r){performance.mark(r)},frame(r){const t=r;Tu!=null&&ql.push(t-Tu),Tu=t},clearMetrics(){Tu=null,ql=[],performance.clearMeasures(Gh),performance.clearMeasures(Zh);for(const r in A.cG)performance.clearMarks(A.cG[r])},getPerformanceMetrics(){performance.measure(Gh,A.cG.create,A.cG.load),performance.measure(Zh,A.cG.create,A.cG.fullLoad);const r=performance.getEntriesByName(Gh)[0].duration,t=performance.getEntriesByName(Zh)[0].duration,i=ql.length,s=1/(ql.reduce((l,u)=>l+u,0)/i/1e3),a=ql.filter(l=>l>Uh).reduce((l,u)=>l+(u-Uh)/Uh,0);return{loadTime:r,fullLoadTime:t,fps:s,percentDroppedFrames:a/(i+a)*100,totalFrames:i}}};A.$=hn,A.A=Pe,A.B=Ja,A.C=An,A.D=zt,A.E=nt,A.F=function([r,t,i]){return t+=90,t*=Math.PI/180,i*=Math.PI/180,{x:r*Math.cos(t)*Math.sin(i),y:r*Math.sin(t)*Math.sin(i),z:r*Math.cos(i)}},A.G=nr,A.H=ce,A.I=fh,A.J=Gu,A.K=function(r){if(Ie==null){const t=r.navigator?r.navigator.userAgent:null;Ie=!!r.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Ie},A.L=class{constructor(r,t){this.target=r,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new km(()=>this.process()),this.subscription=Hr(this.target,"message",i=>this.receive(i),!1),this.globalScope=dr(self)?r:window}registerMessageHandler(r,t){this.messageHandlers[r]=t}unregisterMessageHandler(r){delete this.messageHandlers[r]}sendAsync(r,t){return new Promise((i,s)=>{const a=Math.round(1e18*Math.random()).toString(36).substring(0,10),l=t?Hr(t.signal,"abort",()=>{l?.unsubscribe(),delete this.resolveRejects[a];const g={id:a,type:"<cancel>",origin:location.origin,targetMapId:r.targetMapId,sourceMapId:this.mapId};this.target.postMessage(g)},Rm):null;this.resolveRejects[a]={resolve:g=>{l?.unsubscribe(),i(g)},reject:g=>{l?.unsubscribe(),s(g)}};const u=[],f=Object.assign(Object.assign({},r),{id:a,sourceMapId:this.mapId,origin:location.origin,data:Qs(r.data,u)});this.target.postMessage(f,{transfer:u})})}receive(r){const t=r.data,i=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==="<cancel>"){delete this.tasks[i];const s=this.abortControllers[i];return delete this.abortControllers[i],void(s&&s.abort())}if(dr(self)||t.mustQueue)return this.tasks[i]=t,this.taskQueue.push(i),void this.invoker.trigger();this.processTask(i,t)}}process(){if(this.taskQueue.length===0)return;const r=this.taskQueue.shift(),t=this.tasks[r];delete this.tasks[r],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(r,t)}processTask(r,t){return h(this,void 0,void 0,function*(){if(t.type==="<response>"){const a=this.resolveRejects[r];return delete this.resolveRejects[r],a?void(t.error?a.reject(Cr(t.error)):a.resolve(Cr(t.data))):void 0}if(!this.messageHandlers[t.type])return void this.completeTask(r,new Error(`Could not find a registered handler for ${t.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const i=Cr(t.data),s=new AbortController;this.abortControllers[r]=s;try{const a=yield this.messageHandlers[t.type](t.sourceMapId,i,s);this.completeTask(r,null,a)}catch(a){this.completeTask(r,a)}})}completeTask(r,t,i){const s=[];delete this.abortControllers[r];const a={id:r,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?Qs(t):null,data:Qs(i,s)};this.target.postMessage(a,{transfer:s})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},A.M=yn,A.N=function(){var r=new Pe(16);return Pe!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r},A.O=function(r,t,i){var s,a,l,u,f,g,y,v,w,S,P,M,C=i[0],z=i[1],F=i[2];return t===r?(r[12]=t[0]*C+t[4]*z+t[8]*F+t[12],r[13]=t[1]*C+t[5]*z+t[9]*F+t[13],r[14]=t[2]*C+t[6]*z+t[10]*F+t[14],r[15]=t[3]*C+t[7]*z+t[11]*F+t[15]):(a=t[1],l=t[2],u=t[3],f=t[4],g=t[5],y=t[6],v=t[7],w=t[8],S=t[9],P=t[10],M=t[11],r[0]=s=t[0],r[1]=a,r[2]=l,r[3]=u,r[4]=f,r[5]=g,r[6]=y,r[7]=v,r[8]=w,r[9]=S,r[10]=P,r[11]=M,r[12]=s*C+f*z+w*F+t[12],r[13]=a*C+g*z+S*F+t[13],r[14]=l*C+y*z+P*F+t[14],r[15]=u*C+v*z+M*F+t[15]),r},A.P=Pt,A.Q=function(r,t,i){var s=i[0],a=i[1],l=i[2];return r[0]=t[0]*s,r[1]=t[1]*s,r[2]=t[2]*s,r[3]=t[3]*s,r[4]=t[4]*a,r[5]=t[5]*a,r[6]=t[6]*a,r[7]=t[7]*a,r[8]=t[8]*l,r[9]=t[9]*l,r[10]=t[10]*l,r[11]=t[11]*l,r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r},A.R=ji,A.S=function(r,t,i){var s=t[0],a=t[1],l=t[2],u=t[3],f=t[4],g=t[5],y=t[6],v=t[7],w=t[8],S=t[9],P=t[10],M=t[11],C=t[12],z=t[13],F=t[14],Z=t[15],O=i[0],j=i[1],Q=i[2],et=i[3];return r[0]=O*s+j*f+Q*w+et*C,r[1]=O*a+j*g+Q*S+et*z,r[2]=O*l+j*y+Q*P+et*F,r[3]=O*u+j*v+Q*M+et*Z,r[4]=(O=i[4])*s+(j=i[5])*f+(Q=i[6])*w+(et=i[7])*C,r[5]=O*a+j*g+Q*S+et*z,r[6]=O*l+j*y+Q*P+et*F,r[7]=O*u+j*v+Q*M+et*Z,r[8]=(O=i[8])*s+(j=i[9])*f+(Q=i[10])*w+(et=i[11])*C,r[9]=O*a+j*g+Q*S+et*z,r[10]=O*l+j*y+Q*P+et*F,r[11]=O*u+j*v+Q*M+et*Z,r[12]=(O=i[12])*s+(j=i[13])*f+(Q=i[14])*w+(et=i[15])*C,r[13]=O*a+j*g+Q*S+et*z,r[14]=O*l+j*y+Q*P+et*F,r[15]=O*u+j*v+Q*M+et*Z,r},A.T=nh,A.U=function(r,t){const i={};for(let s=0;s<t.length;s++){const a=t[s];a in r&&(i[a]=r[a])}return i},A.V=vs,A.W=Qi,A.X=Yd,A.Y=Xd,A.Z=dt,A._=h,A.a=Xr,A.a$=Pr,A.a0=qn,A.a1=lr,A.a2=Jd,A.a3=cu,A.a4=le,A.a5=function(r,t,i){if(!r)return t||{};if(!t)return r||{};const s=ip(r),a=ip(t);(function(u,f){f.removeAll&&(u.add.clear(),u.update.clear(),u.remove.clear(),f.remove.clear());for(const g of f.remove)u.add.delete(g),u.update.delete(g);for(const[g,y]of f.update){const v=u.update.get(g);v&&(f.update.set(g,Lm(v,y)),u.update.delete(g))}})(s,a);const l={};if((s.removeAll||a.removeAll)&&(l.removeAll=!0),l.remove=new Set([...s.remove,...a.remove]),l.add=new Map([...s.add,...a.add]),l.update=new Map([...s.update,...a.update]),l.remove.size&&l.add.size)for(const u of l.add.keys())l.remove.delete(u);return function(u){const f={};return u.removeAll&&(f.removeAll=u.removeAll),u.remove&&(f.remove=Array.from(u.remove)),u.add&&(f.add=Array.from(u.add.values())),u.update&&(f.update=Array.from(u.update.values())),f}(l)},A.a6=function(r,t){if(r==null)return!0;if(r.type==="Feature")return Ol(r,t)!=null;if(r.type==="FeatureCollection"){const i=new Set;for(const s of r.features){const a=Ol(s,t);if(a==null||i.has(a))return!1;i.add(a)}return!0}return!1},A.a7=function(r,t){const i=new Map;if(r!=null)if(r.type==="Feature")i.set(Ol(r,t),r);else for(const s of r.features)i.set(Ol(s,t),s);return i},A.a8=function(r,t,i){var s,a;if(t.removeAll)r.clear();else if(t.remove)for(const l of t.remove)r.delete(l);if(t.add)for(const l of t.add){const u=Ol(l,i);u!=null&&r.set(u,l)}if(t.update)for(const l of t.update){let u=r.get(l.id);if(!u)continue;const f=!!l.newGeometry,g=l.removeAllProperties||((s=l.removeProperties)===null||s===void 0?void 0:s.length)>0||((a=l.addOrUpdateProperties)===null||a===void 0?void 0:a.length)>0;if((f||g)&&(u=Object.assign({},u),r.set(l.id,u),f&&(u.geometry=l.newGeometry),g)){if(u.properties=l.removeAllProperties?{}:Object.assign({},u.properties||{}),l.removeProperties)for(const y of l.removeProperties)delete u.properties[y];if(l.addOrUpdateProperties)for(const{key:y,value:v}of l.addOrUpdateProperties)u.properties[y]=v}}},A.a9=Lh,A.aA=function(r,t){var i=t[0],s=t[1],a=t[2],l=t[3],u=t[4],f=t[5],g=t[6],y=t[7],v=t[8],w=t[9],S=t[10],P=t[11],M=t[12],C=t[13],z=t[14],F=t[15],Z=i*f-s*u,O=i*g-a*u,j=i*y-l*u,Q=s*g-a*f,et=s*y-l*f,ot=a*y-l*g,_t=v*C-w*M,ft=v*z-S*M,yt=v*F-P*M,Mt=w*z-S*C,wt=w*F-P*C,Tt=S*F-P*z,mt=Z*Tt-O*wt+j*Mt+Q*yt-et*ft+ot*_t;return mt?(r[0]=(f*Tt-g*wt+y*Mt)*(mt=1/mt),r[1]=(a*wt-s*Tt-l*Mt)*mt,r[2]=(C*ot-z*et+F*Q)*mt,r[3]=(S*et-w*ot-P*Q)*mt,r[4]=(g*yt-u*Tt-y*ft)*mt,r[5]=(i*Tt-a*yt+l*ft)*mt,r[6]=(z*j-M*ot-F*O)*mt,r[7]=(v*ot-S*j+P*O)*mt,r[8]=(u*wt-f*yt+y*_t)*mt,r[9]=(s*yt-i*wt-l*_t)*mt,r[10]=(M*et-C*j+F*Z)*mt,r[11]=(w*j-v*et-P*Z)*mt,r[12]=(f*ft-u*Mt-g*_t)*mt,r[13]=(i*Mt-s*ft+a*_t)*mt,r[14]=(C*O-M*Q-z*Z)*mt,r[15]=(v*Q-w*O+S*Z)*mt,r):null},A.aB=Ji,A.aC=function(r){var t=r[0],i=r[1];return Math.sqrt(t*t+i*i)},A.aD=function(r){return r[0]=0,r[1]=0,r},A.aE=function(r,t,i){return r[0]=t[0]*i,r[1]=t[1]*i,r},A.aF=_h,A.aG=Ps,A.aH=function(r,t,i,s){const a=t.y-r.y,l=t.x-r.x,u=s.y-i.y,f=s.x-i.x,g=u*l-f*a;if(g===0)return null;const y=(f*(r.y-i.y)-u*(r.x-i.x))/g;return new Pt(r.x+y*l,r.y+y*a)},A.aI=Ip,A.aJ=Xh,A.aK=function(r){let t=1/0,i=1/0,s=-1/0,a=-1/0;for(const l of r)t=Math.min(t,l.x),i=Math.min(i,l.y),s=Math.max(s,l.x),a=Math.max(a,l.y);return[t,i,s,a]},A.aL=ri,A.aM=Zn,A.aN=function(r,t,i,s,a=!1){if(!i[0]&&!i[1])return[0,0];const l=a?s==="map"?-r.bearingInRadians:0:s==="viewport"?r.bearingInRadians:0;if(l){const u=Math.sin(l),f=Math.cos(l);i=[i[0]*f-i[1]*u,i[0]*u+i[1]*f]}return[a?i[0]:Zn(t,i[0],r.zoom),a?i[1]:Zn(t,i[1],r.zoom)]},A.aP=gh,A.aQ=Bh,A.aR=mh,A.aS=Oh,A.aT=Ne,A.aU=nu,A.aV=G,A.aW=$t,A.aX=vt,A.aY=Ai,A.aZ=Qd,A.a_=Ur,A.aa=Bl,A.ab=ma,A.ac=25,A.ad=wh,A.ae=r=>{const t=window.document.createElement("video");return t.muted=!0,new Promise(i=>{t.onloadstart=()=>{i(t)};for(const s of r){const a=window.document.createElement("source");k(s)||(t.crossOrigin="Anonymous"),a.src=s,t.appendChild(a)}})},A.af=xt,A.ag=function(){return $n++},A.ah=m,A.ai=mo,A.aj=$s,A.ak=Rr,A.al=np,A.am=function(r){const t={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(i,s,a,l)=>{const u=a||l;return t[s]=!u||u.toLowerCase(),""}),t["max-age"]){const i=parseInt(t["max-age"],10);isNaN(i)?delete t["max-age"]:t["max-age"]=i}return t},A.an=wi,A.ao=85.051129,A.ap=gn,A.aq=function(r){return Math.pow(2,r)},A.ar=Gn,A.as=Kd,A.at=function(r){return Math.log(r)/Math.LN2},A.au=function(r){var t=r[0],i=r[1];return t*t+i*i},A.av=class{constructor(r,t){this.max=r,this.onRemove=t,this.reset()}reset(){for(const r in this.data)for(const t of this.data[r])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(r,t,i){const s=r.wrapped().key;this.data[s]===void 0&&(this.data[s]=[]);const a={value:t,timeout:void 0};if(i!==void 0&&(a.timeout=setTimeout(()=>{this.remove(r,a)},i)),this.data[s].push(a),this.order.push(s),this.order.length>this.max){const l=this._getAndRemoveByKey(this.order[0]);l&&this.onRemove(l)}return this}has(r){return r.wrapped().key in this.data}getAndRemove(r){return this.has(r)?this._getAndRemoveByKey(r.wrapped().key):null}_getAndRemoveByKey(r){const t=this.data[r].shift();return t.timeout&&clearTimeout(t.timeout),this.data[r].length===0&&delete this.data[r],this.order.splice(this.order.indexOf(r),1),t.value}getByKey(r){const t=this.data[r];return t?t[0].value:null}get(r){return this.has(r)?this.data[r.wrapped().key][0].value:null}remove(r,t){if(!this.has(r))return this;const i=r.wrapped().key,s=t===void 0?0:this.data[i].indexOf(t),a=this.data[i][s];return this.data[i].splice(s,1),a.timeout&&clearTimeout(a.timeout),this.data[i].length===0&&delete this.data[i],this.onRemove(a.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(r){for(this.max=r;this.order.length>this.max;){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(r){const t=[];for(const i in this.data)for(const s of this.data[i])r(s.value)||t.push(s);for(const i of t)this.remove(i.value.tileID,i)}},A.aw=function(r){if(!r.length)return new Set;const t=Math.max(...r.map(g=>g.canonical.z));let i=1/0,s=-1/0,a=1/0,l=-1/0;const u=[];for(const g of r){const{x:y,y:v,z:w}=g.canonical,S=Math.pow(2,t-w),P=y*S,M=v*S;u.push({id:g,x:P,y:M}),P<i&&(i=P),P>s&&(s=P),M<a&&(a=M),M>l&&(l=M)}const f=new Set;for(const g of u)g.x!==i&&g.x!==s&&g.y!==a&&g.y!==l||f.add(g.id);return f},A.ax=function(r,t){let i=0,s=0;if(r.kind==="constant")s=r.layoutSize;else if(r.kind!=="source"){const{interpolationType:a,minZoom:l,maxZoom:u}=r,f=a?wi(ci.interpolationFactor(a,t,l,u),0,1):0;r.kind==="camera"?s=nr.number(r.minSize,r.maxSize,f):i=f}return{uSizeT:i,uSize:s}},A.az=function(r,{uSize:t,uSizeT:i},{lowerSize:s,upperSize:a}){return r.kind==="source"?s/On:r.kind==="composite"?nr.number(s/On,a/On,i):t},A.b=pr,A.b$=class extends Xi{constructor(r,t){super(r,t),this.current=Ln}set(r){if(r[12]!==this.current[12]||r[0]!==this.current[0])return this.current=r,void this.gl.uniformMatrix4fv(this.location,!1,r);for(let t=1;t<16;t++)if(r[t]!==this.current[t]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}},A.b0=function(r){var t=new Pe(3);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t},A.b1=function(r,t,i){return r[0]=t[0]-i[0],r[1]=t[1]-i[1],r[2]=t[2]-i[2],r},A.b2=function(r,t){var i=t[0],s=t[1],a=t[2],l=i*i+s*s+a*a;return l>0&&(l=1/Math.sqrt(l)),r[0]=t[0]*l,r[1]=t[1]*l,r[2]=t[2]*l,r},A.b3=dn,A.b4=function(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]},A.b5=function(r,t,i){return r[0]=t[0]*i[0],r[1]=t[1]*i[1],r[2]=t[2]*i[2],r[3]=t[3]*i[3],r},A.b6=Ci,A.b7=function(r,t,i){const s=t[0]*i[0]+t[1]*i[1]+t[2]*i[2];return s===0?null:(-(r[0]*i[0]+r[1]*i[1]+r[2]*i[2])-i[3])/s},A.b8=pn,A.b9=function(r,t,i){return r[0]=t[0]*i,r[1]=t[1]*i,r[2]=t[2]*i,r[3]=t[3]*i,r},A.bA=Is,A.bB=function(r,t,i){var s=i[0],a=i[1],l=i[2],u=i[3],f=t[0],g=t[1],y=t[2],v=a*y-l*g,w=l*f-s*y,S=s*g-a*f;return r[0]=f+u*(v+=v)+a*(S+=S)-l*(w+=w),r[1]=g+u*w+l*v-s*S,r[2]=y+u*S+s*w-a*v,r},A.bC=function(r,t,i){const s=(a=[r[0],r[1],r[2],t[0],t[1],t[2],i[0],i[1],i[2]])[0]*((v=a[8])*(u=a[4])-(f=a[5])*(y=a[7]))+a[1]*(-v*(l=a[3])+f*(g=a[6]))+a[2]*(y*l-u*g);var a,l,u,f,g,y,v;if(s===0)return null;const w=dn([],[t[0],t[1],t[2]],[i[0],i[1],i[2]]),S=dn([],[i[0],i[1],i[2]],[r[0],r[1],r[2]]),P=dn([],[r[0],r[1],r[2]],[t[0],t[1],t[2]]),M=Ur([],w,-r[3]);return Pr(M,M,Ur([],S,-t[3])),Pr(M,M,Ur([],P,-i[3])),Ur(M,M,1/s),M},A.bD=bh,A.bE=function(){return new Float64Array(4)},A.bF=function(r,t,i,s){var a=[],l=[];return a[0]=t[0]-i[0],a[1]=t[1]-i[1],a[2]=t[2]-i[2],l[0]=a[0]*Math.cos(s)-a[1]*Math.sin(s),l[1]=a[0]*Math.sin(s)+a[1]*Math.cos(s),l[2]=a[2],r[0]=l[0]+i[0],r[1]=l[1]+i[1],r[2]=l[2]+i[2],r},A.bG=function(r,t,i,s){var a=[],l=[];return a[0]=t[0]-i[0],a[1]=t[1]-i[1],a[2]=t[2]-i[2],l[0]=a[0],l[1]=a[1]*Math.cos(s)-a[2]*Math.sin(s),l[2]=a[1]*Math.sin(s)+a[2]*Math.cos(s),r[0]=l[0]+i[0],r[1]=l[1]+i[1],r[2]=l[2]+i[2],r},A.bH=function(r,t,i,s){var a=[],l=[];return a[0]=t[0]-i[0],a[1]=t[1]-i[1],a[2]=t[2]-i[2],l[0]=a[2]*Math.sin(s)+a[0]*Math.cos(s),l[1]=a[1],l[2]=a[2]*Math.cos(s)-a[0]*Math.sin(s),r[0]=l[0]+i[0],r[1]=l[1]+i[1],r[2]=l[2]+i[2],r},A.bI=function(r,t,i){var s=Math.sin(i),a=Math.cos(i),l=t[0],u=t[1],f=t[2],g=t[3],y=t[8],v=t[9],w=t[10],S=t[11];return t!==r&&(r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[0]=l*a-y*s,r[1]=u*a-v*s,r[2]=f*a-w*s,r[3]=g*a-S*s,r[8]=l*s+y*a,r[9]=u*s+v*a,r[10]=f*s+w*a,r[11]=g*s+S*a,r},A.bJ=function(r,t){const i=hr(r,360),s=hr(t,360),a=s-i,l=s>i?a-360:a+360;return Math.abs(a)<Math.abs(l)?a:l},A.bK=function(r){return r[0]=0,r[1]=0,r[2]=0,r},A.bL=function(r,t,i,s){const a=Math.sqrt(r*r+t*t),l=Math.sqrt(i*i+s*s);r/=a,t/=a,i/=l,s/=l;const u=Math.acos(r*i+t*s);return-t*i+r*s>0?u:-u},A.bM=function(r,t){const i=hr(r,2*Math.PI),s=hr(t,2*Math.PI);return Math.min(Math.abs(i-s),Math.abs(i-s+2*Math.PI),Math.abs(i-s-2*Math.PI))},A.bN=function(){const r={},t=U.$version;for(const i in U.$root){const s=U.$root[i];if(s.required){let a=null;a=i==="version"?t:s.type==="array"?[]:{},a!=null&&(r[i]=a)}}return r},A.bO=Oi,A.bP=hl,A.bQ=function r(t,i){if(Array.isArray(t)){if(!Array.isArray(i)||t.length!==i.length)return!1;for(let s=0;s<t.length;s++)if(!r(t[s],i[s]))return!1;return!0}if(typeof t=="object"&&t!==null&&i!==null){if(typeof i!="object"||Object.keys(t).length!==Object.keys(i).length)return!1;for(const s in t)if(!r(t[s],i[s]))return!1;return!0}return t===i},A.bR=function(r){r=r.slice();const t=Object.create(null);for(let i=0;i<r.length;i++)t[r[i].id]=r[i];for(let i=0;i<r.length;i++)"ref"in r[i]&&(r[i]=ut(r[i],t[r[i].ref]));return r},A.bS=function(r,t){if(r.type==="custom")return new zm(r,t);switch(r.type){case"background":return new Dm(r,t);case"circle":return new gf(r,t);case"color-relief":return new wf(r,t);case"fill":return new Bf(r,t);case"fill-extrusion":return new Hf(r,t);case"heatmap":return new yf(r,t);case"hillshade":return new vf(r,t);case"line":return new em(r,t);case"raster":return new Hu(r,t);case"symbol":return new lu(r,t)}},A.bT=r=>r.type==="raster",A.bU=Zi,A.bV=function(r,t){if(!r)return[{command:"setStyle",args:[t]}];let i=[];try{if(!ht(r.version,t.version))return[{command:"setStyle",args:[t]}];ht(r.center,t.center)||i.push({command:"setCenter",args:[t.center]}),ht(r.state,t.state)||i.push({command:"setGlobalState",args:[t.state]}),ht(r.centerAltitude,t.centerAltitude)||i.push({command:"setCenterAltitude",args:[t.centerAltitude]}),ht(r.zoom,t.zoom)||i.push({command:"setZoom",args:[t.zoom]}),ht(r.bearing,t.bearing)||i.push({command:"setBearing",args:[t.bearing]}),ht(r.pitch,t.pitch)||i.push({command:"setPitch",args:[t.pitch]}),ht(r.roll,t.roll)||i.push({command:"setRoll",args:[t.roll]}),ht(r.sprite,t.sprite)||i.push({command:"setSprite",args:[t.sprite]}),ht(r.glyphs,t.glyphs)||i.push({command:"setGlyphs",args:[t.glyphs]}),ht(r.transition,t.transition)||i.push({command:"setTransition",args:[t.transition]}),ht(r.light,t.light)||i.push({command:"setLight",args:[t.light]}),ht(r.terrain,t.terrain)||i.push({command:"setTerrain",args:[t.terrain]}),ht(r.sky,t.sky)||i.push({command:"setSky",args:[t.sky]}),ht(r.projection,t.projection)||i.push({command:"setProjection",args:[t.projection]});const s={},a=[];(function(u,f,g,y){let v;for(v in f=f||{},u=u||{})Object.prototype.hasOwnProperty.call(u,v)&&(Object.prototype.hasOwnProperty.call(f,v)||Ot(v,g,y));for(v in f)Object.prototype.hasOwnProperty.call(f,v)&&(Object.prototype.hasOwnProperty.call(u,v)?ht(u[v],f[v])||(u[v].type==="geojson"&&f[v].type==="geojson"&&Le(u,f,v)?pt(g,{command:"setGeoJSONSourceData",args:[v,f[v].data]}):Wt(v,f,g,y)):Et(v,f,g))})(r.sources,t.sources,a,s);const l=[];r.layers&&r.layers.forEach(u=>{"source"in u&&s[u.source]?i.push({command:"removeLayer",args:[u.id]}):l.push(u)}),i=i.concat(a),function(u,f,g){f=f||[];const y=(u=u||[]).map(ae),v=f.map(ae),w=u.reduce(pe,{}),S=f.reduce(pe,{}),P=y.slice(),M=Object.create(null);let C,z,F,Z,O;for(let j=0,Q=0;j<y.length;j++)C=y[j],Object.prototype.hasOwnProperty.call(S,C)?Q++:(pt(g,{command:"removeLayer",args:[C]}),P.splice(P.indexOf(C,Q),1));for(let j=0,Q=0;j<v.length;j++)C=v[v.length-1-j],P[P.length-1-j]!==C&&(Object.prototype.hasOwnProperty.call(w,C)?(pt(g,{command:"removeLayer",args:[C]}),P.splice(P.lastIndexOf(C,P.length-Q),1)):Q++,Z=P[P.length-j],pt(g,{command:"addLayer",args:[S[C],Z]}),P.splice(P.length-j,0,C),M[C]=!0);for(let j=0;j<v.length;j++)if(C=v[j],z=w[C],F=S[C],!M[C]&&!ht(z,F))if(ht(z.source,F.source)&&ht(z["source-layer"],F["source-layer"])&&ht(z.type,F.type)){for(O in Kt(z.layout,F.layout,g,C,null,"setLayoutProperty"),Kt(z.paint,F.paint,g,C,null,"setPaintProperty"),ht(z.filter,F.filter)||pt(g,{command:"setFilter",args:[C,F.filter]}),ht(z.minzoom,F.minzoom)&&ht(z.maxzoom,F.maxzoom)||pt(g,{command:"setLayerZoomRange",args:[C,F.minzoom,F.maxzoom]}),z)Object.prototype.hasOwnProperty.call(z,O)&&O!=="layout"&&O!=="paint"&&O!=="filter"&&O!=="metadata"&&O!=="minzoom"&&O!=="maxzoom"&&(O.indexOf("paint.")===0?Kt(z[O],F[O],g,C,O.slice(6),"setPaintProperty"):ht(z[O],F[O])||pt(g,{command:"setLayerProperty",args:[C,O,F[O]]}));for(O in F)Object.prototype.hasOwnProperty.call(F,O)&&!Object.prototype.hasOwnProperty.call(z,O)&&O!=="layout"&&O!=="paint"&&O!=="filter"&&O!=="metadata"&&O!=="minzoom"&&O!=="maxzoom"&&(O.indexOf("paint.")===0?Kt(z[O],F[O],g,C,O.slice(6),"setPaintProperty"):ht(z[O],F[O])||pt(g,{command:"setLayerProperty",args:[C,O,F[O]]}))}else pt(g,{command:"removeLayer",args:[C]}),Z=P[P.lastIndexOf(C)+1],pt(g,{command:"addLayer",args:[F,Z]})}(l,t.layers,i)}catch(s){console.warn("Unable to compute style diff:",s),i=[{command:"setStyle",args:[t]}]}return i},A.bW=function(r){const t=[],i=r.id;return i===void 0&&t.push({message:`layers.${i}: missing required property "id"`}),r.render===void 0&&t.push({message:`layers.${i}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&t.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),t},A.bX=qr,A.bY=mn,A.bZ=class extends Xi{constructor(r,t){super(r,t),this.current=0}set(r){this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}},A.b_=kr,A.ba=function(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]+r[3]},A.bb=ep,A.bc=go,A.bd=function(r,t,i,s,a){var l=1/Math.tan(t/2);if(r[0]=l/i,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=l,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,a!=null&&a!==1/0){var u=1/(s-a);r[10]=(a+s)*u,r[14]=2*a*s*u}else r[10]=-1,r[14]=-2*s;return r},A.be=function(r){var t=new Pe(16);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],t},A.bf=function(r,t,i){var s=Math.sin(i),a=Math.cos(i),l=t[0],u=t[1],f=t[2],g=t[3],y=t[4],v=t[5],w=t[6],S=t[7];return t!==r&&(r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[0]=l*a+y*s,r[1]=u*a+v*s,r[2]=f*a+w*s,r[3]=g*a+S*s,r[4]=y*a-l*s,r[5]=v*a-u*s,r[6]=w*a-f*s,r[7]=S*a-g*s,r},A.bg=function(r,t,i){var s=Math.sin(i),a=Math.cos(i),l=t[4],u=t[5],f=t[6],g=t[7],y=t[8],v=t[9],w=t[10],S=t[11];return t!==r&&(r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[4]=l*a+y*s,r[5]=u*a+v*s,r[6]=f*a+w*s,r[7]=g*a+S*s,r[8]=y*a-l*s,r[9]=v*a-u*s,r[10]=w*a-f*s,r[11]=S*a-g*s,r},A.bh=function(){const r=new Float32Array(16);return Gn(r),r},A.bi=function(){const r=new Float64Array(16);return Gn(r),r},A.bj=function(){return new Float64Array(16)},A.bk=function(r,t,i){const s=new Float64Array(4);return Is(s,r,t-90,i),s},A.bl=function(r,t,i,s){var a,l,u,f,g,y=t[0],v=t[1],w=t[2],S=t[3],P=i[0],M=i[1],C=i[2],z=i[3];return(l=y*P+v*M+w*C+S*z)<0&&(l=-l,P=-P,M=-M,C=-C,z=-z),1-l>Re?(a=Math.acos(l),u=Math.sin(a),f=Math.sin((1-s)*a)/u,g=Math.sin(s*a)/u):(f=1-s,g=s),r[0]=f*y+g*P,r[1]=f*v+g*M,r[2]=f*w+g*C,r[3]=f*S+g*z,r},A.bm=function(r){const t=new Float64Array(9);var i,s,a,l,u,f,g,y,v,w,S,P,M,C,z,F,Z,O;w=(a=(s=r)[0])*(g=a+a),S=(l=s[1])*g,M=(u=s[2])*g,C=u*(y=l+l),F=(f=s[3])*g,Z=f*y,O=f*(v=u+u),(i=t)[0]=1-(P=l*y)-(z=u*v),i[3]=S-O,i[6]=M+Z,i[1]=S+O,i[4]=1-w-z,i[7]=C-F,i[2]=M-Z,i[5]=C+F,i[8]=1-w-P;const j=Ai(-Math.asin(wi(t[2],-1,1)));let Q,et;return Math.hypot(t[5],t[8])<.001?(Q=0,et=-Ai(Math.atan2(t[3],t[4]))):(Q=Ai(t[5]===0&&t[8]===0?0:Math.atan2(t[5],t[8])),et=Ai(t[1]===0&&t[0]===0?0:Math.atan2(t[1],t[0]))),{roll:Q,pitch:j+90,bearing:et}},A.bn=function(r,t){return r.roll==t.roll&&r.pitch==t.pitch&&r.bearing==t.bearing},A.bo=Jt,A.bp=zr,A.bq=uo,A.br=zl,A.bs=co,A.bt=fn,A.bu=wa,A.bv=mi,A.bw=function(r,t,i,s,a){return fn(s,a,wi((r-t)/(i-t),0,1))},A.bx=hr,A.by=function(){return new Float64Array(3)},A.bz=function(r,t,i,s){return r[0]=t[0]+i[0]*s,r[1]=t[1]+i[1]*s,r[2]=t[2]+i[2]*s,r},A.c=Wn,A.c$=class{constructor(r){this._marks={start:[r.url,"start"].join("#"),end:[r.url,"end"].join("#"),measure:r.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let r=performance.getEntriesByName(this._marks.measure);return r.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),r=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),r}},A.c0=Ni,A.c1=class extends Xi{constructor(r,t){super(r,t),this.current=[0,0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]||(this.current=r,this.gl.uniform3f(this.location,r[0],r[1],r[2]))}},A.c2=class extends Xi{constructor(r,t){super(r,t),this.current=[0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]||(this.current=r,this.gl.uniform2f(this.location,r[0],r[1]))}},A.c3=Un,A.c4=function(r,t){var i=Math.sin(t),s=Math.cos(t);return r[0]=s,r[1]=i,r[2]=0,r[3]=-i,r[4]=s,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r},A.c5=function(r,t,i){var s=t[0],a=t[1],l=t[2];return r[0]=s*i[0]+a*i[3]+l*i[6],r[1]=s*i[1]+a*i[4]+l*i[7],r[2]=s*i[2]+a*i[5]+l*i[8],r},A.c6=function(r,t,i,s,a,l,u){var f=1/(t-i),g=1/(s-a),y=1/(l-u);return r[0]=-2*f,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*g,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*y,r[11]=0,r[12]=(t+i)*f,r[13]=(a+s)*g,r[14]=(u+l)*y,r[15]=1,r},A.c7=class extends Xi{constructor(r,t){super(r,t),this.current=new Array}set(r){if(r!=this.current){this.current=r;const t=new Float32Array(4*r.length);for(let i=0;i<r.length;i++)t[4*i]=r[i].r,t[4*i+1]=r[i].g,t[4*i+2]=r[i].b,t[4*i+3]=r[i].a;this.gl.uniform4fv(this.location,t)}}},A.c8=class extends Xi{constructor(r,t){super(r,t),this.current=new Array}set(r){if(r!=this.current){this.current=r;const t=new Float32Array(r);this.gl.uniform1fv(this.location,t)}}},A.c9=class extends eo{},A.cA=function(r){return Cs[r]||As[r]},A.cB=function(r,t,i){var s=t[0],a=t[1];return r[0]=i[0]*s+i[4]*a+i[12],r[1]=i[1]*s+i[5]*a+i[13],r},A.cC=function(r,t){const{x:i,y:s}=Bl.fromLngLat(t);return!(r<0||r>25||s<0||s>=1||i<0||i>=1)},A.cD=function(r,t){return r[0]=t[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=t[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=t[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},A.cE=class extends oa{},A.cF=hg,A.cH=function(r){return r.message===_n},A.cI=er,A.cJ=function(r,t){Xr.REGISTERED_PROTOCOLS[r]=t},A.cK=function(r){delete Xr.REGISTERED_PROTOCOLS[r]},A.cL=function(r,t){const i={};for(let a=0;a<r.length;a++){const l=t&&t[r[a].id]||Cc(r[a]);t&&(t[r[a].id]=l);let u=i[l];u||(u=i[l]=[]),u.push(r[a])}const s=[];for(const a in i)s.push(i[a]);return s},A.cM=It,A.cN=rp,A.cO=Pp,A.cP=Od,A.cQ=function(r){r.bucket.createArrays(),r.bucket.tilePixelRatio=le/(512*r.bucket.overscaling),r.bucket.compareText={},r.bucket.iconsNeedLinear=!1;const t=r.bucket.layers[0],i=t.layout,s=t._unevaluatedLayout._values,a={layoutIconSize:s["icon-size"].possiblyEvaluate(new ce(r.bucket.zoom+1),r.canonical),layoutTextSize:s["text-size"].possiblyEvaluate(new ce(r.bucket.zoom+1),r.canonical),textMaxSize:s["text-size"].possiblyEvaluate(new ce(18))};if(r.bucket.textSizeData.kind==="composite"){const{minZoom:y,maxZoom:v}=r.bucket.textSizeData;a.compositeTextSizes=[s["text-size"].possiblyEvaluate(new ce(y),r.canonical),s["text-size"].possiblyEvaluate(new ce(v),r.canonical)]}if(r.bucket.iconSizeData.kind==="composite"){const{minZoom:y,maxZoom:v}=r.bucket.iconSizeData;a.compositeIconSizes=[s["icon-size"].possiblyEvaluate(new ce(y),r.canonical),s["icon-size"].possiblyEvaluate(new ce(v),r.canonical)]}const l=i.get("text-line-height")*ri,u=i.get("text-rotation-alignment")!=="viewport"&&i.get("symbol-placement")!=="point",f=i.get("text-keep-upright"),g=i.get("text-size");for(const y of r.bucket.features){const v=i.get("text-font").evaluate(y,{},r.canonical).join(","),w=g.evaluate(y,{},r.canonical),S=a.layoutTextSize.evaluate(y,{},r.canonical),P=a.layoutIconSize.evaluate(y,{},r.canonical),M={horizontal:{},vertical:void 0},C=y.text;let z,F=[0,0];if(C){const j=C.toString(),Q=i.get("text-letter-spacing").evaluate(y,{},r.canonical)*ri,et=Qa(j)?Q:0,ot=i.get("text-anchor").evaluate(y,{},r.canonical),_t=Op(t,y,r.canonical);if(!_t){const wt=i.get("text-radial-offset").evaluate(y,{},r.canonical);F=wt?Bp(ot,[wt*ri,Fh]):i.get("text-offset").evaluate(y,{},r.canonical).map(Tt=>Tt*ri)}let ft=u?"center":i.get("text-justify").evaluate(y,{},r.canonical);const yt=i.get("symbol-placement")==="point"?i.get("text-max-width").evaluate(y,{},r.canonical)*ri:1/0,Mt=()=>{r.bucket.allowVerticalPlacement&&ta(j)&&(M.vertical=au(C,r.glyphMap,r.glyphPositions,r.imagePositions,v,yt,l,ot,"left",et,F,A.ay.vertical,!0,S,w))};if(!u&&_t){const wt=new Set;if(ft==="auto")for(let mt=0;mt<_t.values.length;mt+=2)wt.add(Bh(_t.values[mt]));else wt.add(ft);let Tt=!1;for(const mt of wt)if(!M.horizontal[mt])if(Tt)M.horizontal[mt]=M.horizontal[0];else{const Rt=au(C,r.glyphMap,r.glyphPositions,r.imagePositions,v,yt,l,"center",mt,et,F,A.ay.horizontal,!1,S,w);Rt&&(M.horizontal[mt]=Rt,Tt=Rt.positionedLines.length===1)}Mt()}else{ft==="auto"&&(ft=Bh(ot));const wt=au(C,r.glyphMap,r.glyphPositions,r.imagePositions,v,yt,l,ot,ft,et,F,A.ay.horizontal,!1,S,w);wt&&(M.horizontal[ft]=wt),Mt(),ta(j)&&u&&f&&(M.vertical=au(C,r.glyphMap,r.glyphPositions,r.imagePositions,v,yt,l,ot,ft,et,F,A.ay.vertical,!1,S,w))}}let Z=!1;if(y.icon&&y.icon.name){const j=r.imageMap[y.icon.name];j&&(z=Im(r.imagePositions[y.icon.name],i.get("icon-offset").evaluate(y,{},r.canonical),i.get("icon-anchor").evaluate(y,{},r.canonical)),Z=!!j.sdf,r.bucket.sdfIcons===void 0?r.bucket.sdfIcons=Z:r.bucket.sdfIcons!==Z&&Me("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(j.pixelRatio!==r.bucket.pixelRatio||i.get("icon-rotate").constantOr(1)!==0)&&(r.bucket.iconsNeedLinear=!0))}const O=Np(M.horizontal)||M.vertical;r.bucket.iconsInText=!!O&&O.iconsInText,(O||z)&&cg(r.bucket,y,M,z,r.imageMap,a,S,P,F,Z,r.canonical,r.subdivisionGranularity)}r.showCollisionBoxes&&r.bucket.generateCollisionDebugBuffers()},A.cR=lh,A.cS=uh,A.cT=hh,A.cU=xd,A.cV=ph,A.cW=ho,A.cX=function(r,t,i,s,a,l){let u=Ep(r,t,i,a,0);return u=Ep(u,t,s,l,1),u},A.cY=class{constructor(r){this.maxEntries=r,this.map=new Map}get(r){const t=this.map.get(r);return t!==void 0&&(this.map.delete(r),this.map.set(r,t)),t}set(r,t){if(this.map.has(r))this.map.delete(r);else if(this.map.size>=this.maxEntries){const i=this.map.keys().next().value;this.map.delete(i)}this.map.set(r,t)}clear(){this.map.clear()}},A.cZ=vd,A.c_=Sp,A.ca=sm,A.cb=class extends io{},A.cc=rh,A.cd=function(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))},A.ce=sd,A.cf=function(r,t,i){var s=t[0],a=t[1],l=t[2],u=i[3]*s+i[7]*a+i[11]*l+i[15];return r[0]=(i[0]*s+i[4]*a+i[8]*l+i[12])/(u=u||1),r[1]=(i[1]*s+i[5]*a+i[9]*l+i[13])/u,r[2]=(i[2]*s+i[6]*a+i[10]*l+i[14])/u,r},A.cg=class extends xl{},A.ch=class extends o{},A.ci=function(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]&&r[3]===t[3]&&r[4]===t[4]&&r[5]===t[5]&&r[6]===t[6]&&r[7]===t[7]&&r[8]===t[8]&&r[9]===t[9]&&r[10]===t[10]&&r[11]===t[11]&&r[12]===t[12]&&r[13]===t[13]&&r[14]===t[14]&&r[15]===t[15]},A.cj=function(r,t){var i=r[0],s=r[1],a=r[2],l=r[3],u=r[4],f=r[5],g=r[6],y=r[7],v=r[8],w=r[9],S=r[10],P=r[11],M=r[12],C=r[13],z=r[14],F=r[15],Z=t[0],O=t[1],j=t[2],Q=t[3],et=t[4],ot=t[5],_t=t[6],ft=t[7],yt=t[8],Mt=t[9],wt=t[10],Tt=t[11],mt=t[12],Rt=t[13],Lt=t[14],Nt=t[15];return Math.abs(i-Z)<=Re*Math.max(1,Math.abs(i),Math.abs(Z))&&Math.abs(s-O)<=Re*Math.max(1,Math.abs(s),Math.abs(O))&&Math.abs(a-j)<=Re*Math.max(1,Math.abs(a),Math.abs(j))&&Math.abs(l-Q)<=Re*Math.max(1,Math.abs(l),Math.abs(Q))&&Math.abs(u-et)<=Re*Math.max(1,Math.abs(u),Math.abs(et))&&Math.abs(f-ot)<=Re*Math.max(1,Math.abs(f),Math.abs(ot))&&Math.abs(g-_t)<=Re*Math.max(1,Math.abs(g),Math.abs(_t))&&Math.abs(y-ft)<=Re*Math.max(1,Math.abs(y),Math.abs(ft))&&Math.abs(v-yt)<=Re*Math.max(1,Math.abs(v),Math.abs(yt))&&Math.abs(w-Mt)<=Re*Math.max(1,Math.abs(w),Math.abs(Mt))&&Math.abs(S-wt)<=Re*Math.max(1,Math.abs(S),Math.abs(wt))&&Math.abs(P-Tt)<=Re*Math.max(1,Math.abs(P),Math.abs(Tt))&&Math.abs(M-mt)<=Re*Math.max(1,Math.abs(M),Math.abs(mt))&&Math.abs(C-Rt)<=Re*Math.max(1,Math.abs(C),Math.abs(Rt))&&Math.abs(z-Lt)<=Re*Math.max(1,Math.abs(z),Math.abs(Lt))&&Math.abs(F-Nt)<=Re*Math.max(1,Math.abs(F),Math.abs(Nt))},A.ck=function(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r},A.cl=r=>r.type==="symbol",A.cm=r=>r.type==="circle",A.cn=r=>r.type==="heatmap",A.co=r=>r.type==="line",A.cp=r=>r.type==="fill",A.cq=r=>r.type==="fill-extrusion",A.cr=r=>r.type==="hillshade",A.cs=r=>r.type==="color-relief",A.ct=r=>r.type==="background",A.cu=r=>r.type==="custom",A.cv=Zr,A.cw=function(r,t,i){const s=ba(t.x-i.x,t.y-i.y),a=ba(r.x-i.x,r.y-i.y);var l,u;return Ai(Math.atan2(s[0]*a[1]-s[1]*a[0],(l=s)[0]*(u=a)[0]+l[1]*u[1]))},A.cx=$r,A.cy=function(r,t){return As[t]&&(r instanceof MouseEvent||r instanceof WheelEvent)},A.cz=function(r,t){return Cs[t]&&"touches"in r},A.d=k,A.d0=function(r,t,i,s,a){return h(this,void 0,void 0,function*(){if(hn())try{return yield qn(r,t,i,s,a)}catch{}return function(l,u,f,g,y){const v=l.width,w=l.height;Wr&&mr||(Wr=new OffscreenCanvas(v,w),mr=Wr.getContext("2d",{willReadFrequently:!0})),Wr.width=v,Wr.height=w,mr.drawImage(l,0,0,v,w);const S=mr.getImageData(u,f,g,y);return mr.clearRect(0,0,v,w),S.data}(r,t,i,s,a)})},A.d1=ld,A.d2=ke,A.d3=Ga,A.d4=nn,A.e=di,A.f=r=>h(void 0,void 0,void 0,function*(){if(r.byteLength===0)return createImageBitmap(new ImageData(1,1));const t=new Blob([new Uint8Array(r)],{type:"image/png"});try{return createImageBitmap(t)}catch(i){throw new Error(`Could not load image because of ${i.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),A.g=Hn,A.h=r=>new Promise((t,i)=>{const s=new Image;s.onload=()=>{t(s),URL.revokeObjectURL(s.src),s.onload=null,window.requestAnimationFrame(()=>{s.src=fr})},s.onerror=()=>i(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 a=new Blob([new Uint8Array(r)],{type:"image/png"});s.src=r.byteLength?URL.createObjectURL(a):fr}),A.i=dr,A.j=(r,t)=>tt(di(r,{type:"json"}),t),A.k=X,A.l=W,A.m=tt,A.n=(r,t)=>tt(di(r,{type:"arrayBuffer"}),t),A.o=function(r){return new ph(r).readFields(xm,[])},A.p=Bd,A.q=function(r){return/[\u02EA\u02EB\u1100-\u11FF\u2E80-\u2FDF\u3000-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(r))},A.r=Il,A.s=Hr,A.t=gi,A.u=U,A.v=Ys,A.w=Me,A.x=Zc,A.y=Uu,A.z=ea}),Ut("worker",["./shared"],function(A){class h{constructor(k,R){this.keyCache={},k&&this.replace(k,R)}replace(k,R){this._layerConfigs={},this._layers={},this.update(k,[],R)}update(k,R,B){for(const X of k){this._layerConfigs[X.id]=X;const nt=this._layers[X.id]=A.bS(X,B);nt._featureFilter=A.aj(nt.filter,B),this.keyCache[X.id]&&delete this.keyCache[X.id]}for(const X of R)delete this.keyCache[X],delete this._layerConfigs[X],delete this._layers[X];this.familiesBySource={};const W=A.cL(Object.values(this._layerConfigs),this.keyCache);for(const X of W){const nt=X.map(Et=>this._layers[Et.id]),U=nt[0];if(U.visibility==="none")continue;const rt=U.source||"";let ut=this.familiesBySource[rt];ut||(ut=this.familiesBySource[rt]={});const ht=U.sourceLayer||A.a9;let pt=ut[ht];pt||(pt=ut[ht]=[]),pt.push(nt)}}}class Pt{constructor(k){const R={},B=[];for(const U in k){const rt=k[U],ut=R[U]={};for(const ht in rt){const pt=rt[+ht];if(!pt||pt.bitmap.width===0||pt.bitmap.height===0)continue;const Et={x:0,y:0,w:pt.bitmap.width+2,h:pt.bitmap.height+2};B.push(Et),ut[ht]={rect:Et,metrics:pt.metrics}}}const{w:W,h:X}=A.p(B),nt=new A.r({width:W||1,height:X||1});for(const U in k){const rt=k[U];for(const ut in rt){const ht=rt[+ut];if(!ht||ht.bitmap.width===0||ht.bitmap.height===0)continue;const pt=R[U][ut].rect;A.r.copy(ht.bitmap,nt,{x:0,y:0},{x:pt.x+1,y:pt.y+1},ht.bitmap)}}this.image=nt,this.positions=R}}A.cM("GlyphAtlas",Pt);class ke{constructor(k){this.tileID=new A.a1(k.tileID.overscaledZ,k.tileID.wrap,k.tileID.canonical.z,k.tileID.canonical.x,k.tileID.canonical.y),this.uid=k.uid,this.zoom=k.zoom,this.pixelRatio=k.pixelRatio,this.tileSize=k.tileSize,this.source=k.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=k.showCollisionBoxes,this.collectResourceTiming=!!k.collectResourceTiming,this.returnDependencies=!!k.returnDependencies,this.promoteId=k.promoteId,this.inFlightDependencies=[]}parse(k,R,B,W,X){return A._(this,void 0,void 0,function*(){this.status="parsing",this.data=k,this.collisionBoxArray=new A.ah;const nt=new A.cN(Object.keys(k.layers).sort()),U=new A.cO(this.tileID,this.promoteId);U.bucketLayerIDs=[];const rt={},ut={featureIndex:U,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:B,subdivisionGranularity:X},ht=R.familiesBySource[this.source];for(const Dt in ht){const jt=k.layers[Dt];if(!jt)continue;jt.version===1&&A.w(`Vector tile source "${this.source}" layer "${Dt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Di=nt.encode(Dt),xn=[];for(let ii=0;ii<jt.length;ii++){const Zt=jt.feature(ii),Mr=U.getId(Zt,Dt);xn.push({feature:Zt,id:Mr,index:ii,sourceLayerIndex:Di})}for(const ii of ht[Dt]){const Zt=ii[0];Zt.source!==this.source&&A.w(`layer.source = ${Zt.source} does not equal this.source = ${this.source}`),Zt.isHidden(this.zoom,!0)||(Ve(ii,this.zoom,B),(rt[Zt.id]=Zt.createBucket({index:U.bucketLayerIDs.length,layers:ii,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Di,sourceID:this.source})).populate(xn,ut,this.tileID.canonical),U.bucketLayerIDs.push(ii.map(Mr=>Mr.id)))}}const pt=A.bX(ut.glyphDependencies,Dt=>Object.keys(Dt).map(Number));this.inFlightDependencies.forEach(Dt=>Dt?.abort()),this.inFlightDependencies=[];let Et=Promise.resolve({});if(Object.keys(pt).length){const Dt=new AbortController;this.inFlightDependencies.push(Dt),Et=W.sendAsync({type:"GG",data:{stacks:pt,source:this.source,tileID:this.tileID,type:"glyphs"}},Dt)}const Ot=Object.keys(ut.iconDependencies);let Wt=Promise.resolve({});if(Ot.length){const Dt=new AbortController;this.inFlightDependencies.push(Dt),Wt=W.sendAsync({type:"GI",data:{icons:Ot,source:this.source,tileID:this.tileID,type:"icons"}},Dt)}const Le=Object.keys(ut.patternDependencies);let Kt=Promise.resolve({});if(Le.length){const Dt=new AbortController;this.inFlightDependencies.push(Dt),Kt=W.sendAsync({type:"GI",data:{icons:Le,source:this.source,tileID:this.tileID,type:"patterns"}},Dt)}const ae=ut.dashDependencies;let pe=Promise.resolve({});if(Object.keys(ae).length){const Dt=new AbortController;this.inFlightDependencies.push(Dt),pe=W.sendAsync({type:"GDA",data:{dashes:ae}},Dt)}const[xt,ve,fe,qe]=yield Promise.all([Et,Wt,Kt,pe]),me=new Pt(xt),bt=new A.cP(ve,fe);for(const Dt in rt){const jt=rt[Dt];jt instanceof A.ai?(Ve(jt.layers,this.zoom,B),A.cQ({bucket:jt,glyphMap:xt,glyphPositions:me.positions,imageMap:ve,imagePositions:bt.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:ut.subdivisionGranularity})):jt.hasDependencies&&(jt instanceof A.cR||jt instanceof A.cS||jt instanceof A.cT)&&(Ve(jt.layers,this.zoom,B),jt.addFeatures(ut,this.tileID.canonical,bt.patternPositions,qe))}return this.status="done",{buckets:Object.values(rt).filter(Dt=>!Dt.isEmpty()),featureIndex:U,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:me.image,imageAtlas:bt,dashPositions:qe,glyphMap:this.returnDependencies?xt:null,iconMap:this.returnDependencies?ve:null,glyphPositions:this.returnDependencies?me.positions:null}})}}function Ve(tt,k,R){const B=new A.H(k);for(const W of tt)W.recalculate(B,R)}class Ki extends A.cW{constructor(k,R){super(new A.cV,0,R,[],[]),this.feature=k,this.type=k.type,this.properties=k.tags?k.tags:{},"id"in k&&(typeof k.id=="string"?this.id=parseInt(k.id,10):typeof k.id!="number"||isNaN(k.id)||(this.id=k.id))}loadGeometry(){const k=[],R=this.feature.type===1?[this.feature.geometry]:this.feature.geometry;for(const B of R){const W=[];for(const X of B)W.push(new A.P(X[0],X[1]));k.push(W)}return k}}class Nr extends A.cU{constructor(k,R){super(new A.cV),this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.version=R?R.version:1,this.extent=R?R.extent:4096,this.length=k.length,this.features=k}feature(k){return new Ki(this.features[k],this.extent)}}function Qe(tt,k){k.writeVarintField(15,tt.version||1),k.writeStringField(1,tt.name||""),k.writeVarintField(5,tt.extent||4096);const R={keys:[],values:[],keycache:{},valuecache:{}};for(let X=0;X<tt.length;X++)R.feature=tt.feature(X),k.writeMessage(2,jr,R);const B=R.keys;for(const X of B)k.writeStringField(3,X);const W=R.values;for(const X of W)k.writeMessage(4,Pe,X)}function jr(tt,k){if(!tt.feature)return;const R=tt.feature;R.id!==void 0&&k.writeVarintField(1,R.id),k.writeMessage(2,ne,tt),k.writeVarintField(3,R.type),k.writeMessage(4,Re,R)}function ne(tt,k){for(const R in tt.feature?.properties){let B=tt.feature.properties[R],W=tt.keycache[R];if(B===null)continue;W===void 0&&(tt.keys.push(R),W=tt.keys.length-1,tt.keycache[R]=W),k.writeVarint(W),typeof B!="string"&&typeof B!="boolean"&&typeof B!="number"&&(B=JSON.stringify(B));const X=typeof B+":"+B;let nt=tt.valuecache[X];nt===void 0&&(tt.values.push(B),nt=tt.values.length-1,tt.valuecache[X]=nt),k.writeVarint(nt)}}function dt(tt,k){return(k<<3)+(7&tt)}function hn(tt){return tt<<1^tt>>31}function Re(tt,k){const R=tt.loadGeometry(),B=tt.type;let W=0,X=0;for(const nt of R){let U=1;B===1&&(U=nt.length),k.writeVarint(dt(1,U));const rt=B===3?nt.length-1:nt.length;for(let ut=0;ut<rt;ut++){ut===1&&B!==1&&k.writeVarint(dt(2,rt-1));const ht=nt[ut].x-W,pt=nt[ut].y-X;k.writeVarint(hn(ht)),k.writeVarint(hn(pt)),W+=ht,X+=pt}tt.type===3&&k.writeVarint(dt(7,1))}}function Pe(tt,k){const R=typeof tt;R==="string"?k.writeStringField(1,tt):R==="boolean"?k.writeBooleanField(7,tt):R==="number"&&(tt%1!=0?k.writeDoubleField(3,tt):tt<0?k.writeSVarintField(6,tt):k.writeVarintField(5,tt))}class Un extends A.cW{constructor(k,R,B,W,X){super(new A.cV,0,X,[],[]),this.type=k,this.properties=B||{},this.extent=X,this.pointsArray=R,this.id=W}loadGeometry(){return this.pointsArray.map(k=>k.map(R=>new A.P(R.x,R.y)))}}class Gn extends A.cU{constructor(k,R,B){super(new A.cV),this.version=2,this._myFeatures=k,this.name=R,this.length=k.length,this.extent=B}feature(k){return this._myFeatures[k]}}class Ss{constructor(){this.layers={}}addLayer(k){this.layers[k.name]=k}}function Ci(tt){let k=function(R){const B=new A.cV;return function(W,X){for(const nt in W.layers)X.writeMessage(3,Qe,W.layers[nt])}(R,B),B.finish()}(tt);return k.byteOffset===0&&k.byteLength===k.buffer.byteLength||(k=new Uint8Array(k)),{vectorTile:tt,rawData:k.buffer}}function va(tt,k,R){const{extent:B}=tt,W=Math.pow(2,R.z-k.z),X=(R.x-k.x*W)*B,nt=(R.y-k.y*W)*B,U=[];for(let rt=0;rt<tt.length;rt++){const ut=tt.feature(rt);let ht=ut.loadGeometry();for(const Et of ht)for(const Ot of Et)Ot.x=Ot.x*W-X,Ot.y=Ot.y*W-nt;const pt=128;ht=A.cX(ht,ut.type,-pt,-pt,B+pt,B+pt),ht.length!==0&&U.push(new Un(ut.type,ht,ut.properties,ut.id,B))}return new Gn(U,tt.name,B)}class Pr{constructor(k,R,B){this.actor=k,this.layerIndex=R,this.availableImages=B,this.fetching={},this.loading={},this.loaded={},this.overzoomedTileResultCache=new A.cY(1e3)}loadVectorTile(k,R){return A._(this,void 0,void 0,function*(){const B=yield A.n(k.request,R);try{return{vectorTile:k.encoding!=="mlt"?new A.cZ(new A.cV(B.data)):new A.c_(B.data),rawData:B.data,cacheControl:B.cacheControl,expires:B.expires}}catch(W){const X=new Uint8Array(B.data);let nt=`Unable to parse the tile at ${k.request.url}, `;throw nt+=X[0]===31&&X[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${W.message}`,new Error(nt)}})}loadTile(k){return A._(this,void 0,void 0,function*(){const{uid:R,overzoomParameters:B}=k;B&&(k.request=B.overzoomRequest);const W=!!(k&&k.request&&k.request.collectResourceTiming)&&new A.c$(k.request),X=new ke(k);this.loading[R]=X;const nt=new AbortController;X.abort=nt;try{const U=yield this.loadVectorTile(k,nt);if(delete this.loading[R],!U)return null;if(B){const Et=this._getOverzoomTile(k,U.vectorTile);U.rawData=Et.rawData,U.vectorTile=Et.vectorTile}const rt=U.rawData,ut={};U.expires&&(ut.expires=U.expires),U.cacheControl&&(ut.cacheControl=U.cacheControl);const ht={};if(W){const Et=W.finish();Et&&(ht.resourceTiming=JSON.parse(JSON.stringify(Et)))}X.vectorTile=U.vectorTile;const pt=X.parse(U.vectorTile,this.layerIndex,this.availableImages,this.actor,k.subdivisionGranularity);this.loaded[R]=X,this.fetching[R]={rawTileData:rt,cacheControl:ut,resourceTiming:ht};try{const Et=yield pt;return A.e({rawTileData:rt.slice(0),encoding:k.encoding},Et,ut,ht)}finally{delete this.fetching[R]}}catch(U){throw delete this.loading[R],X.status="done",this.loaded[R]=X,U}})}_getOverzoomTile(k,R){const{tileID:B,source:W,overzoomParameters:X}=k,{maxZoomTileID:nt}=X,U=`${nt.key}_${B.key}`,rt=this.overzoomedTileResultCache.get(U);if(rt)return rt;const ut=new Ss,ht=this.layerIndex.familiesBySource[W];for(const Et in ht){const Ot=R.layers[Et];if(!Ot)continue;const Wt=va(Ot,nt,B.canonical);Wt.length>0&&ut.addLayer(Wt)}const pt=Ci(ut);return this.overzoomedTileResultCache.set(U,pt),pt}reloadTile(k){return A._(this,void 0,void 0,function*(){const R=k.uid;if(!this.loaded||!this.loaded[R])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const B=this.loaded[R];if(B.showCollisionBoxes=k.showCollisionBoxes,B.status==="parsing"){const W=yield B.parse(B.vectorTile,this.layerIndex,this.availableImages,this.actor,k.subdivisionGranularity);let X;if(this.fetching[R]){const{rawTileData:nt,cacheControl:U,resourceTiming:rt}=this.fetching[R];delete this.fetching[R],X=A.e({rawTileData:nt.slice(0),encoding:k.encoding},W,U,rt)}else X=W;return X}if(B.status==="done"&&B.vectorTile)return B.parse(B.vectorTile,this.layerIndex,this.availableImages,this.actor,k.subdivisionGranularity)})}abortTile(k){return A._(this,void 0,void 0,function*(){const R=this.loading,B=k.uid;R&&R[B]&&R[B].abort&&(R[B].abort.abort(),delete R[B])})}removeTile(k){return A._(this,void 0,void 0,function*(){this.loaded&&this.loaded[k.uid]&&delete this.loaded[k.uid]})}}class Ur{constructor(){this.loaded={}}loadTile(k){return A._(this,void 0,void 0,function*(){const{uid:R,encoding:B,rawImageData:W,redFactor:X,greenFactor:nt,blueFactor:U,baseShift:rt}=k,ut=W.width+2,ht=W.height+2,pt=A.b(W)?new A.R({width:ut,height:ht},yield A.d0(W,-1,-1,ut,ht)):W,Et=new A.d1(R,pt,B,X,nt,U,rt);return this.loaded=this.loaded||{},this.loaded[R]=Et,Et})}removeTile(k){const R=this.loaded,B=k.uid;R&&R[B]&&delete R[B]}}var dn,Gr,pn=function(){if(Gr)return dn;function tt(R,B){if(R.length!==0){k(R[0],B);for(var W=1;W<R.length;W++)k(R[W],!B)}}function k(R,B){for(var W=0,X=0,nt=0,U=R.length,rt=U-1;nt<U;rt=nt++){var ut=(R[nt][0]-R[rt][0])*(R[rt][1]+R[nt][1]),ht=W+ut;X+=Math.abs(W)>=Math.abs(ut)?W-ht+ut:ut-ht+W,W=ht}W+X>=0!=!!B&&R.reverse()}return Gr=1,dn=function R(B,W){var X,nt=B&&B.type;if(nt==="FeatureCollection")for(X=0;X<B.features.length;X++)R(B.features[X],W);else if(nt==="GeometryCollection")for(X=0;X<B.geometries.length;X++)R(B.geometries[X],W);else if(nt==="Feature")R(B.geometry,W);else if(nt==="Polygon")tt(B.coordinates,W);else if(nt==="MultiPolygon")for(X=0;X<B.coordinates.length;X++)tt(B.coordinates[X],W);return B}}(),Ps=A.d2(pn);const Ms={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:tt=>tt},Is=Math.fround||(Ji=new Float32Array(1),tt=>(Ji[0]=+tt,Ji[0]));var Ji;class ba{constructor(k){this.options=Object.assign(Object.create(Ms),k),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(k){const{log:R,minZoom:B,maxZoom:W}=this.options;R&&console.time("total time");const X=`prepare ${k.length} points`;R&&console.time(X),this.points=k;const nt=[];for(let rt=0;rt<k.length;rt++){const ut=k[rt];if(!ut.geometry)continue;const[ht,pt]=ut.geometry.coordinates,Et=Is(hr(ht)),Ot=Is(fn(pt));nt.push(Et,Ot,1/0,rt,-1,1),this.options.reduce&&nt.push(0)}let U=this.trees[W+1]=this._createTree(nt);R&&console.timeEnd(X);for(let rt=W;rt>=B;rt--){const ut=+Date.now();U=this.trees[rt]=this._createTree(this._cluster(U,rt)),R&&console.log("z%d: %d clusters in %dms",rt,U.numItems,+Date.now()-ut)}return R&&console.timeEnd("total time"),this}getClusters(k,R){let B=((k[0]+180)%360+360)%360-180;const W=Math.max(-90,Math.min(90,k[1]));let X=k[2]===180?180:((k[2]+180)%360+360)%360-180;const nt=Math.max(-90,Math.min(90,k[3]));if(k[2]-k[0]>=360)B=-180,X=180;else if(B>X){const pt=this.getClusters([B,W,180,nt],R),Et=this.getClusters([-180,W,X,nt],R);return pt.concat(Et)}const U=this.trees[this._limitZoom(R)],rt=U.range(hr(B),fn(nt),hr(X),fn(W)),ut=U.data,ht=[];for(const pt of rt){const Et=this.stride*pt;ht.push(ut[Et+5]>1?le(ut,Et,this.clusterProps):this.points[ut[Et+3]])}return ht}getChildren(k){const R=this._getOriginId(k),B=this._getOriginZoom(k),W="No cluster with the specified id.",X=this.trees[B];if(!X)throw new Error(W);const nt=X.data;if(R*this.stride>=nt.length)throw new Error(W);const U=this.options.radius/(this.options.extent*Math.pow(2,B-1)),rt=X.within(nt[R*this.stride],nt[R*this.stride+1],U),ut=[];for(const ht of rt){const pt=ht*this.stride;nt[pt+4]===k&&ut.push(nt[pt+5]>1?le(nt,pt,this.clusterProps):this.points[nt[pt+3]])}if(ut.length===0)throw new Error(W);return ut}getLeaves(k,R,B){const W=[];return this._appendLeaves(W,k,R=R||10,B=B||0,0),W}getTile(k,R,B){const W=this.trees[this._limitZoom(k)],X=Math.pow(2,k),{extent:nt,radius:U}=this.options,rt=U/nt,ut=(B-rt)/X,ht=(B+1+rt)/X,pt={features:[]};return this._addTileFeatures(W.range((R-rt)/X,ut,(R+1+rt)/X,ht),W.data,R,B,X,pt),R===0&&this._addTileFeatures(W.range(1-rt/X,ut,1,ht),W.data,X,B,X,pt),R===X-1&&this._addTileFeatures(W.range(0,ut,rt/X,ht),W.data,-1,B,X,pt),pt.features.length?pt:null}getClusterExpansionZoom(k){let R=this._getOriginZoom(k)-1;for(;R<=this.options.maxZoom;){const B=this.getChildren(k);if(R++,B.length!==1)break;k=B[0].properties.cluster_id}return R}_appendLeaves(k,R,B,W,X){const nt=this.getChildren(R);for(const U of nt){const rt=U.properties;if(rt&&rt.cluster?X+rt.point_count<=W?X+=rt.point_count:X=this._appendLeaves(k,rt.cluster_id,B,W,X):X<W?X++:k.push(U),k.length===B)break}return X}_createTree(k){const R=new A.aS(k.length/this.stride|0,this.options.nodeSize,Float32Array);for(let B=0;B<k.length;B+=this.stride)R.add(k[B],k[B+1]);return R.finish(),R.data=k,R}_addTileFeatures(k,R,B,W,X,nt){for(const U of k){const rt=U*this.stride,ut=R[rt+5]>1;let ht,pt,Et;if(ut)ht=Zn(R,rt,this.clusterProps),pt=R[rt],Et=R[rt+1];else{const Le=this.points[R[rt+3]];ht=Le.properties;const[Kt,ae]=Le.geometry.coordinates;pt=hr(Kt),Et=fn(ae)}const Ot={type:1,geometry:[[Math.round(this.options.extent*(pt*X-B)),Math.round(this.options.extent*(Et*X-W))]],tags:ht};let Wt;Wt=ut||this.options.generateId?R[rt+3]:this.points[R[rt+3]].id,Wt!==void 0&&(Ot.id=Wt),nt.features.push(Ot)}}_limitZoom(k){return Math.max(this.options.minZoom,Math.min(Math.floor(+k),this.options.maxZoom+1))}_cluster(k,R){const{radius:B,extent:W,reduce:X,minPoints:nt}=this.options,U=B/(W*Math.pow(2,R)),rt=k.data,ut=[],ht=this.stride;for(let pt=0;pt<rt.length;pt+=ht){if(rt[pt+2]<=R)continue;rt[pt+2]=R;const Et=rt[pt],Ot=rt[pt+1],Wt=k.within(rt[pt],rt[pt+1],U),Le=rt[pt+5];let Kt=Le;for(const ae of Wt){const pe=ae*ht;rt[pe+2]>R&&(Kt+=rt[pe+5])}if(Kt>Le&&Kt>=nt){let ae,pe=Et*Le,xt=Ot*Le,ve=-1;const fe=(pt/ht<<5)+(R+1)+this.points.length;for(const qe of Wt){const me=qe*ht;if(rt[me+2]<=R)continue;rt[me+2]=R;const bt=rt[me+5];pe+=rt[me]*bt,xt+=rt[me+1]*bt,rt[me+4]=fe,X&&(ae||(ae=this._map(rt,pt,!0),ve=this.clusterProps.length,this.clusterProps.push(ae)),X(ae,this._map(rt,me)))}rt[pt+4]=fe,ut.push(pe/Kt,xt/Kt,1/0,fe,-1,Kt),X&&ut.push(ve)}else{for(let ae=0;ae<ht;ae++)ut.push(rt[pt+ae]);if(Kt>1)for(const ae of Wt){const pe=ae*ht;if(!(rt[pe+2]<=R)){rt[pe+2]=R;for(let xt=0;xt<ht;xt++)ut.push(rt[pe+xt])}}}}return ut}_getOriginId(k){return k-this.points.length>>5}_getOriginZoom(k){return(k-this.points.length)%32}_map(k,R,B){if(k[R+5]>1){const nt=this.clusterProps[k[R+6]];return B?Object.assign({},nt):nt}const W=this.points[k[R+3]].properties,X=this.options.map(W);return B&&X===W?Object.assign({},X):X}}function le(tt,k,R){return{type:"Feature",id:tt[k+3],properties:Zn(tt,k,R),geometry:{type:"Point",coordinates:[(B=tt[k],360*(B-.5)),wa(tt[k+1])]}};var B}function Zn(tt,k,R){const B=tt[k+5],W=B>=1e4?`${Math.round(B/1e3)}k`:B>=1e3?Math.round(B/100)/10+"k":B,X=tt[k+6],nt=X===-1?{}:Object.assign({},R[X]);return Object.assign(nt,{cluster:!0,cluster_id:tt[k+3],point_count:B,point_count_abbreviated:W})}function hr(tt){return tt/360+.5}function fn(tt){const k=Math.sin(tt*Math.PI/180),R=.5-.25*Math.log((1+k)/(1-k))/Math.PI;return R<0?0:R>1?1:R}function wa(tt){const k=(180-360*tt)*Math.PI/180;return 360*Math.atan(Math.exp(k))/Math.PI-90}function Zr(tt,k,R,B){let W=B;const X=k+(R-k>>1);let nt,U=R-k;const rt=tt[k],ut=tt[k+1],ht=tt[R],pt=tt[R+1];for(let Et=k+3;Et<R;Et+=3){const Ot=$r(tt[Et],tt[Et+1],rt,ut,ht,pt);if(Ot>W)nt=Et,W=Ot;else if(Ot===W){const Wt=Math.abs(Et-X);Wt<U&&(nt=Et,U=Wt)}}W>B&&(nt-k>3&&Zr(tt,k,nt,B),tt[nt+2]=W,R-nt>3&&Zr(tt,nt,R,B))}function $r(tt,k,R,B,W,X){let nt=W-R,U=X-B;if(nt!==0||U!==0){const rt=((tt-R)*nt+(k-B)*U)/(nt*nt+U*U);rt>1?(R=W,B=X):rt>0&&(R+=nt*rt,B+=U*rt)}return nt=tt-R,U=k-B,nt*nt+U*U}function wi(tt,k,R,B){const W={id:tt??null,type:k,geometry:R,tags:B,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(k==="Point"||k==="MultiPoint"||k==="LineString")Qi(W,R);else if(k==="Polygon")Qi(W,R[0]);else if(k==="MultiLineString")for(const X of R)Qi(W,X);else if(k==="MultiPolygon")for(const X of R)Qi(W,X[0]);return W}function Qi(tt,k){for(let R=0;R<k.length;R+=3)tt.minX=Math.min(tt.minX,k[R]),tt.minY=Math.min(tt.minY,k[R+1]),tt.maxX=Math.max(tt.maxX,k[R]),tt.maxY=Math.max(tt.maxY,k[R+1])}function di(tt,k,R,B){if(!k.geometry)return;const W=k.geometry.coordinates;if(W&&W.length===0)return;const X=k.geometry.type,nt=Math.pow(R.tolerance/((1<<R.maxZoom)*R.extent),2);let U=[],rt=k.id;if(R.promoteId?rt=k.properties[R.promoteId]:R.generateId&&(rt=B||0),X==="Point")$n(W,U);else if(X==="MultiPoint")for(const ut of W)$n(ut,U);else if(X==="LineString")qr(W,U,nt,!1);else if(X==="MultiLineString"){if(R.lineMetrics){for(const ut of W)U=[],qr(ut,U,nt,!1),tt.push(wi(rt,"LineString",U,k.properties));return}mn(W,U,nt,!1)}else if(X==="Polygon")mn(W,U,nt,!0);else{if(X!=="MultiPolygon"){if(X==="GeometryCollection"){for(const ut of k.geometry.geometries)di(tt,{id:rt,geometry:ut,properties:k.properties},R,B);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const ut of W){const ht=[];mn(ut,ht,nt,!0),U.push(ht)}}tt.push(wi(rt,X,U,k.properties))}function $n(tt,k){k.push(Zi(tt[0]),Es(tt[1]),0)}function qr(tt,k,R,B){let W,X,nt=0;for(let rt=0;rt<tt.length;rt++){const ut=Zi(tt[rt][0]),ht=Es(tt[rt][1]);k.push(ut,ht,0),rt>0&&(nt+=B?(W*ht-ut*X)/2:Math.sqrt(Math.pow(ut-W,2)+Math.pow(ht-X,2))),W=ut,X=ht}const U=k.length-3;k[2]=1,Zr(k,0,U,R),k[U+2]=1,k.size=Math.abs(nt),k.start=0,k.end=k.size}function mn(tt,k,R,B){for(let W=0;W<tt.length;W++){const X=[];qr(tt[W],X,R,B),k.push(X)}}function Zi(tt){return tt/360+.5}function Es(tt){const k=Math.sin(tt*Math.PI/180),R=.5-.25*Math.log((1+k)/(1-k))/Math.PI;return R<0?0:R>1?1:R}function Me(tt,k,R,B,W,X,nt,U){if(B/=k,X>=(R/=k)&&nt<B)return tt;if(nt<R||X>=B)return null;const rt=[];for(const ut of tt){const ht=ut.geometry;let pt=ut.type;const Et=W===0?ut.minX:ut.minY,Ot=W===0?ut.maxX:ut.maxY;if(Et>=R&&Ot<B){rt.push(ut);continue}if(Ot<R||Et>=B)continue;let Wt=[];if(pt==="Point"||pt==="MultiPoint")tr(ht,Wt,R,B,W);else if(pt==="LineString")dr(ht,Wt,R,B,W,!1,U.lineMetrics);else if(pt==="MultiLineString")pr(ht,Wt,R,B,W,!1);else if(pt==="Polygon")pr(ht,Wt,R,B,W,!0);else if(pt==="MultiPolygon")for(const Le of ht){const Kt=[];pr(Le,Kt,R,B,W,!0),Kt.length&&Wt.push(Kt)}if(Wt.length){if(U.lineMetrics&&pt==="LineString"){for(const Le of Wt)rt.push(wi(ut.id,pt,Le,ut.tags));continue}pt!=="LineString"&&pt!=="MultiLineString"||(Wt.length===1?(pt="LineString",Wt=Wt[0]):pt="MultiLineString"),pt!=="Point"&&pt!=="MultiPoint"||(pt=Wt.length===3?"Point":"MultiPoint"),rt.push(wi(ut.id,pt,Wt,ut.tags))}}return rt.length?rt:null}function tr(tt,k,R,B,W){for(let X=0;X<tt.length;X+=3){const nt=tt[X+W];nt>=R&&nt<=B&&fr(k,tt[X],tt[X+1],tt[X+2])}}function dr(tt,k,R,B,W,X,nt){let U=Ie(tt);const rt=W===0?qn:Wr;let ut,ht,pt=tt.start;for(let Kt=0;Kt<tt.length-3;Kt+=3){const ae=tt[Kt],pe=tt[Kt+1],xt=tt[Kt+2],ve=tt[Kt+3],fe=tt[Kt+4],qe=W===0?ae:pe,me=W===0?ve:fe;let bt=!1;nt&&(ut=Math.sqrt(Math.pow(ae-ve,2)+Math.pow(pe-fe,2))),qe<R?me>R&&(ht=rt(U,ae,pe,ve,fe,R),nt&&(U.start=pt+ut*ht)):qe>B?me<B&&(ht=rt(U,ae,pe,ve,fe,B),nt&&(U.start=pt+ut*ht)):fr(U,ae,pe,xt),me<R&&qe>=R&&(ht=rt(U,ae,pe,ve,fe,R),bt=!0),me>B&&qe<=B&&(ht=rt(U,ae,pe,ve,fe,B),bt=!0),!X&&bt&&(nt&&(U.end=pt+ut*ht),k.push(U),U=Ie(tt)),nt&&(pt+=ut)}let Et=tt.length-3;const Ot=tt[Et],Wt=tt[Et+1],Le=W===0?Ot:Wt;Le>=R&&Le<=B&&fr(U,Ot,Wt,tt[Et+2]),Et=U.length-3,X&&Et>=3&&(U[Et]!==U[0]||U[Et+1]!==U[1])&&fr(U,U[0],U[1],U[2]),U.length&&k.push(U)}function Ie(tt){const k=[];return k.size=tt.size,k.start=tt.start,k.end=tt.end,k}function pr(tt,k,R,B,W,X){for(const nt of tt)dr(nt,k,R,B,W,X,!1)}function fr(tt,k,R,B){tt.push(k,R,B)}function qn(tt,k,R,B,W,X){const nt=(X-k)/(B-k);return fr(tt,X,R+(W-R)*nt,1),nt}function Wr(tt,k,R,B,W,X){const nt=(X-R)/(W-R);return fr(tt,k+(B-k)*nt,X,1),nt}function mr(tt,k){const R=[];for(let B=0;B<tt.length;B++){const W=tt[B],X=W.type;let nt;if(X==="Point"||X==="MultiPoint"||X==="LineString")nt=Hr(W.geometry,k);else if(X==="MultiLineString"||X==="Polygon"){nt=[];for(const U of W.geometry)nt.push(Hr(U,k))}else if(X==="MultiPolygon"){nt=[];for(const U of W.geometry){const rt=[];for(const ut of U)rt.push(Hr(ut,k));nt.push(rt)}}R.push(wi(W.id,X,nt,W.tags))}return R}function Hr(tt,k){const R=[];R.size=tt.size,tt.start!==void 0&&(R.start=tt.start,R.end=tt.end);for(let B=0;B<tt.length;B+=3)R.push(tt[B]+k,tt[B+1],tt[B+2]);return R}function gn(tt,k){if(tt.transformed)return tt;const R=1<<tt.z,B=tt.x,W=tt.y;for(const X of tt.features){const nt=X.geometry,U=X.type;if(X.geometry=[],U===1)for(let rt=0;rt<nt.length;rt+=2)X.geometry.push(Ai(nt[rt],nt[rt+1],k,R,B,W));else for(let rt=0;rt<nt.length;rt++){const ut=[];for(let ht=0;ht<nt[rt].length;ht+=2)ut.push(Ai(nt[rt][ht],nt[rt][ht+1],k,R,B,W));X.geometry.push(ut)}}return tt.transformed=!0,tt}function Ai(tt,k,R,B,W,X){return[Math.round(R*(tt*B-W)),Math.round(R*(k*B-X))]}function Cs(tt,k,R,B,W){const X=k===W.maxZoom?0:W.tolerance/((1<<k)*W.extent),nt={features:[],numPoints:0,numSimplified:0,numFeatures:tt.length,source:null,x:R,y:B,z:k,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const U of tt)As(nt,U,X,W);return nt}function As(tt,k,R,B){const W=k.geometry,X=k.type,nt=[];if(tt.minX=Math.min(tt.minX,k.minX),tt.minY=Math.min(tt.minY,k.minY),tt.maxX=Math.max(tt.maxX,k.maxX),tt.maxY=Math.max(tt.maxY,k.maxY),X==="Point"||X==="MultiPoint")for(let U=0;U<W.length;U+=3)nt.push(W[U],W[U+1]),tt.numPoints++,tt.numSimplified++;else if(X==="LineString")_n(nt,W,tt,R,!1,!1);else if(X==="MultiLineString"||X==="Polygon")for(let U=0;U<W.length;U++)_n(nt,W[U],tt,R,X==="Polygon",U===0);else if(X==="MultiPolygon")for(let U=0;U<W.length;U++){const rt=W[U];for(let ut=0;ut<rt.length;ut++)_n(nt,rt[ut],tt,R,!0,ut===0)}if(nt.length){let U=k.tags||null;if(X==="LineString"&&B.lineMetrics){U={};for(const ut in k.tags)U[ut]=k.tags[ut];U.mapbox_clip_start=W.start/W.size,U.mapbox_clip_end=W.end/W.size}const rt={geometry:nt,type:X==="Polygon"||X==="MultiPolygon"?3:X==="LineString"||X==="MultiLineString"?2:1,tags:U};k.id!==null&&(rt.id=k.id),tt.features.push(rt)}}function _n(tt,k,R,B,W,X){const nt=B*B;if(B>0&&k.size<(W?nt:B))return void(R.numPoints+=k.length/3);const U=[];for(let rt=0;rt<k.length;rt+=3)(B===0||k[rt+2]>nt)&&(R.numSimplified++,U.push(k[rt],k[rt+1])),R.numPoints++;W&&function(rt,ut){let ht=0;for(let pt=0,Et=rt.length,Ot=Et-2;pt<Et;Ot=pt,pt+=2)ht+=(rt[pt]-rt[Ot])*(rt[pt+1]+rt[Ot+1]);if(ht>0===ut)for(let pt=0,Et=rt.length;pt<Et/2;pt+=2){const Ot=rt[pt],Wt=rt[pt+1];rt[pt]=rt[Et-2-pt],rt[pt+1]=rt[Et-1-pt],rt[Et-2-pt]=Ot,rt[Et-1-pt]=Wt}}(U,X),tt.push(U)}const Wn={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Xr{constructor(k,R){const B=(R=this.options=function(X,nt){for(const U in nt)X[U]=nt[U];return X}(Object.create(Wn),R)).debug;if(B&&console.time("preprocess data"),R.maxZoom<0||R.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(R.promoteId&&R.generateId)throw new Error("promoteId and generateId cannot be used together.");let W=function(X,nt){const U=[];if(X.type==="FeatureCollection")for(let rt=0;rt<X.features.length;rt++)di(U,X.features[rt],nt,rt);else di(U,X.type==="Feature"?X:{geometry:X},nt);return U}(k,R);this.tiles={},this.tileCoords=[],B&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",R.indexMaxZoom,R.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),W=function(X,nt){const U=nt.buffer/nt.extent;let rt=X;const ut=Me(X,1,-1-U,U,0,-1,2,nt),ht=Me(X,1,1-U,2+U,0,-1,2,nt);return(ut||ht)&&(rt=Me(X,1,-U,1+U,0,-1,2,nt)||[],ut&&(rt=mr(ut,1).concat(rt)),ht&&(rt=rt.concat(mr(ht,-1)))),rt}(W,R),W.length&&this.splitTile(W,0,0,0),B&&(W.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(k,R,B,W,X,nt,U){const rt=[k,R,B,W],ut=this.options,ht=ut.debug;for(;rt.length;){W=rt.pop(),B=rt.pop(),R=rt.pop(),k=rt.pop();const pt=1<<R,Et=Hn(R,B,W);let Ot=this.tiles[Et];if(!Ot&&(ht>1&&console.time("creation"),Ot=this.tiles[Et]=Cs(k,R,B,W,ut),this.tileCoords.push({z:R,x:B,y:W}),ht)){ht>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",R,B,W,Ot.numFeatures,Ot.numPoints,Ot.numSimplified),console.timeEnd("creation"));const bt=`z${R}`;this.stats[bt]=(this.stats[bt]||0)+1,this.total++}if(Ot.source=k,X==null){if(R===ut.indexMaxZoom||Ot.numPoints<=ut.indexMaxPoints)continue}else{if(R===ut.maxZoom||R===X)continue;if(X!=null){const bt=X-R;if(B!==nt>>bt||W!==U>>bt)continue}}if(Ot.source=null,k.length===0)continue;ht>1&&console.time("clipping");const Wt=.5*ut.buffer/ut.extent,Le=.5-Wt,Kt=.5+Wt,ae=1+Wt;let pe=null,xt=null,ve=null,fe=null,qe=Me(k,pt,B-Wt,B+Kt,0,Ot.minX,Ot.maxX,ut),me=Me(k,pt,B+Le,B+ae,0,Ot.minX,Ot.maxX,ut);k=null,qe&&(pe=Me(qe,pt,W-Wt,W+Kt,1,Ot.minY,Ot.maxY,ut),xt=Me(qe,pt,W+Le,W+ae,1,Ot.minY,Ot.maxY,ut),qe=null),me&&(ve=Me(me,pt,W-Wt,W+Kt,1,Ot.minY,Ot.maxY,ut),fe=Me(me,pt,W+Le,W+ae,1,Ot.minY,Ot.maxY,ut),me=null),ht>1&&console.timeEnd("clipping"),rt.push(pe||[],R+1,2*B,2*W),rt.push(xt||[],R+1,2*B,2*W+1),rt.push(ve||[],R+1,2*B+1,2*W),rt.push(fe||[],R+1,2*B+1,2*W+1)}}getTile(k,R,B){k=+k,R=+R,B=+B;const W=this.options,{extent:X,debug:nt}=W;if(k<0||k>24)return null;const U=1<<k,rt=Hn(k,R=R+U&U-1,B);if(this.tiles[rt])return gn(this.tiles[rt],X);nt>1&&console.log("drilling down to z%d-%d-%d",k,R,B);let ut,ht=k,pt=R,Et=B;for(;!ut&&ht>0;)ht--,pt>>=1,Et>>=1,ut=this.tiles[Hn(ht,pt,Et)];return ut&&ut.source?(nt>1&&(console.log("found parent tile z%d-%d-%d",ht,pt,Et),console.time("drilling down")),this.splitTile(ut.source,ht,pt,Et,k,R,B),nt>1&&console.timeEnd("drilling down"),this.tiles[rt]?gn(this.tiles[rt],X):null):null}}function Hn(tt,k,R){return 32*((1<<tt)*R+k)+tt}class yn extends Pr{constructor(k,R,B,W=er){super(k,R,B),this._dataUpdateable=new Map,this._createGeoJSONIndex=W}loadVectorTile(k,R){return A._(this,void 0,void 0,function*(){const B=k.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const W=this._geoJSONIndex.getTile(B.z,B.x,B.y);return W?Ci(new Nr(W.features,{version:2,extent:A.a4})):null})}loadData(k){return A._(this,void 0,void 0,function*(){var R;(R=this._pendingRequest)===null||R===void 0||R.abort();const B=this._startPerformance(k);this._pendingRequest=new AbortController;try{(!this._pendingData||k.request||k.data||k.dataDiff)&&(this._pendingData=this.loadAndProcessGeoJSON(k,this._pendingRequest));const W=yield this._pendingData;this._geoJSONIndex=this._createGeoJSONIndex(W,k),this.loaded={};const X=k.dataDiff&&A.a6(W)?{applyDiff:!0}:{data:W};return this._finishPerformance(B,k,X),X}catch(W){if(delete this._pendingRequest,A.cH(W))return{abandoned:!0};throw W}})}_startPerformance(k){var R;if(!((R=k?.request)===null||R===void 0)&&R.collectResourceTiming)return new A.c$(k.request)}_finishPerformance(k,R,B){if(!k)return;const W=k.finish();W&&(B.resourceTiming={},B.resourceTiming[R.source]=JSON.parse(JSON.stringify(W)))}getData(){return A._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(k){const R=this.loaded;return R&&R[k.uid]?super.reloadTile(k):this.loadTile(k)}loadAndProcessGeoJSON(k,R){return A._(this,void 0,void 0,function*(){let B;if(k.request?B=yield this.loadGeoJSONFromUrl(k.request,k.promoteId,R):k.data?B=this._loadGeoJSONFromObject(k.data,k.promoteId):k.dataDiff&&(B=this._loadGeoJSONFromDiff(k.dataDiff,k.promoteId,k.source)),delete this._pendingRequest,typeof B!="object")throw new Error(`Input data given to '${k.source}' is not a valid GeoJSON object.`);return Ps(B,!0),k.filter&&(B=this._filterGeoJSON(B,k.filter)),B})}loadGeoJSONFromUrl(k,R,B){return A._(this,void 0,void 0,function*(){const W=yield A.j(k,B);return this._dataUpdateable=A.a6(W.data,R)?A.a7(W.data,R):void 0,W.data})}_loadGeoJSONFromObject(k,R){return this._dataUpdateable=A.a6(k,R)?A.a7(k,R):void 0,k}_loadGeoJSONFromDiff(k,R,B){if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${B}`);A.a8(this._dataUpdateable,k,R);const W=Array.from(this._dataUpdateable.values());return this._toFeatureCollection(W)}_filterGeoJSON(k,R){const B=A.d3(R,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(B.result==="error")throw new Error(B.value.map(X=>`${X.key}: ${X.message}`).join(", "));const W=k.features.filter(X=>B.value.evaluate({zoom:0},X));return this._toFeatureCollection(W)}_toFeatureCollection(k){return{type:"FeatureCollection",features:k}}removeSource(k){return A._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(k){return this._geoJSONIndex.getClusterExpansionZoom(k.clusterId)}getClusterChildren(k){return this._geoJSONIndex.getChildren(k.clusterId)}getClusterLeaves(k){return this._geoJSONIndex.getLeaves(k.clusterId,k.limit,k.offset)}}function er(tt,k){return k.cluster?new ba(function({superclusterOptions:R,clusterProperties:B}){if(!B||!R)return R;const W={},X={},nt={accumulated:null,zoom:0},U={properties:null},rt=Object.keys(B);for(const ut of rt){const[ht,pt]=B[ut],Et=A.d3(pt),Ot=A.d3(typeof ht=="string"?[ht,["accumulated"],["get",ut]]:ht);W[ut]=Et.value,X[ut]=Ot.value}return R.map=ut=>{U.properties=ut;const ht={};for(const pt of rt)ht[pt]=W[pt].evaluate(nt,U);return ht},R.reduce=(ut,ht)=>{U.properties=ht;for(const pt of rt)nt.accumulated=ut[pt],ut[pt]=X[pt].evaluate(nt,U)},R}(k)).load(tt.features):function(R,B){return new Xr(R,B)}(tt,k.geojsonVtOptions)}class Oi{constructor(k){this.self=k,this.actor=new A.L(k),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(R,B)=>{if(this.externalWorkerSourceTypes[R])throw new Error(`Worker source with name "${R}" already registered.`);this.externalWorkerSourceTypes[R]=B},this.self.addProtocol=A.cJ,this.self.removeProtocol=A.cK,this.self.registerRTLTextPlugin=R=>{A.d4.setMethods(R)},this.actor.registerMessageHandler("LDT",(R,B)=>this._getDEMWorkerSource(R,B.source).loadTile(B)),this.actor.registerMessageHandler("RDT",(R,B)=>A._(this,void 0,void 0,function*(){this._getDEMWorkerSource(R,B.source).removeTile(B)})),this.actor.registerMessageHandler("GCEZ",(R,B)=>A._(this,void 0,void 0,function*(){return this._getWorkerSource(R,B.type,B.source).getClusterExpansionZoom(B)})),this.actor.registerMessageHandler("GCC",(R,B)=>A._(this,void 0,void 0,function*(){return this._getWorkerSource(R,B.type,B.source).getClusterChildren(B)})),this.actor.registerMessageHandler("GCL",(R,B)=>A._(this,void 0,void 0,function*(){return this._getWorkerSource(R,B.type,B.source).getClusterLeaves(B)})),this.actor.registerMessageHandler("LD",(R,B)=>this._getWorkerSource(R,B.type,B.source).loadData(B)),this.actor.registerMessageHandler("GD",(R,B)=>this._getWorkerSource(R,B.type,B.source).getData()),this.actor.registerMessageHandler("LT",(R,B)=>this._getWorkerSource(R,B.type,B.source).loadTile(B)),this.actor.registerMessageHandler("RT",(R,B)=>this._getWorkerSource(R,B.type,B.source).reloadTile(B)),this.actor.registerMessageHandler("AT",(R,B)=>this._getWorkerSource(R,B.type,B.source).abortTile(B)),this.actor.registerMessageHandler("RMT",(R,B)=>this._getWorkerSource(R,B.type,B.source).removeTile(B)),this.actor.registerMessageHandler("RS",(R,B)=>A._(this,void 0,void 0,function*(){if(!this.workerSources[R]||!this.workerSources[R][B.type]||!this.workerSources[R][B.type][B.source])return;const W=this.workerSources[R][B.type][B.source];delete this.workerSources[R][B.type][B.source],W.removeSource!==void 0&&W.removeSource(B)})),this.actor.registerMessageHandler("RM",R=>A._(this,void 0,void 0,function*(){delete this.layerIndexes[R],delete this.availableImages[R],delete this.workerSources[R],delete this.demWorkerSources[R],this.globalStates.delete(R)})),this.actor.registerMessageHandler("SR",(R,B)=>A._(this,void 0,void 0,function*(){this.referrer=B})),this.actor.registerMessageHandler("SRPS",(R,B)=>this._syncRTLPluginState(R,B)),this.actor.registerMessageHandler("IS",(R,B)=>A._(this,void 0,void 0,function*(){this.self.importScripts(B)})),this.actor.registerMessageHandler("SI",(R,B)=>this._setImages(R,B)),this.actor.registerMessageHandler("UL",(R,B)=>A._(this,void 0,void 0,function*(){this._getLayerIndex(R).update(B.layers,B.removedIds,this._getGlobalState(R))})),this.actor.registerMessageHandler("UGS",(R,B)=>A._(this,void 0,void 0,function*(){const W=this._getGlobalState(R);for(const X in B)W[X]=B[X]})),this.actor.registerMessageHandler("SL",(R,B)=>A._(this,void 0,void 0,function*(){this._getLayerIndex(R).replace(B,this._getGlobalState(R))}))}_getGlobalState(k){let R=this.globalStates.get(k);return R||(R={},this.globalStates.set(k,R)),R}_setImages(k,R){return A._(this,void 0,void 0,function*(){this.availableImages[k]=R;for(const B in this.workerSources[k]){const W=this.workerSources[k][B];for(const X in W)W[X].availableImages=R}})}_syncRTLPluginState(k,R){return A._(this,void 0,void 0,function*(){return yield A.d4.syncState(R,this.self.importScripts)})}_getAvailableImages(k){let R=this.availableImages[k];return R||(R=[]),R}_getLayerIndex(k){let R=this.layerIndexes[k];return R||(R=this.layerIndexes[k]=new h),R}_getWorkerSource(k,R,B){if(this.workerSources[k]||(this.workerSources[k]={}),this.workerSources[k][R]||(this.workerSources[k][R]={}),!this.workerSources[k][R][B]){const W={sendAsync:(X,nt)=>(X.targetMapId=k,this.actor.sendAsync(X,nt))};switch(R){case"vector":this.workerSources[k][R][B]=new Pr(W,this._getLayerIndex(k),this._getAvailableImages(k));break;case"geojson":this.workerSources[k][R][B]=new yn(W,this._getLayerIndex(k),this._getAvailableImages(k));break;default:this.workerSources[k][R][B]=new this.externalWorkerSourceTypes[R](W,this._getLayerIndex(k),this._getAvailableImages(k))}}return this.workerSources[k][R][B]}_getDEMWorkerSource(k,R){return this.demWorkerSources[k]||(this.demWorkerSources[k]={}),this.demWorkerSources[k][R]||(this.demWorkerSources[k][R]=new Ur),this.demWorkerSources[k][R]}}return A.i(self)&&(self.worker=new Oi(self)),Oi}),Ut("index",["exports","./shared"],function(A,h){var Pt="5.13.0";function ke(){var d=new h.A(4);return h.A!=Float32Array&&(d[1]=0,d[2]=0),d[0]=1,d[3]=1,d}let Ve,Ki,Nr;const Qe={frame(d,e,n){const o=requestAnimationFrame(p=>{c(),e(p)}),{unsubscribe:c}=h.s(d.signal,"abort",()=>{c(),cancelAnimationFrame(o),n(h.c())},!1)},frameAsync(d){return new Promise((e,n)=>{this.frame(d,e,n)})},getImageData(d,e=0){return this.getImageCanvasContext(d).getImageData(-e,-e,d.width+2*e,d.height+2*e)},getImageCanvasContext(d){const e=window.document.createElement("canvas"),n=e.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return e.width=d.width,e.height=d.height,n.drawImage(d,0,0,d.width,d.height),n},resolveURL:d=>(Ve||(Ve=document.createElement("a")),Ve.href=d,Ve.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return Nr!==void 0?Nr:!!matchMedia&&(Ki==null&&(Ki=matchMedia("(prefers-reduced-motion: reduce)")),Ki.matches)},set prefersReducedMotion(d){Nr=d}},jr=new class{constructor(){this._realTime=typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),this._frozenAt=null}getCurrentTime(){return this._frozenAt!==null?this._frozenAt:this._realTime()}setNow(d){this._frozenAt=d}restoreNow(){this._frozenAt=null}isFrozen(){return this._frozenAt!==null}};function ne(){return jr.getCurrentTime()}class dt{static testProp(e){if(!dt.docStyle)return e[0];for(let n=0;n<e.length;n++)if(e[n]in dt.docStyle)return e[n];return e[0]}static create(e,n,o){const c=window.document.createElement(e);return n!==void 0&&(c.className=n),o&&o.appendChild(c),c}static createNS(e,n){return window.document.createElementNS(e,n)}static disableDrag(){dt.docStyle&&dt.selectProp&&(dt.userSelect=dt.docStyle[dt.selectProp],dt.docStyle[dt.selectProp]="none")}static enableDrag(){dt.docStyle&&dt.selectProp&&(dt.docStyle[dt.selectProp]=dt.userSelect)}static setTransform(e,n){e.style[dt.transformProp]=n}static addEventListener(e,n,o,c={}){e.addEventListener(n,o,"passive"in c?c:c.capture)}static removeEventListener(e,n,o,c={}){e.removeEventListener(n,o,"passive"in c?c:c.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",dt.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",dt.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",dt.suppressClickInternal,!0)},0)}static getScale(e){const n=e.getBoundingClientRect();return{x:n.width/e.offsetWidth||1,y:n.height/e.offsetHeight||1,boundingClientRect:n}}static getPoint(e,n,o){const c=n.boundingClientRect;return new h.P((o.clientX-c.left)/n.x-e.clientLeft,(o.clientY-c.top)/n.y-e.clientTop)}static mousePos(e,n){const o=dt.getScale(e);return dt.getPoint(e,o,n)}static touchPos(e,n){const o=[],c=dt.getScale(e);for(let p=0;p<n.length;p++)o.push(dt.getPoint(e,c,n[p]));return o}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}static sanitize(e){const n=new DOMParser().parseFromString(e,"text/html").body||document.createElement("body"),o=n.querySelectorAll("script");for(const c of o)c.remove();return dt.clean(n),n.innerHTML}static isPossiblyDangerous(e,n){const o=n.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!o.includes("javascript:")&&!o.includes("data:"))||!!e.startsWith("on")||void 0}static clean(e){const n=e.children;for(const o of n)dt.removeAttributes(o),dt.clean(o)}static removeAttributes(e){for(const{name:n,value:o}of e.attributes)dt.isPossiblyDangerous(n,o)&&e.removeAttribute(n)}}dt.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,dt.selectProp=dt.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),dt.transformProp=dt.testProp(["transform","WebkitTransform"]);const hn={supported:!1,testSupport:function(d){!Un&&Pe&&(Gn?Ss(d):Re=d)}};let Re,Pe,Un=!1,Gn=!1;function Ss(d){const e=d.createTexture();d.bindTexture(d.TEXTURE_2D,e);try{if(d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,Pe),d.isContextLost())return;hn.supported=!0}catch{}d.deleteTexture(e),Un=!0}var Ci;typeof document<"u"&&(Pe=document.createElement("img"),Pe.onload=()=>{Re&&Ss(Re),Re=null,Gn=!0},Pe.onerror=()=>{Un=!0,Re=null},Pe.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(d){let e,n,o,c;d.resetRequestQueue=()=>{e=[],n=0,o=0,c={}},d.addThrottleControl=x=>{const b=o++;return c[b]=x,b},d.removeThrottleControl=x=>{delete c[x],m()},d.getImage=(x,b,T=!0)=>new Promise((E,I)=>{hn.supported&&(x.headers||(x.headers={}),x.headers.accept="image/webp,*/*"),h.e(x,{type:"image"}),e.push({abortController:b,requestParameters:x,supportImageRefresh:T,state:"queued",onError:D=>{I(D)},onSuccess:D=>{E(D)}}),m()});const p=x=>h._(this,void 0,void 0,function*(){x.state="running";const{requestParameters:b,supportImageRefresh:T,onError:E,onSuccess:I,abortController:D}=x,L=T===!1&&!h.i(self)&&!h.g(b.url)&&(!b.headers||Object.keys(b.headers).reduce((G,q)=>G&&q==="accept",!0));n++;const V=L?_(b,D):h.m(b,D);try{const G=yield V;delete x.abortController,x.state="completed",G.data instanceof HTMLImageElement||h.b(G.data)?I(G):G.data&&I({data:yield(N=G.data,typeof createImageBitmap=="function"?h.f(N):h.h(N)),cacheControl:G.cacheControl,expires:G.expires})}catch(G){delete x.abortController,E(G)}finally{n--,m()}var N}),m=()=>{const x=(()=>{for(const b of Object.keys(c))if(c[b]())return!0;return!1})()?h.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:h.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let b=n;b<x&&e.length>0;b++){const T=e.shift();T.abortController.signal.aborted?b--:p(T)}},_=(x,b)=>new Promise((T,E)=>{const I=new Image,D=x.url,L=x.credentials;L&&L==="include"?I.crossOrigin="use-credentials":(L&&L==="same-origin"||!h.d(D))&&(I.crossOrigin="anonymous"),b.signal.addEventListener("abort",()=>{I.src="",E(h.c())}),I.fetchPriority="high",I.onload=()=>{I.onerror=I.onload=null,T({data:I})},I.onerror=()=>{I.onerror=I.onload=null,b.signal.aborted||E(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."))},I.src=D})}(Ci||(Ci={})),Ci.resetRequestQueue();class va{constructor(e){this._transformRequestFn=e??null}transformRequest(e,n){return this._transformRequestFn&&this._transformRequestFn(e,n)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function Pr(d){const e=[];if(typeof d=="string")e.push({id:"default",url:d});else if(d&&d.length>0){const n=[];for(const{id:o,url:c}of d){const p=`${o}${c}`;n.indexOf(p)===-1&&(n.push(p),e.push({id:o,url:c}))}}return e}function Ur(d,e,n){try{const o=new URL(d);return o.pathname+=`${e}${n}`,o.toString()}catch{throw new Error(`Invalid sprite URL "${d}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}function dn(d){const{userImage:e}=d;return!!(e&&e.render&&e.render())&&(d.data.replace(new Uint8Array(e.data.buffer)),!0)}class Gr 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}destroy(){this.atlasTexture&&(this.atlasTexture.destroy(),this.atlasTexture=null);for(const e of Object.keys(this.images))this.removeImage(e);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:n,promiseResolve:o}of this.requestors)o(this._getImagesForIds(n));this.requestors=[]}}getImage(e){const n=this.images[e];if(n&&!n.data&&n.spriteData){const o=n.spriteData;n.data=new h.R({width:o.width,height:o.height},o.context.getImageData(o.x,o.y,o.width,o.height).data),n.spriteData=null}return n}addImage(e,n){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,n)&&(this.images[e]=n)}_validate(e,n){let o=!0;const c=n.data||n.spriteData;return this._validateStretch(n.stretchX,c&&c.width)||(this.fire(new h.k(new Error(`Image "${e}" has invalid "stretchX" value`))),o=!1),this._validateStretch(n.stretchY,c&&c.height)||(this.fire(new h.k(new Error(`Image "${e}" has invalid "stretchY" value`))),o=!1),this._validateContent(n.content,n)||(this.fire(new h.k(new Error(`Image "${e}" has invalid "content" value`))),o=!1),o}_validateStretch(e,n){if(!e)return!0;let o=0;for(const c of e){if(c[0]<o||c[1]<c[0]||n<c[1])return!1;o=c[1]}return!0}_validateContent(e,n){if(!e)return!0;if(e.length!==4)return!1;const o=n.spriteData,c=o&&o.width||n.data.width,p=o&&o.height||n.data.height;return!(e[0]<0||c<e[0]||e[1]<0||p<e[1]||e[2]<0||c<e[2]||e[3]<0||p<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,n,o=!0){const c=this.getImage(e);if(o&&(c.data.width!==n.data.width||c.data.height!==n.data.height))throw new Error(`size mismatch between old image (${c.data.width}x${c.data.height}) and new image (${n.data.width}x${n.data.height}).`);n.version=c.version+1,this.images[e]=n,this.updatedImages[e]=!0}removeImage(e){const n=this.images[e];delete this.images[e],delete this.patterns[e],n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise((n,o)=>{let c=!0;if(!this.isLoaded())for(const p of e)this.images[p]||(c=!1);this.isLoaded()||c?n(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:n})})}_getImagesForIds(e){const n={};for(const o of e){let c=this.getImage(o);c||(this.fire(new h.l("styleimagemissing",{id:o})),c=this.getImage(o)),c?n[o]={data:c.data.clone(),pixelRatio:c.pixelRatio,sdf:c.sdf,version:c.version,stretchX:c.stretchX,stretchY:c.stretchY,content:c.content,textFitWidth:c.textFitWidth,textFitHeight:c.textFitHeight,hasRenderCallback:!!(c.userImage&&c.userImage.render)}:h.w(`Image "${o}" 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 n}getPixelSize(){const{width:e,height:n}=this.atlasImage;return{width:e,height:n}}getPattern(e){const n=this.patterns[e],o=this.getImage(e);if(!o)return null;if(n&&n.position.version===o.version)return n.position;if(n)n.position.version=o.version;else{const c={w:o.data.width+2,h:o.data.height+2,x:0,y:0},p=new h.I(c,o);this.patterns[e]={bin:c,position:p}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){const n=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new h.T(e,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const p in this.patterns)e.push(this.patterns[p].bin);const{w:n,h:o}=h.p(e),c=this.atlasImage;c.resize({width:n||1,height:o||1});for(const p in this.patterns){const{bin:m}=this.patterns[p],_=m.x+1,x=m.y+1,b=this.getImage(p).data,T=b.width,E=b.height;h.R.copy(b,c,{x:0,y:0},{x:_,y:x},{width:T,height:E}),h.R.copy(b,c,{x:0,y:E-1},{x:_,y:x-1},{width:T,height:1}),h.R.copy(b,c,{x:0,y:0},{x:_,y:x+E},{width:T,height:1}),h.R.copy(b,c,{x:T-1,y:0},{x:_-1,y:x},{width:1,height:E}),h.R.copy(b,c,{x:0,y:0},{x:_+T,y:x},{width:1,height:E})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(const n of e){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const o=this.getImage(n);o||h.w(`Image with ID: "${n}" was not found`),dn(o)&&this.updateImage(n,o)}}cloneImages(){const e={};for(const n in this.images){const o=this.images[n];e[n]=Object.assign(Object.assign({},o),{data:o.data?o.data.clone():null})}return e}}const pn=1e20;function Ps(d,e,n,o,c,p,m,_,x){for(let b=e;b<e+o;b++)Ms(d,n*p+b,p,c,m,_,x);for(let b=n;b<n+c;b++)Ms(d,b*p+e,1,o,m,_,x)}function Ms(d,e,n,o,c,p,m){p[0]=0,m[0]=-pn,m[1]=pn,c[0]=d[e];for(let _=1,x=0,b=0;_<o;_++){c[_]=d[e+_*n];const T=_*_;do{const E=p[x];b=(c[_]-c[E]+T-E*E)/(_-E)/2}while(b<=m[x]&&--x>-1);x++,p[x]=_,m[x]=b,m[x+1]=pn}for(let _=0,x=0;_<o;_++){for(;m[x+1]<_;)x++;const b=p[x],T=_-b;d[e+_*n]=c[b]+T*T}}const Is=h.v.layout_symbol["text-font"].default.join(",");class Ji{constructor(e,n,o){this.requestManager=e,this.localIdeographFontFamily=n,this.entries={},this.lang=o}setURL(e){this.url=e}getGlyphs(e){return h._(this,void 0,void 0,function*(){const n=[];for(const p in e)for(const m of e[p])n.push(this._getAndCacheGlyphsPromise(p,m));const o=yield Promise.all(n),c={};for(const{stack:p,id:m,glyph:_}of o)c[p]||(c[p]={}),c[p][m]=_&&{id:_.id,bitmap:_.bitmap.clone(),metrics:_.metrics};return c})}_getAndCacheGlyphsPromise(e,n){return h._(this,void 0,void 0,function*(){let o=this.entries[e];o||(o=this.entries[e]={glyphs:{},requests:{},ranges:{}});let c=o.glyphs[n];return c!==void 0?{stack:e,id:n,glyph:c}:!this.url||this._charUsesLocalIdeographFontFamily(n)?(c=o.glyphs[n]=this._drawGlyph(o,e,n),{stack:e,id:n,glyph:c}):yield this._downloadAndCacheRangePromise(e,n)})}_downloadAndCacheRangePromise(e,n){return h._(this,void 0,void 0,function*(){const o=this.entries[e],c=Math.floor(n/256);if(o.ranges[c])return{stack:e,id:n,glyph:null};if(!o.requests[c]){const p=Ji.loadGlyphRange(e,c,this.url,this.requestManager);o.requests[c]=p}try{const p=yield o.requests[c];for(const m in p)o.glyphs[+m]=p[+m];return o.ranges[c]=!0,{stack:e,id:n,glyph:p[n]||null}}catch(p){const m=o.glyphs[n]=this._drawGlyph(o,e,n);return this._warnOnMissingGlyphRange(m,c,n,p),{stack:e,id:n,glyph:m}}})}_warnOnMissingGlyphRange(e,n,o,c){const p=256*n,m=p+255,_=o.toString(16).padStart(4,"0").toUpperCase();h.w(`Unable to load glyph range ${n}, ${p}-${m}. Rendering codepoint U+${_} locally instead. ${c}`)}_charUsesLocalIdeographFontFamily(e){return!!this.localIdeographFontFamily&&h.q(e)}_drawGlyph(e,n,o){const c=n===Is&&this.localIdeographFontFamily!==""&&this._charUsesLocalIdeographFontFamily(o),p=c?"ideographTinySDF":"tinySDF";e[p]||(e[p]=this._createTinySDF(c?this.localIdeographFontFamily:n));const m=e[p].draw(String.fromCodePoint(o));return{id:o,bitmap:new h.r({width:m.width||60,height:m.height||60},m.data),metrics:{width:m.glyphWidth/2||24,height:m.glyphHeight/2||24,left:m.glyphLeft/2+.5||0,top:m.glyphTop/2-27.5||-8,advance:m.glyphAdvance/2||24,isDoubleResolution:!0}}}_createTinySDF(e){const n=e?e.split(","):[];n.push("sans-serif");const o=n.map(c=>/[-\w]+/.test(c)?c:`'${CSS.escape(c)}'`).join(",");return new Ji.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:o,fontWeight:this._fontWeight(n[0]),fontStyle:this._fontStyle(n[0]),lang:this.lang})}_fontStyle(e){return/italic/i.test(e)?"italic":/oblique/i.test(e)?"oblique":"normal"}_fontWeight(e){const n={thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950};let o;for(const[c,p]of Object.entries(n))new RegExp(`\\b${c}\\b`,"i").test(e)&&(o=`${p}`);return o}destroy(){for(const e in this.entries){const n=this.entries[e];n.tinySDF&&(n.tinySDF=null),n.ideographTinySDF&&(n.ideographTinySDF=null),n.glyphs={},n.requests={},n.ranges={}}this.entries={}}}Ji.loadGlyphRange=function(d,e,n,o){return h._(this,void 0,void 0,function*(){const c=256*e,p=c+255,m=o.transformRequest(n.replace("{fontstack}",d).replace("{range}",`${c}-${p}`),"Glyphs"),_=yield h.n(m,new AbortController);if(!_||!_.data)throw new Error(`Could not load glyph range. range: ${e}, ${c}-${p}`);const x={};for(const b of h.o(_.data))x[b.id]=b;return x})},Ji.TinySDF=class{constructor({fontSize:d=24,buffer:e=3,radius:n=8,cutoff:o=.25,fontFamily:c="sans-serif",fontWeight:p="normal",fontStyle:m="normal",lang:_=null}={}){this.buffer=e,this.cutoff=o,this.radius=n,this.lang=_;const x=this.size=d+4*e,b=this._createCanvas(x),T=this.ctx=b.getContext("2d",{willReadFrequently:!0});T.font=`${m} ${p} ${d}px ${c}`,T.textBaseline="alphabetic",T.textAlign="left",T.fillStyle="black",this.gridOuter=new Float64Array(x*x),this.gridInner=new Float64Array(x*x),this.f=new Float64Array(x),this.z=new Float64Array(x+1),this.v=new Uint16Array(x)}_createCanvas(d){const e=document.createElement("canvas");return e.width=e.height=d,e}draw(d){const{width:e,actualBoundingBoxAscent:n,actualBoundingBoxDescent:o,actualBoundingBoxLeft:c,actualBoundingBoxRight:p}=this.ctx.measureText(d),m=Math.ceil(n),_=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(p-c))),x=Math.min(this.size-this.buffer,m+Math.ceil(o)),b=_+2*this.buffer,T=x+2*this.buffer,E=Math.max(b*T,0),I=new Uint8ClampedArray(E),D={data:I,width:b,height:T,glyphWidth:_,glyphHeight:x,glyphTop:m,glyphLeft:0,glyphAdvance:e};if(_===0||x===0)return D;const{ctx:L,buffer:V,gridInner:N,gridOuter:G}=this;this.lang&&(L.lang=this.lang),L.clearRect(V,V,_,x),L.fillText(d,V,V+m);const q=L.getImageData(V,V,_,x);G.fill(pn,0,E),N.fill(0,0,E);for(let Y=0;Y<x;Y++)for(let $=0;$<_;$++){const K=q.data[4*(Y*_+$)+3]/255;if(K===0)continue;const J=(Y+V)*b+$+V;if(K===1)G[J]=0,N[J]=pn;else{const H=.5-K;G[J]=H>0?H*H:0,N[J]=H<0?H*H:0}}Ps(G,0,0,b,T,b,this.f,this.v,this.z),Ps(N,V,V,_,x,b,this.f,this.v,this.z);for(let Y=0;Y<E;Y++){const $=Math.sqrt(G[Y])-Math.sqrt(N[Y]);I[Y]=Math.round(255-255*($/this.radius+this.cutoff))}return D}};class ba{constructor(){this.specification=h.u.light.position}possiblyEvaluate(e,n){return h.F(e.expression.evaluate(n))}interpolate(e,n,o){return{x:h.G.number(e.x,n.x,o),y:h.G.number(e.y,n.y,o),z:h.G.number(e.z,n.z,o)}}}let le;class Zn extends h.E{constructor(e){super(),le=le||new h.t({anchor:new h.D(h.u.light.anchor),position:new ba,color:new h.D(h.u.light.color),intensity:new h.D(h.u.light.intensity)}),this._transitionable=new h.x(le,void 0),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,n={}){if(!this._validate(h.y,e,n))for(const o in e){const c=e[o];o.endsWith(h.z)?this._transitionable.setTransition(o.slice(0,-h.z.length),c):this._transitionable.setValue(o,c)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,n,o){return(!o||o.validate!==!1)&&h.B(this,e.call(h.C,{value:n,style:{glyphs:!0,sprite:!0},styleSpec:h.u}))}}const hr=new h.t({"sky-color":new h.D(h.u.sky["sky-color"]),"horizon-color":new h.D(h.u.sky["horizon-color"]),"fog-color":new h.D(h.u.sky["fog-color"]),"fog-ground-blend":new h.D(h.u.sky["fog-ground-blend"]),"horizon-fog-blend":new h.D(h.u.sky["horizon-fog-blend"]),"sky-horizon-blend":new h.D(h.u.sky["sky-horizon-blend"]),"atmosphere-blend":new h.D(h.u.sky["atmosphere-blend"])});class fn extends h.E{constructor(e){super(),this._transitionable=new h.x(hr,void 0),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new h.H(0))}setSky(e,n={}){if(!this._validate(h.J,e,n)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const o in e){const c=e[o];o.endsWith(h.z)?this._transitionable.setTransition(o.slice(0,-h.z.length),c):this._transitionable.setValue(o,c)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,n,o={}){return o?.validate!==!1&&h.B(this,e.call(h.C,h.e({value:n,style:{glyphs:!0,sprite:!0},styleSpec:h.u})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class wa{constructor(e,n){this.width=e,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,n){const o=e.join(",")+String(n);return this.dashEntry[o]||(this.dashEntry[o]=this.addDash(e,n)),this.dashEntry[o]}getDashRanges(e,n,o){const c=[];let p=e.length%2==1?-e[e.length-1]*o:0,m=e[0]*o,_=!0;c.push({left:p,right:m,isDash:_,zeroLength:e[0]===0});let x=e[0];for(let b=1;b<e.length;b++){_=!_;const T=e[b];p=x*o,x+=T,m=x*o,c.push({left:p,right:m,isDash:_,zeroLength:T===0})}return c}addRoundDash(e,n,o){const c=n/2;for(let p=-o;p<=o;p++){const m=this.width*(this.nextRow+o+p);let _=0,x=e[_];for(let b=0;b<this.width;b++){b/x.right>1&&(x=e[++_]);const T=Math.abs(b-x.left),E=Math.abs(b-x.right),I=Math.min(T,E);let D;const L=p/o*(c+1);if(x.isDash){const V=c-Math.abs(L);D=Math.sqrt(I*I+V*V)}else D=c-Math.sqrt(I*I+L*L);this.data[m+b]=Math.max(0,Math.min(255,D+128))}}}addRegularDash(e){for(let _=e.length-1;_>=0;--_){const x=e[_],b=e[_+1];x.zeroLength?e.splice(_,1):b&&b.isDash===x.isDash&&(b.left=x.left,e.splice(_,1))}const n=e[0],o=e[e.length-1];n.isDash===o.isDash&&(n.left=o.left-this.width,o.right=n.right+this.width);const c=this.width*this.nextRow;let p=0,m=e[p];for(let _=0;_<this.width;_++){_/m.right>1&&(m=e[++p]);const x=Math.abs(_-m.left),b=Math.abs(_-m.right),T=Math.min(x,b);this.data[c+_]=Math.max(0,Math.min(255,(m.isDash?T:-T)+128))}}addDash(e,n){const o=n?7:0,c=2*o+1;if(this.nextRow+c>this.height)return h.w("LineAtlas out of space"),null;let p=0;for(let _=0;_<e.length;_++)p+=e[_];if(p!==0){const _=this.width/p,x=this.getDashRanges(e,this.width,_);n?this.addRoundDash(x,_,o):this.addRegularDash(x)}const m={y:this.nextRow+o,height:2*o,width:p};return this.nextRow+=c,this.dirty=!0,m}bind(e){const n=e.gl;this.texture?(n.bindTexture(n.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,n.texSubImage2D(n.TEXTURE_2D,0,0,0,this.width,this.height,n.ALPHA,n.UNSIGNED_BYTE,this.data))):(this.texture=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texImage2D(n.TEXTURE_2D,0,n.ALPHA,this.width,this.height,0,n.ALPHA,n.UNSIGNED_BYTE,this.data))}}const Zr="maplibre_preloaded_worker_pool";class $r{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<$r.workerCount;)this.workers.push(new Worker(h.a.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach(n=>{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Zr]}numActive(){return Object.keys(this.active).length}}const wi=Math.floor(Qe.hardwareConcurrency/2);let Qi,di;function $n(){return Qi||(Qi=new $r),Qi}$r.workerCount=h.K(globalThis)?Math.max(Math.min(wi,3),1):1;class qr{constructor(e,n){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=n;const o=this.workerPool.acquire(n);for(let c=0;c<o.length;c++){const p=new h.L(o[c],n);p.name=`Worker ${c}`,this.actors.push(p)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,n){const o=[];for(const c of this.actors)o.push(c.sendAsync({type:e,data:n}));return Promise.all(o)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach(n=>{n.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,n){for(const o of this.actors)o.registerMessageHandler(e,n)}unregisterMessageHandler(e){for(const n of this.actors)n.unregisterMessageHandler(e)}}function mn(){return di||(di=new qr($n(),h.M),di.registerMessageHandler("GR",(d,e,n)=>h.m(e,n))),di}function Zi(d,e){const n=h.N();return h.O(n,n,[1,1,0]),h.Q(n,n,[.5*d.width,.5*d.height,1]),d.calculatePosMatrix?h.S(n,n,d.calculatePosMatrix(e.toUnwrapped())):n}function Es(d,e,n,o,c,p,m){var _;const x=function(I,D,L){if(I)for(const V of I){const N=D[V];if(N&&N.source===L&&N.type==="fill-extrusion")return!0}else for(const V in D){const N=D[V];if(N.source===L&&N.type==="fill-extrusion")return!0}return!1}((_=c?.layers)!==null&&_!==void 0?_:null,e,d.id),b=p.maxPitchScaleFactor(),T=d.tilesIn(o,b,x);T.sort(Me);const E=[];for(const I of T)E.push({wrappedTileID:I.tileID.wrapped().key,queryResults:I.tile.queryRenderedFeatures(e,n,d.getState(),I.queryGeometry,I.cameraQueryGeometry,I.scale,c,p,b,Zi(p,I.tileID),m?(D,L)=>m(I.tileID,D,L):void 0)});return function(I,D){for(const L in I)for(const V of I[L])tr(V,D);return I}(function(I){const D={},L={};for(const V of I){const N=V.queryResults,G=V.wrappedTileID,q=L[G]=L[G]||{};for(const Y in N){const $=N[Y],K=q[Y]=q[Y]||{},J=D[Y]=D[Y]||[];for(const H of $)K[H.featureIndex]||(K[H.featureIndex]=!0,J.push(H))}}return D}(E),d)}function Me(d,e){const n=d.tileID,o=e.tileID;return n.overscaledZ-o.overscaledZ||n.canonical.y-o.canonical.y||n.wrap-o.wrap||n.canonical.x-o.canonical.x}function tr(d,e){const n=d.feature,o=e.getFeatureState(n.layer["source-layer"],n.id);n.source=n.layer.source,n.layer["source-layer"]&&(n.sourceLayer=n.layer["source-layer"]),n.state=o}function dr(d,e,n){return h._(this,void 0,void 0,function*(){let o=d;if(d.url?o=(yield h.j(e.transformRequest(d.url,"Source"),n)).data:yield Qe.frameAsync(n),!o)return null;const c=h.U(h.e(o,d),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in o&&o.vector_layers&&(c.vectorLayerIds=o.vector_layers.map(p=>p.id)),c})}class Ie{constructor(e,n){e&&(n?this.setSouthWest(e).setNorthEast(n):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.V?new h.V(e.lng,e.lat):h.V.convert(e),this}setSouthWest(e){return this._sw=e instanceof h.V?new h.V(e.lng,e.lat):h.V.convert(e),this}extend(e){const n=this._sw,o=this._ne;let c,p;if(e instanceof h.V)c=e,p=e;else{if(!(e instanceof Ie))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(Ie.convert(e)):this.extend(h.V.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(h.V.convert(e)):this;if(c=e._sw,p=e._ne,!c||!p)return this}return n||o?(n.lng=Math.min(c.lng,n.lng),n.lat=Math.min(c.lat,n.lat),o.lng=Math.max(p.lng,o.lng),o.lat=Math.max(p.lat,o.lat)):(this._sw=new h.V(c.lng,c.lat),this._ne=new h.V(p.lng,p.lat)),this}getCenter(){return new h.V((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.V(this.getWest(),this.getNorth())}getSouthEast(){return new h.V(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:n,lat:o}=h.V.convert(e);let c=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(c=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=o&&o<=this._ne.lat&&c}intersects(e){if((e=Ie.convert(e)).getNorth()<this.getSouth()||e.getSouth()>this.getNorth())return!1;const n=h.W(this.getWest(),-180,180),o=h.W(this.getEast(),-180,180),c=h.W(e.getWest(),-180,180),p=h.W(e.getEast(),-180,180),m=n>o,_=c>p;return!(!m||!_)||(m?p>=n||c<=o:_?o>=c||n<=p:!(c>o||p<n))}static convert(e){return e instanceof Ie?e:e&&new Ie(e)}static fromLngLat(e,n=0){const o=360*n/40075017,c=o/Math.cos(Math.PI/180*e.lat);return new Ie(new h.V(e.lng-c,e.lat-o),new h.V(e.lng+c,e.lat+o))}adjustAntiMeridian(){const e=new h.V(this._sw.lng,this._sw.lat),n=new h.V(this._ne.lng,this._ne.lat);return new Ie(e,e.lng>n.lng?new h.V(n.lng+360,n.lat):n)}}class pr{constructor(e,n,o){this.bounds=Ie.convert(this.validateBounds(e)),this.minzoom=n||0,this.maxzoom=o||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 n=Math.pow(2,e.z),o=Math.floor(h.Y(this.bounds.getWest())*n),c=Math.floor(h.X(this.bounds.getNorth())*n),p=Math.ceil(h.Y(this.bounds.getEast())*n),m=Math.ceil(h.X(this.bounds.getSouth())*n);return e.x>=o&&e.x<p&&e.y>=c&&e.y<m}}class fr extends h.E{constructor(e,n,o,c){if(super(),this.id=e,this.dispatcher=o,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,h.e(this,h.U(n,["url","scheme","tileSize","promoteId","encoding"])),this._options=h.e({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(c)}load(){return h._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new h.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const e=yield dr(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.tileManagers[this.id].clearTiles(),e&&(h.e(this,e),e.bounds&&(this.tileBounds=new pr(e.bounds,this.minzoom,this.maxzoom)),this.fire(new h.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new h.l("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,this.fire(new h.k(e))}})}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),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}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 n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),o={request:this.map._requestManager.transformRequest(n,"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,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:this._getOverzoomParameters(e)};o.request.collectResourceTiming=this._collectResourceTiming;let c="RT";if(e.actor&&e.state!=="expired"){if(e.state==="loading")return new Promise((p,m)=>{e.reloadPromise={resolve:p,reject:m}})}else e.actor=this.dispatcher.getActor(),c="LT";e.abortController=new AbortController;try{const p=yield e.actor.sendAsync({type:c,data:o},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,p)}catch(p){if(delete e.abortController,e.aborted)return;if(p&&p.status!==404)throw p;this._afterTileLoadWorkerResponse(e,null)}})}_getOverzoomParameters(e){if(e.tileID.canonical.z<=this.maxzoom||this.map._zoomLevelsToOverscale===void 0)return;const n=e.tileID.scaledTo(this.maxzoom).canonical,o=n.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:n,overzoomRequest:this.map._requestManager.transformRequest(o,"Tile")}}_afterTileLoadWorkerResponse(e,n){if(n&&n.resourceTiming&&(e.resourceTiming=n.resourceTiming),n&&this.map._refreshExpiredTiles&&e.setExpiryData(n),e.loadVectorData(n,this.map.painter),e.reloadPromise){const o=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(o.resolve).catch(o.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 qn extends h.E{constructor(e,n,o,c){super(),this.id=e,this.dispatcher=o,this.setEventedParent(c),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"},n),h.e(this,h.U(n,["url","scheme","tileSize"]))}load(){return h._(this,arguments,void 0,function*(e=!1){this._loaded=!1,this.fire(new h.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const n=yield dr(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,n&&(h.e(this,n),n.bounds&&(this.tileBounds=new pr(n.bounds,this.minzoom,this.maxzoom)),this.fire(new h.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new h.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(n){this._tileJSONRequest=null,this._loaded=!0,this.fire(new h.k(n))}})}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(!0)}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 n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{const o=yield Ci.getImage(this.map._requestManager.transformRequest(n,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(o&&o.data){this.map._refreshExpiredTiles&&(o.cacheControl||o.expires)&&e.setExpiryData({cacheControl:o.cacheControl,expires:o.expires});const c=this.map.painter.context,p=c.gl,m=o.data;e.texture=this.map.painter.getTileTexture(m.width),e.texture?e.texture.update(m,{useMipmap:!0}):(e.texture=new h.T(c,m,p.RGBA,{useMipmap:!0}),e.texture.bind(p.LINEAR,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(o){if(delete e.abortController,e.aborted)e.state="unloaded";else if(o)throw e.state="errored",o}})}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 Wr extends qn{constructor(e,n,o,c){super(e,n,o,c),this.type="raster-dem",this.maxzoom=22,this._options=h.e({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox",this.redFactor=n.redFactor,this.greenFactor=n.greenFactor,this.blueFactor=n.blueFactor,this.baseShift=n.baseShift}loadTile(e){return h._(this,void 0,void 0,function*(){const n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),o=this.map._requestManager.transformRequest(n,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{const c=yield Ci.getImage(o,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(c&&c.data){const p=c.data;this.map._refreshExpiredTiles&&(c.cacheControl||c.expires)&&e.setExpiryData({cacheControl:c.cacheControl,expires:c.expires});const m=h.b(p)&&h.Z()?p:yield this.readImageNow(p),_={type:this.type,uid:e.uid,source:this.id,rawImageData:m,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 x=yield e.actor.sendAsync({type:"LDT",data:_});e.dem=x,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(c){if(delete e.abortController,e.aborted)e.state="unloaded";else if(c)throw e.state="errored",c}})}readImageNow(e){return h._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&h.$()){const n=e.width+2,o=e.height+2;try{return new h.R({width:n,height:o},yield h.a0(e,-1,-1,n,o))}catch{}}return Qe.getImageData(e,1)})}_getNeighboringTiles(e){const n=e.canonical,o=Math.pow(2,n.z),c=(n.x-1+o)%o,p=n.x===0?e.wrap-1:e.wrap,m=(n.x+1+o)%o,_=n.x+1===o?e.wrap+1:e.wrap,x={};return x[new h.a1(e.overscaledZ,p,n.z,c,n.y).key]={backfilled:!1},x[new h.a1(e.overscaledZ,_,n.z,m,n.y).key]={backfilled:!1},n.y>0&&(x[new h.a1(e.overscaledZ,p,n.z,c,n.y-1).key]={backfilled:!1},x[new h.a1(e.overscaledZ,e.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},x[new h.a1(e.overscaledZ,_,n.z,m,n.y-1).key]={backfilled:!1}),n.y+1<o&&(x[new h.a1(e.overscaledZ,p,n.z,c,n.y+1).key]={backfilled:!1},x[new h.a1(e.overscaledZ,e.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},x[new h.a1(e.overscaledZ,_,n.z,m,n.y+1).key]={backfilled:!1}),x}unloadTile(e){return h._(this,void 0,void 0,function*(){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&(yield e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}}))})}}function mr(d){return d.type==="GeometryCollection"?d.geometries.map(e=>e.coordinates).flat(1/0):d.coordinates.flat(1/0)}function Hr(d){const e=new Ie;let n;switch(d.type){case"FeatureCollection":n=d.features.map(o=>mr(o.geometry)).flat(1/0);break;case"Feature":n=mr(d.geometry);break;default:n=mr(d)}if(n.length==0)return e;for(let o=0;o<n.length-1;o+=2)e.extend([n[o],n[o+1]]);return e}class gn extends h.E{constructor(e,n,o,c){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:n.data},this.actor=o.getActor(),this.setEventedParent(c),this._data=typeof n.data=="string"?{url:n.data}:{geojson:n.data},this._options=h.e({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId,n.clusterMaxZoom!==void 0&&this.maxzoom<=n.clusterMaxZoom&&h.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${n.clusterMaxZoom}".`),this.workerOptions=h.e({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(n.buffer!==void 0?n.buffer:128),tolerance:this._pixelsToTileUnits(n.tolerance!==void 0?n.tolerance:.375),extent:h.a4,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:this._getClusterMaxZoom(n.clusterMaxZoom),minPoints:Math.max(2,n.clusterMinPoints||2),extent:h.a4,radius:this._pixelsToTileUnits(n.clusterRadius||50),log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}_hasPendingWorkerUpdate(){return this._pendingWorkerUpdate.data!==void 0||this._pendingWorkerUpdate.diff!==void 0||this._pendingWorkerUpdate.optionsChanged}_pixelsToTileUnits(e){return e*(h.a4/this.tileSize)}_getClusterMaxZoom(e){const n=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||e===void 0||h.w(`Integer expected for option 'clusterMaxZoom': provided value "${e}" rounded to "${n}"`),n}load(){return h._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(e){this.map=e,this.load()}setData(e,n){this._data=typeof e=="string"?{url:e}:{geojson:e},this._pendingWorkerUpdate={data:e};const o=this._updateWorkerData();return n?o:this}updateData(e,n){this._pendingWorkerUpdate.diff=h.a5(this._pendingWorkerUpdate.diff,e);const o=this._updateWorkerData();return n?o:this}getData(){return h._(this,void 0,void 0,function*(){const e=h.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:e})})}getBounds(){return h._(this,void 0,void 0,function*(){return Hr(yield this.getData())})}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=this._getClusterMaxZoom(e.clusterMaxZoom)),this._pendingWorkerUpdate.optionsChanged=!0,this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,n,o){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:n,offset:o}})}_updateWorkerData(){return h._(this,void 0,void 0,function*(){if(this._isUpdatingWorker)return;if(!this._hasPendingWorkerUpdate())return void h.w(`No pending worker updates for GeoJSONSource ${this.id}.`);const{data:e,diff:n}=this._pendingWorkerUpdate,o=h.e({type:this.type},this.workerOptions);e?(typeof e=="string"?(o.request=this.map._requestManager.transformRequest(Qe.resolveURL(e),"Source"),o.request.collectResourceTiming=this._collectResourceTiming):o.data=e,this._pendingWorkerUpdate.data=void 0):n&&(o.dataDiff=n,this._pendingWorkerUpdate.diff=void 0),this._pendingWorkerUpdate.optionsChanged=void 0,this._isUpdatingWorker=!0,this.fire(new h.l("dataloading",{dataType:"source"}));try{const c=yield this.actor.sendAsync({type:"LD",data:o});if(this._isUpdatingWorker=!1,this._removed||c.abandoned)return void this.fire(new h.l("dataabort",{dataType:"source"}));c.applyDiff?this._applyDiff(n):this._data={geojson:c.data};let p=null;c.resourceTiming&&c.resourceTiming[this.id]&&(p=c.resourceTiming[this.id].slice(0));const m={dataType:"source"};this._collectResourceTiming&&p&&p.length>0&&h.e(m,{resourceTiming:p}),this.fire(new h.l("data",Object.assign(Object.assign({},m),{sourceDataType:"metadata"}))),this.fire(new h.l("data",Object.assign(Object.assign({},m),{sourceDataType:"content",shouldReloadTileOptions:this._getShouldReloadTileOptions(n)})))}catch(c){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new h.l("dataabort",{dataType:"source"}));this.fire(new h.k(c))}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData()}})}_applyDiff(e){const n=typeof this.promoteId=="string"?this.promoteId:void 0;this._data.url||this._data.updateable||!h.a6(this._data.geojson,n)||(this._data={updateable:h.a7(this._data.geojson,n)}),e&&this._data.updateable?h.a8(this._data.updateable,e,n):h.w("Cannot apply GeoJSONSource#updateData due to internal error")}_getShouldReloadTileOptions(e){if(this._options.cluster||!e||e.removeAll)return;const{add:n=[],update:o=[],remove:c=[]}=e||{},p=new Set([...o.map(m=>m.id),...c]);for(const m of p.values())if(typeof m!="number"&&this.promoteId==null)return void h.w(`GeoJSONSource "${this.id}": updateData is slower when using string GeoJSON feature IDs (e.g. "${m}"). Consider using promoteId or numeric IDs for better performance.`);return{nextBounds:[...o.map(m=>m.newGeometry),...n.map(m=>m.geometry)].filter(Boolean).map(m=>Hr(m)),prevIds:p}}shouldReloadTile(e,{nextBounds:n,prevIds:o}){if(!e.latestFeatureIndex)return e.state!=="unloaded";const c=e.latestFeatureIndex.loadVTLayers();for(let x=0;x<e.latestFeatureIndex.featureIndexArray.length;x++){const b=e.latestFeatureIndex.featureIndexArray.get(x),T=c[h.a9].feature(b.featureIndex),E=e.latestFeatureIndex.getId(T,h.a9);if(o.has(E))return!0}const{buffer:p,extent:m}=this.workerOptions.geojsonVtOptions,_=function({x,y:b,z:T},E=0){const I=h.a2((x-E)/Math.pow(2,T)),D=h.a3((b+1+E)/Math.pow(2,T)),L=h.a2((x+1+E)/Math.pow(2,T)),V=h.a3((b-E)/Math.pow(2,T));return new Ie([I,D],[L,V])}(e.tileID.canonical,p/m);for(const x of n)if(_.intersects(x))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}loadTile(e){return h._(this,void 0,void 0,function*(){const n=e.actor?"RT":"LT";e.actor=this.actor;const o={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,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};e.abortController=new AbortController;const c=yield this.actor.sendAsync({type:n,data:o},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(c,this.map.painter,n==="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.updateable?{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}}class Ai extends h.E{constructor(e,n,o,c){super(),this.flippedWindingOrder=!1,this.id=e,this.dispatcher=o,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(c),this.options=n}load(e){return h._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new h.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const n=yield Ci.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,n&&n.data&&(this.image=n.data,e&&(this.coordinates=e),this._finishLoading())}catch(n){this._request=null,this._loaded=!0,this.fire(new h.k(n))}})}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.l("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 n=e.map(h.aa.fromLngLat);var o;return this.tileID=function(c){const p=h.ab.fromPoints(c),m=p.width(),_=p.height(),x=Math.max(m,_),b=Math.max(0,Math.floor(-Math.log(x)/Math.LN2)),T=Math.pow(2,b);return new h.ad(b,Math.floor((p.minX+p.maxX)/2*T),Math.floor((p.minY+p.maxY)/2*T))}(n),this.terrainTileRanges=this._getOverlappingTileRanges(n),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=n.map(c=>this.tileID.getTilePoint(c)._round()),this.flippedWindingOrder=((o=this.tileCoords)[1].x-o[0].x)*(o[2].y-o[0].y)-(o[1].y-o[0].y)*(o[2].x-o[0].x)<0,this.fire(new h.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const e=this.map.painter.context,n=e.gl;this.texture||(this.texture=new h.T(e,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let o=!1;for(const c in this.tiles){const p=this.tiles[c];p.state!=="loaded"&&(p.state="loaded",p.texture=this.texture,o=!0)}o&&this.fire(new h.l("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}_getOverlappingTileRanges(e){const{minX:n,minY:o,maxX:c,maxY:p}=h.ab.fromPoints(e),m={};for(let _=0;_<=h.ac;_++){const x=Math.pow(2,_),b=Math.floor(n*x),T=Math.floor(o*x),E=Math.floor(c*x),I=Math.floor(p*x);m[_]={minTileX:b,minTileY:T,maxTileX:E,maxTileY:I}}return m}}class Cs extends Ai{constructor(e,n,o,c){super(e,n,o,c),this.roundZoom=!0,this.type="video",this.options=n}load(){return h._(this,void 0,void 0,function*(){this._loaded=!1;const e=this.options;this.urls=[];for(const n of e.urls)this.urls.push(this.map._requestManager.transformRequest(n,"Source").url);try{const n=yield h.ae(this.urls);if(this._loaded=!0,!n)return;this.video=n,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(n){this.fire(new h.k(n))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const n=this.video.seekable;e<n.start(0)||e>n.end(0)?this.fire(new h.k(new h.af(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.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,n=e.gl;this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new h.T(e,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let o=!1;for(const c in this.tiles){const p=this.tiles[c];p.state!=="loaded"&&(p.state="loaded",p.texture=this.texture,o=!0)}o&&this.fire(new h.l("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 As extends Ai{constructor(e,n,o,c){super(e,n,o,c),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(p=>!Array.isArray(p)||p.length!==2||p.some(m=>typeof m!="number"))||this.fire(new h.k(new h.af(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new h.k(new h.af(`sources.${e}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new h.k(new h.af(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new h.k(new h.af(`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.k(new h.af(`sources.${e}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.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.k(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 n=this.map.painter.context,o=n.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new h.T(n,this.canvas,o.RGBA,{premultiply:!0});let c=!1;for(const p in this.tiles){const m=this.tiles[p];m.state!=="loaded"&&(m.state="loaded",m.texture=this.texture,c=!0)}c&&this.fire(new h.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.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 _n={},Wn=d=>{switch(d){case"geojson":return gn;case"image":return Ai;case"raster":return qn;case"raster-dem":return Wr;case"vector":return fr;case"video":return Cs;case"canvas":return As}return _n[d]},Xr="RTLPluginLoaded";class Hn extends h.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=mn()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(n=>{throw this.status="error",n})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return h._(this,arguments,void 0,function*(n,o=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=Qe.resolveURL(n),!this.url)throw new Error(`requested url ${n} is invalid`);if(this.status==="unavailable"){if(!o)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.l(Xr))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let yn=null;function er(){return yn||(yn=new Hn),yn}var Oi,tt;(function(d){d[d.Base=0]="Base",d[d.Parent=1]="Parent"})(Oi||(Oi={})),function(d){d[d.Departing=0]="Departing",d[d.Incoming=1]="Incoming"}(tt||(tt={}));class k{constructor(e,n){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=e,this.uid=h.ag(),this.uses=0,this.tileSize=n,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"}isRenderable(e){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(e||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:e,fadingDirection:n,fadingParentID:o,fadeEndTime:c}){this.resetFadeLogic(),this.fadingRole=e,this.fadingDirection=n,this.fadingParentID=o,this.fadeEndTime=c}setSelfFadeLogic(e){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=e}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=ne(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,n,o){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData,this.latestFeatureIndex.encoding=e.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(c,p){const m={};if(!p)return m;for(const _ of c){const x=_.layerIds.map(b=>p.getLayer(b)).filter(Boolean);if(x.length!==0){_.layers=x,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(b=>x.filter(T=>T.id===b)[0]));for(const b of x)m[b.id]=_}}return m}(e.buckets,n?.style),this.hasSymbolBuckets=!1;for(const c in this.buckets){const p=this.buckets[c];if(p instanceof h.ai){if(this.hasSymbolBuckets=!0,!o)break;p.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const c in this.buckets){const p=this.buckets[c];if(p instanceof h.ai&&p.hasRTLText){this.hasRTLText=!0,er().lazyLoad();break}}this.queryPadding=0;for(const c in this.buckets){const p=this.buckets[c];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(c).queryRadius(p))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),this.dashPositions=e.dashPositions}else this.collisionBoxArray=new h.ah}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.dashPositions&&(this.dashPositions=null),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(const o in this.buckets){const c=this.buckets[o];c.uploadPending()&&c.upload(e)}const n=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new h.T(e,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new h.T(e,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,n,o,c,p,m,_,x,b,T,E){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:c,cameraQueryGeometry:p,scale:m,tileSize:this.tileSize,pixelPosMatrix:T,transform:x,params:_,queryPadding:this.queryPadding*b,getElevation:E},e,n,o):{}}querySourceFeatures(e,n){const o=this.latestFeatureIndex;if(!o||!o.rawTileData)return;const c=o.loadVTLayers(),p=n&&n.sourceLayer?n.sourceLayer:"",m=c[h.a9]||c[p];if(!m)return;const _=h.aj(n?.filter,n?.globalState),{z:x,x:b,y:T}=this.tileID.canonical,E={z:x,x:b,y:T};for(let I=0;I<m.length;I++){const D=m.feature(I);if(_.needGeometry){const N=h.ak(D,!0);if(!_.filter(new h.H(this.tileID.overscaledZ),N,this.tileID.canonical))continue}else if(!_.filter(new h.H(this.tileID.overscaledZ),D))continue;const L=o.getId(D,p),V=new h.al(D,x,b,T,L);V.tile=E,e.push(V)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const n=this.expirationTime;if(e.cacheControl){const o=h.am(e.cacheControl);o["max-age"]&&(this.expirationTime=Date.now()+1e3*o["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const o=Date.now();let c=!1;if(this.expirationTime>o)c=!1;else if(n)if(this.expirationTime<n)c=!0;else{const p=this.expirationTime-n;p?this.expirationTime=o+Math.max(p,3e4):c=!0}else c=!0;c?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(e,n){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;const o=this.latestFeatureIndex.loadVTLayers();for(const c in this.buckets){if(!n.style.hasLayer(c))continue;const p=this.buckets[c],m=p.layers[0].sourceLayer||h.a9,_=o[m],x=e[m];if(!_||!x||Object.keys(x).length===0)continue;p.update(x,_,this.imageAtlas&&this.imageAtlas.patternPositions||{},this.dashPositions||{});const b=n&&n.style&&n.style.getLayer(c);b&&(this.queryPadding=Math.max(this.queryPadding,b.queryRadius(p)))}}holdingForSymbolFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<ne()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(e){this.symbolFadeHoldUntil=ne()+e}setDependencies(e,n){const o={};for(const c of n)o[c]=!0;this.dependencies[e]=o}hasDependency(e,n){for(const o of e){const c=this.dependencies[o];if(c){for(const p of n)if(c[p])return!0}}return!1}}class R{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,n,o){const c=String(n);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][c]=this.stateChanges[e][c]||{},h.e(this.stateChanges[e][c],o),this.deletedStates[e]===null){this.deletedStates[e]={};for(const p in this.state[e])p!==c&&(this.deletedStates[e][p]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][c]===null){this.deletedStates[e][c]={};for(const p in this.state[e][c])o[p]||(this.deletedStates[e][c][p]=null)}else for(const p in o)this.deletedStates[e]&&this.deletedStates[e][c]&&this.deletedStates[e][c][p]===null&&delete this.deletedStates[e][c][p]}removeFeatureState(e,n,o){if(this.deletedStates[e]===null)return;const c=String(n);if(this.deletedStates[e]=this.deletedStates[e]||{},o&&n!==void 0)this.deletedStates[e][c]!==null&&(this.deletedStates[e][c]=this.deletedStates[e][c]||{},this.deletedStates[e][c][o]=null);else if(n!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][c])for(o in this.deletedStates[e][c]={},this.stateChanges[e][c])this.deletedStates[e][c][o]=null;else this.deletedStates[e][c]=null;else this.deletedStates[e]=null}getState(e,n){const o=String(n),c=h.e({},(this.state[e]||{})[o],(this.stateChanges[e]||{})[o]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){const p=this.deletedStates[e][n];if(p===null)return{};for(const m in p)delete c[m]}return c}initializeTileState(e,n){e.setFeatureState(this.state,n)}coalesceChanges(e,n){const o={};for(const c in this.stateChanges){this.state[c]=this.state[c]||{};const p={};for(const m in this.stateChanges[c])this.state[c][m]||(this.state[c][m]={}),h.e(this.state[c][m],this.stateChanges[c][m]),p[m]=this.state[c][m];o[c]=p}for(const c in this.deletedStates){this.state[c]=this.state[c]||{};const p={};if(this.deletedStates[c]===null)for(const m in this.state[c])p[m]={},this.state[c][m]={};else for(const m in this.deletedStates[c]){if(this.deletedStates[c][m]===null)this.state[c][m]={};else for(const _ of Object.keys(this.deletedStates[c][m]))delete this.state[c][m][_];p[m]=this.state[c][m]}o[c]=o[c]||{},h.e(o[c],p)}if(this.stateChanges={},this.deletedStates={},Object.keys(o).length!==0)for(const c in e)e[c].setFeatureState(o,n)}}const B=89.25;function W(d,e){const n=h.an(e.lat,-h.ao,h.ao);return new h.P(h.Y(e.lng)*d,h.X(n)*d)}function X(d,e){return new h.aa(e.x/d,e.y/d).toLngLat()}function nt(d){return d.cameraToCenterDistance*Math.min(.85*Math.tan(h.ap(90-d.pitch)),Math.tan(h.ap(B-d.pitch)))}function U(d,e){const n=d.canonical,o=e/h.aq(n.z),c=n.x+Math.pow(2,n.z)*d.wrap,p=h.ar(new Float64Array(16));return h.O(p,p,[c*o,n.y*o,0]),h.Q(p,p,[o/h.a4,o/h.a4,1]),p}function rt(d,e,n,o,c){const p=h.aa.fromLngLat(d,e),m=c*h.as(1,d.lat),_=m*Math.cos(h.ap(n)),x=Math.sqrt(m*m-_*_),b=x*Math.sin(h.ap(-o)),T=x*Math.cos(h.ap(-o));return new h.aa(p.x+b,p.y+T,p.z+_)}function ut(d,e,n){const o=e.intersectsFrustum(d);if(!n||o===0)return o;const c=e.intersectsPlane(n);return c===0?0:o===2&&c===2?2:1}function ht(d,e,n){let o=0;const c=(n-e)/10;for(let p=0;p<10;p++)o+=c*Math.pow(Math.cos(e+(p+.5)/10*(n-e)),d);return o}function pt(d,e){return function(n,o,c,p,m){const _=2*((d-1)/h.at(Math.cos(h.ap(B-m))/Math.cos(h.ap(B)))-1),x=Math.acos(c/p),b=2*ht(_-1,0,h.ap(m/2)),T=Math.min(h.ap(B),x+h.ap(m/2)),E=ht(_-1,Math.min(T,x-h.ap(m/2)),T),I=Math.atan(o/c),D=Math.hypot(o,c);let L=n;return L+=h.at(p/D/Math.max(.5,Math.cos(h.ap(m/2)))),L+=_*h.at(Math.cos(I))/2,L-=h.at(Math.max(1,E/b/e))/2,L}}const Et=pt(9.314,3);function Ot(d,e){const n=(e.roundZoom?Math.round:Math.floor)(d.zoom+h.at(d.tileSize/e.tileSize));return Math.max(0,n)}function Wt(d,e){const n=d.getCameraFrustum(),o=d.getClippingPlane(),c=d.screenPointToMercatorCoordinate(d.getCameraPoint()),p=h.aa.fromLngLat(d.center,d.elevation);c.z=p.z+Math.cos(d.pitchInRadians)*d.cameraToCenterDistance/d.worldSize;const m=d.getCoveringTilesDetailsProvider(),_=m.allowVariableZoom(d,e),x=Ot(d,e),b=e.minzoom||0,T=e.maxzoom!==void 0?e.maxzoom:d.maxZoom,E=Math.min(Math.max(0,x),T),I=Math.pow(2,E),D=[I*c.x,I*c.y,0],L=[I*p.x,I*p.y,0],V=Math.hypot(p.x-c.x,p.y-c.y),N=Math.abs(p.z-c.z),G=Math.hypot(V,N),q=K=>({zoom:0,x:0,y:0,wrap:K,fullyVisible:!1}),Y=[],$=[];if(d.renderWorldCopies&&m.allowWorldCopies())for(let K=1;K<=3;K++)Y.push(q(-K)),Y.push(q(K));for(Y.push(q(0));Y.length>0;){const K=Y.pop(),J=K.x,H=K.y;let it=K.fullyVisible;const ct={x:J,y:H,z:K.zoom},st=m.getTileBoundingVolume(ct,K.wrap,d.elevation,e);if(!it){const vt=ut(n,st,o);if(vt===0)continue;it=vt===2}const at=m.distanceToTile2d(c.x,c.y,ct,st);let lt=x;_&&(lt=(e.calculateTileZoom||Et)(d.zoom+h.at(d.tileSize/e.tileSize),at,N,G,d.fov)),lt=(e.roundZoom?Math.round:Math.floor)(lt),lt=Math.max(0,lt);const St=Math.min(lt,T);if(K.wrap=m.getWrap(p,ct,K.wrap),K.zoom>=St){if(K.zoom<b)continue;const vt=E-K.zoom,gt=D[0]-.5-(J<<vt),At=D[1]-.5-(H<<vt),qt=e.reparseOverscaled?Math.max(K.zoom,lt):K.zoom;$.push({tileID:new h.a1(K.zoom===T?qt:K.zoom,K.wrap,K.zoom,J,H),distanceSq:h.au([L[0]-.5-J,L[1]-.5-H]),tileDistanceToCamera:Math.sqrt(gt*gt+At*At)})}else for(let vt=0;vt<4;vt++)Y.push({zoom:K.zoom+1,x:(J<<1)+vt%2,y:(H<<1)+(vt>>1),wrap:K.wrap,fullyVisible:it})}return $.sort((K,J)=>K.distanceSq-J.distanceSq).map(K=>K.tileID)}const Le=h.ab.fromPoints([new h.P(0,0),new h.P(h.a4,h.a4)]);class Kt extends h.E{constructor(e,n,o){super(),this.id=e,this.dispatcher=o,this.on("data",c=>this._dataHandler(c)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((c,p,m,_)=>{const x=new(Wn(p.type))(c,p,m,_);if(x.id!==c)throw new Error(`Expected Source id to be ${c} instead of ${x.id}`);return x})(e,n,o,this),this._tiles={},this._cache=new h.av(0,c=>this._unloadTile(c)),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new R,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 n=this._tiles[e];if(n.state!=="loaded"&&n.state!=="errored")return!1}return!0}getSource(){return this._source}getState(){return this._state}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,n,o){return h._(this,void 0,void 0,function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,n,o)}catch(c){e.state="errored",c.status!==404?this._source.fire(new h.k(c,{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.l("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 n in this._tiles){const o=this._tiles[n];o.upload(e),o.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(ae).map(e=>e.key)}getRenderableIds(e){const n=[];for(const o in this._tiles)this._isIdRenderable(o,e)&&n.push(this._tiles[o]);return e?n.sort((o,c)=>{const p=o.tileID,m=c.tileID,_=new h.P(p.canonical.x,p.canonical.y)._rotate(-this.transform.bearingInRadians),x=new h.P(m.canonical.x,m.canonical.y)._rotate(-this.transform.bearingInRadians);return p.overscaledZ-m.overscaledZ||x.y-_.y||x.x-_.x}).map(o=>o.tileID.key):n.map(o=>o.tileID).sort(ae).map(o=>o.key)}hasRenderableParent(e){const n=e.overscaledZ-1;if(n>=this._source.minzoom){const o=this.getLoadedTile(e.scaledTo(n));if(o)return this._isIdRenderable(o.tileID.key)}return!1}_isIdRenderable(e,n=!1){var o;return(o=this._tiles[e])===null||o===void 0?void 0:o.isRenderable(n)}reload(e,n=void 0){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const o in this._tiles)n&&this._source.shouldReloadTile&&!this._source.shouldReloadTile(this._tiles[o],n)||(e?this._reloadTile(o,"expired"):this._tiles[o].state!=="errored"&&this._reloadTile(o,"reloading"))}}_reloadTile(e,n){return h._(this,void 0,void 0,function*(){const o=this._tiles[e];o&&(o.state!=="loading"&&(o.state=n),yield this._loadTile(o,e,n))})}_tileLoaded(e,n,o){e.timeAdded=ne(),e.selfFading&&(e.fadeEndTime=e.timeAdded+this._rasterFadeDuration),o==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(n,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.l("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){const n=this.getRenderableIds();for(let c=0;c<n.length;c++){const p=n[c];if(e.neighboringTiles&&e.neighboringTiles[p]){const m=this.getTileByID(p);o(e,m),o(m,e)}}function o(c,p){c.needsHillshadePrepare=!0,c.needsTerrainPrepare=!0;let m=p.tileID.canonical.x-c.tileID.canonical.x;const _=p.tileID.canonical.y-c.tileID.canonical.y,x=Math.pow(2,c.tileID.canonical.z),b=p.tileID.key;m===0&&_===0||Math.abs(_)>1||(Math.abs(m)>1&&(Math.abs(m+x)===1?m+=x:Math.abs(m-x)===1&&(m-=x)),p.dem&&c.dem&&(c.dem.backfillBorder(p.dem,m,_),c.neighboringTiles&&c.neighboringTiles[b]&&(c.neighboringTiles[b].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,n){const o=this._getLoadedDescendents(n),c=new Set;for(const p of n){const m=o[p.key];if(!m?.length){c.add(p);continue}const _=p.overscaledZ+Kt.maxOverzooming,x=m.filter(E=>E.tileID.overscaledZ<=_);if(!x.length){c.add(p);continue}const b=Math.min(...x.map(E=>E.tileID.overscaledZ)),T=x.filter(E=>E.tileID.overscaledZ===b).map(E=>E.tileID);for(const E of T)e[E.key]=E;this._areDescendentsComplete(T,b,p.overscaledZ)||c.add(p)}return c}_getLoadedDescendents(e){var n;const o={};for(const c in this._tiles){const p=this._tiles[c];if(p.hasData())for(const m of e)p.tileID.isChildOf(m)&&(o[n=m.key]||(o[n]=[])).push(p)}return o}_areDescendentsComplete(e,n,o){return e.length===1&&e[0].isOverscaled()?e[0].overscaledZ===n:Math.pow(4,n-o)===e.length}getLoadedTile(e){const n=this._tiles[e.key];return n?.hasData()?n:null}updateCacheSize(e){const n=Math.ceil(e.width/this._source.tileSize)+1,o=Math.ceil(e.height/this._source.tileSize)+1,c=Math.floor(n*o*(this._maxTileCacheZoomLevels===null?h.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),p=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,c):c;this._cache.setMaxSize(p)}handleWrapJump(e){const n=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,n){const o={};for(const c in this._tiles){const p=this._tiles[c];p.tileID=p.tileID.unwrapTo(p.tileID.wrap+n),o[p.tileID.key]=p}this._tiles=o,this._resetTileReloadTimers()}}update(e,n){if(!this._sourceLoaded||this._paused)return;let o;this.transform=e,this.terrain=n,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?o=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(x=>new h.a1(x.canonical.z,x.wrap,x.canonical.z,x.canonical.x,x.canonical.y)):(o=Wt(e,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.type==="vector"&&this.map._zoomLevelsToOverscale!==void 0?e.maxZoom-this.map._zoomLevelsToOverscale:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(o=o.filter(x=>this._source.hasTile(x)))):o=[],this.usedForTerrain&&(o=this._addTerrainIdealTiles(o));const c=o.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,c&&this.fire(new h.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const p=Ot(e,this._source),m=this._updateRetainedTiles(o,p),_=pe(this._source.type);_&&this._rasterFadeDuration>0&&!n&&this._updateFadingTiles(o,m),_?this._cleanUpRasterTiles(m):this._cleanUpVectorTiles(m)}_cleanUpRasterTiles(e){for(const n in this._tiles)e[n]||this._removeTile(n)}_cleanUpVectorTiles(e){for(const n in this._tiles){const o=this._tiles[n];e[n]?o.clearSymbolFadeHold():o.hasSymbolBuckets?o.holdingForSymbolFade()?o.symbolFadeFinished()&&this._removeTile(n):o.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(n)}}_addTerrainIdealTiles(e){const n=[];for(const o of e)if(o.canonical.z>this._source.minzoom){const c=o.scaledTo(o.canonical.z-1);n.push(c);const p=o.scaledTo(Math.max(this._source.minzoom,Math.min(o.canonical.z,5)));n.push(p)}return e.concat(n)}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForSymbolFade()&&this._removeTile(e)}_updateRetainedTiles(e,n){var o;const c=new Set;for(const b of e)this._addTile(b).hasData()||c.add(b);const p=e.reduce((b,T)=>(b[T.key]=T,b),{}),m=this._retainLoadedChildren(p,c),_={},x=Math.max(n-Kt.maxUnderzooming,this._source.minzoom);for(const b of m){let T=this._tiles[b.key],E=T?.wasRequested();for(let I=b.overscaledZ-1;I>=x;--I){const D=b.scaledTo(I);if(_[D.key])break;if(_[D.key]=!0,T=this.getTile(D),!T&&E&&(T=this._addTile(D)),T){const L=T.hasData();if((L||!(!((o=this.map)===null||o===void 0)&&o.cancelPendingTileRequestsWhileZooming)||E)&&(p[D.key]=D),E=T.wasRequested(),L)break}}}return p}_updateFadingTiles(e,n){const o=ne(),c=h.aw(e);for(const p of e){const m=this._tiles[p.key];m.fadingDirection!==tt.Departing&&m.fadeOpacity!==0||m.resetFadeLogic(),this._updateFadingAncestor(m,n,o)||this._updateFadingDescendents(m,n,o)||this._updateFadingEdge(m,c,o)||m.resetFadeLogic()}}_updateFadingAncestor(e,n,o){if(!e.hasData())return!1;const{tileID:c,fadingRole:p,fadingDirection:m,fadingParentID:_}=e;if(p===Oi.Base&&m===tt.Incoming&&_)return n[_.key]=_,!0;const x=Math.max(c.overscaledZ-this._maxFadingAncestorLevels,this._source.minzoom);for(let b=c.overscaledZ-1;b>=x;b--){const T=c.scaledTo(b),E=this.getLoadedTile(T);if(E)return e.setCrossFadeLogic({fadingRole:Oi.Base,fadingDirection:tt.Incoming,fadingParentID:E.tileID,fadeEndTime:o+this._rasterFadeDuration}),E.setCrossFadeLogic({fadingRole:Oi.Parent,fadingDirection:tt.Departing,fadeEndTime:o+this._rasterFadeDuration}),n[T.key]=T,!0}return!1}_updateFadingDescendents(e,n,o){if(!e.hasData())return!1;const c=e.tileID.children(this._source.maxzoom);let p=this._updateFadingChildren(e,c,n,o);if(p)return!0;for(const m of c){const _=m.children(this._source.maxzoom);this._updateFadingChildren(e,_,n,o)&&(p=!0)}return p}_updateFadingChildren(e,n,o,c){if(n[0].overscaledZ>=this._source.maxzoom)return!1;let p=!1;for(const m of n){const _=this.getLoadedTile(m);if(!_)continue;const{fadingRole:x,fadingDirection:b,fadingParentID:T}=_;x===Oi.Base&&b===tt.Departing&&T||(_.setCrossFadeLogic({fadingRole:Oi.Base,fadingDirection:tt.Departing,fadingParentID:e.tileID,fadeEndTime:c+this._rasterFadeDuration}),e.setCrossFadeLogic({fadingRole:Oi.Parent,fadingDirection:tt.Incoming,fadeEndTime:c+this._rasterFadeDuration})),o[m.key]=m,p=!0}return p}_updateFadingEdge(e,n,o){const c=e.tileID;return!!e.selfFading||!e.hasData()&&!!n.has(c)&&(e.setSelfFadeLogic(o+this._rasterFadeDuration),!0)}_addTile(e){let n=this._tiles[e.key];if(n)return n;n=this._cache.getAndRemove(e),n&&(n.resetFadeLogic(),this._setTileReloadTimer(e.key,n),n.tileID=e,this._state.initializeTileState(n,this.map?this.map.painter:null));const o=n;return n||(n=new k(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(n,e.key,n.state)),n.uses++,this._tiles[e.key]=n,o||this._source.fire(new h.l("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(e,n){this._clearTileReloadTimer(e);const o=n.getExpiryTimeout();o&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},o))}_clearTileReloadTimer(e){const n=this._timers[e];n&&(clearTimeout(n),delete this._timers[e])}_resetTileReloadTimers(){for(const e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(const e in this._tiles)this._setTileReloadTimer(e,this._tiles[e])}refreshTiles(e){for(const n in this._tiles)(this._isIdRenderable(n)||this._tiles[n].state=="errored")&&e.some(o=>o.equals(this._tiles[n].tileID.canonical))&&this._reloadTile(n,"expired")}_removeTile(e){const n=this._tiles[e];n&&(n.uses--,delete this._tiles[e],this._clearTileReloadTimer(e),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}_dataHandler(e){e.dataType==="source"&&(e.sourceDataType!=="metadata"?e.sourceDataType==="content"&&this._sourceLoaded&&!this._paused&&(this.reload(e.sourceDataChanged,e.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0):this._sourceLoaded=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,n,o){const c=[],p=this.transform;if(!p)return c;const m=p.getCoveringTilesDetailsProvider().allowWorldCopies(),_=o?p.getCameraQueryGeometry(e):e,x=D=>p.screenPointToMercatorCoordinate(D,this.terrain),b=this.transformBbox(e,x,!m),T=this.transformBbox(_,x,!m),E=this.getIds(),I=h.ab.fromPoints(T);for(let D=0;D<E.length;D++){const L=this._tiles[E[D]];if(L.holdingForSymbolFade())continue;const V=m?[L.tileID]:[L.tileID.unwrapTo(-1),L.tileID.unwrapTo(0)],N=Math.pow(2,p.zoom-L.tileID.overscaledZ),G=n*L.queryPadding*h.a4/L.tileSize/N;for(const q of V){const Y=I.map($=>q.getTilePoint(new h.aa($.x,$.y)));if(Y.expandBy(G),Y.intersects(Le)){const $=b.map(J=>q.getTilePoint(J)),K=T.map(J=>q.getTilePoint(J));c.push({tile:L,tileID:m?q:q.unwrapTo(0),queryGeometry:$,cameraQueryGeometry:K,scale:N})}}}return c}transformBbox(e,n,o){let c=e.map(n);if(o){const p=h.ab.fromPoints(e);p.shrinkBy(.001*Math.min(p.width(),p.height()));const m=p.map(n);h.ab.fromPoints(c).covers(m)||(c=c.map(_=>_.x>.5?new h.aa(_.x-1,_.y,_.z):_))}return c}getVisibleCoordinates(e){const n=this.getRenderableIds(e).map(o=>this._tiles[o].tileID);return this.transform&&this.transform.populateCache(n),n}hasTransition(){if(this._source.hasTransition())return!0;if(pe(this._source.type)&&this._rasterFadeDuration>0){const e=ne();for(const n in this._tiles)if(this._tiles[n].fadeEndTime>=e)return!0}return!1}setRasterFadeDuration(e){this._rasterFadeDuration=e}setFeatureState(e,n,o){this._state.updateState(e=e||h.a9,n,o)}removeFeatureState(e,n,o){this._state.removeFeatureState(e=e||h.a9,n,o)}getFeatureState(e,n){return this._state.getState(e=e||h.a9,n)}setDependencies(e,n,o){const c=this._tiles[e];c&&c.setDependencies(n,o)}reloadTilesForDependencies(e,n){for(const o in this._tiles)this._tiles[o].hasDependency(e,n)&&this._reloadTile(o,"reloading");this._cache.filter(o=>!o.hasDependency(e,n))}}function ae(d,e){const n=Math.abs(2*d.wrap)-+(d.wrap<0),o=Math.abs(2*e.wrap)-+(e.wrap<0);return d.overscaledZ-e.overscaledZ||o-n||e.canonical.y-d.canonical.y||e.canonical.x-d.canonical.x}function pe(d){return d==="raster"||d==="image"||d==="video"}Kt.maxUnderzooming=10,Kt.maxOverzooming=3;class xt{constructor(e,n){this.reset(e,n)}reset(e,n){this.points=e||[],this._distances=[0];for(let o=1;o<this.points.length;o++)this._distances[o]=this._distances[o-1]+this.points[o].dist(this.points[o-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(this.points.length===1)return this.points[0];e=h.an(e,0,1);let n=1,o=this._distances[n];const c=e*this.paddedLength+this.padding;for(;o<c&&n<this._distances.length;)o=this._distances[++n];const p=n-1,m=this._distances[p],_=o-m,x=_>0?(c-m)/_:0;return this.points[p].mult(1-x).add(this.points[n].mult(x))}}function ve(d,e){let n=!0;return d==="always"||d!=="never"&&e!=="never"||(n=!1),n}class fe{constructor(e,n,o){const c=this.boxCells=[],p=this.circleCells=[];this.xCellCount=Math.ceil(e/o),this.yCellCount=Math.ceil(n/o);for(let m=0;m<this.xCellCount*this.yCellCount;m++)c.push([]),p.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=n,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,n,o,c,p){this._forEachCell(n,o,c,p,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(n),this.bboxes.push(o),this.bboxes.push(c),this.bboxes.push(p)}insertCircle(e,n,o,c){this._forEachCell(n-c,o-c,n+c,o+c,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(n),this.circles.push(o),this.circles.push(c)}_insertBoxCell(e,n,o,c,p,m){this.boxCells[p].push(m)}_insertCircleCell(e,n,o,c,p,m){this.circleCells[p].push(m)}_query(e,n,o,c,p,m,_){if(o<0||e>this.width||c<0||n>this.height)return[];const x=[];if(e<=0&&n<=0&&this.width<=o&&this.height<=c){if(p)return[{key:null,x1:e,y1:n,x2:o,y2:c}];for(let b=0;b<this.boxKeys.length;b++)x.push({key:this.boxKeys[b],x1:this.bboxes[4*b],y1:this.bboxes[4*b+1],x2:this.bboxes[4*b+2],y2:this.bboxes[4*b+3]});for(let b=0;b<this.circleKeys.length;b++){const T=this.circles[3*b],E=this.circles[3*b+1],I=this.circles[3*b+2];x.push({key:this.circleKeys[b],x1:T-I,y1:E-I,x2:T+I,y2:E+I})}}else this._forEachCell(e,n,o,c,this._queryCell,x,{hitTest:p,overlapMode:m,seenUids:{box:{},circle:{}}},_);return x}query(e,n,o,c){return this._query(e,n,o,c,!1,null)}hitTest(e,n,o,c,p,m){return this._query(e,n,o,c,!0,p,m).length>0}hitTestCircle(e,n,o,c,p){const m=e-o,_=e+o,x=n-o,b=n+o;if(_<0||m>this.width||b<0||x>this.height)return!1;const T=[];return this._forEachCell(m,x,_,b,this._queryCellCircle,T,{hitTest:!0,overlapMode:c,circle:{x:e,y:n,radius:o},seenUids:{box:{},circle:{}}},p),T.length>0}_queryCell(e,n,o,c,p,m,_,x){const{seenUids:b,hitTest:T,overlapMode:E}=_,I=this.boxCells[p];if(I!==null){const L=this.bboxes;for(const V of I)if(!b.box[V]){b.box[V]=!0;const N=4*V,G=this.boxKeys[V];if(e<=L[N+2]&&n<=L[N+3]&&o>=L[N+0]&&c>=L[N+1]&&(!x||x(G))&&(!T||!ve(E,G.overlapMode))&&(m.push({key:G,x1:L[N],y1:L[N+1],x2:L[N+2],y2:L[N+3]}),T))return!0}}const D=this.circleCells[p];if(D!==null){const L=this.circles;for(const V of D)if(!b.circle[V]){b.circle[V]=!0;const N=3*V,G=this.circleKeys[V];if(this._circleAndRectCollide(L[N],L[N+1],L[N+2],e,n,o,c)&&(!x||x(G))&&(!T||!ve(E,G.overlapMode))){const q=L[N],Y=L[N+1],$=L[N+2];if(m.push({key:G,x1:q-$,y1:Y-$,x2:q+$,y2:Y+$}),T)return!0}}}return!1}_queryCellCircle(e,n,o,c,p,m,_,x){const{circle:b,seenUids:T,overlapMode:E}=_,I=this.boxCells[p];if(I!==null){const L=this.bboxes;for(const V of I)if(!T.box[V]){T.box[V]=!0;const N=4*V,G=this.boxKeys[V];if(this._circleAndRectCollide(b.x,b.y,b.radius,L[N+0],L[N+1],L[N+2],L[N+3])&&(!x||x(G))&&!ve(E,G.overlapMode))return m.push(!0),!0}}const D=this.circleCells[p];if(D!==null){const L=this.circles;for(const V of D)if(!T.circle[V]){T.circle[V]=!0;const N=3*V,G=this.circleKeys[V];if(this._circlesCollide(L[N],L[N+1],L[N+2],b.x,b.y,b.radius)&&(!x||x(G))&&!ve(E,G.overlapMode))return m.push(!0),!0}}}_forEachCell(e,n,o,c,p,m,_,x){const b=this._convertToXCellCoord(e),T=this._convertToYCellCoord(n),E=this._convertToXCellCoord(o),I=this._convertToYCellCoord(c);for(let D=b;D<=E;D++)for(let L=T;L<=I;L++)if(p.call(this,e,n,o,c,this.xCellCount*L+D,m,_,x))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,n,o,c,p,m){const _=c-e,x=p-n,b=o+m;return b*b>_*_+x*x}_circleAndRectCollide(e,n,o,c,p,m,_){const x=(m-c)/2,b=Math.abs(e-(c+x));if(b>x+o)return!1;const T=(_-p)/2,E=Math.abs(n-(p+T));if(E>T+o)return!1;if(b<=x||E<=T)return!0;const I=b-x,D=E-T;return I*I+D*D<=o*o}}function qe(d,e,n){const o=h.N();if(!d){const{vecSouth:E,vecEast:I}=bt(e),D=ke();D[0]=I[0],D[1]=I[1],D[2]=E[0],D[3]=E[1],c=D,(T=(m=(p=D)[0])*(b=p[3])-(x=p[2])*(_=p[1]))&&(c[0]=b*(T=1/T),c[1]=-_*T,c[2]=-x*T,c[3]=m*T),o[0]=D[0],o[1]=D[1],o[4]=D[2],o[5]=D[3]}var c,p,m,_,x,b,T;return h.Q(o,o,[1/n,1/n,1]),o}function me(d,e,n,o){if(d){const c=h.N();if(!e){const{vecSouth:p,vecEast:m}=bt(n);c[0]=m[0],c[1]=m[1],c[4]=p[0],c[5]=p[1]}return h.Q(c,c,[o,o,1]),c}return n.pixelsToClipSpaceMatrix}function bt(d){const e=Math.cos(d.rollInRadians),n=Math.sin(d.rollInRadians),o=Math.cos(d.pitchInRadians),c=Math.cos(d.bearingInRadians),p=Math.sin(d.bearingInRadians),m=h.aB();m[0]=-c*o*n-p*e,m[1]=-p*o*n+c*e;const _=h.aC(m);_<1e-9?h.aD(m):h.aE(m,m,1/_);const x=h.aB();x[0]=c*o*e-p*n,x[1]=p*o*e+c*n;const b=h.aC(x);return b<1e-9?h.aD(x):h.aE(x,x,1/b),{vecEast:x,vecSouth:m}}function Dt(d,e,n,o){let c;o?(c=[d,e,o(d,e),1],h.aG(c,c,n)):(c=[d,e,0,1],Ds(c,c,n));const p=c[3];return{point:new h.P(c[0]/p,c[1]/p),signedDistanceFromCamera:p,isOccluded:!1}}function jt(d,e){return .5+d/e*.5}function Di(d,e){return d.x>=-e[0]&&d.x<=e[0]&&d.y>=-e[1]&&d.y<=e[1]}function xn(d,e,n,o,c,p,m,_,x,b,T,E,I){const D=n?d.textSizeData:d.iconSizeData,L=h.ax(D,e.transform.zoom),V=[256/e.width*2+1,256/e.height*2+1],N=n?d.text.dynamicLayoutVertexArray:d.icon.dynamicLayoutVertexArray;N.clear();const G=d.lineVertexArray,q=n?d.text.placedSymbolArray:d.icon.placedSymbolArray,Y=e.transform.width/e.transform.height;let $=!1;for(let K=0;K<q.length;K++){const J=q.get(K);if(J.hidden||J.writingMode===h.ay.vertical&&!$){gr(J.numGlyphs,N);continue}$=!1;const H=new h.P(J.anchorX,J.anchorY),it={getElevation:I,pitchedLabelPlaneMatrix:o,lineVertexArray:G,pitchWithMap:p,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:e.transform,tileAnchorPoint:H,unwrappedTileID:x,width:b,height:T,translation:E},ct=Kn(J.anchorX,J.anchorY,it);if(!Di(ct.point,V)){gr(J.numGlyphs,N);continue}const st=jt(e.transform.cameraToCenterDistance,ct.signedDistanceFromCamera),at=h.az(D,L,J),lt=p?at*e.transform.getPitchedTextCorrection(J.anchorX,J.anchorY,x)/st:at*st,St=Mr({projectionContext:it,pitchedLabelPlaneMatrixInverse:c,symbol:J,fontSize:lt,flip:!1,keepUpright:m,glyphOffsetArray:d.glyphOffsetArray,dynamicLayoutVertexArray:N,aspectRatio:Y,rotateToLine:_});$=St.useVertical,(St.notEnoughRoom||$||St.needsFlipping&&Mr({projectionContext:it,pitchedLabelPlaneMatrixInverse:c,symbol:J,fontSize:lt,flip:!0,keepUpright:m,glyphOffsetArray:d.glyphOffsetArray,dynamicLayoutVertexArray:N,aspectRatio:Y,rotateToLine:_}).notEnoughRoom)&&gr(J.numGlyphs,N)}n?d.text.dynamicLayoutVertexBuffer.updateData(N):d.icon.dynamicLayoutVertexBuffer.updateData(N)}function ii(d,e,n,o,c,p,m,_){const x=p.glyphStartIndex+p.numGlyphs,b=p.lineStartIndex,T=p.lineStartIndex+p.lineLength,E=e.getoffsetX(p.glyphStartIndex),I=e.getoffsetX(x-1),D=ge(d*E,n,o,c,p.segment,b,T,_,m);if(!D)return null;const L=ge(d*I,n,o,c,p.segment,b,T,_,m);return L?_.projectionCache.anyProjectionOccluded?null:{first:D,last:L}:null}function Zt(d,e,n,o){return d===h.ay.horizontal&&Math.abs(n.y-e.y)>Math.abs(n.x-e.x)*o?{useVertical:!0}:(d===h.ay.vertical?e.y<n.y:e.x>n.x)?{needsFlipping:!0}:null}function Mr(d){const{projectionContext:e,pitchedLabelPlaneMatrixInverse:n,symbol:o,fontSize:c,flip:p,keepUpright:m,glyphOffsetArray:_,dynamicLayoutVertexArray:x,aspectRatio:b,rotateToLine:T}=d,E=c/24,I=o.lineOffsetX*E,D=o.lineOffsetY*E;let L;if(o.numGlyphs>1){const V=o.glyphStartIndex+o.numGlyphs,N=o.lineStartIndex,G=o.lineStartIndex+o.lineLength,q=ii(E,_,I,D,p,o,T,e);if(!q)return{notEnoughRoom:!0};const Y=vn(q.first.point.x,q.first.point.y,e,n),$=vn(q.last.point.x,q.last.point.y,e,n);if(m&&!p){const K=Zt(o.writingMode,Y,$,b);if(K)return K}L=[q.first];for(let K=o.glyphStartIndex+1;K<V-1;K++){const J=ge(E*_.getoffsetX(K),I,D,p,o.segment,N,G,e,T);if(!J)return{notEnoughRoom:!0};L.push(J)}L.push(q.last)}else{if(m&&!p){const N=ir(e.tileAnchorPoint.x,e.tileAnchorPoint.y,e).point,G=o.lineStartIndex+o.segment+1,q=new h.P(e.lineVertexArray.getx(G),e.lineVertexArray.gety(G)),Y=ir(q.x,q.y,e),$=Y.signedDistanceFromCamera>0?Y.point:Xn(e.tileAnchorPoint,q,N,1,e),K=vn(N.x,N.y,e,n),J=vn($.x,$.y,e,n),H=Zt(o.writingMode,K,J,b);if(H)return H}const V=ge(E*_.getoffsetX(o.glyphStartIndex),I,D,p,o.segment,o.lineStartIndex,o.lineStartIndex+o.lineLength,e,T);if(!V||e.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};L=[V]}for(const V of L)h.aF(x,V.point,V.angle);return{}}function Xn(d,e,n,o,c){const p=d.add(d.sub(e)._unit()),m=ir(p.x,p.y,c).point,_=n.sub(m);return n.add(_._mult(o/_.mag()))}function Yn(d,e,n){const o=e.projectionCache;if(o.projections[d])return o.projections[d];const c=new h.P(e.lineVertexArray.getx(d),e.lineVertexArray.gety(d)),p=ir(c.x,c.y,e);if(p.signedDistanceFromCamera>0)return o.projections[d]=p.point,o.anyProjectionOccluded=o.anyProjectionOccluded||p.isOccluded,p.point;const m=d-n.direction;return Xn(n.distanceFromAnchor===0?e.tileAnchorPoint:new h.P(e.lineVertexArray.getx(m),e.lineVertexArray.gety(m)),c,n.previousVertex,n.absOffsetX-n.distanceFromAnchor+1,e)}function ir(d,e,n){const o=d+n.translation[0],c=e+n.translation[1];let p;return n.pitchWithMap?(p=Dt(o,c,n.pitchedLabelPlaneMatrix,n.getElevation),p.isOccluded=!1):(p=n.transform.projectTileCoordinates(o,c,n.unwrappedTileID,n.getElevation),p.point.x=(.5*p.point.x+.5)*n.width,p.point.y=(.5*-p.point.y+.5)*n.height),p}function vn(d,e,n,o){if(n.pitchWithMap){const c=[d,e,0,1];return h.aG(c,c,o),n.transform.projectTileCoordinates(c[0]/c[3],c[1]/c[3],n.unwrappedTileID,n.getElevation).point}return{x:d/n.width*2-1,y:1-e/n.height*2}}function Kn(d,e,n){return n.transform.projectTileCoordinates(d,e,n.unwrappedTileID,n.getElevation)}function Jn(d,e,n){return d._unit()._perp()._mult(e*n)}function Vi(d,e,n,o,c,p,m,_,x){if(_.projectionCache.offsets[d])return _.projectionCache.offsets[d];const b=n.add(e);if(d+x.direction<o||d+x.direction>=c)return _.projectionCache.offsets[d]=b,b;const T=Yn(d+x.direction,_,x),E=Jn(T.sub(n),m,x.direction),I=n.add(E),D=T.add(E);return _.projectionCache.offsets[d]=h.aH(p,b,I,D)||b,_.projectionCache.offsets[d]}function ge(d,e,n,o,c,p,m,_,x){const b=o?d-e:d+e;let T=b>0?1:-1,E=0;o&&(T*=-1,E=Math.PI),T<0&&(E+=Math.PI);let I,D=T>0?p+c:p+c+1;_.projectionCache.cachedAnchorPoint?I=_.projectionCache.cachedAnchorPoint:(I=ir(_.tileAnchorPoint.x,_.tileAnchorPoint.y,_).point,_.projectionCache.cachedAnchorPoint=I);let L,V,N=I,G=I,q=0,Y=0;const $=Math.abs(b),K=[];let J;for(;q+Y<=$;){if(D+=T,D<p||D>=m)return null;q+=Y,G=N,V=L;const ct={absOffsetX:$,direction:T,distanceFromAnchor:q,previousVertex:G};if(N=Yn(D,_,ct),n===0)K.push(G),J=N.sub(G);else{let st;const at=N.sub(G);st=at.mag()===0?Jn(Yn(D+T,_,ct).sub(N),n,T):Jn(at,n,T),V||(V=G.add(st)),L=Vi(D,st,N,p,m,V,n,_,ct),K.push(V),J=L.sub(V)}Y=J.mag()}const H=J._mult(($-q)/Y)._add(V||G),it=E+Math.atan2(N.y-G.y,N.x-G.x);return K.push(H),{point:H,angle:x?it:0,path:K}}const Pu=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function gr(d,e){for(let n=0;n<d;n++){const o=e.length;e.resize(o+4),e.float32.set(Pu,3*o)}}function Ds(d,e,n){const o=e[0],c=e[1];return d[0]=n[0]*o+n[4]*c+n[12],d[1]=n[1]*o+n[5]*c+n[13],d[3]=n[3]*o+n[7]*c+n[15],d}const Ee=100;class Yr{constructor(e,n=new fe(e.width+200,e.height+200,25),o=new fe(e.width+200,e.height+200,25)){this.transform=e,this.grid=n,this.ignoredGrid=o,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+Ee,this.screenBottomBoundary=e.height+Ee,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,n,o,c,p,m,_,x,b,T,E,I){const D=this.projectAndGetPerspectiveRatio(e.anchorPointX+x[0],e.anchorPointY+x[1],p,T,I),L=o*D.perspectiveRatio;let V;if(m||_)V=this._projectCollisionBox(e,L,c,p,m,_,x,D,T,E,I);else{const J=D.x+(E?E.x*L:0),H=D.y+(E?E.y*L:0);V={allPointsOccluded:!1,box:[J+e.x1*L,H+e.y1*L,J+e.x2*L,H+e.y2*L]}}const[N,G,q,Y]=V.box,$=m?V.allPointsOccluded:D.isOccluded;let K=$;return K||(K=D.perspectiveRatio<this.perspectiveRatioCutoff),K||(K=!this.isInsideGrid(N,G,q,Y)),K||n!=="always"&&this.grid.hitTest(N,G,q,Y,n,b)?{box:[N,G,q,Y],placeable:!1,offscreen:!1,occluded:$}:{box:[N,G,q,Y],placeable:!0,offscreen:this.isOffscreen(N,G,q,Y),occluded:$}}placeCollisionCircles(e,n,o,c,p,m,_,x,b,T,E,I,D,L){const V=[],N=new h.P(n.anchorX,n.anchorY),G=this.getPerspectiveRatio(N.x,N.y,m,L),q=(b?p*this.transform.getPitchedTextCorrection(n.anchorX,n.anchorY,m)/G:p*G)/h.aL,Y={getElevation:L,pitchedLabelPlaneMatrix:_,lineVertexArray:o,pitchWithMap:b,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:N,unwrappedTileID:m,width:this.transform.width,height:this.transform.height,translation:D},$=ii(q,c,n.lineOffsetX*q,n.lineOffsetY*q,!1,n,!1,Y);let K=!1,J=!1,H=!0;if($){const it=.5*E*G+I,ct=new h.P(-100,-100),st=new h.P(this.screenRightBoundary,this.screenBottomBoundary),at=new xt,lt=$.first,St=$.last;let vt=[];for(let qt=lt.path.length-1;qt>=1;qt--)vt.push(lt.path[qt]);for(let qt=1;qt<St.path.length;qt++)vt.push(St.path[qt]);const gt=2.5*it;if(b){const qt=this.projectPathToScreenSpace(vt,Y);vt=qt.some($t=>$t.signedDistanceFromCamera<=0)?[]:qt.map($t=>$t.point)}let At=[];if(vt.length>0){const qt=vt[0].clone(),$t=vt[0].clone();for(let ye=1;ye<vt.length;ye++)qt.x=Math.min(qt.x,vt[ye].x),qt.y=Math.min(qt.y,vt[ye].y),$t.x=Math.max($t.x,vt[ye].x),$t.y=Math.max($t.y,vt[ye].y);At=qt.x>=ct.x&&$t.x<=st.x&&qt.y>=ct.y&&$t.y<=st.y?[vt]:$t.x<ct.x||qt.x>st.x||$t.y<ct.y||qt.y>st.y?[]:h.aI([vt],ct.x,ct.y,st.x,st.y)}for(const qt of At){at.reset(qt,.25*it);let $t=0;$t=at.length<=.5*it?1:Math.ceil(at.paddedLength/gt)+1;for(let ye=0;ye<$t;ye++){const xe=ye/Math.max($t-1,1),Ae=at.lerp(xe),he=Ae.x+Ee,Xe=Ae.y+Ee;V.push(he,Xe,it,0);const Te=he-it,Ge=Xe-it,je=he+it,Ze=Xe+it;if(H=H&&this.isOffscreen(Te,Ge,je,Ze),J=J||this.isInsideGrid(Te,Ge,je,Ze),e!=="always"&&this.grid.hitTestCircle(he,Xe,it,e,T)&&(K=!0,!x))return{circles:[],offscreen:!1,collisionDetected:K}}}}return{circles:!x&&K||!J||G<this.perspectiveRatioCutoff?[]:V,offscreen:H,collisionDetected:K}}projectPathToScreenSpace(e,n){const o=function(c,p){const m=h.N();return h.aA(m,p.pitchedLabelPlaneMatrix),c.map(_=>{const x=Dt(_.x,_.y,m,p.getElevation),b=p.transform.projectTileCoordinates(x.point.x,x.point.y,p.unwrappedTileID,p.getElevation);return b.point.x=(.5*b.point.x+.5)*p.width,b.point.y=(.5*-b.point.y+.5)*p.height,b})}(e,n);return function(c){let p=0,m=0,_=0,x=0;for(let b=0;b<c.length;b++)c[b].isOccluded?(_=b+1,x=0):(x++,x>m&&(m=x,p=_));return c.slice(p,p+m)}(o)}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[],o=new h.ab;for(const E of e){const I=new h.P(E.x+Ee,E.y+Ee);o.extend(I),n.push(I)}const{minX:c,minY:p,maxX:m,maxY:_}=o,x=this.grid.query(c,p,m,_).concat(this.ignoredGrid.query(c,p,m,_)),b={},T={};for(const E of x){const I=E.key;if(b[I.bucketInstanceId]===void 0&&(b[I.bucketInstanceId]={}),b[I.bucketInstanceId][I.featureIndex])continue;const D=[new h.P(E.x1,E.y1),new h.P(E.x2,E.y1),new h.P(E.x2,E.y2),new h.P(E.x1,E.y2)];h.aJ(n,D)&&(b[I.bucketInstanceId][I.featureIndex]=!0,T[I.bucketInstanceId]===void 0&&(T[I.bucketInstanceId]=[]),T[I.bucketInstanceId].push(I.featureIndex))}return T}insertCollisionBox(e,n,o,c,p,m){(o?this.ignoredGrid:this.grid).insert({bucketInstanceId:c,featureIndex:p,collisionGroupID:m,overlapMode:n},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,n,o,c,p,m){const _=o?this.ignoredGrid:this.grid,x={bucketInstanceId:c,featureIndex:p,collisionGroupID:m,overlapMode:n};for(let b=0;b<e.length;b+=4)_.insertCircle(x,e[b],e[b+1],e[b+2])}projectAndGetPerspectiveRatio(e,n,o,c,p){if(p){let m;c?(m=[e,n,c(e,n),1],h.aG(m,m,p)):(m=[e,n,0,1],Ds(m,m,p));const _=m[3];return{x:(m[0]/_+1)/2*this.transform.width+Ee,y:(-m[1]/_+1)/2*this.transform.height+Ee,perspectiveRatio:.5+this.transform.cameraToCenterDistance/_*.5,isOccluded:!1,signedDistanceFromCamera:_}}{const m=this.transform.projectTileCoordinates(e,n,o,c);return{x:(m.point.x+1)/2*this.transform.width+Ee,y:(1-m.point.y)/2*this.transform.height+Ee,perspectiveRatio:.5+this.transform.cameraToCenterDistance/m.signedDistanceFromCamera*.5,isOccluded:m.isOccluded,signedDistanceFromCamera:m.signedDistanceFromCamera}}}getPerspectiveRatio(e,n,o,c){const p=this.transform.projectTileCoordinates(e,n,o,c);return .5+this.transform.cameraToCenterDistance/p.signedDistanceFromCamera*.5}isOffscreen(e,n,o,c){return o<Ee||e>=this.screenRightBoundary||c<Ee||n>this.screenBottomBoundary}isInsideGrid(e,n,o,c){return o>=0&&e<this.gridRightBoundary&&c>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const e=h.ar([]);return h.O(e,e,[-100,-100,0]),e}_projectCollisionBox(e,n,o,c,p,m,_,x,b,T,E){let I=1,D=0,L=0,V=1;const N=e.anchorPointX+_[0],G=e.anchorPointY+_[1];if(m&&!p){const vt=this.projectAndGetPerspectiveRatio(N+1,G,c,b,E),gt=vt.x-x.x,At=Math.atan((vt.y-x.y)/gt)+(gt<0?Math.PI:0),qt=Math.sin(At),$t=Math.cos(At);I=$t,D=qt,L=-qt,V=$t}else if(!m&&p){const vt=bt(this.transform);I=vt.vecEast[0],D=vt.vecEast[1],L=vt.vecSouth[0],V=vt.vecSouth[1]}let q=x.x,Y=x.y,$=n;p&&(q=N,Y=G,$=Math.pow(2,-(this.transform.zoom-o.overscaledZ)),$*=this.transform.getPitchedTextCorrection(N,G,c),T||($*=h.an(.5+x.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),T&&(q+=I*T.x*$+L*T.y*$,Y+=D*T.x*$+V*T.y*$);const K=e.x1*$,J=e.x2*$,H=(K+J)/2,it=e.y1*$,ct=e.y2*$,st=(it+ct)/2,at=[{offsetX:K,offsetY:it},{offsetX:H,offsetY:it},{offsetX:J,offsetY:it},{offsetX:J,offsetY:st},{offsetX:J,offsetY:ct},{offsetX:H,offsetY:ct},{offsetX:K,offsetY:ct},{offsetX:K,offsetY:st}];let lt=[];for(const{offsetX:vt,offsetY:gt}of at)lt.push(new h.P(q+I*vt+L*gt,Y+D*vt+V*gt));let St=!1;if(p){const vt=lt.map(gt=>this.projectAndGetPerspectiveRatio(gt.x,gt.y,c,b,E));St=vt.some(gt=>!gt.isOccluded),lt=vt.map(gt=>new h.P(gt.x,gt.y))}else St=!0;return{box:h.aK(lt),allPointsOccluded:!St}}}class Eo{constructor(e,n,o,c){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?n:-n))):c&&o?1:0,this.placed=o}isHidden(){return this.opacity===0&&!this.placed}}class Qn{constructor(e,n,o,c,p){this.text=new Eo(e?e.text:null,n,o,p),this.icon=new Eo(e?e.icon:null,n,c,p)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Co{constructor(e,n,o){this.text=e,this.icon=n,this.skipFade=o}}class ts{constructor(e,n,o,c,p){this.bucketInstanceId=e,this.featureIndex=n,this.sourceLayerIndex=o,this.bucketIndex=c,this.tileID=p}}class Hl{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 n=++this.maxGroupID;this.collisionGroups[e]={ID:n,predicate:o=>o.collisionGroupID===n}}return this.collisionGroups[e]}}function Xl(d,e,n,o,c){const{horizontalAlign:p,verticalAlign:m}=h.aR(d);return new h.P(-(p-.5)*e+o[0]*c,-(m-.5)*n+o[1]*c)}class Mu{constructor(e,n,o,c,p){this.transform=e.clone(),this.terrain=n,this.collisionIndex=new Yr(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=o,this.retainedQueryData={},this.collisionGroups=new Hl(c),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=p,p&&(p.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){const n=this.terrain;return n?(o,c)=>n.getElevation(e,o,c):null}getBucketParts(e,n,o,c){const p=o.getBucket(n),m=o.latestFeatureIndex;if(!p||!m||n.id!==p.layerIds[0])return;const _=o.collisionBoxArray,x=p.layers[0].layout,b=p.layers[0].paint,T=Math.pow(2,this.transform.zoom-o.tileID.overscaledZ),E=o.tileSize/h.a4,I=o.tileID.toUnwrapped(),D=x.get("text-rotation-alignment")==="map",L=h.aM(o,1,this.transform.zoom),V=h.aN(this.collisionIndex.transform,o,b.get("text-translate"),b.get("text-translate-anchor")),N=h.aN(this.collisionIndex.transform,o,b.get("icon-translate"),b.get("icon-translate-anchor")),G=qe(D,this.transform,L);this.retainedQueryData[p.bucketInstanceId]=new ts(p.bucketInstanceId,m,p.sourceLayerIndex,p.index,o.tileID);const q={bucket:p,layout:x,translationText:V,translationIcon:N,unwrappedTileID:I,pitchedLabelPlaneMatrix:G,scale:T,textPixelRatio:E,holdingForFade:o.holdingForSymbolFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:h.ax(p.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(p.sourceID)};if(c)for(const Y of p.sortKeyRanges){const{sortKey:$,symbolInstanceStart:K,symbolInstanceEnd:J}=Y;e.push({sortKey:$,symbolInstanceStart:K,symbolInstanceEnd:J,parameters:q})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:p.symbolInstances.length,parameters:q})}attemptAnchorPlacement(e,n,o,c,p,m,_,x,b,T,E,I,D,L,V,N,G,q,Y,$){const K=h.aO[e.textAnchor],J=[e.textOffset0,e.textOffset1],H=Xl(K,o,c,J,p),it=this.collisionIndex.placeCollisionBox(n,I,x,b,T,_,m,N,E.predicate,Y,H,$);if((!q||this.collisionIndex.placeCollisionBox(q,I,x,b,T,_,m,G,E.predicate,Y,H,$).placeable)&&it.placeable){let ct;if(this.prevPlacement&&this.prevPlacement.variableOffsets[D.crossTileID]&&this.prevPlacement.placements[D.crossTileID]&&this.prevPlacement.placements[D.crossTileID].text&&(ct=this.prevPlacement.variableOffsets[D.crossTileID].anchor),D.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[D.crossTileID]={textOffset:J,width:o,height:c,anchor:K,textBoxScale:p,prevAnchor:ct},this.markUsedJustification(L,K,D,V),L.allowVerticalPlacement&&(this.markUsedOrientation(L,V,D),this.placedOrientations[D.crossTileID]=V),{shift:H,placedGlyphBoxes:it}}}placeLayerBucketPart(e,n,o){const{bucket:c,layout:p,translationText:m,translationIcon:_,unwrappedTileID:x,pitchedLabelPlaneMatrix:b,textPixelRatio:T,holdingForFade:E,collisionBoxArray:I,partiallyEvaluatedTextSize:D,collisionGroup:L}=e.parameters,V=p.get("text-optional"),N=p.get("icon-optional"),G=h.aP(p,"text-overlap","text-allow-overlap"),q=G==="always",Y=h.aP(p,"icon-overlap","icon-allow-overlap"),$=Y==="always",K=p.get("text-rotation-alignment")==="map",J=p.get("text-pitch-alignment")==="map",H=p.get("icon-text-fit")!=="none",it=p.get("symbol-z-order")==="viewport-y",ct=q&&($||!c.hasIconData()||N),st=$&&(q||!c.hasTextData()||V);!c.collisionArrays&&I&&c.deserializeCollisionBoxes(I);const at=this.retainedQueryData[c.bucketInstanceId].tileID,lt=this._getTerrainElevationFunc(at),St=this.transform.getFastPathSimpleProjectionMatrix(at),vt=(gt,At,qt)=>{var $t,ye;if(n[gt.crossTileID])return;if(E)return void(this.placements[gt.crossTileID]=new Co(!1,!1,!1));let xe=!1,Ae=!1,he=!0,Xe=null,Te={box:null,placeable:!1,offscreen:null,occluded:!1},Ge={placeable:!1},je=null,Ze=null,Fi=null,Dr=0,wr=0,sn=0;At.textFeatureIndex?Dr=At.textFeatureIndex:gt.useRuntimeCollisionCircles&&(Dr=gt.featureIndex),At.verticalTextFeatureIndex&&(wr=At.verticalTextFeatureIndex);const an=At.textBox;if(an){const Ni=Be=>{let De=h.ay.horizontal;if(c.allowVerticalPlacement&&!Be&&this.prevPlacement){const Ye=this.prevPlacement.placedOrientations[gt.crossTileID];Ye&&(this.placedOrientations[gt.crossTileID]=Ye,De=Ye,this.markUsedOrientation(c,De,gt))}return De},kr=(Be,De)=>{if(c.allowVerticalPlacement&&gt.numVerticalGlyphVertices>0&&At.verticalTextBox){for(const Ye of c.writingModes)if(Ye===h.ay.vertical?(Te=De(),Ge=Te):Te=Be(),Te&&Te.placeable)break}else Te=Be()},Ln=gt.textAnchorOffsetStartIndex,Fn=gt.textAnchorOffsetEndIndex;if(Fn===Ln){const Be=(De,Ye)=>{const de=this.collisionIndex.placeCollisionBox(De,G,T,at,x,J,K,m,L.predicate,lt,void 0,St);return de&&de.placeable&&(this.markUsedOrientation(c,Ye,gt),this.placedOrientations[gt.crossTileID]=Ye),de};kr(()=>Be(an,h.ay.horizontal),()=>{const De=At.verticalTextBox;return c.allowVerticalPlacement&&gt.numVerticalGlyphVertices>0&&De?Be(De,h.ay.vertical):{box:null,offscreen:null}}),Ni(Te&&Te.placeable)}else{let Be=h.aO[(ye=($t=this.prevPlacement)===null||$t===void 0?void 0:$t.variableOffsets[gt.crossTileID])===null||ye===void 0?void 0:ye.anchor];const De=(de,on,Xc)=>{const Yc=de.x2-de.x1,Kc=de.y2-de.y1,Bn=gt.textBoxScale,Yu=H&&Y==="never"?on:null;let ln=null,so=G==="never"?1:2,Sl="never";Be&&so++;for(let cn=0;cn<so;cn++){for(let Rr=Ln;Rr<Fn;Rr++){const Pl=c.textAnchorOffsets.get(Rr);if(Be&&Pl.textAnchor!==Be)continue;const Ml=this.attemptAnchorPlacement(Pl,de,Yc,Kc,Bn,K,J,T,at,x,L,Sl,gt,c,Xc,m,_,Yu,lt);if(Ml&&(ln=Ml.placedGlyphBoxes,ln&&ln.placeable))return xe=!0,Xe=Ml.shift,ln}Be?Be=null:Sl=G}return o&&!ln&&(ln={box:this.collisionIndex.placeCollisionBox(an,"always",T,at,x,J,K,m,L.predicate,lt,void 0,St).box,offscreen:!1,placeable:!1,occluded:!1}),ln};kr(()=>De(an,At.iconBox,h.ay.horizontal),()=>{const de=At.verticalTextBox;return c.allowVerticalPlacement&&(!Te||!Te.placeable)&&gt.numVerticalGlyphVertices>0&&de?De(de,At.verticalIconBox,h.ay.vertical):{box:null,occluded:!0,offscreen:null}}),Te&&(xe=Te.placeable,he=Te.offscreen);const Ye=Ni(Te&&Te.placeable);if(!xe&&this.prevPlacement){const de=this.prevPlacement.variableOffsets[gt.crossTileID];de&&(this.variableOffsets[gt.crossTileID]=de,this.markUsedJustification(c,de.anchor,gt,Ye))}}}if(je=Te,xe=je&&je.placeable,he=je&&je.offscreen,gt.useRuntimeCollisionCircles&&gt.centerJustifiedTextSymbolIndex>=0){const Ni=c.text.placedSymbolArray.get(gt.centerJustifiedTextSymbolIndex),kr=h.az(c.textSizeData,D,Ni),Ln=p.get("text-padding");Ze=this.collisionIndex.placeCollisionCircles(G,Ni,c.lineVertexArray,c.glyphOffsetArray,kr,x,b,o,J,L.predicate,gt.collisionCircleDiameter,Ln,m,lt),Ze.circles.length&&Ze.collisionDetected&&!o&&h.w("Collisions detected, but collision boxes are not shown"),xe=q||Ze.circles.length>0&&!Ze.collisionDetected,he=he&&Ze.offscreen}if(At.iconFeatureIndex&&(sn=At.iconFeatureIndex),At.iconBox){const Ni=kr=>this.collisionIndex.placeCollisionBox(kr,Y,T,at,x,J,K,_,L.predicate,lt,H&&Xe?Xe:void 0,St);Ge&&Ge.placeable&&At.verticalIconBox?(Fi=Ni(At.verticalIconBox),Ae=Fi.placeable):(Fi=Ni(At.iconBox),Ae=Fi.placeable),he=he&&Fi.offscreen}const Rn=V||gt.numHorizontalGlyphVertices===0&&gt.numVerticalGlyphVertices===0,Xi=N||gt.numIconVertices===0;Rn||Xi?Xi?Rn||(Ae=Ae&&xe):xe=Ae&&xe:Ae=xe=Ae&&xe;const zr=Ae&&Fi.placeable;if(xe&&je.placeable&&this.collisionIndex.insertCollisionBox(je.box,G,p.get("text-ignore-placement"),c.bucketInstanceId,Ge&&Ge.placeable&&wr?wr:Dr,L.ID),zr&&this.collisionIndex.insertCollisionBox(Fi.box,Y,p.get("icon-ignore-placement"),c.bucketInstanceId,sn,L.ID),Ze&&xe&&this.collisionIndex.insertCollisionCircles(Ze.circles,G,p.get("text-ignore-placement"),c.bucketInstanceId,Dr,L.ID),o&&this.storeCollisionData(c.bucketInstanceId,qt,At,je,Fi,Ze),gt.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(c.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[gt.crossTileID]=new Co((xe||ct)&&!je?.occluded,(Ae||st)&&!Fi?.occluded,he||c.justReloaded),n[gt.crossTileID]=!0};if(it){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const gt=c.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let At=gt.length-1;At>=0;--At){const qt=gt[At];vt(c.symbolInstances.get(qt),c.collisionArrays[qt],qt)}}else for(let gt=e.symbolInstanceStart;gt<e.symbolInstanceEnd;gt++)vt(c.symbolInstances.get(gt),c.collisionArrays[gt],gt);c.justReloaded=!1}storeCollisionData(e,n,o,c,p,m){if(o.textBox||o.iconBox){let _,x;this.collisionBoxArrays.has(e)?_=this.collisionBoxArrays.get(e):(_=new Map,this.collisionBoxArrays.set(e,_)),_.has(n)?x=_.get(n):(x={text:null,icon:null},_.set(n,x)),o.textBox&&(x.text=c.box),o.iconBox&&(x.icon=p.box)}if(m){let _=this.collisionCircleArrays[e];_===void 0&&(_=this.collisionCircleArrays[e]=[]);for(let x=0;x<m.circles.length;x+=4)_.push(m.circles[x+0]-Ee),_.push(m.circles[x+1]-Ee),_.push(m.circles[x+2]),_.push(m.collisionDetected?1:0)}}markUsedJustification(e,n,o,c){let p;p=c===h.ay.vertical?o.verticalPlacedTextSymbolIndex:{left:o.leftJustifiedTextSymbolIndex,center:o.centerJustifiedTextSymbolIndex,right:o.rightJustifiedTextSymbolIndex}[h.aQ(n)];const m=[o.leftJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.rightJustifiedTextSymbolIndex,o.verticalPlacedTextSymbolIndex];for(const _ of m)_>=0&&(e.text.placedSymbolArray.get(_).crossTileID=p>=0&&_!==p?0:o.crossTileID)}markUsedOrientation(e,n,o){const c=n===h.ay.horizontal||n===h.ay.horizontalOnly?n:0,p=n===h.ay.vertical?n:0,m=[o.leftJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.rightJustifiedTextSymbolIndex];for(const _ of m)e.text.placedSymbolArray.get(_).placedOrientation=c;o.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(o.verticalPlacedTextSymbolIndex).placedOrientation=p)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let o=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const c=n?n.symbolFadeChange(e):1,p=n?n.opacities:{},m=n?n.variableOffsets:{},_=n?n.placedOrientations:{};for(const x in this.placements){const b=this.placements[x],T=p[x];T?(this.opacities[x]=new Qn(T,c,b.text,b.icon),o=o||b.text!==T.text.placed||b.icon!==T.icon.placed):(this.opacities[x]=new Qn(null,c,b.text,b.icon,b.skipFade),o=o||b.text||b.icon)}for(const x in p){const b=p[x];if(!this.opacities[x]){const T=new Qn(b,c,!1,!1);T.isHidden()||(this.opacities[x]=T,o=o||b.text.placed||b.icon.placed)}}for(const x in m)this.variableOffsets[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.variableOffsets[x]=m[x]);for(const x in _)this.placedOrientations[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.placedOrientations[x]=_[x]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");o?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:e)}updateLayerOpacities(e,n){const o={};for(const c of n){const p=c.getBucket(e);p&&c.latestFeatureIndex&&e.id===p.layerIds[0]&&this.updateBucketOpacities(p,c.tileID,o,c.collisionBoxArray)}}updateBucketOpacities(e,n,o,c){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 p=e.layers[0],m=p.layout,_=new Qn(null,0,!1,!1,!0),x=m.get("text-allow-overlap"),b=m.get("icon-allow-overlap"),T=p._unevaluatedLayout.hasValue("text-variable-anchor")||p._unevaluatedLayout.hasValue("text-variable-anchor-offset"),E=m.get("text-rotation-alignment")==="map",I=m.get("text-pitch-alignment")==="map",D=m.get("icon-text-fit")!=="none",L=new Qn(null,0,x&&(b||!e.hasIconData()||m.get("icon-optional")),b&&(x||!e.hasTextData()||m.get("text-optional")),!0);!e.collisionArrays&&c&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(c);const V=(G,q,Y)=>{for(let $=0;$<q/4;$++)G.opacityVertexArray.emplaceBack(Y);G.hasVisibleVertices=G.hasVisibleVertices||Y!==Ir},N=this.collisionBoxArrays.get(e.bucketInstanceId);for(let G=0;G<e.symbolInstances.length;G++){const q=e.symbolInstances.get(G),{numHorizontalGlyphVertices:Y,numVerticalGlyphVertices:$,crossTileID:K}=q;let J=this.opacities[K];o[K]?J=_:J||(J=L,this.opacities[K]=J),o[K]=!0;const H=q.numIconVertices>0,it=this.placedOrientations[q.crossTileID],ct=it===h.ay.vertical,st=it===h.ay.horizontal||it===h.ay.horizontalOnly;if(Y>0||$>0){const lt=tc(J.text);V(e.text,Y,ct?Ir:lt),V(e.text,$,st?Ir:lt);const St=J.text.isHidden();[q.rightJustifiedTextSymbolIndex,q.centerJustifiedTextSymbolIndex,q.leftJustifiedTextSymbolIndex].forEach(At=>{At>=0&&(e.text.placedSymbolArray.get(At).hidden=St||ct?1:0)}),q.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(q.verticalPlacedTextSymbolIndex).hidden=St||st?1:0);const vt=this.variableOffsets[q.crossTileID];vt&&this.markUsedJustification(e,vt.anchor,q,it);const gt=this.placedOrientations[q.crossTileID];gt&&(this.markUsedJustification(e,"left",q,gt),this.markUsedOrientation(e,gt,q))}if(H){const lt=tc(J.icon),St=!(D&&q.verticalPlacedIconSymbolIndex&&ct);q.placedIconSymbolIndex>=0&&(V(e.icon,q.numIconVertices,St?lt:Ir),e.icon.placedSymbolArray.get(q.placedIconSymbolIndex).hidden=J.icon.isHidden()),q.verticalPlacedIconSymbolIndex>=0&&(V(e.icon,q.numVerticalIconVertices,St?Ir:lt),e.icon.placedSymbolArray.get(q.verticalPlacedIconSymbolIndex).hidden=J.icon.isHidden())}const at=N&&N.has(G)?N.get(G):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const lt=e.collisionArrays[G];if(lt){let St=new h.P(0,0);if(lt.textBox||lt.verticalTextBox){let vt=!0;if(T){const gt=this.variableOffsets[K];gt?(St=Xl(gt.anchor,gt.width,gt.height,gt.textOffset,gt.textBoxScale),E&&St._rotate(I?-this.transform.bearingInRadians:this.transform.bearingInRadians)):vt=!1}if(lt.textBox||lt.verticalTextBox){let gt;lt.textBox&&(gt=ct),lt.verticalTextBox&&(gt=st),Yl(e.textCollisionBox.collisionVertexArray,J.text.placed,!vt||gt,at.text,St.x,St.y)}}if(lt.iconBox||lt.verticalIconBox){const vt=!!(!st&&lt.verticalIconBox);let gt;lt.iconBox&&(gt=vt),lt.verticalIconBox&&(gt=!vt),Yl(e.iconCollisionBox.collisionVertexArray,J.icon.placed,gt,at.icon,D?St.x:0,D?St.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),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`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],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.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,n){const o=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*o>e}setStale(){this.stale=!0}}function Yl(d,e,n,o,c,p){o&&o.length!==0||(o=[0,0,0,0]);const m=o[0]-Ee,_=o[1]-Ee,x=o[2]-Ee,b=o[3]-Ee;d.emplaceBack(e?1:0,n?1:0,c||0,p||0,m,_),d.emplaceBack(e?1:0,n?1:0,c||0,p||0,x,_),d.emplaceBack(e?1:0,n?1:0,c||0,p||0,x,b),d.emplaceBack(e?1:0,n?1:0,c||0,p||0,m,b)}const Kl=Math.pow(2,25),Jl=Math.pow(2,24),Ao=Math.pow(2,17),Do=Math.pow(2,16),Ql=Math.pow(2,9),zo=Math.pow(2,8),ko=Math.pow(2,1);function tc(d){if(d.opacity===0&&!d.placed)return 0;if(d.opacity===1&&d.placed)return 4294967295;const e=d.placed?1:0,n=Math.floor(127*d.opacity);return n*Kl+e*Jl+n*Ao+e*Do+n*Ql+e*zo+n*ko+e}const Ir=0;class Ta{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,n,o,c,p){const m=this._bucketParts;for(;this._currentTileIndex<e.length;)if(n.getBucketParts(m,c,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,p())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,m.sort((_,x)=>_.sortKey-x.sortKey));this._currentPartIndex<m.length;)if(n.placeLayerBucketPart(m[this._currentPartIndex],this._seenCrossTileIDs,o),this._currentPartIndex++,p())return!0;return!1}}class ec{constructor(e,n,o,c,p,m,_,x){this.placement=new Mu(e,n,m,_,x),this._currentPlacementIndex=o.length-1,this._forceFullPlacement=c,this._showCollisionBoxes=p,this._done=!1}isDone(){return this._done}continuePlacement(e,n,o){const c=ne(),p=()=>!this._forceFullPlacement&&ne()-c>2;for(;this._currentPlacementIndex>=0;){const m=n[e[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(m.type==="symbol"&&(!m.minzoom||m.minzoom<=_)&&(!m.maxzoom||m.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new Ta(m)),this._inProgressLayer.continuePlacement(o[m.source],this.placement,this._showCollisionBoxes,m,p))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const _r=512/h.a4/2;class ic{constructor(e,n,o){this.tileID=e,this.bucketInstanceId=o,this._symbolsByKey={};const c=new Map;for(let p=0;p<n.length;p++){const m=n.get(p),_=m.key,x=c.get(_);x?x.push(m):c.set(_,[m])}for(const[p,m]of c){const _={positions:m.map(x=>({x:Math.floor(x.anchorX*_r),y:Math.floor(x.anchorY*_r)})),crossTileIDs:m.map(x=>x.crossTileID)};if(_.positions.length>128){const x=new h.aS(_.positions.length,16,Uint16Array);for(const{x:b,y:T}of _.positions)x.add(b,T);x.finish(),delete _.positions,_.index=x}this._symbolsByKey[p]=_}}getScaledCoordinates(e,n){const{x:o,y:c,z:p}=this.tileID.canonical,{x:m,y:_,z:x}=n.canonical,b=_r/Math.pow(2,x-p),T=(_*h.a4+e.anchorY)*b,E=c*h.a4*_r;return{x:Math.floor((m*h.a4+e.anchorX)*b-o*h.a4*_r),y:Math.floor(T-E)}}findMatches(e,n,o){const c=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let p=0;p<e.length;p++){const m=e.get(p);if(m.crossTileID)continue;const _=this._symbolsByKey[m.key];if(!_)continue;const x=this.getScaledCoordinates(m,n);if(_.index){const b=_.index.range(x.x-c,x.y-c,x.x+c,x.y+c).sort();for(const T of b){const E=_.crossTileIDs[T];if(!o[E]){o[E]=!0,m.crossTileID=E;break}}}else if(_.positions)for(let b=0;b<_.positions.length;b++){const T=_.positions[b],E=_.crossTileIDs[b];if(Math.abs(T.x-x.x)<=c&&Math.abs(T.y-x.y)<=c&&!o[E]){o[E]=!0,m.crossTileID=E;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}}class Iu{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Kr{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const n=Math.round((e-this.lng)/360);if(n!==0)for(const o in this.indexes){const c=this.indexes[o],p={};for(const m in c){const _=c[m];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+n),p[_.tileID.key]=_}this.indexes[o]=p}this.lng=e}addBucket(e,n,o){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let p=0;p<n.symbolInstances.length;p++)n.symbolInstances.get(p).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});const c=this.usedCrossTileIDs[e.overscaledZ];for(const p in this.indexes){const m=this.indexes[p];if(Number(p)>e.overscaledZ)for(const _ in m){const x=m[_];x.tileID.isChildOf(e)&&x.findMatches(n.symbolInstances,e,c)}else{const _=m[e.scaledTo(Number(p)).key];_&&_.findMatches(n.symbolInstances,e,c)}}for(let p=0;p<n.symbolInstances.length;p++){const m=n.symbolInstances.get(p);m.crossTileID||(m.crossTileID=o.generate(),c[m.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new ic(e,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(e,n){for(const o of n.getCrossTileIDsLists())for(const c of o)delete this.usedCrossTileIDs[e][c]}removeStaleBuckets(e){let n=!1;for(const o in this.indexes){const c=this.indexes[o];for(const p in c)e[c[p].bucketInstanceId]||(this.removeBucketCrossTileIDs(o,c[p]),delete c[p],n=!0)}return n}}class bn{constructor(){this.layerIndexes={},this.crossTileIDs=new Iu,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,n,o){let c=this.layerIndexes[e.id];c===void 0&&(c=this.layerIndexes[e.id]=new Kr);let p=!1;const m={};c.handleWrapJump(o);for(const _ of n){const x=_.getBucket(e);x&&e.id===x.layerIds[0]&&(x.bucketInstanceId||(x.bucketInstanceId=++this.maxBucketInstanceId),c.addBucket(_.tileID,x,this.crossTileIDs)&&(p=!0),m[x.bucketInstanceId]=!0)}return c.removeStaleBuckets(m)&&(p=!0),p}pruneUnusedLayers(e){const n={};e.forEach(o=>{n[o]=!0});for(const o in this.layerIndexes)n[o]||delete this.layerIndexes[o]}}var Jt="void main() {fragColor=vec4(1.0);}";const $i={prelude:ie(`#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
out highp vec4 fragColor;`,`#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;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+      c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+    c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+    c
);}
#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(texture(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=(texture(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
#ifdef GLOBE
if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}
#endif
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
}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;`),projectionMercator:ie("","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:ie("",`#define GLOBE_RADIUS 6371008.8
uniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos
);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY); 
if (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len
);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}`),background:ie(`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;
#ifdef OVERDRAW_INSPECTOR
fragColor=vec4(1.0);
#endif
}`,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:ie(`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;in vec2 v_pos_a;in 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=texture(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=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;
#ifdef OVERDRAW_INSPECTOR
fragColor=vec4(1.0);
#endif
}`,"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;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);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:ie(`in vec3 v_data;in 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);float antialiased_blur=v_data.z;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));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}
#ifdef OVERDRAW_INSPECTOR
fragColor=vec4(1.0);
#endif
}`,`uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out 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 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {
#ifdef GLOBE
vec3 center_vector=projectToSphere(circle_center);
#endif
float angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {
#ifdef GLOBE
vec4 projected_center=interpolateProjection(circle_center,center_vector,ele);
#else
vec4 projected_center=projectTileWithElevation(circle_center,ele);
#endif
corner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}
#ifdef GLOBE
vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);
#else
gl_Position=projectTileWithElevation(corner_position,ele);
#endif
} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}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;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:ie(Jt,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:ie(`uniform highp float u_intensity;in 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);fragColor=vec4(val,1.0,1.0,1.0);
#ifdef OVERDRAW_INSPECTOR
fragColor=vec4(1.0);
#endif
}`,`uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out 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 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.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;vec2 circle_center=floor(pos_raw/8.0);
#ifdef GLOBE
vec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);
#else
gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));
#endif
}`),heatmapTexture:ie(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;
#ifdef OVERDRAW_INSPECTOR
fragColor=vec4(0.0);
#endif
}`,"uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out 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:ie("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;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:ie("in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;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);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {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;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:ie(`#ifdef GL_ES
precision highp float;
#endif
uniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(u_color_ramp_size);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else
{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));
#ifdef OVERDRAW_INSPECTOR
fragColor=vec4(1.0);
#endif
}`,"uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:ie("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:ie(Jt,`in vec2 a_pos;void main() {
#ifdef GLOBE
gl_Position=projectTileFor3D(a_pos,0.0);
#else
gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);
#endif
}`),fill:ie(`#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
fragColor=color*opacity;
#ifdef OVERDRAW_INSPECTOR
fragColor=vec4(1.0);
#endif
}`,`uniform vec2 u_fill_translate;in vec2 a_pos;
#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=projectTile(a_pos+u_fill_translate,a_pos);}`),fillOutline:ie(`in vec2 v_pos;
#ifdef GLOBE
in float v_depth;
#endif
#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);fragColor=outline_color*(alpha*opacity);
#ifdef GLOBE
if (v_depth > 1.0) {discard;}
#endif
#ifdef OVERDRAW_INSPECTOR
fragColor=vec4(1.0);
#endif
}`,`uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;
#ifdef GLOBE
out float v_depth;
#endif
#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=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
#ifdef GLOBE
v_depth=gl_Position.z/gl_Position.w;
#endif
}`),fillOutlinePattern:ie(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;
#ifdef GLOBE
in float v_depth;
#endif
#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=texture(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=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;
#ifdef GLOBE
if (v_depth > 1.0) {discard;}
#endif
#ifdef OVERDRAW_INSPECTOR
fragColor=vec4(1.0);
#endif
}`,`uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;
#ifdef GLOBE
out float v_depth;
#endif
#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=projectTile(a_pos+u_fill_translate,a_pos);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;
#ifdef GLOBE
v_depth=gl_Position.z/gl_Position.w;
#endif
}`),fillPattern:ie(`#ifdef GL_ES
precision highp float;
#endif
uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in 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=texture(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=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;
#ifdef OVERDRAW_INSPECTOR
fragColor=vec4(1.0);
#endif
}`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out 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=projectTile(a_pos+u_fill_translate,a_pos);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:ie(`in vec4 v_color;void main() {fragColor=v_color;
#ifdef OVERDRAW_INSPECTOR
fragColor=vec4(1.0);
#endif
}`,`uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;
#ifdef TERRAIN3D
in vec2 a_centroid;
#endif
out 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);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
#ifdef GLOBE
vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
#else
gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
#endif
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;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);
#ifdef GLOBE
mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);
#endif
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:ie(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in 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=texture(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=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;
#ifdef OVERDRAW_INSPECTOR
fragColor=vec4(1.0);
#endif
}`,`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 vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;
#ifdef TERRAIN3D
in vec2 a_centroid;
#endif
#ifdef GLOBE
out vec3 v_sphere_pos;
#endif
out vec2 v_pos_a;out vec2 v_pos_b;out 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 elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
#ifdef GLOBE
vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
#else
gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
#endif
vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
? a_pos
: vec2(edgedistance,elevation*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:ie(`#ifdef GL_ES
precision highp float;
#endif
uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;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))*tileSize/pow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);
#ifdef OVERDRAW_INSPECTOR
fragColor=vec4(1.0);
#endif
}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out 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:ie(`uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];
#define PI 3.141592653589793
#define STANDARD 0
#define COMBINED 1
#define IGOR 2
#define MULTIDIRECTIONAL 3
#define BASIC 4
float get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;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_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else
{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else
{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);}
#ifdef OVERDRAW_INSPECTOR
fragColor=vec4(1.0);
#endif
}`,"uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:ie(`uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;
#ifdef GLOBE
in float v_depth;
#endif
#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);fragColor=color*(alpha*opacity);
#ifdef GLOBE
if (v_depth > 1.0) {discard;}
#endif
#ifdef OVERDRAW_INSPECTOR
fragColor=vec4(1.0);
#endif
}`,`
#define scale 0.015873016
in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;
#ifdef GLOBE
out float v_depth;
#endif
#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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
#ifdef GLOBE
v_depth=gl_Position.z/gl_Position.w;
#endif
#ifdef TERRAIN3D
v_gamma_scale=1.0;
#else
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
#endif
v_width2=vec2(outset,inset);}`),lineGradient:ie(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;
#ifdef GLOBE
in float v_depth;
#endif
#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=texture(u_image,v_uv);fragColor=color*(alpha*opacity);
#ifdef GLOBE
if (v_depth > 1.0) {discard;}
#endif
#ifdef OVERDRAW_INSPECTOR
fragColor=vec4(1.0);
#endif
}`,`
#define scale 0.015873016
in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;
#ifdef GLOBE
out float v_depth;
#endif
#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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
#ifdef GLOBE
v_depth=gl_Position.z/gl_Position.w;
#endif
#ifdef TERRAIN3D
v_gamma_scale=1.0;
#else
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
#endif
v_width2=vec2(outset,inset);}`),linePattern:ie(`#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;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;
#ifdef GLOBE
in float v_depth;
#endif
#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(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;
#ifdef GLOBE
if (v_depth > 1.0) {discard;}
#endif
#ifdef OVERDRAW_INSPECTOR
fragColor=vec4(1.0);
#endif
}`,`
#define scale 0.015873016
#define LINE_DISTANCE_SCALE 2.0
in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;
#ifdef GLOBE
out float v_depth;
#endif
#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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
#ifdef GLOBE
v_depth=gl_Position.z/gl_Position.w;
#endif
#ifdef TERRAIN3D
v_gamma_scale=1.0;
#else
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.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:ie(`uniform lowp float u_device_pixel_ratio;uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;
#ifdef GLOBE
in float v_depth;
#endif
#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
#pragma mapbox: define mediump vec4 dasharray_from
#pragma mapbox: define mediump vec4 dasharray_to
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
#pragma mapbox: initialize mediump vec4 dasharray_from
#pragma mapbox: initialize mediump vec4 dasharray_to
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=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);
#ifdef GLOBE
if (v_depth > 1.0) {discard;}
#endif
#ifdef OVERDRAW_INSPECTOR
fragColor=vec4(1.0);
#endif
}`,`
#define scale 0.015873016
#define LINE_DISTANCE_SCALE 2.0
in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;
#ifdef GLOBE
out float v_depth;
#endif
#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
#pragma mapbox: define mediump vec4 dasharray_from
#pragma mapbox: define mediump vec4 dasharray_to
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
#pragma mapbox: initialize mediump vec4 dasharray_from
#pragma mapbox: initialize mediump vec4 dasharray_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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
#ifdef GLOBE
v_depth=gl_Position.z/gl_Position.w;
#endif
#ifdef TERRAIN3D
v_gamma_scale=1.0;
#else
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
#endif
float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),lineGradientSDF:ie(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;
#ifdef GLOBE
in float v_depth;
#endif
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float width
#pragma mapbox: define lowp float floorwidth
#pragma mapbox: define mediump vec4 dasharray_from
#pragma mapbox: define mediump vec4 dasharray_to
void main() {
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float width
#pragma mapbox: initialize lowp float floorwidth
#pragma mapbox: initialize mediump vec4 dasharray_from
#pragma mapbox: initialize mediump vec4 dasharray_to
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=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity);
#ifdef GLOBE
if (v_depth > 1.0) {discard;}
#endif
#ifdef OVERDRAW_INSPECTOR
fragColor=vec4(1.0);
#endif
}`,`
#define scale 0.015873016
#define LINE_DISTANCE_SCALE 2.0
in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;
#ifdef GLOBE
out float v_depth;
#endif
#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
#pragma mapbox: define mediump vec4 dasharray_from
#pragma mapbox: define mediump vec4 dasharray_to
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
#pragma mapbox: initialize lowp float floorwidth
#pragma mapbox: initialize mediump vec4 dasharray_from
#pragma mapbox: initialize mediump vec4 dasharray_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;float texel_height=1.0/u_image_height;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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
#ifdef GLOBE
v_depth=gl_Position.z/gl_Position.w;
#endif
#ifdef TERRAIN3D
v_gamma_scale=1.0;
#else
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
#endif
float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),raster:ie(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in 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=texture(u_image0,v_pos0);vec4 color1=texture(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);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
#ifdef OVERDRAW_INSPECTOR
fragColor=vec4(1.0);
#endif
}`,`uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;
#ifdef GLOBE
if (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}
#endif
v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),symbolIcon:ie(`uniform sampler2D u_texture;in vec2 v_tex;in 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;fragColor=texture(u_texture,v_tex)*alpha;
#ifdef OVERDRAW_INSPECTOR
fragColor=vec4(1.0);
#endif
}`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in 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_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;out vec2 v_tex;out float v_fade_opacity;
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize lowp float opacity
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}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;
#ifdef GLOBE
if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
#endif
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:ie(`#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;in vec2 v_data0;in 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=texture(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);}fragColor=color*(alpha*opacity*fade_opacity);
#ifdef OVERDRAW_INSPECTOR
fragColor=vec4(1.0);
#endif
}`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in 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_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;out vec2 v_data0;out vec3 v_data1;
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}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;
#ifdef GLOBE
if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
#endif
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:ie(`#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;in vec4 v_data0;in 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;fragColor=texture(u_texture_icon,tex_icon)*alpha;
#ifdef OVERDRAW_INSPECTOR
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=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity);
#ifdef OVERDRAW_INSPECTOR
fragColor=vec4(1.0);
#endif
}`,`in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in 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_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;out vec4 v_data0;out vec4 v_data1;
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}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;
#ifdef GLOBE
if(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
#endif
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:ie("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;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in 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=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && 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);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out 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=projectTileFor3D(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:ie("in 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() {fragColor=pack(v_depth);}","in vec3 a_pos3d;uniform float u_ele_delta;out 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=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:ie("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","in vec3 a_pos3d;uniform float u_ele_delta;out 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=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}"),projectionErrorMeasurement:ie("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}"),atmosphere:ie(`in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758
);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}`,"in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:ie("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function ie(d,e){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,o=e.match(/in ([\w]+) ([\w]+)/g),c=d.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),p=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),m=p?p.concat(c):c,_={};return{fragmentSource:d=d.replace(n,(x,b,T,E,I)=>(_[I]=!0,b==="define"?`
#ifndef HAS_UNIFORM_u_${I}
in ${T} ${E} ${I};
#else
uniform ${T} ${E} u_${I};
#endif
`:`
#ifdef HAS_UNIFORM_u_${I}
    ${T} ${E} ${I} = u_${I};
#endif
`)),vertexSource:e=e.replace(n,(x,b,T,E,I)=>{const D=E==="float"?"vec2":"vec4",L=I.match(/color/)?"color":D;return _[I]?b==="define"?`
#ifndef HAS_UNIFORM_u_${I}
uniform lowp float u_${I}_t;
in ${T} ${D} a_${I};
out ${T} ${E} ${I};
#else
uniform ${T} ${E} u_${I};
#endif
`:L==="vec4"?`
#ifndef HAS_UNIFORM_u_${I}
    ${I} = a_${I};
#else
    ${T} ${E} ${I} = u_${I};
#endif
`:`
#ifndef HAS_UNIFORM_u_${I}
    ${I} = unpack_mix_${L}(a_${I}, u_${I}_t);
#else
    ${T} ${E} ${I} = u_${I};
#endif
`:b==="define"?`
#ifndef HAS_UNIFORM_u_${I}
uniform lowp float u_${I}_t;
in ${T} ${D} a_${I};
#else
uniform ${T} ${E} u_${I};
#endif
`:L==="vec4"?`
#ifndef HAS_UNIFORM_u_${I}
    ${T} ${E} ${I} = a_${I};
#else
    ${T} ${E} ${I} = u_${I};
#endif
`:`
#ifndef HAS_UNIFORM_u_${I}
    ${T} ${E} ${I} = unpack_mix_${L}(a_${I}, u_${I}_t);
#else
    ${T} ${E} ${I} = u_${I};
#endif
`}),staticAttributes:o,staticUniforms:m}}class Jr{constructor(e,n,o){this.vertexBuffer=e,this.indexBuffer=n,this.segments=o}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var We=h.aT([{name:"a_pos",type:"Int16",components:2}]);const pi="#define PROJECTION_MERCATOR",fi="mercator";class ti{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return fi}get shaderDefine(){return pi}get shaderPreludeCode(){return $i.projectionMercator}get vertexShaderPreludeCode(){return $i.projectionMercator.vertexSource}get subdivisionGranularity(){return h.aU.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(e){}getMeshFromTileID(e,n,o,c,p){if(this._cachedMesh)return this._cachedMesh;const m=new h.aV;m.emplaceBack(0,0),m.emplaceBack(h.a4,0),m.emplaceBack(0,h.a4),m.emplaceBack(h.a4,h.a4);const _=e.createVertexBuffer(m,We.members),x=h.aW.simpleSegment(0,0,4,2),b=new h.aX;b.emplaceBack(1,0,2),b.emplaceBack(1,2,3);const T=e.createIndexBuffer(b);return this._cachedMesh=new Jr(_,T,x),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}}class _e{constructor(e=0,n=0,o=0,c=0){if(isNaN(e)||e<0||isNaN(n)||n<0||isNaN(o)||o<0||isNaN(c)||c<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=n,this.left=o,this.right=c}interpolate(e,n,o){return n.top!=null&&e.top!=null&&(this.top=h.G.number(e.top,n.top,o)),n.bottom!=null&&e.bottom!=null&&(this.bottom=h.G.number(e.bottom,n.bottom,o)),n.left!=null&&e.left!=null&&(this.left=h.G.number(e.left,n.left,o)),n.right!=null&&e.right!=null&&(this.right=h.G.number(e.right,n.right,o)),this}getCenter(e,n){const o=h.an((this.left+e-this.right)/2,0,e),c=h.an((this.top+n-this.bottom)/2,0,n);return new h.P(o,c)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new _e(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function Sa(d,e){if(!d.renderWorldCopies||d.lngRange)return;const n=e.lng-d.center.lng;e.lng+=n>180?-360:n<-180?360:0}function Ti(d){return Math.max(0,Math.floor(d))}class zi{constructor(e,n){var o;this.applyConstrain=(c,p)=>this._constrainOverride!==null?this._constrainOverride(c,p):this._callbacks.defaultConstrain(c,p),this._callbacks=e,this._tileSize=512,this._renderWorldCopies=n?.renderWorldCopies===void 0||!!n?.renderWorldCopies,this._minZoom=n?.minZoom||0,this._maxZoom=n?.maxZoom||22,this._minPitch=n?.minPitch==null?0:n?.minPitch,this._maxPitch=n?.maxPitch==null?60:n?.maxPitch,this._constrainOverride=(o=n?.constrainOverride)!==null&&o!==void 0?o:null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new h.V(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Ti(this._zoom),this._scale=h.aq(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new _e,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,n,o){this._constrainOverride=e.constrainOverride,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._tileZoom=Ti(this._zoom),this._scale=h.aq(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new _e(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=!o&&e.autoCalculateNearFarZ,n&&this.constrainInternal(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(e){this._minZoom!==e&&(this._minZoom=e,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(e){this._minPitch!==e&&(this._minPitch=e,this.setPitch(Math.max(this.pitch,e)))}get maxPitch(){return this._maxPitch}setMaxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.setPitch(Math.min(this.pitch,e)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get constrainOverride(){return this._constrainOverride}setConstrainOverride(e){e===void 0&&(e=null),this._constrainOverride!==e&&(this._constrainOverride=e,this.constrainInternal(),this._calcMatrices())}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._bearingInRadians/Math.PI*180}setBearing(e){const n=h.W(e,-180,180)*Math.PI/180;var o,c,p,m,_,x,b,T,E;this._bearingInRadians!==n&&(this._unmodified=!1,this._bearingInRadians=n,this._calcMatrices(),this._rotationMatrix=ke(),o=this._rotationMatrix,p=-this._bearingInRadians,m=(c=this._rotationMatrix)[0],_=c[1],x=c[2],b=c[3],T=Math.sin(p),E=Math.cos(p),o[0]=m*E+x*T,o[1]=_*E+b*T,o[2]=m*-T+x*E,o[3]=_*-T+b*E)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){const n=h.an(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==n&&(this._unmodified=!1,this._pitchInRadians=n,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){const n=e/180*Math.PI;this._rollInRadians!==n&&(this._unmodified=!1,this._rollInRadians=n,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return h.aY(this._fovInRadians)}setFov(e){e=h.an(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=h.ap(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){const n=this.applyConstrain(this._center,e).zoom;this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this._tileZoom=Math.max(0,Math.floor(n)),this._scale=h.aq(n),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(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)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(e,n){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=n,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,n,o){this._unmodified=!1,this._edgeInsets.interpolate(e,n,o),this.constrainInternal(),this._calcMatrices()}resize(e,n,o=!0){this._width=e,this._height=n,o&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){return this._latRange&&this._latRange.length===2&&this._lngRange&&this._lngRange.length===2?new Ie([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]]):null}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-h.ao,h.ao])}getCameraQueryGeometry(e,n){if(n.length===1)return[n[0],e];{const{minX:o,minY:c,maxX:p,maxY:m}=h.ab.fromPoints(n).extend(e);return[new h.P(o,c),new h.P(p,c),new h.P(p,m),new h.P(o,m),new h.P(o,c)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const e=this._unmodified,{center:n,zoom:o}=this.applyConstrain(this.center,this.zoom);this.setCenter(n),this.setZoom(o),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=h.ar(new Float64Array(16));h.Q(e,e,[this._width/2,-this._height/2,1]),h.O(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=h.ar(new Float64Array(16)),h.Q(e,e,[1,-1,1]),h.O(e,e,[-1,-1,0]),h.Q(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,n,o,c){const p=o!==void 0?o:this.bearing,m=c=c!==void 0?c:this.pitch,_=h.aa.fromLngLat(e,n),x=-Math.cos(h.ap(m)),b=Math.sin(h.ap(m)),T=b*Math.sin(h.ap(p)),E=-b*Math.cos(h.ap(p));let I=this.elevation;const D=n-I;let L;x*D>=0||Math.abs(x)<.1?(L=1e4,I=n+L*x):L=-D/x;let V,N,G=h.aZ(1,_.y),q=0;do{if(q+=1,q>10)break;N=L/G,V=new h.aa(_.x+T*N,_.y+E*N),G=1/V.meterInMercatorCoordinateUnits()}while(Math.abs(L-N*G)>1e-12);return{center:V.toLngLat(),elevation:I,zoom:h.at(this.height/2/Math.tan(this.fovInRadians/2)/N/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e==0)return;const n=h.as(1,this.center.lat)*this.worldSize,o=this.cameraToCenterDistance/n,c=h.aa.fromLngLat(this.center,this.elevation),p=rt(this.center,this.elevation,this.pitch,this.bearing,o);this._elevation=e;const m=this.calculateCenterFromCameraLngLatAlt(p.toLngLat(),h.aZ(p.z,c.y),this.bearing,this.pitch);this._elevation=m.elevation,this._center=m.center,this.setZoom(m.zoom)}getCameraPoint(){const e=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new h.P(e*Math.sin(this.rollInRadians),e*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){const e=h.as(1,this.center.lat)*this.worldSize;return rt(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/e).toLngLat()}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];const n=e.canonical.z>=0?1<<e.canonical.z:Math.pow(2,e.canonical.z);return[e.canonical.x/n,e.canonical.y/n,1/n/h.a4,1/n/h.a4]}}class mi{constructor(e,n){this.min=e,this.max=n,this.center=h.a_([],h.a$([],this.min,this.max),.5)}quadrant(e){const n=[e%2==0,e<2],o=h.b0(this.min),c=h.b0(this.max);for(let p=0;p<n.length;p++)o[p]=n[p]?this.min[p]:this.center[p],c[p]=n[p]?this.center[p]:this.max[p];return c[2]=this.max[2],new mi(o,c)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersectsFrustum(e){let n=!0;for(let o=0;o<e.planes.length;o++){const c=this.intersectsPlane(e.planes[o]);if(c===0)return 0;c===1&&(n=!1)}return n?2:e.aabb.min[0]>this.max[0]||e.aabb.min[1]>this.max[1]||e.aabb.min[2]>this.max[2]||e.aabb.max[0]<this.min[0]||e.aabb.max[1]<this.min[1]||e.aabb.max[2]<this.min[2]?0:1}intersectsPlane(e){let n=e[3],o=e[3];for(let c=0;c<3;c++)e[c]>0?(n+=e[c]*this.min[c],o+=e[c]*this.max[c]):(o+=e[c]*this.min[c],n+=e[c]*this.max[c]);return n>=0?2:o<0?0:1}}class rc{distanceToTile2d(e,n,o,c){const p=c.distanceX([e,n]),m=c.distanceY([e,n]);return Math.hypot(p,m)}getWrap(e,n,o){return o}getTileBoundingVolume(e,n,o,c){var p,m;let _=0,x=0;if(c?.terrain){const T=new h.a1(e.z,n,e.z,e.x,e.y),E=c.terrain.getMinMaxElevation(T);_=(p=E.minElevation)!==null&&p!==void 0?p:Math.min(0,o),x=(m=E.maxElevation)!==null&&m!==void 0?m:Math.max(0,o)}const b=1<<e.z;return new mi([n+e.x/b,e.y/b,_],[n+(e.x+1)/b,(e.y+1)/b,x])}allowVariableZoom(e,n){const o=e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height,c=h.an(78.5-o/2,0,60);return!!n.terrain||e.pitch>c}allowWorldCopies(){return!0}prepareNextFrame(){}}class Qr{constructor(e,n,o){this.points=e,this.planes=n,this.aabb=o}static fromInvProjectionMatrix(e,n=1,o=0,c,p){const m=p?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],_=Math.pow(2,o),x=[[-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(I=>function(D,L,V,N){const G=h.aG([],D,L),q=1/G[3]/V*N;return h.b5(G,G,[q,q,1/G[3],q])}(I,e,n,_));c&&function(I,D,L,V){const N=V?4:0,G=V?0:4;let q=0;const Y=[],$=[];for(let H=0;H<4;H++){const it=h.b1([],I[H+G],I[H+N]),ct=h.b6(it);h.a_(it,it,1/ct),Y.push(ct),$.push(it)}for(let H=0;H<4;H++){const it=h.b7(I[H+N],$[H],L);q=it!==null&&it>=0?Math.max(q,it):Math.max(q,Y[H])}const K=function(H,it){const ct=h.b1([],H[it[0]],H[it[1]]),st=h.b1([],H[it[2]],H[it[1]]),at=[0,0,0,0];return h.b2(at,h.b3([],ct,st)),at[3]=-h.b4(at,H[it[0]]),at}(I,D),J=function(H,it){const ct=h.b8(H),st=h.b9([],H,1/ct),at=h.b1([],it,h.a_([],st,h.b4(it,st))),lt=h.b8(at);if(lt>0){const St=Math.sqrt(1-st[3]*st[3]),vt=h.a_([],st,-st[3]),gt=h.a$([],vt,h.a_([],at,St/lt));return h.ba(it,gt)}return null}(L,K);if(J!==null){const H=J/h.b4($[0],K);q=Math.min(q,H)}for(let H=0;H<4;H++){const it=Math.min(q,Y[H]);I[H+G]=[I[H+N][0]+$[H][0]*it,I[H+N][1]+$[H][1]*it,I[H+N][2]+$[H][2]*it,1]}}(x,m[0],c,p);const b=m.map(I=>{const D=h.b1([],x[I[0]],x[I[1]]),L=h.b1([],x[I[2]],x[I[1]]),V=h.b2([],h.b3([],D,L)),N=-h.b4(V,x[I[1]]);return V.concat(N)}),T=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],E=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const I of x)for(let D=0;D<3;D++)T[D]=Math.min(T[D],I[D]),E[D]=Math.max(E[D],I[D]);return new Qr(x,b,new mi(T,E))}}class be{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,n,o){return this._helper.interpolatePadding(e,n,o)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,n,o=!0){this._helper.resize(e,n,o)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,n){this._helper.overrideNearFarZ(e,n)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e,n){}constructor(e){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(n,o)=>{o=h.an(+o,this.minZoom,this.maxZoom);const c={center:new h.V(n.lng,n.lat),zoom:o};let p=this._helper._lngRange;if(!this._helper._renderWorldCopies&&p===null){const $=179.9999999999;p=[-$,$]}const m=this.tileSize*h.aq(c.zoom);let _=0,x=m,b=0,T=m,E=0,I=0;const{x:D,y:L}=this.size;if(this._helper._latRange){const $=this._helper._latRange;_=h.X($[1])*m,x=h.X($[0])*m,x-_<L&&(E=L/(x-_))}p&&(b=h.W(h.Y(p[0])*m,0,m),T=h.W(h.Y(p[1])*m,0,m),T<b&&(T+=m),T-b<D&&(I=D/(T-b)));const{x:V,y:N}=W(m,n);let G,q;const Y=Math.max(I||0,E||0);if(Y){const $=new h.P(I?(T+b)/2:V,E?(x+_)/2:N);return c.center=X(m,$).wrap(),c.zoom+=h.at(Y),c}if(this._helper._latRange){const $=L/2;N-$<_&&(q=_+$),N+$>x&&(q=x-$)}if(p){const $=(b+T)/2;let K=V;this._helper._renderWorldCopies&&(K=h.W(V,$-m/2,$+m/2));const J=D/2;K-J<b&&(G=b+J),K+J>T&&(G=T-J)}if(G!==void 0||q!==void 0){const $=new h.P(G??V,q??N);c.center=X(m,$).wrap()}return c},this.applyConstrain=(n,o)=>this._helper.applyConstrain(n,o),this._helper=new zi({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(n,o)=>this.defaultConstrain(n,o)},e),this._coveringTilesDetailsProvider=new rc}clone(){const e=new be;return e.apply(this),e}apply(e,n,o){this._helper.apply(e,n,o)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(e){const n=[new h.bb(0,e)];if(this._helper._renderWorldCopies){const o=this.screenPointToMercatorCoordinate(new h.P(0,0)),c=this.screenPointToMercatorCoordinate(new h.P(this._helper._width,0)),p=this.screenPointToMercatorCoordinate(new h.P(this._helper._width,this._helper._height)),m=this.screenPointToMercatorCoordinate(new h.P(0,this._helper._height)),_=Math.floor(Math.min(o.x,c.x,p.x,m.x)),x=Math.floor(Math.max(o.x,c.x,p.x,m.x)),b=1;for(let T=_-b;T<=x+b;T++)T!==0&&n.push(new h.bb(T,e))}return n}getCameraFrustum(){return Qr.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){const n=this.screenPointToLocation(this.centerPoint,e),o=e?e.getElevationForLngLatZoom(n,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(o)}setLocationAtPoint(e,n){const o=h.as(this.elevation,this.center.lat),c=this.screenPointToMercatorCoordinateAtZ(n,o),p=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,o),m=h.aa.fromLngLat(e),_=new h.aa(m.x-(c.x-p.x),m.y-(c.y-p.y));this.setCenter(_?.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(e,n){return n?this.coordinatePoint(h.aa.fromLngLat(e),n.getElevationForLngLatZoom(e,this._helper._tileZoom),this._pixelMatrix3D):this.coordinatePoint(h.aa.fromLngLat(e))}screenPointToLocation(e,n){var o;return(o=this.screenPointToMercatorCoordinate(e,n))===null||o===void 0?void 0:o.toLngLat()}screenPointToMercatorCoordinate(e,n){if(n){const o=n.pointCoordinate(e);if(o!=null)return o}return this.screenPointToMercatorCoordinateAtZ(e)}screenPointToMercatorCoordinateAtZ(e,n){const o=n||0,c=[e.x,e.y,0,1],p=[e.x,e.y,1,1];h.aG(c,c,this._pixelMatrixInverse),h.aG(p,p,this._pixelMatrixInverse);const m=c[3],_=p[3],x=c[1]/m,b=p[1]/_,T=c[2]/m,E=p[2]/_,I=T===E?0:(o-T)/(E-T);return new h.aa(h.G.number(c[0]/m,p[0]/_,I)/this.worldSize,h.G.number(x,b,I)/this.worldSize,o)}coordinatePoint(e,n=0,o=this._pixelMatrix){const c=[e.x*this.worldSize,e.y*this.worldSize,n,1];return h.aG(c,c,o),new h.P(c[0]/c[3],c[1]/c[3])}getBounds(){const e=Math.max(0,this._helper._height/2-nt(this));return new Ie().extend(this.screenPointToLocation(new h.P(0,e))).extend(this.screenPointToLocation(new h.P(this._helper._width,e))).extend(this.screenPointToLocation(new h.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new h.P(0,this._helper._height)))}isPointOnMapSurface(e,n){return n?n.pointCoordinate(e)!=null:e.y>this.height/2-nt(this)}calculatePosMatrix(e,n=!1,o){var c;const p=(c=e.key)!==null&&c!==void 0?c:h.bc(e.wrap,e.canonical.z,e.canonical.z,e.canonical.x,e.canonical.y),m=n?this._alignedPosMatrixCache:this._posMatrixCache;if(m.has(p)){const b=m.get(p);return o?b.f32:b.f64}const _=U(e,this.worldSize);h.S(_,n?this._alignedProjMatrix:this._viewProjMatrix,_);const x={f64:_,f32:new Float32Array(_)};return m.set(p,x),o?x.f32:x.f64}calculateFogMatrix(e){const n=e.key,o=this._fogMatrixCacheF32;if(o.has(n))return o.get(n);const c=U(e,this.worldSize);return h.S(c,this._fogMatrix,c),o.set(n,new Float32Array(c)),o.get(n)}calculateCenterFromCameraLngLatAlt(e,n,o,c){return this._helper.calculateCenterFromCameraLngLatAlt(e,n,o,c)}_calculateNearFarZIfNeeded(e,n,o){if(!this._helper.autoCalculateNearFarZ)return;const c=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),p=e-c*this._helper._pixelPerMeter/Math.cos(n),m=c<0?p:e,_=Math.PI/2+this.pitchInRadians,x=h.ap(this.fov)*(Math.abs(Math.cos(h.ap(this.roll)))*this.height+Math.abs(Math.sin(h.ap(this.roll)))*this.width)/this.height*(.5+o.y/this.height),b=Math.sin(x)*m/Math.sin(h.an(Math.PI-_-x,.01,Math.PI-.01)),T=nt(this),E=Math.atan(T/this._helper.cameraToCenterDistance),I=h.ap(.75),D=E>I?2*E*(.5+o.y/(2*T)):I,L=Math.sin(D)*m/Math.sin(h.an(Math.PI-_-D,.01,Math.PI-.01)),V=Math.min(b,L);this._helper._farZ=1.01*(Math.cos(Math.PI/2-n)*V+m),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const e=this.centerOffset,n=W(this.worldSize,this.center),o=n.x,c=n.y;this._helper._pixelPerMeter=h.as(1,this.center.lat)*this.worldSize;const p=h.ap(Math.min(this.pitch,B)),m=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(p));let _;this._calculateNearFarZIfNeeded(m,p,e),_=new Float64Array(16),h.bd(_,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),h.aA(this._invProjMatrix,_),_[8]=2*-e.x/this._helper._width,_[9]=2*e.y/this._helper._height,this._projectionMatrix=h.be(_),h.Q(_,_,[1,-1,1]),h.O(_,_,[0,0,-this._helper.cameraToCenterDistance]),h.bf(_,_,-this.rollInRadians),h.bg(_,_,this.pitchInRadians),h.bf(_,_,-this.bearingInRadians),h.O(_,_,[-o,-c,0]),this._mercatorMatrix=h.Q([],_,[this.worldSize,this.worldSize,this.worldSize]),h.Q(_,_,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=h.S(new Float64Array(16),this.clipSpaceToPixelsMatrix,_),h.O(_,_,[0,0,-this.elevation]),this._viewProjMatrix=_,this._invViewProjMatrix=h.aA([],_);const x=[0,0,-1,1];h.aG(x,x,this._invViewProjMatrix),this._cameraPosition=[x[0]/x[3],x[1]/x[3],x[2]/x[3]],this._fogMatrix=new Float64Array(16),h.bd(this._fogMatrix,this.fovInRadians,this.width/this.height,m,this._helper._farZ),this._fogMatrix[8]=2*-e.x/this.width,this._fogMatrix[9]=2*e.y/this.height,h.Q(this._fogMatrix,this._fogMatrix,[1,-1,1]),h.O(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),h.bf(this._fogMatrix,this._fogMatrix,-this.rollInRadians),h.bg(this._fogMatrix,this._fogMatrix,this.pitchInRadians),h.bf(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),h.O(this._fogMatrix,this._fogMatrix,[-o,-c,0]),h.Q(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),h.O(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=h.S(new Float64Array(16),this.clipSpaceToPixelsMatrix,_);const b=this._helper._width%2/2,T=this._helper._height%2/2,E=Math.cos(this.bearingInRadians),I=Math.sin(-this.bearingInRadians),D=o-Math.round(o)+E*b+I*T,L=c-Math.round(c)+E*T+I*b,V=new Float64Array(_);if(h.O(V,V,[D>.5?D-1:D,L>.5?L-1:L,0]),this._alignedProjMatrix=V,_=h.aA(new Float64Array(16),this._pixelMatrix),!_)throw new Error("failed to invert matrix");this._pixelMatrixInverse=_,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;const e=this.screenPointToMercatorCoordinate(new h.P(0,0)),n=[e.x*this.worldSize,e.y*this.worldSize,0,1];return h.aG(n,n,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const e=h.as(1,this.center.lat)*this.worldSize;return rt(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/e).toLngLat()}lngLatToCameraDepth(e,n){const o=h.aa.fromLngLat(e),c=[o.x*this.worldSize,o.y*this.worldSize,n,1];return h.aG(c,c,this._viewProjMatrix),c[2]/c[3]}getProjectionData(e){const{overscaledTileID:n,aligned:o,applyTerrainMatrix:c}=e,p=this._helper.getMercatorTileCoordinates(n),m=n?this.calculatePosMatrix(n,o,!0):null;let _;return _=n&&n.terrainRttPosMatrix32f&&c?n.terrainRttPosMatrix32f:m||h.bh(),{mainMatrix:_,tileMercatorCoords:p,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:_}}isLocationOccluded(e){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(e,n,o){return 1}transformLightDirection(e){return h.b0(e)}getRayDirectionFromPixel(e){throw new Error("Not implemented.")}projectTileCoordinates(e,n,o,c){const p=this.calculatePosMatrix(o);let m;c?(m=[e,n,c(e,n),1],h.aG(m,m,p)):(m=[e,n,0,1],Ds(m,m,p));const _=m[3];return{point:new h.P(m[0]/_,m[1]/_),signedDistanceFromCamera:_,isOccluded:!1}}populateCache(e){for(const n of e)this.calculatePosMatrix(n)}getMatrixForModel(e,n){const o=h.aa.fromLngLat(e,n),c=o.meterInMercatorCoordinateUnits(),p=h.bi();return h.O(p,p,[o.x,o.y,o.z]),h.bf(p,p,Math.PI),h.bg(p,p,Math.PI/2),h.Q(p,p,[-c,c,c]),p}getProjectionDataForCustomLayer(e=!0){const n=new h.a1(0,0,0,0,0),o=this.getProjectionData({overscaledTileID:n,applyGlobeMatrix:e}),c=U(n,this.worldSize);h.S(c,this._viewProjMatrix,c),o.tileMercatorCoords=[0,0,1,1];const p=[h.a4,h.a4,this.worldSize/this._helper.pixelsPerMeter],m=h.bj();return h.Q(m,c,p),o.fallbackMatrix=m,o.mainMatrix=m,o}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}}function es(){h.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function tn(d){if(d.useSlerp)if(d.k<1){const e=h.bk(d.startEulerAngles.roll,d.startEulerAngles.pitch,d.startEulerAngles.bearing),n=h.bk(d.endEulerAngles.roll,d.endEulerAngles.pitch,d.endEulerAngles.bearing),o=new Float64Array(4);h.bl(o,e,n,d.k);const c=h.bm(o);d.tr.setRoll(c.roll),d.tr.setPitch(c.pitch),d.tr.setBearing(c.bearing)}else d.tr.setRoll(d.endEulerAngles.roll),d.tr.setPitch(d.endEulerAngles.pitch),d.tr.setBearing(d.endEulerAngles.bearing);else d.tr.setRoll(h.G.number(d.startEulerAngles.roll,d.endEulerAngles.roll,d.k)),d.tr.setPitch(h.G.number(d.startEulerAngles.pitch,d.endEulerAngles.pitch,d.k)),d.tr.setBearing(h.G.number(d.startEulerAngles.bearing,d.endEulerAngles.bearing,d.k))}function zs(d,e,n,o,c){const p=c.padding,m=W(c.worldSize,n.getNorthWest()),_=W(c.worldSize,n.getNorthEast()),x=W(c.worldSize,n.getSouthEast()),b=W(c.worldSize,n.getSouthWest()),T=h.ap(-o),E=m.rotate(T),I=_.rotate(T),D=x.rotate(T),L=b.rotate(T),V=new h.P(Math.max(E.x,I.x,L.x,D.x),Math.max(E.y,I.y,L.y,D.y)),N=new h.P(Math.min(E.x,I.x,L.x,D.x),Math.min(E.y,I.y,L.y,D.y)),G=V.sub(N),q=(c.width-(p.left+p.right+e.left+e.right))/G.x,Y=(c.height-(p.top+p.bottom+e.top+e.bottom))/G.y;if(Y<0||q<0)return void es();const $=Math.min(h.at(c.scale*Math.min(q,Y)),d.maxZoom),K=h.P.convert(d.offset),J=new h.P((e.left-e.right)/2,(e.top-e.bottom)/2).rotate(h.ap(o)),H=K.add(J).mult(c.scale/h.aq($));return{center:X(c.worldSize,m.add(x).div(2).sub(H)),zoom:$,bearing:o}}class ki{get useGlobeControls(){return!1}handlePanInertia(e,n){const o=e.mag(),c=Math.abs(nt(n));return{easingOffset:e.mult(Math.min(.75*c/o,1)),easingCenter:n.center}}handleMapControlsRollPitchBearingZoom(e,n){e.bearingDelta&&n.setBearing(n.bearing+e.bearingDelta),e.pitchDelta&&n.setPitch(n.pitch+e.pitchDelta),e.rollDelta&&n.setRoll(n.roll+e.rollDelta),e.zoomDelta&&n.setZoom(n.zoom+e.zoomDelta)}handleMapControlsPan(e,n,o){e.around.distSqr(n.centerPoint)<.01||n.setLocationAtPoint(o,e.around)}cameraForBoxAndBearing(e,n,o,c,p){return zs(e,n,o,c,p)}handleJumpToCenterZoom(e,n){e.zoom!==(n.zoom!==void 0?+n.zoom:e.zoom)&&e.setZoom(+n.zoom),n.center!==void 0&&e.setCenter(h.V.convert(n.center))}handleEaseTo(e,n){const o=e.zoom,c=e.padding,p={roll:e.roll,pitch:e.pitch,bearing:e.bearing},m={roll:n.roll===void 0?e.roll:n.roll,pitch:n.pitch===void 0?e.pitch:n.pitch,bearing:n.bearing===void 0?e.bearing:n.bearing},_=n.zoom!==void 0,x=!e.isPaddingEqual(n.padding);let b=!1;const T=_?+n.zoom:e.zoom;let E=e.centerPoint.add(n.offsetAsPoint);const I=e.screenPointToLocation(E),{center:D,zoom:L}=e.applyConstrain(h.V.convert(n.center||I),T??o);Sa(e,D);const V=W(e.worldSize,I),N=W(e.worldSize,D).sub(V),G=h.aq(L-o);return b=L!==o,{easeFunc:q=>{if(b&&e.setZoom(h.G.number(o,L,q)),h.bn(p,m)||tn({startEulerAngles:p,endEulerAngles:m,tr:e,k:q,useSlerp:p.roll!=m.roll}),x&&(e.interpolatePadding(c,n.padding,q),E=e.centerPoint.add(n.offsetAsPoint)),n.around)e.setLocationAtPoint(n.around,n.aroundPoint);else{const Y=h.aq(e.zoom-o),$=L>o?Math.min(2,G):Math.max(.5,G),K=Math.pow($,1-q),J=X(e.worldSize,V.add(N.mult(q*K)).mult(Y));e.setLocationAtPoint(e.renderWorldCopies?J.wrap():J,E)}},isZooming:b,elevationCenter:D}}handleFlyTo(e,n){const o=n.zoom!==void 0,c=e.zoom,p=e.applyConstrain(h.V.convert(n.center||n.locationAtOffset),o?+n.zoom:c),m=p.center,_=p.zoom;Sa(e,m);const x=W(e.worldSize,n.locationAtOffset),b=W(e.worldSize,m).sub(x),T=b.mag(),E=h.aq(_-c);let I;if(n.minZoom!==void 0){const D=Math.min(+n.minZoom,c,_),L=e.applyConstrain(m,D).zoom;I=h.aq(L-c)}return{easeFunc:(D,L,V,N)=>{e.setZoom(D===1?_:c+h.at(L));const G=D===1?m:X(e.worldSize,x.add(b.mult(V)).mult(L));e.setLocationAtPoint(e.renderWorldCopies?G.wrap():G,N)},scaleOfZoom:E,targetCenter:m,scaleOfMinZoom:I,pixelPathLength:T}}}class we{constructor(e,n,o){this.blendFunction=e,this.blendColor=n,this.mask=o}}we.Replace=[1,0],we.disabled=new we(we.Replace,h.bo.transparent,[!1,!1,!1,!1]),we.unblended=new we(we.Replace,h.bo.transparent,[!0,!0,!0,!0]),we.alphaBlended=new we([1,771],h.bo.transparent,[!0,!0,!0,!0]);const yr=2305;class se{constructor(e,n,o){this.enable=e,this.mode=n,this.frontFace=o}}se.disabled=new se(!1,1029,yr),se.backCCW=new se(!0,1029,yr),se.frontCCW=new se(!0,1028,yr);class Xt{constructor(e,n,o){this.func=e,this.mask=n,this.range=o}}Xt.ReadOnly=!1,Xt.ReadWrite=!0,Xt.disabled=new Xt(519,Xt.ReadOnly,[0,1]);const is=7680;class re{constructor(e,n,o,c,p,m){this.test=e,this.ref=n,this.mask=o,this.fail=c,this.depthFail=p,this.pass=m}}re.disabled=new re({func:519,mask:0},0,0,is,is,is);const rs=new WeakMap;function rr(d){var e;if(rs.has(d))return rs.get(d);{const n=(e=d.getParameter(d.VERSION))===null||e===void 0?void 0:e.startsWith("WebGL 2.0");return rs.set(d,n),n}}class ks{get awaitingQuery(){return!!this._readbackQueue}constructor(e){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=e;const n=e.context,o=n.gl;this._texFormat=o.RGBA,this._texType=o.UNSIGNED_BYTE;const c=new h.aV;c.emplaceBack(-1,-1),c.emplaceBack(2,-1),c.emplaceBack(-1,2);const p=new h.aX;p.emplaceBack(0,1,2),this._fullscreenTriangle=new Jr(n.createVertexBuffer(c,We.members),n.createIndexBuffer(p),h.aW.simpleSegment(0,0,c.length,p.length)),this._resultBuffer=new Uint8Array(4),n.activeTexture.set(o.TEXTURE1);const m=o.createTexture();o.bindTexture(o.TEXTURE_2D,m),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.NEAREST),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.NEAREST),o.texImage2D(o.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=n.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(m),rr(o)&&(this._pbo=o.createBuffer(),o.bindBuffer(o.PIXEL_PACK_BUFFER,this._pbo),o.bufferData(o.PIXEL_PACK_BUFFER,4,o.STREAM_READ),o.bindBuffer(o.PIXEL_PACK_BUFFER,null))}destroy(){const e=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),e.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(e,n){const o=this._updateCount;return this._readbackQueue?o>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():o>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(e,n),this._updateCount++,this._measuredError}_bindFramebuffer(){const e=this._cachedRenderContext.context,n=e.gl;e.activeTexture.set(n.TEXTURE1),n.bindTexture(n.TEXTURE_2D,this._fbo.colorAttachment.get()),e.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(e,n){const o=this._cachedRenderContext.context,c=o.gl;if(this._bindFramebuffer(),o.viewport.set([0,0,this._texWidth,this._texHeight]),o.clear({color:h.bo.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(o,c.TRIANGLES,Xt.disabled,re.disabled,we.unblended,se.disabled,((p,m)=>({u_input:p,u_output_expected:m}))(e,n),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&rr(c)){c.bindBuffer(c.PIXEL_PACK_BUFFER,this._pbo),c.readBuffer(c.COLOR_ATTACHMENT0),c.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),c.bindBuffer(c.PIXEL_PACK_BUFFER,null);const p=c.fenceSync(c.SYNC_GPU_COMMANDS_COMPLETE,0);c.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:p}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){const e=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&rr(e)){const n=e.clientWaitSync(this._readbackQueue.sync,0,0);if(n===e.WAIT_FAILED)return h.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(n===e.TIMEOUT_EXPIRED)return;e.bindBuffer(e.PIXEL_PACK_BUFFER,this._pbo),e.getBufferSubData(e.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),e.bindBuffer(e.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),e.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=ks._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(e){let n=0;return n+=e[0]/256,n+=e[1]/65536,n+=e[2]/16777216,e[3]<127&&(n=-n),n/128}}const wn=h.a4/128;function Pa(d,e){const n=d.granularity!==void 0?Math.max(d.granularity,1):1,o=n+(d.generateBorders?2:0),c=n+(d.extendToNorthPole||d.generateBorders?1:0)+(d.extendToSouthPole||d.generateBorders?1:0),p=o+1,m=c+1,_=d.generateBorders?-1:0,x=d.generateBorders||d.extendToNorthPole?-1:0,b=n+(d.generateBorders?1:0),T=n+(d.generateBorders||d.extendToSouthPole?1:0),E=p*m,I=o*c*6,D=p*m>65536;if(D&&e==="16bit")throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const L=D||e==="32bit",V=new Int16Array(2*E);let N=0;for(let Y=x;Y<=T;Y++)for(let $=_;$<=b;$++){let K=$/n*h.a4;$===-1&&(K=-wn),$===n+1&&(K=h.a4+wn);let J=Y/n*h.a4;Y===-1&&(J=d.extendToNorthPole?h.bq:-wn),Y===n+1&&(J=d.extendToSouthPole?h.br:h.a4+wn),V[N++]=K,V[N++]=J}const G=L?new Uint32Array(I):new Uint16Array(I);let q=0;for(let Y=0;Y<c;Y++)for(let $=0;$<o;$++){const K=$+1+Y*p,J=$+(Y+1)*p,H=$+1+(Y+1)*p;G[q++]=$+Y*p,G[q++]=J,G[q++]=K,G[q++]=K,G[q++]=J,G[q++]=H}return{vertices:V.buffer.slice(0),indices:G.buffer.slice(0),uses32bitIndices:L}}const Rs=new h.aU({fill:new h.bs(128,2),line:new h.bs(512,0),tile:new h.bs(128,32),stencil:new h.bs(128,1),circle:3});class Ls{constructor(){this._tileMeshCache={},this._errorCorrectionUsable=0,this._errorMeasurementLastValue=0,this._errorCorrectionPreviousValue=0,this._errorMeasurementLastChangeTime=-1e3}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return $i.projectionGlobe}get vertexShaderPreludeCode(){return $i.projectionMercator.vertexSource}get subdivisionGranularity(){return Rs}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(e){this._errorMeasurement||(this._errorMeasurement=new ks(e));const n=h.X(this._errorQueryLatitudeDegrees),o=2*Math.atan(Math.exp(Math.PI-n*Math.PI*2))-.5*Math.PI,c=this._errorMeasurement.updateErrorLoop(n,o),p=ne();c!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=c,this._errorMeasurementLastChangeTime=p);const m=Math.min(Math.max((p-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=h.bt(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,h.bu(m))}_getMeshKey(e){return`${e.granularity.toString(36)}_${e.generateBorders?"b":""}${e.extendToNorthPole?"n":""}${e.extendToSouthPole?"s":""}`}getMeshFromTileID(e,n,o,c,p){const m=(p==="stencil"?Rs.stencil:Rs.tile).getGranularityForZoomLevel(n.z);return this._getMesh(e,{granularity:m,generateBorders:o,extendToNorthPole:n.y===0&&c,extendToSouthPole:n.y===(1<<n.z)-1&&c})}_getMesh(e,n){const o=this._getMeshKey(n);if(o in this._tileMeshCache)return this._tileMeshCache[o];const c=function(p,m){const _=Pa(m,"16bit"),x=h.aV.deserialize({arrayBuffer:_.vertices,length:_.vertices.byteLength/2/2}),b=h.aX.deserialize({arrayBuffer:_.indices,length:_.indices.byteLength/2/3});return new Jr(p.createVertexBuffer(x,We.members),p.createIndexBuffer(b),h.aW.simpleSegment(0,0,x.length,b.length))}(e,n);return this._tileMeshCache[o]=c,c}recalculate(e){}hasTransition(){const e=ne();let n=!1;return n=n||(e-this._errorMeasurementLastChangeTime)/1e3<.7,n=n||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,n}setErrorQueryLatitudeDegrees(e){this._errorQueryLatitudeDegrees=e}}const Ma=new h.t({type:new h.D(h.u.projection.type)});class ns extends h.E{constructor(e){super(),this._transitionable=new h.x(Ma,void 0),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new h.H(0)),this._mercatorProjection=new ti,this._verticalPerspectiveProjection=new Ls}get transitionState(){const e=this.properties.get("type");if(typeof e=="string"&&e==="mercator")return 0;if(typeof e=="string"&&e==="vertical-perspective")return 1;if(e instanceof h.bv){if(e.from==="vertical-perspective"&&e.to==="mercator")return 1-e.transition;if(e.from==="mercator"&&e.to==="vertical-perspective")return e.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(e){this._mercatorProjection.updateGPUdependent(e),this._verticalPerspectiveProjection.updateGPUdependent(e)}getMeshFromTileID(e,n,o,c,p){return this.currentProjection.getMeshFromTileID(e,n,o,c,p)}setProjection(e){this._transitionable.setValue("type",e?.type||"mercator")}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}setErrorQueryLatitudeDegrees(e){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(e),this._mercatorProjection.setErrorQueryLatitudeDegrees(e)}}function nc(d){const e=Ia(d.worldSize,d.center.lat);return 2*Math.PI*e}function xr(d,e,n,o,c){const p=1/(1<<c),m=e/h.a4*p+o*p,_=h.bx((d/h.a4*p+n*p)*Math.PI*2+Math.PI,2*Math.PI),x=2*Math.atan(Math.exp(Math.PI-m*Math.PI*2))-.5*Math.PI,b=Math.cos(x),T=new Float64Array(3);return T[0]=Math.sin(_)*b,T[1]=Math.sin(x),T[2]=Math.cos(_)*b,T}function li(d){return function(e,n){const o=Math.cos(n),c=new Float64Array(3);return c[0]=Math.sin(e)*o,c[1]=Math.sin(n),c[2]=Math.cos(e)*o,c}(d.lng*Math.PI/180,d.lat*Math.PI/180)}function Ia(d,e){return d/(2*Math.PI)/Math.cos(e*Math.PI/180)}function sc(d){const e=Math.asin(d[1])/Math.PI*180,n=Math.sqrt(d[0]*d[0]+d[2]*d[2]);if(n>1e-6){const o=d[0]/n,c=Math.acos(d[2]/n),p=(o>0?c:-c)/Math.PI*180;return new h.V(h.W(p,-180,180),e)}return new h.V(0,e)}function ci(d){return Math.cos(d*Math.PI/180)}function He(d,e){const n=ci(d),o=ci(e);return h.at(o/n)}function nr(d,e){const n=d.rotate(e.bearingInRadians),o=e.zoom+He(e.center.lat,0),c=h.bt(1/ci(e.center.lat),1/ci(Math.min(Math.abs(e.center.lat),60)),h.bw(o,7,3,0,1)),p=360/nc({worldSize:e.worldSize,center:{lat:e.center.lat}});return new h.V(e.center.lng-n.x*p*c,h.an(e.center.lat+n.y*p,-h.ao,h.ao))}function ss(d){const e=.5*d,n=Math.sin(e),o=Math.cos(e);return Math.log(n+o)-Math.log(o-n)}function Ro(d,e,n,o){const c=d.lat+n*o;if(Math.abs(n)>1){const p=(Math.sign(d.lat+n)!==Math.sign(d.lat)?-Math.abs(d.lat):Math.abs(d.lat))*Math.PI/180,m=Math.abs(d.lat+n)*Math.PI/180,_=ss(p+o*(m-p)),x=ss(p),b=ss(m);return new h.V(d.lng+e*((_-x)/(b-x)),c)}return new h.V(d.lng+e*o,c)}class ac{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=e}swapBuffers(){if(!this._hadAnyChanges)return;const e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(e,n,o,c){const p=`${e.z}_${e.x}_${e.y}_${c?.terrain?"t":""}`,m=this._cache.get(p);if(m)return m;const _=this._cachePrevious.get(p);if(_)return this._cache.set(p,_),_;const x=this._boundingVolumeFactory(e,n,o,c);return this._cache.set(p,x),this._hadAnyChanges=!0,x}}class sr{constructor(e,n,o,c){this.min=o,this.max=c,this.points=e,this.planes=n}static fromAabb(e,n){const o=[];for(let c=0;c<8;c++)o.push([1&~c?e[0]:n[0],(c>>1&1)==1?n[1]:e[1],(c>>2&1)==1?n[2]:e[2]]);return new sr(o,[[-1,0,0,n[0]],[1,0,0,-e[0]],[0,-1,0,n[1]],[0,1,0,-e[1]],[0,0,-1,n[2]],[0,0,1,-e[2]]],e,n)}static fromCenterSizeAngles(e,n,o){const c=h.bA([],o[0],o[1],o[2]),p=h.bB([],[n[0],0,0],c),m=h.bB([],[0,n[1],0],c),_=h.bB([],[0,0,n[2]],c),x=[...e],b=[...e];for(let E=0;E<8;E++)for(let I=0;I<3;I++){const D=e[I]+p[I]*(1&~E?-1:1)+m[I]*((E>>1&1)==1?1:-1)+_[I]*((E>>2&1)==1?1:-1);x[I]=Math.min(x[I],D),b[I]=Math.max(b[I],D)}const T=[];for(let E=0;E<8;E++){const I=[...e];h.a$(I,I,h.a_([],p,1&~E?-1:1)),h.a$(I,I,h.a_([],m,(E>>1&1)==1?1:-1)),h.a$(I,I,h.a_([],_,(E>>2&1)==1?1:-1)),T.push(I)}return new sr(T,[[...p,-h.b4(p,T[0])],[...m,-h.b4(m,T[0])],[..._,-h.b4(_,T[0])],[-p[0],-p[1],-p[2],-h.b4(p,T[7])],[-m[0],-m[1],-m[2],-h.b4(m,T[7])],[-_[0],-_[1],-_[2],-h.b4(_,T[7])]],x,b)}intersectsFrustum(e){let n=!0;const o=this.points.length,c=this.planes.length,p=e.planes.length,m=e.points.length;for(let _=0;_<p;_++){const x=e.planes[_];let b=0;for(let T=0;T<o;T++){const E=this.points[T];x[0]*E[0]+x[1]*E[1]+x[2]*E[2]+x[3]>=0&&b++}if(b===0)return 0;b<o&&(n=!1)}if(n)return 2;for(let _=0;_<c;_++){const x=this.planes[_];let b=0;for(let T=0;T<m;T++){const E=e.points[T];x[0]*E[0]+x[1]*E[1]+x[2]*E[2]+x[3]>=0&&b++}if(b===0)return 0}return 1}intersectsPlane(e){const n=this.points.length;let o=0;for(let c=0;c<n;c++){const p=this.points[c];e[0]*p[0]+e[1]*p[1]+e[2]*p[2]+e[3]>=0&&o++}return o===n?2:o===0?0:1}}function Ea(d,e,n){const o=d-e;return o<0?-o:Math.max(0,o-n)}function Lo(d,e,n,o,c){const p=d-n;let m;return m=p<0?Math.min(-p,1+p-c):p>1?Math.min(Math.max(p-c,0),1-p):0,Math.max(m,Ea(e,o,c))}class Eu{constructor(){this._boundingVolumeCache=new ac(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,n,o,c){const p=1<<o.z,m=1/p,_=o.x/p,x=o.y/p;let b=2;return b=Math.min(b,Lo(e,n,_,x,m)),b=Math.min(b,Lo(e,n,_+.5,-x-m,m)),b=Math.min(b,Lo(e,n,_+.5,2-x-m,m)),b}getWrap(e,n,o){const c=1<<n.z,p=1/c,m=n.x/c,_=Ea(e.x,m,p),x=Ea(e.x,m-1,p),b=Ea(e.x,m+1,p),T=Math.min(_,x,b);return T===b?1:T===x?-1:0}allowVariableZoom(e,n){return Ot(e,n)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,n,o,c){return this._boundingVolumeCache.getTileBoundingVolume(e,n,o,c)}_computeTileBoundingVolume(e,n,o,c){var p,m;let _=0,x=0;if(c?.terrain){const b=new h.a1(e.z,n,e.z,e.x,e.y),T=c.terrain.getMinMaxElevation(b);_=(p=T.minElevation)!==null&&p!==void 0?p:Math.min(0,o),x=(m=T.maxElevation)!==null&&m!==void 0?m:Math.max(0,o)}if(_/=h.bD,x/=h.bD,_+=1,x+=1,e.z<=0)return sr.fromAabb([-x,-x,-x],[x,x,x]);if(e.z===1)return sr.fromAabb([e.x===0?-x:0,e.y===0?0:-x,-x],[e.x===0?0:x,e.y===0?x:0,x]);{const b=[xr(0,0,e.x,e.y,e.z),xr(h.a4,0,e.x,e.y,e.z),xr(h.a4,h.a4,e.x,e.y,e.z),xr(0,h.a4,e.x,e.y,e.z)],T=[];for(const at of b)T.push(h.a_([],at,x));if(x!==_)for(const at of b)T.push(h.a_([],at,_));e.y===0&&T.push([0,1,0]),e.y===(1<<e.z)-1&&T.push([0,-1,0]);const E=[1,1,1],I=[-1,-1,-1];for(const at of T)for(let lt=0;lt<3;lt++)E[lt]=Math.min(E[lt],at[lt]),I[lt]=Math.max(I[lt],at[lt]);const D=xr(h.a4/2,h.a4/2,e.x,e.y,e.z),L=h.b3([],[0,1,0],D);h.b2(L,L);const V=h.b3([],D,L);h.b2(V,V);const N=h.b3([],b[2],b[1]);h.b2(N,N);const G=h.b3([],b[0],b[3]);h.b2(G,G),T.push(h.a_([],D,x)),e.y>=(1<<e.z)/2&&T.push(h.a_([],xr(h.a4/2,0,e.x,e.y,e.z),x)),e.y<(1<<e.z)/2&&T.push(h.a_([],xr(h.a4/2,h.a4,e.x,e.y,e.z),x));const q=oc(D,T),Y=oc(V,T),$=[-D[0],-D[1],-D[2],q.max],K=[D[0],D[1],D[2],-q.min],J=[-V[0],-V[1],-V[2],Y.max],H=[V[0],V[1],V[2],-Y.min],it=[...N,0],ct=[...G,0],st=[];return e.y===0?st.push(h.bC(ct,it,$),h.bC(ct,it,K)):st.push(h.bC(J,it,$),h.bC(J,it,K),h.bC(J,ct,$),h.bC(J,ct,K)),e.y===(1<<e.z)-1?st.push(h.bC(ct,it,$),h.bC(ct,it,K)):st.push(h.bC(H,it,$),h.bC(H,it,K),h.bC(H,ct,$),h.bC(H,ct,K)),new sr(st,[$,K,J,H,it,ct],E,I)}}}function oc(d,e){let n=1/0,o=-1/0;for(const c of e){const p=h.b4(d,c);n=Math.min(n,p),o=Math.max(o,p)}return{min:n,max:o}}class Ca{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,n,o){return this._helper.interpolatePadding(e,n,o)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,n){this._helper.resize(e,n)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,n){this._helper.overrideNearFarZ(e,n)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e){}constructor(e){this._cachedClippingPlane=h.bE(),this._projectionMatrix=h.bi(),this._globeViewProjMatrix32f=h.bh(),this._globeViewProjMatrixNoCorrection=h.bi(),this._globeViewProjMatrixNoCorrectionInverted=h.bi(),this._globeProjMatrixInverted=h.bi(),this._cameraPosition=h.by(),this._globeLatitudeErrorCorrectionRadians=0,this.defaultConstrain=(n,o)=>{const c=h.an(n.lat,-h.ao,h.ao),p=h.an(+o,this.minZoom+He(0,c),this.maxZoom);return{center:new h.V(n.lng,c),zoom:p}},this.applyConstrain=(n,o)=>this._helper.applyConstrain(n,o),this._helper=new zi({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(n,o)=>this.defaultConstrain(n,o)},e),this._coveringTilesDetailsProvider=new Eu}clone(){const e=new Ca;return e.apply(this),e}apply(e,n){this._globeLatitudeErrorCorrectionRadians=n||0,this._helper.apply(e)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){const e=h.by();return e[0]=this._cameraPosition[0],e[1]=this._cameraPosition[1],e[2]=this._cameraPosition[2],e}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(e){const{overscaledTileID:n,applyGlobeMatrix:o}=e,c=this._helper.getMercatorTileCoordinates(n);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:c,clippingPlane:this._cachedClippingPlane,projectionTransition:o?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(e){const n=this.pitchInRadians,o=this.cameraToCenterDistance/e,c=Math.sin(n)*o,p=Math.cos(n)*o+1,m=1/Math.sqrt(c*c+p*p)*1;let _=-c,x=p;const b=Math.sqrt(_*_+x*x);_/=b,x/=b;const T=[0,_,x];h.bF(T,T,[0,0,0],-this.bearingInRadians),h.bG(T,T,[0,0,0],-1*this.center.lat*Math.PI/180),h.bH(T,T,[0,0,0],this.center.lng*Math.PI/180);const E=1/h.b6(T);return h.a_(T,T,E),[...T,-m*E]}isLocationOccluded(e){return!this.isSurfacePointVisible(li(e))}transformLightDirection(e){const n=this._helper._center.lng*Math.PI/180,o=this._helper._center.lat*Math.PI/180,c=Math.cos(o),p=[Math.sin(n)*c,Math.sin(o),Math.cos(n)*c],m=[p[2],0,-p[0]],_=[0,0,0];h.b3(_,m,p),h.b2(m,m),h.b2(_,_);const x=[0,0,0];return h.b2(x,[m[0]*e[0]+_[0]*e[1]+p[0]*e[2],m[1]*e[0]+_[1]*e[1]+p[1]*e[2],m[2]*e[0]+_[2]*e[1]+p[2]*e[2]]),x}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(e,n,o){const c=function(_,x,b){const T=1/(1<<b.z);return new h.aa(_/h.a4*T+b.x*T,x/h.a4*T+b.y*T)}(e,n,o.canonical),p=(m=c.y,[h.bx(c.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-m*Math.PI*2))-.5*Math.PI]);var m;return this.getCircleRadiusCorrection()/Math.cos(p[1])}projectTileCoordinates(e,n,o,c){const p=o.canonical,m=xr(e,n,p.x,p.y,p.z),_=1+(c?c(e,n):0)/h.bD,x=[m[0]*_,m[1]*_,m[2]*_,1];h.aG(x,x,this._globeViewProjMatrixNoCorrection);const b=this._cachedClippingPlane,T=b[0]*m[0]+b[1]*m[1]+b[2]*m[2]+b[3]<0;return{point:new h.P(x[0]/x[3],x[1]/x[3]),signedDistanceFromCamera:x[3],isOccluded:T}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;const e=Ia(this.worldSize,this.center.lat),n=h.bj(),o=h.bj();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*e),h.bd(n,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);const c=this.centerOffset;n[8]=2*-c.x/this._helper._width,n[9]=2*c.y/this._helper._height,this._projectionMatrix=h.be(n),this._globeProjMatrixInverted=h.bj(),h.aA(this._globeProjMatrixInverted,n),h.O(n,n,[0,0,-this.cameraToCenterDistance]),h.bf(n,n,this.rollInRadians),h.bg(n,n,-this.pitchInRadians),h.bf(n,n,this.bearingInRadians),h.O(n,n,[0,0,-e]);const p=h.by();p[0]=e,p[1]=e,p[2]=e,h.bg(o,n,this.center.lat*Math.PI/180),h.bI(o,o,-this.center.lng*Math.PI/180),h.Q(o,o,p),this._globeViewProjMatrixNoCorrection=o,h.bg(n,n,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),h.bI(n,n,-this.center.lng*Math.PI/180),h.Q(n,n,p),this._globeViewProjMatrix32f=new Float32Array(n),this._globeViewProjMatrixNoCorrectionInverted=h.bj(),h.aA(this._globeViewProjMatrixNoCorrectionInverted,o);const m=h.by();this._cameraPosition=h.by(),this._cameraPosition[2]=this.cameraToCenterDistance/e,h.bF(this._cameraPosition,this._cameraPosition,m,-this.rollInRadians),h.bG(this._cameraPosition,this._cameraPosition,m,this.pitchInRadians),h.bF(this._cameraPosition,this._cameraPosition,m,-this.bearingInRadians),h.a$(this._cameraPosition,this._cameraPosition,[0,0,1]),h.bG(this._cameraPosition,this._cameraPosition,m,-this.center.lat*Math.PI/180),h.bH(this._cameraPosition,this._cameraPosition,m,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(e);const _=h.be(this._globeViewProjMatrixNoCorrectionInverted);h.Q(_,_,[1,1,-1]),this._cachedFrustum=Qr.fromInvProjectionMatrix(_,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(e){h.w("calculateFogMatrix is not supported on globe projection.");const n=h.bj();return h.ar(n),n}getVisibleUnwrappedCoordinates(e){return[new h.bb(0,e)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){e&&h.w("terrain is not fully supported on vertical perspective projection."),this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,n){if(!this._globeViewProjMatrixNoCorrection)return 1;const o=li(e);h.a_(o,o,1+n/h.bD);const c=h.bE();return h.aG(c,[o[0],o[1],o[2],1],this._globeViewProjMatrixNoCorrection),c[2]/c[3]}populateCache(e){}getBounds(){const e=.5*this.width,n=.5*this.height,o=[new h.P(0,0),new h.P(e,0),new h.P(this.width,0),new h.P(this.width,n),new h.P(this.width,this.height),new h.P(e,this.height),new h.P(0,this.height),new h.P(0,n)],c=[];for(const E of o)c.push(this.unprojectScreenPoint(E));let p=0,m=0,_=0,x=0;const b=this.center;for(const E of c){const I=h.bJ(b.lng,E.lng),D=h.bJ(b.lat,E.lat);I<m&&(m=I),I>p&&(p=I),D<x&&(x=D),D>_&&(_=D)}const T=[b.lng+m,b.lat+x,b.lng+p,b.lat+_];return this.isSurfacePointOnScreen([0,1,0])&&(T[3]=90,T[0]=-180,T[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(T[1]=-90,T[0]=-180,T[2]=180),new Ie(T)}calculateCenterFromCameraLngLatAlt(e,n,o,c){return this._helper.calculateCenterFromCameraLngLatAlt(e,n,o,c)}setLocationAtPoint(e,n){const o=li(this.unprojectScreenPoint(n)),c=li(e),p=h.by();h.bK(p);const m=h.by();h.bH(m,o,p,-this.center.lng*Math.PI/180),h.bG(m,m,p,this.center.lat*Math.PI/180);const _=c[0]*c[0]+c[2]*c[2],x=m[0]*m[0];if(_<x)return;const b=Math.sqrt(_-x),T=-b,E=h.bL(c[0],c[2],m[0],b),I=h.bL(c[0],c[2],m[0],T),D=h.by();h.bH(D,c,p,-E);const L=h.bL(D[1],D[2],m[1],m[2]),V=h.by();h.bH(V,c,p,-I);const N=h.bL(V[1],V[2],m[1],m[2]),G=.5*Math.PI,q=L>=-G&&L<=G,Y=N>=-G&&N<=G;let $,K;if(q&&Y){const ct=this.center.lng*Math.PI/180,st=this.center.lat*Math.PI/180;h.bM(E,ct)+h.bM(L,st)<h.bM(I,ct)+h.bM(N,st)?($=E,K=L):($=I,K=N)}else if(q)$=E,K=L;else{if(!Y)return;$=I,K=N}const J=$/Math.PI*180,H=K/Math.PI*180,it=this.center.lat;this.setCenter(new h.V(J,h.an(H,-90,90))),this.setZoom(this.zoom+He(it,this.center.lat))}locationToScreenPoint(e,n){const o=li(e);if(n){const c=n.getElevationForLngLatZoom(e,this._helper._tileZoom);h.a_(o,o,1+c/h.bD)}return this._projectSurfacePointToScreen(o)}_projectSurfacePointToScreen(e){const n=h.bE();return h.aG(n,[...e,1],this._globeViewProjMatrixNoCorrection),n[0]/=n[3],n[1]/=n[3],new h.P((.5*n[0]+.5)*this.width,(.5*-n[1]+.5)*this.height)}screenPointToMercatorCoordinate(e,n){if(n){const o=n.pointCoordinate(e);if(o)return o}return h.aa.fromLngLat(this.unprojectScreenPoint(e))}screenPointToLocation(e,n){var o;return(o=this.screenPointToMercatorCoordinate(e,n))===null||o===void 0?void 0:o.toLngLat()}isPointOnMapSurface(e,n){const o=this._cameraPosition,c=this.getRayDirectionFromPixel(e);return!!this.rayPlanetIntersection(o,c)}getRayDirectionFromPixel(e){const n=h.bE();n[0]=e.x/this.width*2-1,n[1]=-1*(e.y/this.height*2-1),n[2]=1,n[3]=1,h.aG(n,n,this._globeViewProjMatrixNoCorrectionInverted),n[0]/=n[3],n[1]/=n[3],n[2]/=n[3];const o=h.by();o[0]=n[0]-this._cameraPosition[0],o[1]=n[1]-this._cameraPosition[1],o[2]=n[2]-this._cameraPosition[2];const c=h.by();return h.b2(c,o),c}isSurfacePointVisible(e){const n=this._cachedClippingPlane;return n[0]*e[0]+n[1]*e[1]+n[2]*e[2]+n[3]>=0}isSurfacePointOnScreen(e){if(!this.isSurfacePointVisible(e))return!1;const n=h.bE();return h.aG(n,[...e,1],this._globeViewProjMatrixNoCorrection),n[0]/=n[3],n[1]/=n[3],n[2]/=n[3],n[0]>-1&&n[0]<1&&n[1]>-1&&n[1]<1&&n[2]>-1&&n[2]<1}rayPlanetIntersection(e,n){const o=h.b4(e,n),c=h.by(),p=h.by();h.a_(p,n,o),h.b1(c,e,p);const m=1-h.b4(c,c);if(m<0)return null;const _=h.b4(e,e)-1,x=-o+(o<0?1:-1)*Math.sqrt(m),b=_/x,T=x;return{tMin:Math.min(b,T),tMax:Math.max(b,T)}}unprojectScreenPoint(e){const n=this._cameraPosition,o=this.getRayDirectionFromPixel(e),c=this.rayPlanetIntersection(n,o);if(c){const T=h.by();h.a$(T,n,[o[0]*c.tMin,o[1]*c.tMin,o[2]*c.tMin]);const E=h.by();return h.b2(E,T),sc(E)}const p=this._cachedClippingPlane,m=p[0]*o[0]+p[1]*o[1]+p[2]*o[2],_=-h.ba(p,n)/m,x=h.by();if(_>0)h.a$(x,n,[o[0]*_,o[1]*_,o[2]*_]);else{const T=h.by();h.a$(T,n,[2*o[0],2*o[1],2*o[2]]);const E=h.ba(this._cachedClippingPlane,T);h.b1(x,T,[this._cachedClippingPlane[0]*E,this._cachedClippingPlane[1]*E,this._cachedClippingPlane[2]*E])}const b=function(T){const E=h.by();return E[0]=T[0]*-T[3],E[1]=T[1]*-T[3],E[2]=T[2]*-T[3],{center:E,radius:Math.sqrt(1-T[3]*T[3])}}(p);return sc(function(T,E,I){const D=h.by();h.b1(D,I,T);const L=h.by();return h.bz(L,T,D,E/h.b8(D)),L}(b.center,b.radius,x))}getMatrixForModel(e,n){const o=h.V.convert(e),c=1/h.bD,p=h.bi();return h.bI(p,p,o.lng/180*Math.PI),h.bg(p,p,-o.lat/180*Math.PI),h.O(p,p,[0,0,1+n/h.bD]),h.bg(p,p,.5*Math.PI),h.Q(p,p,[c,c,c]),p}getProjectionDataForCustomLayer(e=!0){const n=this.getProjectionData({overscaledTileID:new h.a1(0,0,0,0,0),applyGlobeMatrix:e});return n.tileMercatorCoords=[0,0,1,1],n}getFastPathSimpleProjectionMatrix(e){}}class Aa{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,n,o){return this._helper.interpolatePadding(e,n,o)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,n,o=!0){this._helper.resize(e,n,o)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,n){this._helper.overrideNearFarZ(e,n)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(e,n){this._globeness=e,this._globeLatitudeErrorCorrectionRadians=n,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(e){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this.defaultConstrain=(n,o)=>this.currentTransform.defaultConstrain(n,o),this.applyConstrain=(n,o)=>this._helper.applyConstrain(n,o),this._helper=new zi({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(n,o)=>this.defaultConstrain(n,o)},e),this._globeness=1,this._mercatorTransform=new be,this._verticalPerspectiveTransform=new Ca}clone(){const e=new Aa;return e._globeness=this._globeness,e._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,e.apply(this),e}apply(e){this._helper.apply(e),this._mercatorTransform.apply(this),this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(e){const n=this._mercatorTransform.getProjectionData(e),o=this._verticalPerspectiveTransform.getProjectionData(e);return{mainMatrix:this.isGlobeRendering?o.mainMatrix:n.mainMatrix,clippingPlane:o.clippingPlane,tileMercatorCoords:o.tileMercatorCoords,projectionTransition:e.applyGlobeMatrix?this._globeness:0,fallbackMatrix:n.fallbackMatrix}}isLocationOccluded(e){return this.currentTransform.isLocationOccluded(e)}transformLightDirection(e){return this.currentTransform.transformLightDirection(e)}getPixelScale(){return h.bt(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return h.bt(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(e,n,o){const c=this._mercatorTransform.getPitchedTextCorrection(e,n,o),p=this._verticalPerspectiveTransform.getPitchedTextCorrection(e,n,o);return h.bt(c,p,this._globeness)}projectTileCoordinates(e,n,o,c){return this.currentTransform.projectTileCoordinates(e,n,o,c)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(e){return this.currentTransform.calculateFogMatrix(e)}getVisibleUnwrappedCoordinates(e){return this.currentTransform.getVisibleUnwrappedCoordinates(e)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(e){this._mercatorTransform.recalculateZoomAndCenter(e),this._verticalPerspectiveTransform.recalculateZoomAndCenter(e)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,n){return this.currentTransform.lngLatToCameraDepth(e,n)}populateCache(e){this._mercatorTransform.populateCache(e),this._verticalPerspectiveTransform.populateCache(e)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(e,n,o,c){return this._helper.calculateCenterFromCameraLngLatAlt(e,n,o,c)}setLocationAtPoint(e,n){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(e,n),void this.apply(this._mercatorTransform);this._verticalPerspectiveTransform.setLocationAtPoint(e,n),this.apply(this._verticalPerspectiveTransform)}locationToScreenPoint(e,n){return this.currentTransform.locationToScreenPoint(e,n)}screenPointToMercatorCoordinate(e,n){return this.currentTransform.screenPointToMercatorCoordinate(e,n)}screenPointToLocation(e,n){return this.currentTransform.screenPointToLocation(e,n)}isPointOnMapSurface(e,n){return this.currentTransform.isPointOnMapSurface(e,n)}getRayDirectionFromPixel(e){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(e)}getMatrixForModel(e,n){return this.currentTransform.getMatrixForModel(e,n)}getProjectionDataForCustomLayer(e=!0){const n=this._mercatorTransform.getProjectionDataForCustomLayer(e);if(!this.isGlobeRendering)return n;const o=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(e);return o.fallbackMatrix=n.mainMatrix,o}getFastPathSimpleProjectionMatrix(e){return this.currentTransform.getFastPathSimpleProjectionMatrix(e)}}class Ri{get useGlobeControls(){return!0}handlePanInertia(e,n){const o=nr(e,n);return Math.abs(o.lng-n.center.lng)>180&&(o.lng=n.center.lng+179.5*Math.sign(o.lng-n.center.lng)),{easingCenter:o,easingOffset:new h.P(0,0)}}handleMapControlsRollPitchBearingZoom(e,n){const o=e.around,c=n.screenPointToLocation(o);e.bearingDelta&&n.setBearing(n.bearing+e.bearingDelta),e.pitchDelta&&n.setPitch(n.pitch+e.pitchDelta),e.rollDelta&&n.setRoll(n.roll+e.rollDelta);const p=n.zoom;e.zoomDelta&&n.setZoom(n.zoom+e.zoomDelta);const m=n.zoom-p;if(m===0)return;const _=h.bJ(n.center.lng,c.lng),x=_/(Math.abs(_/180)+1),b=h.bJ(n.center.lat,c.lat),T=n.getRayDirectionFromPixel(o),E=n.cameraPosition,I=-1*h.b4(E,T),D=h.by();h.a$(D,E,[T[0]*I,T[1]*I,T[2]*I]);const L=h.b6(D)-1,V=Math.exp(.5*-Math.max(L-.3,0)),N=Ia(n.worldSize,n.center.lat)/Math.min(n.width,n.height),G=h.bw(N,.9,.5,1,.25),q=(1-h.aq(-m))*Math.min(V,G),Y=n.center.lat,$=n.zoom,K=new h.V(n.center.lng+x*q,h.an(n.center.lat+b*q,-h.ao,h.ao));n.setLocationAtPoint(c,o);const J=n.center,H=h.bw(Math.abs(_),45,85,0,1),it=h.bw(N,.75,.35,0,1),ct=Math.pow(Math.max(H,it),.25),st=h.bJ(J.lng,K.lng),at=h.bJ(J.lat,K.lat);n.setCenter(new h.V(J.lng+st*ct,J.lat+at*ct).wrap()),n.setZoom($+He(Y,n.center.lat))}handleMapControlsPan(e,n,o){if(!e.panDelta)return;const c=n.center.lat,p=n.zoom;n.setCenter(nr(e.panDelta,n).wrap()),n.setZoom(p+He(c,n.center.lat))}cameraForBoxAndBearing(e,n,o,c,p){const m=zs(e,n,o,c,p),_=n.left/p.width*2-1,x=(p.width-n.right)/p.width*2-1,b=n.top/p.height*-2+1,T=(p.height-n.bottom)/p.height*-2+1,E=h.bJ(o.getWest(),o.getEast())<0,I=E?o.getEast():o.getWest(),D=E?o.getWest():o.getEast(),L=Math.max(o.getNorth(),o.getSouth()),V=Math.min(o.getNorth(),o.getSouth()),N=I+.5*h.bJ(I,D),G=L+.5*h.bJ(L,V),q=p.clone();q.setCenter(m.center),q.setBearing(m.bearing),q.setPitch(0),q.setRoll(0),q.setZoom(m.zoom);const Y=q.modelViewProjectionMatrix,$=[li(o.getNorthWest()),li(o.getNorthEast()),li(o.getSouthWest()),li(o.getSouthEast()),li(new h.V(D,G)),li(new h.V(I,G)),li(new h.V(N,L)),li(new h.V(N,V))],K=li(m.center);let J=Number.POSITIVE_INFINITY;for(const H of $)_<0&&(J=Ri.getLesserNonNegativeNonNull(J,Ri.solveVectorScale(H,K,Y,"x",_))),x>0&&(J=Ri.getLesserNonNegativeNonNull(J,Ri.solveVectorScale(H,K,Y,"x",x))),b>0&&(J=Ri.getLesserNonNegativeNonNull(J,Ri.solveVectorScale(H,K,Y,"y",b))),T<0&&(J=Ri.getLesserNonNegativeNonNull(J,Ri.solveVectorScale(H,K,Y,"y",T)));if(Number.isFinite(J)&&J!==0)return m.zoom=q.zoom+h.at(J),m;es()}handleJumpToCenterZoom(e,n){const o=e.center.lat,c=e.applyConstrain(n.center?h.V.convert(n.center):e.center,e.zoom).center;e.setCenter(c.wrap());const p=n.zoom!==void 0?+n.zoom:e.zoom+He(o,c.lat);e.zoom!==p&&e.setZoom(p)}handleEaseTo(e,n){const o=e.zoom,c=e.center,p=e.padding,m={roll:e.roll,pitch:e.pitch,bearing:e.bearing},_={roll:n.roll===void 0?e.roll:n.roll,pitch:n.pitch===void 0?e.pitch:n.pitch,bearing:n.bearing===void 0?e.bearing:n.bearing},x=n.zoom!==void 0,b=!e.isPaddingEqual(n.padding);let T=!1;const E=n.center?h.V.convert(n.center):c,I=e.applyConstrain(E,o).center;Sa(e,I);const D=e.clone();D.setCenter(I),D.setZoom(x?+n.zoom:o+He(c.lat,E.lat)),D.setBearing(n.bearing);const L=new h.P(h.an(e.centerPoint.x+n.offsetAsPoint.x,0,e.width),h.an(e.centerPoint.y+n.offsetAsPoint.y,0,e.height));D.setLocationAtPoint(I,L);const V=(n.offset&&n.offsetAsPoint.mag())>0?D.center:I,N=x?+n.zoom:o+He(c.lat,V.lat),G=o+He(c.lat,0),q=N+He(V.lat,0),Y=h.bJ(c.lng,V.lng),$=h.bJ(c.lat,V.lat),K=h.aq(q-G);return T=N!==o,{easeFunc:J=>{if(h.bn(m,_)||tn({startEulerAngles:m,endEulerAngles:_,tr:e,k:J,useSlerp:m.roll!=_.roll}),b&&e.interpolatePadding(p,n.padding,J),n.around)h.w("Easing around a point is not supported under globe projection."),e.setLocationAtPoint(n.around,n.aroundPoint);else{const H=q>G?Math.min(2,K):Math.max(.5,K),it=Math.pow(H,1-J),ct=Ro(c,Y,$,J*it);e.setCenter(ct.wrap())}if(T){const H=h.G.number(G,q,J)+He(0,e.center.lat);e.setZoom(H)}},isZooming:T,elevationCenter:V}}handleFlyTo(e,n){const o=n.zoom!==void 0,c=e.center,p=e.zoom,m=e.padding,_=!e.isPaddingEqual(n.padding),x=e.applyConstrain(h.V.convert(n.center||n.locationAtOffset),p).center,b=o?+n.zoom:e.zoom+He(e.center.lat,x.lat),T=e.clone();T.setCenter(x),T.setZoom(b),T.setBearing(n.bearing);const E=new h.P(h.an(e.centerPoint.x+n.offsetAsPoint.x,0,e.width),h.an(e.centerPoint.y+n.offsetAsPoint.y,0,e.height));T.setLocationAtPoint(x,E);const I=T.center;Sa(e,I);const D=function($,K,J){const H=li(K),it=li(J),ct=h.b4(H,it),st=Math.acos(ct),at=nc($);return st/(2*Math.PI)*at}(e,c,I),L=p+He(c.lat,0),V=b+He(I.lat,0),N=h.aq(V-L);let G;if(typeof n.minZoom=="number"){const $=+n.minZoom+He(I.lat,0),K=Math.min($,L,V)+He(0,I.lat),J=e.applyConstrain(I,K).zoom+He(I.lat,0);G=h.aq(J-L)}const q=h.bJ(c.lng,I.lng),Y=h.bJ(c.lat,I.lat);return{easeFunc:($,K,J,H)=>{const it=Ro(c,q,Y,J);_&&e.interpolatePadding(m,n.padding,$);const ct=$===1?I:it;e.setCenter(ct.wrap());const st=L+h.at(K);e.setZoom($===1?b:st+He(0,ct.lat))},scaleOfZoom:N,targetCenter:I,scaleOfMinZoom:G,pixelPathLength:D}}static solveVectorScale(e,n,o,c,p){const m=c==="x"?[o[0],o[4],o[8],o[12]]:[o[1],o[5],o[9],o[13]],_=[o[3],o[7],o[11],o[15]],x=e[0]*m[0]+e[1]*m[1]+e[2]*m[2],b=e[0]*_[0]+e[1]*_[1]+e[2]*_[2],T=n[0]*m[0]+n[1]*m[1]+n[2]*m[2],E=n[0]*_[0]+n[1]*_[1]+n[2]*_[2];return T+p*b===x+p*E||_[3]*(x-T)+m[3]*(E-b)+x*E==T*b?null:(T+m[3]-p*E-p*_[3])/(T-x-p*E+p*b)}static getLesserNonNegativeNonNull(e,n){return n!==null&&n>=0&&n<e?n:e}}class Da{constructor(e){this._globe=e,this._mercatorCameraHelper=new ki,this._verticalPerspectiveCameraHelper=new Ri}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(e,n){return this.currentHelper.handlePanInertia(e,n)}handleMapControlsRollPitchBearingZoom(e,n){return this.currentHelper.handleMapControlsRollPitchBearingZoom(e,n)}handleMapControlsPan(e,n,o){this.currentHelper.handleMapControlsPan(e,n,o)}cameraForBoxAndBearing(e,n,o,c,p){return this.currentHelper.cameraForBoxAndBearing(e,n,o,c,p)}handleJumpToCenterZoom(e,n){this.currentHelper.handleJumpToCenterZoom(e,n)}handleEaseTo(e,n){return this.currentHelper.handleEaseTo(e,n)}handleFlyTo(e,n){return this.currentHelper.handleFlyTo(e,n)}}const Tn=(d,e)=>h.B(d,e&&e.filter(n=>n.identifier!=="source.canvas")),Fo=h.bN();class Fs extends h.E{constructor(e,n={}){var o,c;super(),this._rtlPluginLoaded=()=>{for(const m in this.tileManagers){const _=this.tileManagers[m].getSource().type;_!=="vector"&&_!=="geojson"||this.tileManagers[m].reload()}},this.map=e,this.dispatcher=new qr($n(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(m,_)=>this.getGlyphs(m,_)),this.dispatcher.registerMessageHandler("GI",(m,_)=>this.getImages(m,_)),this.dispatcher.registerMessageHandler("GDA",(m,_)=>this.getDashes(m,_)),this.imageManager=new Gr,this.imageManager.setEventedParent(this);const p=((o=e._container)===null||o===void 0?void 0:o.lang)||typeof document<"u"&&((c=document.documentElement)===null||c===void 0?void 0:c.lang)||void 0;this.glyphManager=new Ji(e._requestManager,n.localIdeographFontFamily,p),this.lineAtlas=new wa(256,512),this.crossTileSymbolIndex=new bn,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",h.bO()),er().on(Xr,this._rtlPluginLoaded),this.on("data",m=>{if(m.dataType!=="source"||m.sourceDataType!=="metadata")return;const _=this.tileManagers[m.sourceId];if(!_)return;const x=_.getSource();if(x&&x.vectorLayerIds)for(const b in this._layers){const T=this._layers[b];T.source===x.id&&this._validateLayer(T)}})}_setInitialValues(){var e;this._spritesImagesIds={},this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new h.bP,this._availableImages=[],this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this.crossTileSymbolIndex=new(((e=this.crossTileSymbolIndex)===null||e===void 0?void 0:e.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(e,n){var o,c,p;this._checkLoaded();const m=n===null?(p=(c=(o=this.stylesheet.state)===null||o===void 0?void 0:o[e])===null||c===void 0?void 0:c.default)!==null&&p!==void 0?p:null:n;if(h.bQ(m,this._globalState[e]))return this;this._globalState[e]=m,this._applyGlobalStateChanges([e])}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();const n=[];for(const o in e)!h.bQ(this._globalState[o],e[o].default)&&(n.push(o),this._globalState[o]=e[o].default);this._applyGlobalStateChanges(n)}_applyGlobalStateChanges(e){if(e.length===0)return;const n=new Set,o={};for(const c of e){o[c]=this._globalState[c];for(const p in this._layers){const m=this._layers[p],_=m.getLayoutAffectingGlobalStateRefs(),x=m.getPaintAffectingGlobalStateRefs();if(_.has(c)&&n.add(m.source),x.has(c))for(const{name:b,value:T}of x.get(c))this._updatePaintProperty(m,b,T)}}this.dispatcher.broadcast("UGS",o);for(const c in this.tileManagers)n.has(c)&&(this._reloadSource(c),this._changed=!0)}loadURL(e,n={},o){this.fire(new h.l("dataloading",{dataType:"style"})),n.validate=typeof n.validate!="boolean"||n.validate;const c=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;const p=this._loadStyleRequest;h.j(c,this._loadStyleRequest).then(m=>{this._loadStyleRequest=null,this._load(m.data,n,o)}).catch(m=>{this._loadStyleRequest=null,m&&!p.signal.aborted&&this.fire(new h.k(m))})}loadJSON(e,n={},o){this.fire(new h.l("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,Qe.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,n.validate=n.validate!==!1,this._load(e,n,o)}).catch(()=>{})}loadEmpty(){this.fire(new h.l("dataloading",{dataType:"style"})),this._load(Fo,{validate:!1})}_load(e,n,o){var c,p;let m=n.transformStyle?n.transformStyle(o,e):e;if(!n.validate||!Tn(this,h.C(m))){m=Object.assign({},m),this._loaded=!0,this.stylesheet=m;for(const _ in m.sources)this.addSource(_,m.sources[_],{validate:!1});m.sprite?this._loadSprite(m.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(m.glyphs),this._createLayers(),this.light=new Zn(this.stylesheet.light),this._setProjectionInternal(((c=this.stylesheet.projection)===null||c===void 0?void 0:c.type)||"mercator"),this.sky=new fn(this.stylesheet.sky),this.map.setTerrain((p=this.stylesheet.terrain)!==null&&p!==void 0?p:null),this.fire(new h.l("data",{dataType:"style"})),this.fire(new h.l("style.load"))}}_createLayers(){var e,n,o;const c=h.bR(this.stylesheet.layers);this.setGlobalState((e=this.stylesheet.state)!==null&&e!==void 0?e:null),this.dispatcher.broadcast("SL",c),this._order=c.map(p=>p.id),this._layers={},this._serializedLayers=null;for(const p of c){const m=h.bS(p,this._globalState);if(m.setEventedParent(this,{layer:{id:p.id}}),this._layers[p.id]=m,h.bT(m)&&this.tileManagers[m.source]){const _=(o=(n=p.paint)===null||n===void 0?void 0:n["raster-fade-duration"])!==null&&o!==void 0?o:m.paint.get("raster-fade-duration");this.tileManagers[m.source].setRasterFadeDuration(_)}}}_loadSprite(e,n=!1,o=void 0){let c;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(p,m,_,x){return h._(this,void 0,void 0,function*(){const b=Pr(p),T=_>1?"@2x":"",E={},I={};for(const{id:D,url:L}of b){const V=m.transformRequest(Ur(L,T,".json"),"SpriteJSON");E[D]=h.j(V,x);const N=m.transformRequest(Ur(L,T,".png"),"SpriteImage");I[D]=Ci.getImage(N,x)}return yield Promise.all([...Object.values(E),...Object.values(I)]),function(D,L){return h._(this,void 0,void 0,function*(){const V={};for(const N in D){V[N]={};const G=Qe.getImageCanvasContext((yield L[N]).data),q=(yield D[N]).data;for(const Y in q){const{width:$,height:K,x:J,y:H,sdf:it,pixelRatio:ct,stretchX:st,stretchY:at,content:lt,textFitWidth:St,textFitHeight:vt}=q[Y];V[N][Y]={data:null,pixelRatio:ct,sdf:it,stretchX:st,stretchY:at,content:lt,textFitWidth:St,textFitHeight:vt,spriteData:{width:$,height:K,x:J,y:H,context:G}}}}return V})}(E,I)})}(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(p=>{if(this._spriteRequest=null,p)for(const m in p){this._spritesImagesIds[m]=[];const _=this._spritesImagesIds[m]?this._spritesImagesIds[m].filter(x=>!(x in p)):[];for(const x of _)this.imageManager.removeImage(x),this._changedImages[x]=!0;for(const x in p[m]){const b=m==="default"?x:`${m}:${x}`;this._spritesImagesIds[m].push(b),b in this.imageManager.images?this.imageManager.updateImage(b,p[m][x],!1):this.imageManager.addImage(b,p[m][x]),n&&(this._changedImages[b]=!0)}}}).catch(p=>{this._spriteRequest=null,c=p,this.fire(new h.k(c))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new h.l("data",{dataType:"style"})),o&&o(c)})}_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.l("data",{dataType:"style"}))}_validateLayer(e){const n=this.tileManagers[e.source];if(!n)return;const o=e.sourceLayer;if(!o)return;const c=n.getSource();(c.type==="geojson"||c.vectorLayerIds&&c.vectorLayerIds.indexOf(o)===-1)&&this.fire(new h.k(new Error(`Source layer "${o}" does not exist on source "${c.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const e in this.tileManagers)if(!this.tileManagers[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,n=!1){const o=this._serializedAllLayers();if(!e||e.length===0)return Object.values(n?h.bU(o):o);const c=[];for(const p of e)if(o[p]){const m=n?h.bU(o[p]):o[p];c.push(m)}return c}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};const n=Object.keys(this._layers);for(const o of n){const c=this._layers[o];c.type!=="custom"&&(e[o]=c.serialize())}return e}hasTransitions(){var e,n,o;if(!((e=this.light)===null||e===void 0)&&e.hasTransition()||!((n=this.sky)===null||n===void 0)&&n.hasTransition()||!((o=this.projection)===null||o===void 0)&&o.hasTransition())return!0;for(const c in this.tileManagers)if(this.tileManagers[c].hasTransition())return!0;for(const c in this._layers)if(this._layers[c].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;const n=this._changed;if(n){const c=Object.keys(this._updatedLayers),p=Object.keys(this._removedLayers);(c.length||p.length)&&this._updateWorkerLayers(c,p);for(const m in this._updatedSources){const _=this._updatedSources[m];if(_==="reload")this._reloadSource(m);else{if(_!=="clear")throw new Error(`Invalid action ${_}`);this._clearSource(m)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const m in this._updatedPaintProps)this._layers[m].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}const o={};for(const c in this.tileManagers){const p=this.tileManagers[c];o[c]=p.used,p.used=!1}for(const c of this._order){const p=this._layers[c];p.recalculate(e,this._availableImages),!p.isHidden(e.zoom)&&p.source&&(this.tileManagers[p.source].used=!0)}for(const c in o){const p=this.tileManagers[c];!!o[c]!=!!p.used&&p.fire(new h.l("data",{sourceDataType:"visibility",dataType:"source",sourceId:c}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,n&&this.fire(new h.l("data",{dataType:"style"}))}_updateTilesForChangedImages(){const e=Object.keys(this._changedImages);if(e.length){for(const n in this.tileManagers)this.tileManagers[n].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const e in this.tileManagers)this.tileManagers[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,n){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,n={}){var o;this._checkLoaded();const c=this.serialize();if(e=n.transformStyle?n.transformStyle(c,e):e,((o=n.validate)===null||o===void 0||o)&&Tn(this,h.C(e)))return!1;(e=h.bU(e)).layers=h.bR(e.layers);const p=h.bV(c,e),m=this._getOperationsToPerform(p);if(m.unimplemented.length>0)throw new Error(`Unimplemented: ${m.unimplemented.join(", ")}.`);if(m.operations.length===0)return!1;for(const _ of m.operations)_();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){const n=[],o=[];for(const c of e)switch(c.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":n.push(()=>this.addLayer.apply(this,c.args));break;case"removeLayer":n.push(()=>this.removeLayer.apply(this,c.args));break;case"setPaintProperty":n.push(()=>this.setPaintProperty.apply(this,c.args));break;case"setLayoutProperty":n.push(()=>this.setLayoutProperty.apply(this,c.args));break;case"setFilter":n.push(()=>this.setFilter.apply(this,c.args));break;case"addSource":n.push(()=>this.addSource.apply(this,c.args));break;case"removeSource":n.push(()=>this.removeSource.apply(this,c.args));break;case"setLayerZoomRange":n.push(()=>this.setLayerZoomRange.apply(this,c.args));break;case"setLight":n.push(()=>this.setLight.apply(this,c.args));break;case"setGeoJSONSourceData":n.push(()=>this.setGeoJSONSourceData.apply(this,c.args));break;case"setGlyphs":n.push(()=>this.setGlyphs.apply(this,c.args));break;case"setSprite":n.push(()=>this.setSprite.apply(this,c.args));break;case"setTerrain":n.push(()=>this.map.setTerrain.apply(this,c.args));break;case"setSky":n.push(()=>this.setSky.apply(this,c.args));break;case"setProjection":this.setProjection.apply(this,c.args);break;case"setGlobalState":n.push(()=>this.setGlobalState.apply(this,c.args));break;case"setTransition":n.push(()=>{});break;default:o.push(c.command)}return{operations:n,unimplemented:o}}addImage(e,n){if(this.getImage(e))return this.fire(new h.k(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,n),this._afterImageUpdated(e)}updateImage(e,n){this.imageManager.updateImage(e,n)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new h.k(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.l("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,n,o={}){if(this._checkLoaded(),this.tileManagers[e]!==void 0)throw new Error(`Source "${e}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(h.C.source,`sources.${e}`,n,null,o))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const c=this.tileManagers[e]=new Kt(e,n,this.dispatcher);c.style=this,c.setEventedParent(this,()=>({isSourceLoaded:c.loaded(),source:c.serialize(),sourceId:e})),c.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.tileManagers[e]===void 0)throw new Error("There is no source with this ID");for(const o in this._layers)if(this._layers[o].source===e)return this.fire(new h.k(new Error(`Source "${e}" cannot be removed while layer "${o}" is using it.`)));const n=this.tileManagers[e];delete this.tileManagers[e],delete this._updatedSources[e],n.fire(new h.l("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,n){if(this._checkLoaded(),this.tileManagers[e]===void 0)throw new Error(`There is no source with this ID=${e}`);const o=this.tileManagers[e].getSource();if(o.type!=="geojson")throw new Error(`geojsonSource.type is ${o.type}, which is !== 'geojson`);o.setData(n),this._changed=!0}getSource(e){return this.tileManagers[e]&&this.tileManagers[e].getSource()}addLayer(e,n,o={}){this._checkLoaded();const c=e.id;if(this.getLayer(c))return void this.fire(new h.k(new Error(`Layer "${c}" already exists on this map.`)));let p;if(e.type==="custom"){if(Tn(this,h.bW(e)))return;p=h.bS(e,this._globalState)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(c,e.source),e=h.bU(e),e=h.e(e,{source:c})),this._validate(h.C.layer,`layers.${c}`,e,{arrayIndex:-1},o))return;p=h.bS(e,this._globalState),this._validateLayer(p),p.setEventedParent(this,{layer:{id:c}})}const m=n?this._order.indexOf(n):this._order.length;if(n&&m===-1)this.fire(new h.k(new Error(`Cannot add layer "${c}" before non-existing layer "${n}".`)));else{if(this._order.splice(m,0,c),this._layerOrderChanged=!0,this._layers[c]=p,this._removedLayers[c]&&p.source&&p.type!=="custom"){const _=this._removedLayers[c];delete this._removedLayers[c],_.type!==p.type?this._updatedSources[p.source]="clear":(this._updatedSources[p.source]="reload",this.tileManagers[p.source].pause())}this._updateLayer(p),p.onAdd&&p.onAdd(this.map)}}moveLayer(e,n){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new h.k(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===n)return;const o=this._order.indexOf(e);this._order.splice(o,1);const c=n?this._order.indexOf(n):this._order.length;n&&c===-1?this.fire(new h.k(new Error(`Cannot move layer "${e}" before non-existing layer "${n}".`))):(this._order.splice(c,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const n=this._layers[e];if(!n)return void this.fire(new h.k(new Error(`Cannot remove non-existing layer "${e}".`)));n.setEventedParent(null);const o=this._order.indexOf(e);this._order.splice(o,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=n,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],n.onRemove&&n.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,n,o){this._checkLoaded();const c=this.getLayer(e);c?c.minzoom===n&&c.maxzoom===o||(n!=null&&(c.minzoom=n),o!=null&&(c.maxzoom=o),this._updateLayer(c)):this.fire(new h.k(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,n,o={}){this._checkLoaded();const c=this.getLayer(e);if(c){if(!h.bQ(c.filter,n))return n==null?(c.setFilter(void 0),void this._updateLayer(c)):void(this._validate(h.C.filter,`layers.${c.id}.filter`,n,null,o)||(c.setFilter(h.bU(n)),this._updateLayer(c)))}else this.fire(new h.k(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return h.bU(this.getLayer(e).filter)}setLayoutProperty(e,n,o,c={}){this._checkLoaded();const p=this.getLayer(e);p?h.bQ(p.getLayoutProperty(n),o)||(p.setLayoutProperty(n,o,c),this._updateLayer(p)):this.fire(new h.k(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,n){const o=this.getLayer(e);if(o)return o.getLayoutProperty(n);this.fire(new h.k(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,n,o,c={}){this._checkLoaded();const p=this.getLayer(e);p?h.bQ(p.getPaintProperty(n),o)||this._updatePaintProperty(p,n,o,c):this.fire(new h.k(new Error(`Cannot style non-existing layer "${e}".`)))}_updatePaintProperty(e,n,o,c={}){e.setPaintProperty(n,o,c)&&this._updateLayer(e),h.bT(e)&&n==="raster-fade-duration"&&this.tileManagers[e.source].setRasterFadeDuration(o),this._changed=!0,this._updatedPaintProps[e.id]=!0,this._serializedLayers=null}getPaintProperty(e,n){return this.getLayer(e).getPaintProperty(n)}setFeatureState(e,n){this._checkLoaded();const o=e.source,c=e.sourceLayer,p=this.tileManagers[o];if(p===void 0)return void this.fire(new h.k(new Error(`The source '${o}' does not exist in the map's style.`)));const m=p.getSource().type;m==="geojson"&&c?this.fire(new h.k(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):m!=="vector"||c?(e.id===void 0&&this.fire(new h.k(new Error("The feature id parameter must be provided."))),p.setFeatureState(c,e.id,n)):this.fire(new h.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,n){this._checkLoaded();const o=e.source,c=this.tileManagers[o];if(c===void 0)return void this.fire(new h.k(new Error(`The source '${o}' does not exist in the map's style.`)));const p=c.getSource().type,m=p==="vector"?e.sourceLayer:void 0;p!=="vector"||m?n&&typeof e.id!="string"&&typeof e.id!="number"?this.fire(new h.k(new Error("A feature id is required to remove its specific state property."))):c.removeFeatureState(m,e.id,n):this.fire(new h.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const n=e.source,o=e.sourceLayer,c=this.tileManagers[n];if(c!==void 0)return c.getSource().type!=="vector"||o?(e.id===void 0&&this.fire(new h.k(new Error("The feature id parameter must be provided."))),c.getFeatureState(o,e.id)):void this.fire(new h.k(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new h.k(new Error(`The source '${n}' 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.bX(this.tileManagers,p=>p.serialize()),n=this._serializeByIds(this._order,!0),o=this.map.getTerrain()||void 0,c=this.stylesheet;return h.bY({version:c.version,name:c.name,metadata:c.metadata,light:c.light,sky:c.sky,center:c.center,zoom:c.zoom,bearing:c.bearing,pitch:c.pitch,sprite:c.sprite,glyphs:c.glyphs,transition:c.transition,projection:c.projection,sources:e,layers:n,terrain:o},p=>p!==void 0)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.tileManagers[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.tileManagers[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){const n=m=>this._layers[m].type==="fill-extrusion",o={},c=[];for(let m=this._order.length-1;m>=0;m--){const _=this._order[m];if(n(_)){o[_]=m;for(const x of e){const b=x[_];if(b)for(const T of b)c.push(T)}}}c.sort((m,_)=>_.intersectionZ-m.intersectionZ);const p=[];for(let m=this._order.length-1;m>=0;m--){const _=this._order[m];if(n(_))for(let x=c.length-1;x>=0;x--){const b=c[x].feature;if(o[b.layer.id]<m)break;p.push(b),c.pop()}else for(const x of e){const b=x[_];if(b)for(const T of b)p.push(T.feature)}}return p}queryRenderedFeatures(e,n,o){n&&n.filter&&this._validate(h.C.filter,"queryRenderedFeatures.filter",n.filter,null,n);const c={};if(n&&n.layers){if(!(Array.isArray(n.layers)||n.layers instanceof Set))return this.fire(new h.k(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(const b of n.layers){const T=this._layers[b];if(!T)return this.fire(new h.k(new Error(`The layer '${b}' does not exist in the map's style and cannot be queried for features.`))),[];c[T.source]=!0}}const p=[];n.availableImages=this._availableImages;const m=this._serializedAllLayers(),_=n.layers instanceof Set?n.layers:Array.isArray(n.layers)?new Set(n.layers):null,x=Object.assign(Object.assign({},n),{layers:_,globalState:this._globalState});for(const b in this.tileManagers)n.layers&&!c[b]||p.push(Es(this.tileManagers[b],this._layers,m,e,x,o,this.map.terrain?(T,E,I)=>this.map.terrain.getElevation(T,E,I):void 0));return this.placement&&p.push(function(b,T,E,I,D,L,V){const N={},G=L.queryRenderedSymbols(I),q=[];for(const Y of Object.keys(G).map(Number))q.push(V[Y]);q.sort(Me);for(const Y of q){const $=Y.featureIndex.lookupSymbolFeatures(G[Y.bucketInstanceId],T,Y.bucketIndex,Y.sourceLayerIndex,{filterSpec:D.filter,globalState:D.globalState},D.layers,D.availableImages,b);for(const K in $){const J=N[K]=N[K]||[],H=$[K];H.sort((it,ct)=>{const st=Y.featureSortOrder;if(st){const at=st.indexOf(it.featureIndex);return st.indexOf(ct.featureIndex)-at}return ct.featureIndex-it.featureIndex});for(const it of H)J.push(it)}}return function(Y,$,K){for(const J in Y)for(const H of Y[J])tr(H,K[$[J].source]);return Y}(N,b,E)}(this._layers,m,this.tileManagers,e,x,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(p)}querySourceFeatures(e,n){n?.filter&&this._validate(h.C.filter,"querySourceFeatures.filter",n.filter,null,n);const o=this.tileManagers[e];return o?function(c,p){const m=c.getRenderableIds().map(b=>c.getTileByID(b)),_=[],x={};for(let b=0;b<m.length;b++){const T=m[b],E=T.tileID.canonical.key;x[E]||(x[E]=!0,T.querySourceFeatures(_,p))}return _}(o,n?Object.assign(Object.assign({},n),{globalState:this._globalState}):{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(e,n={}){this._checkLoaded();const o=this.light.getLight();let c=!1;for(const m in e)if(!h.bQ(e[m],o[m])){c=!0;break}if(!c)return;const p={now:ne(),transition:h.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,n),this.light.updateTransitions(p)}getProjection(){var e;return(e=this.stylesheet)===null||e===void 0?void 0:e.projection}setProjection(e){if(this._checkLoaded(),this.projection){if(this.projection.name===e.type)return;this.projection.destroy(),delete this.projection}this.stylesheet.projection=e,this._setProjectionInternal(e.type)}getSky(){var e;return(e=this.stylesheet)===null||e===void 0?void 0:e.sky}setSky(e,n={}){this._checkLoaded();const o=this.getSky();let c=!1;if(!e&&!o)return;if(e&&!o)c=!0;else if(!e&&o)c=!0;else for(const m in e)if(!h.bQ(e[m],o[m])){c=!0;break}if(!c)return;const p={now:ne(),transition:h.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,n),this.sky.updateTransitions(p)}_setProjectionInternal(e){const n=function(o,c){const p={constrainOverride:c};if(Array.isArray(o)){const m=new ns({type:o});return{projection:m,transform:new Aa(p),cameraHelper:new Da(m)}}switch(o){case"mercator":return{projection:new ti,transform:new be(p),cameraHelper:new ki};case"globe":{const m=new ns({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:m,transform:new Aa(p),cameraHelper:new Da(m)}}case"vertical-perspective":return{projection:new Ls,transform:new Ca(p),cameraHelper:new Ri};default:return h.w(`Unknown projection name: ${o}. Falling back to mercator projection.`),{projection:new ti,transform:new be(p),cameraHelper:new ki}}}(e,this.map.transformConstrain);this.projection=n.projection,this.map.migrateProjection(n.transform,n.cameraHelper);for(const o in this.tileManagers)this.tileManagers[o].reload()}_validate(e,n,o,c,p={}){return(!p||p.validate!==!1)&&Tn(this,e.call(h.C,h.e({key:n,style:this.serialize(),value:o,styleSpec:h.u},c)))}_remove(e=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),er().off(Xr,this._rtlPluginLoaded);for(const n in this._layers)this._layers[n].setEventedParent(null);for(const n in this.tileManagers){const o=this.tileManagers[n];o.setEventedParent(null),o.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.tileManagers[e].clearTiles()}_reloadSource(e){this.tileManagers[e].resume(),this.tileManagers[e].reload()}_updateSources(e){for(const n in this.tileManagers)this.tileManagers[n].update(e,this.map.terrain)}_generateCollisionBoxes(){for(const e in this.tileManagers)this._reloadSource(e)}_updatePlacement(e,n,o,c,p=!1){let m=!1,_=!1;const x={};for(const b of this._order){const T=this._layers[b];if(T.type!=="symbol")continue;if(!x[T.source]){const I=this.tileManagers[T.source];x[T.source]=I.getRenderableIds(!0).map(D=>I.getTileByID(D)).sort((D,L)=>L.tileID.overscaledZ-D.tileID.overscaledZ||(D.tileID.isLessThan(L.tileID)?-1:1))}const E=this.crossTileSymbolIndex.addLayer(T,x[T.source],e.center.lng);m=m||E}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((p=p||this._layerOrderChanged||o===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(ne(),e.zoom))&&(this.pauseablePlacement=new ec(e,this.map.terrain,this._order,p,n,o,c,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,x),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(ne()),_=!0),m&&this.pauseablePlacement.placement.setStale()),_||m)for(const b of this._order){const T=this._layers[b];T.type==="symbol"&&this.placement.updateLayerOpacities(T,x[T.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(ne())}_releaseSymbolFadeTiles(){for(const e in this.tileManagers)this.tileManagers[e].releaseSymbolFadeTiles()}getImages(e,n){return h._(this,void 0,void 0,function*(){const o=yield this.imageManager.getImages(n.icons);this._updateTilesForChangedImages();const c=this.tileManagers[n.source];return c&&c.setDependencies(n.tileID.key,n.type,n.icons),o})}getGlyphs(e,n){return h._(this,void 0,void 0,function*(){const o=yield this.glyphManager.getGlyphs(n.stacks),c=this.tileManagers[n.source];return c&&c.setDependencies(n.tileID.key,n.type,[""]),o})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,n={}){this._checkLoaded(),e&&this._validate(h.C.glyphs,"glyphs",e,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}getDashes(e,n){return h._(this,void 0,void 0,function*(){const o={};for(const[c,p]of Object.entries(n.dashes))o[c]=this.lineAtlas.getDash(p.dasharray,p.round);return o})}addSprite(e,n,o={},c){this._checkLoaded();const p=[{id:e,url:n}],m=[...Pr(this.stylesheet.sprite),...p];this._validate(h.C.sprite,"sprite",m,null,o)||(this.stylesheet.sprite=m,this._loadSprite(p,!0,c))}removeSprite(e){this._checkLoaded();const n=Pr(this.stylesheet.sprite);if(n.find(o=>o.id===e)){if(this._spritesImagesIds[e])for(const o of this._spritesImagesIds[e])this.imageManager.removeImage(o),this._changedImages[o]=!0;n.splice(n.findIndex(o=>o.id===e),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new h.l("data",{dataType:"style"}))}else this.fire(new h.k(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return Pr(this.stylesheet.sprite)}setSprite(e,n={},o){this._checkLoaded(),e&&this._validate(h.C.sprite,"sprite",e,null,n)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,o):(this._unloadSprite(),o&&o(null)))}destroy(){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null);for(const e in this.tileManagers){const n=this.tileManagers[e];if(n.setEventedParent(null),n._tiles){for(const o in n._tiles)n._tiles[o].unloadVectorData();n._tiles={}}n._cache.reset(),n.onRemove(this.map)}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this._availableImages=[],this._spritesImagesIds={}),this.glyphManager&&this.glyphManager.destroy();for(const e in this._layers){const n=this._layers[e];n.setEventedParent(null),n.onRemove&&n.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}}var vr=h.aT([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Cu{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,n,o,c,p,m,_,x,b){this.context=e;let T=this.boundPaintVertexBuffers.length!==c.length;for(let E=0;!T&&E<c.length;E++)this.boundPaintVertexBuffers[E]!==c[E]&&(T=!0);!this.vao||this.boundProgram!==n||this.boundLayoutVertexBuffer!==o||T||this.boundIndexBuffer!==p||this.boundVertexOffset!==m||this.boundDynamicVertexBuffer!==_||this.boundDynamicVertexBuffer2!==x||this.boundDynamicVertexBuffer3!==b?this.freshBind(n,o,c,p,m,_,x,b):(e.bindVertexArray.set(this.vao),_&&_.bind(),p&&p.dynamicDraw&&p.bind(),x&&x.bind(),b&&b.bind())}freshBind(e,n,o,c,p,m,_,x){const b=e.numAttributes,T=this.context,E=T.gl;this.vao&&this.destroy(),this.vao=T.createVertexArray(),T.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=o,this.boundIndexBuffer=c,this.boundVertexOffset=p,this.boundDynamicVertexBuffer=m,this.boundDynamicVertexBuffer2=_,this.boundDynamicVertexBuffer3=x,n.enableAttributes(E,e);for(const I of o)I.enableAttributes(E,e);m&&m.enableAttributes(E,e),_&&_.enableAttributes(E,e),x&&x.enableAttributes(E,e),n.bind(),n.setVertexAttribPointers(E,e,p);for(const I of o)I.bind(),I.setVertexAttribPointers(E,e,p);m&&(m.bind(),m.setVertexAttribPointers(E,e,p)),c&&c.bind(),_&&(_.bind(),_.setVertexAttribPointers(E,e,p)),x&&(x.bind(),x.setVertexAttribPointers(E,e,p)),T.currentNumAttributes=b}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const Bo=(d,e,n,o,c)=>({u_texture:0,u_ele_delta:d,u_fog_matrix:e,u_fog_color:n?n.properties.get("fog-color"):h.bo.white,u_fog_ground_blend:n?n.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:c?0:n?n.calculateFogBlendOpacity(o):0,u_horizon_color:n?n.properties.get("horizon-color"):h.bo.white,u_horizon_fog_blend:n?n.properties.get("horizon-fog-blend"):1,u_is_globe_mode:c?1:0}),Bs={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function en(d){const e=[];for(let n=0;n<d.length;n++){if(d[n]===null)continue;const o=d[n].split(" ");e.push(o.pop())}return e}class Au{constructor(e,n,o,c,p,m,_,x,b=[]){const T=e.gl;this.program=T.createProgram();const E=en(n.staticAttributes),I=o?o.getBinderAttributes():[],D=E.concat(I),L=$i.prelude.staticUniforms?en($i.prelude.staticUniforms):[],V=_.staticUniforms?en(_.staticUniforms):[],N=n.staticUniforms?en(n.staticUniforms):[],G=o?o.getBinderUniforms():[],q=L.concat(V).concat(N).concat(G),Y=[];for(const st of q)Y.indexOf(st)<0&&Y.push(st);const $=o?o.defines():[];rr(T)&&$.unshift("#version 300 es"),p&&$.push("#define OVERDRAW_INSPECTOR;"),m&&$.push("#define TERRAIN3D;"),x&&$.push(x),b&&$.push(...b);let K=$.concat($i.prelude.fragmentSource,_.fragmentSource,n.fragmentSource).join(`
`),J=$.concat($i.prelude.vertexSource,_.vertexSource,n.vertexSource).join(`
`);rr(T)||(K=function(st){return st.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}(K),J=function(st){return st.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(J));const H=T.createShader(T.FRAGMENT_SHADER);if(T.isContextLost())return void(this.failedToCreate=!0);if(T.shaderSource(H,K),T.compileShader(H),!T.getShaderParameter(H,T.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${T.getShaderInfoLog(H)}`);T.attachShader(this.program,H);const it=T.createShader(T.VERTEX_SHADER);if(T.isContextLost())return void(this.failedToCreate=!0);if(T.shaderSource(it,J),T.compileShader(it),!T.getShaderParameter(it,T.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${T.getShaderInfoLog(it)}`);T.attachShader(this.program,it),this.attributes={};const ct={};this.numAttributes=D.length;for(let st=0;st<this.numAttributes;st++)D[st]&&(T.bindAttribLocation(this.program,st,D[st]),this.attributes[D[st]]=st);if(T.linkProgram(this.program),!T.getProgramParameter(this.program,T.LINK_STATUS))throw new Error(`Program failed to link: ${T.getProgramInfoLog(this.program)}`);T.deleteShader(it),T.deleteShader(H);for(let st=0;st<Y.length;st++){const at=Y[st];if(at&&!ct[at]){const lt=T.getUniformLocation(this.program,at);lt&&(ct[at]=lt)}}this.fixedUniforms=c(e,ct),this.terrainUniforms=((st,at)=>({u_depth:new h.bZ(st,at.u_depth),u_terrain:new h.bZ(st,at.u_terrain),u_terrain_dim:new h.bp(st,at.u_terrain_dim),u_terrain_matrix:new h.b$(st,at.u_terrain_matrix),u_terrain_unpack:new h.c0(st,at.u_terrain_unpack),u_terrain_exaggeration:new h.bp(st,at.u_terrain_exaggeration)}))(e,ct),this.projectionUniforms=((st,at)=>({u_projection_matrix:new h.b$(st,at.u_projection_matrix),u_projection_tile_mercator_coords:new h.c0(st,at.u_projection_tile_mercator_coords),u_projection_clipping_plane:new h.c0(st,at.u_projection_clipping_plane),u_projection_transition:new h.bp(st,at.u_projection_transition),u_projection_fallback_matrix:new h.b$(st,at.u_projection_fallback_matrix)}))(e,ct),this.binderUniforms=o?o.getUniforms(e,ct):[]}draw(e,n,o,c,p,m,_,x,b,T,E,I,D,L,V,N,G,q,Y){const $=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(o),e.setStencilMode(c),e.setColorMode(p),e.setCullFace(m),x){e.activeTexture.set($.TEXTURE2),$.bindTexture($.TEXTURE_2D,x.depthTexture),e.activeTexture.set($.TEXTURE3),$.bindTexture($.TEXTURE_2D,x.texture);for(const J in this.terrainUniforms)this.terrainUniforms[J].set(x[J])}if(b)for(const J in b)this.projectionUniforms[Bs[J]].set(b[J]);if(_)for(const J in this.fixedUniforms)this.fixedUniforms[J].set(_[J]);N&&N.setUniforms(e,this.binderUniforms,L,{zoom:V});let K=0;switch(n){case $.LINES:K=2;break;case $.TRIANGLES:K=3;break;case $.LINE_STRIP:K=1}for(const J of D.get()){const H=J.vaos||(J.vaos={});(H[T]||(H[T]=new Cu)).bind(e,this,E,N?N.getPaintVertexBuffers():[],I,J.vertexOffset,G,q,Y),$.drawElements(n,J.primitiveLength*K,$.UNSIGNED_SHORT,J.primitiveOffset*K*2)}}}function Os(d,e,n){const o=1/h.aM(n,1,e.transform.tileZoom),c=Math.pow(2,n.tileID.overscaledZ),p=n.tileSize*Math.pow(2,e.transform.tileZoom)/c,m=p*(n.tileID.canonical.x+n.tileID.wrap*c),_=p*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[o,d.fromScale,d.toScale],u_fade:d.t,u_pixel_coord_upper:[m>>16,_>>16],u_pixel_coord_lower:[65535&m,65535&_]}}const lc=(d,e,n,o)=>{const c=d.style.light,p=c.properties.get("position"),m=[p.x,p.y,p.z],_=h.c3();c.properties.get("anchor")==="viewport"&&h.c4(_,d.transform.bearingInRadians),h.c5(m,m,_);const x=d.transform.transformLightDirection(m),b=c.properties.get("color");return{u_lightpos:m,u_lightpos_globe:x,u_lightintensity:c.properties.get("intensity"),u_lightcolor:[b.r,b.g,b.b],u_vertical_gradient:+e,u_opacity:n,u_fill_translate:o}},as=(d,e,n,o,c,p,m)=>h.e(lc(d,e,n,o),Os(p,d,m),{u_height_factor:-Math.pow(2,c.overscaledZ)/m.tileSize/8}),cc=(d,e,n,o)=>h.e(Os(e,d,n),{u_fill_translate:o}),uc=(d,e)=>({u_world:d,u_fill_translate:e}),Du=(d,e,n,o,c)=>h.e(cc(d,e,n,c),{u_world:o}),hc=(d,e,n,o,c)=>{const p=d.transform;let m,_,x=0;if(n.paint.get("circle-pitch-alignment")==="map"){const b=h.aM(e,1,p.zoom);m=!0,_=[b,b],x=b/(h.a4*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*c}else m=!1,_=p.pixelsToGLUnits;return{u_camera_to_center_distance:p.cameraToCenterDistance,u_scale_with_map:+(n.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+m,u_device_pixel_ratio:d.pixelRatio,u_extrude_scale:_,u_globe_extrude_scale:x,u_translate:o}},Oo=d=>({u_pixel_extrude_scale:[1/d.width,1/d.height]}),dc=d=>({u_viewport_size:[d.width,d.height]}),Vo=(d,e=1)=>({u_color:d,u_overlay:0,u_overlay_scale:e}),No=(d,e,n,o)=>{const c=h.aM(d,1,e)/(h.a4*Math.pow(2,d.tileID.overscaledZ))*2*Math.PI*o;return{u_extrude_scale:h.aM(d,1,e),u_intensity:n,u_globe_extrude_scale:c}},jo=(d,e,n,o)=>{const c=h.N();h.c6(c,0,d.width,d.height,0,0,1);const p=d.context.gl;return{u_matrix:c,u_world:[p.drawingBufferWidth,p.drawingBufferHeight],u_image:n,u_color_ramp:o,u_opacity:e.paint.get("heatmap-opacity")}},Sn=(d,e,n)=>{const o=n.paint.get("hillshade-accent-color");let c;switch(n.paint.get("hillshade-method")){case"basic":c=4;break;case"combined":c=1;break;case"igor":c=2;break;case"multidirectional":c=3;break;default:c=0}const p=n.getIlluminationProperties();for(let m=0;m<p.directionRadians.length;m++)n.paint.get("hillshade-illumination-anchor")==="viewport"&&(p.directionRadians[m]+=d.transform.bearingInRadians);return{u_image:0,u_latrange:fc(0,e.tileID),u_exaggeration:n.paint.get("hillshade-exaggeration"),u_altitudes:p.altitudeRadians,u_azimuths:p.directionRadians,u_accent:o,u_method:c,u_highlights:p.highlightColor,u_shadows:p.shadowColor}},pc=(d,e)=>{const n=e.stride,o=h.N();return h.c6(o,0,h.a4,-h.a4,0,0,1),h.O(o,o,[0,-h.a4,0]),{u_matrix:o,u_image:1,u_dimension:[n,n],u_zoom:d.overscaledZ,u_unpack:e.getUnpackVector()}};function fc(d,e){const n=Math.pow(2,e.canonical.z),o=e.canonical.y;return[new h.aa(0,o/n).toLngLat().lat,new h.aa(0,(o+1)/n).toLngLat().lat]}const Vs=(d,e,n=0)=>({u_image:0,u_unpack:e.getUnpackVector(),u_dimension:[e.stride,e.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:n,u_opacity:d.paint.get("color-relief-opacity")}),za=(d,e,n,o)=>{const c=d.transform;return{u_translation:Uo(d,e,n),u_ratio:o/h.aM(e,1,c.zoom),u_device_pixel_ratio:d.pixelRatio,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]]}},Ns=(d,e,n,o,c)=>h.e(za(d,e,n,o),{u_image:0,u_image_height:c}),zu=(d,e,n,o,c)=>{const p=d.transform,m=ka(e,p);return{u_translation:Uo(d,e,n),u_texsize:e.imageAtlasTexture.size,u_ratio:o/h.aM(e,1,p.zoom),u_device_pixel_ratio:d.pixelRatio,u_image:0,u_scale:[m,c.fromScale,c.toScale],u_fade:c.t,u_units_to_pixels:[1/p.pixelsToGLUnits[0],1/p.pixelsToGLUnits[1]]}},ku=(d,e,n,o,c)=>{const p=ka(e,d.transform);return h.e(za(d,e,n,o),{u_tileratio:p,u_crossfade_from:c.fromScale,u_crossfade_to:c.toScale,u_image:0,u_mix:c.t,u_lineatlas_width:d.lineAtlas.width,u_lineatlas_height:d.lineAtlas.height})},mc=(d,e,n,o,c,p)=>{const m=ka(e,d.transform);return h.e(za(d,e,n,o),{u_image:0,u_image_height:p,u_tileratio:m,u_crossfade_from:c.fromScale,u_crossfade_to:c.toScale,u_image_dash:1,u_mix:c.t,u_lineatlas_width:d.lineAtlas.width,u_lineatlas_height:d.lineAtlas.height})};function ka(d,e){return 1/h.aM(d,1,e.tileZoom)}function Uo(d,e,n){return h.aN(d.transform,e,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const Go=(d,e,n,o,c)=>{return{u_tl_parent:d,u_scale_parent:e,u_buffer_scale:1,u_fade_t:n.mix,u_opacity:n.opacity*o.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:o.paint.get("raster-brightness-min"),u_brightness_high:o.paint.get("raster-brightness-max"),u_saturation_factor:(m=o.paint.get("raster-saturation"),m>0?1-1/(1.001-m):-m),u_contrast_factor:(p=o.paint.get("raster-contrast"),p>0?1/(1-p):1+p),u_spin_weights:gc(o.paint.get("raster-hue-rotate")),u_coords_top:[c[0].x,c[0].y,c[1].x,c[1].y],u_coords_bottom:[c[3].x,c[3].y,c[2].x,c[2].y]};var p,m};function gc(d){d*=Math.PI/180;const e=Math.sin(d),n=Math.cos(d);return[(2*n+1)/3,(-Math.sqrt(3)*e-n+1)/3,(Math.sqrt(3)*e-n+1)/3]}const js=(d,e,n,o,c,p,m,_,x,b,T,E,I)=>{const D=m.transform;return{u_is_size_zoom_constant:+(d==="constant"||d==="source"),u_is_size_feature_constant:+(d==="constant"||d==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:D.cameraToCenterDistance,u_pitch:D.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:D.width/D.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_label_plane_matrix:_,u_coord_matrix:x,u_is_text:+T,u_pitch_with_map:+o,u_is_along_line:c,u_is_variable_anchor:p,u_texsize:E,u_texture:0,u_translation:b,u_pitched_scale:I}},br=(d,e,n,o,c,p,m,_,x,b,T,E,I,D)=>{const L=m.transform;return h.e(js(d,e,n,o,c,p,m,_,x,b,T,E,D),{u_gamma_scale:o?Math.cos(L.pitch*Math.PI/180)*L.cameraToCenterDistance:1,u_device_pixel_ratio:m.pixelRatio,u_is_halo:1})},Zo=(d,e,n,o,c,p,m,_,x,b,T,E,I)=>h.e(br(d,e,n,o,c,p,m,_,x,b,!0,T,0,I),{u_texsize_icon:E,u_texture_icon:1}),$o=(d,e)=>({u_opacity:d,u_color:e}),qo=(d,e,n,o,c)=>h.e(function(p,m,_,x){const b=_.imageManager.getPattern(p.from.toString()),T=_.imageManager.getPattern(p.to.toString()),{width:E,height:I}=_.imageManager.getPixelSize(),D=Math.pow(2,x.tileID.overscaledZ),L=x.tileSize*Math.pow(2,_.transform.tileZoom)/D,V=L*(x.tileID.canonical.x+x.tileID.wrap*D),N=L*x.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:b.tl,u_pattern_br_a:b.br,u_pattern_tl_b:T.tl,u_pattern_br_b:T.br,u_texsize:[E,I],u_mix:m.t,u_pattern_size_a:b.displaySize,u_pattern_size_b:T.displaySize,u_scale_a:m.fromScale,u_scale_b:m.toScale,u_tile_units_to_pixels:1/h.aM(x,1,_.transform.tileZoom),u_pixel_coord_upper:[V>>16,N>>16],u_pixel_coord_lower:[65535&V,65535&N]}}(n,c,e,o),{u_opacity:d}),Wo=(d,e)=>{},Ho={fillExtrusion:(d,e)=>({u_lightpos:new h.c1(d,e.u_lightpos),u_lightpos_globe:new h.c1(d,e.u_lightpos_globe),u_lightintensity:new h.bp(d,e.u_lightintensity),u_lightcolor:new h.c1(d,e.u_lightcolor),u_vertical_gradient:new h.bp(d,e.u_vertical_gradient),u_opacity:new h.bp(d,e.u_opacity),u_fill_translate:new h.c2(d,e.u_fill_translate)}),fillExtrusionPattern:(d,e)=>({u_lightpos:new h.c1(d,e.u_lightpos),u_lightpos_globe:new h.c1(d,e.u_lightpos_globe),u_lightintensity:new h.bp(d,e.u_lightintensity),u_lightcolor:new h.c1(d,e.u_lightcolor),u_vertical_gradient:new h.bp(d,e.u_vertical_gradient),u_height_factor:new h.bp(d,e.u_height_factor),u_opacity:new h.bp(d,e.u_opacity),u_fill_translate:new h.c2(d,e.u_fill_translate),u_image:new h.bZ(d,e.u_image),u_texsize:new h.c2(d,e.u_texsize),u_pixel_coord_upper:new h.c2(d,e.u_pixel_coord_upper),u_pixel_coord_lower:new h.c2(d,e.u_pixel_coord_lower),u_scale:new h.c1(d,e.u_scale),u_fade:new h.bp(d,e.u_fade)}),fill:(d,e)=>({u_fill_translate:new h.c2(d,e.u_fill_translate)}),fillPattern:(d,e)=>({u_image:new h.bZ(d,e.u_image),u_texsize:new h.c2(d,e.u_texsize),u_pixel_coord_upper:new h.c2(d,e.u_pixel_coord_upper),u_pixel_coord_lower:new h.c2(d,e.u_pixel_coord_lower),u_scale:new h.c1(d,e.u_scale),u_fade:new h.bp(d,e.u_fade),u_fill_translate:new h.c2(d,e.u_fill_translate)}),fillOutline:(d,e)=>({u_world:new h.c2(d,e.u_world),u_fill_translate:new h.c2(d,e.u_fill_translate)}),fillOutlinePattern:(d,e)=>({u_world:new h.c2(d,e.u_world),u_image:new h.bZ(d,e.u_image),u_texsize:new h.c2(d,e.u_texsize),u_pixel_coord_upper:new h.c2(d,e.u_pixel_coord_upper),u_pixel_coord_lower:new h.c2(d,e.u_pixel_coord_lower),u_scale:new h.c1(d,e.u_scale),u_fade:new h.bp(d,e.u_fade),u_fill_translate:new h.c2(d,e.u_fill_translate)}),circle:(d,e)=>({u_camera_to_center_distance:new h.bp(d,e.u_camera_to_center_distance),u_scale_with_map:new h.bZ(d,e.u_scale_with_map),u_pitch_with_map:new h.bZ(d,e.u_pitch_with_map),u_extrude_scale:new h.c2(d,e.u_extrude_scale),u_device_pixel_ratio:new h.bp(d,e.u_device_pixel_ratio),u_globe_extrude_scale:new h.bp(d,e.u_globe_extrude_scale),u_translate:new h.c2(d,e.u_translate)}),collisionBox:(d,e)=>({u_pixel_extrude_scale:new h.c2(d,e.u_pixel_extrude_scale)}),collisionCircle:(d,e)=>({u_viewport_size:new h.c2(d,e.u_viewport_size)}),debug:(d,e)=>({u_color:new h.b_(d,e.u_color),u_overlay:new h.bZ(d,e.u_overlay),u_overlay_scale:new h.bp(d,e.u_overlay_scale)}),depth:Wo,clippingMask:Wo,heatmap:(d,e)=>({u_extrude_scale:new h.bp(d,e.u_extrude_scale),u_intensity:new h.bp(d,e.u_intensity),u_globe_extrude_scale:new h.bp(d,e.u_globe_extrude_scale)}),heatmapTexture:(d,e)=>({u_matrix:new h.b$(d,e.u_matrix),u_world:new h.c2(d,e.u_world),u_image:new h.bZ(d,e.u_image),u_color_ramp:new h.bZ(d,e.u_color_ramp),u_opacity:new h.bp(d,e.u_opacity)}),hillshade:(d,e)=>({u_image:new h.bZ(d,e.u_image),u_latrange:new h.c2(d,e.u_latrange),u_exaggeration:new h.bp(d,e.u_exaggeration),u_altitudes:new h.c8(d,e.u_altitudes),u_azimuths:new h.c8(d,e.u_azimuths),u_accent:new h.b_(d,e.u_accent),u_method:new h.bZ(d,e.u_method),u_shadows:new h.c7(d,e.u_shadows),u_highlights:new h.c7(d,e.u_highlights)}),hillshadePrepare:(d,e)=>({u_matrix:new h.b$(d,e.u_matrix),u_image:new h.bZ(d,e.u_image),u_dimension:new h.c2(d,e.u_dimension),u_zoom:new h.bp(d,e.u_zoom),u_unpack:new h.c0(d,e.u_unpack)}),colorRelief:(d,e)=>({u_image:new h.bZ(d,e.u_image),u_unpack:new h.c0(d,e.u_unpack),u_dimension:new h.c2(d,e.u_dimension),u_elevation_stops:new h.bZ(d,e.u_elevation_stops),u_color_stops:new h.bZ(d,e.u_color_stops),u_color_ramp_size:new h.bZ(d,e.u_color_ramp_size),u_opacity:new h.bp(d,e.u_opacity)}),line:(d,e)=>({u_translation:new h.c2(d,e.u_translation),u_ratio:new h.bp(d,e.u_ratio),u_device_pixel_ratio:new h.bp(d,e.u_device_pixel_ratio),u_units_to_pixels:new h.c2(d,e.u_units_to_pixels)}),lineGradient:(d,e)=>({u_translation:new h.c2(d,e.u_translation),u_ratio:new h.bp(d,e.u_ratio),u_device_pixel_ratio:new h.bp(d,e.u_device_pixel_ratio),u_units_to_pixels:new h.c2(d,e.u_units_to_pixels),u_image:new h.bZ(d,e.u_image),u_image_height:new h.bp(d,e.u_image_height)}),linePattern:(d,e)=>({u_translation:new h.c2(d,e.u_translation),u_texsize:new h.c2(d,e.u_texsize),u_ratio:new h.bp(d,e.u_ratio),u_device_pixel_ratio:new h.bp(d,e.u_device_pixel_ratio),u_image:new h.bZ(d,e.u_image),u_units_to_pixels:new h.c2(d,e.u_units_to_pixels),u_scale:new h.c1(d,e.u_scale),u_fade:new h.bp(d,e.u_fade)}),lineSDF:(d,e)=>({u_translation:new h.c2(d,e.u_translation),u_ratio:new h.bp(d,e.u_ratio),u_device_pixel_ratio:new h.bp(d,e.u_device_pixel_ratio),u_units_to_pixels:new h.c2(d,e.u_units_to_pixels),u_image:new h.bZ(d,e.u_image),u_mix:new h.bp(d,e.u_mix),u_tileratio:new h.bp(d,e.u_tileratio),u_crossfade_from:new h.bp(d,e.u_crossfade_from),u_crossfade_to:new h.bp(d,e.u_crossfade_to),u_lineatlas_width:new h.bp(d,e.u_lineatlas_width),u_lineatlas_height:new h.bp(d,e.u_lineatlas_height)}),lineGradientSDF:(d,e)=>({u_translation:new h.c2(d,e.u_translation),u_ratio:new h.bp(d,e.u_ratio),u_device_pixel_ratio:new h.bp(d,e.u_device_pixel_ratio),u_units_to_pixels:new h.c2(d,e.u_units_to_pixels),u_image:new h.bZ(d,e.u_image),u_image_height:new h.bp(d,e.u_image_height),u_tileratio:new h.bp(d,e.u_tileratio),u_crossfade_from:new h.bp(d,e.u_crossfade_from),u_crossfade_to:new h.bp(d,e.u_crossfade_to),u_image_dash:new h.bZ(d,e.u_image_dash),u_mix:new h.bp(d,e.u_mix),u_lineatlas_width:new h.bp(d,e.u_lineatlas_width),u_lineatlas_height:new h.bp(d,e.u_lineatlas_height)}),raster:(d,e)=>({u_tl_parent:new h.c2(d,e.u_tl_parent),u_scale_parent:new h.bp(d,e.u_scale_parent),u_buffer_scale:new h.bp(d,e.u_buffer_scale),u_fade_t:new h.bp(d,e.u_fade_t),u_opacity:new h.bp(d,e.u_opacity),u_image0:new h.bZ(d,e.u_image0),u_image1:new h.bZ(d,e.u_image1),u_brightness_low:new h.bp(d,e.u_brightness_low),u_brightness_high:new h.bp(d,e.u_brightness_high),u_saturation_factor:new h.bp(d,e.u_saturation_factor),u_contrast_factor:new h.bp(d,e.u_contrast_factor),u_spin_weights:new h.c1(d,e.u_spin_weights),u_coords_top:new h.c0(d,e.u_coords_top),u_coords_bottom:new h.c0(d,e.u_coords_bottom)}),symbolIcon:(d,e)=>({u_is_size_zoom_constant:new h.bZ(d,e.u_is_size_zoom_constant),u_is_size_feature_constant:new h.bZ(d,e.u_is_size_feature_constant),u_size_t:new h.bp(d,e.u_size_t),u_size:new h.bp(d,e.u_size),u_camera_to_center_distance:new h.bp(d,e.u_camera_to_center_distance),u_pitch:new h.bp(d,e.u_pitch),u_rotate_symbol:new h.bZ(d,e.u_rotate_symbol),u_aspect_ratio:new h.bp(d,e.u_aspect_ratio),u_fade_change:new h.bp(d,e.u_fade_change),u_label_plane_matrix:new h.b$(d,e.u_label_plane_matrix),u_coord_matrix:new h.b$(d,e.u_coord_matrix),u_is_text:new h.bZ(d,e.u_is_text),u_pitch_with_map:new h.bZ(d,e.u_pitch_with_map),u_is_along_line:new h.bZ(d,e.u_is_along_line),u_is_variable_anchor:new h.bZ(d,e.u_is_variable_anchor),u_texsize:new h.c2(d,e.u_texsize),u_texture:new h.bZ(d,e.u_texture),u_translation:new h.c2(d,e.u_translation),u_pitched_scale:new h.bp(d,e.u_pitched_scale)}),symbolSDF:(d,e)=>({u_is_size_zoom_constant:new h.bZ(d,e.u_is_size_zoom_constant),u_is_size_feature_constant:new h.bZ(d,e.u_is_size_feature_constant),u_size_t:new h.bp(d,e.u_size_t),u_size:new h.bp(d,e.u_size),u_camera_to_center_distance:new h.bp(d,e.u_camera_to_center_distance),u_pitch:new h.bp(d,e.u_pitch),u_rotate_symbol:new h.bZ(d,e.u_rotate_symbol),u_aspect_ratio:new h.bp(d,e.u_aspect_ratio),u_fade_change:new h.bp(d,e.u_fade_change),u_label_plane_matrix:new h.b$(d,e.u_label_plane_matrix),u_coord_matrix:new h.b$(d,e.u_coord_matrix),u_is_text:new h.bZ(d,e.u_is_text),u_pitch_with_map:new h.bZ(d,e.u_pitch_with_map),u_is_along_line:new h.bZ(d,e.u_is_along_line),u_is_variable_anchor:new h.bZ(d,e.u_is_variable_anchor),u_texsize:new h.c2(d,e.u_texsize),u_texture:new h.bZ(d,e.u_texture),u_gamma_scale:new h.bp(d,e.u_gamma_scale),u_device_pixel_ratio:new h.bp(d,e.u_device_pixel_ratio),u_is_halo:new h.bZ(d,e.u_is_halo),u_translation:new h.c2(d,e.u_translation),u_pitched_scale:new h.bp(d,e.u_pitched_scale)}),symbolTextAndIcon:(d,e)=>({u_is_size_zoom_constant:new h.bZ(d,e.u_is_size_zoom_constant),u_is_size_feature_constant:new h.bZ(d,e.u_is_size_feature_constant),u_size_t:new h.bp(d,e.u_size_t),u_size:new h.bp(d,e.u_size),u_camera_to_center_distance:new h.bp(d,e.u_camera_to_center_distance),u_pitch:new h.bp(d,e.u_pitch),u_rotate_symbol:new h.bZ(d,e.u_rotate_symbol),u_aspect_ratio:new h.bp(d,e.u_aspect_ratio),u_fade_change:new h.bp(d,e.u_fade_change),u_label_plane_matrix:new h.b$(d,e.u_label_plane_matrix),u_coord_matrix:new h.b$(d,e.u_coord_matrix),u_is_text:new h.bZ(d,e.u_is_text),u_pitch_with_map:new h.bZ(d,e.u_pitch_with_map),u_is_along_line:new h.bZ(d,e.u_is_along_line),u_is_variable_anchor:new h.bZ(d,e.u_is_variable_anchor),u_texsize:new h.c2(d,e.u_texsize),u_texsize_icon:new h.c2(d,e.u_texsize_icon),u_texture:new h.bZ(d,e.u_texture),u_texture_icon:new h.bZ(d,e.u_texture_icon),u_gamma_scale:new h.bp(d,e.u_gamma_scale),u_device_pixel_ratio:new h.bp(d,e.u_device_pixel_ratio),u_is_halo:new h.bZ(d,e.u_is_halo),u_translation:new h.c2(d,e.u_translation),u_pitched_scale:new h.bp(d,e.u_pitched_scale)}),background:(d,e)=>({u_opacity:new h.bp(d,e.u_opacity),u_color:new h.b_(d,e.u_color)}),backgroundPattern:(d,e)=>({u_opacity:new h.bp(d,e.u_opacity),u_image:new h.bZ(d,e.u_image),u_pattern_tl_a:new h.c2(d,e.u_pattern_tl_a),u_pattern_br_a:new h.c2(d,e.u_pattern_br_a),u_pattern_tl_b:new h.c2(d,e.u_pattern_tl_b),u_pattern_br_b:new h.c2(d,e.u_pattern_br_b),u_texsize:new h.c2(d,e.u_texsize),u_mix:new h.bp(d,e.u_mix),u_pattern_size_a:new h.c2(d,e.u_pattern_size_a),u_pattern_size_b:new h.c2(d,e.u_pattern_size_b),u_scale_a:new h.bp(d,e.u_scale_a),u_scale_b:new h.bp(d,e.u_scale_b),u_pixel_coord_upper:new h.c2(d,e.u_pixel_coord_upper),u_pixel_coord_lower:new h.c2(d,e.u_pixel_coord_lower),u_tile_units_to_pixels:new h.bp(d,e.u_tile_units_to_pixels)}),terrain:(d,e)=>({u_texture:new h.bZ(d,e.u_texture),u_ele_delta:new h.bp(d,e.u_ele_delta),u_fog_matrix:new h.b$(d,e.u_fog_matrix),u_fog_color:new h.b_(d,e.u_fog_color),u_fog_ground_blend:new h.bp(d,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new h.bp(d,e.u_fog_ground_blend_opacity),u_horizon_color:new h.b_(d,e.u_horizon_color),u_horizon_fog_blend:new h.bp(d,e.u_horizon_fog_blend),u_is_globe_mode:new h.bp(d,e.u_is_globe_mode)}),terrainDepth:(d,e)=>({u_ele_delta:new h.bp(d,e.u_ele_delta)}),terrainCoords:(d,e)=>({u_texture:new h.bZ(d,e.u_texture),u_terrain_coords_id:new h.bp(d,e.u_terrain_coords_id),u_ele_delta:new h.bp(d,e.u_ele_delta)}),projectionErrorMeasurement:(d,e)=>({u_input:new h.bp(d,e.u_input),u_output_expected:new h.bp(d,e.u_output_expected)}),atmosphere:(d,e)=>({u_sun_pos:new h.c1(d,e.u_sun_pos),u_atmosphere_blend:new h.bp(d,e.u_atmosphere_blend),u_globe_position:new h.c1(d,e.u_globe_position),u_globe_radius:new h.bp(d,e.u_globe_radius),u_inv_proj_matrix:new h.b$(d,e.u_inv_proj_matrix)}),sky:(d,e)=>({u_sky_color:new h.b_(d,e.u_sky_color),u_horizon_color:new h.b_(d,e.u_horizon_color),u_horizon:new h.c2(d,e.u_horizon),u_horizon_normal:new h.c2(d,e.u_horizon_normal),u_sky_horizon_blend:new h.bp(d,e.u_sky_horizon_blend),u_sky_blend:new h.bp(d,e.u_sky_blend)})};class Pn{constructor(e,n,o){this.context=e;const c=e.gl;this.buffer=c.createBuffer(),this.dynamicDraw=!!o,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?c.DYNAMIC_DRAW:c.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){const n=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Xo={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Ru{constructor(e,n,o,c){this.length=n.length,this.attributes=o,this.itemSize=n.bytesPerElement,this.dynamicDraw=c,this.context=e;const p=e.gl;this.buffer=p.createBuffer(),e.bindVertexBuffer.set(this.buffer),p.bufferData(p.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?p.DYNAMIC_DRAW:p.STATIC_DRAW),this.dynamicDraw||delete n.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 n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,n){for(let o=0;o<this.attributes.length;o++){const c=n.attributes[this.attributes[o].name];c!==void 0&&e.enableVertexAttribArray(c)}}setVertexAttribPointers(e,n,o){for(let c=0;c<this.attributes.length;c++){const p=this.attributes[c],m=n.attributes[p.name];m!==void 0&&e.vertexAttribPointer(m,p.components,e[Xo[p.type]],!1,this.itemSize,p.offset+this.itemSize*(o||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class oe{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Lu extends oe{getDefault(){return h.bo.transparent}set(e){const n=this.current;(e.r!==n.r||e.g!==n.g||e.b!==n.b||e.a!==n.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Fu extends oe{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class _c extends oe{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class Bu extends oe{getDefault(){return[!0,!0,!0,!0]}set(e){const n=this.current;(e[0]!==n[0]||e[1]!==n[1]||e[2]!==n[2]||e[3]!==n[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class yc extends oe{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class Ra extends oe{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class La extends oe{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){const n=this.current;(e.func!==n.func||e.ref!==n.ref||e.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class Fa extends oe{getDefault(){const e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){const n=this.current;(e[0]!==n[0]||e[1]!==n[1]||e[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class Yo extends oe{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;e?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=e,this.dirty=!1}}class Mn extends oe{getDefault(){return[0,1]}set(e){const n=this.current;(e[0]!==n[0]||e[1]!==n[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class Us extends oe{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;e?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=e,this.dirty=!1}}class os extends oe{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class qi extends oe{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;e?n.enable(n.BLEND):n.disable(n.BLEND),this.current=e,this.dirty=!1}}class xc extends oe{getDefault(){const e=this.gl;return[e.ONE,e.ZERO]}set(e){const n=this.current;(e[0]!==n[0]||e[1]!==n[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}class vc extends oe{getDefault(){return h.bo.transparent}set(e){const n=this.current;(e.r!==n.r||e.g!==n.g||e.b!==n.b||e.a!==n.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Ko extends oe{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class In extends oe{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;e?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=e,this.dirty=!1}}class Ba extends oe{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class Oa extends oe{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class Gs extends oe{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class Va extends oe{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class bc extends oe{getDefault(){const e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){const n=this.current;(e[0]!==n[0]||e[1]!==n[1]||e[2]!==n[2]||e[3]!==n[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class ls extends oe{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class cs extends oe{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class wc extends oe{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class Jo extends oe{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Qt extends oe{getDefault(){return null}set(e){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Na extends oe{getDefault(){return null}set(e){var n;if(e===this.current&&!this.dirty)return;const o=this.gl;rr(o)?o.bindVertexArray(e):(n=o.getExtension("OES_vertex_array_object"))===null||n===void 0||n.bindVertexArrayOES(e),this.current=e,this.dirty=!1}}class Ou extends oe{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class Tc extends oe{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class Zs extends oe{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class Qo extends oe{constructor(e,n){super(e),this.context=e,this.parent=n}getDefault(){return null}}class Vu extends Qo{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class Sc extends Qo{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Nu extends Qo{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,e),this.current=e,this.dirty=!1}}const ja="Framebuffer is not complete";class Ua{constructor(e,n,o,c,p){this.context=e,this.width=n,this.height=o;const m=e.gl,_=this.framebuffer=m.createFramebuffer();if(this.colorAttachment=new Vu(e,_),c)this.depthAttachment=p?new Nu(e,_):new Sc(e,_);else if(p)throw new Error("Stencil cannot be set without depth");if(m.checkFramebufferStatus(m.FRAMEBUFFER)!==m.FRAMEBUFFER_COMPLETE)throw new Error(ja)}destroy(){const e=this.context.gl,n=this.colorAttachment.get();if(n&&e.deleteTexture(n),this.depthAttachment){const o=this.depthAttachment.get();o&&e.deleteRenderbuffer(o)}e.deleteFramebuffer(this.framebuffer)}}class Ga{constructor(e){var n,o;if(this.gl=e,this.clearColor=new Lu(this),this.clearDepth=new Fu(this),this.clearStencil=new _c(this),this.colorMask=new Bu(this),this.depthMask=new yc(this),this.stencilMask=new Ra(this),this.stencilFunc=new La(this),this.stencilOp=new Fa(this),this.stencilTest=new Yo(this),this.depthRange=new Mn(this),this.depthTest=new Us(this),this.depthFunc=new os(this),this.blend=new qi(this),this.blendFunc=new xc(this),this.blendColor=new vc(this),this.blendEquation=new Ko(this),this.cullFace=new In(this),this.cullFaceSide=new Ba(this),this.frontFace=new Oa(this),this.program=new Gs(this),this.activeTexture=new Va(this),this.viewport=new bc(this),this.bindFramebuffer=new ls(this),this.bindRenderbuffer=new cs(this),this.bindTexture=new wc(this),this.bindVertexBuffer=new Jo(this),this.bindElementBuffer=new Qt(this),this.bindVertexArray=new Na(this),this.pixelStoreUnpack=new Ou(this),this.pixelStoreUnpackPremultiplyAlpha=new Tc(this),this.pixelStoreUnpackFlipY=new Zs(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),rr(e)){this.HALF_FLOAT=e.HALF_FLOAT;const c=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(n=e.RGBA16F)!==null&&n!==void 0?n:c?.RGBA16F_EXT,this.RGB16F=(o=e.RGB16F)!==null&&o!==void 0?o:c?.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");const c=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=c?.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,n){return new Pn(this,e,n)}createVertexBuffer(e,n,o){return new Ru(this,e,n,o)}createRenderbuffer(e,n,o){const c=this.gl,p=c.createRenderbuffer();return this.bindRenderbuffer.set(p),c.renderbufferStorage(c.RENDERBUFFER,e,n,o),this.bindRenderbuffer.set(null),p}createFramebuffer(e,n,o,c){return new Ua(this,e,n,o,c)}clear({color:e,depth:n,stencil:o}){const c=this.gl;let p=0;e&&(p|=c.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(p|=c.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),o!==void 0&&(p|=c.STENCIL_BUFFER_BIT,this.clearStencil.set(o),this.stencilMask.set(255)),c.clear(p)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){h.bQ(e.blendFunction,we.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var e;return rr(this.gl)?this.gl.createVertexArray():(e=this.gl.getExtension("OES_vertex_array_object"))===null||e===void 0?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var n;return rr(this.gl)?this.gl.deleteVertexArray(e):(n=this.gl.getExtension("OES_vertex_array_object"))===null||n===void 0?void 0:n.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}}let En;function Za(d,e,n,o,c){const p=d.context,m=d.transform,_=p.gl,x=d.useProgram("collisionBox"),b=[];let T=0,E=0;for(let G=0;G<o.length;G++){const q=o[G],Y=e.getTile(q).getBucket(n);if(!Y)continue;const $=c?Y.textCollisionBox:Y.iconCollisionBox,K=Y.collisionCircleArray;K.length>0&&(b.push({circleArray:K,circleOffset:E,coord:q}),T+=K.length/4,E=T),$&&x.draw(p,_.LINES,Xt.disabled,re.disabled,d.colorModeForRenderPass(),se.disabled,Oo(d.transform),d.style.map.terrain&&d.style.map.terrain.getTerrainData(q),m.getProjectionData({overscaledTileID:q,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),n.id,$.layoutVertexBuffer,$.indexBuffer,$.segments,null,d.transform.zoom,null,null,$.collisionVertexBuffer)}if(!c||!b.length)return;const I=d.useProgram("collisionCircle"),D=new h.c9;D.resize(4*T),D._trim();let L=0;for(const G of b)for(let q=0;q<G.circleArray.length/4;q++){const Y=4*q,$=G.circleArray[Y+0],K=G.circleArray[Y+1],J=G.circleArray[Y+2],H=G.circleArray[Y+3];D.emplace(L++,$,K,J,H,0),D.emplace(L++,$,K,J,H,1),D.emplace(L++,$,K,J,H,2),D.emplace(L++,$,K,J,H,3)}(!En||En.length<2*T)&&(En=function(G){const q=2*G,Y=new h.cb;Y.resize(q),Y._trim();for(let $=0;$<q;$++){const K=6*$;Y.uint16[K+0]=4*$+0,Y.uint16[K+1]=4*$+1,Y.uint16[K+2]=4*$+2,Y.uint16[K+3]=4*$+2,Y.uint16[K+4]=4*$+3,Y.uint16[K+5]=4*$+0}return Y}(T));const V=p.createIndexBuffer(En,!0),N=p.createVertexBuffer(D,h.ca.members,!0);for(const G of b){const q=dc(d.transform);I.draw(p,_.TRIANGLES,Xt.disabled,re.disabled,d.colorModeForRenderPass(),se.disabled,q,d.style.map.terrain&&d.style.map.terrain.getTerrainData(G.coord),null,n.id,N,V,h.aW.simpleSegment(0,2*G.circleOffset,G.circleArray.length,G.circleArray.length/2),null,d.transform.zoom,null,null,null)}N.destroy(),V.destroy()}const Pc=h.ar(new Float32Array(16));function $a(d,e,n,o,c,p){const{horizontalAlign:m,verticalAlign:_}=h.aR(d);return new h.P((-(m-.5)*e/c+o[0])*p,(-(_-.5)*n/c+o[1])*p)}function qa(d,e,n,o,c,p){const m=e.tileAnchorPoint.add(new h.P(e.translation[0],e.translation[1]));if(e.pitchWithMap){let _=o.mult(p);n||(_=_.rotate(-c));const x=m.add(_);return Dt(x.x,x.y,e.pitchedLabelPlaneMatrix,e.getElevation).point}if(n){const _=ir(e.tileAnchorPoint.x+1,e.tileAnchorPoint.y,e).point.sub(d),x=Math.atan(_.y/_.x)+(_.x<0?Math.PI:0);return d.add(o.rotate(x))}return d.add(o)}function Wa(d,e,n,o,c,p,m,_,x,b,T,E){const I=d.text.placedSymbolArray,D=d.text.dynamicLayoutVertexArray,L=d.icon.dynamicLayoutVertexArray,V={};D.clear();for(let N=0;N<I.length;N++){const G=I.get(N),q=G.hidden||!G.crossTileID||d.allowVerticalPlacement&&!G.placedOrientation?null:o[G.crossTileID];if(q){const Y=new h.P(G.anchorX,G.anchorY),$={getElevation:E,width:c.width,height:c.height,pitchedLabelPlaneMatrix:p,pitchWithMap:n,transform:c,tileAnchorPoint:Y,translation:b,unwrappedTileID:T},K=n?Kn(Y.x,Y.y,$):ir(Y.x,Y.y,$),J=jt(c.cameraToCenterDistance,K.signedDistanceFromCamera);let H=h.az(d.textSizeData,_,G)*J/h.aL;n&&(H*=d.tilePixelRatio/m);const{width:it,height:ct,anchor:st,textOffset:at,textBoxScale:lt}=q,St=$a(st,it,ct,at,lt,H),vt=c.getPitchedTextCorrection(Y.x+b[0],Y.y+b[1],T),gt=qa(K.point,$,e,St,-c.bearingInRadians,vt),At=d.allowVerticalPlacement&&G.placedOrientation===h.ay.vertical?Math.PI/2:0;for(let qt=0;qt<G.numGlyphs;qt++)h.aF(D,gt,At);x&&G.associatedIconIndex>=0&&(V[G.associatedIconIndex]={shiftedAnchor:gt,angle:At})}else gr(G.numGlyphs,D)}if(x){L.clear();const N=d.icon.placedSymbolArray;for(let G=0;G<N.length;G++){const q=N.get(G);if(q.hidden)gr(q.numGlyphs,L);else{const Y=V[G];if(Y)for(let $=0;$<q.numGlyphs;$++)h.aF(L,Y.shiftedAnchor,Y.angle);else gr(q.numGlyphs,L)}}d.icon.dynamicLayoutVertexBuffer.updateData(L)}d.text.dynamicLayoutVertexBuffer.updateData(D)}function us(d,e,n){return n.iconsInText&&e?"symbolTextAndIcon":d?"symbolSDF":"symbolIcon"}function Ha(d,e,n,o,c,p,m,_,x,b,T,E,I){const D=d.context,L=D.gl,V=d.transform,N=_==="map",G=x==="map",q=_!=="viewport"&&n.layout.get("symbol-placement")!=="point",Y=N&&!G&&!q,$=!n.layout.get("symbol-sort-key").isConstant();let K=!1;const J=d.getDepthModeForSublayer(0,Xt.ReadOnly),H=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),it=[],ct=V.getCircleRadiusCorrection();for(const st of o){const at=e.getTile(st),lt=at.getBucket(n);if(!lt)continue;const St=c?lt.text:lt.icon;if(!St||!St.segments.get().length||!St.hasVisibleVertices)continue;const vt=St.programConfigurations.get(n.id),gt=c||lt.sdfIcons,At=c?lt.textSizeData:lt.iconSizeData,qt=G||V.pitch!==0,$t=d.useProgram(us(gt,c,lt),vt),ye=h.ax(At,V.zoom),xe=d.style.map.terrain&&d.style.map.terrain.getTerrainData(st);let Ae,he,Xe,Te,Ge=[0,0],je=null;if(c)he=at.glyphAtlasTexture,Xe=L.LINEAR,Ae=at.glyphAtlasTexture.size,lt.iconsInText&&(Ge=at.imageAtlasTexture.size,je=at.imageAtlasTexture,Te=qt||d.options.rotating||d.options.zooming||At.kind==="composite"||At.kind==="camera"?L.LINEAR:L.NEAREST);else{const Be=n.layout.get("icon-size").constantOr(0)!==1||lt.iconsNeedLinear;he=at.imageAtlasTexture,Xe=gt||d.options.rotating||d.options.zooming||Be||qt?L.LINEAR:L.NEAREST,Ae=at.imageAtlasTexture.size}const Ze=h.aM(at,1,d.transform.zoom),Fi=qe(N,d.transform,Ze),Dr=h.N();h.aA(Dr,Fi);const wr=me(G,N,d.transform,Ze),sn=h.aN(V,at,p,m),an=V.getProjectionData({overscaledTileID:st,applyGlobeMatrix:!I,applyTerrainMatrix:!0}),Rn=H&&lt.hasTextData(),Xi=n.layout.get("icon-text-fit")!=="none"&&Rn&&lt.hasIconData();if(q){const Be=d.style.map.terrain?(Ye,de)=>d.style.map.terrain.getElevation(st,Ye,de):null,De=n.layout.get("text-rotation-alignment")==="map";xn(lt,d,c,Fi,Dr,G,b,De,st.toUnwrapped(),V.width,V.height,sn,Be)}const zr=c&&H||Xi,Ni=q||zr?Pc:G?Fi:d.transform.clipSpaceToPixelsMatrix,kr=gt&&n.paint.get(c?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Ln;Ln=gt?lt.iconsInText?Zo(At.kind,ye,Y,G,q,zr,d,Ni,wr,sn,Ae,Ge,ct):br(At.kind,ye,Y,G,q,zr,d,Ni,wr,sn,c,Ae,0,ct):js(At.kind,ye,Y,G,q,zr,d,Ni,wr,sn,c,Ae,ct);const Fn={program:$t,buffers:St,uniformValues:Ln,projectionData:an,atlasTexture:he,atlasTextureIcon:je,atlasInterpolation:Xe,atlasInterpolationIcon:Te,isSDF:gt,hasHalo:kr};if($&&lt.canOverlap){K=!0;const Be=St.segments.get();for(const De of Be)it.push({segments:new h.aW([De]),sortKey:De.sortKey,state:Fn,terrainData:xe})}else it.push({segments:St.segments,sortKey:0,state:Fn,terrainData:xe})}K&&it.sort((st,at)=>st.sortKey-at.sortKey);for(const st of it){const at=st.state;if(D.activeTexture.set(L.TEXTURE0),at.atlasTexture.bind(at.atlasInterpolation,L.CLAMP_TO_EDGE),at.atlasTextureIcon&&(D.activeTexture.set(L.TEXTURE1),at.atlasTextureIcon&&at.atlasTextureIcon.bind(at.atlasInterpolationIcon,L.CLAMP_TO_EDGE)),at.isSDF){const lt=at.uniformValues;at.hasHalo&&(lt.u_is_halo=1,Mc(at.buffers,st.segments,n,d,at.program,J,T,E,lt,at.projectionData,st.terrainData)),lt.u_is_halo=0}Mc(at.buffers,st.segments,n,d,at.program,J,T,E,at.uniformValues,at.projectionData,st.terrainData)}}function Mc(d,e,n,o,c,p,m,_,x,b,T){const E=o.context;c.draw(E,E.gl.TRIANGLES,p,m,_,se.backCCW,x,T,b,n.id,d.layoutVertexBuffer,d.indexBuffer,e,n.paint,o.transform.zoom,d.programConfigurations.get(n.id),d.dynamicLayoutVertexBuffer,d.opacityVertexBuffer)}function $s(d,e,n,o,c){const p=d.context,m=p.gl,_=re.disabled,x=new we([m.ONE,m.ONE],h.bo.transparent,[!0,!0,!0,!0]),b=e.getBucket(n);if(!b)return;const T=o.key;let E=n.heatmapFbos.get(T);E||(E=tl(p,e.tileSize,e.tileSize),n.heatmapFbos.set(T,E)),p.bindFramebuffer.set(E.framebuffer),p.viewport.set([0,0,e.tileSize,e.tileSize]),p.clear({color:h.bo.transparent});const I=b.programConfigurations.get(n.id),D=d.useProgram("heatmap",I,!c),L=d.transform.getProjectionData({overscaledTileID:e.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),V=d.style.map.terrain.getTerrainData(o);D.draw(p,m.TRIANGLES,Xt.disabled,_,x,se.disabled,No(e,d.transform.zoom,n.paint.get("heatmap-intensity"),1),V,L,n.id,b.layoutVertexBuffer,b.indexBuffer,b.segments,n.paint,d.transform.zoom,I)}function ju(d,e,n,o,c){const p=d.context,m=p.gl,_=d.transform;p.setColorMode(d.colorModeForRenderPass());const x=qs(p,e),b=n.key,T=e.heatmapFbos.get(b);if(!T)return;p.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,T.colorAttachment.get()),p.activeTexture.set(m.TEXTURE1),x.bind(m.LINEAR,m.CLAMP_TO_EDGE);const E=_.getProjectionData({overscaledTileID:n,applyTerrainMatrix:c,applyGlobeMatrix:!o});d.useProgram("heatmapTexture").draw(p,m.TRIANGLES,Xt.disabled,re.disabled,d.colorModeForRenderPass(),se.disabled,jo(d,e,0,1),null,E,e.id,d.rasterBoundsBuffer,d.quadTriangleIndexBuffer,d.rasterBoundsSegments,e.paint,_.zoom),T.destroy(),e.heatmapFbos.delete(b)}function tl(d,e,n){var o,c;const p=d.gl,m=p.createTexture();p.bindTexture(p.TEXTURE_2D,m),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,p.LINEAR),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,p.LINEAR);const _=(o=d.HALF_FLOAT)!==null&&o!==void 0?o:p.UNSIGNED_BYTE,x=(c=d.RGBA16F)!==null&&c!==void 0?c:p.RGBA;p.texImage2D(p.TEXTURE_2D,0,x,e,n,0,p.RGBA,_,null);const b=d.createFramebuffer(e,n,!1,!1);return b.colorAttachment.set(m),b}function qs(d,e){return e.colorRampTexture||(e.colorRampTexture=new h.T(d,e.colorRamp,d.gl.RGBA)),e.colorRampTexture}function Xa(d,e,n,o,c,p,m,_){let x=256;if(c.stepInterpolant){const b=e.getSource().maxzoom,T=m.canonical.z===b?Math.ceil(1<<d.transform.maxZoom-m.canonical.z):1;x=h.an(h.cd(p.maxLineLength/h.a4*1024*T),256,n.maxTextureSize)}return _.gradient=h.ce({expression:c.gradientExpression(),evaluationKey:"lineProgress",resolution:x,image:_.gradient||void 0,clips:p.lineClipsArray}),_.texture?_.texture.update(_.gradient):_.texture=new h.T(n,_.gradient,o.RGBA),_.version=c.gradientVersion,_.texture}function Ic(d,e,n,o,c){d.activeTexture.set(e.TEXTURE0),n.imageAtlasTexture.bind(e.LINEAR,e.CLAMP_TO_EDGE),o.updatePaintBuffers(c)}function Ec(d,e,n,o,c,p){(c||d.lineAtlas.dirty)&&(e.activeTexture.set(n.TEXTURE0),d.lineAtlas.bind(e)),o.updatePaintBuffers(p)}function Ya(d,e,n,o,c,p,m){const _=p.gradients[c.id];let x=_.texture;c.gradientVersion!==_.version&&(x=Xa(d,e,n,o,c,p,m,_)),n.activeTexture.set(o.TEXTURE0),x.bind(c.stepInterpolant?o.NEAREST:o.LINEAR,o.CLAMP_TO_EDGE)}function el(d,e,n,o,c,p,m,_,x){const b=p.gradients[c.id];let T=b.texture;c.gradientVersion!==b.version&&(T=Xa(d,e,n,o,c,p,m,b)),n.activeTexture.set(o.TEXTURE0),T.bind(c.stepInterpolant?o.NEAREST:o.LINEAR,o.CLAMP_TO_EDGE),n.activeTexture.set(o.TEXTURE1),d.lineAtlas.bind(n),_.updatePaintBuffers(x)}function Cc(d,e,n,o,c){if(!n||!o||!o.imageAtlas)return;const p=o.imageAtlas.patternPositions;let m=p[n.to.toString()],_=p[n.from.toString()];if(!m&&_&&(m=_),!_&&m&&(_=m),!m||!_){const x=c.getPaintProperty(e);m=p[x],_=p[x]}m&&_&&d.setConstantPatternPositions(m,_)}function il(d,e,n,o,c,p,m,_){const x=d.context.gl,b="fill-pattern",T=n.paint.get(b),E=T&&T.constantOr(1),I=n.getCrossfadeParameters();let D,L,V,N,G;const q=d.transform,Y=n.paint.get("fill-translate"),$=n.paint.get("fill-translate-anchor");m?(L=E&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",D=x.LINES):(L=E?"fillPattern":"fill",D=x.TRIANGLES);const K=T.constantOr(null);for(const J of o){const H=e.getTile(J);if(E&&!H.patternsLoaded())continue;const it=H.getBucket(n);if(!it)continue;const ct=it.programConfigurations.get(n.id),st=d.useProgram(L,ct),at=d.style.map.terrain&&d.style.map.terrain.getTerrainData(J);E&&(d.context.activeTexture.set(x.TEXTURE0),H.imageAtlasTexture.bind(x.LINEAR,x.CLAMP_TO_EDGE),ct.updatePaintBuffers(I)),Cc(ct,b,K,H,n);const lt=q.getProjectionData({overscaledTileID:J,applyGlobeMatrix:!_,applyTerrainMatrix:!0}),St=h.aN(q,H,Y,$);if(m){N=it.indexBuffer2,G=it.segments2;const gt=[x.drawingBufferWidth,x.drawingBufferHeight];V=L==="fillOutlinePattern"&&E?Du(d,I,H,gt,St):uc(gt,St)}else N=it.indexBuffer,G=it.segments,V=E?cc(d,I,H,St):{u_fill_translate:St};const vt=d.stencilModeForClipping(J);st.draw(d.context,D,c,vt,p,se.backCCW,V,at,lt,n.id,it.layoutVertexBuffer,N,G,n.paint,d.transform.zoom,ct)}}function Ce(d,e,n,o,c,p,m,_){const x=d.context,b=x.gl,T="fill-extrusion-pattern",E=n.paint.get(T),I=E.constantOr(1),D=n.getCrossfadeParameters(),L=n.paint.get("fill-extrusion-opacity"),V=E.constantOr(null),N=d.transform;for(const G of o){const q=e.getTile(G),Y=q.getBucket(n);if(!Y)continue;const $=d.style.map.terrain&&d.style.map.terrain.getTerrainData(G),K=Y.programConfigurations.get(n.id),J=d.useProgram(I?"fillExtrusionPattern":"fillExtrusion",K);I&&(d.context.activeTexture.set(b.TEXTURE0),q.imageAtlasTexture.bind(b.LINEAR,b.CLAMP_TO_EDGE),K.updatePaintBuffers(D));const H=N.getProjectionData({overscaledTileID:G,applyGlobeMatrix:!_,applyTerrainMatrix:!0});Cc(K,T,V,q,n);const it=h.aN(N,q,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),ct=n.paint.get("fill-extrusion-vertical-gradient"),st=I?as(d,ct,L,it,G,D,q):lc(d,ct,L,it);J.draw(x,x.gl.TRIANGLES,c,p,m,se.backCCW,st,$,H,n.id,Y.layoutVertexBuffer,Y.indexBuffer,Y.segments,n.paint,d.transform.zoom,K,d.style.map.terrain&&Y.centroidVertexBuffer)}}function Er(d,e,n,o,c,p,m,_,x){var b;const T=d.style.projection,E=d.context,I=d.transform,D=E.gl,L=[`#define NUM_ILLUMINATION_SOURCES ${n.paint.get("hillshade-highlight-color").values.length}`],V=d.useProgram("hillshade",null,!1,L),N=!d.options.moving;for(const G of o){const q=e.getTile(G),Y=q.fbo;if(!Y)continue;const $=T.getMeshFromTileID(E,G.canonical,_,!0,"raster"),K=(b=d.style.map.terrain)===null||b===void 0?void 0:b.getTerrainData(G);E.activeTexture.set(D.TEXTURE0),D.bindTexture(D.TEXTURE_2D,Y.colorAttachment.get());const J=I.getProjectionData({overscaledTileID:G,aligned:N,applyGlobeMatrix:!x,applyTerrainMatrix:!0});V.draw(E,D.TRIANGLES,p,c[G.overscaledZ],m,se.backCCW,Sn(d,q,n),K,J,n.id,$.vertexBuffer,$.indexBuffer,$.segments)}}function Li(d,e,n,o,c,p,m,_,x){var b;const T=d.style.projection,E=d.context,I=d.transform,D=E.gl,L=d.useProgram("colorRelief"),V=!d.options.moving;let N=!0,G=0;for(const q of o){const Y=e.getTile(q),$=Y.dem;if(N){const st=D.getParameter(D.MAX_TEXTURE_SIZE),{elevationTexture:at,colorTexture:lt}=n.getColorRampTextures(E,st,$.getUnpackVector());E.activeTexture.set(D.TEXTURE1),at.bind(D.NEAREST,D.CLAMP_TO_EDGE),E.activeTexture.set(D.TEXTURE4),lt.bind(D.LINEAR,D.CLAMP_TO_EDGE),N=!1,G=at.size[0]}if(!$||!$.data)continue;const K=$.stride,J=$.getPixels();if(E.activeTexture.set(D.TEXTURE0),E.pixelStoreUnpackPremultiplyAlpha.set(!1),Y.demTexture=Y.demTexture||d.getTileTexture(K),Y.demTexture){const st=Y.demTexture;st.update(J,{premultiply:!1}),st.bind(D.LINEAR,D.CLAMP_TO_EDGE)}else Y.demTexture=new h.T(E,J,D.RGBA,{premultiply:!1}),Y.demTexture.bind(D.LINEAR,D.CLAMP_TO_EDGE);const H=T.getMeshFromTileID(E,q.canonical,_,!0,"raster"),it=(b=d.style.map.terrain)===null||b===void 0?void 0:b.getTerrainData(q),ct=I.getProjectionData({overscaledTileID:q,aligned:V,applyGlobeMatrix:!x,applyTerrainMatrix:!0});L.draw(E,D.TRIANGLES,p,c[q.overscaledZ],m,se.backCCW,Vs(n,Y.dem,G),it,ct,n.id,H.vertexBuffer,H.indexBuffer,H.segments)}}const Ws=[new h.P(0,0),new h.P(h.a4,0),new h.P(h.a4,h.a4),new h.P(0,h.a4)];function Cn(d,e,n,o,c,p,m,_,x=!1,b=!1){const T=o[o.length-1].overscaledZ,E=d.context,I=E.gl,D=d.useProgram("raster"),L=d.transform,V=d.style.projection,N=d.colorModeForRenderPass(),G=!d.options.moving,q=n.paint.get("raster-opacity"),Y=n.paint.get("raster-resampling"),$=n.paint.get("raster-fade-duration"),K=!!d.style.map.terrain;for(const J of o){const H=d.getDepthModeForSublayer(J.overscaledZ-T,q===1?Xt.ReadWrite:Xt.ReadOnly,I.LESS),it=e.getTile(J),ct=Y==="nearest"?I.NEAREST:I.LINEAR;E.activeTexture.set(I.TEXTURE0),it.texture.bind(ct,I.CLAMP_TO_EDGE,I.LINEAR_MIPMAP_NEAREST),E.activeTexture.set(I.TEXTURE1);const{parentTile:st,parentScaleBy:at,parentTopLeft:lt,fadeValues:St}=Ac(it,e,$,K);it.fadeOpacity=St.tileOpacity,st?(st.fadeOpacity=St.parentTileOpacity,st.texture.bind(ct,I.CLAMP_TO_EDGE,I.LINEAR_MIPMAP_NEAREST)):it.texture.bind(ct,I.CLAMP_TO_EDGE,I.LINEAR_MIPMAP_NEAREST),it.texture.useMipmap&&E.extTextureFilterAnisotropic&&d.transform.pitch>20&&I.texParameterf(I.TEXTURE_2D,E.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,E.extTextureFilterAnisotropicMax);const vt=d.style.map.terrain&&d.style.map.terrain.getTerrainData(J),gt=L.getProjectionData({overscaledTileID:J,aligned:G,applyGlobeMatrix:!b,applyTerrainMatrix:!0}),At=Go(lt,at,St.fadeMix,n,_),qt=V.getMeshFromTileID(E,J.canonical,p,m,"raster");D.draw(E,I.TRIANGLES,H,c?c[J.overscaledZ]:re.disabled,N,x?se.frontCCW:se.backCCW,At,vt,gt,n.id,qt.vertexBuffer,qt.indexBuffer,qt.segments)}}function Ac(d,e,n,o){const c={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(n===0||o)return c;if(d.fadingParentID){const p=e.getLoadedTile(d.fadingParentID);if(!p)return c;const m=Math.pow(2,p.tileID.overscaledZ-d.tileID.overscaledZ),_=[d.tileID.canonical.x*m%1,d.tileID.canonical.y*m%1],x=function(b,T,E){const I=ne(),D=(I-T.timeAdded)/E,L=b.fadingDirection===tt.Incoming,V=h.an((I-b.timeAdded)/E,0,1),N=h.an(1-D,0,1),G=L?V:N;return{tileOpacity:G,parentTileOpacity:L?N:V,fadeMix:{opacity:1,mix:1-G}}}(d,p,n);return{parentTile:p,parentScaleBy:m,parentTopLeft:_,fadeValues:x}}if(d.selfFading){const p=function(m,_){const x=(ne()-m.timeAdded)/_,b=h.an(x,0,1);return{tileOpacity:b,fadeMix:{opacity:b,mix:0}}}(d,n);return{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:p}}return c}const hs=new h.bo(1,0,0,1),rl=new h.bo(0,1,0,1),Hs=new h.bo(0,0,1,1),nl=new h.bo(1,0,1,1),Dc=new h.bo(0,1,1,1);function sl(d,e,n,o){Xs(d,0,e+n/2,d.transform.width,n,o)}function al(d,e,n,o){Xs(d,e-n/2,0,n,d.transform.height,o)}function Xs(d,e,n,o,c,p){const m=d.context,_=m.gl;_.enable(_.SCISSOR_TEST),_.scissor(e*d.pixelRatio,n*d.pixelRatio,o*d.pixelRatio,c*d.pixelRatio),m.clear({color:p}),_.disable(_.SCISSOR_TEST)}function zc(d,e,n){const o=d.context,c=o.gl,p=d.useProgram("debug"),m=Xt.disabled,_=re.disabled,x=d.colorModeForRenderPass(),b="$debug",T=d.style.map.terrain&&d.style.map.terrain.getTerrainData(n);o.activeTexture.set(c.TEXTURE0);const E=e.getTileByID(n.key).latestRawTileData,I=Math.floor((E&&E.byteLength||0)/1024),D=e.getTile(n).tileSize,L=512/Math.min(D,512)*(n.overscaledZ/d.transform.zoom)*.5;let V=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(V+=` => ${n.overscaledZ}`),function(G,q){G.initDebugOverlayCanvas();const Y=G.debugOverlayCanvas,$=G.context.gl,K=G.debugOverlayCanvas.getContext("2d");K.clearRect(0,0,Y.width,Y.height),K.shadowColor="white",K.shadowBlur=2,K.lineWidth=1.5,K.strokeStyle="white",K.textBaseline="top",K.font="bold 36px Open Sans, sans-serif",K.fillText(q,5,5),K.strokeText(q,5,5),G.debugOverlayTexture.update(Y),G.debugOverlayTexture.bind($.LINEAR,$.CLAMP_TO_EDGE)}(d,`${V} ${I}kB`);const N=d.transform.getProjectionData({overscaledTileID:n,applyGlobeMatrix:!0,applyTerrainMatrix:!0});p.draw(o,c.TRIANGLES,m,_,we.alphaBlended,se.disabled,Vo(h.bo.transparent,L),null,N,b,d.debugBuffer,d.quadTriangleIndexBuffer,d.debugSegments),p.draw(o,c.LINE_STRIP,m,_,x,se.disabled,Vo(h.bo.red),T,N,b,d.debugBuffer,d.tileBorderIndexBuffer,d.debugSegments)}function rn(d,e,n,o){const{isRenderingGlobe:c}=o,p=d.context,m=p.gl,_=d.transform,x=d.colorModeForRenderPass(),b=d.getDepthModeFor3D(),T=d.useProgram("terrain");p.bindFramebuffer.set(null),p.viewport.set([0,0,d.width,d.height]);for(const E of n){const I=e.getTerrainMesh(E.tileID),D=d.renderToTexture.getTexture(E),L=e.getTerrainData(E.tileID);p.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,D.texture);const V=e.getMeshFrameDelta(_.zoom),N=_.calculateFogMatrix(E.tileID.toUnwrapped()),G=Bo(V,N,d.style.sky,_.pitch,c),q=_.getProjectionData({overscaledTileID:E.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});T.draw(p,m.TRIANGLES,b,re.disabled,x,se.backCCW,G,L,q,"terrain",I.vertexBuffer,I.indexBuffer,I.segments)}}function ol(d,e){if(!e.mesh){const n=new h.aV;n.emplaceBack(-1,-1),n.emplaceBack(1,-1),n.emplaceBack(1,1),n.emplaceBack(-1,1);const o=new h.aX;o.emplaceBack(0,1,2),o.emplaceBack(0,2,3),e.mesh=new Jr(d.createVertexBuffer(n,We.members),d.createIndexBuffer(o),h.aW.simpleSegment(0,0,n.length,o.length))}return e.mesh}class kc{constructor(e,n){this.context=new Ga(e),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:h.ar(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Kt.maxOverzooming+Kt.maxUnderzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new bn}resize(e,n,o){if(this.width=Math.floor(e*o),this.height=Math.floor(n*o),this.pixelRatio=o,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const c of this.style._order)this.style._layers[c].resize()}setup(){const e=this.context,n=new h.aV;n.emplaceBack(0,0),n.emplaceBack(h.a4,0),n.emplaceBack(0,h.a4),n.emplaceBack(h.a4,h.a4),this.tileExtentBuffer=e.createVertexBuffer(n,We.members),this.tileExtentSegments=h.aW.simpleSegment(0,0,4,2);const o=new h.aV;o.emplaceBack(0,0),o.emplaceBack(h.a4,0),o.emplaceBack(0,h.a4),o.emplaceBack(h.a4,h.a4),this.debugBuffer=e.createVertexBuffer(o,We.members),this.debugSegments=h.aW.simpleSegment(0,0,4,5);const c=new h.cg;c.emplaceBack(0,0,0,0),c.emplaceBack(h.a4,0,h.a4,0),c.emplaceBack(0,h.a4,0,h.a4),c.emplaceBack(h.a4,h.a4,h.a4,h.a4),this.rasterBoundsBuffer=e.createVertexBuffer(c,vr.members),this.rasterBoundsSegments=h.aW.simpleSegment(0,0,4,2);const p=new h.aV;p.emplaceBack(0,0),p.emplaceBack(h.a4,0),p.emplaceBack(0,h.a4),p.emplaceBack(h.a4,h.a4),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(p,We.members),this.rasterBoundsSegmentsPosOnly=h.aW.simpleSegment(0,0,4,5);const m=new h.aV;m.emplaceBack(0,0),m.emplaceBack(1,0),m.emplaceBack(0,1),m.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(m,We.members),this.viewportSegments=h.aW.simpleSegment(0,0,4,2);const _=new h.ch;_.emplaceBack(0),_.emplaceBack(1),_.emplaceBack(3),_.emplaceBack(2),_.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(_);const x=new h.aX;x.emplaceBack(1,0,2),x.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(x);const b=this.context.gl;this.stencilClearMode=new re({func:b.ALWAYS,mask:0},0,255,b.ZERO,b.ZERO,b.ZERO),this.tileExtentMesh=new Jr(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const e=this.context,n=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const o=h.N();h.c6(o,0,this.width,this.height,0,0,1),h.Q(o,o,[n.drawingBufferWidth,n.drawingBufferHeight,0]);const c={mainMatrix:o,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:o};this.useProgram("clippingMask",null,!0).draw(e,n.TRIANGLES,Xt.disabled,this.stencilClearMode,we.disabled,se.disabled,null,null,c,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,n,o){if(this.currentStencilSource===e.source||!e.isTileClipped()||!n||!n.length)return;this.currentStencilSource=e.source,this.nextStencilID+n.length>256&&this.clearStencil();const c=this.context;c.setColorMode(we.disabled),c.setDepthMode(Xt.disabled);const p={};for(const m of n)p[m.key]=this.nextStencilID++;this._renderTileMasks(p,n,o,!0),this._renderTileMasks(p,n,o,!1),this._tileClippingMaskIDs=p}_renderTileMasks(e,n,o,c){const p=this.context,m=p.gl,_=this.style.projection,x=this.transform,b=this.useProgram("clippingMask");for(const T of n){const E=e[T.key],I=this.style.map.terrain&&this.style.map.terrain.getTerrainData(T),D=_.getMeshFromTileID(this.context,T.canonical,c,!0,"stencil"),L=x.getProjectionData({overscaledTileID:T,applyGlobeMatrix:!o,applyTerrainMatrix:!0});b.draw(p,m.TRIANGLES,Xt.disabled,new re({func:m.ALWAYS,mask:0},E,255,m.KEEP,m.KEEP,m.REPLACE),we.disabled,o?se.disabled:se.backCCW,null,I,L,"$clipping",D.vertexBuffer,D.indexBuffer,D.segments)}}_renderTilesDepthBuffer(){const e=this.context,n=e.gl,o=this.style.projection,c=this.transform,p=this.useProgram("depth"),m=this.getDepthModeFor3D(),_=Wt(c,{tileSize:c.tileSize});for(const x of _){const b=this.style.map.terrain&&this.style.map.terrain.getTerrainData(x),T=o.getMeshFromTileID(this.context,x.canonical,!0,!0,"raster"),E=c.getProjectionData({overscaledTileID:x,applyGlobeMatrix:!0,applyTerrainMatrix:!0});p.draw(e,n.TRIANGLES,m,re.disabled,we.disabled,se.backCCW,null,b,E,"$clipping",T.vertexBuffer,T.indexBuffer,T.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,n=this.context.gl;return new re({func:n.NOTEQUAL,mask:255},e,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(e){const n=this.context.gl;return new re({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,n.KEEP,n.KEEP,n.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){const n=this.context.gl,o=e.sort((m,_)=>_.overscaledZ-m.overscaledZ),c=o[o.length-1].overscaledZ,p=o[0].overscaledZ-c+1;if(p>1){this.currentStencilSource=void 0,this.nextStencilID+p>256&&this.clearStencil();const m={};for(let _=0;_<p;_++)m[_+c]=new re({func:n.GEQUAL,mask:255},_+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=p,[m,o]}return[{[c]:re.disabled},o]}stencilConfigForOverlapTwoPass(e){const n=this.context.gl,o=e.sort((m,_)=>_.overscaledZ-m.overscaledZ),c=o[o.length-1].overscaledZ,p=o[0].overscaledZ-c+1;if(this.clearStencil(),p>1){const m={},_={};for(let x=0;x<p;x++)m[x+c]=new re({func:n.GREATER,mask:255},p+1+x,255,n.KEEP,n.KEEP,n.REPLACE),_[x+c]=new re({func:n.GREATER,mask:255},1+x,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID=2*p+1,[m,_,o]}return this.nextStencilID=3,[{[c]:new re({func:n.GREATER,mask:255},2,255,n.KEEP,n.KEEP,n.REPLACE)},{[c]:new re({func:n.GREATER,mask:255},1,255,n.KEEP,n.KEEP,n.REPLACE)},o]}colorModeForRenderPass(){const e=this.context.gl;return this._showOverdrawInspector?new we([e.CONSTANT_COLOR,e.ONE],new h.bo(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?we.unblended:we.alphaBlended}getDepthModeForSublayer(e,n,o){if(!this.opaquePassEnabledForLayer())return Xt.disabled;const c=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new Xt(o||this.context.gl.LEQUAL,n,[c,c])}getDepthModeFor3D(){return new Xt(this.context.gl.LEQUAL,Xt.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,n){var o,c;this.style=e,this.options=n,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(ne()),this.imageManager.beginFrame();const p=this.style._order,m=this.style.tileManagers,_={},x={},b={},T={isRenderingToTexture:!1,isRenderingGlobe:((o=e.projection)===null||o===void 0?void 0:o.transitionState)>0};for(const I in m){const D=m[I];D.used&&D.prepare(this.context),_[I]=D.getVisibleCoordinates(!1),x[I]=_[I].slice().reverse(),b[I]=D.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let I=0;I<p.length;I++)if(this.style._layers[p[I]].is3D()){this.opaquePassCutoff=I;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const I of p){const D=this.style._layers[I];if(!D.hasOffscreenPass()||D.isHidden(this.transform.zoom))continue;const L=x[D.source];(D.type==="custom"||L.length)&&this.renderLayer(this,m[D.source],D,L,T)}if((c=this.style.projection)===null||c===void 0||c.updateGPUdependent({context:this.context,useProgram:I=>this.useProgram(I)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?h.bo.black:h.bo.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(I,D){const L=I.context,V=L.gl,N=((J,H,it)=>{const ct=Math.cos(H.rollInRadians),st=Math.sin(H.rollInRadians),at=nt(H),lt=H.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:J.properties.get("sky-color"),u_horizon_color:J.properties.get("horizon-color"),u_horizon:[(H.width/2-at*st)*it,(H.height/2+at*ct)*it],u_horizon_normal:[-st,ct],u_sky_horizon_blend:J.properties.get("sky-horizon-blend")*H.height/2*it,u_sky_blend:lt}})(D,I.style.map.transform,I.pixelRatio),G=new Xt(V.LEQUAL,Xt.ReadWrite,[0,1]),q=re.disabled,Y=I.colorModeForRenderPass(),$=I.useProgram("sky"),K=ol(L,D);$.draw(L,V.TRIANGLES,G,q,Y,se.disabled,N,null,void 0,"sky",K.vertexBuffer,K.indexBuffer,K.segments)}(this,this.style.sky),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=p.length-1;this.currentLayer>=0;this.currentLayer--){const I=this.style._layers[p[this.currentLayer]],D=m[I.source],L=_[I.source];this._renderTileClippingMasks(I,L,!1),this.renderLayer(this,D,I,L,T)}this.renderPass="translucent";let E=!1;for(this.currentLayer=0;this.currentLayer<p.length;this.currentLayer++){const I=this.style._layers[p[this.currentLayer]],D=m[I.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(I,T))continue;this.opaquePassEnabledForLayer()||E||(E=!0,T.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const L=(I.type==="symbol"?b:x)[I.source];this._renderTileClippingMasks(I,_[I.source],!!this.renderToTexture),this.renderLayer(this,D,I,L,T)}if(T.isRenderingGlobe&&function(I,D,L){const V=I.context,N=V.gl,G=I.useProgram("atmosphere"),q=new Xt(N.LEQUAL,Xt.ReadOnly,[0,1]),Y=I.transform,$=function(lt,St){const vt=lt.properties.get("position"),gt=[-vt.x,-vt.y,-vt.z],At=h.ar(new Float64Array(16));return lt.properties.get("anchor")==="map"&&(h.bf(At,At,St.rollInRadians),h.bg(At,At,-St.pitchInRadians),h.bf(At,At,St.bearingInRadians),h.bg(At,At,St.center.lat*Math.PI/180),h.bI(At,At,-St.center.lng*Math.PI/180)),h.cf(gt,gt,At),gt}(L,I.transform),K=Y.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),J=D.properties.get("atmosphere-blend")*K.projectionTransition;if(J===0)return;const H=Ia(Y.worldSize,Y.center.lat),it=Y.inverseProjectionMatrix,ct=new Float64Array(4);ct[3]=1,h.aG(ct,ct,Y.modelViewProjectionMatrix),ct[0]/=ct[3],ct[1]/=ct[3],ct[2]/=ct[3],ct[3]=1,h.aG(ct,ct,it),ct[0]/=ct[3],ct[1]/=ct[3],ct[2]/=ct[3],ct[3]=1;const st=((lt,St,vt,gt,At)=>({u_sun_pos:lt,u_atmosphere_blend:St,u_globe_position:vt,u_globe_radius:gt,u_inv_proj_matrix:At}))($,J,[ct[0],ct[1],ct[2]],H,it),at=ol(V,D);G.draw(V,N.TRIANGLES,q,re.disabled,we.alphaBlended,se.disabled,st,null,null,"atmosphere",at.vertexBuffer,at.indexBuffer,at.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const I=function(D,L){let V=null;const N=Object.values(D._layers).flatMap($=>$.source&&!$.isHidden(L)?[D.tileManagers[$.source]]:[]),G=N.filter($=>$.getSource().type==="vector"),q=N.filter($=>$.getSource().type!=="vector"),Y=$=>{(!V||V.getSource().maxzoom<$.getSource().maxzoom)&&(V=$)};return G.forEach($=>Y($)),V||q.forEach($=>Y($)),V}(this.style,this.transform.zoom);I&&function(D,L,V){for(let N=0;N<V.length;N++)zc(D,L,V[N])}(this,I,I.getVisibleCoordinates())}this.options.showPadding&&function(I){const D=I.transform.padding;sl(I,I.transform.height-(D.top||0),3,hs),sl(I,D.bottom||0,3,rl),al(I,D.left||0,3,Hs),al(I,I.transform.width-(D.right||0),3,nl);const L=I.transform.centerPoint;(function(V,N,G,q){Xs(V,N-1,G-10,2,20,q),Xs(V,N-10,G-1,20,2,q)})(I,L.x,I.transform.height-L.y,Dc)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;const n=this.terrainFacilitator.matrix,o=this.transform.modelViewProjectionMatrix;let c=this.terrainFacilitator.dirty;c||(c=e?!h.ci(n,o):!h.cj(n,o)),c||(c=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),c&&(h.ck(n,o),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(p,m){const _=p.context,x=_.gl,b=p.transform,T=we.unblended,E=new Xt(x.LEQUAL,Xt.ReadWrite,[0,1]),I=m.tileManager.getRenderableTiles(),D=p.useProgram("terrainDepth");_.bindFramebuffer.set(m.getFramebuffer("depth").framebuffer),_.viewport.set([0,0,p.width/devicePixelRatio,p.height/devicePixelRatio]),_.clear({color:h.bo.transparent,depth:1});for(const L of I){const V=m.getTerrainMesh(L.tileID),N=m.getTerrainData(L.tileID),G=b.getProjectionData({overscaledTileID:L.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),q={u_ele_delta:m.getMeshFrameDelta(b.zoom)};D.draw(_,x.TRIANGLES,E,re.disabled,T,se.backCCW,q,N,G,"terrain",V.vertexBuffer,V.indexBuffer,V.segments)}_.bindFramebuffer.set(null),_.viewport.set([0,0,p.width,p.height])}(this,this.style.map.terrain),function(p,m){const _=p.context,x=_.gl,b=p.transform,T=we.unblended,E=new Xt(x.LEQUAL,Xt.ReadWrite,[0,1]),I=m.getCoordsTexture(),D=m.tileManager.getRenderableTiles(),L=p.useProgram("terrainCoords");_.bindFramebuffer.set(m.getFramebuffer("coords").framebuffer),_.viewport.set([0,0,p.width/devicePixelRatio,p.height/devicePixelRatio]),_.clear({color:h.bo.transparent,depth:1}),m.coordsIndex=[];for(const V of D){const N=m.getTerrainMesh(V.tileID),G=m.getTerrainData(V.tileID);_.activeTexture.set(x.TEXTURE0),x.bindTexture(x.TEXTURE_2D,I.texture);const q={u_terrain_coords_id:(255-m.coordsIndex.length)/255,u_texture:0,u_ele_delta:m.getMeshFrameDelta(b.zoom)},Y=b.getProjectionData({overscaledTileID:V.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});L.draw(_,x.TRIANGLES,E,re.disabled,T,se.backCCW,q,G,Y,"terrain",N.vertexBuffer,N.indexBuffer,N.segments),m.coordsIndex.push(V.tileID.key)}_.bindFramebuffer.set(null),_.viewport.set([0,0,p.width,p.height])}(this,this.style.map.terrain))}renderLayer(e,n,o,c,p){o.isHidden(this.transform.zoom)||(o.type==="background"||o.type==="custom"||(c||[]).length)&&(this.id=o.id,h.cl(o)?function(m,_,x,b,T,E){if(m.renderPass!=="translucent")return;const{isRenderingToTexture:I}=E,D=re.disabled,L=m.colorModeForRenderPass();(x._unevaluatedLayout.hasValue("text-variable-anchor")||x._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(V,N,G,q,Y,$,K,J,H){const it=N.transform,ct=N.style.map.terrain,st=Y==="map",at=$==="map";for(const lt of V){const St=q.getTile(lt),vt=St.getBucket(G);if(!vt||!vt.text||!vt.text.segments.get().length)continue;const gt=h.ax(vt.textSizeData,it.zoom),At=h.aM(St,1,N.transform.zoom),qt=qe(st,N.transform,At),$t=G.layout.get("icon-text-fit")!=="none"&&vt.hasIconData();if(gt){const ye=Math.pow(2,it.zoom-St.tileID.overscaledZ),xe=ct?(Ae,he)=>ct.getElevation(lt,Ae,he):null;Wa(vt,st,at,H,it,qt,ye,gt,$t,h.aN(it,St,K,J),lt.toUnwrapped(),xe)}}}(b,m,x,_,x.layout.get("text-rotation-alignment"),x.layout.get("text-pitch-alignment"),x.paint.get("text-translate"),x.paint.get("text-translate-anchor"),T),x.paint.get("icon-opacity").constantOr(1)!==0&&Ha(m,_,x,b,!1,x.paint.get("icon-translate"),x.paint.get("icon-translate-anchor"),x.layout.get("icon-rotation-alignment"),x.layout.get("icon-pitch-alignment"),x.layout.get("icon-keep-upright"),D,L,I),x.paint.get("text-opacity").constantOr(1)!==0&&Ha(m,_,x,b,!0,x.paint.get("text-translate"),x.paint.get("text-translate-anchor"),x.layout.get("text-rotation-alignment"),x.layout.get("text-pitch-alignment"),x.layout.get("text-keep-upright"),D,L,I),_.map.showCollisionBoxes&&(Za(m,_,x,b,!0),Za(m,_,x,b,!1))}(e,n,o,c,this.style.placement.variableOffsets,p):h.cm(o)?function(m,_,x,b,T){if(m.renderPass!=="translucent")return;const{isRenderingToTexture:E}=T,I=x.paint.get("circle-opacity"),D=x.paint.get("circle-stroke-width"),L=x.paint.get("circle-stroke-opacity"),V=!x.layout.get("circle-sort-key").isConstant();if(I.constantOr(1)===0&&(D.constantOr(1)===0||L.constantOr(1)===0))return;const N=m.context,G=N.gl,q=m.transform,Y=m.getDepthModeForSublayer(0,Xt.ReadOnly),$=re.disabled,K=m.colorModeForRenderPass(),J=[],H=q.getCircleRadiusCorrection();for(let it=0;it<b.length;it++){const ct=b[it],st=_.getTile(ct),at=st.getBucket(x);if(!at)continue;const lt=x.paint.get("circle-translate"),St=x.paint.get("circle-translate-anchor"),vt=h.aN(q,st,lt,St),gt=at.programConfigurations.get(x.id),At=m.useProgram("circle",gt),qt=at.layoutVertexBuffer,$t=at.indexBuffer,ye=m.style.map.terrain&&m.style.map.terrain.getTerrainData(ct),xe={programConfiguration:gt,program:At,layoutVertexBuffer:qt,indexBuffer:$t,uniformValues:hc(m,st,x,vt,H),terrainData:ye,projectionData:q.getProjectionData({overscaledTileID:ct,applyGlobeMatrix:!E,applyTerrainMatrix:!0})};if(V){const Ae=at.segments.get();for(const he of Ae)J.push({segments:new h.aW([he]),sortKey:he.sortKey,state:xe})}else J.push({segments:at.segments,sortKey:0,state:xe})}V&&J.sort((it,ct)=>it.sortKey-ct.sortKey);for(const it of J){const{programConfiguration:ct,program:st,layoutVertexBuffer:at,indexBuffer:lt,uniformValues:St,terrainData:vt,projectionData:gt}=it.state;st.draw(N,G.TRIANGLES,Y,$,K,se.backCCW,St,vt,gt,x.id,at,lt,it.segments,x.paint,m.transform.zoom,ct)}}(e,n,o,c,p):h.cn(o)?function(m,_,x,b,T){if(x.paint.get("heatmap-opacity")===0)return;const E=m.context,{isRenderingToTexture:I,isRenderingGlobe:D}=T;if(m.style.map.terrain){for(const L of b){const V=_.getTile(L);_.hasRenderableParent(L)||(m.renderPass==="offscreen"?$s(m,V,x,L,D):m.renderPass==="translucent"&&ju(m,x,L,I,D))}E.viewport.set([0,0,m.width,m.height])}else m.renderPass==="offscreen"?function(L,V,N,G){const q=L.context,Y=q.gl,$=L.transform,K=re.disabled,J=new we([Y.ONE,Y.ONE],h.bo.transparent,[!0,!0,!0,!0]);(function(H,it,ct){const st=H.gl;H.activeTexture.set(st.TEXTURE1),H.viewport.set([0,0,it.width/4,it.height/4]);let at=ct.heatmapFbos.get(h.cc);at?(st.bindTexture(st.TEXTURE_2D,at.colorAttachment.get()),H.bindFramebuffer.set(at.framebuffer)):(at=tl(H,it.width/4,it.height/4),ct.heatmapFbos.set(h.cc,at))})(q,L,N),q.clear({color:h.bo.transparent});for(let H=0;H<G.length;H++){const it=G[H];if(V.hasRenderableParent(it))continue;const ct=V.getTile(it),st=ct.getBucket(N);if(!st)continue;const at=st.programConfigurations.get(N.id),lt=L.useProgram("heatmap",at),St=$.getProjectionData({overscaledTileID:it,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),vt=$.getCircleRadiusCorrection();lt.draw(q,Y.TRIANGLES,Xt.disabled,K,J,se.backCCW,No(ct,$.zoom,N.paint.get("heatmap-intensity"),vt),null,St,N.id,st.layoutVertexBuffer,st.indexBuffer,st.segments,N.paint,$.zoom,at)}q.viewport.set([0,0,L.width,L.height])}(m,_,x,b):m.renderPass==="translucent"&&function(L,V){const N=L.context,G=N.gl;N.setColorMode(L.colorModeForRenderPass());const q=V.heatmapFbos.get(h.cc);q&&(N.activeTexture.set(G.TEXTURE0),G.bindTexture(G.TEXTURE_2D,q.colorAttachment.get()),N.activeTexture.set(G.TEXTURE1),qs(N,V).bind(G.LINEAR,G.CLAMP_TO_EDGE),L.useProgram("heatmapTexture").draw(N,G.TRIANGLES,Xt.disabled,re.disabled,L.colorModeForRenderPass(),se.disabled,jo(L,V,0,1),null,null,V.id,L.viewportBuffer,L.quadTriangleIndexBuffer,L.viewportSegments,V.paint,L.transform.zoom))}(m,x)}(e,n,o,c,p):h.co(o)?function(m,_,x,b,T){if(m.renderPass!=="translucent")return;const{isRenderingToTexture:E}=T,I=x.paint.get("line-opacity"),D=x.paint.get("line-width");if(I.constantOr(1)===0||D.constantOr(1)===0)return;const L=m.getDepthModeForSublayer(0,Xt.ReadOnly),V=m.colorModeForRenderPass(),N=x.paint.get("line-dasharray"),G=N.constantOr(1),q=x.paint.get("line-pattern"),Y=q.constantOr(1),$=x.paint.get("line-gradient"),K=x.getCrossfadeParameters();let J;J=Y?"linePattern":G&&$?"lineGradientSDF":G?"lineSDF":$?"lineGradient":"line";const H=m.context,it=H.gl,ct=m.transform;let st=!0;for(const at of b){const lt=_.getTile(at);if(Y&&!lt.patternsLoaded())continue;const St=lt.getBucket(x);if(!St)continue;const vt=St.programConfigurations.get(x.id),gt=m.context.program.get(),At=m.useProgram(J,vt),qt=st||At.program!==gt,$t=m.style.map.terrain&&m.style.map.terrain.getTerrainData(at),ye=q.constantOr(null),xe=N&&N.constantOr(null);if(ye&&lt.imageAtlas){const Ge=lt.imageAtlas,je=Ge.patternPositions[ye.to.toString()],Ze=Ge.patternPositions[ye.from.toString()];je&&Ze&&vt.setConstantPatternPositions(je,Ze)}else if(xe){const Ge=x.layout.get("line-cap")==="round",je=m.lineAtlas.getDash(xe.to,Ge),Ze=m.lineAtlas.getDash(xe.from,Ge);vt.setConstantDashPositions(je,Ze)}const Ae=ct.getProjectionData({overscaledTileID:at,applyGlobeMatrix:!E,applyTerrainMatrix:!0}),he=ct.getPixelScale();let Xe;Y?(Xe=zu(m,lt,x,he,K),Ic(H,it,lt,vt,K)):G&&$?(Xe=mc(m,lt,x,he,K,St.lineClipsArray.length),el(m,_,H,it,x,St,at,vt,K)):G?(Xe=ku(m,lt,x,he,K),Ec(m,H,it,vt,qt,K)):$?(Xe=Ns(m,lt,x,he,St.lineClipsArray.length),Ya(m,_,H,it,x,St,at)):Xe=za(m,lt,x,he);const Te=m.stencilModeForClipping(at);At.draw(H,it.TRIANGLES,L,Te,V,se.disabled,Xe,$t,Ae,x.id,St.layoutVertexBuffer,St.indexBuffer,St.segments,x.paint,m.transform.zoom,vt,St.layoutVertexBuffer2),st=!1}}(e,n,o,c,p):h.cp(o)?function(m,_,x,b,T){const E=x.paint.get("fill-color"),I=x.paint.get("fill-opacity");if(I.constantOr(1)===0)return;const{isRenderingToTexture:D}=T,L=m.colorModeForRenderPass(),V=x.paint.get("fill-pattern"),N=m.opaquePassEnabledForLayer()&&!V.constantOr(1)&&E.constantOr(h.bo.transparent).a===1&&I.constantOr(0)===1?"opaque":"translucent";if(m.renderPass===N){const G=m.getDepthModeForSublayer(1,m.renderPass==="opaque"?Xt.ReadWrite:Xt.ReadOnly);il(m,_,x,b,G,L,!1,D)}if(m.renderPass==="translucent"&&x.paint.get("fill-antialias")){const G=m.getDepthModeForSublayer(x.getPaintProperty("fill-outline-color")?2:0,Xt.ReadOnly);il(m,_,x,b,G,L,!0,D)}}(e,n,o,c,p):h.cq(o)?function(m,_,x,b,T){const E=x.paint.get("fill-extrusion-opacity");if(E===0)return;const{isRenderingToTexture:I}=T;if(m.renderPass==="translucent"){const D=new Xt(m.context.gl.LEQUAL,Xt.ReadWrite,m.depthRangeFor3D);if(E!==1||x.paint.get("fill-extrusion-pattern").constantOr(1))Ce(m,_,x,b,D,re.disabled,we.disabled,I),Ce(m,_,x,b,D,m.stencilModeFor3D(),m.colorModeForRenderPass(),I);else{const L=m.colorModeForRenderPass();Ce(m,_,x,b,D,re.disabled,L,I)}}}(e,n,o,c,p):h.cr(o)?function(m,_,x,b,T){if(m.renderPass!=="offscreen"&&m.renderPass!=="translucent")return;const{isRenderingToTexture:E}=T,I=m.context,D=m.style.projection.useSubdivision,L=m.getDepthModeForSublayer(0,Xt.ReadOnly),V=m.colorModeForRenderPass();if(m.renderPass==="offscreen")(function(N,G,q,Y,$,K,J){const H=N.context,it=H.gl;for(const ct of q){const st=G.getTile(ct),at=st.dem;if(!at||!at.data||!st.needsHillshadePrepare)continue;const lt=at.dim,St=at.stride,vt=at.getPixels();if(H.activeTexture.set(it.TEXTURE1),H.pixelStoreUnpackPremultiplyAlpha.set(!1),st.demTexture=st.demTexture||N.getTileTexture(St),st.demTexture){const At=st.demTexture;At.update(vt,{premultiply:!1}),At.bind(it.NEAREST,it.CLAMP_TO_EDGE)}else st.demTexture=new h.T(H,vt,it.RGBA,{premultiply:!1}),st.demTexture.bind(it.NEAREST,it.CLAMP_TO_EDGE);H.activeTexture.set(it.TEXTURE0);let gt=st.fbo;if(!gt){const At=new h.T(H,{width:lt,height:lt,data:null},it.RGBA);At.bind(it.LINEAR,it.CLAMP_TO_EDGE),gt=st.fbo=H.createFramebuffer(lt,lt,!0,!1),gt.colorAttachment.set(At.texture)}H.bindFramebuffer.set(gt.framebuffer),H.viewport.set([0,0,lt,lt]),N.useProgram("hillshadePrepare").draw(H,it.TRIANGLES,$,K,J,se.disabled,pc(st.tileID,at),null,null,Y.id,N.rasterBoundsBuffer,N.quadTriangleIndexBuffer,N.rasterBoundsSegments),st.needsHillshadePrepare=!1}})(m,_,b,x,L,re.disabled,V),I.viewport.set([0,0,m.width,m.height]);else if(m.renderPass==="translucent")if(D){const[N,G,q]=m.stencilConfigForOverlapTwoPass(b);Er(m,_,x,q,N,L,V,!1,E),Er(m,_,x,q,G,L,V,!0,E)}else{const[N,G]=m.getStencilConfigForOverlapAndUpdateStencilID(b);Er(m,_,x,G,N,L,V,!1,E)}}(e,n,o,c,p):h.cs(o)?function(m,_,x,b,T){if(m.renderPass!=="translucent"||!b.length)return;const{isRenderingToTexture:E}=T,I=m.style.projection.useSubdivision,D=m.getDepthModeForSublayer(0,Xt.ReadOnly),L=m.colorModeForRenderPass();if(I){const[V,N,G]=m.stencilConfigForOverlapTwoPass(b);Li(m,_,x,G,V,D,L,!1,E),Li(m,_,x,G,N,D,L,!0,E)}else{const[V,N]=m.getStencilConfigForOverlapAndUpdateStencilID(b);Li(m,_,x,N,V,D,L,!1,E)}}(e,n,o,c,p):h.bT(o)?function(m,_,x,b,T){if(m.renderPass!=="translucent"||x.paint.get("raster-opacity")===0||!b.length)return;const{isRenderingToTexture:E}=T,I=_.getSource(),D=m.style.projection.useSubdivision;if(I instanceof Ai)Cn(m,_,x,b,null,!1,!1,I.tileCoords,I.flippedWindingOrder,E);else if(D){const[L,V,N]=m.stencilConfigForOverlapTwoPass(b);Cn(m,_,x,N,L,!1,!0,Ws,!1,E),Cn(m,_,x,N,V,!0,!0,Ws,!1,E)}else{const[L,V]=m.getStencilConfigForOverlapAndUpdateStencilID(b);Cn(m,_,x,V,L,!1,!0,Ws,!1,E)}}(e,n,o,c,p):h.ct(o)?function(m,_,x,b,T){const E=x.paint.get("background-color"),I=x.paint.get("background-opacity");if(I===0)return;const{isRenderingToTexture:D}=T,L=m.context,V=L.gl,N=m.style.projection,G=m.transform,q=G.tileSize,Y=x.paint.get("background-pattern");if(m.isPatternMissing(Y))return;const $=!Y&&E.a===1&&I===1&&m.opaquePassEnabledForLayer()?"opaque":"translucent";if(m.renderPass!==$)return;const K=re.disabled,J=m.getDepthModeForSublayer(0,$==="opaque"?Xt.ReadWrite:Xt.ReadOnly),H=m.colorModeForRenderPass(),it=m.useProgram(Y?"backgroundPattern":"background"),ct=b||Wt(G,{tileSize:q,terrain:m.style.map.terrain});Y&&(L.activeTexture.set(V.TEXTURE0),m.imageManager.bind(m.context));const st=x.getCrossfadeParameters();for(const at of ct){const lt=G.getProjectionData({overscaledTileID:at,applyGlobeMatrix:!D,applyTerrainMatrix:!0}),St=Y?qo(I,m,Y,{tileID:at,tileSize:q},st):$o(I,E),vt=m.style.map.terrain&&m.style.map.terrain.getTerrainData(at),gt=N.getMeshFromTileID(L,at.canonical,!1,!0,"raster");it.draw(L,V.TRIANGLES,J,K,H,se.backCCW,St,vt,lt,x.id,gt.vertexBuffer,gt.indexBuffer,gt.segments)}}(e,0,o,c,p):h.cu(o)&&function(m,_,x,b){const{isRenderingGlobe:T}=b,E=m.context,I=x.implementation,D=m.style.projection,L=m.transform,V=L.getProjectionDataForCustomLayer(T),N={farZ:L.farZ,nearZ:L.nearZ,fov:L.fov*Math.PI/180,modelViewProjectionMatrix:L.modelViewProjectionMatrix,projectionMatrix:L.projectionMatrix,shaderData:{variantName:D.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
uniform mat4 u_projection_matrix;
${D.shaderPreludeCode.vertexSource}`,define:D.shaderDefine},defaultProjectionData:V},G=I.renderingMode?I.renderingMode:"2d";if(m.renderPass==="offscreen"){const q=I.prerender;q&&(m.setCustomLayerDefaults(),E.setColorMode(m.colorModeForRenderPass()),q.call(I,E.gl,N),E.setDirty(),m.setBaseState())}else if(m.renderPass==="translucent"){m.setCustomLayerDefaults(),E.setColorMode(m.colorModeForRenderPass()),E.setStencilMode(re.disabled);const q=G==="3d"?m.getDepthModeFor3D():m.getDepthModeForSublayer(0,Xt.ReadOnly);E.setDepthMode(q),I.render(E.gl,N),E.setDirty(),m.setBaseState(),E.bindFramebuffer.set(null)}}(e,0,o,p))}saveTileTexture(e){const n=this._tileTextures[e.size[0]];n?n.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const n=this._tileTextures[e];return n&&n.length>0?n.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const n=this.imageManager.getPattern(e.from.toString()),o=this.imageManager.getPattern(e.to.toString());return!n||!o}useProgram(e,n,o=!1,c=[]){this.cache=this.cache||{};const p=!!this.style.map.terrain,m=this.style.projection,_=o?$i.projectionMercator:m.shaderPreludeCode,x=o?pi:m.shaderDefine,b=e+(n?n.cacheKey:"")+`/${o?fi:m.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(p?"/terrain":"")+(c?`/${c.join("/")}`:"");return this.cache[b]||(this.cache[b]=new Au(this.context,$i[e],n,Ho[e],this._showOverdrawInspector,p,_,x,c)),this.cache[b]}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 h.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){var e,n;if(this._tileTextures){for(const o in this._tileTextures){const c=this._tileTextures[o];if(c)for(const p of c)p.destroy()}this._tileTextures={}}if(this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&((e=this.tileExtentMesh.vertexBuffer)===null||e===void 0||e.destroy()),this.tileExtentMesh&&((n=this.tileExtentMesh.indexBuffer)===null||n===void 0||n.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.cache){for(const o in this.cache){const c=this.cache[o];c&&c.program&&this.context.gl.deleteProgram(c.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){const{drawingBufferWidth:e,drawingBufferHeight:n}=this.context.gl;return this.width!==e||this.height!==n}}function ll(d,e){let n,o=!1,c=null,p=null;const m=()=>{c=null,o&&(d.apply(p,n),c=setTimeout(m,e),o=!1)};return(..._)=>(o=!0,p=this,n=_,c||m(),c)}class cl{constructor(e){this._getCurrentHash=()=>{const n=window.location.hash.replace("#","");if(this._hashName){let o;return n.split("&").map(c=>c.split("=")).forEach(c=>{c[0]===this._hashName&&(o=c)}),(o&&o[1]||"").split("/")}return n.split("/")},this._onHashChange=()=>{const n=this._getCurrentHash();if(!this._isValidHash(n))return!1;const o=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(n[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+n[2],+n[1]],zoom:+n[0],bearing:o,pitch:+(n[4]||0)}),!0},this._updateHashUnthrottled=()=>{const n=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,n)},this._removeHash=()=>{const n=this._getCurrentHash();if(n.length===0)return;const o=n.join("/");let c=o;c.split("&").length>0&&(c=c.split("&")[0]),this._hashName&&(c=`${this._hashName}=${o}`);let p=window.location.hash.replace(c,"");p.startsWith("#&")?p=p.slice(0,1)+p.slice(2):p==="#"&&(p="");let m=window.location.href.replace(/(#.+)?$/,p);m=m.replace("&&","&"),window.history.replaceState(window.history.state,null,m)},this._updateHash=ll(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 n=this._map.getCenter(),o=Math.round(100*this._map.getZoom())/100,c=Math.ceil((o*Math.LN2+Math.log(512/360/.5))/Math.LN10),p=Math.pow(10,c),m=Math.round(n.lng*p)/p,_=Math.round(n.lat*p)/p,x=this._map.getBearing(),b=this._map.getPitch();let T="";if(T+=e?`/${m}/${_}/${o}`:`${o}/${_}/${m}`,(x||b)&&(T+="/"+Math.round(10*x)/10),b&&(T+=`/${Math.round(b)}`),this._hashName){const E=this._hashName;let I=!1;const D=window.location.hash.slice(1).split("&").map(L=>{const V=L.split("=")[0];return V===E?(I=!0,`${V}=${T}`):L}).filter(L=>L);return I||D.push(`${E}=${T}`),`#${D.join("&")}`}return`#${T}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new h.V(+e[2],+e[1])}catch{return!1}const n=+e[0],o=+(e[3]||0),c=+(e[4]||0);return n>=this._map.getMinZoom()&&n<=this._map.getMaxZoom()&&o>=-180&&o<=180&&c>=this._map.getMinPitch()&&c<=this._map.getMaxPitch()}}const ds={linearity:.3,easing:h.cv(0,0,.3,1)},Rc=h.e({deceleration:2500,maxSpeed:1400},ds),Lc=h.e({deceleration:20,maxSpeed:1400},ds),Fc=h.e({deceleration:1e3,maxSpeed:360},ds),Ka=h.e({deceleration:1e3,maxSpeed:90},ds),Bc=h.e({deceleration:1e3,maxSpeed:360},ds);class Wi{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:ne(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,n=ne();for(;e.length>0&&n-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,roll:0,pan:new h.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:p}of this._inertiaBuffer)n.zoom+=p.zoomDelta||0,n.bearing+=p.bearingDelta||0,n.pitch+=p.pitchDelta||0,n.roll+=p.rollDelta||0,p.panDelta&&n.pan._add(p.panDelta),p.around&&(n.around=p.around),p.pinchAround&&(n.pinchAround=p.pinchAround);const o=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,c={};if(n.pan.mag()){const p=ps(n.pan.mag(),o,h.e({},Rc,e||{})),m=n.pan.mult(p.amount/n.pan.mag()),_=this._map.cameraHelper.handlePanInertia(m,this._map.transform);c.center=_.easingCenter,c.offset=_.easingOffset,Si(c,p)}if(n.zoom){const p=ps(n.zoom,o,Lc);c.zoom=this._map.transform.zoom+p.amount,Si(c,p)}if(n.bearing){const p=ps(n.bearing,o,Fc);c.bearing=this._map.transform.bearing+h.an(p.amount,-179,179),Si(c,p)}if(n.pitch){const p=ps(n.pitch,o,Ka);c.pitch=this._map.transform.pitch+p.amount,Si(c,p)}if(n.roll){const p=ps(n.roll,o,Bc);c.roll=this._map.transform.roll+h.an(p.amount,-179,179),Si(c,p)}if(c.zoom||c.bearing){const p=n.pinchAround===void 0?n.around:n.pinchAround;c.around=p?this._map.unproject(p):this._map.getCenter()}return this.clear(),h.e(c,{noMoveStart:!0})}}function Si(d,e){(!d.duration||d.duration<e.duration)&&(d.duration=e.duration,d.easing=e.easing)}function ps(d,e,n){const{maxSpeed:o,linearity:c,deceleration:p}=n,m=h.an(d*c/(e/1e3),-o,o),_=Math.abs(m)/(p*c);return{easing:n.easing,duration:1e3*_,amount:m*(_/2)}}class Fe extends h.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,n,o,c={}){o=o instanceof MouseEvent?o:new MouseEvent(e,o);const p=dt.mousePos(n.getCanvas(),o),m=n.unproject(p);super(e,h.e({point:p,lngLat:m,originalEvent:o},c)),this._defaultPrevented=!1,this.target=n}}class Ys extends h.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,n,o){const c=e==="touchend"?o.changedTouches:o.touches,p=dt.touchPos(n.getCanvasContainer(),c),m=p.map(x=>n.unproject(x)),_=p.reduce((x,b,T,E)=>x.add(b.div(E.length)),new h.P(0,0));super(e,{points:p,point:_,lngLats:m,lngLat:n.unproject(_),originalEvent:o}),this._defaultPrevented=!1}}class An extends h.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,n,o){super(e,{originalEvent:o}),this._defaultPrevented=!1}}class Uu{constructor(e,n){this._map=e,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new An(e.type,this._map,e))}mousedown(e,n){return this._mousedownPos=n,this._firePreventable(new Fe(e.type,this._map,e))}mouseup(e){this._map.fire(new Fe(e.type,this._map,e))}click(e,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Fe(e.type,this._map,e))}dblclick(e){return this._firePreventable(new Fe(e.type,this._map,e))}mouseover(e){this._map.fire(new Fe(e.type,this._map,e))}mouseout(e){this._map.fire(new Fe(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Ys(e.type,this._map,e))}touchmove(e){this._map.fire(new Ys(e.type,this._map,e))}touchend(e){this._map.fire(new Ys(e.type,this._map,e))}touchcancel(e){this._map.fire(new Ys(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Gu{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new Fe(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Fe("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new Fe(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ks{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.screenPointToLocation(h.P.convert(e),this._map.terrain)}}class Oc{constructor(e,n){this._map=e,this._tr=new Ks(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,n){this.isEnabled()&&e.shiftKey&&e.button===0&&(dt.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(e,n){if(!this._active)return;const o=n;if(this._lastPos.equals(o)||!this._box&&o.dist(this._startPos)<this._clickTolerance)return;const c=this._startPos;this._lastPos=o,this._box||(this._box=dt.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));const p=Math.min(c.x,o.x),m=Math.max(c.x,o.x),_=Math.min(c.y,o.y),x=Math.max(c.y,o.y);dt.setTransform(this._box,`translate(${p}px,${_}px)`),this._box.style.width=m-p+"px",this._box.style.height=x-_+"px"}mouseupWindow(e,n){if(!this._active||e.button!==0)return;const o=this._startPos,c=n;if(this.reset(),dt.suppressClick(),o.x!==c.x||o.y!==c.y)return this._map.fire(new h.l("boxzoomend",{originalEvent:e})),{cameraAnimation:p=>p.fitScreenCoordinates(o,c,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&&(dt.remove(this._box),this._box=null),dt.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,n){return this._map.fire(new h.l(e,{originalEvent:n}))}}function Ja(d,e){if(d.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${d.length}, points ${e.length}`);const n={};for(let o=0;o<d.length;o++)n[d[o].identifier]=e[o];return n}class Js{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,n,o){(this.centroid||o.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),o.length===this.numTouches&&(this.centroid=function(c){const p=new h.P(0,0);for(const m of c)p._add(m);return p.div(c.length)}(n),this.touches=Ja(o,n)))}touchmove(e,n,o){if(this.aborted||!this.centroid)return;const c=Ja(o,n);for(const p in this.touches){const m=c[p];(!m||m.dist(this.touches[p])>30)&&(this.aborted=!0)}}touchend(e,n,o){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),o.length===0){const c=!this.aborted&&this.centroid;if(this.reset(),c)return c}}}class ar{constructor(e){this.singleTap=new Js(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,n,o){this.singleTap.touchstart(e,n,o)}touchmove(e,n,o){this.singleTap.touchmove(e,n,o)}touchend(e,n,o){const c=this.singleTap.touchend(e,n,o);if(c){const p=e.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(c)<30;if(p&&m||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=c,this.count===this.numTaps)return this.reset(),c}}}class It{constructor(e){this._tr=new Ks(e),this._zoomIn=new ar({numTouches:1,numTaps:2}),this._zoomOut=new ar({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,n,o){this._zoomIn.touchstart(e,n,o),this._zoomOut.touchstart(e,n,o)}touchmove(e,n,o){this._zoomIn.touchmove(e,n,o),this._zoomOut.touchmove(e,n,o)}touchend(e,n,o){const c=this._zoomIn.touchend(e,n,o),p=this._zoomOut.touchend(e,n,o),m=this._tr;return c?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:m.zoom+1,around:m.unproject(c)},{originalEvent:e})}):p?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:m.zoom-1,around:m.unproject(p)},{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 fs{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 n=this._moveFunction(...e);if(n.bearingDelta||n.pitchDelta||n.rollDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(e,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(n)?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,n){if(!this.isEnabled())return;const o=this._lastPoint;if(!o)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const c=Array.isArray(n)?n[0]:n;return!this._moved&&c.dist(o)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=c,this._move(o,c))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&dt.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const ul=0,Vc=2,Qs={[ul]:1,[Vc]:2};class Cr{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const n=dt.mouseButton(e);this._eventButton=n}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(n,o){const c=Qs[o];return n.buttons===void 0||(n.buttons&c)!==c}(e,this._eventButton)}isValidEndEvent(e){return dt.mouseButton(e)===this._eventButton}}class hl{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}}class Zu{constructor(e=new Cr({checkCorrectEvent:()=>!0}),n=new hl){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=n}_executeRelevantHandler(e,n,o){return e instanceof MouseEvent?n(e):typeof TouchEvent<"u"&&e instanceof TouchEvent?o(e):void 0}startMove(e){this._executeRelevantHandler(e,n=>this.mouseMoveStateManager.startMove(n),n=>this.oneFingerTouchMoveStateManager.startMove(n))}endMove(e){this._executeRelevantHandler(e,n=>this.mouseMoveStateManager.endMove(n),n=>this.oneFingerTouchMoveStateManager.endMove(n))}isValidStartEvent(e){return this._executeRelevantHandler(e,n=>this.mouseMoveStateManager.isValidStartEvent(n),n=>this.oneFingerTouchMoveStateManager.isValidStartEvent(n))}isValidMoveEvent(e){return this._executeRelevantHandler(e,n=>this.mouseMoveStateManager.isValidMoveEvent(n),n=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(n))}isValidEndEvent(e){return this._executeRelevantHandler(e,n=>this.mouseMoveStateManager.isValidEndEvent(n),n=>this.oneFingerTouchMoveStateManager.isValidEndEvent(n))}}const ms=d=>{d.mousedown=d.dragStart,d.mousemoveWindow=d.dragMove,d.mouseup=d.dragEnd,d.contextmenu=e=>{e.preventDefault()}};class Nc{constructor(e,n){this._clickTolerance=e.clickTolerance||1,this._map=n,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,n,o){return this._calculateTransform(e,n,o)}touchmove(e,n,o){if(this._active){if(!this._shouldBePrevented(o.length))return e.preventDefault(),this._calculateTransform(e,n,o);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,n,o){this._calculateTransform(e,n,o),this._active&&this._shouldBePrevented(o.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,n,o){o.length>0&&(this._active=!0);const c=Ja(o,n),p=new h.P(0,0),m=new h.P(0,0);let _=0;for(const b in c){const T=c[b],E=this._touches[b];E&&(p._add(T),m._add(T.sub(E)),_++,c[b]=T)}if(this._touches=c,this._shouldBePrevented(_)||!m.mag())return;const x=m.div(_);return this._sum._add(x),this._sum.mag()<this._clickTolerance?void 0:{around:p.div(_),panDelta:x}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ta{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,n,o){this._firstTwoTouches||o.length<2||(this._firstTwoTouches=[o[0].identifier,o[1].identifier],this._start([n[0],n[1]]))}touchmove(e,n,o){if(!this._firstTwoTouches)return;e.preventDefault();const[c,p]=this._firstTwoTouches,m=Qa(o,n,c),_=Qa(o,n,p);if(!m||!_)return;const x=this._aroundCenter?null:m.add(_).div(2);return this._move([m,_],x,e)}touchend(e,n,o){if(!this._firstTwoTouches)return;const[c,p]=this._firstTwoTouches,m=Qa(o,n,c),_=Qa(o,n,p);m&&_||(this._active&&dt.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Qa(d,e,n){for(let o=0;o<d.length;o++)if(d[o].identifier===n)return e[o]}function dl(d,e){return Math.log(d/e)/Math.LN2}class jc extends ta{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,n){const o=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(dl(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:dl(this._distance,o),pinchAround:n}}}function Uc(d,e){return 180*d.angleWith(e)/Math.PI}class pl extends ta{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,n,o){const c=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Uc(this._vector,c),pinchAround:n}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const n=25/(Math.PI*this._minDiameter)*360,o=Uc(e,this._startVector);return Math.abs(o)<n}}function fl(d){return Math.abs(d.y)>Math.abs(d.x)}class ml extends ta{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,n,o){super.touchstart(e,n,o),this._currentTouchCount=o.length}_start(e){this._lastPoints=e,fl(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,n,o){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const c=e[0].sub(this._lastPoints[0]),p=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(c,p,o.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(c.y+p.y)/2*-.5}):void 0}gestureBeginsVertically(e,n,o){if(this._valid!==void 0)return this._valid;const c=e.mag()>=2,p=n.mag()>=2;if(!c&&!p)return;if(!c||!p)return this._firstMove===void 0&&(this._firstMove=o),o-this._firstMove<100&&void 0;const m=e.y>0==n.y>0;return fl(e)&&fl(n)&&m}}const $u={panStep:100,bearingStep:15,pitchStep:10};class Gc{constructor(e){this._tr=new Ks(e);const n=$u;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let n=0,o=0,c=0,p=0,m=0;switch(e.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:e.shiftKey?o=-1:(e.preventDefault(),p=-1);break;case 39:e.shiftKey?o=1:(e.preventDefault(),p=1);break;case 38:e.shiftKey?c=1:(e.preventDefault(),m=-1);break;case 40:e.shiftKey?c=-1:(e.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(o=0,c=0),{cameraAnimation:_=>{const x=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:nn,zoom:n?Math.round(x.zoom)+n*(e.shiftKey?2:1):x.zoom,bearing:x.bearing+o*this._bearingStep,pitch:x.pitch+c*this._pitchStep,offset:[-p*this._panStep,-m*this._panStep],center:x.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 nn(d){return d*(2-d)}const ce=4.000244140625,qu=1/450;class ea{constructor(e,n){this._onTimeout=o=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(o)},this._map=e,this._tr=new Ks(e),this._triggerRenderFrame=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=qu}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 n=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const o=ne(),c=o-(this._lastWheelEventTime||0);this._lastWheelEventTime=o,n!==0&&n%ce==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":c>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(c*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),e.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=e,this._delta-=n,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 n=dt.mousePos(this._map.getCanvas(),e),o=this._tr;this._aroundPoint=this._aroundCenter?o.transform.locationToScreenPoint(h.V.convert(o.center)):n,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){const _=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=_),typeof this._targetZoom=="number"&&(this._targetZoom+=_)}if(this._delta!==0){const _=this._type==="wheel"&&Math.abs(this._delta)>ce?this._wheelZoomRate:this._defaultZoomRate;let x=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&x!==0&&(x=1/x);const b=typeof this._targetZoom!="number"?e.scale:h.aq(this._targetZoom);this._targetZoom=e.applyConstrain(e.getCameraLngLat(),h.at(b*x)).zoom,this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom!="number"?e.zoom:this._targetZoom,o=this._startZoom,c=this._easing;let p,m=!1;if(this._type==="wheel"&&o&&c){const _=ne()-this._lastWheelEventTime,x=Math.min((_+5)/200,1),b=c(x);p=h.G.number(o,n,b),x<1?this._frameId||(this._frameId=!0):m=!0}else p=n,m=!0;return this._active=!0,m&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=p,{noInertia:!0,needsRenderFrame:!m,zoomDelta:p-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let n=h.cx;if(this._prevEase){const o=this._prevEase,c=(ne()-o.start)/o.duration,p=o.easing(c+.01)-o.easing(c),m=.27/Math.sqrt(p*p+1e-4)*.01,_=Math.sqrt(.0729-m*m);n=h.cv(m,_,.25,1)}return this._prevEase={start:ne(),duration:e,easing:n},n}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class ia{constructor(e,n){this._clickZoom=e,this._tapZoom=n}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 gl{constructor(e){this._tr=new Ks(e),this.reset()}reset(){this._active=!1}dblclick(e,n){return e.preventDefault(),{cameraAnimation:o=>{o.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(n)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Zc{constructor(){this._tap=new ar({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,n,o){if(!this._swipePoint)if(this._tapTime){const c=n[0],p=e.timeStamp-this._tapTime<500,m=this._tapPoint.dist(c)<30;p&&m?o.length>0&&(this._swipePoint=c,this._swipeTouch=o[0].identifier):this.reset()}else this._tap.touchstart(e,n,o)}touchmove(e,n,o){if(this._tapTime){if(this._swipePoint){if(o[0].identifier!==this._swipeTouch)return;const c=n[0],p=c.y-this._swipePoint.y;return this._swipePoint=c,e.preventDefault(),this._active=!0,{zoomDelta:p/128}}}else this._tap.touchmove(e,n,o)}touchend(e,n,o){if(this._tapTime)this._swipePoint&&o.length===0&&this.reset();else{const c=this._tap.touchend(e,n,o);c&&(this._tapTime=e.timeStamp,this._tapPoint=c)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class _l{constructor(e,n,o){this._el=e,this._mousePan=n,this._touchPan=o}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 yl{constructor(e,n,o,c){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=n,this._mousePitch=o,this._mouseRoll=c}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class $c{constructor(e,n,o,c){this._el=e,this._touchZoom=n,this._touchRotate=o,this._tapDragZoom=c,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 or{constructor(e,n){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=n,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=dt.create("div","maplibregl-cooperative-gesture-screen",e);let n=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(n=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const o=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),c=document.createElement("div");c.className="maplibregl-desktop-message",c.textContent=n,this._container.appendChild(c);const p=document.createElement("div");p.className="maplibregl-mobile-message",p.textContent=o,this._container.appendChild(p),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(dt.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,n){this._enabled&&(this._map.fire(new h.l("cooperativegestureprevented",{gestureType:e,originalEvent:n})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Dn=d=>d.zoom||d.drag||d.roll||d.pitch||d.rotate;class zt extends h.l{}function Vt(d){return d.panDelta&&d.panDelta.mag()||d.zoomDelta||d.bearingDelta||d.pitchDelta||d.rollDelta}class ra{constructor(e,n){this.handleWindowEvent=c=>{this.handleEvent(c,`${c.type}Window`)},this.handleEvent=(c,p)=>{if(c.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const m=c.type==="renderFrame"?void 0:c,_={needsRenderFrame:!1},x={},b={};for(const{handlerName:I,handler:D,allowed:L}of this._handlers){if(!D.isEnabled())continue;let V;if(this._blockedByActive(b,L,I))D.reset();else if(D[p||c.type]){if(h.cy(c,p||c.type)){const N=dt.mousePos(this._map.getCanvas(),c);V=D[p||c.type](c,N)}else if(h.cz(c,p||c.type)){const N=this._getMapTouches(c.touches),G=dt.touchPos(this._map.getCanvas(),N);V=D[p||c.type](c,G,N)}else h.cA(p||c.type)||(V=D[p||c.type](c));this.mergeHandlerResult(_,x,V,I,m),V&&V.needsRenderFrame&&this._triggerRenderFrame()}(V||D.isActive())&&(b[I]=D)}const T={};for(const I in this._previousActiveHandlers)b[I]||(T[I]=m);this._previousActiveHandlers=b,(Object.keys(T).length||Vt(_))&&(this._changes.push([_,x,T]),this._triggerRenderFrame()),(Object.keys(b).length||Vt(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:E}=_;E&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],E(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Wi(e),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);const o=this._el;this._listeners=[[o,"touchstart",{passive:!0}],[o,"touchmove",{passive:!1}],[o,"touchend",void 0],[o,"touchcancel",void 0],[o,"mousedown",void 0],[o,"mousemove",void 0],[o,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[o,"mouseover",void 0],[o,"mouseout",void 0],[o,"dblclick",void 0],[o,"click",void 0],[o,"keydown",{capture:!1}],[o,"keyup",void 0],[o,"wheel",{passive:!1}],[o,"contextmenu",void 0],[window,"blur",void 0]];for(const[c,p,m]of this._listeners)dt.addEventListener(c,p,c===document?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(const[e,n,o]of this._listeners)dt.removeEventListener(e,n,e===document?this.handleWindowEvent:this.handleEvent,o)}_addDefaultHandlers(e){const n=this._map,o=n.getCanvasContainer();this._add("mapEvent",new Uu(n,e));const c=n.boxZoom=new Oc(n,e);this._add("boxZoom",c),e.interactive&&e.boxZoom&&c.enable();const p=n.cooperativeGestures=new or(n,e.cooperativeGestures);this._add("cooperativeGestures",p),e.cooperativeGestures&&p.enable();const m=new It(n),_=new gl(n);n.doubleClickZoom=new ia(_,m),this._add("tapZoom",m),this._add("clickZoom",_),e.interactive&&e.doubleClickZoom&&n.doubleClickZoom.enable();const x=new Zc;this._add("tapDragZoom",x);const b=n.touchPitch=new ml(n);this._add("touchPitch",b),e.interactive&&e.touchPitch&&n.touchPitch.enable(e.touchPitch);const T=()=>n.project(n.getCenter()),E=function({enable:$,clickTolerance:K,aroundCenter:J=!0,minPixelCenterThreshold:H=100,rotateDegreesPerPixelMoved:it=.8},ct){const st=new Cr({checkCorrectEvent:at=>dt.mouseButton(at)===0&&at.ctrlKey||dt.mouseButton(at)===2&&!at.ctrlKey});return new fs({clickTolerance:K,move:(at,lt)=>{const St=ct();if(J&&Math.abs(St.y-at.y)>H)return{bearingDelta:h.cw(new h.P(at.x,lt.y),lt,St)};let vt=(lt.x-at.x)*it;return J&&lt.y<St.y&&(vt=-vt),{bearingDelta:vt}},moveStateManager:st,enable:$,assignEvents:ms})}(e,T),I=function({enable:$,clickTolerance:K,pitchDegreesPerPixelMoved:J=-.5}){const H=new Cr({checkCorrectEvent:it=>dt.mouseButton(it)===0&&it.ctrlKey||dt.mouseButton(it)===2});return new fs({clickTolerance:K,move:(it,ct)=>({pitchDelta:(ct.y-it.y)*J}),moveStateManager:H,enable:$,assignEvents:ms})}(e),D=function({enable:$,clickTolerance:K,rollDegreesPerPixelMoved:J=.3},H){const it=new Cr({checkCorrectEvent:ct=>dt.mouseButton(ct)===2&&ct.ctrlKey});return new fs({clickTolerance:K,move:(ct,st)=>{const at=H();let lt=(st.x-ct.x)*J;return st.y<at.y&&(lt=-lt),{rollDelta:lt}},moveStateManager:it,enable:$,assignEvents:ms})}(e,T);n.dragRotate=new yl(e,E,I,D),this._add("mouseRotate",E,["mousePitch"]),this._add("mousePitch",I,["mouseRotate","mouseRoll"]),this._add("mouseRoll",D,["mousePitch"]),e.interactive&&e.dragRotate&&n.dragRotate.enable();const L=function({enable:$,clickTolerance:K}){const J=new Cr({checkCorrectEvent:H=>dt.mouseButton(H)===0&&!H.ctrlKey});return new fs({clickTolerance:K,move:(H,it)=>({around:it,panDelta:it.sub(H)}),activateOnStart:!0,moveStateManager:J,enable:$,assignEvents:ms})}(e),V=new Nc(e,n);n.dragPan=new _l(o,L,V),this._add("mousePan",L),this._add("touchPan",V,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&n.dragPan.enable(e.dragPan);const N=new pl,G=new jc;n.touchZoomRotate=new $c(o,G,N,x),this._add("touchRotate",N,["touchPan","touchZoom"]),this._add("touchZoom",G,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&n.touchZoomRotate.enable(e.touchZoomRotate),this._add("blockableMapEvent",new Gu(n));const q=n.scrollZoom=new ea(n,()=>this._triggerRenderFrame());this._add("scrollZoom",q,["mousePan"]),e.interactive&&e.scrollZoom&&n.scrollZoom.enable(e.scrollZoom);const Y=n.keyboard=new Gc(n);this._add("keyboard",Y),e.interactive&&e.keyboard&&n.keyboard.enable()}_add(e,n,o){this._handlers.push({handlerName:e,handler:n,allowed:o}),this._handlersById[e]=n}stop(e){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.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!!Dn(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,n,o){for(const c in e)if(c!==o&&(!n||n.indexOf(c)<0))return!0;return!1}_getMapTouches(e){const n=[];for(const o of e)this._el.contains(o.target)&&n.push(o);return n}mergeHandlerResult(e,n,o,c,p){if(!o)return;h.e(e,o);const m={handlerName:c,originalEvent:o.originalEvent||p};o.zoomDelta!==void 0&&(n.zoom=m),o.panDelta!==void 0&&(n.drag=m),o.rollDelta!==void 0&&(n.roll=m),o.pitchDelta!==void 0&&(n.pitch=m),o.bearingDelta!==void 0&&(n.rotate=m)}_applyChanges(){const e={},n={},o={};for(const[c,p,m]of this._changes)c.panDelta&&(e.panDelta=(e.panDelta||new h.P(0,0))._add(c.panDelta)),c.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+c.zoomDelta),c.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+c.bearingDelta),c.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+c.pitchDelta),c.rollDelta&&(e.rollDelta=(e.rollDelta||0)+c.rollDelta),c.around!==void 0&&(e.around=c.around),c.pinchAround!==void 0&&(e.pinchAround=c.pinchAround),c.noInertia&&(e.noInertia=c.noInertia),h.e(n,p),h.e(o,m);this._updateMapTransform(e,n,o),this._changes=[]}_updateMapTransform(e,n,o){const c=this._map,p=c._getTransformForUpdate(),m=c.terrain;if(!(Vt(e)||m&&this._terrainMovement))return this._fireEvents(n,o,!0);c._stop(!0);let{panDelta:_,zoomDelta:x,bearingDelta:b,pitchDelta:T,rollDelta:E,around:I,pinchAround:D}=e;D!==void 0&&(I=D),I=I||c.transform.centerPoint,m&&!p.isPointOnMapSurface(I)&&(I=p.centerPoint);const L={panDelta:_,zoomDelta:x,rollDelta:E,pitchDelta:T,bearingDelta:b,around:I};this._map.cameraHelper.useGlobeControls&&!p.isPointOnMapSurface(I)&&(I=p.centerPoint);const V=I.distSqr(p.centerPoint)<.01?p.center:p.screenPointToLocation(_?I.sub(_):I);this._handleMapControls({terrain:m,tr:p,deltasForHelper:L,preZoomAroundLoc:V,combinedEventsInProgress:n,panDelta:_}),c._applyUpdatedTransform(p),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(n,o,!0)}_handleMapControls({terrain:e,tr:n,deltasForHelper:o,preZoomAroundLoc:c,combinedEventsInProgress:p,panDelta:m}){const _=this._map.cameraHelper;if(_.handleMapControlsRollPitchBearingZoom(o,n),e)return _.useGlobeControls?(this._terrainMovement||!p.drag&&!p.zoom||(this._terrainMovement=!0,this._map._elevationFreeze=!0),void _.handleMapControlsPan(o,n,c)):this._terrainMovement||!p.drag&&!p.zoom?void(p.drag&&this._terrainMovement&&m?n.setCenter(n.screenPointToLocation(n.centerPoint.sub(m))):_.handleMapControlsPan(o,n,c)):(this._terrainMovement=!0,this._map._elevationFreeze=!0,void _.handleMapControlsPan(o,n,c));_.handleMapControlsPan(o,n,c)}_fireEvents(e,n,o){const c=Dn(this._eventsInProgress),p=Dn(e),m={};for(const E in e){const{originalEvent:I}=e[E];this._eventsInProgress[E]||(m[`${E}start`]=I),this._eventsInProgress[E]=e[E]}!c&&p&&this._fireEvent("movestart",p.originalEvent);for(const E in m)this._fireEvent(E,m[E]);p&&this._fireEvent("move",p.originalEvent);for(const E in e){const{originalEvent:I}=e[E];this._fireEvent(E,I)}const _={};let x;for(const E in this._eventsInProgress){const{handlerName:I,originalEvent:D}=this._eventsInProgress[E];this._handlersById[I].isActive()||(delete this._eventsInProgress[E],x=n[I]||D,_[`${E}end`]=x)}for(const E in _)this._fireEvent(E,_[E]);const b=Dn(this._eventsInProgress),T=(c||p)&&!b;if(T&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const E=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&E.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(E)}if(o&&T){this._updatingCamera=!0;const E=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),I=D=>D!==0&&-this._bearingSnap<D&&D<this._bearingSnap;!E||!E.essential&&Qe.prefersReducedMotion?(this._map.fire(new h.l("moveend",{originalEvent:x})),I(this._map.getBearing())&&this._map.resetNorth()):(I(E.bearing||this._map.getBearing())&&(E.bearing=0),E.freezeElevation=!0,this._map.easeTo(E,{originalEvent:x})),this._updatingCamera=!1}}_fireEvent(e,n){this._map.fire(new h.l(e,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new zt("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class qc extends h.E{constructor(e,n,o){super(),this._renderFrameCallback=()=>{const c=Math.min((ne()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(c)),c<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.cameraHelper=n,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,n){e.apply(this.transform),this.transform=e,this.cameraHelper=n}getCenter(){return new h.V(this.transform.center.lng,this.transform.center.lat)}setCenter(e,n){return this.jumpTo({center:e},n)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,n){return this.jumpTo({elevation:e},n),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,n,o){return e=h.P.convert(e).mult(-1),this.panTo(this.transform.center,h.e({offset:e},n),o)}panTo(e,n,o){return this.easeTo(h.e({center:e},n),o)}getZoom(){return this.transform.zoom}setZoom(e,n){return this.jumpTo({zoom:e},n),this}zoomTo(e,n,o){return this.easeTo(h.e({zoom:e},n),o)}zoomIn(e,n){return this.zoomTo(this.getZoom()+1,e,n),this}zoomOut(e,n){return this.zoomTo(this.getZoom()-1,e,n),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,n){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new h.l("movestart",n)).fire(new h.l("move",n)).fire(new h.l("moveend",n))),this}getBearing(){return this.transform.bearing}setBearing(e,n){return this.jumpTo({bearing:e},n),this}getPadding(){return this.transform.padding}setPadding(e,n){return this.jumpTo({padding:e},n),this}rotateTo(e,n,o){return this.easeTo(h.e({bearing:e},n),o)}resetNorth(e,n){return this.rotateTo(0,h.e({duration:1e3},e),n),this}resetNorthPitch(e,n){return this.easeTo(h.e({bearing:0,pitch:0,roll:0,duration:1e3},e),n),this}snapToNorth(e,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,n):this}getPitch(){return this.transform.pitch}setPitch(e,n){return this.jumpTo({pitch:e},n),this}getRoll(){return this.transform.roll}setRoll(e,n){return this.jumpTo({roll:e},n),this}cameraForBounds(e,n){e=Ie.convert(e).adjustAntiMeridian();const o=n&&n.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),o,n)}_cameraForBoxAndBearing(e,n,o,c){const p={top:0,bottom:0,right:0,left:0};if(typeof(c=h.e({padding:p,offset:[0,0],maxZoom:this.transform.maxZoom},c)).padding=="number"){const b=c.padding;c.padding={top:b,bottom:b,right:b,left:b}}const m=h.e(p,c.padding);c.padding=m;const _=this.transform,x=new Ie(e,n);return this.cameraHelper.cameraForBoxAndBearing(c,m,x,o,_)}fitBounds(e,n,o){return this._fitInternal(this.cameraForBounds(e,n),n,o)}fitScreenCoordinates(e,n,o,c,p){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(h.P.convert(e)),this.transform.screenPointToLocation(h.P.convert(n)),o,c),c,p)}_fitInternal(e,n,o){return e?(delete(n=h.e(e,n)).padding,n.linear?this.easeTo(n,o):this.flyTo(n,o)):this}jumpTo(e,n){this.stop();const o=this._getTransformForUpdate();let c=!1,p=!1,m=!1;const _=o.zoom;this.cameraHelper.handleJumpToCenterZoom(o,e);const x=o.zoom!==_;return"elevation"in e&&o.elevation!==+e.elevation&&o.setElevation(+e.elevation),"bearing"in e&&o.bearing!==+e.bearing&&(c=!0,o.setBearing(+e.bearing)),"pitch"in e&&o.pitch!==+e.pitch&&(p=!0,o.setPitch(+e.pitch)),"roll"in e&&o.roll!==+e.roll&&(m=!0,o.setRoll(+e.roll)),e.padding==null||o.isPaddingEqual(e.padding)||o.setPadding(e.padding),this._applyUpdatedTransform(o),this.fire(new h.l("movestart",n)).fire(new h.l("move",n)),x&&this.fire(new h.l("zoomstart",n)).fire(new h.l("zoom",n)).fire(new h.l("zoomend",n)),c&&this.fire(new h.l("rotatestart",n)).fire(new h.l("rotate",n)).fire(new h.l("rotateend",n)),p&&this.fire(new h.l("pitchstart",n)).fire(new h.l("pitch",n)).fire(new h.l("pitchend",n)),m&&this.fire(new h.l("rollstart",n)).fire(new h.l("roll",n)).fire(new h.l("rollend",n)),this.fire(new h.l("moveend",n))}calculateCameraOptionsFromTo(e,n,o,c=0){const p=h.aa.fromLngLat(e,n),m=h.aa.fromLngLat(o,c),_=m.x-p.x,x=m.y-p.y,b=m.z-p.z,T=Math.hypot(_,x,b);if(T===0)throw new Error("Can't calculate camera options with same From and To");const E=Math.hypot(_,x),I=h.at(this.transform.cameraToCenterDistance/T/this.transform.tileSize),D=180*Math.atan2(_,-x)/Math.PI;let L=180*Math.acos(E/T)/Math.PI;return L=b<0?90-L:90+L,{center:m.toLngLat(),elevation:c,zoom:I,pitch:L,bearing:D}}calculateCameraOptionsFromCameraLngLatAltRotation(e,n,o,c,p){const m=this.transform.calculateCenterFromCameraLngLatAlt(e,n,o,c);return{center:m.center,elevation:m.elevation,zoom:m.zoom,bearing:o,pitch:c,roll:p}}easeTo(e,n){this._stop(!1,e.easeId),((e=h.e({offset:[0,0],duration:500,easing:h.cx},e)).animate===!1||!e.essential&&Qe.prefersReducedMotion)&&(e.duration=0);const o=this._getTransformForUpdate(),c=this.getBearing(),p=o.pitch,m=o.roll,_="bearing"in e?this._normalizeBearing(e.bearing,c):c,x="pitch"in e?+e.pitch:p,b="roll"in e?this._normalizeBearing(e.roll,m):m,T="padding"in e?e.padding:o.padding,E=h.P.convert(e.offset);let I,D;e.around&&(I=h.V.convert(e.around),D=o.locationToScreenPoint(I));const L={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},V=this.cameraHelper.handleEaseTo(o,{bearing:_,pitch:x,roll:b,padding:T,around:I,aroundPoint:D,offsetAsPoint:E,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||c!==_,this._pitching=this._pitching||x!==p,this._rolling=this._rolling||b!==m,this._padding=!o.isPaddingEqual(T),this._zooming=this._zooming||V.isZooming,this._easeId=e.easeId,this._prepareEase(n,e.noMoveStart,L),this.terrain&&this._prepareElevation(V.elevationCenter),this._ease(N=>{V.easeFunc(N),this.terrain&&!e.freezeElevation&&this._updateElevation(N),this._applyUpdatedTransform(o),this._fireMoveEvents(n)},N=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(n,N)},e),this}_prepareEase(e,n,o={}){this._moving=!0,n||o.moving||this.fire(new h.l("movestart",e)),this._zooming&&!o.zooming&&this.fire(new h.l("zoomstart",e)),this._rotating&&!o.rotating&&this.fire(new h.l("rotatestart",e)),this._pitching&&!o.pitching&&this.fire(new h.l("pitchstart",e)),this._rolling&&!o.rolling&&this.fire(new h.l("rollstart",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._elevationStart!==void 0&&this._elevationCenter!==void 0||this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&n!==this._elevationTarget){const o=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(o-(n-(o*e+this._elevationStart))/(1-e)),this._elevationTarget=n}this.transform.setElevation(h.G.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};const n=e.getCameraLngLat(),o=e.getCameraAltitude(),c=this.terrain?this.terrain.getElevationForLngLatZoom(n,e.zoom):0;if(o<c){const p=this.calculateCameraOptionsFromTo(n,c,e.center,e.elevation);return{pitch:p.pitch,zoom:p.zoom}}return{}}_applyUpdatedTransform(e){const n=[];if(n.push(c=>this._elevateCameraIfInsideTerrain(c)),this.transformCameraUpdate&&n.push(c=>this.transformCameraUpdate(c)),!n.length)return;const o=e.clone();for(const c of n){const p=o.clone(),{center:m,zoom:_,roll:x,pitch:b,bearing:T,elevation:E}=c(p);m&&p.setCenter(m),E!==void 0&&p.setElevation(E),_!==void 0&&p.setZoom(_),x!==void 0&&p.setRoll(x),b!==void 0&&p.setPitch(b),T!==void 0&&p.setBearing(T),o.apply(p)}this.transform.apply(o)}_fireMoveEvents(e){this.fire(new h.l("move",e)),this._zooming&&this.fire(new h.l("zoom",e)),this._rotating&&this.fire(new h.l("rotate",e)),this._pitching&&this.fire(new h.l("pitch",e)),this._rolling&&this.fire(new h.l("roll",e))}_afterEase(e,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const o=this._zooming,c=this._rotating,p=this._pitching,m=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,o&&this.fire(new h.l("zoomend",e)),c&&this.fire(new h.l("rotateend",e)),p&&this.fire(new h.l("pitchend",e)),m&&this.fire(new h.l("rollend",e)),this.fire(new h.l("moveend",e))}flyTo(e,n){if(!e.essential&&Qe.prefersReducedMotion){const lt=h.U(e,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(lt,n)}this.stop(),e=h.e({offset:[0,0],speed:1.2,curve:1.42,easing:h.cx},e);const o=this._getTransformForUpdate(),c=o.bearing,p=o.pitch,m=o.roll,_=o.padding,x="bearing"in e?this._normalizeBearing(e.bearing,c):c,b="pitch"in e?+e.pitch:p,T="roll"in e?this._normalizeBearing(e.roll,m):m,E="padding"in e?e.padding:o.padding,I=h.P.convert(e.offset);let D=o.centerPoint.add(I);const L=o.screenPointToLocation(D),V=this.cameraHelper.handleFlyTo(o,{bearing:x,pitch:b,roll:T,padding:E,locationAtOffset:L,offsetAsPoint:I,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let N=e.curve;const G=Math.max(o.width,o.height),q=G/V.scaleOfZoom,Y=V.pixelPathLength;typeof V.scaleOfMinZoom=="number"&&(N=Math.sqrt(G/V.scaleOfMinZoom/Y*2));const $=N*N;function K(lt){const St=(q*q-G*G+(lt?-1:1)*$*$*Y*Y)/(2*(lt?q:G)*$*Y);return Math.log(Math.sqrt(St*St+1)-St)}function J(lt){return(Math.exp(lt)-Math.exp(-lt))/2}function H(lt){return(Math.exp(lt)+Math.exp(-lt))/2}const it=K(!1);let ct=function(lt){return H(it)/H(it+N*lt)},st=function(lt){return G*((H(it)*(J(St=it+N*lt)/H(St))-J(it))/$)/Y;var St},at=(K(!0)-it)/N;if(Math.abs(Y)<2e-6||!isFinite(at)){if(Math.abs(G-q)<1e-6)return this.easeTo(e,n);const lt=q<G?-1:1;at=Math.abs(Math.log(q/G))/N,st=()=>0,ct=St=>Math.exp(lt*N*St)}return e.duration="duration"in e?+e.duration:1e3*at/("screenSpeed"in e?+e.screenSpeed/N:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=c!==x,this._pitching=b!==p,this._rolling=T!==m,this._padding=!o.isPaddingEqual(E),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(V.targetCenter),this._ease(lt=>{const St=lt*at,vt=1/ct(St),gt=st(St);this._rotating&&o.setBearing(h.G.number(c,x,lt)),this._pitching&&o.setPitch(h.G.number(p,b,lt)),this._rolling&&o.setRoll(h.G.number(m,T,lt)),this._padding&&(o.interpolatePadding(_,E,lt),D=o.centerPoint.add(I)),V.easeFunc(lt,vt,gt,D),this.terrain&&!e.freezeElevation&&this._updateElevation(lt),this._applyUpdatedTransform(o),this._fireMoveEvents(n)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(n)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,n){var o;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const c=this._onEaseEnd;delete this._onEaseEnd,c.call(this,n)}return e||(o=this.handlers)===null||o===void 0||o.stop(!1),this}_ease(e,n,o){o.animate===!1||o.duration===0?(e(1),n()):(this._easeStart=ne(),this._easeOptions=o,this._onEaseFrame=e,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,n){e=h.W(e,-180,180);const o=Math.abs(e-n);return Math.abs(e-360-n)<o&&(e-=360),Math.abs(e+360-n)<o&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(h.V.convert(e),this.transform.tileZoom):null}}const na={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class gi{constructor(e=na){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=n=>{!n||n.sourceDataType!=="metadata"&&n.sourceDataType!=="visibility"&&n.dataType!=="style"&&n.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=dt.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=dt.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=dt.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(){dt.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,n){const o=this._map._getUIString(`AttributionControl.${n}`);e.title=o,e.setAttribute("aria-label",o)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(c=>typeof c!="string"?"":c)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const c=this._map.style.stylesheet;this.styleOwner=c.owner,this.styleId=c.id}const n=this._map.style.tileManagers;for(const c in n){const p=n[c];if(p.used||p.usedForTerrain){const m=p.getSource();m.attribution&&e.indexOf(m.attribution)<0&&e.push(m.attribution)}}e=e.filter(c=>String(c).trim()),e.sort((c,p)=>c.length-p.length),e=e.filter((c,p)=>{for(let m=p+1;m<e.length;m++)if(e[m].indexOf(c)>=0)return!1;return!0});const o=e.join(" | ");o!==this._attribHTML&&(this._attribHTML=o,e.length?(this._innerContainer.innerHTML=dt.sanitize(o),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Hi{constructor(e={}){this._updateCompact=()=>{const n=this._container.children;if(n.length){const o=n[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&o.classList.add("maplibregl-compact"):o.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=dt.create("div","maplibregl-ctrl");const n=dt.create("a","maplibregl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){dt.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Wc{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const n=++this._id;return this._queue.push({callback:e,id:n,cancelled:!1}),n}remove(e){const n=this._currentlyRunning,o=n?this._queue.concat(n):this._queue;for(const c of o)if(c.id===e)return void(c.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const o of n)if(!o.cancelled&&(o.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Wu=h.aT([{name:"a_pos3d",type:"Int16",components:3}]);class Hu extends h.E{constructor(e){super(),this._lastTilesetChange=ne(),this.tileManager=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null}getSource(){return this.tileManager._source}update(e,n){this.tileManager.update(e,n),this._renderableTilesKeys=[];const o={};for(const c of Wt(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n,calculateTileZoom:this.tileManager._source.calculateTileZoom}))o[c.key]=!0,this._renderableTilesKeys.push(c.key),this._tiles[c.key]||(c.terrainRttPosMatrix32f=new Float64Array(16),h.c6(c.terrainRttPosMatrix32f,0,h.a4,h.a4,0,0,1),this._tiles[c.key]=new k(c,this.tileSize),this._lastTilesetChange=ne());for(const c in this._tiles)o[c]||delete this._tiles[c]}freeRtt(e){for(const n in this._tiles){const o=this._tiles[n];(!e||o.tileID.equals(e)||o.tileID.isChildOf(e)||e.isChildOf(o.tileID))&&(o.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,n){return n?this._getTerrainCoordsForTileRanges(e,n):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){const n={};for(const o of this._renderableTilesKeys){const c=this._tiles[o].tileID,p=e.clone(),m=h.bj();if(c.canonical.equals(e.canonical))h.c6(m,0,h.a4,h.a4,0,0,1);else if(c.canonical.isChildOf(e.canonical)){const _=c.canonical.z-e.canonical.z,x=c.canonical.x-(c.canonical.x>>_<<_),b=c.canonical.y-(c.canonical.y>>_<<_),T=h.a4>>_;h.c6(m,0,T,T,0,0,1),h.O(m,m,[-x*T,-b*T,0])}else{if(!e.canonical.isChildOf(c.canonical))continue;{const _=e.canonical.z-c.canonical.z,x=e.canonical.x-(e.canonical.x>>_<<_),b=e.canonical.y-(e.canonical.y>>_<<_),T=h.a4>>_;h.c6(m,0,h.a4,h.a4,0,0,1),h.O(m,m,[x*T,b*T,0]),h.Q(m,m,[1/2**_,1/2**_,0])}}p.terrainRttPosMatrix32f=new Float32Array(m),n[o]=p}return n}_getTerrainCoordsForTileRanges(e,n){const o={};for(const c of this._renderableTilesKeys){const p=this._tiles[c].tileID;if(!this._isWithinTileRanges(p,n))continue;const m=e.clone(),_=h.bj();if(p.canonical.z===e.canonical.z){const x=e.canonical.x-p.canonical.x,b=e.canonical.y-p.canonical.y;h.c6(_,0,h.a4,h.a4,0,0,1),h.O(_,_,[x*h.a4,b*h.a4,0])}else if(p.canonical.z>e.canonical.z){const x=p.canonical.z-e.canonical.z,b=p.canonical.x-(p.canonical.x>>x<<x),T=p.canonical.y-(p.canonical.y>>x<<x),E=e.canonical.x-(p.canonical.x>>x),I=e.canonical.y-(p.canonical.y>>x),D=h.a4>>x;h.c6(_,0,D,D,0,0,1),h.O(_,_,[-b*D+E*h.a4,-T*D+I*h.a4,0])}else{const x=e.canonical.z-p.canonical.z,b=e.canonical.x-(e.canonical.x>>x<<x),T=e.canonical.y-(e.canonical.y>>x<<x),E=(e.canonical.x>>x)-p.canonical.x,I=(e.canonical.y>>x)-p.canonical.y,D=h.a4<<x;h.c6(_,0,D,D,0,0,1),h.O(_,_,[b*h.a4+E*D,T*h.a4+I*D,0])}m.terrainRttPosMatrix32f=new Float32Array(_),o[c]=m}return o}getSourceTile(e,n){const o=this.tileManager._source;let c=e.overscaledZ-this.deltaZoom;if(c>o.maxzoom&&(c=o.maxzoom),c<o.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(c).key);let p=this.tileManager.getTileByID(this._sourceTileCache[e.key]);if((!p||!p.dem)&&n)for(;c>=o.minzoom&&(!p||!p.dem);)p=this.tileManager.getTileByID(e.scaledTo(c--).key);return p}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,n){return n[e.canonical.z]&&e.canonical.x>=n[e.canonical.z].minTileX&&e.canonical.x<=n[e.canonical.z].maxTileX&&e.canonical.y>=n[e.canonical.z].minTileY&&e.canonical.y<=n[e.canonical.z].maxTileY}}class Xu{constructor(e,n,o){this._meshCache={},this.painter=e,this.tileManager=new Hu(n),this.options=o,this.exaggeration=typeof o.exaggeration=="number"?o.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,n,o,c=h.a4){var p;if(!(n>=0&&n<c&&o>=0&&o<c))return 0;const m=this.getTerrainData(e),_=(p=m.tile)===null||p===void 0?void 0:p.dem;if(!_)return 0;const x=h.cB([],[n/c*h.a4,o/c*h.a4],m.u_terrain_matrix),b=[x[0]*_.dim,x[1]*_.dim],T=Math.floor(b[0]),E=Math.floor(b[1]),I=b[0]-T,D=b[1]-E;return _.get(T,E)*(1-I)*(1-D)+_.get(T+1,E)*I*(1-D)+_.get(T,E+1)*(1-I)*D+_.get(T+1,E+1)*I*D}getElevationForLngLatZoom(e,n){if(!h.cC(n,e.wrap()))return 0;const{tileID:o,mercatorX:c,mercatorY:p}=this._getOverscaledTileIDFromLngLatZoom(e,n);return this.getElevation(o,c%h.a4,p%h.a4,h.a4)}getElevation(e,n,o,c=h.a4){return this.getDEMElevation(e,n,o,c)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const c=this.painter.context,p=new h.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new h.T(c,p,c.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new h.T(c,new h.R({width:1,height:1}),c.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(c.gl.NEAREST,c.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=h.ar([])}const n=this.tileManager.getSourceTile(e,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const c=this.painter.context;n.demTexture=this.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new h.T(c,n.dem.getPixels(),c.gl.RGBA,{premultiply:!1}),n.demTexture.bind(c.gl.NEAREST,c.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const o=n&&n+n.tileID.key+e.key;if(o&&!this._demMatrixCache[o]){const c=this.tileManager.getSource().maxzoom;let p=e.canonical.z-n.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=c?p=e.canonical.z-c:h.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const m=e.canonical.x-(e.canonical.x>>p<<p),_=e.canonical.y-(e.canonical.y>>p<<p),x=h.cD(new Float64Array(16),[1/(h.a4<<p),1/(h.a4<<p),0]);h.O(x,x,[m*h.a4,_*h.a4,0]),this._demMatrixCache[e.key]={matrix:x,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:o?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:n&&n.dem&&n.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(n&&n.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getFramebuffer(e){const n=this.painter,o=n.width/devicePixelRatio,c=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===o&&this._fbo.height===c||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new h.T(n.context,{width:o,height:c,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new h.T(n.context,{width:o,height:c,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=n.context.createFramebuffer(o,c,!0,!1),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,o,c))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let p=0,m=0;p<this._coordsTextureSize;p++)for(let _=0;_<this._coordsTextureSize;_++,m+=4)n[m+0]=255&_,n[m+1]=255&p,n[m+2]=_>>8<<4|p>>8,n[m+3]=0;const o=new h.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),c=new h.T(e,o,e.gl.RGBA,{premultiply:!1});return c.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=c,c}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const n=new Uint8Array(4),o=this.painter.context,c=o.gl,p=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),m=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),_=Math.round(this.painter.height/devicePixelRatio);o.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),c.readPixels(p,_-m-1,1,1,c.RGBA,c.UNSIGNED_BYTE,n),o.bindFramebuffer.set(null);const x=n[0]+(n[2]>>4<<8),b=n[1]+((15&n[2])<<8),T=this.coordsIndex[255-n[3]],E=T&&this.tileManager.getTileByID(T);if(!E)return null;const I=this._coordsTextureSize,D=(1<<E.tileID.canonical.z)*I;return new h.aa((E.tileID.canonical.x*I+x)/D+E.tileID.wrap,(E.tileID.canonical.y*I+b)/D,this.getElevation(E.tileID,x,b,I))}depthAtPoint(e){const n=new Uint8Array(4),o=this.painter.context,c=o.gl;return o.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),c.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,c.RGBA,c.UNSIGNED_BYTE,n),o.bindFramebuffer.set(null),(n[0]/16777216+n[1]/65536+n[2]/256+n[3])/256}getTerrainMesh(e){var n;const o=((n=this.painter.style.projection)===null||n===void 0?void 0:n.transitionState)>0,c=o&&e.canonical.y===0,p=o&&e.canonical.y===(1<<e.canonical.z)-1,m=`m_${c?"n":""}_${p?"s":""}`;if(this._meshCache[m])return this._meshCache[m];const _=this.painter.context,x=new h.cE,b=new h.aX,T=this.meshSize,E=h.a4/T,I=T*T;for(let H=0;H<=T;H++)for(let it=0;it<=T;it++)x.emplaceBack(it*E,H*E,0);for(let H=0;H<I;H+=T+1)for(let it=0;it<T;it++)b.emplaceBack(it+H,T+it+H+1,T+it+H+2),b.emplaceBack(it+H,T+it+H+2,it+H+1);const D=x.length,L=D+(T+1),V=(T+1)*T,N=c?h.bq:0,G=c?0:1,q=p?h.br:h.a4,Y=p?0:1;for(let H=0;H<=T;H++)x.emplaceBack(H*E,N,G);for(let H=0;H<=T;H++)x.emplaceBack(H*E,q,Y);for(let H=0;H<T;H++)b.emplaceBack(V+H,L+H,L+H+1),b.emplaceBack(V+H,L+H+1,V+H+1),b.emplaceBack(0+H,D+H+1,D+H),b.emplaceBack(0+H,0+H+1,D+H+1);const $=x.length,K=$+2*(T+1);for(const H of[0,1])for(let it=0;it<=T;it++)for(const ct of[0,1])x.emplaceBack(H*h.a4,it*E,ct);for(let H=0;H<2*T;H+=2)b.emplaceBack($+H,$+H+1,$+H+3),b.emplaceBack($+H,$+H+3,$+H+2),b.emplaceBack(K+H,K+H+3,K+H+1),b.emplaceBack(K+H,K+H+2,K+H+3);const J=new Jr(_.createVertexBuffer(x,Wu.members),_.createIndexBuffer(b),h.aW.simpleSegment(0,0,x.length,b.length));return this._meshCache[m]=J,J}getMeshFrameDelta(e){return 2*Math.PI*h.bD/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,n){var o;const{tileID:c}=this._getOverscaledTileIDFromLngLatZoom(e,n);return(o=this.getMinMaxElevation(c).minElevation)!==null&&o!==void 0?o:0}getMinMaxElevation(e){const n=this.getTerrainData(e).tile,o={minElevation:null,maxElevation:null};return n&&n.dem&&(o.minElevation=n.dem.min*this.exaggeration,o.maxElevation=n.dem.max*this.exaggeration),o}_getOverscaledTileIDFromLngLatZoom(e,n){const o=h.aa.fromLngLat(e.wrap()),c=(1<<n)*h.a4,p=o.x*c,m=o.y*c,_=Math.floor(p/h.a4),x=Math.floor(m/h.a4);return{tileID:new h.a1(n,0,n,_,x),mercatorX:p,mercatorY:m}}}class sa{constructor(e,n,o){this._context=e,this._size=n,this._tileSize=o,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){const n=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),o=new h.T(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return o.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),n.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),n.colorAttachment.set(o.texture),{id:e,fbo:n,texture:o,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(n=>e.id!==n),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(const n of this._recentlyUsed)if(!this._objects[n].inUse)return this._objects[n];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<this._size)&&this._objects.some(e=>!e.inUse)===!1}}const ue={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class Ne{constructor(e,n){this.painter=e,this.terrain=n,this.pool=new sa(e.context,30,n.tileManager.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,n){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=e._order.filter(o=>!e._layers[o].isHidden(n)),this._coordsAscending={};for(const o in e.tileManagers){this._coordsAscending[o]={};const c=e.tileManagers[o].getVisibleCoordinates(),p=e.tileManagers[o].getSource(),m=p instanceof Ai?p.terrainTileRanges:null;for(const _ of c){const x=this.terrain.tileManager.getTerrainCoords(_,m);for(const b in x)this._coordsAscending[o][b]||(this._coordsAscending[o][b]=[]),this._coordsAscending[o][b].push(x[b])}}this._coordsAscendingStr={};for(const o of e._order){const c=e._layers[o],p=c.source;if(ue[c.type]&&!this._coordsAscendingStr[p]){this._coordsAscendingStr[p]={};for(const m in this._coordsAscending[p])this._coordsAscendingStr[p][m]=this._coordsAscending[p][m].map(_=>_.key).sort().join()}}for(const o of this._renderableTiles)for(const c in this._coordsAscendingStr){const p=this._coordsAscendingStr[c][o.tileID.key];p&&p!==o.rttCoords[c]&&(o.rtt=[])}}renderLayer(e,n){if(e.isHidden(this.painter.transform.zoom))return!1;const o=Object.assign(Object.assign({},n),{isRenderingToTexture:!0}),c=e.type,p=this.painter,m=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(ue[c]&&(this._prevType&&ue[this._prevType]||this._stacks.push([]),this._prevType=c,this._stacks[this._stacks.length-1].push(e.id),!m))return!0;if(ue[this._prevType]||ue[c]&&m){this._prevType=c;const _=this._stacks.length-1,x=this._stacks[_]||[];for(const b of this._renderableTiles){if(this.pool.isFull()&&(rn(this.painter,this.terrain,this._rttTiles,o),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(b),b.rtt[_]){const E=this.pool.getObjectForId(b.rtt[_].id);if(E.stamp===b.rtt[_].stamp){this.pool.useObject(E);continue}}const T=this.pool.getOrCreateFreeObject();this.pool.useObject(T),this.pool.stampObject(T),b.rtt[_]={id:T.id,stamp:T.stamp},p.context.bindFramebuffer.set(T.fbo.framebuffer),p.context.clear({color:h.bo.transparent,stencil:0}),p.currentStencilSource=void 0;for(let E=0;E<x.length;E++){const I=p.style._layers[x[E]],D=I.source?this._coordsAscending[I.source][b.tileID.key]:[b.tileID];p.context.viewport.set([0,0,T.fbo.width,T.fbo.height]),p._renderTileClippingMasks(I,D,!0),p.renderLayer(p,p.style.tileManagers[I.source],I,D,o),I.source&&(b.rttCoords[I.source]=this._coordsAscendingStr[I.source][b.tileID.key])}}return rn(this.painter,this.terrain,this._rttTiles,o),this._rttTiles=[],this.pool.freeAllObjects(),ue[c]}return!1}}const Hc={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},aa=Pt,oa={hash:!1,interactive:!0,bearingSnap:7,attributionControl:na,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:h.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,experimentalZoomLevelsToOverscale:void 0},xl={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class vl{constructor(e,n,o=!1){this.mousedown=p=>{this.startMove(p,dt.mousePos(this.element,p)),dt.addEventListener(window,"mousemove",this.mousemove),dt.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=p=>{this.move(p,dt.mousePos(this.element,p))},this.mouseup=p=>{this._rotatePitchHandler.dragEnd(p),this.offTemp()},this.touchstart=p=>{p.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=dt.touchPos(this.element,p.targetTouches)[0],this.startMove(p,this._startPos),dt.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),dt.addEventListener(window,"touchend",this.touchend))},this.touchmove=p=>{p.targetTouches.length!==1?this.reset():(this._lastPos=dt.touchPos(this.element,p.targetTouches)[0],this.move(p,this._lastPos))},this.touchend=p=>{p.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=n;const c=new Zu;this._rotatePitchHandler=new fs({clickTolerance:3,move:(p,m)=>{const _=n.getBoundingClientRect(),x=new h.P((_.bottom-_.top)/2,(_.right-_.left)/2);return{bearingDelta:h.cw(new h.P(p.x,m.y),m,x),pitchDelta:o?-.5*(m.y-p.y):void 0}},moveStateManager:c,enable:!0,assignEvents:()=>{}}),this.map=e,dt.addEventListener(n,"mousedown",this.mousedown),dt.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),dt.addEventListener(n,"touchcancel",this.reset)}startMove(e,n){this._rotatePitchHandler.dragStart(e,n),dt.disableDrag()}move(e,n){const o=this.map,{bearingDelta:c,pitchDelta:p}=this._rotatePitchHandler.dragMove(e,n)||{};c&&o.setBearing(o.getBearing()+c),p&&o.setPitch(o.getPitch()+p)}off(){const e=this.element;dt.removeEventListener(e,"mousedown",this.mousedown),dt.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),dt.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),dt.removeEventListener(window,"touchend",this.touchend),dt.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){dt.enableDrag(),dt.removeEventListener(window,"mousemove",this.mousemove),dt.removeEventListener(window,"mouseup",this.mouseup),dt.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),dt.removeEventListener(window,"touchend",this.touchend)}}let Ar;function gs(d,e,n,o=!1){if(o||!n.getCoveringTilesDetailsProvider().allowWorldCopies())return d?.wrap();const c=new h.V(d.lng,d.lat);if(d=new h.V(d.lng,d.lat),e){const p=new h.V(d.lng-360,d.lat),m=new h.V(d.lng+360,d.lat),_=n.locationToScreenPoint(d).distSqr(e);n.locationToScreenPoint(p).distSqr(e)<_?d=p:n.locationToScreenPoint(m).distSqr(e)<_&&(d=m)}for(;Math.abs(d.lng-n.center.lng)>180;){const p=n.locationToScreenPoint(d);if(p.x>=0&&p.y>=0&&p.x<=n.width&&p.y<=n.height)break;d.lng>n.center.lng?d.lng-=360:d.lng+=360}return d.lng!==c.lng&&n.isPointOnMapSurface(n.locationToScreenPoint(d))?d:c}const la={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 to(d,e,n){const o=d.classList;for(const c in la)o.remove(`maplibregl-${n}-anchor-${c}`);o.add(`maplibregl-${n}-anchor-${e}`)}class ca extends h.E{constructor(e){if(super(),this._onKeyPress=n=>{const o=n.code,c=n.charCode||n.keyCode;o!=="Space"&&o!=="Enter"&&c!==32&&c!==13||this.togglePopup()},this._onMapClick=n=>{const o=n.originalEvent.target,c=this._element;this._popup&&(o===c||c.contains(o))&&this.togglePopup()},this._update=n=>{if(!this._map)return;const o=this._map.loaded()&&!this._map.isMoving();(n?.type==="terrain"||n?.type==="render"&&!o)&&this._map.once("render",this._update),this._lngLat=gs(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let c="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?c=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(c=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let p="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?p="rotateX(0deg)":this._pitchAlignment==="map"&&(p=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||n&&n.type!=="moveend"||(this._pos=this._pos.round()),dt.setTransform(this._element,`${la[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${p} ${c}`),Qe.frameAsync(new AbortController).then(()=>{this._updateOpacity(n&&n.type==="moveend")}).catch(()=>{})},this._onMove=n=>{if(!this._isDragging){const o=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=o}this._isDragging&&(this._pos=n.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.l("dragstart"))),this.fire(new h.l("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.l("dragend")),this._state="inactive"},this._addDragHandler=n=>{this._element.contains(n.originalEvent.target)&&(n.preventDefault(),this._positionDelta=n.point.sub(this._pos).add(this._offset),this._pointerdownPos=n.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(e?.opacity,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=dt.create("div");const n=dt.createNS("http://www.w3.org/2000/svg","svg"),o=41,c=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${o}px`),n.setAttributeNS(null,"width",`${c}px`),n.setAttributeNS(null,"viewBox",`0 0 ${c} ${o}`);const p=dt.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"stroke","none"),p.setAttributeNS(null,"stroke-width","1"),p.setAttributeNS(null,"fill","none"),p.setAttributeNS(null,"fill-rule","evenodd");const m=dt.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"fill-rule","nonzero");const _=dt.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const x=[{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 G of x){const q=dt.createNS("http://www.w3.org/2000/svg","ellipse");q.setAttributeNS(null,"opacity","0.04"),q.setAttributeNS(null,"cx","10.5"),q.setAttributeNS(null,"cy","5.80029008"),q.setAttributeNS(null,"rx",G.rx),q.setAttributeNS(null,"ry",G.ry),_.appendChild(q)}const b=dt.createNS("http://www.w3.org/2000/svg","g");b.setAttributeNS(null,"fill",this._color);const T=dt.createNS("http://www.w3.org/2000/svg","path");T.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"),b.appendChild(T);const E=dt.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"opacity","0.25"),E.setAttributeNS(null,"fill","#000000");const I=dt.createNS("http://www.w3.org/2000/svg","path");I.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"),E.appendChild(I);const D=dt.createNS("http://www.w3.org/2000/svg","g");D.setAttributeNS(null,"transform","translate(6.0, 7.0)"),D.setAttributeNS(null,"fill","#FFFFFF");const L=dt.createNS("http://www.w3.org/2000/svg","g");L.setAttributeNS(null,"transform","translate(8.0, 8.0)");const V=dt.createNS("http://www.w3.org/2000/svg","circle");V.setAttributeNS(null,"fill","#000000"),V.setAttributeNS(null,"opacity","0.25"),V.setAttributeNS(null,"cx","5.5"),V.setAttributeNS(null,"cy","5.5"),V.setAttributeNS(null,"r","5.4999962");const N=dt.createNS("http://www.w3.org/2000/svg","circle");N.setAttributeNS(null,"fill","#FFFFFF"),N.setAttributeNS(null,"cx","5.5"),N.setAttributeNS(null,"cy","5.5"),N.setAttributeNS(null,"r","5.4999962"),L.appendChild(V),L.appendChild(N),m.appendChild(_),m.appendChild(b),m.appendChild(E),m.appendChild(D),m.appendChild(L),n.appendChild(m),n.setAttributeNS(null,"height",o*this._scale+"px"),n.setAttributeNS(null,"width",c*this._scale+"px"),this._element.appendChild(n),this._offset=h.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",n=>{n.preventDefault()}),this._element.addEventListener("mousedown",n=>{n.preventDefault()}),to(this._element,this._anchor,"marker"),e&&e.className)for(const n of e.className.split(" "))this._element.classList.add(n);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),this._element.hasAttribute("role")||this._element.setAttribute("role","button"),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",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("projectiontransition",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),dt.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=h.V.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 c=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":[c,-1*(38.1-13.5+c)],"bottom-right":[-c,-1*(38.1-13.5+c)],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 n,o;const c=(n=this._map)===null||n===void 0?void 0:n.terrain,p=this._map.transform.isLocationOccluded(this._lngLat);if(!c||p){const D=p?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==D&&(this._element.style.opacity=D))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const m=this._map,_=m.terrain.depthAtPoint(this._pos),x=m.terrain.getElevationForLngLatZoom(this._lngLat,m.transform.tileZoom);if(m.transform.lngLatToCameraDepth(this._lngLat,x)-_<.006)return void(this._element.style.opacity=this._opacity);const b=-this._offset.y/m.transform.pixelsPerMeter,T=Math.sin(m.getPitch()*Math.PI/180)*b,E=m.terrain.depthAtPoint(new h.P(this._pos.x,this._pos.y-this._offset.y)),I=m.transform.lngLatToCameraDepth(this._lngLat,x+T)-E>.006;!((o=this._popup)===null||o===void 0)&&o.isOpen()&&I&&this._popup.remove(),this._element.style.opacity=I?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,n){return(this._opacity===void 0||e===void 0&&n===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),n!==void 0&&(this._opacityWhenCovered=n),this._map&&this._updateOpacity(!0),this}}const bl={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let _s=0,zn=!1;const wl={maxWidth:100,unit:"metric"};function eo(d,e,n){const o=n&&n.maxWidth||100,c=d._container.clientHeight/2,p=d._container.clientWidth/2,m=d.unproject([p-o/2,c]),_=d.unproject([p+o/2,c]),x=Math.round(d.project(_).x-d.project(m).x),b=Math.min(o,x,d._container.clientWidth),T=m.distanceTo(_);if(n&&n.unit==="imperial"){const E=3.2808*T;E>5280?kn(e,b,E/5280,d._getUIString("ScaleControl.Miles")):kn(e,b,E,d._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?kn(e,b,T/1852,d._getUIString("ScaleControl.NauticalMiles")):T>=1e3?kn(e,b,T/1e3,d._getUIString("ScaleControl.Kilometers")):kn(e,b,T,d._getUIString("ScaleControl.Meters"))}function kn(d,e,n,o){const c=function(p){const m=Math.pow(10,`${Math.floor(p)}`.length-1);let _=p/m;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(x){const b=Math.pow(10,Math.ceil(-Math.log(x)/Math.LN10));return Math.round(x*b)/b}(_),m*_}(n);d.style.width=e*(c/n)+"px",d.innerHTML=`${c}&nbsp;${o}`}const io={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},Tl=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function ro(d){if(d){if(typeof d=="number"){const e=Math.round(Math.abs(d)/Math.SQRT2);return{center:new h.P(0,0),top:new h.P(0,d),"top-left":new h.P(e,e),"top-right":new h.P(-e,e),bottom:new h.P(0,-d),"bottom-left":new h.P(e,-e),"bottom-right":new h.P(-e,-e),left:new h.P(d,0),right:new h.P(-d,0)}}if(d instanceof h.P||Array.isArray(d)){const e=h.P.convert(d);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(d.center||[0,0]),top:h.P.convert(d.top||[0,0]),"top-left":h.P.convert(d["top-left"]||[0,0]),"top-right":h.P.convert(d["top-right"]||[0,0]),bottom:h.P.convert(d.bottom||[0,0]),"bottom-left":h.P.convert(d["bottom-left"]||[0,0]),"bottom-right":h.P.convert(d["bottom-right"]||[0,0]),left:h.P.convert(d.left||[0,0]),right:h.P.convert(d.right||[0,0])}}return ro(new h.P(0,0))}const no=Pt;A.AJAXError=h.cI,A.Event=h.l,A.Evented=h.E,A.LngLat=h.V,A.MercatorCoordinate=h.aa,A.Point=h.P,A.addProtocol=h.cJ,A.config=h.a,A.removeProtocol=h.cK,A.AttributionControl=gi,A.BoxZoomHandler=Oc,A.CanvasSource=As,A.CooperativeGesturesHandler=or,A.DoubleClickZoomHandler=ia,A.DragPanHandler=_l,A.DragRotateHandler=yl,A.EdgeInsets=_e,A.FullscreenControl=class extends h.E{constructor(d={}){super(),this._onFullscreenChange=()=>{var e;let n=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((e=n?.shadowRoot)===null||e===void 0)&&e.fullscreenElement;)n=n.shadowRoot.fullscreenElement;n===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,d&&d.container&&(d.container instanceof HTMLElement?this._container=d.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(d){return this._map=d,this._container||(this._container=this._map.getContainer()),this._controlContainer=dt.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){dt.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const d=this._fullscreenButton=dt.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);dt.create("span","maplibregl-ctrl-icon",d).setAttribute("aria-hidden","true"),d.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const d=this._getTitle();this._fullscreenButton.setAttribute("aria-label",d),this._fullscreenButton.title=d}_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.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new h.l("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()}},A.GeoJSONSource=gn,A.GeolocateControl=class extends h.E{constructor(d){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new h.l("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.l("geolocate",e)),this._finish()}},this._updateCamera=e=>{const n=new h.V(e.coords.longitude,e.coords.latitude),o=e.coords.accuracy,c=this._map.getBearing(),p=h.e({bearing:c},this.options.fitBoundsOptions),m=Ie.fromLngLat(n,o);this._map.fitBounds(m,p,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const n=new h.V(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=e.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=e=>{if(this._map){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 n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&zn)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new h.l("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=dt.create("button","maplibregl-ctrl-geolocate",this._container),dt.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 n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}else{const n=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=dt.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new ca({element:this._dotElement}),this._circleElement=dt.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ca({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",n=>{const o=n?.[0]instanceof ResizeObserverEntry;n.geolocateSource||this._watchState!=="ACTIVE_LOCK"||o||this._map.isZooming()||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new h.l("trackuserlocationend")),this.fire(new h.l("userlocationlostfocus")))})}},this.options=h.e({},bl,d)}onAdd(d){return this._map=d,this._container=dt.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return h._(this,arguments,void 0,function*(e=!1){if(Ar!==void 0&&!e)return Ar;if(window.navigator.permissions===void 0)return Ar=!!window.navigator.geolocation,Ar;try{Ar=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Ar=!!window.navigator.geolocation}return Ar})}().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(),dt.remove(this._container),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,_s=0,zn=!1}_isOutOfMapMaxBounds(d){const e=this._map.getMaxBounds(),n=d.coords;return e&&(n.longitude<e.getWest()||n.longitude>e.getEast()||n.latitude<e.getSouth()||n.latitude>e.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":case"BACKGROUND_ERROR":case"OFF":case void 0:break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){const d=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&d))return;const e=this._map.project(d),n=this._map.unproject([e.x+100,e.y]),o=d.distanceTo(n)/100,c=2*this._accuracy/o;this._circleElement.style.width=`${c.toFixed(2)}px`,this._circleElement.style.height=`${c.toFixed(2)}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.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":_s--,zn=!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.l("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.l("trackuserlocationstart")),this.fire(new h.l("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 d;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),_s++,_s>1?(d={maximumAge:6e5,timeout:0},zn=!0):(d=this.options.positionOptions,zn=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,d)}}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)}},A.GlobeControl=class{constructor(){this._toggleProjection=()=>{var d;const e=(d=this._map.getProjection())===null||d===void 0?void 0:d.type;this._map.setProjection(e!=="mercator"&&e?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var d;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((d=this._map.getProjection())===null||d===void 0?void 0:d.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(d){return this._map=d,this._container=dt.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=dt.create("button","maplibregl-ctrl-globe",this._container),dt.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){dt.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},A.Hash=cl,A.ImageSource=Ai,A.KeyboardHandler=Gc,A.LngLatBounds=Ie,A.LogoControl=Hi,A.Map=class extends qc{constructor(d){var e,n;h.cF.mark(h.cG.create);const o=Object.assign(Object.assign(Object.assign({},oa),d),{canvasContextAttributes:Object.assign(Object.assign({},oa.canvasContextAttributes),d.canvasContextAttributes)});if(o.minZoom!=null&&o.maxZoom!=null&&o.minZoom>o.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(o.minPitch!=null&&o.maxPitch!=null&&o.minPitch>o.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(o.minPitch!=null&&o.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(o.maxPitch!=null&&o.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const c=new be,p=new ki;if(o.minZoom!==void 0&&c.setMinZoom(o.minZoom),o.maxZoom!==void 0&&c.setMaxZoom(o.maxZoom),o.minPitch!==void 0&&c.setMinPitch(o.minPitch),o.maxPitch!==void 0&&c.setMaxPitch(o.maxPitch),o.renderWorldCopies!==void 0&&c.setRenderWorldCopies(o.renderWorldCopies),o.transformConstrain!==null&&c.setConstrainOverride(o.transformConstrain),super(c,p,{bearingSnap:o.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Wc,this._controls=[],this._mapId=h.ag(),this._lostContextStyle={style:null,images:null},this._contextLost=_=>{_.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.painter.destroy();for(const x of Object.values(this.style._layers))if(x.type==="custom"&&console.warn(`Custom layer with id '${x.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),x._listeners)for(const[b]of Object.entries(x._listeners))console.warn(`Custom layer with id '${x.id}' had event listeners for event '${b}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this._lostContextStyle=this._getStyleAndImages(),this.style.destroy(),this.style=null,this.fire(new h.l("webglcontextlost",{originalEvent:_}))},this._contextRestored=_=>{this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&(this.style.imageManager.images=this._lostContextStyle.images),this._setupPainter(),this.resize(),this._update(),this.fire(new h.l("webglcontextrestored",{originalEvent:_}))},this._onMapScroll=_=>{if(_.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=o.interactive,this._maxTileCacheSize=o.maxTileCacheSize,this._maxTileCacheZoomLevels=o.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},o.canvasContextAttributes),this._trackResize=o.trackResize===!0,this._bearingSnap=o.bearingSnap,this._centerClampedToGround=o.centerClampedToGround,this._refreshExpiredTiles=o.refreshExpiredTiles===!0,this._fadeDuration=o.fadeDuration,this._crossSourceCollisions=o.crossSourceCollisions===!0,this._collectResourceTiming=o.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Hc),o.locale),this._clickTolerance=o.clickTolerance,this._overridePixelRatio=o.pixelRatio,this._maxCanvasSize=o.maxCanvasSize,this._zoomLevelsToOverscale=o.experimentalZoomLevelsToOverscale,this.transformCameraUpdate=o.transformCameraUpdate,this.transformConstrain=o.transformConstrain,this.cancelPendingTileRequestsWhileZooming=o.cancelPendingTileRequestsWhileZooming===!0,o.reduceMotion!==void 0&&(Qe.prefersReducedMotion=o.reduceMotion),this._imageQueueHandle=Ci.addThrottleControl(()=>this.isMoving()),this._requestManager=new va(o.transformRequest),typeof o.container=="string"){if(this._container=document.getElementById(o.container),!this._container)throw new Error(`Container '${o.container}' not found.`)}else{if(!(o.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=o.container}if(o.maxBounds&&this.setMaxBounds(o.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let _=!1;const x=ll(b=>{this._trackResize&&!this._removed&&(this.resize(b),this.redraw())},50);this._resizeObserver=new ResizeObserver(b=>{_?x(b):_=!0}),this._resizeObserver.observe(this._container)}this.handlers=new ra(this,o),this._hash=o.hash&&new cl(typeof o.hash=="string"&&o.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:o.center,elevation:o.elevation,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch,roll:o.roll}),o.bounds&&(this.resize(),this.fitBounds(o.bounds,h.e({},o.fitBoundsOptions,{duration:0}))));const m=typeof o.style=="string"||((n=(e=o.style)===null||e===void 0?void 0:e.projection)===null||n===void 0?void 0:n.type)!=="globe";this.resize(null,m),this._localIdeographFontFamily=o.localIdeographFontFamily,this._validateStyle=o.validateStyle,o.style&&this.setStyle(o.style,{localIdeographFontFamily:o.localIdeographFontFamily}),o.attributionControl&&this.addControl(new gi(typeof o.attributionControl=="boolean"?void 0:o.attributionControl)),o.maplibreLogo&&this.addControl(new Hi,o.logoPosition),this.on("style.load",()=>{if(m||this._resizeTransform(),this.transform.unmodified){const _=h.U(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(_)}}),this.on("data",_=>{this._update(_.dataType==="style"),this.fire(new h.l(`${_.dataType}data`,_))}),this.on("dataloading",_=>{this.fire(new h.l(`${_.dataType}dataloading`,_))}),this.on("dataabort",_=>{this.fire(new h.l("sourcedataabort",_))})}_getMapId(){return this._mapId}setGlobalStateProperty(d,e){return this.style.setGlobalStateProperty(d,e),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(d,e){if(e===void 0&&(e=d.getDefaultPosition?d.getDefaultPosition():"top-right"),!d||!d.onAdd)return this.fire(new h.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=d.onAdd(this);this._controls.push(d);const o=this._controlPositions[e];return e.indexOf("bottom")!==-1?o.insertBefore(n,o.firstChild):o.appendChild(n),this}removeControl(d){if(!d||!d.onRemove)return this.fire(new h.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const e=this._controls.indexOf(d);return e>-1&&this._controls.splice(e,1),d.onRemove(this),this}hasControl(d){return this._controls.indexOf(d)>-1}coveringTiles(d){return Wt(this.transform,d)}calculateCameraOptionsFromTo(d,e,n,o){return o==null&&this.terrain&&(o=this.terrain.getElevationForLngLatZoom(n,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(d,e,n,o)}resize(d,e=!0){const[n,o]=this._containerDimensions(),c=this._getClampedPixelRatio(n,o);if(this._resizeCanvas(n,o,c),this.painter.resize(n,o,c),this.painter.overLimit()){const m=this.painter.context.gl;this._maxCanvasSize=[m.drawingBufferWidth,m.drawingBufferHeight];const _=this._getClampedPixelRatio(n,o);this._resizeCanvas(n,o,_),this.painter.resize(n,o,_)}this._resizeTransform(e);const p=!this._moving;return p&&(this.stop(),this.fire(new h.l("movestart",d)).fire(new h.l("move",d))),this.fire(new h.l("resize",d)),p&&this.fire(new h.l("moveend",d)),this}_resizeTransform(d=!0){var e;const[n,o]=this._containerDimensions();this.transform.resize(n,o,d),(e=this._requestedCameraState)===null||e===void 0||e.resize(n,o,d)}_getClampedPixelRatio(d,e){const{0:n,1:o}=this._maxCanvasSize,c=this.getPixelRatio(),p=d*c,m=e*c;return Math.min(p>n?n/p:1,m>o?o/m:1)*c}getPixelRatio(){var d;return(d=this._overridePixelRatio)!==null&&d!==void 0?d:devicePixelRatio}setPixelRatio(d){this._overridePixelRatio=d,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(d){return this.transform.setMaxBounds(Ie.convert(d)),this._update()}setMinZoom(d){if((d=d??-2)>=-2&&d<=this.transform.maxZoom)return this.transform.setMinZoom(d),this._update(),this.getZoom()<d&&this.setZoom(d),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(d){if((d=d??22)>=this.transform.minZoom)return this.transform.setMaxZoom(d),this._update(),this.getZoom()>d&&this.setZoom(d),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(d){if((d=d??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(d>=0&&d<=this.transform.maxPitch)return this.transform.setMinPitch(d),this._update(),this.getPitch()<d&&this.setPitch(d),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(d){if((d=d??60)>180)throw new Error("maxPitch must be less than or equal to 180");if(d>=this.transform.minPitch)return this.transform.setMaxPitch(d),this._update(),this.getPitch()>d&&this.setPitch(d),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(d){return this.transform.setRenderWorldCopies(d),this._update()}setTransformConstrain(d){return this.transform.setConstrainOverride(d),this._update()}project(d){return this.transform.locationToScreenPoint(h.V.convert(d),this.style&&this.terrain)}unproject(d){return this.transform.screenPointToLocation(h.P.convert(d),this.terrain)}isMoving(){var d;return this._moving||((d=this.handlers)===null||d===void 0?void 0:d.isMoving())}isZooming(){var d;return this._zooming||((d=this.handlers)===null||d===void 0?void 0:d.isZooming())}isRotating(){var d;return this._rotating||((d=this.handlers)===null||d===void 0?void 0:d.isRotating())}_createDelegatedListener(d,e,n){if(d==="mouseenter"||d==="mouseover"){let o=!1;return{layers:e,listener:n,delegates:{mousemove:p=>{const m=e.filter(x=>this.getLayer(x)),_=m.length!==0?this.queryRenderedFeatures(p.point,{layers:m}):[];_.length?o||(o=!0,n.call(this,new Fe(d,this,p.originalEvent,{features:_}))):o=!1},mouseout:()=>{o=!1}}}}if(d==="mouseleave"||d==="mouseout"){let o=!1;return{layers:e,listener:n,delegates:{mousemove:m=>{const _=e.filter(x=>this.getLayer(x));(_.length!==0?this.queryRenderedFeatures(m.point,{layers:_}):[]).length?o=!0:o&&(o=!1,n.call(this,new Fe(d,this,m.originalEvent)))},mouseout:m=>{o&&(o=!1,n.call(this,new Fe(d,this,m.originalEvent)))}}}}{const o=c=>{const p=e.filter(_=>this.getLayer(_)),m=p.length!==0?this.queryRenderedFeatures(c.point,{layers:p}):[];m.length&&(c.features=m,n.call(this,c),delete c.features)};return{layers:e,listener:n,delegates:{[d]:o}}}}_saveDelegatedListener(d,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[d]=this._delegatedListeners[d]||[],this._delegatedListeners[d].push(e)}_removeDelegatedListener(d,e,n){if(!this._delegatedListeners||!this._delegatedListeners[d])return;const o=this._delegatedListeners[d];for(let c=0;c<o.length;c++){const p=o[c];if(p.listener===n&&p.layers.length===e.length&&p.layers.every(m=>e.includes(m))){for(const m in p.delegates)this.off(m,p.delegates[m]);return void o.splice(c,1)}}}on(d,e,n){if(n===void 0)return super.on(d,e);const o=typeof e=="string"?[e]:e,c=this._createDelegatedListener(d,o,n);this._saveDelegatedListener(d,c);for(const p in c.delegates)this.on(p,c.delegates[p]);return{unsubscribe:()=>{this._removeDelegatedListener(d,o,n)}}}once(d,e,n){if(n===void 0)return super.once(d,e);const o=typeof e=="string"?[e]:e,c=this._createDelegatedListener(d,o,n);for(const p in c.delegates){const m=c.delegates[p];c.delegates[p]=(..._)=>{this._removeDelegatedListener(d,o,n),m(..._)}}this._saveDelegatedListener(d,c);for(const p in c.delegates)this.once(p,c.delegates[p]);return this}off(d,e,n){return n===void 0?super.off(d,e):(this._removeDelegatedListener(d,typeof e=="string"?[e]:e,n),this)}queryRenderedFeatures(d,e){if(!this.style)return[];let n;const o=d instanceof h.P||Array.isArray(d),c=o?d:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(o?{}:d)||{},c instanceof h.P||typeof c[0]=="number")n=[h.P.convert(c)];else{const p=h.P.convert(c[0]),m=h.P.convert(c[1]);n=[p,new h.P(m.x,p.y),m,new h.P(p.x,m.y),p]}return this.style.queryRenderedFeatures(n,e,this.transform)}querySourceFeatures(d,e){return this.style.querySourceFeatures(d,e)}setStyle(d,e){return(e=h.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&d?(this._diffStyle(d,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(d,e))}setTransformRequest(d){return this._requestManager.setTransformRequest(d),this}_getUIString(d){const e=this._locale[d];if(e==null)throw new Error(`Missing UI string '${d}'`);return e}_updateStyle(d,e){var n,o;if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(d,e));const c=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!d)),d?(this.style=new Fs(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof d=="string"?this.style.loadURL(d,e,c):this.style.loadJSON(d,e,c),this):((o=(n=this.style)===null||n===void 0?void 0:n.projection)===null||o===void 0||o.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Fs(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(d,e){if(typeof d=="string"){const n=this._requestManager.transformRequest(d,"Style");h.j(n,new AbortController).then(o=>{this._updateDiff(o.data,e)}).catch(o=>{o&&this.fire(new h.k(o))})}else typeof d=="object"&&this._updateDiff(d,e)}_updateDiff(d,e){try{this.style.setState(d,e)&&this._update(!0)}catch(n){h.w(`Unable to perform style diff: ${n.message||n.error||n}.  Rebuilding the style from scratch.`),this._updateStyle(d,e)}}getStyle(){if(this.style)return this.style.serialize()}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){return this.style?this.style.loaded():h.w("There is no style added to the map.")}addSource(d,e){return this._lazyInitEmptyStyle(),this.style.addSource(d,e),this._update(!0)}isSourceLoaded(d){const e=this.style&&this.style.tileManagers[d];if(e!==void 0)return e.loaded();this.fire(new h.k(new Error(`There is no tile manager with ID '${d}'`)))}setTerrain(d){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),d){const e=this.style.tileManagers[d.source];if(!e)throw new Error(`cannot load terrain, because there exists no source with ID: ${d.source}`);this.terrain===null&&e.reload();for(const n in this.style._layers){const o=this.style._layers[n];o.type==="hillshade"&&o.source===d.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."),o.type==="color-relief"&&o.source===d.source&&h.w("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Xu(this.painter,e,d),this.painter.renderToTexture=new Ne(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=n=>{var o;n.dataType==="style"?this.terrain.tileManager.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId!==d.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((o=n.source)===null||o===void 0?void 0:o.type)==="image"?this.terrain.tileManager.freeRtt():this.terrain.tileManager.freeRtt(n.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.tileManager.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new h.l("terrain",{terrain:d})),this}getTerrain(){var d,e;return(e=(d=this.terrain)===null||d===void 0?void 0:d.options)!==null&&e!==void 0?e:null}areTilesLoaded(){const d=this.style&&this.style.tileManagers;for(const e in d){const n=d[e]._tiles;for(const o in n){const c=n[o];if(c.state!=="loaded"&&c.state!=="errored")return!1}}return!0}removeSource(d){return this.style.removeSource(d),this._update(!0)}getSource(d){return this.style.getSource(d)}setSourceTileLodParams(d,e,n){if(n){const o=this.getSource(n);if(!o)throw new Error(`There is no source with ID "${n}", cannot set LOD parameters`);o.calculateTileZoom=pt(Math.max(1,d),Math.max(1,e))}else for(const o in this.style.tileManagers)this.style.tileManagers[o].getSource().calculateTileZoom=pt(Math.max(1,d),Math.max(1,e));return this._update(!0),this}refreshTiles(d,e){const n=this.style.tileManagers[d];if(!n)throw new Error(`There is no tile manager with ID "${d}", cannot refresh tile`);e===void 0?n.reload(!0):n.refreshTiles(e.map(o=>new h.ad(o.z,o.x,o.y)))}addImage(d,e,n={}){const{pixelRatio:o=1,sdf:c=!1,stretchX:p,stretchY:m,content:_,textFitWidth:x,textFitHeight:b}=n;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||h.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new h.k(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:T,height:E,data:I}=e,D=e;return this.style.addImage(d,{data:new h.R({width:T,height:E},new Uint8Array(I)),pixelRatio:o,stretchX:p,stretchY:m,content:_,textFitWidth:x,textFitHeight:b,sdf:c,version:0,userImage:D}),D.onAdd&&D.onAdd(this,d),this}}{const{width:T,height:E,data:I}=Qe.getImageData(e);this.style.addImage(d,{data:new h.R({width:T,height:E},I),pixelRatio:o,stretchX:p,stretchY:m,content:_,textFitWidth:x,textFitHeight:b,sdf:c,version:0})}}updateImage(d,e){const n=this.style.getImage(d);if(!n)return this.fire(new h.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const o=e instanceof HTMLImageElement||h.b(e)?Qe.getImageData(e):e,{width:c,height:p,data:m}=o;if(c===void 0||p===void 0)return this.fire(new h.k(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(c!==n.data.width||p!==n.data.height)return this.fire(new h.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const _=!(e instanceof HTMLImageElement||h.b(e));return n.data.replace(m,_),this.style.updateImage(d,n),this}getImage(d){return this.style.getImage(d)}hasImage(d){return d?!!this.style.getImage(d):(this.fire(new h.k(new Error("Missing required image id"))),!1)}removeImage(d){this.style.removeImage(d)}loadImage(d){return Ci.getImage(this._requestManager.transformRequest(d,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(d,e){return this._lazyInitEmptyStyle(),this.style.addLayer(d,e),this._update(!0)}moveLayer(d,e){return this.style.moveLayer(d,e),this._update(!0)}removeLayer(d){return this.style.removeLayer(d),this._update(!0)}getLayer(d){return this.style.getLayer(d)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(d,e,n){return this.style.setLayerZoomRange(d,e,n),this._update(!0)}setFilter(d,e,n={}){return this.style.setFilter(d,e,n),this._update(!0)}getFilter(d){return this.style.getFilter(d)}setPaintProperty(d,e,n,o={}){return this.style.setPaintProperty(d,e,n,o),this._update(!0)}getPaintProperty(d,e){return this.style.getPaintProperty(d,e)}setLayoutProperty(d,e,n,o={}){return this.style.setLayoutProperty(d,e,n,o),this._update(!0)}getLayoutProperty(d,e){return this.style.getLayoutProperty(d,e)}setGlyphs(d,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(d,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(d,e,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(d,e,n,o=>{o||this._update(!0)}),this}removeSprite(d){return this._lazyInitEmptyStyle(),this.style.removeSprite(d),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(d,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(d,e,n=>{n||this._update(!0)}),this}setLight(d,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(d,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(d,e={}){return this._lazyInitEmptyStyle(),this.style.setSky(d,e),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(d,e){return this.style.setFeatureState(d,e),this._update()}removeFeatureState(d,e){return this.style.removeFeatureState(d,e),this._update()}getFeatureState(d){return this.style.getFeatureState(d)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let d=0,e=0;return this._container&&(d=this._container.clientWidth||400,e=this._container.clientHeight||300),[d,e]}_setupContainer(){const d=this._container;d.classList.add("maplibregl-map");const e=this._canvasContainer=dt.create("div","maplibregl-canvas-container",d);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=dt.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 n=this._containerDimensions(),o=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],o);const c=this._controlContainer=dt.create("div","maplibregl-control-container",d),p=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(m=>{p[m]=dt.create("div",`maplibregl-ctrl-${m} `,c)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(d,e,n){this._canvas.width=Math.floor(n*d),this._canvas.height=Math.floor(n*e),this._canvas.style.width=`${d}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const d=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let e=null;this._canvas.addEventListener("webglcontextcreationerror",o=>{e={requestedAttributes:d},o&&(e.statusMessage=o.statusMessage,e.type=o.type)},{once:!0});let n=null;if(n=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,d):this._canvas.getContext("webgl2",d)||this._canvas.getContext("webgl",d),!n){const o="Failed to initialize WebGL";throw e?(e.message=o,new Error(JSON.stringify(e))):new Error(o)}this.painter=new kc(n,this.transform),hn.testSupport(n)}migrateProjection(d,e){super.migrateProjection(d,e),this.painter.transform=d,this.fire(new h.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(d){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||d,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(d){return this._update(),this._renderTaskQueue.add(d)}_cancelRenderFrame(d){this._renderTaskQueue.remove(d)}_render(d){var e,n,o,c,p;const m=this._idleTriggered?this._fadeDuration:0,_=((e=this.style.projection)===null||e===void 0?void 0:e.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(d),this._removed)return;let x=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const E=this.transform.zoom,I=ne();this.style.zoomHistory.update(E,I);const D=new h.H(E,{now:I,fadeDuration:m,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),L=D.crossFadingFactor();L===1&&L===this._crossFadingFactor||(x=!0,this._crossFadingFactor=L),this.style.update(D)}const b=((n=this.style.projection)===null||n===void 0?void 0:n.transitionState)>0!==_;(o=this.style.projection)===null||o===void 0||o.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((c=this.style.projection)===null||c===void 0?void 0:c.transitionState,(p=this.style.projection)===null||p===void 0?void 0:p.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||b)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.tileManager.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,m,this._crossSourceCollisions,b),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:m,showPadding:this.showPadding}),this.fire(new h.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,h.cF.mark(h.cG.load),this.fire(new h.l("load"))),this.style&&(this.style.hasTransitions()||x)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const T=this._sourcesDirty||this._styleDirty||this._placementDirty;return T||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new h.l("idle")),!this._loaded||this._fullyLoaded||T||(this._fullyLoaded=!0,h.cF.mark(h.cG.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var d;this._hash&&this._hash.remove();for(const n of this._controls)n.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),Ci.removeThrottleControl(this._imageQueueHandle),(d=this._resizeObserver)===null||d===void 0||d.disconnect();const e=this.painter.context.gl.getExtension("WEBGL_lose_context");e?.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),dt.remove(this._canvasContainer),dt.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),h.cF.clearMetrics(),this._removed=!0,this.fire(new h.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,Qe.frame(this._frameRequest,d=>{h.cF.frame(d),this._frameRequest=null;try{this._render(d)}catch(e){if(!h.cH(e)&&!function(n){return n.message===ja}(e))throw e}},()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(d){this._showTileBoundaries!==d&&(this._showTileBoundaries=d,this._update())}get showPadding(){return!!this._showPadding}set showPadding(d){this._showPadding!==d&&(this._showPadding=d,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(d){this._showCollisionBoxes!==d&&(this._showCollisionBoxes=d,d?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(d){this._showOverdrawInspector!==d&&(this._showOverdrawInspector=d,this._update())}get repaint(){return!!this._repaint}set repaint(d){this._repaint!==d&&(this._repaint=d,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(d){this._vertices=d,this._update()}get version(){return aa}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(d){return this._lazyInitEmptyStyle(),this.style.setProjection(d),this._update(!0)}},A.MapMouseEvent=Fe,A.MapTouchEvent=Ys,A.MapWheelEvent=An,A.Marker=ca,A.NavigationControl=class{constructor(d){this._updateZoomButtons=()=>{const e=this._map.getZoom(),n=e===this._map.getMaxZoom(),o=e===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=o,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",o.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(e,n)=>{const o=this._map._getUIString(`NavigationControl.${n}`);e.title=o,e.setAttribute("aria-label",o)},this.options=h.e({},xl,d),this._container=dt.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})),dt.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})),dt.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=dt.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(d){return this._map=d,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.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new vl(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){dt.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.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(d,e){const n=dt.create("button",d,this._container);return n.type="button",n.addEventListener("click",e),n}},A.Popup=class extends h.E{constructor(d){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:"")},this.remove=()=>(this._content&&dt.remove(this._content),this._container&&(dt.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.l("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=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=dt.create("div","maplibregl-popup",this._map.getContainer()),this._tip=dt.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const m of this.options.className.split(" "))this._container.classList.add(m);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=gs(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!e)return;const n=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.locationToScreenPoint(this._lngLat));let o=this.options.anchor;const c=ro(this.options.offset);if(!o){const m=this._container.offsetWidth,_=this._container.offsetHeight;let x;x=n.y+c.bottom.y<_?["top"]:n.y>this._map.transform.height-_?["bottom"]:[],n.x<m/2?x.push("left"):n.x>this._map.transform.width-m/2&&x.push("right"),o=x.length===0?"bottom":x.join("-")}let p=n.add(c[o]);this.options.subpixelPositioning||(p=p.round()),dt.setTransform(this._container,`${la[o]} translate(${p.x}px,${p.y}px)`),to(this._container,o,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=h.e(Object.create(io),d)}addTo(d){return this._map&&this.remove(),this._map=d,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.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(d){return this._lngLat=h.V.convert(d),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(d){return this.setDOMContent(document.createTextNode(d))}setHTML(d){const e=document.createDocumentFragment(),n=document.createElement("body");let o;for(n.innerHTML=d;o=n.firstChild,o;)e.appendChild(o);return this.setDOMContent(e)}getMaxWidth(){var d;return(d=this._container)===null||d===void 0?void 0:d.style.maxWidth}setMaxWidth(d){return this.options.maxWidth=d,this._update(),this}setDOMContent(d){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=dt.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(d),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(d){return this._container&&this._container.classList.add(d),this}removeClassName(d){return this._container&&this._container.classList.remove(d),this}setOffset(d){return this.options.offset=d,this._update(),this}toggleClassName(d){if(this._container)return this._container.classList.toggle(d)}setSubpixelPositioning(d){this.options.subpixelPositioning=d}_createCloseButton(){this.options.closeButton&&(this._closeButton=dt.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const d=this._container.querySelector(Tl);d&&d.focus()}},A.RasterDEMTileSource=Wr,A.RasterTileSource=qn,A.ScaleControl=class{constructor(d){this._onMove=()=>{eo(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,eo(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},wl),d)}getDefaultPosition(){return"bottom-left"}onAdd(d){return this._map=d,this._container=dt.create("div","maplibregl-ctrl maplibregl-ctrl-scale",d.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){dt.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},A.ScrollZoomHandler=ea,A.Style=Fs,A.TerrainControl=class{constructor(d){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=d}onAdd(d){return this._map=d,this._container=dt.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=dt.create("button","maplibregl-ctrl-terrain",this._container),dt.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(){dt.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},A.TwoFingersTouchPitchHandler=ml,A.TwoFingersTouchRotateHandler=pl,A.TwoFingersTouchZoomHandler=jc,A.TwoFingersTouchZoomRotateHandler=$c,A.VectorTileSource=fr,A.VideoSource=Cs,A.addSourceType=(d,e)=>h._(void 0,void 0,void 0,function*(){if(Wn(d))throw new Error(`A source type called "${d}" already exists.`);((n,o)=>{_n[n]=o})(d,e)}),A.clearPrewarmedResources=function(){const d=Qi;d&&(d.isPreloaded()&&d.numActive()===1?(d.release(Zr),Qi=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()"))},A.createTileMesh=Pa,A.getMaxParallelImageRequests=function(){return h.a.MAX_PARALLEL_IMAGE_REQUESTS},A.getRTLTextPluginStatus=function(){return er().getRTLTextPluginStatus()},A.getVersion=function(){return no},A.getWorkerCount=function(){return $r.workerCount},A.getWorkerUrl=function(){return h.a.WORKER_URL},A.importScriptInWorkers=function(d){return mn().broadcast("IS",d)},A.isTimeFrozen=function(){return jr.isFrozen()},A.now=ne,A.prewarm=function(){$n().acquire(Zr)},A.restoreNow=function(){jr.restoreNow()},A.setMaxParallelImageRequests=function(d){h.a.MAX_PARALLEL_IMAGE_REQUESTS=d},A.setNow=function(d){jr.setNow(d)},A.setRTLTextPlugin=function(d,e){return er().setRTLTextPlugin(d,e)},A.setWorkerCount=function(d){$r.workerCount=d},A.setWorkerUrl=function(d){h.a.WORKER_URL=d}});var ee=Gt;return ee})})(Qp);var ef=Qp.exports;const Pg=Sg(ef);function Mo(kt,Ft){return Array.from(kt.getElementsByTagName(Ft))}function Io(kt){return kt?.normalize(),kt?.textContent||""}function xa(kt,Ft,Gt){const Bt=kt.getElementsByTagName(Ft);return Bt.length?Bt[0]:null}function Mg(kt,Ft,Gt){const Bt={};if(!kt)return Bt;const Ut=kt.getElementsByTagName(Ft),ee=Ut.length?Ut[0]:null;return ee&&Gt?Gt(ee,Bt):Bt}function rf(kt,Ft,Gt){const Bt=Io(xa(kt,Ft));return Bt&&Gt?Gt(Bt)||{}:{}}function Kp(kt,Ft,Gt){const Bt=Number.parseFloat(Io(xa(kt,Ft)));if(!Number.isNaN(Bt))return Bt&&Gt?Gt(Bt)||{}:{}}function Ig(kt,Ft,Gt){const Bt=Number.parseFloat(Io(xa(kt,Ft)));if(!Number.isNaN(Bt))return Gt&&Gt(Bt),Bt}function Wh(kt,Ft){const Gt={};for(const Bt of Ft)rf(kt,Bt,Ut=>{Gt[Bt]=Ut});return Gt}function Eg(kt){return kt?.nodeType===1}function nf(kt){let Ft=[];if(kt===null)return Ft;for(const Gt of Array.from(kt.childNodes)){if(!Eg(Gt))continue;const Bt=Cg(Gt.nodeName);if(Bt==="gpxtpx:TrackPointExtension")Ft=Ft.concat(nf(Gt));else{const Ut=Io(Gt);Ft.push([Bt,Ag(Ut)])}}return Ft}function Cg(kt){return["heart","gpxtpx:hr","hr"].includes(kt)?"heart":kt}function Ag(kt){const Ft=Number.parseFloat(kt);return Number.isNaN(Ft)?kt:Ft}function sf(kt){const Ft=[Number.parseFloat(kt.getAttribute("lon")||""),Number.parseFloat(kt.getAttribute("lat")||"")];if(Number.isNaN(Ft[0])||Number.isNaN(Ft[1]))return null;Ig(kt,"ele",Bt=>{Ft.push(Bt)});const Gt=xa(kt,"time");return{coordinates:Ft,time:Gt?Io(Gt):null,extendedValues:nf(xa(kt,"extensions"))}}function af(kt){return Mg(kt,"line",Ft=>Object.assign({},rf(Ft,"color",Bt=>({stroke:`#${Bt}`})),Kp(Ft,"opacity",Bt=>({"stroke-opacity":Bt})),Kp(Ft,"width",Bt=>({"stroke-width":Bt*96/25.4}))))}function Hh(kt,Ft){const Gt=Wh(Ft,["name","cmt","desc","type","time","keywords"]);for(const[Ut,ee]of kt)for(const A of Array.from(Ft.getElementsByTagNameNS(ee,"*")))Gt[A.tagName.replace(":","_")]=Io(A)?.trim();const Bt=Mo(Ft,"link");return Bt.length&&(Gt.links=Bt.map(Ut=>Object.assign({href:Ut.getAttribute("href")},Wh(Ut,["text","type"])))),Gt}function of(kt,Ft){const Gt=Mo(kt,Ft),Bt=[],Ut=[],ee={};for(let A=0;A<Gt.length;A++){const h=sf(Gt[A]);if(h){Bt.push(h.coordinates),h.time&&Ut.push(h.time);for(const[Pt,ke]of h.extendedValues){const Ve=Pt==="heart"?Pt:`${Pt.replace("gpxtpx:","")}s`;ee[Ve]||(ee[Ve]=Array(Gt.length).fill(null)),ee[Ve][A]=ke}}}if(!(Bt.length<2))return{line:Bt,times:Ut,extendedValues:ee}}function Dg(kt,Ft){const Gt=of(Ft,"rtept");if(Gt)return{type:"Feature",properties:Object.assign({_gpxType:"rte"},Hh(kt,Ft),af(xa(Ft,"extensions"))),geometry:{type:"LineString",coordinates:Gt.line}}}function zg(kt,Ft){const Gt=Mo(Ft,"trkseg"),Bt=[],Ut=[],ee=[];for(const Pt of Gt){const ke=of(Pt,"trkpt");ke&&(ee.push(ke),ke.times?.length&&Ut.push(ke.times))}if(ee.length===0)return null;const A=ee.length>1,h=Object.assign({_gpxType:"trk"},Hh(kt,Ft),af(xa(Ft,"extensions")),Ut.length?{coordinateProperties:{times:A?Ut:Ut[0]}}:{});for(let Pt=0;Pt<ee.length;Pt++){const ke=ee[Pt];Bt.push(ke.line),h.coordinateProperties||(h.coordinateProperties={});const Ve=h.coordinateProperties;for(const[Ki,Nr]of Object.entries(ke.extendedValues))A?(Ve[Ki]||(Ve[Ki]=ee.map(Qe=>new Array(Qe.line.length).fill(null))),Ve[Ki][Pt]=Nr):Ve[Ki]=Nr}return{type:"Feature",properties:h,geometry:A?{type:"MultiLineString",coordinates:Bt}:{type:"LineString",coordinates:Bt[0]}}}function kg(kt,Ft){const Gt=Object.assign(Hh(kt,Ft),Wh(Ft,["sym"])),Bt=sf(Ft);return Bt?{type:"Feature",properties:Gt,geometry:{type:"Point",coordinates:Bt.coordinates}}:null}function*Rg(kt){const Ft=kt,Gt="gpxx",Bt="http://www.garmin.com/xmlschemas/GpxExtensions/v3",Ut=[[Gt,Bt]],ee=Ft.getElementsByTagName("gpx")[0]?.attributes;if(ee)for(const A of Array.from(ee))A.name?.startsWith("xmlns:")&&A.value!==Bt&&Ut.push([A.name,A.value]);for(const A of Mo(Ft,"trk")){const h=zg(Ut,A);h&&(yield h)}for(const A of Mo(Ft,"rte")){const h=Dg(Ut,A);h&&(yield h)}for(const A of Mo(Ft,"wpt")){const h=kg(Ut,A);h&&(yield h)}}function Lg(kt){return{type:"FeatureCollection",features:Array.from(Rg(kt))}}var Jp;(function(kt){kt.ABSOLUTE="absolute",kt.RELATIVE_TO_GROUND="relativeToGround",kt.CLAMP_TO_GROUND="clampToGround",kt.CLAMP_TO_SEAFLOOR="clampToSeaFloor",kt.RELATIVE_TO_SEAFLOOR="relativeToSeaFloor"})(Jp||(Jp={}));function Fg(kt){const Ft=new ef.LngLatBounds;function Gt(Ut,ee){if(ee===0)Ft.extend(Ut);else if(ee===1)for(const A of Ut)Ft.extend(A);else for(const A of Ut)Gt(A,ee-1)}function Bt(Ut){switch(Ut.type){case"Point":Gt(Ut.coordinates,0);break;case"LineString":case"MultiPoint":Gt(Ut.coordinates,1);break;case"Polygon":case"MultiLineString":Gt(Ut.coordinates,2);break;case"MultiPolygon":for(const ee of Ut.coordinates)Gt(ee,2);break}}for(const Ut of kt.features)Ut.geometry&&Bt(Ut.geometry);return Ft}async function Bg(){const kt=atob(globalThis.fileBase64),Gt=new DOMParser().parseFromString(kt,"text/xml"),Bt=Lg(Gt);if(!document.getElementById("map"))throw new Error("Map container not found");const ee=1280,A=960,h=new Pg.Map({container:"map",style:{version:8,sources:{osm:{type:"raster",tiles:["https://a.tile.openstreetmap.org/{z}/{x}/{y}.png","https://b.tile.openstreetmap.org/{z}/{x}/{y}.png","https://c.tile.openstreetmap.org/{z}/{x}/{y}.png"],tileSize:256,attribution:'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'}},layers:[{id:"osm",type:"raster",source:"osm"}]},center:[0,0],zoom:1});await new Promise(ke=>{h.loaded()?ke():h.on("load",()=>ke())}),h.addSource("gpx-data",{type:"geojson",data:Bt}),h.addLayer({id:"tracks",type:"line",source:"gpx-data",filter:["==","$type","LineString"],paint:{"line-color":"#FF4500","line-width":4}}),h.addLayer({id:"waypoints",type:"circle",source:"gpx-data",filter:["==","$type","Point"],paint:{"circle-radius":8,"circle-color":"#FF0000","circle-stroke-width":2,"circle-stroke-color":"#FFFFFF"}});const Pt=Fg(Bt);return Pt.isEmpty()||h.fitBounds(Pt,{padding:50,maxZoom:15}),await new Promise(ke=>setTimeout(ke,1500)),{width:ee,height:A,pageCount:1,pageNumber:1,scale:1}}window.renderComplete=Bg();</script>
  <style rel="stylesheet" crossorigin>.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}@media (hover:hover){.maplibregl-ctrl button:not(:disabled):hover{background-color:#0000000d}}.maplibregl-ctrl button:not(:disabled):active{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-globe .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='none' stroke='%23333' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='8.5'/%3E%3Cpath d='M17.5 11c0 4.819-3.02 8.5-6.5 8.5S4.5 15.819 4.5 11 7.52 2.5 11 2.5s6.5 3.681 6.5 8.5Z'/%3E%3Cpath d='M13.5 11c0 2.447-.331 4.64-.853 6.206-.262.785-.562 1.384-.872 1.777-.314.399-.58.517-.775.517s-.461-.118-.775-.517c-.31-.393-.61-.992-.872-1.777C8.831 15.64 8.5 13.446 8.5 11s.331-4.64.853-6.206c.262-.785.562-1.384.872-1.777.314-.399.58-.517.775-.517s.461.118.775.517c.31.393.61.992.872 1.777.522 1.565.853 3.76.853 6.206Z'/%3E%3Cpath d='M11 7.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138q.07-.058.224-.138c.299-.151.763-.302 1.379-.434C7.378 5.666 9.091 5.5 11 5.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138q-.07.058-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428ZM4.486 6.436ZM11 16.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138 1.3 1.3 0 0 1 .224-.138c.299-.151.763-.302 1.379-.434C7.378 14.666 9.091 14.5 11 14.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138a1.3 1.3 0 0 1-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm-6.514-1.064ZM11 12.5c-2.46 0-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.5 1.5 0 0 1-.39-.272.3.3 0 0 1-.047-.064.3.3 0 0 1 .048-.064c.066-.073.189-.167.389-.272.399-.21 1.009-.413 1.805-.59C6.328 9.722 8.54 9.5 11 9.5s4.672.222 6.256.574c.795.177 1.405.38 1.804.59.2.105.323.2.39.272a.3.3 0 0 1 .047.064.3.3 0 0 1-.048.064 1.4 1.4 0 0 1-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002zm0 .018v.002zm17.002.002v-.002zm0-.018v-.002z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-globe-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='none' stroke='%2333b5e5' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='8.5'/%3E%3Cpath d='M17.5 11c0 4.819-3.02 8.5-6.5 8.5S4.5 15.819 4.5 11 7.52 2.5 11 2.5s6.5 3.681 6.5 8.5Z'/%3E%3Cpath d='M13.5 11c0 2.447-.331 4.64-.853 6.206-.262.785-.562 1.384-.872 1.777-.314.399-.58.517-.775.517s-.461-.118-.775-.517c-.31-.393-.61-.992-.872-1.777C8.831 15.64 8.5 13.446 8.5 11s.331-4.64.853-6.206c.262-.785.562-1.384.872-1.777.314-.399.58-.517.775-.517s.461.118.775.517c.31.393.61.992.872 1.777.522 1.565.853 3.76.853 6.206Z'/%3E%3Cpath d='M11 7.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138q.07-.058.224-.138c.299-.151.763-.302 1.379-.434C7.378 5.666 9.091 5.5 11 5.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138q-.07.058-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428ZM4.486 6.436ZM11 16.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138 1.3 1.3 0 0 1 .224-.138c.299-.151.763-.302 1.379-.434C7.378 14.666 9.091 14.5 11 14.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138a1.3 1.3 0 0 1-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm-6.514-1.064ZM11 12.5c-2.46 0-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.5 1.5 0 0 1-.39-.272.3.3 0 0 1-.047-.064.3.3 0 0 1 .048-.064c.066-.073.189-.167.389-.272.399-.21 1.009-.413 1.805-.59C6.328 9.722 8.54 9.5 11 9.5s4.672.222 6.256.574c.795.177 1.405.38 1.804.59.2.105.323.2.39.272a.3.3 0 0 1 .047.064.3.3 0 0 1-.048.064 1.4 1.4 0 0 1-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002zm0 .018v.002zm17.002.002v-.002zm0-.018v-.002z'/%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;white-space:nowrap}.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;inset: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),(pointer:coarse){.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}</style>
</head>
<body>
  <div id="map"></div>
</body>
</html>
