@maptiler/sdk 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/maptiler-sdk.d.ts +21 -3
- package/dist/maptiler-sdk.min.mjs +2 -2
- package/dist/maptiler-sdk.mjs +27 -4
- package/dist/maptiler-sdk.mjs.map +1 -1
- package/dist/maptiler-sdk.umd.js +744 -39
- package/dist/maptiler-sdk.umd.js.map +1 -1
- package/dist/maptiler-sdk.umd.min.js +42 -42
- package/package.json +3 -3
- package/readme.md +195 -5
- package/src/Map.ts +27 -3
- package/src/index.ts +88 -129
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(De,Hs){typeof exports=="object"&&typeof module<"u"?Hs(exports):typeof define=="function"&&define.amd?define(["exports"],Hs):(De=typeof globalThis<"u"?globalThis:De||self,Hs(De.maptilersdk={}))})(this,function(De){"use strict";var Hs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function uu(v){return v&&v.__esModule&&Object.prototype.hasOwnProperty.call(v,"default")?v.default:v}var pu={exports:{}};(function(v,m){(function(w,P){v.exports=P()})(Hs,function(){var w,P,B;function X(l,he){if(!w)w=he;else if(!P)P=he;else{var H="var sharedChunk = {}; ("+w+")(sharedChunk); ("+P+")(sharedChunk);",Ae={};w(Ae),B=he(Ae),typeof window<"u"&&(B.workerUrl=window.URL.createObjectURL(new Blob([H],{type:"text/javascript"})))}}X(["exports"],function(l){function he(i,e,r,a){return new(r||(r=Promise))(function(o,u){function d(b){try{_(a.next(b))}catch(T){u(T)}}function f(b){try{_(a.throw(b))}catch(T){u(T)}}function _(b){var T;b.done?o(b.value):(T=b.value,T instanceof r?T:new r(function(C){C(T)})).then(d,f)}_((a=a.apply(i,e||[])).next())})}function H(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}typeof SuppressedError=="function"&&SuppressedError;var Ae=ke;function ke(i,e){this.x=i,this.y=e}ke.prototype={clone:function(){return new ke(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,r=i.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),r=Math.sin(i),a=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=a,this},_rotateAround:function(i,e){var r=Math.cos(i),a=Math.sin(i),o=e.y+a*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-a*(this.y-e.y),this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},ke.convert=function(i){return i instanceof ke?i:Array.isArray(i)?new ke(i[0],i[1]):i};var ye=H(Ae),ct=dt;function dt(i,e,r,a){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(a-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=a}dt.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,a=0;a<8;a++){var o=this.sampleCurveX(r)-i;if(Math.abs(o)<e)return r;var u=this.sampleCurveDerivativeX(r);if(Math.abs(u)<1e-6)break;r-=o/u}var d=0,f=1;for(r=i,a=0;a<20&&(o=this.sampleCurveX(r),!(Math.abs(o-i)<e));a++)i>o?d=r:f=r,r=.5*(f-d)+d;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var et=H(ct);let Tt,it;function It(){return Tt==null&&(Tt=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Tt}function qt(){if(it==null&&(it=!1,It())){const e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let a=0;a<5*5;a++){const o=4*a;e.fillStyle=`rgb(${o},${o+1},${o+2})`,e.fillRect(a%5,Math.floor(a/5),1,1)}const r=e.getImageData(0,0,5,5).data;for(let a=0;a<5*5*4;a++)if(a%4!=3&&r[a]!==a){it=!0;break}}}return it||!1}function Jt(i,e,r,a){const o=new et(i,e,r,a);return function(u){return o.solve(u)}}const Lt=Jt(.25,.1,.25,1);function ht(i,e,r){return Math.min(r,Math.max(e,i))}function bt(i,e,r){const a=r-e,o=((i-e)%a+a)%a+e;return o===e?r:o}function Ke(i,...e){for(const r of e)for(const a in r)i[a]=r[a];return i}let _t=1;function qe(i,e,r){const a={};for(const o in i)a[o]=e.call(r||this,i[o],o,i);return a}function jt(i,e,r){const a={};for(const o in i)e.call(r||this,i[o],o,i)&&(a[o]=i[o]);return a}function Qe(i){return Array.isArray(i)?i.map(Qe):typeof i=="object"&&i?qe(i,Qe):i}const ot={};function rt(i){ot[i]||(typeof console<"u"&&console.warn(i),ot[i]=!0)}function gt(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function Rt(i){let e=0;for(let r,a,o=0,u=i.length,d=u-1;o<u;d=o++)r=i[o],a=i[d],e+=(a.x-r.x)*(r.y+a.y);return e}function Ot(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}let ai=null;function Pi(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const vr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function gi(i,e,r,a,o){return he(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const u=new VideoFrame(i,{timestamp:0});try{const d=u?.format;if(!d||!d.startsWith("BGR")&&!d.startsWith("RGB"))throw new Error(`Unrecognized format ${d}`);const f=d.startsWith("BGR"),_=new Uint8ClampedArray(a*o*4);if(yield u.copyTo(_,function(b,T,C,k,z){const D=4*Math.max(-T,0),O=(Math.max(0,C)-C)*k*4+D,G=4*k,W=Math.max(0,T),ie=Math.max(0,C);return{rect:{x:W,y:ie,width:Math.min(b.width,T+k)-W,height:Math.min(b.height,C+z)-ie},layout:[{offset:O,stride:G}]}}(i,e,r,a,o)),f)for(let b=0;b<_.length;b+=4){const T=_[b];_[b]=_[b+2],_[b+2]=T}return _}finally{u.close()}})}let Bi,zt,Ei,$r;const en={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(i){const e=requestAnimationFrame(i);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(i,e=0){return this.getImageCanvasContext(i).getImageData(-e,-e,i.width+2*e,i.height+2*e)},getImageCanvasContext(i){const e=window.document.createElement("canvas"),r=e.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("failed to create canvas 2d context");return e.width=i.width,e.height=i.height,r.drawImage(i,0,0,i.width,i.height),r},resolveURL:i=>(Ei||(Ei=document.createElement("a")),Ei.href=i,Ei.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&($r==null&&($r=matchMedia("(prefers-reduced-motion: reduce)")),$r.matches)}},ra={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};class _n extends Error{constructor(e,r,a,o){super(`AJAXError: ${r} (${e}): ${a}`),this.status=e,this.statusText=r,this.url=a,this.body=o}}const zr=Ot()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,xr=i=>ra.REGISTERED_PROTOCOLS[i.substring(0,i.indexOf("://"))];function za(i,e){const r=new AbortController,a=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,cache:i.cache,referrer:zr(),signal:r.signal});let o=!1,u=!1;return i.type==="json"&&a.headers.set("Accept","application/json"),u||fetch(a).then(d=>d.ok?(f=>{(i.type==="arrayBuffer"||i.type==="image"?f.arrayBuffer():i.type==="json"?f.json():f.text()).then(_=>{u||(o=!0,e(null,_,f.headers.get("Cache-Control"),f.headers.get("Expires")))}).catch(_=>{u||e(new Error(_.message))})})(d):d.blob().then(f=>e(new _n(d.status,d.statusText,i.url,f)))).catch(d=>{d.code!==20&&e(new Error(d.message))}),{cancel:()=>{u=!0,o||r.abort()}}}const vn=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(Ot()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!Ot())return(xr(i.url)||za)(i,e)}if(!(/^file:/.test(r=i.url)||/^file:/.test(zr())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return za(i,e);if(Ot()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e,void 0,!0)}var r;return function(a,o){const u=new XMLHttpRequest;u.open(a.method||"GET",a.url,!0),a.type!=="arrayBuffer"&&a.type!=="image"||(u.responseType="arraybuffer");for(const d in a.headers)u.setRequestHeader(d,a.headers[d]);return a.type==="json"&&(u.responseType="text",u.setRequestHeader("Accept","application/json")),u.withCredentials=a.credentials==="include",u.onerror=()=>{o(new Error(u.statusText))},u.onload=()=>{if((u.status>=200&&u.status<300||u.status===0)&&u.response!==null){let d=u.response;if(a.type==="json")try{d=JSON.parse(u.response)}catch(f){return o(f)}o(null,d,u.getResponseHeader("Cache-Control"),u.getResponseHeader("Expires"))}else{const d=new Blob([u.response],{type:u.getResponseHeader("Content-Type")});o(new _n(u.status,u.statusText,a.url,d))}},u.send(a.body),{cancel:()=>u.abort()}}(i,e)},Da=function(i,e){return vn(Ke(i,{type:"arrayBuffer"}),e)};function tn(i){if(!i||i.indexOf("://")<=0||i.indexOf("data:image/")===0||i.indexOf("blob:")===0)return!0;const e=new URL(i),r=window.location;return e.protocol===r.protocol&&e.host===r.host}function na(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function Dn(i,e,r){if(r&&r[i]){const a=r[i].indexOf(e);a!==-1&&r[i].splice(a,1)}}class xn{constructor(e,r={}){Ke(this,r),this.type=e}}class bn extends xn{constructor(e,r={}){super("error",Ke({error:e},r))}}class Rn{on(e,r){return this._listeners=this._listeners||{},na(e,r,this._listeners),this}off(e,r){return Dn(e,r,this._listeners),Dn(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},na(e,r,this._oneTimeListeners),this):new Promise(a=>this.once(e,a))}fire(e,r){typeof e=="string"&&(e=new xn(e,r||{}));const a=e.type;if(this.listens(a)){e.target=this;const o=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(const f of o)f.call(this,e);const u=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(const f of u)Dn(a,f,this._oneTimeListeners),f.call(this,e);const d=this._eventedParent;d&&(Ke(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(e))}else e instanceof bn&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}}var ue={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const Ji=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function br(i,e){const r={};for(const a in i)a!=="ref"&&(r[a]=i[a]);return Ji.forEach(a=>{a in e&&(r[a]=e[a])}),r}function Gt(i,e){if(Array.isArray(i)){if(!Array.isArray(e)||i.length!==e.length)return!1;for(let r=0;r<i.length;r++)if(!Gt(i[r],e[r]))return!1;return!0}if(typeof i=="object"&&i!==null&&e!==null){if(typeof e!="object"||Object.keys(i).length!==Object.keys(e).length)return!1;for(const r in i)if(!Gt(i[r],e[r]))return!1;return!0}return i===e}const At={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function jr(i,e,r){r.push({command:At.addSource,args:[i,e[i]]})}function aa(i,e,r){e.push({command:At.removeSource,args:[i]}),r[i]=!0}function rn(i,e,r,a){aa(i,r,a),jr(i,e,r)}function os(i,e,r){let a;for(a in i[r])if(Object.prototype.hasOwnProperty.call(i[r],a)&&a!=="data"&&!Gt(i[r][a],e[r][a]))return!1;for(a in e[r])if(Object.prototype.hasOwnProperty.call(e[r],a)&&a!=="data"&&!Gt(i[r][a],e[r][a]))return!1;return!0}function sa(i,e,r,a,o,u){let d;for(d in e=e||{},i=i||{})Object.prototype.hasOwnProperty.call(i,d)&&(Gt(i[d],e[d])||r.push({command:u,args:[a,d,e[d],o]}));for(d in e)Object.prototype.hasOwnProperty.call(e,d)&&!Object.prototype.hasOwnProperty.call(i,d)&&(Gt(i[d],e[d])||r.push({command:u,args:[a,d,e[d],o]}))}function wn(i){return i.id}function Bn(i,e){return i[e.id]=e,i}class Se{constructor(e,r,a,o){this.message=(e?`${e}: `:"")+a,o&&(this.identifier=o),r!=null&&r.__line__&&(this.line=r.__line__)}}function Gr(i,...e){for(const r of e)for(const a in r)i[a]=r[a];return i}class si extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}class Fn{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[a,o]of r)this.bindings[a]=o}concat(e){return new Fn(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const nn={kind:"null"},Ie={kind:"number"},st={kind:"string"},Ye={kind:"boolean"},qi={kind:"color"},qr={kind:"object"},tt={kind:"value"},an={kind:"collator"},V={kind:"formatted"},E={kind:"padding"},M={kind:"resolvedImage"},R={kind:"variableAnchorOffsetCollection"};function j(i,e){return{kind:"array",itemType:i,N:e}}function q(i){if(i.kind==="array"){const e=q(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const re=[nn,Ie,st,Ye,qi,V,qr,j(tt),E,M,R];function J(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!J(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const r of re)if(!J(r,e))return null}}return`Expected ${q(i)} but found ${q(e)} instead.`}function K(i,e){return e.some(r=>r.kind===i.kind)}function te(i,e){return e.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}function pe(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const de=.96422,ge=.82521,$e=4/29,Xe=6/29,Be=3*Xe*Xe,Ge=Xe*Xe*Xe,Je=Math.PI/180,Dt=180/Math.PI;function Nt(i){return(i%=360)<0&&(i+=360),i}function St([i,e,r,a]){let o,u;const d=Fi((.2225045*(i=wt(i))+.7168786*(e=wt(e))+.0606169*(r=wt(r)))/1);i===e&&e===r?o=u=d:(o=Fi((.4360747*i+.3850649*e+.1430804*r)/de),u=Fi((.0139322*i+.0971045*e+.7141733*r)/ge));const f=116*d-16;return[f<0?0:f,500*(o-d),200*(d-u),a]}function wt(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Fi(i){return i>Ge?Math.pow(i,1/3):i/Be+$e}function Zt([i,e,r,a]){let o=(i+16)/116,u=isNaN(e)?o:o+e/500,d=isNaN(r)?o:o-r/200;return o=1*ki(o),u=de*ki(u),d=ge*ki(d),[yi(3.1338561*u-1.6168667*o-.4906146*d),yi(-.9787684*u+1.9161415*o+.033454*d),yi(.0719453*u-.2289914*o+1.4052427*d),a]}function yi(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function ki(i){return i>Xe?i*i*i:Be*(i-$e)}function wr(i){return parseInt(i.padEnd(2,i),16)/255}function Sl(i,e){return oa(e?i/100:i,0,1)}function oa(i,e,r){return Math.min(Math.max(e,i),r)}function la(i){return!i.some(Number.isNaN)}const nh={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class Bt{constructor(e,r,a,o=1,u=!0){this.r=e,this.g=r,this.b=a,this.a=o,u||(this.r*=o,this.g*=o,this.b*=o,o||this.overwriteGetter("rgb",[e,r,a,o]))}static parse(e){if(e instanceof Bt)return e;if(typeof e!="string")return;const r=function(a){if((a=a.toLowerCase().trim())==="transparent")return[0,0,0,0];const o=nh[a];if(o){const[d,f,_]=o;return[d/255,f/255,_/255,1]}if(a.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(a)){const d=a.length<6?1:2;let f=1;return[wr(a.slice(f,f+=d)),wr(a.slice(f,f+=d)),wr(a.slice(f,f+=d)),wr(a.slice(f,f+d)||"ff")]}if(a.startsWith("rgb")){const d=a.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){const[f,_,b,T,C,k,z,D,O,G,W,ie]=d,Y=[T||" ",z||" ",G].join("");if(Y===" "||Y===" /"||Y===",,"||Y===",,,"){const ne=[b,k,O].join(""),oe=ne==="%%%"?100:ne===""?255:0;if(oe){const fe=[oa(+_/oe,0,1),oa(+C/oe,0,1),oa(+D/oe,0,1),W?Sl(+W,ie):1];if(la(fe))return fe}}return}}const u=a.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(u){const[d,f,_,b,T,C,k,z,D]=u,O=[_||" ",T||" ",k].join("");if(O===" "||O===" /"||O===",,"||O===",,,"){const G=[+f,oa(+b,0,100),oa(+C,0,100),z?Sl(+z,D):1];if(la(G))return function([W,ie,Y,ne]){function oe(fe){const Le=(fe+W/30)%12,Oe=ie*Math.min(Y,1-Y);return Y-Oe*Math.max(-1,Math.min(Le-3,9-Le,1))}return W=Nt(W),ie/=100,Y/=100,[oe(0),oe(8),oe(4),ne]}(G)}}}(e);return r?new Bt(...r,!1):void 0}get rgb(){const{r:e,g:r,b:a,a:o}=this,u=o||1/0;return this.overwriteGetter("rgb",[e/u,r/u,a/u,o])}get hcl(){return this.overwriteGetter("hcl",function(e){const[r,a,o,u]=St(e),d=Math.sqrt(a*a+o*o);return[Math.round(1e4*d)?Nt(Math.atan2(o,a)*Dt):NaN,d,r,u]}(this.rgb))}get lab(){return this.overwriteGetter("lab",St(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){const[e,r,a,o]=this.rgb;return`rgba(${[e,r,a].map(u=>Math.round(255*u)).join(",")},${o})`}}Bt.black=new Bt(0,0,0,1),Bt.white=new Bt(1,1,1,1),Bt.transparent=new Bt(0,0,0,0),Bt.red=new Bt(1,0,0,1);class Js{constructor(e,r,a){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=a,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class ls{constructor(e,r,a,o,u){this.text=e,this.image=r,this.scale=a,this.fontStack=o,this.textColor=u}}class Oi{constructor(e){this.sections=e}static fromString(e){return new Oi([new ls(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof Oi?e:Oi.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class or{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof or)return e;if(typeof e=="number")return new or([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new or(e)}}toString(){return JSON.stringify(this.values)}}const ah=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Sr{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Sr)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let r=0;r<e.length;r+=2){const a=e[r],o=e[r+1];if(typeof a!="string"||!ah.has(a)||!Array.isArray(o)||o.length!==2||typeof o[0]!="number"||typeof o[1]!="number")return}return new Sr(e)}}toString(){return JSON.stringify(this.values)}}class Mi{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Mi({name:e,available:!1}):null}}function cs(i,e,r,a){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?a===void 0||typeof a=="number"&&a>=0&&a<=1?null:`Invalid rgba value [${[i,e,r,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof a=="number"?[i,e,r,a]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ca(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof Bt||i instanceof Js||i instanceof Oi||i instanceof or||i instanceof Sr||i instanceof Mi)return!0;if(Array.isArray(i)){for(const e of i)if(!ca(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!ca(i[e]))return!1;return!0}return!1}function ti(i){if(i===null)return nn;if(typeof i=="string")return st;if(typeof i=="boolean")return Ye;if(typeof i=="number")return Ie;if(i instanceof Bt)return qi;if(i instanceof Js)return an;if(i instanceof Oi)return V;if(i instanceof or)return E;if(i instanceof Sr)return R;if(i instanceof Mi)return M;if(Array.isArray(i)){const e=i.length;let r;for(const a of i){const o=ti(a);if(r){if(r===o)continue;r=tt;break}r=o}return j(r||tt,e)}return qr}function Et(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof Bt||i instanceof Oi||i instanceof or||i instanceof Sr||i instanceof Mi?i.toString():JSON.stringify(i)}class On{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ca(e[1]))return r.error("invalid value");const a=e[1];let o=ti(a);const u=r.expectedType;return o.kind!=="array"||o.N!==0||!u||u.kind!=="array"||typeof u.N=="number"&&u.N!==0||(o=u),new On(o,a)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class oi{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const hs={string:st,number:Ie,boolean:Ye,object:qr};class Tr{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let a,o=1;const u=e[0];if(u==="array"){let f,_;if(e.length>2){const b=e[1];if(typeof b!="string"||!(b in hs)||b==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);f=hs[b],o++}else f=tt;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);_=e[2],o++}a=j(f,_)}else{if(!hs[u])throw new Error(`Types doesn't contain name = ${u}`);a=hs[u]}const d=[];for(;o<e.length;o++){const f=r.parse(e[o],o,tt);if(!f)return null;d.push(f)}return new Tr(a,d)}evaluate(e){for(let r=0;r<this.args.length;r++){const a=this.args[r].evaluate(e);if(!J(this.type,ti(a)))return a;if(r===this.args.length-1)throw new oi(`Expected value to be of type ${q(this.type)}, but found ${q(ti(a))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Qs={"to-boolean":Ye,"to-color":qi,"to-number":Ie,"to-string":st};class Sn{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const a=e[0];if(!Qs[a])throw new Error(`Can't parse ${a} as it is not part of the known types`);if((a==="to-boolean"||a==="to-string")&&e.length!==2)return r.error("Expected one argument.");const o=Qs[a],u=[];for(let d=1;d<e.length;d++){const f=r.parse(e[d],d,tt);if(!f)return null;u.push(f)}return new Sn(o,u)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let r,a;for(const o of this.args){if(r=o.evaluate(e),a=null,r instanceof Bt)return r;if(typeof r=="string"){const u=e.parseColor(r);if(u)return u}else if(Array.isArray(r)&&(a=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:cs(r[0],r[1],r[2],r[3]),!a))return new Bt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new oi(a||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(const a of this.args){r=a.evaluate(e);const o=or.parse(r);if(o)return o}throw new oi(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(const a of this.args){r=a.evaluate(e);const o=Sr.parse(r);if(o)return o}throw new oi(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(const a of this.args){if(r=a.evaluate(e),r===null)return 0;const o=Number(r);if(!isNaN(o))return o}throw new oi(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return Oi.fromString(Et(this.args[0].evaluate(e)));case"resolvedImage":return Mi.fromString(Et(this.args[0].evaluate(e)));default:return Et(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Tl=["Unknown","Point","LineString","Polygon"];class eo{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Tl[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let r=this._parseColorCache[e];return r||(r=this._parseColorCache[e]=Bt.parse(e)),r}}class us{constructor(e,r,a=[],o,u=new Fn,d=[]){this.registry=e,this.path=a,this.key=a.map(f=>`[${f}]`).join(""),this.scope=u,this.errors=d,this.expectedType=o,this._isConstant=r}parse(e,r,a,o,u={}){return r?this.concat(r,a,o)._parse(e,u):this._parse(e,u)}_parse(e,r){function a(o,u,d){return d==="assert"?new Tr(u,[o]):d==="coerce"?new Sn(u,[o]):o}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const o=e[0];if(typeof o!="string")return this.error(`Expression name must be a string, but found ${typeof o} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const u=this.registry[o];if(u){let d=u.parse(e,this);if(!d)return null;if(this.expectedType){const f=this.expectedType,_=d.type;if(f.kind!=="string"&&f.kind!=="number"&&f.kind!=="boolean"&&f.kind!=="object"&&f.kind!=="array"||_.kind!=="value")if(f.kind!=="color"&&f.kind!=="formatted"&&f.kind!=="resolvedImage"||_.kind!=="value"&&_.kind!=="string")if(f.kind!=="padding"||_.kind!=="value"&&_.kind!=="number"&&_.kind!=="array")if(f.kind!=="variableAnchorOffsetCollection"||_.kind!=="value"&&_.kind!=="array"){if(this.checkSubtype(f,_))return null}else d=a(d,f,r.typeAnnotation||"coerce");else d=a(d,f,r.typeAnnotation||"coerce");else d=a(d,f,r.typeAnnotation||"coerce");else d=a(d,f,r.typeAnnotation||"assert")}if(!(d instanceof On)&&d.type.kind!=="resolvedImage"&&this._isConstant(d)){const f=new eo;try{d=new On(d.type,d.evaluate(f))}catch(_){return this.error(_.message),null}}return d}return this.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,r,a){const o=typeof e=="number"?this.path.concat(e):this.path,u=a?this.scope.concat(a):this.scope;return new us(this.registry,this._isConstant,o,r||null,u,this.errors)}error(e,...r){const a=`${this.key}${r.map(o=>`[${o}]`).join("")}`;this.errors.push(new si(a,e))}checkSubtype(e,r){const a=J(e,r);return a&&this.error(a),a}}class ps{constructor(e,r,a){this.type=an,this.locale=a,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const a=e[1];if(typeof a!="object"||Array.isArray(a))return r.error("Collator options argument must be an object.");const o=r.parse(a["case-sensitive"]!==void 0&&a["case-sensitive"],1,Ye);if(!o)return null;const u=r.parse(a["diacritic-sensitive"]!==void 0&&a["diacritic-sensitive"],1,Ye);if(!u)return null;let d=null;return a.locale&&(d=r.parse(a.locale,1,st),!d)?null:new ps(o,u,d)}evaluate(e){return new Js(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}const Tn=8192;function to(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function Ra(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function Il(i,e){const r=(180+i[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,o=Math.pow(2,e.z);return[Math.round(r*o*Tn),Math.round(a*o*Tn)]}function sh(i,e,r){const a=i[0]-e[0],o=i[1]-e[1],u=i[0]-r[0],d=i[1]-r[1];return a*d-u*o==0&&a*u<=0&&o*d<=0}function io(i,e){let r=!1;for(let d=0,f=e.length;d<f;d++){const _=e[d];for(let b=0,T=_.length;b<T-1;b++){if(sh(i,_[b],_[b+1]))return!1;(o=_[b])[1]>(a=i)[1]!=(u=_[b+1])[1]>a[1]&&a[0]<(u[0]-o[0])*(a[1]-o[1])/(u[1]-o[1])+o[0]&&(r=!r)}}var a,o,u;return r}function ro(i,e){for(let r=0;r<e.length;r++)if(io(i,e[r]))return!0;return!1}function Al(i,e,r,a){const o=a[0]-r[0],u=a[1]-r[1],d=(i[0]-r[0])*u-o*(i[1]-r[1]),f=(e[0]-r[0])*u-o*(e[1]-r[1]);return d>0&&f<0||d<0&&f>0}function oh(i,e,r){for(const b of r)for(let T=0;T<b.length-1;++T)if((f=[(d=b[T+1])[0]-(u=b[T])[0],d[1]-u[1]])[0]*(_=[(o=e)[0]-(a=i)[0],o[1]-a[1]])[1]-f[1]*_[0]!=0&&Al(a,o,u,d)&&Al(u,d,a,o))return!0;var a,o,u,d,f,_;return!1}function Cl(i,e){for(let r=0;r<i.length;++r)if(!io(i[r],e))return!1;for(let r=0;r<i.length-1;++r)if(oh(i[r],i[r+1],e))return!1;return!0}function El(i,e){for(let r=0;r<e.length;r++)if(Cl(i,e[r]))return!0;return!1}function ds(i,e,r){const a=[];for(let o=0;o<i.length;o++){const u=[];for(let d=0;d<i[o].length;d++){const f=Il(i[o][d],r);to(e,f),u.push(f)}a.push(u)}return a}function Pl(i,e,r){const a=[];for(let o=0;o<i.length;o++){const u=ds(i[o],e,r);a.push(u)}return a}function kl(i,e,r,a){if(i[0]<r[0]||i[0]>r[2]){const o=.5*a;let u=i[0]-r[0]>o?-a:r[0]-i[0]>o?a:0;u===0&&(u=i[0]-r[2]>o?-a:r[2]-i[0]>o?a:0),i[0]+=u}to(e,i)}function no(i,e,r,a){const o=Math.pow(2,a.z)*Tn,u=[a.x*Tn,a.y*Tn],d=[];for(const f of i)for(const _ of f){const b=[_.x+u[0],_.y+u[1]];kl(b,e,r,o),d.push(b)}return d}function ao(i,e,r,a){const o=Math.pow(2,a.z)*Tn,u=[a.x*Tn,a.y*Tn],d=[];for(const _ of i){const b=[];for(const T of _){const C=[T.x+u[0],T.y+u[1]];to(e,C),b.push(C)}d.push(b)}if(e[2]-e[0]<=o/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const _ of d)for(const b of _)kl(b,e,r,o)}var f;return d}class Nn{constructor(e,r){this.type=Ye,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ca(e[1])){const a=e[1];if(a.type==="FeatureCollection")for(let o=0;o<a.features.length;++o){const u=a.features[o].geometry.type;if(u==="Polygon"||u==="MultiPolygon")return new Nn(a,a.features[o].geometry)}else if(a.type==="Feature"){const o=a.geometry.type;if(o==="Polygon"||o==="MultiPolygon")return new Nn(a,a.geometry)}else if(a.type==="Polygon"||a.type==="MultiPolygon")return new Nn(a,a)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(r,a){const o=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(a.type==="Polygon"){const f=ds(a.coordinates,u,d),_=no(r.geometry(),o,u,d);if(!Ra(o,u))return!1;for(const b of _)if(!io(b,f))return!1}if(a.type==="MultiPolygon"){const f=Pl(a.coordinates,u,d),_=no(r.geometry(),o,u,d);if(!Ra(o,u))return!1;for(const b of _)if(!ro(b,f))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,a){const o=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(a.type==="Polygon"){const f=ds(a.coordinates,u,d),_=ao(r.geometry(),o,u,d);if(!Ra(o,u))return!1;for(const b of _)if(!Cl(b,f))return!1}if(a.type==="MultiPolygon"){const f=Pl(a.coordinates,u,d),_=ao(r.geometry(),o,u,d);if(!Ra(o,u))return!1;for(const b of _)if(!El(b,f))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class ms{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const a=e[1];return r.scope.has(a)?new ms(a,r.scope.get(a)):r.error(`Unknown variable "${a}". Make sure "${a}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Ir{constructor(e,r,a,o){this.name=e,this.type=r,this._evaluate=a,this.args=o}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){const a=e[0],o=Ir.definitions[a];if(!o)return r.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0);const u=Array.isArray(o)?o[0]:o.type,d=Array.isArray(o)?[[o[1],o[2]]]:o.overloads,f=d.filter(([b])=>!Array.isArray(b)||b.length===e.length-1);let _=null;for(const[b,T]of f){_=new us(r.registry,fs,r.path,null,r.scope);const C=[];let k=!1;for(let z=1;z<e.length;z++){const D=e[z],O=Array.isArray(b)?b[z-1]:b.type,G=_.parse(D,1+C.length,O);if(!G){k=!0;break}C.push(G)}if(!k)if(Array.isArray(b)&&b.length!==C.length)_.error(`Expected ${b.length} arguments, but found ${C.length} instead.`);else{for(let z=0;z<C.length;z++){const D=Array.isArray(b)?b[z]:b.type,O=C[z];_.concat(z+1).checkSubtype(D,O.type)}if(_.errors.length===0)return new Ir(a,u,T,C)}}if(f.length===1)r.errors.push(..._.errors);else{const b=(f.length?f:d).map(([C])=>{return k=C,Array.isArray(k)?`(${k.map(q).join(", ")})`:`(${q(k.type)}...)`;var k}).join(" | "),T=[];for(let C=1;C<e.length;C++){const k=r.parse(e[C],1+T.length);if(!k)return null;T.push(q(k.type))}r.error(`Expected arguments of type ${b}, but found (${T.join(", ")}) instead.`)}return null}static register(e,r){Ir.definitions=r;for(const a in r)e[a]=Ir}}function fs(i){if(i instanceof ms)return fs(i.boundExpression);if(i instanceof Ir&&i.name==="error"||i instanceof ps||i instanceof Nn)return!1;const e=i instanceof Sn||i instanceof Tr;let r=!0;return i.eachChild(a=>{r=e?r&&fs(a):r&&a instanceof On}),!!r&&gs(i)&&ys(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function gs(i){if(i instanceof Ir&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof Nn)return!1;let e=!0;return i.eachChild(r=>{e&&!gs(r)&&(e=!1)}),e}function Ba(i){if(i instanceof Ir&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!Ba(r)&&(e=!1)}),e}function ys(i,e){if(i instanceof Ir&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(a=>{r&&!ys(a,e)&&(r=!1)}),r}function ha(i,e){const r=i.length-1;let a,o,u=0,d=r,f=0;for(;u<=d;)if(f=Math.floor((u+d)/2),a=i[f],o=i[f+1],a<=e){if(f===r||e<o)return f;u=f+1}else{if(!(a>e))throw new oi("Input is not a number.");d=f-1}return 0}class In{constructor(e,r,a){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[o,u]of a)this.labels.push(o),this.outputs.push(u)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");const a=r.parse(e[1],1,Ie);if(!a)return null;const o=[];let u=null;r.expectedType&&r.expectedType.kind!=="value"&&(u=r.expectedType);for(let d=1;d<e.length;d+=2){const f=d===1?-1/0:e[d],_=e[d+1],b=d,T=d+1;if(typeof f!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',b);if(o.length&&o[o.length-1][0]>=f)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',b);const C=r.parse(_,T,u);if(!C)return null;u=u||C.type,o.push([f,C])}return new In(u,a,o)}evaluate(e){const r=this.labels,a=this.outputs;if(r.length===1)return a[0].evaluate(e);const o=this.input.evaluate(e);if(o<=r[0])return a[0].evaluate(e);const u=r.length;return o>=r[u-1]?a[u-1].evaluate(e):a[ha(r,o)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function vt(i,e,r){return i+r*(e-i)}function _s(i,e,r){return i.map((a,o)=>vt(a,e[o],r))}const lr={number:vt,color:function(i,e,r,a="rgb"){switch(a){case"rgb":{const[o,u,d,f]=_s(i.rgb,e.rgb,r);return new Bt(o,u,d,f,!1)}case"hcl":{const[o,u,d,f]=i.hcl,[_,b,T,C]=e.hcl;let k,z;if(isNaN(o)||isNaN(_))isNaN(o)?isNaN(_)?k=NaN:(k=_,d!==1&&d!==0||(z=b)):(k=o,T!==1&&T!==0||(z=u));else{let ie=_-o;_>o&&ie>180?ie-=360:_<o&&o-_>180&&(ie+=360),k=o+r*ie}const[D,O,G,W]=function([ie,Y,ne,oe]){return ie=isNaN(ie)?0:ie*Je,Zt([ne,Math.cos(ie)*Y,Math.sin(ie)*Y,oe])}([k,z??vt(u,b,r),vt(d,T,r),vt(f,C,r)]);return new Bt(D,O,G,W,!1)}case"lab":{const[o,u,d,f]=Zt(_s(i.lab,e.lab,r));return new Bt(o,u,d,f,!1)}}},array:_s,padding:function(i,e,r){return new or(_s(i.values,e.values,r))},variableAnchorOffsetCollection:function(i,e,r){const a=i.values,o=e.values;if(a.length!==o.length)throw new oi(`Cannot interpolate values of different length. from: ${i.toString()}, to: ${e.toString()}`);const u=[];for(let d=0;d<a.length;d+=2){if(a[d]!==o[d])throw new oi(`Cannot interpolate values containing mismatched anchors. from[${d}]: ${a[d]}, to[${d}]: ${o[d]}`);u.push(a[d]);const[f,_]=a[d+1],[b,T]=o[d+1];u.push([vt(f,b,r),vt(_,T,r)])}return new Sr(u)}};class cr{constructor(e,r,a,o,u){this.type=e,this.operator=r,this.interpolation=a,this.input=o,this.labels=[],this.outputs=[];for(const[d,f]of u)this.labels.push(d),this.outputs.push(f)}static interpolationFactor(e,r,a,o){let u=0;if(e.name==="exponential")u=so(r,e.base,a,o);else if(e.name==="linear")u=so(r,1,a,o);else if(e.name==="cubic-bezier"){const d=e.controlPoints;u=new et(d[0],d[1],d[2],d[3]).solve(so(r,1,a,o))}return u}static parse(e,r){let[a,o,u,...d]=e;if(!Array.isArray(o)||o.length===0)return r.error("Expected an interpolation type expression.",1);if(o[0]==="linear")o={name:"linear"};else if(o[0]==="exponential"){const b=o[1];if(typeof b!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);o={name:"exponential",base:b}}else{if(o[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(o[0])}`,1,0);{const b=o.slice(1);if(b.length!==4||b.some(T=>typeof T!="number"||T<0||T>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);o={name:"cubic-bezier",controlPoints:b}}}if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(u=r.parse(u,2,Ie),!u)return null;const f=[];let _=null;a==="interpolate-hcl"||a==="interpolate-lab"?_=qi:r.expectedType&&r.expectedType.kind!=="value"&&(_=r.expectedType);for(let b=0;b<d.length;b+=2){const T=d[b],C=d[b+1],k=b+3,z=b+4;if(typeof T!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',k);if(f.length&&f[f.length-1][0]>=T)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',k);const D=r.parse(C,z,_);if(!D)return null;_=_||D.type,f.push([T,D])}return pe(_,Ie)||pe(_,qi)||pe(_,E)||pe(_,R)||pe(_,j(Ie))?new cr(_,a,o,u,f):r.error(`Type ${q(_)} is not interpolatable.`)}evaluate(e){const r=this.labels,a=this.outputs;if(r.length===1)return a[0].evaluate(e);const o=this.input.evaluate(e);if(o<=r[0])return a[0].evaluate(e);const u=r.length;if(o>=r[u-1])return a[u-1].evaluate(e);const d=ha(r,o),f=cr.interpolationFactor(this.interpolation,o,r[d],r[d+1]),_=a[d].evaluate(e),b=a[d+1].evaluate(e);switch(this.operator){case"interpolate":return lr[this.type.kind](_,b,f);case"interpolate-hcl":return lr.color(_,b,f,"hcl");case"interpolate-lab":return lr.color(_,b,f,"lab")}}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function so(i,e,r,a){const o=a-r,u=i-r;return o===0?0:e===1?u/o:(Math.pow(e,u)-1)/(Math.pow(e,o)-1)}class vs{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected at least one argument.");let a=null;const o=r.expectedType;o&&o.kind!=="value"&&(a=o);const u=[];for(const f of e.slice(1)){const _=r.parse(f,1+u.length,a,void 0,{typeAnnotation:"omit"});if(!_)return null;a=a||_.type,u.push(_)}if(!a)throw new Error("No output type");const d=o&&u.some(f=>J(o,f.type));return new vs(d?tt:a,u)}evaluate(e){let r,a=null,o=0;for(const u of this.args)if(o++,a=u.evaluate(e),a&&a instanceof Mi&&!a.available&&(r||(r=a.name),a=null,o===this.args.length&&(a=r)),a!==null)break;return a}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class xs{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const a=[];for(let u=1;u<e.length-1;u+=2){const d=e[u];if(typeof d!="string")return r.error(`Expected string, but found ${typeof d} instead.`,u);if(/[^a-zA-Z0-9_]/.test(d))return r.error("Variable names must contain only alphanumeric characters or '_'.",u);const f=r.parse(e[u+1],u+1);if(!f)return null;a.push([d,f])}const o=r.parse(e[e.length-1],e.length-1,r.expectedType,a);return o?new xs(a,o):null}outputDefined(){return this.result.outputDefined()}}class oo{constructor(e,r,a){this.type=e,this.index=r,this.input=a}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const a=r.parse(e[1],1,Ie),o=r.parse(e[2],2,j(r.expectedType||tt));return a&&o?new oo(o.type.itemType,a,o):null}evaluate(e){const r=this.index.evaluate(e),a=this.input.evaluate(e);if(r<0)throw new oi(`Array index out of bounds: ${r} < 0.`);if(r>=a.length)throw new oi(`Array index out of bounds: ${r} > ${a.length-1}.`);if(r!==Math.floor(r))throw new oi(`Array index must be an integer, but found ${r} instead.`);return a[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class lo{constructor(e,r){this.type=Ye,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const a=r.parse(e[1],1,tt),o=r.parse(e[2],2,tt);return a&&o?K(a.type,[Ye,st,Ie,nn,tt])?new lo(a,o):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${q(a.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),a=this.haystack.evaluate(e);if(!a)return!1;if(!te(r,["boolean","string","number","null"]))throw new oi(`Expected first argument to be of type boolean, string, number or null, but found ${q(ti(r))} instead.`);if(!te(a,["string","array"]))throw new oi(`Expected second argument to be of type array or string, but found ${q(ti(a))} instead.`);return a.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class bs{constructor(e,r,a){this.type=Ie,this.needle=e,this.haystack=r,this.fromIndex=a}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const a=r.parse(e[1],1,tt),o=r.parse(e[2],2,tt);if(!a||!o)return null;if(!K(a.type,[Ye,st,Ie,nn,tt]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${q(a.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,Ie);return u?new bs(a,o,u):null}return new bs(a,o)}evaluate(e){const r=this.needle.evaluate(e),a=this.haystack.evaluate(e);if(!te(r,["boolean","string","number","null"]))throw new oi(`Expected first argument to be of type boolean, string, number or null, but found ${q(ti(r))} instead.`);if(!te(a,["string","array"]))throw new oi(`Expected second argument to be of type array or string, but found ${q(ti(a))} instead.`);if(this.fromIndex){const o=this.fromIndex.evaluate(e);return a.indexOf(r,o)}return a.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class co{constructor(e,r,a,o,u,d){this.inputType=e,this.type=r,this.input=a,this.cases=o,this.outputs=u,this.otherwise=d}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let a,o;r.expectedType&&r.expectedType.kind!=="value"&&(o=r.expectedType);const u={},d=[];for(let b=2;b<e.length-1;b+=2){let T=e[b];const C=e[b+1];Array.isArray(T)||(T=[T]);const k=r.concat(b);if(T.length===0)return k.error("Expected at least one branch label.");for(const D of T){if(typeof D!="number"&&typeof D!="string")return k.error("Branch labels must be numbers or strings.");if(typeof D=="number"&&Math.abs(D)>Number.MAX_SAFE_INTEGER)return k.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof D=="number"&&Math.floor(D)!==D)return k.error("Numeric branch labels must be integer values.");if(a){if(k.checkSubtype(a,ti(D)))return null}else a=ti(D);if(u[String(D)]!==void 0)return k.error("Branch labels must be unique.");u[String(D)]=d.length}const z=r.parse(C,b,o);if(!z)return null;o=o||z.type,d.push(z)}const f=r.parse(e[1],1,tt);if(!f)return null;const _=r.parse(e[e.length-1],e.length-1,o);return _?f.type.kind!=="value"&&r.concat(1).checkSubtype(a,f.type)?null:new co(a,o,f,u,d,_):null}evaluate(e){const r=this.input.evaluate(e);return(ti(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class ho{constructor(e,r,a){this.type=e,this.branches=r,this.otherwise=a}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let a;r.expectedType&&r.expectedType.kind!=="value"&&(a=r.expectedType);const o=[];for(let d=1;d<e.length-1;d+=2){const f=r.parse(e[d],d,Ye);if(!f)return null;const _=r.parse(e[d+1],d+1,a);if(!_)return null;o.push([f,_]),a=a||_.type}const u=r.parse(e[e.length-1],e.length-1,a);if(!u)return null;if(!a)throw new Error("Can't infer output type");return new ho(a,o,u)}evaluate(e){for(const[r,a]of this.branches)if(r.evaluate(e))return a.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[r,a]of this.branches)e(r),e(a);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}}class ws{constructor(e,r,a,o){this.type=e,this.input=r,this.beginIndex=a,this.endIndex=o}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const a=r.parse(e[1],1,tt),o=r.parse(e[2],2,Ie);if(!a||!o)return null;if(!K(a.type,[j(tt),st,tt]))return r.error(`Expected first argument to be of type array or string, but found ${q(a.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,Ie);return u?new ws(a.type,a,o,u):null}return new ws(a.type,a,o)}evaluate(e){const r=this.input.evaluate(e),a=this.beginIndex.evaluate(e);if(!te(r,["string","array"]))throw new oi(`Expected first argument to be of type array or string, but found ${q(ti(r))} instead.`);if(this.endIndex){const o=this.endIndex.evaluate(e);return r.slice(a,o)}return r.slice(a)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Ml(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Ll(i,e,r,a){return a.compare(e,r)===0}function ua(i,e,r){const a=i!=="=="&&i!=="!=";return class Em{constructor(u,d,f){this.type=Ye,this.lhs=u,this.rhs=d,this.collator=f,this.hasUntypedArgument=u.type.kind==="value"||d.type.kind==="value"}static parse(u,d){if(u.length!==3&&u.length!==4)return d.error("Expected two or three arguments.");const f=u[0];let _=d.parse(u[1],1,tt);if(!_)return null;if(!Ml(f,_.type))return d.concat(1).error(`"${f}" comparisons are not supported for type '${q(_.type)}'.`);let b=d.parse(u[2],2,tt);if(!b)return null;if(!Ml(f,b.type))return d.concat(2).error(`"${f}" comparisons are not supported for type '${q(b.type)}'.`);if(_.type.kind!==b.type.kind&&_.type.kind!=="value"&&b.type.kind!=="value")return d.error(`Cannot compare types '${q(_.type)}' and '${q(b.type)}'.`);a&&(_.type.kind==="value"&&b.type.kind!=="value"?_=new Tr(b.type,[_]):_.type.kind!=="value"&&b.type.kind==="value"&&(b=new Tr(_.type,[b])));let T=null;if(u.length===4){if(_.type.kind!=="string"&&b.type.kind!=="string"&&_.type.kind!=="value"&&b.type.kind!=="value")return d.error("Cannot use collator to compare non-string types.");if(T=d.parse(u[3],3,an),!T)return null}return new Em(_,b,T)}evaluate(u){const d=this.lhs.evaluate(u),f=this.rhs.evaluate(u);if(a&&this.hasUntypedArgument){const _=ti(d),b=ti(f);if(_.kind!==b.kind||_.kind!=="string"&&_.kind!=="number")throw new oi(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${_.kind}, ${b.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){const _=ti(d),b=ti(f);if(_.kind!=="string"||b.kind!=="string")return e(u,d,f)}return this.collator?r(u,d,f,this.collator.evaluate(u)):e(u,d,f)}eachChild(u){u(this.lhs),u(this.rhs),this.collator&&u(this.collator)}outputDefined(){return!0}}}const lh=ua("==",function(i,e,r){return e===r},Ll),ch=ua("!=",function(i,e,r){return e!==r},function(i,e,r,a){return!Ll(0,e,r,a)}),hh=ua("<",function(i,e,r){return e<r},function(i,e,r,a){return a.compare(e,r)<0}),uh=ua(">",function(i,e,r){return e>r},function(i,e,r,a){return a.compare(e,r)>0}),ph=ua("<=",function(i,e,r){return e<=r},function(i,e,r,a){return a.compare(e,r)<=0}),dh=ua(">=",function(i,e,r){return e>=r},function(i,e,r,a){return a.compare(e,r)>=0});class uo{constructor(e,r,a,o,u){this.type=st,this.number=e,this.locale=r,this.currency=a,this.minFractionDigits=o,this.maxFractionDigits=u}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const a=r.parse(e[1],1,Ie);if(!a)return null;const o=e[2];if(typeof o!="object"||Array.isArray(o))return r.error("NumberFormat options argument must be an object.");let u=null;if(o.locale&&(u=r.parse(o.locale,1,st),!u))return null;let d=null;if(o.currency&&(d=r.parse(o.currency,1,st),!d))return null;let f=null;if(o["min-fraction-digits"]&&(f=r.parse(o["min-fraction-digits"],1,Ie),!f))return null;let _=null;return o["max-fraction-digits"]&&(_=r.parse(o["max-fraction-digits"],1,Ie),!_)?null:new uo(a,u,d,f,_)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class Ss{constructor(e){this.type=V,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const a=e[1];if(!Array.isArray(a)&&typeof a=="object")return r.error("First argument must be an image or text section.");const o=[];let u=!1;for(let d=1;d<=e.length-1;++d){const f=e[d];if(u&&typeof f=="object"&&!Array.isArray(f)){u=!1;let _=null;if(f["font-scale"]&&(_=r.parse(f["font-scale"],1,Ie),!_))return null;let b=null;if(f["text-font"]&&(b=r.parse(f["text-font"],1,j(st)),!b))return null;let T=null;if(f["text-color"]&&(T=r.parse(f["text-color"],1,qi),!T))return null;const C=o[o.length-1];C.scale=_,C.font=b,C.textColor=T}else{const _=r.parse(e[d],1,tt);if(!_)return null;const b=_.type.kind;if(b!=="string"&&b!=="value"&&b!=="null"&&b!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");u=!0,o.push({content:_,scale:null,font:null,textColor:null})}}return new Ss(o)}evaluate(e){return new Oi(this.sections.map(r=>{const a=r.content.evaluate(e);return ti(a)===M?new ls("",a,null,null,null):new ls(Et(a),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null)}))}eachChild(e){for(const r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}}class po{constructor(e){this.type=M,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const a=r.parse(e[1],1,st);return a?new po(a):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),a=Mi.fromString(r);return a&&e.availableImages&&(a.available=e.availableImages.indexOf(r)>-1),a}eachChild(e){e(this.input)}outputDefined(){return!1}}class mo{constructor(e){this.type=Ie,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const a=r.parse(e[1],1);return a?a.type.kind!=="array"&&a.type.kind!=="string"&&a.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${q(a.type)} instead.`):new mo(a):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new oi(`Expected value to be of type string or array, but found ${q(ti(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const pa={"==":lh,"!=":ch,">":uh,"<":hh,">=":dh,"<=":ph,array:Tr,at:oo,boolean:Tr,case:ho,coalesce:vs,collator:ps,format:Ss,image:po,in:lo,"index-of":bs,interpolate:cr,"interpolate-hcl":cr,"interpolate-lab":cr,length:mo,let:xs,literal:On,match:co,number:Tr,"number-format":uo,object:Tr,slice:ws,step:In,string:Tr,"to-boolean":Sn,"to-color":Sn,"to-number":Sn,"to-string":Sn,var:ms,within:Nn};function zl(i,[e,r,a,o]){e=e.evaluate(i),r=r.evaluate(i),a=a.evaluate(i);const u=o?o.evaluate(i):1,d=cs(e,r,a,u);if(d)throw new oi(d);return new Bt(e/255,r/255,a/255,u,!1)}function Dl(i,e){return i in e}function fo(i,e){const r=e[i];return r===void 0?null:r}function Un(i){return{type:i}}function Rl(i){return{result:"success",value:i}}function An(i){return{result:"error",value:i}}function da(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function Bl(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function go(i){return!!i.expression&&i.expression.interpolated}function Pt(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function ii(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function mh(i){return i}function xt(i,e){const r=e.type==="color",a=i.stops&&typeof i.stops[0][0]=="object",o=a||!(a||i.property!==void 0),u=i.type||(go(e)?"exponential":"interval");if(r||e.type==="padding"){const T=r?Bt.parse:or.parse;(i=Gr({},i)).stops&&(i.stops=i.stops.map(C=>[C[0],T(C[1])])),i.default=T(i.default?i.default:e.default)}if(i.colorSpace&&(d=i.colorSpace)!=="rgb"&&d!=="hcl"&&d!=="lab")throw new Error(`Unknown color space: "${i.colorSpace}"`);var d;let f,_,b;if(u==="exponential")f=Fa;else if(u==="interval")f=Qt;else if(u==="categorical"){f=ri,_=Object.create(null);for(const T of i.stops)_[T[0]]=T[1];b=typeof i.stops[0][0]}else{if(u!=="identity")throw new Error(`Unknown function type "${u}"`);f=Fl}if(a){const T={},C=[];for(let D=0;D<i.stops.length;D++){const O=i.stops[D],G=O[0].zoom;T[G]===void 0&&(T[G]={zoom:G,type:i.type,property:i.property,default:i.default,stops:[]},C.push(G)),T[G].stops.push([O[0].value,O[1]])}const k=[];for(const D of C)k.push([T[D].zoom,xt(T[D],e)]);const z={name:"linear"};return{kind:"composite",interpolationType:z,interpolationFactor:cr.interpolationFactor.bind(void 0,z),zoomStops:k.map(D=>D[0]),evaluate:({zoom:D},O)=>Fa({stops:k,base:i.base},e,D).evaluate(D,O)}}if(o){const T=u==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:T,interpolationFactor:cr.interpolationFactor.bind(void 0,T),zoomStops:i.stops.map(C=>C[0]),evaluate:({zoom:C})=>f(i,e,C,_,b)}}return{kind:"source",evaluate(T,C){const k=C&&C.properties?C.properties[i.property]:void 0;return k===void 0?Vn(i.default,e.default):f(i,e,k,_,b)}}}function Vn(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function ri(i,e,r,a,o){return Vn(typeof r===o?a[r]:void 0,i.default,e.default)}function Qt(i,e,r){if(Pt(r)!=="number")return Vn(i.default,e.default);const a=i.stops.length;if(a===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[a-1][0])return i.stops[a-1][1];const o=ha(i.stops.map(u=>u[0]),r);return i.stops[o][1]}function Fa(i,e,r){const a=i.base!==void 0?i.base:1;if(Pt(r)!=="number")return Vn(i.default,e.default);const o=i.stops.length;if(o===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[o-1][0])return i.stops[o-1][1];const u=ha(i.stops.map(T=>T[0]),r),d=function(T,C,k,z){const D=z-k,O=T-k;return D===0?0:C===1?O/D:(Math.pow(C,O)-1)/(Math.pow(C,D)-1)}(r,a,i.stops[u][0],i.stops[u+1][0]),f=i.stops[u][1],_=i.stops[u+1][1],b=lr[e.type]||mh;return typeof f.evaluate=="function"?{evaluate(...T){const C=f.evaluate.apply(void 0,T),k=_.evaluate.apply(void 0,T);if(C!==void 0&&k!==void 0)return b(C,k,d,i.colorSpace)}}:b(f,_,d,i.colorSpace)}function Fl(i,e,r){switch(e.type){case"color":r=Bt.parse(r);break;case"formatted":r=Oi.fromString(r.toString());break;case"resolvedImage":r=Mi.fromString(r.toString());break;case"padding":r=or.parse(r);break;default:Pt(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return Vn(r,i.default,e.default)}Ir.register(pa,{error:[{kind:"error"},[st],(i,[e])=>{throw new oi(e.evaluate(i))}],typeof:[st,[tt],(i,[e])=>q(ti(e.evaluate(i)))],"to-rgba":[j(Ie,4),[qi],(i,[e])=>{const[r,a,o,u]=e.evaluate(i).rgb;return[255*r,255*a,255*o,u]}],rgb:[qi,[Ie,Ie,Ie],zl],rgba:[qi,[Ie,Ie,Ie,Ie],zl],has:{type:Ye,overloads:[[[st],(i,[e])=>Dl(e.evaluate(i),i.properties())],[[st,qr],(i,[e,r])=>Dl(e.evaluate(i),r.evaluate(i))]]},get:{type:tt,overloads:[[[st],(i,[e])=>fo(e.evaluate(i),i.properties())],[[st,qr],(i,[e,r])=>fo(e.evaluate(i),r.evaluate(i))]]},"feature-state":[tt,[st],(i,[e])=>fo(e.evaluate(i),i.featureState||{})],properties:[qr,[],i=>i.properties()],"geometry-type":[st,[],i=>i.geometryType()],id:[tt,[],i=>i.id()],zoom:[Ie,[],i=>i.globals.zoom],"heatmap-density":[Ie,[],i=>i.globals.heatmapDensity||0],"line-progress":[Ie,[],i=>i.globals.lineProgress||0],accumulated:[tt,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Ie,Un(Ie),(i,e)=>{let r=0;for(const a of e)r+=a.evaluate(i);return r}],"*":[Ie,Un(Ie),(i,e)=>{let r=1;for(const a of e)r*=a.evaluate(i);return r}],"-":{type:Ie,overloads:[[[Ie,Ie],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[Ie],(i,[e])=>-e.evaluate(i)]]},"/":[Ie,[Ie,Ie],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[Ie,[Ie,Ie],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[Ie,[],()=>Math.LN2],pi:[Ie,[],()=>Math.PI],e:[Ie,[],()=>Math.E],"^":[Ie,[Ie,Ie],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[Ie,[Ie],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[Ie,[Ie],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[Ie,[Ie],(i,[e])=>Math.log(e.evaluate(i))],log2:[Ie,[Ie],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[Ie,[Ie],(i,[e])=>Math.sin(e.evaluate(i))],cos:[Ie,[Ie],(i,[e])=>Math.cos(e.evaluate(i))],tan:[Ie,[Ie],(i,[e])=>Math.tan(e.evaluate(i))],asin:[Ie,[Ie],(i,[e])=>Math.asin(e.evaluate(i))],acos:[Ie,[Ie],(i,[e])=>Math.acos(e.evaluate(i))],atan:[Ie,[Ie],(i,[e])=>Math.atan(e.evaluate(i))],min:[Ie,Un(Ie),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[Ie,Un(Ie),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[Ie,[Ie],(i,[e])=>Math.abs(e.evaluate(i))],round:[Ie,[Ie],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Ie,[Ie],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[Ie,[Ie],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[Ye,[st,tt],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[Ye,[tt],(i,[e])=>i.id()===e.value],"filter-type-==":[Ye,[st],(i,[e])=>i.geometryType()===e.value],"filter-<":[Ye,[st,tt],(i,[e,r])=>{const a=i.properties()[e.value],o=r.value;return typeof a==typeof o&&a<o}],"filter-id-<":[Ye,[tt],(i,[e])=>{const r=i.id(),a=e.value;return typeof r==typeof a&&r<a}],"filter->":[Ye,[st,tt],(i,[e,r])=>{const a=i.properties()[e.value],o=r.value;return typeof a==typeof o&&a>o}],"filter-id->":[Ye,[tt],(i,[e])=>{const r=i.id(),a=e.value;return typeof r==typeof a&&r>a}],"filter-<=":[Ye,[st,tt],(i,[e,r])=>{const a=i.properties()[e.value],o=r.value;return typeof a==typeof o&&a<=o}],"filter-id-<=":[Ye,[tt],(i,[e])=>{const r=i.id(),a=e.value;return typeof r==typeof a&&r<=a}],"filter->=":[Ye,[st,tt],(i,[e,r])=>{const a=i.properties()[e.value],o=r.value;return typeof a==typeof o&&a>=o}],"filter-id->=":[Ye,[tt],(i,[e])=>{const r=i.id(),a=e.value;return typeof r==typeof a&&r>=a}],"filter-has":[Ye,[tt],(i,[e])=>e.value in i.properties()],"filter-has-id":[Ye,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Ye,[j(st)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[Ye,[j(tt)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[Ye,[st,j(tt)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[Ye,[st,j(tt)],(i,[e,r])=>function(a,o,u,d){for(;u<=d;){const f=u+d>>1;if(o[f]===a)return!0;o[f]>a?d=f-1:u=f+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:Ye,overloads:[[[Ye,Ye],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[Un(Ye),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:Ye,overloads:[[[Ye,Ye],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[Un(Ye),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[Ye,[Ye],(i,[e])=>!e.evaluate(i)],"is-supported-script":[Ye,[st],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[st,[st],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[st,[st],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[st,Un(tt),(i,e)=>e.map(r=>Et(r.evaluate(i))).join("")],"resolved-locale":[st,[an],(i,[e])=>e.evaluate(i).resolvedLocale()]});class yo{constructor(e,r){var a;this.expression=e,this._warningHistory={},this._evaluator=new eo,this._defaultValue=r?(a=r).type==="color"&&ii(a.default)?new Bt(0,0,0,0):a.type==="color"?Bt.parse(a.default)||null:a.type==="padding"?or.parse(a.default)||null:a.type==="variableAnchorOffsetCollection"?Sr.parse(a.default)||null:a.default===void 0?null:a.default:null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,a,o,u,d){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=a,this._evaluator.canonical=o,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d,this.expression.evaluate(this._evaluator)}evaluate(e,r,a,o,u,d){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=a||null,this._evaluator.canonical=o,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d||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 oi(`Expected value to be one of ${Object.keys(this._enumValues).map(_=>JSON.stringify(_)).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 Ts(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in pa}function Is(i,e){const r=new us(pa,fs,[],e?function(o){const u={color:qi,string:st,number:Ie,enum:st,boolean:Ye,formatted:V,padding:E,resolvedImage:M,variableAnchorOffsetCollection:R};return o.type==="array"?j(u[o.value]||tt,o.length):u[o.type]}(e):void 0),a=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?Rl(new yo(a,e)):An(r.errors)}class _o{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!Ba(r.expression)}evaluateWithoutErrorHandling(e,r,a,o,u,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,a,o,u,d)}evaluate(e,r,a,o,u,d){return this._styleExpression.evaluate(e,r,a,o,u,d)}}class As{constructor(e,r,a,o){this.kind=e,this.zoomStops=a,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!Ba(r.expression),this.interpolationType=o}evaluateWithoutErrorHandling(e,r,a,o,u,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,a,o,u,d)}evaluate(e,r,a,o,u,d){return this._styleExpression.evaluate(e,r,a,o,u,d)}interpolationFactor(e,r,a){return this.interpolationType?cr.interpolationFactor(this.interpolationType,e,r,a):0}}function vo(i,e){const r=Is(i,e);if(r.result==="error")return r;const a=r.value.expression,o=gs(a);if(!o&&!da(e))return An([new si("","data expressions not supported")]);const u=ys(a,["zoom"]);if(!u&&!Bl(e))return An([new si("","zoom expressions not supported")]);const d=Na(a);return d||u?d instanceof si?An([d]):d instanceof cr&&!go(e)?An([new si("",'"interpolate" expressions cannot be used with this property')]):Rl(d?new As(o?"camera":"composite",r.value,d.labels,d instanceof cr?d.interpolation:void 0):new _o(o?"constant":"source",r.value)):An([new si("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Oa{constructor(e,r){this._parameters=e,this._specification=r,Gr(this,xt(this._parameters,this._specification))}static deserialize(e){return new Oa(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Na(i){let e=null;if(i instanceof xs)e=Na(i.result);else if(i instanceof vs){for(const r of i.args)if(e=Na(r),e)break}else(i instanceof In||i instanceof cr)&&i.input instanceof Ir&&i.input.name==="zoom"&&(e=i);return e instanceof si||i.eachChild(r=>{const a=Na(r);a instanceof si?e=a:!e&&a?e=new si("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&a&&e!==a&&(e=new si("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Ua(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!Ua(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const fh={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function xo(i){if(i==null)return{filter:()=>!0,needGeometry:!1};Ua(i)||(i=Cs(i));const e=Is(i,fh);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,a,o)=>e.value.evaluate(r,a,{},o),needGeometry:Ol(i)}}function gh(i,e){return i<e?-1:i>e?1:0}function Ol(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e<i.length;e++)if(Ol(i[e]))return!0;return!1}function Cs(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?bo(i[1],i[2],"=="):e==="!="?Va(bo(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?bo(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(Cs))):e==="all"?["all"].concat(i.slice(1).map(Cs)):e==="none"?["all"].concat(i.slice(1).map(Cs).map(Va)):e==="in"?Nl(i[1],i.slice(2)):e==="!in"?Va(Nl(i[1],i.slice(2))):e==="has"?Ul(i[1]):e==="!has"?Va(Ul(i[1])):e!=="within"||i;var r}function bo(i,e,r){switch(i){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,i,e]}}function Nl(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",i,["literal",e.sort(gh)]]:["filter-in-small",i,["literal",e]]}}function Ul(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Va(i){return["!",i]}function Es(i){const e=typeof i;if(e==="number"||e==="boolean"||e==="string"||i==null)return JSON.stringify(i);if(Array.isArray(i)){let o="[";for(const u of i)o+=`${Es(u)},`;return`${o}]`}const r=Object.keys(i).sort();let a="{";for(let o=0;o<r.length;o++)a+=`${JSON.stringify(r[o])}:${Es(i[r[o]])},`;return`${a}}`}function Ps(i){let e="";for(const r of Ji)e+=`/${Es(i[r])}`;return e}function Vl(i){const e=i.value;return e?[new Se(i.key,e,"constants have been deprecated as of v8")]:[]}function li(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function $n(i){if(Array.isArray(i))return i.map($n);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={};for(const r in i)e[r]=$n(i[r]);return e}return li(i)}function Qi(i){const e=i.key,r=i.value,a=i.valueSpec||{},o=i.objectElementValidators||{},u=i.style,d=i.styleSpec,f=i.validateSpec;let _=[];const b=Pt(r);if(b!=="object")return[new Se(e,r,`object expected, ${b} found`)];for(const T in r){const C=T.split(".")[0],k=a[C]||a["*"];let z;if(o[C])z=o[C];else if(a[C])z=f;else if(o["*"])z=o["*"];else{if(!a["*"]){_.push(new Se(e,r[T],`unknown property "${T}"`));continue}z=f}_=_.concat(z({key:(e&&`${e}.`)+T,value:r[T],valueSpec:k,style:u,styleSpec:d,object:r,objectKey:T,validateSpec:f},r))}for(const T in a)o[T]||a[T].required&&a[T].default===void 0&&r[T]===void 0&&_.push(new Se(e,r,`missing required property "${T}"`));return _}function ma(i){const e=i.value,r=i.valueSpec,a=i.style,o=i.styleSpec,u=i.key,d=i.arrayElementValidator||i.validateSpec;if(Pt(e)!=="array")return[new Se(u,e,`array expected, ${Pt(e)} found`)];if(r.length&&e.length!==r.length)return[new Se(u,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new Se(u,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let f={type:r.value,values:r.values};o.$version<7&&(f.function=r.function),Pt(r.value)==="object"&&(f=r.value);let _=[];for(let b=0;b<e.length;b++)_=_.concat(d({array:e,arrayIndex:b,value:e[b],valueSpec:f,validateSpec:i.validateSpec,style:a,styleSpec:o,key:`${u}[${b}]`}));return _}function $a(i){const e=i.key,r=i.value,a=i.valueSpec;let o=Pt(r);return o==="number"&&r!=r&&(o="NaN"),o!=="number"?[new Se(e,r,`number expected, ${o} found`)]:"minimum"in a&&r<a.minimum?[new Se(e,r,`${r} is less than the minimum value ${a.minimum}`)]:"maximum"in a&&r>a.maximum?[new Se(e,r,`${r} is greater than the maximum value ${a.maximum}`)]:[]}function ks(i){const e=i.valueSpec,r=li(i.value.type);let a,o,u,d={};const f=r!=="categorical"&&i.value.property===void 0,_=!f,b=Pt(i.value.stops)==="array"&&Pt(i.value.stops[0])==="array"&&Pt(i.value.stops[0][0])==="object",T=Qi({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(z){if(r==="identity")return[new Se(z.key,z.value,'identity function may not have a "stops" property')];let D=[];const O=z.value;return D=D.concat(ma({key:z.key,value:O,valueSpec:z.valueSpec,validateSpec:z.validateSpec,style:z.style,styleSpec:z.styleSpec,arrayElementValidator:C})),Pt(O)==="array"&&O.length===0&&D.push(new Se(z.key,O,"array must have at least one stop")),D},default:function(z){return z.validateSpec({key:z.key,value:z.value,valueSpec:e,validateSpec:z.validateSpec,style:z.style,styleSpec:z.styleSpec})}}});return r==="identity"&&f&&T.push(new Se(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||T.push(new Se(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!go(i.valueSpec)&&T.push(new Se(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(_&&!da(i.valueSpec)?T.push(new Se(i.key,i.value,"property functions not supported")):f&&!Bl(i.valueSpec)&&T.push(new Se(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!b||i.value.property!==void 0||T.push(new Se(i.key,i.value,'"property" property is required')),T;function C(z){let D=[];const O=z.value,G=z.key;if(Pt(O)!=="array")return[new Se(G,O,`array expected, ${Pt(O)} found`)];if(O.length!==2)return[new Se(G,O,`array length 2 expected, length ${O.length} found`)];if(b){if(Pt(O[0])!=="object")return[new Se(G,O,`object expected, ${Pt(O[0])} found`)];if(O[0].zoom===void 0)return[new Se(G,O,"object stop key must have zoom")];if(O[0].value===void 0)return[new Se(G,O,"object stop key must have value")];if(u&&u>li(O[0].zoom))return[new Se(G,O[0].zoom,"stop zoom values must appear in ascending order")];li(O[0].zoom)!==u&&(u=li(O[0].zoom),o=void 0,d={}),D=D.concat(Qi({key:`${G}[0]`,value:O[0],valueSpec:{zoom:{}},validateSpec:z.validateSpec,style:z.style,styleSpec:z.styleSpec,objectElementValidators:{zoom:$a,value:k}}))}else D=D.concat(k({key:`${G}[0]`,value:O[0],valueSpec:{},validateSpec:z.validateSpec,style:z.style,styleSpec:z.styleSpec},O));return Ts($n(O[1]))?D.concat([new Se(`${G}[1]`,O[1],"expressions are not allowed in function stops.")]):D.concat(z.validateSpec({key:`${G}[1]`,value:O[1],valueSpec:e,validateSpec:z.validateSpec,style:z.style,styleSpec:z.styleSpec}))}function k(z,D){const O=Pt(z.value),G=li(z.value),W=z.value!==null?z.value:D;if(a){if(O!==a)return[new Se(z.key,W,`${O} stop domain type must match previous stop domain type ${a}`)]}else a=O;if(O!=="number"&&O!=="string"&&O!=="boolean")return[new Se(z.key,W,"stop domain value must be a number, string, or boolean")];if(O!=="number"&&r!=="categorical"){let ie=`number expected, ${O} found`;return da(e)&&r===void 0&&(ie+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Se(z.key,W,ie)]}return r!=="categorical"||O!=="number"||isFinite(G)&&Math.floor(G)===G?r!=="categorical"&&O==="number"&&o!==void 0&&G<o?[new Se(z.key,W,"stop domain values must appear in ascending order")]:(o=G,r==="categorical"&&G in d?[new Se(z.key,W,"stop domain values must be unique")]:(d[G]=!0,[])):[new Se(z.key,W,`integer expected, found ${G}`)]}}function jn(i){const e=(i.expressionContext==="property"?vo:Is)($n(i.value),i.valueSpec);if(e.result==="error")return e.value.map(a=>new Se(`${i.key}${a.key}`,i.value,a.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new Se(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!Ba(r))return[new Se(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!Ba(r))return[new Se(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!ys(r,["zoom","feature-state"]))return[new Se(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!gs(r))return[new Se(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ja(i){const e=i.key,r=i.value,a=i.valueSpec,o=[];return Array.isArray(a.values)?a.values.indexOf(li(r))===-1&&o.push(new Se(e,r,`expected one of [${a.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(a.values).indexOf(li(r))===-1&&o.push(new Se(e,r,`expected one of [${Object.keys(a.values).join(", ")}], ${JSON.stringify(r)} found`)),o}function fa(i){return Ua($n(i.value))?jn(Gr({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):$l(i)}function $l(i){const e=i.value,r=i.key;if(Pt(e)!=="array")return[new Se(r,e,`array expected, ${Pt(e)} found`)];const a=i.styleSpec;let o,u=[];if(e.length<1)return[new Se(r,e,"filter array must have at least 1 element")];switch(u=u.concat(ja({key:`${r}[0]`,value:e[0],valueSpec:a.filter_operator,style:i.style,styleSpec:i.styleSpec})),li(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&li(e[1])==="$type"&&u.push(new Se(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&u.push(new Se(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(o=Pt(e[1]),o!=="string"&&u.push(new Se(`${r}[1]`,e[1],`string expected, ${o} found`)));for(let d=2;d<e.length;d++)o=Pt(e[d]),li(e[1])==="$type"?u=u.concat(ja({key:`${r}[${d}]`,value:e[d],valueSpec:a.geometry_type,style:i.style,styleSpec:i.styleSpec})):o!=="string"&&o!=="number"&&o!=="boolean"&&u.push(new Se(`${r}[${d}]`,e[d],`string, number, or boolean expected, ${o} found`));break;case"any":case"all":case"none":for(let d=1;d<e.length;d++)u=u.concat($l({key:`${r}[${d}]`,value:e[d],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":o=Pt(e[1]),e.length!==2?u.push(new Se(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):o!=="string"&&u.push(new Se(`${r}[1]`,e[1],`string expected, ${o} found`));break;case"within":o=Pt(e[1]),e.length!==2?u.push(new Se(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):o!=="object"&&u.push(new Se(`${r}[1]`,e[1],`object expected, ${o} found`))}return u}function jl(i,e){const r=i.key,a=i.validateSpec,o=i.style,u=i.styleSpec,d=i.value,f=i.objectKey,_=u[`${e}_${i.layerType}`];if(!_)return[];const b=f.match(/^(.*)-transition$/);if(e==="paint"&&b&&_[b[1]]&&_[b[1]].transition)return a({key:r,value:d,valueSpec:u.transition,style:o,styleSpec:u});const T=i.valueSpec||_[f];if(!T)return[new Se(r,d,`unknown property "${f}"`)];let C;if(Pt(d)==="string"&&da(T)&&!T.tokens&&(C=/^{([^}]+)}$/.exec(d)))return[new Se(r,d,`"${f}" does not support interpolation syntax
|
|
2
|
-
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(C[1])} }\`.`)];const k=[];return i.layerType==="symbol"&&(f==="text-field"&&o&&!o.glyphs&&k.push(new Se(r,d,'use of "text-field" requires a style "glyphs" property')),f==="text-font"&&ii($n(d))&&li(d.type)==="identity"&&k.push(new Se(r,d,'"text-font" does not support identity functions'))),k.concat(a({key:i.key,value:d,valueSpec:T,style:o,styleSpec:u,expressionContext:"property",propertyType:e,propertyKey:f}))}function Gl(i){return jl(i,"paint")}function ql(i){return jl(i,"layout")}function Zl(i){let e=[];const r=i.value,a=i.key,o=i.style,u=i.styleSpec;r.type||r.ref||e.push(new Se(a,r,'either "type" or "ref" is required'));let d=li(r.type);const f=li(r.ref);if(r.id){const _=li(r.id);for(let b=0;b<i.arrayIndex;b++){const T=o.layers[b];li(T.id)===_&&e.push(new Se(a,r.id,`duplicate layer id "${r.id}", previously used at line ${T.id.__line__}`))}}if("ref"in r){let _;["type","source","source-layer","filter","layout"].forEach(b=>{b in r&&e.push(new Se(a,r[b],`"${b}" is prohibited for ref layers`))}),o.layers.forEach(b=>{li(b.id)===f&&(_=b)}),_?_.ref?e.push(new Se(a,r.ref,"ref cannot reference another ref layer")):d=li(_.type):e.push(new Se(a,r.ref,`ref layer "${f}" not found`))}else if(d!=="background")if(r.source){const _=o.sources&&o.sources[r.source],b=_&&li(_.type);_?b==="vector"&&d==="raster"?e.push(new Se(a,r.source,`layer "${r.id}" requires a raster source`)):b!=="raster-dem"&&d==="hillshade"?e.push(new Se(a,r.source,`layer "${r.id}" requires a raster-dem source`)):b==="raster"&&d!=="raster"?e.push(new Se(a,r.source,`layer "${r.id}" requires a vector source`)):b!=="vector"||r["source-layer"]?b==="raster-dem"&&d!=="hillshade"?e.push(new Se(a,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):d!=="line"||!r.paint||!r.paint["line-gradient"]||b==="geojson"&&_.lineMetrics||e.push(new Se(a,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Se(a,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new Se(a,r.source,`source "${r.source}" not found`))}else e.push(new Se(a,r,'missing required property "source"'));return e=e.concat(Qi({key:a,value:r,valueSpec:u.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${a}.type`,value:r.type,valueSpec:u.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:fa,layout:_=>Qi({layer:r,key:_.key,value:_.value,style:_.style,styleSpec:_.styleSpec,validateSpec:_.validateSpec,objectElementValidators:{"*":b=>ql(Gr({layerType:d},b))}}),paint:_=>Qi({layer:r,key:_.key,value:_.value,style:_.style,styleSpec:_.styleSpec,validateSpec:_.validateSpec,objectElementValidators:{"*":b=>Gl(Gr({layerType:d},b))}})}})),e}function Zr(i){const e=i.value,r=i.key,a=Pt(e);return a!=="string"?[new Se(r,e,`string expected, ${a} found`)]:[]}const Ga={promoteId:function({key:i,value:e}){if(Pt(e)==="string")return Zr({key:i,value:e});{const r=[];for(const a in e)r.push(...Zr({key:`${i}.${a}`,value:e[a]}));return r}}};function hr(i){const e=i.value,r=i.key,a=i.styleSpec,o=i.style,u=i.validateSpec;if(!e.type)return[new Se(r,e,'"type" is required')];const d=li(e.type);let f;switch(d){case"vector":case"raster":return f=Qi({key:r,value:e,valueSpec:a[`source_${d.replace("-","_")}`],style:i.style,styleSpec:a,objectElementValidators:Ga,validateSpec:u}),f;case"raster-dem":return f=function(_){var b;const T=(b=_.sourceName)!==null&&b!==void 0?b:"",C=_.value,k=_.styleSpec,z=k.source_raster_dem,D=_.style;let O=[];const G=Pt(C);if(C===void 0)return O;if(G!=="object")return O.push(new Se("source_raster_dem",C,`object expected, ${G} found`)),O;const W=li(C.encoding)==="custom",ie=["redFactor","greenFactor","blueFactor","baseShift"],Y=_.value.encoding?`"${_.value.encoding}"`:"Default";for(const ne in C)!W&&ie.includes(ne)?O.push(new Se(ne,C[ne],`In "${T}": "${ne}" is only valid when "encoding" is set to "custom". ${Y} encoding found`)):z[ne]?O=O.concat(_.validateSpec({key:ne,value:C[ne],valueSpec:z[ne],validateSpec:_.validateSpec,style:D,styleSpec:k})):O.push(new Se(ne,C[ne],`unknown property "${ne}"`));return O}({sourceName:r,value:e,style:i.style,styleSpec:a,validateSpec:u}),f;case"geojson":if(f=Qi({key:r,value:e,valueSpec:a.source_geojson,style:o,styleSpec:a,validateSpec:u,objectElementValidators:Ga}),e.cluster)for(const _ in e.clusterProperties){const[b,T]=e.clusterProperties[_],C=typeof b=="string"?[b,["accumulated"],["get",_]]:b;f.push(...jn({key:`${r}.${_}.map`,value:T,validateSpec:u,expressionContext:"cluster-map"})),f.push(...jn({key:`${r}.${_}.reduce`,value:C,validateSpec:u,expressionContext:"cluster-reduce"}))}return f;case"video":return Qi({key:r,value:e,valueSpec:a.source_video,style:o,validateSpec:u,styleSpec:a});case"image":return Qi({key:r,value:e,valueSpec:a.source_image,style:o,validateSpec:u,styleSpec:a});case"canvas":return[new Se(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ja({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:o,validateSpec:u,styleSpec:a})}}function qa(i){const e=i.value,r=i.styleSpec,a=r.light,o=i.style;let u=[];const d=Pt(e);if(e===void 0)return u;if(d!=="object")return u=u.concat([new Se("light",e,`object expected, ${d} found`)]),u;for(const f in e){const _=f.match(/^(.*)-transition$/);u=u.concat(_&&a[_[1]]&&a[_[1]].transition?i.validateSpec({key:f,value:e[f],valueSpec:r.transition,validateSpec:i.validateSpec,style:o,styleSpec:r}):a[f]?i.validateSpec({key:f,value:e[f],valueSpec:a[f],validateSpec:i.validateSpec,style:o,styleSpec:r}):[new Se(f,e[f],`unknown property "${f}"`)])}return u}function Hl(i){const e=i.value,r=i.styleSpec,a=r.terrain,o=i.style;let u=[];const d=Pt(e);if(e===void 0)return u;if(d!=="object")return u=u.concat([new Se("terrain",e,`object expected, ${d} found`)]),u;for(const f in e)u=u.concat(a[f]?i.validateSpec({key:f,value:e[f],valueSpec:a[f],validateSpec:i.validateSpec,style:o,styleSpec:r}):[new Se(f,e[f],`unknown property "${f}"`)]);return u}function Wl(i){let e=[];const r=i.value,a=i.key;if(Array.isArray(r)){const o=[],u=[];for(const d in r)r[d].id&&o.includes(r[d].id)&&e.push(new Se(a,r,`all the sprites' ids must be unique, but ${r[d].id} is duplicated`)),o.push(r[d].id),r[d].url&&u.includes(r[d].url)&&e.push(new Se(a,r,`all the sprites' URLs must be unique, but ${r[d].url} is duplicated`)),u.push(r[d].url),e=e.concat(Qi({key:`${a}[${d}]`,value:r[d],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return e}return Zr({key:a,value:r})}const Kl={"*":()=>[],array:ma,boolean:function(i){const e=i.value,r=i.key,a=Pt(e);return a!=="boolean"?[new Se(r,e,`boolean expected, ${a} found`)]:[]},number:$a,color:function(i){const e=i.key,r=i.value,a=Pt(r);return a!=="string"?[new Se(e,r,`color expected, ${a} found`)]:Bt.parse(String(r))?[]:[new Se(e,r,`color expected, "${r}" found`)]},constants:Vl,enum:ja,filter:fa,function:ks,layer:Zl,object:Qi,source:hr,light:qa,terrain:Hl,string:Zr,formatted:function(i){return Zr(i).length===0?[]:jn(i)},resolvedImage:function(i){return Zr(i).length===0?[]:jn(i)},padding:function(i){const e=i.key,r=i.value;if(Pt(r)==="array"){if(r.length<1||r.length>4)return[new Se(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const a={type:"number"};let o=[];for(let u=0;u<r.length;u++)o=o.concat(i.validateSpec({key:`${e}[${u}]`,value:r[u],validateSpec:i.validateSpec,valueSpec:a}));return o}return $a({key:e,value:r,valueSpec:{}})},variableAnchorOffsetCollection:function(i){const e=i.key,r=i.value,a=Pt(r),o=i.styleSpec;if(a!=="array"||r.length<1||r.length%2!=0)return[new Se(e,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let u=[];for(let d=0;d<r.length;d+=2)u=u.concat(ja({key:`${e}[${d}]`,value:r[d],valueSpec:o.layout_symbol["text-anchor"]})),u=u.concat(ma({key:`${e}[${d+1}]`,value:r[d+1],valueSpec:{length:2,value:"number"},validateSpec:i.validateSpec,style:i.style,styleSpec:o}));return u},sprite:Wl};function sn(i){const e=i.value,r=i.valueSpec,a=i.styleSpec;return i.validateSpec=sn,r.expression&&ii(li(e))?ks(i):r.expression&&Ts($n(e))?jn(i):r.type&&Kl[r.type]?Kl[r.type](i):Qi(Gr({},i,{valueSpec:r.type?a[r.type]:r}))}function Xl(i){const e=i.value,r=i.key,a=Zr(i);return a.length||(e.indexOf("{fontstack}")===-1&&a.push(new Se(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&a.push(new Se(r,e,'"glyphs" url must include a "{range}" token'))),a}function Ar(i,e=ue){let r=[];return r=r.concat(sn({key:"",value:i,valueSpec:e.$root,styleSpec:e,style:i,validateSpec:sn,objectElementValidators:{glyphs:Xl,"*":()=>[]}})),i.constants&&(r=r.concat(Vl({key:"constants",value:i.constants,style:i,styleSpec:e,validateSpec:sn}))),Ms(r)}function on(i){return function(e){return i({...e,validateSpec:sn})}}function Ms(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function ln(i){return function(...e){return Ms(i.apply(this,e))}}Ar.source=ln(on(hr)),Ar.sprite=ln(on(Wl)),Ar.glyphs=ln(on(Xl)),Ar.light=ln(on(qa)),Ar.terrain=ln(on(Hl)),Ar.layer=ln(on(Zl)),Ar.filter=ln(on(fa)),Ar.paintProperty=ln(on(Gl)),Ar.layoutProperty=ln(on(ql));const cn=Ar,yh=cn.light,wo=cn.paintProperty,Yl=cn.layoutProperty;function Ls(i,e){let r=!1;if(e&&e.length)for(const a of e)i.fire(new bn(new Error(a.message))),r=!0;return r}class ga{constructor(e,r,a){const o=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const d=new Int32Array(this.arrayBuffer);e=d[0],this.d=(r=d[1])+2*(a=d[2]);for(let _=0;_<this.d*this.d;_++){const b=d[3+_],T=d[3+_+1];o.push(b===T?null:d.subarray(b,T))}const f=d[3+o.length+1];this.keys=d.subarray(d[3+o.length],f),this.bboxes=d.subarray(f),this.insert=this._insertReadonly}else{this.d=r+2*a;for(let d=0;d<this.d*this.d;d++)o.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=a,this.scale=r/e,this.uid=0;const u=a/r*e;this.min=-u,this.max=e+u}insert(e,r,a,o,u){this._forEachCell(r,a,o,u,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(a),this.bboxes.push(o),this.bboxes.push(u)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,a,o,u,d){this.cells[u].push(d)}query(e,r,a,o,u){const d=this.min,f=this.max;if(e<=d&&r<=d&&f<=a&&f<=o&&!u)return Array.prototype.slice.call(this.keys);{const _=[];return this._forEachCell(e,r,a,o,this._queryCell,_,{},u),_}}_queryCell(e,r,a,o,u,d,f,_){const b=this.cells[u];if(b!==null){const T=this.keys,C=this.bboxes;for(let k=0;k<b.length;k++){const z=b[k];if(f[z]===void 0){const D=4*z;(_?_(C[D+0],C[D+1],C[D+2],C[D+3]):e<=C[D+2]&&r<=C[D+3]&&a>=C[D+0]&&o>=C[D+1])?(f[z]=!0,d.push(T[z])):f[z]=!1}}}}_forEachCell(e,r,a,o,u,d,f,_){const b=this._convertToCellCoord(e),T=this._convertToCellCoord(r),C=this._convertToCellCoord(a),k=this._convertToCellCoord(o);for(let z=b;z<=C;z++)for(let D=T;D<=k;D++){const O=this.d*D+z;if((!_||_(this._convertFromCellCoord(z),this._convertFromCellCoord(D),this._convertFromCellCoord(z+1),this._convertFromCellCoord(D+1)))&&u.call(this,e,r,a,o,O,d,f,_))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,r=3+this.cells.length+1+1;let a=0;for(let d=0;d<this.cells.length;d++)a+=this.cells[d].length;const o=new Int32Array(r+a+this.keys.length+this.bboxes.length);o[0]=this.extent,o[1]=this.n,o[2]=this.padding;let u=r;for(let d=0;d<e.length;d++){const f=e[d];o[3+d]=u,o.set(f,u),u+=f.length}return o[3+e.length]=u,o.set(this.keys,u),u+=this.keys.length,o[3+e.length+1]=u,o.set(this.bboxes,u),u+=this.bboxes.length,o.buffer}static serialize(e,r){const a=e.toArrayBuffer();return r&&r.push(a),{buffer:a}}static deserialize(e){return new ga(e.buffer)}}const hn={};function ze(i,e,r={}){if(hn[i])throw new Error(`${i} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),hn[i]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}ze("Object",Object),ze("TransferableGridIndex",ga),ze("Color",Bt),ze("Error",Error),ze("AJAXError",_n),ze("ResolvedImage",Mi),ze("StylePropertyFunction",Oa),ze("StyleExpression",yo,{omit:["_evaluator"]}),ze("ZoomDependentExpression",As),ze("ZoomConstantExpression",_o),ze("CompoundExpression",Ir,{omit:["_evaluate"]});for(const i in pa)pa[i]._classRegistryKey||ze(`Expression_${i}`,pa[i]);function zs(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function Cn(i,e){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob)return i;if(zs(i)||Pi(i))return e&&e.push(i),i;if(ArrayBuffer.isView(i)){const r=i;return e&&e.push(r.buffer),r}if(i instanceof ImageData)return e&&e.push(i.data.buffer),i;if(Array.isArray(i)){const r=[];for(const a of i)r.push(Cn(a,e));return r}if(typeof i=="object"){const r=i.constructor,a=r._classRegistryKey;if(!a)throw new Error("can't serialize object of unregistered class");if(!hn[a])throw new Error(`${a} is not registered.`);const o=r.serialize?r.serialize(i,e):{};if(r.serialize){if(e&&o===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const u in i){if(!i.hasOwnProperty(u)||hn[a].omit.indexOf(u)>=0)continue;const d=i[u];o[u]=hn[a].shallow.indexOf(u)>=0?d:Cn(d,e)}i instanceof Error&&(o.message=i.message)}if(o.$name)throw new Error("$name property is reserved for worker serialization logic.");return a!=="Object"&&(o.$name=a),o}throw new Error("can't serialize object of type "+typeof i)}function ya(i){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||zs(i)||Pi(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(ya);if(typeof i=="object"){const e=i.$name||"Object";if(!hn[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=hn[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const a=Object.create(r.prototype);for(const o of Object.keys(i)){if(o==="$name")continue;const u=i[o];a[o]=hn[e].shallow.indexOf(o)>=0?u:ya(u)}return a}throw new Error("can't deserialize object of type "+typeof i)}class Jl{constructor(){this.first=!0}update(e,r){const a=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=a,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=a,!0):(this.lastFloorZoom>a?(this.lastIntegerZoom=a+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<a&&(this.lastIntegerZoom=a,this.lastIntegerZoomTime=r),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=a,!0))}}const Me={"Latin-1 Supplement":i=>i>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function So(i){for(const e of i)if(Io(e.charCodeAt(0)))return!0;return!1}function To(i){for(const e of i)if(!_h(e.charCodeAt(0)))return!1;return!0}function _h(i){return!(Me.Arabic(i)||Me["Arabic Supplement"](i)||Me["Arabic Extended-A"](i)||Me["Arabic Presentation Forms-A"](i)||Me["Arabic Presentation Forms-B"](i))}function Io(i){return!(i!==746&&i!==747&&(i<4352||!(Me["Bopomofo Extended"](i)||Me.Bopomofo(i)||Me["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||Me["CJK Compatibility Ideographs"](i)||Me["CJK Compatibility"](i)||Me["CJK Radicals Supplement"](i)||Me["CJK Strokes"](i)||!(!Me["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Me["CJK Unified Ideographs Extension A"](i)||Me["CJK Unified Ideographs"](i)||Me["Enclosed CJK Letters and Months"](i)||Me["Hangul Compatibility Jamo"](i)||Me["Hangul Jamo Extended-A"](i)||Me["Hangul Jamo Extended-B"](i)||Me["Hangul Jamo"](i)||Me["Hangul Syllables"](i)||Me.Hiragana(i)||Me["Ideographic Description Characters"](i)||Me.Kanbun(i)||Me["Kangxi Radicals"](i)||Me["Katakana Phonetic Extensions"](i)||Me.Katakana(i)&&i!==12540||!(!Me["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!Me["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||Me["Unified Canadian Aboriginal Syllabics"](i)||Me["Unified Canadian Aboriginal Syllabics Extended"](i)||Me["Vertical Forms"](i)||Me["Yijing Hexagram Symbols"](i)||Me["Yi Syllables"](i)||Me["Yi Radicals"](i))))}function Ql(i){return!(Io(i)||function(e){return!!(Me["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||Me["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||Me["Letterlike Symbols"](e)||Me["Number Forms"](e)||Me["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||Me["Control Pictures"](e)&&e!==9251||Me["Optical Character Recognition"](e)||Me["Enclosed Alphanumerics"](e)||Me["Geometric Shapes"](e)||Me["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Me["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Me["CJK Symbols and Punctuation"](e)||Me.Katakana(e)||Me["Private Use Area"](e)||Me["CJK Compatibility Forms"](e)||Me["Small Form Variants"](e)||Me["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function ec(i){return i>=1424&&i<=2303||Me["Arabic Presentation Forms-A"](i)||Me["Arabic Presentation Forms-B"](i)}function tc(i,e){return!(!e&&ec(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Me.Khmer(i))}function vh(i){for(const e of i)if(ec(e.charCodeAt(0)))return!0;return!1}const Ao="deferred",Co="loading",Eo="loaded";let Po=null,er="unavailable",En=null;const Za=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(er="error"),Po&&Po(i)};function ko(){Ha.fire(new xn("pluginStateChange",{pluginStatus:er,pluginURL:En}))}const Ha=new Rn,Mo=function(){return er},ic=function(){if(er!==Ao||!En)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");er=Co,ko(),En&&Da({url:En},i=>{i?Za(i):(er=Eo,ko())})},ur={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>er===Eo||ur.applyArabicShaping!=null,isLoading:()=>er===Co,setState(i){if(!Ot())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");er=i.pluginStatus,En=i.pluginURL},isParsed(){if(!Ot())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return ur.applyArabicShaping!=null&&ur.processBidirectionalText!=null&&ur.processStyledBidirectionalText!=null},getPluginURL(){if(!Ot())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return En}};class Kt{constructor(e,r){this.zoom=e,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Jl,this.transition={})}isSupportedScript(e){return function(r,a){for(const o of r)if(!tc(o.charCodeAt(0),a))return!1;return!0}(e,ur.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,r=e-Math.floor(e),a=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*a}:{fromScale:.5,toScale:1,t:1-(1-a)*r}}}class Ds{constructor(e,r){this.property=e,this.value=r,this.expression=function(a,o){if(ii(a))return new Oa(a,o);if(Ts(a)){const u=vo(a,o);if(u.result==="error")throw new Error(u.value.map(d=>`${d.key}: ${d.message}`).join(", "));return u.value}{let u=a;return o.type==="color"&&typeof a=="string"?u=Bt.parse(a):o.type!=="padding"||typeof a!="number"&&!Array.isArray(a)?o.type==="variableAnchorOffsetCollection"&&Array.isArray(a)&&(u=Sr.parse(a)):u=or.parse(a),{kind:"constant",evaluate:()=>u}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,a){return this.property.possiblyEvaluate(this,e,r,a)}}class Lo{constructor(e){this.property=e,this.value=new Ds(e,void 0)}transitioned(e,r){return new nc(this.property,this.value,r,Ke({},e.transition,this.transition),e.now)}untransitioned(){return new nc(this.property,this.value,null,{},0)}}class rc{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return Qe(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Lo(this._values[e].property)),this._values[e].value=new Ds(this._values[e].property,r===null?void 0:Qe(r))}getTransition(e){return Qe(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Lo(this._values[e].property)),this._values[e].transition=Qe(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const a=this.getValue(r);a!==void 0&&(e[r]=a);const o=this.getTransition(r);o!==void 0&&(e[`${r}-transition`]=o)}return e}transitioned(e,r){const a=new ac(this._properties);for(const o of Object.keys(this._values))a._values[o]=this._values[o].transitioned(e,r._values[o]);return a}untransitioned(){const e=new ac(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class nc{constructor(e,r,a,o,u){this.property=e,this.value=r,this.begin=u+o.delay||0,this.end=this.begin+o.duration||0,e.specification.transition&&(o.delay||o.duration)&&(this.prior=a)}possiblyEvaluate(e,r,a){const o=e.now||0,u=this.value.possiblyEvaluate(e,r,a),d=this.prior;if(d){if(o>this.end)return this.prior=null,u;if(this.value.isDataDriven())return this.prior=null,u;if(o<this.begin)return d.possiblyEvaluate(e,r,a);{const f=(o-this.begin)/(this.end-this.begin);return this.property.interpolate(d.possiblyEvaluate(e,r,a),u,function(_){if(_<=0)return 0;if(_>=1)return 1;const b=_*_,T=b*_;return 4*(_<.5?T:3*(_-b)+T-.75)}(f))}}return u}}class ac{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,a){const o=new Rs(this._properties);for(const u of Object.keys(this._values))o._values[u]=this._values[u].possiblyEvaluate(e,r,a);return o}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class xh{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return Qe(this._values[e].value)}setValue(e,r){this._values[e]=new Ds(this._values[e].property,r===null?void 0:Qe(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const a=this.getValue(r);a!==void 0&&(e[r]=a)}return e}possiblyEvaluate(e,r,a){const o=new Rs(this._properties);for(const u of Object.keys(this._values))o._values[u]=this._values[u].possiblyEvaluate(e,r,a);return o}}class Zi{constructor(e,r,a){this.property=e,this.value=r,this.parameters=a}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,a,o){return this.property.evaluate(this.value,this.parameters,e,r,a,o)}}class Rs{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Ve{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,a){const o=lr[this.specification.type];return o?o(e,r,a):e}}class Ze{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,a,o){return new Zi(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},a,o)}:e.expression,r)}interpolate(e,r,a){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new Zi(this,{kind:"constant",value:void 0},e.parameters);const o=lr[this.specification.type];if(o){const u=o(e.value.value,r.value.value,a);return new Zi(this,{kind:"constant",value:u},e.parameters)}return e}evaluate(e,r,a,o,u,d){return e.kind==="constant"?e.value:e.evaluate(r,a,o,u,d)}}class Wa extends Ze{possiblyEvaluate(e,r,a,o){if(e.value===void 0)return new Zi(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const u=e.expression.evaluate(r,null,{},a,o),d=e.property.specification.type==="resolvedImage"&&typeof u!="string"?u.name:u,f=this._calculate(d,d,d,r);return new Zi(this,{kind:"constant",value:f},r)}if(e.expression.kind==="camera"){const u=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new Zi(this,{kind:"constant",value:u},r)}return new Zi(this,e.expression,r)}evaluate(e,r,a,o,u,d){if(e.kind==="source"){const f=e.evaluate(r,a,o,u,d);return this._calculate(f,f,f,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},a,o),e.evaluate({zoom:Math.floor(r.zoom)},a,o),e.evaluate({zoom:Math.floor(r.zoom)+1},a,o),r):e.value}_calculate(e,r,a,o){return o.zoom>o.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:a,to:r}}interpolate(e){return e}}class zo{constructor(e){this.specification=e}possiblyEvaluate(e,r,a,o){if(e.value!==void 0){if(e.expression.kind==="constant"){const u=e.expression.evaluate(r,null,{},a,o);return this._calculate(u,u,u,r)}return this._calculate(e.expression.evaluate(new Kt(Math.floor(r.zoom-1),r)),e.expression.evaluate(new Kt(Math.floor(r.zoom),r)),e.expression.evaluate(new Kt(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,a,o){return o.zoom>o.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:a,to:r}}interpolate(e){return e}}class Do{constructor(e){this.specification=e}possiblyEvaluate(e,r,a,o){return!!e.expression.evaluate(r,null,{},a,o)}interpolate(){return!1}}class di{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in e){const a=e[r];a.specification.overridable&&this.overridableProperties.push(r);const o=this.defaultPropertyValues[r]=new Ds(a,void 0),u=this.defaultTransitionablePropertyValues[r]=new Lo(a);this.defaultTransitioningPropertyValues[r]=u.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=o.possiblyEvaluate({})}}}ze("DataDrivenProperty",Ze),ze("DataConstantProperty",Ve),ze("CrossFadedDataDrivenProperty",Wa),ze("CrossFadedProperty",zo),ze("ColorRampProperty",Do);const Ro="-transition";class Cr extends Rn{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new xh(r.layout)),r.paint)){this._transitionablePaint=new rc(r.paint);for(const a in e.paint)this.setPaintProperty(a,e.paint[a],{validate:!1});for(const a in e.layout)this.setLayoutProperty(a,e.layout[a],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Rs(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,a={}){r!=null&&this._validate(Yl,`layers.${this.id}.layout.${e}`,e,r,a)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(Ro)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,a={}){if(r!=null&&this._validate(wo,`layers.${this.id}.paint.${e}`,e,r,a))return!1;if(e.endsWith(Ro))return this._transitionablePaint.setTransition(e.slice(0,-11),r||void 0),!1;{const o=this._transitionablePaint._values[e],u=o.property.specification["property-type"]==="cross-faded-data-driven",d=o.value.isDataDriven(),f=o.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const _=this._transitionablePaint._values[e].value;return _.isDataDriven()||d||u||this._handleOverridablePaintPropertyUpdate(e,f,_)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,a){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){const e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),jt(e,(r,a)=>!(r===void 0||a==="layout"&&!Object.keys(r).length||a==="paint"&&!Object.keys(r).length))}_validate(e,r,a,o,u={}){return(!u||u.validate!==!1)&&Ls(this,e.call(cn,{key:r,layerType:this.type,objectKey:a,value:o,styleSpec:ue,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const r=this.paint.get(e);if(r instanceof Zi&&da(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const sc={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Gn{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class ci{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function ni(i,e=1){let r=0,a=0;return{members:i.map(o=>{const u=sc[o.type].BYTES_PER_ELEMENT,d=r=_a(r,Math.max(e,u)),f=o.components||1;return a=Math.max(a,u),r+=u*f,{name:o.name,type:o.type,components:f,offset:d}}),size:_a(r,Math.max(a,e)),alignment:e}}function _a(i,e){return Math.ceil(i/e)*e}class Ka extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const a=this.length;return this.resize(a+1),this.emplace(a,e,r)}emplace(e,r,a){const o=2*e;return this.int16[o+0]=r,this.int16[o+1]=a,e}}Ka.prototype.bytesPerElement=4,ze("StructArrayLayout2i4",Ka);class Xa extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,a){const o=this.length;return this.resize(o+1),this.emplace(o,e,r,a)}emplace(e,r,a,o){const u=3*e;return this.int16[u+0]=r,this.int16[u+1]=a,this.int16[u+2]=o,e}}Xa.prototype.bytesPerElement=6,ze("StructArrayLayout3i6",Xa);class qn extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,a,o){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,a,o)}emplace(e,r,a,o,u){const d=4*e;return this.int16[d+0]=r,this.int16[d+1]=a,this.int16[d+2]=o,this.int16[d+3]=u,e}}qn.prototype.bytesPerElement=8,ze("StructArrayLayout4i8",qn);class Bo extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,a,o,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,a,o,u,d)}emplace(e,r,a,o,u,d,f){const _=6*e;return this.int16[_+0]=r,this.int16[_+1]=a,this.int16[_+2]=o,this.int16[_+3]=u,this.int16[_+4]=d,this.int16[_+5]=f,e}}Bo.prototype.bytesPerElement=12,ze("StructArrayLayout2i4i12",Bo);class Fo extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,a,o,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,a,o,u,d)}emplace(e,r,a,o,u,d,f){const _=4*e,b=8*e;return this.int16[_+0]=r,this.int16[_+1]=a,this.uint8[b+4]=o,this.uint8[b+5]=u,this.uint8[b+6]=d,this.uint8[b+7]=f,e}}Fo.prototype.bytesPerElement=8,ze("StructArrayLayout2i4ub8",Fo);class va extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const a=this.length;return this.resize(a+1),this.emplace(a,e,r)}emplace(e,r,a){const o=2*e;return this.float32[o+0]=r,this.float32[o+1]=a,e}}va.prototype.bytesPerElement=8,ze("StructArrayLayout2f8",va);class Oo extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,a,o,u,d,f,_,b,T){const C=this.length;return this.resize(C+1),this.emplace(C,e,r,a,o,u,d,f,_,b,T)}emplace(e,r,a,o,u,d,f,_,b,T,C){const k=10*e;return this.uint16[k+0]=r,this.uint16[k+1]=a,this.uint16[k+2]=o,this.uint16[k+3]=u,this.uint16[k+4]=d,this.uint16[k+5]=f,this.uint16[k+6]=_,this.uint16[k+7]=b,this.uint16[k+8]=T,this.uint16[k+9]=C,e}}Oo.prototype.bytesPerElement=20,ze("StructArrayLayout10ui20",Oo);class No extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,a,o,u,d,f,_,b,T,C,k){const z=this.length;return this.resize(z+1),this.emplace(z,e,r,a,o,u,d,f,_,b,T,C,k)}emplace(e,r,a,o,u,d,f,_,b,T,C,k,z){const D=12*e;return this.int16[D+0]=r,this.int16[D+1]=a,this.int16[D+2]=o,this.int16[D+3]=u,this.uint16[D+4]=d,this.uint16[D+5]=f,this.uint16[D+6]=_,this.uint16[D+7]=b,this.int16[D+8]=T,this.int16[D+9]=C,this.int16[D+10]=k,this.int16[D+11]=z,e}}No.prototype.bytesPerElement=24,ze("StructArrayLayout4i4ui4i24",No);class kt extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,a){const o=this.length;return this.resize(o+1),this.emplace(o,e,r,a)}emplace(e,r,a,o){const u=3*e;return this.float32[u+0]=r,this.float32[u+1]=a,this.float32[u+2]=o,e}}kt.prototype.bytesPerElement=12,ze("StructArrayLayout3f12",kt);class h extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint32[1*e+0]=r,e}}h.prototype.bytesPerElement=4,ze("StructArrayLayout1ul4",h);class t extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,a,o,u,d,f,_,b){const T=this.length;return this.resize(T+1),this.emplace(T,e,r,a,o,u,d,f,_,b)}emplace(e,r,a,o,u,d,f,_,b,T){const C=10*e,k=5*e;return this.int16[C+0]=r,this.int16[C+1]=a,this.int16[C+2]=o,this.int16[C+3]=u,this.int16[C+4]=d,this.int16[C+5]=f,this.uint32[k+3]=_,this.uint16[C+8]=b,this.uint16[C+9]=T,e}}t.prototype.bytesPerElement=20,ze("StructArrayLayout6i1ul2ui20",t);class n extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,a,o,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,a,o,u,d)}emplace(e,r,a,o,u,d,f){const _=6*e;return this.int16[_+0]=r,this.int16[_+1]=a,this.int16[_+2]=o,this.int16[_+3]=u,this.int16[_+4]=d,this.int16[_+5]=f,e}}n.prototype.bytesPerElement=12,ze("StructArrayLayout2i2i2i12",n);class s extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,a,o,u){const d=this.length;return this.resize(d+1),this.emplace(d,e,r,a,o,u)}emplace(e,r,a,o,u,d){const f=4*e,_=8*e;return this.float32[f+0]=r,this.float32[f+1]=a,this.float32[f+2]=o,this.int16[_+6]=u,this.int16[_+7]=d,e}}s.prototype.bytesPerElement=16,ze("StructArrayLayout2f1f2i16",s);class c extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,a,o){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,a,o)}emplace(e,r,a,o,u){const d=12*e,f=3*e;return this.uint8[d+0]=r,this.uint8[d+1]=a,this.float32[f+1]=o,this.float32[f+2]=u,e}}c.prototype.bytesPerElement=12,ze("StructArrayLayout2ub2f12",c);class p extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,a){const o=this.length;return this.resize(o+1),this.emplace(o,e,r,a)}emplace(e,r,a,o){const u=3*e;return this.uint16[u+0]=r,this.uint16[u+1]=a,this.uint16[u+2]=o,e}}p.prototype.bytesPerElement=6,ze("StructArrayLayout3ui6",p);class g extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,a,o,u,d,f,_,b,T,C,k,z,D,O,G,W){const ie=this.length;return this.resize(ie+1),this.emplace(ie,e,r,a,o,u,d,f,_,b,T,C,k,z,D,O,G,W)}emplace(e,r,a,o,u,d,f,_,b,T,C,k,z,D,O,G,W,ie){const Y=24*e,ne=12*e,oe=48*e;return this.int16[Y+0]=r,this.int16[Y+1]=a,this.uint16[Y+2]=o,this.uint16[Y+3]=u,this.uint32[ne+2]=d,this.uint32[ne+3]=f,this.uint32[ne+4]=_,this.uint16[Y+10]=b,this.uint16[Y+11]=T,this.uint16[Y+12]=C,this.float32[ne+7]=k,this.float32[ne+8]=z,this.uint8[oe+36]=D,this.uint8[oe+37]=O,this.uint8[oe+38]=G,this.uint32[ne+10]=W,this.int16[Y+22]=ie,e}}g.prototype.bytesPerElement=48,ze("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",g);class y extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,a,o,u,d,f,_,b,T,C,k,z,D,O,G,W,ie,Y,ne,oe,fe,Le,Oe,Pe,Ee,we,Re){const Te=this.length;return this.resize(Te+1),this.emplace(Te,e,r,a,o,u,d,f,_,b,T,C,k,z,D,O,G,W,ie,Y,ne,oe,fe,Le,Oe,Pe,Ee,we,Re)}emplace(e,r,a,o,u,d,f,_,b,T,C,k,z,D,O,G,W,ie,Y,ne,oe,fe,Le,Oe,Pe,Ee,we,Re,Te){const xe=32*e,je=16*e;return this.int16[xe+0]=r,this.int16[xe+1]=a,this.int16[xe+2]=o,this.int16[xe+3]=u,this.int16[xe+4]=d,this.int16[xe+5]=f,this.int16[xe+6]=_,this.int16[xe+7]=b,this.uint16[xe+8]=T,this.uint16[xe+9]=C,this.uint16[xe+10]=k,this.uint16[xe+11]=z,this.uint16[xe+12]=D,this.uint16[xe+13]=O,this.uint16[xe+14]=G,this.uint16[xe+15]=W,this.uint16[xe+16]=ie,this.uint16[xe+17]=Y,this.uint16[xe+18]=ne,this.uint16[xe+19]=oe,this.uint16[xe+20]=fe,this.uint16[xe+21]=Le,this.uint16[xe+22]=Oe,this.uint32[je+12]=Pe,this.float32[je+13]=Ee,this.float32[je+14]=we,this.uint16[xe+30]=Re,this.uint16[xe+31]=Te,e}}y.prototype.bytesPerElement=64,ze("StructArrayLayout8i15ui1ul2f2ui64",y);class x extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.float32[1*e+0]=r,e}}x.prototype.bytesPerElement=4,ze("StructArrayLayout1f4",x);class S extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,a){const o=this.length;return this.resize(o+1),this.emplace(o,e,r,a)}emplace(e,r,a,o){const u=3*e;return this.uint16[6*e+0]=r,this.float32[u+1]=a,this.float32[u+2]=o,e}}S.prototype.bytesPerElement=12,ze("StructArrayLayout1ui2f12",S);class I extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,a){const o=this.length;return this.resize(o+1),this.emplace(o,e,r,a)}emplace(e,r,a,o){const u=4*e;return this.uint32[2*e+0]=r,this.uint16[u+2]=a,this.uint16[u+3]=o,e}}I.prototype.bytesPerElement=8,ze("StructArrayLayout1ul2ui8",I);class A extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const a=this.length;return this.resize(a+1),this.emplace(a,e,r)}emplace(e,r,a){const o=2*e;return this.uint16[o+0]=r,this.uint16[o+1]=a,e}}A.prototype.bytesPerElement=4,ze("StructArrayLayout2ui4",A);class L extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint16[1*e+0]=r,e}}L.prototype.bytesPerElement=2,ze("StructArrayLayout1ui2",L);class U extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,a,o){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,a,o)}emplace(e,r,a,o,u){const d=4*e;return this.float32[d+0]=r,this.float32[d+1]=a,this.float32[d+2]=o,this.float32[d+3]=u,e}}U.prototype.bytesPerElement=16,ze("StructArrayLayout4f16",U);class N extends Gn{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 ye(this.anchorPointX,this.anchorPointY)}}N.prototype.size=20;class $ extends t{get(e){return new N(this,e)}}ze("CollisionBoxArray",$);class F extends Gn{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}F.prototype.size=48;class Q extends g{get(e){return new F(this,e)}}ze("PlacedSymbolArray",Q);class se extends Gn{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}se.prototype.size=64;class Z extends y{get(e){return new se(this,e)}}ze("SymbolInstanceArray",Z);class ee extends x{getoffsetX(e){return this.float32[1*e+0]}}ze("GlyphOffsetArray",ee);class le extends Xa{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}ze("SymbolLineVertexArray",le);class ce extends Gn{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]}}ce.prototype.size=12;class me extends S{get(e){return new ce(this,e)}}ze("TextAnchorOffsetArray",me);class ve extends Gn{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]}}ve.prototype.size=8;class _e extends I{get(e){return new ve(this,e)}}ze("FeatureIndexArray",_e);class be extends Ka{}class Fe extends Ka{}class mt extends Ka{}class Ce extends Bo{}class He extends Fo{}class Ne extends va{}class Ft extends Oo{}class ut extends No{}class nt extends kt{}class ft extends h{}class hi extends n{}class Ht extends c{}class Li extends p{}class xi extends A{}const mi=ni([{name:"a_pos",components:2,type:"Int16"}],4),{members:pr}=mi;class Xt{constructor(e=[]){this.segments=e}prepareSegment(e,r,a,o){let u=this.segments[this.segments.length-1];return e>Xt.MAX_VERTEX_ARRAY_LENGTH&&rt(`Max vertices per segment is ${Xt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!u||u.vertexLength+e>Xt.MAX_VERTEX_ARRAY_LENGTH||u.sortKey!==o)&&(u={vertexOffset:r.length,primitiveOffset:a.length,vertexLength:0,primitiveLength:0},o!==void 0&&(u.sortKey=o),this.segments.push(u)),u}get(){return this.segments}destroy(){for(const e of this.segments)for(const r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,a,o){return new Xt([{vertexOffset:e,primitiveOffset:r,vertexLength:a,primitiveLength:o,vaos:{},sortKey:0}])}}function Hr(i,e){return 256*(i=ht(Math.floor(i),0,255))+ht(Math.floor(e),0,255)}Xt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,ze("SegmentVector",Xt);const Wr=ni([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Pn={exports:{}},Zn={exports:{}};Zn.exports=function(i,e){var r,a,o,u,d,f,_,b;for(a=i.length-(r=3&i.length),o=e,d=3432918353,f=461845907,b=0;b<a;)_=255&i.charCodeAt(b)|(255&i.charCodeAt(++b))<<8|(255&i.charCodeAt(++b))<<16|(255&i.charCodeAt(++b))<<24,++b,o=27492+(65535&(u=5*(65535&(o=(o^=_=(65535&(_=(_=(65535&_)*d+(((_>>>16)*d&65535)<<16)&4294967295)<<15|_>>>17))*f+(((_>>>16)*f&65535)<<16)&4294967295)<<13|o>>>19))+((5*(o>>>16)&65535)<<16)&4294967295))+((58964+(u>>>16)&65535)<<16);switch(_=0,r){case 3:_^=(255&i.charCodeAt(b+2))<<16;case 2:_^=(255&i.charCodeAt(b+1))<<8;case 1:o^=_=(65535&(_=(_=(65535&(_^=255&i.charCodeAt(b)))*d+(((_>>>16)*d&65535)<<16)&4294967295)<<15|_>>>17))*f+(((_>>>16)*f&65535)<<16)&4294967295}return o^=i.length,o=2246822507*(65535&(o^=o>>>16))+((2246822507*(o>>>16)&65535)<<16)&4294967295,o=3266489909*(65535&(o^=o>>>13))+((3266489909*(o>>>16)&65535)<<16)&4294967295,(o^=o>>>16)>>>0};var xa=Zn.exports,Ni={exports:{}};Ni.exports=function(i,e){for(var r,a=i.length,o=e^a,u=0;a>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(u)|(255&i.charCodeAt(++u))<<8|(255&i.charCodeAt(++u))<<16|(255&i.charCodeAt(++u))<<24))+((1540483477*(r>>>16)&65535)<<16),o=1540483477*(65535&o)+((1540483477*(o>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),a-=4,++u;switch(a){case 3:o^=(255&i.charCodeAt(u+2))<<16;case 2:o^=(255&i.charCodeAt(u+1))<<8;case 1:o=1540483477*(65535&(o^=255&i.charCodeAt(u)))+((1540483477*(o>>>16)&65535)<<16)}return o=1540483477*(65535&(o^=o>>>13))+((1540483477*(o>>>16)&65535)<<16),(o^=o>>>15)>>>0};var zi=xa,Hi=Ni.exports;Pn.exports=zi,Pn.exports.murmur3=zi,Pn.exports.murmur2=Hi;var Hn=H(Pn.exports);class ui{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,a,o){this.ids.push(bi(e)),this.positions.push(r,a,o)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=bi(e);let a=0,o=this.ids.length-1;for(;a<o;){const d=a+o>>1;this.ids[d]>=r?o=d:a=d+1}const u=[];for(;this.ids[a]===r;)u.push({index:this.positions[3*a],start:this.positions[3*a+1],end:this.positions[3*a+2]}),a++;return u}static serialize(e,r){const a=new Float64Array(e.ids),o=new Uint32Array(e.positions);return tr(a,o,0,a.length-1),r&&r.push(a.buffer,o.buffer),{ids:a,positions:o}}static deserialize(e){const r=new ui;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function bi(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Hn(String(i))}function tr(i,e,r,a){for(;r<a;){const o=i[r+a>>1];let u=r-1,d=a+1;for(;;){do u++;while(i[u]<o);do d--;while(i[d]>o);if(u>=d)break;pi(i,u,d),pi(e,3*u,3*d),pi(e,3*u+1,3*d+1),pi(e,3*u+2,3*d+2)}d-r<a-d?(tr(i,e,r,d),r=d+1):(tr(i,e,d+1,a),a=d)}}function pi(i,e,r){const a=i[e];i[e]=i[r],i[r]=a}ze("FeaturePositionMap",ui);class Wn{constructor(e,r){this.gl=e.gl,this.location=r}}class Bs extends Wn{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class oc extends Wn{constructor(e,r){super(e,r),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class lc extends Wn{constructor(e,r){super(e,r),this.current=Bt.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}const bh=new Float32Array(16);function Uo(i){return[Hr(255*i.r,255*i.g),Hr(255*i.b,255*i.a)]}class Kr{constructor(e,r,a){this.value=e,this.uniformNames=r.map(o=>`u_${o}`),this.type=a}setUniform(e,r,a){e.set(a.constantOr(this.value))}getBinding(e,r,a){return this.type==="color"?new lc(e,r):new Bs(e,r)}}class Kn{constructor(e,r){this.uniformNames=r.map(a=>`u_${a}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,a,o){const u=o==="u_pattern_to"?this.patternTo:o==="u_pattern_from"?this.patternFrom:o==="u_pixel_ratio_to"?this.pixelRatioTo:o==="u_pixel_ratio_from"?this.pixelRatioFrom:null;u&&e.set(u)}getBinding(e,r,a){return a.substr(0,9)==="u_pattern"?new oc(e,r):new Bs(e,r)}}class Xr{constructor(e,r,a,o){this.expression=e,this.type=a,this.maxValue=0,this.paintVertexAttributes=r.map(u=>({name:`a_${u}`,type:"Float32",components:a==="color"?2:1,offset:0})),this.paintVertexArray=new o}populatePaintArray(e,r,a,o,u){const d=this.paintVertexArray.length,f=this.expression.evaluate(new Kt(0),r,{},o,[],u);this.paintVertexArray.resize(e),this._setPaintValue(d,e,f)}updatePaintArray(e,r,a,o){const u=this.expression.evaluate({zoom:0},a,o);this._setPaintValue(e,r,u)}_setPaintValue(e,r,a){if(this.type==="color"){const o=Uo(a);for(let u=e;u<r;u++)this.paintVertexArray.emplace(u,o[0],o[1])}else{for(let o=e;o<r;o++)this.paintVertexArray.emplace(o,a);this.maxValue=Math.max(this.maxValue,Math.abs(a))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Er{constructor(e,r,a,o,u,d){this.expression=e,this.uniformNames=r.map(f=>`u_${f}_t`),this.type=a,this.useIntegerZoom=o,this.zoom=u,this.maxValue=0,this.paintVertexAttributes=r.map(f=>({name:`a_${f}`,type:"Float32",components:a==="color"?4:2,offset:0})),this.paintVertexArray=new d}populatePaintArray(e,r,a,o,u){const d=this.expression.evaluate(new Kt(this.zoom),r,{},o,[],u),f=this.expression.evaluate(new Kt(this.zoom+1),r,{},o,[],u),_=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(_,e,d,f)}updatePaintArray(e,r,a,o){const u=this.expression.evaluate({zoom:this.zoom},a,o),d=this.expression.evaluate({zoom:this.zoom+1},a,o);this._setPaintValue(e,r,u,d)}_setPaintValue(e,r,a,o){if(this.type==="color"){const u=Uo(a),d=Uo(o);for(let f=e;f<r;f++)this.paintVertexArray.emplace(f,u[0],u[1],d[0],d[1])}else{for(let u=e;u<r;u++)this.paintVertexArray.emplace(u,a,o);this.maxValue=Math.max(this.maxValue,Math.abs(a),Math.abs(o))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,r){const a=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,o=ht(this.expression.interpolationFactor(a,this.zoom,this.zoom+1),0,1);e.set(o)}getBinding(e,r,a){return new Bs(e,r)}}class Yr{constructor(e,r,a,o,u,d){this.expression=e,this.type=r,this.useIntegerZoom=a,this.zoom=o,this.layerId=d,this.zoomInPaintVertexArray=new u,this.zoomOutPaintVertexArray=new u}populatePaintArray(e,r,a){const o=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(o,e,r.patterns&&r.patterns[this.layerId],a)}updatePaintArray(e,r,a,o,u){this._setPaintValues(e,r,a.patterns&&a.patterns[this.layerId],u)}_setPaintValues(e,r,a,o){if(!o||!a)return;const{min:u,mid:d,max:f}=a,_=o[u],b=o[d],T=o[f];if(_&&b&&T)for(let C=e;C<r;C++)this.zoomInPaintVertexArray.emplace(C,b.tl[0],b.tl[1],b.br[0],b.br[1],_.tl[0],_.tl[1],_.br[0],_.br[1],b.pixelRatio,_.pixelRatio),this.zoomOutPaintVertexArray.emplace(C,b.tl[0],b.tl[1],b.br[0],b.br[1],T.tl[0],T.tl[1],T.br[0],T.br[1],b.pixelRatio,T.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,Wr.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,Wr.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Vo{constructor(e,r,a){this.binders={},this._buffers=[];const o=[];for(const u in e.paint._values){if(!a(u))continue;const d=e.paint.get(u);if(!(d instanceof Zi&&da(d.property.specification)))continue;const f=Ty(u,e.type),_=d.value,b=d.property.specification.type,T=d.property.useIntegerZoom,C=d.property.specification["property-type"],k=C==="cross-faded"||C==="cross-faded-data-driven";if(_.kind==="constant")this.binders[u]=k?new Kn(_.value,f):new Kr(_.value,f,b),o.push(`/u_${u}`);else if(_.kind==="source"||k){const z=Kp(u,b,"source");this.binders[u]=k?new Yr(_,b,T,r,z,e.id):new Xr(_,f,b,z),o.push(`/a_${u}`)}else{const z=Kp(u,b,"composite");this.binders[u]=new Er(_,f,b,T,r,z),o.push(`/z_${u}`)}}this.cacheKey=o.sort().join("")}getMaxValue(e){const r=this.binders[e];return r instanceof Xr||r instanceof Er?r.maxValue:0}populatePaintArrays(e,r,a,o,u){for(const d in this.binders){const f=this.binders[d];(f instanceof Xr||f instanceof Er||f instanceof Yr)&&f.populatePaintArray(e,r,a,o,u)}}setConstantPatternPositions(e,r){for(const a in this.binders){const o=this.binders[a];o instanceof Kn&&o.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,a,o,u){let d=!1;for(const f in e){const _=r.getPositions(f);for(const b of _){const T=a.feature(b.index);for(const C in this.binders){const k=this.binders[C];if((k instanceof Xr||k instanceof Er||k instanceof Yr)&&k.expression.isStateDependent===!0){const z=o.paint.get(C);k.expression=z.value,k.updatePaintArray(b.start,b.end,T,e[f],u),d=!0}}}}return d}defines(){const e=[];for(const r in this.binders){const a=this.binders[r];(a instanceof Kr||a instanceof Kn)&&e.push(...a.uniformNames.map(o=>`#define HAS_UNIFORM_${o}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const a=this.binders[r];if(a instanceof Xr||a instanceof Er)for(let o=0;o<a.paintVertexAttributes.length;o++)e.push(a.paintVertexAttributes[o].name);else if(a instanceof Yr)for(let o=0;o<Wr.members.length;o++)e.push(Wr.members[o].name)}return e}getBinderUniforms(){const e=[];for(const r in this.binders){const a=this.binders[r];if(a instanceof Kr||a instanceof Kn||a instanceof Er)for(const o of a.uniformNames)e.push(o)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,r){const a=[];for(const o in this.binders){const u=this.binders[o];if(u instanceof Kr||u instanceof Kn||u instanceof Er){for(const d of u.uniformNames)if(r[d]){const f=u.getBinding(e,r[d],d);a.push({name:d,property:o,binding:f})}}}return a}setUniforms(e,r,a,o){for(const{name:u,property:d,binding:f}of r)this.binders[d].setUniform(f,o,a.get(d),u)}updatePaintBuffers(e){this._buffers=[];for(const r in this.binders){const a=this.binders[r];if(e&&a instanceof Yr){const o=e.fromScale===2?a.zoomInPaintVertexBuffer:a.zoomOutPaintVertexBuffer;o&&this._buffers.push(o)}else(a instanceof Xr||a instanceof Er)&&a.paintVertexBuffer&&this._buffers.push(a.paintVertexBuffer)}}upload(e){for(const r in this.binders){const a=this.binders[r];(a instanceof Xr||a instanceof Er||a instanceof Yr)&&a.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const r=this.binders[e];(r instanceof Xr||r instanceof Er||r instanceof Yr)&&r.destroy()}}}class un{constructor(e,r,a=()=>!0){this.programConfigurations={};for(const o of e)this.programConfigurations[o.id]=new Vo(o,r,a);this.needsUpload=!1,this._featureMap=new ui,this._bufferOffset=0}populatePaintArrays(e,r,a,o,u,d){for(const f in this.programConfigurations)this.programConfigurations[f].populatePaintArrays(e,r,o,u,d);r.id!==void 0&&this._featureMap.add(r.id,a,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,a,o){for(const u of a)this.needsUpload=this.programConfigurations[u.id].updatePaintArrays(e,this._featureMap,r,u,o)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Ty(i,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}function Kp(i,e,r){const a={color:{source:va,composite:U},number:{source:x,composite:va}},o=function(u){return{"line-pattern":{source:Ft,composite:Ft},"fill-pattern":{source:Ft,composite:Ft},"fill-extrusion-pattern":{source:Ft,composite:Ft}}[u]}(i);return o&&o[r]||a[e][r]}ze("ConstantBinder",Kr),ze("CrossFadedConstantBinder",Kn),ze("SourceExpressionBinder",Xr),ze("CrossFadedCompositeBinder",Yr),ze("CompositeExpressionBinder",Er),ze("ProgramConfiguration",Vo,{omit:["_buffers"]}),ze("ProgramConfigurationSet",un);const _i=8192,wh=Math.pow(2,14)-1,Xp=-wh-1;function Ya(i){const e=_i/i.extent,r=i.loadGeometry();for(let a=0;a<r.length;a++){const o=r[a];for(let u=0;u<o.length;u++){const d=o[u],f=Math.round(d.x*e),_=Math.round(d.y*e);d.x=ht(f,Xp,wh),d.y=ht(_,Xp,wh),(f<d.x||f>d.x+1||_<d.y||_>d.y+1)&&rt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Ja(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?Ya(i):[]}}function cc(i,e,r,a,o){i.emplaceBack(2*e+(a+1)/2,2*r+(o+1)/2)}class Sh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Fe,this.indexArray=new Li,this.segments=new Xt,this.programConfigurations=new un(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,a){const o=this.layers[0],u=[];let d=null,f=!1;o.type==="circle"&&(d=o.layout.get("circle-sort-key"),f=!d.isConstant());for(const{feature:_,id:b,index:T,sourceLayerIndex:C}of e){const k=this.layers[0]._featureFilter.needGeometry,z=Ja(_,k);if(!this.layers[0]._featureFilter.filter(new Kt(this.zoom),z,a))continue;const D=f?d.evaluate(z,{},a):void 0,O={id:b,properties:_.properties,type:_.type,sourceLayerIndex:C,index:T,geometry:k?z.geometry:Ya(_),patterns:{},sortKey:D};u.push(O)}f&&u.sort((_,b)=>_.sortKey-b.sortKey);for(const _ of u){const{geometry:b,index:T,sourceLayerIndex:C}=_,k=e[T].feature;this.addFeature(_,b,T,a),r.featureIndex.insert(k,b,T,C,this.index)}}update(e,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,pr),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,a,o){for(const u of r)for(const d of u){const f=d.x,_=d.y;if(f<0||f>=_i||_<0||_>=_i)continue;const b=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),T=b.vertexLength;cc(this.layoutVertexArray,f,_,-1,-1),cc(this.layoutVertexArray,f,_,1,-1),cc(this.layoutVertexArray,f,_,1,1),cc(this.layoutVertexArray,f,_,-1,1),this.indexArray.emplaceBack(T,T+1,T+2),this.indexArray.emplaceBack(T,T+3,T+2),b.vertexLength+=4,b.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a,{},o)}}function Yp(i,e){for(let r=0;r<i.length;r++)if(Fs(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Fs(i,e[r]))return!0;return!!Th(i,e)}function Iy(i,e,r){return!!Fs(i,e)||!!Ih(e,i,r)}function Jp(i,e){if(i.length===1)return ed(e,i[0]);for(let r=0;r<e.length;r++){const a=e[r];for(let o=0;o<a.length;o++)if(Fs(i,a[o]))return!0}for(let r=0;r<i.length;r++)if(ed(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Th(i,e[r]))return!0;return!1}function Ay(i,e,r){if(i.length>1){if(Th(i,e))return!0;for(let a=0;a<e.length;a++)if(Ih(e[a],i,r))return!0}for(let a=0;a<i.length;a++)if(Ih(i[a],e,r))return!0;return!1}function Th(i,e){if(i.length===0||e.length===0)return!1;for(let r=0;r<i.length-1;r++){const a=i[r],o=i[r+1];for(let u=0;u<e.length-1;u++)if(Cy(a,o,e[u],e[u+1]))return!0}return!1}function Cy(i,e,r,a){return gt(i,r,a)!==gt(e,r,a)&>(i,e,r)!==gt(i,e,a)}function Ih(i,e,r){const a=r*r;if(e.length===1)return i.distSqr(e[0])<a;for(let o=1;o<e.length;o++)if(Qp(i,e[o-1],e[o])<a)return!0;return!1}function Qp(i,e,r){const a=e.distSqr(r);if(a===0)return i.distSqr(e);const o=((i.x-e.x)*(r.x-e.x)+(i.y-e.y)*(r.y-e.y))/a;return i.distSqr(o<0?e:o>1?r:r.sub(e)._mult(o)._add(e))}function ed(i,e){let r,a,o,u=!1;for(let d=0;d<i.length;d++){r=i[d];for(let f=0,_=r.length-1;f<r.length;_=f++)a=r[f],o=r[_],a.y>e.y!=o.y>e.y&&e.x<(o.x-a.x)*(e.y-a.y)/(o.y-a.y)+a.x&&(u=!u)}return u}function Fs(i,e){let r=!1;for(let a=0,o=i.length-1;a<i.length;o=a++){const u=i[a],d=i[o];u.y>e.y!=d.y>e.y&&e.x<(d.x-u.x)*(e.y-u.y)/(d.y-u.y)+u.x&&(r=!r)}return r}function Ey(i,e,r){const a=r[0],o=r[2];if(i.x<a.x&&e.x<a.x||i.x>o.x&&e.x>o.x||i.y<a.y&&e.y<a.y||i.y>o.y&&e.y>o.y)return!1;const u=gt(i,e,r[0]);return u!==gt(i,e,r[1])||u!==gt(i,e,r[2])||u!==gt(i,e,r[3])}function $o(i,e,r){const a=e.paint.get(i).value;return a.kind==="constant"?a.value:r.programConfigurations.get(e.id).getMaxValue(i)}function hc(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function uc(i,e,r,a,o){if(!e[0]&&!e[1])return i;const u=ye.convert(e)._mult(o);r==="viewport"&&u._rotate(-a);const d=[];for(let f=0;f<i.length;f++)d.push(i[f].sub(u));return d}let td,id;ze("CircleBucket",Sh,{omit:["layers"]});var Py={get paint(){return id=id||new di({"circle-radius":new Ze(ue.paint_circle["circle-radius"]),"circle-color":new Ze(ue.paint_circle["circle-color"]),"circle-blur":new Ze(ue.paint_circle["circle-blur"]),"circle-opacity":new Ze(ue.paint_circle["circle-opacity"]),"circle-translate":new Ve(ue.paint_circle["circle-translate"]),"circle-translate-anchor":new Ve(ue.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ve(ue.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ve(ue.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Ze(ue.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Ze(ue.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Ze(ue.paint_circle["circle-stroke-opacity"])})},get layout(){return td=td||new di({"circle-sort-key":new Ze(ue.layout_circle["circle-sort-key"])})}},ir=1e-6,Os=typeof Float32Array<"u"?Float32Array:Array;function Ah(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function rd(i,e,r){var a=e[0],o=e[1],u=e[2],d=e[3],f=e[4],_=e[5],b=e[6],T=e[7],C=e[8],k=e[9],z=e[10],D=e[11],O=e[12],G=e[13],W=e[14],ie=e[15],Y=r[0],ne=r[1],oe=r[2],fe=r[3];return i[0]=Y*a+ne*f+oe*C+fe*O,i[1]=Y*o+ne*_+oe*k+fe*G,i[2]=Y*u+ne*b+oe*z+fe*W,i[3]=Y*d+ne*T+oe*D+fe*ie,i[4]=(Y=r[4])*a+(ne=r[5])*f+(oe=r[6])*C+(fe=r[7])*O,i[5]=Y*o+ne*_+oe*k+fe*G,i[6]=Y*u+ne*b+oe*z+fe*W,i[7]=Y*d+ne*T+oe*D+fe*ie,i[8]=(Y=r[8])*a+(ne=r[9])*f+(oe=r[10])*C+(fe=r[11])*O,i[9]=Y*o+ne*_+oe*k+fe*G,i[10]=Y*u+ne*b+oe*z+fe*W,i[11]=Y*d+ne*T+oe*D+fe*ie,i[12]=(Y=r[12])*a+(ne=r[13])*f+(oe=r[14])*C+(fe=r[15])*O,i[13]=Y*o+ne*_+oe*k+fe*G,i[14]=Y*u+ne*b+oe*z+fe*W,i[15]=Y*d+ne*T+oe*D+fe*ie,i}Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});var jo,ky=rd;function pc(i,e,r){var a=e[0],o=e[1],u=e[2],d=e[3];return i[0]=r[0]*a+r[4]*o+r[8]*u+r[12]*d,i[1]=r[1]*a+r[5]*o+r[9]*u+r[13]*d,i[2]=r[2]*a+r[6]*o+r[10]*u+r[14]*d,i[3]=r[3]*a+r[7]*o+r[11]*u+r[15]*d,i}jo=new Os(4),Os!=Float32Array&&(jo[0]=0,jo[1]=0,jo[2]=0,jo[3]=0);class My extends Cr{constructor(e){super(e,Py)}createBucket(e){return new Sh(e)}queryRadius(e){const r=e;return $o("circle-radius",this,r)+$o("circle-stroke-width",this,r)+hc(this.paint.get("circle-translate"))}queryIntersectsFeature(e,r,a,o,u,d,f,_){const b=uc(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),d.angle,f),T=this.paint.get("circle-radius").evaluate(r,a)+this.paint.get("circle-stroke-width").evaluate(r,a),C=this.paint.get("circle-pitch-alignment")==="map",k=C?b:function(D,O){return D.map(G=>nd(G,O))}(b,_),z=C?T*f:T;for(const D of o)for(const O of D){const G=C?O:nd(O,_);let W=z;const ie=pc([],[O.x,O.y,0,1],_);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?W*=ie[3]/d.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(W*=d.cameraToCenterDistance/ie[3]),Iy(k,G,W))return!0}return!1}}function nd(i,e){const r=pc([],[i.x,i.y,0,1],e);return new ye(r[0]/r[3],r[1]/r[3])}class ad extends Sh{}let sd;ze("HeatmapBucket",ad,{omit:["layers"]});var Ly={get paint(){return sd=sd||new di({"heatmap-radius":new Ze(ue.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Ze(ue.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ve(ue.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Do(ue.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ve(ue.paint_heatmap["heatmap-opacity"])})}};function Ch(i,{width:e,height:r},a,o){if(o){if(o instanceof Uint8ClampedArray)o=new Uint8Array(o.buffer);else if(o.length!==e*r*a)throw new RangeError(`mismatched image size. expected: ${o.length} but got: ${e*r*a}`)}else o=new Uint8Array(e*r*a);return i.width=e,i.height=r,i.data=o,i}function od(i,{width:e,height:r},a){if(e===i.width&&r===i.height)return;const o=Ch({},{width:e,height:r},a);Eh(i,o,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,e),height:Math.min(i.height,r)},a),i.width=e,i.height=r,i.data=o.data}function Eh(i,e,r,a,o,u){if(o.width===0||o.height===0)return e;if(o.width>i.width||o.height>i.height||r.x>i.width-o.width||r.y>i.height-o.height)throw new RangeError("out of range source coordinates for image copy");if(o.width>e.width||o.height>e.height||a.x>e.width-o.width||a.y>e.height-o.height)throw new RangeError("out of range destination coordinates for image copy");const d=i.data,f=e.data;if(d===f)throw new Error("srcData equals dstData, so image is already copied");for(let _=0;_<o.height;_++){const b=((r.y+_)*i.width+r.x)*u,T=((a.y+_)*e.width+a.x)*u;for(let C=0;C<o.width*u;C++)f[T+C]=d[b+C]}return e}class Go{constructor(e,r){Ch(this,e,1,r)}resize(e){od(this,e,1)}clone(){return new Go({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,a,o,u){Eh(e,r,a,o,u,1)}}class Dr{constructor(e,r){Ch(this,e,4,r)}resize(e){od(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Dr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,a,o,u){Eh(e,r,a,o,u,4)}}function ld(i){const e={},r=i.resolution||256,a=i.clips?i.clips.length:1,o=i.image||new Dr({width:r,height:a});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const u=(d,f,_)=>{e[i.evaluationKey]=_;const b=i.expression.evaluate(e);o.data[d+f+0]=Math.floor(255*b.r/b.a),o.data[d+f+1]=Math.floor(255*b.g/b.a),o.data[d+f+2]=Math.floor(255*b.b/b.a),o.data[d+f+3]=Math.floor(255*b.a)};if(i.clips)for(let d=0,f=0;d<a;++d,f+=4*r)for(let _=0,b=0;_<r;_++,b+=4){const T=_/(r-1),{start:C,end:k}=i.clips[d];u(f,b,C*(1-T)+k*T)}else for(let d=0,f=0;d<r;d++,f+=4)u(0,f,d/(r-1));return o}ze("AlphaImage",Go),ze("RGBAImage",Dr);class zy extends Cr{createBucket(e){return new ad(e)}constructor(e){super(e,Ly),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=ld({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let cd;var Dy={get paint(){return cd=cd||new di({"hillshade-illumination-direction":new Ve(ue.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ve(ue.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ve(ue.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ve(ue.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ve(ue.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ve(ue.paint_hillshade["hillshade-accent-color"])})}};class Ry extends Cr{constructor(e){super(e,Dy)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const By=ni([{name:"a_pos",components:2,type:"Int16"}],4),{members:Fy}=By;var Ph={exports:{}};function dc(i,e,r){r=r||2;var a,o,u,d,f,_,b,T=e&&e.length,C=T?e[0]*r:i.length,k=hd(i,0,C,r,!0),z=[];if(!k||k.next===k.prev)return z;if(T&&(k=function(O,G,W,ie){var Y,ne,oe,fe=[];for(Y=0,ne=G.length;Y<ne;Y++)(oe=hd(O,G[Y]*ie,Y<ne-1?G[Y+1]*ie:O.length,ie,!1))===oe.next&&(oe.steiner=!0),fe.push(qy(oe));for(fe.sort($y),Y=0;Y<fe.length;Y++)W=jy(fe[Y],W);return W}(i,e,k,r)),i.length>80*r){a=u=i[0],o=d=i[1];for(var D=r;D<C;D+=r)(f=i[D])<a&&(a=f),(_=i[D+1])<o&&(o=_),f>u&&(u=f),_>d&&(d=_);b=(b=Math.max(u-a,d-o))!==0?32767/b:0}return qo(k,z,r,a,o,b,0),z}function hd(i,e,r,a,o){var u,d;if(o===Lh(i,e,r,a)>0)for(u=e;u<r;u+=a)d=dd(u,i[u],i[u+1],d);else for(u=r-a;u>=e;u-=a)d=dd(u,i[u],i[u+1],d);return d&&mc(d,d.next)&&(Ho(d),d=d.next),d}function Qa(i,e){if(!i)return i;e||(e=i);var r,a=i;do if(r=!1,a.steiner||!mc(a,a.next)&&fi(a.prev,a,a.next)!==0)a=a.next;else{if(Ho(a),(a=e=a.prev)===a.next)break;r=!0}while(r||a!==e);return e}function qo(i,e,r,a,o,u,d){if(i){!d&&u&&function(T,C,k,z){var D=T;do D.z===0&&(D.z=kh(D.x,D.y,C,k,z)),D.prevZ=D.prev,D.nextZ=D.next,D=D.next;while(D!==T);D.prevZ.nextZ=null,D.prevZ=null,function(O){var G,W,ie,Y,ne,oe,fe,Le,Oe=1;do{for(W=O,O=null,ne=null,oe=0;W;){for(oe++,ie=W,fe=0,G=0;G<Oe&&(fe++,ie=ie.nextZ);G++);for(Le=Oe;fe>0||Le>0&&ie;)fe!==0&&(Le===0||!ie||W.z<=ie.z)?(Y=W,W=W.nextZ,fe--):(Y=ie,ie=ie.nextZ,Le--),ne?ne.nextZ=Y:O=Y,Y.prevZ=ne,ne=Y;W=ie}ne.nextZ=null,Oe*=2}while(oe>1)}(D)}(i,a,o,u);for(var f,_,b=i;i.prev!==i.next;)if(f=i.prev,_=i.next,u?Ny(i,a,o,u):Oy(i))e.push(f.i/r|0),e.push(i.i/r|0),e.push(_.i/r|0),Ho(i),i=_.next,b=_.next;else if((i=_)===b){d?d===1?qo(i=Uy(Qa(i),e,r),e,r,a,o,u,2):d===2&&Vy(i,e,r,a,o,u):qo(Qa(i),e,r,a,o,u,1);break}}}function Oy(i){var e=i.prev,r=i,a=i.next;if(fi(e,r,a)>=0)return!1;for(var o=e.x,u=r.x,d=a.x,f=e.y,_=r.y,b=a.y,T=o<u?o<d?o:d:u<d?u:d,C=f<_?f<b?f:b:_<b?_:b,k=o>u?o>d?o:d:u>d?u:d,z=f>_?f>b?f:b:_>b?_:b,D=a.next;D!==e;){if(D.x>=T&&D.x<=k&&D.y>=C&&D.y<=z&&Ns(o,f,u,_,d,b,D.x,D.y)&&fi(D.prev,D,D.next)>=0)return!1;D=D.next}return!0}function Ny(i,e,r,a){var o=i.prev,u=i,d=i.next;if(fi(o,u,d)>=0)return!1;for(var f=o.x,_=u.x,b=d.x,T=o.y,C=u.y,k=d.y,z=f<_?f<b?f:b:_<b?_:b,D=T<C?T<k?T:k:C<k?C:k,O=f>_?f>b?f:b:_>b?_:b,G=T>C?T>k?T:k:C>k?C:k,W=kh(z,D,e,r,a),ie=kh(O,G,e,r,a),Y=i.prevZ,ne=i.nextZ;Y&&Y.z>=W&&ne&&ne.z<=ie;){if(Y.x>=z&&Y.x<=O&&Y.y>=D&&Y.y<=G&&Y!==o&&Y!==d&&Ns(f,T,_,C,b,k,Y.x,Y.y)&&fi(Y.prev,Y,Y.next)>=0||(Y=Y.prevZ,ne.x>=z&&ne.x<=O&&ne.y>=D&&ne.y<=G&&ne!==o&&ne!==d&&Ns(f,T,_,C,b,k,ne.x,ne.y)&&fi(ne.prev,ne,ne.next)>=0))return!1;ne=ne.nextZ}for(;Y&&Y.z>=W;){if(Y.x>=z&&Y.x<=O&&Y.y>=D&&Y.y<=G&&Y!==o&&Y!==d&&Ns(f,T,_,C,b,k,Y.x,Y.y)&&fi(Y.prev,Y,Y.next)>=0)return!1;Y=Y.prevZ}for(;ne&&ne.z<=ie;){if(ne.x>=z&&ne.x<=O&&ne.y>=D&&ne.y<=G&&ne!==o&&ne!==d&&Ns(f,T,_,C,b,k,ne.x,ne.y)&&fi(ne.prev,ne,ne.next)>=0)return!1;ne=ne.nextZ}return!0}function Uy(i,e,r){var a=i;do{var o=a.prev,u=a.next.next;!mc(o,u)&&ud(o,a,a.next,u)&&Zo(o,u)&&Zo(u,o)&&(e.push(o.i/r|0),e.push(a.i/r|0),e.push(u.i/r|0),Ho(a),Ho(a.next),a=i=u),a=a.next}while(a!==i);return Qa(a)}function Vy(i,e,r,a,o,u){var d=i;do{for(var f=d.next.next;f!==d.prev;){if(d.i!==f.i&&Zy(d,f)){var _=pd(d,f);return d=Qa(d,d.next),_=Qa(_,_.next),qo(d,e,r,a,o,u,0),void qo(_,e,r,a,o,u,0)}f=f.next}d=d.next}while(d!==i)}function $y(i,e){return i.x-e.x}function jy(i,e){var r=function(o,u){var d,f=u,_=o.x,b=o.y,T=-1/0;do{if(b<=f.y&&b>=f.next.y&&f.next.y!==f.y){var C=f.x+(b-f.y)*(f.next.x-f.x)/(f.next.y-f.y);if(C<=_&&C>T&&(T=C,d=f.x<f.next.x?f:f.next,C===_))return d}f=f.next}while(f!==u);if(!d)return null;var k,z=d,D=d.x,O=d.y,G=1/0;f=d;do _>=f.x&&f.x>=D&&_!==f.x&&Ns(b<O?_:T,b,D,O,b<O?T:_,b,f.x,f.y)&&(k=Math.abs(b-f.y)/(_-f.x),Zo(f,o)&&(k<G||k===G&&(f.x>d.x||f.x===d.x&&Gy(d,f)))&&(d=f,G=k)),f=f.next;while(f!==z);return d}(i,e);if(!r)return e;var a=pd(r,i);return Qa(a,a.next),Qa(r,r.next)}function Gy(i,e){return fi(i.prev,i,e.prev)<0&&fi(e.next,i,i.next)<0}function kh(i,e,r,a,o){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*o|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-a)*o|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function qy(i){var e=i,r=i;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==i);return r}function Ns(i,e,r,a,o,u,d,f){return(o-d)*(e-f)>=(i-d)*(u-f)&&(i-d)*(a-f)>=(r-d)*(e-f)&&(r-d)*(u-f)>=(o-d)*(a-f)}function Zy(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,a){var o=r;do{if(o.i!==r.i&&o.next.i!==r.i&&o.i!==a.i&&o.next.i!==a.i&&ud(o,o.next,r,a))return!0;o=o.next}while(o!==r);return!1}(i,e)&&(Zo(i,e)&&Zo(e,i)&&function(r,a){var o=r,u=!1,d=(r.x+a.x)/2,f=(r.y+a.y)/2;do o.y>f!=o.next.y>f&&o.next.y!==o.y&&d<(o.next.x-o.x)*(f-o.y)/(o.next.y-o.y)+o.x&&(u=!u),o=o.next;while(o!==r);return u}(i,e)&&(fi(i.prev,i,e.prev)||fi(i,e.prev,e))||mc(i,e)&&fi(i.prev,i,i.next)>0&&fi(e.prev,e,e.next)>0)}function fi(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function mc(i,e){return i.x===e.x&&i.y===e.y}function ud(i,e,r,a){var o=gc(fi(i,e,r)),u=gc(fi(i,e,a)),d=gc(fi(r,a,i)),f=gc(fi(r,a,e));return o!==u&&d!==f||!(o!==0||!fc(i,r,e))||!(u!==0||!fc(i,a,e))||!(d!==0||!fc(r,i,a))||!(f!==0||!fc(r,e,a))}function fc(i,e,r){return e.x<=Math.max(i.x,r.x)&&e.x>=Math.min(i.x,r.x)&&e.y<=Math.max(i.y,r.y)&&e.y>=Math.min(i.y,r.y)}function gc(i){return i>0?1:i<0?-1:0}function Zo(i,e){return fi(i.prev,i,i.next)<0?fi(i,e,i.next)>=0&&fi(i,i.prev,e)>=0:fi(i,e,i.prev)<0||fi(i,i.next,e)<0}function pd(i,e){var r=new Mh(i.i,i.x,i.y),a=new Mh(e.i,e.x,e.y),o=i.next,u=e.prev;return i.next=e,e.prev=i,r.next=o,o.prev=r,a.next=r,r.prev=a,u.next=a,a.prev=u,a}function dd(i,e,r,a){var o=new Mh(i,e,r);return a?(o.next=a.next,o.prev=a,a.next.prev=o,a.next=o):(o.prev=o,o.next=o),o}function Ho(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Mh(i,e,r){this.i=i,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Lh(i,e,r,a){for(var o=0,u=e,d=r-a;u<r;u+=a)o+=(i[d]-i[u])*(i[u+1]+i[d+1]),d=u;return o}Ph.exports=dc,Ph.exports.default=dc,dc.deviation=function(i,e,r,a){var o=e&&e.length,u=Math.abs(Lh(i,0,o?e[0]*r:i.length,r));if(o)for(var d=0,f=e.length;d<f;d++)u-=Math.abs(Lh(i,e[d]*r,d<f-1?e[d+1]*r:i.length,r));var _=0;for(d=0;d<a.length;d+=3){var b=a[d]*r,T=a[d+1]*r,C=a[d+2]*r;_+=Math.abs((i[b]-i[C])*(i[T+1]-i[b+1])-(i[b]-i[T])*(i[C+1]-i[b+1]))}return u===0&&_===0?0:Math.abs((_-u)/u)},dc.flatten=function(i){for(var e=i[0][0].length,r={vertices:[],holes:[],dimensions:e},a=0,o=0;o<i.length;o++){for(var u=0;u<i[o].length;u++)for(var d=0;d<e;d++)r.vertices.push(i[o][u][d]);o>0&&r.holes.push(a+=i[o-1].length)}return r};var md=H(Ph.exports);function Hy(i,e,r,a,o){fd(i,e,r||0,a||i.length-1,o||Wy)}function fd(i,e,r,a,o){for(;a>r;){if(a-r>600){var u=a-r+1,d=e-r+1,f=Math.log(u),_=.5*Math.exp(2*f/3),b=.5*Math.sqrt(f*_*(u-_)/u)*(d-u/2<0?-1:1);fd(i,e,Math.max(r,Math.floor(e-d*_/u+b)),Math.min(a,Math.floor(e+(u-d)*_/u+b)),o)}var T=i[e],C=r,k=a;for(Wo(i,r,e),o(i[a],T)>0&&Wo(i,r,a);C<k;){for(Wo(i,C,k),C++,k--;o(i[C],T)<0;)C++;for(;o(i[k],T)>0;)k--}o(i[r],T)===0?Wo(i,r,k):Wo(i,++k,a),k<=e&&(r=k+1),e<=k&&(a=k-1)}}function Wo(i,e,r){var a=i[e];i[e]=i[r],i[r]=a}function Wy(i,e){return i<e?-1:i>e?1:0}function zh(i,e){const r=i.length;if(r<=1)return[i];const a=[];let o,u;for(let d=0;d<r;d++){const f=Rt(i[d]);f!==0&&(i[d].area=Math.abs(f),u===void 0&&(u=f<0),u===f<0?(o&&a.push(o),o=[i[d]]):o.push(i[d]))}if(o&&a.push(o),e>1)for(let d=0;d<a.length;d++)a[d].length<=e||(Hy(a[d],e,1,a[d].length-1,Ky),a[d]=a[d].slice(0,e));return a}function Ky(i,e){return e.area-i.area}function Dh(i,e,r){const a=r.patternDependencies;let o=!1;for(const u of e){const d=u.paint.get(`${i}-pattern`);d.isConstant()||(o=!0);const f=d.constantOr(null);f&&(o=!0,a[f.to]=!0,a[f.from]=!0)}return o}function Rh(i,e,r,a,o){const u=o.patternDependencies;for(const d of e){const f=d.paint.get(`${i}-pattern`).value;if(f.kind!=="constant"){let _=f.evaluate({zoom:a-1},r,{},o.availableImages),b=f.evaluate({zoom:a},r,{},o.availableImages),T=f.evaluate({zoom:a+1},r,{},o.availableImages);_=_&&_.name?_.name:_,b=b&&b.name?b.name:b,T=T&&T.name?T.name:T,u[_]=!0,u[b]=!0,u[T]=!0,r.patterns[d.id]={min:_,mid:b,max:T}}}return r}class Bh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new mt,this.indexArray=new Li,this.indexArray2=new xi,this.programConfigurations=new un(e.layers,e.zoom),this.segments=new Xt,this.segments2=new Xt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,a){this.hasPattern=Dh("fill",this.layers,r);const o=this.layers[0].layout.get("fill-sort-key"),u=!o.isConstant(),d=[];for(const{feature:f,id:_,index:b,sourceLayerIndex:T}of e){const C=this.layers[0]._featureFilter.needGeometry,k=Ja(f,C);if(!this.layers[0]._featureFilter.filter(new Kt(this.zoom),k,a))continue;const z=u?o.evaluate(k,{},a,r.availableImages):void 0,D={id:_,properties:f.properties,type:f.type,sourceLayerIndex:T,index:b,geometry:C?k.geometry:Ya(f),patterns:{},sortKey:z};d.push(D)}u&&d.sort((f,_)=>f.sortKey-_.sortKey);for(const f of d){const{geometry:_,index:b,sourceLayerIndex:T}=f;if(this.hasPattern){const C=Rh("fill",this.layers,f,this.zoom,r);this.patternFeatures.push(C)}else this.addFeature(f,_,b,a,{});r.featureIndex.insert(e[b].feature,_,b,T,this.index)}}update(e,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,a)}addFeatures(e,r,a){for(const o of this.patternFeatures)this.addFeature(o,o.geometry,o.index,r,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Fy),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,r,a,o,u){for(const d of zh(r,500)){let f=0;for(const z of d)f+=z.length;const _=this.segments.prepareSegment(f,this.layoutVertexArray,this.indexArray),b=_.vertexLength,T=[],C=[];for(const z of d){if(z.length===0)continue;z!==d[0]&&C.push(T.length/2);const D=this.segments2.prepareSegment(z.length,this.layoutVertexArray,this.indexArray2),O=D.vertexLength;this.layoutVertexArray.emplaceBack(z[0].x,z[0].y),this.indexArray2.emplaceBack(O+z.length-1,O),T.push(z[0].x),T.push(z[0].y);for(let G=1;G<z.length;G++)this.layoutVertexArray.emplaceBack(z[G].x,z[G].y),this.indexArray2.emplaceBack(O+G-1,O+G),T.push(z[G].x),T.push(z[G].y);D.vertexLength+=z.length,D.primitiveLength+=z.length}const k=md(T,C);for(let z=0;z<k.length;z+=3)this.indexArray.emplaceBack(b+k[z],b+k[z+1],b+k[z+2]);_.vertexLength+=f,_.primitiveLength+=k.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a,u,o)}}let gd,yd;ze("FillBucket",Bh,{omit:["layers","patternFeatures"]});var Xy={get paint(){return yd=yd||new di({"fill-antialias":new Ve(ue.paint_fill["fill-antialias"]),"fill-opacity":new Ze(ue.paint_fill["fill-opacity"]),"fill-color":new Ze(ue.paint_fill["fill-color"]),"fill-outline-color":new Ze(ue.paint_fill["fill-outline-color"]),"fill-translate":new Ve(ue.paint_fill["fill-translate"]),"fill-translate-anchor":new Ve(ue.paint_fill["fill-translate-anchor"]),"fill-pattern":new Wa(ue.paint_fill["fill-pattern"])})},get layout(){return gd=gd||new di({"fill-sort-key":new Ze(ue.layout_fill["fill-sort-key"])})}};class Yy extends Cr{constructor(e){super(e,Xy)}recalculate(e,r){super.recalculate(e,r);const a=this.paint._values["fill-outline-color"];a.value.kind==="constant"&&a.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new Bh(e)}queryRadius(){return hc(this.paint.get("fill-translate"))}queryIntersectsFeature(e,r,a,o,u,d,f){return Jp(uc(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),d.angle,f),o)}isTileClipped(){return!0}}const Jy=ni([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Qy=ni([{name:"a_centroid",components:2,type:"Int16"}],4),{members:e_}=Jy;var ba={},t_=Ae,_d=Us;function Us(i,e,r,a,o){this.properties={},this.extent=r,this.type=0,this._pbf=i,this._geometry=-1,this._keys=a,this._values=o,i.readFields(i_,this,e)}function i_(i,e,r){i==1?e.id=r.readVarint():i==2?function(a,o){for(var u=a.readVarint()+a.pos;a.pos<u;){var d=o._keys[a.readVarint()],f=o._values[a.readVarint()];o.properties[d]=f}}(r,e):i==3?e.type=r.readVarint():i==4&&(e._geometry=r.pos)}function r_(i){for(var e,r,a=0,o=0,u=i.length,d=u-1;o<u;d=o++)a+=((r=i[d]).x-(e=i[o]).x)*(e.y+r.y);return a}Us.types=["Unknown","Point","LineString","Polygon"],Us.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var e,r=i.readVarint()+i.pos,a=1,o=0,u=0,d=0,f=[];i.pos<r;){if(o<=0){var _=i.readVarint();a=7&_,o=_>>3}if(o--,a===1||a===2)u+=i.readSVarint(),d+=i.readSVarint(),a===1&&(e&&f.push(e),e=[]),e.push(new t_(u,d));else{if(a!==7)throw new Error("unknown command "+a);e&&e.push(e[0].clone())}}return e&&f.push(e),f},Us.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,a=0,o=0,u=0,d=1/0,f=-1/0,_=1/0,b=-1/0;i.pos<e;){if(a<=0){var T=i.readVarint();r=7&T,a=T>>3}if(a--,r===1||r===2)(o+=i.readSVarint())<d&&(d=o),o>f&&(f=o),(u+=i.readSVarint())<_&&(_=u),u>b&&(b=u);else if(r!==7)throw new Error("unknown command "+r)}return[d,_,f,b]},Us.prototype.toGeoJSON=function(i,e,r){var a,o,u=this.extent*Math.pow(2,r),d=this.extent*i,f=this.extent*e,_=this.loadGeometry(),b=Us.types[this.type];function T(z){for(var D=0;D<z.length;D++){var O=z[D];z[D]=[360*(O.x+d)/u-180,360/Math.PI*Math.atan(Math.exp((180-360*(O.y+f)/u)*Math.PI/180))-90]}}switch(this.type){case 1:var C=[];for(a=0;a<_.length;a++)C[a]=_[a][0];T(_=C);break;case 2:for(a=0;a<_.length;a++)T(_[a]);break;case 3:for(_=function(z){var D=z.length;if(D<=1)return[z];for(var O,G,W=[],ie=0;ie<D;ie++){var Y=r_(z[ie]);Y!==0&&(G===void 0&&(G=Y<0),G===Y<0?(O&&W.push(O),O=[z[ie]]):O.push(z[ie]))}return O&&W.push(O),W}(_),a=0;a<_.length;a++)for(o=0;o<_[a].length;o++)T(_[a][o])}_.length===1?_=_[0]:b="Multi"+b;var k={type:"Feature",geometry:{type:b,coordinates:_},properties:this.properties};return"id"in this&&(k.id=this.id),k};var n_=_d,vd=xd;function xd(i,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(a_,this,e),this.length=this._features.length}function a_(i,e,r){i===15?e.version=r.readVarint():i===1?e.name=r.readString():i===5?e.extent=r.readVarint():i===2?e._features.push(r.pos):i===3?e._keys.push(r.readString()):i===4&&e._values.push(function(a){for(var o=null,u=a.readVarint()+a.pos;a.pos<u;){var d=a.readVarint()>>3;o=d===1?a.readString():d===2?a.readFloat():d===3?a.readDouble():d===4?a.readVarint64():d===5?a.readVarint():d===6?a.readSVarint():d===7?a.readBoolean():null}return o}(r))}xd.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var e=this._pbf.readVarint()+this._pbf.pos;return new n_(this._pbf,e,this.extent,this._keys,this._values)};var s_=vd;function o_(i,e,r){if(i===3){var a=new s_(r,r.readVarint()+r.pos);a.length&&(e[a.name]=a)}}ba.VectorTile=function(i,e){this.layers=i.readFields(o_,{},e)},ba.VectorTileFeature=_d,ba.VectorTileLayer=vd;const l_=ba.VectorTileFeature.types,Fh=Math.pow(2,13);function Ko(i,e,r,a,o,u,d,f){i.emplaceBack(e,r,2*Math.floor(a*Fh)+d,o*Fh*2,u*Fh*2,Math.round(f))}class Oh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Ce,this.centroidVertexArray=new be,this.indexArray=new Li,this.programConfigurations=new un(e.layers,e.zoom),this.segments=new Xt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,a){this.features=[],this.hasPattern=Dh("fill-extrusion",this.layers,r);for(const{feature:o,id:u,index:d,sourceLayerIndex:f}of e){const _=this.layers[0]._featureFilter.needGeometry,b=Ja(o,_);if(!this.layers[0]._featureFilter.filter(new Kt(this.zoom),b,a))continue;const T={id:u,sourceLayerIndex:f,index:d,geometry:_?b.geometry:Ya(o),properties:o.properties,type:o.type,patterns:{}};this.hasPattern?this.features.push(Rh("fill-extrusion",this.layers,T,this.zoom,r)):this.addFeature(T,T.geometry,d,a,{}),r.featureIndex.insert(o,T.geometry,d,f,this.index,!0)}}addFeatures(e,r,a){for(const o of this.features){const{geometry:u}=o;this.addFeature(o,u,o.index,r,a)}}update(e,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,a)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,e_),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Qy.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,r,a,o,u){const d={x:0,y:0,vertexCount:0};for(const f of zh(r,500)){let _=0;for(const D of f)_+=D.length;let b=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const D of f){if(D.length===0||h_(D))continue;let O=0;for(let G=0;G<D.length;G++){const W=D[G];if(G>=1){const ie=D[G-1];if(!c_(W,ie)){b.vertexLength+4>Xt.MAX_VERTEX_ARRAY_LENGTH&&(b=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const Y=W.sub(ie)._perp()._unit(),ne=ie.dist(W);O+ne>32768&&(O=0),Ko(this.layoutVertexArray,W.x,W.y,Y.x,Y.y,0,0,O),Ko(this.layoutVertexArray,W.x,W.y,Y.x,Y.y,0,1,O),d.x+=2*W.x,d.y+=2*W.y,d.vertexCount+=2,O+=ne,Ko(this.layoutVertexArray,ie.x,ie.y,Y.x,Y.y,0,0,O),Ko(this.layoutVertexArray,ie.x,ie.y,Y.x,Y.y,0,1,O),d.x+=2*ie.x,d.y+=2*ie.y,d.vertexCount+=2;const oe=b.vertexLength;this.indexArray.emplaceBack(oe,oe+2,oe+1),this.indexArray.emplaceBack(oe+1,oe+2,oe+3),b.vertexLength+=4,b.primitiveLength+=2}}}}if(b.vertexLength+_>Xt.MAX_VERTEX_ARRAY_LENGTH&&(b=this.segments.prepareSegment(_,this.layoutVertexArray,this.indexArray)),l_[e.type]!=="Polygon")continue;const T=[],C=[],k=b.vertexLength;for(const D of f)if(D.length!==0){D!==f[0]&&C.push(T.length/2);for(let O=0;O<D.length;O++){const G=D[O];Ko(this.layoutVertexArray,G.x,G.y,0,0,1,1,0),d.x+=G.x,d.y+=G.y,d.vertexCount+=1,T.push(G.x),T.push(G.y)}}const z=md(T,C);for(let D=0;D<z.length;D+=3)this.indexArray.emplaceBack(k+z[D],k+z[D+2],k+z[D+1]);b.primitiveLength+=z.length/3,b.vertexLength+=_}for(let f=0;f<d.vertexCount;f++)this.centroidVertexArray.emplaceBack(Math.floor(d.x/d.vertexCount),Math.floor(d.y/d.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a,u,o)}}function c_(i,e){return i.x===e.x&&(i.x<0||i.x>_i)||i.y===e.y&&(i.y<0||i.y>_i)}function h_(i){return i.every(e=>e.x<0)||i.every(e=>e.x>_i)||i.every(e=>e.y<0)||i.every(e=>e.y>_i)}let bd;ze("FillExtrusionBucket",Oh,{omit:["layers","features"]});var u_={get paint(){return bd=bd||new di({"fill-extrusion-opacity":new Ve(ue["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ze(ue["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ve(ue["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ve(ue["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Wa(ue["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Ze(ue["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ze(ue["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ve(ue["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class p_ extends Cr{constructor(e){super(e,u_)}createBucket(e){return new Oh(e)}queryRadius(){return hc(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,r,a,o,u,d,f,_){const b=uc(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),d.angle,f),T=this.paint.get("fill-extrusion-height").evaluate(r,a),C=this.paint.get("fill-extrusion-base").evaluate(r,a),k=function(D,O,G,W){const ie=[];for(const Y of D){const ne=[Y.x,Y.y,0,1];pc(ne,ne,O),ie.push(new ye(ne[0]/ne[3],ne[1]/ne[3]))}return ie}(b,_),z=function(D,O,G,W){const ie=[],Y=[],ne=W[8]*O,oe=W[9]*O,fe=W[10]*O,Le=W[11]*O,Oe=W[8]*G,Pe=W[9]*G,Ee=W[10]*G,we=W[11]*G;for(const Re of D){const Te=[],xe=[];for(const je of Re){const Ue=je.x,lt=je.y,Yt=W[0]*Ue+W[4]*lt+W[12],ei=W[1]*Ue+W[5]*lt+W[13],Si=W[2]*Ue+W[6]*lt+W[14],Pr=W[3]*Ue+W[7]*lt+W[15],rr=Si+fe,vi=Pr+Le,Di=Yt+Oe,Vi=ei+Pe,nr=Si+Ee,ar=Pr+we,Ti=new ye((Yt+ne)/vi,(ei+oe)/vi);Ti.z=rr/vi,Te.push(Ti);const Ii=new ye(Di/ar,Vi/ar);Ii.z=nr/ar,xe.push(Ii)}ie.push(Te),Y.push(xe)}return[ie,Y]}(o,C,T,_);return function(D,O,G){let W=1/0;Jp(G,O)&&(W=wd(G,O[0]));for(let ie=0;ie<O.length;ie++){const Y=O[ie],ne=D[ie];for(let oe=0;oe<Y.length-1;oe++){const fe=Y[oe],Le=[fe,Y[oe+1],ne[oe+1],ne[oe],fe];Yp(G,Le)&&(W=Math.min(W,wd(G,Le)))}}return W!==1/0&&W}(z[0],z[1],k)}}function Xo(i,e){return i.x*e.x+i.y*e.y}function wd(i,e){if(i.length===1){let r=0;const a=e[r++];let o;for(;!o||a.equals(o);)if(o=e[r++],!o)return 1/0;for(;r<e.length;r++){const u=e[r],d=i[0],f=o.sub(a),_=u.sub(a),b=d.sub(a),T=Xo(f,f),C=Xo(f,_),k=Xo(_,_),z=Xo(b,f),D=Xo(b,_),O=T*k-C*C,G=(k*z-C*D)/O,W=(T*D-C*z)/O,ie=a.z*(1-G-W)+o.z*G+u.z*W;if(isFinite(ie))return ie}return 1/0}{let r=1/0;for(const a of e)r=Math.min(r,a.z);return r}}const d_=ni([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:m_}=d_,f_=ni([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:g_}=f_,y_=ba.VectorTileFeature.types,__=Math.cos(Math.PI/180*37.5),Sd=Math.pow(2,14)/.5;class Nh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new He,this.layoutVertexArray2=new Ne,this.indexArray=new Li,this.programConfigurations=new un(e.layers,e.zoom),this.segments=new Xt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,a){this.hasPattern=Dh("line",this.layers,r);const o=this.layers[0].layout.get("line-sort-key"),u=!o.isConstant(),d=[];for(const{feature:f,id:_,index:b,sourceLayerIndex:T}of e){const C=this.layers[0]._featureFilter.needGeometry,k=Ja(f,C);if(!this.layers[0]._featureFilter.filter(new Kt(this.zoom),k,a))continue;const z=u?o.evaluate(k,{},a):void 0,D={id:_,properties:f.properties,type:f.type,sourceLayerIndex:T,index:b,geometry:C?k.geometry:Ya(f),patterns:{},sortKey:z};d.push(D)}u&&d.sort((f,_)=>f.sortKey-_.sortKey);for(const f of d){const{geometry:_,index:b,sourceLayerIndex:T}=f;if(this.hasPattern){const C=Rh("line",this.layers,f,this.zoom,r);this.patternFeatures.push(C)}else this.addFeature(f,_,b,a,{});r.featureIndex.insert(e[b].feature,_,b,T,this.index)}}update(e,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,a)}addFeatures(e,r,a){for(const o of this.patternFeatures)this.addFeature(o,o.geometry,o.index,r,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,g_)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,m_),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,r,a,o,u){const d=this.layers[0].layout,f=d.get("line-join").evaluate(e,{}),_=d.get("line-cap"),b=d.get("line-miter-limit"),T=d.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const C of r)this.addLine(C,e,f,_,b,T);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a,u,o)}addLine(e,r,a,o,u,d){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let W=0;W<e.length-1;W++)this.totalDistance+=e[W].dist(e[W+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const f=y_[r.type]==="Polygon";let _=e.length;for(;_>=2&&e[_-1].equals(e[_-2]);)_--;let b=0;for(;b<_-1&&e[b].equals(e[b+1]);)b++;if(_<(f?3:2))return;a==="bevel"&&(u=1.05);const T=this.overscaling<=16?15*_i/(512*this.overscaling):0,C=this.segments.prepareSegment(10*_,this.layoutVertexArray,this.indexArray);let k,z,D,O,G;this.e1=this.e2=-1,f&&(k=e[_-2],G=e[b].sub(k)._unit()._perp());for(let W=b;W<_;W++){if(D=W===_-1?f?e[b+1]:void 0:e[W+1],D&&e[W].equals(D))continue;G&&(O=G),k&&(z=k),k=e[W],G=D?D.sub(k)._unit()._perp():O,O=O||G;let ie=O.add(G);ie.x===0&&ie.y===0||ie._unit();const Y=O.x*G.x+O.y*G.y,ne=ie.x*G.x+ie.y*G.y,oe=ne!==0?1/ne:1/0,fe=2*Math.sqrt(2-2*ne),Le=ne<__&&z&&D,Oe=O.x*G.y-O.y*G.x>0;if(Le&&W>b){const we=k.dist(z);if(we>2*T){const Re=k.sub(k.sub(z)._mult(T/we)._round());this.updateDistance(z,Re),this.addCurrentVertex(Re,O,0,0,C),z=Re}}const Pe=z&&D;let Ee=Pe?a:f?"butt":o;if(Pe&&Ee==="round"&&(oe<d?Ee="miter":oe<=2&&(Ee="fakeround")),Ee==="miter"&&oe>u&&(Ee="bevel"),Ee==="bevel"&&(oe>2&&(Ee="flipbevel"),oe<u&&(Ee="miter")),z&&this.updateDistance(z,k),Ee==="miter")ie._mult(oe),this.addCurrentVertex(k,ie,0,0,C);else if(Ee==="flipbevel"){if(oe>100)ie=G.mult(-1);else{const we=oe*O.add(G).mag()/O.sub(G).mag();ie._perp()._mult(we*(Oe?-1:1))}this.addCurrentVertex(k,ie,0,0,C),this.addCurrentVertex(k,ie.mult(-1),0,0,C)}else if(Ee==="bevel"||Ee==="fakeround"){const we=-Math.sqrt(oe*oe-1),Re=Oe?we:0,Te=Oe?0:we;if(z&&this.addCurrentVertex(k,O,Re,Te,C),Ee==="fakeround"){const xe=Math.round(180*fe/Math.PI/20);for(let je=1;je<xe;je++){let Ue=je/xe;if(Ue!==.5){const Yt=Ue-.5;Ue+=Ue*Yt*(Ue-1)*((1.0904+Y*(Y*(3.55645-1.43519*Y)-3.2452))*Yt*Yt+(.848013+Y*(.215638*Y-1.06021)))}const lt=G.sub(O)._mult(Ue)._add(O)._unit()._mult(Oe?-1:1);this.addHalfVertex(k,lt.x,lt.y,!1,Oe,0,C)}}D&&this.addCurrentVertex(k,G,-Re,-Te,C)}else if(Ee==="butt")this.addCurrentVertex(k,ie,0,0,C);else if(Ee==="square"){const we=z?1:-1;this.addCurrentVertex(k,ie,we,we,C)}else Ee==="round"&&(z&&(this.addCurrentVertex(k,O,0,0,C),this.addCurrentVertex(k,O,1,1,C,!0)),D&&(this.addCurrentVertex(k,G,-1,-1,C,!0),this.addCurrentVertex(k,G,0,0,C)));if(Le&&W<_-1){const we=k.dist(D);if(we>2*T){const Re=k.add(D.sub(k)._mult(T/we)._round());this.updateDistance(k,Re),this.addCurrentVertex(Re,G,0,0,C),k=Re}}}}addCurrentVertex(e,r,a,o,u,d=!1){const f=r.y*o-r.x,_=-r.y-r.x*o;this.addHalfVertex(e,r.x+r.y*a,r.y-r.x*a,d,!1,a,u),this.addHalfVertex(e,f,_,d,!0,-o,u),this.distance>Sd/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,r,a,o,u,d))}addHalfVertex({x:e,y:r},a,o,u,d,f,_){const b=.5*(this.lineClips?this.scaledDistance*(Sd-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(u?1:0),(r<<1)+(d?1:0),Math.round(63*a)+128,Math.round(63*o)+128,1+(f===0?0:f<0?-1:1)|(63&b)<<2,b>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const T=_.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,T),_.primitiveLength++),d?this.e2=T:this.e1=T}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}}let Td,Id;ze("LineBucket",Nh,{omit:["layers","patternFeatures"]});var Ad={get paint(){return Id=Id||new di({"line-opacity":new Ze(ue.paint_line["line-opacity"]),"line-color":new Ze(ue.paint_line["line-color"]),"line-translate":new Ve(ue.paint_line["line-translate"]),"line-translate-anchor":new Ve(ue.paint_line["line-translate-anchor"]),"line-width":new Ze(ue.paint_line["line-width"]),"line-gap-width":new Ze(ue.paint_line["line-gap-width"]),"line-offset":new Ze(ue.paint_line["line-offset"]),"line-blur":new Ze(ue.paint_line["line-blur"]),"line-dasharray":new zo(ue.paint_line["line-dasharray"]),"line-pattern":new Wa(ue.paint_line["line-pattern"]),"line-gradient":new Do(ue.paint_line["line-gradient"])})},get layout(){return Td=Td||new di({"line-cap":new Ve(ue.layout_line["line-cap"]),"line-join":new Ze(ue.layout_line["line-join"]),"line-miter-limit":new Ve(ue.layout_line["line-miter-limit"]),"line-round-limit":new Ve(ue.layout_line["line-round-limit"]),"line-sort-key":new Ze(ue.layout_line["line-sort-key"])})}};class v_ extends Ze{possiblyEvaluate(e,r){return r=new Kt(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(e,r)}evaluate(e,r,a,o){return r=Ke({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,a,o)}}let yc;class x_ extends Cr{constructor(e){super(e,Ad),this.gradientVersion=0,yc||(yc=new v_(Ad.paint.properties["line-width"].specification),yc.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){const r=this.gradientExpression();this.stepInterpolant=!!function(a){return a._styleExpression!==void 0}(r)&&r._styleExpression.expression instanceof In,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,r){super.recalculate(e,r),this.paint._values["line-floorwidth"]=yc.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Nh(e)}queryRadius(e){const r=e,a=Cd($o("line-width",this,r),$o("line-gap-width",this,r)),o=$o("line-offset",this,r);return a/2+Math.abs(o)+hc(this.paint.get("line-translate"))}queryIntersectsFeature(e,r,a,o,u,d,f){const _=uc(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),d.angle,f),b=f/2*Cd(this.paint.get("line-width").evaluate(r,a),this.paint.get("line-gap-width").evaluate(r,a)),T=this.paint.get("line-offset").evaluate(r,a);return T&&(o=function(C,k){const z=[];for(let D=0;D<C.length;D++){const O=C[D],G=[];for(let W=0;W<O.length;W++){const ie=O[W-1],Y=O[W],ne=O[W+1],oe=W===0?new ye(0,0):Y.sub(ie)._unit()._perp(),fe=W===O.length-1?new ye(0,0):ne.sub(Y)._unit()._perp(),Le=oe._add(fe)._unit(),Oe=Le.x*fe.x+Le.y*fe.y;Oe!==0&&Le._mult(1/Oe),G.push(Le._mult(k)._add(Y))}z.push(G)}return z}(o,T*f)),function(C,k,z){for(let D=0;D<k.length;D++){const O=k[D];if(C.length>=3){for(let G=0;G<O.length;G++)if(Fs(C,O[G]))return!0}if(Ay(C,O,z))return!0}return!1}(_,o,b)}isTileClipped(){return!0}}function Cd(i,e){return e>0?e+2*i:i}const b_=ni([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),w_=ni([{name:"a_projected_pos",components:3,type:"Float32"}],4);ni([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const S_=ni([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);ni([{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 Ed=ni([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),T_=ni([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function I_(i,e,r){return i.sections.forEach(a=>{a.text=function(o,u,d){const f=u.layout.get("text-transform").evaluate(d,{});return f==="uppercase"?o=o.toLocaleUpperCase():f==="lowercase"&&(o=o.toLocaleLowerCase()),ur.applyArabicShaping&&(o=ur.applyArabicShaping(o)),o}(a.text,e,r)}),i}ni([{name:"triangle",components:3,type:"Uint16"}]),ni([{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"}]),ni([{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"}]),ni([{type:"Float32",name:"offsetX"}]),ni([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),ni([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Yo={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"};var wi=24,Pd=Ut,kd=function(i,e,r,a,o){var u,d,f=8*o-a-1,_=(1<<f)-1,b=_>>1,T=-7,C=r?o-1:0,k=r?-1:1,z=i[e+C];for(C+=k,u=z&(1<<-T)-1,z>>=-T,T+=f;T>0;u=256*u+i[e+C],C+=k,T-=8);for(d=u&(1<<-T)-1,u>>=-T,T+=a;T>0;d=256*d+i[e+C],C+=k,T-=8);if(u===0)u=1-b;else{if(u===_)return d?NaN:1/0*(z?-1:1);d+=Math.pow(2,a),u-=b}return(z?-1:1)*d*Math.pow(2,u-a)},Md=function(i,e,r,a,o,u){var d,f,_,b=8*u-o-1,T=(1<<b)-1,C=T>>1,k=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,z=a?0:u-1,D=a?1:-1,O=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,d=T):(d=Math.floor(Math.log(e)/Math.LN2),e*(_=Math.pow(2,-d))<1&&(d--,_*=2),(e+=d+C>=1?k/_:k*Math.pow(2,1-C))*_>=2&&(d++,_/=2),d+C>=T?(f=0,d=T):d+C>=1?(f=(e*_-1)*Math.pow(2,o),d+=C):(f=e*Math.pow(2,C-1)*Math.pow(2,o),d=0));o>=8;i[r+z]=255&f,z+=D,f/=256,o-=8);for(d=d<<o|f,b+=o;b>0;i[r+z]=255&d,z+=D,d/=256,b-=8);i[r+z-D]|=128*O};function Ut(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}Ut.Varint=0,Ut.Fixed64=1,Ut.Bytes=2,Ut.Fixed32=5;var Uh=4294967296,Ld=1/Uh,zd=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Xn(i){return i.type===Ut.Bytes?i.readVarint()+i.pos:i.pos+1}function Vs(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function Dd(i,e,r){var a=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(a);for(var o=r.pos-1;o>=i;o--)r.buf[o+a]=r.buf[o]}function A_(i,e){for(var r=0;r<i.length;r++)e.writeVarint(i[r])}function C_(i,e){for(var r=0;r<i.length;r++)e.writeSVarint(i[r])}function E_(i,e){for(var r=0;r<i.length;r++)e.writeFloat(i[r])}function P_(i,e){for(var r=0;r<i.length;r++)e.writeDouble(i[r])}function k_(i,e){for(var r=0;r<i.length;r++)e.writeBoolean(i[r])}function M_(i,e){for(var r=0;r<i.length;r++)e.writeFixed32(i[r])}function L_(i,e){for(var r=0;r<i.length;r++)e.writeSFixed32(i[r])}function z_(i,e){for(var r=0;r<i.length;r++)e.writeFixed64(i[r])}function D_(i,e){for(var r=0;r<i.length;r++)e.writeSFixed64(i[r])}function _c(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+16777216*i[e+3]}function $s(i,e,r){i[r]=e,i[r+1]=e>>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function Rd(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}Ut.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos<r;){var a=this.readVarint(),o=a>>3,u=this.pos;this.type=7&a,i(o,e,this),this.pos===u&&this.skip(a)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=_c(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=Rd(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=_c(this.buf,this.pos)+_c(this.buf,this.pos+4)*Uh;return this.pos+=8,i},readSFixed64:function(){var i=_c(this.buf,this.pos)+Rd(this.buf,this.pos+4)*Uh;return this.pos+=8,i},readFloat:function(){var i=kd(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=kd(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,a=this.buf;return e=127&(r=a[this.pos++]),r<128?e:(e|=(127&(r=a[this.pos++]))<<7,r<128?e:(e|=(127&(r=a[this.pos++]))<<14,r<128?e:(e|=(127&(r=a[this.pos++]))<<21,r<128?e:function(o,u,d){var f,_,b=d.buf;if(f=(112&(_=b[d.pos++]))>>4,_<128||(f|=(127&(_=b[d.pos++]))<<3,_<128)||(f|=(127&(_=b[d.pos++]))<<10,_<128)||(f|=(127&(_=b[d.pos++]))<<17,_<128)||(f|=(127&(_=b[d.pos++]))<<24,_<128)||(f|=(1&(_=b[d.pos++]))<<31,_<128))return Vs(o,f,u);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=a[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var i=this.readVarint()+this.pos,e=this.pos;return this.pos=i,i-e>=12&&zd?function(r,a,o){return zd.decode(r.subarray(a,o))}(this.buf,e,i):function(r,a,o){for(var u="",d=a;d<o;){var f,_,b,T=r[d],C=null,k=T>239?4:T>223?3:T>191?2:1;if(d+k>o)break;k===1?T<128&&(C=T):k===2?(192&(f=r[d+1]))==128&&(C=(31&T)<<6|63&f)<=127&&(C=null):k===3?(_=r[d+2],(192&(f=r[d+1]))==128&&(192&_)==128&&((C=(15&T)<<12|(63&f)<<6|63&_)<=2047||C>=55296&&C<=57343)&&(C=null)):k===4&&(_=r[d+2],b=r[d+3],(192&(f=r[d+1]))==128&&(192&_)==128&&(192&b)==128&&((C=(15&T)<<18|(63&f)<<12|(63&_)<<6|63&b)<=65535||C>=1114112)&&(C=null)),C===null?(C=65533,k=1):C>65535&&(C-=65536,u+=String.fromCharCode(C>>>10&1023|55296),C=56320|1023&C),u+=String.fromCharCode(C),d+=k}return u}(this.buf,e,i)},readBytes:function(){var i=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,i);return this.pos=i,e},readPackedVarint:function(i,e){if(this.type!==Ut.Bytes)return i.push(this.readVarint(e));var r=Xn(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(e));return i},readPackedSVarint:function(i){if(this.type!==Ut.Bytes)return i.push(this.readSVarint());var e=Xn(this);for(i=i||[];this.pos<e;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==Ut.Bytes)return i.push(this.readBoolean());var e=Xn(this);for(i=i||[];this.pos<e;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==Ut.Bytes)return i.push(this.readFloat());var e=Xn(this);for(i=i||[];this.pos<e;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==Ut.Bytes)return i.push(this.readDouble());var e=Xn(this);for(i=i||[];this.pos<e;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==Ut.Bytes)return i.push(this.readFixed32());var e=Xn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==Ut.Bytes)return i.push(this.readSFixed32());var e=Xn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==Ut.Bytes)return i.push(this.readFixed64());var e=Xn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==Ut.Bytes)return i.push(this.readSFixed64());var e=Xn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed64());return i},skip:function(i){var e=7&i;if(e===Ut.Varint)for(;this.buf[this.pos++]>127;);else if(e===Ut.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Ut.Fixed32)this.pos+=4;else{if(e!==Ut.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e<this.pos+i;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(i){this.realloc(4),$s(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),$s(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),$s(this.buf,-1&i,this.pos),$s(this.buf,Math.floor(i*Ld),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),$s(this.buf,-1&i,this.pos),$s(this.buf,Math.floor(i*Ld),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?function(e,r){var a,o;if(e>=0?(a=e%4294967296|0,o=e/4294967296|0):(o=~(-e/4294967296),4294967295^(a=~(-e%4294967296))?a=a+1|0:(a=0,o=o+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(u,d,f){f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,f.buf[f.pos]=127&(u>>>=7)}(a,0,r),function(u,d){var f=(7&u)<<4;d.buf[d.pos++]|=f|((u>>>=3)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u)))))}(o,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(!!i)},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var e=this.pos;this.pos=function(a,o,u){for(var d,f,_=0;_<o.length;_++){if((d=o.charCodeAt(_))>55295&&d<57344){if(!f){d>56319||_+1===o.length?(a[u++]=239,a[u++]=191,a[u++]=189):f=d;continue}if(d<56320){a[u++]=239,a[u++]=191,a[u++]=189,f=d;continue}d=f-55296<<10|d-56320|65536,f=null}else f&&(a[u++]=239,a[u++]=191,a[u++]=189,f=null);d<128?a[u++]=d:(d<2048?a[u++]=d>>6|192:(d<65536?a[u++]=d>>12|224:(a[u++]=d>>18|240,a[u++]=d>>12&63|128),a[u++]=d>>6&63|128),a[u++]=63&d|128)}return u}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&Dd(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Md(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Md(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=i[r]},writeRawMessage:function(i,e){this.pos++;var r=this.pos;i(e,this);var a=this.pos-r;a>=128&&Dd(r,a,this),this.pos=r-1,this.writeVarint(a),this.pos+=a},writeMessage:function(i,e,r){this.writeTag(i,Ut.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,A_,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,C_,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,k_,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,E_,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,P_,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,M_,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,L_,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,z_,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,D_,e)},writeBytesField:function(i,e){this.writeTag(i,Ut.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,Ut.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,Ut.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,Ut.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,Ut.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,Ut.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,Ut.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,Ut.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,Ut.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,Ut.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,!!e)}};var Vh=H(Pd);const $h=3;function R_(i,e,r){i===1&&r.readMessage(B_,e)}function B_(i,e,r){if(i===3){const{id:a,bitmap:o,width:u,height:d,left:f,top:_,advance:b}=r.readMessage(F_,{});e.push({id:a,bitmap:new Go({width:u+2*$h,height:d+2*$h},o),metrics:{width:u,height:d,left:f,top:_,advance:b}})}}function F_(i,e,r){i===1?e.id=r.readVarint():i===2?e.bitmap=r.readBytes():i===3?e.width=r.readVarint():i===4?e.height=r.readVarint():i===5?e.left=r.readSVarint():i===6?e.top=r.readSVarint():i===7&&(e.advance=r.readVarint())}const Bd=$h;function Fd(i){let e=0,r=0;for(const d of i)e+=d.w*d.h,r=Math.max(r,d.w);i.sort((d,f)=>f.h-d.h);const a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let o=0,u=0;for(const d of i)for(let f=a.length-1;f>=0;f--){const _=a[f];if(!(d.w>_.w||d.h>_.h)){if(d.x=_.x,d.y=_.y,u=Math.max(u,d.y+d.h),o=Math.max(o,d.x+d.w),d.w===_.w&&d.h===_.h){const b=a.pop();f<a.length&&(a[f]=b)}else d.h===_.h?(_.x+=d.w,_.w-=d.w):d.w===_.w?(_.y+=d.h,_.h-=d.h):(a.push({x:_.x+d.w,y:_.y,w:_.w-d.w,h:d.h}),_.y+=d.h,_.h-=d.h);break}}return{w:o,h:u,fill:e/(o*u)||0}}const dr=1;class jh{constructor(e,{pixelRatio:r,version:a,stretchX:o,stretchY:u,content:d}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=o,this.stretchY=u,this.content=d,this.version=a}get tl(){return[this.paddedRect.x+dr,this.paddedRect.y+dr]}get br(){return[this.paddedRect.x+this.paddedRect.w-dr,this.paddedRect.y+this.paddedRect.h-dr]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*dr)/this.pixelRatio,(this.paddedRect.h-2*dr)/this.pixelRatio]}}class Od{constructor(e,r){const a={},o={};this.haveRenderCallbacks=[];const u=[];this.addImages(e,a,u),this.addImages(r,o,u);const{w:d,h:f}=Fd(u),_=new Dr({width:d||1,height:f||1});for(const b in e){const T=e[b],C=a[b].paddedRect;Dr.copy(T.data,_,{x:0,y:0},{x:C.x+dr,y:C.y+dr},T.data)}for(const b in r){const T=r[b],C=o[b].paddedRect,k=C.x+dr,z=C.y+dr,D=T.data.width,O=T.data.height;Dr.copy(T.data,_,{x:0,y:0},{x:k,y:z},T.data),Dr.copy(T.data,_,{x:0,y:O-1},{x:k,y:z-1},{width:D,height:1}),Dr.copy(T.data,_,{x:0,y:0},{x:k,y:z+O},{width:D,height:1}),Dr.copy(T.data,_,{x:D-1,y:0},{x:k-1,y:z},{width:1,height:O}),Dr.copy(T.data,_,{x:0,y:0},{x:k+D,y:z},{width:1,height:O})}this.image=_,this.iconPositions=a,this.patternPositions=o}addImages(e,r,a){for(const o in e){const u=e[o],d={x:0,y:0,w:u.data.width+2*dr,h:u.data.height+2*dr};a.push(d),r[o]=new jh(d,u),u.hasRenderCallback&&this.haveRenderCallbacks.push(o)}}patchUpdatedImages(e,r){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const a in e.updatedImages)this.patchUpdatedImage(this.iconPositions[a],e.getImage(a),r),this.patchUpdatedImage(this.patternPositions[a],e.getImage(a),r)}patchUpdatedImage(e,r,a){if(!e||!r||e.version===r.version)return;e.version=r.version;const[o,u]=e.tl;a.update(r.data,void 0,{x:o,y:u})}}var wa;ze("ImagePosition",jh),ze("ImageAtlas",Od),l.ai=void 0,(wa=l.ai||(l.ai={}))[wa.none=0]="none",wa[wa.horizontal=1]="horizontal",wa[wa.vertical=2]="vertical",wa[wa.horizontalOnly=3]="horizontalOnly";const Jo=-17;class Qo{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){const a=new Qo;return a.scale=e||1,a.fontStack=r,a}static forImage(e){const r=new Qo;return r.imageName=e,r}}class js{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){const a=new js;for(let o=0;o<e.sections.length;o++){const u=e.sections[o];u.image?a.addImageSection(u):a.addTextSection(u,r)}return a}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}getCharCode(e){return this.text.charCodeAt(e)}verticalizePunctuation(){this.text=function(e){let r="";for(let a=0;a<e.length;a++){const o=e.charCodeAt(a+1)||null,u=e.charCodeAt(a-1)||null;r+=o&&Ql(o)&&!Yo[e[a+1]]||u&&Ql(u)&&!Yo[e[a-1]]||!Yo[e[a]]?e[a]:Yo[e[a]]}return r}(this.text)}trim(){let e=0;for(let a=0;a<this.text.length&&xc[this.text.charCodeAt(a)];a++)e++;let r=this.text.length;for(let a=this.text.length-1;a>=0&&a>=e&&xc[this.text.charCodeAt(a)];a--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const a=new js;return a.text=this.text.substring(e,r),a.sectionIndex=this.sectionIndex.slice(e,r),a.sections=this.sections,a}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}addTextSection(e,r){this.text+=e.text,this.sections.push(Qo.forText(e.scale,e.fontStack||r));const a=this.sections.length-1;for(let o=0;o<e.text.length;++o)this.sectionIndex.push(a)}addImageSection(e){const r=e.image?e.image.name:"";if(r.length===0)return void rt("Can't add FormattedSection with an empty image.");const a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCharCode(a),this.sections.push(Qo.forImage(r)),this.sectionIndex.push(this.sections.length-1)):rt("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function vc(i,e,r,a,o,u,d,f,_,b,T,C,k,z,D,O){const G=js.fromFeature(i,o);let W;C===l.ai.vertical&&G.verticalizePunctuation();const{processBidirectionalText:ie,processStyledBidirectionalText:Y}=ur;if(ie&&G.sections.length===1){W=[];const fe=ie(G.toString(),Gh(G,b,u,e,a,z,D));for(const Le of fe){const Oe=new js;Oe.text=Le,Oe.sections=G.sections;for(let Pe=0;Pe<Le.length;Pe++)Oe.sectionIndex.push(0);W.push(Oe)}}else if(Y){W=[];const fe=Y(G.text,G.sectionIndex,Gh(G,b,u,e,a,z,D));for(const Le of fe){const Oe=new js;Oe.text=Le[0],Oe.sectionIndex=Le[1],Oe.sections=G.sections,W.push(Oe)}}else W=function(fe,Le){const Oe=[],Pe=fe.text;let Ee=0;for(const we of Le)Oe.push(fe.substring(Ee,we)),Ee=we;return Ee<Pe.length&&Oe.push(fe.substring(Ee,Pe.length)),Oe}(G,Gh(G,b,u,e,a,z,D));const ne=[],oe={positionedLines:ne,text:G.toString(),top:T[1],bottom:T[1],left:T[0],right:T[0],writingMode:C,iconsInText:!1,verticalizable:!1};return function(fe,Le,Oe,Pe,Ee,we,Re,Te,xe,je,Ue,lt){let Yt=0,ei=Jo,Si=0,Pr=0;const rr=Te==="right"?1:Te==="left"?0:.5;let vi=0;for(const Ti of Ee){Ti.trim();const Ii=Ti.getMaxScale(),Wi=(Ii-1)*wi,sr={positionedGlyphs:[],lineOffset:0};fe.positionedLines[vi]=sr;const Ki=sr.positionedGlyphs;let mr=0;if(!Ti.length()){ei+=we,++vi;continue}for(let Ai=0;Ai<Ti.length();Ai++){const yt=Ti.getSection(Ai),Xi=Ti.getSectionIndex(Ai),$i=Ti.getCharCode(Ai);let Ci=0,Jr=null,pn=null,dn=null,Yn=wi;const Qr=!(xe===l.ai.horizontal||!Ue&&!Io($i)||Ue&&(xc[$i]||(Di=$i,Me.Arabic(Di)||Me["Arabic Supplement"](Di)||Me["Arabic Extended-A"](Di)||Me["Arabic Presentation Forms-A"](Di)||Me["Arabic Presentation Forms-B"](Di))));if(yt.imageName){const Br=Pe[yt.imageName];if(!Br)continue;dn=yt.imageName,fe.iconsInText=fe.iconsInText||!0,pn=Br.paddedRect;const gr=Br.displaySize;yt.scale=yt.scale*wi/lt,Jr={width:gr[0],height:gr[1],left:dr,top:-Bd,advance:Qr?gr[1]:gr[0]},Ci=Wi+(wi-gr[1]*yt.scale),Yn=Jr.advance;const Jn=Qr?gr[0]*yt.scale-wi*Ii:gr[1]*yt.scale-wi*Ii;Jn>0&&Jn>mr&&(mr=Jn)}else{const Br=Oe[yt.fontStack],gr=Br&&Br[$i];if(gr&&gr.rect)pn=gr.rect,Jr=gr.metrics;else{const Jn=Le[yt.fontStack],nl=Jn&&Jn[$i];if(!nl)continue;Jr=nl.metrics}Ci=(Ii-yt.scale)*wi}Qr?(fe.verticalizable=!0,Ki.push({glyph:$i,imageName:dn,x:Yt,y:ei+Ci,vertical:Qr,scale:yt.scale,fontStack:yt.fontStack,sectionIndex:Xi,metrics:Jr,rect:pn}),Yt+=Yn*yt.scale+je):(Ki.push({glyph:$i,imageName:dn,x:Yt,y:ei+Ci,vertical:Qr,scale:yt.scale,fontStack:yt.fontStack,sectionIndex:Xi,metrics:Jr,rect:pn}),Yt+=Jr.advance*yt.scale+je)}Ki.length!==0&&(Si=Math.max(Yt-je,Si),U_(Ki,0,Ki.length-1,rr,mr)),Yt=0;const fr=we*Ii+mr;sr.lineOffset=Math.max(mr,Wi),ei+=fr,Pr=Math.max(fr,Pr),++vi}var Di;const Vi=ei-Jo,{horizontalAlign:nr,verticalAlign:ar}=qh(Re);(function(Ti,Ii,Wi,sr,Ki,mr,fr,Ai,yt){const Xi=(Ii-Wi)*Ki;let $i=0;$i=mr!==fr?-Ai*sr-Jo:(-sr*yt+.5)*fr;for(const Ci of Ti)for(const Jr of Ci.positionedGlyphs)Jr.x+=Xi,Jr.y+=$i})(fe.positionedLines,rr,nr,ar,Si,Pr,we,Vi,Ee.length),fe.top+=-ar*Vi,fe.bottom=fe.top+Vi,fe.left+=-nr*Si,fe.right=fe.left+Si}(oe,e,r,a,W,d,f,_,C,b,k,O),!function(fe){for(const Le of fe)if(Le.positionedGlyphs.length!==0)return!1;return!0}(ne)&&oe}const xc={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},O_={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Nd(i,e,r,a,o,u){if(e.imageName){const d=a[e.imageName];return d?d.displaySize[0]*e.scale*wi/u+o:0}{const d=r[e.fontStack],f=d&&d[i];return f?f.metrics.advance*e.scale+o:0}}function Ud(i,e,r,a){const o=Math.pow(i-e,2);return a?i<e?o/2:2*o:o+Math.abs(r)*r}function N_(i,e,r){let a=0;return i===10&&(a-=1e4),r&&(a+=150),i!==40&&i!==65288||(a+=50),e!==41&&e!==65289||(a+=50),a}function Vd(i,e,r,a,o,u){let d=null,f=Ud(e,r,o,u);for(const _ of a){const b=Ud(e-_.x,r,o,u)+_.badness;b<=f&&(d=_,f=b)}return{index:i,x:e,priorBreak:d,badness:f}}function $d(i){return i?$d(i.priorBreak).concat(i.index):[]}function Gh(i,e,r,a,o,u,d){if(u!=="point")return[];if(!i)return[];const f=[],_=function(k,z,D,O,G,W){let ie=0;for(let Y=0;Y<k.length();Y++){const ne=k.getSection(Y);ie+=Nd(k.getCharCode(Y),ne,O,G,z,W)}return ie/Math.max(1,Math.ceil(ie/D))}(i,e,r,a,o,d),b=i.text.indexOf("\u200B")>=0;let T=0;for(let k=0;k<i.length();k++){const z=i.getSection(k),D=i.getCharCode(k);if(xc[D]||(T+=Nd(D,z,a,o,e,d)),k<i.length()-1){const O=!((C=D)<11904||!(Me["Bopomofo Extended"](C)||Me.Bopomofo(C)||Me["CJK Compatibility Forms"](C)||Me["CJK Compatibility Ideographs"](C)||Me["CJK Compatibility"](C)||Me["CJK Radicals Supplement"](C)||Me["CJK Strokes"](C)||Me["CJK Symbols and Punctuation"](C)||Me["CJK Unified Ideographs Extension A"](C)||Me["CJK Unified Ideographs"](C)||Me["Enclosed CJK Letters and Months"](C)||Me["Halfwidth and Fullwidth Forms"](C)||Me.Hiragana(C)||Me["Ideographic Description Characters"](C)||Me["Kangxi Radicals"](C)||Me["Katakana Phonetic Extensions"](C)||Me.Katakana(C)||Me["Vertical Forms"](C)||Me["Yi Radicals"](C)||Me["Yi Syllables"](C)));(O_[D]||O||z.imageName)&&f.push(Vd(k+1,T,_,f,N_(D,i.getCharCode(k+1),O&&b),!1))}}var C;return $d(Vd(i.length(),T,_,f,0,!0))}function qh(i){let e=.5,r=.5;switch(i){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(i){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function U_(i,e,r,a,o){if(!a&&!o)return;const u=i[r],d=(i[r].x+u.metrics.advance*u.scale)*a;for(let f=e;f<=r;f++)i[f].x-=d,i[f].y+=o}function V_(i,e,r){const{horizontalAlign:a,verticalAlign:o}=qh(r),u=e[0]-i.displaySize[0]*a,d=e[1]-i.displaySize[1]*o;return{image:i,top:d,bottom:d+i.displaySize[1],left:u,right:u+i.displaySize[0]}}function jd(i,e,r,a,o,u){const d=i.image;let f;if(d.content){const G=d.content,W=d.pixelRatio||1;f=[G[0]/W,G[1]/W,d.displaySize[0]-G[2]/W,d.displaySize[1]-G[3]/W]}const _=e.left*u,b=e.right*u;let T,C,k,z;r==="width"||r==="both"?(z=o[0]+_-a[3],C=o[0]+b+a[1]):(z=o[0]+(_+b-d.displaySize[0])/2,C=z+d.displaySize[0]);const D=e.top*u,O=e.bottom*u;return r==="height"||r==="both"?(T=o[1]+D-a[0],k=o[1]+O+a[2]):(T=o[1]+(D+O-d.displaySize[1])/2,k=T+d.displaySize[1]),{image:d,top:T,right:C,bottom:k,left:z,collisionPadding:f}}const el=255,kn=128,Sa=el*kn;function Gd(i,e){const{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Kt(i+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:a,interpolationType:o}=r;let u=0;for(;u<a.length&&a[u]<=i;)u++;u=Math.max(0,u-1);let d=u;for(;d<a.length&&a[d]<i+1;)d++;d=Math.min(a.length-1,d);const f=a[u],_=a[d];return r.kind==="composite"?{kind:"composite",minZoom:f,maxZoom:_,interpolationType:o}:{kind:"camera",minZoom:f,maxZoom:_,minSize:r.evaluate(new Kt(f)),maxSize:r.evaluate(new Kt(_)),interpolationType:o}}}function Zh(i,e,r){let a="never";const o=i.get(e);return o?a=o:i.get(r)&&(a="always"),a}const $_=ba.VectorTileFeature.types,j_=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function bc(i,e,r,a,o,u,d,f,_,b,T,C,k){const z=f?Math.min(Sa,Math.round(f[0])):0,D=f?Math.min(Sa,Math.round(f[1])):0;i.emplaceBack(e,r,Math.round(32*a),Math.round(32*o),u,d,(z<<1)+(_?1:0),D,16*b,16*T,256*C,256*k)}function Hh(i,e,r){i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r)}function G_(i){for(const e of i.sections)if(vh(e.text))return!0;return!1}class Wh{constructor(e){this.layoutVertexArray=new ut,this.indexArray=new Li,this.programConfigurations=e,this.segments=new Xt,this.dynamicLayoutVertexArray=new nt,this.opacityVertexArray=new ft,this.hasVisibleVertices=!1,this.placedSymbolArray=new Q}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,a,o){this.isEmpty()||(a&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,b_.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,w_.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,j_,!0),this.opacityVertexBuffer.itemSize=1),(a||o)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}ze("SymbolBuffers",Wh);class Kh{constructor(e,r,a){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new a,this.segments=new Xt,this.collisionVertexArray=new Ht}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,S_.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}ze("CollisionBuffers",Kh);class Gs{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(d=>d.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Ah([]),this.placementViewportMatrix=Ah([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Gd(this.zoom,r["text-size"]),this.iconSizeData=Gd(this.zoom,r["icon-size"]);const a=this.layers[0].layout,o=a.get("symbol-sort-key"),u=a.get("symbol-z-order");this.canOverlap=Zh(a,"text-overlap","text-allow-overlap")!=="never"||Zh(a,"icon-overlap","icon-allow-overlap")!=="never"||a.get("text-ignore-placement")||a.get("icon-ignore-placement"),this.sortFeaturesByKey=u!=="viewport-y"&&!o.isConstant(),this.sortFeaturesByY=(u==="viewport-y"||u==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,a.get("symbol-placement")==="point"&&(this.writingModes=a.get("text-writing-mode").map(d=>l.ai[d])),this.stateDependentLayerIds=this.layers.filter(d=>d.isStateDependent()).map(d=>d.id),this.sourceID=e.sourceID}createArrays(){this.text=new Wh(new un(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Wh(new un(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new ee,this.lineVertexArray=new le,this.symbolInstances=new Z,this.textAnchorOffsets=new me}calculateGlyphDependencies(e,r,a,o,u){for(let d=0;d<e.length;d++)if(r[e.charCodeAt(d)]=!0,(a||o)&&u){const f=Yo[e.charAt(d)];f&&(r[f.charCodeAt(0)]=!0)}}populate(e,r,a){const o=this.layers[0],u=o.layout,d=u.get("text-font"),f=u.get("text-field"),_=u.get("icon-image"),b=(f.value.kind!=="constant"||f.value.value instanceof Oi&&!f.value.value.isEmpty()||f.value.value.toString().length>0)&&(d.value.kind!=="constant"||d.value.value.length>0),T=_.value.kind!=="constant"||!!_.value.value||Object.keys(_.parameters).length>0,C=u.get("symbol-sort-key");if(this.features=[],!b&&!T)return;const k=r.iconDependencies,z=r.glyphDependencies,D=r.availableImages,O=new Kt(this.zoom);for(const{feature:G,id:W,index:ie,sourceLayerIndex:Y}of e){const ne=o._featureFilter.needGeometry,oe=Ja(G,ne);if(!o._featureFilter.filter(O,oe,a))continue;let fe,Le;if(ne||(oe.geometry=Ya(G)),b){const Pe=o.getValueAndResolveTokens("text-field",oe,a,D),Ee=Oi.factory(Pe);G_(Ee)&&(this.hasRTLText=!0),(!this.hasRTLText||Mo()==="unavailable"||this.hasRTLText&&ur.isParsed())&&(fe=I_(Ee,o,oe))}if(T){const Pe=o.getValueAndResolveTokens("icon-image",oe,a,D);Le=Pe instanceof Mi?Pe:Mi.fromString(Pe)}if(!fe&&!Le)continue;const Oe=this.sortFeaturesByKey?C.evaluate(oe,{},a):void 0;if(this.features.push({id:W,text:fe,icon:Le,index:ie,sourceLayerIndex:Y,geometry:oe.geometry,properties:G.properties,type:$_[G.type],sortKey:Oe}),Le&&(k[Le.name]=!0),fe){const Pe=d.evaluate(oe,{},a).join(","),Ee=u.get("text-rotation-alignment")!=="viewport"&&u.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(l.ai.vertical)>=0;for(const we of fe.sections)if(we.image)k[we.image.name]=!0;else{const Re=So(fe.toString()),Te=we.fontStack||Pe,xe=z[Te]=z[Te]||{};this.calculateGlyphDependencies(we.text,xe,Ee,this.allowVerticalPlacement,Re)}}}u.get("symbol-placement")==="line"&&(this.features=function(G){const W={},ie={},Y=[];let ne=0;function oe(Pe){Y.push(G[Pe]),ne++}function fe(Pe,Ee,we){const Re=ie[Pe];return delete ie[Pe],ie[Ee]=Re,Y[Re].geometry[0].pop(),Y[Re].geometry[0]=Y[Re].geometry[0].concat(we[0]),Re}function Le(Pe,Ee,we){const Re=W[Ee];return delete W[Ee],W[Pe]=Re,Y[Re].geometry[0].shift(),Y[Re].geometry[0]=we[0].concat(Y[Re].geometry[0]),Re}function Oe(Pe,Ee,we){const Re=we?Ee[0][Ee[0].length-1]:Ee[0][0];return`${Pe}:${Re.x}:${Re.y}`}for(let Pe=0;Pe<G.length;Pe++){const Ee=G[Pe],we=Ee.geometry,Re=Ee.text?Ee.text.toString():null;if(!Re){oe(Pe);continue}const Te=Oe(Re,we),xe=Oe(Re,we,!0);if(Te in ie&&xe in W&&ie[Te]!==W[xe]){const je=Le(Te,xe,we),Ue=fe(Te,xe,Y[je].geometry);delete W[Te],delete ie[xe],ie[Oe(Re,Y[Ue].geometry,!0)]=Ue,Y[je].geometry=null}else Te in ie?fe(Te,xe,we):xe in W?Le(Te,xe,we):(oe(Pe),W[Te]=ne-1,ie[xe]=ne-1)}return Y.filter(Pe=>Pe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((G,W)=>G.sortKey-W.sortKey)}update(e,r,a){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,a),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,a))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,r){const a=this.lineVertexArray.length;if(e.segment!==void 0){let o=e.dist(r[e.segment+1]),u=e.dist(r[e.segment]);const d={};for(let f=e.segment+1;f<r.length;f++)d[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:o},f<r.length-1&&(o+=r[f+1].dist(r[f]));for(let f=e.segment||0;f>=0;f--)d[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:u},f>0&&(u+=r[f-1].dist(r[f]));for(let f=0;f<r.length;f++){const _=d[f];this.lineVertexArray.emplaceBack(_.x,_.y,_.tileUnitDistanceFromAnchor)}}return{lineStartIndex:a,lineLength:this.lineVertexArray.length-a}}addSymbols(e,r,a,o,u,d,f,_,b,T,C,k){const z=e.indexArray,D=e.layoutVertexArray,O=e.segments.prepareSegment(4*r.length,D,z,this.canOverlap?d.sortKey:void 0),G=this.glyphOffsetArray.length,W=O.vertexLength,ie=this.allowVerticalPlacement&&f===l.ai.vertical?Math.PI/2:0,Y=d.text&&d.text.sections;for(let ne=0;ne<r.length;ne++){const{tl:oe,tr:fe,bl:Le,br:Oe,tex:Pe,pixelOffsetTL:Ee,pixelOffsetBR:we,minFontScaleX:Re,minFontScaleY:Te,glyphOffset:xe,isSDF:je,sectionIndex:Ue}=r[ne],lt=O.vertexLength,Yt=xe[1];bc(D,_.x,_.y,oe.x,Yt+oe.y,Pe.x,Pe.y,a,je,Ee.x,Ee.y,Re,Te),bc(D,_.x,_.y,fe.x,Yt+fe.y,Pe.x+Pe.w,Pe.y,a,je,we.x,Ee.y,Re,Te),bc(D,_.x,_.y,Le.x,Yt+Le.y,Pe.x,Pe.y+Pe.h,a,je,Ee.x,we.y,Re,Te),bc(D,_.x,_.y,Oe.x,Yt+Oe.y,Pe.x+Pe.w,Pe.y+Pe.h,a,je,we.x,we.y,Re,Te),Hh(e.dynamicLayoutVertexArray,_,ie),z.emplaceBack(lt,lt+1,lt+2),z.emplaceBack(lt+1,lt+2,lt+3),O.vertexLength+=4,O.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(xe[0]),ne!==r.length-1&&Ue===r[ne+1].sectionIndex||e.programConfigurations.populatePaintArrays(D.length,d,d.index,{},k,Y&&Y[Ue])}e.placedSymbolArray.emplaceBack(_.x,_.y,G,this.glyphOffsetArray.length-G,W,b,T,_.segment,a?a[0]:0,a?a[1]:0,o[0],o[1],f,0,!1,0,C)}_addCollisionDebugVertex(e,r,a,o,u,d){return r.emplaceBack(0,0),e.emplaceBack(a.x,a.y,o,u,Math.round(d.x),Math.round(d.y))}addCollisionDebugVertices(e,r,a,o,u,d,f){const _=u.segments.prepareSegment(4,u.layoutVertexArray,u.indexArray),b=_.vertexLength,T=u.layoutVertexArray,C=u.collisionVertexArray,k=f.anchorX,z=f.anchorY;this._addCollisionDebugVertex(T,C,d,k,z,new ye(e,r)),this._addCollisionDebugVertex(T,C,d,k,z,new ye(a,r)),this._addCollisionDebugVertex(T,C,d,k,z,new ye(a,o)),this._addCollisionDebugVertex(T,C,d,k,z,new ye(e,o)),_.vertexLength+=4;const D=u.indexArray;D.emplaceBack(b,b+1),D.emplaceBack(b+1,b+2),D.emplaceBack(b+2,b+3),D.emplaceBack(b+3,b),_.primitiveLength+=4}addDebugCollisionBoxes(e,r,a,o){for(let u=e;u<r;u++){const d=this.collisionBoxArray.get(u);this.addCollisionDebugVertices(d.x1,d.y1,d.x2,d.y2,o?this.textCollisionBox:this.iconCollisionBox,d.anchorPoint,a)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Kh(hi,Ed.members,xi),this.iconCollisionBox=new Kh(hi,Ed.members,xi);for(let e=0;e<this.symbolInstances.length;e++){const r=this.symbolInstances.get(e);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(e,r,a,o,u,d,f,_,b){const T={};for(let C=r;C<a;C++){const k=e.get(C);T.textBox={x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2,anchorPointX:k.anchorPointX,anchorPointY:k.anchorPointY},T.textFeatureIndex=k.featureIndex;break}for(let C=o;C<u;C++){const k=e.get(C);T.verticalTextBox={x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2,anchorPointX:k.anchorPointX,anchorPointY:k.anchorPointY},T.verticalTextFeatureIndex=k.featureIndex;break}for(let C=d;C<f;C++){const k=e.get(C);T.iconBox={x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2,anchorPointX:k.anchorPointX,anchorPointY:k.anchorPointY},T.iconFeatureIndex=k.featureIndex;break}for(let C=_;C<b;C++){const k=e.get(C);T.verticalIconBox={x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2,anchorPointX:k.anchorPointX,anchorPointY:k.anchorPointY},T.verticalIconFeatureIndex=k.featureIndex;break}return T}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const a=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,a.textBoxStartIndex,a.textBoxEndIndex,a.verticalTextBoxStartIndex,a.verticalTextBoxEndIndex,a.iconBoxStartIndex,a.iconBoxEndIndex,a.verticalIconBoxStartIndex,a.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(e,r){const a=e.placedSymbolArray.get(r),o=a.vertexStartIndex+4*a.numGlyphs;for(let u=a.vertexStartIndex;u<o;u+=4)e.indexArray.emplaceBack(u,u+1,u+2),e.indexArray.emplaceBack(u+1,u+2,u+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(e),a=Math.cos(e),o=[],u=[],d=[];for(let f=0;f<this.symbolInstances.length;++f){d.push(f);const _=this.symbolInstances.get(f);o.push(0|Math.round(r*_.anchorX+a*_.anchorY)),u.push(_.featureIndex)}return d.sort((f,_)=>o[f]-o[_]||u[_]-u[f]),d}addToSortKeyRanges(e,r){const a=this.sortKeyRanges[this.sortKeyRanges.length-1];a&&a.sortKey===r?a.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const a=this.symbolInstances.get(r);this.featureSortOrder.push(a.featureIndex),[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex].forEach((o,u,d)=>{o>=0&&d.indexOf(o)===u&&this.addIndicesForPlacedSymbol(this.text,o)}),a.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,a.verticalPlacedTextSymbolIndex),a.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.placedIconSymbolIndex),a.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let qd,Zd;ze("SymbolBucket",Gs,{omit:["layers","collisionBoxArray","features","compareText"]}),Gs.MAX_GLYPHS=65535,Gs.addDynamicAttributes=Hh;var Xh={get paint(){return Zd=Zd||new di({"icon-opacity":new Ze(ue.paint_symbol["icon-opacity"]),"icon-color":new Ze(ue.paint_symbol["icon-color"]),"icon-halo-color":new Ze(ue.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ze(ue.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ze(ue.paint_symbol["icon-halo-blur"]),"icon-translate":new Ve(ue.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ve(ue.paint_symbol["icon-translate-anchor"]),"text-opacity":new Ze(ue.paint_symbol["text-opacity"]),"text-color":new Ze(ue.paint_symbol["text-color"],{runtimeType:qi,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new Ze(ue.paint_symbol["text-halo-color"]),"text-halo-width":new Ze(ue.paint_symbol["text-halo-width"]),"text-halo-blur":new Ze(ue.paint_symbol["text-halo-blur"]),"text-translate":new Ve(ue.paint_symbol["text-translate"]),"text-translate-anchor":new Ve(ue.paint_symbol["text-translate-anchor"])})},get layout(){return qd=qd||new di({"symbol-placement":new Ve(ue.layout_symbol["symbol-placement"]),"symbol-spacing":new Ve(ue.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ve(ue.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ze(ue.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ve(ue.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ve(ue.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ve(ue.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ve(ue.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ve(ue.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ve(ue.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ze(ue.layout_symbol["icon-size"]),"icon-text-fit":new Ve(ue.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ve(ue.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ze(ue.layout_symbol["icon-image"]),"icon-rotate":new Ze(ue.layout_symbol["icon-rotate"]),"icon-padding":new Ze(ue.layout_symbol["icon-padding"]),"icon-keep-upright":new Ve(ue.layout_symbol["icon-keep-upright"]),"icon-offset":new Ze(ue.layout_symbol["icon-offset"]),"icon-anchor":new Ze(ue.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ve(ue.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ve(ue.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ve(ue.layout_symbol["text-rotation-alignment"]),"text-field":new Ze(ue.layout_symbol["text-field"]),"text-font":new Ze(ue.layout_symbol["text-font"]),"text-size":new Ze(ue.layout_symbol["text-size"]),"text-max-width":new Ze(ue.layout_symbol["text-max-width"]),"text-line-height":new Ve(ue.layout_symbol["text-line-height"]),"text-letter-spacing":new Ze(ue.layout_symbol["text-letter-spacing"]),"text-justify":new Ze(ue.layout_symbol["text-justify"]),"text-radial-offset":new Ze(ue.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ve(ue.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Ze(ue.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Ze(ue.layout_symbol["text-anchor"]),"text-max-angle":new Ve(ue.layout_symbol["text-max-angle"]),"text-writing-mode":new Ve(ue.layout_symbol["text-writing-mode"]),"text-rotate":new Ze(ue.layout_symbol["text-rotate"]),"text-padding":new Ve(ue.layout_symbol["text-padding"]),"text-keep-upright":new Ve(ue.layout_symbol["text-keep-upright"]),"text-transform":new Ze(ue.layout_symbol["text-transform"]),"text-offset":new Ze(ue.layout_symbol["text-offset"]),"text-allow-overlap":new Ve(ue.layout_symbol["text-allow-overlap"]),"text-overlap":new Ve(ue.layout_symbol["text-overlap"]),"text-ignore-placement":new Ve(ue.layout_symbol["text-ignore-placement"]),"text-optional":new Ve(ue.layout_symbol["text-optional"])})}};class Hd{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:nn,this.defaultValue=e}evaluate(e){if(e.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}ze("FormatSectionOverride",Hd,{omit:["defaultValue"]});class wc extends Cr{constructor(e){super(e,Xh)}recalculate(e,r){if(super.recalculate(e,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const a=this.layout.get("text-writing-mode");if(a){const o=[];for(const u of a)o.indexOf(u)<0&&o.push(u);this.layout._values["text-writing-mode"]=o}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,a,o){const u=this.layout.get(e).evaluate(r,{},a,o),d=this._unevaluatedLayout._values[e];return d.isDataDriven()||Ts(d.value)||!u?u:function(f,_){return _.replace(/{([^{}]+)}/g,(b,T)=>T in f?String(f[T]):"")}(r.properties,u)}createBucket(e){return new Gs(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of Xh.paint.overridableProperties){if(!wc.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),a=new Hd(r),o=new yo(a,r.property.specification);let u=null;u=r.value.kind==="constant"||r.value.kind==="source"?new _o("source",o):new As("composite",o,r.value.zoomStops),this.paint._values[e]=new Zi(r.property,u,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,a){return!(!this.layout||r.isDataDriven()||a.isDataDriven())&&wc.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const a=e.get("text-field"),o=Xh.paint.properties[r];let u=!1;const d=f=>{for(const _ of f)if(o.overrides&&o.overrides.hasOverride(_))return void(u=!0)};if(a.value.kind==="constant"&&a.value.value instanceof Oi)d(a.value.value.sections);else if(a.value.kind==="source"){const f=b=>{u||(b instanceof On&&ti(b.value)===V?d(b.value.sections):b instanceof Ss?d(b.sections):b.eachChild(f))},_=a.value;_._styleExpression&&f(_._styleExpression.expression)}return u}}let Wd;var q_={get paint(){return Wd=Wd||new di({"background-color":new Ve(ue.paint_background["background-color"]),"background-pattern":new zo(ue.paint_background["background-pattern"]),"background-opacity":new Ve(ue.paint_background["background-opacity"])})}};class Z_ extends Cr{constructor(e){super(e,q_)}}let Kd;var H_={get paint(){return Kd=Kd||new di({"raster-opacity":new Ve(ue.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ve(ue.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ve(ue.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ve(ue.paint_raster["raster-brightness-max"]),"raster-saturation":new Ve(ue.paint_raster["raster-saturation"]),"raster-contrast":new Ve(ue.paint_raster["raster-contrast"]),"raster-resampling":new Ve(ue.paint_raster["raster-resampling"]),"raster-fade-duration":new Ve(ue.paint_raster["raster-fade-duration"])})}};class W_ extends Cr{constructor(e){super(e,H_)}}class K_ extends Cr{constructor(e){super(e,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class X_{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const Yh=63710088e-1;class Ta{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Ta(bt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const r=Math.PI/180,a=this.lat*r,o=e.lat*r,u=Math.sin(a)*Math.sin(o)+Math.cos(a)*Math.cos(o)*Math.cos((e.lng-this.lng)*r);return Yh*Math.acos(Math.min(u,1))}static convert(e){if(e instanceof Ta)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Ta(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Ta(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const Xd=2*Math.PI*Yh;function Yd(i){return Xd*Math.cos(i*Math.PI/180)}function Jd(i){return(180+i)/360}function Qd(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function em(i,e){return i/Yd(e)}function Jh(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class Sc{constructor(e,r,a=0){this.x=+e,this.y=+r,this.z=+a}static fromLngLat(e,r=0){const a=Ta.convert(e);return new Sc(Jd(a.lng),Qd(a.lat),em(r,a.lat))}toLngLat(){return new Ta(360*this.x-180,Jh(this.y))}toAltitude(){return this.z*Yd(Jh(this.y))}meterInMercatorCoordinateUnits(){return 1/Xd*(e=Jh(this.y),1/Math.cos(e*Math.PI/180));var e}}function tm(i,e,r){var a=2*Math.PI*6378137/256/Math.pow(2,r);return[i*a-2*Math.PI*6378137/2,e*a-2*Math.PI*6378137/2]}class Qh{constructor(e,r,a){if(e<0||e>25||a<0||a>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error(`x=${r}, y=${a}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=r,this.y=a,this.key=tl(0,e,e,r,a)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,a){const o=(d=this.y,f=this.z,_=tm(256*(u=this.x),256*(d=Math.pow(2,f)-d-1),f),b=tm(256*(u+1),256*(d+1),f),_[0]+","+_[1]+","+b[0]+","+b[1]);var u,d,f,_,b;const T=function(C,k,z){let D,O="";for(let G=C;G>0;G--)D=1<<G-1,O+=(k&D?1:0)+(z&D?2:0);return O}(this.z,this.x,this.y);return e[(this.x+this.y)%e.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(a==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,T).replace(/{bbox-epsg-3857}/g,o)}isChildOf(e){const r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){const r=Math.pow(2,this.z);return new ye((e.x*r-this.x)*_i,(e.y*r-this.y)*_i)}toString(){return`${this.z}/${this.x}/${this.y}`}}class im{constructor(e,r){this.wrap=e,this.canonical=r,this.key=tl(e,r.z,r.z,r.x,r.y)}}class Rr{constructor(e,r,a,o,u){if(e<a)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${a}`);this.overscaledZ=e,this.wrap=r,this.canonical=new Qh(a,+o,+u),this.key=tl(r,e,a,o,u)}clone(){return new Rr(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-e;return e>this.canonical.z?new Rr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Rr(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const a=this.canonical.z-e;return e>this.canonical.z?tl(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):tl(this.wrap*+r,e,e,this.canonical.x>>a,this.canonical.y>>a)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new Rr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,a=2*this.canonical.x,o=2*this.canonical.y;return[new Rr(r,this.wrap,r,a,o),new Rr(r,this.wrap,r,a+1,o),new Rr(r,this.wrap,r,a,o+1),new Rr(r,this.wrap,r,a+1,o+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Rr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Rr(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new im(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new Sc(e.x-this.wrap,e.y))}}function tl(i,e,r,a,o){(i*=2)<0&&(i=-1*i-1);const u=1<<r;return(u*u*i+u*o+a).toString(36)+r.toString(36)+e.toString(36)}ze("CanonicalTileID",Qh),ze("OverscaledTileID",Rr,{omit:["posMatrix"]});class rm{constructor(e,r,a,o=1,u=1,d=1,f=0){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(a&&!["mapbox","terrarium","custom"].includes(a))return void rt(`"${a}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=r.height;const _=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),a){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=o,this.greenFactor=u,this.blueFactor=d,this.baseShift=f;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let b=0;b<_;b++)this.data[this._idx(-1,b)]=this.data[this._idx(0,b)],this.data[this._idx(_,b)]=this.data[this._idx(_-1,b)],this.data[this._idx(b,-1)]=this.data[this._idx(b,0)],this.data[this._idx(b,_)]=this.data[this._idx(b,_-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(_,-1)]=this.data[this._idx(_-1,0)],this.data[this._idx(-1,_)]=this.data[this._idx(0,_-1)],this.data[this._idx(_,_)]=this.data[this._idx(_-1,_-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let b=0;b<_;b++)for(let T=0;T<_;T++){const C=this.get(b,T);C>this.max&&(this.max=C),C<this.min&&(this.min=C)}}get(e,r){const a=new Uint8Array(this.data.buffer),o=4*this._idx(e,r);return this.unpack(a[o],a[o+1],a[o+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,r){if(e<-1||e>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(e+1)}unpack(e,r,a){return e*this.redFactor+r*this.greenFactor+a*this.blueFactor-this.baseShift}getPixels(){return new Dr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,a){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let o=r*this.dim,u=r*this.dim+this.dim,d=a*this.dim,f=a*this.dim+this.dim;switch(r){case-1:o=u-1;break;case 1:u=o+1}switch(a){case-1:d=f-1;break;case 1:f=d+1}const _=-r*this.dim,b=-a*this.dim;for(let T=d;T<f;T++)for(let C=o;C<u;C++)this.data[this._idx(C,T)]=e.data[this._idx(C+_,T+b)]}}ze("DEMData",rm);class nm{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){const a=e[r];this._stringToNumber[a]=r,this._numberToString[r]=a}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class am{constructor(e,r,a,o,u){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=a,e._y=o,this.properties=e.properties,this.id=u}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(e[r]=this[r]);return e}}class sm{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new ga(_i,16,0),this.grid3D=new ga(_i,16,0),this.featureIndexArray=new _e,this.promoteId=r}insert(e,r,a,o,u,d){const f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(a,o,u);const _=d?this.grid3D:this.grid;for(let b=0;b<r.length;b++){const T=r[b],C=[1/0,1/0,-1/0,-1/0];for(let k=0;k<T.length;k++){const z=T[k];C[0]=Math.min(C[0],z.x),C[1]=Math.min(C[1],z.y),C[2]=Math.max(C[2],z.x),C[3]=Math.max(C[3],z.y)}C[0]<_i&&C[1]<_i&&C[2]>=0&&C[3]>=0&&_.insert(f,C[0],C[1],C[2],C[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new ba.VectorTile(new Vh(this.rawTileData)).layers,this.sourceLayerCoder=new nm(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,a,o){this.loadVTLayers();const u=e.params||{},d=_i/e.tileSize/e.scale,f=xo(u.filter),_=e.queryGeometry,b=e.queryPadding*d,T=lm(_),C=this.grid.query(T.minX-b,T.minY-b,T.maxX+b,T.maxY+b),k=lm(e.cameraQueryGeometry),z=this.grid3D.query(k.minX-b,k.minY-b,k.maxX+b,k.maxY+b,(G,W,ie,Y)=>function(ne,oe,fe,Le,Oe){for(const Ee of ne)if(oe<=Ee.x&&fe<=Ee.y&&Le>=Ee.x&&Oe>=Ee.y)return!0;const Pe=[new ye(oe,fe),new ye(oe,Oe),new ye(Le,Oe),new ye(Le,fe)];if(ne.length>2){for(const Ee of Pe)if(Fs(ne,Ee))return!0}for(let Ee=0;Ee<ne.length-1;Ee++)if(Ey(ne[Ee],ne[Ee+1],Pe))return!0;return!1}(e.cameraQueryGeometry,G-b,W-b,ie+b,Y+b));for(const G of z)C.push(G);C.sort(Y_);const D={};let O;for(let G=0;G<C.length;G++){const W=C[G];if(W===O)continue;O=W;const ie=this.featureIndexArray.get(W);let Y=null;this.loadMatchingFeature(D,ie.bucketIndex,ie.sourceLayerIndex,ie.featureIndex,f,u.layers,u.availableImages,r,a,o,(ne,oe,fe)=>(Y||(Y=Ya(ne)),oe.queryIntersectsFeature(_,ne,fe,Y,this.z,e.transform,d,e.pixelPosMatrix)))}return D}loadMatchingFeature(e,r,a,o,u,d,f,_,b,T,C){const k=this.bucketLayerIDs[r];if(d&&!function(G,W){for(let ie=0;ie<G.length;ie++)if(W.indexOf(G[ie])>=0)return!0;return!1}(d,k))return;const z=this.sourceLayerCoder.decode(a),D=this.vtLayers[z].feature(o);if(u.needGeometry){const G=Ja(D,!0);if(!u.filter(new Kt(this.tileID.overscaledZ),G,this.tileID.canonical))return}else if(!u.filter(new Kt(this.tileID.overscaledZ),D))return;const O=this.getId(D,z);for(let G=0;G<k.length;G++){const W=k[G];if(d&&d.indexOf(W)<0)continue;const ie=_[W];if(!ie)continue;let Y={};O&&T&&(Y=T.getState(ie.sourceLayer||"_geojsonTileLayer",O));const ne=Ke({},b[W]);ne.paint=om(ne.paint,ie.paint,D,Y,f),ne.layout=om(ne.layout,ie.layout,D,Y,f);const oe=!C||C(D,ie,Y);if(!oe)continue;const fe=new am(D,this.z,this.x,this.y,O);fe.layer=ne;let Le=e[W];Le===void 0&&(Le=e[W]=[]),Le.push({featureIndex:o,feature:fe,intersectionZ:oe})}}lookupSymbolFeatures(e,r,a,o,u,d,f,_){const b={};this.loadVTLayers();const T=xo(u);for(const C of e)this.loadMatchingFeature(b,a,o,C,T,d,f,_,r);return b}hasLayer(e){for(const r of this.bucketLayerIDs)for(const a of r)if(e===a)return!0;return!1}getId(e,r){let a=e.id;return this.promoteId&&(a=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof a=="boolean"&&(a=Number(a))),a}}function om(i,e,r,a,o){return qe(i,(u,d)=>{const f=e instanceof Rs?e.get(d):null;return f&&f.evaluate?f.evaluate(r,a,o):f})}function lm(i){let e=1/0,r=1/0,a=-1/0,o=-1/0;for(const u of i)e=Math.min(e,u.x),r=Math.min(r,u.y),a=Math.max(a,u.x),o=Math.max(o,u.y);return{minX:e,minY:r,maxX:a,maxY:o}}function Y_(i,e){return e-i}function cm(i,e,r,a,o){const u=[];for(let d=0;d<i.length;d++){const f=i[d];let _;for(let b=0;b<f.length-1;b++){let T=f[b],C=f[b+1];T.x<e&&C.x<e||(T.x<e?T=new ye(e,T.y+(e-T.x)/(C.x-T.x)*(C.y-T.y))._round():C.x<e&&(C=new ye(e,T.y+(e-T.x)/(C.x-T.x)*(C.y-T.y))._round()),T.y<r&&C.y<r||(T.y<r?T=new ye(T.x+(r-T.y)/(C.y-T.y)*(C.x-T.x),r)._round():C.y<r&&(C=new ye(T.x+(r-T.y)/(C.y-T.y)*(C.x-T.x),r)._round()),T.x>=a&&C.x>=a||(T.x>=a?T=new ye(a,T.y+(a-T.x)/(C.x-T.x)*(C.y-T.y))._round():C.x>=a&&(C=new ye(a,T.y+(a-T.x)/(C.x-T.x)*(C.y-T.y))._round()),T.y>=o&&C.y>=o||(T.y>=o?T=new ye(T.x+(o-T.y)/(C.y-T.y)*(C.x-T.x),o)._round():C.y>=o&&(C=new ye(T.x+(o-T.y)/(C.y-T.y)*(C.x-T.x),o)._round()),_&&T.equals(_[_.length-1])||(_=[T],u.push(_)),_.push(C)))))}}return u}ze("FeatureIndex",sm,{omit:["rawTileData","sourceLayerCoder"]});class Ia extends ye{constructor(e,r,a,o){super(e,r),this.angle=a,o!==void 0&&(this.segment=o)}clone(){return new Ia(this.x,this.y,this.angle,this.segment)}}function hm(i,e,r,a,o){if(e.segment===void 0||r===0)return!0;let u=e,d=e.segment+1,f=0;for(;f>-r/2;){if(d--,d<0)return!1;f-=i[d].dist(u),u=i[d]}f+=i[d].dist(i[d+1]),d++;const _=[];let b=0;for(;f<r/2;){const T=i[d],C=i[d+1];if(!C)return!1;let k=i[d-1].angleTo(T)-T.angleTo(C);for(k=Math.abs((k+3*Math.PI)%(2*Math.PI)-Math.PI),_.push({distance:f,angleDelta:k}),b+=k;f-_[0].distance>a;)b-=_.shift().angleDelta;if(b>o)return!1;d++,f+=T.dist(C)}return!0}function um(i){let e=0;for(let r=0;r<i.length-1;r++)e+=i[r].dist(i[r+1]);return e}function pm(i,e,r){return i?.6*e*r:0}function dm(i,e){return Math.max(i?i.right-i.left:0,e?e.right-e.left:0)}function J_(i,e,r,a,o,u){const d=pm(r,o,u),f=dm(r,a)*u;let _=0;const b=um(i)/2;for(let T=0;T<i.length-1;T++){const C=i[T],k=i[T+1],z=C.dist(k);if(_+z>b){const D=(b-_)/z,O=lr.number(C.x,k.x,D),G=lr.number(C.y,k.y,D),W=new Ia(O,G,k.angleTo(C),T);return W._round(),!d||hm(i,W,f,d,e)?W:void 0}_+=z}}function Q_(i,e,r,a,o,u,d,f,_){const b=pm(a,u,d),T=dm(a,o),C=T*d,k=i[0].x===0||i[0].x===_||i[0].y===0||i[0].y===_;return e-C<e/4&&(e=C+e/4),mm(i,k?e/2*f%e:(T/2+2*u)*d*f%e,e,b,r,C,k,!1,_)}function mm(i,e,r,a,o,u,d,f,_){const b=u/2,T=um(i);let C=0,k=e-r,z=[];for(let D=0;D<i.length-1;D++){const O=i[D],G=i[D+1],W=O.dist(G),ie=G.angleTo(O);for(;k+r<C+W;){k+=r;const Y=(k-C)/W,ne=lr.number(O.x,G.x,Y),oe=lr.number(O.y,G.y,Y);if(ne>=0&&ne<_&&oe>=0&&oe<_&&k-b>=0&&k+b<=T){const fe=new Ia(ne,oe,ie,D);fe._round(),a&&!hm(i,fe,u,a,o)||z.push(fe)}}C+=W}return f||z.length||d||(z=mm(i,C/2,r,a,o,u,d,!0,_)),z}ze("Anchor",Ia);const qs=dr;function fm(i,e,r,a){const o=[],u=i.image,d=u.pixelRatio,f=u.paddedRect.w-2*qs,_=u.paddedRect.h-2*qs,b=i.right-i.left,T=i.bottom-i.top,C=u.stretchX||[[0,f]],k=u.stretchY||[[0,_]],z=(we,Re)=>we+Re[1]-Re[0],D=C.reduce(z,0),O=k.reduce(z,0),G=f-D,W=_-O;let ie=0,Y=D,ne=0,oe=O,fe=0,Le=G,Oe=0,Pe=W;if(u.content&&a){const we=u.content;ie=Tc(C,0,we[0]),ne=Tc(k,0,we[1]),Y=Tc(C,we[0],we[2]),oe=Tc(k,we[1],we[3]),fe=we[0]-ie,Oe=we[1]-ne,Le=we[2]-we[0]-Y,Pe=we[3]-we[1]-oe}const Ee=(we,Re,Te,xe)=>{const je=Ic(we.stretch-ie,Y,b,i.left),Ue=Ac(we.fixed-fe,Le,we.stretch,D),lt=Ic(Re.stretch-ne,oe,T,i.top),Yt=Ac(Re.fixed-Oe,Pe,Re.stretch,O),ei=Ic(Te.stretch-ie,Y,b,i.left),Si=Ac(Te.fixed-fe,Le,Te.stretch,D),Pr=Ic(xe.stretch-ne,oe,T,i.top),rr=Ac(xe.fixed-Oe,Pe,xe.stretch,O),vi=new ye(je,lt),Di=new ye(ei,lt),Vi=new ye(ei,Pr),nr=new ye(je,Pr),ar=new ye(Ue/d,Yt/d),Ti=new ye(Si/d,rr/d),Ii=e*Math.PI/180;if(Ii){const Ki=Math.sin(Ii),mr=Math.cos(Ii),fr=[mr,-Ki,Ki,mr];vi._matMult(fr),Di._matMult(fr),nr._matMult(fr),Vi._matMult(fr)}const Wi=we.stretch+we.fixed,sr=Re.stretch+Re.fixed;return{tl:vi,tr:Di,bl:nr,br:Vi,tex:{x:u.paddedRect.x+qs+Wi,y:u.paddedRect.y+qs+sr,w:Te.stretch+Te.fixed-Wi,h:xe.stretch+xe.fixed-sr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:ar,pixelOffsetBR:Ti,minFontScaleX:Le/d/b,minFontScaleY:Pe/d/T,isSDF:r}};if(a&&(u.stretchX||u.stretchY)){const we=gm(C,G,D),Re=gm(k,W,O);for(let Te=0;Te<we.length-1;Te++){const xe=we[Te],je=we[Te+1];for(let Ue=0;Ue<Re.length-1;Ue++)o.push(Ee(xe,Re[Ue],je,Re[Ue+1]))}}else o.push(Ee({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:f+1},{fixed:0,stretch:_+1}));return o}function Tc(i,e,r){let a=0;for(const o of i)a+=Math.max(e,Math.min(r,o[1]))-Math.max(e,Math.min(r,o[0]));return a}function gm(i,e,r){const a=[{fixed:-qs,stretch:0}];for(const[o,u]of i){const d=a[a.length-1];a.push({fixed:o-d.stretch,stretch:d.stretch}),a.push({fixed:o-d.stretch,stretch:d.stretch+(u-o)})}return a.push({fixed:e+qs,stretch:r}),a}function Ic(i,e,r,a){return i/e*r+a}function Ac(i,e,r,a){return i-e*r/a}class Cc{constructor(e,r,a,o,u,d,f,_,b,T){if(this.boxStartIndex=e.length,b){let C=d.top,k=d.bottom;const z=d.collisionPadding;z&&(C-=z[1],k+=z[3]);let D=k-C;D>0&&(D=Math.max(10,D),this.circleDiameter=D)}else{let C=d.top*f-_[0],k=d.bottom*f+_[2],z=d.left*f-_[3],D=d.right*f+_[1];const O=d.collisionPadding;if(O&&(z-=O[0]*f,C-=O[1]*f,D+=O[2]*f,k+=O[3]*f),T){const G=new ye(z,C),W=new ye(D,C),ie=new ye(z,k),Y=new ye(D,k),ne=T*Math.PI/180;G._rotate(ne),W._rotate(ne),ie._rotate(ne),Y._rotate(ne),z=Math.min(G.x,W.x,ie.x,Y.x),D=Math.max(G.x,W.x,ie.x,Y.x),C=Math.min(G.y,W.y,ie.y,Y.y),k=Math.max(G.y,W.y,ie.y,Y.y)}e.emplaceBack(r.x,r.y,z,C,D,k,a,o,u)}this.boxEndIndex=e.length}}class ev{constructor(e=[],r=tv){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let a=(this.length>>1)-1;a>=0;a--)this._down(a)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:a}=this,o=r[e];for(;e>0;){const u=e-1>>1,d=r[u];if(a(o,d)>=0)break;r[e]=d,e=u}r[e]=o}_down(e){const{data:r,compare:a}=this,o=this.length>>1,u=r[e];for(;e<o;){let d=1+(e<<1),f=r[d];const _=d+1;if(_<this.length&&a(r[_],f)<0&&(d=_,f=r[_]),a(f,u)>=0)break;r[e]=f,e=d}r[e]=u}}function tv(i,e){return i<e?-1:i>e?1:0}function iv(i,e=1,r=!1){let a=1/0,o=1/0,u=-1/0,d=-1/0;const f=i[0];for(let z=0;z<f.length;z++){const D=f[z];(!z||D.x<a)&&(a=D.x),(!z||D.y<o)&&(o=D.y),(!z||D.x>u)&&(u=D.x),(!z||D.y>d)&&(d=D.y)}const _=Math.min(u-a,d-o);let b=_/2;const T=new ev([],rv);if(_===0)return new ye(a,o);for(let z=a;z<u;z+=_)for(let D=o;D<d;D+=_)T.push(new Zs(z+b,D+b,b,i));let C=function(z){let D=0,O=0,G=0;const W=z[0];for(let ie=0,Y=W.length,ne=Y-1;ie<Y;ne=ie++){const oe=W[ie],fe=W[ne],Le=oe.x*fe.y-fe.x*oe.y;O+=(oe.x+fe.x)*Le,G+=(oe.y+fe.y)*Le,D+=3*Le}return new Zs(O/D,G/D,0,z)}(i),k=T.length;for(;T.length;){const z=T.pop();(z.d>C.d||!C.d)&&(C=z,r&&console.log("found best %d after %d probes",Math.round(1e4*z.d)/1e4,k)),z.max-C.d<=e||(b=z.h/2,T.push(new Zs(z.p.x-b,z.p.y-b,b,i)),T.push(new Zs(z.p.x+b,z.p.y-b,b,i)),T.push(new Zs(z.p.x-b,z.p.y+b,b,i)),T.push(new Zs(z.p.x+b,z.p.y+b,b,i)),k+=4)}return r&&(console.log(`num probes: ${k}`),console.log(`best distance: ${C.d}`)),C.p}function rv(i,e){return e.max-i.max}function Zs(i,e,r,a){this.p=new ye(i,e),this.h=r,this.d=function(o,u){let d=!1,f=1/0;for(let _=0;_<u.length;_++){const b=u[_];for(let T=0,C=b.length,k=C-1;T<C;k=T++){const z=b[T],D=b[k];z.y>o.y!=D.y>o.y&&o.x<(D.x-z.x)*(o.y-z.y)/(D.y-z.y)+z.x&&(d=!d),f=Math.min(f,Qp(o,z,D))}}return(d?1:-1)*Math.sqrt(f)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}var Ui;l.aq=void 0,(Ui=l.aq||(l.aq={}))[Ui.center=1]="center",Ui[Ui.left=2]="left",Ui[Ui.right=3]="right",Ui[Ui.top=4]="top",Ui[Ui.bottom=5]="bottom",Ui[Ui["top-left"]=6]="top-left",Ui[Ui["top-right"]=7]="top-right",Ui[Ui["bottom-left"]=8]="bottom-left",Ui[Ui["bottom-right"]=9]="bottom-right";const Aa=7,eu=Number.POSITIVE_INFINITY;function ym(i,e){return e[1]!==eu?function(r,a,o){let u=0,d=0;switch(a=Math.abs(a),o=Math.abs(o),r){case"top-right":case"top-left":case"top":d=o-Aa;break;case"bottom-right":case"bottom-left":case"bottom":d=-o+Aa}switch(r){case"top-right":case"bottom-right":case"right":u=-a;break;case"top-left":case"bottom-left":case"left":u=a}return[u,d]}(i,e[0],e[1]):function(r,a){let o=0,u=0;a<0&&(a=0);const d=a/Math.SQRT2;switch(r){case"top-right":case"top-left":u=d-Aa;break;case"bottom-right":case"bottom-left":u=-d+Aa;break;case"bottom":u=-a+Aa;break;case"top":u=a-Aa}switch(r){case"top-right":case"bottom-right":o=-d;break;case"top-left":case"bottom-left":o=d;break;case"left":o=a;break;case"right":o=-a}return[o,u]}(i,e[0])}function _m(i,e,r){var a;const o=i.layout,u=(a=o.get("text-variable-anchor-offset"))===null||a===void 0?void 0:a.evaluate(e,{},r);if(u){const f=u.values,_=[];for(let b=0;b<f.length;b+=2){const T=_[b]=f[b],C=f[b+1].map(k=>k*wi);T.startsWith("top")?C[1]-=Aa:T.startsWith("bottom")&&(C[1]+=Aa),_[b+1]=C}return new Sr(_)}const d=o.get("text-variable-anchor");if(d){let f;f=i._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[o.get("text-radial-offset").evaluate(e,{},r)*wi,eu]:o.get("text-offset").evaluate(e,{},r).map(b=>b*wi);const _=[];for(const b of d)_.push(b,ym(b,f));return new Sr(_)}return null}function tu(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function nv(i,e,r,a,o,u,d,f,_,b,T){let C=u.textMaxSize.evaluate(e,{});C===void 0&&(C=d);const k=i.layers[0].layout,z=k.get("icon-offset").evaluate(e,{},T),D=xm(r.horizontal),O=d/24,G=i.tilePixelRatio*O,W=i.tilePixelRatio*C/24,ie=i.tilePixelRatio*f,Y=i.tilePixelRatio*k.get("symbol-spacing"),ne=k.get("text-padding")*i.tilePixelRatio,oe=function(xe,je,Ue,lt=1){const Yt=xe.get("icon-padding").evaluate(je,{},Ue),ei=Yt&&Yt.values;return[ei[0]*lt,ei[1]*lt,ei[2]*lt,ei[3]*lt]}(k,e,T,i.tilePixelRatio),fe=k.get("text-max-angle")/180*Math.PI,Le=k.get("text-rotation-alignment")!=="viewport"&&k.get("symbol-placement")!=="point",Oe=k.get("icon-rotation-alignment")==="map"&&k.get("symbol-placement")!=="point",Pe=k.get("symbol-placement"),Ee=Y/2,we=k.get("icon-text-fit");let Re;a&&we!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Re=jd(a,r.vertical,we,k.get("icon-text-fit-padding"),z,O)),D&&(a=jd(a,D,we,k.get("icon-text-fit-padding"),z,O)));const Te=(xe,je)=>{je.x<0||je.x>=_i||je.y<0||je.y>=_i||function(Ue,lt,Yt,ei,Si,Pr,rr,vi,Di,Vi,nr,ar,Ti,Ii,Wi,sr,Ki,mr,fr,Ai,yt,Xi,$i,Ci,Jr){const pn=Ue.addToLineVertexArray(lt,Yt);let dn,Yn,Qr,Br,gr=0,Jn=0,nl=0,Tm=0,cu=-1,hu=-1;const Qn={};let Im=Hn("");if(Ue.allowVerticalPlacement&&ei.vertical){const Yi=vi.layout.get("text-rotate").evaluate(yt,{},Ci)+90;Qr=new Cc(Di,lt,Vi,nr,ar,ei.vertical,Ti,Ii,Wi,Yi),rr&&(Br=new Cc(Di,lt,Vi,nr,ar,rr,Ki,mr,Wi,Yi))}if(Si){const Yi=vi.layout.get("icon-rotate").evaluate(yt,{}),Fr=vi.layout.get("icon-text-fit")!=="none",es=fm(Si,Yi,$i,Fr),fn=rr?fm(rr,Yi,$i,Fr):void 0;Yn=new Cc(Di,lt,Vi,nr,ar,Si,Ki,mr,!1,Yi),gr=4*es.length;const ts=Ue.iconSizeData;let Mn=null;ts.kind==="source"?(Mn=[kn*vi.layout.get("icon-size").evaluate(yt,{})],Mn[0]>Sa&&rt(`${Ue.layerIds[0]}: Value for "icon-size" is >= ${el}. Reduce your "icon-size".`)):ts.kind==="composite"&&(Mn=[kn*Xi.compositeIconSizes[0].evaluate(yt,{},Ci),kn*Xi.compositeIconSizes[1].evaluate(yt,{},Ci)],(Mn[0]>Sa||Mn[1]>Sa)&&rt(`${Ue.layerIds[0]}: Value for "icon-size" is >= ${el}. Reduce your "icon-size".`)),Ue.addSymbols(Ue.icon,es,Mn,Ai,fr,yt,l.ai.none,lt,pn.lineStartIndex,pn.lineLength,-1,Ci),cu=Ue.icon.placedSymbolArray.length-1,fn&&(Jn=4*fn.length,Ue.addSymbols(Ue.icon,fn,Mn,Ai,fr,yt,l.ai.vertical,lt,pn.lineStartIndex,pn.lineLength,-1,Ci),hu=Ue.icon.placedSymbolArray.length-1)}const Am=Object.keys(ei.horizontal);for(const Yi of Am){const Fr=ei.horizontal[Yi];if(!dn){Im=Hn(Fr.text);const fn=vi.layout.get("text-rotate").evaluate(yt,{},Ci);dn=new Cc(Di,lt,Vi,nr,ar,Fr,Ti,Ii,Wi,fn)}const es=Fr.positionedLines.length===1;if(nl+=vm(Ue,lt,Fr,Pr,vi,Wi,yt,sr,pn,ei.vertical?l.ai.horizontal:l.ai.horizontalOnly,es?Am:[Yi],Qn,cu,Xi,Ci),es)break}ei.vertical&&(Tm+=vm(Ue,lt,ei.vertical,Pr,vi,Wi,yt,sr,pn,l.ai.vertical,["vertical"],Qn,hu,Xi,Ci));const ov=dn?dn.boxStartIndex:Ue.collisionBoxArray.length,lv=dn?dn.boxEndIndex:Ue.collisionBoxArray.length,cv=Qr?Qr.boxStartIndex:Ue.collisionBoxArray.length,hv=Qr?Qr.boxEndIndex:Ue.collisionBoxArray.length,uv=Yn?Yn.boxStartIndex:Ue.collisionBoxArray.length,pv=Yn?Yn.boxEndIndex:Ue.collisionBoxArray.length,dv=Br?Br.boxStartIndex:Ue.collisionBoxArray.length,mv=Br?Br.boxEndIndex:Ue.collisionBoxArray.length;let mn=-1;const Pc=(Yi,Fr)=>Yi&&Yi.circleDiameter?Math.max(Yi.circleDiameter,Fr):Fr;mn=Pc(dn,mn),mn=Pc(Qr,mn),mn=Pc(Yn,mn),mn=Pc(Br,mn);const Cm=mn>-1?1:0;Cm&&(mn*=Jr/wi),Ue.glyphOffsetArray.length>=Gs.MAX_GLYPHS&&rt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),yt.sortKey!==void 0&&Ue.addToSortKeyRanges(Ue.symbolInstances.length,yt.sortKey);const fv=_m(vi,yt,Ci),[gv,yv]=function(Yi,Fr){const es=Yi.length,fn=Fr?.values;if(fn?.length>0)for(let ts=0;ts<fn.length;ts+=2){const Mn=fn[ts+1];Yi.emplaceBack(l.aq[fn[ts]],Mn[0],Mn[1])}return[es,Yi.length]}(Ue.textAnchorOffsets,fv);Ue.symbolInstances.emplaceBack(lt.x,lt.y,Qn.right>=0?Qn.right:-1,Qn.center>=0?Qn.center:-1,Qn.left>=0?Qn.left:-1,Qn.vertical||-1,cu,hu,Im,ov,lv,cv,hv,uv,pv,dv,mv,Vi,nl,Tm,gr,Jn,Cm,0,Ti,mn,gv,yv)}(i,je,xe,r,a,o,Re,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,G,[ne,ne,ne,ne],Le,_,ie,oe,Oe,z,e,u,b,T,d)};if(Pe==="line")for(const xe of cm(e.geometry,0,0,_i,_i)){const je=Q_(xe,Y,fe,r.vertical||D,a,24,W,i.overscaling,_i);for(const Ue of je)D&&av(i,D.text,Ee,Ue)||Te(xe,Ue)}else if(Pe==="line-center"){for(const xe of e.geometry)if(xe.length>1){const je=J_(xe,fe,r.vertical||D,a,24,W);je&&Te(xe,je)}}else if(e.type==="Polygon")for(const xe of zh(e.geometry,0)){const je=iv(xe,16);Te(xe[0],new Ia(je.x,je.y,0))}else if(e.type==="LineString")for(const xe of e.geometry)Te(xe,new Ia(xe[0].x,xe[0].y,0));else if(e.type==="Point")for(const xe of e.geometry)for(const je of xe)Te([je],new Ia(je.x,je.y,0))}function vm(i,e,r,a,o,u,d,f,_,b,T,C,k,z,D){const O=function(ie,Y,ne,oe,fe,Le,Oe,Pe){const Ee=oe.layout.get("text-rotate").evaluate(Le,{})*Math.PI/180,we=[];for(const Re of Y.positionedLines)for(const Te of Re.positionedGlyphs){if(!Te.rect)continue;const xe=Te.rect||{};let je=Bd+1,Ue=!0,lt=1,Yt=0;const ei=(fe||Pe)&&Te.vertical,Si=Te.metrics.advance*Te.scale/2;if(Pe&&Y.verticalizable&&(Yt=Re.lineOffset/2-(Te.imageName?-(wi-Te.metrics.width*Te.scale)/2:(Te.scale-1)*wi)),Te.imageName){const Ai=Oe[Te.imageName];Ue=Ai.sdf,lt=Ai.pixelRatio,je=dr/lt}const Pr=fe?[Te.x+Si,Te.y]:[0,0];let rr=fe?[0,0]:[Te.x+Si+ne[0],Te.y+ne[1]-Yt],vi=[0,0];ei&&(vi=rr,rr=[0,0]);const Di=Te.metrics.isDoubleResolution?2:1,Vi=(Te.metrics.left-je)*Te.scale-Si+rr[0],nr=(-Te.metrics.top-je)*Te.scale+rr[1],ar=Vi+xe.w/Di*Te.scale/lt,Ti=nr+xe.h/Di*Te.scale/lt,Ii=new ye(Vi,nr),Wi=new ye(ar,nr),sr=new ye(Vi,Ti),Ki=new ye(ar,Ti);if(ei){const Ai=new ye(-Si,Si-Jo),yt=-Math.PI/2,Xi=wi/2-Si,$i=new ye(5-Jo-Xi,-(Te.imageName?Xi:0)),Ci=new ye(...vi);Ii._rotateAround(yt,Ai)._add($i)._add(Ci),Wi._rotateAround(yt,Ai)._add($i)._add(Ci),sr._rotateAround(yt,Ai)._add($i)._add(Ci),Ki._rotateAround(yt,Ai)._add($i)._add(Ci)}if(Ee){const Ai=Math.sin(Ee),yt=Math.cos(Ee),Xi=[yt,-Ai,Ai,yt];Ii._matMult(Xi),Wi._matMult(Xi),sr._matMult(Xi),Ki._matMult(Xi)}const mr=new ye(0,0),fr=new ye(0,0);we.push({tl:Ii,tr:Wi,bl:sr,br:Ki,tex:xe,writingMode:Y.writingMode,glyphOffset:Pr,sectionIndex:Te.sectionIndex,isSDF:Ue,pixelOffsetTL:mr,pixelOffsetBR:fr,minFontScaleX:0,minFontScaleY:0})}return we}(0,r,f,o,u,d,a,i.allowVerticalPlacement),G=i.textSizeData;let W=null;G.kind==="source"?(W=[kn*o.layout.get("text-size").evaluate(d,{})],W[0]>Sa&&rt(`${i.layerIds[0]}: Value for "text-size" is >= ${el}. Reduce your "text-size".`)):G.kind==="composite"&&(W=[kn*z.compositeTextSizes[0].evaluate(d,{},D),kn*z.compositeTextSizes[1].evaluate(d,{},D)],(W[0]>Sa||W[1]>Sa)&&rt(`${i.layerIds[0]}: Value for "text-size" is >= ${el}. Reduce your "text-size".`)),i.addSymbols(i.text,O,W,f,u,d,b,e,_.lineStartIndex,_.lineLength,k,D);for(const ie of T)C[ie]=i.text.placedSymbolArray.length-1;return 4*O.length}function xm(i){for(const e in i)return i[e];return null}function av(i,e,r,a){const o=i.compareText;if(e in o){const u=o[e];for(let d=u.length-1;d>=0;d--)if(a.dist(u[d])<r)return!0}else o[e]=[];return o[e].push(a),!1}const bm=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class iu{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[r,a]=new Uint8Array(e,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");const o=a>>4;if(o!==1)throw new Error(`Got v${o} data when expected v1.`);const u=bm[15&a];if(!u)throw new Error("Unrecognized array type.");const[d]=new Uint16Array(e,2,1),[f]=new Uint32Array(e,4,1);return new iu(f,d,u,e)}constructor(e,r=64,a=Float64Array,o){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=a,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const u=bm.indexOf(this.ArrayType),d=2*e*this.ArrayType.BYTES_PER_ELEMENT,f=e*this.IndexArrayType.BYTES_PER_ELEMENT,_=(8-f%8)%8;if(u<0)throw new Error(`Unexpected typed array class: ${a}.`);o&&o instanceof ArrayBuffer?(this.data=o,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+_,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+d+f+_),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+_,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+u]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=e)}add(e,r){const a=this._pos>>1;return this.ids[a]=a,this.coords[this._pos++]=e,this.coords[this._pos++]=r,a}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return ru(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,a,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:u,coords:d,nodeSize:f}=this,_=[0,u.length-1,0],b=[];for(;_.length;){const T=_.pop()||0,C=_.pop()||0,k=_.pop()||0;if(C-k<=f){for(let G=k;G<=C;G++){const W=d[2*G],ie=d[2*G+1];W>=e&&W<=a&&ie>=r&&ie<=o&&b.push(u[G])}continue}const z=k+C>>1,D=d[2*z],O=d[2*z+1];D>=e&&D<=a&&O>=r&&O<=o&&b.push(u[z]),(T===0?e<=D:r<=O)&&(_.push(k),_.push(z-1),_.push(1-T)),(T===0?a>=D:o>=O)&&(_.push(z+1),_.push(C),_.push(1-T))}return b}within(e,r,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:o,coords:u,nodeSize:d}=this,f=[0,o.length-1,0],_=[],b=a*a;for(;f.length;){const T=f.pop()||0,C=f.pop()||0,k=f.pop()||0;if(C-k<=d){for(let G=k;G<=C;G++)Sm(u[2*G],u[2*G+1],e,r)<=b&&_.push(o[G]);continue}const z=k+C>>1,D=u[2*z],O=u[2*z+1];Sm(D,O,e,r)<=b&&_.push(o[z]),(T===0?e-a<=D:r-a<=O)&&(f.push(k),f.push(z-1),f.push(1-T)),(T===0?e+a>=D:r+a>=O)&&(f.push(z+1),f.push(C),f.push(1-T))}return _}}function ru(i,e,r,a,o,u){if(o-a<=r)return;const d=a+o>>1;wm(i,e,d,a,o,u),ru(i,e,r,a,d-1,1-u),ru(i,e,r,d+1,o,1-u)}function wm(i,e,r,a,o,u){for(;o>a;){if(o-a>600){const b=o-a+1,T=r-a+1,C=Math.log(b),k=.5*Math.exp(2*C/3),z=.5*Math.sqrt(C*k*(b-k)/b)*(T-b/2<0?-1:1);wm(i,e,r,Math.max(a,Math.floor(r-T*k/b+z)),Math.min(o,Math.floor(r+(b-T)*k/b+z)),u)}const d=e[2*r+u];let f=a,_=o;for(il(i,e,a,r),e[2*o+u]>d&&il(i,e,a,o);f<_;){for(il(i,e,f,_),f++,_--;e[2*f+u]<d;)f++;for(;e[2*_+u]>d;)_--}e[2*a+u]===d?il(i,e,a,_):(_++,il(i,e,_,o)),_<=r&&(a=_+1),r<=_&&(o=_-1)}}function il(i,e,r,a){nu(i,r,a),nu(e,2*r,2*a),nu(e,2*r+1,2*a+1)}function nu(i,e,r){const a=i[e];i[e]=i[r],i[r]=a}function Sm(i,e,r,a){const o=i-r,u=e-a;return o*o+u*u}var au;l.bg=void 0,(au=l.bg||(l.bg={})).create="create",au.load="load",au.fullLoad="fullLoad";let Ec=null,rl=[];const su=1e3/60,ou="loadTime",lu="fullLoadTime",sv={mark(i){performance.mark(i)},frame(i){const e=i;Ec!=null&&rl.push(e-Ec),Ec=e},clearMetrics(){Ec=null,rl=[],performance.clearMeasures(ou),performance.clearMeasures(lu);for(const i in l.bg)performance.clearMarks(l.bg[i])},getPerformanceMetrics(){performance.measure(ou,l.bg.create,l.bg.load),performance.measure(lu,l.bg.create,l.bg.fullLoad);const i=performance.getEntriesByName(ou)[0].duration,e=performance.getEntriesByName(lu)[0].duration,r=rl.length,a=1/(rl.reduce((u,d)=>u+d,0)/r/1e3),o=rl.filter(u=>u>su).reduce((u,d)=>u+(d-su)/su,0);return{loadTime:i,fullLoadTime:e,fps:a,percentDroppedFrames:o/(r+o)*100,totalFrames:r}}};l.$=function(i,e,r){var a,o,u,d,f,_,b,T,C,k,z,D,O=r[0],G=r[1],W=r[2];return e===i?(i[12]=e[0]*O+e[4]*G+e[8]*W+e[12],i[13]=e[1]*O+e[5]*G+e[9]*W+e[13],i[14]=e[2]*O+e[6]*G+e[10]*W+e[14],i[15]=e[3]*O+e[7]*G+e[11]*W+e[15]):(o=e[1],u=e[2],d=e[3],f=e[4],_=e[5],b=e[6],T=e[7],C=e[8],k=e[9],z=e[10],D=e[11],i[0]=a=e[0],i[1]=o,i[2]=u,i[3]=d,i[4]=f,i[5]=_,i[6]=b,i[7]=T,i[8]=C,i[9]=k,i[10]=z,i[11]=D,i[12]=a*O+f*G+C*W+e[12],i[13]=o*O+_*G+k*W+e[13],i[14]=u*O+b*G+z*W+e[14],i[15]=d*O+T*G+D*W+e[15]),i},l.A=Os,l.B=lr,l.C=class{constructor(i,e,r){this.receive=a=>{const o=a.data,u=o.id;if(u&&(!o.targetMapId||this.mapId===o.targetMapId))if(o.type==="<cancel>"){delete this.tasks[u];const d=this.cancelCallbacks[u];delete this.cancelCallbacks[u],d&&d()}else Ot()||o.mustQueue?(this.tasks[u]=o,this.taskQueue.push(u),this.invoker.trigger()):this.processTask(u,o)},this.process=()=>{if(!this.taskQueue.length)return;const a=this.taskQueue.shift(),o=this.tasks[a];delete this.tasks[a],this.taskQueue.length&&this.invoker.trigger(),o&&this.processTask(a,o)},this.target=i,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new X_(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=Ot()?i:window}send(i,e,r,a,o=!1){const u=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[u]=r);const d=[],f={id:u,type:i,hasCallback:!!r,targetMapId:a,mustQueue:o,sourceMapId:this.mapId,data:Cn(e,d)};return this.target.postMessage(f,{transfer:d}),{cancel:()=>{r&&delete this.callbacks[u],this.target.postMessage({id:u,type:"<cancel>",targetMapId:a,sourceMapId:this.mapId})}}}processTask(i,e){if(e.type==="<response>"){const r=this.callbacks[i];delete this.callbacks[i],r&&(e.error?r(ya(e.error)):r(null,ya(e.data)))}else{let r=!1;const a=[],o=e.hasCallback?(f,_)=>{r=!0,delete this.cancelCallbacks[i];const b={id:i,type:"<response>",sourceMapId:this.mapId,error:f?Cn(f):null,data:Cn(_,a)};this.target.postMessage(b,{transfer:a})}:f=>{r=!0};let u=null;const d=ya(e.data);if(this.parent[e.type])u=this.parent[e.type](e.sourceMapId,d,o);else if("getWorkerSource"in this.parent){const f=e.type.split(".");u=this.parent.getWorkerSource(e.sourceMapId,f[0],d.source)[f[1]](d,o)}else o(new Error(`Could not find function ${e.type}`));!r&&u&&u.cancel&&(this.cancelCallbacks[i]=u.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},l.D=Ve,l.E=Rn,l.F=function(i,e){const r={};for(let a=0;a<e.length;a++){const o=e[a];o in i&&(r[o]=i[o])}return r},l.G=Jd,l.H=Qd,l.I=jh,l.J=It,l.K=qt,l.L=Ta,l.M=gi,l.N=_i,l.O=Rr,l.P=ye,l.Q=ni,l.R=Dr,l.S=Xt,l.T=rc,l.U=Sc,l.V=class extends qn{},l.W=Qh,l.X=function(i,e){const r=window.document.createElement("video");r.muted=!0,r.onloadstart=function(){e(null,r)};for(let a=0;a<i.length;a++){const o=window.document.createElement("source");tn(i[a])||(r.crossOrigin="Anonymous"),o.src=i[a],r.appendChild(o)}return{cancel:()=>{}}},l.Y=Se,l.Z=function(){var i=new Os(16);return Os!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},l._=he,l.a=Pi,l.a$=class extends L{},l.a0=function(i,e,r){var a=r[0],o=r[1],u=r[2];return i[0]=e[0]*a,i[1]=e[1]*a,i[2]=e[2]*a,i[3]=e[3]*a,i[4]=e[4]*o,i[5]=e[5]*o,i[6]=e[6]*o,i[7]=e[7]*o,i[8]=e[8]*u,i[9]=e[9]*u,i[10]=e[10]*u,i[11]=e[11]*u,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},l.a1=rd,l.a2=function(){return _t++},l.a3=$,l.a4=Gs,l.a5=function(){ur.isLoading()||ur.isLoaded()||Mo()!=="deferred"||ic()},l.a6=xo,l.a7=Ja,l.a8=Kt,l.a9=am,l.aA=Za,l.aB=function(i){i=i.slice();const e=Object.create(null);for(let r=0;r<i.length;r++)e[i[r].id]=i[r];for(let r=0;r<i.length;r++)"ref"in i[r]&&(i[r]=br(i[r],e[i[r].ref]));return i},l.aC=function(i){if(i.type==="custom")return new K_(i);switch(i.type){case"background":return new Z_(i);case"circle":return new My(i);case"fill":return new Yy(i);case"fill-extrusion":return new p_(i);case"heatmap":return new zy(i);case"hillshade":return new Ry(i);case"line":return new x_(i);case"raster":return new W_(i);case"symbol":return new wc(i)}},l.aD=Qe,l.aE=function(i,e){if(!i)return[{command:At.setStyle,args:[e]}];let r=[];try{if(!Gt(i.version,e.version))return[{command:At.setStyle,args:[e]}];Gt(i.center,e.center)||r.push({command:At.setCenter,args:[e.center]}),Gt(i.zoom,e.zoom)||r.push({command:At.setZoom,args:[e.zoom]}),Gt(i.bearing,e.bearing)||r.push({command:At.setBearing,args:[e.bearing]}),Gt(i.pitch,e.pitch)||r.push({command:At.setPitch,args:[e.pitch]}),Gt(i.sprite,e.sprite)||r.push({command:At.setSprite,args:[e.sprite]}),Gt(i.glyphs,e.glyphs)||r.push({command:At.setGlyphs,args:[e.glyphs]}),Gt(i.transition,e.transition)||r.push({command:At.setTransition,args:[e.transition]}),Gt(i.light,e.light)||r.push({command:At.setLight,args:[e.light]});const a={},o=[];(function(d,f,_,b){let T;for(T in f=f||{},d=d||{})Object.prototype.hasOwnProperty.call(d,T)&&(Object.prototype.hasOwnProperty.call(f,T)||aa(T,_,b));for(T in f)Object.prototype.hasOwnProperty.call(f,T)&&(Object.prototype.hasOwnProperty.call(d,T)?Gt(d[T],f[T])||(d[T].type==="geojson"&&f[T].type==="geojson"&&os(d,f,T)?_.push({command:At.setGeoJSONSourceData,args:[T,f[T].data]}):rn(T,f,_,b)):jr(T,f,_))})(i.sources,e.sources,o,a);const u=[];i.layers&&i.layers.forEach(d=>{a[d.source]?r.push({command:At.removeLayer,args:[d.id]}):u.push(d)}),r=r.concat(o),function(d,f,_){f=f||[];const b=(d=d||[]).map(wn),T=f.map(wn),C=d.reduce(Bn,{}),k=f.reduce(Bn,{}),z=b.slice(),D=Object.create(null);let O,G,W,ie,Y,ne,oe;for(O=0,G=0;O<b.length;O++)W=b[O],Object.prototype.hasOwnProperty.call(k,W)?G++:(_.push({command:At.removeLayer,args:[W]}),z.splice(z.indexOf(W,G),1));for(O=0,G=0;O<T.length;O++)W=T[T.length-1-O],z[z.length-1-O]!==W&&(Object.prototype.hasOwnProperty.call(C,W)?(_.push({command:At.removeLayer,args:[W]}),z.splice(z.lastIndexOf(W,z.length-G),1)):G++,ne=z[z.length-O],_.push({command:At.addLayer,args:[k[W],ne]}),z.splice(z.length-O,0,W),D[W]=!0);for(O=0;O<T.length;O++)if(W=T[O],ie=C[W],Y=k[W],!D[W]&&!Gt(ie,Y))if(Gt(ie.source,Y.source)&&Gt(ie["source-layer"],Y["source-layer"])&&Gt(ie.type,Y.type)){for(oe in sa(ie.layout,Y.layout,_,W,null,At.setLayoutProperty),sa(ie.paint,Y.paint,_,W,null,At.setPaintProperty),Gt(ie.filter,Y.filter)||_.push({command:At.setFilter,args:[W,Y.filter]}),Gt(ie.minzoom,Y.minzoom)&&Gt(ie.maxzoom,Y.maxzoom)||_.push({command:At.setLayerZoomRange,args:[W,Y.minzoom,Y.maxzoom]}),ie)Object.prototype.hasOwnProperty.call(ie,oe)&&oe!=="layout"&&oe!=="paint"&&oe!=="filter"&&oe!=="metadata"&&oe!=="minzoom"&&oe!=="maxzoom"&&(oe.indexOf("paint.")===0?sa(ie[oe],Y[oe],_,W,oe.slice(6),At.setPaintProperty):Gt(ie[oe],Y[oe])||_.push({command:At.setLayerProperty,args:[W,oe,Y[oe]]}));for(oe in Y)Object.prototype.hasOwnProperty.call(Y,oe)&&!Object.prototype.hasOwnProperty.call(ie,oe)&&oe!=="layout"&&oe!=="paint"&&oe!=="filter"&&oe!=="metadata"&&oe!=="minzoom"&&oe!=="maxzoom"&&(oe.indexOf("paint.")===0?sa(ie[oe],Y[oe],_,W,oe.slice(6),At.setPaintProperty):Gt(ie[oe],Y[oe])||_.push({command:At.setLayerProperty,args:[W,oe,Y[oe]]}))}else _.push({command:At.removeLayer,args:[W]}),ne=z[z.lastIndexOf(W)+1],_.push({command:At.addLayer,args:[Y,ne]})}(u,e.layers,r)}catch(a){console.warn("Unable to compute style diff:",a),r=[{command:At.setStyle,args:[e]}]}return r},l.aF=function(i){const e=[],r=i.id;return r===void 0&&e.push({message:`layers.${r}: missing required property "id"`}),i.render===void 0&&e.push({message:`layers.${r}: missing required method "render"`}),i.renderingMode&&i.renderingMode!=="2d"&&i.renderingMode!=="3d"&&e.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),e},l.aG=function i(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(let a=0;a<e.length;a++)if(!i(e[a],r[a]))return!1;return!0}if(typeof e=="object"&&e!==null&&r!==null){if(typeof r!="object"||Object.keys(e).length!==Object.keys(r).length)return!1;for(const a in e)if(!i(e[a],r[a]))return!1;return!0}return e===r},l.aH=qe,l.aI=jt,l.aJ=Ha,l.aK=function(i){return i({pluginStatus:er,pluginURL:En}),Ha.on("pluginStateChange",i),i},l.aL=class extends Wn{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},l.aM=Bs,l.aN=class extends Wn{constructor(i,e){super(i,e),this.current=bh}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let e=1;e<16;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},l.aO=oc,l.aP=class extends Wn{constructor(i,e){super(i,e),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},l.aQ=class extends Wn{constructor(i,e){super(i,e),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},l.aR=lc,l.aS=function(i,e,r,a,o,u,d){var f=1/(e-r),_=1/(a-o),b=1/(u-d);return i[0]=-2*f,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*_,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*b,i[11]=0,i[12]=(e+r)*f,i[13]=(o+a)*_,i[14]=(d+u)*b,i[15]=1,i},l.aT=Bt,l.aU=ky,l.aV=class extends s{},l.aW=T_,l.aX=class extends p{},l.aY=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},l.aZ=ld,l.a_=be,l.aa=function(i){const e={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,a,o,u)=>{const d=o||u;return e[a]=!d||d.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e},l.ab=function(i,e){const r=[];for(const a in i)a in e||r.push(a);return r},l.ac=function(i){if(ai==null){const e=i.navigator?i.navigator.userAgent:null;ai=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return ai},l.ad=ht,l.ae=function(i,e,r){var a=Math.sin(r),o=Math.cos(r),u=e[0],d=e[1],f=e[2],_=e[3],b=e[4],T=e[5],C=e[6],k=e[7];return e!==i&&(i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[0]=u*o+b*a,i[1]=d*o+T*a,i[2]=f*o+C*a,i[3]=_*o+k*a,i[4]=b*o-u*a,i[5]=T*o-d*a,i[6]=C*o-f*a,i[7]=k*o-_*a,i},l.af=function(i){var e=new Os(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},l.ag=pc,l.ah=function(i,e){let r=0,a=0;if(i.kind==="constant")a=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:o,minZoom:u,maxZoom:d}=i,f=o?ht(cr.interpolationFactor(o,e,u,d),0,1):0;i.kind==="camera"?a=lr.number(i.minSize,i.maxSize,f):r=f}return{uSizeT:r,uSize:a}},l.aj=function(i,{uSize:e,uSizeT:r},{lowerSize:a,upperSize:o}){return i.kind==="source"?a/kn:i.kind==="composite"?lr.number(a/kn,o/kn,r):e},l.ak=Hh,l.al=function(i,e,r,a){const o=e.y-i.y,u=e.x-i.x,d=a.y-r.y,f=a.x-r.x,_=d*u-f*o;if(_===0)return null;const b=(f*(i.y-r.y)-d*(i.x-r.x))/_;return new ye(i.x+b*u,i.y+b*o)},l.am=cm,l.an=Yp,l.ao=Ah,l.ap=wi,l.ar=Zh,l.as=function(i,e){var r=e[0],a=e[1],o=e[2],u=e[3],d=e[4],f=e[5],_=e[6],b=e[7],T=e[8],C=e[9],k=e[10],z=e[11],D=e[12],O=e[13],G=e[14],W=e[15],ie=r*f-a*d,Y=r*_-o*d,ne=r*b-u*d,oe=a*_-o*f,fe=a*b-u*f,Le=o*b-u*_,Oe=T*O-C*D,Pe=T*G-k*D,Ee=T*W-z*D,we=C*G-k*O,Re=C*W-z*O,Te=k*W-z*G,xe=ie*Te-Y*Re+ne*we+oe*Ee-fe*Pe+Le*Oe;return xe?(i[0]=(f*Te-_*Re+b*we)*(xe=1/xe),i[1]=(o*Re-a*Te-u*we)*xe,i[2]=(O*Le-G*fe+W*oe)*xe,i[3]=(k*fe-C*Le-z*oe)*xe,i[4]=(_*Ee-d*Te-b*Pe)*xe,i[5]=(r*Te-o*Ee+u*Pe)*xe,i[6]=(G*ne-D*Le-W*Y)*xe,i[7]=(T*Le-k*ne+z*Y)*xe,i[8]=(d*Re-f*Ee+b*Oe)*xe,i[9]=(a*Ee-r*Re-u*Oe)*xe,i[10]=(D*fe-O*ne+W*ie)*xe,i[11]=(C*ne-T*fe-z*ie)*xe,i[12]=(f*Pe-d*we-_*Oe)*xe,i[13]=(r*we-a*Pe+o*Oe)*xe,i[14]=(O*Y-D*oe-G*ie)*xe,i[15]=(T*oe-C*Y+k*ie)*xe,i):null},l.at=tu,l.au=qh,l.av=iu,l.aw=function(){const i={},e=ue.$version;for(const r in ue.$root){const a=ue.$root[r];if(a.required){let o=null;o=r==="version"?e:a.type==="array"?[]:{},o!=null&&(i[r]=o)}}return i},l.ax=At,l.ay=Jl,l.az=zr,l.b=function(i,e){const r=new Blob([new Uint8Array(i)],{type:"image/png"});createImageBitmap(r).then(a=>{e(null,a)}).catch(a=>{e(new Error(`Could not load image because of ${a.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})},l.b0=Li,l.b1=function(i,e){var r=i[0],a=i[1],o=i[2],u=i[3],d=i[4],f=i[5],_=i[6],b=i[7],T=i[8],C=i[9],k=i[10],z=i[11],D=i[12],O=i[13],G=i[14],W=i[15],ie=e[0],Y=e[1],ne=e[2],oe=e[3],fe=e[4],Le=e[5],Oe=e[6],Pe=e[7],Ee=e[8],we=e[9],Re=e[10],Te=e[11],xe=e[12],je=e[13],Ue=e[14],lt=e[15];return Math.abs(r-ie)<=ir*Math.max(1,Math.abs(r),Math.abs(ie))&&Math.abs(a-Y)<=ir*Math.max(1,Math.abs(a),Math.abs(Y))&&Math.abs(o-ne)<=ir*Math.max(1,Math.abs(o),Math.abs(ne))&&Math.abs(u-oe)<=ir*Math.max(1,Math.abs(u),Math.abs(oe))&&Math.abs(d-fe)<=ir*Math.max(1,Math.abs(d),Math.abs(fe))&&Math.abs(f-Le)<=ir*Math.max(1,Math.abs(f),Math.abs(Le))&&Math.abs(_-Oe)<=ir*Math.max(1,Math.abs(_),Math.abs(Oe))&&Math.abs(b-Pe)<=ir*Math.max(1,Math.abs(b),Math.abs(Pe))&&Math.abs(T-Ee)<=ir*Math.max(1,Math.abs(T),Math.abs(Ee))&&Math.abs(C-we)<=ir*Math.max(1,Math.abs(C),Math.abs(we))&&Math.abs(k-Re)<=ir*Math.max(1,Math.abs(k),Math.abs(Re))&&Math.abs(z-Te)<=ir*Math.max(1,Math.abs(z),Math.abs(Te))&&Math.abs(D-xe)<=ir*Math.max(1,Math.abs(D),Math.abs(xe))&&Math.abs(O-je)<=ir*Math.max(1,Math.abs(O),Math.abs(je))&&Math.abs(G-Ue)<=ir*Math.max(1,Math.abs(G),Math.abs(Ue))&&Math.abs(W-lt)<=ir*Math.max(1,Math.abs(W),Math.abs(lt))},l.b2=function(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},l.b3=function(i,e,r){return i[0]=e[0]*r[0],i[1]=e[1]*r[1],i[2]=e[2]*r[2],i[3]=e[3]*r[3],i},l.b4=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},l.b5=bt,l.b6=im,l.b7=em,l.b8=function(i,e,r,a,o){var u,d=1/Math.tan(e/2);return i[0]=d/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=d,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,o!=null&&o!==1/0?(i[10]=(o+a)*(u=1/(a-o)),i[14]=2*o*a*u):(i[10]=-1,i[14]=-2*a),i},l.b9=function(i,e,r){var a=Math.sin(r),o=Math.cos(r),u=e[4],d=e[5],f=e[6],_=e[7],b=e[8],T=e[9],C=e[10],k=e[11];return e!==i&&(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[4]=u*o+b*a,i[5]=d*o+T*a,i[6]=f*o+C*a,i[7]=_*o+k*a,i[8]=b*o-u*a,i[9]=T*o-d*a,i[10]=C*o-f*a,i[11]=k*o-_*a,i},l.bA=Pd,l.bB=Is,l.bC=ur,l.ba=Jt,l.bb=Lt,l.bc=function(i,e){return i[0]=e[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=e[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=e[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},l.bd=class extends Xa{},l.be=Yh,l.bf=sv,l.bh=_n,l.bi=function(i,e,r=!1){if(er===Ao||er===Co||er===Eo)throw new Error("setRTLTextPlugin cannot be called multiple times.");En=en.resolveURL(i),er=Ao,Po=e,ko(),r||ic()},l.bj=Mo,l.bk=function(i,e){const r={};for(let o=0;o<i.length;o++){const u=e&&e[i[o].id]||Ps(i[o]);e&&(e[i[o].id]=u);let d=r[u];d||(d=r[u]=[]),d.push(i[o])}const a=[];for(const o in r)a.push(r[o]);return a},l.bl=ze,l.bm=nm,l.bn=sm,l.bo=Od,l.bp=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=_i/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const e=i.bucket.layers[0],r=e.layout,a=e._unevaluatedLayout._values,o={layoutIconSize:a["icon-size"].possiblyEvaluate(new Kt(i.bucket.zoom+1),i.canonical),layoutTextSize:a["text-size"].possiblyEvaluate(new Kt(i.bucket.zoom+1),i.canonical),textMaxSize:a["text-size"].possiblyEvaluate(new Kt(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:b,maxZoom:T}=i.bucket.textSizeData;o.compositeTextSizes=[a["text-size"].possiblyEvaluate(new Kt(b),i.canonical),a["text-size"].possiblyEvaluate(new Kt(T),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:b,maxZoom:T}=i.bucket.iconSizeData;o.compositeIconSizes=[a["icon-size"].possiblyEvaluate(new Kt(b),i.canonical),a["icon-size"].possiblyEvaluate(new Kt(T),i.canonical)]}const u=r.get("text-line-height")*wi,d=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",f=r.get("text-keep-upright"),_=r.get("text-size");for(const b of i.bucket.features){const T=r.get("text-font").evaluate(b,{},i.canonical).join(","),C=_.evaluate(b,{},i.canonical),k=o.layoutTextSize.evaluate(b,{},i.canonical),z=o.layoutIconSize.evaluate(b,{},i.canonical),D={horizontal:{},vertical:void 0},O=b.text;let G,W=[0,0];if(O){const ne=O.toString(),oe=r.get("text-letter-spacing").evaluate(b,{},i.canonical)*wi,fe=To(ne)?oe:0,Le=r.get("text-anchor").evaluate(b,{},i.canonical),Oe=_m(e,b,i.canonical);if(!Oe){const Te=r.get("text-radial-offset").evaluate(b,{},i.canonical);W=Te?ym(Le,[Te*wi,eu]):r.get("text-offset").evaluate(b,{},i.canonical).map(xe=>xe*wi)}let Pe=d?"center":r.get("text-justify").evaluate(b,{},i.canonical);const Ee=r.get("symbol-placement"),we=Ee==="point"?r.get("text-max-width").evaluate(b,{},i.canonical)*wi:0,Re=()=>{i.bucket.allowVerticalPlacement&&So(ne)&&(D.vertical=vc(O,i.glyphMap,i.glyphPositions,i.imagePositions,T,we,u,Le,"left",fe,W,l.ai.vertical,!0,Ee,k,C))};if(!d&&Oe){const Te=new Set;if(Pe==="auto")for(let je=0;je<Oe.values.length;je+=2)Te.add(tu(Oe.values[je]));else Te.add(Pe);let xe=!1;for(const je of Te)if(!D.horizontal[je])if(xe)D.horizontal[je]=D.horizontal[0];else{const Ue=vc(O,i.glyphMap,i.glyphPositions,i.imagePositions,T,we,u,"center",je,fe,W,l.ai.horizontal,!1,Ee,k,C);Ue&&(D.horizontal[je]=Ue,xe=Ue.positionedLines.length===1)}Re()}else{Pe==="auto"&&(Pe=tu(Le));const Te=vc(O,i.glyphMap,i.glyphPositions,i.imagePositions,T,we,u,Le,Pe,fe,W,l.ai.horizontal,!1,Ee,k,C);Te&&(D.horizontal[Pe]=Te),Re(),So(ne)&&d&&f&&(D.vertical=vc(O,i.glyphMap,i.glyphPositions,i.imagePositions,T,we,u,Le,Pe,fe,W,l.ai.vertical,!1,Ee,k,C))}}let ie=!1;if(b.icon&&b.icon.name){const ne=i.imageMap[b.icon.name];ne&&(G=V_(i.imagePositions[b.icon.name],r.get("icon-offset").evaluate(b,{},i.canonical),r.get("icon-anchor").evaluate(b,{},i.canonical)),ie=!!ne.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=ie:i.bucket.sdfIcons!==ie&&rt("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(ne.pixelRatio!==i.bucket.pixelRatio||r.get("icon-rotate").constantOr(1)!==0)&&(i.bucket.iconsNeedLinear=!0))}const Y=xm(D.horizontal)||D.vertical;i.bucket.iconsInText=!!Y&&Y.iconsInText,(Y||G)&&nv(i.bucket,b,D,G,i.imageMap,o,k,z,W,ie,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},l.bq=Nh,l.br=Bh,l.bs=Oh,l.bt=class{constructor(i){this._marks={start:[i.url,"start"].join("#"),end:[i.url,"end"].join("#"),measure:i.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let i=performance.getEntriesByName(this._marks.measure);return i.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),i=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),i}},l.bu=Vh,l.bv=ba,l.bw=function(i,e,r,a,o){return he(this,void 0,void 0,function*(){if(qt())try{return yield gi(i,e,r,a,o)}catch{}return function(u,d,f,_,b){const T=u.width,C=u.height;Bi&&zt||(Bi=new OffscreenCanvas(T,C),zt=Bi.getContext("2d",{willReadFrequently:!0})),Bi.width=T,Bi.height=C,zt.drawImage(u,0,0,T,C);const k=zt.getImageData(d,f,_,b);return zt.clearRect(0,0,T,C),k.data}(i,e,r,a,o)})},l.bx=rm,l.by=H,l.bz=Ae,l.c=ra,l.d=function(i,e){const r=new Image;r.onload=()=>{e(null,r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame(()=>{r.src=vr})},r.onerror=()=>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."));const a=new Blob([new Uint8Array(i)],{type:"image/png"});r.src=i.byteLength?URL.createObjectURL(a):vr},l.e=Ke,l.f=function(i,e){return vn(Ke(i,{type:"json"}),e)},l.g=xr,l.h=en,l.i=Ot,l.j=bn,l.k=xn,l.l=Da,l.m=vn,l.n=function(i){return new Vh(i).readFields(R_,[])},l.o=function(i,e,r){if(!i.length)return r(null,[]);let a=i.length;const o=new Array(i.length);let u=null;i.forEach((d,f)=>{e(d,(_,b)=>{_&&(u=_),o[f]=b,--a==0&&r(u,o)})})},l.p=Fd,l.q=Go,l.r=di,l.s=tn,l.t=yh,l.u=Me,l.v=ue,l.w=rt,l.x=Ls,l.y=cn,l.z=function([i,e,r]){return e+=90,e*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(e)*Math.sin(r),y:i*Math.sin(e)*Math.sin(r),z:i*Math.cos(r)}}}),X(["./shared"],function(l){class he{constructor(E){this.keyCache={},E&&this.replace(E)}replace(E){this._layerConfigs={},this._layers={},this.update(E,[])}update(E,M){for(const j of E){this._layerConfigs[j.id]=j;const q=this._layers[j.id]=l.aC(j);q._featureFilter=l.a6(q.filter),this.keyCache[j.id]&&delete this.keyCache[j.id]}for(const j of M)delete this.keyCache[j],delete this._layerConfigs[j],delete this._layers[j];this.familiesBySource={};const R=l.bk(Object.values(this._layerConfigs),this.keyCache);for(const j of R){const q=j.map(de=>this._layers[de.id]),re=q[0];if(re.visibility==="none")continue;const J=re.source||"";let K=this.familiesBySource[J];K||(K=this.familiesBySource[J]={});const te=re.sourceLayer||"_geojsonTileLayer";let pe=K[te];pe||(pe=K[te]=[]),pe.push(q)}}}class H{constructor(E){const M={},R=[];for(const J in E){const K=E[J],te=M[J]={};for(const pe in K){const de=K[+pe];if(!de||de.bitmap.width===0||de.bitmap.height===0)continue;const ge={x:0,y:0,w:de.bitmap.width+2,h:de.bitmap.height+2};R.push(ge),te[pe]={rect:ge,metrics:de.metrics}}}const{w:j,h:q}=l.p(R),re=new l.q({width:j||1,height:q||1});for(const J in E){const K=E[J];for(const te in K){const pe=K[+te];if(!pe||pe.bitmap.width===0||pe.bitmap.height===0)continue;const de=M[J][te].rect;l.q.copy(pe.bitmap,re,{x:0,y:0},{x:de.x+1,y:de.y+1},pe.bitmap)}}this.image=re,this.positions=M}}l.bl("GlyphAtlas",H);class Ae{constructor(E){this.tileID=new l.O(E.tileID.overscaledZ,E.tileID.wrap,E.tileID.canonical.z,E.tileID.canonical.x,E.tileID.canonical.y),this.uid=E.uid,this.zoom=E.zoom,this.pixelRatio=E.pixelRatio,this.tileSize=E.tileSize,this.source=E.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=E.showCollisionBoxes,this.collectResourceTiming=!!E.collectResourceTiming,this.returnDependencies=!!E.returnDependencies,this.promoteId=E.promoteId,this.inFlightDependencies=[],this.dependencySentinel=-1}parse(E,M,R,j,q){this.status="parsing",this.data=E,this.collisionBoxArray=new l.a3;const re=new l.bm(Object.keys(E.layers).sort()),J=new l.bn(this.tileID,this.promoteId);J.bucketLayerIDs=[];const K={},te={featureIndex:J,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:R},pe=M.familiesBySource[this.source];for(const St in pe){const wt=E.layers[St];if(!wt)continue;wt.version===1&&l.w(`Vector tile source "${this.source}" layer "${St}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Fi=re.encode(St),Zt=[];for(let yi=0;yi<wt.length;yi++){const ki=wt.feature(yi),wr=J.getId(ki,St);Zt.push({feature:ki,id:wr,index:yi,sourceLayerIndex:Fi})}for(const yi of pe[St]){const ki=yi[0];ki.source!==this.source&&l.w(`layer.source = ${ki.source} does not equal this.source = ${this.source}`),ki.minzoom&&this.zoom<Math.floor(ki.minzoom)||ki.maxzoom&&this.zoom>=ki.maxzoom||ki.visibility!=="none"&&(ke(yi,this.zoom,R),(K[ki.id]=ki.createBucket({index:J.bucketLayerIDs.length,layers:yi,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Fi,sourceID:this.source})).populate(Zt,te,this.tileID.canonical),J.bucketLayerIDs.push(yi.map(wr=>wr.id)))}}let de,ge,$e,Xe;const Be=l.aH(te.glyphDependencies,St=>Object.keys(St).map(Number));this.inFlightDependencies.forEach(St=>St?.cancel()),this.inFlightDependencies=[];const Ge=++this.dependencySentinel;Object.keys(Be).length?this.inFlightDependencies.push(j.send("getGlyphs",{uid:this.uid,stacks:Be,source:this.source,tileID:this.tileID,type:"glyphs"},(St,wt)=>{Ge===this.dependencySentinel&&(de||(de=St,ge=wt,Nt.call(this)))})):ge={};const Je=Object.keys(te.iconDependencies);Je.length?this.inFlightDependencies.push(j.send("getImages",{icons:Je,source:this.source,tileID:this.tileID,type:"icons"},(St,wt)=>{Ge===this.dependencySentinel&&(de||(de=St,$e=wt,Nt.call(this)))})):$e={};const Dt=Object.keys(te.patternDependencies);function Nt(){if(de)return q(de);if(ge&&$e&&Xe){const St=new H(ge),wt=new l.bo($e,Xe);for(const Fi in K){const Zt=K[Fi];Zt instanceof l.a4?(ke(Zt.layers,this.zoom,R),l.bp({bucket:Zt,glyphMap:ge,glyphPositions:St.positions,imageMap:$e,imagePositions:wt.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Zt.hasPattern&&(Zt instanceof l.bq||Zt instanceof l.br||Zt instanceof l.bs)&&(ke(Zt.layers,this.zoom,R),Zt.addFeatures(te,this.tileID.canonical,wt.patternPositions))}this.status="done",q(null,{buckets:Object.values(K).filter(Fi=>!Fi.isEmpty()),featureIndex:J,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:St.image,imageAtlas:wt,glyphMap:this.returnDependencies?ge:null,iconMap:this.returnDependencies?$e:null,glyphPositions:this.returnDependencies?St.positions:null})}}Dt.length?this.inFlightDependencies.push(j.send("getImages",{icons:Dt,source:this.source,tileID:this.tileID,type:"patterns"},(St,wt)=>{Ge===this.dependencySentinel&&(de||(de=St,Xe=wt,Nt.call(this)))})):Xe={},Nt.call(this)}}function ke(V,E,M){const R=new l.a8(E);for(const j of V)j.recalculate(R,M)}function ye(V,E){const M=l.l(V.request,(R,j,q,re)=>{if(R)E(R);else if(j)try{const J=new l.bv.VectorTile(new l.bu(j));E(null,{vectorTile:J,rawData:j,cacheControl:q,expires:re})}catch(J){const K=new Uint8Array(j);let te=`Unable to parse the tile at ${V.request.url}, `;te+=K[0]===31&&K[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${J.messge}`,E(new Error(te))}});return()=>{M.cancel(),E()}}class ct{constructor(E,M,R,j){this.actor=E,this.layerIndex=M,this.availableImages=R,this.loadVectorData=j||ye,this.fetching={},this.loading={},this.loaded={}}loadTile(E,M){const R=E.uid;this.loading||(this.loading={});const j=!!(E&&E.request&&E.request.collectResourceTiming)&&new l.bt(E.request),q=this.loading[R]=new Ae(E);q.abort=this.loadVectorData(E,(re,J)=>{if(delete this.loading[R],re||!J)return q.status="done",this.loaded[R]=q,M(re);const K=J.rawData,te={};J.expires&&(te.expires=J.expires),J.cacheControl&&(te.cacheControl=J.cacheControl);const pe={};if(j){const de=j.finish();de&&(pe.resourceTiming=JSON.parse(JSON.stringify(de)))}q.vectorTile=J.vectorTile,q.parse(J.vectorTile,this.layerIndex,this.availableImages,this.actor,(de,ge)=>{if(delete this.fetching[R],de||!ge)return M(de);M(null,l.e({rawTileData:K.slice(0)},ge,te,pe))}),this.loaded=this.loaded||{},this.loaded[R]=q,this.fetching[R]={rawTileData:K,cacheControl:te,resourceTiming:pe}})}reloadTile(E,M){const R=this.loaded,j=E.uid;if(R&&R[j]){const q=R[j];q.showCollisionBoxes=E.showCollisionBoxes,q.status==="parsing"?q.parse(q.vectorTile,this.layerIndex,this.availableImages,this.actor,(re,J)=>{if(re||!J)return M(re,J);let K;if(this.fetching[j]){const{rawTileData:te,cacheControl:pe,resourceTiming:de}=this.fetching[j];delete this.fetching[j],K=l.e({rawTileData:te.slice(0)},J,pe,de)}else K=J;M(null,K)}):q.status==="done"&&(q.vectorTile?q.parse(q.vectorTile,this.layerIndex,this.availableImages,this.actor,M):M())}}abortTile(E,M){const R=this.loading,j=E.uid;R&&R[j]&&R[j].abort&&(R[j].abort(),delete R[j]),M()}removeTile(E,M){const R=this.loaded,j=E.uid;R&&R[j]&&delete R[j],M()}}class dt{constructor(){this.loaded={}}loadTile(E,M){return l._(this,void 0,void 0,function*(){const{uid:R,encoding:j,rawImageData:q,redFactor:re,greenFactor:J,blueFactor:K,baseShift:te}=E,pe=q.width+2,de=q.height+2,ge=l.a(q)?new l.R({width:pe,height:de},yield l.bw(q,-1,-1,pe,de)):q,$e=new l.bx(R,ge,j,re,J,K,te);this.loaded=this.loaded||{},this.loaded[R]=$e,M(null,$e)})}removeTile(E){const M=this.loaded,R=E.uid;M&&M[R]&&delete M[R]}}function et(V,E){if(V.length!==0){Tt(V[0],E);for(var M=1;M<V.length;M++)Tt(V[M],!E)}}function Tt(V,E){for(var M=0,R=0,j=0,q=V.length,re=q-1;j<q;re=j++){var J=(V[j][0]-V[re][0])*(V[re][1]+V[j][1]),K=M+J;R+=Math.abs(M)>=Math.abs(J)?M-K+J:J-K+M,M=K}M+R>=0!=!!E&&V.reverse()}var it=l.by(function V(E,M){var R,j=E&&E.type;if(j==="FeatureCollection")for(R=0;R<E.features.length;R++)V(E.features[R],M);else if(j==="GeometryCollection")for(R=0;R<E.geometries.length;R++)V(E.geometries[R],M);else if(j==="Feature")V(E.geometry,M);else if(j==="Polygon")et(E.coordinates,M);else if(j==="MultiPolygon")for(R=0;R<E.coordinates.length;R++)et(E.coordinates[R],M);return E});const It=l.bv.VectorTileFeature.prototype.toGeoJSON;var qt={exports:{}},Jt=l.bz,Lt=l.bv.VectorTileFeature,ht=bt;function bt(V,E){this.options=E||{},this.features=V,this.length=V.length}function Ke(V,E){this.id=typeof V.id=="number"?V.id:void 0,this.type=V.type,this.rawGeometry=V.type===1?[V.geometry]:V.geometry,this.properties=V.tags,this.extent=E||4096}bt.prototype.feature=function(V){return new Ke(this.features[V],this.options.extent)},Ke.prototype.loadGeometry=function(){var V=this.rawGeometry;this.geometry=[];for(var E=0;E<V.length;E++){for(var M=V[E],R=[],j=0;j<M.length;j++)R.push(new Jt(M[j][0],M[j][1]));this.geometry.push(R)}return this.geometry},Ke.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var V=this.geometry,E=1/0,M=-1/0,R=1/0,j=-1/0,q=0;q<V.length;q++)for(var re=V[q],J=0;J<re.length;J++){var K=re[J];E=Math.min(E,K.x),M=Math.max(M,K.x),R=Math.min(R,K.y),j=Math.max(j,K.y)}return[E,R,M,j]},Ke.prototype.toGeoJSON=Lt.prototype.toGeoJSON;var _t=l.bA,qe=ht;function jt(V){var E=new _t;return function(M,R){for(var j in M.layers)R.writeMessage(3,Qe,M.layers[j])}(V,E),E.finish()}function Qe(V,E){var M;E.writeVarintField(15,V.version||1),E.writeStringField(1,V.name||""),E.writeVarintField(5,V.extent||4096);var R={keys:[],values:[],keycache:{},valuecache:{}};for(M=0;M<V.length;M++)R.feature=V.feature(M),E.writeMessage(2,ot,R);var j=R.keys;for(M=0;M<j.length;M++)E.writeStringField(3,j[M]);var q=R.values;for(M=0;M<q.length;M++)E.writeMessage(4,ai,q[M])}function ot(V,E){var M=V.feature;M.id!==void 0&&E.writeVarintField(1,M.id),E.writeMessage(2,rt,V),E.writeVarintField(3,M.type),E.writeMessage(4,Ot,M)}function rt(V,E){var M=V.feature,R=V.keys,j=V.values,q=V.keycache,re=V.valuecache;for(var J in M.properties){var K=M.properties[J],te=q[J];if(K!==null){te===void 0&&(R.push(J),q[J]=te=R.length-1),E.writeVarint(te);var pe=typeof K;pe!=="string"&&pe!=="boolean"&&pe!=="number"&&(K=JSON.stringify(K));var de=pe+":"+K,ge=re[de];ge===void 0&&(j.push(K),re[de]=ge=j.length-1),E.writeVarint(ge)}}}function gt(V,E){return(E<<3)+(7&V)}function Rt(V){return V<<1^V>>31}function Ot(V,E){for(var M=V.loadGeometry(),R=V.type,j=0,q=0,re=M.length,J=0;J<re;J++){var K=M[J],te=1;R===1&&(te=K.length),E.writeVarint(gt(1,te));for(var pe=R===3?K.length-1:K.length,de=0;de<pe;de++){de===1&&R!==1&&E.writeVarint(gt(2,pe-1));var ge=K[de].x-j,$e=K[de].y-q;E.writeVarint(Rt(ge)),E.writeVarint(Rt($e)),j+=ge,q+=$e}R===3&&E.writeVarint(gt(7,1))}}function ai(V,E){var M=typeof V;M==="string"?E.writeStringField(1,V):M==="boolean"?E.writeBooleanField(7,V):M==="number"&&(V%1!=0?E.writeDoubleField(3,V):V<0?E.writeSVarintField(6,V):E.writeVarintField(5,V))}qt.exports=jt,qt.exports.fromVectorTileJs=jt,qt.exports.fromGeojsonVt=function(V,E){E=E||{};var M={};for(var R in V)M[R]=new qe(V[R].features,E),M[R].name=R,M[R].version=E.version,M[R].extent=E.extent;return jt({layers:M})},qt.exports.GeoJSONWrapper=qe;var Pi=l.by(qt.exports);const vr={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:V=>V},gi=Math.fround||(Bi=new Float32Array(1),V=>(Bi[0]=+V,Bi[0]));var Bi;const zt=3,Ei=5,$r=6;class en{constructor(E){this.options=Object.assign(Object.create(vr),E),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(E){const{log:M,minZoom:R,maxZoom:j}=this.options;M&&console.time("total time");const q=`prepare ${E.length} points`;M&&console.time(q),this.points=E;const re=[];for(let K=0;K<E.length;K++){const te=E[K];if(!te.geometry)continue;const[pe,de]=te.geometry.coordinates,ge=gi(zr(pe)),$e=gi(xr(de));re.push(ge,$e,1/0,K,-1,1),this.options.reduce&&re.push(0)}let J=this.trees[j+1]=this._createTree(re);M&&console.timeEnd(q);for(let K=j;K>=R;K--){const te=+Date.now();J=this.trees[K]=this._createTree(this._cluster(J,K)),M&&console.log("z%d: %d clusters in %dms",K,J.numItems,+Date.now()-te)}return M&&console.timeEnd("total time"),this}getClusters(E,M){let R=((E[0]+180)%360+360)%360-180;const j=Math.max(-90,Math.min(90,E[1]));let q=E[2]===180?180:((E[2]+180)%360+360)%360-180;const re=Math.max(-90,Math.min(90,E[3]));if(E[2]-E[0]>=360)R=-180,q=180;else if(R>q){const de=this.getClusters([R,j,180,re],M),ge=this.getClusters([-180,j,q,re],M);return de.concat(ge)}const J=this.trees[this._limitZoom(M)],K=J.range(zr(R),xr(re),zr(q),xr(j)),te=J.data,pe=[];for(const de of K){const ge=this.stride*de;pe.push(te[ge+Ei]>1?ra(te,ge,this.clusterProps):this.points[te[ge+zt]])}return pe}getChildren(E){const M=this._getOriginId(E),R=this._getOriginZoom(E),j="No cluster with the specified id.",q=this.trees[R];if(!q)throw new Error(j);const re=q.data;if(M*this.stride>=re.length)throw new Error(j);const J=this.options.radius/(this.options.extent*Math.pow(2,R-1)),K=q.within(re[M*this.stride],re[M*this.stride+1],J),te=[];for(const pe of K){const de=pe*this.stride;re[de+4]===E&&te.push(re[de+Ei]>1?ra(re,de,this.clusterProps):this.points[re[de+zt]])}if(te.length===0)throw new Error(j);return te}getLeaves(E,M,R){const j=[];return this._appendLeaves(j,E,M=M||10,R=R||0,0),j}getTile(E,M,R){const j=this.trees[this._limitZoom(E)],q=Math.pow(2,E),{extent:re,radius:J}=this.options,K=J/re,te=(R-K)/q,pe=(R+1+K)/q,de={features:[]};return this._addTileFeatures(j.range((M-K)/q,te,(M+1+K)/q,pe),j.data,M,R,q,de),M===0&&this._addTileFeatures(j.range(1-K/q,te,1,pe),j.data,q,R,q,de),M===q-1&&this._addTileFeatures(j.range(0,te,K/q,pe),j.data,-1,R,q,de),de.features.length?de:null}getClusterExpansionZoom(E){let M=this._getOriginZoom(E)-1;for(;M<=this.options.maxZoom;){const R=this.getChildren(E);if(M++,R.length!==1)break;E=R[0].properties.cluster_id}return M}_appendLeaves(E,M,R,j,q){const re=this.getChildren(M);for(const J of re){const K=J.properties;if(K&&K.cluster?q+K.point_count<=j?q+=K.point_count:q=this._appendLeaves(E,K.cluster_id,R,j,q):q<j?q++:E.push(J),E.length===R)break}return q}_createTree(E){const M=new l.av(E.length/this.stride|0,this.options.nodeSize,Float32Array);for(let R=0;R<E.length;R+=this.stride)M.add(E[R],E[R+1]);return M.finish(),M.data=E,M}_addTileFeatures(E,M,R,j,q,re){for(const J of E){const K=J*this.stride,te=M[K+Ei]>1;let pe,de,ge;if(te)pe=_n(M,K,this.clusterProps),de=M[K],ge=M[K+1];else{const Be=this.points[M[K+zt]];pe=Be.properties;const[Ge,Je]=Be.geometry.coordinates;de=zr(Ge),ge=xr(Je)}const $e={type:1,geometry:[[Math.round(this.options.extent*(de*q-R)),Math.round(this.options.extent*(ge*q-j))]],tags:pe};let Xe;Xe=te||this.options.generateId?M[K+zt]:this.points[M[K+zt]].id,Xe!==void 0&&($e.id=Xe),re.features.push($e)}}_limitZoom(E){return Math.max(this.options.minZoom,Math.min(Math.floor(+E),this.options.maxZoom+1))}_cluster(E,M){const{radius:R,extent:j,reduce:q,minPoints:re}=this.options,J=R/(j*Math.pow(2,M)),K=E.data,te=[],pe=this.stride;for(let de=0;de<K.length;de+=pe){if(K[de+2]<=M)continue;K[de+2]=M;const ge=K[de],$e=K[de+1],Xe=E.within(K[de],K[de+1],J),Be=K[de+Ei];let Ge=Be;for(const Je of Xe){const Dt=Je*pe;K[Dt+2]>M&&(Ge+=K[Dt+Ei])}if(Ge>Be&&Ge>=re){let Je,Dt=ge*Be,Nt=$e*Be,St=-1;const wt=((de/pe|0)<<5)+(M+1)+this.points.length;for(const Fi of Xe){const Zt=Fi*pe;if(K[Zt+2]<=M)continue;K[Zt+2]=M;const yi=K[Zt+Ei];Dt+=K[Zt]*yi,Nt+=K[Zt+1]*yi,K[Zt+4]=wt,q&&(Je||(Je=this._map(K,de,!0),St=this.clusterProps.length,this.clusterProps.push(Je)),q(Je,this._map(K,Zt)))}K[de+4]=wt,te.push(Dt/Ge,Nt/Ge,1/0,wt,-1,Ge),q&&te.push(St)}else{for(let Je=0;Je<pe;Je++)te.push(K[de+Je]);if(Ge>1)for(const Je of Xe){const Dt=Je*pe;if(!(K[Dt+2]<=M)){K[Dt+2]=M;for(let Nt=0;Nt<pe;Nt++)te.push(K[Dt+Nt])}}}}return te}_getOriginId(E){return E-this.points.length>>5}_getOriginZoom(E){return(E-this.points.length)%32}_map(E,M,R){if(E[M+Ei]>1){const re=this.clusterProps[E[M+$r]];return R?Object.assign({},re):re}const j=this.points[E[M+zt]].properties,q=this.options.map(j);return R&&q===j?Object.assign({},q):q}}function ra(V,E,M){return{type:"Feature",id:V[E+zt],properties:_n(V,E,M),geometry:{type:"Point",coordinates:[(R=V[E],360*(R-.5)),za(V[E+1])]}};var R}function _n(V,E,M){const R=V[E+Ei],j=R>=1e4?`${Math.round(R/1e3)}k`:R>=1e3?Math.round(R/100)/10+"k":R,q=V[E+$r],re=q===-1?{}:Object.assign({},M[q]);return Object.assign(re,{cluster:!0,cluster_id:V[E+zt],point_count:R,point_count_abbreviated:j})}function zr(V){return V/360+.5}function xr(V){const E=Math.sin(V*Math.PI/180),M=.5-.25*Math.log((1+E)/(1-E))/Math.PI;return M<0?0:M>1?1:M}function za(V){const E=(180-360*V)*Math.PI/180;return 360*Math.atan(Math.exp(E))/Math.PI-90}function vn(V,E,M,R){for(var j,q=R,re=M-E>>1,J=M-E,K=V[E],te=V[E+1],pe=V[M],de=V[M+1],ge=E+3;ge<M;ge+=3){var $e=Da(V[ge],V[ge+1],K,te,pe,de);if($e>q)j=ge,q=$e;else if($e===q){var Xe=Math.abs(ge-re);Xe<J&&(j=ge,J=Xe)}}q>R&&(j-E>3&&vn(V,E,j,R),V[j+2]=q,M-j>3&&vn(V,j,M,R))}function Da(V,E,M,R,j,q){var re=j-M,J=q-R;if(re!==0||J!==0){var K=((V-M)*re+(E-R)*J)/(re*re+J*J);K>1?(M=j,R=q):K>0&&(M+=re*K,R+=J*K)}return(re=V-M)*re+(J=E-R)*J}function tn(V,E,M,R){var j={id:V===void 0?null:V,type:E,geometry:M,tags:R,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(q){var re=q.geometry,J=q.type;if(J==="Point"||J==="MultiPoint"||J==="LineString")na(q,re);else if(J==="Polygon"||J==="MultiLineString")for(var K=0;K<re.length;K++)na(q,re[K]);else if(J==="MultiPolygon")for(K=0;K<re.length;K++)for(var te=0;te<re[K].length;te++)na(q,re[K][te])}(j),j}function na(V,E){for(var M=0;M<E.length;M+=3)V.minX=Math.min(V.minX,E[M]),V.minY=Math.min(V.minY,E[M+1]),V.maxX=Math.max(V.maxX,E[M]),V.maxY=Math.max(V.maxY,E[M+1])}function Dn(V,E,M,R){if(E.geometry){var j=E.geometry.coordinates,q=E.geometry.type,re=Math.pow(M.tolerance/((1<<M.maxZoom)*M.extent),2),J=[],K=E.id;if(M.promoteId?K=E.properties[M.promoteId]:M.generateId&&(K=R||0),q==="Point")xn(j,J);else if(q==="MultiPoint")for(var te=0;te<j.length;te++)xn(j[te],J);else if(q==="LineString")bn(j,J,re,!1);else if(q==="MultiLineString"){if(M.lineMetrics){for(te=0;te<j.length;te++)bn(j[te],J=[],re,!1),V.push(tn(K,"LineString",J,E.properties));return}Rn(j,J,re,!1)}else if(q==="Polygon")Rn(j,J,re,!0);else{if(q!=="MultiPolygon"){if(q==="GeometryCollection"){for(te=0;te<E.geometry.geometries.length;te++)Dn(V,{id:K,geometry:E.geometry.geometries[te],properties:E.properties},M,R);return}throw new Error("Input data is not a valid GeoJSON object.")}for(te=0;te<j.length;te++){var pe=[];Rn(j[te],pe,re,!0),J.push(pe)}}V.push(tn(K,q,J,E.properties))}}function xn(V,E){E.push(ue(V[0])),E.push(Ji(V[1])),E.push(0)}function bn(V,E,M,R){for(var j,q,re=0,J=0;J<V.length;J++){var K=ue(V[J][0]),te=Ji(V[J][1]);E.push(K),E.push(te),E.push(0),J>0&&(re+=R?(j*te-K*q)/2:Math.sqrt(Math.pow(K-j,2)+Math.pow(te-q,2))),j=K,q=te}var pe=E.length-3;E[2]=1,vn(E,0,pe,M),E[pe+2]=1,E.size=Math.abs(re),E.start=0,E.end=E.size}function Rn(V,E,M,R){for(var j=0;j<V.length;j++){var q=[];bn(V[j],q,M,R),E.push(q)}}function ue(V){return V/360+.5}function Ji(V){var E=Math.sin(V*Math.PI/180),M=.5-.25*Math.log((1+E)/(1-E))/Math.PI;return M<0?0:M>1?1:M}function br(V,E,M,R,j,q,re,J){if(R/=E,q>=(M/=E)&&re<R)return V;if(re<M||q>=R)return null;for(var K=[],te=0;te<V.length;te++){var pe=V[te],de=pe.geometry,ge=pe.type,$e=j===0?pe.minX:pe.minY,Xe=j===0?pe.maxX:pe.maxY;if($e>=M&&Xe<R)K.push(pe);else if(!(Xe<M||$e>=R)){var Be=[];if(ge==="Point"||ge==="MultiPoint")Gt(de,Be,M,R,j);else if(ge==="LineString")At(de,Be,M,R,j,!1,J.lineMetrics);else if(ge==="MultiLineString")aa(de,Be,M,R,j,!1);else if(ge==="Polygon")aa(de,Be,M,R,j,!0);else if(ge==="MultiPolygon")for(var Ge=0;Ge<de.length;Ge++){var Je=[];aa(de[Ge],Je,M,R,j,!0),Je.length&&Be.push(Je)}if(Be.length){if(J.lineMetrics&&ge==="LineString"){for(Ge=0;Ge<Be.length;Ge++)K.push(tn(pe.id,ge,Be[Ge],pe.tags));continue}ge!=="LineString"&&ge!=="MultiLineString"||(Be.length===1?(ge="LineString",Be=Be[0]):ge="MultiLineString"),ge!=="Point"&&ge!=="MultiPoint"||(ge=Be.length===3?"Point":"MultiPoint"),K.push(tn(pe.id,ge,Be,pe.tags))}}}return K.length?K:null}function Gt(V,E,M,R,j){for(var q=0;q<V.length;q+=3){var re=V[q+j];re>=M&&re<=R&&(E.push(V[q]),E.push(V[q+1]),E.push(V[q+2]))}}function At(V,E,M,R,j,q,re){for(var J,K,te=jr(V),pe=j===0?os:sa,de=V.start,ge=0;ge<V.length-3;ge+=3){var $e=V[ge],Xe=V[ge+1],Be=V[ge+2],Ge=V[ge+3],Je=V[ge+4],Dt=j===0?$e:Xe,Nt=j===0?Ge:Je,St=!1;re&&(J=Math.sqrt(Math.pow($e-Ge,2)+Math.pow(Xe-Je,2))),Dt<M?Nt>M&&(K=pe(te,$e,Xe,Ge,Je,M),re&&(te.start=de+J*K)):Dt>R?Nt<R&&(K=pe(te,$e,Xe,Ge,Je,R),re&&(te.start=de+J*K)):rn(te,$e,Xe,Be),Nt<M&&Dt>=M&&(K=pe(te,$e,Xe,Ge,Je,M),St=!0),Nt>R&&Dt<=R&&(K=pe(te,$e,Xe,Ge,Je,R),St=!0),!q&&St&&(re&&(te.end=de+J*K),E.push(te),te=jr(V)),re&&(de+=J)}var wt=V.length-3;$e=V[wt],Xe=V[wt+1],Be=V[wt+2],(Dt=j===0?$e:Xe)>=M&&Dt<=R&&rn(te,$e,Xe,Be),wt=te.length-3,q&&wt>=3&&(te[wt]!==te[0]||te[wt+1]!==te[1])&&rn(te,te[0],te[1],te[2]),te.length&&E.push(te)}function jr(V){var E=[];return E.size=V.size,E.start=V.start,E.end=V.end,E}function aa(V,E,M,R,j,q){for(var re=0;re<V.length;re++)At(V[re],E,M,R,j,q,!1)}function rn(V,E,M,R){V.push(E),V.push(M),V.push(R)}function os(V,E,M,R,j,q){var re=(q-E)/(R-E);return V.push(q),V.push(M+(j-M)*re),V.push(1),re}function sa(V,E,M,R,j,q){var re=(q-M)/(j-M);return V.push(E+(R-E)*re),V.push(q),V.push(1),re}function wn(V,E){for(var M=[],R=0;R<V.length;R++){var j,q=V[R],re=q.type;if(re==="Point"||re==="MultiPoint"||re==="LineString")j=Bn(q.geometry,E);else if(re==="MultiLineString"||re==="Polygon"){j=[];for(var J=0;J<q.geometry.length;J++)j.push(Bn(q.geometry[J],E))}else if(re==="MultiPolygon")for(j=[],J=0;J<q.geometry.length;J++){for(var K=[],te=0;te<q.geometry[J].length;te++)K.push(Bn(q.geometry[J][te],E));j.push(K)}M.push(tn(q.id,re,j,q.tags))}return M}function Bn(V,E){var M=[];M.size=V.size,V.start!==void 0&&(M.start=V.start,M.end=V.end);for(var R=0;R<V.length;R+=3)M.push(V[R]+E,V[R+1],V[R+2]);return M}function Se(V,E){if(V.transformed)return V;var M,R,j,q=1<<V.z,re=V.x,J=V.y;for(M=0;M<V.features.length;M++){var K=V.features[M],te=K.geometry,pe=K.type;if(K.geometry=[],pe===1)for(R=0;R<te.length;R+=2)K.geometry.push(Gr(te[R],te[R+1],E,q,re,J));else for(R=0;R<te.length;R++){var de=[];for(j=0;j<te[R].length;j+=2)de.push(Gr(te[R][j],te[R][j+1],E,q,re,J));K.geometry.push(de)}}return V.transformed=!0,V}function Gr(V,E,M,R,j,q){return[Math.round(M*(V*R-j)),Math.round(M*(E*R-q))]}function si(V,E,M,R,j){for(var q=E===j.maxZoom?0:j.tolerance/((1<<E)*j.extent),re={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:M,y:R,z:E,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},J=0;J<V.length;J++){re.numFeatures++,Fn(re,V[J],q,j);var K=V[J].minX,te=V[J].minY,pe=V[J].maxX,de=V[J].maxY;K<re.minX&&(re.minX=K),te<re.minY&&(re.minY=te),pe>re.maxX&&(re.maxX=pe),de>re.maxY&&(re.maxY=de)}return re}function Fn(V,E,M,R){var j=E.geometry,q=E.type,re=[];if(q==="Point"||q==="MultiPoint")for(var J=0;J<j.length;J+=3)re.push(j[J]),re.push(j[J+1]),V.numPoints++,V.numSimplified++;else if(q==="LineString")nn(re,j,V,M,!1,!1);else if(q==="MultiLineString"||q==="Polygon")for(J=0;J<j.length;J++)nn(re,j[J],V,M,q==="Polygon",J===0);else if(q==="MultiPolygon")for(var K=0;K<j.length;K++){var te=j[K];for(J=0;J<te.length;J++)nn(re,te[J],V,M,!0,J===0)}if(re.length){var pe=E.tags||null;if(q==="LineString"&&R.lineMetrics){for(var de in pe={},E.tags)pe[de]=E.tags[de];pe.mapbox_clip_start=j.start/j.size,pe.mapbox_clip_end=j.end/j.size}var ge={geometry:re,type:q==="Polygon"||q==="MultiPolygon"?3:q==="LineString"||q==="MultiLineString"?2:1,tags:pe};E.id!==null&&(ge.id=E.id),V.features.push(ge)}}function nn(V,E,M,R,j,q){var re=R*R;if(R>0&&E.size<(j?re:R))M.numPoints+=E.length/3;else{for(var J=[],K=0;K<E.length;K+=3)(R===0||E[K+2]>re)&&(M.numSimplified++,J.push(E[K]),J.push(E[K+1])),M.numPoints++;j&&function(te,pe){for(var de=0,ge=0,$e=te.length,Xe=$e-2;ge<$e;Xe=ge,ge+=2)de+=(te[ge]-te[Xe])*(te[ge+1]+te[Xe+1]);if(de>0===pe)for(ge=0,$e=te.length;ge<$e/2;ge+=2){var Be=te[ge],Ge=te[ge+1];te[ge]=te[$e-2-ge],te[ge+1]=te[$e-1-ge],te[$e-2-ge]=Be,te[$e-1-ge]=Ge}}(J,q),V.push(J)}}function Ie(V,E){var M=(E=this.options=function(j,q){for(var re in q)j[re]=q[re];return j}(Object.create(this.options),E)).debug;if(M&&console.time("preprocess data"),E.maxZoom<0||E.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(E.promoteId&&E.generateId)throw new Error("promoteId and generateId cannot be used together.");var R=function(j,q){var re=[];if(j.type==="FeatureCollection")for(var J=0;J<j.features.length;J++)Dn(re,j.features[J],q,J);else Dn(re,j.type==="Feature"?j:{geometry:j},q);return re}(V,E);this.tiles={},this.tileCoords=[],M&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",E.indexMaxZoom,E.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),R=function(j,q){var re=q.buffer/q.extent,J=j,K=br(j,1,-1-re,re,0,-1,2,q),te=br(j,1,1-re,2+re,0,-1,2,q);return(K||te)&&(J=br(j,1,-re,1+re,0,-1,2,q)||[],K&&(J=wn(K,1).concat(J)),te&&(J=J.concat(wn(te,-1)))),J}(R,E),R.length&&this.splitTile(R,0,0,0),M&&(R.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function st(V,E,M){return 32*((1<<V)*M+E)+V}function Ye(V,E){return E?V.properties[E]:V.id}function qi(V,E){if(V==null)return!0;if(V.type==="Feature")return Ye(V,E)!=null;if(V.type==="FeatureCollection"){const M=new Set;for(const R of V.features){const j=Ye(R,E);if(j==null||M.has(j))return!1;M.add(j)}return!0}return!1}function qr(V,E){const M=new Map;if(V!=null)if(V.type==="Feature")M.set(Ye(V,E),V);else for(const R of V.features)M.set(Ye(R,E),R);return M}Ie.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Ie.prototype.splitTile=function(V,E,M,R,j,q,re){for(var J=[V,E,M,R],K=this.options,te=K.debug;J.length;){R=J.pop(),M=J.pop(),E=J.pop(),V=J.pop();var pe=1<<E,de=st(E,M,R),ge=this.tiles[de];if(!ge&&(te>1&&console.time("creation"),ge=this.tiles[de]=si(V,E,M,R,K),this.tileCoords.push({z:E,x:M,y:R}),te)){te>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",E,M,R,ge.numFeatures,ge.numPoints,ge.numSimplified),console.timeEnd("creation"));var $e="z"+E;this.stats[$e]=(this.stats[$e]||0)+1,this.total++}if(ge.source=V,j){if(E===K.maxZoom||E===j)continue;var Xe=1<<j-E;if(M!==Math.floor(q/Xe)||R!==Math.floor(re/Xe))continue}else if(E===K.indexMaxZoom||ge.numPoints<=K.indexMaxPoints)continue;if(ge.source=null,V.length!==0){te>1&&console.time("clipping");var Be,Ge,Je,Dt,Nt,St,wt=.5*K.buffer/K.extent,Fi=.5-wt,Zt=.5+wt,yi=1+wt;Be=Ge=Je=Dt=null,Nt=br(V,pe,M-wt,M+Zt,0,ge.minX,ge.maxX,K),St=br(V,pe,M+Fi,M+yi,0,ge.minX,ge.maxX,K),V=null,Nt&&(Be=br(Nt,pe,R-wt,R+Zt,1,ge.minY,ge.maxY,K),Ge=br(Nt,pe,R+Fi,R+yi,1,ge.minY,ge.maxY,K),Nt=null),St&&(Je=br(St,pe,R-wt,R+Zt,1,ge.minY,ge.maxY,K),Dt=br(St,pe,R+Fi,R+yi,1,ge.minY,ge.maxY,K),St=null),te>1&&console.timeEnd("clipping"),J.push(Be||[],E+1,2*M,2*R),J.push(Ge||[],E+1,2*M,2*R+1),J.push(Je||[],E+1,2*M+1,2*R),J.push(Dt||[],E+1,2*M+1,2*R+1)}}},Ie.prototype.getTile=function(V,E,M){var R=this.options,j=R.extent,q=R.debug;if(V<0||V>24)return null;var re=1<<V,J=st(V,E=(E%re+re)%re,M);if(this.tiles[J])return Se(this.tiles[J],j);q>1&&console.log("drilling down to z%d-%d-%d",V,E,M);for(var K,te=V,pe=E,de=M;!K&&te>0;)te--,pe=Math.floor(pe/2),de=Math.floor(de/2),K=this.tiles[st(te,pe,de)];return K&&K.source?(q>1&&console.log("found parent tile z%d-%d-%d",te,pe,de),q>1&&console.time("drilling down"),this.splitTile(K.source,te,pe,de,V,E,M),q>1&&console.timeEnd("drilling down"),this.tiles[J]?Se(this.tiles[J],j):null):null};class tt extends ct{constructor(E,M,R,j){super(E,M,R),this._dataUpdateable=new Map,this.loadGeoJSON=(q,re)=>{const{promoteId:J}=q;if(q.request)return l.f(q.request,(K,te,pe,de)=>{this._dataUpdateable=qi(te,J)?qr(te,J):void 0,re(K,te,pe,de)});if(typeof q.data=="string")try{const K=JSON.parse(q.data);this._dataUpdateable=qi(K,J)?qr(K,J):void 0,re(null,K)}catch{re(new Error(`Input data given to '${q.source}' is not a valid GeoJSON object.`))}else q.dataDiff?this._dataUpdateable?(function(K,te,pe){var de,ge,$e,Xe;if(te.removeAll&&K.clear(),te.remove)for(const Be of te.remove)K.delete(Be);if(te.add)for(const Be of te.add){const Ge=Ye(Be,pe);Ge!=null&&K.set(Ge,Be)}if(te.update)for(const Be of te.update){let Ge=K.get(Be.id);if(Ge==null)continue;const Je=!Be.removeAllProperties&&(((de=Be.removeProperties)===null||de===void 0?void 0:de.length)>0||((ge=Be.addOrUpdateProperties)===null||ge===void 0?void 0:ge.length)>0);if((Be.newGeometry||Be.removeAllProperties||Je)&&(Ge=Object.assign({},Ge),K.set(Be.id,Ge),Je&&(Ge.properties=Object.assign({},Ge.properties))),Be.newGeometry&&(Ge.geometry=Be.newGeometry),Be.removeAllProperties)Ge.properties={};else if((($e=Be.removeProperties)===null||$e===void 0?void 0:$e.length)>0)for(const Dt of Be.removeProperties)Object.prototype.hasOwnProperty.call(Ge.properties,Dt)&&delete Ge.properties[Dt];if(((Xe=Be.addOrUpdateProperties)===null||Xe===void 0?void 0:Xe.length)>0)for(const{key:Dt,value:Nt}of Be.addOrUpdateProperties)Ge.properties[Dt]=Nt}}(this._dataUpdateable,q.dataDiff,J),re(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):re(new Error(`Cannot update existing geojson data in ${q.source}`)):re(new Error(`Input data given to '${q.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},this.loadVectorData=this.loadGeoJSONTile,j&&(this.loadGeoJSON=j)}loadGeoJSONTile(E,M){const R=E.tileID.canonical;if(!this._geoJSONIndex)return M(null,null);const j=this._geoJSONIndex.getTile(R.z,R.x,R.y);if(!j)return M(null,null);const q=new class{constructor(J){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=l.N,this.length=J.length,this._features=J}feature(J){return new class{constructor(K){this._feature=K,this.extent=l.N,this.type=K.type,this.properties=K.tags,"id"in K&&!isNaN(K.id)&&(this.id=parseInt(K.id,10))}loadGeometry(){if(this._feature.type===1){const K=[];for(const te of this._feature.geometry)K.push([new l.P(te[0],te[1])]);return K}{const K=[];for(const te of this._feature.geometry){const pe=[];for(const de of te)pe.push(new l.P(de[0],de[1]));K.push(pe)}return K}}toGeoJSON(K,te,pe){return It.call(this,K,te,pe)}}(this._features[J])}}(j.features);let re=Pi(q);re.byteOffset===0&&re.byteLength===re.buffer.byteLength||(re=new Uint8Array(re)),M(null,{vectorTile:q,rawData:re.buffer})}loadData(E,M){var R;(R=this._pendingRequest)===null||R===void 0||R.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const j=!!(E&&E.request&&E.request.collectResourceTiming)&&new l.bt(E.request);this._pendingCallback=M,this._pendingRequest=this.loadGeoJSON(E,(q,re)=>{if(delete this._pendingCallback,delete this._pendingRequest,q||!re)return M(q);if(typeof re!="object")return M(new Error(`Input data given to '${E.source}' is not a valid GeoJSON object.`));{it(re,!0);try{if(E.filter){const K=l.bB(E.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(K.result==="error")throw new Error(K.value.map(pe=>`${pe.key}: ${pe.message}`).join(", "));re={type:"FeatureCollection",features:re.features.filter(pe=>K.value.evaluate({zoom:0},pe))}}this._geoJSONIndex=E.cluster?new en(function({superclusterOptions:K,clusterProperties:te}){if(!te||!K)return K;const pe={},de={},ge={accumulated:null,zoom:0},$e={properties:null},Xe=Object.keys(te);for(const Be of Xe){const[Ge,Je]=te[Be],Dt=l.bB(Je),Nt=l.bB(typeof Ge=="string"?[Ge,["accumulated"],["get",Be]]:Ge);pe[Be]=Dt.value,de[Be]=Nt.value}return K.map=Be=>{$e.properties=Be;const Ge={};for(const Je of Xe)Ge[Je]=pe[Je].evaluate(ge,$e);return Ge},K.reduce=(Be,Ge)=>{$e.properties=Ge;for(const Je of Xe)ge.accumulated=Be[Je],Be[Je]=de[Je].evaluate(ge,$e)},K}(E)).load(re.features):function(K,te){return new Ie(K,te)}(re,E.geojsonVtOptions)}catch(K){return M(K)}this.loaded={};const J={};if(j){const K=j.finish();K&&(J.resourceTiming={},J.resourceTiming[E.source]=JSON.parse(JSON.stringify(K)))}M(null,J)}})}reloadTile(E,M){const R=this.loaded;return R&&R[E.uid]?super.reloadTile(E,M):this.loadTile(E,M)}removeSource(E,M){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),M()}getClusterExpansionZoom(E,M){try{M(null,this._geoJSONIndex.getClusterExpansionZoom(E.clusterId))}catch(R){M(R)}}getClusterChildren(E,M){try{M(null,this._geoJSONIndex.getChildren(E.clusterId))}catch(R){M(R)}}getClusterLeaves(E,M){try{M(null,this._geoJSONIndex.getLeaves(E.clusterId,E.limit,E.offset))}catch(R){M(R)}}}class an{constructor(E){this.self=E,this.actor=new l.C(E,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:ct,geojson:tt},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(M,R)=>{if(this.workerSourceTypes[M])throw new Error(`Worker source with name "${M}" already registered.`);this.workerSourceTypes[M]=R},this.self.registerRTLTextPlugin=M=>{if(l.bC.isParsed())throw new Error("RTL text plugin already registered.");l.bC.applyArabicShaping=M.applyArabicShaping,l.bC.processBidirectionalText=M.processBidirectionalText,l.bC.processStyledBidirectionalText=M.processStyledBidirectionalText}}setReferrer(E,M){this.referrer=M}setImages(E,M,R){this.availableImages[E]=M;for(const j in this.workerSources[E]){const q=this.workerSources[E][j];for(const re in q)q[re].availableImages=M}R()}setLayers(E,M,R){this.getLayerIndex(E).replace(M),R()}updateLayers(E,M,R){this.getLayerIndex(E).update(M.layers,M.removedIds),R()}loadTile(E,M,R){this.getWorkerSource(E,M.type,M.source).loadTile(M,R)}loadDEMTile(E,M,R){this.getDEMWorkerSource(E,M.source).loadTile(M,R)}reloadTile(E,M,R){this.getWorkerSource(E,M.type,M.source).reloadTile(M,R)}abortTile(E,M,R){this.getWorkerSource(E,M.type,M.source).abortTile(M,R)}removeTile(E,M,R){this.getWorkerSource(E,M.type,M.source).removeTile(M,R)}removeDEMTile(E,M){this.getDEMWorkerSource(E,M.source).removeTile(M)}removeSource(E,M,R){if(!this.workerSources[E]||!this.workerSources[E][M.type]||!this.workerSources[E][M.type][M.source])return;const j=this.workerSources[E][M.type][M.source];delete this.workerSources[E][M.type][M.source],j.removeSource!==void 0?j.removeSource(M,R):R()}loadWorkerSource(E,M,R){try{this.self.importScripts(M.url),R()}catch(j){R(j.toString())}}syncRTLPluginState(E,M,R){try{l.bC.setState(M);const j=l.bC.getPluginURL();if(l.bC.isLoaded()&&!l.bC.isParsed()&&j!=null){this.self.importScripts(j);const q=l.bC.isParsed();R(q?void 0:new Error(`RTL Text Plugin failed to import scripts from ${j}`),q)}}catch(j){R(j.toString())}}getAvailableImages(E){let M=this.availableImages[E];return M||(M=[]),M}getLayerIndex(E){let M=this.layerIndexes[E];return M||(M=this.layerIndexes[E]=new he),M}getWorkerSource(E,M,R){return this.workerSources[E]||(this.workerSources[E]={}),this.workerSources[E][M]||(this.workerSources[E][M]={}),this.workerSources[E][M][R]||(this.workerSources[E][M][R]=new this.workerSourceTypes[M]({send:(j,q,re)=>{this.actor.send(j,q,re,E)}},this.getLayerIndex(E),this.getAvailableImages(E))),this.workerSources[E][M][R]}getDEMWorkerSource(E,M){return this.demWorkerSources[E]||(this.demWorkerSources[E]={}),this.demWorkerSources[E][M]||(this.demWorkerSources[E][M]=new dt),this.demWorkerSources[E][M]}}return l.i()&&(self.worker=new an(self)),an}),X(["./shared"],function(l){var he="3.5.2";class H{static testProp(t){if(!H.docStyle)return t[0];for(let n=0;n<t.length;n++)if(t[n]in H.docStyle)return t[n];return t[0]}static create(t,n,s){const c=window.document.createElement(t);return n!==void 0&&(c.className=n),s&&s.appendChild(c),c}static createNS(t,n){return window.document.createElementNS(t,n)}static disableDrag(){H.docStyle&&H.selectProp&&(H.userSelect=H.docStyle[H.selectProp],H.docStyle[H.selectProp]="none")}static enableDrag(){H.docStyle&&H.selectProp&&(H.docStyle[H.selectProp]=H.userSelect)}static setTransform(t,n){t.style[H.transformProp]=n}static addEventListener(t,n,s,c={}){t.addEventListener(n,s,"passive"in c?c:c.capture)}static removeEventListener(t,n,s,c={}){t.removeEventListener(n,s,"passive"in c?c:c.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",H.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",H.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",H.suppressClickInternal,!0)},0)}static mousePos(t,n){const s=t.getBoundingClientRect();return new l.P(n.clientX-s.left-t.clientLeft,n.clientY-s.top-t.clientTop)}static touchPos(t,n){const s=t.getBoundingClientRect(),c=[];for(let p=0;p<n.length;p++)c.push(new l.P(n[p].clientX-s.left-t.clientLeft,n[p].clientY-s.top-t.clientTop));return c}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}H.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,H.selectProp=H.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),H.transformProp=H.testProp(["transform","WebkitTransform"]);const Ae={supported:!1,testSupport:function(h){!ct&&ye&&(dt?et(h):ke=h)}};let ke,ye,ct=!1,dt=!1;function et(h){const t=h.createTexture();h.bindTexture(h.TEXTURE_2D,t);try{if(h.texImage2D(h.TEXTURE_2D,0,h.RGBA,h.RGBA,h.UNSIGNED_BYTE,ye),h.isContextLost())return;Ae.supported=!0}catch{}h.deleteTexture(t),ct=!0}var Tt,it;typeof document<"u"&&(ye=document.createElement("img"),ye.onload=function(){ke&&et(ke),ke=null,dt=!0},ye.onerror=function(){ct=!0,ke=null},ye.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(h){let t,n,s,c;h.resetRequestQueue=()=>{t=[],n=0,s=0,c={}},h.addThrottleControl=S=>{const I=s++;return c[I]=S,I},h.removeThrottleControl=S=>{delete c[S],y()},h.getImage=(S,I,A=!0)=>{Ae.supported&&(S.headers||(S.headers={}),S.headers.accept="image/webp,*/*");const L={requestParameters:S,supportImageRefresh:A,callback:I,cancelled:!1,completed:!1,cancel:()=>{L.completed||L.cancelled||(L.cancelled=!0,L.innerRequest&&(L.innerRequest.cancel(),n--),y())}};return t.push(L),y(),L};const p=S=>{const{requestParameters:I,supportImageRefresh:A,callback:L}=S;return l.e(I,{type:"image"}),(A!==!1||l.i()||l.g(I.url)||I.headers&&!Object.keys(I.headers).reduce((U,N)=>U&&N==="accept",!0)?l.m:x)(I,(U,N,$,F)=>{g(S,L,U,N,$,F)})},g=(S,I,A,L,U,N)=>{A?I(A):L instanceof HTMLImageElement||l.a(L)?I(null,L):L&&(($,F)=>{typeof createImageBitmap=="function"?l.b($,F):l.d($,F)})(L,($,F)=>{$!=null?I($):F!=null&&I(null,F,{cacheControl:U,expires:N})}),S.cancelled||(S.completed=!0,n--,y())},y=()=>{const S=(()=>{const I=Object.keys(c);let A=!1;if(I.length>0){for(const L of I)if(A=c[L](),A)break}return A})()?l.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:l.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let I=n;I<S&&t.length>0;I++){const A=t.shift();if(A.cancelled){I--;continue}const L=p(A);n++,A.innerRequest=L}},x=(S,I)=>{const A=new Image,L=S.url;let U=!1;const N=S.credentials;return N&&N==="include"?A.crossOrigin="use-credentials":(N&&N==="same-origin"||!l.s(L))&&(A.crossOrigin="anonymous"),A.fetchPriority="high",A.onload=()=>{I(null,A),A.onerror=A.onload=null},A.onerror=()=>{U||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.")),A.onerror=A.onload=null},A.src=L,{cancel:()=>{U=!0,A.src=""}}}}(Tt||(Tt={})),Tt.resetRequestQueue(),function(h){h.Glyphs="Glyphs",h.Image="Image",h.Source="Source",h.SpriteImage="SpriteImage",h.SpriteJSON="SpriteJSON",h.Style="Style",h.Tile="Tile",h.Unknown="Unknown"}(it||(it={}));class It{constructor(t){this._transformRequestFn=t}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}normalizeSpriteURL(t,n,s){const c=function(p){const g=p.match(qt);if(!g)throw new Error(`Unable to parse URL "${p}"`);return{protocol:g[1],authority:g[2],path:g[3]||"/",params:g[4]?g[4].split("&"):[]}}(t);return c.path+=`${n}${s}`,function(p){const g=p.params.length?`?${p.params.join("&")}`:"";return`${p.protocol}://${p.authority}${p.path}${g}`}(c)}setTransformRequest(t){this._transformRequestFn=t}}const qt=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Jt(h){var t=new l.A(3);return t[0]=h[0],t[1]=h[1],t[2]=h[2],t}var Lt,ht=function(h,t,n){return h[0]=t[0]-n[0],h[1]=t[1]-n[1],h[2]=t[2]-n[2],h};Lt=new l.A(3),l.A!=Float32Array&&(Lt[0]=0,Lt[1]=0,Lt[2]=0);var bt=function(h){var t=h[0],n=h[1];return t*t+n*n};function Ke(h){const t=[];if(typeof h=="string")t.push({id:"default",url:h});else if(h&&h.length>0){const n=[];for(const{id:s,url:c}of h){const p=`${s}${c}`;n.indexOf(p)===-1&&(n.push(p),t.push({id:s,url:c}))}}return t}function _t(h,t,n,s,c){if(s)return void h(s);if(c!==Object.values(t).length||c!==Object.values(n).length)return;const p={};for(const g in t){p[g]={};const y=l.h.getImageCanvasContext(n[g]),x=t[g];for(const S in x){const{width:I,height:A,x:L,y:U,sdf:N,pixelRatio:$,stretchX:F,stretchY:Q,content:se}=x[S];p[g][S]={data:null,pixelRatio:$,sdf:N,stretchX:F,stretchY:Q,content:se,spriteData:{width:I,height:A,x:L,y:U,context:y}}}}h(null,p)}(function(){var h=new l.A(2);l.A!=Float32Array&&(h[0]=0,h[1]=0)})();class qe{constructor(t,n,s,c){this.context=t,this.format=s,this.texture=t.gl.createTexture(),this.update(n,c)}update(t,n,s){const{width:c,height:p}=t,g=!(this.size&&this.size[0]===c&&this.size[1]===p||s),{context:y}=this,{gl:x}=y;if(this.useMipmap=!!(n&&n.useMipmap),x.bindTexture(x.TEXTURE_2D,this.texture),y.pixelStoreUnpackFlipY.set(!1),y.pixelStoreUnpack.set(1),y.pixelStoreUnpackPremultiplyAlpha.set(this.format===x.RGBA&&(!n||n.premultiply!==!1)),g)this.size=[c,p],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||l.a(t)?x.texImage2D(x.TEXTURE_2D,0,this.format,this.format,x.UNSIGNED_BYTE,t):x.texImage2D(x.TEXTURE_2D,0,this.format,c,p,0,this.format,x.UNSIGNED_BYTE,t.data);else{const{x:S,y:I}=s||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||l.a(t)?x.texSubImage2D(x.TEXTURE_2D,0,S,I,x.RGBA,x.UNSIGNED_BYTE,t):x.texSubImage2D(x.TEXTURE_2D,0,S,I,c,p,x.RGBA,x.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&x.generateMipmap(x.TEXTURE_2D)}bind(t,n,s){const{context:c}=this,{gl:p}=c;p.bindTexture(p.TEXTURE_2D,this.texture),s!==p.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=p.LINEAR),t!==this.filter&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,t),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,s||t),this.filter=t),n!==this.wrap&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,n),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,n),this.wrap=n)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function jt(h){const{userImage:t}=h;return!!(t&&t.render&&t.render())&&(h.data.replace(new Uint8Array(t.data.buffer)),!0)}class Qe extends l.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new l.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:n,callback:s}of this.requestors)this._notify(n,s);this.requestors=[]}}getImage(t){const n=this.images[t];if(n&&!n.data&&n.spriteData){const s=n.spriteData;n.data=new l.R({width:s.width,height:s.height},s.context.getImageData(s.x,s.y,s.width,s.height).data),n.spriteData=null}return n}addImage(t,n){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,n)&&(this.images[t]=n)}_validate(t,n){let s=!0;const c=n.data||n.spriteData;return this._validateStretch(n.stretchX,c&&c.width)||(this.fire(new l.j(new Error(`Image "${t}" has invalid "stretchX" value`))),s=!1),this._validateStretch(n.stretchY,c&&c.height)||(this.fire(new l.j(new Error(`Image "${t}" has invalid "stretchY" value`))),s=!1),this._validateContent(n.content,n)||(this.fire(new l.j(new Error(`Image "${t}" has invalid "content" value`))),s=!1),s}_validateStretch(t,n){if(!t)return!0;let s=0;for(const c of t){if(c[0]<s||c[1]<c[0]||n<c[1])return!1;s=c[1]}return!0}_validateContent(t,n){if(!t)return!0;if(t.length!==4)return!1;const s=n.spriteData,c=s&&s.width||n.data.width,p=s&&s.height||n.data.height;return!(t[0]<0||c<t[0]||t[1]<0||p<t[1]||t[2]<0||c<t[2]||t[3]<0||p<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,n,s=!0){const c=this.getImage(t);if(s&&(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[t]=n,this.updatedImages[t]=!0}removeImage(t){const n=this.images[t];delete this.images[t],delete this.patterns[t],n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t,n){let s=!0;if(!this.isLoaded())for(const c of t)this.images[c]||(s=!1);this.isLoaded()||s?this._notify(t,n):this.requestors.push({ids:t,callback:n})}_notify(t,n){const s={};for(const c of t){let p=this.getImage(c);p||(this.fire(new l.k("styleimagemissing",{id:c})),p=this.getImage(c)),p?s[c]={data:p.data.clone(),pixelRatio:p.pixelRatio,sdf:p.sdf,version:p.version,stretchX:p.stretchX,stretchY:p.stretchY,content:p.content,hasRenderCallback:!!(p.userImage&&p.userImage.render)}:l.w(`Image "${c}" 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.`)}n(null,s)}getPixelSize(){const{width:t,height:n}=this.atlasImage;return{width:t,height:n}}getPattern(t){const n=this.patterns[t],s=this.getImage(t);if(!s)return null;if(n&&n.position.version===s.version)return n.position;if(n)n.position.version=s.version;else{const c={w:s.data.width+2,h:s.data.height+2,x:0,y:0},p=new l.I(c,s);this.patterns[t]={bin:c,position:p}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const n=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new qe(t,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const p in this.patterns)t.push(this.patterns[p].bin);const{w:n,h:s}=l.p(t),c=this.atlasImage;c.resize({width:n||1,height:s||1});for(const p in this.patterns){const{bin:g}=this.patterns[p],y=g.x+1,x=g.y+1,S=this.getImage(p).data,I=S.width,A=S.height;l.R.copy(S,c,{x:0,y:0},{x:y,y:x},{width:I,height:A}),l.R.copy(S,c,{x:0,y:A-1},{x:y,y:x-1},{width:I,height:1}),l.R.copy(S,c,{x:0,y:0},{x:y,y:x+A},{width:I,height:1}),l.R.copy(S,c,{x:I-1,y:0},{x:y-1,y:x},{width:1,height:A}),l.R.copy(S,c,{x:0,y:0},{x:y+I,y:x},{width:1,height:A})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const s=this.getImage(n);s||l.w(`Image with ID: "${n}" was not found`),jt(s)&&this.updateImage(n,s)}}}const ot=1e20;function rt(h,t,n,s,c,p,g,y,x){for(let S=t;S<t+s;S++)gt(h,n*p+S,p,c,g,y,x);for(let S=n;S<n+c;S++)gt(h,S*p+t,1,s,g,y,x)}function gt(h,t,n,s,c,p,g){p[0]=0,g[0]=-ot,g[1]=ot,c[0]=h[t];for(let y=1,x=0,S=0;y<s;y++){c[y]=h[t+y*n];const I=y*y;do{const A=p[x];S=(c[y]-c[A]+I-A*A)/(y-A)/2}while(S<=g[x]&&--x>-1);x++,p[x]=y,g[x]=S,g[x+1]=ot}for(let y=0,x=0;y<s;y++){for(;g[x+1]<y;)x++;const S=p[x],I=y-S;h[t+y*n]=c[S]+I*I}}class Rt{constructor(t,n){this.requestManager=t,this.localIdeographFontFamily=n,this.entries={}}setURL(t){this.url=t}getGlyphs(t,n){const s=[];for(const c in t)for(const p of t[c])s.push({stack:c,id:p});l.o(s,({stack:c,id:p},g)=>{let y=this.entries[c];y||(y=this.entries[c]={glyphs:{},requests:{},ranges:{}});let x=y.glyphs[p];if(x!==void 0)return void g(null,{stack:c,id:p,glyph:x});if(x=this._tinySDF(y,c,p),x)return y.glyphs[p]=x,void g(null,{stack:c,id:p,glyph:x});const S=Math.floor(p/256);if(256*S>65535)return void g(new Error("glyphs > 65535 not supported"));if(y.ranges[S])return void g(null,{stack:c,id:p,glyph:x});if(!this.url)return void g(new Error("glyphsUrl is not set"));let I=y.requests[S];I||(I=y.requests[S]=[],Rt.loadGlyphRange(c,S,this.url,this.requestManager,(A,L)=>{if(L){for(const U in L)this._doesCharSupportLocalGlyph(+U)||(y.glyphs[+U]=L[+U]);y.ranges[S]=!0}for(const U of I)U(A,L);delete y.requests[S]})),I.push((A,L)=>{A?g(A):L&&g(null,{stack:c,id:p,glyph:L[p]||null})})},(c,p)=>{if(c)n(c);else if(p){const g={};for(const{stack:y,id:x,glyph:S}of p)(g[y]||(g[y]={}))[x]=S&&{id:S.id,bitmap:S.bitmap.clone(),metrics:S.metrics};n(null,g)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(l.u["CJK Unified Ideographs"](t)||l.u["Hangul Syllables"](t)||l.u.Hiragana(t)||l.u.Katakana(t))}_tinySDF(t,n,s){const c=this.localIdeographFontFamily;if(!c||!this._doesCharSupportLocalGlyph(s))return;let p=t.tinySDF;if(!p){let y="400";/bold/i.test(n)?y="900":/medium/i.test(n)?y="500":/light/i.test(n)&&(y="200"),p=t.tinySDF=new Rt.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:c,fontWeight:y})}const g=p.draw(String.fromCharCode(s));return{id:s,bitmap:new l.q({width:g.width||60,height:g.height||60},g.data),metrics:{width:g.glyphWidth/2||24,height:g.glyphHeight/2||24,left:g.glyphLeft/2+.5||0,top:g.glyphTop/2-27.5||-8,advance:g.glyphAdvance/2||24,isDoubleResolution:!0}}}}Rt.loadGlyphRange=function(h,t,n,s,c){const p=256*t,g=p+255,y=s.transformRequest(n.replace("{fontstack}",h).replace("{range}",`${p}-${g}`),it.Glyphs);l.l(y,(x,S)=>{if(x)c(x);else if(S){const I={};for(const A of l.n(S))I[A.id]=A;c(null,I)}})},Rt.TinySDF=class{constructor({fontSize:h=24,buffer:t=3,radius:n=8,cutoff:s=.25,fontFamily:c="sans-serif",fontWeight:p="normal",fontStyle:g="normal"}={}){this.buffer=t,this.cutoff=s,this.radius=n;const y=this.size=h+4*t,x=this._createCanvas(y),S=this.ctx=x.getContext("2d",{willReadFrequently:!0});S.font=`${g} ${p} ${h}px ${c}`,S.textBaseline="alphabetic",S.textAlign="left",S.fillStyle="black",this.gridOuter=new Float64Array(y*y),this.gridInner=new Float64Array(y*y),this.f=new Float64Array(y),this.z=new Float64Array(y+1),this.v=new Uint16Array(y)}_createCanvas(h){const t=document.createElement("canvas");return t.width=t.height=h,t}draw(h){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:s,actualBoundingBoxLeft:c,actualBoundingBoxRight:p}=this.ctx.measureText(h),g=Math.ceil(n),y=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(p-c))),x=Math.min(this.size-this.buffer,g+Math.ceil(s)),S=y+2*this.buffer,I=x+2*this.buffer,A=Math.max(S*I,0),L=new Uint8ClampedArray(A),U={data:L,width:S,height:I,glyphWidth:y,glyphHeight:x,glyphTop:g,glyphLeft:0,glyphAdvance:t};if(y===0||x===0)return U;const{ctx:N,buffer:$,gridInner:F,gridOuter:Q}=this;N.clearRect($,$,y,x),N.fillText(h,$,$+g);const se=N.getImageData($,$,y,x);Q.fill(ot,0,A),F.fill(0,0,A);for(let Z=0;Z<x;Z++)for(let ee=0;ee<y;ee++){const le=se.data[4*(Z*y+ee)+3]/255;if(le===0)continue;const ce=(Z+$)*S+ee+$;if(le===1)Q[ce]=0,F[ce]=ot;else{const me=.5-le;Q[ce]=me>0?me*me:0,F[ce]=me<0?me*me:0}}rt(Q,0,0,S,I,S,this.f,this.v,this.z),rt(F,$,$,y,x,S,this.f,this.v,this.z);for(let Z=0;Z<A;Z++){const ee=Math.sqrt(Q[Z])-Math.sqrt(F[Z]);L[Z]=Math.round(255-255*(ee/this.radius+this.cutoff))}return U}};class Ot{constructor(){this.specification=l.v.light.position}possiblyEvaluate(t,n){return l.z(t.expression.evaluate(n))}interpolate(t,n,s){return{x:l.B.number(t.x,n.x,s),y:l.B.number(t.y,n.y,s),z:l.B.number(t.z,n.z,s)}}}let ai;class Pi extends l.E{constructor(t){super(),ai=ai||new l.r({anchor:new l.D(l.v.light.anchor),position:new Ot,color:new l.D(l.v.light.color),intensity:new l.D(l.v.light.intensity)}),this._transitionable=new l.T(ai),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(l.t,t,n))for(const s in t){const c=t[s];s.endsWith("-transition")?this._transitionable.setTransition(s.slice(0,-11),c):this._transitionable.setValue(s,c)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,s){return(!s||s.validate!==!1)&&l.x(this,t.call(l.y,l.e({value:n,style:{glyphs:!0,sprite:!0},styleSpec:l.v})))}}class vr{constructor(t,n){this.width=t,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,n){const s=t.join(",")+String(n);return this.dashEntry[s]||(this.dashEntry[s]=this.addDash(t,n)),this.dashEntry[s]}getDashRanges(t,n,s){const c=[];let p=t.length%2==1?-t[t.length-1]*s:0,g=t[0]*s,y=!0;c.push({left:p,right:g,isDash:y,zeroLength:t[0]===0});let x=t[0];for(let S=1;S<t.length;S++){y=!y;const I=t[S];p=x*s,x+=I,g=x*s,c.push({left:p,right:g,isDash:y,zeroLength:I===0})}return c}addRoundDash(t,n,s){const c=n/2;for(let p=-s;p<=s;p++){const g=this.width*(this.nextRow+s+p);let y=0,x=t[y];for(let S=0;S<this.width;S++){S/x.right>1&&(x=t[++y]);const I=Math.abs(S-x.left),A=Math.abs(S-x.right),L=Math.min(I,A);let U;const N=p/s*(c+1);if(x.isDash){const $=c-Math.abs(N);U=Math.sqrt(L*L+$*$)}else U=c-Math.sqrt(L*L+N*N);this.data[g+S]=Math.max(0,Math.min(255,U+128))}}}addRegularDash(t){for(let y=t.length-1;y>=0;--y){const x=t[y],S=t[y+1];x.zeroLength?t.splice(y,1):S&&S.isDash===x.isDash&&(S.left=x.left,t.splice(y,1))}const n=t[0],s=t[t.length-1];n.isDash===s.isDash&&(n.left=s.left-this.width,s.right=n.right+this.width);const c=this.width*this.nextRow;let p=0,g=t[p];for(let y=0;y<this.width;y++){y/g.right>1&&(g=t[++p]);const x=Math.abs(y-g.left),S=Math.abs(y-g.right),I=Math.min(x,S);this.data[c+y]=Math.max(0,Math.min(255,(g.isDash?I:-I)+128))}}addDash(t,n){const s=n?7:0,c=2*s+1;if(this.nextRow+c>this.height)return l.w("LineAtlas out of space"),null;let p=0;for(let y=0;y<t.length;y++)p+=t[y];if(p!==0){const y=this.width/p,x=this.getDashRanges(t,this.width,y);n?this.addRoundDash(x,y,s):this.addRegularDash(x)}const g={y:(this.nextRow+s+.5)/this.height,height:2*s/this.height,width:p};return this.nextRow+=c,this.dirty=!0,g}bind(t){const n=t.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))}}class gi{constructor(t,n,s){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=s;const c=this.workerPool.acquire(s);for(let p=0;p<c.length;p++){const g=new l.C(c[p],n,s);g.name=`Worker ${p}`,this.actors.push(g)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n,s){l.o(this.actors,(c,p)=>{c.send(t,n,p)},s=s||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach(n=>{n.remove()}),this.actors=[],t&&this.workerPool.release(this.id)}}function Bi(h,t,n){const s=function(c,p){if(c)return n(c);if(p){const g=l.F(l.e(p,h),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);p.vector_layers&&(g.vectorLayers=p.vector_layers,g.vectorLayerIds=g.vectorLayers.map(y=>y.id)),n(null,g)}};return h.url?l.f(t.transformRequest(h.url,it.Source),s):l.h.frame(()=>s(null,h))}class zt{constructor(t,n){t&&(n?this.setSouthWest(t).setNorthEast(n):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof l.L?new l.L(t.lng,t.lat):l.L.convert(t),this}setSouthWest(t){return this._sw=t instanceof l.L?new l.L(t.lng,t.lat):l.L.convert(t),this}extend(t){const n=this._sw,s=this._ne;let c,p;if(t instanceof l.L)c=t,p=t;else{if(!(t instanceof zt))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(zt.convert(t)):this.extend(l.L.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(l.L.convert(t)):this;if(c=t._sw,p=t._ne,!c||!p)return this}return n||s?(n.lng=Math.min(c.lng,n.lng),n.lat=Math.min(c.lat,n.lat),s.lng=Math.max(p.lng,s.lng),s.lat=Math.max(p.lat,s.lat)):(this._sw=new l.L(c.lng,c.lat),this._ne=new l.L(p.lng,p.lat)),this}getCenter(){return new l.L((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new l.L(this.getWest(),this.getNorth())}getSouthEast(){return new l.L(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){const{lng:n,lat:s}=l.L.convert(t);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<=s&&s<=this._ne.lat&&c}static convert(t){return t instanceof zt?t:t&&new zt(t)}static fromLngLat(t,n=0){const s=360*n/40075017,c=s/Math.cos(Math.PI/180*t.lat);return new zt(new l.L(t.lng-c,t.lat-s),new l.L(t.lng+c,t.lat+s))}}class Ei{constructor(t,n,s){this.bounds=zt.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=s||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const n=Math.pow(2,t.z),s=Math.floor(l.G(this.bounds.getWest())*n),c=Math.floor(l.H(this.bounds.getNorth())*n),p=Math.ceil(l.G(this.bounds.getEast())*n),g=Math.ceil(l.H(this.bounds.getSouth())*n);return t.x>=s&&t.x<p&&t.y>=c&&t.y<g}}class $r extends l.E{constructor(t,n,s,c){if(super(),this.load=()=>{this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this._tileJSONRequest=Bi(this._options,this.map._requestManager,(p,g)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),p?this.fire(new l.j(p)):g&&(l.e(this,g),g.bounds&&(this.tileBounds=new Ei(g.bounds,this.minzoom,this.maxzoom)),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})))})},this.serialize=()=>l.e({},this._options),this.id=t,this.dispatcher=s,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,l.e(this,l.F(n,["url","scheme","tileSize","promoteId"])),this._options=l.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)}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}loadTile(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),c={request:this.map._requestManager.transformRequest(s,it.Tile),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function p(g,y){return delete t.request,t.aborted?n(null):g&&g.status!==404?n(g):(y&&y.resourceTiming&&(t.resourceTiming=y.resourceTiming),this.map._refreshExpiredTiles&&y&&t.setExpiryData(y),t.loadVectorData(y,this.map.painter),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}c.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired"?t.state==="loading"?t.reloadCallback=n:t.request=t.actor.send("reloadTile",c,p.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",c,p.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class en extends l.E{constructor(t,n,s,c){super(),this.id=t,this.dispatcher=s,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=l.e({type:"raster"},n),l.e(this,l.F(n,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this._tileJSONRequest=Bi(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new l.j(t)):n&&(l.e(this,n),n.bounds&&(this.tileBounds=new Ei(n.bounds,this.minzoom,this.maxzoom)),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}serialize(){return l.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=Tt.getImage(this.map._requestManager.transformRequest(s,it.Tile),(c,p,g)=>{if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(c)t.state="errored",n(c);else if(p){this.map._refreshExpiredTiles&&g&&t.setExpiryData(g);const y=this.map.painter.context,x=y.gl;t.texture=this.map.painter.getTileTexture(p.width),t.texture?t.texture.update(p,{useMipmap:!0}):(t.texture=new qe(y,p,x.RGBA,{useMipmap:!0}),t.texture.bind(x.LINEAR,x.CLAMP_TO_EDGE,x.LINEAR_MIPMAP_NEAREST),y.extTextureFilterAnisotropic&&x.texParameterf(x.TEXTURE_2D,y.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,y.extTextureFilterAnisotropicMax)),t.state="loaded",n(null)}},this.map._refreshExpiredTiles)}abortTile(t,n){t.request&&(t.request.cancel(),delete t.request),n()}unloadTile(t,n){t.texture&&this.map.painter.saveTileTexture(t.texture),n()}hasTransition(){return!1}}class ra extends en{constructor(t,n,s,c){super(t,n,s,c),this.type="raster-dem",this.maxzoom=22,this._options=l.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(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),c=this.map._requestManager.transformRequest(s,it.Tile);function p(g,y){g&&(t.state="errored",n(g)),y&&(t.dem=y,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded",n(null))}t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.request=Tt.getImage(c,(g,y,x)=>l._(this,void 0,void 0,function*(){if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(g)t.state="errored",n(g);else if(y){this.map._refreshExpiredTiles&&t.setExpiryData(x);const S=l.a(y)&&l.J()?y:yield function(A){return l._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&l.K()){const L=A.width+2,U=A.height+2;try{return new l.R({width:L,height:U},yield l.M(A,-1,-1,L,U))}catch{}}return l.h.getImageData(A,1)})}(y),I={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:S,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",I,p))}}),this.map._refreshExpiredTiles)}_getNeighboringTiles(t){const n=t.canonical,s=Math.pow(2,n.z),c=(n.x-1+s)%s,p=n.x===0?t.wrap-1:t.wrap,g=(n.x+1+s)%s,y=n.x+1===s?t.wrap+1:t.wrap,x={};return x[new l.O(t.overscaledZ,p,n.z,c,n.y).key]={backfilled:!1},x[new l.O(t.overscaledZ,y,n.z,g,n.y).key]={backfilled:!1},n.y>0&&(x[new l.O(t.overscaledZ,p,n.z,c,n.y-1).key]={backfilled:!1},x[new l.O(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},x[new l.O(t.overscaledZ,y,n.z,g,n.y-1).key]={backfilled:!1}),n.y+1<s&&(x[new l.O(t.overscaledZ,p,n.z,c,n.y+1).key]={backfilled:!1},x[new l.O(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},x[new l.O(t.overscaledZ,y,n.z,g,n.y+1).key]={backfilled:!1}),x}unloadTile(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&t.actor.send("removeDEMTile",{uid:t.uid,source:this.id})}}class _n extends l.E{constructor(t,n,s,c){super(),this.load=()=>{this._updateWorkerData()},this.serialize=()=>l.e({},this._options,{type:this.type,data:this._data}),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=s.getActor(),this.setEventedParent(c),this._data=n.data,this._options=l.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;const p=l.N/this.tileSize;this.workerOptions=l.e({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*p,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*p,extent:l.N,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:n.clusterMaxZoom!==void 0?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:l.N,radius:(n.clusterRadius||50)*p,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData(),this}updateData(t){return this._updateWorkerData(t),this}setClusterOptions(t){return this.workerOptions.cluster=t.cluster,t&&(t.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=t.clusterRadius),t.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=t.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(t,n){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},n),this}getClusterChildren(t,n){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},n),this}getClusterLeaves(t,n,s,c){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:n,offset:s},c),this}_updateWorkerData(t){const n=l.e({},this.workerOptions);t?n.dataDiff=t:typeof this._data=="string"?(n.request=this.map._requestManager.transformRequest(l.h.resolveURL(this._data),it.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new l.k("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,n,(s,c)=>{if(this._pendingLoads--,this._removed||c&&c.abandoned)return void this.fire(new l.k("dataabort",{dataType:"source"}));let p=null;if(c&&c.resourceTiming&&c.resourceTiming[this.id]&&(p=c.resourceTiming[this.id].slice(0)),s)return void this.fire(new l.j(s));const g={dataType:"source"};this._collectResourceTiming&&p&&p.length>0&&l.e(g,{resourceTiming:p}),this.fire(new l.k("data",Object.assign(Object.assign({},g),{sourceDataType:"metadata"}))),this.fire(new l.k("data",Object.assign(Object.assign({},g),{sourceDataType:"content"})))})}loaded(){return this._pendingLoads===0}loadTile(t,n){const s=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const c={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.request=this.actor.send(s,c,(p,g)=>(delete t.request,t.unloadVectorData(),t.aborted?n(null):p?n(p):(t.loadVectorData(g,this.map.painter,s==="reloadTile"),n(null))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}hasTransition(){return!1}}var zr=l.Q([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class xr extends l.E{constructor(t,n,s,c){super(),this.load=(p,g)=>{this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=Tt.getImage(this.map._requestManager.transformRequest(this.url,it.Image),(y,x)=>{this._request=null,this._loaded=!0,y?this.fire(new l.j(y)):x&&(this.image=x,p&&(this.coordinates=p),g&&g(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||!this.image)return;const p=this.map.painter.context,g=p.gl;this.boundsBuffer||(this.boundsBuffer=p.createVertexBuffer(this._boundsArray,zr.members)),this.boundsSegments||(this.boundsSegments=l.S.simpleSegment(0,0,4,2)),this.texture||(this.texture=new qe(p,this.image,g.RGBA),this.texture.bind(g.LINEAR,g.CLAMP_TO_EDGE));let y=!1;for(const x in this.tiles){const S=this.tiles[x];S.state!=="loaded"&&(S.state="loaded",S.texture=this.texture,y=!0)}y&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"image",url:this.options.url,coordinates:this.coordinates}),this.id=t,this.dispatcher=s,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}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=t.url,this.load(t.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(t){this.coordinates=t;const n=t.map(l.U.fromLngLat);this.tileID=function(c){let p=1/0,g=1/0,y=-1/0,x=-1/0;for(const L of c)p=Math.min(p,L.x),g=Math.min(g,L.y),y=Math.max(y,L.x),x=Math.max(x,L.y);const S=Math.max(y-p,x-g),I=Math.max(0,Math.floor(-Math.log(S)/Math.LN2)),A=Math.pow(2,I);return new l.W(I,Math.floor((p+y)/2*A),Math.floor((g+x)/2*A))}(n),this.minzoom=this.maxzoom=this.tileID.z;const s=n.map(c=>this.tileID.getTilePoint(c)._round());return this._boundsArray=new l.V,this._boundsArray.emplaceBack(s[0].x,s[0].y,0,0),this._boundsArray.emplaceBack(s[1].x,s[1].y,l.N,0),this._boundsArray.emplaceBack(s[3].x,s[3].y,0,l.N),this._boundsArray.emplaceBack(s[2].x,s[2].y,l.N,l.N),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})),this}loadTile(t,n){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},n(null)):(t.state="errored",n(null))}hasTransition(){return!1}}class za extends xr{constructor(t,n,s,c){super(t,n,s,c),this.load=()=>{this._loaded=!1;const p=this.options;this.urls=[];for(const g of p.urls)this.urls.push(this.map._requestManager.transformRequest(g,it.Source).url);l.X(this.urls,(g,y)=>{this._loaded=!0,g?this.fire(new l.j(g)):y&&(this.video=y,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const p=this.map.painter.context,g=p.gl;this.boundsBuffer||(this.boundsBuffer=p.createVertexBuffer(this._boundsArray,zr.members)),this.boundsSegments||(this.boundsSegments=l.S.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(g.LINEAR,g.CLAMP_TO_EDGE),g.texSubImage2D(g.TEXTURE_2D,0,0,0,g.RGBA,g.UNSIGNED_BYTE,this.video)):(this.texture=new qe(p,this.video,g.RGBA),this.texture.bind(g.LINEAR,g.CLAMP_TO_EDGE));let y=!1;for(const x in this.tiles){const S=this.tiles[x];S.state!=="loaded"&&(S.state="loaded",S.texture=this.texture,y=!0)}y&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"video",urls:this.urls,coordinates:this.coordinates}),this.roundZoom=!0,this.type="video",this.options=n}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;t<n.start(0)||t>n.end(0)?this.fire(new l.j(new l.Y(`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=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}hasTransition(){return this.video&&!this.video.paused}}class vn extends xr{constructor(t,n,s,c){super(t,n,s,c),this.load=()=>{this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new l.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())},this.prepare=()=>{let p=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,p=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,p=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const g=this.map.painter.context,y=g.gl;this.boundsBuffer||(this.boundsBuffer=g.createVertexBuffer(this._boundsArray,zr.members)),this.boundsSegments||(this.boundsSegments=l.S.simpleSegment(0,0,4,2)),this.texture?(p||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new qe(g,this.canvas,y.RGBA,{premultiply:!0});let x=!1;for(const S in this.tiles){const I=this.tiles[S];I.state!=="loaded"&&(I.state="loaded",I.texture=this.texture,x=!0)}x&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"canvas",coordinates:this.coordinates}),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(p=>!Array.isArray(p)||p.length!==2||p.some(g=>typeof g!="number"))||this.fire(new l.j(new l.Y(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new l.j(new l.Y(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new l.j(new l.Y(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new l.j(new l.Y(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new l.j(new l.Y(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const Da={},tn=h=>{switch(h){case"geojson":return _n;case"image":return xr;case"raster":return en;case"raster-dem":return ra;case"vector":return $r;case"video":return za;case"canvas":return vn}return Da[h]};function na(h,t){const n=l.Z();return l.$(n,n,[1,1,0]),l.a0(n,n,[.5*h.width,.5*h.height,1]),l.a1(n,n,h.calculatePosMatrix(t.toUnwrapped()))}function Dn(h,t,n,s,c,p){const g=function(A,L,U){if(A)for(const N of A){const $=L[N];if($&&$.source===U&&$.type==="fill-extrusion")return!0}else for(const N in L){const $=L[N];if($.source===U&&$.type==="fill-extrusion")return!0}return!1}(c&&c.layers,t,h.id),y=p.maxPitchScaleFactor(),x=h.tilesIn(s,y,g);x.sort(xn);const S=[];for(const A of x)S.push({wrappedTileID:A.tileID.wrapped().key,queryResults:A.tile.queryRenderedFeatures(t,n,h._state,A.queryGeometry,A.cameraQueryGeometry,A.scale,c,p,y,na(h.transform,A.tileID))});const I=function(A){const L={},U={};for(const N of A){const $=N.queryResults,F=N.wrappedTileID,Q=U[F]=U[F]||{};for(const se in $){const Z=$[se],ee=Q[se]=Q[se]||{},le=L[se]=L[se]||[];for(const ce of Z)ee[ce.featureIndex]||(ee[ce.featureIndex]=!0,le.push(ce))}}return L}(S);for(const A in I)I[A].forEach(L=>{const U=L.feature,N=h.getFeatureState(U.layer["source-layer"],U.id);U.source=U.layer.source,U.layer["source-layer"]&&(U.sourceLayer=U.layer["source-layer"]),U.state=N});return I}function xn(h,t){const n=h.tileID,s=t.tileID;return n.overscaledZ-s.overscaledZ||n.canonical.y-s.canonical.y||n.wrap-s.wrap||n.canonical.x-s.canonical.x}class bn{constructor(t,n){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=l.a2(),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"}registerFadeDuration(t){const n=t+this.timeAdded;n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,n,s){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(c,p){const g={};if(!p)return g;for(const y of c){const x=y.layerIds.map(S=>p.getLayer(S)).filter(Boolean);if(x.length!==0){y.layers=x,y.stateDependentLayerIds&&(y.stateDependentLayers=y.stateDependentLayerIds.map(S=>x.filter(I=>I.id===S)[0]));for(const S of x)g[S.id]=y}}return g}(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const c in this.buckets){const p=this.buckets[c];if(p instanceof l.a4){if(this.hasSymbolBuckets=!0,!s)break;p.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const c in this.buckets){const p=this.buckets[c];if(p instanceof l.a4&&p.hasRTLText){this.hasRTLText=!0,l.a5();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))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new l.a3}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const s in this.buckets){const c=this.buckets[s];c.uploadPending()&&c.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new qe(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new qe(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,s,c,p,g,y,x,S,I){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:c,cameraQueryGeometry:p,scale:g,tileSize:this.tileSize,pixelPosMatrix:I,transform:x,params:y,queryPadding:this.queryPadding*S},t,n,s):{}}querySourceFeatures(t,n){const s=this.latestFeatureIndex;if(!s||!s.rawTileData)return;const c=s.loadVTLayers(),p=n&&n.sourceLayer?n.sourceLayer:"",g=c._geojsonTileLayer||c[p];if(!g)return;const y=l.a6(n&&n.filter),{z:x,x:S,y:I}=this.tileID.canonical,A={z:x,x:S,y:I};for(let L=0;L<g.length;L++){const U=g.feature(L);if(y.needGeometry){const F=l.a7(U,!0);if(!y.filter(new l.a8(this.tileID.overscaledZ),F,this.tileID.canonical))continue}else if(!y.filter(new l.a8(this.tileID.overscaledZ),U))continue;const N=s.getId(U,p),$=new l.a9(U,x,S,I,N);$.tile=A,t.push($)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const n=this.expirationTime;if(t.cacheControl){const s=l.aa(t.cacheControl);s["max-age"]&&(this.expirationTime=Date.now()+1e3*s["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const s=Date.now();let c=!1;if(this.expirationTime>s)c=!1;else if(n)if(this.expirationTime<n)c=!0;else{const p=this.expirationTime-n;p?this.expirationTime=s+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(t,n){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(t).length===0)return;const s=this.latestFeatureIndex.loadVTLayers();for(const c in this.buckets){if(!n.style.hasLayer(c))continue;const p=this.buckets[c],g=p.layers[0].sourceLayer||"_geojsonTileLayer",y=s[g],x=t[g];if(!y||!x||Object.keys(x).length===0)continue;p.update(x,y,this.imageAtlas&&this.imageAtlas.patternPositions||{});const S=n&&n.style&&n.style.getLayer(c);S&&(this.queryPadding=Math.max(this.queryPadding,S.queryRadius(p)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<l.h.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=l.h.now()+t}setDependencies(t,n){const s={};for(const c of n)s[c]=!0;this.dependencies[t]=s}hasDependency(t,n){for(const s of t){const c=this.dependencies[s];if(c){for(const p of n)if(c[p])return!0}}return!1}}class Rn{constructor(t,n){this.max=t,this.onRemove=n,this.reset()}reset(){for(const t in this.data)for(const n of this.data[t])n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value);return this.data={},this.order=[],this}add(t,n,s){const c=t.wrapped().key;this.data[c]===void 0&&(this.data[c]=[]);const p={value:n,timeout:void 0};if(s!==void 0&&(p.timeout=setTimeout(()=>{this.remove(t,p)},s)),this.data[c].push(p),this.order.push(c),this.order.length>this.max){const g=this._getAndRemoveByKey(this.order[0]);g&&this.onRemove(g)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const n=this.data[t].shift();return n.timeout&&clearTimeout(n.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),n.value}getByKey(t){const n=this.data[t];return n?n[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,n){if(!this.has(t))return this;const s=t.wrapped().key,c=n===void 0?0:this.data[s].indexOf(n),p=this.data[s][c];return this.data[s].splice(c,1),p.timeout&&clearTimeout(p.timeout),this.data[s].length===0&&delete this.data[s],this.onRemove(p.value),this.order.splice(this.order.indexOf(s),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(t){const n=[];for(const s in this.data)for(const c of this.data[s])t(c.value)||n.push(c);for(const s of n)this.remove(s.value.tileID,s)}}class ue{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,s){const c=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][c]=this.stateChanges[t][c]||{},l.e(this.stateChanges[t][c],s),this.deletedStates[t]===null){this.deletedStates[t]={};for(const p in this.state[t])p!==c&&(this.deletedStates[t][p]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][c]===null){this.deletedStates[t][c]={};for(const p in this.state[t][c])s[p]||(this.deletedStates[t][c][p]=null)}else for(const p in s)this.deletedStates[t]&&this.deletedStates[t][c]&&this.deletedStates[t][c][p]===null&&delete this.deletedStates[t][c][p]}removeFeatureState(t,n,s){if(this.deletedStates[t]===null)return;const c=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},s&&n!==void 0)this.deletedStates[t][c]!==null&&(this.deletedStates[t][c]=this.deletedStates[t][c]||{},this.deletedStates[t][c][s]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][c])for(s in this.deletedStates[t][c]={},this.stateChanges[t][c])this.deletedStates[t][c][s]=null;else this.deletedStates[t][c]=null;else this.deletedStates[t]=null}getState(t,n){const s=String(n),c=l.e({},(this.state[t]||{})[s],(this.stateChanges[t]||{})[s]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const p=this.deletedStates[t][n];if(p===null)return{};for(const g in p)delete c[g]}return c}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const s={};for(const c in this.stateChanges){this.state[c]=this.state[c]||{};const p={};for(const g in this.stateChanges[c])this.state[c][g]||(this.state[c][g]={}),l.e(this.state[c][g],this.stateChanges[c][g]),p[g]=this.state[c][g];s[c]=p}for(const c in this.deletedStates){this.state[c]=this.state[c]||{};const p={};if(this.deletedStates[c]===null)for(const g in this.state[c])p[g]={},this.state[c][g]={};else for(const g in this.deletedStates[c]){if(this.deletedStates[c][g]===null)this.state[c][g]={};else for(const y of Object.keys(this.deletedStates[c][g]))delete this.state[c][g][y];p[g]=this.state[c][g]}s[c]=s[c]||{},l.e(s[c],p)}if(this.stateChanges={},this.deletedStates={},Object.keys(s).length!==0)for(const c in t)t[c].setFeatureState(s,n)}}class Ji extends l.E{constructor(t,n,s){super(),this.id=t,this.dispatcher=s,this.on("data",c=>{c.dataType==="source"&&c.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&c.dataType==="source"&&c.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((c,p,g,y)=>{const x=new(tn(p.type))(c,p,g,y);if(x.id!==c)throw new Error(`Expected Source id to be ${c} instead of ${x.id}`);return x})(t,n,s,this),this._tiles={},this._cache=new Rn(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new ue,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const t in this._tiles){const n=this._tiles[t];if(n.state!=="loaded"&&n.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,n){return this._source.loadTile(t,n)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,()=>{}),this._source.fire(new l.k("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const n in this._tiles){const s=this._tiles[n];s.upload(t),s.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(br).map(t=>t.key)}getRenderableIds(t){const n=[];for(const s in this._tiles)this._isIdRenderable(s,t)&&n.push(this._tiles[s]);return t?n.sort((s,c)=>{const p=s.tileID,g=c.tileID,y=new l.P(p.canonical.x,p.canonical.y)._rotate(this.transform.angle),x=new l.P(g.canonical.x,g.canonical.y)._rotate(this.transform.angle);return p.overscaledZ-g.overscaledZ||x.y-y.y||x.x-y.x}).map(s=>s.tileID.key):n.map(s=>s.tileID).sort(br).map(s=>s.key)}hasRenderableParent(t){const n=this.findLoadedParent(t,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(t,n){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(n||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}}_reloadTile(t,n){const s=this._tiles[t];s&&(s.state!=="loading"&&(s.state=n),this._loadTile(s,this._tileLoaded.bind(this,s,t,n)))}_tileLoaded(t,n,s,c){if(c)return t.state="errored",void(c.status!==404?this._source.fire(new l.j(c,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=l.h.now(),s==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new l.k("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const n=this.getRenderableIds();for(let c=0;c<n.length;c++){const p=n[c];if(t.neighboringTiles&&t.neighboringTiles[p]){const g=this.getTileByID(p);s(t,g),s(g,t)}}function s(c,p){c.needsHillshadePrepare=!0,c.needsTerrainPrepare=!0;let g=p.tileID.canonical.x-c.tileID.canonical.x;const y=p.tileID.canonical.y-c.tileID.canonical.y,x=Math.pow(2,c.tileID.canonical.z),S=p.tileID.key;g===0&&y===0||Math.abs(y)>1||(Math.abs(g)>1&&(Math.abs(g+x)===1?g+=x:Math.abs(g-x)===1&&(g-=x)),p.dem&&c.dem&&(c.dem.backfillBorder(p.dem,g,y),c.neighboringTiles&&c.neighboringTiles[S]&&(c.neighboringTiles[S].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,s,c){for(const p in this._tiles){let g=this._tiles[p];if(c[p]||!g.hasData()||g.tileID.overscaledZ<=n||g.tileID.overscaledZ>s)continue;let y=g.tileID;for(;g&&g.tileID.overscaledZ>n+1;){const S=g.tileID.scaledTo(g.tileID.overscaledZ-1);g=this._tiles[S.key],g&&g.hasData()&&(y=S)}let x=y;for(;x.overscaledZ>n;)if(x=x.scaledTo(x.overscaledZ-1),t[x.key]){c[y.key]=y;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const s=this._loadedParentTiles[t.key];return s&&s.tileID.overscaledZ>=n?s:null}for(let s=t.overscaledZ-1;s>=n;s--){const c=t.scaledTo(s),p=this._getLoadedTile(c);if(p)return p}}_getLoadedTile(t){const n=this._tiles[t.key];return n&&n.hasData()?n:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const n=Math.ceil(t.width/this._source.tileSize)+1,s=Math.ceil(t.height/this._source.tileSize)+1,c=Math.floor(n*s*(this._maxTileCacheZoomLevels===null?l.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),p=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,c):c;this._cache.setMaxSize(p)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const s={};for(const c in this._tiles){const p=this._tiles[c];p.tileID=p.tileID.unwrapTo(p.tileID.wrap+n),s[p.tileID.key]=p}this._tiles=s;for(const c in this._timers)clearTimeout(this._timers[c]),delete this._timers[c];for(const c in this._tiles)this._setTileReloadTimer(c,this._tiles[c])}}update(t,n){if(this.transform=t,this.terrain=n,!this._sourceLoaded||this._paused)return;let s;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?s=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(I=>new l.O(I.canonical.z,I.wrap,I.canonical.z,I.canonical.x,I.canonical.y)):(s=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n}),this._source.hasTile&&(s=s.filter(I=>this._source.hasTile(I)))):s=[];const c=t.coveringZoomLevel(this._source),p=Math.max(c-Ji.maxOverzooming,this._source.minzoom),g=Math.max(c+Ji.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const I={};for(const A of s)if(A.canonical.z>this._source.minzoom){const L=A.scaledTo(A.canonical.z-1);I[L.key]=L;const U=A.scaledTo(Math.max(this._source.minzoom,Math.min(A.canonical.z,5)));I[U.key]=U}s=s.concat(Object.values(I))}const y=s.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,y&&this.fire(new l.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const x=this._updateRetainedTiles(s,c);if(Gt(this._source.type)){const I={},A={},L=Object.keys(x),U=l.h.now();for(const N of L){const $=x[N],F=this._tiles[N];if(!F||F.fadeEndTime!==0&&F.fadeEndTime<=U)continue;const Q=this.findLoadedParent($,p);Q&&(this._addTile(Q.tileID),I[Q.tileID.key]=Q.tileID),A[N]=$}this._retainLoadedChildren(A,c,g,x);for(const N in I)x[N]||(this._coveredTiles[N]=!0,x[N]=I[N]);if(n){const N={},$={};for(const F of s)this._tiles[F.key].hasData()?N[F.key]=F:$[F.key]=F;for(const F in $){const Q=$[F].children(this._source.maxzoom);this._tiles[Q[0].key]&&this._tiles[Q[1].key]&&this._tiles[Q[2].key]&&this._tiles[Q[3].key]&&(N[Q[0].key]=x[Q[0].key]=Q[0],N[Q[1].key]=x[Q[1].key]=Q[1],N[Q[2].key]=x[Q[2].key]=Q[2],N[Q[3].key]=x[Q[3].key]=Q[3],delete $[F])}for(const F in $){const Q=this.findLoadedParent($[F],this._source.minzoom);if(Q){N[Q.tileID.key]=x[Q.tileID.key]=Q.tileID;for(const se in N)N[se].isChildOf(Q.tileID)&&delete N[se]}}for(const F in this._tiles)N[F]||(this._coveredTiles[F]=!0)}}for(const I in x)this._tiles[I].clearFadeHold();const S=l.ab(this._tiles,x);for(const I of S){const A=this._tiles[I];A.hasSymbolBuckets&&!A.holdingForFade()?A.setHoldDuration(this.map._fadeDuration):A.hasSymbolBuckets&&!A.symbolFadeFinished()||this._removeTile(I)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){const s={},c={},p=Math.max(n-Ji.maxOverzooming,this._source.minzoom),g=Math.max(n+Ji.maxUnderzooming,this._source.minzoom),y={};for(const x of t){const S=this._addTile(x);s[x.key]=x,S.hasData()||n<this._source.maxzoom&&(y[x.key]=x)}this._retainLoadedChildren(y,n,g,s);for(const x of t){let S=this._tiles[x.key];if(S.hasData())continue;if(n+1>this._source.maxzoom){const A=x.children(this._source.maxzoom)[0],L=this.getTile(A);if(L&&L.hasData()){s[A.key]=A;continue}}else{const A=x.children(this._source.maxzoom);if(s[A[0].key]&&s[A[1].key]&&s[A[2].key]&&s[A[3].key])continue}let I=S.wasRequested();for(let A=x.overscaledZ-1;A>=p;--A){const L=x.scaledTo(A);if(c[L.key])break;if(c[L.key]=!0,S=this.getTile(L),!S&&I&&(S=this._addTile(L)),S){const U=S.hasData();if((I||U)&&(s[L.key]=L),I=S.wasRequested(),U)break}}}return s}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let s,c=this._tiles[t].tileID;for(;c.overscaledZ>0;){if(c.key in this._loadedParentTiles){s=this._loadedParentTiles[c.key];break}n.push(c.key);const p=c.scaledTo(c.overscaledZ-1);if(s=this._getLoadedTile(p),s)break;c=p}for(const p of n)this._loadedParentTiles[p]=s}}_addTile(t){let n=this._tiles[t.key];if(n)return n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));const s=n;return n||(n=new bn(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))),n.uses++,this._tiles[t.key]=n,s||this._source.fire(new l.k("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const s=n.getExpiryTimeout();s&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},s))}_removeTile(t){const n=this._tiles[t];n&&(n.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),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))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,n,s){const c=[],p=this.transform;if(!p)return c;const g=s?p.getCameraQueryGeometry(t):t,y=t.map(N=>p.pointCoordinate(N,this.terrain)),x=g.map(N=>p.pointCoordinate(N,this.terrain)),S=this.getIds();let I=1/0,A=1/0,L=-1/0,U=-1/0;for(const N of x)I=Math.min(I,N.x),A=Math.min(A,N.y),L=Math.max(L,N.x),U=Math.max(U,N.y);for(let N=0;N<S.length;N++){const $=this._tiles[S[N]];if($.holdingForFade())continue;const F=$.tileID,Q=Math.pow(2,p.zoom-$.tileID.overscaledZ),se=n*$.queryPadding*l.N/$.tileSize/Q,Z=[F.getTilePoint(new l.U(I,A)),F.getTilePoint(new l.U(L,U))];if(Z[0].x-se<l.N&&Z[0].y-se<l.N&&Z[1].x+se>=0&&Z[1].y+se>=0){const ee=y.map(ce=>F.getTilePoint(ce)),le=x.map(ce=>F.getTilePoint(ce));c.push({tile:$,tileID:F,queryGeometry:ee,cameraQueryGeometry:le,scale:Q})}}return c}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map(s=>this._tiles[s].tileID);for(const s of n)s.posMatrix=this.transform.calculatePosMatrix(s.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(Gt(this._source.type)){const t=l.h.now();for(const n in this._tiles)if(this._tiles[n].fadeEndTime>=t)return!0}return!1}setFeatureState(t,n,s){this._state.updateState(t=t||"_geojsonTileLayer",n,s)}removeFeatureState(t,n,s){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,s)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,s){const c=this._tiles[t];c&&c.setDependencies(n,s)}reloadTilesForDependencies(t,n){for(const s in this._tiles)this._tiles[s].hasDependency(t,n)&&this._reloadTile(s,"reloading");this._cache.filter(s=>!s.hasDependency(t,n))}}function br(h,t){const n=Math.abs(2*h.wrap)-+(h.wrap<0),s=Math.abs(2*t.wrap)-+(t.wrap<0);return h.overscaledZ-t.overscaledZ||s-n||t.canonical.y-h.canonical.y||t.canonical.x-h.canonical.x}function Gt(h){return h==="raster"||h==="image"||h==="video"}Ji.maxOverzooming=10,Ji.maxUnderzooming=3;const At="mapboxgl_preloaded_worker_pool";class jr{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<jr.workerCount;)this.workers.push(new Worker(l.c.WORKER_URL));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach(n=>{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[At]}numActive(){return Object.keys(this.active).length}}const aa=Math.floor(l.h.hardwareConcurrency/2);let rn;function os(){return rn||(rn=new jr),rn}jr.workerCount=l.ac(globalThis)?Math.max(Math.min(aa,3),1):1;class sa{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let s=1;s<this.points.length;s++)this._distances[s]=this._distances[s-1]+this.points[s].dist(this.points[s-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(t){if(this.points.length===1)return this.points[0];t=l.ad(t,0,1);let n=1,s=this._distances[n];const c=t*this.paddedLength+this.padding;for(;s<c&&n<this._distances.length;)s=this._distances[++n];const p=n-1,g=this._distances[p],y=s-g,x=y>0?(c-g)/y:0;return this.points[p].mult(1-x).add(this.points[n].mult(x))}}function wn(h,t){let n=!0;return h==="always"||h!=="never"&&t!=="never"||(n=!1),n}class Bn{constructor(t,n,s){const c=this.boxCells=[],p=this.circleCells=[];this.xCellCount=Math.ceil(t/s),this.yCellCount=Math.ceil(n/s);for(let g=0;g<this.xCellCount*this.yCellCount;g++)c.push([]),p.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=n,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,n,s,c,p){this._forEachCell(n,s,c,p,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(s),this.bboxes.push(c),this.bboxes.push(p)}insertCircle(t,n,s,c){this._forEachCell(n-c,s-c,n+c,s+c,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(s),this.circles.push(c)}_insertBoxCell(t,n,s,c,p,g){this.boxCells[p].push(g)}_insertCircleCell(t,n,s,c,p,g){this.circleCells[p].push(g)}_query(t,n,s,c,p,g,y){if(s<0||t>this.width||c<0||n>this.height)return[];const x=[];if(t<=0&&n<=0&&this.width<=s&&this.height<=c){if(p)return[{key:null,x1:t,y1:n,x2:s,y2:c}];for(let S=0;S<this.boxKeys.length;S++)x.push({key:this.boxKeys[S],x1:this.bboxes[4*S],y1:this.bboxes[4*S+1],x2:this.bboxes[4*S+2],y2:this.bboxes[4*S+3]});for(let S=0;S<this.circleKeys.length;S++){const I=this.circles[3*S],A=this.circles[3*S+1],L=this.circles[3*S+2];x.push({key:this.circleKeys[S],x1:I-L,y1:A-L,x2:I+L,y2:A+L})}}else this._forEachCell(t,n,s,c,this._queryCell,x,{hitTest:p,overlapMode:g,seenUids:{box:{},circle:{}}},y);return x}query(t,n,s,c){return this._query(t,n,s,c,!1,null)}hitTest(t,n,s,c,p,g){return this._query(t,n,s,c,!0,p,g).length>0}hitTestCircle(t,n,s,c,p){const g=t-s,y=t+s,x=n-s,S=n+s;if(y<0||g>this.width||S<0||x>this.height)return!1;const I=[];return this._forEachCell(g,x,y,S,this._queryCellCircle,I,{hitTest:!0,overlapMode:c,circle:{x:t,y:n,radius:s},seenUids:{box:{},circle:{}}},p),I.length>0}_queryCell(t,n,s,c,p,g,y,x){const{seenUids:S,hitTest:I,overlapMode:A}=y,L=this.boxCells[p];if(L!==null){const N=this.bboxes;for(const $ of L)if(!S.box[$]){S.box[$]=!0;const F=4*$,Q=this.boxKeys[$];if(t<=N[F+2]&&n<=N[F+3]&&s>=N[F+0]&&c>=N[F+1]&&(!x||x(Q))&&(!I||!wn(A,Q.overlapMode))&&(g.push({key:Q,x1:N[F],y1:N[F+1],x2:N[F+2],y2:N[F+3]}),I))return!0}}const U=this.circleCells[p];if(U!==null){const N=this.circles;for(const $ of U)if(!S.circle[$]){S.circle[$]=!0;const F=3*$,Q=this.circleKeys[$];if(this._circleAndRectCollide(N[F],N[F+1],N[F+2],t,n,s,c)&&(!x||x(Q))&&(!I||!wn(A,Q.overlapMode))){const se=N[F],Z=N[F+1],ee=N[F+2];if(g.push({key:Q,x1:se-ee,y1:Z-ee,x2:se+ee,y2:Z+ee}),I)return!0}}}return!1}_queryCellCircle(t,n,s,c,p,g,y,x){const{circle:S,seenUids:I,overlapMode:A}=y,L=this.boxCells[p];if(L!==null){const N=this.bboxes;for(const $ of L)if(!I.box[$]){I.box[$]=!0;const F=4*$,Q=this.boxKeys[$];if(this._circleAndRectCollide(S.x,S.y,S.radius,N[F+0],N[F+1],N[F+2],N[F+3])&&(!x||x(Q))&&!wn(A,Q.overlapMode))return g.push(!0),!0}}const U=this.circleCells[p];if(U!==null){const N=this.circles;for(const $ of U)if(!I.circle[$]){I.circle[$]=!0;const F=3*$,Q=this.circleKeys[$];if(this._circlesCollide(N[F],N[F+1],N[F+2],S.x,S.y,S.radius)&&(!x||x(Q))&&!wn(A,Q.overlapMode))return g.push(!0),!0}}}_forEachCell(t,n,s,c,p,g,y,x){const S=this._convertToXCellCoord(t),I=this._convertToYCellCoord(n),A=this._convertToXCellCoord(s),L=this._convertToYCellCoord(c);for(let U=S;U<=A;U++)for(let N=I;N<=L;N++)if(p.call(this,t,n,s,c,this.xCellCount*N+U,g,y,x))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,n,s,c,p,g){const y=c-t,x=p-n,S=s+g;return S*S>y*y+x*x}_circleAndRectCollide(t,n,s,c,p,g,y){const x=(g-c)/2,S=Math.abs(t-(c+x));if(S>x+s)return!1;const I=(y-p)/2,A=Math.abs(n-(p+I));if(A>I+s)return!1;if(S<=x||A<=I)return!0;const L=S-x,U=A-I;return L*L+U*U<=s*s}}function Se(h,t,n,s,c){const p=l.Z();return t?(l.a0(p,p,[1/c,1/c,1]),n||l.ae(p,p,s.angle)):l.a1(p,s.labelPlaneMatrix,h),p}function Gr(h,t,n,s,c){if(t){const p=l.af(h);return l.a0(p,p,[c,c,1]),n||l.ae(p,p,-s.angle),p}return s.glCoordMatrix}function si(h,t,n){let s;n?(s=[h.x,h.y,n(h.x,h.y),1],l.ag(s,s,t)):(s=[h.x,h.y,0,1],j(s,s,t));const c=s[3];return{point:new l.P(s[0]/c,s[1]/c),signedDistanceFromCamera:c}}function Fn(h,t){return .5+h/t*.5}function nn(h,t){const n=h[0]/h[3],s=h[1]/h[3];return n>=-t[0]&&n<=t[0]&&s>=-t[1]&&s<=t[1]}function Ie(h,t,n,s,c,p,g,y,x,S){const I=s?h.textSizeData:h.iconSizeData,A=l.ah(I,n.transform.zoom),L=[256/n.width*2+1,256/n.height*2+1],U=s?h.text.dynamicLayoutVertexArray:h.icon.dynamicLayoutVertexArray;U.clear();const N=h.lineVertexArray,$=s?h.text.placedSymbolArray:h.icon.placedSymbolArray,F=n.transform.width/n.transform.height;let Q=!1;for(let se=0;se<$.length;se++){const Z=$.get(se);if(Z.hidden||Z.writingMode===l.ai.vertical&&!Q){R(Z.numGlyphs,U);continue}let ee;if(Q=!1,S?(ee=[Z.anchorX,Z.anchorY,S(Z.anchorX,Z.anchorY),1],l.ag(ee,ee,t)):(ee=[Z.anchorX,Z.anchorY,0,1],j(ee,ee,t)),!nn(ee,L)){R(Z.numGlyphs,U);continue}const le=Fn(n.transform.cameraToCenterDistance,ee[3]),ce=l.aj(I,A,Z),me=g?ce/le:ce*le,ve=new l.P(Z.anchorX,Z.anchorY),_e=si(ve,c,S).point,be={projections:{},offsets:{}},Fe=qi(Z,me,!1,y,t,c,p,h.glyphOffsetArray,N,U,_e,ve,be,F,x,S);Q=Fe.useVertical,(Fe.notEnoughRoom||Q||Fe.needsFlipping&&qi(Z,me,!0,y,t,c,p,h.glyphOffsetArray,N,U,_e,ve,be,F,x,S).notEnoughRoom)&&R(Z.numGlyphs,U)}s?h.text.dynamicLayoutVertexBuffer.updateData(U):h.icon.dynamicLayoutVertexBuffer.updateData(U)}function st(h,t,n,s,c,p,g,y,x,S,I,A,L){const U=y.glyphStartIndex+y.numGlyphs,N=y.lineStartIndex,$=y.lineStartIndex+y.lineLength,F=t.getoffsetX(y.glyphStartIndex),Q=t.getoffsetX(U-1),se=E(h*F,n,s,c,p,g,y.segment,N,$,x,S,I,A,L);if(!se)return null;const Z=E(h*Q,n,s,c,p,g,y.segment,N,$,x,S,I,A,L);return Z?{first:se,last:Z}:null}function Ye(h,t,n,s){return h===l.ai.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*s?{useVertical:!0}:(h===l.ai.vertical?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function qi(h,t,n,s,c,p,g,y,x,S,I,A,L,U,N,$){const F=t/24,Q=h.lineOffsetX*F,se=h.lineOffsetY*F;let Z;if(h.numGlyphs>1){const ee=h.glyphStartIndex+h.numGlyphs,le=h.lineStartIndex,ce=h.lineStartIndex+h.lineLength,me=st(F,y,Q,se,n,I,A,h,x,p,L,N,$);if(!me)return{notEnoughRoom:!0};const ve=si(me.first.point,g,$).point,_e=si(me.last.point,g,$).point;if(s&&!n){const be=Ye(h.writingMode,ve,_e,U);if(be)return be}Z=[me.first];for(let be=h.glyphStartIndex+1;be<ee-1;be++)Z.push(E(F*y.getoffsetX(be),Q,se,n,I,A,h.segment,le,ce,x,p,L,N,$));Z.push(me.last)}else{if(s&&!n){const le=si(A,c,$).point,ce=h.lineStartIndex+h.segment+1,me=new l.P(x.getx(ce),x.gety(ce)),ve=si(me,c,$),_e=ve.signedDistanceFromCamera>0?ve.point:qr(A,me,le,1,c,$),be=Ye(h.writingMode,le,_e,U);if(be)return be}const ee=E(F*y.getoffsetX(h.glyphStartIndex),Q,se,n,I,A,h.segment,h.lineStartIndex,h.lineStartIndex+h.lineLength,x,p,L,N,$);if(!ee)return{notEnoughRoom:!0};Z=[ee]}for(const ee of Z)l.ak(S,ee.point,ee.angle);return{}}function qr(h,t,n,s,c,p){const g=si(h.add(h.sub(t)._unit()),c,p).point,y=n.sub(g);return n.add(y._mult(s/y.mag()))}function tt(h,t){const{projectionCache:n,lineVertexArray:s,labelPlaneMatrix:c,tileAnchorPoint:p,distanceFromAnchor:g,getElevation:y,previousVertex:x,direction:S,absOffsetX:I}=t;if(n.projections[h])return n.projections[h];const A=new l.P(s.getx(h),s.gety(h)),L=si(A,c,y);if(L.signedDistanceFromCamera>0)return n.projections[h]=L.point,L.point;const U=h-S;return qr(g===0?p:new l.P(s.getx(U),s.gety(U)),A,x,I-g+1,c,y)}function an(h,t,n){return h._unit()._perp()._mult(t*n)}function V(h,t,n,s,c,p,g,y){const{projectionCache:x,direction:S}=y;if(x.offsets[h])return x.offsets[h];const I=n.add(t);if(h+S<s||h+S>=c)return x.offsets[h]=I,I;const A=tt(h+S,y),L=an(A.sub(n),g,S),U=n.add(L),N=A.add(L);return x.offsets[h]=l.al(p,I,U,N)||I,x.offsets[h]}function E(h,t,n,s,c,p,g,y,x,S,I,A,L,U){const N=s?h-t:h+t;let $=N>0?1:-1,F=0;s&&($*=-1,F=Math.PI),$<0&&(F+=Math.PI);let Q,se,Z=$>0?y+g:y+g+1,ee=c,le=c,ce=0,me=0;const ve=Math.abs(N),_e=[];let be;for(;ce+me<=ve;){if(Z+=$,Z<y||Z>=x)return null;ce+=me,le=ee,se=Q;const Ce={projectionCache:A,lineVertexArray:S,labelPlaneMatrix:I,tileAnchorPoint:p,distanceFromAnchor:ce,getElevation:U,previousVertex:le,direction:$,absOffsetX:ve};if(ee=tt(Z,Ce),n===0)_e.push(le),be=ee.sub(le);else{let He;const Ne=ee.sub(le);He=Ne.mag()===0?an(tt(Z+$,Ce).sub(ee),n,$):an(Ne,n,$),se||(se=le.add(He)),Q=V(Z,He,ee,y,x,se,n,Ce),_e.push(se),be=Q.sub(se)}me=be.mag()}const Fe=be._mult((ve-ce)/me)._add(se||le),mt=F+Math.atan2(ee.y-le.y,ee.x-le.x);return _e.push(Fe),{point:Fe,angle:L?mt:0,path:_e}}const M=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function R(h,t){for(let n=0;n<h;n++){const s=t.length;t.resize(s+4),t.float32.set(M,3*s)}}function j(h,t,n){const s=t[0],c=t[1];return h[0]=n[0]*s+n[4]*c+n[12],h[1]=n[1]*s+n[5]*c+n[13],h[3]=n[3]*s+n[7]*c+n[15],h}const q=100;class re{constructor(t,n=new Bn(t.width+200,t.height+200,25),s=new Bn(t.width+200,t.height+200,25)){this.transform=t,this.grid=n,this.ignoredGrid=s,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+q,this.screenBottomBoundary=t.height+q,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,n,s,c,p,g){const y=this.projectAndGetPerspectiveRatio(c,t.anchorPointX,t.anchorPointY,g),x=s*y.perspectiveRatio,S=t.x1*x+y.point.x,I=t.y1*x+y.point.y,A=t.x2*x+y.point.x,L=t.y2*x+y.point.y;return!this.isInsideGrid(S,I,A,L)||n!=="always"&&this.grid.hitTest(S,I,A,L,n,p)||y.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[S,I,A,L],offscreen:this.isOffscreen(S,I,A,L)}}placeCollisionCircles(t,n,s,c,p,g,y,x,S,I,A,L,U,N){const $=[],F=new l.P(n.anchorX,n.anchorY),Q=si(F,g,N),se=Fn(this.transform.cameraToCenterDistance,Q.signedDistanceFromCamera),Z=(I?p/se:p*se)/l.ap,ee=si(F,y,N).point,le=st(Z,c,n.lineOffsetX*Z,n.lineOffsetY*Z,!1,ee,F,n,s,y,{projections:{},offsets:{}},!1,N);let ce=!1,me=!1,ve=!0;if(le){const _e=.5*L*se+U,be=new l.P(-100,-100),Fe=new l.P(this.screenRightBoundary,this.screenBottomBoundary),mt=new sa,Ce=le.first,He=le.last;let Ne=[];for(let nt=Ce.path.length-1;nt>=1;nt--)Ne.push(Ce.path[nt]);for(let nt=1;nt<He.path.length;nt++)Ne.push(He.path[nt]);const Ft=2.5*_e;if(x){const nt=Ne.map(ft=>si(ft,x,N));Ne=nt.some(ft=>ft.signedDistanceFromCamera<=0)?[]:nt.map(ft=>ft.point)}let ut=[];if(Ne.length>0){const nt=Ne[0].clone(),ft=Ne[0].clone();for(let hi=1;hi<Ne.length;hi++)nt.x=Math.min(nt.x,Ne[hi].x),nt.y=Math.min(nt.y,Ne[hi].y),ft.x=Math.max(ft.x,Ne[hi].x),ft.y=Math.max(ft.y,Ne[hi].y);ut=nt.x>=be.x&&ft.x<=Fe.x&&nt.y>=be.y&&ft.y<=Fe.y?[Ne]:ft.x<be.x||nt.x>Fe.x||ft.y<be.y||nt.y>Fe.y?[]:l.am([Ne],be.x,be.y,Fe.x,Fe.y)}for(const nt of ut){mt.reset(nt,.25*_e);let ft=0;ft=mt.length<=.5*_e?1:Math.ceil(mt.paddedLength/Ft)+1;for(let hi=0;hi<ft;hi++){const Ht=hi/Math.max(ft-1,1),Li=mt.lerp(Ht),xi=Li.x+q,mi=Li.y+q;$.push(xi,mi,_e,0);const pr=xi-_e,Xt=mi-_e,Hr=xi+_e,Wr=mi+_e;if(ve=ve&&this.isOffscreen(pr,Xt,Hr,Wr),me=me||this.isInsideGrid(pr,Xt,Hr,Wr),t!=="always"&&this.grid.hitTestCircle(xi,mi,_e,t,A)&&(ce=!0,!S))return{circles:[],offscreen:!1,collisionDetected:ce}}}}return{circles:!S&&ce||!me||se<this.perspectiveRatioCutoff?[]:$,offscreen:ve,collisionDetected:ce}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[];let s=1/0,c=1/0,p=-1/0,g=-1/0;for(const I of t){const A=new l.P(I.x+q,I.y+q);s=Math.min(s,A.x),c=Math.min(c,A.y),p=Math.max(p,A.x),g=Math.max(g,A.y),n.push(A)}const y=this.grid.query(s,c,p,g).concat(this.ignoredGrid.query(s,c,p,g)),x={},S={};for(const I of y){const A=I.key;if(x[A.bucketInstanceId]===void 0&&(x[A.bucketInstanceId]={}),x[A.bucketInstanceId][A.featureIndex])continue;const L=[new l.P(I.x1,I.y1),new l.P(I.x2,I.y1),new l.P(I.x2,I.y2),new l.P(I.x1,I.y2)];l.an(n,L)&&(x[A.bucketInstanceId][A.featureIndex]=!0,S[A.bucketInstanceId]===void 0&&(S[A.bucketInstanceId]=[]),S[A.bucketInstanceId].push(A.featureIndex))}return S}insertCollisionBox(t,n,s,c,p,g){(s?this.ignoredGrid:this.grid).insert({bucketInstanceId:c,featureIndex:p,collisionGroupID:g,overlapMode:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,s,c,p,g){const y=s?this.ignoredGrid:this.grid,x={bucketInstanceId:c,featureIndex:p,collisionGroupID:g,overlapMode:n};for(let S=0;S<t.length;S+=4)y.insertCircle(x,t[S],t[S+1],t[S+2])}projectAndGetPerspectiveRatio(t,n,s,c){let p;return c?(p=[n,s,c(n,s),1],l.ag(p,p,t)):(p=[n,s,0,1],j(p,p,t)),{point:new l.P((p[0]/p[3]+1)/2*this.transform.width+q,(-p[1]/p[3]+1)/2*this.transform.height+q),perspectiveRatio:.5+this.transform.cameraToCenterDistance/p[3]*.5}}isOffscreen(t,n,s,c){return s<q||t>=this.screenRightBoundary||c<q||n>this.screenBottomBoundary}isInsideGrid(t,n,s,c){return s>=0&&t<this.gridRightBoundary&&c>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=l.ao([]);return l.$(t,t,[-100,-100,0]),t}}function J(h,t,n){return t*(l.N/(h.tileSize*Math.pow(2,n-h.tileID.overscaledZ)))}class K{constructor(t,n,s,c){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):c&&s?1:0,this.placed=s}isHidden(){return this.opacity===0&&!this.placed}}class te{constructor(t,n,s,c,p){this.text=new K(t?t.text:null,n,s,p),this.icon=new K(t?t.icon:null,n,c,p)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class pe{constructor(t,n,s){this.text=t,this.icon=n,this.skipFade=s}}class de{constructor(){this.invProjMatrix=l.Z(),this.viewportMatrix=l.Z(),this.circles=[]}}class ge{constructor(t,n,s,c,p){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=s,this.bucketIndex=c,this.tileID=p}}class $e{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const n=++this.maxGroupID;this.collisionGroups[t]={ID:n,predicate:s=>s.collisionGroupID===n}}return this.collisionGroups[t]}}function Xe(h,t,n,s,c){const{horizontalAlign:p,verticalAlign:g}=l.au(h);return new l.P(-(p-.5)*t+s[0]*c,-(g-.5)*n+s[1]*c)}function Be(h,t,n,s,c,p){const{x1:g,x2:y,y1:x,y2:S,anchorPointX:I,anchorPointY:A}=h,L=new l.P(t,n);return s&&L._rotate(c?p:-p),{x1:g+L.x,y1:x+L.y,x2:y+L.x,y2:S+L.y,anchorPointX:I,anchorPointY:A}}class Ge{constructor(t,n,s,c,p){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new re(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=s,this.retainedQueryData={},this.collisionGroups=new $e(c),this.collisionCircleArrays={},this.prevPlacement=p,p&&(p.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,s,c){const p=s.getBucket(n),g=s.latestFeatureIndex;if(!p||!g||n.id!==p.layerIds[0])return;const y=s.collisionBoxArray,x=p.layers[0].layout,S=Math.pow(2,this.transform.zoom-s.tileID.overscaledZ),I=s.tileSize/l.N,A=this.transform.calculatePosMatrix(s.tileID.toUnwrapped()),L=x.get("text-pitch-alignment")==="map",U=x.get("text-rotation-alignment")==="map",N=J(s,1,this.transform.zoom),$=Se(A,L,U,this.transform,N);let F=null;if(L){const se=Gr(A,L,U,this.transform,N);F=l.a1([],this.transform.labelPlaneMatrix,se)}this.retainedQueryData[p.bucketInstanceId]=new ge(p.bucketInstanceId,g,p.sourceLayerIndex,p.index,s.tileID);const Q={bucket:p,layout:x,posMatrix:A,textLabelPlaneMatrix:$,labelToScreenMatrix:F,scale:S,textPixelRatio:I,holdingForFade:s.holdingForFade(),collisionBoxArray:y,partiallyEvaluatedTextSize:l.ah(p.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(p.sourceID)};if(c)for(const se of p.sortKeyRanges){const{sortKey:Z,symbolInstanceStart:ee,symbolInstanceEnd:le}=se;t.push({sortKey:Z,symbolInstanceStart:ee,symbolInstanceEnd:le,parameters:Q})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:p.symbolInstances.length,parameters:Q})}attemptAnchorPlacement(t,n,s,c,p,g,y,x,S,I,A,L,U,N,$,F){const Q=l.aq[t.textAnchor],se=[t.textOffset0,t.textOffset1],Z=Xe(Q,s,c,se,p),ee=this.collisionIndex.placeCollisionBox(Be(n,Z.x,Z.y,g,y,this.transform.angle),A,x,S,I.predicate,F);if((!$||this.collisionIndex.placeCollisionBox(Be($,Z.x,Z.y,g,y,this.transform.angle),A,x,S,I.predicate,F).box.length!==0)&&ee.box.length>0){let le;if(this.prevPlacement&&this.prevPlacement.variableOffsets[L.crossTileID]&&this.prevPlacement.placements[L.crossTileID]&&this.prevPlacement.placements[L.crossTileID].text&&(le=this.prevPlacement.variableOffsets[L.crossTileID].anchor),L.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[L.crossTileID]={textOffset:se,width:s,height:c,anchor:Q,textBoxScale:p,prevAnchor:le},this.markUsedJustification(U,Q,L,N),U.allowVerticalPlacement&&(this.markUsedOrientation(U,N,L),this.placedOrientations[L.crossTileID]=N),{shift:Z,placedGlyphBoxes:ee}}}placeLayerBucketPart(t,n,s){const{bucket:c,layout:p,posMatrix:g,textLabelPlaneMatrix:y,labelToScreenMatrix:x,textPixelRatio:S,holdingForFade:I,collisionBoxArray:A,partiallyEvaluatedTextSize:L,collisionGroup:U}=t.parameters,N=p.get("text-optional"),$=p.get("icon-optional"),F=l.ar(p,"text-overlap","text-allow-overlap"),Q=F==="always",se=l.ar(p,"icon-overlap","icon-allow-overlap"),Z=se==="always",ee=p.get("text-rotation-alignment")==="map",le=p.get("text-pitch-alignment")==="map",ce=p.get("icon-text-fit")!=="none",me=p.get("symbol-z-order")==="viewport-y",ve=Q&&(Z||!c.hasIconData()||$),_e=Z&&(Q||!c.hasTextData()||N);!c.collisionArrays&&A&&c.deserializeCollisionBoxes(A);const be=this.retainedQueryData[c.bucketInstanceId].tileID,Fe=this.terrain?(Ce,He)=>this.terrain.getElevation(be,Ce,He):null,mt=(Ce,He)=>{var Ne,Ft;if(n[Ce.crossTileID])return;if(I)return void(this.placements[Ce.crossTileID]=new pe(!1,!1,!1));let ut=!1,nt=!1,ft=!0,hi=null,Ht={box:null,offscreen:null},Li={box:null,offscreen:null},xi=null,mi=null,pr=null,Xt=0,Hr=0,Wr=0;He.textFeatureIndex?Xt=He.textFeatureIndex:Ce.useRuntimeCollisionCircles&&(Xt=Ce.featureIndex),He.verticalTextFeatureIndex&&(Hr=He.verticalTextFeatureIndex);const Pn=He.textBox;if(Pn){const Ni=ui=>{let bi=l.ai.horizontal;if(c.allowVerticalPlacement&&!ui&&this.prevPlacement){const tr=this.prevPlacement.placedOrientations[Ce.crossTileID];tr&&(this.placedOrientations[Ce.crossTileID]=tr,bi=tr,this.markUsedOrientation(c,bi,Ce))}return bi},zi=(ui,bi)=>{if(c.allowVerticalPlacement&&Ce.numVerticalGlyphVertices>0&&He.verticalTextBox){for(const tr of c.writingModes)if(tr===l.ai.vertical?(Ht=bi(),Li=Ht):Ht=ui(),Ht&&Ht.box&&Ht.box.length)break}else Ht=ui()},Hi=Ce.textAnchorOffsetStartIndex,Hn=Ce.textAnchorOffsetEndIndex;if(Hn===Hi){const ui=(bi,tr)=>{const pi=this.collisionIndex.placeCollisionBox(bi,F,S,g,U.predicate,Fe);return pi&&pi.box&&pi.box.length&&(this.markUsedOrientation(c,tr,Ce),this.placedOrientations[Ce.crossTileID]=tr),pi};zi(()=>ui(Pn,l.ai.horizontal),()=>{const bi=He.verticalTextBox;return c.allowVerticalPlacement&&Ce.numVerticalGlyphVertices>0&&bi?ui(bi,l.ai.vertical):{box:null,offscreen:null}}),Ni(Ht&&Ht.box&&Ht.box.length)}else{let ui=l.aq[(Ft=(Ne=this.prevPlacement)===null||Ne===void 0?void 0:Ne.variableOffsets[Ce.crossTileID])===null||Ft===void 0?void 0:Ft.anchor];const bi=(pi,Wn,Bs)=>{const oc=pi.x2-pi.x1,lc=pi.y2-pi.y1,bh=Ce.textBoxScale,Uo=ce&&se==="never"?Wn:null;let Kr={box:[],offscreen:!1},Kn=F==="never"?1:2,Xr="never";ui&&Kn++;for(let Er=0;Er<Kn;Er++){for(let Yr=Hi;Yr<Hn;Yr++){const Vo=c.textAnchorOffsets.get(Yr);if(ui&&Vo.textAnchor!==ui)continue;const un=this.attemptAnchorPlacement(Vo,pi,oc,lc,bh,ee,le,S,g,U,Xr,Ce,c,Bs,Uo,Fe);if(un&&(Kr=un.placedGlyphBoxes,Kr&&Kr.box&&Kr.box.length))return ut=!0,hi=un.shift,Kr}ui?ui=null:Xr=F}return Kr};zi(()=>bi(Pn,He.iconBox,l.ai.horizontal),()=>{const pi=He.verticalTextBox;return c.allowVerticalPlacement&&!(Ht&&Ht.box&&Ht.box.length)&&Ce.numVerticalGlyphVertices>0&&pi?bi(pi,He.verticalIconBox,l.ai.vertical):{box:null,offscreen:null}}),Ht&&(ut=Ht.box,ft=Ht.offscreen);const tr=Ni(Ht&&Ht.box);if(!ut&&this.prevPlacement){const pi=this.prevPlacement.variableOffsets[Ce.crossTileID];pi&&(this.variableOffsets[Ce.crossTileID]=pi,this.markUsedJustification(c,pi.anchor,Ce,tr))}}}if(xi=Ht,ut=xi&&xi.box&&xi.box.length>0,ft=xi&&xi.offscreen,Ce.useRuntimeCollisionCircles){const Ni=c.text.placedSymbolArray.get(Ce.centerJustifiedTextSymbolIndex),zi=l.aj(c.textSizeData,L,Ni),Hi=p.get("text-padding");mi=this.collisionIndex.placeCollisionCircles(F,Ni,c.lineVertexArray,c.glyphOffsetArray,zi,g,y,x,s,le,U.predicate,Ce.collisionCircleDiameter,Hi,Fe),mi.circles.length&&mi.collisionDetected&&!s&&l.w("Collisions detected, but collision boxes are not shown"),ut=Q||mi.circles.length>0&&!mi.collisionDetected,ft=ft&&mi.offscreen}if(He.iconFeatureIndex&&(Wr=He.iconFeatureIndex),He.iconBox){const Ni=zi=>{const Hi=ce&&hi?Be(zi,hi.x,hi.y,ee,le,this.transform.angle):zi;return this.collisionIndex.placeCollisionBox(Hi,se,S,g,U.predicate,Fe)};Li&&Li.box&&Li.box.length&&He.verticalIconBox?(pr=Ni(He.verticalIconBox),nt=pr.box.length>0):(pr=Ni(He.iconBox),nt=pr.box.length>0),ft=ft&&pr.offscreen}const Zn=N||Ce.numHorizontalGlyphVertices===0&&Ce.numVerticalGlyphVertices===0,xa=$||Ce.numIconVertices===0;if(Zn||xa?xa?Zn||(nt=nt&&ut):ut=nt&&ut:nt=ut=nt&&ut,ut&&xi&&xi.box&&this.collisionIndex.insertCollisionBox(xi.box,F,p.get("text-ignore-placement"),c.bucketInstanceId,Li&&Li.box&&Hr?Hr:Xt,U.ID),nt&&pr&&this.collisionIndex.insertCollisionBox(pr.box,se,p.get("icon-ignore-placement"),c.bucketInstanceId,Wr,U.ID),mi&&(ut&&this.collisionIndex.insertCollisionCircles(mi.circles,F,p.get("text-ignore-placement"),c.bucketInstanceId,Xt,U.ID),s)){const Ni=c.bucketInstanceId;let zi=this.collisionCircleArrays[Ni];zi===void 0&&(zi=this.collisionCircleArrays[Ni]=new de);for(let Hi=0;Hi<mi.circles.length;Hi+=4)zi.circles.push(mi.circles[Hi+0]),zi.circles.push(mi.circles[Hi+1]),zi.circles.push(mi.circles[Hi+2]),zi.circles.push(mi.collisionDetected?1:0)}if(Ce.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[Ce.crossTileID]=new pe(ut||ve,nt||_e,ft||c.justReloaded),n[Ce.crossTileID]=!0};if(me){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ce=c.getSortedSymbolIndexes(this.transform.angle);for(let He=Ce.length-1;He>=0;--He){const Ne=Ce[He];mt(c.symbolInstances.get(Ne),c.collisionArrays[Ne])}}else for(let Ce=t.symbolInstanceStart;Ce<t.symbolInstanceEnd;Ce++)mt(c.symbolInstances.get(Ce),c.collisionArrays[Ce]);if(s&&c.bucketInstanceId in this.collisionCircleArrays){const Ce=this.collisionCircleArrays[c.bucketInstanceId];l.as(Ce.invProjMatrix,g),Ce.viewportMatrix=this.collisionIndex.getViewportMatrix()}c.justReloaded=!1}markUsedJustification(t,n,s,c){let p;p=c===l.ai.vertical?s.verticalPlacedTextSymbolIndex:{left:s.leftJustifiedTextSymbolIndex,center:s.centerJustifiedTextSymbolIndex,right:s.rightJustifiedTextSymbolIndex}[l.at(n)];const g=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex,s.verticalPlacedTextSymbolIndex];for(const y of g)y>=0&&(t.text.placedSymbolArray.get(y).crossTileID=p>=0&&y!==p?0:s.crossTileID)}markUsedOrientation(t,n,s){const c=n===l.ai.horizontal||n===l.ai.horizontalOnly?n:0,p=n===l.ai.vertical?n:0,g=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex];for(const y of g)t.text.placedSymbolArray.get(y).placedOrientation=c;s.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).placedOrientation=p)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let s=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const c=n?n.symbolFadeChange(t):1,p=n?n.opacities:{},g=n?n.variableOffsets:{},y=n?n.placedOrientations:{};for(const x in this.placements){const S=this.placements[x],I=p[x];I?(this.opacities[x]=new te(I,c,S.text,S.icon),s=s||S.text!==I.text.placed||S.icon!==I.icon.placed):(this.opacities[x]=new te(null,c,S.text,S.icon,S.skipFade),s=s||S.text||S.icon)}for(const x in p){const S=p[x];if(!this.opacities[x]){const I=new te(S,c,!1,!1);I.isHidden()||(this.opacities[x]=I,s=s||S.text.placed||S.icon.placed)}}for(const x in g)this.variableOffsets[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.variableOffsets[x]=g[x]);for(const x in y)this.placedOrientations[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.placedOrientations[x]=y[x]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");s?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const s={};for(const c of n){const p=c.getBucket(t);p&&c.latestFeatureIndex&&t.id===p.layerIds[0]&&this.updateBucketOpacities(p,s,c.collisionBoxArray)}}updateBucketOpacities(t,n,s){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const c=t.layers[0],p=c.layout,g=new te(null,0,!1,!1,!0),y=p.get("text-allow-overlap"),x=p.get("icon-allow-overlap"),S=c._unevaluatedLayout.hasValue("text-variable-anchor")||c._unevaluatedLayout.hasValue("text-variable-anchor-offset"),I=p.get("text-rotation-alignment")==="map",A=p.get("text-pitch-alignment")==="map",L=p.get("icon-text-fit")!=="none",U=new te(null,0,y&&(x||!t.hasIconData()||p.get("icon-optional")),x&&(y||!t.hasTextData()||p.get("text-optional")),!0);!t.collisionArrays&&s&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(s);const N=($,F,Q)=>{for(let se=0;se<F/4;se++)$.opacityVertexArray.emplaceBack(Q);$.hasVisibleVertices=$.hasVisibleVertices||Q!==wr};for(let $=0;$<t.symbolInstances.length;$++){const F=t.symbolInstances.get($),{numHorizontalGlyphVertices:Q,numVerticalGlyphVertices:se,crossTileID:Z}=F;let ee=this.opacities[Z];n[Z]?ee=g:ee||(ee=U,this.opacities[Z]=ee),n[Z]=!0;const le=F.numIconVertices>0,ce=this.placedOrientations[F.crossTileID],me=ce===l.ai.vertical,ve=ce===l.ai.horizontal||ce===l.ai.horizontalOnly;if(Q>0||se>0){const _e=ki(ee.text);N(t.text,Q,me?wr:_e),N(t.text,se,ve?wr:_e);const be=ee.text.isHidden();[F.rightJustifiedTextSymbolIndex,F.centerJustifiedTextSymbolIndex,F.leftJustifiedTextSymbolIndex].forEach(Ce=>{Ce>=0&&(t.text.placedSymbolArray.get(Ce).hidden=be||me?1:0)}),F.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(F.verticalPlacedTextSymbolIndex).hidden=be||ve?1:0);const Fe=this.variableOffsets[F.crossTileID];Fe&&this.markUsedJustification(t,Fe.anchor,F,ce);const mt=this.placedOrientations[F.crossTileID];mt&&(this.markUsedJustification(t,"left",F,mt),this.markUsedOrientation(t,mt,F))}if(le){const _e=ki(ee.icon),be=!(L&&F.verticalPlacedIconSymbolIndex&&me);F.placedIconSymbolIndex>=0&&(N(t.icon,F.numIconVertices,be?_e:wr),t.icon.placedSymbolArray.get(F.placedIconSymbolIndex).hidden=ee.icon.isHidden()),F.verticalPlacedIconSymbolIndex>=0&&(N(t.icon,F.numVerticalIconVertices,be?wr:_e),t.icon.placedSymbolArray.get(F.verticalPlacedIconSymbolIndex).hidden=ee.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const _e=t.collisionArrays[$];if(_e){let be=new l.P(0,0);if(_e.textBox||_e.verticalTextBox){let mt=!0;if(S){const Ce=this.variableOffsets[Z];Ce?(be=Xe(Ce.anchor,Ce.width,Ce.height,Ce.textOffset,Ce.textBoxScale),I&&be._rotate(A?this.transform.angle:-this.transform.angle)):mt=!1}_e.textBox&&Je(t.textCollisionBox.collisionVertexArray,ee.text.placed,!mt||me,be.x,be.y),_e.verticalTextBox&&Je(t.textCollisionBox.collisionVertexArray,ee.text.placed,!mt||ve,be.x,be.y)}const Fe=!!(!ve&&_e.verticalIconBox);_e.iconBox&&Je(t.iconCollisionBox.collisionVertexArray,ee.icon.placed,Fe,L?be.x:0,L?be.y:0),_e.verticalIconBox&&Je(t.iconCollisionBox.collisionVertexArray,ee.icon.placed,!Fe,L?be.x:0,L?be.y:0)}}}if(t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);if(t.bucketInstanceId in this.collisionCircleArrays){const $=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=$.invProjMatrix,t.placementViewportMatrix=$.viewportMatrix,t.collisionCircleArray=$.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,n){const s=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*s>t}setStale(){this.stale=!0}}function Je(h,t,n,s,c){h.emplaceBack(t?1:0,n?1:0,s||0,c||0),h.emplaceBack(t?1:0,n?1:0,s||0,c||0),h.emplaceBack(t?1:0,n?1:0,s||0,c||0),h.emplaceBack(t?1:0,n?1:0,s||0,c||0)}const Dt=Math.pow(2,25),Nt=Math.pow(2,24),St=Math.pow(2,17),wt=Math.pow(2,16),Fi=Math.pow(2,9),Zt=Math.pow(2,8),yi=Math.pow(2,1);function ki(h){if(h.opacity===0&&!h.placed)return 0;if(h.opacity===1&&h.placed)return 4294967295;const t=h.placed?1:0,n=Math.floor(127*h.opacity);return n*Dt+t*Nt+n*St+t*wt+n*Fi+t*Zt+n*yi+t}const wr=0;class Sl{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,n,s,c,p){const g=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(g,c,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,p())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,g.sort((y,x)=>y.sortKey-x.sortKey));this._currentPartIndex<g.length;)if(n.placeLayerBucketPart(g[this._currentPartIndex],this._seenCrossTileIDs,s),this._currentPartIndex++,p())return!0;return!1}}class oa{constructor(t,n,s,c,p,g,y,x){this.placement=new Ge(t,n,g,y,x),this._currentPlacementIndex=s.length-1,this._forceFullPlacement=c,this._showCollisionBoxes=p,this._done=!1}isDone(){return this._done}continuePlacement(t,n,s){const c=l.h.now(),p=()=>!this._forceFullPlacement&&l.h.now()-c>2;for(;this._currentPlacementIndex>=0;){const g=n[t[this._currentPlacementIndex]],y=this.placement.collisionIndex.transform.zoom;if(g.type==="symbol"&&(!g.minzoom||g.minzoom<=y)&&(!g.maxzoom||g.maxzoom>y)){if(this._inProgressLayer||(this._inProgressLayer=new Sl(g)),this._inProgressLayer.continuePlacement(s[g.source],this.placement,this._showCollisionBoxes,g,p))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const la=512/l.N/2;class nh{constructor(t,n,s){this.tileID=t,this.bucketInstanceId=s,this._symbolsByKey={};const c=new Map;for(let p=0;p<n.length;p++){const g=n.get(p),y=g.key,x=c.get(y);x?x.push(g):c.set(y,[g])}for(const[p,g]of c){const y={positions:g.map(x=>({x:Math.floor(x.anchorX*la),y:Math.floor(x.anchorY*la)})),crossTileIDs:g.map(x=>x.crossTileID)};if(y.positions.length>128){const x=new l.av(y.positions.length,16,Uint16Array);for(const{x:S,y:I}of y.positions)x.add(S,I);x.finish(),delete y.positions,y.index=x}this._symbolsByKey[p]=y}}getScaledCoordinates(t,n){const{x:s,y:c,z:p}=this.tileID.canonical,{x:g,y,z:x}=n.canonical,S=la/Math.pow(2,x-p),I=(y*l.N+t.anchorY)*S,A=c*l.N*la;return{x:Math.floor((g*l.N+t.anchorX)*S-s*l.N*la),y:Math.floor(I-A)}}findMatches(t,n,s){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<t.length;p++){const g=t.get(p);if(g.crossTileID)continue;const y=this._symbolsByKey[g.key];if(!y)continue;const x=this.getScaledCoordinates(g,n);if(y.index){const S=y.index.range(x.x-c,x.y-c,x.x+c,x.y+c).sort();for(const I of S){const A=y.crossTileIDs[I];if(!s[A]){s[A]=!0,g.crossTileID=A;break}}}else if(y.positions)for(let S=0;S<y.positions.length;S++){const I=y.positions[S],A=y.crossTileIDs[S];if(Math.abs(I.x-x.x)<=c&&Math.abs(I.y-x.y)<=c&&!s[A]){s[A]=!0,g.crossTileID=A;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:t})=>t)}}class Bt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Js{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const s in this.indexes){const c=this.indexes[s],p={};for(const g in c){const y=c[g];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+n),p[y.tileID.key]=y}this.indexes[s]=p}this.lng=t}addBucket(t,n,s){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let p=0;p<n.symbolInstances.length;p++)n.symbolInstances.get(p).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const c=this.usedCrossTileIDs[t.overscaledZ];for(const p in this.indexes){const g=this.indexes[p];if(Number(p)>t.overscaledZ)for(const y in g){const x=g[y];x.tileID.isChildOf(t)&&x.findMatches(n.symbolInstances,t,c)}else{const y=g[t.scaledTo(Number(p)).key];y&&y.findMatches(n.symbolInstances,t,c)}}for(let p=0;p<n.symbolInstances.length;p++){const g=n.symbolInstances.get(p);g.crossTileID||(g.crossTileID=s.generate(),c[g.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new nh(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const s of n.getCrossTileIDsLists())for(const c of s)delete this.usedCrossTileIDs[t][c]}removeStaleBuckets(t){let n=!1;for(const s in this.indexes){const c=this.indexes[s];for(const p in c)t[c[p].bucketInstanceId]||(this.removeBucketCrossTileIDs(s,c[p]),delete c[p],n=!0)}return n}}class ls{constructor(){this.layerIndexes={},this.crossTileIDs=new Bt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,s){let c=this.layerIndexes[t.id];c===void 0&&(c=this.layerIndexes[t.id]=new Js);let p=!1;const g={};c.handleWrapJump(s);for(const y of n){const x=y.getBucket(t);x&&t.id===x.layerIds[0]&&(x.bucketInstanceId||(x.bucketInstanceId=++this.maxBucketInstanceId),c.addBucket(y.tileID,x,this.crossTileIDs)&&(p=!0),g[x.bucketInstanceId]=!0)}return c.removeStaleBuckets(g)&&(p=!0),p}pruneUnusedLayers(t){const n={};t.forEach(s=>{n[s]=!0});for(const s in this.layerIndexes)n[s]||delete this.layerIndexes[s]}}const Oi=(h,t)=>l.x(h,t&&t.filter(n=>n.identifier!=="source.canvas")),or=l.F(l.ax,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),ah=l.F(l.ax,["setCenter","setZoom","setBearing","setPitch"]),Sr=l.aw();class Mi extends l.E{constructor(t,n={}){super(),this.map=t,this.dispatcher=new gi(os(),this,t._getMapId()),this.imageManager=new Qe,this.imageManager.setEventedParent(this),this.glyphManager=new Rt(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new vr(256,512),this.crossTileSymbolIndex=new ls,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new l.ay,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",l.az());const s=this;this._rtlTextPluginCallback=Mi.registerForPluginStateChange(c=>{s.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:c.pluginStatus,pluginURL:c.pluginURL},(p,g)=>{if(l.aA(p),g&&g.every(y=>y))for(const y in s.sourceCaches){const x=s.sourceCaches[y].getSource().type;x!=="vector"&&x!=="geojson"||s.sourceCaches[y].reload()}})}),this.on("data",c=>{if(c.dataType!=="source"||c.sourceDataType!=="metadata")return;const p=this.sourceCaches[c.sourceId];if(!p)return;const g=p.getSource();if(g&&g.vectorLayerIds)for(const y in this._layers){const x=this._layers[y];x.source===g.id&&this._validateLayer(x)}})}loadURL(t,n={},s){this.fire(new l.k("dataloading",{dataType:"style"})),n.validate=typeof n.validate!="boolean"||n.validate;const c=this.map._requestManager.transformRequest(t,it.Style);this._request=l.f(c,(p,g)=>{this._request=null,p?this.fire(new l.j(p)):g&&this._load(g,n,s)})}loadJSON(t,n={},s){this.fire(new l.k("dataloading",{dataType:"style"})),this._request=l.h.frame(()=>{this._request=null,n.validate=n.validate!==!1,this._load(t,n,s)})}loadEmpty(){this.fire(new l.k("dataloading",{dataType:"style"})),this._load(Sr,{validate:!1})}_load(t,n,s){var c;const p=n.transformStyle?n.transformStyle(s,t):t;if(!n.validate||!Oi(this,l.y(p))){this._loaded=!0,this.stylesheet=p;for(const g in p.sources)this.addSource(g,p.sources[g],{validate:!1});p.sprite?this._loadSprite(p.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(p.glyphs),this._createLayers(),this.light=new Pi(this.stylesheet.light),this.map.setTerrain((c=this.stylesheet.terrain)!==null&&c!==void 0?c:null),this.fire(new l.k("data",{dataType:"style"})),this.fire(new l.k("style.load"))}}_createLayers(){const t=l.aB(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",t),this._order=t.map(n=>n.id),this._layers={},this._serializedLayers=null;for(const n of t){const s=l.aC(n);s.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=s}}_loadSprite(t,n=!1,s=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=function(c,p,g,y){const x=Ke(c),S=x.length,I=g>1?"@2x":"",A={},L={},U={};for(const{id:N,url:$}of x){const F=p.transformRequest(p.normalizeSpriteURL($,I,".json"),it.SpriteJSON),Q=`${N}_${F.url}`;A[Q]=l.f(F,(ee,le)=>{delete A[Q],L[N]=le,_t(y,L,U,ee,S)});const se=p.transformRequest(p.normalizeSpriteURL($,I,".png"),it.SpriteImage),Z=`${N}_${se.url}`;A[Z]=Tt.getImage(se,(ee,le)=>{delete A[Z],U[N]=le,_t(y,L,U,ee,S)})}return{cancel(){for(const N of Object.values(A))N.cancel()}}}(t,this.map._requestManager,this.map.getPixelRatio(),(c,p)=>{if(this._spriteRequest=null,c)this.fire(new l.j(c));else if(p)for(const g in p){this._spritesImagesIds[g]=[];const y=this._spritesImagesIds[g]?this._spritesImagesIds[g].filter(x=>!(x in p)):[];for(const x of y)this.imageManager.removeImage(x),this._changedImages[x]=!0;for(const x in p[g]){const S=g==="default"?x:`${g}:${x}`;this._spritesImagesIds[g].push(S),S in this.imageManager.images?this.imageManager.updateImage(S,p[g][x],!1):this.imageManager.addImage(S,p[g][x]),n&&(this._changedImages[S]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new l.k("data",{dataType:"style"})),s&&s(c)})}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}_validateLayer(t){const n=this.sourceCaches[t.source];if(!n)return;const s=t.sourceLayer;if(!s)return;const c=n.getSource();(c.type==="geojson"||c.vectorLayerIds&&c.vectorLayerIds.indexOf(s)===-1)&&this.fire(new l.j(new Error(`Source layer "${s}" does not exist on source "${c.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t){const n=this._serializedAllLayers();if(!t||t.length===0)return Object.values(n);const s=[];for(const c of t)n[c]&&s.push(n[c]);return s}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const n=Object.keys(this._layers);for(const s of n){const c=this._layers[s];c.type!=="custom"&&(t[s]=c.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const n=this._changed;if(this._changed){const c=Object.keys(this._updatedLayers),p=Object.keys(this._removedLayers);(c.length||p.length)&&this._updateWorkerLayers(c,p);for(const g in this._updatedSources){const y=this._updatedSources[g];if(y==="reload")this._reloadSource(g);else{if(y!=="clear")throw new Error(`Invalid action ${y}`);this._clearSource(g)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const g in this._updatedPaintProps)this._layers[g].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const s={};for(const c in this.sourceCaches){const p=this.sourceCaches[c];s[c]=p.used,p.used=!1}for(const c of this._order){const p=this._layers[c];p.recalculate(t,this._availableImages),!p.isHidden(t.zoom)&&p.source&&(this.sourceCaches[p.source].used=!0)}for(const c in s){const p=this.sourceCaches[c];s[c]!==p.used&&p.fire(new l.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:c}))}this.light.recalculate(t),this.z=t.zoom,n&&this.fire(new l.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,n){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(t),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,n={}){this._checkLoaded();const s=this.serialize();if(t=n.transformStyle?n.transformStyle(s,t):t,Oi(this,l.y(t)))return!1;(t=l.aD(t)).layers=l.aB(t.layers);const c=l.aE(s,t).filter(g=>!(g.command in ah));if(c.length===0)return!1;const p=c.filter(g=>!(g.command in or));if(p.length>0)throw new Error(`Unimplemented: ${p.map(g=>g.command).join(", ")}.`);for(const g of c)g.command!=="setTransition"&&this[g.command].apply(this,g.args);return this.stylesheet=t,this._serializedLayers=null,!0}addImage(t,n){if(this.getImage(t))return this.fire(new l.j(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(t,n){this.imageManager.updateImage(t,n)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new l.j(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,s={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" 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(l.y.source,`sources.${t}`,n,null,s))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const c=this.sourceCaches[t]=new Ji(t,n,this.dispatcher);c.style=this,c.setEventedParent(this,()=>({isSourceLoaded:c.loaded(),source:c.serialize(),sourceId:t})),c.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(const s in this._layers)if(this._layers[s].source===t)return this.fire(new l.j(new Error(`Source "${t}" cannot be removed while layer "${s}" is using it.`)));const n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new l.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,n){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const s=this.sourceCaches[t].getSource();if(s.type!=="geojson")throw new Error(`geojsonSource.type is ${s.type}, which is !== 'geojson`);s.setData(n),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,n,s={}){this._checkLoaded();const c=t.id;if(this.getLayer(c))return void this.fire(new l.j(new Error(`Layer "${c}" already exists on this map.`)));let p;if(t.type==="custom"){if(Oi(this,l.aF(t)))return;p=l.aC(t)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(c,t.source),t=l.aD(t),t=l.e(t,{source:c})),this._validate(l.y.layer,`layers.${c}`,t,{arrayIndex:-1},s))return;p=l.aC(t),this._validateLayer(p),p.setEventedParent(this,{layer:{id:c}})}const g=n?this._order.indexOf(n):this._order.length;if(n&&g===-1)this.fire(new l.j(new Error(`Cannot add layer "${c}" before non-existing layer "${n}".`)));else{if(this._order.splice(g,0,c),this._layerOrderChanged=!0,this._layers[c]=p,this._removedLayers[c]&&p.source&&p.type!=="custom"){const y=this._removedLayers[c];delete this._removedLayers[c],y.type!==p.type?this._updatedSources[p.source]="clear":(this._updatedSources[p.source]="reload",this.sourceCaches[p.source].pause())}this._updateLayer(p),p.onAdd&&p.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new l.j(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const s=this._order.indexOf(t);this._order.splice(s,1);const c=n?this._order.indexOf(n):this._order.length;n&&c===-1?this.fire(new l.j(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(c,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new l.j(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const s=this._order.indexOf(t);this._order.splice(s,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,s){this._checkLoaded();const c=this.getLayer(t);c?c.minzoom===n&&c.maxzoom===s||(n!=null&&(c.minzoom=n),s!=null&&(c.maxzoom=s),this._updateLayer(c)):this.fire(new l.j(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,s={}){this._checkLoaded();const c=this.getLayer(t);if(c){if(!l.aG(c.filter,n))return n==null?(c.filter=void 0,void this._updateLayer(c)):void(this._validate(l.y.filter,`layers.${c.id}.filter`,n,null,s)||(c.filter=l.aD(n),this._updateLayer(c)))}else this.fire(new l.j(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return l.aD(this.getLayer(t).filter)}setLayoutProperty(t,n,s,c={}){this._checkLoaded();const p=this.getLayer(t);p?l.aG(p.getLayoutProperty(n),s)||(p.setLayoutProperty(n,s,c),this._updateLayer(p)):this.fire(new l.j(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const s=this.getLayer(t);if(s)return s.getLayoutProperty(n);this.fire(new l.j(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,s,c={}){this._checkLoaded();const p=this.getLayer(t);p?l.aG(p.getPaintProperty(n),s)||(p.setPaintProperty(n,s,c)&&this._updateLayer(p),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new l.j(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const s=t.source,c=t.sourceLayer,p=this.sourceCaches[s];if(p===void 0)return void this.fire(new l.j(new Error(`The source '${s}' does not exist in the map's style.`)));const g=p.getSource().type;g==="geojson"&&c?this.fire(new l.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):g!=="vector"||c?(t.id===void 0&&this.fire(new l.j(new Error("The feature id parameter must be provided."))),p.setFeatureState(c,t.id,n)):this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const s=t.source,c=this.sourceCaches[s];if(c===void 0)return void this.fire(new l.j(new Error(`The source '${s}' does not exist in the map's style.`)));const p=c.getSource().type,g=p==="vector"?t.sourceLayer:void 0;p!=="vector"||g?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new l.j(new Error("A feature id is required to remove its specific state property."))):c.removeFeatureState(g,t.id,n):this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,s=t.sourceLayer,c=this.sourceCaches[n];if(c!==void 0)return c.getSource().type!=="vector"||s?(t.id===void 0&&this.fire(new l.j(new Error("The feature id parameter must be provided."))),c.getFeatureState(s,t.id)):void this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new l.j(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return l.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=l.aH(this.sourceCaches,p=>p.serialize()),n=this._serializeByIds(this._order),s=this.map.getTerrain()||void 0,c=this.stylesheet;return l.aI({version:c.version,name:c.name,metadata:c.metadata,light:c.light,center:c.center,zoom:c.zoom,bearing:c.bearing,pitch:c.pitch,sprite:c.sprite,glyphs:c.glyphs,transition:c.transition,sources:t,layers:n,terrain:s},p=>p!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const n=g=>this._layers[g].type==="fill-extrusion",s={},c=[];for(let g=this._order.length-1;g>=0;g--){const y=this._order[g];if(n(y)){s[y]=g;for(const x of t){const S=x[y];if(S)for(const I of S)c.push(I)}}}c.sort((g,y)=>y.intersectionZ-g.intersectionZ);const p=[];for(let g=this._order.length-1;g>=0;g--){const y=this._order[g];if(n(y))for(let x=c.length-1;x>=0;x--){const S=c[x].feature;if(s[S.layer.id]<g)break;p.push(S),c.pop()}else for(const x of t){const S=x[y];if(S)for(const I of S)p.push(I.feature)}}return p}queryRenderedFeatures(t,n,s){n&&n.filter&&this._validate(l.y.filter,"queryRenderedFeatures.filter",n.filter,null,n);const c={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new l.j(new Error("parameters.layers must be an Array."))),[];for(const y of n.layers){const x=this._layers[y];if(!x)return this.fire(new l.j(new Error(`The layer '${y}' does not exist in the map's style and cannot be queried for features.`))),[];c[x.source]=!0}}const p=[];n.availableImages=this._availableImages;const g=this._serializedAllLayers();for(const y in this.sourceCaches)n.layers&&!c[y]||p.push(Dn(this.sourceCaches[y],this._layers,g,t,n,s));return this.placement&&p.push(function(y,x,S,I,A,L,U){const N={},$=L.queryRenderedSymbols(I),F=[];for(const Q of Object.keys($).map(Number))F.push(U[Q]);F.sort(xn);for(const Q of F){const se=Q.featureIndex.lookupSymbolFeatures($[Q.bucketInstanceId],x,Q.bucketIndex,Q.sourceLayerIndex,A.filter,A.layers,A.availableImages,y);for(const Z in se){const ee=N[Z]=N[Z]||[],le=se[Z];le.sort((ce,me)=>{const ve=Q.featureSortOrder;if(ve){const _e=ve.indexOf(ce.featureIndex);return ve.indexOf(me.featureIndex)-_e}return me.featureIndex-ce.featureIndex});for(const ce of le)ee.push(ce)}}for(const Q in N)N[Q].forEach(se=>{const Z=se.feature,ee=S[y[Q].source].getFeatureState(Z.layer["source-layer"],Z.id);Z.source=Z.layer.source,Z.layer["source-layer"]&&(Z.sourceLayer=Z.layer["source-layer"]),Z.state=ee});return N}(this._layers,g,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(p)}querySourceFeatures(t,n){n&&n.filter&&this._validate(l.y.filter,"querySourceFeatures.filter",n.filter,null,n);const s=this.sourceCaches[t];return s?function(c,p){const g=c.getRenderableIds().map(S=>c.getTileByID(S)),y=[],x={};for(let S=0;S<g.length;S++){const I=g[S],A=I.tileID.canonical.key;x[A]||(x[A]=!0,I.querySourceFeatures(y,p))}return y}(s,n):[]}addSourceType(t,n,s){return tn(t)?s(new Error(`A source type called "${t}" already exists.`)):(((c,p)=>{Da[c]=p})(t,n),n.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:n.workerSourceURL},s):s(null,null))}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const s=this.light.getLight();let c=!1;for(const g in t)if(!l.aG(t[g],s[g])){c=!0;break}if(!c)return;const p={now:l.h.now(),transition:l.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(p)}_validate(t,n,s,c,p={}){return(!p||p.validate!==!1)&&Oi(this,t.call(l.y,l.e({key:n,style:this.serialize(),value:s,styleSpec:l.v},c)))}_remove(t=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),l.aJ.off("pluginStateChange",this._rtlTextPluginCallback);for(const n in this._layers)this._layers[n].setEventedParent(null);for(const n in this.sourceCaches){const s=this.sourceCaches[n];s.setEventedParent(null),s.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove(t)}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const n in this.sourceCaches)this.sourceCaches[n].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,n,s,c,p=!1){let g=!1,y=!1;const x={};for(const S of this._order){const I=this._layers[S];if(I.type!=="symbol")continue;if(!x[I.source]){const L=this.sourceCaches[I.source];x[I.source]=L.getRenderableIds(!0).map(U=>L.getTileByID(U)).sort((U,N)=>N.tileID.overscaledZ-U.tileID.overscaledZ||(U.tileID.isLessThan(N.tileID)?-1:1))}const A=this.crossTileSymbolIndex.addLayer(I,x[I.source],t.center.lng);g=g||A}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((p=p||this._layerOrderChanged||s===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(l.h.now(),t.zoom))&&(this.pauseablePlacement=new oa(t,this.map.terrain,this._order,p,n,s,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(l.h.now()),y=!0),g&&this.pauseablePlacement.placement.setStale()),y||g)for(const S of this._order){const I=this._layers[S];I.type==="symbol"&&this.placement.updateLayerOpacities(I,x[I.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(l.h.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,n,s){this.imageManager.getImages(n.icons,s),this._updateTilesForChangedImages();const c=this.sourceCaches[n.source];c&&c.setDependencies(n.tileID.key,n.type,n.icons)}getGlyphs(t,n,s){this.glyphManager.getGlyphs(n.stacks,s);const c=this.sourceCaches[n.source];c&&c.setDependencies(n.tileID.key,n.type,[""])}getResource(t,n,s){return l.m(n,s)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,n={}){this._checkLoaded(),t&&this._validate(l.y.glyphs,"glyphs",t,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,n,s={},c){this._checkLoaded();const p=[{id:t,url:n}],g=[...Ke(this.stylesheet.sprite),...p];this._validate(l.y.sprite,"sprite",g,null,s)||(this.stylesheet.sprite=g,this._loadSprite(p,!0,c))}removeSprite(t){this._checkLoaded();const n=Ke(this.stylesheet.sprite);if(n.find(s=>s.id===t)){if(this._spritesImagesIds[t])for(const s of this._spritesImagesIds[t])this.imageManager.removeImage(s),this._changedImages[s]=!0;n.splice(n.findIndex(s=>s.id===t),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}else this.fire(new l.j(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return Ke(this.stylesheet.sprite)}setSprite(t,n={},s){this._checkLoaded(),t&&this._validate(l.y.sprite,"sprite",t,null,n)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,s):(this._unloadSprite(),s&&s(null)))}}Mi.registerForPluginStateChange=l.aK;var cs=l.Q([{name:"a_pos",type:"Int16",components:2}]),ca="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";const ti={prelude:Et(`#ifdef GL_ES
|
|
1
|
+
(function(Ee,Ws){typeof exports=="object"&&typeof module<"u"?Ws(exports):typeof define=="function"&&define.amd?define(["exports"],Ws):(Ee=typeof globalThis<"u"?globalThis:Ee||self,Ws(Ee.maptilersdk={}))})(this,function(Ee){"use strict";var Ws=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Iu(y){return y&&y.__esModule&&Object.prototype.hasOwnProperty.call(y,"default")?y.default:y}var Au={exports:{}};(function(y,d){(function(x,A){y.exports=A()})(Ws,function(){var x,A,D;function V(l,oe){if(!x)x=oe;else if(!A)A=oe;else{var q="var sharedChunk = {}; ("+x+")(sharedChunk); ("+A+")(sharedChunk);",be={};x(be),D=oe(be),typeof window<"u"&&(D.workerUrl=window.URL.createObjectURL(new Blob([q],{type:"text/javascript"})))}}V(["exports"],function(l){function oe(i,e,r,a){return new(r||(r=Promise))(function(o,u){function m(w){try{v(a.next(w))}catch(T){u(T)}}function f(w){try{v(a.throw(w))}catch(T){u(T)}}function v(w){var T;w.done?o(w.value):(T=w.value,T instanceof r?T:new r(function(E){E(T)})).then(m,f)}v((a=a.apply(i,e||[])).next())})}function q(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}typeof SuppressedError=="function"&&SuppressedError;var be=Te;function Te(i,e){this.x=i,this.y=e}Te.prototype={clone:function(){return new Te(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,r=i.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),r=Math.sin(i),a=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=a,this},_rotateAround:function(i,e){var r=Math.cos(i),a=Math.sin(i),o=e.y+a*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-a*(this.y-e.y),this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Te.convert=function(i){return i instanceof Te?i:Array.isArray(i)?new Te(i[0],i[1]):i};var de=q(be),et=lt;function lt(i,e,r,a){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(a-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=a}lt.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,a=0;a<8;a++){var o=this.sampleCurveX(r)-i;if(Math.abs(o)<e)return r;var u=this.sampleCurveDerivativeX(r);if(Math.abs(u)<1e-6)break;r-=o/u}var m=0,f=1;for(r=i,a=0;a<20&&(o=this.sampleCurveX(r),!(Math.abs(o-i)<e));a++)i>o?m=r:f=r,r=.5*(f-m)+m;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var Xe=q(et);let ft,tt;function St(){return ft==null&&(ft=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),ft}function Ct(){if(tt==null&&(tt=!1,St())){const e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let a=0;a<5*5;a++){const o=4*a;e.fillStyle=`rgb(${o},${o+1},${o+2})`,e.fillRect(a%5,Math.floor(a/5),1,1)}const r=e.getImageData(0,0,5,5).data;for(let a=0;a<5*5*4;a++)if(a%4!=3&&r[a]!==a){tt=!0;break}}}return tt||!1}function Ue(i,e,r,a){const o=new Xe(i,e,r,a);return function(u){return o.solve(u)}}const gt=Ue(.25,.1,.25,1);function Qe(i,e,r){return Math.min(r,Math.max(e,i))}function rt(i,e,r){const a=r-e,o=((i-e)%a+a)%a+e;return o===e?r:o}function Ve(i,...e){for(const r of e)for(const a in r)i[a]=r[a];return i}let pt=1;function Ge(i,e,r){const a={};for(const o in i)a[o]=e.call(r||this,i[o],o,i);return a}function Rt(i,e,r){const a={};for(const o in i)e.call(r||this,i[o],o,i)&&(a[o]=i[o]);return a}function it(i){return Array.isArray(i)?i.map(it):typeof i=="object"&&i?Ge(i,it):i}const ct={};function st(i){ct[i]||(typeof console<"u"&&console.warn(i),ct[i]=!0)}function yt(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function Ot(i){let e=0;for(let r,a,o=0,u=i.length,m=u-1;o<u;m=o++)r=i[o],a=i[m],e+=(a.x-r.x)*(r.y+a.y);return e}function Vt(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}let ai=null;function Mi(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const vr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function gi(i,e,r,a,o){return oe(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const u=new VideoFrame(i,{timestamp:0});try{const m=u?.format;if(!m||!m.startsWith("BGR")&&!m.startsWith("RGB"))throw new Error(`Unrecognized format ${m}`);const f=m.startsWith("BGR"),v=new Uint8ClampedArray(a*o*4);if(yield u.copyTo(v,function(w,T,E,M,z){const R=4*Math.max(-T,0),O=(Math.max(0,E)-E)*M*4+R,Z=4*M,K=Math.max(0,T),re=Math.max(0,E);return{rect:{x:K,y:re,width:Math.min(w.width,T+M)-K,height:Math.min(w.height,E+z)-re},layout:[{offset:O,stride:Z}]}}(i,e,r,a,o)),f)for(let w=0;w<v.length;w+=4){const T=v[w];v[w]=v[w+2],v[w+2]=T}return v}finally{u.close()}})}let Fi,Bt,Ei,jr;const rn={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(i){const e=requestAnimationFrame(i);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(i,e=0){return this.getImageCanvasContext(i).getImageData(-e,-e,i.width+2*e,i.height+2*e)},getImageCanvasContext(i){const e=window.document.createElement("canvas"),r=e.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("failed to create canvas 2d context");return e.width=i.width,e.height=i.height,r.drawImage(i,0,0,i.width,i.height),r},resolveURL:i=>(Ei||(Ei=document.createElement("a")),Ei.href=i,Ei.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(jr==null&&(jr=matchMedia("(prefers-reduced-motion: reduce)")),jr.matches)}},na={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};class bn extends Error{constructor(e,r,a,o){super(`AJAXError: ${r} (${e}): ${a}`),this.status=e,this.statusText=r,this.url=a,this.body=o}}const Dr=Vt()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,xr=i=>na.REGISTERED_PROTOCOLS[i.substring(0,i.indexOf("://"))];function Da(i,e){const r=new AbortController,a=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,cache:i.cache,referrer:Dr(),signal:r.signal});let o=!1,u=!1;return i.type==="json"&&a.headers.set("Accept","application/json"),u||fetch(a).then(m=>m.ok?(f=>{(i.type==="arrayBuffer"||i.type==="image"?f.arrayBuffer():i.type==="json"?f.json():f.text()).then(v=>{u||(o=!0,e(null,v,f.headers.get("Cache-Control"),f.headers.get("Expires")))}).catch(v=>{u||e(new Error(v.message))})})(m):m.blob().then(f=>e(new bn(m.status,m.statusText,i.url,f)))).catch(m=>{m.code!==20&&e(new Error(m.message))}),{cancel:()=>{u=!0,o||r.abort()}}}const wn=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(Vt()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!Vt())return(xr(i.url)||Da)(i,e)}if(!(/^file:/.test(r=i.url)||/^file:/.test(Dr())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return Da(i,e);if(Vt()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e,void 0,!0)}var r;return function(a,o){const u=new XMLHttpRequest;u.open(a.method||"GET",a.url,!0),a.type!=="arrayBuffer"&&a.type!=="image"||(u.responseType="arraybuffer");for(const m in a.headers)u.setRequestHeader(m,a.headers[m]);return a.type==="json"&&(u.responseType="text",u.setRequestHeader("Accept","application/json")),u.withCredentials=a.credentials==="include",u.onerror=()=>{o(new Error(u.statusText))},u.onload=()=>{if((u.status>=200&&u.status<300||u.status===0)&&u.response!==null){let m=u.response;if(a.type==="json")try{m=JSON.parse(u.response)}catch(f){return o(f)}o(null,m,u.getResponseHeader("Cache-Control"),u.getResponseHeader("Expires"))}else{const m=new Blob([u.response],{type:u.getResponseHeader("Content-Type")});o(new bn(u.status,u.statusText,a.url,m))}},u.send(a.body),{cancel:()=>u.abort()}}(i,e)},Ra=function(i,e){return wn(Ve(i,{type:"arrayBuffer"}),e)};function nn(i){if(!i||i.indexOf("://")<=0||i.indexOf("data:image/")===0||i.indexOf("blob:")===0)return!0;const e=new URL(i),r=window.location;return e.protocol===r.protocol&&e.host===r.host}function aa(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function Fn(i,e,r){if(r&&r[i]){const a=r[i].indexOf(e);a!==-1&&r[i].splice(a,1)}}class Sn{constructor(e,r={}){Ve(this,r),this.type=e}}class Tn extends Sn{constructor(e,r={}){super("error",Ve({error:e},r))}}class On{on(e,r){return this._listeners=this._listeners||{},aa(e,r,this._listeners),this}off(e,r){return Fn(e,r,this._listeners),Fn(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},aa(e,r,this._oneTimeListeners),this):new Promise(a=>this.once(e,a))}fire(e,r){typeof e=="string"&&(e=new Sn(e,r||{}));const a=e.type;if(this.listens(a)){e.target=this;const o=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(const f of o)f.call(this,e);const u=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(const f of u)Fn(a,f,this._oneTimeListeners),f.call(this,e);const m=this._eventedParent;m&&(Ve(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),m.fire(e))}else e instanceof Tn&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}}var ue={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const Qi=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function br(i,e){const r={};for(const a in i)a!=="ref"&&(r[a]=i[a]);return Qi.forEach(a=>{a in e&&(r[a]=e[a])}),r}function Zt(i,e){if(Array.isArray(i)){if(!Array.isArray(e)||i.length!==e.length)return!1;for(let r=0;r<i.length;r++)if(!Zt(i[r],e[r]))return!1;return!0}if(typeof i=="object"&&i!==null&&e!==null){if(typeof e!="object"||Object.keys(i).length!==Object.keys(e).length)return!1;for(const r in i)if(!Zt(i[r],e[r]))return!1;return!0}return i===e}const Pt={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function Gr(i,e,r){r.push({command:Pt.addSource,args:[i,e[i]]})}function sa(i,e,r){e.push({command:Pt.removeSource,args:[i]}),r[i]=!0}function an(i,e,r,a){sa(i,r,a),Gr(i,e,r)}function ls(i,e,r){let a;for(a in i[r])if(Object.prototype.hasOwnProperty.call(i[r],a)&&a!=="data"&&!Zt(i[r][a],e[r][a]))return!1;for(a in e[r])if(Object.prototype.hasOwnProperty.call(e[r],a)&&a!=="data"&&!Zt(i[r][a],e[r][a]))return!1;return!0}function oa(i,e,r,a,o,u){let m;for(m in e=e||{},i=i||{})Object.prototype.hasOwnProperty.call(i,m)&&(Zt(i[m],e[m])||r.push({command:u,args:[a,m,e[m],o]}));for(m in e)Object.prototype.hasOwnProperty.call(e,m)&&!Object.prototype.hasOwnProperty.call(i,m)&&(Zt(i[m],e[m])||r.push({command:u,args:[a,m,e[m],o]}))}function In(i){return i.id}function Nn(i,e){return i[e.id]=e,i}class Ie{constructor(e,r,a,o){this.message=(e?`${e}: `:"")+a,o&&(this.identifier=o),r!=null&&r.__line__&&(this.line=r.__line__)}}function qr(i,...e){for(const r of e)for(const a in r)i[a]=r[a];return i}class si extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}class Un{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[a,o]of r)this.bindings[a]=o}concat(e){return new Un(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const sn={kind:"null"},Ce={kind:"number"},dt={kind:"string"},nt={kind:"boolean"},Zi={kind:"color"},Zr={kind:"object"},ot={kind:"value"},on={kind:"collator"},$={kind:"formatted"},P={kind:"padding"},k={kind:"resolvedImage"},B={kind:"variableAnchorOffsetCollection"};function G(i,e){return{kind:"array",itemType:i,N:e}}function H(i){if(i.kind==="array"){const e=H(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const ne=[sn,Ce,dt,nt,Zi,$,Zr,G(ot),P,k,B];function J(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!J(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const r of ne)if(!J(r,e))return null}}return`Expected ${H(i)} but found ${H(e)} instead.`}function X(i,e){return e.some(r=>r.kind===i.kind)}function ie(i,e){return e.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}function pe(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const me=.96422,ye=.82521,qe=4/29,Je=6/29,Be=3*Je*Je,He=Je*Je*Je,at=Math.PI/180,Ft=180/Math.PI;function $t(i){return(i%=360)<0&&(i+=360),i}function Et([i,e,r,a]){let o,u;const m=Oi((.2225045*(i=At(i))+.7168786*(e=At(e))+.0606169*(r=At(r)))/1);i===e&&e===r?o=u=m:(o=Oi((.4360747*i+.3850649*e+.1430804*r)/me),u=Oi((.0139322*i+.0971045*e+.7141733*r)/ye));const f=116*m-16;return[f<0?0:f,500*(o-m),200*(m-u),a]}function At(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Oi(i){return i>He?Math.pow(i,1/3):i/Be+qe}function Ht([i,e,r,a]){let o=(i+16)/116,u=isNaN(e)?o:o+e/500,m=isNaN(r)?o:o-r/200;return o=1*ki(o),u=me*ki(u),m=ye*ki(m),[yi(3.1338561*u-1.6168667*o-.4906146*m),yi(-.9787684*u+1.9161415*o+.033454*m),yi(.0719453*u-.2289914*o+1.4052427*m),a]}function yi(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function ki(i){return i>Je?i*i*i:Be*(i-qe)}function wr(i){return parseInt(i.padEnd(2,i),16)/255}function Cl(i,e){return la(e?i/100:i,0,1)}function la(i,e,r){return Math.min(Math.max(e,i),r)}function ca(i){return!i.some(Number.isNaN)}const _h={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class Nt{constructor(e,r,a,o=1,u=!0){this.r=e,this.g=r,this.b=a,this.a=o,u||(this.r*=o,this.g*=o,this.b*=o,o||this.overwriteGetter("rgb",[e,r,a,o]))}static parse(e){if(e instanceof Nt)return e;if(typeof e!="string")return;const r=function(a){if((a=a.toLowerCase().trim())==="transparent")return[0,0,0,0];const o=_h[a];if(o){const[m,f,v]=o;return[m/255,f/255,v/255,1]}if(a.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(a)){const m=a.length<6?1:2;let f=1;return[wr(a.slice(f,f+=m)),wr(a.slice(f,f+=m)),wr(a.slice(f,f+=m)),wr(a.slice(f,f+m)||"ff")]}if(a.startsWith("rgb")){const m=a.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(m){const[f,v,w,T,E,M,z,R,O,Z,K,re]=m,Y=[T||" ",z||" ",Z].join("");if(Y===" "||Y===" /"||Y===",,"||Y===",,,"){const ae=[w,M,O].join(""),le=ae==="%%%"?100:ae===""?255:0;if(le){const ge=[la(+v/le,0,1),la(+E/le,0,1),la(+R/le,0,1),K?Cl(+K,re):1];if(ca(ge))return ge}}return}}const u=a.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(u){const[m,f,v,w,T,E,M,z,R]=u,O=[v||" ",T||" ",M].join("");if(O===" "||O===" /"||O===",,"||O===",,,"){const Z=[+f,la(+w,0,100),la(+E,0,100),z?Cl(+z,R):1];if(ca(Z))return function([K,re,Y,ae]){function le(ge){const ze=(ge+K/30)%12,Oe=re*Math.min(Y,1-Y);return Y-Oe*Math.max(-1,Math.min(ze-3,9-ze,1))}return K=$t(K),re/=100,Y/=100,[le(0),le(8),le(4),ae]}(Z)}}}(e);return r?new Nt(...r,!1):void 0}get rgb(){const{r:e,g:r,b:a,a:o}=this,u=o||1/0;return this.overwriteGetter("rgb",[e/u,r/u,a/u,o])}get hcl(){return this.overwriteGetter("hcl",function(e){const[r,a,o,u]=Et(e),m=Math.sqrt(a*a+o*o);return[Math.round(1e4*m)?$t(Math.atan2(o,a)*Ft):NaN,m,r,u]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Et(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){const[e,r,a,o]=this.rgb;return`rgba(${[e,r,a].map(u=>Math.round(255*u)).join(",")},${o})`}}Nt.black=new Nt(0,0,0,1),Nt.white=new Nt(1,1,1,1),Nt.transparent=new Nt(0,0,0,0),Nt.red=new Nt(1,0,0,1);class to{constructor(e,r,a){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=a,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class cs{constructor(e,r,a,o,u){this.text=e,this.image=r,this.scale=a,this.fontStack=o,this.textColor=u}}class Ni{constructor(e){this.sections=e}static fromString(e){return new Ni([new cs(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof Ni?e:Ni.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class lr{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof lr)return e;if(typeof e=="number")return new lr([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new lr(e)}}toString(){return JSON.stringify(this.values)}}const vh=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Sr{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Sr)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let r=0;r<e.length;r+=2){const a=e[r],o=e[r+1];if(typeof a!="string"||!vh.has(a)||!Array.isArray(o)||o.length!==2||typeof o[0]!="number"||typeof o[1]!="number")return}return new Sr(e)}}toString(){return JSON.stringify(this.values)}}class Li{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Li({name:e,available:!1}):null}}function hs(i,e,r,a){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?a===void 0||typeof a=="number"&&a>=0&&a<=1?null:`Invalid rgba value [${[i,e,r,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof a=="number"?[i,e,r,a]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ha(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof Nt||i instanceof to||i instanceof Ni||i instanceof lr||i instanceof Sr||i instanceof Li)return!0;if(Array.isArray(i)){for(const e of i)if(!ha(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!ha(i[e]))return!1;return!0}return!1}function ti(i){if(i===null)return sn;if(typeof i=="string")return dt;if(typeof i=="boolean")return nt;if(typeof i=="number")return Ce;if(i instanceof Nt)return Zi;if(i instanceof to)return on;if(i instanceof Ni)return $;if(i instanceof lr)return P;if(i instanceof Sr)return B;if(i instanceof Li)return k;if(Array.isArray(i)){const e=i.length;let r;for(const a of i){const o=ti(a);if(r){if(r===o)continue;r=ot;break}r=o}return G(r||ot,e)}return Zr}function kt(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof Nt||i instanceof Ni||i instanceof lr||i instanceof Sr||i instanceof Li?i.toString():JSON.stringify(i)}class Vn{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ha(e[1]))return r.error("invalid value");const a=e[1];let o=ti(a);const u=r.expectedType;return o.kind!=="array"||o.N!==0||!u||u.kind!=="array"||typeof u.N=="number"&&u.N!==0||(o=u),new Vn(o,a)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class oi{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const us={string:dt,number:Ce,boolean:nt,object:Zr};class Tr{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let a,o=1;const u=e[0];if(u==="array"){let f,v;if(e.length>2){const w=e[1];if(typeof w!="string"||!(w in us)||w==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);f=us[w],o++}else f=ot;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);v=e[2],o++}a=G(f,v)}else{if(!us[u])throw new Error(`Types doesn't contain name = ${u}`);a=us[u]}const m=[];for(;o<e.length;o++){const f=r.parse(e[o],o,ot);if(!f)return null;m.push(f)}return new Tr(a,m)}evaluate(e){for(let r=0;r<this.args.length;r++){const a=this.args[r].evaluate(e);if(!J(this.type,ti(a)))return a;if(r===this.args.length-1)throw new oi(`Expected value to be of type ${H(this.type)}, but found ${H(ti(a))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const io={"to-boolean":nt,"to-color":Zi,"to-number":Ce,"to-string":dt};class An{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const a=e[0];if(!io[a])throw new Error(`Can't parse ${a} as it is not part of the known types`);if((a==="to-boolean"||a==="to-string")&&e.length!==2)return r.error("Expected one argument.");const o=io[a],u=[];for(let m=1;m<e.length;m++){const f=r.parse(e[m],m,ot);if(!f)return null;u.push(f)}return new An(o,u)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let r,a;for(const o of this.args){if(r=o.evaluate(e),a=null,r instanceof Nt)return r;if(typeof r=="string"){const u=e.parseColor(r);if(u)return u}else if(Array.isArray(r)&&(a=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:hs(r[0],r[1],r[2],r[3]),!a))return new Nt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new oi(a||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(const a of this.args){r=a.evaluate(e);const o=lr.parse(r);if(o)return o}throw new oi(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(const a of this.args){r=a.evaluate(e);const o=Sr.parse(r);if(o)return o}throw new oi(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(const a of this.args){if(r=a.evaluate(e),r===null)return 0;const o=Number(r);if(!isNaN(o))return o}throw new oi(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return Ni.fromString(kt(this.args[0].evaluate(e)));case"resolvedImage":return Li.fromString(kt(this.args[0].evaluate(e)));default:return kt(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const El=["Unknown","Point","LineString","Polygon"];class ro{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?El[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let r=this._parseColorCache[e];return r||(r=this._parseColorCache[e]=Nt.parse(e)),r}}class ps{constructor(e,r,a=[],o,u=new Un,m=[]){this.registry=e,this.path=a,this.key=a.map(f=>`[${f}]`).join(""),this.scope=u,this.errors=m,this.expectedType=o,this._isConstant=r}parse(e,r,a,o,u={}){return r?this.concat(r,a,o)._parse(e,u):this._parse(e,u)}_parse(e,r){function a(o,u,m){return m==="assert"?new Tr(u,[o]):m==="coerce"?new An(u,[o]):o}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const o=e[0];if(typeof o!="string")return this.error(`Expression name must be a string, but found ${typeof o} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const u=this.registry[o];if(u){let m=u.parse(e,this);if(!m)return null;if(this.expectedType){const f=this.expectedType,v=m.type;if(f.kind!=="string"&&f.kind!=="number"&&f.kind!=="boolean"&&f.kind!=="object"&&f.kind!=="array"||v.kind!=="value")if(f.kind!=="color"&&f.kind!=="formatted"&&f.kind!=="resolvedImage"||v.kind!=="value"&&v.kind!=="string")if(f.kind!=="padding"||v.kind!=="value"&&v.kind!=="number"&&v.kind!=="array")if(f.kind!=="variableAnchorOffsetCollection"||v.kind!=="value"&&v.kind!=="array"){if(this.checkSubtype(f,v))return null}else m=a(m,f,r.typeAnnotation||"coerce");else m=a(m,f,r.typeAnnotation||"coerce");else m=a(m,f,r.typeAnnotation||"coerce");else m=a(m,f,r.typeAnnotation||"assert")}if(!(m instanceof Vn)&&m.type.kind!=="resolvedImage"&&this._isConstant(m)){const f=new ro;try{m=new Vn(m.type,m.evaluate(f))}catch(v){return this.error(v.message),null}}return m}return this.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,r,a){const o=typeof e=="number"?this.path.concat(e):this.path,u=a?this.scope.concat(a):this.scope;return new ps(this.registry,this._isConstant,o,r||null,u,this.errors)}error(e,...r){const a=`${this.key}${r.map(o=>`[${o}]`).join("")}`;this.errors.push(new si(a,e))}checkSubtype(e,r){const a=J(e,r);return a&&this.error(a),a}}class ds{constructor(e,r,a){this.type=on,this.locale=a,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const a=e[1];if(typeof a!="object"||Array.isArray(a))return r.error("Collator options argument must be an object.");const o=r.parse(a["case-sensitive"]!==void 0&&a["case-sensitive"],1,nt);if(!o)return null;const u=r.parse(a["diacritic-sensitive"]!==void 0&&a["diacritic-sensitive"],1,nt);if(!u)return null;let m=null;return a.locale&&(m=r.parse(a.locale,1,dt),!m)?null:new ds(o,u,m)}evaluate(e){return new to(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}const Cn=8192;function no(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function Ba(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function Pl(i,e){const r=(180+i[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,o=Math.pow(2,e.z);return[Math.round(r*o*Cn),Math.round(a*o*Cn)]}function xh(i,e,r){const a=i[0]-e[0],o=i[1]-e[1],u=i[0]-r[0],m=i[1]-r[1];return a*m-u*o==0&&a*u<=0&&o*m<=0}function ao(i,e){let r=!1;for(let m=0,f=e.length;m<f;m++){const v=e[m];for(let w=0,T=v.length;w<T-1;w++){if(xh(i,v[w],v[w+1]))return!1;(o=v[w])[1]>(a=i)[1]!=(u=v[w+1])[1]>a[1]&&a[0]<(u[0]-o[0])*(a[1]-o[1])/(u[1]-o[1])+o[0]&&(r=!r)}}var a,o,u;return r}function so(i,e){for(let r=0;r<e.length;r++)if(ao(i,e[r]))return!0;return!1}function Ml(i,e,r,a){const o=a[0]-r[0],u=a[1]-r[1],m=(i[0]-r[0])*u-o*(i[1]-r[1]),f=(e[0]-r[0])*u-o*(e[1]-r[1]);return m>0&&f<0||m<0&&f>0}function bh(i,e,r){for(const w of r)for(let T=0;T<w.length-1;++T)if((f=[(m=w[T+1])[0]-(u=w[T])[0],m[1]-u[1]])[0]*(v=[(o=e)[0]-(a=i)[0],o[1]-a[1]])[1]-f[1]*v[0]!=0&&Ml(a,o,u,m)&&Ml(u,m,a,o))return!0;var a,o,u,m,f,v;return!1}function kl(i,e){for(let r=0;r<i.length;++r)if(!ao(i[r],e))return!1;for(let r=0;r<i.length-1;++r)if(bh(i[r],i[r+1],e))return!1;return!0}function Ll(i,e){for(let r=0;r<e.length;r++)if(kl(i,e[r]))return!0;return!1}function ms(i,e,r){const a=[];for(let o=0;o<i.length;o++){const u=[];for(let m=0;m<i[o].length;m++){const f=Pl(i[o][m],r);no(e,f),u.push(f)}a.push(u)}return a}function zl(i,e,r){const a=[];for(let o=0;o<i.length;o++){const u=ms(i[o],e,r);a.push(u)}return a}function Dl(i,e,r,a){if(i[0]<r[0]||i[0]>r[2]){const o=.5*a;let u=i[0]-r[0]>o?-a:r[0]-i[0]>o?a:0;u===0&&(u=i[0]-r[2]>o?-a:r[2]-i[0]>o?a:0),i[0]+=u}no(e,i)}function oo(i,e,r,a){const o=Math.pow(2,a.z)*Cn,u=[a.x*Cn,a.y*Cn],m=[];for(const f of i)for(const v of f){const w=[v.x+u[0],v.y+u[1]];Dl(w,e,r,o),m.push(w)}return m}function lo(i,e,r,a){const o=Math.pow(2,a.z)*Cn,u=[a.x*Cn,a.y*Cn],m=[];for(const v of i){const w=[];for(const T of v){const E=[T.x+u[0],T.y+u[1]];no(e,E),w.push(E)}m.push(w)}if(e[2]-e[0]<=o/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const v of m)for(const w of v)Dl(w,e,r,o)}var f;return m}class $n{constructor(e,r){this.type=nt,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ha(e[1])){const a=e[1];if(a.type==="FeatureCollection")for(let o=0;o<a.features.length;++o){const u=a.features[o].geometry.type;if(u==="Polygon"||u==="MultiPolygon")return new $n(a,a.features[o].geometry)}else if(a.type==="Feature"){const o=a.geometry.type;if(o==="Polygon"||o==="MultiPolygon")return new $n(a,a.geometry)}else if(a.type==="Polygon"||a.type==="MultiPolygon")return new $n(a,a)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(r,a){const o=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],m=r.canonicalID();if(a.type==="Polygon"){const f=ms(a.coordinates,u,m),v=oo(r.geometry(),o,u,m);if(!Ba(o,u))return!1;for(const w of v)if(!ao(w,f))return!1}if(a.type==="MultiPolygon"){const f=zl(a.coordinates,u,m),v=oo(r.geometry(),o,u,m);if(!Ba(o,u))return!1;for(const w of v)if(!so(w,f))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,a){const o=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],m=r.canonicalID();if(a.type==="Polygon"){const f=ms(a.coordinates,u,m),v=lo(r.geometry(),o,u,m);if(!Ba(o,u))return!1;for(const w of v)if(!kl(w,f))return!1}if(a.type==="MultiPolygon"){const f=zl(a.coordinates,u,m),v=lo(r.geometry(),o,u,m);if(!Ba(o,u))return!1;for(const w of v)if(!Ll(w,f))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class fs{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const a=e[1];return r.scope.has(a)?new fs(a,r.scope.get(a)):r.error(`Unknown variable "${a}". Make sure "${a}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Ir{constructor(e,r,a,o){this.name=e,this.type=r,this._evaluate=a,this.args=o}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){const a=e[0],o=Ir.definitions[a];if(!o)return r.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0);const u=Array.isArray(o)?o[0]:o.type,m=Array.isArray(o)?[[o[1],o[2]]]:o.overloads,f=m.filter(([w])=>!Array.isArray(w)||w.length===e.length-1);let v=null;for(const[w,T]of f){v=new ps(r.registry,gs,r.path,null,r.scope);const E=[];let M=!1;for(let z=1;z<e.length;z++){const R=e[z],O=Array.isArray(w)?w[z-1]:w.type,Z=v.parse(R,1+E.length,O);if(!Z){M=!0;break}E.push(Z)}if(!M)if(Array.isArray(w)&&w.length!==E.length)v.error(`Expected ${w.length} arguments, but found ${E.length} instead.`);else{for(let z=0;z<E.length;z++){const R=Array.isArray(w)?w[z]:w.type,O=E[z];v.concat(z+1).checkSubtype(R,O.type)}if(v.errors.length===0)return new Ir(a,u,T,E)}}if(f.length===1)r.errors.push(...v.errors);else{const w=(f.length?f:m).map(([E])=>{return M=E,Array.isArray(M)?`(${M.map(H).join(", ")})`:`(${H(M.type)}...)`;var M}).join(" | "),T=[];for(let E=1;E<e.length;E++){const M=r.parse(e[E],1+T.length);if(!M)return null;T.push(H(M.type))}r.error(`Expected arguments of type ${w}, but found (${T.join(", ")}) instead.`)}return null}static register(e,r){Ir.definitions=r;for(const a in r)e[a]=Ir}}function gs(i){if(i instanceof fs)return gs(i.boundExpression);if(i instanceof Ir&&i.name==="error"||i instanceof ds||i instanceof $n)return!1;const e=i instanceof An||i instanceof Tr;let r=!0;return i.eachChild(a=>{r=e?r&&gs(a):r&&a instanceof Vn}),!!r&&ys(i)&&_s(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function ys(i){if(i instanceof Ir&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof $n)return!1;let e=!0;return i.eachChild(r=>{e&&!ys(r)&&(e=!1)}),e}function Fa(i){if(i instanceof Ir&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!Fa(r)&&(e=!1)}),e}function _s(i,e){if(i instanceof Ir&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(a=>{r&&!_s(a,e)&&(r=!1)}),r}function ua(i,e){const r=i.length-1;let a,o,u=0,m=r,f=0;for(;u<=m;)if(f=Math.floor((u+m)/2),a=i[f],o=i[f+1],a<=e){if(f===r||e<o)return f;u=f+1}else{if(!(a>e))throw new oi("Input is not a number.");m=f-1}return 0}class En{constructor(e,r,a){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[o,u]of a)this.labels.push(o),this.outputs.push(u)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");const a=r.parse(e[1],1,Ce);if(!a)return null;const o=[];let u=null;r.expectedType&&r.expectedType.kind!=="value"&&(u=r.expectedType);for(let m=1;m<e.length;m+=2){const f=m===1?-1/0:e[m],v=e[m+1],w=m,T=m+1;if(typeof f!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',w);if(o.length&&o[o.length-1][0]>=f)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',w);const E=r.parse(v,T,u);if(!E)return null;u=u||E.type,o.push([f,E])}return new En(u,a,o)}evaluate(e){const r=this.labels,a=this.outputs;if(r.length===1)return a[0].evaluate(e);const o=this.input.evaluate(e);if(o<=r[0])return a[0].evaluate(e);const u=r.length;return o>=r[u-1]?a[u-1].evaluate(e):a[ua(r,o)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Tt(i,e,r){return i+r*(e-i)}function vs(i,e,r){return i.map((a,o)=>Tt(a,e[o],r))}const cr={number:Tt,color:function(i,e,r,a="rgb"){switch(a){case"rgb":{const[o,u,m,f]=vs(i.rgb,e.rgb,r);return new Nt(o,u,m,f,!1)}case"hcl":{const[o,u,m,f]=i.hcl,[v,w,T,E]=e.hcl;let M,z;if(isNaN(o)||isNaN(v))isNaN(o)?isNaN(v)?M=NaN:(M=v,m!==1&&m!==0||(z=w)):(M=o,T!==1&&T!==0||(z=u));else{let re=v-o;v>o&&re>180?re-=360:v<o&&o-v>180&&(re+=360),M=o+r*re}const[R,O,Z,K]=function([re,Y,ae,le]){return re=isNaN(re)?0:re*at,Ht([ae,Math.cos(re)*Y,Math.sin(re)*Y,le])}([M,z??Tt(u,w,r),Tt(m,T,r),Tt(f,E,r)]);return new Nt(R,O,Z,K,!1)}case"lab":{const[o,u,m,f]=Ht(vs(i.lab,e.lab,r));return new Nt(o,u,m,f,!1)}}},array:vs,padding:function(i,e,r){return new lr(vs(i.values,e.values,r))},variableAnchorOffsetCollection:function(i,e,r){const a=i.values,o=e.values;if(a.length!==o.length)throw new oi(`Cannot interpolate values of different length. from: ${i.toString()}, to: ${e.toString()}`);const u=[];for(let m=0;m<a.length;m+=2){if(a[m]!==o[m])throw new oi(`Cannot interpolate values containing mismatched anchors. from[${m}]: ${a[m]}, to[${m}]: ${o[m]}`);u.push(a[m]);const[f,v]=a[m+1],[w,T]=o[m+1];u.push([Tt(f,w,r),Tt(v,T,r)])}return new Sr(u)}};class hr{constructor(e,r,a,o,u){this.type=e,this.operator=r,this.interpolation=a,this.input=o,this.labels=[],this.outputs=[];for(const[m,f]of u)this.labels.push(m),this.outputs.push(f)}static interpolationFactor(e,r,a,o){let u=0;if(e.name==="exponential")u=co(r,e.base,a,o);else if(e.name==="linear")u=co(r,1,a,o);else if(e.name==="cubic-bezier"){const m=e.controlPoints;u=new Xe(m[0],m[1],m[2],m[3]).solve(co(r,1,a,o))}return u}static parse(e,r){let[a,o,u,...m]=e;if(!Array.isArray(o)||o.length===0)return r.error("Expected an interpolation type expression.",1);if(o[0]==="linear")o={name:"linear"};else if(o[0]==="exponential"){const w=o[1];if(typeof w!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);o={name:"exponential",base:w}}else{if(o[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(o[0])}`,1,0);{const w=o.slice(1);if(w.length!==4||w.some(T=>typeof T!="number"||T<0||T>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);o={name:"cubic-bezier",controlPoints:w}}}if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(u=r.parse(u,2,Ce),!u)return null;const f=[];let v=null;a==="interpolate-hcl"||a==="interpolate-lab"?v=Zi:r.expectedType&&r.expectedType.kind!=="value"&&(v=r.expectedType);for(let w=0;w<m.length;w+=2){const T=m[w],E=m[w+1],M=w+3,z=w+4;if(typeof T!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',M);if(f.length&&f[f.length-1][0]>=T)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',M);const R=r.parse(E,z,v);if(!R)return null;v=v||R.type,f.push([T,R])}return pe(v,Ce)||pe(v,Zi)||pe(v,P)||pe(v,B)||pe(v,G(Ce))?new hr(v,a,o,u,f):r.error(`Type ${H(v)} is not interpolatable.`)}evaluate(e){const r=this.labels,a=this.outputs;if(r.length===1)return a[0].evaluate(e);const o=this.input.evaluate(e);if(o<=r[0])return a[0].evaluate(e);const u=r.length;if(o>=r[u-1])return a[u-1].evaluate(e);const m=ua(r,o),f=hr.interpolationFactor(this.interpolation,o,r[m],r[m+1]),v=a[m].evaluate(e),w=a[m+1].evaluate(e);switch(this.operator){case"interpolate":return cr[this.type.kind](v,w,f);case"interpolate-hcl":return cr.color(v,w,f,"hcl");case"interpolate-lab":return cr.color(v,w,f,"lab")}}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function co(i,e,r,a){const o=a-r,u=i-r;return o===0?0:e===1?u/o:(Math.pow(e,u)-1)/(Math.pow(e,o)-1)}class xs{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected at least one argument.");let a=null;const o=r.expectedType;o&&o.kind!=="value"&&(a=o);const u=[];for(const f of e.slice(1)){const v=r.parse(f,1+u.length,a,void 0,{typeAnnotation:"omit"});if(!v)return null;a=a||v.type,u.push(v)}if(!a)throw new Error("No output type");const m=o&&u.some(f=>J(o,f.type));return new xs(m?ot:a,u)}evaluate(e){let r,a=null,o=0;for(const u of this.args)if(o++,a=u.evaluate(e),a&&a instanceof Li&&!a.available&&(r||(r=a.name),a=null,o===this.args.length&&(a=r)),a!==null)break;return a}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class bs{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const a=[];for(let u=1;u<e.length-1;u+=2){const m=e[u];if(typeof m!="string")return r.error(`Expected string, but found ${typeof m} instead.`,u);if(/[^a-zA-Z0-9_]/.test(m))return r.error("Variable names must contain only alphanumeric characters or '_'.",u);const f=r.parse(e[u+1],u+1);if(!f)return null;a.push([m,f])}const o=r.parse(e[e.length-1],e.length-1,r.expectedType,a);return o?new bs(a,o):null}outputDefined(){return this.result.outputDefined()}}class ho{constructor(e,r,a){this.type=e,this.index=r,this.input=a}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const a=r.parse(e[1],1,Ce),o=r.parse(e[2],2,G(r.expectedType||ot));return a&&o?new ho(o.type.itemType,a,o):null}evaluate(e){const r=this.index.evaluate(e),a=this.input.evaluate(e);if(r<0)throw new oi(`Array index out of bounds: ${r} < 0.`);if(r>=a.length)throw new oi(`Array index out of bounds: ${r} > ${a.length-1}.`);if(r!==Math.floor(r))throw new oi(`Array index must be an integer, but found ${r} instead.`);return a[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class uo{constructor(e,r){this.type=nt,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const a=r.parse(e[1],1,ot),o=r.parse(e[2],2,ot);return a&&o?X(a.type,[nt,dt,Ce,sn,ot])?new uo(a,o):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${H(a.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),a=this.haystack.evaluate(e);if(!a)return!1;if(!ie(r,["boolean","string","number","null"]))throw new oi(`Expected first argument to be of type boolean, string, number or null, but found ${H(ti(r))} instead.`);if(!ie(a,["string","array"]))throw new oi(`Expected second argument to be of type array or string, but found ${H(ti(a))} instead.`);return a.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class ws{constructor(e,r,a){this.type=Ce,this.needle=e,this.haystack=r,this.fromIndex=a}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const a=r.parse(e[1],1,ot),o=r.parse(e[2],2,ot);if(!a||!o)return null;if(!X(a.type,[nt,dt,Ce,sn,ot]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${H(a.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,Ce);return u?new ws(a,o,u):null}return new ws(a,o)}evaluate(e){const r=this.needle.evaluate(e),a=this.haystack.evaluate(e);if(!ie(r,["boolean","string","number","null"]))throw new oi(`Expected first argument to be of type boolean, string, number or null, but found ${H(ti(r))} instead.`);if(!ie(a,["string","array"]))throw new oi(`Expected second argument to be of type array or string, but found ${H(ti(a))} instead.`);if(this.fromIndex){const o=this.fromIndex.evaluate(e);return a.indexOf(r,o)}return a.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class po{constructor(e,r,a,o,u,m){this.inputType=e,this.type=r,this.input=a,this.cases=o,this.outputs=u,this.otherwise=m}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let a,o;r.expectedType&&r.expectedType.kind!=="value"&&(o=r.expectedType);const u={},m=[];for(let w=2;w<e.length-1;w+=2){let T=e[w];const E=e[w+1];Array.isArray(T)||(T=[T]);const M=r.concat(w);if(T.length===0)return M.error("Expected at least one branch label.");for(const R of T){if(typeof R!="number"&&typeof R!="string")return M.error("Branch labels must be numbers or strings.");if(typeof R=="number"&&Math.abs(R)>Number.MAX_SAFE_INTEGER)return M.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof R=="number"&&Math.floor(R)!==R)return M.error("Numeric branch labels must be integer values.");if(a){if(M.checkSubtype(a,ti(R)))return null}else a=ti(R);if(u[String(R)]!==void 0)return M.error("Branch labels must be unique.");u[String(R)]=m.length}const z=r.parse(E,w,o);if(!z)return null;o=o||z.type,m.push(z)}const f=r.parse(e[1],1,ot);if(!f)return null;const v=r.parse(e[e.length-1],e.length-1,o);return v?f.type.kind!=="value"&&r.concat(1).checkSubtype(a,f.type)?null:new po(a,o,f,u,m,v):null}evaluate(e){const r=this.input.evaluate(e);return(ti(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class mo{constructor(e,r,a){this.type=e,this.branches=r,this.otherwise=a}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let a;r.expectedType&&r.expectedType.kind!=="value"&&(a=r.expectedType);const o=[];for(let m=1;m<e.length-1;m+=2){const f=r.parse(e[m],m,nt);if(!f)return null;const v=r.parse(e[m+1],m+1,a);if(!v)return null;o.push([f,v]),a=a||v.type}const u=r.parse(e[e.length-1],e.length-1,a);if(!u)return null;if(!a)throw new Error("Can't infer output type");return new mo(a,o,u)}evaluate(e){for(const[r,a]of this.branches)if(r.evaluate(e))return a.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[r,a]of this.branches)e(r),e(a);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}}class Ss{constructor(e,r,a,o){this.type=e,this.input=r,this.beginIndex=a,this.endIndex=o}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const a=r.parse(e[1],1,ot),o=r.parse(e[2],2,Ce);if(!a||!o)return null;if(!X(a.type,[G(ot),dt,ot]))return r.error(`Expected first argument to be of type array or string, but found ${H(a.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,Ce);return u?new Ss(a.type,a,o,u):null}return new Ss(a.type,a,o)}evaluate(e){const r=this.input.evaluate(e),a=this.beginIndex.evaluate(e);if(!ie(r,["string","array"]))throw new oi(`Expected first argument to be of type array or string, but found ${H(ti(r))} instead.`);if(this.endIndex){const o=this.endIndex.evaluate(e);return r.slice(a,o)}return r.slice(a)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Rl(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Bl(i,e,r,a){return a.compare(e,r)===0}function pa(i,e,r){const a=i!=="=="&&i!=="!=";return class Qm{constructor(u,m,f){this.type=nt,this.lhs=u,this.rhs=m,this.collator=f,this.hasUntypedArgument=u.type.kind==="value"||m.type.kind==="value"}static parse(u,m){if(u.length!==3&&u.length!==4)return m.error("Expected two or three arguments.");const f=u[0];let v=m.parse(u[1],1,ot);if(!v)return null;if(!Rl(f,v.type))return m.concat(1).error(`"${f}" comparisons are not supported for type '${H(v.type)}'.`);let w=m.parse(u[2],2,ot);if(!w)return null;if(!Rl(f,w.type))return m.concat(2).error(`"${f}" comparisons are not supported for type '${H(w.type)}'.`);if(v.type.kind!==w.type.kind&&v.type.kind!=="value"&&w.type.kind!=="value")return m.error(`Cannot compare types '${H(v.type)}' and '${H(w.type)}'.`);a&&(v.type.kind==="value"&&w.type.kind!=="value"?v=new Tr(w.type,[v]):v.type.kind!=="value"&&w.type.kind==="value"&&(w=new Tr(v.type,[w])));let T=null;if(u.length===4){if(v.type.kind!=="string"&&w.type.kind!=="string"&&v.type.kind!=="value"&&w.type.kind!=="value")return m.error("Cannot use collator to compare non-string types.");if(T=m.parse(u[3],3,on),!T)return null}return new Qm(v,w,T)}evaluate(u){const m=this.lhs.evaluate(u),f=this.rhs.evaluate(u);if(a&&this.hasUntypedArgument){const v=ti(m),w=ti(f);if(v.kind!==w.kind||v.kind!=="string"&&v.kind!=="number")throw new oi(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${v.kind}, ${w.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){const v=ti(m),w=ti(f);if(v.kind!=="string"||w.kind!=="string")return e(u,m,f)}return this.collator?r(u,m,f,this.collator.evaluate(u)):e(u,m,f)}eachChild(u){u(this.lhs),u(this.rhs),this.collator&&u(this.collator)}outputDefined(){return!0}}}const wh=pa("==",function(i,e,r){return e===r},Bl),Sh=pa("!=",function(i,e,r){return e!==r},function(i,e,r,a){return!Bl(0,e,r,a)}),Th=pa("<",function(i,e,r){return e<r},function(i,e,r,a){return a.compare(e,r)<0}),Ih=pa(">",function(i,e,r){return e>r},function(i,e,r,a){return a.compare(e,r)>0}),Ah=pa("<=",function(i,e,r){return e<=r},function(i,e,r,a){return a.compare(e,r)<=0}),Ch=pa(">=",function(i,e,r){return e>=r},function(i,e,r,a){return a.compare(e,r)>=0});class fo{constructor(e,r,a,o,u){this.type=dt,this.number=e,this.locale=r,this.currency=a,this.minFractionDigits=o,this.maxFractionDigits=u}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const a=r.parse(e[1],1,Ce);if(!a)return null;const o=e[2];if(typeof o!="object"||Array.isArray(o))return r.error("NumberFormat options argument must be an object.");let u=null;if(o.locale&&(u=r.parse(o.locale,1,dt),!u))return null;let m=null;if(o.currency&&(m=r.parse(o.currency,1,dt),!m))return null;let f=null;if(o["min-fraction-digits"]&&(f=r.parse(o["min-fraction-digits"],1,Ce),!f))return null;let v=null;return o["max-fraction-digits"]&&(v=r.parse(o["max-fraction-digits"],1,Ce),!v)?null:new fo(a,u,m,f,v)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class Ts{constructor(e){this.type=$,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const a=e[1];if(!Array.isArray(a)&&typeof a=="object")return r.error("First argument must be an image or text section.");const o=[];let u=!1;for(let m=1;m<=e.length-1;++m){const f=e[m];if(u&&typeof f=="object"&&!Array.isArray(f)){u=!1;let v=null;if(f["font-scale"]&&(v=r.parse(f["font-scale"],1,Ce),!v))return null;let w=null;if(f["text-font"]&&(w=r.parse(f["text-font"],1,G(dt)),!w))return null;let T=null;if(f["text-color"]&&(T=r.parse(f["text-color"],1,Zi),!T))return null;const E=o[o.length-1];E.scale=v,E.font=w,E.textColor=T}else{const v=r.parse(e[m],1,ot);if(!v)return null;const w=v.type.kind;if(w!=="string"&&w!=="value"&&w!=="null"&&w!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");u=!0,o.push({content:v,scale:null,font:null,textColor:null})}}return new Ts(o)}evaluate(e){return new Ni(this.sections.map(r=>{const a=r.content.evaluate(e);return ti(a)===k?new cs("",a,null,null,null):new cs(kt(a),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null)}))}eachChild(e){for(const r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}}class go{constructor(e){this.type=k,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const a=r.parse(e[1],1,dt);return a?new go(a):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),a=Li.fromString(r);return a&&e.availableImages&&(a.available=e.availableImages.indexOf(r)>-1),a}eachChild(e){e(this.input)}outputDefined(){return!1}}class yo{constructor(e){this.type=Ce,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const a=r.parse(e[1],1);return a?a.type.kind!=="array"&&a.type.kind!=="string"&&a.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${H(a.type)} instead.`):new yo(a):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new oi(`Expected value to be of type string or array, but found ${H(ti(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const da={"==":wh,"!=":Sh,">":Ih,"<":Th,">=":Ch,"<=":Ah,array:Tr,at:ho,boolean:Tr,case:mo,coalesce:xs,collator:ds,format:Ts,image:go,in:uo,"index-of":ws,interpolate:hr,"interpolate-hcl":hr,"interpolate-lab":hr,length:yo,let:bs,literal:Vn,match:po,number:Tr,"number-format":fo,object:Tr,slice:Ss,step:En,string:Tr,"to-boolean":An,"to-color":An,"to-number":An,"to-string":An,var:fs,within:$n};function Fl(i,[e,r,a,o]){e=e.evaluate(i),r=r.evaluate(i),a=a.evaluate(i);const u=o?o.evaluate(i):1,m=hs(e,r,a,u);if(m)throw new oi(m);return new Nt(e/255,r/255,a/255,u,!1)}function Ol(i,e){return i in e}function _o(i,e){const r=e[i];return r===void 0?null:r}function jn(i){return{type:i}}function Nl(i){return{result:"success",value:i}}function Pn(i){return{result:"error",value:i}}function ma(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function Ul(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function vo(i){return!!i.expression&&i.expression.interpolated}function Lt(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function ii(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Eh(i){return i}function It(i,e){const r=e.type==="color",a=i.stops&&typeof i.stops[0][0]=="object",o=a||!(a||i.property!==void 0),u=i.type||(vo(e)?"exponential":"interval");if(r||e.type==="padding"){const T=r?Nt.parse:lr.parse;(i=qr({},i)).stops&&(i.stops=i.stops.map(E=>[E[0],T(E[1])])),i.default=T(i.default?i.default:e.default)}if(i.colorSpace&&(m=i.colorSpace)!=="rgb"&&m!=="hcl"&&m!=="lab")throw new Error(`Unknown color space: "${i.colorSpace}"`);var m;let f,v,w;if(u==="exponential")f=Oa;else if(u==="interval")f=Qt;else if(u==="categorical"){f=ri,v=Object.create(null);for(const T of i.stops)v[T[0]]=T[1];w=typeof i.stops[0][0]}else{if(u!=="identity")throw new Error(`Unknown function type "${u}"`);f=Vl}if(a){const T={},E=[];for(let R=0;R<i.stops.length;R++){const O=i.stops[R],Z=O[0].zoom;T[Z]===void 0&&(T[Z]={zoom:Z,type:i.type,property:i.property,default:i.default,stops:[]},E.push(Z)),T[Z].stops.push([O[0].value,O[1]])}const M=[];for(const R of E)M.push([T[R].zoom,It(T[R],e)]);const z={name:"linear"};return{kind:"composite",interpolationType:z,interpolationFactor:hr.interpolationFactor.bind(void 0,z),zoomStops:M.map(R=>R[0]),evaluate:({zoom:R},O)=>Oa({stops:M,base:i.base},e,R).evaluate(R,O)}}if(o){const T=u==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:T,interpolationFactor:hr.interpolationFactor.bind(void 0,T),zoomStops:i.stops.map(E=>E[0]),evaluate:({zoom:E})=>f(i,e,E,v,w)}}return{kind:"source",evaluate(T,E){const M=E&&E.properties?E.properties[i.property]:void 0;return M===void 0?Gn(i.default,e.default):f(i,e,M,v,w)}}}function Gn(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function ri(i,e,r,a,o){return Gn(typeof r===o?a[r]:void 0,i.default,e.default)}function Qt(i,e,r){if(Lt(r)!=="number")return Gn(i.default,e.default);const a=i.stops.length;if(a===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[a-1][0])return i.stops[a-1][1];const o=ua(i.stops.map(u=>u[0]),r);return i.stops[o][1]}function Oa(i,e,r){const a=i.base!==void 0?i.base:1;if(Lt(r)!=="number")return Gn(i.default,e.default);const o=i.stops.length;if(o===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[o-1][0])return i.stops[o-1][1];const u=ua(i.stops.map(T=>T[0]),r),m=function(T,E,M,z){const R=z-M,O=T-M;return R===0?0:E===1?O/R:(Math.pow(E,O)-1)/(Math.pow(E,R)-1)}(r,a,i.stops[u][0],i.stops[u+1][0]),f=i.stops[u][1],v=i.stops[u+1][1],w=cr[e.type]||Eh;return typeof f.evaluate=="function"?{evaluate(...T){const E=f.evaluate.apply(void 0,T),M=v.evaluate.apply(void 0,T);if(E!==void 0&&M!==void 0)return w(E,M,m,i.colorSpace)}}:w(f,v,m,i.colorSpace)}function Vl(i,e,r){switch(e.type){case"color":r=Nt.parse(r);break;case"formatted":r=Ni.fromString(r.toString());break;case"resolvedImage":r=Li.fromString(r.toString());break;case"padding":r=lr.parse(r);break;default:Lt(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return Gn(r,i.default,e.default)}Ir.register(da,{error:[{kind:"error"},[dt],(i,[e])=>{throw new oi(e.evaluate(i))}],typeof:[dt,[ot],(i,[e])=>H(ti(e.evaluate(i)))],"to-rgba":[G(Ce,4),[Zi],(i,[e])=>{const[r,a,o,u]=e.evaluate(i).rgb;return[255*r,255*a,255*o,u]}],rgb:[Zi,[Ce,Ce,Ce],Fl],rgba:[Zi,[Ce,Ce,Ce,Ce],Fl],has:{type:nt,overloads:[[[dt],(i,[e])=>Ol(e.evaluate(i),i.properties())],[[dt,Zr],(i,[e,r])=>Ol(e.evaluate(i),r.evaluate(i))]]},get:{type:ot,overloads:[[[dt],(i,[e])=>_o(e.evaluate(i),i.properties())],[[dt,Zr],(i,[e,r])=>_o(e.evaluate(i),r.evaluate(i))]]},"feature-state":[ot,[dt],(i,[e])=>_o(e.evaluate(i),i.featureState||{})],properties:[Zr,[],i=>i.properties()],"geometry-type":[dt,[],i=>i.geometryType()],id:[ot,[],i=>i.id()],zoom:[Ce,[],i=>i.globals.zoom],"heatmap-density":[Ce,[],i=>i.globals.heatmapDensity||0],"line-progress":[Ce,[],i=>i.globals.lineProgress||0],accumulated:[ot,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Ce,jn(Ce),(i,e)=>{let r=0;for(const a of e)r+=a.evaluate(i);return r}],"*":[Ce,jn(Ce),(i,e)=>{let r=1;for(const a of e)r*=a.evaluate(i);return r}],"-":{type:Ce,overloads:[[[Ce,Ce],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[Ce],(i,[e])=>-e.evaluate(i)]]},"/":[Ce,[Ce,Ce],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[Ce,[Ce,Ce],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[Ce,[],()=>Math.LN2],pi:[Ce,[],()=>Math.PI],e:[Ce,[],()=>Math.E],"^":[Ce,[Ce,Ce],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[Ce,[Ce],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[Ce,[Ce],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[Ce,[Ce],(i,[e])=>Math.log(e.evaluate(i))],log2:[Ce,[Ce],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[Ce,[Ce],(i,[e])=>Math.sin(e.evaluate(i))],cos:[Ce,[Ce],(i,[e])=>Math.cos(e.evaluate(i))],tan:[Ce,[Ce],(i,[e])=>Math.tan(e.evaluate(i))],asin:[Ce,[Ce],(i,[e])=>Math.asin(e.evaluate(i))],acos:[Ce,[Ce],(i,[e])=>Math.acos(e.evaluate(i))],atan:[Ce,[Ce],(i,[e])=>Math.atan(e.evaluate(i))],min:[Ce,jn(Ce),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[Ce,jn(Ce),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[Ce,[Ce],(i,[e])=>Math.abs(e.evaluate(i))],round:[Ce,[Ce],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Ce,[Ce],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[Ce,[Ce],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[nt,[dt,ot],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[nt,[ot],(i,[e])=>i.id()===e.value],"filter-type-==":[nt,[dt],(i,[e])=>i.geometryType()===e.value],"filter-<":[nt,[dt,ot],(i,[e,r])=>{const a=i.properties()[e.value],o=r.value;return typeof a==typeof o&&a<o}],"filter-id-<":[nt,[ot],(i,[e])=>{const r=i.id(),a=e.value;return typeof r==typeof a&&r<a}],"filter->":[nt,[dt,ot],(i,[e,r])=>{const a=i.properties()[e.value],o=r.value;return typeof a==typeof o&&a>o}],"filter-id->":[nt,[ot],(i,[e])=>{const r=i.id(),a=e.value;return typeof r==typeof a&&r>a}],"filter-<=":[nt,[dt,ot],(i,[e,r])=>{const a=i.properties()[e.value],o=r.value;return typeof a==typeof o&&a<=o}],"filter-id-<=":[nt,[ot],(i,[e])=>{const r=i.id(),a=e.value;return typeof r==typeof a&&r<=a}],"filter->=":[nt,[dt,ot],(i,[e,r])=>{const a=i.properties()[e.value],o=r.value;return typeof a==typeof o&&a>=o}],"filter-id->=":[nt,[ot],(i,[e])=>{const r=i.id(),a=e.value;return typeof r==typeof a&&r>=a}],"filter-has":[nt,[ot],(i,[e])=>e.value in i.properties()],"filter-has-id":[nt,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[nt,[G(dt)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[nt,[G(ot)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[nt,[dt,G(ot)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[nt,[dt,G(ot)],(i,[e,r])=>function(a,o,u,m){for(;u<=m;){const f=u+m>>1;if(o[f]===a)return!0;o[f]>a?m=f-1:u=f+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:nt,overloads:[[[nt,nt],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[jn(nt),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:nt,overloads:[[[nt,nt],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[jn(nt),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[nt,[nt],(i,[e])=>!e.evaluate(i)],"is-supported-script":[nt,[dt],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[dt,[dt],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[dt,[dt],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[dt,jn(ot),(i,e)=>e.map(r=>kt(r.evaluate(i))).join("")],"resolved-locale":[dt,[on],(i,[e])=>e.evaluate(i).resolvedLocale()]});class xo{constructor(e,r){var a;this.expression=e,this._warningHistory={},this._evaluator=new ro,this._defaultValue=r?(a=r).type==="color"&&ii(a.default)?new Nt(0,0,0,0):a.type==="color"?Nt.parse(a.default)||null:a.type==="padding"?lr.parse(a.default)||null:a.type==="variableAnchorOffsetCollection"?Sr.parse(a.default)||null:a.default===void 0?null:a.default:null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,a,o,u,m){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=a,this._evaluator.canonical=o,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=m,this.expression.evaluate(this._evaluator)}evaluate(e,r,a,o,u,m){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=a||null,this._evaluator.canonical=o,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=m||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 oi(`Expected value to be one of ${Object.keys(this._enumValues).map(v=>JSON.stringify(v)).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 Is(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in da}function As(i,e){const r=new ps(da,gs,[],e?function(o){const u={color:Zi,string:dt,number:Ce,enum:dt,boolean:nt,formatted:$,padding:P,resolvedImage:k,variableAnchorOffsetCollection:B};return o.type==="array"?G(u[o.value]||ot,o.length):u[o.type]}(e):void 0),a=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?Nl(new xo(a,e)):Pn(r.errors)}class bo{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!Fa(r.expression)}evaluateWithoutErrorHandling(e,r,a,o,u,m){return this._styleExpression.evaluateWithoutErrorHandling(e,r,a,o,u,m)}evaluate(e,r,a,o,u,m){return this._styleExpression.evaluate(e,r,a,o,u,m)}}class Cs{constructor(e,r,a,o){this.kind=e,this.zoomStops=a,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!Fa(r.expression),this.interpolationType=o}evaluateWithoutErrorHandling(e,r,a,o,u,m){return this._styleExpression.evaluateWithoutErrorHandling(e,r,a,o,u,m)}evaluate(e,r,a,o,u,m){return this._styleExpression.evaluate(e,r,a,o,u,m)}interpolationFactor(e,r,a){return this.interpolationType?hr.interpolationFactor(this.interpolationType,e,r,a):0}}function wo(i,e){const r=As(i,e);if(r.result==="error")return r;const a=r.value.expression,o=ys(a);if(!o&&!ma(e))return Pn([new si("","data expressions not supported")]);const u=_s(a,["zoom"]);if(!u&&!Ul(e))return Pn([new si("","zoom expressions not supported")]);const m=Ua(a);return m||u?m instanceof si?Pn([m]):m instanceof hr&&!vo(e)?Pn([new si("",'"interpolate" expressions cannot be used with this property')]):Nl(m?new Cs(o?"camera":"composite",r.value,m.labels,m instanceof hr?m.interpolation:void 0):new bo(o?"constant":"source",r.value)):Pn([new si("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Na{constructor(e,r){this._parameters=e,this._specification=r,qr(this,It(this._parameters,this._specification))}static deserialize(e){return new Na(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Ua(i){let e=null;if(i instanceof bs)e=Ua(i.result);else if(i instanceof xs){for(const r of i.args)if(e=Ua(r),e)break}else(i instanceof En||i instanceof hr)&&i.input instanceof Ir&&i.input.name==="zoom"&&(e=i);return e instanceof si||i.eachChild(r=>{const a=Ua(r);a instanceof si?e=a:!e&&a?e=new si("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&a&&e!==a&&(e=new si("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Va(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!Va(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const Ph={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function So(i){if(i==null)return{filter:()=>!0,needGeometry:!1};Va(i)||(i=Es(i));const e=As(i,Ph);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,a,o)=>e.value.evaluate(r,a,{},o),needGeometry:$l(i)}}function Mh(i,e){return i<e?-1:i>e?1:0}function $l(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e<i.length;e++)if($l(i[e]))return!0;return!1}function Es(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?To(i[1],i[2],"=="):e==="!="?$a(To(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?To(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(Es))):e==="all"?["all"].concat(i.slice(1).map(Es)):e==="none"?["all"].concat(i.slice(1).map(Es).map($a)):e==="in"?jl(i[1],i.slice(2)):e==="!in"?$a(jl(i[1],i.slice(2))):e==="has"?Gl(i[1]):e==="!has"?$a(Gl(i[1])):e!=="within"||i;var r}function To(i,e,r){switch(i){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,i,e]}}function jl(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",i,["literal",e.sort(Mh)]]:["filter-in-small",i,["literal",e]]}}function Gl(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function $a(i){return["!",i]}function Ps(i){const e=typeof i;if(e==="number"||e==="boolean"||e==="string"||i==null)return JSON.stringify(i);if(Array.isArray(i)){let o="[";for(const u of i)o+=`${Ps(u)},`;return`${o}]`}const r=Object.keys(i).sort();let a="{";for(let o=0;o<r.length;o++)a+=`${JSON.stringify(r[o])}:${Ps(i[r[o]])},`;return`${a}}`}function Ms(i){let e="";for(const r of Qi)e+=`/${Ps(i[r])}`;return e}function ql(i){const e=i.value;return e?[new Ie(i.key,e,"constants have been deprecated as of v8")]:[]}function li(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function qn(i){if(Array.isArray(i))return i.map(qn);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={};for(const r in i)e[r]=qn(i[r]);return e}return li(i)}function er(i){const e=i.key,r=i.value,a=i.valueSpec||{},o=i.objectElementValidators||{},u=i.style,m=i.styleSpec,f=i.validateSpec;let v=[];const w=Lt(r);if(w!=="object")return[new Ie(e,r,`object expected, ${w} found`)];for(const T in r){const E=T.split(".")[0],M=a[E]||a["*"];let z;if(o[E])z=o[E];else if(a[E])z=f;else if(o["*"])z=o["*"];else{if(!a["*"]){v.push(new Ie(e,r[T],`unknown property "${T}"`));continue}z=f}v=v.concat(z({key:(e&&`${e}.`)+T,value:r[T],valueSpec:M,style:u,styleSpec:m,object:r,objectKey:T,validateSpec:f},r))}for(const T in a)o[T]||a[T].required&&a[T].default===void 0&&r[T]===void 0&&v.push(new Ie(e,r,`missing required property "${T}"`));return v}function fa(i){const e=i.value,r=i.valueSpec,a=i.style,o=i.styleSpec,u=i.key,m=i.arrayElementValidator||i.validateSpec;if(Lt(e)!=="array")return[new Ie(u,e,`array expected, ${Lt(e)} found`)];if(r.length&&e.length!==r.length)return[new Ie(u,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new Ie(u,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let f={type:r.value,values:r.values};o.$version<7&&(f.function=r.function),Lt(r.value)==="object"&&(f=r.value);let v=[];for(let w=0;w<e.length;w++)v=v.concat(m({array:e,arrayIndex:w,value:e[w],valueSpec:f,validateSpec:i.validateSpec,style:a,styleSpec:o,key:`${u}[${w}]`}));return v}function ja(i){const e=i.key,r=i.value,a=i.valueSpec;let o=Lt(r);return o==="number"&&r!=r&&(o="NaN"),o!=="number"?[new Ie(e,r,`number expected, ${o} found`)]:"minimum"in a&&r<a.minimum?[new Ie(e,r,`${r} is less than the minimum value ${a.minimum}`)]:"maximum"in a&&r>a.maximum?[new Ie(e,r,`${r} is greater than the maximum value ${a.maximum}`)]:[]}function ks(i){const e=i.valueSpec,r=li(i.value.type);let a,o,u,m={};const f=r!=="categorical"&&i.value.property===void 0,v=!f,w=Lt(i.value.stops)==="array"&&Lt(i.value.stops[0])==="array"&&Lt(i.value.stops[0][0])==="object",T=er({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(z){if(r==="identity")return[new Ie(z.key,z.value,'identity function may not have a "stops" property')];let R=[];const O=z.value;return R=R.concat(fa({key:z.key,value:O,valueSpec:z.valueSpec,validateSpec:z.validateSpec,style:z.style,styleSpec:z.styleSpec,arrayElementValidator:E})),Lt(O)==="array"&&O.length===0&&R.push(new Ie(z.key,O,"array must have at least one stop")),R},default:function(z){return z.validateSpec({key:z.key,value:z.value,valueSpec:e,validateSpec:z.validateSpec,style:z.style,styleSpec:z.styleSpec})}}});return r==="identity"&&f&&T.push(new Ie(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||T.push(new Ie(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!vo(i.valueSpec)&&T.push(new Ie(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(v&&!ma(i.valueSpec)?T.push(new Ie(i.key,i.value,"property functions not supported")):f&&!Ul(i.valueSpec)&&T.push(new Ie(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!w||i.value.property!==void 0||T.push(new Ie(i.key,i.value,'"property" property is required')),T;function E(z){let R=[];const O=z.value,Z=z.key;if(Lt(O)!=="array")return[new Ie(Z,O,`array expected, ${Lt(O)} found`)];if(O.length!==2)return[new Ie(Z,O,`array length 2 expected, length ${O.length} found`)];if(w){if(Lt(O[0])!=="object")return[new Ie(Z,O,`object expected, ${Lt(O[0])} found`)];if(O[0].zoom===void 0)return[new Ie(Z,O,"object stop key must have zoom")];if(O[0].value===void 0)return[new Ie(Z,O,"object stop key must have value")];if(u&&u>li(O[0].zoom))return[new Ie(Z,O[0].zoom,"stop zoom values must appear in ascending order")];li(O[0].zoom)!==u&&(u=li(O[0].zoom),o=void 0,m={}),R=R.concat(er({key:`${Z}[0]`,value:O[0],valueSpec:{zoom:{}},validateSpec:z.validateSpec,style:z.style,styleSpec:z.styleSpec,objectElementValidators:{zoom:ja,value:M}}))}else R=R.concat(M({key:`${Z}[0]`,value:O[0],valueSpec:{},validateSpec:z.validateSpec,style:z.style,styleSpec:z.styleSpec},O));return Is(qn(O[1]))?R.concat([new Ie(`${Z}[1]`,O[1],"expressions are not allowed in function stops.")]):R.concat(z.validateSpec({key:`${Z}[1]`,value:O[1],valueSpec:e,validateSpec:z.validateSpec,style:z.style,styleSpec:z.styleSpec}))}function M(z,R){const O=Lt(z.value),Z=li(z.value),K=z.value!==null?z.value:R;if(a){if(O!==a)return[new Ie(z.key,K,`${O} stop domain type must match previous stop domain type ${a}`)]}else a=O;if(O!=="number"&&O!=="string"&&O!=="boolean")return[new Ie(z.key,K,"stop domain value must be a number, string, or boolean")];if(O!=="number"&&r!=="categorical"){let re=`number expected, ${O} found`;return ma(e)&&r===void 0&&(re+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ie(z.key,K,re)]}return r!=="categorical"||O!=="number"||isFinite(Z)&&Math.floor(Z)===Z?r!=="categorical"&&O==="number"&&o!==void 0&&Z<o?[new Ie(z.key,K,"stop domain values must appear in ascending order")]:(o=Z,r==="categorical"&&Z in m?[new Ie(z.key,K,"stop domain values must be unique")]:(m[Z]=!0,[])):[new Ie(z.key,K,`integer expected, found ${Z}`)]}}function Zn(i){const e=(i.expressionContext==="property"?wo:As)(qn(i.value),i.valueSpec);if(e.result==="error")return e.value.map(a=>new Ie(`${i.key}${a.key}`,i.value,a.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new Ie(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!Fa(r))return[new Ie(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!Fa(r))return[new Ie(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!_s(r,["zoom","feature-state"]))return[new Ie(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!ys(r))return[new Ie(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Ga(i){const e=i.key,r=i.value,a=i.valueSpec,o=[];return Array.isArray(a.values)?a.values.indexOf(li(r))===-1&&o.push(new Ie(e,r,`expected one of [${a.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(a.values).indexOf(li(r))===-1&&o.push(new Ie(e,r,`expected one of [${Object.keys(a.values).join(", ")}], ${JSON.stringify(r)} found`)),o}function ga(i){return Va(qn(i.value))?Zn(qr({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Zl(i)}function Zl(i){const e=i.value,r=i.key;if(Lt(e)!=="array")return[new Ie(r,e,`array expected, ${Lt(e)} found`)];const a=i.styleSpec;let o,u=[];if(e.length<1)return[new Ie(r,e,"filter array must have at least 1 element")];switch(u=u.concat(Ga({key:`${r}[0]`,value:e[0],valueSpec:a.filter_operator,style:i.style,styleSpec:i.styleSpec})),li(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&li(e[1])==="$type"&&u.push(new Ie(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&u.push(new Ie(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(o=Lt(e[1]),o!=="string"&&u.push(new Ie(`${r}[1]`,e[1],`string expected, ${o} found`)));for(let m=2;m<e.length;m++)o=Lt(e[m]),li(e[1])==="$type"?u=u.concat(Ga({key:`${r}[${m}]`,value:e[m],valueSpec:a.geometry_type,style:i.style,styleSpec:i.styleSpec})):o!=="string"&&o!=="number"&&o!=="boolean"&&u.push(new Ie(`${r}[${m}]`,e[m],`string, number, or boolean expected, ${o} found`));break;case"any":case"all":case"none":for(let m=1;m<e.length;m++)u=u.concat(Zl({key:`${r}[${m}]`,value:e[m],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":o=Lt(e[1]),e.length!==2?u.push(new Ie(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):o!=="string"&&u.push(new Ie(`${r}[1]`,e[1],`string expected, ${o} found`));break;case"within":o=Lt(e[1]),e.length!==2?u.push(new Ie(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):o!=="object"&&u.push(new Ie(`${r}[1]`,e[1],`object expected, ${o} found`))}return u}function Hl(i,e){const r=i.key,a=i.validateSpec,o=i.style,u=i.styleSpec,m=i.value,f=i.objectKey,v=u[`${e}_${i.layerType}`];if(!v)return[];const w=f.match(/^(.*)-transition$/);if(e==="paint"&&w&&v[w[1]]&&v[w[1]].transition)return a({key:r,value:m,valueSpec:u.transition,style:o,styleSpec:u});const T=i.valueSpec||v[f];if(!T)return[new Ie(r,m,`unknown property "${f}"`)];let E;if(Lt(m)==="string"&&ma(T)&&!T.tokens&&(E=/^{([^}]+)}$/.exec(m)))return[new Ie(r,m,`"${f}" does not support interpolation syntax
|
|
2
|
+
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(E[1])} }\`.`)];const M=[];return i.layerType==="symbol"&&(f==="text-field"&&o&&!o.glyphs&&M.push(new Ie(r,m,'use of "text-field" requires a style "glyphs" property')),f==="text-font"&&ii(qn(m))&&li(m.type)==="identity"&&M.push(new Ie(r,m,'"text-font" does not support identity functions'))),M.concat(a({key:i.key,value:m,valueSpec:T,style:o,styleSpec:u,expressionContext:"property",propertyType:e,propertyKey:f}))}function Wl(i){return Hl(i,"paint")}function Kl(i){return Hl(i,"layout")}function Xl(i){let e=[];const r=i.value,a=i.key,o=i.style,u=i.styleSpec;r.type||r.ref||e.push(new Ie(a,r,'either "type" or "ref" is required'));let m=li(r.type);const f=li(r.ref);if(r.id){const v=li(r.id);for(let w=0;w<i.arrayIndex;w++){const T=o.layers[w];li(T.id)===v&&e.push(new Ie(a,r.id,`duplicate layer id "${r.id}", previously used at line ${T.id.__line__}`))}}if("ref"in r){let v;["type","source","source-layer","filter","layout"].forEach(w=>{w in r&&e.push(new Ie(a,r[w],`"${w}" is prohibited for ref layers`))}),o.layers.forEach(w=>{li(w.id)===f&&(v=w)}),v?v.ref?e.push(new Ie(a,r.ref,"ref cannot reference another ref layer")):m=li(v.type):e.push(new Ie(a,r.ref,`ref layer "${f}" not found`))}else if(m!=="background")if(r.source){const v=o.sources&&o.sources[r.source],w=v&&li(v.type);v?w==="vector"&&m==="raster"?e.push(new Ie(a,r.source,`layer "${r.id}" requires a raster source`)):w!=="raster-dem"&&m==="hillshade"?e.push(new Ie(a,r.source,`layer "${r.id}" requires a raster-dem source`)):w==="raster"&&m!=="raster"?e.push(new Ie(a,r.source,`layer "${r.id}" requires a vector source`)):w!=="vector"||r["source-layer"]?w==="raster-dem"&&m!=="hillshade"?e.push(new Ie(a,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):m!=="line"||!r.paint||!r.paint["line-gradient"]||w==="geojson"&&v.lineMetrics||e.push(new Ie(a,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Ie(a,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new Ie(a,r.source,`source "${r.source}" not found`))}else e.push(new Ie(a,r,'missing required property "source"'));return e=e.concat(er({key:a,value:r,valueSpec:u.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${a}.type`,value:r.type,valueSpec:u.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:ga,layout:v=>er({layer:r,key:v.key,value:v.value,style:v.style,styleSpec:v.styleSpec,validateSpec:v.validateSpec,objectElementValidators:{"*":w=>Kl(qr({layerType:m},w))}}),paint:v=>er({layer:r,key:v.key,value:v.value,style:v.style,styleSpec:v.styleSpec,validateSpec:v.validateSpec,objectElementValidators:{"*":w=>Wl(qr({layerType:m},w))}})}})),e}function Hr(i){const e=i.value,r=i.key,a=Lt(e);return a!=="string"?[new Ie(r,e,`string expected, ${a} found`)]:[]}const qa={promoteId:function({key:i,value:e}){if(Lt(e)==="string")return Hr({key:i,value:e});{const r=[];for(const a in e)r.push(...Hr({key:`${i}.${a}`,value:e[a]}));return r}}};function ur(i){const e=i.value,r=i.key,a=i.styleSpec,o=i.style,u=i.validateSpec;if(!e.type)return[new Ie(r,e,'"type" is required')];const m=li(e.type);let f;switch(m){case"vector":case"raster":return f=er({key:r,value:e,valueSpec:a[`source_${m.replace("-","_")}`],style:i.style,styleSpec:a,objectElementValidators:qa,validateSpec:u}),f;case"raster-dem":return f=function(v){var w;const T=(w=v.sourceName)!==null&&w!==void 0?w:"",E=v.value,M=v.styleSpec,z=M.source_raster_dem,R=v.style;let O=[];const Z=Lt(E);if(E===void 0)return O;if(Z!=="object")return O.push(new Ie("source_raster_dem",E,`object expected, ${Z} found`)),O;const K=li(E.encoding)==="custom",re=["redFactor","greenFactor","blueFactor","baseShift"],Y=v.value.encoding?`"${v.value.encoding}"`:"Default";for(const ae in E)!K&&re.includes(ae)?O.push(new Ie(ae,E[ae],`In "${T}": "${ae}" is only valid when "encoding" is set to "custom". ${Y} encoding found`)):z[ae]?O=O.concat(v.validateSpec({key:ae,value:E[ae],valueSpec:z[ae],validateSpec:v.validateSpec,style:R,styleSpec:M})):O.push(new Ie(ae,E[ae],`unknown property "${ae}"`));return O}({sourceName:r,value:e,style:i.style,styleSpec:a,validateSpec:u}),f;case"geojson":if(f=er({key:r,value:e,valueSpec:a.source_geojson,style:o,styleSpec:a,validateSpec:u,objectElementValidators:qa}),e.cluster)for(const v in e.clusterProperties){const[w,T]=e.clusterProperties[v],E=typeof w=="string"?[w,["accumulated"],["get",v]]:w;f.push(...Zn({key:`${r}.${v}.map`,value:T,validateSpec:u,expressionContext:"cluster-map"})),f.push(...Zn({key:`${r}.${v}.reduce`,value:E,validateSpec:u,expressionContext:"cluster-reduce"}))}return f;case"video":return er({key:r,value:e,valueSpec:a.source_video,style:o,validateSpec:u,styleSpec:a});case"image":return er({key:r,value:e,valueSpec:a.source_image,style:o,validateSpec:u,styleSpec:a});case"canvas":return[new Ie(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Ga({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:o,validateSpec:u,styleSpec:a})}}function Za(i){const e=i.value,r=i.styleSpec,a=r.light,o=i.style;let u=[];const m=Lt(e);if(e===void 0)return u;if(m!=="object")return u=u.concat([new Ie("light",e,`object expected, ${m} found`)]),u;for(const f in e){const v=f.match(/^(.*)-transition$/);u=u.concat(v&&a[v[1]]&&a[v[1]].transition?i.validateSpec({key:f,value:e[f],valueSpec:r.transition,validateSpec:i.validateSpec,style:o,styleSpec:r}):a[f]?i.validateSpec({key:f,value:e[f],valueSpec:a[f],validateSpec:i.validateSpec,style:o,styleSpec:r}):[new Ie(f,e[f],`unknown property "${f}"`)])}return u}function Yl(i){const e=i.value,r=i.styleSpec,a=r.terrain,o=i.style;let u=[];const m=Lt(e);if(e===void 0)return u;if(m!=="object")return u=u.concat([new Ie("terrain",e,`object expected, ${m} found`)]),u;for(const f in e)u=u.concat(a[f]?i.validateSpec({key:f,value:e[f],valueSpec:a[f],validateSpec:i.validateSpec,style:o,styleSpec:r}):[new Ie(f,e[f],`unknown property "${f}"`)]);return u}function Jl(i){let e=[];const r=i.value,a=i.key;if(Array.isArray(r)){const o=[],u=[];for(const m in r)r[m].id&&o.includes(r[m].id)&&e.push(new Ie(a,r,`all the sprites' ids must be unique, but ${r[m].id} is duplicated`)),o.push(r[m].id),r[m].url&&u.includes(r[m].url)&&e.push(new Ie(a,r,`all the sprites' URLs must be unique, but ${r[m].url} is duplicated`)),u.push(r[m].url),e=e.concat(er({key:`${a}[${m}]`,value:r[m],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return e}return Hr({key:a,value:r})}const Ql={"*":()=>[],array:fa,boolean:function(i){const e=i.value,r=i.key,a=Lt(e);return a!=="boolean"?[new Ie(r,e,`boolean expected, ${a} found`)]:[]},number:ja,color:function(i){const e=i.key,r=i.value,a=Lt(r);return a!=="string"?[new Ie(e,r,`color expected, ${a} found`)]:Nt.parse(String(r))?[]:[new Ie(e,r,`color expected, "${r}" found`)]},constants:ql,enum:Ga,filter:ga,function:ks,layer:Xl,object:er,source:ur,light:Za,terrain:Yl,string:Hr,formatted:function(i){return Hr(i).length===0?[]:Zn(i)},resolvedImage:function(i){return Hr(i).length===0?[]:Zn(i)},padding:function(i){const e=i.key,r=i.value;if(Lt(r)==="array"){if(r.length<1||r.length>4)return[new Ie(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const a={type:"number"};let o=[];for(let u=0;u<r.length;u++)o=o.concat(i.validateSpec({key:`${e}[${u}]`,value:r[u],validateSpec:i.validateSpec,valueSpec:a}));return o}return ja({key:e,value:r,valueSpec:{}})},variableAnchorOffsetCollection:function(i){const e=i.key,r=i.value,a=Lt(r),o=i.styleSpec;if(a!=="array"||r.length<1||r.length%2!=0)return[new Ie(e,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let u=[];for(let m=0;m<r.length;m+=2)u=u.concat(Ga({key:`${e}[${m}]`,value:r[m],valueSpec:o.layout_symbol["text-anchor"]})),u=u.concat(fa({key:`${e}[${m+1}]`,value:r[m+1],valueSpec:{length:2,value:"number"},validateSpec:i.validateSpec,style:i.style,styleSpec:o}));return u},sprite:Jl};function ln(i){const e=i.value,r=i.valueSpec,a=i.styleSpec;return i.validateSpec=ln,r.expression&&ii(li(e))?ks(i):r.expression&&Is(qn(e))?Zn(i):r.type&&Ql[r.type]?Ql[r.type](i):er(qr({},i,{valueSpec:r.type?a[r.type]:r}))}function ec(i){const e=i.value,r=i.key,a=Hr(i);return a.length||(e.indexOf("{fontstack}")===-1&&a.push(new Ie(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&a.push(new Ie(r,e,'"glyphs" url must include a "{range}" token'))),a}function Ar(i,e=ue){let r=[];return r=r.concat(ln({key:"",value:i,valueSpec:e.$root,styleSpec:e,style:i,validateSpec:ln,objectElementValidators:{glyphs:ec,"*":()=>[]}})),i.constants&&(r=r.concat(ql({key:"constants",value:i.constants,style:i,styleSpec:e,validateSpec:ln}))),Ls(r)}function cn(i){return function(e){return i({...e,validateSpec:ln})}}function Ls(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function hn(i){return function(...e){return Ls(i.apply(this,e))}}Ar.source=hn(cn(ur)),Ar.sprite=hn(cn(Jl)),Ar.glyphs=hn(cn(ec)),Ar.light=hn(cn(Za)),Ar.terrain=hn(cn(Yl)),Ar.layer=hn(cn(Xl)),Ar.filter=hn(cn(ga)),Ar.paintProperty=hn(cn(Wl)),Ar.layoutProperty=hn(cn(Kl));const un=Ar,kh=un.light,Io=un.paintProperty,tc=un.layoutProperty;function zs(i,e){let r=!1;if(e&&e.length)for(const a of e)i.fire(new Tn(new Error(a.message))),r=!0;return r}class ya{constructor(e,r,a){const o=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const m=new Int32Array(this.arrayBuffer);e=m[0],this.d=(r=m[1])+2*(a=m[2]);for(let v=0;v<this.d*this.d;v++){const w=m[3+v],T=m[3+v+1];o.push(w===T?null:m.subarray(w,T))}const f=m[3+o.length+1];this.keys=m.subarray(m[3+o.length],f),this.bboxes=m.subarray(f),this.insert=this._insertReadonly}else{this.d=r+2*a;for(let m=0;m<this.d*this.d;m++)o.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=a,this.scale=r/e,this.uid=0;const u=a/r*e;this.min=-u,this.max=e+u}insert(e,r,a,o,u){this._forEachCell(r,a,o,u,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(a),this.bboxes.push(o),this.bboxes.push(u)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,a,o,u,m){this.cells[u].push(m)}query(e,r,a,o,u){const m=this.min,f=this.max;if(e<=m&&r<=m&&f<=a&&f<=o&&!u)return Array.prototype.slice.call(this.keys);{const v=[];return this._forEachCell(e,r,a,o,this._queryCell,v,{},u),v}}_queryCell(e,r,a,o,u,m,f,v){const w=this.cells[u];if(w!==null){const T=this.keys,E=this.bboxes;for(let M=0;M<w.length;M++){const z=w[M];if(f[z]===void 0){const R=4*z;(v?v(E[R+0],E[R+1],E[R+2],E[R+3]):e<=E[R+2]&&r<=E[R+3]&&a>=E[R+0]&&o>=E[R+1])?(f[z]=!0,m.push(T[z])):f[z]=!1}}}}_forEachCell(e,r,a,o,u,m,f,v){const w=this._convertToCellCoord(e),T=this._convertToCellCoord(r),E=this._convertToCellCoord(a),M=this._convertToCellCoord(o);for(let z=w;z<=E;z++)for(let R=T;R<=M;R++){const O=this.d*R+z;if((!v||v(this._convertFromCellCoord(z),this._convertFromCellCoord(R),this._convertFromCellCoord(z+1),this._convertFromCellCoord(R+1)))&&u.call(this,e,r,a,o,O,m,f,v))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,r=3+this.cells.length+1+1;let a=0;for(let m=0;m<this.cells.length;m++)a+=this.cells[m].length;const o=new Int32Array(r+a+this.keys.length+this.bboxes.length);o[0]=this.extent,o[1]=this.n,o[2]=this.padding;let u=r;for(let m=0;m<e.length;m++){const f=e[m];o[3+m]=u,o.set(f,u),u+=f.length}return o[3+e.length]=u,o.set(this.keys,u),u+=this.keys.length,o[3+e.length+1]=u,o.set(this.bboxes,u),u+=this.bboxes.length,o.buffer}static serialize(e,r){const a=e.toArrayBuffer();return r&&r.push(a),{buffer:a}}static deserialize(e){return new ya(e.buffer)}}const pn={};function De(i,e,r={}){if(pn[i])throw new Error(`${i} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),pn[i]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}De("Object",Object),De("TransferableGridIndex",ya),De("Color",Nt),De("Error",Error),De("AJAXError",bn),De("ResolvedImage",Li),De("StylePropertyFunction",Na),De("StyleExpression",xo,{omit:["_evaluator"]}),De("ZoomDependentExpression",Cs),De("ZoomConstantExpression",bo),De("CompoundExpression",Ir,{omit:["_evaluate"]});for(const i in da)da[i]._classRegistryKey||De(`Expression_${i}`,da[i]);function Ds(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function Mn(i,e){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob)return i;if(Ds(i)||Mi(i))return e&&e.push(i),i;if(ArrayBuffer.isView(i)){const r=i;return e&&e.push(r.buffer),r}if(i instanceof ImageData)return e&&e.push(i.data.buffer),i;if(Array.isArray(i)){const r=[];for(const a of i)r.push(Mn(a,e));return r}if(typeof i=="object"){const r=i.constructor,a=r._classRegistryKey;if(!a)throw new Error("can't serialize object of unregistered class");if(!pn[a])throw new Error(`${a} is not registered.`);const o=r.serialize?r.serialize(i,e):{};if(r.serialize){if(e&&o===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const u in i){if(!i.hasOwnProperty(u)||pn[a].omit.indexOf(u)>=0)continue;const m=i[u];o[u]=pn[a].shallow.indexOf(u)>=0?m:Mn(m,e)}i instanceof Error&&(o.message=i.message)}if(o.$name)throw new Error("$name property is reserved for worker serialization logic.");return a!=="Object"&&(o.$name=a),o}throw new Error("can't serialize object of type "+typeof i)}function _a(i){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||Ds(i)||Mi(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(_a);if(typeof i=="object"){const e=i.$name||"Object";if(!pn[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=pn[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const a=Object.create(r.prototype);for(const o of Object.keys(i)){if(o==="$name")continue;const u=i[o];a[o]=pn[e].shallow.indexOf(o)>=0?u:_a(u)}return a}throw new Error("can't deserialize object of type "+typeof i)}class ic{constructor(){this.first=!0}update(e,r){const a=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=a,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=a,!0):(this.lastFloorZoom>a?(this.lastIntegerZoom=a+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<a&&(this.lastIntegerZoom=a,this.lastIntegerZoomTime=r),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=a,!0))}}const Le={"Latin-1 Supplement":i=>i>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function Ao(i){for(const e of i)if(Eo(e.charCodeAt(0)))return!0;return!1}function Co(i){for(const e of i)if(!Lh(e.charCodeAt(0)))return!1;return!0}function Lh(i){return!(Le.Arabic(i)||Le["Arabic Supplement"](i)||Le["Arabic Extended-A"](i)||Le["Arabic Presentation Forms-A"](i)||Le["Arabic Presentation Forms-B"](i))}function Eo(i){return!(i!==746&&i!==747&&(i<4352||!(Le["Bopomofo Extended"](i)||Le.Bopomofo(i)||Le["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||Le["CJK Compatibility Ideographs"](i)||Le["CJK Compatibility"](i)||Le["CJK Radicals Supplement"](i)||Le["CJK Strokes"](i)||!(!Le["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Le["CJK Unified Ideographs Extension A"](i)||Le["CJK Unified Ideographs"](i)||Le["Enclosed CJK Letters and Months"](i)||Le["Hangul Compatibility Jamo"](i)||Le["Hangul Jamo Extended-A"](i)||Le["Hangul Jamo Extended-B"](i)||Le["Hangul Jamo"](i)||Le["Hangul Syllables"](i)||Le.Hiragana(i)||Le["Ideographic Description Characters"](i)||Le.Kanbun(i)||Le["Kangxi Radicals"](i)||Le["Katakana Phonetic Extensions"](i)||Le.Katakana(i)&&i!==12540||!(!Le["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!Le["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||Le["Unified Canadian Aboriginal Syllabics"](i)||Le["Unified Canadian Aboriginal Syllabics Extended"](i)||Le["Vertical Forms"](i)||Le["Yijing Hexagram Symbols"](i)||Le["Yi Syllables"](i)||Le["Yi Radicals"](i))))}function rc(i){return!(Eo(i)||function(e){return!!(Le["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||Le["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||Le["Letterlike Symbols"](e)||Le["Number Forms"](e)||Le["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||Le["Control Pictures"](e)&&e!==9251||Le["Optical Character Recognition"](e)||Le["Enclosed Alphanumerics"](e)||Le["Geometric Shapes"](e)||Le["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Le["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Le["CJK Symbols and Punctuation"](e)||Le.Katakana(e)||Le["Private Use Area"](e)||Le["CJK Compatibility Forms"](e)||Le["Small Form Variants"](e)||Le["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function nc(i){return i>=1424&&i<=2303||Le["Arabic Presentation Forms-A"](i)||Le["Arabic Presentation Forms-B"](i)}function ac(i,e){return!(!e&&nc(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Le.Khmer(i))}function zh(i){for(const e of i)if(nc(e.charCodeAt(0)))return!0;return!1}const Po="deferred",Mo="loading",ko="loaded";let Lo=null,tr="unavailable",kn=null;const Ha=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(tr="error"),Lo&&Lo(i)};function zo(){Wa.fire(new Sn("pluginStateChange",{pluginStatus:tr,pluginURL:kn}))}const Wa=new On,Do=function(){return tr},sc=function(){if(tr!==Po||!kn)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");tr=Mo,zo(),kn&&Ra({url:kn},i=>{i?Ha(i):(tr=ko,zo())})},pr={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>tr===ko||pr.applyArabicShaping!=null,isLoading:()=>tr===Mo,setState(i){if(!Vt())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");tr=i.pluginStatus,kn=i.pluginURL},isParsed(){if(!Vt())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return pr.applyArabicShaping!=null&&pr.processBidirectionalText!=null&&pr.processStyledBidirectionalText!=null},getPluginURL(){if(!Vt())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return kn}};class Xt{constructor(e,r){this.zoom=e,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new ic,this.transition={})}isSupportedScript(e){return function(r,a){for(const o of r)if(!ac(o.charCodeAt(0),a))return!1;return!0}(e,pr.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,r=e-Math.floor(e),a=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*a}:{fromScale:.5,toScale:1,t:1-(1-a)*r}}}class Rs{constructor(e,r){this.property=e,this.value=r,this.expression=function(a,o){if(ii(a))return new Na(a,o);if(Is(a)){const u=wo(a,o);if(u.result==="error")throw new Error(u.value.map(m=>`${m.key}: ${m.message}`).join(", "));return u.value}{let u=a;return o.type==="color"&&typeof a=="string"?u=Nt.parse(a):o.type!=="padding"||typeof a!="number"&&!Array.isArray(a)?o.type==="variableAnchorOffsetCollection"&&Array.isArray(a)&&(u=Sr.parse(a)):u=lr.parse(a),{kind:"constant",evaluate:()=>u}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,a){return this.property.possiblyEvaluate(this,e,r,a)}}class Ro{constructor(e){this.property=e,this.value=new Rs(e,void 0)}transitioned(e,r){return new lc(this.property,this.value,r,Ve({},e.transition,this.transition),e.now)}untransitioned(){return new lc(this.property,this.value,null,{},0)}}class oc{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return it(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Ro(this._values[e].property)),this._values[e].value=new Rs(this._values[e].property,r===null?void 0:it(r))}getTransition(e){return it(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Ro(this._values[e].property)),this._values[e].transition=it(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const a=this.getValue(r);a!==void 0&&(e[r]=a);const o=this.getTransition(r);o!==void 0&&(e[`${r}-transition`]=o)}return e}transitioned(e,r){const a=new cc(this._properties);for(const o of Object.keys(this._values))a._values[o]=this._values[o].transitioned(e,r._values[o]);return a}untransitioned(){const e=new cc(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class lc{constructor(e,r,a,o,u){this.property=e,this.value=r,this.begin=u+o.delay||0,this.end=this.begin+o.duration||0,e.specification.transition&&(o.delay||o.duration)&&(this.prior=a)}possiblyEvaluate(e,r,a){const o=e.now||0,u=this.value.possiblyEvaluate(e,r,a),m=this.prior;if(m){if(o>this.end)return this.prior=null,u;if(this.value.isDataDriven())return this.prior=null,u;if(o<this.begin)return m.possiblyEvaluate(e,r,a);{const f=(o-this.begin)/(this.end-this.begin);return this.property.interpolate(m.possiblyEvaluate(e,r,a),u,function(v){if(v<=0)return 0;if(v>=1)return 1;const w=v*v,T=w*v;return 4*(v<.5?T:3*(v-w)+T-.75)}(f))}}return u}}class cc{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,a){const o=new Bs(this._properties);for(const u of Object.keys(this._values))o._values[u]=this._values[u].possiblyEvaluate(e,r,a);return o}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Dh{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return it(this._values[e].value)}setValue(e,r){this._values[e]=new Rs(this._values[e].property,r===null?void 0:it(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const a=this.getValue(r);a!==void 0&&(e[r]=a)}return e}possiblyEvaluate(e,r,a){const o=new Bs(this._properties);for(const u of Object.keys(this._values))o._values[u]=this._values[u].possiblyEvaluate(e,r,a);return o}}class Hi{constructor(e,r,a){this.property=e,this.value=r,this.parameters=a}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,a,o){return this.property.evaluate(this.value,this.parameters,e,r,a,o)}}class Bs{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class je{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,a){const o=cr[this.specification.type];return o?o(e,r,a):e}}class We{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,a,o){return new Hi(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},a,o)}:e.expression,r)}interpolate(e,r,a){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new Hi(this,{kind:"constant",value:void 0},e.parameters);const o=cr[this.specification.type];if(o){const u=o(e.value.value,r.value.value,a);return new Hi(this,{kind:"constant",value:u},e.parameters)}return e}evaluate(e,r,a,o,u,m){return e.kind==="constant"?e.value:e.evaluate(r,a,o,u,m)}}class Ka extends We{possiblyEvaluate(e,r,a,o){if(e.value===void 0)return new Hi(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const u=e.expression.evaluate(r,null,{},a,o),m=e.property.specification.type==="resolvedImage"&&typeof u!="string"?u.name:u,f=this._calculate(m,m,m,r);return new Hi(this,{kind:"constant",value:f},r)}if(e.expression.kind==="camera"){const u=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new Hi(this,{kind:"constant",value:u},r)}return new Hi(this,e.expression,r)}evaluate(e,r,a,o,u,m){if(e.kind==="source"){const f=e.evaluate(r,a,o,u,m);return this._calculate(f,f,f,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},a,o),e.evaluate({zoom:Math.floor(r.zoom)},a,o),e.evaluate({zoom:Math.floor(r.zoom)+1},a,o),r):e.value}_calculate(e,r,a,o){return o.zoom>o.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:a,to:r}}interpolate(e){return e}}class Bo{constructor(e){this.specification=e}possiblyEvaluate(e,r,a,o){if(e.value!==void 0){if(e.expression.kind==="constant"){const u=e.expression.evaluate(r,null,{},a,o);return this._calculate(u,u,u,r)}return this._calculate(e.expression.evaluate(new Xt(Math.floor(r.zoom-1),r)),e.expression.evaluate(new Xt(Math.floor(r.zoom),r)),e.expression.evaluate(new Xt(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,a,o){return o.zoom>o.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:a,to:r}}interpolate(e){return e}}class Fo{constructor(e){this.specification=e}possiblyEvaluate(e,r,a,o){return!!e.expression.evaluate(r,null,{},a,o)}interpolate(){return!1}}class di{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in e){const a=e[r];a.specification.overridable&&this.overridableProperties.push(r);const o=this.defaultPropertyValues[r]=new Rs(a,void 0),u=this.defaultTransitionablePropertyValues[r]=new Ro(a);this.defaultTransitioningPropertyValues[r]=u.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=o.possiblyEvaluate({})}}}De("DataDrivenProperty",We),De("DataConstantProperty",je),De("CrossFadedDataDrivenProperty",Ka),De("CrossFadedProperty",Bo),De("ColorRampProperty",Fo);const Oo="-transition";class Cr extends On{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new Dh(r.layout)),r.paint)){this._transitionablePaint=new oc(r.paint);for(const a in e.paint)this.setPaintProperty(a,e.paint[a],{validate:!1});for(const a in e.layout)this.setLayoutProperty(a,e.layout[a],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Bs(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,a={}){r!=null&&this._validate(tc,`layers.${this.id}.layout.${e}`,e,r,a)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(Oo)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,a={}){if(r!=null&&this._validate(Io,`layers.${this.id}.paint.${e}`,e,r,a))return!1;if(e.endsWith(Oo))return this._transitionablePaint.setTransition(e.slice(0,-11),r||void 0),!1;{const o=this._transitionablePaint._values[e],u=o.property.specification["property-type"]==="cross-faded-data-driven",m=o.value.isDataDriven(),f=o.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const v=this._transitionablePaint._values[e].value;return v.isDataDriven()||m||u||this._handleOverridablePaintPropertyUpdate(e,f,v)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,a){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){const e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),Rt(e,(r,a)=>!(r===void 0||a==="layout"&&!Object.keys(r).length||a==="paint"&&!Object.keys(r).length))}_validate(e,r,a,o,u={}){return(!u||u.validate!==!1)&&zs(this,e.call(un,{key:r,layerType:this.type,objectKey:a,value:o,styleSpec:ue,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const r=this.paint.get(e);if(r instanceof Hi&&ma(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const hc={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Hn{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class ci{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function ni(i,e=1){let r=0,a=0;return{members:i.map(o=>{const u=hc[o.type].BYTES_PER_ELEMENT,m=r=va(r,Math.max(e,u)),f=o.components||1;return a=Math.max(a,u),r+=u*f,{name:o.name,type:o.type,components:f,offset:m}}),size:va(r,Math.max(a,e)),alignment:e}}function va(i,e){return Math.ceil(i/e)*e}class Xa extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const a=this.length;return this.resize(a+1),this.emplace(a,e,r)}emplace(e,r,a){const o=2*e;return this.int16[o+0]=r,this.int16[o+1]=a,e}}Xa.prototype.bytesPerElement=4,De("StructArrayLayout2i4",Xa);class Ya extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,a){const o=this.length;return this.resize(o+1),this.emplace(o,e,r,a)}emplace(e,r,a,o){const u=3*e;return this.int16[u+0]=r,this.int16[u+1]=a,this.int16[u+2]=o,e}}Ya.prototype.bytesPerElement=6,De("StructArrayLayout3i6",Ya);class Wn extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,a,o){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,a,o)}emplace(e,r,a,o,u){const m=4*e;return this.int16[m+0]=r,this.int16[m+1]=a,this.int16[m+2]=o,this.int16[m+3]=u,e}}Wn.prototype.bytesPerElement=8,De("StructArrayLayout4i8",Wn);class No extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,a,o,u,m){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,a,o,u,m)}emplace(e,r,a,o,u,m,f){const v=6*e;return this.int16[v+0]=r,this.int16[v+1]=a,this.int16[v+2]=o,this.int16[v+3]=u,this.int16[v+4]=m,this.int16[v+5]=f,e}}No.prototype.bytesPerElement=12,De("StructArrayLayout2i4i12",No);class Uo extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,a,o,u,m){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,a,o,u,m)}emplace(e,r,a,o,u,m,f){const v=4*e,w=8*e;return this.int16[v+0]=r,this.int16[v+1]=a,this.uint8[w+4]=o,this.uint8[w+5]=u,this.uint8[w+6]=m,this.uint8[w+7]=f,e}}Uo.prototype.bytesPerElement=8,De("StructArrayLayout2i4ub8",Uo);class xa extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const a=this.length;return this.resize(a+1),this.emplace(a,e,r)}emplace(e,r,a){const o=2*e;return this.float32[o+0]=r,this.float32[o+1]=a,e}}xa.prototype.bytesPerElement=8,De("StructArrayLayout2f8",xa);class Vo extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,a,o,u,m,f,v,w,T){const E=this.length;return this.resize(E+1),this.emplace(E,e,r,a,o,u,m,f,v,w,T)}emplace(e,r,a,o,u,m,f,v,w,T,E){const M=10*e;return this.uint16[M+0]=r,this.uint16[M+1]=a,this.uint16[M+2]=o,this.uint16[M+3]=u,this.uint16[M+4]=m,this.uint16[M+5]=f,this.uint16[M+6]=v,this.uint16[M+7]=w,this.uint16[M+8]=T,this.uint16[M+9]=E,e}}Vo.prototype.bytesPerElement=20,De("StructArrayLayout10ui20",Vo);class $o extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,a,o,u,m,f,v,w,T,E,M){const z=this.length;return this.resize(z+1),this.emplace(z,e,r,a,o,u,m,f,v,w,T,E,M)}emplace(e,r,a,o,u,m,f,v,w,T,E,M,z){const R=12*e;return this.int16[R+0]=r,this.int16[R+1]=a,this.int16[R+2]=o,this.int16[R+3]=u,this.uint16[R+4]=m,this.uint16[R+5]=f,this.uint16[R+6]=v,this.uint16[R+7]=w,this.int16[R+8]=T,this.int16[R+9]=E,this.int16[R+10]=M,this.int16[R+11]=z,e}}$o.prototype.bytesPerElement=24,De("StructArrayLayout4i4ui4i24",$o);class zt extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,a){const o=this.length;return this.resize(o+1),this.emplace(o,e,r,a)}emplace(e,r,a,o){const u=3*e;return this.float32[u+0]=r,this.float32[u+1]=a,this.float32[u+2]=o,e}}zt.prototype.bytesPerElement=12,De("StructArrayLayout3f12",zt);class h extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint32[1*e+0]=r,e}}h.prototype.bytesPerElement=4,De("StructArrayLayout1ul4",h);class t extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,a,o,u,m,f,v,w){const T=this.length;return this.resize(T+1),this.emplace(T,e,r,a,o,u,m,f,v,w)}emplace(e,r,a,o,u,m,f,v,w,T){const E=10*e,M=5*e;return this.int16[E+0]=r,this.int16[E+1]=a,this.int16[E+2]=o,this.int16[E+3]=u,this.int16[E+4]=m,this.int16[E+5]=f,this.uint32[M+3]=v,this.uint16[E+8]=w,this.uint16[E+9]=T,e}}t.prototype.bytesPerElement=20,De("StructArrayLayout6i1ul2ui20",t);class n extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,a,o,u,m){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,a,o,u,m)}emplace(e,r,a,o,u,m,f){const v=6*e;return this.int16[v+0]=r,this.int16[v+1]=a,this.int16[v+2]=o,this.int16[v+3]=u,this.int16[v+4]=m,this.int16[v+5]=f,e}}n.prototype.bytesPerElement=12,De("StructArrayLayout2i2i2i12",n);class s extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,a,o,u){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,a,o,u)}emplace(e,r,a,o,u,m){const f=4*e,v=8*e;return this.float32[f+0]=r,this.float32[f+1]=a,this.float32[f+2]=o,this.int16[v+6]=u,this.int16[v+7]=m,e}}s.prototype.bytesPerElement=16,De("StructArrayLayout2f1f2i16",s);class c extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,a,o){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,a,o)}emplace(e,r,a,o,u){const m=12*e,f=3*e;return this.uint8[m+0]=r,this.uint8[m+1]=a,this.float32[f+1]=o,this.float32[f+2]=u,e}}c.prototype.bytesPerElement=12,De("StructArrayLayout2ub2f12",c);class p extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,a){const o=this.length;return this.resize(o+1),this.emplace(o,e,r,a)}emplace(e,r,a,o){const u=3*e;return this.uint16[u+0]=r,this.uint16[u+1]=a,this.uint16[u+2]=o,e}}p.prototype.bytesPerElement=6,De("StructArrayLayout3ui6",p);class g extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,a,o,u,m,f,v,w,T,E,M,z,R,O,Z,K){const re=this.length;return this.resize(re+1),this.emplace(re,e,r,a,o,u,m,f,v,w,T,E,M,z,R,O,Z,K)}emplace(e,r,a,o,u,m,f,v,w,T,E,M,z,R,O,Z,K,re){const Y=24*e,ae=12*e,le=48*e;return this.int16[Y+0]=r,this.int16[Y+1]=a,this.uint16[Y+2]=o,this.uint16[Y+3]=u,this.uint32[ae+2]=m,this.uint32[ae+3]=f,this.uint32[ae+4]=v,this.uint16[Y+10]=w,this.uint16[Y+11]=T,this.uint16[Y+12]=E,this.float32[ae+7]=M,this.float32[ae+8]=z,this.uint8[le+36]=R,this.uint8[le+37]=O,this.uint8[le+38]=Z,this.uint32[ae+10]=K,this.int16[Y+22]=re,e}}g.prototype.bytesPerElement=48,De("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",g);class _ extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,a,o,u,m,f,v,w,T,E,M,z,R,O,Z,K,re,Y,ae,le,ge,ze,Oe,ke,Me,Se,Re){const Ae=this.length;return this.resize(Ae+1),this.emplace(Ae,e,r,a,o,u,m,f,v,w,T,E,M,z,R,O,Z,K,re,Y,ae,le,ge,ze,Oe,ke,Me,Se,Re)}emplace(e,r,a,o,u,m,f,v,w,T,E,M,z,R,O,Z,K,re,Y,ae,le,ge,ze,Oe,ke,Me,Se,Re,Ae){const xe=32*e,Ze=16*e;return this.int16[xe+0]=r,this.int16[xe+1]=a,this.int16[xe+2]=o,this.int16[xe+3]=u,this.int16[xe+4]=m,this.int16[xe+5]=f,this.int16[xe+6]=v,this.int16[xe+7]=w,this.uint16[xe+8]=T,this.uint16[xe+9]=E,this.uint16[xe+10]=M,this.uint16[xe+11]=z,this.uint16[xe+12]=R,this.uint16[xe+13]=O,this.uint16[xe+14]=Z,this.uint16[xe+15]=K,this.uint16[xe+16]=re,this.uint16[xe+17]=Y,this.uint16[xe+18]=ae,this.uint16[xe+19]=le,this.uint16[xe+20]=ge,this.uint16[xe+21]=ze,this.uint16[xe+22]=Oe,this.uint32[Ze+12]=ke,this.float32[Ze+13]=Me,this.float32[Ze+14]=Se,this.uint16[xe+30]=Re,this.uint16[xe+31]=Ae,e}}_.prototype.bytesPerElement=64,De("StructArrayLayout8i15ui1ul2f2ui64",_);class b extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.float32[1*e+0]=r,e}}b.prototype.bytesPerElement=4,De("StructArrayLayout1f4",b);class S extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,a){const o=this.length;return this.resize(o+1),this.emplace(o,e,r,a)}emplace(e,r,a,o){const u=3*e;return this.uint16[6*e+0]=r,this.float32[u+1]=a,this.float32[u+2]=o,e}}S.prototype.bytesPerElement=12,De("StructArrayLayout1ui2f12",S);class I extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,a){const o=this.length;return this.resize(o+1),this.emplace(o,e,r,a)}emplace(e,r,a,o){const u=4*e;return this.uint32[2*e+0]=r,this.uint16[u+2]=a,this.uint16[u+3]=o,e}}I.prototype.bytesPerElement=8,De("StructArrayLayout1ul2ui8",I);class C extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const a=this.length;return this.resize(a+1),this.emplace(a,e,r)}emplace(e,r,a){const o=2*e;return this.uint16[o+0]=r,this.uint16[o+1]=a,e}}C.prototype.bytesPerElement=4,De("StructArrayLayout2ui4",C);class L extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint16[1*e+0]=r,e}}L.prototype.bytesPerElement=2,De("StructArrayLayout1ui2",L);class U extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,a,o){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,a,o)}emplace(e,r,a,o,u){const m=4*e;return this.float32[m+0]=r,this.float32[m+1]=a,this.float32[m+2]=o,this.float32[m+3]=u,e}}U.prototype.bytesPerElement=16,De("StructArrayLayout4f16",U);class N extends Hn{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 de(this.anchorPointX,this.anchorPointY)}}N.prototype.size=20;class j extends t{get(e){return new N(this,e)}}De("CollisionBoxArray",j);class F extends Hn{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}F.prototype.size=48;class ee extends g{get(e){return new F(this,e)}}De("PlacedSymbolArray",ee);class se extends Hn{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}se.prototype.size=64;class W extends _{get(e){return new se(this,e)}}De("SymbolInstanceArray",W);class te extends b{getoffsetX(e){return this.float32[1*e+0]}}De("GlyphOffsetArray",te);class ce extends Ya{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}De("SymbolLineVertexArray",ce);class he extends Hn{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]}}he.prototype.size=12;class fe extends S{get(e){return new he(this,e)}}De("TextAnchorOffsetArray",fe);class ve extends Hn{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]}}ve.prototype.size=8;class _e extends I{get(e){return new ve(this,e)}}De("FeatureIndexArray",_e);class we extends Xa{}class Fe extends Xa{}class xt extends Xa{}class Pe extends No{}class Ke extends Uo{}class Ne extends xa{}class Ut extends Vo{}class _t extends $o{}class ht extends zt{}class bt extends h{}class hi extends n{}class Wt extends c{}class zi extends p{}class xi extends C{}const mi=ni([{name:"a_pos",components:2,type:"Int16"}],4),{members:dr}=mi;class Yt{constructor(e=[]){this.segments=e}prepareSegment(e,r,a,o){let u=this.segments[this.segments.length-1];return e>Yt.MAX_VERTEX_ARRAY_LENGTH&&st(`Max vertices per segment is ${Yt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!u||u.vertexLength+e>Yt.MAX_VERTEX_ARRAY_LENGTH||u.sortKey!==o)&&(u={vertexOffset:r.length,primitiveOffset:a.length,vertexLength:0,primitiveLength:0},o!==void 0&&(u.sortKey=o),this.segments.push(u)),u}get(){return this.segments}destroy(){for(const e of this.segments)for(const r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,a,o){return new Yt([{vertexOffset:e,primitiveOffset:r,vertexLength:a,primitiveLength:o,vaos:{},sortKey:0}])}}function Wr(i,e){return 256*(i=Qe(Math.floor(i),0,255))+Qe(Math.floor(e),0,255)}Yt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,De("SegmentVector",Yt);const Kr=ni([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Ln={exports:{}},Kn={exports:{}};Kn.exports=function(i,e){var r,a,o,u,m,f,v,w;for(a=i.length-(r=3&i.length),o=e,m=3432918353,f=461845907,w=0;w<a;)v=255&i.charCodeAt(w)|(255&i.charCodeAt(++w))<<8|(255&i.charCodeAt(++w))<<16|(255&i.charCodeAt(++w))<<24,++w,o=27492+(65535&(u=5*(65535&(o=(o^=v=(65535&(v=(v=(65535&v)*m+(((v>>>16)*m&65535)<<16)&4294967295)<<15|v>>>17))*f+(((v>>>16)*f&65535)<<16)&4294967295)<<13|o>>>19))+((5*(o>>>16)&65535)<<16)&4294967295))+((58964+(u>>>16)&65535)<<16);switch(v=0,r){case 3:v^=(255&i.charCodeAt(w+2))<<16;case 2:v^=(255&i.charCodeAt(w+1))<<8;case 1:o^=v=(65535&(v=(v=(65535&(v^=255&i.charCodeAt(w)))*m+(((v>>>16)*m&65535)<<16)&4294967295)<<15|v>>>17))*f+(((v>>>16)*f&65535)<<16)&4294967295}return o^=i.length,o=2246822507*(65535&(o^=o>>>16))+((2246822507*(o>>>16)&65535)<<16)&4294967295,o=3266489909*(65535&(o^=o>>>13))+((3266489909*(o>>>16)&65535)<<16)&4294967295,(o^=o>>>16)>>>0};var ba=Kn.exports,Ui={exports:{}};Ui.exports=function(i,e){for(var r,a=i.length,o=e^a,u=0;a>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(u)|(255&i.charCodeAt(++u))<<8|(255&i.charCodeAt(++u))<<16|(255&i.charCodeAt(++u))<<24))+((1540483477*(r>>>16)&65535)<<16),o=1540483477*(65535&o)+((1540483477*(o>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),a-=4,++u;switch(a){case 3:o^=(255&i.charCodeAt(u+2))<<16;case 2:o^=(255&i.charCodeAt(u+1))<<8;case 1:o=1540483477*(65535&(o^=255&i.charCodeAt(u)))+((1540483477*(o>>>16)&65535)<<16)}return o=1540483477*(65535&(o^=o>>>13))+((1540483477*(o>>>16)&65535)<<16),(o^=o>>>15)>>>0};var Di=ba,Wi=Ui.exports;Ln.exports=Di,Ln.exports.murmur3=Di,Ln.exports.murmur2=Wi;var Xn=q(Ln.exports);class ui{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,a,o){this.ids.push(bi(e)),this.positions.push(r,a,o)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=bi(e);let a=0,o=this.ids.length-1;for(;a<o;){const m=a+o>>1;this.ids[m]>=r?o=m:a=m+1}const u=[];for(;this.ids[a]===r;)u.push({index:this.positions[3*a],start:this.positions[3*a+1],end:this.positions[3*a+2]}),a++;return u}static serialize(e,r){const a=new Float64Array(e.ids),o=new Uint32Array(e.positions);return ir(a,o,0,a.length-1),r&&r.push(a.buffer,o.buffer),{ids:a,positions:o}}static deserialize(e){const r=new ui;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function bi(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Xn(String(i))}function ir(i,e,r,a){for(;r<a;){const o=i[r+a>>1];let u=r-1,m=a+1;for(;;){do u++;while(i[u]<o);do m--;while(i[m]>o);if(u>=m)break;pi(i,u,m),pi(e,3*u,3*m),pi(e,3*u+1,3*m+1),pi(e,3*u+2,3*m+2)}m-r<a-m?(ir(i,e,r,m),r=m+1):(ir(i,e,m+1,a),a=m)}}function pi(i,e,r){const a=i[e];i[e]=i[r],i[r]=a}De("FeaturePositionMap",ui);class Yn{constructor(e,r){this.gl=e.gl,this.location=r}}class Fs extends Yn{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class uc extends Yn{constructor(e,r){super(e,r),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class pc extends Yn{constructor(e,r){super(e,r),this.current=Nt.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}const Rh=new Float32Array(16);function jo(i){return[Wr(255*i.r,255*i.g),Wr(255*i.b,255*i.a)]}class Xr{constructor(e,r,a){this.value=e,this.uniformNames=r.map(o=>`u_${o}`),this.type=a}setUniform(e,r,a){e.set(a.constantOr(this.value))}getBinding(e,r,a){return this.type==="color"?new pc(e,r):new Fs(e,r)}}class Jn{constructor(e,r){this.uniformNames=r.map(a=>`u_${a}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,a,o){const u=o==="u_pattern_to"?this.patternTo:o==="u_pattern_from"?this.patternFrom:o==="u_pixel_ratio_to"?this.pixelRatioTo:o==="u_pixel_ratio_from"?this.pixelRatioFrom:null;u&&e.set(u)}getBinding(e,r,a){return a.substr(0,9)==="u_pattern"?new uc(e,r):new Fs(e,r)}}class Yr{constructor(e,r,a,o){this.expression=e,this.type=a,this.maxValue=0,this.paintVertexAttributes=r.map(u=>({name:`a_${u}`,type:"Float32",components:a==="color"?2:1,offset:0})),this.paintVertexArray=new o}populatePaintArray(e,r,a,o,u){const m=this.paintVertexArray.length,f=this.expression.evaluate(new Xt(0),r,{},o,[],u);this.paintVertexArray.resize(e),this._setPaintValue(m,e,f)}updatePaintArray(e,r,a,o){const u=this.expression.evaluate({zoom:0},a,o);this._setPaintValue(e,r,u)}_setPaintValue(e,r,a){if(this.type==="color"){const o=jo(a);for(let u=e;u<r;u++)this.paintVertexArray.emplace(u,o[0],o[1])}else{for(let o=e;o<r;o++)this.paintVertexArray.emplace(o,a);this.maxValue=Math.max(this.maxValue,Math.abs(a))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Er{constructor(e,r,a,o,u,m){this.expression=e,this.uniformNames=r.map(f=>`u_${f}_t`),this.type=a,this.useIntegerZoom=o,this.zoom=u,this.maxValue=0,this.paintVertexAttributes=r.map(f=>({name:`a_${f}`,type:"Float32",components:a==="color"?4:2,offset:0})),this.paintVertexArray=new m}populatePaintArray(e,r,a,o,u){const m=this.expression.evaluate(new Xt(this.zoom),r,{},o,[],u),f=this.expression.evaluate(new Xt(this.zoom+1),r,{},o,[],u),v=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(v,e,m,f)}updatePaintArray(e,r,a,o){const u=this.expression.evaluate({zoom:this.zoom},a,o),m=this.expression.evaluate({zoom:this.zoom+1},a,o);this._setPaintValue(e,r,u,m)}_setPaintValue(e,r,a,o){if(this.type==="color"){const u=jo(a),m=jo(o);for(let f=e;f<r;f++)this.paintVertexArray.emplace(f,u[0],u[1],m[0],m[1])}else{for(let u=e;u<r;u++)this.paintVertexArray.emplace(u,a,o);this.maxValue=Math.max(this.maxValue,Math.abs(a),Math.abs(o))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,r){const a=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,o=Qe(this.expression.interpolationFactor(a,this.zoom,this.zoom+1),0,1);e.set(o)}getBinding(e,r,a){return new Fs(e,r)}}class Jr{constructor(e,r,a,o,u,m){this.expression=e,this.type=r,this.useIntegerZoom=a,this.zoom=o,this.layerId=m,this.zoomInPaintVertexArray=new u,this.zoomOutPaintVertexArray=new u}populatePaintArray(e,r,a){const o=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(o,e,r.patterns&&r.patterns[this.layerId],a)}updatePaintArray(e,r,a,o,u){this._setPaintValues(e,r,a.patterns&&a.patterns[this.layerId],u)}_setPaintValues(e,r,a,o){if(!o||!a)return;const{min:u,mid:m,max:f}=a,v=o[u],w=o[m],T=o[f];if(v&&w&&T)for(let E=e;E<r;E++)this.zoomInPaintVertexArray.emplace(E,w.tl[0],w.tl[1],w.br[0],w.br[1],v.tl[0],v.tl[1],v.br[0],v.br[1],w.pixelRatio,v.pixelRatio),this.zoomOutPaintVertexArray.emplace(E,w.tl[0],w.tl[1],w.br[0],w.br[1],T.tl[0],T.tl[1],T.br[0],T.br[1],w.pixelRatio,T.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,Kr.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,Kr.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Go{constructor(e,r,a){this.binders={},this._buffers=[];const o=[];for(const u in e.paint._values){if(!a(u))continue;const m=e.paint.get(u);if(!(m instanceof Hi&&ma(m.property.specification)))continue;const f=a_(u,e.type),v=m.value,w=m.property.specification.type,T=m.property.useIntegerZoom,E=m.property.specification["property-type"],M=E==="cross-faded"||E==="cross-faded-data-driven";if(v.kind==="constant")this.binders[u]=M?new Jn(v.value,f):new Xr(v.value,f,w),o.push(`/u_${u}`);else if(v.kind==="source"||M){const z=vd(u,w,"source");this.binders[u]=M?new Jr(v,w,T,r,z,e.id):new Yr(v,f,w,z),o.push(`/a_${u}`)}else{const z=vd(u,w,"composite");this.binders[u]=new Er(v,f,w,T,r,z),o.push(`/z_${u}`)}}this.cacheKey=o.sort().join("")}getMaxValue(e){const r=this.binders[e];return r instanceof Yr||r instanceof Er?r.maxValue:0}populatePaintArrays(e,r,a,o,u){for(const m in this.binders){const f=this.binders[m];(f instanceof Yr||f instanceof Er||f instanceof Jr)&&f.populatePaintArray(e,r,a,o,u)}}setConstantPatternPositions(e,r){for(const a in this.binders){const o=this.binders[a];o instanceof Jn&&o.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,a,o,u){let m=!1;for(const f in e){const v=r.getPositions(f);for(const w of v){const T=a.feature(w.index);for(const E in this.binders){const M=this.binders[E];if((M instanceof Yr||M instanceof Er||M instanceof Jr)&&M.expression.isStateDependent===!0){const z=o.paint.get(E);M.expression=z.value,M.updatePaintArray(w.start,w.end,T,e[f],u),m=!0}}}}return m}defines(){const e=[];for(const r in this.binders){const a=this.binders[r];(a instanceof Xr||a instanceof Jn)&&e.push(...a.uniformNames.map(o=>`#define HAS_UNIFORM_${o}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const a=this.binders[r];if(a instanceof Yr||a instanceof Er)for(let o=0;o<a.paintVertexAttributes.length;o++)e.push(a.paintVertexAttributes[o].name);else if(a instanceof Jr)for(let o=0;o<Kr.members.length;o++)e.push(Kr.members[o].name)}return e}getBinderUniforms(){const e=[];for(const r in this.binders){const a=this.binders[r];if(a instanceof Xr||a instanceof Jn||a instanceof Er)for(const o of a.uniformNames)e.push(o)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,r){const a=[];for(const o in this.binders){const u=this.binders[o];if(u instanceof Xr||u instanceof Jn||u instanceof Er){for(const m of u.uniformNames)if(r[m]){const f=u.getBinding(e,r[m],m);a.push({name:m,property:o,binding:f})}}}return a}setUniforms(e,r,a,o){for(const{name:u,property:m,binding:f}of r)this.binders[m].setUniform(f,o,a.get(m),u)}updatePaintBuffers(e){this._buffers=[];for(const r in this.binders){const a=this.binders[r];if(e&&a instanceof Jr){const o=e.fromScale===2?a.zoomInPaintVertexBuffer:a.zoomOutPaintVertexBuffer;o&&this._buffers.push(o)}else(a instanceof Yr||a instanceof Er)&&a.paintVertexBuffer&&this._buffers.push(a.paintVertexBuffer)}}upload(e){for(const r in this.binders){const a=this.binders[r];(a instanceof Yr||a instanceof Er||a instanceof Jr)&&a.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const r=this.binders[e];(r instanceof Yr||r instanceof Er||r instanceof Jr)&&r.destroy()}}}class dn{constructor(e,r,a=()=>!0){this.programConfigurations={};for(const o of e)this.programConfigurations[o.id]=new Go(o,r,a);this.needsUpload=!1,this._featureMap=new ui,this._bufferOffset=0}populatePaintArrays(e,r,a,o,u,m){for(const f in this.programConfigurations)this.programConfigurations[f].populatePaintArrays(e,r,o,u,m);r.id!==void 0&&this._featureMap.add(r.id,a,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,a,o){for(const u of a)this.needsUpload=this.programConfigurations[u.id].updatePaintArrays(e,this._featureMap,r,u,o)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function a_(i,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}function vd(i,e,r){const a={color:{source:xa,composite:U},number:{source:b,composite:xa}},o=function(u){return{"line-pattern":{source:Ut,composite:Ut},"fill-pattern":{source:Ut,composite:Ut},"fill-extrusion-pattern":{source:Ut,composite:Ut}}[u]}(i);return o&&o[r]||a[e][r]}De("ConstantBinder",Xr),De("CrossFadedConstantBinder",Jn),De("SourceExpressionBinder",Yr),De("CrossFadedCompositeBinder",Jr),De("CompositeExpressionBinder",Er),De("ProgramConfiguration",Go,{omit:["_buffers"]}),De("ProgramConfigurationSet",dn);const _i=8192,Bh=Math.pow(2,14)-1,xd=-Bh-1;function Ja(i){const e=_i/i.extent,r=i.loadGeometry();for(let a=0;a<r.length;a++){const o=r[a];for(let u=0;u<o.length;u++){const m=o[u],f=Math.round(m.x*e),v=Math.round(m.y*e);m.x=Qe(f,xd,Bh),m.y=Qe(v,xd,Bh),(f<m.x||f>m.x+1||v<m.y||v>m.y+1)&&st("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Qa(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?Ja(i):[]}}function dc(i,e,r,a,o){i.emplaceBack(2*e+(a+1)/2,2*r+(o+1)/2)}class Fh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Fe,this.indexArray=new zi,this.segments=new Yt,this.programConfigurations=new dn(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,a){const o=this.layers[0],u=[];let m=null,f=!1;o.type==="circle"&&(m=o.layout.get("circle-sort-key"),f=!m.isConstant());for(const{feature:v,id:w,index:T,sourceLayerIndex:E}of e){const M=this.layers[0]._featureFilter.needGeometry,z=Qa(v,M);if(!this.layers[0]._featureFilter.filter(new Xt(this.zoom),z,a))continue;const R=f?m.evaluate(z,{},a):void 0,O={id:w,properties:v.properties,type:v.type,sourceLayerIndex:E,index:T,geometry:M?z.geometry:Ja(v),patterns:{},sortKey:R};u.push(O)}f&&u.sort((v,w)=>v.sortKey-w.sortKey);for(const v of u){const{geometry:w,index:T,sourceLayerIndex:E}=v,M=e[T].feature;this.addFeature(v,w,T,a),r.featureIndex.insert(M,w,T,E,this.index)}}update(e,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,dr),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,a,o){for(const u of r)for(const m of u){const f=m.x,v=m.y;if(f<0||f>=_i||v<0||v>=_i)continue;const w=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),T=w.vertexLength;dc(this.layoutVertexArray,f,v,-1,-1),dc(this.layoutVertexArray,f,v,1,-1),dc(this.layoutVertexArray,f,v,1,1),dc(this.layoutVertexArray,f,v,-1,1),this.indexArray.emplaceBack(T,T+1,T+2),this.indexArray.emplaceBack(T,T+3,T+2),w.vertexLength+=4,w.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a,{},o)}}function bd(i,e){for(let r=0;r<i.length;r++)if(Os(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Os(i,e[r]))return!0;return!!Oh(i,e)}function s_(i,e,r){return!!Os(i,e)||!!Nh(e,i,r)}function wd(i,e){if(i.length===1)return Td(e,i[0]);for(let r=0;r<e.length;r++){const a=e[r];for(let o=0;o<a.length;o++)if(Os(i,a[o]))return!0}for(let r=0;r<i.length;r++)if(Td(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Oh(i,e[r]))return!0;return!1}function o_(i,e,r){if(i.length>1){if(Oh(i,e))return!0;for(let a=0;a<e.length;a++)if(Nh(e[a],i,r))return!0}for(let a=0;a<i.length;a++)if(Nh(i[a],e,r))return!0;return!1}function Oh(i,e){if(i.length===0||e.length===0)return!1;for(let r=0;r<i.length-1;r++){const a=i[r],o=i[r+1];for(let u=0;u<e.length-1;u++)if(l_(a,o,e[u],e[u+1]))return!0}return!1}function l_(i,e,r,a){return yt(i,r,a)!==yt(e,r,a)&&yt(i,e,r)!==yt(i,e,a)}function Nh(i,e,r){const a=r*r;if(e.length===1)return i.distSqr(e[0])<a;for(let o=1;o<e.length;o++)if(Sd(i,e[o-1],e[o])<a)return!0;return!1}function Sd(i,e,r){const a=e.distSqr(r);if(a===0)return i.distSqr(e);const o=((i.x-e.x)*(r.x-e.x)+(i.y-e.y)*(r.y-e.y))/a;return i.distSqr(o<0?e:o>1?r:r.sub(e)._mult(o)._add(e))}function Td(i,e){let r,a,o,u=!1;for(let m=0;m<i.length;m++){r=i[m];for(let f=0,v=r.length-1;f<r.length;v=f++)a=r[f],o=r[v],a.y>e.y!=o.y>e.y&&e.x<(o.x-a.x)*(e.y-a.y)/(o.y-a.y)+a.x&&(u=!u)}return u}function Os(i,e){let r=!1;for(let a=0,o=i.length-1;a<i.length;o=a++){const u=i[a],m=i[o];u.y>e.y!=m.y>e.y&&e.x<(m.x-u.x)*(e.y-u.y)/(m.y-u.y)+u.x&&(r=!r)}return r}function c_(i,e,r){const a=r[0],o=r[2];if(i.x<a.x&&e.x<a.x||i.x>o.x&&e.x>o.x||i.y<a.y&&e.y<a.y||i.y>o.y&&e.y>o.y)return!1;const u=yt(i,e,r[0]);return u!==yt(i,e,r[1])||u!==yt(i,e,r[2])||u!==yt(i,e,r[3])}function qo(i,e,r){const a=e.paint.get(i).value;return a.kind==="constant"?a.value:r.programConfigurations.get(e.id).getMaxValue(i)}function mc(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function fc(i,e,r,a,o){if(!e[0]&&!e[1])return i;const u=de.convert(e)._mult(o);r==="viewport"&&u._rotate(-a);const m=[];for(let f=0;f<i.length;f++)m.push(i[f].sub(u));return m}let Id,Ad;De("CircleBucket",Fh,{omit:["layers"]});var h_={get paint(){return Ad=Ad||new di({"circle-radius":new We(ue.paint_circle["circle-radius"]),"circle-color":new We(ue.paint_circle["circle-color"]),"circle-blur":new We(ue.paint_circle["circle-blur"]),"circle-opacity":new We(ue.paint_circle["circle-opacity"]),"circle-translate":new je(ue.paint_circle["circle-translate"]),"circle-translate-anchor":new je(ue.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new je(ue.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new je(ue.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new We(ue.paint_circle["circle-stroke-width"]),"circle-stroke-color":new We(ue.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new We(ue.paint_circle["circle-stroke-opacity"])})},get layout(){return Id=Id||new di({"circle-sort-key":new We(ue.layout_circle["circle-sort-key"])})}},rr=1e-6,Ns=typeof Float32Array<"u"?Float32Array:Array;function Uh(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function Cd(i,e,r){var a=e[0],o=e[1],u=e[2],m=e[3],f=e[4],v=e[5],w=e[6],T=e[7],E=e[8],M=e[9],z=e[10],R=e[11],O=e[12],Z=e[13],K=e[14],re=e[15],Y=r[0],ae=r[1],le=r[2],ge=r[3];return i[0]=Y*a+ae*f+le*E+ge*O,i[1]=Y*o+ae*v+le*M+ge*Z,i[2]=Y*u+ae*w+le*z+ge*K,i[3]=Y*m+ae*T+le*R+ge*re,i[4]=(Y=r[4])*a+(ae=r[5])*f+(le=r[6])*E+(ge=r[7])*O,i[5]=Y*o+ae*v+le*M+ge*Z,i[6]=Y*u+ae*w+le*z+ge*K,i[7]=Y*m+ae*T+le*R+ge*re,i[8]=(Y=r[8])*a+(ae=r[9])*f+(le=r[10])*E+(ge=r[11])*O,i[9]=Y*o+ae*v+le*M+ge*Z,i[10]=Y*u+ae*w+le*z+ge*K,i[11]=Y*m+ae*T+le*R+ge*re,i[12]=(Y=r[12])*a+(ae=r[13])*f+(le=r[14])*E+(ge=r[15])*O,i[13]=Y*o+ae*v+le*M+ge*Z,i[14]=Y*u+ae*w+le*z+ge*K,i[15]=Y*m+ae*T+le*R+ge*re,i}Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});var Zo,u_=Cd;function gc(i,e,r){var a=e[0],o=e[1],u=e[2],m=e[3];return i[0]=r[0]*a+r[4]*o+r[8]*u+r[12]*m,i[1]=r[1]*a+r[5]*o+r[9]*u+r[13]*m,i[2]=r[2]*a+r[6]*o+r[10]*u+r[14]*m,i[3]=r[3]*a+r[7]*o+r[11]*u+r[15]*m,i}Zo=new Ns(4),Ns!=Float32Array&&(Zo[0]=0,Zo[1]=0,Zo[2]=0,Zo[3]=0);class p_ extends Cr{constructor(e){super(e,h_)}createBucket(e){return new Fh(e)}queryRadius(e){const r=e;return qo("circle-radius",this,r)+qo("circle-stroke-width",this,r)+mc(this.paint.get("circle-translate"))}queryIntersectsFeature(e,r,a,o,u,m,f,v){const w=fc(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),m.angle,f),T=this.paint.get("circle-radius").evaluate(r,a)+this.paint.get("circle-stroke-width").evaluate(r,a),E=this.paint.get("circle-pitch-alignment")==="map",M=E?w:function(R,O){return R.map(Z=>Ed(Z,O))}(w,v),z=E?T*f:T;for(const R of o)for(const O of R){const Z=E?O:Ed(O,v);let K=z;const re=gc([],[O.x,O.y,0,1],v);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?K*=re[3]/m.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(K*=m.cameraToCenterDistance/re[3]),s_(M,Z,K))return!0}return!1}}function Ed(i,e){const r=gc([],[i.x,i.y,0,1],e);return new de(r[0]/r[3],r[1]/r[3])}class Pd extends Fh{}let Md;De("HeatmapBucket",Pd,{omit:["layers"]});var d_={get paint(){return Md=Md||new di({"heatmap-radius":new We(ue.paint_heatmap["heatmap-radius"]),"heatmap-weight":new We(ue.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new je(ue.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Fo(ue.paint_heatmap["heatmap-color"]),"heatmap-opacity":new je(ue.paint_heatmap["heatmap-opacity"])})}};function Vh(i,{width:e,height:r},a,o){if(o){if(o instanceof Uint8ClampedArray)o=new Uint8Array(o.buffer);else if(o.length!==e*r*a)throw new RangeError(`mismatched image size. expected: ${o.length} but got: ${e*r*a}`)}else o=new Uint8Array(e*r*a);return i.width=e,i.height=r,i.data=o,i}function kd(i,{width:e,height:r},a){if(e===i.width&&r===i.height)return;const o=Vh({},{width:e,height:r},a);$h(i,o,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,e),height:Math.min(i.height,r)},a),i.width=e,i.height=r,i.data=o.data}function $h(i,e,r,a,o,u){if(o.width===0||o.height===0)return e;if(o.width>i.width||o.height>i.height||r.x>i.width-o.width||r.y>i.height-o.height)throw new RangeError("out of range source coordinates for image copy");if(o.width>e.width||o.height>e.height||a.x>e.width-o.width||a.y>e.height-o.height)throw new RangeError("out of range destination coordinates for image copy");const m=i.data,f=e.data;if(m===f)throw new Error("srcData equals dstData, so image is already copied");for(let v=0;v<o.height;v++){const w=((r.y+v)*i.width+r.x)*u,T=((a.y+v)*e.width+a.x)*u;for(let E=0;E<o.width*u;E++)f[T+E]=m[w+E]}return e}class Ho{constructor(e,r){Vh(this,e,1,r)}resize(e){kd(this,e,1)}clone(){return new Ho({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,a,o,u){$h(e,r,a,o,u,1)}}class Rr{constructor(e,r){Vh(this,e,4,r)}resize(e){kd(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Rr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,a,o,u){$h(e,r,a,o,u,4)}}function Ld(i){const e={},r=i.resolution||256,a=i.clips?i.clips.length:1,o=i.image||new Rr({width:r,height:a});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const u=(m,f,v)=>{e[i.evaluationKey]=v;const w=i.expression.evaluate(e);o.data[m+f+0]=Math.floor(255*w.r/w.a),o.data[m+f+1]=Math.floor(255*w.g/w.a),o.data[m+f+2]=Math.floor(255*w.b/w.a),o.data[m+f+3]=Math.floor(255*w.a)};if(i.clips)for(let m=0,f=0;m<a;++m,f+=4*r)for(let v=0,w=0;v<r;v++,w+=4){const T=v/(r-1),{start:E,end:M}=i.clips[m];u(f,w,E*(1-T)+M*T)}else for(let m=0,f=0;m<r;m++,f+=4)u(0,f,m/(r-1));return o}De("AlphaImage",Ho),De("RGBAImage",Rr);class m_ extends Cr{createBucket(e){return new Pd(e)}constructor(e){super(e,d_),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Ld({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let zd;var f_={get paint(){return zd=zd||new di({"hillshade-illumination-direction":new je(ue.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new je(ue.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new je(ue.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new je(ue.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new je(ue.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new je(ue.paint_hillshade["hillshade-accent-color"])})}};class g_ extends Cr{constructor(e){super(e,f_)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const y_=ni([{name:"a_pos",components:2,type:"Int16"}],4),{members:__}=y_;var jh={exports:{}};function yc(i,e,r){r=r||2;var a,o,u,m,f,v,w,T=e&&e.length,E=T?e[0]*r:i.length,M=Dd(i,0,E,r,!0),z=[];if(!M||M.next===M.prev)return z;if(T&&(M=function(O,Z,K,re){var Y,ae,le,ge=[];for(Y=0,ae=Z.length;Y<ae;Y++)(le=Dd(O,Z[Y]*re,Y<ae-1?Z[Y+1]*re:O.length,re,!1))===le.next&&(le.steiner=!0),ge.push(A_(le));for(ge.sort(S_),Y=0;Y<ge.length;Y++)K=T_(ge[Y],K);return K}(i,e,M,r)),i.length>80*r){a=u=i[0],o=m=i[1];for(var R=r;R<E;R+=r)(f=i[R])<a&&(a=f),(v=i[R+1])<o&&(o=v),f>u&&(u=f),v>m&&(m=v);w=(w=Math.max(u-a,m-o))!==0?32767/w:0}return Wo(M,z,r,a,o,w,0),z}function Dd(i,e,r,a,o){var u,m;if(o===Zh(i,e,r,a)>0)for(u=e;u<r;u+=a)m=Fd(u,i[u],i[u+1],m);else for(u=r-a;u>=e;u-=a)m=Fd(u,i[u],i[u+1],m);return m&&_c(m,m.next)&&(Xo(m),m=m.next),m}function es(i,e){if(!i)return i;e||(e=i);var r,a=i;do if(r=!1,a.steiner||!_c(a,a.next)&&fi(a.prev,a,a.next)!==0)a=a.next;else{if(Xo(a),(a=e=a.prev)===a.next)break;r=!0}while(r||a!==e);return e}function Wo(i,e,r,a,o,u,m){if(i){!m&&u&&function(T,E,M,z){var R=T;do R.z===0&&(R.z=Gh(R.x,R.y,E,M,z)),R.prevZ=R.prev,R.nextZ=R.next,R=R.next;while(R!==T);R.prevZ.nextZ=null,R.prevZ=null,function(O){var Z,K,re,Y,ae,le,ge,ze,Oe=1;do{for(K=O,O=null,ae=null,le=0;K;){for(le++,re=K,ge=0,Z=0;Z<Oe&&(ge++,re=re.nextZ);Z++);for(ze=Oe;ge>0||ze>0&&re;)ge!==0&&(ze===0||!re||K.z<=re.z)?(Y=K,K=K.nextZ,ge--):(Y=re,re=re.nextZ,ze--),ae?ae.nextZ=Y:O=Y,Y.prevZ=ae,ae=Y;K=re}ae.nextZ=null,Oe*=2}while(le>1)}(R)}(i,a,o,u);for(var f,v,w=i;i.prev!==i.next;)if(f=i.prev,v=i.next,u?x_(i,a,o,u):v_(i))e.push(f.i/r|0),e.push(i.i/r|0),e.push(v.i/r|0),Xo(i),i=v.next,w=v.next;else if((i=v)===w){m?m===1?Wo(i=b_(es(i),e,r),e,r,a,o,u,2):m===2&&w_(i,e,r,a,o,u):Wo(es(i),e,r,a,o,u,1);break}}}function v_(i){var e=i.prev,r=i,a=i.next;if(fi(e,r,a)>=0)return!1;for(var o=e.x,u=r.x,m=a.x,f=e.y,v=r.y,w=a.y,T=o<u?o<m?o:m:u<m?u:m,E=f<v?f<w?f:w:v<w?v:w,M=o>u?o>m?o:m:u>m?u:m,z=f>v?f>w?f:w:v>w?v:w,R=a.next;R!==e;){if(R.x>=T&&R.x<=M&&R.y>=E&&R.y<=z&&Us(o,f,u,v,m,w,R.x,R.y)&&fi(R.prev,R,R.next)>=0)return!1;R=R.next}return!0}function x_(i,e,r,a){var o=i.prev,u=i,m=i.next;if(fi(o,u,m)>=0)return!1;for(var f=o.x,v=u.x,w=m.x,T=o.y,E=u.y,M=m.y,z=f<v?f<w?f:w:v<w?v:w,R=T<E?T<M?T:M:E<M?E:M,O=f>v?f>w?f:w:v>w?v:w,Z=T>E?T>M?T:M:E>M?E:M,K=Gh(z,R,e,r,a),re=Gh(O,Z,e,r,a),Y=i.prevZ,ae=i.nextZ;Y&&Y.z>=K&&ae&&ae.z<=re;){if(Y.x>=z&&Y.x<=O&&Y.y>=R&&Y.y<=Z&&Y!==o&&Y!==m&&Us(f,T,v,E,w,M,Y.x,Y.y)&&fi(Y.prev,Y,Y.next)>=0||(Y=Y.prevZ,ae.x>=z&&ae.x<=O&&ae.y>=R&&ae.y<=Z&&ae!==o&&ae!==m&&Us(f,T,v,E,w,M,ae.x,ae.y)&&fi(ae.prev,ae,ae.next)>=0))return!1;ae=ae.nextZ}for(;Y&&Y.z>=K;){if(Y.x>=z&&Y.x<=O&&Y.y>=R&&Y.y<=Z&&Y!==o&&Y!==m&&Us(f,T,v,E,w,M,Y.x,Y.y)&&fi(Y.prev,Y,Y.next)>=0)return!1;Y=Y.prevZ}for(;ae&&ae.z<=re;){if(ae.x>=z&&ae.x<=O&&ae.y>=R&&ae.y<=Z&&ae!==o&&ae!==m&&Us(f,T,v,E,w,M,ae.x,ae.y)&&fi(ae.prev,ae,ae.next)>=0)return!1;ae=ae.nextZ}return!0}function b_(i,e,r){var a=i;do{var o=a.prev,u=a.next.next;!_c(o,u)&&Rd(o,a,a.next,u)&&Ko(o,u)&&Ko(u,o)&&(e.push(o.i/r|0),e.push(a.i/r|0),e.push(u.i/r|0),Xo(a),Xo(a.next),a=i=u),a=a.next}while(a!==i);return es(a)}function w_(i,e,r,a,o,u){var m=i;do{for(var f=m.next.next;f!==m.prev;){if(m.i!==f.i&&C_(m,f)){var v=Bd(m,f);return m=es(m,m.next),v=es(v,v.next),Wo(m,e,r,a,o,u,0),void Wo(v,e,r,a,o,u,0)}f=f.next}m=m.next}while(m!==i)}function S_(i,e){return i.x-e.x}function T_(i,e){var r=function(o,u){var m,f=u,v=o.x,w=o.y,T=-1/0;do{if(w<=f.y&&w>=f.next.y&&f.next.y!==f.y){var E=f.x+(w-f.y)*(f.next.x-f.x)/(f.next.y-f.y);if(E<=v&&E>T&&(T=E,m=f.x<f.next.x?f:f.next,E===v))return m}f=f.next}while(f!==u);if(!m)return null;var M,z=m,R=m.x,O=m.y,Z=1/0;f=m;do v>=f.x&&f.x>=R&&v!==f.x&&Us(w<O?v:T,w,R,O,w<O?T:v,w,f.x,f.y)&&(M=Math.abs(w-f.y)/(v-f.x),Ko(f,o)&&(M<Z||M===Z&&(f.x>m.x||f.x===m.x&&I_(m,f)))&&(m=f,Z=M)),f=f.next;while(f!==z);return m}(i,e);if(!r)return e;var a=Bd(r,i);return es(a,a.next),es(r,r.next)}function I_(i,e){return fi(i.prev,i,e.prev)<0&&fi(e.next,i,i.next)<0}function Gh(i,e,r,a,o){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*o|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-a)*o|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function A_(i){var e=i,r=i;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==i);return r}function Us(i,e,r,a,o,u,m,f){return(o-m)*(e-f)>=(i-m)*(u-f)&&(i-m)*(a-f)>=(r-m)*(e-f)&&(r-m)*(u-f)>=(o-m)*(a-f)}function C_(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,a){var o=r;do{if(o.i!==r.i&&o.next.i!==r.i&&o.i!==a.i&&o.next.i!==a.i&&Rd(o,o.next,r,a))return!0;o=o.next}while(o!==r);return!1}(i,e)&&(Ko(i,e)&&Ko(e,i)&&function(r,a){var o=r,u=!1,m=(r.x+a.x)/2,f=(r.y+a.y)/2;do o.y>f!=o.next.y>f&&o.next.y!==o.y&&m<(o.next.x-o.x)*(f-o.y)/(o.next.y-o.y)+o.x&&(u=!u),o=o.next;while(o!==r);return u}(i,e)&&(fi(i.prev,i,e.prev)||fi(i,e.prev,e))||_c(i,e)&&fi(i.prev,i,i.next)>0&&fi(e.prev,e,e.next)>0)}function fi(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function _c(i,e){return i.x===e.x&&i.y===e.y}function Rd(i,e,r,a){var o=xc(fi(i,e,r)),u=xc(fi(i,e,a)),m=xc(fi(r,a,i)),f=xc(fi(r,a,e));return o!==u&&m!==f||!(o!==0||!vc(i,r,e))||!(u!==0||!vc(i,a,e))||!(m!==0||!vc(r,i,a))||!(f!==0||!vc(r,e,a))}function vc(i,e,r){return e.x<=Math.max(i.x,r.x)&&e.x>=Math.min(i.x,r.x)&&e.y<=Math.max(i.y,r.y)&&e.y>=Math.min(i.y,r.y)}function xc(i){return i>0?1:i<0?-1:0}function Ko(i,e){return fi(i.prev,i,i.next)<0?fi(i,e,i.next)>=0&&fi(i,i.prev,e)>=0:fi(i,e,i.prev)<0||fi(i,i.next,e)<0}function Bd(i,e){var r=new qh(i.i,i.x,i.y),a=new qh(e.i,e.x,e.y),o=i.next,u=e.prev;return i.next=e,e.prev=i,r.next=o,o.prev=r,a.next=r,r.prev=a,u.next=a,a.prev=u,a}function Fd(i,e,r,a){var o=new qh(i,e,r);return a?(o.next=a.next,o.prev=a,a.next.prev=o,a.next=o):(o.prev=o,o.next=o),o}function Xo(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function qh(i,e,r){this.i=i,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Zh(i,e,r,a){for(var o=0,u=e,m=r-a;u<r;u+=a)o+=(i[m]-i[u])*(i[u+1]+i[m+1]),m=u;return o}jh.exports=yc,jh.exports.default=yc,yc.deviation=function(i,e,r,a){var o=e&&e.length,u=Math.abs(Zh(i,0,o?e[0]*r:i.length,r));if(o)for(var m=0,f=e.length;m<f;m++)u-=Math.abs(Zh(i,e[m]*r,m<f-1?e[m+1]*r:i.length,r));var v=0;for(m=0;m<a.length;m+=3){var w=a[m]*r,T=a[m+1]*r,E=a[m+2]*r;v+=Math.abs((i[w]-i[E])*(i[T+1]-i[w+1])-(i[w]-i[T])*(i[E+1]-i[w+1]))}return u===0&&v===0?0:Math.abs((v-u)/u)},yc.flatten=function(i){for(var e=i[0][0].length,r={vertices:[],holes:[],dimensions:e},a=0,o=0;o<i.length;o++){for(var u=0;u<i[o].length;u++)for(var m=0;m<e;m++)r.vertices.push(i[o][u][m]);o>0&&r.holes.push(a+=i[o-1].length)}return r};var Od=q(jh.exports);function E_(i,e,r,a,o){Nd(i,e,r||0,a||i.length-1,o||P_)}function Nd(i,e,r,a,o){for(;a>r;){if(a-r>600){var u=a-r+1,m=e-r+1,f=Math.log(u),v=.5*Math.exp(2*f/3),w=.5*Math.sqrt(f*v*(u-v)/u)*(m-u/2<0?-1:1);Nd(i,e,Math.max(r,Math.floor(e-m*v/u+w)),Math.min(a,Math.floor(e+(u-m)*v/u+w)),o)}var T=i[e],E=r,M=a;for(Yo(i,r,e),o(i[a],T)>0&&Yo(i,r,a);E<M;){for(Yo(i,E,M),E++,M--;o(i[E],T)<0;)E++;for(;o(i[M],T)>0;)M--}o(i[r],T)===0?Yo(i,r,M):Yo(i,++M,a),M<=e&&(r=M+1),e<=M&&(a=M-1)}}function Yo(i,e,r){var a=i[e];i[e]=i[r],i[r]=a}function P_(i,e){return i<e?-1:i>e?1:0}function Hh(i,e){const r=i.length;if(r<=1)return[i];const a=[];let o,u;for(let m=0;m<r;m++){const f=Ot(i[m]);f!==0&&(i[m].area=Math.abs(f),u===void 0&&(u=f<0),u===f<0?(o&&a.push(o),o=[i[m]]):o.push(i[m]))}if(o&&a.push(o),e>1)for(let m=0;m<a.length;m++)a[m].length<=e||(E_(a[m],e,1,a[m].length-1,M_),a[m]=a[m].slice(0,e));return a}function M_(i,e){return e.area-i.area}function Wh(i,e,r){const a=r.patternDependencies;let o=!1;for(const u of e){const m=u.paint.get(`${i}-pattern`);m.isConstant()||(o=!0);const f=m.constantOr(null);f&&(o=!0,a[f.to]=!0,a[f.from]=!0)}return o}function Kh(i,e,r,a,o){const u=o.patternDependencies;for(const m of e){const f=m.paint.get(`${i}-pattern`).value;if(f.kind!=="constant"){let v=f.evaluate({zoom:a-1},r,{},o.availableImages),w=f.evaluate({zoom:a},r,{},o.availableImages),T=f.evaluate({zoom:a+1},r,{},o.availableImages);v=v&&v.name?v.name:v,w=w&&w.name?w.name:w,T=T&&T.name?T.name:T,u[v]=!0,u[w]=!0,u[T]=!0,r.patterns[m.id]={min:v,mid:w,max:T}}}return r}class Xh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new xt,this.indexArray=new zi,this.indexArray2=new xi,this.programConfigurations=new dn(e.layers,e.zoom),this.segments=new Yt,this.segments2=new Yt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,a){this.hasPattern=Wh("fill",this.layers,r);const o=this.layers[0].layout.get("fill-sort-key"),u=!o.isConstant(),m=[];for(const{feature:f,id:v,index:w,sourceLayerIndex:T}of e){const E=this.layers[0]._featureFilter.needGeometry,M=Qa(f,E);if(!this.layers[0]._featureFilter.filter(new Xt(this.zoom),M,a))continue;const z=u?o.evaluate(M,{},a,r.availableImages):void 0,R={id:v,properties:f.properties,type:f.type,sourceLayerIndex:T,index:w,geometry:E?M.geometry:Ja(f),patterns:{},sortKey:z};m.push(R)}u&&m.sort((f,v)=>f.sortKey-v.sortKey);for(const f of m){const{geometry:v,index:w,sourceLayerIndex:T}=f;if(this.hasPattern){const E=Kh("fill",this.layers,f,this.zoom,r);this.patternFeatures.push(E)}else this.addFeature(f,v,w,a,{});r.featureIndex.insert(e[w].feature,v,w,T,this.index)}}update(e,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,a)}addFeatures(e,r,a){for(const o of this.patternFeatures)this.addFeature(o,o.geometry,o.index,r,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,__),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,r,a,o,u){for(const m of Hh(r,500)){let f=0;for(const z of m)f+=z.length;const v=this.segments.prepareSegment(f,this.layoutVertexArray,this.indexArray),w=v.vertexLength,T=[],E=[];for(const z of m){if(z.length===0)continue;z!==m[0]&&E.push(T.length/2);const R=this.segments2.prepareSegment(z.length,this.layoutVertexArray,this.indexArray2),O=R.vertexLength;this.layoutVertexArray.emplaceBack(z[0].x,z[0].y),this.indexArray2.emplaceBack(O+z.length-1,O),T.push(z[0].x),T.push(z[0].y);for(let Z=1;Z<z.length;Z++)this.layoutVertexArray.emplaceBack(z[Z].x,z[Z].y),this.indexArray2.emplaceBack(O+Z-1,O+Z),T.push(z[Z].x),T.push(z[Z].y);R.vertexLength+=z.length,R.primitiveLength+=z.length}const M=Od(T,E);for(let z=0;z<M.length;z+=3)this.indexArray.emplaceBack(w+M[z],w+M[z+1],w+M[z+2]);v.vertexLength+=f,v.primitiveLength+=M.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a,u,o)}}let Ud,Vd;De("FillBucket",Xh,{omit:["layers","patternFeatures"]});var k_={get paint(){return Vd=Vd||new di({"fill-antialias":new je(ue.paint_fill["fill-antialias"]),"fill-opacity":new We(ue.paint_fill["fill-opacity"]),"fill-color":new We(ue.paint_fill["fill-color"]),"fill-outline-color":new We(ue.paint_fill["fill-outline-color"]),"fill-translate":new je(ue.paint_fill["fill-translate"]),"fill-translate-anchor":new je(ue.paint_fill["fill-translate-anchor"]),"fill-pattern":new Ka(ue.paint_fill["fill-pattern"])})},get layout(){return Ud=Ud||new di({"fill-sort-key":new We(ue.layout_fill["fill-sort-key"])})}};class L_ extends Cr{constructor(e){super(e,k_)}recalculate(e,r){super.recalculate(e,r);const a=this.paint._values["fill-outline-color"];a.value.kind==="constant"&&a.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new Xh(e)}queryRadius(){return mc(this.paint.get("fill-translate"))}queryIntersectsFeature(e,r,a,o,u,m,f){return wd(fc(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),m.angle,f),o)}isTileClipped(){return!0}}const z_=ni([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),D_=ni([{name:"a_centroid",components:2,type:"Int16"}],4),{members:R_}=z_;var wa={},B_=be,$d=Vs;function Vs(i,e,r,a,o){this.properties={},this.extent=r,this.type=0,this._pbf=i,this._geometry=-1,this._keys=a,this._values=o,i.readFields(F_,this,e)}function F_(i,e,r){i==1?e.id=r.readVarint():i==2?function(a,o){for(var u=a.readVarint()+a.pos;a.pos<u;){var m=o._keys[a.readVarint()],f=o._values[a.readVarint()];o.properties[m]=f}}(r,e):i==3?e.type=r.readVarint():i==4&&(e._geometry=r.pos)}function O_(i){for(var e,r,a=0,o=0,u=i.length,m=u-1;o<u;m=o++)a+=((r=i[m]).x-(e=i[o]).x)*(e.y+r.y);return a}Vs.types=["Unknown","Point","LineString","Polygon"],Vs.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var e,r=i.readVarint()+i.pos,a=1,o=0,u=0,m=0,f=[];i.pos<r;){if(o<=0){var v=i.readVarint();a=7&v,o=v>>3}if(o--,a===1||a===2)u+=i.readSVarint(),m+=i.readSVarint(),a===1&&(e&&f.push(e),e=[]),e.push(new B_(u,m));else{if(a!==7)throw new Error("unknown command "+a);e&&e.push(e[0].clone())}}return e&&f.push(e),f},Vs.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,a=0,o=0,u=0,m=1/0,f=-1/0,v=1/0,w=-1/0;i.pos<e;){if(a<=0){var T=i.readVarint();r=7&T,a=T>>3}if(a--,r===1||r===2)(o+=i.readSVarint())<m&&(m=o),o>f&&(f=o),(u+=i.readSVarint())<v&&(v=u),u>w&&(w=u);else if(r!==7)throw new Error("unknown command "+r)}return[m,v,f,w]},Vs.prototype.toGeoJSON=function(i,e,r){var a,o,u=this.extent*Math.pow(2,r),m=this.extent*i,f=this.extent*e,v=this.loadGeometry(),w=Vs.types[this.type];function T(z){for(var R=0;R<z.length;R++){var O=z[R];z[R]=[360*(O.x+m)/u-180,360/Math.PI*Math.atan(Math.exp((180-360*(O.y+f)/u)*Math.PI/180))-90]}}switch(this.type){case 1:var E=[];for(a=0;a<v.length;a++)E[a]=v[a][0];T(v=E);break;case 2:for(a=0;a<v.length;a++)T(v[a]);break;case 3:for(v=function(z){var R=z.length;if(R<=1)return[z];for(var O,Z,K=[],re=0;re<R;re++){var Y=O_(z[re]);Y!==0&&(Z===void 0&&(Z=Y<0),Z===Y<0?(O&&K.push(O),O=[z[re]]):O.push(z[re]))}return O&&K.push(O),K}(v),a=0;a<v.length;a++)for(o=0;o<v[a].length;o++)T(v[a][o])}v.length===1?v=v[0]:w="Multi"+w;var M={type:"Feature",geometry:{type:w,coordinates:v},properties:this.properties};return"id"in this&&(M.id=this.id),M};var N_=$d,jd=Gd;function Gd(i,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(U_,this,e),this.length=this._features.length}function U_(i,e,r){i===15?e.version=r.readVarint():i===1?e.name=r.readString():i===5?e.extent=r.readVarint():i===2?e._features.push(r.pos):i===3?e._keys.push(r.readString()):i===4&&e._values.push(function(a){for(var o=null,u=a.readVarint()+a.pos;a.pos<u;){var m=a.readVarint()>>3;o=m===1?a.readString():m===2?a.readFloat():m===3?a.readDouble():m===4?a.readVarint64():m===5?a.readVarint():m===6?a.readSVarint():m===7?a.readBoolean():null}return o}(r))}Gd.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var e=this._pbf.readVarint()+this._pbf.pos;return new N_(this._pbf,e,this.extent,this._keys,this._values)};var V_=jd;function $_(i,e,r){if(i===3){var a=new V_(r,r.readVarint()+r.pos);a.length&&(e[a.name]=a)}}wa.VectorTile=function(i,e){this.layers=i.readFields($_,{},e)},wa.VectorTileFeature=$d,wa.VectorTileLayer=jd;const j_=wa.VectorTileFeature.types,Yh=Math.pow(2,13);function Jo(i,e,r,a,o,u,m,f){i.emplaceBack(e,r,2*Math.floor(a*Yh)+m,o*Yh*2,u*Yh*2,Math.round(f))}class Jh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Pe,this.centroidVertexArray=new we,this.indexArray=new zi,this.programConfigurations=new dn(e.layers,e.zoom),this.segments=new Yt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,a){this.features=[],this.hasPattern=Wh("fill-extrusion",this.layers,r);for(const{feature:o,id:u,index:m,sourceLayerIndex:f}of e){const v=this.layers[0]._featureFilter.needGeometry,w=Qa(o,v);if(!this.layers[0]._featureFilter.filter(new Xt(this.zoom),w,a))continue;const T={id:u,sourceLayerIndex:f,index:m,geometry:v?w.geometry:Ja(o),properties:o.properties,type:o.type,patterns:{}};this.hasPattern?this.features.push(Kh("fill-extrusion",this.layers,T,this.zoom,r)):this.addFeature(T,T.geometry,m,a,{}),r.featureIndex.insert(o,T.geometry,m,f,this.index,!0)}}addFeatures(e,r,a){for(const o of this.features){const{geometry:u}=o;this.addFeature(o,u,o.index,r,a)}}update(e,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,a)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,R_),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,D_.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,r,a,o,u){const m={x:0,y:0,vertexCount:0};for(const f of Hh(r,500)){let v=0;for(const R of f)v+=R.length;let w=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const R of f){if(R.length===0||q_(R))continue;let O=0;for(let Z=0;Z<R.length;Z++){const K=R[Z];if(Z>=1){const re=R[Z-1];if(!G_(K,re)){w.vertexLength+4>Yt.MAX_VERTEX_ARRAY_LENGTH&&(w=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const Y=K.sub(re)._perp()._unit(),ae=re.dist(K);O+ae>32768&&(O=0),Jo(this.layoutVertexArray,K.x,K.y,Y.x,Y.y,0,0,O),Jo(this.layoutVertexArray,K.x,K.y,Y.x,Y.y,0,1,O),m.x+=2*K.x,m.y+=2*K.y,m.vertexCount+=2,O+=ae,Jo(this.layoutVertexArray,re.x,re.y,Y.x,Y.y,0,0,O),Jo(this.layoutVertexArray,re.x,re.y,Y.x,Y.y,0,1,O),m.x+=2*re.x,m.y+=2*re.y,m.vertexCount+=2;const le=w.vertexLength;this.indexArray.emplaceBack(le,le+2,le+1),this.indexArray.emplaceBack(le+1,le+2,le+3),w.vertexLength+=4,w.primitiveLength+=2}}}}if(w.vertexLength+v>Yt.MAX_VERTEX_ARRAY_LENGTH&&(w=this.segments.prepareSegment(v,this.layoutVertexArray,this.indexArray)),j_[e.type]!=="Polygon")continue;const T=[],E=[],M=w.vertexLength;for(const R of f)if(R.length!==0){R!==f[0]&&E.push(T.length/2);for(let O=0;O<R.length;O++){const Z=R[O];Jo(this.layoutVertexArray,Z.x,Z.y,0,0,1,1,0),m.x+=Z.x,m.y+=Z.y,m.vertexCount+=1,T.push(Z.x),T.push(Z.y)}}const z=Od(T,E);for(let R=0;R<z.length;R+=3)this.indexArray.emplaceBack(M+z[R],M+z[R+2],M+z[R+1]);w.primitiveLength+=z.length/3,w.vertexLength+=v}for(let f=0;f<m.vertexCount;f++)this.centroidVertexArray.emplaceBack(Math.floor(m.x/m.vertexCount),Math.floor(m.y/m.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a,u,o)}}function G_(i,e){return i.x===e.x&&(i.x<0||i.x>_i)||i.y===e.y&&(i.y<0||i.y>_i)}function q_(i){return i.every(e=>e.x<0)||i.every(e=>e.x>_i)||i.every(e=>e.y<0)||i.every(e=>e.y>_i)}let qd;De("FillExtrusionBucket",Jh,{omit:["layers","features"]});var Z_={get paint(){return qd=qd||new di({"fill-extrusion-opacity":new je(ue["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new We(ue["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new je(ue["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new je(ue["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Ka(ue["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new We(ue["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new We(ue["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new je(ue["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class H_ extends Cr{constructor(e){super(e,Z_)}createBucket(e){return new Jh(e)}queryRadius(){return mc(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,r,a,o,u,m,f,v){const w=fc(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),m.angle,f),T=this.paint.get("fill-extrusion-height").evaluate(r,a),E=this.paint.get("fill-extrusion-base").evaluate(r,a),M=function(R,O,Z,K){const re=[];for(const Y of R){const ae=[Y.x,Y.y,0,1];gc(ae,ae,O),re.push(new de(ae[0]/ae[3],ae[1]/ae[3]))}return re}(w,v),z=function(R,O,Z,K){const re=[],Y=[],ae=K[8]*O,le=K[9]*O,ge=K[10]*O,ze=K[11]*O,Oe=K[8]*Z,ke=K[9]*Z,Me=K[10]*Z,Se=K[11]*Z;for(const Re of R){const Ae=[],xe=[];for(const Ze of Re){const $e=Ze.x,mt=Ze.y,Jt=K[0]*$e+K[4]*mt+K[12],ei=K[1]*$e+K[5]*mt+K[13],Si=K[2]*$e+K[6]*mt+K[14],Pr=K[3]*$e+K[7]*mt+K[15],nr=Si+ge,vi=Pr+ze,Ri=Jt+Oe,$i=ei+ke,ar=Si+Me,sr=Pr+Se,Ti=new de((Jt+ae)/vi,(ei+le)/vi);Ti.z=nr/vi,Ae.push(Ti);const Ii=new de(Ri/sr,$i/sr);Ii.z=ar/sr,xe.push(Ii)}re.push(Ae),Y.push(xe)}return[re,Y]}(o,E,T,v);return function(R,O,Z){let K=1/0;wd(Z,O)&&(K=Zd(Z,O[0]));for(let re=0;re<O.length;re++){const Y=O[re],ae=R[re];for(let le=0;le<Y.length-1;le++){const ge=Y[le],ze=[ge,Y[le+1],ae[le+1],ae[le],ge];bd(Z,ze)&&(K=Math.min(K,Zd(Z,ze)))}}return K!==1/0&&K}(z[0],z[1],M)}}function Qo(i,e){return i.x*e.x+i.y*e.y}function Zd(i,e){if(i.length===1){let r=0;const a=e[r++];let o;for(;!o||a.equals(o);)if(o=e[r++],!o)return 1/0;for(;r<e.length;r++){const u=e[r],m=i[0],f=o.sub(a),v=u.sub(a),w=m.sub(a),T=Qo(f,f),E=Qo(f,v),M=Qo(v,v),z=Qo(w,f),R=Qo(w,v),O=T*M-E*E,Z=(M*z-E*R)/O,K=(T*R-E*z)/O,re=a.z*(1-Z-K)+o.z*Z+u.z*K;if(isFinite(re))return re}return 1/0}{let r=1/0;for(const a of e)r=Math.min(r,a.z);return r}}const W_=ni([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:K_}=W_,X_=ni([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Y_}=X_,J_=wa.VectorTileFeature.types,Q_=Math.cos(Math.PI/180*37.5),Hd=Math.pow(2,14)/.5;class Qh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new Ke,this.layoutVertexArray2=new Ne,this.indexArray=new zi,this.programConfigurations=new dn(e.layers,e.zoom),this.segments=new Yt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,a){this.hasPattern=Wh("line",this.layers,r);const o=this.layers[0].layout.get("line-sort-key"),u=!o.isConstant(),m=[];for(const{feature:f,id:v,index:w,sourceLayerIndex:T}of e){const E=this.layers[0]._featureFilter.needGeometry,M=Qa(f,E);if(!this.layers[0]._featureFilter.filter(new Xt(this.zoom),M,a))continue;const z=u?o.evaluate(M,{},a):void 0,R={id:v,properties:f.properties,type:f.type,sourceLayerIndex:T,index:w,geometry:E?M.geometry:Ja(f),patterns:{},sortKey:z};m.push(R)}u&&m.sort((f,v)=>f.sortKey-v.sortKey);for(const f of m){const{geometry:v,index:w,sourceLayerIndex:T}=f;if(this.hasPattern){const E=Kh("line",this.layers,f,this.zoom,r);this.patternFeatures.push(E)}else this.addFeature(f,v,w,a,{});r.featureIndex.insert(e[w].feature,v,w,T,this.index)}}update(e,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,a)}addFeatures(e,r,a){for(const o of this.patternFeatures)this.addFeature(o,o.geometry,o.index,r,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Y_)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,K_),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,r,a,o,u){const m=this.layers[0].layout,f=m.get("line-join").evaluate(e,{}),v=m.get("line-cap"),w=m.get("line-miter-limit"),T=m.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const E of r)this.addLine(E,e,f,v,w,T);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a,u,o)}addLine(e,r,a,o,u,m){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let K=0;K<e.length-1;K++)this.totalDistance+=e[K].dist(e[K+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const f=J_[r.type]==="Polygon";let v=e.length;for(;v>=2&&e[v-1].equals(e[v-2]);)v--;let w=0;for(;w<v-1&&e[w].equals(e[w+1]);)w++;if(v<(f?3:2))return;a==="bevel"&&(u=1.05);const T=this.overscaling<=16?15*_i/(512*this.overscaling):0,E=this.segments.prepareSegment(10*v,this.layoutVertexArray,this.indexArray);let M,z,R,O,Z;this.e1=this.e2=-1,f&&(M=e[v-2],Z=e[w].sub(M)._unit()._perp());for(let K=w;K<v;K++){if(R=K===v-1?f?e[w+1]:void 0:e[K+1],R&&e[K].equals(R))continue;Z&&(O=Z),M&&(z=M),M=e[K],Z=R?R.sub(M)._unit()._perp():O,O=O||Z;let re=O.add(Z);re.x===0&&re.y===0||re._unit();const Y=O.x*Z.x+O.y*Z.y,ae=re.x*Z.x+re.y*Z.y,le=ae!==0?1/ae:1/0,ge=2*Math.sqrt(2-2*ae),ze=ae<Q_&&z&&R,Oe=O.x*Z.y-O.y*Z.x>0;if(ze&&K>w){const Se=M.dist(z);if(Se>2*T){const Re=M.sub(M.sub(z)._mult(T/Se)._round());this.updateDistance(z,Re),this.addCurrentVertex(Re,O,0,0,E),z=Re}}const ke=z&&R;let Me=ke?a:f?"butt":o;if(ke&&Me==="round"&&(le<m?Me="miter":le<=2&&(Me="fakeround")),Me==="miter"&&le>u&&(Me="bevel"),Me==="bevel"&&(le>2&&(Me="flipbevel"),le<u&&(Me="miter")),z&&this.updateDistance(z,M),Me==="miter")re._mult(le),this.addCurrentVertex(M,re,0,0,E);else if(Me==="flipbevel"){if(le>100)re=Z.mult(-1);else{const Se=le*O.add(Z).mag()/O.sub(Z).mag();re._perp()._mult(Se*(Oe?-1:1))}this.addCurrentVertex(M,re,0,0,E),this.addCurrentVertex(M,re.mult(-1),0,0,E)}else if(Me==="bevel"||Me==="fakeround"){const Se=-Math.sqrt(le*le-1),Re=Oe?Se:0,Ae=Oe?0:Se;if(z&&this.addCurrentVertex(M,O,Re,Ae,E),Me==="fakeround"){const xe=Math.round(180*ge/Math.PI/20);for(let Ze=1;Ze<xe;Ze++){let $e=Ze/xe;if($e!==.5){const Jt=$e-.5;$e+=$e*Jt*($e-1)*((1.0904+Y*(Y*(3.55645-1.43519*Y)-3.2452))*Jt*Jt+(.848013+Y*(.215638*Y-1.06021)))}const mt=Z.sub(O)._mult($e)._add(O)._unit()._mult(Oe?-1:1);this.addHalfVertex(M,mt.x,mt.y,!1,Oe,0,E)}}R&&this.addCurrentVertex(M,Z,-Re,-Ae,E)}else if(Me==="butt")this.addCurrentVertex(M,re,0,0,E);else if(Me==="square"){const Se=z?1:-1;this.addCurrentVertex(M,re,Se,Se,E)}else Me==="round"&&(z&&(this.addCurrentVertex(M,O,0,0,E),this.addCurrentVertex(M,O,1,1,E,!0)),R&&(this.addCurrentVertex(M,Z,-1,-1,E,!0),this.addCurrentVertex(M,Z,0,0,E)));if(ze&&K<v-1){const Se=M.dist(R);if(Se>2*T){const Re=M.add(R.sub(M)._mult(T/Se)._round());this.updateDistance(M,Re),this.addCurrentVertex(Re,Z,0,0,E),M=Re}}}}addCurrentVertex(e,r,a,o,u,m=!1){const f=r.y*o-r.x,v=-r.y-r.x*o;this.addHalfVertex(e,r.x+r.y*a,r.y-r.x*a,m,!1,a,u),this.addHalfVertex(e,f,v,m,!0,-o,u),this.distance>Hd/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,r,a,o,u,m))}addHalfVertex({x:e,y:r},a,o,u,m,f,v){const w=.5*(this.lineClips?this.scaledDistance*(Hd-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(u?1:0),(r<<1)+(m?1:0),Math.round(63*a)+128,Math.round(63*o)+128,1+(f===0?0:f<0?-1:1)|(63&w)<<2,w>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const T=v.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,T),v.primitiveLength++),m?this.e2=T:this.e1=T}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}}let Wd,Kd;De("LineBucket",Qh,{omit:["layers","patternFeatures"]});var Xd={get paint(){return Kd=Kd||new di({"line-opacity":new We(ue.paint_line["line-opacity"]),"line-color":new We(ue.paint_line["line-color"]),"line-translate":new je(ue.paint_line["line-translate"]),"line-translate-anchor":new je(ue.paint_line["line-translate-anchor"]),"line-width":new We(ue.paint_line["line-width"]),"line-gap-width":new We(ue.paint_line["line-gap-width"]),"line-offset":new We(ue.paint_line["line-offset"]),"line-blur":new We(ue.paint_line["line-blur"]),"line-dasharray":new Bo(ue.paint_line["line-dasharray"]),"line-pattern":new Ka(ue.paint_line["line-pattern"]),"line-gradient":new Fo(ue.paint_line["line-gradient"])})},get layout(){return Wd=Wd||new di({"line-cap":new je(ue.layout_line["line-cap"]),"line-join":new We(ue.layout_line["line-join"]),"line-miter-limit":new je(ue.layout_line["line-miter-limit"]),"line-round-limit":new je(ue.layout_line["line-round-limit"]),"line-sort-key":new We(ue.layout_line["line-sort-key"])})}};class e0 extends We{possiblyEvaluate(e,r){return r=new Xt(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(e,r)}evaluate(e,r,a,o){return r=Ve({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,a,o)}}let bc;class t0 extends Cr{constructor(e){super(e,Xd),this.gradientVersion=0,bc||(bc=new e0(Xd.paint.properties["line-width"].specification),bc.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){const r=this.gradientExpression();this.stepInterpolant=!!function(a){return a._styleExpression!==void 0}(r)&&r._styleExpression.expression instanceof En,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,r){super.recalculate(e,r),this.paint._values["line-floorwidth"]=bc.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Qh(e)}queryRadius(e){const r=e,a=Yd(qo("line-width",this,r),qo("line-gap-width",this,r)),o=qo("line-offset",this,r);return a/2+Math.abs(o)+mc(this.paint.get("line-translate"))}queryIntersectsFeature(e,r,a,o,u,m,f){const v=fc(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),m.angle,f),w=f/2*Yd(this.paint.get("line-width").evaluate(r,a),this.paint.get("line-gap-width").evaluate(r,a)),T=this.paint.get("line-offset").evaluate(r,a);return T&&(o=function(E,M){const z=[];for(let R=0;R<E.length;R++){const O=E[R],Z=[];for(let K=0;K<O.length;K++){const re=O[K-1],Y=O[K],ae=O[K+1],le=K===0?new de(0,0):Y.sub(re)._unit()._perp(),ge=K===O.length-1?new de(0,0):ae.sub(Y)._unit()._perp(),ze=le._add(ge)._unit(),Oe=ze.x*ge.x+ze.y*ge.y;Oe!==0&&ze._mult(1/Oe),Z.push(ze._mult(M)._add(Y))}z.push(Z)}return z}(o,T*f)),function(E,M,z){for(let R=0;R<M.length;R++){const O=M[R];if(E.length>=3){for(let Z=0;Z<O.length;Z++)if(Os(E,O[Z]))return!0}if(o_(E,O,z))return!0}return!1}(v,o,w)}isTileClipped(){return!0}}function Yd(i,e){return e>0?e+2*i:i}const i0=ni([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),r0=ni([{name:"a_projected_pos",components:3,type:"Float32"}],4);ni([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const n0=ni([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);ni([{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 Jd=ni([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),a0=ni([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function s0(i,e,r){return i.sections.forEach(a=>{a.text=function(o,u,m){const f=u.layout.get("text-transform").evaluate(m,{});return f==="uppercase"?o=o.toLocaleUpperCase():f==="lowercase"&&(o=o.toLocaleLowerCase()),pr.applyArabicShaping&&(o=pr.applyArabicShaping(o)),o}(a.text,e,r)}),i}ni([{name:"triangle",components:3,type:"Uint16"}]),ni([{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"}]),ni([{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"}]),ni([{type:"Float32",name:"offsetX"}]),ni([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),ni([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const el={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"};var wi=24,Qd=jt,em=function(i,e,r,a,o){var u,m,f=8*o-a-1,v=(1<<f)-1,w=v>>1,T=-7,E=r?o-1:0,M=r?-1:1,z=i[e+E];for(E+=M,u=z&(1<<-T)-1,z>>=-T,T+=f;T>0;u=256*u+i[e+E],E+=M,T-=8);for(m=u&(1<<-T)-1,u>>=-T,T+=a;T>0;m=256*m+i[e+E],E+=M,T-=8);if(u===0)u=1-w;else{if(u===v)return m?NaN:1/0*(z?-1:1);m+=Math.pow(2,a),u-=w}return(z?-1:1)*m*Math.pow(2,u-a)},tm=function(i,e,r,a,o,u){var m,f,v,w=8*u-o-1,T=(1<<w)-1,E=T>>1,M=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,z=a?0:u-1,R=a?1:-1,O=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,m=T):(m=Math.floor(Math.log(e)/Math.LN2),e*(v=Math.pow(2,-m))<1&&(m--,v*=2),(e+=m+E>=1?M/v:M*Math.pow(2,1-E))*v>=2&&(m++,v/=2),m+E>=T?(f=0,m=T):m+E>=1?(f=(e*v-1)*Math.pow(2,o),m+=E):(f=e*Math.pow(2,E-1)*Math.pow(2,o),m=0));o>=8;i[r+z]=255&f,z+=R,f/=256,o-=8);for(m=m<<o|f,w+=o;w>0;i[r+z]=255&m,z+=R,m/=256,w-=8);i[r+z-R]|=128*O};function jt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}jt.Varint=0,jt.Fixed64=1,jt.Bytes=2,jt.Fixed32=5;var eu=4294967296,im=1/eu,rm=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Qn(i){return i.type===jt.Bytes?i.readVarint()+i.pos:i.pos+1}function $s(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function nm(i,e,r){var a=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(a);for(var o=r.pos-1;o>=i;o--)r.buf[o+a]=r.buf[o]}function o0(i,e){for(var r=0;r<i.length;r++)e.writeVarint(i[r])}function l0(i,e){for(var r=0;r<i.length;r++)e.writeSVarint(i[r])}function c0(i,e){for(var r=0;r<i.length;r++)e.writeFloat(i[r])}function h0(i,e){for(var r=0;r<i.length;r++)e.writeDouble(i[r])}function u0(i,e){for(var r=0;r<i.length;r++)e.writeBoolean(i[r])}function p0(i,e){for(var r=0;r<i.length;r++)e.writeFixed32(i[r])}function d0(i,e){for(var r=0;r<i.length;r++)e.writeSFixed32(i[r])}function m0(i,e){for(var r=0;r<i.length;r++)e.writeFixed64(i[r])}function f0(i,e){for(var r=0;r<i.length;r++)e.writeSFixed64(i[r])}function wc(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+16777216*i[e+3]}function js(i,e,r){i[r]=e,i[r+1]=e>>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function am(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}jt.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos<r;){var a=this.readVarint(),o=a>>3,u=this.pos;this.type=7&a,i(o,e,this),this.pos===u&&this.skip(a)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=wc(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=am(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=wc(this.buf,this.pos)+wc(this.buf,this.pos+4)*eu;return this.pos+=8,i},readSFixed64:function(){var i=wc(this.buf,this.pos)+am(this.buf,this.pos+4)*eu;return this.pos+=8,i},readFloat:function(){var i=em(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=em(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,a=this.buf;return e=127&(r=a[this.pos++]),r<128?e:(e|=(127&(r=a[this.pos++]))<<7,r<128?e:(e|=(127&(r=a[this.pos++]))<<14,r<128?e:(e|=(127&(r=a[this.pos++]))<<21,r<128?e:function(o,u,m){var f,v,w=m.buf;if(f=(112&(v=w[m.pos++]))>>4,v<128||(f|=(127&(v=w[m.pos++]))<<3,v<128)||(f|=(127&(v=w[m.pos++]))<<10,v<128)||(f|=(127&(v=w[m.pos++]))<<17,v<128)||(f|=(127&(v=w[m.pos++]))<<24,v<128)||(f|=(1&(v=w[m.pos++]))<<31,v<128))return $s(o,f,u);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=a[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var i=this.readVarint()+this.pos,e=this.pos;return this.pos=i,i-e>=12&&rm?function(r,a,o){return rm.decode(r.subarray(a,o))}(this.buf,e,i):function(r,a,o){for(var u="",m=a;m<o;){var f,v,w,T=r[m],E=null,M=T>239?4:T>223?3:T>191?2:1;if(m+M>o)break;M===1?T<128&&(E=T):M===2?(192&(f=r[m+1]))==128&&(E=(31&T)<<6|63&f)<=127&&(E=null):M===3?(v=r[m+2],(192&(f=r[m+1]))==128&&(192&v)==128&&((E=(15&T)<<12|(63&f)<<6|63&v)<=2047||E>=55296&&E<=57343)&&(E=null)):M===4&&(v=r[m+2],w=r[m+3],(192&(f=r[m+1]))==128&&(192&v)==128&&(192&w)==128&&((E=(15&T)<<18|(63&f)<<12|(63&v)<<6|63&w)<=65535||E>=1114112)&&(E=null)),E===null?(E=65533,M=1):E>65535&&(E-=65536,u+=String.fromCharCode(E>>>10&1023|55296),E=56320|1023&E),u+=String.fromCharCode(E),m+=M}return u}(this.buf,e,i)},readBytes:function(){var i=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,i);return this.pos=i,e},readPackedVarint:function(i,e){if(this.type!==jt.Bytes)return i.push(this.readVarint(e));var r=Qn(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(e));return i},readPackedSVarint:function(i){if(this.type!==jt.Bytes)return i.push(this.readSVarint());var e=Qn(this);for(i=i||[];this.pos<e;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==jt.Bytes)return i.push(this.readBoolean());var e=Qn(this);for(i=i||[];this.pos<e;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==jt.Bytes)return i.push(this.readFloat());var e=Qn(this);for(i=i||[];this.pos<e;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==jt.Bytes)return i.push(this.readDouble());var e=Qn(this);for(i=i||[];this.pos<e;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==jt.Bytes)return i.push(this.readFixed32());var e=Qn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==jt.Bytes)return i.push(this.readSFixed32());var e=Qn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==jt.Bytes)return i.push(this.readFixed64());var e=Qn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==jt.Bytes)return i.push(this.readSFixed64());var e=Qn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed64());return i},skip:function(i){var e=7&i;if(e===jt.Varint)for(;this.buf[this.pos++]>127;);else if(e===jt.Bytes)this.pos=this.readVarint()+this.pos;else if(e===jt.Fixed32)this.pos+=4;else{if(e!==jt.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e<this.pos+i;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(i){this.realloc(4),js(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),js(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),js(this.buf,-1&i,this.pos),js(this.buf,Math.floor(i*im),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),js(this.buf,-1&i,this.pos),js(this.buf,Math.floor(i*im),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?function(e,r){var a,o;if(e>=0?(a=e%4294967296|0,o=e/4294967296|0):(o=~(-e/4294967296),4294967295^(a=~(-e%4294967296))?a=a+1|0:(a=0,o=o+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(u,m,f){f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,f.buf[f.pos]=127&(u>>>=7)}(a,0,r),function(u,m){var f=(7&u)<<4;m.buf[m.pos++]|=f|((u>>>=3)?128:0),u&&(m.buf[m.pos++]=127&u|((u>>>=7)?128:0),u&&(m.buf[m.pos++]=127&u|((u>>>=7)?128:0),u&&(m.buf[m.pos++]=127&u|((u>>>=7)?128:0),u&&(m.buf[m.pos++]=127&u|((u>>>=7)?128:0),u&&(m.buf[m.pos++]=127&u)))))}(o,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(!!i)},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var e=this.pos;this.pos=function(a,o,u){for(var m,f,v=0;v<o.length;v++){if((m=o.charCodeAt(v))>55295&&m<57344){if(!f){m>56319||v+1===o.length?(a[u++]=239,a[u++]=191,a[u++]=189):f=m;continue}if(m<56320){a[u++]=239,a[u++]=191,a[u++]=189,f=m;continue}m=f-55296<<10|m-56320|65536,f=null}else f&&(a[u++]=239,a[u++]=191,a[u++]=189,f=null);m<128?a[u++]=m:(m<2048?a[u++]=m>>6|192:(m<65536?a[u++]=m>>12|224:(a[u++]=m>>18|240,a[u++]=m>>12&63|128),a[u++]=m>>6&63|128),a[u++]=63&m|128)}return u}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&nm(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),tm(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),tm(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=i[r]},writeRawMessage:function(i,e){this.pos++;var r=this.pos;i(e,this);var a=this.pos-r;a>=128&&nm(r,a,this),this.pos=r-1,this.writeVarint(a),this.pos+=a},writeMessage:function(i,e,r){this.writeTag(i,jt.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,o0,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,l0,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,u0,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,c0,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,h0,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,p0,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,d0,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,m0,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,f0,e)},writeBytesField:function(i,e){this.writeTag(i,jt.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,jt.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,jt.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,jt.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,jt.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,jt.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,jt.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,jt.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,jt.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,jt.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,!!e)}};var tu=q(Qd);const iu=3;function g0(i,e,r){i===1&&r.readMessage(y0,e)}function y0(i,e,r){if(i===3){const{id:a,bitmap:o,width:u,height:m,left:f,top:v,advance:w}=r.readMessage(_0,{});e.push({id:a,bitmap:new Ho({width:u+2*iu,height:m+2*iu},o),metrics:{width:u,height:m,left:f,top:v,advance:w}})}}function _0(i,e,r){i===1?e.id=r.readVarint():i===2?e.bitmap=r.readBytes():i===3?e.width=r.readVarint():i===4?e.height=r.readVarint():i===5?e.left=r.readSVarint():i===6?e.top=r.readSVarint():i===7&&(e.advance=r.readVarint())}const sm=iu;function om(i){let e=0,r=0;for(const m of i)e+=m.w*m.h,r=Math.max(r,m.w);i.sort((m,f)=>f.h-m.h);const a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let o=0,u=0;for(const m of i)for(let f=a.length-1;f>=0;f--){const v=a[f];if(!(m.w>v.w||m.h>v.h)){if(m.x=v.x,m.y=v.y,u=Math.max(u,m.y+m.h),o=Math.max(o,m.x+m.w),m.w===v.w&&m.h===v.h){const w=a.pop();f<a.length&&(a[f]=w)}else m.h===v.h?(v.x+=m.w,v.w-=m.w):m.w===v.w?(v.y+=m.h,v.h-=m.h):(a.push({x:v.x+m.w,y:v.y,w:v.w-m.w,h:m.h}),v.y+=m.h,v.h-=m.h);break}}return{w:o,h:u,fill:e/(o*u)||0}}const mr=1;class ru{constructor(e,{pixelRatio:r,version:a,stretchX:o,stretchY:u,content:m}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=o,this.stretchY=u,this.content=m,this.version=a}get tl(){return[this.paddedRect.x+mr,this.paddedRect.y+mr]}get br(){return[this.paddedRect.x+this.paddedRect.w-mr,this.paddedRect.y+this.paddedRect.h-mr]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*mr)/this.pixelRatio,(this.paddedRect.h-2*mr)/this.pixelRatio]}}class lm{constructor(e,r){const a={},o={};this.haveRenderCallbacks=[];const u=[];this.addImages(e,a,u),this.addImages(r,o,u);const{w:m,h:f}=om(u),v=new Rr({width:m||1,height:f||1});for(const w in e){const T=e[w],E=a[w].paddedRect;Rr.copy(T.data,v,{x:0,y:0},{x:E.x+mr,y:E.y+mr},T.data)}for(const w in r){const T=r[w],E=o[w].paddedRect,M=E.x+mr,z=E.y+mr,R=T.data.width,O=T.data.height;Rr.copy(T.data,v,{x:0,y:0},{x:M,y:z},T.data),Rr.copy(T.data,v,{x:0,y:O-1},{x:M,y:z-1},{width:R,height:1}),Rr.copy(T.data,v,{x:0,y:0},{x:M,y:z+O},{width:R,height:1}),Rr.copy(T.data,v,{x:R-1,y:0},{x:M-1,y:z},{width:1,height:O}),Rr.copy(T.data,v,{x:0,y:0},{x:M+R,y:z},{width:1,height:O})}this.image=v,this.iconPositions=a,this.patternPositions=o}addImages(e,r,a){for(const o in e){const u=e[o],m={x:0,y:0,w:u.data.width+2*mr,h:u.data.height+2*mr};a.push(m),r[o]=new ru(m,u),u.hasRenderCallback&&this.haveRenderCallbacks.push(o)}}patchUpdatedImages(e,r){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const a in e.updatedImages)this.patchUpdatedImage(this.iconPositions[a],e.getImage(a),r),this.patchUpdatedImage(this.patternPositions[a],e.getImage(a),r)}patchUpdatedImage(e,r,a){if(!e||!r||e.version===r.version)return;e.version=r.version;const[o,u]=e.tl;a.update(r.data,void 0,{x:o,y:u})}}var Sa;De("ImagePosition",ru),De("ImageAtlas",lm),l.ai=void 0,(Sa=l.ai||(l.ai={}))[Sa.none=0]="none",Sa[Sa.horizontal=1]="horizontal",Sa[Sa.vertical=2]="vertical",Sa[Sa.horizontalOnly=3]="horizontalOnly";const tl=-17;class il{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){const a=new il;return a.scale=e||1,a.fontStack=r,a}static forImage(e){const r=new il;return r.imageName=e,r}}class Gs{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){const a=new Gs;for(let o=0;o<e.sections.length;o++){const u=e.sections[o];u.image?a.addImageSection(u):a.addTextSection(u,r)}return a}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}getCharCode(e){return this.text.charCodeAt(e)}verticalizePunctuation(){this.text=function(e){let r="";for(let a=0;a<e.length;a++){const o=e.charCodeAt(a+1)||null,u=e.charCodeAt(a-1)||null;r+=o&&rc(o)&&!el[e[a+1]]||u&&rc(u)&&!el[e[a-1]]||!el[e[a]]?e[a]:el[e[a]]}return r}(this.text)}trim(){let e=0;for(let a=0;a<this.text.length&&Tc[this.text.charCodeAt(a)];a++)e++;let r=this.text.length;for(let a=this.text.length-1;a>=0&&a>=e&&Tc[this.text.charCodeAt(a)];a--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const a=new Gs;return a.text=this.text.substring(e,r),a.sectionIndex=this.sectionIndex.slice(e,r),a.sections=this.sections,a}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}addTextSection(e,r){this.text+=e.text,this.sections.push(il.forText(e.scale,e.fontStack||r));const a=this.sections.length-1;for(let o=0;o<e.text.length;++o)this.sectionIndex.push(a)}addImageSection(e){const r=e.image?e.image.name:"";if(r.length===0)return void st("Can't add FormattedSection with an empty image.");const a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCharCode(a),this.sections.push(il.forImage(r)),this.sectionIndex.push(this.sections.length-1)):st("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Sc(i,e,r,a,o,u,m,f,v,w,T,E,M,z,R,O){const Z=Gs.fromFeature(i,o);let K;E===l.ai.vertical&&Z.verticalizePunctuation();const{processBidirectionalText:re,processStyledBidirectionalText:Y}=pr;if(re&&Z.sections.length===1){K=[];const ge=re(Z.toString(),nu(Z,w,u,e,a,z,R));for(const ze of ge){const Oe=new Gs;Oe.text=ze,Oe.sections=Z.sections;for(let ke=0;ke<ze.length;ke++)Oe.sectionIndex.push(0);K.push(Oe)}}else if(Y){K=[];const ge=Y(Z.text,Z.sectionIndex,nu(Z,w,u,e,a,z,R));for(const ze of ge){const Oe=new Gs;Oe.text=ze[0],Oe.sectionIndex=ze[1],Oe.sections=Z.sections,K.push(Oe)}}else K=function(ge,ze){const Oe=[],ke=ge.text;let Me=0;for(const Se of ze)Oe.push(ge.substring(Me,Se)),Me=Se;return Me<ke.length&&Oe.push(ge.substring(Me,ke.length)),Oe}(Z,nu(Z,w,u,e,a,z,R));const ae=[],le={positionedLines:ae,text:Z.toString(),top:T[1],bottom:T[1],left:T[0],right:T[0],writingMode:E,iconsInText:!1,verticalizable:!1};return function(ge,ze,Oe,ke,Me,Se,Re,Ae,xe,Ze,$e,mt){let Jt=0,ei=tl,Si=0,Pr=0;const nr=Ae==="right"?1:Ae==="left"?0:.5;let vi=0;for(const Ti of Me){Ti.trim();const Ii=Ti.getMaxScale(),Ki=(Ii-1)*wi,or={positionedGlyphs:[],lineOffset:0};ge.positionedLines[vi]=or;const Xi=or.positionedGlyphs;let fr=0;if(!Ti.length()){ei+=Se,++vi;continue}for(let Ai=0;Ai<Ti.length();Ai++){const wt=Ti.getSection(Ai),Yi=Ti.getSectionIndex(Ai),ji=Ti.getCharCode(Ai);let Ci=0,Qr=null,mn=null,fn=null,ea=wi;const en=!(xe===l.ai.horizontal||!$e&&!Eo(ji)||$e&&(Tc[ji]||(Ri=ji,Le.Arabic(Ri)||Le["Arabic Supplement"](Ri)||Le["Arabic Extended-A"](Ri)||Le["Arabic Presentation Forms-A"](Ri)||Le["Arabic Presentation Forms-B"](Ri))));if(wt.imageName){const Fr=ke[wt.imageName];if(!Fr)continue;fn=wt.imageName,ge.iconsInText=ge.iconsInText||!0,mn=Fr.paddedRect;const yr=Fr.displaySize;wt.scale=wt.scale*wi/mt,Qr={width:yr[0],height:yr[1],left:mr,top:-sm,advance:en?yr[1]:yr[0]},Ci=Ki+(wi-yr[1]*wt.scale),ea=Qr.advance;const ta=en?yr[0]*wt.scale-wi*Ii:yr[1]*wt.scale-wi*Ii;ta>0&&ta>fr&&(fr=ta)}else{const Fr=Oe[wt.fontStack],yr=Fr&&Fr[ji];if(yr&&yr.rect)mn=yr.rect,Qr=yr.metrics;else{const ta=ze[wt.fontStack],ol=ta&&ta[ji];if(!ol)continue;Qr=ol.metrics}Ci=(Ii-wt.scale)*wi}en?(ge.verticalizable=!0,Xi.push({glyph:ji,imageName:fn,x:Jt,y:ei+Ci,vertical:en,scale:wt.scale,fontStack:wt.fontStack,sectionIndex:Yi,metrics:Qr,rect:mn}),Jt+=ea*wt.scale+Ze):(Xi.push({glyph:ji,imageName:fn,x:Jt,y:ei+Ci,vertical:en,scale:wt.scale,fontStack:wt.fontStack,sectionIndex:Yi,metrics:Qr,rect:mn}),Jt+=Qr.advance*wt.scale+Ze)}Xi.length!==0&&(Si=Math.max(Jt-Ze,Si),b0(Xi,0,Xi.length-1,nr,fr)),Jt=0;const gr=Se*Ii+fr;or.lineOffset=Math.max(fr,Ki),ei+=gr,Pr=Math.max(gr,Pr),++vi}var Ri;const $i=ei-tl,{horizontalAlign:ar,verticalAlign:sr}=au(Re);(function(Ti,Ii,Ki,or,Xi,fr,gr,Ai,wt){const Yi=(Ii-Ki)*Xi;let ji=0;ji=fr!==gr?-Ai*or-tl:(-or*wt+.5)*gr;for(const Ci of Ti)for(const Qr of Ci.positionedGlyphs)Qr.x+=Yi,Qr.y+=ji})(ge.positionedLines,nr,ar,sr,Si,Pr,Se,$i,Me.length),ge.top+=-sr*$i,ge.bottom=ge.top+$i,ge.left+=-ar*Si,ge.right=ge.left+Si}(le,e,r,a,K,m,f,v,E,w,M,O),!function(ge){for(const ze of ge)if(ze.positionedGlyphs.length!==0)return!1;return!0}(ae)&&le}const Tc={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},v0={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function cm(i,e,r,a,o,u){if(e.imageName){const m=a[e.imageName];return m?m.displaySize[0]*e.scale*wi/u+o:0}{const m=r[e.fontStack],f=m&&m[i];return f?f.metrics.advance*e.scale+o:0}}function hm(i,e,r,a){const o=Math.pow(i-e,2);return a?i<e?o/2:2*o:o+Math.abs(r)*r}function x0(i,e,r){let a=0;return i===10&&(a-=1e4),r&&(a+=150),i!==40&&i!==65288||(a+=50),e!==41&&e!==65289||(a+=50),a}function um(i,e,r,a,o,u){let m=null,f=hm(e,r,o,u);for(const v of a){const w=hm(e-v.x,r,o,u)+v.badness;w<=f&&(m=v,f=w)}return{index:i,x:e,priorBreak:m,badness:f}}function pm(i){return i?pm(i.priorBreak).concat(i.index):[]}function nu(i,e,r,a,o,u,m){if(u!=="point")return[];if(!i)return[];const f=[],v=function(M,z,R,O,Z,K){let re=0;for(let Y=0;Y<M.length();Y++){const ae=M.getSection(Y);re+=cm(M.getCharCode(Y),ae,O,Z,z,K)}return re/Math.max(1,Math.ceil(re/R))}(i,e,r,a,o,m),w=i.text.indexOf("\u200B")>=0;let T=0;for(let M=0;M<i.length();M++){const z=i.getSection(M),R=i.getCharCode(M);if(Tc[R]||(T+=cm(R,z,a,o,e,m)),M<i.length()-1){const O=!((E=R)<11904||!(Le["Bopomofo Extended"](E)||Le.Bopomofo(E)||Le["CJK Compatibility Forms"](E)||Le["CJK Compatibility Ideographs"](E)||Le["CJK Compatibility"](E)||Le["CJK Radicals Supplement"](E)||Le["CJK Strokes"](E)||Le["CJK Symbols and Punctuation"](E)||Le["CJK Unified Ideographs Extension A"](E)||Le["CJK Unified Ideographs"](E)||Le["Enclosed CJK Letters and Months"](E)||Le["Halfwidth and Fullwidth Forms"](E)||Le.Hiragana(E)||Le["Ideographic Description Characters"](E)||Le["Kangxi Radicals"](E)||Le["Katakana Phonetic Extensions"](E)||Le.Katakana(E)||Le["Vertical Forms"](E)||Le["Yi Radicals"](E)||Le["Yi Syllables"](E)));(v0[R]||O||z.imageName)&&f.push(um(M+1,T,v,f,x0(R,i.getCharCode(M+1),O&&w),!1))}}var E;return pm(um(i.length(),T,v,f,0,!0))}function au(i){let e=.5,r=.5;switch(i){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(i){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function b0(i,e,r,a,o){if(!a&&!o)return;const u=i[r],m=(i[r].x+u.metrics.advance*u.scale)*a;for(let f=e;f<=r;f++)i[f].x-=m,i[f].y+=o}function w0(i,e,r){const{horizontalAlign:a,verticalAlign:o}=au(r),u=e[0]-i.displaySize[0]*a,m=e[1]-i.displaySize[1]*o;return{image:i,top:m,bottom:m+i.displaySize[1],left:u,right:u+i.displaySize[0]}}function dm(i,e,r,a,o,u){const m=i.image;let f;if(m.content){const Z=m.content,K=m.pixelRatio||1;f=[Z[0]/K,Z[1]/K,m.displaySize[0]-Z[2]/K,m.displaySize[1]-Z[3]/K]}const v=e.left*u,w=e.right*u;let T,E,M,z;r==="width"||r==="both"?(z=o[0]+v-a[3],E=o[0]+w+a[1]):(z=o[0]+(v+w-m.displaySize[0])/2,E=z+m.displaySize[0]);const R=e.top*u,O=e.bottom*u;return r==="height"||r==="both"?(T=o[1]+R-a[0],M=o[1]+O+a[2]):(T=o[1]+(R+O-m.displaySize[1])/2,M=T+m.displaySize[1]),{image:m,top:T,right:E,bottom:M,left:z,collisionPadding:f}}const rl=255,zn=128,Ta=rl*zn;function mm(i,e){const{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Xt(i+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:a,interpolationType:o}=r;let u=0;for(;u<a.length&&a[u]<=i;)u++;u=Math.max(0,u-1);let m=u;for(;m<a.length&&a[m]<i+1;)m++;m=Math.min(a.length-1,m);const f=a[u],v=a[m];return r.kind==="composite"?{kind:"composite",minZoom:f,maxZoom:v,interpolationType:o}:{kind:"camera",minZoom:f,maxZoom:v,minSize:r.evaluate(new Xt(f)),maxSize:r.evaluate(new Xt(v)),interpolationType:o}}}function su(i,e,r){let a="never";const o=i.get(e);return o?a=o:i.get(r)&&(a="always"),a}const S0=wa.VectorTileFeature.types,T0=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Ic(i,e,r,a,o,u,m,f,v,w,T,E,M){const z=f?Math.min(Ta,Math.round(f[0])):0,R=f?Math.min(Ta,Math.round(f[1])):0;i.emplaceBack(e,r,Math.round(32*a),Math.round(32*o),u,m,(z<<1)+(v?1:0),R,16*w,16*T,256*E,256*M)}function ou(i,e,r){i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r)}function I0(i){for(const e of i.sections)if(zh(e.text))return!0;return!1}class lu{constructor(e){this.layoutVertexArray=new _t,this.indexArray=new zi,this.programConfigurations=e,this.segments=new Yt,this.dynamicLayoutVertexArray=new ht,this.opacityVertexArray=new bt,this.hasVisibleVertices=!1,this.placedSymbolArray=new ee}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,a,o){this.isEmpty()||(a&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,i0.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,r0.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,T0,!0),this.opacityVertexBuffer.itemSize=1),(a||o)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}De("SymbolBuffers",lu);class cu{constructor(e,r,a){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new a,this.segments=new Yt,this.collisionVertexArray=new Wt}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,n0.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}De("CollisionBuffers",cu);class qs{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(m=>m.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Uh([]),this.placementViewportMatrix=Uh([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=mm(this.zoom,r["text-size"]),this.iconSizeData=mm(this.zoom,r["icon-size"]);const a=this.layers[0].layout,o=a.get("symbol-sort-key"),u=a.get("symbol-z-order");this.canOverlap=su(a,"text-overlap","text-allow-overlap")!=="never"||su(a,"icon-overlap","icon-allow-overlap")!=="never"||a.get("text-ignore-placement")||a.get("icon-ignore-placement"),this.sortFeaturesByKey=u!=="viewport-y"&&!o.isConstant(),this.sortFeaturesByY=(u==="viewport-y"||u==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,a.get("symbol-placement")==="point"&&(this.writingModes=a.get("text-writing-mode").map(m=>l.ai[m])),this.stateDependentLayerIds=this.layers.filter(m=>m.isStateDependent()).map(m=>m.id),this.sourceID=e.sourceID}createArrays(){this.text=new lu(new dn(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new lu(new dn(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new te,this.lineVertexArray=new ce,this.symbolInstances=new W,this.textAnchorOffsets=new fe}calculateGlyphDependencies(e,r,a,o,u){for(let m=0;m<e.length;m++)if(r[e.charCodeAt(m)]=!0,(a||o)&&u){const f=el[e.charAt(m)];f&&(r[f.charCodeAt(0)]=!0)}}populate(e,r,a){const o=this.layers[0],u=o.layout,m=u.get("text-font"),f=u.get("text-field"),v=u.get("icon-image"),w=(f.value.kind!=="constant"||f.value.value instanceof Ni&&!f.value.value.isEmpty()||f.value.value.toString().length>0)&&(m.value.kind!=="constant"||m.value.value.length>0),T=v.value.kind!=="constant"||!!v.value.value||Object.keys(v.parameters).length>0,E=u.get("symbol-sort-key");if(this.features=[],!w&&!T)return;const M=r.iconDependencies,z=r.glyphDependencies,R=r.availableImages,O=new Xt(this.zoom);for(const{feature:Z,id:K,index:re,sourceLayerIndex:Y}of e){const ae=o._featureFilter.needGeometry,le=Qa(Z,ae);if(!o._featureFilter.filter(O,le,a))continue;let ge,ze;if(ae||(le.geometry=Ja(Z)),w){const ke=o.getValueAndResolveTokens("text-field",le,a,R),Me=Ni.factory(ke);I0(Me)&&(this.hasRTLText=!0),(!this.hasRTLText||Do()==="unavailable"||this.hasRTLText&&pr.isParsed())&&(ge=s0(Me,o,le))}if(T){const ke=o.getValueAndResolveTokens("icon-image",le,a,R);ze=ke instanceof Li?ke:Li.fromString(ke)}if(!ge&&!ze)continue;const Oe=this.sortFeaturesByKey?E.evaluate(le,{},a):void 0;if(this.features.push({id:K,text:ge,icon:ze,index:re,sourceLayerIndex:Y,geometry:le.geometry,properties:Z.properties,type:S0[Z.type],sortKey:Oe}),ze&&(M[ze.name]=!0),ge){const ke=m.evaluate(le,{},a).join(","),Me=u.get("text-rotation-alignment")!=="viewport"&&u.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(l.ai.vertical)>=0;for(const Se of ge.sections)if(Se.image)M[Se.image.name]=!0;else{const Re=Ao(ge.toString()),Ae=Se.fontStack||ke,xe=z[Ae]=z[Ae]||{};this.calculateGlyphDependencies(Se.text,xe,Me,this.allowVerticalPlacement,Re)}}}u.get("symbol-placement")==="line"&&(this.features=function(Z){const K={},re={},Y=[];let ae=0;function le(ke){Y.push(Z[ke]),ae++}function ge(ke,Me,Se){const Re=re[ke];return delete re[ke],re[Me]=Re,Y[Re].geometry[0].pop(),Y[Re].geometry[0]=Y[Re].geometry[0].concat(Se[0]),Re}function ze(ke,Me,Se){const Re=K[Me];return delete K[Me],K[ke]=Re,Y[Re].geometry[0].shift(),Y[Re].geometry[0]=Se[0].concat(Y[Re].geometry[0]),Re}function Oe(ke,Me,Se){const Re=Se?Me[0][Me[0].length-1]:Me[0][0];return`${ke}:${Re.x}:${Re.y}`}for(let ke=0;ke<Z.length;ke++){const Me=Z[ke],Se=Me.geometry,Re=Me.text?Me.text.toString():null;if(!Re){le(ke);continue}const Ae=Oe(Re,Se),xe=Oe(Re,Se,!0);if(Ae in re&&xe in K&&re[Ae]!==K[xe]){const Ze=ze(Ae,xe,Se),$e=ge(Ae,xe,Y[Ze].geometry);delete K[Ae],delete re[xe],re[Oe(Re,Y[$e].geometry,!0)]=$e,Y[Ze].geometry=null}else Ae in re?ge(Ae,xe,Se):xe in K?ze(Ae,xe,Se):(le(ke),K[Ae]=ae-1,re[xe]=ae-1)}return Y.filter(ke=>ke.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((Z,K)=>Z.sortKey-K.sortKey)}update(e,r,a){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,a),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,a))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,r){const a=this.lineVertexArray.length;if(e.segment!==void 0){let o=e.dist(r[e.segment+1]),u=e.dist(r[e.segment]);const m={};for(let f=e.segment+1;f<r.length;f++)m[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:o},f<r.length-1&&(o+=r[f+1].dist(r[f]));for(let f=e.segment||0;f>=0;f--)m[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:u},f>0&&(u+=r[f-1].dist(r[f]));for(let f=0;f<r.length;f++){const v=m[f];this.lineVertexArray.emplaceBack(v.x,v.y,v.tileUnitDistanceFromAnchor)}}return{lineStartIndex:a,lineLength:this.lineVertexArray.length-a}}addSymbols(e,r,a,o,u,m,f,v,w,T,E,M){const z=e.indexArray,R=e.layoutVertexArray,O=e.segments.prepareSegment(4*r.length,R,z,this.canOverlap?m.sortKey:void 0),Z=this.glyphOffsetArray.length,K=O.vertexLength,re=this.allowVerticalPlacement&&f===l.ai.vertical?Math.PI/2:0,Y=m.text&&m.text.sections;for(let ae=0;ae<r.length;ae++){const{tl:le,tr:ge,bl:ze,br:Oe,tex:ke,pixelOffsetTL:Me,pixelOffsetBR:Se,minFontScaleX:Re,minFontScaleY:Ae,glyphOffset:xe,isSDF:Ze,sectionIndex:$e}=r[ae],mt=O.vertexLength,Jt=xe[1];Ic(R,v.x,v.y,le.x,Jt+le.y,ke.x,ke.y,a,Ze,Me.x,Me.y,Re,Ae),Ic(R,v.x,v.y,ge.x,Jt+ge.y,ke.x+ke.w,ke.y,a,Ze,Se.x,Me.y,Re,Ae),Ic(R,v.x,v.y,ze.x,Jt+ze.y,ke.x,ke.y+ke.h,a,Ze,Me.x,Se.y,Re,Ae),Ic(R,v.x,v.y,Oe.x,Jt+Oe.y,ke.x+ke.w,ke.y+ke.h,a,Ze,Se.x,Se.y,Re,Ae),ou(e.dynamicLayoutVertexArray,v,re),z.emplaceBack(mt,mt+1,mt+2),z.emplaceBack(mt+1,mt+2,mt+3),O.vertexLength+=4,O.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(xe[0]),ae!==r.length-1&&$e===r[ae+1].sectionIndex||e.programConfigurations.populatePaintArrays(R.length,m,m.index,{},M,Y&&Y[$e])}e.placedSymbolArray.emplaceBack(v.x,v.y,Z,this.glyphOffsetArray.length-Z,K,w,T,v.segment,a?a[0]:0,a?a[1]:0,o[0],o[1],f,0,!1,0,E)}_addCollisionDebugVertex(e,r,a,o,u,m){return r.emplaceBack(0,0),e.emplaceBack(a.x,a.y,o,u,Math.round(m.x),Math.round(m.y))}addCollisionDebugVertices(e,r,a,o,u,m,f){const v=u.segments.prepareSegment(4,u.layoutVertexArray,u.indexArray),w=v.vertexLength,T=u.layoutVertexArray,E=u.collisionVertexArray,M=f.anchorX,z=f.anchorY;this._addCollisionDebugVertex(T,E,m,M,z,new de(e,r)),this._addCollisionDebugVertex(T,E,m,M,z,new de(a,r)),this._addCollisionDebugVertex(T,E,m,M,z,new de(a,o)),this._addCollisionDebugVertex(T,E,m,M,z,new de(e,o)),v.vertexLength+=4;const R=u.indexArray;R.emplaceBack(w,w+1),R.emplaceBack(w+1,w+2),R.emplaceBack(w+2,w+3),R.emplaceBack(w+3,w),v.primitiveLength+=4}addDebugCollisionBoxes(e,r,a,o){for(let u=e;u<r;u++){const m=this.collisionBoxArray.get(u);this.addCollisionDebugVertices(m.x1,m.y1,m.x2,m.y2,o?this.textCollisionBox:this.iconCollisionBox,m.anchorPoint,a)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new cu(hi,Jd.members,xi),this.iconCollisionBox=new cu(hi,Jd.members,xi);for(let e=0;e<this.symbolInstances.length;e++){const r=this.symbolInstances.get(e);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(e,r,a,o,u,m,f,v,w){const T={};for(let E=r;E<a;E++){const M=e.get(E);T.textBox={x1:M.x1,y1:M.y1,x2:M.x2,y2:M.y2,anchorPointX:M.anchorPointX,anchorPointY:M.anchorPointY},T.textFeatureIndex=M.featureIndex;break}for(let E=o;E<u;E++){const M=e.get(E);T.verticalTextBox={x1:M.x1,y1:M.y1,x2:M.x2,y2:M.y2,anchorPointX:M.anchorPointX,anchorPointY:M.anchorPointY},T.verticalTextFeatureIndex=M.featureIndex;break}for(let E=m;E<f;E++){const M=e.get(E);T.iconBox={x1:M.x1,y1:M.y1,x2:M.x2,y2:M.y2,anchorPointX:M.anchorPointX,anchorPointY:M.anchorPointY},T.iconFeatureIndex=M.featureIndex;break}for(let E=v;E<w;E++){const M=e.get(E);T.verticalIconBox={x1:M.x1,y1:M.y1,x2:M.x2,y2:M.y2,anchorPointX:M.anchorPointX,anchorPointY:M.anchorPointY},T.verticalIconFeatureIndex=M.featureIndex;break}return T}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const a=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,a.textBoxStartIndex,a.textBoxEndIndex,a.verticalTextBoxStartIndex,a.verticalTextBoxEndIndex,a.iconBoxStartIndex,a.iconBoxEndIndex,a.verticalIconBoxStartIndex,a.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(e,r){const a=e.placedSymbolArray.get(r),o=a.vertexStartIndex+4*a.numGlyphs;for(let u=a.vertexStartIndex;u<o;u+=4)e.indexArray.emplaceBack(u,u+1,u+2),e.indexArray.emplaceBack(u+1,u+2,u+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(e),a=Math.cos(e),o=[],u=[],m=[];for(let f=0;f<this.symbolInstances.length;++f){m.push(f);const v=this.symbolInstances.get(f);o.push(0|Math.round(r*v.anchorX+a*v.anchorY)),u.push(v.featureIndex)}return m.sort((f,v)=>o[f]-o[v]||u[v]-u[f]),m}addToSortKeyRanges(e,r){const a=this.sortKeyRanges[this.sortKeyRanges.length-1];a&&a.sortKey===r?a.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const a=this.symbolInstances.get(r);this.featureSortOrder.push(a.featureIndex),[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex].forEach((o,u,m)=>{o>=0&&m.indexOf(o)===u&&this.addIndicesForPlacedSymbol(this.text,o)}),a.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,a.verticalPlacedTextSymbolIndex),a.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.placedIconSymbolIndex),a.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let fm,gm;De("SymbolBucket",qs,{omit:["layers","collisionBoxArray","features","compareText"]}),qs.MAX_GLYPHS=65535,qs.addDynamicAttributes=ou;var hu={get paint(){return gm=gm||new di({"icon-opacity":new We(ue.paint_symbol["icon-opacity"]),"icon-color":new We(ue.paint_symbol["icon-color"]),"icon-halo-color":new We(ue.paint_symbol["icon-halo-color"]),"icon-halo-width":new We(ue.paint_symbol["icon-halo-width"]),"icon-halo-blur":new We(ue.paint_symbol["icon-halo-blur"]),"icon-translate":new je(ue.paint_symbol["icon-translate"]),"icon-translate-anchor":new je(ue.paint_symbol["icon-translate-anchor"]),"text-opacity":new We(ue.paint_symbol["text-opacity"]),"text-color":new We(ue.paint_symbol["text-color"],{runtimeType:Zi,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new We(ue.paint_symbol["text-halo-color"]),"text-halo-width":new We(ue.paint_symbol["text-halo-width"]),"text-halo-blur":new We(ue.paint_symbol["text-halo-blur"]),"text-translate":new je(ue.paint_symbol["text-translate"]),"text-translate-anchor":new je(ue.paint_symbol["text-translate-anchor"])})},get layout(){return fm=fm||new di({"symbol-placement":new je(ue.layout_symbol["symbol-placement"]),"symbol-spacing":new je(ue.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new je(ue.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new We(ue.layout_symbol["symbol-sort-key"]),"symbol-z-order":new je(ue.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new je(ue.layout_symbol["icon-allow-overlap"]),"icon-overlap":new je(ue.layout_symbol["icon-overlap"]),"icon-ignore-placement":new je(ue.layout_symbol["icon-ignore-placement"]),"icon-optional":new je(ue.layout_symbol["icon-optional"]),"icon-rotation-alignment":new je(ue.layout_symbol["icon-rotation-alignment"]),"icon-size":new We(ue.layout_symbol["icon-size"]),"icon-text-fit":new je(ue.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new je(ue.layout_symbol["icon-text-fit-padding"]),"icon-image":new We(ue.layout_symbol["icon-image"]),"icon-rotate":new We(ue.layout_symbol["icon-rotate"]),"icon-padding":new We(ue.layout_symbol["icon-padding"]),"icon-keep-upright":new je(ue.layout_symbol["icon-keep-upright"]),"icon-offset":new We(ue.layout_symbol["icon-offset"]),"icon-anchor":new We(ue.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new je(ue.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new je(ue.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new je(ue.layout_symbol["text-rotation-alignment"]),"text-field":new We(ue.layout_symbol["text-field"]),"text-font":new We(ue.layout_symbol["text-font"]),"text-size":new We(ue.layout_symbol["text-size"]),"text-max-width":new We(ue.layout_symbol["text-max-width"]),"text-line-height":new je(ue.layout_symbol["text-line-height"]),"text-letter-spacing":new We(ue.layout_symbol["text-letter-spacing"]),"text-justify":new We(ue.layout_symbol["text-justify"]),"text-radial-offset":new We(ue.layout_symbol["text-radial-offset"]),"text-variable-anchor":new je(ue.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new We(ue.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new We(ue.layout_symbol["text-anchor"]),"text-max-angle":new je(ue.layout_symbol["text-max-angle"]),"text-writing-mode":new je(ue.layout_symbol["text-writing-mode"]),"text-rotate":new We(ue.layout_symbol["text-rotate"]),"text-padding":new je(ue.layout_symbol["text-padding"]),"text-keep-upright":new je(ue.layout_symbol["text-keep-upright"]),"text-transform":new We(ue.layout_symbol["text-transform"]),"text-offset":new We(ue.layout_symbol["text-offset"]),"text-allow-overlap":new je(ue.layout_symbol["text-allow-overlap"]),"text-overlap":new je(ue.layout_symbol["text-overlap"]),"text-ignore-placement":new je(ue.layout_symbol["text-ignore-placement"]),"text-optional":new je(ue.layout_symbol["text-optional"])})}};class ym{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:sn,this.defaultValue=e}evaluate(e){if(e.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}De("FormatSectionOverride",ym,{omit:["defaultValue"]});class Ac extends Cr{constructor(e){super(e,hu)}recalculate(e,r){if(super.recalculate(e,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const a=this.layout.get("text-writing-mode");if(a){const o=[];for(const u of a)o.indexOf(u)<0&&o.push(u);this.layout._values["text-writing-mode"]=o}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,a,o){const u=this.layout.get(e).evaluate(r,{},a,o),m=this._unevaluatedLayout._values[e];return m.isDataDriven()||Is(m.value)||!u?u:function(f,v){return v.replace(/{([^{}]+)}/g,(w,T)=>f&&T in f?String(f[T]):"")}(r.properties,u)}createBucket(e){return new qs(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of hu.paint.overridableProperties){if(!Ac.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),a=new ym(r),o=new xo(a,r.property.specification);let u=null;u=r.value.kind==="constant"||r.value.kind==="source"?new bo("source",o):new Cs("composite",o,r.value.zoomStops),this.paint._values[e]=new Hi(r.property,u,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,a){return!(!this.layout||r.isDataDriven()||a.isDataDriven())&&Ac.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const a=e.get("text-field"),o=hu.paint.properties[r];let u=!1;const m=f=>{for(const v of f)if(o.overrides&&o.overrides.hasOverride(v))return void(u=!0)};if(a.value.kind==="constant"&&a.value.value instanceof Ni)m(a.value.value.sections);else if(a.value.kind==="source"){const f=w=>{u||(w instanceof Vn&&ti(w.value)===$?m(w.value.sections):w instanceof Ts?m(w.sections):w.eachChild(f))},v=a.value;v._styleExpression&&f(v._styleExpression.expression)}return u}}let _m;var A0={get paint(){return _m=_m||new di({"background-color":new je(ue.paint_background["background-color"]),"background-pattern":new Bo(ue.paint_background["background-pattern"]),"background-opacity":new je(ue.paint_background["background-opacity"])})}};class C0 extends Cr{constructor(e){super(e,A0)}}let vm;var E0={get paint(){return vm=vm||new di({"raster-opacity":new je(ue.paint_raster["raster-opacity"]),"raster-hue-rotate":new je(ue.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new je(ue.paint_raster["raster-brightness-min"]),"raster-brightness-max":new je(ue.paint_raster["raster-brightness-max"]),"raster-saturation":new je(ue.paint_raster["raster-saturation"]),"raster-contrast":new je(ue.paint_raster["raster-contrast"]),"raster-resampling":new je(ue.paint_raster["raster-resampling"]),"raster-fade-duration":new je(ue.paint_raster["raster-fade-duration"])})}};class P0 extends Cr{constructor(e){super(e,E0)}}class M0 extends Cr{constructor(e){super(e,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class k0{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const uu=63710088e-1;class Ia{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Ia(rt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const r=Math.PI/180,a=this.lat*r,o=e.lat*r,u=Math.sin(a)*Math.sin(o)+Math.cos(a)*Math.cos(o)*Math.cos((e.lng-this.lng)*r);return uu*Math.acos(Math.min(u,1))}static convert(e){if(e instanceof Ia)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Ia(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Ia(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const xm=2*Math.PI*uu;function bm(i){return xm*Math.cos(i*Math.PI/180)}function wm(i){return(180+i)/360}function Sm(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function Tm(i,e){return i/bm(e)}function Im(i){return 360*i-180}function pu(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class Cc{constructor(e,r,a=0){this.x=+e,this.y=+r,this.z=+a}static fromLngLat(e,r=0){const a=Ia.convert(e);return new Cc(wm(a.lng),Sm(a.lat),Tm(r,a.lat))}toLngLat(){return new Ia(Im(this.x),pu(this.y))}toAltitude(){return this.z*bm(pu(this.y))}meterInMercatorCoordinateUnits(){return 1/xm*(e=pu(this.y),1/Math.cos(e*Math.PI/180));var e}}function Am(i,e,r){var a=2*Math.PI*6378137/256/Math.pow(2,r);return[i*a-2*Math.PI*6378137/2,e*a-2*Math.PI*6378137/2]}class du{constructor(e,r,a){if(e<0||e>25||a<0||a>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error(`x=${r}, y=${a}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=r,this.y=a,this.key=nl(0,e,e,r,a)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,a){const o=(m=this.y,f=this.z,v=Am(256*(u=this.x),256*(m=Math.pow(2,f)-m-1),f),w=Am(256*(u+1),256*(m+1),f),v[0]+","+v[1]+","+w[0]+","+w[1]);var u,m,f,v,w;const T=function(E,M,z){let R,O="";for(let Z=E;Z>0;Z--)R=1<<Z-1,O+=(M&R?1:0)+(z&R?2:0);return O}(this.z,this.x,this.y);return e[(this.x+this.y)%e.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(a==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,T).replace(/{bbox-epsg-3857}/g,o)}isChildOf(e){const r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){const r=Math.pow(2,this.z);return new de((e.x*r-this.x)*_i,(e.y*r-this.y)*_i)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Cm{constructor(e,r){this.wrap=e,this.canonical=r,this.key=nl(e,r.z,r.z,r.x,r.y)}}class Br{constructor(e,r,a,o,u){if(e<a)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${a}`);this.overscaledZ=e,this.wrap=r,this.canonical=new du(a,+o,+u),this.key=nl(r,e,a,o,u)}clone(){return new Br(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-e;return e>this.canonical.z?new Br(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Br(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const a=this.canonical.z-e;return e>this.canonical.z?nl(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):nl(this.wrap*+r,e,e,this.canonical.x>>a,this.canonical.y>>a)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new Br(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,a=2*this.canonical.x,o=2*this.canonical.y;return[new Br(r,this.wrap,r,a,o),new Br(r,this.wrap,r,a+1,o),new Br(r,this.wrap,r,a,o+1),new Br(r,this.wrap,r,a+1,o+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Br(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Br(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Cm(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new Cc(e.x-this.wrap,e.y))}}function nl(i,e,r,a,o){(i*=2)<0&&(i=-1*i-1);const u=1<<r;return(u*u*i+u*o+a).toString(36)+r.toString(36)+e.toString(36)}De("CanonicalTileID",du),De("OverscaledTileID",Br,{omit:["posMatrix"]});class Em{constructor(e,r,a,o=1,u=1,m=1,f=0){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(a&&!["mapbox","terrarium","custom"].includes(a))return void st(`"${a}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=r.height;const v=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),a){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=o,this.greenFactor=u,this.blueFactor=m,this.baseShift=f;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let w=0;w<v;w++)this.data[this._idx(-1,w)]=this.data[this._idx(0,w)],this.data[this._idx(v,w)]=this.data[this._idx(v-1,w)],this.data[this._idx(w,-1)]=this.data[this._idx(w,0)],this.data[this._idx(w,v)]=this.data[this._idx(w,v-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(v,-1)]=this.data[this._idx(v-1,0)],this.data[this._idx(-1,v)]=this.data[this._idx(0,v-1)],this.data[this._idx(v,v)]=this.data[this._idx(v-1,v-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let w=0;w<v;w++)for(let T=0;T<v;T++){const E=this.get(w,T);E>this.max&&(this.max=E),E<this.min&&(this.min=E)}}get(e,r){const a=new Uint8Array(this.data.buffer),o=4*this._idx(e,r);return this.unpack(a[o],a[o+1],a[o+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,r){if(e<-1||e>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(e+1)}unpack(e,r,a){return e*this.redFactor+r*this.greenFactor+a*this.blueFactor-this.baseShift}getPixels(){return new Rr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,a){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let o=r*this.dim,u=r*this.dim+this.dim,m=a*this.dim,f=a*this.dim+this.dim;switch(r){case-1:o=u-1;break;case 1:u=o+1}switch(a){case-1:m=f-1;break;case 1:f=m+1}const v=-r*this.dim,w=-a*this.dim;for(let T=m;T<f;T++)for(let E=o;E<u;E++)this.data[this._idx(E,T)]=e.data[this._idx(E+v,T+w)]}}De("DEMData",Em);class Pm{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){const a=e[r];this._stringToNumber[a]=r,this._numberToString[r]=a}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class Mm{constructor(e,r,a,o,u){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=a,e._y=o,this.properties=e.properties,this.id=u}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(e[r]=this[r]);return e}}class km{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new ya(_i,16,0),this.grid3D=new ya(_i,16,0),this.featureIndexArray=new _e,this.promoteId=r}insert(e,r,a,o,u,m){const f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(a,o,u);const v=m?this.grid3D:this.grid;for(let w=0;w<r.length;w++){const T=r[w],E=[1/0,1/0,-1/0,-1/0];for(let M=0;M<T.length;M++){const z=T[M];E[0]=Math.min(E[0],z.x),E[1]=Math.min(E[1],z.y),E[2]=Math.max(E[2],z.x),E[3]=Math.max(E[3],z.y)}E[0]<_i&&E[1]<_i&&E[2]>=0&&E[3]>=0&&v.insert(f,E[0],E[1],E[2],E[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new wa.VectorTile(new tu(this.rawTileData)).layers,this.sourceLayerCoder=new Pm(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,a,o){this.loadVTLayers();const u=e.params||{},m=_i/e.tileSize/e.scale,f=So(u.filter),v=e.queryGeometry,w=e.queryPadding*m,T=zm(v),E=this.grid.query(T.minX-w,T.minY-w,T.maxX+w,T.maxY+w),M=zm(e.cameraQueryGeometry),z=this.grid3D.query(M.minX-w,M.minY-w,M.maxX+w,M.maxY+w,(Z,K,re,Y)=>function(ae,le,ge,ze,Oe){for(const Me of ae)if(le<=Me.x&&ge<=Me.y&&ze>=Me.x&&Oe>=Me.y)return!0;const ke=[new de(le,ge),new de(le,Oe),new de(ze,Oe),new de(ze,ge)];if(ae.length>2){for(const Me of ke)if(Os(ae,Me))return!0}for(let Me=0;Me<ae.length-1;Me++)if(c_(ae[Me],ae[Me+1],ke))return!0;return!1}(e.cameraQueryGeometry,Z-w,K-w,re+w,Y+w));for(const Z of z)E.push(Z);E.sort(L0);const R={};let O;for(let Z=0;Z<E.length;Z++){const K=E[Z];if(K===O)continue;O=K;const re=this.featureIndexArray.get(K);let Y=null;this.loadMatchingFeature(R,re.bucketIndex,re.sourceLayerIndex,re.featureIndex,f,u.layers,u.availableImages,r,a,o,(ae,le,ge)=>(Y||(Y=Ja(ae)),le.queryIntersectsFeature(v,ae,ge,Y,this.z,e.transform,m,e.pixelPosMatrix)))}return R}loadMatchingFeature(e,r,a,o,u,m,f,v,w,T,E){const M=this.bucketLayerIDs[r];if(m&&!function(Z,K){for(let re=0;re<Z.length;re++)if(K.indexOf(Z[re])>=0)return!0;return!1}(m,M))return;const z=this.sourceLayerCoder.decode(a),R=this.vtLayers[z].feature(o);if(u.needGeometry){const Z=Qa(R,!0);if(!u.filter(new Xt(this.tileID.overscaledZ),Z,this.tileID.canonical))return}else if(!u.filter(new Xt(this.tileID.overscaledZ),R))return;const O=this.getId(R,z);for(let Z=0;Z<M.length;Z++){const K=M[Z];if(m&&m.indexOf(K)<0)continue;const re=v[K];if(!re)continue;let Y={};O&&T&&(Y=T.getState(re.sourceLayer||"_geojsonTileLayer",O));const ae=Ve({},w[K]);ae.paint=Lm(ae.paint,re.paint,R,Y,f),ae.layout=Lm(ae.layout,re.layout,R,Y,f);const le=!E||E(R,re,Y);if(!le)continue;const ge=new Mm(R,this.z,this.x,this.y,O);ge.layer=ae;let ze=e[K];ze===void 0&&(ze=e[K]=[]),ze.push({featureIndex:o,feature:ge,intersectionZ:le})}}lookupSymbolFeatures(e,r,a,o,u,m,f,v){const w={};this.loadVTLayers();const T=So(u);for(const E of e)this.loadMatchingFeature(w,a,o,E,T,m,f,v,r);return w}hasLayer(e){for(const r of this.bucketLayerIDs)for(const a of r)if(e===a)return!0;return!1}getId(e,r){let a=e.id;return this.promoteId&&(a=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof a=="boolean"&&(a=Number(a))),a}}function Lm(i,e,r,a,o){return Ge(i,(u,m)=>{const f=e instanceof Bs?e.get(m):null;return f&&f.evaluate?f.evaluate(r,a,o):f})}function zm(i){let e=1/0,r=1/0,a=-1/0,o=-1/0;for(const u of i)e=Math.min(e,u.x),r=Math.min(r,u.y),a=Math.max(a,u.x),o=Math.max(o,u.y);return{minX:e,minY:r,maxX:a,maxY:o}}function L0(i,e){return e-i}function Dm(i,e,r,a,o){const u=[];for(let m=0;m<i.length;m++){const f=i[m];let v;for(let w=0;w<f.length-1;w++){let T=f[w],E=f[w+1];T.x<e&&E.x<e||(T.x<e?T=new de(e,T.y+(e-T.x)/(E.x-T.x)*(E.y-T.y))._round():E.x<e&&(E=new de(e,T.y+(e-T.x)/(E.x-T.x)*(E.y-T.y))._round()),T.y<r&&E.y<r||(T.y<r?T=new de(T.x+(r-T.y)/(E.y-T.y)*(E.x-T.x),r)._round():E.y<r&&(E=new de(T.x+(r-T.y)/(E.y-T.y)*(E.x-T.x),r)._round()),T.x>=a&&E.x>=a||(T.x>=a?T=new de(a,T.y+(a-T.x)/(E.x-T.x)*(E.y-T.y))._round():E.x>=a&&(E=new de(a,T.y+(a-T.x)/(E.x-T.x)*(E.y-T.y))._round()),T.y>=o&&E.y>=o||(T.y>=o?T=new de(T.x+(o-T.y)/(E.y-T.y)*(E.x-T.x),o)._round():E.y>=o&&(E=new de(T.x+(o-T.y)/(E.y-T.y)*(E.x-T.x),o)._round()),v&&T.equals(v[v.length-1])||(v=[T],u.push(v)),v.push(E)))))}}return u}De("FeatureIndex",km,{omit:["rawTileData","sourceLayerCoder"]});class Aa extends de{constructor(e,r,a,o){super(e,r),this.angle=a,o!==void 0&&(this.segment=o)}clone(){return new Aa(this.x,this.y,this.angle,this.segment)}}function Rm(i,e,r,a,o){if(e.segment===void 0||r===0)return!0;let u=e,m=e.segment+1,f=0;for(;f>-r/2;){if(m--,m<0)return!1;f-=i[m].dist(u),u=i[m]}f+=i[m].dist(i[m+1]),m++;const v=[];let w=0;for(;f<r/2;){const T=i[m],E=i[m+1];if(!E)return!1;let M=i[m-1].angleTo(T)-T.angleTo(E);for(M=Math.abs((M+3*Math.PI)%(2*Math.PI)-Math.PI),v.push({distance:f,angleDelta:M}),w+=M;f-v[0].distance>a;)w-=v.shift().angleDelta;if(w>o)return!1;m++,f+=T.dist(E)}return!0}function Bm(i){let e=0;for(let r=0;r<i.length-1;r++)e+=i[r].dist(i[r+1]);return e}function Fm(i,e,r){return i?.6*e*r:0}function Om(i,e){return Math.max(i?i.right-i.left:0,e?e.right-e.left:0)}function z0(i,e,r,a,o,u){const m=Fm(r,o,u),f=Om(r,a)*u;let v=0;const w=Bm(i)/2;for(let T=0;T<i.length-1;T++){const E=i[T],M=i[T+1],z=E.dist(M);if(v+z>w){const R=(w-v)/z,O=cr.number(E.x,M.x,R),Z=cr.number(E.y,M.y,R),K=new Aa(O,Z,M.angleTo(E),T);return K._round(),!m||Rm(i,K,f,m,e)?K:void 0}v+=z}}function D0(i,e,r,a,o,u,m,f,v){const w=Fm(a,u,m),T=Om(a,o),E=T*m,M=i[0].x===0||i[0].x===v||i[0].y===0||i[0].y===v;return e-E<e/4&&(e=E+e/4),Nm(i,M?e/2*f%e:(T/2+2*u)*m*f%e,e,w,r,E,M,!1,v)}function Nm(i,e,r,a,o,u,m,f,v){const w=u/2,T=Bm(i);let E=0,M=e-r,z=[];for(let R=0;R<i.length-1;R++){const O=i[R],Z=i[R+1],K=O.dist(Z),re=Z.angleTo(O);for(;M+r<E+K;){M+=r;const Y=(M-E)/K,ae=cr.number(O.x,Z.x,Y),le=cr.number(O.y,Z.y,Y);if(ae>=0&&ae<v&&le>=0&&le<v&&M-w>=0&&M+w<=T){const ge=new Aa(ae,le,re,R);ge._round(),a&&!Rm(i,ge,u,a,o)||z.push(ge)}}E+=K}return f||z.length||m||(z=Nm(i,E/2,r,a,o,u,m,!0,v)),z}De("Anchor",Aa);const Zs=mr;function Um(i,e,r,a){const o=[],u=i.image,m=u.pixelRatio,f=u.paddedRect.w-2*Zs,v=u.paddedRect.h-2*Zs,w=i.right-i.left,T=i.bottom-i.top,E=u.stretchX||[[0,f]],M=u.stretchY||[[0,v]],z=(Se,Re)=>Se+Re[1]-Re[0],R=E.reduce(z,0),O=M.reduce(z,0),Z=f-R,K=v-O;let re=0,Y=R,ae=0,le=O,ge=0,ze=Z,Oe=0,ke=K;if(u.content&&a){const Se=u.content;re=Ec(E,0,Se[0]),ae=Ec(M,0,Se[1]),Y=Ec(E,Se[0],Se[2]),le=Ec(M,Se[1],Se[3]),ge=Se[0]-re,Oe=Se[1]-ae,ze=Se[2]-Se[0]-Y,ke=Se[3]-Se[1]-le}const Me=(Se,Re,Ae,xe)=>{const Ze=Pc(Se.stretch-re,Y,w,i.left),$e=Mc(Se.fixed-ge,ze,Se.stretch,R),mt=Pc(Re.stretch-ae,le,T,i.top),Jt=Mc(Re.fixed-Oe,ke,Re.stretch,O),ei=Pc(Ae.stretch-re,Y,w,i.left),Si=Mc(Ae.fixed-ge,ze,Ae.stretch,R),Pr=Pc(xe.stretch-ae,le,T,i.top),nr=Mc(xe.fixed-Oe,ke,xe.stretch,O),vi=new de(Ze,mt),Ri=new de(ei,mt),$i=new de(ei,Pr),ar=new de(Ze,Pr),sr=new de($e/m,Jt/m),Ti=new de(Si/m,nr/m),Ii=e*Math.PI/180;if(Ii){const Xi=Math.sin(Ii),fr=Math.cos(Ii),gr=[fr,-Xi,Xi,fr];vi._matMult(gr),Ri._matMult(gr),ar._matMult(gr),$i._matMult(gr)}const Ki=Se.stretch+Se.fixed,or=Re.stretch+Re.fixed;return{tl:vi,tr:Ri,bl:ar,br:$i,tex:{x:u.paddedRect.x+Zs+Ki,y:u.paddedRect.y+Zs+or,w:Ae.stretch+Ae.fixed-Ki,h:xe.stretch+xe.fixed-or},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:sr,pixelOffsetBR:Ti,minFontScaleX:ze/m/w,minFontScaleY:ke/m/T,isSDF:r}};if(a&&(u.stretchX||u.stretchY)){const Se=Vm(E,Z,R),Re=Vm(M,K,O);for(let Ae=0;Ae<Se.length-1;Ae++){const xe=Se[Ae],Ze=Se[Ae+1];for(let $e=0;$e<Re.length-1;$e++)o.push(Me(xe,Re[$e],Ze,Re[$e+1]))}}else o.push(Me({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:f+1},{fixed:0,stretch:v+1}));return o}function Ec(i,e,r){let a=0;for(const o of i)a+=Math.max(e,Math.min(r,o[1]))-Math.max(e,Math.min(r,o[0]));return a}function Vm(i,e,r){const a=[{fixed:-Zs,stretch:0}];for(const[o,u]of i){const m=a[a.length-1];a.push({fixed:o-m.stretch,stretch:m.stretch}),a.push({fixed:o-m.stretch,stretch:m.stretch+(u-o)})}return a.push({fixed:e+Zs,stretch:r}),a}function Pc(i,e,r,a){return i/e*r+a}function Mc(i,e,r,a){return i-e*r/a}class kc{constructor(e,r,a,o,u,m,f,v,w,T){if(this.boxStartIndex=e.length,w){let E=m.top,M=m.bottom;const z=m.collisionPadding;z&&(E-=z[1],M+=z[3]);let R=M-E;R>0&&(R=Math.max(10,R),this.circleDiameter=R)}else{let E=m.top*f-v[0],M=m.bottom*f+v[2],z=m.left*f-v[3],R=m.right*f+v[1];const O=m.collisionPadding;if(O&&(z-=O[0]*f,E-=O[1]*f,R+=O[2]*f,M+=O[3]*f),T){const Z=new de(z,E),K=new de(R,E),re=new de(z,M),Y=new de(R,M),ae=T*Math.PI/180;Z._rotate(ae),K._rotate(ae),re._rotate(ae),Y._rotate(ae),z=Math.min(Z.x,K.x,re.x,Y.x),R=Math.max(Z.x,K.x,re.x,Y.x),E=Math.min(Z.y,K.y,re.y,Y.y),M=Math.max(Z.y,K.y,re.y,Y.y)}e.emplaceBack(r.x,r.y,z,E,R,M,a,o,u)}this.boxEndIndex=e.length}}class R0{constructor(e=[],r=B0){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let a=(this.length>>1)-1;a>=0;a--)this._down(a)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:a}=this,o=r[e];for(;e>0;){const u=e-1>>1,m=r[u];if(a(o,m)>=0)break;r[e]=m,e=u}r[e]=o}_down(e){const{data:r,compare:a}=this,o=this.length>>1,u=r[e];for(;e<o;){let m=1+(e<<1),f=r[m];const v=m+1;if(v<this.length&&a(r[v],f)<0&&(m=v,f=r[v]),a(f,u)>=0)break;r[e]=f,e=m}r[e]=u}}function B0(i,e){return i<e?-1:i>e?1:0}function F0(i,e=1,r=!1){let a=1/0,o=1/0,u=-1/0,m=-1/0;const f=i[0];for(let z=0;z<f.length;z++){const R=f[z];(!z||R.x<a)&&(a=R.x),(!z||R.y<o)&&(o=R.y),(!z||R.x>u)&&(u=R.x),(!z||R.y>m)&&(m=R.y)}const v=Math.min(u-a,m-o);let w=v/2;const T=new R0([],O0);if(v===0)return new de(a,o);for(let z=a;z<u;z+=v)for(let R=o;R<m;R+=v)T.push(new Hs(z+w,R+w,w,i));let E=function(z){let R=0,O=0,Z=0;const K=z[0];for(let re=0,Y=K.length,ae=Y-1;re<Y;ae=re++){const le=K[re],ge=K[ae],ze=le.x*ge.y-ge.x*le.y;O+=(le.x+ge.x)*ze,Z+=(le.y+ge.y)*ze,R+=3*ze}return new Hs(O/R,Z/R,0,z)}(i),M=T.length;for(;T.length;){const z=T.pop();(z.d>E.d||!E.d)&&(E=z,r&&console.log("found best %d after %d probes",Math.round(1e4*z.d)/1e4,M)),z.max-E.d<=e||(w=z.h/2,T.push(new Hs(z.p.x-w,z.p.y-w,w,i)),T.push(new Hs(z.p.x+w,z.p.y-w,w,i)),T.push(new Hs(z.p.x-w,z.p.y+w,w,i)),T.push(new Hs(z.p.x+w,z.p.y+w,w,i)),M+=4)}return r&&(console.log(`num probes: ${M}`),console.log(`best distance: ${E.d}`)),E.p}function O0(i,e){return e.max-i.max}function Hs(i,e,r,a){this.p=new de(i,e),this.h=r,this.d=function(o,u){let m=!1,f=1/0;for(let v=0;v<u.length;v++){const w=u[v];for(let T=0,E=w.length,M=E-1;T<E;M=T++){const z=w[T],R=w[M];z.y>o.y!=R.y>o.y&&o.x<(R.x-z.x)*(o.y-z.y)/(R.y-z.y)+z.x&&(m=!m),f=Math.min(f,Sd(o,z,R))}}return(m?1:-1)*Math.sqrt(f)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}var Vi;l.aq=void 0,(Vi=l.aq||(l.aq={}))[Vi.center=1]="center",Vi[Vi.left=2]="left",Vi[Vi.right=3]="right",Vi[Vi.top=4]="top",Vi[Vi.bottom=5]="bottom",Vi[Vi["top-left"]=6]="top-left",Vi[Vi["top-right"]=7]="top-right",Vi[Vi["bottom-left"]=8]="bottom-left",Vi[Vi["bottom-right"]=9]="bottom-right";const Ca=7,mu=Number.POSITIVE_INFINITY;function $m(i,e){return e[1]!==mu?function(r,a,o){let u=0,m=0;switch(a=Math.abs(a),o=Math.abs(o),r){case"top-right":case"top-left":case"top":m=o-Ca;break;case"bottom-right":case"bottom-left":case"bottom":m=-o+Ca}switch(r){case"top-right":case"bottom-right":case"right":u=-a;break;case"top-left":case"bottom-left":case"left":u=a}return[u,m]}(i,e[0],e[1]):function(r,a){let o=0,u=0;a<0&&(a=0);const m=a/Math.SQRT2;switch(r){case"top-right":case"top-left":u=m-Ca;break;case"bottom-right":case"bottom-left":u=-m+Ca;break;case"bottom":u=-a+Ca;break;case"top":u=a-Ca}switch(r){case"top-right":case"bottom-right":o=-m;break;case"top-left":case"bottom-left":o=m;break;case"left":o=a;break;case"right":o=-a}return[o,u]}(i,e[0])}function jm(i,e,r){var a;const o=i.layout,u=(a=o.get("text-variable-anchor-offset"))===null||a===void 0?void 0:a.evaluate(e,{},r);if(u){const f=u.values,v=[];for(let w=0;w<f.length;w+=2){const T=v[w]=f[w],E=f[w+1].map(M=>M*wi);T.startsWith("top")?E[1]-=Ca:T.startsWith("bottom")&&(E[1]+=Ca),v[w+1]=E}return new Sr(v)}const m=o.get("text-variable-anchor");if(m){let f;f=i._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[o.get("text-radial-offset").evaluate(e,{},r)*wi,mu]:o.get("text-offset").evaluate(e,{},r).map(w=>w*wi);const v=[];for(const w of m)v.push(w,$m(w,f));return new Sr(v)}return null}function fu(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function N0(i,e,r,a,o,u,m,f,v,w,T){let E=u.textMaxSize.evaluate(e,{});E===void 0&&(E=m);const M=i.layers[0].layout,z=M.get("icon-offset").evaluate(e,{},T),R=qm(r.horizontal),O=m/24,Z=i.tilePixelRatio*O,K=i.tilePixelRatio*E/24,re=i.tilePixelRatio*f,Y=i.tilePixelRatio*M.get("symbol-spacing"),ae=M.get("text-padding")*i.tilePixelRatio,le=function(xe,Ze,$e,mt=1){const Jt=xe.get("icon-padding").evaluate(Ze,{},$e),ei=Jt&&Jt.values;return[ei[0]*mt,ei[1]*mt,ei[2]*mt,ei[3]*mt]}(M,e,T,i.tilePixelRatio),ge=M.get("text-max-angle")/180*Math.PI,ze=M.get("text-rotation-alignment")!=="viewport"&&M.get("symbol-placement")!=="point",Oe=M.get("icon-rotation-alignment")==="map"&&M.get("symbol-placement")!=="point",ke=M.get("symbol-placement"),Me=Y/2,Se=M.get("icon-text-fit");let Re;a&&Se!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Re=dm(a,r.vertical,Se,M.get("icon-text-fit-padding"),z,O)),R&&(a=dm(a,R,Se,M.get("icon-text-fit-padding"),z,O)));const Ae=(xe,Ze)=>{Ze.x<0||Ze.x>=_i||Ze.y<0||Ze.y>=_i||function($e,mt,Jt,ei,Si,Pr,nr,vi,Ri,$i,ar,sr,Ti,Ii,Ki,or,Xi,fr,gr,Ai,wt,Yi,ji,Ci,Qr){const mn=$e.addToLineVertexArray(mt,Jt);let fn,ea,en,Fr,yr=0,ta=0,ol=0,Km=0,Su=-1,Tu=-1;const ia={};let Xm=Xn("");if($e.allowVerticalPlacement&&ei.vertical){const Ji=vi.layout.get("text-rotate").evaluate(wt,{},Ci)+90;en=new kc(Ri,mt,$i,ar,sr,ei.vertical,Ti,Ii,Ki,Ji),nr&&(Fr=new kc(Ri,mt,$i,ar,sr,nr,Xi,fr,Ki,Ji))}if(Si){const Ji=vi.layout.get("icon-rotate").evaluate(wt,{}),Or=vi.layout.get("icon-text-fit")!=="none",ts=Um(Si,Ji,ji,Or),yn=nr?Um(nr,Ji,ji,Or):void 0;ea=new kc(Ri,mt,$i,ar,sr,Si,Xi,fr,!1,Ji),yr=4*ts.length;const is=$e.iconSizeData;let Dn=null;is.kind==="source"?(Dn=[zn*vi.layout.get("icon-size").evaluate(wt,{})],Dn[0]>Ta&&st(`${$e.layerIds[0]}: Value for "icon-size" is >= ${rl}. Reduce your "icon-size".`)):is.kind==="composite"&&(Dn=[zn*Yi.compositeIconSizes[0].evaluate(wt,{},Ci),zn*Yi.compositeIconSizes[1].evaluate(wt,{},Ci)],(Dn[0]>Ta||Dn[1]>Ta)&&st(`${$e.layerIds[0]}: Value for "icon-size" is >= ${rl}. Reduce your "icon-size".`)),$e.addSymbols($e.icon,ts,Dn,Ai,gr,wt,l.ai.none,mt,mn.lineStartIndex,mn.lineLength,-1,Ci),Su=$e.icon.placedSymbolArray.length-1,yn&&(ta=4*yn.length,$e.addSymbols($e.icon,yn,Dn,Ai,gr,wt,l.ai.vertical,mt,mn.lineStartIndex,mn.lineLength,-1,Ci),Tu=$e.icon.placedSymbolArray.length-1)}const Ym=Object.keys(ei.horizontal);for(const Ji of Ym){const Or=ei.horizontal[Ji];if(!fn){Xm=Xn(Or.text);const yn=vi.layout.get("text-rotate").evaluate(wt,{},Ci);fn=new kc(Ri,mt,$i,ar,sr,Or,Ti,Ii,Ki,yn)}const ts=Or.positionedLines.length===1;if(ol+=Gm($e,mt,Or,Pr,vi,Ki,wt,or,mn,ei.vertical?l.ai.horizontal:l.ai.horizontalOnly,ts?Ym:[Ji],ia,Su,Yi,Ci),ts)break}ei.vertical&&(Km+=Gm($e,mt,ei.vertical,Pr,vi,Ki,wt,or,mn,l.ai.vertical,["vertical"],ia,Tu,Yi,Ci));const $0=fn?fn.boxStartIndex:$e.collisionBoxArray.length,j0=fn?fn.boxEndIndex:$e.collisionBoxArray.length,G0=en?en.boxStartIndex:$e.collisionBoxArray.length,q0=en?en.boxEndIndex:$e.collisionBoxArray.length,Z0=ea?ea.boxStartIndex:$e.collisionBoxArray.length,H0=ea?ea.boxEndIndex:$e.collisionBoxArray.length,W0=Fr?Fr.boxStartIndex:$e.collisionBoxArray.length,K0=Fr?Fr.boxEndIndex:$e.collisionBoxArray.length;let gn=-1;const zc=(Ji,Or)=>Ji&&Ji.circleDiameter?Math.max(Ji.circleDiameter,Or):Or;gn=zc(fn,gn),gn=zc(en,gn),gn=zc(ea,gn),gn=zc(Fr,gn);const Jm=gn>-1?1:0;Jm&&(gn*=Qr/wi),$e.glyphOffsetArray.length>=qs.MAX_GLYPHS&&st("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),wt.sortKey!==void 0&&$e.addToSortKeyRanges($e.symbolInstances.length,wt.sortKey);const X0=jm(vi,wt,Ci),[Y0,J0]=function(Ji,Or){const ts=Ji.length,yn=Or?.values;if(yn?.length>0)for(let is=0;is<yn.length;is+=2){const Dn=yn[is+1];Ji.emplaceBack(l.aq[yn[is]],Dn[0],Dn[1])}return[ts,Ji.length]}($e.textAnchorOffsets,X0);$e.symbolInstances.emplaceBack(mt.x,mt.y,ia.right>=0?ia.right:-1,ia.center>=0?ia.center:-1,ia.left>=0?ia.left:-1,ia.vertical||-1,Su,Tu,Xm,$0,j0,G0,q0,Z0,H0,W0,K0,$i,ol,Km,yr,ta,Jm,0,Ti,gn,Y0,J0)}(i,Ze,xe,r,a,o,Re,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,Z,[ae,ae,ae,ae],ze,v,re,le,Oe,z,e,u,w,T,m)};if(ke==="line")for(const xe of Dm(e.geometry,0,0,_i,_i)){const Ze=D0(xe,Y,ge,r.vertical||R,a,24,K,i.overscaling,_i);for(const $e of Ze)R&&U0(i,R.text,Me,$e)||Ae(xe,$e)}else if(ke==="line-center"){for(const xe of e.geometry)if(xe.length>1){const Ze=z0(xe,ge,r.vertical||R,a,24,K);Ze&&Ae(xe,Ze)}}else if(e.type==="Polygon")for(const xe of Hh(e.geometry,0)){const Ze=F0(xe,16);Ae(xe[0],new Aa(Ze.x,Ze.y,0))}else if(e.type==="LineString")for(const xe of e.geometry)Ae(xe,new Aa(xe[0].x,xe[0].y,0));else if(e.type==="Point")for(const xe of e.geometry)for(const Ze of xe)Ae([Ze],new Aa(Ze.x,Ze.y,0))}function Gm(i,e,r,a,o,u,m,f,v,w,T,E,M,z,R){const O=function(re,Y,ae,le,ge,ze,Oe,ke){const Me=le.layout.get("text-rotate").evaluate(ze,{})*Math.PI/180,Se=[];for(const Re of Y.positionedLines)for(const Ae of Re.positionedGlyphs){if(!Ae.rect)continue;const xe=Ae.rect||{};let Ze=sm+1,$e=!0,mt=1,Jt=0;const ei=(ge||ke)&&Ae.vertical,Si=Ae.metrics.advance*Ae.scale/2;if(ke&&Y.verticalizable&&(Jt=Re.lineOffset/2-(Ae.imageName?-(wi-Ae.metrics.width*Ae.scale)/2:(Ae.scale-1)*wi)),Ae.imageName){const Ai=Oe[Ae.imageName];$e=Ai.sdf,mt=Ai.pixelRatio,Ze=mr/mt}const Pr=ge?[Ae.x+Si,Ae.y]:[0,0];let nr=ge?[0,0]:[Ae.x+Si+ae[0],Ae.y+ae[1]-Jt],vi=[0,0];ei&&(vi=nr,nr=[0,0]);const Ri=Ae.metrics.isDoubleResolution?2:1,$i=(Ae.metrics.left-Ze)*Ae.scale-Si+nr[0],ar=(-Ae.metrics.top-Ze)*Ae.scale+nr[1],sr=$i+xe.w/Ri*Ae.scale/mt,Ti=ar+xe.h/Ri*Ae.scale/mt,Ii=new de($i,ar),Ki=new de(sr,ar),or=new de($i,Ti),Xi=new de(sr,Ti);if(ei){const Ai=new de(-Si,Si-tl),wt=-Math.PI/2,Yi=wi/2-Si,ji=new de(5-tl-Yi,-(Ae.imageName?Yi:0)),Ci=new de(...vi);Ii._rotateAround(wt,Ai)._add(ji)._add(Ci),Ki._rotateAround(wt,Ai)._add(ji)._add(Ci),or._rotateAround(wt,Ai)._add(ji)._add(Ci),Xi._rotateAround(wt,Ai)._add(ji)._add(Ci)}if(Me){const Ai=Math.sin(Me),wt=Math.cos(Me),Yi=[wt,-Ai,Ai,wt];Ii._matMult(Yi),Ki._matMult(Yi),or._matMult(Yi),Xi._matMult(Yi)}const fr=new de(0,0),gr=new de(0,0);Se.push({tl:Ii,tr:Ki,bl:or,br:Xi,tex:xe,writingMode:Y.writingMode,glyphOffset:Pr,sectionIndex:Ae.sectionIndex,isSDF:$e,pixelOffsetTL:fr,pixelOffsetBR:gr,minFontScaleX:0,minFontScaleY:0})}return Se}(0,r,f,o,u,m,a,i.allowVerticalPlacement),Z=i.textSizeData;let K=null;Z.kind==="source"?(K=[zn*o.layout.get("text-size").evaluate(m,{})],K[0]>Ta&&st(`${i.layerIds[0]}: Value for "text-size" is >= ${rl}. Reduce your "text-size".`)):Z.kind==="composite"&&(K=[zn*z.compositeTextSizes[0].evaluate(m,{},R),zn*z.compositeTextSizes[1].evaluate(m,{},R)],(K[0]>Ta||K[1]>Ta)&&st(`${i.layerIds[0]}: Value for "text-size" is >= ${rl}. Reduce your "text-size".`)),i.addSymbols(i.text,O,K,f,u,m,w,e,v.lineStartIndex,v.lineLength,M,R);for(const re of T)E[re]=i.text.placedSymbolArray.length-1;return 4*O.length}function qm(i){for(const e in i)return i[e];return null}function U0(i,e,r,a){const o=i.compareText;if(e in o){const u=o[e];for(let m=u.length-1;m>=0;m--)if(a.dist(u[m])<r)return!0}else o[e]=[];return o[e].push(a),!1}const Zm=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class gu{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[r,a]=new Uint8Array(e,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");const o=a>>4;if(o!==1)throw new Error(`Got v${o} data when expected v1.`);const u=Zm[15&a];if(!u)throw new Error("Unrecognized array type.");const[m]=new Uint16Array(e,2,1),[f]=new Uint32Array(e,4,1);return new gu(f,m,u,e)}constructor(e,r=64,a=Float64Array,o){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=a,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const u=Zm.indexOf(this.ArrayType),m=2*e*this.ArrayType.BYTES_PER_ELEMENT,f=e*this.IndexArrayType.BYTES_PER_ELEMENT,v=(8-f%8)%8;if(u<0)throw new Error(`Unexpected typed array class: ${a}.`);o&&o instanceof ArrayBuffer?(this.data=o,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+v,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+m+f+v),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+v,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+u]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=e)}add(e,r){const a=this._pos>>1;return this.ids[a]=a,this.coords[this._pos++]=e,this.coords[this._pos++]=r,a}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return yu(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,a,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:u,coords:m,nodeSize:f}=this,v=[0,u.length-1,0],w=[];for(;v.length;){const T=v.pop()||0,E=v.pop()||0,M=v.pop()||0;if(E-M<=f){for(let Z=M;Z<=E;Z++){const K=m[2*Z],re=m[2*Z+1];K>=e&&K<=a&&re>=r&&re<=o&&w.push(u[Z])}continue}const z=M+E>>1,R=m[2*z],O=m[2*z+1];R>=e&&R<=a&&O>=r&&O<=o&&w.push(u[z]),(T===0?e<=R:r<=O)&&(v.push(M),v.push(z-1),v.push(1-T)),(T===0?a>=R:o>=O)&&(v.push(z+1),v.push(E),v.push(1-T))}return w}within(e,r,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:o,coords:u,nodeSize:m}=this,f=[0,o.length-1,0],v=[],w=a*a;for(;f.length;){const T=f.pop()||0,E=f.pop()||0,M=f.pop()||0;if(E-M<=m){for(let Z=M;Z<=E;Z++)Wm(u[2*Z],u[2*Z+1],e,r)<=w&&v.push(o[Z]);continue}const z=M+E>>1,R=u[2*z],O=u[2*z+1];Wm(R,O,e,r)<=w&&v.push(o[z]),(T===0?e-a<=R:r-a<=O)&&(f.push(M),f.push(z-1),f.push(1-T)),(T===0?e+a>=R:r+a>=O)&&(f.push(z+1),f.push(E),f.push(1-T))}return v}}function yu(i,e,r,a,o,u){if(o-a<=r)return;const m=a+o>>1;Hm(i,e,m,a,o,u),yu(i,e,r,a,m-1,1-u),yu(i,e,r,m+1,o,1-u)}function Hm(i,e,r,a,o,u){for(;o>a;){if(o-a>600){const w=o-a+1,T=r-a+1,E=Math.log(w),M=.5*Math.exp(2*E/3),z=.5*Math.sqrt(E*M*(w-M)/w)*(T-w/2<0?-1:1);Hm(i,e,r,Math.max(a,Math.floor(r-T*M/w+z)),Math.min(o,Math.floor(r+(w-T)*M/w+z)),u)}const m=e[2*r+u];let f=a,v=o;for(al(i,e,a,r),e[2*o+u]>m&&al(i,e,a,o);f<v;){for(al(i,e,f,v),f++,v--;e[2*f+u]<m;)f++;for(;e[2*v+u]>m;)v--}e[2*a+u]===m?al(i,e,a,v):(v++,al(i,e,v,o)),v<=r&&(a=v+1),r<=v&&(o=v-1)}}function al(i,e,r,a){_u(i,r,a),_u(e,2*r,2*a),_u(e,2*r+1,2*a+1)}function _u(i,e,r){const a=i[e];i[e]=i[r],i[r]=a}function Wm(i,e,r,a){const o=i-r,u=e-a;return o*o+u*u}var vu;l.bh=void 0,(vu=l.bh||(l.bh={})).create="create",vu.load="load",vu.fullLoad="fullLoad";let Lc=null,sl=[];const xu=1e3/60,bu="loadTime",wu="fullLoadTime",V0={mark(i){performance.mark(i)},frame(i){const e=i;Lc!=null&&sl.push(e-Lc),Lc=e},clearMetrics(){Lc=null,sl=[],performance.clearMeasures(bu),performance.clearMeasures(wu);for(const i in l.bh)performance.clearMarks(l.bh[i])},getPerformanceMetrics(){performance.measure(bu,l.bh.create,l.bh.load),performance.measure(wu,l.bh.create,l.bh.fullLoad);const i=performance.getEntriesByName(bu)[0].duration,e=performance.getEntriesByName(wu)[0].duration,r=sl.length,a=1/(sl.reduce((u,m)=>u+m,0)/r/1e3),o=sl.filter(u=>u>xu).reduce((u,m)=>u+(m-xu)/xu,0);return{loadTime:i,fullLoadTime:e,fps:a,percentDroppedFrames:o/(r+o)*100,totalFrames:r}}};l.$=function(i,e,r){var a,o,u,m,f,v,w,T,E,M,z,R,O=r[0],Z=r[1],K=r[2];return e===i?(i[12]=e[0]*O+e[4]*Z+e[8]*K+e[12],i[13]=e[1]*O+e[5]*Z+e[9]*K+e[13],i[14]=e[2]*O+e[6]*Z+e[10]*K+e[14],i[15]=e[3]*O+e[7]*Z+e[11]*K+e[15]):(o=e[1],u=e[2],m=e[3],f=e[4],v=e[5],w=e[6],T=e[7],E=e[8],M=e[9],z=e[10],R=e[11],i[0]=a=e[0],i[1]=o,i[2]=u,i[3]=m,i[4]=f,i[5]=v,i[6]=w,i[7]=T,i[8]=E,i[9]=M,i[10]=z,i[11]=R,i[12]=a*O+f*Z+E*K+e[12],i[13]=o*O+v*Z+M*K+e[13],i[14]=u*O+w*Z+z*K+e[14],i[15]=m*O+T*Z+R*K+e[15]),i},l.A=Ns,l.B=cr,l.C=class{constructor(i,e,r){this.receive=a=>{const o=a.data,u=o.id;if(u&&(!o.targetMapId||this.mapId===o.targetMapId))if(o.type==="<cancel>"){delete this.tasks[u];const m=this.cancelCallbacks[u];delete this.cancelCallbacks[u],m&&m()}else Vt()||o.mustQueue?(this.tasks[u]=o,this.taskQueue.push(u),this.invoker.trigger()):this.processTask(u,o)},this.process=()=>{if(!this.taskQueue.length)return;const a=this.taskQueue.shift(),o=this.tasks[a];delete this.tasks[a],this.taskQueue.length&&this.invoker.trigger(),o&&this.processTask(a,o)},this.target=i,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new k0(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=Vt()?i:window}send(i,e,r,a,o=!1){const u=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[u]=r);const m=[],f={id:u,type:i,hasCallback:!!r,targetMapId:a,mustQueue:o,sourceMapId:this.mapId,data:Mn(e,m)};return this.target.postMessage(f,{transfer:m}),{cancel:()=>{r&&delete this.callbacks[u],this.target.postMessage({id:u,type:"<cancel>",targetMapId:a,sourceMapId:this.mapId})}}}processTask(i,e){if(e.type==="<response>"){const r=this.callbacks[i];delete this.callbacks[i],r&&(e.error?r(_a(e.error)):r(null,_a(e.data)))}else{let r=!1;const a=[],o=e.hasCallback?(f,v)=>{r=!0,delete this.cancelCallbacks[i];const w={id:i,type:"<response>",sourceMapId:this.mapId,error:f?Mn(f):null,data:Mn(v,a)};this.target.postMessage(w,{transfer:a})}:f=>{r=!0};let u=null;const m=_a(e.data);if(this.parent[e.type])u=this.parent[e.type](e.sourceMapId,m,o);else if("getWorkerSource"in this.parent){const f=e.type.split(".");u=this.parent.getWorkerSource(e.sourceMapId,f[0],m.source)[f[1]](m,o)}else o(new Error(`Could not find function ${e.type}`));!r&&u&&u.cancel&&(this.cancelCallbacks[i]=u.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},l.D=je,l.E=On,l.F=function(i,e){const r={};for(let a=0;a<e.length;a++){const o=e[a];o in i&&(r[o]=i[o])}return r},l.G=wm,l.H=Sm,l.I=ru,l.J=St,l.K=Ct,l.L=Ia,l.M=gi,l.N=_i,l.O=Br,l.P=de,l.Q=ni,l.R=Rr,l.S=Yt,l.T=oc,l.U=Cc,l.V=class extends Wn{},l.W=du,l.X=function(i,e){const r=window.document.createElement("video");r.muted=!0,r.onloadstart=function(){e(null,r)};for(let a=0;a<i.length;a++){const o=window.document.createElement("source");nn(i[a])||(r.crossOrigin="Anonymous"),o.src=i[a],r.appendChild(o)}return{cancel:()=>{}}},l.Y=Ie,l.Z=function(){var i=new Ns(16);return Ns!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},l._=oe,l.a=Mi,l.a$=class extends L{},l.a0=function(i,e,r){var a=r[0],o=r[1],u=r[2];return i[0]=e[0]*a,i[1]=e[1]*a,i[2]=e[2]*a,i[3]=e[3]*a,i[4]=e[4]*o,i[5]=e[5]*o,i[6]=e[6]*o,i[7]=e[7]*o,i[8]=e[8]*u,i[9]=e[9]*u,i[10]=e[10]*u,i[11]=e[11]*u,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},l.a1=Cd,l.a2=function(){return pt++},l.a3=j,l.a4=qs,l.a5=function(){pr.isLoading()||pr.isLoaded()||Do()!=="deferred"||sc()},l.a6=So,l.a7=Qa,l.a8=Xt,l.a9=Mm,l.aA=Ha,l.aB=function(i){i=i.slice();const e=Object.create(null);for(let r=0;r<i.length;r++)e[i[r].id]=i[r];for(let r=0;r<i.length;r++)"ref"in i[r]&&(i[r]=br(i[r],e[i[r].ref]));return i},l.aC=function(i){if(i.type==="custom")return new M0(i);switch(i.type){case"background":return new C0(i);case"circle":return new p_(i);case"fill":return new L_(i);case"fill-extrusion":return new H_(i);case"heatmap":return new m_(i);case"hillshade":return new g_(i);case"line":return new t0(i);case"raster":return new P0(i);case"symbol":return new Ac(i)}},l.aD=it,l.aE=function(i,e){if(!i)return[{command:Pt.setStyle,args:[e]}];let r=[];try{if(!Zt(i.version,e.version))return[{command:Pt.setStyle,args:[e]}];Zt(i.center,e.center)||r.push({command:Pt.setCenter,args:[e.center]}),Zt(i.zoom,e.zoom)||r.push({command:Pt.setZoom,args:[e.zoom]}),Zt(i.bearing,e.bearing)||r.push({command:Pt.setBearing,args:[e.bearing]}),Zt(i.pitch,e.pitch)||r.push({command:Pt.setPitch,args:[e.pitch]}),Zt(i.sprite,e.sprite)||r.push({command:Pt.setSprite,args:[e.sprite]}),Zt(i.glyphs,e.glyphs)||r.push({command:Pt.setGlyphs,args:[e.glyphs]}),Zt(i.transition,e.transition)||r.push({command:Pt.setTransition,args:[e.transition]}),Zt(i.light,e.light)||r.push({command:Pt.setLight,args:[e.light]});const a={},o=[];(function(m,f,v,w){let T;for(T in f=f||{},m=m||{})Object.prototype.hasOwnProperty.call(m,T)&&(Object.prototype.hasOwnProperty.call(f,T)||sa(T,v,w));for(T in f)Object.prototype.hasOwnProperty.call(f,T)&&(Object.prototype.hasOwnProperty.call(m,T)?Zt(m[T],f[T])||(m[T].type==="geojson"&&f[T].type==="geojson"&&ls(m,f,T)?v.push({command:Pt.setGeoJSONSourceData,args:[T,f[T].data]}):an(T,f,v,w)):Gr(T,f,v))})(i.sources,e.sources,o,a);const u=[];i.layers&&i.layers.forEach(m=>{a[m.source]?r.push({command:Pt.removeLayer,args:[m.id]}):u.push(m)}),r=r.concat(o),function(m,f,v){f=f||[];const w=(m=m||[]).map(In),T=f.map(In),E=m.reduce(Nn,{}),M=f.reduce(Nn,{}),z=w.slice(),R=Object.create(null);let O,Z,K,re,Y,ae,le;for(O=0,Z=0;O<w.length;O++)K=w[O],Object.prototype.hasOwnProperty.call(M,K)?Z++:(v.push({command:Pt.removeLayer,args:[K]}),z.splice(z.indexOf(K,Z),1));for(O=0,Z=0;O<T.length;O++)K=T[T.length-1-O],z[z.length-1-O]!==K&&(Object.prototype.hasOwnProperty.call(E,K)?(v.push({command:Pt.removeLayer,args:[K]}),z.splice(z.lastIndexOf(K,z.length-Z),1)):Z++,ae=z[z.length-O],v.push({command:Pt.addLayer,args:[M[K],ae]}),z.splice(z.length-O,0,K),R[K]=!0);for(O=0;O<T.length;O++)if(K=T[O],re=E[K],Y=M[K],!R[K]&&!Zt(re,Y))if(Zt(re.source,Y.source)&&Zt(re["source-layer"],Y["source-layer"])&&Zt(re.type,Y.type)){for(le in oa(re.layout,Y.layout,v,K,null,Pt.setLayoutProperty),oa(re.paint,Y.paint,v,K,null,Pt.setPaintProperty),Zt(re.filter,Y.filter)||v.push({command:Pt.setFilter,args:[K,Y.filter]}),Zt(re.minzoom,Y.minzoom)&&Zt(re.maxzoom,Y.maxzoom)||v.push({command:Pt.setLayerZoomRange,args:[K,Y.minzoom,Y.maxzoom]}),re)Object.prototype.hasOwnProperty.call(re,le)&&le!=="layout"&&le!=="paint"&&le!=="filter"&&le!=="metadata"&&le!=="minzoom"&&le!=="maxzoom"&&(le.indexOf("paint.")===0?oa(re[le],Y[le],v,K,le.slice(6),Pt.setPaintProperty):Zt(re[le],Y[le])||v.push({command:Pt.setLayerProperty,args:[K,le,Y[le]]}));for(le in Y)Object.prototype.hasOwnProperty.call(Y,le)&&!Object.prototype.hasOwnProperty.call(re,le)&&le!=="layout"&&le!=="paint"&&le!=="filter"&&le!=="metadata"&&le!=="minzoom"&&le!=="maxzoom"&&(le.indexOf("paint.")===0?oa(re[le],Y[le],v,K,le.slice(6),Pt.setPaintProperty):Zt(re[le],Y[le])||v.push({command:Pt.setLayerProperty,args:[K,le,Y[le]]}))}else v.push({command:Pt.removeLayer,args:[K]}),ae=z[z.lastIndexOf(K)+1],v.push({command:Pt.addLayer,args:[Y,ae]})}(u,e.layers,r)}catch(a){console.warn("Unable to compute style diff:",a),r=[{command:Pt.setStyle,args:[e]}]}return r},l.aF=function(i){const e=[],r=i.id;return r===void 0&&e.push({message:`layers.${r}: missing required property "id"`}),i.render===void 0&&e.push({message:`layers.${r}: missing required method "render"`}),i.renderingMode&&i.renderingMode!=="2d"&&i.renderingMode!=="3d"&&e.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),e},l.aG=function i(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(let a=0;a<e.length;a++)if(!i(e[a],r[a]))return!1;return!0}if(typeof e=="object"&&e!==null&&r!==null){if(typeof r!="object"||Object.keys(e).length!==Object.keys(r).length)return!1;for(const a in e)if(!i(e[a],r[a]))return!1;return!0}return e===r},l.aH=Ge,l.aI=Rt,l.aJ=Wa,l.aK=function(i){return i({pluginStatus:tr,pluginURL:kn}),Wa.on("pluginStateChange",i),i},l.aL=class extends Yn{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},l.aM=Fs,l.aN=class extends Yn{constructor(i,e){super(i,e),this.current=Rh}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let e=1;e<16;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},l.aO=uc,l.aP=class extends Yn{constructor(i,e){super(i,e),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},l.aQ=class extends Yn{constructor(i,e){super(i,e),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},l.aR=pc,l.aS=function(i,e,r,a,o,u,m){var f=1/(e-r),v=1/(a-o),w=1/(u-m);return i[0]=-2*f,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*v,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*w,i[11]=0,i[12]=(e+r)*f,i[13]=(o+a)*v,i[14]=(m+u)*w,i[15]=1,i},l.aT=Nt,l.aU=u_,l.aV=class extends s{},l.aW=a0,l.aX=class extends p{},l.aY=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},l.aZ=Ld,l.a_=we,l.aa=function(i){const e={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,a,o,u)=>{const m=o||u;return e[a]=!m||m.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e},l.ab=function(i,e){const r=[];for(const a in i)a in e||r.push(a);return r},l.ac=function(i){if(ai==null){const e=i.navigator?i.navigator.userAgent:null;ai=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return ai},l.ad=Qe,l.ae=function(i,e,r){var a=Math.sin(r),o=Math.cos(r),u=e[0],m=e[1],f=e[2],v=e[3],w=e[4],T=e[5],E=e[6],M=e[7];return e!==i&&(i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[0]=u*o+w*a,i[1]=m*o+T*a,i[2]=f*o+E*a,i[3]=v*o+M*a,i[4]=w*o-u*a,i[5]=T*o-m*a,i[6]=E*o-f*a,i[7]=M*o-v*a,i},l.af=function(i){var e=new Ns(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},l.ag=gc,l.ah=function(i,e){let r=0,a=0;if(i.kind==="constant")a=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:o,minZoom:u,maxZoom:m}=i,f=o?Qe(hr.interpolationFactor(o,e,u,m),0,1):0;i.kind==="camera"?a=cr.number(i.minSize,i.maxSize,f):r=f}return{uSizeT:r,uSize:a}},l.aj=function(i,{uSize:e,uSizeT:r},{lowerSize:a,upperSize:o}){return i.kind==="source"?a/zn:i.kind==="composite"?cr.number(a/zn,o/zn,r):e},l.ak=ou,l.al=function(i,e,r,a){const o=e.y-i.y,u=e.x-i.x,m=a.y-r.y,f=a.x-r.x,v=m*u-f*o;if(v===0)return null;const w=(f*(i.y-r.y)-m*(i.x-r.x))/v;return new de(i.x+w*u,i.y+w*o)},l.am=Dm,l.an=bd,l.ao=Uh,l.ap=wi,l.ar=su,l.as=function(i,e){var r=e[0],a=e[1],o=e[2],u=e[3],m=e[4],f=e[5],v=e[6],w=e[7],T=e[8],E=e[9],M=e[10],z=e[11],R=e[12],O=e[13],Z=e[14],K=e[15],re=r*f-a*m,Y=r*v-o*m,ae=r*w-u*m,le=a*v-o*f,ge=a*w-u*f,ze=o*w-u*v,Oe=T*O-E*R,ke=T*Z-M*R,Me=T*K-z*R,Se=E*Z-M*O,Re=E*K-z*O,Ae=M*K-z*Z,xe=re*Ae-Y*Re+ae*Se+le*Me-ge*ke+ze*Oe;return xe?(i[0]=(f*Ae-v*Re+w*Se)*(xe=1/xe),i[1]=(o*Re-a*Ae-u*Se)*xe,i[2]=(O*ze-Z*ge+K*le)*xe,i[3]=(M*ge-E*ze-z*le)*xe,i[4]=(v*Me-m*Ae-w*ke)*xe,i[5]=(r*Ae-o*Me+u*ke)*xe,i[6]=(Z*ae-R*ze-K*Y)*xe,i[7]=(T*ze-M*ae+z*Y)*xe,i[8]=(m*Re-f*Me+w*Oe)*xe,i[9]=(a*Me-r*Re-u*Oe)*xe,i[10]=(R*ge-O*ae+K*re)*xe,i[11]=(E*ae-T*ge-z*re)*xe,i[12]=(f*ke-m*Se-v*Oe)*xe,i[13]=(r*Se-a*ke+o*Oe)*xe,i[14]=(O*Y-R*le-Z*re)*xe,i[15]=(T*le-E*Y+M*re)*xe,i):null},l.at=fu,l.au=au,l.av=gu,l.aw=function(){const i={},e=ue.$version;for(const r in ue.$root){const a=ue.$root[r];if(a.required){let o=null;o=r==="version"?e:a.type==="array"?[]:{},o!=null&&(i[r]=o)}}return i},l.ax=Pt,l.ay=ic,l.az=Dr,l.b=function(i,e){const r=new Blob([new Uint8Array(i)],{type:"image/png"});createImageBitmap(r).then(a=>{e(null,a)}).catch(a=>{e(new Error(`Could not load image because of ${a.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})},l.b0=zi,l.b1=function(i,e){var r=i[0],a=i[1],o=i[2],u=i[3],m=i[4],f=i[5],v=i[6],w=i[7],T=i[8],E=i[9],M=i[10],z=i[11],R=i[12],O=i[13],Z=i[14],K=i[15],re=e[0],Y=e[1],ae=e[2],le=e[3],ge=e[4],ze=e[5],Oe=e[6],ke=e[7],Me=e[8],Se=e[9],Re=e[10],Ae=e[11],xe=e[12],Ze=e[13],$e=e[14],mt=e[15];return Math.abs(r-re)<=rr*Math.max(1,Math.abs(r),Math.abs(re))&&Math.abs(a-Y)<=rr*Math.max(1,Math.abs(a),Math.abs(Y))&&Math.abs(o-ae)<=rr*Math.max(1,Math.abs(o),Math.abs(ae))&&Math.abs(u-le)<=rr*Math.max(1,Math.abs(u),Math.abs(le))&&Math.abs(m-ge)<=rr*Math.max(1,Math.abs(m),Math.abs(ge))&&Math.abs(f-ze)<=rr*Math.max(1,Math.abs(f),Math.abs(ze))&&Math.abs(v-Oe)<=rr*Math.max(1,Math.abs(v),Math.abs(Oe))&&Math.abs(w-ke)<=rr*Math.max(1,Math.abs(w),Math.abs(ke))&&Math.abs(T-Me)<=rr*Math.max(1,Math.abs(T),Math.abs(Me))&&Math.abs(E-Se)<=rr*Math.max(1,Math.abs(E),Math.abs(Se))&&Math.abs(M-Re)<=rr*Math.max(1,Math.abs(M),Math.abs(Re))&&Math.abs(z-Ae)<=rr*Math.max(1,Math.abs(z),Math.abs(Ae))&&Math.abs(R-xe)<=rr*Math.max(1,Math.abs(R),Math.abs(xe))&&Math.abs(O-Ze)<=rr*Math.max(1,Math.abs(O),Math.abs(Ze))&&Math.abs(Z-$e)<=rr*Math.max(1,Math.abs(Z),Math.abs($e))&&Math.abs(K-mt)<=rr*Math.max(1,Math.abs(K),Math.abs(mt))},l.b2=function(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},l.b3=function(i,e,r){return i[0]=e[0]*r[0],i[1]=e[1]*r[1],i[2]=e[2]*r[2],i[3]=e[3]*r[3],i},l.b4=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},l.b5=rt,l.b6=Cm,l.b7=Tm,l.b8=function(i,e,r,a,o){var u,m=1/Math.tan(e/2);return i[0]=m/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=m,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,o!=null&&o!==1/0?(i[10]=(o+a)*(u=1/(a-o)),i[14]=2*o*a*u):(i[10]=-1,i[14]=-2*a),i},l.b9=function(i,e,r){var a=Math.sin(r),o=Math.cos(r),u=e[4],m=e[5],f=e[6],v=e[7],w=e[8],T=e[9],E=e[10],M=e[11];return e!==i&&(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[4]=u*o+w*a,i[5]=m*o+T*a,i[6]=f*o+E*a,i[7]=v*o+M*a,i[8]=w*o-u*a,i[9]=T*o-m*a,i[10]=E*o-f*a,i[11]=M*o-v*a,i},l.bA=be,l.bB=Qd,l.bC=As,l.bD=pr,l.ba=Ue,l.bb=gt,l.bc=function(i,e){return i[0]=e[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=e[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=e[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},l.bd=class extends Ya{},l.be=uu,l.bf=Im,l.bg=V0,l.bi=bn,l.bj=function(i,e,r=!1){if(tr===Po||tr===Mo||tr===ko)throw new Error("setRTLTextPlugin cannot be called multiple times.");kn=rn.resolveURL(i),tr=Po,Lo=e,zo(),r||sc()},l.bk=Do,l.bl=function(i,e){const r={};for(let o=0;o<i.length;o++){const u=e&&e[i[o].id]||Ms(i[o]);e&&(e[i[o].id]=u);let m=r[u];m||(m=r[u]=[]),m.push(i[o])}const a=[];for(const o in r)a.push(r[o]);return a},l.bm=De,l.bn=Pm,l.bo=km,l.bp=lm,l.bq=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=_i/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const e=i.bucket.layers[0],r=e.layout,a=e._unevaluatedLayout._values,o={layoutIconSize:a["icon-size"].possiblyEvaluate(new Xt(i.bucket.zoom+1),i.canonical),layoutTextSize:a["text-size"].possiblyEvaluate(new Xt(i.bucket.zoom+1),i.canonical),textMaxSize:a["text-size"].possiblyEvaluate(new Xt(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:w,maxZoom:T}=i.bucket.textSizeData;o.compositeTextSizes=[a["text-size"].possiblyEvaluate(new Xt(w),i.canonical),a["text-size"].possiblyEvaluate(new Xt(T),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:w,maxZoom:T}=i.bucket.iconSizeData;o.compositeIconSizes=[a["icon-size"].possiblyEvaluate(new Xt(w),i.canonical),a["icon-size"].possiblyEvaluate(new Xt(T),i.canonical)]}const u=r.get("text-line-height")*wi,m=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",f=r.get("text-keep-upright"),v=r.get("text-size");for(const w of i.bucket.features){const T=r.get("text-font").evaluate(w,{},i.canonical).join(","),E=v.evaluate(w,{},i.canonical),M=o.layoutTextSize.evaluate(w,{},i.canonical),z=o.layoutIconSize.evaluate(w,{},i.canonical),R={horizontal:{},vertical:void 0},O=w.text;let Z,K=[0,0];if(O){const ae=O.toString(),le=r.get("text-letter-spacing").evaluate(w,{},i.canonical)*wi,ge=Co(ae)?le:0,ze=r.get("text-anchor").evaluate(w,{},i.canonical),Oe=jm(e,w,i.canonical);if(!Oe){const Ae=r.get("text-radial-offset").evaluate(w,{},i.canonical);K=Ae?$m(ze,[Ae*wi,mu]):r.get("text-offset").evaluate(w,{},i.canonical).map(xe=>xe*wi)}let ke=m?"center":r.get("text-justify").evaluate(w,{},i.canonical);const Me=r.get("symbol-placement"),Se=Me==="point"?r.get("text-max-width").evaluate(w,{},i.canonical)*wi:0,Re=()=>{i.bucket.allowVerticalPlacement&&Ao(ae)&&(R.vertical=Sc(O,i.glyphMap,i.glyphPositions,i.imagePositions,T,Se,u,ze,"left",ge,K,l.ai.vertical,!0,Me,M,E))};if(!m&&Oe){const Ae=new Set;if(ke==="auto")for(let Ze=0;Ze<Oe.values.length;Ze+=2)Ae.add(fu(Oe.values[Ze]));else Ae.add(ke);let xe=!1;for(const Ze of Ae)if(!R.horizontal[Ze])if(xe)R.horizontal[Ze]=R.horizontal[0];else{const $e=Sc(O,i.glyphMap,i.glyphPositions,i.imagePositions,T,Se,u,"center",Ze,ge,K,l.ai.horizontal,!1,Me,M,E);$e&&(R.horizontal[Ze]=$e,xe=$e.positionedLines.length===1)}Re()}else{ke==="auto"&&(ke=fu(ze));const Ae=Sc(O,i.glyphMap,i.glyphPositions,i.imagePositions,T,Se,u,ze,ke,ge,K,l.ai.horizontal,!1,Me,M,E);Ae&&(R.horizontal[ke]=Ae),Re(),Ao(ae)&&m&&f&&(R.vertical=Sc(O,i.glyphMap,i.glyphPositions,i.imagePositions,T,Se,u,ze,ke,ge,K,l.ai.vertical,!1,Me,M,E))}}let re=!1;if(w.icon&&w.icon.name){const ae=i.imageMap[w.icon.name];ae&&(Z=w0(i.imagePositions[w.icon.name],r.get("icon-offset").evaluate(w,{},i.canonical),r.get("icon-anchor").evaluate(w,{},i.canonical)),re=!!ae.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=re:i.bucket.sdfIcons!==re&&st("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(ae.pixelRatio!==i.bucket.pixelRatio||r.get("icon-rotate").constantOr(1)!==0)&&(i.bucket.iconsNeedLinear=!0))}const Y=qm(R.horizontal)||R.vertical;i.bucket.iconsInText=!!Y&&Y.iconsInText,(Y||Z)&&N0(i.bucket,w,R,Z,i.imageMap,o,M,z,K,re,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},l.br=Qh,l.bs=Xh,l.bt=Jh,l.bu=class{constructor(i){this._marks={start:[i.url,"start"].join("#"),end:[i.url,"end"].join("#"),measure:i.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let i=performance.getEntriesByName(this._marks.measure);return i.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),i=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),i}},l.bv=tu,l.bw=wa,l.bx=function(i,e,r,a,o){return oe(this,void 0,void 0,function*(){if(Ct())try{return yield gi(i,e,r,a,o)}catch{}return function(u,m,f,v,w){const T=u.width,E=u.height;Fi&&Bt||(Fi=new OffscreenCanvas(T,E),Bt=Fi.getContext("2d",{willReadFrequently:!0})),Fi.width=T,Fi.height=E,Bt.drawImage(u,0,0,T,E);const M=Bt.getImageData(m,f,v,w);return Bt.clearRect(0,0,T,E),M.data}(i,e,r,a,o)})},l.by=Em,l.bz=q,l.c=na,l.d=function(i,e){const r=new Image;r.onload=()=>{e(null,r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame(()=>{r.src=vr})},r.onerror=()=>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."));const a=new Blob([new Uint8Array(i)],{type:"image/png"});r.src=i.byteLength?URL.createObjectURL(a):vr},l.e=Ve,l.f=function(i,e){return wn(Ve(i,{type:"json"}),e)},l.g=xr,l.h=rn,l.i=Vt,l.j=Tn,l.k=Sn,l.l=Ra,l.m=wn,l.n=function(i){return new tu(i).readFields(g0,[])},l.o=function(i,e,r){if(!i.length)return r(null,[]);let a=i.length;const o=new Array(i.length);let u=null;i.forEach((m,f)=>{e(m,(v,w)=>{v&&(u=v),o[f]=w,--a==0&&r(u,o)})})},l.p=om,l.q=Ho,l.r=di,l.s=nn,l.t=kh,l.u=Le,l.v=ue,l.w=st,l.x=zs,l.y=un,l.z=function([i,e,r]){return e+=90,e*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(e)*Math.sin(r),y:i*Math.sin(e)*Math.sin(r),z:i*Math.cos(r)}}}),V(["./shared"],function(l){class oe{constructor(P){this.keyCache={},P&&this.replace(P)}replace(P){this._layerConfigs={},this._layers={},this.update(P,[])}update(P,k){for(const G of P){this._layerConfigs[G.id]=G;const H=this._layers[G.id]=l.aC(G);H._featureFilter=l.a6(H.filter),this.keyCache[G.id]&&delete this.keyCache[G.id]}for(const G of k)delete this.keyCache[G],delete this._layerConfigs[G],delete this._layers[G];this.familiesBySource={};const B=l.bl(Object.values(this._layerConfigs),this.keyCache);for(const G of B){const H=G.map(me=>this._layers[me.id]),ne=H[0];if(ne.visibility==="none")continue;const J=ne.source||"";let X=this.familiesBySource[J];X||(X=this.familiesBySource[J]={});const ie=ne.sourceLayer||"_geojsonTileLayer";let pe=X[ie];pe||(pe=X[ie]=[]),pe.push(H)}}}class q{constructor(P){const k={},B=[];for(const J in P){const X=P[J],ie=k[J]={};for(const pe in X){const me=X[+pe];if(!me||me.bitmap.width===0||me.bitmap.height===0)continue;const ye={x:0,y:0,w:me.bitmap.width+2,h:me.bitmap.height+2};B.push(ye),ie[pe]={rect:ye,metrics:me.metrics}}}const{w:G,h:H}=l.p(B),ne=new l.q({width:G||1,height:H||1});for(const J in P){const X=P[J];for(const ie in X){const pe=X[+ie];if(!pe||pe.bitmap.width===0||pe.bitmap.height===0)continue;const me=k[J][ie].rect;l.q.copy(pe.bitmap,ne,{x:0,y:0},{x:me.x+1,y:me.y+1},pe.bitmap)}}this.image=ne,this.positions=k}}l.bm("GlyphAtlas",q);class be{constructor(P){this.tileID=new l.O(P.tileID.overscaledZ,P.tileID.wrap,P.tileID.canonical.z,P.tileID.canonical.x,P.tileID.canonical.y),this.uid=P.uid,this.zoom=P.zoom,this.pixelRatio=P.pixelRatio,this.tileSize=P.tileSize,this.source=P.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=P.showCollisionBoxes,this.collectResourceTiming=!!P.collectResourceTiming,this.returnDependencies=!!P.returnDependencies,this.promoteId=P.promoteId,this.inFlightDependencies=[],this.dependencySentinel=-1}parse(P,k,B,G,H){this.status="parsing",this.data=P,this.collisionBoxArray=new l.a3;const ne=new l.bn(Object.keys(P.layers).sort()),J=new l.bo(this.tileID,this.promoteId);J.bucketLayerIDs=[];const X={},ie={featureIndex:J,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:B},pe=k.familiesBySource[this.source];for(const Et in pe){const At=P.layers[Et];if(!At)continue;At.version===1&&l.w(`Vector tile source "${this.source}" layer "${Et}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Oi=ne.encode(Et),Ht=[];for(let yi=0;yi<At.length;yi++){const ki=At.feature(yi),wr=J.getId(ki,Et);Ht.push({feature:ki,id:wr,index:yi,sourceLayerIndex:Oi})}for(const yi of pe[Et]){const ki=yi[0];ki.source!==this.source&&l.w(`layer.source = ${ki.source} does not equal this.source = ${this.source}`),ki.minzoom&&this.zoom<Math.floor(ki.minzoom)||ki.maxzoom&&this.zoom>=ki.maxzoom||ki.visibility!=="none"&&(Te(yi,this.zoom,B),(X[ki.id]=ki.createBucket({index:J.bucketLayerIDs.length,layers:yi,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Oi,sourceID:this.source})).populate(Ht,ie,this.tileID.canonical),J.bucketLayerIDs.push(yi.map(wr=>wr.id)))}}let me,ye,qe,Je;const Be=l.aH(ie.glyphDependencies,Et=>Object.keys(Et).map(Number));this.inFlightDependencies.forEach(Et=>Et?.cancel()),this.inFlightDependencies=[];const He=++this.dependencySentinel;Object.keys(Be).length?this.inFlightDependencies.push(G.send("getGlyphs",{uid:this.uid,stacks:Be,source:this.source,tileID:this.tileID,type:"glyphs"},(Et,At)=>{He===this.dependencySentinel&&(me||(me=Et,ye=At,$t.call(this)))})):ye={};const at=Object.keys(ie.iconDependencies);at.length?this.inFlightDependencies.push(G.send("getImages",{icons:at,source:this.source,tileID:this.tileID,type:"icons"},(Et,At)=>{He===this.dependencySentinel&&(me||(me=Et,qe=At,$t.call(this)))})):qe={};const Ft=Object.keys(ie.patternDependencies);function $t(){if(me)return H(me);if(ye&&qe&&Je){const Et=new q(ye),At=new l.bp(qe,Je);for(const Oi in X){const Ht=X[Oi];Ht instanceof l.a4?(Te(Ht.layers,this.zoom,B),l.bq({bucket:Ht,glyphMap:ye,glyphPositions:Et.positions,imageMap:qe,imagePositions:At.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Ht.hasPattern&&(Ht instanceof l.br||Ht instanceof l.bs||Ht instanceof l.bt)&&(Te(Ht.layers,this.zoom,B),Ht.addFeatures(ie,this.tileID.canonical,At.patternPositions))}this.status="done",H(null,{buckets:Object.values(X).filter(Oi=>!Oi.isEmpty()),featureIndex:J,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Et.image,imageAtlas:At,glyphMap:this.returnDependencies?ye:null,iconMap:this.returnDependencies?qe:null,glyphPositions:this.returnDependencies?Et.positions:null})}}Ft.length?this.inFlightDependencies.push(G.send("getImages",{icons:Ft,source:this.source,tileID:this.tileID,type:"patterns"},(Et,At)=>{He===this.dependencySentinel&&(me||(me=Et,Je=At,$t.call(this)))})):Je={},$t.call(this)}}function Te($,P,k){const B=new l.a8(P);for(const G of $)G.recalculate(B,k)}function de($,P){const k=l.l($.request,(B,G,H,ne)=>{if(B)P(B);else if(G)try{const J=new l.bw.VectorTile(new l.bv(G));P(null,{vectorTile:J,rawData:G,cacheControl:H,expires:ne})}catch(J){const X=new Uint8Array(G);let ie=`Unable to parse the tile at ${$.request.url}, `;ie+=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: ${J.messge}`,P(new Error(ie))}});return()=>{k.cancel(),P()}}class et{constructor(P,k,B,G){this.actor=P,this.layerIndex=k,this.availableImages=B,this.loadVectorData=G||de,this.fetching={},this.loading={},this.loaded={}}loadTile(P,k){const B=P.uid;this.loading||(this.loading={});const G=!!(P&&P.request&&P.request.collectResourceTiming)&&new l.bu(P.request),H=this.loading[B]=new be(P);H.abort=this.loadVectorData(P,(ne,J)=>{if(delete this.loading[B],ne||!J)return H.status="done",this.loaded[B]=H,k(ne);const X=J.rawData,ie={};J.expires&&(ie.expires=J.expires),J.cacheControl&&(ie.cacheControl=J.cacheControl);const pe={};if(G){const me=G.finish();me&&(pe.resourceTiming=JSON.parse(JSON.stringify(me)))}H.vectorTile=J.vectorTile,H.parse(J.vectorTile,this.layerIndex,this.availableImages,this.actor,(me,ye)=>{if(delete this.fetching[B],me||!ye)return k(me);k(null,l.e({rawTileData:X.slice(0)},ye,ie,pe))}),this.loaded=this.loaded||{},this.loaded[B]=H,this.fetching[B]={rawTileData:X,cacheControl:ie,resourceTiming:pe}})}reloadTile(P,k){const B=this.loaded,G=P.uid;if(B&&B[G]){const H=B[G];H.showCollisionBoxes=P.showCollisionBoxes,H.status==="parsing"?H.parse(H.vectorTile,this.layerIndex,this.availableImages,this.actor,(ne,J)=>{if(ne||!J)return k(ne,J);let X;if(this.fetching[G]){const{rawTileData:ie,cacheControl:pe,resourceTiming:me}=this.fetching[G];delete this.fetching[G],X=l.e({rawTileData:ie.slice(0)},J,pe,me)}else X=J;k(null,X)}):H.status==="done"&&(H.vectorTile?H.parse(H.vectorTile,this.layerIndex,this.availableImages,this.actor,k):k())}}abortTile(P,k){const B=this.loading,G=P.uid;B&&B[G]&&B[G].abort&&(B[G].abort(),delete B[G]),k()}removeTile(P,k){const B=this.loaded,G=P.uid;B&&B[G]&&delete B[G],k()}}class lt{constructor(){this.loaded={}}loadTile(P,k){return l._(this,void 0,void 0,function*(){const{uid:B,encoding:G,rawImageData:H,redFactor:ne,greenFactor:J,blueFactor:X,baseShift:ie}=P,pe=H.width+2,me=H.height+2,ye=l.a(H)?new l.R({width:pe,height:me},yield l.bx(H,-1,-1,pe,me)):H,qe=new l.by(B,ye,G,ne,J,X,ie);this.loaded=this.loaded||{},this.loaded[B]=qe,k(null,qe)})}removeTile(P){const k=this.loaded,B=P.uid;k&&k[B]&&delete k[B]}}function Xe($,P){if($.length!==0){ft($[0],P);for(var k=1;k<$.length;k++)ft($[k],!P)}}function ft($,P){for(var k=0,B=0,G=0,H=$.length,ne=H-1;G<H;ne=G++){var J=($[G][0]-$[ne][0])*($[ne][1]+$[G][1]),X=k+J;B+=Math.abs(k)>=Math.abs(J)?k-X+J:J-X+k,k=X}k+B>=0!=!!P&&$.reverse()}var tt=l.bz(function $(P,k){var B,G=P&&P.type;if(G==="FeatureCollection")for(B=0;B<P.features.length;B++)$(P.features[B],k);else if(G==="GeometryCollection")for(B=0;B<P.geometries.length;B++)$(P.geometries[B],k);else if(G==="Feature")$(P.geometry,k);else if(G==="Polygon")Xe(P.coordinates,k);else if(G==="MultiPolygon")for(B=0;B<P.coordinates.length;B++)Xe(P.coordinates[B],k);return P});const St=l.bw.VectorTileFeature.prototype.toGeoJSON;var Ct={exports:{}},Ue=l.bA,gt=l.bw.VectorTileFeature,Qe=rt;function rt($,P){this.options=P||{},this.features=$,this.length=$.length}function Ve($,P){this.id=typeof $.id=="number"?$.id:void 0,this.type=$.type,this.rawGeometry=$.type===1?[$.geometry]:$.geometry,this.properties=$.tags,this.extent=P||4096}rt.prototype.feature=function($){return new Ve(this.features[$],this.options.extent)},Ve.prototype.loadGeometry=function(){var $=this.rawGeometry;this.geometry=[];for(var P=0;P<$.length;P++){for(var k=$[P],B=[],G=0;G<k.length;G++)B.push(new Ue(k[G][0],k[G][1]));this.geometry.push(B)}return this.geometry},Ve.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var $=this.geometry,P=1/0,k=-1/0,B=1/0,G=-1/0,H=0;H<$.length;H++)for(var ne=$[H],J=0;J<ne.length;J++){var X=ne[J];P=Math.min(P,X.x),k=Math.max(k,X.x),B=Math.min(B,X.y),G=Math.max(G,X.y)}return[P,B,k,G]},Ve.prototype.toGeoJSON=gt.prototype.toGeoJSON;var pt=l.bB,Ge=Qe;function Rt($){var P=new pt;return function(k,B){for(var G in k.layers)B.writeMessage(3,it,k.layers[G])}($,P),P.finish()}function it($,P){var k;P.writeVarintField(15,$.version||1),P.writeStringField(1,$.name||""),P.writeVarintField(5,$.extent||4096);var B={keys:[],values:[],keycache:{},valuecache:{}};for(k=0;k<$.length;k++)B.feature=$.feature(k),P.writeMessage(2,ct,B);var G=B.keys;for(k=0;k<G.length;k++)P.writeStringField(3,G[k]);var H=B.values;for(k=0;k<H.length;k++)P.writeMessage(4,ai,H[k])}function ct($,P){var k=$.feature;k.id!==void 0&&P.writeVarintField(1,k.id),P.writeMessage(2,st,$),P.writeVarintField(3,k.type),P.writeMessage(4,Vt,k)}function st($,P){var k=$.feature,B=$.keys,G=$.values,H=$.keycache,ne=$.valuecache;for(var J in k.properties){var X=k.properties[J],ie=H[J];if(X!==null){ie===void 0&&(B.push(J),H[J]=ie=B.length-1),P.writeVarint(ie);var pe=typeof X;pe!=="string"&&pe!=="boolean"&&pe!=="number"&&(X=JSON.stringify(X));var me=pe+":"+X,ye=ne[me];ye===void 0&&(G.push(X),ne[me]=ye=G.length-1),P.writeVarint(ye)}}}function yt($,P){return(P<<3)+(7&$)}function Ot($){return $<<1^$>>31}function Vt($,P){for(var k=$.loadGeometry(),B=$.type,G=0,H=0,ne=k.length,J=0;J<ne;J++){var X=k[J],ie=1;B===1&&(ie=X.length),P.writeVarint(yt(1,ie));for(var pe=B===3?X.length-1:X.length,me=0;me<pe;me++){me===1&&B!==1&&P.writeVarint(yt(2,pe-1));var ye=X[me].x-G,qe=X[me].y-H;P.writeVarint(Ot(ye)),P.writeVarint(Ot(qe)),G+=ye,H+=qe}B===3&&P.writeVarint(yt(7,1))}}function ai($,P){var k=typeof $;k==="string"?P.writeStringField(1,$):k==="boolean"?P.writeBooleanField(7,$):k==="number"&&($%1!=0?P.writeDoubleField(3,$):$<0?P.writeSVarintField(6,$):P.writeVarintField(5,$))}Ct.exports=Rt,Ct.exports.fromVectorTileJs=Rt,Ct.exports.fromGeojsonVt=function($,P){P=P||{};var k={};for(var B in $)k[B]=new Ge($[B].features,P),k[B].name=B,k[B].version=P.version,k[B].extent=P.extent;return Rt({layers:k})},Ct.exports.GeoJSONWrapper=Ge;var Mi=l.bz(Ct.exports);const vr={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:$=>$},gi=Math.fround||(Fi=new Float32Array(1),$=>(Fi[0]=+$,Fi[0]));var Fi;const Bt=3,Ei=5,jr=6;class rn{constructor(P){this.options=Object.assign(Object.create(vr),P),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(P){const{log:k,minZoom:B,maxZoom:G}=this.options;k&&console.time("total time");const H=`prepare ${P.length} points`;k&&console.time(H),this.points=P;const ne=[];for(let X=0;X<P.length;X++){const ie=P[X];if(!ie.geometry)continue;const[pe,me]=ie.geometry.coordinates,ye=gi(Dr(pe)),qe=gi(xr(me));ne.push(ye,qe,1/0,X,-1,1),this.options.reduce&&ne.push(0)}let J=this.trees[G+1]=this._createTree(ne);k&&console.timeEnd(H);for(let X=G;X>=B;X--){const ie=+Date.now();J=this.trees[X]=this._createTree(this._cluster(J,X)),k&&console.log("z%d: %d clusters in %dms",X,J.numItems,+Date.now()-ie)}return k&&console.timeEnd("total time"),this}getClusters(P,k){let B=((P[0]+180)%360+360)%360-180;const G=Math.max(-90,Math.min(90,P[1]));let H=P[2]===180?180:((P[2]+180)%360+360)%360-180;const ne=Math.max(-90,Math.min(90,P[3]));if(P[2]-P[0]>=360)B=-180,H=180;else if(B>H){const me=this.getClusters([B,G,180,ne],k),ye=this.getClusters([-180,G,H,ne],k);return me.concat(ye)}const J=this.trees[this._limitZoom(k)],X=J.range(Dr(B),xr(ne),Dr(H),xr(G)),ie=J.data,pe=[];for(const me of X){const ye=this.stride*me;pe.push(ie[ye+Ei]>1?na(ie,ye,this.clusterProps):this.points[ie[ye+Bt]])}return pe}getChildren(P){const k=this._getOriginId(P),B=this._getOriginZoom(P),G="No cluster with the specified id.",H=this.trees[B];if(!H)throw new Error(G);const ne=H.data;if(k*this.stride>=ne.length)throw new Error(G);const J=this.options.radius/(this.options.extent*Math.pow(2,B-1)),X=H.within(ne[k*this.stride],ne[k*this.stride+1],J),ie=[];for(const pe of X){const me=pe*this.stride;ne[me+4]===P&&ie.push(ne[me+Ei]>1?na(ne,me,this.clusterProps):this.points[ne[me+Bt]])}if(ie.length===0)throw new Error(G);return ie}getLeaves(P,k,B){const G=[];return this._appendLeaves(G,P,k=k||10,B=B||0,0),G}getTile(P,k,B){const G=this.trees[this._limitZoom(P)],H=Math.pow(2,P),{extent:ne,radius:J}=this.options,X=J/ne,ie=(B-X)/H,pe=(B+1+X)/H,me={features:[]};return this._addTileFeatures(G.range((k-X)/H,ie,(k+1+X)/H,pe),G.data,k,B,H,me),k===0&&this._addTileFeatures(G.range(1-X/H,ie,1,pe),G.data,H,B,H,me),k===H-1&&this._addTileFeatures(G.range(0,ie,X/H,pe),G.data,-1,B,H,me),me.features.length?me:null}getClusterExpansionZoom(P){let k=this._getOriginZoom(P)-1;for(;k<=this.options.maxZoom;){const B=this.getChildren(P);if(k++,B.length!==1)break;P=B[0].properties.cluster_id}return k}_appendLeaves(P,k,B,G,H){const ne=this.getChildren(k);for(const J of ne){const X=J.properties;if(X&&X.cluster?H+X.point_count<=G?H+=X.point_count:H=this._appendLeaves(P,X.cluster_id,B,G,H):H<G?H++:P.push(J),P.length===B)break}return H}_createTree(P){const k=new l.av(P.length/this.stride|0,this.options.nodeSize,Float32Array);for(let B=0;B<P.length;B+=this.stride)k.add(P[B],P[B+1]);return k.finish(),k.data=P,k}_addTileFeatures(P,k,B,G,H,ne){for(const J of P){const X=J*this.stride,ie=k[X+Ei]>1;let pe,me,ye;if(ie)pe=bn(k,X,this.clusterProps),me=k[X],ye=k[X+1];else{const Be=this.points[k[X+Bt]];pe=Be.properties;const[He,at]=Be.geometry.coordinates;me=Dr(He),ye=xr(at)}const qe={type:1,geometry:[[Math.round(this.options.extent*(me*H-B)),Math.round(this.options.extent*(ye*H-G))]],tags:pe};let Je;Je=ie||this.options.generateId?k[X+Bt]:this.points[k[X+Bt]].id,Je!==void 0&&(qe.id=Je),ne.features.push(qe)}}_limitZoom(P){return Math.max(this.options.minZoom,Math.min(Math.floor(+P),this.options.maxZoom+1))}_cluster(P,k){const{radius:B,extent:G,reduce:H,minPoints:ne}=this.options,J=B/(G*Math.pow(2,k)),X=P.data,ie=[],pe=this.stride;for(let me=0;me<X.length;me+=pe){if(X[me+2]<=k)continue;X[me+2]=k;const ye=X[me],qe=X[me+1],Je=P.within(X[me],X[me+1],J),Be=X[me+Ei];let He=Be;for(const at of Je){const Ft=at*pe;X[Ft+2]>k&&(He+=X[Ft+Ei])}if(He>Be&&He>=ne){let at,Ft=ye*Be,$t=qe*Be,Et=-1;const At=((me/pe|0)<<5)+(k+1)+this.points.length;for(const Oi of Je){const Ht=Oi*pe;if(X[Ht+2]<=k)continue;X[Ht+2]=k;const yi=X[Ht+Ei];Ft+=X[Ht]*yi,$t+=X[Ht+1]*yi,X[Ht+4]=At,H&&(at||(at=this._map(X,me,!0),Et=this.clusterProps.length,this.clusterProps.push(at)),H(at,this._map(X,Ht)))}X[me+4]=At,ie.push(Ft/He,$t/He,1/0,At,-1,He),H&&ie.push(Et)}else{for(let at=0;at<pe;at++)ie.push(X[me+at]);if(He>1)for(const at of Je){const Ft=at*pe;if(!(X[Ft+2]<=k)){X[Ft+2]=k;for(let $t=0;$t<pe;$t++)ie.push(X[Ft+$t])}}}}return ie}_getOriginId(P){return P-this.points.length>>5}_getOriginZoom(P){return(P-this.points.length)%32}_map(P,k,B){if(P[k+Ei]>1){const ne=this.clusterProps[P[k+jr]];return B?Object.assign({},ne):ne}const G=this.points[P[k+Bt]].properties,H=this.options.map(G);return B&&H===G?Object.assign({},H):H}}function na($,P,k){return{type:"Feature",id:$[P+Bt],properties:bn($,P,k),geometry:{type:"Point",coordinates:[(B=$[P],360*(B-.5)),Da($[P+1])]}};var B}function bn($,P,k){const B=$[P+Ei],G=B>=1e4?`${Math.round(B/1e3)}k`:B>=1e3?Math.round(B/100)/10+"k":B,H=$[P+jr],ne=H===-1?{}:Object.assign({},k[H]);return Object.assign(ne,{cluster:!0,cluster_id:$[P+Bt],point_count:B,point_count_abbreviated:G})}function Dr($){return $/360+.5}function xr($){const P=Math.sin($*Math.PI/180),k=.5-.25*Math.log((1+P)/(1-P))/Math.PI;return k<0?0:k>1?1:k}function Da($){const P=(180-360*$)*Math.PI/180;return 360*Math.atan(Math.exp(P))/Math.PI-90}function wn($,P,k,B){for(var G,H=B,ne=k-P>>1,J=k-P,X=$[P],ie=$[P+1],pe=$[k],me=$[k+1],ye=P+3;ye<k;ye+=3){var qe=Ra($[ye],$[ye+1],X,ie,pe,me);if(qe>H)G=ye,H=qe;else if(qe===H){var Je=Math.abs(ye-ne);Je<J&&(G=ye,J=Je)}}H>B&&(G-P>3&&wn($,P,G,B),$[G+2]=H,k-G>3&&wn($,G,k,B))}function Ra($,P,k,B,G,H){var ne=G-k,J=H-B;if(ne!==0||J!==0){var X=(($-k)*ne+(P-B)*J)/(ne*ne+J*J);X>1?(k=G,B=H):X>0&&(k+=ne*X,B+=J*X)}return(ne=$-k)*ne+(J=P-B)*J}function nn($,P,k,B){var G={id:$===void 0?null:$,type:P,geometry:k,tags:B,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(H){var ne=H.geometry,J=H.type;if(J==="Point"||J==="MultiPoint"||J==="LineString")aa(H,ne);else if(J==="Polygon"||J==="MultiLineString")for(var X=0;X<ne.length;X++)aa(H,ne[X]);else if(J==="MultiPolygon")for(X=0;X<ne.length;X++)for(var ie=0;ie<ne[X].length;ie++)aa(H,ne[X][ie])}(G),G}function aa($,P){for(var k=0;k<P.length;k+=3)$.minX=Math.min($.minX,P[k]),$.minY=Math.min($.minY,P[k+1]),$.maxX=Math.max($.maxX,P[k]),$.maxY=Math.max($.maxY,P[k+1])}function Fn($,P,k,B){if(P.geometry){var G=P.geometry.coordinates,H=P.geometry.type,ne=Math.pow(k.tolerance/((1<<k.maxZoom)*k.extent),2),J=[],X=P.id;if(k.promoteId?X=P.properties[k.promoteId]:k.generateId&&(X=B||0),H==="Point")Sn(G,J);else if(H==="MultiPoint")for(var ie=0;ie<G.length;ie++)Sn(G[ie],J);else if(H==="LineString")Tn(G,J,ne,!1);else if(H==="MultiLineString"){if(k.lineMetrics){for(ie=0;ie<G.length;ie++)Tn(G[ie],J=[],ne,!1),$.push(nn(X,"LineString",J,P.properties));return}On(G,J,ne,!1)}else if(H==="Polygon")On(G,J,ne,!0);else{if(H!=="MultiPolygon"){if(H==="GeometryCollection"){for(ie=0;ie<P.geometry.geometries.length;ie++)Fn($,{id:X,geometry:P.geometry.geometries[ie],properties:P.properties},k,B);return}throw new Error("Input data is not a valid GeoJSON object.")}for(ie=0;ie<G.length;ie++){var pe=[];On(G[ie],pe,ne,!0),J.push(pe)}}$.push(nn(X,H,J,P.properties))}}function Sn($,P){P.push(ue($[0])),P.push(Qi($[1])),P.push(0)}function Tn($,P,k,B){for(var G,H,ne=0,J=0;J<$.length;J++){var X=ue($[J][0]),ie=Qi($[J][1]);P.push(X),P.push(ie),P.push(0),J>0&&(ne+=B?(G*ie-X*H)/2:Math.sqrt(Math.pow(X-G,2)+Math.pow(ie-H,2))),G=X,H=ie}var pe=P.length-3;P[2]=1,wn(P,0,pe,k),P[pe+2]=1,P.size=Math.abs(ne),P.start=0,P.end=P.size}function On($,P,k,B){for(var G=0;G<$.length;G++){var H=[];Tn($[G],H,k,B),P.push(H)}}function ue($){return $/360+.5}function Qi($){var P=Math.sin($*Math.PI/180),k=.5-.25*Math.log((1+P)/(1-P))/Math.PI;return k<0?0:k>1?1:k}function br($,P,k,B,G,H,ne,J){if(B/=P,H>=(k/=P)&&ne<B)return $;if(ne<k||H>=B)return null;for(var X=[],ie=0;ie<$.length;ie++){var pe=$[ie],me=pe.geometry,ye=pe.type,qe=G===0?pe.minX:pe.minY,Je=G===0?pe.maxX:pe.maxY;if(qe>=k&&Je<B)X.push(pe);else if(!(Je<k||qe>=B)){var Be=[];if(ye==="Point"||ye==="MultiPoint")Zt(me,Be,k,B,G);else if(ye==="LineString")Pt(me,Be,k,B,G,!1,J.lineMetrics);else if(ye==="MultiLineString")sa(me,Be,k,B,G,!1);else if(ye==="Polygon")sa(me,Be,k,B,G,!0);else if(ye==="MultiPolygon")for(var He=0;He<me.length;He++){var at=[];sa(me[He],at,k,B,G,!0),at.length&&Be.push(at)}if(Be.length){if(J.lineMetrics&&ye==="LineString"){for(He=0;He<Be.length;He++)X.push(nn(pe.id,ye,Be[He],pe.tags));continue}ye!=="LineString"&&ye!=="MultiLineString"||(Be.length===1?(ye="LineString",Be=Be[0]):ye="MultiLineString"),ye!=="Point"&&ye!=="MultiPoint"||(ye=Be.length===3?"Point":"MultiPoint"),X.push(nn(pe.id,ye,Be,pe.tags))}}}return X.length?X:null}function Zt($,P,k,B,G){for(var H=0;H<$.length;H+=3){var ne=$[H+G];ne>=k&&ne<=B&&(P.push($[H]),P.push($[H+1]),P.push($[H+2]))}}function Pt($,P,k,B,G,H,ne){for(var J,X,ie=Gr($),pe=G===0?ls:oa,me=$.start,ye=0;ye<$.length-3;ye+=3){var qe=$[ye],Je=$[ye+1],Be=$[ye+2],He=$[ye+3],at=$[ye+4],Ft=G===0?qe:Je,$t=G===0?He:at,Et=!1;ne&&(J=Math.sqrt(Math.pow(qe-He,2)+Math.pow(Je-at,2))),Ft<k?$t>k&&(X=pe(ie,qe,Je,He,at,k),ne&&(ie.start=me+J*X)):Ft>B?$t<B&&(X=pe(ie,qe,Je,He,at,B),ne&&(ie.start=me+J*X)):an(ie,qe,Je,Be),$t<k&&Ft>=k&&(X=pe(ie,qe,Je,He,at,k),Et=!0),$t>B&&Ft<=B&&(X=pe(ie,qe,Je,He,at,B),Et=!0),!H&&Et&&(ne&&(ie.end=me+J*X),P.push(ie),ie=Gr($)),ne&&(me+=J)}var At=$.length-3;qe=$[At],Je=$[At+1],Be=$[At+2],(Ft=G===0?qe:Je)>=k&&Ft<=B&&an(ie,qe,Je,Be),At=ie.length-3,H&&At>=3&&(ie[At]!==ie[0]||ie[At+1]!==ie[1])&&an(ie,ie[0],ie[1],ie[2]),ie.length&&P.push(ie)}function Gr($){var P=[];return P.size=$.size,P.start=$.start,P.end=$.end,P}function sa($,P,k,B,G,H){for(var ne=0;ne<$.length;ne++)Pt($[ne],P,k,B,G,H,!1)}function an($,P,k,B){$.push(P),$.push(k),$.push(B)}function ls($,P,k,B,G,H){var ne=(H-P)/(B-P);return $.push(H),$.push(k+(G-k)*ne),$.push(1),ne}function oa($,P,k,B,G,H){var ne=(H-k)/(G-k);return $.push(P+(B-P)*ne),$.push(H),$.push(1),ne}function In($,P){for(var k=[],B=0;B<$.length;B++){var G,H=$[B],ne=H.type;if(ne==="Point"||ne==="MultiPoint"||ne==="LineString")G=Nn(H.geometry,P);else if(ne==="MultiLineString"||ne==="Polygon"){G=[];for(var J=0;J<H.geometry.length;J++)G.push(Nn(H.geometry[J],P))}else if(ne==="MultiPolygon")for(G=[],J=0;J<H.geometry.length;J++){for(var X=[],ie=0;ie<H.geometry[J].length;ie++)X.push(Nn(H.geometry[J][ie],P));G.push(X)}k.push(nn(H.id,ne,G,H.tags))}return k}function Nn($,P){var k=[];k.size=$.size,$.start!==void 0&&(k.start=$.start,k.end=$.end);for(var B=0;B<$.length;B+=3)k.push($[B]+P,$[B+1],$[B+2]);return k}function Ie($,P){if($.transformed)return $;var k,B,G,H=1<<$.z,ne=$.x,J=$.y;for(k=0;k<$.features.length;k++){var X=$.features[k],ie=X.geometry,pe=X.type;if(X.geometry=[],pe===1)for(B=0;B<ie.length;B+=2)X.geometry.push(qr(ie[B],ie[B+1],P,H,ne,J));else for(B=0;B<ie.length;B++){var me=[];for(G=0;G<ie[B].length;G+=2)me.push(qr(ie[B][G],ie[B][G+1],P,H,ne,J));X.geometry.push(me)}}return $.transformed=!0,$}function qr($,P,k,B,G,H){return[Math.round(k*($*B-G)),Math.round(k*(P*B-H))]}function si($,P,k,B,G){for(var H=P===G.maxZoom?0:G.tolerance/((1<<P)*G.extent),ne={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:k,y:B,z:P,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},J=0;J<$.length;J++){ne.numFeatures++,Un(ne,$[J],H,G);var X=$[J].minX,ie=$[J].minY,pe=$[J].maxX,me=$[J].maxY;X<ne.minX&&(ne.minX=X),ie<ne.minY&&(ne.minY=ie),pe>ne.maxX&&(ne.maxX=pe),me>ne.maxY&&(ne.maxY=me)}return ne}function Un($,P,k,B){var G=P.geometry,H=P.type,ne=[];if(H==="Point"||H==="MultiPoint")for(var J=0;J<G.length;J+=3)ne.push(G[J]),ne.push(G[J+1]),$.numPoints++,$.numSimplified++;else if(H==="LineString")sn(ne,G,$,k,!1,!1);else if(H==="MultiLineString"||H==="Polygon")for(J=0;J<G.length;J++)sn(ne,G[J],$,k,H==="Polygon",J===0);else if(H==="MultiPolygon")for(var X=0;X<G.length;X++){var ie=G[X];for(J=0;J<ie.length;J++)sn(ne,ie[J],$,k,!0,J===0)}if(ne.length){var pe=P.tags||null;if(H==="LineString"&&B.lineMetrics){for(var me in pe={},P.tags)pe[me]=P.tags[me];pe.mapbox_clip_start=G.start/G.size,pe.mapbox_clip_end=G.end/G.size}var ye={geometry:ne,type:H==="Polygon"||H==="MultiPolygon"?3:H==="LineString"||H==="MultiLineString"?2:1,tags:pe};P.id!==null&&(ye.id=P.id),$.features.push(ye)}}function sn($,P,k,B,G,H){var ne=B*B;if(B>0&&P.size<(G?ne:B))k.numPoints+=P.length/3;else{for(var J=[],X=0;X<P.length;X+=3)(B===0||P[X+2]>ne)&&(k.numSimplified++,J.push(P[X]),J.push(P[X+1])),k.numPoints++;G&&function(ie,pe){for(var me=0,ye=0,qe=ie.length,Je=qe-2;ye<qe;Je=ye,ye+=2)me+=(ie[ye]-ie[Je])*(ie[ye+1]+ie[Je+1]);if(me>0===pe)for(ye=0,qe=ie.length;ye<qe/2;ye+=2){var Be=ie[ye],He=ie[ye+1];ie[ye]=ie[qe-2-ye],ie[ye+1]=ie[qe-1-ye],ie[qe-2-ye]=Be,ie[qe-1-ye]=He}}(J,H),$.push(J)}}function Ce($,P){var k=(P=this.options=function(G,H){for(var ne in H)G[ne]=H[ne];return G}(Object.create(this.options),P)).debug;if(k&&console.time("preprocess data"),P.maxZoom<0||P.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(P.promoteId&&P.generateId)throw new Error("promoteId and generateId cannot be used together.");var B=function(G,H){var ne=[];if(G.type==="FeatureCollection")for(var J=0;J<G.features.length;J++)Fn(ne,G.features[J],H,J);else Fn(ne,G.type==="Feature"?G:{geometry:G},H);return ne}($,P);this.tiles={},this.tileCoords=[],k&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",P.indexMaxZoom,P.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),B=function(G,H){var ne=H.buffer/H.extent,J=G,X=br(G,1,-1-ne,ne,0,-1,2,H),ie=br(G,1,1-ne,2+ne,0,-1,2,H);return(X||ie)&&(J=br(G,1,-ne,1+ne,0,-1,2,H)||[],X&&(J=In(X,1).concat(J)),ie&&(J=J.concat(In(ie,-1)))),J}(B,P),B.length&&this.splitTile(B,0,0,0),k&&(B.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function dt($,P,k){return 32*((1<<$)*k+P)+$}function nt($,P){return P?$.properties[P]:$.id}function Zi($,P){if($==null)return!0;if($.type==="Feature")return nt($,P)!=null;if($.type==="FeatureCollection"){const k=new Set;for(const B of $.features){const G=nt(B,P);if(G==null||k.has(G))return!1;k.add(G)}return!0}return!1}function Zr($,P){const k=new Map;if($!=null)if($.type==="Feature")k.set(nt($,P),$);else for(const B of $.features)k.set(nt(B,P),B);return k}Ce.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Ce.prototype.splitTile=function($,P,k,B,G,H,ne){for(var J=[$,P,k,B],X=this.options,ie=X.debug;J.length;){B=J.pop(),k=J.pop(),P=J.pop(),$=J.pop();var pe=1<<P,me=dt(P,k,B),ye=this.tiles[me];if(!ye&&(ie>1&&console.time("creation"),ye=this.tiles[me]=si($,P,k,B,X),this.tileCoords.push({z:P,x:k,y:B}),ie)){ie>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",P,k,B,ye.numFeatures,ye.numPoints,ye.numSimplified),console.timeEnd("creation"));var qe="z"+P;this.stats[qe]=(this.stats[qe]||0)+1,this.total++}if(ye.source=$,G){if(P===X.maxZoom||P===G)continue;var Je=1<<G-P;if(k!==Math.floor(H/Je)||B!==Math.floor(ne/Je))continue}else if(P===X.indexMaxZoom||ye.numPoints<=X.indexMaxPoints)continue;if(ye.source=null,$.length!==0){ie>1&&console.time("clipping");var Be,He,at,Ft,$t,Et,At=.5*X.buffer/X.extent,Oi=.5-At,Ht=.5+At,yi=1+At;Be=He=at=Ft=null,$t=br($,pe,k-At,k+Ht,0,ye.minX,ye.maxX,X),Et=br($,pe,k+Oi,k+yi,0,ye.minX,ye.maxX,X),$=null,$t&&(Be=br($t,pe,B-At,B+Ht,1,ye.minY,ye.maxY,X),He=br($t,pe,B+Oi,B+yi,1,ye.minY,ye.maxY,X),$t=null),Et&&(at=br(Et,pe,B-At,B+Ht,1,ye.minY,ye.maxY,X),Ft=br(Et,pe,B+Oi,B+yi,1,ye.minY,ye.maxY,X),Et=null),ie>1&&console.timeEnd("clipping"),J.push(Be||[],P+1,2*k,2*B),J.push(He||[],P+1,2*k,2*B+1),J.push(at||[],P+1,2*k+1,2*B),J.push(Ft||[],P+1,2*k+1,2*B+1)}}},Ce.prototype.getTile=function($,P,k){var B=this.options,G=B.extent,H=B.debug;if($<0||$>24)return null;var ne=1<<$,J=dt($,P=(P%ne+ne)%ne,k);if(this.tiles[J])return Ie(this.tiles[J],G);H>1&&console.log("drilling down to z%d-%d-%d",$,P,k);for(var X,ie=$,pe=P,me=k;!X&&ie>0;)ie--,pe=Math.floor(pe/2),me=Math.floor(me/2),X=this.tiles[dt(ie,pe,me)];return X&&X.source?(H>1&&console.log("found parent tile z%d-%d-%d",ie,pe,me),H>1&&console.time("drilling down"),this.splitTile(X.source,ie,pe,me,$,P,k),H>1&&console.timeEnd("drilling down"),this.tiles[J]?Ie(this.tiles[J],G):null):null};class ot extends et{constructor(P,k,B,G){super(P,k,B),this._dataUpdateable=new Map,this.loadGeoJSON=(H,ne)=>{const{promoteId:J}=H;if(H.request)return l.f(H.request,(X,ie,pe,me)=>{this._dataUpdateable=Zi(ie,J)?Zr(ie,J):void 0,ne(X,ie,pe,me)});if(typeof H.data=="string")try{const X=JSON.parse(H.data);this._dataUpdateable=Zi(X,J)?Zr(X,J):void 0,ne(null,X)}catch{ne(new Error(`Input data given to '${H.source}' is not a valid GeoJSON object.`))}else H.dataDiff?this._dataUpdateable?(function(X,ie,pe){var me,ye,qe,Je;if(ie.removeAll&&X.clear(),ie.remove)for(const Be of ie.remove)X.delete(Be);if(ie.add)for(const Be of ie.add){const He=nt(Be,pe);He!=null&&X.set(He,Be)}if(ie.update)for(const Be of ie.update){let He=X.get(Be.id);if(He==null)continue;const at=!Be.removeAllProperties&&(((me=Be.removeProperties)===null||me===void 0?void 0:me.length)>0||((ye=Be.addOrUpdateProperties)===null||ye===void 0?void 0:ye.length)>0);if((Be.newGeometry||Be.removeAllProperties||at)&&(He=Object.assign({},He),X.set(Be.id,He),at&&(He.properties=Object.assign({},He.properties))),Be.newGeometry&&(He.geometry=Be.newGeometry),Be.removeAllProperties)He.properties={};else if(((qe=Be.removeProperties)===null||qe===void 0?void 0:qe.length)>0)for(const Ft of Be.removeProperties)Object.prototype.hasOwnProperty.call(He.properties,Ft)&&delete He.properties[Ft];if(((Je=Be.addOrUpdateProperties)===null||Je===void 0?void 0:Je.length)>0)for(const{key:Ft,value:$t}of Be.addOrUpdateProperties)He.properties[Ft]=$t}}(this._dataUpdateable,H.dataDiff,J),ne(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):ne(new Error(`Cannot update existing geojson data in ${H.source}`)):ne(new Error(`Input data given to '${H.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},this.loadVectorData=this.loadGeoJSONTile,G&&(this.loadGeoJSON=G)}loadGeoJSONTile(P,k){const B=P.tileID.canonical;if(!this._geoJSONIndex)return k(null,null);const G=this._geoJSONIndex.getTile(B.z,B.x,B.y);if(!G)return k(null,null);const H=new class{constructor(J){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=l.N,this.length=J.length,this._features=J}feature(J){return new class{constructor(X){this._feature=X,this.extent=l.N,this.type=X.type,this.properties=X.tags,"id"in X&&!isNaN(X.id)&&(this.id=parseInt(X.id,10))}loadGeometry(){if(this._feature.type===1){const X=[];for(const ie of this._feature.geometry)X.push([new l.P(ie[0],ie[1])]);return X}{const X=[];for(const ie of this._feature.geometry){const pe=[];for(const me of ie)pe.push(new l.P(me[0],me[1]));X.push(pe)}return X}}toGeoJSON(X,ie,pe){return St.call(this,X,ie,pe)}}(this._features[J])}}(G.features);let ne=Mi(H);ne.byteOffset===0&&ne.byteLength===ne.buffer.byteLength||(ne=new Uint8Array(ne)),k(null,{vectorTile:H,rawData:ne.buffer})}loadData(P,k){var B;(B=this._pendingRequest)===null||B===void 0||B.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const G=!!(P&&P.request&&P.request.collectResourceTiming)&&new l.bu(P.request);this._pendingCallback=k,this._pendingRequest=this.loadGeoJSON(P,(H,ne)=>{if(delete this._pendingCallback,delete this._pendingRequest,H||!ne)return k(H);if(typeof ne!="object")return k(new Error(`Input data given to '${P.source}' is not a valid GeoJSON object.`));{tt(ne,!0);try{if(P.filter){const X=l.bC(P.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(X.result==="error")throw new Error(X.value.map(pe=>`${pe.key}: ${pe.message}`).join(", "));ne={type:"FeatureCollection",features:ne.features.filter(pe=>X.value.evaluate({zoom:0},pe))}}this._geoJSONIndex=P.cluster?new rn(function({superclusterOptions:X,clusterProperties:ie}){if(!ie||!X)return X;const pe={},me={},ye={accumulated:null,zoom:0},qe={properties:null},Je=Object.keys(ie);for(const Be of Je){const[He,at]=ie[Be],Ft=l.bC(at),$t=l.bC(typeof He=="string"?[He,["accumulated"],["get",Be]]:He);pe[Be]=Ft.value,me[Be]=$t.value}return X.map=Be=>{qe.properties=Be;const He={};for(const at of Je)He[at]=pe[at].evaluate(ye,qe);return He},X.reduce=(Be,He)=>{qe.properties=He;for(const at of Je)ye.accumulated=Be[at],Be[at]=me[at].evaluate(ye,qe)},X}(P)).load(ne.features):function(X,ie){return new Ce(X,ie)}(ne,P.geojsonVtOptions)}catch(X){return k(X)}this.loaded={};const J={};if(G){const X=G.finish();X&&(J.resourceTiming={},J.resourceTiming[P.source]=JSON.parse(JSON.stringify(X)))}k(null,J)}})}reloadTile(P,k){const B=this.loaded;return B&&B[P.uid]?super.reloadTile(P,k):this.loadTile(P,k)}removeSource(P,k){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),k()}getClusterExpansionZoom(P,k){try{k(null,this._geoJSONIndex.getClusterExpansionZoom(P.clusterId))}catch(B){k(B)}}getClusterChildren(P,k){try{k(null,this._geoJSONIndex.getChildren(P.clusterId))}catch(B){k(B)}}getClusterLeaves(P,k){try{k(null,this._geoJSONIndex.getLeaves(P.clusterId,P.limit,P.offset))}catch(B){k(B)}}}class on{constructor(P){this.self=P,this.actor=new l.C(P,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:et,geojson:ot},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(k,B)=>{if(this.workerSourceTypes[k])throw new Error(`Worker source with name "${k}" already registered.`);this.workerSourceTypes[k]=B},this.self.registerRTLTextPlugin=k=>{if(l.bD.isParsed())throw new Error("RTL text plugin already registered.");l.bD.applyArabicShaping=k.applyArabicShaping,l.bD.processBidirectionalText=k.processBidirectionalText,l.bD.processStyledBidirectionalText=k.processStyledBidirectionalText}}setReferrer(P,k){this.referrer=k}setImages(P,k,B){this.availableImages[P]=k;for(const G in this.workerSources[P]){const H=this.workerSources[P][G];for(const ne in H)H[ne].availableImages=k}B()}setLayers(P,k,B){this.getLayerIndex(P).replace(k),B()}updateLayers(P,k,B){this.getLayerIndex(P).update(k.layers,k.removedIds),B()}loadTile(P,k,B){this.getWorkerSource(P,k.type,k.source).loadTile(k,B)}loadDEMTile(P,k,B){this.getDEMWorkerSource(P,k.source).loadTile(k,B)}reloadTile(P,k,B){this.getWorkerSource(P,k.type,k.source).reloadTile(k,B)}abortTile(P,k,B){this.getWorkerSource(P,k.type,k.source).abortTile(k,B)}removeTile(P,k,B){this.getWorkerSource(P,k.type,k.source).removeTile(k,B)}removeDEMTile(P,k){this.getDEMWorkerSource(P,k.source).removeTile(k)}removeSource(P,k,B){if(!this.workerSources[P]||!this.workerSources[P][k.type]||!this.workerSources[P][k.type][k.source])return;const G=this.workerSources[P][k.type][k.source];delete this.workerSources[P][k.type][k.source],G.removeSource!==void 0?G.removeSource(k,B):B()}loadWorkerSource(P,k,B){try{this.self.importScripts(k.url),B()}catch(G){B(G.toString())}}syncRTLPluginState(P,k,B){try{l.bD.setState(k);const G=l.bD.getPluginURL();if(l.bD.isLoaded()&&!l.bD.isParsed()&&G!=null){this.self.importScripts(G);const H=l.bD.isParsed();B(H?void 0:new Error(`RTL Text Plugin failed to import scripts from ${G}`),H)}}catch(G){B(G.toString())}}getAvailableImages(P){let k=this.availableImages[P];return k||(k=[]),k}getLayerIndex(P){let k=this.layerIndexes[P];return k||(k=this.layerIndexes[P]=new oe),k}getWorkerSource(P,k,B){return this.workerSources[P]||(this.workerSources[P]={}),this.workerSources[P][k]||(this.workerSources[P][k]={}),this.workerSources[P][k][B]||(this.workerSources[P][k][B]=new this.workerSourceTypes[k]({send:(G,H,ne)=>{this.actor.send(G,H,ne,P)}},this.getLayerIndex(P),this.getAvailableImages(P))),this.workerSources[P][k][B]}getDEMWorkerSource(P,k){return this.demWorkerSources[P]||(this.demWorkerSources[P]={}),this.demWorkerSources[P][k]||(this.demWorkerSources[P][k]=new lt),this.demWorkerSources[P][k]}}return l.i()&&(self.worker=new on(self)),on}),V(["./shared"],function(l){var oe="3.6.2";class q{static testProp(t){if(!q.docStyle)return t[0];for(let n=0;n<t.length;n++)if(t[n]in q.docStyle)return t[n];return t[0]}static create(t,n,s){const c=window.document.createElement(t);return n!==void 0&&(c.className=n),s&&s.appendChild(c),c}static createNS(t,n){return window.document.createElementNS(t,n)}static disableDrag(){q.docStyle&&q.selectProp&&(q.userSelect=q.docStyle[q.selectProp],q.docStyle[q.selectProp]="none")}static enableDrag(){q.docStyle&&q.selectProp&&(q.docStyle[q.selectProp]=q.userSelect)}static setTransform(t,n){t.style[q.transformProp]=n}static addEventListener(t,n,s,c={}){t.addEventListener(n,s,"passive"in c?c:c.capture)}static removeEventListener(t,n,s,c={}){t.removeEventListener(n,s,"passive"in c?c:c.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",q.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",q.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",q.suppressClickInternal,!0)},0)}static mousePos(t,n){const s=t.getBoundingClientRect();return new l.P(n.clientX-s.left-t.clientLeft,n.clientY-s.top-t.clientTop)}static touchPos(t,n){const s=t.getBoundingClientRect(),c=[];for(let p=0;p<n.length;p++)c.push(new l.P(n[p].clientX-s.left-t.clientLeft,n[p].clientY-s.top-t.clientTop));return c}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}q.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,q.selectProp=q.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),q.transformProp=q.testProp(["transform","WebkitTransform"]);const be={supported:!1,testSupport:function(h){!et&&de&&(lt?Xe(h):Te=h)}};let Te,de,et=!1,lt=!1;function Xe(h){const t=h.createTexture();h.bindTexture(h.TEXTURE_2D,t);try{if(h.texImage2D(h.TEXTURE_2D,0,h.RGBA,h.RGBA,h.UNSIGNED_BYTE,de),h.isContextLost())return;be.supported=!0}catch{}h.deleteTexture(t),et=!0}var ft,tt;typeof document<"u"&&(de=document.createElement("img"),de.onload=function(){Te&&Xe(Te),Te=null,lt=!0},de.onerror=function(){et=!0,Te=null},de.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(h){let t,n,s,c;h.resetRequestQueue=()=>{t=[],n=0,s=0,c={}},h.addThrottleControl=S=>{const I=s++;return c[I]=S,I},h.removeThrottleControl=S=>{delete c[S],_()},h.getImage=(S,I,C=!0)=>{be.supported&&(S.headers||(S.headers={}),S.headers.accept="image/webp,*/*");const L={requestParameters:S,supportImageRefresh:C,callback:I,cancelled:!1,completed:!1,cancel:()=>{L.completed||L.cancelled||(L.cancelled=!0,L.innerRequest&&(L.innerRequest.cancel(),n--),_())}};return t.push(L),_(),L};const p=S=>{const{requestParameters:I,supportImageRefresh:C,callback:L}=S;return l.e(I,{type:"image"}),(C!==!1||l.i()||l.g(I.url)||I.headers&&!Object.keys(I.headers).reduce((U,N)=>U&&N==="accept",!0)?l.m:b)(I,(U,N,j,F)=>{g(S,L,U,N,j,F)})},g=(S,I,C,L,U,N)=>{C?I(C):L instanceof HTMLImageElement||l.a(L)?I(null,L):L&&((j,F)=>{typeof createImageBitmap=="function"?l.b(j,F):l.d(j,F)})(L,(j,F)=>{j!=null?I(j):F!=null&&I(null,F,{cacheControl:U,expires:N})}),S.cancelled||(S.completed=!0,n--,_())},_=()=>{const S=(()=>{const I=Object.keys(c);let C=!1;if(I.length>0){for(const L of I)if(C=c[L](),C)break}return C})()?l.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:l.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let I=n;I<S&&t.length>0;I++){const C=t.shift();if(C.cancelled){I--;continue}const L=p(C);n++,C.innerRequest=L}},b=(S,I)=>{const C=new Image,L=S.url;let U=!1;const N=S.credentials;return N&&N==="include"?C.crossOrigin="use-credentials":(N&&N==="same-origin"||!l.s(L))&&(C.crossOrigin="anonymous"),C.fetchPriority="high",C.onload=()=>{I(null,C),C.onerror=C.onload=null},C.onerror=()=>{U||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.")),C.onerror=C.onload=null},C.src=L,{cancel:()=>{U=!0,C.src=""}}}}(ft||(ft={})),ft.resetRequestQueue(),function(h){h.Glyphs="Glyphs",h.Image="Image",h.Source="Source",h.SpriteImage="SpriteImage",h.SpriteJSON="SpriteJSON",h.Style="Style",h.Tile="Tile",h.Unknown="Unknown"}(tt||(tt={}));class St{constructor(t){this._transformRequestFn=t}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}normalizeSpriteURL(t,n,s){const c=function(p){const g=p.match(Ct);if(!g)throw new Error(`Unable to parse URL "${p}"`);return{protocol:g[1],authority:g[2],path:g[3]||"/",params:g[4]?g[4].split("&"):[]}}(t);return c.path+=`${n}${s}`,function(p){const g=p.params.length?`?${p.params.join("&")}`:"";return`${p.protocol}://${p.authority}${p.path}${g}`}(c)}setTransformRequest(t){this._transformRequestFn=t}}const Ct=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Ue(h){var t=new l.A(3);return t[0]=h[0],t[1]=h[1],t[2]=h[2],t}var gt,Qe=function(h,t,n){return h[0]=t[0]-n[0],h[1]=t[1]-n[1],h[2]=t[2]-n[2],h};gt=new l.A(3),l.A!=Float32Array&&(gt[0]=0,gt[1]=0,gt[2]=0);var rt=function(h){var t=h[0],n=h[1];return t*t+n*n};function Ve(h){const t=[];if(typeof h=="string")t.push({id:"default",url:h});else if(h&&h.length>0){const n=[];for(const{id:s,url:c}of h){const p=`${s}${c}`;n.indexOf(p)===-1&&(n.push(p),t.push({id:s,url:c}))}}return t}function pt(h,t,n,s,c){if(s)return void h(s);if(c!==Object.values(t).length||c!==Object.values(n).length)return;const p={};for(const g in t){p[g]={};const _=l.h.getImageCanvasContext(n[g]),b=t[g];for(const S in b){const{width:I,height:C,x:L,y:U,sdf:N,pixelRatio:j,stretchX:F,stretchY:ee,content:se}=b[S];p[g][S]={data:null,pixelRatio:j,sdf:N,stretchX:F,stretchY:ee,content:se,spriteData:{width:I,height:C,x:L,y:U,context:_}}}}h(null,p)}(function(){var h=new l.A(2);l.A!=Float32Array&&(h[0]=0,h[1]=0)})();class Ge{constructor(t,n,s,c){this.context=t,this.format=s,this.texture=t.gl.createTexture(),this.update(n,c)}update(t,n,s){const{width:c,height:p}=t,g=!(this.size&&this.size[0]===c&&this.size[1]===p||s),{context:_}=this,{gl:b}=_;if(this.useMipmap=!!(n&&n.useMipmap),b.bindTexture(b.TEXTURE_2D,this.texture),_.pixelStoreUnpackFlipY.set(!1),_.pixelStoreUnpack.set(1),_.pixelStoreUnpackPremultiplyAlpha.set(this.format===b.RGBA&&(!n||n.premultiply!==!1)),g)this.size=[c,p],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||l.a(t)?b.texImage2D(b.TEXTURE_2D,0,this.format,this.format,b.UNSIGNED_BYTE,t):b.texImage2D(b.TEXTURE_2D,0,this.format,c,p,0,this.format,b.UNSIGNED_BYTE,t.data);else{const{x:S,y:I}=s||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||l.a(t)?b.texSubImage2D(b.TEXTURE_2D,0,S,I,b.RGBA,b.UNSIGNED_BYTE,t):b.texSubImage2D(b.TEXTURE_2D,0,S,I,c,p,b.RGBA,b.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&b.generateMipmap(b.TEXTURE_2D)}bind(t,n,s){const{context:c}=this,{gl:p}=c;p.bindTexture(p.TEXTURE_2D,this.texture),s!==p.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=p.LINEAR),t!==this.filter&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,t),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,s||t),this.filter=t),n!==this.wrap&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,n),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,n),this.wrap=n)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function Rt(h){const{userImage:t}=h;return!!(t&&t.render&&t.render())&&(h.data.replace(new Uint8Array(t.data.buffer)),!0)}class it extends l.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new l.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:n,callback:s}of this.requestors)this._notify(n,s);this.requestors=[]}}getImage(t){const n=this.images[t];if(n&&!n.data&&n.spriteData){const s=n.spriteData;n.data=new l.R({width:s.width,height:s.height},s.context.getImageData(s.x,s.y,s.width,s.height).data),n.spriteData=null}return n}addImage(t,n){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,n)&&(this.images[t]=n)}_validate(t,n){let s=!0;const c=n.data||n.spriteData;return this._validateStretch(n.stretchX,c&&c.width)||(this.fire(new l.j(new Error(`Image "${t}" has invalid "stretchX" value`))),s=!1),this._validateStretch(n.stretchY,c&&c.height)||(this.fire(new l.j(new Error(`Image "${t}" has invalid "stretchY" value`))),s=!1),this._validateContent(n.content,n)||(this.fire(new l.j(new Error(`Image "${t}" has invalid "content" value`))),s=!1),s}_validateStretch(t,n){if(!t)return!0;let s=0;for(const c of t){if(c[0]<s||c[1]<c[0]||n<c[1])return!1;s=c[1]}return!0}_validateContent(t,n){if(!t)return!0;if(t.length!==4)return!1;const s=n.spriteData,c=s&&s.width||n.data.width,p=s&&s.height||n.data.height;return!(t[0]<0||c<t[0]||t[1]<0||p<t[1]||t[2]<0||c<t[2]||t[3]<0||p<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,n,s=!0){const c=this.getImage(t);if(s&&(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[t]=n,this.updatedImages[t]=!0}removeImage(t){const n=this.images[t];delete this.images[t],delete this.patterns[t],n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t,n){let s=!0;if(!this.isLoaded())for(const c of t)this.images[c]||(s=!1);this.isLoaded()||s?this._notify(t,n):this.requestors.push({ids:t,callback:n})}_notify(t,n){const s={};for(const c of t){let p=this.getImage(c);p||(this.fire(new l.k("styleimagemissing",{id:c})),p=this.getImage(c)),p?s[c]={data:p.data.clone(),pixelRatio:p.pixelRatio,sdf:p.sdf,version:p.version,stretchX:p.stretchX,stretchY:p.stretchY,content:p.content,hasRenderCallback:!!(p.userImage&&p.userImage.render)}:l.w(`Image "${c}" 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.`)}n(null,s)}getPixelSize(){const{width:t,height:n}=this.atlasImage;return{width:t,height:n}}getPattern(t){const n=this.patterns[t],s=this.getImage(t);if(!s)return null;if(n&&n.position.version===s.version)return n.position;if(n)n.position.version=s.version;else{const c={w:s.data.width+2,h:s.data.height+2,x:0,y:0},p=new l.I(c,s);this.patterns[t]={bin:c,position:p}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const n=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Ge(t,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const p in this.patterns)t.push(this.patterns[p].bin);const{w:n,h:s}=l.p(t),c=this.atlasImage;c.resize({width:n||1,height:s||1});for(const p in this.patterns){const{bin:g}=this.patterns[p],_=g.x+1,b=g.y+1,S=this.getImage(p).data,I=S.width,C=S.height;l.R.copy(S,c,{x:0,y:0},{x:_,y:b},{width:I,height:C}),l.R.copy(S,c,{x:0,y:C-1},{x:_,y:b-1},{width:I,height:1}),l.R.copy(S,c,{x:0,y:0},{x:_,y:b+C},{width:I,height:1}),l.R.copy(S,c,{x:I-1,y:0},{x:_-1,y:b},{width:1,height:C}),l.R.copy(S,c,{x:0,y:0},{x:_+I,y:b},{width:1,height:C})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const s=this.getImage(n);s||l.w(`Image with ID: "${n}" was not found`),Rt(s)&&this.updateImage(n,s)}}}const ct=1e20;function st(h,t,n,s,c,p,g,_,b){for(let S=t;S<t+s;S++)yt(h,n*p+S,p,c,g,_,b);for(let S=n;S<n+c;S++)yt(h,S*p+t,1,s,g,_,b)}function yt(h,t,n,s,c,p,g){p[0]=0,g[0]=-ct,g[1]=ct,c[0]=h[t];for(let _=1,b=0,S=0;_<s;_++){c[_]=h[t+_*n];const I=_*_;do{const C=p[b];S=(c[_]-c[C]+I-C*C)/(_-C)/2}while(S<=g[b]&&--b>-1);b++,p[b]=_,g[b]=S,g[b+1]=ct}for(let _=0,b=0;_<s;_++){for(;g[b+1]<_;)b++;const S=p[b],I=_-S;h[t+_*n]=c[S]+I*I}}class Ot{constructor(t,n){this.requestManager=t,this.localIdeographFontFamily=n,this.entries={}}setURL(t){this.url=t}getGlyphs(t,n){const s=[];for(const c in t)for(const p of t[c])s.push({stack:c,id:p});l.o(s,({stack:c,id:p},g)=>{let _=this.entries[c];_||(_=this.entries[c]={glyphs:{},requests:{},ranges:{}});let b=_.glyphs[p];if(b!==void 0)return void g(null,{stack:c,id:p,glyph:b});if(b=this._tinySDF(_,c,p),b)return _.glyphs[p]=b,void g(null,{stack:c,id:p,glyph:b});const S=Math.floor(p/256);if(256*S>65535)return void g(new Error("glyphs > 65535 not supported"));if(_.ranges[S])return void g(null,{stack:c,id:p,glyph:b});if(!this.url)return void g(new Error("glyphsUrl is not set"));let I=_.requests[S];I||(I=_.requests[S]=[],Ot.loadGlyphRange(c,S,this.url,this.requestManager,(C,L)=>{if(L){for(const U in L)this._doesCharSupportLocalGlyph(+U)||(_.glyphs[+U]=L[+U]);_.ranges[S]=!0}for(const U of I)U(C,L);delete _.requests[S]})),I.push((C,L)=>{C?g(C):L&&g(null,{stack:c,id:p,glyph:L[p]||null})})},(c,p)=>{if(c)n(c);else if(p){const g={};for(const{stack:_,id:b,glyph:S}of p)(g[_]||(g[_]={}))[b]=S&&{id:S.id,bitmap:S.bitmap.clone(),metrics:S.metrics};n(null,g)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(l.u["CJK Unified Ideographs"](t)||l.u["Hangul Syllables"](t)||l.u.Hiragana(t)||l.u.Katakana(t))}_tinySDF(t,n,s){const c=this.localIdeographFontFamily;if(!c||!this._doesCharSupportLocalGlyph(s))return;let p=t.tinySDF;if(!p){let _="400";/bold/i.test(n)?_="900":/medium/i.test(n)?_="500":/light/i.test(n)&&(_="200"),p=t.tinySDF=new Ot.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:c,fontWeight:_})}const g=p.draw(String.fromCharCode(s));return{id:s,bitmap:new l.q({width:g.width||60,height:g.height||60},g.data),metrics:{width:g.glyphWidth/2||24,height:g.glyphHeight/2||24,left:g.glyphLeft/2+.5||0,top:g.glyphTop/2-27.5||-8,advance:g.glyphAdvance/2||24,isDoubleResolution:!0}}}}Ot.loadGlyphRange=function(h,t,n,s,c){const p=256*t,g=p+255,_=s.transformRequest(n.replace("{fontstack}",h).replace("{range}",`${p}-${g}`),tt.Glyphs);l.l(_,(b,S)=>{if(b)c(b);else if(S){const I={};for(const C of l.n(S))I[C.id]=C;c(null,I)}})},Ot.TinySDF=class{constructor({fontSize:h=24,buffer:t=3,radius:n=8,cutoff:s=.25,fontFamily:c="sans-serif",fontWeight:p="normal",fontStyle:g="normal"}={}){this.buffer=t,this.cutoff=s,this.radius=n;const _=this.size=h+4*t,b=this._createCanvas(_),S=this.ctx=b.getContext("2d",{willReadFrequently:!0});S.font=`${g} ${p} ${h}px ${c}`,S.textBaseline="alphabetic",S.textAlign="left",S.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_createCanvas(h){const t=document.createElement("canvas");return t.width=t.height=h,t}draw(h){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:s,actualBoundingBoxLeft:c,actualBoundingBoxRight:p}=this.ctx.measureText(h),g=Math.ceil(n),_=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(p-c))),b=Math.min(this.size-this.buffer,g+Math.ceil(s)),S=_+2*this.buffer,I=b+2*this.buffer,C=Math.max(S*I,0),L=new Uint8ClampedArray(C),U={data:L,width:S,height:I,glyphWidth:_,glyphHeight:b,glyphTop:g,glyphLeft:0,glyphAdvance:t};if(_===0||b===0)return U;const{ctx:N,buffer:j,gridInner:F,gridOuter:ee}=this;N.clearRect(j,j,_,b),N.fillText(h,j,j+g);const se=N.getImageData(j,j,_,b);ee.fill(ct,0,C),F.fill(0,0,C);for(let W=0;W<b;W++)for(let te=0;te<_;te++){const ce=se.data[4*(W*_+te)+3]/255;if(ce===0)continue;const he=(W+j)*S+te+j;if(ce===1)ee[he]=0,F[he]=ct;else{const fe=.5-ce;ee[he]=fe>0?fe*fe:0,F[he]=fe<0?fe*fe:0}}st(ee,0,0,S,I,S,this.f,this.v,this.z),st(F,j,j,_,b,S,this.f,this.v,this.z);for(let W=0;W<C;W++){const te=Math.sqrt(ee[W])-Math.sqrt(F[W]);L[W]=Math.round(255-255*(te/this.radius+this.cutoff))}return U}};class Vt{constructor(){this.specification=l.v.light.position}possiblyEvaluate(t,n){return l.z(t.expression.evaluate(n))}interpolate(t,n,s){return{x:l.B.number(t.x,n.x,s),y:l.B.number(t.y,n.y,s),z:l.B.number(t.z,n.z,s)}}}let ai;class Mi extends l.E{constructor(t){super(),ai=ai||new l.r({anchor:new l.D(l.v.light.anchor),position:new Vt,color:new l.D(l.v.light.color),intensity:new l.D(l.v.light.intensity)}),this._transitionable=new l.T(ai),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(l.t,t,n))for(const s in t){const c=t[s];s.endsWith("-transition")?this._transitionable.setTransition(s.slice(0,-11),c):this._transitionable.setValue(s,c)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,s){return(!s||s.validate!==!1)&&l.x(this,t.call(l.y,l.e({value:n,style:{glyphs:!0,sprite:!0},styleSpec:l.v})))}}class vr{constructor(t,n){this.width=t,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,n){const s=t.join(",")+String(n);return this.dashEntry[s]||(this.dashEntry[s]=this.addDash(t,n)),this.dashEntry[s]}getDashRanges(t,n,s){const c=[];let p=t.length%2==1?-t[t.length-1]*s:0,g=t[0]*s,_=!0;c.push({left:p,right:g,isDash:_,zeroLength:t[0]===0});let b=t[0];for(let S=1;S<t.length;S++){_=!_;const I=t[S];p=b*s,b+=I,g=b*s,c.push({left:p,right:g,isDash:_,zeroLength:I===0})}return c}addRoundDash(t,n,s){const c=n/2;for(let p=-s;p<=s;p++){const g=this.width*(this.nextRow+s+p);let _=0,b=t[_];for(let S=0;S<this.width;S++){S/b.right>1&&(b=t[++_]);const I=Math.abs(S-b.left),C=Math.abs(S-b.right),L=Math.min(I,C);let U;const N=p/s*(c+1);if(b.isDash){const j=c-Math.abs(N);U=Math.sqrt(L*L+j*j)}else U=c-Math.sqrt(L*L+N*N);this.data[g+S]=Math.max(0,Math.min(255,U+128))}}}addRegularDash(t){for(let _=t.length-1;_>=0;--_){const b=t[_],S=t[_+1];b.zeroLength?t.splice(_,1):S&&S.isDash===b.isDash&&(S.left=b.left,t.splice(_,1))}const n=t[0],s=t[t.length-1];n.isDash===s.isDash&&(n.left=s.left-this.width,s.right=n.right+this.width);const c=this.width*this.nextRow;let p=0,g=t[p];for(let _=0;_<this.width;_++){_/g.right>1&&(g=t[++p]);const b=Math.abs(_-g.left),S=Math.abs(_-g.right),I=Math.min(b,S);this.data[c+_]=Math.max(0,Math.min(255,(g.isDash?I:-I)+128))}}addDash(t,n){const s=n?7:0,c=2*s+1;if(this.nextRow+c>this.height)return l.w("LineAtlas out of space"),null;let p=0;for(let _=0;_<t.length;_++)p+=t[_];if(p!==0){const _=this.width/p,b=this.getDashRanges(t,this.width,_);n?this.addRoundDash(b,_,s):this.addRegularDash(b)}const g={y:(this.nextRow+s+.5)/this.height,height:2*s/this.height,width:p};return this.nextRow+=c,this.dirty=!0,g}bind(t){const n=t.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))}}class gi{constructor(t,n,s){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=s;const c=this.workerPool.acquire(s);for(let p=0;p<c.length;p++){const g=new l.C(c[p],n,s);g.name=`Worker ${p}`,this.actors.push(g)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n,s){l.o(this.actors,(c,p)=>{c.send(t,n,p)},s=s||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach(n=>{n.remove()}),this.actors=[],t&&this.workerPool.release(this.id)}}function Fi(h,t,n){const s=function(c,p){if(c)return n(c);if(p){const g=l.F(l.e(p,h),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);p.vector_layers&&(g.vectorLayers=p.vector_layers,g.vectorLayerIds=g.vectorLayers.map(_=>_.id)),n(null,g)}};return h.url?l.f(t.transformRequest(h.url,tt.Source),s):l.h.frame(()=>s(null,h))}class Bt{constructor(t,n){t&&(n?this.setSouthWest(t).setNorthEast(n):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof l.L?new l.L(t.lng,t.lat):l.L.convert(t),this}setSouthWest(t){return this._sw=t instanceof l.L?new l.L(t.lng,t.lat):l.L.convert(t),this}extend(t){const n=this._sw,s=this._ne;let c,p;if(t instanceof l.L)c=t,p=t;else{if(!(t instanceof Bt))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(Bt.convert(t)):this.extend(l.L.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(l.L.convert(t)):this;if(c=t._sw,p=t._ne,!c||!p)return this}return n||s?(n.lng=Math.min(c.lng,n.lng),n.lat=Math.min(c.lat,n.lat),s.lng=Math.max(p.lng,s.lng),s.lat=Math.max(p.lat,s.lat)):(this._sw=new l.L(c.lng,c.lat),this._ne=new l.L(p.lng,p.lat)),this}getCenter(){return new l.L((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new l.L(this.getWest(),this.getNorth())}getSouthEast(){return new l.L(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){const{lng:n,lat:s}=l.L.convert(t);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<=s&&s<=this._ne.lat&&c}static convert(t){return t instanceof Bt?t:t&&new Bt(t)}static fromLngLat(t,n=0){const s=360*n/40075017,c=s/Math.cos(Math.PI/180*t.lat);return new Bt(new l.L(t.lng-c,t.lat-s),new l.L(t.lng+c,t.lat+s))}}class Ei{constructor(t,n,s){this.bounds=Bt.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=s||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const n=Math.pow(2,t.z),s=Math.floor(l.G(this.bounds.getWest())*n),c=Math.floor(l.H(this.bounds.getNorth())*n),p=Math.ceil(l.G(this.bounds.getEast())*n),g=Math.ceil(l.H(this.bounds.getSouth())*n);return t.x>=s&&t.x<p&&t.y>=c&&t.y<g}}class jr extends l.E{constructor(t,n,s,c){if(super(),this.load=()=>{this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this._tileJSONRequest=Fi(this._options,this.map._requestManager,(p,g)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),p?this.fire(new l.j(p)):g&&(l.e(this,g),g.bounds&&(this.tileBounds=new Ei(g.bounds,this.minzoom,this.maxzoom)),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})))})},this.serialize=()=>l.e({},this._options),this.id=t,this.dispatcher=s,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,l.e(this,l.F(n,["url","scheme","tileSize","promoteId"])),this._options=l.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)}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}loadTile(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),c={request:this.map._requestManager.transformRequest(s,tt.Tile),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function p(g,_){return delete t.request,t.aborted?n(null):g&&g.status!==404?n(g):(_&&_.resourceTiming&&(t.resourceTiming=_.resourceTiming),this.map._refreshExpiredTiles&&_&&t.setExpiryData(_),t.loadVectorData(_,this.map.painter),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}c.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired"?t.state==="loading"?t.reloadCallback=n:t.request=t.actor.send("reloadTile",c,p.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",c,p.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class rn extends l.E{constructor(t,n,s,c){super(),this.id=t,this.dispatcher=s,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=l.e({type:"raster"},n),l.e(this,l.F(n,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this._tileJSONRequest=Fi(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new l.j(t)):n&&(l.e(this,n),n.bounds&&(this.tileBounds=new Ei(n.bounds,this.minzoom,this.maxzoom)),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}serialize(){return l.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=ft.getImage(this.map._requestManager.transformRequest(s,tt.Tile),(c,p,g)=>{if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(c)t.state="errored",n(c);else if(p){this.map._refreshExpiredTiles&&g&&t.setExpiryData(g);const _=this.map.painter.context,b=_.gl;t.texture=this.map.painter.getTileTexture(p.width),t.texture?t.texture.update(p,{useMipmap:!0}):(t.texture=new Ge(_,p,b.RGBA,{useMipmap:!0}),t.texture.bind(b.LINEAR,b.CLAMP_TO_EDGE,b.LINEAR_MIPMAP_NEAREST),_.extTextureFilterAnisotropic&&b.texParameterf(b.TEXTURE_2D,_.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,_.extTextureFilterAnisotropicMax)),t.state="loaded",n(null)}},this.map._refreshExpiredTiles)}abortTile(t,n){t.request&&(t.request.cancel(),delete t.request),n()}unloadTile(t,n){t.texture&&this.map.painter.saveTileTexture(t.texture),n()}hasTransition(){return!1}}class na extends rn{constructor(t,n,s,c){super(t,n,s,c),this.type="raster-dem",this.maxzoom=22,this._options=l.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(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),c=this.map._requestManager.transformRequest(s,tt.Tile);function p(g,_){g&&(t.state="errored",n(g)),_&&(t.dem=_,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded",n(null))}t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.request=ft.getImage(c,(g,_,b)=>l._(this,void 0,void 0,function*(){if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(g)t.state="errored",n(g);else if(_){this.map._refreshExpiredTiles&&t.setExpiryData(b);const S=l.a(_)&&l.J()?_:yield function(C){return l._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&l.K()){const L=C.width+2,U=C.height+2;try{return new l.R({width:L,height:U},yield l.M(C,-1,-1,L,U))}catch{}}return l.h.getImageData(C,1)})}(_),I={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:S,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",I,p))}}),this.map._refreshExpiredTiles)}_getNeighboringTiles(t){const n=t.canonical,s=Math.pow(2,n.z),c=(n.x-1+s)%s,p=n.x===0?t.wrap-1:t.wrap,g=(n.x+1+s)%s,_=n.x+1===s?t.wrap+1:t.wrap,b={};return b[new l.O(t.overscaledZ,p,n.z,c,n.y).key]={backfilled:!1},b[new l.O(t.overscaledZ,_,n.z,g,n.y).key]={backfilled:!1},n.y>0&&(b[new l.O(t.overscaledZ,p,n.z,c,n.y-1).key]={backfilled:!1},b[new l.O(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},b[new l.O(t.overscaledZ,_,n.z,g,n.y-1).key]={backfilled:!1}),n.y+1<s&&(b[new l.O(t.overscaledZ,p,n.z,c,n.y+1).key]={backfilled:!1},b[new l.O(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},b[new l.O(t.overscaledZ,_,n.z,g,n.y+1).key]={backfilled:!1}),b}unloadTile(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&t.actor.send("removeDEMTile",{uid:t.uid,source:this.id})}}class bn extends l.E{constructor(t,n,s,c){super(),this.load=()=>{this._updateWorkerData()},this.serialize=()=>l.e({},this._options,{type:this.type,data:this._data}),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=s.getActor(),this.setEventedParent(c),this._data=n.data,this._options=l.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;const p=l.N/this.tileSize;this.workerOptions=l.e({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*p,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*p,extent:l.N,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:n.clusterMaxZoom!==void 0?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:l.N,radius:(n.clusterRadius||50)*p,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData(),this}updateData(t){return this._updateWorkerData(t),this}setClusterOptions(t){return this.workerOptions.cluster=t.cluster,t&&(t.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=t.clusterRadius),t.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=t.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(t,n){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},n),this}getClusterChildren(t,n){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},n),this}getClusterLeaves(t,n,s,c){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:n,offset:s},c),this}_updateWorkerData(t){const n=l.e({},this.workerOptions);t?n.dataDiff=t:typeof this._data=="string"?(n.request=this.map._requestManager.transformRequest(l.h.resolveURL(this._data),tt.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new l.k("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,n,(s,c)=>{if(this._pendingLoads--,this._removed||c&&c.abandoned)return void this.fire(new l.k("dataabort",{dataType:"source"}));let p=null;if(c&&c.resourceTiming&&c.resourceTiming[this.id]&&(p=c.resourceTiming[this.id].slice(0)),s)return void this.fire(new l.j(s));const g={dataType:"source"};this._collectResourceTiming&&p&&p.length>0&&l.e(g,{resourceTiming:p}),this.fire(new l.k("data",Object.assign(Object.assign({},g),{sourceDataType:"metadata"}))),this.fire(new l.k("data",Object.assign(Object.assign({},g),{sourceDataType:"content"})))})}loaded(){return this._pendingLoads===0}loadTile(t,n){const s=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const c={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.request=this.actor.send(s,c,(p,g)=>(delete t.request,t.unloadVectorData(),t.aborted?n(null):p?n(p):(t.loadVectorData(g,this.map.painter,s==="reloadTile"),n(null))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}hasTransition(){return!1}}var Dr=l.Q([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class xr extends l.E{constructor(t,n,s,c){super(),this.load=(p,g)=>{this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=ft.getImage(this.map._requestManager.transformRequest(this.url,tt.Image),(_,b)=>{this._request=null,this._loaded=!0,_?this.fire(new l.j(_)):b&&(this.image=b,p&&(this.coordinates=p),g&&g(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||!this.image)return;const p=this.map.painter.context,g=p.gl;this.boundsBuffer||(this.boundsBuffer=p.createVertexBuffer(this._boundsArray,Dr.members)),this.boundsSegments||(this.boundsSegments=l.S.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Ge(p,this.image,g.RGBA),this.texture.bind(g.LINEAR,g.CLAMP_TO_EDGE));let _=!1;for(const b in this.tiles){const S=this.tiles[b];S.state!=="loaded"&&(S.state="loaded",S.texture=this.texture,_=!0)}_&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"image",url:this.options.url,coordinates:this.coordinates}),this.id=t,this.dispatcher=s,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}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=t.url,this.load(t.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(t){this.coordinates=t;const n=t.map(l.U.fromLngLat);this.tileID=function(c){let p=1/0,g=1/0,_=-1/0,b=-1/0;for(const L of c)p=Math.min(p,L.x),g=Math.min(g,L.y),_=Math.max(_,L.x),b=Math.max(b,L.y);const S=Math.max(_-p,b-g),I=Math.max(0,Math.floor(-Math.log(S)/Math.LN2)),C=Math.pow(2,I);return new l.W(I,Math.floor((p+_)/2*C),Math.floor((g+b)/2*C))}(n),this.minzoom=this.maxzoom=this.tileID.z;const s=n.map(c=>this.tileID.getTilePoint(c)._round());return this._boundsArray=new l.V,this._boundsArray.emplaceBack(s[0].x,s[0].y,0,0),this._boundsArray.emplaceBack(s[1].x,s[1].y,l.N,0),this._boundsArray.emplaceBack(s[3].x,s[3].y,0,l.N),this._boundsArray.emplaceBack(s[2].x,s[2].y,l.N,l.N),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})),this}loadTile(t,n){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},n(null)):(t.state="errored",n(null))}hasTransition(){return!1}}class Da extends xr{constructor(t,n,s,c){super(t,n,s,c),this.load=()=>{this._loaded=!1;const p=this.options;this.urls=[];for(const g of p.urls)this.urls.push(this.map._requestManager.transformRequest(g,tt.Source).url);l.X(this.urls,(g,_)=>{this._loaded=!0,g?this.fire(new l.j(g)):_&&(this.video=_,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const p=this.map.painter.context,g=p.gl;this.boundsBuffer||(this.boundsBuffer=p.createVertexBuffer(this._boundsArray,Dr.members)),this.boundsSegments||(this.boundsSegments=l.S.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(g.LINEAR,g.CLAMP_TO_EDGE),g.texSubImage2D(g.TEXTURE_2D,0,0,0,g.RGBA,g.UNSIGNED_BYTE,this.video)):(this.texture=new Ge(p,this.video,g.RGBA),this.texture.bind(g.LINEAR,g.CLAMP_TO_EDGE));let _=!1;for(const b in this.tiles){const S=this.tiles[b];S.state!=="loaded"&&(S.state="loaded",S.texture=this.texture,_=!0)}_&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"video",urls:this.urls,coordinates:this.coordinates}),this.roundZoom=!0,this.type="video",this.options=n}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;t<n.start(0)||t>n.end(0)?this.fire(new l.j(new l.Y(`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=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}hasTransition(){return this.video&&!this.video.paused}}class wn extends xr{constructor(t,n,s,c){super(t,n,s,c),this.load=()=>{this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new l.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())},this.prepare=()=>{let p=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,p=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,p=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const g=this.map.painter.context,_=g.gl;this.boundsBuffer||(this.boundsBuffer=g.createVertexBuffer(this._boundsArray,Dr.members)),this.boundsSegments||(this.boundsSegments=l.S.simpleSegment(0,0,4,2)),this.texture?(p||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Ge(g,this.canvas,_.RGBA,{premultiply:!0});let b=!1;for(const S in this.tiles){const I=this.tiles[S];I.state!=="loaded"&&(I.state="loaded",I.texture=this.texture,b=!0)}b&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"canvas",coordinates:this.coordinates}),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(p=>!Array.isArray(p)||p.length!==2||p.some(g=>typeof g!="number"))||this.fire(new l.j(new l.Y(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new l.j(new l.Y(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new l.j(new l.Y(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new l.j(new l.Y(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new l.j(new l.Y(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const Ra={},nn=h=>{switch(h){case"geojson":return bn;case"image":return xr;case"raster":return rn;case"raster-dem":return na;case"vector":return jr;case"video":return Da;case"canvas":return wn}return Ra[h]};function aa(h,t){const n=l.Z();return l.$(n,n,[1,1,0]),l.a0(n,n,[.5*h.width,.5*h.height,1]),l.a1(n,n,h.calculatePosMatrix(t.toUnwrapped()))}function Fn(h,t,n,s,c,p){const g=function(C,L,U){if(C)for(const N of C){const j=L[N];if(j&&j.source===U&&j.type==="fill-extrusion")return!0}else for(const N in L){const j=L[N];if(j.source===U&&j.type==="fill-extrusion")return!0}return!1}(c&&c.layers,t,h.id),_=p.maxPitchScaleFactor(),b=h.tilesIn(s,_,g);b.sort(Sn);const S=[];for(const C of b)S.push({wrappedTileID:C.tileID.wrapped().key,queryResults:C.tile.queryRenderedFeatures(t,n,h._state,C.queryGeometry,C.cameraQueryGeometry,C.scale,c,p,_,aa(h.transform,C.tileID))});const I=function(C){const L={},U={};for(const N of C){const j=N.queryResults,F=N.wrappedTileID,ee=U[F]=U[F]||{};for(const se in j){const W=j[se],te=ee[se]=ee[se]||{},ce=L[se]=L[se]||[];for(const he of W)te[he.featureIndex]||(te[he.featureIndex]=!0,ce.push(he))}}return L}(S);for(const C in I)I[C].forEach(L=>{const U=L.feature,N=h.getFeatureState(U.layer["source-layer"],U.id);U.source=U.layer.source,U.layer["source-layer"]&&(U.sourceLayer=U.layer["source-layer"]),U.state=N});return I}function Sn(h,t){const n=h.tileID,s=t.tileID;return n.overscaledZ-s.overscaledZ||n.canonical.y-s.canonical.y||n.wrap-s.wrap||n.canonical.x-s.canonical.x}class Tn{constructor(t,n){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=l.a2(),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"}registerFadeDuration(t){const n=t+this.timeAdded;n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,n,s){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(c,p){const g={};if(!p)return g;for(const _ of c){const b=_.layerIds.map(S=>p.getLayer(S)).filter(Boolean);if(b.length!==0){_.layers=b,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(S=>b.filter(I=>I.id===S)[0]));for(const S of b)g[S.id]=_}}return g}(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const c in this.buckets){const p=this.buckets[c];if(p instanceof l.a4){if(this.hasSymbolBuckets=!0,!s)break;p.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const c in this.buckets){const p=this.buckets[c];if(p instanceof l.a4&&p.hasRTLText){this.hasRTLText=!0,l.a5();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))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new l.a3}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const s in this.buckets){const c=this.buckets[s];c.uploadPending()&&c.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Ge(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Ge(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,s,c,p,g,_,b,S,I){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:c,cameraQueryGeometry:p,scale:g,tileSize:this.tileSize,pixelPosMatrix:I,transform:b,params:_,queryPadding:this.queryPadding*S},t,n,s):{}}querySourceFeatures(t,n){const s=this.latestFeatureIndex;if(!s||!s.rawTileData)return;const c=s.loadVTLayers(),p=n&&n.sourceLayer?n.sourceLayer:"",g=c._geojsonTileLayer||c[p];if(!g)return;const _=l.a6(n&&n.filter),{z:b,x:S,y:I}=this.tileID.canonical,C={z:b,x:S,y:I};for(let L=0;L<g.length;L++){const U=g.feature(L);if(_.needGeometry){const F=l.a7(U,!0);if(!_.filter(new l.a8(this.tileID.overscaledZ),F,this.tileID.canonical))continue}else if(!_.filter(new l.a8(this.tileID.overscaledZ),U))continue;const N=s.getId(U,p),j=new l.a9(U,b,S,I,N);j.tile=C,t.push(j)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const n=this.expirationTime;if(t.cacheControl){const s=l.aa(t.cacheControl);s["max-age"]&&(this.expirationTime=Date.now()+1e3*s["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const s=Date.now();let c=!1;if(this.expirationTime>s)c=!1;else if(n)if(this.expirationTime<n)c=!0;else{const p=this.expirationTime-n;p?this.expirationTime=s+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(t,n){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(t).length===0)return;const s=this.latestFeatureIndex.loadVTLayers();for(const c in this.buckets){if(!n.style.hasLayer(c))continue;const p=this.buckets[c],g=p.layers[0].sourceLayer||"_geojsonTileLayer",_=s[g],b=t[g];if(!_||!b||Object.keys(b).length===0)continue;p.update(b,_,this.imageAtlas&&this.imageAtlas.patternPositions||{});const S=n&&n.style&&n.style.getLayer(c);S&&(this.queryPadding=Math.max(this.queryPadding,S.queryRadius(p)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<l.h.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=l.h.now()+t}setDependencies(t,n){const s={};for(const c of n)s[c]=!0;this.dependencies[t]=s}hasDependency(t,n){for(const s of t){const c=this.dependencies[s];if(c){for(const p of n)if(c[p])return!0}}return!1}}class On{constructor(t,n){this.max=t,this.onRemove=n,this.reset()}reset(){for(const t in this.data)for(const n of this.data[t])n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value);return this.data={},this.order=[],this}add(t,n,s){const c=t.wrapped().key;this.data[c]===void 0&&(this.data[c]=[]);const p={value:n,timeout:void 0};if(s!==void 0&&(p.timeout=setTimeout(()=>{this.remove(t,p)},s)),this.data[c].push(p),this.order.push(c),this.order.length>this.max){const g=this._getAndRemoveByKey(this.order[0]);g&&this.onRemove(g)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const n=this.data[t].shift();return n.timeout&&clearTimeout(n.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),n.value}getByKey(t){const n=this.data[t];return n?n[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,n){if(!this.has(t))return this;const s=t.wrapped().key,c=n===void 0?0:this.data[s].indexOf(n),p=this.data[s][c];return this.data[s].splice(c,1),p.timeout&&clearTimeout(p.timeout),this.data[s].length===0&&delete this.data[s],this.onRemove(p.value),this.order.splice(this.order.indexOf(s),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(t){const n=[];for(const s in this.data)for(const c of this.data[s])t(c.value)||n.push(c);for(const s of n)this.remove(s.value.tileID,s)}}class ue{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,s){const c=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][c]=this.stateChanges[t][c]||{},l.e(this.stateChanges[t][c],s),this.deletedStates[t]===null){this.deletedStates[t]={};for(const p in this.state[t])p!==c&&(this.deletedStates[t][p]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][c]===null){this.deletedStates[t][c]={};for(const p in this.state[t][c])s[p]||(this.deletedStates[t][c][p]=null)}else for(const p in s)this.deletedStates[t]&&this.deletedStates[t][c]&&this.deletedStates[t][c][p]===null&&delete this.deletedStates[t][c][p]}removeFeatureState(t,n,s){if(this.deletedStates[t]===null)return;const c=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},s&&n!==void 0)this.deletedStates[t][c]!==null&&(this.deletedStates[t][c]=this.deletedStates[t][c]||{},this.deletedStates[t][c][s]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][c])for(s in this.deletedStates[t][c]={},this.stateChanges[t][c])this.deletedStates[t][c][s]=null;else this.deletedStates[t][c]=null;else this.deletedStates[t]=null}getState(t,n){const s=String(n),c=l.e({},(this.state[t]||{})[s],(this.stateChanges[t]||{})[s]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const p=this.deletedStates[t][n];if(p===null)return{};for(const g in p)delete c[g]}return c}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const s={};for(const c in this.stateChanges){this.state[c]=this.state[c]||{};const p={};for(const g in this.stateChanges[c])this.state[c][g]||(this.state[c][g]={}),l.e(this.state[c][g],this.stateChanges[c][g]),p[g]=this.state[c][g];s[c]=p}for(const c in this.deletedStates){this.state[c]=this.state[c]||{};const p={};if(this.deletedStates[c]===null)for(const g in this.state[c])p[g]={},this.state[c][g]={};else for(const g in this.deletedStates[c]){if(this.deletedStates[c][g]===null)this.state[c][g]={};else for(const _ of Object.keys(this.deletedStates[c][g]))delete this.state[c][g][_];p[g]=this.state[c][g]}s[c]=s[c]||{},l.e(s[c],p)}if(this.stateChanges={},this.deletedStates={},Object.keys(s).length!==0)for(const c in t)t[c].setFeatureState(s,n)}}class Qi extends l.E{constructor(t,n,s){super(),this.id=t,this.dispatcher=s,this.on("data",c=>{c.dataType==="source"&&c.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&c.dataType==="source"&&c.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((c,p,g,_)=>{const b=new(nn(p.type))(c,p,g,_);if(b.id!==c)throw new Error(`Expected Source id to be ${c} instead of ${b.id}`);return b})(t,n,s,this),this._tiles={},this._cache=new On(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new ue,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const t in this._tiles){const n=this._tiles[t];if(n.state!=="loaded"&&n.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,n){return this._source.loadTile(t,n)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,()=>{}),this._source.fire(new l.k("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const n in this._tiles){const s=this._tiles[n];s.upload(t),s.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(br).map(t=>t.key)}getRenderableIds(t){const n=[];for(const s in this._tiles)this._isIdRenderable(s,t)&&n.push(this._tiles[s]);return t?n.sort((s,c)=>{const p=s.tileID,g=c.tileID,_=new l.P(p.canonical.x,p.canonical.y)._rotate(this.transform.angle),b=new l.P(g.canonical.x,g.canonical.y)._rotate(this.transform.angle);return p.overscaledZ-g.overscaledZ||b.y-_.y||b.x-_.x}).map(s=>s.tileID.key):n.map(s=>s.tileID).sort(br).map(s=>s.key)}hasRenderableParent(t){const n=this.findLoadedParent(t,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(t,n){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(n||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}}_reloadTile(t,n){const s=this._tiles[t];s&&(s.state!=="loading"&&(s.state=n),this._loadTile(s,this._tileLoaded.bind(this,s,t,n)))}_tileLoaded(t,n,s,c){if(c)return t.state="errored",void(c.status!==404?this._source.fire(new l.j(c,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=l.h.now(),s==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new l.k("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const n=this.getRenderableIds();for(let c=0;c<n.length;c++){const p=n[c];if(t.neighboringTiles&&t.neighboringTiles[p]){const g=this.getTileByID(p);s(t,g),s(g,t)}}function s(c,p){c.needsHillshadePrepare=!0,c.needsTerrainPrepare=!0;let g=p.tileID.canonical.x-c.tileID.canonical.x;const _=p.tileID.canonical.y-c.tileID.canonical.y,b=Math.pow(2,c.tileID.canonical.z),S=p.tileID.key;g===0&&_===0||Math.abs(_)>1||(Math.abs(g)>1&&(Math.abs(g+b)===1?g+=b:Math.abs(g-b)===1&&(g-=b)),p.dem&&c.dem&&(c.dem.backfillBorder(p.dem,g,_),c.neighboringTiles&&c.neighboringTiles[S]&&(c.neighboringTiles[S].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,s,c){for(const p in this._tiles){let g=this._tiles[p];if(c[p]||!g.hasData()||g.tileID.overscaledZ<=n||g.tileID.overscaledZ>s)continue;let _=g.tileID;for(;g&&g.tileID.overscaledZ>n+1;){const S=g.tileID.scaledTo(g.tileID.overscaledZ-1);g=this._tiles[S.key],g&&g.hasData()&&(_=S)}let b=_;for(;b.overscaledZ>n;)if(b=b.scaledTo(b.overscaledZ-1),t[b.key]){c[_.key]=_;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const s=this._loadedParentTiles[t.key];return s&&s.tileID.overscaledZ>=n?s:null}for(let s=t.overscaledZ-1;s>=n;s--){const c=t.scaledTo(s),p=this._getLoadedTile(c);if(p)return p}}_getLoadedTile(t){const n=this._tiles[t.key];return n&&n.hasData()?n:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const n=Math.ceil(t.width/this._source.tileSize)+1,s=Math.ceil(t.height/this._source.tileSize)+1,c=Math.floor(n*s*(this._maxTileCacheZoomLevels===null?l.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),p=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,c):c;this._cache.setMaxSize(p)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const s={};for(const c in this._tiles){const p=this._tiles[c];p.tileID=p.tileID.unwrapTo(p.tileID.wrap+n),s[p.tileID.key]=p}this._tiles=s;for(const c in this._timers)clearTimeout(this._timers[c]),delete this._timers[c];for(const c in this._tiles)this._setTileReloadTimer(c,this._tiles[c])}}update(t,n){if(this.transform=t,this.terrain=n,!this._sourceLoaded||this._paused)return;let s;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?s=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(I=>new l.O(I.canonical.z,I.wrap,I.canonical.z,I.canonical.x,I.canonical.y)):(s=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n}),this._source.hasTile&&(s=s.filter(I=>this._source.hasTile(I)))):s=[];const c=t.coveringZoomLevel(this._source),p=Math.max(c-Qi.maxOverzooming,this._source.minzoom),g=Math.max(c+Qi.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const I={};for(const C of s)if(C.canonical.z>this._source.minzoom){const L=C.scaledTo(C.canonical.z-1);I[L.key]=L;const U=C.scaledTo(Math.max(this._source.minzoom,Math.min(C.canonical.z,5)));I[U.key]=U}s=s.concat(Object.values(I))}const _=s.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,_&&this.fire(new l.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const b=this._updateRetainedTiles(s,c);if(Zt(this._source.type)){const I={},C={},L=Object.keys(b),U=l.h.now();for(const N of L){const j=b[N],F=this._tiles[N];if(!F||F.fadeEndTime!==0&&F.fadeEndTime<=U)continue;const ee=this.findLoadedParent(j,p);ee&&(this._addTile(ee.tileID),I[ee.tileID.key]=ee.tileID),C[N]=j}this._retainLoadedChildren(C,c,g,b);for(const N in I)b[N]||(this._coveredTiles[N]=!0,b[N]=I[N]);if(n){const N={},j={};for(const F of s)this._tiles[F.key].hasData()?N[F.key]=F:j[F.key]=F;for(const F in j){const ee=j[F].children(this._source.maxzoom);this._tiles[ee[0].key]&&this._tiles[ee[1].key]&&this._tiles[ee[2].key]&&this._tiles[ee[3].key]&&(N[ee[0].key]=b[ee[0].key]=ee[0],N[ee[1].key]=b[ee[1].key]=ee[1],N[ee[2].key]=b[ee[2].key]=ee[2],N[ee[3].key]=b[ee[3].key]=ee[3],delete j[F])}for(const F in j){const ee=this.findLoadedParent(j[F],this._source.minzoom);if(ee){N[ee.tileID.key]=b[ee.tileID.key]=ee.tileID;for(const se in N)N[se].isChildOf(ee.tileID)&&delete N[se]}}for(const F in this._tiles)N[F]||(this._coveredTiles[F]=!0)}}for(const I in b)this._tiles[I].clearFadeHold();const S=l.ab(this._tiles,b);for(const I of S){const C=this._tiles[I];C.hasSymbolBuckets&&!C.holdingForFade()?C.setHoldDuration(this.map._fadeDuration):C.hasSymbolBuckets&&!C.symbolFadeFinished()||this._removeTile(I)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){const s={},c={},p=Math.max(n-Qi.maxOverzooming,this._source.minzoom),g=Math.max(n+Qi.maxUnderzooming,this._source.minzoom),_={};for(const b of t){const S=this._addTile(b);s[b.key]=b,S.hasData()||n<this._source.maxzoom&&(_[b.key]=b)}this._retainLoadedChildren(_,n,g,s);for(const b of t){let S=this._tiles[b.key];if(S.hasData())continue;if(n+1>this._source.maxzoom){const C=b.children(this._source.maxzoom)[0],L=this.getTile(C);if(L&&L.hasData()){s[C.key]=C;continue}}else{const C=b.children(this._source.maxzoom);if(s[C[0].key]&&s[C[1].key]&&s[C[2].key]&&s[C[3].key])continue}let I=S.wasRequested();for(let C=b.overscaledZ-1;C>=p;--C){const L=b.scaledTo(C);if(c[L.key])break;if(c[L.key]=!0,S=this.getTile(L),!S&&I&&(S=this._addTile(L)),S){const U=S.hasData();if((I||U)&&(s[L.key]=L),I=S.wasRequested(),U)break}}}return s}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let s,c=this._tiles[t].tileID;for(;c.overscaledZ>0;){if(c.key in this._loadedParentTiles){s=this._loadedParentTiles[c.key];break}n.push(c.key);const p=c.scaledTo(c.overscaledZ-1);if(s=this._getLoadedTile(p),s)break;c=p}for(const p of n)this._loadedParentTiles[p]=s}}_addTile(t){let n=this._tiles[t.key];if(n)return n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));const s=n;return n||(n=new Tn(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))),n.uses++,this._tiles[t.key]=n,s||this._source.fire(new l.k("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const s=n.getExpiryTimeout();s&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},s))}_removeTile(t){const n=this._tiles[t];n&&(n.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),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))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,n,s){const c=[],p=this.transform;if(!p)return c;const g=s?p.getCameraQueryGeometry(t):t,_=t.map(N=>p.pointCoordinate(N,this.terrain)),b=g.map(N=>p.pointCoordinate(N,this.terrain)),S=this.getIds();let I=1/0,C=1/0,L=-1/0,U=-1/0;for(const N of b)I=Math.min(I,N.x),C=Math.min(C,N.y),L=Math.max(L,N.x),U=Math.max(U,N.y);for(let N=0;N<S.length;N++){const j=this._tiles[S[N]];if(j.holdingForFade())continue;const F=j.tileID,ee=Math.pow(2,p.zoom-j.tileID.overscaledZ),se=n*j.queryPadding*l.N/j.tileSize/ee,W=[F.getTilePoint(new l.U(I,C)),F.getTilePoint(new l.U(L,U))];if(W[0].x-se<l.N&&W[0].y-se<l.N&&W[1].x+se>=0&&W[1].y+se>=0){const te=_.map(he=>F.getTilePoint(he)),ce=b.map(he=>F.getTilePoint(he));c.push({tile:j,tileID:F,queryGeometry:te,cameraQueryGeometry:ce,scale:ee})}}return c}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map(s=>this._tiles[s].tileID);for(const s of n)s.posMatrix=this.transform.calculatePosMatrix(s.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(Zt(this._source.type)){const t=l.h.now();for(const n in this._tiles)if(this._tiles[n].fadeEndTime>=t)return!0}return!1}setFeatureState(t,n,s){this._state.updateState(t=t||"_geojsonTileLayer",n,s)}removeFeatureState(t,n,s){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,s)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,s){const c=this._tiles[t];c&&c.setDependencies(n,s)}reloadTilesForDependencies(t,n){for(const s in this._tiles)this._tiles[s].hasDependency(t,n)&&this._reloadTile(s,"reloading");this._cache.filter(s=>!s.hasDependency(t,n))}}function br(h,t){const n=Math.abs(2*h.wrap)-+(h.wrap<0),s=Math.abs(2*t.wrap)-+(t.wrap<0);return h.overscaledZ-t.overscaledZ||s-n||t.canonical.y-h.canonical.y||t.canonical.x-h.canonical.x}function Zt(h){return h==="raster"||h==="image"||h==="video"}Qi.maxOverzooming=10,Qi.maxUnderzooming=3;const Pt="mapboxgl_preloaded_worker_pool";class Gr{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<Gr.workerCount;)this.workers.push(new Worker(l.c.WORKER_URL));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach(n=>{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Pt]}numActive(){return Object.keys(this.active).length}}const sa=Math.floor(l.h.hardwareConcurrency/2);let an;function ls(){return an||(an=new Gr),an}Gr.workerCount=l.ac(globalThis)?Math.max(Math.min(sa,3),1):1;class oa{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let s=1;s<this.points.length;s++)this._distances[s]=this._distances[s-1]+this.points[s].dist(this.points[s-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(t){if(this.points.length===1)return this.points[0];t=l.ad(t,0,1);let n=1,s=this._distances[n];const c=t*this.paddedLength+this.padding;for(;s<c&&n<this._distances.length;)s=this._distances[++n];const p=n-1,g=this._distances[p],_=s-g,b=_>0?(c-g)/_:0;return this.points[p].mult(1-b).add(this.points[n].mult(b))}}function In(h,t){let n=!0;return h==="always"||h!=="never"&&t!=="never"||(n=!1),n}class Nn{constructor(t,n,s){const c=this.boxCells=[],p=this.circleCells=[];this.xCellCount=Math.ceil(t/s),this.yCellCount=Math.ceil(n/s);for(let g=0;g<this.xCellCount*this.yCellCount;g++)c.push([]),p.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=n,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,n,s,c,p){this._forEachCell(n,s,c,p,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(s),this.bboxes.push(c),this.bboxes.push(p)}insertCircle(t,n,s,c){this._forEachCell(n-c,s-c,n+c,s+c,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(s),this.circles.push(c)}_insertBoxCell(t,n,s,c,p,g){this.boxCells[p].push(g)}_insertCircleCell(t,n,s,c,p,g){this.circleCells[p].push(g)}_query(t,n,s,c,p,g,_){if(s<0||t>this.width||c<0||n>this.height)return[];const b=[];if(t<=0&&n<=0&&this.width<=s&&this.height<=c){if(p)return[{key:null,x1:t,y1:n,x2:s,y2:c}];for(let S=0;S<this.boxKeys.length;S++)b.push({key:this.boxKeys[S],x1:this.bboxes[4*S],y1:this.bboxes[4*S+1],x2:this.bboxes[4*S+2],y2:this.bboxes[4*S+3]});for(let S=0;S<this.circleKeys.length;S++){const I=this.circles[3*S],C=this.circles[3*S+1],L=this.circles[3*S+2];b.push({key:this.circleKeys[S],x1:I-L,y1:C-L,x2:I+L,y2:C+L})}}else this._forEachCell(t,n,s,c,this._queryCell,b,{hitTest:p,overlapMode:g,seenUids:{box:{},circle:{}}},_);return b}query(t,n,s,c){return this._query(t,n,s,c,!1,null)}hitTest(t,n,s,c,p,g){return this._query(t,n,s,c,!0,p,g).length>0}hitTestCircle(t,n,s,c,p){const g=t-s,_=t+s,b=n-s,S=n+s;if(_<0||g>this.width||S<0||b>this.height)return!1;const I=[];return this._forEachCell(g,b,_,S,this._queryCellCircle,I,{hitTest:!0,overlapMode:c,circle:{x:t,y:n,radius:s},seenUids:{box:{},circle:{}}},p),I.length>0}_queryCell(t,n,s,c,p,g,_,b){const{seenUids:S,hitTest:I,overlapMode:C}=_,L=this.boxCells[p];if(L!==null){const N=this.bboxes;for(const j of L)if(!S.box[j]){S.box[j]=!0;const F=4*j,ee=this.boxKeys[j];if(t<=N[F+2]&&n<=N[F+3]&&s>=N[F+0]&&c>=N[F+1]&&(!b||b(ee))&&(!I||!In(C,ee.overlapMode))&&(g.push({key:ee,x1:N[F],y1:N[F+1],x2:N[F+2],y2:N[F+3]}),I))return!0}}const U=this.circleCells[p];if(U!==null){const N=this.circles;for(const j of U)if(!S.circle[j]){S.circle[j]=!0;const F=3*j,ee=this.circleKeys[j];if(this._circleAndRectCollide(N[F],N[F+1],N[F+2],t,n,s,c)&&(!b||b(ee))&&(!I||!In(C,ee.overlapMode))){const se=N[F],W=N[F+1],te=N[F+2];if(g.push({key:ee,x1:se-te,y1:W-te,x2:se+te,y2:W+te}),I)return!0}}}return!1}_queryCellCircle(t,n,s,c,p,g,_,b){const{circle:S,seenUids:I,overlapMode:C}=_,L=this.boxCells[p];if(L!==null){const N=this.bboxes;for(const j of L)if(!I.box[j]){I.box[j]=!0;const F=4*j,ee=this.boxKeys[j];if(this._circleAndRectCollide(S.x,S.y,S.radius,N[F+0],N[F+1],N[F+2],N[F+3])&&(!b||b(ee))&&!In(C,ee.overlapMode))return g.push(!0),!0}}const U=this.circleCells[p];if(U!==null){const N=this.circles;for(const j of U)if(!I.circle[j]){I.circle[j]=!0;const F=3*j,ee=this.circleKeys[j];if(this._circlesCollide(N[F],N[F+1],N[F+2],S.x,S.y,S.radius)&&(!b||b(ee))&&!In(C,ee.overlapMode))return g.push(!0),!0}}}_forEachCell(t,n,s,c,p,g,_,b){const S=this._convertToXCellCoord(t),I=this._convertToYCellCoord(n),C=this._convertToXCellCoord(s),L=this._convertToYCellCoord(c);for(let U=S;U<=C;U++)for(let N=I;N<=L;N++)if(p.call(this,t,n,s,c,this.xCellCount*N+U,g,_,b))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,n,s,c,p,g){const _=c-t,b=p-n,S=s+g;return S*S>_*_+b*b}_circleAndRectCollide(t,n,s,c,p,g,_){const b=(g-c)/2,S=Math.abs(t-(c+b));if(S>b+s)return!1;const I=(_-p)/2,C=Math.abs(n-(p+I));if(C>I+s)return!1;if(S<=b||C<=I)return!0;const L=S-b,U=C-I;return L*L+U*U<=s*s}}function Ie(h,t,n,s,c){const p=l.Z();return t?(l.a0(p,p,[1/c,1/c,1]),n||l.ae(p,p,s.angle)):l.a1(p,s.labelPlaneMatrix,h),p}function qr(h,t,n,s,c){if(t){const p=l.af(h);return l.a0(p,p,[c,c,1]),n||l.ae(p,p,-s.angle),p}return s.glCoordMatrix}function si(h,t,n){let s;n?(s=[h.x,h.y,n(h.x,h.y),1],l.ag(s,s,t)):(s=[h.x,h.y,0,1],G(s,s,t));const c=s[3];return{point:new l.P(s[0]/c,s[1]/c),signedDistanceFromCamera:c}}function Un(h,t){return .5+h/t*.5}function sn(h,t){const n=h[0]/h[3],s=h[1]/h[3];return n>=-t[0]&&n<=t[0]&&s>=-t[1]&&s<=t[1]}function Ce(h,t,n,s,c,p,g,_,b,S){const I=s?h.textSizeData:h.iconSizeData,C=l.ah(I,n.transform.zoom),L=[256/n.width*2+1,256/n.height*2+1],U=s?h.text.dynamicLayoutVertexArray:h.icon.dynamicLayoutVertexArray;U.clear();const N=h.lineVertexArray,j=s?h.text.placedSymbolArray:h.icon.placedSymbolArray,F=n.transform.width/n.transform.height;let ee=!1;for(let se=0;se<j.length;se++){const W=j.get(se);if(W.hidden||W.writingMode===l.ai.vertical&&!ee){B(W.numGlyphs,U);continue}let te;if(ee=!1,S?(te=[W.anchorX,W.anchorY,S(W.anchorX,W.anchorY),1],l.ag(te,te,t)):(te=[W.anchorX,W.anchorY,0,1],G(te,te,t)),!sn(te,L)){B(W.numGlyphs,U);continue}const ce=Un(n.transform.cameraToCenterDistance,te[3]),he=l.aj(I,C,W),fe=g?he/ce:he*ce,ve=new l.P(W.anchorX,W.anchorY),_e=si(ve,c,S).point,we={projections:{},offsets:{}},Fe=Zi(W,fe,!1,_,t,c,p,h.glyphOffsetArray,N,U,_e,ve,we,F,b,S);ee=Fe.useVertical,(Fe.notEnoughRoom||ee||Fe.needsFlipping&&Zi(W,fe,!0,_,t,c,p,h.glyphOffsetArray,N,U,_e,ve,we,F,b,S).notEnoughRoom)&&B(W.numGlyphs,U)}s?h.text.dynamicLayoutVertexBuffer.updateData(U):h.icon.dynamicLayoutVertexBuffer.updateData(U)}function dt(h,t,n,s,c,p,g,_,b,S,I,C,L){const U=_.glyphStartIndex+_.numGlyphs,N=_.lineStartIndex,j=_.lineStartIndex+_.lineLength,F=t.getoffsetX(_.glyphStartIndex),ee=t.getoffsetX(U-1),se=P(h*F,n,s,c,p,g,_.segment,N,j,b,S,I,C,L);if(!se)return null;const W=P(h*ee,n,s,c,p,g,_.segment,N,j,b,S,I,C,L);return W?{first:se,last:W}:null}function nt(h,t,n,s){return h===l.ai.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*s?{useVertical:!0}:(h===l.ai.vertical?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function Zi(h,t,n,s,c,p,g,_,b,S,I,C,L,U,N,j){const F=t/24,ee=h.lineOffsetX*F,se=h.lineOffsetY*F;let W;if(h.numGlyphs>1){const te=h.glyphStartIndex+h.numGlyphs,ce=h.lineStartIndex,he=h.lineStartIndex+h.lineLength,fe=dt(F,_,ee,se,n,I,C,h,b,p,L,N,j);if(!fe)return{notEnoughRoom:!0};const ve=si(fe.first.point,g,j).point,_e=si(fe.last.point,g,j).point;if(s&&!n){const we=nt(h.writingMode,ve,_e,U);if(we)return we}W=[fe.first];for(let we=h.glyphStartIndex+1;we<te-1;we++)W.push(P(F*_.getoffsetX(we),ee,se,n,I,C,h.segment,ce,he,b,p,L,N,j));W.push(fe.last)}else{if(s&&!n){const ce=si(C,c,j).point,he=h.lineStartIndex+h.segment+1,fe=new l.P(b.getx(he),b.gety(he)),ve=si(fe,c,j),_e=ve.signedDistanceFromCamera>0?ve.point:Zr(C,fe,ce,1,c,j),we=nt(h.writingMode,ce,_e,U);if(we)return we}const te=P(F*_.getoffsetX(h.glyphStartIndex),ee,se,n,I,C,h.segment,h.lineStartIndex,h.lineStartIndex+h.lineLength,b,p,L,N,j);if(!te)return{notEnoughRoom:!0};W=[te]}for(const te of W)l.ak(S,te.point,te.angle);return{}}function Zr(h,t,n,s,c,p){const g=si(h.add(h.sub(t)._unit()),c,p).point,_=n.sub(g);return n.add(_._mult(s/_.mag()))}function ot(h,t){const{projectionCache:n,lineVertexArray:s,labelPlaneMatrix:c,tileAnchorPoint:p,distanceFromAnchor:g,getElevation:_,previousVertex:b,direction:S,absOffsetX:I}=t;if(n.projections[h])return n.projections[h];const C=new l.P(s.getx(h),s.gety(h)),L=si(C,c,_);if(L.signedDistanceFromCamera>0)return n.projections[h]=L.point,L.point;const U=h-S;return Zr(g===0?p:new l.P(s.getx(U),s.gety(U)),C,b,I-g+1,c,_)}function on(h,t,n){return h._unit()._perp()._mult(t*n)}function $(h,t,n,s,c,p,g,_){const{projectionCache:b,direction:S}=_;if(b.offsets[h])return b.offsets[h];const I=n.add(t);if(h+S<s||h+S>=c)return b.offsets[h]=I,I;const C=ot(h+S,_),L=on(C.sub(n),g,S),U=n.add(L),N=C.add(L);return b.offsets[h]=l.al(p,I,U,N)||I,b.offsets[h]}function P(h,t,n,s,c,p,g,_,b,S,I,C,L,U){const N=s?h-t:h+t;let j=N>0?1:-1,F=0;s&&(j*=-1,F=Math.PI),j<0&&(F+=Math.PI);let ee,se,W=j>0?_+g:_+g+1,te=c,ce=c,he=0,fe=0;const ve=Math.abs(N),_e=[];let we;for(;he+fe<=ve;){if(W+=j,W<_||W>=b)return null;he+=fe,ce=te,se=ee;const Pe={projectionCache:C,lineVertexArray:S,labelPlaneMatrix:I,tileAnchorPoint:p,distanceFromAnchor:he,getElevation:U,previousVertex:ce,direction:j,absOffsetX:ve};if(te=ot(W,Pe),n===0)_e.push(ce),we=te.sub(ce);else{let Ke;const Ne=te.sub(ce);Ke=Ne.mag()===0?on(ot(W+j,Pe).sub(te),n,j):on(Ne,n,j),se||(se=ce.add(Ke)),ee=$(W,Ke,te,_,b,se,n,Pe),_e.push(se),we=ee.sub(se)}fe=we.mag()}const Fe=we._mult((ve-he)/fe)._add(se||ce),xt=F+Math.atan2(te.y-ce.y,te.x-ce.x);return _e.push(Fe),{point:Fe,angle:L?xt:0,path:_e}}const k=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function B(h,t){for(let n=0;n<h;n++){const s=t.length;t.resize(s+4),t.float32.set(k,3*s)}}function G(h,t,n){const s=t[0],c=t[1];return h[0]=n[0]*s+n[4]*c+n[12],h[1]=n[1]*s+n[5]*c+n[13],h[3]=n[3]*s+n[7]*c+n[15],h}const H=100;class ne{constructor(t,n=new Nn(t.width+200,t.height+200,25),s=new Nn(t.width+200,t.height+200,25)){this.transform=t,this.grid=n,this.ignoredGrid=s,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+H,this.screenBottomBoundary=t.height+H,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,n,s,c,p,g){const _=this.projectAndGetPerspectiveRatio(c,t.anchorPointX,t.anchorPointY,g),b=s*_.perspectiveRatio,S=t.x1*b+_.point.x,I=t.y1*b+_.point.y,C=t.x2*b+_.point.x,L=t.y2*b+_.point.y;return!this.isInsideGrid(S,I,C,L)||n!=="always"&&this.grid.hitTest(S,I,C,L,n,p)||_.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[S,I,C,L],offscreen:this.isOffscreen(S,I,C,L)}}placeCollisionCircles(t,n,s,c,p,g,_,b,S,I,C,L,U,N){const j=[],F=new l.P(n.anchorX,n.anchorY),ee=si(F,g,N),se=Un(this.transform.cameraToCenterDistance,ee.signedDistanceFromCamera),W=(I?p/se:p*se)/l.ap,te=si(F,_,N).point,ce=dt(W,c,n.lineOffsetX*W,n.lineOffsetY*W,!1,te,F,n,s,_,{projections:{},offsets:{}},!1,N);let he=!1,fe=!1,ve=!0;if(ce){const _e=.5*L*se+U,we=new l.P(-100,-100),Fe=new l.P(this.screenRightBoundary,this.screenBottomBoundary),xt=new oa,Pe=ce.first,Ke=ce.last;let Ne=[];for(let ht=Pe.path.length-1;ht>=1;ht--)Ne.push(Pe.path[ht]);for(let ht=1;ht<Ke.path.length;ht++)Ne.push(Ke.path[ht]);const Ut=2.5*_e;if(b){const ht=Ne.map(bt=>si(bt,b,N));Ne=ht.some(bt=>bt.signedDistanceFromCamera<=0)?[]:ht.map(bt=>bt.point)}let _t=[];if(Ne.length>0){const ht=Ne[0].clone(),bt=Ne[0].clone();for(let hi=1;hi<Ne.length;hi++)ht.x=Math.min(ht.x,Ne[hi].x),ht.y=Math.min(ht.y,Ne[hi].y),bt.x=Math.max(bt.x,Ne[hi].x),bt.y=Math.max(bt.y,Ne[hi].y);_t=ht.x>=we.x&&bt.x<=Fe.x&&ht.y>=we.y&&bt.y<=Fe.y?[Ne]:bt.x<we.x||ht.x>Fe.x||bt.y<we.y||ht.y>Fe.y?[]:l.am([Ne],we.x,we.y,Fe.x,Fe.y)}for(const ht of _t){xt.reset(ht,.25*_e);let bt=0;bt=xt.length<=.5*_e?1:Math.ceil(xt.paddedLength/Ut)+1;for(let hi=0;hi<bt;hi++){const Wt=hi/Math.max(bt-1,1),zi=xt.lerp(Wt),xi=zi.x+H,mi=zi.y+H;j.push(xi,mi,_e,0);const dr=xi-_e,Yt=mi-_e,Wr=xi+_e,Kr=mi+_e;if(ve=ve&&this.isOffscreen(dr,Yt,Wr,Kr),fe=fe||this.isInsideGrid(dr,Yt,Wr,Kr),t!=="always"&&this.grid.hitTestCircle(xi,mi,_e,t,C)&&(he=!0,!S))return{circles:[],offscreen:!1,collisionDetected:he}}}}return{circles:!S&&he||!fe||se<this.perspectiveRatioCutoff?[]:j,offscreen:ve,collisionDetected:he}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[];let s=1/0,c=1/0,p=-1/0,g=-1/0;for(const I of t){const C=new l.P(I.x+H,I.y+H);s=Math.min(s,C.x),c=Math.min(c,C.y),p=Math.max(p,C.x),g=Math.max(g,C.y),n.push(C)}const _=this.grid.query(s,c,p,g).concat(this.ignoredGrid.query(s,c,p,g)),b={},S={};for(const I of _){const C=I.key;if(b[C.bucketInstanceId]===void 0&&(b[C.bucketInstanceId]={}),b[C.bucketInstanceId][C.featureIndex])continue;const L=[new l.P(I.x1,I.y1),new l.P(I.x2,I.y1),new l.P(I.x2,I.y2),new l.P(I.x1,I.y2)];l.an(n,L)&&(b[C.bucketInstanceId][C.featureIndex]=!0,S[C.bucketInstanceId]===void 0&&(S[C.bucketInstanceId]=[]),S[C.bucketInstanceId].push(C.featureIndex))}return S}insertCollisionBox(t,n,s,c,p,g){(s?this.ignoredGrid:this.grid).insert({bucketInstanceId:c,featureIndex:p,collisionGroupID:g,overlapMode:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,s,c,p,g){const _=s?this.ignoredGrid:this.grid,b={bucketInstanceId:c,featureIndex:p,collisionGroupID:g,overlapMode:n};for(let S=0;S<t.length;S+=4)_.insertCircle(b,t[S],t[S+1],t[S+2])}projectAndGetPerspectiveRatio(t,n,s,c){let p;return c?(p=[n,s,c(n,s),1],l.ag(p,p,t)):(p=[n,s,0,1],G(p,p,t)),{point:new l.P((p[0]/p[3]+1)/2*this.transform.width+H,(-p[1]/p[3]+1)/2*this.transform.height+H),perspectiveRatio:.5+this.transform.cameraToCenterDistance/p[3]*.5}}isOffscreen(t,n,s,c){return s<H||t>=this.screenRightBoundary||c<H||n>this.screenBottomBoundary}isInsideGrid(t,n,s,c){return s>=0&&t<this.gridRightBoundary&&c>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=l.ao([]);return l.$(t,t,[-100,-100,0]),t}}function J(h,t,n){return t*(l.N/(h.tileSize*Math.pow(2,n-h.tileID.overscaledZ)))}class X{constructor(t,n,s,c){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):c&&s?1:0,this.placed=s}isHidden(){return this.opacity===0&&!this.placed}}class ie{constructor(t,n,s,c,p){this.text=new X(t?t.text:null,n,s,p),this.icon=new X(t?t.icon:null,n,c,p)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class pe{constructor(t,n,s){this.text=t,this.icon=n,this.skipFade=s}}class me{constructor(){this.invProjMatrix=l.Z(),this.viewportMatrix=l.Z(),this.circles=[]}}class ye{constructor(t,n,s,c,p){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=s,this.bucketIndex=c,this.tileID=p}}class qe{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const n=++this.maxGroupID;this.collisionGroups[t]={ID:n,predicate:s=>s.collisionGroupID===n}}return this.collisionGroups[t]}}function Je(h,t,n,s,c){const{horizontalAlign:p,verticalAlign:g}=l.au(h);return new l.P(-(p-.5)*t+s[0]*c,-(g-.5)*n+s[1]*c)}function Be(h,t,n,s,c,p){const{x1:g,x2:_,y1:b,y2:S,anchorPointX:I,anchorPointY:C}=h,L=new l.P(t,n);return s&&L._rotate(c?p:-p),{x1:g+L.x,y1:b+L.y,x2:_+L.x,y2:S+L.y,anchorPointX:I,anchorPointY:C}}class He{constructor(t,n,s,c,p){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new ne(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=s,this.retainedQueryData={},this.collisionGroups=new qe(c),this.collisionCircleArrays={},this.prevPlacement=p,p&&(p.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,s,c){const p=s.getBucket(n),g=s.latestFeatureIndex;if(!p||!g||n.id!==p.layerIds[0])return;const _=s.collisionBoxArray,b=p.layers[0].layout,S=Math.pow(2,this.transform.zoom-s.tileID.overscaledZ),I=s.tileSize/l.N,C=this.transform.calculatePosMatrix(s.tileID.toUnwrapped()),L=b.get("text-pitch-alignment")==="map",U=b.get("text-rotation-alignment")==="map",N=J(s,1,this.transform.zoom),j=Ie(C,L,U,this.transform,N);let F=null;if(L){const se=qr(C,L,U,this.transform,N);F=l.a1([],this.transform.labelPlaneMatrix,se)}this.retainedQueryData[p.bucketInstanceId]=new ye(p.bucketInstanceId,g,p.sourceLayerIndex,p.index,s.tileID);const ee={bucket:p,layout:b,posMatrix:C,textLabelPlaneMatrix:j,labelToScreenMatrix:F,scale:S,textPixelRatio:I,holdingForFade:s.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:l.ah(p.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(p.sourceID)};if(c)for(const se of p.sortKeyRanges){const{sortKey:W,symbolInstanceStart:te,symbolInstanceEnd:ce}=se;t.push({sortKey:W,symbolInstanceStart:te,symbolInstanceEnd:ce,parameters:ee})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:p.symbolInstances.length,parameters:ee})}attemptAnchorPlacement(t,n,s,c,p,g,_,b,S,I,C,L,U,N,j,F){const ee=l.aq[t.textAnchor],se=[t.textOffset0,t.textOffset1],W=Je(ee,s,c,se,p),te=this.collisionIndex.placeCollisionBox(Be(n,W.x,W.y,g,_,this.transform.angle),C,b,S,I.predicate,F);if((!j||this.collisionIndex.placeCollisionBox(Be(j,W.x,W.y,g,_,this.transform.angle),C,b,S,I.predicate,F).box.length!==0)&&te.box.length>0){let ce;if(this.prevPlacement&&this.prevPlacement.variableOffsets[L.crossTileID]&&this.prevPlacement.placements[L.crossTileID]&&this.prevPlacement.placements[L.crossTileID].text&&(ce=this.prevPlacement.variableOffsets[L.crossTileID].anchor),L.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[L.crossTileID]={textOffset:se,width:s,height:c,anchor:ee,textBoxScale:p,prevAnchor:ce},this.markUsedJustification(U,ee,L,N),U.allowVerticalPlacement&&(this.markUsedOrientation(U,N,L),this.placedOrientations[L.crossTileID]=N),{shift:W,placedGlyphBoxes:te}}}placeLayerBucketPart(t,n,s){const{bucket:c,layout:p,posMatrix:g,textLabelPlaneMatrix:_,labelToScreenMatrix:b,textPixelRatio:S,holdingForFade:I,collisionBoxArray:C,partiallyEvaluatedTextSize:L,collisionGroup:U}=t.parameters,N=p.get("text-optional"),j=p.get("icon-optional"),F=l.ar(p,"text-overlap","text-allow-overlap"),ee=F==="always",se=l.ar(p,"icon-overlap","icon-allow-overlap"),W=se==="always",te=p.get("text-rotation-alignment")==="map",ce=p.get("text-pitch-alignment")==="map",he=p.get("icon-text-fit")!=="none",fe=p.get("symbol-z-order")==="viewport-y",ve=ee&&(W||!c.hasIconData()||j),_e=W&&(ee||!c.hasTextData()||N);!c.collisionArrays&&C&&c.deserializeCollisionBoxes(C);const we=this.retainedQueryData[c.bucketInstanceId].tileID,Fe=this.terrain?(Pe,Ke)=>this.terrain.getElevation(we,Pe,Ke):null,xt=(Pe,Ke)=>{var Ne,Ut;if(n[Pe.crossTileID])return;if(I)return void(this.placements[Pe.crossTileID]=new pe(!1,!1,!1));let _t=!1,ht=!1,bt=!0,hi=null,Wt={box:null,offscreen:null},zi={box:null,offscreen:null},xi=null,mi=null,dr=null,Yt=0,Wr=0,Kr=0;Ke.textFeatureIndex?Yt=Ke.textFeatureIndex:Pe.useRuntimeCollisionCircles&&(Yt=Pe.featureIndex),Ke.verticalTextFeatureIndex&&(Wr=Ke.verticalTextFeatureIndex);const Ln=Ke.textBox;if(Ln){const Ui=ui=>{let bi=l.ai.horizontal;if(c.allowVerticalPlacement&&!ui&&this.prevPlacement){const ir=this.prevPlacement.placedOrientations[Pe.crossTileID];ir&&(this.placedOrientations[Pe.crossTileID]=ir,bi=ir,this.markUsedOrientation(c,bi,Pe))}return bi},Di=(ui,bi)=>{if(c.allowVerticalPlacement&&Pe.numVerticalGlyphVertices>0&&Ke.verticalTextBox){for(const ir of c.writingModes)if(ir===l.ai.vertical?(Wt=bi(),zi=Wt):Wt=ui(),Wt&&Wt.box&&Wt.box.length)break}else Wt=ui()},Wi=Pe.textAnchorOffsetStartIndex,Xn=Pe.textAnchorOffsetEndIndex;if(Xn===Wi){const ui=(bi,ir)=>{const pi=this.collisionIndex.placeCollisionBox(bi,F,S,g,U.predicate,Fe);return pi&&pi.box&&pi.box.length&&(this.markUsedOrientation(c,ir,Pe),this.placedOrientations[Pe.crossTileID]=ir),pi};Di(()=>ui(Ln,l.ai.horizontal),()=>{const bi=Ke.verticalTextBox;return c.allowVerticalPlacement&&Pe.numVerticalGlyphVertices>0&&bi?ui(bi,l.ai.vertical):{box:null,offscreen:null}}),Ui(Wt&&Wt.box&&Wt.box.length)}else{let ui=l.aq[(Ut=(Ne=this.prevPlacement)===null||Ne===void 0?void 0:Ne.variableOffsets[Pe.crossTileID])===null||Ut===void 0?void 0:Ut.anchor];const bi=(pi,Yn,Fs)=>{const uc=pi.x2-pi.x1,pc=pi.y2-pi.y1,Rh=Pe.textBoxScale,jo=he&&se==="never"?Yn:null;let Xr={box:[],offscreen:!1},Jn=F==="never"?1:2,Yr="never";ui&&Jn++;for(let Er=0;Er<Jn;Er++){for(let Jr=Wi;Jr<Xn;Jr++){const Go=c.textAnchorOffsets.get(Jr);if(ui&&Go.textAnchor!==ui)continue;const dn=this.attemptAnchorPlacement(Go,pi,uc,pc,Rh,te,ce,S,g,U,Yr,Pe,c,Fs,jo,Fe);if(dn&&(Xr=dn.placedGlyphBoxes,Xr&&Xr.box&&Xr.box.length))return _t=!0,hi=dn.shift,Xr}ui?ui=null:Yr=F}return Xr};Di(()=>bi(Ln,Ke.iconBox,l.ai.horizontal),()=>{const pi=Ke.verticalTextBox;return c.allowVerticalPlacement&&!(Wt&&Wt.box&&Wt.box.length)&&Pe.numVerticalGlyphVertices>0&&pi?bi(pi,Ke.verticalIconBox,l.ai.vertical):{box:null,offscreen:null}}),Wt&&(_t=Wt.box,bt=Wt.offscreen);const ir=Ui(Wt&&Wt.box);if(!_t&&this.prevPlacement){const pi=this.prevPlacement.variableOffsets[Pe.crossTileID];pi&&(this.variableOffsets[Pe.crossTileID]=pi,this.markUsedJustification(c,pi.anchor,Pe,ir))}}}if(xi=Wt,_t=xi&&xi.box&&xi.box.length>0,bt=xi&&xi.offscreen,Pe.useRuntimeCollisionCircles){const Ui=c.text.placedSymbolArray.get(Pe.centerJustifiedTextSymbolIndex),Di=l.aj(c.textSizeData,L,Ui),Wi=p.get("text-padding");mi=this.collisionIndex.placeCollisionCircles(F,Ui,c.lineVertexArray,c.glyphOffsetArray,Di,g,_,b,s,ce,U.predicate,Pe.collisionCircleDiameter,Wi,Fe),mi.circles.length&&mi.collisionDetected&&!s&&l.w("Collisions detected, but collision boxes are not shown"),_t=ee||mi.circles.length>0&&!mi.collisionDetected,bt=bt&&mi.offscreen}if(Ke.iconFeatureIndex&&(Kr=Ke.iconFeatureIndex),Ke.iconBox){const Ui=Di=>{const Wi=he&&hi?Be(Di,hi.x,hi.y,te,ce,this.transform.angle):Di;return this.collisionIndex.placeCollisionBox(Wi,se,S,g,U.predicate,Fe)};zi&&zi.box&&zi.box.length&&Ke.verticalIconBox?(dr=Ui(Ke.verticalIconBox),ht=dr.box.length>0):(dr=Ui(Ke.iconBox),ht=dr.box.length>0),bt=bt&&dr.offscreen}const Kn=N||Pe.numHorizontalGlyphVertices===0&&Pe.numVerticalGlyphVertices===0,ba=j||Pe.numIconVertices===0;if(Kn||ba?ba?Kn||(ht=ht&&_t):_t=ht&&_t:ht=_t=ht&&_t,_t&&xi&&xi.box&&this.collisionIndex.insertCollisionBox(xi.box,F,p.get("text-ignore-placement"),c.bucketInstanceId,zi&&zi.box&&Wr?Wr:Yt,U.ID),ht&&dr&&this.collisionIndex.insertCollisionBox(dr.box,se,p.get("icon-ignore-placement"),c.bucketInstanceId,Kr,U.ID),mi&&(_t&&this.collisionIndex.insertCollisionCircles(mi.circles,F,p.get("text-ignore-placement"),c.bucketInstanceId,Yt,U.ID),s)){const Ui=c.bucketInstanceId;let Di=this.collisionCircleArrays[Ui];Di===void 0&&(Di=this.collisionCircleArrays[Ui]=new me);for(let Wi=0;Wi<mi.circles.length;Wi+=4)Di.circles.push(mi.circles[Wi+0]),Di.circles.push(mi.circles[Wi+1]),Di.circles.push(mi.circles[Wi+2]),Di.circles.push(mi.collisionDetected?1:0)}if(Pe.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[Pe.crossTileID]=new pe(_t||ve,ht||_e,bt||c.justReloaded),n[Pe.crossTileID]=!0};if(fe){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Pe=c.getSortedSymbolIndexes(this.transform.angle);for(let Ke=Pe.length-1;Ke>=0;--Ke){const Ne=Pe[Ke];xt(c.symbolInstances.get(Ne),c.collisionArrays[Ne])}}else for(let Pe=t.symbolInstanceStart;Pe<t.symbolInstanceEnd;Pe++)xt(c.symbolInstances.get(Pe),c.collisionArrays[Pe]);if(s&&c.bucketInstanceId in this.collisionCircleArrays){const Pe=this.collisionCircleArrays[c.bucketInstanceId];l.as(Pe.invProjMatrix,g),Pe.viewportMatrix=this.collisionIndex.getViewportMatrix()}c.justReloaded=!1}markUsedJustification(t,n,s,c){let p;p=c===l.ai.vertical?s.verticalPlacedTextSymbolIndex:{left:s.leftJustifiedTextSymbolIndex,center:s.centerJustifiedTextSymbolIndex,right:s.rightJustifiedTextSymbolIndex}[l.at(n)];const g=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex,s.verticalPlacedTextSymbolIndex];for(const _ of g)_>=0&&(t.text.placedSymbolArray.get(_).crossTileID=p>=0&&_!==p?0:s.crossTileID)}markUsedOrientation(t,n,s){const c=n===l.ai.horizontal||n===l.ai.horizontalOnly?n:0,p=n===l.ai.vertical?n:0,g=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex];for(const _ of g)t.text.placedSymbolArray.get(_).placedOrientation=c;s.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).placedOrientation=p)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let s=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const c=n?n.symbolFadeChange(t):1,p=n?n.opacities:{},g=n?n.variableOffsets:{},_=n?n.placedOrientations:{};for(const b in this.placements){const S=this.placements[b],I=p[b];I?(this.opacities[b]=new ie(I,c,S.text,S.icon),s=s||S.text!==I.text.placed||S.icon!==I.icon.placed):(this.opacities[b]=new ie(null,c,S.text,S.icon,S.skipFade),s=s||S.text||S.icon)}for(const b in p){const S=p[b];if(!this.opacities[b]){const I=new ie(S,c,!1,!1);I.isHidden()||(this.opacities[b]=I,s=s||S.text.placed||S.icon.placed)}}for(const b in g)this.variableOffsets[b]||!this.opacities[b]||this.opacities[b].isHidden()||(this.variableOffsets[b]=g[b]);for(const b in _)this.placedOrientations[b]||!this.opacities[b]||this.opacities[b].isHidden()||(this.placedOrientations[b]=_[b]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");s?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const s={};for(const c of n){const p=c.getBucket(t);p&&c.latestFeatureIndex&&t.id===p.layerIds[0]&&this.updateBucketOpacities(p,s,c.collisionBoxArray)}}updateBucketOpacities(t,n,s){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const c=t.layers[0],p=c.layout,g=new ie(null,0,!1,!1,!0),_=p.get("text-allow-overlap"),b=p.get("icon-allow-overlap"),S=c._unevaluatedLayout.hasValue("text-variable-anchor")||c._unevaluatedLayout.hasValue("text-variable-anchor-offset"),I=p.get("text-rotation-alignment")==="map",C=p.get("text-pitch-alignment")==="map",L=p.get("icon-text-fit")!=="none",U=new ie(null,0,_&&(b||!t.hasIconData()||p.get("icon-optional")),b&&(_||!t.hasTextData()||p.get("text-optional")),!0);!t.collisionArrays&&s&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(s);const N=(j,F,ee)=>{for(let se=0;se<F/4;se++)j.opacityVertexArray.emplaceBack(ee);j.hasVisibleVertices=j.hasVisibleVertices||ee!==wr};for(let j=0;j<t.symbolInstances.length;j++){const F=t.symbolInstances.get(j),{numHorizontalGlyphVertices:ee,numVerticalGlyphVertices:se,crossTileID:W}=F;let te=this.opacities[W];n[W]?te=g:te||(te=U,this.opacities[W]=te),n[W]=!0;const ce=F.numIconVertices>0,he=this.placedOrientations[F.crossTileID],fe=he===l.ai.vertical,ve=he===l.ai.horizontal||he===l.ai.horizontalOnly;if(ee>0||se>0){const _e=ki(te.text);N(t.text,ee,fe?wr:_e),N(t.text,se,ve?wr:_e);const we=te.text.isHidden();[F.rightJustifiedTextSymbolIndex,F.centerJustifiedTextSymbolIndex,F.leftJustifiedTextSymbolIndex].forEach(Pe=>{Pe>=0&&(t.text.placedSymbolArray.get(Pe).hidden=we||fe?1:0)}),F.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(F.verticalPlacedTextSymbolIndex).hidden=we||ve?1:0);const Fe=this.variableOffsets[F.crossTileID];Fe&&this.markUsedJustification(t,Fe.anchor,F,he);const xt=this.placedOrientations[F.crossTileID];xt&&(this.markUsedJustification(t,"left",F,xt),this.markUsedOrientation(t,xt,F))}if(ce){const _e=ki(te.icon),we=!(L&&F.verticalPlacedIconSymbolIndex&&fe);F.placedIconSymbolIndex>=0&&(N(t.icon,F.numIconVertices,we?_e:wr),t.icon.placedSymbolArray.get(F.placedIconSymbolIndex).hidden=te.icon.isHidden()),F.verticalPlacedIconSymbolIndex>=0&&(N(t.icon,F.numVerticalIconVertices,we?wr:_e),t.icon.placedSymbolArray.get(F.verticalPlacedIconSymbolIndex).hidden=te.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const _e=t.collisionArrays[j];if(_e){let we=new l.P(0,0);if(_e.textBox||_e.verticalTextBox){let xt=!0;if(S){const Pe=this.variableOffsets[W];Pe?(we=Je(Pe.anchor,Pe.width,Pe.height,Pe.textOffset,Pe.textBoxScale),I&&we._rotate(C?this.transform.angle:-this.transform.angle)):xt=!1}_e.textBox&&at(t.textCollisionBox.collisionVertexArray,te.text.placed,!xt||fe,we.x,we.y),_e.verticalTextBox&&at(t.textCollisionBox.collisionVertexArray,te.text.placed,!xt||ve,we.x,we.y)}const Fe=!!(!ve&&_e.verticalIconBox);_e.iconBox&&at(t.iconCollisionBox.collisionVertexArray,te.icon.placed,Fe,L?we.x:0,L?we.y:0),_e.verticalIconBox&&at(t.iconCollisionBox.collisionVertexArray,te.icon.placed,!Fe,L?we.x:0,L?we.y:0)}}}if(t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);if(t.bucketInstanceId in this.collisionCircleArrays){const j=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=j.invProjMatrix,t.placementViewportMatrix=j.viewportMatrix,t.collisionCircleArray=j.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,n){const s=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*s>t}setStale(){this.stale=!0}}function at(h,t,n,s,c){h.emplaceBack(t?1:0,n?1:0,s||0,c||0),h.emplaceBack(t?1:0,n?1:0,s||0,c||0),h.emplaceBack(t?1:0,n?1:0,s||0,c||0),h.emplaceBack(t?1:0,n?1:0,s||0,c||0)}const Ft=Math.pow(2,25),$t=Math.pow(2,24),Et=Math.pow(2,17),At=Math.pow(2,16),Oi=Math.pow(2,9),Ht=Math.pow(2,8),yi=Math.pow(2,1);function ki(h){if(h.opacity===0&&!h.placed)return 0;if(h.opacity===1&&h.placed)return 4294967295;const t=h.placed?1:0,n=Math.floor(127*h.opacity);return n*Ft+t*$t+n*Et+t*At+n*Oi+t*Ht+n*yi+t}const wr=0;class Cl{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,n,s,c,p){const g=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(g,c,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,p())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,g.sort((_,b)=>_.sortKey-b.sortKey));this._currentPartIndex<g.length;)if(n.placeLayerBucketPart(g[this._currentPartIndex],this._seenCrossTileIDs,s),this._currentPartIndex++,p())return!0;return!1}}class la{constructor(t,n,s,c,p,g,_,b){this.placement=new He(t,n,g,_,b),this._currentPlacementIndex=s.length-1,this._forceFullPlacement=c,this._showCollisionBoxes=p,this._done=!1}isDone(){return this._done}continuePlacement(t,n,s){const c=l.h.now(),p=()=>!this._forceFullPlacement&&l.h.now()-c>2;for(;this._currentPlacementIndex>=0;){const g=n[t[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(g.type==="symbol"&&(!g.minzoom||g.minzoom<=_)&&(!g.maxzoom||g.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new Cl(g)),this._inProgressLayer.continuePlacement(s[g.source],this.placement,this._showCollisionBoxes,g,p))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const ca=512/l.N/2;class _h{constructor(t,n,s){this.tileID=t,this.bucketInstanceId=s,this._symbolsByKey={};const c=new Map;for(let p=0;p<n.length;p++){const g=n.get(p),_=g.key,b=c.get(_);b?b.push(g):c.set(_,[g])}for(const[p,g]of c){const _={positions:g.map(b=>({x:Math.floor(b.anchorX*ca),y:Math.floor(b.anchorY*ca)})),crossTileIDs:g.map(b=>b.crossTileID)};if(_.positions.length>128){const b=new l.av(_.positions.length,16,Uint16Array);for(const{x:S,y:I}of _.positions)b.add(S,I);b.finish(),delete _.positions,_.index=b}this._symbolsByKey[p]=_}}getScaledCoordinates(t,n){const{x:s,y:c,z:p}=this.tileID.canonical,{x:g,y:_,z:b}=n.canonical,S=ca/Math.pow(2,b-p),I=(_*l.N+t.anchorY)*S,C=c*l.N*ca;return{x:Math.floor((g*l.N+t.anchorX)*S-s*l.N*ca),y:Math.floor(I-C)}}findMatches(t,n,s){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<t.length;p++){const g=t.get(p);if(g.crossTileID)continue;const _=this._symbolsByKey[g.key];if(!_)continue;const b=this.getScaledCoordinates(g,n);if(_.index){const S=_.index.range(b.x-c,b.y-c,b.x+c,b.y+c).sort();for(const I of S){const C=_.crossTileIDs[I];if(!s[C]){s[C]=!0,g.crossTileID=C;break}}}else if(_.positions)for(let S=0;S<_.positions.length;S++){const I=_.positions[S],C=_.crossTileIDs[S];if(Math.abs(I.x-b.x)<=c&&Math.abs(I.y-b.y)<=c&&!s[C]){s[C]=!0,g.crossTileID=C;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:t})=>t)}}class Nt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class to{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const s in this.indexes){const c=this.indexes[s],p={};for(const g in c){const _=c[g];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+n),p[_.tileID.key]=_}this.indexes[s]=p}this.lng=t}addBucket(t,n,s){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let p=0;p<n.symbolInstances.length;p++)n.symbolInstances.get(p).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const c=this.usedCrossTileIDs[t.overscaledZ];for(const p in this.indexes){const g=this.indexes[p];if(Number(p)>t.overscaledZ)for(const _ in g){const b=g[_];b.tileID.isChildOf(t)&&b.findMatches(n.symbolInstances,t,c)}else{const _=g[t.scaledTo(Number(p)).key];_&&_.findMatches(n.symbolInstances,t,c)}}for(let p=0;p<n.symbolInstances.length;p++){const g=n.symbolInstances.get(p);g.crossTileID||(g.crossTileID=s.generate(),c[g.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new _h(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const s of n.getCrossTileIDsLists())for(const c of s)delete this.usedCrossTileIDs[t][c]}removeStaleBuckets(t){let n=!1;for(const s in this.indexes){const c=this.indexes[s];for(const p in c)t[c[p].bucketInstanceId]||(this.removeBucketCrossTileIDs(s,c[p]),delete c[p],n=!0)}return n}}class cs{constructor(){this.layerIndexes={},this.crossTileIDs=new Nt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,s){let c=this.layerIndexes[t.id];c===void 0&&(c=this.layerIndexes[t.id]=new to);let p=!1;const g={};c.handleWrapJump(s);for(const _ of n){const b=_.getBucket(t);b&&t.id===b.layerIds[0]&&(b.bucketInstanceId||(b.bucketInstanceId=++this.maxBucketInstanceId),c.addBucket(_.tileID,b,this.crossTileIDs)&&(p=!0),g[b.bucketInstanceId]=!0)}return c.removeStaleBuckets(g)&&(p=!0),p}pruneUnusedLayers(t){const n={};t.forEach(s=>{n[s]=!0});for(const s in this.layerIndexes)n[s]||delete this.layerIndexes[s]}}const Ni=(h,t)=>l.x(h,t&&t.filter(n=>n.identifier!=="source.canvas")),lr=l.F(l.ax,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),vh=l.F(l.ax,["setCenter","setZoom","setBearing","setPitch"]),Sr=l.aw();class Li extends l.E{constructor(t,n={}){super(),this.map=t,this.dispatcher=new gi(ls(),this,t._getMapId()),this.imageManager=new it,this.imageManager.setEventedParent(this),this.glyphManager=new Ot(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new vr(256,512),this.crossTileSymbolIndex=new cs,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new l.ay,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",l.az());const s=this;this._rtlTextPluginCallback=Li.registerForPluginStateChange(c=>{s.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:c.pluginStatus,pluginURL:c.pluginURL},(p,g)=>{if(l.aA(p),g&&g.every(_=>_))for(const _ in s.sourceCaches){const b=s.sourceCaches[_].getSource().type;b!=="vector"&&b!=="geojson"||s.sourceCaches[_].reload()}})}),this.on("data",c=>{if(c.dataType!=="source"||c.sourceDataType!=="metadata")return;const p=this.sourceCaches[c.sourceId];if(!p)return;const g=p.getSource();if(g&&g.vectorLayerIds)for(const _ in this._layers){const b=this._layers[_];b.source===g.id&&this._validateLayer(b)}})}loadURL(t,n={},s){this.fire(new l.k("dataloading",{dataType:"style"})),n.validate=typeof n.validate!="boolean"||n.validate;const c=this.map._requestManager.transformRequest(t,tt.Style);this._request=l.f(c,(p,g)=>{this._request=null,p?this.fire(new l.j(p)):g&&this._load(g,n,s)})}loadJSON(t,n={},s){this.fire(new l.k("dataloading",{dataType:"style"})),this._request=l.h.frame(()=>{this._request=null,n.validate=n.validate!==!1,this._load(t,n,s)})}loadEmpty(){this.fire(new l.k("dataloading",{dataType:"style"})),this._load(Sr,{validate:!1})}_load(t,n,s){var c;const p=n.transformStyle?n.transformStyle(s,t):t;if(!n.validate||!Ni(this,l.y(p))){this._loaded=!0,this.stylesheet=p;for(const g in p.sources)this.addSource(g,p.sources[g],{validate:!1});p.sprite?this._loadSprite(p.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(p.glyphs),this._createLayers(),this.light=new Mi(this.stylesheet.light),this.map.setTerrain((c=this.stylesheet.terrain)!==null&&c!==void 0?c:null),this.fire(new l.k("data",{dataType:"style"})),this.fire(new l.k("style.load"))}}_createLayers(){const t=l.aB(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",t),this._order=t.map(n=>n.id),this._layers={},this._serializedLayers=null;for(const n of t){const s=l.aC(n);s.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=s}}_loadSprite(t,n=!1,s=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=function(c,p,g,_){const b=Ve(c),S=b.length,I=g>1?"@2x":"",C={},L={},U={};for(const{id:N,url:j}of b){const F=p.transformRequest(p.normalizeSpriteURL(j,I,".json"),tt.SpriteJSON),ee=`${N}_${F.url}`;C[ee]=l.f(F,(te,ce)=>{delete C[ee],L[N]=ce,pt(_,L,U,te,S)});const se=p.transformRequest(p.normalizeSpriteURL(j,I,".png"),tt.SpriteImage),W=`${N}_${se.url}`;C[W]=ft.getImage(se,(te,ce)=>{delete C[W],U[N]=ce,pt(_,L,U,te,S)})}return{cancel(){for(const N of Object.values(C))N.cancel()}}}(t,this.map._requestManager,this.map.getPixelRatio(),(c,p)=>{if(this._spriteRequest=null,c)this.fire(new l.j(c));else if(p)for(const g in p){this._spritesImagesIds[g]=[];const _=this._spritesImagesIds[g]?this._spritesImagesIds[g].filter(b=>!(b in p)):[];for(const b of _)this.imageManager.removeImage(b),this._changedImages[b]=!0;for(const b in p[g]){const S=g==="default"?b:`${g}:${b}`;this._spritesImagesIds[g].push(S),S in this.imageManager.images?this.imageManager.updateImage(S,p[g][b],!1):this.imageManager.addImage(S,p[g][b]),n&&(this._changedImages[S]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new l.k("data",{dataType:"style"})),s&&s(c)})}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}_validateLayer(t){const n=this.sourceCaches[t.source];if(!n)return;const s=t.sourceLayer;if(!s)return;const c=n.getSource();(c.type==="geojson"||c.vectorLayerIds&&c.vectorLayerIds.indexOf(s)===-1)&&this.fire(new l.j(new Error(`Source layer "${s}" does not exist on source "${c.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t){const n=this._serializedAllLayers();if(!t||t.length===0)return Object.values(n);const s=[];for(const c of t)n[c]&&s.push(n[c]);return s}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const n=Object.keys(this._layers);for(const s of n){const c=this._layers[s];c.type!=="custom"&&(t[s]=c.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const n=this._changed;if(this._changed){const c=Object.keys(this._updatedLayers),p=Object.keys(this._removedLayers);(c.length||p.length)&&this._updateWorkerLayers(c,p);for(const g in this._updatedSources){const _=this._updatedSources[g];if(_==="reload")this._reloadSource(g);else{if(_!=="clear")throw new Error(`Invalid action ${_}`);this._clearSource(g)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const g in this._updatedPaintProps)this._layers[g].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const s={};for(const c in this.sourceCaches){const p=this.sourceCaches[c];s[c]=p.used,p.used=!1}for(const c of this._order){const p=this._layers[c];p.recalculate(t,this._availableImages),!p.isHidden(t.zoom)&&p.source&&(this.sourceCaches[p.source].used=!0)}for(const c in s){const p=this.sourceCaches[c];s[c]!==p.used&&p.fire(new l.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:c}))}this.light.recalculate(t),this.z=t.zoom,n&&this.fire(new l.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,n){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(t),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,n={}){this._checkLoaded();const s=this.serialize();if(t=n.transformStyle?n.transformStyle(s,t):t,Ni(this,l.y(t)))return!1;(t=l.aD(t)).layers=l.aB(t.layers);const c=l.aE(s,t).filter(g=>!(g.command in vh));if(c.length===0)return!1;const p=c.filter(g=>!(g.command in lr));if(p.length>0)throw new Error(`Unimplemented: ${p.map(g=>g.command).join(", ")}.`);for(const g of c)g.command!=="setTransition"&&this[g.command].apply(this,g.args);return this.stylesheet=t,this._serializedLayers=null,!0}addImage(t,n){if(this.getImage(t))return this.fire(new l.j(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(t,n){this.imageManager.updateImage(t,n)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new l.j(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,s={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" 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(l.y.source,`sources.${t}`,n,null,s))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const c=this.sourceCaches[t]=new Qi(t,n,this.dispatcher);c.style=this,c.setEventedParent(this,()=>({isSourceLoaded:c.loaded(),source:c.serialize(),sourceId:t})),c.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(const s in this._layers)if(this._layers[s].source===t)return this.fire(new l.j(new Error(`Source "${t}" cannot be removed while layer "${s}" is using it.`)));const n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new l.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,n){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const s=this.sourceCaches[t].getSource();if(s.type!=="geojson")throw new Error(`geojsonSource.type is ${s.type}, which is !== 'geojson`);s.setData(n),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,n,s={}){this._checkLoaded();const c=t.id;if(this.getLayer(c))return void this.fire(new l.j(new Error(`Layer "${c}" already exists on this map.`)));let p;if(t.type==="custom"){if(Ni(this,l.aF(t)))return;p=l.aC(t)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(c,t.source),t=l.aD(t),t=l.e(t,{source:c})),this._validate(l.y.layer,`layers.${c}`,t,{arrayIndex:-1},s))return;p=l.aC(t),this._validateLayer(p),p.setEventedParent(this,{layer:{id:c}})}const g=n?this._order.indexOf(n):this._order.length;if(n&&g===-1)this.fire(new l.j(new Error(`Cannot add layer "${c}" before non-existing layer "${n}".`)));else{if(this._order.splice(g,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.sourceCaches[p.source].pause())}this._updateLayer(p),p.onAdd&&p.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new l.j(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const s=this._order.indexOf(t);this._order.splice(s,1);const c=n?this._order.indexOf(n):this._order.length;n&&c===-1?this.fire(new l.j(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(c,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new l.j(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const s=this._order.indexOf(t);this._order.splice(s,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,s){this._checkLoaded();const c=this.getLayer(t);c?c.minzoom===n&&c.maxzoom===s||(n!=null&&(c.minzoom=n),s!=null&&(c.maxzoom=s),this._updateLayer(c)):this.fire(new l.j(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,s={}){this._checkLoaded();const c=this.getLayer(t);if(c){if(!l.aG(c.filter,n))return n==null?(c.filter=void 0,void this._updateLayer(c)):void(this._validate(l.y.filter,`layers.${c.id}.filter`,n,null,s)||(c.filter=l.aD(n),this._updateLayer(c)))}else this.fire(new l.j(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return l.aD(this.getLayer(t).filter)}setLayoutProperty(t,n,s,c={}){this._checkLoaded();const p=this.getLayer(t);p?l.aG(p.getLayoutProperty(n),s)||(p.setLayoutProperty(n,s,c),this._updateLayer(p)):this.fire(new l.j(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const s=this.getLayer(t);if(s)return s.getLayoutProperty(n);this.fire(new l.j(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,s,c={}){this._checkLoaded();const p=this.getLayer(t);p?l.aG(p.getPaintProperty(n),s)||(p.setPaintProperty(n,s,c)&&this._updateLayer(p),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new l.j(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const s=t.source,c=t.sourceLayer,p=this.sourceCaches[s];if(p===void 0)return void this.fire(new l.j(new Error(`The source '${s}' does not exist in the map's style.`)));const g=p.getSource().type;g==="geojson"&&c?this.fire(new l.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):g!=="vector"||c?(t.id===void 0&&this.fire(new l.j(new Error("The feature id parameter must be provided."))),p.setFeatureState(c,t.id,n)):this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const s=t.source,c=this.sourceCaches[s];if(c===void 0)return void this.fire(new l.j(new Error(`The source '${s}' does not exist in the map's style.`)));const p=c.getSource().type,g=p==="vector"?t.sourceLayer:void 0;p!=="vector"||g?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new l.j(new Error("A feature id is required to remove its specific state property."))):c.removeFeatureState(g,t.id,n):this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,s=t.sourceLayer,c=this.sourceCaches[n];if(c!==void 0)return c.getSource().type!=="vector"||s?(t.id===void 0&&this.fire(new l.j(new Error("The feature id parameter must be provided."))),c.getFeatureState(s,t.id)):void this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new l.j(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return l.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=l.aH(this.sourceCaches,p=>p.serialize()),n=this._serializeByIds(this._order),s=this.map.getTerrain()||void 0,c=this.stylesheet;return l.aI({version:c.version,name:c.name,metadata:c.metadata,light:c.light,center:c.center,zoom:c.zoom,bearing:c.bearing,pitch:c.pitch,sprite:c.sprite,glyphs:c.glyphs,transition:c.transition,sources:t,layers:n,terrain:s},p=>p!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const n=g=>this._layers[g].type==="fill-extrusion",s={},c=[];for(let g=this._order.length-1;g>=0;g--){const _=this._order[g];if(n(_)){s[_]=g;for(const b of t){const S=b[_];if(S)for(const I of S)c.push(I)}}}c.sort((g,_)=>_.intersectionZ-g.intersectionZ);const p=[];for(let g=this._order.length-1;g>=0;g--){const _=this._order[g];if(n(_))for(let b=c.length-1;b>=0;b--){const S=c[b].feature;if(s[S.layer.id]<g)break;p.push(S),c.pop()}else for(const b of t){const S=b[_];if(S)for(const I of S)p.push(I.feature)}}return p}queryRenderedFeatures(t,n,s){n&&n.filter&&this._validate(l.y.filter,"queryRenderedFeatures.filter",n.filter,null,n);const c={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new l.j(new Error("parameters.layers must be an Array."))),[];for(const _ of n.layers){const b=this._layers[_];if(!b)return this.fire(new l.j(new Error(`The layer '${_}' does not exist in the map's style and cannot be queried for features.`))),[];c[b.source]=!0}}const p=[];n.availableImages=this._availableImages;const g=this._serializedAllLayers();for(const _ in this.sourceCaches)n.layers&&!c[_]||p.push(Fn(this.sourceCaches[_],this._layers,g,t,n,s));return this.placement&&p.push(function(_,b,S,I,C,L,U){const N={},j=L.queryRenderedSymbols(I),F=[];for(const ee of Object.keys(j).map(Number))F.push(U[ee]);F.sort(Sn);for(const ee of F){const se=ee.featureIndex.lookupSymbolFeatures(j[ee.bucketInstanceId],b,ee.bucketIndex,ee.sourceLayerIndex,C.filter,C.layers,C.availableImages,_);for(const W in se){const te=N[W]=N[W]||[],ce=se[W];ce.sort((he,fe)=>{const ve=ee.featureSortOrder;if(ve){const _e=ve.indexOf(he.featureIndex);return ve.indexOf(fe.featureIndex)-_e}return fe.featureIndex-he.featureIndex});for(const he of ce)te.push(he)}}for(const ee in N)N[ee].forEach(se=>{const W=se.feature,te=S[_[ee].source].getFeatureState(W.layer["source-layer"],W.id);W.source=W.layer.source,W.layer["source-layer"]&&(W.sourceLayer=W.layer["source-layer"]),W.state=te});return N}(this._layers,g,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(p)}querySourceFeatures(t,n){n&&n.filter&&this._validate(l.y.filter,"querySourceFeatures.filter",n.filter,null,n);const s=this.sourceCaches[t];return s?function(c,p){const g=c.getRenderableIds().map(S=>c.getTileByID(S)),_=[],b={};for(let S=0;S<g.length;S++){const I=g[S],C=I.tileID.canonical.key;b[C]||(b[C]=!0,I.querySourceFeatures(_,p))}return _}(s,n):[]}addSourceType(t,n,s){return nn(t)?s(new Error(`A source type called "${t}" already exists.`)):(((c,p)=>{Ra[c]=p})(t,n),n.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:n.workerSourceURL},s):s(null,null))}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const s=this.light.getLight();let c=!1;for(const g in t)if(!l.aG(t[g],s[g])){c=!0;break}if(!c)return;const p={now:l.h.now(),transition:l.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(p)}_validate(t,n,s,c,p={}){return(!p||p.validate!==!1)&&Ni(this,t.call(l.y,l.e({key:n,style:this.serialize(),value:s,styleSpec:l.v},c)))}_remove(t=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),l.aJ.off("pluginStateChange",this._rtlTextPluginCallback);for(const n in this._layers)this._layers[n].setEventedParent(null);for(const n in this.sourceCaches){const s=this.sourceCaches[n];s.setEventedParent(null),s.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove(t)}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const n in this.sourceCaches)this.sourceCaches[n].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,n,s,c,p=!1){let g=!1,_=!1;const b={};for(const S of this._order){const I=this._layers[S];if(I.type!=="symbol")continue;if(!b[I.source]){const L=this.sourceCaches[I.source];b[I.source]=L.getRenderableIds(!0).map(U=>L.getTileByID(U)).sort((U,N)=>N.tileID.overscaledZ-U.tileID.overscaledZ||(U.tileID.isLessThan(N.tileID)?-1:1))}const C=this.crossTileSymbolIndex.addLayer(I,b[I.source],t.center.lng);g=g||C}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((p=p||this._layerOrderChanged||s===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(l.h.now(),t.zoom))&&(this.pauseablePlacement=new la(t,this.map.terrain,this._order,p,n,s,c,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,b),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(l.h.now()),_=!0),g&&this.pauseablePlacement.placement.setStale()),_||g)for(const S of this._order){const I=this._layers[S];I.type==="symbol"&&this.placement.updateLayerOpacities(I,b[I.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(l.h.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,n,s){this.imageManager.getImages(n.icons,s),this._updateTilesForChangedImages();const c=this.sourceCaches[n.source];c&&c.setDependencies(n.tileID.key,n.type,n.icons)}getGlyphs(t,n,s){this.glyphManager.getGlyphs(n.stacks,s);const c=this.sourceCaches[n.source];c&&c.setDependencies(n.tileID.key,n.type,[""])}getResource(t,n,s){return l.m(n,s)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,n={}){this._checkLoaded(),t&&this._validate(l.y.glyphs,"glyphs",t,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,n,s={},c){this._checkLoaded();const p=[{id:t,url:n}],g=[...Ve(this.stylesheet.sprite),...p];this._validate(l.y.sprite,"sprite",g,null,s)||(this.stylesheet.sprite=g,this._loadSprite(p,!0,c))}removeSprite(t){this._checkLoaded();const n=Ve(this.stylesheet.sprite);if(n.find(s=>s.id===t)){if(this._spritesImagesIds[t])for(const s of this._spritesImagesIds[t])this.imageManager.removeImage(s),this._changedImages[s]=!0;n.splice(n.findIndex(s=>s.id===t),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}else this.fire(new l.j(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return Ve(this.stylesheet.sprite)}setSprite(t,n={},s){this._checkLoaded(),t&&this._validate(l.y.sprite,"sprite",t,null,n)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,s):(this._unloadSprite(),s&&s(null)))}}Li.registerForPluginStateChange=l.aK;var hs=l.Q([{name:"a_pos",type:"Int16",components:2}]),ha="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";const ti={prelude:kt(`#ifdef GL_ES
|
|
3
3
|
precision mediump float;
|
|
4
4
|
#else
|
|
5
5
|
#if !defined(lowp)
|
|
@@ -54,15 +54,15 @@ vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=frac
|
|
|
54
54
|
#else
|
|
55
55
|
return 0.0;
|
|
56
56
|
#endif
|
|
57
|
-
}`),background:
|
|
57
|
+
}`),background:kt(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
|
|
58
58
|
#ifdef OVERDRAW_INSPECTOR
|
|
59
59
|
gl_FragColor=vec4(1.0);
|
|
60
60
|
#endif
|
|
61
|
-
}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:
|
|
61
|
+
}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:kt(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;
|
|
62
62
|
#ifdef OVERDRAW_INSPECTOR
|
|
63
63
|
gl_FragColor=vec4(1.0);
|
|
64
64
|
#endif
|
|
65
|
-
}`,"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:
|
|
65
|
+
}`,"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:kt(`varying vec3 v_data;varying float v_visibility;
|
|
66
66
|
#pragma mapbox: define highp vec4 color
|
|
67
67
|
#pragma mapbox: define mediump float radius
|
|
68
68
|
#pragma mapbox: define lowp float blur
|
|
@@ -98,7 +98,7 @@ void main(void) {
|
|
|
98
98
|
#pragma mapbox: initialize highp vec4 stroke_color
|
|
99
99
|
#pragma mapbox: initialize mediump float stroke_width
|
|
100
100
|
#pragma mapbox: initialize lowp float stroke_opacity
|
|
101
|
-
vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:
|
|
101
|
+
vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:kt("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:kt(`uniform highp float u_intensity;varying vec2 v_extrude;
|
|
102
102
|
#pragma mapbox: define highp float weight
|
|
103
103
|
#define GAUSS_COEF 0.3989422804014327
|
|
104
104
|
void main() {
|
|
@@ -115,11 +115,11 @@ const highp float ZERO=1.0/255.0/16.0;
|
|
|
115
115
|
void main(void) {
|
|
116
116
|
#pragma mapbox: initialize highp float weight
|
|
117
117
|
#pragma mapbox: initialize mediump float radius
|
|
118
|
-
vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`),heatmapTexture:
|
|
118
|
+
vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`),heatmapTexture:kt(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;
|
|
119
119
|
#ifdef OVERDRAW_INSPECTOR
|
|
120
120
|
gl_FragColor=vec4(0.0);
|
|
121
121
|
#endif
|
|
122
|
-
}`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:
|
|
122
|
+
}`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:kt("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:kt("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:kt("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:kt(`#pragma mapbox: define highp vec4 color
|
|
123
123
|
#pragma mapbox: define lowp float opacity
|
|
124
124
|
void main() {
|
|
125
125
|
#pragma mapbox: initialize highp vec4 color
|
|
@@ -134,7 +134,7 @@ gl_FragColor=vec4(1.0);
|
|
|
134
134
|
void main() {
|
|
135
135
|
#pragma mapbox: initialize highp vec4 color
|
|
136
136
|
#pragma mapbox: initialize lowp float opacity
|
|
137
|
-
gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:
|
|
137
|
+
gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:kt(`varying vec2 v_pos;
|
|
138
138
|
#pragma mapbox: define highp vec4 outline_color
|
|
139
139
|
#pragma mapbox: define lowp float opacity
|
|
140
140
|
void main() {
|
|
@@ -150,7 +150,7 @@ gl_FragColor=vec4(1.0);
|
|
|
150
150
|
void main() {
|
|
151
151
|
#pragma mapbox: initialize highp vec4 outline_color
|
|
152
152
|
#pragma mapbox: initialize lowp float opacity
|
|
153
|
-
gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:
|
|
153
|
+
gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:kt(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
|
|
154
154
|
#pragma mapbox: define lowp float opacity
|
|
155
155
|
#pragma mapbox: define lowp vec4 pattern_from
|
|
156
156
|
#pragma mapbox: define lowp vec4 pattern_to
|
|
@@ -174,7 +174,7 @@ void main() {
|
|
|
174
174
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
175
175
|
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
176
176
|
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
177
|
-
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:
|
|
177
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:kt(`#ifdef GL_ES
|
|
178
178
|
precision highp float;
|
|
179
179
|
#endif
|
|
180
180
|
uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
|
|
@@ -201,7 +201,7 @@ void main() {
|
|
|
201
201
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
202
202
|
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
203
203
|
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
204
|
-
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:
|
|
204
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:kt(`varying vec4 v_color;void main() {gl_FragColor=v_color;
|
|
205
205
|
#ifdef OVERDRAW_INSPECTOR
|
|
206
206
|
gl_FragColor=vec4(1.0);
|
|
207
207
|
#endif
|
|
@@ -223,7 +223,7 @@ float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_off
|
|
|
223
223
|
#else
|
|
224
224
|
float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
|
|
225
225
|
#endif
|
|
226
|
-
base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:
|
|
226
|
+
base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:kt(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
|
|
227
227
|
#pragma mapbox: define lowp float base
|
|
228
228
|
#pragma mapbox: define lowp float height
|
|
229
229
|
#pragma mapbox: define lowp vec4 pattern_from
|
|
@@ -267,20 +267,20 @@ float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
|
|
|
267
267
|
#endif
|
|
268
268
|
base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
|
|
269
269
|
? a_pos
|
|
270
|
-
: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:
|
|
270
|
+
: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:kt(`#ifdef GL_ES
|
|
271
271
|
precision highp float;
|
|
272
272
|
#endif
|
|
273
273
|
uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);
|
|
274
274
|
#ifdef OVERDRAW_INSPECTOR
|
|
275
275
|
gl_FragColor=vec4(1.0);
|
|
276
276
|
#endif
|
|
277
|
-
}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:
|
|
277
|
+
}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:kt(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
|
|
278
278
|
#define PI 3.141592653589793
|
|
279
279
|
void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;
|
|
280
280
|
#ifdef OVERDRAW_INSPECTOR
|
|
281
281
|
gl_FragColor=vec4(1.0);
|
|
282
282
|
#endif
|
|
283
|
-
}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:
|
|
283
|
+
}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:kt(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
|
|
284
284
|
#pragma mapbox: define highp vec4 color
|
|
285
285
|
#pragma mapbox: define lowp float blur
|
|
286
286
|
#pragma mapbox: define lowp float opacity
|
|
@@ -314,7 +314,7 @@ v_gamma_scale=1.0;
|
|
|
314
314
|
#else
|
|
315
315
|
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
316
316
|
#endif
|
|
317
|
-
v_width2=vec2(outset,inset);}`),lineGradient:
|
|
317
|
+
v_width2=vec2(outset,inset);}`),lineGradient:kt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;
|
|
318
318
|
#pragma mapbox: define lowp float blur
|
|
319
319
|
#pragma mapbox: define lowp float opacity
|
|
320
320
|
void main() {
|
|
@@ -344,7 +344,7 @@ v_gamma_scale=1.0;
|
|
|
344
344
|
#else
|
|
345
345
|
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
346
346
|
#endif
|
|
347
|
-
v_width2=vec2(outset,inset);}`),linePattern:
|
|
347
|
+
v_width2=vec2(outset,inset);}`),linePattern:kt(`#ifdef GL_ES
|
|
348
348
|
precision highp float;
|
|
349
349
|
#endif
|
|
350
350
|
uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
|
|
@@ -396,7 +396,7 @@ v_gamma_scale=1.0;
|
|
|
396
396
|
#else
|
|
397
397
|
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
398
398
|
#endif
|
|
399
|
-
v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:
|
|
399
|
+
v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:kt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
|
|
400
400
|
#pragma mapbox: define highp vec4 color
|
|
401
401
|
#pragma mapbox: define lowp float blur
|
|
402
402
|
#pragma mapbox: define lowp float opacity
|
|
@@ -437,11 +437,11 @@ v_gamma_scale=1.0;
|
|
|
437
437
|
#else
|
|
438
438
|
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
439
439
|
#endif
|
|
440
|
-
v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:
|
|
440
|
+
v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:kt(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
|
|
441
441
|
#ifdef OVERDRAW_INSPECTOR
|
|
442
442
|
gl_FragColor=vec4(1.0);
|
|
443
443
|
#endif
|
|
444
|
-
}`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:
|
|
444
|
+
}`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:kt(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
|
|
445
445
|
#pragma mapbox: define lowp float opacity
|
|
446
446
|
void main() {
|
|
447
447
|
#pragma mapbox: initialize lowp float opacity
|
|
@@ -455,7 +455,7 @@ void main() {
|
|
|
455
455
|
#pragma mapbox: initialize lowp float opacity
|
|
456
456
|
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
457
457
|
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
458
|
-
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:
|
|
458
|
+
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:kt(`#define SDF_PX 8.0
|
|
459
459
|
uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;
|
|
460
460
|
#pragma mapbox: define highp vec4 fill_color
|
|
461
461
|
#pragma mapbox: define highp vec4 halo_color
|
|
@@ -486,7 +486,7 @@ void main() {
|
|
|
486
486
|
#pragma mapbox: initialize lowp float halo_blur
|
|
487
487
|
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
488
488
|
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
489
|
-
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:
|
|
489
|
+
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:kt(`#define SDF_PX 8.0
|
|
490
490
|
#define SDF 1.0
|
|
491
491
|
#define ICON 0.0
|
|
492
492
|
uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;
|
|
@@ -523,60 +523,60 @@ void main() {
|
|
|
523
523
|
#pragma mapbox: initialize lowp float halo_blur
|
|
524
524
|
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
525
525
|
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
526
|
-
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:
|
|
526
|
+
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:kt("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",ha),terrainDepth:kt("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}",ha),terrainCoords:kt("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",ha)};function kt(h,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,s=t.match(/attribute ([\w]+) ([\w]+)/g),c=h.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),p=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),g=p?p.concat(c):c,_={};return{fragmentSource:h=h.replace(n,(b,S,I,C,L)=>(_[L]=!0,S==="define"?`
|
|
527
527
|
#ifndef HAS_UNIFORM_u_${L}
|
|
528
|
-
varying ${I} ${
|
|
528
|
+
varying ${I} ${C} ${L};
|
|
529
529
|
#else
|
|
530
|
-
uniform ${I} ${
|
|
530
|
+
uniform ${I} ${C} u_${L};
|
|
531
531
|
#endif
|
|
532
532
|
`:`
|
|
533
533
|
#ifdef HAS_UNIFORM_u_${L}
|
|
534
|
-
${I} ${
|
|
534
|
+
${I} ${C} ${L} = u_${L};
|
|
535
535
|
#endif
|
|
536
|
-
`)),vertexSource:t=t.replace(n,(
|
|
536
|
+
`)),vertexSource:t=t.replace(n,(b,S,I,C,L)=>{const U=C==="float"?"vec2":"vec4",N=L.match(/color/)?"color":U;return _[L]?S==="define"?`
|
|
537
537
|
#ifndef HAS_UNIFORM_u_${L}
|
|
538
538
|
uniform lowp float u_${L}_t;
|
|
539
539
|
attribute ${I} ${U} a_${L};
|
|
540
|
-
varying ${I} ${
|
|
540
|
+
varying ${I} ${C} ${L};
|
|
541
541
|
#else
|
|
542
|
-
uniform ${I} ${
|
|
542
|
+
uniform ${I} ${C} u_${L};
|
|
543
543
|
#endif
|
|
544
544
|
`:N==="vec4"?`
|
|
545
545
|
#ifndef HAS_UNIFORM_u_${L}
|
|
546
546
|
${L} = a_${L};
|
|
547
547
|
#else
|
|
548
|
-
${I} ${
|
|
548
|
+
${I} ${C} ${L} = u_${L};
|
|
549
549
|
#endif
|
|
550
550
|
`:`
|
|
551
551
|
#ifndef HAS_UNIFORM_u_${L}
|
|
552
552
|
${L} = unpack_mix_${N}(a_${L}, u_${L}_t);
|
|
553
553
|
#else
|
|
554
|
-
${I} ${
|
|
554
|
+
${I} ${C} ${L} = u_${L};
|
|
555
555
|
#endif
|
|
556
556
|
`:S==="define"?`
|
|
557
557
|
#ifndef HAS_UNIFORM_u_${L}
|
|
558
558
|
uniform lowp float u_${L}_t;
|
|
559
559
|
attribute ${I} ${U} a_${L};
|
|
560
560
|
#else
|
|
561
|
-
uniform ${I} ${
|
|
561
|
+
uniform ${I} ${C} u_${L};
|
|
562
562
|
#endif
|
|
563
563
|
`:N==="vec4"?`
|
|
564
564
|
#ifndef HAS_UNIFORM_u_${L}
|
|
565
|
-
${I} ${
|
|
565
|
+
${I} ${C} ${L} = a_${L};
|
|
566
566
|
#else
|
|
567
|
-
${I} ${
|
|
567
|
+
${I} ${C} ${L} = u_${L};
|
|
568
568
|
#endif
|
|
569
569
|
`:`
|
|
570
570
|
#ifndef HAS_UNIFORM_u_${L}
|
|
571
|
-
${I} ${
|
|
571
|
+
${I} ${C} ${L} = unpack_mix_${N}(a_${L}, u_${L}_t);
|
|
572
572
|
#else
|
|
573
|
-
${I} ${
|
|
573
|
+
${I} ${C} ${L} = u_${L};
|
|
574
574
|
#endif
|
|
575
|
-
`}),staticAttributes:s,staticUniforms:g}}class
|
|
575
|
+
`}),staticAttributes:s,staticUniforms:g}}class Vn{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,n,s,c,p,g,_,b,S){this.context=t;let I=this.boundPaintVertexBuffers.length!==c.length;for(let C=0;!I&&C<c.length;C++)this.boundPaintVertexBuffers[C]!==c[C]&&(I=!0);!this.vao||this.boundProgram!==n||this.boundLayoutVertexBuffer!==s||I||this.boundIndexBuffer!==p||this.boundVertexOffset!==g||this.boundDynamicVertexBuffer!==_||this.boundDynamicVertexBuffer2!==b||this.boundDynamicVertexBuffer3!==S?this.freshBind(n,s,c,p,g,_,b,S):(t.bindVertexArray.set(this.vao),_&&_.bind(),p&&p.dynamicDraw&&p.bind(),b&&b.bind(),S&&S.bind())}freshBind(t,n,s,c,p,g,_,b){const S=t.numAttributes,I=this.context,C=I.gl;this.vao&&this.destroy(),this.vao=I.createVertexArray(),I.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=s,this.boundIndexBuffer=c,this.boundVertexOffset=p,this.boundDynamicVertexBuffer=g,this.boundDynamicVertexBuffer2=_,this.boundDynamicVertexBuffer3=b,n.enableAttributes(C,t);for(const L of s)L.enableAttributes(C,t);g&&g.enableAttributes(C,t),_&&_.enableAttributes(C,t),b&&b.enableAttributes(C,t),n.bind(),n.setVertexAttribPointers(C,t,p);for(const L of s)L.bind(),L.setVertexAttribPointers(C,t,p);g&&(g.bind(),g.setVertexAttribPointers(C,t,p)),c&&c.bind(),_&&(_.bind(),_.setVertexAttribPointers(C,t,p)),b&&(b.bind(),b.setVertexAttribPointers(C,t,p)),I.currentNumAttributes=S}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}function oi(h){const t=[];for(let n=0;n<h.length;n++){if(h[n]===null)continue;const s=h[n].split(" ");t.push(s.pop())}return t}class us{constructor(t,n,s,c,p,g){const _=t.gl;this.program=_.createProgram();const b=oi(n.staticAttributes),S=s?s.getBinderAttributes():[],I=b.concat(S),C=ti.prelude.staticUniforms?oi(ti.prelude.staticUniforms):[],L=n.staticUniforms?oi(n.staticUniforms):[],U=s?s.getBinderUniforms():[],N=C.concat(L).concat(U),j=[];for(const he of N)j.indexOf(he)<0&&j.push(he);const F=s?s.defines():[];p&&F.push("#define OVERDRAW_INSPECTOR;"),g&&F.push("#define TERRAIN3D;");const ee=F.concat(ti.prelude.fragmentSource,n.fragmentSource).join(`
|
|
576
576
|
`),se=F.concat(ti.prelude.vertexSource,n.vertexSource).join(`
|
|
577
|
-
`),Z=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);if(y.shaderSource(Z,Q),y.compileShader(Z),!y.getShaderParameter(Z,y.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${y.getShaderInfoLog(Z)}`);y.attachShader(this.program,Z);const ee=y.createShader(y.VERTEX_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);if(y.shaderSource(ee,se),y.compileShader(ee),!y.getShaderParameter(ee,y.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${y.getShaderInfoLog(ee)}`);y.attachShader(this.program,ee),this.attributes={};const le={};this.numAttributes=I.length;for(let ce=0;ce<this.numAttributes;ce++)I[ce]&&(y.bindAttribLocation(this.program,ce,I[ce]),this.attributes[I[ce]]=ce);if(y.linkProgram(this.program),!y.getProgramParameter(this.program,y.LINK_STATUS))throw new Error(`Program failed to link: ${y.getProgramInfoLog(this.program)}`);y.deleteShader(ee),y.deleteShader(Z);for(let ce=0;ce<$.length;ce++){const me=$[ce];if(me&&!le[me]){const ve=y.getUniformLocation(this.program,me);ve&&(le[me]=ve)}}this.fixedUniforms=c(t,le),this.terrainUniforms=((ce,me)=>({u_depth:new l.aL(ce,me.u_depth),u_terrain:new l.aL(ce,me.u_terrain),u_terrain_dim:new l.aM(ce,me.u_terrain_dim),u_terrain_matrix:new l.aN(ce,me.u_terrain_matrix),u_terrain_unpack:new l.aO(ce,me.u_terrain_unpack),u_terrain_exaggeration:new l.aM(ce,me.u_terrain_exaggeration)}))(t,le),this.binderUniforms=s?s.getUniforms(t,le):[]}draw(t,n,s,c,p,g,y,x,S,I,A,L,U,N,$,F,Q,se){const Z=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(s),t.setStencilMode(c),t.setColorMode(p),t.setCullFace(g),x){t.activeTexture.set(Z.TEXTURE2),Z.bindTexture(Z.TEXTURE_2D,x.depthTexture),t.activeTexture.set(Z.TEXTURE3),Z.bindTexture(Z.TEXTURE_2D,x.texture);for(const le in this.terrainUniforms)this.terrainUniforms[le].set(x[le])}for(const le in this.fixedUniforms)this.fixedUniforms[le].set(y[le]);$&&$.setUniforms(t,this.binderUniforms,U,{zoom:N});let ee=0;switch(n){case Z.LINES:ee=2;break;case Z.TRIANGLES:ee=3;break;case Z.LINE_STRIP:ee=1}for(const le of L.get()){const ce=le.vaos||(le.vaos={});(ce[S]||(ce[S]=new On)).bind(t,this,I,$?$.getPaintVertexBuffers():[],A,le.vertexOffset,F,Q,se),Z.drawElements(n,le.primitiveLength*ee,Z.UNSIGNED_SHORT,le.primitiveOffset*ee*2)}}}function Tr(h,t,n){const s=1/J(n,1,t.transform.tileZoom),c=Math.pow(2,n.tileID.overscaledZ),p=n.tileSize*Math.pow(2,t.transform.tileZoom)/c,g=p*(n.tileID.canonical.x+n.tileID.wrap*c),y=p*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[s,h.fromScale,h.toScale],u_fade:h.t,u_pixel_coord_upper:[g>>16,y>>16],u_pixel_coord_lower:[65535&g,65535&y]}}const Qs=(h,t,n,s)=>{const c=t.style.light,p=c.properties.get("position"),g=[p.x,p.y,p.z],y=function(){var S=new l.A(9);return l.A!=Float32Array&&(S[1]=0,S[2]=0,S[3]=0,S[5]=0,S[6]=0,S[7]=0),S[0]=1,S[4]=1,S[8]=1,S}();c.properties.get("anchor")==="viewport"&&function(S,I){var A=Math.sin(I),L=Math.cos(I);S[0]=L,S[1]=A,S[2]=0,S[3]=-A,S[4]=L,S[5]=0,S[6]=0,S[7]=0,S[8]=1}(y,-t.transform.angle),function(S,I,A){var L=I[0],U=I[1],N=I[2];S[0]=L*A[0]+U*A[3]+N*A[6],S[1]=L*A[1]+U*A[4]+N*A[7],S[2]=L*A[2]+U*A[5]+N*A[8]}(g,g,y);const x=c.properties.get("color");return{u_matrix:h,u_lightpos:g,u_lightintensity:c.properties.get("intensity"),u_lightcolor:[x.r,x.g,x.b],u_vertical_gradient:+n,u_opacity:s}},Sn=(h,t,n,s,c,p,g)=>l.e(Qs(h,t,n,s),Tr(p,t,g),{u_height_factor:-Math.pow(2,c.overscaledZ)/g.tileSize/8}),Tl=h=>({u_matrix:h}),eo=(h,t,n,s)=>l.e(Tl(h),Tr(n,t,s)),us=(h,t)=>({u_matrix:h,u_world:t}),ps=(h,t,n,s,c)=>l.e(eo(h,t,n,s),{u_world:c}),Tn=(h,t,n,s)=>{const c=h.transform;let p,g;if(s.paint.get("circle-pitch-alignment")==="map"){const y=J(n,1,c.zoom);p=!0,g=[y,y]}else p=!1,g=c.pixelsToGLUnits;return{u_camera_to_center_distance:c.cameraToCenterDistance,u_scale_with_map:+(s.paint.get("circle-pitch-scale")==="map"),u_matrix:h.translatePosMatrix(t.posMatrix,n,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_pitch_with_map:+p,u_device_pixel_ratio:h.pixelRatio,u_extrude_scale:g}},to=(h,t,n)=>{const s=J(n,1,t.zoom),c=Math.pow(2,t.zoom-n.tileID.overscaledZ),p=n.tileID.overscaleFactor();return{u_matrix:h,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:s,u_extrude_scale:[t.pixelsToGLUnits[0]/(s*c),t.pixelsToGLUnits[1]/(s*c)],u_overscale_factor:p}},Ra=(h,t,n=1)=>({u_matrix:h,u_color:t,u_overlay:0,u_overlay_scale:n}),Il=h=>({u_matrix:h}),sh=(h,t,n,s)=>({u_matrix:h,u_extrude_scale:J(t,1,n),u_intensity:s});function io(h,t){const n=Math.pow(2,t.canonical.z),s=t.canonical.y;return[new l.U(0,s/n).toLngLat().lat,new l.U(0,(s+1)/n).toLngLat().lat]}const ro=(h,t,n,s)=>{const c=h.transform;return{u_matrix:ds(h,t,n,s),u_ratio:1/J(t,1,c.zoom),u_device_pixel_ratio:h.pixelRatio,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]]}},Al=(h,t,n,s,c)=>l.e(ro(h,t,n,c),{u_image:0,u_image_height:s}),oh=(h,t,n,s,c)=>{const p=h.transform,g=El(t,p);return{u_matrix:ds(h,t,n,c),u_texsize:t.imageAtlasTexture.size,u_ratio:1/J(t,1,p.zoom),u_device_pixel_ratio:h.pixelRatio,u_image:0,u_scale:[g,s.fromScale,s.toScale],u_fade:s.t,u_units_to_pixels:[1/p.pixelsToGLUnits[0],1/p.pixelsToGLUnits[1]]}},Cl=(h,t,n,s,c,p)=>{const g=h.lineAtlas,y=El(t,h.transform),x=n.layout.get("line-cap")==="round",S=g.getDash(s.from,x),I=g.getDash(s.to,x),A=S.width*c.fromScale,L=I.width*c.toScale;return l.e(ro(h,t,n,p),{u_patternscale_a:[y/A,-S.height/2],u_patternscale_b:[y/L,-I.height/2],u_sdfgamma:g.width/(256*Math.min(A,L)*h.pixelRatio)/2,u_image:0,u_tex_y_a:S.y,u_tex_y_b:I.y,u_mix:c.t})};function El(h,t){return 1/J(h,1,t.tileZoom)}function ds(h,t,n,s){return h.translatePosMatrix(s?s.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const Pl=(h,t,n,s,c)=>{return{u_matrix:h,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:s.mix,u_opacity:s.opacity*c.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:c.paint.get("raster-brightness-min"),u_brightness_high:c.paint.get("raster-brightness-max"),u_saturation_factor:(g=c.paint.get("raster-saturation"),g>0?1-1/(1.001-g):-g),u_contrast_factor:(p=c.paint.get("raster-contrast"),p>0?1/(1-p):1+p),u_spin_weights:kl(c.paint.get("raster-hue-rotate"))};var p,g};function kl(h){h*=Math.PI/180;const t=Math.sin(h),n=Math.cos(h);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const no=(h,t,n,s,c,p,g,y,x,S)=>{const I=c.transform;return{u_is_size_zoom_constant:+(h==="constant"||h==="source"),u_is_size_feature_constant:+(h==="constant"||h==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:I.cameraToCenterDistance,u_pitch:I.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:I.width/I.height,u_fade_change:c.options.fadeDuration?c.symbolFadeChange:1,u_matrix:p,u_label_plane_matrix:g,u_coord_matrix:y,u_is_text:+x,u_pitch_with_map:+s,u_texsize:S,u_texture:0}},ao=(h,t,n,s,c,p,g,y,x,S,I)=>{const A=c.transform;return l.e(no(h,t,n,s,c,p,g,y,x,S),{u_gamma_scale:s?Math.cos(A._pitch)*A.cameraToCenterDistance:1,u_device_pixel_ratio:c.pixelRatio,u_is_halo:+I})},Nn=(h,t,n,s,c,p,g,y,x,S)=>l.e(ao(h,t,n,s,c,p,g,y,!0,x,!0),{u_texsize_icon:S,u_texture_icon:1}),ms=(h,t,n)=>({u_matrix:h,u_opacity:t,u_color:n}),Ir=(h,t,n,s,c,p)=>l.e(function(g,y,x,S){const I=x.imageManager.getPattern(g.from.toString()),A=x.imageManager.getPattern(g.to.toString()),{width:L,height:U}=x.imageManager.getPixelSize(),N=Math.pow(2,S.tileID.overscaledZ),$=S.tileSize*Math.pow(2,x.transform.tileZoom)/N,F=$*(S.tileID.canonical.x+S.tileID.wrap*N),Q=$*S.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:I.tl,u_pattern_br_a:I.br,u_pattern_tl_b:A.tl,u_pattern_br_b:A.br,u_texsize:[L,U],u_mix:y.t,u_pattern_size_a:I.displaySize,u_pattern_size_b:A.displaySize,u_scale_a:y.fromScale,u_scale_b:y.toScale,u_tile_units_to_pixels:1/J(S,1,x.transform.tileZoom),u_pixel_coord_upper:[F>>16,Q>>16],u_pixel_coord_lower:[65535&F,65535&Q]}}(s,p,n,c),{u_matrix:h,u_opacity:t}),fs={fillExtrusion:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_lightpos:new l.aP(h,t.u_lightpos),u_lightintensity:new l.aM(h,t.u_lightintensity),u_lightcolor:new l.aP(h,t.u_lightcolor),u_vertical_gradient:new l.aM(h,t.u_vertical_gradient),u_opacity:new l.aM(h,t.u_opacity)}),fillExtrusionPattern:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_lightpos:new l.aP(h,t.u_lightpos),u_lightintensity:new l.aM(h,t.u_lightintensity),u_lightcolor:new l.aP(h,t.u_lightcolor),u_vertical_gradient:new l.aM(h,t.u_vertical_gradient),u_height_factor:new l.aM(h,t.u_height_factor),u_image:new l.aL(h,t.u_image),u_texsize:new l.aQ(h,t.u_texsize),u_pixel_coord_upper:new l.aQ(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.aQ(h,t.u_pixel_coord_lower),u_scale:new l.aP(h,t.u_scale),u_fade:new l.aM(h,t.u_fade),u_opacity:new l.aM(h,t.u_opacity)}),fill:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix)}),fillPattern:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_image:new l.aL(h,t.u_image),u_texsize:new l.aQ(h,t.u_texsize),u_pixel_coord_upper:new l.aQ(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.aQ(h,t.u_pixel_coord_lower),u_scale:new l.aP(h,t.u_scale),u_fade:new l.aM(h,t.u_fade)}),fillOutline:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_world:new l.aQ(h,t.u_world)}),fillOutlinePattern:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_world:new l.aQ(h,t.u_world),u_image:new l.aL(h,t.u_image),u_texsize:new l.aQ(h,t.u_texsize),u_pixel_coord_upper:new l.aQ(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.aQ(h,t.u_pixel_coord_lower),u_scale:new l.aP(h,t.u_scale),u_fade:new l.aM(h,t.u_fade)}),circle:(h,t)=>({u_camera_to_center_distance:new l.aM(h,t.u_camera_to_center_distance),u_scale_with_map:new l.aL(h,t.u_scale_with_map),u_pitch_with_map:new l.aL(h,t.u_pitch_with_map),u_extrude_scale:new l.aQ(h,t.u_extrude_scale),u_device_pixel_ratio:new l.aM(h,t.u_device_pixel_ratio),u_matrix:new l.aN(h,t.u_matrix)}),collisionBox:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_camera_to_center_distance:new l.aM(h,t.u_camera_to_center_distance),u_pixels_to_tile_units:new l.aM(h,t.u_pixels_to_tile_units),u_extrude_scale:new l.aQ(h,t.u_extrude_scale),u_overscale_factor:new l.aM(h,t.u_overscale_factor)}),collisionCircle:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_inv_matrix:new l.aN(h,t.u_inv_matrix),u_camera_to_center_distance:new l.aM(h,t.u_camera_to_center_distance),u_viewport_size:new l.aQ(h,t.u_viewport_size)}),debug:(h,t)=>({u_color:new l.aR(h,t.u_color),u_matrix:new l.aN(h,t.u_matrix),u_overlay:new l.aL(h,t.u_overlay),u_overlay_scale:new l.aM(h,t.u_overlay_scale)}),clippingMask:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix)}),heatmap:(h,t)=>({u_extrude_scale:new l.aM(h,t.u_extrude_scale),u_intensity:new l.aM(h,t.u_intensity),u_matrix:new l.aN(h,t.u_matrix)}),heatmapTexture:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_world:new l.aQ(h,t.u_world),u_image:new l.aL(h,t.u_image),u_color_ramp:new l.aL(h,t.u_color_ramp),u_opacity:new l.aM(h,t.u_opacity)}),hillshade:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_image:new l.aL(h,t.u_image),u_latrange:new l.aQ(h,t.u_latrange),u_light:new l.aQ(h,t.u_light),u_shadow:new l.aR(h,t.u_shadow),u_highlight:new l.aR(h,t.u_highlight),u_accent:new l.aR(h,t.u_accent)}),hillshadePrepare:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_image:new l.aL(h,t.u_image),u_dimension:new l.aQ(h,t.u_dimension),u_zoom:new l.aM(h,t.u_zoom),u_unpack:new l.aO(h,t.u_unpack)}),line:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_ratio:new l.aM(h,t.u_ratio),u_device_pixel_ratio:new l.aM(h,t.u_device_pixel_ratio),u_units_to_pixels:new l.aQ(h,t.u_units_to_pixels)}),lineGradient:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_ratio:new l.aM(h,t.u_ratio),u_device_pixel_ratio:new l.aM(h,t.u_device_pixel_ratio),u_units_to_pixels:new l.aQ(h,t.u_units_to_pixels),u_image:new l.aL(h,t.u_image),u_image_height:new l.aM(h,t.u_image_height)}),linePattern:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_texsize:new l.aQ(h,t.u_texsize),u_ratio:new l.aM(h,t.u_ratio),u_device_pixel_ratio:new l.aM(h,t.u_device_pixel_ratio),u_image:new l.aL(h,t.u_image),u_units_to_pixels:new l.aQ(h,t.u_units_to_pixels),u_scale:new l.aP(h,t.u_scale),u_fade:new l.aM(h,t.u_fade)}),lineSDF:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_ratio:new l.aM(h,t.u_ratio),u_device_pixel_ratio:new l.aM(h,t.u_device_pixel_ratio),u_units_to_pixels:new l.aQ(h,t.u_units_to_pixels),u_patternscale_a:new l.aQ(h,t.u_patternscale_a),u_patternscale_b:new l.aQ(h,t.u_patternscale_b),u_sdfgamma:new l.aM(h,t.u_sdfgamma),u_image:new l.aL(h,t.u_image),u_tex_y_a:new l.aM(h,t.u_tex_y_a),u_tex_y_b:new l.aM(h,t.u_tex_y_b),u_mix:new l.aM(h,t.u_mix)}),raster:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_tl_parent:new l.aQ(h,t.u_tl_parent),u_scale_parent:new l.aM(h,t.u_scale_parent),u_buffer_scale:new l.aM(h,t.u_buffer_scale),u_fade_t:new l.aM(h,t.u_fade_t),u_opacity:new l.aM(h,t.u_opacity),u_image0:new l.aL(h,t.u_image0),u_image1:new l.aL(h,t.u_image1),u_brightness_low:new l.aM(h,t.u_brightness_low),u_brightness_high:new l.aM(h,t.u_brightness_high),u_saturation_factor:new l.aM(h,t.u_saturation_factor),u_contrast_factor:new l.aM(h,t.u_contrast_factor),u_spin_weights:new l.aP(h,t.u_spin_weights)}),symbolIcon:(h,t)=>({u_is_size_zoom_constant:new l.aL(h,t.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aL(h,t.u_is_size_feature_constant),u_size_t:new l.aM(h,t.u_size_t),u_size:new l.aM(h,t.u_size),u_camera_to_center_distance:new l.aM(h,t.u_camera_to_center_distance),u_pitch:new l.aM(h,t.u_pitch),u_rotate_symbol:new l.aL(h,t.u_rotate_symbol),u_aspect_ratio:new l.aM(h,t.u_aspect_ratio),u_fade_change:new l.aM(h,t.u_fade_change),u_matrix:new l.aN(h,t.u_matrix),u_label_plane_matrix:new l.aN(h,t.u_label_plane_matrix),u_coord_matrix:new l.aN(h,t.u_coord_matrix),u_is_text:new l.aL(h,t.u_is_text),u_pitch_with_map:new l.aL(h,t.u_pitch_with_map),u_texsize:new l.aQ(h,t.u_texsize),u_texture:new l.aL(h,t.u_texture)}),symbolSDF:(h,t)=>({u_is_size_zoom_constant:new l.aL(h,t.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aL(h,t.u_is_size_feature_constant),u_size_t:new l.aM(h,t.u_size_t),u_size:new l.aM(h,t.u_size),u_camera_to_center_distance:new l.aM(h,t.u_camera_to_center_distance),u_pitch:new l.aM(h,t.u_pitch),u_rotate_symbol:new l.aL(h,t.u_rotate_symbol),u_aspect_ratio:new l.aM(h,t.u_aspect_ratio),u_fade_change:new l.aM(h,t.u_fade_change),u_matrix:new l.aN(h,t.u_matrix),u_label_plane_matrix:new l.aN(h,t.u_label_plane_matrix),u_coord_matrix:new l.aN(h,t.u_coord_matrix),u_is_text:new l.aL(h,t.u_is_text),u_pitch_with_map:new l.aL(h,t.u_pitch_with_map),u_texsize:new l.aQ(h,t.u_texsize),u_texture:new l.aL(h,t.u_texture),u_gamma_scale:new l.aM(h,t.u_gamma_scale),u_device_pixel_ratio:new l.aM(h,t.u_device_pixel_ratio),u_is_halo:new l.aL(h,t.u_is_halo)}),symbolTextAndIcon:(h,t)=>({u_is_size_zoom_constant:new l.aL(h,t.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aL(h,t.u_is_size_feature_constant),u_size_t:new l.aM(h,t.u_size_t),u_size:new l.aM(h,t.u_size),u_camera_to_center_distance:new l.aM(h,t.u_camera_to_center_distance),u_pitch:new l.aM(h,t.u_pitch),u_rotate_symbol:new l.aL(h,t.u_rotate_symbol),u_aspect_ratio:new l.aM(h,t.u_aspect_ratio),u_fade_change:new l.aM(h,t.u_fade_change),u_matrix:new l.aN(h,t.u_matrix),u_label_plane_matrix:new l.aN(h,t.u_label_plane_matrix),u_coord_matrix:new l.aN(h,t.u_coord_matrix),u_is_text:new l.aL(h,t.u_is_text),u_pitch_with_map:new l.aL(h,t.u_pitch_with_map),u_texsize:new l.aQ(h,t.u_texsize),u_texsize_icon:new l.aQ(h,t.u_texsize_icon),u_texture:new l.aL(h,t.u_texture),u_texture_icon:new l.aL(h,t.u_texture_icon),u_gamma_scale:new l.aM(h,t.u_gamma_scale),u_device_pixel_ratio:new l.aM(h,t.u_device_pixel_ratio),u_is_halo:new l.aL(h,t.u_is_halo)}),background:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_opacity:new l.aM(h,t.u_opacity),u_color:new l.aR(h,t.u_color)}),backgroundPattern:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_opacity:new l.aM(h,t.u_opacity),u_image:new l.aL(h,t.u_image),u_pattern_tl_a:new l.aQ(h,t.u_pattern_tl_a),u_pattern_br_a:new l.aQ(h,t.u_pattern_br_a),u_pattern_tl_b:new l.aQ(h,t.u_pattern_tl_b),u_pattern_br_b:new l.aQ(h,t.u_pattern_br_b),u_texsize:new l.aQ(h,t.u_texsize),u_mix:new l.aM(h,t.u_mix),u_pattern_size_a:new l.aQ(h,t.u_pattern_size_a),u_pattern_size_b:new l.aQ(h,t.u_pattern_size_b),u_scale_a:new l.aM(h,t.u_scale_a),u_scale_b:new l.aM(h,t.u_scale_b),u_pixel_coord_upper:new l.aQ(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.aQ(h,t.u_pixel_coord_lower),u_tile_units_to_pixels:new l.aM(h,t.u_tile_units_to_pixels)}),terrain:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_texture:new l.aL(h,t.u_texture),u_ele_delta:new l.aM(h,t.u_ele_delta)}),terrainDepth:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_ele_delta:new l.aM(h,t.u_ele_delta)}),terrainCoords:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_texture:new l.aL(h,t.u_texture),u_terrain_coords_id:new l.aM(h,t.u_terrain_coords_id),u_ele_delta:new l.aM(h,t.u_ele_delta)})};class gs{constructor(t,n,s){this.context=t;const c=t.gl;this.buffer=c.createBuffer(),this.dynamicDraw=!!s,this.context.unbindVAO(),t.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(t){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,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ba={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class ys{constructor(t,n,s,c){this.length=n.length,this.attributes=s,this.itemSize=n.bytesPerElement,this.dynamicDraw=c,this.context=t;const p=t.gl;this.buffer=p.createBuffer(),t.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(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let s=0;s<this.attributes.length;s++){const c=n.attributes[this.attributes[s].name];c!==void 0&&t.enableVertexAttribArray(c)}}setVertexAttribPointers(t,n,s){for(let c=0;c<this.attributes.length;c++){const p=this.attributes[c],g=n.attributes[p.name];g!==void 0&&t.vertexAttribPointer(g,p.components,t[Ba[p.type]],!1,this.itemSize,p.offset+this.itemSize*(s||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const ha=new WeakMap;function In(h){var t;if(ha.has(h))return ha.get(h);{const n=(t=h.getParameter(h.VERSION))===null||t===void 0?void 0:t.startsWith("WebGL 2.0");return ha.set(h,n),n}}class vt{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class _s extends vt{getDefault(){return l.aT.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class lr extends vt{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class cr extends vt{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class so extends vt{getDefault(){return[!0,!0,!0,!0]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class vs extends vt{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class xs extends vt{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class oo extends vt{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const n=this.current;(t.func!==n.func||t.ref!==n.ref||t.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class lo extends vt{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class bs extends vt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=t,this.dirty=!1}}class co extends vt{getDefault(){return[0,1]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class ho extends vt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=t,this.dirty=!1}}class ws extends vt{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Ml extends vt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.BLEND):n.disable(n.BLEND),this.current=t,this.dirty=!1}}class Ll extends vt{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class ua extends vt{getDefault(){return l.aT.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class lh extends vt{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class ch extends vt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=t,this.dirty=!1}}class hh extends vt{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class uh extends vt{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class ph extends vt{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class dh extends vt{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class uo extends vt{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Ss extends vt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class po extends vt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class mo extends vt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class pa extends vt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class zl extends vt{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Dl extends vt{getDefault(){return null}set(t){var n;if(t===this.current&&!this.dirty)return;const s=this.gl;In(s)?s.bindVertexArray(t):(n=s.getExtension("OES_vertex_array_object"))===null||n===void 0||n.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class fo extends vt{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class Un extends vt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class Rl extends vt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class An extends vt{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class da extends An{setDirty(){this.dirty=!0}set(t){if(t===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,t,0),this.current=t,this.dirty=!1}}class Bl extends An{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class go extends An{set(t){if(t===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,t),this.current=t,this.dirty=!1}}class Pt{constructor(t,n,s,c,p){this.context=t,this.width=n,this.height=s;const g=t.gl,y=this.framebuffer=g.createFramebuffer();if(this.colorAttachment=new da(t,y),c)this.depthAttachment=p?new go(t,y):new Bl(t,y);else if(p)throw new Error("Stencil cannot be setted without depth");if(g.checkFramebufferStatus(g.FRAMEBUFFER)!==g.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const t=this.context.gl,n=this.colorAttachment.get();if(n&&t.deleteTexture(n),this.depthAttachment){const s=this.depthAttachment.get();s&&t.deleteRenderbuffer(s)}t.deleteFramebuffer(this.framebuffer)}}class ii{constructor(t,n,s){this.blendFunction=t,this.blendColor=n,this.mask=s}}ii.Replace=[1,0],ii.disabled=new ii(ii.Replace,l.aT.transparent,[!1,!1,!1,!1]),ii.unblended=new ii(ii.Replace,l.aT.transparent,[!0,!0,!0,!0]),ii.alphaBlended=new ii([1,771],l.aT.transparent,[!0,!0,!0,!0]);class mh{constructor(t){var n,s;if(this.gl=t,this.clearColor=new _s(this),this.clearDepth=new lr(this),this.clearStencil=new cr(this),this.colorMask=new so(this),this.depthMask=new vs(this),this.stencilMask=new xs(this),this.stencilFunc=new oo(this),this.stencilOp=new lo(this),this.stencilTest=new bs(this),this.depthRange=new co(this),this.depthTest=new ho(this),this.depthFunc=new ws(this),this.blend=new Ml(this),this.blendFunc=new Ll(this),this.blendColor=new ua(this),this.blendEquation=new lh(this),this.cullFace=new ch(this),this.cullFaceSide=new hh(this),this.frontFace=new uh(this),this.program=new ph(this),this.activeTexture=new dh(this),this.viewport=new uo(this),this.bindFramebuffer=new Ss(this),this.bindRenderbuffer=new po(this),this.bindTexture=new mo(this),this.bindVertexBuffer=new pa(this),this.bindElementBuffer=new zl(this),this.bindVertexArray=new Dl(this),this.pixelStoreUnpack=new fo(this),this.pixelStoreUnpackPremultiplyAlpha=new Un(this),this.pixelStoreUnpackFlipY=new Rl(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),In(t)){this.HALF_FLOAT=t.HALF_FLOAT;const c=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(n=t.RGBA16F)!==null&&n!==void 0?n:c?.RGBA16F_EXT,this.RGB16F=(s=t.RGB16F)!==null&&s!==void 0?s:c?.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const c=t.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(t,n){return new gs(this,t,n)}createVertexBuffer(t,n,s){return new ys(this,t,n,s)}createRenderbuffer(t,n,s){const c=this.gl,p=c.createRenderbuffer();return this.bindRenderbuffer.set(p),c.renderbufferStorage(c.RENDERBUFFER,t,n,s),this.bindRenderbuffer.set(null),p}createFramebuffer(t,n,s,c){return new Pt(this,t,n,s,c)}clear({color:t,depth:n,stencil:s}){const c=this.gl;let p=0;t&&(p|=c.COLOR_BUFFER_BIT,this.clearColor.set(t),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)),s!==void 0&&(p|=c.STENCIL_BUFFER_BIT,this.clearStencil.set(s),this.stencilMask.set(255)),c.clear(p)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){l.aG(t.blendFunction,ii.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){var t;return In(this.gl)?this.gl.createVertexArray():(t=this.gl.getExtension("OES_vertex_array_object"))===null||t===void 0?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var n;return In(this.gl)?this.gl.deleteVertexArray(t):(n=this.gl.getExtension("OES_vertex_array_object"))===null||n===void 0?void 0:n.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}class xt{constructor(t,n,s){this.func=t,this.mask=n,this.range=s}}xt.ReadOnly=!1,xt.ReadWrite=!0,xt.disabled=new xt(519,xt.ReadOnly,[0,1]);const Vn=7680;class ri{constructor(t,n,s,c,p,g){this.test=t,this.ref=n,this.mask=s,this.fail=c,this.depthFail=p,this.pass=g}}ri.disabled=new ri({func:519,mask:0},0,0,Vn,Vn,Vn);class Qt{constructor(t,n,s){this.enable=t,this.mode=n,this.frontFace=s}}let Fa;function Fl(h,t,n,s,c,p,g){const y=h.context,x=y.gl,S=h.useProgram("collisionBox"),I=[];let A=0,L=0;for(let Z=0;Z<s.length;Z++){const ee=s[Z],le=t.getTile(ee),ce=le.getBucket(n);if(!ce)continue;let me=ee.posMatrix;c[0]===0&&c[1]===0||(me=h.translatePosMatrix(ee.posMatrix,le,c,p));const ve=g?ce.textCollisionBox:ce.iconCollisionBox,_e=ce.collisionCircleArray;if(_e.length>0){const be=l.Z(),Fe=me;l.aU(be,ce.placementInvProjMatrix,h.transform.glCoordMatrix),l.aU(be,be,ce.placementViewportMatrix),I.push({circleArray:_e,circleOffset:L,transform:Fe,invTransform:be,coord:ee}),A+=_e.length/4,L=A}ve&&S.draw(y,x.LINES,xt.disabled,ri.disabled,h.colorModeForRenderPass(),Qt.disabled,to(me,h.transform,le),h.style.map.terrain&&h.style.map.terrain.getTerrainData(ee),n.id,ve.layoutVertexBuffer,ve.indexBuffer,ve.segments,null,h.transform.zoom,null,null,ve.collisionVertexBuffer)}if(!g||!I.length)return;const U=h.useProgram("collisionCircle"),N=new l.aV;N.resize(4*A),N._trim();let $=0;for(const Z of I)for(let ee=0;ee<Z.circleArray.length/4;ee++){const le=4*ee,ce=Z.circleArray[le+0],me=Z.circleArray[le+1],ve=Z.circleArray[le+2],_e=Z.circleArray[le+3];N.emplace($++,ce,me,ve,_e,0),N.emplace($++,ce,me,ve,_e,1),N.emplace($++,ce,me,ve,_e,2),N.emplace($++,ce,me,ve,_e,3)}(!Fa||Fa.length<2*A)&&(Fa=function(Z){const ee=2*Z,le=new l.aX;le.resize(ee),le._trim();for(let ce=0;ce<ee;ce++){const me=6*ce;le.uint16[me+0]=4*ce+0,le.uint16[me+1]=4*ce+1,le.uint16[me+2]=4*ce+2,le.uint16[me+3]=4*ce+2,le.uint16[me+4]=4*ce+3,le.uint16[me+5]=4*ce+0}return le}(A));const F=y.createIndexBuffer(Fa,!0),Q=y.createVertexBuffer(N,l.aW.members,!0);for(const Z of I){const ee={u_matrix:Z.transform,u_inv_matrix:Z.invTransform,u_camera_to_center_distance:(se=h.transform).cameraToCenterDistance,u_viewport_size:[se.width,se.height]};U.draw(y,x.TRIANGLES,xt.disabled,ri.disabled,h.colorModeForRenderPass(),Qt.disabled,ee,h.style.map.terrain&&h.style.map.terrain.getTerrainData(Z.coord),n.id,Q,F,l.S.simpleSegment(0,2*Z.circleOffset,Z.circleArray.length,Z.circleArray.length/2),null,h.transform.zoom,null,null,null)}var se;Q.destroy(),F.destroy()}Qt.disabled=new Qt(!1,1029,2305),Qt.backCCW=new Qt(!0,1029,2305);const yo=l.ao(new Float32Array(16));function Ts(h,t,n,s,c,p){const{horizontalAlign:g,verticalAlign:y}=l.au(h);return new l.P((-(g-.5)*t/c+s[0])*p,(-(y-.5)*n/c+s[1])*p)}function Is(h,t,n,s,c,p,g,y,x,S,I){const A=h.text.placedSymbolArray,L=h.text.dynamicLayoutVertexArray,U=h.icon.dynamicLayoutVertexArray,N={};L.clear();for(let $=0;$<A.length;$++){const F=A.get($),Q=F.hidden||!F.crossTileID||h.allowVerticalPlacement&&!F.placedOrientation?null:s[F.crossTileID];if(Q){const se=new l.P(F.anchorX,F.anchorY),Z=si(se,n?g:p,I),ee=Fn(c.cameraToCenterDistance,Z.signedDistanceFromCamera);let le=l.aj(h.textSizeData,x,F)*ee/l.ap;n&&(le*=h.tilePixelRatio/y);const{width:ce,height:me,anchor:ve,textOffset:_e,textBoxScale:be}=Q,Fe=Ts(ve,ce,me,_e,be,le),mt=n?si(se.add(Fe),p,I).point:Z.point.add(t?Fe.rotate(-c.angle):Fe),Ce=h.allowVerticalPlacement&&F.placedOrientation===l.ai.vertical?Math.PI/2:0;for(let He=0;He<F.numGlyphs;He++)l.ak(L,mt,Ce);S&&F.associatedIconIndex>=0&&(N[F.associatedIconIndex]={shiftedAnchor:mt,angle:Ce})}else R(F.numGlyphs,L)}if(S){U.clear();const $=h.icon.placedSymbolArray;for(let F=0;F<$.length;F++){const Q=$.get(F);if(Q.hidden)R(Q.numGlyphs,U);else{const se=N[F];if(se)for(let Z=0;Z<Q.numGlyphs;Z++)l.ak(U,se.shiftedAnchor,se.angle);else R(Q.numGlyphs,U)}}h.icon.dynamicLayoutVertexBuffer.updateData(U)}h.text.dynamicLayoutVertexBuffer.updateData(L)}function _o(h,t,n){return n.iconsInText&&t?"symbolTextAndIcon":h?"symbolSDF":"symbolIcon"}function As(h,t,n,s,c,p,g,y,x,S,I,A){const L=h.context,U=L.gl,N=h.transform,$=y==="map",F=x==="map",Q=y!=="viewport"&&n.layout.get("symbol-placement")!=="point",se=$&&!F&&!Q,Z=!n.layout.get("symbol-sort-key").isConstant();let ee=!1;const le=h.depthModeForSublayer(0,xt.ReadOnly),ce=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),me=[];for(const ve of s){const _e=t.getTile(ve),be=_e.getBucket(n);if(!be)continue;const Fe=c?be.text:be.icon;if(!Fe||!Fe.segments.get().length||!Fe.hasVisibleVertices)continue;const mt=Fe.programConfigurations.get(n.id),Ce=c||be.sdfIcons,He=c?be.textSizeData:be.iconSizeData,Ne=F||N.pitch!==0,Ft=h.useProgram(_o(Ce,c,be),mt),ut=l.ah(He,N.zoom),nt=h.style.map.terrain&&h.style.map.terrain.getTerrainData(ve);let ft,hi,Ht,Li,xi=[0,0],mi=null;if(c)hi=_e.glyphAtlasTexture,Ht=U.LINEAR,ft=_e.glyphAtlasTexture.size,be.iconsInText&&(xi=_e.imageAtlasTexture.size,mi=_e.imageAtlasTexture,Li=Ne||h.options.rotating||h.options.zooming||He.kind==="composite"||He.kind==="camera"?U.LINEAR:U.NEAREST);else{const ui=n.layout.get("icon-size").constantOr(0)!==1||be.iconsNeedLinear;hi=_e.imageAtlasTexture,Ht=Ce||h.options.rotating||h.options.zooming||ui||Ne?U.LINEAR:U.NEAREST,ft=_e.imageAtlasTexture.size}const pr=J(_e,1,h.transform.zoom),Xt=Se(ve.posMatrix,F,$,h.transform,pr),Hr=Gr(ve.posMatrix,F,$,h.transform,pr),Wr=ce&&be.hasTextData(),Pn=n.layout.get("icon-text-fit")!=="none"&&Wr&&be.hasIconData();if(Q){const ui=h.style.map.terrain?(tr,pi)=>h.style.map.terrain.getElevation(ve,tr,pi):null,bi=n.layout.get("text-rotation-alignment")==="map";Ie(be,ve.posMatrix,h,c,Xt,Hr,F,S,bi,ui)}const Zn=h.translatePosMatrix(ve.posMatrix,_e,p,g),xa=Q||c&&ce||Pn?yo:Xt,Ni=h.translatePosMatrix(Hr,_e,p,g,!0),zi=Ce&&n.paint.get(c?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Hi;Hi=Ce?be.iconsInText?Nn(He.kind,ut,se,F,h,Zn,xa,Ni,ft,xi):ao(He.kind,ut,se,F,h,Zn,xa,Ni,c,ft,!0):no(He.kind,ut,se,F,h,Zn,xa,Ni,c,ft);const Hn={program:Ft,buffers:Fe,uniformValues:Hi,atlasTexture:hi,atlasTextureIcon:mi,atlasInterpolation:Ht,atlasInterpolationIcon:Li,isSDF:Ce,hasHalo:zi};if(Z&&be.canOverlap){ee=!0;const ui=Fe.segments.get();for(const bi of ui)me.push({segments:new l.S([bi]),sortKey:bi.sortKey,state:Hn,terrainData:nt})}else me.push({segments:Fe.segments,sortKey:0,state:Hn,terrainData:nt})}ee&&me.sort((ve,_e)=>ve.sortKey-_e.sortKey);for(const ve of me){const _e=ve.state;if(L.activeTexture.set(U.TEXTURE0),_e.atlasTexture.bind(_e.atlasInterpolation,U.CLAMP_TO_EDGE),_e.atlasTextureIcon&&(L.activeTexture.set(U.TEXTURE1),_e.atlasTextureIcon&&_e.atlasTextureIcon.bind(_e.atlasInterpolationIcon,U.CLAMP_TO_EDGE)),_e.isSDF){const be=_e.uniformValues;_e.hasHalo&&(be.u_is_halo=1,vo(_e.buffers,ve.segments,n,h,_e.program,le,I,A,be,ve.terrainData)),be.u_is_halo=0}vo(_e.buffers,ve.segments,n,h,_e.program,le,I,A,_e.uniformValues,ve.terrainData)}}function vo(h,t,n,s,c,p,g,y,x,S){const I=s.context;c.draw(I,I.gl.TRIANGLES,p,g,y,Qt.disabled,x,S,n.id,h.layoutVertexBuffer,h.indexBuffer,t,n.paint,s.transform.zoom,h.programConfigurations.get(n.id),h.dynamicLayoutVertexBuffer,h.opacityVertexBuffer)}function Oa(h,t,n,s,c){if(!n||!s||!s.imageAtlas)return;const p=s.imageAtlas.patternPositions;let g=p[n.to.toString()],y=p[n.from.toString()];if(!g||!y){const x=c.getPaintProperty(t);g=p[x],y=p[x]}g&&y&&h.setConstantPatternPositions(g,y)}function Na(h,t,n,s,c,p,g){const y=h.context.gl,x="fill-pattern",S=n.paint.get(x),I=S&&S.constantOr(1),A=n.getCrossfadeParameters();let L,U,N,$,F;g?(U=I&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",L=y.LINES):(U=I?"fillPattern":"fill",L=y.TRIANGLES);const Q=S.constantOr(null);for(const se of s){const Z=t.getTile(se);if(I&&!Z.patternsLoaded())continue;const ee=Z.getBucket(n);if(!ee)continue;const le=ee.programConfigurations.get(n.id),ce=h.useProgram(U,le),me=h.style.map.terrain&&h.style.map.terrain.getTerrainData(se);I&&(h.context.activeTexture.set(y.TEXTURE0),Z.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),le.updatePaintBuffers(A)),Oa(le,x,Q,Z,n);const ve=me?se:null,_e=h.translatePosMatrix(ve?ve.posMatrix:se.posMatrix,Z,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(g){$=ee.indexBuffer2,F=ee.segments2;const be=[y.drawingBufferWidth,y.drawingBufferHeight];N=U==="fillOutlinePattern"&&I?ps(_e,h,A,Z,be):us(_e,be)}else $=ee.indexBuffer,F=ee.segments,N=I?eo(_e,h,A,Z):Tl(_e);ce.draw(h.context,L,c,h.stencilModeForClipping(se),p,Qt.disabled,N,me,n.id,ee.layoutVertexBuffer,$,F,n.paint,h.transform.zoom,le)}}function Ua(h,t,n,s,c,p,g){const y=h.context,x=y.gl,S="fill-extrusion-pattern",I=n.paint.get(S),A=I.constantOr(1),L=n.getCrossfadeParameters(),U=n.paint.get("fill-extrusion-opacity"),N=I.constantOr(null);for(const $ of s){const F=t.getTile($),Q=F.getBucket(n);if(!Q)continue;const se=h.style.map.terrain&&h.style.map.terrain.getTerrainData($),Z=Q.programConfigurations.get(n.id),ee=h.useProgram(A?"fillExtrusionPattern":"fillExtrusion",Z);A&&(h.context.activeTexture.set(x.TEXTURE0),F.imageAtlasTexture.bind(x.LINEAR,x.CLAMP_TO_EDGE),Z.updatePaintBuffers(L)),Oa(Z,S,N,F,n);const le=h.translatePosMatrix($.posMatrix,F,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),ce=n.paint.get("fill-extrusion-vertical-gradient"),me=A?Sn(le,h,ce,U,$,L,F):Qs(le,h,ce,U);ee.draw(y,y.gl.TRIANGLES,c,p,g,Qt.backCCW,me,se,n.id,Q.layoutVertexBuffer,Q.indexBuffer,Q.segments,n.paint,h.transform.zoom,Z,h.style.map.terrain&&Q.centroidVertexBuffer)}}function fh(h,t,n,s,c,p,g){const y=h.context,x=y.gl,S=n.fbo;if(!S)return;const I=h.useProgram("hillshade"),A=h.style.map.terrain&&h.style.map.terrain.getTerrainData(t);y.activeTexture.set(x.TEXTURE0),x.bindTexture(x.TEXTURE_2D,S.colorAttachment.get()),I.draw(y,x.TRIANGLES,c,p,g,Qt.disabled,((L,U,N,$)=>{const F=N.paint.get("hillshade-shadow-color"),Q=N.paint.get("hillshade-highlight-color"),se=N.paint.get("hillshade-accent-color");let Z=N.paint.get("hillshade-illumination-direction")*(Math.PI/180);N.paint.get("hillshade-illumination-anchor")==="viewport"&&(Z-=L.transform.angle);const ee=!L.options.moving;return{u_matrix:$?$.posMatrix:L.transform.calculatePosMatrix(U.tileID.toUnwrapped(),ee),u_image:0,u_latrange:io(0,U.tileID),u_light:[N.paint.get("hillshade-exaggeration"),Z],u_shadow:F,u_highlight:Q,u_accent:se}})(h,n,s,A?t:null),A,s.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments)}function xo(h,t,n,s,c,p){const g=h.context,y=g.gl,x=t.dem;if(x&&x.data){const S=x.dim,I=x.stride,A=x.getPixels();if(g.activeTexture.set(y.TEXTURE1),g.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||h.getTileTexture(I),t.demTexture){const U=t.demTexture;U.update(A,{premultiply:!1}),U.bind(y.NEAREST,y.CLAMP_TO_EDGE)}else t.demTexture=new qe(g,A,y.RGBA,{premultiply:!1}),t.demTexture.bind(y.NEAREST,y.CLAMP_TO_EDGE);g.activeTexture.set(y.TEXTURE0);let L=t.fbo;if(!L){const U=new qe(g,{width:S,height:S,data:null},y.RGBA);U.bind(y.LINEAR,y.CLAMP_TO_EDGE),L=t.fbo=g.createFramebuffer(S,S,!0,!1),L.colorAttachment.set(U.texture)}g.bindFramebuffer.set(L.framebuffer),g.viewport.set([0,0,S,S]),h.useProgram("hillshadePrepare").draw(g,y.TRIANGLES,s,c,p,Qt.disabled,((U,N)=>{const $=N.stride,F=l.Z();return l.aS(F,0,l.N,-l.N,0,0,1),l.$(F,F,[0,-l.N,0]),{u_matrix:F,u_image:1,u_dimension:[$,$],u_zoom:U.overscaledZ,u_unpack:N.getUnpackVector()}})(t.tileID,x),null,n.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function gh(h,t,n,s,c,p){const g=s.paint.get("raster-fade-duration");if(!p&&g>0){const y=l.h.now(),x=(y-h.timeAdded)/g,S=t?(y-t.timeAdded)/g:-1,I=n.getSource(),A=c.coveringZoomLevel({tileSize:I.tileSize,roundZoom:I.roundZoom}),L=!t||Math.abs(t.tileID.overscaledZ-A)>Math.abs(h.tileID.overscaledZ-A),U=L&&h.refreshedUponExpiration?1:l.ad(L?x:1-S,0,1);return h.refreshedUponExpiration&&x>=1&&(h.refreshedUponExpiration=!1),t?{opacity:1,mix:1-U}:{opacity:U,mix:0}}return{opacity:1,mix:0}}const Ol=new l.aT(1,0,0,1),Cs=new l.aT(0,1,0,1),bo=new l.aT(0,0,1,1),Nl=new l.aT(1,0,1,1),Ul=new l.aT(0,1,1,1);function Va(h,t,n,s){Ps(h,0,t+n/2,h.transform.width,n,s)}function Es(h,t,n,s){Ps(h,t-n/2,0,n,h.transform.height,s)}function Ps(h,t,n,s,c,p){const g=h.context,y=g.gl;y.enable(y.SCISSOR_TEST),y.scissor(t*h.pixelRatio,n*h.pixelRatio,s*h.pixelRatio,c*h.pixelRatio),g.clear({color:p}),y.disable(y.SCISSOR_TEST)}function Vl(h,t,n){const s=h.context,c=s.gl,p=n.posMatrix,g=h.useProgram("debug"),y=xt.disabled,x=ri.disabled,S=h.colorModeForRenderPass(),I="$debug",A=h.style.map.terrain&&h.style.map.terrain.getTerrainData(n);s.activeTexture.set(c.TEXTURE0);const L=t.getTileByID(n.key).latestRawTileData,U=Math.floor((L&&L.byteLength||0)/1024),N=t.getTile(n).tileSize,$=512/Math.min(N,512)*(n.overscaledZ/h.transform.zoom)*.5;let F=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(F+=` => ${n.overscaledZ}`),function(Q,se){Q.initDebugOverlayCanvas();const Z=Q.debugOverlayCanvas,ee=Q.context.gl,le=Q.debugOverlayCanvas.getContext("2d");le.clearRect(0,0,Z.width,Z.height),le.shadowColor="white",le.shadowBlur=2,le.lineWidth=1.5,le.strokeStyle="white",le.textBaseline="top",le.font="bold 36px Open Sans, sans-serif",le.fillText(se,5,5),le.strokeText(se,5,5),Q.debugOverlayTexture.update(Z),Q.debugOverlayTexture.bind(ee.LINEAR,ee.CLAMP_TO_EDGE)}(h,`${F} ${U}kB`),g.draw(s,c.TRIANGLES,y,x,ii.alphaBlended,Qt.disabled,Ra(p,l.aT.transparent,$),null,I,h.debugBuffer,h.quadTriangleIndexBuffer,h.debugSegments),g.draw(s,c.LINE_STRIP,y,x,S,Qt.disabled,Ra(p,l.aT.red),A,I,h.debugBuffer,h.tileBorderIndexBuffer,h.debugSegments)}function li(h,t,n){const s=h.context,c=s.gl,p=h.colorModeForRenderPass(),g=new xt(c.LEQUAL,xt.ReadWrite,h.depthRangeFor3D),y=h.useProgram("terrain"),x=t.getTerrainMesh();s.bindFramebuffer.set(null),s.viewport.set([0,0,h.width,h.height]);for(const S of n){const I=h.renderToTexture.getTexture(S),A=t.getTerrainData(S.tileID);s.activeTexture.set(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,I.texture);const L={u_matrix:h.transform.calculatePosMatrix(S.tileID.toUnwrapped()),u_texture:0,u_ele_delta:t.getMeshFrameDelta(h.transform.zoom)};y.draw(s,c.TRIANGLES,g,ri.disabled,p,Qt.backCCW,L,A,"terrain",x.vertexBuffer,x.indexBuffer,x.segments)}}class $n{constructor(t,n){this.context=new mh(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:l.Z(),renderTime:0},this.setup(),this.numSublayers=Ji.maxUnderzooming+Ji.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new ls}resize(t,n,s){if(this.width=Math.floor(t*s),this.height=Math.floor(n*s),this.pixelRatio=s,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 t=this.context,n=new l.a_;n.emplaceBack(0,0),n.emplaceBack(l.N,0),n.emplaceBack(0,l.N),n.emplaceBack(l.N,l.N),this.tileExtentBuffer=t.createVertexBuffer(n,cs.members),this.tileExtentSegments=l.S.simpleSegment(0,0,4,2);const s=new l.a_;s.emplaceBack(0,0),s.emplaceBack(l.N,0),s.emplaceBack(0,l.N),s.emplaceBack(l.N,l.N),this.debugBuffer=t.createVertexBuffer(s,cs.members),this.debugSegments=l.S.simpleSegment(0,0,4,5);const c=new l.V;c.emplaceBack(0,0,0,0),c.emplaceBack(l.N,0,l.N,0),c.emplaceBack(0,l.N,0,l.N),c.emplaceBack(l.N,l.N,l.N,l.N),this.rasterBoundsBuffer=t.createVertexBuffer(c,zr.members),this.rasterBoundsSegments=l.S.simpleSegment(0,0,4,2);const p=new l.a_;p.emplaceBack(0,0),p.emplaceBack(1,0),p.emplaceBack(0,1),p.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(p,cs.members),this.viewportSegments=l.S.simpleSegment(0,0,4,2);const g=new l.a$;g.emplaceBack(0),g.emplaceBack(1),g.emplaceBack(3),g.emplaceBack(2),g.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(g);const y=new l.b0;y.emplaceBack(0,1,2),y.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(y);const x=this.context.gl;this.stencilClearMode=new ri({func:x.ALWAYS,mask:0},0,255,x.ZERO,x.ZERO,x.ZERO)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const s=l.Z();l.aS(s,0,this.width,this.height,0,0,1),l.a0(s,s,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,xt.disabled,this.stencilClearMode,ii.disabled,Qt.disabled,Il(s),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n){if(this.currentStencilSource===t.source||!t.isTileClipped()||!n||!n.length)return;this.currentStencilSource=t.source;const s=this.context,c=s.gl;this.nextStencilID+n.length>256&&this.clearStencil(),s.setColorMode(ii.disabled),s.setDepthMode(xt.disabled);const p=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const g of n){const y=this._tileClippingMaskIDs[g.key]=this.nextStencilID++,x=this.style.map.terrain&&this.style.map.terrain.getTerrainData(g);p.draw(s,c.TRIANGLES,xt.disabled,new ri({func:c.ALWAYS,mask:0},y,255,c.KEEP,c.KEEP,c.REPLACE),ii.disabled,Qt.disabled,Il(g.posMatrix),x,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new ri({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new ri({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,s=t.sort((g,y)=>y.overscaledZ-g.overscaledZ),c=s[s.length-1].overscaledZ,p=s[0].overscaledZ-c+1;if(p>1){this.currentStencilSource=void 0,this.nextStencilID+p>256&&this.clearStencil();const g={};for(let y=0;y<p;y++)g[y+c]=new ri({func:n.GEQUAL,mask:255},y+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=p,[g,s]}return[{[c]:ri.disabled},s]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new ii([t.CONSTANT_COLOR,t.ONE],new l.aT(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?ii.unblended:ii.alphaBlended}depthModeForSublayer(t,n,s){if(!this.opaquePassEnabledForLayer())return xt.disabled;const c=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new xt(s||this.context.gl.LEQUAL,n,[c,c])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(l.h.now()),this.imageManager.beginFrame();const s=this.style._order,c=this.style.sourceCaches,p={},g={},y={};for(const x in c){const S=c[x];S.used&&S.prepare(this.context),p[x]=S.getVisibleCoordinates(),g[x]=p[x].slice().reverse(),y[x]=S.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let x=0;x<s.length;x++)if(this.style._layers[s[x]].is3D()){this.opaquePassCutoff=x;break}if(this.renderToTexture){this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0;const x=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!l.b1(this.terrainFacilitator.matrix,this.transform.projMatrix)||x.length)&&(l.b2(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(S,I){const A=S.context,L=A.gl,U=ii.unblended,N=new xt(L.LEQUAL,xt.ReadWrite,[0,1]),$=I.getTerrainMesh(),F=I.sourceCache.getRenderableTiles(),Q=S.useProgram("terrainDepth");A.bindFramebuffer.set(I.getFramebuffer("depth").framebuffer),A.viewport.set([0,0,S.width/devicePixelRatio,S.height/devicePixelRatio]),A.clear({color:l.aT.transparent,depth:1});for(const se of F){const Z=I.getTerrainData(se.tileID),ee={u_matrix:S.transform.calculatePosMatrix(se.tileID.toUnwrapped()),u_ele_delta:I.getMeshFrameDelta(S.transform.zoom)};Q.draw(A,L.TRIANGLES,N,ri.disabled,U,Qt.backCCW,ee,Z,"terrain",$.vertexBuffer,$.indexBuffer,$.segments)}A.bindFramebuffer.set(null),A.viewport.set([0,0,S.width,S.height])}(this,this.style.map.terrain),function(S,I){const A=S.context,L=A.gl,U=ii.unblended,N=new xt(L.LEQUAL,xt.ReadWrite,[0,1]),$=I.getTerrainMesh(),F=I.getCoordsTexture(),Q=I.sourceCache.getRenderableTiles(),se=S.useProgram("terrainCoords");A.bindFramebuffer.set(I.getFramebuffer("coords").framebuffer),A.viewport.set([0,0,S.width/devicePixelRatio,S.height/devicePixelRatio]),A.clear({color:l.aT.transparent,depth:1}),I.coordsIndex=[];for(const Z of Q){const ee=I.getTerrainData(Z.tileID);A.activeTexture.set(L.TEXTURE0),L.bindTexture(L.TEXTURE_2D,F.texture);const le={u_matrix:S.transform.calculatePosMatrix(Z.tileID.toUnwrapped()),u_terrain_coords_id:(255-I.coordsIndex.length)/255,u_texture:0,u_ele_delta:I.getMeshFrameDelta(S.transform.zoom)};se.draw(A,L.TRIANGLES,N,ri.disabled,U,Qt.backCCW,le,ee,"terrain",$.vertexBuffer,$.indexBuffer,$.segments),I.coordsIndex.push(Z.tileID.key)}A.bindFramebuffer.set(null),A.viewport.set([0,0,S.width,S.height])}(this,this.style.map.terrain))}this.renderPass="offscreen";for(const x of s){const S=this.style._layers[x];if(!S.hasOffscreenPass()||S.isHidden(this.transform.zoom))continue;const I=g[S.source];(S.type==="custom"||I.length)&&this.renderLayer(this,c[S.source],S,I)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?l.aT.black:l.aT.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=s.length-1;this.currentLayer>=0;this.currentLayer--){const x=this.style._layers[s[this.currentLayer]],S=c[x.source],I=p[x.source];this._renderTileClippingMasks(x,I),this.renderLayer(this,S,x,I)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<s.length;this.currentLayer++){const x=this.style._layers[s[this.currentLayer]],S=c[x.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(x))continue;const I=(x.type==="symbol"?y:g)[x.source];this._renderTileClippingMasks(x,p[x.source]),this.renderLayer(this,S,x,I)}if(this.options.showTileBoundaries){const x=function(S,I){let A=null;const L=Object.values(S._layers).flatMap(F=>F.source&&!F.isHidden(I)?[S.sourceCaches[F.source]]:[]),U=L.filter(F=>F.getSource().type==="vector"),N=L.filter(F=>F.getSource().type!=="vector"),$=F=>{(!A||A.getSource().maxzoom<F.getSource().maxzoom)&&(A=F)};return U.forEach(F=>$(F)),A||N.forEach(F=>$(F)),A}(this.style,this.transform.zoom);x&&function(S,I,A){for(let L=0;L<A.length;L++)Vl(S,I,A[L])}(this,x,x.getVisibleCoordinates())}this.options.showPadding&&function(x){const S=x.transform.padding;Va(x,x.transform.height-(S.top||0),3,Ol),Va(x,S.bottom||0,3,Cs),Es(x,S.left||0,3,bo),Es(x,x.transform.width-(S.right||0),3,Nl);const I=x.transform.centerPoint;(function(A,L,U,N){Ps(A,L-1,U-10,2,20,N),Ps(A,L-10,U-1,20,2,N)})(x,I.x,x.transform.height-I.y,Ul)}(this),this.context.setDefault()}renderLayer(t,n,s,c){if(!s.isHidden(this.transform.zoom)&&(s.type==="background"||s.type==="custom"||(c||[]).length))switch(this.id=s.id,s.type){case"symbol":(function(p,g,y,x,S){if(p.renderPass!=="translucent")return;const I=ri.disabled,A=p.colorModeForRenderPass();(y._unevaluatedLayout.hasValue("text-variable-anchor")||y._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(L,U,N,$,F,Q,se){const Z=U.transform,ee=F==="map",le=Q==="map";for(const ce of L){const me=$.getTile(ce),ve=me.getBucket(N);if(!ve||!ve.text||!ve.text.segments.get().length)continue;const _e=l.ah(ve.textSizeData,Z.zoom),be=J(me,1,U.transform.zoom),Fe=Se(ce.posMatrix,le,ee,U.transform,be),mt=N.layout.get("icon-text-fit")!=="none"&&ve.hasIconData();if(_e){const Ce=Math.pow(2,Z.zoom-me.tileID.overscaledZ);Is(ve,ee,le,se,Z,Fe,ce.posMatrix,Ce,_e,mt,U.style.map.terrain?(He,Ne)=>U.style.map.terrain.getElevation(ce,He,Ne):null)}}}(x,p,y,g,y.layout.get("text-rotation-alignment"),y.layout.get("text-pitch-alignment"),S),y.paint.get("icon-opacity").constantOr(1)!==0&&As(p,g,y,x,!1,y.paint.get("icon-translate"),y.paint.get("icon-translate-anchor"),y.layout.get("icon-rotation-alignment"),y.layout.get("icon-pitch-alignment"),y.layout.get("icon-keep-upright"),I,A),y.paint.get("text-opacity").constantOr(1)!==0&&As(p,g,y,x,!0,y.paint.get("text-translate"),y.paint.get("text-translate-anchor"),y.layout.get("text-rotation-alignment"),y.layout.get("text-pitch-alignment"),y.layout.get("text-keep-upright"),I,A),g.map.showCollisionBoxes&&(Fl(p,g,y,x,y.paint.get("text-translate"),y.paint.get("text-translate-anchor"),!0),Fl(p,g,y,x,y.paint.get("icon-translate"),y.paint.get("icon-translate-anchor"),!1))})(t,n,s,c,this.style.placement.variableOffsets);break;case"circle":(function(p,g,y,x){if(p.renderPass!=="translucent")return;const S=y.paint.get("circle-opacity"),I=y.paint.get("circle-stroke-width"),A=y.paint.get("circle-stroke-opacity"),L=!y.layout.get("circle-sort-key").isConstant();if(S.constantOr(1)===0&&(I.constantOr(1)===0||A.constantOr(1)===0))return;const U=p.context,N=U.gl,$=p.depthModeForSublayer(0,xt.ReadOnly),F=ri.disabled,Q=p.colorModeForRenderPass(),se=[];for(let Z=0;Z<x.length;Z++){const ee=x[Z],le=g.getTile(ee),ce=le.getBucket(y);if(!ce)continue;const me=ce.programConfigurations.get(y.id),ve=p.useProgram("circle",me),_e=ce.layoutVertexBuffer,be=ce.indexBuffer,Fe=p.style.map.terrain&&p.style.map.terrain.getTerrainData(ee),mt={programConfiguration:me,program:ve,layoutVertexBuffer:_e,indexBuffer:be,uniformValues:Tn(p,ee,le,y),terrainData:Fe};if(L){const Ce=ce.segments.get();for(const He of Ce)se.push({segments:new l.S([He]),sortKey:He.sortKey,state:mt})}else se.push({segments:ce.segments,sortKey:0,state:mt})}L&&se.sort((Z,ee)=>Z.sortKey-ee.sortKey);for(const Z of se){const{programConfiguration:ee,program:le,layoutVertexBuffer:ce,indexBuffer:me,uniformValues:ve,terrainData:_e}=Z.state;le.draw(U,N.TRIANGLES,$,F,Q,Qt.disabled,ve,_e,y.id,ce,me,Z.segments,y.paint,p.transform.zoom,ee)}})(t,n,s,c);break;case"heatmap":(function(p,g,y,x){if(y.paint.get("heatmap-opacity")!==0)if(p.renderPass==="offscreen"){const S=p.context,I=S.gl,A=ri.disabled,L=new ii([I.ONE,I.ONE],l.aT.transparent,[!0,!0,!0,!0]);(function(U,N,$){const F=U.gl;U.activeTexture.set(F.TEXTURE1),U.viewport.set([0,0,N.width/4,N.height/4]);let Q=$.heatmapFbo;if(Q)F.bindTexture(F.TEXTURE_2D,Q.colorAttachment.get()),U.bindFramebuffer.set(Q.framebuffer);else{const se=F.createTexture();F.bindTexture(F.TEXTURE_2D,se),F.texParameteri(F.TEXTURE_2D,F.TEXTURE_WRAP_S,F.CLAMP_TO_EDGE),F.texParameteri(F.TEXTURE_2D,F.TEXTURE_WRAP_T,F.CLAMP_TO_EDGE),F.texParameteri(F.TEXTURE_2D,F.TEXTURE_MIN_FILTER,F.LINEAR),F.texParameteri(F.TEXTURE_2D,F.TEXTURE_MAG_FILTER,F.LINEAR),Q=$.heatmapFbo=U.createFramebuffer(N.width/4,N.height/4,!1,!1),function(Z,ee,le,ce){var me,ve;const _e=Z.gl,be=(me=Z.HALF_FLOAT)!==null&&me!==void 0?me:_e.UNSIGNED_BYTE,Fe=(ve=Z.RGBA16F)!==null&&ve!==void 0?ve:_e.RGBA;_e.texImage2D(_e.TEXTURE_2D,0,Fe,ee.width/4,ee.height/4,0,_e.RGBA,be,null),ce.colorAttachment.set(le)}(U,N,se,Q)}})(S,p,y),S.clear({color:l.aT.transparent});for(let U=0;U<x.length;U++){const N=x[U];if(g.hasRenderableParent(N))continue;const $=g.getTile(N),F=$.getBucket(y);if(!F)continue;const Q=F.programConfigurations.get(y.id),se=p.useProgram("heatmap",Q),{zoom:Z}=p.transform;se.draw(S,I.TRIANGLES,xt.disabled,A,L,Qt.disabled,sh(N.posMatrix,$,Z,y.paint.get("heatmap-intensity")),null,y.id,F.layoutVertexBuffer,F.indexBuffer,F.segments,y.paint,p.transform.zoom,Q)}S.viewport.set([0,0,p.width,p.height])}else p.renderPass==="translucent"&&(p.context.setColorMode(p.colorModeForRenderPass()),function(S,I){const A=S.context,L=A.gl,U=I.heatmapFbo;if(!U)return;A.activeTexture.set(L.TEXTURE0),L.bindTexture(L.TEXTURE_2D,U.colorAttachment.get()),A.activeTexture.set(L.TEXTURE1);let N=I.colorRampTexture;N||(N=I.colorRampTexture=new qe(A,I.colorRamp,L.RGBA)),N.bind(L.LINEAR,L.CLAMP_TO_EDGE),S.useProgram("heatmapTexture").draw(A,L.TRIANGLES,xt.disabled,ri.disabled,S.colorModeForRenderPass(),Qt.disabled,(($,F,Q,se)=>{const Z=l.Z();l.aS(Z,0,$.width,$.height,0,0,1);const ee=$.context.gl;return{u_matrix:Z,u_world:[ee.drawingBufferWidth,ee.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:F.paint.get("heatmap-opacity")}})(S,I),null,I.id,S.viewportBuffer,S.quadTriangleIndexBuffer,S.viewportSegments,I.paint,S.transform.zoom)}(p,y))})(t,n,s,c);break;case"line":(function(p,g,y,x){if(p.renderPass!=="translucent")return;const S=y.paint.get("line-opacity"),I=y.paint.get("line-width");if(S.constantOr(1)===0||I.constantOr(1)===0)return;const A=p.depthModeForSublayer(0,xt.ReadOnly),L=p.colorModeForRenderPass(),U=y.paint.get("line-dasharray"),N=y.paint.get("line-pattern"),$=N.constantOr(1),F=y.paint.get("line-gradient"),Q=y.getCrossfadeParameters(),se=$?"linePattern":U?"lineSDF":F?"lineGradient":"line",Z=p.context,ee=Z.gl;let le=!0;for(const ce of x){const me=g.getTile(ce);if($&&!me.patternsLoaded())continue;const ve=me.getBucket(y);if(!ve)continue;const _e=ve.programConfigurations.get(y.id),be=p.context.program.get(),Fe=p.useProgram(se,_e),mt=le||Fe.program!==be,Ce=p.style.map.terrain&&p.style.map.terrain.getTerrainData(ce),He=N.constantOr(null);if(He&&me.imageAtlas){const ut=me.imageAtlas,nt=ut.patternPositions[He.to.toString()],ft=ut.patternPositions[He.from.toString()];nt&&ft&&_e.setConstantPatternPositions(nt,ft)}const Ne=Ce?ce:null,Ft=$?oh(p,me,y,Q,Ne):U?Cl(p,me,y,U,Q,Ne):F?Al(p,me,y,ve.lineClipsArray.length,Ne):ro(p,me,y,Ne);if($)Z.activeTexture.set(ee.TEXTURE0),me.imageAtlasTexture.bind(ee.LINEAR,ee.CLAMP_TO_EDGE),_e.updatePaintBuffers(Q);else if(U&&(mt||p.lineAtlas.dirty))Z.activeTexture.set(ee.TEXTURE0),p.lineAtlas.bind(Z);else if(F){const ut=ve.gradients[y.id];let nt=ut.texture;if(y.gradientVersion!==ut.version){let ft=256;if(y.stepInterpolant){const hi=g.getSource().maxzoom,Ht=ce.canonical.z===hi?Math.ceil(1<<p.transform.maxZoom-ce.canonical.z):1;ft=l.ad(l.aY(ve.maxLineLength/l.N*1024*Ht),256,Z.maxTextureSize)}ut.gradient=l.aZ({expression:y.gradientExpression(),evaluationKey:"lineProgress",resolution:ft,image:ut.gradient||void 0,clips:ve.lineClipsArray}),ut.texture?ut.texture.update(ut.gradient):ut.texture=new qe(Z,ut.gradient,ee.RGBA),ut.version=y.gradientVersion,nt=ut.texture}Z.activeTexture.set(ee.TEXTURE0),nt.bind(y.stepInterpolant?ee.NEAREST:ee.LINEAR,ee.CLAMP_TO_EDGE)}Fe.draw(Z,ee.TRIANGLES,A,p.stencilModeForClipping(ce),L,Qt.disabled,Ft,Ce,y.id,ve.layoutVertexBuffer,ve.indexBuffer,ve.segments,y.paint,p.transform.zoom,_e,ve.layoutVertexBuffer2),le=!1}})(t,n,s,c);break;case"fill":(function(p,g,y,x){const S=y.paint.get("fill-color"),I=y.paint.get("fill-opacity");if(I.constantOr(1)===0)return;const A=p.colorModeForRenderPass(),L=y.paint.get("fill-pattern"),U=p.opaquePassEnabledForLayer()&&!L.constantOr(1)&&S.constantOr(l.aT.transparent).a===1&&I.constantOr(0)===1?"opaque":"translucent";if(p.renderPass===U){const N=p.depthModeForSublayer(1,p.renderPass==="opaque"?xt.ReadWrite:xt.ReadOnly);Na(p,g,y,x,N,A,!1)}if(p.renderPass==="translucent"&&y.paint.get("fill-antialias")){const N=p.depthModeForSublayer(y.getPaintProperty("fill-outline-color")?2:0,xt.ReadOnly);Na(p,g,y,x,N,A,!0)}})(t,n,s,c);break;case"fill-extrusion":(function(p,g,y,x){const S=y.paint.get("fill-extrusion-opacity");if(S!==0&&p.renderPass==="translucent"){const I=new xt(p.context.gl.LEQUAL,xt.ReadWrite,p.depthRangeFor3D);if(S!==1||y.paint.get("fill-extrusion-pattern").constantOr(1))Ua(p,g,y,x,I,ri.disabled,ii.disabled),Ua(p,g,y,x,I,p.stencilModeFor3D(),p.colorModeForRenderPass());else{const A=p.colorModeForRenderPass();Ua(p,g,y,x,I,ri.disabled,A)}}})(t,n,s,c);break;case"hillshade":(function(p,g,y,x){if(p.renderPass!=="offscreen"&&p.renderPass!=="translucent")return;const S=p.context,I=p.depthModeForSublayer(0,xt.ReadOnly),A=p.colorModeForRenderPass(),[L,U]=p.renderPass==="translucent"?p.stencilConfigForOverlap(x):[{},x];for(const N of U){const $=g.getTile(N);$.needsHillshadePrepare!==void 0&&$.needsHillshadePrepare&&p.renderPass==="offscreen"?xo(p,$,y,I,ri.disabled,A):p.renderPass==="translucent"&&fh(p,N,$,y,I,L[N.overscaledZ],A)}S.viewport.set([0,0,p.width,p.height])})(t,n,s,c);break;case"raster":(function(p,g,y,x){if(p.renderPass!=="translucent"||y.paint.get("raster-opacity")===0||!x.length)return;const S=p.context,I=S.gl,A=g.getSource(),L=p.useProgram("raster"),U=p.colorModeForRenderPass(),[N,$]=A instanceof xr?[{},x]:p.stencilConfigForOverlap(x),F=$[$.length-1].overscaledZ,Q=!p.options.moving;for(const se of $){const Z=p.depthModeForSublayer(se.overscaledZ-F,y.paint.get("raster-opacity")===1?xt.ReadWrite:xt.ReadOnly,I.LESS),ee=g.getTile(se);ee.registerFadeDuration(y.paint.get("raster-fade-duration"));const le=g.findLoadedParent(se,0),ce=gh(ee,le,g,y,p.transform,p.style.map.terrain);let me,ve;const _e=y.paint.get("raster-resampling")==="nearest"?I.NEAREST:I.LINEAR;S.activeTexture.set(I.TEXTURE0),ee.texture.bind(_e,I.CLAMP_TO_EDGE,I.LINEAR_MIPMAP_NEAREST),S.activeTexture.set(I.TEXTURE1),le?(le.texture.bind(_e,I.CLAMP_TO_EDGE,I.LINEAR_MIPMAP_NEAREST),me=Math.pow(2,le.tileID.overscaledZ-ee.tileID.overscaledZ),ve=[ee.tileID.canonical.x*me%1,ee.tileID.canonical.y*me%1]):ee.texture.bind(_e,I.CLAMP_TO_EDGE,I.LINEAR_MIPMAP_NEAREST);const be=p.style.map.terrain&&p.style.map.terrain.getTerrainData(se),Fe=be?se:null,mt=Fe?Fe.posMatrix:p.transform.calculatePosMatrix(se.toUnwrapped(),Q),Ce=Pl(mt,ve||[0,0],me||1,ce,y);A instanceof xr?L.draw(S,I.TRIANGLES,Z,ri.disabled,U,Qt.disabled,Ce,be,y.id,A.boundsBuffer,p.quadTriangleIndexBuffer,A.boundsSegments):L.draw(S,I.TRIANGLES,Z,N[se.overscaledZ],U,Qt.disabled,Ce,be,y.id,p.rasterBoundsBuffer,p.quadTriangleIndexBuffer,p.rasterBoundsSegments)}})(t,n,s,c);break;case"background":(function(p,g,y,x){const S=y.paint.get("background-color"),I=y.paint.get("background-opacity");if(I===0)return;const A=p.context,L=A.gl,U=p.transform,N=U.tileSize,$=y.paint.get("background-pattern");if(p.isPatternMissing($))return;const F=!$&&S.a===1&&I===1&&p.opaquePassEnabledForLayer()?"opaque":"translucent";if(p.renderPass!==F)return;const Q=ri.disabled,se=p.depthModeForSublayer(0,F==="opaque"?xt.ReadWrite:xt.ReadOnly),Z=p.colorModeForRenderPass(),ee=p.useProgram($?"backgroundPattern":"background"),le=x||U.coveringTiles({tileSize:N,terrain:p.style.map.terrain});$&&(A.activeTexture.set(L.TEXTURE0),p.imageManager.bind(p.context));const ce=y.getCrossfadeParameters();for(const me of le){const ve=x?me.posMatrix:p.transform.calculatePosMatrix(me.toUnwrapped()),_e=$?Ir(ve,I,p,$,{tileID:me,tileSize:N},ce):ms(ve,I,S),be=p.style.map.terrain&&p.style.map.terrain.getTerrainData(me);ee.draw(A,L.TRIANGLES,se,Q,Z,Qt.disabled,_e,be,y.id,p.tileExtentBuffer,p.quadTriangleIndexBuffer,p.tileExtentSegments)}})(t,0,s,c);break;case"custom":(function(p,g,y){const x=p.context,S=y.implementation;if(p.renderPass==="offscreen"){const I=S.prerender;I&&(p.setCustomLayerDefaults(),x.setColorMode(p.colorModeForRenderPass()),I.call(S,x.gl,p.transform.customLayerMatrix()),x.setDirty(),p.setBaseState())}else if(p.renderPass==="translucent"){p.setCustomLayerDefaults(),x.setColorMode(p.colorModeForRenderPass()),x.setStencilMode(ri.disabled);const I=S.renderingMode==="3d"?new xt(p.context.gl.LEQUAL,xt.ReadWrite,p.depthRangeFor3D):p.depthModeForSublayer(0,xt.ReadOnly);x.setDepthMode(I),S.render(x.gl,p.transform.customLayerMatrix()),x.setDirty(),p.setBaseState(),x.bindFramebuffer.set(null)}})(t,0,s)}}translatePosMatrix(t,n,s,c,p){if(!s[0]&&!s[1])return t;const g=p?c==="map"?this.transform.angle:0:c==="viewport"?-this.transform.angle:0;if(g){const S=Math.sin(g),I=Math.cos(g);s=[s[0]*I-s[1]*S,s[0]*S+s[1]*I]}const y=[p?s[0]:J(n,s[0],this.transform.zoom),p?s[1]:J(n,s[1],this.transform.zoom),0],x=new Float32Array(16);return l.$(x,t,y),x}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const n=this.imageManager.getPattern(t.from.toString()),s=this.imageManager.getPattern(t.to.toString());return!n||!s}useProgram(t,n){this.cache=this.cache||{};const s=t+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[s]||(this.cache[s]=new hs(this.context,ti[t],n,fs[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[s]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new qe(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:n}=this.context.gl;return this.width!==t||this.height!==n}}class Qi{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,s){const c=Math.pow(2,s),p=[[-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(y=>{const x=1/(y=l.ag([],y,t))[3]/n*c;return l.b3(y,y,[x,x,1/y[3],x])}),g=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(y=>{const x=function(L,U){var N=U[0],$=U[1],F=U[2],Q=N*N+$*$+F*F;return Q>0&&(Q=1/Math.sqrt(Q)),L[0]=U[0]*Q,L[1]=U[1]*Q,L[2]=U[2]*Q,L}([],function(L,U,N){var $=U[0],F=U[1],Q=U[2],se=N[0],Z=N[1],ee=N[2];return L[0]=F*ee-Q*Z,L[1]=Q*se-$*ee,L[2]=$*Z-F*se,L}([],ht([],p[y[0]],p[y[1]]),ht([],p[y[2]],p[y[1]]))),S=-((I=x)[0]*(A=p[y[1]])[0]+I[1]*A[1]+I[2]*A[2]);var I,A;return x.concat(S)});return new Qi(p,g)}}class ma{constructor(t,n){this.min=t,this.max=n,this.center=function(s,c,p){return s[0]=.5*c[0],s[1]=.5*c[1],s[2]=.5*c[2],s}([],function(s,c,p){return s[0]=c[0]+p[0],s[1]=c[1]+p[1],s[2]=c[2]+p[2],s}([],this.min,this.max))}quadrant(t){const n=[t%2==0,t<2],s=Jt(this.min),c=Jt(this.max);for(let p=0;p<n.length;p++)s[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 ma(s,c)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersects(t){const n=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let s=!0;for(let c=0;c<t.planes.length;c++){const p=t.planes[c];let g=0;for(let y=0;y<n.length;y++)l.b4(p,n[y])>=0&&g++;if(g===0)return 0;g!==n.length&&(s=!1)}if(s)return 2;for(let c=0;c<3;c++){let p=Number.MAX_VALUE,g=-Number.MAX_VALUE;for(let y=0;y<t.points.length;y++){const x=t.points[y][c]-this.min[c];p=Math.min(p,x),g=Math.max(g,x)}if(g<0||p>this.max[c]-this.min[c])return 0}return 1}}class $a{constructor(t=0,n=0,s=0,c=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(s)||s<0||isNaN(c)||c<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=s,this.right=c}interpolate(t,n,s){return n.top!=null&&t.top!=null&&(this.top=l.B.number(t.top,n.top,s)),n.bottom!=null&&t.bottom!=null&&(this.bottom=l.B.number(t.bottom,n.bottom,s)),n.left!=null&&t.left!=null&&(this.left=l.B.number(t.left,n.left,s)),n.right!=null&&t.right!=null&&(this.right=l.B.number(t.right,n.right,s)),this}getCenter(t,n){const s=l.ad((this.left+t-this.right)/2,0,t),c=l.ad((this.top+n-this.bottom)/2,0,n);return new l.P(s,c)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new $a(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class ks{constructor(t,n,s,c,p){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=p===void 0||!!p,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=s??0,this._maxPitch=c??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new l.L(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new $a,this._posMatrixCache={},this._alignedPosMatrixCache={},this._minEleveationForCurrentTile=0}clone(){const t=new ks(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this._minEleveationForCurrentTile=t._minEleveationForCurrentTile,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new l.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-l.b5(t,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=function(){var s=new l.A(4);return l.A!=Float32Array&&(s[1]=0,s[2]=0),s[0]=1,s[3]=1,s}(),function(s,c,p){var g=c[0],y=c[1],x=c[2],S=c[3],I=Math.sin(p),A=Math.cos(p);s[0]=g*A+x*I,s[1]=y*A+S*I,s[2]=g*-I+x*A,s[3]=y*-I+S*A}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=l.ad(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const n=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this.tileZoom=Math.max(0,Math.floor(n)),this.scale=this.zoomScale(n),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,s){this._unmodified=!1,this._edgeInsets.interpolate(t,n,s),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new l.b6(0,t)];if(this._renderWorldCopies){const s=this.pointCoordinate(new l.P(0,0)),c=this.pointCoordinate(new l.P(this.width,0)),p=this.pointCoordinate(new l.P(this.width,this.height)),g=this.pointCoordinate(new l.P(0,this.height)),y=Math.floor(Math.min(s.x,c.x,p.x,g.x)),x=Math.floor(Math.max(s.x,c.x,p.x,g.x)),S=1;for(let I=y-S;I<=x+S;I++)I!==0&&n.push(new l.b6(I,t))}return n}coveringTiles(t){var n,s;let c=this.coveringZoomLevel(t);const p=c;if(t.minzoom!==void 0&&c<t.minzoom)return[];t.maxzoom!==void 0&&c>t.maxzoom&&(c=t.maxzoom);const g=this.pointCoordinate(this.getCameraPoint()),y=l.U.fromLngLat(this.center),x=Math.pow(2,c),S=[x*g.x,x*g.y,0],I=[x*y.x,x*y.y,0],A=Qi.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,c);let L=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(L=c);const U=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,N=Z=>({aabb:new ma([Z*x,0,0],[(Z+1)*x,x,0]),zoom:0,x:0,y:0,wrap:Z,fullyVisible:!1}),$=[],F=[],Q=c,se=t.reparseOverscaled?p:c;if(this._renderWorldCopies)for(let Z=1;Z<=3;Z++)$.push(N(-Z)),$.push(N(Z));for($.push(N(0));$.length>0;){const Z=$.pop(),ee=Z.x,le=Z.y;let ce=Z.fullyVisible;if(!ce){const Fe=Z.aabb.intersects(A);if(Fe===0)continue;ce=Fe===2}const me=t.terrain?S:I,ve=Z.aabb.distanceX(me),_e=Z.aabb.distanceY(me),be=Math.max(Math.abs(ve),Math.abs(_e));if(Z.zoom===Q||be>U+(1<<Q-Z.zoom)-2&&Z.zoom>=L){const Fe=Q-Z.zoom,mt=S[0]-.5-(ee<<Fe),Ce=S[1]-.5-(le<<Fe);F.push({tileID:new l.O(Z.zoom===Q?se:Z.zoom,Z.wrap,Z.zoom,ee,le),distanceSq:bt([I[0]-.5-ee,I[1]-.5-le]),tileDistanceToCamera:Math.sqrt(mt*mt+Ce*Ce)})}else for(let Fe=0;Fe<4;Fe++){const mt=(ee<<1)+Fe%2,Ce=(le<<1)+(Fe>>1),He=Z.zoom+1;let Ne=Z.aabb.quadrant(Fe);if(t.terrain){const Ft=new l.O(He,Z.wrap,He,mt,Ce),ut=t.terrain.getMinMaxElevation(Ft),nt=(n=ut.minElevation)!==null&&n!==void 0?n:this.elevation,ft=(s=ut.maxElevation)!==null&&s!==void 0?s:this.elevation;Ne=new ma([Ne.min[0],Ne.min[1],nt],[Ne.max[0],Ne.max[1],ft])}$.push({aabb:Ne,zoom:He,x:mt,y:Ce,wrap:Z.wrap,fullyVisible:ce})}}return F.sort((Z,ee)=>Z.distanceSq-ee.distanceSq).map(Z=>Z.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const n=l.ad(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new l.P(l.G(t.lng)*this.worldSize,l.H(n)*this.worldSize)}unproject(t){return new l.U(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const n=this.pointLocation(this.centerPoint,t),s=t.getElevationForLngLatZoom(n,this.tileZoom);if(!(this.elevation-s))return;const c=this.getCameraPosition(),p=l.U.fromLngLat(c.lngLat,c.altitude),g=l.U.fromLngLat(n,s),y=p.x-g.x,x=p.y-g.y,S=p.z-g.z,I=Math.sqrt(y*y+x*x+S*S),A=this.scaleZoom(this.cameraToCenterDistance/I/this.tileSize);this._elevation=s,this._center=n,this.zoom=A}setLocationAtPoint(t,n){const s=this.pointCoordinate(n),c=this.pointCoordinate(this.centerPoint),p=this.locationCoordinate(t),g=new l.U(p.x-(s.x-c.x),p.y-(s.y-c.y));this.center=this.coordinateLocation(g),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,n){return n?this.coordinatePoint(this.locationCoordinate(t),n.getElevationForLngLatZoom(t,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,n){return this.coordinateLocation(this.pointCoordinate(t,n))}locationCoordinate(t){return l.U.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,n){if(n){const L=n.pointCoordinate(t);if(L!=null)return L}const s=[t.x,t.y,0,1],c=[t.x,t.y,1,1];l.ag(s,s,this.pixelMatrixInverse),l.ag(c,c,this.pixelMatrixInverse);const p=s[3],g=c[3],y=s[1]/p,x=c[1]/g,S=s[2]/p,I=c[2]/g,A=S===I?0:(0-S)/(I-S);return new l.U(l.B.number(s[0]/p,c[0]/g,A)/this.worldSize,l.B.number(y,x,A)/this.worldSize)}coordinatePoint(t,n=0,s=this.pixelMatrix){const c=[t.x*this.worldSize,t.y*this.worldSize,n,1];return l.ag(c,c,s),new l.P(c[0]/c[3],c[1]/c[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new zt().extend(this.pointLocation(new l.P(0,t))).extend(this.pointLocation(new l.P(this.width,t))).extend(this.pointLocation(new l.P(this.width,this.height))).extend(this.pointLocation(new l.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new zt([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(t,n=!1){const s=t.key,c=n?this._alignedPosMatrixCache:this._posMatrixCache;if(c[s])return c[s];const p=t.canonical,g=this.worldSize/this.zoomScale(p.z),y=p.x+Math.pow(2,p.z)*t.wrap,x=l.ao(new Float64Array(16));return l.$(x,x,[y*g,p.y*g,0]),l.a0(x,x,[g/l.N,g/l.N,1]),l.a1(x,n?this.alignedProjMatrix:this.projMatrix,x),c[s]=new Float32Array(x),c[s]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t,n,s,c,p=-90,g=90,y=-180,x=180;const S=this.size,I=this._unmodified;if(this.latRange){const U=this.latRange;p=l.H(U[1])*this.worldSize,g=l.H(U[0])*this.worldSize,t=g-p<S.y?S.y/(g-p):0}if(this.lngRange){const U=this.lngRange;y=l.b5(l.G(U[0])*this.worldSize,0,this.worldSize),x=l.b5(l.G(U[1])*this.worldSize,0,this.worldSize),x<y&&(x+=this.worldSize),n=x-y<S.x?S.x/(x-y):0}const A=this.point,L=Math.max(n||0,t||0);if(L)return this.center=this.unproject(new l.P(n?(x+y)/2:A.x,t?(g+p)/2:A.y)),this.zoom+=this.scaleZoom(L),this._unmodified=I,void(this._constraining=!1);if(this.latRange){const U=A.y,N=S.y/2;U-N<p&&(c=p+N),U+N>g&&(c=g-N)}if(this.lngRange){const U=(y+x)/2,N=l.b5(A.x,U-this.worldSize/2,U+this.worldSize/2),$=S.x/2;N-$<y&&(s=y+$),N+$>x&&(s=x-$)}s===void 0&&c===void 0||(this.center=this.unproject(new l.P(s!==void 0?s:A.x,c!==void 0?c:A.y)).wrap()),this._unmodified=I,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,s=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=l.b7(1,this.center.lat)*this.worldSize;let c=l.ao(new Float64Array(16));l.a0(c,c,[this.width/2,-this.height/2,1]),l.$(c,c,[1,-1,0]),this.labelPlaneMatrix=c,c=l.ao(new Float64Array(16)),l.a0(c,c,[1,-1,1]),l.$(c,c,[-1,-1,0]),l.a0(c,c,[2/this.width,2/this.height,1]),this.glCoordMatrix=c;const p=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),g=Math.min(this.elevation,this._minEleveationForCurrentTile),y=p-g*this._pixelPerMeter/Math.cos(this._pitch),x=g<0?y:p,S=Math.PI/2+this._pitch,I=this._fov*(.5+t.y/this.height),A=Math.sin(I)*x/Math.sin(l.ad(Math.PI-S-I,.01,Math.PI-.01)),L=this.getHorizon(),U=2*Math.atan(L/this.cameraToCenterDistance)*(.5+t.y/(2*L)),N=Math.sin(U)*x/Math.sin(l.ad(Math.PI-S-U,.01,Math.PI-.01)),$=Math.min(A,N),F=1.01*(Math.cos(Math.PI/2-this._pitch)*$+x),Q=this.height/50;c=new Float64Array(16),l.b8(c,this._fov,this.width/this.height,Q,F),c[8]=2*-t.x/this.width,c[9]=2*t.y/this.height,l.a0(c,c,[1,-1,1]),l.$(c,c,[0,0,-this.cameraToCenterDistance]),l.b9(c,c,this._pitch),l.ae(c,c,this.angle),l.$(c,c,[-n,-s,0]),this.mercatorMatrix=l.a0([],c,[this.worldSize,this.worldSize,this.worldSize]),l.a0(c,c,[1,1,this._pixelPerMeter]),this.pixelMatrix=l.a1(new Float64Array(16),this.labelPlaneMatrix,c),l.$(c,c,[0,0,-this.elevation]),this.projMatrix=c,this.invProjMatrix=l.as([],c),this.pixelMatrix3D=l.a1(new Float64Array(16),this.labelPlaneMatrix,c);const se=this.width%2/2,Z=this.height%2/2,ee=Math.cos(this.angle),le=Math.sin(this.angle),ce=n-Math.round(n)+ee*se+le*Z,me=s-Math.round(s)+ee*Z+le*se,ve=new Float64Array(c);if(l.$(ve,ve,[ce>.5?ce-1:ce,me>.5?me-1:me,0]),this.alignedProjMatrix=ve,c=l.as(new Float64Array(16),this.pixelMatrix),!c)throw new Error("failed to invert matrix");this.pixelMatrixInverse=c,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new l.P(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return l.ag(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new l.P(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let s=n.x,c=n.y,p=n.x,g=n.y;for(const y of t)s=Math.min(s,y.x),c=Math.min(c,y.y),p=Math.max(p,y.x),g=Math.max(g,y.y);return[new l.P(s,c),new l.P(p,c),new l.P(p,g),new l.P(s,g),new l.P(s,c)]}}}function jn(h,t){let n,s=!1,c=null,p=null;const g=()=>{c=null,s&&(h.apply(p,n),c=setTimeout(g,t),s=!1)};return(...y)=>(s=!0,p=this,n=y,c||g(),c)}class ja{constructor(t){this._getCurrentHash=()=>{const n=window.location.hash.replace("#","");if(this._hashName){let s;return n.split("&").map(c=>c.split("=")).forEach(c=>{c[0]===this._hashName&&(s=c)}),(s&&s[1]||"").split("/")}return n.split("/")},this._onHashChange=()=>{const n=this._getCurrentHash();if(n.length>=3&&!n.some(s=>isNaN(s))){const s=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:s,pitch:+(n[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const n=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,n)}catch{}},this._updateHash=jn(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){const n=this._map.getCenter(),s=Math.round(100*this._map.getZoom())/100,c=Math.ceil((s*Math.LN2+Math.log(512/360/.5))/Math.LN10),p=Math.pow(10,c),g=Math.round(n.lng*p)/p,y=Math.round(n.lat*p)/p,x=this._map.getBearing(),S=this._map.getPitch();let I="";if(I+=t?`/${g}/${y}/${s}`:`${s}/${y}/${g}`,(x||S)&&(I+="/"+Math.round(10*x)/10),S&&(I+=`/${Math.round(S)}`),this._hashName){const A=this._hashName;let L=!1;const U=window.location.hash.slice(1).split("&").map(N=>{const $=N.split("=")[0];return $===A?(L=!0,`${$}=${I}`):N}).filter(N=>N);return L||U.push(`${A}=${I}`),`#${U.join("&")}`}return`#${I}`}}const fa={linearity:.3,easing:l.ba(0,0,.3,1)},$l=l.e({deceleration:2500,maxSpeed:1400},fa),jl=l.e({deceleration:20,maxSpeed:1400},fa),Gl=l.e({deceleration:1e3,maxSpeed:360},fa),ql=l.e({deceleration:1e3,maxSpeed:90},fa);class Zl{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:l.h.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=l.h.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new l.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,p.panDelta&&n.pan._add(p.panDelta),p.around&&(n.around=p.around),p.pinchAround&&(n.pinchAround=p.pinchAround);const s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,c={};if(n.pan.mag()){const p=Ga(n.pan.mag(),s,l.e({},$l,t||{}));c.offset=n.pan.mult(p.amount/n.pan.mag()),c.center=this._map.transform.center,Zr(c,p)}if(n.zoom){const p=Ga(n.zoom,s,jl);c.zoom=this._map.transform.zoom+p.amount,Zr(c,p)}if(n.bearing){const p=Ga(n.bearing,s,Gl);c.bearing=this._map.transform.bearing+l.ad(p.amount,-179,179),Zr(c,p)}if(n.pitch){const p=Ga(n.pitch,s,ql);c.pitch=this._map.transform.pitch+p.amount,Zr(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(),l.e(c,{noMoveStart:!0})}}function Zr(h,t){(!h.duration||h.duration<t.duration)&&(h.duration=t.duration,h.easing=t.easing)}function Ga(h,t,n){const{maxSpeed:s,linearity:c,deceleration:p}=n,g=l.ad(h*c/(t/1e3),-s,s),y=Math.abs(g)/(p*c);return{easing:n.easing,duration:1e3*y,amount:g*(y/2)}}class hr extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,s,c={}){const p=H.mousePos(n.getCanvasContainer(),s),g=n.unproject(p);super(t,l.e({point:p,lngLat:g,originalEvent:s},c)),this._defaultPrevented=!1,this.target=n}}class qa extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,s){const c=t==="touchend"?s.changedTouches:s.touches,p=H.touchPos(n.getCanvasContainer(),c),g=p.map(x=>n.unproject(x)),y=p.reduce((x,S,I,A)=>x.add(S.div(A.length)),new l.P(0,0));super(t,{points:p,point:y,lngLats:g,lngLat:n.unproject(y),originalEvent:s}),this._defaultPrevented=!1}}class Hl extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,s){super(t,{originalEvent:s}),this._defaultPrevented=!1}}class Wl{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Hl(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new hr(t.type,this._map,t))}mouseup(t){this._map.fire(new hr(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new hr(t.type,this._map,t))}dblclick(t){return this._firePreventable(new hr(t.type,this._map,t))}mouseover(t){this._map.fire(new hr(t.type,this._map,t))}mouseout(t){this._map.fire(new hr(t.type,this._map,t))}touchstart(t){return this._firePreventable(new qa(t.type,this._map,t))}touchmove(t){this._map.fire(new qa(t.type,this._map,t))}touchend(t){this._map.fire(new qa(t.type,this._map,t))}touchcancel(t){this._map.fire(new qa(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Kl{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new hr(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new hr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new hr(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class sn{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.pointLocation(l.P.convert(t),this._map.terrain)}}class Xl{constructor(t,n){this._map=t,this._tr=new sn(t),this._el=t.getCanvasContainer(),this._container=t.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(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(H.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const s=n;if(this._lastPos.equals(s)||!this._box&&s.dist(this._startPos)<this._clickTolerance)return;const c=this._startPos;this._lastPos=s,this._box||(this._box=H.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const p=Math.min(c.x,s.x),g=Math.max(c.x,s.x),y=Math.min(c.y,s.y),x=Math.max(c.y,s.y);H.setTransform(this._box,`translate(${p}px,${y}px)`),this._box.style.width=g-p+"px",this._box.style.height=x-y+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const s=this._startPos,c=n;if(this.reset(),H.suppressClick(),s.x!==c.x||s.y!==c.y)return this._map.fire(new l.k("boxzoomend",{originalEvent:t})),{cameraAnimation:p=>p.fitScreenCoordinates(s,c,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(H.remove(this._box),this._box=null),H.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new l.k(t,{originalEvent:n}))}}function Ar(h,t){if(h.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${h.length}, points ${t.length}`);const n={};for(let s=0;s<h.length;s++)n[h[s].identifier]=t[s];return n}class on{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,s){(this.centroid||s.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),s.length===this.numTouches&&(this.centroid=function(c){const p=new l.P(0,0);for(const g of c)p._add(g);return p.div(c.length)}(n),this.touches=Ar(s,n)))}touchmove(t,n,s){if(this.aborted||!this.centroid)return;const c=Ar(s,n);for(const p in this.touches){const g=c[p];(!g||g.dist(this.touches[p])>30)&&(this.aborted=!0)}}touchend(t,n,s){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),s.length===0){const c=!this.aborted&&this.centroid;if(this.reset(),c)return c}}}class Ms{constructor(t){this.singleTap=new on(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,s){this.singleTap.touchstart(t,n,s)}touchmove(t,n,s){this.singleTap.touchmove(t,n,s)}touchend(t,n,s){const c=this.singleTap.touchend(t,n,s);if(c){const p=t.timeStamp-this.lastTime<500,g=!this.lastTap||this.lastTap.dist(c)<30;if(p&&g||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=c,this.count===this.numTaps)return this.reset(),c}}}class ln{constructor(t){this._tr=new sn(t),this._zoomIn=new Ms({numTouches:1,numTaps:2}),this._zoomOut=new Ms({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,s){this._zoomIn.touchstart(t,n,s),this._zoomOut.touchstart(t,n,s)}touchmove(t,n,s){this._zoomIn.touchmove(t,n,s),this._zoomOut.touchmove(t,n,s)}touchend(t,n,s){const c=this._zoomIn.touchend(t,n,s),p=this._zoomOut.touchend(t,n,s),g=this._tr;return c?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.easeTo({duration:300,zoom:g.zoom+1,around:g.unproject(c)},{originalEvent:t})}):p?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.easeTo({duration:300,zoom:g.zoom-1,around:g.unproject(p)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class cn{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const n=this._moveFunction(...t);if(n.bearingDelta||n.pitchDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(t,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=n.length?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,n){if(!this.isEnabled())return;const s=this._lastPoint;if(!s)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const c=n.length?n[0]:n;return!this._moved&&c.dist(s)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=c,this._move(s,c))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&H.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const yh={0:1,2:2};class wo{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const n=H.mouseButton(t);this._eventButton=n}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!function(n,s){const c=yh[s];return n.buttons===void 0||(n.buttons&c)!==c}(t,this._eventButton)}isValidEndEvent(t){return H.mouseButton(t)===this._eventButton}}class Yl{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return t.targetTouches.length===1}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}const Ls=h=>{h.mousedown=h.dragStart,h.mousemoveWindow=h.dragMove,h.mouseup=h.dragEnd,h.contextmenu=function(t){t.preventDefault()}},ga=({enable:h,clickTolerance:t,bearingDegreesPerPixelMoved:n=.8})=>{const s=new wo({checkCorrectEvent:c=>H.mouseButton(c)===0&&c.ctrlKey||H.mouseButton(c)===2});return new cn({clickTolerance:t,move:(c,p)=>({bearingDelta:(p.x-c.x)*n}),moveStateManager:s,enable:h,assignEvents:Ls})},hn=({enable:h,clickTolerance:t,pitchDegreesPerPixelMoved:n=-.5})=>{const s=new wo({checkCorrectEvent:c=>H.mouseButton(c)===0&&c.ctrlKey||H.mouseButton(c)===2});return new cn({clickTolerance:t,move:(c,p)=>({pitchDelta:(p.y-c.y)*n}),moveStateManager:s,enable:h,assignEvents:Ls})};class ze{constructor(t,n){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new l.P(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(t,n,s){return this._calculateTransform(t,n,s)}touchmove(t,n,s){if(this._map._cooperativeGestures&&(this._minTouches===2&&s.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,s.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(s.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,n,s)}touchend(t,n,s){this._calculateTransform(t,n,s),this._active&&s.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,s){s.length>0&&(this._active=!0);const c=Ar(s,n),p=new l.P(0,0),g=new l.P(0,0);let y=0;for(const S in c){const I=c[S],A=this._touches[S];A&&(p._add(I),g._add(I.sub(A)),y++,c[S]=I)}if(this._touches=c,y<this._minTouches||!g.mag())return;const x=g.div(y);return this._sum._add(x),this._sum.mag()<this._clickTolerance?void 0:{around:p.div(y),panDelta:x}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class zs{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,n,s){this._firstTwoTouches||s.length<2||(this._firstTwoTouches=[s[0].identifier,s[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,s){if(!this._firstTwoTouches)return;t.preventDefault();const[c,p]=this._firstTwoTouches,g=Cn(s,n,c),y=Cn(s,n,p);if(!g||!y)return;const x=this._aroundCenter?null:g.add(y).div(2);return this._move([g,y],x,t)}touchend(t,n,s){if(!this._firstTwoTouches)return;const[c,p]=this._firstTwoTouches,g=Cn(s,n,c),y=Cn(s,n,p);g&&y||(this._active&&H.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Cn(h,t,n){for(let s=0;s<h.length;s++)if(h[s].identifier===n)return t[s]}function ya(h,t){return Math.log(h/t)/Math.LN2}class Jl extends zs{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const s=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(ya(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:ya(this._distance,s),pinchAround:n}}}function Me(h,t){return 180*h.angleWith(t)/Math.PI}class So extends zs{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,n){const s=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Me(this._vector,s),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,s=Me(t,this._startVector);return Math.abs(s)<n}}function To(h){return Math.abs(h.y)>Math.abs(h.x)}class _h extends zs{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,s){super.touchstart(t,n,s),this._currentTouchCount=s.length}_start(t){this._lastPoints=t,To(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,s){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const c=t[0].sub(this._lastPoints[0]),p=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(c,p,s.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(c.y+p.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,s){if(this._valid!==void 0)return this._valid;const c=t.mag()>=2,p=n.mag()>=2;if(!c&&!p)return;if(!c||!p)return this._firstMove===void 0&&(this._firstMove=s),s-this._firstMove<100&&void 0;const g=t.y>0==n.y>0;return To(t)&&To(n)&&g}}const Io={panStep:100,bearingStep:15,pitchStep:10};class Ql{constructor(t){this._tr=new sn(t);const n=Io;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,s=0,c=0,p=0,g=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?s=-1:(t.preventDefault(),p=-1);break;case 39:t.shiftKey?s=1:(t.preventDefault(),p=1);break;case 38:t.shiftKey?c=1:(t.preventDefault(),g=-1);break;case 40:t.shiftKey?c=-1:(t.preventDefault(),g=1);break;default:return}return this._rotationDisabled&&(s=0,c=0),{cameraAnimation:y=>{const x=this._tr;y.easeTo({duration:300,easeId:"keyboardHandler",easing:ec,zoom:n?Math.round(x.zoom)+n*(t.shiftKey?2:1):x.zoom,bearing:x.bearing+s*this._bearingStep,pitch:x.pitch+c*this._pitchStep,offset:[-p*this._panStep,-g*this._panStep],center:x.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function ec(h){return h*(2-h)}const tc=4.000244140625;class vh{constructor(t,n){this._onTimeout=s=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(s)},this._map=t,this._tr=new sn(t),this._el=t.getCanvasContainer(),this._triggerRenderFrame=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!t[this._map._metaKey])return;t.preventDefault()}let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const s=l.h.now(),c=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,n!==0&&n%tc==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,t)):this._type||(this._type=Math.abs(c*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=H.mousePos(this._el,t),s=this._tr;this._around=l.L.convert(this._aroundCenter?s.center:s.unproject(n)),this._aroundPoint=s.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._tr.transform;if(this._delta!==0){const y=this._type==="wheel"&&Math.abs(this._delta)>tc?this._wheelZoomRate:this._defaultZoomRate;let x=2/(1+Math.exp(-Math.abs(this._delta*y)));this._delta<0&&x!==0&&(x=1/x);const S=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(S*x))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,s=this._startZoom,c=this._easing;let p,g=!1;if(this._type==="wheel"&&s&&c){const y=Math.min((l.h.now()-this._lastWheelEventTime)/200,1),x=c(y);p=l.B.number(s,n,x),y<1?this._frameId||(this._frameId=!0):g=!0}else p=n,g=!0;return this._active=!0,g&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!g,zoomDelta:p-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=l.bb;if(this._prevEase){const s=this._prevEase,c=(l.h.now()-s.start)/s.duration,p=s.easing(c+.01)-s.easing(c),g=.27/Math.sqrt(p*p+1e-4)*.01,y=Math.sqrt(.0729-g*g);n=l.ba(g,y,.25,1)}return this._prevEase={start:l.h.now(),duration:t,easing:n},n}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Ao{constructor(t,n){this._clickZoom=t,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 Co{constructor(t){this._tr=new sn(t),this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:s=>{s.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Eo{constructor(){this._tap=new Ms({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,n,s){if(!this._swipePoint)if(this._tapTime){const c=n[0],p=t.timeStamp-this._tapTime<500,g=this._tapPoint.dist(c)<30;p&&g?s.length>0&&(this._swipePoint=c,this._swipeTouch=s[0].identifier):this.reset()}else this._tap.touchstart(t,n,s)}touchmove(t,n,s){if(this._tapTime){if(this._swipePoint){if(s[0].identifier!==this._swipeTouch)return;const c=n[0],p=c.y-this._swipePoint.y;return this._swipePoint=c,t.preventDefault(),this._active=!0,{zoomDelta:p/128}}}else this._tap.touchmove(t,n,s)}touchend(t,n,s){if(this._tapTime)this._swipePoint&&s.length===0&&this.reset();else{const c=this._tap.touchend(t,n,s);c&&(this._tapTime=t.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 Po{constructor(t,n,s){this._el=t,this._mousePan=n,this._touchPan=s}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class er{constructor(t,n,s){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,this._mousePitch=s}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class En{constructor(t,n,s,c){this._el=t,this._touchZoom=n,this._touchRotate=s,this._tapDragZoom=c,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const Za=h=>h.zoom||h.drag||h.pitch||h.rotate;class ko extends l.k{}function Ha(h){return h.panDelta&&h.panDelta.mag()||h.zoomDelta||h.bearingDelta||h.pitchDelta}class Mo{constructor(t,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 g=c.type==="renderFrame"?void 0:c,y={needsRenderFrame:!1},x={},S={},I=c.touches,A=I?this._getMapTouches(I):void 0,L=A?H.touchPos(this._el,A):H.mousePos(this._el,c);for(const{handlerName:$,handler:F,allowed:Q}of this._handlers){if(!F.isEnabled())continue;let se;this._blockedByActive(S,Q,$)?F.reset():F[p||c.type]&&(se=F[p||c.type](c,L,A),this.mergeHandlerResult(y,x,se,$,g),se&&se.needsRenderFrame&&this._triggerRenderFrame()),(se||F.isActive())&&(S[$]=F)}const U={};for(const $ in this._previousActiveHandlers)S[$]||(U[$]=g);this._previousActiveHandlers=S,(Object.keys(U).length||Ha(y))&&(this._changes.push([y,x,U]),this._triggerRenderFrame()),(Object.keys(S).length||Ha(y))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:N}=y;N&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],N(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Zl(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);const s=this._el;this._listeners=[[s,"touchstart",{passive:!0}],[s,"touchmove",{passive:!1}],[s,"touchend",void 0],[s,"touchcancel",void 0],[s,"mousedown",void 0],[s,"mousemove",void 0],[s,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[s,"mouseover",void 0],[s,"mouseout",void 0],[s,"dblclick",void 0],[s,"click",void 0],[s,"keydown",{capture:!1}],[s,"keyup",void 0],[s,"wheel",{passive:!1}],[s,"contextmenu",void 0],[window,"blur",void 0]];for(const[c,p,g]of this._listeners)H.addEventListener(c,p,c===document?this.handleWindowEvent:this.handleEvent,g)}destroy(){for(const[t,n,s]of this._listeners)H.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(t){const n=this._map,s=n.getCanvasContainer();this._add("mapEvent",new Wl(n,t));const c=n.boxZoom=new Xl(n,t);this._add("boxZoom",c),t.interactive&&t.boxZoom&&c.enable();const p=new ln(n),g=new Co(n);n.doubleClickZoom=new Ao(g,p),this._add("tapZoom",p),this._add("clickZoom",g),t.interactive&&t.doubleClickZoom&&n.doubleClickZoom.enable();const y=new Eo;this._add("tapDragZoom",y);const x=n.touchPitch=new _h(n);this._add("touchPitch",x),t.interactive&&t.touchPitch&&n.touchPitch.enable(t.touchPitch);const S=ga(t),I=hn(t);n.dragRotate=new er(t,S,I),this._add("mouseRotate",S,["mousePitch"]),this._add("mousePitch",I,["mouseRotate"]),t.interactive&&t.dragRotate&&n.dragRotate.enable();const A=(({enable:Q,clickTolerance:se})=>{const Z=new wo({checkCorrectEvent:ee=>H.mouseButton(ee)===0&&!ee.ctrlKey});return new cn({clickTolerance:se,move:(ee,le)=>({around:le,panDelta:le.sub(ee)}),activateOnStart:!0,moveStateManager:Z,enable:Q,assignEvents:Ls})})(t),L=new ze(t,n);n.dragPan=new Po(s,A,L),this._add("mousePan",A),this._add("touchPan",L,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&n.dragPan.enable(t.dragPan);const U=new So,N=new Jl;n.touchZoomRotate=new En(s,N,U,y),this._add("touchRotate",U,["touchPan","touchZoom"]),this._add("touchZoom",N,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&n.touchZoomRotate.enable(t.touchZoomRotate);const $=n.scrollZoom=new vh(n,()=>this._triggerRenderFrame());this._add("scrollZoom",$,["mousePan"]),t.interactive&&t.scrollZoom&&n.scrollZoom.enable(t.scrollZoom);const F=n.keyboard=new Ql(n);this._add("keyboard",F),t.interactive&&t.keyboard&&n.keyboard.enable(),this._add("blockableMapEvent",new Kl(n))}_add(t,n,s){this._handlers.push({handlerName:t,handler:n,allowed:s}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Za(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,n,s){for(const c in t)if(c!==s&&(!n||n.indexOf(c)<0))return!0;return!1}_getMapTouches(t){const n=[];for(const s of t)this._el.contains(s.target)&&n.push(s);return n}mergeHandlerResult(t,n,s,c,p){if(!s)return;l.e(t,s);const g={handlerName:c,originalEvent:s.originalEvent||p};s.zoomDelta!==void 0&&(n.zoom=g),s.panDelta!==void 0&&(n.drag=g),s.pitchDelta!==void 0&&(n.pitch=g),s.bearingDelta!==void 0&&(n.rotate=g)}_applyChanges(){const t={},n={},s={};for(const[c,p,g]of this._changes)c.panDelta&&(t.panDelta=(t.panDelta||new l.P(0,0))._add(c.panDelta)),c.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+c.zoomDelta),c.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+c.bearingDelta),c.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+c.pitchDelta),c.around!==void 0&&(t.around=c.around),c.pinchAround!==void 0&&(t.pinchAround=c.pinchAround),c.noInertia&&(t.noInertia=c.noInertia),l.e(n,p),l.e(s,g);this._updateMapTransform(t,n,s),this._changes=[]}_updateMapTransform(t,n,s){const c=this._map,p=c._getTransformForUpdate(),g=c.terrain;if(!(Ha(t)||g&&this._terrainMovement))return this._fireEvents(n,s,!0);let{panDelta:y,zoomDelta:x,bearingDelta:S,pitchDelta:I,around:A,pinchAround:L}=t;L!==void 0&&(A=L),c._stop(!0),A=A||c.transform.centerPoint;const U=p.pointLocation(y?A.sub(y):A);S&&(p.bearing+=S),I&&(p.pitch+=I),x&&(p.zoom+=x),g?this._terrainMovement||!n.drag&&!n.zoom?n.drag&&this._terrainMovement?p.center=p.pointLocation(p.centerPoint.sub(y)):p.setLocationAtPoint(U,A):(this._terrainMovement=!0,this._map._elevationFreeze=!0,p.setLocationAtPoint(U,A),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,p.recalculateZoom(c.terrain)})):p.setLocationAtPoint(U,A),c._applyUpdatedTransform(p),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,s,!0)}_fireEvents(t,n,s){const c=Za(this._eventsInProgress),p=Za(t),g={};for(const I in t){const{originalEvent:A}=t[I];this._eventsInProgress[I]||(g[`${I}start`]=A),this._eventsInProgress[I]=t[I]}!c&&p&&this._fireEvent("movestart",p.originalEvent);for(const I in g)this._fireEvent(I,g[I]);p&&this._fireEvent("move",p.originalEvent);for(const I in t){const{originalEvent:A}=t[I];this._fireEvent(I,A)}const y={};let x;for(const I in this._eventsInProgress){const{handlerName:A,originalEvent:L}=this._eventsInProgress[I];this._handlersById[A].isActive()||(delete this._eventsInProgress[I],x=n[A]||L,y[`${I}end`]=x)}for(const I in y)this._fireEvent(I,y[I]);const S=Za(this._eventsInProgress);if(s&&(c||p)&&!S){this._updatingCamera=!0;const I=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),A=L=>L!==0&&-this._bearingSnap<L&&L<this._bearingSnap;!I||!I.essential&&l.h.prefersReducedMotion?(this._map.fire(new l.k("moveend",{originalEvent:x})),A(this._map.getBearing())&&this._map.resetNorth()):(A(I.bearing||this._map.getBearing())&&(I.bearing=0),I.freezeElevation=!0,this._map.easeTo(I,{originalEvent:x})),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new l.k(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new ko("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class ic extends l.E{constructor(t,n){super(),this._renderFrameCallback=()=>{const s=Math.min((l.h.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(s)),s<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new l.L(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,s){return t=l.P.convert(t).mult(-1),this.panTo(this.transform.center,l.e({offset:t},n),s)}panTo(t,n,s){return this.easeTo(l.e({center:t},n),s)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,s){return this.easeTo(l.e({zoom:t},n),s)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,s){return this.easeTo(l.e({bearing:t},n),s)}resetNorth(t,n){return this.rotateTo(0,l.e({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(l.e({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}cameraForBounds(t,n){t=zt.convert(t);const s=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),s,n)}_cameraForBoxAndBearing(t,n,s,c){const p={top:0,bottom:0,right:0,left:0};if(typeof(c=l.e({padding:p,offset:[0,0],maxZoom:this.transform.maxZoom},c)).padding=="number"){const le=c.padding;c.padding={top:le,bottom:le,right:le,left:le}}c.padding=l.e(p,c.padding);const g=this.transform,y=g.padding,x=g.project(l.L.convert(t)),S=g.project(l.L.convert(n)),I=x.rotate(-s*Math.PI/180),A=S.rotate(-s*Math.PI/180),L=new l.P(Math.max(I.x,A.x),Math.max(I.y,A.y)),U=new l.P(Math.min(I.x,A.x),Math.min(I.y,A.y)),N=L.sub(U),$=(g.width-(y.left+y.right+c.padding.left+c.padding.right))/N.x,F=(g.height-(y.top+y.bottom+c.padding.top+c.padding.bottom))/N.y;if(F<0||$<0)return void l.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const Q=Math.min(g.scaleZoom(g.scale*Math.min($,F)),c.maxZoom),se=l.P.convert(c.offset),Z=new l.P((c.padding.left-c.padding.right)/2,(c.padding.top-c.padding.bottom)/2).rotate(s*Math.PI/180),ee=se.add(Z).mult(g.scale/g.zoomScale(Q));return{center:g.unproject(x.add(S).div(2).sub(ee)),zoom:Q,bearing:s}}fitBounds(t,n,s){return this._fitInternal(this.cameraForBounds(t,n),n,s)}fitScreenCoordinates(t,n,s,c,p){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(l.P.convert(t)),this.transform.pointLocation(l.P.convert(n)),s,c),c,p)}_fitInternal(t,n,s){return t?(delete(n=l.e(t,n)).padding,n.linear?this.easeTo(n,s):this.flyTo(n,s)):this}jumpTo(t,n){this.stop();const s=this._getTransformForUpdate();let c=!1,p=!1,g=!1;return"zoom"in t&&s.zoom!==+t.zoom&&(c=!0,s.zoom=+t.zoom),t.center!==void 0&&(s.center=l.L.convert(t.center)),"bearing"in t&&s.bearing!==+t.bearing&&(p=!0,s.bearing=+t.bearing),"pitch"in t&&s.pitch!==+t.pitch&&(g=!0,s.pitch=+t.pitch),t.padding==null||s.isPaddingEqual(t.padding)||(s.padding=t.padding),this._applyUpdatedTransform(s),this.fire(new l.k("movestart",n)).fire(new l.k("move",n)),c&&this.fire(new l.k("zoomstart",n)).fire(new l.k("zoom",n)).fire(new l.k("zoomend",n)),p&&this.fire(new l.k("rotatestart",n)).fire(new l.k("rotate",n)).fire(new l.k("rotateend",n)),g&&this.fire(new l.k("pitchstart",n)).fire(new l.k("pitch",n)).fire(new l.k("pitchend",n)),this.fire(new l.k("moveend",n))}calculateCameraOptionsFromTo(t,n,s,c=0){const p=l.U.fromLngLat(t,n),g=l.U.fromLngLat(s,c),y=g.x-p.x,x=g.y-p.y,S=g.z-p.z,I=Math.hypot(y,x,S);if(I===0)throw new Error("Can't calculate camera options with same From and To");const A=Math.hypot(y,x),L=this.transform.scaleZoom(this.transform.cameraToCenterDistance/I/this.transform.tileSize),U=180*Math.atan2(y,-x)/Math.PI;let N=180*Math.acos(A/I)/Math.PI;return N=S<0?90-N:90+N,{center:g.toLngLat(),zoom:L,pitch:N,bearing:U}}easeTo(t,n){this._stop(!1,t.easeId),((t=l.e({offset:[0,0],duration:500,easing:l.bb},t)).animate===!1||!t.essential&&l.h.prefersReducedMotion)&&(t.duration=0);const s=this._getTransformForUpdate(),c=this.getZoom(),p=this.getBearing(),g=this.getPitch(),y=this.getPadding(),x="zoom"in t?+t.zoom:c,S="bearing"in t?this._normalizeBearing(t.bearing,p):p,I="pitch"in t?+t.pitch:g,A="padding"in t?t.padding:s.padding,L=l.P.convert(t.offset);let U=s.centerPoint.add(L);const N=s.pointLocation(U),$=l.L.convert(t.center||N);this._normalizeCenter($);const F=s.project(N),Q=s.project($).sub(F),se=s.zoomScale(x-c);let Z,ee;t.around&&(Z=l.L.convert(t.around),ee=s.locationPoint(Z));const le={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||x!==c,this._rotating=this._rotating||p!==S,this._pitching=this._pitching||I!==g,this._padding=!s.isPaddingEqual(A),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,le),this.terrain&&this._prepareElevation($),this._ease(ce=>{if(this._zooming&&(s.zoom=l.B.number(c,x,ce)),this._rotating&&(s.bearing=l.B.number(p,S,ce)),this._pitching&&(s.pitch=l.B.number(g,I,ce)),this._padding&&(s.interpolatePadding(y,A,ce),U=s.centerPoint.add(L)),this.terrain&&!t.freezeElevation&&this._updateElevation(ce),Z)s.setLocationAtPoint(Z,ee);else{const me=s.zoomScale(s.zoom-c),ve=x>c?Math.min(2,se):Math.max(.5,se),_e=Math.pow(ve,1-ce),be=s.unproject(F.add(Q.mult(ce*_e)).mult(me));s.setLocationAtPoint(s.renderWorldCopies?be.wrap():be,U)}this._applyUpdatedTransform(s),this._fireMoveEvents(n)},ce=>{this.terrain&&this._finalizeElevation(),this._afterEase(n,ce)},t),this}_prepareEase(t,n,s={}){this._moving=!0,n||s.moving||this.fire(new l.k("movestart",t)),this._zooming&&!s.zooming&&this.fire(new l.k("zoomstart",t)),this._rotating&&!s.rotating&&this.fire(new l.k("rotatestart",t)),this._pitching&&!s.pitching&&this.fire(new l.k("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&n!==this._elevationTarget){const s=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(s-(n-(s*t+this._elevationStart))/(1-t)),this._elevationTarget=n}this.transform.elevation=l.B.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(t){if(!this.transformCameraUpdate)return;const n=t.clone(),{center:s,zoom:c,pitch:p,bearing:g,elevation:y}=this.transformCameraUpdate(n);s&&(n.center=s),c!==void 0&&(n.zoom=c),p!==void 0&&(n.pitch=p),g!==void 0&&(n.bearing=g),y!==void 0&&(n.elevation=y),this.transform.apply(n)}_fireMoveEvents(t){this.fire(new l.k("move",t)),this._zooming&&this.fire(new l.k("zoom",t)),this._rotating&&this.fire(new l.k("rotate",t)),this._pitching&&this.fire(new l.k("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const s=this._zooming,c=this._rotating,p=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,s&&this.fire(new l.k("zoomend",t)),c&&this.fire(new l.k("rotateend",t)),p&&this.fire(new l.k("pitchend",t)),this.fire(new l.k("moveend",t))}flyTo(t,n){if(!t.essential&&l.h.prefersReducedMotion){const Ne=l.F(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Ne,n)}this.stop(),t=l.e({offset:[0,0],speed:1.2,curve:1.42,easing:l.bb},t);const s=this._getTransformForUpdate(),c=this.getZoom(),p=this.getBearing(),g=this.getPitch(),y=this.getPadding(),x="zoom"in t?l.ad(+t.zoom,s.minZoom,s.maxZoom):c,S="bearing"in t?this._normalizeBearing(t.bearing,p):p,I="pitch"in t?+t.pitch:g,A="padding"in t?t.padding:s.padding,L=s.zoomScale(x-c),U=l.P.convert(t.offset);let N=s.centerPoint.add(U);const $=s.pointLocation(N),F=l.L.convert(t.center||$);this._normalizeCenter(F);const Q=s.project($),se=s.project(F).sub(Q);let Z=t.curve;const ee=Math.max(s.width,s.height),le=ee/L,ce=se.mag();if("minZoom"in t){const Ne=l.ad(Math.min(t.minZoom,c,x),s.minZoom,s.maxZoom),Ft=ee/s.zoomScale(Ne-c);Z=Math.sqrt(Ft/ce*2)}const me=Z*Z;function ve(Ne){const Ft=(le*le-ee*ee+(Ne?-1:1)*me*me*ce*ce)/(2*(Ne?le:ee)*me*ce);return Math.log(Math.sqrt(Ft*Ft+1)-Ft)}function _e(Ne){return(Math.exp(Ne)-Math.exp(-Ne))/2}function be(Ne){return(Math.exp(Ne)+Math.exp(-Ne))/2}const Fe=ve(!1);let mt=function(Ne){return be(Fe)/be(Fe+Z*Ne)},Ce=function(Ne){return ee*((be(Fe)*(_e(Ft=Fe+Z*Ne)/be(Ft))-_e(Fe))/me)/ce;var Ft},He=(ve(!0)-Fe)/Z;if(Math.abs(ce)<1e-6||!isFinite(He)){if(Math.abs(ee-le)<1e-6)return this.easeTo(t,n);const Ne=le<ee?-1:1;He=Math.abs(Math.log(le/ee))/Z,Ce=function(){return 0},mt=function(Ft){return Math.exp(Ne*Z*Ft)}}return t.duration="duration"in t?+t.duration:1e3*He/("screenSpeed"in t?+t.screenSpeed/Z:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=p!==S,this._pitching=I!==g,this._padding=!s.isPaddingEqual(A),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(F),this._ease(Ne=>{const Ft=Ne*He,ut=1/mt(Ft);s.zoom=Ne===1?x:c+s.scaleZoom(ut),this._rotating&&(s.bearing=l.B.number(p,S,Ne)),this._pitching&&(s.pitch=l.B.number(g,I,Ne)),this._padding&&(s.interpolatePadding(y,A,Ne),N=s.centerPoint.add(U)),this.terrain&&!t.freezeElevation&&this._updateElevation(Ne);const nt=Ne===1?F:s.unproject(Q.add(se.mult(Ce(Ft))).mult(ut));s.setLocationAtPoint(s.renderWorldCopies?nt.wrap():nt,N),this._applyUpdatedTransform(s),this._fireMoveEvents(n)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(n)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const s=this._onEaseEnd;delete this._onEaseEnd,s.call(this,n)}if(!t){const s=this.handlers;s&&s.stop(!1)}return this}_ease(t,n,s){s.animate===!1||s.duration===0?(t(1),n()):(this._easeStart=l.h.now(),this._easeOptions=s,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,n){t=l.b5(t,-180,180);const s=Math.abs(t-n);return Math.abs(t-360-n)<s&&(t-=360),Math.abs(t+360-n)<s&&(t+=360),t}_normalizeCenter(t){const n=this.transform;if(!n.renderWorldCopies||n.lngRange)return;const s=t.lng-n.center.lng;t.lng+=s>180?-360:s<-180?360:0}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(l.L.convert(t),this.transform.tileZoom)-this.transform.elevation:null}}class ur{constructor(t={}){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=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=H.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=H.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=H.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(){H.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,n){const s=this._map._getUIString(`AttributionControl.${n}`);t.title=s,t.setAttribute("aria-label",s)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(c=>typeof c!="string"?"":c)):typeof this.options.customAttribution=="string"&&t.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.sourceCaches;for(const c in n){const p=n[c];if(p.used||p.usedForTerrain){const g=p.getSource();g.attribution&&t.indexOf(g.attribution)<0&&t.push(g.attribution)}}t=t.filter(c=>String(c).trim()),t.sort((c,p)=>c.length-p.length),t=t.filter((c,p)=>{for(let g=p+1;g<t.length;g++)if(t[g].indexOf(c)>=0)return!1;return!0});const s=t.join(" | ");s!==this._attribHTML&&(this._attribHTML=s,t.length?(this._innerContainer.innerHTML=s,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Kt{constructor(t={}){this._updateCompact=()=>{const n=this._container.children;if(n.length){const s=n[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&s.classList.add("maplibregl-compact"):s.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=H.create("div","maplibregl-ctrl");const n=H.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(){H.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Ds{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,s=n?this._queue.concat(n):this._queue;for(const c of s)if(c.id===t)return void(c.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const s of n)if(!s.cancelled&&(s.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const Lo={"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":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"};var rc=l.Q([{name:"a_pos3d",type:"Int16",components:3}]);class nc extends l.E{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];const s={};for(const c of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))s[c.key]=!0,this._renderableTilesKeys.push(c.key),this._tiles[c.key]||(c.posMatrix=new Float64Array(16),l.aS(c.posMatrix,0,l.N,0,l.N,0,1),this._tiles[c.key]=new bn(c,this.tileSize));for(const c in this._tiles)s[c]||delete this._tiles[c]}freeRtt(t){for(const n in this._tiles){const s=this._tiles[n];(!t||s.tileID.equals(t)||s.tileID.isChildOf(t)||t.isChildOf(s.tileID))&&(s.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const n={};for(const s of this._renderableTilesKeys){const c=this._tiles[s].tileID;if(c.canonical.equals(t.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16),l.aS(p.posMatrix,0,l.N,0,l.N,0,1),n[s]=p}else if(c.canonical.isChildOf(t.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16);const g=c.canonical.z-t.canonical.z,y=c.canonical.x-(c.canonical.x>>g<<g),x=c.canonical.y-(c.canonical.y>>g<<g),S=l.N>>g;l.aS(p.posMatrix,0,S,0,S,0,1),l.$(p.posMatrix,p.posMatrix,[-y*S,-x*S,0]),n[s]=p}else if(t.canonical.isChildOf(c.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16);const g=t.canonical.z-c.canonical.z,y=t.canonical.x-(t.canonical.x>>g<<g),x=t.canonical.y-(t.canonical.y>>g<<g),S=l.N>>g;l.aS(p.posMatrix,0,l.N,0,l.N,0,1),l.$(p.posMatrix,p.posMatrix,[y*S,x*S,0]),l.a0(p.posMatrix,p.posMatrix,[1/2**g,1/2**g,0]),n[s]=p}}return n}getSourceTile(t,n){const s=this.sourceCache._source;let c=t.overscaledZ-this.deltaZoom;if(c>s.maxzoom&&(c=s.maxzoom),c<s.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(c).key);let p=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!p||!p.dem)&&n)for(;c>=s.minzoom&&(!p||!p.dem);)p=this.sourceCache.getTileByID(t.scaledTo(c--).key);return p}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(n=>n.timeAdded>=t)}}class ac{constructor(t,n,s){this.painter=t,this.sourceCache=new nc(n),this.options=s,this.exaggeration=typeof s.exaggeration=="number"?s.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,n,s,c=l.N){var p;if(!(n>=0&&n<c&&s>=0&&s<c))return 0;const g=this.getTerrainData(t),y=(p=g.tile)===null||p===void 0?void 0:p.dem;if(!y)return 0;const x=function(N,$,F){var Q=$[0],se=$[1];return N[0]=F[0]*Q+F[4]*se+F[12],N[1]=F[1]*Q+F[5]*se+F[13],N}([],[n/c*l.N,s/c*l.N],g.u_terrain_matrix),S=[x[0]*y.dim,x[1]*y.dim],I=Math.floor(S[0]),A=Math.floor(S[1]),L=S[0]-I,U=S[1]-A;return y.get(I,A)*(1-L)*(1-U)+y.get(I+1,A)*L*(1-U)+y.get(I,A+1)*(1-L)*U+y.get(I+1,A+1)*L*U}getElevationForLngLatZoom(t,n){const{tileID:s,mercatorX:c,mercatorY:p}=this._getOverscaledTileIDFromLngLatZoom(t,n);return this.getElevation(s,c%l.N,p%l.N,l.N)}getElevation(t,n,s,c=l.N){return this.getDEMElevation(t,n,s,c)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const c=this.painter.context,p=new l.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new qe(c,p,c.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new qe(c,new l.R({width:1,height:1}),c.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(c.gl.NEAREST,c.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=l.ao([])}const n=this.sourceCache.getSourceTile(t,!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 qe(c,n.dem.getPixels(),c.gl.RGBA,{premultiply:!1}),n.demTexture.bind(c.gl.NEAREST,c.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const s=n&&n+n.tileID.key+t.key;if(s&&!this._demMatrixCache[s]){const c=this.sourceCache.sourceCache._source.maxzoom;let p=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=c?p=t.canonical.z-c:l.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const g=t.canonical.x-(t.canonical.x>>p<<p),y=t.canonical.y-(t.canonical.y>>p<<p),x=l.bc(new Float64Array(16),[1/(l.N<<p),1/(l.N<<p),0]);l.$(x,x,[g*l.N,y*l.N,0]),this._demMatrixCache[t.key]={matrix:x,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:s?this._demMatrixCache[t.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(t){const n=this.painter,s=n.width/devicePixelRatio,c=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===s&&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 qe(n.context,{width:s,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 qe(n.context,{width:s,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(s,c,!0,!1),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,s,c))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let p=0,g=0;p<this._coordsTextureSize;p++)for(let y=0;y<this._coordsTextureSize;y++,g+=4)n[g+0]=255&y,n[g+1]=255&p,n[g+2]=y>>8<<4|p>>8,n[g+3]=0;const s=new l.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),c=new qe(t,s,t.gl.RGBA,{premultiply:!1});return c.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=c,c}pointCoordinate(t){const n=new Uint8Array(4),s=this.painter.context,c=s.gl;s.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),c.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,c.RGBA,c.UNSIGNED_BYTE,n),s.bindFramebuffer.set(null);const p=n[0]+(n[2]>>4<<8),g=n[1]+((15&n[2])<<8),y=this.coordsIndex[255-n[3]],x=y&&this.sourceCache.getTileByID(y);if(!x)return null;const S=this._coordsTextureSize,I=(1<<x.tileID.canonical.z)*S;return new l.U((x.tileID.canonical.x*S+p)/I,(x.tileID.canonical.y*S+g)/I,this.getElevation(x.tileID,p,g,S))}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.painter.context,n=new l.bd,s=new l.b0,c=this.meshSize,p=l.N/c,g=c*c;for(let A=0;A<=c;A++)for(let L=0;L<=c;L++)n.emplaceBack(L*p,A*p,0);for(let A=0;A<g;A+=c+1)for(let L=0;L<c;L++)s.emplaceBack(L+A,c+L+A+1,c+L+A+2),s.emplaceBack(L+A,c+L+A+2,L+A+1);const y=n.length,x=y+2*(c+1);for(const A of[0,1])for(let L=0;L<=c;L++)for(const U of[0,1])n.emplaceBack(L*p,A*l.N,U);for(let A=0;A<2*c;A+=2)s.emplaceBack(x+A,x+A+1,x+A+3),s.emplaceBack(x+A,x+A+3,x+A+2),s.emplaceBack(y+A,y+A+3,y+A+1),s.emplaceBack(y+A,y+A+2,y+A+3);const S=n.length,I=S+2*(c+1);for(const A of[0,1])for(let L=0;L<=c;L++)for(const U of[0,1])n.emplaceBack(A*l.N,L*p,U);for(let A=0;A<2*c;A+=2)s.emplaceBack(S+A,S+A+1,S+A+3),s.emplaceBack(S+A,S+A+3,S+A+2),s.emplaceBack(I+A,I+A+3,I+A+1),s.emplaceBack(I+A,I+A+2,I+A+3);return this._mesh={indexBuffer:t.createIndexBuffer(s),vertexBuffer:t.createVertexBuffer(n,rc.members),segments:l.S.simpleSegment(0,0,n.length,s.length)},this._mesh}getMeshFrameDelta(t){return 2*Math.PI*l.be/Math.pow(2,t)/5}getMinTileElevationForLngLatZoom(t,n){var s;const{tileID:c}=this._getOverscaledTileIDFromLngLatZoom(t,n);return(s=this.getMinMaxElevation(c).minElevation)!==null&&s!==void 0?s:0}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,s={minElevation:null,maxElevation:null};return n&&n.dem&&(s.minElevation=n.dem.min*this.exaggeration,s.maxElevation=n.dem.max*this.exaggeration),s}_getOverscaledTileIDFromLngLatZoom(t,n){const s=l.U.fromLngLat(t.wrap()),c=(1<<n)*l.N,p=s.x*c,g=s.y*c,y=Math.floor(p/l.N),x=Math.floor(g/l.N);return{tileID:new l.O(n,0,n,y,x),mercatorX:p,mercatorY:g}}}class xh{constructor(t,n,s){this._context=t,this._size=n,this._tileSize=s,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const n=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),s=new qe(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return s.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),n.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),n.colorAttachment.set(s.texture),{id:t,fbo:n,texture:s,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(n=>t.id!==n),this._recentlyUsed.push(t.id)}stampObject(t){t.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 t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(t=>!t.inUse)===!1}}const Zi={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Rs{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new xh(t.context,30,n.sourceCache.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,n){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(s=>!t._layers[s].isHidden(n)),this._coordsDescendingInv={};for(const s in t.sourceCaches){this._coordsDescendingInv[s]={};const c=t.sourceCaches[s].getVisibleCoordinates();for(const p of c){const g=this.terrain.sourceCache.getTerrainCoords(p);for(const y in g)this._coordsDescendingInv[s][y]||(this._coordsDescendingInv[s][y]=[]),this._coordsDescendingInv[s][y].push(g[y])}}this._coordsDescendingInvStr={};for(const s of t._order){const c=t._layers[s],p=c.source;if(Zi[c.type]&&!this._coordsDescendingInvStr[p]){this._coordsDescendingInvStr[p]={};for(const g in this._coordsDescendingInv[p])this._coordsDescendingInvStr[p][g]=this._coordsDescendingInv[p][g].map(y=>y.key).sort().join()}}for(const s of this._renderableTiles)for(const c in this._coordsDescendingInvStr){const p=this._coordsDescendingInvStr[c][s.tileID.key];p&&p!==s.rttCoords[c]&&(s.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const n=t.type,s=this.painter,c=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(Zi[n]&&(this._prevType&&Zi[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!c))return!0;if(Zi[this._prevType]||Zi[n]&&c){this._prevType=n;const p=this._stacks.length-1,g=this._stacks[p]||[];for(const y of this._renderableTiles){if(this.pool.isFull()&&(li(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(y),y.rtt[p]){const S=this.pool.getObjectForId(y.rtt[p].id);if(S.stamp===y.rtt[p].stamp){this.pool.useObject(S);continue}}const x=this.pool.getOrCreateFreeObject();this.pool.useObject(x),this.pool.stampObject(x),y.rtt[p]={id:x.id,stamp:x.stamp},s.context.bindFramebuffer.set(x.fbo.framebuffer),s.context.clear({color:l.aT.transparent,stencil:0}),s.currentStencilSource=void 0;for(let S=0;S<g.length;S++){const I=s.style._layers[g[S]],A=I.source?this._coordsDescendingInv[I.source][y.tileID.key]:[y.tileID];s.context.viewport.set([0,0,x.fbo.width,x.fbo.height]),s._renderTileClippingMasks(I,A),s.renderLayer(s,s.style.sourceCaches[I.source],I,A),I.source&&(y.rttCoords[I.source]=this._coordsDescendingInvStr[I.source][y.tileID.key])}}return li(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),Zi[n]}return!1}}const Ve=he,Ze={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:l.c.MAX_TILE_CACHE_ZOOM_LEVELS,localIdeographFontFamily:"sans-serif",transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,validateStyle:!0,maxCanvasSize:[4096,4096]},Wa=h=>{h.touchstart=h.dragStart,h.touchmoveWindow=h.dragMove,h.touchend=h.dragEnd},zo={showCompass:!0,showZoom:!0,visualizePitch:!1};class Do{constructor(t,n,s=!1){this.mousedown=g=>{this.startMouse(l.e({},g,{ctrlKey:!0,preventDefault:()=>g.preventDefault()}),H.mousePos(this.element,g)),H.addEventListener(window,"mousemove",this.mousemove),H.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=g=>{this.moveMouse(g,H.mousePos(this.element,g))},this.mouseup=g=>{this.mouseRotate.dragEnd(g),this.mousePitch&&this.mousePitch.dragEnd(g),this.offTemp()},this.touchstart=g=>{g.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=H.touchPos(this.element,g.targetTouches)[0],this.startTouch(g,this._startPos),H.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),H.addEventListener(window,"touchend",this.touchend))},this.touchmove=g=>{g.targetTouches.length!==1?this.reset():(this._lastPos=H.touchPos(this.element,g.targetTouches)[0],this.moveTouch(g,this._lastPos))},this.touchend=g=>{g.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.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const c=t.dragRotate._mouseRotate.getClickTolerance(),p=t.dragRotate._mousePitch.getClickTolerance();this.element=n,this.mouseRotate=ga({clickTolerance:c,enable:!0}),this.touchRotate=(({enable:g,clickTolerance:y,bearingDegreesPerPixelMoved:x=.8})=>{const S=new Yl;return new cn({clickTolerance:y,move:(I,A)=>({bearingDelta:(A.x-I.x)*x}),moveStateManager:S,enable:g,assignEvents:Wa})})({clickTolerance:c,enable:!0}),this.map=t,s&&(this.mousePitch=hn({clickTolerance:p,enable:!0}),this.touchPitch=(({enable:g,clickTolerance:y,pitchDegreesPerPixelMoved:x=-.5})=>{const S=new Yl;return new cn({clickTolerance:y,move:(I,A)=>({pitchDelta:(A.y-I.y)*x}),moveStateManager:S,enable:g,assignEvents:Wa})})({clickTolerance:p,enable:!0})),H.addEventListener(n,"mousedown",this.mousedown),H.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),H.addEventListener(n,"touchcancel",this.reset)}startMouse(t,n){this.mouseRotate.dragStart(t,n),this.mousePitch&&this.mousePitch.dragStart(t,n),H.disableDrag()}startTouch(t,n){this.touchRotate.dragStart(t,n),this.touchPitch&&this.touchPitch.dragStart(t,n),H.disableDrag()}moveMouse(t,n){const s=this.map,{bearingDelta:c}=this.mouseRotate.dragMove(t,n)||{};if(c&&s.setBearing(s.getBearing()+c),this.mousePitch){const{pitchDelta:p}=this.mousePitch.dragMove(t,n)||{};p&&s.setPitch(s.getPitch()+p)}}moveTouch(t,n){const s=this.map,{bearingDelta:c}=this.touchRotate.dragMove(t,n)||{};if(c&&s.setBearing(s.getBearing()+c),this.touchPitch){const{pitchDelta:p}=this.touchPitch.dragMove(t,n)||{};p&&s.setPitch(s.getPitch()+p)}}off(){const t=this.element;H.removeEventListener(t,"mousedown",this.mousedown),H.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),H.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),H.removeEventListener(window,"touchend",this.touchend),H.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){H.enableDrag(),H.removeEventListener(window,"mousemove",this.mousemove),H.removeEventListener(window,"mouseup",this.mouseup),H.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),H.removeEventListener(window,"touchend",this.touchend)}}let di;function Ro(h,t,n){if(h=new l.L(h.lng,h.lat),t){const s=new l.L(h.lng-360,h.lat),c=new l.L(h.lng+360,h.lat),p=n.locationPoint(h).distSqr(t);n.locationPoint(s).distSqr(t)<p?h=s:n.locationPoint(c).distSqr(t)<p&&(h=c)}for(;Math.abs(h.lng-n.center.lng)>180;){const s=n.locationPoint(h);if(s.x>=0&&s.y>=0&&s.x<=n.width&&s.y<=n.height)break;h.lng>n.center.lng?h.lng-=360:h.lng+=360}return h}const Cr={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 sc(h,t,n){const s=h.classList;for(const c in Cr)s.remove(`maplibregl-${n}-anchor-${c}`);s.add(`maplibregl-${n}-anchor-${t}`)}class Gn extends l.E{constructor(t){if(super(),this._onKeyPress=n=>{const s=n.code,c=n.charCode||n.keyCode;s!=="Space"&&s!=="Enter"&&c!==32&&c!==13||this.togglePopup()},this._onMapClick=n=>{const s=n.originalEvent.target,c=this._element;this._popup&&(s===c||c.contains(s))&&this.togglePopup()},this._update=n=>{if(!this._map)return;const s=this._map.loaded()&&!this._map.isMoving();(n?.type==="terrain"||n?.type==="render"&&!s)&&this._map.once("render",this._update),this._map.transform.renderWorldCopies&&(this._lngLat=Ro(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(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)`),n&&n.type!=="moveend"||(this._pos=this._pos.round()),H.setTransform(this._element,`${Cr[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${p} ${c}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const g=this._map.unproject(this._pos),y=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=g.distanceTo(this._lngLat)>20*y?"0.2":"1.0",this._opacityTimeout=null},100))},this._onMove=n=>{if(!this._isDragging){const s=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=s}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 l.k("dragstart"))),this.fire(new l.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new l.k("dragend")),this._state="inactive"},this._addDragHandler=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=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,t&&t.element)this._element=t.element,this._offset=l.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=H.create("div"),this._element.setAttribute("aria-label","Map marker");const n=H.createNS("http://www.w3.org/2000/svg","svg"),s=41,c=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${s}px`),n.setAttributeNS(null,"width",`${c}px`),n.setAttributeNS(null,"viewBox",`0 0 ${c} ${s}`);const p=H.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 g=H.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"fill-rule","nonzero");const y=H.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(3.0, 29.0)"),y.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 Q of x){const se=H.createNS("http://www.w3.org/2000/svg","ellipse");se.setAttributeNS(null,"opacity","0.04"),se.setAttributeNS(null,"cx","10.5"),se.setAttributeNS(null,"cy","5.80029008"),se.setAttributeNS(null,"rx",Q.rx),se.setAttributeNS(null,"ry",Q.ry),y.appendChild(se)}const S=H.createNS("http://www.w3.org/2000/svg","g");S.setAttributeNS(null,"fill",this._color);const I=H.createNS("http://www.w3.org/2000/svg","path");I.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"),S.appendChild(I);const A=H.createNS("http://www.w3.org/2000/svg","g");A.setAttributeNS(null,"opacity","0.25"),A.setAttributeNS(null,"fill","#000000");const L=H.createNS("http://www.w3.org/2000/svg","path");L.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"),A.appendChild(L);const U=H.createNS("http://www.w3.org/2000/svg","g");U.setAttributeNS(null,"transform","translate(6.0, 7.0)"),U.setAttributeNS(null,"fill","#FFFFFF");const N=H.createNS("http://www.w3.org/2000/svg","g");N.setAttributeNS(null,"transform","translate(8.0, 8.0)");const $=H.createNS("http://www.w3.org/2000/svg","circle");$.setAttributeNS(null,"fill","#000000"),$.setAttributeNS(null,"opacity","0.25"),$.setAttributeNS(null,"cx","5.5"),$.setAttributeNS(null,"cy","5.5"),$.setAttributeNS(null,"r","5.4999962");const F=H.createNS("http://www.w3.org/2000/svg","circle");F.setAttributeNS(null,"fill","#FFFFFF"),F.setAttributeNS(null,"cx","5.5"),F.setAttributeNS(null,"cy","5.5"),F.setAttributeNS(null,"r","5.4999962"),N.appendChild($),N.appendChild(F),g.appendChild(y),g.appendChild(S),g.appendChild(A),g.appendChild(U),g.appendChild(N),n.appendChild(g),n.setAttributeNS(null,"height",s*this._scale+"px"),n.setAttributeNS(null,"width",c*this._scale+"px"),this._element.appendChild(n),this._offset=l.P.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",n=>{n.preventDefault()}),this._element.addEventListener("mousedown",n=>{n.preventDefault()}),sc(this._element,this._anchor,"marker"),t&&t.className)for(const n of t.className.split(" "))this._element.classList.add(n);this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("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),H.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=l.L.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const c=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[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=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}getOffset(){return this._offset}setOffset(t){return this._offset=l.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const ci={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let ni=0,_a=!1;const Ka={maxWidth:100,unit:"metric"};function Xa(h,t,n){const s=n&&n.maxWidth||100,c=h._container.clientHeight/2,p=h.unproject([0,c]),g=h.unproject([s,c]),y=p.distanceTo(g);if(n&&n.unit==="imperial"){const x=3.2808*y;x>5280?qn(t,s,x/5280,h._getUIString("ScaleControl.Miles")):qn(t,s,x,h._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?qn(t,s,y/1852,h._getUIString("ScaleControl.NauticalMiles")):y>=1e3?qn(t,s,y/1e3,h._getUIString("ScaleControl.Kilometers")):qn(t,s,y,h._getUIString("ScaleControl.Meters"))}function qn(h,t,n,s){const c=function(p){const g=Math.pow(10,`${Math.floor(p)}`.length-1);let y=p/g;return y=y>=10?10:y>=5?5:y>=3?3:y>=2?2:y>=1?1:function(x){const S=Math.pow(10,Math.ceil(-Math.log(x)/Math.LN10));return Math.round(x*S)/S}(y),g*y}(n);h.style.width=t*(c/n)+"px",h.innerHTML=`${c} ${s}`}const Bo={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Fo=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function va(h){if(h){if(typeof h=="number"){const t=Math.round(Math.abs(h)/Math.SQRT2);return{center:new l.P(0,0),top:new l.P(0,h),"top-left":new l.P(t,t),"top-right":new l.P(-t,t),bottom:new l.P(0,-h),"bottom-left":new l.P(t,-t),"bottom-right":new l.P(-t,-t),left:new l.P(h,0),right:new l.P(-h,0)}}if(h instanceof l.P||Array.isArray(h)){const t=l.P.convert(h);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:l.P.convert(h.center||[0,0]),top:l.P.convert(h.top||[0,0]),"top-left":l.P.convert(h["top-left"]||[0,0]),"top-right":l.P.convert(h["top-right"]||[0,0]),bottom:l.P.convert(h.bottom||[0,0]),"bottom-left":l.P.convert(h["bottom-left"]||[0,0]),"bottom-right":l.P.convert(h["bottom-right"]||[0,0]),left:l.P.convert(h.left||[0,0]),right:l.P.convert(h.right||[0,0])}}return va(new l.P(0,0))}const Oo={extend:(h,...t)=>l.e(h,...t),run(h){h()},logToElement(h,t=!1,n="log"){const s=window.document.getElementById(n);s&&(t&&(s.innerHTML=""),s.innerHTML+=`<br>${h}`)}},No=he;class kt{static get version(){return No}static get workerCount(){return jr.workerCount}static set workerCount(t){jr.workerCount=t}static get maxParallelImageRequests(){return l.c.MAX_PARALLEL_IMAGE_REQUESTS}static set maxParallelImageRequests(t){l.c.MAX_PARALLEL_IMAGE_REQUESTS=t}static get workerUrl(){return l.c.WORKER_URL}static set workerUrl(t){l.c.WORKER_URL=t}static addProtocol(t,n){l.c.REGISTERED_PROTOCOLS[t]=n}static removeProtocol(t){delete l.c.REGISTERED_PROTOCOLS[t]}}return kt.Map=class extends ic{constructor(h){if(l.bf.mark(l.bg.create),(h=l.e({},Ze,h)).minZoom!=null&&h.maxZoom!=null&&h.minZoom>h.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(h.minPitch!=null&&h.maxPitch!=null&&h.minPitch>h.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(h.minPitch!=null&&h.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(h.maxPitch!=null&&h.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new ks(h.minZoom,h.maxZoom,h.minPitch,h.maxPitch,h.renderWorldCopies),{bearingSnap:h.bearingSnap}),this._cooperativeGesturesOnWheel=t=>{this._onCooperativeGesture(t,t[this._metaKey],1)},this._contextLost=t=>{t.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new l.k("webglcontextlost",{originalEvent:t}))},this._contextRestored=t=>{this._setupPainter(),this.resize(),this._update(),this.fire(new l.k("webglcontextrestored",{originalEvent:t}))},this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=h.interactive,this._cooperativeGestures=h.cooperativeGestures,this._metaKey=navigator.platform.indexOf("Mac")===0?"metaKey":"ctrlKey",this._maxTileCacheSize=h.maxTileCacheSize,this._maxTileCacheZoomLevels=h.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=h.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=h.preserveDrawingBuffer,this._antialias=h.antialias,this._trackResize=h.trackResize,this._bearingSnap=h.bearingSnap,this._refreshExpiredTiles=h.refreshExpiredTiles,this._fadeDuration=h.fadeDuration,this._crossSourceCollisions=h.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=h.collectResourceTiming,this._renderTaskQueue=new Ds,this._controls=[],this._mapId=l.a2(),this._locale=l.e({},Lo,h.locale),this._clickTolerance=h.clickTolerance,this._overridePixelRatio=h.pixelRatio,this._maxCanvasSize=h.maxCanvasSize,this.transformCameraUpdate=h.transformCameraUpdate,this._imageQueueHandle=Tt.addThrottleControl(()=>this.isMoving()),this._requestManager=new It(h.transformRequest),typeof h.container=="string"){if(this._container=document.getElementById(h.container),!this._container)throw new Error(`Container '${h.container}' not found.`)}else{if(!(h.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=h.container}if(h.maxBounds&&this.setMaxBounds(h.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 t=!1;const n=jn(s=>{this._trackResize&&!this._removed&&this.resize(s)._update()},50);this._resizeObserver=new ResizeObserver(s=>{t?n(s):t=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Mo(this,h),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=h.hash&&new ja(typeof h.hash=="string"&&h.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:h.center,zoom:h.zoom,bearing:h.bearing,pitch:h.pitch}),h.bounds&&(this.resize(),this.fitBounds(h.bounds,l.e({},h.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=h.localIdeographFontFamily,this._validateStyle=h.validateStyle,h.style&&this.setStyle(h.style,{localIdeographFontFamily:h.localIdeographFontFamily}),h.attributionControl&&this.addControl(new ur({customAttribution:h.customAttribution})),h.maplibreLogo&&this.addControl(new Kt,h.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",t=>{this._update(t.dataType==="style"),this.fire(new l.k(`${t.dataType}data`,t))}),this.on("dataloading",t=>{this.fire(new l.k(`${t.dataType}dataloading`,t))}),this.on("dataabort",t=>{this.fire(new l.k("sourcedataabort",t))})}_getMapId(){return this._mapId}addControl(h,t){if(t===void 0&&(t=h.getDefaultPosition?h.getDefaultPosition():"top-right"),!h||!h.onAdd)return this.fire(new l.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=h.onAdd(this);this._controls.push(h);const s=this._controlPositions[t];return t.indexOf("bottom")!==-1?s.insertBefore(n,s.firstChild):s.appendChild(n),this}removeControl(h){if(!h||!h.onRemove)return this.fire(new l.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(h);return t>-1&&this._controls.splice(t,1),h.onRemove(this),this}hasControl(h){return this._controls.indexOf(h)>-1}calculateCameraOptionsFromTo(h,t,n,s){return s==null&&this.terrain&&(s=this.terrain.getElevationForLngLatZoom(n,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(h,t,n,s)}resize(h){var t;const n=this._containerDimensions(),s=n[0],c=n[1],p=this._getClampedPixelRatio(s,c);if(this._resizeCanvas(s,c,p),this.painter.resize(s,c,p),this.painter.overLimit()){const y=this.painter.context.gl;this._maxCanvasSize=[y.drawingBufferWidth,y.drawingBufferHeight];const x=this._getClampedPixelRatio(s,c);this._resizeCanvas(s,c,x),this.painter.resize(s,c,x)}this.transform.resize(s,c),(t=this._requestedCameraState)===null||t===void 0||t.resize(s,c);const g=!this._moving;return g&&(this.stop(),this.fire(new l.k("movestart",h)).fire(new l.k("move",h))),this.fire(new l.k("resize",h)),g&&this.fire(new l.k("moveend",h)),this}_getClampedPixelRatio(h,t){const{0:n,1:s}=this._maxCanvasSize,c=this.getPixelRatio(),p=h*c,g=t*c;return Math.min(p>n?n/p:1,g>s?s/g:1)*c}getPixelRatio(){var h;return(h=this._overridePixelRatio)!==null&&h!==void 0?h:devicePixelRatio}setPixelRatio(h){this._overridePixelRatio=h,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(h){return this.transform.setMaxBounds(zt.convert(h)),this._update()}setMinZoom(h){if((h=h??-2)>=-2&&h<=this.transform.maxZoom)return this.transform.minZoom=h,this._update(),this.getZoom()<h&&this.setZoom(h),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(h){if((h=h??22)>=this.transform.minZoom)return this.transform.maxZoom=h,this._update(),this.getZoom()>h&&this.setZoom(h),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(h){if((h=h??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(h>=0&&h<=this.transform.maxPitch)return this.transform.minPitch=h,this._update(),this.getPitch()<h&&this.setPitch(h),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(h){if((h=h??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(h>=this.transform.minPitch)return this.transform.maxPitch=h,this._update(),this.getPitch()>h&&this.setPitch(h),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(h){return this.transform.renderWorldCopies=h,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(h){return this._cooperativeGestures=h,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(h){return this.transform.locationPoint(l.L.convert(h),this.style&&this.terrain)}unproject(h){return this.transform.pointLocation(l.P.convert(h),this.terrain)}isMoving(){var h;return this._moving||((h=this.handlers)===null||h===void 0?void 0:h.isMoving())}isZooming(){var h;return this._zooming||((h=this.handlers)===null||h===void 0?void 0:h.isZooming())}isRotating(){var h;return this._rotating||((h=this.handlers)===null||h===void 0?void 0:h.isRotating())}_createDelegatedListener(h,t,n){if(h==="mouseenter"||h==="mouseover"){let s=!1;return{layer:t,listener:n,delegates:{mousemove:p=>{const g=this.getLayer(t)?this.queryRenderedFeatures(p.point,{layers:[t]}):[];g.length?s||(s=!0,n.call(this,new hr(h,this,p.originalEvent,{features:g}))):s=!1},mouseout:()=>{s=!1}}}}if(h==="mouseleave"||h==="mouseout"){let s=!1;return{layer:t,listener:n,delegates:{mousemove:g=>{(this.getLayer(t)?this.queryRenderedFeatures(g.point,{layers:[t]}):[]).length?s=!0:s&&(s=!1,n.call(this,new hr(h,this,g.originalEvent)))},mouseout:g=>{s&&(s=!1,n.call(this,new hr(h,this,g.originalEvent)))}}}}{const s=c=>{const p=this.getLayer(t)?this.queryRenderedFeatures(c.point,{layers:[t]}):[];p.length&&(c.features=p,n.call(this,c),delete c.features)};return{layer:t,listener:n,delegates:{[h]:s}}}}on(h,t,n){if(n===void 0)return super.on(h,t);const s=this._createDelegatedListener(h,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[h]=this._delegatedListeners[h]||[],this._delegatedListeners[h].push(s);for(const c in s.delegates)this.on(c,s.delegates[c]);return this}once(h,t,n){if(n===void 0)return super.once(h,t);const s=this._createDelegatedListener(h,t,n);for(const c in s.delegates)this.once(c,s.delegates[c]);return this}off(h,t,n){return n===void 0?super.off(h,t):(this._delegatedListeners&&this._delegatedListeners[h]&&(s=>{const c=this._delegatedListeners[h];for(let p=0;p<c.length;p++){const g=c[p];if(g.layer===t&&g.listener===n){for(const y in g.delegates)this.off(y,g.delegates[y]);return c.splice(p,1),this}}})(),this)}queryRenderedFeatures(h,t){if(!this.style)return[];let n;const s=h instanceof l.P||Array.isArray(h),c=s?h:[[0,0],[this.transform.width,this.transform.height]];if(t=t||(s?{}:h)||{},c instanceof l.P||typeof c[0]=="number")n=[l.P.convert(c)];else{const p=l.P.convert(c[0]),g=l.P.convert(c[1]);n=[p,new l.P(g.x,p.y),g,new l.P(p.x,g.y),p]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(h,t){return this.style.querySourceFeatures(h,t)}setStyle(h,t){return(t=l.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&h?(this._diffStyle(h,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(h,t))}setTransformRequest(h){return this._requestManager.setTransformRequest(h),this}_getUIString(h){const t=this._locale[h];if(t==null)throw new Error(`Missing UI string '${h}'`);return t}_updateStyle(h,t){if(t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(h,t));const n=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!h)),h?(this.style=new Mi(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof h=="string"?this.style.loadURL(h,t,n):this.style.loadJSON(h,t,n),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Mi(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(h,t){if(typeof h=="string"){const n=this._requestManager.transformRequest(h,it.Style);l.f(n,(s,c)=>{s?this.fire(new l.j(s)):c&&this._updateDiff(c,t)})}else typeof h=="object"&&this._updateDiff(h,t)}_updateDiff(h,t){try{this.style.setState(h,t)&&this._update(!0)}catch(n){l.w(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(h,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():l.w("There is no style added to the map.")}addSource(h,t){return this._lazyInitEmptyStyle(),this.style.addSource(h,t),this._update(!0)}isSourceLoaded(h){const t=this.style&&this.style.sourceCaches[h];if(t!==void 0)return t.loaded();this.fire(new l.j(new Error(`There is no source with ID '${h}'`)))}setTerrain(h){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),h){const t=this.style.sourceCaches[h.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${h.source}`);for(const n in this.style._layers){const s=this.style._layers[n];s.type==="hillshade"&&s.source===h.source&&l.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new ac(this.painter,t,h),this.painter.renderToTexture=new Rs(this.painter,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=n=>{n.dataType==="style"?this.terrain.sourceCache.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId!==h.source||this._elevationFreeze||(this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(n.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0;return this.fire(new l.k("terrain",{terrain:h})),this}getTerrain(){var h,t;return(t=(h=this.terrain)===null||h===void 0?void 0:h.options)!==null&&t!==void 0?t:null}areTilesLoaded(){const h=this.style&&this.style.sourceCaches;for(const t in h){const n=h[t]._tiles;for(const s in n){const c=n[s];if(c.state!=="loaded"&&c.state!=="errored")return!1}}return!0}addSourceType(h,t,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(h,t,n)}removeSource(h){return this.style.removeSource(h),this._update(!0)}getSource(h){return this.style.getSource(h)}addImage(h,t,n={}){const{pixelRatio:s=1,sdf:c=!1,stretchX:p,stretchY:g,content:y}=n;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||l.a(t))){if(t.width===void 0||t.height===void 0)return this.fire(new l.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:x,height:S,data:I}=t,A=t;return this.style.addImage(h,{data:new l.R({width:x,height:S},new Uint8Array(I)),pixelRatio:s,stretchX:p,stretchY:g,content:y,sdf:c,version:0,userImage:A}),A.onAdd&&A.onAdd(this,h),this}}{const{width:x,height:S,data:I}=l.h.getImageData(t);this.style.addImage(h,{data:new l.R({width:x,height:S},I),pixelRatio:s,stretchX:p,stretchY:g,content:y,sdf:c,version:0})}}updateImage(h,t){const n=this.style.getImage(h);if(!n)return this.fire(new l.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=t instanceof HTMLImageElement||l.a(t)?l.h.getImageData(t):t,{width:c,height:p,data:g}=s;if(c===void 0||p===void 0)return this.fire(new l.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(c!==n.data.width||p!==n.data.height)return this.fire(new l.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const y=!(t instanceof HTMLImageElement||l.a(t));return n.data.replace(g,y),this.style.updateImage(h,n),this}getImage(h){return this.style.getImage(h)}hasImage(h){return h?!!this.style.getImage(h):(this.fire(new l.j(new Error("Missing required image id"))),!1)}removeImage(h){this.style.removeImage(h)}loadImage(h,t){Tt.getImage(this._requestManager.transformRequest(h,it.Image),t)}listImages(){return this.style.listImages()}addLayer(h,t){return this._lazyInitEmptyStyle(),this.style.addLayer(h,t),this._update(!0)}moveLayer(h,t){return this.style.moveLayer(h,t),this._update(!0)}removeLayer(h){return this.style.removeLayer(h),this._update(!0)}getLayer(h){return this.style.getLayer(h)}setLayerZoomRange(h,t,n){return this.style.setLayerZoomRange(h,t,n),this._update(!0)}setFilter(h,t,n={}){return this.style.setFilter(h,t,n),this._update(!0)}getFilter(h){return this.style.getFilter(h)}setPaintProperty(h,t,n,s={}){return this.style.setPaintProperty(h,t,n,s),this._update(!0)}getPaintProperty(h,t){return this.style.getPaintProperty(h,t)}setLayoutProperty(h,t,n,s={}){return this.style.setLayoutProperty(h,t,n,s),this._update(!0)}getLayoutProperty(h,t){return this.style.getLayoutProperty(h,t)}setGlyphs(h,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(h,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(h,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(h,t,n,s=>{s||this._update(!0)}),this}removeSprite(h){return this._lazyInitEmptyStyle(),this.style.removeSprite(h),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(h,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(h,t,n=>{n||this._update(!0)}),this}setLight(h,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(h,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(h,t){return this.style.setFeatureState(h,t),this._update()}removeFeatureState(h,t){return this.style.removeFeatureState(h,t),this._update()}getFeatureState(h){return this.style.getFeatureState(h)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let h=0,t=0;return this._container&&(h=this._container.clientWidth||400,t=this._container.clientHeight||300),[h,t]}_setupContainer(){const h=this._container;h.classList.add("maplibregl-map");const t=this._canvasContainer=H.create("div","maplibregl-canvas-container",h);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=H.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const n=this._containerDimensions(),s=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],s);const c=this._controlContainer=H.create("div","maplibregl-control-container",h),p=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(g=>{p[g]=H.create("div",`maplibregl-ctrl-${g} `,c)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){this._cooperativeGesturesScreen=H.create("div","maplibregl-cooperative-gesture-screen",this._container);let h=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(h=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use \u2318 + scroll to zoom the map"),this._cooperativeGesturesScreen.innerHTML=`
|
|
577
|
+
`),W=_.createShader(_.FRAGMENT_SHADER);if(_.isContextLost())return void(this.failedToCreate=!0);if(_.shaderSource(W,ee),_.compileShader(W),!_.getShaderParameter(W,_.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${_.getShaderInfoLog(W)}`);_.attachShader(this.program,W);const te=_.createShader(_.VERTEX_SHADER);if(_.isContextLost())return void(this.failedToCreate=!0);if(_.shaderSource(te,se),_.compileShader(te),!_.getShaderParameter(te,_.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${_.getShaderInfoLog(te)}`);_.attachShader(this.program,te),this.attributes={};const ce={};this.numAttributes=I.length;for(let he=0;he<this.numAttributes;he++)I[he]&&(_.bindAttribLocation(this.program,he,I[he]),this.attributes[I[he]]=he);if(_.linkProgram(this.program),!_.getProgramParameter(this.program,_.LINK_STATUS))throw new Error(`Program failed to link: ${_.getProgramInfoLog(this.program)}`);_.deleteShader(te),_.deleteShader(W);for(let he=0;he<j.length;he++){const fe=j[he];if(fe&&!ce[fe]){const ve=_.getUniformLocation(this.program,fe);ve&&(ce[fe]=ve)}}this.fixedUniforms=c(t,ce),this.terrainUniforms=((he,fe)=>({u_depth:new l.aL(he,fe.u_depth),u_terrain:new l.aL(he,fe.u_terrain),u_terrain_dim:new l.aM(he,fe.u_terrain_dim),u_terrain_matrix:new l.aN(he,fe.u_terrain_matrix),u_terrain_unpack:new l.aO(he,fe.u_terrain_unpack),u_terrain_exaggeration:new l.aM(he,fe.u_terrain_exaggeration)}))(t,ce),this.binderUniforms=s?s.getUniforms(t,ce):[]}draw(t,n,s,c,p,g,_,b,S,I,C,L,U,N,j,F,ee,se){const W=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(s),t.setStencilMode(c),t.setColorMode(p),t.setCullFace(g),b){t.activeTexture.set(W.TEXTURE2),W.bindTexture(W.TEXTURE_2D,b.depthTexture),t.activeTexture.set(W.TEXTURE3),W.bindTexture(W.TEXTURE_2D,b.texture);for(const ce in this.terrainUniforms)this.terrainUniforms[ce].set(b[ce])}for(const ce in this.fixedUniforms)this.fixedUniforms[ce].set(_[ce]);j&&j.setUniforms(t,this.binderUniforms,U,{zoom:N});let te=0;switch(n){case W.LINES:te=2;break;case W.TRIANGLES:te=3;break;case W.LINE_STRIP:te=1}for(const ce of L.get()){const he=ce.vaos||(ce.vaos={});(he[S]||(he[S]=new Vn)).bind(t,this,I,j?j.getPaintVertexBuffers():[],C,ce.vertexOffset,F,ee,se),W.drawElements(n,ce.primitiveLength*te,W.UNSIGNED_SHORT,ce.primitiveOffset*te*2)}}}function Tr(h,t,n){const s=1/J(n,1,t.transform.tileZoom),c=Math.pow(2,n.tileID.overscaledZ),p=n.tileSize*Math.pow(2,t.transform.tileZoom)/c,g=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:[s,h.fromScale,h.toScale],u_fade:h.t,u_pixel_coord_upper:[g>>16,_>>16],u_pixel_coord_lower:[65535&g,65535&_]}}const io=(h,t,n,s)=>{const c=t.style.light,p=c.properties.get("position"),g=[p.x,p.y,p.z],_=function(){var S=new l.A(9);return l.A!=Float32Array&&(S[1]=0,S[2]=0,S[3]=0,S[5]=0,S[6]=0,S[7]=0),S[0]=1,S[4]=1,S[8]=1,S}();c.properties.get("anchor")==="viewport"&&function(S,I){var C=Math.sin(I),L=Math.cos(I);S[0]=L,S[1]=C,S[2]=0,S[3]=-C,S[4]=L,S[5]=0,S[6]=0,S[7]=0,S[8]=1}(_,-t.transform.angle),function(S,I,C){var L=I[0],U=I[1],N=I[2];S[0]=L*C[0]+U*C[3]+N*C[6],S[1]=L*C[1]+U*C[4]+N*C[7],S[2]=L*C[2]+U*C[5]+N*C[8]}(g,g,_);const b=c.properties.get("color");return{u_matrix:h,u_lightpos:g,u_lightintensity:c.properties.get("intensity"),u_lightcolor:[b.r,b.g,b.b],u_vertical_gradient:+n,u_opacity:s}},An=(h,t,n,s,c,p,g)=>l.e(io(h,t,n,s),Tr(p,t,g),{u_height_factor:-Math.pow(2,c.overscaledZ)/g.tileSize/8}),El=h=>({u_matrix:h}),ro=(h,t,n,s)=>l.e(El(h),Tr(n,t,s)),ps=(h,t)=>({u_matrix:h,u_world:t}),ds=(h,t,n,s,c)=>l.e(ro(h,t,n,s),{u_world:c}),Cn=(h,t,n,s)=>{const c=h.transform;let p,g;if(s.paint.get("circle-pitch-alignment")==="map"){const _=J(n,1,c.zoom);p=!0,g=[_,_]}else p=!1,g=c.pixelsToGLUnits;return{u_camera_to_center_distance:c.cameraToCenterDistance,u_scale_with_map:+(s.paint.get("circle-pitch-scale")==="map"),u_matrix:h.translatePosMatrix(t.posMatrix,n,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_pitch_with_map:+p,u_device_pixel_ratio:h.pixelRatio,u_extrude_scale:g}},no=(h,t,n)=>{const s=J(n,1,t.zoom),c=Math.pow(2,t.zoom-n.tileID.overscaledZ),p=n.tileID.overscaleFactor();return{u_matrix:h,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:s,u_extrude_scale:[t.pixelsToGLUnits[0]/(s*c),t.pixelsToGLUnits[1]/(s*c)],u_overscale_factor:p}},Ba=(h,t,n=1)=>({u_matrix:h,u_color:t,u_overlay:0,u_overlay_scale:n}),Pl=h=>({u_matrix:h}),xh=(h,t,n,s)=>({u_matrix:h,u_extrude_scale:J(t,1,n),u_intensity:s});function ao(h,t){const n=Math.pow(2,t.canonical.z),s=t.canonical.y;return[new l.U(0,s/n).toLngLat().lat,new l.U(0,(s+1)/n).toLngLat().lat]}const so=(h,t,n,s)=>{const c=h.transform;return{u_matrix:ms(h,t,n,s),u_ratio:1/J(t,1,c.zoom),u_device_pixel_ratio:h.pixelRatio,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]]}},Ml=(h,t,n,s,c)=>l.e(so(h,t,n,c),{u_image:0,u_image_height:s}),bh=(h,t,n,s,c)=>{const p=h.transform,g=Ll(t,p);return{u_matrix:ms(h,t,n,c),u_texsize:t.imageAtlasTexture.size,u_ratio:1/J(t,1,p.zoom),u_device_pixel_ratio:h.pixelRatio,u_image:0,u_scale:[g,s.fromScale,s.toScale],u_fade:s.t,u_units_to_pixels:[1/p.pixelsToGLUnits[0],1/p.pixelsToGLUnits[1]]}},kl=(h,t,n,s,c,p)=>{const g=h.lineAtlas,_=Ll(t,h.transform),b=n.layout.get("line-cap")==="round",S=g.getDash(s.from,b),I=g.getDash(s.to,b),C=S.width*c.fromScale,L=I.width*c.toScale;return l.e(so(h,t,n,p),{u_patternscale_a:[_/C,-S.height/2],u_patternscale_b:[_/L,-I.height/2],u_sdfgamma:g.width/(256*Math.min(C,L)*h.pixelRatio)/2,u_image:0,u_tex_y_a:S.y,u_tex_y_b:I.y,u_mix:c.t})};function Ll(h,t){return 1/J(h,1,t.tileZoom)}function ms(h,t,n,s){return h.translatePosMatrix(s?s.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const zl=(h,t,n,s,c)=>{return{u_matrix:h,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:s.mix,u_opacity:s.opacity*c.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:c.paint.get("raster-brightness-min"),u_brightness_high:c.paint.get("raster-brightness-max"),u_saturation_factor:(g=c.paint.get("raster-saturation"),g>0?1-1/(1.001-g):-g),u_contrast_factor:(p=c.paint.get("raster-contrast"),p>0?1/(1-p):1+p),u_spin_weights:Dl(c.paint.get("raster-hue-rotate"))};var p,g};function Dl(h){h*=Math.PI/180;const t=Math.sin(h),n=Math.cos(h);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const oo=(h,t,n,s,c,p,g,_,b,S)=>{const I=c.transform;return{u_is_size_zoom_constant:+(h==="constant"||h==="source"),u_is_size_feature_constant:+(h==="constant"||h==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:I.cameraToCenterDistance,u_pitch:I.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:I.width/I.height,u_fade_change:c.options.fadeDuration?c.symbolFadeChange:1,u_matrix:p,u_label_plane_matrix:g,u_coord_matrix:_,u_is_text:+b,u_pitch_with_map:+s,u_texsize:S,u_texture:0}},lo=(h,t,n,s,c,p,g,_,b,S,I)=>{const C=c.transform;return l.e(oo(h,t,n,s,c,p,g,_,b,S),{u_gamma_scale:s?Math.cos(C._pitch)*C.cameraToCenterDistance:1,u_device_pixel_ratio:c.pixelRatio,u_is_halo:+I})},$n=(h,t,n,s,c,p,g,_,b,S)=>l.e(lo(h,t,n,s,c,p,g,_,!0,b,!0),{u_texsize_icon:S,u_texture_icon:1}),fs=(h,t,n)=>({u_matrix:h,u_opacity:t,u_color:n}),Ir=(h,t,n,s,c,p)=>l.e(function(g,_,b,S){const I=b.imageManager.getPattern(g.from.toString()),C=b.imageManager.getPattern(g.to.toString()),{width:L,height:U}=b.imageManager.getPixelSize(),N=Math.pow(2,S.tileID.overscaledZ),j=S.tileSize*Math.pow(2,b.transform.tileZoom)/N,F=j*(S.tileID.canonical.x+S.tileID.wrap*N),ee=j*S.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:I.tl,u_pattern_br_a:I.br,u_pattern_tl_b:C.tl,u_pattern_br_b:C.br,u_texsize:[L,U],u_mix:_.t,u_pattern_size_a:I.displaySize,u_pattern_size_b:C.displaySize,u_scale_a:_.fromScale,u_scale_b:_.toScale,u_tile_units_to_pixels:1/J(S,1,b.transform.tileZoom),u_pixel_coord_upper:[F>>16,ee>>16],u_pixel_coord_lower:[65535&F,65535&ee]}}(s,p,n,c),{u_matrix:h,u_opacity:t}),gs={fillExtrusion:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_lightpos:new l.aP(h,t.u_lightpos),u_lightintensity:new l.aM(h,t.u_lightintensity),u_lightcolor:new l.aP(h,t.u_lightcolor),u_vertical_gradient:new l.aM(h,t.u_vertical_gradient),u_opacity:new l.aM(h,t.u_opacity)}),fillExtrusionPattern:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_lightpos:new l.aP(h,t.u_lightpos),u_lightintensity:new l.aM(h,t.u_lightintensity),u_lightcolor:new l.aP(h,t.u_lightcolor),u_vertical_gradient:new l.aM(h,t.u_vertical_gradient),u_height_factor:new l.aM(h,t.u_height_factor),u_image:new l.aL(h,t.u_image),u_texsize:new l.aQ(h,t.u_texsize),u_pixel_coord_upper:new l.aQ(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.aQ(h,t.u_pixel_coord_lower),u_scale:new l.aP(h,t.u_scale),u_fade:new l.aM(h,t.u_fade),u_opacity:new l.aM(h,t.u_opacity)}),fill:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix)}),fillPattern:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_image:new l.aL(h,t.u_image),u_texsize:new l.aQ(h,t.u_texsize),u_pixel_coord_upper:new l.aQ(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.aQ(h,t.u_pixel_coord_lower),u_scale:new l.aP(h,t.u_scale),u_fade:new l.aM(h,t.u_fade)}),fillOutline:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_world:new l.aQ(h,t.u_world)}),fillOutlinePattern:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_world:new l.aQ(h,t.u_world),u_image:new l.aL(h,t.u_image),u_texsize:new l.aQ(h,t.u_texsize),u_pixel_coord_upper:new l.aQ(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.aQ(h,t.u_pixel_coord_lower),u_scale:new l.aP(h,t.u_scale),u_fade:new l.aM(h,t.u_fade)}),circle:(h,t)=>({u_camera_to_center_distance:new l.aM(h,t.u_camera_to_center_distance),u_scale_with_map:new l.aL(h,t.u_scale_with_map),u_pitch_with_map:new l.aL(h,t.u_pitch_with_map),u_extrude_scale:new l.aQ(h,t.u_extrude_scale),u_device_pixel_ratio:new l.aM(h,t.u_device_pixel_ratio),u_matrix:new l.aN(h,t.u_matrix)}),collisionBox:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_camera_to_center_distance:new l.aM(h,t.u_camera_to_center_distance),u_pixels_to_tile_units:new l.aM(h,t.u_pixels_to_tile_units),u_extrude_scale:new l.aQ(h,t.u_extrude_scale),u_overscale_factor:new l.aM(h,t.u_overscale_factor)}),collisionCircle:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_inv_matrix:new l.aN(h,t.u_inv_matrix),u_camera_to_center_distance:new l.aM(h,t.u_camera_to_center_distance),u_viewport_size:new l.aQ(h,t.u_viewport_size)}),debug:(h,t)=>({u_color:new l.aR(h,t.u_color),u_matrix:new l.aN(h,t.u_matrix),u_overlay:new l.aL(h,t.u_overlay),u_overlay_scale:new l.aM(h,t.u_overlay_scale)}),clippingMask:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix)}),heatmap:(h,t)=>({u_extrude_scale:new l.aM(h,t.u_extrude_scale),u_intensity:new l.aM(h,t.u_intensity),u_matrix:new l.aN(h,t.u_matrix)}),heatmapTexture:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_world:new l.aQ(h,t.u_world),u_image:new l.aL(h,t.u_image),u_color_ramp:new l.aL(h,t.u_color_ramp),u_opacity:new l.aM(h,t.u_opacity)}),hillshade:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_image:new l.aL(h,t.u_image),u_latrange:new l.aQ(h,t.u_latrange),u_light:new l.aQ(h,t.u_light),u_shadow:new l.aR(h,t.u_shadow),u_highlight:new l.aR(h,t.u_highlight),u_accent:new l.aR(h,t.u_accent)}),hillshadePrepare:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_image:new l.aL(h,t.u_image),u_dimension:new l.aQ(h,t.u_dimension),u_zoom:new l.aM(h,t.u_zoom),u_unpack:new l.aO(h,t.u_unpack)}),line:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_ratio:new l.aM(h,t.u_ratio),u_device_pixel_ratio:new l.aM(h,t.u_device_pixel_ratio),u_units_to_pixels:new l.aQ(h,t.u_units_to_pixels)}),lineGradient:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_ratio:new l.aM(h,t.u_ratio),u_device_pixel_ratio:new l.aM(h,t.u_device_pixel_ratio),u_units_to_pixels:new l.aQ(h,t.u_units_to_pixels),u_image:new l.aL(h,t.u_image),u_image_height:new l.aM(h,t.u_image_height)}),linePattern:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_texsize:new l.aQ(h,t.u_texsize),u_ratio:new l.aM(h,t.u_ratio),u_device_pixel_ratio:new l.aM(h,t.u_device_pixel_ratio),u_image:new l.aL(h,t.u_image),u_units_to_pixels:new l.aQ(h,t.u_units_to_pixels),u_scale:new l.aP(h,t.u_scale),u_fade:new l.aM(h,t.u_fade)}),lineSDF:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_ratio:new l.aM(h,t.u_ratio),u_device_pixel_ratio:new l.aM(h,t.u_device_pixel_ratio),u_units_to_pixels:new l.aQ(h,t.u_units_to_pixels),u_patternscale_a:new l.aQ(h,t.u_patternscale_a),u_patternscale_b:new l.aQ(h,t.u_patternscale_b),u_sdfgamma:new l.aM(h,t.u_sdfgamma),u_image:new l.aL(h,t.u_image),u_tex_y_a:new l.aM(h,t.u_tex_y_a),u_tex_y_b:new l.aM(h,t.u_tex_y_b),u_mix:new l.aM(h,t.u_mix)}),raster:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_tl_parent:new l.aQ(h,t.u_tl_parent),u_scale_parent:new l.aM(h,t.u_scale_parent),u_buffer_scale:new l.aM(h,t.u_buffer_scale),u_fade_t:new l.aM(h,t.u_fade_t),u_opacity:new l.aM(h,t.u_opacity),u_image0:new l.aL(h,t.u_image0),u_image1:new l.aL(h,t.u_image1),u_brightness_low:new l.aM(h,t.u_brightness_low),u_brightness_high:new l.aM(h,t.u_brightness_high),u_saturation_factor:new l.aM(h,t.u_saturation_factor),u_contrast_factor:new l.aM(h,t.u_contrast_factor),u_spin_weights:new l.aP(h,t.u_spin_weights)}),symbolIcon:(h,t)=>({u_is_size_zoom_constant:new l.aL(h,t.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aL(h,t.u_is_size_feature_constant),u_size_t:new l.aM(h,t.u_size_t),u_size:new l.aM(h,t.u_size),u_camera_to_center_distance:new l.aM(h,t.u_camera_to_center_distance),u_pitch:new l.aM(h,t.u_pitch),u_rotate_symbol:new l.aL(h,t.u_rotate_symbol),u_aspect_ratio:new l.aM(h,t.u_aspect_ratio),u_fade_change:new l.aM(h,t.u_fade_change),u_matrix:new l.aN(h,t.u_matrix),u_label_plane_matrix:new l.aN(h,t.u_label_plane_matrix),u_coord_matrix:new l.aN(h,t.u_coord_matrix),u_is_text:new l.aL(h,t.u_is_text),u_pitch_with_map:new l.aL(h,t.u_pitch_with_map),u_texsize:new l.aQ(h,t.u_texsize),u_texture:new l.aL(h,t.u_texture)}),symbolSDF:(h,t)=>({u_is_size_zoom_constant:new l.aL(h,t.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aL(h,t.u_is_size_feature_constant),u_size_t:new l.aM(h,t.u_size_t),u_size:new l.aM(h,t.u_size),u_camera_to_center_distance:new l.aM(h,t.u_camera_to_center_distance),u_pitch:new l.aM(h,t.u_pitch),u_rotate_symbol:new l.aL(h,t.u_rotate_symbol),u_aspect_ratio:new l.aM(h,t.u_aspect_ratio),u_fade_change:new l.aM(h,t.u_fade_change),u_matrix:new l.aN(h,t.u_matrix),u_label_plane_matrix:new l.aN(h,t.u_label_plane_matrix),u_coord_matrix:new l.aN(h,t.u_coord_matrix),u_is_text:new l.aL(h,t.u_is_text),u_pitch_with_map:new l.aL(h,t.u_pitch_with_map),u_texsize:new l.aQ(h,t.u_texsize),u_texture:new l.aL(h,t.u_texture),u_gamma_scale:new l.aM(h,t.u_gamma_scale),u_device_pixel_ratio:new l.aM(h,t.u_device_pixel_ratio),u_is_halo:new l.aL(h,t.u_is_halo)}),symbolTextAndIcon:(h,t)=>({u_is_size_zoom_constant:new l.aL(h,t.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aL(h,t.u_is_size_feature_constant),u_size_t:new l.aM(h,t.u_size_t),u_size:new l.aM(h,t.u_size),u_camera_to_center_distance:new l.aM(h,t.u_camera_to_center_distance),u_pitch:new l.aM(h,t.u_pitch),u_rotate_symbol:new l.aL(h,t.u_rotate_symbol),u_aspect_ratio:new l.aM(h,t.u_aspect_ratio),u_fade_change:new l.aM(h,t.u_fade_change),u_matrix:new l.aN(h,t.u_matrix),u_label_plane_matrix:new l.aN(h,t.u_label_plane_matrix),u_coord_matrix:new l.aN(h,t.u_coord_matrix),u_is_text:new l.aL(h,t.u_is_text),u_pitch_with_map:new l.aL(h,t.u_pitch_with_map),u_texsize:new l.aQ(h,t.u_texsize),u_texsize_icon:new l.aQ(h,t.u_texsize_icon),u_texture:new l.aL(h,t.u_texture),u_texture_icon:new l.aL(h,t.u_texture_icon),u_gamma_scale:new l.aM(h,t.u_gamma_scale),u_device_pixel_ratio:new l.aM(h,t.u_device_pixel_ratio),u_is_halo:new l.aL(h,t.u_is_halo)}),background:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_opacity:new l.aM(h,t.u_opacity),u_color:new l.aR(h,t.u_color)}),backgroundPattern:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_opacity:new l.aM(h,t.u_opacity),u_image:new l.aL(h,t.u_image),u_pattern_tl_a:new l.aQ(h,t.u_pattern_tl_a),u_pattern_br_a:new l.aQ(h,t.u_pattern_br_a),u_pattern_tl_b:new l.aQ(h,t.u_pattern_tl_b),u_pattern_br_b:new l.aQ(h,t.u_pattern_br_b),u_texsize:new l.aQ(h,t.u_texsize),u_mix:new l.aM(h,t.u_mix),u_pattern_size_a:new l.aQ(h,t.u_pattern_size_a),u_pattern_size_b:new l.aQ(h,t.u_pattern_size_b),u_scale_a:new l.aM(h,t.u_scale_a),u_scale_b:new l.aM(h,t.u_scale_b),u_pixel_coord_upper:new l.aQ(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.aQ(h,t.u_pixel_coord_lower),u_tile_units_to_pixels:new l.aM(h,t.u_tile_units_to_pixels)}),terrain:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_texture:new l.aL(h,t.u_texture),u_ele_delta:new l.aM(h,t.u_ele_delta)}),terrainDepth:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_ele_delta:new l.aM(h,t.u_ele_delta)}),terrainCoords:(h,t)=>({u_matrix:new l.aN(h,t.u_matrix),u_texture:new l.aL(h,t.u_texture),u_terrain_coords_id:new l.aM(h,t.u_terrain_coords_id),u_ele_delta:new l.aM(h,t.u_ele_delta)})};class ys{constructor(t,n,s){this.context=t;const c=t.gl;this.buffer=c.createBuffer(),this.dynamicDraw=!!s,this.context.unbindVAO(),t.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(t){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,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Fa={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class _s{constructor(t,n,s,c){this.length=n.length,this.attributes=s,this.itemSize=n.bytesPerElement,this.dynamicDraw=c,this.context=t;const p=t.gl;this.buffer=p.createBuffer(),t.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(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let s=0;s<this.attributes.length;s++){const c=n.attributes[this.attributes[s].name];c!==void 0&&t.enableVertexAttribArray(c)}}setVertexAttribPointers(t,n,s){for(let c=0;c<this.attributes.length;c++){const p=this.attributes[c],g=n.attributes[p.name];g!==void 0&&t.vertexAttribPointer(g,p.components,t[Fa[p.type]],!1,this.itemSize,p.offset+this.itemSize*(s||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const ua=new WeakMap;function En(h){var t;if(ua.has(h))return ua.get(h);{const n=(t=h.getParameter(h.VERSION))===null||t===void 0?void 0:t.startsWith("WebGL 2.0");return ua.set(h,n),n}}class Tt{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class vs extends Tt{getDefault(){return l.aT.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class cr extends Tt{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class hr extends Tt{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class co extends Tt{getDefault(){return[!0,!0,!0,!0]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class xs extends Tt{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class bs extends Tt{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class ho extends Tt{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const n=this.current;(t.func!==n.func||t.ref!==n.ref||t.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class uo extends Tt{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class ws extends Tt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=t,this.dirty=!1}}class po extends Tt{getDefault(){return[0,1]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class mo extends Tt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=t,this.dirty=!1}}class Ss extends Tt{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Rl extends Tt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.BLEND):n.disable(n.BLEND),this.current=t,this.dirty=!1}}class Bl extends Tt{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class pa extends Tt{getDefault(){return l.aT.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class wh extends Tt{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Sh extends Tt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=t,this.dirty=!1}}class Th extends Tt{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Ih extends Tt{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class Ah extends Tt{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Ch extends Tt{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class fo extends Tt{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Ts extends Tt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class go extends Tt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class yo extends Tt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class da extends Tt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Fl extends Tt{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Ol extends Tt{getDefault(){return null}set(t){var n;if(t===this.current&&!this.dirty)return;const s=this.gl;En(s)?s.bindVertexArray(t):(n=s.getExtension("OES_vertex_array_object"))===null||n===void 0||n.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class _o extends Tt{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class jn extends Tt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class Nl extends Tt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class Pn extends Tt{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class ma extends Pn{setDirty(){this.dirty=!0}set(t){if(t===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,t,0),this.current=t,this.dirty=!1}}class Ul extends Pn{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class vo extends Pn{set(t){if(t===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,t),this.current=t,this.dirty=!1}}class Lt{constructor(t,n,s,c,p){this.context=t,this.width=n,this.height=s;const g=t.gl,_=this.framebuffer=g.createFramebuffer();if(this.colorAttachment=new ma(t,_),c)this.depthAttachment=p?new vo(t,_):new Ul(t,_);else if(p)throw new Error("Stencil cannot be setted without depth");if(g.checkFramebufferStatus(g.FRAMEBUFFER)!==g.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const t=this.context.gl,n=this.colorAttachment.get();if(n&&t.deleteTexture(n),this.depthAttachment){const s=this.depthAttachment.get();s&&t.deleteRenderbuffer(s)}t.deleteFramebuffer(this.framebuffer)}}class ii{constructor(t,n,s){this.blendFunction=t,this.blendColor=n,this.mask=s}}ii.Replace=[1,0],ii.disabled=new ii(ii.Replace,l.aT.transparent,[!1,!1,!1,!1]),ii.unblended=new ii(ii.Replace,l.aT.transparent,[!0,!0,!0,!0]),ii.alphaBlended=new ii([1,771],l.aT.transparent,[!0,!0,!0,!0]);class Eh{constructor(t){var n,s;if(this.gl=t,this.clearColor=new vs(this),this.clearDepth=new cr(this),this.clearStencil=new hr(this),this.colorMask=new co(this),this.depthMask=new xs(this),this.stencilMask=new bs(this),this.stencilFunc=new ho(this),this.stencilOp=new uo(this),this.stencilTest=new ws(this),this.depthRange=new po(this),this.depthTest=new mo(this),this.depthFunc=new Ss(this),this.blend=new Rl(this),this.blendFunc=new Bl(this),this.blendColor=new pa(this),this.blendEquation=new wh(this),this.cullFace=new Sh(this),this.cullFaceSide=new Th(this),this.frontFace=new Ih(this),this.program=new Ah(this),this.activeTexture=new Ch(this),this.viewport=new fo(this),this.bindFramebuffer=new Ts(this),this.bindRenderbuffer=new go(this),this.bindTexture=new yo(this),this.bindVertexBuffer=new da(this),this.bindElementBuffer=new Fl(this),this.bindVertexArray=new Ol(this),this.pixelStoreUnpack=new _o(this),this.pixelStoreUnpackPremultiplyAlpha=new jn(this),this.pixelStoreUnpackFlipY=new Nl(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),En(t)){this.HALF_FLOAT=t.HALF_FLOAT;const c=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(n=t.RGBA16F)!==null&&n!==void 0?n:c?.RGBA16F_EXT,this.RGB16F=(s=t.RGB16F)!==null&&s!==void 0?s:c?.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const c=t.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(t,n){return new ys(this,t,n)}createVertexBuffer(t,n,s){return new _s(this,t,n,s)}createRenderbuffer(t,n,s){const c=this.gl,p=c.createRenderbuffer();return this.bindRenderbuffer.set(p),c.renderbufferStorage(c.RENDERBUFFER,t,n,s),this.bindRenderbuffer.set(null),p}createFramebuffer(t,n,s,c){return new Lt(this,t,n,s,c)}clear({color:t,depth:n,stencil:s}){const c=this.gl;let p=0;t&&(p|=c.COLOR_BUFFER_BIT,this.clearColor.set(t),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)),s!==void 0&&(p|=c.STENCIL_BUFFER_BIT,this.clearStencil.set(s),this.stencilMask.set(255)),c.clear(p)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){l.aG(t.blendFunction,ii.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){var t;return En(this.gl)?this.gl.createVertexArray():(t=this.gl.getExtension("OES_vertex_array_object"))===null||t===void 0?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var n;return En(this.gl)?this.gl.deleteVertexArray(t):(n=this.gl.getExtension("OES_vertex_array_object"))===null||n===void 0?void 0:n.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}class It{constructor(t,n,s){this.func=t,this.mask=n,this.range=s}}It.ReadOnly=!1,It.ReadWrite=!0,It.disabled=new It(519,It.ReadOnly,[0,1]);const Gn=7680;class ri{constructor(t,n,s,c,p,g){this.test=t,this.ref=n,this.mask=s,this.fail=c,this.depthFail=p,this.pass=g}}ri.disabled=new ri({func:519,mask:0},0,0,Gn,Gn,Gn);class Qt{constructor(t,n,s){this.enable=t,this.mode=n,this.frontFace=s}}let Oa;function Vl(h,t,n,s,c,p,g){const _=h.context,b=_.gl,S=h.useProgram("collisionBox"),I=[];let C=0,L=0;for(let W=0;W<s.length;W++){const te=s[W],ce=t.getTile(te),he=ce.getBucket(n);if(!he)continue;let fe=te.posMatrix;c[0]===0&&c[1]===0||(fe=h.translatePosMatrix(te.posMatrix,ce,c,p));const ve=g?he.textCollisionBox:he.iconCollisionBox,_e=he.collisionCircleArray;if(_e.length>0){const we=l.Z(),Fe=fe;l.aU(we,he.placementInvProjMatrix,h.transform.glCoordMatrix),l.aU(we,we,he.placementViewportMatrix),I.push({circleArray:_e,circleOffset:L,transform:Fe,invTransform:we,coord:te}),C+=_e.length/4,L=C}ve&&S.draw(_,b.LINES,It.disabled,ri.disabled,h.colorModeForRenderPass(),Qt.disabled,no(fe,h.transform,ce),h.style.map.terrain&&h.style.map.terrain.getTerrainData(te),n.id,ve.layoutVertexBuffer,ve.indexBuffer,ve.segments,null,h.transform.zoom,null,null,ve.collisionVertexBuffer)}if(!g||!I.length)return;const U=h.useProgram("collisionCircle"),N=new l.aV;N.resize(4*C),N._trim();let j=0;for(const W of I)for(let te=0;te<W.circleArray.length/4;te++){const ce=4*te,he=W.circleArray[ce+0],fe=W.circleArray[ce+1],ve=W.circleArray[ce+2],_e=W.circleArray[ce+3];N.emplace(j++,he,fe,ve,_e,0),N.emplace(j++,he,fe,ve,_e,1),N.emplace(j++,he,fe,ve,_e,2),N.emplace(j++,he,fe,ve,_e,3)}(!Oa||Oa.length<2*C)&&(Oa=function(W){const te=2*W,ce=new l.aX;ce.resize(te),ce._trim();for(let he=0;he<te;he++){const fe=6*he;ce.uint16[fe+0]=4*he+0,ce.uint16[fe+1]=4*he+1,ce.uint16[fe+2]=4*he+2,ce.uint16[fe+3]=4*he+2,ce.uint16[fe+4]=4*he+3,ce.uint16[fe+5]=4*he+0}return ce}(C));const F=_.createIndexBuffer(Oa,!0),ee=_.createVertexBuffer(N,l.aW.members,!0);for(const W of I){const te={u_matrix:W.transform,u_inv_matrix:W.invTransform,u_camera_to_center_distance:(se=h.transform).cameraToCenterDistance,u_viewport_size:[se.width,se.height]};U.draw(_,b.TRIANGLES,It.disabled,ri.disabled,h.colorModeForRenderPass(),Qt.disabled,te,h.style.map.terrain&&h.style.map.terrain.getTerrainData(W.coord),n.id,ee,F,l.S.simpleSegment(0,2*W.circleOffset,W.circleArray.length,W.circleArray.length/2),null,h.transform.zoom,null,null,null)}var se;ee.destroy(),F.destroy()}Qt.disabled=new Qt(!1,1029,2305),Qt.backCCW=new Qt(!0,1029,2305);const xo=l.ao(new Float32Array(16));function Is(h,t,n,s,c,p){const{horizontalAlign:g,verticalAlign:_}=l.au(h);return new l.P((-(g-.5)*t/c+s[0])*p,(-(_-.5)*n/c+s[1])*p)}function As(h,t,n,s,c,p,g,_,b,S,I){const C=h.text.placedSymbolArray,L=h.text.dynamicLayoutVertexArray,U=h.icon.dynamicLayoutVertexArray,N={};L.clear();for(let j=0;j<C.length;j++){const F=C.get(j),ee=F.hidden||!F.crossTileID||h.allowVerticalPlacement&&!F.placedOrientation?null:s[F.crossTileID];if(ee){const se=new l.P(F.anchorX,F.anchorY),W=si(se,n?g:p,I),te=Un(c.cameraToCenterDistance,W.signedDistanceFromCamera);let ce=l.aj(h.textSizeData,b,F)*te/l.ap;n&&(ce*=h.tilePixelRatio/_);const{width:he,height:fe,anchor:ve,textOffset:_e,textBoxScale:we}=ee,Fe=Is(ve,he,fe,_e,we,ce),xt=n?si(se.add(Fe),p,I).point:W.point.add(t?Fe.rotate(-c.angle):Fe),Pe=h.allowVerticalPlacement&&F.placedOrientation===l.ai.vertical?Math.PI/2:0;for(let Ke=0;Ke<F.numGlyphs;Ke++)l.ak(L,xt,Pe);S&&F.associatedIconIndex>=0&&(N[F.associatedIconIndex]={shiftedAnchor:xt,angle:Pe})}else B(F.numGlyphs,L)}if(S){U.clear();const j=h.icon.placedSymbolArray;for(let F=0;F<j.length;F++){const ee=j.get(F);if(ee.hidden)B(ee.numGlyphs,U);else{const se=N[F];if(se)for(let W=0;W<ee.numGlyphs;W++)l.ak(U,se.shiftedAnchor,se.angle);else B(ee.numGlyphs,U)}}h.icon.dynamicLayoutVertexBuffer.updateData(U)}h.text.dynamicLayoutVertexBuffer.updateData(L)}function bo(h,t,n){return n.iconsInText&&t?"symbolTextAndIcon":h?"symbolSDF":"symbolIcon"}function Cs(h,t,n,s,c,p,g,_,b,S,I,C){const L=h.context,U=L.gl,N=h.transform,j=_==="map",F=b==="map",ee=_!=="viewport"&&n.layout.get("symbol-placement")!=="point",se=j&&!F&&!ee,W=!n.layout.get("symbol-sort-key").isConstant();let te=!1;const ce=h.depthModeForSublayer(0,It.ReadOnly),he=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),fe=[];for(const ve of s){const _e=t.getTile(ve),we=_e.getBucket(n);if(!we)continue;const Fe=c?we.text:we.icon;if(!Fe||!Fe.segments.get().length||!Fe.hasVisibleVertices)continue;const xt=Fe.programConfigurations.get(n.id),Pe=c||we.sdfIcons,Ke=c?we.textSizeData:we.iconSizeData,Ne=F||N.pitch!==0,Ut=h.useProgram(bo(Pe,c,we),xt),_t=l.ah(Ke,N.zoom),ht=h.style.map.terrain&&h.style.map.terrain.getTerrainData(ve);let bt,hi,Wt,zi,xi=[0,0],mi=null;if(c)hi=_e.glyphAtlasTexture,Wt=U.LINEAR,bt=_e.glyphAtlasTexture.size,we.iconsInText&&(xi=_e.imageAtlasTexture.size,mi=_e.imageAtlasTexture,zi=Ne||h.options.rotating||h.options.zooming||Ke.kind==="composite"||Ke.kind==="camera"?U.LINEAR:U.NEAREST);else{const ui=n.layout.get("icon-size").constantOr(0)!==1||we.iconsNeedLinear;hi=_e.imageAtlasTexture,Wt=Pe||h.options.rotating||h.options.zooming||ui||Ne?U.LINEAR:U.NEAREST,bt=_e.imageAtlasTexture.size}const dr=J(_e,1,h.transform.zoom),Yt=Ie(ve.posMatrix,F,j,h.transform,dr),Wr=qr(ve.posMatrix,F,j,h.transform,dr),Kr=he&&we.hasTextData(),Ln=n.layout.get("icon-text-fit")!=="none"&&Kr&&we.hasIconData();if(ee){const ui=h.style.map.terrain?(ir,pi)=>h.style.map.terrain.getElevation(ve,ir,pi):null,bi=n.layout.get("text-rotation-alignment")==="map";Ce(we,ve.posMatrix,h,c,Yt,Wr,F,S,bi,ui)}const Kn=h.translatePosMatrix(ve.posMatrix,_e,p,g),ba=ee||c&&he||Ln?xo:Yt,Ui=h.translatePosMatrix(Wr,_e,p,g,!0),Di=Pe&&n.paint.get(c?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Wi;Wi=Pe?we.iconsInText?$n(Ke.kind,_t,se,F,h,Kn,ba,Ui,bt,xi):lo(Ke.kind,_t,se,F,h,Kn,ba,Ui,c,bt,!0):oo(Ke.kind,_t,se,F,h,Kn,ba,Ui,c,bt);const Xn={program:Ut,buffers:Fe,uniformValues:Wi,atlasTexture:hi,atlasTextureIcon:mi,atlasInterpolation:Wt,atlasInterpolationIcon:zi,isSDF:Pe,hasHalo:Di};if(W&&we.canOverlap){te=!0;const ui=Fe.segments.get();for(const bi of ui)fe.push({segments:new l.S([bi]),sortKey:bi.sortKey,state:Xn,terrainData:ht})}else fe.push({segments:Fe.segments,sortKey:0,state:Xn,terrainData:ht})}te&&fe.sort((ve,_e)=>ve.sortKey-_e.sortKey);for(const ve of fe){const _e=ve.state;if(L.activeTexture.set(U.TEXTURE0),_e.atlasTexture.bind(_e.atlasInterpolation,U.CLAMP_TO_EDGE),_e.atlasTextureIcon&&(L.activeTexture.set(U.TEXTURE1),_e.atlasTextureIcon&&_e.atlasTextureIcon.bind(_e.atlasInterpolationIcon,U.CLAMP_TO_EDGE)),_e.isSDF){const we=_e.uniformValues;_e.hasHalo&&(we.u_is_halo=1,wo(_e.buffers,ve.segments,n,h,_e.program,ce,I,C,we,ve.terrainData)),we.u_is_halo=0}wo(_e.buffers,ve.segments,n,h,_e.program,ce,I,C,_e.uniformValues,ve.terrainData)}}function wo(h,t,n,s,c,p,g,_,b,S){const I=s.context;c.draw(I,I.gl.TRIANGLES,p,g,_,Qt.disabled,b,S,n.id,h.layoutVertexBuffer,h.indexBuffer,t,n.paint,s.transform.zoom,h.programConfigurations.get(n.id),h.dynamicLayoutVertexBuffer,h.opacityVertexBuffer)}function Na(h,t,n,s,c){if(!n||!s||!s.imageAtlas)return;const p=s.imageAtlas.patternPositions;let g=p[n.to.toString()],_=p[n.from.toString()];if(!g&&_&&(g=_),!_&&g&&(_=g),!g||!_){const b=c.getPaintProperty(t);g=p[b],_=p[b]}g&&_&&h.setConstantPatternPositions(g,_)}function Ua(h,t,n,s,c,p,g){const _=h.context.gl,b="fill-pattern",S=n.paint.get(b),I=S&&S.constantOr(1),C=n.getCrossfadeParameters();let L,U,N,j,F;g?(U=I&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",L=_.LINES):(U=I?"fillPattern":"fill",L=_.TRIANGLES);const ee=S.constantOr(null);for(const se of s){const W=t.getTile(se);if(I&&!W.patternsLoaded())continue;const te=W.getBucket(n);if(!te)continue;const ce=te.programConfigurations.get(n.id),he=h.useProgram(U,ce),fe=h.style.map.terrain&&h.style.map.terrain.getTerrainData(se);I&&(h.context.activeTexture.set(_.TEXTURE0),W.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),ce.updatePaintBuffers(C)),Na(ce,b,ee,W,n);const ve=fe?se:null,_e=h.translatePosMatrix(ve?ve.posMatrix:se.posMatrix,W,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(g){j=te.indexBuffer2,F=te.segments2;const we=[_.drawingBufferWidth,_.drawingBufferHeight];N=U==="fillOutlinePattern"&&I?ds(_e,h,C,W,we):ps(_e,we)}else j=te.indexBuffer,F=te.segments,N=I?ro(_e,h,C,W):El(_e);he.draw(h.context,L,c,h.stencilModeForClipping(se),p,Qt.disabled,N,fe,n.id,te.layoutVertexBuffer,j,F,n.paint,h.transform.zoom,ce)}}function Va(h,t,n,s,c,p,g){const _=h.context,b=_.gl,S="fill-extrusion-pattern",I=n.paint.get(S),C=I.constantOr(1),L=n.getCrossfadeParameters(),U=n.paint.get("fill-extrusion-opacity"),N=I.constantOr(null);for(const j of s){const F=t.getTile(j),ee=F.getBucket(n);if(!ee)continue;const se=h.style.map.terrain&&h.style.map.terrain.getTerrainData(j),W=ee.programConfigurations.get(n.id),te=h.useProgram(C?"fillExtrusionPattern":"fillExtrusion",W);C&&(h.context.activeTexture.set(b.TEXTURE0),F.imageAtlasTexture.bind(b.LINEAR,b.CLAMP_TO_EDGE),W.updatePaintBuffers(L)),Na(W,S,N,F,n);const ce=h.translatePosMatrix(j.posMatrix,F,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),he=n.paint.get("fill-extrusion-vertical-gradient"),fe=C?An(ce,h,he,U,j,L,F):io(ce,h,he,U);te.draw(_,_.gl.TRIANGLES,c,p,g,Qt.backCCW,fe,se,n.id,ee.layoutVertexBuffer,ee.indexBuffer,ee.segments,n.paint,h.transform.zoom,W,h.style.map.terrain&&ee.centroidVertexBuffer)}}function Ph(h,t,n,s,c,p,g){const _=h.context,b=_.gl,S=n.fbo;if(!S)return;const I=h.useProgram("hillshade"),C=h.style.map.terrain&&h.style.map.terrain.getTerrainData(t);_.activeTexture.set(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,S.colorAttachment.get()),I.draw(_,b.TRIANGLES,c,p,g,Qt.disabled,((L,U,N,j)=>{const F=N.paint.get("hillshade-shadow-color"),ee=N.paint.get("hillshade-highlight-color"),se=N.paint.get("hillshade-accent-color");let W=N.paint.get("hillshade-illumination-direction")*(Math.PI/180);N.paint.get("hillshade-illumination-anchor")==="viewport"&&(W-=L.transform.angle);const te=!L.options.moving;return{u_matrix:j?j.posMatrix:L.transform.calculatePosMatrix(U.tileID.toUnwrapped(),te),u_image:0,u_latrange:ao(0,U.tileID),u_light:[N.paint.get("hillshade-exaggeration"),W],u_shadow:F,u_highlight:ee,u_accent:se}})(h,n,s,C?t:null),C,s.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments)}function So(h,t,n,s,c,p){const g=h.context,_=g.gl,b=t.dem;if(b&&b.data){const S=b.dim,I=b.stride,C=b.getPixels();if(g.activeTexture.set(_.TEXTURE1),g.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||h.getTileTexture(I),t.demTexture){const U=t.demTexture;U.update(C,{premultiply:!1}),U.bind(_.NEAREST,_.CLAMP_TO_EDGE)}else t.demTexture=new Ge(g,C,_.RGBA,{premultiply:!1}),t.demTexture.bind(_.NEAREST,_.CLAMP_TO_EDGE);g.activeTexture.set(_.TEXTURE0);let L=t.fbo;if(!L){const U=new Ge(g,{width:S,height:S,data:null},_.RGBA);U.bind(_.LINEAR,_.CLAMP_TO_EDGE),L=t.fbo=g.createFramebuffer(S,S,!0,!1),L.colorAttachment.set(U.texture)}g.bindFramebuffer.set(L.framebuffer),g.viewport.set([0,0,S,S]),h.useProgram("hillshadePrepare").draw(g,_.TRIANGLES,s,c,p,Qt.disabled,((U,N)=>{const j=N.stride,F=l.Z();return l.aS(F,0,l.N,-l.N,0,0,1),l.$(F,F,[0,-l.N,0]),{u_matrix:F,u_image:1,u_dimension:[j,j],u_zoom:U.overscaledZ,u_unpack:N.getUnpackVector()}})(t.tileID,b),null,n.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function Mh(h,t,n,s,c,p){const g=s.paint.get("raster-fade-duration");if(!p&&g>0){const _=l.h.now(),b=(_-h.timeAdded)/g,S=t?(_-t.timeAdded)/g:-1,I=n.getSource(),C=c.coveringZoomLevel({tileSize:I.tileSize,roundZoom:I.roundZoom}),L=!t||Math.abs(t.tileID.overscaledZ-C)>Math.abs(h.tileID.overscaledZ-C),U=L&&h.refreshedUponExpiration?1:l.ad(L?b:1-S,0,1);return h.refreshedUponExpiration&&b>=1&&(h.refreshedUponExpiration=!1),t?{opacity:1,mix:1-U}:{opacity:U,mix:0}}return{opacity:1,mix:0}}const $l=new l.aT(1,0,0,1),Es=new l.aT(0,1,0,1),To=new l.aT(0,0,1,1),jl=new l.aT(1,0,1,1),Gl=new l.aT(0,1,1,1);function $a(h,t,n,s){Ms(h,0,t+n/2,h.transform.width,n,s)}function Ps(h,t,n,s){Ms(h,t-n/2,0,n,h.transform.height,s)}function Ms(h,t,n,s,c,p){const g=h.context,_=g.gl;_.enable(_.SCISSOR_TEST),_.scissor(t*h.pixelRatio,n*h.pixelRatio,s*h.pixelRatio,c*h.pixelRatio),g.clear({color:p}),_.disable(_.SCISSOR_TEST)}function ql(h,t,n){const s=h.context,c=s.gl,p=n.posMatrix,g=h.useProgram("debug"),_=It.disabled,b=ri.disabled,S=h.colorModeForRenderPass(),I="$debug",C=h.style.map.terrain&&h.style.map.terrain.getTerrainData(n);s.activeTexture.set(c.TEXTURE0);const L=t.getTileByID(n.key).latestRawTileData,U=Math.floor((L&&L.byteLength||0)/1024),N=t.getTile(n).tileSize,j=512/Math.min(N,512)*(n.overscaledZ/h.transform.zoom)*.5;let F=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(F+=` => ${n.overscaledZ}`),function(ee,se){ee.initDebugOverlayCanvas();const W=ee.debugOverlayCanvas,te=ee.context.gl,ce=ee.debugOverlayCanvas.getContext("2d");ce.clearRect(0,0,W.width,W.height),ce.shadowColor="white",ce.shadowBlur=2,ce.lineWidth=1.5,ce.strokeStyle="white",ce.textBaseline="top",ce.font="bold 36px Open Sans, sans-serif",ce.fillText(se,5,5),ce.strokeText(se,5,5),ee.debugOverlayTexture.update(W),ee.debugOverlayTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE)}(h,`${F} ${U}kB`),g.draw(s,c.TRIANGLES,_,b,ii.alphaBlended,Qt.disabled,Ba(p,l.aT.transparent,j),null,I,h.debugBuffer,h.quadTriangleIndexBuffer,h.debugSegments),g.draw(s,c.LINE_STRIP,_,b,S,Qt.disabled,Ba(p,l.aT.red),C,I,h.debugBuffer,h.tileBorderIndexBuffer,h.debugSegments)}function li(h,t,n){const s=h.context,c=s.gl,p=h.colorModeForRenderPass(),g=new It(c.LEQUAL,It.ReadWrite,h.depthRangeFor3D),_=h.useProgram("terrain"),b=t.getTerrainMesh();s.bindFramebuffer.set(null),s.viewport.set([0,0,h.width,h.height]);for(const S of n){const I=h.renderToTexture.getTexture(S),C=t.getTerrainData(S.tileID);s.activeTexture.set(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,I.texture);const L={u_matrix:h.transform.calculatePosMatrix(S.tileID.toUnwrapped()),u_texture:0,u_ele_delta:t.getMeshFrameDelta(h.transform.zoom)};_.draw(s,c.TRIANGLES,g,ri.disabled,p,Qt.backCCW,L,C,"terrain",b.vertexBuffer,b.indexBuffer,b.segments)}}class qn{constructor(t,n){this.context=new Eh(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:l.Z(),renderTime:0},this.setup(),this.numSublayers=Qi.maxUnderzooming+Qi.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new cs}resize(t,n,s){if(this.width=Math.floor(t*s),this.height=Math.floor(n*s),this.pixelRatio=s,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 t=this.context,n=new l.a_;n.emplaceBack(0,0),n.emplaceBack(l.N,0),n.emplaceBack(0,l.N),n.emplaceBack(l.N,l.N),this.tileExtentBuffer=t.createVertexBuffer(n,hs.members),this.tileExtentSegments=l.S.simpleSegment(0,0,4,2);const s=new l.a_;s.emplaceBack(0,0),s.emplaceBack(l.N,0),s.emplaceBack(0,l.N),s.emplaceBack(l.N,l.N),this.debugBuffer=t.createVertexBuffer(s,hs.members),this.debugSegments=l.S.simpleSegment(0,0,4,5);const c=new l.V;c.emplaceBack(0,0,0,0),c.emplaceBack(l.N,0,l.N,0),c.emplaceBack(0,l.N,0,l.N),c.emplaceBack(l.N,l.N,l.N,l.N),this.rasterBoundsBuffer=t.createVertexBuffer(c,Dr.members),this.rasterBoundsSegments=l.S.simpleSegment(0,0,4,2);const p=new l.a_;p.emplaceBack(0,0),p.emplaceBack(1,0),p.emplaceBack(0,1),p.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(p,hs.members),this.viewportSegments=l.S.simpleSegment(0,0,4,2);const g=new l.a$;g.emplaceBack(0),g.emplaceBack(1),g.emplaceBack(3),g.emplaceBack(2),g.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(g);const _=new l.b0;_.emplaceBack(0,1,2),_.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(_);const b=this.context.gl;this.stencilClearMode=new ri({func:b.ALWAYS,mask:0},0,255,b.ZERO,b.ZERO,b.ZERO)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const s=l.Z();l.aS(s,0,this.width,this.height,0,0,1),l.a0(s,s,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,It.disabled,this.stencilClearMode,ii.disabled,Qt.disabled,Pl(s),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n){if(this.currentStencilSource===t.source||!t.isTileClipped()||!n||!n.length)return;this.currentStencilSource=t.source;const s=this.context,c=s.gl;this.nextStencilID+n.length>256&&this.clearStencil(),s.setColorMode(ii.disabled),s.setDepthMode(It.disabled);const p=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const g of n){const _=this._tileClippingMaskIDs[g.key]=this.nextStencilID++,b=this.style.map.terrain&&this.style.map.terrain.getTerrainData(g);p.draw(s,c.TRIANGLES,It.disabled,new ri({func:c.ALWAYS,mask:0},_,255,c.KEEP,c.KEEP,c.REPLACE),ii.disabled,Qt.disabled,Pl(g.posMatrix),b,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new ri({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new ri({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,s=t.sort((g,_)=>_.overscaledZ-g.overscaledZ),c=s[s.length-1].overscaledZ,p=s[0].overscaledZ-c+1;if(p>1){this.currentStencilSource=void 0,this.nextStencilID+p>256&&this.clearStencil();const g={};for(let _=0;_<p;_++)g[_+c]=new ri({func:n.GEQUAL,mask:255},_+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=p,[g,s]}return[{[c]:ri.disabled},s]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new ii([t.CONSTANT_COLOR,t.ONE],new l.aT(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?ii.unblended:ii.alphaBlended}depthModeForSublayer(t,n,s){if(!this.opaquePassEnabledForLayer())return It.disabled;const c=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new It(s||this.context.gl.LEQUAL,n,[c,c])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(l.h.now()),this.imageManager.beginFrame();const s=this.style._order,c=this.style.sourceCaches,p={},g={},_={};for(const b in c){const S=c[b];S.used&&S.prepare(this.context),p[b]=S.getVisibleCoordinates(),g[b]=p[b].slice().reverse(),_[b]=S.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let b=0;b<s.length;b++)if(this.style._layers[s[b]].is3D()){this.opaquePassCutoff=b;break}if(this.renderToTexture){this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0;const b=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!l.b1(this.terrainFacilitator.matrix,this.transform.projMatrix)||b.length)&&(l.b2(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(S,I){const C=S.context,L=C.gl,U=ii.unblended,N=new It(L.LEQUAL,It.ReadWrite,[0,1]),j=I.getTerrainMesh(),F=I.sourceCache.getRenderableTiles(),ee=S.useProgram("terrainDepth");C.bindFramebuffer.set(I.getFramebuffer("depth").framebuffer),C.viewport.set([0,0,S.width/devicePixelRatio,S.height/devicePixelRatio]),C.clear({color:l.aT.transparent,depth:1});for(const se of F){const W=I.getTerrainData(se.tileID),te={u_matrix:S.transform.calculatePosMatrix(se.tileID.toUnwrapped()),u_ele_delta:I.getMeshFrameDelta(S.transform.zoom)};ee.draw(C,L.TRIANGLES,N,ri.disabled,U,Qt.backCCW,te,W,"terrain",j.vertexBuffer,j.indexBuffer,j.segments)}C.bindFramebuffer.set(null),C.viewport.set([0,0,S.width,S.height])}(this,this.style.map.terrain),function(S,I){const C=S.context,L=C.gl,U=ii.unblended,N=new It(L.LEQUAL,It.ReadWrite,[0,1]),j=I.getTerrainMesh(),F=I.getCoordsTexture(),ee=I.sourceCache.getRenderableTiles(),se=S.useProgram("terrainCoords");C.bindFramebuffer.set(I.getFramebuffer("coords").framebuffer),C.viewport.set([0,0,S.width/devicePixelRatio,S.height/devicePixelRatio]),C.clear({color:l.aT.transparent,depth:1}),I.coordsIndex=[];for(const W of ee){const te=I.getTerrainData(W.tileID);C.activeTexture.set(L.TEXTURE0),L.bindTexture(L.TEXTURE_2D,F.texture);const ce={u_matrix:S.transform.calculatePosMatrix(W.tileID.toUnwrapped()),u_terrain_coords_id:(255-I.coordsIndex.length)/255,u_texture:0,u_ele_delta:I.getMeshFrameDelta(S.transform.zoom)};se.draw(C,L.TRIANGLES,N,ri.disabled,U,Qt.backCCW,ce,te,"terrain",j.vertexBuffer,j.indexBuffer,j.segments),I.coordsIndex.push(W.tileID.key)}C.bindFramebuffer.set(null),C.viewport.set([0,0,S.width,S.height])}(this,this.style.map.terrain))}this.renderPass="offscreen";for(const b of s){const S=this.style._layers[b];if(!S.hasOffscreenPass()||S.isHidden(this.transform.zoom))continue;const I=g[S.source];(S.type==="custom"||I.length)&&this.renderLayer(this,c[S.source],S,I)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?l.aT.black:l.aT.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=s.length-1;this.currentLayer>=0;this.currentLayer--){const b=this.style._layers[s[this.currentLayer]],S=c[b.source],I=p[b.source];this._renderTileClippingMasks(b,I),this.renderLayer(this,S,b,I)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<s.length;this.currentLayer++){const b=this.style._layers[s[this.currentLayer]],S=c[b.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(b))continue;const I=(b.type==="symbol"?_:g)[b.source];this._renderTileClippingMasks(b,p[b.source]),this.renderLayer(this,S,b,I)}if(this.options.showTileBoundaries){const b=function(S,I){let C=null;const L=Object.values(S._layers).flatMap(F=>F.source&&!F.isHidden(I)?[S.sourceCaches[F.source]]:[]),U=L.filter(F=>F.getSource().type==="vector"),N=L.filter(F=>F.getSource().type!=="vector"),j=F=>{(!C||C.getSource().maxzoom<F.getSource().maxzoom)&&(C=F)};return U.forEach(F=>j(F)),C||N.forEach(F=>j(F)),C}(this.style,this.transform.zoom);b&&function(S,I,C){for(let L=0;L<C.length;L++)ql(S,I,C[L])}(this,b,b.getVisibleCoordinates())}this.options.showPadding&&function(b){const S=b.transform.padding;$a(b,b.transform.height-(S.top||0),3,$l),$a(b,S.bottom||0,3,Es),Ps(b,S.left||0,3,To),Ps(b,b.transform.width-(S.right||0),3,jl);const I=b.transform.centerPoint;(function(C,L,U,N){Ms(C,L-1,U-10,2,20,N),Ms(C,L-10,U-1,20,2,N)})(b,I.x,b.transform.height-I.y,Gl)}(this),this.context.setDefault()}renderLayer(t,n,s,c){if(!s.isHidden(this.transform.zoom)&&(s.type==="background"||s.type==="custom"||(c||[]).length))switch(this.id=s.id,s.type){case"symbol":(function(p,g,_,b,S){if(p.renderPass!=="translucent")return;const I=ri.disabled,C=p.colorModeForRenderPass();(_._unevaluatedLayout.hasValue("text-variable-anchor")||_._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(L,U,N,j,F,ee,se){const W=U.transform,te=F==="map",ce=ee==="map";for(const he of L){const fe=j.getTile(he),ve=fe.getBucket(N);if(!ve||!ve.text||!ve.text.segments.get().length)continue;const _e=l.ah(ve.textSizeData,W.zoom),we=J(fe,1,U.transform.zoom),Fe=Ie(he.posMatrix,ce,te,U.transform,we),xt=N.layout.get("icon-text-fit")!=="none"&&ve.hasIconData();if(_e){const Pe=Math.pow(2,W.zoom-fe.tileID.overscaledZ);As(ve,te,ce,se,W,Fe,he.posMatrix,Pe,_e,xt,U.style.map.terrain?(Ke,Ne)=>U.style.map.terrain.getElevation(he,Ke,Ne):null)}}}(b,p,_,g,_.layout.get("text-rotation-alignment"),_.layout.get("text-pitch-alignment"),S),_.paint.get("icon-opacity").constantOr(1)!==0&&Cs(p,g,_,b,!1,_.paint.get("icon-translate"),_.paint.get("icon-translate-anchor"),_.layout.get("icon-rotation-alignment"),_.layout.get("icon-pitch-alignment"),_.layout.get("icon-keep-upright"),I,C),_.paint.get("text-opacity").constantOr(1)!==0&&Cs(p,g,_,b,!0,_.paint.get("text-translate"),_.paint.get("text-translate-anchor"),_.layout.get("text-rotation-alignment"),_.layout.get("text-pitch-alignment"),_.layout.get("text-keep-upright"),I,C),g.map.showCollisionBoxes&&(Vl(p,g,_,b,_.paint.get("text-translate"),_.paint.get("text-translate-anchor"),!0),Vl(p,g,_,b,_.paint.get("icon-translate"),_.paint.get("icon-translate-anchor"),!1))})(t,n,s,c,this.style.placement.variableOffsets);break;case"circle":(function(p,g,_,b){if(p.renderPass!=="translucent")return;const S=_.paint.get("circle-opacity"),I=_.paint.get("circle-stroke-width"),C=_.paint.get("circle-stroke-opacity"),L=!_.layout.get("circle-sort-key").isConstant();if(S.constantOr(1)===0&&(I.constantOr(1)===0||C.constantOr(1)===0))return;const U=p.context,N=U.gl,j=p.depthModeForSublayer(0,It.ReadOnly),F=ri.disabled,ee=p.colorModeForRenderPass(),se=[];for(let W=0;W<b.length;W++){const te=b[W],ce=g.getTile(te),he=ce.getBucket(_);if(!he)continue;const fe=he.programConfigurations.get(_.id),ve=p.useProgram("circle",fe),_e=he.layoutVertexBuffer,we=he.indexBuffer,Fe=p.style.map.terrain&&p.style.map.terrain.getTerrainData(te),xt={programConfiguration:fe,program:ve,layoutVertexBuffer:_e,indexBuffer:we,uniformValues:Cn(p,te,ce,_),terrainData:Fe};if(L){const Pe=he.segments.get();for(const Ke of Pe)se.push({segments:new l.S([Ke]),sortKey:Ke.sortKey,state:xt})}else se.push({segments:he.segments,sortKey:0,state:xt})}L&&se.sort((W,te)=>W.sortKey-te.sortKey);for(const W of se){const{programConfiguration:te,program:ce,layoutVertexBuffer:he,indexBuffer:fe,uniformValues:ve,terrainData:_e}=W.state;ce.draw(U,N.TRIANGLES,j,F,ee,Qt.disabled,ve,_e,_.id,he,fe,W.segments,_.paint,p.transform.zoom,te)}})(t,n,s,c);break;case"heatmap":(function(p,g,_,b){if(_.paint.get("heatmap-opacity")!==0)if(p.renderPass==="offscreen"){const S=p.context,I=S.gl,C=ri.disabled,L=new ii([I.ONE,I.ONE],l.aT.transparent,[!0,!0,!0,!0]);(function(U,N,j){const F=U.gl;U.activeTexture.set(F.TEXTURE1),U.viewport.set([0,0,N.width/4,N.height/4]);let ee=j.heatmapFbo;if(ee)F.bindTexture(F.TEXTURE_2D,ee.colorAttachment.get()),U.bindFramebuffer.set(ee.framebuffer);else{const se=F.createTexture();F.bindTexture(F.TEXTURE_2D,se),F.texParameteri(F.TEXTURE_2D,F.TEXTURE_WRAP_S,F.CLAMP_TO_EDGE),F.texParameteri(F.TEXTURE_2D,F.TEXTURE_WRAP_T,F.CLAMP_TO_EDGE),F.texParameteri(F.TEXTURE_2D,F.TEXTURE_MIN_FILTER,F.LINEAR),F.texParameteri(F.TEXTURE_2D,F.TEXTURE_MAG_FILTER,F.LINEAR),ee=j.heatmapFbo=U.createFramebuffer(N.width/4,N.height/4,!1,!1),function(W,te,ce,he){var fe,ve;const _e=W.gl,we=(fe=W.HALF_FLOAT)!==null&&fe!==void 0?fe:_e.UNSIGNED_BYTE,Fe=(ve=W.RGBA16F)!==null&&ve!==void 0?ve:_e.RGBA;_e.texImage2D(_e.TEXTURE_2D,0,Fe,te.width/4,te.height/4,0,_e.RGBA,we,null),he.colorAttachment.set(ce)}(U,N,se,ee)}})(S,p,_),S.clear({color:l.aT.transparent});for(let U=0;U<b.length;U++){const N=b[U];if(g.hasRenderableParent(N))continue;const j=g.getTile(N),F=j.getBucket(_);if(!F)continue;const ee=F.programConfigurations.get(_.id),se=p.useProgram("heatmap",ee),{zoom:W}=p.transform;se.draw(S,I.TRIANGLES,It.disabled,C,L,Qt.disabled,xh(N.posMatrix,j,W,_.paint.get("heatmap-intensity")),null,_.id,F.layoutVertexBuffer,F.indexBuffer,F.segments,_.paint,p.transform.zoom,ee)}S.viewport.set([0,0,p.width,p.height])}else p.renderPass==="translucent"&&(p.context.setColorMode(p.colorModeForRenderPass()),function(S,I){const C=S.context,L=C.gl,U=I.heatmapFbo;if(!U)return;C.activeTexture.set(L.TEXTURE0),L.bindTexture(L.TEXTURE_2D,U.colorAttachment.get()),C.activeTexture.set(L.TEXTURE1);let N=I.colorRampTexture;N||(N=I.colorRampTexture=new Ge(C,I.colorRamp,L.RGBA)),N.bind(L.LINEAR,L.CLAMP_TO_EDGE),S.useProgram("heatmapTexture").draw(C,L.TRIANGLES,It.disabled,ri.disabled,S.colorModeForRenderPass(),Qt.disabled,((j,F,ee,se)=>{const W=l.Z();l.aS(W,0,j.width,j.height,0,0,1);const te=j.context.gl;return{u_matrix:W,u_world:[te.drawingBufferWidth,te.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:F.paint.get("heatmap-opacity")}})(S,I),null,I.id,S.viewportBuffer,S.quadTriangleIndexBuffer,S.viewportSegments,I.paint,S.transform.zoom)}(p,_))})(t,n,s,c);break;case"line":(function(p,g,_,b){if(p.renderPass!=="translucent")return;const S=_.paint.get("line-opacity"),I=_.paint.get("line-width");if(S.constantOr(1)===0||I.constantOr(1)===0)return;const C=p.depthModeForSublayer(0,It.ReadOnly),L=p.colorModeForRenderPass(),U=_.paint.get("line-dasharray"),N=_.paint.get("line-pattern"),j=N.constantOr(1),F=_.paint.get("line-gradient"),ee=_.getCrossfadeParameters(),se=j?"linePattern":U?"lineSDF":F?"lineGradient":"line",W=p.context,te=W.gl;let ce=!0;for(const he of b){const fe=g.getTile(he);if(j&&!fe.patternsLoaded())continue;const ve=fe.getBucket(_);if(!ve)continue;const _e=ve.programConfigurations.get(_.id),we=p.context.program.get(),Fe=p.useProgram(se,_e),xt=ce||Fe.program!==we,Pe=p.style.map.terrain&&p.style.map.terrain.getTerrainData(he),Ke=N.constantOr(null);if(Ke&&fe.imageAtlas){const _t=fe.imageAtlas,ht=_t.patternPositions[Ke.to.toString()],bt=_t.patternPositions[Ke.from.toString()];ht&&bt&&_e.setConstantPatternPositions(ht,bt)}const Ne=Pe?he:null,Ut=j?bh(p,fe,_,ee,Ne):U?kl(p,fe,_,U,ee,Ne):F?Ml(p,fe,_,ve.lineClipsArray.length,Ne):so(p,fe,_,Ne);if(j)W.activeTexture.set(te.TEXTURE0),fe.imageAtlasTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE),_e.updatePaintBuffers(ee);else if(U&&(xt||p.lineAtlas.dirty))W.activeTexture.set(te.TEXTURE0),p.lineAtlas.bind(W);else if(F){const _t=ve.gradients[_.id];let ht=_t.texture;if(_.gradientVersion!==_t.version){let bt=256;if(_.stepInterpolant){const hi=g.getSource().maxzoom,Wt=he.canonical.z===hi?Math.ceil(1<<p.transform.maxZoom-he.canonical.z):1;bt=l.ad(l.aY(ve.maxLineLength/l.N*1024*Wt),256,W.maxTextureSize)}_t.gradient=l.aZ({expression:_.gradientExpression(),evaluationKey:"lineProgress",resolution:bt,image:_t.gradient||void 0,clips:ve.lineClipsArray}),_t.texture?_t.texture.update(_t.gradient):_t.texture=new Ge(W,_t.gradient,te.RGBA),_t.version=_.gradientVersion,ht=_t.texture}W.activeTexture.set(te.TEXTURE0),ht.bind(_.stepInterpolant?te.NEAREST:te.LINEAR,te.CLAMP_TO_EDGE)}Fe.draw(W,te.TRIANGLES,C,p.stencilModeForClipping(he),L,Qt.disabled,Ut,Pe,_.id,ve.layoutVertexBuffer,ve.indexBuffer,ve.segments,_.paint,p.transform.zoom,_e,ve.layoutVertexBuffer2),ce=!1}})(t,n,s,c);break;case"fill":(function(p,g,_,b){const S=_.paint.get("fill-color"),I=_.paint.get("fill-opacity");if(I.constantOr(1)===0)return;const C=p.colorModeForRenderPass(),L=_.paint.get("fill-pattern"),U=p.opaquePassEnabledForLayer()&&!L.constantOr(1)&&S.constantOr(l.aT.transparent).a===1&&I.constantOr(0)===1?"opaque":"translucent";if(p.renderPass===U){const N=p.depthModeForSublayer(1,p.renderPass==="opaque"?It.ReadWrite:It.ReadOnly);Ua(p,g,_,b,N,C,!1)}if(p.renderPass==="translucent"&&_.paint.get("fill-antialias")){const N=p.depthModeForSublayer(_.getPaintProperty("fill-outline-color")?2:0,It.ReadOnly);Ua(p,g,_,b,N,C,!0)}})(t,n,s,c);break;case"fill-extrusion":(function(p,g,_,b){const S=_.paint.get("fill-extrusion-opacity");if(S!==0&&p.renderPass==="translucent"){const I=new It(p.context.gl.LEQUAL,It.ReadWrite,p.depthRangeFor3D);if(S!==1||_.paint.get("fill-extrusion-pattern").constantOr(1))Va(p,g,_,b,I,ri.disabled,ii.disabled),Va(p,g,_,b,I,p.stencilModeFor3D(),p.colorModeForRenderPass());else{const C=p.colorModeForRenderPass();Va(p,g,_,b,I,ri.disabled,C)}}})(t,n,s,c);break;case"hillshade":(function(p,g,_,b){if(p.renderPass!=="offscreen"&&p.renderPass!=="translucent")return;const S=p.context,I=p.depthModeForSublayer(0,It.ReadOnly),C=p.colorModeForRenderPass(),[L,U]=p.renderPass==="translucent"?p.stencilConfigForOverlap(b):[{},b];for(const N of U){const j=g.getTile(N);j.needsHillshadePrepare!==void 0&&j.needsHillshadePrepare&&p.renderPass==="offscreen"?So(p,j,_,I,ri.disabled,C):p.renderPass==="translucent"&&Ph(p,N,j,_,I,L[N.overscaledZ],C)}S.viewport.set([0,0,p.width,p.height])})(t,n,s,c);break;case"raster":(function(p,g,_,b){if(p.renderPass!=="translucent"||_.paint.get("raster-opacity")===0||!b.length)return;const S=p.context,I=S.gl,C=g.getSource(),L=p.useProgram("raster"),U=p.colorModeForRenderPass(),[N,j]=C instanceof xr?[{},b]:p.stencilConfigForOverlap(b),F=j[j.length-1].overscaledZ,ee=!p.options.moving;for(const se of j){const W=p.depthModeForSublayer(se.overscaledZ-F,_.paint.get("raster-opacity")===1?It.ReadWrite:It.ReadOnly,I.LESS),te=g.getTile(se);te.registerFadeDuration(_.paint.get("raster-fade-duration"));const ce=g.findLoadedParent(se,0),he=Mh(te,ce,g,_,p.transform,p.style.map.terrain);let fe,ve;const _e=_.paint.get("raster-resampling")==="nearest"?I.NEAREST:I.LINEAR;S.activeTexture.set(I.TEXTURE0),te.texture.bind(_e,I.CLAMP_TO_EDGE,I.LINEAR_MIPMAP_NEAREST),S.activeTexture.set(I.TEXTURE1),ce?(ce.texture.bind(_e,I.CLAMP_TO_EDGE,I.LINEAR_MIPMAP_NEAREST),fe=Math.pow(2,ce.tileID.overscaledZ-te.tileID.overscaledZ),ve=[te.tileID.canonical.x*fe%1,te.tileID.canonical.y*fe%1]):te.texture.bind(_e,I.CLAMP_TO_EDGE,I.LINEAR_MIPMAP_NEAREST);const we=p.style.map.terrain&&p.style.map.terrain.getTerrainData(se),Fe=we?se:null,xt=Fe?Fe.posMatrix:p.transform.calculatePosMatrix(se.toUnwrapped(),ee),Pe=zl(xt,ve||[0,0],fe||1,he,_);C instanceof xr?L.draw(S,I.TRIANGLES,W,ri.disabled,U,Qt.disabled,Pe,we,_.id,C.boundsBuffer,p.quadTriangleIndexBuffer,C.boundsSegments):L.draw(S,I.TRIANGLES,W,N[se.overscaledZ],U,Qt.disabled,Pe,we,_.id,p.rasterBoundsBuffer,p.quadTriangleIndexBuffer,p.rasterBoundsSegments)}})(t,n,s,c);break;case"background":(function(p,g,_,b){const S=_.paint.get("background-color"),I=_.paint.get("background-opacity");if(I===0)return;const C=p.context,L=C.gl,U=p.transform,N=U.tileSize,j=_.paint.get("background-pattern");if(p.isPatternMissing(j))return;const F=!j&&S.a===1&&I===1&&p.opaquePassEnabledForLayer()?"opaque":"translucent";if(p.renderPass!==F)return;const ee=ri.disabled,se=p.depthModeForSublayer(0,F==="opaque"?It.ReadWrite:It.ReadOnly),W=p.colorModeForRenderPass(),te=p.useProgram(j?"backgroundPattern":"background"),ce=b||U.coveringTiles({tileSize:N,terrain:p.style.map.terrain});j&&(C.activeTexture.set(L.TEXTURE0),p.imageManager.bind(p.context));const he=_.getCrossfadeParameters();for(const fe of ce){const ve=b?fe.posMatrix:p.transform.calculatePosMatrix(fe.toUnwrapped()),_e=j?Ir(ve,I,p,j,{tileID:fe,tileSize:N},he):fs(ve,I,S),we=p.style.map.terrain&&p.style.map.terrain.getTerrainData(fe);te.draw(C,L.TRIANGLES,se,ee,W,Qt.disabled,_e,we,_.id,p.tileExtentBuffer,p.quadTriangleIndexBuffer,p.tileExtentSegments)}})(t,0,s,c);break;case"custom":(function(p,g,_){const b=p.context,S=_.implementation;if(p.renderPass==="offscreen"){const I=S.prerender;I&&(p.setCustomLayerDefaults(),b.setColorMode(p.colorModeForRenderPass()),I.call(S,b.gl,p.transform.customLayerMatrix()),b.setDirty(),p.setBaseState())}else if(p.renderPass==="translucent"){p.setCustomLayerDefaults(),b.setColorMode(p.colorModeForRenderPass()),b.setStencilMode(ri.disabled);const I=S.renderingMode==="3d"?new It(p.context.gl.LEQUAL,It.ReadWrite,p.depthRangeFor3D):p.depthModeForSublayer(0,It.ReadOnly);b.setDepthMode(I),S.render(b.gl,p.transform.customLayerMatrix()),b.setDirty(),p.setBaseState(),b.bindFramebuffer.set(null)}})(t,0,s)}}translatePosMatrix(t,n,s,c,p){if(!s[0]&&!s[1])return t;const g=p?c==="map"?this.transform.angle:0:c==="viewport"?-this.transform.angle:0;if(g){const S=Math.sin(g),I=Math.cos(g);s=[s[0]*I-s[1]*S,s[0]*S+s[1]*I]}const _=[p?s[0]:J(n,s[0],this.transform.zoom),p?s[1]:J(n,s[1],this.transform.zoom),0],b=new Float32Array(16);return l.$(b,t,_),b}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const n=this.imageManager.getPattern(t.from.toString()),s=this.imageManager.getPattern(t.to.toString());return!n||!s}useProgram(t,n){this.cache=this.cache||{};const s=t+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[s]||(this.cache[s]=new us(this.context,ti[t],n,gs[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[s]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Ge(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:n}=this.context.gl;return this.width!==t||this.height!==n}}class er{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,s){const c=Math.pow(2,s),p=[[-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(_=>{const b=1/(_=l.ag([],_,t))[3]/n*c;return l.b3(_,_,[b,b,1/_[3],b])}),g=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(_=>{const b=function(L,U){var N=U[0],j=U[1],F=U[2],ee=N*N+j*j+F*F;return ee>0&&(ee=1/Math.sqrt(ee)),L[0]=U[0]*ee,L[1]=U[1]*ee,L[2]=U[2]*ee,L}([],function(L,U,N){var j=U[0],F=U[1],ee=U[2],se=N[0],W=N[1],te=N[2];return L[0]=F*te-ee*W,L[1]=ee*se-j*te,L[2]=j*W-F*se,L}([],Qe([],p[_[0]],p[_[1]]),Qe([],p[_[2]],p[_[1]]))),S=-((I=b)[0]*(C=p[_[1]])[0]+I[1]*C[1]+I[2]*C[2]);var I,C;return b.concat(S)});return new er(p,g)}}class fa{constructor(t,n){this.min=t,this.max=n,this.center=function(s,c,p){return s[0]=.5*c[0],s[1]=.5*c[1],s[2]=.5*c[2],s}([],function(s,c,p){return s[0]=c[0]+p[0],s[1]=c[1]+p[1],s[2]=c[2]+p[2],s}([],this.min,this.max))}quadrant(t){const n=[t%2==0,t<2],s=Ue(this.min),c=Ue(this.max);for(let p=0;p<n.length;p++)s[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 fa(s,c)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersects(t){const n=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let s=!0;for(let c=0;c<t.planes.length;c++){const p=t.planes[c];let g=0;for(let _=0;_<n.length;_++)l.b4(p,n[_])>=0&&g++;if(g===0)return 0;g!==n.length&&(s=!1)}if(s)return 2;for(let c=0;c<3;c++){let p=Number.MAX_VALUE,g=-Number.MAX_VALUE;for(let _=0;_<t.points.length;_++){const b=t.points[_][c]-this.min[c];p=Math.min(p,b),g=Math.max(g,b)}if(g<0||p>this.max[c]-this.min[c])return 0}return 1}}class ja{constructor(t=0,n=0,s=0,c=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(s)||s<0||isNaN(c)||c<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=s,this.right=c}interpolate(t,n,s){return n.top!=null&&t.top!=null&&(this.top=l.B.number(t.top,n.top,s)),n.bottom!=null&&t.bottom!=null&&(this.bottom=l.B.number(t.bottom,n.bottom,s)),n.left!=null&&t.left!=null&&(this.left=l.B.number(t.left,n.left,s)),n.right!=null&&t.right!=null&&(this.right=l.B.number(t.right,n.right,s)),this}getCenter(t,n){const s=l.ad((this.left+t-this.right)/2,0,t),c=l.ad((this.top+n-this.bottom)/2,0,n);return new l.P(s,c)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new ja(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class ks{constructor(t,n,s,c,p){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=p===void 0||!!p,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=s??0,this._maxPitch=c??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new l.L(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new ja,this._posMatrixCache={},this._alignedPosMatrixCache={},this._minEleveationForCurrentTile=0}clone(){const t=new ks(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this._minEleveationForCurrentTile=t._minEleveationForCurrentTile,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new l.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-l.b5(t,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=function(){var s=new l.A(4);return l.A!=Float32Array&&(s[1]=0,s[2]=0),s[0]=1,s[3]=1,s}(),function(s,c,p){var g=c[0],_=c[1],b=c[2],S=c[3],I=Math.sin(p),C=Math.cos(p);s[0]=g*C+b*I,s[1]=_*C+S*I,s[2]=g*-I+b*C,s[3]=_*-I+S*C}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=l.ad(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const n=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this.tileZoom=Math.max(0,Math.floor(n)),this.scale=this.zoomScale(n),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,s){this._unmodified=!1,this._edgeInsets.interpolate(t,n,s),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new l.b6(0,t)];if(this._renderWorldCopies){const s=this.pointCoordinate(new l.P(0,0)),c=this.pointCoordinate(new l.P(this.width,0)),p=this.pointCoordinate(new l.P(this.width,this.height)),g=this.pointCoordinate(new l.P(0,this.height)),_=Math.floor(Math.min(s.x,c.x,p.x,g.x)),b=Math.floor(Math.max(s.x,c.x,p.x,g.x)),S=1;for(let I=_-S;I<=b+S;I++)I!==0&&n.push(new l.b6(I,t))}return n}coveringTiles(t){var n,s;let c=this.coveringZoomLevel(t);const p=c;if(t.minzoom!==void 0&&c<t.minzoom)return[];t.maxzoom!==void 0&&c>t.maxzoom&&(c=t.maxzoom);const g=this.pointCoordinate(this.getCameraPoint()),_=l.U.fromLngLat(this.center),b=Math.pow(2,c),S=[b*g.x,b*g.y,0],I=[b*_.x,b*_.y,0],C=er.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,c);let L=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(L=c);const U=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,N=W=>({aabb:new fa([W*b,0,0],[(W+1)*b,b,0]),zoom:0,x:0,y:0,wrap:W,fullyVisible:!1}),j=[],F=[],ee=c,se=t.reparseOverscaled?p:c;if(this._renderWorldCopies)for(let W=1;W<=3;W++)j.push(N(-W)),j.push(N(W));for(j.push(N(0));j.length>0;){const W=j.pop(),te=W.x,ce=W.y;let he=W.fullyVisible;if(!he){const Fe=W.aabb.intersects(C);if(Fe===0)continue;he=Fe===2}const fe=t.terrain?S:I,ve=W.aabb.distanceX(fe),_e=W.aabb.distanceY(fe),we=Math.max(Math.abs(ve),Math.abs(_e));if(W.zoom===ee||we>U+(1<<ee-W.zoom)-2&&W.zoom>=L){const Fe=ee-W.zoom,xt=S[0]-.5-(te<<Fe),Pe=S[1]-.5-(ce<<Fe);F.push({tileID:new l.O(W.zoom===ee?se:W.zoom,W.wrap,W.zoom,te,ce),distanceSq:rt([I[0]-.5-te,I[1]-.5-ce]),tileDistanceToCamera:Math.sqrt(xt*xt+Pe*Pe)})}else for(let Fe=0;Fe<4;Fe++){const xt=(te<<1)+Fe%2,Pe=(ce<<1)+(Fe>>1),Ke=W.zoom+1;let Ne=W.aabb.quadrant(Fe);if(t.terrain){const Ut=new l.O(Ke,W.wrap,Ke,xt,Pe),_t=t.terrain.getMinMaxElevation(Ut),ht=(n=_t.minElevation)!==null&&n!==void 0?n:this.elevation,bt=(s=_t.maxElevation)!==null&&s!==void 0?s:this.elevation;Ne=new fa([Ne.min[0],Ne.min[1],ht],[Ne.max[0],Ne.max[1],bt])}j.push({aabb:Ne,zoom:Ke,x:xt,y:Pe,wrap:W.wrap,fullyVisible:he})}}return F.sort((W,te)=>W.distanceSq-te.distanceSq).map(W=>W.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const n=l.ad(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new l.P(l.G(t.lng)*this.worldSize,l.H(n)*this.worldSize)}unproject(t){return new l.U(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const n=this.pointLocation(this.centerPoint,t),s=t.getElevationForLngLatZoom(n,this.tileZoom);if(!(this.elevation-s))return;const c=this.getCameraPosition(),p=l.U.fromLngLat(c.lngLat,c.altitude),g=l.U.fromLngLat(n,s),_=p.x-g.x,b=p.y-g.y,S=p.z-g.z,I=Math.sqrt(_*_+b*b+S*S),C=this.scaleZoom(this.cameraToCenterDistance/I/this.tileSize);this._elevation=s,this._center=n,this.zoom=C}setLocationAtPoint(t,n){const s=this.pointCoordinate(n),c=this.pointCoordinate(this.centerPoint),p=this.locationCoordinate(t),g=new l.U(p.x-(s.x-c.x),p.y-(s.y-c.y));this.center=this.coordinateLocation(g),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,n){return n?this.coordinatePoint(this.locationCoordinate(t),n.getElevationForLngLatZoom(t,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,n){return this.coordinateLocation(this.pointCoordinate(t,n))}locationCoordinate(t){return l.U.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,n){if(n){const L=n.pointCoordinate(t);if(L!=null)return L}const s=[t.x,t.y,0,1],c=[t.x,t.y,1,1];l.ag(s,s,this.pixelMatrixInverse),l.ag(c,c,this.pixelMatrixInverse);const p=s[3],g=c[3],_=s[1]/p,b=c[1]/g,S=s[2]/p,I=c[2]/g,C=S===I?0:(0-S)/(I-S);return new l.U(l.B.number(s[0]/p,c[0]/g,C)/this.worldSize,l.B.number(_,b,C)/this.worldSize)}coordinatePoint(t,n=0,s=this.pixelMatrix){const c=[t.x*this.worldSize,t.y*this.worldSize,n,1];return l.ag(c,c,s),new l.P(c[0]/c[3],c[1]/c[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new Bt().extend(this.pointLocation(new l.P(0,t))).extend(this.pointLocation(new l.P(this.width,t))).extend(this.pointLocation(new l.P(this.width,this.height))).extend(this.pointLocation(new l.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Bt([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(t,n=!1){const s=t.key,c=n?this._alignedPosMatrixCache:this._posMatrixCache;if(c[s])return c[s];const p=t.canonical,g=this.worldSize/this.zoomScale(p.z),_=p.x+Math.pow(2,p.z)*t.wrap,b=l.ao(new Float64Array(16));return l.$(b,b,[_*g,p.y*g,0]),l.a0(b,b,[g/l.N,g/l.N,1]),l.a1(b,n?this.alignedProjMatrix:this.projMatrix,b),c[s]=new Float32Array(b),c[s]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t,n,s,c,p=-90,g=90,_=-180,b=180;const S=this.size,I=this._unmodified;if(this.latRange){const U=this.latRange;p=l.H(U[1])*this.worldSize,g=l.H(U[0])*this.worldSize,t=g-p<S.y?S.y/(g-p):0}if(this.lngRange){const U=this.lngRange;_=l.b5(l.G(U[0])*this.worldSize,0,this.worldSize),b=l.b5(l.G(U[1])*this.worldSize,0,this.worldSize),b<_&&(b+=this.worldSize),n=b-_<S.x?S.x/(b-_):0}const C=this.point,L=Math.max(n||0,t||0);if(L)return this.center=this.unproject(new l.P(n?(b+_)/2:C.x,t?(g+p)/2:C.y)),this.zoom+=this.scaleZoom(L),this._unmodified=I,void(this._constraining=!1);if(this.latRange){const U=C.y,N=S.y/2;U-N<p&&(c=p+N),U+N>g&&(c=g-N)}if(this.lngRange){const U=(_+b)/2,N=l.b5(C.x,U-this.worldSize/2,U+this.worldSize/2),j=S.x/2;N-j<_&&(s=_+j),N+j>b&&(s=b-j)}s===void 0&&c===void 0||(this.center=this.unproject(new l.P(s!==void 0?s:C.x,c!==void 0?c:C.y)).wrap()),this._unmodified=I,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,s=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=l.b7(1,this.center.lat)*this.worldSize;let c=l.ao(new Float64Array(16));l.a0(c,c,[this.width/2,-this.height/2,1]),l.$(c,c,[1,-1,0]),this.labelPlaneMatrix=c,c=l.ao(new Float64Array(16)),l.a0(c,c,[1,-1,1]),l.$(c,c,[-1,-1,0]),l.a0(c,c,[2/this.width,2/this.height,1]),this.glCoordMatrix=c;const p=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),g=Math.min(this.elevation,this._minEleveationForCurrentTile),_=p-g*this._pixelPerMeter/Math.cos(this._pitch),b=g<0?_:p,S=Math.PI/2+this._pitch,I=this._fov*(.5+t.y/this.height),C=Math.sin(I)*b/Math.sin(l.ad(Math.PI-S-I,.01,Math.PI-.01)),L=this.getHorizon(),U=2*Math.atan(L/this.cameraToCenterDistance)*(.5+t.y/(2*L)),N=Math.sin(U)*b/Math.sin(l.ad(Math.PI-S-U,.01,Math.PI-.01)),j=Math.min(C,N),F=1.01*(Math.cos(Math.PI/2-this._pitch)*j+b),ee=this.height/50;c=new Float64Array(16),l.b8(c,this._fov,this.width/this.height,ee,F),c[8]=2*-t.x/this.width,c[9]=2*t.y/this.height,l.a0(c,c,[1,-1,1]),l.$(c,c,[0,0,-this.cameraToCenterDistance]),l.b9(c,c,this._pitch),l.ae(c,c,this.angle),l.$(c,c,[-n,-s,0]),this.mercatorMatrix=l.a0([],c,[this.worldSize,this.worldSize,this.worldSize]),l.a0(c,c,[1,1,this._pixelPerMeter]),this.pixelMatrix=l.a1(new Float64Array(16),this.labelPlaneMatrix,c),l.$(c,c,[0,0,-this.elevation]),this.projMatrix=c,this.invProjMatrix=l.as([],c),this.pixelMatrix3D=l.a1(new Float64Array(16),this.labelPlaneMatrix,c);const se=this.width%2/2,W=this.height%2/2,te=Math.cos(this.angle),ce=Math.sin(this.angle),he=n-Math.round(n)+te*se+ce*W,fe=s-Math.round(s)+te*W+ce*se,ve=new Float64Array(c);if(l.$(ve,ve,[he>.5?he-1:he,fe>.5?fe-1:fe,0]),this.alignedProjMatrix=ve,c=l.as(new Float64Array(16),this.pixelMatrix),!c)throw new Error("failed to invert matrix");this.pixelMatrixInverse=c,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new l.P(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return l.ag(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new l.P(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let s=n.x,c=n.y,p=n.x,g=n.y;for(const _ of t)s=Math.min(s,_.x),c=Math.min(c,_.y),p=Math.max(p,_.x),g=Math.max(g,_.y);return[new l.P(s,c),new l.P(p,c),new l.P(p,g),new l.P(s,g),new l.P(s,c)]}}}function Zn(h,t){let n,s=!1,c=null,p=null;const g=()=>{c=null,s&&(h.apply(p,n),c=setTimeout(g,t),s=!1)};return(..._)=>(s=!0,p=this,n=_,c||g(),c)}class Ga{constructor(t){this._getCurrentHash=()=>{const n=window.location.hash.replace("#","");if(this._hashName){let s;return n.split("&").map(c=>c.split("=")).forEach(c=>{c[0]===this._hashName&&(s=c)}),(s&&s[1]||"").split("/")}return n.split("/")},this._onHashChange=()=>{const n=this._getCurrentHash();if(n.length>=3&&!n.some(s=>isNaN(s))){const s=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:s,pitch:+(n[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const n=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,n)}catch{}},this._updateHash=Zn(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){const n=this._map.getCenter(),s=Math.round(100*this._map.getZoom())/100,c=Math.ceil((s*Math.LN2+Math.log(512/360/.5))/Math.LN10),p=Math.pow(10,c),g=Math.round(n.lng*p)/p,_=Math.round(n.lat*p)/p,b=this._map.getBearing(),S=this._map.getPitch();let I="";if(I+=t?`/${g}/${_}/${s}`:`${s}/${_}/${g}`,(b||S)&&(I+="/"+Math.round(10*b)/10),S&&(I+=`/${Math.round(S)}`),this._hashName){const C=this._hashName;let L=!1;const U=window.location.hash.slice(1).split("&").map(N=>{const j=N.split("=")[0];return j===C?(L=!0,`${j}=${I}`):N}).filter(N=>N);return L||U.push(`${C}=${I}`),`#${U.join("&")}`}return`#${I}`}}const ga={linearity:.3,easing:l.ba(0,0,.3,1)},Zl=l.e({deceleration:2500,maxSpeed:1400},ga),Hl=l.e({deceleration:20,maxSpeed:1400},ga),Wl=l.e({deceleration:1e3,maxSpeed:360},ga),Kl=l.e({deceleration:1e3,maxSpeed:90},ga);class Xl{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:l.h.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=l.h.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new l.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,p.panDelta&&n.pan._add(p.panDelta),p.around&&(n.around=p.around),p.pinchAround&&(n.pinchAround=p.pinchAround);const s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,c={};if(n.pan.mag()){const p=qa(n.pan.mag(),s,l.e({},Zl,t||{}));c.offset=n.pan.mult(p.amount/n.pan.mag()),c.center=this._map.transform.center,Hr(c,p)}if(n.zoom){const p=qa(n.zoom,s,Hl);c.zoom=this._map.transform.zoom+p.amount,Hr(c,p)}if(n.bearing){const p=qa(n.bearing,s,Wl);c.bearing=this._map.transform.bearing+l.ad(p.amount,-179,179),Hr(c,p)}if(n.pitch){const p=qa(n.pitch,s,Kl);c.pitch=this._map.transform.pitch+p.amount,Hr(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(),l.e(c,{noMoveStart:!0})}}function Hr(h,t){(!h.duration||h.duration<t.duration)&&(h.duration=t.duration,h.easing=t.easing)}function qa(h,t,n){const{maxSpeed:s,linearity:c,deceleration:p}=n,g=l.ad(h*c/(t/1e3),-s,s),_=Math.abs(g)/(p*c);return{easing:n.easing,duration:1e3*_,amount:g*(_/2)}}class ur extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,s,c={}){const p=q.mousePos(n.getCanvasContainer(),s),g=n.unproject(p);super(t,l.e({point:p,lngLat:g,originalEvent:s},c)),this._defaultPrevented=!1,this.target=n}}class Za extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,s){const c=t==="touchend"?s.changedTouches:s.touches,p=q.touchPos(n.getCanvasContainer(),c),g=p.map(b=>n.unproject(b)),_=p.reduce((b,S,I,C)=>b.add(S.div(C.length)),new l.P(0,0));super(t,{points:p,point:_,lngLats:g,lngLat:n.unproject(_),originalEvent:s}),this._defaultPrevented=!1}}class Yl extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,s){super(t,{originalEvent:s}),this._defaultPrevented=!1}}class Jl{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Yl(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new ur(t.type,this._map,t))}mouseup(t){this._map.fire(new ur(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new ur(t.type,this._map,t))}dblclick(t){return this._firePreventable(new ur(t.type,this._map,t))}mouseover(t){this._map.fire(new ur(t.type,this._map,t))}mouseout(t){this._map.fire(new ur(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Za(t.type,this._map,t))}touchmove(t){this._map.fire(new Za(t.type,this._map,t))}touchend(t){this._map.fire(new Za(t.type,this._map,t))}touchcancel(t){this._map.fire(new Za(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ql{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new ur(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new ur("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new ur(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ln{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.pointLocation(l.P.convert(t),this._map.terrain)}}class ec{constructor(t,n){this._map=t,this._tr=new ln(t),this._el=t.getCanvasContainer(),this._container=t.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(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(q.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const s=n;if(this._lastPos.equals(s)||!this._box&&s.dist(this._startPos)<this._clickTolerance)return;const c=this._startPos;this._lastPos=s,this._box||(this._box=q.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const p=Math.min(c.x,s.x),g=Math.max(c.x,s.x),_=Math.min(c.y,s.y),b=Math.max(c.y,s.y);q.setTransform(this._box,`translate(${p}px,${_}px)`),this._box.style.width=g-p+"px",this._box.style.height=b-_+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const s=this._startPos,c=n;if(this.reset(),q.suppressClick(),s.x!==c.x||s.y!==c.y)return this._map.fire(new l.k("boxzoomend",{originalEvent:t})),{cameraAnimation:p=>p.fitScreenCoordinates(s,c,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(q.remove(this._box),this._box=null),q.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new l.k(t,{originalEvent:n}))}}function Ar(h,t){if(h.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${h.length}, points ${t.length}`);const n={};for(let s=0;s<h.length;s++)n[h[s].identifier]=t[s];return n}class cn{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,s){(this.centroid||s.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),s.length===this.numTouches&&(this.centroid=function(c){const p=new l.P(0,0);for(const g of c)p._add(g);return p.div(c.length)}(n),this.touches=Ar(s,n)))}touchmove(t,n,s){if(this.aborted||!this.centroid)return;const c=Ar(s,n);for(const p in this.touches){const g=c[p];(!g||g.dist(this.touches[p])>30)&&(this.aborted=!0)}}touchend(t,n,s){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),s.length===0){const c=!this.aborted&&this.centroid;if(this.reset(),c)return c}}}class Ls{constructor(t){this.singleTap=new cn(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,s){this.singleTap.touchstart(t,n,s)}touchmove(t,n,s){this.singleTap.touchmove(t,n,s)}touchend(t,n,s){const c=this.singleTap.touchend(t,n,s);if(c){const p=t.timeStamp-this.lastTime<500,g=!this.lastTap||this.lastTap.dist(c)<30;if(p&&g||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=c,this.count===this.numTaps)return this.reset(),c}}}class hn{constructor(t){this._tr=new ln(t),this._zoomIn=new Ls({numTouches:1,numTaps:2}),this._zoomOut=new Ls({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,s){this._zoomIn.touchstart(t,n,s),this._zoomOut.touchstart(t,n,s)}touchmove(t,n,s){this._zoomIn.touchmove(t,n,s),this._zoomOut.touchmove(t,n,s)}touchend(t,n,s){const c=this._zoomIn.touchend(t,n,s),p=this._zoomOut.touchend(t,n,s),g=this._tr;return c?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:g.zoom+1,around:g.unproject(c)},{originalEvent:t})}):p?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:g.zoom-1,around:g.unproject(p)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class un{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const n=this._moveFunction(...t);if(n.bearingDelta||n.pitchDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(t,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=n.length?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,n){if(!this.isEnabled())return;const s=this._lastPoint;if(!s)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const c=n.length?n[0]:n;return!this._moved&&c.dist(s)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=c,this._move(s,c))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&q.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const kh={0:1,2:2};class Io{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const n=q.mouseButton(t);this._eventButton=n}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!function(n,s){const c=kh[s];return n.buttons===void 0||(n.buttons&c)!==c}(t,this._eventButton)}isValidEndEvent(t){return q.mouseButton(t)===this._eventButton}}class tc{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return t.targetTouches.length===1}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}const zs=h=>{h.mousedown=h.dragStart,h.mousemoveWindow=h.dragMove,h.mouseup=h.dragEnd,h.contextmenu=function(t){t.preventDefault()}},ya=({enable:h,clickTolerance:t,bearingDegreesPerPixelMoved:n=.8})=>{const s=new Io({checkCorrectEvent:c=>q.mouseButton(c)===0&&c.ctrlKey||q.mouseButton(c)===2});return new un({clickTolerance:t,move:(c,p)=>({bearingDelta:(p.x-c.x)*n}),moveStateManager:s,enable:h,assignEvents:zs})},pn=({enable:h,clickTolerance:t,pitchDegreesPerPixelMoved:n=-.5})=>{const s=new Io({checkCorrectEvent:c=>q.mouseButton(c)===0&&c.ctrlKey||q.mouseButton(c)===2});return new un({clickTolerance:t,move:(c,p)=>({pitchDelta:(p.y-c.y)*n}),moveStateManager:s,enable:h,assignEvents:zs})};class De{constructor(t,n){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new l.P(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(t,n,s){return this._calculateTransform(t,n,s)}touchmove(t,n,s){if(this._map._cooperativeGestures&&(this._minTouches===2&&s.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,s.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(s.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,n,s)}touchend(t,n,s){this._calculateTransform(t,n,s),this._active&&s.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,s){s.length>0&&(this._active=!0);const c=Ar(s,n),p=new l.P(0,0),g=new l.P(0,0);let _=0;for(const S in c){const I=c[S],C=this._touches[S];C&&(p._add(I),g._add(I.sub(C)),_++,c[S]=I)}if(this._touches=c,_<this._minTouches||!g.mag())return;const b=g.div(_);return this._sum._add(b),this._sum.mag()<this._clickTolerance?void 0:{around:p.div(_),panDelta:b}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ds{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,n,s){this._firstTwoTouches||s.length<2||(this._firstTwoTouches=[s[0].identifier,s[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,s){if(!this._firstTwoTouches)return;t.preventDefault();const[c,p]=this._firstTwoTouches,g=Mn(s,n,c),_=Mn(s,n,p);if(!g||!_)return;const b=this._aroundCenter?null:g.add(_).div(2);return this._move([g,_],b,t)}touchend(t,n,s){if(!this._firstTwoTouches)return;const[c,p]=this._firstTwoTouches,g=Mn(s,n,c),_=Mn(s,n,p);g&&_||(this._active&&q.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Mn(h,t,n){for(let s=0;s<h.length;s++)if(h[s].identifier===n)return t[s]}function _a(h,t){return Math.log(h/t)/Math.LN2}class ic extends Ds{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const s=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(_a(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:_a(this._distance,s),pinchAround:n}}}function Le(h,t){return 180*h.angleWith(t)/Math.PI}class Ao extends Ds{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,n){const s=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Le(this._vector,s),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,s=Le(t,this._startVector);return Math.abs(s)<n}}function Co(h){return Math.abs(h.y)>Math.abs(h.x)}class Lh extends Ds{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,s){super.touchstart(t,n,s),this._currentTouchCount=s.length}_start(t){this._lastPoints=t,Co(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,s){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const c=t[0].sub(this._lastPoints[0]),p=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(c,p,s.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(c.y+p.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,s){if(this._valid!==void 0)return this._valid;const c=t.mag()>=2,p=n.mag()>=2;if(!c&&!p)return;if(!c||!p)return this._firstMove===void 0&&(this._firstMove=s),s-this._firstMove<100&&void 0;const g=t.y>0==n.y>0;return Co(t)&&Co(n)&&g}}const Eo={panStep:100,bearingStep:15,pitchStep:10};class rc{constructor(t){this._tr=new ln(t);const n=Eo;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,s=0,c=0,p=0,g=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?s=-1:(t.preventDefault(),p=-1);break;case 39:t.shiftKey?s=1:(t.preventDefault(),p=1);break;case 38:t.shiftKey?c=1:(t.preventDefault(),g=-1);break;case 40:t.shiftKey?c=-1:(t.preventDefault(),g=1);break;default:return}return this._rotationDisabled&&(s=0,c=0),{cameraAnimation:_=>{const b=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:nc,zoom:n?Math.round(b.zoom)+n*(t.shiftKey?2:1):b.zoom,bearing:b.bearing+s*this._bearingStep,pitch:b.pitch+c*this._pitchStep,offset:[-p*this._panStep,-g*this._panStep],center:b.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function nc(h){return h*(2-h)}const ac=4.000244140625;class zh{constructor(t,n){this._onTimeout=s=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(s)},this._map=t,this._tr=new ln(t),this._el=t.getCanvasContainer(),this._triggerRenderFrame=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!t[this._map._metaKey])return;t.preventDefault()}let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const s=l.h.now(),c=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,n!==0&&n%ac==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,t)):this._type||(this._type=Math.abs(c*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=q.mousePos(this._el,t),s=this._tr;this._around=l.L.convert(this._aroundCenter?s.center:s.unproject(n)),this._aroundPoint=s.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._tr.transform;if(this._delta!==0){const _=this._type==="wheel"&&Math.abs(this._delta)>ac?this._wheelZoomRate:this._defaultZoomRate;let b=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&b!==0&&(b=1/b);const S=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(S*b))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,s=this._startZoom,c=this._easing;let p,g=!1;if(this._type==="wheel"&&s&&c){const _=Math.min((l.h.now()-this._lastWheelEventTime)/200,1),b=c(_);p=l.B.number(s,n,b),_<1?this._frameId||(this._frameId=!0):g=!0}else p=n,g=!0;return this._active=!0,g&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!g,zoomDelta:p-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=l.bb;if(this._prevEase){const s=this._prevEase,c=(l.h.now()-s.start)/s.duration,p=s.easing(c+.01)-s.easing(c),g=.27/Math.sqrt(p*p+1e-4)*.01,_=Math.sqrt(.0729-g*g);n=l.ba(g,_,.25,1)}return this._prevEase={start:l.h.now(),duration:t,easing:n},n}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Po{constructor(t,n){this._clickZoom=t,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 Mo{constructor(t){this._tr=new ln(t),this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:s=>{s.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ko{constructor(){this._tap=new Ls({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,n,s){if(!this._swipePoint)if(this._tapTime){const c=n[0],p=t.timeStamp-this._tapTime<500,g=this._tapPoint.dist(c)<30;p&&g?s.length>0&&(this._swipePoint=c,this._swipeTouch=s[0].identifier):this.reset()}else this._tap.touchstart(t,n,s)}touchmove(t,n,s){if(this._tapTime){if(this._swipePoint){if(s[0].identifier!==this._swipeTouch)return;const c=n[0],p=c.y-this._swipePoint.y;return this._swipePoint=c,t.preventDefault(),this._active=!0,{zoomDelta:p/128}}}else this._tap.touchmove(t,n,s)}touchend(t,n,s){if(this._tapTime)this._swipePoint&&s.length===0&&this.reset();else{const c=this._tap.touchend(t,n,s);c&&(this._tapTime=t.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 Lo{constructor(t,n,s){this._el=t,this._mousePan=n,this._touchPan=s}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class tr{constructor(t,n,s){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,this._mousePitch=s}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class kn{constructor(t,n,s,c){this._el=t,this._touchZoom=n,this._touchRotate=s,this._tapDragZoom=c,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const Ha=h=>h.zoom||h.drag||h.pitch||h.rotate;class zo extends l.k{}function Wa(h){return h.panDelta&&h.panDelta.mag()||h.zoomDelta||h.bearingDelta||h.pitchDelta}class Do{constructor(t,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 g=c.type==="renderFrame"?void 0:c,_={needsRenderFrame:!1},b={},S={},I=c.touches,C=I?this._getMapTouches(I):void 0,L=C?q.touchPos(this._el,C):q.mousePos(this._el,c);for(const{handlerName:j,handler:F,allowed:ee}of this._handlers){if(!F.isEnabled())continue;let se;this._blockedByActive(S,ee,j)?F.reset():F[p||c.type]&&(se=F[p||c.type](c,L,C),this.mergeHandlerResult(_,b,se,j,g),se&&se.needsRenderFrame&&this._triggerRenderFrame()),(se||F.isActive())&&(S[j]=F)}const U={};for(const j in this._previousActiveHandlers)S[j]||(U[j]=g);this._previousActiveHandlers=S,(Object.keys(U).length||Wa(_))&&(this._changes.push([_,b,U]),this._triggerRenderFrame()),(Object.keys(S).length||Wa(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:N}=_;N&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],N(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Xl(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);const s=this._el;this._listeners=[[s,"touchstart",{passive:!0}],[s,"touchmove",{passive:!1}],[s,"touchend",void 0],[s,"touchcancel",void 0],[s,"mousedown",void 0],[s,"mousemove",void 0],[s,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[s,"mouseover",void 0],[s,"mouseout",void 0],[s,"dblclick",void 0],[s,"click",void 0],[s,"keydown",{capture:!1}],[s,"keyup",void 0],[s,"wheel",{passive:!1}],[s,"contextmenu",void 0],[window,"blur",void 0]];for(const[c,p,g]of this._listeners)q.addEventListener(c,p,c===document?this.handleWindowEvent:this.handleEvent,g)}destroy(){for(const[t,n,s]of this._listeners)q.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(t){const n=this._map,s=n.getCanvasContainer();this._add("mapEvent",new Jl(n,t));const c=n.boxZoom=new ec(n,t);this._add("boxZoom",c),t.interactive&&t.boxZoom&&c.enable();const p=new hn(n),g=new Mo(n);n.doubleClickZoom=new Po(g,p),this._add("tapZoom",p),this._add("clickZoom",g),t.interactive&&t.doubleClickZoom&&n.doubleClickZoom.enable();const _=new ko;this._add("tapDragZoom",_);const b=n.touchPitch=new Lh(n);this._add("touchPitch",b),t.interactive&&t.touchPitch&&n.touchPitch.enable(t.touchPitch);const S=ya(t),I=pn(t);n.dragRotate=new tr(t,S,I),this._add("mouseRotate",S,["mousePitch"]),this._add("mousePitch",I,["mouseRotate"]),t.interactive&&t.dragRotate&&n.dragRotate.enable();const C=(({enable:ee,clickTolerance:se})=>{const W=new Io({checkCorrectEvent:te=>q.mouseButton(te)===0&&!te.ctrlKey});return new un({clickTolerance:se,move:(te,ce)=>({around:ce,panDelta:ce.sub(te)}),activateOnStart:!0,moveStateManager:W,enable:ee,assignEvents:zs})})(t),L=new De(t,n);n.dragPan=new Lo(s,C,L),this._add("mousePan",C),this._add("touchPan",L,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&n.dragPan.enable(t.dragPan);const U=new Ao,N=new ic;n.touchZoomRotate=new kn(s,N,U,_),this._add("touchRotate",U,["touchPan","touchZoom"]),this._add("touchZoom",N,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&n.touchZoomRotate.enable(t.touchZoomRotate);const j=n.scrollZoom=new zh(n,()=>this._triggerRenderFrame());this._add("scrollZoom",j,["mousePan"]),t.interactive&&t.scrollZoom&&n.scrollZoom.enable(t.scrollZoom);const F=n.keyboard=new rc(n);this._add("keyboard",F),t.interactive&&t.keyboard&&n.keyboard.enable(),this._add("blockableMapEvent",new Ql(n))}_add(t,n,s){this._handlers.push({handlerName:t,handler:n,allowed:s}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Ha(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,n,s){for(const c in t)if(c!==s&&(!n||n.indexOf(c)<0))return!0;return!1}_getMapTouches(t){const n=[];for(const s of t)this._el.contains(s.target)&&n.push(s);return n}mergeHandlerResult(t,n,s,c,p){if(!s)return;l.e(t,s);const g={handlerName:c,originalEvent:s.originalEvent||p};s.zoomDelta!==void 0&&(n.zoom=g),s.panDelta!==void 0&&(n.drag=g),s.pitchDelta!==void 0&&(n.pitch=g),s.bearingDelta!==void 0&&(n.rotate=g)}_applyChanges(){const t={},n={},s={};for(const[c,p,g]of this._changes)c.panDelta&&(t.panDelta=(t.panDelta||new l.P(0,0))._add(c.panDelta)),c.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+c.zoomDelta),c.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+c.bearingDelta),c.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+c.pitchDelta),c.around!==void 0&&(t.around=c.around),c.pinchAround!==void 0&&(t.pinchAround=c.pinchAround),c.noInertia&&(t.noInertia=c.noInertia),l.e(n,p),l.e(s,g);this._updateMapTransform(t,n,s),this._changes=[]}_updateMapTransform(t,n,s){const c=this._map,p=c._getTransformForUpdate(),g=c.terrain;if(!(Wa(t)||g&&this._terrainMovement))return this._fireEvents(n,s,!0);let{panDelta:_,zoomDelta:b,bearingDelta:S,pitchDelta:I,around:C,pinchAround:L}=t;L!==void 0&&(C=L),c._stop(!0),C=C||c.transform.centerPoint;const U=p.pointLocation(_?C.sub(_):C);S&&(p.bearing+=S),I&&(p.pitch+=I),b&&(p.zoom+=b),g?this._terrainMovement||!n.drag&&!n.zoom?n.drag&&this._terrainMovement?p.center=p.pointLocation(p.centerPoint.sub(_)):p.setLocationAtPoint(U,C):(this._terrainMovement=!0,this._map._elevationFreeze=!0,p.setLocationAtPoint(U,C),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,p.recalculateZoom(c.terrain)})):p.setLocationAtPoint(U,C),c._applyUpdatedTransform(p),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,s,!0)}_fireEvents(t,n,s){const c=Ha(this._eventsInProgress),p=Ha(t),g={};for(const I in t){const{originalEvent:C}=t[I];this._eventsInProgress[I]||(g[`${I}start`]=C),this._eventsInProgress[I]=t[I]}!c&&p&&this._fireEvent("movestart",p.originalEvent);for(const I in g)this._fireEvent(I,g[I]);p&&this._fireEvent("move",p.originalEvent);for(const I in t){const{originalEvent:C}=t[I];this._fireEvent(I,C)}const _={};let b;for(const I in this._eventsInProgress){const{handlerName:C,originalEvent:L}=this._eventsInProgress[I];this._handlersById[C].isActive()||(delete this._eventsInProgress[I],b=n[C]||L,_[`${I}end`]=b)}for(const I in _)this._fireEvent(I,_[I]);const S=Ha(this._eventsInProgress);if(s&&(c||p)&&!S){this._updatingCamera=!0;const I=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),C=L=>L!==0&&-this._bearingSnap<L&&L<this._bearingSnap;!I||!I.essential&&l.h.prefersReducedMotion?(this._map.fire(new l.k("moveend",{originalEvent:b})),C(this._map.getBearing())&&this._map.resetNorth()):(C(I.bearing||this._map.getBearing())&&(I.bearing=0),I.freezeElevation=!0,this._map.easeTo(I,{originalEvent:b})),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new l.k(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new zo("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class sc extends l.E{constructor(t,n){super(),this._renderFrameCallback=()=>{const s=Math.min((l.h.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(s)),s<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new l.L(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,s){return t=l.P.convert(t).mult(-1),this.panTo(this.transform.center,l.e({offset:t},n),s)}panTo(t,n,s){return this.easeTo(l.e({center:t},n),s)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,s){return this.easeTo(l.e({zoom:t},n),s)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,s){return this.easeTo(l.e({bearing:t},n),s)}resetNorth(t,n){return this.rotateTo(0,l.e({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(l.e({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}cameraForBounds(t,n){t=Bt.convert(t);const s=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),s,n)}_cameraForBoxAndBearing(t,n,s,c){const p={top:0,bottom:0,right:0,left:0};if(typeof(c=l.e({padding:p,offset:[0,0],maxZoom:this.transform.maxZoom},c)).padding=="number"){const ce=c.padding;c.padding={top:ce,bottom:ce,right:ce,left:ce}}c.padding=l.e(p,c.padding);const g=this.transform,_=g.padding,b=g.project(l.L.convert(t)),S=g.project(l.L.convert(n)),I=b.rotate(-s*Math.PI/180),C=S.rotate(-s*Math.PI/180),L=new l.P(Math.max(I.x,C.x),Math.max(I.y,C.y)),U=new l.P(Math.min(I.x,C.x),Math.min(I.y,C.y)),N=L.sub(U),j=(g.width-(_.left+_.right+c.padding.left+c.padding.right))/N.x,F=(g.height-(_.top+_.bottom+c.padding.top+c.padding.bottom))/N.y;if(F<0||j<0)return void l.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const ee=Math.min(g.scaleZoom(g.scale*Math.min(j,F)),c.maxZoom),se=l.P.convert(c.offset),W=new l.P((c.padding.left-c.padding.right)/2,(c.padding.top-c.padding.bottom)/2).rotate(s*Math.PI/180),te=se.add(W).mult(g.scale/g.zoomScale(ee));return{center:g.unproject(b.add(S).div(2).sub(te)),zoom:ee,bearing:s}}fitBounds(t,n,s){return this._fitInternal(this.cameraForBounds(t,n),n,s)}fitScreenCoordinates(t,n,s,c,p){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(l.P.convert(t)),this.transform.pointLocation(l.P.convert(n)),s,c),c,p)}_fitInternal(t,n,s){return t?(delete(n=l.e(t,n)).padding,n.linear?this.easeTo(n,s):this.flyTo(n,s)):this}jumpTo(t,n){this.stop();const s=this._getTransformForUpdate();let c=!1,p=!1,g=!1;return"zoom"in t&&s.zoom!==+t.zoom&&(c=!0,s.zoom=+t.zoom),t.center!==void 0&&(s.center=l.L.convert(t.center)),"bearing"in t&&s.bearing!==+t.bearing&&(p=!0,s.bearing=+t.bearing),"pitch"in t&&s.pitch!==+t.pitch&&(g=!0,s.pitch=+t.pitch),t.padding==null||s.isPaddingEqual(t.padding)||(s.padding=t.padding),this._applyUpdatedTransform(s),this.fire(new l.k("movestart",n)).fire(new l.k("move",n)),c&&this.fire(new l.k("zoomstart",n)).fire(new l.k("zoom",n)).fire(new l.k("zoomend",n)),p&&this.fire(new l.k("rotatestart",n)).fire(new l.k("rotate",n)).fire(new l.k("rotateend",n)),g&&this.fire(new l.k("pitchstart",n)).fire(new l.k("pitch",n)).fire(new l.k("pitchend",n)),this.fire(new l.k("moveend",n))}calculateCameraOptionsFromTo(t,n,s,c=0){const p=l.U.fromLngLat(t,n),g=l.U.fromLngLat(s,c),_=g.x-p.x,b=g.y-p.y,S=g.z-p.z,I=Math.hypot(_,b,S);if(I===0)throw new Error("Can't calculate camera options with same From and To");const C=Math.hypot(_,b),L=this.transform.scaleZoom(this.transform.cameraToCenterDistance/I/this.transform.tileSize),U=180*Math.atan2(_,-b)/Math.PI;let N=180*Math.acos(C/I)/Math.PI;return N=S<0?90-N:90+N,{center:g.toLngLat(),zoom:L,pitch:N,bearing:U}}easeTo(t,n){this._stop(!1,t.easeId),((t=l.e({offset:[0,0],duration:500,easing:l.bb},t)).animate===!1||!t.essential&&l.h.prefersReducedMotion)&&(t.duration=0);const s=this._getTransformForUpdate(),c=this.getZoom(),p=this.getBearing(),g=this.getPitch(),_=this.getPadding(),b="zoom"in t?+t.zoom:c,S="bearing"in t?this._normalizeBearing(t.bearing,p):p,I="pitch"in t?+t.pitch:g,C="padding"in t?t.padding:s.padding,L=l.P.convert(t.offset);let U=s.centerPoint.add(L);const N=s.pointLocation(U),j=l.L.convert(t.center||N);this._normalizeCenter(j);const F=s.project(N),ee=s.project(j).sub(F),se=s.zoomScale(b-c);let W,te;t.around&&(W=l.L.convert(t.around),te=s.locationPoint(W));const ce={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||b!==c,this._rotating=this._rotating||p!==S,this._pitching=this._pitching||I!==g,this._padding=!s.isPaddingEqual(C),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,ce),this.terrain&&this._prepareElevation(j),this._ease(he=>{if(this._zooming&&(s.zoom=l.B.number(c,b,he)),this._rotating&&(s.bearing=l.B.number(p,S,he)),this._pitching&&(s.pitch=l.B.number(g,I,he)),this._padding&&(s.interpolatePadding(_,C,he),U=s.centerPoint.add(L)),this.terrain&&!t.freezeElevation&&this._updateElevation(he),W)s.setLocationAtPoint(W,te);else{const fe=s.zoomScale(s.zoom-c),ve=b>c?Math.min(2,se):Math.max(.5,se),_e=Math.pow(ve,1-he),we=s.unproject(F.add(ee.mult(he*_e)).mult(fe));s.setLocationAtPoint(s.renderWorldCopies?we.wrap():we,U)}this._applyUpdatedTransform(s),this._fireMoveEvents(n)},he=>{this.terrain&&this._finalizeElevation(),this._afterEase(n,he)},t),this}_prepareEase(t,n,s={}){this._moving=!0,n||s.moving||this.fire(new l.k("movestart",t)),this._zooming&&!s.zooming&&this.fire(new l.k("zoomstart",t)),this._rotating&&!s.rotating&&this.fire(new l.k("rotatestart",t)),this._pitching&&!s.pitching&&this.fire(new l.k("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&n!==this._elevationTarget){const s=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(s-(n-(s*t+this._elevationStart))/(1-t)),this._elevationTarget=n}this.transform.elevation=l.B.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(t){if(!this.transformCameraUpdate)return;const n=t.clone(),{center:s,zoom:c,pitch:p,bearing:g,elevation:_}=this.transformCameraUpdate(n);s&&(n.center=s),c!==void 0&&(n.zoom=c),p!==void 0&&(n.pitch=p),g!==void 0&&(n.bearing=g),_!==void 0&&(n.elevation=_),this.transform.apply(n)}_fireMoveEvents(t){this.fire(new l.k("move",t)),this._zooming&&this.fire(new l.k("zoom",t)),this._rotating&&this.fire(new l.k("rotate",t)),this._pitching&&this.fire(new l.k("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const s=this._zooming,c=this._rotating,p=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,s&&this.fire(new l.k("zoomend",t)),c&&this.fire(new l.k("rotateend",t)),p&&this.fire(new l.k("pitchend",t)),this.fire(new l.k("moveend",t))}flyTo(t,n){if(!t.essential&&l.h.prefersReducedMotion){const Ne=l.F(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Ne,n)}this.stop(),t=l.e({offset:[0,0],speed:1.2,curve:1.42,easing:l.bb},t);const s=this._getTransformForUpdate(),c=this.getZoom(),p=this.getBearing(),g=this.getPitch(),_=this.getPadding(),b="zoom"in t?l.ad(+t.zoom,s.minZoom,s.maxZoom):c,S="bearing"in t?this._normalizeBearing(t.bearing,p):p,I="pitch"in t?+t.pitch:g,C="padding"in t?t.padding:s.padding,L=s.zoomScale(b-c),U=l.P.convert(t.offset);let N=s.centerPoint.add(U);const j=s.pointLocation(N),F=l.L.convert(t.center||j);this._normalizeCenter(F);const ee=s.project(j),se=s.project(F).sub(ee);let W=t.curve;const te=Math.max(s.width,s.height),ce=te/L,he=se.mag();if("minZoom"in t){const Ne=l.ad(Math.min(t.minZoom,c,b),s.minZoom,s.maxZoom),Ut=te/s.zoomScale(Ne-c);W=Math.sqrt(Ut/he*2)}const fe=W*W;function ve(Ne){const Ut=(ce*ce-te*te+(Ne?-1:1)*fe*fe*he*he)/(2*(Ne?ce:te)*fe*he);return Math.log(Math.sqrt(Ut*Ut+1)-Ut)}function _e(Ne){return(Math.exp(Ne)-Math.exp(-Ne))/2}function we(Ne){return(Math.exp(Ne)+Math.exp(-Ne))/2}const Fe=ve(!1);let xt=function(Ne){return we(Fe)/we(Fe+W*Ne)},Pe=function(Ne){return te*((we(Fe)*(_e(Ut=Fe+W*Ne)/we(Ut))-_e(Fe))/fe)/he;var Ut},Ke=(ve(!0)-Fe)/W;if(Math.abs(he)<1e-6||!isFinite(Ke)){if(Math.abs(te-ce)<1e-6)return this.easeTo(t,n);const Ne=ce<te?-1:1;Ke=Math.abs(Math.log(ce/te))/W,Pe=function(){return 0},xt=function(Ut){return Math.exp(Ne*W*Ut)}}return t.duration="duration"in t?+t.duration:1e3*Ke/("screenSpeed"in t?+t.screenSpeed/W:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=p!==S,this._pitching=I!==g,this._padding=!s.isPaddingEqual(C),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(F),this._ease(Ne=>{const Ut=Ne*Ke,_t=1/xt(Ut);s.zoom=Ne===1?b:c+s.scaleZoom(_t),this._rotating&&(s.bearing=l.B.number(p,S,Ne)),this._pitching&&(s.pitch=l.B.number(g,I,Ne)),this._padding&&(s.interpolatePadding(_,C,Ne),N=s.centerPoint.add(U)),this.terrain&&!t.freezeElevation&&this._updateElevation(Ne);const ht=Ne===1?F:s.unproject(ee.add(se.mult(Pe(Ut))).mult(_t));s.setLocationAtPoint(s.renderWorldCopies?ht.wrap():ht,N),this._applyUpdatedTransform(s),this._fireMoveEvents(n)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(n)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const s=this._onEaseEnd;delete this._onEaseEnd,s.call(this,n)}if(!t){const s=this.handlers;s&&s.stop(!1)}return this}_ease(t,n,s){s.animate===!1||s.duration===0?(t(1),n()):(this._easeStart=l.h.now(),this._easeOptions=s,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,n){t=l.b5(t,-180,180);const s=Math.abs(t-n);return Math.abs(t-360-n)<s&&(t-=360),Math.abs(t+360-n)<s&&(t+=360),t}_normalizeCenter(t){const n=this.transform;if(!n.renderWorldCopies||n.lngRange)return;const s=t.lng-n.center.lng;t.lng+=s>180?-360:s<-180?360:0}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(l.L.convert(t),this.transform.tileZoom)-this.transform.elevation:null}}class pr{constructor(t={}){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=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=q.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=q.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=q.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(){q.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,n){const s=this._map._getUIString(`AttributionControl.${n}`);t.title=s,t.setAttribute("aria-label",s)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(c=>typeof c!="string"?"":c)):typeof this.options.customAttribution=="string"&&t.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.sourceCaches;for(const c in n){const p=n[c];if(p.used||p.usedForTerrain){const g=p.getSource();g.attribution&&t.indexOf(g.attribution)<0&&t.push(g.attribution)}}t=t.filter(c=>String(c).trim()),t.sort((c,p)=>c.length-p.length),t=t.filter((c,p)=>{for(let g=p+1;g<t.length;g++)if(t[g].indexOf(c)>=0)return!1;return!0});const s=t.join(" | ");s!==this._attribHTML&&(this._attribHTML=s,t.length?(this._innerContainer.innerHTML=s,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Xt{constructor(t={}){this._updateCompact=()=>{const n=this._container.children;if(n.length){const s=n[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&s.classList.add("maplibregl-compact"):s.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=q.create("div","maplibregl-ctrl");const n=q.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(){q.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Rs{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,s=n?this._queue.concat(n):this._queue;for(const c of s)if(c.id===t)return void(c.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const s of n)if(!s.cancelled&&(s.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const Ro={"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":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"};var oc=l.Q([{name:"a_pos3d",type:"Int16",components:3}]);class lc extends l.E{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];const s={};for(const c of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))s[c.key]=!0,this._renderableTilesKeys.push(c.key),this._tiles[c.key]||(c.posMatrix=new Float64Array(16),l.aS(c.posMatrix,0,l.N,0,l.N,0,1),this._tiles[c.key]=new Tn(c,this.tileSize));for(const c in this._tiles)s[c]||delete this._tiles[c]}freeRtt(t){for(const n in this._tiles){const s=this._tiles[n];(!t||s.tileID.equals(t)||s.tileID.isChildOf(t)||t.isChildOf(s.tileID))&&(s.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const n={};for(const s of this._renderableTilesKeys){const c=this._tiles[s].tileID;if(c.canonical.equals(t.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16),l.aS(p.posMatrix,0,l.N,0,l.N,0,1),n[s]=p}else if(c.canonical.isChildOf(t.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16);const g=c.canonical.z-t.canonical.z,_=c.canonical.x-(c.canonical.x>>g<<g),b=c.canonical.y-(c.canonical.y>>g<<g),S=l.N>>g;l.aS(p.posMatrix,0,S,0,S,0,1),l.$(p.posMatrix,p.posMatrix,[-_*S,-b*S,0]),n[s]=p}else if(t.canonical.isChildOf(c.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16);const g=t.canonical.z-c.canonical.z,_=t.canonical.x-(t.canonical.x>>g<<g),b=t.canonical.y-(t.canonical.y>>g<<g),S=l.N>>g;l.aS(p.posMatrix,0,l.N,0,l.N,0,1),l.$(p.posMatrix,p.posMatrix,[_*S,b*S,0]),l.a0(p.posMatrix,p.posMatrix,[1/2**g,1/2**g,0]),n[s]=p}}return n}getSourceTile(t,n){const s=this.sourceCache._source;let c=t.overscaledZ-this.deltaZoom;if(c>s.maxzoom&&(c=s.maxzoom),c<s.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(c).key);let p=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!p||!p.dem)&&n)for(;c>=s.minzoom&&(!p||!p.dem);)p=this.sourceCache.getTileByID(t.scaledTo(c--).key);return p}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(n=>n.timeAdded>=t)}}class cc{constructor(t,n,s){this.painter=t,this.sourceCache=new lc(n),this.options=s,this.exaggeration=typeof s.exaggeration=="number"?s.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,n,s,c=l.N){var p;if(!(n>=0&&n<c&&s>=0&&s<c))return 0;const g=this.getTerrainData(t),_=(p=g.tile)===null||p===void 0?void 0:p.dem;if(!_)return 0;const b=function(N,j,F){var ee=j[0],se=j[1];return N[0]=F[0]*ee+F[4]*se+F[12],N[1]=F[1]*ee+F[5]*se+F[13],N}([],[n/c*l.N,s/c*l.N],g.u_terrain_matrix),S=[b[0]*_.dim,b[1]*_.dim],I=Math.floor(S[0]),C=Math.floor(S[1]),L=S[0]-I,U=S[1]-C;return _.get(I,C)*(1-L)*(1-U)+_.get(I+1,C)*L*(1-U)+_.get(I,C+1)*(1-L)*U+_.get(I+1,C+1)*L*U}getElevationForLngLatZoom(t,n){const{tileID:s,mercatorX:c,mercatorY:p}=this._getOverscaledTileIDFromLngLatZoom(t,n);return this.getElevation(s,c%l.N,p%l.N,l.N)}getElevation(t,n,s,c=l.N){return this.getDEMElevation(t,n,s,c)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const c=this.painter.context,p=new l.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Ge(c,p,c.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Ge(c,new l.R({width:1,height:1}),c.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(c.gl.NEAREST,c.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=l.ao([])}const n=this.sourceCache.getSourceTile(t,!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 Ge(c,n.dem.getPixels(),c.gl.RGBA,{premultiply:!1}),n.demTexture.bind(c.gl.NEAREST,c.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const s=n&&n+n.tileID.key+t.key;if(s&&!this._demMatrixCache[s]){const c=this.sourceCache.sourceCache._source.maxzoom;let p=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=c?p=t.canonical.z-c:l.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const g=t.canonical.x-(t.canonical.x>>p<<p),_=t.canonical.y-(t.canonical.y>>p<<p),b=l.bc(new Float64Array(16),[1/(l.N<<p),1/(l.N<<p),0]);l.$(b,b,[g*l.N,_*l.N,0]),this._demMatrixCache[t.key]={matrix:b,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:s?this._demMatrixCache[t.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(t){const n=this.painter,s=n.width/devicePixelRatio,c=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===s&&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 Ge(n.context,{width:s,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 Ge(n.context,{width:s,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(s,c,!0,!1),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,s,c))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let p=0,g=0;p<this._coordsTextureSize;p++)for(let _=0;_<this._coordsTextureSize;_++,g+=4)n[g+0]=255&_,n[g+1]=255&p,n[g+2]=_>>8<<4|p>>8,n[g+3]=0;const s=new l.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),c=new Ge(t,s,t.gl.RGBA,{premultiply:!1});return c.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=c,c}pointCoordinate(t){const n=new Uint8Array(4),s=this.painter.context,c=s.gl;s.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),c.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,c.RGBA,c.UNSIGNED_BYTE,n),s.bindFramebuffer.set(null);const p=n[0]+(n[2]>>4<<8),g=n[1]+((15&n[2])<<8),_=this.coordsIndex[255-n[3]],b=_&&this.sourceCache.getTileByID(_);if(!b)return null;const S=this._coordsTextureSize,I=(1<<b.tileID.canonical.z)*S;return new l.U(this._allowMercatorOverflow(t,(b.tileID.canonical.x*S+p)/I),(b.tileID.canonical.y*S+g)/I,this.getElevation(b.tileID,p,g,S))}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.painter.context,n=new l.bd,s=new l.b0,c=this.meshSize,p=l.N/c,g=c*c;for(let C=0;C<=c;C++)for(let L=0;L<=c;L++)n.emplaceBack(L*p,C*p,0);for(let C=0;C<g;C+=c+1)for(let L=0;L<c;L++)s.emplaceBack(L+C,c+L+C+1,c+L+C+2),s.emplaceBack(L+C,c+L+C+2,L+C+1);const _=n.length,b=_+2*(c+1);for(const C of[0,1])for(let L=0;L<=c;L++)for(const U of[0,1])n.emplaceBack(L*p,C*l.N,U);for(let C=0;C<2*c;C+=2)s.emplaceBack(b+C,b+C+1,b+C+3),s.emplaceBack(b+C,b+C+3,b+C+2),s.emplaceBack(_+C,_+C+3,_+C+1),s.emplaceBack(_+C,_+C+2,_+C+3);const S=n.length,I=S+2*(c+1);for(const C of[0,1])for(let L=0;L<=c;L++)for(const U of[0,1])n.emplaceBack(C*l.N,L*p,U);for(let C=0;C<2*c;C+=2)s.emplaceBack(S+C,S+C+1,S+C+3),s.emplaceBack(S+C,S+C+3,S+C+2),s.emplaceBack(I+C,I+C+3,I+C+1),s.emplaceBack(I+C,I+C+2,I+C+3);return this._mesh={indexBuffer:t.createIndexBuffer(s),vertexBuffer:t.createVertexBuffer(n,oc.members),segments:l.S.simpleSegment(0,0,n.length,s.length)},this._mesh}getMeshFrameDelta(t){return 2*Math.PI*l.be/Math.pow(2,t)/5}getMinTileElevationForLngLatZoom(t,n){var s;const{tileID:c}=this._getOverscaledTileIDFromLngLatZoom(t,n);return(s=this.getMinMaxElevation(c).minElevation)!==null&&s!==void 0?s:0}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,s={minElevation:null,maxElevation:null};return n&&n.dem&&(s.minElevation=n.dem.min*this.exaggeration,s.maxElevation=n.dem.max*this.exaggeration),s}_getOverscaledTileIDFromLngLatZoom(t,n){const s=l.U.fromLngLat(t.wrap()),c=(1<<n)*l.N,p=s.x*c,g=s.y*c,_=Math.floor(p/l.N),b=Math.floor(g/l.N);return{tileID:new l.O(n,0,n,_,b),mercatorX:p,mercatorY:g}}_allowMercatorOverflow(t,n){const s=t.x<this.painter.width/2;let c=l.bf(n);const p=this.painter.transform.center.lng;return s&&Math.sign(c)>0&&Math.sign(p)<0||!s&&Math.sign(c)<0&&Math.sign(p)>0?(c=360*Math.sign(p)+c,l.G(c)):n}}class Dh{constructor(t,n,s){this._context=t,this._size=n,this._tileSize=s,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const n=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),s=new Ge(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return s.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),n.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),n.colorAttachment.set(s.texture),{id:t,fbo:n,texture:s,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(n=>t.id!==n),this._recentlyUsed.push(t.id)}stampObject(t){t.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 t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(t=>!t.inUse)===!1}}const Hi={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Bs{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new Dh(t.context,30,n.sourceCache.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,n){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(s=>!t._layers[s].isHidden(n)),this._coordsDescendingInv={};for(const s in t.sourceCaches){this._coordsDescendingInv[s]={};const c=t.sourceCaches[s].getVisibleCoordinates();for(const p of c){const g=this.terrain.sourceCache.getTerrainCoords(p);for(const _ in g)this._coordsDescendingInv[s][_]||(this._coordsDescendingInv[s][_]=[]),this._coordsDescendingInv[s][_].push(g[_])}}this._coordsDescendingInvStr={};for(const s of t._order){const c=t._layers[s],p=c.source;if(Hi[c.type]&&!this._coordsDescendingInvStr[p]){this._coordsDescendingInvStr[p]={};for(const g in this._coordsDescendingInv[p])this._coordsDescendingInvStr[p][g]=this._coordsDescendingInv[p][g].map(_=>_.key).sort().join()}}for(const s of this._renderableTiles)for(const c in this._coordsDescendingInvStr){const p=this._coordsDescendingInvStr[c][s.tileID.key];p&&p!==s.rttCoords[c]&&(s.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const n=t.type,s=this.painter,c=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(Hi[n]&&(this._prevType&&Hi[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!c))return!0;if(Hi[this._prevType]||Hi[n]&&c){this._prevType=n;const p=this._stacks.length-1,g=this._stacks[p]||[];for(const _ of this._renderableTiles){if(this.pool.isFull()&&(li(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(_),_.rtt[p]){const S=this.pool.getObjectForId(_.rtt[p].id);if(S.stamp===_.rtt[p].stamp){this.pool.useObject(S);continue}}const b=this.pool.getOrCreateFreeObject();this.pool.useObject(b),this.pool.stampObject(b),_.rtt[p]={id:b.id,stamp:b.stamp},s.context.bindFramebuffer.set(b.fbo.framebuffer),s.context.clear({color:l.aT.transparent,stencil:0}),s.currentStencilSource=void 0;for(let S=0;S<g.length;S++){const I=s.style._layers[g[S]],C=I.source?this._coordsDescendingInv[I.source][_.tileID.key]:[_.tileID];s.context.viewport.set([0,0,b.fbo.width,b.fbo.height]),s._renderTileClippingMasks(I,C),s.renderLayer(s,s.style.sourceCaches[I.source],I,C),I.source&&(_.rttCoords[I.source]=this._coordsDescendingInvStr[I.source][_.tileID.key])}}return li(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),Hi[n]}return!1}}const je=oe,We={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:l.c.MAX_TILE_CACHE_ZOOM_LEVELS,localIdeographFontFamily:"sans-serif",transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,validateStyle:!0,maxCanvasSize:[4096,4096]},Ka=h=>{h.touchstart=h.dragStart,h.touchmoveWindow=h.dragMove,h.touchend=h.dragEnd},Bo={showCompass:!0,showZoom:!0,visualizePitch:!1};class Fo{constructor(t,n,s=!1){this.mousedown=g=>{this.startMouse(l.e({},g,{ctrlKey:!0,preventDefault:()=>g.preventDefault()}),q.mousePos(this.element,g)),q.addEventListener(window,"mousemove",this.mousemove),q.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=g=>{this.moveMouse(g,q.mousePos(this.element,g))},this.mouseup=g=>{this.mouseRotate.dragEnd(g),this.mousePitch&&this.mousePitch.dragEnd(g),this.offTemp()},this.touchstart=g=>{g.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=q.touchPos(this.element,g.targetTouches)[0],this.startTouch(g,this._startPos),q.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),q.addEventListener(window,"touchend",this.touchend))},this.touchmove=g=>{g.targetTouches.length!==1?this.reset():(this._lastPos=q.touchPos(this.element,g.targetTouches)[0],this.moveTouch(g,this._lastPos))},this.touchend=g=>{g.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.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const c=t.dragRotate._mouseRotate.getClickTolerance(),p=t.dragRotate._mousePitch.getClickTolerance();this.element=n,this.mouseRotate=ya({clickTolerance:c,enable:!0}),this.touchRotate=(({enable:g,clickTolerance:_,bearingDegreesPerPixelMoved:b=.8})=>{const S=new tc;return new un({clickTolerance:_,move:(I,C)=>({bearingDelta:(C.x-I.x)*b}),moveStateManager:S,enable:g,assignEvents:Ka})})({clickTolerance:c,enable:!0}),this.map=t,s&&(this.mousePitch=pn({clickTolerance:p,enable:!0}),this.touchPitch=(({enable:g,clickTolerance:_,pitchDegreesPerPixelMoved:b=-.5})=>{const S=new tc;return new un({clickTolerance:_,move:(I,C)=>({pitchDelta:(C.y-I.y)*b}),moveStateManager:S,enable:g,assignEvents:Ka})})({clickTolerance:p,enable:!0})),q.addEventListener(n,"mousedown",this.mousedown),q.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),q.addEventListener(n,"touchcancel",this.reset)}startMouse(t,n){this.mouseRotate.dragStart(t,n),this.mousePitch&&this.mousePitch.dragStart(t,n),q.disableDrag()}startTouch(t,n){this.touchRotate.dragStart(t,n),this.touchPitch&&this.touchPitch.dragStart(t,n),q.disableDrag()}moveMouse(t,n){const s=this.map,{bearingDelta:c}=this.mouseRotate.dragMove(t,n)||{};if(c&&s.setBearing(s.getBearing()+c),this.mousePitch){const{pitchDelta:p}=this.mousePitch.dragMove(t,n)||{};p&&s.setPitch(s.getPitch()+p)}}moveTouch(t,n){const s=this.map,{bearingDelta:c}=this.touchRotate.dragMove(t,n)||{};if(c&&s.setBearing(s.getBearing()+c),this.touchPitch){const{pitchDelta:p}=this.touchPitch.dragMove(t,n)||{};p&&s.setPitch(s.getPitch()+p)}}off(){const t=this.element;q.removeEventListener(t,"mousedown",this.mousedown),q.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),q.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),q.removeEventListener(window,"touchend",this.touchend),q.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){q.enableDrag(),q.removeEventListener(window,"mousemove",this.mousemove),q.removeEventListener(window,"mouseup",this.mouseup),q.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),q.removeEventListener(window,"touchend",this.touchend)}}let di;function Oo(h,t,n){if(h=new l.L(h.lng,h.lat),t){const s=new l.L(h.lng-360,h.lat),c=new l.L(h.lng+360,h.lat),p=n.locationPoint(h).distSqr(t);n.locationPoint(s).distSqr(t)<p?h=s:n.locationPoint(c).distSqr(t)<p&&(h=c)}for(;Math.abs(h.lng-n.center.lng)>180;){const s=n.locationPoint(h);if(s.x>=0&&s.y>=0&&s.x<=n.width&&s.y<=n.height)break;h.lng>n.center.lng?h.lng-=360:h.lng+=360}return h}const Cr={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 hc(h,t,n){const s=h.classList;for(const c in Cr)s.remove(`maplibregl-${n}-anchor-${c}`);s.add(`maplibregl-${n}-anchor-${t}`)}class Hn extends l.E{constructor(t){if(super(),this._onKeyPress=n=>{const s=n.code,c=n.charCode||n.keyCode;s!=="Space"&&s!=="Enter"&&c!==32&&c!==13||this.togglePopup()},this._onMapClick=n=>{const s=n.originalEvent.target,c=this._element;this._popup&&(s===c||c.contains(s))&&this.togglePopup()},this._update=n=>{if(!this._map)return;const s=this._map.loaded()&&!this._map.isMoving();(n?.type==="terrain"||n?.type==="render"&&!s)&&this._map.once("render",this._update),this._map.transform.renderWorldCopies&&(this._lngLat=Oo(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(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)`),n&&n.type!=="moveend"||(this._pos=this._pos.round()),q.setTransform(this._element,`${Cr[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${p} ${c}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const g=this._map.unproject(this._pos),_=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=g.distanceTo(this._lngLat)>20*_?"0.2":"1.0",this._opacityTimeout=null},100))},this._onMove=n=>{if(!this._isDragging){const s=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=s}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 l.k("dragstart"))),this.fire(new l.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new l.k("dragend")),this._state="inactive"},this._addDragHandler=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=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,t&&t.element)this._element=t.element,this._offset=l.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=q.create("div"),this._element.setAttribute("aria-label","Map marker");const n=q.createNS("http://www.w3.org/2000/svg","svg"),s=41,c=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${s}px`),n.setAttributeNS(null,"width",`${c}px`),n.setAttributeNS(null,"viewBox",`0 0 ${c} ${s}`);const p=q.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 g=q.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"fill-rule","nonzero");const _=q.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const b=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const ee of b){const se=q.createNS("http://www.w3.org/2000/svg","ellipse");se.setAttributeNS(null,"opacity","0.04"),se.setAttributeNS(null,"cx","10.5"),se.setAttributeNS(null,"cy","5.80029008"),se.setAttributeNS(null,"rx",ee.rx),se.setAttributeNS(null,"ry",ee.ry),_.appendChild(se)}const S=q.createNS("http://www.w3.org/2000/svg","g");S.setAttributeNS(null,"fill",this._color);const I=q.createNS("http://www.w3.org/2000/svg","path");I.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"),S.appendChild(I);const C=q.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"opacity","0.25"),C.setAttributeNS(null,"fill","#000000");const L=q.createNS("http://www.w3.org/2000/svg","path");L.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"),C.appendChild(L);const U=q.createNS("http://www.w3.org/2000/svg","g");U.setAttributeNS(null,"transform","translate(6.0, 7.0)"),U.setAttributeNS(null,"fill","#FFFFFF");const N=q.createNS("http://www.w3.org/2000/svg","g");N.setAttributeNS(null,"transform","translate(8.0, 8.0)");const j=q.createNS("http://www.w3.org/2000/svg","circle");j.setAttributeNS(null,"fill","#000000"),j.setAttributeNS(null,"opacity","0.25"),j.setAttributeNS(null,"cx","5.5"),j.setAttributeNS(null,"cy","5.5"),j.setAttributeNS(null,"r","5.4999962");const F=q.createNS("http://www.w3.org/2000/svg","circle");F.setAttributeNS(null,"fill","#FFFFFF"),F.setAttributeNS(null,"cx","5.5"),F.setAttributeNS(null,"cy","5.5"),F.setAttributeNS(null,"r","5.4999962"),N.appendChild(j),N.appendChild(F),g.appendChild(_),g.appendChild(S),g.appendChild(C),g.appendChild(U),g.appendChild(N),n.appendChild(g),n.setAttributeNS(null,"height",s*this._scale+"px"),n.setAttributeNS(null,"width",c*this._scale+"px"),this._element.appendChild(n),this._offset=l.P.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",n=>{n.preventDefault()}),this._element.addEventListener("mousedown",n=>{n.preventDefault()}),hc(this._element,this._anchor,"marker"),t&&t.className)for(const n of t.className.split(" "))this._element.classList.add(n);this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("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),q.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=l.L.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const c=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[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=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}getOffset(){return this._offset}setOffset(t){return this._offset=l.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const ci={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let ni=0,va=!1;const Xa={maxWidth:100,unit:"metric"};function Ya(h,t,n){const s=n&&n.maxWidth||100,c=h._container.clientHeight/2,p=h.unproject([0,c]),g=h.unproject([s,c]),_=p.distanceTo(g);if(n&&n.unit==="imperial"){const b=3.2808*_;b>5280?Wn(t,s,b/5280,h._getUIString("ScaleControl.Miles")):Wn(t,s,b,h._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?Wn(t,s,_/1852,h._getUIString("ScaleControl.NauticalMiles")):_>=1e3?Wn(t,s,_/1e3,h._getUIString("ScaleControl.Kilometers")):Wn(t,s,_,h._getUIString("ScaleControl.Meters"))}function Wn(h,t,n,s){const c=function(p){const g=Math.pow(10,`${Math.floor(p)}`.length-1);let _=p/g;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(b){const S=Math.pow(10,Math.ceil(-Math.log(b)/Math.LN10));return Math.round(b*S)/S}(_),g*_}(n);h.style.width=t*(c/n)+"px",h.innerHTML=`${c} ${s}`}const No={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Uo=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function xa(h){if(h){if(typeof h=="number"){const t=Math.round(Math.abs(h)/Math.SQRT2);return{center:new l.P(0,0),top:new l.P(0,h),"top-left":new l.P(t,t),"top-right":new l.P(-t,t),bottom:new l.P(0,-h),"bottom-left":new l.P(t,-t),"bottom-right":new l.P(-t,-t),left:new l.P(h,0),right:new l.P(-h,0)}}if(h instanceof l.P||Array.isArray(h)){const t=l.P.convert(h);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:l.P.convert(h.center||[0,0]),top:l.P.convert(h.top||[0,0]),"top-left":l.P.convert(h["top-left"]||[0,0]),"top-right":l.P.convert(h["top-right"]||[0,0]),bottom:l.P.convert(h.bottom||[0,0]),"bottom-left":l.P.convert(h["bottom-left"]||[0,0]),"bottom-right":l.P.convert(h["bottom-right"]||[0,0]),left:l.P.convert(h.left||[0,0]),right:l.P.convert(h.right||[0,0])}}return xa(new l.P(0,0))}const Vo={extend:(h,...t)=>l.e(h,...t),run(h){h()},logToElement(h,t=!1,n="log"){const s=window.document.getElementById(n);s&&(t&&(s.innerHTML=""),s.innerHTML+=`<br>${h}`)}},$o=oe;class zt{static get version(){return $o}static get workerCount(){return Gr.workerCount}static set workerCount(t){Gr.workerCount=t}static get maxParallelImageRequests(){return l.c.MAX_PARALLEL_IMAGE_REQUESTS}static set maxParallelImageRequests(t){l.c.MAX_PARALLEL_IMAGE_REQUESTS=t}static get workerUrl(){return l.c.WORKER_URL}static set workerUrl(t){l.c.WORKER_URL=t}static addProtocol(t,n){l.c.REGISTERED_PROTOCOLS[t]=n}static removeProtocol(t){delete l.c.REGISTERED_PROTOCOLS[t]}}return zt.Map=class extends sc{constructor(h){if(l.bg.mark(l.bh.create),(h=l.e({},We,h)).minZoom!=null&&h.maxZoom!=null&&h.minZoom>h.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(h.minPitch!=null&&h.maxPitch!=null&&h.minPitch>h.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(h.minPitch!=null&&h.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(h.maxPitch!=null&&h.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new ks(h.minZoom,h.maxZoom,h.minPitch,h.maxPitch,h.renderWorldCopies),{bearingSnap:h.bearingSnap}),this._cooperativeGesturesOnWheel=t=>{this._onCooperativeGesture(t,t[this._metaKey],1)},this._contextLost=t=>{t.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new l.k("webglcontextlost",{originalEvent:t}))},this._contextRestored=t=>{this._setupPainter(),this.resize(),this._update(),this.fire(new l.k("webglcontextrestored",{originalEvent:t}))},this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=h.interactive,this._cooperativeGestures=h.cooperativeGestures,this._metaKey=navigator.platform.indexOf("Mac")===0?"metaKey":"ctrlKey",this._maxTileCacheSize=h.maxTileCacheSize,this._maxTileCacheZoomLevels=h.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=h.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=h.preserveDrawingBuffer,this._antialias=h.antialias,this._trackResize=h.trackResize,this._bearingSnap=h.bearingSnap,this._refreshExpiredTiles=h.refreshExpiredTiles,this._fadeDuration=h.fadeDuration,this._crossSourceCollisions=h.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=h.collectResourceTiming,this._renderTaskQueue=new Rs,this._controls=[],this._mapId=l.a2(),this._locale=l.e({},Ro,h.locale),this._clickTolerance=h.clickTolerance,this._overridePixelRatio=h.pixelRatio,this._maxCanvasSize=h.maxCanvasSize,this.transformCameraUpdate=h.transformCameraUpdate,this._imageQueueHandle=ft.addThrottleControl(()=>this.isMoving()),this._requestManager=new St(h.transformRequest),typeof h.container=="string"){if(this._container=document.getElementById(h.container),!this._container)throw new Error(`Container '${h.container}' not found.`)}else{if(!(h.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=h.container}if(h.maxBounds&&this.setMaxBounds(h.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 t=!1;const n=Zn(s=>{this._trackResize&&!this._removed&&this.resize(s)._update()},50);this._resizeObserver=new ResizeObserver(s=>{t?n(s):t=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Do(this,h),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=h.hash&&new Ga(typeof h.hash=="string"&&h.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:h.center,zoom:h.zoom,bearing:h.bearing,pitch:h.pitch}),h.bounds&&(this.resize(),this.fitBounds(h.bounds,l.e({},h.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=h.localIdeographFontFamily,this._validateStyle=h.validateStyle,h.style&&this.setStyle(h.style,{localIdeographFontFamily:h.localIdeographFontFamily}),h.attributionControl&&this.addControl(new pr({customAttribution:h.customAttribution})),h.maplibreLogo&&this.addControl(new Xt,h.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",t=>{this._update(t.dataType==="style"),this.fire(new l.k(`${t.dataType}data`,t))}),this.on("dataloading",t=>{this.fire(new l.k(`${t.dataType}dataloading`,t))}),this.on("dataabort",t=>{this.fire(new l.k("sourcedataabort",t))})}_getMapId(){return this._mapId}addControl(h,t){if(t===void 0&&(t=h.getDefaultPosition?h.getDefaultPosition():"top-right"),!h||!h.onAdd)return this.fire(new l.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=h.onAdd(this);this._controls.push(h);const s=this._controlPositions[t];return t.indexOf("bottom")!==-1?s.insertBefore(n,s.firstChild):s.appendChild(n),this}removeControl(h){if(!h||!h.onRemove)return this.fire(new l.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(h);return t>-1&&this._controls.splice(t,1),h.onRemove(this),this}hasControl(h){return this._controls.indexOf(h)>-1}calculateCameraOptionsFromTo(h,t,n,s){return s==null&&this.terrain&&(s=this.terrain.getElevationForLngLatZoom(n,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(h,t,n,s)}resize(h){var t;const n=this._containerDimensions(),s=n[0],c=n[1],p=this._getClampedPixelRatio(s,c);if(this._resizeCanvas(s,c,p),this.painter.resize(s,c,p),this.painter.overLimit()){const _=this.painter.context.gl;this._maxCanvasSize=[_.drawingBufferWidth,_.drawingBufferHeight];const b=this._getClampedPixelRatio(s,c);this._resizeCanvas(s,c,b),this.painter.resize(s,c,b)}this.transform.resize(s,c),(t=this._requestedCameraState)===null||t===void 0||t.resize(s,c);const g=!this._moving;return g&&(this.stop(),this.fire(new l.k("movestart",h)).fire(new l.k("move",h))),this.fire(new l.k("resize",h)),g&&this.fire(new l.k("moveend",h)),this}_getClampedPixelRatio(h,t){const{0:n,1:s}=this._maxCanvasSize,c=this.getPixelRatio(),p=h*c,g=t*c;return Math.min(p>n?n/p:1,g>s?s/g:1)*c}getPixelRatio(){var h;return(h=this._overridePixelRatio)!==null&&h!==void 0?h:devicePixelRatio}setPixelRatio(h){this._overridePixelRatio=h,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(h){return this.transform.setMaxBounds(Bt.convert(h)),this._update()}setMinZoom(h){if((h=h??-2)>=-2&&h<=this.transform.maxZoom)return this.transform.minZoom=h,this._update(),this.getZoom()<h&&this.setZoom(h),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(h){if((h=h??22)>=this.transform.minZoom)return this.transform.maxZoom=h,this._update(),this.getZoom()>h&&this.setZoom(h),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(h){if((h=h??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(h>=0&&h<=this.transform.maxPitch)return this.transform.minPitch=h,this._update(),this.getPitch()<h&&this.setPitch(h),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(h){if((h=h??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(h>=this.transform.minPitch)return this.transform.maxPitch=h,this._update(),this.getPitch()>h&&this.setPitch(h),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(h){return this.transform.renderWorldCopies=h,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(h){return this._cooperativeGestures=h,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(h){return this.transform.locationPoint(l.L.convert(h),this.style&&this.terrain)}unproject(h){return this.transform.pointLocation(l.P.convert(h),this.terrain)}isMoving(){var h;return this._moving||((h=this.handlers)===null||h===void 0?void 0:h.isMoving())}isZooming(){var h;return this._zooming||((h=this.handlers)===null||h===void 0?void 0:h.isZooming())}isRotating(){var h;return this._rotating||((h=this.handlers)===null||h===void 0?void 0:h.isRotating())}_createDelegatedListener(h,t,n){if(h==="mouseenter"||h==="mouseover"){let s=!1;return{layer:t,listener:n,delegates:{mousemove:p=>{const g=this.getLayer(t)?this.queryRenderedFeatures(p.point,{layers:[t]}):[];g.length?s||(s=!0,n.call(this,new ur(h,this,p.originalEvent,{features:g}))):s=!1},mouseout:()=>{s=!1}}}}if(h==="mouseleave"||h==="mouseout"){let s=!1;return{layer:t,listener:n,delegates:{mousemove:g=>{(this.getLayer(t)?this.queryRenderedFeatures(g.point,{layers:[t]}):[]).length?s=!0:s&&(s=!1,n.call(this,new ur(h,this,g.originalEvent)))},mouseout:g=>{s&&(s=!1,n.call(this,new ur(h,this,g.originalEvent)))}}}}{const s=c=>{const p=this.getLayer(t)?this.queryRenderedFeatures(c.point,{layers:[t]}):[];p.length&&(c.features=p,n.call(this,c),delete c.features)};return{layer:t,listener:n,delegates:{[h]:s}}}}on(h,t,n){if(n===void 0)return super.on(h,t);const s=this._createDelegatedListener(h,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[h]=this._delegatedListeners[h]||[],this._delegatedListeners[h].push(s);for(const c in s.delegates)this.on(c,s.delegates[c]);return this}once(h,t,n){if(n===void 0)return super.once(h,t);const s=this._createDelegatedListener(h,t,n);for(const c in s.delegates)this.once(c,s.delegates[c]);return this}off(h,t,n){return n===void 0?super.off(h,t):(this._delegatedListeners&&this._delegatedListeners[h]&&(s=>{const c=this._delegatedListeners[h];for(let p=0;p<c.length;p++){const g=c[p];if(g.layer===t&&g.listener===n){for(const _ in g.delegates)this.off(_,g.delegates[_]);return c.splice(p,1),this}}})(),this)}queryRenderedFeatures(h,t){if(!this.style)return[];let n;const s=h instanceof l.P||Array.isArray(h),c=s?h:[[0,0],[this.transform.width,this.transform.height]];if(t=t||(s?{}:h)||{},c instanceof l.P||typeof c[0]=="number")n=[l.P.convert(c)];else{const p=l.P.convert(c[0]),g=l.P.convert(c[1]);n=[p,new l.P(g.x,p.y),g,new l.P(p.x,g.y),p]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(h,t){return this.style.querySourceFeatures(h,t)}setStyle(h,t){return(t=l.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&h?(this._diffStyle(h,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(h,t))}setTransformRequest(h){return this._requestManager.setTransformRequest(h),this}_getUIString(h){const t=this._locale[h];if(t==null)throw new Error(`Missing UI string '${h}'`);return t}_updateStyle(h,t){if(t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(h,t));const n=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!h)),h?(this.style=new Li(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof h=="string"?this.style.loadURL(h,t,n):this.style.loadJSON(h,t,n),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Li(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(h,t){if(typeof h=="string"){const n=this._requestManager.transformRequest(h,tt.Style);l.f(n,(s,c)=>{s?this.fire(new l.j(s)):c&&this._updateDiff(c,t)})}else typeof h=="object"&&this._updateDiff(h,t)}_updateDiff(h,t){try{this.style.setState(h,t)&&this._update(!0)}catch(n){l.w(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(h,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():l.w("There is no style added to the map.")}addSource(h,t){return this._lazyInitEmptyStyle(),this.style.addSource(h,t),this._update(!0)}isSourceLoaded(h){const t=this.style&&this.style.sourceCaches[h];if(t!==void 0)return t.loaded();this.fire(new l.j(new Error(`There is no source with ID '${h}'`)))}setTerrain(h){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),h){const t=this.style.sourceCaches[h.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${h.source}`);for(const n in this.style._layers){const s=this.style._layers[n];s.type==="hillshade"&&s.source===h.source&&l.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new cc(this.painter,t,h),this.painter.renderToTexture=new Bs(this.painter,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=n=>{n.dataType==="style"?this.terrain.sourceCache.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId!==h.source||this._elevationFreeze||(this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(n.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0;return this.fire(new l.k("terrain",{terrain:h})),this}getTerrain(){var h,t;return(t=(h=this.terrain)===null||h===void 0?void 0:h.options)!==null&&t!==void 0?t:null}areTilesLoaded(){const h=this.style&&this.style.sourceCaches;for(const t in h){const n=h[t]._tiles;for(const s in n){const c=n[s];if(c.state!=="loaded"&&c.state!=="errored")return!1}}return!0}addSourceType(h,t,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(h,t,n)}removeSource(h){return this.style.removeSource(h),this._update(!0)}getSource(h){return this.style.getSource(h)}addImage(h,t,n={}){const{pixelRatio:s=1,sdf:c=!1,stretchX:p,stretchY:g,content:_}=n;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||l.a(t))){if(t.width===void 0||t.height===void 0)return this.fire(new l.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:b,height:S,data:I}=t,C=t;return this.style.addImage(h,{data:new l.R({width:b,height:S},new Uint8Array(I)),pixelRatio:s,stretchX:p,stretchY:g,content:_,sdf:c,version:0,userImage:C}),C.onAdd&&C.onAdd(this,h),this}}{const{width:b,height:S,data:I}=l.h.getImageData(t);this.style.addImage(h,{data:new l.R({width:b,height:S},I),pixelRatio:s,stretchX:p,stretchY:g,content:_,sdf:c,version:0})}}updateImage(h,t){const n=this.style.getImage(h);if(!n)return this.fire(new l.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=t instanceof HTMLImageElement||l.a(t)?l.h.getImageData(t):t,{width:c,height:p,data:g}=s;if(c===void 0||p===void 0)return this.fire(new l.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(c!==n.data.width||p!==n.data.height)return this.fire(new l.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const _=!(t instanceof HTMLImageElement||l.a(t));return n.data.replace(g,_),this.style.updateImage(h,n),this}getImage(h){return this.style.getImage(h)}hasImage(h){return h?!!this.style.getImage(h):(this.fire(new l.j(new Error("Missing required image id"))),!1)}removeImage(h){this.style.removeImage(h)}loadImage(h,t){ft.getImage(this._requestManager.transformRequest(h,tt.Image),t)}listImages(){return this.style.listImages()}addLayer(h,t){return this._lazyInitEmptyStyle(),this.style.addLayer(h,t),this._update(!0)}moveLayer(h,t){return this.style.moveLayer(h,t),this._update(!0)}removeLayer(h){return this.style.removeLayer(h),this._update(!0)}getLayer(h){return this.style.getLayer(h)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(h,t,n){return this.style.setLayerZoomRange(h,t,n),this._update(!0)}setFilter(h,t,n={}){return this.style.setFilter(h,t,n),this._update(!0)}getFilter(h){return this.style.getFilter(h)}setPaintProperty(h,t,n,s={}){return this.style.setPaintProperty(h,t,n,s),this._update(!0)}getPaintProperty(h,t){return this.style.getPaintProperty(h,t)}setLayoutProperty(h,t,n,s={}){return this.style.setLayoutProperty(h,t,n,s),this._update(!0)}getLayoutProperty(h,t){return this.style.getLayoutProperty(h,t)}setGlyphs(h,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(h,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(h,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(h,t,n,s=>{s||this._update(!0)}),this}removeSprite(h){return this._lazyInitEmptyStyle(),this.style.removeSprite(h),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(h,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(h,t,n=>{n||this._update(!0)}),this}setLight(h,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(h,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(h,t){return this.style.setFeatureState(h,t),this._update()}removeFeatureState(h,t){return this.style.removeFeatureState(h,t),this._update()}getFeatureState(h){return this.style.getFeatureState(h)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let h=0,t=0;return this._container&&(h=this._container.clientWidth||400,t=this._container.clientHeight||300),[h,t]}_setupContainer(){const h=this._container;h.classList.add("maplibregl-map");const t=this._canvasContainer=q.create("div","maplibregl-canvas-container",h);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=q.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const n=this._containerDimensions(),s=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],s);const c=this._controlContainer=q.create("div","maplibregl-control-container",h),p=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(g=>{p[g]=q.create("div",`maplibregl-ctrl-${g} `,c)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){this._cooperativeGesturesScreen=q.create("div","maplibregl-cooperative-gesture-screen",this._container);let h=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(h=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use \u2318 + scroll to zoom the map"),this._cooperativeGesturesScreen.innerHTML=`
|
|
578
578
|
<div class="maplibregl-desktop-message">${h}</div>
|
|
579
579
|
<div class="maplibregl-mobile-message">${typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}</div>
|
|
580
|
-
`,this._cooperativeGesturesScreen.setAttribute("aria-hidden","true"),this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){H.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(h,t,n){this._canvas.width=Math.floor(n*h),this._canvas.height=Math.floor(n*t),this._canvas.style.width=`${h}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const h={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let t=null;this._canvas.addEventListener("webglcontextcreationerror",s=>{t={requestedAttributes:h},s&&(t.statusMessage=s.statusMessage,t.type=s.type)},{once:!0});const n=this._canvas.getContext("webgl2",h)||this._canvas.getContext("webgl",h);if(!n){const s="Failed to initialize WebGL";throw t?(t.message=s,new Error(JSON.stringify(t))):new Error(s)}this.painter=new $n(n,this.transform),Ae.testSupport(n)}_onCooperativeGesture(h,t,n){return!t&&n<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(h){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||h,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(h){return this._update(),this._renderTaskQueue.add(h)}_cancelRenderFrame(h){this._renderTaskQueue.remove(h)}_render(h){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(h),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const c=this.transform.zoom,p=l.h.now();this.style.zoomHistory.update(c,p);const g=new l.a8(c,{now:p,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),y=g.crossFadingFactor();y===1&&y===this._crossFadingFactor||(n=!0,this._crossFadingFactor=y),this.style.update(g)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,t,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding}),this.fire(new l.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,l.bf.mark(l.bg.load),this.fire(new l.k("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const s=this._sourcesDirty||this._styleDirty||this._placementDirty;return s||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new l.k("idle")),!this._loaded||this._fullyLoaded||s||(this._fullyLoaded=!0,l.bf.mark(l.bg.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var h;this._hash&&this._hash.remove();for(const n of this._controls)n.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),Tt.removeThrottleControl(this._imageQueueHandle),(h=this._resizeObserver)===null||h===void 0||h.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),H.remove(this._canvasContainer),H.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),l.bf.clearMetrics(),this._removed=!0,this.fire(new l.k("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=l.h.frame(h=>{l.bf.frame(h),this._frame=null,this._render(h)}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(h){this._showTileBoundaries!==h&&(this._showTileBoundaries=h,this._update())}get showPadding(){return!!this._showPadding}set showPadding(h){this._showPadding!==h&&(this._showPadding=h,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(h){this._showCollisionBoxes!==h&&(this._showCollisionBoxes=h,h?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(h){this._showOverdrawInspector!==h&&(this._showOverdrawInspector=h,this._update())}get repaint(){return!!this._repaint}set repaint(h){this._repaint!==h&&(this._repaint=h,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(h){this._vertices=h,this._update()}get version(){return Ve}getCameraTargetElevation(){return this.transform.elevation}},kt.NavigationControl=class{constructor(h){this._updateZoomButtons=()=>{const t=this._map.getZoom(),n=t===this._map.getMaxZoom(),s=t===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=s,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",s.toString())},this._rotateCompassArrow=()=>{const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t},this._setButtonTitle=(t,n)=>{const s=this._map._getUIString(`NavigationControl.${n}`);t.title=s,t.setAttribute("aria-label",s)},this.options=l.e({},zo,h),this._container=H.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),H.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),H.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=H.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(h){return this._map=h,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Do(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){H.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(h,t){const n=H.create("button",h,this._container);return n.type="button",n.addEventListener("click",t),n}},kt.GeolocateControl=class extends l.E{constructor(h){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new l.k("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new l.k("geolocate",t)),this._finish()}},this._updateCamera=t=>{const n=new l.L(t.coords.longitude,t.coords.latitude),s=t.coords.accuracy,c=this._map.getBearing(),p=l.e({bearing:c},this.options.fitBoundsOptions),g=zt.fromLngLat(n,s);this._map.fitBounds(g,p,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const n=new l.L(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=t=>{if(this._map){if(this.options.trackUserLocation)if(t.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&_a)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new l.k("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=t=>{if(this._map){if(this._container.addEventListener("contextmenu",n=>n.preventDefault()),this._geolocateButton=H.create("button","maplibregl-ctrl-geolocate",this._container),H.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",t===!1){l.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.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=H.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Gn({element:this._dotElement}),this._circleElement=H.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Gn({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",n=>{n.geolocateSource||this._watchState!=="ACTIVE_LOCK"||n.originalEvent&&n.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new l.k("trackuserlocationend")))})}},this.options=l.e({},ci,h)}onAdd(h){return this._map=h,this._container=H.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(t,n=!1){di===void 0||n?window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(s=>{di=s.state!=="denied",t(di)}).catch(()=>{di=!!window.navigator.geolocation,t(di)}):(di=!!window.navigator.geolocation,t(di)):t(di)}(this._setupUI),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(),H.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,ni=0,_a=!1}_isOutOfMapMaxBounds(h){const t=this._map.getMaxBounds(),n=h.coords;return t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const h=this._map.getBounds(),t=h.getSouthEast(),n=h.getNorthEast(),s=t.distanceTo(n),c=Math.ceil(this._accuracy/(s/this._map._container.clientHeight)*2);this._circleElement.style.width=`${c}px`,this._circleElement.style.height=`${c}px`}trigger(){if(!this._setup)return l.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new l.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":ni--,_a=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new l.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new l.k("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let h;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),ni++,ni>1?(h={maximumAge:6e5,timeout:0},_a=!0):(h=this.options.positionOptions,_a=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,h)}}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)}},kt.AttributionControl=ur,kt.LogoControl=Kt,kt.ScaleControl=class{constructor(h){this._onMove=()=>{Xa(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,Xa(this._map,this._container,this.options)},this.options=l.e({},Ka,h)}getDefaultPosition(){return"bottom-left"}onAdd(h){return this._map=h,this._container=H.create("div","maplibregl-ctrl maplibregl-ctrl-scale",h.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){H.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},kt.FullscreenControl=class extends l.E{constructor(h={}){super(),this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,h&&h.container&&(h.container instanceof HTMLElement?this._container=h.container:l.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(h){return this._map=h,this._container||(this._container=this._map.getContainer()),this._controlContainer=H.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){H.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const h=this._fullscreenButton=H.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);H.create("span","maplibregl-ctrl-icon",h).setAttribute("aria-hidden","true"),h.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const h=this._getTitle();this._fullscreenButton.setAttribute("aria-label",h),this._fullscreenButton.title=h}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new l.k("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new l.k("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_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()}},kt.TerrainControl=class{constructor(h){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.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))},this.options=h}onAdd(h){return this._map=h,this._container=H.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=H.create("button","maplibregl-ctrl-terrain",this._container),H.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(){H.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},kt.Popup=class extends l.E{constructor(h){super(),this.remove=()=>(this._content&&H.remove(this._content),this._container&&(H.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),delete this._map),this.fire(new l.k("close")),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=H.create("div","maplibregl-popup",this._map.getContainer()),this._tip=H.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const g of this.options.className.split(" "))this._container.classList.add(g);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._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Ro(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!t)return;const n=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);let s=this.options.anchor;const c=va(this.options.offset);if(!s){const g=this._container.offsetWidth,y=this._container.offsetHeight;let x;x=n.y+c.bottom.y<y?["top"]:n.y>this._map.transform.height-y?["bottom"]:[],n.x<g/2?x.push("left"):n.x>this._map.transform.width-g/2&&x.push("right"),s=x.length===0?"bottom":x.join("-")}const p=n.add(c[s]).round();H.setTransform(this._container,`${Cr[s]} translate(${p.x}px,${p.y}px)`),sc(this._container,s,"popup")},this._onClose=()=>{this.remove()},this.options=l.e(Object.create(Bo),h)}addTo(h){return this._map&&this.remove(),this._map=h,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new l.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(h){return this._lngLat=l.L.convert(h),this._pos=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._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(h){return this.setDOMContent(document.createTextNode(h))}setHTML(h){const t=document.createDocumentFragment(),n=document.createElement("body");let s;for(n.innerHTML=h;s=n.firstChild,s;)t.appendChild(s);return this.setDOMContent(t)}getMaxWidth(){var h;return(h=this._container)===null||h===void 0?void 0:h.style.maxWidth}setMaxWidth(h){return this.options.maxWidth=h,this._update(),this}setDOMContent(h){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=H.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(h),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(h){this._container&&this._container.classList.add(h)}removeClassName(h){this._container&&this._container.classList.remove(h)}setOffset(h){return this.options.offset=h,this._update(),this}toggleClassName(h){if(this._container)return this._container.classList.toggle(h)}_createCloseButton(){this.options.closeButton&&(this._closeButton=H.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const h=this._container.querySelector(Fo);h&&h.focus()}},kt.Marker=Gn,kt.Style=Mi,kt.LngLat=l.L,kt.LngLatBounds=zt,kt.Point=l.P,kt.MercatorCoordinate=l.U,kt.Evented=l.E,kt.AJAXError=l.bh,kt.config=l.c,kt.CanvasSource=vn,kt.GeoJSONSource=_n,kt.ImageSource=xr,kt.RasterDEMTileSource=ra,kt.RasterTileSource=en,kt.VectorTileSource=$r,kt.VideoSource=za,kt.setRTLTextPlugin=l.bi,kt.getRTLTextPluginStatus=l.bj,kt.prewarm=function(){os().acquire(At)},kt.clearPrewarmedResources=function(){const h=rn;h&&(h.isPreloaded()&&h.numActive()===1?(h.release(At),rn=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()"))},Oo.extend(kt,{isSafari:l.ac,getPerformanceMetrics:l.bf.getPerformanceMetrics}),kt});var ae=B;return ae})})(pu);var Pm=pu.exports,pt=uu(Pm);const du="3.7.5",km=du,Mm=typeof atob=="function",Lm=typeof btoa=="function",is=typeof Buffer=="function",mu=typeof TextDecoder=="function"?new TextDecoder:void 0,fu=typeof TextEncoder=="function"?new TextEncoder:void 0,zm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Ws=Array.prototype.slice.call(zm),al=(v=>{let m={};return v.forEach((w,P)=>m[w]=P),m})(Ws),Dm=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,ji=String.fromCharCode.bind(String),gu=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):v=>new Uint8Array(Array.prototype.slice.call(v,0)),yu=v=>v.replace(/=/g,"").replace(/[+\/]/g,m=>m=="+"?"-":"_"),_u=v=>v.replace(/[^A-Za-z0-9\+\/]/g,""),vu=v=>{let m,w,P,B,X="";const ae=v.length%3;for(let l=0;l<v.length;){if((w=v.charCodeAt(l++))>255||(P=v.charCodeAt(l++))>255||(B=v.charCodeAt(l++))>255)throw new TypeError("invalid character found");m=w<<16|P<<8|B,X+=Ws[m>>18&63]+Ws[m>>12&63]+Ws[m>>6&63]+Ws[m&63]}return ae?X.slice(0,ae-3)+"===".substring(ae):X},kc=Lm?v=>btoa(v):is?v=>Buffer.from(v,"binary").toString("base64"):vu,Mc=is?v=>Buffer.from(v).toString("base64"):v=>{let w=[];for(let P=0,B=v.length;P<B;P+=4096)w.push(ji.apply(null,v.subarray(P,P+4096)));return kc(w.join(""))},sl=(v,m=!1)=>m?yu(Mc(v)):Mc(v),Rm=v=>{if(v.length<2){var m=v.charCodeAt(0);return m<128?v:m<2048?ji(192|m>>>6)+ji(128|m&63):ji(224|m>>>12&15)+ji(128|m>>>6&63)+ji(128|m&63)}else{var m=65536+(v.charCodeAt(0)-55296)*1024+(v.charCodeAt(1)-56320);return ji(240|m>>>18&7)+ji(128|m>>>12&63)+ji(128|m>>>6&63)+ji(128|m&63)}},Bm=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,xu=v=>v.replace(Bm,Rm),bu=is?v=>Buffer.from(v,"utf8").toString("base64"):fu?v=>Mc(fu.encode(v)):v=>kc(xu(v)),rs=(v,m=!1)=>m?yu(bu(v)):bu(v),wu=v=>rs(v,!0),Fm=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Om=v=>{switch(v.length){case 4:var m=(7&v.charCodeAt(0))<<18|(63&v.charCodeAt(1))<<12|(63&v.charCodeAt(2))<<6|63&v.charCodeAt(3),w=m-65536;return ji((w>>>10)+55296)+ji((w&1023)+56320);case 3:return ji((15&v.charCodeAt(0))<<12|(63&v.charCodeAt(1))<<6|63&v.charCodeAt(2));default:return ji((31&v.charCodeAt(0))<<6|63&v.charCodeAt(1))}},Su=v=>v.replace(Fm,Om),Tu=v=>{if(v=v.replace(/\s+/g,""),!Dm.test(v))throw new TypeError("malformed base64.");v+="==".slice(2-(v.length&3));let m,w="",P,B;for(let X=0;X<v.length;)m=al[v.charAt(X++)]<<18|al[v.charAt(X++)]<<12|(P=al[v.charAt(X++)])<<6|(B=al[v.charAt(X++)]),w+=P===64?ji(m>>16&255):B===64?ji(m>>16&255,m>>8&255):ji(m>>16&255,m>>8&255,m&255);return w},Lc=Mm?v=>atob(_u(v)):is?v=>Buffer.from(v,"base64").toString("binary"):Tu,Iu=is?v=>gu(Buffer.from(v,"base64")):v=>gu(Lc(v).split("").map(m=>m.charCodeAt(0))),Au=v=>Iu(Cu(v)),Nm=is?v=>Buffer.from(v,"base64").toString("utf8"):mu?v=>mu.decode(Iu(v)):v=>Su(Lc(v)),Cu=v=>_u(v.replace(/[-_]/g,m=>m=="-"?"+":"/")),zc=v=>Nm(Cu(v)),Um=v=>{if(typeof v!="string")return!1;const m=v.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(m)||!/[^\s0-9a-zA-Z\-_]/.test(m)},Eu=v=>({value:v,enumerable:!1,writable:!0,configurable:!0}),Pu=function(){const v=(m,w)=>Object.defineProperty(String.prototype,m,Eu(w));v("fromBase64",function(){return zc(this)}),v("toBase64",function(m){return rs(this,m)}),v("toBase64URI",function(){return rs(this,!0)}),v("toBase64URL",function(){return rs(this,!0)}),v("toUint8Array",function(){return Au(this)})},ku=function(){const v=(m,w)=>Object.defineProperty(Uint8Array.prototype,m,Eu(w));v("toBase64",function(m){return sl(this,m)}),v("toBase64URI",function(){return sl(this,!0)}),v("toBase64URL",function(){return sl(this,!0)})},Vm={version:du,VERSION:km,atob:Lc,atobPolyfill:Tu,btoa:kc,btoaPolyfill:vu,fromBase64:zc,toBase64:rs,encode:rs,encodeURI:wu,encodeURL:wu,utob:xu,btou:Su,decode:zc,isValid:Um,fromUint8Array:sl,toUint8Array:Au,extendString:Pu,extendUint8Array:ku,extendBuiltins:()=>{Pu(),ku()}};var Dc={exports:{}},ns=typeof Reflect=="object"?Reflect:null,Mu=ns&&typeof ns.apply=="function"?ns.apply:function(m,w,P){return Function.prototype.apply.call(m,w,P)},ol;ns&&typeof ns.ownKeys=="function"?ol=ns.ownKeys:Object.getOwnPropertySymbols?ol=function(m){return Object.getOwnPropertyNames(m).concat(Object.getOwnPropertySymbols(m))}:ol=function(m){return Object.getOwnPropertyNames(m)};function $m(v){console&&console.warn&&console.warn(v)}var Lu=Number.isNaN||function(m){return m!==m};function Wt(){Wt.init.call(this)}Dc.exports=Wt,Dc.exports.once=Zm,Wt.EventEmitter=Wt,Wt.prototype._events=void 0,Wt.prototype._eventsCount=0,Wt.prototype._maxListeners=void 0;var zu=10;function ll(v){if(typeof v!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof v)}Object.defineProperty(Wt,"defaultMaxListeners",{enumerable:!0,get:function(){return zu},set:function(v){if(typeof v!="number"||v<0||Lu(v))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+v+".");zu=v}}),Wt.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Wt.prototype.setMaxListeners=function(m){if(typeof m!="number"||m<0||Lu(m))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+m+".");return this._maxListeners=m,this};function Du(v){return v._maxListeners===void 0?Wt.defaultMaxListeners:v._maxListeners}Wt.prototype.getMaxListeners=function(){return Du(this)},Wt.prototype.emit=function(m){for(var w=[],P=1;P<arguments.length;P++)w.push(arguments[P]);var B=m==="error",X=this._events;if(X!==void 0)B=B&&X.error===void 0;else if(!B)return!1;if(B){var ae;if(w.length>0&&(ae=w[0]),ae instanceof Error)throw ae;var l=new Error("Unhandled error."+(ae?" ("+ae.message+")":""));throw l.context=ae,l}var he=X[m];if(he===void 0)return!1;if(typeof he=="function")Mu(he,this,w);else for(var H=he.length,Ae=Nu(he,H),P=0;P<H;++P)Mu(Ae[P],this,w);return!0};function Ru(v,m,w,P){var B,X,ae;if(ll(w),X=v._events,X===void 0?(X=v._events=Object.create(null),v._eventsCount=0):(X.newListener!==void 0&&(v.emit("newListener",m,w.listener?w.listener:w),X=v._events),ae=X[m]),ae===void 0)ae=X[m]=w,++v._eventsCount;else if(typeof ae=="function"?ae=X[m]=P?[w,ae]:[ae,w]:P?ae.unshift(w):ae.push(w),B=Du(v),B>0&&ae.length>B&&!ae.warned){ae.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+ae.length+" "+String(m)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=v,l.type=m,l.count=ae.length,$m(l)}return v}Wt.prototype.addListener=function(m,w){return Ru(this,m,w,!1)},Wt.prototype.on=Wt.prototype.addListener,Wt.prototype.prependListener=function(m,w){return Ru(this,m,w,!0)};function jm(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Bu(v,m,w){var P={fired:!1,wrapFn:void 0,target:v,type:m,listener:w},B=jm.bind(P);return B.listener=w,P.wrapFn=B,B}Wt.prototype.once=function(m,w){return ll(w),this.on(m,Bu(this,m,w)),this},Wt.prototype.prependOnceListener=function(m,w){return ll(w),this.prependListener(m,Bu(this,m,w)),this},Wt.prototype.removeListener=function(m,w){var P,B,X,ae,l;if(ll(w),B=this._events,B===void 0)return this;if(P=B[m],P===void 0)return this;if(P===w||P.listener===w)--this._eventsCount===0?this._events=Object.create(null):(delete B[m],B.removeListener&&this.emit("removeListener",m,P.listener||w));else if(typeof P!="function"){for(X=-1,ae=P.length-1;ae>=0;ae--)if(P[ae]===w||P[ae].listener===w){l=P[ae].listener,X=ae;break}if(X<0)return this;X===0?P.shift():Gm(P,X),P.length===1&&(B[m]=P[0]),B.removeListener!==void 0&&this.emit("removeListener",m,l||w)}return this},Wt.prototype.off=Wt.prototype.removeListener,Wt.prototype.removeAllListeners=function(m){var w,P,B;if(P=this._events,P===void 0)return this;if(P.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):P[m]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete P[m]),this;if(arguments.length===0){var X=Object.keys(P),ae;for(B=0;B<X.length;++B)ae=X[B],ae!=="removeListener"&&this.removeAllListeners(ae);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(w=P[m],typeof w=="function")this.removeListener(m,w);else if(w!==void 0)for(B=w.length-1;B>=0;B--)this.removeListener(m,w[B]);return this};function Fu(v,m,w){var P=v._events;if(P===void 0)return[];var B=P[m];return B===void 0?[]:typeof B=="function"?w?[B.listener||B]:[B]:w?qm(B):Nu(B,B.length)}Wt.prototype.listeners=function(m){return Fu(this,m,!0)},Wt.prototype.rawListeners=function(m){return Fu(this,m,!1)},Wt.listenerCount=function(v,m){return typeof v.listenerCount=="function"?v.listenerCount(m):Ou.call(v,m)},Wt.prototype.listenerCount=Ou;function Ou(v){var m=this._events;if(m!==void 0){var w=m[v];if(typeof w=="function")return 1;if(w!==void 0)return w.length}return 0}Wt.prototype.eventNames=function(){return this._eventsCount>0?ol(this._events):[]};function Nu(v,m){for(var w=new Array(m),P=0;P<m;++P)w[P]=v[P];return w}function Gm(v,m){for(;m+1<v.length;m++)v[m]=v[m+1];v.pop()}function qm(v){for(var m=new Array(v.length),w=0;w<m.length;++w)m[w]=v[w].listener||v[w];return m}function Zm(v,m){return new Promise(function(w,P){function B(ae){v.removeListener(m,X),P(ae)}function X(){typeof v.removeListener=="function"&&v.removeListener("error",B),w([].slice.call(arguments))}Uu(v,m,X,{once:!0}),m!=="error"&&Hm(v,B,{once:!0})})}function Hm(v,m,w){typeof v.on=="function"&&Uu(v,"error",m,w)}function Uu(v,m,w,P){if(typeof v.on=="function")P.once?v.once(m,w):v.on(m,w);else if(typeof v.addEventListener=="function")v.addEventListener(m,function B(X){P.once&&v.removeEventListener(m,B),w(X)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof v)}var Wm=Dc.exports,Km=uu(Wm);function Xm(){return typeof self<"u"?fetch.bind(self):typeof global<"u"&&global.fetch?global.fetch:null}class Ym{constructor(){this._apiKey="",this._fetch=Xm()}set apiKey(m){this._apiKey=m}get apiKey(){return this._apiKey}set fetch(m){this._fetch=m}get fetch(){return this._fetch}}const yr=new Ym,Ks={AUTO:"auto",ALBANIAN:"sq",ARABIC:"ar",ARMENIAN:"hy",AZERBAIJANI:"az",BELORUSSIAN:"be",BOSNIAN:"bs",BRETON:"br",BULGARIAN:"bg",CATALAN:"ca",CHINESE:"zh",CROATIAN:"hr",CZECH:"cs",DANISH:"da",DUTCH:"nl",ENGLISH:"en",ESPERANTO:"eo",ESTONIAN:"et",FINNISH:"fi",FRENCH:"fr",FRISIAN:"fy",GEORGIAN:"ka",GERMAN:"de",GREEK:"el",HEBREW:"he",HUNGARIAN:"hu",ICELANDIC:"is",IRISH:"ga",ITALIAN:"it",JAPANESE:"ja",KANNADA:"kn",KAZAKH:"kk",KOREAN:"ko",ROMAN_LATIN:"la",LATVIAN:"lv",LITHUANIAN:"lt",LUXEMBOURGISH:"lb",MACEDONIAN:"mk",MALTESE:"mt",NORWEGIAN:"no",POLISH:"pl",PORTUGUESE:"pt",ROMANIAN:"ro",ROMANSH:"rm",RUSSIAN:"ru",SCOTTISH_GAELIC:"gd",SERBIAN_CYRILLIC:"sr",SLOVAK:"sk",SLOVENE:"sl",SPANISH:"es",SWEDISH:"sv",THAI:"th",TURKISH:"tr",UKRAINIAN:"uk",WELSH:"cy"},Jm=new Set(Object.values(Ks));function Qm(){if(typeof navigator>"u")return Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];const v=Array.from(new Set(navigator.languages.map(m=>m.split("-")[0]))).filter(m=>Jm.has(m));return v.length?v[0]:Ks.ENGLISH}async function ea(v,m={}){if(yr.fetch===null)throw new Error("The fetch function was not found. If on NodeJS < 18 please specify the fetch function with config.fetch");if(new URL(v).searchParams.get("key").trim()==="")throw new Error("The MapTiler Cloud API key is missing. Set it in `config.apiKey` or get one for free at https://maptiler.com");return yr.fetch(v,m)}const Or={maptilerApiURL:"https://api.maptiler.com/",mapStyle:"streets-v2"};Object.freeze(Or);class Ln extends Error{constructor(m,w=""){super(`Call to enpoint ${m.url} failed with the status code ${m.status}. ${w}`),this.res=m}}const cl={400:"Query too long / Invalid parameters",403:"Key is missing, invalid or restricted"};function Vu(v,m){if(m.language==null)return;const w=Array.from(new Set((Array.isArray(m.language)?m.language:[m.language]).map(P=>P===Ks.AUTO?Qm():P))).join(",");v.set("language",w)}function $u(v,m){v.set("key",m.apiKey??yr.apiKey),m.limit!=null&&v.set("limit",String(m.limit)),m.types!=null&&v.set("types",m.types.join(",")),Vu(v,m)}function ju(v,m){$u(v,m),m.bbox!=null&&v.set("bbox",m.bbox.join(",")),m.proximity!=null&&v.set("proximity",m.proximity.join(",")),m.country!=null&&v.set("country",m.country.join(",")),m.fuzzyMatch!=null&&v.set("fuzzyMatch",m.fuzzyMatch?"true":"false"),m.autocomplete!=null&&v.set("autocomplete",m.autocomplete?"true":"false")}async function ef(v,m={}){if(typeof v!="string"||v.trim().length===0)throw new Error("The query must be a non-empty string");const w=new URL(`geocoding/${encodeURIComponent(v)}.json`,Or.maptilerApiURL),{searchParams:P}=w;ju(P,m);const B=w.toString(),X=await ea(B);if(!X.ok)throw new Ln(X,cl[X.status]??"");return await X.json()}async function tf(v,m={}){if(!Array.isArray(v)||v.length<2)throw new Error("The position must be an array of form [lng, lat].");const w=new URL(`geocoding/${v[0]},${v[1]}.json`,Or.maptilerApiURL);$u(w.searchParams,m);const P=w.toString(),B=await ea(P);if(!B.ok)throw new Ln(B,cl[B.status]??"");return await B.json()}async function rf(v,m={}){const w=new URL(`geocoding/${v}.json`,Or.maptilerApiURL);w.searchParams.set("key",m.apiKey??yr.apiKey),Vu(w.searchParams,m);const P=w.toString(),B=await ea(P);if(!B.ok)throw new Ln(B,cl[B.status]??"");return await B.json()}async function nf(v,m={}){if(!v.length)return[];const w=v.map(he=>encodeURIComponent(he)).join(";"),P=new URL(`geocoding/${w}.json`,Or.maptilerApiURL),{searchParams:B}=P;ju(B,m);const X=P.toString(),ae=await ea(X);if(!ae.ok)throw new Ln(ae,cl[ae.status]??"");const l=await ae.json();return v.length===1?[l]:l}const af={forward:ef,reverse:tf,byId:rf,batch:nf,language:Ks},Gu={403:"Key is missing, invalid or restricted"};async function sf(v={}){const m=new URL("geolocation/ip.json",Or.maptilerApiURL);m.searchParams.set("key",v.apiKey??yr.apiKey);const w=m.toString(),P=await ea(w);if(!P.ok)throw new Ln(P,P.status in Gu?Gu[P.status]:"");return await P.json()}const Rc={info:sf},hl={403:"Key is missing, invalid or restricted"};async function of(v,m={}){if(typeof v!="string"||v.trim().length===0)throw new Error("The query must be a non-empty string");const w=new URL(`coordinates/search/${v}.json`,Or.maptilerApiURL);w.searchParams.set("key",m.apiKey??yr.apiKey),"limit"in m&&w.searchParams.set("limit",m.limit.toString()),"transformations"in m&&w.searchParams.set("transformations",m.transformations.toString()),"exports"in m&&w.searchParams.set("exports",m.exports.toString());const P=w.toString(),B=await ea(P);if(!B.ok)throw new Ln(B,B.status in hl?hl[B.status]:"");return await B.json()}async function lf(v,m={}){const w=(Array.isArray(v[0])?v:[v]).map(l=>`${l[0]},${l[1]}`).join(";"),P=new URL(`coordinates/transform/${w}.json`,Or.maptilerApiURL);P.searchParams.set("key",m.apiKey??yr.apiKey),"sourceCrs"in m&&P.searchParams.set("s_srs",m.sourceCrs.toString()),"targetCrs"in m&&P.searchParams.set("t_srs",m.targetCrs.toString()),"operations"in m&&P.searchParams.set("ops",(Array.isArray(m.operations)?m.operations:[m.operations]).join("|"));const B=P.toString(),X=await ea(B);if(!X.ok)throw new Ln(X,X.status in hl?hl[X.status]:"");return await X.json()}const cf={search:of,transform:lf},qu={403:"Key is missing, invalid or restricted"};async function hf(v,m={}){if(typeof v!="string"||v.trim().length===0)throw new Error("The data ID must be a non-empty string");const w=new URL(`data/${encodeURIComponent(v)}/features.json`,Or.maptilerApiURL);w.searchParams.set("key",m.apiKey??yr.apiKey);const P=w.toString(),B=await ea(P);if(!B.ok)throw new Ln(B,B.status in qu?qu[B.status]:"");return await B.json()}const uf={get:hf};function Zu(v){const m=/^maptiler:\/\/(.*)/;let w;const P=v.trim();let B;return P.startsWith("http://")||P.startsWith("https://")?B=P:(w=m.exec(P))!==null?B=`https://api.maptiler.com/maps/${w[1]}/style.json`:B=`https://api.maptiler.com/maps/${P}/style.json`,B}class ul{constructor(m,w,P,B,X,ae){this.name=m,this.variantType=w,this.id=P,this.referenceStyle=B,this.description=X,this.imageURL=ae}getName(){return this.name}getFullName(){return`${this.referenceStyle.getName()} ${this.name}`}getType(){return this.variantType}getId(){return this.id}getDescription(){return this.description}getReferenceStyle(){return this.referenceStyle}hasVariant(m){return this.referenceStyle.hasVariant(m)}getVariant(m){return this.referenceStyle.getVariant(m)}getVariants(){return this.referenceStyle.getVariants().filter(m=>m!==this)}getImageURL(){return this.imageURL}getExpandedStyleURL(){return Zu(this.getId())}}class pl{constructor(m,w){this.name=m,this.id=w,this.variants={},this.orderedVariants=[]}getName(){return this.name}getId(){return this.id}addVariant(m){this.variants[m.getType()]=m,this.orderedVariants.push(m)}hasVariant(m){return m in this.variants}getVariant(m){return m in this.variants?this.variants[m]:this.orderedVariants[0]}getVariants(){return Object.values(this.variants)}getDefaultVariant(){return this.orderedVariants[0]}}const dl=[{referenceStyleID:"STREETS",name:"Streets",description:"",variants:[{id:"streets-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"streets-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"streets-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"streets-v2-night",name:"Night",variantType:"NIGHT",description:"",imageURL:""},{id:"streets-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OUTDOOR",name:"Outdoor",description:"",variants:[{id:"outdoor-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"outdoor-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"WINTER",name:"Winter",description:"",variants:[{id:"winter-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"winter-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"SATELLITE",name:"Satellite",description:"",variants:[{id:"satellite",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"HYBRID",name:"Hybrid",description:"",variants:[{id:"hybrid",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"BASIC",name:"Basic",description:"",variants:[{id:"basic-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"basic-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"basic-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BRIGHT",name:"Bright",description:"",variants:[{id:"bright-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"bright-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"bright-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"bright-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OPENSTREETMAP",name:"OpenStreetMap",description:"",variants:[{id:"openstreetmap",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"TOPO",name:"Topo",description:"",variants:[{id:"topo-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"topo-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"topo-v2-shiny",name:"Shiny",variantType:"SHINY",description:"",imageURL:""},{id:"topo-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""},{id:"topo-v2-topographique",name:"Topographique",variantType:"TOPOGRAPHIQUE",description:"",imageURL:""}]},{referenceStyleID:"VOYAGER",name:"Voyager",description:"",variants:[{id:"voyager-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"voyager-v2-darkmatter",name:"Darkmatter",variantType:"DARK",description:"",imageURL:""},{id:"voyager-v2-positron",name:"Positron",variantType:"LIGHT",description:"",imageURL:""},{id:"voyager-v2-vintage",name:"Vintage",variantType:"VINTAGE",description:"",imageURL:""}]},{referenceStyleID:"TONER",name:"Toner",description:"",variants:[{id:"toner-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"toner-v2-background",name:"Background",variantType:"BACKGROUND",description:"",imageURL:""},{id:"toner-v2-lite",name:"Lite",variantType:"LITE",description:"",imageURL:""},{id:"toner-v2-lines",name:"Lines",variantType:"LINES",description:"",imageURL:""}]},{referenceStyleID:"DATAVIZ",name:"Dataviz",description:"",variants:[{id:"dataviz",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"dataviz-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"dataviz-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BACKDROP",name:"Backdrop",description:"",variants:[{id:"backdrop",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"backdrop-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"backdrop-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"OCEAN",name:"Ocean",description:"",variants:[{id:"ocean",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]}];function pf(v){return new Proxy(v,{get(m,w,P){return m.hasVariant(w)?m.getVariant(w):w.toString().toUpperCase()===w?v.getDefaultVariant():Reflect.get(m,w,P)}})}function df(){const v={};for(let m=0;m<dl.length;m+=1){const w=dl[m],P=pf(new pl(w.name,w.referenceStyleID));for(let B=0;B<w.variants.length;B+=1){const X=w.variants[B],ae=new ul(X.name,X.variantType,X.id,P,X.description,X.imageURL);P.addVariant(ae)}v[w.referenceStyleID]=P}return v}function Bc(v){if(!v)return Fc[dl[0].referenceStyleID].getDefaultVariant().getId();if(typeof v=="string"||v instanceof String)return v.trim().toLowerCase();if(v instanceof ul)return v.getId();if(v instanceof pl)return v.getDefaultVariant().getId()}const Fc=df();function mf(v,m,w){let P=m[0],B=m[1],X=w[0]-P,ae=w[1]-B;if(X!==0||ae!==0){const l=((v[0]-P)*X+(v[1]-B)*ae)/(X*X+ae*ae);l>1?(P=w[0],B=w[1]):l>0&&(P+=X*l,B+=ae*l)}return X=v[0]-P,ae=v[1]-B,X*X+ae*ae}function Oc(v,m,w,P,B){let X=P,ae;for(let l=m+1;l<w;l++){const he=mf(v[l],v[m],v[w]);he>X&&(ae=l,X=he)}X>P&&(ae-m>1&&Oc(v,m,ae,P,B),B.push(v[ae]),w-ae>1&&Oc(v,ae,w,P,B))}function ff(v,m){const w=v.length-1,P=[v[0]];return Oc(v,0,w,m,P),P.push(v[w]),P}function gf(v,m){if(v.length<=2)return v;const w=m!==void 0?m*m:1;return ff(v,w)}function Nc(v,m=!0){let w=`${v[0]},${v[1]}`;return v.length===3&&m&&(w+=`,${v[2]}`),w}function Uc(v,m=3e3){let w=v.map(X=>X.join(",")).join("|"),P=5e-6;const B=1e-5;for(;w.length>m;)w=gf(v,P).map(ae=>`${ae[0]},${ae[1]}`).join("|"),P+=B;return w}function yf(v,m,w={}){const P=Bc(w.style),B=w.hiDPI?"@2x":"",X=w.format??"png";let ae=~~(w.width??1024),l=~~(w.height??1024);w.hiDPI&&(ae=~~(ae/2),l=~~(l/2));const he=new URL(`maps/${encodeURIComponent(P)}/static/${v[0]},${v[1]},${m}/${ae}x${l}${B}.${X}`,Or.maptilerApiURL);if("attribution"in w&&he.searchParams.set("attribution",w.attribution.toString()),"markers"in w){let H="";const Ae="markerIcon"in w;Ae&&(H+=`icon:${w.markerIcon}|`),Ae&&"markerAnchor"in w&&(H+=`anchor:${w.markerAnchor}|`),Ae&&w.hiDPI&&(H+="scale:2|");const ke=Array.isArray(w.markers[0])?w.markers:[w.markers];H+=ke.map(ye=>Nc(ye,!Ae)).join("|"),he.searchParams.set("markers",H)}if("path"in w){let H="";if(H+=`fill:${w.pathFillColor??"none"}|`,"pathStrokeColor"in w&&(H+=`stroke:${w.pathStrokeColor}|`),"pathWidth"in w){const Ae=w.pathWidth/(w.hiDPI?2:1);H+=`width:${Ae.toString()}|`}H+=Uc(w.path),he.searchParams.set("path",H)}return he.searchParams.set("key",w.apiKey??yr.apiKey),he.toString()}function _f(v,m={}){const w=Bc(m.style),P=m.hiDPI?"@2x":"",B=m.format??"png";let X=~~(m.width??1024),ae=~~(m.height??1024);m.hiDPI&&(X=~~(X/2),ae=~~(ae/2));const l=new URL(`maps/${encodeURIComponent(w)}/static/${v[0]},${v[1]},${v[2]},${v[3]}/${X}x${ae}${P}.${B}`,Or.maptilerApiURL);if("attribution"in m&&l.searchParams.set("attribution",m.attribution.toString()),"padding"in m&&l.searchParams.set("padding",m.padding.toString()),"markers"in m){let he="";const H="markerIcon"in m;H&&(he+=`icon:${m.markerIcon}|`),H&&"markerAnchor"in m&&(he+=`anchor:${m.markerAnchor}|`),H&&m.hiDPI&&(he+="scale:2|");const Ae=Array.isArray(m.markers[0])?m.markers:[m.markers];he+=Ae.map(ke=>Nc(ke,!H)).join("|"),l.searchParams.set("markers",he)}if("path"in m){let he="";if(he+=`fill:${m.pathFillColor??"none"}|`,"pathStrokeColor"in m&&(he+=`stroke:${m.pathStrokeColor}|`),"pathWidth"in m){const H=m.pathWidth/(m.hiDPI?2:1);he+=`width:${H.toString()}|`}he+=Uc(m.path),l.searchParams.set("path",he)}return l.searchParams.set("key",m.apiKey??yr.apiKey),l.toString()}function vf(v={}){if(!("markers"in v)&&!("path"in v))throw new Error("Automatic static maps require markers and/or path to be created.");const m=Bc(v.style),w=v.hiDPI?"@2x":"",P=v.format??"png";let B=~~(v.width??1024),X=~~(v.height??1024);v.hiDPI&&(B=~~(B/2),X=~~(X/2));const ae=new URL(`maps/${encodeURIComponent(m)}/static/auto/${B}x${X}${w}.${P}`,Or.maptilerApiURL);if("attribution"in v&&ae.searchParams.set("attribution",v.attribution.toString()),"padding"in v&&ae.searchParams.set("padding",v.padding.toString()),"markers"in v){let l="";const he="markerIcon"in v;he&&(l+=`icon:${v.markerIcon}|`),he&&"markerAnchor"in v&&(l+=`anchor:${v.markerAnchor}|`),he&&v.hiDPI&&(l+="scale:2|");const H=Array.isArray(v.markers[0])?v.markers:[v.markers];l+=H.map(Ae=>Nc(Ae,!he)).join("|"),ae.searchParams.set("markers",l)}if("path"in v){let l="";if(l+=`fill:${v.pathFillColor??"none"}|`,"pathStrokeColor"in v&&(l+=`stroke:${v.pathStrokeColor}|`),"pathWidth"in v){const he=v.pathWidth/(v.hiDPI?2:1);l+=`width:${he.toString()}|`}l+=Uc(v.path),ae.searchParams.set("path",l)}return ae.searchParams.set("key",v.apiKey??yr.apiKey),ae.toString()}const xf={centered:yf,bounded:_f,automatic:vf};let ml;const bf=new Uint8Array(16);function wf(){if(!ml&&(ml=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ml))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ml(bf)}const Gi=[];for(let v=0;v<256;++v)Gi.push((v+256).toString(16).slice(1));function Sf(v,m=0){return Gi[v[m+0]]+Gi[v[m+1]]+Gi[v[m+2]]+Gi[v[m+3]]+"-"+Gi[v[m+4]]+Gi[v[m+5]]+"-"+Gi[v[m+6]]+Gi[v[m+7]]+"-"+Gi[v[m+8]]+Gi[v[m+9]]+"-"+Gi[v[m+10]]+Gi[v[m+11]]+Gi[v[m+12]]+Gi[v[m+13]]+Gi[v[m+14]]+Gi[v[m+15]]}var Hu={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Tf(v,m,w){if(Hu.randomUUID&&!m&&!v)return Hu.randomUUID();v=v||{};const P=v.random||(v.rng||wf)();if(P[6]=P[6]&15|64,P[8]=P[8]&63|128,m){w=w||0;for(let B=0;B<16;++B)m[w+B]=P[B];return m}return Sf(P)}const Mt={VISITOR:"visitor",VISITOR_ENGLISH:"visitor_en",STYLE:"style",AUTO:"auto",STYLE_LOCK:"style_lock",LATIN:"name:latin",NON_LATIN:"name:nonlatin",LOCAL:"name",INTERNATIONAL:"name_int",ALBANIAN:"name:sq",AMHARIC:"name:am",ARABIC:"name:ar",ARMENIAN:"name:hy",AZERBAIJANI:"name:az",BASQUE:"name:eu",BELORUSSIAN:"name:be",BENGALI:"name:bn",BOSNIAN:"name:bs",BRETON:"name:br",BULGARIAN:"name:bg",CATALAN:"name:ca",CHINESE:"name:zh",TRADITIONAL_CHINESE:"name:zh-Hant",SIMPLIFIED_CHINESE:"name:zh-Hans",CORSICAN:"name:co",CROATIAN:"name:hr",CZECH:"name:cs",DANISH:"name:da",DUTCH:"name:nl",ENGLISH:"name:en",ESPERANTO:"name:eo",ESTONIAN:"name:et",FINNISH:"name:fi",FRENCH:"name:fr",FRISIAN:"name:fy",GEORGIAN:"name:ka",GERMAN:"name:de",GREEK:"name:el",HEBREW:"name:he",HINDI:"name:hi",HUNGARIAN:"name:hu",ICELANDIC:"name:is",INDONESIAN:"name:id",IRISH:"name:ga",ITALIAN:"name:it",JAPANESE:"name:ja",JAPANESE_HIRAGANA:"name:ja-Hira",JAPANESE_KANA:"name:ja_kana",JAPANESE_LATIN:"name:ja_rm",JAPANESE_2018:"name:ja-Latn",KANNADA:"name:kn",KAZAKH:"name:kk",KOREAN:"name:ko",KOREAN_LATIN:"name:ko-Latn",KURDISH:"name:ku",ROMAN_LATIN:"name:la",LATVIAN:"name:lv",LITHUANIAN:"name:lt",LUXEMBOURGISH:"name:lb",MACEDONIAN:"name:mk",MALAYALAM:"name:ml",MALTESE:"name:mt",NORWEGIAN:"name:no",OCCITAN:"name:oc",PERSIAN:"name:fa",POLISH:"name:pl",PORTUGUESE:"name:pt",PUNJABI:"name:pa",WESTERN_PUNJABI:"name:pnb",ROMANIAN:"name:ro",ROMANSH:"name:rm",RUSSIAN:"name:ru",SCOTTISH_GAELIC:"name:gd",SERBIAN_CYRILLIC:"name:sr",SERBIAN_LATIN:"name:sr-Latn",SLOVAK:"name:sk",SLOVENE:"name:sl",SPANISH:"name:es",SWEDISH:"name:sv",TAMIL:"name:ta",TELUGU:"name:te",THAI:"name:th",TURKISH:"name:tr",UKRAINIAN:"name:uk",URDU:"name:ur",VIETNAMIAN_LATIN:"name:vi",WELSH:"name:cy"},If=new Set(Object.values(Mt));function Wu(v){return If.has(v)}const Af=new Set(Object.values(Mt));function Ku(){if(typeof navigator>"u")return`name:${Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0]}`;const v=Array.from(new Set(navigator.languages.map(m=>`name:${m.split("-")[0]}`))).filter(m=>Af.has(m));return v.length?v[0]:Mt.LOCAL}const Nr={maptilerLogoURL:"https://api.maptiler.com/resources/logo.svg",maptilerURL:"https://www.maptiler.com/",maptilerApiHost:"api.maptiler.com",rtlPluginURL:"https://cdn.maptiler.com/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.min.js",primaryLanguage:Mt.STYLE,secondaryLanguage:Mt.LOCAL,terrainSourceURL:"https://api.maptiler.com/tiles/terrain-rgb-v2/tiles.json",terrainSourceId:"maptiler-terrain"};Object.freeze(Nr);var Cf=Object.defineProperty,Ef=(v,m,w)=>m in v?Cf(v,m,{enumerable:!0,configurable:!0,writable:!0,value:w}):v[m]=w,Xs=(v,m,w)=>(Ef(v,typeof m!="symbol"?m+"":m,w),w);const Xu=Tf();let Yu=class extends Km{constructor(){super(),Xs(this,"primaryLanguage",Nr.primaryLanguage),Xs(this,"secondaryLanguage"),Xs(this,"session",!0),Xs(this,"_unit","metric"),Xs(this,"_apiKey","")}set unit(m){this._unit=m,this.emit("unit",m)}get unit(){return this._unit}set apiKey(m){this._apiKey=m,yr.apiKey=m,this.emit("apiKey",m)}get apiKey(){return this._apiKey}set fetch(m){yr.fetch=m}get fetch(){return yr.fetch}};const _r=new Yu;class Ju extends pt.LogoControl{onAdd(m){return super.onAdd(m)}}var Pf=Object.defineProperty,kf=(v,m,w)=>m in v?Pf(v,m,{enumerable:!0,configurable:!0,writable:!0,value:w}):v[m]=w,Qu=(v,m,w)=>(kf(v,typeof m!="symbol"?m+"":m,w),w);class Vc extends Ju{constructor(m={}){var w,P;super(m),Qu(this,"logoURL",""),Qu(this,"linkURL",""),this.logoURL=(w=m.logoURL)!=null?w:Nr.maptilerLogoURL,this.linkURL=(P=m.linkURL)!=null?P:Nr.maptilerURL}onAdd(m){var w;this._map=m,this._compact=(w=this.options.compact)!=null?w:!1,this._container=window.document.createElement("div"),this._container.className="maplibregl-ctrl";const P=window.document.createElement("a");return P.style.backgroundRepeat="no-repeat",P.style.cursor="pointer",P.style.display="block",P.style.height="23px",P.style.margin="0 0 -4px -4px",P.style.overflow="hidden",P.style.width="88px",P.style.backgroundImage=`url(${this.logoURL})`,P.style.backgroundSize="100px 30px",P.style.width="100px",P.style.height="30px",P.target="_blank",P.rel="noopener",P.href=this.linkURL,P.setAttribute("aria-label","MapTiler logo"),P.setAttribute("rel","noopener"),this._container.appendChild(P),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}}var Mf=Object.defineProperty,ep=Object.getOwnPropertySymbols,Lf=Object.prototype.hasOwnProperty,zf=Object.prototype.propertyIsEnumerable,tp=(v,m,w)=>m in v?Mf(v,m,{enumerable:!0,configurable:!0,writable:!0,value:w}):v[m]=w,ip=(v,m)=>{for(var w in m||(m={}))Lf.call(m,w)&&tp(v,w,m[w]);if(ep)for(var w of ep(m))zf.call(m,w)&&tp(v,w,m[w]);return v};function Df(){pt.getRTLTextPluginStatus()==="unavailable"&&pt.setRTLTextPlugin(Nr.rtlPluginURL,v=>{v&&console.error(v)},!0)}function Rf(v,m){v.forEach(w=>{typeof m[w]=="function"&&(m[w]=m[w].bind(m))})}function ta(v,m,w){const P=window.document.createElement(v);return m!==void 0&&(P.className=m),w&&w.appendChild(P),P}function rp(v){v.parentNode&&v.parentNode.removeChild(v)}function np(v,m){let w=null;try{w=new URL(v)}catch{return{url:v}}return w.host===Nr.maptilerApiHost&&(w.searchParams.has("key")||w.searchParams.append("key",_r.apiKey),_r.session&&w.searchParams.append("mtsid",Xu)),{url:w.href}}function ap(v){return function(m,w){var P;if(v!==void 0){const B=v(m,w),X=np((P=B?.url)!=null?P:"");return ip(ip({},B),X)}else return np(m)}}function sp(){return Math.random().toString(36).substring(2)}function fl(v){return/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi.test(v)}function Bf(v){try{return JSON.parse(v)}catch{}return null}function op(v){return v?typeof v=="string"||v instanceof String?!v.startsWith("http")&&v.toLowerCase().includes(".json")?v:Zu(v):v instanceof ul?v.getExpandedStyleURL():v instanceof pl?v.getDefaultVariant().getExpandedStyleURL():v:Fc[dl[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL()}var Ff=Object.defineProperty,Of=(v,m,w)=>m in v?Ff(v,m,{enumerable:!0,configurable:!0,writable:!0,value:w}):v[m]=w,$c=(v,m,w)=>(Of(v,typeof m!="symbol"?m+"":m,w),w);class lp{constructor(){$c(this,"_map"),$c(this,"_container"),$c(this,"_terrainButton"),Rf(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(m){return this._map=m,this._container=ta("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=ta("button","maplibregl-ctrl-terrain",this._container),ta("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(){rp(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.hasTerrain()?this._map.disableTerrain():this._map.enableTerrain(),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.hasTerrain()?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}}class cp extends pt.NavigationControl{onAdd(m){return super.onAdd(m)}}var Nf=Object.defineProperty,Uf=(v,m,w)=>m in v?Nf(v,m,{enumerable:!0,configurable:!0,writable:!0,value:w}):v[m]=w,Vf=(v,m,w)=>(Uf(v,typeof m!="symbol"?m+"":m,w),w);class hp extends cp{constructor(){super({showCompass:!0,showZoom:!0,visualizePitch:!0}),Vf(this,"_rotateCompassArrow",()=>{const m=this.options.visualizePitch?`scale(${Math.min(1.5,1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5))}) rotateX(${Math.min(70,this._map.transform.pitch)}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=m}),this._compass.removeEventListener("click",this._compass.clickFunction),this._compass.addEventListener("click",m=>{this._map.getPitch()===0?this._map.easeTo({pitch:Math.min(this._map.getMaxPitch(),80)}):this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:m}):this._map.resetNorth({},{originalEvent:m})})}_createButton(m,w){const P=super._createButton(m,w);return P.clickFunction=w,P}}class up extends pt.GeolocateControl{onAdd(m){return super.onAdd(m)}}var $f=Object.defineProperty,jf=Object.defineProperties,Gf=Object.getOwnPropertyDescriptors,pp=Object.getOwnPropertySymbols,qf=Object.prototype.hasOwnProperty,Zf=Object.prototype.propertyIsEnumerable,jc=(v,m,w)=>m in v?$f(v,m,{enumerable:!0,configurable:!0,writable:!0,value:w}):v[m]=w,Hf=(v,m)=>{for(var w in m||(m={}))qf.call(m,w)&&jc(v,w,m[w]);if(pp)for(var w of pp(m))Zf.call(m,w)&&jc(v,w,m[w]);return v},Wf=(v,m)=>jf(v,Gf(m)),gl=(v,m,w)=>(jc(v,typeof m!="symbol"?m+"":m,w),w);const dp=pt.Marker,mp=pt.LngLat,Kf=pt.LngLatBounds;class fp extends up{constructor(){super(...arguments),gl(this,"lastUpdatedCenter",new mp(0,0)),gl(this,"_updateCamera",m=>{var w,P,B;const X=new mp(m.coords.longitude,m.coords.latitude),ae=m.coords.accuracy,l=this._map.getBearing(),he=Wf(Hf({bearing:l},this.options.fitBoundsOptions),{linear:!0}),H=this._map.getZoom();H>((B=(P=(w=this.options)==null?void 0:w.fitBoundsOptions)==null?void 0:P.maxZoom)!=null?B:30)&&(he.zoom=H),this._map.fitBounds(Kf.fromLngLat(X,ae),he,{geolocateSource:!0});let Ae=!1;const ke=()=>{Ae=!0};this._map.once("click",ke),this._map.once("dblclick",ke),this._map.once("dragstart",ke),this._map.once("mousedown",ke),this._map.once("touchstart",ke),this._map.once("wheel",ke),this._map.once("moveend",()=>{this._map.off("click",ke),this._map.off("dblclick",ke),this._map.off("dragstart",ke),this._map.off("mousedown",ke),this._map.off("touchstart",ke),this._map.off("wheel",ke),!Ae&&(this.lastUpdatedCenter=this._map.getCenter())})}),gl(this,"_setupUI",m=>{if(this.lastUpdatedCenter=this._map.getCenter(),this._container.addEventListener("contextmenu",w=>w.preventDefault()),this._geolocateButton=ta("button","maplibregl-ctrl-geolocate",this._container),ta("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",m===!1){const w=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=w,this._geolocateButton.setAttribute("aria-label",w)}else{const w=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=w,this._geolocateButton.setAttribute("aria-label",w)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=ta("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new dp({element:this._dotElement}),this._circleElement=ta("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new dp({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("move",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("moveend",w=>{const P=w.originalEvent&&w.originalEvent.type==="resize",B=this.lastUpdatedCenter.distanceTo(this._map.getCenter());!w.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!P&&B>1&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new Event("trackuserlocationend")))})}),gl(this,"_onZoom",()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()})}_updateCircleRadius(){if(this._watchState!=="BACKGROUND"&&this._watchState!=="ACTIVE_LOCK")return;const m=[this._lastKnownPosition.coords.longitude,this._lastKnownPosition.coords.latitude],w=this._map.project(m),P=this._map.unproject([w.x,w.y]),B=this._map.unproject([w.x+20,w.y]),X=P.distanceTo(B)/20,ae=Math.ceil(2*this._accuracy/X);this._circleElement.style.width=`${ae}px`,this._circleElement.style.height=`${ae}px`}}class gp extends pt.AttributionControl{onAdd(m){return super.onAdd(m)}}class yp extends pt.ScaleControl{onAdd(m){return super.onAdd(m)}}class _p extends pt.FullscreenControl{onAdd(m){return super.onAdd(m)}}var Xf=Object.defineProperty,Yf=Object.defineProperties,Jf=Object.getOwnPropertyDescriptors,vp=Object.getOwnPropertySymbols,Qf=Object.prototype.hasOwnProperty,eg=Object.prototype.propertyIsEnumerable,Gc=(v,m,w)=>m in v?Xf(v,m,{enumerable:!0,configurable:!0,writable:!0,value:w}):v[m]=w,as=(v,m)=>{for(var w in m||(m={}))Qf.call(m,w)&&Gc(v,w,m[w]);if(vp)for(var w of vp(m))eg.call(m,w)&&Gc(v,w,m[w]);return v},xp=(v,m)=>Yf(v,Jf(m)),tg=(v,m,w)=>(Gc(v,typeof m!="symbol"?m+"":m,w),w),qc=(v,m,w)=>{if(!m.has(v))throw TypeError("Cannot "+w)},Ct=(v,m,w)=>(qc(v,m,"read from private field"),w?w.call(v):m.get(v)),gn=(v,m,w)=>{if(m.has(v))throw TypeError("Cannot add the same private member more than once");m instanceof WeakSet?m.add(v):m.set(v,w)},ss=(v,m,w,P)=>(qc(v,m,"write to private field"),P?P.call(v,w):m.set(v,w),w),kr=(v,m,w)=>(qc(v,m,"access private method"),w),Mr,yn,Ca,bp,Ea,Ur,yl,Zc,wp,Lr,Vr,Hc,Sp;let Wc=class{constructor(m,w){gn(this,Zc),gn(this,Lr),gn(this,Hc),gn(this,Mr,void 0),tg(this,"map"),gn(this,yn,void 0),gn(this,Ca,void 0),gn(this,bp,void 0),gn(this,Ea,void 0),gn(this,Ur,!1),gn(this,yl,void 0);var P;m.style!==void 0&&ss(this,Ur,!0),ss(this,Mr,xp(as(xp(as({zoomAdjust:-4,position:"top-right"},w),{forceNoAttributionControl:!0,attributionControl:!1,navigationControl:!1,geolocateControl:!1,maptilerLogo:!1,minimap:!1,hash:!1,pitchAdjust:!1}),m),{containerStyle:as({border:"1px solid #000",width:"400px",height:"300px"},(P=m.containerStyle)!=null?P:{})})),m.lockZoom!==void 0&&(Ct(this,Mr).minZoom=m.lockZoom,Ct(this,Mr).maxZoom=m.lockZoom)}setStyle(m,w){Ct(this,Ur)||this.map.setStyle(m,w),kr(this,Lr,Vr).call(this)}addLayer(m,w){return Ct(this,Ur)||this.map.addLayer(m,w),kr(this,Lr,Vr).call(this),this.map}moveLayer(m,w){return Ct(this,Ur)||this.map.moveLayer(m,w),kr(this,Lr,Vr).call(this),this.map}removeLayer(m){return Ct(this,Ur)||this.map.removeLayer(m),kr(this,Lr,Vr).call(this),this}setLayerZoomRange(m,w,P){return Ct(this,Ur)||this.map.setLayerZoomRange(m,w,P),kr(this,Lr,Vr).call(this),this}setFilter(m,w,P){return Ct(this,Ur)||this.map.setFilter(m,w,P),kr(this,Lr,Vr).call(this),this}setPaintProperty(m,w,P,B){return Ct(this,Ur)||this.map.setPaintProperty(m,w,P,B),kr(this,Lr,Vr).call(this),this}setLayoutProperty(m,w,P,B){return Ct(this,Ur)||this.map.setLayoutProperty(m,w,P,B),kr(this,Lr,Vr).call(this),this}setGlyphs(m,w){return Ct(this,Ur)||this.map.setGlyphs(m,w),kr(this,Lr,Vr).call(this),this}onAdd(m){ss(this,yn,m),ss(this,Ca,ta("div","maplibregl-ctrl maplibregl-ctrl-group"));for(const[w,P]of Object.entries(Ct(this,Mr).containerStyle))Ct(this,Ca).style.setProperty(w,P);return Ct(this,Mr).container=Ct(this,Ca),Ct(this,Mr).zoom=m.getZoom()+Ct(this,Mr).zoomAdjust,this.map=new Ap(Ct(this,Mr)),this.map.once("style.load",()=>{this.map.resize()}),this.map.once("load",()=>{kr(this,Zc,wp).call(this,Ct(this,Mr).parentRect),ss(this,yl,kr(this,Hc,Sp).call(this))}),Ct(this,Ca)}onRemove(){var m;(m=Ct(this,yl))==null||m.call(this),rp(Ct(this,Ca))}};Mr=new WeakMap,yn=new WeakMap,Ca=new WeakMap,bp=new WeakMap,Ea=new WeakMap,Ur=new WeakMap,yl=new WeakMap,Zc=new WeakSet,wp=function(v){v===void 0||v.linePaint===void 0&&v.fillPaint===void 0||(ss(this,Ea,{type:"Feature",properties:{name:"parentRect"},geometry:{type:"Polygon",coordinates:[[[],[],[],[],[]]]}}),this.map.addSource("parentRect",{type:"geojson",data:Ct(this,Ea)}),(v.lineLayout!==void 0||v.linePaint!==void 0)&&this.map.addLayer({id:"parentRectOutline",type:"line",source:"parentRect",layout:as({},v.lineLayout),paint:as({"line-color":"#FFF","line-width":1,"line-opacity":.85},v.linePaint)}),v.fillPaint!==void 0&&this.map.addLayer({id:"parentRectFill",type:"fill",source:"parentRect",layout:{},paint:as({"fill-color":"#08F","fill-opacity":.135},v.fillPaint)}),kr(this,Lr,Vr).call(this))},Lr=new WeakSet,Vr=function(){if(Ct(this,Ea)===void 0)return;const{devicePixelRatio:v}=window,m=Ct(this,yn).getCanvas(),w=m.width/v,P=m.height/v,B=Ct(this,yn).unproject.bind(Ct(this,yn)),X=B([0,0]),ae=B([w,0]),l=B([0,P]),he=B([w,P]);Ct(this,Ea).geometry.coordinates=[[l.toArray(),he.toArray(),ae.toArray(),X.toArray(),l.toArray()]],this.map.getSource("parentRect").setData(Ct(this,Ea))},Hc=new WeakSet,Sp=function(){const{pitchAdjust:v}=Ct(this,Mr),m=()=>{X("parent")},w=()=>{X("minimap")},P=()=>{Ct(this,yn).on("move",m),this.map.on("move",w)},B=()=>{Ct(this,yn).off("move",m),this.map.off("move",w)},X=ae=>{var l;B();const he=ae==="parent"?Ct(this,yn):this.map,H=ae==="parent"?this.map:Ct(this,yn),Ae=he.getCenter(),ke=he.getZoom()+((l=Ct(this,Mr).zoomAdjust)!=null?l:-4)*(ae==="parent"?1:-1),ye=he.getBearing(),ct=he.getPitch();H.jumpTo({center:Ae,zoom:ke,bearing:ye,pitch:v?ct:0}),kr(this,Lr,Vr).call(this),P()};return P(),()=>{B()}};var ig=Object.defineProperty,rg=Object.defineProperties,ng=Object.getOwnPropertyDescriptors,Tp=Object.getOwnPropertySymbols,ag=Object.prototype.hasOwnProperty,sg=Object.prototype.propertyIsEnumerable,Kc=(v,m,w)=>m in v?ig(v,m,{enumerable:!0,configurable:!0,writable:!0,value:w}):v[m]=w,og=(v,m)=>{for(var w in m||(m={}))ag.call(m,w)&&Kc(v,w,m[w]);if(Tp)for(var w of Tp(m))sg.call(m,w)&&Kc(v,w,m[w]);return v},lg=(v,m)=>rg(v,ng(m)),ia=(v,m,w)=>(Kc(v,typeof m!="symbol"?m+"":m,w),w),zn=(v,m,w)=>new Promise((P,B)=>{var X=he=>{try{l(w.next(he))}catch(H){B(H)}},ae=he=>{try{l(w.throw(he))}catch(H){B(H)}},l=he=>he.done?P(he.value):Promise.resolve(he.value).then(X,ae);l((w=w.apply(v,m)).next())});const Ip={POINT:"POINT",COUNTRY:"COUNTRY"};let Ap=class extends pt.Map{constructor(m){var w,P,B;m.apiKey&&(_r.apiKey=m.apiKey);const X=op(m.style),ae=location.hash;_r.apiKey||console.warn("MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!"),super(lg(og({},m),{style:X,maplibreLogo:!1,transformRequest:ap(m.transformRequest)})),ia(this,"isTerrainEnabled",!1),ia(this,"terrainExaggeration",1),ia(this,"primaryLanguage"),ia(this,"terrainGrowing",!1),ia(this,"terrainFlattening",!1),ia(this,"minimap"),ia(this,"forceLanguageUpdate"),ia(this,"languageAlwaysBeenStyle"),this.primaryLanguage=(w=m.language)!=null?w:_r.primaryLanguage,this.forceLanguageUpdate=!(this.primaryLanguage===Mt.STYLE||this.primaryLanguage===Mt.STYLE_LOCK),this.languageAlwaysBeenStyle=this.primaryLanguage===Mt.STYLE,this.terrainExaggeration=(P=m.terrainExaggeration)!=null?P:this.terrainExaggeration,this.once("styledata",()=>zn(this,null,function*(){if(!m.geolocate||m.center||m.hash&&ae)return;try{if(m.geolocate===Ip.COUNTRY){yield this.fitToIpBounds();return}}catch(ye){console.warn(ye.message)}let ke;try{yield this.centerOnIpPoint(m.zoom),ke=this.getCameraHash()}catch(ye){console.warn(ye.message)}(yield navigator.permissions.query({name:"geolocation"})).state==="granted"&&navigator.geolocation.getCurrentPosition(ye=>{ke===this.getCameraHash()&&(this.terrain?this.easeTo({center:[ye.coords.longitude,ye.coords.latitude],zoom:m.zoom||12,duration:2e3}):this.once("terrain",()=>{this.easeTo({center:[ye.coords.longitude,ye.coords.latitude],zoom:m.zoom||12,duration:2e3})}))},null,{maximumAge:24*3600*1e3,timeout:5e3,enableHighAccuracy:!1})})),this.on("styledata",()=>{this.setPrimaryLanguage(this.primaryLanguage)}),this.on("styledata",()=>{this.getTerrain()===null&&this.isTerrainEnabled&&this.enableTerrain(this.terrainExaggeration)}),this.once("load",()=>zn(this,null,function*(){Df()})),this.once("load",()=>zn(this,null,function*(){let ke={logo:null};try{const ye=Object.keys(this.style.sourceCaches).map(dt=>this.getSource(dt)).filter(dt=>dt&&"url"in dt&&typeof dt.url=="string"&&dt?.url.includes("tiles.json")),ct=new URL(ye[0].url);ct.searchParams.has("key")||ct.searchParams.append("key",_r.apiKey),ke=yield(yield fetch(ct.href)).json()}catch{}if(m.forceNoAttributionControl!==!0)if("logo"in ke&&ke.logo){const ye=ke.logo;this.addControl(new Vc({logoURL:ye}),m.logoPosition),m.attributionControl===!1&&this.addControl(new gp({customAttribution:m.customAttribution}))}else m.maptilerLogo&&this.addControl(new Vc,m.logoPosition);if(m.scaleControl){const ye=m.scaleControl===!0||m.scaleControl===void 0?"bottom-right":m.scaleControl,ct=new yp({unit:_r.unit});this.addControl(ct,ye),_r.on("unit",dt=>{ct.setUnit(dt)})}if(m.navigationControl!==!1){const ye=m.navigationControl===!0||m.navigationControl===void 0?"top-right":m.navigationControl;this.addControl(new hp,ye)}if(m.geolocateControl!==!1){const ye=m.geolocateControl===!0||m.geolocateControl===void 0?"top-right":m.geolocateControl;this.addControl(new fp({positionOptions:{enableHighAccuracy:!0,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!0,showAccuracyCircle:!0,showUserLocation:!0}),ye)}if(m.terrainControl){const ye=m.terrainControl===!0||m.terrainControl===void 0?"top-right":m.terrainControl;this.addControl(new lp,ye)}if(m.fullscreenControl){const ye=m.fullscreenControl===!0||m.fullscreenControl===void 0?"top-right":m.fullscreenControl;this.addControl(new _p({}),ye)}}));let l=!1,he=!1,H;this.once("load",()=>{l=!0,he&&this.fire("loadWithTerrain",H)}),this.once("style.load",()=>{var ke;const{minimap:ye}=m;if(typeof ye=="object"){const{zoom:ct,center:dt,style:et,language:Tt,apiKey:it,maptilerLogo:It,antialias:qt,refreshExpiredTiles:Jt,maxBounds:Lt,scrollZoom:ht,minZoom:bt,maxZoom:Ke,boxZoom:_t,locale:qe,fadeDuration:jt,crossSourceCollisions:Qe,clickTolerance:ot,bounds:rt,fitBoundsOptions:gt,pixelRatio:Rt,validateStyle:Ot}=m;this.minimap=new Wc(ye,{zoom:ct,center:dt,style:et,language:Tt,apiKey:it,container:"null",maptilerLogo:It,antialias:qt,refreshExpiredTiles:Jt,maxBounds:Lt,scrollZoom:ht,minZoom:bt,maxZoom:Ke,boxZoom:_t,locale:qe,fadeDuration:jt,crossSourceCollisions:Qe,clickTolerance:ot,bounds:rt,fitBoundsOptions:gt,pixelRatio:Rt,validateStyle:Ot}),this.addControl(this.minimap,(ke=ye.position)!=null?ke:"bottom-left")}else ye===!0?(this.minimap=new Wc({},m),this.addControl(this.minimap,"bottom-left")):ye!==void 0&&ye!==!1&&(this.minimap=new Wc({},m),this.addControl(this.minimap,ye))});const Ae=ke=>{ke.terrain&&(he=!0,H={type:"loadWithTerrain",target:this,terrain:ke.terrain},this.off("terrain",Ae),l&&this.fire("loadWithTerrain",H))};this.on("terrain",Ae),m.terrain&&this.enableTerrain((B=m.terrainExaggeration)!=null?B:this.terrainExaggeration)}onLoadAsync(){return zn(this,null,function*(){return new Promise(m=>{if(this.loaded())return m(this);this.once("load",()=>{m(this)})})})}onLoadWithTerrainAsync(){return zn(this,null,function*(){return new Promise(m=>{if(this.loaded()&&this.terrain)return m(this);this.once("loadWithTerrain",()=>{m(this)})})})}setStyle(m,w){var P;return(P=this.minimap)==null||P.setStyle(m),this.forceLanguageUpdate=!0,this.once("idle",()=>{this.forceLanguageUpdate=!1}),super.setStyle(op(m),w)}addLayer(m,w){var P;return(P=this.minimap)==null||P.addLayer(m,w),super.addLayer(m,w)}moveLayer(m,w){var P;return(P=this.minimap)==null||P.moveLayer(m,w),super.moveLayer(m,w)}removeLayer(m){var w;return(w=this.minimap)==null||w.removeLayer(m),super.removeLayer(m)}setLayerZoomRange(m,w,P){var B;return(B=this.minimap)==null||B.setLayerZoomRange(m,w,P),super.setLayerZoomRange(m,w,P)}setFilter(m,w,P){var B;return(B=this.minimap)==null||B.setFilter(m,w,P),super.setFilter(m,w,P)}setPaintProperty(m,w,P,B){var X;return(X=this.minimap)==null||X.setPaintProperty(m,w,P,B),super.setPaintProperty(m,w,P,B)}setLayoutProperty(m,w,P,B){var X;return(X=this.minimap)==null||X.setLayoutProperty(m,w,P,B),super.setLayoutProperty(m,w,P,B)}setGlyphs(m,w){var P;return(P=this.minimap)==null||P.setGlyphs(m,w),super.setGlyphs(m,w)}getStyleLanguage(){return!this.style.stylesheet.metadata||typeof this.style.stylesheet.metadata!="object"?null:"maptiler:language"in this.style.stylesheet.metadata&&typeof this.style.stylesheet.metadata["maptiler:language"]=="string"?this.style.stylesheet.metadata["maptiler:language"]:null}setLanguage(m){var w,P;(P=(w=this.minimap)==null?void 0:w.map)==null||P.setLanguage(m),this.onStyleReady(()=>{this.setPrimaryLanguage(m)})}setPrimaryLanguage(m){const w=this.getStyleLanguage();if(!(m===Mt.STYLE&&(w===Mt.AUTO||w===Mt.VISITOR))&&(m!==Mt.STYLE&&(this.languageAlwaysBeenStyle=!1),this.languageAlwaysBeenStyle||this.primaryLanguage===m&&!this.forceLanguageUpdate))return;if(!Wu(m)){console.warn(`The language "${m}" is not supported.`);return}if(this.primaryLanguage===Mt.STYLE_LOCK){console.warn("The language cannot be changed because this map has been instantiated with the STYLE_LOCK language flag.");return}this.primaryLanguage=m;let P=m;if(m===Mt.STYLE){if(!w){console.warn("The style has no default languages.");return}if(!Wu(w)){console.warn("The language defined in the style is not valid.");return}P=w}let B=Mt.LOCAL,X=`{${B}}`;P==Mt.VISITOR?(B=Ku(),X=["case",["all",["has",B],["has",Mt.LOCAL]],["case",["==",["get",B],["get",Mt.LOCAL]],["get",Mt.LOCAL],["format",["get",B],{"font-scale":.8},`
|
|
581
|
-
`,["get",
|
|
582
|
-
`,["get",Mt.LOCAL],{"font-scale":1.1}]],["get",Mt.LOCAL]]):P===Mt.AUTO?(B=Ku(),X=["case",["has",B],["get",B],["get",Mt.LOCAL]]):P===Mt.LOCAL?(B=Mt.LOCAL,X=`{${B}}`):(B=P,X=["case",["has",B],["get",B],["get",Mt.LOCAL]]);const{layers:ae}=this.getStyle();for(const{id:l,layout:he}of ae){if(!he||!("text-field"in he))continue;const H=this.getLayoutProperty(l,"text-field");typeof H=="string"&&(H.toLowerCase().includes("ref")||H.toLowerCase().includes("housenumber"))||this.setLayoutProperty(l,"text-field",X)}}getPrimaryLanguage(){return this.primaryLanguage}getTerrainExaggeration(){return this.terrainExaggeration}hasTerrain(){return this.isTerrainEnabled}growTerrain(m,w=1e3){if(!this.terrain)return;const P=performance.now(),B=this.terrain.exaggeration,X=m-B,ae=()=>{if(!this.terrain||this.terrainFlattening)return;const l=(performance.now()-P)/w;if(l<.99){const he=1-Math.pow(1-l,4),H=B+he*X;this.terrain.exaggeration=H,requestAnimationFrame(ae)}else this.terrainGrowing=!1,this.terrainFlattening=!1,this.terrain.exaggeration=m;this.triggerRepaint()};this.terrainGrowing=!0,this.terrainFlattening=!1,requestAnimationFrame(ae)}enableTerrain(m=this.terrainExaggeration){if(m<0){console.warn("Terrain exaggeration cannot be negative.");return}const w=B=>zn(this,null,function*(){!this.terrain||B.type!=="data"||B.dataType!=="source"||!("source"in B)||B.sourceId!=="maptiler-terrain"||B.source.type!=="raster-dem"||B.isSourceLoaded&&(this.off("data",w),this.growTerrain(m))}),P=()=>{this.isTerrainEnabled=!0,this.terrainExaggeration=m,this.on("data",w),this.addSource(Nr.terrainSourceId,{type:"raster-dem",url:Nr.terrainSourceURL}),this.setTerrain({source:Nr.terrainSourceId,exaggeration:0})};if(this.getTerrain()){this.isTerrainEnabled=!0,this.growTerrain(m);return}this.loaded()||this.isTerrainEnabled?P():this.once("load",()=>{this.getTerrain()&&this.getSource(Nr.terrainSourceId)||P()})}disableTerrain(){if(!this.terrain)return;this.isTerrainEnabled=!1;const m=1*1e3,w=performance.now(),P=this.terrain.exaggeration,B=()=>{if(!this.terrain||this.terrainGrowing)return;const X=(performance.now()-w)/m;if(X<.99){const ae=Math.pow(1-X,4),l=P*ae;this.terrain.exaggeration=l,requestAnimationFrame(B)}else this.terrain.exaggeration=0,this.terrainGrowing=!1,this.terrainFlattening=!1,this.setTerrain(),this.getSource(Nr.terrainSourceId)&&this.removeSource(Nr.terrainSourceId);this.triggerRepaint()};this.terrainGrowing=!1,this.terrainFlattening=!0,requestAnimationFrame(B)}setTerrainExaggeration(m,w=!0){!w&&this.terrain?(this.terrainExaggeration=m,this.terrain.exaggeration=m,this.triggerRepaint()):this.enableTerrain(m)}onStyleReady(m){this.isStyleLoaded()?m():this.once("styledata",()=>{m()})}fitToIpBounds(){return zn(this,null,function*(){const m=yield Rc.info();this.fitBounds(m.country_bounds,{duration:0,padding:100})})}centerOnIpPoint(m){return zn(this,null,function*(){var w,P;const B=yield Rc.info();this.jumpTo({center:[(w=B?.longitude)!=null?w:0,(P=B?.latitude)!=null?P:0],zoom:m||11})})}getCameraHash(){const m=new Float32Array(5),w=this.getCenter();return m[0]=w.lng,m[1]=w.lat,m[2]=this.getZoom(),m[3]=this.getPitch(),m[4]=this.getBearing(),Vm.fromUint8Array(new Uint8Array(m.buffer))}getSdkConfig(){return _r}getMaptilerSessionId(){return Xu}setTransformRequest(m){return super.setTransformRequest(ap(m)),this}loadImageAsync(m){return zn(this,null,function*(){return new Promise((w,P)=>{this.loadImage(m,(B,X)=>{if(B){P(B);return}w(X)})})})}};class cg extends pt.Marker{addTo(m){return super.addTo(m)}}class hg extends pt.Popup{addTo(m){return super.addTo(m)}}class ug extends pt.Style{constructor(m,w={}){super(m,w)}}class pg extends pt.CanvasSource{onAdd(m){super.onAdd(m)}}class dg extends pt.GeoJSONSource{onAdd(m){super.onAdd(m)}}class mg extends pt.ImageSource{onAdd(m){super.onAdd(m)}}class fg extends pt.RasterTileSource{onAdd(m){super.onAdd(m)}}class gg extends pt.RasterDEMTileSource{onAdd(m){super.onAdd(m)}}class yg extends pt.VectorTileSource{onAdd(m){super.onAdd(m)}}class _g extends pt.VideoSource{onAdd(m){super.onAdd(m)}}class vg extends pt.TerrainControl{onAdd(m){return super.onAdd(m)}}var xg=Object.defineProperty,bg=(v,m,w)=>m in v?xg(v,m,{enumerable:!0,configurable:!0,writable:!0,value:w}):v[m]=w,Cp=(v,m,w)=>(bg(v,typeof m!="symbol"?m+"":m,w),w);class Ys{constructor(m,w){Cp(this,"x"),Cp(this,"y"),this.x=m,this.y=w}_matMult(m){const w=m[0]*this.x+m[1]*this.y,P=m[2]*this.x+m[3]*this.y;return this.x=w,this.y=P,this}_add(m){return this.x+=m.x,this.y+=m.y,this}_sub(m){return this.x-=m.x,this.y-=m.y,this}_mult(m){return this.x*=m,this.y*=m,this}_div(m){return this.x/=m,this.y/=m,this}_multByPoint(m){return this.x*=m.x,this.y*=m.y,this}_divByPoint(m){return this.x/=m.x,this.y/=m.y,this}_unit(){return this._div(this.mag()),this}_perp(){const m=this.y;return this.y=this.x,this.x=-m,this}_rotate(m){const w=Math.cos(m),P=Math.sin(m),B=w*this.x-P*this.y,X=P*this.x+w*this.y;return this.x=B,this.y=X,this}_rotateAround(m,w){const P=Math.cos(m),B=Math.sin(m),X=w.x+P*(this.x-w.x)-B*(this.y-w.y),ae=w.y+B*(this.x-w.x)+P*(this.y-w.y);return this.x=X,this.y=ae,this}_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}clone(){return new Ys(this.x,this.y)}add(m){return this.clone()._add(m)}sub(m){return this.clone()._sub(m)}multByPoint(m){return this.clone()._multByPoint(m)}divByPoint(m){return this.clone()._divByPoint(m)}mult(m){return this.clone()._mult(m)}div(m){return this.clone()._div(m)}rotate(m){return this.clone()._rotate(m)}rotateAround(m,w){return this.clone()._rotateAround(m,w)}matMult(m){return this.clone()._matMult(m)}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(m){return this.x===m.x&&this.y===m.y}dist(m){return Math.sqrt(this.distSqr(m))}distSqr(m){const w=m.x-this.x,P=m.y-this.y;return w*w+P*P}angle(){return Math.atan2(this.y,this.x)}angleTo(m){return Math.atan2(this.y-m.y,this.x-m.x)}angleWith(m){return this.angleWithSep(m.x,m.y)}angleWithSep(m,w){return Math.atan2(this.x*w-this.y*m,this.x*m+this.y*w)}static convert(m){return m instanceof Ys?m:Array.isArray(m)?new Ys(m[0],m[1]):m}}var wg=Object.defineProperty,Ep=Object.getOwnPropertySymbols,Sg=Object.prototype.hasOwnProperty,Tg=Object.prototype.propertyIsEnumerable,Pp=(v,m,w)=>m in v?wg(v,m,{enumerable:!0,configurable:!0,writable:!0,value:w}):v[m]=w,Pa=(v,m)=>{for(var w in m||(m={}))Sg.call(m,w)&&Pp(v,w,m[w]);if(Ep)for(var w of Ep(m))Tg.call(m,w)&&Pp(v,w,m[w]);return v};function _l(v){if(typeof DOMParser<"u"){const m=new DOMParser().parseFromString(v,"application/xml");if(m.querySelector("parsererror"))throw new Error("The provided string is not valid XML");return m}else throw new Error("No XML parser found")}function Xc(v,m){if(!v.hasChildNodes())return!1;for(const w of Array.from(v.childNodes)){const P=w.nodeName;if(typeof P=="string"&&P.trim().toLowerCase()===m.toLowerCase())return!0}return!1}function Yc(v){if(typeof XMLSerializer<"u")return new XMLSerializer().serializeToString(v);throw new Error("No XML serializer found")}function Jc(v){if(typeof v=="string"&&(v=_l(v)),!Xc(v,"gpx"))throw new Error("The XML document is not valid GPX");const m=Ri(v,"trk"),w=Ri(v,"rte"),P=Ri(v,"wpt"),B={type:"FeatureCollection",features:[]};for(const X of Array.from(m)){const ae=Eg(X);ae&&B.features.push(ae)}for(const X of Array.from(w)){const ae=Pg(X);ae&&B.features.push(ae)}for(const X of Array.from(P))B.features.push(kg(X));return B}function Qc(v,m){var w;if(typeof v=="string"&&(v=_l(v)),!Xc(v,"kml"))throw new Error("The XML document is not valid KML");const P={type:"FeatureCollection",features:[]},B={},X={},ae={},l=Ri(v,"Placemark"),he=Ri(v,"Style"),H=Ri(v,"StyleMap");for(const Ae of Array.from(he)){const ke=zp(m!==void 0?m(Ae):Yc(Ae)).toString(16);B["#"+ka(Ae,"id")]=ke,X[ke]=Ae}for(const Ae of Array.from(H)){B["#"+ka(Ae,"id")]=zp(m!==void 0?m(Ae):Yc(Ae)).toString(16);const ke=Ri(Ae,"Pair"),ye={};for(const ct of Array.from(ke))ye[(w=Vt(at(ct,"key")))!=null?w:""]=Vt(at(ct,"styleUrl"));ae["#"+ka(Ae,"id")]=ye}for(const Ae of Array.from(l))P.features=P.features.concat(Cg(Ae,B,X,ae));return P}function kp(v){if(v===null)return["#000000",1];let m="",w=1;return v.substring(0,1)==="#"&&(v=v.substring(1)),(v.length===6||v.length===3)&&(m=v),v.length===8&&(w=parseInt(v.substring(0,2),16)/255,m="#"+v.substring(6,8)+v.substring(4,6)+v.substring(2,4)),[m??"#000000",w??1]}function Ig(v){return Rp(v.split(" "))}function Ag(v){var m;let w=Ri(v,"coord");const P=[],B=[];w.length===0&&(w=Ri(v,"gx:coord"));for(const ae of Array.from(w))P.push(Ig((m=Vt(ae))!=null?m:""));const X=Ri(v,"when");for(const ae of Array.from(X))B.push(Vt(ae));return{coords:P,times:B}}function vl(v){var m,w,P;const B=["Polygon","LineString","Point","Track","gx:Track"];let X,ae,l,he,H;const Ae=[],ke=[];if(at(v,"MultiGeometry")!==null)return vl(at(v,"MultiGeometry"));if(at(v,"MultiTrack")!==null)return vl(at(v,"MultiTrack"));if(at(v,"gx:MultiTrack")!==null)return vl(at(v,"gx:MultiTrack"));for(l=0;l<B.length;l++)if(ae=Ri(v,B[l]),ae){for(he=0;he<ae.length;he++)if(X=ae[he],B[l]==="Point")Ae.push({type:"Point",coordinates:Bp((m=Vt(at(X,"coordinates")))!=null?m:"")});else if(B[l]==="LineString")Ae.push({type:"LineString",coordinates:Fp((w=Vt(at(X,"coordinates")))!=null?w:"")});else if(B[l]==="Polygon"){const ye=Ri(X,"LinearRing"),ct=[];for(H=0;H<ye.length;H++)ct.push(Fp((P=Vt(at(ye[H],"coordinates")))!=null?P:""));Ae.push({type:"Polygon",coordinates:ct})}else if(B[l]==="Track"||B[l]==="gx:Track"){const ye=Ag(X);Ae.push({type:"LineString",coordinates:ye.coords}),ye.times.length&&ke.push(ye.times)}}return{geoms:Ae,coordTimes:ke}}function Cg(v,m,w,P){var B,X,ae,l,he,H,Ae,ke,ye,ct;const dt=vl(v),et={},Tt=Vt(at(v,"name")),it=Vt(at(v,"address")),It=Vt(at(v,"description")),qt=at(v,"TimeSpan"),Jt=at(v,"TimeStamp"),Lt=at(v,"ExtendedData"),ht=at(v,"visibility");let bt,Ke=Vt(at(v,"styleUrl")),_t=at(v,"LineStyle"),qe=at(v,"PolyStyle");if(!dt.geoms.length)return[];if(Tt&&(et.name=Tt),it&&(et.address=it),Ke){Ke[0]!=="#"&&(Ke="#"+Ke),et.styleUrl=Ke,m[Ke]&&(et.styleHash=m[Ke]),P[Ke]&&(et.styleMapHash=P[Ke],et.styleHash=m[(B=P[Ke].normal)!=null?B:""]);const Qe=w[(X=et.styleHash)!=null?X:""];if(Qe){_t||(_t=at(Qe,"LineStyle")),qe||(qe=at(Qe,"PolyStyle"));const ot=at(Qe,"IconStyle");if(ot){const rt=at(ot,"Icon");if(rt){const gt=Vt(at(rt,"href"));gt&&(et.icon=gt)}}}}if(It&&(et.description=It),qt){const Qe=Vt(at(qt,"begin")),ot=Vt(at(qt,"end"));Qe&&ot&&(et.timespan={begin:Qe,end:ot})}if(Jt!==null&&(et.timestamp=(ae=Vt(at(Jt,"when")))!=null?ae:new Date().toISOString()),_t!==null){const Qe=kp(Vt(at(_t,"color"))),ot=Qe[0],rt=Qe[1],gt=parseFloat((l=Vt(at(_t,"width")))!=null?l:"");ot&&(et.stroke=ot),isNaN(rt)||(et["stroke-opacity"]=rt),isNaN(gt)||(et["stroke-width"]=gt)}if(qe){const Qe=kp(Vt(at(qe,"color"))),ot=Qe[0],rt=Qe[1],gt=Vt(at(qe,"fill")),Rt=Vt(at(qe,"outline"));ot&&(et.fill=ot),isNaN(rt)||(et["fill-opacity"]=rt),gt&&(et["fill-opacity"]=gt==="1"?et["fill-opacity"]||1:0),Rt&&(et["stroke-opacity"]=Rt==="1"?et["stroke-opacity"]||1:0)}if(Lt){const Qe=Ri(Lt,"Data"),ot=Ri(Lt,"SimpleData");for(bt=0;bt<Qe.length;bt++)et[(he=Qe[bt].getAttribute("name"))!=null?he:""]=(H=Vt(at(Qe[bt],"value")))!=null?H:"";for(bt=0;bt<ot.length;bt++)et[(Ae=ot[bt].getAttribute("name"))!=null?Ae:""]=(ke=Vt(ot[bt]))!=null?ke:""}ht!==null&&(et.visibility=(ye=Vt(ht))!=null?ye:""),dt.coordTimes.length!==0&&(et.coordTimes=dt.coordTimes.length===1?dt.coordTimes[0]:dt.coordTimes);const jt={type:"Feature",geometry:dt.geoms.length===1?dt.geoms[0]:{type:"GeometryCollection",geometries:dt.geoms},properties:et};return ka(v,"id")&&(jt.id=(ct=ka(v,"id"))!=null?ct:void 0),[jt]}function Mp(v,m){const w=Ri(v,m),P=[],B=[];let X=[];const ae=w.length;if(!(ae<2)){for(let l=0;l<ae;l++){const he=Op(w[l]);P.push(he.coordinates),he.time&&B.push(he.time),(he.heartRate||X.length)&&(X.length===0&&(X=new Array(l).fill(null)),X.push(he.heartRate))}return{line:P,times:B,heartRates:X}}}function Eg(v){const m=Ri(v,"trkseg"),w=[],P=[],B=[];let X;for(let l=0;l<m.length;l++)if(X=Mp(m[l],"trkpt"),X!==void 0&&(X.line&&w.push(X.line),X.times&&X.times.length&&P.push(X.times),B.length||X.heartRates&&X.heartRates.length)){if(!B.length)for(let he=0;he<l;he++)B.push(new Array(w[he].length).fill(null));X.heartRates&&X.heartRates.length?B.push(X.heartRates):B.push(new Array(X.line.length).fill(null))}if(w.length===0)return;const ae=Pa(Pa({},eh(v)),Lp(at(v,"extensions")));return P.length!==0&&(ae.coordTimes=w.length===1?P[0]:P),B.length!==0&&(ae.heartRates=w.length===1?B[0]:B),w.length===1?{type:"Feature",properties:ae,geometry:{type:"LineString",coordinates:w[0]}}:{type:"Feature",properties:ae,geometry:{type:"MultiLineString",coordinates:w}}}function Pg(v){const m=Mp(v,"rtept");return m===void 0?void 0:{type:"Feature",properties:Pa(Pa({},eh(v)),Lp(at(v,"extensions"))),geometry:{type:"LineString",coordinates:m.line}}}function kg(v){return{type:"Feature",properties:Pa(Pa({},eh(v)),th(v,["sym"])),geometry:{type:"Point",coordinates:Op(v).coordinates}}}function Lp(v){var m,w;const P={};if(v){const B=at(v,"line");if(B){const X=Vt(at(B,"color")),ae=parseFloat((m=Vt(at(B,"opacity")))!=null?m:"0"),l=parseFloat((w=Vt(at(B,"width")))!=null?w:"0");X&&(P.stroke=X),isNaN(ae)||(P["stroke-opacity"]=ae),isNaN(l)||(P["stroke-width"]=l*96/25.4)}}return P}function eh(v){const m=th(v,["name","cmt","desc","type","time","keywords"]),w=Ri(v,"link");if(w.length!==0){m.links=[];for(const P of Array.from(w)){const B=Pa({href:ka(P,"href")},th(P,["text","type"]));m.links.push(B)}}return m}function zp(v){let m=0;if(!v||!v.length)return m;for(let w=0;w<v.length;w++)m=(m<<5)-m+v.charCodeAt(w)|0;return m}function Ri(v,m){return v.getElementsByTagName(m)}function ka(v,m){return v.getAttribute(m)}function Dp(v,m){var w;return parseFloat((w=ka(v,m))!=null?w:"0")}function at(v,m){const w=Ri(v,m);return w.length?w[0]:null}function Mg(v){return v.normalize&&v.normalize(),v}function Rp(v){return v.map(parseFloat).map(m=>isNaN(m)?null:m)}function Vt(v){return v&&Mg(v),v&&v.textContent}function th(v,m){var w;const P={};let B,X;for(X=0;X<m.length;X++)B=at(v,m[X]),B&&(P[m[X]]=(w=Vt(B))!=null?w:"");return P}function Bp(v){return Rp(v.replace(/\s*/g,"").split(","))}function Fp(v){const m=v.replace(/^\s*|\s*$/g,"").split(/\s+/),w=[];for(const P of m)w.push(Bp(P));return w}function Op(v){var m,w;const P=[Dp(v,"lon"),Dp(v,"lat")],B=at(v,"ele"),X=at(v,"gpxtpx:hr")||at(v,"hr"),ae=at(v,"time");let l;return B&&(l=parseFloat((m=Vt(B))!=null?m:"0"),isNaN(l)||P.push(l)),{coordinates:P,time:ae?Vt(ae):null,heartRate:X!==null?parseFloat((w=Vt(X))!=null?w:"0"):null}}function Np(v){try{typeof v=="string"&&(v=_l(v))}catch{return null}try{return Jc(v)}catch{}try{return Qc(v)}catch{}return null}var Lg=Object.defineProperty,zg=(v,m,w)=>m in v?Lg(v,m,{enumerable:!0,configurable:!0,writable:!0,value:w}):v[m]=w,Up=(v,m,w)=>(zg(v,typeof m!="symbol"?m+"":m,w),w);function xl(v){const m=v.toString(16);return m.length==1?"0"+m:m}function Dg(v){return"#"+xl(v[0])+xl(v[1])+xl(v[2])+(v.length===4?xl(v[3]):"")}class We extends Array{constructor(m={}){super(),Up(this,"min",0),Up(this,"max",1),"min"in m&&(this.min=m.min),"max"in m&&(this.max=m.max),"stops"in m&&this.setStops(m.stops,{clone:!1})}static fromArrayDefinition(m){return new We({stops:m.map(w=>({value:w[0],color:w[1]}))})}setStops(m,w={clone:!0}){const P=w.clone?this.clone():this;P.length=0;let B=1/0,X=-1/0;for(let ae=0;ae<m.length;ae+=1)B=Math.min(B,m[ae].value),X=Math.max(X,m[ae].value),P.push({value:m[ae].value,color:m[ae].color.slice()});return P.sort((ae,l)=>ae.value<l.value?-1:1),this.min=B,this.max=X,P}scale(m,w,P={clone:!0}){const B=P.clone,X=this[0].value,ae=this.at(-1).value-X,l=w-m,he=[];for(let H=0;H<this.length;H+=1){const Ae=(this[H].value-X)/ae*l+m;B?he.push({value:Ae,color:this[H].color.slice()}):this[H].value=Ae}return B?new We({stops:he}):this}at(m){return m<0?this[this.length+m]:this[m]}clone(){return new We({stops:this.getRawColorStops()})}getRawColorStops(){const m=[];for(let w=0;w<this.length;w+=1)m.push({value:this[w].value,color:this[w].color});return m}reverse(m={clone:!0}){const w=m.clone?this.clone():this;for(let P=0;P<~~(w.length/2);P+=1){const B=w[P].color;w[P].color=w.at(-(P+1)).color,w.at(-(P+1)).color=B}return w}getBounds(){return{min:this.min,max:this.max}}getColor(m,w={smooth:!0}){if(m<=this[0].value)return this[0].color;if(m>=this.at(-1).value)return this.at(-1).color;for(let P=0;P<this.length-1;P+=1){if(m>this[P+1].value)continue;const B=this[P].color;if(!w.smooth)return B.slice();const X=this[P].value,ae=this[P+1].value,l=this[P+1].color,he=(ae-m)/(ae-X);return B.map((H,Ae)=>Math.round(H*he+l[Ae]*(1-he)))}return[0,0,0]}getColorHex(m,w={smooth:!0,withAlpha:!1}){return Dg(this.getColor(m,w))}getColorRelative(m,w={smooth:!0}){const P=this.getBounds();return this.getColor(P.min+m*(P.max-P.min),w)}getCanvasStrip(m={horizontal:!0,size:512,smooth:!0}){const w=document.createElement("canvas");w.width=m.horizontal?m.size:1,w.height=m.horizontal?1:m.size;const P=w.getContext("2d");if(!P)throw new Error("Canvs context is missing");const B=P.getImageData(0,0,w.width,w.height),X=B.data,ae=m.size,l=this[0].value,he=(this.at(-1).value-l)/ae;for(let H=0;H<ae;H+=1){const Ae=this.getColor(l+H*he,{smooth:m.smooth});X[H*4]=Ae[0],X[H*4+1]=Ae[1],X[H*4+2]=Ae[2],X[H*4+3]=Ae.length>3?Ae[3]:255}return P.putImageData(B,0,0),w}resample(m,w=15){const P=this.getBounds(),B=this.scale(0,1),X=1/(w-1);let ae;if(m==="ease-in-square")ae=Array.from({length:w},(l,he)=>{const H=he*X,Ae=Math.pow(H,2),ke=B.getColor(Ae);return{value:H,color:ke}});else if(m==="ease-out-square")ae=Array.from({length:w},(l,he)=>{const H=he*X,Ae=1-Math.pow(1-H,2),ke=B.getColor(Ae);return{value:H,color:ke}});else if(m==="ease-out-sqrt")ae=Array.from({length:w},(l,he)=>{const H=he*X,Ae=Math.pow(H,.5),ke=B.getColor(Ae);return{value:H,color:ke}});else if(m==="ease-in-sqrt")ae=Array.from({length:w},(l,he)=>{const H=he*X,Ae=1-Math.pow(1-H,.5),ke=B.getColor(Ae);return{value:H,color:ke}});else if(m==="ease-out-exp")ae=Array.from({length:w},(l,he)=>{const H=he*X,Ae=1-Math.pow(2,-10*H),ke=B.getColor(Ae);return{value:H,color:ke}});else if(m==="ease-in-exp")ae=Array.from({length:w},(l,he)=>{const H=he*X,Ae=Math.pow(2,10*H-10),ke=B.getColor(Ae);return{value:H,color:ke}});else throw new Error("Invalid ressampling method.");return new We({stops:ae}).scale(P.min,P.max)}transparentStart(){const m=this.getRawColorStops();return m.unshift({value:m[0].value,color:m[0].color.slice()}),m[1].value+=.001,m.forEach(w=>{w.color.length===3&&w.color.push(255)}),m[0].color[3]=0,new We({stops:m})}hasTransparentStart(){return this[0].color.length===4&&this[0].color[3]===0}}const ih={NULL:new We({stops:[{value:0,color:[0,0,0,0]},{value:1,color:[0,0,0,0]}]}),GRAY:new We({stops:[{value:0,color:[0,0,0]},{value:1,color:[255,255,255]}]}),JET:new We({stops:[{value:0,color:[0,0,131]},{value:.125,color:[0,60,170]},{value:.375,color:[5,255,255]},{value:.625,color:[255,255,0]},{value:.875,color:[250,0,0]},{value:1,color:[128,0,0]}]}),HSV:new We({stops:[{value:0,color:[255,0,0]},{value:.169,color:[253,255,2]},{value:.173,color:[247,255,2]},{value:.337,color:[0,252,4]},{value:.341,color:[0,252,10]},{value:.506,color:[1,249,255]},{value:.671,color:[2,0,253]},{value:.675,color:[8,0,253]},{value:.839,color:[255,0,251]},{value:.843,color:[255,0,245]},{value:1,color:[255,0,6]}]}),HOT:new We({stops:[{value:0,color:[0,0,0]},{value:.3,color:[230,0,0]},{value:.6,color:[255,210,0]},{value:1,color:[255,255,255]}]}),SPRING:new We({stops:[{value:0,color:[255,0,255]},{value:1,color:[255,255,0]}]}),SUMMER:new We({stops:[{value:0,color:[0,128,102]},{value:1,color:[255,255,102]}]}),AUTOMN:new We({stops:[{value:0,color:[255,0,0]},{value:1,color:[255,255,0]}]}),WINTER:new We({stops:[{value:0,color:[0,0,255]},{value:1,color:[0,255,128]}]}),BONE:new We({stops:[{value:0,color:[0,0,0]},{value:.376,color:[84,84,116]},{value:.753,color:[169,200,200]},{value:1,color:[255,255,255]}]}),COPPER:new We({stops:[{value:0,color:[0,0,0]},{value:.804,color:[255,160,102]},{value:1,color:[255,199,127]}]}),GREYS:new We({stops:[{value:0,color:[0,0,0]},{value:1,color:[255,255,255]}]}),YIGNBU:new We({stops:[{value:0,color:[8,29,88]},{value:.125,color:[37,52,148]},{value:.25,color:[34,94,168]},{value:.375,color:[29,145,192]},{value:.5,color:[65,182,196]},{value:.625,color:[127,205,187]},{value:.75,color:[199,233,180]},{value:.875,color:[237,248,217]},{value:1,color:[255,255,217]}]}),GREENS:new We({stops:[{value:0,color:[0,68,27]},{value:.125,color:[0,109,44]},{value:.25,color:[35,139,69]},{value:.375,color:[65,171,93]},{value:.5,color:[116,196,118]},{value:.625,color:[161,217,155]},{value:.75,color:[199,233,192]},{value:.875,color:[229,245,224]},{value:1,color:[247,252,245]}]}),YIORRD:new We({stops:[{value:0,color:[128,0,38]},{value:.125,color:[189,0,38]},{value:.25,color:[227,26,28]},{value:.375,color:[252,78,42]},{value:.5,color:[253,141,60]},{value:.625,color:[254,178,76]},{value:.75,color:[254,217,118]},{value:.875,color:[255,237,160]},{value:1,color:[255,255,204]}]}),BLUERED:new We({stops:[{value:0,color:[0,0,255]},{value:1,color:[255,0,0]}]}),RDBU:new We({stops:[{value:0,color:[5,10,172]},{value:.35,color:[106,137,247]},{value:.5,color:[190,190,190]},{value:.6,color:[220,170,132]},{value:.7,color:[230,145,90]},{value:1,color:[178,10,28]}]}),PICNIC:new We({stops:[{value:0,color:[0,0,255]},{value:.1,color:[51,153,255]},{value:.2,color:[102,204,255]},{value:.3,color:[153,204,255]},{value:.4,color:[204,204,255]},{value:.5,color:[255,255,255]},{value:.6,color:[255,204,255]},{value:.7,color:[255,153,255]},{value:.8,color:[255,102,204]},{value:.9,color:[255,102,102]},{value:1,color:[255,0,0]}]}),RAINBOW:new We({stops:[{value:0,color:[150,0,90]},{value:.125,color:[0,0,200]},{value:.25,color:[0,25,255]},{value:.375,color:[0,152,255]},{value:.5,color:[44,255,150]},{value:.625,color:[151,255,0]},{value:.75,color:[255,234,0]},{value:.875,color:[255,111,0]},{value:1,color:[255,0,0]}]}),PORTLAND:new We({stops:[{value:0,color:[12,51,131]},{value:.25,color:[10,136,186]},{value:.5,color:[242,211,56]},{value:.75,color:[242,143,56]},{value:1,color:[217,30,30]}]}),BLACKBODY:new We({stops:[{value:0,color:[0,0,0]},{value:.2,color:[230,0,0]},{value:.4,color:[230,210,0]},{value:.7,color:[255,255,255]},{value:1,color:[160,200,255]}]}),EARTH:new We({stops:[{value:0,color:[0,0,130]},{value:.1,color:[0,180,180]},{value:.2,color:[40,210,40]},{value:.4,color:[230,230,50]},{value:.6,color:[120,70,20]},{value:1,color:[255,255,255]}]}),ELECTRIC:new We({stops:[{value:0,color:[0,0,0]},{value:.15,color:[30,0,100]},{value:.4,color:[120,0,100]},{value:.6,color:[160,90,0]},{value:.8,color:[230,200,0]},{value:1,color:[255,250,220]}]}),VIRIDIS:new We({stops:[{value:0,color:[68,1,84]},{value:.13,color:[71,44,122]},{value:.25,color:[59,81,139]},{value:.38,color:[44,113,142]},{value:.5,color:[33,144,141]},{value:.63,color:[39,173,129]},{value:.75,color:[92,200,99]},{value:.88,color:[170,220,50]},{value:1,color:[253,231,37]}]}),INFERNO:new We({stops:[{value:0,color:[0,0,4]},{value:.13,color:[31,12,72]},{value:.25,color:[85,15,109]},{value:.38,color:[136,34,106]},{value:.5,color:[186,54,85]},{value:.63,color:[227,89,51]},{value:.75,color:[249,140,10]},{value:.88,color:[249,201,50]},{value:1,color:[252,255,164]}]}),MAGMA:new We({stops:[{value:0,color:[0,0,4]},{value:.13,color:[28,16,68]},{value:.25,color:[79,18,123]},{value:.38,color:[129,37,129]},{value:.5,color:[181,54,122]},{value:.63,color:[229,80,100]},{value:.75,color:[251,135,97]},{value:.88,color:[254,194,135]},{value:1,color:[252,253,191]}]}),PLASMA:new We({stops:[{value:0,color:[13,8,135]},{value:.13,color:[75,3,161]},{value:.25,color:[125,3,168]},{value:.38,color:[168,34,150]},{value:.5,color:[203,70,121]},{value:.63,color:[229,107,93]},{value:.75,color:[248,148,65]},{value:.88,color:[253,195,40]},{value:1,color:[240,249,33]}]}),WARM:new We({stops:[{value:0,color:[125,0,179]},{value:.13,color:[172,0,187]},{value:.25,color:[219,0,170]},{value:.38,color:[255,0,130]},{value:.5,color:[255,63,74]},{value:.63,color:[255,123,0]},{value:.75,color:[234,176,0]},{value:.88,color:[190,228,0]},{value:1,color:[147,255,0]}]}),COOL:new We({stops:[{value:0,color:[125,0,179]},{value:.13,color:[116,0,218]},{value:.25,color:[98,74,237]},{value:.38,color:[68,146,231]},{value:.5,color:[0,204,197]},{value:.63,color:[0,247,146]},{value:.75,color:[0,255,88]},{value:.88,color:[40,255,8]},{value:1,color:[147,255,0]}]}),RAINBOW_SOFT:new We({stops:[{value:0,color:[125,0,179]},{value:.1,color:[199,0,180]},{value:.2,color:[255,0,121]},{value:.3,color:[255,108,0]},{value:.4,color:[222,194,0]},{value:.5,color:[150,255,0]},{value:.6,color:[0,255,55]},{value:.7,color:[0,246,150]},{value:.8,color:[50,167,222]},{value:.9,color:[103,51,235]},{value:1,color:[124,0,186]}]}),BATHYMETRY:new We({stops:[{value:0,color:[40,26,44]},{value:.13,color:[59,49,90]},{value:.25,color:[64,76,139]},{value:.38,color:[63,110,151]},{value:.5,color:[72,142,158]},{value:.63,color:[85,174,163]},{value:.75,color:[120,206,163]},{value:.88,color:[187,230,172]},{value:1,color:[253,254,204]}]}),CDOM:new We({stops:[{value:0,color:[47,15,62]},{value:.13,color:[87,23,86]},{value:.25,color:[130,28,99]},{value:.38,color:[171,41,96]},{value:.5,color:[206,67,86]},{value:.63,color:[230,106,84]},{value:.75,color:[242,149,103]},{value:.88,color:[249,193,135]},{value:1,color:[254,237,176]}]}),CHLOROPHYLL:new We({stops:[{value:0,color:[18,36,20]},{value:.13,color:[25,63,41]},{value:.25,color:[24,91,59]},{value:.38,color:[13,119,72]},{value:.5,color:[18,148,80]},{value:.63,color:[80,173,89]},{value:.75,color:[132,196,122]},{value:.88,color:[175,221,162]},{value:1,color:[215,249,208]}]}),DENSITY:new We({stops:[{value:0,color:[54,14,36]},{value:.13,color:[89,23,80]},{value:.25,color:[110,45,132]},{value:.38,color:[120,77,178]},{value:.5,color:[120,113,213]},{value:.63,color:[115,151,228]},{value:.75,color:[134,185,227]},{value:.88,color:[177,214,227]},{value:1,color:[230,241,241]}]}),FREESURFACE_BLUE:new We({stops:[{value:0,color:[30,4,110]},{value:.13,color:[47,14,176]},{value:.25,color:[41,45,236]},{value:.38,color:[25,99,212]},{value:.5,color:[68,131,200]},{value:.63,color:[114,156,197]},{value:.75,color:[157,181,203]},{value:.88,color:[200,208,216]},{value:1,color:[241,237,236]}]}),FREESURFACE_RED:new We({stops:[{value:0,color:[60,9,18]},{value:.13,color:[100,17,27]},{value:.25,color:[142,20,29]},{value:.38,color:[177,43,27]},{value:.5,color:[192,87,63]},{value:.63,color:[205,125,105]},{value:.75,color:[216,162,148]},{value:.88,color:[227,199,193]},{value:1,color:[241,237,236]}]}),OXYGEN:new We({stops:[{value:0,color:[64,5,5]},{value:.13,color:[106,6,15]},{value:.25,color:[144,26,7]},{value:.38,color:[168,64,3]},{value:.5,color:[188,100,4]},{value:.63,color:[206,136,11]},{value:.75,color:[220,174,25]},{value:.88,color:[231,215,44]},{value:1,color:[248,254,105]}]}),PAR:new We({stops:[{value:0,color:[51,20,24]},{value:.13,color:[90,32,35]},{value:.25,color:[129,44,34]},{value:.38,color:[159,68,25]},{value:.5,color:[182,99,19]},{value:.63,color:[199,134,22]},{value:.75,color:[212,171,35]},{value:.88,color:[221,210,54]},{value:1,color:[225,253,75]}]}),PHASE:new We({stops:[{value:0,color:[145,105,18]},{value:.13,color:[184,71,38]},{value:.25,color:[186,58,115]},{value:.38,color:[160,71,185]},{value:.5,color:[110,97,218]},{value:.63,color:[50,123,164]},{value:.75,color:[31,131,110]},{value:.88,color:[77,129,34]},{value:1,color:[145,105,18]}]}),SALINITY:new We({stops:[{value:0,color:[42,24,108]},{value:.13,color:[33,50,162]},{value:.25,color:[15,90,145]},{value:.38,color:[40,118,137]},{value:.5,color:[59,146,135]},{value:.63,color:[79,175,126]},{value:.75,color:[120,203,104]},{value:.88,color:[193,221,100]},{value:1,color:[253,239,154]}]}),TEMPERATURE:new We({stops:[{value:0,color:[4,35,51]},{value:.13,color:[23,51,122]},{value:.25,color:[85,59,157]},{value:.38,color:[129,79,143]},{value:.5,color:[175,95,130]},{value:.63,color:[222,112,101]},{value:.75,color:[249,146,66]},{value:.88,color:[249,196,65]},{value:1,color:[232,250,91]}]}),TURBIDITY:new We({stops:[{value:0,color:[34,31,27]},{value:.13,color:[65,50,41]},{value:.25,color:[98,69,52]},{value:.38,color:[131,89,57]},{value:.5,color:[161,112,59]},{value:.63,color:[185,140,66]},{value:.75,color:[202,174,88]},{value:.88,color:[216,209,126]},{value:1,color:[233,246,171]}]}),VELOCITY_BLUE:new We({stops:[{value:0,color:[17,32,64]},{value:.13,color:[35,52,116]},{value:.25,color:[29,81,156]},{value:.38,color:[31,113,162]},{value:.5,color:[50,144,169]},{value:.63,color:[87,173,176]},{value:.75,color:[149,196,189]},{value:.88,color:[203,221,211]},{value:1,color:[254,251,230]}]}),VELOCITY_GREEN:new We({stops:[{value:0,color:[23,35,19]},{value:.13,color:[24,64,38]},{value:.25,color:[11,95,45]},{value:.38,color:[39,123,35]},{value:.5,color:[95,146,12]},{value:.63,color:[152,165,18]},{value:.75,color:[201,186,69]},{value:.88,color:[233,216,137]},{value:1,color:[255,253,205]}]}),CUBEHELIX:new We({stops:[{value:0,color:[0,0,0]},{value:.07,color:[22,5,59]},{value:.13,color:[60,4,105]},{value:.2,color:[109,1,135]},{value:.27,color:[161,0,147]},{value:.33,color:[210,2,142]},{value:.4,color:[251,11,123]},{value:.47,color:[255,29,97]},{value:.53,color:[255,54,69]},{value:.6,color:[255,85,46]},{value:.67,color:[255,120,34]},{value:.73,color:[255,157,37]},{value:.8,color:[241,191,57]},{value:.87,color:[224,220,93]},{value:.93,color:[218,241,142]},{value:1,color:[227,253,198]}]}),CIVIDIS:new We({stops:[{value:0,color:[0,32,77,255]},{value:.125,color:[5,54,110,255]},{value:.25,color:[65,77,108,255]},{value:.375,color:[97,100,111,255]},{value:.5,color:[125,124,121,255]},{value:.625,color:[156,149,120,255]},{value:.75,color:[190,175,111,255]},{value:.875,color:[225,204,94,255]},{value:1,color:[255,235,70,255]}]}),TURBO:new We({stops:[{value:0,color:[48,18,59,255]},{value:.125,color:[70,107,227,255]},{value:.25,color:[40,187,236,255]},{value:.375,color:[49,242,153,255]},{value:.5,color:[162,252,60,255]},{value:.625,color:[237,208,58,255]},{value:.75,color:[251,128,34,255]},{value:.875,color:[210,49,5,255]},{value:1,color:[122,4,3,255]}]}),ROCKET:new We({stops:[{value:0,color:[250,235,221,0]},{value:.133,color:[250,235,221,255]},{value:.266,color:[246,170,130,255]},{value:.4,color:[240,96,67,255]},{value:.533,color:[203,27,79,255]},{value:.666,color:[132,30,90,255]},{value:.8,color:[63,27,68,255]},{value:1,color:[3,5,26,255]}]}),MAKO:new We({stops:[{value:0,color:[11,4,5,255]},{value:.125,color:[43,28,53,255]},{value:.25,color:[62,53,107,255]},{value:.375,color:[59,86,152,255]},{value:.5,color:[53,123,162,255]},{value:.625,color:[53,158,170,255]},{value:.75,color:[73,193,173,255]},{value:.875,color:[150,221,181,255]},{value:1,color:[222,245,229,255]}]})},Vp=[["#1D5B79","#468B97","#EF6262","#F3AA60"],["#614BC3","#33BBC5","#85E6C5","#C8FFE0"],["#461959","#7A316F","#CD6688","#AED8CC"],["#0079FF","#00DFA2","#F6FA70","#FF0060"],["#39B5E0","#A31ACB","#FF78F0","#F5EA5A"],["#37E2D5","#590696","#C70A80","#FBCB0A"],["#FFD36E","#FFF56D","#99FFCD","#9FB4FF"],["#00EAD3","#FFF5B7","#FF449F","#005F99"],["#10A19D","#540375","#FF7000","#FFBF00"]];function rh(){return Vp[~~(Math.random()*Vp.length)][~~(Math.random()*4)]}function bl(){return`maptiler_source_${sp()}`}function wl(){return`maptiler_layer_${sp()}`}function $p(v,m){if(m<=v[0].zoom)return v[0].value;if(m>=v[v.length-1].zoom)return v[v.length-1].value;for(let w=0;w<v.length-1;w+=1)if(m>=v[w].zoom&&m<v[w+1].zoom){const P=v[w+1].zoom-v[w].zoom,B=(m-v[w].zoom)/P;return B*v[w+1].value+(1-B)*v[w].value}return 0}function Ma(v){return["interpolate",["linear"],["zoom"],...v.map(m=>[m.zoom,m.value]).flat()]}function $t(v){return["interpolate",["linear"],["zoom"],...v.map(m=>[m.zoom,m.value]).flat()]}function Rg(v,m){if(typeof m=="number"&&typeof v=="number")return 2*m+v;if(typeof m=="number"&&Array.isArray(v))return["interpolate",["linear"],["zoom"],...v.map(w=>[w.zoom,2*m+w.value]).flat()];if(typeof v=="number"&&Array.isArray(m))return["interpolate",["linear"],["zoom"],...m.map(w=>[w.zoom,2*w.value+v]).flat()];if(Array.isArray(v)&&Array.isArray(m)){const w=Array.from(new Set([...v.map(P=>P.zoom),...m.map(P=>P.zoom)])).sort((P,B)=>P<B?-1:1);return["interpolate",["linear"],["zoom"],...w.map(P=>[P,2*$p(m,P)+$p(v,P)]).flat()]}return 0}function Bg(v,m){return["interpolate",["linear"],["get",m],...v.map(w=>[w.propertyValue,w.value]).flat()]}function jp(v){const m=v.trimStart(),w=`${m}${" ".repeat(v.length-m.length)}`,P=Array.from(w);if(!P.every(X=>X===" "||X==="_"))throw new Error("A dash pattern must be composed only of whitespace and underscore characters.");if(!(P.some(X=>X==="_")&&P.some(X=>X===" ")))throw new Error("A dash pattern must contain at least one underscore and one whitespace character");const B=[1];for(let X=1;X<P.length;X+=1){const ae=P[X-1],l=P[X];ae===l?B[B.length-1]+=1:B.push(1)}return B}function Gp(v,m){return["interpolate",["linear"],["get",m],...v.map(w=>[w.value,w.color]).flat()]}function qp(v,m,w=!0){return w?["interpolate",["linear"],["zoom"],0,["interpolate",["linear"],["get",m],...v.map(P=>[P.value,P.pointRadius*.025]).flat()],2,["interpolate",["linear"],["get",m],...v.map(P=>[P.value,P.pointRadius*.05]).flat()],4,["interpolate",["linear"],["get",m],...v.map(P=>[P.value,P.pointRadius*.1]).flat()],8,["interpolate",["linear"],["get",m],...v.map(P=>[P.value,P.pointRadius*.25]).flat()],16,["interpolate",["linear"],["get",m],...v.map(P=>[P.value,P.pointRadius]).flat()]]:["interpolate",["linear"],["get",m],...v.map(P=>[P.value,P.pointRadius]).flat()]}function Fg(v,m,w=!0){return w?["interpolate",["linear"],["zoom"],0,["interpolate",["linear"],["get",m],...v.map(P=>[P.propertyValue,P.value*.025]).flat()],2,["interpolate",["linear"],["get",m],...v.map(P=>[P.propertyValue,P.value*.05]).flat()],4,["interpolate",["linear"],["get",m],...v.map(P=>[P.propertyValue,P.value*.1]).flat()],8,["interpolate",["linear"],["get",m],...v.map(P=>[P.propertyValue,P.value*.25]).flat()],16,["interpolate",["linear"],["get",m],...v.map(P=>[P.propertyValue,P.value]).flat()]]:["interpolate",["linear"],["get",m],...v.map(P=>[P.propertyValue,P.value]).flat()]}function Zp(v,m){return v.every(w=>w.color[3]===v[0].color[3])?v[0].color[3]?v[0].color[3]/255:1:["interpolate",["linear"],["get",m],...v.getRawColorStops().map(w=>{const P=w.value,B=w.color;return[P,B.length===4?B[3]/255:1]}).flat()]}function Og(v,m=10){return["interpolate",["linear"],["heatmap-density"],...Array.from({length:m+1},(w,P)=>{const B=P/m;return[B,v.getColorHex(B)]}).flat()]}var Ng=Object.defineProperty,Ug=Object.defineProperties,Vg=Object.getOwnPropertyDescriptors,Hp=Object.getOwnPropertySymbols,$g=Object.prototype.hasOwnProperty,jg=Object.prototype.propertyIsEnumerable,Wp=(v,m,w)=>m in v?Ng(v,m,{enumerable:!0,configurable:!0,writable:!0,value:w}):v[m]=w,La=(v,m)=>{for(var w in m||(m={}))$g.call(m,w)&&Wp(v,w,m[w]);if(Hp)for(var w of Hp(m))jg.call(m,w)&&Wp(v,w,m[w]);return v},Gg=(v,m)=>Ug(v,Vg(m)),qg=(v,m,w)=>new Promise((P,B)=>{var X=he=>{try{l(w.next(he))}catch(H){B(H)}},ae=he=>{try{l(w.throw(he))}catch(H){B(H)}},l=he=>he.done?P(he.value):Promise.resolve(he.value).then(X,ae);l((w=w.apply(v,m)).next())});function Zg(v,m){return qg(this,arguments,function*(w,P,B={}){var X,ae,l;if(!P.sourceId&&!P.data)throw new Error("Creating a polyline layer requires an existing .sourceId or a valid .data property");let he=P.data;if(typeof he=="string"){if(fl(he))he=`https://api.maptiler.com/data/${P.data}/features.json?key=${_r.apiKey}`;else if(((X=he.split(".").pop())==null?void 0:X.toLowerCase().trim())==="gpx"){const H=yield(yield fetch(he,B)).text();he=Jc(H)}else if(((ae=he.split(".").pop())==null?void 0:ae.toLowerCase().trim())==="kml"){const H=yield(yield fetch(he,B)).text();he=Qc(H)}else{const H=(l=Bf(he))!=null?l:Np(he);H&&(he=H)}if(!he)throw new Error("Polyline data was provided as string but is incompatible with valid formats.")}return Hg(w,Gg(La({},P),{data:he}))})}function Hg(v,m){var w,P,B,X,ae,l,he,H,Ae,ke,ye,ct,dt,et,Tt,it,It,qt,Jt,Lt;if(m.layerId&&v.getLayer(m.layerId))throw new Error(`A layer already exists with the layer id: ${m.layerId}`);const ht=(w=m.sourceId)!=null?w:bl(),bt=(P=m.layerId)!=null?P:wl(),Ke={polylineLayerId:bt,polylineOutlineLayerId:"",polylineSourceId:ht};m.data&&!v.getSource(ht)&&v.addSource(ht,{type:"geojson",data:m.data});const _t=(B=m.lineWidth)!=null?B:3,qe=(X=m.lineColor)!=null?X:rh(),jt=(ae=m.lineOpacity)!=null?ae:1,Qe=(l=m.lineBlur)!=null?l:0,ot=(he=m.lineGapWidth)!=null?he:0;let rt=(H=m.lineDashArray)!=null?H:null;const gt=(Ae=m.outlineWidth)!=null?Ae:1,Rt=(ke=m.outlineColor)!=null?ke:"#FFFFFF",Ot=(ye=m.outlineOpacity)!=null?ye:1,ai=(ct=m.outlineBlur)!=null?ct:0;if(typeof rt=="string"&&(rt=jp(rt)),m.outline===!0){const Pi=`${bt}_outline`;Ke.polylineOutlineLayerId=Pi,v.addLayer({id:Pi,type:"line",source:ht,layout:{"line-join":(dt=m.lineJoin)!=null?dt:"round","line-cap":(et=m.lineCap)!=null?et:"round"},minzoom:(Tt=m.minzoom)!=null?Tt:0,maxzoom:(it=m.maxzoom)!=null?it:23,paint:{"line-opacity":typeof Ot=="number"?Ot:$t(Ot),"line-color":typeof Rt=="string"?Rt:Ma(Rt),"line-width":Rg(_t,gt),"line-blur":typeof ai=="number"?ai:$t(ai)}},m.beforeId)}return v.addLayer({id:bt,type:"line",source:ht,layout:{"line-join":(It=m.lineJoin)!=null?It:"round","line-cap":(qt=m.lineCap)!=null?qt:"round"},minzoom:(Jt=m.minzoom)!=null?Jt:0,maxzoom:(Lt=m.maxzoom)!=null?Lt:23,paint:La({"line-opacity":typeof jt=="number"?jt:$t(jt),"line-color":typeof qe=="string"?qe:Ma(qe),"line-width":typeof _t=="number"?_t:$t(_t),"line-blur":typeof Qe=="number"?Qe:$t(Qe),"line-gap-width":typeof ot=="number"?ot:$t(ot)},rt&&{"line-dasharray":rt})},m.beforeId),Ke}function Wg(v,m){var w,P,B,X,ae,l,he,H,Ae,ke,ye;if(m.layerId&&v.getLayer(m.layerId))throw new Error(`A layer already exists with the layer id: ${m.layerId}`);const ct=(w=m.sourceId)!=null?w:bl(),dt=(P=m.layerId)!=null?P:wl(),et={polygonLayerId:dt,polygonOutlineLayerId:m.outline?`${dt}_outline`:"",polygonSourceId:ct};if(m.data&&!v.getSource(ct)){let qe=m.data;typeof qe=="string"&&fl(qe)&&(qe=`https://api.maptiler.com/data/${qe}/features.json?key=${_r.apiKey}`),v.addSource(ct,{type:"geojson",data:qe})}let Tt=(B=m.outlineDashArray)!=null?B:null;const it=(X=m.outlineWidth)!=null?X:1,It=(ae=m.outlineColor)!=null?ae:"#FFFFFF",qt=(l=m.outlineOpacity)!=null?l:1,Jt=(he=m.outlineBlur)!=null?he:0,Lt=(H=m.fillColor)!=null?H:rh(),ht=(Ae=m.fillOpacity)!=null?Ae:1,bt=(ke=m.outlinePosition)!=null?ke:"center",Ke=(ye=m.pattern)!=null?ye:null;typeof Tt=="string"&&(Tt=jp(Tt));const _t=(qe=null)=>{var jt,Qe,ot,rt,gt,Rt;if(v.addLayer({id:dt,type:"fill",source:ct,minzoom:(jt=m.minzoom)!=null?jt:0,maxzoom:(Qe=m.maxzoom)!=null?Qe:23,paint:La({"fill-color":typeof Lt=="string"?Lt:Ma(Lt),"fill-opacity":typeof ht=="number"?ht:$t(ht)},qe&&{"fill-pattern":qe})},m.beforeId),m.outline===!0){let Ot;bt==="inside"?typeof it=="number"?Ot=.5*it:Ot=$t(it.map(({zoom:ai,value:Pi})=>({zoom:ai,value:.5*Pi}))):bt==="outside"?typeof it=="number"?Ot=-.5*it:Ot=$t(it.map(ai=>({zoom:ai.zoom,value:-.5*ai.value}))):Ot=0,v.addLayer({id:et.polygonOutlineLayerId,type:"line",source:ct,layout:{"line-join":(ot=m.outlineJoin)!=null?ot:"round","line-cap":(rt=m.outlineCap)!=null?rt:"butt"},minzoom:(gt=m.minzoom)!=null?gt:0,maxzoom:(Rt=m.maxzoom)!=null?Rt:23,paint:La({"line-opacity":typeof qt=="number"?qt:$t(qt),"line-color":typeof It=="string"?It:Ma(It),"line-width":typeof it=="number"?it:$t(it),"line-blur":typeof Jt=="number"?Jt:$t(Jt),"line-offset":Ot},Tt&&{"line-dasharray":Tt})},m.beforeId)}};return Ke?v.hasImage(Ke)?_t(Ke):v.loadImage(Ke,(qe,jt)=>{if(qe)return console.error("Could not load the pattern image.",qe.message),_t();if(!jt)return console.error(`An image cannot be created from the pattern URL ${Ke}.`),_t();v.addImage(Ke,jt),_t(Ke)}):_t(),et}function Kg(v,m){var w,P,B,X,ae,l,he,H,Ae,ke,ye,ct,dt,et,Tt,it;if(m.layerId&&v.getLayer(m.layerId))throw new Error(`A layer already exists with the layer id: ${m.layerId}`);const It=(w=m.minPointRadius)!=null?w:10,qt=(P=m.maxPointRadius)!=null?P:50,Jt=(B=m.cluster)!=null?B:!1,Lt=20,ht=Array.isArray(m.pointColor)?m.pointColor:ih.TURBO.scale(10,m.cluster?1e4:1e3).resample("ease-out-square"),bt=ht.getBounds(),Ke=(X=m.sourceId)!=null?X:bl(),_t=(ae=m.layerId)!=null?ae:wl(),qe=(l=m.showLabel)!=null?l:Jt,jt=(he=m.alignOnViewport)!=null?he:!0,Qe=(H=m.outline)!=null?H:!1,ot=(Ae=m.outlineOpacity)!=null?Ae:1,rt=(ke=m.outlineWidth)!=null?ke:1,gt=(ye=m.outlineColor)!=null?ye:"#FFFFFF";let Rt;const Ot=(ct=m.zoomCompensation)!=null?ct:!0,ai=(dt=m.minzoom)!=null?dt:0,Pi=(et=m.maxzoom)!=null?et:23;typeof m.pointOpacity=="number"?Rt=m.pointOpacity:Array.isArray(m.pointOpacity)?Rt=$t(m.pointOpacity):m.cluster?Rt=Zp(ht,"point_count"):m.property?Rt=Zp(ht,m.property):Rt=$t([{zoom:ai,value:0},{zoom:ai+.25,value:1},{zoom:Pi-.25,value:1},{zoom:Pi,value:0}]);const vr={pointLayerId:_t,clusterLayerId:"",labelLayerId:"",pointSourceId:Ke};if(m.data&&!v.getSource(Ke)){let gi=m.data;typeof gi=="string"&&fl(gi)&&(gi=`https://api.maptiler.com/data/${gi}/features.json?key=${_r.apiKey}`),v.addSource(Ke,{type:"geojson",data:gi,cluster:Jt})}if(Jt){vr.clusterLayerId=`${_t}_cluster`;const gi=Array.from({length:Lt},(Bi,zt)=>{const Ei=bt.min+zt*(bt.max-bt.min)/(Lt-1);return{value:Ei,pointRadius:It+(qt-It)*Math.pow(zt/(Lt-1),.5),color:ht.getColorHex(Ei)}});v.addLayer({id:vr.clusterLayerId,type:"circle",source:Ke,filter:["has","point_count"],paint:La({"circle-color":typeof m.pointColor=="string"?m.pointColor:Gp(gi,"point_count"),"circle-radius":typeof m.pointRadius=="number"?m.pointRadius:Array.isArray(m.pointRadius)?$t(m.pointRadius):qp(gi,"point_count",!1),"circle-pitch-alignment":jt?"viewport":"map","circle-pitch-scale":"map","circle-opacity":Rt},Qe&&{"circle-stroke-opacity":typeof ot=="number"?ot:$t(ot),"circle-stroke-width":typeof rt=="number"?rt:$t(rt),"circle-stroke-color":typeof gt=="string"?gt:Ma(gt)}),minzoom:ai,maxzoom:Pi},m.beforeId),v.addLayer({id:vr.pointLayerId,type:"circle",source:Ke,filter:["!",["has","point_count"]],paint:La({"circle-pitch-alignment":jt?"viewport":"map","circle-pitch-scale":"map","circle-color":typeof m.pointColor=="string"?m.pointColor:ht.getColorHex(ht.getBounds().min),"circle-radius":typeof m.pointRadius=="number"?m.pointRadius:Array.isArray(m.pointRadius)?$t(m.pointRadius):gi[0].pointRadius*.75,"circle-opacity":Rt},Qe&&{"circle-stroke-opacity":typeof ot=="number"?ot:$t(ot),"circle-stroke-width":typeof rt=="number"?rt:$t(rt),"circle-stroke-color":typeof gt=="string"?gt:Ma(gt)}),minzoom:ai,maxzoom:Pi},m.beforeId)}else{let gi=typeof m.pointColor=="string"?m.pointColor:Array.isArray(m.pointColor)?m.pointColor.getColorHex(m.pointColor.getBounds().min):rh(),Bi=typeof m.pointRadius=="number"?Ot?$t([{zoom:0,value:m.pointRadius*.025},{zoom:2,value:m.pointRadius*.05},{zoom:4,value:m.pointRadius*.1},{zoom:8,value:m.pointRadius*.25},{zoom:16,value:m.pointRadius*1}]):m.pointRadius:Array.isArray(m.pointRadius)?$t(m.pointRadius):Ot?$t([{zoom:0,value:It*.05},{zoom:2,value:It*.1},{zoom:4,value:It*.2},{zoom:8,value:It*.5},{zoom:16,value:It*1}]):It;if(m.property&&Array.isArray(m.pointColor)){const zt=Array.from({length:Lt},(Ei,$r)=>{const en=bt.min+$r*(bt.max-bt.min)/(Lt-1);return{value:en,pointRadius:typeof m.pointRadius=="number"?m.pointRadius:It+(qt-It)*Math.pow($r/(Lt-1),.5),color:typeof m.pointColor=="string"?m.pointColor:ht.getColorHex(en)}});gi=Gp(zt,m.property),Bi=qp(zt,m.property,Ot)}v.addLayer({id:vr.pointLayerId,type:"circle",source:Ke,layout:{"circle-sort-key":m.property?["/",1,["get",m.property]]:0},paint:La({"circle-pitch-alignment":jt?"viewport":"map","circle-pitch-scale":"map","circle-color":gi,"circle-opacity":Rt,"circle-radius":Bi},Qe&&{"circle-stroke-opacity":typeof ot=="number"?ot:$t(ot),"circle-stroke-width":typeof rt=="number"?rt:$t(rt),"circle-stroke-color":typeof gt=="string"?gt:Ma(gt)}),minzoom:ai,maxzoom:Pi},m.beforeId)}if(qe!==!1&&(m.cluster||m.property)){vr.labelLayerId=`${_t}_label`;const gi=(Tt=m.labelColor)!=null?Tt:"#fff",Bi=(it=m.labelSize)!=null?it:12;v.addLayer({id:vr.labelLayerId,type:"symbol",source:Ke,filter:["has",m.cluster?"point_count":m.property],layout:{"text-field":m.cluster?"{point_count_abbreviated}":`{${m.property}}`,"text-font":["Noto Sans Regular"],"text-size":Bi,"text-pitch-alignment":jt?"viewport":"map","symbol-sort-key":["/",1,["get",m.cluster?"point_count":m.property]]},paint:{"text-color":gi,"text-opacity":Rt},minzoom:ai,maxzoom:Pi},m.beforeId)}return vr}function Xg(v,m){var w,P,B,X,ae,l,he,H,Ae,ke;if(m.layerId&&v.getLayer(m.layerId))throw new Error(`A layer already exists with the layer id: ${m.layerId}`);const ye=(w=m.sourceId)!=null?w:bl(),ct=(P=m.layerId)!=null?P:wl(),dt=(B=m.minzoom)!=null?B:0,et=(X=m.maxzoom)!=null?X:23,Tt=(ae=m.zoomCompensation)!=null?ae:!0,it=(l=m.opacity)!=null?l:[{zoom:dt,value:0},{zoom:dt+.25,value:1},{zoom:et-.25,value:1},{zoom:et,value:0}];let It=Array.isArray(m.colorRamp)?m.colorRamp:ih.TURBO.transparentStart();const qt=It.getBounds();(qt.min!==0||qt.max!==1)&&(It=It.scale(0,1)),It.hasTransparentStart()||(It=It.transparentStart());const Jt=(he=m.intensity)!=null?he:[{zoom:0,value:.01},{zoom:4,value:.2},{zoom:16,value:1}],Lt=(H=m.property)!=null?H:null,ht=(Ae=m.weight)!=null?Ae:1;let bt=1;Lt?typeof ht=="number"?(bt=ht,typeof m.weight=="number"&&console.warn("The option `.property` is ignored when `.propertyValueWeights` is not of type `PropertyValueWeights`")):Array.isArray(ht)?bt=Bg(ht,Lt):console.warn("The option `.property` is ignored when `.propertyValueWeights` is not of type `PropertyValueWeights`"):typeof ht=="number"?bt=ht:Array.isArray(ht)&&console.warn("The options `.propertyValueWeights` can only be used when `.property` is provided.");const Ke=[{zoom:0,value:50*.025},{zoom:2,value:50*.05},{zoom:4,value:50*.1},{zoom:8,value:50*.25},{zoom:16,value:50}],_t=(ke=m.radius)!=null?ke:Tt?Ke:10;let qe=1;typeof _t=="number"?qe=_t:Array.isArray(_t)&&"zoom"in _t[0]?qe=$t(_t):Lt&&Array.isArray(_t)&&"propertyValue"in _t[0]?qe=Fg(_t,Lt,Tt):!Lt&&Array.isArray(_t)&&"propertyValue"in _t[0]?(qe=$t(Ke),console.warn("The option `.radius` can only be property-driven if the option `.property` is provided.")):qe=$t(Ke);const jt={heatmapLayerId:ct,heatmapSourceId:ye};if(m.data&&!v.getSource(ye)){let Qe=m.data;typeof Qe=="string"&&fl(Qe)&&(Qe=`https://api.maptiler.com/data/${Qe}/features.json?key=${_r.apiKey}`),v.addSource(ye,{type:"geojson",data:Qe})}return v.addLayer({id:ct,type:"heatmap",source:ye,minzoom:dt,maxzoom:et,paint:{"heatmap-weight":bt,"heatmap-intensity":typeof Jt=="number"?Jt:$t(Jt),"heatmap-color":Og(It),"heatmap-radius":qe,"heatmap-opacity":typeof it=="number"?it:$t(it)}}),jt}const Yg={addPolyline:Zg,addPolygon:Wg,addPoint:Kg,addHeatmap:Xg},{setRTLTextPlugin:Jg,getRTLTextPluginStatus:Qg,LngLat:ey,LngLatBounds:ty,MercatorCoordinate:iy,Evented:ry,AJAXError:ny,prewarm:ay,clearPrewarmedResources:sy,version:oy,workerCount:ly,maxParallelImageRequests:cy,workerUrl:hy,addProtocol:uy,removeProtocol:py}=pt,dy=pt.Map,my=pt.Marker,fy=pt.Popup,gy=pt.Style,yy=pt.CanvasSource,_y=pt.GeoJSONSource,vy=pt.ImageSource,xy=pt.RasterTileSource,by=pt.RasterDEMTileSource,wy=pt.VectorTileSource,Sy=pt.VideoSource;pt.NavigationControl,pt.GeolocateControl,pt.AttributionControl,pt.LogoControl,pt.ScaleControl,pt.FullscreenControl,pt.TerrainControl,De.AJAXError=ny,De.AttributionControl=gp,De.CanvasSource=pg,De.CanvasSourceMLGL=yy,De.ColorRamp=We,De.ColorRampCollection=ih,De.Evented=ry,De.FullscreenControl=_p,De.GeoJSONSource=dg,De.GeoJSONSourceMLGL=_y,De.GeolocateControl=up,De.GeolocationType=Ip,De.ImageSource=mg,De.ImageSourceMLGL=vy,De.Language=Mt,De.LanguageGeocoding=Ks,De.LngLat=ey,De.LngLatBounds=ty,De.LogoControl=Ju,De.Map=Ap,De.MapMLGL=dy,De.MapStyle=Fc,De.MapStyleVariant=ul,De.MaptilerGeolocateControl=fp,De.MaptilerLogoControl=Vc,De.MaptilerNavigationControl=hp,De.MaptilerTerrainControl=lp,De.Marker=cg,De.MarkerMLGL=my,De.MercatorCoordinate=iy,De.NavigationControl=cp,De.Point=Ys,De.Popup=hg,De.PopupMLGL=fy,De.RasterDEMTileSource=gg,De.RasterDEMTileSourceMLGL=by,De.RasterTileSource=fg,De.RasterTileSourceMLGL=xy,De.ReferenceMapStyle=pl,De.ScaleControl=yp,De.SdkConfig=Yu,De.ServiceError=Ln,De.Style=ug,De.StyleMLGL=gy,De.TerrainControl=vg,De.VectorTileSource=yg,De.VectorTileSourceMLGL=wy,De.VideoSource=_g,De.VideoSourceMLGL=Sy,De.addProtocol=uy,De.clearPrewarmedResources=sy,De.config=_r,De.coordinates=cf,De.data=uf,De.geocoding=af,De.geolocation=Rc,De.getRTLTextPluginStatus=Qg,De.gpx=Jc,De.gpxOrKml=Np,De.hasChildNodeWithName=Xc,De.helpers=Yg,De.kml=Qc,De.maxParallelImageRequests=cy,De.prewarm=ay,De.removeProtocol=py,De.setRTLTextPlugin=Jg,De.staticMaps=xf,De.str2xml=_l,De.version=oy,De.workerCount=ly,De.workerUrl=hy,De.xml2str=Yc});
|
|
580
|
+
`,this._cooperativeGesturesScreen.setAttribute("aria-hidden","true"),this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){q.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(h,t,n){this._canvas.width=Math.floor(n*h),this._canvas.height=Math.floor(n*t),this._canvas.style.width=`${h}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const h={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let t=null;this._canvas.addEventListener("webglcontextcreationerror",s=>{t={requestedAttributes:h},s&&(t.statusMessage=s.statusMessage,t.type=s.type)},{once:!0});const n=this._canvas.getContext("webgl2",h)||this._canvas.getContext("webgl",h);if(!n){const s="Failed to initialize WebGL";throw t?(t.message=s,new Error(JSON.stringify(t))):new Error(s)}this.painter=new qn(n,this.transform),be.testSupport(n)}_onCooperativeGesture(h,t,n){return!t&&n<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(h){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||h,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(h){return this._update(),this._renderTaskQueue.add(h)}_cancelRenderFrame(h){this._renderTaskQueue.remove(h)}_render(h){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(h),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const c=this.transform.zoom,p=l.h.now();this.style.zoomHistory.update(c,p);const g=new l.a8(c,{now:p,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),_=g.crossFadingFactor();_===1&&_===this._crossFadingFactor||(n=!0,this._crossFadingFactor=_),this.style.update(g)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,t,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding}),this.fire(new l.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,l.bg.mark(l.bh.load),this.fire(new l.k("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const s=this._sourcesDirty||this._styleDirty||this._placementDirty;return s||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new l.k("idle")),!this._loaded||this._fullyLoaded||s||(this._fullyLoaded=!0,l.bg.mark(l.bh.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var h;this._hash&&this._hash.remove();for(const n of this._controls)n.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),ft.removeThrottleControl(this._imageQueueHandle),(h=this._resizeObserver)===null||h===void 0||h.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),q.remove(this._canvasContainer),q.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),l.bg.clearMetrics(),this._removed=!0,this.fire(new l.k("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=l.h.frame(h=>{l.bg.frame(h),this._frame=null,this._render(h)}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(h){this._showTileBoundaries!==h&&(this._showTileBoundaries=h,this._update())}get showPadding(){return!!this._showPadding}set showPadding(h){this._showPadding!==h&&(this._showPadding=h,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(h){this._showCollisionBoxes!==h&&(this._showCollisionBoxes=h,h?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(h){this._showOverdrawInspector!==h&&(this._showOverdrawInspector=h,this._update())}get repaint(){return!!this._repaint}set repaint(h){this._repaint!==h&&(this._repaint=h,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(h){this._vertices=h,this._update()}get version(){return je}getCameraTargetElevation(){return this.transform.elevation}},zt.NavigationControl=class{constructor(h){this._updateZoomButtons=()=>{const t=this._map.getZoom(),n=t===this._map.getMaxZoom(),s=t===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=s,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",s.toString())},this._rotateCompassArrow=()=>{const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t},this._setButtonTitle=(t,n)=>{const s=this._map._getUIString(`NavigationControl.${n}`);t.title=s,t.setAttribute("aria-label",s)},this.options=l.e({},Bo,h),this._container=q.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),q.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),q.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=q.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(h){return this._map=h,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Fo(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){q.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(h,t){const n=q.create("button",h,this._container);return n.type="button",n.addEventListener("click",t),n}},zt.GeolocateControl=class extends l.E{constructor(h){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new l.k("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new l.k("geolocate",t)),this._finish()}},this._updateCamera=t=>{const n=new l.L(t.coords.longitude,t.coords.latitude),s=t.coords.accuracy,c=this._map.getBearing(),p=l.e({bearing:c},this.options.fitBoundsOptions),g=Bt.fromLngLat(n,s);this._map.fitBounds(g,p,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const n=new l.L(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=t=>{if(this._map){if(this.options.trackUserLocation)if(t.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&va)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new l.k("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=t=>{if(this._map){if(this._container.addEventListener("contextmenu",n=>n.preventDefault()),this._geolocateButton=q.create("button","maplibregl-ctrl-geolocate",this._container),q.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",t===!1){l.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.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=q.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Hn({element:this._dotElement}),this._circleElement=q.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Hn({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",n=>{n.geolocateSource||this._watchState!=="ACTIVE_LOCK"||n.originalEvent&&n.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new l.k("trackuserlocationend")))})}},this.options=l.e({},ci,h)}onAdd(h){return this._map=h,this._container=q.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(t,n=!1){di===void 0||n?window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(s=>{di=s.state!=="denied",t(di)}).catch(()=>{di=!!window.navigator.geolocation,t(di)}):(di=!!window.navigator.geolocation,t(di)):t(di)}(this._setupUI),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(),q.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,ni=0,va=!1}_isOutOfMapMaxBounds(h){const t=this._map.getMaxBounds(),n=h.coords;return t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const h=this._map.getBounds(),t=h.getSouthEast(),n=h.getNorthEast(),s=t.distanceTo(n),c=Math.ceil(this._accuracy/(s/this._map._container.clientHeight)*2);this._circleElement.style.width=`${c}px`,this._circleElement.style.height=`${c}px`}trigger(){if(!this._setup)return l.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new l.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":ni--,va=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new l.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new l.k("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let h;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),ni++,ni>1?(h={maximumAge:6e5,timeout:0},va=!0):(h=this.options.positionOptions,va=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,h)}}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)}},zt.AttributionControl=pr,zt.LogoControl=Xt,zt.ScaleControl=class{constructor(h){this._onMove=()=>{Ya(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,Ya(this._map,this._container,this.options)},this.options=l.e({},Xa,h)}getDefaultPosition(){return"bottom-left"}onAdd(h){return this._map=h,this._container=q.create("div","maplibregl-ctrl maplibregl-ctrl-scale",h.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){q.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},zt.FullscreenControl=class extends l.E{constructor(h={}){super(),this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,h&&h.container&&(h.container instanceof HTMLElement?this._container=h.container:l.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(h){return this._map=h,this._container||(this._container=this._map.getContainer()),this._controlContainer=q.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){q.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const h=this._fullscreenButton=q.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);q.create("span","maplibregl-ctrl-icon",h).setAttribute("aria-hidden","true"),h.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const h=this._getTitle();this._fullscreenButton.setAttribute("aria-label",h),this._fullscreenButton.title=h}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new l.k("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new l.k("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_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()}},zt.TerrainControl=class{constructor(h){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.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))},this.options=h}onAdd(h){return this._map=h,this._container=q.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=q.create("button","maplibregl-ctrl-terrain",this._container),q.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(){q.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},zt.Popup=class extends l.E{constructor(h){super(),this.remove=()=>(this._content&&q.remove(this._content),this._container&&(q.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),delete this._map),this.fire(new l.k("close")),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=q.create("div","maplibregl-popup",this._map.getContainer()),this._tip=q.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const g of this.options.className.split(" "))this._container.classList.add(g);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._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Oo(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!t)return;const n=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);let s=this.options.anchor;const c=xa(this.options.offset);if(!s){const g=this._container.offsetWidth,_=this._container.offsetHeight;let b;b=n.y+c.bottom.y<_?["top"]:n.y>this._map.transform.height-_?["bottom"]:[],n.x<g/2?b.push("left"):n.x>this._map.transform.width-g/2&&b.push("right"),s=b.length===0?"bottom":b.join("-")}const p=n.add(c[s]).round();q.setTransform(this._container,`${Cr[s]} translate(${p.x}px,${p.y}px)`),hc(this._container,s,"popup")},this._onClose=()=>{this.remove()},this.options=l.e(Object.create(No),h)}addTo(h){return this._map&&this.remove(),this._map=h,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new l.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(h){return this._lngLat=l.L.convert(h),this._pos=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._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(h){return this.setDOMContent(document.createTextNode(h))}setHTML(h){const t=document.createDocumentFragment(),n=document.createElement("body");let s;for(n.innerHTML=h;s=n.firstChild,s;)t.appendChild(s);return this.setDOMContent(t)}getMaxWidth(){var h;return(h=this._container)===null||h===void 0?void 0:h.style.maxWidth}setMaxWidth(h){return this.options.maxWidth=h,this._update(),this}setDOMContent(h){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=q.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(h),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(h){this._container&&this._container.classList.add(h)}removeClassName(h){this._container&&this._container.classList.remove(h)}setOffset(h){return this.options.offset=h,this._update(),this}toggleClassName(h){if(this._container)return this._container.classList.toggle(h)}_createCloseButton(){this.options.closeButton&&(this._closeButton=q.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const h=this._container.querySelector(Uo);h&&h.focus()}},zt.Marker=Hn,zt.Style=Li,zt.LngLat=l.L,zt.LngLatBounds=Bt,zt.Point=l.P,zt.MercatorCoordinate=l.U,zt.Evented=l.E,zt.AJAXError=l.bi,zt.config=l.c,zt.CanvasSource=wn,zt.GeoJSONSource=bn,zt.ImageSource=xr,zt.RasterDEMTileSource=na,zt.RasterTileSource=rn,zt.VectorTileSource=jr,zt.VideoSource=Da,zt.setRTLTextPlugin=l.bj,zt.getRTLTextPluginStatus=l.bk,zt.prewarm=function(){ls().acquire(Pt)},zt.clearPrewarmedResources=function(){const h=an;h&&(h.isPreloaded()&&h.numActive()===1?(h.release(Pt),an=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()"))},Vo.extend(zt,{isSafari:l.ac,getPerformanceMetrics:l.bg.getPerformanceMetrics}),zt});var Q=D;return Q})})(Au);var ef=Au.exports,vt=Iu(ef);const Cu="3.7.5",tf=Cu,rf=typeof atob=="function",nf=typeof btoa=="function",rs=typeof Buffer=="function",Eu=typeof TextDecoder=="function"?new TextDecoder:void 0,Pu=typeof TextEncoder=="function"?new TextEncoder:void 0,af="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Ks=Array.prototype.slice.call(af),ll=(y=>{let d={};return y.forEach((x,A)=>d[x]=A),d})(Ks),sf=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,Gi=String.fromCharCode.bind(String),Mu=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):y=>new Uint8Array(Array.prototype.slice.call(y,0)),ku=y=>y.replace(/=/g,"").replace(/[+\/]/g,d=>d=="+"?"-":"_"),Lu=y=>y.replace(/[^A-Za-z0-9\+\/]/g,""),zu=y=>{let d,x,A,D,V="";const Q=y.length%3;for(let l=0;l<y.length;){if((x=y.charCodeAt(l++))>255||(A=y.charCodeAt(l++))>255||(D=y.charCodeAt(l++))>255)throw new TypeError("invalid character found");d=x<<16|A<<8|D,V+=Ks[d>>18&63]+Ks[d>>12&63]+Ks[d>>6&63]+Ks[d&63]}return Q?V.slice(0,Q-3)+"===".substring(Q):V},Dc=nf?y=>btoa(y):rs?y=>Buffer.from(y,"binary").toString("base64"):zu,Rc=rs?y=>Buffer.from(y).toString("base64"):y=>{let x=[];for(let A=0,D=y.length;A<D;A+=4096)x.push(Gi.apply(null,y.subarray(A,A+4096)));return Dc(x.join(""))},cl=(y,d=!1)=>d?ku(Rc(y)):Rc(y),of=y=>{if(y.length<2){var d=y.charCodeAt(0);return d<128?y:d<2048?Gi(192|d>>>6)+Gi(128|d&63):Gi(224|d>>>12&15)+Gi(128|d>>>6&63)+Gi(128|d&63)}else{var d=65536+(y.charCodeAt(0)-55296)*1024+(y.charCodeAt(1)-56320);return Gi(240|d>>>18&7)+Gi(128|d>>>12&63)+Gi(128|d>>>6&63)+Gi(128|d&63)}},lf=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Du=y=>y.replace(lf,of),Ru=rs?y=>Buffer.from(y,"utf8").toString("base64"):Pu?y=>Rc(Pu.encode(y)):y=>Dc(Du(y)),ns=(y,d=!1)=>d?ku(Ru(y)):Ru(y),Bu=y=>ns(y,!0),cf=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,hf=y=>{switch(y.length){case 4:var d=(7&y.charCodeAt(0))<<18|(63&y.charCodeAt(1))<<12|(63&y.charCodeAt(2))<<6|63&y.charCodeAt(3),x=d-65536;return Gi((x>>>10)+55296)+Gi((x&1023)+56320);case 3:return Gi((15&y.charCodeAt(0))<<12|(63&y.charCodeAt(1))<<6|63&y.charCodeAt(2));default:return Gi((31&y.charCodeAt(0))<<6|63&y.charCodeAt(1))}},Fu=y=>y.replace(cf,hf),Ou=y=>{if(y=y.replace(/\s+/g,""),!sf.test(y))throw new TypeError("malformed base64.");y+="==".slice(2-(y.length&3));let d,x="",A,D;for(let V=0;V<y.length;)d=ll[y.charAt(V++)]<<18|ll[y.charAt(V++)]<<12|(A=ll[y.charAt(V++)])<<6|(D=ll[y.charAt(V++)]),x+=A===64?Gi(d>>16&255):D===64?Gi(d>>16&255,d>>8&255):Gi(d>>16&255,d>>8&255,d&255);return x},Bc=rf?y=>atob(Lu(y)):rs?y=>Buffer.from(y,"base64").toString("binary"):Ou,Nu=rs?y=>Mu(Buffer.from(y,"base64")):y=>Mu(Bc(y).split("").map(d=>d.charCodeAt(0))),Uu=y=>Nu(Vu(y)),uf=rs?y=>Buffer.from(y,"base64").toString("utf8"):Eu?y=>Eu.decode(Nu(y)):y=>Fu(Bc(y)),Vu=y=>Lu(y.replace(/[-_]/g,d=>d=="-"?"+":"/")),Fc=y=>uf(Vu(y)),pf=y=>{if(typeof y!="string")return!1;const d=y.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(d)||!/[^\s0-9a-zA-Z\-_]/.test(d)},$u=y=>({value:y,enumerable:!1,writable:!0,configurable:!0}),ju=function(){const y=(d,x)=>Object.defineProperty(String.prototype,d,$u(x));y("fromBase64",function(){return Fc(this)}),y("toBase64",function(d){return ns(this,d)}),y("toBase64URI",function(){return ns(this,!0)}),y("toBase64URL",function(){return ns(this,!0)}),y("toUint8Array",function(){return Uu(this)})},Gu=function(){const y=(d,x)=>Object.defineProperty(Uint8Array.prototype,d,$u(x));y("toBase64",function(d){return cl(this,d)}),y("toBase64URI",function(){return cl(this,!0)}),y("toBase64URL",function(){return cl(this,!0)})},df={version:Cu,VERSION:tf,atob:Bc,atobPolyfill:Ou,btoa:Dc,btoaPolyfill:zu,fromBase64:Fc,toBase64:ns,encode:ns,encodeURI:Bu,encodeURL:Bu,utob:Du,btou:Fu,decode:Fc,isValid:pf,fromUint8Array:cl,toUint8Array:Uu,extendString:ju,extendUint8Array:Gu,extendBuiltins:()=>{ju(),Gu()}};var Oc={exports:{}},as=typeof Reflect=="object"?Reflect:null,qu=as&&typeof as.apply=="function"?as.apply:function(d,x,A){return Function.prototype.apply.call(d,x,A)},hl;as&&typeof as.ownKeys=="function"?hl=as.ownKeys:Object.getOwnPropertySymbols?hl=function(d){return Object.getOwnPropertyNames(d).concat(Object.getOwnPropertySymbols(d))}:hl=function(d){return Object.getOwnPropertyNames(d)};function mf(y){console&&console.warn&&console.warn(y)}var Zu=Number.isNaN||function(d){return d!==d};function Kt(){Kt.init.call(this)}Oc.exports=Kt,Oc.exports.once=_f,Kt.EventEmitter=Kt,Kt.prototype._events=void 0,Kt.prototype._eventsCount=0,Kt.prototype._maxListeners=void 0;var Hu=10;function ul(y){if(typeof y!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof y)}Object.defineProperty(Kt,"defaultMaxListeners",{enumerable:!0,get:function(){return Hu},set:function(y){if(typeof y!="number"||y<0||Zu(y))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+y+".");Hu=y}}),Kt.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Kt.prototype.setMaxListeners=function(d){if(typeof d!="number"||d<0||Zu(d))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+d+".");return this._maxListeners=d,this};function Wu(y){return y._maxListeners===void 0?Kt.defaultMaxListeners:y._maxListeners}Kt.prototype.getMaxListeners=function(){return Wu(this)},Kt.prototype.emit=function(d){for(var x=[],A=1;A<arguments.length;A++)x.push(arguments[A]);var D=d==="error",V=this._events;if(V!==void 0)D=D&&V.error===void 0;else if(!D)return!1;if(D){var Q;if(x.length>0&&(Q=x[0]),Q instanceof Error)throw Q;var l=new Error("Unhandled error."+(Q?" ("+Q.message+")":""));throw l.context=Q,l}var oe=V[d];if(oe===void 0)return!1;if(typeof oe=="function")qu(oe,this,x);else for(var q=oe.length,be=Qu(oe,q),A=0;A<q;++A)qu(be[A],this,x);return!0};function Ku(y,d,x,A){var D,V,Q;if(ul(x),V=y._events,V===void 0?(V=y._events=Object.create(null),y._eventsCount=0):(V.newListener!==void 0&&(y.emit("newListener",d,x.listener?x.listener:x),V=y._events),Q=V[d]),Q===void 0)Q=V[d]=x,++y._eventsCount;else if(typeof Q=="function"?Q=V[d]=A?[x,Q]:[Q,x]:A?Q.unshift(x):Q.push(x),D=Wu(y),D>0&&Q.length>D&&!Q.warned){Q.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+Q.length+" "+String(d)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=y,l.type=d,l.count=Q.length,mf(l)}return y}Kt.prototype.addListener=function(d,x){return Ku(this,d,x,!1)},Kt.prototype.on=Kt.prototype.addListener,Kt.prototype.prependListener=function(d,x){return Ku(this,d,x,!0)};function ff(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Xu(y,d,x){var A={fired:!1,wrapFn:void 0,target:y,type:d,listener:x},D=ff.bind(A);return D.listener=x,A.wrapFn=D,D}Kt.prototype.once=function(d,x){return ul(x),this.on(d,Xu(this,d,x)),this},Kt.prototype.prependOnceListener=function(d,x){return ul(x),this.prependListener(d,Xu(this,d,x)),this},Kt.prototype.removeListener=function(d,x){var A,D,V,Q,l;if(ul(x),D=this._events,D===void 0)return this;if(A=D[d],A===void 0)return this;if(A===x||A.listener===x)--this._eventsCount===0?this._events=Object.create(null):(delete D[d],D.removeListener&&this.emit("removeListener",d,A.listener||x));else if(typeof A!="function"){for(V=-1,Q=A.length-1;Q>=0;Q--)if(A[Q]===x||A[Q].listener===x){l=A[Q].listener,V=Q;break}if(V<0)return this;V===0?A.shift():gf(A,V),A.length===1&&(D[d]=A[0]),D.removeListener!==void 0&&this.emit("removeListener",d,l||x)}return this},Kt.prototype.off=Kt.prototype.removeListener,Kt.prototype.removeAllListeners=function(d){var x,A,D;if(A=this._events,A===void 0)return this;if(A.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):A[d]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete A[d]),this;if(arguments.length===0){var V=Object.keys(A),Q;for(D=0;D<V.length;++D)Q=V[D],Q!=="removeListener"&&this.removeAllListeners(Q);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(x=A[d],typeof x=="function")this.removeListener(d,x);else if(x!==void 0)for(D=x.length-1;D>=0;D--)this.removeListener(d,x[D]);return this};function Yu(y,d,x){var A=y._events;if(A===void 0)return[];var D=A[d];return D===void 0?[]:typeof D=="function"?x?[D.listener||D]:[D]:x?yf(D):Qu(D,D.length)}Kt.prototype.listeners=function(d){return Yu(this,d,!0)},Kt.prototype.rawListeners=function(d){return Yu(this,d,!1)},Kt.listenerCount=function(y,d){return typeof y.listenerCount=="function"?y.listenerCount(d):Ju.call(y,d)},Kt.prototype.listenerCount=Ju;function Ju(y){var d=this._events;if(d!==void 0){var x=d[y];if(typeof x=="function")return 1;if(x!==void 0)return x.length}return 0}Kt.prototype.eventNames=function(){return this._eventsCount>0?hl(this._events):[]};function Qu(y,d){for(var x=new Array(d),A=0;A<d;++A)x[A]=y[A];return x}function gf(y,d){for(;d+1<y.length;d++)y[d]=y[d+1];y.pop()}function yf(y){for(var d=new Array(y.length),x=0;x<d.length;++x)d[x]=y[x].listener||y[x];return d}function _f(y,d){return new Promise(function(x,A){function D(Q){y.removeListener(d,V),A(Q)}function V(){typeof y.removeListener=="function"&&y.removeListener("error",D),x([].slice.call(arguments))}ep(y,d,V,{once:!0}),d!=="error"&&vf(y,D,{once:!0})})}function vf(y,d,x){typeof y.on=="function"&&ep(y,"error",d,x)}function ep(y,d,x,A){if(typeof y.on=="function")A.once?y.once(d,x):y.on(d,x);else if(typeof y.addEventListener=="function")y.addEventListener(d,function D(V){A.once&&y.removeEventListener(d,D),x(V)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof y)}var xf=Oc.exports,bf=Iu(xf);class wf extends Map{#r=0;#e=new Map;#t=new Map;#n;#s;#a;constructor(d={}){if(super(),!(d.maxSize&&d.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if(typeof d.maxAge=="number"&&d.maxAge===0)throw new TypeError("`maxAge` must be a number greater than 0");this.#n=d.maxSize,this.#s=d.maxAge||Number.POSITIVE_INFINITY,this.#a=d.onEviction}get __oldCache(){return this.#t}#o(d){if(typeof this.#a=="function")for(const[x,A]of d)this.#a(x,A.value)}#i(d,x){return typeof x.expiry=="number"&&x.expiry<=Date.now()?(typeof this.#a=="function"&&this.#a(d,x.value),this.delete(d)):!1}#p(d,x){if(this.#i(d,x)===!1)return x.value}#l(d,x){return x.expiry?this.#p(d,x):x.value}#c(d,x){const A=x.get(d);return this.#l(d,A)}#h(d,x){this.#e.set(d,x),this.#r++,this.#r>=this.#n&&(this.#r=0,this.#o(this.#t),this.#t=this.#e,this.#e=new Map)}#d(d,x){this.#t.delete(d),this.#h(d,x)}*#u(){for(const d of this.#t){const[x,A]=d;this.#e.has(x)||this.#i(x,A)===!1&&(yield d)}for(const d of this.#e){const[x,A]=d;this.#i(x,A)===!1&&(yield d)}}get(d){if(this.#e.has(d)){const x=this.#e.get(d);return this.#l(d,x)}if(this.#t.has(d)){const x=this.#t.get(d);if(this.#i(d,x)===!1)return this.#d(d,x),x.value}}set(d,x,{maxAge:A=this.#s}={}){const D=typeof A=="number"&&A!==Number.POSITIVE_INFINITY?Date.now()+A:void 0;return this.#e.has(d)?this.#e.set(d,{value:x,expiry:D}):this.#h(d,{value:x,expiry:D}),this}has(d){return this.#e.has(d)?!this.#i(d,this.#e.get(d)):this.#t.has(d)?!this.#i(d,this.#t.get(d)):!1}peek(d){if(this.#e.has(d))return this.#c(d,this.#e);if(this.#t.has(d))return this.#c(d,this.#t)}delete(d){const x=this.#e.delete(d);return x&&this.#r--,this.#t.delete(d)||x}clear(){this.#e.clear(),this.#t.clear(),this.#r=0}resize(d){if(!(d&&d>0))throw new TypeError("`maxSize` must be a number greater than 0");const x=[...this.#u()],A=x.length-d;A<0?(this.#e=new Map(x),this.#t=new Map,this.#r=x.length):(A>0&&this.#o(x.slice(0,A)),this.#t=new Map(x.slice(A)),this.#e=new Map,this.#r=0),this.#n=d}*keys(){for(const[d]of this)yield d}*values(){for(const[,d]of this)yield d}*[Symbol.iterator](){for(const d of this.#e){const[x,A]=d;this.#i(x,A)===!1&&(yield[x,A.value])}for(const d of this.#t){const[x,A]=d;this.#e.has(x)||this.#i(x,A)===!1&&(yield[x,A.value])}}*entriesDescending(){let d=[...this.#e];for(let x=d.length-1;x>=0;--x){const A=d[x],[D,V]=A;this.#i(D,V)===!1&&(yield[D,V.value])}d=[...this.#t];for(let x=d.length-1;x>=0;--x){const A=d[x],[D,V]=A;this.#e.has(D)||this.#i(D,V)===!1&&(yield[D,V.value])}}*entriesAscending(){for(const[d,x]of this.#u())yield[d,x.value]}get size(){if(!this.#r)return this.#t.size;let d=0;for(const x of this.#t.keys())this.#e.has(x)||d++;return Math.min(this.#r+d,this.#n)}get maxSize(){return this.#n}entries(){return this.entriesAscending()}forEach(d,x=this){for(const[A,D]of this.entriesAscending())d.call(x,D,A,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}}function Sf(){return typeof self<"u"?fetch.bind(self):typeof global<"u"&&global.fetch?global.fetch:null}class Tf{constructor(){this._apiKey="",this._fetch=Sf(),this.tileCacheSize=200}set apiKey(d){this._apiKey=d}get apiKey(){return this._apiKey}set fetch(d){this._fetch=d}get fetch(){return this._fetch}}const Pi=new Tf,Xs={AUTO:"auto",ALBANIAN:"sq",ARABIC:"ar",ARMENIAN:"hy",AZERBAIJANI:"az",BELORUSSIAN:"be",BOSNIAN:"bs",BRETON:"br",BULGARIAN:"bg",CATALAN:"ca",CHINESE:"zh",CROATIAN:"hr",CZECH:"cs",DANISH:"da",DUTCH:"nl",ENGLISH:"en",ESPERANTO:"eo",ESTONIAN:"et",FINNISH:"fi",FRENCH:"fr",FRISIAN:"fy",GEORGIAN:"ka",GERMAN:"de",GREEK:"el",HEBREW:"he",HUNGARIAN:"hu",ICELANDIC:"is",IRISH:"ga",ITALIAN:"it",JAPANESE:"ja",KANNADA:"kn",KAZAKH:"kk",KOREAN:"ko",ROMAN_LATIN:"la",LATVIAN:"lv",LITHUANIAN:"lt",LUXEMBOURGISH:"lb",MACEDONIAN:"mk",MALTESE:"mt",NORWEGIAN:"no",POLISH:"pl",PORTUGUESE:"pt",ROMANIAN:"ro",ROMANSH:"rm",RUSSIAN:"ru",SCOTTISH_GAELIC:"gd",SERBIAN_CYRILLIC:"sr",SLOVAK:"sk",SLOVENE:"sl",SPANISH:"es",SWEDISH:"sv",THAI:"th",TURKISH:"tr",UKRAINIAN:"uk",WELSH:"cy"},If=new Set(Object.values(Xs));function tp(){if(typeof navigator>"u")return Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];const y=Array.from(new Set(navigator.languages.map(d=>d.split("-")[0]))).filter(d=>If.has(d));return y.length?y[0]:Xs.ENGLISH}async function tn(y,d={}){if(Pi.fetch===null)throw new Error("The fetch function was not found. If on NodeJS < 18 please specify the fetch function with config.fetch");if(new URL(y).searchParams.get("key").trim()==="")throw new Error("The MapTiler Cloud API key is missing. Set it in `config.apiKey` or get one for free at https://maptiler.com");return Pi.fetch(y,d)}const Mr={maptilerApiURL:"https://api.maptiler.com/",mapStyle:"streets-v2"};Object.freeze(Mr);class Nr extends Error{constructor(d,x=""){super(`Call to enpoint ${d.url} failed with the status code ${d.status}. ${x}`),this.res=d}}const pl={400:"Query too long / Invalid parameters",403:"Key is missing, invalid or restricted"};function ip(y,d){const{language:x}=d;if(x==null)return;const A=Array.from(new Set((Array.isArray(x)?x:[x]).map(D=>D===Xs.AUTO?tp():D))).join(",");y.set("language",A)}function rp(y,d){const{apiKey:x,limit:A,types:D,excludeTypes:V}=d;y.set("key",x??Pi.apiKey),A!=null&&y.set("limit",String(A)),D!=null&&y.set("types",D.join(",")),V!=null&&y.set("excludeTypes",String(V)),ip(y,d)}function np(y,d){rp(y,d);const{bbox:x,proximity:A,country:D,fuzzyMatch:V,autocomplete:Q}=d;x!=null&&y.set("bbox",x.join(",")),A!=null&&y.set("proximity",A==="ip"?A:A.join(",")),D!=null&&y.set("country",D.join(",")),V!=null&&y.set("fuzzyMatch",V?"true":"false"),Q!=null&&y.set("autocomplete",Q?"true":"false")}async function Af(y,d={}){if(typeof y!="string"||y.trim().length===0)throw new Error("The query must be a non-empty string");const x=new URL(`geocoding/${encodeURIComponent(y)}.json`,Mr.maptilerApiURL),{searchParams:A}=x;np(A,d);const D=x.toString(),V=await tn(D);if(!V.ok)throw new Nr(V,pl[V.status]??"");return await V.json()}async function Cf(y,d={}){if(!Array.isArray(y)||y.length<2)throw new Error("The position must be an array of form [lng, lat].");const x=new URL(`geocoding/${y[0]},${y[1]}.json`,Mr.maptilerApiURL);rp(x.searchParams,d);const A=x.toString(),D=await tn(A);if(!D.ok)throw new Nr(D,pl[D.status]??"");return await D.json()}async function Ef(y,d={}){const x=new URL(`geocoding/${y}.json`,Mr.maptilerApiURL);x.searchParams.set("key",d.apiKey??Pi.apiKey),ip(x.searchParams,d);const A=x.toString(),D=await tn(A);if(!D.ok)throw new Nr(D,pl[D.status]??"");return await D.json()}async function Pf(y,d={}){if(!y.length)return[];const x=y.map(oe=>encodeURIComponent(oe)).join(";"),A=new URL(`geocoding/${x}.json`,Mr.maptilerApiURL),{searchParams:D}=A;np(D,d);const V=A.toString(),Q=await tn(V);if(!Q.ok)throw new Nr(Q,pl[Q.status]??"");const l=await Q.json();return y.length===1?[l]:l}const Mf={forward:Af,reverse:Cf,byId:Ef,batch:Pf,language:Xs},ap={403:"Key is missing, invalid or restricted"};async function kf(y={}){const d=new URL("geolocation/ip.json",Mr.maptilerApiURL);d.searchParams.set("key",y.apiKey??Pi.apiKey);const x=d.toString(),A=await tn(x);if(!A.ok)throw new Nr(A,A.status in ap?ap[A.status]:"");return await A.json()}const Nc={info:kf},dl={403:"Key is missing, invalid or restricted"};async function Lf(y,d={}){if(typeof y!="string"||y.trim().length===0)throw new Error("The query must be a non-empty string");const x=new URL(`coordinates/search/${y}.json`,Mr.maptilerApiURL);x.searchParams.set("key",d.apiKey??Pi.apiKey),"limit"in d&&x.searchParams.set("limit",d.limit.toString()),"transformations"in d&&x.searchParams.set("transformations",d.transformations.toString()),"exports"in d&&x.searchParams.set("exports",d.exports.toString());const A=x.toString(),D=await tn(A);if(!D.ok)throw new Nr(D,D.status in dl?dl[D.status]:"");return await D.json()}async function zf(y,d={}){const x=(Array.isArray(y[0])?y:[y]).map(l=>`${l[0]},${l[1]}`).join(";"),A=new URL(`coordinates/transform/${x}.json`,Mr.maptilerApiURL);A.searchParams.set("key",d.apiKey??Pi.apiKey),"sourceCrs"in d&&A.searchParams.set("s_srs",d.sourceCrs.toString()),"targetCrs"in d&&A.searchParams.set("t_srs",d.targetCrs.toString()),"operations"in d&&A.searchParams.set("ops",(Array.isArray(d.operations)?d.operations:[d.operations]).join("|"));const D=A.toString(),V=await tn(D);if(!V.ok)throw new Nr(V,V.status in dl?dl[V.status]:"");return await V.json()}const Df={search:Lf,transform:zf},sp={403:"Key is missing, invalid or restricted"};async function Rf(y,d={}){if(typeof y!="string"||y.trim().length===0)throw new Error("The data ID must be a non-empty string");const x=new URL(`data/${encodeURIComponent(y)}/features.json`,Mr.maptilerApiURL);x.searchParams.set("key",d.apiKey??Pi.apiKey);const A=x.toString(),D=await tn(A);if(!D.ok)throw new Nr(D,D.status in sp?sp[D.status]:"");return await D.json()}const Bf={get:Rf};function Uc(y){const d=/^maptiler:\/\/(.*)/;let x;const A=y.trim();let D;return A.startsWith("http://")||A.startsWith("https://")?D=A:(x=d.exec(A))!==null?D=`https://api.maptiler.com/maps/${x[1]}/style.json`:D=`https://api.maptiler.com/maps/${A}/style.json`,D}class ml{constructor(d,x,A,D,V,Q){this.name=d,this.variantType=x,this.id=A,this.referenceStyle=D,this.description=V,this.imageURL=Q}getName(){return this.name}getFullName(){return`${this.referenceStyle.getName()} ${this.name}`}getType(){return this.variantType}getId(){return this.id}getDescription(){return this.description}getReferenceStyle(){return this.referenceStyle}hasVariant(d){return this.referenceStyle.hasVariant(d)}getVariant(d){return this.referenceStyle.getVariant(d)}getVariants(){return this.referenceStyle.getVariants().filter(d=>d!==this)}getImageURL(){return this.imageURL}getExpandedStyleURL(){return Uc(this.getId())}}class fl{constructor(d,x){this.name=d,this.id=x,this.variants={},this.orderedVariants=[]}getName(){return this.name}getId(){return this.id}addVariant(d){this.variants[d.getType()]=d,this.orderedVariants.push(d)}hasVariant(d){return d in this.variants}getVariant(d){return d in this.variants?this.variants[d]:this.orderedVariants[0]}getVariants(){return Object.values(this.variants)}getDefaultVariant(){return this.orderedVariants[0]}}const Ys=[{referenceStyleID:"STREETS",name:"Streets",description:"",variants:[{id:"streets-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"streets-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"streets-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"streets-v2-night",name:"Night",variantType:"NIGHT",description:"",imageURL:""},{id:"streets-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OUTDOOR",name:"Outdoor",description:"",variants:[{id:"outdoor-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"outdoor-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"WINTER",name:"Winter",description:"",variants:[{id:"winter-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"winter-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"SATELLITE",name:"Satellite",description:"",variants:[{id:"satellite",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"HYBRID",name:"Hybrid",description:"",variants:[{id:"hybrid",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"BASIC",name:"Basic",description:"",variants:[{id:"basic-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"basic-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"basic-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BRIGHT",name:"Bright",description:"",variants:[{id:"bright-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"bright-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"bright-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"bright-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OPENSTREETMAP",name:"OpenStreetMap",description:"",variants:[{id:"openstreetmap",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"TOPO",name:"Topo",description:"",variants:[{id:"topo-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"topo-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"topo-v2-shiny",name:"Shiny",variantType:"SHINY",description:"",imageURL:""},{id:"topo-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""},{id:"topo-v2-topographique",name:"Topographique",variantType:"TOPOGRAPHIQUE",description:"",imageURL:""}]},{referenceStyleID:"VOYAGER",name:"Voyager",description:"",variants:[{id:"voyager-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"voyager-v2-darkmatter",name:"Darkmatter",variantType:"DARK",description:"",imageURL:""},{id:"voyager-v2-positron",name:"Positron",variantType:"LIGHT",description:"",imageURL:""},{id:"voyager-v2-vintage",name:"Vintage",variantType:"VINTAGE",description:"",imageURL:""}]},{referenceStyleID:"TONER",name:"Toner",description:"",variants:[{id:"toner-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"toner-v2-background",name:"Background",variantType:"BACKGROUND",description:"",imageURL:""},{id:"toner-v2-lite",name:"Lite",variantType:"LITE",description:"",imageURL:""},{id:"toner-v2-lines",name:"Lines",variantType:"LINES",description:"",imageURL:""}]},{referenceStyleID:"DATAVIZ",name:"Dataviz",description:"",variants:[{id:"dataviz",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"dataviz-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"dataviz-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BACKDROP",name:"Backdrop",description:"",variants:[{id:"backdrop",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"backdrop-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"backdrop-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"OCEAN",name:"Ocean",description:"",variants:[{id:"ocean",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]}];function Ff(y){return new Proxy(y,{get(d,x,A){return d.hasVariant(x)?d.getVariant(x):x.toString().toUpperCase()===x?y.getDefaultVariant():Reflect.get(d,x,A)}})}function Of(){const y={};for(let d=0;d<Ys.length;d+=1){const x=Ys[d],A=Ff(new fl(x.name,x.referenceStyleID));for(let D=0;D<x.variants.length;D+=1){const V=x.variants[D],Q=new ml(V.name,V.variantType,V.id,A,V.description,V.imageURL);A.addVariant(Q)}y[x.referenceStyleID]=A}return y}function gl(y){if(!y)return Vc[Ys[0].referenceStyleID].getDefaultVariant().getId();if(typeof y=="string"||y instanceof String)return y.trim().toLowerCase();if(y instanceof ml)return y.getId();if(y instanceof fl)return y.getDefaultVariant().getId()}const Vc=Of();function Nf(y){const d=[];function x(V){(V.type==="LineString"||V.type==="MultiLineString")&&d.push(V)}function A(V){V.geometry&&x(V.geometry)}function D(V){for(const Q of V.features)Q.type==="Feature"?A(Q):Q.type==="FeatureCollection"&&D(Q)}return y.type==="Feature"?A(y):y.type==="FeatureCollection"?D(y):x(y),d}function Uf(y,d,x){let A=d[0],D=d[1],V=x[0]-A,Q=x[1]-D;if(V!==0||Q!==0){const l=((y[0]-A)*V+(y[1]-D)*Q)/(V*V+Q*Q);l>1?(A=x[0],D=x[1]):l>0&&(A+=V*l,D+=Q*l)}return V=y[0]-A,Q=y[1]-D,V*V+Q*Q}function $c(y,d,x,A,D){let V=A,Q;for(let l=d+1;l<x;l++){const oe=Uf(y[l],y[d],y[x]);oe>V&&(Q=l,V=oe)}V>A&&(Q-d>1&&$c(y,d,Q,A,D),D.push(y[Q]),x-Q>1&&$c(y,Q,x,A,D))}function Vf(y,d){const x=y.length-1,A=[y[0]];return $c(y,0,x,d,A),A.push(y[x]),A}function $f(y,d){if(y.length<=2)return y;const x=d!==void 0?d*d:1;return Vf(y,x)}const op={extractLineStrings:Nf,simplify:$f};function jc(y,d=!0){let x=`${y[0]},${y[1]}`;return y.length===3&&d&&(x+=`,${y[2]}`),x}function Gc(y,d=3e3){let x=y.map(V=>V.join(",")).join("|"),A=5e-6;const D=1e-5;for(;x.length>d;)x=op.simplify(y,A).map(Q=>`${Q[0]},${Q[1]}`).join("|"),A+=D;return x}function jf(y,d,x={}){const A=gl(x.style),D=x.hiDPI?"@2x":"",V=x.format??"png";let Q=~~(x.width??1024),l=~~(x.height??1024);x.hiDPI&&(Q=~~(Q/2),l=~~(l/2));const oe=new URL(`maps/${encodeURIComponent(A)}/static/${y[0]},${y[1]},${d}/${Q}x${l}${D}.${V}`,Mr.maptilerApiURL);if("attribution"in x&&oe.searchParams.set("attribution",x.attribution.toString()),"markers"in x){let q="";const be="markerIcon"in x;be&&(q+=`icon:${x.markerIcon}|`),be&&"markerAnchor"in x&&(q+=`anchor:${x.markerAnchor}|`),be&&x.hiDPI&&(q+="scale:2|");const Te=Array.isArray(x.markers[0])?x.markers:[x.markers];q+=Te.map(de=>jc(de,!be)).join("|"),oe.searchParams.set("markers",q)}if("path"in x){let q="";if(q+=`fill:${x.pathFillColor??"none"}|`,"pathStrokeColor"in x&&(q+=`stroke:${x.pathStrokeColor}|`),"pathWidth"in x){const be=x.pathWidth/(x.hiDPI?2:1);q+=`width:${be.toString()}|`}q+=Gc(x.path),oe.searchParams.set("path",q)}return oe.searchParams.set("key",x.apiKey??Pi.apiKey),oe.toString()}function Gf(y,d={}){const x=gl(d.style),A=d.hiDPI?"@2x":"",D=d.format??"png";let V=~~(d.width??1024),Q=~~(d.height??1024);d.hiDPI&&(V=~~(V/2),Q=~~(Q/2));const l=new URL(`maps/${encodeURIComponent(x)}/static/${y[0]},${y[1]},${y[2]},${y[3]}/${V}x${Q}${A}.${D}`,Mr.maptilerApiURL);if("attribution"in d&&l.searchParams.set("attribution",d.attribution.toString()),"padding"in d&&l.searchParams.set("padding",d.padding.toString()),"markers"in d){let oe="";const q="markerIcon"in d;q&&(oe+=`icon:${d.markerIcon}|`),q&&"markerAnchor"in d&&(oe+=`anchor:${d.markerAnchor}|`),q&&d.hiDPI&&(oe+="scale:2|");const be=Array.isArray(d.markers[0])?d.markers:[d.markers];oe+=be.map(Te=>jc(Te,!q)).join("|"),l.searchParams.set("markers",oe)}if("path"in d){let oe="";if(oe+=`fill:${d.pathFillColor??"none"}|`,"pathStrokeColor"in d&&(oe+=`stroke:${d.pathStrokeColor}|`),"pathWidth"in d){const q=d.pathWidth/(d.hiDPI?2:1);oe+=`width:${q.toString()}|`}oe+=Gc(d.path),l.searchParams.set("path",oe)}return l.searchParams.set("key",d.apiKey??Pi.apiKey),l.toString()}function qf(y={}){if(!("markers"in y)&&!("path"in y))throw new Error("Automatic static maps require markers and/or path to be created.");const d=gl(y.style),x=y.hiDPI?"@2x":"",A=y.format??"png";let D=~~(y.width??1024),V=~~(y.height??1024);y.hiDPI&&(D=~~(D/2),V=~~(V/2));const Q=new URL(`maps/${encodeURIComponent(d)}/static/auto/${D}x${V}${x}.${A}`,Mr.maptilerApiURL);if("attribution"in y&&Q.searchParams.set("attribution",y.attribution.toString()),"padding"in y&&Q.searchParams.set("padding",y.padding.toString()),"markers"in y){let l="";const oe="markerIcon"in y;oe&&(l+=`icon:${y.markerIcon}|`),oe&&"markerAnchor"in y&&(l+=`anchor:${y.markerAnchor}|`),oe&&y.hiDPI&&(l+="scale:2|");const q=Array.isArray(y.markers[0])?y.markers:[y.markers];l+=q.map(be=>jc(be,!oe)).join("|"),Q.searchParams.set("markers",l)}if("path"in y){let l="";if(l+=`fill:${y.pathFillColor??"none"}|`,"pathStrokeColor"in y&&(l+=`stroke:${y.pathStrokeColor}|`),"pathWidth"in y){const oe=y.pathWidth/(y.hiDPI?2:1);l+=`width:${oe.toString()}|`}l+=Gc(y.path),Q.searchParams.set("path",l)}return Q.searchParams.set("key",y.apiKey??Pi.apiKey),Q.toString()}const Zf={centered:jf,bounded:Gf,automatic:qf},yl=63710088e-1,lp=2*Math.PI*yl;function cp(y){return(180+y)/360}function hp(y){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+y*Math.PI/360)))/360}function up(y){const d=mp(y);return[cp(d[0]),hp(d[1])]}function pp(y){return y*360-180}function dp(y){const d=180-y*360;return 360/Math.PI*Math.atan(Math.exp(d*Math.PI/180))-90}function Hf(y){return[pp(y[0]),dp(y[1])]}function qc(y,d){const x=Math.PI/180,A=y[1]*x,D=d[1]*x,V=Math.sin(A)*Math.sin(D)+Math.cos(A)*Math.cos(D)*Math.cos((d[0]-y[0])*x);return yl*Math.acos(Math.min(V,1))}function Wf(y){const d=Array(y.length);d[0]=0;const x=d.length;for(let A=1;A<x;A++)d[A]=qc(y[A-1],y[A])+d[A-1];return d}function mp(y){const d=y[0],x=y[1],A=360,D=((d+180)%A+A)%A-180;return[D===-180?180:D,x]}function fp(y){return lp*Math.cos(y*Math.PI/180)}function gp(y,d,x=!0){const A=2**d,D=[y[0]*A,y[1]*A];return x?[~~D[0],~~D[1]]:D}function Kf(y,d,x=!0){const A=up(y);return gp(A,d,x)}function Js(y){return y*Math.PI/180}function Zc(y){return y*180/Math.PI}function Xf(y,d,x){const A=qc(y,d),D=Js(y[0]),V=Js(y[1]),Q=Js(d[0]),l=Js(d[1]),oe=A/yl,q=Math.sin((1-x)*oe)/Math.sin(oe),be=Math.sin(x*oe)/Math.sin(oe),Te=q*Math.cos(V)*Math.cos(D)+be*Math.cos(l)*Math.cos(Q),de=q*Math.cos(V)*Math.sin(D)+be*Math.cos(l)*Math.sin(Q),et=q*Math.sin(V)+be*Math.sin(l),lt=Math.atan2(et,Math.sqrt(Te*Te+de*de)),Xe=Math.atan2(de,Te);return[Zc(Xe),Zc(lt)]}const Hc={EARTH_RADIUS:yl,EARTH_CIRCUMFERENCE:lp,longitudeToMercatorX:cp,latitudeToMercatorY:hp,wgs84ToMercator:up,mercatorXToLongitude:pp,mercatorYToLatitude:dp,mercatorToWgs84:Hf,haversineDistanceWgs84:qc,wrapWgs84:mp,circumferenceAtLatitude:fp,mercatorToTileIndex:gp,wgs84ToTileIndex:Kf,toRadians:Js,toDegrees:Zc,haversineIntermediateWgs84:Xf,haversineCumulatedDistanceWgs84:Wf};let Wc=null;function Kc(){return Wc||(Wc=new wf({maxSize:Pi.tileCacheSize})),Wc}async function yp(y){const d=new Blob([y]),x=await createImageBitmap(d),A=document.createElement("canvas"),D=A.getContext("2d");A.width=x.width,A.height=x.height,D.drawImage(x,0,0);const V=D.getImageData(0,0,A.width,A.height);return{pixels:V.data,width:A.width,height:A.height,components:V.data.length/(A.width*A.height)}}function Xc(){if(Pi.bufferToPixelData)return Pi.bufferToPixelData;if(typeof window<"u")return yp;throw new Error("An image file buffer to pixel data parser is necessary. Specify it in `config.bufferToPixelData`")}const Yf="tiles/terrain-rgb-v2/tiles.json";let Rn=null;const Yc={403:"Key is missing, invalid or restricted"};async function _p(y){const d=new URL(Yf,Mr.maptilerApiURL);d.searchParams.set("key",y);const x=d.toString(),A=await tn(x);if(A.ok)return Rn=await A.json(),Rn;if(!A.ok)throw new Nr(A,Yc[A.status]??"")}async function Jf(y,d={}){const x=d.apiKey??Pi.apiKey;Rn||await _p(x);const A=Rn.maxzoom;let D=~~(d.zoom??A);(D>A||D<0)&&(D=A);const V=Hc.wgs84ToTileIndex(y,D,!1),Q=~~V[0],l=~~V[1];if(!Rn.tiles.length)throw new Error("Terrain tileJSON tile list is empty.");const oe=`terrain_${D.toString()}_${Q.toString()}_${l.toString()}`;let q;const be=Kc();if(be.has(oe))q=be.get(oe);else{const St=Rn.tiles[0].replace("{x}",Q.toString()).replace("{y}",l.toString()).replace("{z}",D.toString()),Ct=await tn(St);if(!Ct.ok)throw new Nr(Ct,Yc[Ct.status]??"");const Ue=await Ct.arrayBuffer();q=await Xc()(Ue),be.set(oe,q)}const Te=~~(q.width*(V[0]%1)),et=(~~(q.height*(V[1]%1))*q.width+Te)*q.components,lt=q.pixels[et],Xe=q.pixels[et+1],ft=q.pixels[et+2],tt=-1e4+(lt*256*256+Xe*256+ft)*.1;return[y[0],y[1],tt]}async function Jc(y,d={}){const x=d.apiKey??Pi.apiKey;Rn||await _p(x);const A=Xc(),D=Rn.tiles[0],V=Kc(),Q=Rn.maxzoom;let l=~~(d.zoom??Q);(l>Q||l<0)&&(l=Q);const oe=y.map(Ue=>Hc.wgs84ToTileIndex(Ue,l,!1)),be=oe.map(Ue=>[~~Ue[0],~~Ue[1]]).map(Ue=>`terrain_${l.toString()}_${Ue[0].toString()}_${Ue[1].toString()}`),Te=Array.from(new Set(be.filter(Ue=>!V.has(Ue)))).map(Ue=>Ue.split("_").slice(1)),et=Te.map(Ue=>D.replace("{x}",Ue[1].toString()).replace("{y}",Ue[2].toString()).replace("{z}",Ue[0].toString())).map(Ue=>tn(Ue)),Xe=(await Promise.allSettled(et)).map(Ue=>Ue.status==="fulfilled"?Ue.value:null).filter(Ue=>Ue),ft=Xe.filter(Ue=>!Ue.ok);if(Xe.length!==et.length)throw new Error("Some tiles could not be fetched.");if(ft.length)throw new Nr(ft[0],Yc[ft[0].status]??"");const tt=await Promise.all(Xe.map(Ue=>Ue.arrayBuffer()));if(!tt.every(Ue=>Ue.byteLength>0))throw new Error("Some tiles are not available.");(await Promise.all(tt.map(Ue=>A(Ue)))).forEach((Ue,gt)=>{const Qe=Te[gt],rt=`terrain_${Qe[0].toString()}_${Qe[1].toString()}_${Qe[2].toString()}`;V.set(rt,Ue)});const Ct=y.map((Ue,gt)=>{const Qe=be[gt],rt=oe[gt],Ve=V.get(Qe),pt=Math.min(Math.round(Ve.width*(rt[0]%1)),Ve.width-1),Rt=(Math.min(Math.round(Ve.height*(rt[1]%1)),Ve.height-1)*Ve.width+pt)*Ve.components,it=Ve.pixels[Rt],ct=Ve.pixels[Rt+1],st=Ve.pixels[Rt+2],yt=-1e4+(it*256*256+ct*256+st)*.1;return[Ue[0],Ue[1],~~(yt*1e3)/1e3]});if(d.smoothingKernelSize){const Ue=~~(d.smoothingKernelSize/2)*2+1,gt=Ct.map(rt=>rt[2]),Qe=~~(Ue/2);for(let rt=Qe;rt<gt.length-Qe-1;rt+=1){let Ve=0;for(let pt=0;pt<Ue;pt+=1){const Ge=gt[rt-Qe+pt];Ve+=Ge}Ve/=Ue,Ct[rt][2]=Ve}}return Ct}async function Qf(y,d={}){if(y.type!=="LineString")throw new Error("The provided object is not a GeoJSON LineString");const x=structuredClone(y),A=await Jc(x.coordinates,d);return x.coordinates=A,x}async function eg(y,d={}){if(y.type!=="MultiLineString")throw new Error("The provided object is not a GeoJSON MultiLineString");const x=structuredClone(y),A=x.coordinates.map(oe=>oe.length),D=x.coordinates.flat(),V=await Jc(D,d),Q=[];let l=0;for(const oe of A)Q.push(V.slice(l,l+oe)),l+=oe;return x.coordinates=Q,x}const tg={at:Jf,batch:Jc,fromLineString:Qf,fromMultiLineString:eg};let _l;const ig=new Uint8Array(16);function rg(){if(!_l&&(_l=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!_l))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return _l(ig)}const qi=[];for(let y=0;y<256;++y)qi.push((y+256).toString(16).slice(1));function ng(y,d=0){return qi[y[d+0]]+qi[y[d+1]]+qi[y[d+2]]+qi[y[d+3]]+"-"+qi[y[d+4]]+qi[y[d+5]]+"-"+qi[y[d+6]]+qi[y[d+7]]+"-"+qi[y[d+8]]+qi[y[d+9]]+"-"+qi[y[d+10]]+qi[y[d+11]]+qi[y[d+12]]+qi[y[d+13]]+qi[y[d+14]]+qi[y[d+15]]}var vp={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ag(y,d,x){if(vp.randomUUID&&!d&&!y)return vp.randomUUID();y=y||{};const A=y.random||(y.rng||rg)();if(A[6]=A[6]&15|64,A[8]=A[8]&63|128,d){x=x||0;for(let D=0;D<16;++D)d[x+D]=A[D];return d}return ng(A)}const Dt={VISITOR:"visitor",VISITOR_ENGLISH:"visitor_en",STYLE:"style",AUTO:"auto",STYLE_LOCK:"style_lock",LATIN:"name:latin",NON_LATIN:"name:nonlatin",LOCAL:"name",INTERNATIONAL:"name_int",ALBANIAN:"name:sq",AMHARIC:"name:am",ARABIC:"name:ar",ARMENIAN:"name:hy",AZERBAIJANI:"name:az",BASQUE:"name:eu",BELORUSSIAN:"name:be",BENGALI:"name:bn",BOSNIAN:"name:bs",BRETON:"name:br",BULGARIAN:"name:bg",CATALAN:"name:ca",CHINESE:"name:zh",TRADITIONAL_CHINESE:"name:zh-Hant",SIMPLIFIED_CHINESE:"name:zh-Hans",CORSICAN:"name:co",CROATIAN:"name:hr",CZECH:"name:cs",DANISH:"name:da",DUTCH:"name:nl",ENGLISH:"name:en",ESPERANTO:"name:eo",ESTONIAN:"name:et",FINNISH:"name:fi",FRENCH:"name:fr",FRISIAN:"name:fy",GEORGIAN:"name:ka",GERMAN:"name:de",GREEK:"name:el",HEBREW:"name:he",HINDI:"name:hi",HUNGARIAN:"name:hu",ICELANDIC:"name:is",INDONESIAN:"name:id",IRISH:"name:ga",ITALIAN:"name:it",JAPANESE:"name:ja",JAPANESE_HIRAGANA:"name:ja-Hira",JAPANESE_KANA:"name:ja_kana",JAPANESE_LATIN:"name:ja_rm",JAPANESE_2018:"name:ja-Latn",KANNADA:"name:kn",KAZAKH:"name:kk",KOREAN:"name:ko",KOREAN_LATIN:"name:ko-Latn",KURDISH:"name:ku",ROMAN_LATIN:"name:la",LATVIAN:"name:lv",LITHUANIAN:"name:lt",LUXEMBOURGISH:"name:lb",MACEDONIAN:"name:mk",MALAYALAM:"name:ml",MALTESE:"name:mt",NORWEGIAN:"name:no",OCCITAN:"name:oc",PERSIAN:"name:fa",POLISH:"name:pl",PORTUGUESE:"name:pt",PUNJABI:"name:pa",WESTERN_PUNJABI:"name:pnb",ROMANIAN:"name:ro",ROMANSH:"name:rm",RUSSIAN:"name:ru",SCOTTISH_GAELIC:"name:gd",SERBIAN_CYRILLIC:"name:sr",SERBIAN_LATIN:"name:sr-Latn",SLOVAK:"name:sk",SLOVENE:"name:sl",SPANISH:"name:es",SWEDISH:"name:sv",TAMIL:"name:ta",TELUGU:"name:te",THAI:"name:th",TURKISH:"name:tr",UKRAINIAN:"name:uk",URDU:"name:ur",VIETNAMIAN_LATIN:"name:vi",WELSH:"name:cy"},sg=new Set(Object.values(Dt));function Qc(y){return sg.has(y)}const og=new Set(Object.values(Dt));function eh(){if(typeof navigator>"u")return`name:${Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0]}`;const y=Array.from(new Set(navigator.languages.map(d=>`name:${d.split("-")[0]}`))).filter(d=>og.has(d));return y.length?y[0]:Dt.LOCAL}const Ur={maptilerLogoURL:"https://api.maptiler.com/resources/logo.svg",maptilerURL:"https://www.maptiler.com/",maptilerApiHost:"api.maptiler.com",rtlPluginURL:"https://cdn.maptiler.com/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.min.js",primaryLanguage:Dt.STYLE,secondaryLanguage:Dt.LOCAL,terrainSourceURL:"https://api.maptiler.com/tiles/terrain-rgb-v2/tiles.json",terrainSourceId:"maptiler-terrain"};Object.freeze(Ur);var lg=Object.defineProperty,cg=(y,d,x)=>d in y?lg(y,d,{enumerable:!0,configurable:!0,writable:!0,value:x}):y[d]=x,Qs=(y,d,x)=>(cg(y,typeof d!="symbol"?d+"":d,x),x);const xp=ag();let bp=class extends bf{constructor(){super(),Qs(this,"primaryLanguage",Ur.primaryLanguage),Qs(this,"secondaryLanguage"),Qs(this,"session",!0),Qs(this,"_unit","metric"),Qs(this,"_apiKey","")}set unit(d){this._unit=d,this.emit("unit",d)}get unit(){return this._unit}set apiKey(d){this._apiKey=d,Pi.apiKey=d,this.emit("apiKey",d)}get apiKey(){return this._apiKey}set fetch(d){Pi.fetch=d}get fetch(){return Pi.fetch}};const _r=new bp;class wp extends vt.LogoControl{onAdd(d){return super.onAdd(d)}}var hg=Object.defineProperty,ug=(y,d,x)=>d in y?hg(y,d,{enumerable:!0,configurable:!0,writable:!0,value:x}):y[d]=x,Sp=(y,d,x)=>(ug(y,typeof d!="symbol"?d+"":d,x),x);class th extends wp{constructor(d={}){var x,A;super(d),Sp(this,"logoURL",""),Sp(this,"linkURL",""),this.logoURL=(x=d.logoURL)!=null?x:Ur.maptilerLogoURL,this.linkURL=(A=d.linkURL)!=null?A:Ur.maptilerURL}onAdd(d){var x;this._map=d,this._compact=(x=this.options.compact)!=null?x:!1,this._container=window.document.createElement("div"),this._container.className="maplibregl-ctrl";const A=window.document.createElement("a");return A.style.backgroundRepeat="no-repeat",A.style.cursor="pointer",A.style.display="block",A.style.height="23px",A.style.margin="0 0 -4px -4px",A.style.overflow="hidden",A.style.width="88px",A.style.backgroundImage=`url(${this.logoURL})`,A.style.backgroundSize="100px 30px",A.style.width="100px",A.style.height="30px",A.target="_blank",A.rel="noopener",A.href=this.linkURL,A.setAttribute("aria-label","MapTiler logo"),A.setAttribute("rel","noopener"),this._container.appendChild(A),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}}var pg=Object.defineProperty,Tp=Object.getOwnPropertySymbols,dg=Object.prototype.hasOwnProperty,mg=Object.prototype.propertyIsEnumerable,Ip=(y,d,x)=>d in y?pg(y,d,{enumerable:!0,configurable:!0,writable:!0,value:x}):y[d]=x,Ap=(y,d)=>{for(var x in d||(d={}))dg.call(d,x)&&Ip(y,x,d[x]);if(Tp)for(var x of Tp(d))mg.call(d,x)&&Ip(y,x,d[x]);return y};function fg(){vt.getRTLTextPluginStatus()==="unavailable"&&vt.setRTLTextPlugin(Ur.rtlPluginURL,y=>{y&&console.error(y)},!0)}function gg(y,d){y.forEach(x=>{typeof d[x]=="function"&&(d[x]=d[x].bind(d))})}function ra(y,d,x){const A=window.document.createElement(y);return d!==void 0&&(A.className=d),x&&x.appendChild(A),A}function Cp(y){y.parentNode&&y.parentNode.removeChild(y)}function Ep(y,d){let x=null;try{x=new URL(y)}catch{return{url:y}}return x.host===Ur.maptilerApiHost&&(x.searchParams.has("key")||x.searchParams.append("key",_r.apiKey),_r.session&&x.searchParams.append("mtsid",xp)),{url:x.href}}function Pp(y){return function(d,x){var A;if(y!==void 0){const D=y(d,x),V=Ep((A=D?.url)!=null?A:"");return Ap(Ap({},D),V)}else return Ep(d)}}function Mp(){return Math.random().toString(36).substring(2)}function vl(y){return/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi.test(y)}function yg(y){try{return JSON.parse(y)}catch{}return null}function kp(y){return y?typeof y=="string"||y instanceof String?!y.startsWith("http")&&y.toLowerCase().includes(".json")?y:Uc(y):y instanceof ml?y.getExpandedStyleURL():y instanceof fl?y.getDefaultVariant().getExpandedStyleURL():y:Vc[Ys[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL()}var _g=Object.defineProperty,vg=(y,d,x)=>d in y?_g(y,d,{enumerable:!0,configurable:!0,writable:!0,value:x}):y[d]=x,ih=(y,d,x)=>(vg(y,typeof d!="symbol"?d+"":d,x),x);class Lp{constructor(){ih(this,"_map"),ih(this,"_container"),ih(this,"_terrainButton"),gg(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(d){return this._map=d,this._container=ra("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=ra("button","maplibregl-ctrl-terrain",this._container),ra("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(){Cp(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.hasTerrain()?this._map.disableTerrain():this._map.enableTerrain(),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.hasTerrain()?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}}class zp extends vt.NavigationControl{onAdd(d){return super.onAdd(d)}}var xg=Object.defineProperty,bg=(y,d,x)=>d in y?xg(y,d,{enumerable:!0,configurable:!0,writable:!0,value:x}):y[d]=x,wg=(y,d,x)=>(bg(y,typeof d!="symbol"?d+"":d,x),x);class Dp extends zp{constructor(){super({showCompass:!0,showZoom:!0,visualizePitch:!0}),wg(this,"_rotateCompassArrow",()=>{const d=this.options.visualizePitch?`scale(${Math.min(1.5,1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5))}) rotateX(${Math.min(70,this._map.transform.pitch)}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=d}),this._compass.removeEventListener("click",this._compass.clickFunction),this._compass.addEventListener("click",d=>{this._map.getPitch()===0?this._map.easeTo({pitch:Math.min(this._map.getMaxPitch(),80)}):this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:d}):this._map.resetNorth({},{originalEvent:d})})}_createButton(d,x){const A=super._createButton(d,x);return A.clickFunction=x,A}}class Rp extends vt.GeolocateControl{onAdd(d){return super.onAdd(d)}}var Sg=Object.defineProperty,Tg=Object.defineProperties,Ig=Object.getOwnPropertyDescriptors,Bp=Object.getOwnPropertySymbols,Ag=Object.prototype.hasOwnProperty,Cg=Object.prototype.propertyIsEnumerable,rh=(y,d,x)=>d in y?Sg(y,d,{enumerable:!0,configurable:!0,writable:!0,value:x}):y[d]=x,Eg=(y,d)=>{for(var x in d||(d={}))Ag.call(d,x)&&rh(y,x,d[x]);if(Bp)for(var x of Bp(d))Cg.call(d,x)&&rh(y,x,d[x]);return y},Pg=(y,d)=>Tg(y,Ig(d)),xl=(y,d,x)=>(rh(y,typeof d!="symbol"?d+"":d,x),x);const Fp=vt.Marker,Op=vt.LngLat,Mg=vt.LngLatBounds;class Np extends Rp{constructor(){super(...arguments),xl(this,"lastUpdatedCenter",new Op(0,0)),xl(this,"_updateCamera",d=>{var x,A,D;const V=new Op(d.coords.longitude,d.coords.latitude),Q=d.coords.accuracy,l=this._map.getBearing(),oe=Pg(Eg({bearing:l},this.options.fitBoundsOptions),{linear:!0}),q=this._map.getZoom();q>((D=(A=(x=this.options)==null?void 0:x.fitBoundsOptions)==null?void 0:A.maxZoom)!=null?D:30)&&(oe.zoom=q),this._map.fitBounds(Mg.fromLngLat(V,Q),oe,{geolocateSource:!0});let be=!1;const Te=()=>{be=!0};this._map.once("click",Te),this._map.once("dblclick",Te),this._map.once("dragstart",Te),this._map.once("mousedown",Te),this._map.once("touchstart",Te),this._map.once("wheel",Te),this._map.once("moveend",()=>{this._map.off("click",Te),this._map.off("dblclick",Te),this._map.off("dragstart",Te),this._map.off("mousedown",Te),this._map.off("touchstart",Te),this._map.off("wheel",Te),!be&&(this.lastUpdatedCenter=this._map.getCenter())})}),xl(this,"_setupUI",d=>{if(this.lastUpdatedCenter=this._map.getCenter(),this._container.addEventListener("contextmenu",x=>x.preventDefault()),this._geolocateButton=ra("button","maplibregl-ctrl-geolocate",this._container),ra("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",d===!1){const x=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=x,this._geolocateButton.setAttribute("aria-label",x)}else{const x=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=x,this._geolocateButton.setAttribute("aria-label",x)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=ra("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Fp({element:this._dotElement}),this._circleElement=ra("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Fp({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("move",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("moveend",x=>{const A=x.originalEvent&&x.originalEvent.type==="resize",D=this.lastUpdatedCenter.distanceTo(this._map.getCenter());!x.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!A&&D>1&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new Event("trackuserlocationend")))})}),xl(this,"_onZoom",()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()})}_updateCircleRadius(){if(this._watchState!=="BACKGROUND"&&this._watchState!=="ACTIVE_LOCK")return;const d=[this._lastKnownPosition.coords.longitude,this._lastKnownPosition.coords.latitude],x=this._map.project(d),A=this._map.unproject([x.x,x.y]),D=this._map.unproject([x.x+20,x.y]),V=A.distanceTo(D)/20,Q=Math.ceil(2*this._accuracy/V);this._circleElement.style.width=`${Q}px`,this._circleElement.style.height=`${Q}px`}}class Up extends vt.AttributionControl{onAdd(d){return super.onAdd(d)}}class Vp extends vt.ScaleControl{onAdd(d){return super.onAdd(d)}}class $p extends vt.FullscreenControl{onAdd(d){return super.onAdd(d)}}var kg=Object.defineProperty,Lg=Object.defineProperties,zg=Object.getOwnPropertyDescriptors,jp=Object.getOwnPropertySymbols,Dg=Object.prototype.hasOwnProperty,Rg=Object.prototype.propertyIsEnumerable,nh=(y,d,x)=>d in y?kg(y,d,{enumerable:!0,configurable:!0,writable:!0,value:x}):y[d]=x,ss=(y,d)=>{for(var x in d||(d={}))Dg.call(d,x)&&nh(y,x,d[x]);if(jp)for(var x of jp(d))Rg.call(d,x)&&nh(y,x,d[x]);return y},Gp=(y,d)=>Lg(y,zg(d)),Bg=(y,d,x)=>(nh(y,typeof d!="symbol"?d+"":d,x),x),ah=(y,d,x)=>{if(!d.has(y))throw TypeError("Cannot "+x)},Mt=(y,d,x)=>(ah(y,d,"read from private field"),x?x.call(y):d.get(y)),_n=(y,d,x)=>{if(d.has(y))throw TypeError("Cannot add the same private member more than once");d instanceof WeakSet?d.add(y):d.set(y,x)},os=(y,d,x,A)=>(ah(y,d,"write to private field"),A?A.call(y,x):d.set(y,x),x),kr=(y,d,x)=>(ah(y,d,"access private method"),x),Lr,vn,Ea,qp,Pa,Vr,bl,sh,Zp,zr,$r,oh,Hp;let lh=class{constructor(d,x){_n(this,sh),_n(this,zr),_n(this,oh),_n(this,Lr,void 0),Bg(this,"map"),_n(this,vn,void 0),_n(this,Ea,void 0),_n(this,qp,void 0),_n(this,Pa,void 0),_n(this,Vr,!1),_n(this,bl,void 0);var A;d.style!==void 0&&os(this,Vr,!0),os(this,Lr,Gp(ss(Gp(ss({zoomAdjust:-4,position:"top-right"},x),{forceNoAttributionControl:!0,attributionControl:!1,navigationControl:!1,geolocateControl:!1,maptilerLogo:!1,minimap:!1,hash:!1,pitchAdjust:!1}),d),{containerStyle:ss({border:"1px solid #000",width:"400px",height:"300px"},(A=d.containerStyle)!=null?A:{})})),d.lockZoom!==void 0&&(Mt(this,Lr).minZoom=d.lockZoom,Mt(this,Lr).maxZoom=d.lockZoom)}setStyle(d,x){Mt(this,Vr)||this.map.setStyle(d,x),kr(this,zr,$r).call(this)}addLayer(d,x){return Mt(this,Vr)||this.map.addLayer(d,x),kr(this,zr,$r).call(this),this.map}moveLayer(d,x){return Mt(this,Vr)||this.map.moveLayer(d,x),kr(this,zr,$r).call(this),this.map}removeLayer(d){return Mt(this,Vr)||this.map.removeLayer(d),kr(this,zr,$r).call(this),this}setLayerZoomRange(d,x,A){return Mt(this,Vr)||this.map.setLayerZoomRange(d,x,A),kr(this,zr,$r).call(this),this}setFilter(d,x,A){return Mt(this,Vr)||this.map.setFilter(d,x,A),kr(this,zr,$r).call(this),this}setPaintProperty(d,x,A,D){return Mt(this,Vr)||this.map.setPaintProperty(d,x,A,D),kr(this,zr,$r).call(this),this}setLayoutProperty(d,x,A,D){return Mt(this,Vr)||this.map.setLayoutProperty(d,x,A,D),kr(this,zr,$r).call(this),this}setGlyphs(d,x){return Mt(this,Vr)||this.map.setGlyphs(d,x),kr(this,zr,$r).call(this),this}onAdd(d){os(this,vn,d),os(this,Ea,ra("div","maplibregl-ctrl maplibregl-ctrl-group"));for(const[x,A]of Object.entries(Mt(this,Lr).containerStyle))Mt(this,Ea).style.setProperty(x,A);return Mt(this,Lr).container=Mt(this,Ea),Mt(this,Lr).zoom=d.getZoom()+Mt(this,Lr).zoomAdjust,this.map=new Xp(Mt(this,Lr)),this.map.once("style.load",()=>{this.map.resize()}),this.map.once("load",()=>{kr(this,sh,Zp).call(this,Mt(this,Lr).parentRect),os(this,bl,kr(this,oh,Hp).call(this))}),Mt(this,Ea)}onRemove(){var d;(d=Mt(this,bl))==null||d.call(this),Cp(Mt(this,Ea))}};Lr=new WeakMap,vn=new WeakMap,Ea=new WeakMap,qp=new WeakMap,Pa=new WeakMap,Vr=new WeakMap,bl=new WeakMap,sh=new WeakSet,Zp=function(y){y===void 0||y.linePaint===void 0&&y.fillPaint===void 0||(os(this,Pa,{type:"Feature",properties:{name:"parentRect"},geometry:{type:"Polygon",coordinates:[[[],[],[],[],[]]]}}),this.map.addSource("parentRect",{type:"geojson",data:Mt(this,Pa)}),(y.lineLayout!==void 0||y.linePaint!==void 0)&&this.map.addLayer({id:"parentRectOutline",type:"line",source:"parentRect",layout:ss({},y.lineLayout),paint:ss({"line-color":"#FFF","line-width":1,"line-opacity":.85},y.linePaint)}),y.fillPaint!==void 0&&this.map.addLayer({id:"parentRectFill",type:"fill",source:"parentRect",layout:{},paint:ss({"fill-color":"#08F","fill-opacity":.135},y.fillPaint)}),kr(this,zr,$r).call(this))},zr=new WeakSet,$r=function(){if(Mt(this,Pa)===void 0)return;const{devicePixelRatio:y}=window,d=Mt(this,vn).getCanvas(),x=d.width/y,A=d.height/y,D=Mt(this,vn).unproject.bind(Mt(this,vn)),V=D([0,0]),Q=D([x,0]),l=D([0,A]),oe=D([x,A]);Mt(this,Pa).geometry.coordinates=[[l.toArray(),oe.toArray(),Q.toArray(),V.toArray(),l.toArray()]],this.map.getSource("parentRect").setData(Mt(this,Pa))},oh=new WeakSet,Hp=function(){const{pitchAdjust:y}=Mt(this,Lr),d=()=>{V("parent")},x=()=>{V("minimap")},A=()=>{Mt(this,vn).on("move",d),this.map.on("move",x)},D=()=>{Mt(this,vn).off("move",d),this.map.off("move",x)},V=Q=>{var l;D();const oe=Q==="parent"?Mt(this,vn):this.map,q=Q==="parent"?this.map:Mt(this,vn),be=oe.getCenter(),Te=oe.getZoom()+((l=Mt(this,Lr).zoomAdjust)!=null?l:-4)*(Q==="parent"?1:-1),de=oe.getBearing(),et=oe.getPitch();q.jumpTo({center:be,zoom:Te,bearing:de,pitch:y?et:0}),kr(this,zr,$r).call(this),A()};return A(),()=>{D()}};var Fg=Object.defineProperty,Og=Object.defineProperties,Ng=Object.getOwnPropertyDescriptors,Wp=Object.getOwnPropertySymbols,Ug=Object.prototype.hasOwnProperty,Vg=Object.prototype.propertyIsEnumerable,ch=(y,d,x)=>d in y?Fg(y,d,{enumerable:!0,configurable:!0,writable:!0,value:x}):y[d]=x,$g=(y,d)=>{for(var x in d||(d={}))Ug.call(d,x)&&ch(y,x,d[x]);if(Wp)for(var x of Wp(d))Vg.call(d,x)&&ch(y,x,d[x]);return y},jg=(y,d)=>Og(y,Ng(d)),Bn=(y,d,x)=>(ch(y,typeof d!="symbol"?d+"":d,x),x),xn=(y,d,x)=>new Promise((A,D)=>{var V=oe=>{try{l(x.next(oe))}catch(q){D(q)}},Q=oe=>{try{l(x.throw(oe))}catch(q){D(q)}},l=oe=>oe.done?A(oe.value):Promise.resolve(oe.value).then(V,Q);l((x=x.apply(y,d)).next())});const Kp={POINT:"POINT",COUNTRY:"COUNTRY"};let Xp=class extends vt.Map{constructor(d){var x,A,D;d.apiKey&&(_r.apiKey=d.apiKey);const V=kp(d.style),Q=location.hash;_r.apiKey||console.warn("MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!"),super(jg($g({},d),{style:V,maplibreLogo:!1,transformRequest:Pp(d.transformRequest)})),Bn(this,"isTerrainEnabled",!1),Bn(this,"terrainExaggeration",1),Bn(this,"primaryLanguage"),Bn(this,"terrainGrowing",!1),Bn(this,"terrainFlattening",!1),Bn(this,"minimap"),Bn(this,"forceLanguageUpdate"),Bn(this,"languageAlwaysBeenStyle"),Bn(this,"isReady",!1),this.primaryLanguage=(x=d.language)!=null?x:_r.primaryLanguage,this.forceLanguageUpdate=!(this.primaryLanguage===Dt.STYLE||this.primaryLanguage===Dt.STYLE_LOCK),this.languageAlwaysBeenStyle=this.primaryLanguage===Dt.STYLE,this.terrainExaggeration=(A=d.terrainExaggeration)!=null?A:this.terrainExaggeration,this.once("styledata",()=>xn(this,null,function*(){if(!d.geolocate||d.center||d.hash&&Q)return;try{if(d.geolocate===Kp.COUNTRY){yield this.fitToIpBounds();return}}catch(de){console.warn(de.message)}let Te;try{yield this.centerOnIpPoint(d.zoom),Te=this.getCameraHash()}catch(de){console.warn(de.message)}(yield navigator.permissions.query({name:"geolocation"})).state==="granted"&&navigator.geolocation.getCurrentPosition(de=>{Te===this.getCameraHash()&&(this.terrain?this.easeTo({center:[de.coords.longitude,de.coords.latitude],zoom:d.zoom||12,duration:2e3}):this.once("terrain",()=>{this.easeTo({center:[de.coords.longitude,de.coords.latitude],zoom:d.zoom||12,duration:2e3})}))},null,{maximumAge:24*3600*1e3,timeout:5e3,enableHighAccuracy:!1})})),this.on("styledata",()=>{this.setPrimaryLanguage(this.primaryLanguage)}),this.on("styledata",()=>{this.getTerrain()===null&&this.isTerrainEnabled&&this.enableTerrain(this.terrainExaggeration)}),this.once("load",()=>xn(this,null,function*(){fg()})),this.once("load",()=>xn(this,null,function*(){let Te={logo:null};try{const de=Object.keys(this.style.sourceCaches).map(lt=>this.getSource(lt)).filter(lt=>lt&&"url"in lt&&typeof lt.url=="string"&<?.url.includes("tiles.json")),et=new URL(de[0].url);et.searchParams.has("key")||et.searchParams.append("key",_r.apiKey),Te=yield(yield fetch(et.href)).json()}catch{}if(d.forceNoAttributionControl!==!0)if("logo"in Te&&Te.logo){const de=Te.logo;this.addControl(new th({logoURL:de}),d.logoPosition),d.attributionControl===!1&&this.addControl(new Up({customAttribution:d.customAttribution}))}else d.maptilerLogo&&this.addControl(new th,d.logoPosition);if(d.scaleControl){const de=d.scaleControl===!0||d.scaleControl===void 0?"bottom-right":d.scaleControl,et=new Vp({unit:_r.unit});this.addControl(et,de),_r.on("unit",lt=>{et.setUnit(lt)})}if(d.navigationControl!==!1){const de=d.navigationControl===!0||d.navigationControl===void 0?"top-right":d.navigationControl;this.addControl(new Dp,de)}if(d.geolocateControl!==!1){const de=d.geolocateControl===!0||d.geolocateControl===void 0?"top-right":d.geolocateControl;this.addControl(new Np({positionOptions:{enableHighAccuracy:!0,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!0,showAccuracyCircle:!0,showUserLocation:!0}),de)}if(d.terrainControl){const de=d.terrainControl===!0||d.terrainControl===void 0?"top-right":d.terrainControl;this.addControl(new Lp,de)}if(d.fullscreenControl){const de=d.fullscreenControl===!0||d.fullscreenControl===void 0?"top-right":d.fullscreenControl;this.addControl(new $p({}),de)}this.isReady=!0,this.fire("ready",{target:this})}));let l=!1,oe=!1,q;this.once("ready",()=>{l=!0,oe&&this.fire("loadWithTerrain",q)}),this.once("style.load",()=>{var Te;const{minimap:de}=d;if(typeof de=="object"){const{zoom:et,center:lt,style:Xe,language:ft,apiKey:tt,maptilerLogo:St,antialias:Ct,refreshExpiredTiles:Ue,maxBounds:gt,scrollZoom:Qe,minZoom:rt,maxZoom:Ve,boxZoom:pt,locale:Ge,fadeDuration:Rt,crossSourceCollisions:it,clickTolerance:ct,bounds:st,fitBoundsOptions:yt,pixelRatio:Ot,validateStyle:Vt}=d;this.minimap=new lh(de,{zoom:et,center:lt,style:Xe,language:ft,apiKey:tt,container:"null",maptilerLogo:St,antialias:Ct,refreshExpiredTiles:Ue,maxBounds:gt,scrollZoom:Qe,minZoom:rt,maxZoom:Ve,boxZoom:pt,locale:Ge,fadeDuration:Rt,crossSourceCollisions:it,clickTolerance:ct,bounds:st,fitBoundsOptions:yt,pixelRatio:Ot,validateStyle:Vt}),this.addControl(this.minimap,(Te=de.position)!=null?Te:"bottom-left")}else de===!0?(this.minimap=new lh({},d),this.addControl(this.minimap,"bottom-left")):de!==void 0&&de!==!1&&(this.minimap=new lh({},d),this.addControl(this.minimap,de))});const be=Te=>{Te.terrain&&(oe=!0,q={type:"loadWithTerrain",target:this,terrain:Te.terrain},this.off("terrain",be),l&&this.fire("loadWithTerrain",q))};this.on("terrain",be),d.terrain&&this.enableTerrain((D=d.terrainExaggeration)!=null?D:this.terrainExaggeration)}onLoadAsync(){return xn(this,null,function*(){return new Promise(d=>{if(this.loaded())return d(this);this.once("load",()=>{d(this)})})})}onReadyAsync(){return xn(this,null,function*(){return new Promise(d=>{if(this.isReady)return d(this);this.once("ready",()=>{d(this)})})})}onLoadWithTerrainAsync(){return xn(this,null,function*(){return new Promise(d=>{if(this.isReady&&this.terrain)return d(this);this.once("loadWithTerrain",()=>{d(this)})})})}setStyle(d,x){var A;return(A=this.minimap)==null||A.setStyle(d),this.forceLanguageUpdate=!0,this.once("idle",()=>{this.forceLanguageUpdate=!1}),super.setStyle(kp(d),x)}addLayer(d,x){var A;return(A=this.minimap)==null||A.addLayer(d,x),super.addLayer(d,x)}moveLayer(d,x){var A;return(A=this.minimap)==null||A.moveLayer(d,x),super.moveLayer(d,x)}removeLayer(d){var x;return(x=this.minimap)==null||x.removeLayer(d),super.removeLayer(d)}setLayerZoomRange(d,x,A){var D;return(D=this.minimap)==null||D.setLayerZoomRange(d,x,A),super.setLayerZoomRange(d,x,A)}setFilter(d,x,A){var D;return(D=this.minimap)==null||D.setFilter(d,x,A),super.setFilter(d,x,A)}setPaintProperty(d,x,A,D){var V;return(V=this.minimap)==null||V.setPaintProperty(d,x,A,D),super.setPaintProperty(d,x,A,D)}setLayoutProperty(d,x,A,D){var V;return(V=this.minimap)==null||V.setLayoutProperty(d,x,A,D),super.setLayoutProperty(d,x,A,D)}setGlyphs(d,x){var A;return(A=this.minimap)==null||A.setGlyphs(d,x),super.setGlyphs(d,x)}getStyleLanguage(){return!this.style.stylesheet.metadata||typeof this.style.stylesheet.metadata!="object"?null:"maptiler:language"in this.style.stylesheet.metadata&&typeof this.style.stylesheet.metadata["maptiler:language"]=="string"?this.style.stylesheet.metadata["maptiler:language"]:null}setLanguage(d){var x,A;(A=(x=this.minimap)==null?void 0:x.map)==null||A.setLanguage(d),this.onStyleReady(()=>{this.setPrimaryLanguage(d)})}setPrimaryLanguage(d){const x=this.getStyleLanguage();if(!(d===Dt.STYLE&&(x===Dt.AUTO||x===Dt.VISITOR))&&(d!==Dt.STYLE&&(this.languageAlwaysBeenStyle=!1),this.languageAlwaysBeenStyle||this.primaryLanguage===d&&!this.forceLanguageUpdate))return;if(!Qc(d)){console.warn(`The language "${d}" is not supported.`);return}if(this.primaryLanguage===Dt.STYLE_LOCK){console.warn("The language cannot be changed because this map has been instantiated with the STYLE_LOCK language flag.");return}this.primaryLanguage=d;let A=d;if(d===Dt.STYLE){if(!x){console.warn("The style has no default languages.");return}if(!Qc(x)){console.warn("The language defined in the style is not valid.");return}A=x}let D=Dt.LOCAL,V=`{${D}}`;A==Dt.VISITOR?(D=eh(),V=["case",["all",["has",D],["has",Dt.LOCAL]],["case",["==",["get",D],["get",Dt.LOCAL]],["get",Dt.LOCAL],["format",["get",D],{"font-scale":.8},`
|
|
581
|
+
`,["get",Dt.LOCAL],{"font-scale":1.1}]],["get",Dt.LOCAL]]):A==Dt.VISITOR_ENGLISH?(D=Dt.ENGLISH,V=["case",["all",["has",D],["has",Dt.LOCAL]],["case",["==",["get",D],["get",Dt.LOCAL]],["get",Dt.LOCAL],["format",["get",D],{"font-scale":.8},`
|
|
582
|
+
`,["get",Dt.LOCAL],{"font-scale":1.1}]],["get",Dt.LOCAL]]):A===Dt.AUTO?(D=eh(),V=["case",["has",D],["get",D],["get",Dt.LOCAL]]):A===Dt.LOCAL?(D=Dt.LOCAL,V=`{${D}}`):(D=A,V=["case",["has",D],["get",D],["get",Dt.LOCAL]]);const{layers:Q}=this.getStyle();for(const{id:l,layout:oe}of Q){if(!oe||!("text-field"in oe))continue;const q=this.getLayoutProperty(l,"text-field");typeof q=="string"&&(q.toLowerCase().includes("ref")||q.toLowerCase().includes("housenumber"))||this.setLayoutProperty(l,"text-field",V)}}getPrimaryLanguage(){return this.primaryLanguage}getTerrainExaggeration(){return this.terrainExaggeration}hasTerrain(){return this.isTerrainEnabled}growTerrain(d,x=1e3){if(!this.terrain)return;const A=performance.now(),D=this.terrain.exaggeration,V=d-D,Q=()=>{if(!this.terrain||this.terrainFlattening)return;const l=(performance.now()-A)/x;if(l<.99){const oe=1-Math.pow(1-l,4),q=D+oe*V;this.terrain.exaggeration=q,requestAnimationFrame(Q)}else this.terrainGrowing=!1,this.terrainFlattening=!1,this.terrain.exaggeration=d;this.triggerRepaint()};this.terrainGrowing=!0,this.terrainFlattening=!1,requestAnimationFrame(Q)}enableTerrain(d=this.terrainExaggeration){if(d<0){console.warn("Terrain exaggeration cannot be negative.");return}const x=D=>xn(this,null,function*(){!this.terrain||D.type!=="data"||D.dataType!=="source"||!("source"in D)||D.sourceId!=="maptiler-terrain"||D.source.type!=="raster-dem"||D.isSourceLoaded&&(this.off("data",x),this.growTerrain(d))}),A=()=>{this.isTerrainEnabled=!0,this.terrainExaggeration=d,this.on("data",x),this.addSource(Ur.terrainSourceId,{type:"raster-dem",url:Ur.terrainSourceURL}),this.setTerrain({source:Ur.terrainSourceId,exaggeration:0})};if(this.getTerrain()){this.isTerrainEnabled=!0,this.growTerrain(d);return}this.loaded()||this.isTerrainEnabled?A():this.once("load",()=>{this.getTerrain()&&this.getSource(Ur.terrainSourceId)||A()})}disableTerrain(){if(!this.terrain)return;this.isTerrainEnabled=!1;const d=1*1e3,x=performance.now(),A=this.terrain.exaggeration,D=()=>{if(!this.terrain||this.terrainGrowing)return;const V=(performance.now()-x)/d;if(V<.99){const Q=Math.pow(1-V,4),l=A*Q;this.terrain.exaggeration=l,requestAnimationFrame(D)}else this.terrain.exaggeration=0,this.terrainGrowing=!1,this.terrainFlattening=!1,this.setTerrain(),this.getSource(Ur.terrainSourceId)&&this.removeSource(Ur.terrainSourceId);this.triggerRepaint()};this.terrainGrowing=!1,this.terrainFlattening=!0,requestAnimationFrame(D)}setTerrainExaggeration(d,x=!0){!x&&this.terrain?(this.terrainExaggeration=d,this.terrain.exaggeration=d,this.triggerRepaint()):this.enableTerrain(d)}onStyleReady(d){this.isStyleLoaded()?d():this.once("styledata",()=>{d()})}fitToIpBounds(){return xn(this,null,function*(){const d=yield Nc.info();this.fitBounds(d.country_bounds,{duration:0,padding:100})})}centerOnIpPoint(d){return xn(this,null,function*(){var x,A;const D=yield Nc.info();this.jumpTo({center:[(x=D?.longitude)!=null?x:0,(A=D?.latitude)!=null?A:0],zoom:d||11})})}getCameraHash(){const d=new Float32Array(5),x=this.getCenter();return d[0]=x.lng,d[1]=x.lat,d[2]=this.getZoom(),d[3]=this.getPitch(),d[4]=this.getBearing(),df.fromUint8Array(new Uint8Array(d.buffer))}getSdkConfig(){return _r}getMaptilerSessionId(){return xp}setTransformRequest(d){return super.setTransformRequest(Pp(d)),this}loadImageAsync(d){return xn(this,null,function*(){return new Promise((x,A)=>{this.loadImage(d,(D,V)=>{if(D){A(D);return}x(V)})})})}};class Gg extends vt.Marker{addTo(d){return super.addTo(d)}}class qg extends vt.Popup{addTo(d){return super.addTo(d)}}class Zg extends vt.Style{constructor(d,x={}){super(d,x)}}class Hg extends vt.CanvasSource{onAdd(d){super.onAdd(d)}}class Wg extends vt.GeoJSONSource{onAdd(d){super.onAdd(d)}}class Kg extends vt.ImageSource{onAdd(d){super.onAdd(d)}}class Xg extends vt.RasterTileSource{onAdd(d){super.onAdd(d)}}class Yg extends vt.RasterDEMTileSource{onAdd(d){super.onAdd(d)}}class Jg extends vt.VectorTileSource{onAdd(d){super.onAdd(d)}}class Qg extends vt.VideoSource{onAdd(d){super.onAdd(d)}}class ey extends vt.TerrainControl{onAdd(d){return super.onAdd(d)}}var ty=Object.defineProperty,iy=(y,d,x)=>d in y?ty(y,d,{enumerable:!0,configurable:!0,writable:!0,value:x}):y[d]=x,Yp=(y,d,x)=>(iy(y,typeof d!="symbol"?d+"":d,x),x);class eo{constructor(d,x){Yp(this,"x"),Yp(this,"y"),this.x=d,this.y=x}_matMult(d){const x=d[0]*this.x+d[1]*this.y,A=d[2]*this.x+d[3]*this.y;return this.x=x,this.y=A,this}_add(d){return this.x+=d.x,this.y+=d.y,this}_sub(d){return this.x-=d.x,this.y-=d.y,this}_mult(d){return this.x*=d,this.y*=d,this}_div(d){return this.x/=d,this.y/=d,this}_multByPoint(d){return this.x*=d.x,this.y*=d.y,this}_divByPoint(d){return this.x/=d.x,this.y/=d.y,this}_unit(){return this._div(this.mag()),this}_perp(){const d=this.y;return this.y=this.x,this.x=-d,this}_rotate(d){const x=Math.cos(d),A=Math.sin(d),D=x*this.x-A*this.y,V=A*this.x+x*this.y;return this.x=D,this.y=V,this}_rotateAround(d,x){const A=Math.cos(d),D=Math.sin(d),V=x.x+A*(this.x-x.x)-D*(this.y-x.y),Q=x.y+D*(this.x-x.x)+A*(this.y-x.y);return this.x=V,this.y=Q,this}_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}clone(){return new eo(this.x,this.y)}add(d){return this.clone()._add(d)}sub(d){return this.clone()._sub(d)}multByPoint(d){return this.clone()._multByPoint(d)}divByPoint(d){return this.clone()._divByPoint(d)}mult(d){return this.clone()._mult(d)}div(d){return this.clone()._div(d)}rotate(d){return this.clone()._rotate(d)}rotateAround(d,x){return this.clone()._rotateAround(d,x)}matMult(d){return this.clone()._matMult(d)}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(d){return this.x===d.x&&this.y===d.y}dist(d){return Math.sqrt(this.distSqr(d))}distSqr(d){const x=d.x-this.x,A=d.y-this.y;return x*x+A*A}angle(){return Math.atan2(this.y,this.x)}angleTo(d){return Math.atan2(this.y-d.y,this.x-d.x)}angleWith(d){return this.angleWithSep(d.x,d.y)}angleWithSep(d,x){return Math.atan2(this.x*x-this.y*d,this.x*d+this.y*x)}static convert(d){return d instanceof eo?d:Array.isArray(d)?new eo(d[0],d[1]):d}}var ry=Object.defineProperty,Jp=Object.getOwnPropertySymbols,ny=Object.prototype.hasOwnProperty,ay=Object.prototype.propertyIsEnumerable,Qp=(y,d,x)=>d in y?ry(y,d,{enumerable:!0,configurable:!0,writable:!0,value:x}):y[d]=x,Ma=(y,d)=>{for(var x in d||(d={}))ny.call(d,x)&&Qp(y,x,d[x]);if(Jp)for(var x of Jp(d))ay.call(d,x)&&Qp(y,x,d[x]);return y};function wl(y){if(typeof DOMParser<"u"){const d=new DOMParser().parseFromString(y,"application/xml");if(d.querySelector("parsererror"))throw new Error("The provided string is not valid XML");return d}else throw new Error("No XML parser found")}function hh(y,d){if(!y.hasChildNodes())return!1;for(const x of Array.from(y.childNodes)){const A=x.nodeName;if(typeof A=="string"&&A.trim().toLowerCase()===d.toLowerCase())return!0}return!1}function uh(y){if(typeof XMLSerializer<"u")return new XMLSerializer().serializeToString(y);throw new Error("No XML serializer found")}function ph(y){if(typeof y=="string"&&(y=wl(y)),!hh(y,"gpx"))throw new Error("The XML document is not valid GPX");const d=Bi(y,"trk"),x=Bi(y,"rte"),A=Bi(y,"wpt"),D={type:"FeatureCollection",features:[]};for(const V of Array.from(d)){const Q=cy(V);Q&&D.features.push(Q)}for(const V of Array.from(x)){const Q=hy(V);Q&&D.features.push(Q)}for(const V of Array.from(A))D.features.push(uy(V));return D}function dh(y,d){var x;if(typeof y=="string"&&(y=wl(y)),!hh(y,"kml"))throw new Error("The XML document is not valid KML");const A={type:"FeatureCollection",features:[]},D={},V={},Q={},l=Bi(y,"Placemark"),oe=Bi(y,"Style"),q=Bi(y,"StyleMap");for(const be of Array.from(oe)){const Te=rd(d!==void 0?d(be):uh(be)).toString(16);D["#"+ka(be,"id")]=Te,V[Te]=be}for(const be of Array.from(q)){D["#"+ka(be,"id")]=rd(d!==void 0?d(be):uh(be)).toString(16);const Te=Bi(be,"Pair"),de={};for(const et of Array.from(Te))de[(x=Gt(ut(et,"key")))!=null?x:""]=Gt(ut(et,"styleUrl"));Q["#"+ka(be,"id")]=de}for(const be of Array.from(l))A.features=A.features.concat(ly(be,D,V,Q));return A}function ed(y){if(y===null)return["#000000",1];let d="",x=1;return y.substring(0,1)==="#"&&(y=y.substring(1)),(y.length===6||y.length===3)&&(d=y),y.length===8&&(x=parseInt(y.substring(0,2),16)/255,d="#"+y.substring(6,8)+y.substring(4,6)+y.substring(2,4)),[d??"#000000",x??1]}function sy(y){return ad(y.split(" "))}function oy(y){var d;let x=Bi(y,"coord");const A=[],D=[];x.length===0&&(x=Bi(y,"gx:coord"));for(const Q of Array.from(x))A.push(sy((d=Gt(Q))!=null?d:""));const V=Bi(y,"when");for(const Q of Array.from(V))D.push(Gt(Q));return{coords:A,times:D}}function Sl(y){var d,x,A;const D=["Polygon","LineString","Point","Track","gx:Track"];let V,Q,l,oe,q;const be=[],Te=[];if(ut(y,"MultiGeometry")!==null)return Sl(ut(y,"MultiGeometry"));if(ut(y,"MultiTrack")!==null)return Sl(ut(y,"MultiTrack"));if(ut(y,"gx:MultiTrack")!==null)return Sl(ut(y,"gx:MultiTrack"));for(l=0;l<D.length;l++)if(Q=Bi(y,D[l]),Q){for(oe=0;oe<Q.length;oe++)if(V=Q[oe],D[l]==="Point")be.push({type:"Point",coordinates:sd((d=Gt(ut(V,"coordinates")))!=null?d:"")});else if(D[l]==="LineString")be.push({type:"LineString",coordinates:od((x=Gt(ut(V,"coordinates")))!=null?x:"")});else if(D[l]==="Polygon"){const de=Bi(V,"LinearRing"),et=[];for(q=0;q<de.length;q++)et.push(od((A=Gt(ut(de[q],"coordinates")))!=null?A:""));be.push({type:"Polygon",coordinates:et})}else if(D[l]==="Track"||D[l]==="gx:Track"){const de=oy(V);be.push({type:"LineString",coordinates:de.coords}),de.times.length&&Te.push(de.times)}}return{geoms:be,coordTimes:Te}}function ly(y,d,x,A){var D,V,Q,l,oe,q,be,Te,de,et;const lt=Sl(y),Xe={},ft=Gt(ut(y,"name")),tt=Gt(ut(y,"address")),St=Gt(ut(y,"description")),Ct=ut(y,"TimeSpan"),Ue=ut(y,"TimeStamp"),gt=ut(y,"ExtendedData"),Qe=ut(y,"visibility");let rt,Ve=Gt(ut(y,"styleUrl")),pt=ut(y,"LineStyle"),Ge=ut(y,"PolyStyle");if(!lt.geoms.length)return[];if(ft&&(Xe.name=ft),tt&&(Xe.address=tt),Ve){Ve[0]!=="#"&&(Ve="#"+Ve),Xe.styleUrl=Ve,d[Ve]&&(Xe.styleHash=d[Ve]),A[Ve]&&(Xe.styleMapHash=A[Ve],Xe.styleHash=d[(D=A[Ve].normal)!=null?D:""]);const it=x[(V=Xe.styleHash)!=null?V:""];if(it){pt||(pt=ut(it,"LineStyle")),Ge||(Ge=ut(it,"PolyStyle"));const ct=ut(it,"IconStyle");if(ct){const st=ut(ct,"Icon");if(st){const yt=Gt(ut(st,"href"));yt&&(Xe.icon=yt)}}}}if(St&&(Xe.description=St),Ct){const it=Gt(ut(Ct,"begin")),ct=Gt(ut(Ct,"end"));it&&ct&&(Xe.timespan={begin:it,end:ct})}if(Ue!==null&&(Xe.timestamp=(Q=Gt(ut(Ue,"when")))!=null?Q:new Date().toISOString()),pt!==null){const it=ed(Gt(ut(pt,"color"))),ct=it[0],st=it[1],yt=parseFloat((l=Gt(ut(pt,"width")))!=null?l:"");ct&&(Xe.stroke=ct),isNaN(st)||(Xe["stroke-opacity"]=st),isNaN(yt)||(Xe["stroke-width"]=yt)}if(Ge){const it=ed(Gt(ut(Ge,"color"))),ct=it[0],st=it[1],yt=Gt(ut(Ge,"fill")),Ot=Gt(ut(Ge,"outline"));ct&&(Xe.fill=ct),isNaN(st)||(Xe["fill-opacity"]=st),yt&&(Xe["fill-opacity"]=yt==="1"?Xe["fill-opacity"]||1:0),Ot&&(Xe["stroke-opacity"]=Ot==="1"?Xe["stroke-opacity"]||1:0)}if(gt){const it=Bi(gt,"Data"),ct=Bi(gt,"SimpleData");for(rt=0;rt<it.length;rt++)Xe[(oe=it[rt].getAttribute("name"))!=null?oe:""]=(q=Gt(ut(it[rt],"value")))!=null?q:"";for(rt=0;rt<ct.length;rt++)Xe[(be=ct[rt].getAttribute("name"))!=null?be:""]=(Te=Gt(ct[rt]))!=null?Te:""}Qe!==null&&(Xe.visibility=(de=Gt(Qe))!=null?de:""),lt.coordTimes.length!==0&&(Xe.coordTimes=lt.coordTimes.length===1?lt.coordTimes[0]:lt.coordTimes);const Rt={type:"Feature",geometry:lt.geoms.length===1?lt.geoms[0]:{type:"GeometryCollection",geometries:lt.geoms},properties:Xe};return ka(y,"id")&&(Rt.id=(et=ka(y,"id"))!=null?et:void 0),[Rt]}function td(y,d){const x=Bi(y,d),A=[],D=[];let V=[];const Q=x.length;if(!(Q<2)){for(let l=0;l<Q;l++){const oe=ld(x[l]);A.push(oe.coordinates),oe.time&&D.push(oe.time),(oe.heartRate||V.length)&&(V.length===0&&(V=new Array(l).fill(null)),V.push(oe.heartRate))}return{line:A,times:D,heartRates:V}}}function cy(y){const d=Bi(y,"trkseg"),x=[],A=[],D=[];let V;for(let l=0;l<d.length;l++)if(V=td(d[l],"trkpt"),V!==void 0&&(V.line&&x.push(V.line),V.times&&V.times.length&&A.push(V.times),D.length||V.heartRates&&V.heartRates.length)){if(!D.length)for(let oe=0;oe<l;oe++)D.push(new Array(x[oe].length).fill(null));V.heartRates&&V.heartRates.length?D.push(V.heartRates):D.push(new Array(V.line.length).fill(null))}if(x.length===0)return;const Q=Ma(Ma({},mh(y)),id(ut(y,"extensions")));return A.length!==0&&(Q.coordTimes=x.length===1?A[0]:A),D.length!==0&&(Q.heartRates=x.length===1?D[0]:D),x.length===1?{type:"Feature",properties:Q,geometry:{type:"LineString",coordinates:x[0]}}:{type:"Feature",properties:Q,geometry:{type:"MultiLineString",coordinates:x}}}function hy(y){const d=td(y,"rtept");return d===void 0?void 0:{type:"Feature",properties:Ma(Ma({},mh(y)),id(ut(y,"extensions"))),geometry:{type:"LineString",coordinates:d.line}}}function uy(y){return{type:"Feature",properties:Ma(Ma({},mh(y)),fh(y,["sym"])),geometry:{type:"Point",coordinates:ld(y).coordinates}}}function id(y){var d,x;const A={};if(y){const D=ut(y,"line");if(D){const V=Gt(ut(D,"color")),Q=parseFloat((d=Gt(ut(D,"opacity")))!=null?d:"0"),l=parseFloat((x=Gt(ut(D,"width")))!=null?x:"0");V&&(A.stroke=V),isNaN(Q)||(A["stroke-opacity"]=Q),isNaN(l)||(A["stroke-width"]=l*96/25.4)}}return A}function mh(y){const d=fh(y,["name","cmt","desc","type","time","keywords"]),x=Bi(y,"link");if(x.length!==0){d.links=[];for(const A of Array.from(x)){const D=Ma({href:ka(A,"href")},fh(A,["text","type"]));d.links.push(D)}}return d}function rd(y){let d=0;if(!y||!y.length)return d;for(let x=0;x<y.length;x++)d=(d<<5)-d+y.charCodeAt(x)|0;return d}function Bi(y,d){return y.getElementsByTagName(d)}function ka(y,d){return y.getAttribute(d)}function nd(y,d){var x;return parseFloat((x=ka(y,d))!=null?x:"0")}function ut(y,d){const x=Bi(y,d);return x.length?x[0]:null}function py(y){return y.normalize&&y.normalize(),y}function ad(y){return y.map(parseFloat).map(d=>isNaN(d)?null:d)}function Gt(y){return y&&py(y),y&&y.textContent}function fh(y,d){var x;const A={};let D,V;for(V=0;V<d.length;V++)D=ut(y,d[V]),D&&(A[d[V]]=(x=Gt(D))!=null?x:"");return A}function sd(y){return ad(y.replace(/\s*/g,"").split(","))}function od(y){const d=y.replace(/^\s*|\s*$/g,"").split(/\s+/),x=[];for(const A of d)x.push(sd(A));return x}function ld(y){var d,x;const A=[nd(y,"lon"),nd(y,"lat")],D=ut(y,"ele"),V=ut(y,"gpxtpx:hr")||ut(y,"hr"),Q=ut(y,"time");let l;return D&&(l=parseFloat((d=Gt(D))!=null?d:"0"),isNaN(l)||A.push(l)),{coordinates:A,time:Q?Gt(Q):null,heartRate:V!==null?parseFloat((x=Gt(V))!=null?x:"0"):null}}function cd(y){try{typeof y=="string"&&(y=wl(y))}catch{return null}try{return ph(y)}catch{}try{return dh(y)}catch{}return null}var dy=Object.defineProperty,my=(y,d,x)=>d in y?dy(y,d,{enumerable:!0,configurable:!0,writable:!0,value:x}):y[d]=x,hd=(y,d,x)=>(my(y,typeof d!="symbol"?d+"":d,x),x);function Tl(y){const d=y.toString(16);return d.length==1?"0"+d:d}function fy(y){return"#"+Tl(y[0])+Tl(y[1])+Tl(y[2])+(y.length===4?Tl(y[3]):"")}class Ye extends Array{constructor(d={}){super(),hd(this,"min",0),hd(this,"max",1),"min"in d&&(this.min=d.min),"max"in d&&(this.max=d.max),"stops"in d&&this.setStops(d.stops,{clone:!1})}static fromArrayDefinition(d){return new Ye({stops:d.map(x=>({value:x[0],color:x[1]}))})}setStops(d,x={clone:!0}){const A=x.clone?this.clone():this;A.length=0;let D=1/0,V=-1/0;for(let Q=0;Q<d.length;Q+=1)D=Math.min(D,d[Q].value),V=Math.max(V,d[Q].value),A.push({value:d[Q].value,color:d[Q].color.slice()});return A.sort((Q,l)=>Q.value<l.value?-1:1),this.min=D,this.max=V,A}scale(d,x,A={clone:!0}){const D=A.clone,V=this[0].value,Q=this.at(-1).value-V,l=x-d,oe=[];for(let q=0;q<this.length;q+=1){const be=(this[q].value-V)/Q*l+d;D?oe.push({value:be,color:this[q].color.slice()}):this[q].value=be}return D?new Ye({stops:oe}):this}at(d){return d<0?this[this.length+d]:this[d]}clone(){return new Ye({stops:this.getRawColorStops()})}getRawColorStops(){const d=[];for(let x=0;x<this.length;x+=1)d.push({value:this[x].value,color:this[x].color});return d}reverse(d={clone:!0}){const x=d.clone?this.clone():this;for(let A=0;A<~~(x.length/2);A+=1){const D=x[A].color;x[A].color=x.at(-(A+1)).color,x.at(-(A+1)).color=D}return x}getBounds(){return{min:this.min,max:this.max}}getColor(d,x={smooth:!0}){if(d<=this[0].value)return this[0].color;if(d>=this.at(-1).value)return this.at(-1).color;for(let A=0;A<this.length-1;A+=1){if(d>this[A+1].value)continue;const D=this[A].color;if(!x.smooth)return D.slice();const V=this[A].value,Q=this[A+1].value,l=this[A+1].color,oe=(Q-d)/(Q-V);return D.map((q,be)=>Math.round(q*oe+l[be]*(1-oe)))}return[0,0,0]}getColorHex(d,x={smooth:!0,withAlpha:!1}){return fy(this.getColor(d,x))}getColorRelative(d,x={smooth:!0}){const A=this.getBounds();return this.getColor(A.min+d*(A.max-A.min),x)}getCanvasStrip(d={horizontal:!0,size:512,smooth:!0}){const x=document.createElement("canvas");x.width=d.horizontal?d.size:1,x.height=d.horizontal?1:d.size;const A=x.getContext("2d");if(!A)throw new Error("Canvs context is missing");const D=A.getImageData(0,0,x.width,x.height),V=D.data,Q=d.size,l=this[0].value,oe=(this.at(-1).value-l)/Q;for(let q=0;q<Q;q+=1){const be=this.getColor(l+q*oe,{smooth:d.smooth});V[q*4]=be[0],V[q*4+1]=be[1],V[q*4+2]=be[2],V[q*4+3]=be.length>3?be[3]:255}return A.putImageData(D,0,0),x}resample(d,x=15){const A=this.getBounds(),D=this.scale(0,1),V=1/(x-1);let Q;if(d==="ease-in-square")Q=Array.from({length:x},(l,oe)=>{const q=oe*V,be=Math.pow(q,2),Te=D.getColor(be);return{value:q,color:Te}});else if(d==="ease-out-square")Q=Array.from({length:x},(l,oe)=>{const q=oe*V,be=1-Math.pow(1-q,2),Te=D.getColor(be);return{value:q,color:Te}});else if(d==="ease-out-sqrt")Q=Array.from({length:x},(l,oe)=>{const q=oe*V,be=Math.pow(q,.5),Te=D.getColor(be);return{value:q,color:Te}});else if(d==="ease-in-sqrt")Q=Array.from({length:x},(l,oe)=>{const q=oe*V,be=1-Math.pow(1-q,.5),Te=D.getColor(be);return{value:q,color:Te}});else if(d==="ease-out-exp")Q=Array.from({length:x},(l,oe)=>{const q=oe*V,be=1-Math.pow(2,-10*q),Te=D.getColor(be);return{value:q,color:Te}});else if(d==="ease-in-exp")Q=Array.from({length:x},(l,oe)=>{const q=oe*V,be=Math.pow(2,10*q-10),Te=D.getColor(be);return{value:q,color:Te}});else throw new Error("Invalid ressampling method.");return new Ye({stops:Q}).scale(A.min,A.max)}transparentStart(){const d=this.getRawColorStops();return d.unshift({value:d[0].value,color:d[0].color.slice()}),d[1].value+=.001,d.forEach(x=>{x.color.length===3&&x.color.push(255)}),d[0].color[3]=0,new Ye({stops:d})}hasTransparentStart(){return this[0].color.length===4&&this[0].color[3]===0}}const gh={NULL:new Ye({stops:[{value:0,color:[0,0,0,0]},{value:1,color:[0,0,0,0]}]}),GRAY:new Ye({stops:[{value:0,color:[0,0,0]},{value:1,color:[255,255,255]}]}),JET:new Ye({stops:[{value:0,color:[0,0,131]},{value:.125,color:[0,60,170]},{value:.375,color:[5,255,255]},{value:.625,color:[255,255,0]},{value:.875,color:[250,0,0]},{value:1,color:[128,0,0]}]}),HSV:new Ye({stops:[{value:0,color:[255,0,0]},{value:.169,color:[253,255,2]},{value:.173,color:[247,255,2]},{value:.337,color:[0,252,4]},{value:.341,color:[0,252,10]},{value:.506,color:[1,249,255]},{value:.671,color:[2,0,253]},{value:.675,color:[8,0,253]},{value:.839,color:[255,0,251]},{value:.843,color:[255,0,245]},{value:1,color:[255,0,6]}]}),HOT:new Ye({stops:[{value:0,color:[0,0,0]},{value:.3,color:[230,0,0]},{value:.6,color:[255,210,0]},{value:1,color:[255,255,255]}]}),SPRING:new Ye({stops:[{value:0,color:[255,0,255]},{value:1,color:[255,255,0]}]}),SUMMER:new Ye({stops:[{value:0,color:[0,128,102]},{value:1,color:[255,255,102]}]}),AUTOMN:new Ye({stops:[{value:0,color:[255,0,0]},{value:1,color:[255,255,0]}]}),WINTER:new Ye({stops:[{value:0,color:[0,0,255]},{value:1,color:[0,255,128]}]}),BONE:new Ye({stops:[{value:0,color:[0,0,0]},{value:.376,color:[84,84,116]},{value:.753,color:[169,200,200]},{value:1,color:[255,255,255]}]}),COPPER:new Ye({stops:[{value:0,color:[0,0,0]},{value:.804,color:[255,160,102]},{value:1,color:[255,199,127]}]}),GREYS:new Ye({stops:[{value:0,color:[0,0,0]},{value:1,color:[255,255,255]}]}),YIGNBU:new Ye({stops:[{value:0,color:[8,29,88]},{value:.125,color:[37,52,148]},{value:.25,color:[34,94,168]},{value:.375,color:[29,145,192]},{value:.5,color:[65,182,196]},{value:.625,color:[127,205,187]},{value:.75,color:[199,233,180]},{value:.875,color:[237,248,217]},{value:1,color:[255,255,217]}]}),GREENS:new Ye({stops:[{value:0,color:[0,68,27]},{value:.125,color:[0,109,44]},{value:.25,color:[35,139,69]},{value:.375,color:[65,171,93]},{value:.5,color:[116,196,118]},{value:.625,color:[161,217,155]},{value:.75,color:[199,233,192]},{value:.875,color:[229,245,224]},{value:1,color:[247,252,245]}]}),YIORRD:new Ye({stops:[{value:0,color:[128,0,38]},{value:.125,color:[189,0,38]},{value:.25,color:[227,26,28]},{value:.375,color:[252,78,42]},{value:.5,color:[253,141,60]},{value:.625,color:[254,178,76]},{value:.75,color:[254,217,118]},{value:.875,color:[255,237,160]},{value:1,color:[255,255,204]}]}),BLUERED:new Ye({stops:[{value:0,color:[0,0,255]},{value:1,color:[255,0,0]}]}),RDBU:new Ye({stops:[{value:0,color:[5,10,172]},{value:.35,color:[106,137,247]},{value:.5,color:[190,190,190]},{value:.6,color:[220,170,132]},{value:.7,color:[230,145,90]},{value:1,color:[178,10,28]}]}),PICNIC:new Ye({stops:[{value:0,color:[0,0,255]},{value:.1,color:[51,153,255]},{value:.2,color:[102,204,255]},{value:.3,color:[153,204,255]},{value:.4,color:[204,204,255]},{value:.5,color:[255,255,255]},{value:.6,color:[255,204,255]},{value:.7,color:[255,153,255]},{value:.8,color:[255,102,204]},{value:.9,color:[255,102,102]},{value:1,color:[255,0,0]}]}),RAINBOW:new Ye({stops:[{value:0,color:[150,0,90]},{value:.125,color:[0,0,200]},{value:.25,color:[0,25,255]},{value:.375,color:[0,152,255]},{value:.5,color:[44,255,150]},{value:.625,color:[151,255,0]},{value:.75,color:[255,234,0]},{value:.875,color:[255,111,0]},{value:1,color:[255,0,0]}]}),PORTLAND:new Ye({stops:[{value:0,color:[12,51,131]},{value:.25,color:[10,136,186]},{value:.5,color:[242,211,56]},{value:.75,color:[242,143,56]},{value:1,color:[217,30,30]}]}),BLACKBODY:new Ye({stops:[{value:0,color:[0,0,0]},{value:.2,color:[230,0,0]},{value:.4,color:[230,210,0]},{value:.7,color:[255,255,255]},{value:1,color:[160,200,255]}]}),EARTH:new Ye({stops:[{value:0,color:[0,0,130]},{value:.1,color:[0,180,180]},{value:.2,color:[40,210,40]},{value:.4,color:[230,230,50]},{value:.6,color:[120,70,20]},{value:1,color:[255,255,255]}]}),ELECTRIC:new Ye({stops:[{value:0,color:[0,0,0]},{value:.15,color:[30,0,100]},{value:.4,color:[120,0,100]},{value:.6,color:[160,90,0]},{value:.8,color:[230,200,0]},{value:1,color:[255,250,220]}]}),VIRIDIS:new Ye({stops:[{value:0,color:[68,1,84]},{value:.13,color:[71,44,122]},{value:.25,color:[59,81,139]},{value:.38,color:[44,113,142]},{value:.5,color:[33,144,141]},{value:.63,color:[39,173,129]},{value:.75,color:[92,200,99]},{value:.88,color:[170,220,50]},{value:1,color:[253,231,37]}]}),INFERNO:new Ye({stops:[{value:0,color:[0,0,4]},{value:.13,color:[31,12,72]},{value:.25,color:[85,15,109]},{value:.38,color:[136,34,106]},{value:.5,color:[186,54,85]},{value:.63,color:[227,89,51]},{value:.75,color:[249,140,10]},{value:.88,color:[249,201,50]},{value:1,color:[252,255,164]}]}),MAGMA:new Ye({stops:[{value:0,color:[0,0,4]},{value:.13,color:[28,16,68]},{value:.25,color:[79,18,123]},{value:.38,color:[129,37,129]},{value:.5,color:[181,54,122]},{value:.63,color:[229,80,100]},{value:.75,color:[251,135,97]},{value:.88,color:[254,194,135]},{value:1,color:[252,253,191]}]}),PLASMA:new Ye({stops:[{value:0,color:[13,8,135]},{value:.13,color:[75,3,161]},{value:.25,color:[125,3,168]},{value:.38,color:[168,34,150]},{value:.5,color:[203,70,121]},{value:.63,color:[229,107,93]},{value:.75,color:[248,148,65]},{value:.88,color:[253,195,40]},{value:1,color:[240,249,33]}]}),WARM:new Ye({stops:[{value:0,color:[125,0,179]},{value:.13,color:[172,0,187]},{value:.25,color:[219,0,170]},{value:.38,color:[255,0,130]},{value:.5,color:[255,63,74]},{value:.63,color:[255,123,0]},{value:.75,color:[234,176,0]},{value:.88,color:[190,228,0]},{value:1,color:[147,255,0]}]}),COOL:new Ye({stops:[{value:0,color:[125,0,179]},{value:.13,color:[116,0,218]},{value:.25,color:[98,74,237]},{value:.38,color:[68,146,231]},{value:.5,color:[0,204,197]},{value:.63,color:[0,247,146]},{value:.75,color:[0,255,88]},{value:.88,color:[40,255,8]},{value:1,color:[147,255,0]}]}),RAINBOW_SOFT:new Ye({stops:[{value:0,color:[125,0,179]},{value:.1,color:[199,0,180]},{value:.2,color:[255,0,121]},{value:.3,color:[255,108,0]},{value:.4,color:[222,194,0]},{value:.5,color:[150,255,0]},{value:.6,color:[0,255,55]},{value:.7,color:[0,246,150]},{value:.8,color:[50,167,222]},{value:.9,color:[103,51,235]},{value:1,color:[124,0,186]}]}),BATHYMETRY:new Ye({stops:[{value:0,color:[40,26,44]},{value:.13,color:[59,49,90]},{value:.25,color:[64,76,139]},{value:.38,color:[63,110,151]},{value:.5,color:[72,142,158]},{value:.63,color:[85,174,163]},{value:.75,color:[120,206,163]},{value:.88,color:[187,230,172]},{value:1,color:[253,254,204]}]}),CDOM:new Ye({stops:[{value:0,color:[47,15,62]},{value:.13,color:[87,23,86]},{value:.25,color:[130,28,99]},{value:.38,color:[171,41,96]},{value:.5,color:[206,67,86]},{value:.63,color:[230,106,84]},{value:.75,color:[242,149,103]},{value:.88,color:[249,193,135]},{value:1,color:[254,237,176]}]}),CHLOROPHYLL:new Ye({stops:[{value:0,color:[18,36,20]},{value:.13,color:[25,63,41]},{value:.25,color:[24,91,59]},{value:.38,color:[13,119,72]},{value:.5,color:[18,148,80]},{value:.63,color:[80,173,89]},{value:.75,color:[132,196,122]},{value:.88,color:[175,221,162]},{value:1,color:[215,249,208]}]}),DENSITY:new Ye({stops:[{value:0,color:[54,14,36]},{value:.13,color:[89,23,80]},{value:.25,color:[110,45,132]},{value:.38,color:[120,77,178]},{value:.5,color:[120,113,213]},{value:.63,color:[115,151,228]},{value:.75,color:[134,185,227]},{value:.88,color:[177,214,227]},{value:1,color:[230,241,241]}]}),FREESURFACE_BLUE:new Ye({stops:[{value:0,color:[30,4,110]},{value:.13,color:[47,14,176]},{value:.25,color:[41,45,236]},{value:.38,color:[25,99,212]},{value:.5,color:[68,131,200]},{value:.63,color:[114,156,197]},{value:.75,color:[157,181,203]},{value:.88,color:[200,208,216]},{value:1,color:[241,237,236]}]}),FREESURFACE_RED:new Ye({stops:[{value:0,color:[60,9,18]},{value:.13,color:[100,17,27]},{value:.25,color:[142,20,29]},{value:.38,color:[177,43,27]},{value:.5,color:[192,87,63]},{value:.63,color:[205,125,105]},{value:.75,color:[216,162,148]},{value:.88,color:[227,199,193]},{value:1,color:[241,237,236]}]}),OXYGEN:new Ye({stops:[{value:0,color:[64,5,5]},{value:.13,color:[106,6,15]},{value:.25,color:[144,26,7]},{value:.38,color:[168,64,3]},{value:.5,color:[188,100,4]},{value:.63,color:[206,136,11]},{value:.75,color:[220,174,25]},{value:.88,color:[231,215,44]},{value:1,color:[248,254,105]}]}),PAR:new Ye({stops:[{value:0,color:[51,20,24]},{value:.13,color:[90,32,35]},{value:.25,color:[129,44,34]},{value:.38,color:[159,68,25]},{value:.5,color:[182,99,19]},{value:.63,color:[199,134,22]},{value:.75,color:[212,171,35]},{value:.88,color:[221,210,54]},{value:1,color:[225,253,75]}]}),PHASE:new Ye({stops:[{value:0,color:[145,105,18]},{value:.13,color:[184,71,38]},{value:.25,color:[186,58,115]},{value:.38,color:[160,71,185]},{value:.5,color:[110,97,218]},{value:.63,color:[50,123,164]},{value:.75,color:[31,131,110]},{value:.88,color:[77,129,34]},{value:1,color:[145,105,18]}]}),SALINITY:new Ye({stops:[{value:0,color:[42,24,108]},{value:.13,color:[33,50,162]},{value:.25,color:[15,90,145]},{value:.38,color:[40,118,137]},{value:.5,color:[59,146,135]},{value:.63,color:[79,175,126]},{value:.75,color:[120,203,104]},{value:.88,color:[193,221,100]},{value:1,color:[253,239,154]}]}),TEMPERATURE:new Ye({stops:[{value:0,color:[4,35,51]},{value:.13,color:[23,51,122]},{value:.25,color:[85,59,157]},{value:.38,color:[129,79,143]},{value:.5,color:[175,95,130]},{value:.63,color:[222,112,101]},{value:.75,color:[249,146,66]},{value:.88,color:[249,196,65]},{value:1,color:[232,250,91]}]}),TURBIDITY:new Ye({stops:[{value:0,color:[34,31,27]},{value:.13,color:[65,50,41]},{value:.25,color:[98,69,52]},{value:.38,color:[131,89,57]},{value:.5,color:[161,112,59]},{value:.63,color:[185,140,66]},{value:.75,color:[202,174,88]},{value:.88,color:[216,209,126]},{value:1,color:[233,246,171]}]}),VELOCITY_BLUE:new Ye({stops:[{value:0,color:[17,32,64]},{value:.13,color:[35,52,116]},{value:.25,color:[29,81,156]},{value:.38,color:[31,113,162]},{value:.5,color:[50,144,169]},{value:.63,color:[87,173,176]},{value:.75,color:[149,196,189]},{value:.88,color:[203,221,211]},{value:1,color:[254,251,230]}]}),VELOCITY_GREEN:new Ye({stops:[{value:0,color:[23,35,19]},{value:.13,color:[24,64,38]},{value:.25,color:[11,95,45]},{value:.38,color:[39,123,35]},{value:.5,color:[95,146,12]},{value:.63,color:[152,165,18]},{value:.75,color:[201,186,69]},{value:.88,color:[233,216,137]},{value:1,color:[255,253,205]}]}),CUBEHELIX:new Ye({stops:[{value:0,color:[0,0,0]},{value:.07,color:[22,5,59]},{value:.13,color:[60,4,105]},{value:.2,color:[109,1,135]},{value:.27,color:[161,0,147]},{value:.33,color:[210,2,142]},{value:.4,color:[251,11,123]},{value:.47,color:[255,29,97]},{value:.53,color:[255,54,69]},{value:.6,color:[255,85,46]},{value:.67,color:[255,120,34]},{value:.73,color:[255,157,37]},{value:.8,color:[241,191,57]},{value:.87,color:[224,220,93]},{value:.93,color:[218,241,142]},{value:1,color:[227,253,198]}]}),CIVIDIS:new Ye({stops:[{value:0,color:[0,32,77,255]},{value:.125,color:[5,54,110,255]},{value:.25,color:[65,77,108,255]},{value:.375,color:[97,100,111,255]},{value:.5,color:[125,124,121,255]},{value:.625,color:[156,149,120,255]},{value:.75,color:[190,175,111,255]},{value:.875,color:[225,204,94,255]},{value:1,color:[255,235,70,255]}]}),TURBO:new Ye({stops:[{value:0,color:[48,18,59,255]},{value:.125,color:[70,107,227,255]},{value:.25,color:[40,187,236,255]},{value:.375,color:[49,242,153,255]},{value:.5,color:[162,252,60,255]},{value:.625,color:[237,208,58,255]},{value:.75,color:[251,128,34,255]},{value:.875,color:[210,49,5,255]},{value:1,color:[122,4,3,255]}]}),ROCKET:new Ye({stops:[{value:0,color:[250,235,221,0]},{value:.133,color:[250,235,221,255]},{value:.266,color:[246,170,130,255]},{value:.4,color:[240,96,67,255]},{value:.533,color:[203,27,79,255]},{value:.666,color:[132,30,90,255]},{value:.8,color:[63,27,68,255]},{value:1,color:[3,5,26,255]}]}),MAKO:new Ye({stops:[{value:0,color:[11,4,5,255]},{value:.125,color:[43,28,53,255]},{value:.25,color:[62,53,107,255]},{value:.375,color:[59,86,152,255]},{value:.5,color:[53,123,162,255]},{value:.625,color:[53,158,170,255]},{value:.75,color:[73,193,173,255]},{value:.875,color:[150,221,181,255]},{value:1,color:[222,245,229,255]}]})},ud=[["#1D5B79","#468B97","#EF6262","#F3AA60"],["#614BC3","#33BBC5","#85E6C5","#C8FFE0"],["#461959","#7A316F","#CD6688","#AED8CC"],["#0079FF","#00DFA2","#F6FA70","#FF0060"],["#39B5E0","#A31ACB","#FF78F0","#F5EA5A"],["#37E2D5","#590696","#C70A80","#FBCB0A"],["#FFD36E","#FFF56D","#99FFCD","#9FB4FF"],["#00EAD3","#FFF5B7","#FF449F","#005F99"],["#10A19D","#540375","#FF7000","#FFBF00"]];function yh(){return ud[~~(Math.random()*ud.length)][~~(Math.random()*4)]}function Il(){return`maptiler_source_${Mp()}`}function Al(){return`maptiler_layer_${Mp()}`}function pd(y,d){if(d<=y[0].zoom)return y[0].value;if(d>=y[y.length-1].zoom)return y[y.length-1].value;for(let x=0;x<y.length-1;x+=1)if(d>=y[x].zoom&&d<y[x+1].zoom){const A=y[x+1].zoom-y[x].zoom,D=(d-y[x].zoom)/A;return D*y[x+1].value+(1-D)*y[x].value}return 0}function La(y){return["interpolate",["linear"],["zoom"],...y.map(d=>[d.zoom,d.value]).flat()]}function qt(y){return["interpolate",["linear"],["zoom"],...y.map(d=>[d.zoom,d.value]).flat()]}function gy(y,d){if(typeof d=="number"&&typeof y=="number")return 2*d+y;if(typeof d=="number"&&Array.isArray(y))return["interpolate",["linear"],["zoom"],...y.map(x=>[x.zoom,2*d+x.value]).flat()];if(typeof y=="number"&&Array.isArray(d))return["interpolate",["linear"],["zoom"],...d.map(x=>[x.zoom,2*x.value+y]).flat()];if(Array.isArray(y)&&Array.isArray(d)){const x=Array.from(new Set([...y.map(A=>A.zoom),...d.map(A=>A.zoom)])).sort((A,D)=>A<D?-1:1);return["interpolate",["linear"],["zoom"],...x.map(A=>[A,2*pd(d,A)+pd(y,A)]).flat()]}return 0}function yy(y,d){return["interpolate",["linear"],["get",d],...y.map(x=>[x.propertyValue,x.value]).flat()]}function dd(y){const d=y.trimStart(),x=`${d}${" ".repeat(y.length-d.length)}`,A=Array.from(x);if(!A.every(V=>V===" "||V==="_"))throw new Error("A dash pattern must be composed only of whitespace and underscore characters.");if(!(A.some(V=>V==="_")&&A.some(V=>V===" ")))throw new Error("A dash pattern must contain at least one underscore and one whitespace character");const D=[1];for(let V=1;V<A.length;V+=1){const Q=A[V-1],l=A[V];Q===l?D[D.length-1]+=1:D.push(1)}return D}function md(y,d){return["interpolate",["linear"],["get",d],...y.map(x=>[x.value,x.color]).flat()]}function fd(y,d,x=!0){return x?["interpolate",["linear"],["zoom"],0,["interpolate",["linear"],["get",d],...y.map(A=>[A.value,A.pointRadius*.025]).flat()],2,["interpolate",["linear"],["get",d],...y.map(A=>[A.value,A.pointRadius*.05]).flat()],4,["interpolate",["linear"],["get",d],...y.map(A=>[A.value,A.pointRadius*.1]).flat()],8,["interpolate",["linear"],["get",d],...y.map(A=>[A.value,A.pointRadius*.25]).flat()],16,["interpolate",["linear"],["get",d],...y.map(A=>[A.value,A.pointRadius]).flat()]]:["interpolate",["linear"],["get",d],...y.map(A=>[A.value,A.pointRadius]).flat()]}function _y(y,d,x=!0){return x?["interpolate",["linear"],["zoom"],0,["interpolate",["linear"],["get",d],...y.map(A=>[A.propertyValue,A.value*.025]).flat()],2,["interpolate",["linear"],["get",d],...y.map(A=>[A.propertyValue,A.value*.05]).flat()],4,["interpolate",["linear"],["get",d],...y.map(A=>[A.propertyValue,A.value*.1]).flat()],8,["interpolate",["linear"],["get",d],...y.map(A=>[A.propertyValue,A.value*.25]).flat()],16,["interpolate",["linear"],["get",d],...y.map(A=>[A.propertyValue,A.value]).flat()]]:["interpolate",["linear"],["get",d],...y.map(A=>[A.propertyValue,A.value]).flat()]}function gd(y,d){return y.every(x=>x.color[3]===y[0].color[3])?y[0].color[3]?y[0].color[3]/255:1:["interpolate",["linear"],["get",d],...y.getRawColorStops().map(x=>{const A=x.value,D=x.color;return[A,D.length===4?D[3]/255:1]}).flat()]}function vy(y,d=10){return["interpolate",["linear"],["heatmap-density"],...Array.from({length:d+1},(x,A)=>{const D=A/d;return[D,y.getColorHex(D)]}).flat()]}var xy=Object.defineProperty,by=Object.defineProperties,wy=Object.getOwnPropertyDescriptors,yd=Object.getOwnPropertySymbols,Sy=Object.prototype.hasOwnProperty,Ty=Object.prototype.propertyIsEnumerable,_d=(y,d,x)=>d in y?xy(y,d,{enumerable:!0,configurable:!0,writable:!0,value:x}):y[d]=x,za=(y,d)=>{for(var x in d||(d={}))Sy.call(d,x)&&_d(y,x,d[x]);if(yd)for(var x of yd(d))Ty.call(d,x)&&_d(y,x,d[x]);return y},Iy=(y,d)=>by(y,wy(d)),Ay=(y,d,x)=>new Promise((A,D)=>{var V=oe=>{try{l(x.next(oe))}catch(q){D(q)}},Q=oe=>{try{l(x.throw(oe))}catch(q){D(q)}},l=oe=>oe.done?A(oe.value):Promise.resolve(oe.value).then(V,Q);l((x=x.apply(y,d)).next())});function Cy(y,d){return Ay(this,arguments,function*(x,A,D={}){var V,Q,l;if(!A.sourceId&&!A.data)throw new Error("Creating a polyline layer requires an existing .sourceId or a valid .data property");let oe=A.data;if(typeof oe=="string"){if(vl(oe))oe=`https://api.maptiler.com/data/${A.data}/features.json?key=${_r.apiKey}`;else if(((V=oe.split(".").pop())==null?void 0:V.toLowerCase().trim())==="gpx"){const q=yield(yield fetch(oe,D)).text();oe=ph(q)}else if(((Q=oe.split(".").pop())==null?void 0:Q.toLowerCase().trim())==="kml"){const q=yield(yield fetch(oe,D)).text();oe=dh(q)}else{const q=(l=yg(oe))!=null?l:cd(oe);q&&(oe=q)}if(!oe)throw new Error("Polyline data was provided as string but is incompatible with valid formats.")}return Ey(x,Iy(za({},A),{data:oe}))})}function Ey(y,d){var x,A,D,V,Q,l,oe,q,be,Te,de,et,lt,Xe,ft,tt,St,Ct,Ue,gt;if(d.layerId&&y.getLayer(d.layerId))throw new Error(`A layer already exists with the layer id: ${d.layerId}`);const Qe=(x=d.sourceId)!=null?x:Il(),rt=(A=d.layerId)!=null?A:Al(),Ve={polylineLayerId:rt,polylineOutlineLayerId:"",polylineSourceId:Qe};d.data&&!y.getSource(Qe)&&y.addSource(Qe,{type:"geojson",data:d.data});const pt=(D=d.lineWidth)!=null?D:3,Ge=(V=d.lineColor)!=null?V:yh(),Rt=(Q=d.lineOpacity)!=null?Q:1,it=(l=d.lineBlur)!=null?l:0,ct=(oe=d.lineGapWidth)!=null?oe:0;let st=(q=d.lineDashArray)!=null?q:null;const yt=(be=d.outlineWidth)!=null?be:1,Ot=(Te=d.outlineColor)!=null?Te:"#FFFFFF",Vt=(de=d.outlineOpacity)!=null?de:1,ai=(et=d.outlineBlur)!=null?et:0;if(typeof st=="string"&&(st=dd(st)),d.outline===!0){const Mi=`${rt}_outline`;Ve.polylineOutlineLayerId=Mi,y.addLayer({id:Mi,type:"line",source:Qe,layout:{"line-join":(lt=d.lineJoin)!=null?lt:"round","line-cap":(Xe=d.lineCap)!=null?Xe:"round"},minzoom:(ft=d.minzoom)!=null?ft:0,maxzoom:(tt=d.maxzoom)!=null?tt:23,paint:{"line-opacity":typeof Vt=="number"?Vt:qt(Vt),"line-color":typeof Ot=="string"?Ot:La(Ot),"line-width":gy(pt,yt),"line-blur":typeof ai=="number"?ai:qt(ai)}},d.beforeId)}return y.addLayer({id:rt,type:"line",source:Qe,layout:{"line-join":(St=d.lineJoin)!=null?St:"round","line-cap":(Ct=d.lineCap)!=null?Ct:"round"},minzoom:(Ue=d.minzoom)!=null?Ue:0,maxzoom:(gt=d.maxzoom)!=null?gt:23,paint:za({"line-opacity":typeof Rt=="number"?Rt:qt(Rt),"line-color":typeof Ge=="string"?Ge:La(Ge),"line-width":typeof pt=="number"?pt:qt(pt),"line-blur":typeof it=="number"?it:qt(it),"line-gap-width":typeof ct=="number"?ct:qt(ct)},st&&{"line-dasharray":st})},d.beforeId),Ve}function Py(y,d){var x,A,D,V,Q,l,oe,q,be,Te,de;if(d.layerId&&y.getLayer(d.layerId))throw new Error(`A layer already exists with the layer id: ${d.layerId}`);const et=(x=d.sourceId)!=null?x:Il(),lt=(A=d.layerId)!=null?A:Al(),Xe={polygonLayerId:lt,polygonOutlineLayerId:d.outline?`${lt}_outline`:"",polygonSourceId:et};if(d.data&&!y.getSource(et)){let Ge=d.data;typeof Ge=="string"&&vl(Ge)&&(Ge=`https://api.maptiler.com/data/${Ge}/features.json?key=${_r.apiKey}`),y.addSource(et,{type:"geojson",data:Ge})}let ft=(D=d.outlineDashArray)!=null?D:null;const tt=(V=d.outlineWidth)!=null?V:1,St=(Q=d.outlineColor)!=null?Q:"#FFFFFF",Ct=(l=d.outlineOpacity)!=null?l:1,Ue=(oe=d.outlineBlur)!=null?oe:0,gt=(q=d.fillColor)!=null?q:yh(),Qe=(be=d.fillOpacity)!=null?be:1,rt=(Te=d.outlinePosition)!=null?Te:"center",Ve=(de=d.pattern)!=null?de:null;typeof ft=="string"&&(ft=dd(ft));const pt=(Ge=null)=>{var Rt,it,ct,st,yt,Ot;if(y.addLayer({id:lt,type:"fill",source:et,minzoom:(Rt=d.minzoom)!=null?Rt:0,maxzoom:(it=d.maxzoom)!=null?it:23,paint:za({"fill-color":typeof gt=="string"?gt:La(gt),"fill-opacity":typeof Qe=="number"?Qe:qt(Qe)},Ge&&{"fill-pattern":Ge})},d.beforeId),d.outline===!0){let Vt;rt==="inside"?typeof tt=="number"?Vt=.5*tt:Vt=qt(tt.map(({zoom:ai,value:Mi})=>({zoom:ai,value:.5*Mi}))):rt==="outside"?typeof tt=="number"?Vt=-.5*tt:Vt=qt(tt.map(ai=>({zoom:ai.zoom,value:-.5*ai.value}))):Vt=0,y.addLayer({id:Xe.polygonOutlineLayerId,type:"line",source:et,layout:{"line-join":(ct=d.outlineJoin)!=null?ct:"round","line-cap":(st=d.outlineCap)!=null?st:"butt"},minzoom:(yt=d.minzoom)!=null?yt:0,maxzoom:(Ot=d.maxzoom)!=null?Ot:23,paint:za({"line-opacity":typeof Ct=="number"?Ct:qt(Ct),"line-color":typeof St=="string"?St:La(St),"line-width":typeof tt=="number"?tt:qt(tt),"line-blur":typeof Ue=="number"?Ue:qt(Ue),"line-offset":Vt},ft&&{"line-dasharray":ft})},d.beforeId)}};return Ve?y.hasImage(Ve)?pt(Ve):y.loadImage(Ve,(Ge,Rt)=>{if(Ge)return console.error("Could not load the pattern image.",Ge.message),pt();if(!Rt)return console.error(`An image cannot be created from the pattern URL ${Ve}.`),pt();y.addImage(Ve,Rt),pt(Ve)}):pt(),Xe}function My(y,d){var x,A,D,V,Q,l,oe,q,be,Te,de,et,lt,Xe,ft,tt;if(d.layerId&&y.getLayer(d.layerId))throw new Error(`A layer already exists with the layer id: ${d.layerId}`);const St=(x=d.minPointRadius)!=null?x:10,Ct=(A=d.maxPointRadius)!=null?A:50,Ue=(D=d.cluster)!=null?D:!1,gt=20,Qe=Array.isArray(d.pointColor)?d.pointColor:gh.TURBO.scale(10,d.cluster?1e4:1e3).resample("ease-out-square"),rt=Qe.getBounds(),Ve=(V=d.sourceId)!=null?V:Il(),pt=(Q=d.layerId)!=null?Q:Al(),Ge=(l=d.showLabel)!=null?l:Ue,Rt=(oe=d.alignOnViewport)!=null?oe:!0,it=(q=d.outline)!=null?q:!1,ct=(be=d.outlineOpacity)!=null?be:1,st=(Te=d.outlineWidth)!=null?Te:1,yt=(de=d.outlineColor)!=null?de:"#FFFFFF";let Ot;const Vt=(et=d.zoomCompensation)!=null?et:!0,ai=(lt=d.minzoom)!=null?lt:0,Mi=(Xe=d.maxzoom)!=null?Xe:23;typeof d.pointOpacity=="number"?Ot=d.pointOpacity:Array.isArray(d.pointOpacity)?Ot=qt(d.pointOpacity):d.cluster?Ot=gd(Qe,"point_count"):d.property?Ot=gd(Qe,d.property):Ot=qt([{zoom:ai,value:0},{zoom:ai+.25,value:1},{zoom:Mi-.25,value:1},{zoom:Mi,value:0}]);const vr={pointLayerId:pt,clusterLayerId:"",labelLayerId:"",pointSourceId:Ve};if(d.data&&!y.getSource(Ve)){let gi=d.data;typeof gi=="string"&&vl(gi)&&(gi=`https://api.maptiler.com/data/${gi}/features.json?key=${_r.apiKey}`),y.addSource(Ve,{type:"geojson",data:gi,cluster:Ue})}if(Ue){vr.clusterLayerId=`${pt}_cluster`;const gi=Array.from({length:gt},(Fi,Bt)=>{const Ei=rt.min+Bt*(rt.max-rt.min)/(gt-1);return{value:Ei,pointRadius:St+(Ct-St)*Math.pow(Bt/(gt-1),.5),color:Qe.getColorHex(Ei)}});y.addLayer({id:vr.clusterLayerId,type:"circle",source:Ve,filter:["has","point_count"],paint:za({"circle-color":typeof d.pointColor=="string"?d.pointColor:md(gi,"point_count"),"circle-radius":typeof d.pointRadius=="number"?d.pointRadius:Array.isArray(d.pointRadius)?qt(d.pointRadius):fd(gi,"point_count",!1),"circle-pitch-alignment":Rt?"viewport":"map","circle-pitch-scale":"map","circle-opacity":Ot},it&&{"circle-stroke-opacity":typeof ct=="number"?ct:qt(ct),"circle-stroke-width":typeof st=="number"?st:qt(st),"circle-stroke-color":typeof yt=="string"?yt:La(yt)}),minzoom:ai,maxzoom:Mi},d.beforeId),y.addLayer({id:vr.pointLayerId,type:"circle",source:Ve,filter:["!",["has","point_count"]],paint:za({"circle-pitch-alignment":Rt?"viewport":"map","circle-pitch-scale":"map","circle-color":typeof d.pointColor=="string"?d.pointColor:Qe.getColorHex(Qe.getBounds().min),"circle-radius":typeof d.pointRadius=="number"?d.pointRadius:Array.isArray(d.pointRadius)?qt(d.pointRadius):gi[0].pointRadius*.75,"circle-opacity":Ot},it&&{"circle-stroke-opacity":typeof ct=="number"?ct:qt(ct),"circle-stroke-width":typeof st=="number"?st:qt(st),"circle-stroke-color":typeof yt=="string"?yt:La(yt)}),minzoom:ai,maxzoom:Mi},d.beforeId)}else{let gi=typeof d.pointColor=="string"?d.pointColor:Array.isArray(d.pointColor)?d.pointColor.getColorHex(d.pointColor.getBounds().min):yh(),Fi=typeof d.pointRadius=="number"?Vt?qt([{zoom:0,value:d.pointRadius*.025},{zoom:2,value:d.pointRadius*.05},{zoom:4,value:d.pointRadius*.1},{zoom:8,value:d.pointRadius*.25},{zoom:16,value:d.pointRadius*1}]):d.pointRadius:Array.isArray(d.pointRadius)?qt(d.pointRadius):Vt?qt([{zoom:0,value:St*.05},{zoom:2,value:St*.1},{zoom:4,value:St*.2},{zoom:8,value:St*.5},{zoom:16,value:St*1}]):St;if(d.property&&Array.isArray(d.pointColor)){const Bt=Array.from({length:gt},(Ei,jr)=>{const rn=rt.min+jr*(rt.max-rt.min)/(gt-1);return{value:rn,pointRadius:typeof d.pointRadius=="number"?d.pointRadius:St+(Ct-St)*Math.pow(jr/(gt-1),.5),color:typeof d.pointColor=="string"?d.pointColor:Qe.getColorHex(rn)}});gi=md(Bt,d.property),Fi=fd(Bt,d.property,Vt)}y.addLayer({id:vr.pointLayerId,type:"circle",source:Ve,layout:{"circle-sort-key":d.property?["/",1,["get",d.property]]:0},paint:za({"circle-pitch-alignment":Rt?"viewport":"map","circle-pitch-scale":"map","circle-color":gi,"circle-opacity":Ot,"circle-radius":Fi},it&&{"circle-stroke-opacity":typeof ct=="number"?ct:qt(ct),"circle-stroke-width":typeof st=="number"?st:qt(st),"circle-stroke-color":typeof yt=="string"?yt:La(yt)}),minzoom:ai,maxzoom:Mi},d.beforeId)}if(Ge!==!1&&(d.cluster||d.property)){vr.labelLayerId=`${pt}_label`;const gi=(ft=d.labelColor)!=null?ft:"#fff",Fi=(tt=d.labelSize)!=null?tt:12;y.addLayer({id:vr.labelLayerId,type:"symbol",source:Ve,filter:["has",d.cluster?"point_count":d.property],layout:{"text-field":d.cluster?"{point_count_abbreviated}":`{${d.property}}`,"text-font":["Noto Sans Regular"],"text-size":Fi,"text-pitch-alignment":Rt?"viewport":"map","symbol-sort-key":["/",1,["get",d.cluster?"point_count":d.property]]},paint:{"text-color":gi,"text-opacity":Ot},minzoom:ai,maxzoom:Mi},d.beforeId)}return vr}function ky(y,d){var x,A,D,V,Q,l,oe,q,be,Te;if(d.layerId&&y.getLayer(d.layerId))throw new Error(`A layer already exists with the layer id: ${d.layerId}`);const de=(x=d.sourceId)!=null?x:Il(),et=(A=d.layerId)!=null?A:Al(),lt=(D=d.minzoom)!=null?D:0,Xe=(V=d.maxzoom)!=null?V:23,ft=(Q=d.zoomCompensation)!=null?Q:!0,tt=(l=d.opacity)!=null?l:[{zoom:lt,value:0},{zoom:lt+.25,value:1},{zoom:Xe-.25,value:1},{zoom:Xe,value:0}];let St=Array.isArray(d.colorRamp)?d.colorRamp:gh.TURBO.transparentStart();const Ct=St.getBounds();(Ct.min!==0||Ct.max!==1)&&(St=St.scale(0,1)),St.hasTransparentStart()||(St=St.transparentStart());const Ue=(oe=d.intensity)!=null?oe:[{zoom:0,value:.01},{zoom:4,value:.2},{zoom:16,value:1}],gt=(q=d.property)!=null?q:null,Qe=(be=d.weight)!=null?be:1;let rt=1;gt?typeof Qe=="number"?(rt=Qe,typeof d.weight=="number"&&console.warn("The option `.property` is ignored when `.propertyValueWeights` is not of type `PropertyValueWeights`")):Array.isArray(Qe)?rt=yy(Qe,gt):console.warn("The option `.property` is ignored when `.propertyValueWeights` is not of type `PropertyValueWeights`"):typeof Qe=="number"?rt=Qe:Array.isArray(Qe)&&console.warn("The options `.propertyValueWeights` can only be used when `.property` is provided.");const Ve=[{zoom:0,value:50*.025},{zoom:2,value:50*.05},{zoom:4,value:50*.1},{zoom:8,value:50*.25},{zoom:16,value:50}],pt=(Te=d.radius)!=null?Te:ft?Ve:10;let Ge=1;typeof pt=="number"?Ge=pt:Array.isArray(pt)&&"zoom"in pt[0]?Ge=qt(pt):gt&&Array.isArray(pt)&&"propertyValue"in pt[0]?Ge=_y(pt,gt,ft):!gt&&Array.isArray(pt)&&"propertyValue"in pt[0]?(Ge=qt(Ve),console.warn("The option `.radius` can only be property-driven if the option `.property` is provided.")):Ge=qt(Ve);const Rt={heatmapLayerId:et,heatmapSourceId:de};if(d.data&&!y.getSource(de)){let it=d.data;typeof it=="string"&&vl(it)&&(it=`https://api.maptiler.com/data/${it}/features.json?key=${_r.apiKey}`),y.addSource(de,{type:"geojson",data:it})}return y.addLayer({id:et,type:"heatmap",source:de,minzoom:lt,maxzoom:Xe,paint:{"heatmap-weight":rt,"heatmap-intensity":typeof Ue=="number"?Ue:qt(Ue),"heatmap-color":vy(St),"heatmap-radius":Ge,"heatmap-opacity":typeof tt=="number"?tt:qt(tt)}}),Rt}const Ly={addPolyline:Cy,addPolygon:Py,addPoint:My,addHeatmap:ky},{setRTLTextPlugin:zy,getRTLTextPluginStatus:Dy,LngLat:Ry,LngLatBounds:By,MercatorCoordinate:Fy,Evented:Oy,AJAXError:Ny,prewarm:Uy,clearPrewarmedResources:Vy,version:$y,workerCount:jy,maxParallelImageRequests:Gy,workerUrl:qy,addProtocol:Zy,removeProtocol:Hy}=vt,Wy=vt.Map,Ky=vt.Marker,Xy=vt.Popup,Yy=vt.Style,Jy=vt.CanvasSource,Qy=vt.GeoJSONSource,e_=vt.ImageSource,t_=vt.RasterTileSource,i_=vt.RasterDEMTileSource,r_=vt.VectorTileSource,n_=vt.VideoSource;vt.NavigationControl,vt.GeolocateControl,vt.AttributionControl,vt.LogoControl,vt.ScaleControl,vt.FullscreenControl,vt.TerrainControl,Ee.AJAXError=Ny,Ee.AttributionControl=Up,Ee.CanvasSource=Hg,Ee.CanvasSourceMLGL=Jy,Ee.ColorRamp=Ye,Ee.ColorRampCollection=gh,Ee.Evented=Oy,Ee.FullscreenControl=$p,Ee.GeoJSONSource=Wg,Ee.GeoJSONSourceMLGL=Qy,Ee.GeolocateControl=Rp,Ee.GeolocationType=Kp,Ee.ImageSource=Kg,Ee.ImageSourceMLGL=e_,Ee.Language=Dt,Ee.LanguageGeocoding=Xs,Ee.LngLat=Ry,Ee.LngLatBounds=By,Ee.LogoControl=wp,Ee.Map=Xp,Ee.MapMLGL=Wy,Ee.MapStyle=Vc,Ee.MapStyleVariant=ml,Ee.MaptilerGeolocateControl=Np,Ee.MaptilerLogoControl=th,Ee.MaptilerNavigationControl=Dp,Ee.MaptilerTerrainControl=Lp,Ee.Marker=Gg,Ee.MarkerMLGL=Ky,Ee.MercatorCoordinate=Fy,Ee.NavigationControl=zp,Ee.Point=eo,Ee.Popup=qg,Ee.PopupMLGL=Xy,Ee.RasterDEMTileSource=Yg,Ee.RasterDEMTileSourceMLGL=i_,Ee.RasterTileSource=Xg,Ee.RasterTileSourceMLGL=t_,Ee.ReferenceMapStyle=fl,Ee.ScaleControl=Vp,Ee.SdkConfig=bp,Ee.ServiceError=Nr,Ee.Style=Zg,Ee.StyleMLGL=Yy,Ee.TerrainControl=ey,Ee.VectorTileSource=Jg,Ee.VectorTileSourceMLGL=r_,Ee.VideoSource=Qg,Ee.VideoSourceMLGL=n_,Ee.addProtocol=Zy,Ee.bufferToPixelDataBrowser=yp,Ee.circumferenceAtLatitude=fp,Ee.clearPrewarmedResources=Vy,Ee.config=_r,Ee.coordinates=Df,Ee.data=Bf,Ee.elevation=tg,Ee.expandMapStyle=Uc,Ee.geocoding=Mf,Ee.geolocation=Nc,Ee.getAutoLanguageGeocoding=tp,Ee.getBrowserLanguage=eh,Ee.getBufferToPixelDataParser=Xc,Ee.getRTLTextPluginStatus=Dy,Ee.getTileCache=Kc,Ee.gpx=ph,Ee.gpxOrKml=cd,Ee.hasChildNodeWithName=hh,Ee.helpers=Ly,Ee.isLanguageSupported=Qc,Ee.kml=dh,Ee.mapStylePresetList=Ys,Ee.math=Hc,Ee.maxParallelImageRequests=Gy,Ee.misc=op,Ee.prewarm=Uy,Ee.removeProtocol=Hy,Ee.setRTLTextPlugin=zy,Ee.staticMaps=Zf,Ee.str2xml=wl,Ee.styleToStyle=gl,Ee.version=$y,Ee.workerCount=jy,Ee.workerUrl=qy,Ee.xml2str=uh});
|