@opengis/partsmap 0.0.2 → 0.0.3
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/dist/PartsMap.js +5565 -5681
- package/dist/PartsMap.umd.cjs +62 -62
- package/dist/style.css +1 -1
- package/package.json +45 -32
package/dist/PartsMap.umd.cjs
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
(function(oe,Ro){typeof exports=="object"&&typeof module<"u"?module.exports=Ro(require("vue")):typeof define=="function"&&define.amd?define(["vue"],Ro):(oe=typeof globalThis<"u"?globalThis:oe||self,oe.PartsMap=Ro(oe.Vue))})(this,function(oe){"use strict";var Ro=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function
|
1
|
+
(function(oe,Ro){typeof exports=="object"&&typeof module<"u"?module.exports=Ro(require("vue")):typeof define=="function"&&define.amd?define(["vue"],Ro):(oe=typeof globalThis<"u"?globalThis:oe||self,oe.PartsMap=Ro(oe.Vue))})(this,function(oe){"use strict";var Ro=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function fp(y){return y&&y.__esModule&&Object.prototype.hasOwnProperty.call(y,"default")?y.default:y}var jh={exports:{}};/**
|
2
2
|
* MapLibre GL JS
|
3
3
|
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.5.2/LICENSE.txt
|
4
|
-
*/(function(y,T){(function(M,D){y.exports=D()})(Ro,function(){var M={},D={};function N(S,c,ve){if(D[S]=ve,S==="index"){var ye="var sharedModule = {}; ("+D.shared+")(sharedModule); ("+D.worker+")(sharedModule);",be={};return D.shared(be),D.index(M,be),typeof window<"u"&&M.setWorkerUrl(window.URL.createObjectURL(new Blob([ye],{type:"text/javascript"}))),M}}N("shared",["exports"],function(S){function c(i,e,r,s){return new(r||(r=Promise))(function(l,d){function p(x){try{g(s.next(x))}catch(w){d(w)}}function f(x){try{g(s.throw(x))}catch(w){d(w)}}function g(x){var w;x.done?l(x.value):(w=x.value,w instanceof r?w:new r(function(I){I(w)})).then(p,f)}g((s=s.apply(i,e||[])).next())})}function ve(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}typeof SuppressedError=="function"&&SuppressedError;var ye=be;function be(i,e){this.x=i,this.y=e}be.prototype={clone:function(){return new be(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),s=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=s,this},_rotateAround:function(i,e){var r=Math.cos(i),s=Math.sin(i),l=e.y+s*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-s*(this.y-e.y),this.y=l,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},be.convert=function(i){return i instanceof be?i:Array.isArray(i)?new be(i[0],i[1]):i};var le=ve(ye),ae=ut;function ut(i,e,r,s){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*(s-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=s}ut.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,s=0;s<8;s++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)<e)return r;var d=this.sampleCurveDerivativeX(r);if(Math.abs(d)<1e-6)break;r-=l/d}var p=0,f=1;for(r=i,s=0;s<20&&(l=this.sampleCurveX(r),!(Math.abs(l-i)<e));s++)i>l?p=r:f=r,r=.5*(f-p)+p;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var je=ve(ae);let Ke,Fe;function ht(){return Ke==null&&(Ke=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Ke}function Ye(){if(Fe==null&&(Fe=!1,ht())){const e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let s=0;s<5*5;s++){const l=4*s;e.fillStyle=`rgb(${l},${l+1},${l+2})`,e.fillRect(s%5,Math.floor(s/5),1,1)}const r=e.getImageData(0,0,5,5).data;for(let s=0;s<5*5*4;s++)if(s%4!=3&&r[s]!==s){Fe=!0;break}}}return Fe||!1}function Ue(i,e,r,s){const l=new je(i,e,r,s);return d=>l.solve(d)}const bt=Ue(.25,.1,.25,1);function yt(i,e,r){return Math.min(r,Math.max(e,i))}function At(i,e,r){const s=r-e,l=((i-e)%s+s)%s+e;return l===e?r:l}function It(i,...e){for(const r of e)for(const s in r)i[s]=r[s];return i}let Yi=1;function ri(i,e,r){const s={};for(const l in i)s[l]=e.call(this,i[l],l,i);return s}function Qi(i,e,r){const s={};for(const l in i)e.call(this,i[l],l,i)&&(s[l]=i[l]);return s}function wt(i){return Array.isArray(i)?i.map(wt):typeof i=="object"&&i?ri(i,wt):i}const Vs={};function ci(i){Vs[i]||(typeof console<"u"&&console.warn(i),Vs[i]=!0)}function wi(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function Er(i){return typeof WorkerGlobalScope<"u"&&i!==void 0&&i instanceof WorkerGlobalScope}let Pn=null;function pr(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const Ns="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function sn(i,e,r,s,l){return c(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const d=new VideoFrame(i,{timestamp:0});try{const p=d==null?void 0:d.format;if(!p||!p.startsWith("BGR")&&!p.startsWith("RGB"))throw new Error(`Unrecognized format ${p}`);const f=p.startsWith("BGR"),g=new Uint8ClampedArray(s*l*4);if(yield d.copyTo(g,function(x,w,I,C,z){const R=4*Math.max(-w,0),F=(Math.max(0,I)-I)*C*4+R,$=4*C,X=Math.max(0,w),se=Math.max(0,I);return{rect:{x:X,y:se,width:Math.min(x.width,w+C)-X,height:Math.min(x.height,I+z)-se},layout:[{offset:F,stride:$}]}}(i,e,r,s,l)),f)for(let x=0;x<g.length;x+=4){const w=g[x];g[x]=g[x+2],g[x+2]=w}return g}finally{d.close()}})}let Cr,Ci;const er="AbortError";function En(){return new Error(er)}const Vr={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function fr(i){return Vr.REGISTERED_PROTOCOLS[i.substring(0,i.indexOf("://"))]}const Cn="global-dispatcher";class Fi extends Error{constructor(e,r,s,l){super(`AJAXError: ${r} (${e}): ${s}`),this.status=e,this.statusText=r,this.url=s,this.body=l}}const tr=()=>Er(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,on=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){const s=fr(i.url);if(s)return s(i,e);if(Er(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,targetMapId:Cn},e)}if(!(/^file:/.test(r=i.url)||/^file:/.test(tr())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(s,l){return c(this,void 0,void 0,function*(){const d=new Request(s.url,{method:s.method||"GET",body:s.body,credentials:s.credentials,headers:s.headers,cache:s.cache,referrer:tr(),signal:l.signal});s.type!=="json"||d.headers.has("Accept")||d.headers.set("Accept","application/json");const p=yield fetch(d);if(!p.ok){const x=yield p.blob();throw new Fi(p.status,p.statusText,s.url,x)}let f;f=s.type==="arrayBuffer"||s.type==="image"?p.arrayBuffer():s.type==="json"?p.json():p.text();const g=yield f;if(l.signal.aborted)throw En();return{data:g,cacheControl:p.headers.get("Cache-Control"),expires:p.headers.get("Expires")}})}(i,e);if(Er(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,mustQueue:!0,targetMapId:Cn},e)}var r;return function(s,l){return new Promise((d,p)=>{var f;const g=new XMLHttpRequest;g.open(s.method||"GET",s.url,!0),s.type!=="arrayBuffer"&&s.type!=="image"||(g.responseType="arraybuffer");for(const x in s.headers)g.setRequestHeader(x,s.headers[x]);s.type==="json"&&(g.responseType="text",!((f=s.headers)===null||f===void 0)&&f.Accept||g.setRequestHeader("Accept","application/json")),g.withCredentials=s.credentials==="include",g.onerror=()=>{p(new Error(g.statusText))},g.onload=()=>{if(!l.signal.aborted)if((g.status>=200&&g.status<300||g.status===0)&&g.response!==null){let x=g.response;if(s.type==="json")try{x=JSON.parse(g.response)}catch(w){return void p(w)}d({data:x,cacheControl:g.getResponseHeader("Cache-Control"),expires:g.getResponseHeader("Expires")})}else{const x=new Blob([g.response],{type:g.getResponseHeader("Content-Type")});p(new Fi(g.status,g.statusText,s.url,x))}},l.signal.addEventListener("abort",()=>{g.abort(),p(En())}),g.send(s.body)})}(i,e)};function an(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 is(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function Ar(i,e,r){if(r&&r[i]){const s=r[i].indexOf(e);s!==-1&&r[i].splice(s,1)}}class Nr{constructor(e,r={}){It(this,r),this.type=e}}class jr extends Nr{constructor(e,r={}){super("error",It({error:e},r))}}class An{on(e,r){return this._listeners=this._listeners||{},is(e,r,this._listeners),this}off(e,r){return Ar(e,r,this._listeners),Ar(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},is(e,r,this._oneTimeListeners),this):new Promise(s=>this.once(e,s))}fire(e,r){typeof e=="string"&&(e=new Nr(e,r||{}));const s=e.type;if(this.listens(s)){e.target=this;const l=this._listeners&&this._listeners[s]?this._listeners[s].slice():[];for(const f of l)f.call(this,e);const d=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(const f of d)Ar(s,f,this._oneTimeListeners),f.call(this,e);const p=this._eventedParent;p&&(It(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(e))}else e instanceof jr&&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"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const ln=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function rs(i,e){const r={};for(const s in i)s!=="ref"&&(r[s]=i[s]);return ln.forEach(s=>{s in e&&(r[s]=e[s])}),r}function xt(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(!xt(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(!xt(i[r],e[r]))return!1;return!0}return i===e}function $t(i,e){i.push(e)}function ns(i,e,r){$t(r,{command:"addSource",args:[i,e[i]]})}function Ur(i,e,r){$t(e,{command:"removeSource",args:[i]}),r[i]=!0}function kr(i,e,r,s){Ur(i,r,s),ns(i,e,r)}function kn(i,e,r){let s;for(s in i[r])if(Object.prototype.hasOwnProperty.call(i[r],s)&&s!=="data"&&!xt(i[r][s],e[r][s]))return!1;for(s in e[r])if(Object.prototype.hasOwnProperty.call(e[r],s)&&s!=="data"&&!xt(i[r][s],e[r][s]))return!1;return!0}function Hi(i,e,r,s,l,d){i=i||{},e=e||{};for(const p in i)Object.prototype.hasOwnProperty.call(i,p)&&(xt(i[p],e[p])||r.push({command:d,args:[s,p,e[p],l]}));for(const p in e)Object.prototype.hasOwnProperty.call(e,p)&&!Object.prototype.hasOwnProperty.call(i,p)&&(xt(i[p],e[p])||r.push({command:d,args:[s,p,e[p],l]}))}function ss(i){return i.id}function os(i,e){return i[e.id]=e,i}class Ie{constructor(e,r,s,l){this.message=(e?`${e}: `:"")+s,l&&(this.identifier=l),r!=null&&r.__line__&&(this.line=r.__line__)}}function mr(i,...e){for(const r of e)for(const s in r)i[s]=r[s];return i}class Si extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}class gr{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[s,l]of r)this.bindings[s]=l}concat(e){return new gr(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 $r={kind:"null"},Ce={kind:"number"},at={kind:"string"},Qe={kind:"boolean"},Ai={kind:"color"},ir={kind:"object"},rt={kind:"value"},_r={kind:"collator"},Mr={kind:"formatted"},qr={kind:"padding"},yr={kind:"resolvedImage"},G={kind:"variableAnchorOffsetCollection"};function k(i,e){return{kind:"array",itemType:i,N:e}}function A(i){if(i.kind==="array"){const e=A(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const O=[$r,Ce,at,Qe,Ai,Mr,ir,k(rt),qr,yr,G];function q(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!q(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const r of O)if(!q(r,e))return null}}return`Expected ${A(i)} but found ${A(e)} instead.`}function Q(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 re(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const W=.96422,pe=.82521,_e=4/29,he=6/29,Pe=3*he*he,He=he*he*he,Xe=Math.PI/180,st=180/Math.PI;function mt(i){return(i%=360)<0&&(i+=360),i}function nt([i,e,r,s]){let l,d;const p=qt((.2225045*(i=kt(i))+.7168786*(e=kt(e))+.0606169*(r=kt(r)))/1);i===e&&e===r?l=d=p:(l=qt((.4360747*i+.3850649*e+.1430804*r)/W),d=qt((.0139322*i+.0971045*e+.7141733*r)/pe));const f=116*p-16;return[f<0?0:f,500*(l-p),200*(p-d),s]}function kt(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function qt(i){return i>He?Math.pow(i,1/3):i/Pe+_e}function Kt([i,e,r,s]){let l=(i+16)/116,d=isNaN(e)?l:l+e/500,p=isNaN(r)?l:l-r/200;return l=1*St(l),d=W*St(d),p=pe*St(p),[lt(3.1338561*d-1.6168667*l-.4906146*p),lt(-.9787684*d+1.9161415*l+.033454*p),lt(.0719453*d-.2289914*l+1.4052427*p),s]}function lt(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function St(i){return i>he?i*i*i:Pe*(i-_e)}function Nt(i){return parseInt(i.padEnd(2,i),16)/255}function ei(i,e){return hi(e?i/100:i,0,1)}function hi(i,e,r){return Math.min(Math.max(e,i),r)}function ui(i){return!i.some(Number.isNaN)}const as={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 Tt{constructor(e,r,s,l=1,d=!0){this.r=e,this.g=r,this.b=s,this.a=l,d||(this.r*=l,this.g*=l,this.b*=l,l||this.overwriteGetter("rgb",[e,r,s,l]))}static parse(e){if(e instanceof Tt)return e;if(typeof e!="string")return;const r=function(s){if((s=s.toLowerCase().trim())==="transparent")return[0,0,0,0];const l=as[s];if(l){const[p,f,g]=l;return[p/255,f/255,g/255,1]}if(s.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(s)){const p=s.length<6?1:2;let f=1;return[Nt(s.slice(f,f+=p)),Nt(s.slice(f,f+=p)),Nt(s.slice(f,f+=p)),Nt(s.slice(f,f+p)||"ff")]}if(s.startsWith("rgb")){const p=s.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(p){const[f,g,x,w,I,C,z,R,F,$,X,se]=p,Y=[w||" ",z||" ",$].join("");if(Y===" "||Y===" /"||Y===",,"||Y===",,,"){const ie=[x,C,F].join(""),de=ie==="%%%"?100:ie===""?255:0;if(de){const xe=[hi(+g/de,0,1),hi(+I/de,0,1),hi(+R/de,0,1),X?ei(+X,se):1];if(ui(xe))return xe}}return}}const d=s.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){const[p,f,g,x,w,I,C,z,R]=d,F=[g||" ",w||" ",C].join("");if(F===" "||F===" /"||F===",,"||F===",,,"){const $=[+f,hi(+x,0,100),hi(+I,0,100),z?ei(+z,R):1];if(ui($))return function([X,se,Y,ie]){function de(xe){const Le=(xe+X/30)%12,We=se*Math.min(Y,1-Y);return Y-We*Math.max(-1,Math.min(Le-3,9-Le,1))}return X=mt(X),se/=100,Y/=100,[de(0),de(8),de(4),ie]}($)}}}(e);return r?new Tt(...r,!1):void 0}get rgb(){const{r:e,g:r,b:s,a:l}=this,d=l||1/0;return this.overwriteGetter("rgb",[e/d,r/d,s/d,l])}get hcl(){return this.overwriteGetter("hcl",function(e){const[r,s,l,d]=nt(e),p=Math.sqrt(s*s+l*l);return[Math.round(1e4*p)?mt(Math.atan2(l,s)*st):NaN,p,r,d]}(this.rgb))}get lab(){return this.overwriteGetter("lab",nt(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){const[e,r,s,l]=this.rgb;return`rgba(${[e,r,s].map(d=>Math.round(255*d)).join(",")},${l})`}}Tt.black=new Tt(0,0,0,1),Tt.white=new Tt(1,1,1,1),Tt.transparent=new Tt(0,0,0,0),Tt.red=new Tt(1,0,0,1);class No{constructor(e,r,s){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=s,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 jo{constructor(e,r,s,l,d){this.text=e,this.image=r,this.scale=s,this.fontStack=l,this.textColor=d}}class Oi{constructor(e){this.sections=e}static fromString(e){return new Oi([new jo(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 Vi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Vi)return e;if(typeof e=="number")return new Vi([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 Vi(e)}}toString(){return JSON.stringify(this.values)}}const Dc=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Ni{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ni)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let r=0;r<e.length;r+=2){const s=e[r],l=e[r+1];if(typeof s!="string"||!Dc.has(s)||!Array.isArray(l)||l.length!==2||typeof l[0]!="number"||typeof l[1]!="number")return}return new Ni(e)}}toString(){return JSON.stringify(this.values)}}class di{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new di({name:e,available:!1}):null}}function js(i,e,r,s){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[i,e,r,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[i,e,r,s]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ls(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof Tt||i instanceof No||i instanceof Oi||i instanceof Vi||i instanceof Ni||i instanceof di)return!0;if(Array.isArray(i)){for(const e of i)if(!ls(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!ls(i[e]))return!1;return!0}return!1}function Yt(i){if(i===null)return $r;if(typeof i=="string")return at;if(typeof i=="boolean")return Qe;if(typeof i=="number")return Ce;if(i instanceof Tt)return Ai;if(i instanceof No)return _r;if(i instanceof Oi)return Mr;if(i instanceof Vi)return qr;if(i instanceof Ni)return G;if(i instanceof di)return yr;if(Array.isArray(i)){const e=i.length;let r;for(const s of i){const l=Yt(s);if(r){if(r===l)continue;r=rt;break}r=l}return k(r||rt,e)}return ir}function zr(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof Tt||i instanceof Oi||i instanceof Vi||i instanceof Ni||i instanceof di?i.toString():JSON.stringify(i)}class cn{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(!ls(e[1]))return r.error("invalid value");const s=e[1];let l=Yt(s);const d=r.expectedType;return l.kind!=="array"||l.N!==0||!d||d.kind!=="array"||typeof d.N=="number"&&d.N!==0||(l=d),new cn(l,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Wt{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Us={string:at,number:Ce,boolean:Qe,object:ir};class Xi{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 s,l=1;const d=e[0];if(d==="array"){let f,g;if(e.length>2){const x=e[1];if(typeof x!="string"||!(x in Us)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);f=Us[x],l++}else f=rt;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);g=e[2],l++}s=k(f,g)}else{if(!Us[d])throw new Error(`Types doesn't contain name = ${d}`);s=Us[d]}const p=[];for(;l<e.length;l++){const f=r.parse(e[l],l,rt);if(!f)return null;p.push(f)}return new Xi(s,p)}evaluate(e){for(let r=0;r<this.args.length;r++){const s=this.args[r].evaluate(e);if(!q(this.type,Yt(s)))return s;if(r===this.args.length-1)throw new Wt(`Expected value to be of type ${A(this.type)}, but found ${A(Yt(s))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const cs={"to-boolean":Qe,"to-color":Ai,"to-number":Ce,"to-string":at};class Zr{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 s=e[0];if(!cs[s])throw new Error(`Can't parse ${s} as it is not part of the known types`);if((s==="to-boolean"||s==="to-string")&&e.length!==2)return r.error("Expected one argument.");const l=cs[s],d=[];for(let p=1;p<e.length;p++){const f=r.parse(e[p],p,rt);if(!f)return null;d.push(f)}return new Zr(l,d)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let r,s;for(const l of this.args){if(r=l.evaluate(e),s=null,r instanceof Tt)return r;if(typeof r=="string"){const d=e.parseColor(r);if(d)return d}else if(Array.isArray(r)&&(s=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:js(r[0],r[1],r[2],r[3]),!s))return new Tt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Wt(s||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(const s of this.args){r=s.evaluate(e);const l=Vi.parse(r);if(l)return l}throw new Wt(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(const s of this.args){r=s.evaluate(e);const l=Ni.parse(r);if(l)return l}throw new Wt(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(const s of this.args){if(r=s.evaluate(e),r===null)return 0;const l=Number(r);if(!isNaN(l))return l}throw new Wt(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return Oi.fromString(zr(this.args[0].evaluate(e)));case"resolvedImage":return di.fromString(zr(this.args[0].evaluate(e)));default:return zr(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Uo=["Unknown","Point","LineString","Polygon"];class hs{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"?Uo[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]=Tt.parse(e)),r}}class Gr{constructor(e,r,s=[],l,d=new gr,p=[]){this.registry=e,this.path=s,this.key=s.map(f=>`[${f}]`).join(""),this.scope=d,this.errors=p,this.expectedType=l,this._isConstant=r}parse(e,r,s,l,d={}){return r?this.concat(r,s,l)._parse(e,d):this._parse(e,d)}_parse(e,r){function s(l,d,p){return p==="assert"?new Xi(d,[l]):p==="coerce"?new Zr(d,[l]):l}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 l=e[0];if(typeof l!="string")return this.error(`Expression name must be a string, but found ${typeof l} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const d=this.registry[l];if(d){let p=d.parse(e,this);if(!p)return null;if(this.expectedType){const f=this.expectedType,g=p.type;if(f.kind!=="string"&&f.kind!=="number"&&f.kind!=="boolean"&&f.kind!=="object"&&f.kind!=="array"||g.kind!=="value")if(f.kind!=="color"&&f.kind!=="formatted"&&f.kind!=="resolvedImage"||g.kind!=="value"&&g.kind!=="string")if(f.kind!=="padding"||g.kind!=="value"&&g.kind!=="number"&&g.kind!=="array")if(f.kind!=="variableAnchorOffsetCollection"||g.kind!=="value"&&g.kind!=="array"){if(this.checkSubtype(f,g))return null}else p=s(p,f,r.typeAnnotation||"coerce");else p=s(p,f,r.typeAnnotation||"coerce");else p=s(p,f,r.typeAnnotation||"coerce");else p=s(p,f,r.typeAnnotation||"assert")}if(!(p instanceof cn)&&p.type.kind!=="resolvedImage"&&this._isConstant(p)){const f=new hs;try{p=new cn(p.type,p.evaluate(f))}catch(g){return this.error(g.message),null}}return p}return this.error(`Unknown expression "${l}". 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,s){const l=typeof e=="number"?this.path.concat(e):this.path,d=s?this.scope.concat(s):this.scope;return new Gr(this.registry,this._isConstant,l,r||null,d,this.errors)}error(e,...r){const s=`${this.key}${r.map(l=>`[${l}]`).join("")}`;this.errors.push(new Si(s,e))}checkSubtype(e,r){const s=q(e,r);return s&&this.error(s),s}}class vt{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 s=[];for(let d=1;d<e.length-1;d+=2){const p=e[d];if(typeof p!="string")return r.error(`Expected string, but found ${typeof p} instead.`,d);if(/[^a-zA-Z0-9_]/.test(p))return r.error("Variable names must contain only alphanumeric characters or '_'.",d);const f=r.parse(e[d+1],d+1);if(!f)return null;s.push([p,f])}const l=r.parse(e[e.length-1],e.length-1,r.expectedType,s);return l?new vt(s,l):null}outputDefined(){return this.result.outputDefined()}}class $s{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 s=e[1];return r.scope.has(s)?new $s(s,r.scope.get(s)):r.error(`Unknown variable "${s}". Make sure "${s}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class $o{constructor(e,r,s){this.type=e,this.index=r,this.input=s}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,Ce),l=r.parse(e[2],2,k(r.expectedType||rt));return s&&l?new $o(l.type.itemType,s,l):null}evaluate(e){const r=this.index.evaluate(e),s=this.input.evaluate(e);if(r<0)throw new Wt(`Array index out of bounds: ${r} < 0.`);if(r>=s.length)throw new Wt(`Array index out of bounds: ${r} > ${s.length-1}.`);if(r!==Math.floor(r))throw new Wt(`Array index must be an integer, but found ${r} instead.`);return s[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class us{constructor(e,r){this.type=Qe,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 s=r.parse(e[1],1,rt),l=r.parse(e[2],2,rt);return s&&l?Q(s.type,[Qe,at,Ce,$r,rt])?new us(s,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${A(s.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!s)return!1;if(!te(r,["boolean","string","number","null"]))throw new Wt(`Expected first argument to be of type boolean, string, number or null, but found ${A(Yt(r))} instead.`);if(!te(s,["string","array"]))throw new Wt(`Expected second argument to be of type array or string, but found ${A(Yt(s))} instead.`);return s.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class qs{constructor(e,r,s){this.type=Ce,this.needle=e,this.haystack=r,this.fromIndex=s}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 s=r.parse(e[1],1,rt),l=r.parse(e[2],2,rt);if(!s||!l)return null;if(!Q(s.type,[Qe,at,Ce,$r,rt]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${A(s.type)} instead`);if(e.length===4){const d=r.parse(e[3],3,Ce);return d?new qs(s,l,d):null}return new qs(s,l)}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!te(r,["boolean","string","number","null"]))throw new Wt(`Expected first argument to be of type boolean, string, number or null, but found ${A(Yt(r))} instead.`);if(!te(s,["string","array"]))throw new Wt(`Expected second argument to be of type array or string, but found ${A(Yt(s))} instead.`);if(this.fromIndex){const l=this.fromIndex.evaluate(e);return s.indexOf(r,l)}return s.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class Zs{constructor(e,r,s,l,d,p){this.inputType=e,this.type=r,this.input=s,this.cases=l,this.outputs=d,this.otherwise=p}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 s,l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);const d={},p=[];for(let x=2;x<e.length-1;x+=2){let w=e[x];const I=e[x+1];Array.isArray(w)||(w=[w]);const C=r.concat(x);if(w.length===0)return C.error("Expected at least one branch label.");for(const R of w){if(typeof R!="number"&&typeof R!="string")return C.error("Branch labels must be numbers or strings.");if(typeof R=="number"&&Math.abs(R)>Number.MAX_SAFE_INTEGER)return C.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof R=="number"&&Math.floor(R)!==R)return C.error("Numeric branch labels must be integer values.");if(s){if(C.checkSubtype(s,Yt(R)))return null}else s=Yt(R);if(d[String(R)]!==void 0)return C.error("Branch labels must be unique.");d[String(R)]=p.length}const z=r.parse(I,x,l);if(!z)return null;l=l||z.type,p.push(z)}const f=r.parse(e[1],1,rt);if(!f)return null;const g=r.parse(e[e.length-1],e.length-1,l);return g?f.type.kind!=="value"&&r.concat(1).checkSubtype(s,f.type)?null:new Zs(s,l,f,d,p,g):null}evaluate(e){const r=this.input.evaluate(e);return(Yt(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 Gs{constructor(e,r,s){this.type=e,this.branches=r,this.otherwise=s}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 s;r.expectedType&&r.expectedType.kind!=="value"&&(s=r.expectedType);const l=[];for(let p=1;p<e.length-1;p+=2){const f=r.parse(e[p],p,Qe);if(!f)return null;const g=r.parse(e[p+1],p+1,s);if(!g)return null;l.push([f,g]),s=s||g.type}const d=r.parse(e[e.length-1],e.length-1,s);if(!d)return null;if(!s)throw new Error("Can't infer output type");return new Gs(s,l,d)}evaluate(e){for(const[r,s]of this.branches)if(r.evaluate(e))return s.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[r,s]of this.branches)e(r),e(s);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}}class Hs{constructor(e,r,s,l){this.type=e,this.input=r,this.beginIndex=s,this.endIndex=l}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 s=r.parse(e[1],1,rt),l=r.parse(e[2],2,Ce);if(!s||!l)return null;if(!Q(s.type,[k(rt),at,rt]))return r.error(`Expected first argument to be of type array or string, but found ${A(s.type)} instead`);if(e.length===4){const d=r.parse(e[3],3,Ce);return d?new Hs(s.type,s,l,d):null}return new Hs(s.type,s,l)}evaluate(e){const r=this.input.evaluate(e),s=this.beginIndex.evaluate(e);if(!te(r,["string","array"]))throw new Wt(`Expected first argument to be of type array or string, but found ${A(Yt(r))} instead.`);if(this.endIndex){const l=this.endIndex.evaluate(e);return r.slice(s,l)}return r.slice(s)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function ds(i,e){const r=i.length-1;let s,l,d=0,p=r,f=0;for(;d<=p;)if(f=Math.floor((d+p)/2),s=i[f],l=i[f+1],s<=e){if(f===r||e<l)return f;d=f+1}else{if(!(s>e))throw new Wt("Input is not a number.");p=f-1}return 0}class Mn{constructor(e,r,s){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[l,d]of s)this.labels.push(l),this.outputs.push(d)}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 s=r.parse(e[1],1,Ce);if(!s)return null;const l=[];let d=null;r.expectedType&&r.expectedType.kind!=="value"&&(d=r.expectedType);for(let p=1;p<e.length;p+=2){const f=p===1?-1/0:e[p],g=e[p+1],x=p,w=p+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.',x);if(l.length&&l[l.length-1][0]>=f)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',x);const I=r.parse(g,w,d);if(!I)return null;d=d||I.type,l.push([f,I])}return new Mn(d,s,l)}evaluate(e){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return s[0].evaluate(e);const d=r.length;return l>=r[d-1]?s[d-1].evaluate(e):s[ds(r,l)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Lc(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Rc=hl;function hl(i,e,r,s){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*(s-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=s}hl.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,s=0;s<8;s++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)<e)return r;var d=this.sampleCurveDerivativeX(r);if(Math.abs(d)<1e-6)break;r-=l/d}var p=0,f=1;for(r=i,s=0;s<20&&(l=this.sampleCurveX(r),!(Math.abs(l-i)<e));s++)i>l?p=r:f=r,r=.5*(f-p)+p;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var Bc=Lc(Rc);function Hr(i,e,r){return i+r*(e-i)}function ps(i,e,r){return i.map((s,l)=>Hr(s,e[l],r))}const ji={number:Hr,color:function(i,e,r,s="rgb"){switch(s){case"rgb":{const[l,d,p,f]=ps(i.rgb,e.rgb,r);return new Tt(l,d,p,f,!1)}case"hcl":{const[l,d,p,f]=i.hcl,[g,x,w,I]=e.hcl;let C,z;if(isNaN(l)||isNaN(g))isNaN(l)?isNaN(g)?C=NaN:(C=g,p!==1&&p!==0||(z=x)):(C=l,w!==1&&w!==0||(z=d));else{let se=g-l;g>l&&se>180?se-=360:g<l&&l-g>180&&(se+=360),C=l+r*se}const[R,F,$,X]=function([se,Y,ie,de]){return se=isNaN(se)?0:se*Xe,Kt([ie,Math.cos(se)*Y,Math.sin(se)*Y,de])}([C,z??Hr(d,x,r),Hr(p,w,r),Hr(f,I,r)]);return new Tt(R,F,$,X,!1)}case"lab":{const[l,d,p,f]=Kt(ps(i.lab,e.lab,r));return new Tt(l,d,p,f,!1)}}},array:ps,padding:function(i,e,r){return new Vi(ps(i.values,e.values,r))},variableAnchorOffsetCollection:function(i,e,r){const s=i.values,l=e.values;if(s.length!==l.length)throw new Wt(`Cannot interpolate values of different length. from: ${i.toString()}, to: ${e.toString()}`);const d=[];for(let p=0;p<s.length;p+=2){if(s[p]!==l[p])throw new Wt(`Cannot interpolate values containing mismatched anchors. from[${p}]: ${s[p]}, to[${p}]: ${l[p]}`);d.push(s[p]);const[f,g]=s[p+1],[x,w]=l[p+1];d.push([Hr(f,x,r),Hr(g,w,r)])}return new Ni(d)}};class Ui{constructor(e,r,s,l,d){this.type=e,this.operator=r,this.interpolation=s,this.input=l,this.labels=[],this.outputs=[];for(const[p,f]of d)this.labels.push(p),this.outputs.push(f)}static interpolationFactor(e,r,s,l){let d=0;if(e.name==="exponential")d=fs(r,e.base,s,l);else if(e.name==="linear")d=fs(r,1,s,l);else if(e.name==="cubic-bezier"){const p=e.controlPoints;d=new Bc(p[0],p[1],p[2],p[3]).solve(fs(r,1,s,l))}return d}static parse(e,r){let[s,l,d,...p]=e;if(!Array.isArray(l)||l.length===0)return r.error("Expected an interpolation type expression.",1);if(l[0]==="linear")l={name:"linear"};else if(l[0]==="exponential"){const x=l[1];if(typeof x!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);l={name:"exponential",base:x}}else{if(l[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(l[0])}`,1,0);{const x=l.slice(1);if(x.length!==4||x.some(w=>typeof w!="number"||w<0||w>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);l={name:"cubic-bezier",controlPoints:x}}}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(d=r.parse(d,2,Ce),!d)return null;const f=[];let g=null;s==="interpolate-hcl"||s==="interpolate-lab"?g=Ai:r.expectedType&&r.expectedType.kind!=="value"&&(g=r.expectedType);for(let x=0;x<p.length;x+=2){const w=p[x],I=p[x+1],C=x+3,z=x+4;if(typeof w!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',C);if(f.length&&f[f.length-1][0]>=w)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',C);const R=r.parse(I,z,g);if(!R)return null;g=g||R.type,f.push([w,R])}return re(g,Ce)||re(g,Ai)||re(g,qr)||re(g,G)||re(g,k(Ce))?new Ui(g,s,l,d,f):r.error(`Type ${A(g)} is not interpolatable.`)}evaluate(e){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return s[0].evaluate(e);const d=r.length;if(l>=r[d-1])return s[d-1].evaluate(e);const p=ds(r,l),f=Ui.interpolationFactor(this.interpolation,l,r[p],r[p+1]),g=s[p].evaluate(e),x=s[p+1].evaluate(e);switch(this.operator){case"interpolate":return ji[this.type.kind](g,x,f);case"interpolate-hcl":return ji.color(g,x,f,"hcl");case"interpolate-lab":return ji.color(g,x,f,"lab")}}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function fs(i,e,r,s){const l=s-r,d=i-r;return l===0?0:e===1?d/l:(Math.pow(e,d)-1)/(Math.pow(e,l)-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 s=null;const l=r.expectedType;l&&l.kind!=="value"&&(s=l);const d=[];for(const f of e.slice(1)){const g=r.parse(f,1+d.length,s,void 0,{typeAnnotation:"omit"});if(!g)return null;s=s||g.type,d.push(g)}if(!s)throw new Error("No output type");const p=l&&d.some(f=>q(l,f.type));return new Xs(p?rt:s,d)}evaluate(e){let r,s=null,l=0;for(const d of this.args)if(l++,s=d.evaluate(e),s&&s instanceof di&&!s.available&&(r||(r=s.name),s=null,l===this.args.length&&(s=r)),s!==null)break;return s}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}function ul(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 dl(i,e,r,s){return s.compare(e,r)===0}function hn(i,e,r){const s=i!=="=="&&i!=="!=";return class _p{constructor(d,p,f){this.type=Qe,this.lhs=d,this.rhs=p,this.collator=f,this.hasUntypedArgument=d.type.kind==="value"||p.type.kind==="value"}static parse(d,p){if(d.length!==3&&d.length!==4)return p.error("Expected two or three arguments.");const f=d[0];let g=p.parse(d[1],1,rt);if(!g)return null;if(!ul(f,g.type))return p.concat(1).error(`"${f}" comparisons are not supported for type '${A(g.type)}'.`);let x=p.parse(d[2],2,rt);if(!x)return null;if(!ul(f,x.type))return p.concat(2).error(`"${f}" comparisons are not supported for type '${A(x.type)}'.`);if(g.type.kind!==x.type.kind&&g.type.kind!=="value"&&x.type.kind!=="value")return p.error(`Cannot compare types '${A(g.type)}' and '${A(x.type)}'.`);s&&(g.type.kind==="value"&&x.type.kind!=="value"?g=new Xi(x.type,[g]):g.type.kind!=="value"&&x.type.kind==="value"&&(x=new Xi(g.type,[x])));let w=null;if(d.length===4){if(g.type.kind!=="string"&&x.type.kind!=="string"&&g.type.kind!=="value"&&x.type.kind!=="value")return p.error("Cannot use collator to compare non-string types.");if(w=p.parse(d[3],3,_r),!w)return null}return new _p(g,x,w)}evaluate(d){const p=this.lhs.evaluate(d),f=this.rhs.evaluate(d);if(s&&this.hasUntypedArgument){const g=Yt(p),x=Yt(f);if(g.kind!==x.kind||g.kind!=="string"&&g.kind!=="number")throw new Wt(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${g.kind}, ${x.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const g=Yt(p),x=Yt(f);if(g.kind!=="string"||x.kind!=="string")return e(d,p,f)}return this.collator?r(d,p,f,this.collator.evaluate(d)):e(d,p,f)}eachChild(d){d(this.lhs),d(this.rhs),this.collator&&d(this.collator)}outputDefined(){return!0}}}const pl=hn("==",function(i,e,r){return e===r},dl),Fc=hn("!=",function(i,e,r){return e!==r},function(i,e,r,s){return!dl(0,e,r,s)}),Oc=hn("<",function(i,e,r){return e<r},function(i,e,r,s){return s.compare(e,r)<0}),fl=hn(">",function(i,e,r){return e>r},function(i,e,r,s){return s.compare(e,r)>0}),ml=hn("<=",function(i,e,r){return e<=r},function(i,e,r,s){return s.compare(e,r)<=0}),Vc=hn(">=",function(i,e,r){return e>=r},function(i,e,r,s){return s.compare(e,r)>=0});class Ws{constructor(e,r,s){this.type=_r,this.locale=s,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const s=e[1];if(typeof s!="object"||Array.isArray(s))return r.error("Collator options argument must be an object.");const l=r.parse(s["case-sensitive"]!==void 0&&s["case-sensitive"],1,Qe);if(!l)return null;const d=r.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,Qe);if(!d)return null;let p=null;return s.locale&&(p=r.parse(s.locale,1,at),!p)?null:new Ws(l,d,p)}evaluate(e){return new No(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class qo{constructor(e,r,s,l,d){this.type=at,this.number=e,this.locale=r,this.currency=s,this.minFractionDigits=l,this.maxFractionDigits=d}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const s=r.parse(e[1],1,Ce);if(!s)return null;const l=e[2];if(typeof l!="object"||Array.isArray(l))return r.error("NumberFormat options argument must be an object.");let d=null;if(l.locale&&(d=r.parse(l.locale,1,at),!d))return null;let p=null;if(l.currency&&(p=r.parse(l.currency,1,at),!p))return null;let f=null;if(l["min-fraction-digits"]&&(f=r.parse(l["min-fraction-digits"],1,Ce),!f))return null;let g=null;return l["max-fraction-digits"]&&(g=r.parse(l["max-fraction-digits"],1,Ce),!g)?null:new qo(s,d,p,f,g)}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 Js{constructor(e){this.type=Mr,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const s=e[1];if(!Array.isArray(s)&&typeof s=="object")return r.error("First argument must be an image or text section.");const l=[];let d=!1;for(let p=1;p<=e.length-1;++p){const f=e[p];if(d&&typeof f=="object"&&!Array.isArray(f)){d=!1;let g=null;if(f["font-scale"]&&(g=r.parse(f["font-scale"],1,Ce),!g))return null;let x=null;if(f["text-font"]&&(x=r.parse(f["text-font"],1,k(at)),!x))return null;let w=null;if(f["text-color"]&&(w=r.parse(f["text-color"],1,Ai),!w))return null;const I=l[l.length-1];I.scale=g,I.font=x,I.textColor=w}else{const g=r.parse(e[p],1,rt);if(!g)return null;const x=g.type.kind;if(x!=="string"&&x!=="value"&&x!=="null"&&x!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");d=!0,l.push({content:g,scale:null,font:null,textColor:null})}}return new Js(l)}evaluate(e){return new Oi(this.sections.map(r=>{const s=r.content.evaluate(e);return Yt(s)===yr?new jo("",s,null,null,null):new jo(zr(s),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 Zo{constructor(e){this.type=yr,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const s=r.parse(e[1],1,at);return s?new Zo(s):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),s=di.fromString(r);return s&&e.availableImages&&(s.available=e.availableImages.indexOf(r)>-1),s}eachChild(e){e(this.input)}outputDefined(){return!1}}class Go{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 s=r.parse(e[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${A(s.type)} instead.`):new Go(s):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new Wt(`Expected value to be of type string or array, but found ${A(Yt(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const xr=8192;function Ho(i,e){const r=(180+i[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,l=Math.pow(2,e.z);return[Math.round(r*l*xr),Math.round(s*l*xr)]}function zn(i,e){const r=Math.pow(2,e.z);return[(l=(i[0]/xr+e.x)/r,360*l-180),(s=(i[1]/xr+e.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90)];var s,l}function ft(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 ms(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function Nc(i,e,r){const s=i[0]-e[0],l=i[1]-e[1],d=i[0]-r[0],p=i[1]-r[1];return s*p-d*l==0&&s*d<=0&&l*p<=0}function Ks(i,e,r,s){return(l=[s[0]-r[0],s[1]-r[1]])[0]*(d=[e[0]-i[0],e[1]-i[1]])[1]-l[1]*d[0]!=0&&!(!_l(i,e,r,s)||!_l(r,s,i,e));var l,d}function jc(i,e,r){for(const s of r)for(let l=0;l<s.length-1;++l)if(Ks(i,e,s[l],s[l+1]))return!0;return!1}function Dn(i,e,r=!1){let s=!1;for(const f of e)for(let g=0;g<f.length-1;g++){if(Nc(i,f[g],f[g+1]))return r;(d=f[g])[1]>(l=i)[1]!=(p=f[g+1])[1]>l[1]&&l[0]<(p[0]-d[0])*(l[1]-d[1])/(p[1]-d[1])+d[0]&&(s=!s)}var l,d,p;return s}function Uc(i,e){for(const r of e)if(Dn(i,r))return!0;return!1}function gl(i,e){for(const r of i)if(!Dn(r,e))return!1;for(let r=0;r<i.length-1;++r)if(jc(i[r],i[r+1],e))return!1;return!0}function $c(i,e){for(const r of e)if(gl(i,r))return!0;return!1}function _l(i,e,r,s){const l=s[0]-r[0],d=s[1]-r[1],p=(i[0]-r[0])*d-l*(i[1]-r[1]),f=(e[0]-r[0])*d-l*(e[1]-r[1]);return p>0&&f<0||p<0&&f>0}function Xo(i,e,r){const s=[];for(let l=0;l<i.length;l++){const d=[];for(let p=0;p<i[l].length;p++){const f=Ho(i[l][p],r);ft(e,f),d.push(f)}s.push(d)}return s}function yl(i,e,r){const s=[];for(let l=0;l<i.length;l++){const d=Xo(i[l],e,r);s.push(d)}return s}function xl(i,e,r,s){if(i[0]<r[0]||i[0]>r[2]){const l=.5*s;let d=i[0]-r[0]>l?-s:r[0]-i[0]>l?s:0;d===0&&(d=i[0]-r[2]>l?-s:r[2]-i[0]>l?s:0),i[0]+=d}ft(e,i)}function vl(i,e,r,s){const l=Math.pow(2,s.z)*xr,d=[s.x*xr,s.y*xr],p=[];for(const f of i)for(const g of f){const x=[g.x+d[0],g.y+d[1]];xl(x,e,r,l),p.push(x)}return p}function bl(i,e,r,s){const l=Math.pow(2,s.z)*xr,d=[s.x*xr,s.y*xr],p=[];for(const g of i){const x=[];for(const w of g){const I=[w.x+d[0],w.y+d[1]];ft(e,I),x.push(I)}p.push(x)}if(e[2]-e[0]<=l/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const g of p)for(const x of g)xl(x,e,r,l)}var f;return p}class un{constructor(e,r){this.type=Qe,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(ls(e[1])){const s=e[1];if(s.type==="FeatureCollection"){const l=[];for(const d of s.features){const{type:p,coordinates:f}=d.geometry;p==="Polygon"&&l.push(f),p==="MultiPolygon"&&l.push(...f)}if(l.length)return new un(s,{type:"MultiPolygon",coordinates:l})}else if(s.type==="Feature"){const l=s.geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new un(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new un(s,s)}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,s){const l=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(s.type==="Polygon"){const f=Xo(s.coordinates,d,p),g=vl(r.geometry(),l,d,p);if(!ms(l,d))return!1;for(const x of g)if(!Dn(x,f))return!1}if(s.type==="MultiPolygon"){const f=yl(s.coordinates,d,p),g=vl(r.geometry(),l,d,p);if(!ms(l,d))return!1;for(const x of g)if(!Uc(x,f))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,s){const l=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(s.type==="Polygon"){const f=Xo(s.coordinates,d,p),g=bl(r.geometry(),l,d,p);if(!ms(l,d))return!1;for(const x of g)if(!gl(x,f))return!1}if(s.type==="MultiPolygon"){const f=yl(s.coordinates,d,p),g=bl(r.geometry(),l,d,p);if(!ms(l,d))return!1;for(const x of g)if(!$c(x,f))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let wl=class{constructor(i=[],e=qc){if(this.data=i,this.length=this.data.length,this.compare=e,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(i){this.data.push(i),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const i=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),i}peek(){return this.data[0]}_up(i){const{data:e,compare:r}=this,s=e[i];for(;i>0;){const l=i-1>>1,d=e[l];if(r(s,d)>=0)break;e[i]=d,i=l}e[i]=s}_down(i){const{data:e,compare:r}=this,s=this.length>>1,l=e[i];for(;i<s;){let d=1+(i<<1),p=e[d];const f=d+1;if(f<this.length&&r(e[f],p)<0&&(d=f,p=e[f]),r(p,l)>=0)break;e[i]=p,i=d}e[i]=l}};function qc(i,e){return i<e?-1:i>e?1:0}function Zc(i,e,r,s,l){Sl(i,e,r,s||i.length-1,l||Gc)}function Sl(i,e,r,s,l){for(;s>r;){if(s-r>600){var d=s-r+1,p=e-r+1,f=Math.log(d),g=.5*Math.exp(2*f/3),x=.5*Math.sqrt(f*g*(d-g)/d)*(p-d/2<0?-1:1);Sl(i,e,Math.max(r,Math.floor(e-p*g/d+x)),Math.min(s,Math.floor(e+(d-p)*g/d+x)),l)}var w=i[e],I=r,C=s;for(gs(i,r,e),l(i[s],w)>0&&gs(i,r,s);I<C;){for(gs(i,I,C),I++,C--;l(i[I],w)<0;)I++;for(;l(i[C],w)>0;)C--}l(i[r],w)===0?gs(i,r,C):gs(i,++C,s),C<=e&&(r=C+1),e<=C&&(s=C-1)}}function gs(i,e,r){var s=i[e];i[e]=i[r],i[r]=s}function Gc(i,e){return i<e?-1:i>e?1:0}function Ys(i,e){if(i.length<=1)return[i];const r=[];let s,l;for(const d of i){const p=Xc(d);p!==0&&(d.area=Math.abs(p),l===void 0&&(l=p<0),l===p<0?(s&&r.push(s),s=[d]):s.push(d))}if(s&&r.push(s),e>1)for(let d=0;d<r.length;d++)r[d].length<=e||(Zc(r[d],e,1,r[d].length-1,Hc),r[d]=r[d].slice(0,e));return r}function Hc(i,e){return e.area-i.area}function Xc(i){let e=0;for(let r,s,l=0,d=i.length,p=d-1;l<d;p=l++)r=i[l],s=i[p],e+=(s.x-r.x)*(r.y+s.y);return e}const Tl=1/298.257223563,Il=Tl*(2-Tl),Pl=Math.PI/180;class Wo{constructor(e){const r=6378.137*Pl*1e3,s=Math.cos(e*Pl),l=1/(1-Il*(1-s*s)),d=Math.sqrt(l);this.kx=r*d*s,this.ky=r*d*l*(1-Il)}distance(e,r){const s=this.wrap(e[0]-r[0])*this.kx,l=(e[1]-r[1])*this.ky;return Math.sqrt(s*s+l*l)}pointOnLine(e,r){let s,l,d,p,f=1/0;for(let g=0;g<e.length-1;g++){let x=e[g][0],w=e[g][1],I=this.wrap(e[g+1][0]-x)*this.kx,C=(e[g+1][1]-w)*this.ky,z=0;I===0&&C===0||(z=(this.wrap(r[0]-x)*this.kx*I+(r[1]-w)*this.ky*C)/(I*I+C*C),z>1?(x=e[g+1][0],w=e[g+1][1]):z>0&&(x+=I/this.kx*z,w+=C/this.ky*z)),I=this.wrap(r[0]-x)*this.kx,C=(r[1]-w)*this.ky;const R=I*I+C*C;R<f&&(f=R,s=x,l=w,d=g,p=z)}return{point:[s,l],index:d,t:Math.max(0,Math.min(1,p))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}function El(i,e){return e[0]-i[0]}function Qs(i){return i[1]-i[0]+1}function Dr(i,e){return i[1]>=i[0]&&i[1]<e}function _s(i,e){if(i[0]>i[1])return[null,null];const r=Qs(i);if(e){if(r===2)return[i,null];const l=Math.floor(r/2);return[[i[0],i[0]+l],[i[0]+l,i[1]]]}if(r===1)return[i,null];const s=Math.floor(r/2)-1;return[[i[0],i[0]+s],[i[0]+s+1,i[1]]]}function Jo(i,e){if(!Dr(e,i.length))return[1/0,1/0,-1/0,-1/0];const r=[1/0,1/0,-1/0,-1/0];for(let s=e[0];s<=e[1];++s)ft(r,i[s]);return r}function Ko(i){const e=[1/0,1/0,-1/0,-1/0];for(const r of i)for(const s of r)ft(e,s);return e}function Cl(i){return i[0]!==-1/0&&i[1]!==-1/0&&i[2]!==1/0&&i[3]!==1/0}function Yo(i,e,r){if(!Cl(i)||!Cl(e))return NaN;let s=0,l=0;return i[2]<e[0]&&(s=e[0]-i[2]),i[0]>e[2]&&(s=i[0]-e[2]),i[1]>e[3]&&(l=i[1]-e[3]),i[3]<e[1]&&(l=e[1]-i[3]),r.distance([0,0],[s,l])}function Mt(i,e,r){const s=r.pointOnLine(e,i);return r.distance(i,s.point)}function Qo(i,e,r,s,l){const d=Math.min(Mt(i,[r,s],l),Mt(e,[r,s],l)),p=Math.min(Mt(r,[i,e],l),Mt(s,[i,e],l));return Math.min(d,p)}function dt(i,e,r,s,l){if(!Dr(e,i.length)||!Dr(s,r.length))return 1/0;let d=1/0;for(let p=e[0];p<e[1];++p){const f=i[p],g=i[p+1];for(let x=s[0];x<s[1];++x){const w=r[x],I=r[x+1];if(Ks(f,g,w,I))return 0;d=Math.min(d,Qo(f,g,w,I,l))}}return d}function ea(i,e,r,s,l){if(!Dr(e,i.length)||!Dr(s,r.length))return NaN;let d=1/0;for(let p=e[0];p<=e[1];++p)for(let f=s[0];f<=s[1];++f)if(d=Math.min(d,l.distance(i[p],r[f])),d===0)return d;return d}function jt(i,e,r){if(Dn(i,e,!0))return 0;let s=1/0;for(const l of e){const d=l[0],p=l[l.length-1];if(d!==p&&(s=Math.min(s,Mt(i,[p,d],r)),s===0))return s;const f=r.pointOnLine(l,i);if(s=Math.min(s,r.distance(i,f.point)),s===0)return s}return s}function Lt(i,e,r,s){if(!Dr(e,i.length))return NaN;for(let d=e[0];d<=e[1];++d)if(Dn(i[d],r,!0))return 0;let l=1/0;for(let d=e[0];d<e[1];++d){const p=i[d],f=i[d+1];for(const g of r)for(let x=0,w=g.length,I=w-1;x<w;I=x++){const C=g[I],z=g[x];if(Ks(p,f,C,z))return 0;l=Math.min(l,Qo(p,f,C,z,s))}}return l}function ys(i,e){for(const r of i)for(const s of r)if(Dn(s,e,!0))return!0;return!1}function Al(i,e,r,s=1/0){const l=Ko(i),d=Ko(e);if(s!==1/0&&Yo(l,d,r)>=s)return s;if(ms(l,d)){if(ys(i,e))return 0}else if(ys(e,i))return 0;let p=1/0;for(const f of i)for(let g=0,x=f.length,w=x-1;g<x;w=g++){const I=f[w],C=f[g];for(const z of e)for(let R=0,F=z.length,$=F-1;R<F;$=R++){const X=z[$],se=z[R];if(Ks(I,C,X,se))return 0;p=Math.min(p,Qo(I,C,X,se,r))}}return p}function ta(i,e,r,s,l,d){if(!d)return;const p=Yo(Jo(s,d),l,r);p<e&&i.push([p,d,[0,0]])}function eo(i,e,r,s,l,d,p){if(!d||!p)return;const f=Yo(Jo(s,d),Jo(l,p),r);f<e&&i.push([f,d,p])}function to(i,e,r,s,l=1/0){let d=Math.min(s.distance(i[0],r[0][0]),l);if(d===0)return d;const p=new wl([[0,[0,i.length-1],[0,0]]],El),f=Ko(r);for(;p.length>0;){const g=p.pop();if(g[0]>=d)continue;const x=g[1],w=e?50:100;if(Qs(x)<=w){if(!Dr(x,i.length))return NaN;if(e){const I=Lt(i,x,r,s);if(isNaN(I)||I===0)return I;d=Math.min(d,I)}else for(let I=x[0];I<=x[1];++I){const C=jt(i[I],r,s);if(d=Math.min(d,C),d===0)return 0}}else{const I=_s(x,e);ta(p,d,s,i,f,I[0]),ta(p,d,s,i,f,I[1])}}return d}function io(i,e,r,s,l,d=1/0){let p=Math.min(d,l.distance(i[0],r[0]));if(p===0)return p;const f=new wl([[0,[0,i.length-1],[0,r.length-1]]],El);for(;f.length>0;){const g=f.pop();if(g[0]>=p)continue;const x=g[1],w=g[2],I=e?50:100,C=s?50:100;if(Qs(x)<=I&&Qs(w)<=C){if(!Dr(x,i.length)&&Dr(w,r.length))return NaN;let z;if(e&&s)z=dt(i,x,r,w,l),p=Math.min(p,z);else if(e&&!s){const R=i.slice(x[0],x[1]+1);for(let F=w[0];F<=w[1];++F)if(z=Mt(r[F],R,l),p=Math.min(p,z),p===0)return p}else if(!e&&s){const R=r.slice(w[0],w[1]+1);for(let F=x[0];F<=x[1];++F)if(z=Mt(i[F],R,l),p=Math.min(p,z),p===0)return p}else z=ea(i,x,r,w,l),p=Math.min(p,z)}else{const z=_s(x,e),R=_s(w,s);eo(f,p,l,i,r,z[0],R[0]),eo(f,p,l,i,r,z[0],R[1]),eo(f,p,l,i,r,z[1],R[0]),eo(f,p,l,i,r,z[1],R[1])}}return p}function ia(i){return i.type==="MultiPolygon"?i.coordinates.map(e=>({type:"Polygon",coordinates:e})):i.type==="MultiLineString"?i.coordinates.map(e=>({type:"LineString",coordinates:e})):i.type==="MultiPoint"?i.coordinates.map(e=>({type:"Point",coordinates:e})):[i]}class Xr{constructor(e,r){this.type=Ce,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ls(e[1])){const s=e[1];if(s.type==="FeatureCollection")return new Xr(s,s.features.map(l=>ia(l.geometry)).flat());if(s.type==="Feature")return new Xr(s,ia(s.geometry));if("type"in s&&"coordinates"in s)return new Xr(s,ia(s))}return r.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(r,s){const l=r.geometry(),d=l.flat().map(g=>zn([g.x,g.y],r.canonical));if(l.length===0)return NaN;const p=new Wo(d[0][1]);let f=1/0;for(const g of s){switch(g.type){case"Point":f=Math.min(f,io(d,!1,[g.coordinates],!1,p,f));break;case"LineString":f=Math.min(f,io(d,!1,g.coordinates,!0,p,f));break;case"Polygon":f=Math.min(f,to(d,!1,g.coordinates,p,f))}if(f===0)return f}return f}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,s){const l=r.geometry(),d=l.flat().map(g=>zn([g.x,g.y],r.canonical));if(l.length===0)return NaN;const p=new Wo(d[0][1]);let f=1/0;for(const g of s){switch(g.type){case"Point":f=Math.min(f,io(d,!0,[g.coordinates],!1,p,f));break;case"LineString":f=Math.min(f,io(d,!0,g.coordinates,!0,p,f));break;case"Polygon":f=Math.min(f,to(d,!0,g.coordinates,p,f))}if(f===0)return f}return f}(e,this.geometries);if(e.geometryType()==="Polygon")return function(r,s){const l=r.geometry();if(l.length===0||l[0].length===0)return NaN;const d=Ys(l,0).map(g=>g.map(x=>x.map(w=>zn([w.x,w.y],r.canonical)))),p=new Wo(d[0][0][0][1]);let f=1/0;for(const g of s)for(const x of d){switch(g.type){case"Point":f=Math.min(f,to([g.coordinates],!1,x,p,f));break;case"LineString":f=Math.min(f,to(g.coordinates,!0,x,p,f));break;case"Polygon":f=Math.min(f,Al(x,g.coordinates,p,f))}if(f===0)return f}return f}(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const dn={"==":pl,"!=":Fc,">":fl,"<":Oc,">=":Vc,"<=":ml,array:Xi,at:$o,boolean:Xi,case:Gs,coalesce:Xs,collator:Ws,format:Js,image:Zo,in:us,"index-of":qs,interpolate:Ui,"interpolate-hcl":Ui,"interpolate-lab":Ui,length:Go,let:vt,literal:cn,match:Zs,number:Xi,"number-format":qo,object:Xi,slice:Hs,step:Mn,string:Xi,"to-boolean":Zr,"to-color":Zr,"to-number":Zr,"to-string":Zr,var:$s,within:un,distance:Xr};class $i{constructor(e,r,s,l){this.name=e,this.type=r,this._evaluate=s,this.args=l}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){const s=e[0],l=$i.definitions[s];if(!l)return r.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);const d=Array.isArray(l)?l[0]:l.type,p=Array.isArray(l)?[[l[1],l[2]]]:l.overloads,f=p.filter(([x])=>!Array.isArray(x)||x.length===e.length-1);let g=null;for(const[x,w]of f){g=new Gr(r.registry,no,r.path,null,r.scope);const I=[];let C=!1;for(let z=1;z<e.length;z++){const R=e[z],F=Array.isArray(x)?x[z-1]:x.type,$=g.parse(R,1+I.length,F);if(!$){C=!0;break}I.push($)}if(!C)if(Array.isArray(x)&&x.length!==I.length)g.error(`Expected ${x.length} arguments, but found ${I.length} instead.`);else{for(let z=0;z<I.length;z++){const R=Array.isArray(x)?x[z]:x.type,F=I[z];g.concat(z+1).checkSubtype(R,F.type)}if(g.errors.length===0)return new $i(s,d,w,I)}}if(f.length===1)r.errors.push(...g.errors);else{const x=(f.length?f:p).map(([I])=>{return C=I,Array.isArray(C)?`(${C.map(A).join(", ")})`:`(${A(C.type)}...)`;var C}).join(" | "),w=[];for(let I=1;I<e.length;I++){const C=r.parse(e[I],1+w.length);if(!C)return null;w.push(A(C.type))}r.error(`Expected arguments of type ${x}, but found (${w.join(", ")}) instead.`)}return null}static register(e,r){$i.definitions=r;for(const s in r)e[s]=$i}}function ra(i,[e,r,s,l]){e=e.evaluate(i),r=r.evaluate(i),s=s.evaluate(i);const d=l?l.evaluate(i):1,p=js(e,r,s,d);if(p)throw new Wt(p);return new Tt(e/255,r/255,s/255,d,!1)}function ro(i,e){return i in e}function na(i,e){const r=e[i];return r===void 0?null:r}function pn(i){return{type:i}}function no(i){if(i instanceof $s)return no(i.boundExpression);if(i instanceof $i&&i.name==="error"||i instanceof Ws||i instanceof un||i instanceof Xr)return!1;const e=i instanceof Zr||i instanceof Xi;let r=!0;return i.eachChild(s=>{r=e?r&&no(s):r&&s instanceof cn}),!!r&&so(i)&&oo(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function so(i){if(i instanceof $i&&(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 un||i instanceof Xr)return!1;let e=!0;return i.eachChild(r=>{e&&!so(r)&&(e=!1)}),e}function xs(i){if(i instanceof $i&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!xs(r)&&(e=!1)}),e}function oo(i,e){if(i instanceof $i&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(s=>{r&&!oo(s,e)&&(r=!1)}),r}function kl(i){return{result:"success",value:i}}function Ln(i){return{result:"error",value:i}}function fn(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function sa(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function Rn(i){return!!i.expression&&i.expression.interpolated}function gt(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function vs(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Ml(i){return i}function zl(i,e){const r=e.type==="color",s=i.stops&&typeof i.stops[0][0]=="object",l=s||!(s||i.property!==void 0),d=i.type||(Rn(e)?"exponential":"interval");if(r||e.type==="padding"){const w=r?Tt.parse:Vi.parse;(i=mr({},i)).stops&&(i.stops=i.stops.map(I=>[I[0],w(I[1])])),i.default=w(i.default?i.default:e.default)}if(i.colorSpace&&(p=i.colorSpace)!=="rgb"&&p!=="hcl"&&p!=="lab")throw new Error(`Unknown color space: "${i.colorSpace}"`);var p;let f,g,x;if(d==="exponential")f=oa;else if(d==="interval")f=lo;else if(d==="categorical"){f=ao,g=Object.create(null);for(const w of i.stops)g[w[0]]=w[1];x=typeof i.stops[0][0]}else{if(d!=="identity")throw new Error(`Unknown function type "${d}"`);f=aa}if(s){const w={},I=[];for(let R=0;R<i.stops.length;R++){const F=i.stops[R],$=F[0].zoom;w[$]===void 0&&(w[$]={zoom:$,type:i.type,property:i.property,default:i.default,stops:[]},I.push($)),w[$].stops.push([F[0].value,F[1]])}const C=[];for(const R of I)C.push([w[R].zoom,zl(w[R],e)]);const z={name:"linear"};return{kind:"composite",interpolationType:z,interpolationFactor:Ui.interpolationFactor.bind(void 0,z),zoomStops:C.map(R=>R[0]),evaluate:({zoom:R},F)=>oa({stops:C,base:i.base},e,R).evaluate(R,F)}}if(l){const w=d==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:w,interpolationFactor:Ui.interpolationFactor.bind(void 0,w),zoomStops:i.stops.map(I=>I[0]),evaluate:({zoom:I})=>f(i,e,I,g,x)}}return{kind:"source",evaluate(w,I){const C=I&&I.properties?I.properties[i.property]:void 0;return C===void 0?mn(i.default,e.default):f(i,e,C,g,x)}}}function mn(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function ao(i,e,r,s,l){return mn(typeof r===l?s[r]:void 0,i.default,e.default)}function lo(i,e,r){if(gt(r)!=="number")return mn(i.default,e.default);const s=i.stops.length;if(s===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[s-1][0])return i.stops[s-1][1];const l=ds(i.stops.map(d=>d[0]),r);return i.stops[l][1]}function oa(i,e,r){const s=i.base!==void 0?i.base:1;if(gt(r)!=="number")return mn(i.default,e.default);const l=i.stops.length;if(l===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[l-1][0])return i.stops[l-1][1];const d=ds(i.stops.map(w=>w[0]),r),p=function(w,I,C,z){const R=z-C,F=w-C;return R===0?0:I===1?F/R:(Math.pow(I,F)-1)/(Math.pow(I,R)-1)}(r,s,i.stops[d][0],i.stops[d+1][0]),f=i.stops[d][1],g=i.stops[d+1][1],x=ji[e.type]||Ml;return typeof f.evaluate=="function"?{evaluate(...w){const I=f.evaluate.apply(void 0,w),C=g.evaluate.apply(void 0,w);if(I!==void 0&&C!==void 0)return x(I,C,p,i.colorSpace)}}:x(f,g,p,i.colorSpace)}function aa(i,e,r){switch(e.type){case"color":r=Tt.parse(r);break;case"formatted":r=Oi.fromString(r.toString());break;case"resolvedImage":r=di.fromString(r.toString());break;case"padding":r=Vi.parse(r);break;default:gt(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return mn(r,i.default,e.default)}$i.register(dn,{error:[{kind:"error"},[at],(i,[e])=>{throw new Wt(e.evaluate(i))}],typeof:[at,[rt],(i,[e])=>A(Yt(e.evaluate(i)))],"to-rgba":[k(Ce,4),[Ai],(i,[e])=>{const[r,s,l,d]=e.evaluate(i).rgb;return[255*r,255*s,255*l,d]}],rgb:[Ai,[Ce,Ce,Ce],ra],rgba:[Ai,[Ce,Ce,Ce,Ce],ra],has:{type:Qe,overloads:[[[at],(i,[e])=>ro(e.evaluate(i),i.properties())],[[at,ir],(i,[e,r])=>ro(e.evaluate(i),r.evaluate(i))]]},get:{type:rt,overloads:[[[at],(i,[e])=>na(e.evaluate(i),i.properties())],[[at,ir],(i,[e,r])=>na(e.evaluate(i),r.evaluate(i))]]},"feature-state":[rt,[at],(i,[e])=>na(e.evaluate(i),i.featureState||{})],properties:[ir,[],i=>i.properties()],"geometry-type":[at,[],i=>i.geometryType()],id:[rt,[],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:[rt,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Ce,pn(Ce),(i,e)=>{let r=0;for(const s of e)r+=s.evaluate(i);return r}],"*":[Ce,pn(Ce),(i,e)=>{let r=1;for(const s of e)r*=s.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,pn(Ce),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[Ce,pn(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-==":[Qe,[at,rt],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[Qe,[rt],(i,[e])=>i.id()===e.value],"filter-type-==":[Qe,[at],(i,[e])=>i.geometryType()===e.value],"filter-<":[Qe,[at,rt],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s<l}],"filter-id-<":[Qe,[rt],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r<s}],"filter->":[Qe,[at,rt],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>l}],"filter-id->":[Qe,[rt],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>s}],"filter-<=":[Qe,[at,rt],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s<=l}],"filter-id-<=":[Qe,[rt],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r<=s}],"filter->=":[Qe,[at,rt],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>=l}],"filter-id->=":[Qe,[rt],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>=s}],"filter-has":[Qe,[rt],(i,[e])=>e.value in i.properties()],"filter-has-id":[Qe,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Qe,[k(at)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[Qe,[k(rt)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[Qe,[at,k(rt)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[Qe,[at,k(rt)],(i,[e,r])=>function(s,l,d,p){for(;d<=p;){const f=d+p>>1;if(l[f]===s)return!0;l[f]>s?p=f-1:d=f+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:Qe,overloads:[[[Qe,Qe],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[pn(Qe),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:Qe,overloads:[[[Qe,Qe],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[pn(Qe),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[Qe,[Qe],(i,[e])=>!e.evaluate(i)],"is-supported-script":[Qe,[at],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[at,[at],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[at,[at],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[at,pn(rt),(i,e)=>e.map(r=>zr(r.evaluate(i))).join("")],"resolved-locale":[at,[_r],(i,[e])=>e.evaluate(i).resolvedLocale()]});class co{constructor(e,r){var s;this.expression=e,this._warningHistory={},this._evaluator=new hs,this._defaultValue=r?(s=r).type==="color"&&vs(s.default)?new Tt(0,0,0,0):s.type==="color"?Tt.parse(s.default)||null:s.type==="padding"?Vi.parse(s.default)||null:s.type==="variableAnchorOffsetCollection"?Ni.parse(s.default)||null:s.default===void 0?null:s.default:null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,s,l,d,p){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=s,this._evaluator.canonical=l,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p,this.expression.evaluate(this._evaluator)}evaluate(e,r,s,l,d,p){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=s||null,this._evaluator.canonical=l,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p||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 Wt(`Expected value to be one of ${Object.keys(this._enumValues).map(g=>JSON.stringify(g)).join(", ")}, but found ${JSON.stringify(f)} instead.`);return f}catch(f){return this._warningHistory[f.message]||(this._warningHistory[f.message]=!0,typeof console<"u"&&console.warn(f.message)),this._defaultValue}}}function bs(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in dn}function gn(i,e){const r=new Gr(dn,no,[],e?function(l){const d={color:Ai,string:at,number:Ce,enum:at,boolean:Qe,formatted:Mr,padding:qr,resolvedImage:yr,variableAnchorOffsetCollection:G};return l.type==="array"?k(d[l.value]||rt,l.length):d[l.type]}(e):void 0),s=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?kl(new co(s,e)):Ln(r.errors)}class la{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!xs(r.expression)}evaluateWithoutErrorHandling(e,r,s,l,d,p){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,l,d,p)}evaluate(e,r,s,l,d,p){return this._styleExpression.evaluate(e,r,s,l,d,p)}}class ca{constructor(e,r,s,l){this.kind=e,this.zoomStops=s,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!xs(r.expression),this.interpolationType=l}evaluateWithoutErrorHandling(e,r,s,l,d,p){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,l,d,p)}evaluate(e,r,s,l,d,p){return this._styleExpression.evaluate(e,r,s,l,d,p)}interpolationFactor(e,r,s){return this.interpolationType?Ui.interpolationFactor(this.interpolationType,e,r,s):0}}function Dl(i,e){const r=gn(i,e);if(r.result==="error")return r;const s=r.value.expression,l=so(s);if(!l&&!fn(e))return Ln([new Si("","data expressions not supported")]);const d=oo(s,["zoom"]);if(!d&&!sa(e))return Ln([new Si("","zoom expressions not supported")]);const p=uo(s);return p||d?p instanceof Si?Ln([p]):p instanceof Ui&&!Rn(e)?Ln([new Si("",'"interpolate" expressions cannot be used with this property')]):kl(p?new ca(l?"camera":"composite",r.value,p.labels,p instanceof Ui?p.interpolation:void 0):new la(l?"constant":"source",r.value)):Ln([new Si("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class ho{constructor(e,r){this._parameters=e,this._specification=r,mr(this,zl(this._parameters,this._specification))}static deserialize(e){return new ho(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function uo(i){let e=null;if(i instanceof vt)e=uo(i.result);else if(i instanceof Xs){for(const r of i.args)if(e=uo(r),e)break}else(i instanceof Mn||i instanceof Ui)&&i.input instanceof $i&&i.input.name==="zoom"&&(e=i);return e instanceof Si||i.eachChild(r=>{const s=uo(r);s instanceof Si?e=s:!e&&s?e=new Si("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&s&&e!==s&&(e=new Si("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Bn(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(!Bn(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const po={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ti(i){if(i==null)return{filter:()=>!0,needGeometry:!1};Bn(i)||(i=fo(i));const e=gn(i,po);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,s,l)=>e.value.evaluate(r,s,{},l),needGeometry:ha(i)}}function ws(i,e){return i<e?-1:i>e?1:0}function ha(i){if(!Array.isArray(i))return!1;if(i[0]==="within"||i[0]==="distance")return!0;for(let e=1;e<i.length;e++)if(ha(i[e]))return!0;return!1}function fo(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?ua(i[1],i[2],"=="):e==="!="?On(ua(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?ua(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(fo))):e==="all"?["all"].concat(i.slice(1).map(fo)):e==="none"?["all"].concat(i.slice(1).map(fo).map(On)):e==="in"?Fn(i[1],i.slice(2)):e==="!in"?On(Fn(i[1],i.slice(2))):e==="has"?da(i[1]):e!=="!has"||On(da(i[1]));var r}function ua(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 Fn(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(ws)]]:["filter-in-small",i,["literal",e]]}}function da(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function On(i){return["!",i]}function pa(i){const e=typeof i;if(e==="number"||e==="boolean"||e==="string"||i==null)return JSON.stringify(i);if(Array.isArray(i)){let l="[";for(const d of i)l+=`${pa(d)},`;return`${l}]`}const r=Object.keys(i).sort();let s="{";for(let l=0;l<r.length;l++)s+=`${JSON.stringify(r[l])}:${pa(i[r[l]])},`;return`${s}}`}function fa(i){let e="";for(const r of ln)e+=`/${pa(i[r])}`;return e}function Ll(i){const e=i.value;return e?[new Ie(i.key,e,"constants have been deprecated as of v8")]:[]}function Rt(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 Rt(i)}function ki(i){const e=i.key,r=i.value,s=i.valueSpec||{},l=i.objectElementValidators||{},d=i.style,p=i.styleSpec,f=i.validateSpec;let g=[];const x=gt(r);if(x!=="object")return[new Ie(e,r,`object expected, ${x} found`)];for(const w in r){const I=w.split(".")[0],C=s[I]||s["*"];let z;if(l[I])z=l[I];else if(s[I])z=f;else if(l["*"])z=l["*"];else{if(!s["*"]){g.push(new Ie(e,r[w],`unknown property "${w}"`));continue}z=f}g=g.concat(z({key:(e&&`${e}.`)+w,value:r[w],valueSpec:C,style:d,styleSpec:p,object:r,objectKey:w,validateSpec:f},r))}for(const w in s)l[w]||s[w].required&&s[w].default===void 0&&r[w]===void 0&&g.push(new Ie(e,r,`missing required property "${w}"`));return g}function mo(i){const e=i.value,r=i.valueSpec,s=i.style,l=i.styleSpec,d=i.key,p=i.arrayElementValidator||i.validateSpec;if(gt(e)!=="array")return[new Ie(d,e,`array expected, ${gt(e)} found`)];if(r.length&&e.length!==r.length)return[new Ie(d,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new Ie(d,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let f={type:r.value,values:r.values};l.$version<7&&(f.function=r.function),gt(r.value)==="object"&&(f=r.value);let g=[];for(let x=0;x<e.length;x++)g=g.concat(p({array:e,arrayIndex:x,value:e[x],valueSpec:f,validateSpec:i.validateSpec,style:s,styleSpec:l,key:`${d}[${x}]`}));return g}function Ss(i){const e=i.key,r=i.value,s=i.valueSpec;let l=gt(r);return l==="number"&&r!=r&&(l="NaN"),l!=="number"?[new Ie(e,r,`number expected, ${l} found`)]:"minimum"in s&&r<s.minimum?[new Ie(e,r,`${r} is less than the minimum value ${s.minimum}`)]:"maximum"in s&&r>s.maximum?[new Ie(e,r,`${r} is greater than the maximum value ${s.maximum}`)]:[]}function ma(i){const e=i.valueSpec,r=Rt(i.value.type);let s,l,d,p={};const f=r!=="categorical"&&i.value.property===void 0,g=!f,x=gt(i.value.stops)==="array"&>(i.value.stops[0])==="array"&>(i.value.stops[0][0])==="object",w=ki({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 F=z.value;return R=R.concat(mo({key:z.key,value:F,valueSpec:z.valueSpec,validateSpec:z.validateSpec,style:z.style,styleSpec:z.styleSpec,arrayElementValidator:I})),gt(F)==="array"&&F.length===0&&R.push(new Ie(z.key,F,"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&&w.push(new Ie(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||w.push(new Ie(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!Rn(i.valueSpec)&&w.push(new Ie(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(g&&!fn(i.valueSpec)?w.push(new Ie(i.key,i.value,"property functions not supported")):f&&!sa(i.valueSpec)&&w.push(new Ie(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!x||i.value.property!==void 0||w.push(new Ie(i.key,i.value,'"property" property is required')),w;function I(z){let R=[];const F=z.value,$=z.key;if(gt(F)!=="array")return[new Ie($,F,`array expected, ${gt(F)} found`)];if(F.length!==2)return[new Ie($,F,`array length 2 expected, length ${F.length} found`)];if(x){if(gt(F[0])!=="object")return[new Ie($,F,`object expected, ${gt(F[0])} found`)];if(F[0].zoom===void 0)return[new Ie($,F,"object stop key must have zoom")];if(F[0].value===void 0)return[new Ie($,F,"object stop key must have value")];if(d&&d>Rt(F[0].zoom))return[new Ie($,F[0].zoom,"stop zoom values must appear in ascending order")];Rt(F[0].zoom)!==d&&(d=Rt(F[0].zoom),l=void 0,p={}),R=R.concat(ki({key:`${$}[0]`,value:F[0],valueSpec:{zoom:{}},validateSpec:z.validateSpec,style:z.style,styleSpec:z.styleSpec,objectElementValidators:{zoom:Ss,value:C}}))}else R=R.concat(C({key:`${$}[0]`,value:F[0],valueSpec:{},validateSpec:z.validateSpec,style:z.style,styleSpec:z.styleSpec},F));return bs(_n(F[1]))?R.concat([new Ie(`${$}[1]`,F[1],"expressions are not allowed in function stops.")]):R.concat(z.validateSpec({key:`${$}[1]`,value:F[1],valueSpec:e,validateSpec:z.validateSpec,style:z.style,styleSpec:z.styleSpec}))}function C(z,R){const F=gt(z.value),$=Rt(z.value),X=z.value!==null?z.value:R;if(s){if(F!==s)return[new Ie(z.key,X,`${F} stop domain type must match previous stop domain type ${s}`)]}else s=F;if(F!=="number"&&F!=="string"&&F!=="boolean")return[new Ie(z.key,X,"stop domain value must be a number, string, or boolean")];if(F!=="number"&&r!=="categorical"){let se=`number expected, ${F} found`;return fn(e)&&r===void 0&&(se+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ie(z.key,X,se)]}return r!=="categorical"||F!=="number"||isFinite($)&&Math.floor($)===$?r!=="categorical"&&F==="number"&&l!==void 0&&$<l?[new Ie(z.key,X,"stop domain values must appear in ascending order")]:(l=$,r==="categorical"&&$ in p?[new Ie(z.key,X,"stop domain values must be unique")]:(p[$]=!0,[])):[new Ie(z.key,X,`integer expected, found ${$}`)]}}function yn(i){const e=(i.expressionContext==="property"?Dl:gn)(_n(i.value),i.valueSpec);if(e.result==="error")return e.value.map(s=>new Ie(`${i.key}${s.key}`,i.value,s.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"&&!xs(r))return[new Ie(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!xs(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(!oo(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"&&!so(r))return[new Ie(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Ts(i){const e=i.key,r=i.value,s=i.valueSpec,l=[];return Array.isArray(s.values)?s.values.indexOf(Rt(r))===-1&&l.push(new Ie(e,r,`expected one of [${s.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(s.values).indexOf(Rt(r))===-1&&l.push(new Ie(e,r,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(r)} found`)),l}function Is(i){return Bn(_n(i.value))?yn(mr({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Ps(i)}function Ps(i){const e=i.value,r=i.key;if(gt(e)!=="array")return[new Ie(r,e,`array expected, ${gt(e)} found`)];const s=i.styleSpec;let l,d=[];if(e.length<1)return[new Ie(r,e,"filter array must have at least 1 element")];switch(d=d.concat(Ts({key:`${r}[0]`,value:e[0],valueSpec:s.filter_operator,style:i.style,styleSpec:i.styleSpec})),Rt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Rt(e[1])==="$type"&&d.push(new Ie(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&d.push(new Ie(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(l=gt(e[1]),l!=="string"&&d.push(new Ie(`${r}[1]`,e[1],`string expected, ${l} found`)));for(let p=2;p<e.length;p++)l=gt(e[p]),Rt(e[1])==="$type"?d=d.concat(Ts({key:`${r}[${p}]`,value:e[p],valueSpec:s.geometry_type,style:i.style,styleSpec:i.styleSpec})):l!=="string"&&l!=="number"&&l!=="boolean"&&d.push(new Ie(`${r}[${p}]`,e[p],`string, number, or boolean expected, ${l} found`));break;case"any":case"all":case"none":for(let p=1;p<e.length;p++)d=d.concat(Ps({key:`${r}[${p}]`,value:e[p],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":l=gt(e[1]),e.length!==2?d.push(new Ie(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):l!=="string"&&d.push(new Ie(`${r}[1]`,e[1],`string expected, ${l} found`))}return d}function ga(i,e){const r=i.key,s=i.validateSpec,l=i.style,d=i.styleSpec,p=i.value,f=i.objectKey,g=d[`${e}_${i.layerType}`];if(!g)return[];const x=f.match(/^(.*)-transition$/);if(e==="paint"&&x&&g[x[1]]&&g[x[1]].transition)return s({key:r,value:p,valueSpec:d.transition,style:l,styleSpec:d});const w=i.valueSpec||g[f];if(!w)return[new Ie(r,p,`unknown property "${f}"`)];let I;if(gt(p)==="string"&&fn(w)&&!w.tokens&&(I=/^{([^}]+)}$/.exec(p)))return[new Ie(r,p,`"${f}" does not support interpolation syntax
|
5
|
-
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(I[1])} }\`.`)];const C=[];return i.layerType==="symbol"&&(f==="text-field"&&l&&!l.glyphs&&C.push(new Ie(r,p,'use of "text-field" requires a style "glyphs" property')),f==="text-font"&&vs(_n(p))&&Rt(p.type)==="identity"&&C.push(new Ie(r,p,'"text-font" does not support identity functions'))),C.concat(s({key:i.key,value:p,valueSpec:w,style:l,styleSpec:d,expressionContext:"property",propertyType:e,propertyKey:f}))}function _a(i){return ga(i,"paint")}function ya(i){return ga(i,"layout")}function xa(i){let e=[];const r=i.value,s=i.key,l=i.style,d=i.styleSpec;r.type||r.ref||e.push(new Ie(s,r,'either "type" or "ref" is required'));let p=Rt(r.type);const f=Rt(r.ref);if(r.id){const g=Rt(r.id);for(let x=0;x<i.arrayIndex;x++){const w=l.layers[x];Rt(w.id)===g&&e.push(new Ie(s,r.id,`duplicate layer id "${r.id}", previously used at line ${w.id.__line__}`))}}if("ref"in r){let g;["type","source","source-layer","filter","layout"].forEach(x=>{x in r&&e.push(new Ie(s,r[x],`"${x}" is prohibited for ref layers`))}),l.layers.forEach(x=>{Rt(x.id)===f&&(g=x)}),g?g.ref?e.push(new Ie(s,r.ref,"ref cannot reference another ref layer")):p=Rt(g.type):e.push(new Ie(s,r.ref,`ref layer "${f}" not found`))}else if(p!=="background")if(r.source){const g=l.sources&&l.sources[r.source],x=g&&Rt(g.type);g?x==="vector"&&p==="raster"?e.push(new Ie(s,r.source,`layer "${r.id}" requires a raster source`)):x!=="raster-dem"&&p==="hillshade"?e.push(new Ie(s,r.source,`layer "${r.id}" requires a raster-dem source`)):x==="raster"&&p!=="raster"?e.push(new Ie(s,r.source,`layer "${r.id}" requires a vector source`)):x!=="vector"||r["source-layer"]?x==="raster-dem"&&p!=="hillshade"?e.push(new Ie(s,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):p!=="line"||!r.paint||!r.paint["line-gradient"]||x==="geojson"&&g.lineMetrics||e.push(new Ie(s,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Ie(s,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new Ie(s,r.source,`source "${r.source}" not found`))}else e.push(new Ie(s,r,'missing required property "source"'));return e=e.concat(ki({key:s,value:r,valueSpec:d.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${s}.type`,value:r.type,valueSpec:d.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:Is,layout:g=>ki({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":x=>ya(mr({layerType:p},x))}}),paint:g=>ki({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":x=>_a(mr({layerType:p},x))}})}})),e}function Lr(i){const e=i.value,r=i.key,s=gt(e);return s!=="string"?[new Ie(r,e,`string expected, ${s} found`)]:[]}const va={promoteId:function({key:i,value:e}){if(gt(e)==="string")return Lr({key:i,value:e});{const r=[];for(const s in e)r.push(...Lr({key:`${i}.${s}`,value:e[s]}));return r}}};function Rl(i){const e=i.value,r=i.key,s=i.styleSpec,l=i.style,d=i.validateSpec;if(!e.type)return[new Ie(r,e,'"type" is required')];const p=Rt(e.type);let f;switch(p){case"vector":case"raster":return f=ki({key:r,value:e,valueSpec:s[`source_${p.replace("-","_")}`],style:i.style,styleSpec:s,objectElementValidators:va,validateSpec:d}),f;case"raster-dem":return f=function(g){var x;const w=(x=g.sourceName)!==null&&x!==void 0?x:"",I=g.value,C=g.styleSpec,z=C.source_raster_dem,R=g.style;let F=[];const $=gt(I);if(I===void 0)return F;if($!=="object")return F.push(new Ie("source_raster_dem",I,`object expected, ${$} found`)),F;const X=Rt(I.encoding)==="custom",se=["redFactor","greenFactor","blueFactor","baseShift"],Y=g.value.encoding?`"${g.value.encoding}"`:"Default";for(const ie in I)!X&&se.includes(ie)?F.push(new Ie(ie,I[ie],`In "${w}": "${ie}" is only valid when "encoding" is set to "custom". ${Y} encoding found`)):z[ie]?F=F.concat(g.validateSpec({key:ie,value:I[ie],valueSpec:z[ie],validateSpec:g.validateSpec,style:R,styleSpec:C})):F.push(new Ie(ie,I[ie],`unknown property "${ie}"`));return F}({sourceName:r,value:e,style:i.style,styleSpec:s,validateSpec:d}),f;case"geojson":if(f=ki({key:r,value:e,valueSpec:s.source_geojson,style:l,styleSpec:s,validateSpec:d,objectElementValidators:va}),e.cluster)for(const g in e.clusterProperties){const[x,w]=e.clusterProperties[g],I=typeof x=="string"?[x,["accumulated"],["get",g]]:x;f.push(...yn({key:`${r}.${g}.map`,value:w,validateSpec:d,expressionContext:"cluster-map"})),f.push(...yn({key:`${r}.${g}.reduce`,value:I,validateSpec:d,expressionContext:"cluster-reduce"}))}return f;case"video":return ki({key:r,value:e,valueSpec:s.source_video,style:l,validateSpec:d,styleSpec:s});case"image":return ki({key:r,value:e,valueSpec:s.source_image,style:l,validateSpec:d,styleSpec:s});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 Ts({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:l,validateSpec:d,styleSpec:s})}}function ba(i){const e=i.value,r=i.styleSpec,s=r.light,l=i.style;let d=[];const p=gt(e);if(e===void 0)return d;if(p!=="object")return d=d.concat([new Ie("light",e,`object expected, ${p} found`)]),d;for(const f in e){const g=f.match(/^(.*)-transition$/);d=d.concat(g&&s[g[1]]&&s[g[1]].transition?i.validateSpec({key:f,value:e[f],valueSpec:r.transition,validateSpec:i.validateSpec,style:l,styleSpec:r}):s[f]?i.validateSpec({key:f,value:e[f],valueSpec:s[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new Ie(f,e[f],`unknown property "${f}"`)])}return d}function Bl(i){const e=i.value,r=i.styleSpec,s=r.sky,l=i.style,d=gt(e);if(e===void 0)return[];if(d!=="object")return[new Ie("sky",e,`object expected, ${d} found`)];let p=[];for(const f in e)p=p.concat(s[f]?i.validateSpec({key:f,value:e[f],valueSpec:s[f],style:l,styleSpec:r}):[new Ie(f,e[f],`unknown property "${f}"`)]);return p}function wa(i){const e=i.value,r=i.styleSpec,s=r.terrain,l=i.style;let d=[];const p=gt(e);if(e===void 0)return d;if(p!=="object")return d=d.concat([new Ie("terrain",e,`object expected, ${p} found`)]),d;for(const f in e)d=d.concat(s[f]?i.validateSpec({key:f,value:e[f],valueSpec:s[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new Ie(f,e[f],`unknown property "${f}"`)]);return d}function Sa(i){let e=[];const r=i.value,s=i.key;if(Array.isArray(r)){const l=[],d=[];for(const p in r)r[p].id&&l.includes(r[p].id)&&e.push(new Ie(s,r,`all the sprites' ids must be unique, but ${r[p].id} is duplicated`)),l.push(r[p].id),r[p].url&&d.includes(r[p].url)&&e.push(new Ie(s,r,`all the sprites' URLs must be unique, but ${r[p].url} is duplicated`)),d.push(r[p].url),e=e.concat(ki({key:`${s}[${p}]`,value:r[p],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return e}return Lr({key:s,value:r})}const Ta={"*":()=>[],array:mo,boolean:function(i){const e=i.value,r=i.key,s=gt(e);return s!=="boolean"?[new Ie(r,e,`boolean expected, ${s} found`)]:[]},number:Ss,color:function(i){const e=i.key,r=i.value,s=gt(r);return s!=="string"?[new Ie(e,r,`color expected, ${s} found`)]:Tt.parse(String(r))?[]:[new Ie(e,r,`color expected, "${r}" found`)]},constants:Ll,enum:Ts,filter:Is,function:ma,layer:xa,object:ki,source:Rl,light:ba,sky:Bl,terrain:wa,projection:function(i){const e=i.value,r=i.styleSpec,s=r.projection,l=i.style,d=gt(e);if(e===void 0)return[];if(d!=="object")return[new Ie("projection",e,`object expected, ${d} found`)];let p=[];for(const f in e)p=p.concat(s[f]?i.validateSpec({key:f,value:e[f],valueSpec:s[f],style:l,styleSpec:r}):[new Ie(f,e[f],`unknown property "${f}"`)]);return p},string:Lr,formatted:function(i){return Lr(i).length===0?[]:yn(i)},resolvedImage:function(i){return Lr(i).length===0?[]:yn(i)},padding:function(i){const e=i.key,r=i.value;if(gt(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 s={type:"number"};let l=[];for(let d=0;d<r.length;d++)l=l.concat(i.validateSpec({key:`${e}[${d}]`,value:r[d],validateSpec:i.validateSpec,valueSpec:s}));return l}return Ss({key:e,value:r,valueSpec:{}})},variableAnchorOffsetCollection:function(i){const e=i.key,r=i.value,s=gt(r),l=i.styleSpec;if(s!=="array"||r.length<1||r.length%2!=0)return[new Ie(e,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let d=[];for(let p=0;p<r.length;p+=2)d=d.concat(Ts({key:`${e}[${p}]`,value:r[p],valueSpec:l.layout_symbol["text-anchor"]})),d=d.concat(mo({key:`${e}[${p+1}]`,value:r[p+1],valueSpec:{length:2,value:"number"},validateSpec:i.validateSpec,style:i.style,styleSpec:l}));return d},sprite:Sa};function Es(i){const e=i.value,r=i.valueSpec,s=i.styleSpec;return i.validateSpec=Es,r.expression&&vs(Rt(e))?ma(i):r.expression&&bs(_n(e))?yn(i):r.type&&Ta[r.type]?Ta[r.type](i):ki(mr({},i,{valueSpec:r.type?s[r.type]:r}))}function Fl(i){const e=i.value,r=i.key,s=Lr(i);return s.length||(e.indexOf("{fontstack}")===-1&&s.push(new Ie(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&s.push(new Ie(r,e,'"glyphs" url must include a "{range}" token'))),s}function Wi(i,e=ue){let r=[];return r=r.concat(Es({key:"",value:i,valueSpec:e.$root,styleSpec:e,style:i,validateSpec:Es,objectElementValidators:{glyphs:Fl,"*":()=>[]}})),i.constants&&(r=r.concat(Ll({key:"constants",value:i.constants,style:i,styleSpec:e,validateSpec:Es}))),Ia(r)}function rr(i){return function(e){return i({...e,validateSpec:Es})}}function Ia(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function nr(i){return function(...e){return Ia(i.apply(this,e))}}Wi.source=nr(rr(Rl)),Wi.sprite=nr(rr(Sa)),Wi.glyphs=nr(rr(Fl)),Wi.light=nr(rr(ba)),Wi.sky=nr(rr(Bl)),Wi.terrain=nr(rr(wa)),Wi.layer=nr(rr(xa)),Wi.filter=nr(rr(Is)),Wi.paintProperty=nr(rr(_a)),Wi.layoutProperty=nr(rr(ya));const Rr=Wi,Wc=Rr.light,Pa=Rr.sky,Jc=Rr.paintProperty,Kc=Rr.layoutProperty;function Ea(i,e){let r=!1;if(e&&e.length)for(const s of e)i.fire(new jr(new Error(s.message))),r=!0;return r}class Vn{constructor(e,r,s){const l=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const p=new Int32Array(this.arrayBuffer);e=p[0],this.d=(r=p[1])+2*(s=p[2]);for(let g=0;g<this.d*this.d;g++){const x=p[3+g],w=p[3+g+1];l.push(x===w?null:p.subarray(x,w))}const f=p[3+l.length+1];this.keys=p.subarray(p[3+l.length],f),this.bboxes=p.subarray(f),this.insert=this._insertReadonly}else{this.d=r+2*s;for(let p=0;p<this.d*this.d;p++)l.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=s,this.scale=r/e,this.uid=0;const d=s/r*e;this.min=-d,this.max=e+d}insert(e,r,s,l,d){this._forEachCell(r,s,l,d,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(s),this.bboxes.push(l),this.bboxes.push(d)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,s,l,d,p){this.cells[d].push(p)}query(e,r,s,l,d){const p=this.min,f=this.max;if(e<=p&&r<=p&&f<=s&&f<=l&&!d)return Array.prototype.slice.call(this.keys);{const g=[];return this._forEachCell(e,r,s,l,this._queryCell,g,{},d),g}}_queryCell(e,r,s,l,d,p,f,g){const x=this.cells[d];if(x!==null){const w=this.keys,I=this.bboxes;for(let C=0;C<x.length;C++){const z=x[C];if(f[z]===void 0){const R=4*z;(g?g(I[R+0],I[R+1],I[R+2],I[R+3]):e<=I[R+2]&&r<=I[R+3]&&s>=I[R+0]&&l>=I[R+1])?(f[z]=!0,p.push(w[z])):f[z]=!1}}}}_forEachCell(e,r,s,l,d,p,f,g){const x=this._convertToCellCoord(e),w=this._convertToCellCoord(r),I=this._convertToCellCoord(s),C=this._convertToCellCoord(l);for(let z=x;z<=I;z++)for(let R=w;R<=C;R++){const F=this.d*R+z;if((!g||g(this._convertFromCellCoord(z),this._convertFromCellCoord(R),this._convertFromCellCoord(z+1),this._convertFromCellCoord(R+1)))&&d.call(this,e,r,s,l,F,p,f,g))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 s=0;for(let p=0;p<this.cells.length;p++)s+=this.cells[p].length;const l=new Int32Array(r+s+this.keys.length+this.bboxes.length);l[0]=this.extent,l[1]=this.n,l[2]=this.padding;let d=r;for(let p=0;p<e.length;p++){const f=e[p];l[3+p]=d,l.set(f,d),d+=f.length}return l[3+e.length]=d,l.set(this.keys,d),d+=this.keys.length,l[3+e.length+1]=d,l.set(this.bboxes,d),d+=this.bboxes.length,l.buffer}static serialize(e,r){const s=e.toArrayBuffer();return r&&r.push(s),{buffer:s}}static deserialize(e){return new Vn(e.buffer)}}const vr={};function Oe(i,e,r={}){if(vr[i])throw new Error(`${i} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),vr[i]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}Oe("Object",Object),Oe("TransferableGridIndex",Vn),Oe("Color",Tt),Oe("Error",Error),Oe("AJAXError",Fi),Oe("ResolvedImage",di),Oe("StylePropertyFunction",ho),Oe("StyleExpression",co,{omit:["_evaluator"]}),Oe("ZoomDependentExpression",ca),Oe("ZoomConstantExpression",la),Oe("CompoundExpression",$i,{omit:["_evaluate"]});for(const i in dn)dn[i]._classRegistryKey||Oe(`Expression_${i}`,dn[i]);function Ol(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function Ca(i){return i.$name||i.constructor._classRegistryKey}function Vl(i){return!function(e){if(e===null||typeof e!="object")return!1;const r=Ca(e);return!(!r||r==="Object")}(i)&&(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||i instanceof Error||Ol(i)||pr(i)||ArrayBuffer.isView(i)||i instanceof ImageData)}function Cs(i,e){if(Vl(i))return(Ol(i)||pr(i))&&e&&e.push(i),ArrayBuffer.isView(i)&&e&&e.push(i.buffer),i instanceof ImageData&&e&&e.push(i.data.buffer),i;if(Array.isArray(i)){const d=[];for(const p of i)d.push(Cs(p,e));return d}if(typeof i!="object")throw new Error("can't serialize object of type "+typeof i);const r=Ca(i);if(!r)throw new Error(`can't serialize object of unregistered class ${i.constructor.name}`);if(!vr[r])throw new Error(`${r} is not registered.`);const{klass:s}=vr[r],l=s.serialize?s.serialize(i,e):{};if(s.serialize){if(e&&l===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const d in i){if(!i.hasOwnProperty(d)||vr[r].omit.indexOf(d)>=0)continue;const p=i[d];l[d]=vr[r].shallow.indexOf(d)>=0?p:Cs(p,e)}i instanceof Error&&(l.message=i.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(l.$name=r),l}function br(i){if(Vl(i))return i;if(Array.isArray(i))return i.map(br);if(typeof i!="object")throw new Error("can't deserialize object of type "+typeof i);const e=Ca(i)||"Object";if(!vr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=vr[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const s=Object.create(r.prototype);for(const l of Object.keys(i)){if(l==="$name")continue;const d=i[l];s[l]=vr[e].shallow.indexOf(l)>=0?d:br(d)}return s}class Nl{constructor(){this.first=!0}update(e,r){const s=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=s,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=s,!0):(this.lastFloorZoom>s?(this.lastIntegerZoom=s+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<s&&(this.lastIntegerZoom=s,this.lastIntegerZoomTime=r),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=s,!0))}}const ze={"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 Aa(i){for(const e of i)if(ka(e.charCodeAt(0)))return!0;return!1}function Yc(i){for(const e of i)if(!jl(e.charCodeAt(0)))return!1;return!0}function jl(i){return!(ze.Arabic(i)||ze["Arabic Supplement"](i)||ze["Arabic Extended-A"](i)||ze["Arabic Presentation Forms-A"](i)||ze["Arabic Presentation Forms-B"](i))}function ka(i){return!(i!==746&&i!==747&&(i<4352||!(ze["Bopomofo Extended"](i)||ze.Bopomofo(i)||ze["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||ze["CJK Compatibility Ideographs"](i)||ze["CJK Compatibility"](i)||ze["CJK Radicals Supplement"](i)||ze["CJK Strokes"](i)||!(!ze["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||ze["CJK Unified Ideographs Extension A"](i)||ze["CJK Unified Ideographs"](i)||ze["Enclosed CJK Letters and Months"](i)||ze["Hangul Compatibility Jamo"](i)||ze["Hangul Jamo Extended-A"](i)||ze["Hangul Jamo Extended-B"](i)||ze["Hangul Jamo"](i)||ze["Hangul Syllables"](i)||ze.Hiragana(i)||ze["Ideographic Description Characters"](i)||ze.Kanbun(i)||ze["Kangxi Radicals"](i)||ze["Katakana Phonetic Extensions"](i)||ze.Katakana(i)&&i!==12540||!(!ze["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)||!(!ze["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||ze["Unified Canadian Aboriginal Syllabics"](i)||ze["Unified Canadian Aboriginal Syllabics Extended"](i)||ze["Vertical Forms"](i)||ze["Yijing Hexagram Symbols"](i)||ze["Yi Syllables"](i)||ze["Yi Radicals"](i))))}function Ul(i){return!(ka(i)||function(e){return!!(ze["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||ze["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)||ze["Letterlike Symbols"](e)||ze["Number Forms"](e)||ze["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)||ze["Control Pictures"](e)&&e!==9251||ze["Optical Character Recognition"](e)||ze["Enclosed Alphanumerics"](e)||ze["Geometric Shapes"](e)||ze["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||ze["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||ze["CJK Symbols and Punctuation"](e)||ze.Katakana(e)||ze["Private Use Area"](e)||ze["CJK Compatibility Forms"](e)||ze["Small Form Variants"](e)||ze["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 Wr(i){return i>=1424&&i<=2303||ze["Arabic Presentation Forms-A"](i)||ze["Arabic Presentation Forms-B"](i)}function $l(i,e){return!(!e&&Wr(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||ze.Khmer(i))}function Ma(i){for(const e of i)if(Wr(e.charCodeAt(0)))return!0;return!1}const Jr=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(i){this.pluginStatus=i.pluginStatus,this.pluginURL=i.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(i){this.applyArabicShaping=i.applyArabicShaping,this.processBidirectionalText=i.processBidirectionalText,this.processStyledBidirectionalText=i.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class zt{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 Nl,this.transition={})}isSupportedScript(e){return function(r,s){for(const l of r)if(!$l(l.charCodeAt(0),s))return!1;return!0}(e,Jr.getRTLTextPluginStatus()==="loaded")}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),s=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*s}:{fromScale:.5,toScale:1,t:1-(1-s)*r}}}class go{constructor(e,r){this.property=e,this.value=r,this.expression=function(s,l){if(vs(s))return new ho(s,l);if(bs(s)){const d=Dl(s,l);if(d.result==="error")throw new Error(d.value.map(p=>`${p.key}: ${p.message}`).join(", "));return d.value}{let d=s;return l.type==="color"&&typeof s=="string"?d=Tt.parse(s):l.type!=="padding"||typeof s!="number"&&!Array.isArray(s)?l.type==="variableAnchorOffsetCollection"&&Array.isArray(s)&&(d=Ni.parse(s)):d=Vi.parse(s),{kind:"constant",evaluate:()=>d}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,s){return this.property.possiblyEvaluate(this,e,r,s)}}class Nn{constructor(e){this.property=e,this.value=new go(e,void 0)}transitioned(e,r){return new ql(this.property,this.value,r,It({},e.transition,this.transition),e.now)}untransitioned(){return new ql(this.property,this.value,null,{},0)}}class jn{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return wt(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Nn(this._values[e].property)),this._values[e].value=new go(this._values[e].property,r===null?void 0:wt(r))}getTransition(e){return wt(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Nn(this._values[e].property)),this._values[e].transition=wt(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(e[r]=s);const l=this.getTransition(r);l!==void 0&&(e[`${r}-transition`]=l)}return e}transitioned(e,r){const s=new za(this._properties);for(const l of Object.keys(this._values))s._values[l]=this._values[l].transitioned(e,r._values[l]);return s}untransitioned(){const e=new za(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class ql{constructor(e,r,s,l,d){this.property=e,this.value=r,this.begin=d+l.delay||0,this.end=this.begin+l.duration||0,e.specification.transition&&(l.delay||l.duration)&&(this.prior=s)}possiblyEvaluate(e,r,s){const l=e.now||0,d=this.value.possiblyEvaluate(e,r,s),p=this.prior;if(p){if(l>this.end)return this.prior=null,d;if(this.value.isDataDriven())return this.prior=null,d;if(l<this.begin)return p.possiblyEvaluate(e,r,s);{const f=(l-this.begin)/(this.end-this.begin);return this.property.interpolate(p.possiblyEvaluate(e,r,s),d,function(g){if(g<=0)return 0;if(g>=1)return 1;const x=g*g,w=x*g;return 4*(g<.5?w:3*(g-x)+w-.75)}(f))}}return d}}class za{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,s){const l=new _o(this._properties);for(const d of Object.keys(this._values))l._values[d]=this._values[d].possiblyEvaluate(e,r,s);return l}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class As{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return wt(this._values[e].value)}setValue(e,r){this._values[e]=new go(this._values[e].property,r===null?void 0:wt(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(e[r]=s)}return e}possiblyEvaluate(e,r,s){const l=new _o(this._properties);for(const d of Object.keys(this._values))l._values[d]=this._values[d].possiblyEvaluate(e,r,s);return l}}class wr{constructor(e,r,s){this.property=e,this.value=r,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,s,l){return this.property.evaluate(this.value,this.parameters,e,r,s,l)}}class _o{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Ze{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,s){const l=ji[this.specification.type];return l?l(e,r,s):e}}class Je{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,s,l){return new wr(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},s,l)}:e.expression,r)}interpolate(e,r,s){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new wr(this,{kind:"constant",value:void 0},e.parameters);const l=ji[this.specification.type];if(l){const d=l(e.value.value,r.value.value,s);return new wr(this,{kind:"constant",value:d},e.parameters)}return e}evaluate(e,r,s,l,d,p){return e.kind==="constant"?e.value:e.evaluate(r,s,l,d,p)}}class u extends Je{possiblyEvaluate(e,r,s,l){if(e.value===void 0)return new wr(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const d=e.expression.evaluate(r,null,{},s,l),p=e.property.specification.type==="resolvedImage"&&typeof d!="string"?d.name:d,f=this._calculate(p,p,p,r);return new wr(this,{kind:"constant",value:f},r)}if(e.expression.kind==="camera"){const d=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 wr(this,{kind:"constant",value:d},r)}return new wr(this,e.expression,r)}evaluate(e,r,s,l,d,p){if(e.kind==="source"){const f=e.evaluate(r,s,l,d,p);return this._calculate(f,f,f,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},s,l),e.evaluate({zoom:Math.floor(r.zoom)},s,l),e.evaluate({zoom:Math.floor(r.zoom)+1},s,l),r):e.value}_calculate(e,r,s,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:s,to:r}}interpolate(e){return e}}class t{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,l){if(e.value!==void 0){if(e.expression.kind==="constant"){const d=e.expression.evaluate(r,null,{},s,l);return this._calculate(d,d,d,r)}return this._calculate(e.expression.evaluate(new zt(Math.floor(r.zoom-1),r)),e.expression.evaluate(new zt(Math.floor(r.zoom),r)),e.expression.evaluate(new zt(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,s,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:s,to:r}}interpolate(e){return e}}class n{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,l){return!!e.expression.evaluate(r,null,{},s,l)}interpolate(){return!1}}class o{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in e){const s=e[r];s.specification.overridable&&this.overridableProperties.push(r);const l=this.defaultPropertyValues[r]=new go(s,void 0),d=this.defaultTransitionablePropertyValues[r]=new Nn(s);this.defaultTransitioningPropertyValues[r]=d.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=l.possiblyEvaluate({})}}}Oe("DataDrivenProperty",Je),Oe("DataConstantProperty",Ze),Oe("CrossFadedDataDrivenProperty",u),Oe("CrossFadedProperty",t),Oe("ColorRampProperty",n);const a="-transition";class h extends An{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 As(r.layout)),r.paint)){this._transitionablePaint=new jn(r.paint);for(const s in e.paint)this.setPaintProperty(s,e.paint[s],{validate:!1});for(const s in e.layout)this.setLayoutProperty(s,e.layout[s],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new _o(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,s={}){r!=null&&this._validate(Kc,`layers.${this.id}.layout.${e}`,e,r,s)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(a)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,s={}){if(r!=null&&this._validate(Jc,`layers.${this.id}.paint.${e}`,e,r,s))return!1;if(e.endsWith(a))return this._transitionablePaint.setTransition(e.slice(0,-11),r||void 0),!1;{const l=this._transitionablePaint._values[e],d=l.property.specification["property-type"]==="cross-faded-data-driven",p=l.value.isDataDriven(),f=l.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const g=this._transitionablePaint._values[e].value;return g.isDataDriven()||p||d||this._handleOverridablePaintPropertyUpdate(e,f,g)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,s){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),Qi(e,(r,s)=>!(r===void 0||s==="layout"&&!Object.keys(r).length||s==="paint"&&!Object.keys(r).length))}_validate(e,r,s,l,d={}){return(!d||d.validate!==!1)&&Ea(this,e.call(Rr,{key:r,layerType:this.type,objectKey:s,value:l,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 wr&&fn(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const m={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class _{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 v{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 b(i,e=1){let r=0,s=0;return{members:i.map(l=>{const d=m[l.type].BYTES_PER_ELEMENT,p=r=P(r,Math.max(e,d)),f=l.components||1;return s=Math.max(s,d),r+=d*f,{name:l.name,type:l.type,components:f,offset:p}}),size:P(r,Math.max(s,e)),alignment:e}}function P(i,e){return Math.ceil(i/e)*e}class E extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.int16[l+0]=r,this.int16[l+1]=s,e}}E.prototype.bytesPerElement=4,Oe("StructArrayLayout2i4",E);class L extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const d=3*e;return this.int16[d+0]=r,this.int16[d+1]=s,this.int16[d+2]=l,e}}L.prototype.bytesPerElement=6,Oe("StructArrayLayout3i6",L);class B extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const d=this.length;return this.resize(d+1),this.emplace(d,e,r,s,l)}emplace(e,r,s,l,d){const p=4*e;return this.int16[p+0]=r,this.int16[p+1]=s,this.int16[p+2]=l,this.int16[p+3]=d,e}}B.prototype.bytesPerElement=8,Oe("StructArrayLayout4i8",B);class V extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,d,p){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,d,p)}emplace(e,r,s,l,d,p,f){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=s,this.int16[g+2]=l,this.int16[g+3]=d,this.int16[g+4]=p,this.int16[g+5]=f,e}}V.prototype.bytesPerElement=12,Oe("StructArrayLayout2i4i12",V);class Z extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,d,p){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,d,p)}emplace(e,r,s,l,d,p,f){const g=4*e,x=8*e;return this.int16[g+0]=r,this.int16[g+1]=s,this.uint8[x+4]=l,this.uint8[x+5]=d,this.uint8[x+6]=p,this.uint8[x+7]=f,e}}Z.prototype.bytesPerElement=8,Oe("StructArrayLayout2i4ub8",Z);class U extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.float32[l+0]=r,this.float32[l+1]=s,e}}U.prototype.bytesPerElement=8,Oe("StructArrayLayout2f8",U);class H extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,d,p,f,g,x,w){const I=this.length;return this.resize(I+1),this.emplace(I,e,r,s,l,d,p,f,g,x,w)}emplace(e,r,s,l,d,p,f,g,x,w,I){const C=10*e;return this.uint16[C+0]=r,this.uint16[C+1]=s,this.uint16[C+2]=l,this.uint16[C+3]=d,this.uint16[C+4]=p,this.uint16[C+5]=f,this.uint16[C+6]=g,this.uint16[C+7]=x,this.uint16[C+8]=w,this.uint16[C+9]=I,e}}H.prototype.bytesPerElement=20,Oe("StructArrayLayout10ui20",H);class K extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,d,p,f,g,x,w,I,C){const z=this.length;return this.resize(z+1),this.emplace(z,e,r,s,l,d,p,f,g,x,w,I,C)}emplace(e,r,s,l,d,p,f,g,x,w,I,C,z){const R=12*e;return this.int16[R+0]=r,this.int16[R+1]=s,this.int16[R+2]=l,this.int16[R+3]=d,this.uint16[R+4]=p,this.uint16[R+5]=f,this.uint16[R+6]=g,this.uint16[R+7]=x,this.int16[R+8]=w,this.int16[R+9]=I,this.int16[R+10]=C,this.int16[R+11]=z,e}}K.prototype.bytesPerElement=24,Oe("StructArrayLayout4i4ui4i24",K);class j extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const d=3*e;return this.float32[d+0]=r,this.float32[d+1]=s,this.float32[d+2]=l,e}}j.prototype.bytesPerElement=12,Oe("StructArrayLayout3f12",j);class ee extends v{_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}}ee.prototype.bytesPerElement=4,Oe("StructArrayLayout1ul4",ee);class ne extends v{_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,s,l,d,p,f,g,x){const w=this.length;return this.resize(w+1),this.emplace(w,e,r,s,l,d,p,f,g,x)}emplace(e,r,s,l,d,p,f,g,x,w){const I=10*e,C=5*e;return this.int16[I+0]=r,this.int16[I+1]=s,this.int16[I+2]=l,this.int16[I+3]=d,this.int16[I+4]=p,this.int16[I+5]=f,this.uint32[C+3]=g,this.uint16[I+8]=x,this.uint16[I+9]=w,e}}ne.prototype.bytesPerElement=20,Oe("StructArrayLayout6i1ul2ui20",ne);class ce extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,d,p){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,d,p)}emplace(e,r,s,l,d,p,f){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=s,this.int16[g+2]=l,this.int16[g+3]=d,this.int16[g+4]=p,this.int16[g+5]=f,e}}ce.prototype.bytesPerElement=12,Oe("StructArrayLayout2i2i2i12",ce);class ge extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,d){const p=this.length;return this.resize(p+1),this.emplace(p,e,r,s,l,d)}emplace(e,r,s,l,d,p){const f=4*e,g=8*e;return this.float32[f+0]=r,this.float32[f+1]=s,this.float32[f+2]=l,this.int16[g+6]=d,this.int16[g+7]=p,e}}ge.prototype.bytesPerElement=16,Oe("StructArrayLayout2f1f2i16",ge);class we extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,d,p){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,d,p)}emplace(e,r,s,l,d,p,f){const g=16*e,x=4*e,w=8*e;return this.uint8[g+0]=r,this.uint8[g+1]=s,this.float32[x+1]=l,this.float32[x+2]=d,this.int16[w+6]=p,this.int16[w+7]=f,e}}we.prototype.bytesPerElement=16,Oe("StructArrayLayout2ub2f2i16",we);class De extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const d=3*e;return this.uint16[d+0]=r,this.uint16[d+1]=s,this.uint16[d+2]=l,e}}De.prototype.bytesPerElement=6,Oe("StructArrayLayout3ui6",De);class Re extends v{_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,s,l,d,p,f,g,x,w,I,C,z,R,F,$,X){const se=this.length;return this.resize(se+1),this.emplace(se,e,r,s,l,d,p,f,g,x,w,I,C,z,R,F,$,X)}emplace(e,r,s,l,d,p,f,g,x,w,I,C,z,R,F,$,X,se){const Y=24*e,ie=12*e,de=48*e;return this.int16[Y+0]=r,this.int16[Y+1]=s,this.uint16[Y+2]=l,this.uint16[Y+3]=d,this.uint32[ie+2]=p,this.uint32[ie+3]=f,this.uint32[ie+4]=g,this.uint16[Y+10]=x,this.uint16[Y+11]=w,this.uint16[Y+12]=I,this.float32[ie+7]=C,this.float32[ie+8]=z,this.uint8[de+36]=R,this.uint8[de+37]=F,this.uint8[de+38]=$,this.uint32[ie+10]=X,this.int16[Y+22]=se,e}}Re.prototype.bytesPerElement=48,Oe("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Re);class Se extends v{_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,s,l,d,p,f,g,x,w,I,C,z,R,F,$,X,se,Y,ie,de,xe,Le,We,Me,Ae,qe,Ve){const Be=this.length;return this.resize(Be+1),this.emplace(Be,e,r,s,l,d,p,f,g,x,w,I,C,z,R,F,$,X,se,Y,ie,de,xe,Le,We,Me,Ae,qe,Ve)}emplace(e,r,s,l,d,p,f,g,x,w,I,C,z,R,F,$,X,se,Y,ie,de,xe,Le,We,Me,Ae,qe,Ve,Be){const me=32*e,Ge=16*e;return this.int16[me+0]=r,this.int16[me+1]=s,this.int16[me+2]=l,this.int16[me+3]=d,this.int16[me+4]=p,this.int16[me+5]=f,this.int16[me+6]=g,this.int16[me+7]=x,this.uint16[me+8]=w,this.uint16[me+9]=I,this.uint16[me+10]=C,this.uint16[me+11]=z,this.uint16[me+12]=R,this.uint16[me+13]=F,this.uint16[me+14]=$,this.uint16[me+15]=X,this.uint16[me+16]=se,this.uint16[me+17]=Y,this.uint16[me+18]=ie,this.uint16[me+19]=de,this.uint16[me+20]=xe,this.uint16[me+21]=Le,this.uint16[me+22]=We,this.uint32[Ge+12]=Me,this.float32[Ge+13]=Ae,this.float32[Ge+14]=qe,this.uint16[me+30]=Ve,this.uint16[me+31]=Be,e}}Se.prototype.bytesPerElement=64,Oe("StructArrayLayout8i15ui1ul2f2ui64",Se);class Te extends v{_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}}Te.prototype.bytesPerElement=4,Oe("StructArrayLayout1f4",Te);class Ne extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const d=3*e;return this.uint16[6*e+0]=r,this.float32[d+1]=s,this.float32[d+2]=l,e}}Ne.prototype.bytesPerElement=12,Oe("StructArrayLayout1ui2f12",Ne);class it extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const d=4*e;return this.uint32[2*e+0]=r,this.uint16[d+2]=s,this.uint16[d+3]=l,e}}it.prototype.bytesPerElement=8,Oe("StructArrayLayout1ul2ui8",it);class Ee extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.uint16[l+0]=r,this.uint16[l+1]=s,e}}Ee.prototype.bytesPerElement=4,Oe("StructArrayLayout2ui4",Ee);class ke extends v{_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}}ke.prototype.bytesPerElement=2,Oe("StructArrayLayout1ui2",ke);class et extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const d=this.length;return this.resize(d+1),this.emplace(d,e,r,s,l)}emplace(e,r,s,l,d){const p=4*e;return this.float32[p+0]=r,this.float32[p+1]=s,this.float32[p+2]=l,this.float32[p+3]=d,e}}et.prototype.bytesPerElement=16,Oe("StructArrayLayout4f16",et);class Bt extends _{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 le(this.anchorPointX,this.anchorPointY)}}Bt.prototype.size=20;class ot extends ne{get(e){return new Bt(this,e)}}Oe("CollisionBoxArray",ot);class pt extends _{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]}}pt.prototype.size=48;class Ft extends Re{get(e){return new pt(this,e)}}Oe("PlacedSymbolArray",Ft);class pi extends _{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]}}pi.prototype.size=64;class sr extends Se{get(e){return new pi(this,e)}}Oe("SymbolInstanceArray",sr);class Ot extends Te{getoffsetX(e){return this.float32[1*e+0]}}Oe("GlyphOffsetArray",Ot);class Mi extends L{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Oe("SymbolLineVertexArray",Mi);class Ii extends _{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]}}Ii.prototype.size=12;class fi extends Ne{get(e){return new Ii(this,e)}}Oe("TextAnchorOffsetArray",fi);class mi extends _{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]}}mi.prototype.size=8;class or extends it{get(e){return new mi(this,e)}}Oe("FeatureIndexArray",or);class xn extends E{}class yo extends E{}class Un extends E{}class vn extends V{}class xo extends Z{}class Da extends U{}class ai extends H{}class ar extends K{}class Kr extends j{}class $n extends ee{}class gi extends ce{}class _i extends we{}class ni extends De{}class Ut extends Ee{}const qn=b([{name:"a_pos",components:2,type:"Int16"}],4),{members:La}=qn;class ti{constructor(e=[]){this.segments=e}prepareSegment(e,r,s,l){let d=this.segments[this.segments.length-1];return e>ti.MAX_VERTEX_ARRAY_LENGTH&&ci(`Max vertices per segment is ${ti.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!d||d.vertexLength+e>ti.MAX_VERTEX_ARRAY_LENGTH||d.sortKey!==l)&&(d={vertexOffset:r.length,primitiveOffset:s.length,vertexLength:0,primitiveLength:0},l!==void 0&&(d.sortKey=l),this.segments.push(d)),d}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,s,l){return new ti([{vertexOffset:e,primitiveOffset:r,vertexLength:s,primitiveLength:l,vaos:{},sortKey:0}])}}function Zl(i,e){return 256*(i=yt(Math.floor(i),0,255))+yt(Math.floor(e),0,255)}ti.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Oe("SegmentVector",ti);const vo=b([{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 bo={exports:{}},Yr={exports:{}};Yr.exports=function(i,e){var r,s,l,d,p,f,g,x;for(s=i.length-(r=3&i.length),l=e,p=3432918353,f=461845907,x=0;x<s;)g=255&i.charCodeAt(x)|(255&i.charCodeAt(++x))<<8|(255&i.charCodeAt(++x))<<16|(255&i.charCodeAt(++x))<<24,++x,l=27492+(65535&(d=5*(65535&(l=(l^=g=(65535&(g=(g=(65535&g)*p+(((g>>>16)*p&65535)<<16)&4294967295)<<15|g>>>17))*f+(((g>>>16)*f&65535)<<16)&4294967295)<<13|l>>>19))+((5*(l>>>16)&65535)<<16)&4294967295))+((58964+(d>>>16)&65535)<<16);switch(g=0,r){case 3:g^=(255&i.charCodeAt(x+2))<<16;case 2:g^=(255&i.charCodeAt(x+1))<<8;case 1:l^=g=(65535&(g=(g=(65535&(g^=255&i.charCodeAt(x)))*p+(((g>>>16)*p&65535)<<16)&4294967295)<<15|g>>>17))*f+(((g>>>16)*f&65535)<<16)&4294967295}return l^=i.length,l=2246822507*(65535&(l^=l>>>16))+((2246822507*(l>>>16)&65535)<<16)&4294967295,l=3266489909*(65535&(l^=l>>>13))+((3266489909*(l>>>16)&65535)<<16)&4294967295,(l^=l>>>16)>>>0};var Gl=Yr.exports,Ra={exports:{}};Ra.exports=function(i,e){for(var r,s=i.length,l=e^s,d=0;s>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(d)|(255&i.charCodeAt(++d))<<8|(255&i.charCodeAt(++d))<<16|(255&i.charCodeAt(++d))<<24))+((1540483477*(r>>>16)&65535)<<16),l=1540483477*(65535&l)+((1540483477*(l>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),s-=4,++d;switch(s){case 3:l^=(255&i.charCodeAt(d+2))<<16;case 2:l^=(255&i.charCodeAt(d+1))<<8;case 1:l=1540483477*(65535&(l^=255&i.charCodeAt(d)))+((1540483477*(l>>>16)&65535)<<16)}return l=1540483477*(65535&(l^=l>>>13))+((1540483477*(l>>>16)&65535)<<16),(l^=l>>>15)>>>0};var Ba=Gl,Fa=Ra.exports;bo.exports=Ba,bo.exports.murmur3=Ba,bo.exports.murmur2=Fa;var wo=ve(bo.exports);class Zn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,s,l){this.ids.push(Du(e)),this.positions.push(r,s,l)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=Du(e);let s=0,l=this.ids.length-1;for(;s<l;){const p=s+l>>1;this.ids[p]>=r?l=p:s=p+1}const d=[];for(;this.ids[s]===r;)d.push({index:this.positions[3*s],start:this.positions[3*s+1],end:this.positions[3*s+2]}),s++;return d}static serialize(e,r){const s=new Float64Array(e.ids),l=new Uint32Array(e.positions);return Qc(s,l,0,s.length-1),r&&r.push(s.buffer,l.buffer),{ids:s,positions:l}}static deserialize(e){const r=new Zn;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function Du(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:wo(String(i))}function Qc(i,e,r,s){for(;r<s;){const l=i[r+s>>1];let d=r-1,p=s+1;for(;;){do d++;while(i[d]<l);do p--;while(i[p]>l);if(d>=p)break;Hl(i,d,p),Hl(e,3*d,3*p),Hl(e,3*d+1,3*p+1),Hl(e,3*d+2,3*p+2)}p-r<s-p?(Qc(i,e,r,p),r=p+1):(Qc(i,e,p+1,s),s=p)}}function Hl(i,e,r){const s=i[e];i[e]=i[r],i[r]=s}Oe("FeaturePositionMap",Zn);class ks{constructor(e,r){this.gl=e.gl,this.location=r}}class Xl extends ks{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Lu extends ks{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 Ru extends ks{constructor(e,r){super(e,r),this.current=Tt.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 pg=new Float32Array(16);function eh(i){return[Zl(255*i.r,255*i.g),Zl(255*i.b,255*i.a)]}class Oa{constructor(e,r,s){this.value=e,this.uniformNames=r.map(l=>`u_${l}`),this.type=s}setUniform(e,r,s){e.set(s.constantOr(this.value))}getBinding(e,r,s){return this.type==="color"?new Ru(e,r):new Xl(e,r)}}class So{constructor(e,r){this.uniformNames=r.map(s=>`u_${s}`),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,s,l){const d=l==="u_pattern_to"?this.patternTo:l==="u_pattern_from"?this.patternFrom:l==="u_pixel_ratio_to"?this.pixelRatioTo:l==="u_pixel_ratio_from"?this.pixelRatioFrom:null;d&&e.set(d)}getBinding(e,r,s){return s.substr(0,9)==="u_pattern"?new Lu(e,r):new Xl(e,r)}}class bn{constructor(e,r,s,l){this.expression=e,this.type=s,this.maxValue=0,this.paintVertexAttributes=r.map(d=>({name:`a_${d}`,type:"Float32",components:s==="color"?2:1,offset:0})),this.paintVertexArray=new l}populatePaintArray(e,r,s,l,d){const p=this.paintVertexArray.length,f=this.expression.evaluate(new zt(0),r,{},l,[],d);this.paintVertexArray.resize(e),this._setPaintValue(p,e,f)}updatePaintArray(e,r,s,l){const d=this.expression.evaluate({zoom:0},s,l);this._setPaintValue(e,r,d)}_setPaintValue(e,r,s){if(this.type==="color"){const l=eh(s);for(let d=e;d<r;d++)this.paintVertexArray.emplace(d,l[0],l[1])}else{for(let l=e;l<r;l++)this.paintVertexArray.emplace(l,s);this.maxValue=Math.max(this.maxValue,Math.abs(s))}}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 Br{constructor(e,r,s,l,d,p){this.expression=e,this.uniformNames=r.map(f=>`u_${f}_t`),this.type=s,this.useIntegerZoom=l,this.zoom=d,this.maxValue=0,this.paintVertexAttributes=r.map(f=>({name:`a_${f}`,type:"Float32",components:s==="color"?4:2,offset:0})),this.paintVertexArray=new p}populatePaintArray(e,r,s,l,d){const p=this.expression.evaluate(new zt(this.zoom),r,{},l,[],d),f=this.expression.evaluate(new zt(this.zoom+1),r,{},l,[],d),g=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(g,e,p,f)}updatePaintArray(e,r,s,l){const d=this.expression.evaluate({zoom:this.zoom},s,l),p=this.expression.evaluate({zoom:this.zoom+1},s,l);this._setPaintValue(e,r,d,p)}_setPaintValue(e,r,s,l){if(this.type==="color"){const d=eh(s),p=eh(l);for(let f=e;f<r;f++)this.paintVertexArray.emplace(f,d[0],d[1],p[0],p[1])}else{for(let d=e;d<r;d++)this.paintVertexArray.emplace(d,s,l);this.maxValue=Math.max(this.maxValue,Math.abs(s),Math.abs(l))}}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 s=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,l=yt(this.expression.interpolationFactor(s,this.zoom,this.zoom+1),0,1);e.set(l)}getBinding(e,r,s){return new Xl(e,r)}}class Gn{constructor(e,r,s,l,d,p){this.expression=e,this.type=r,this.useIntegerZoom=s,this.zoom=l,this.layerId=p,this.zoomInPaintVertexArray=new d,this.zoomOutPaintVertexArray=new d}populatePaintArray(e,r,s){const l=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(l,e,r.patterns&&r.patterns[this.layerId],s)}updatePaintArray(e,r,s,l,d){this._setPaintValues(e,r,s.patterns&&s.patterns[this.layerId],d)}_setPaintValues(e,r,s,l){if(!l||!s)return;const{min:d,mid:p,max:f}=s,g=l[d],x=l[p],w=l[f];if(g&&x&&w)for(let I=e;I<r;I++)this.zoomInPaintVertexArray.emplace(I,x.tl[0],x.tl[1],x.br[0],x.br[1],g.tl[0],g.tl[1],g.br[0],g.br[1],x.pixelRatio,g.pixelRatio),this.zoomOutPaintVertexArray.emplace(I,x.tl[0],x.tl[1],x.br[0],x.br[1],w.tl[0],w.tl[1],w.br[0],w.br[1],x.pixelRatio,w.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,vo.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,vo.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Bu{constructor(e,r,s){this.binders={},this._buffers=[];const l=[];for(const d in e.paint._values){if(!s(d))continue;const p=e.paint.get(d);if(!(p instanceof wr&&fn(p.property.specification)))continue;const f=fg(d,e.type),g=p.value,x=p.property.specification.type,w=p.property.useIntegerZoom,I=p.property.specification["property-type"],C=I==="cross-faded"||I==="cross-faded-data-driven";if(g.kind==="constant")this.binders[d]=C?new So(g.value,f):new Oa(g.value,f,x),l.push(`/u_${d}`);else if(g.kind==="source"||C){const z=Fu(d,x,"source");this.binders[d]=C?new Gn(g,x,w,r,z,e.id):new bn(g,f,x,z),l.push(`/a_${d}`)}else{const z=Fu(d,x,"composite");this.binders[d]=new Br(g,f,x,w,r,z),l.push(`/z_${d}`)}}this.cacheKey=l.sort().join("")}getMaxValue(e){const r=this.binders[e];return r instanceof bn||r instanceof Br?r.maxValue:0}populatePaintArrays(e,r,s,l,d){for(const p in this.binders){const f=this.binders[p];(f instanceof bn||f instanceof Br||f instanceof Gn)&&f.populatePaintArray(e,r,s,l,d)}}setConstantPatternPositions(e,r){for(const s in this.binders){const l=this.binders[s];l instanceof So&&l.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,s,l,d){let p=!1;for(const f in e){const g=r.getPositions(f);for(const x of g){const w=s.feature(x.index);for(const I in this.binders){const C=this.binders[I];if((C instanceof bn||C instanceof Br||C instanceof Gn)&&C.expression.isStateDependent===!0){const z=l.paint.get(I);C.expression=z.value,C.updatePaintArray(x.start,x.end,w,e[f],d),p=!0}}}}return p}defines(){const e=[];for(const r in this.binders){const s=this.binders[r];(s instanceof Oa||s instanceof So)&&e.push(...s.uniformNames.map(l=>`#define HAS_UNIFORM_${l}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof bn||s instanceof Br)for(let l=0;l<s.paintVertexAttributes.length;l++)e.push(s.paintVertexAttributes[l].name);else if(s instanceof Gn)for(let l=0;l<vo.members.length;l++)e.push(vo.members[l].name)}return e}getBinderUniforms(){const e=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof Oa||s instanceof So||s instanceof Br)for(const l of s.uniformNames)e.push(l)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,r){const s=[];for(const l in this.binders){const d=this.binders[l];if(d instanceof Oa||d instanceof So||d instanceof Br){for(const p of d.uniformNames)if(r[p]){const f=d.getBinding(e,r[p],p);s.push({name:p,property:l,binding:f})}}}return s}setUniforms(e,r,s,l){for(const{name:d,property:p,binding:f}of r)this.binders[p].setUniform(f,l,s.get(p),d)}updatePaintBuffers(e){this._buffers=[];for(const r in this.binders){const s=this.binders[r];if(e&&s instanceof Gn){const l=e.fromScale===2?s.zoomInPaintVertexBuffer:s.zoomOutPaintVertexBuffer;l&&this._buffers.push(l)}else(s instanceof bn||s instanceof Br)&&s.paintVertexBuffer&&this._buffers.push(s.paintVertexBuffer)}}upload(e){for(const r in this.binders){const s=this.binders[r];(s instanceof bn||s instanceof Br||s instanceof Gn)&&s.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const r=this.binders[e];(r instanceof bn||r instanceof Br||r instanceof Gn)&&r.destroy()}}}class Ms{constructor(e,r,s=()=>!0){this.programConfigurations={};for(const l of e)this.programConfigurations[l.id]=new Bu(l,r,s);this.needsUpload=!1,this._featureMap=new Zn,this._bufferOffset=0}populatePaintArrays(e,r,s,l,d,p){for(const f in this.programConfigurations)this.programConfigurations[f].populatePaintArrays(e,r,l,d,p);r.id!==void 0&&this._featureMap.add(r.id,s,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,s,l){for(const d of s)this.needsUpload=this.programConfigurations[d.id].updatePaintArrays(e,this._featureMap,r,d,l)||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 fg(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 Fu(i,e,r){const s={color:{source:U,composite:et},number:{source:Te,composite:U}},l=function(d){return{"line-pattern":{source:ai,composite:ai},"fill-pattern":{source:ai,composite:ai},"fill-extrusion-pattern":{source:ai,composite:ai}}[d]}(i);return l&&l[r]||s[e][r]}Oe("ConstantBinder",Oa),Oe("CrossFadedConstantBinder",So),Oe("SourceExpressionBinder",bn),Oe("CrossFadedCompositeBinder",Gn),Oe("CompositeExpressionBinder",Br),Oe("ProgramConfiguration",Bu,{omit:["_buffers"]}),Oe("ProgramConfigurationSet",Ms);const Qt=8192,th=Math.pow(2,14)-1,Ou=-th-1;function zs(i){const e=Qt/i.extent,r=i.loadGeometry();for(let s=0;s<r.length;s++){const l=r[s];for(let d=0;d<l.length;d++){const p=l[d],f=Math.round(p.x*e),g=Math.round(p.y*e);p.x=yt(f,Ou,th),p.y=yt(g,Ou,th),(f<p.x||f>p.x+1||g<p.y||g>p.y+1)&&ci("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Ds(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?zs(i):[]}}function Wl(i,e,r,s,l){i.emplaceBack(2*e+(s+1)/2,2*r+(l+1)/2)}class ih{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 yo,this.indexArray=new ni,this.segments=new ti,this.programConfigurations=new Ms(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){const l=this.layers[0],d=[];let p=null,f=!1;l.type==="circle"&&(p=l.layout.get("circle-sort-key"),f=!p.isConstant());for(const{feature:g,id:x,index:w,sourceLayerIndex:I}of e){const C=this.layers[0]._featureFilter.needGeometry,z=Ds(g,C);if(!this.layers[0]._featureFilter.filter(new zt(this.zoom),z,s))continue;const R=f?p.evaluate(z,{},s):void 0,F={id:x,properties:g.properties,type:g.type,sourceLayerIndex:I,index:w,geometry:C?z.geometry:zs(g),patterns:{},sortKey:R};d.push(F)}f&&d.sort((g,x)=>g.sortKey-x.sortKey);for(const g of d){const{geometry:x,index:w,sourceLayerIndex:I}=g,C=e[w].feature;this.addFeature(g,x,w,s),r.featureIndex.insert(C,x,w,I,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,La),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,s,l){for(const d of r)for(const p of d){const f=p.x,g=p.y;if(f<0||f>=Qt||g<0||g>=Qt)continue;const x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),w=x.vertexLength;Wl(this.layoutVertexArray,f,g,-1,-1),Wl(this.layoutVertexArray,f,g,1,-1),Wl(this.layoutVertexArray,f,g,1,1),Wl(this.layoutVertexArray,f,g,-1,1),this.indexArray.emplaceBack(w,w+1,w+2),this.indexArray.emplaceBack(w,w+3,w+2),x.vertexLength+=4,x.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{},l)}}function Vu(i,e){for(let r=0;r<i.length;r++)if(To(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(To(i,e[r]))return!0;return!!rh(i,e)}function mg(i,e,r){return!!To(i,e)||!!nh(e,i,r)}function Nu(i,e){if(i.length===1)return Uu(e,i[0]);for(let r=0;r<e.length;r++){const s=e[r];for(let l=0;l<s.length;l++)if(To(i,s[l]))return!0}for(let r=0;r<i.length;r++)if(Uu(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(rh(i,e[r]))return!0;return!1}function gg(i,e,r){if(i.length>1){if(rh(i,e))return!0;for(let s=0;s<e.length;s++)if(nh(e[s],i,r))return!0}for(let s=0;s<i.length;s++)if(nh(i[s],e,r))return!0;return!1}function rh(i,e){if(i.length===0||e.length===0)return!1;for(let r=0;r<i.length-1;r++){const s=i[r],l=i[r+1];for(let d=0;d<e.length-1;d++)if(_g(s,l,e[d],e[d+1]))return!0}return!1}function _g(i,e,r,s){return wi(i,r,s)!==wi(e,r,s)&&wi(i,e,r)!==wi(i,e,s)}function nh(i,e,r){const s=r*r;if(e.length===1)return i.distSqr(e[0])<s;for(let l=1;l<e.length;l++)if(ju(i,e[l-1],e[l])<s)return!0;return!1}function ju(i,e,r){const s=e.distSqr(r);if(s===0)return i.distSqr(e);const l=((i.x-e.x)*(r.x-e.x)+(i.y-e.y)*(r.y-e.y))/s;return i.distSqr(l<0?e:l>1?r:r.sub(e)._mult(l)._add(e))}function Uu(i,e){let r,s,l,d=!1;for(let p=0;p<i.length;p++){r=i[p];for(let f=0,g=r.length-1;f<r.length;g=f++)s=r[f],l=r[g],s.y>e.y!=l.y>e.y&&e.x<(l.x-s.x)*(e.y-s.y)/(l.y-s.y)+s.x&&(d=!d)}return d}function To(i,e){let r=!1;for(let s=0,l=i.length-1;s<i.length;l=s++){const d=i[s],p=i[l];d.y>e.y!=p.y>e.y&&e.x<(p.x-d.x)*(e.y-d.y)/(p.y-d.y)+d.x&&(r=!r)}return r}function yg(i,e,r){const s=r[0],l=r[2];if(i.x<s.x&&e.x<s.x||i.x>l.x&&e.x>l.x||i.y<s.y&&e.y<s.y||i.y>l.y&&e.y>l.y)return!1;const d=wi(i,e,r[0]);return d!==wi(i,e,r[1])||d!==wi(i,e,r[2])||d!==wi(i,e,r[3])}function Va(i,e,r){const s=e.paint.get(i).value;return s.kind==="constant"?s.value:r.programConfigurations.get(e.id).getMaxValue(i)}function Jl(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function Kl(i,e,r,s,l){if(!e[0]&&!e[1])return i;const d=le.convert(e)._mult(l);r==="viewport"&&d._rotate(-s);const p=[];for(let f=0;f<i.length;f++)p.push(i[f].sub(d));return p}let $u,qu;Oe("CircleBucket",ih,{omit:["layers"]});var xg={get paint(){return qu=qu||new o({"circle-radius":new Je(ue.paint_circle["circle-radius"]),"circle-color":new Je(ue.paint_circle["circle-color"]),"circle-blur":new Je(ue.paint_circle["circle-blur"]),"circle-opacity":new Je(ue.paint_circle["circle-opacity"]),"circle-translate":new Ze(ue.paint_circle["circle-translate"]),"circle-translate-anchor":new Ze(ue.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ze(ue.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ze(ue.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Je(ue.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Je(ue.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Je(ue.paint_circle["circle-stroke-opacity"])})},get layout(){return $u=$u||new o({"circle-sort-key":new Je(ue.layout_circle["circle-sort-key"])})}},zi=1e-6,Io=typeof Float32Array<"u"?Float32Array:Array;function sh(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 Zu(i,e,r){var s=e[0],l=e[1],d=e[2],p=e[3],f=e[4],g=e[5],x=e[6],w=e[7],I=e[8],C=e[9],z=e[10],R=e[11],F=e[12],$=e[13],X=e[14],se=e[15],Y=r[0],ie=r[1],de=r[2],xe=r[3];return i[0]=Y*s+ie*f+de*I+xe*F,i[1]=Y*l+ie*g+de*C+xe*$,i[2]=Y*d+ie*x+de*z+xe*X,i[3]=Y*p+ie*w+de*R+xe*se,i[4]=(Y=r[4])*s+(ie=r[5])*f+(de=r[6])*I+(xe=r[7])*F,i[5]=Y*l+ie*g+de*C+xe*$,i[6]=Y*d+ie*x+de*z+xe*X,i[7]=Y*p+ie*w+de*R+xe*se,i[8]=(Y=r[8])*s+(ie=r[9])*f+(de=r[10])*I+(xe=r[11])*F,i[9]=Y*l+ie*g+de*C+xe*$,i[10]=Y*d+ie*x+de*z+xe*X,i[11]=Y*p+ie*w+de*R+xe*se,i[12]=(Y=r[12])*s+(ie=r[13])*f+(de=r[14])*I+(xe=r[15])*F,i[13]=Y*l+ie*g+de*C+xe*$,i[14]=Y*d+ie*x+de*z+xe*X,i[15]=Y*p+ie*w+de*R+xe*se,i}Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});var Na,vg=Zu;function Yl(i,e,r){var s=e[0],l=e[1],d=e[2],p=e[3];return i[0]=r[0]*s+r[4]*l+r[8]*d+r[12]*p,i[1]=r[1]*s+r[5]*l+r[9]*d+r[13]*p,i[2]=r[2]*s+r[6]*l+r[10]*d+r[14]*p,i[3]=r[3]*s+r[7]*l+r[11]*d+r[15]*p,i}Na=new Io(4),Io!=Float32Array&&(Na[0]=0,Na[1]=0,Na[2]=0,Na[3]=0);class bg extends h{constructor(e){super(e,xg)}createBucket(e){return new ih(e)}queryRadius(e){const r=e;return Va("circle-radius",this,r)+Va("circle-stroke-width",this,r)+Jl(this.paint.get("circle-translate"))}queryIntersectsFeature(e,r,s,l,d,p,f,g){const x=Kl(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),p.angle,f),w=this.paint.get("circle-radius").evaluate(r,s)+this.paint.get("circle-stroke-width").evaluate(r,s),I=this.paint.get("circle-pitch-alignment")==="map",C=I?x:function(R,F){return R.map($=>Gu($,F))}(x,g),z=I?w*f:w;for(const R of l)for(const F of R){const $=I?F:Gu(F,g);let X=z;const se=Yl([],[F.x,F.y,0,1],g);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?X*=se[3]/p.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(X*=p.cameraToCenterDistance/se[3]),mg(C,$,X))return!0}return!1}}function Gu(i,e){const r=Yl([],[i.x,i.y,0,1],e);return new le(r[0]/r[3],r[1]/r[3])}class Hu extends ih{}let Xu;Oe("HeatmapBucket",Hu,{omit:["layers"]});var wg={get paint(){return Xu=Xu||new o({"heatmap-radius":new Je(ue.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Je(ue.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ze(ue.paint_heatmap["heatmap-intensity"]),"heatmap-color":new n(ue.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ze(ue.paint_heatmap["heatmap-opacity"])})}};function oh(i,{width:e,height:r},s,l){if(l){if(l instanceof Uint8ClampedArray)l=new Uint8Array(l.buffer);else if(l.length!==e*r*s)throw new RangeError(`mismatched image size. expected: ${l.length} but got: ${e*r*s}`)}else l=new Uint8Array(e*r*s);return i.width=e,i.height=r,i.data=l,i}function Wu(i,{width:e,height:r},s){if(e===i.width&&r===i.height)return;const l=oh({},{width:e,height:r},s);ah(i,l,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,e),height:Math.min(i.height,r)},s),i.width=e,i.height=r,i.data=l.data}function ah(i,e,r,s,l,d){if(l.width===0||l.height===0)return e;if(l.width>i.width||l.height>i.height||r.x>i.width-l.width||r.y>i.height-l.height)throw new RangeError("out of range source coordinates for image copy");if(l.width>e.width||l.height>e.height||s.x>e.width-l.width||s.y>e.height-l.height)throw new RangeError("out of range destination coordinates for image copy");const p=i.data,f=e.data;if(p===f)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g<l.height;g++){const x=((r.y+g)*i.width+r.x)*d,w=((s.y+g)*e.width+s.x)*d;for(let I=0;I<l.width*d;I++)f[w+I]=p[x+I]}return e}class ja{constructor(e,r){oh(this,e,1,r)}resize(e){Wu(this,e,1)}clone(){return new ja({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,s,l,d){ah(e,r,s,l,d,1)}}class lr{constructor(e,r){oh(this,e,4,r)}resize(e){Wu(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new lr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,s,l,d){ah(e,r,s,l,d,4)}}function Ju(i){const e={},r=i.resolution||256,s=i.clips?i.clips.length:1,l=i.image||new lr({width:r,height:s});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const d=(p,f,g)=>{e[i.evaluationKey]=g;const x=i.expression.evaluate(e);l.data[p+f+0]=Math.floor(255*x.r/x.a),l.data[p+f+1]=Math.floor(255*x.g/x.a),l.data[p+f+2]=Math.floor(255*x.b/x.a),l.data[p+f+3]=Math.floor(255*x.a)};if(i.clips)for(let p=0,f=0;p<s;++p,f+=4*r)for(let g=0,x=0;g<r;g++,x+=4){const w=g/(r-1),{start:I,end:C}=i.clips[p];d(f,x,I*(1-w)+C*w)}else for(let p=0,f=0;p<r;p++,f+=4)d(0,f,p/(r-1));return l}Oe("AlphaImage",ja),Oe("RGBAImage",lr);class Sg extends h{createBucket(e){return new Hu(e)}constructor(e){super(e,wg),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Ju({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 Ku;var Tg={get paint(){return Ku=Ku||new o({"hillshade-illumination-direction":new Ze(ue.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ze(ue.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ze(ue.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ze(ue.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ze(ue.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ze(ue.paint_hillshade["hillshade-accent-color"])})}};class Ig extends h{constructor(e){super(e,Tg)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const Pg=b([{name:"a_pos",components:2,type:"Int16"}],4),{members:Eg}=Pg;function Yu(i,e,r=2){const s=e&&e.length,l=s?e[0]*r:i.length;let d=Qu(i,0,l,r,!0);const p=[];if(!d||d.next===d.prev)return p;let f,g,x;if(s&&(d=function(w,I,C,z){const R=[];for(let F=0,$=I.length;F<$;F++){const X=Qu(w,I[F]*z,F<$-1?I[F+1]*z:w.length,z,!1);X===X.next&&(X.steiner=!0),R.push(Rg(X))}R.sort(zg);for(let F=0;F<R.length;F++)C=Dg(R[F],C);return C}(i,e,d,r)),i.length>80*r){f=1/0,g=1/0;let w=-1/0,I=-1/0;for(let C=r;C<l;C+=r){const z=i[C],R=i[C+1];z<f&&(f=z),R<g&&(g=R),z>w&&(w=z),R>I&&(I=R)}x=Math.max(w-f,I-g),x=x!==0?32767/x:0}return Ua(d,p,r,f,g,x,0),p}function Qu(i,e,r,s,l){let d;if(l===function(p,f,g,x){let w=0;for(let I=f,C=g-x;I<g;I+=x)w+=(p[C]-p[I])*(p[I+1]+p[C+1]),C=I;return w}(i,e,r,s)>0)for(let p=e;p<r;p+=s)d=id(p/s|0,i[p],i[p+1],d);else for(let p=r-s;p>=e;p-=s)d=id(p/s|0,i[p],i[p+1],d);return d&&Ql(d,d.next)&&(qa(d),d=d.next),d}function Ls(i,e){if(!i)return i;e||(e=i);let r,s=i;do if(r=!1,s.steiner||!Ql(s,s.next)&&Jt(s.prev,s,s.next)!==0)s=s.next;else{if(qa(s),s=e=s.prev,s===s.next)break;r=!0}while(r||s!==e);return e}function Ua(i,e,r,s,l,d,p){if(!i)return;!p&&d&&function(g,x,w,I){let C=g;do C.z===0&&(C.z=lh(C.x,C.y,x,w,I)),C.prevZ=C.prev,C.nextZ=C.next,C=C.next;while(C!==g);C.prevZ.nextZ=null,C.prevZ=null,function(z){let R,F=1;do{let $,X=z;z=null;let se=null;for(R=0;X;){R++;let Y=X,ie=0;for(let xe=0;xe<F&&(ie++,Y=Y.nextZ,Y);xe++);let de=F;for(;ie>0||de>0&&Y;)ie!==0&&(de===0||!Y||X.z<=Y.z)?($=X,X=X.nextZ,ie--):($=Y,Y=Y.nextZ,de--),se?se.nextZ=$:z=$,$.prevZ=se,se=$;X=Y}se.nextZ=null,F*=2}while(R>1)}(C)}(i,s,l,d);let f=i;for(;i.prev!==i.next;){const g=i.prev,x=i.next;if(d?Ag(i,s,l,d):Cg(i))e.push(g.i,i.i,x.i),qa(i),i=x.next,f=x.next;else if((i=x)===f){p?p===1?Ua(i=kg(Ls(i),e),e,r,s,l,d,2):p===2&&Mg(i,e,r,s,l,d):Ua(Ls(i),e,r,s,l,d,1);break}}}function Cg(i){const e=i.prev,r=i,s=i.next;if(Jt(e,r,s)>=0)return!1;const l=e.x,d=r.x,p=s.x,f=e.y,g=r.y,x=s.y,w=l<d?l<p?l:p:d<p?d:p,I=f<g?f<x?f:x:g<x?g:x,C=l>d?l>p?l:p:d>p?d:p,z=f>g?f>x?f:x:g>x?g:x;let R=s.next;for(;R!==e;){if(R.x>=w&&R.x<=C&&R.y>=I&&R.y<=z&&Po(l,f,d,g,p,x,R.x,R.y)&&Jt(R.prev,R,R.next)>=0)return!1;R=R.next}return!0}function Ag(i,e,r,s){const l=i.prev,d=i,p=i.next;if(Jt(l,d,p)>=0)return!1;const f=l.x,g=d.x,x=p.x,w=l.y,I=d.y,C=p.y,z=f<g?f<x?f:x:g<x?g:x,R=w<I?w<C?w:C:I<C?I:C,F=f>g?f>x?f:x:g>x?g:x,$=w>I?w>C?w:C:I>C?I:C,X=lh(z,R,e,r,s),se=lh(F,$,e,r,s);let Y=i.prevZ,ie=i.nextZ;for(;Y&&Y.z>=X&&ie&&ie.z<=se;){if(Y.x>=z&&Y.x<=F&&Y.y>=R&&Y.y<=$&&Y!==l&&Y!==p&&Po(f,w,g,I,x,C,Y.x,Y.y)&&Jt(Y.prev,Y,Y.next)>=0||(Y=Y.prevZ,ie.x>=z&&ie.x<=F&&ie.y>=R&&ie.y<=$&&ie!==l&&ie!==p&&Po(f,w,g,I,x,C,ie.x,ie.y)&&Jt(ie.prev,ie,ie.next)>=0))return!1;ie=ie.nextZ}for(;Y&&Y.z>=X;){if(Y.x>=z&&Y.x<=F&&Y.y>=R&&Y.y<=$&&Y!==l&&Y!==p&&Po(f,w,g,I,x,C,Y.x,Y.y)&&Jt(Y.prev,Y,Y.next)>=0)return!1;Y=Y.prevZ}for(;ie&&ie.z<=se;){if(ie.x>=z&&ie.x<=F&&ie.y>=R&&ie.y<=$&&ie!==l&&ie!==p&&Po(f,w,g,I,x,C,ie.x,ie.y)&&Jt(ie.prev,ie,ie.next)>=0)return!1;ie=ie.nextZ}return!0}function kg(i,e){let r=i;do{const s=r.prev,l=r.next.next;!Ql(s,l)&&ed(s,r,r.next,l)&&$a(s,l)&&$a(l,s)&&(e.push(s.i,r.i,l.i),qa(r),qa(r.next),r=i=l),r=r.next}while(r!==i);return Ls(r)}function Mg(i,e,r,s,l,d){let p=i;do{let f=p.next.next;for(;f!==p.prev;){if(p.i!==f.i&&Bg(p,f)){let g=td(p,f);return p=Ls(p,p.next),g=Ls(g,g.next),Ua(p,e,r,s,l,d,0),void Ua(g,e,r,s,l,d,0)}f=f.next}p=p.next}while(p!==i)}function zg(i,e){return i.x-e.x}function Dg(i,e){const r=function(l,d){let p=d;const f=l.x,g=l.y;let x,w=-1/0;do{if(g<=p.y&&g>=p.next.y&&p.next.y!==p.y){const F=p.x+(g-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(F<=f&&F>w&&(w=F,x=p.x<p.next.x?p:p.next,F===f))return x}p=p.next}while(p!==d);if(!x)return null;const I=x,C=x.x,z=x.y;let R=1/0;p=x;do{if(f>=p.x&&p.x>=C&&f!==p.x&&Po(g<z?f:w,g,C,z,g<z?w:f,g,p.x,p.y)){const F=Math.abs(g-p.y)/(f-p.x);$a(p,l)&&(F<R||F===R&&(p.x>x.x||p.x===x.x&&Lg(x,p)))&&(x=p,R=F)}p=p.next}while(p!==I);return x}(i,e);if(!r)return e;const s=td(r,i);return Ls(s,s.next),Ls(r,r.next)}function Lg(i,e){return Jt(i.prev,i,e.prev)<0&&Jt(e.next,i,i.next)<0}function lh(i,e,r,s,l){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*l|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*l|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Rg(i){let 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 Po(i,e,r,s,l,d,p,f){return(l-p)*(e-f)>=(i-p)*(d-f)&&(i-p)*(s-f)>=(r-p)*(e-f)&&(r-p)*(d-f)>=(l-p)*(s-f)}function Bg(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,s){let l=r;do{if(l.i!==r.i&&l.next.i!==r.i&&l.i!==s.i&&l.next.i!==s.i&&ed(l,l.next,r,s))return!0;l=l.next}while(l!==r);return!1}(i,e)&&($a(i,e)&&$a(e,i)&&function(r,s){let l=r,d=!1;const p=(r.x+s.x)/2,f=(r.y+s.y)/2;do l.y>f!=l.next.y>f&&l.next.y!==l.y&&p<(l.next.x-l.x)*(f-l.y)/(l.next.y-l.y)+l.x&&(d=!d),l=l.next;while(l!==r);return d}(i,e)&&(Jt(i.prev,i,e.prev)||Jt(i,e.prev,e))||Ql(i,e)&&Jt(i.prev,i,i.next)>0&&Jt(e.prev,e,e.next)>0)}function Jt(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function Ql(i,e){return i.x===e.x&&i.y===e.y}function ed(i,e,r,s){const l=tc(Jt(i,e,r)),d=tc(Jt(i,e,s)),p=tc(Jt(r,s,i)),f=tc(Jt(r,s,e));return l!==d&&p!==f||!(l!==0||!ec(i,r,e))||!(d!==0||!ec(i,s,e))||!(p!==0||!ec(r,i,s))||!(f!==0||!ec(r,e,s))}function ec(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 tc(i){return i>0?1:i<0?-1:0}function $a(i,e){return Jt(i.prev,i,i.next)<0?Jt(i,e,i.next)>=0&&Jt(i,i.prev,e)>=0:Jt(i,e,i.prev)<0||Jt(i,i.next,e)<0}function td(i,e){const r=ch(i.i,i.x,i.y),s=ch(e.i,e.x,e.y),l=i.next,d=e.prev;return i.next=e,e.prev=i,r.next=l,l.prev=r,s.next=r,r.prev=s,d.next=s,s.prev=d,s}function id(i,e,r,s){const l=ch(i,e,r);return s?(l.next=s.next,l.prev=s,s.next.prev=l,s.next=l):(l.prev=l,l.next=l),l}function qa(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 ch(i,e,r){return{i,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function hh(i,e,r){const s=r.patternDependencies;let l=!1;for(const d of e){const p=d.paint.get(`${i}-pattern`);p.isConstant()||(l=!0);const f=p.constantOr(null);f&&(l=!0,s[f.to]=!0,s[f.from]=!0)}return l}function uh(i,e,r,s,l){const d=l.patternDependencies;for(const p of e){const f=p.paint.get(`${i}-pattern`).value;if(f.kind!=="constant"){let g=f.evaluate({zoom:s-1},r,{},l.availableImages),x=f.evaluate({zoom:s},r,{},l.availableImages),w=f.evaluate({zoom:s+1},r,{},l.availableImages);g=g&&g.name?g.name:g,x=x&&x.name?x.name:x,w=w&&w.name?w.name:w,d[g]=!0,d[x]=!0,d[w]=!0,r.patterns[p.id]={min:g,mid:x,max:w}}}return r}class dh{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 Un,this.indexArray=new ni,this.indexArray2=new Ut,this.programConfigurations=new Ms(e.layers,e.zoom),this.segments=new ti,this.segments2=new ti,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=hh("fill",this.layers,r);const l=this.layers[0].layout.get("fill-sort-key"),d=!l.isConstant(),p=[];for(const{feature:f,id:g,index:x,sourceLayerIndex:w}of e){const I=this.layers[0]._featureFilter.needGeometry,C=Ds(f,I);if(!this.layers[0]._featureFilter.filter(new zt(this.zoom),C,s))continue;const z=d?l.evaluate(C,{},s,r.availableImages):void 0,R={id:g,properties:f.properties,type:f.type,sourceLayerIndex:w,index:x,geometry:I?C.geometry:zs(f),patterns:{},sortKey:z};p.push(R)}d&&p.sort((f,g)=>f.sortKey-g.sortKey);for(const f of p){const{geometry:g,index:x,sourceLayerIndex:w}=f;if(this.hasPattern){const I=uh("fill",this.layers,f,this.zoom,r);this.patternFeatures.push(I)}else this.addFeature(f,g,x,s,{});r.featureIndex.insert(e[x].feature,g,x,w,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}addFeatures(e,r,s){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Eg),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,s,l,d){for(const p of Ys(r,500)){let f=0;for(const z of p)f+=z.length;const g=this.segments.prepareSegment(f,this.layoutVertexArray,this.indexArray),x=g.vertexLength,w=[],I=[];for(const z of p){if(z.length===0)continue;z!==p[0]&&I.push(w.length/2);const R=this.segments2.prepareSegment(z.length,this.layoutVertexArray,this.indexArray2),F=R.vertexLength;this.layoutVertexArray.emplaceBack(z[0].x,z[0].y),this.indexArray2.emplaceBack(F+z.length-1,F),w.push(z[0].x),w.push(z[0].y);for(let $=1;$<z.length;$++)this.layoutVertexArray.emplaceBack(z[$].x,z[$].y),this.indexArray2.emplaceBack(F+$-1,F+$),w.push(z[$].x),w.push(z[$].y);R.vertexLength+=z.length,R.primitiveLength+=z.length}const C=Yu(w,I);for(let z=0;z<C.length;z+=3)this.indexArray.emplaceBack(x+C[z],x+C[z+1],x+C[z+2]);g.vertexLength+=f,g.primitiveLength+=C.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,d,l)}}let rd,nd;Oe("FillBucket",dh,{omit:["layers","patternFeatures"]});var Fg={get paint(){return nd=nd||new o({"fill-antialias":new Ze(ue.paint_fill["fill-antialias"]),"fill-opacity":new Je(ue.paint_fill["fill-opacity"]),"fill-color":new Je(ue.paint_fill["fill-color"]),"fill-outline-color":new Je(ue.paint_fill["fill-outline-color"]),"fill-translate":new Ze(ue.paint_fill["fill-translate"]),"fill-translate-anchor":new Ze(ue.paint_fill["fill-translate-anchor"]),"fill-pattern":new u(ue.paint_fill["fill-pattern"])})},get layout(){return rd=rd||new o({"fill-sort-key":new Je(ue.layout_fill["fill-sort-key"])})}};class Og extends h{constructor(e){super(e,Fg)}recalculate(e,r){super.recalculate(e,r);const s=this.paint._values["fill-outline-color"];s.value.kind==="constant"&&s.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new dh(e)}queryRadius(){return Jl(this.paint.get("fill-translate"))}queryIntersectsFeature(e,r,s,l,d,p,f){return Nu(Kl(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),p.angle,f),l)}isTileClipped(){return!0}}const Vg=b([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Ng=b([{name:"a_centroid",components:2,type:"Int16"}],4),{members:jg}=Vg;var Hn={},Ug=ye,sd=Eo;function Eo(i,e,r,s,l){this.properties={},this.extent=r,this.type=0,this._pbf=i,this._geometry=-1,this._keys=s,this._values=l,i.readFields($g,this,e)}function $g(i,e,r){i==1?e.id=r.readVarint():i==2?function(s,l){for(var d=s.readVarint()+s.pos;s.pos<d;){var p=l._keys[s.readVarint()],f=l._values[s.readVarint()];l.properties[p]=f}}(r,e):i==3?e.type=r.readVarint():i==4&&(e._geometry=r.pos)}function qg(i){for(var e,r,s=0,l=0,d=i.length,p=d-1;l<d;p=l++)s+=((r=i[p]).x-(e=i[l]).x)*(e.y+r.y);return s}Eo.types=["Unknown","Point","LineString","Polygon"],Eo.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var e,r=i.readVarint()+i.pos,s=1,l=0,d=0,p=0,f=[];i.pos<r;){if(l<=0){var g=i.readVarint();s=7&g,l=g>>3}if(l--,s===1||s===2)d+=i.readSVarint(),p+=i.readSVarint(),s===1&&(e&&f.push(e),e=[]),e.push(new Ug(d,p));else{if(s!==7)throw new Error("unknown command "+s);e&&e.push(e[0].clone())}}return e&&f.push(e),f},Eo.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,s=0,l=0,d=0,p=1/0,f=-1/0,g=1/0,x=-1/0;i.pos<e;){if(s<=0){var w=i.readVarint();r=7&w,s=w>>3}if(s--,r===1||r===2)(l+=i.readSVarint())<p&&(p=l),l>f&&(f=l),(d+=i.readSVarint())<g&&(g=d),d>x&&(x=d);else if(r!==7)throw new Error("unknown command "+r)}return[p,g,f,x]},Eo.prototype.toGeoJSON=function(i,e,r){var s,l,d=this.extent*Math.pow(2,r),p=this.extent*i,f=this.extent*e,g=this.loadGeometry(),x=Eo.types[this.type];function w(z){for(var R=0;R<z.length;R++){var F=z[R];z[R]=[360*(F.x+p)/d-180,360/Math.PI*Math.atan(Math.exp((180-360*(F.y+f)/d)*Math.PI/180))-90]}}switch(this.type){case 1:var I=[];for(s=0;s<g.length;s++)I[s]=g[s][0];w(g=I);break;case 2:for(s=0;s<g.length;s++)w(g[s]);break;case 3:for(g=function(z){var R=z.length;if(R<=1)return[z];for(var F,$,X=[],se=0;se<R;se++){var Y=qg(z[se]);Y!==0&&($===void 0&&($=Y<0),$===Y<0?(F&&X.push(F),F=[z[se]]):F.push(z[se]))}return F&&X.push(F),X}(g),s=0;s<g.length;s++)for(l=0;l<g[s].length;l++)w(g[s][l])}g.length===1?g=g[0]:x="Multi"+x;var C={type:"Feature",geometry:{type:x,coordinates:g},properties:this.properties};return"id"in this&&(C.id=this.id),C};var Zg=sd,od=ad;function ad(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(Gg,this,e),this.length=this._features.length}function Gg(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(s){for(var l=null,d=s.readVarint()+s.pos;s.pos<d;){var p=s.readVarint()>>3;l=p===1?s.readString():p===2?s.readFloat():p===3?s.readDouble():p===4?s.readVarint64():p===5?s.readVarint():p===6?s.readSVarint():p===7?s.readBoolean():null}return l}(r))}ad.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 Zg(this._pbf,e,this.extent,this._keys,this._values)};var Hg=od;function Xg(i,e,r){if(i===3){var s=new Hg(r,r.readVarint()+r.pos);s.length&&(e[s.name]=s)}}Hn.VectorTile=function(i,e){this.layers=i.readFields(Xg,{},e)},Hn.VectorTileFeature=sd,Hn.VectorTileLayer=od;const Wg=Hn.VectorTileFeature.types,ph=Math.pow(2,13);function Za(i,e,r,s,l,d,p,f){i.emplaceBack(e,r,2*Math.floor(s*ph)+p,l*ph*2,d*ph*2,Math.round(f))}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 vn,this.centroidVertexArray=new xn,this.indexArray=new ni,this.programConfigurations=new Ms(e.layers,e.zoom),this.segments=new ti,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.features=[],this.hasPattern=hh("fill-extrusion",this.layers,r);for(const{feature:l,id:d,index:p,sourceLayerIndex:f}of e){const g=this.layers[0]._featureFilter.needGeometry,x=Ds(l,g);if(!this.layers[0]._featureFilter.filter(new zt(this.zoom),x,s))continue;const w={id:d,sourceLayerIndex:f,index:p,geometry:g?x.geometry:zs(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(uh("fill-extrusion",this.layers,w,this.zoom,r)):this.addFeature(w,w.geometry,p,s,{}),r.featureIndex.insert(l,w.geometry,p,f,this.index,!0)}}addFeatures(e,r,s){for(const l of this.features){const{geometry:d}=l;this.addFeature(l,d,l.index,r,s)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}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,jg),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Ng.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,s,l,d){for(const p of Ys(r,500)){const f={x:0,y:0,vertexCount:0};let g=0;for(const R of p)g+=R.length;let x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const R of p){if(R.length===0||Kg(R))continue;let F=0;for(let $=0;$<R.length;$++){const X=R[$];if($>=1){const se=R[$-1];if(!Jg(X,se)){x.vertexLength+4>ti.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const Y=X.sub(se)._perp()._unit(),ie=se.dist(X);F+ie>32768&&(F=0),Za(this.layoutVertexArray,X.x,X.y,Y.x,Y.y,0,0,F),Za(this.layoutVertexArray,X.x,X.y,Y.x,Y.y,0,1,F),f.x+=2*X.x,f.y+=2*X.y,f.vertexCount+=2,F+=ie,Za(this.layoutVertexArray,se.x,se.y,Y.x,Y.y,0,0,F),Za(this.layoutVertexArray,se.x,se.y,Y.x,Y.y,0,1,F),f.x+=2*se.x,f.y+=2*se.y,f.vertexCount+=2;const de=x.vertexLength;this.indexArray.emplaceBack(de,de+2,de+1),this.indexArray.emplaceBack(de+1,de+2,de+3),x.vertexLength+=4,x.primitiveLength+=2}}}}if(x.vertexLength+g>ti.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(g,this.layoutVertexArray,this.indexArray)),Wg[e.type]!=="Polygon")continue;const w=[],I=[],C=x.vertexLength;for(const R of p)if(R.length!==0){R!==p[0]&&I.push(w.length/2);for(let F=0;F<R.length;F++){const $=R[F];Za(this.layoutVertexArray,$.x,$.y,0,0,1,1,0),f.x+=$.x,f.y+=$.y,f.vertexCount+=1,w.push($.x),w.push($.y)}}const z=Yu(w,I);for(let R=0;R<z.length;R+=3)this.indexArray.emplaceBack(C+z[R],C+z[R+2],C+z[R+1]);x.primitiveLength+=z.length/3,x.vertexLength+=g;for(let R=0;R<f.vertexCount;R++){const F=Math.floor(f.x/f.vertexCount),$=Math.floor(f.y/f.vertexCount);this.centroidVertexArray.emplaceBack(F,$)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,d,l)}}function Jg(i,e){return i.x===e.x&&(i.x<0||i.x>Qt)||i.y===e.y&&(i.y<0||i.y>Qt)}function Kg(i){return i.every(e=>e.x<0)||i.every(e=>e.x>Qt)||i.every(e=>e.y<0)||i.every(e=>e.y>Qt)}let ld;Oe("FillExtrusionBucket",fh,{omit:["layers","features"]});var Yg={get paint(){return ld=ld||new o({"fill-extrusion-opacity":new Ze(ue["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Je(ue["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ze(ue["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ze(ue["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new u(ue["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Je(ue["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Je(ue["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ze(ue["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Qg extends h{constructor(e){super(e,Yg)}createBucket(e){return new fh(e)}queryRadius(){return Jl(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,r,s,l,d,p,f,g){const x=Kl(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),p.angle,f),w=this.paint.get("fill-extrusion-height").evaluate(r,s),I=this.paint.get("fill-extrusion-base").evaluate(r,s),C=function(R,F,$,X){const se=[];for(const Y of R){const ie=[Y.x,Y.y,0,1];Yl(ie,ie,F),se.push(new le(ie[0]/ie[3],ie[1]/ie[3]))}return se}(x,g),z=function(R,F,$,X){const se=[],Y=[],ie=X[8]*F,de=X[9]*F,xe=X[10]*F,Le=X[11]*F,We=X[8]*$,Me=X[9]*$,Ae=X[10]*$,qe=X[11]*$;for(const Ve of R){const Be=[],me=[];for(const Ge of Ve){const $e=Ge.x,tt=Ge.y,Ct=X[0]*$e+X[4]*tt+X[12],Et=X[1]*$e+X[5]*tt+X[13],si=X[2]*$e+X[6]*tt+X[14],Sr=X[3]*$e+X[7]*tt+X[15],xi=si+xe,Gt=Sr+Le,Di=Ct+We,Li=Et+Me,Ri=si+Ae,Ht=Sr+qe,oi=new le((Ct+ie)/Gt,(Et+de)/Gt);oi.z=xi/Gt,Be.push(oi);const Pi=new le(Di/Ht,Li/Ht);Pi.z=Ri/Ht,me.push(Pi)}se.push(Be),Y.push(me)}return[se,Y]}(l,I,w,g);return function(R,F,$){let X=1/0;Nu($,F)&&(X=cd($,F[0]));for(let se=0;se<F.length;se++){const Y=F[se],ie=R[se];for(let de=0;de<Y.length-1;de++){const xe=Y[de],Le=[xe,Y[de+1],ie[de+1],ie[de],xe];Vu($,Le)&&(X=Math.min(X,cd($,Le)))}}return X!==1/0&&X}(z[0],z[1],C)}}function Ga(i,e){return i.x*e.x+i.y*e.y}function cd(i,e){if(i.length===1){let r=0;const s=e[r++];let l;for(;!l||s.equals(l);)if(l=e[r++],!l)return 1/0;for(;r<e.length;r++){const d=e[r],p=i[0],f=l.sub(s),g=d.sub(s),x=p.sub(s),w=Ga(f,f),I=Ga(f,g),C=Ga(g,g),z=Ga(x,f),R=Ga(x,g),F=w*C-I*I,$=(C*z-I*R)/F,X=(w*R-I*z)/F,se=s.z*(1-$-X)+l.z*$+d.z*X;if(isFinite(se))return se}return 1/0}{let r=1/0;for(const s of e)r=Math.min(r,s.z);return r}}const e_=b([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:t_}=e_,i_=b([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:r_}=i_,n_=Hn.VectorTileFeature.types,s_=Math.cos(Math.PI/180*37.5),hd=Math.pow(2,14)/.5;class mh{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 xo,this.layoutVertexArray2=new Da,this.indexArray=new ni,this.programConfigurations=new Ms(e.layers,e.zoom),this.segments=new ti,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=hh("line",this.layers,r);const l=this.layers[0].layout.get("line-sort-key"),d=!l.isConstant(),p=[];for(const{feature:f,id:g,index:x,sourceLayerIndex:w}of e){const I=this.layers[0]._featureFilter.needGeometry,C=Ds(f,I);if(!this.layers[0]._featureFilter.filter(new zt(this.zoom),C,s))continue;const z=d?l.evaluate(C,{},s):void 0,R={id:g,properties:f.properties,type:f.type,sourceLayerIndex:w,index:x,geometry:I?C.geometry:zs(f),patterns:{},sortKey:z};p.push(R)}d&&p.sort((f,g)=>f.sortKey-g.sortKey);for(const f of p){const{geometry:g,index:x,sourceLayerIndex:w}=f;if(this.hasPattern){const I=uh("line",this.layers,f,this.zoom,r);this.patternFeatures.push(I)}else this.addFeature(f,g,x,s,{});r.featureIndex.insert(e[x].feature,g,x,w,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}addFeatures(e,r,s){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,s)}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,r_)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,t_),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,s,l,d){const p=this.layers[0].layout,f=p.get("line-join").evaluate(e,{}),g=p.get("line-cap"),x=p.get("line-miter-limit"),w=p.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const I of r)this.addLine(I,e,f,g,x,w);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,d,l)}addLine(e,r,s,l,d,p){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let X=0;X<e.length-1;X++)this.totalDistance+=e[X].dist(e[X+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const f=n_[r.type]==="Polygon";let g=e.length;for(;g>=2&&e[g-1].equals(e[g-2]);)g--;let x=0;for(;x<g-1&&e[x].equals(e[x+1]);)x++;if(g<(f?3:2))return;s==="bevel"&&(d=1.05);const w=this.overscaling<=16?15*Qt/(512*this.overscaling):0,I=this.segments.prepareSegment(10*g,this.layoutVertexArray,this.indexArray);let C,z,R,F,$;this.e1=this.e2=-1,f&&(C=e[g-2],$=e[x].sub(C)._unit()._perp());for(let X=x;X<g;X++){if(R=X===g-1?f?e[x+1]:void 0:e[X+1],R&&e[X].equals(R))continue;$&&(F=$),C&&(z=C),C=e[X],$=R?R.sub(C)._unit()._perp():F,F=F||$;let se=F.add($);se.x===0&&se.y===0||se._unit();const Y=F.x*$.x+F.y*$.y,ie=se.x*$.x+se.y*$.y,de=ie!==0?1/ie:1/0,xe=2*Math.sqrt(2-2*ie),Le=ie<s_&&z&&R,We=F.x*$.y-F.y*$.x>0;if(Le&&X>x){const qe=C.dist(z);if(qe>2*w){const Ve=C.sub(C.sub(z)._mult(w/qe)._round());this.updateDistance(z,Ve),this.addCurrentVertex(Ve,F,0,0,I),z=Ve}}const Me=z&&R;let Ae=Me?s:f?"butt":l;if(Me&&Ae==="round"&&(de<p?Ae="miter":de<=2&&(Ae="fakeround")),Ae==="miter"&&de>d&&(Ae="bevel"),Ae==="bevel"&&(de>2&&(Ae="flipbevel"),de<d&&(Ae="miter")),z&&this.updateDistance(z,C),Ae==="miter")se._mult(de),this.addCurrentVertex(C,se,0,0,I);else if(Ae==="flipbevel"){if(de>100)se=$.mult(-1);else{const qe=de*F.add($).mag()/F.sub($).mag();se._perp()._mult(qe*(We?-1:1))}this.addCurrentVertex(C,se,0,0,I),this.addCurrentVertex(C,se.mult(-1),0,0,I)}else if(Ae==="bevel"||Ae==="fakeround"){const qe=-Math.sqrt(de*de-1),Ve=We?qe:0,Be=We?0:qe;if(z&&this.addCurrentVertex(C,F,Ve,Be,I),Ae==="fakeround"){const me=Math.round(180*xe/Math.PI/20);for(let Ge=1;Ge<me;Ge++){let $e=Ge/me;if($e!==.5){const Ct=$e-.5;$e+=$e*Ct*($e-1)*((1.0904+Y*(Y*(3.55645-1.43519*Y)-3.2452))*Ct*Ct+(.848013+Y*(.215638*Y-1.06021)))}const tt=$.sub(F)._mult($e)._add(F)._unit()._mult(We?-1:1);this.addHalfVertex(C,tt.x,tt.y,!1,We,0,I)}}R&&this.addCurrentVertex(C,$,-Ve,-Be,I)}else if(Ae==="butt")this.addCurrentVertex(C,se,0,0,I);else if(Ae==="square"){const qe=z?1:-1;this.addCurrentVertex(C,se,qe,qe,I)}else Ae==="round"&&(z&&(this.addCurrentVertex(C,F,0,0,I),this.addCurrentVertex(C,F,1,1,I,!0)),R&&(this.addCurrentVertex(C,$,-1,-1,I,!0),this.addCurrentVertex(C,$,0,0,I)));if(Le&&X<g-1){const qe=C.dist(R);if(qe>2*w){const Ve=C.add(R.sub(C)._mult(w/qe)._round());this.updateDistance(C,Ve),this.addCurrentVertex(Ve,$,0,0,I),C=Ve}}}}addCurrentVertex(e,r,s,l,d,p=!1){const f=r.y*l-r.x,g=-r.y-r.x*l;this.addHalfVertex(e,r.x+r.y*s,r.y-r.x*s,p,!1,s,d),this.addHalfVertex(e,f,g,p,!0,-l,d),this.distance>hd/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,r,s,l,d,p))}addHalfVertex({x:e,y:r},s,l,d,p,f,g){const x=.5*(this.lineClips?this.scaledDistance*(hd-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(d?1:0),(r<<1)+(p?1:0),Math.round(63*s)+128,Math.round(63*l)+128,1+(f===0?0:f<0?-1:1)|(63&x)<<2,x>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const w=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,w),g.primitiveLength++),p?this.e2=w:this.e1=w}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 ud,dd;Oe("LineBucket",mh,{omit:["layers","patternFeatures"]});var pd={get paint(){return dd=dd||new o({"line-opacity":new Je(ue.paint_line["line-opacity"]),"line-color":new Je(ue.paint_line["line-color"]),"line-translate":new Ze(ue.paint_line["line-translate"]),"line-translate-anchor":new Ze(ue.paint_line["line-translate-anchor"]),"line-width":new Je(ue.paint_line["line-width"]),"line-gap-width":new Je(ue.paint_line["line-gap-width"]),"line-offset":new Je(ue.paint_line["line-offset"]),"line-blur":new Je(ue.paint_line["line-blur"]),"line-dasharray":new t(ue.paint_line["line-dasharray"]),"line-pattern":new u(ue.paint_line["line-pattern"]),"line-gradient":new n(ue.paint_line["line-gradient"])})},get layout(){return ud=ud||new o({"line-cap":new Ze(ue.layout_line["line-cap"]),"line-join":new Je(ue.layout_line["line-join"]),"line-miter-limit":new Ze(ue.layout_line["line-miter-limit"]),"line-round-limit":new Ze(ue.layout_line["line-round-limit"]),"line-sort-key":new Je(ue.layout_line["line-sort-key"])})}};class o_ extends Je{possiblyEvaluate(e,r){return r=new zt(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(e,r)}evaluate(e,r,s,l){return r=It({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,s,l)}}let ic;class a_ extends h{constructor(e){super(e,pd),this.gradientVersion=0,ic||(ic=new o_(pd.paint.properties["line-width"].specification),ic.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){const r=this.gradientExpression();this.stepInterpolant=!!function(s){return s._styleExpression!==void 0}(r)&&r._styleExpression.expression instanceof Mn,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"]=ic.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new mh(e)}queryRadius(e){const r=e,s=fd(Va("line-width",this,r),Va("line-gap-width",this,r)),l=Va("line-offset",this,r);return s/2+Math.abs(l)+Jl(this.paint.get("line-translate"))}queryIntersectsFeature(e,r,s,l,d,p,f){const g=Kl(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),p.angle,f),x=f/2*fd(this.paint.get("line-width").evaluate(r,s),this.paint.get("line-gap-width").evaluate(r,s)),w=this.paint.get("line-offset").evaluate(r,s);return w&&(l=function(I,C){const z=[];for(let R=0;R<I.length;R++){const F=I[R],$=[];for(let X=0;X<F.length;X++){const se=F[X-1],Y=F[X],ie=F[X+1],de=X===0?new le(0,0):Y.sub(se)._unit()._perp(),xe=X===F.length-1?new le(0,0):ie.sub(Y)._unit()._perp(),Le=de._add(xe)._unit(),We=Le.x*xe.x+Le.y*xe.y;We!==0&&Le._mult(1/We),$.push(Le._mult(C)._add(Y))}z.push($)}return z}(l,w*f)),function(I,C,z){for(let R=0;R<C.length;R++){const F=C[R];if(I.length>=3){for(let $=0;$<F.length;$++)if(To(I,F[$]))return!0}if(gg(I,F,z))return!0}return!1}(g,l,x)}isTileClipped(){return!0}}function fd(i,e){return e>0?e+2*i:i}const l_=b([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),c_=b([{name:"a_projected_pos",components:3,type:"Float32"}],4);b([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const h_=b([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);b([{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 md=b([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),u_=b([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function d_(i,e,r){return i.sections.forEach(s=>{s.text=function(l,d,p){const f=d.layout.get("text-transform").evaluate(p,{});return f==="uppercase"?l=l.toLocaleUpperCase():f==="lowercase"&&(l=l.toLocaleLowerCase()),Jr.applyArabicShaping&&(l=Jr.applyArabicShaping(l)),l}(s.text,e,r)}),i}b([{name:"triangle",components:3,type:"Uint16"}]),b([{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"}]),b([{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"}]),b([{type:"Float32",name:"offsetX"}]),b([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),b([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Ha={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var ii=24,gd=Pt,_d=function(i,e,r,s,l){var d,p,f=8*l-s-1,g=(1<<f)-1,x=g>>1,w=-7,I=l-1,C=-1,z=i[e+I];for(I+=C,d=z&(1<<-w)-1,z>>=-w,w+=f;w>0;d=256*d+i[e+I],I+=C,w-=8);for(p=d&(1<<-w)-1,d>>=-w,w+=s;w>0;p=256*p+i[e+I],I+=C,w-=8);if(d===0)d=1-x;else{if(d===g)return p?NaN:1/0*(z?-1:1);p+=Math.pow(2,s),d-=x}return(z?-1:1)*p*Math.pow(2,d-s)},yd=function(i,e,r,s,l,d){var p,f,g,x=8*d-l-1,w=(1<<x)-1,I=w>>1,C=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,z=0,R=1,F=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,p=w):(p=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-p))<1&&(p--,g*=2),(e+=p+I>=1?C/g:C*Math.pow(2,1-I))*g>=2&&(p++,g/=2),p+I>=w?(f=0,p=w):p+I>=1?(f=(e*g-1)*Math.pow(2,l),p+=I):(f=e*Math.pow(2,I-1)*Math.pow(2,l),p=0));l>=8;i[r+z]=255&f,z+=R,f/=256,l-=8);for(p=p<<l|f,x+=l;x>0;i[r+z]=255&p,z+=R,p/=256,x-=8);i[r+z-R]|=128*F};function Pt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}Pt.Varint=0,Pt.Fixed64=1,Pt.Bytes=2,Pt.Fixed32=5;var gh=4294967296,xd=1/gh,vd=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function wn(i){return i.type===Pt.Bytes?i.readVarint()+i.pos:i.pos+1}function Co(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function bd(i,e,r){var s=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(s);for(var l=r.pos-1;l>=i;l--)r.buf[l+s]=r.buf[l]}function p_(i,e){for(var r=0;r<i.length;r++)e.writeVarint(i[r])}function f_(i,e){for(var r=0;r<i.length;r++)e.writeSVarint(i[r])}function m_(i,e){for(var r=0;r<i.length;r++)e.writeFloat(i[r])}function g_(i,e){for(var r=0;r<i.length;r++)e.writeDouble(i[r])}function __(i,e){for(var r=0;r<i.length;r++)e.writeBoolean(i[r])}function y_(i,e){for(var r=0;r<i.length;r++)e.writeFixed32(i[r])}function x_(i,e){for(var r=0;r<i.length;r++)e.writeSFixed32(i[r])}function v_(i,e){for(var r=0;r<i.length;r++)e.writeFixed64(i[r])}function b_(i,e){for(var r=0;r<i.length;r++)e.writeSFixed64(i[r])}function rc(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+16777216*i[e+3]}function Ao(i,e,r){i[r]=e,i[r+1]=e>>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function wd(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}Pt.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos<r;){var s=this.readVarint(),l=s>>3,d=this.pos;this.type=7&s,i(l,e,this),this.pos===d&&this.skip(s)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=rc(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=wd(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=rc(this.buf,this.pos)+rc(this.buf,this.pos+4)*gh;return this.pos+=8,i},readSFixed64:function(){var i=rc(this.buf,this.pos)+wd(this.buf,this.pos+4)*gh;return this.pos+=8,i},readFloat:function(){var i=_d(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=_d(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,s=this.buf;return e=127&(r=s[this.pos++]),r<128?e:(e|=(127&(r=s[this.pos++]))<<7,r<128?e:(e|=(127&(r=s[this.pos++]))<<14,r<128?e:(e|=(127&(r=s[this.pos++]))<<21,r<128?e:function(l,d,p){var f,g,x=p.buf;if(f=(112&(g=x[p.pos++]))>>4,g<128||(f|=(127&(g=x[p.pos++]))<<3,g<128)||(f|=(127&(g=x[p.pos++]))<<10,g<128)||(f|=(127&(g=x[p.pos++]))<<17,g<128)||(f|=(127&(g=x[p.pos++]))<<24,g<128)||(f|=(1&(g=x[p.pos++]))<<31,g<128))return Co(l,f,d);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=s[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&&vd?function(r,s,l){return vd.decode(r.subarray(s,l))}(this.buf,e,i):function(r,s,l){for(var d="",p=s;p<l;){var f,g,x,w=r[p],I=null,C=w>239?4:w>223?3:w>191?2:1;if(p+C>l)break;C===1?w<128&&(I=w):C===2?(192&(f=r[p+1]))==128&&(I=(31&w)<<6|63&f)<=127&&(I=null):C===3?(g=r[p+2],(192&(f=r[p+1]))==128&&(192&g)==128&&((I=(15&w)<<12|(63&f)<<6|63&g)<=2047||I>=55296&&I<=57343)&&(I=null)):C===4&&(g=r[p+2],x=r[p+3],(192&(f=r[p+1]))==128&&(192&g)==128&&(192&x)==128&&((I=(15&w)<<18|(63&f)<<12|(63&g)<<6|63&x)<=65535||I>=1114112)&&(I=null)),I===null?(I=65533,C=1):I>65535&&(I-=65536,d+=String.fromCharCode(I>>>10&1023|55296),I=56320|1023&I),d+=String.fromCharCode(I),p+=C}return d}(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!==Pt.Bytes)return i.push(this.readVarint(e));var r=wn(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(e));return i},readPackedSVarint:function(i){if(this.type!==Pt.Bytes)return i.push(this.readSVarint());var e=wn(this);for(i=i||[];this.pos<e;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==Pt.Bytes)return i.push(this.readBoolean());var e=wn(this);for(i=i||[];this.pos<e;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==Pt.Bytes)return i.push(this.readFloat());var e=wn(this);for(i=i||[];this.pos<e;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==Pt.Bytes)return i.push(this.readDouble());var e=wn(this);for(i=i||[];this.pos<e;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==Pt.Bytes)return i.push(this.readFixed32());var e=wn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==Pt.Bytes)return i.push(this.readSFixed32());var e=wn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==Pt.Bytes)return i.push(this.readFixed64());var e=wn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==Pt.Bytes)return i.push(this.readSFixed64());var e=wn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed64());return i},skip:function(i){var e=7&i;if(e===Pt.Varint)for(;this.buf[this.pos++]>127;);else if(e===Pt.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Pt.Fixed32)this.pos+=4;else{if(e!==Pt.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),Ao(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),Ao(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),Ao(this.buf,-1&i,this.pos),Ao(this.buf,Math.floor(i*xd),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),Ao(this.buf,-1&i,this.pos),Ao(this.buf,Math.floor(i*xd),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?function(e,r){var s,l;if(e>=0?(s=e%4294967296|0,l=e/4294967296|0):(l=~(-e/4294967296),4294967295^(s=~(-e%4294967296))?s=s+1|0:(s=0,l=l+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(d,p,f){f.buf[f.pos++]=127&d|128,d>>>=7,f.buf[f.pos++]=127&d|128,d>>>=7,f.buf[f.pos++]=127&d|128,d>>>=7,f.buf[f.pos++]=127&d|128,f.buf[f.pos]=127&(d>>>=7)}(s,0,r),function(d,p){var f=(7&d)<<4;p.buf[p.pos++]|=f|((d>>>=3)?128:0),d&&(p.buf[p.pos++]=127&d|((d>>>=7)?128:0),d&&(p.buf[p.pos++]=127&d|((d>>>=7)?128:0),d&&(p.buf[p.pos++]=127&d|((d>>>=7)?128:0),d&&(p.buf[p.pos++]=127&d|((d>>>=7)?128:0),d&&(p.buf[p.pos++]=127&d)))))}(l,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(s,l,d){for(var p,f,g=0;g<l.length;g++){if((p=l.charCodeAt(g))>55295&&p<57344){if(!f){p>56319||g+1===l.length?(s[d++]=239,s[d++]=191,s[d++]=189):f=p;continue}if(p<56320){s[d++]=239,s[d++]=191,s[d++]=189,f=p;continue}p=f-55296<<10|p-56320|65536,f=null}else f&&(s[d++]=239,s[d++]=191,s[d++]=189,f=null);p<128?s[d++]=p:(p<2048?s[d++]=p>>6|192:(p<65536?s[d++]=p>>12|224:(s[d++]=p>>18|240,s[d++]=p>>12&63|128),s[d++]=p>>6&63|128),s[d++]=63&p|128)}return d}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&bd(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),yd(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),yd(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 s=this.pos-r;s>=128&&bd(r,s,this),this.pos=r-1,this.writeVarint(s),this.pos+=s},writeMessage:function(i,e,r){this.writeTag(i,Pt.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,p_,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,f_,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,__,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,m_,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,g_,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,y_,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,x_,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,v_,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,b_,e)},writeBytesField:function(i,e){this.writeTag(i,Pt.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,Pt.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,Pt.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,Pt.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,Pt.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,Pt.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,Pt.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,Pt.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,Pt.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,Pt.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,!!e)}};var _h=ve(gd);const yh=3;function w_(i,e,r){i===1&&r.readMessage(S_,e)}function S_(i,e,r){if(i===3){const{id:s,bitmap:l,width:d,height:p,left:f,top:g,advance:x}=r.readMessage(T_,{});e.push({id:s,bitmap:new ja({width:d+2*yh,height:p+2*yh},l),metrics:{width:d,height:p,left:f,top:g,advance:x}})}}function T_(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 Sd=yh;function Td(i){let e=0,r=0;for(const p of i)e+=p.w*p.h,r=Math.max(r,p.w);i.sort((p,f)=>f.h-p.h);const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let l=0,d=0;for(const p of i)for(let f=s.length-1;f>=0;f--){const g=s[f];if(!(p.w>g.w||p.h>g.h)){if(p.x=g.x,p.y=g.y,d=Math.max(d,p.y+p.h),l=Math.max(l,p.x+p.w),p.w===g.w&&p.h===g.h){const x=s.pop();f<s.length&&(s[f]=x)}else p.h===g.h?(g.x+=p.w,g.w-=p.w):p.w===g.w?(g.y+=p.h,g.h-=p.h):(s.push({x:g.x+p.w,y:g.y,w:g.w-p.w,h:p.h}),g.y+=p.h,g.h-=p.h);break}}return{w:l,h:d,fill:e/(l*d)||0}}const qi=1;class xh{constructor(e,{pixelRatio:r,version:s,stretchX:l,stretchY:d,content:p,textFitWidth:f,textFitHeight:g}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=l,this.stretchY=d,this.content=p,this.version=s,this.textFitWidth=f,this.textFitHeight=g}get tl(){return[this.paddedRect.x+qi,this.paddedRect.y+qi]}get br(){return[this.paddedRect.x+this.paddedRect.w-qi,this.paddedRect.y+this.paddedRect.h-qi]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*qi)/this.pixelRatio,(this.paddedRect.h-2*qi)/this.pixelRatio]}}class Id{constructor(e,r){const s={},l={};this.haveRenderCallbacks=[];const d=[];this.addImages(e,s,d),this.addImages(r,l,d);const{w:p,h:f}=Td(d),g=new lr({width:p||1,height:f||1});for(const x in e){const w=e[x],I=s[x].paddedRect;lr.copy(w.data,g,{x:0,y:0},{x:I.x+qi,y:I.y+qi},w.data)}for(const x in r){const w=r[x],I=l[x].paddedRect,C=I.x+qi,z=I.y+qi,R=w.data.width,F=w.data.height;lr.copy(w.data,g,{x:0,y:0},{x:C,y:z},w.data),lr.copy(w.data,g,{x:0,y:F-1},{x:C,y:z-1},{width:R,height:1}),lr.copy(w.data,g,{x:0,y:0},{x:C,y:z+F},{width:R,height:1}),lr.copy(w.data,g,{x:R-1,y:0},{x:C-1,y:z},{width:1,height:F}),lr.copy(w.data,g,{x:0,y:0},{x:C+R,y:z},{width:1,height:F})}this.image=g,this.iconPositions=s,this.patternPositions=l}addImages(e,r,s){for(const l in e){const d=e[l],p={x:0,y:0,w:d.data.width+2*qi,h:d.data.height+2*qi};s.push(p),r[l]=new xh(p,d),d.hasRenderCallback&&this.haveRenderCallbacks.push(l)}}patchUpdatedImages(e,r){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const s in e.updatedImages)this.patchUpdatedImage(this.iconPositions[s],e.getImage(s),r),this.patchUpdatedImage(this.patternPositions[s],e.getImage(s),r)}patchUpdatedImage(e,r,s){if(!e||!r||e.version===r.version)return;e.version=r.version;const[l,d]=e.tl;s.update(r.data,void 0,{x:l,y:d})}}var Xn;Oe("ImagePosition",xh),Oe("ImageAtlas",Id),S.ai=void 0,(Xn=S.ai||(S.ai={}))[Xn.none=0]="none",Xn[Xn.horizontal=1]="horizontal",Xn[Xn.vertical=2]="vertical",Xn[Xn.horizontalOnly=3]="horizontalOnly";const Xa=-17;class Wa{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){const s=new Wa;return s.scale=e||1,s.fontStack=r,s}static forImage(e){const r=new Wa;return r.imageName=e,r}}class ko{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){const s=new ko;for(let l=0;l<e.sections.length;l++){const d=e.sections[l];d.image?s.addImageSection(d):s.addTextSection(d,r)}return s}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 s=0;s<e.length;s++){const l=e.charCodeAt(s+1)||null,d=e.charCodeAt(s-1)||null;r+=l&&Ul(l)&&!Ha[e[s+1]]||d&&Ul(d)&&!Ha[e[s-1]]||!Ha[e[s]]?e[s]:Ha[e[s]]}return r}(this.text)}trim(){let e=0;for(let s=0;s<this.text.length&&sc[this.text.charCodeAt(s)];s++)e++;let r=this.text.length;for(let s=this.text.length-1;s>=0&&s>=e&&sc[this.text.charCodeAt(s)];s--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const s=new ko;return s.text=this.text.substring(e,r),s.sectionIndex=this.sectionIndex.slice(e,r),s.sections=this.sections,s}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(Wa.forText(e.scale,e.fontStack||r));const s=this.sections.length-1;for(let l=0;l<e.text.length;++l)this.sectionIndex.push(s)}addImageSection(e){const r=e.image?e.image.name:"";if(r.length===0)return void ci("Can't add FormattedSection with an empty image.");const s=this.getNextImageSectionCharCode();s?(this.text+=String.fromCharCode(s),this.sections.push(Wa.forImage(r)),this.sectionIndex.push(this.sections.length-1)):ci("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function nc(i,e,r,s,l,d,p,f,g,x,w,I,C,z,R){const F=ko.fromFeature(i,l);let $;I===S.ai.vertical&&F.verticalizePunctuation();const{processBidirectionalText:X,processStyledBidirectionalText:se}=Jr;if(X&&F.sections.length===1){$=[];const de=X(F.toString(),vh(F,x,d,e,s,z));for(const xe of de){const Le=new ko;Le.text=xe,Le.sections=F.sections;for(let We=0;We<xe.length;We++)Le.sectionIndex.push(0);$.push(Le)}}else if(se){$=[];const de=se(F.text,F.sectionIndex,vh(F,x,d,e,s,z));for(const xe of de){const Le=new ko;Le.text=xe[0],Le.sectionIndex=xe[1],Le.sections=F.sections,$.push(Le)}}else $=function(de,xe){const Le=[],We=de.text;let Me=0;for(const Ae of xe)Le.push(de.substring(Me,Ae)),Me=Ae;return Me<We.length&&Le.push(de.substring(Me,We.length)),Le}(F,vh(F,x,d,e,s,z));const Y=[],ie={positionedLines:Y,text:F.toString(),top:w[1],bottom:w[1],left:w[0],right:w[0],writingMode:I,iconsInText:!1,verticalizable:!1};return function(de,xe,Le,We,Me,Ae,qe,Ve,Be,me,Ge,$e){let tt=0,Ct=Xa,Et=0,si=0;const Sr=Ve==="right"?1:Ve==="left"?0:.5;let xi=0;for(const Ht of Me){Ht.trim();const oi=Ht.getMaxScale(),Pi=(oi-1)*ii,vi={positionedGlyphs:[],lineOffset:0};de.positionedLines[xi]=vi;const Bi=vi.positionedGlyphs;let bi=0;if(!Ht.length()){Ct+=Ae,++xi;continue}for(let Zi=0;Zi<Ht.length();Zi++){const _t=Ht.getSection(Zi),Dt=Ht.getSectionIndex(Zi),Vt=Ht.getCharCode(Zi);let Ji=0,Zt=null,Lo=null,en=null,tn=ii;const Tr=!(Be===S.ai.horizontal||!Ge&&!ka(Vt)||Ge&&(sc[Vt]||(Gt=Vt,ze.Arabic(Gt)||ze["Arabic Supplement"](Gt)||ze["Arabic Extended-A"](Gt)||ze["Arabic Presentation Forms-A"](Gt)||ze["Arabic Presentation Forms-B"](Gt))));if(_t.imageName){const ur=We[_t.imageName];if(!ur)continue;en=_t.imageName,de.iconsInText=de.iconsInText||!0,Lo=ur.paddedRect;const li=ur.displaySize;_t.scale=_t.scale*ii/$e,Zt={width:li[0],height:li[1],left:qi,top:-Sd,advance:Tr?li[1]:li[0]},Ji=Pi+(ii-li[1]*_t.scale),tn=Zt.advance;const Sn=Tr?li[0]*_t.scale-ii*oi:li[1]*_t.scale-ii*oi;Sn>0&&Sn>bi&&(bi=Sn)}else{const ur=Le[_t.fontStack],li=ur&&ur[Vt];if(li&&li.rect)Lo=li.rect,Zt=li.metrics;else{const Sn=xe[_t.fontStack],el=Sn&&Sn[Vt];if(!el)continue;Zt=el.metrics}Ji=(oi-_t.scale)*ii}Tr?(de.verticalizable=!0,Bi.push({glyph:Vt,imageName:en,x:tt,y:Ct+Ji,vertical:Tr,scale:_t.scale,fontStack:_t.fontStack,sectionIndex:Dt,metrics:Zt,rect:Lo}),tt+=tn*_t.scale+me):(Bi.push({glyph:Vt,imageName:en,x:tt,y:Ct+Ji,vertical:Tr,scale:_t.scale,fontStack:_t.fontStack,sectionIndex:Dt,metrics:Zt,rect:Lo}),tt+=Zt.advance*_t.scale+me)}Bi.length!==0&&(Et=Math.max(tt-me,Et),C_(Bi,0,Bi.length-1,Sr,bi)),tt=0;const hr=Ae*oi+bi;vi.lineOffset=Math.max(bi,Pi),Ct+=hr,si=Math.max(hr,si),++xi}var Gt;const Di=Ct-Xa,{horizontalAlign:Li,verticalAlign:Ri}=bh(qe);(function(Ht,oi,Pi,vi,Bi,bi,hr,Zi,_t){const Dt=(oi-Pi)*Bi;let Vt=0;Vt=bi!==hr?-Zi*vi-Xa:(-vi*_t+.5)*hr;for(const Ji of Ht)for(const Zt of Ji.positionedGlyphs)Zt.x+=Dt,Zt.y+=Vt})(de.positionedLines,Sr,Li,Ri,Et,si,Ae,Di,Me.length),de.top+=-Ri*Di,de.bottom=de.top+Di,de.left+=-Li*Et,de.right=de.left+Et}(ie,e,r,s,$,p,f,g,I,x,C,R),!function(de){for(const xe of de)if(xe.positionedGlyphs.length!==0)return!1;return!0}(Y)&&ie}const sc={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},I_={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},P_={40:!0};function Pd(i,e,r,s,l,d){if(e.imageName){const p=s[e.imageName];return p?p.displaySize[0]*e.scale*ii/d+l:0}{const p=r[e.fontStack],f=p&&p[i];return f?f.metrics.advance*e.scale+l:0}}function Ed(i,e,r,s){const l=Math.pow(i-e,2);return s?i<e?l/2:2*l:l+Math.abs(r)*r}function E_(i,e,r){let s=0;return i===10&&(s-=1e4),r&&(s+=150),i!==40&&i!==65288||(s+=50),e!==41&&e!==65289||(s+=50),s}function Cd(i,e,r,s,l,d){let p=null,f=Ed(e,r,l,d);for(const g of s){const x=Ed(e-g.x,r,l,d)+g.badness;x<=f&&(p=g,f=x)}return{index:i,x:e,priorBreak:p,badness:f}}function Ad(i){return i?Ad(i.priorBreak).concat(i.index):[]}function vh(i,e,r,s,l,d){if(!i)return[];const p=[],f=function(I,C,z,R,F,$){let X=0;for(let se=0;se<I.length();se++){const Y=I.getSection(se);X+=Pd(I.getCharCode(se),Y,R,F,C,$)}return X/Math.max(1,Math.ceil(X/z))}(i,e,r,s,l,d),g=i.text.indexOf("")>=0;let x=0;for(let I=0;I<i.length();I++){const C=i.getSection(I),z=i.getCharCode(I);if(sc[z]||(x+=Pd(z,C,s,l,e,d)),I<i.length()-1){const R=!((w=z)<11904||!(ze["Bopomofo Extended"](w)||ze.Bopomofo(w)||ze["CJK Compatibility Forms"](w)||ze["CJK Compatibility Ideographs"](w)||ze["CJK Compatibility"](w)||ze["CJK Radicals Supplement"](w)||ze["CJK Strokes"](w)||ze["CJK Symbols and Punctuation"](w)||ze["CJK Unified Ideographs Extension A"](w)||ze["CJK Unified Ideographs"](w)||ze["Enclosed CJK Letters and Months"](w)||ze["Halfwidth and Fullwidth Forms"](w)||ze.Hiragana(w)||ze["Ideographic Description Characters"](w)||ze["Kangxi Radicals"](w)||ze["Katakana Phonetic Extensions"](w)||ze.Katakana(w)||ze["Vertical Forms"](w)||ze["Yi Radicals"](w)||ze["Yi Syllables"](w)));(I_[z]||R||C.imageName||I!==i.length()-2&&P_[i.getCharCode(I+1)])&&p.push(Cd(I+1,x,f,p,E_(z,i.getCharCode(I+1),R&&g),!1))}}var w;return Ad(Cd(i.length(),x,f,p,0,!0))}function bh(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 C_(i,e,r,s,l){if(!s&&!l)return;const d=i[r],p=(i[r].x+d.metrics.advance*d.scale)*s;for(let f=e;f<=r;f++)i[f].x-=p,i[f].y+=l}function A_(i,e,r){const{horizontalAlign:s,verticalAlign:l}=bh(r),d=e[0]-i.displaySize[0]*s,p=e[1]-i.displaySize[1]*l;return{image:i,top:p,bottom:p+i.displaySize[1],left:d,right:d+i.displaySize[0]}}function kd(i){var e,r;let s=i.left,l=i.top,d=i.right-s,p=i.bottom-l;const f=(e=i.image.textFitWidth)!==null&&e!==void 0?e:"stretchOrShrink",g=(r=i.image.textFitHeight)!==null&&r!==void 0?r:"stretchOrShrink",x=(i.image.content[2]-i.image.content[0])/(i.image.content[3]-i.image.content[1]);if(g==="proportional"){if(f==="stretchOnly"&&d/p<x||f==="proportional"){const w=Math.ceil(p*x);s*=w/d,d=w}}else if(f==="proportional"&&g==="stretchOnly"&&x!==0&&d/p>x){const w=Math.ceil(d/x);l*=w/p,p=w}return{x1:s,y1:l,x2:s+d,y2:l+p}}function Md(i,e,r,s,l,d){const p=i.image;let f;if(p.content){const $=p.content,X=p.pixelRatio||1;f=[$[0]/X,$[1]/X,p.displaySize[0]-$[2]/X,p.displaySize[1]-$[3]/X]}const g=e.left*d,x=e.right*d;let w,I,C,z;r==="width"||r==="both"?(z=l[0]+g-s[3],I=l[0]+x+s[1]):(z=l[0]+(g+x-p.displaySize[0])/2,I=z+p.displaySize[0]);const R=e.top*d,F=e.bottom*d;return r==="height"||r==="both"?(w=l[1]+R-s[0],C=l[1]+F+s[2]):(w=l[1]+(R+F-p.displaySize[1])/2,C=w+p.displaySize[1]),{image:p,top:w,right:I,bottom:C,left:z,collisionPadding:f}}const Ja=255,Qr=128,Wn=Ja*Qr;function zd(i,e){const{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new zt(i+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:s,interpolationType:l}=r;let d=0;for(;d<s.length&&s[d]<=i;)d++;d=Math.max(0,d-1);let p=d;for(;p<s.length&&s[p]<i+1;)p++;p=Math.min(s.length-1,p);const f=s[d],g=s[p];return r.kind==="composite"?{kind:"composite",minZoom:f,maxZoom:g,interpolationType:l}:{kind:"camera",minZoom:f,maxZoom:g,minSize:r.evaluate(new zt(f)),maxSize:r.evaluate(new zt(g)),interpolationType:l}}}function wh(i,e,r){let s="never";const l=i.get(e);return l?s=l:i.get(r)&&(s="always"),s}const k_=Hn.VectorTileFeature.types,M_=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function oc(i,e,r,s,l,d,p,f,g,x,w,I,C){const z=f?Math.min(Wn,Math.round(f[0])):0,R=f?Math.min(Wn,Math.round(f[1])):0;i.emplaceBack(e,r,Math.round(32*s),Math.round(32*l),d,p,(z<<1)+(g?1:0),R,16*x,16*w,256*I,256*C)}function Sh(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 z_(i){for(const e of i.sections)if(Ma(e.text))return!0;return!1}class Th{constructor(e){this.layoutVertexArray=new ar,this.indexArray=new ni,this.programConfigurations=e,this.segments=new ti,this.dynamicLayoutVertexArray=new Kr,this.opacityVertexArray=new $n,this.hasVisibleVertices=!1,this.placedSymbolArray=new Ft}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,s,l){this.isEmpty()||(s&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,l_.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,c_.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,M_,!0),this.opacityVertexBuffer.itemSize=1),(s||l)&&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())}}Oe("SymbolBuffers",Th);class Ih{constructor(e,r,s){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new s,this.segments=new ti,this.collisionVertexArray=new _i}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,h_.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Oe("CollisionBuffers",Ih);class Mo{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(p=>p.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=sh([]),this.placementViewportMatrix=sh([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=zd(this.zoom,r["text-size"]),this.iconSizeData=zd(this.zoom,r["icon-size"]);const s=this.layers[0].layout,l=s.get("symbol-sort-key"),d=s.get("symbol-z-order");this.canOverlap=wh(s,"text-overlap","text-allow-overlap")!=="never"||wh(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=d!=="viewport-y"&&!l.isConstant(),this.sortFeaturesByY=(d==="viewport-y"||d==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,s.get("symbol-placement")==="point"&&(this.writingModes=s.get("text-writing-mode").map(p=>S.ai[p])),this.stateDependentLayerIds=this.layers.filter(p=>p.isStateDependent()).map(p=>p.id),this.sourceID=e.sourceID}createArrays(){this.text=new Th(new Ms(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Th(new Ms(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Ot,this.lineVertexArray=new Mi,this.symbolInstances=new sr,this.textAnchorOffsets=new fi}calculateGlyphDependencies(e,r,s,l,d){for(let p=0;p<e.length;p++)if(r[e.charCodeAt(p)]=!0,(s||l)&&d){const f=Ha[e.charAt(p)];f&&(r[f.charCodeAt(0)]=!0)}}populate(e,r,s){const l=this.layers[0],d=l.layout,p=d.get("text-font"),f=d.get("text-field"),g=d.get("icon-image"),x=(f.value.kind!=="constant"||f.value.value instanceof Oi&&!f.value.value.isEmpty()||f.value.value.toString().length>0)&&(p.value.kind!=="constant"||p.value.value.length>0),w=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,I=d.get("symbol-sort-key");if(this.features=[],!x&&!w)return;const C=r.iconDependencies,z=r.glyphDependencies,R=r.availableImages,F=new zt(this.zoom);for(const{feature:$,id:X,index:se,sourceLayerIndex:Y}of e){const ie=l._featureFilter.needGeometry,de=Ds($,ie);if(!l._featureFilter.filter(F,de,s))continue;let xe,Le;if(ie||(de.geometry=zs($)),x){const Me=l.getValueAndResolveTokens("text-field",de,s,R),Ae=Oi.factory(Me),qe=this.hasRTLText=this.hasRTLText||z_(Ae);(!qe||Jr.getRTLTextPluginStatus()==="unavailable"||qe&&Jr.isParsed())&&(xe=d_(Ae,l,de))}if(w){const Me=l.getValueAndResolveTokens("icon-image",de,s,R);Le=Me instanceof di?Me:di.fromString(Me)}if(!xe&&!Le)continue;const We=this.sortFeaturesByKey?I.evaluate(de,{},s):void 0;if(this.features.push({id:X,text:xe,icon:Le,index:se,sourceLayerIndex:Y,geometry:de.geometry,properties:$.properties,type:k_[$.type],sortKey:We}),Le&&(C[Le.name]=!0),xe){const Me=p.evaluate(de,{},s).join(","),Ae=d.get("text-rotation-alignment")!=="viewport"&&d.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(S.ai.vertical)>=0;for(const qe of xe.sections)if(qe.image)C[qe.image.name]=!0;else{const Ve=Aa(xe.toString()),Be=qe.fontStack||Me,me=z[Be]=z[Be]||{};this.calculateGlyphDependencies(qe.text,me,Ae,this.allowVerticalPlacement,Ve)}}}d.get("symbol-placement")==="line"&&(this.features=function($){const X={},se={},Y=[];let ie=0;function de(Me){Y.push($[Me]),ie++}function xe(Me,Ae,qe){const Ve=se[Me];return delete se[Me],se[Ae]=Ve,Y[Ve].geometry[0].pop(),Y[Ve].geometry[0]=Y[Ve].geometry[0].concat(qe[0]),Ve}function Le(Me,Ae,qe){const Ve=X[Ae];return delete X[Ae],X[Me]=Ve,Y[Ve].geometry[0].shift(),Y[Ve].geometry[0]=qe[0].concat(Y[Ve].geometry[0]),Ve}function We(Me,Ae,qe){const Ve=qe?Ae[0][Ae[0].length-1]:Ae[0][0];return`${Me}:${Ve.x}:${Ve.y}`}for(let Me=0;Me<$.length;Me++){const Ae=$[Me],qe=Ae.geometry,Ve=Ae.text?Ae.text.toString():null;if(!Ve){de(Me);continue}const Be=We(Ve,qe),me=We(Ve,qe,!0);if(Be in se&&me in X&&se[Be]!==X[me]){const Ge=Le(Be,me,qe),$e=xe(Be,me,Y[Ge].geometry);delete X[Be],delete se[me],se[We(Ve,Y[$e].geometry,!0)]=$e,Y[Ge].geometry=null}else Be in se?xe(Be,me,qe):me in X?Le(Be,me,qe):(de(Me),X[Be]=ie-1,se[me]=ie-1)}return Y.filter(Me=>Me.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort(($,X)=>$.sortKey-X.sortKey)}update(e,r,s){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,s),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,s))}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 s=this.lineVertexArray.length;if(e.segment!==void 0){let l=e.dist(r[e.segment+1]),d=e.dist(r[e.segment]);const p={};for(let f=e.segment+1;f<r.length;f++)p[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:l},f<r.length-1&&(l+=r[f+1].dist(r[f]));for(let f=e.segment||0;f>=0;f--)p[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:d},f>0&&(d+=r[f-1].dist(r[f]));for(let f=0;f<r.length;f++){const g=p[f];this.lineVertexArray.emplaceBack(g.x,g.y,g.tileUnitDistanceFromAnchor)}}return{lineStartIndex:s,lineLength:this.lineVertexArray.length-s}}addSymbols(e,r,s,l,d,p,f,g,x,w,I,C){const z=e.indexArray,R=e.layoutVertexArray,F=e.segments.prepareSegment(4*r.length,R,z,this.canOverlap?p.sortKey:void 0),$=this.glyphOffsetArray.length,X=F.vertexLength,se=this.allowVerticalPlacement&&f===S.ai.vertical?Math.PI/2:0,Y=p.text&&p.text.sections;for(let ie=0;ie<r.length;ie++){const{tl:de,tr:xe,bl:Le,br:We,tex:Me,pixelOffsetTL:Ae,pixelOffsetBR:qe,minFontScaleX:Ve,minFontScaleY:Be,glyphOffset:me,isSDF:Ge,sectionIndex:$e}=r[ie],tt=F.vertexLength,Ct=me[1];oc(R,g.x,g.y,de.x,Ct+de.y,Me.x,Me.y,s,Ge,Ae.x,Ae.y,Ve,Be),oc(R,g.x,g.y,xe.x,Ct+xe.y,Me.x+Me.w,Me.y,s,Ge,qe.x,Ae.y,Ve,Be),oc(R,g.x,g.y,Le.x,Ct+Le.y,Me.x,Me.y+Me.h,s,Ge,Ae.x,qe.y,Ve,Be),oc(R,g.x,g.y,We.x,Ct+We.y,Me.x+Me.w,Me.y+Me.h,s,Ge,qe.x,qe.y,Ve,Be),Sh(e.dynamicLayoutVertexArray,g,se),z.emplaceBack(tt,tt+1,tt+2),z.emplaceBack(tt+1,tt+2,tt+3),F.vertexLength+=4,F.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(me[0]),ie!==r.length-1&&$e===r[ie+1].sectionIndex||e.programConfigurations.populatePaintArrays(R.length,p,p.index,{},C,Y&&Y[$e])}e.placedSymbolArray.emplaceBack(g.x,g.y,$,this.glyphOffsetArray.length-$,X,x,w,g.segment,s?s[0]:0,s?s[1]:0,l[0],l[1],f,0,!1,0,I)}_addCollisionDebugVertex(e,r,s,l,d,p){return r.emplaceBack(0,0),e.emplaceBack(s.x,s.y,l,d,Math.round(p.x),Math.round(p.y))}addCollisionDebugVertices(e,r,s,l,d,p,f){const g=d.segments.prepareSegment(4,d.layoutVertexArray,d.indexArray),x=g.vertexLength,w=d.layoutVertexArray,I=d.collisionVertexArray,C=f.anchorX,z=f.anchorY;this._addCollisionDebugVertex(w,I,p,C,z,new le(e,r)),this._addCollisionDebugVertex(w,I,p,C,z,new le(s,r)),this._addCollisionDebugVertex(w,I,p,C,z,new le(s,l)),this._addCollisionDebugVertex(w,I,p,C,z,new le(e,l)),g.vertexLength+=4;const R=d.indexArray;R.emplaceBack(x,x+1),R.emplaceBack(x+1,x+2),R.emplaceBack(x+2,x+3),R.emplaceBack(x+3,x),g.primitiveLength+=4}addDebugCollisionBoxes(e,r,s,l){for(let d=e;d<r;d++){const p=this.collisionBoxArray.get(d);this.addCollisionDebugVertices(p.x1,p.y1,p.x2,p.y2,l?this.textCollisionBox:this.iconCollisionBox,p.anchorPoint,s)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Ih(gi,md.members,Ut),this.iconCollisionBox=new Ih(gi,md.members,Ut);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,s,l,d,p,f,g,x){const w={};for(let I=r;I<s;I++){const C=e.get(I);w.textBox={x1:C.x1,y1:C.y1,x2:C.x2,y2:C.y2,anchorPointX:C.anchorPointX,anchorPointY:C.anchorPointY},w.textFeatureIndex=C.featureIndex;break}for(let I=l;I<d;I++){const C=e.get(I);w.verticalTextBox={x1:C.x1,y1:C.y1,x2:C.x2,y2:C.y2,anchorPointX:C.anchorPointX,anchorPointY:C.anchorPointY},w.verticalTextFeatureIndex=C.featureIndex;break}for(let I=p;I<f;I++){const C=e.get(I);w.iconBox={x1:C.x1,y1:C.y1,x2:C.x2,y2:C.y2,anchorPointX:C.anchorPointX,anchorPointY:C.anchorPointY},w.iconFeatureIndex=C.featureIndex;break}for(let I=g;I<x;I++){const C=e.get(I);w.verticalIconBox={x1:C.x1,y1:C.y1,x2:C.x2,y2:C.y2,anchorPointX:C.anchorPointX,anchorPointY:C.anchorPointY},w.verticalIconFeatureIndex=C.featureIndex;break}return w}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const s=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,s.textBoxStartIndex,s.textBoxEndIndex,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s.iconBoxStartIndex,s.iconBoxEndIndex,s.verticalIconBoxStartIndex,s.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,r){const s=e.placedSymbolArray.get(r),l=s.vertexStartIndex+4*s.numGlyphs;for(let d=s.vertexStartIndex;d<l;d+=4)e.indexArray.emplaceBack(d,d+1,d+2),e.indexArray.emplaceBack(d+1,d+2,d+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(e),s=Math.cos(e),l=[],d=[],p=[];for(let f=0;f<this.symbolInstances.length;++f){p.push(f);const g=this.symbolInstances.get(f);l.push(0|Math.round(r*g.anchorX+s*g.anchorY)),d.push(g.featureIndex)}return p.sort((f,g)=>l[f]-l[g]||d[g]-d[f]),p}addToSortKeyRanges(e,r){const s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===r?s.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 s=this.symbolInstances.get(r);this.featureSortOrder.push(s.featureIndex),[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex].forEach((l,d,p)=>{l>=0&&p.indexOf(l)===d&&this.addIndicesForPlacedSymbol(this.text,l)}),s.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,s.verticalPlacedTextSymbolIndex),s.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.placedIconSymbolIndex),s.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Dd,Ld;Oe("SymbolBucket",Mo,{omit:["layers","collisionBoxArray","features","compareText"]}),Mo.MAX_GLYPHS=65535,Mo.addDynamicAttributes=Sh;var Ph={get paint(){return Ld=Ld||new o({"icon-opacity":new Je(ue.paint_symbol["icon-opacity"]),"icon-color":new Je(ue.paint_symbol["icon-color"]),"icon-halo-color":new Je(ue.paint_symbol["icon-halo-color"]),"icon-halo-width":new Je(ue.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Je(ue.paint_symbol["icon-halo-blur"]),"icon-translate":new Ze(ue.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ze(ue.paint_symbol["icon-translate-anchor"]),"text-opacity":new Je(ue.paint_symbol["text-opacity"]),"text-color":new Je(ue.paint_symbol["text-color"],{runtimeType:Ai,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new Je(ue.paint_symbol["text-halo-color"]),"text-halo-width":new Je(ue.paint_symbol["text-halo-width"]),"text-halo-blur":new Je(ue.paint_symbol["text-halo-blur"]),"text-translate":new Ze(ue.paint_symbol["text-translate"]),"text-translate-anchor":new Ze(ue.paint_symbol["text-translate-anchor"])})},get layout(){return Dd=Dd||new o({"symbol-placement":new Ze(ue.layout_symbol["symbol-placement"]),"symbol-spacing":new Ze(ue.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ze(ue.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Je(ue.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ze(ue.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ze(ue.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ze(ue.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ze(ue.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ze(ue.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ze(ue.layout_symbol["icon-rotation-alignment"]),"icon-size":new Je(ue.layout_symbol["icon-size"]),"icon-text-fit":new Ze(ue.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ze(ue.layout_symbol["icon-text-fit-padding"]),"icon-image":new Je(ue.layout_symbol["icon-image"]),"icon-rotate":new Je(ue.layout_symbol["icon-rotate"]),"icon-padding":new Je(ue.layout_symbol["icon-padding"]),"icon-keep-upright":new Ze(ue.layout_symbol["icon-keep-upright"]),"icon-offset":new Je(ue.layout_symbol["icon-offset"]),"icon-anchor":new Je(ue.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ze(ue.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ze(ue.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ze(ue.layout_symbol["text-rotation-alignment"]),"text-field":new Je(ue.layout_symbol["text-field"]),"text-font":new Je(ue.layout_symbol["text-font"]),"text-size":new Je(ue.layout_symbol["text-size"]),"text-max-width":new Je(ue.layout_symbol["text-max-width"]),"text-line-height":new Ze(ue.layout_symbol["text-line-height"]),"text-letter-spacing":new Je(ue.layout_symbol["text-letter-spacing"]),"text-justify":new Je(ue.layout_symbol["text-justify"]),"text-radial-offset":new Je(ue.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ze(ue.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Je(ue.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Je(ue.layout_symbol["text-anchor"]),"text-max-angle":new Ze(ue.layout_symbol["text-max-angle"]),"text-writing-mode":new Ze(ue.layout_symbol["text-writing-mode"]),"text-rotate":new Je(ue.layout_symbol["text-rotate"]),"text-padding":new Ze(ue.layout_symbol["text-padding"]),"text-keep-upright":new Ze(ue.layout_symbol["text-keep-upright"]),"text-transform":new Je(ue.layout_symbol["text-transform"]),"text-offset":new Je(ue.layout_symbol["text-offset"]),"text-allow-overlap":new Ze(ue.layout_symbol["text-allow-overlap"]),"text-overlap":new Ze(ue.layout_symbol["text-overlap"]),"text-ignore-placement":new Ze(ue.layout_symbol["text-ignore-placement"]),"text-optional":new Ze(ue.layout_symbol["text-optional"])})}};class Rd{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:$r,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}}Oe("FormatSectionOverride",Rd,{omit:["defaultValue"]});class ac extends h{constructor(e){super(e,Ph)}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 s=this.layout.get("text-writing-mode");if(s){const l=[];for(const d of s)l.indexOf(d)<0&&l.push(d);this.layout._values["text-writing-mode"]=l}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,s,l){const d=this.layout.get(e).evaluate(r,{},s,l),p=this._unevaluatedLayout._values[e];return p.isDataDriven()||bs(p.value)||!d?d:function(f,g){return g.replace(/{([^{}]+)}/g,(x,w)=>f&&w in f?String(f[w]):"")}(r.properties,d)}createBucket(e){return new Mo(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of Ph.paint.overridableProperties){if(!ac.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),s=new Rd(r),l=new co(s,r.property.specification);let d=null;d=r.value.kind==="constant"||r.value.kind==="source"?new la("source",l):new ca("composite",l,r.value.zoomStops),this.paint._values[e]=new wr(r.property,d,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,s){return!(!this.layout||r.isDataDriven()||s.isDataDriven())&&ac.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const s=e.get("text-field"),l=Ph.paint.properties[r];let d=!1;const p=f=>{for(const g of f)if(l.overrides&&l.overrides.hasOverride(g))return void(d=!0)};if(s.value.kind==="constant"&&s.value.value instanceof Oi)p(s.value.value.sections);else if(s.value.kind==="source"){const f=x=>{d||(x instanceof cn&&Yt(x.value)===Mr?p(x.value.sections):x instanceof Js?p(x.sections):x.eachChild(f))},g=s.value;g._styleExpression&&f(g._styleExpression.expression)}return d}}let Bd;var D_={get paint(){return Bd=Bd||new o({"background-color":new Ze(ue.paint_background["background-color"]),"background-pattern":new t(ue.paint_background["background-pattern"]),"background-opacity":new Ze(ue.paint_background["background-opacity"])})}};class L_ extends h{constructor(e){super(e,D_)}}let Fd;var R_={get paint(){return Fd=Fd||new o({"raster-opacity":new Ze(ue.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ze(ue.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ze(ue.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ze(ue.paint_raster["raster-brightness-max"]),"raster-saturation":new Ze(ue.paint_raster["raster-saturation"]),"raster-contrast":new Ze(ue.paint_raster["raster-contrast"]),"raster-resampling":new Ze(ue.paint_raster["raster-resampling"]),"raster-fade-duration":new Ze(ue.paint_raster["raster-fade-duration"])})}};class B_ extends h{constructor(e){super(e,R_)}}class F_ extends h{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 O_{constructor(e){this._methodToThrottle=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const Eh=63710088e-1;class Jn{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 Jn(At(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,s=this.lat*r,l=e.lat*r,d=Math.sin(s)*Math.sin(l)+Math.cos(s)*Math.cos(l)*Math.cos((e.lng-this.lng)*r);return Eh*Math.acos(Math.min(d,1))}static convert(e){if(e instanceof Jn)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Jn(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Jn(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 Od=2*Math.PI*Eh;function Vd(i){return Od*Math.cos(i*Math.PI/180)}function Nd(i){return(180+i)/360}function jd(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function Ud(i,e){return i/Vd(e)}function Ch(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class lc{constructor(e,r,s=0){this.x=+e,this.y=+r,this.z=+s}static fromLngLat(e,r=0){const s=Jn.convert(e);return new lc(Nd(s.lng),jd(s.lat),Ud(r,s.lat))}toLngLat(){return new Jn(360*this.x-180,Ch(this.y))}toAltitude(){return this.z*Vd(Ch(this.y))}meterInMercatorCoordinateUnits(){return 1/Od*(e=Ch(this.y),1/Math.cos(e*Math.PI/180));var e}}function $d(i,e,r){var s=2*Math.PI*6378137/256/Math.pow(2,r);return[i*s-2*Math.PI*6378137/2,e*s-2*Math.PI*6378137/2]}class Ah{constructor(e,r,s){if(e<0||e>25||s<0||s>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error(`x=${r}, y=${s}, 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=s,this.key=Ka(0,e,e,r,s)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,s){const l=(p=this.y,f=this.z,g=$d(256*(d=this.x),256*(p=Math.pow(2,f)-p-1),f),x=$d(256*(d+1),256*(p+1),f),g[0]+","+g[1]+","+x[0]+","+x[1]);var d,p,f,g,x;const w=function(I,C,z){let R,F="";for(let $=I;$>0;$--)R=1<<$-1,F+=(C&R?1:0)+(z&R?2:0);return F}(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(s==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,w).replace(/{bbox-epsg-3857}/g,l)}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 le((e.x*r-this.x)*Qt,(e.y*r-this.y)*Qt)}toString(){return`${this.z}/${this.x}/${this.y}`}}class qd{constructor(e,r){this.wrap=e,this.canonical=r,this.key=Ka(e,r.z,r.z,r.x,r.y)}}class cr{constructor(e,r,s,l,d){if(e<s)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${s}`);this.overscaledZ=e,this.wrap=r,this.canonical=new Ah(s,+l,+d),this.key=Ka(r,e,s,l,d)}clone(){return new cr(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 cr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new cr(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 s=this.canonical.z-e;return e>this.canonical.z?Ka(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Ka(this.wrap*+r,e,e,this.canonical.x>>s,this.canonical.y>>s)}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 cr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,s=2*this.canonical.x,l=2*this.canonical.y;return[new cr(r,this.wrap,r,s,l),new cr(r,this.wrap,r,s+1,l),new cr(r,this.wrap,r,s,l+1),new cr(r,this.wrap,r,s+1,l+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 cr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new cr(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 qd(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new lc(e.x-this.wrap,e.y))}}function Ka(i,e,r,s,l){(i*=2)<0&&(i=-1*i-1);const d=1<<r;return(d*d*i+d*l+s).toString(36)+r.toString(36)+e.toString(36)}Oe("CanonicalTileID",Ah),Oe("OverscaledTileID",cr,{omit:["posMatrix"]});class Zd{constructor(e,r,s,l=1,d=1,p=1,f=0){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(s&&!["mapbox","terrarium","custom"].includes(s))return void ci(`"${s}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=r.height;const g=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),s){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=l,this.greenFactor=d,this.blueFactor=p,this.baseShift=f;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let x=0;x<g;x++)this.data[this._idx(-1,x)]=this.data[this._idx(0,x)],this.data[this._idx(g,x)]=this.data[this._idx(g-1,x)],this.data[this._idx(x,-1)]=this.data[this._idx(x,0)],this.data[this._idx(x,g)]=this.data[this._idx(x,g-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(g,-1)]=this.data[this._idx(g-1,0)],this.data[this._idx(-1,g)]=this.data[this._idx(0,g-1)],this.data[this._idx(g,g)]=this.data[this._idx(g-1,g-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let x=0;x<g;x++)for(let w=0;w<g;w++){const I=this.get(x,w);I>this.max&&(this.max=I),I<this.min&&(this.min=I)}}get(e,r){const s=new Uint8Array(this.data.buffer),l=4*this._idx(e,r);return this.unpack(s[l],s[l+1],s[l+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,s){return e*this.redFactor+r*this.greenFactor+s*this.blueFactor-this.baseShift}getPixels(){return new lr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,s){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let l=r*this.dim,d=r*this.dim+this.dim,p=s*this.dim,f=s*this.dim+this.dim;switch(r){case-1:l=d-1;break;case 1:d=l+1}switch(s){case-1:p=f-1;break;case 1:f=p+1}const g=-r*this.dim,x=-s*this.dim;for(let w=p;w<f;w++)for(let I=l;I<d;I++)this.data[this._idx(I,w)]=e.data[this._idx(I+g,w+x)]}}Oe("DEMData",Zd);class Gd{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){const s=e[r];this._stringToNumber[s]=r,this._numberToString[r]=s}}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 Hd{constructor(e,r,s,l,d){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=s,e._y=l,this.properties=e.properties,this.id=d}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 Xd{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Vn(Qt,16,0),this.grid3D=new Vn(Qt,16,0),this.featureIndexArray=new or,this.promoteId=r}insert(e,r,s,l,d,p){const f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,l,d);const g=p?this.grid3D:this.grid;for(let x=0;x<r.length;x++){const w=r[x],I=[1/0,1/0,-1/0,-1/0];for(let C=0;C<w.length;C++){const z=w[C];I[0]=Math.min(I[0],z.x),I[1]=Math.min(I[1],z.y),I[2]=Math.max(I[2],z.x),I[3]=Math.max(I[3],z.y)}I[0]<Qt&&I[1]<Qt&&I[2]>=0&&I[3]>=0&&g.insert(f,I[0],I[1],I[2],I[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Hn.VectorTile(new _h(this.rawTileData)).layers,this.sourceLayerCoder=new Gd(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,s,l){this.loadVTLayers();const d=e.params||{},p=Qt/e.tileSize/e.scale,f=Ti(d.filter),g=e.queryGeometry,x=e.queryPadding*p,w=Jd(g),I=this.grid.query(w.minX-x,w.minY-x,w.maxX+x,w.maxY+x),C=Jd(e.cameraQueryGeometry),z=this.grid3D.query(C.minX-x,C.minY-x,C.maxX+x,C.maxY+x,($,X,se,Y)=>function(ie,de,xe,Le,We){for(const Ae of ie)if(de<=Ae.x&&xe<=Ae.y&&Le>=Ae.x&&We>=Ae.y)return!0;const Me=[new le(de,xe),new le(de,We),new le(Le,We),new le(Le,xe)];if(ie.length>2){for(const Ae of Me)if(To(ie,Ae))return!0}for(let Ae=0;Ae<ie.length-1;Ae++)if(yg(ie[Ae],ie[Ae+1],Me))return!0;return!1}(e.cameraQueryGeometry,$-x,X-x,se+x,Y+x));for(const $ of z)I.push($);I.sort(V_);const R={};let F;for(let $=0;$<I.length;$++){const X=I[$];if(X===F)continue;F=X;const se=this.featureIndexArray.get(X);let Y=null;this.loadMatchingFeature(R,se.bucketIndex,se.sourceLayerIndex,se.featureIndex,f,d.layers,d.availableImages,r,s,l,(ie,de,xe)=>(Y||(Y=zs(ie)),de.queryIntersectsFeature(g,ie,xe,Y,this.z,e.transform,p,e.pixelPosMatrix)))}return R}loadMatchingFeature(e,r,s,l,d,p,f,g,x,w,I){const C=this.bucketLayerIDs[r];if(p&&!function($,X){for(let se=0;se<$.length;se++)if(X.indexOf($[se])>=0)return!0;return!1}(p,C))return;const z=this.sourceLayerCoder.decode(s),R=this.vtLayers[z].feature(l);if(d.needGeometry){const $=Ds(R,!0);if(!d.filter(new zt(this.tileID.overscaledZ),$,this.tileID.canonical))return}else if(!d.filter(new zt(this.tileID.overscaledZ),R))return;const F=this.getId(R,z);for(let $=0;$<C.length;$++){const X=C[$];if(p&&p.indexOf(X)<0)continue;const se=g[X];if(!se)continue;let Y={};F&&w&&(Y=w.getState(se.sourceLayer||"_geojsonTileLayer",F));const ie=It({},x[X]);ie.paint=Wd(ie.paint,se.paint,R,Y,f),ie.layout=Wd(ie.layout,se.layout,R,Y,f);const de=!I||I(R,se,Y);if(!de)continue;const xe=new Hd(R,this.z,this.x,this.y,F);xe.layer=ie;let Le=e[X];Le===void 0&&(Le=e[X]=[]),Le.push({featureIndex:l,feature:xe,intersectionZ:de})}}lookupSymbolFeatures(e,r,s,l,d,p,f,g){const x={};this.loadVTLayers();const w=Ti(d);for(const I of e)this.loadMatchingFeature(x,s,l,I,w,p,f,g,r);return x}hasLayer(e){for(const r of this.bucketLayerIDs)for(const s of r)if(e===s)return!0;return!1}getId(e,r){let s=e.id;return this.promoteId&&(s=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof s=="boolean"&&(s=Number(s))),s}}function Wd(i,e,r,s,l){return ri(i,(d,p)=>{const f=e instanceof _o?e.get(p):null;return f&&f.evaluate?f.evaluate(r,s,l):f})}function Jd(i){let e=1/0,r=1/0,s=-1/0,l=-1/0;for(const d of i)e=Math.min(e,d.x),r=Math.min(r,d.y),s=Math.max(s,d.x),l=Math.max(l,d.y);return{minX:e,minY:r,maxX:s,maxY:l}}function V_(i,e){return e-i}function Kd(i,e,r,s,l){const d=[];for(let p=0;p<i.length;p++){const f=i[p];let g;for(let x=0;x<f.length-1;x++){let w=f[x],I=f[x+1];w.x<e&&I.x<e||(w.x<e?w=new le(e,w.y+(e-w.x)/(I.x-w.x)*(I.y-w.y))._round():I.x<e&&(I=new le(e,w.y+(e-w.x)/(I.x-w.x)*(I.y-w.y))._round()),w.y<r&&I.y<r||(w.y<r?w=new le(w.x+(r-w.y)/(I.y-w.y)*(I.x-w.x),r)._round():I.y<r&&(I=new le(w.x+(r-w.y)/(I.y-w.y)*(I.x-w.x),r)._round()),w.x>=s&&I.x>=s||(w.x>=s?w=new le(s,w.y+(s-w.x)/(I.x-w.x)*(I.y-w.y))._round():I.x>=s&&(I=new le(s,w.y+(s-w.x)/(I.x-w.x)*(I.y-w.y))._round()),w.y>=l&&I.y>=l||(w.y>=l?w=new le(w.x+(l-w.y)/(I.y-w.y)*(I.x-w.x),l)._round():I.y>=l&&(I=new le(w.x+(l-w.y)/(I.y-w.y)*(I.x-w.x),l)._round()),g&&w.equals(g[g.length-1])||(g=[w],d.push(g)),g.push(I)))))}}return d}Oe("FeatureIndex",Xd,{omit:["rawTileData","sourceLayerCoder"]});class Kn extends le{constructor(e,r,s,l){super(e,r),this.angle=s,l!==void 0&&(this.segment=l)}clone(){return new Kn(this.x,this.y,this.angle,this.segment)}}function Yd(i,e,r,s,l){if(e.segment===void 0||r===0)return!0;let d=e,p=e.segment+1,f=0;for(;f>-r/2;){if(p--,p<0)return!1;f-=i[p].dist(d),d=i[p]}f+=i[p].dist(i[p+1]),p++;const g=[];let x=0;for(;f<r/2;){const w=i[p],I=i[p+1];if(!I)return!1;let C=i[p-1].angleTo(w)-w.angleTo(I);for(C=Math.abs((C+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:f,angleDelta:C}),x+=C;f-g[0].distance>s;)x-=g.shift().angleDelta;if(x>l)return!1;p++,f+=w.dist(I)}return!0}function Qd(i){let e=0;for(let r=0;r<i.length-1;r++)e+=i[r].dist(i[r+1]);return e}function ep(i,e,r){return i?.6*e*r:0}function tp(i,e){return Math.max(i?i.right-i.left:0,e?e.right-e.left:0)}function N_(i,e,r,s,l,d){const p=ep(r,l,d),f=tp(r,s)*d;let g=0;const x=Qd(i)/2;for(let w=0;w<i.length-1;w++){const I=i[w],C=i[w+1],z=I.dist(C);if(g+z>x){const R=(x-g)/z,F=ji.number(I.x,C.x,R),$=ji.number(I.y,C.y,R),X=new Kn(F,$,C.angleTo(I),w);return X._round(),!p||Yd(i,X,f,p,e)?X:void 0}g+=z}}function j_(i,e,r,s,l,d,p,f,g){const x=ep(s,d,p),w=tp(s,l),I=w*p,C=i[0].x===0||i[0].x===g||i[0].y===0||i[0].y===g;return e-I<e/4&&(e=I+e/4),ip(i,C?e/2*f%e:(w/2+2*d)*p*f%e,e,x,r,I,C,!1,g)}function ip(i,e,r,s,l,d,p,f,g){const x=d/2,w=Qd(i);let I=0,C=e-r,z=[];for(let R=0;R<i.length-1;R++){const F=i[R],$=i[R+1],X=F.dist($),se=$.angleTo(F);for(;C+r<I+X;){C+=r;const Y=(C-I)/X,ie=ji.number(F.x,$.x,Y),de=ji.number(F.y,$.y,Y);if(ie>=0&&ie<g&&de>=0&&de<g&&C-x>=0&&C+x<=w){const xe=new Kn(ie,de,se,R);xe._round(),s&&!Yd(i,xe,d,s,l)||z.push(xe)}}I+=X}return f||z.length||p||(z=ip(i,I/2,r,s,l,d,p,!0,g)),z}Oe("Anchor",Kn);const zo=qi;function rp(i,e,r,s){const l=[],d=i.image,p=d.pixelRatio,f=d.paddedRect.w-2*zo,g=d.paddedRect.h-2*zo;let x={x1:i.left,y1:i.top,x2:i.right,y2:i.bottom};const w=d.stretchX||[[0,f]],I=d.stretchY||[[0,g]],C=(me,Ge)=>me+Ge[1]-Ge[0],z=w.reduce(C,0),R=I.reduce(C,0),F=f-z,$=g-R;let X=0,se=z,Y=0,ie=R,de=0,xe=F,Le=0,We=$;if(d.content&&s){const me=d.content,Ge=me[2]-me[0],$e=me[3]-me[1];(d.textFitWidth||d.textFitHeight)&&(x=kd(i)),X=cc(w,0,me[0]),Y=cc(I,0,me[1]),se=cc(w,me[0],me[2]),ie=cc(I,me[1],me[3]),de=me[0]-X,Le=me[1]-Y,xe=Ge-se,We=$e-ie}const Me=x.x1,Ae=x.y1,qe=x.x2-Me,Ve=x.y2-Ae,Be=(me,Ge,$e,tt)=>{const Ct=hc(me.stretch-X,se,qe,Me),Et=uc(me.fixed-de,xe,me.stretch,z),si=hc(Ge.stretch-Y,ie,Ve,Ae),Sr=uc(Ge.fixed-Le,We,Ge.stretch,R),xi=hc($e.stretch-X,se,qe,Me),Gt=uc($e.fixed-de,xe,$e.stretch,z),Di=hc(tt.stretch-Y,ie,Ve,Ae),Li=uc(tt.fixed-Le,We,tt.stretch,R),Ri=new le(Ct,si),Ht=new le(xi,si),oi=new le(xi,Di),Pi=new le(Ct,Di),vi=new le(Et/p,Sr/p),Bi=new le(Gt/p,Li/p),bi=e*Math.PI/180;if(bi){const _t=Math.sin(bi),Dt=Math.cos(bi),Vt=[Dt,-_t,_t,Dt];Ri._matMult(Vt),Ht._matMult(Vt),Pi._matMult(Vt),oi._matMult(Vt)}const hr=me.stretch+me.fixed,Zi=Ge.stretch+Ge.fixed;return{tl:Ri,tr:Ht,bl:Pi,br:oi,tex:{x:d.paddedRect.x+zo+hr,y:d.paddedRect.y+zo+Zi,w:$e.stretch+$e.fixed-hr,h:tt.stretch+tt.fixed-Zi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:vi,pixelOffsetBR:Bi,minFontScaleX:xe/p/qe,minFontScaleY:We/p/Ve,isSDF:r}};if(s&&(d.stretchX||d.stretchY)){const me=np(w,F,z),Ge=np(I,$,R);for(let $e=0;$e<me.length-1;$e++){const tt=me[$e],Ct=me[$e+1];for(let Et=0;Et<Ge.length-1;Et++)l.push(Be(tt,Ge[Et],Ct,Ge[Et+1]))}}else l.push(Be({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:f+1},{fixed:0,stretch:g+1}));return l}function cc(i,e,r){let s=0;for(const l of i)s+=Math.max(e,Math.min(r,l[1]))-Math.max(e,Math.min(r,l[0]));return s}function np(i,e,r){const s=[{fixed:-zo,stretch:0}];for(const[l,d]of i){const p=s[s.length-1];s.push({fixed:l-p.stretch,stretch:p.stretch}),s.push({fixed:l-p.stretch,stretch:p.stretch+(d-l)})}return s.push({fixed:e+zo,stretch:r}),s}function hc(i,e,r,s){return i/e*r+s}function uc(i,e,r,s){return i-e*r/s}class dc{constructor(e,r,s,l,d,p,f,g,x,w){var I;if(this.boxStartIndex=e.length,x){let C=p.top,z=p.bottom;const R=p.collisionPadding;R&&(C-=R[1],z+=R[3]);let F=z-C;F>0&&(F=Math.max(10,F),this.circleDiameter=F)}else{const C=!((I=p.image)===null||I===void 0)&&I.content&&(p.image.textFitWidth||p.image.textFitHeight)?kd(p):{x1:p.left,y1:p.top,x2:p.right,y2:p.bottom};C.y1=C.y1*f-g[0],C.y2=C.y2*f+g[2],C.x1=C.x1*f-g[3],C.x2=C.x2*f+g[1];const z=p.collisionPadding;if(z&&(C.x1-=z[0]*f,C.y1-=z[1]*f,C.x2+=z[2]*f,C.y2+=z[3]*f),w){const R=new le(C.x1,C.y1),F=new le(C.x2,C.y1),$=new le(C.x1,C.y2),X=new le(C.x2,C.y2),se=w*Math.PI/180;R._rotate(se),F._rotate(se),$._rotate(se),X._rotate(se),C.x1=Math.min(R.x,F.x,$.x,X.x),C.x2=Math.max(R.x,F.x,$.x,X.x),C.y1=Math.min(R.y,F.y,$.y,X.y),C.y2=Math.max(R.y,F.y,$.y,X.y)}e.emplaceBack(r.x,r.y,C.x1,C.y1,C.x2,C.y2,s,l,d)}this.boxEndIndex=e.length}}class U_{constructor(e=[],r=(s,l)=>s<l?-1:s>l?1:0){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:s}=this,l=r[e];for(;e>0;){const d=e-1>>1,p=r[d];if(s(l,p)>=0)break;r[e]=p,e=d}r[e]=l}_down(e){const{data:r,compare:s}=this,l=this.length>>1,d=r[e];for(;e<l;){let p=1+(e<<1);const f=p+1;if(f<this.length&&s(r[f],r[p])<0&&(p=f),s(r[p],d)>=0)break;r[e]=r[p],e=p}r[e]=d}}function $_(i,e=1,r=!1){let s=1/0,l=1/0,d=-1/0,p=-1/0;const f=i[0];for(let z=0;z<f.length;z++){const R=f[z];(!z||R.x<s)&&(s=R.x),(!z||R.y<l)&&(l=R.y),(!z||R.x>d)&&(d=R.x),(!z||R.y>p)&&(p=R.y)}const g=Math.min(d-s,p-l);let x=g/2;const w=new U_([],q_);if(g===0)return new le(s,l);for(let z=s;z<d;z+=g)for(let R=l;R<p;R+=g)w.push(new Do(z+x,R+x,x,i));let I=function(z){let R=0,F=0,$=0;const X=z[0];for(let se=0,Y=X.length,ie=Y-1;se<Y;ie=se++){const de=X[se],xe=X[ie],Le=de.x*xe.y-xe.x*de.y;F+=(de.x+xe.x)*Le,$+=(de.y+xe.y)*Le,R+=3*Le}return new Do(F/R,$/R,0,z)}(i),C=w.length;for(;w.length;){const z=w.pop();(z.d>I.d||!I.d)&&(I=z,r&&console.log("found best %d after %d probes",Math.round(1e4*z.d)/1e4,C)),z.max-I.d<=e||(x=z.h/2,w.push(new Do(z.p.x-x,z.p.y-x,x,i)),w.push(new Do(z.p.x+x,z.p.y-x,x,i)),w.push(new Do(z.p.x-x,z.p.y+x,x,i)),w.push(new Do(z.p.x+x,z.p.y+x,x,i)),C+=4)}return r&&(console.log(`num probes: ${C}`),console.log(`best distance: ${I.d}`)),I.p}function q_(i,e){return e.max-i.max}function Do(i,e,r,s){this.p=new le(i,e),this.h=r,this.d=function(l,d){let p=!1,f=1/0;for(let g=0;g<d.length;g++){const x=d[g];for(let w=0,I=x.length,C=I-1;w<I;C=w++){const z=x[w],R=x[C];z.y>l.y!=R.y>l.y&&l.x<(R.x-z.x)*(l.y-z.y)/(R.y-z.y)+z.x&&(p=!p),f=Math.min(f,ju(l,z,R))}}return(p?1:-1)*Math.sqrt(f)}(this.p,s),this.max=this.d+this.h*Math.SQRT2}var yi;S.ar=void 0,(yi=S.ar||(S.ar={}))[yi.center=1]="center",yi[yi.left=2]="left",yi[yi.right=3]="right",yi[yi.top=4]="top",yi[yi.bottom=5]="bottom",yi[yi["top-left"]=6]="top-left",yi[yi["top-right"]=7]="top-right",yi[yi["bottom-left"]=8]="bottom-left",yi[yi["bottom-right"]=9]="bottom-right";const Yn=7,kh=Number.POSITIVE_INFINITY;function sp(i,e){return e[1]!==kh?function(r,s,l){let d=0,p=0;switch(s=Math.abs(s),l=Math.abs(l),r){case"top-right":case"top-left":case"top":p=l-Yn;break;case"bottom-right":case"bottom-left":case"bottom":p=-l+Yn}switch(r){case"top-right":case"bottom-right":case"right":d=-s;break;case"top-left":case"bottom-left":case"left":d=s}return[d,p]}(i,e[0],e[1]):function(r,s){let l=0,d=0;s<0&&(s=0);const p=s/Math.SQRT2;switch(r){case"top-right":case"top-left":d=p-Yn;break;case"bottom-right":case"bottom-left":d=-p+Yn;break;case"bottom":d=-s+Yn;break;case"top":d=s-Yn}switch(r){case"top-right":case"bottom-right":l=-p;break;case"top-left":case"bottom-left":l=p;break;case"left":l=s;break;case"right":l=-s}return[l,d]}(i,e[0])}function op(i,e,r){var s;const l=i.layout,d=(s=l.get("text-variable-anchor-offset"))===null||s===void 0?void 0:s.evaluate(e,{},r);if(d){const f=d.values,g=[];for(let x=0;x<f.length;x+=2){const w=g[x]=f[x],I=f[x+1].map(C=>C*ii);w.startsWith("top")?I[1]-=Yn:w.startsWith("bottom")&&(I[1]+=Yn),g[x+1]=I}return new Ni(g)}const p=l.get("text-variable-anchor");if(p){let f;f=i._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[l.get("text-radial-offset").evaluate(e,{},r)*ii,kh]:l.get("text-offset").evaluate(e,{},r).map(x=>x*ii);const g=[];for(const x of p)g.push(x,sp(x,f));return new Ni(g)}return null}function Mh(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 Z_(i,e,r,s,l,d,p,f,g,x,w){let I=d.textMaxSize.evaluate(e,{});I===void 0&&(I=p);const C=i.layers[0].layout,z=C.get("icon-offset").evaluate(e,{},w),R=lp(r.horizontal),F=p/24,$=i.tilePixelRatio*F,X=i.tilePixelRatio*I/24,se=i.tilePixelRatio*f,Y=i.tilePixelRatio*C.get("symbol-spacing"),ie=C.get("text-padding")*i.tilePixelRatio,de=function(me,Ge,$e,tt=1){const Ct=me.get("icon-padding").evaluate(Ge,{},$e),Et=Ct&&Ct.values;return[Et[0]*tt,Et[1]*tt,Et[2]*tt,Et[3]*tt]}(C,e,w,i.tilePixelRatio),xe=C.get("text-max-angle")/180*Math.PI,Le=C.get("text-rotation-alignment")!=="viewport"&&C.get("symbol-placement")!=="point",We=C.get("icon-rotation-alignment")==="map"&&C.get("symbol-placement")!=="point",Me=C.get("symbol-placement"),Ae=Y/2,qe=C.get("icon-text-fit");let Ve;s&&qe!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Ve=Md(s,r.vertical,qe,C.get("icon-text-fit-padding"),z,F)),R&&(s=Md(s,R,qe,C.get("icon-text-fit-padding"),z,F)));const Be=(me,Ge)=>{Ge.x<0||Ge.x>=Qt||Ge.y<0||Ge.y>=Qt||function($e,tt,Ct,Et,si,Sr,xi,Gt,Di,Li,Ri,Ht,oi,Pi,vi,Bi,bi,hr,Zi,_t,Dt,Vt,Ji,Zt,Lo){const en=$e.addToLineVertexArray(tt,Ct);let tn,Tr,ur,li,Sn=0,el=0,dp=0,pp=0,Vh=-1,Nh=-1;const Tn={};let fp=wo("");if($e.allowVerticalPlacement&&Et.vertical){const Ei=Gt.layout.get("text-rotate").evaluate(Dt,{},Zt)+90;ur=new dc(Di,tt,Li,Ri,Ht,Et.vertical,oi,Pi,vi,Ei),xi&&(li=new dc(Di,tt,Li,Ri,Ht,xi,bi,hr,vi,Ei))}if(si){const Ei=Gt.layout.get("icon-rotate").evaluate(Dt,{}),dr=Gt.layout.get("icon-text-fit")!=="none",Rs=rp(si,Ei,Ji,dr),Or=xi?rp(xi,Ei,Ji,dr):void 0;Tr=new dc(Di,tt,Li,Ri,Ht,si,bi,hr,!1,Ei),Sn=4*Rs.length;const Bs=$e.iconSizeData;let rn=null;Bs.kind==="source"?(rn=[Qr*Gt.layout.get("icon-size").evaluate(Dt,{})],rn[0]>Wn&&ci(`${$e.layerIds[0]}: Value for "icon-size" is >= ${Ja}. Reduce your "icon-size".`)):Bs.kind==="composite"&&(rn=[Qr*Vt.compositeIconSizes[0].evaluate(Dt,{},Zt),Qr*Vt.compositeIconSizes[1].evaluate(Dt,{},Zt)],(rn[0]>Wn||rn[1]>Wn)&&ci(`${$e.layerIds[0]}: Value for "icon-size" is >= ${Ja}. Reduce your "icon-size".`)),$e.addSymbols($e.icon,Rs,rn,_t,Zi,Dt,S.ai.none,tt,en.lineStartIndex,en.lineLength,-1,Zt),Vh=$e.icon.placedSymbolArray.length-1,Or&&(el=4*Or.length,$e.addSymbols($e.icon,Or,rn,_t,Zi,Dt,S.ai.vertical,tt,en.lineStartIndex,en.lineLength,-1,Zt),Nh=$e.icon.placedSymbolArray.length-1)}const mp=Object.keys(Et.horizontal);for(const Ei of mp){const dr=Et.horizontal[Ei];if(!tn){fp=wo(dr.text);const Or=Gt.layout.get("text-rotate").evaluate(Dt,{},Zt);tn=new dc(Di,tt,Li,Ri,Ht,dr,oi,Pi,vi,Or)}const Rs=dr.positionedLines.length===1;if(dp+=ap($e,tt,dr,Sr,Gt,vi,Dt,Bi,en,Et.vertical?S.ai.horizontal:S.ai.horizontalOnly,Rs?mp:[Ei],Tn,Vh,Vt,Zt),Rs)break}Et.vertical&&(pp+=ap($e,tt,Et.vertical,Sr,Gt,vi,Dt,Bi,en,S.ai.vertical,["vertical"],Tn,Nh,Vt,Zt));const X_=tn?tn.boxStartIndex:$e.collisionBoxArray.length,W_=tn?tn.boxEndIndex:$e.collisionBoxArray.length,J_=ur?ur.boxStartIndex:$e.collisionBoxArray.length,K_=ur?ur.boxEndIndex:$e.collisionBoxArray.length,Y_=Tr?Tr.boxStartIndex:$e.collisionBoxArray.length,Q_=Tr?Tr.boxEndIndex:$e.collisionBoxArray.length,ey=li?li.boxStartIndex:$e.collisionBoxArray.length,ty=li?li.boxEndIndex:$e.collisionBoxArray.length;let Fr=-1;const fc=(Ei,dr)=>Ei&&Ei.circleDiameter?Math.max(Ei.circleDiameter,dr):dr;Fr=fc(tn,Fr),Fr=fc(ur,Fr),Fr=fc(Tr,Fr),Fr=fc(li,Fr);const gp=Fr>-1?1:0;gp&&(Fr*=Lo/ii),$e.glyphOffsetArray.length>=Mo.MAX_GLYPHS&&ci("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Dt.sortKey!==void 0&&$e.addToSortKeyRanges($e.symbolInstances.length,Dt.sortKey);const iy=op(Gt,Dt,Zt),[ry,ny]=function(Ei,dr){const Rs=Ei.length,Or=dr==null?void 0:dr.values;if((Or==null?void 0:Or.length)>0)for(let Bs=0;Bs<Or.length;Bs+=2){const rn=Or[Bs+1];Ei.emplaceBack(S.ar[Or[Bs]],rn[0],rn[1])}return[Rs,Ei.length]}($e.textAnchorOffsets,iy);$e.symbolInstances.emplaceBack(tt.x,tt.y,Tn.right>=0?Tn.right:-1,Tn.center>=0?Tn.center:-1,Tn.left>=0?Tn.left:-1,Tn.vertical||-1,Vh,Nh,fp,X_,W_,J_,K_,Y_,Q_,ey,ty,Li,dp,pp,Sn,el,gp,0,oi,Fr,ry,ny)}(i,Ge,me,r,s,l,Ve,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,$,[ie,ie,ie,ie],Le,g,se,de,We,z,e,d,x,w,p)};if(Me==="line")for(const me of Kd(e.geometry,0,0,Qt,Qt)){const Ge=j_(me,Y,xe,r.vertical||R,s,24,X,i.overscaling,Qt);for(const $e of Ge)R&&G_(i,R.text,Ae,$e)||Be(me,$e)}else if(Me==="line-center"){for(const me of e.geometry)if(me.length>1){const Ge=N_(me,xe,r.vertical||R,s,24,X);Ge&&Be(me,Ge)}}else if(e.type==="Polygon")for(const me of Ys(e.geometry,0)){const Ge=$_(me,16);Be(me[0],new Kn(Ge.x,Ge.y,0))}else if(e.type==="LineString")for(const me of e.geometry)Be(me,new Kn(me[0].x,me[0].y,0));else if(e.type==="Point")for(const me of e.geometry)for(const Ge of me)Be([Ge],new Kn(Ge.x,Ge.y,0))}function ap(i,e,r,s,l,d,p,f,g,x,w,I,C,z,R){const F=function(se,Y,ie,de,xe,Le,We,Me){const Ae=de.layout.get("text-rotate").evaluate(Le,{})*Math.PI/180,qe=[];for(const Ve of Y.positionedLines)for(const Be of Ve.positionedGlyphs){if(!Be.rect)continue;const me=Be.rect||{};let Ge=Sd+1,$e=!0,tt=1,Ct=0;const Et=(xe||Me)&&Be.vertical,si=Be.metrics.advance*Be.scale/2;if(Me&&Y.verticalizable&&(Ct=Ve.lineOffset/2-(Be.imageName?-(ii-Be.metrics.width*Be.scale)/2:(Be.scale-1)*ii)),Be.imageName){const _t=We[Be.imageName];$e=_t.sdf,tt=_t.pixelRatio,Ge=qi/tt}const Sr=xe?[Be.x+si,Be.y]:[0,0];let xi=xe?[0,0]:[Be.x+si+ie[0],Be.y+ie[1]-Ct],Gt=[0,0];Et&&(Gt=xi,xi=[0,0]);const Di=Be.metrics.isDoubleResolution?2:1,Li=(Be.metrics.left-Ge)*Be.scale-si+xi[0],Ri=(-Be.metrics.top-Ge)*Be.scale+xi[1],Ht=Li+me.w/Di*Be.scale/tt,oi=Ri+me.h/Di*Be.scale/tt,Pi=new le(Li,Ri),vi=new le(Ht,Ri),Bi=new le(Li,oi),bi=new le(Ht,oi);if(Et){const _t=new le(-si,si-Xa),Dt=-Math.PI/2,Vt=ii/2-si,Ji=new le(5-Xa-Vt,-(Be.imageName?Vt:0)),Zt=new le(...Gt);Pi._rotateAround(Dt,_t)._add(Ji)._add(Zt),vi._rotateAround(Dt,_t)._add(Ji)._add(Zt),Bi._rotateAround(Dt,_t)._add(Ji)._add(Zt),bi._rotateAround(Dt,_t)._add(Ji)._add(Zt)}if(Ae){const _t=Math.sin(Ae),Dt=Math.cos(Ae),Vt=[Dt,-_t,_t,Dt];Pi._matMult(Vt),vi._matMult(Vt),Bi._matMult(Vt),bi._matMult(Vt)}const hr=new le(0,0),Zi=new le(0,0);qe.push({tl:Pi,tr:vi,bl:Bi,br:bi,tex:me,writingMode:Y.writingMode,glyphOffset:Sr,sectionIndex:Be.sectionIndex,isSDF:$e,pixelOffsetTL:hr,pixelOffsetBR:Zi,minFontScaleX:0,minFontScaleY:0})}return qe}(0,r,f,l,d,p,s,i.allowVerticalPlacement),$=i.textSizeData;let X=null;$.kind==="source"?(X=[Qr*l.layout.get("text-size").evaluate(p,{})],X[0]>Wn&&ci(`${i.layerIds[0]}: Value for "text-size" is >= ${Ja}. Reduce your "text-size".`)):$.kind==="composite"&&(X=[Qr*z.compositeTextSizes[0].evaluate(p,{},R),Qr*z.compositeTextSizes[1].evaluate(p,{},R)],(X[0]>Wn||X[1]>Wn)&&ci(`${i.layerIds[0]}: Value for "text-size" is >= ${Ja}. Reduce your "text-size".`)),i.addSymbols(i.text,F,X,f,d,p,x,e,g.lineStartIndex,g.lineLength,C,R);for(const se of w)I[se]=i.text.placedSymbolArray.length-1;return 4*F.length}function lp(i){for(const e in i)return i[e];return null}function G_(i,e,r,s){const l=i.compareText;if(e in l){const d=l[e];for(let p=d.length-1;p>=0;p--)if(s.dist(d[p])<r)return!0}else l[e]=[];return l[e].push(s),!1}const cp=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class zh{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[r,s]=new Uint8Array(e,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");const l=s>>4;if(l!==1)throw new Error(`Got v${l} data when expected v1.`);const d=cp[15&s];if(!d)throw new Error("Unrecognized array type.");const[p]=new Uint16Array(e,2,1),[f]=new Uint32Array(e,4,1);return new zh(f,p,d,e)}constructor(e,r=64,s=Float64Array,l){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=s,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const d=cp.indexOf(this.ArrayType),p=2*e*this.ArrayType.BYTES_PER_ELEMENT,f=e*this.IndexArrayType.BYTES_PER_ELEMENT,g=(8-f%8)%8;if(d<0)throw new Error(`Unexpected typed array class: ${s}.`);l&&l instanceof ArrayBuffer?(this.data=l,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+g,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+p+f+g),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+g,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+d]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=e)}add(e,r){const s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=e,this.coords[this._pos++]=r,s}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Dh(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,s,l){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:d,coords:p,nodeSize:f}=this,g=[0,d.length-1,0],x=[];for(;g.length;){const w=g.pop()||0,I=g.pop()||0,C=g.pop()||0;if(I-C<=f){for(let $=C;$<=I;$++){const X=p[2*$],se=p[2*$+1];X>=e&&X<=s&&se>=r&&se<=l&&x.push(d[$])}continue}const z=C+I>>1,R=p[2*z],F=p[2*z+1];R>=e&&R<=s&&F>=r&&F<=l&&x.push(d[z]),(w===0?e<=R:r<=F)&&(g.push(C),g.push(z-1),g.push(1-w)),(w===0?s>=R:l>=F)&&(g.push(z+1),g.push(I),g.push(1-w))}return x}within(e,r,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:d,nodeSize:p}=this,f=[0,l.length-1,0],g=[],x=s*s;for(;f.length;){const w=f.pop()||0,I=f.pop()||0,C=f.pop()||0;if(I-C<=p){for(let $=C;$<=I;$++)up(d[2*$],d[2*$+1],e,r)<=x&&g.push(l[$]);continue}const z=C+I>>1,R=d[2*z],F=d[2*z+1];up(R,F,e,r)<=x&&g.push(l[z]),(w===0?e-s<=R:r-s<=F)&&(f.push(C),f.push(z-1),f.push(1-w)),(w===0?e+s>=R:r+s>=F)&&(f.push(z+1),f.push(I),f.push(1-w))}return g}}function Dh(i,e,r,s,l,d){if(l-s<=r)return;const p=s+l>>1;hp(i,e,p,s,l,d),Dh(i,e,r,s,p-1,1-d),Dh(i,e,r,p+1,l,1-d)}function hp(i,e,r,s,l,d){for(;l>s;){if(l-s>600){const x=l-s+1,w=r-s+1,I=Math.log(x),C=.5*Math.exp(2*I/3),z=.5*Math.sqrt(I*C*(x-C)/x)*(w-x/2<0?-1:1);hp(i,e,r,Math.max(s,Math.floor(r-w*C/x+z)),Math.min(l,Math.floor(r+(x-w)*C/x+z)),d)}const p=e[2*r+d];let f=s,g=l;for(Ya(i,e,s,r),e[2*l+d]>p&&Ya(i,e,s,l);f<g;){for(Ya(i,e,f,g),f++,g--;e[2*f+d]<p;)f++;for(;e[2*g+d]>p;)g--}e[2*s+d]===p?Ya(i,e,s,g):(g++,Ya(i,e,g,l)),g<=r&&(s=g+1),r<=g&&(l=g-1)}}function Ya(i,e,r,s){Lh(i,r,s),Lh(e,2*r,2*s),Lh(e,2*r+1,2*s+1)}function Lh(i,e,r){const s=i[e];i[e]=i[r],i[r]=s}function up(i,e,r,s){const l=i-r,d=e-s;return l*l+d*d}var Rh;S.bf=void 0,(Rh=S.bf||(S.bf={})).create="create",Rh.load="load",Rh.fullLoad="fullLoad";let pc=null,Qa=[];const Bh=1e3/60,Fh="loadTime",Oh="fullLoadTime",H_={mark(i){performance.mark(i)},frame(i){const e=i;pc!=null&&Qa.push(e-pc),pc=e},clearMetrics(){pc=null,Qa=[],performance.clearMeasures(Fh),performance.clearMeasures(Oh);for(const i in S.bf)performance.clearMarks(S.bf[i])},getPerformanceMetrics(){performance.measure(Fh,S.bf.create,S.bf.load),performance.measure(Oh,S.bf.create,S.bf.fullLoad);const i=performance.getEntriesByName(Fh)[0].duration,e=performance.getEntriesByName(Oh)[0].duration,r=Qa.length,s=1/(Qa.reduce((d,p)=>d+p,0)/r/1e3),l=Qa.filter(d=>d>Bh).reduce((d,p)=>d+(p-Bh)/Bh,0);return{loadTime:i,fullLoadTime:e,fps:s,percentDroppedFrames:l/(r+l)*100,totalFrames:r}}};S.$=class extends B{},S.A=Io,S.B=Pa,S.C=function(i){if(Pn==null){const e=i.navigator?i.navigator.userAgent:null;Pn=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Pn},S.D=Ze,S.E=An,S.F=class{constructor(i,e){this.target=i,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new O_(()=>this.process()),this.subscription=function(r,s,l,d){return r.addEventListener(s,l,!1),{unsubscribe:()=>{r.removeEventListener(s,l,!1)}}}(this.target,"message",r=>this.receive(r)),this.globalScope=Er(self)?i:window}registerMessageHandler(i,e){this.messageHandlers[i]=e}sendAsync(i,e){return new Promise((r,s)=>{const l=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[l]={resolve:r,reject:s},e&&e.signal.addEventListener("abort",()=>{delete this.resolveRejects[l];const f={id:l,type:"<cancel>",origin:location.origin,targetMapId:i.targetMapId,sourceMapId:this.mapId};this.target.postMessage(f)},{once:!0});const d=[],p=Object.assign(Object.assign({},i),{id:l,sourceMapId:this.mapId,origin:location.origin,data:Cs(i.data,d)});this.target.postMessage(p,{transfer:d})})}receive(i){const e=i.data,r=e.id;if(!(e.origin!=="file://"&&location.origin!=="file://"&&e.origin!=="resource://android"&&location.origin!=="resource://android"&&e.origin!==location.origin||e.targetMapId&&this.mapId!==e.targetMapId)){if(e.type==="<cancel>"){delete this.tasks[r];const s=this.abortControllers[r];return delete this.abortControllers[r],void(s&&s.abort())}if(Er(self)||e.mustQueue)return this.tasks[r]=e,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,e)}}process(){if(this.taskQueue.length===0)return;const i=this.taskQueue.shift(),e=this.tasks[i];delete this.tasks[i],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(i,e)}processTask(i,e){return c(this,void 0,void 0,function*(){if(e.type==="<response>"){const l=this.resolveRejects[i];return delete this.resolveRejects[i],l?void(e.error?l.reject(br(e.error)):l.resolve(br(e.data))):void 0}if(!this.messageHandlers[e.type])return void this.completeTask(i,new Error(`Could not find a registered handler for ${e.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const r=br(e.data),s=new AbortController;this.abortControllers[i]=s;try{const l=yield this.messageHandlers[e.type](e.sourceMapId,r,s);this.completeTask(i,null,l)}catch(l){this.completeTask(i,l)}})}completeTask(i,e,r){const s=[];delete this.abortControllers[i];const l={id:i,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?Cs(e):null,data:Cs(r,s)};this.target.postMessage(l,{transfer:s})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},S.G=Cn,S.H=function(){var i=new Io(16);return Io!=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},S.I=xh,S.J=function(i,e,r){var s,l,d,p,f,g,x,w,I,C,z,R,F=r[0],$=r[1],X=r[2];return e===i?(i[12]=e[0]*F+e[4]*$+e[8]*X+e[12],i[13]=e[1]*F+e[5]*$+e[9]*X+e[13],i[14]=e[2]*F+e[6]*$+e[10]*X+e[14],i[15]=e[3]*F+e[7]*$+e[11]*X+e[15]):(l=e[1],d=e[2],p=e[3],f=e[4],g=e[5],x=e[6],w=e[7],I=e[8],C=e[9],z=e[10],R=e[11],i[0]=s=e[0],i[1]=l,i[2]=d,i[3]=p,i[4]=f,i[5]=g,i[6]=x,i[7]=w,i[8]=I,i[9]=C,i[10]=z,i[11]=R,i[12]=s*F+f*$+I*X+e[12],i[13]=l*F+g*$+C*X+e[13],i[14]=d*F+x*$+z*X+e[14],i[15]=p*F+w*$+R*X+e[15]),i},S.K=function(i,e,r){var s=r[0],l=r[1],d=r[2];return i[0]=e[0]*s,i[1]=e[1]*s,i[2]=e[2]*s,i[3]=e[3]*s,i[4]=e[4]*l,i[5]=e[5]*l,i[6]=e[6]*l,i[7]=e[7]*l,i[8]=e[8]*d,i[9]=e[9]*d,i[10]=e[10]*d,i[11]=e[11]*d,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},S.L=Zu,S.M=function(i,e){const r={};for(let s=0;s<e.length;s++){const l=e[s];l in i&&(r[l]=i[l])}return r},S.N=Jn,S.O=Nd,S.P=le,S.Q=jd,S.R=lr,S.S=cr,S.T=jn,S.U=ht,S.V=Ye,S.W=sn,S.X=Qt,S.Y=b,S.Z=lc,S._=c,S.a=Vr,S.a$=function(i,e){var r=i[0],s=i[1],l=i[2],d=i[3],p=i[4],f=i[5],g=i[6],x=i[7],w=i[8],I=i[9],C=i[10],z=i[11],R=i[12],F=i[13],$=i[14],X=i[15],se=e[0],Y=e[1],ie=e[2],de=e[3],xe=e[4],Le=e[5],We=e[6],Me=e[7],Ae=e[8],qe=e[9],Ve=e[10],Be=e[11],me=e[12],Ge=e[13],$e=e[14],tt=e[15];return Math.abs(r-se)<=zi*Math.max(1,Math.abs(r),Math.abs(se))&&Math.abs(s-Y)<=zi*Math.max(1,Math.abs(s),Math.abs(Y))&&Math.abs(l-ie)<=zi*Math.max(1,Math.abs(l),Math.abs(ie))&&Math.abs(d-de)<=zi*Math.max(1,Math.abs(d),Math.abs(de))&&Math.abs(p-xe)<=zi*Math.max(1,Math.abs(p),Math.abs(xe))&&Math.abs(f-Le)<=zi*Math.max(1,Math.abs(f),Math.abs(Le))&&Math.abs(g-We)<=zi*Math.max(1,Math.abs(g),Math.abs(We))&&Math.abs(x-Me)<=zi*Math.max(1,Math.abs(x),Math.abs(Me))&&Math.abs(w-Ae)<=zi*Math.max(1,Math.abs(w),Math.abs(Ae))&&Math.abs(I-qe)<=zi*Math.max(1,Math.abs(I),Math.abs(qe))&&Math.abs(C-Ve)<=zi*Math.max(1,Math.abs(C),Math.abs(Ve))&&Math.abs(z-Be)<=zi*Math.max(1,Math.abs(z),Math.abs(Be))&&Math.abs(R-me)<=zi*Math.max(1,Math.abs(R),Math.abs(me))&&Math.abs(F-Ge)<=zi*Math.max(1,Math.abs(F),Math.abs(Ge))&&Math.abs($-$e)<=zi*Math.max(1,Math.abs($),Math.abs($e))&&Math.abs(X-tt)<=zi*Math.max(1,Math.abs(X),Math.abs(tt))},S.a0=ti,S.a1=Ah,S.a2=Ie,S.a3=i=>{const e=window.document.createElement("video");return e.muted=!0,new Promise(r=>{e.onloadstart=()=>{r(e)};for(const s of i){const l=window.document.createElement("source");an(s)||(e.crossOrigin="Anonymous"),l.src=s,e.appendChild(l)}})},S.a4=function(){return Yi++},S.a5=ot,S.a6=Mo,S.a7=Ti,S.a8=Ds,S.a9=zt,S.aA=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]=rs(i[r],e[i[r].ref]));return i},S.aB=function(i){if(i.type==="custom")return new F_(i);switch(i.type){case"background":return new L_(i);case"circle":return new bg(i);case"fill":return new Og(i);case"fill-extrusion":return new Qg(i);case"heatmap":return new Sg(i);case"hillshade":return new Ig(i);case"line":return new a_(i);case"raster":return new B_(i);case"symbol":return new ac(i)}},S.aC=wt,S.aD=function(i,e){if(!i)return[{command:"setStyle",args:[e]}];let r=[];try{if(!xt(i.version,e.version))return[{command:"setStyle",args:[e]}];xt(i.center,e.center)||r.push({command:"setCenter",args:[e.center]}),xt(i.zoom,e.zoom)||r.push({command:"setZoom",args:[e.zoom]}),xt(i.bearing,e.bearing)||r.push({command:"setBearing",args:[e.bearing]}),xt(i.pitch,e.pitch)||r.push({command:"setPitch",args:[e.pitch]}),xt(i.sprite,e.sprite)||r.push({command:"setSprite",args:[e.sprite]}),xt(i.glyphs,e.glyphs)||r.push({command:"setGlyphs",args:[e.glyphs]}),xt(i.transition,e.transition)||r.push({command:"setTransition",args:[e.transition]}),xt(i.light,e.light)||r.push({command:"setLight",args:[e.light]}),xt(i.terrain,e.terrain)||r.push({command:"setTerrain",args:[e.terrain]}),xt(i.sky,e.sky)||r.push({command:"setSky",args:[e.sky]}),xt(i.projection,e.projection)||r.push({command:"setProjection",args:[e.projection]});const s={},l=[];(function(p,f,g,x){let w;for(w in f=f||{},p=p||{})Object.prototype.hasOwnProperty.call(p,w)&&(Object.prototype.hasOwnProperty.call(f,w)||Ur(w,g,x));for(w in f)Object.prototype.hasOwnProperty.call(f,w)&&(Object.prototype.hasOwnProperty.call(p,w)?xt(p[w],f[w])||(p[w].type==="geojson"&&f[w].type==="geojson"&&kn(p,f,w)?$t(g,{command:"setGeoJSONSourceData",args:[w,f[w].data]}):kr(w,f,g,x)):ns(w,f,g))})(i.sources,e.sources,l,s);const d=[];i.layers&&i.layers.forEach(p=>{"source"in p&&s[p.source]?r.push({command:"removeLayer",args:[p.id]}):d.push(p)}),r=r.concat(l),function(p,f,g){f=f||[];const x=(p=p||[]).map(ss),w=f.map(ss),I=p.reduce(os,{}),C=f.reduce(os,{}),z=x.slice(),R=Object.create(null);let F,$,X,se,Y;for(let ie=0,de=0;ie<x.length;ie++)F=x[ie],Object.prototype.hasOwnProperty.call(C,F)?de++:($t(g,{command:"removeLayer",args:[F]}),z.splice(z.indexOf(F,de),1));for(let ie=0,de=0;ie<w.length;ie++)F=w[w.length-1-ie],z[z.length-1-ie]!==F&&(Object.prototype.hasOwnProperty.call(I,F)?($t(g,{command:"removeLayer",args:[F]}),z.splice(z.lastIndexOf(F,z.length-de),1)):de++,se=z[z.length-ie],$t(g,{command:"addLayer",args:[C[F],se]}),z.splice(z.length-ie,0,F),R[F]=!0);for(let ie=0;ie<w.length;ie++)if(F=w[ie],$=I[F],X=C[F],!R[F]&&!xt($,X))if(xt($.source,X.source)&&xt($["source-layer"],X["source-layer"])&&xt($.type,X.type)){for(Y in Hi($.layout,X.layout,g,F,null,"setLayoutProperty"),Hi($.paint,X.paint,g,F,null,"setPaintProperty"),xt($.filter,X.filter)||$t(g,{command:"setFilter",args:[F,X.filter]}),xt($.minzoom,X.minzoom)&&xt($.maxzoom,X.maxzoom)||$t(g,{command:"setLayerZoomRange",args:[F,X.minzoom,X.maxzoom]}),$)Object.prototype.hasOwnProperty.call($,Y)&&Y!=="layout"&&Y!=="paint"&&Y!=="filter"&&Y!=="metadata"&&Y!=="minzoom"&&Y!=="maxzoom"&&(Y.indexOf("paint.")===0?Hi($[Y],X[Y],g,F,Y.slice(6),"setPaintProperty"):xt($[Y],X[Y])||$t(g,{command:"setLayerProperty",args:[F,Y,X[Y]]}));for(Y in X)Object.prototype.hasOwnProperty.call(X,Y)&&!Object.prototype.hasOwnProperty.call($,Y)&&Y!=="layout"&&Y!=="paint"&&Y!=="filter"&&Y!=="metadata"&&Y!=="minzoom"&&Y!=="maxzoom"&&(Y.indexOf("paint.")===0?Hi($[Y],X[Y],g,F,Y.slice(6),"setPaintProperty"):xt($[Y],X[Y])||$t(g,{command:"setLayerProperty",args:[F,Y,X[Y]]}))}else $t(g,{command:"removeLayer",args:[F]}),se=z[z.lastIndexOf(F)+1],$t(g,{command:"addLayer",args:[X,se]})}(d,e.layers,r)}catch(s){console.warn("Unable to compute style diff:",s),r=[{command:"setStyle",args:[e]}]}return r},S.aE=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},S.aF=function i(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(let s=0;s<e.length;s++)if(!i(e[s],r[s]))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 s in e)if(!i(e[s],r[s]))return!1;return!0}return e===r},S.aG=ri,S.aH=Qi,S.aI=class extends ks{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},S.aJ=Xl,S.aK=class extends ks{constructor(i,e){super(i,e),this.current=pg}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}}},S.aL=Lu,S.aM=Ru,S.aN=Tt,S.aO=class extends ks{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]))}},S.aP=class extends ks{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]))}},S.aQ=function(i,e,r,s,l,d,p){var f=1/(e-r),g=1/(s-l),x=1/(d-p);return i[0]=-2*f,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*g,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*x,i[11]=0,i[12]=(e+r)*f,i[13]=(l+s)*g,i[14]=(p+d)*x,i[15]=1,i},S.aR=vg,S.aS=class extends ge{},S.aT=u_,S.aU=class extends De{},S.aV=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},S.aW=Ju,S.aX=xn,S.aY=ni,S.aZ=class extends ke{},S.a_=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]},S.aa=Hd,S.ab=function(i){const e={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,s,l,d)=>{const p=l||d;return e[s]=!p||p.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e},S.ac=function(i,e){const r=[];for(const s in i)s in e||r.push(s);return r},S.ad=yt,S.ae=function(i,e,r){var s=Math.sin(r),l=Math.cos(r),d=e[0],p=e[1],f=e[2],g=e[3],x=e[4],w=e[5],I=e[6],C=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]=d*l+x*s,i[1]=p*l+w*s,i[2]=f*l+I*s,i[3]=g*l+C*s,i[4]=x*l-d*s,i[5]=w*l-p*s,i[6]=I*l-f*s,i[7]=C*l-g*s,i},S.af=function(i){var e=new Io(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},S.ag=Yl,S.ah=function(i,e){let r=0,s=0;if(i.kind==="constant")s=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:l,minZoom:d,maxZoom:p}=i,f=l?yt(Ui.interpolationFactor(l,e,d,p),0,1):0;i.kind==="camera"?s=ji.number(i.minSize,i.maxSize,f):r=f}return{uSizeT:r,uSize:s}},S.aj=function(i,{uSize:e,uSizeT:r},{lowerSize:s,upperSize:l}){return i.kind==="source"?s/Qr:i.kind==="composite"?ji.number(s/Qr,l/Qr,r):e},S.ak=Sh,S.al=function(i,e,r,s){const l=e.y-i.y,d=e.x-i.x,p=s.y-r.y,f=s.x-r.x,g=p*d-f*l;if(g===0)return null;const x=(f*(i.y-r.y)-p*(i.x-r.x))/g;return new le(i.x+x*d,i.y+x*l)},S.am=Kd,S.an=Vu,S.ao=sh,S.ap=function(i){let e=1/0,r=1/0,s=-1/0,l=-1/0;for(const d of i)e=Math.min(e,d.x),r=Math.min(r,d.y),s=Math.max(s,d.x),l=Math.max(l,d.y);return[e,r,s,l]},S.aq=ii,S.as=wh,S.at=function(i,e){var r=e[0],s=e[1],l=e[2],d=e[3],p=e[4],f=e[5],g=e[6],x=e[7],w=e[8],I=e[9],C=e[10],z=e[11],R=e[12],F=e[13],$=e[14],X=e[15],se=r*f-s*p,Y=r*g-l*p,ie=r*x-d*p,de=s*g-l*f,xe=s*x-d*f,Le=l*x-d*g,We=w*F-I*R,Me=w*$-C*R,Ae=w*X-z*R,qe=I*$-C*F,Ve=I*X-z*F,Be=C*X-z*$,me=se*Be-Y*Ve+ie*qe+de*Ae-xe*Me+Le*We;return me?(i[0]=(f*Be-g*Ve+x*qe)*(me=1/me),i[1]=(l*Ve-s*Be-d*qe)*me,i[2]=(F*Le-$*xe+X*de)*me,i[3]=(C*xe-I*Le-z*de)*me,i[4]=(g*Ae-p*Be-x*Me)*me,i[5]=(r*Be-l*Ae+d*Me)*me,i[6]=($*ie-R*Le-X*Y)*me,i[7]=(w*Le-C*ie+z*Y)*me,i[8]=(p*Ve-f*Ae+x*We)*me,i[9]=(s*Ae-r*Ve-d*We)*me,i[10]=(R*xe-F*ie+X*se)*me,i[11]=(I*ie-w*xe-z*se)*me,i[12]=(f*Me-p*qe-g*We)*me,i[13]=(r*qe-s*Me+l*We)*me,i[14]=(F*Y-R*de-$*se)*me,i[15]=(w*de-I*Y+C*se)*me,i):null},S.au=Mh,S.av=bh,S.aw=zh,S.ax=function(){const i={},e=ue.$version;for(const r in ue.$root){const s=ue.$root[r];if(s.required){let l=null;l=r==="version"?e:s.type==="array"?[]:{},l!=null&&(i[r]=l)}}return i},S.ay=Nl,S.az=tr,S.b=pr,S.b0=function(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},S.b1=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},S.b2=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},S.b3=At,S.b4=qd,S.b5=Ud,S.b6=function(i,e,r,s,l){var d,p=1/Math.tan(e/2);return i[0]=p/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=p,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,l!=null&&l!==1/0?(i[10]=(l+s)*(d=1/(s-l)),i[14]=2*l*s*d):(i[10]=-1,i[14]=-2*s),i},S.b7=function(i,e,r){var s=Math.sin(r),l=Math.cos(r),d=e[4],p=e[5],f=e[6],g=e[7],x=e[8],w=e[9],I=e[10],C=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]=d*l+x*s,i[5]=p*l+w*s,i[6]=f*l+I*s,i[7]=g*l+C*s,i[8]=x*l-d*s,i[9]=w*l-p*s,i[10]=I*l-f*s,i[11]=C*l-g*s,i},S.b8=Ue,S.b9=bt,S.bA=function(i){return i.message===er},S.bB=gn,S.bC=Jr,S.ba=function(i){return i*Math.PI/180},S.bb=function(i,e){return i[0]=e[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=e[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=e[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},S.bc=class extends L{},S.bd=Eh,S.be=H_,S.bg=Fi,S.bh=function(i,e){Vr.REGISTERED_PROTOCOLS[i]=e},S.bi=function(i){delete Vr.REGISTERED_PROTOCOLS[i]},S.bj=function(i,e){const r={};for(let l=0;l<i.length;l++){const d=e&&e[i[l].id]||fa(i[l]);e&&(e[i[l].id]=d);let p=r[d];p||(p=r[d]=[]),p.push(i[l])}const s=[];for(const l in r)s.push(r[l]);return s},S.bk=Oe,S.bl=Gd,S.bm=Xd,S.bn=Id,S.bo=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=Qt/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const e=i.bucket.layers[0],r=e.layout,s=e._unevaluatedLayout._values,l={layoutIconSize:s["icon-size"].possiblyEvaluate(new zt(i.bucket.zoom+1),i.canonical),layoutTextSize:s["text-size"].possiblyEvaluate(new zt(i.bucket.zoom+1),i.canonical),textMaxSize:s["text-size"].possiblyEvaluate(new zt(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:x,maxZoom:w}=i.bucket.textSizeData;l.compositeTextSizes=[s["text-size"].possiblyEvaluate(new zt(x),i.canonical),s["text-size"].possiblyEvaluate(new zt(w),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:x,maxZoom:w}=i.bucket.iconSizeData;l.compositeIconSizes=[s["icon-size"].possiblyEvaluate(new zt(x),i.canonical),s["icon-size"].possiblyEvaluate(new zt(w),i.canonical)]}const d=r.get("text-line-height")*ii,p=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",f=r.get("text-keep-upright"),g=r.get("text-size");for(const x of i.bucket.features){const w=r.get("text-font").evaluate(x,{},i.canonical).join(","),I=g.evaluate(x,{},i.canonical),C=l.layoutTextSize.evaluate(x,{},i.canonical),z=l.layoutIconSize.evaluate(x,{},i.canonical),R={horizontal:{},vertical:void 0},F=x.text;let $,X=[0,0];if(F){const ie=F.toString(),de=r.get("text-letter-spacing").evaluate(x,{},i.canonical)*ii,xe=Yc(ie)?de:0,Le=r.get("text-anchor").evaluate(x,{},i.canonical),We=op(e,x,i.canonical);if(!We){const Ve=r.get("text-radial-offset").evaluate(x,{},i.canonical);X=Ve?sp(Le,[Ve*ii,kh]):r.get("text-offset").evaluate(x,{},i.canonical).map(Be=>Be*ii)}let Me=p?"center":r.get("text-justify").evaluate(x,{},i.canonical);const Ae=r.get("symbol-placement")==="point"?r.get("text-max-width").evaluate(x,{},i.canonical)*ii:1/0,qe=()=>{i.bucket.allowVerticalPlacement&&Aa(ie)&&(R.vertical=nc(F,i.glyphMap,i.glyphPositions,i.imagePositions,w,Ae,d,Le,"left",xe,X,S.ai.vertical,!0,C,I))};if(!p&&We){const Ve=new Set;if(Me==="auto")for(let me=0;me<We.values.length;me+=2)Ve.add(Mh(We.values[me]));else Ve.add(Me);let Be=!1;for(const me of Ve)if(!R.horizontal[me])if(Be)R.horizontal[me]=R.horizontal[0];else{const Ge=nc(F,i.glyphMap,i.glyphPositions,i.imagePositions,w,Ae,d,"center",me,xe,X,S.ai.horizontal,!1,C,I);Ge&&(R.horizontal[me]=Ge,Be=Ge.positionedLines.length===1)}qe()}else{Me==="auto"&&(Me=Mh(Le));const Ve=nc(F,i.glyphMap,i.glyphPositions,i.imagePositions,w,Ae,d,Le,Me,xe,X,S.ai.horizontal,!1,C,I);Ve&&(R.horizontal[Me]=Ve),qe(),Aa(ie)&&p&&f&&(R.vertical=nc(F,i.glyphMap,i.glyphPositions,i.imagePositions,w,Ae,d,Le,Me,xe,X,S.ai.vertical,!1,C,I))}}let se=!1;if(x.icon&&x.icon.name){const ie=i.imageMap[x.icon.name];ie&&($=A_(i.imagePositions[x.icon.name],r.get("icon-offset").evaluate(x,{},i.canonical),r.get("icon-anchor").evaluate(x,{},i.canonical)),se=!!ie.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=se:i.bucket.sdfIcons!==se&&ci("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(ie.pixelRatio!==i.bucket.pixelRatio||r.get("icon-rotate").constantOr(1)!==0)&&(i.bucket.iconsNeedLinear=!0))}const Y=lp(R.horizontal)||R.vertical;i.bucket.iconsInText=!!Y&&Y.iconsInText,(Y||$)&&Z_(i.bucket,x,R,$,i.imageMap,l,C,z,X,se,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},S.bp=mh,S.bq=dh,S.br=fh,S.bs=Hn,S.bt=_h,S.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}},S.bv=function(i,e,r,s,l){return c(this,void 0,void 0,function*(){if(Ye())try{return yield sn(i,e,r,s,l)}catch{}return function(d,p,f,g,x){const w=d.width,I=d.height;Cr&&Ci||(Cr=new OffscreenCanvas(w,I),Ci=Cr.getContext("2d",{willReadFrequently:!0})),Cr.width=w,Cr.height=I,Ci.drawImage(d,0,0,w,I);const C=Ci.getImageData(p,f,g,x);return Ci.clearRect(0,0,w,I),C.data}(i,e,r,s,l)})},S.bw=Zd,S.bx=ve,S.by=ye,S.bz=gd,S.c=En,S.d=i=>c(void 0,void 0,void 0,function*(){if(i.byteLength===0)return createImageBitmap(new ImageData(1,1));const e=new Blob([new Uint8Array(i)],{type:"image/png"});try{return createImageBitmap(e)}catch(r){throw new Error(`Could not load image because of ${r.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),S.e=It,S.f=i=>new Promise((e,r)=>{const s=new Image;s.onload=()=>{e(s),URL.revokeObjectURL(s.src),s.onload=null,window.requestAnimationFrame(()=>{s.src=Ns})},s.onerror=()=>r(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const l=new Blob([new Uint8Array(i)],{type:"image/png"});s.src=i.byteLength?URL.createObjectURL(l):Ns}),S.g=fr,S.h=(i,e)=>on(It(i,{type:"json"}),e),S.i=Er,S.j=jr,S.k=Nr,S.l=(i,e)=>on(It(i,{type:"arrayBuffer"}),e),S.m=on,S.n=function(i){return new _h(i).readFields(w_,[])},S.o=ja,S.p=Td,S.q=o,S.r=Wc,S.s=an,S.t=Ea,S.u=ze,S.v=ue,S.w=ci,S.x=Rr,S.y=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)}},S.z=ji}),N("worker",["./shared"],function(S){class c{constructor(k){this.keyCache={},k&&this.replace(k)}replace(k){this._layerConfigs={},this._layers={},this.update(k,[])}update(k,A){for(const q of k){this._layerConfigs[q.id]=q;const Q=this._layers[q.id]=S.aB(q);Q._featureFilter=S.a7(Q.filter),this.keyCache[q.id]&&delete this.keyCache[q.id]}for(const q of A)delete this.keyCache[q],delete this._layerConfigs[q],delete this._layers[q];this.familiesBySource={};const O=S.bj(Object.values(this._layerConfigs),this.keyCache);for(const q of O){const Q=q.map(he=>this._layers[he.id]),te=Q[0];if(te.visibility==="none")continue;const re=te.source||"";let W=this.familiesBySource[re];W||(W=this.familiesBySource[re]={});const pe=te.sourceLayer||"_geojsonTileLayer";let _e=W[pe];_e||(_e=W[pe]=[]),_e.push(Q)}}}class ve{constructor(k){const A={},O=[];for(const re in k){const W=k[re],pe=A[re]={};for(const _e in W){const he=W[+_e];if(!he||he.bitmap.width===0||he.bitmap.height===0)continue;const Pe={x:0,y:0,w:he.bitmap.width+2,h:he.bitmap.height+2};O.push(Pe),pe[_e]={rect:Pe,metrics:he.metrics}}}const{w:q,h:Q}=S.p(O),te=new S.o({width:q||1,height:Q||1});for(const re in k){const W=k[re];for(const pe in W){const _e=W[+pe];if(!_e||_e.bitmap.width===0||_e.bitmap.height===0)continue;const he=A[re][pe].rect;S.o.copy(_e.bitmap,te,{x:0,y:0},{x:he.x+1,y:he.y+1},_e.bitmap)}}this.image=te,this.positions=A}}S.bk("GlyphAtlas",ve);class ye{constructor(k){this.tileID=new S.S(k.tileID.overscaledZ,k.tileID.wrap,k.tileID.canonical.z,k.tileID.canonical.x,k.tileID.canonical.y),this.uid=k.uid,this.zoom=k.zoom,this.pixelRatio=k.pixelRatio,this.tileSize=k.tileSize,this.source=k.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=k.showCollisionBoxes,this.collectResourceTiming=!!k.collectResourceTiming,this.returnDependencies=!!k.returnDependencies,this.promoteId=k.promoteId,this.inFlightDependencies=[]}parse(k,A,O,q){return S._(this,void 0,void 0,function*(){this.status="parsing",this.data=k,this.collisionBoxArray=new S.a5;const Q=new S.bl(Object.keys(k.layers).sort()),te=new S.bm(this.tileID,this.promoteId);te.bucketLayerIDs=[];const re={},W={featureIndex:te,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:O},pe=A.familiesBySource[this.source];for(const lt in pe){const St=k.layers[lt];if(!St)continue;St.version===1&&S.w(`Vector tile source "${this.source}" layer "${lt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Nt=Q.encode(lt),ei=[];for(let hi=0;hi<St.length;hi++){const ui=St.feature(hi),as=te.getId(ui,lt);ei.push({feature:ui,id:as,index:hi,sourceLayerIndex:Nt})}for(const hi of pe[lt]){const ui=hi[0];ui.source!==this.source&&S.w(`layer.source = ${ui.source} does not equal this.source = ${this.source}`),ui.minzoom&&this.zoom<Math.floor(ui.minzoom)||ui.maxzoom&&this.zoom>=ui.maxzoom||ui.visibility!=="none"&&(be(hi,this.zoom,O),(re[ui.id]=ui.createBucket({index:te.bucketLayerIDs.length,layers:hi,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Nt,sourceID:this.source})).populate(ei,W,this.tileID.canonical),te.bucketLayerIDs.push(hi.map(as=>as.id)))}}const _e=S.aG(W.glyphDependencies,lt=>Object.keys(lt).map(Number));this.inFlightDependencies.forEach(lt=>lt==null?void 0:lt.abort()),this.inFlightDependencies=[];let he=Promise.resolve({});if(Object.keys(_e).length){const lt=new AbortController;this.inFlightDependencies.push(lt),he=q.sendAsync({type:"GG",data:{stacks:_e,source:this.source,tileID:this.tileID,type:"glyphs"}},lt)}const Pe=Object.keys(W.iconDependencies);let He=Promise.resolve({});if(Pe.length){const lt=new AbortController;this.inFlightDependencies.push(lt),He=q.sendAsync({type:"GI",data:{icons:Pe,source:this.source,tileID:this.tileID,type:"icons"}},lt)}const Xe=Object.keys(W.patternDependencies);let st=Promise.resolve({});if(Xe.length){const lt=new AbortController;this.inFlightDependencies.push(lt),st=q.sendAsync({type:"GI",data:{icons:Xe,source:this.source,tileID:this.tileID,type:"patterns"}},lt)}const[mt,nt,kt]=yield Promise.all([he,He,st]),qt=new ve(mt),Kt=new S.bn(nt,kt);for(const lt in re){const St=re[lt];St instanceof S.a6?(be(St.layers,this.zoom,O),S.bo({bucket:St,glyphMap:mt,glyphPositions:qt.positions,imageMap:nt,imagePositions:Kt.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):St.hasPattern&&(St instanceof S.bp||St instanceof S.bq||St instanceof S.br)&&(be(St.layers,this.zoom,O),St.addFeatures(W,this.tileID.canonical,Kt.patternPositions))}return this.status="done",{buckets:Object.values(re).filter(lt=>!lt.isEmpty()),featureIndex:te,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:qt.image,imageAtlas:Kt,glyphMap:this.returnDependencies?mt:null,iconMap:this.returnDependencies?nt:null,glyphPositions:this.returnDependencies?qt.positions:null}})}}function be(G,k,A){const O=new S.a9(k);for(const q of G)q.recalculate(O,A)}class le{constructor(k,A,O){this.actor=k,this.layerIndex=A,this.availableImages=O,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(k,A){return S._(this,void 0,void 0,function*(){const O=yield S.l(k.request,A);try{return{vectorTile:new S.bs.VectorTile(new S.bt(O.data)),rawData:O.data,cacheControl:O.cacheControl,expires:O.expires}}catch(q){const Q=new Uint8Array(O.data);let te=`Unable to parse the tile at ${k.request.url}, `;throw te+=Q[0]===31&&Q[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${q.message}`,new Error(te)}})}loadTile(k){return S._(this,void 0,void 0,function*(){const A=k.uid,O=!!(k&&k.request&&k.request.collectResourceTiming)&&new S.bu(k.request),q=new ye(k);this.loading[A]=q;const Q=new AbortController;q.abort=Q;try{const te=yield this.loadVectorTile(k,Q);if(delete this.loading[A],!te)return null;const re=te.rawData,W={};te.expires&&(W.expires=te.expires),te.cacheControl&&(W.cacheControl=te.cacheControl);const pe={};if(O){const he=O.finish();he&&(pe.resourceTiming=JSON.parse(JSON.stringify(he)))}q.vectorTile=te.vectorTile;const _e=q.parse(te.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[A]=q,this.fetching[A]={rawTileData:re,cacheControl:W,resourceTiming:pe};try{const he=yield _e;return S.e({rawTileData:re.slice(0)},he,W,pe)}finally{delete this.fetching[A]}}catch(te){throw delete this.loading[A],q.status="done",this.loaded[A]=q,te}})}reloadTile(k){return S._(this,void 0,void 0,function*(){const A=k.uid;if(!this.loaded||!this.loaded[A])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const O=this.loaded[A];if(O.showCollisionBoxes=k.showCollisionBoxes,O.status==="parsing"){const q=yield O.parse(O.vectorTile,this.layerIndex,this.availableImages,this.actor);let Q;if(this.fetching[A]){const{rawTileData:te,cacheControl:re,resourceTiming:W}=this.fetching[A];delete this.fetching[A],Q=S.e({rawTileData:te.slice(0)},q,re,W)}else Q=q;return Q}if(O.status==="done"&&O.vectorTile)return O.parse(O.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(k){return S._(this,void 0,void 0,function*(){const A=this.loading,O=k.uid;A&&A[O]&&A[O].abort&&(A[O].abort.abort(),delete A[O])})}removeTile(k){return S._(this,void 0,void 0,function*(){this.loaded&&this.loaded[k.uid]&&delete this.loaded[k.uid]})}}class ae{constructor(){this.loaded={}}loadTile(k){return S._(this,void 0,void 0,function*(){const{uid:A,encoding:O,rawImageData:q,redFactor:Q,greenFactor:te,blueFactor:re,baseShift:W}=k,pe=q.width+2,_e=q.height+2,he=S.b(q)?new S.R({width:pe,height:_e},yield S.bv(q,-1,-1,pe,_e)):q,Pe=new S.bw(A,he,O,Q,te,re,W);return this.loaded=this.loaded||{},this.loaded[A]=Pe,Pe})}removeTile(k){const A=this.loaded,O=k.uid;A&&A[O]&&delete A[O]}}function ut(G,k){if(G.length!==0){je(G[0],k);for(var A=1;A<G.length;A++)je(G[A],!k)}}function je(G,k){for(var A=0,O=0,q=0,Q=G.length,te=Q-1;q<Q;te=q++){var re=(G[q][0]-G[te][0])*(G[te][1]+G[q][1]),W=A+re;O+=Math.abs(A)>=Math.abs(re)?A-W+re:re-W+A,A=W}A+O>=0!=!!k&&G.reverse()}var Ke=S.bx(function G(k,A){var O,q=k&&k.type;if(q==="FeatureCollection")for(O=0;O<k.features.length;O++)G(k.features[O],A);else if(q==="GeometryCollection")for(O=0;O<k.geometries.length;O++)G(k.geometries[O],A);else if(q==="Feature")G(k.geometry,A);else if(q==="Polygon")ut(k.coordinates,A);else if(q==="MultiPolygon")for(O=0;O<k.coordinates.length;O++)ut(k.coordinates[O],A);return k});const Fe=S.bs.VectorTileFeature.prototype.toGeoJSON;var ht={exports:{}},Ye=S.by,Ue=S.bs.VectorTileFeature,bt=yt;function yt(G,k){this.options=k||{},this.features=G,this.length=G.length}function At(G,k){this.id=typeof G.id=="number"?G.id:void 0,this.type=G.type,this.rawGeometry=G.type===1?[G.geometry]:G.geometry,this.properties=G.tags,this.extent=k||4096}yt.prototype.feature=function(G){return new At(this.features[G],this.options.extent)},At.prototype.loadGeometry=function(){var G=this.rawGeometry;this.geometry=[];for(var k=0;k<G.length;k++){for(var A=G[k],O=[],q=0;q<A.length;q++)O.push(new Ye(A[q][0],A[q][1]));this.geometry.push(O)}return this.geometry},At.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var G=this.geometry,k=1/0,A=-1/0,O=1/0,q=-1/0,Q=0;Q<G.length;Q++)for(var te=G[Q],re=0;re<te.length;re++){var W=te[re];k=Math.min(k,W.x),A=Math.max(A,W.x),O=Math.min(O,W.y),q=Math.max(q,W.y)}return[k,O,A,q]},At.prototype.toGeoJSON=Ue.prototype.toGeoJSON;var It=S.bz,Yi=bt;function ri(G){var k=new It;return function(A,O){for(var q in A.layers)O.writeMessage(3,Qi,A.layers[q])}(G,k),k.finish()}function Qi(G,k){var A;k.writeVarintField(15,G.version||1),k.writeStringField(1,G.name||""),k.writeVarintField(5,G.extent||4096);var O={keys:[],values:[],keycache:{},valuecache:{}};for(A=0;A<G.length;A++)O.feature=G.feature(A),k.writeMessage(2,wt,O);var q=O.keys;for(A=0;A<q.length;A++)k.writeStringField(3,q[A]);var Q=O.values;for(A=0;A<Q.length;A++)k.writeMessage(4,Pn,Q[A])}function wt(G,k){var A=G.feature;A.id!==void 0&&k.writeVarintField(1,A.id),k.writeMessage(2,Vs,G),k.writeVarintField(3,A.type),k.writeMessage(4,Er,A)}function Vs(G,k){var A=G.feature,O=G.keys,q=G.values,Q=G.keycache,te=G.valuecache;for(var re in A.properties){var W=A.properties[re],pe=Q[re];if(W!==null){pe===void 0&&(O.push(re),Q[re]=pe=O.length-1),k.writeVarint(pe);var _e=typeof W;_e!=="string"&&_e!=="boolean"&&_e!=="number"&&(W=JSON.stringify(W));var he=_e+":"+W,Pe=te[he];Pe===void 0&&(q.push(W),te[he]=Pe=q.length-1),k.writeVarint(Pe)}}}function ci(G,k){return(k<<3)+(7&G)}function wi(G){return G<<1^G>>31}function Er(G,k){for(var A=G.loadGeometry(),O=G.type,q=0,Q=0,te=A.length,re=0;re<te;re++){var W=A[re],pe=1;O===1&&(pe=W.length),k.writeVarint(ci(1,pe));for(var _e=O===3?W.length-1:W.length,he=0;he<_e;he++){he===1&&O!==1&&k.writeVarint(ci(2,_e-1));var Pe=W[he].x-q,He=W[he].y-Q;k.writeVarint(wi(Pe)),k.writeVarint(wi(He)),q+=Pe,Q+=He}O===3&&k.writeVarint(ci(7,1))}}function Pn(G,k){var A=typeof G;A==="string"?k.writeStringField(1,G):A==="boolean"?k.writeBooleanField(7,G):A==="number"&&(G%1!=0?k.writeDoubleField(3,G):G<0?k.writeSVarintField(6,G):k.writeVarintField(5,G))}ht.exports=ri,ht.exports.fromVectorTileJs=ri,ht.exports.fromGeojsonVt=function(G,k){k=k||{};var A={};for(var O in G)A[O]=new Yi(G[O].features,k),A[O].name=O,A[O].version=k.version,A[O].extent=k.extent;return ri({layers:A})},ht.exports.GeoJSONWrapper=Yi;var pr=S.bx(ht.exports);const Ns={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:G=>G},sn=Math.fround||(Cr=new Float32Array(1),G=>(Cr[0]=+G,Cr[0]));var Cr;const Ci=3,er=5,En=6;class Vr{constructor(k){this.options=Object.assign(Object.create(Ns),k),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(k){const{log:A,minZoom:O,maxZoom:q}=this.options;A&&console.time("total time");const Q=`prepare ${k.length} points`;A&&console.time(Q),this.points=k;const te=[];for(let W=0;W<k.length;W++){const pe=k[W];if(!pe.geometry)continue;const[_e,he]=pe.geometry.coordinates,Pe=sn(Fi(_e)),He=sn(tr(he));te.push(Pe,He,1/0,W,-1,1),this.options.reduce&&te.push(0)}let re=this.trees[q+1]=this._createTree(te);A&&console.timeEnd(Q);for(let W=q;W>=O;W--){const pe=+Date.now();re=this.trees[W]=this._createTree(this._cluster(re,W)),A&&console.log("z%d: %d clusters in %dms",W,re.numItems,+Date.now()-pe)}return A&&console.timeEnd("total time"),this}getClusters(k,A){let O=((k[0]+180)%360+360)%360-180;const q=Math.max(-90,Math.min(90,k[1]));let Q=k[2]===180?180:((k[2]+180)%360+360)%360-180;const te=Math.max(-90,Math.min(90,k[3]));if(k[2]-k[0]>=360)O=-180,Q=180;else if(O>Q){const he=this.getClusters([O,q,180,te],A),Pe=this.getClusters([-180,q,Q,te],A);return he.concat(Pe)}const re=this.trees[this._limitZoom(A)],W=re.range(Fi(O),tr(te),Fi(Q),tr(q)),pe=re.data,_e=[];for(const he of W){const Pe=this.stride*he;_e.push(pe[Pe+er]>1?fr(pe,Pe,this.clusterProps):this.points[pe[Pe+Ci]])}return _e}getChildren(k){const A=this._getOriginId(k),O=this._getOriginZoom(k),q="No cluster with the specified id.",Q=this.trees[O];if(!Q)throw new Error(q);const te=Q.data;if(A*this.stride>=te.length)throw new Error(q);const re=this.options.radius/(this.options.extent*Math.pow(2,O-1)),W=Q.within(te[A*this.stride],te[A*this.stride+1],re),pe=[];for(const _e of W){const he=_e*this.stride;te[he+4]===k&&pe.push(te[he+er]>1?fr(te,he,this.clusterProps):this.points[te[he+Ci]])}if(pe.length===0)throw new Error(q);return pe}getLeaves(k,A,O){const q=[];return this._appendLeaves(q,k,A=A||10,O=O||0,0),q}getTile(k,A,O){const q=this.trees[this._limitZoom(k)],Q=Math.pow(2,k),{extent:te,radius:re}=this.options,W=re/te,pe=(O-W)/Q,_e=(O+1+W)/Q,he={features:[]};return this._addTileFeatures(q.range((A-W)/Q,pe,(A+1+W)/Q,_e),q.data,A,O,Q,he),A===0&&this._addTileFeatures(q.range(1-W/Q,pe,1,_e),q.data,Q,O,Q,he),A===Q-1&&this._addTileFeatures(q.range(0,pe,W/Q,_e),q.data,-1,O,Q,he),he.features.length?he:null}getClusterExpansionZoom(k){let A=this._getOriginZoom(k)-1;for(;A<=this.options.maxZoom;){const O=this.getChildren(k);if(A++,O.length!==1)break;k=O[0].properties.cluster_id}return A}_appendLeaves(k,A,O,q,Q){const te=this.getChildren(A);for(const re of te){const W=re.properties;if(W&&W.cluster?Q+W.point_count<=q?Q+=W.point_count:Q=this._appendLeaves(k,W.cluster_id,O,q,Q):Q<q?Q++:k.push(re),k.length===O)break}return Q}_createTree(k){const A=new S.aw(k.length/this.stride|0,this.options.nodeSize,Float32Array);for(let O=0;O<k.length;O+=this.stride)A.add(k[O],k[O+1]);return A.finish(),A.data=k,A}_addTileFeatures(k,A,O,q,Q,te){for(const re of k){const W=re*this.stride,pe=A[W+er]>1;let _e,he,Pe;if(pe)_e=Cn(A,W,this.clusterProps),he=A[W],Pe=A[W+1];else{const st=this.points[A[W+Ci]];_e=st.properties;const[mt,nt]=st.geometry.coordinates;he=Fi(mt),Pe=tr(nt)}const He={type:1,geometry:[[Math.round(this.options.extent*(he*Q-O)),Math.round(this.options.extent*(Pe*Q-q))]],tags:_e};let Xe;Xe=pe||this.options.generateId?A[W+Ci]:this.points[A[W+Ci]].id,Xe!==void 0&&(He.id=Xe),te.features.push(He)}}_limitZoom(k){return Math.max(this.options.minZoom,Math.min(Math.floor(+k),this.options.maxZoom+1))}_cluster(k,A){const{radius:O,extent:q,reduce:Q,minPoints:te}=this.options,re=O/(q*Math.pow(2,A)),W=k.data,pe=[],_e=this.stride;for(let he=0;he<W.length;he+=_e){if(W[he+2]<=A)continue;W[he+2]=A;const Pe=W[he],He=W[he+1],Xe=k.within(W[he],W[he+1],re),st=W[he+er];let mt=st;for(const nt of Xe){const kt=nt*_e;W[kt+2]>A&&(mt+=W[kt+er])}if(mt>st&&mt>=te){let nt,kt=Pe*st,qt=He*st,Kt=-1;const lt=((he/_e|0)<<5)+(A+1)+this.points.length;for(const St of Xe){const Nt=St*_e;if(W[Nt+2]<=A)continue;W[Nt+2]=A;const ei=W[Nt+er];kt+=W[Nt]*ei,qt+=W[Nt+1]*ei,W[Nt+4]=lt,Q&&(nt||(nt=this._map(W,he,!0),Kt=this.clusterProps.length,this.clusterProps.push(nt)),Q(nt,this._map(W,Nt)))}W[he+4]=lt,pe.push(kt/mt,qt/mt,1/0,lt,-1,mt),Q&&pe.push(Kt)}else{for(let nt=0;nt<_e;nt++)pe.push(W[he+nt]);if(mt>1)for(const nt of Xe){const kt=nt*_e;if(!(W[kt+2]<=A)){W[kt+2]=A;for(let qt=0;qt<_e;qt++)pe.push(W[kt+qt])}}}}return pe}_getOriginId(k){return k-this.points.length>>5}_getOriginZoom(k){return(k-this.points.length)%32}_map(k,A,O){if(k[A+er]>1){const te=this.clusterProps[k[A+En]];return O?Object.assign({},te):te}const q=this.points[k[A+Ci]].properties,Q=this.options.map(q);return O&&Q===q?Object.assign({},Q):Q}}function fr(G,k,A){return{type:"Feature",id:G[k+Ci],properties:Cn(G,k,A),geometry:{type:"Point",coordinates:[(O=G[k],360*(O-.5)),on(G[k+1])]}};var O}function Cn(G,k,A){const O=G[k+er],q=O>=1e4?`${Math.round(O/1e3)}k`:O>=1e3?Math.round(O/100)/10+"k":O,Q=G[k+En],te=Q===-1?{}:Object.assign({},A[Q]);return Object.assign(te,{cluster:!0,cluster_id:G[k+Ci],point_count:O,point_count_abbreviated:q})}function Fi(G){return G/360+.5}function tr(G){const k=Math.sin(G*Math.PI/180),A=.5-.25*Math.log((1+k)/(1-k))/Math.PI;return A<0?0:A>1?1:A}function on(G){const k=(180-360*G)*Math.PI/180;return 360*Math.atan(Math.exp(k))/Math.PI-90}function an(G,k,A,O){let q=O;const Q=k+(A-k>>1);let te,re=A-k;const W=G[k],pe=G[k+1],_e=G[A],he=G[A+1];for(let Pe=k+3;Pe<A;Pe+=3){const He=is(G[Pe],G[Pe+1],W,pe,_e,he);if(He>q)te=Pe,q=He;else if(He===q){const Xe=Math.abs(Pe-Q);Xe<re&&(te=Pe,re=Xe)}}q>O&&(te-k>3&&an(G,k,te,O),G[te+2]=q,A-te>3&&an(G,te,A,O))}function is(G,k,A,O,q,Q){let te=q-A,re=Q-O;if(te!==0||re!==0){const W=((G-A)*te+(k-O)*re)/(te*te+re*re);W>1?(A=q,O=Q):W>0&&(A+=te*W,O+=re*W)}return te=G-A,re=k-O,te*te+re*re}function Ar(G,k,A,O){const q={id:G??null,type:k,geometry:A,tags:O,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(k==="Point"||k==="MultiPoint"||k==="LineString")Nr(q,A);else if(k==="Polygon")Nr(q,A[0]);else if(k==="MultiLineString")for(const Q of A)Nr(q,Q);else if(k==="MultiPolygon")for(const Q of A)Nr(q,Q[0]);return q}function Nr(G,k){for(let A=0;A<k.length;A+=3)G.minX=Math.min(G.minX,k[A]),G.minY=Math.min(G.minY,k[A+1]),G.maxX=Math.max(G.maxX,k[A]),G.maxY=Math.max(G.maxY,k[A+1])}function jr(G,k,A,O){if(!k.geometry)return;const q=k.geometry.coordinates;if(q&&q.length===0)return;const Q=k.geometry.type,te=Math.pow(A.tolerance/((1<<A.maxZoom)*A.extent),2);let re=[],W=k.id;if(A.promoteId?W=k.properties[A.promoteId]:A.generateId&&(W=O||0),Q==="Point")An(q,re);else if(Q==="MultiPoint")for(const pe of q)An(pe,re);else if(Q==="LineString")ue(q,re,te,!1);else if(Q==="MultiLineString"){if(A.lineMetrics){for(const pe of q)re=[],ue(pe,re,te,!1),G.push(Ar(W,"LineString",re,k.properties));return}ln(q,re,te,!1)}else if(Q==="Polygon")ln(q,re,te,!0);else{if(Q!=="MultiPolygon"){if(Q==="GeometryCollection"){for(const pe of k.geometry.geometries)jr(G,{id:W,geometry:pe,properties:k.properties},A,O);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const pe of q){const _e=[];ln(pe,_e,te,!0),re.push(_e)}}G.push(Ar(W,Q,re,k.properties))}function An(G,k){k.push(rs(G[0]),xt(G[1]),0)}function ue(G,k,A,O){let q,Q,te=0;for(let W=0;W<G.length;W++){const pe=rs(G[W][0]),_e=xt(G[W][1]);k.push(pe,_e,0),W>0&&(te+=O?(q*_e-pe*Q)/2:Math.sqrt(Math.pow(pe-q,2)+Math.pow(_e-Q,2))),q=pe,Q=_e}const re=k.length-3;k[2]=1,an(k,0,re,A),k[re+2]=1,k.size=Math.abs(te),k.start=0,k.end=k.size}function ln(G,k,A,O){for(let q=0;q<G.length;q++){const Q=[];ue(G[q],Q,A,O),k.push(Q)}}function rs(G){return G/360+.5}function xt(G){const k=Math.sin(G*Math.PI/180),A=.5-.25*Math.log((1+k)/(1-k))/Math.PI;return A<0?0:A>1?1:A}function $t(G,k,A,O,q,Q,te,re){if(O/=k,Q>=(A/=k)&&te<O)return G;if(te<A||Q>=O)return null;const W=[];for(const pe of G){const _e=pe.geometry;let he=pe.type;const Pe=q===0?pe.minX:pe.minY,He=q===0?pe.maxX:pe.maxY;if(Pe>=A&&He<O){W.push(pe);continue}if(He<A||Pe>=O)continue;let Xe=[];if(he==="Point"||he==="MultiPoint")ns(_e,Xe,A,O,q);else if(he==="LineString")Ur(_e,Xe,A,O,q,!1,re.lineMetrics);else if(he==="MultiLineString")kn(_e,Xe,A,O,q,!1);else if(he==="Polygon")kn(_e,Xe,A,O,q,!0);else if(he==="MultiPolygon")for(const st of _e){const mt=[];kn(st,mt,A,O,q,!0),mt.length&&Xe.push(mt)}if(Xe.length){if(re.lineMetrics&&he==="LineString"){for(const st of Xe)W.push(Ar(pe.id,he,st,pe.tags));continue}he!=="LineString"&&he!=="MultiLineString"||(Xe.length===1?(he="LineString",Xe=Xe[0]):he="MultiLineString"),he!=="Point"&&he!=="MultiPoint"||(he=Xe.length===3?"Point":"MultiPoint"),W.push(Ar(pe.id,he,Xe,pe.tags))}}return W.length?W:null}function ns(G,k,A,O,q){for(let Q=0;Q<G.length;Q+=3){const te=G[Q+q];te>=A&&te<=O&&Hi(k,G[Q],G[Q+1],G[Q+2])}}function Ur(G,k,A,O,q,Q,te){let re=kr(G);const W=q===0?ss:os;let pe,_e,he=G.start;for(let mt=0;mt<G.length-3;mt+=3){const nt=G[mt],kt=G[mt+1],qt=G[mt+2],Kt=G[mt+3],lt=G[mt+4],St=q===0?nt:kt,Nt=q===0?Kt:lt;let ei=!1;te&&(pe=Math.sqrt(Math.pow(nt-Kt,2)+Math.pow(kt-lt,2))),St<A?Nt>A&&(_e=W(re,nt,kt,Kt,lt,A),te&&(re.start=he+pe*_e)):St>O?Nt<O&&(_e=W(re,nt,kt,Kt,lt,O),te&&(re.start=he+pe*_e)):Hi(re,nt,kt,qt),Nt<A&&St>=A&&(_e=W(re,nt,kt,Kt,lt,A),ei=!0),Nt>O&&St<=O&&(_e=W(re,nt,kt,Kt,lt,O),ei=!0),!Q&&ei&&(te&&(re.end=he+pe*_e),k.push(re),re=kr(G)),te&&(he+=pe)}let Pe=G.length-3;const He=G[Pe],Xe=G[Pe+1],st=q===0?He:Xe;st>=A&&st<=O&&Hi(re,He,Xe,G[Pe+2]),Pe=re.length-3,Q&&Pe>=3&&(re[Pe]!==re[0]||re[Pe+1]!==re[1])&&Hi(re,re[0],re[1],re[2]),re.length&&k.push(re)}function kr(G){const k=[];return k.size=G.size,k.start=G.start,k.end=G.end,k}function kn(G,k,A,O,q,Q){for(const te of G)Ur(te,k,A,O,q,Q,!1)}function Hi(G,k,A,O){G.push(k,A,O)}function ss(G,k,A,O,q,Q){const te=(Q-k)/(O-k);return Hi(G,Q,A+(q-A)*te,1),te}function os(G,k,A,O,q,Q){const te=(Q-A)/(q-A);return Hi(G,k+(O-k)*te,Q,1),te}function Ie(G,k){const A=[];for(let O=0;O<G.length;O++){const q=G[O],Q=q.type;let te;if(Q==="Point"||Q==="MultiPoint"||Q==="LineString")te=mr(q.geometry,k);else if(Q==="MultiLineString"||Q==="Polygon"){te=[];for(const re of q.geometry)te.push(mr(re,k))}else if(Q==="MultiPolygon"){te=[];for(const re of q.geometry){const W=[];for(const pe of re)W.push(mr(pe,k));te.push(W)}}A.push(Ar(q.id,Q,te,q.tags))}return A}function mr(G,k){const A=[];A.size=G.size,G.start!==void 0&&(A.start=G.start,A.end=G.end);for(let O=0;O<G.length;O+=3)A.push(G[O]+k,G[O+1],G[O+2]);return A}function Si(G,k){if(G.transformed)return G;const A=1<<G.z,O=G.x,q=G.y;for(const Q of G.features){const te=Q.geometry,re=Q.type;if(Q.geometry=[],re===1)for(let W=0;W<te.length;W+=2)Q.geometry.push(gr(te[W],te[W+1],k,A,O,q));else for(let W=0;W<te.length;W++){const pe=[];for(let _e=0;_e<te[W].length;_e+=2)pe.push(gr(te[W][_e],te[W][_e+1],k,A,O,q));Q.geometry.push(pe)}}return G.transformed=!0,G}function gr(G,k,A,O,q,Q){return[Math.round(A*(G*O-q)),Math.round(A*(k*O-Q))]}function $r(G,k,A,O,q){const Q=k===q.maxZoom?0:q.tolerance/((1<<k)*q.extent),te={features:[],numPoints:0,numSimplified:0,numFeatures:G.length,source:null,x:A,y:O,z:k,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const re of G)Ce(te,re,Q,q);return te}function Ce(G,k,A,O){const q=k.geometry,Q=k.type,te=[];if(G.minX=Math.min(G.minX,k.minX),G.minY=Math.min(G.minY,k.minY),G.maxX=Math.max(G.maxX,k.maxX),G.maxY=Math.max(G.maxY,k.maxY),Q==="Point"||Q==="MultiPoint")for(let re=0;re<q.length;re+=3)te.push(q[re],q[re+1]),G.numPoints++,G.numSimplified++;else if(Q==="LineString")at(te,q,G,A,!1,!1);else if(Q==="MultiLineString"||Q==="Polygon")for(let re=0;re<q.length;re++)at(te,q[re],G,A,Q==="Polygon",re===0);else if(Q==="MultiPolygon")for(let re=0;re<q.length;re++){const W=q[re];for(let pe=0;pe<W.length;pe++)at(te,W[pe],G,A,!0,pe===0)}if(te.length){let re=k.tags||null;if(Q==="LineString"&&O.lineMetrics){re={};for(const pe in k.tags)re[pe]=k.tags[pe];re.mapbox_clip_start=q.start/q.size,re.mapbox_clip_end=q.end/q.size}const W={geometry:te,type:Q==="Polygon"||Q==="MultiPolygon"?3:Q==="LineString"||Q==="MultiLineString"?2:1,tags:re};k.id!==null&&(W.id=k.id),G.features.push(W)}}function at(G,k,A,O,q,Q){const te=O*O;if(O>0&&k.size<(q?te:O))return void(A.numPoints+=k.length/3);const re=[];for(let W=0;W<k.length;W+=3)(O===0||k[W+2]>te)&&(A.numSimplified++,re.push(k[W],k[W+1])),A.numPoints++;q&&function(W,pe){let _e=0;for(let he=0,Pe=W.length,He=Pe-2;he<Pe;He=he,he+=2)_e+=(W[he]-W[He])*(W[he+1]+W[He+1]);if(_e>0===pe)for(let he=0,Pe=W.length;he<Pe/2;he+=2){const He=W[he],Xe=W[he+1];W[he]=W[Pe-2-he],W[he+1]=W[Pe-1-he],W[Pe-2-he]=He,W[Pe-1-he]=Xe}}(re,Q),G.push(re)}const Qe={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Ai{constructor(k,A){const O=(A=this.options=function(Q,te){for(const re in te)Q[re]=te[re];return Q}(Object.create(Qe),A)).debug;if(O&&console.time("preprocess data"),A.maxZoom<0||A.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(A.promoteId&&A.generateId)throw new Error("promoteId and generateId cannot be used together.");let q=function(Q,te){const re=[];if(Q.type==="FeatureCollection")for(let W=0;W<Q.features.length;W++)jr(re,Q.features[W],te,W);else jr(re,Q.type==="Feature"?Q:{geometry:Q},te);return re}(k,A);this.tiles={},this.tileCoords=[],O&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",A.indexMaxZoom,A.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),q=function(Q,te){const re=te.buffer/te.extent;let W=Q;const pe=$t(Q,1,-1-re,re,0,-1,2,te),_e=$t(Q,1,1-re,2+re,0,-1,2,te);return(pe||_e)&&(W=$t(Q,1,-re,1+re,0,-1,2,te)||[],pe&&(W=Ie(pe,1).concat(W)),_e&&(W=W.concat(Ie(_e,-1)))),W}(q,A),q.length&&this.splitTile(q,0,0,0),O&&(q.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(k,A,O,q,Q,te,re){const W=[k,A,O,q],pe=this.options,_e=pe.debug;for(;W.length;){q=W.pop(),O=W.pop(),A=W.pop(),k=W.pop();const he=1<<A,Pe=ir(A,O,q);let He=this.tiles[Pe];if(!He&&(_e>1&&console.time("creation"),He=this.tiles[Pe]=$r(k,A,O,q,pe),this.tileCoords.push({z:A,x:O,y:q}),_e)){_e>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",A,O,q,He.numFeatures,He.numPoints,He.numSimplified),console.timeEnd("creation"));const ei=`z${A}`;this.stats[ei]=(this.stats[ei]||0)+1,this.total++}if(He.source=k,Q==null){if(A===pe.indexMaxZoom||He.numPoints<=pe.indexMaxPoints)continue}else{if(A===pe.maxZoom||A===Q)continue;if(Q!=null){const ei=Q-A;if(O!==te>>ei||q!==re>>ei)continue}}if(He.source=null,k.length===0)continue;_e>1&&console.time("clipping");const Xe=.5*pe.buffer/pe.extent,st=.5-Xe,mt=.5+Xe,nt=1+Xe;let kt=null,qt=null,Kt=null,lt=null,St=$t(k,he,O-Xe,O+mt,0,He.minX,He.maxX,pe),Nt=$t(k,he,O+st,O+nt,0,He.minX,He.maxX,pe);k=null,St&&(kt=$t(St,he,q-Xe,q+mt,1,He.minY,He.maxY,pe),qt=$t(St,he,q+st,q+nt,1,He.minY,He.maxY,pe),St=null),Nt&&(Kt=$t(Nt,he,q-Xe,q+mt,1,He.minY,He.maxY,pe),lt=$t(Nt,he,q+st,q+nt,1,He.minY,He.maxY,pe),Nt=null),_e>1&&console.timeEnd("clipping"),W.push(kt||[],A+1,2*O,2*q),W.push(qt||[],A+1,2*O,2*q+1),W.push(Kt||[],A+1,2*O+1,2*q),W.push(lt||[],A+1,2*O+1,2*q+1)}}getTile(k,A,O){k=+k,A=+A,O=+O;const q=this.options,{extent:Q,debug:te}=q;if(k<0||k>24)return null;const re=1<<k,W=ir(k,A=A+re&re-1,O);if(this.tiles[W])return Si(this.tiles[W],Q);te>1&&console.log("drilling down to z%d-%d-%d",k,A,O);let pe,_e=k,he=A,Pe=O;for(;!pe&&_e>0;)_e--,he>>=1,Pe>>=1,pe=this.tiles[ir(_e,he,Pe)];return pe&&pe.source?(te>1&&(console.log("found parent tile z%d-%d-%d",_e,he,Pe),console.time("drilling down")),this.splitTile(pe.source,_e,he,Pe,k,A,O),te>1&&console.timeEnd("drilling down"),this.tiles[W]?Si(this.tiles[W],Q):null):null}}function ir(G,k,A){return 32*((1<<G)*A+k)+G}function rt(G,k){return k?G.properties[k]:G.id}function _r(G,k){if(G==null)return!0;if(G.type==="Feature")return rt(G,k)!=null;if(G.type==="FeatureCollection"){const A=new Set;for(const O of G.features){const q=rt(O,k);if(q==null||A.has(q))return!1;A.add(q)}return!0}return!1}function Mr(G,k){const A=new Map;if(G!=null)if(G.type==="Feature")A.set(rt(G,k),G);else for(const O of G.features)A.set(rt(O,k),O);return A}class qr extends le{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(k,A){return S._(this,void 0,void 0,function*(){const O=k.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const q=this._geoJSONIndex.getTile(O.z,O.x,O.y);if(!q)return null;const Q=new class{constructor(re){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=S.X,this.length=re.length,this._features=re}feature(re){return new class{constructor(W){this._feature=W,this.extent=S.X,this.type=W.type,this.properties=W.tags,"id"in W&&!isNaN(W.id)&&(this.id=parseInt(W.id,10))}loadGeometry(){if(this._feature.type===1){const W=[];for(const pe of this._feature.geometry)W.push([new S.P(pe[0],pe[1])]);return W}{const W=[];for(const pe of this._feature.geometry){const _e=[];for(const he of pe)_e.push(new S.P(he[0],he[1]));W.push(_e)}return W}}toGeoJSON(W,pe,_e){return Fe.call(this,W,pe,_e)}}(this._features[re])}}(q.features);let te=pr(Q);return te.byteOffset===0&&te.byteLength===te.buffer.byteLength||(te=new Uint8Array(te)),{vectorTile:Q,rawData:te.buffer}})}loadData(k){return S._(this,void 0,void 0,function*(){var A;(A=this._pendingRequest)===null||A===void 0||A.abort();const O=!!(k&&k.request&&k.request.collectResourceTiming)&&new S.bu(k.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(k,this._pendingRequest),this._geoJSONIndex=k.cluster?new Vr(function({superclusterOptions:te,clusterProperties:re}){if(!re||!te)return te;const W={},pe={},_e={accumulated:null,zoom:0},he={properties:null},Pe=Object.keys(re);for(const He of Pe){const[Xe,st]=re[He],mt=S.bB(st),nt=S.bB(typeof Xe=="string"?[Xe,["accumulated"],["get",He]]:Xe);W[He]=mt.value,pe[He]=nt.value}return te.map=He=>{he.properties=He;const Xe={};for(const st of Pe)Xe[st]=W[st].evaluate(_e,he);return Xe},te.reduce=(He,Xe)=>{he.properties=Xe;for(const st of Pe)_e.accumulated=He[st],He[st]=pe[st].evaluate(_e,he)},te}(k)).load((yield this._pendingData).features):(q=yield this._pendingData,new Ai(q,k.geojsonVtOptions)),this.loaded={};const Q={};if(O){const te=O.finish();te&&(Q.resourceTiming={},Q.resourceTiming[k.source]=JSON.parse(JSON.stringify(te)))}return Q}catch(Q){if(delete this._pendingRequest,S.bA(Q))return{abandoned:!0};throw Q}var q})}getData(){return S._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(k){const A=this.loaded;return A&&A[k.uid]?super.reloadTile(k):this.loadTile(k)}loadAndProcessGeoJSON(k,A){return S._(this,void 0,void 0,function*(){let O=yield this.loadGeoJSON(k,A);if(delete this._pendingRequest,typeof O!="object")throw new Error(`Input data given to '${k.source}' is not a valid GeoJSON object.`);if(Ke(O,!0),k.filter){const q=S.bB(k.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(q.result==="error")throw new Error(q.value.map(te=>`${te.key}: ${te.message}`).join(", "));O={type:"FeatureCollection",features:O.features.filter(te=>q.value.evaluate({zoom:0},te))}}return O})}loadGeoJSON(k,A){return S._(this,void 0,void 0,function*(){const{promoteId:O}=k;if(k.request){const q=yield S.h(k.request,A);return this._dataUpdateable=_r(q.data,O)?Mr(q.data,O):void 0,q.data}if(typeof k.data=="string")try{const q=JSON.parse(k.data);return this._dataUpdateable=_r(q,O)?Mr(q,O):void 0,q}catch{throw new Error(`Input data given to '${k.source}' is not a valid GeoJSON object.`)}if(!k.dataDiff)throw new Error(`Input data given to '${k.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${k.source}`);return function(q,Q,te){var re,W,pe,_e;if(Q.removeAll&&q.clear(),Q.remove)for(const he of Q.remove)q.delete(he);if(Q.add)for(const he of Q.add){const Pe=rt(he,te);Pe!=null&&q.set(Pe,he)}if(Q.update)for(const he of Q.update){let Pe=q.get(he.id);if(Pe==null)continue;const He=!he.removeAllProperties&&(((re=he.removeProperties)===null||re===void 0?void 0:re.length)>0||((W=he.addOrUpdateProperties)===null||W===void 0?void 0:W.length)>0);if((he.newGeometry||he.removeAllProperties||He)&&(Pe=Object.assign({},Pe),q.set(he.id,Pe),He&&(Pe.properties=Object.assign({},Pe.properties))),he.newGeometry&&(Pe.geometry=he.newGeometry),he.removeAllProperties)Pe.properties={};else if(((pe=he.removeProperties)===null||pe===void 0?void 0:pe.length)>0)for(const Xe of he.removeProperties)Object.prototype.hasOwnProperty.call(Pe.properties,Xe)&&delete Pe.properties[Xe];if(((_e=he.addOrUpdateProperties)===null||_e===void 0?void 0:_e.length)>0)for(const{key:Xe,value:st}of he.addOrUpdateProperties)Pe.properties[Xe]=st}}(this._dataUpdateable,k.dataDiff,O),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(k){return S._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(k){return this._geoJSONIndex.getClusterExpansionZoom(k.clusterId)}getClusterChildren(k){return this._geoJSONIndex.getChildren(k.clusterId)}getClusterLeaves(k){return this._geoJSONIndex.getLeaves(k.clusterId,k.limit,k.offset)}}class yr{constructor(k){this.self=k,this.actor=new S.F(k),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(A,O)=>{if(this.externalWorkerSourceTypes[A])throw new Error(`Worker source with name "${A}" already registered.`);this.externalWorkerSourceTypes[A]=O},this.self.addProtocol=S.bh,this.self.removeProtocol=S.bi,this.self.registerRTLTextPlugin=A=>{if(S.bC.isParsed())throw new Error("RTL text plugin already registered.");S.bC.setMethods(A)},this.actor.registerMessageHandler("LDT",(A,O)=>this._getDEMWorkerSource(A,O.source).loadTile(O)),this.actor.registerMessageHandler("RDT",(A,O)=>S._(this,void 0,void 0,function*(){this._getDEMWorkerSource(A,O.source).removeTile(O)})),this.actor.registerMessageHandler("GCEZ",(A,O)=>S._(this,void 0,void 0,function*(){return this._getWorkerSource(A,O.type,O.source).getClusterExpansionZoom(O)})),this.actor.registerMessageHandler("GCC",(A,O)=>S._(this,void 0,void 0,function*(){return this._getWorkerSource(A,O.type,O.source).getClusterChildren(O)})),this.actor.registerMessageHandler("GCL",(A,O)=>S._(this,void 0,void 0,function*(){return this._getWorkerSource(A,O.type,O.source).getClusterLeaves(O)})),this.actor.registerMessageHandler("LD",(A,O)=>this._getWorkerSource(A,O.type,O.source).loadData(O)),this.actor.registerMessageHandler("GD",(A,O)=>this._getWorkerSource(A,O.type,O.source).getData()),this.actor.registerMessageHandler("LT",(A,O)=>this._getWorkerSource(A,O.type,O.source).loadTile(O)),this.actor.registerMessageHandler("RT",(A,O)=>this._getWorkerSource(A,O.type,O.source).reloadTile(O)),this.actor.registerMessageHandler("AT",(A,O)=>this._getWorkerSource(A,O.type,O.source).abortTile(O)),this.actor.registerMessageHandler("RMT",(A,O)=>this._getWorkerSource(A,O.type,O.source).removeTile(O)),this.actor.registerMessageHandler("RS",(A,O)=>S._(this,void 0,void 0,function*(){if(!this.workerSources[A]||!this.workerSources[A][O.type]||!this.workerSources[A][O.type][O.source])return;const q=this.workerSources[A][O.type][O.source];delete this.workerSources[A][O.type][O.source],q.removeSource!==void 0&&q.removeSource(O)})),this.actor.registerMessageHandler("RM",A=>S._(this,void 0,void 0,function*(){delete this.layerIndexes[A],delete this.availableImages[A],delete this.workerSources[A],delete this.demWorkerSources[A]})),this.actor.registerMessageHandler("SR",(A,O)=>S._(this,void 0,void 0,function*(){this.referrer=O})),this.actor.registerMessageHandler("SRPS",(A,O)=>this._syncRTLPluginState(A,O)),this.actor.registerMessageHandler("IS",(A,O)=>S._(this,void 0,void 0,function*(){this.self.importScripts(O)})),this.actor.registerMessageHandler("SI",(A,O)=>this._setImages(A,O)),this.actor.registerMessageHandler("UL",(A,O)=>S._(this,void 0,void 0,function*(){this._getLayerIndex(A).update(O.layers,O.removedIds)})),this.actor.registerMessageHandler("SL",(A,O)=>S._(this,void 0,void 0,function*(){this._getLayerIndex(A).replace(O)}))}_setImages(k,A){return S._(this,void 0,void 0,function*(){this.availableImages[k]=A;for(const O in this.workerSources[k]){const q=this.workerSources[k][O];for(const Q in q)q[Q].availableImages=A}})}_syncRTLPluginState(k,A){return S._(this,void 0,void 0,function*(){if(S.bC.isParsed())return S.bC.getState();if(A.pluginStatus!=="loading")return S.bC.setState(A),A;const O=A.pluginURL;if(this.self.importScripts(O),S.bC.isParsed()){const q={pluginStatus:"loaded",pluginURL:O};return S.bC.setState(q),q}throw S.bC.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${O}`)})}_getAvailableImages(k){let A=this.availableImages[k];return A||(A=[]),A}_getLayerIndex(k){let A=this.layerIndexes[k];return A||(A=this.layerIndexes[k]=new c),A}_getWorkerSource(k,A,O){if(this.workerSources[k]||(this.workerSources[k]={}),this.workerSources[k][A]||(this.workerSources[k][A]={}),!this.workerSources[k][A][O]){const q={sendAsync:(Q,te)=>(Q.targetMapId=k,this.actor.sendAsync(Q,te))};switch(A){case"vector":this.workerSources[k][A][O]=new le(q,this._getLayerIndex(k),this._getAvailableImages(k));break;case"geojson":this.workerSources[k][A][O]=new qr(q,this._getLayerIndex(k),this._getAvailableImages(k));break;default:this.workerSources[k][A][O]=new this.externalWorkerSourceTypes[A](q,this._getLayerIndex(k),this._getAvailableImages(k))}}return this.workerSources[k][A][O]}_getDEMWorkerSource(k,A){return this.demWorkerSources[k]||(this.demWorkerSources[k]={}),this.demWorkerSources[k][A]||(this.demWorkerSources[k][A]=new ae),this.demWorkerSources[k][A]}}return S.i(self)&&(self.worker=new yr(self)),yr}),N("index",["exports","./shared"],function(S,c){var ve="4.5.2";let ye,be;const le={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:u=>new Promise((t,n)=>{const o=requestAnimationFrame(t);u.signal.addEventListener("abort",()=>{cancelAnimationFrame(o),n(c.c())})}),getImageData(u,t=0){return this.getImageCanvasContext(u).getImageData(-t,-t,u.width+2*t,u.height+2*t)},getImageCanvasContext(u){const t=window.document.createElement("canvas"),n=t.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return t.width=u.width,t.height=u.height,n.drawImage(u,0,0,u.width,u.height),n},resolveURL:u=>(ye||(ye=document.createElement("a")),ye.href=u,ye.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(be==null&&(be=matchMedia("(prefers-reduced-motion: reduce)")),be.matches)}};class ae{static testProp(t){if(!ae.docStyle)return t[0];for(let n=0;n<t.length;n++)if(t[n]in ae.docStyle)return t[n];return t[0]}static create(t,n,o){const a=window.document.createElement(t);return n!==void 0&&(a.className=n),o&&o.appendChild(a),a}static createNS(t,n){return window.document.createElementNS(t,n)}static disableDrag(){ae.docStyle&&ae.selectProp&&(ae.userSelect=ae.docStyle[ae.selectProp],ae.docStyle[ae.selectProp]="none")}static enableDrag(){ae.docStyle&&ae.selectProp&&(ae.docStyle[ae.selectProp]=ae.userSelect)}static setTransform(t,n){t.style[ae.transformProp]=n}static addEventListener(t,n,o,a={}){t.addEventListener(n,o,"passive"in a?a:a.capture)}static removeEventListener(t,n,o,a={}){t.removeEventListener(n,o,"passive"in a?a:a.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",ae.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",ae.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",ae.suppressClickInternal,!0)},0)}static getScale(t){const n=t.getBoundingClientRect();return{x:n.width/t.offsetWidth||1,y:n.height/t.offsetHeight||1,boundingClientRect:n}}static getPoint(t,n,o){const a=n.boundingClientRect;return new c.P((o.clientX-a.left)/n.x-t.clientLeft,(o.clientY-a.top)/n.y-t.clientTop)}static mousePos(t,n){const o=ae.getScale(t);return ae.getPoint(t,o,n)}static touchPos(t,n){const o=[],a=ae.getScale(t);for(let h=0;h<n.length;h++)o.push(ae.getPoint(t,a,n[h]));return o}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}ae.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,ae.selectProp=ae.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),ae.transformProp=ae.testProp(["transform","WebkitTransform"]);const ut={supported:!1,testSupport:function(u){!Fe&&Ke&&(ht?Ye(u):je=u)}};let je,Ke,Fe=!1,ht=!1;function Ye(u){const t=u.createTexture();u.bindTexture(u.TEXTURE_2D,t);try{if(u.texImage2D(u.TEXTURE_2D,0,u.RGBA,u.RGBA,u.UNSIGNED_BYTE,Ke),u.isContextLost())return;ut.supported=!0}catch{}u.deleteTexture(t),Fe=!0}var Ue;typeof document<"u"&&(Ke=document.createElement("img"),Ke.onload=()=>{je&&Ye(je),je=null,ht=!0},Ke.onerror=()=>{Fe=!0,je=null},Ke.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(u){let t,n,o,a;u.resetRequestQueue=()=>{t=[],n=0,o=0,a={}},u.addThrottleControl=v=>{const b=o++;return a[b]=v,b},u.removeThrottleControl=v=>{delete a[v],m()},u.getImage=(v,b,P=!0)=>new Promise((E,L)=>{ut.supported&&(v.headers||(v.headers={}),v.headers.accept="image/webp,*/*"),c.e(v,{type:"image"}),t.push({abortController:b,requestParameters:v,supportImageRefresh:P,state:"queued",onError:B=>{L(B)},onSuccess:B=>{E(B)}}),m()});const h=v=>c._(this,void 0,void 0,function*(){v.state="running";const{requestParameters:b,supportImageRefresh:P,onError:E,onSuccess:L,abortController:B}=v,V=P===!1&&!c.i(self)&&!c.g(b.url)&&(!b.headers||Object.keys(b.headers).reduce((H,K)=>H&&K==="accept",!0));n++;const Z=V?_(b,B):c.m(b,B);try{const H=yield Z;delete v.abortController,v.state="completed",H.data instanceof HTMLImageElement||c.b(H.data)?L(H):H.data&&L({data:yield(U=H.data,typeof createImageBitmap=="function"?c.d(U):c.f(U)),cacheControl:H.cacheControl,expires:H.expires})}catch(H){delete v.abortController,E(H)}finally{n--,m()}var U}),m=()=>{const v=(()=>{for(const b of Object.keys(a))if(a[b]())return!0;return!1})()?c.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:c.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let b=n;b<v&&t.length>0;b++){const P=t.shift();P.abortController.signal.aborted?b--:h(P)}},_=(v,b)=>new Promise((P,E)=>{const L=new Image,B=v.url,V=v.credentials;V&&V==="include"?L.crossOrigin="use-credentials":(V&&V==="same-origin"||!c.s(B))&&(L.crossOrigin="anonymous"),b.signal.addEventListener("abort",()=>{L.src="",E(c.c())}),L.fetchPriority="high",L.onload=()=>{L.onerror=L.onload=null,P({data:L})},L.onerror=()=>{L.onerror=L.onload=null,b.signal.aborted||E(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},L.src=B})}(Ue||(Ue={})),Ue.resetRequestQueue();class bt{constructor(t){this._transformRequestFn=t}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function yt(u){var t=new c.A(3);return t[0]=u[0],t[1]=u[1],t[2]=u[2],t}var At,It=function(u,t,n){return u[0]=t[0]-n[0],u[1]=t[1]-n[1],u[2]=t[2]-n[2],u};At=new c.A(3),c.A!=Float32Array&&(At[0]=0,At[1]=0,At[2]=0);var Yi=function(u){var t=u[0],n=u[1];return t*t+n*n};function ri(u){const t=[];if(typeof u=="string")t.push({id:"default",url:u});else if(u&&u.length>0){const n=[];for(const{id:o,url:a}of u){const h=`${o}${a}`;n.indexOf(h)===-1&&(n.push(h),t.push({id:o,url:a}))}}return t}function Qi(u,t,n){const o=u.split("?");return o[0]+=`${t}${n}`,o.join("?")}(function(){var u=new c.A(2);c.A!=Float32Array&&(u[0]=0,u[1]=0)})();class wt{constructor(t,n,o,a){this.context=t,this.format=o,this.texture=t.gl.createTexture(),this.update(n,a)}update(t,n,o){const{width:a,height:h}=t,m=!(this.size&&this.size[0]===a&&this.size[1]===h||o),{context:_}=this,{gl:v}=_;if(this.useMipmap=!!(n&&n.useMipmap),v.bindTexture(v.TEXTURE_2D,this.texture),_.pixelStoreUnpackFlipY.set(!1),_.pixelStoreUnpack.set(1),_.pixelStoreUnpackPremultiplyAlpha.set(this.format===v.RGBA&&(!n||n.premultiply!==!1)),m)this.size=[a,h],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||c.b(t)?v.texImage2D(v.TEXTURE_2D,0,this.format,this.format,v.UNSIGNED_BYTE,t):v.texImage2D(v.TEXTURE_2D,0,this.format,a,h,0,this.format,v.UNSIGNED_BYTE,t.data);else{const{x:b,y:P}=o||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||c.b(t)?v.texSubImage2D(v.TEXTURE_2D,0,b,P,v.RGBA,v.UNSIGNED_BYTE,t):v.texSubImage2D(v.TEXTURE_2D,0,b,P,a,h,v.RGBA,v.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&v.generateMipmap(v.TEXTURE_2D)}bind(t,n,o){const{context:a}=this,{gl:h}=a;h.bindTexture(h.TEXTURE_2D,this.texture),o!==h.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(o=h.LINEAR),t!==this.filter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,t),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,o||t),this.filter=t),n!==this.wrap&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,n),h.texParameteri(h.TEXTURE_2D,h.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 Vs(u){const{userImage:t}=u;return!!(t&&t.render&&t.render())&&(u.data.replace(new Uint8Array(t.data.buffer)),!0)}class ci extends c.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new c.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,promiseResolve:o}of this.requestors)o(this._getImagesForIds(n));this.requestors=[]}}getImage(t){const n=this.images[t];if(n&&!n.data&&n.spriteData){const o=n.spriteData;n.data=new c.R({width:o.width,height:o.height},o.context.getImageData(o.x,o.y,o.width,o.height).data),n.spriteData=null}return n}addImage(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 o=!0;const a=n.data||n.spriteData;return this._validateStretch(n.stretchX,a&&a.width)||(this.fire(new c.j(new Error(`Image "${t}" has invalid "stretchX" value`))),o=!1),this._validateStretch(n.stretchY,a&&a.height)||(this.fire(new c.j(new Error(`Image "${t}" has invalid "stretchY" value`))),o=!1),this._validateContent(n.content,n)||(this.fire(new c.j(new Error(`Image "${t}" has invalid "content" value`))),o=!1),o}_validateStretch(t,n){if(!t)return!0;let o=0;for(const a of t){if(a[0]<o||a[1]<a[0]||n<a[1])return!1;o=a[1]}return!0}_validateContent(t,n){if(!t)return!0;if(t.length!==4)return!1;const o=n.spriteData,a=o&&o.width||n.data.width,h=o&&o.height||n.data.height;return!(t[0]<0||a<t[0]||t[1]<0||h<t[1]||t[2]<0||a<t[2]||t[3]<0||h<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,n,o=!0){const a=this.getImage(t);if(o&&(a.data.width!==n.data.width||a.data.height!==n.data.height))throw new Error(`size mismatch between old image (${a.data.width}x${a.data.height}) and new image (${n.data.width}x${n.data.height}).`);n.version=a.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){return new Promise((n,o)=>{let a=!0;if(!this.isLoaded())for(const h of t)this.images[h]||(a=!1);this.isLoaded()||a?n(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:n})})}_getImagesForIds(t){const n={};for(const o of t){let a=this.getImage(o);a||(this.fire(new c.k("styleimagemissing",{id:o})),a=this.getImage(o)),a?n[o]={data:a.data.clone(),pixelRatio:a.pixelRatio,sdf:a.sdf,version:a.version,stretchX:a.stretchX,stretchY:a.stretchY,content:a.content,textFitWidth:a.textFitWidth,textFitHeight:a.textFitHeight,hasRenderCallback:!!(a.userImage&&a.userImage.render)}:c.w(`Image "${o}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return n}getPixelSize(){const{width:t,height:n}=this.atlasImage;return{width:t,height:n}}getPattern(t){const n=this.patterns[t],o=this.getImage(t);if(!o)return null;if(n&&n.position.version===o.version)return n.position;if(n)n.position.version=o.version;else{const a={w:o.data.width+2,h:o.data.height+2,x:0,y:0},h=new c.I(a,o);this.patterns[t]={bin:a,position:h}}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 wt(t,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const h in this.patterns)t.push(this.patterns[h].bin);const{w:n,h:o}=c.p(t),a=this.atlasImage;a.resize({width:n||1,height:o||1});for(const h in this.patterns){const{bin:m}=this.patterns[h],_=m.x+1,v=m.y+1,b=this.getImage(h).data,P=b.width,E=b.height;c.R.copy(b,a,{x:0,y:0},{x:_,y:v},{width:P,height:E}),c.R.copy(b,a,{x:0,y:E-1},{x:_,y:v-1},{width:P,height:1}),c.R.copy(b,a,{x:0,y:0},{x:_,y:v+E},{width:P,height:1}),c.R.copy(b,a,{x:P-1,y:0},{x:_-1,y:v},{width:1,height:E}),c.R.copy(b,a,{x:0,y:0},{x:_+P,y:v},{width:1,height:E})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const o=this.getImage(n);o||c.w(`Image with ID: "${n}" was not found`),Vs(o)&&this.updateImage(n,o)}}}const wi=1e20;function Er(u,t,n,o,a,h,m,_,v){for(let b=t;b<t+o;b++)Pn(u,n*h+b,h,a,m,_,v);for(let b=n;b<n+a;b++)Pn(u,b*h+t,1,o,m,_,v)}function Pn(u,t,n,o,a,h,m){h[0]=0,m[0]=-wi,m[1]=wi,a[0]=u[t];for(let _=1,v=0,b=0;_<o;_++){a[_]=u[t+_*n];const P=_*_;do{const E=h[v];b=(a[_]-a[E]+P-E*E)/(_-E)/2}while(b<=m[v]&&--v>-1);v++,h[v]=_,m[v]=b,m[v+1]=wi}for(let _=0,v=0;_<o;_++){for(;m[v+1]<_;)v++;const b=h[v],P=_-b;u[t+_*n]=a[b]+P*P}}class pr{constructor(t,n){this.requestManager=t,this.localIdeographFontFamily=n,this.entries={}}setURL(t){this.url=t}getGlyphs(t){return c._(this,void 0,void 0,function*(){const n=[];for(const h in t)for(const m of t[h])n.push(this._getAndCacheGlyphsPromise(h,m));const o=yield Promise.all(n),a={};for(const{stack:h,id:m,glyph:_}of o)a[h]||(a[h]={}),a[h][m]=_&&{id:_.id,bitmap:_.bitmap.clone(),metrics:_.metrics};return a})}_getAndCacheGlyphsPromise(t,n){return c._(this,void 0,void 0,function*(){let o=this.entries[t];o||(o=this.entries[t]={glyphs:{},requests:{},ranges:{}});let a=o.glyphs[n];if(a!==void 0)return{stack:t,id:n,glyph:a};if(a=this._tinySDF(o,t,n),a)return o.glyphs[n]=a,{stack:t,id:n,glyph:a};const h=Math.floor(n/256);if(256*h>65535)throw new Error("glyphs > 65535 not supported");if(o.ranges[h])return{stack:t,id:n,glyph:a};if(!this.url)throw new Error("glyphsUrl is not set");if(!o.requests[h]){const _=pr.loadGlyphRange(t,h,this.url,this.requestManager);o.requests[h]=_}const m=yield o.requests[h];for(const _ in m)this._doesCharSupportLocalGlyph(+_)||(o.glyphs[+_]=m[+_]);return o.ranges[h]=!0,{stack:t,id:n,glyph:m[n]||null}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(c.u["CJK Unified Ideographs"](t)||c.u["Hangul Syllables"](t)||c.u.Hiragana(t)||c.u.Katakana(t))}_tinySDF(t,n,o){const a=this.localIdeographFontFamily;if(!a||!this._doesCharSupportLocalGlyph(o))return;let h=t.tinySDF;if(!h){let _="400";/bold/i.test(n)?_="900":/medium/i.test(n)?_="500":/light/i.test(n)&&(_="200"),h=t.tinySDF=new pr.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:a,fontWeight:_})}const m=h.draw(String.fromCharCode(o));return{id:o,bitmap:new c.o({width:m.width||60,height:m.height||60},m.data),metrics:{width:m.glyphWidth/2||24,height:m.glyphHeight/2||24,left:m.glyphLeft/2+.5||0,top:m.glyphTop/2-27.5||-8,advance:m.glyphAdvance/2||24,isDoubleResolution:!0}}}}pr.loadGlyphRange=function(u,t,n,o){return c._(this,void 0,void 0,function*(){const a=256*t,h=a+255,m=o.transformRequest(n.replace("{fontstack}",u).replace("{range}",`${a}-${h}`),"Glyphs"),_=yield c.l(m,new AbortController);if(!_||!_.data)throw new Error(`Could not load glyph range. range: ${t}, ${a}-${h}`);const v={};for(const b of c.n(_.data))v[b.id]=b;return v})},pr.TinySDF=class{constructor({fontSize:u=24,buffer:t=3,radius:n=8,cutoff:o=.25,fontFamily:a="sans-serif",fontWeight:h="normal",fontStyle:m="normal"}={}){this.buffer=t,this.cutoff=o,this.radius=n;const _=this.size=u+4*t,v=this._createCanvas(_),b=this.ctx=v.getContext("2d",{willReadFrequently:!0});b.font=`${m} ${h} ${u}px ${a}`,b.textBaseline="alphabetic",b.textAlign="left",b.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_createCanvas(u){const t=document.createElement("canvas");return t.width=t.height=u,t}draw(u){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:o,actualBoundingBoxLeft:a,actualBoundingBoxRight:h}=this.ctx.measureText(u),m=Math.ceil(n),_=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(h-a))),v=Math.min(this.size-this.buffer,m+Math.ceil(o)),b=_+2*this.buffer,P=v+2*this.buffer,E=Math.max(b*P,0),L=new Uint8ClampedArray(E),B={data:L,width:b,height:P,glyphWidth:_,glyphHeight:v,glyphTop:m,glyphLeft:0,glyphAdvance:t};if(_===0||v===0)return B;const{ctx:V,buffer:Z,gridInner:U,gridOuter:H}=this;V.clearRect(Z,Z,_,v),V.fillText(u,Z,Z+m);const K=V.getImageData(Z,Z,_,v);H.fill(wi,0,E),U.fill(0,0,E);for(let j=0;j<v;j++)for(let ee=0;ee<_;ee++){const ne=K.data[4*(j*_+ee)+3]/255;if(ne===0)continue;const ce=(j+Z)*b+ee+Z;if(ne===1)H[ce]=0,U[ce]=wi;else{const ge=.5-ne;H[ce]=ge>0?ge*ge:0,U[ce]=ge<0?ge*ge:0}}Er(H,0,0,b,P,b,this.f,this.v,this.z),Er(U,Z,Z,_,v,b,this.f,this.v,this.z);for(let j=0;j<E;j++){const ee=Math.sqrt(H[j])-Math.sqrt(U[j]);L[j]=Math.round(255-255*(ee/this.radius+this.cutoff))}return B}};class Ns{constructor(){this.specification=c.v.light.position}possiblyEvaluate(t,n){return c.y(t.expression.evaluate(n))}interpolate(t,n,o){return{x:c.z.number(t.x,n.x,o),y:c.z.number(t.y,n.y,o),z:c.z.number(t.z,n.z,o)}}}let sn;class Cr extends c.E{constructor(t){super(),sn=sn||new c.q({anchor:new c.D(c.v.light.anchor),position:new Ns,color:new c.D(c.v.light.color),intensity:new c.D(c.v.light.intensity)}),this._transitionable=new c.T(sn),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(c.r,t,n))for(const o in t){const a=t[o];o.endsWith("-transition")?this._transitionable.setTransition(o.slice(0,-11),a):this._transitionable.setValue(o,a)}}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,o){return(!o||o.validate!==!1)&&c.t(this,t.call(c.x,{value:n,style:{glyphs:!0,sprite:!0},styleSpec:c.v}))}}const Ci=new c.q({"sky-color":new c.D(c.v.sky["sky-color"]),"horizon-color":new c.D(c.v.sky["horizon-color"]),"fog-color":new c.D(c.v.sky["fog-color"]),"fog-ground-blend":new c.D(c.v.sky["fog-ground-blend"]),"horizon-fog-blend":new c.D(c.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new c.D(c.v.sky["sky-horizon-blend"]),"atmosphere-blend":new c.D(c.v.sky["atmosphere-blend"])});class er extends c.E{constructor(t){super(),this._transitionable=new c.T(Ci),this.setSky(t),this._transitioning=this._transitionable.untransitioned()}setSky(t,n={}){if(!this._validate(c.B,t,n))for(const o in t){const a=t[o];o.endsWith("-transition")?this._transitionable.setTransition(o.slice(0,-11),a):this._transitionable.setValue(o,a)}}getSky(){return this._transitionable.serialize()}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,o={}){return(o==null?void 0:o.validate)!==!1&&c.t(this,t.call(c.x,c.e({value:n,style:{glyphs:!0,sprite:!0},styleSpec:c.v})))}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}}class En{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 o=t.join(",")+String(n);return this.dashEntry[o]||(this.dashEntry[o]=this.addDash(t,n)),this.dashEntry[o]}getDashRanges(t,n,o){const a=[];let h=t.length%2==1?-t[t.length-1]*o:0,m=t[0]*o,_=!0;a.push({left:h,right:m,isDash:_,zeroLength:t[0]===0});let v=t[0];for(let b=1;b<t.length;b++){_=!_;const P=t[b];h=v*o,v+=P,m=v*o,a.push({left:h,right:m,isDash:_,zeroLength:P===0})}return a}addRoundDash(t,n,o){const a=n/2;for(let h=-o;h<=o;h++){const m=this.width*(this.nextRow+o+h);let _=0,v=t[_];for(let b=0;b<this.width;b++){b/v.right>1&&(v=t[++_]);const P=Math.abs(b-v.left),E=Math.abs(b-v.right),L=Math.min(P,E);let B;const V=h/o*(a+1);if(v.isDash){const Z=a-Math.abs(V);B=Math.sqrt(L*L+Z*Z)}else B=a-Math.sqrt(L*L+V*V);this.data[m+b]=Math.max(0,Math.min(255,B+128))}}}addRegularDash(t){for(let _=t.length-1;_>=0;--_){const v=t[_],b=t[_+1];v.zeroLength?t.splice(_,1):b&&b.isDash===v.isDash&&(b.left=v.left,t.splice(_,1))}const n=t[0],o=t[t.length-1];n.isDash===o.isDash&&(n.left=o.left-this.width,o.right=n.right+this.width);const a=this.width*this.nextRow;let h=0,m=t[h];for(let _=0;_<this.width;_++){_/m.right>1&&(m=t[++h]);const v=Math.abs(_-m.left),b=Math.abs(_-m.right),P=Math.min(v,b);this.data[a+_]=Math.max(0,Math.min(255,(m.isDash?P:-P)+128))}}addDash(t,n){const o=n?7:0,a=2*o+1;if(this.nextRow+a>this.height)return c.w("LineAtlas out of space"),null;let h=0;for(let _=0;_<t.length;_++)h+=t[_];if(h!==0){const _=this.width/h,v=this.getDashRanges(t,this.width,_);n?this.addRoundDash(v,_,o):this.addRegularDash(v)}const m={y:(this.nextRow+o+.5)/this.height,height:2*o/this.height,width:h};return this.nextRow+=a,this.dirty=!0,m}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))}}const Vr="maplibre_preloaded_worker_pool";class fr{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<fr.workerCount;)this.workers.push(new Worker(c.a.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[Vr]}numActive(){return Object.keys(this.active).length}}const Cn=Math.floor(le.hardwareConcurrency/2);let Fi,tr;function on(){return Fi||(Fi=new fr),Fi}fr.workerCount=c.C(globalThis)?Math.max(Math.min(Cn,3),1):1;class an{constructor(t,n){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=n;const o=this.workerPool.acquire(n);for(let a=0;a<o.length;a++){const h=new c.F(o[a],n);h.name=`Worker ${a}`,this.actors.push(h)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n){const o=[];for(const a of this.actors)o.push(a.sendAsync({type:t,data:n}));return Promise.all(o)}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)}registerMessageHandler(t,n){for(const o of this.actors)o.registerMessageHandler(t,n)}}function is(){return tr||(tr=new an(on(),c.G),tr.registerMessageHandler("GR",(u,t,n)=>c.m(t,n))),tr}function Ar(u,t){const n=c.H();return c.J(n,n,[1,1,0]),c.K(n,n,[.5*u.width,.5*u.height,1]),c.L(n,n,u.calculatePosMatrix(t.toUnwrapped()))}function Nr(u,t,n,o,a,h){const m=function(E,L,B){if(E)for(const V of E){const Z=L[V];if(Z&&Z.source===B&&Z.type==="fill-extrusion")return!0}else for(const V in L){const Z=L[V];if(Z.source===B&&Z.type==="fill-extrusion")return!0}return!1}(a&&a.layers,t,u.id),_=h.maxPitchScaleFactor(),v=u.tilesIn(o,_,m);v.sort(jr);const b=[];for(const E of v)b.push({wrappedTileID:E.tileID.wrapped().key,queryResults:E.tile.queryRenderedFeatures(t,n,u._state,E.queryGeometry,E.cameraQueryGeometry,E.scale,a,h,_,Ar(u.transform,E.tileID))});const P=function(E){const L={},B={};for(const V of E){const Z=V.queryResults,U=V.wrappedTileID,H=B[U]=B[U]||{};for(const K in Z){const j=Z[K],ee=H[K]=H[K]||{},ne=L[K]=L[K]||[];for(const ce of j)ee[ce.featureIndex]||(ee[ce.featureIndex]=!0,ne.push(ce))}}return L}(b);for(const E in P)P[E].forEach(L=>{const B=L.feature,V=u.getFeatureState(B.layer["source-layer"],B.id);B.source=B.layer.source,B.layer["source-layer"]&&(B.sourceLayer=B.layer["source-layer"]),B.state=V});return P}function jr(u,t){const n=u.tileID,o=t.tileID;return n.overscaledZ-o.overscaledZ||n.canonical.y-o.canonical.y||n.wrap-o.wrap||n.canonical.x-o.canonical.x}function An(u,t,n){return c._(this,void 0,void 0,function*(){let o=u;if(u.url?o=(yield c.h(t.transformRequest(u.url,"Source"),n)).data:yield le.frameAsync(n),!o)return null;const a=c.M(c.e(o,u),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in o&&o.vector_layers&&(a.vectorLayerIds=o.vector_layers.map(h=>h.id)),a})}class ue{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 c.N?new c.N(t.lng,t.lat):c.N.convert(t),this}setSouthWest(t){return this._sw=t instanceof c.N?new c.N(t.lng,t.lat):c.N.convert(t),this}extend(t){const n=this._sw,o=this._ne;let a,h;if(t instanceof c.N)a=t,h=t;else{if(!(t instanceof ue))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(ue.convert(t)):this.extend(c.N.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(c.N.convert(t)):this;if(a=t._sw,h=t._ne,!a||!h)return this}return n||o?(n.lng=Math.min(a.lng,n.lng),n.lat=Math.min(a.lat,n.lat),o.lng=Math.max(h.lng,o.lng),o.lat=Math.max(h.lat,o.lat)):(this._sw=new c.N(a.lng,a.lat),this._ne=new c.N(h.lng,h.lat)),this}getCenter(){return new c.N((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new c.N(this.getWest(),this.getNorth())}getSouthEast(){return new c.N(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){const{lng:n,lat:o}=c.N.convert(t);let a=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=o&&o<=this._ne.lat&&a}static convert(t){return t instanceof ue?t:t&&new ue(t)}static fromLngLat(t,n=0){const o=360*n/40075017,a=o/Math.cos(Math.PI/180*t.lat);return new ue(new c.N(t.lng-a,t.lat-o),new c.N(t.lng+a,t.lat+o))}}class ln{constructor(t,n,o){this.bounds=ue.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=o||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),o=Math.floor(c.O(this.bounds.getWest())*n),a=Math.floor(c.Q(this.bounds.getNorth())*n),h=Math.ceil(c.O(this.bounds.getEast())*n),m=Math.ceil(c.Q(this.bounds.getSouth())*n);return t.x>=o&&t.x<h&&t.y>=a&&t.y<m}}class rs extends c.E{constructor(t,n,o,a){if(super(),this.id=t,this.dispatcher=o,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,c.e(this,c.M(n,["url","scheme","tileSize","promoteId"])),this._options=c.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(a)}load(){return c._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const t=yield An(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t&&(c.e(this,t),t.bounds&&(this.tileBounds=new ln(t.bounds,this.minzoom,this.maxzoom)),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.k("data",{dataType:"source",sourceDataType:"content"})))}catch(t){this._tileJSONRequest=null,this.fire(new c.j(t))}})}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.abort(),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.abort(),this._tileJSONRequest=null)}serialize(){return c.e({},this._options)}loadTile(t){return c._(this,void 0,void 0,function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),o={request:this.map._requestManager.transformRequest(n,"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};o.request.collectResourceTiming=this._collectResourceTiming;let a="RT";if(t.actor&&t.state!=="expired"){if(t.state==="loading")return new Promise((h,m)=>{t.reloadPromise={resolve:h,reject:m}})}else t.actor=this.dispatcher.getActor(),a="LT";t.abortController=new AbortController;try{const h=yield t.actor.sendAsync({type:a,data:o},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,h)}catch(h){if(delete t.abortController,t.aborted)return;if(h&&h.status!==404)throw h;this._afterTileLoadWorkerResponse(t,null)}})}_afterTileLoadWorkerResponse(t,n){if(n&&n.resourceTiming&&(t.resourceTiming=n.resourceTiming),n&&this.map._refreshExpiredTiles&&t.setExpiryData(n),t.loadVectorData(n,this.map.painter),t.reloadPromise){const o=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(o.resolve).catch(o.reject)}}abortTile(t){return c._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.type,source:this.id}}))})}unloadTile(t){return c._(this,void 0,void 0,function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class xt extends c.E{constructor(t,n,o,a){super(),this.id=t,this.dispatcher=o,this.setEventedParent(a),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=c.e({type:"raster"},n),c.e(this,c.M(n,["url","scheme","tileSize"]))}load(){return c._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const t=yield An(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,t&&(c.e(this,t),t.bounds&&(this.tileBounds=new ln(t.bounds,this.minzoom,this.maxzoom)),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.k("data",{dataType:"source",sourceDataType:"content"})))}catch(t){this._tileJSONRequest=null,this.fire(new c.j(t))}})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}serialize(){return c.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return c._(this,void 0,void 0,function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{const o=yield Ue.getImage(this.map._requestManager.transformRequest(n,"Tile"),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(o&&o.data){this.map._refreshExpiredTiles&&o.cacheControl&&o.expires&&t.setExpiryData({cacheControl:o.cacheControl,expires:o.expires});const a=this.map.painter.context,h=a.gl,m=o.data;t.texture=this.map.painter.getTileTexture(m.width),t.texture?t.texture.update(m,{useMipmap:!0}):(t.texture=new wt(a,m,h.RGBA,{useMipmap:!0}),t.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE,h.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(o){if(delete t.abortController,t.aborted)t.state="unloaded";else if(o)throw t.state="errored",o}})}abortTile(t){return c._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)})}unloadTile(t){return c._(this,void 0,void 0,function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)})}hasTransition(){return!1}}class $t extends xt{constructor(t,n,o,a){super(t,n,o,a),this.type="raster-dem",this.maxzoom=22,this._options=c.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){return c._(this,void 0,void 0,function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),o=this.map._requestManager.transformRequest(n,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{const a=yield Ue.getImage(o,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(a&&a.data){const h=a.data;this.map._refreshExpiredTiles&&a.cacheControl&&a.expires&&t.setExpiryData({cacheControl:a.cacheControl,expires:a.expires});const m=c.b(h)&&c.U()?h:yield this.readImageNow(h),_={type:this.type,uid:t.uid,source:this.id,rawImageData:m,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!t.actor||t.state==="expired"){t.actor=this.dispatcher.getActor();const v=yield t.actor.sendAsync({type:"LDT",data:_});t.dem=v,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}}catch(a){if(delete t.abortController,t.aborted)t.state="unloaded";else if(a)throw t.state="errored",a}})}readImageNow(t){return c._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&c.V()){const n=t.width+2,o=t.height+2;try{return new c.R({width:n,height:o},yield c.W(t,-1,-1,n,o))}catch{}}return le.getImageData(t,1)})}_getNeighboringTiles(t){const n=t.canonical,o=Math.pow(2,n.z),a=(n.x-1+o)%o,h=n.x===0?t.wrap-1:t.wrap,m=(n.x+1+o)%o,_=n.x+1===o?t.wrap+1:t.wrap,v={};return v[new c.S(t.overscaledZ,h,n.z,a,n.y).key]={backfilled:!1},v[new c.S(t.overscaledZ,_,n.z,m,n.y).key]={backfilled:!1},n.y>0&&(v[new c.S(t.overscaledZ,h,n.z,a,n.y-1).key]={backfilled:!1},v[new c.S(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},v[new c.S(t.overscaledZ,_,n.z,m,n.y-1).key]={backfilled:!1}),n.y+1<o&&(v[new c.S(t.overscaledZ,h,n.z,a,n.y+1).key]={backfilled:!1},v[new c.S(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},v[new c.S(t.overscaledZ,_,n.z,m,n.y+1).key]={backfilled:!1}),v}unloadTile(t){return c._(this,void 0,void 0,function*(){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&&(yield t.actor.sendAsync({type:"RDT",data:{type:this.type,uid:t.uid,source:this.id}}))})}}class ns extends c.E{constructor(t,n,o,a){super(),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=o.getActor(),this.setEventedParent(a),this._data=n.data,this._options=c.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 h=c.X/this.tileSize;this.workerOptions=c.e({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*h,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*h,extent:c.X,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:c.X,radius:(n.clusterRadius||50)*h,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}load(){return c._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData(),this}updateData(t){return this._updateWorkerData(t),this}getData(){return c._(this,void 0,void 0,function*(){const t=c.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:t})})}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){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:t,source:this.id}})}getClusterChildren(t){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:t,source:this.id}})}getClusterLeaves(t,n,o){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:n,offset:o}})}_updateWorkerData(t){return c._(this,void 0,void 0,function*(){const n=c.e({type:this.type},this.workerOptions);t?n.dataDiff=t:typeof this._data=="string"?(n.request=this.map._requestManager.transformRequest(le.resolveURL(this._data),"Source"),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new c.k("dataloading",{dataType:"source"}));try{const o=yield this.actor.sendAsync({type:"LD",data:n});if(this._pendingLoads--,this._removed||o.abandoned)return void this.fire(new c.k("dataabort",{dataType:"source"}));let a=null;o.resourceTiming&&o.resourceTiming[this.id]&&(a=o.resourceTiming[this.id].slice(0));const h={dataType:"source"};this._collectResourceTiming&&a&&a.length>0&&c.e(h,{resourceTiming:a}),this.fire(new c.k("data",Object.assign(Object.assign({},h),{sourceDataType:"metadata"}))),this.fire(new c.k("data",Object.assign(Object.assign({},h),{sourceDataType:"content"})))}catch(o){if(this._pendingLoads--,this._removed)return void this.fire(new c.k("dataabort",{dataType:"source"}));this.fire(new c.j(o))}})}loaded(){return this._pendingLoads===0}loadTile(t){return c._(this,void 0,void 0,function*(){const n=t.actor?"RT":"LT";t.actor=this.actor;const o={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.abortController=new AbortController;const a=yield this.actor.sendAsync({type:n,data:o},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(a,this.map.painter,n==="RT")})}abortTile(t){return c._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0})}unloadTile(t){return c._(this,void 0,void 0,function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return c.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Ur=c.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class kr extends c.E{constructor(t,n,o,a){super(),this.id=t,this.dispatcher=o,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(a),this.options=n}load(t){return c._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const n=yield Ue.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,n&&n.data&&(this.image=n.data,t&&(this.coordinates=t),this._finishLoading())}catch(n){this._request=null,this._loaded=!0,this.fire(new c.j(n))}})}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;const n=t.map(c.Z.fromLngLat);this.tileID=function(a){let h=1/0,m=1/0,_=-1/0,v=-1/0;for(const L of a)h=Math.min(h,L.x),m=Math.min(m,L.y),_=Math.max(_,L.x),v=Math.max(v,L.y);const b=Math.max(_-h,v-m),P=Math.max(0,Math.floor(-Math.log(b)/Math.LN2)),E=Math.pow(2,P);return new c.a1(P,Math.floor((h+_)/2*E),Math.floor((m+v)/2*E))}(n),this.minzoom=this.maxzoom=this.tileID.z;const o=n.map(a=>this.tileID.getTilePoint(a)._round());return this._boundsArray=new c.$,this._boundsArray.emplaceBack(o[0].x,o[0].y,0,0),this._boundsArray.emplaceBack(o[1].x,o[1].y,c.X,0),this._boundsArray.emplaceBack(o[3].x,o[3].y,0,c.X),this._boundsArray.emplaceBack(o[2].x,o[2].y,c.X,c.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new c.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Ur.members)),this.boundsSegments||(this.boundsSegments=c.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new wt(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let o=!1;for(const a in this.tiles){const h=this.tiles[a];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture,o=!0)}o&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return c._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class kn extends kr{constructor(t,n,o,a){super(t,n,o,a),this.roundZoom=!0,this.type="video",this.options=n}load(){return c._(this,void 0,void 0,function*(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push(this.map._requestManager.transformRequest(n,"Source").url);try{const n=yield c.a3(this.urls);if(this._loaded=!0,!n)return;this.video=n,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(n){this.fire(new c.j(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 c.j(new c.a2(`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)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Ur.members)),this.boundsSegments||(this.boundsSegments=c.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new wt(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let o=!1;for(const a in this.tiles){const h=this.tiles[a];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture,o=!0)}o&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Hi extends kr{constructor(t,n,o,a){super(t,n,o,a),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(h=>!Array.isArray(h)||h.length!==2||h.some(m=>typeof m!="number"))||this.fire(new c.j(new c.a2(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new c.j(new c.a2(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new c.j(new c.a2(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new c.j(new c.a2(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new c.j(new c.a2(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){return c._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new c.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const n=this.map.painter.context,o=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,Ur.members)),this.boundsSegments||(this.boundsSegments=c.a0.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new wt(n,this.canvas,o.RGBA,{premultiply:!0});let a=!1;for(const h in this.tiles){const m=this.tiles[h];m.state!=="loaded"&&(m.state="loaded",m.texture=this.texture,a=!0)}a&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const ss={},os=u=>{switch(u){case"geojson":return ns;case"image":return kr;case"raster":return xt;case"raster-dem":return $t;case"vector":return rs;case"video":return kn;case"canvas":return Hi}return ss[u]},Ie="RTLPluginLoaded";class mr extends c.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=is()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch(n=>{throw this.status="error",n})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return c._(this,arguments,void 0,function*(n,o=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=le.resolveURL(n),!this.url)throw new Error(`requested url ${n} is invalid`);if(this.status==="unavailable"){if(!o)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return c._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new c.k(Ie))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Si=null;function gr(){return Si||(Si=new mr),Si}class $r{constructor(t,n){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=c.a4(),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,o){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(a,h){const m={};if(!h)return m;for(const _ of a){const v=_.layerIds.map(b=>h.getLayer(b)).filter(Boolean);if(v.length!==0){_.layers=v,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(b=>v.filter(P=>P.id===b)[0]));for(const b of v)m[b.id]=_}}return m}(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const a in this.buckets){const h=this.buckets[a];if(h instanceof c.a6){if(this.hasSymbolBuckets=!0,!o)break;h.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const a in this.buckets){const h=this.buckets[a];if(h instanceof c.a6&&h.hasRTLText){this.hasRTLText=!0,gr().lazyLoad();break}}this.queryPadding=0;for(const a in this.buckets){const h=this.buckets[a];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(a).queryRadius(h))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new c.a5}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const o in this.buckets){const a=this.buckets[o];a.uploadPending()&&a.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new wt(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new wt(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,o,a,h,m,_,v,b,P){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:a,cameraQueryGeometry:h,scale:m,tileSize:this.tileSize,pixelPosMatrix:P,transform:v,params:_,queryPadding:this.queryPadding*b},t,n,o):{}}querySourceFeatures(t,n){const o=this.latestFeatureIndex;if(!o||!o.rawTileData)return;const a=o.loadVTLayers(),h=n&&n.sourceLayer?n.sourceLayer:"",m=a._geojsonTileLayer||a[h];if(!m)return;const _=c.a7(n&&n.filter),{z:v,x:b,y:P}=this.tileID.canonical,E={z:v,x:b,y:P};for(let L=0;L<m.length;L++){const B=m.feature(L);if(_.needGeometry){const U=c.a8(B,!0);if(!_.filter(new c.a9(this.tileID.overscaledZ),U,this.tileID.canonical))continue}else if(!_.filter(new c.a9(this.tileID.overscaledZ),B))continue;const V=o.getId(B,h),Z=new c.aa(B,v,b,P,V);Z.tile=E,t.push(Z)}}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 o=c.ab(t.cacheControl);o["max-age"]&&(this.expirationTime=Date.now()+1e3*o["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const o=Date.now();let a=!1;if(this.expirationTime>o)a=!1;else if(n)if(this.expirationTime<n)a=!0;else{const h=this.expirationTime-n;h?this.expirationTime=o+Math.max(h,3e4):a=!0}else a=!0;a?(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 o=this.latestFeatureIndex.loadVTLayers();for(const a in this.buckets){if(!n.style.hasLayer(a))continue;const h=this.buckets[a],m=h.layers[0].sourceLayer||"_geojsonTileLayer",_=o[m],v=t[m];if(!_||!v||Object.keys(v).length===0)continue;h.update(v,_,this.imageAtlas&&this.imageAtlas.patternPositions||{});const b=n&&n.style&&n.style.getLayer(a);b&&(this.queryPadding=Math.max(this.queryPadding,b.queryRadius(h)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<le.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=le.now()+t}setDependencies(t,n){const o={};for(const a of n)o[a]=!0;this.dependencies[t]=o}hasDependency(t,n){for(const o of t){const a=this.dependencies[o];if(a){for(const h of n)if(a[h])return!0}}return!1}}class Ce{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,o){const a=t.wrapped().key;this.data[a]===void 0&&(this.data[a]=[]);const h={value:n,timeout:void 0};if(o!==void 0&&(h.timeout=setTimeout(()=>{this.remove(t,h)},o)),this.data[a].push(h),this.order.push(a),this.order.length>this.max){const m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}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 o=t.wrapped().key,a=n===void 0?0:this.data[o].indexOf(n),h=this.data[o][a];return this.data[o].splice(a,1),h.timeout&&clearTimeout(h.timeout),this.data[o].length===0&&delete this.data[o],this.onRemove(h.value),this.order.splice(this.order.indexOf(o),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 o in this.data)for(const a of this.data[o])t(a.value)||n.push(a);for(const o of n)this.remove(o.value.tileID,o)}}class at{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,o){const a=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][a]=this.stateChanges[t][a]||{},c.e(this.stateChanges[t][a],o),this.deletedStates[t]===null){this.deletedStates[t]={};for(const h in this.state[t])h!==a&&(this.deletedStates[t][h]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][a]===null){this.deletedStates[t][a]={};for(const h in this.state[t][a])o[h]||(this.deletedStates[t][a][h]=null)}else for(const h in o)this.deletedStates[t]&&this.deletedStates[t][a]&&this.deletedStates[t][a][h]===null&&delete this.deletedStates[t][a][h]}removeFeatureState(t,n,o){if(this.deletedStates[t]===null)return;const a=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},o&&n!==void 0)this.deletedStates[t][a]!==null&&(this.deletedStates[t][a]=this.deletedStates[t][a]||{},this.deletedStates[t][a][o]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][a])for(o in this.deletedStates[t][a]={},this.stateChanges[t][a])this.deletedStates[t][a][o]=null;else this.deletedStates[t][a]=null;else this.deletedStates[t]=null}getState(t,n){const o=String(n),a=c.e({},(this.state[t]||{})[o],(this.stateChanges[t]||{})[o]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const h=this.deletedStates[t][n];if(h===null)return{};for(const m in h)delete a[m]}return a}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const o={};for(const a in this.stateChanges){this.state[a]=this.state[a]||{};const h={};for(const m in this.stateChanges[a])this.state[a][m]||(this.state[a][m]={}),c.e(this.state[a][m],this.stateChanges[a][m]),h[m]=this.state[a][m];o[a]=h}for(const a in this.deletedStates){this.state[a]=this.state[a]||{};const h={};if(this.deletedStates[a]===null)for(const m in this.state[a])h[m]={},this.state[a][m]={};else for(const m in this.deletedStates[a]){if(this.deletedStates[a][m]===null)this.state[a][m]={};else for(const _ of Object.keys(this.deletedStates[a][m]))delete this.state[a][m][_];h[m]=this.state[a][m]}o[a]=o[a]||{},c.e(o[a],h)}if(this.stateChanges={},this.deletedStates={},Object.keys(o).length!==0)for(const a in t)t[a].setFeatureState(o,n)}}class Qe extends c.E{constructor(t,n,o){super(),this.id=t,this.dispatcher=o,this.on("data",a=>this._dataHandler(a)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((a,h,m,_)=>{const v=new(os(h.type))(a,h,m,_);if(v.id!==a)throw new Error(`Expected Source id to be ${a} instead of ${v.id}`);return v})(t,n,o,this),this._tiles={},this._cache=new Ce(0,a=>this._unloadTile(a)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new at,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,o){return c._(this,void 0,void 0,function*(){try{yield this._source.loadTile(t),this._tileLoaded(t,n,o)}catch(a){t.state="errored",a.status!==404?this._source.fire(new c.j(a,{tile:t})):this.update(this.transform,this.terrain)}})}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new c.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 o=this._tiles[n];o.upload(t),o.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(Ai).map(t=>t.key)}getRenderableIds(t){const n=[];for(const o in this._tiles)this._isIdRenderable(o,t)&&n.push(this._tiles[o]);return t?n.sort((o,a)=>{const h=o.tileID,m=a.tileID,_=new c.P(h.canonical.x,h.canonical.y)._rotate(this.transform.angle),v=new c.P(m.canonical.x,m.canonical.y)._rotate(this.transform.angle);return h.overscaledZ-m.overscaledZ||v.y-_.y||v.x-_.x}).map(o=>o.tileID.key):n.map(o=>o.tileID).sort(Ai).map(o=>o.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){return c._(this,void 0,void 0,function*(){const o=this._tiles[t];o&&(o.state!=="loading"&&(o.state=n),yield this._loadTile(o,t,n))})}_tileLoaded(t,n,o){t.timeAdded=le.now(),o==="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 c.k("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const n=this.getRenderableIds();for(let a=0;a<n.length;a++){const h=n[a];if(t.neighboringTiles&&t.neighboringTiles[h]){const m=this.getTileByID(h);o(t,m),o(m,t)}}function o(a,h){a.needsHillshadePrepare=!0,a.needsTerrainPrepare=!0;let m=h.tileID.canonical.x-a.tileID.canonical.x;const _=h.tileID.canonical.y-a.tileID.canonical.y,v=Math.pow(2,a.tileID.canonical.z),b=h.tileID.key;m===0&&_===0||Math.abs(_)>1||(Math.abs(m)>1&&(Math.abs(m+v)===1?m+=v:Math.abs(m-v)===1&&(m-=v)),h.dem&&a.dem&&(a.dem.backfillBorder(h.dem,m,_),a.neighboringTiles&&a.neighboringTiles[b]&&(a.neighboringTiles[b].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,o,a){for(const h in this._tiles){let m=this._tiles[h];if(a[h]||!m.hasData()||m.tileID.overscaledZ<=n||m.tileID.overscaledZ>o)continue;let _=m.tileID;for(;m&&m.tileID.overscaledZ>n+1;){const b=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[b.key],m&&m.hasData()&&(_=b)}let v=_;for(;v.overscaledZ>n;)if(v=v.scaledTo(v.overscaledZ-1),t[v.key]){a[_.key]=_;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const o=this._loadedParentTiles[t.key];return o&&o.tileID.overscaledZ>=n?o:null}for(let o=t.overscaledZ-1;o>=n;o--){const a=t.scaledTo(o),h=this._getLoadedTile(a);if(h)return h}}findLoadedSibling(t){return this._getLoadedTile(t)}_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,o=Math.ceil(t.height/this._source.tileSize)+1,a=Math.floor(n*o*(this._maxTileCacheZoomLevels===null?c.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),h=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,a):a;this._cache.setMaxSize(h)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const o={};for(const a in this._tiles){const h=this._tiles[a];h.tileID=h.tileID.unwrapTo(h.tileID.wrap+n),o[h.tileID.key]=h}this._tiles=o;for(const a in this._timers)clearTimeout(this._timers[a]),delete this._timers[a];for(const a in this._tiles)this._setTileReloadTimer(a,this._tiles[a])}}_updateCoveredAndRetainedTiles(t,n,o,a,h,m){const _={},v={},b=Object.keys(t),P=le.now();for(const E of b){const L=t[E],B=this._tiles[E];if(!B||B.fadeEndTime!==0&&B.fadeEndTime<=P)continue;const V=this.findLoadedParent(L,n),Z=this.findLoadedSibling(L),U=V||Z||null;U&&(this._addTile(U.tileID),_[U.tileID.key]=U.tileID),v[E]=L}this._retainLoadedChildren(v,a,o,t);for(const E in _)t[E]||(this._coveredTiles[E]=!0,t[E]=_[E]);if(m){const E={},L={};for(const B of h)this._tiles[B.key].hasData()?E[B.key]=B:L[B.key]=B;for(const B in L){const V=L[B].children(this._source.maxzoom);this._tiles[V[0].key]&&this._tiles[V[1].key]&&this._tiles[V[2].key]&&this._tiles[V[3].key]&&(E[V[0].key]=t[V[0].key]=V[0],E[V[1].key]=t[V[1].key]=V[1],E[V[2].key]=t[V[2].key]=V[2],E[V[3].key]=t[V[3].key]=V[3],delete L[B])}for(const B in L){const V=L[B],Z=this.findLoadedParent(V,this._source.minzoom),U=this.findLoadedSibling(V),H=Z||U||null;if(H){E[H.tileID.key]=t[H.tileID.key]=H.tileID;for(const K in E)E[K].isChildOf(H.tileID)&&delete E[K]}}for(const B in this._tiles)E[B]||(this._coveredTiles[B]=!0)}}update(t,n){if(!this._sourceLoaded||this._paused)return;let o;this.transform=t,this.terrain=n,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?o=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(P=>new c.S(P.canonical.z,P.wrap,P.canonical.z,P.canonical.x,P.canonical.y)):(o=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&&(o=o.filter(P=>this._source.hasTile(P)))):o=[];const a=t.coveringZoomLevel(this._source),h=Math.max(a-Qe.maxOverzooming,this._source.minzoom),m=Math.max(a+Qe.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const P={};for(const E of o)if(E.canonical.z>this._source.minzoom){const L=E.scaledTo(E.canonical.z-1);P[L.key]=L;const B=E.scaledTo(Math.max(this._source.minzoom,Math.min(E.canonical.z,5)));P[B.key]=B}o=o.concat(Object.values(P))}const _=o.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,_&&this.fire(new c.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const v=this._updateRetainedTiles(o,a);ir(this._source.type)&&this._updateCoveredAndRetainedTiles(v,h,m,a,o,n);for(const P in v)this._tiles[P].clearFadeHold();const b=c.ac(this._tiles,v);for(const P of b){const E=this._tiles[P];E.hasSymbolBuckets&&!E.holdingForFade()?E.setHoldDuration(this.map._fadeDuration):E.hasSymbolBuckets&&!E.symbolFadeFinished()||this._removeTile(P)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){var o;const a={},h={},m=Math.max(n-Qe.maxOverzooming,this._source.minzoom),_=Math.max(n+Qe.maxUnderzooming,this._source.minzoom),v={};for(const b of t){const P=this._addTile(b);a[b.key]=b,P.hasData()||n<this._source.maxzoom&&(v[b.key]=b)}this._retainLoadedChildren(v,n,_,a);for(const b of t){let P=this._tiles[b.key];if(P.hasData())continue;if(n+1>this._source.maxzoom){const L=b.children(this._source.maxzoom)[0],B=this.getTile(L);if(B&&B.hasData()){a[L.key]=L;continue}}else{const L=b.children(this._source.maxzoom);if(a[L[0].key]&&a[L[1].key]&&a[L[2].key]&&a[L[3].key])continue}let E=P.wasRequested();for(let L=b.overscaledZ-1;L>=m;--L){const B=b.scaledTo(L);if(h[B.key])break;if(h[B.key]=!0,P=this.getTile(B),!P&&E&&(P=this._addTile(B)),P){const V=P.hasData();if((V||!(!((o=this.map)===null||o===void 0)&&o.cancelPendingTileRequestsWhileZooming)||E)&&(a[B.key]=B),E=P.wasRequested(),V)break}}}return a}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let o,a=this._tiles[t].tileID;for(;a.overscaledZ>0;){if(a.key in this._loadedParentTiles){o=this._loadedParentTiles[a.key];break}n.push(a.key);const h=a.scaledTo(a.overscaledZ-1);if(o=this._getLoadedTile(h),o)break;a=h}for(const h of n)this._loadedParentTiles[h]=o}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const t in this._tiles){const n=this._tiles[t].tileID,o=this._getLoadedTile(n);this._loadedSiblingTiles[n.key]=o}}_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 o=n;return n||(n=new $r(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,t.key,n.state)),n.uses++,this._tiles[t.key]=n,o||this._source.fire(new c.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 o=n.getExpiryTimeout();o&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},o))}_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))))}_dataHandler(t){const n=t.sourceDataType;t.dataType==="source"&&n==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&t.dataType==="source"&&n==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,n,o){const a=[],h=this.transform;if(!h)return a;const m=o?h.getCameraQueryGeometry(t):t,_=t.map(V=>h.pointCoordinate(V,this.terrain)),v=m.map(V=>h.pointCoordinate(V,this.terrain)),b=this.getIds();let P=1/0,E=1/0,L=-1/0,B=-1/0;for(const V of v)P=Math.min(P,V.x),E=Math.min(E,V.y),L=Math.max(L,V.x),B=Math.max(B,V.y);for(let V=0;V<b.length;V++){const Z=this._tiles[b[V]];if(Z.holdingForFade())continue;const U=Z.tileID,H=Math.pow(2,h.zoom-Z.tileID.overscaledZ),K=n*Z.queryPadding*c.X/Z.tileSize/H,j=[U.getTilePoint(new c.Z(P,E)),U.getTilePoint(new c.Z(L,B))];if(j[0].x-K<c.X&&j[0].y-K<c.X&&j[1].x+K>=0&&j[1].y+K>=0){const ee=_.map(ce=>U.getTilePoint(ce)),ne=v.map(ce=>U.getTilePoint(ce));a.push({tile:Z,tileID:U,queryGeometry:ee,cameraQueryGeometry:ne,scale:H})}}return a}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map(o=>this._tiles[o].tileID);for(const o of n)o.posMatrix=this.transform.calculatePosMatrix(o.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(ir(this._source.type)){const t=le.now();for(const n in this._tiles)if(this._tiles[n].fadeEndTime>=t)return!0}return!1}setFeatureState(t,n,o){this._state.updateState(t=t||"_geojsonTileLayer",n,o)}removeFeatureState(t,n,o){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,o)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,o){const a=this._tiles[t];a&&a.setDependencies(n,o)}reloadTilesForDependencies(t,n){for(const o in this._tiles)this._tiles[o].hasDependency(t,n)&&this._reloadTile(o,"reloading");this._cache.filter(o=>!o.hasDependency(t,n))}}function Ai(u,t){const n=Math.abs(2*u.wrap)-+(u.wrap<0),o=Math.abs(2*t.wrap)-+(t.wrap<0);return u.overscaledZ-t.overscaledZ||o-n||t.canonical.y-u.canonical.y||t.canonical.x-u.canonical.x}function ir(u){return u==="raster"||u==="image"||u==="video"}Qe.maxOverzooming=10,Qe.maxUnderzooming=3;class rt{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let o=1;o<this.points.length;o++)this._distances[o]=this._distances[o-1]+this.points[o].dist(this.points[o-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=c.ad(t,0,1);let n=1,o=this._distances[n];const a=t*this.paddedLength+this.padding;for(;o<a&&n<this._distances.length;)o=this._distances[++n];const h=n-1,m=this._distances[h],_=o-m,v=_>0?(a-m)/_:0;return this.points[h].mult(1-v).add(this.points[n].mult(v))}}function _r(u,t){let n=!0;return u==="always"||u!=="never"&&t!=="never"||(n=!1),n}class Mr{constructor(t,n,o){const a=this.boxCells=[],h=this.circleCells=[];this.xCellCount=Math.ceil(t/o),this.yCellCount=Math.ceil(n/o);for(let m=0;m<this.xCellCount*this.yCellCount;m++)a.push([]),h.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,o,a,h){this._forEachCell(n,o,a,h,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(o),this.bboxes.push(a),this.bboxes.push(h)}insertCircle(t,n,o,a){this._forEachCell(n-a,o-a,n+a,o+a,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(o),this.circles.push(a)}_insertBoxCell(t,n,o,a,h,m){this.boxCells[h].push(m)}_insertCircleCell(t,n,o,a,h,m){this.circleCells[h].push(m)}_query(t,n,o,a,h,m,_){if(o<0||t>this.width||a<0||n>this.height)return[];const v=[];if(t<=0&&n<=0&&this.width<=o&&this.height<=a){if(h)return[{key:null,x1:t,y1:n,x2:o,y2:a}];for(let b=0;b<this.boxKeys.length;b++)v.push({key:this.boxKeys[b],x1:this.bboxes[4*b],y1:this.bboxes[4*b+1],x2:this.bboxes[4*b+2],y2:this.bboxes[4*b+3]});for(let b=0;b<this.circleKeys.length;b++){const P=this.circles[3*b],E=this.circles[3*b+1],L=this.circles[3*b+2];v.push({key:this.circleKeys[b],x1:P-L,y1:E-L,x2:P+L,y2:E+L})}}else this._forEachCell(t,n,o,a,this._queryCell,v,{hitTest:h,overlapMode:m,seenUids:{box:{},circle:{}}},_);return v}query(t,n,o,a){return this._query(t,n,o,a,!1,null)}hitTest(t,n,o,a,h,m){return this._query(t,n,o,a,!0,h,m).length>0}hitTestCircle(t,n,o,a,h){const m=t-o,_=t+o,v=n-o,b=n+o;if(_<0||m>this.width||b<0||v>this.height)return!1;const P=[];return this._forEachCell(m,v,_,b,this._queryCellCircle,P,{hitTest:!0,overlapMode:a,circle:{x:t,y:n,radius:o},seenUids:{box:{},circle:{}}},h),P.length>0}_queryCell(t,n,o,a,h,m,_,v){const{seenUids:b,hitTest:P,overlapMode:E}=_,L=this.boxCells[h];if(L!==null){const V=this.bboxes;for(const Z of L)if(!b.box[Z]){b.box[Z]=!0;const U=4*Z,H=this.boxKeys[Z];if(t<=V[U+2]&&n<=V[U+3]&&o>=V[U+0]&&a>=V[U+1]&&(!v||v(H))&&(!P||!_r(E,H.overlapMode))&&(m.push({key:H,x1:V[U],y1:V[U+1],x2:V[U+2],y2:V[U+3]}),P))return!0}}const B=this.circleCells[h];if(B!==null){const V=this.circles;for(const Z of B)if(!b.circle[Z]){b.circle[Z]=!0;const U=3*Z,H=this.circleKeys[Z];if(this._circleAndRectCollide(V[U],V[U+1],V[U+2],t,n,o,a)&&(!v||v(H))&&(!P||!_r(E,H.overlapMode))){const K=V[U],j=V[U+1],ee=V[U+2];if(m.push({key:H,x1:K-ee,y1:j-ee,x2:K+ee,y2:j+ee}),P)return!0}}}return!1}_queryCellCircle(t,n,o,a,h,m,_,v){const{circle:b,seenUids:P,overlapMode:E}=_,L=this.boxCells[h];if(L!==null){const V=this.bboxes;for(const Z of L)if(!P.box[Z]){P.box[Z]=!0;const U=4*Z,H=this.boxKeys[Z];if(this._circleAndRectCollide(b.x,b.y,b.radius,V[U+0],V[U+1],V[U+2],V[U+3])&&(!v||v(H))&&!_r(E,H.overlapMode))return m.push(!0),!0}}const B=this.circleCells[h];if(B!==null){const V=this.circles;for(const Z of B)if(!P.circle[Z]){P.circle[Z]=!0;const U=3*Z,H=this.circleKeys[Z];if(this._circlesCollide(V[U],V[U+1],V[U+2],b.x,b.y,b.radius)&&(!v||v(H))&&!_r(E,H.overlapMode))return m.push(!0),!0}}}_forEachCell(t,n,o,a,h,m,_,v){const b=this._convertToXCellCoord(t),P=this._convertToYCellCoord(n),E=this._convertToXCellCoord(o),L=this._convertToYCellCoord(a);for(let B=b;B<=E;B++)for(let V=P;V<=L;V++)if(h.call(this,t,n,o,a,this.xCellCount*V+B,m,_,v))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,o,a,h,m){const _=a-t,v=h-n,b=o+m;return b*b>_*_+v*v}_circleAndRectCollide(t,n,o,a,h,m,_){const v=(m-a)/2,b=Math.abs(t-(a+v));if(b>v+o)return!1;const P=(_-h)/2,E=Math.abs(n-(h+P));if(E>P+o)return!1;if(b<=v||E<=P)return!0;const L=b-v,B=E-P;return L*L+B*B<=o*o}}function qr(u,t,n,o,a){const h=c.H();return t?(c.K(h,h,[1/a,1/a,1]),n||c.ae(h,h,o.angle)):c.L(h,o.labelPlaneMatrix,u),h}function yr(u,t,n,o,a){if(t){const h=c.af(u);return c.K(h,h,[a,a,1]),n||c.ae(h,h,-o.angle),h}return o.glCoordMatrix}function G(u,t,n){let o;n?(o=[u.x,u.y,n(u.x,u.y),1],c.ag(o,o,t)):(o=[u.x,u.y,0,1],function(h,m,_){const v=m[0],b=m[1];h[0]=_[0]*v+_[4]*b+_[12],h[1]=_[1]*v+_[5]*b+_[13],h[3]=_[3]*v+_[7]*b+_[15]}(o,o,t));const a=o[3];return{point:new c.P(o[0]/a,o[1]/a),signedDistanceFromCamera:a,isOccluded:!1}}function k(u,t){return .5+u/t*.5}function A(u,t){return u.x>=-t[0]&&u.x<=t[0]&&u.y>=-t[1]&&u.y<=t[1]}function O(u,t,n,o,a,h,m,_,v,b,P,E,L,B,V){const Z=o?u.textSizeData:u.iconSizeData,U=c.ah(Z,n.transform.zoom),H=[256/n.width*2+1,256/n.height*2+1],K=o?u.text.dynamicLayoutVertexArray:u.icon.dynamicLayoutVertexArray;K.clear();const j=u.lineVertexArray,ee=o?u.text.placedSymbolArray:u.icon.placedSymbolArray,ne=n.transform.width/n.transform.height;let ce=!1;for(let ge=0;ge<ee.length;ge++){const we=ee.get(ge);if(we.hidden||we.writingMode===c.ai.vertical&&!ce){Xe(we.numGlyphs,K);continue}ce=!1;const De=G(new c.P(we.anchorX,we.anchorY),t,V);if(!A(De.point,H)){Xe(we.numGlyphs,K);continue}const Re=k(n.transform.cameraToCenterDistance,De.signedDistanceFromCamera),Se=c.aj(Z,U,we),Te=m?Se/Re:Se*Re,Ne={getElevation:V,labelPlaneMatrix:a,lineVertexArray:j,pitchWithMap:m,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:b,tileAnchorPoint:new c.P(we.anchorX,we.anchorY),unwrappedTileID:P,width:E,height:L,translation:B},it=te(Ne,we,Te,!1,_,t,h,u.glyphOffsetArray,K,ne,v);ce=it.useVertical,(it.notEnoughRoom||ce||it.needsFlipping&&te(Ne,we,Te,!0,_,t,h,u.glyphOffsetArray,K,ne,v).notEnoughRoom)&&Xe(we.numGlyphs,K)}o?u.text.dynamicLayoutVertexBuffer.updateData(K):u.icon.dynamicLayoutVertexBuffer.updateData(K)}function q(u,t,n,o,a,h,m,_){const v=h.glyphStartIndex+h.numGlyphs,b=h.lineStartIndex,P=h.lineStartIndex+h.lineLength,E=t.getoffsetX(h.glyphStartIndex),L=t.getoffsetX(v-1),B=Pe(u*E,n,o,a,h.segment,b,P,_,m);if(!B)return null;const V=Pe(u*L,n,o,a,h.segment,b,P,_,m);return V?_.projectionCache.anyProjectionOccluded?null:{first:B,last:V}:null}function Q(u,t,n,o){return u===c.ai.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*o?{useVertical:!0}:(u===c.ai.vertical?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function te(u,t,n,o,a,h,m,_,v,b,P){const E=n/24,L=t.lineOffsetX*E,B=t.lineOffsetY*E;let V;if(t.numGlyphs>1){const Z=t.glyphStartIndex+t.numGlyphs,U=t.lineStartIndex,H=t.lineStartIndex+t.lineLength,K=q(E,_,L,B,o,t,P,u);if(!K)return{notEnoughRoom:!0};const j=G(K.first.point,m,u.getElevation).point,ee=G(K.last.point,m,u.getElevation).point;if(a&&!o){const ne=Q(t.writingMode,j,ee,b);if(ne)return ne}V=[K.first];for(let ne=t.glyphStartIndex+1;ne<Z-1;ne++)V.push(Pe(E*_.getoffsetX(ne),L,B,o,t.segment,U,H,u,P));V.push(K.last)}else{if(a&&!o){const U=G(u.tileAnchorPoint,h,u.getElevation).point,H=t.lineStartIndex+t.segment+1,K=new c.P(u.lineVertexArray.getx(H),u.lineVertexArray.gety(H)),j=G(K,h,u.getElevation),ee=j.signedDistanceFromCamera>0?j.point:function(ce,ge,we,De,Re,Se){return re(ce,ge,we,1,Re,Se)}(u.tileAnchorPoint,K,U,0,h,u),ne=Q(t.writingMode,U,ee,b);if(ne)return ne}const Z=Pe(E*_.getoffsetX(t.glyphStartIndex),L,B,o,t.segment,t.lineStartIndex,t.lineStartIndex+t.lineLength,u,P);if(!Z||u.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};V=[Z]}for(const Z of V)c.ak(v,Z.point,Z.angle);return{}}function re(u,t,n,o,a,h){const m=u.add(u.sub(t)._unit()),_=a!==void 0?G(m,a,h.getElevation).point:pe(m.x,m.y,h).point,v=n.sub(_);return n.add(v._mult(o/v.mag()))}function W(u,t,n){const o=t.projectionCache;if(o.projections[u])return o.projections[u];const a=new c.P(t.lineVertexArray.getx(u),t.lineVertexArray.gety(u)),h=pe(a.x,a.y,t);if(h.signedDistanceFromCamera>0)return o.projections[u]=h.point,o.anyProjectionOccluded=o.anyProjectionOccluded||h.isOccluded,h.point;const m=u-n.direction;return function(_,v,b,P,E){return re(_,v,b,P,void 0,E)}(n.distanceFromAnchor===0?t.tileAnchorPoint:new c.P(t.lineVertexArray.getx(m),t.lineVertexArray.gety(m)),a,n.previousVertex,n.absOffsetX-n.distanceFromAnchor+1,t)}function pe(u,t,n){const o=u+n.translation[0],a=t+n.translation[1];let h;return!n.pitchWithMap&&n.projection.useSpecialProjectionForSymbols?(h=n.projection.projectTileCoordinates(o,a,n.unwrappedTileID,n.getElevation),h.point.x=(.5*h.point.x+.5)*n.width,h.point.y=(.5*-h.point.y+.5)*n.height):(h=G(new c.P(o,a),n.labelPlaneMatrix,n.getElevation),h.isOccluded=!1),h}function _e(u,t,n){return u._unit()._perp()._mult(t*n)}function he(u,t,n,o,a,h,m,_,v){if(_.projectionCache.offsets[u])return _.projectionCache.offsets[u];const b=n.add(t);if(u+v.direction<o||u+v.direction>=a)return _.projectionCache.offsets[u]=b,b;const P=W(u+v.direction,_,v),E=_e(P.sub(n),m,v.direction),L=n.add(E),B=P.add(E);return _.projectionCache.offsets[u]=c.al(h,b,L,B)||b,_.projectionCache.offsets[u]}function Pe(u,t,n,o,a,h,m,_,v){const b=o?u-t:u+t;let P=b>0?1:-1,E=0;o&&(P*=-1,E=Math.PI),P<0&&(E+=Math.PI);let L,B=P>0?h+a:h+a+1;_.projectionCache.cachedAnchorPoint?L=_.projectionCache.cachedAnchorPoint:(L=pe(_.tileAnchorPoint.x,_.tileAnchorPoint.y,_).point,_.projectionCache.cachedAnchorPoint=L);let V,Z,U=L,H=L,K=0,j=0;const ee=Math.abs(b),ne=[];let ce;for(;K+j<=ee;){if(B+=P,B<h||B>=m)return null;K+=j,H=U,Z=V;const De={absOffsetX:ee,direction:P,distanceFromAnchor:K,previousVertex:H};if(U=W(B,_,De),n===0)ne.push(H),ce=U.sub(H);else{let Re;const Se=U.sub(H);Re=Se.mag()===0?_e(W(B+P,_,De).sub(U),n,P):_e(Se,n,P),Z||(Z=H.add(Re)),V=he(B,Re,U,h,m,Z,n,_,De),ne.push(Z),ce=V.sub(Z)}j=ce.mag()}const ge=ce._mult((ee-K)/j)._add(Z||H),we=E+Math.atan2(U.y-H.y,U.x-H.x);return ne.push(ge),{point:ge,angle:v?we:0,path:ne}}const He=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Xe(u,t){for(let n=0;n<u;n++){const o=t.length;t.resize(o+4),t.float32.set(He,3*o)}}const st=100;class mt{constructor(t,n,o=new Mr(t.width+200,t.height+200,25),a=new Mr(t.width+200,t.height+200,25)){this.transform=t,this.mapProjection=n,this.grid=o,this.ignoredGrid=a,this.pitchFactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+st,this.screenBottomBoundary=t.height+st,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,n,o,a,h,m,_,v,b,P,E){const L=t.anchorPointX+v[0],B=t.anchorPointY+v[1],V=this.projectAndGetPerspectiveRatio(a,L,B,h,P),Z=this._projectCollisionBox(t,o,a,h,m,_,v,V,P,E),[U,H,K,j]=Z.box;return this.mapProjection.useSpecialProjectionForSymbols&&(m?Z.allPointsOccluded:this.mapProjection.isOccluded(L,B,h))||V.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid(U,H,K,j)||n!=="always"&&this.grid.hitTest(U,H,K,j,n,b)?{box:[U,H,K,j],placeable:!1,offscreen:!1}:{box:[U,H,K,j],placeable:!0,offscreen:this.isOffscreen(U,H,K,j)}}placeCollisionCircles(t,n,o,a,h,m,_,v,b,P,E,L,B,V,Z,U){const H=[],K=new c.P(n.anchorX,n.anchorY),j=this.getPerspectiveRatio(m,K.x,K.y,_,U),ee=(E?h/j:h*j)/c.aq,ne={getElevation:U,labelPlaneMatrix:v,lineVertexArray:o,pitchWithMap:E,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:K,unwrappedTileID:_,width:this.transform.width,height:this.transform.height,translation:Z},ce=q(ee,a,n.lineOffsetX*ee,n.lineOffsetY*ee,!1,n,!1,ne);let ge=!1,we=!1,De=!0;if(ce){const Re=.5*B*j+V,Se=new c.P(-100,-100),Te=new c.P(this.screenRightBoundary,this.screenBottomBoundary),Ne=new rt,it=ce.first,Ee=ce.last;let ke=[];for(let ot=it.path.length-1;ot>=1;ot--)ke.push(it.path[ot]);for(let ot=1;ot<Ee.path.length;ot++)ke.push(Ee.path[ot]);const et=2.5*Re;if(b){const ot=this.projectPathToScreenSpace(ke,ne,b);ke=ot.some(pt=>pt.signedDistanceFromCamera<=0)?[]:ot.map(pt=>pt.point)}let Bt=[];if(ke.length>0){const ot=ke[0].clone(),pt=ke[0].clone();for(let Ft=1;Ft<ke.length;Ft++)ot.x=Math.min(ot.x,ke[Ft].x),ot.y=Math.min(ot.y,ke[Ft].y),pt.x=Math.max(pt.x,ke[Ft].x),pt.y=Math.max(pt.y,ke[Ft].y);Bt=ot.x>=Se.x&&pt.x<=Te.x&&ot.y>=Se.y&&pt.y<=Te.y?[ke]:pt.x<Se.x||ot.x>Te.x||pt.y<Se.y||ot.y>Te.y?[]:c.am([ke],Se.x,Se.y,Te.x,Te.y)}for(const ot of Bt){Ne.reset(ot,.25*Re);let pt=0;pt=Ne.length<=.5*Re?1:Math.ceil(Ne.paddedLength/et)+1;for(let Ft=0;Ft<pt;Ft++){const pi=Ft/Math.max(pt-1,1),sr=Ne.lerp(pi),Ot=sr.x+st,Mi=sr.y+st;H.push(Ot,Mi,Re,0);const Ii=Ot-Re,fi=Mi-Re,mi=Ot+Re,or=Mi+Re;if(De=De&&this.isOffscreen(Ii,fi,mi,or),we=we||this.isInsideGrid(Ii,fi,mi,or),t!=="always"&&this.grid.hitTestCircle(Ot,Mi,Re,t,L)&&(ge=!0,!P))return{circles:[],offscreen:!1,collisionDetected:ge}}}}return{circles:!P&&ge||!we||j<this.perspectiveRatioCutoff?[]:H,offscreen:De,collisionDetected:ge}}projectPathToScreenSpace(t,n,o){return t.map(a=>G(a,o,n.getElevation))}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[];let o=1/0,a=1/0,h=-1/0,m=-1/0;for(const P of t){const E=new c.P(P.x+st,P.y+st);o=Math.min(o,E.x),a=Math.min(a,E.y),h=Math.max(h,E.x),m=Math.max(m,E.y),n.push(E)}const _=this.grid.query(o,a,h,m).concat(this.ignoredGrid.query(o,a,h,m)),v={},b={};for(const P of _){const E=P.key;if(v[E.bucketInstanceId]===void 0&&(v[E.bucketInstanceId]={}),v[E.bucketInstanceId][E.featureIndex])continue;const L=[new c.P(P.x1,P.y1),new c.P(P.x2,P.y1),new c.P(P.x2,P.y2),new c.P(P.x1,P.y2)];c.an(n,L)&&(v[E.bucketInstanceId][E.featureIndex]=!0,b[E.bucketInstanceId]===void 0&&(b[E.bucketInstanceId]=[]),b[E.bucketInstanceId].push(E.featureIndex))}return b}insertCollisionBox(t,n,o,a,h,m){(o?this.ignoredGrid:this.grid).insert({bucketInstanceId:a,featureIndex:h,collisionGroupID:m,overlapMode:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,o,a,h,m){const _=o?this.ignoredGrid:this.grid,v={bucketInstanceId:a,featureIndex:h,collisionGroupID:m,overlapMode:n};for(let b=0;b<t.length;b+=4)_.insertCircle(v,t[b],t[b+1],t[b+2])}projectAndGetPerspectiveRatio(t,n,o,a,h){const m=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(n,o,a,h):G(new c.P(n,o),t,h);return{point:new c.P((m.point.x+1)/2*this.transform.width+st,(1-m.point.y)/2*this.transform.height+st),perspectiveRatio:.5+this.transform.cameraToCenterDistance/m.signedDistanceFromCamera*.5,isOccluded:m.isOccluded,signedDistanceFromCamera:m.signedDistanceFromCamera}}getPerspectiveRatio(t,n,o,a,h){const m=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(n,o,a,h):G(new c.P(n,o),t,h);return .5+this.transform.cameraToCenterDistance/m.signedDistanceFromCamera*.5}isOffscreen(t,n,o,a){return o<st||t>=this.screenRightBoundary||a<st||n>this.screenBottomBoundary}isInsideGrid(t,n,o,a){return o>=0&&t<this.gridRightBoundary&&a>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=c.ao([]);return c.J(t,t,[-100,-100,0]),t}_projectCollisionBox(t,n,o,a,h,m,_,v,b,P){const E=n*v.perspectiveRatio;let L=new c.P(1,0),B=new c.P(0,1);const V=new c.P(t.anchorPointX+_[0],t.anchorPointY+_[1]);if(m&&!h){const Re=this.projectAndGetPerspectiveRatio(o,V.x+1,V.y,a,b).point.sub(v.point).unit(),Se=Math.atan(Re.y/Re.x)+(Re.x<0?Math.PI:0),Te=Math.sin(Se),Ne=Math.cos(Se);L=new c.P(Ne,Te),B=new c.P(-Te,Ne)}else if(!m&&h){const Re=-this.transform.angle,Se=Math.sin(Re),Te=Math.cos(Re);L=new c.P(Te,Se),B=new c.P(-Se,Te)}let Z=v.point,U=E;if(h){Z=V;const Re=this.transform.zoom-Math.floor(this.transform.zoom);U=Math.pow(2,-Re),U*=this.mapProjection.getPitchedTextCorrection(this.transform,V,a),P||(U*=c.ad(.5+v.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))}P&&(Z=Z.add(L.mult(P.x*U)).add(B.mult(P.y*U)));const H=t.x1*U,K=t.x2*U,j=(H+K)/2,ee=t.y1*U,ne=t.y2*U,ce=(ee+ne)/2,ge=[{offsetX:H,offsetY:ee},{offsetX:j,offsetY:ee},{offsetX:K,offsetY:ee},{offsetX:K,offsetY:ce},{offsetX:K,offsetY:ne},{offsetX:j,offsetY:ne},{offsetX:H,offsetY:ne},{offsetX:H,offsetY:ce}];let we=[];for(const{offsetX:Re,offsetY:Se}of ge)we.push(new c.P(Z.x+L.x*Re+B.x*Se,Z.y+L.y*Re+B.y*Se));let De=!1;if(h){const Re=we.map(Se=>this.projectAndGetPerspectiveRatio(o,Se.x,Se.y,a,b));De=Re.some(Se=>!Se.isOccluded),we=Re.map(Se=>Se.point)}else De=!0;return{box:c.ap(we),allPointsOccluded:!De}}}function nt(u,t,n){return t*(c.X/(u.tileSize*Math.pow(2,n-u.tileID.overscaledZ)))}class kt{constructor(t,n,o,a){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):a&&o?1:0,this.placed=o}isHidden(){return this.opacity===0&&!this.placed}}class qt{constructor(t,n,o,a,h){this.text=new kt(t?t.text:null,n,o,h),this.icon=new kt(t?t.icon:null,n,a,h)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Kt{constructor(t,n,o){this.text=t,this.icon=n,this.skipFade=o}}class lt{constructor(){this.invProjMatrix=c.H(),this.viewportMatrix=c.H(),this.circles=[]}}class St{constructor(t,n,o,a,h){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=o,this.bucketIndex=a,this.tileID=h}}class Nt{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:o=>o.collisionGroupID===n}}return this.collisionGroups[t]}}function ei(u,t,n,o,a){const{horizontalAlign:h,verticalAlign:m}=c.av(u);return new c.P(-(h-.5)*t+o[0]*a,-(m-.5)*n+o[1]*a)}class hi{constructor(t,n,o,a,h,m){this.transform=t.clone(),this.terrain=o,this.collisionIndex=new mt(this.transform,n),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new Nt(h),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=m,m&&(m.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){const n=this.terrain;return n?(o,a)=>n.getElevation(t,o,a):null}getBucketParts(t,n,o,a){const h=o.getBucket(n),m=o.latestFeatureIndex;if(!h||!m||n.id!==h.layerIds[0])return;const _=o.collisionBoxArray,v=h.layers[0].layout,b=h.layers[0].paint,P=Math.pow(2,this.transform.zoom-o.tileID.overscaledZ),E=o.tileSize/c.X,L=o.tileID.toUnwrapped(),B=this.transform.calculatePosMatrix(L),V=v.get("text-pitch-alignment")==="map",Z=v.get("text-rotation-alignment")==="map",U=nt(o,1,this.transform.zoom),H=this.collisionIndex.mapProjection.translatePosition(this.transform,o,b.get("text-translate"),b.get("text-translate-anchor")),K=this.collisionIndex.mapProjection.translatePosition(this.transform,o,b.get("icon-translate"),b.get("icon-translate-anchor")),j=qr(B,V,Z,this.transform,U);let ee=null;if(V){const ce=yr(B,V,Z,this.transform,U);ee=c.L([],this.transform.labelPlaneMatrix,ce)}this.retainedQueryData[h.bucketInstanceId]=new St(h.bucketInstanceId,m,h.sourceLayerIndex,h.index,o.tileID);const ne={bucket:h,layout:v,translationText:H,translationIcon:K,posMatrix:B,unwrappedTileID:L,textLabelPlaneMatrix:j,labelToScreenMatrix:ee,scale:P,textPixelRatio:E,holdingForFade:o.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:c.ah(h.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(h.sourceID)};if(a)for(const ce of h.sortKeyRanges){const{sortKey:ge,symbolInstanceStart:we,symbolInstanceEnd:De}=ce;t.push({sortKey:ge,symbolInstanceStart:we,symbolInstanceEnd:De,parameters:ne})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:h.symbolInstances.length,parameters:ne})}attemptAnchorPlacement(t,n,o,a,h,m,_,v,b,P,E,L,B,V,Z,U,H,K,j){const ee=c.ar[t.textAnchor],ne=[t.textOffset0,t.textOffset1],ce=ei(ee,o,a,ne,h),ge=this.collisionIndex.placeCollisionBox(n,L,v,b,P,_,m,U,E.predicate,j,ce);if((!K||this.collisionIndex.placeCollisionBox(K,L,v,b,P,_,m,H,E.predicate,j,ce).placeable)&&ge.placeable){let we;if(this.prevPlacement&&this.prevPlacement.variableOffsets[B.crossTileID]&&this.prevPlacement.placements[B.crossTileID]&&this.prevPlacement.placements[B.crossTileID].text&&(we=this.prevPlacement.variableOffsets[B.crossTileID].anchor),B.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[B.crossTileID]={textOffset:ne,width:o,height:a,anchor:ee,textBoxScale:h,prevAnchor:we},this.markUsedJustification(V,ee,B,Z),V.allowVerticalPlacement&&(this.markUsedOrientation(V,Z,B),this.placedOrientations[B.crossTileID]=Z),{shift:ce,placedGlyphBoxes:ge}}}placeLayerBucketPart(t,n,o){const{bucket:a,layout:h,translationText:m,translationIcon:_,posMatrix:v,unwrappedTileID:b,textLabelPlaneMatrix:P,labelToScreenMatrix:E,textPixelRatio:L,holdingForFade:B,collisionBoxArray:V,partiallyEvaluatedTextSize:Z,collisionGroup:U}=t.parameters,H=h.get("text-optional"),K=h.get("icon-optional"),j=c.as(h,"text-overlap","text-allow-overlap"),ee=j==="always",ne=c.as(h,"icon-overlap","icon-allow-overlap"),ce=ne==="always",ge=h.get("text-rotation-alignment")==="map",we=h.get("text-pitch-alignment")==="map",De=h.get("icon-text-fit")!=="none",Re=h.get("symbol-z-order")==="viewport-y",Se=ee&&(ce||!a.hasIconData()||K),Te=ce&&(ee||!a.hasTextData()||H);!a.collisionArrays&&V&&a.deserializeCollisionBoxes(V);const Ne=this._getTerrainElevationFunc(this.retainedQueryData[a.bucketInstanceId].tileID),it=(Ee,ke,et)=>{var Bt,ot;if(n[Ee.crossTileID])return;if(B)return void(this.placements[Ee.crossTileID]=new Kt(!1,!1,!1));let pt=!1,Ft=!1,pi=!0,sr=null,Ot={box:null,placeable:!1,offscreen:null},Mi={box:null,placeable:!1,offscreen:null},Ii=null,fi=null,mi=null,or=0,xn=0,yo=0;ke.textFeatureIndex?or=ke.textFeatureIndex:Ee.useRuntimeCollisionCircles&&(or=Ee.featureIndex),ke.verticalTextFeatureIndex&&(xn=ke.verticalTextFeatureIndex);const Un=ke.textBox;if(Un){const ai=gi=>{let _i=c.ai.horizontal;if(a.allowVerticalPlacement&&!gi&&this.prevPlacement){const ni=this.prevPlacement.placedOrientations[Ee.crossTileID];ni&&(this.placedOrientations[Ee.crossTileID]=ni,_i=ni,this.markUsedOrientation(a,_i,Ee))}return _i},ar=(gi,_i)=>{if(a.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&ke.verticalTextBox){for(const ni of a.writingModes)if(ni===c.ai.vertical?(Ot=_i(),Mi=Ot):Ot=gi(),Ot&&Ot.placeable)break}else Ot=gi()},Kr=Ee.textAnchorOffsetStartIndex,$n=Ee.textAnchorOffsetEndIndex;if($n===Kr){const gi=(_i,ni)=>{const Ut=this.collisionIndex.placeCollisionBox(_i,j,L,v,b,we,ge,m,U.predicate,Ne);return Ut&&Ut.placeable&&(this.markUsedOrientation(a,ni,Ee),this.placedOrientations[Ee.crossTileID]=ni),Ut};ar(()=>gi(Un,c.ai.horizontal),()=>{const _i=ke.verticalTextBox;return a.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&_i?gi(_i,c.ai.vertical):{box:null,offscreen:null}}),ai(Ot&&Ot.placeable)}else{let gi=c.ar[(ot=(Bt=this.prevPlacement)===null||Bt===void 0?void 0:Bt.variableOffsets[Ee.crossTileID])===null||ot===void 0?void 0:ot.anchor];const _i=(Ut,qn,La)=>{const ti=Ut.x2-Ut.x1,Zl=Ut.y2-Ut.y1,vo=Ee.textBoxScale,bo=De&&ne==="never"?qn:null;let Yr=null,Gl=j==="never"?1:2,Ra="never";gi&&Gl++;for(let Ba=0;Ba<Gl;Ba++){for(let Fa=Kr;Fa<$n;Fa++){const wo=a.textAnchorOffsets.get(Fa);if(gi&&wo.textAnchor!==gi)continue;const Zn=this.attemptAnchorPlacement(wo,Ut,ti,Zl,vo,ge,we,L,v,b,U,Ra,Ee,a,La,m,_,bo,Ne);if(Zn&&(Yr=Zn.placedGlyphBoxes,Yr&&Yr.placeable))return pt=!0,sr=Zn.shift,Yr}gi?gi=null:Ra=j}return o&&!Yr&&(Yr={box:this.collisionIndex.placeCollisionBox(Un,"always",L,v,b,we,ge,m,U.predicate,Ne,new c.P(0,0)).box,offscreen:!1,placeable:!1}),Yr};ar(()=>_i(Un,ke.iconBox,c.ai.horizontal),()=>{const Ut=ke.verticalTextBox;return a.allowVerticalPlacement&&(!Ot||!Ot.placeable)&&Ee.numVerticalGlyphVertices>0&&Ut?_i(Ut,ke.verticalIconBox,c.ai.vertical):{box:null,occluded:!0,offscreen:null}}),Ot&&(pt=Ot.placeable,pi=Ot.offscreen);const ni=ai(Ot&&Ot.placeable);if(!pt&&this.prevPlacement){const Ut=this.prevPlacement.variableOffsets[Ee.crossTileID];Ut&&(this.variableOffsets[Ee.crossTileID]=Ut,this.markUsedJustification(a,Ut.anchor,Ee,ni))}}}if(Ii=Ot,pt=Ii&&Ii.placeable,pi=Ii&&Ii.offscreen,Ee.useRuntimeCollisionCircles){const ai=a.text.placedSymbolArray.get(Ee.centerJustifiedTextSymbolIndex),ar=c.aj(a.textSizeData,Z,ai),Kr=h.get("text-padding");fi=this.collisionIndex.placeCollisionCircles(j,ai,a.lineVertexArray,a.glyphOffsetArray,ar,v,b,P,E,o,we,U.predicate,Ee.collisionCircleDiameter,Kr,m,Ne),fi.circles.length&&fi.collisionDetected&&!o&&c.w("Collisions detected, but collision boxes are not shown"),pt=ee||fi.circles.length>0&&!fi.collisionDetected,pi=pi&&fi.offscreen}if(ke.iconFeatureIndex&&(yo=ke.iconFeatureIndex),ke.iconBox){const ai=ar=>this.collisionIndex.placeCollisionBox(ar,ne,L,v,b,we,ge,_,U.predicate,Ne,De&&sr?sr:void 0);Mi&&Mi.placeable&&ke.verticalIconBox?(mi=ai(ke.verticalIconBox),Ft=mi.placeable):(mi=ai(ke.iconBox),Ft=mi.placeable),pi=pi&&mi.offscreen}const vn=H||Ee.numHorizontalGlyphVertices===0&&Ee.numVerticalGlyphVertices===0,xo=K||Ee.numIconVertices===0;vn||xo?xo?vn||(Ft=Ft&&pt):pt=Ft&&pt:Ft=pt=Ft&&pt;const Da=Ft&&mi.placeable;if(pt&&Ii.placeable&&this.collisionIndex.insertCollisionBox(Ii.box,j,h.get("text-ignore-placement"),a.bucketInstanceId,Mi&&Mi.placeable&&xn?xn:or,U.ID),Da&&this.collisionIndex.insertCollisionBox(mi.box,ne,h.get("icon-ignore-placement"),a.bucketInstanceId,yo,U.ID),fi&&pt&&this.collisionIndex.insertCollisionCircles(fi.circles,j,h.get("text-ignore-placement"),a.bucketInstanceId,or,U.ID),o&&this.storeCollisionData(a.bucketInstanceId,et,ke,Ii,mi,fi),Ee.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(a.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Ee.crossTileID]=new Kt(pt||Se,Ft||Te,pi||a.justReloaded),n[Ee.crossTileID]=!0};if(Re){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ee=a.getSortedSymbolIndexes(this.transform.angle);for(let ke=Ee.length-1;ke>=0;--ke){const et=Ee[ke];it(a.symbolInstances.get(et),a.collisionArrays[et],et)}}else for(let Ee=t.symbolInstanceStart;Ee<t.symbolInstanceEnd;Ee++)it(a.symbolInstances.get(Ee),a.collisionArrays[Ee],Ee);if(o&&a.bucketInstanceId in this.collisionCircleArrays){const Ee=this.collisionCircleArrays[a.bucketInstanceId];c.at(Ee.invProjMatrix,v),Ee.viewportMatrix=this.collisionIndex.getViewportMatrix()}a.justReloaded=!1}storeCollisionData(t,n,o,a,h,m){if(o.textBox||o.iconBox){let _,v;this.collisionBoxArrays.has(t)?_=this.collisionBoxArrays.get(t):(_=new Map,this.collisionBoxArrays.set(t,_)),_.has(n)?v=_.get(n):(v={text:null,icon:null},_.set(n,v)),o.textBox&&(v.text=a.box),o.iconBox&&(v.icon=h.box)}if(m){let _=this.collisionCircleArrays[t];_===void 0&&(_=this.collisionCircleArrays[t]=new lt);for(let v=0;v<m.circles.length;v+=4)_.circles.push(m.circles[v+0]),_.circles.push(m.circles[v+1]),_.circles.push(m.circles[v+2]),_.circles.push(m.collisionDetected?1:0)}}markUsedJustification(t,n,o,a){let h;h=a===c.ai.vertical?o.verticalPlacedTextSymbolIndex:{left:o.leftJustifiedTextSymbolIndex,center:o.centerJustifiedTextSymbolIndex,right:o.rightJustifiedTextSymbolIndex}[c.au(n)];const m=[o.leftJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.rightJustifiedTextSymbolIndex,o.verticalPlacedTextSymbolIndex];for(const _ of m)_>=0&&(t.text.placedSymbolArray.get(_).crossTileID=h>=0&&_!==h?0:o.crossTileID)}markUsedOrientation(t,n,o){const a=n===c.ai.horizontal||n===c.ai.horizontalOnly?n:0,h=n===c.ai.vertical?n:0,m=[o.leftJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.rightJustifiedTextSymbolIndex];for(const _ of m)t.text.placedSymbolArray.get(_).placedOrientation=a;o.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(o.verticalPlacedTextSymbolIndex).placedOrientation=h)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let o=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const a=n?n.symbolFadeChange(t):1,h=n?n.opacities:{},m=n?n.variableOffsets:{},_=n?n.placedOrientations:{};for(const v in this.placements){const b=this.placements[v],P=h[v];P?(this.opacities[v]=new qt(P,a,b.text,b.icon),o=o||b.text!==P.text.placed||b.icon!==P.icon.placed):(this.opacities[v]=new qt(null,a,b.text,b.icon,b.skipFade),o=o||b.text||b.icon)}for(const v in h){const b=h[v];if(!this.opacities[v]){const P=new qt(b,a,!1,!1);P.isHidden()||(this.opacities[v]=P,o=o||b.text.placed||b.icon.placed)}}for(const v in m)this.variableOffsets[v]||!this.opacities[v]||this.opacities[v].isHidden()||(this.variableOffsets[v]=m[v]);for(const v in _)this.placedOrientations[v]||!this.opacities[v]||this.opacities[v].isHidden()||(this.placedOrientations[v]=_[v]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");o?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const o={};for(const a of n){const h=a.getBucket(t);h&&a.latestFeatureIndex&&t.id===h.layerIds[0]&&this.updateBucketOpacities(h,a.tileID,o,a.collisionBoxArray)}}updateBucketOpacities(t,n,o,a){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 h=t.layers[0],m=h.layout,_=new qt(null,0,!1,!1,!0),v=m.get("text-allow-overlap"),b=m.get("icon-allow-overlap"),P=h._unevaluatedLayout.hasValue("text-variable-anchor")||h._unevaluatedLayout.hasValue("text-variable-anchor-offset"),E=m.get("text-rotation-alignment")==="map",L=m.get("text-pitch-alignment")==="map",B=m.get("icon-text-fit")!=="none",V=new qt(null,0,v&&(b||!t.hasIconData()||m.get("icon-optional")),b&&(v||!t.hasTextData()||m.get("text-optional")),!0);!t.collisionArrays&&a&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(a);const Z=(H,K,j)=>{for(let ee=0;ee<K/4;ee++)H.opacityVertexArray.emplaceBack(j);H.hasVisibleVertices=H.hasVisibleVertices||j!==di},U=this.collisionBoxArrays.get(t.bucketInstanceId);for(let H=0;H<t.symbolInstances.length;H++){const K=t.symbolInstances.get(H),{numHorizontalGlyphVertices:j,numVerticalGlyphVertices:ee,crossTileID:ne}=K;let ce=this.opacities[ne];o[ne]?ce=_:ce||(ce=V,this.opacities[ne]=ce),o[ne]=!0;const ge=K.numIconVertices>0,we=this.placedOrientations[K.crossTileID],De=we===c.ai.vertical,Re=we===c.ai.horizontal||we===c.ai.horizontalOnly;if(j>0||ee>0){const Te=Ni(ce.text);Z(t.text,j,De?di:Te),Z(t.text,ee,Re?di:Te);const Ne=ce.text.isHidden();[K.rightJustifiedTextSymbolIndex,K.centerJustifiedTextSymbolIndex,K.leftJustifiedTextSymbolIndex].forEach(ke=>{ke>=0&&(t.text.placedSymbolArray.get(ke).hidden=Ne||De?1:0)}),K.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(K.verticalPlacedTextSymbolIndex).hidden=Ne||Re?1:0);const it=this.variableOffsets[K.crossTileID];it&&this.markUsedJustification(t,it.anchor,K,we);const Ee=this.placedOrientations[K.crossTileID];Ee&&(this.markUsedJustification(t,"left",K,Ee),this.markUsedOrientation(t,Ee,K))}if(ge){const Te=Ni(ce.icon),Ne=!(B&&K.verticalPlacedIconSymbolIndex&&De);K.placedIconSymbolIndex>=0&&(Z(t.icon,K.numIconVertices,Ne?Te:di),t.icon.placedSymbolArray.get(K.placedIconSymbolIndex).hidden=ce.icon.isHidden()),K.verticalPlacedIconSymbolIndex>=0&&(Z(t.icon,K.numVerticalIconVertices,Ne?di:Te),t.icon.placedSymbolArray.get(K.verticalPlacedIconSymbolIndex).hidden=ce.icon.isHidden())}const Se=U&&U.has(H)?U.get(H):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const Te=t.collisionArrays[H];if(Te){let Ne=new c.P(0,0);if(Te.textBox||Te.verticalTextBox){let it=!0;if(P){const Ee=this.variableOffsets[ne];Ee?(Ne=ei(Ee.anchor,Ee.width,Ee.height,Ee.textOffset,Ee.textBoxScale),E&&Ne._rotate(L?this.transform.angle:-this.transform.angle)):it=!1}if(Te.textBox||Te.verticalTextBox){let Ee;Te.textBox&&(Ee=De),Te.verticalTextBox&&(Ee=Re),ui(t.textCollisionBox.collisionVertexArray,ce.text.placed,!it||Ee,Se.text,Ne.x,Ne.y)}}if(Te.iconBox||Te.verticalIconBox){const it=!!(!Re&&Te.verticalIconBox);let Ee;Te.iconBox&&(Ee=it),Te.verticalIconBox&&(Ee=!it),ui(t.iconCollisionBox.collisionVertexArray,ce.icon.placed,Ee,Se.icon,B?Ne.x:0,B?Ne.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 H=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=H.invProjMatrix,t.placementViewportMatrix=H.viewportMatrix,t.collisionCircleArray=H.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 o=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*o>t}setStale(){this.stale=!0}}function ui(u,t,n,o,a,h){o&&o.length!==0||(o=[0,0,0,0]);const m=o[0]-st,_=o[1]-st,v=o[2]-st,b=o[3]-st;u.emplaceBack(t?1:0,n?1:0,a||0,h||0,m,_),u.emplaceBack(t?1:0,n?1:0,a||0,h||0,v,_),u.emplaceBack(t?1:0,n?1:0,a||0,h||0,v,b),u.emplaceBack(t?1:0,n?1:0,a||0,h||0,m,b)}const as=Math.pow(2,25),Tt=Math.pow(2,24),No=Math.pow(2,17),jo=Math.pow(2,16),Oi=Math.pow(2,9),Vi=Math.pow(2,8),Dc=Math.pow(2,1);function Ni(u){if(u.opacity===0&&!u.placed)return 0;if(u.opacity===1&&u.placed)return 4294967295;const t=u.placed?1:0,n=Math.floor(127*u.opacity);return n*as+t*Tt+n*No+t*jo+n*Oi+t*Vi+n*Dc+t}const di=0;function js(){return{isOccluded:(u,t,n)=>!1,getPitchedTextCorrection:(u,t,n)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(u,t,n,o){throw new Error("Not implemented.")},translatePosition:(u,t,n,o)=>function(a,h,m,_,v=!1){if(!m[0]&&!m[1])return[0,0];const b=v?_==="map"?a.angle:0:_==="viewport"?-a.angle:0;if(b){const P=Math.sin(b),E=Math.cos(b);m=[m[0]*E-m[1]*P,m[0]*P+m[1]*E]}return[v?m[0]:nt(h,m[0],a.zoom),v?m[1]:nt(h,m[1],a.zoom)]}(u,t,n,o),getCircleRadiusCorrection:u=>1}}class ls{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,o,a,h){const m=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(m,a,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,h())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,m.sort((_,v)=>_.sortKey-v.sortKey));this._currentPartIndex<m.length;)if(n.placeLayerBucketPart(m[this._currentPartIndex],this._seenCrossTileIDs,o),this._currentPartIndex++,h())return!0;return!1}}class Yt{constructor(t,n,o,a,h,m,_,v){this.placement=new hi(t,js(),n,m,_,v),this._currentPlacementIndex=o.length-1,this._forceFullPlacement=a,this._showCollisionBoxes=h,this._done=!1}isDone(){return this._done}continuePlacement(t,n,o){const a=le.now(),h=()=>!this._forceFullPlacement&&le.now()-a>2;for(;this._currentPlacementIndex>=0;){const m=n[t[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(m.type==="symbol"&&(!m.minzoom||m.minzoom<=_)&&(!m.maxzoom||m.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new ls(m)),this._inProgressLayer.continuePlacement(o[m.source],this.placement,this._showCollisionBoxes,m,h))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const zr=512/c.X/2;class cn{constructor(t,n,o){this.tileID=t,this.bucketInstanceId=o,this._symbolsByKey={};const a=new Map;for(let h=0;h<n.length;h++){const m=n.get(h),_=m.key,v=a.get(_);v?v.push(m):a.set(_,[m])}for(const[h,m]of a){const _={positions:m.map(v=>({x:Math.floor(v.anchorX*zr),y:Math.floor(v.anchorY*zr)})),crossTileIDs:m.map(v=>v.crossTileID)};if(_.positions.length>128){const v=new c.aw(_.positions.length,16,Uint16Array);for(const{x:b,y:P}of _.positions)v.add(b,P);v.finish(),delete _.positions,_.index=v}this._symbolsByKey[h]=_}}getScaledCoordinates(t,n){const{x:o,y:a,z:h}=this.tileID.canonical,{x:m,y:_,z:v}=n.canonical,b=zr/Math.pow(2,v-h),P=(_*c.X+t.anchorY)*b,E=a*c.X*zr;return{x:Math.floor((m*c.X+t.anchorX)*b-o*c.X*zr),y:Math.floor(P-E)}}findMatches(t,n,o){const a=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let h=0;h<t.length;h++){const m=t.get(h);if(m.crossTileID)continue;const _=this._symbolsByKey[m.key];if(!_)continue;const v=this.getScaledCoordinates(m,n);if(_.index){const b=_.index.range(v.x-a,v.y-a,v.x+a,v.y+a).sort();for(const P of b){const E=_.crossTileIDs[P];if(!o[E]){o[E]=!0,m.crossTileID=E;break}}}else if(_.positions)for(let b=0;b<_.positions.length;b++){const P=_.positions[b],E=_.crossTileIDs[b];if(Math.abs(P.x-v.x)<=a&&Math.abs(P.y-v.y)<=a&&!o[E]){o[E]=!0,m.crossTileID=E;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:t})=>t)}}class Wt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Us{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const o in this.indexes){const a=this.indexes[o],h={};for(const m in a){const _=a[m];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+n),h[_.tileID.key]=_}this.indexes[o]=h}this.lng=t}addBucket(t,n,o){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 h=0;h<n.symbolInstances.length;h++)n.symbolInstances.get(h).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const a=this.usedCrossTileIDs[t.overscaledZ];for(const h in this.indexes){const m=this.indexes[h];if(Number(h)>t.overscaledZ)for(const _ in m){const v=m[_];v.tileID.isChildOf(t)&&v.findMatches(n.symbolInstances,t,a)}else{const _=m[t.scaledTo(Number(h)).key];_&&_.findMatches(n.symbolInstances,t,a)}}for(let h=0;h<n.symbolInstances.length;h++){const m=n.symbolInstances.get(h);m.crossTileID||(m.crossTileID=o.generate(),a[m.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new cn(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const o of n.getCrossTileIDsLists())for(const a of o)delete this.usedCrossTileIDs[t][a]}removeStaleBuckets(t){let n=!1;for(const o in this.indexes){const a=this.indexes[o];for(const h in a)t[a[h].bucketInstanceId]||(this.removeBucketCrossTileIDs(o,a[h]),delete a[h],n=!0)}return n}}class Xi{constructor(){this.layerIndexes={},this.crossTileIDs=new Wt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,o){let a=this.layerIndexes[t.id];a===void 0&&(a=this.layerIndexes[t.id]=new Us);let h=!1;const m={};a.handleWrapJump(o);for(const _ of n){const v=_.getBucket(t);v&&t.id===v.layerIds[0]&&(v.bucketInstanceId||(v.bucketInstanceId=++this.maxBucketInstanceId),a.addBucket(_.tileID,v,this.crossTileIDs)&&(h=!0),m[v.bucketInstanceId]=!0)}return a.removeStaleBuckets(m)&&(h=!0),h}pruneUnusedLayers(t){const n={};t.forEach(o=>{n[o]=!0});for(const o in this.layerIndexes)n[o]||delete this.layerIndexes[o]}}const cs=(u,t)=>c.t(u,t&&t.filter(n=>n.identifier!=="source.canvas")),Zr=c.ax();class Uo extends c.E{constructor(t,n={}){super(),this._rtlPluginLoaded=()=>{for(const o in this.sourceCaches){const a=this.sourceCaches[o].getSource().type;a!=="vector"&&a!=="geojson"||this.sourceCaches[o].reload()}},this.map=t,this.dispatcher=new an(on(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",(o,a)=>this.getGlyphs(o,a)),this.dispatcher.registerMessageHandler("GI",(o,a)=>this.getImages(o,a)),this.imageManager=new ci,this.imageManager.setEventedParent(this),this.glyphManager=new pr(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new En(256,512),this.crossTileSymbolIndex=new Xi,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new c.ay,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",c.az()),gr().on(Ie,this._rtlPluginLoaded),this.on("data",o=>{if(o.dataType!=="source"||o.sourceDataType!=="metadata")return;const a=this.sourceCaches[o.sourceId];if(!a)return;const h=a.getSource();if(h&&h.vectorLayerIds)for(const m in this._layers){const _=this._layers[m];_.source===h.id&&this._validateLayer(_)}})}loadURL(t,n={},o){this.fire(new c.k("dataloading",{dataType:"style"})),n.validate=typeof n.validate!="boolean"||n.validate;const a=this.map._requestManager.transformRequest(t,"Style");this._loadStyleRequest=new AbortController;const h=this._loadStyleRequest;c.h(a,this._loadStyleRequest).then(m=>{this._loadStyleRequest=null,this._load(m.data,n,o)}).catch(m=>{this._loadStyleRequest=null,m&&!h.signal.aborted&&this.fire(new c.j(m))})}loadJSON(t,n={},o){this.fire(new c.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,le.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,n.validate=n.validate!==!1,this._load(t,n,o)}).catch(()=>{})}loadEmpty(){this.fire(new c.k("dataloading",{dataType:"style"})),this._load(Zr,{validate:!1})}_load(t,n,o){var a;const h=n.transformStyle?n.transformStyle(o,t):t;if(!n.validate||!cs(this,c.x(h))){this._loaded=!0,this.stylesheet=h;for(const m in h.sources)this.addSource(m,h.sources[m],{validate:!1});h.sprite?this._loadSprite(h.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(h.glyphs),this._createLayers(),this.light=new Cr(this.stylesheet.light),this.sky=new er(this.stylesheet.sky),this.map.setTerrain((a=this.stylesheet.terrain)!==null&&a!==void 0?a:null),this.fire(new c.k("data",{dataType:"style"})),this.fire(new c.k("style.load"))}}_createLayers(){const t=c.aA(this.stylesheet.layers);this.dispatcher.broadcast("SL",t),this._order=t.map(n=>n.id),this._layers={},this._serializedLayers=null;for(const n of t){const o=c.aB(n);o.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=o}}_loadSprite(t,n=!1,o=void 0){let a;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(h,m,_,v){return c._(this,void 0,void 0,function*(){const b=ri(h),P=_>1?"@2x":"",E={},L={};for(const{id:B,url:V}of b){const Z=m.transformRequest(Qi(V,P,".json"),"SpriteJSON");E[B]=c.h(Z,v);const U=m.transformRequest(Qi(V,P,".png"),"SpriteImage");L[B]=Ue.getImage(U,v)}return yield Promise.all([...Object.values(E),...Object.values(L)]),function(B,V){return c._(this,void 0,void 0,function*(){const Z={};for(const U in B){Z[U]={};const H=le.getImageCanvasContext((yield V[U]).data),K=(yield B[U]).data;for(const j in K){const{width:ee,height:ne,x:ce,y:ge,sdf:we,pixelRatio:De,stretchX:Re,stretchY:Se,content:Te,textFitWidth:Ne,textFitHeight:it}=K[j];Z[U][j]={data:null,pixelRatio:De,sdf:we,stretchX:Re,stretchY:Se,content:Te,textFitWidth:Ne,textFitHeight:it,spriteData:{width:ee,height:ne,x:ce,y:ge,context:H}}}}return Z})}(E,L)})}(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(h=>{if(this._spriteRequest=null,h)for(const m in h){this._spritesImagesIds[m]=[];const _=this._spritesImagesIds[m]?this._spritesImagesIds[m].filter(v=>!(v in h)):[];for(const v of _)this.imageManager.removeImage(v),this._changedImages[v]=!0;for(const v in h[m]){const b=m==="default"?v:`${m}:${v}`;this._spritesImagesIds[m].push(b),b in this.imageManager.images?this.imageManager.updateImage(b,h[m][v],!1):this.imageManager.addImage(b,h[m][v]),n&&(this._changedImages[b]=!0)}}}).catch(h=>{this._spriteRequest=null,a=h,this.fire(new c.j(a))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"})),o&&o(a)})}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}_validateLayer(t){const n=this.sourceCaches[t.source];if(!n)return;const o=t.sourceLayer;if(!o)return;const a=n.getSource();(a.type==="geojson"||a.vectorLayerIds&&a.vectorLayerIds.indexOf(o)===-1)&&this.fire(new c.j(new Error(`Source layer "${o}" does not exist on source "${a.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 o=[];for(const a of t)n[a]&&o.push(n[a]);return o}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const n=Object.keys(this._layers);for(const o of n){const a=this._layers[o];a.type!=="custom"&&(t[o]=a.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const n=this._changed;if(n){const a=Object.keys(this._updatedLayers),h=Object.keys(this._removedLayers);(a.length||h.length)&&this._updateWorkerLayers(a,h);for(const m in this._updatedSources){const _=this._updatedSources[m];if(_==="reload")this._reloadSource(m);else{if(_!=="clear")throw new Error(`Invalid action ${_}`);this._clearSource(m)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const m in this._updatedPaintProps)this._layers[m].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}const o={};for(const a in this.sourceCaches){const h=this.sourceCaches[a];o[a]=h.used,h.used=!1}for(const a of this._order){const h=this._layers[a];h.recalculate(t,this._availableImages),!h.isHidden(t.zoom)&&h.source&&(this.sourceCaches[h.source].used=!0)}for(const a in o){const h=this.sourceCaches[a];!!o[a]!=!!h.used&&h.fire(new c.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:a}))}this.light.recalculate(t),this.sky.recalculate(t),this.z=t.zoom,n&&this.fire(new c.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("UL",{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={}){var o;this._checkLoaded();const a=this.serialize();if(t=n.transformStyle?n.transformStyle(a,t):t,((o=n.validate)===null||o===void 0||o)&&cs(this,c.x(t)))return!1;(t=c.aC(t)).layers=c.aA(t.layers);const h=c.aD(a,t),m=this._getOperationsToPerform(h);if(m.unimplemented.length>0)throw new Error(`Unimplemented: ${m.unimplemented.join(", ")}.`);if(m.operations.length===0)return!1;for(const _ of m.operations)_();return this.stylesheet=t,this._serializedLayers=null,!0}_getOperationsToPerform(t){const n=[],o=[];for(const a of t)switch(a.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":n.push(()=>this.addLayer.apply(this,a.args));break;case"removeLayer":n.push(()=>this.removeLayer.apply(this,a.args));break;case"setPaintProperty":n.push(()=>this.setPaintProperty.apply(this,a.args));break;case"setLayoutProperty":n.push(()=>this.setLayoutProperty.apply(this,a.args));break;case"setFilter":n.push(()=>this.setFilter.apply(this,a.args));break;case"addSource":n.push(()=>this.addSource.apply(this,a.args));break;case"removeSource":n.push(()=>this.removeSource.apply(this,a.args));break;case"setLayerZoomRange":n.push(()=>this.setLayerZoomRange.apply(this,a.args));break;case"setLight":n.push(()=>this.setLight.apply(this,a.args));break;case"setGeoJSONSourceData":n.push(()=>this.setGeoJSONSourceData.apply(this,a.args));break;case"setGlyphs":n.push(()=>this.setGlyphs.apply(this,a.args));break;case"setSprite":n.push(()=>this.setSprite.apply(this,a.args));break;case"setSky":n.push(()=>this.setSky.apply(this,a.args));break;case"setTerrain":n.push(()=>this.map.setTerrain.apply(this,a.args));break;case"setTransition":n.push(()=>{});break;default:o.push(a.command)}return{operations:n,unimplemented:o}}addImage(t,n){if(this.getImage(t))return this.fire(new c.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 c.j(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,o={}){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(c.x.source,`sources.${t}`,n,null,o))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const a=this.sourceCaches[t]=new Qe(t,n,this.dispatcher);a.style=this,a.setEventedParent(this,()=>({isSourceLoaded:a.loaded(),source:a.serialize(),sourceId:t})),a.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 o in this._layers)if(this._layers[o].source===t)return this.fire(new c.j(new Error(`Source "${t}" cannot be removed while layer "${o}" is using it.`)));const n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new c.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 o=this.sourceCaches[t].getSource();if(o.type!=="geojson")throw new Error(`geojsonSource.type is ${o.type}, which is !== 'geojson`);o.setData(n),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,n,o={}){this._checkLoaded();const a=t.id;if(this.getLayer(a))return void this.fire(new c.j(new Error(`Layer "${a}" already exists on this map.`)));let h;if(t.type==="custom"){if(cs(this,c.aE(t)))return;h=c.aB(t)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(a,t.source),t=c.aC(t),t=c.e(t,{source:a})),this._validate(c.x.layer,`layers.${a}`,t,{arrayIndex:-1},o))return;h=c.aB(t),this._validateLayer(h),h.setEventedParent(this,{layer:{id:a}})}const m=n?this._order.indexOf(n):this._order.length;if(n&&m===-1)this.fire(new c.j(new Error(`Cannot add layer "${a}" before non-existing layer "${n}".`)));else{if(this._order.splice(m,0,a),this._layerOrderChanged=!0,this._layers[a]=h,this._removedLayers[a]&&h.source&&h.type!=="custom"){const _=this._removedLayers[a];delete this._removedLayers[a],_.type!==h.type?this._updatedSources[h.source]="clear":(this._updatedSources[h.source]="reload",this.sourceCaches[h.source].pause())}this._updateLayer(h),h.onAdd&&h.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new c.j(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const o=this._order.indexOf(t);this._order.splice(o,1);const a=n?this._order.indexOf(n):this._order.length;n&&a===-1?this.fire(new c.j(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(a,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new c.j(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const o=this._order.indexOf(t);this._order.splice(o,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,o){this._checkLoaded();const a=this.getLayer(t);a?a.minzoom===n&&a.maxzoom===o||(n!=null&&(a.minzoom=n),o!=null&&(a.maxzoom=o),this._updateLayer(a)):this.fire(new c.j(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,o={}){this._checkLoaded();const a=this.getLayer(t);if(a){if(!c.aF(a.filter,n))return n==null?(a.filter=void 0,void this._updateLayer(a)):void(this._validate(c.x.filter,`layers.${a.id}.filter`,n,null,o)||(a.filter=c.aC(n),this._updateLayer(a)))}else this.fire(new c.j(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return c.aC(this.getLayer(t).filter)}setLayoutProperty(t,n,o,a={}){this._checkLoaded();const h=this.getLayer(t);h?c.aF(h.getLayoutProperty(n),o)||(h.setLayoutProperty(n,o,a),this._updateLayer(h)):this.fire(new c.j(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const o=this.getLayer(t);if(o)return o.getLayoutProperty(n);this.fire(new c.j(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,o,a={}){this._checkLoaded();const h=this.getLayer(t);h?c.aF(h.getPaintProperty(n),o)||(h.setPaintProperty(n,o,a)&&this._updateLayer(h),this._changed=!0,this._updatedPaintProps[t]=!0,this._serializedLayers=null):this.fire(new c.j(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const o=t.source,a=t.sourceLayer,h=this.sourceCaches[o];if(h===void 0)return void this.fire(new c.j(new Error(`The source '${o}' does not exist in the map's style.`)));const m=h.getSource().type;m==="geojson"&&a?this.fire(new c.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):m!=="vector"||a?(t.id===void 0&&this.fire(new c.j(new Error("The feature id parameter must be provided."))),h.setFeatureState(a,t.id,n)):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const o=t.source,a=this.sourceCaches[o];if(a===void 0)return void this.fire(new c.j(new Error(`The source '${o}' does not exist in the map's style.`)));const h=a.getSource().type,m=h==="vector"?t.sourceLayer:void 0;h!=="vector"||m?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new c.j(new Error("A feature id is required to remove its specific state property."))):a.removeFeatureState(m,t.id,n):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,o=t.sourceLayer,a=this.sourceCaches[n];if(a!==void 0)return a.getSource().type!=="vector"||o?(t.id===void 0&&this.fire(new c.j(new Error("The feature id parameter must be provided."))),a.getFeatureState(o,t.id)):void this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new c.j(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return c.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=c.aG(this.sourceCaches,h=>h.serialize()),n=this._serializeByIds(this._order),o=this.map.getTerrain()||void 0,a=this.stylesheet;return c.aH({version:a.version,name:a.name,metadata:a.metadata,light:a.light,sky:a.sky,center:a.center,zoom:a.zoom,bearing:a.bearing,pitch:a.pitch,sprite:a.sprite,glyphs:a.glyphs,transition:a.transition,sources:t,layers:n,terrain:o},h=>h!==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=m=>this._layers[m].type==="fill-extrusion",o={},a=[];for(let m=this._order.length-1;m>=0;m--){const _=this._order[m];if(n(_)){o[_]=m;for(const v of t){const b=v[_];if(b)for(const P of b)a.push(P)}}}a.sort((m,_)=>_.intersectionZ-m.intersectionZ);const h=[];for(let m=this._order.length-1;m>=0;m--){const _=this._order[m];if(n(_))for(let v=a.length-1;v>=0;v--){const b=a[v].feature;if(o[b.layer.id]<m)break;h.push(b),a.pop()}else for(const v of t){const b=v[_];if(b)for(const P of b)h.push(P.feature)}}return h}queryRenderedFeatures(t,n,o){n&&n.filter&&this._validate(c.x.filter,"queryRenderedFeatures.filter",n.filter,null,n);const a={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new c.j(new Error("parameters.layers must be an Array."))),[];for(const _ of n.layers){const v=this._layers[_];if(!v)return this.fire(new c.j(new Error(`The layer '${_}' does not exist in the map's style and cannot be queried for features.`))),[];a[v.source]=!0}}const h=[];n.availableImages=this._availableImages;const m=this._serializedAllLayers();for(const _ in this.sourceCaches)n.layers&&!a[_]||h.push(Nr(this.sourceCaches[_],this._layers,m,t,n,o));return this.placement&&h.push(function(_,v,b,P,E,L,B){const V={},Z=L.queryRenderedSymbols(P),U=[];for(const H of Object.keys(Z).map(Number))U.push(B[H]);U.sort(jr);for(const H of U){const K=H.featureIndex.lookupSymbolFeatures(Z[H.bucketInstanceId],v,H.bucketIndex,H.sourceLayerIndex,E.filter,E.layers,E.availableImages,_);for(const j in K){const ee=V[j]=V[j]||[],ne=K[j];ne.sort((ce,ge)=>{const we=H.featureSortOrder;if(we){const De=we.indexOf(ce.featureIndex);return we.indexOf(ge.featureIndex)-De}return ge.featureIndex-ce.featureIndex});for(const ce of ne)ee.push(ce)}}for(const H in V)V[H].forEach(K=>{const j=K.feature,ee=b[_[H].source].getFeatureState(j.layer["source-layer"],j.id);j.source=j.layer.source,j.layer["source-layer"]&&(j.sourceLayer=j.layer["source-layer"]),j.state=ee});return V}(this._layers,m,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(h)}querySourceFeatures(t,n){n&&n.filter&&this._validate(c.x.filter,"querySourceFeatures.filter",n.filter,null,n);const o=this.sourceCaches[t];return o?function(a,h){const m=a.getRenderableIds().map(b=>a.getTileByID(b)),_=[],v={};for(let b=0;b<m.length;b++){const P=m[b],E=P.tileID.canonical.key;v[E]||(v[E]=!0,P.querySourceFeatures(_,h))}return _}(o,n):[]}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const o=this.light.getLight();let a=!1;for(const m in t)if(!c.aF(t[m],o[m])){a=!0;break}if(!a)return;const h={now:le.now(),transition:c.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(h)}getSky(){var t;return(t=this.stylesheet)===null||t===void 0?void 0:t.sky}setSky(t,n={}){const o=this.sky.getSky();let a=!1;t||o&&(a=!0);for(const m in t)if(!c.aF(t[m],o[m])){a=!0;break}if(!a)return;const h={now:le.now(),transition:c.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,n),this.sky.updateTransitions(h)}_validate(t,n,o,a,h={}){return(!h||h.validate!==!1)&&cs(this,t.call(c.x,c.e({key:n,style:this.serialize(),value:o,styleSpec:c.v},a)))}_remove(t=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),gr().off(Ie,this._rtlPluginLoaded);for(const n in this._layers)this._layers[n].setEventedParent(null);for(const n in this.sourceCaches){const o=this.sourceCaches[n];o.setEventedParent(null),o.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),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,o,a,h=!1){let m=!1,_=!1;const v={};for(const b of this._order){const P=this._layers[b];if(P.type!=="symbol")continue;if(!v[P.source]){const L=this.sourceCaches[P.source];v[P.source]=L.getRenderableIds(!0).map(B=>L.getTileByID(B)).sort((B,V)=>V.tileID.overscaledZ-B.tileID.overscaledZ||(B.tileID.isLessThan(V.tileID)?-1:1))}const E=this.crossTileSymbolIndex.addLayer(P,v[P.source],t.center.lng);m=m||E}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((h=h||this._layerOrderChanged||o===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(le.now(),t.zoom))&&(this.pauseablePlacement=new Yt(t,this.map.terrain,this._order,h,n,o,a,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,v),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(le.now()),_=!0),m&&this.pauseablePlacement.placement.setStale()),_||m)for(const b of this._order){const P=this._layers[b];P.type==="symbol"&&this.placement.updateLayerOpacities(P,v[P.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(le.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,n){return c._(this,void 0,void 0,function*(){const o=yield this.imageManager.getImages(n.icons);this._updateTilesForChangedImages();const a=this.sourceCaches[n.source];return a&&a.setDependencies(n.tileID.key,n.type,n.icons),o})}getGlyphs(t,n){return c._(this,void 0,void 0,function*(){const o=yield this.glyphManager.getGlyphs(n.stacks),a=this.sourceCaches[n.source];return a&&a.setDependencies(n.tileID.key,n.type,[""]),o})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,n={}){this._checkLoaded(),t&&this._validate(c.x.glyphs,"glyphs",t,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,n,o={},a){this._checkLoaded();const h=[{id:t,url:n}],m=[...ri(this.stylesheet.sprite),...h];this._validate(c.x.sprite,"sprite",m,null,o)||(this.stylesheet.sprite=m,this._loadSprite(h,!0,a))}removeSprite(t){this._checkLoaded();const n=ri(this.stylesheet.sprite);if(n.find(o=>o.id===t)){if(this._spritesImagesIds[t])for(const o of this._spritesImagesIds[t])this.imageManager.removeImage(o),this._changedImages[o]=!0;n.splice(n.findIndex(o=>o.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("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}else this.fire(new c.j(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return ri(this.stylesheet.sprite)}setSprite(t,n={},o){this._checkLoaded(),t&&this._validate(c.x.sprite,"sprite",t,null,n)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,o):(this._unloadSprite(),o&&o(null)))}}var hs=c.Y([{name:"a_pos",type:"Int16",components:2}]);const Gr={prelude:vt(`#ifdef GL_ES
|
4
|
+
*/(function(y,T){(function(D,R){y.exports=R()})(Ro,function(){var D={},R={};function Z(S,u,Ie){if(R[S]=Ie,S==="index"){var xe="var sharedModule = {}; ("+R.shared+")(sharedModule); ("+R.worker+")(sharedModule);",we={};return R.shared(we),R.index(D,we),typeof window<"u"&&D.setWorkerUrl(window.URL.createObjectURL(new Blob([xe],{type:"text/javascript"}))),D}}Z("shared",["exports"],function(S){function u(i,e,r,s){return new(r||(r=Promise))(function(l,d){function p(x){try{g(s.next(x))}catch(w){d(w)}}function f(x){try{g(s.throw(x))}catch(w){d(w)}}function g(x){var w;x.done?l(x.value):(w=x.value,w instanceof r?w:new r(function(I){I(w)})).then(p,f)}g((s=s.apply(i,e||[])).next())})}function Ie(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}typeof SuppressedError=="function"&&SuppressedError;var xe=we;function we(i,e){this.x=i,this.y=e}we.prototype={clone:function(){return new we(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),s=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=s,this},_rotateAround:function(i,e){var r=Math.cos(i),s=Math.sin(i),l=e.y+s*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-s*(this.y-e.y),this.y=l,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},we.convert=function(i){return i instanceof we?i:Array.isArray(i)?new we(i[0],i[1]):i};var he=Ie(xe),ae=dt;function dt(i,e,r,s){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*(s-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=s}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,s=0;s<8;s++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)<e)return r;var d=this.sampleCurveDerivativeX(r);if(Math.abs(d)<1e-6)break;r-=l/d}var p=0,f=1;for(r=i,s=0;s<20&&(l=this.sampleCurveX(r),!(Math.abs(l-i)<e));s++)i>l?p=r:f=r,r=.5*(f-p)+p;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var je=Ie(ae);let Ke,Oe;function xt(){return Ke==null&&(Ke=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Ke}function tt(){if(Oe==null&&(Oe=!1,xt())){const e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let s=0;s<5*5;s++){const l=4*s;e.fillStyle=`rgb(${l},${l+1},${l+2})`,e.fillRect(s%5,Math.floor(s/5),1,1)}const r=e.getImageData(0,0,5,5).data;for(let s=0;s<5*5*4;s++)if(s%4!=3&&r[s]!==s){Oe=!0;break}}}return Oe||!1}function We(i,e,r,s){const l=new je(i,e,r,s);return d=>l.solve(d)}const Ut=We(.25,.1,.25,1);function zt(i,e,r){return Math.min(r,Math.max(e,i))}function Et(i,e,r){const s=r-e,l=((i-e)%s+s)%s+e;return l===e?r:l}function St(i,...e){for(const r of e)for(const s in r)i[s]=r[s];return i}let Yi=1;function ri(i,e,r){const s={};for(const l in i)s[l]=e.call(this,i[l],l,i);return s}function Qi(i,e,r){const s={};for(const l in i)e.call(this,i[l],l,i)&&(s[l]=i[l]);return s}function vt(i){return Array.isArray(i)?i.map(vt):typeof i=="object"&&i?ri(i,vt):i}const Pn={};function ci(i){Pn[i]||(typeof console<"u"&&console.warn(i),Pn[i]=!0)}function wi(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function Er(i){return typeof WorkerGlobalScope<"u"&&i!==void 0&&i instanceof WorkerGlobalScope}let En=null;function pr(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const Ns="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function sn(i,e,r,s,l){return u(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const d=new VideoFrame(i,{timestamp:0});try{const p=d==null?void 0:d.format;if(!p||!p.startsWith("BGR")&&!p.startsWith("RGB"))throw new Error(`Unrecognized format ${p}`);const f=p.startsWith("BGR"),g=new Uint8ClampedArray(s*l*4);if(yield d.copyTo(g,function(x,w,I,A,M){const L=4*Math.max(-w,0),F=(Math.max(0,I)-I)*A*4+L,U=4*A,X=Math.max(0,w),se=Math.max(0,I);return{rect:{x:X,y:se,width:Math.min(x.width,w+A)-X,height:Math.min(x.height,I+M)-se},layout:[{offset:F,stride:U}]}}(i,e,r,s,l)),f)for(let x=0;x<g.length;x+=4){const w=g[x];g[x]=g[x+2],g[x+2]=w}return g}finally{d.close()}})}let Ar,Ai;const er="AbortError";function An(){return new Error(er)}const Vr={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function fr(i){return Vr.REGISTERED_PROTOCOLS[i.substring(0,i.indexOf("://"))]}const Cn="global-dispatcher";class Fi extends Error{constructor(e,r,s,l){super(`AJAXError: ${r} (${e}): ${s}`),this.status=e,this.statusText=r,this.url=s,this.body=l}}const tr=()=>Er(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,on=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){const s=fr(i.url);if(s)return s(i,e);if(Er(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,targetMapId:Cn},e)}if(!(/^file:/.test(r=i.url)||/^file:/.test(tr())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(s,l){return u(this,void 0,void 0,function*(){const d=new Request(s.url,{method:s.method||"GET",body:s.body,credentials:s.credentials,headers:s.headers,cache:s.cache,referrer:tr(),signal:l.signal});s.type!=="json"||d.headers.has("Accept")||d.headers.set("Accept","application/json");const p=yield fetch(d);if(!p.ok){const x=yield p.blob();throw new Fi(p.status,p.statusText,s.url,x)}let f;f=s.type==="arrayBuffer"||s.type==="image"?p.arrayBuffer():s.type==="json"?p.json():p.text();const g=yield f;if(l.signal.aborted)throw An();return{data:g,cacheControl:p.headers.get("Cache-Control"),expires:p.headers.get("Expires")}})}(i,e);if(Er(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,mustQueue:!0,targetMapId:Cn},e)}var r;return function(s,l){return new Promise((d,p)=>{var f;const g=new XMLHttpRequest;g.open(s.method||"GET",s.url,!0),s.type!=="arrayBuffer"&&s.type!=="image"||(g.responseType="arraybuffer");for(const x in s.headers)g.setRequestHeader(x,s.headers[x]);s.type==="json"&&(g.responseType="text",!((f=s.headers)===null||f===void 0)&&f.Accept||g.setRequestHeader("Accept","application/json")),g.withCredentials=s.credentials==="include",g.onerror=()=>{p(new Error(g.statusText))},g.onload=()=>{if(!l.signal.aborted)if((g.status>=200&&g.status<300||g.status===0)&&g.response!==null){let x=g.response;if(s.type==="json")try{x=JSON.parse(g.response)}catch(w){return void p(w)}d({data:x,cacheControl:g.getResponseHeader("Cache-Control"),expires:g.getResponseHeader("Expires")})}else{const x=new Blob([g.response],{type:g.getResponseHeader("Content-Type")});p(new Fi(g.status,g.statusText,s.url,x))}},l.signal.addEventListener("abort",()=>{g.abort(),p(An())}),g.send(s.body)})}(i,e)};function an(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 rs(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function Cr(i,e,r){if(r&&r[i]){const s=r[i].indexOf(e);s!==-1&&r[i].splice(s,1)}}class Nr{constructor(e,r={}){St(this,r),this.type=e}}class jr extends Nr{constructor(e,r={}){super("error",St({error:e},r))}}class kn{on(e,r){return this._listeners=this._listeners||{},rs(e,r,this._listeners),this}off(e,r){return Cr(e,r,this._listeners),Cr(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},rs(e,r,this._oneTimeListeners),this):new Promise(s=>this.once(e,s))}fire(e,r){typeof e=="string"&&(e=new Nr(e,r||{}));const s=e.type;if(this.listens(s)){e.target=this;const l=this._listeners&&this._listeners[s]?this._listeners[s].slice():[];for(const f of l)f.call(this,e);const d=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(const f of d)Cr(s,f,this._oneTimeListeners),f.call(this,e);const p=this._eventedParent;p&&(St(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(e))}else e instanceof jr&&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"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const ln=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function ns(i,e){const r={};for(const s in i)s!=="ref"&&(r[s]=i[s]);return ln.forEach(s=>{s in e&&(r[s]=e[s])}),r}function _t(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(!_t(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(!_t(i[r],e[r]))return!1;return!0}return i===e}function $t(i,e){i.push(e)}function ss(i,e,r){$t(r,{command:"addSource",args:[i,e[i]]})}function Ur(i,e,r){$t(e,{command:"removeSource",args:[i]}),r[i]=!0}function kr(i,e,r,s){Ur(i,r,s),ss(i,e,r)}function Mn(i,e,r){let s;for(s in i[r])if(Object.prototype.hasOwnProperty.call(i[r],s)&&s!=="data"&&!_t(i[r][s],e[r][s]))return!1;for(s in e[r])if(Object.prototype.hasOwnProperty.call(e[r],s)&&s!=="data"&&!_t(i[r][s],e[r][s]))return!1;return!0}function Hi(i,e,r,s,l,d){i=i||{},e=e||{};for(const p in i)Object.prototype.hasOwnProperty.call(i,p)&&(_t(i[p],e[p])||r.push({command:d,args:[s,p,e[p],l]}));for(const p in e)Object.prototype.hasOwnProperty.call(e,p)&&!Object.prototype.hasOwnProperty.call(i,p)&&(_t(i[p],e[p])||r.push({command:d,args:[s,p,e[p],l]}))}function os(i){return i.id}function as(i,e){return i[e.id]=e,i}class Te{constructor(e,r,s,l){this.message=(e?`${e}: `:"")+s,l&&(this.identifier=l),r!=null&&r.__line__&&(this.line=r.__line__)}}function mr(i,...e){for(const r of e)for(const s in r)i[s]=r[s];return i}class Si extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}class gr{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[s,l]of r)this.bindings[s]=l}concat(e){return new gr(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 $r={kind:"null"},Ae={kind:"number"},at={kind:"string"},Ye={kind:"boolean"},Ci={kind:"color"},ir={kind:"object"},rt={kind:"value"},_r={kind:"collator"},Mr={kind:"formatted"},qr={kind:"padding"},yr={kind:"resolvedImage"},G={kind:"variableAnchorOffsetCollection"};function k(i,e){return{kind:"array",itemType:i,N:e}}function C(i){if(i.kind==="array"){const e=C(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const O=[$r,Ae,at,Ye,Ci,Mr,ir,k(rt),qr,yr,G];function $(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!$(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const r of O)if(!$(r,e))return null}}return`Expected ${C(i)} but found ${C(e)} instead.`}function Y(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 re(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const W=.96422,pe=.82521,_e=4/29,ce=6/29,Pe=3*ce*ce,Ge=ce*ce*ce,He=Math.PI/180,st=180/Math.PI;function ft(i){return(i%=360)<0&&(i+=360),i}function nt([i,e,r,s]){let l,d;const p=qt((.2225045*(i=At(i))+.7168786*(e=At(e))+.0606169*(r=At(r)))/1);i===e&&e===r?l=d=p:(l=qt((.4360747*i+.3850649*e+.1430804*r)/W),d=qt((.0139322*i+.0971045*e+.7141733*r)/pe));const f=116*p-16;return[f<0?0:f,500*(l-p),200*(p-d),s]}function At(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function qt(i){return i>Ge?Math.pow(i,1/3):i/Pe+_e}function Kt([i,e,r,s]){let l=(i+16)/116,d=isNaN(e)?l:l+e/500,p=isNaN(r)?l:l-r/200;return l=1*bt(l),d=W*bt(d),p=pe*bt(p),[lt(3.1338561*d-1.6168667*l-.4906146*p),lt(-.9787684*d+1.9161415*l+.033454*p),lt(.0719453*d-.2289914*l+1.4052427*p),s]}function lt(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function bt(i){return i>ce?i*i*i:Pe*(i-_e)}function Vt(i){return parseInt(i.padEnd(2,i),16)/255}function ei(i,e){return hi(e?i/100:i,0,1)}function hi(i,e,r){return Math.min(Math.max(e,i),r)}function ui(i){return!i.some(Number.isNaN)}const ls={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 wt{constructor(e,r,s,l=1,d=!0){this.r=e,this.g=r,this.b=s,this.a=l,d||(this.r*=l,this.g*=l,this.b*=l,l||this.overwriteGetter("rgb",[e,r,s,l]))}static parse(e){if(e instanceof wt)return e;if(typeof e!="string")return;const r=function(s){if((s=s.toLowerCase().trim())==="transparent")return[0,0,0,0];const l=ls[s];if(l){const[p,f,g]=l;return[p/255,f/255,g/255,1]}if(s.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(s)){const p=s.length<6?1:2;let f=1;return[Vt(s.slice(f,f+=p)),Vt(s.slice(f,f+=p)),Vt(s.slice(f,f+=p)),Vt(s.slice(f,f+p)||"ff")]}if(s.startsWith("rgb")){const p=s.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(p){const[f,g,x,w,I,A,M,L,F,U,X,se]=p,K=[w||" ",M||" ",U].join("");if(K===" "||K===" /"||K===",,"||K===",,,"){const ie=[x,A,F].join(""),de=ie==="%%%"?100:ie===""?255:0;if(de){const ye=[hi(+g/de,0,1),hi(+I/de,0,1),hi(+L/de,0,1),X?ei(+X,se):1];if(ui(ye))return ye}}return}}const d=s.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){const[p,f,g,x,w,I,A,M,L]=d,F=[g||" ",w||" ",A].join("");if(F===" "||F===" /"||F===",,"||F===",,,"){const U=[+f,hi(+x,0,100),hi(+I,0,100),M?ei(+M,L):1];if(ui(U))return function([X,se,K,ie]){function de(ye){const Le=(ye+X/30)%12,Xe=se*Math.min(K,1-K);return K-Xe*Math.max(-1,Math.min(Le-3,9-Le,1))}return X=ft(X),se/=100,K/=100,[de(0),de(8),de(4),ie]}(U)}}}(e);return r?new wt(...r,!1):void 0}get rgb(){const{r:e,g:r,b:s,a:l}=this,d=l||1/0;return this.overwriteGetter("rgb",[e/d,r/d,s/d,l])}get hcl(){return this.overwriteGetter("hcl",function(e){const[r,s,l,d]=nt(e),p=Math.sqrt(s*s+l*l);return[Math.round(1e4*p)?ft(Math.atan2(l,s)*st):NaN,p,r,d]}(this.rgb))}get lab(){return this.overwriteGetter("lab",nt(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){const[e,r,s,l]=this.rgb;return`rgba(${[e,r,s].map(d=>Math.round(255*d)).join(",")},${l})`}}wt.black=new wt(0,0,0,1),wt.white=new wt(1,1,1,1),wt.transparent=new wt(0,0,0,0),wt.red=new wt(1,0,0,1);class No{constructor(e,r,s){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=s,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 jo{constructor(e,r,s,l,d){this.text=e,this.image=r,this.scale=s,this.fontStack=l,this.textColor=d}}class Oi{constructor(e){this.sections=e}static fromString(e){return new Oi([new jo(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 Vi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Vi)return e;if(typeof e=="number")return new Vi([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 Vi(e)}}toString(){return JSON.stringify(this.values)}}const Dc=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Ni{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ni)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let r=0;r<e.length;r+=2){const s=e[r],l=e[r+1];if(typeof s!="string"||!Dc.has(s)||!Array.isArray(l)||l.length!==2||typeof l[0]!="number"||typeof l[1]!="number")return}return new Ni(e)}}toString(){return JSON.stringify(this.values)}}class di{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new di({name:e,available:!1}):null}}function js(i,e,r,s){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[i,e,r,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[i,e,r,s]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function cs(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof wt||i instanceof No||i instanceof Oi||i instanceof Vi||i instanceof Ni||i instanceof di)return!0;if(Array.isArray(i)){for(const e of i)if(!cs(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!cs(i[e]))return!1;return!0}return!1}function Yt(i){if(i===null)return $r;if(typeof i=="string")return at;if(typeof i=="boolean")return Ye;if(typeof i=="number")return Ae;if(i instanceof wt)return Ci;if(i instanceof No)return _r;if(i instanceof Oi)return Mr;if(i instanceof Vi)return qr;if(i instanceof Ni)return G;if(i instanceof di)return yr;if(Array.isArray(i)){const e=i.length;let r;for(const s of i){const l=Yt(s);if(r){if(r===l)continue;r=rt;break}r=l}return k(r||rt,e)}return ir}function zr(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof wt||i instanceof Oi||i instanceof Vi||i instanceof Ni||i instanceof di?i.toString():JSON.stringify(i)}class cn{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(!cs(e[1]))return r.error("invalid value");const s=e[1];let l=Yt(s);const d=r.expectedType;return l.kind!=="array"||l.N!==0||!d||d.kind!=="array"||typeof d.N=="number"&&d.N!==0||(l=d),new cn(l,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Wt{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Us={string:at,number:Ae,boolean:Ye,object:ir};class Xi{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 s,l=1;const d=e[0];if(d==="array"){let f,g;if(e.length>2){const x=e[1];if(typeof x!="string"||!(x in Us)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);f=Us[x],l++}else f=rt;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);g=e[2],l++}s=k(f,g)}else{if(!Us[d])throw new Error(`Types doesn't contain name = ${d}`);s=Us[d]}const p=[];for(;l<e.length;l++){const f=r.parse(e[l],l,rt);if(!f)return null;p.push(f)}return new Xi(s,p)}evaluate(e){for(let r=0;r<this.args.length;r++){const s=this.args[r].evaluate(e);if(!$(this.type,Yt(s)))return s;if(r===this.args.length-1)throw new Wt(`Expected value to be of type ${C(this.type)}, but found ${C(Yt(s))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const hs={"to-boolean":Ye,"to-color":Ci,"to-number":Ae,"to-string":at};class Zr{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 s=e[0];if(!hs[s])throw new Error(`Can't parse ${s} as it is not part of the known types`);if((s==="to-boolean"||s==="to-string")&&e.length!==2)return r.error("Expected one argument.");const l=hs[s],d=[];for(let p=1;p<e.length;p++){const f=r.parse(e[p],p,rt);if(!f)return null;d.push(f)}return new Zr(l,d)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let r,s;for(const l of this.args){if(r=l.evaluate(e),s=null,r instanceof wt)return r;if(typeof r=="string"){const d=e.parseColor(r);if(d)return d}else if(Array.isArray(r)&&(s=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:js(r[0],r[1],r[2],r[3]),!s))return new wt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Wt(s||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(const s of this.args){r=s.evaluate(e);const l=Vi.parse(r);if(l)return l}throw new Wt(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(const s of this.args){r=s.evaluate(e);const l=Ni.parse(r);if(l)return l}throw new Wt(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(const s of this.args){if(r=s.evaluate(e),r===null)return 0;const l=Number(r);if(!isNaN(l))return l}throw new Wt(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return Oi.fromString(zr(this.args[0].evaluate(e)));case"resolvedImage":return di.fromString(zr(this.args[0].evaluate(e)));default:return zr(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Uo=["Unknown","Point","LineString","Polygon"];class us{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"?Uo[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]=wt.parse(e)),r}}class Gr{constructor(e,r,s=[],l,d=new gr,p=[]){this.registry=e,this.path=s,this.key=s.map(f=>`[${f}]`).join(""),this.scope=d,this.errors=p,this.expectedType=l,this._isConstant=r}parse(e,r,s,l,d={}){return r?this.concat(r,s,l)._parse(e,d):this._parse(e,d)}_parse(e,r){function s(l,d,p){return p==="assert"?new Xi(d,[l]):p==="coerce"?new Zr(d,[l]):l}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 l=e[0];if(typeof l!="string")return this.error(`Expression name must be a string, but found ${typeof l} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const d=this.registry[l];if(d){let p=d.parse(e,this);if(!p)return null;if(this.expectedType){const f=this.expectedType,g=p.type;if(f.kind!=="string"&&f.kind!=="number"&&f.kind!=="boolean"&&f.kind!=="object"&&f.kind!=="array"||g.kind!=="value")if(f.kind!=="color"&&f.kind!=="formatted"&&f.kind!=="resolvedImage"||g.kind!=="value"&&g.kind!=="string")if(f.kind!=="padding"||g.kind!=="value"&&g.kind!=="number"&&g.kind!=="array")if(f.kind!=="variableAnchorOffsetCollection"||g.kind!=="value"&&g.kind!=="array"){if(this.checkSubtype(f,g))return null}else p=s(p,f,r.typeAnnotation||"coerce");else p=s(p,f,r.typeAnnotation||"coerce");else p=s(p,f,r.typeAnnotation||"coerce");else p=s(p,f,r.typeAnnotation||"assert")}if(!(p instanceof cn)&&p.type.kind!=="resolvedImage"&&this._isConstant(p)){const f=new us;try{p=new cn(p.type,p.evaluate(f))}catch(g){return this.error(g.message),null}}return p}return this.error(`Unknown expression "${l}". 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,s){const l=typeof e=="number"?this.path.concat(e):this.path,d=s?this.scope.concat(s):this.scope;return new Gr(this.registry,this._isConstant,l,r||null,d,this.errors)}error(e,...r){const s=`${this.key}${r.map(l=>`[${l}]`).join("")}`;this.errors.push(new Si(s,e))}checkSubtype(e,r){const s=$(e,r);return s&&this.error(s),s}}class yt{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 s=[];for(let d=1;d<e.length-1;d+=2){const p=e[d];if(typeof p!="string")return r.error(`Expected string, but found ${typeof p} instead.`,d);if(/[^a-zA-Z0-9_]/.test(p))return r.error("Variable names must contain only alphanumeric characters or '_'.",d);const f=r.parse(e[d+1],d+1);if(!f)return null;s.push([p,f])}const l=r.parse(e[e.length-1],e.length-1,r.expectedType,s);return l?new yt(s,l):null}outputDefined(){return this.result.outputDefined()}}class $s{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 s=e[1];return r.scope.has(s)?new $s(s,r.scope.get(s)):r.error(`Unknown variable "${s}". Make sure "${s}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class $o{constructor(e,r,s){this.type=e,this.index=r,this.input=s}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,Ae),l=r.parse(e[2],2,k(r.expectedType||rt));return s&&l?new $o(l.type.itemType,s,l):null}evaluate(e){const r=this.index.evaluate(e),s=this.input.evaluate(e);if(r<0)throw new Wt(`Array index out of bounds: ${r} < 0.`);if(r>=s.length)throw new Wt(`Array index out of bounds: ${r} > ${s.length-1}.`);if(r!==Math.floor(r))throw new Wt(`Array index must be an integer, but found ${r} instead.`);return s[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class ds{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 s=r.parse(e[1],1,rt),l=r.parse(e[2],2,rt);return s&&l?Y(s.type,[Ye,at,Ae,$r,rt])?new ds(s,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${C(s.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!s)return!1;if(!te(r,["boolean","string","number","null"]))throw new Wt(`Expected first argument to be of type boolean, string, number or null, but found ${C(Yt(r))} instead.`);if(!te(s,["string","array"]))throw new Wt(`Expected second argument to be of type array or string, but found ${C(Yt(s))} instead.`);return s.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class qs{constructor(e,r,s){this.type=Ae,this.needle=e,this.haystack=r,this.fromIndex=s}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 s=r.parse(e[1],1,rt),l=r.parse(e[2],2,rt);if(!s||!l)return null;if(!Y(s.type,[Ye,at,Ae,$r,rt]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${C(s.type)} instead`);if(e.length===4){const d=r.parse(e[3],3,Ae);return d?new qs(s,l,d):null}return new qs(s,l)}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!te(r,["boolean","string","number","null"]))throw new Wt(`Expected first argument to be of type boolean, string, number or null, but found ${C(Yt(r))} instead.`);if(!te(s,["string","array"]))throw new Wt(`Expected second argument to be of type array or string, but found ${C(Yt(s))} instead.`);if(this.fromIndex){const l=this.fromIndex.evaluate(e);return s.indexOf(r,l)}return s.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class Zs{constructor(e,r,s,l,d,p){this.inputType=e,this.type=r,this.input=s,this.cases=l,this.outputs=d,this.otherwise=p}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 s,l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);const d={},p=[];for(let x=2;x<e.length-1;x+=2){let w=e[x];const I=e[x+1];Array.isArray(w)||(w=[w]);const A=r.concat(x);if(w.length===0)return A.error("Expected at least one branch label.");for(const L of w){if(typeof L!="number"&&typeof L!="string")return A.error("Branch labels must be numbers or strings.");if(typeof L=="number"&&Math.abs(L)>Number.MAX_SAFE_INTEGER)return A.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof L=="number"&&Math.floor(L)!==L)return A.error("Numeric branch labels must be integer values.");if(s){if(A.checkSubtype(s,Yt(L)))return null}else s=Yt(L);if(d[String(L)]!==void 0)return A.error("Branch labels must be unique.");d[String(L)]=p.length}const M=r.parse(I,x,l);if(!M)return null;l=l||M.type,p.push(M)}const f=r.parse(e[1],1,rt);if(!f)return null;const g=r.parse(e[e.length-1],e.length-1,l);return g?f.type.kind!=="value"&&r.concat(1).checkSubtype(s,f.type)?null:new Zs(s,l,f,d,p,g):null}evaluate(e){const r=this.input.evaluate(e);return(Yt(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 Gs{constructor(e,r,s){this.type=e,this.branches=r,this.otherwise=s}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 s;r.expectedType&&r.expectedType.kind!=="value"&&(s=r.expectedType);const l=[];for(let p=1;p<e.length-1;p+=2){const f=r.parse(e[p],p,Ye);if(!f)return null;const g=r.parse(e[p+1],p+1,s);if(!g)return null;l.push([f,g]),s=s||g.type}const d=r.parse(e[e.length-1],e.length-1,s);if(!d)return null;if(!s)throw new Error("Can't infer output type");return new Gs(s,l,d)}evaluate(e){for(const[r,s]of this.branches)if(r.evaluate(e))return s.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[r,s]of this.branches)e(r),e(s);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}}class Hs{constructor(e,r,s,l){this.type=e,this.input=r,this.beginIndex=s,this.endIndex=l}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 s=r.parse(e[1],1,rt),l=r.parse(e[2],2,Ae);if(!s||!l)return null;if(!Y(s.type,[k(rt),at,rt]))return r.error(`Expected first argument to be of type array or string, but found ${C(s.type)} instead`);if(e.length===4){const d=r.parse(e[3],3,Ae);return d?new Hs(s.type,s,l,d):null}return new Hs(s.type,s,l)}evaluate(e){const r=this.input.evaluate(e),s=this.beginIndex.evaluate(e);if(!te(r,["string","array"]))throw new Wt(`Expected first argument to be of type array or string, but found ${C(Yt(r))} instead.`);if(this.endIndex){const l=this.endIndex.evaluate(e);return r.slice(s,l)}return r.slice(s)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function ps(i,e){const r=i.length-1;let s,l,d=0,p=r,f=0;for(;d<=p;)if(f=Math.floor((d+p)/2),s=i[f],l=i[f+1],s<=e){if(f===r||e<l)return f;d=f+1}else{if(!(s>e))throw new Wt("Input is not a number.");p=f-1}return 0}class zn{constructor(e,r,s){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[l,d]of s)this.labels.push(l),this.outputs.push(d)}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 s=r.parse(e[1],1,Ae);if(!s)return null;const l=[];let d=null;r.expectedType&&r.expectedType.kind!=="value"&&(d=r.expectedType);for(let p=1;p<e.length;p+=2){const f=p===1?-1/0:e[p],g=e[p+1],x=p,w=p+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.',x);if(l.length&&l[l.length-1][0]>=f)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',x);const I=r.parse(g,w,d);if(!I)return null;d=d||I.type,l.push([f,I])}return new zn(d,s,l)}evaluate(e){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return s[0].evaluate(e);const d=r.length;return l>=r[d-1]?s[d-1].evaluate(e):s[ps(r,l)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Lc(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Rc=hl;function hl(i,e,r,s){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*(s-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=s}hl.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,s=0;s<8;s++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)<e)return r;var d=this.sampleCurveDerivativeX(r);if(Math.abs(d)<1e-6)break;r-=l/d}var p=0,f=1;for(r=i,s=0;s<20&&(l=this.sampleCurveX(r),!(Math.abs(l-i)<e));s++)i>l?p=r:f=r,r=.5*(f-p)+p;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var Bc=Lc(Rc);function Hr(i,e,r){return i+r*(e-i)}function fs(i,e,r){return i.map((s,l)=>Hr(s,e[l],r))}const ji={number:Hr,color:function(i,e,r,s="rgb"){switch(s){case"rgb":{const[l,d,p,f]=fs(i.rgb,e.rgb,r);return new wt(l,d,p,f,!1)}case"hcl":{const[l,d,p,f]=i.hcl,[g,x,w,I]=e.hcl;let A,M;if(isNaN(l)||isNaN(g))isNaN(l)?isNaN(g)?A=NaN:(A=g,p!==1&&p!==0||(M=x)):(A=l,w!==1&&w!==0||(M=d));else{let se=g-l;g>l&&se>180?se-=360:g<l&&l-g>180&&(se+=360),A=l+r*se}const[L,F,U,X]=function([se,K,ie,de]){return se=isNaN(se)?0:se*He,Kt([ie,Math.cos(se)*K,Math.sin(se)*K,de])}([A,M??Hr(d,x,r),Hr(p,w,r),Hr(f,I,r)]);return new wt(L,F,U,X,!1)}case"lab":{const[l,d,p,f]=Kt(fs(i.lab,e.lab,r));return new wt(l,d,p,f,!1)}}},array:fs,padding:function(i,e,r){return new Vi(fs(i.values,e.values,r))},variableAnchorOffsetCollection:function(i,e,r){const s=i.values,l=e.values;if(s.length!==l.length)throw new Wt(`Cannot interpolate values of different length. from: ${i.toString()}, to: ${e.toString()}`);const d=[];for(let p=0;p<s.length;p+=2){if(s[p]!==l[p])throw new Wt(`Cannot interpolate values containing mismatched anchors. from[${p}]: ${s[p]}, to[${p}]: ${l[p]}`);d.push(s[p]);const[f,g]=s[p+1],[x,w]=l[p+1];d.push([Hr(f,x,r),Hr(g,w,r)])}return new Ni(d)}};class Ui{constructor(e,r,s,l,d){this.type=e,this.operator=r,this.interpolation=s,this.input=l,this.labels=[],this.outputs=[];for(const[p,f]of d)this.labels.push(p),this.outputs.push(f)}static interpolationFactor(e,r,s,l){let d=0;if(e.name==="exponential")d=ms(r,e.base,s,l);else if(e.name==="linear")d=ms(r,1,s,l);else if(e.name==="cubic-bezier"){const p=e.controlPoints;d=new Bc(p[0],p[1],p[2],p[3]).solve(ms(r,1,s,l))}return d}static parse(e,r){let[s,l,d,...p]=e;if(!Array.isArray(l)||l.length===0)return r.error("Expected an interpolation type expression.",1);if(l[0]==="linear")l={name:"linear"};else if(l[0]==="exponential"){const x=l[1];if(typeof x!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);l={name:"exponential",base:x}}else{if(l[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(l[0])}`,1,0);{const x=l.slice(1);if(x.length!==4||x.some(w=>typeof w!="number"||w<0||w>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);l={name:"cubic-bezier",controlPoints:x}}}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(d=r.parse(d,2,Ae),!d)return null;const f=[];let g=null;s==="interpolate-hcl"||s==="interpolate-lab"?g=Ci:r.expectedType&&r.expectedType.kind!=="value"&&(g=r.expectedType);for(let x=0;x<p.length;x+=2){const w=p[x],I=p[x+1],A=x+3,M=x+4;if(typeof w!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',A);if(f.length&&f[f.length-1][0]>=w)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',A);const L=r.parse(I,M,g);if(!L)return null;g=g||L.type,f.push([w,L])}return re(g,Ae)||re(g,Ci)||re(g,qr)||re(g,G)||re(g,k(Ae))?new Ui(g,s,l,d,f):r.error(`Type ${C(g)} is not interpolatable.`)}evaluate(e){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return s[0].evaluate(e);const d=r.length;if(l>=r[d-1])return s[d-1].evaluate(e);const p=ps(r,l),f=Ui.interpolationFactor(this.interpolation,l,r[p],r[p+1]),g=s[p].evaluate(e),x=s[p+1].evaluate(e);switch(this.operator){case"interpolate":return ji[this.type.kind](g,x,f);case"interpolate-hcl":return ji.color(g,x,f,"hcl");case"interpolate-lab":return ji.color(g,x,f,"lab")}}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function ms(i,e,r,s){const l=s-r,d=i-r;return l===0?0:e===1?d/l:(Math.pow(e,d)-1)/(Math.pow(e,l)-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 s=null;const l=r.expectedType;l&&l.kind!=="value"&&(s=l);const d=[];for(const f of e.slice(1)){const g=r.parse(f,1+d.length,s,void 0,{typeAnnotation:"omit"});if(!g)return null;s=s||g.type,d.push(g)}if(!s)throw new Error("No output type");const p=l&&d.some(f=>$(l,f.type));return new Xs(p?rt:s,d)}evaluate(e){let r,s=null,l=0;for(const d of this.args)if(l++,s=d.evaluate(e),s&&s instanceof di&&!s.available&&(r||(r=s.name),s=null,l===this.args.length&&(s=r)),s!==null)break;return s}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}function ul(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 dl(i,e,r,s){return s.compare(e,r)===0}function hn(i,e,r){const s=i!=="=="&&i!=="!=";return class pp{constructor(d,p,f){this.type=Ye,this.lhs=d,this.rhs=p,this.collator=f,this.hasUntypedArgument=d.type.kind==="value"||p.type.kind==="value"}static parse(d,p){if(d.length!==3&&d.length!==4)return p.error("Expected two or three arguments.");const f=d[0];let g=p.parse(d[1],1,rt);if(!g)return null;if(!ul(f,g.type))return p.concat(1).error(`"${f}" comparisons are not supported for type '${C(g.type)}'.`);let x=p.parse(d[2],2,rt);if(!x)return null;if(!ul(f,x.type))return p.concat(2).error(`"${f}" comparisons are not supported for type '${C(x.type)}'.`);if(g.type.kind!==x.type.kind&&g.type.kind!=="value"&&x.type.kind!=="value")return p.error(`Cannot compare types '${C(g.type)}' and '${C(x.type)}'.`);s&&(g.type.kind==="value"&&x.type.kind!=="value"?g=new Xi(x.type,[g]):g.type.kind!=="value"&&x.type.kind==="value"&&(x=new Xi(g.type,[x])));let w=null;if(d.length===4){if(g.type.kind!=="string"&&x.type.kind!=="string"&&g.type.kind!=="value"&&x.type.kind!=="value")return p.error("Cannot use collator to compare non-string types.");if(w=p.parse(d[3],3,_r),!w)return null}return new pp(g,x,w)}evaluate(d){const p=this.lhs.evaluate(d),f=this.rhs.evaluate(d);if(s&&this.hasUntypedArgument){const g=Yt(p),x=Yt(f);if(g.kind!==x.kind||g.kind!=="string"&&g.kind!=="number")throw new Wt(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${g.kind}, ${x.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const g=Yt(p),x=Yt(f);if(g.kind!=="string"||x.kind!=="string")return e(d,p,f)}return this.collator?r(d,p,f,this.collator.evaluate(d)):e(d,p,f)}eachChild(d){d(this.lhs),d(this.rhs),this.collator&&d(this.collator)}outputDefined(){return!0}}}const pl=hn("==",function(i,e,r){return e===r},dl),Fc=hn("!=",function(i,e,r){return e!==r},function(i,e,r,s){return!dl(0,e,r,s)}),Oc=hn("<",function(i,e,r){return e<r},function(i,e,r,s){return s.compare(e,r)<0}),fl=hn(">",function(i,e,r){return e>r},function(i,e,r,s){return s.compare(e,r)>0}),ml=hn("<=",function(i,e,r){return e<=r},function(i,e,r,s){return s.compare(e,r)<=0}),Vc=hn(">=",function(i,e,r){return e>=r},function(i,e,r,s){return s.compare(e,r)>=0});class Ws{constructor(e,r,s){this.type=_r,this.locale=s,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const s=e[1];if(typeof s!="object"||Array.isArray(s))return r.error("Collator options argument must be an object.");const l=r.parse(s["case-sensitive"]!==void 0&&s["case-sensitive"],1,Ye);if(!l)return null;const d=r.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,Ye);if(!d)return null;let p=null;return s.locale&&(p=r.parse(s.locale,1,at),!p)?null:new Ws(l,d,p)}evaluate(e){return new No(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class qo{constructor(e,r,s,l,d){this.type=at,this.number=e,this.locale=r,this.currency=s,this.minFractionDigits=l,this.maxFractionDigits=d}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const s=r.parse(e[1],1,Ae);if(!s)return null;const l=e[2];if(typeof l!="object"||Array.isArray(l))return r.error("NumberFormat options argument must be an object.");let d=null;if(l.locale&&(d=r.parse(l.locale,1,at),!d))return null;let p=null;if(l.currency&&(p=r.parse(l.currency,1,at),!p))return null;let f=null;if(l["min-fraction-digits"]&&(f=r.parse(l["min-fraction-digits"],1,Ae),!f))return null;let g=null;return l["max-fraction-digits"]&&(g=r.parse(l["max-fraction-digits"],1,Ae),!g)?null:new qo(s,d,p,f,g)}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 Js{constructor(e){this.type=Mr,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const s=e[1];if(!Array.isArray(s)&&typeof s=="object")return r.error("First argument must be an image or text section.");const l=[];let d=!1;for(let p=1;p<=e.length-1;++p){const f=e[p];if(d&&typeof f=="object"&&!Array.isArray(f)){d=!1;let g=null;if(f["font-scale"]&&(g=r.parse(f["font-scale"],1,Ae),!g))return null;let x=null;if(f["text-font"]&&(x=r.parse(f["text-font"],1,k(at)),!x))return null;let w=null;if(f["text-color"]&&(w=r.parse(f["text-color"],1,Ci),!w))return null;const I=l[l.length-1];I.scale=g,I.font=x,I.textColor=w}else{const g=r.parse(e[p],1,rt);if(!g)return null;const x=g.type.kind;if(x!=="string"&&x!=="value"&&x!=="null"&&x!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");d=!0,l.push({content:g,scale:null,font:null,textColor:null})}}return new Js(l)}evaluate(e){return new Oi(this.sections.map(r=>{const s=r.content.evaluate(e);return Yt(s)===yr?new jo("",s,null,null,null):new jo(zr(s),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 Zo{constructor(e){this.type=yr,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const s=r.parse(e[1],1,at);return s?new Zo(s):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),s=di.fromString(r);return s&&e.availableImages&&(s.available=e.availableImages.indexOf(r)>-1),s}eachChild(e){e(this.input)}outputDefined(){return!1}}class Go{constructor(e){this.type=Ae,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=r.parse(e[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${C(s.type)} instead.`):new Go(s):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new Wt(`Expected value to be of type string or array, but found ${C(Yt(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const xr=8192;function Ho(i,e){const r=(180+i[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,l=Math.pow(2,e.z);return[Math.round(r*l*xr),Math.round(s*l*xr)]}function Dn(i,e){const r=Math.pow(2,e.z);return[(l=(i[0]/xr+e.x)/r,360*l-180),(s=(i[1]/xr+e.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90)];var s,l}function pt(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 gs(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function Nc(i,e,r){const s=i[0]-e[0],l=i[1]-e[1],d=i[0]-r[0],p=i[1]-r[1];return s*p-d*l==0&&s*d<=0&&l*p<=0}function Ks(i,e,r,s){return(l=[s[0]-r[0],s[1]-r[1]])[0]*(d=[e[0]-i[0],e[1]-i[1]])[1]-l[1]*d[0]!=0&&!(!_l(i,e,r,s)||!_l(r,s,i,e));var l,d}function jc(i,e,r){for(const s of r)for(let l=0;l<s.length-1;++l)if(Ks(i,e,s[l],s[l+1]))return!0;return!1}function Ln(i,e,r=!1){let s=!1;for(const f of e)for(let g=0;g<f.length-1;g++){if(Nc(i,f[g],f[g+1]))return r;(d=f[g])[1]>(l=i)[1]!=(p=f[g+1])[1]>l[1]&&l[0]<(p[0]-d[0])*(l[1]-d[1])/(p[1]-d[1])+d[0]&&(s=!s)}var l,d,p;return s}function Uc(i,e){for(const r of e)if(Ln(i,r))return!0;return!1}function gl(i,e){for(const r of i)if(!Ln(r,e))return!1;for(let r=0;r<i.length-1;++r)if(jc(i[r],i[r+1],e))return!1;return!0}function $c(i,e){for(const r of e)if(gl(i,r))return!0;return!1}function _l(i,e,r,s){const l=s[0]-r[0],d=s[1]-r[1],p=(i[0]-r[0])*d-l*(i[1]-r[1]),f=(e[0]-r[0])*d-l*(e[1]-r[1]);return p>0&&f<0||p<0&&f>0}function Xo(i,e,r){const s=[];for(let l=0;l<i.length;l++){const d=[];for(let p=0;p<i[l].length;p++){const f=Ho(i[l][p],r);pt(e,f),d.push(f)}s.push(d)}return s}function yl(i,e,r){const s=[];for(let l=0;l<i.length;l++){const d=Xo(i[l],e,r);s.push(d)}return s}function xl(i,e,r,s){if(i[0]<r[0]||i[0]>r[2]){const l=.5*s;let d=i[0]-r[0]>l?-s:r[0]-i[0]>l?s:0;d===0&&(d=i[0]-r[2]>l?-s:r[2]-i[0]>l?s:0),i[0]+=d}pt(e,i)}function vl(i,e,r,s){const l=Math.pow(2,s.z)*xr,d=[s.x*xr,s.y*xr],p=[];for(const f of i)for(const g of f){const x=[g.x+d[0],g.y+d[1]];xl(x,e,r,l),p.push(x)}return p}function bl(i,e,r,s){const l=Math.pow(2,s.z)*xr,d=[s.x*xr,s.y*xr],p=[];for(const g of i){const x=[];for(const w of g){const I=[w.x+d[0],w.y+d[1]];pt(e,I),x.push(I)}p.push(x)}if(e[2]-e[0]<=l/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const g of p)for(const x of g)xl(x,e,r,l)}var f;return p}class un{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(cs(e[1])){const s=e[1];if(s.type==="FeatureCollection"){const l=[];for(const d of s.features){const{type:p,coordinates:f}=d.geometry;p==="Polygon"&&l.push(f),p==="MultiPolygon"&&l.push(...f)}if(l.length)return new un(s,{type:"MultiPolygon",coordinates:l})}else if(s.type==="Feature"){const l=s.geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new un(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new un(s,s)}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,s){const l=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(s.type==="Polygon"){const f=Xo(s.coordinates,d,p),g=vl(r.geometry(),l,d,p);if(!gs(l,d))return!1;for(const x of g)if(!Ln(x,f))return!1}if(s.type==="MultiPolygon"){const f=yl(s.coordinates,d,p),g=vl(r.geometry(),l,d,p);if(!gs(l,d))return!1;for(const x of g)if(!Uc(x,f))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,s){const l=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(s.type==="Polygon"){const f=Xo(s.coordinates,d,p),g=bl(r.geometry(),l,d,p);if(!gs(l,d))return!1;for(const x of g)if(!gl(x,f))return!1}if(s.type==="MultiPolygon"){const f=yl(s.coordinates,d,p),g=bl(r.geometry(),l,d,p);if(!gs(l,d))return!1;for(const x of g)if(!$c(x,f))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let wl=class{constructor(i=[],e=qc){if(this.data=i,this.length=this.data.length,this.compare=e,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(i){this.data.push(i),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const i=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),i}peek(){return this.data[0]}_up(i){const{data:e,compare:r}=this,s=e[i];for(;i>0;){const l=i-1>>1,d=e[l];if(r(s,d)>=0)break;e[i]=d,i=l}e[i]=s}_down(i){const{data:e,compare:r}=this,s=this.length>>1,l=e[i];for(;i<s;){let d=1+(i<<1),p=e[d];const f=d+1;if(f<this.length&&r(e[f],p)<0&&(d=f,p=e[f]),r(p,l)>=0)break;e[i]=p,i=d}e[i]=l}};function qc(i,e){return i<e?-1:i>e?1:0}function Zc(i,e,r,s,l){Sl(i,e,r,s||i.length-1,l||Gc)}function Sl(i,e,r,s,l){for(;s>r;){if(s-r>600){var d=s-r+1,p=e-r+1,f=Math.log(d),g=.5*Math.exp(2*f/3),x=.5*Math.sqrt(f*g*(d-g)/d)*(p-d/2<0?-1:1);Sl(i,e,Math.max(r,Math.floor(e-p*g/d+x)),Math.min(s,Math.floor(e+(d-p)*g/d+x)),l)}var w=i[e],I=r,A=s;for(_s(i,r,e),l(i[s],w)>0&&_s(i,r,s);I<A;){for(_s(i,I,A),I++,A--;l(i[I],w)<0;)I++;for(;l(i[A],w)>0;)A--}l(i[r],w)===0?_s(i,r,A):_s(i,++A,s),A<=e&&(r=A+1),e<=A&&(s=A-1)}}function _s(i,e,r){var s=i[e];i[e]=i[r],i[r]=s}function Gc(i,e){return i<e?-1:i>e?1:0}function Ys(i,e){if(i.length<=1)return[i];const r=[];let s,l;for(const d of i){const p=Xc(d);p!==0&&(d.area=Math.abs(p),l===void 0&&(l=p<0),l===p<0?(s&&r.push(s),s=[d]):s.push(d))}if(s&&r.push(s),e>1)for(let d=0;d<r.length;d++)r[d].length<=e||(Zc(r[d],e,1,r[d].length-1,Hc),r[d]=r[d].slice(0,e));return r}function Hc(i,e){return e.area-i.area}function Xc(i){let e=0;for(let r,s,l=0,d=i.length,p=d-1;l<d;p=l++)r=i[l],s=i[p],e+=(s.x-r.x)*(r.y+s.y);return e}const Tl=1/298.257223563,Il=Tl*(2-Tl),Pl=Math.PI/180;class Wo{constructor(e){const r=6378.137*Pl*1e3,s=Math.cos(e*Pl),l=1/(1-Il*(1-s*s)),d=Math.sqrt(l);this.kx=r*d*s,this.ky=r*d*l*(1-Il)}distance(e,r){const s=this.wrap(e[0]-r[0])*this.kx,l=(e[1]-r[1])*this.ky;return Math.sqrt(s*s+l*l)}pointOnLine(e,r){let s,l,d,p,f=1/0;for(let g=0;g<e.length-1;g++){let x=e[g][0],w=e[g][1],I=this.wrap(e[g+1][0]-x)*this.kx,A=(e[g+1][1]-w)*this.ky,M=0;I===0&&A===0||(M=(this.wrap(r[0]-x)*this.kx*I+(r[1]-w)*this.ky*A)/(I*I+A*A),M>1?(x=e[g+1][0],w=e[g+1][1]):M>0&&(x+=I/this.kx*M,w+=A/this.ky*M)),I=this.wrap(r[0]-x)*this.kx,A=(r[1]-w)*this.ky;const L=I*I+A*A;L<f&&(f=L,s=x,l=w,d=g,p=M)}return{point:[s,l],index:d,t:Math.max(0,Math.min(1,p))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}function El(i,e){return e[0]-i[0]}function Qs(i){return i[1]-i[0]+1}function Dr(i,e){return i[1]>=i[0]&&i[1]<e}function ys(i,e){if(i[0]>i[1])return[null,null];const r=Qs(i);if(e){if(r===2)return[i,null];const l=Math.floor(r/2);return[[i[0],i[0]+l],[i[0]+l,i[1]]]}if(r===1)return[i,null];const s=Math.floor(r/2)-1;return[[i[0],i[0]+s],[i[0]+s+1,i[1]]]}function Jo(i,e){if(!Dr(e,i.length))return[1/0,1/0,-1/0,-1/0];const r=[1/0,1/0,-1/0,-1/0];for(let s=e[0];s<=e[1];++s)pt(r,i[s]);return r}function Ko(i){const e=[1/0,1/0,-1/0,-1/0];for(const r of i)for(const s of r)pt(e,s);return e}function Al(i){return i[0]!==-1/0&&i[1]!==-1/0&&i[2]!==1/0&&i[3]!==1/0}function Yo(i,e,r){if(!Al(i)||!Al(e))return NaN;let s=0,l=0;return i[2]<e[0]&&(s=e[0]-i[2]),i[0]>e[2]&&(s=i[0]-e[2]),i[1]>e[3]&&(l=i[1]-e[3]),i[3]<e[1]&&(l=e[1]-i[3]),r.distance([0,0],[s,l])}function Ct(i,e,r){const s=r.pointOnLine(e,i);return r.distance(i,s.point)}function Qo(i,e,r,s,l){const d=Math.min(Ct(i,[r,s],l),Ct(e,[r,s],l)),p=Math.min(Ct(r,[i,e],l),Ct(s,[i,e],l));return Math.min(d,p)}function ht(i,e,r,s,l){if(!Dr(e,i.length)||!Dr(s,r.length))return 1/0;let d=1/0;for(let p=e[0];p<e[1];++p){const f=i[p],g=i[p+1];for(let x=s[0];x<s[1];++x){const w=r[x],I=r[x+1];if(Ks(f,g,w,I))return 0;d=Math.min(d,Qo(f,g,w,I,l))}}return d}function ea(i,e,r,s,l){if(!Dr(e,i.length)||!Dr(s,r.length))return NaN;let d=1/0;for(let p=e[0];p<=e[1];++p)for(let f=s[0];f<=s[1];++f)if(d=Math.min(d,l.distance(i[p],r[f])),d===0)return d;return d}function Nt(i,e,r){if(Ln(i,e,!0))return 0;let s=1/0;for(const l of e){const d=l[0],p=l[l.length-1];if(d!==p&&(s=Math.min(s,Ct(i,[p,d],r)),s===0))return s;const f=r.pointOnLine(l,i);if(s=Math.min(s,r.distance(i,f.point)),s===0)return s}return s}function Dt(i,e,r,s){if(!Dr(e,i.length))return NaN;for(let d=e[0];d<=e[1];++d)if(Ln(i[d],r,!0))return 0;let l=1/0;for(let d=e[0];d<e[1];++d){const p=i[d],f=i[d+1];for(const g of r)for(let x=0,w=g.length,I=w-1;x<w;I=x++){const A=g[I],M=g[x];if(Ks(p,f,A,M))return 0;l=Math.min(l,Qo(p,f,A,M,s))}}return l}function xs(i,e){for(const r of i)for(const s of r)if(Ln(s,e,!0))return!0;return!1}function Cl(i,e,r,s=1/0){const l=Ko(i),d=Ko(e);if(s!==1/0&&Yo(l,d,r)>=s)return s;if(gs(l,d)){if(xs(i,e))return 0}else if(xs(e,i))return 0;let p=1/0;for(const f of i)for(let g=0,x=f.length,w=x-1;g<x;w=g++){const I=f[w],A=f[g];for(const M of e)for(let L=0,F=M.length,U=F-1;L<F;U=L++){const X=M[U],se=M[L];if(Ks(I,A,X,se))return 0;p=Math.min(p,Qo(I,A,X,se,r))}}return p}function ta(i,e,r,s,l,d){if(!d)return;const p=Yo(Jo(s,d),l,r);p<e&&i.push([p,d,[0,0]])}function eo(i,e,r,s,l,d,p){if(!d||!p)return;const f=Yo(Jo(s,d),Jo(l,p),r);f<e&&i.push([f,d,p])}function to(i,e,r,s,l=1/0){let d=Math.min(s.distance(i[0],r[0][0]),l);if(d===0)return d;const p=new wl([[0,[0,i.length-1],[0,0]]],El),f=Ko(r);for(;p.length>0;){const g=p.pop();if(g[0]>=d)continue;const x=g[1],w=e?50:100;if(Qs(x)<=w){if(!Dr(x,i.length))return NaN;if(e){const I=Dt(i,x,r,s);if(isNaN(I)||I===0)return I;d=Math.min(d,I)}else for(let I=x[0];I<=x[1];++I){const A=Nt(i[I],r,s);if(d=Math.min(d,A),d===0)return 0}}else{const I=ys(x,e);ta(p,d,s,i,f,I[0]),ta(p,d,s,i,f,I[1])}}return d}function io(i,e,r,s,l,d=1/0){let p=Math.min(d,l.distance(i[0],r[0]));if(p===0)return p;const f=new wl([[0,[0,i.length-1],[0,r.length-1]]],El);for(;f.length>0;){const g=f.pop();if(g[0]>=p)continue;const x=g[1],w=g[2],I=e?50:100,A=s?50:100;if(Qs(x)<=I&&Qs(w)<=A){if(!Dr(x,i.length)&&Dr(w,r.length))return NaN;let M;if(e&&s)M=ht(i,x,r,w,l),p=Math.min(p,M);else if(e&&!s){const L=i.slice(x[0],x[1]+1);for(let F=w[0];F<=w[1];++F)if(M=Ct(r[F],L,l),p=Math.min(p,M),p===0)return p}else if(!e&&s){const L=r.slice(w[0],w[1]+1);for(let F=x[0];F<=x[1];++F)if(M=Ct(i[F],L,l),p=Math.min(p,M),p===0)return p}else M=ea(i,x,r,w,l),p=Math.min(p,M)}else{const M=ys(x,e),L=ys(w,s);eo(f,p,l,i,r,M[0],L[0]),eo(f,p,l,i,r,M[0],L[1]),eo(f,p,l,i,r,M[1],L[0]),eo(f,p,l,i,r,M[1],L[1])}}return p}function ia(i){return i.type==="MultiPolygon"?i.coordinates.map(e=>({type:"Polygon",coordinates:e})):i.type==="MultiLineString"?i.coordinates.map(e=>({type:"LineString",coordinates:e})):i.type==="MultiPoint"?i.coordinates.map(e=>({type:"Point",coordinates:e})):[i]}class Xr{constructor(e,r){this.type=Ae,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(cs(e[1])){const s=e[1];if(s.type==="FeatureCollection")return new Xr(s,s.features.map(l=>ia(l.geometry)).flat());if(s.type==="Feature")return new Xr(s,ia(s.geometry));if("type"in s&&"coordinates"in s)return new Xr(s,ia(s))}return r.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(r,s){const l=r.geometry(),d=l.flat().map(g=>Dn([g.x,g.y],r.canonical));if(l.length===0)return NaN;const p=new Wo(d[0][1]);let f=1/0;for(const g of s){switch(g.type){case"Point":f=Math.min(f,io(d,!1,[g.coordinates],!1,p,f));break;case"LineString":f=Math.min(f,io(d,!1,g.coordinates,!0,p,f));break;case"Polygon":f=Math.min(f,to(d,!1,g.coordinates,p,f))}if(f===0)return f}return f}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,s){const l=r.geometry(),d=l.flat().map(g=>Dn([g.x,g.y],r.canonical));if(l.length===0)return NaN;const p=new Wo(d[0][1]);let f=1/0;for(const g of s){switch(g.type){case"Point":f=Math.min(f,io(d,!0,[g.coordinates],!1,p,f));break;case"LineString":f=Math.min(f,io(d,!0,g.coordinates,!0,p,f));break;case"Polygon":f=Math.min(f,to(d,!0,g.coordinates,p,f))}if(f===0)return f}return f}(e,this.geometries);if(e.geometryType()==="Polygon")return function(r,s){const l=r.geometry();if(l.length===0||l[0].length===0)return NaN;const d=Ys(l,0).map(g=>g.map(x=>x.map(w=>Dn([w.x,w.y],r.canonical)))),p=new Wo(d[0][0][0][1]);let f=1/0;for(const g of s)for(const x of d){switch(g.type){case"Point":f=Math.min(f,to([g.coordinates],!1,x,p,f));break;case"LineString":f=Math.min(f,to(g.coordinates,!0,x,p,f));break;case"Polygon":f=Math.min(f,Cl(x,g.coordinates,p,f))}if(f===0)return f}return f}(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const dn={"==":pl,"!=":Fc,">":fl,"<":Oc,">=":Vc,"<=":ml,array:Xi,at:$o,boolean:Xi,case:Gs,coalesce:Xs,collator:Ws,format:Js,image:Zo,in:ds,"index-of":qs,interpolate:Ui,"interpolate-hcl":Ui,"interpolate-lab":Ui,length:Go,let:yt,literal:cn,match:Zs,number:Xi,"number-format":qo,object:Xi,slice:Hs,step:zn,string:Xi,"to-boolean":Zr,"to-color":Zr,"to-number":Zr,"to-string":Zr,var:$s,within:un,distance:Xr};class $i{constructor(e,r,s,l){this.name=e,this.type=r,this._evaluate=s,this.args=l}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){const s=e[0],l=$i.definitions[s];if(!l)return r.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);const d=Array.isArray(l)?l[0]:l.type,p=Array.isArray(l)?[[l[1],l[2]]]:l.overloads,f=p.filter(([x])=>!Array.isArray(x)||x.length===e.length-1);let g=null;for(const[x,w]of f){g=new Gr(r.registry,no,r.path,null,r.scope);const I=[];let A=!1;for(let M=1;M<e.length;M++){const L=e[M],F=Array.isArray(x)?x[M-1]:x.type,U=g.parse(L,1+I.length,F);if(!U){A=!0;break}I.push(U)}if(!A)if(Array.isArray(x)&&x.length!==I.length)g.error(`Expected ${x.length} arguments, but found ${I.length} instead.`);else{for(let M=0;M<I.length;M++){const L=Array.isArray(x)?x[M]:x.type,F=I[M];g.concat(M+1).checkSubtype(L,F.type)}if(g.errors.length===0)return new $i(s,d,w,I)}}if(f.length===1)r.errors.push(...g.errors);else{const x=(f.length?f:p).map(([I])=>{return A=I,Array.isArray(A)?`(${A.map(C).join(", ")})`:`(${C(A.type)}...)`;var A}).join(" | "),w=[];for(let I=1;I<e.length;I++){const A=r.parse(e[I],1+w.length);if(!A)return null;w.push(C(A.type))}r.error(`Expected arguments of type ${x}, but found (${w.join(", ")}) instead.`)}return null}static register(e,r){$i.definitions=r;for(const s in r)e[s]=$i}}function ra(i,[e,r,s,l]){e=e.evaluate(i),r=r.evaluate(i),s=s.evaluate(i);const d=l?l.evaluate(i):1,p=js(e,r,s,d);if(p)throw new Wt(p);return new wt(e/255,r/255,s/255,d,!1)}function ro(i,e){return i in e}function na(i,e){const r=e[i];return r===void 0?null:r}function pn(i){return{type:i}}function no(i){if(i instanceof $s)return no(i.boundExpression);if(i instanceof $i&&i.name==="error"||i instanceof Ws||i instanceof un||i instanceof Xr)return!1;const e=i instanceof Zr||i instanceof Xi;let r=!0;return i.eachChild(s=>{r=e?r&&no(s):r&&s instanceof cn}),!!r&&so(i)&&oo(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function so(i){if(i instanceof $i&&(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 un||i instanceof Xr)return!1;let e=!0;return i.eachChild(r=>{e&&!so(r)&&(e=!1)}),e}function vs(i){if(i instanceof $i&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!vs(r)&&(e=!1)}),e}function oo(i,e){if(i instanceof $i&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(s=>{r&&!oo(s,e)&&(r=!1)}),r}function kl(i){return{result:"success",value:i}}function Rn(i){return{result:"error",value:i}}function fn(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function sa(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function Bn(i){return!!i.expression&&i.expression.interpolated}function mt(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function bs(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Ml(i){return i}function zl(i,e){const r=e.type==="color",s=i.stops&&typeof i.stops[0][0]=="object",l=s||!(s||i.property!==void 0),d=i.type||(Bn(e)?"exponential":"interval");if(r||e.type==="padding"){const w=r?wt.parse:Vi.parse;(i=mr({},i)).stops&&(i.stops=i.stops.map(I=>[I[0],w(I[1])])),i.default=w(i.default?i.default:e.default)}if(i.colorSpace&&(p=i.colorSpace)!=="rgb"&&p!=="hcl"&&p!=="lab")throw new Error(`Unknown color space: "${i.colorSpace}"`);var p;let f,g,x;if(d==="exponential")f=oa;else if(d==="interval")f=lo;else if(d==="categorical"){f=ao,g=Object.create(null);for(const w of i.stops)g[w[0]]=w[1];x=typeof i.stops[0][0]}else{if(d!=="identity")throw new Error(`Unknown function type "${d}"`);f=aa}if(s){const w={},I=[];for(let L=0;L<i.stops.length;L++){const F=i.stops[L],U=F[0].zoom;w[U]===void 0&&(w[U]={zoom:U,type:i.type,property:i.property,default:i.default,stops:[]},I.push(U)),w[U].stops.push([F[0].value,F[1]])}const A=[];for(const L of I)A.push([w[L].zoom,zl(w[L],e)]);const M={name:"linear"};return{kind:"composite",interpolationType:M,interpolationFactor:Ui.interpolationFactor.bind(void 0,M),zoomStops:A.map(L=>L[0]),evaluate:({zoom:L},F)=>oa({stops:A,base:i.base},e,L).evaluate(L,F)}}if(l){const w=d==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:w,interpolationFactor:Ui.interpolationFactor.bind(void 0,w),zoomStops:i.stops.map(I=>I[0]),evaluate:({zoom:I})=>f(i,e,I,g,x)}}return{kind:"source",evaluate(w,I){const A=I&&I.properties?I.properties[i.property]:void 0;return A===void 0?mn(i.default,e.default):f(i,e,A,g,x)}}}function mn(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function ao(i,e,r,s,l){return mn(typeof r===l?s[r]:void 0,i.default,e.default)}function lo(i,e,r){if(mt(r)!=="number")return mn(i.default,e.default);const s=i.stops.length;if(s===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[s-1][0])return i.stops[s-1][1];const l=ps(i.stops.map(d=>d[0]),r);return i.stops[l][1]}function oa(i,e,r){const s=i.base!==void 0?i.base:1;if(mt(r)!=="number")return mn(i.default,e.default);const l=i.stops.length;if(l===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[l-1][0])return i.stops[l-1][1];const d=ps(i.stops.map(w=>w[0]),r),p=function(w,I,A,M){const L=M-A,F=w-A;return L===0?0:I===1?F/L:(Math.pow(I,F)-1)/(Math.pow(I,L)-1)}(r,s,i.stops[d][0],i.stops[d+1][0]),f=i.stops[d][1],g=i.stops[d+1][1],x=ji[e.type]||Ml;return typeof f.evaluate=="function"?{evaluate(...w){const I=f.evaluate.apply(void 0,w),A=g.evaluate.apply(void 0,w);if(I!==void 0&&A!==void 0)return x(I,A,p,i.colorSpace)}}:x(f,g,p,i.colorSpace)}function aa(i,e,r){switch(e.type){case"color":r=wt.parse(r);break;case"formatted":r=Oi.fromString(r.toString());break;case"resolvedImage":r=di.fromString(r.toString());break;case"padding":r=Vi.parse(r);break;default:mt(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return mn(r,i.default,e.default)}$i.register(dn,{error:[{kind:"error"},[at],(i,[e])=>{throw new Wt(e.evaluate(i))}],typeof:[at,[rt],(i,[e])=>C(Yt(e.evaluate(i)))],"to-rgba":[k(Ae,4),[Ci],(i,[e])=>{const[r,s,l,d]=e.evaluate(i).rgb;return[255*r,255*s,255*l,d]}],rgb:[Ci,[Ae,Ae,Ae],ra],rgba:[Ci,[Ae,Ae,Ae,Ae],ra],has:{type:Ye,overloads:[[[at],(i,[e])=>ro(e.evaluate(i),i.properties())],[[at,ir],(i,[e,r])=>ro(e.evaluate(i),r.evaluate(i))]]},get:{type:rt,overloads:[[[at],(i,[e])=>na(e.evaluate(i),i.properties())],[[at,ir],(i,[e,r])=>na(e.evaluate(i),r.evaluate(i))]]},"feature-state":[rt,[at],(i,[e])=>na(e.evaluate(i),i.featureState||{})],properties:[ir,[],i=>i.properties()],"geometry-type":[at,[],i=>i.geometryType()],id:[rt,[],i=>i.id()],zoom:[Ae,[],i=>i.globals.zoom],"heatmap-density":[Ae,[],i=>i.globals.heatmapDensity||0],"line-progress":[Ae,[],i=>i.globals.lineProgress||0],accumulated:[rt,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Ae,pn(Ae),(i,e)=>{let r=0;for(const s of e)r+=s.evaluate(i);return r}],"*":[Ae,pn(Ae),(i,e)=>{let r=1;for(const s of e)r*=s.evaluate(i);return r}],"-":{type:Ae,overloads:[[[Ae,Ae],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[Ae],(i,[e])=>-e.evaluate(i)]]},"/":[Ae,[Ae,Ae],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[Ae,[Ae,Ae],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[Ae,[],()=>Math.LN2],pi:[Ae,[],()=>Math.PI],e:[Ae,[],()=>Math.E],"^":[Ae,[Ae,Ae],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[Ae,[Ae],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[Ae,[Ae],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[Ae,[Ae],(i,[e])=>Math.log(e.evaluate(i))],log2:[Ae,[Ae],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[Ae,[Ae],(i,[e])=>Math.sin(e.evaluate(i))],cos:[Ae,[Ae],(i,[e])=>Math.cos(e.evaluate(i))],tan:[Ae,[Ae],(i,[e])=>Math.tan(e.evaluate(i))],asin:[Ae,[Ae],(i,[e])=>Math.asin(e.evaluate(i))],acos:[Ae,[Ae],(i,[e])=>Math.acos(e.evaluate(i))],atan:[Ae,[Ae],(i,[e])=>Math.atan(e.evaluate(i))],min:[Ae,pn(Ae),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[Ae,pn(Ae),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[Ae,[Ae],(i,[e])=>Math.abs(e.evaluate(i))],round:[Ae,[Ae],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Ae,[Ae],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[Ae,[Ae],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[Ye,[at,rt],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[Ye,[rt],(i,[e])=>i.id()===e.value],"filter-type-==":[Ye,[at],(i,[e])=>i.geometryType()===e.value],"filter-<":[Ye,[at,rt],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s<l}],"filter-id-<":[Ye,[rt],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r<s}],"filter->":[Ye,[at,rt],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>l}],"filter-id->":[Ye,[rt],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>s}],"filter-<=":[Ye,[at,rt],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s<=l}],"filter-id-<=":[Ye,[rt],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r<=s}],"filter->=":[Ye,[at,rt],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>=l}],"filter-id->=":[Ye,[rt],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>=s}],"filter-has":[Ye,[rt],(i,[e])=>e.value in i.properties()],"filter-has-id":[Ye,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Ye,[k(at)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[Ye,[k(rt)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[Ye,[at,k(rt)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[Ye,[at,k(rt)],(i,[e,r])=>function(s,l,d,p){for(;d<=p;){const f=d+p>>1;if(l[f]===s)return!0;l[f]>s?p=f-1:d=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)],[pn(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)],[pn(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,[at],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[at,[at],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[at,[at],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[at,pn(rt),(i,e)=>e.map(r=>zr(r.evaluate(i))).join("")],"resolved-locale":[at,[_r],(i,[e])=>e.evaluate(i).resolvedLocale()]});class co{constructor(e,r){var s;this.expression=e,this._warningHistory={},this._evaluator=new us,this._defaultValue=r?(s=r).type==="color"&&bs(s.default)?new wt(0,0,0,0):s.type==="color"?wt.parse(s.default)||null:s.type==="padding"?Vi.parse(s.default)||null:s.type==="variableAnchorOffsetCollection"?Ni.parse(s.default)||null:s.default===void 0?null:s.default:null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,s,l,d,p){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=s,this._evaluator.canonical=l,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p,this.expression.evaluate(this._evaluator)}evaluate(e,r,s,l,d,p){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=s||null,this._evaluator.canonical=l,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p||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 Wt(`Expected value to be one of ${Object.keys(this._enumValues).map(g=>JSON.stringify(g)).join(", ")}, but found ${JSON.stringify(f)} instead.`);return f}catch(f){return this._warningHistory[f.message]||(this._warningHistory[f.message]=!0,typeof console<"u"&&console.warn(f.message)),this._defaultValue}}}function ws(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in dn}function gn(i,e){const r=new Gr(dn,no,[],e?function(l){const d={color:Ci,string:at,number:Ae,enum:at,boolean:Ye,formatted:Mr,padding:qr,resolvedImage:yr,variableAnchorOffsetCollection:G};return l.type==="array"?k(d[l.value]||rt,l.length):d[l.type]}(e):void 0),s=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?kl(new co(s,e)):Rn(r.errors)}class la{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!vs(r.expression)}evaluateWithoutErrorHandling(e,r,s,l,d,p){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,l,d,p)}evaluate(e,r,s,l,d,p){return this._styleExpression.evaluate(e,r,s,l,d,p)}}class ca{constructor(e,r,s,l){this.kind=e,this.zoomStops=s,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!vs(r.expression),this.interpolationType=l}evaluateWithoutErrorHandling(e,r,s,l,d,p){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,l,d,p)}evaluate(e,r,s,l,d,p){return this._styleExpression.evaluate(e,r,s,l,d,p)}interpolationFactor(e,r,s){return this.interpolationType?Ui.interpolationFactor(this.interpolationType,e,r,s):0}}function Dl(i,e){const r=gn(i,e);if(r.result==="error")return r;const s=r.value.expression,l=so(s);if(!l&&!fn(e))return Rn([new Si("","data expressions not supported")]);const d=oo(s,["zoom"]);if(!d&&!sa(e))return Rn([new Si("","zoom expressions not supported")]);const p=uo(s);return p||d?p instanceof Si?Rn([p]):p instanceof Ui&&!Bn(e)?Rn([new Si("",'"interpolate" expressions cannot be used with this property')]):kl(p?new ca(l?"camera":"composite",r.value,p.labels,p instanceof Ui?p.interpolation:void 0):new la(l?"constant":"source",r.value)):Rn([new Si("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class ho{constructor(e,r){this._parameters=e,this._specification=r,mr(this,zl(this._parameters,this._specification))}static deserialize(e){return new ho(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function uo(i){let e=null;if(i instanceof yt)e=uo(i.result);else if(i instanceof Xs){for(const r of i.args)if(e=uo(r),e)break}else(i instanceof zn||i instanceof Ui)&&i.input instanceof $i&&i.input.name==="zoom"&&(e=i);return e instanceof Si||i.eachChild(r=>{const s=uo(r);s instanceof Si?e=s:!e&&s?e=new Si("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&s&&e!==s&&(e=new Si("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Fn(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(!Fn(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const po={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ti(i){if(i==null)return{filter:()=>!0,needGeometry:!1};Fn(i)||(i=fo(i));const e=gn(i,po);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,s,l)=>e.value.evaluate(r,s,{},l),needGeometry:ha(i)}}function Ss(i,e){return i<e?-1:i>e?1:0}function ha(i){if(!Array.isArray(i))return!1;if(i[0]==="within"||i[0]==="distance")return!0;for(let e=1;e<i.length;e++)if(ha(i[e]))return!0;return!1}function fo(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?ua(i[1],i[2],"=="):e==="!="?Vn(ua(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?ua(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(fo))):e==="all"?["all"].concat(i.slice(1).map(fo)):e==="none"?["all"].concat(i.slice(1).map(fo).map(Vn)):e==="in"?On(i[1],i.slice(2)):e==="!in"?Vn(On(i[1],i.slice(2))):e==="has"?da(i[1]):e!=="!has"||Vn(da(i[1]));var r}function ua(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 On(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(Ss)]]:["filter-in-small",i,["literal",e]]}}function da(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Vn(i){return["!",i]}function pa(i){const e=typeof i;if(e==="number"||e==="boolean"||e==="string"||i==null)return JSON.stringify(i);if(Array.isArray(i)){let l="[";for(const d of i)l+=`${pa(d)},`;return`${l}]`}const r=Object.keys(i).sort();let s="{";for(let l=0;l<r.length;l++)s+=`${JSON.stringify(r[l])}:${pa(i[r[l]])},`;return`${s}}`}function fa(i){let e="";for(const r of ln)e+=`/${pa(i[r])}`;return e}function Ll(i){const e=i.value;return e?[new Te(i.key,e,"constants have been deprecated as of v8")]:[]}function Lt(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 Lt(i)}function ki(i){const e=i.key,r=i.value,s=i.valueSpec||{},l=i.objectElementValidators||{},d=i.style,p=i.styleSpec,f=i.validateSpec;let g=[];const x=mt(r);if(x!=="object")return[new Te(e,r,`object expected, ${x} found`)];for(const w in r){const I=w.split(".")[0],A=s[I]||s["*"];let M;if(l[I])M=l[I];else if(s[I])M=f;else if(l["*"])M=l["*"];else{if(!s["*"]){g.push(new Te(e,r[w],`unknown property "${w}"`));continue}M=f}g=g.concat(M({key:(e&&`${e}.`)+w,value:r[w],valueSpec:A,style:d,styleSpec:p,object:r,objectKey:w,validateSpec:f},r))}for(const w in s)l[w]||s[w].required&&s[w].default===void 0&&r[w]===void 0&&g.push(new Te(e,r,`missing required property "${w}"`));return g}function mo(i){const e=i.value,r=i.valueSpec,s=i.style,l=i.styleSpec,d=i.key,p=i.arrayElementValidator||i.validateSpec;if(mt(e)!=="array")return[new Te(d,e,`array expected, ${mt(e)} found`)];if(r.length&&e.length!==r.length)return[new Te(d,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new Te(d,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let f={type:r.value,values:r.values};l.$version<7&&(f.function=r.function),mt(r.value)==="object"&&(f=r.value);let g=[];for(let x=0;x<e.length;x++)g=g.concat(p({array:e,arrayIndex:x,value:e[x],valueSpec:f,validateSpec:i.validateSpec,style:s,styleSpec:l,key:`${d}[${x}]`}));return g}function Ts(i){const e=i.key,r=i.value,s=i.valueSpec;let l=mt(r);return l==="number"&&r!=r&&(l="NaN"),l!=="number"?[new Te(e,r,`number expected, ${l} found`)]:"minimum"in s&&r<s.minimum?[new Te(e,r,`${r} is less than the minimum value ${s.minimum}`)]:"maximum"in s&&r>s.maximum?[new Te(e,r,`${r} is greater than the maximum value ${s.maximum}`)]:[]}function ma(i){const e=i.valueSpec,r=Lt(i.value.type);let s,l,d,p={};const f=r!=="categorical"&&i.value.property===void 0,g=!f,x=mt(i.value.stops)==="array"&&mt(i.value.stops[0])==="array"&&mt(i.value.stops[0][0])==="object",w=ki({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(M){if(r==="identity")return[new Te(M.key,M.value,'identity function may not have a "stops" property')];let L=[];const F=M.value;return L=L.concat(mo({key:M.key,value:F,valueSpec:M.valueSpec,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec,arrayElementValidator:I})),mt(F)==="array"&&F.length===0&&L.push(new Te(M.key,F,"array must have at least one stop")),L},default:function(M){return M.validateSpec({key:M.key,value:M.value,valueSpec:e,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec})}}});return r==="identity"&&f&&w.push(new Te(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||w.push(new Te(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!Bn(i.valueSpec)&&w.push(new Te(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(g&&!fn(i.valueSpec)?w.push(new Te(i.key,i.value,"property functions not supported")):f&&!sa(i.valueSpec)&&w.push(new Te(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!x||i.value.property!==void 0||w.push(new Te(i.key,i.value,'"property" property is required')),w;function I(M){let L=[];const F=M.value,U=M.key;if(mt(F)!=="array")return[new Te(U,F,`array expected, ${mt(F)} found`)];if(F.length!==2)return[new Te(U,F,`array length 2 expected, length ${F.length} found`)];if(x){if(mt(F[0])!=="object")return[new Te(U,F,`object expected, ${mt(F[0])} found`)];if(F[0].zoom===void 0)return[new Te(U,F,"object stop key must have zoom")];if(F[0].value===void 0)return[new Te(U,F,"object stop key must have value")];if(d&&d>Lt(F[0].zoom))return[new Te(U,F[0].zoom,"stop zoom values must appear in ascending order")];Lt(F[0].zoom)!==d&&(d=Lt(F[0].zoom),l=void 0,p={}),L=L.concat(ki({key:`${U}[0]`,value:F[0],valueSpec:{zoom:{}},validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec,objectElementValidators:{zoom:Ts,value:A}}))}else L=L.concat(A({key:`${U}[0]`,value:F[0],valueSpec:{},validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec},F));return ws(_n(F[1]))?L.concat([new Te(`${U}[1]`,F[1],"expressions are not allowed in function stops.")]):L.concat(M.validateSpec({key:`${U}[1]`,value:F[1],valueSpec:e,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec}))}function A(M,L){const F=mt(M.value),U=Lt(M.value),X=M.value!==null?M.value:L;if(s){if(F!==s)return[new Te(M.key,X,`${F} stop domain type must match previous stop domain type ${s}`)]}else s=F;if(F!=="number"&&F!=="string"&&F!=="boolean")return[new Te(M.key,X,"stop domain value must be a number, string, or boolean")];if(F!=="number"&&r!=="categorical"){let se=`number expected, ${F} found`;return fn(e)&&r===void 0&&(se+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Te(M.key,X,se)]}return r!=="categorical"||F!=="number"||isFinite(U)&&Math.floor(U)===U?r!=="categorical"&&F==="number"&&l!==void 0&&U<l?[new Te(M.key,X,"stop domain values must appear in ascending order")]:(l=U,r==="categorical"&&U in p?[new Te(M.key,X,"stop domain values must be unique")]:(p[U]=!0,[])):[new Te(M.key,X,`integer expected, found ${U}`)]}}function yn(i){const e=(i.expressionContext==="property"?Dl:gn)(_n(i.value),i.valueSpec);if(e.result==="error")return e.value.map(s=>new Te(`${i.key}${s.key}`,i.value,s.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new Te(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"&&!vs(r))return[new Te(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!vs(r))return[new Te(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!oo(r,["zoom","feature-state"]))return[new Te(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!so(r))return[new Te(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Is(i){const e=i.key,r=i.value,s=i.valueSpec,l=[];return Array.isArray(s.values)?s.values.indexOf(Lt(r))===-1&&l.push(new Te(e,r,`expected one of [${s.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(s.values).indexOf(Lt(r))===-1&&l.push(new Te(e,r,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(r)} found`)),l}function Ps(i){return Fn(_n(i.value))?yn(mr({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Es(i)}function Es(i){const e=i.value,r=i.key;if(mt(e)!=="array")return[new Te(r,e,`array expected, ${mt(e)} found`)];const s=i.styleSpec;let l,d=[];if(e.length<1)return[new Te(r,e,"filter array must have at least 1 element")];switch(d=d.concat(Is({key:`${r}[0]`,value:e[0],valueSpec:s.filter_operator,style:i.style,styleSpec:i.styleSpec})),Lt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Lt(e[1])==="$type"&&d.push(new Te(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&d.push(new Te(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(l=mt(e[1]),l!=="string"&&d.push(new Te(`${r}[1]`,e[1],`string expected, ${l} found`)));for(let p=2;p<e.length;p++)l=mt(e[p]),Lt(e[1])==="$type"?d=d.concat(Is({key:`${r}[${p}]`,value:e[p],valueSpec:s.geometry_type,style:i.style,styleSpec:i.styleSpec})):l!=="string"&&l!=="number"&&l!=="boolean"&&d.push(new Te(`${r}[${p}]`,e[p],`string, number, or boolean expected, ${l} found`));break;case"any":case"all":case"none":for(let p=1;p<e.length;p++)d=d.concat(Es({key:`${r}[${p}]`,value:e[p],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":l=mt(e[1]),e.length!==2?d.push(new Te(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):l!=="string"&&d.push(new Te(`${r}[1]`,e[1],`string expected, ${l} found`))}return d}function ga(i,e){const r=i.key,s=i.validateSpec,l=i.style,d=i.styleSpec,p=i.value,f=i.objectKey,g=d[`${e}_${i.layerType}`];if(!g)return[];const x=f.match(/^(.*)-transition$/);if(e==="paint"&&x&&g[x[1]]&&g[x[1]].transition)return s({key:r,value:p,valueSpec:d.transition,style:l,styleSpec:d});const w=i.valueSpec||g[f];if(!w)return[new Te(r,p,`unknown property "${f}"`)];let I;if(mt(p)==="string"&&fn(w)&&!w.tokens&&(I=/^{([^}]+)}$/.exec(p)))return[new Te(r,p,`"${f}" does not support interpolation syntax
|
5
|
+
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(I[1])} }\`.`)];const A=[];return i.layerType==="symbol"&&(f==="text-field"&&l&&!l.glyphs&&A.push(new Te(r,p,'use of "text-field" requires a style "glyphs" property')),f==="text-font"&&bs(_n(p))&&Lt(p.type)==="identity"&&A.push(new Te(r,p,'"text-font" does not support identity functions'))),A.concat(s({key:i.key,value:p,valueSpec:w,style:l,styleSpec:d,expressionContext:"property",propertyType:e,propertyKey:f}))}function _a(i){return ga(i,"paint")}function ya(i){return ga(i,"layout")}function xa(i){let e=[];const r=i.value,s=i.key,l=i.style,d=i.styleSpec;r.type||r.ref||e.push(new Te(s,r,'either "type" or "ref" is required'));let p=Lt(r.type);const f=Lt(r.ref);if(r.id){const g=Lt(r.id);for(let x=0;x<i.arrayIndex;x++){const w=l.layers[x];Lt(w.id)===g&&e.push(new Te(s,r.id,`duplicate layer id "${r.id}", previously used at line ${w.id.__line__}`))}}if("ref"in r){let g;["type","source","source-layer","filter","layout"].forEach(x=>{x in r&&e.push(new Te(s,r[x],`"${x}" is prohibited for ref layers`))}),l.layers.forEach(x=>{Lt(x.id)===f&&(g=x)}),g?g.ref?e.push(new Te(s,r.ref,"ref cannot reference another ref layer")):p=Lt(g.type):e.push(new Te(s,r.ref,`ref layer "${f}" not found`))}else if(p!=="background")if(r.source){const g=l.sources&&l.sources[r.source],x=g&&Lt(g.type);g?x==="vector"&&p==="raster"?e.push(new Te(s,r.source,`layer "${r.id}" requires a raster source`)):x!=="raster-dem"&&p==="hillshade"?e.push(new Te(s,r.source,`layer "${r.id}" requires a raster-dem source`)):x==="raster"&&p!=="raster"?e.push(new Te(s,r.source,`layer "${r.id}" requires a vector source`)):x!=="vector"||r["source-layer"]?x==="raster-dem"&&p!=="hillshade"?e.push(new Te(s,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):p!=="line"||!r.paint||!r.paint["line-gradient"]||x==="geojson"&&g.lineMetrics||e.push(new Te(s,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Te(s,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new Te(s,r.source,`source "${r.source}" not found`))}else e.push(new Te(s,r,'missing required property "source"'));return e=e.concat(ki({key:s,value:r,valueSpec:d.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${s}.type`,value:r.type,valueSpec:d.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:Ps,layout:g=>ki({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":x=>ya(mr({layerType:p},x))}}),paint:g=>ki({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":x=>_a(mr({layerType:p},x))}})}})),e}function Lr(i){const e=i.value,r=i.key,s=mt(e);return s!=="string"?[new Te(r,e,`string expected, ${s} found`)]:[]}const va={promoteId:function({key:i,value:e}){if(mt(e)==="string")return Lr({key:i,value:e});{const r=[];for(const s in e)r.push(...Lr({key:`${i}.${s}`,value:e[s]}));return r}}};function Rl(i){const e=i.value,r=i.key,s=i.styleSpec,l=i.style,d=i.validateSpec;if(!e.type)return[new Te(r,e,'"type" is required')];const p=Lt(e.type);let f;switch(p){case"vector":case"raster":return f=ki({key:r,value:e,valueSpec:s[`source_${p.replace("-","_")}`],style:i.style,styleSpec:s,objectElementValidators:va,validateSpec:d}),f;case"raster-dem":return f=function(g){var x;const w=(x=g.sourceName)!==null&&x!==void 0?x:"",I=g.value,A=g.styleSpec,M=A.source_raster_dem,L=g.style;let F=[];const U=mt(I);if(I===void 0)return F;if(U!=="object")return F.push(new Te("source_raster_dem",I,`object expected, ${U} found`)),F;const X=Lt(I.encoding)==="custom",se=["redFactor","greenFactor","blueFactor","baseShift"],K=g.value.encoding?`"${g.value.encoding}"`:"Default";for(const ie in I)!X&&se.includes(ie)?F.push(new Te(ie,I[ie],`In "${w}": "${ie}" is only valid when "encoding" is set to "custom". ${K} encoding found`)):M[ie]?F=F.concat(g.validateSpec({key:ie,value:I[ie],valueSpec:M[ie],validateSpec:g.validateSpec,style:L,styleSpec:A})):F.push(new Te(ie,I[ie],`unknown property "${ie}"`));return F}({sourceName:r,value:e,style:i.style,styleSpec:s,validateSpec:d}),f;case"geojson":if(f=ki({key:r,value:e,valueSpec:s.source_geojson,style:l,styleSpec:s,validateSpec:d,objectElementValidators:va}),e.cluster)for(const g in e.clusterProperties){const[x,w]=e.clusterProperties[g],I=typeof x=="string"?[x,["accumulated"],["get",g]]:x;f.push(...yn({key:`${r}.${g}.map`,value:w,validateSpec:d,expressionContext:"cluster-map"})),f.push(...yn({key:`${r}.${g}.reduce`,value:I,validateSpec:d,expressionContext:"cluster-reduce"}))}return f;case"video":return ki({key:r,value:e,valueSpec:s.source_video,style:l,validateSpec:d,styleSpec:s});case"image":return ki({key:r,value:e,valueSpec:s.source_image,style:l,validateSpec:d,styleSpec:s});case"canvas":return[new Te(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Is({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:l,validateSpec:d,styleSpec:s})}}function ba(i){const e=i.value,r=i.styleSpec,s=r.light,l=i.style;let d=[];const p=mt(e);if(e===void 0)return d;if(p!=="object")return d=d.concat([new Te("light",e,`object expected, ${p} found`)]),d;for(const f in e){const g=f.match(/^(.*)-transition$/);d=d.concat(g&&s[g[1]]&&s[g[1]].transition?i.validateSpec({key:f,value:e[f],valueSpec:r.transition,validateSpec:i.validateSpec,style:l,styleSpec:r}):s[f]?i.validateSpec({key:f,value:e[f],valueSpec:s[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new Te(f,e[f],`unknown property "${f}"`)])}return d}function Bl(i){const e=i.value,r=i.styleSpec,s=r.sky,l=i.style,d=mt(e);if(e===void 0)return[];if(d!=="object")return[new Te("sky",e,`object expected, ${d} found`)];let p=[];for(const f in e)p=p.concat(s[f]?i.validateSpec({key:f,value:e[f],valueSpec:s[f],style:l,styleSpec:r}):[new Te(f,e[f],`unknown property "${f}"`)]);return p}function wa(i){const e=i.value,r=i.styleSpec,s=r.terrain,l=i.style;let d=[];const p=mt(e);if(e===void 0)return d;if(p!=="object")return d=d.concat([new Te("terrain",e,`object expected, ${p} found`)]),d;for(const f in e)d=d.concat(s[f]?i.validateSpec({key:f,value:e[f],valueSpec:s[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new Te(f,e[f],`unknown property "${f}"`)]);return d}function Sa(i){let e=[];const r=i.value,s=i.key;if(Array.isArray(r)){const l=[],d=[];for(const p in r)r[p].id&&l.includes(r[p].id)&&e.push(new Te(s,r,`all the sprites' ids must be unique, but ${r[p].id} is duplicated`)),l.push(r[p].id),r[p].url&&d.includes(r[p].url)&&e.push(new Te(s,r,`all the sprites' URLs must be unique, but ${r[p].url} is duplicated`)),d.push(r[p].url),e=e.concat(ki({key:`${s}[${p}]`,value:r[p],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return e}return Lr({key:s,value:r})}const Ta={"*":()=>[],array:mo,boolean:function(i){const e=i.value,r=i.key,s=mt(e);return s!=="boolean"?[new Te(r,e,`boolean expected, ${s} found`)]:[]},number:Ts,color:function(i){const e=i.key,r=i.value,s=mt(r);return s!=="string"?[new Te(e,r,`color expected, ${s} found`)]:wt.parse(String(r))?[]:[new Te(e,r,`color expected, "${r}" found`)]},constants:Ll,enum:Is,filter:Ps,function:ma,layer:xa,object:ki,source:Rl,light:ba,sky:Bl,terrain:wa,projection:function(i){const e=i.value,r=i.styleSpec,s=r.projection,l=i.style,d=mt(e);if(e===void 0)return[];if(d!=="object")return[new Te("projection",e,`object expected, ${d} found`)];let p=[];for(const f in e)p=p.concat(s[f]?i.validateSpec({key:f,value:e[f],valueSpec:s[f],style:l,styleSpec:r}):[new Te(f,e[f],`unknown property "${f}"`)]);return p},string:Lr,formatted:function(i){return Lr(i).length===0?[]:yn(i)},resolvedImage:function(i){return Lr(i).length===0?[]:yn(i)},padding:function(i){const e=i.key,r=i.value;if(mt(r)==="array"){if(r.length<1||r.length>4)return[new Te(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const s={type:"number"};let l=[];for(let d=0;d<r.length;d++)l=l.concat(i.validateSpec({key:`${e}[${d}]`,value:r[d],validateSpec:i.validateSpec,valueSpec:s}));return l}return Ts({key:e,value:r,valueSpec:{}})},variableAnchorOffsetCollection:function(i){const e=i.key,r=i.value,s=mt(r),l=i.styleSpec;if(s!=="array"||r.length<1||r.length%2!=0)return[new Te(e,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let d=[];for(let p=0;p<r.length;p+=2)d=d.concat(Is({key:`${e}[${p}]`,value:r[p],valueSpec:l.layout_symbol["text-anchor"]})),d=d.concat(mo({key:`${e}[${p+1}]`,value:r[p+1],valueSpec:{length:2,value:"number"},validateSpec:i.validateSpec,style:i.style,styleSpec:l}));return d},sprite:Sa};function As(i){const e=i.value,r=i.valueSpec,s=i.styleSpec;return i.validateSpec=As,r.expression&&bs(Lt(e))?ma(i):r.expression&&ws(_n(e))?yn(i):r.type&&Ta[r.type]?Ta[r.type](i):ki(mr({},i,{valueSpec:r.type?s[r.type]:r}))}function Fl(i){const e=i.value,r=i.key,s=Lr(i);return s.length||(e.indexOf("{fontstack}")===-1&&s.push(new Te(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&s.push(new Te(r,e,'"glyphs" url must include a "{range}" token'))),s}function Wi(i,e=ue){let r=[];return r=r.concat(As({key:"",value:i,valueSpec:e.$root,styleSpec:e,style:i,validateSpec:As,objectElementValidators:{glyphs:Fl,"*":()=>[]}})),i.constants&&(r=r.concat(Ll({key:"constants",value:i.constants,style:i,styleSpec:e,validateSpec:As}))),Ia(r)}function rr(i){return function(e){return i({...e,validateSpec:As})}}function Ia(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function nr(i){return function(...e){return Ia(i.apply(this,e))}}Wi.source=nr(rr(Rl)),Wi.sprite=nr(rr(Sa)),Wi.glyphs=nr(rr(Fl)),Wi.light=nr(rr(ba)),Wi.sky=nr(rr(Bl)),Wi.terrain=nr(rr(wa)),Wi.layer=nr(rr(xa)),Wi.filter=nr(rr(Ps)),Wi.paintProperty=nr(rr(_a)),Wi.layoutProperty=nr(rr(ya));const Rr=Wi,Wc=Rr.light,Pa=Rr.sky,Jc=Rr.paintProperty,Kc=Rr.layoutProperty;function Ea(i,e){let r=!1;if(e&&e.length)for(const s of e)i.fire(new jr(new Error(s.message))),r=!0;return r}class Nn{constructor(e,r,s){const l=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const p=new Int32Array(this.arrayBuffer);e=p[0],this.d=(r=p[1])+2*(s=p[2]);for(let g=0;g<this.d*this.d;g++){const x=p[3+g],w=p[3+g+1];l.push(x===w?null:p.subarray(x,w))}const f=p[3+l.length+1];this.keys=p.subarray(p[3+l.length],f),this.bboxes=p.subarray(f),this.insert=this._insertReadonly}else{this.d=r+2*s;for(let p=0;p<this.d*this.d;p++)l.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=s,this.scale=r/e,this.uid=0;const d=s/r*e;this.min=-d,this.max=e+d}insert(e,r,s,l,d){this._forEachCell(r,s,l,d,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(s),this.bboxes.push(l),this.bboxes.push(d)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,s,l,d,p){this.cells[d].push(p)}query(e,r,s,l,d){const p=this.min,f=this.max;if(e<=p&&r<=p&&f<=s&&f<=l&&!d)return Array.prototype.slice.call(this.keys);{const g=[];return this._forEachCell(e,r,s,l,this._queryCell,g,{},d),g}}_queryCell(e,r,s,l,d,p,f,g){const x=this.cells[d];if(x!==null){const w=this.keys,I=this.bboxes;for(let A=0;A<x.length;A++){const M=x[A];if(f[M]===void 0){const L=4*M;(g?g(I[L+0],I[L+1],I[L+2],I[L+3]):e<=I[L+2]&&r<=I[L+3]&&s>=I[L+0]&&l>=I[L+1])?(f[M]=!0,p.push(w[M])):f[M]=!1}}}}_forEachCell(e,r,s,l,d,p,f,g){const x=this._convertToCellCoord(e),w=this._convertToCellCoord(r),I=this._convertToCellCoord(s),A=this._convertToCellCoord(l);for(let M=x;M<=I;M++)for(let L=w;L<=A;L++){const F=this.d*L+M;if((!g||g(this._convertFromCellCoord(M),this._convertFromCellCoord(L),this._convertFromCellCoord(M+1),this._convertFromCellCoord(L+1)))&&d.call(this,e,r,s,l,F,p,f,g))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 s=0;for(let p=0;p<this.cells.length;p++)s+=this.cells[p].length;const l=new Int32Array(r+s+this.keys.length+this.bboxes.length);l[0]=this.extent,l[1]=this.n,l[2]=this.padding;let d=r;for(let p=0;p<e.length;p++){const f=e[p];l[3+p]=d,l.set(f,d),d+=f.length}return l[3+e.length]=d,l.set(this.keys,d),d+=this.keys.length,l[3+e.length+1]=d,l.set(this.bboxes,d),d+=this.bboxes.length,l.buffer}static serialize(e,r){const s=e.toArrayBuffer();return r&&r.push(s),{buffer:s}}static deserialize(e){return new Nn(e.buffer)}}const vr={};function Fe(i,e,r={}){if(vr[i])throw new Error(`${i} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),vr[i]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}Fe("Object",Object),Fe("TransferableGridIndex",Nn),Fe("Color",wt),Fe("Error",Error),Fe("AJAXError",Fi),Fe("ResolvedImage",di),Fe("StylePropertyFunction",ho),Fe("StyleExpression",co,{omit:["_evaluator"]}),Fe("ZoomDependentExpression",ca),Fe("ZoomConstantExpression",la),Fe("CompoundExpression",$i,{omit:["_evaluate"]});for(const i in dn)dn[i]._classRegistryKey||Fe(`Expression_${i}`,dn[i]);function Ol(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function Aa(i){return i.$name||i.constructor._classRegistryKey}function Vl(i){return!function(e){if(e===null||typeof e!="object")return!1;const r=Aa(e);return!(!r||r==="Object")}(i)&&(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||i instanceof Error||Ol(i)||pr(i)||ArrayBuffer.isView(i)||i instanceof ImageData)}function Cs(i,e){if(Vl(i))return(Ol(i)||pr(i))&&e&&e.push(i),ArrayBuffer.isView(i)&&e&&e.push(i.buffer),i instanceof ImageData&&e&&e.push(i.data.buffer),i;if(Array.isArray(i)){const d=[];for(const p of i)d.push(Cs(p,e));return d}if(typeof i!="object")throw new Error("can't serialize object of type "+typeof i);const r=Aa(i);if(!r)throw new Error(`can't serialize object of unregistered class ${i.constructor.name}`);if(!vr[r])throw new Error(`${r} is not registered.`);const{klass:s}=vr[r],l=s.serialize?s.serialize(i,e):{};if(s.serialize){if(e&&l===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const d in i){if(!i.hasOwnProperty(d)||vr[r].omit.indexOf(d)>=0)continue;const p=i[d];l[d]=vr[r].shallow.indexOf(d)>=0?p:Cs(p,e)}i instanceof Error&&(l.message=i.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(l.$name=r),l}function br(i){if(Vl(i))return i;if(Array.isArray(i))return i.map(br);if(typeof i!="object")throw new Error("can't deserialize object of type "+typeof i);const e=Aa(i)||"Object";if(!vr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=vr[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const s=Object.create(r.prototype);for(const l of Object.keys(i)){if(l==="$name")continue;const d=i[l];s[l]=vr[e].shallow.indexOf(l)>=0?d:br(d)}return s}class Nl{constructor(){this.first=!0}update(e,r){const s=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=s,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=s,!0):(this.lastFloorZoom>s?(this.lastIntegerZoom=s+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<s&&(this.lastIntegerZoom=s,this.lastIntegerZoomTime=r),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=s,!0))}}const ze={"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 Ca(i){for(const e of i)if(ka(e.charCodeAt(0)))return!0;return!1}function Yc(i){for(const e of i)if(!jl(e.charCodeAt(0)))return!1;return!0}function jl(i){return!(ze.Arabic(i)||ze["Arabic Supplement"](i)||ze["Arabic Extended-A"](i)||ze["Arabic Presentation Forms-A"](i)||ze["Arabic Presentation Forms-B"](i))}function ka(i){return!(i!==746&&i!==747&&(i<4352||!(ze["Bopomofo Extended"](i)||ze.Bopomofo(i)||ze["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||ze["CJK Compatibility Ideographs"](i)||ze["CJK Compatibility"](i)||ze["CJK Radicals Supplement"](i)||ze["CJK Strokes"](i)||!(!ze["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||ze["CJK Unified Ideographs Extension A"](i)||ze["CJK Unified Ideographs"](i)||ze["Enclosed CJK Letters and Months"](i)||ze["Hangul Compatibility Jamo"](i)||ze["Hangul Jamo Extended-A"](i)||ze["Hangul Jamo Extended-B"](i)||ze["Hangul Jamo"](i)||ze["Hangul Syllables"](i)||ze.Hiragana(i)||ze["Ideographic Description Characters"](i)||ze.Kanbun(i)||ze["Kangxi Radicals"](i)||ze["Katakana Phonetic Extensions"](i)||ze.Katakana(i)&&i!==12540||!(!ze["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)||!(!ze["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||ze["Unified Canadian Aboriginal Syllabics"](i)||ze["Unified Canadian Aboriginal Syllabics Extended"](i)||ze["Vertical Forms"](i)||ze["Yijing Hexagram Symbols"](i)||ze["Yi Syllables"](i)||ze["Yi Radicals"](i))))}function Ul(i){return!(ka(i)||function(e){return!!(ze["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||ze["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)||ze["Letterlike Symbols"](e)||ze["Number Forms"](e)||ze["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)||ze["Control Pictures"](e)&&e!==9251||ze["Optical Character Recognition"](e)||ze["Enclosed Alphanumerics"](e)||ze["Geometric Shapes"](e)||ze["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||ze["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||ze["CJK Symbols and Punctuation"](e)||ze.Katakana(e)||ze["Private Use Area"](e)||ze["CJK Compatibility Forms"](e)||ze["Small Form Variants"](e)||ze["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 Wr(i){return i>=1424&&i<=2303||ze["Arabic Presentation Forms-A"](i)||ze["Arabic Presentation Forms-B"](i)}function $l(i,e){return!(!e&&Wr(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||ze.Khmer(i))}function Ma(i){for(const e of i)if(Wr(e.charCodeAt(0)))return!0;return!1}const Jr=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(i){this.pluginStatus=i.pluginStatus,this.pluginURL=i.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(i){this.applyArabicShaping=i.applyArabicShaping,this.processBidirectionalText=i.processBidirectionalText,this.processStyledBidirectionalText=i.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class 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 Nl,this.transition={})}isSupportedScript(e){return function(r,s){for(const l of r)if(!$l(l.charCodeAt(0),s))return!1;return!0}(e,Jr.getRTLTextPluginStatus()==="loaded")}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),s=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*s}:{fromScale:.5,toScale:1,t:1-(1-s)*r}}}class go{constructor(e,r){this.property=e,this.value=r,this.expression=function(s,l){if(bs(s))return new ho(s,l);if(ws(s)){const d=Dl(s,l);if(d.result==="error")throw new Error(d.value.map(p=>`${p.key}: ${p.message}`).join(", "));return d.value}{let d=s;return l.type==="color"&&typeof s=="string"?d=wt.parse(s):l.type!=="padding"||typeof s!="number"&&!Array.isArray(s)?l.type==="variableAnchorOffsetCollection"&&Array.isArray(s)&&(d=Ni.parse(s)):d=Vi.parse(s),{kind:"constant",evaluate:()=>d}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,s){return this.property.possiblyEvaluate(this,e,r,s)}}class jn{constructor(e){this.property=e,this.value=new go(e,void 0)}transitioned(e,r){return new ql(this.property,this.value,r,St({},e.transition,this.transition),e.now)}untransitioned(){return new ql(this.property,this.value,null,{},0)}}class Un{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return vt(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new jn(this._values[e].property)),this._values[e].value=new go(this._values[e].property,r===null?void 0:vt(r))}getTransition(e){return vt(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new jn(this._values[e].property)),this._values[e].transition=vt(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(e[r]=s);const l=this.getTransition(r);l!==void 0&&(e[`${r}-transition`]=l)}return e}transitioned(e,r){const s=new za(this._properties);for(const l of Object.keys(this._values))s._values[l]=this._values[l].transitioned(e,r._values[l]);return s}untransitioned(){const e=new za(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class ql{constructor(e,r,s,l,d){this.property=e,this.value=r,this.begin=d+l.delay||0,this.end=this.begin+l.duration||0,e.specification.transition&&(l.delay||l.duration)&&(this.prior=s)}possiblyEvaluate(e,r,s){const l=e.now||0,d=this.value.possiblyEvaluate(e,r,s),p=this.prior;if(p){if(l>this.end)return this.prior=null,d;if(this.value.isDataDriven())return this.prior=null,d;if(l<this.begin)return p.possiblyEvaluate(e,r,s);{const f=(l-this.begin)/(this.end-this.begin);return this.property.interpolate(p.possiblyEvaluate(e,r,s),d,function(g){if(g<=0)return 0;if(g>=1)return 1;const x=g*g,w=x*g;return 4*(g<.5?w:3*(g-x)+w-.75)}(f))}}return d}}class za{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,s){const l=new _o(this._properties);for(const d of Object.keys(this._values))l._values[d]=this._values[d].possiblyEvaluate(e,r,s);return l}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class ks{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return vt(this._values[e].value)}setValue(e,r){this._values[e]=new go(this._values[e].property,r===null?void 0:vt(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(e[r]=s)}return e}possiblyEvaluate(e,r,s){const l=new _o(this._properties);for(const d of Object.keys(this._values))l._values[d]=this._values[d].possiblyEvaluate(e,r,s);return l}}class wr{constructor(e,r,s){this.property=e,this.value=r,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,s,l){return this.property.evaluate(this.value,this.parameters,e,r,s,l)}}class _o{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class qe{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,s){const l=ji[this.specification.type];return l?l(e,r,s):e}}class Je{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,s,l){return new wr(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},s,l)}:e.expression,r)}interpolate(e,r,s){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new wr(this,{kind:"constant",value:void 0},e.parameters);const l=ji[this.specification.type];if(l){const d=l(e.value.value,r.value.value,s);return new wr(this,{kind:"constant",value:d},e.parameters)}return e}evaluate(e,r,s,l,d,p){return e.kind==="constant"?e.value:e.evaluate(r,s,l,d,p)}}class h extends Je{possiblyEvaluate(e,r,s,l){if(e.value===void 0)return new wr(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const d=e.expression.evaluate(r,null,{},s,l),p=e.property.specification.type==="resolvedImage"&&typeof d!="string"?d.name:d,f=this._calculate(p,p,p,r);return new wr(this,{kind:"constant",value:f},r)}if(e.expression.kind==="camera"){const d=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 wr(this,{kind:"constant",value:d},r)}return new wr(this,e.expression,r)}evaluate(e,r,s,l,d,p){if(e.kind==="source"){const f=e.evaluate(r,s,l,d,p);return this._calculate(f,f,f,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},s,l),e.evaluate({zoom:Math.floor(r.zoom)},s,l),e.evaluate({zoom:Math.floor(r.zoom)+1},s,l),r):e.value}_calculate(e,r,s,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:s,to:r}}interpolate(e){return e}}class t{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,l){if(e.value!==void 0){if(e.expression.kind==="constant"){const d=e.expression.evaluate(r,null,{},s,l);return this._calculate(d,d,d,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,s,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:s,to:r}}interpolate(e){return e}}class n{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,l){return!!e.expression.evaluate(r,null,{},s,l)}interpolate(){return!1}}class o{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in e){const s=e[r];s.specification.overridable&&this.overridableProperties.push(r);const l=this.defaultPropertyValues[r]=new go(s,void 0),d=this.defaultTransitionablePropertyValues[r]=new jn(s);this.defaultTransitioningPropertyValues[r]=d.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=l.possiblyEvaluate({})}}}Fe("DataDrivenProperty",Je),Fe("DataConstantProperty",qe),Fe("CrossFadedDataDrivenProperty",h),Fe("CrossFadedProperty",t),Fe("ColorRampProperty",n);const a="-transition";class c extends kn{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 ks(r.layout)),r.paint)){this._transitionablePaint=new Un(r.paint);for(const s in e.paint)this.setPaintProperty(s,e.paint[s],{validate:!1});for(const s in e.layout)this.setLayoutProperty(s,e.layout[s],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new _o(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,s={}){r!=null&&this._validate(Kc,`layers.${this.id}.layout.${e}`,e,r,s)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(a)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,s={}){if(r!=null&&this._validate(Jc,`layers.${this.id}.paint.${e}`,e,r,s))return!1;if(e.endsWith(a))return this._transitionablePaint.setTransition(e.slice(0,-11),r||void 0),!1;{const l=this._transitionablePaint._values[e],d=l.property.specification["property-type"]==="cross-faded-data-driven",p=l.value.isDataDriven(),f=l.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const g=this._transitionablePaint._values[e].value;return g.isDataDriven()||p||d||this._handleOverridablePaintPropertyUpdate(e,f,g)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,s){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),Qi(e,(r,s)=>!(r===void 0||s==="layout"&&!Object.keys(r).length||s==="paint"&&!Object.keys(r).length))}_validate(e,r,s,l,d={}){return(!d||d.validate!==!1)&&Ea(this,e.call(Rr,{key:r,layerType:this.type,objectKey:s,value:l,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 wr&&fn(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const m={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class _{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 v{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 b(i,e=1){let r=0,s=0;return{members:i.map(l=>{const d=m[l.type].BYTES_PER_ELEMENT,p=r=P(r,Math.max(e,d)),f=l.components||1;return s=Math.max(s,d),r+=d*f,{name:l.name,type:l.type,components:f,offset:p}}),size:P(r,Math.max(s,e)),alignment:e}}function P(i,e){return Math.ceil(i/e)*e}class E extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.int16[l+0]=r,this.int16[l+1]=s,e}}E.prototype.bytesPerElement=4,Fe("StructArrayLayout2i4",E);class z extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const d=3*e;return this.int16[d+0]=r,this.int16[d+1]=s,this.int16[d+2]=l,e}}z.prototype.bytesPerElement=6,Fe("StructArrayLayout3i6",z);class B extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const d=this.length;return this.resize(d+1),this.emplace(d,e,r,s,l)}emplace(e,r,s,l,d){const p=4*e;return this.int16[p+0]=r,this.int16[p+1]=s,this.int16[p+2]=l,this.int16[p+3]=d,e}}B.prototype.bytesPerElement=8,Fe("StructArrayLayout4i8",B);class V extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,d,p){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,d,p)}emplace(e,r,s,l,d,p,f){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=s,this.int16[g+2]=l,this.int16[g+3]=d,this.int16[g+4]=p,this.int16[g+5]=f,e}}V.prototype.bytesPerElement=12,Fe("StructArrayLayout2i4i12",V);class q extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,d,p){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,d,p)}emplace(e,r,s,l,d,p,f){const g=4*e,x=8*e;return this.int16[g+0]=r,this.int16[g+1]=s,this.uint8[x+4]=l,this.uint8[x+5]=d,this.uint8[x+6]=p,this.uint8[x+7]=f,e}}q.prototype.bytesPerElement=8,Fe("StructArrayLayout2i4ub8",q);class j extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.float32[l+0]=r,this.float32[l+1]=s,e}}j.prototype.bytesPerElement=8,Fe("StructArrayLayout2f8",j);class H extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,d,p,f,g,x,w){const I=this.length;return this.resize(I+1),this.emplace(I,e,r,s,l,d,p,f,g,x,w)}emplace(e,r,s,l,d,p,f,g,x,w,I){const A=10*e;return this.uint16[A+0]=r,this.uint16[A+1]=s,this.uint16[A+2]=l,this.uint16[A+3]=d,this.uint16[A+4]=p,this.uint16[A+5]=f,this.uint16[A+6]=g,this.uint16[A+7]=x,this.uint16[A+8]=w,this.uint16[A+9]=I,e}}H.prototype.bytesPerElement=20,Fe("StructArrayLayout10ui20",H);class J extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,d,p,f,g,x,w,I,A){const M=this.length;return this.resize(M+1),this.emplace(M,e,r,s,l,d,p,f,g,x,w,I,A)}emplace(e,r,s,l,d,p,f,g,x,w,I,A,M){const L=12*e;return this.int16[L+0]=r,this.int16[L+1]=s,this.int16[L+2]=l,this.int16[L+3]=d,this.uint16[L+4]=p,this.uint16[L+5]=f,this.uint16[L+6]=g,this.uint16[L+7]=x,this.int16[L+8]=w,this.int16[L+9]=I,this.int16[L+10]=A,this.int16[L+11]=M,e}}J.prototype.bytesPerElement=24,Fe("StructArrayLayout4i4ui4i24",J);class N extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const d=3*e;return this.float32[d+0]=r,this.float32[d+1]=s,this.float32[d+2]=l,e}}N.prototype.bytesPerElement=12,Fe("StructArrayLayout3f12",N);class ee extends v{_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}}ee.prototype.bytesPerElement=4,Fe("StructArrayLayout1ul4",ee);class ne extends v{_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,s,l,d,p,f,g,x){const w=this.length;return this.resize(w+1),this.emplace(w,e,r,s,l,d,p,f,g,x)}emplace(e,r,s,l,d,p,f,g,x,w){const I=10*e,A=5*e;return this.int16[I+0]=r,this.int16[I+1]=s,this.int16[I+2]=l,this.int16[I+3]=d,this.int16[I+4]=p,this.int16[I+5]=f,this.uint32[A+3]=g,this.uint16[I+8]=x,this.uint16[I+9]=w,e}}ne.prototype.bytesPerElement=20,Fe("StructArrayLayout6i1ul2ui20",ne);class le extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,d,p){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,d,p)}emplace(e,r,s,l,d,p,f){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=s,this.int16[g+2]=l,this.int16[g+3]=d,this.int16[g+4]=p,this.int16[g+5]=f,e}}le.prototype.bytesPerElement=12,Fe("StructArrayLayout2i2i2i12",le);class ge extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,d){const p=this.length;return this.resize(p+1),this.emplace(p,e,r,s,l,d)}emplace(e,r,s,l,d,p){const f=4*e,g=8*e;return this.float32[f+0]=r,this.float32[f+1]=s,this.float32[f+2]=l,this.int16[g+6]=d,this.int16[g+7]=p,e}}ge.prototype.bytesPerElement=16,Fe("StructArrayLayout2f1f2i16",ge);class ve extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,d,p){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,d,p)}emplace(e,r,s,l,d,p,f){const g=16*e,x=4*e,w=8*e;return this.uint8[g+0]=r,this.uint8[g+1]=s,this.float32[x+1]=l,this.float32[x+2]=d,this.int16[w+6]=p,this.int16[w+7]=f,e}}ve.prototype.bytesPerElement=16,Fe("StructArrayLayout2ub2f2i16",ve);class De extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const d=3*e;return this.uint16[d+0]=r,this.uint16[d+1]=s,this.uint16[d+2]=l,e}}De.prototype.bytesPerElement=6,Fe("StructArrayLayout3ui6",De);class Re extends v{_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,s,l,d,p,f,g,x,w,I,A,M,L,F,U,X){const se=this.length;return this.resize(se+1),this.emplace(se,e,r,s,l,d,p,f,g,x,w,I,A,M,L,F,U,X)}emplace(e,r,s,l,d,p,f,g,x,w,I,A,M,L,F,U,X,se){const K=24*e,ie=12*e,de=48*e;return this.int16[K+0]=r,this.int16[K+1]=s,this.uint16[K+2]=l,this.uint16[K+3]=d,this.uint32[ie+2]=p,this.uint32[ie+3]=f,this.uint32[ie+4]=g,this.uint16[K+10]=x,this.uint16[K+11]=w,this.uint16[K+12]=I,this.float32[ie+7]=A,this.float32[ie+8]=M,this.uint8[de+36]=L,this.uint8[de+37]=F,this.uint8[de+38]=U,this.uint32[ie+10]=X,this.int16[K+22]=se,e}}Re.prototype.bytesPerElement=48,Fe("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Re);class be extends v{_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,s,l,d,p,f,g,x,w,I,A,M,L,F,U,X,se,K,ie,de,ye,Le,Xe,Me,Ce,$e,Ve){const Be=this.length;return this.resize(Be+1),this.emplace(Be,e,r,s,l,d,p,f,g,x,w,I,A,M,L,F,U,X,se,K,ie,de,ye,Le,Xe,Me,Ce,$e,Ve)}emplace(e,r,s,l,d,p,f,g,x,w,I,A,M,L,F,U,X,se,K,ie,de,ye,Le,Xe,Me,Ce,$e,Ve,Be){const me=32*e,Ze=16*e;return this.int16[me+0]=r,this.int16[me+1]=s,this.int16[me+2]=l,this.int16[me+3]=d,this.int16[me+4]=p,this.int16[me+5]=f,this.int16[me+6]=g,this.int16[me+7]=x,this.uint16[me+8]=w,this.uint16[me+9]=I,this.uint16[me+10]=A,this.uint16[me+11]=M,this.uint16[me+12]=L,this.uint16[me+13]=F,this.uint16[me+14]=U,this.uint16[me+15]=X,this.uint16[me+16]=se,this.uint16[me+17]=K,this.uint16[me+18]=ie,this.uint16[me+19]=de,this.uint16[me+20]=ye,this.uint16[me+21]=Le,this.uint16[me+22]=Xe,this.uint32[Ze+12]=Me,this.float32[Ze+13]=Ce,this.float32[Ze+14]=$e,this.uint16[me+30]=Ve,this.uint16[me+31]=Be,e}}be.prototype.bytesPerElement=64,Fe("StructArrayLayout8i15ui1ul2f2ui64",be);class Se extends v{_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}}Se.prototype.bytesPerElement=4,Fe("StructArrayLayout1f4",Se);class Ne extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const d=3*e;return this.uint16[6*e+0]=r,this.float32[d+1]=s,this.float32[d+2]=l,e}}Ne.prototype.bytesPerElement=12,Fe("StructArrayLayout1ui2f12",Ne);class it extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const d=4*e;return this.uint32[2*e+0]=r,this.uint16[d+2]=s,this.uint16[d+3]=l,e}}it.prototype.bytesPerElement=8,Fe("StructArrayLayout1ul2ui8",it);class Ee extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.uint16[l+0]=r,this.uint16[l+1]=s,e}}Ee.prototype.bytesPerElement=4,Fe("StructArrayLayout2ui4",Ee);class ke extends v{_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}}ke.prototype.bytesPerElement=2,Fe("StructArrayLayout1ui2",ke);class Qe extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const d=this.length;return this.resize(d+1),this.emplace(d,e,r,s,l)}emplace(e,r,s,l,d){const p=4*e;return this.float32[p+0]=r,this.float32[p+1]=s,this.float32[p+2]=l,this.float32[p+3]=d,e}}Qe.prototype.bytesPerElement=16,Fe("StructArrayLayout4f16",Qe);class Rt extends _{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 he(this.anchorPointX,this.anchorPointY)}}Rt.prototype.size=20;class ot extends ne{get(e){return new Rt(this,e)}}Fe("CollisionBoxArray",ot);class ut extends _{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]}}ut.prototype.size=48;class Bt extends Re{get(e){return new ut(this,e)}}Fe("PlacedSymbolArray",Bt);class pi extends _{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]}}pi.prototype.size=64;class sr extends be{get(e){return new pi(this,e)}}Fe("SymbolInstanceArray",sr);class Ft extends Se{getoffsetX(e){return this.float32[1*e+0]}}Fe("GlyphOffsetArray",Ft);class Mi extends z{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Fe("SymbolLineVertexArray",Mi);class Ii extends _{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]}}Ii.prototype.size=12;class fi extends Ne{get(e){return new Ii(this,e)}}Fe("TextAnchorOffsetArray",fi);class mi extends _{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]}}mi.prototype.size=8;class or extends it{get(e){return new mi(this,e)}}Fe("FeatureIndexArray",or);class xn extends E{}class yo extends E{}class $n extends E{}class vn extends V{}class xo extends q{}class Da extends j{}class ai extends H{}class ar extends J{}class Kr extends N{}class qn extends ee{}class gi extends le{}class _i extends ve{}class ni extends De{}class jt extends Ee{}const Zn=b([{name:"a_pos",components:2,type:"Int16"}],4),{members:La}=Zn;class ti{constructor(e=[]){this.segments=e}prepareSegment(e,r,s,l){let d=this.segments[this.segments.length-1];return e>ti.MAX_VERTEX_ARRAY_LENGTH&&ci(`Max vertices per segment is ${ti.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!d||d.vertexLength+e>ti.MAX_VERTEX_ARRAY_LENGTH||d.sortKey!==l)&&(d={vertexOffset:r.length,primitiveOffset:s.length,vertexLength:0,primitiveLength:0},l!==void 0&&(d.sortKey=l),this.segments.push(d)),d}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,s,l){return new ti([{vertexOffset:e,primitiveOffset:r,vertexLength:s,primitiveLength:l,vaos:{},sortKey:0}])}}function Zl(i,e){return 256*(i=zt(Math.floor(i),0,255))+zt(Math.floor(e),0,255)}ti.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Fe("SegmentVector",ti);const vo=b([{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 bo={exports:{}},Yr={exports:{}};Yr.exports=function(i,e){var r,s,l,d,p,f,g,x;for(s=i.length-(r=3&i.length),l=e,p=3432918353,f=461845907,x=0;x<s;)g=255&i.charCodeAt(x)|(255&i.charCodeAt(++x))<<8|(255&i.charCodeAt(++x))<<16|(255&i.charCodeAt(++x))<<24,++x,l=27492+(65535&(d=5*(65535&(l=(l^=g=(65535&(g=(g=(65535&g)*p+(((g>>>16)*p&65535)<<16)&4294967295)<<15|g>>>17))*f+(((g>>>16)*f&65535)<<16)&4294967295)<<13|l>>>19))+((5*(l>>>16)&65535)<<16)&4294967295))+((58964+(d>>>16)&65535)<<16);switch(g=0,r){case 3:g^=(255&i.charCodeAt(x+2))<<16;case 2:g^=(255&i.charCodeAt(x+1))<<8;case 1:l^=g=(65535&(g=(g=(65535&(g^=255&i.charCodeAt(x)))*p+(((g>>>16)*p&65535)<<16)&4294967295)<<15|g>>>17))*f+(((g>>>16)*f&65535)<<16)&4294967295}return l^=i.length,l=2246822507*(65535&(l^=l>>>16))+((2246822507*(l>>>16)&65535)<<16)&4294967295,l=3266489909*(65535&(l^=l>>>13))+((3266489909*(l>>>16)&65535)<<16)&4294967295,(l^=l>>>16)>>>0};var Gl=Yr.exports,Ra={exports:{}};Ra.exports=function(i,e){for(var r,s=i.length,l=e^s,d=0;s>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(d)|(255&i.charCodeAt(++d))<<8|(255&i.charCodeAt(++d))<<16|(255&i.charCodeAt(++d))<<24))+((1540483477*(r>>>16)&65535)<<16),l=1540483477*(65535&l)+((1540483477*(l>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),s-=4,++d;switch(s){case 3:l^=(255&i.charCodeAt(d+2))<<16;case 2:l^=(255&i.charCodeAt(d+1))<<8;case 1:l=1540483477*(65535&(l^=255&i.charCodeAt(d)))+((1540483477*(l>>>16)&65535)<<16)}return l=1540483477*(65535&(l^=l>>>13))+((1540483477*(l>>>16)&65535)<<16),(l^=l>>>15)>>>0};var Ba=Gl,Fa=Ra.exports;bo.exports=Ba,bo.exports.murmur3=Ba,bo.exports.murmur2=Fa;var wo=Ie(bo.exports);class Gn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,s,l){this.ids.push(Cu(e)),this.positions.push(r,s,l)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=Cu(e);let s=0,l=this.ids.length-1;for(;s<l;){const p=s+l>>1;this.ids[p]>=r?l=p:s=p+1}const d=[];for(;this.ids[s]===r;)d.push({index:this.positions[3*s],start:this.positions[3*s+1],end:this.positions[3*s+2]}),s++;return d}static serialize(e,r){const s=new Float64Array(e.ids),l=new Uint32Array(e.positions);return Qc(s,l,0,s.length-1),r&&r.push(s.buffer,l.buffer),{ids:s,positions:l}}static deserialize(e){const r=new Gn;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function Cu(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:wo(String(i))}function Qc(i,e,r,s){for(;r<s;){const l=i[r+s>>1];let d=r-1,p=s+1;for(;;){do d++;while(i[d]<l);do p--;while(i[p]>l);if(d>=p)break;Hl(i,d,p),Hl(e,3*d,3*p),Hl(e,3*d+1,3*p+1),Hl(e,3*d+2,3*p+2)}p-r<s-p?(Qc(i,e,r,p),r=p+1):(Qc(i,e,p+1,s),s=p)}}function Hl(i,e,r){const s=i[e];i[e]=i[r],i[r]=s}Fe("FeaturePositionMap",Gn);class Ms{constructor(e,r){this.gl=e.gl,this.location=r}}class Xl extends Ms{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class ku extends Ms{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 Mu extends Ms{constructor(e,r){super(e,r),this.current=wt.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 og=new Float32Array(16);function eh(i){return[Zl(255*i.r,255*i.g),Zl(255*i.b,255*i.a)]}class Oa{constructor(e,r,s){this.value=e,this.uniformNames=r.map(l=>`u_${l}`),this.type=s}setUniform(e,r,s){e.set(s.constantOr(this.value))}getBinding(e,r,s){return this.type==="color"?new Mu(e,r):new Xl(e,r)}}class So{constructor(e,r){this.uniformNames=r.map(s=>`u_${s}`),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,s,l){const d=l==="u_pattern_to"?this.patternTo:l==="u_pattern_from"?this.patternFrom:l==="u_pixel_ratio_to"?this.pixelRatioTo:l==="u_pixel_ratio_from"?this.pixelRatioFrom:null;d&&e.set(d)}getBinding(e,r,s){return s.substr(0,9)==="u_pattern"?new ku(e,r):new Xl(e,r)}}class bn{constructor(e,r,s,l){this.expression=e,this.type=s,this.maxValue=0,this.paintVertexAttributes=r.map(d=>({name:`a_${d}`,type:"Float32",components:s==="color"?2:1,offset:0})),this.paintVertexArray=new l}populatePaintArray(e,r,s,l,d){const p=this.paintVertexArray.length,f=this.expression.evaluate(new kt(0),r,{},l,[],d);this.paintVertexArray.resize(e),this._setPaintValue(p,e,f)}updatePaintArray(e,r,s,l){const d=this.expression.evaluate({zoom:0},s,l);this._setPaintValue(e,r,d)}_setPaintValue(e,r,s){if(this.type==="color"){const l=eh(s);for(let d=e;d<r;d++)this.paintVertexArray.emplace(d,l[0],l[1])}else{for(let l=e;l<r;l++)this.paintVertexArray.emplace(l,s);this.maxValue=Math.max(this.maxValue,Math.abs(s))}}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 Br{constructor(e,r,s,l,d,p){this.expression=e,this.uniformNames=r.map(f=>`u_${f}_t`),this.type=s,this.useIntegerZoom=l,this.zoom=d,this.maxValue=0,this.paintVertexAttributes=r.map(f=>({name:`a_${f}`,type:"Float32",components:s==="color"?4:2,offset:0})),this.paintVertexArray=new p}populatePaintArray(e,r,s,l,d){const p=this.expression.evaluate(new kt(this.zoom),r,{},l,[],d),f=this.expression.evaluate(new kt(this.zoom+1),r,{},l,[],d),g=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(g,e,p,f)}updatePaintArray(e,r,s,l){const d=this.expression.evaluate({zoom:this.zoom},s,l),p=this.expression.evaluate({zoom:this.zoom+1},s,l);this._setPaintValue(e,r,d,p)}_setPaintValue(e,r,s,l){if(this.type==="color"){const d=eh(s),p=eh(l);for(let f=e;f<r;f++)this.paintVertexArray.emplace(f,d[0],d[1],p[0],p[1])}else{for(let d=e;d<r;d++)this.paintVertexArray.emplace(d,s,l);this.maxValue=Math.max(this.maxValue,Math.abs(s),Math.abs(l))}}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 s=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,l=zt(this.expression.interpolationFactor(s,this.zoom,this.zoom+1),0,1);e.set(l)}getBinding(e,r,s){return new Xl(e,r)}}class Hn{constructor(e,r,s,l,d,p){this.expression=e,this.type=r,this.useIntegerZoom=s,this.zoom=l,this.layerId=p,this.zoomInPaintVertexArray=new d,this.zoomOutPaintVertexArray=new d}populatePaintArray(e,r,s){const l=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(l,e,r.patterns&&r.patterns[this.layerId],s)}updatePaintArray(e,r,s,l,d){this._setPaintValues(e,r,s.patterns&&s.patterns[this.layerId],d)}_setPaintValues(e,r,s,l){if(!l||!s)return;const{min:d,mid:p,max:f}=s,g=l[d],x=l[p],w=l[f];if(g&&x&&w)for(let I=e;I<r;I++)this.zoomInPaintVertexArray.emplace(I,x.tl[0],x.tl[1],x.br[0],x.br[1],g.tl[0],g.tl[1],g.br[0],g.br[1],x.pixelRatio,g.pixelRatio),this.zoomOutPaintVertexArray.emplace(I,x.tl[0],x.tl[1],x.br[0],x.br[1],w.tl[0],w.tl[1],w.br[0],w.br[1],x.pixelRatio,w.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,vo.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,vo.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class zu{constructor(e,r,s){this.binders={},this._buffers=[];const l=[];for(const d in e.paint._values){if(!s(d))continue;const p=e.paint.get(d);if(!(p instanceof wr&&fn(p.property.specification)))continue;const f=ag(d,e.type),g=p.value,x=p.property.specification.type,w=p.property.useIntegerZoom,I=p.property.specification["property-type"],A=I==="cross-faded"||I==="cross-faded-data-driven";if(g.kind==="constant")this.binders[d]=A?new So(g.value,f):new Oa(g.value,f,x),l.push(`/u_${d}`);else if(g.kind==="source"||A){const M=Du(d,x,"source");this.binders[d]=A?new Hn(g,x,w,r,M,e.id):new bn(g,f,x,M),l.push(`/a_${d}`)}else{const M=Du(d,x,"composite");this.binders[d]=new Br(g,f,x,w,r,M),l.push(`/z_${d}`)}}this.cacheKey=l.sort().join("")}getMaxValue(e){const r=this.binders[e];return r instanceof bn||r instanceof Br?r.maxValue:0}populatePaintArrays(e,r,s,l,d){for(const p in this.binders){const f=this.binders[p];(f instanceof bn||f instanceof Br||f instanceof Hn)&&f.populatePaintArray(e,r,s,l,d)}}setConstantPatternPositions(e,r){for(const s in this.binders){const l=this.binders[s];l instanceof So&&l.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,s,l,d){let p=!1;for(const f in e){const g=r.getPositions(f);for(const x of g){const w=s.feature(x.index);for(const I in this.binders){const A=this.binders[I];if((A instanceof bn||A instanceof Br||A instanceof Hn)&&A.expression.isStateDependent===!0){const M=l.paint.get(I);A.expression=M.value,A.updatePaintArray(x.start,x.end,w,e[f],d),p=!0}}}}return p}defines(){const e=[];for(const r in this.binders){const s=this.binders[r];(s instanceof Oa||s instanceof So)&&e.push(...s.uniformNames.map(l=>`#define HAS_UNIFORM_${l}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof bn||s instanceof Br)for(let l=0;l<s.paintVertexAttributes.length;l++)e.push(s.paintVertexAttributes[l].name);else if(s instanceof Hn)for(let l=0;l<vo.members.length;l++)e.push(vo.members[l].name)}return e}getBinderUniforms(){const e=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof Oa||s instanceof So||s instanceof Br)for(const l of s.uniformNames)e.push(l)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,r){const s=[];for(const l in this.binders){const d=this.binders[l];if(d instanceof Oa||d instanceof So||d instanceof Br){for(const p of d.uniformNames)if(r[p]){const f=d.getBinding(e,r[p],p);s.push({name:p,property:l,binding:f})}}}return s}setUniforms(e,r,s,l){for(const{name:d,property:p,binding:f}of r)this.binders[p].setUniform(f,l,s.get(p),d)}updatePaintBuffers(e){this._buffers=[];for(const r in this.binders){const s=this.binders[r];if(e&&s instanceof Hn){const l=e.fromScale===2?s.zoomInPaintVertexBuffer:s.zoomOutPaintVertexBuffer;l&&this._buffers.push(l)}else(s instanceof bn||s instanceof Br)&&s.paintVertexBuffer&&this._buffers.push(s.paintVertexBuffer)}}upload(e){for(const r in this.binders){const s=this.binders[r];(s instanceof bn||s instanceof Br||s instanceof Hn)&&s.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const r=this.binders[e];(r instanceof bn||r instanceof Br||r instanceof Hn)&&r.destroy()}}}class zs{constructor(e,r,s=()=>!0){this.programConfigurations={};for(const l of e)this.programConfigurations[l.id]=new zu(l,r,s);this.needsUpload=!1,this._featureMap=new Gn,this._bufferOffset=0}populatePaintArrays(e,r,s,l,d,p){for(const f in this.programConfigurations)this.programConfigurations[f].populatePaintArrays(e,r,l,d,p);r.id!==void 0&&this._featureMap.add(r.id,s,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,s,l){for(const d of s)this.needsUpload=this.programConfigurations[d.id].updatePaintArrays(e,this._featureMap,r,d,l)||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 ag(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 Du(i,e,r){const s={color:{source:j,composite:Qe},number:{source:Se,composite:j}},l=function(d){return{"line-pattern":{source:ai,composite:ai},"fill-pattern":{source:ai,composite:ai},"fill-extrusion-pattern":{source:ai,composite:ai}}[d]}(i);return l&&l[r]||s[e][r]}Fe("ConstantBinder",Oa),Fe("CrossFadedConstantBinder",So),Fe("SourceExpressionBinder",bn),Fe("CrossFadedCompositeBinder",Hn),Fe("CompositeExpressionBinder",Br),Fe("ProgramConfiguration",zu,{omit:["_buffers"]}),Fe("ProgramConfigurationSet",zs);const Qt=8192,th=Math.pow(2,14)-1,Lu=-th-1;function Ds(i){const e=Qt/i.extent,r=i.loadGeometry();for(let s=0;s<r.length;s++){const l=r[s];for(let d=0;d<l.length;d++){const p=l[d],f=Math.round(p.x*e),g=Math.round(p.y*e);p.x=zt(f,Lu,th),p.y=zt(g,Lu,th),(f<p.x||f>p.x+1||g<p.y||g>p.y+1)&&ci("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Ls(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?Ds(i):[]}}function Wl(i,e,r,s,l){i.emplaceBack(2*e+(s+1)/2,2*r+(l+1)/2)}class ih{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 yo,this.indexArray=new ni,this.segments=new ti,this.programConfigurations=new zs(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){const l=this.layers[0],d=[];let p=null,f=!1;l.type==="circle"&&(p=l.layout.get("circle-sort-key"),f=!p.isConstant());for(const{feature:g,id:x,index:w,sourceLayerIndex:I}of e){const A=this.layers[0]._featureFilter.needGeometry,M=Ls(g,A);if(!this.layers[0]._featureFilter.filter(new kt(this.zoom),M,s))continue;const L=f?p.evaluate(M,{},s):void 0,F={id:x,properties:g.properties,type:g.type,sourceLayerIndex:I,index:w,geometry:A?M.geometry:Ds(g),patterns:{},sortKey:L};d.push(F)}f&&d.sort((g,x)=>g.sortKey-x.sortKey);for(const g of d){const{geometry:x,index:w,sourceLayerIndex:I}=g,A=e[w].feature;this.addFeature(g,x,w,s),r.featureIndex.insert(A,x,w,I,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,La),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,s,l){for(const d of r)for(const p of d){const f=p.x,g=p.y;if(f<0||f>=Qt||g<0||g>=Qt)continue;const x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),w=x.vertexLength;Wl(this.layoutVertexArray,f,g,-1,-1),Wl(this.layoutVertexArray,f,g,1,-1),Wl(this.layoutVertexArray,f,g,1,1),Wl(this.layoutVertexArray,f,g,-1,1),this.indexArray.emplaceBack(w,w+1,w+2),this.indexArray.emplaceBack(w,w+3,w+2),x.vertexLength+=4,x.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{},l)}}function Ru(i,e){for(let r=0;r<i.length;r++)if(To(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(To(i,e[r]))return!0;return!!rh(i,e)}function lg(i,e,r){return!!To(i,e)||!!nh(e,i,r)}function Bu(i,e){if(i.length===1)return Ou(e,i[0]);for(let r=0;r<e.length;r++){const s=e[r];for(let l=0;l<s.length;l++)if(To(i,s[l]))return!0}for(let r=0;r<i.length;r++)if(Ou(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(rh(i,e[r]))return!0;return!1}function cg(i,e,r){if(i.length>1){if(rh(i,e))return!0;for(let s=0;s<e.length;s++)if(nh(e[s],i,r))return!0}for(let s=0;s<i.length;s++)if(nh(i[s],e,r))return!0;return!1}function rh(i,e){if(i.length===0||e.length===0)return!1;for(let r=0;r<i.length-1;r++){const s=i[r],l=i[r+1];for(let d=0;d<e.length-1;d++)if(hg(s,l,e[d],e[d+1]))return!0}return!1}function hg(i,e,r,s){return wi(i,r,s)!==wi(e,r,s)&&wi(i,e,r)!==wi(i,e,s)}function nh(i,e,r){const s=r*r;if(e.length===1)return i.distSqr(e[0])<s;for(let l=1;l<e.length;l++)if(Fu(i,e[l-1],e[l])<s)return!0;return!1}function Fu(i,e,r){const s=e.distSqr(r);if(s===0)return i.distSqr(e);const l=((i.x-e.x)*(r.x-e.x)+(i.y-e.y)*(r.y-e.y))/s;return i.distSqr(l<0?e:l>1?r:r.sub(e)._mult(l)._add(e))}function Ou(i,e){let r,s,l,d=!1;for(let p=0;p<i.length;p++){r=i[p];for(let f=0,g=r.length-1;f<r.length;g=f++)s=r[f],l=r[g],s.y>e.y!=l.y>e.y&&e.x<(l.x-s.x)*(e.y-s.y)/(l.y-s.y)+s.x&&(d=!d)}return d}function To(i,e){let r=!1;for(let s=0,l=i.length-1;s<i.length;l=s++){const d=i[s],p=i[l];d.y>e.y!=p.y>e.y&&e.x<(p.x-d.x)*(e.y-d.y)/(p.y-d.y)+d.x&&(r=!r)}return r}function ug(i,e,r){const s=r[0],l=r[2];if(i.x<s.x&&e.x<s.x||i.x>l.x&&e.x>l.x||i.y<s.y&&e.y<s.y||i.y>l.y&&e.y>l.y)return!1;const d=wi(i,e,r[0]);return d!==wi(i,e,r[1])||d!==wi(i,e,r[2])||d!==wi(i,e,r[3])}function Va(i,e,r){const s=e.paint.get(i).value;return s.kind==="constant"?s.value:r.programConfigurations.get(e.id).getMaxValue(i)}function Jl(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function Kl(i,e,r,s,l){if(!e[0]&&!e[1])return i;const d=he.convert(e)._mult(l);r==="viewport"&&d._rotate(-s);const p=[];for(let f=0;f<i.length;f++)p.push(i[f].sub(d));return p}let Vu,Nu;Fe("CircleBucket",ih,{omit:["layers"]});var dg={get paint(){return Nu=Nu||new o({"circle-radius":new Je(ue.paint_circle["circle-radius"]),"circle-color":new Je(ue.paint_circle["circle-color"]),"circle-blur":new Je(ue.paint_circle["circle-blur"]),"circle-opacity":new Je(ue.paint_circle["circle-opacity"]),"circle-translate":new qe(ue.paint_circle["circle-translate"]),"circle-translate-anchor":new qe(ue.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new qe(ue.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new qe(ue.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Je(ue.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Je(ue.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Je(ue.paint_circle["circle-stroke-opacity"])})},get layout(){return Vu=Vu||new o({"circle-sort-key":new Je(ue.layout_circle["circle-sort-key"])})}},zi=1e-6,Io=typeof Float32Array<"u"?Float32Array:Array;function sh(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 ju(i,e,r){var s=e[0],l=e[1],d=e[2],p=e[3],f=e[4],g=e[5],x=e[6],w=e[7],I=e[8],A=e[9],M=e[10],L=e[11],F=e[12],U=e[13],X=e[14],se=e[15],K=r[0],ie=r[1],de=r[2],ye=r[3];return i[0]=K*s+ie*f+de*I+ye*F,i[1]=K*l+ie*g+de*A+ye*U,i[2]=K*d+ie*x+de*M+ye*X,i[3]=K*p+ie*w+de*L+ye*se,i[4]=(K=r[4])*s+(ie=r[5])*f+(de=r[6])*I+(ye=r[7])*F,i[5]=K*l+ie*g+de*A+ye*U,i[6]=K*d+ie*x+de*M+ye*X,i[7]=K*p+ie*w+de*L+ye*se,i[8]=(K=r[8])*s+(ie=r[9])*f+(de=r[10])*I+(ye=r[11])*F,i[9]=K*l+ie*g+de*A+ye*U,i[10]=K*d+ie*x+de*M+ye*X,i[11]=K*p+ie*w+de*L+ye*se,i[12]=(K=r[12])*s+(ie=r[13])*f+(de=r[14])*I+(ye=r[15])*F,i[13]=K*l+ie*g+de*A+ye*U,i[14]=K*d+ie*x+de*M+ye*X,i[15]=K*p+ie*w+de*L+ye*se,i}Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});var Na,pg=ju;function Yl(i,e,r){var s=e[0],l=e[1],d=e[2],p=e[3];return i[0]=r[0]*s+r[4]*l+r[8]*d+r[12]*p,i[1]=r[1]*s+r[5]*l+r[9]*d+r[13]*p,i[2]=r[2]*s+r[6]*l+r[10]*d+r[14]*p,i[3]=r[3]*s+r[7]*l+r[11]*d+r[15]*p,i}Na=new Io(4),Io!=Float32Array&&(Na[0]=0,Na[1]=0,Na[2]=0,Na[3]=0);class fg extends c{constructor(e){super(e,dg)}createBucket(e){return new ih(e)}queryRadius(e){const r=e;return Va("circle-radius",this,r)+Va("circle-stroke-width",this,r)+Jl(this.paint.get("circle-translate"))}queryIntersectsFeature(e,r,s,l,d,p,f,g){const x=Kl(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),p.angle,f),w=this.paint.get("circle-radius").evaluate(r,s)+this.paint.get("circle-stroke-width").evaluate(r,s),I=this.paint.get("circle-pitch-alignment")==="map",A=I?x:function(L,F){return L.map(U=>Uu(U,F))}(x,g),M=I?w*f:w;for(const L of l)for(const F of L){const U=I?F:Uu(F,g);let X=M;const se=Yl([],[F.x,F.y,0,1],g);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?X*=se[3]/p.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(X*=p.cameraToCenterDistance/se[3]),lg(A,U,X))return!0}return!1}}function Uu(i,e){const r=Yl([],[i.x,i.y,0,1],e);return new he(r[0]/r[3],r[1]/r[3])}class $u extends ih{}let qu;Fe("HeatmapBucket",$u,{omit:["layers"]});var mg={get paint(){return qu=qu||new o({"heatmap-radius":new Je(ue.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Je(ue.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new qe(ue.paint_heatmap["heatmap-intensity"]),"heatmap-color":new n(ue.paint_heatmap["heatmap-color"]),"heatmap-opacity":new qe(ue.paint_heatmap["heatmap-opacity"])})}};function oh(i,{width:e,height:r},s,l){if(l){if(l instanceof Uint8ClampedArray)l=new Uint8Array(l.buffer);else if(l.length!==e*r*s)throw new RangeError(`mismatched image size. expected: ${l.length} but got: ${e*r*s}`)}else l=new Uint8Array(e*r*s);return i.width=e,i.height=r,i.data=l,i}function Zu(i,{width:e,height:r},s){if(e===i.width&&r===i.height)return;const l=oh({},{width:e,height:r},s);ah(i,l,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,e),height:Math.min(i.height,r)},s),i.width=e,i.height=r,i.data=l.data}function ah(i,e,r,s,l,d){if(l.width===0||l.height===0)return e;if(l.width>i.width||l.height>i.height||r.x>i.width-l.width||r.y>i.height-l.height)throw new RangeError("out of range source coordinates for image copy");if(l.width>e.width||l.height>e.height||s.x>e.width-l.width||s.y>e.height-l.height)throw new RangeError("out of range destination coordinates for image copy");const p=i.data,f=e.data;if(p===f)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g<l.height;g++){const x=((r.y+g)*i.width+r.x)*d,w=((s.y+g)*e.width+s.x)*d;for(let I=0;I<l.width*d;I++)f[w+I]=p[x+I]}return e}class ja{constructor(e,r){oh(this,e,1,r)}resize(e){Zu(this,e,1)}clone(){return new ja({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,s,l,d){ah(e,r,s,l,d,1)}}class lr{constructor(e,r){oh(this,e,4,r)}resize(e){Zu(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new lr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,s,l,d){ah(e,r,s,l,d,4)}}function Gu(i){const e={},r=i.resolution||256,s=i.clips?i.clips.length:1,l=i.image||new lr({width:r,height:s});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const d=(p,f,g)=>{e[i.evaluationKey]=g;const x=i.expression.evaluate(e);l.data[p+f+0]=Math.floor(255*x.r/x.a),l.data[p+f+1]=Math.floor(255*x.g/x.a),l.data[p+f+2]=Math.floor(255*x.b/x.a),l.data[p+f+3]=Math.floor(255*x.a)};if(i.clips)for(let p=0,f=0;p<s;++p,f+=4*r)for(let g=0,x=0;g<r;g++,x+=4){const w=g/(r-1),{start:I,end:A}=i.clips[p];d(f,x,I*(1-w)+A*w)}else for(let p=0,f=0;p<r;p++,f+=4)d(0,f,p/(r-1));return l}Fe("AlphaImage",ja),Fe("RGBAImage",lr);class gg extends c{createBucket(e){return new $u(e)}constructor(e){super(e,mg),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Gu({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 Hu;var _g={get paint(){return Hu=Hu||new o({"hillshade-illumination-direction":new qe(ue.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new qe(ue.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new qe(ue.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new qe(ue.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new qe(ue.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new qe(ue.paint_hillshade["hillshade-accent-color"])})}};class yg extends c{constructor(e){super(e,_g)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const xg=b([{name:"a_pos",components:2,type:"Int16"}],4),{members:vg}=xg;function Xu(i,e,r=2){const s=e&&e.length,l=s?e[0]*r:i.length;let d=Wu(i,0,l,r,!0);const p=[];if(!d||d.next===d.prev)return p;let f,g,x;if(s&&(d=function(w,I,A,M){const L=[];for(let F=0,U=I.length;F<U;F++){const X=Wu(w,I[F]*M,F<U-1?I[F+1]*M:w.length,M,!1);X===X.next&&(X.steiner=!0),L.push(Ag(X))}L.sort(Ig);for(let F=0;F<L.length;F++)A=Pg(L[F],A);return A}(i,e,d,r)),i.length>80*r){f=1/0,g=1/0;let w=-1/0,I=-1/0;for(let A=r;A<l;A+=r){const M=i[A],L=i[A+1];M<f&&(f=M),L<g&&(g=L),M>w&&(w=M),L>I&&(I=L)}x=Math.max(w-f,I-g),x=x!==0?32767/x:0}return Ua(d,p,r,f,g,x,0),p}function Wu(i,e,r,s,l){let d;if(l===function(p,f,g,x){let w=0;for(let I=f,A=g-x;I<g;I+=x)w+=(p[A]-p[I])*(p[I+1]+p[A+1]),A=I;return w}(i,e,r,s)>0)for(let p=e;p<r;p+=s)d=Yu(p/s|0,i[p],i[p+1],d);else for(let p=r-s;p>=e;p-=s)d=Yu(p/s|0,i[p],i[p+1],d);return d&&Ql(d,d.next)&&(qa(d),d=d.next),d}function Rs(i,e){if(!i)return i;e||(e=i);let r,s=i;do if(r=!1,s.steiner||!Ql(s,s.next)&&Jt(s.prev,s,s.next)!==0)s=s.next;else{if(qa(s),s=e=s.prev,s===s.next)break;r=!0}while(r||s!==e);return e}function Ua(i,e,r,s,l,d,p){if(!i)return;!p&&d&&function(g,x,w,I){let A=g;do A.z===0&&(A.z=lh(A.x,A.y,x,w,I)),A.prevZ=A.prev,A.nextZ=A.next,A=A.next;while(A!==g);A.prevZ.nextZ=null,A.prevZ=null,function(M){let L,F=1;do{let U,X=M;M=null;let se=null;for(L=0;X;){L++;let K=X,ie=0;for(let ye=0;ye<F&&(ie++,K=K.nextZ,K);ye++);let de=F;for(;ie>0||de>0&&K;)ie!==0&&(de===0||!K||X.z<=K.z)?(U=X,X=X.nextZ,ie--):(U=K,K=K.nextZ,de--),se?se.nextZ=U:M=U,U.prevZ=se,se=U;X=K}se.nextZ=null,F*=2}while(L>1)}(A)}(i,s,l,d);let f=i;for(;i.prev!==i.next;){const g=i.prev,x=i.next;if(d?wg(i,s,l,d):bg(i))e.push(g.i,i.i,x.i),qa(i),i=x.next,f=x.next;else if((i=x)===f){p?p===1?Ua(i=Sg(Rs(i),e),e,r,s,l,d,2):p===2&&Tg(i,e,r,s,l,d):Ua(Rs(i),e,r,s,l,d,1);break}}}function bg(i){const e=i.prev,r=i,s=i.next;if(Jt(e,r,s)>=0)return!1;const l=e.x,d=r.x,p=s.x,f=e.y,g=r.y,x=s.y,w=l<d?l<p?l:p:d<p?d:p,I=f<g?f<x?f:x:g<x?g:x,A=l>d?l>p?l:p:d>p?d:p,M=f>g?f>x?f:x:g>x?g:x;let L=s.next;for(;L!==e;){if(L.x>=w&&L.x<=A&&L.y>=I&&L.y<=M&&Po(l,f,d,g,p,x,L.x,L.y)&&Jt(L.prev,L,L.next)>=0)return!1;L=L.next}return!0}function wg(i,e,r,s){const l=i.prev,d=i,p=i.next;if(Jt(l,d,p)>=0)return!1;const f=l.x,g=d.x,x=p.x,w=l.y,I=d.y,A=p.y,M=f<g?f<x?f:x:g<x?g:x,L=w<I?w<A?w:A:I<A?I:A,F=f>g?f>x?f:x:g>x?g:x,U=w>I?w>A?w:A:I>A?I:A,X=lh(M,L,e,r,s),se=lh(F,U,e,r,s);let K=i.prevZ,ie=i.nextZ;for(;K&&K.z>=X&&ie&&ie.z<=se;){if(K.x>=M&&K.x<=F&&K.y>=L&&K.y<=U&&K!==l&&K!==p&&Po(f,w,g,I,x,A,K.x,K.y)&&Jt(K.prev,K,K.next)>=0||(K=K.prevZ,ie.x>=M&&ie.x<=F&&ie.y>=L&&ie.y<=U&&ie!==l&&ie!==p&&Po(f,w,g,I,x,A,ie.x,ie.y)&&Jt(ie.prev,ie,ie.next)>=0))return!1;ie=ie.nextZ}for(;K&&K.z>=X;){if(K.x>=M&&K.x<=F&&K.y>=L&&K.y<=U&&K!==l&&K!==p&&Po(f,w,g,I,x,A,K.x,K.y)&&Jt(K.prev,K,K.next)>=0)return!1;K=K.prevZ}for(;ie&&ie.z<=se;){if(ie.x>=M&&ie.x<=F&&ie.y>=L&&ie.y<=U&&ie!==l&&ie!==p&&Po(f,w,g,I,x,A,ie.x,ie.y)&&Jt(ie.prev,ie,ie.next)>=0)return!1;ie=ie.nextZ}return!0}function Sg(i,e){let r=i;do{const s=r.prev,l=r.next.next;!Ql(s,l)&&Ju(s,r,r.next,l)&&$a(s,l)&&$a(l,s)&&(e.push(s.i,r.i,l.i),qa(r),qa(r.next),r=i=l),r=r.next}while(r!==i);return Rs(r)}function Tg(i,e,r,s,l,d){let p=i;do{let f=p.next.next;for(;f!==p.prev;){if(p.i!==f.i&&Cg(p,f)){let g=Ku(p,f);return p=Rs(p,p.next),g=Rs(g,g.next),Ua(p,e,r,s,l,d,0),void Ua(g,e,r,s,l,d,0)}f=f.next}p=p.next}while(p!==i)}function Ig(i,e){return i.x-e.x}function Pg(i,e){const r=function(l,d){let p=d;const f=l.x,g=l.y;let x,w=-1/0;do{if(g<=p.y&&g>=p.next.y&&p.next.y!==p.y){const F=p.x+(g-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(F<=f&&F>w&&(w=F,x=p.x<p.next.x?p:p.next,F===f))return x}p=p.next}while(p!==d);if(!x)return null;const I=x,A=x.x,M=x.y;let L=1/0;p=x;do{if(f>=p.x&&p.x>=A&&f!==p.x&&Po(g<M?f:w,g,A,M,g<M?w:f,g,p.x,p.y)){const F=Math.abs(g-p.y)/(f-p.x);$a(p,l)&&(F<L||F===L&&(p.x>x.x||p.x===x.x&&Eg(x,p)))&&(x=p,L=F)}p=p.next}while(p!==I);return x}(i,e);if(!r)return e;const s=Ku(r,i);return Rs(s,s.next),Rs(r,r.next)}function Eg(i,e){return Jt(i.prev,i,e.prev)<0&&Jt(e.next,i,i.next)<0}function lh(i,e,r,s,l){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*l|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*l|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ag(i){let 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 Po(i,e,r,s,l,d,p,f){return(l-p)*(e-f)>=(i-p)*(d-f)&&(i-p)*(s-f)>=(r-p)*(e-f)&&(r-p)*(d-f)>=(l-p)*(s-f)}function Cg(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,s){let l=r;do{if(l.i!==r.i&&l.next.i!==r.i&&l.i!==s.i&&l.next.i!==s.i&&Ju(l,l.next,r,s))return!0;l=l.next}while(l!==r);return!1}(i,e)&&($a(i,e)&&$a(e,i)&&function(r,s){let l=r,d=!1;const p=(r.x+s.x)/2,f=(r.y+s.y)/2;do l.y>f!=l.next.y>f&&l.next.y!==l.y&&p<(l.next.x-l.x)*(f-l.y)/(l.next.y-l.y)+l.x&&(d=!d),l=l.next;while(l!==r);return d}(i,e)&&(Jt(i.prev,i,e.prev)||Jt(i,e.prev,e))||Ql(i,e)&&Jt(i.prev,i,i.next)>0&&Jt(e.prev,e,e.next)>0)}function Jt(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function Ql(i,e){return i.x===e.x&&i.y===e.y}function Ju(i,e,r,s){const l=tc(Jt(i,e,r)),d=tc(Jt(i,e,s)),p=tc(Jt(r,s,i)),f=tc(Jt(r,s,e));return l!==d&&p!==f||!(l!==0||!ec(i,r,e))||!(d!==0||!ec(i,s,e))||!(p!==0||!ec(r,i,s))||!(f!==0||!ec(r,e,s))}function ec(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 tc(i){return i>0?1:i<0?-1:0}function $a(i,e){return Jt(i.prev,i,i.next)<0?Jt(i,e,i.next)>=0&&Jt(i,i.prev,e)>=0:Jt(i,e,i.prev)<0||Jt(i,i.next,e)<0}function Ku(i,e){const r=ch(i.i,i.x,i.y),s=ch(e.i,e.x,e.y),l=i.next,d=e.prev;return i.next=e,e.prev=i,r.next=l,l.prev=r,s.next=r,r.prev=s,d.next=s,s.prev=d,s}function Yu(i,e,r,s){const l=ch(i,e,r);return s?(l.next=s.next,l.prev=s,s.next.prev=l,s.next=l):(l.prev=l,l.next=l),l}function qa(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 ch(i,e,r){return{i,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function hh(i,e,r){const s=r.patternDependencies;let l=!1;for(const d of e){const p=d.paint.get(`${i}-pattern`);p.isConstant()||(l=!0);const f=p.constantOr(null);f&&(l=!0,s[f.to]=!0,s[f.from]=!0)}return l}function uh(i,e,r,s,l){const d=l.patternDependencies;for(const p of e){const f=p.paint.get(`${i}-pattern`).value;if(f.kind!=="constant"){let g=f.evaluate({zoom:s-1},r,{},l.availableImages),x=f.evaluate({zoom:s},r,{},l.availableImages),w=f.evaluate({zoom:s+1},r,{},l.availableImages);g=g&&g.name?g.name:g,x=x&&x.name?x.name:x,w=w&&w.name?w.name:w,d[g]=!0,d[x]=!0,d[w]=!0,r.patterns[p.id]={min:g,mid:x,max:w}}}return r}class dh{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 $n,this.indexArray=new ni,this.indexArray2=new jt,this.programConfigurations=new zs(e.layers,e.zoom),this.segments=new ti,this.segments2=new ti,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=hh("fill",this.layers,r);const l=this.layers[0].layout.get("fill-sort-key"),d=!l.isConstant(),p=[];for(const{feature:f,id:g,index:x,sourceLayerIndex:w}of e){const I=this.layers[0]._featureFilter.needGeometry,A=Ls(f,I);if(!this.layers[0]._featureFilter.filter(new kt(this.zoom),A,s))continue;const M=d?l.evaluate(A,{},s,r.availableImages):void 0,L={id:g,properties:f.properties,type:f.type,sourceLayerIndex:w,index:x,geometry:I?A.geometry:Ds(f),patterns:{},sortKey:M};p.push(L)}d&&p.sort((f,g)=>f.sortKey-g.sortKey);for(const f of p){const{geometry:g,index:x,sourceLayerIndex:w}=f;if(this.hasPattern){const I=uh("fill",this.layers,f,this.zoom,r);this.patternFeatures.push(I)}else this.addFeature(f,g,x,s,{});r.featureIndex.insert(e[x].feature,g,x,w,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}addFeatures(e,r,s){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,vg),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,s,l,d){for(const p of Ys(r,500)){let f=0;for(const M of p)f+=M.length;const g=this.segments.prepareSegment(f,this.layoutVertexArray,this.indexArray),x=g.vertexLength,w=[],I=[];for(const M of p){if(M.length===0)continue;M!==p[0]&&I.push(w.length/2);const L=this.segments2.prepareSegment(M.length,this.layoutVertexArray,this.indexArray2),F=L.vertexLength;this.layoutVertexArray.emplaceBack(M[0].x,M[0].y),this.indexArray2.emplaceBack(F+M.length-1,F),w.push(M[0].x),w.push(M[0].y);for(let U=1;U<M.length;U++)this.layoutVertexArray.emplaceBack(M[U].x,M[U].y),this.indexArray2.emplaceBack(F+U-1,F+U),w.push(M[U].x),w.push(M[U].y);L.vertexLength+=M.length,L.primitiveLength+=M.length}const A=Xu(w,I);for(let M=0;M<A.length;M+=3)this.indexArray.emplaceBack(x+A[M],x+A[M+1],x+A[M+2]);g.vertexLength+=f,g.primitiveLength+=A.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,d,l)}}let Qu,ed;Fe("FillBucket",dh,{omit:["layers","patternFeatures"]});var kg={get paint(){return ed=ed||new o({"fill-antialias":new qe(ue.paint_fill["fill-antialias"]),"fill-opacity":new Je(ue.paint_fill["fill-opacity"]),"fill-color":new Je(ue.paint_fill["fill-color"]),"fill-outline-color":new Je(ue.paint_fill["fill-outline-color"]),"fill-translate":new qe(ue.paint_fill["fill-translate"]),"fill-translate-anchor":new qe(ue.paint_fill["fill-translate-anchor"]),"fill-pattern":new h(ue.paint_fill["fill-pattern"])})},get layout(){return Qu=Qu||new o({"fill-sort-key":new Je(ue.layout_fill["fill-sort-key"])})}};class Mg extends c{constructor(e){super(e,kg)}recalculate(e,r){super.recalculate(e,r);const s=this.paint._values["fill-outline-color"];s.value.kind==="constant"&&s.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new dh(e)}queryRadius(){return Jl(this.paint.get("fill-translate"))}queryIntersectsFeature(e,r,s,l,d,p,f){return Bu(Kl(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),p.angle,f),l)}isTileClipped(){return!0}}const zg=b([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Dg=b([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Lg}=zg;var Xn={},Rg=xe,td=Eo;function Eo(i,e,r,s,l){this.properties={},this.extent=r,this.type=0,this._pbf=i,this._geometry=-1,this._keys=s,this._values=l,i.readFields(Bg,this,e)}function Bg(i,e,r){i==1?e.id=r.readVarint():i==2?function(s,l){for(var d=s.readVarint()+s.pos;s.pos<d;){var p=l._keys[s.readVarint()],f=l._values[s.readVarint()];l.properties[p]=f}}(r,e):i==3?e.type=r.readVarint():i==4&&(e._geometry=r.pos)}function Fg(i){for(var e,r,s=0,l=0,d=i.length,p=d-1;l<d;p=l++)s+=((r=i[p]).x-(e=i[l]).x)*(e.y+r.y);return s}Eo.types=["Unknown","Point","LineString","Polygon"],Eo.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var e,r=i.readVarint()+i.pos,s=1,l=0,d=0,p=0,f=[];i.pos<r;){if(l<=0){var g=i.readVarint();s=7&g,l=g>>3}if(l--,s===1||s===2)d+=i.readSVarint(),p+=i.readSVarint(),s===1&&(e&&f.push(e),e=[]),e.push(new Rg(d,p));else{if(s!==7)throw new Error("unknown command "+s);e&&e.push(e[0].clone())}}return e&&f.push(e),f},Eo.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,s=0,l=0,d=0,p=1/0,f=-1/0,g=1/0,x=-1/0;i.pos<e;){if(s<=0){var w=i.readVarint();r=7&w,s=w>>3}if(s--,r===1||r===2)(l+=i.readSVarint())<p&&(p=l),l>f&&(f=l),(d+=i.readSVarint())<g&&(g=d),d>x&&(x=d);else if(r!==7)throw new Error("unknown command "+r)}return[p,g,f,x]},Eo.prototype.toGeoJSON=function(i,e,r){var s,l,d=this.extent*Math.pow(2,r),p=this.extent*i,f=this.extent*e,g=this.loadGeometry(),x=Eo.types[this.type];function w(M){for(var L=0;L<M.length;L++){var F=M[L];M[L]=[360*(F.x+p)/d-180,360/Math.PI*Math.atan(Math.exp((180-360*(F.y+f)/d)*Math.PI/180))-90]}}switch(this.type){case 1:var I=[];for(s=0;s<g.length;s++)I[s]=g[s][0];w(g=I);break;case 2:for(s=0;s<g.length;s++)w(g[s]);break;case 3:for(g=function(M){var L=M.length;if(L<=1)return[M];for(var F,U,X=[],se=0;se<L;se++){var K=Fg(M[se]);K!==0&&(U===void 0&&(U=K<0),U===K<0?(F&&X.push(F),F=[M[se]]):F.push(M[se]))}return F&&X.push(F),X}(g),s=0;s<g.length;s++)for(l=0;l<g[s].length;l++)w(g[s][l])}g.length===1?g=g[0]:x="Multi"+x;var A={type:"Feature",geometry:{type:x,coordinates:g},properties:this.properties};return"id"in this&&(A.id=this.id),A};var Og=td,id=rd;function rd(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(Vg,this,e),this.length=this._features.length}function Vg(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(s){for(var l=null,d=s.readVarint()+s.pos;s.pos<d;){var p=s.readVarint()>>3;l=p===1?s.readString():p===2?s.readFloat():p===3?s.readDouble():p===4?s.readVarint64():p===5?s.readVarint():p===6?s.readSVarint():p===7?s.readBoolean():null}return l}(r))}rd.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 Og(this._pbf,e,this.extent,this._keys,this._values)};var Ng=id;function jg(i,e,r){if(i===3){var s=new Ng(r,r.readVarint()+r.pos);s.length&&(e[s.name]=s)}}Xn.VectorTile=function(i,e){this.layers=i.readFields(jg,{},e)},Xn.VectorTileFeature=td,Xn.VectorTileLayer=id;const Ug=Xn.VectorTileFeature.types,ph=Math.pow(2,13);function Za(i,e,r,s,l,d,p,f){i.emplaceBack(e,r,2*Math.floor(s*ph)+p,l*ph*2,d*ph*2,Math.round(f))}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 vn,this.centroidVertexArray=new xn,this.indexArray=new ni,this.programConfigurations=new zs(e.layers,e.zoom),this.segments=new ti,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.features=[],this.hasPattern=hh("fill-extrusion",this.layers,r);for(const{feature:l,id:d,index:p,sourceLayerIndex:f}of e){const g=this.layers[0]._featureFilter.needGeometry,x=Ls(l,g);if(!this.layers[0]._featureFilter.filter(new kt(this.zoom),x,s))continue;const w={id:d,sourceLayerIndex:f,index:p,geometry:g?x.geometry:Ds(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(uh("fill-extrusion",this.layers,w,this.zoom,r)):this.addFeature(w,w.geometry,p,s,{}),r.featureIndex.insert(l,w.geometry,p,f,this.index,!0)}}addFeatures(e,r,s){for(const l of this.features){const{geometry:d}=l;this.addFeature(l,d,l.index,r,s)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}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,Lg),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Dg.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,s,l,d){for(const p of Ys(r,500)){const f={x:0,y:0,vertexCount:0};let g=0;for(const L of p)g+=L.length;let x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const L of p){if(L.length===0||qg(L))continue;let F=0;for(let U=0;U<L.length;U++){const X=L[U];if(U>=1){const se=L[U-1];if(!$g(X,se)){x.vertexLength+4>ti.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const K=X.sub(se)._perp()._unit(),ie=se.dist(X);F+ie>32768&&(F=0),Za(this.layoutVertexArray,X.x,X.y,K.x,K.y,0,0,F),Za(this.layoutVertexArray,X.x,X.y,K.x,K.y,0,1,F),f.x+=2*X.x,f.y+=2*X.y,f.vertexCount+=2,F+=ie,Za(this.layoutVertexArray,se.x,se.y,K.x,K.y,0,0,F),Za(this.layoutVertexArray,se.x,se.y,K.x,K.y,0,1,F),f.x+=2*se.x,f.y+=2*se.y,f.vertexCount+=2;const de=x.vertexLength;this.indexArray.emplaceBack(de,de+2,de+1),this.indexArray.emplaceBack(de+1,de+2,de+3),x.vertexLength+=4,x.primitiveLength+=2}}}}if(x.vertexLength+g>ti.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(g,this.layoutVertexArray,this.indexArray)),Ug[e.type]!=="Polygon")continue;const w=[],I=[],A=x.vertexLength;for(const L of p)if(L.length!==0){L!==p[0]&&I.push(w.length/2);for(let F=0;F<L.length;F++){const U=L[F];Za(this.layoutVertexArray,U.x,U.y,0,0,1,1,0),f.x+=U.x,f.y+=U.y,f.vertexCount+=1,w.push(U.x),w.push(U.y)}}const M=Xu(w,I);for(let L=0;L<M.length;L+=3)this.indexArray.emplaceBack(A+M[L],A+M[L+2],A+M[L+1]);x.primitiveLength+=M.length/3,x.vertexLength+=g;for(let L=0;L<f.vertexCount;L++){const F=Math.floor(f.x/f.vertexCount),U=Math.floor(f.y/f.vertexCount);this.centroidVertexArray.emplaceBack(F,U)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,d,l)}}function $g(i,e){return i.x===e.x&&(i.x<0||i.x>Qt)||i.y===e.y&&(i.y<0||i.y>Qt)}function qg(i){return i.every(e=>e.x<0)||i.every(e=>e.x>Qt)||i.every(e=>e.y<0)||i.every(e=>e.y>Qt)}let nd;Fe("FillExtrusionBucket",fh,{omit:["layers","features"]});var Zg={get paint(){return nd=nd||new o({"fill-extrusion-opacity":new qe(ue["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Je(ue["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new qe(ue["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new qe(ue["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new h(ue["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Je(ue["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Je(ue["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new qe(ue["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Gg extends c{constructor(e){super(e,Zg)}createBucket(e){return new fh(e)}queryRadius(){return Jl(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,r,s,l,d,p,f,g){const x=Kl(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),p.angle,f),w=this.paint.get("fill-extrusion-height").evaluate(r,s),I=this.paint.get("fill-extrusion-base").evaluate(r,s),A=function(L,F,U,X){const se=[];for(const K of L){const ie=[K.x,K.y,0,1];Yl(ie,ie,F),se.push(new he(ie[0]/ie[3],ie[1]/ie[3]))}return se}(x,g),M=function(L,F,U,X){const se=[],K=[],ie=X[8]*F,de=X[9]*F,ye=X[10]*F,Le=X[11]*F,Xe=X[8]*U,Me=X[9]*U,Ce=X[10]*U,$e=X[11]*U;for(const Ve of L){const Be=[],me=[];for(const Ze of Ve){const Ue=Ze.x,et=Ze.y,Pt=X[0]*Ue+X[4]*et+X[12],It=X[1]*Ue+X[5]*et+X[13],si=X[2]*Ue+X[6]*et+X[14],Sr=X[3]*Ue+X[7]*et+X[15],xi=si+ye,Gt=Sr+Le,Di=Pt+Xe,Li=It+Me,Ri=si+Ce,Ht=Sr+$e,oi=new he((Pt+ie)/Gt,(It+de)/Gt);oi.z=xi/Gt,Be.push(oi);const Pi=new he(Di/Ht,Li/Ht);Pi.z=Ri/Ht,me.push(Pi)}se.push(Be),K.push(me)}return[se,K]}(l,I,w,g);return function(L,F,U){let X=1/0;Bu(U,F)&&(X=sd(U,F[0]));for(let se=0;se<F.length;se++){const K=F[se],ie=L[se];for(let de=0;de<K.length-1;de++){const ye=K[de],Le=[ye,K[de+1],ie[de+1],ie[de],ye];Ru(U,Le)&&(X=Math.min(X,sd(U,Le)))}}return X!==1/0&&X}(M[0],M[1],A)}}function Ga(i,e){return i.x*e.x+i.y*e.y}function sd(i,e){if(i.length===1){let r=0;const s=e[r++];let l;for(;!l||s.equals(l);)if(l=e[r++],!l)return 1/0;for(;r<e.length;r++){const d=e[r],p=i[0],f=l.sub(s),g=d.sub(s),x=p.sub(s),w=Ga(f,f),I=Ga(f,g),A=Ga(g,g),M=Ga(x,f),L=Ga(x,g),F=w*A-I*I,U=(A*M-I*L)/F,X=(w*L-I*M)/F,se=s.z*(1-U-X)+l.z*U+d.z*X;if(isFinite(se))return se}return 1/0}{let r=1/0;for(const s of e)r=Math.min(r,s.z);return r}}const Hg=b([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Xg}=Hg,Wg=b([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Jg}=Wg,Kg=Xn.VectorTileFeature.types,Yg=Math.cos(Math.PI/180*37.5),od=Math.pow(2,14)/.5;class mh{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 xo,this.layoutVertexArray2=new Da,this.indexArray=new ni,this.programConfigurations=new zs(e.layers,e.zoom),this.segments=new ti,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=hh("line",this.layers,r);const l=this.layers[0].layout.get("line-sort-key"),d=!l.isConstant(),p=[];for(const{feature:f,id:g,index:x,sourceLayerIndex:w}of e){const I=this.layers[0]._featureFilter.needGeometry,A=Ls(f,I);if(!this.layers[0]._featureFilter.filter(new kt(this.zoom),A,s))continue;const M=d?l.evaluate(A,{},s):void 0,L={id:g,properties:f.properties,type:f.type,sourceLayerIndex:w,index:x,geometry:I?A.geometry:Ds(f),patterns:{},sortKey:M};p.push(L)}d&&p.sort((f,g)=>f.sortKey-g.sortKey);for(const f of p){const{geometry:g,index:x,sourceLayerIndex:w}=f;if(this.hasPattern){const I=uh("line",this.layers,f,this.zoom,r);this.patternFeatures.push(I)}else this.addFeature(f,g,x,s,{});r.featureIndex.insert(e[x].feature,g,x,w,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}addFeatures(e,r,s){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,s)}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,Jg)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Xg),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,s,l,d){const p=this.layers[0].layout,f=p.get("line-join").evaluate(e,{}),g=p.get("line-cap"),x=p.get("line-miter-limit"),w=p.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const I of r)this.addLine(I,e,f,g,x,w);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,d,l)}addLine(e,r,s,l,d,p){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let X=0;X<e.length-1;X++)this.totalDistance+=e[X].dist(e[X+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const f=Kg[r.type]==="Polygon";let g=e.length;for(;g>=2&&e[g-1].equals(e[g-2]);)g--;let x=0;for(;x<g-1&&e[x].equals(e[x+1]);)x++;if(g<(f?3:2))return;s==="bevel"&&(d=1.05);const w=this.overscaling<=16?15*Qt/(512*this.overscaling):0,I=this.segments.prepareSegment(10*g,this.layoutVertexArray,this.indexArray);let A,M,L,F,U;this.e1=this.e2=-1,f&&(A=e[g-2],U=e[x].sub(A)._unit()._perp());for(let X=x;X<g;X++){if(L=X===g-1?f?e[x+1]:void 0:e[X+1],L&&e[X].equals(L))continue;U&&(F=U),A&&(M=A),A=e[X],U=L?L.sub(A)._unit()._perp():F,F=F||U;let se=F.add(U);se.x===0&&se.y===0||se._unit();const K=F.x*U.x+F.y*U.y,ie=se.x*U.x+se.y*U.y,de=ie!==0?1/ie:1/0,ye=2*Math.sqrt(2-2*ie),Le=ie<Yg&&M&&L,Xe=F.x*U.y-F.y*U.x>0;if(Le&&X>x){const $e=A.dist(M);if($e>2*w){const Ve=A.sub(A.sub(M)._mult(w/$e)._round());this.updateDistance(M,Ve),this.addCurrentVertex(Ve,F,0,0,I),M=Ve}}const Me=M&&L;let Ce=Me?s:f?"butt":l;if(Me&&Ce==="round"&&(de<p?Ce="miter":de<=2&&(Ce="fakeround")),Ce==="miter"&&de>d&&(Ce="bevel"),Ce==="bevel"&&(de>2&&(Ce="flipbevel"),de<d&&(Ce="miter")),M&&this.updateDistance(M,A),Ce==="miter")se._mult(de),this.addCurrentVertex(A,se,0,0,I);else if(Ce==="flipbevel"){if(de>100)se=U.mult(-1);else{const $e=de*F.add(U).mag()/F.sub(U).mag();se._perp()._mult($e*(Xe?-1:1))}this.addCurrentVertex(A,se,0,0,I),this.addCurrentVertex(A,se.mult(-1),0,0,I)}else if(Ce==="bevel"||Ce==="fakeround"){const $e=-Math.sqrt(de*de-1),Ve=Xe?$e:0,Be=Xe?0:$e;if(M&&this.addCurrentVertex(A,F,Ve,Be,I),Ce==="fakeround"){const me=Math.round(180*ye/Math.PI/20);for(let Ze=1;Ze<me;Ze++){let Ue=Ze/me;if(Ue!==.5){const Pt=Ue-.5;Ue+=Ue*Pt*(Ue-1)*((1.0904+K*(K*(3.55645-1.43519*K)-3.2452))*Pt*Pt+(.848013+K*(.215638*K-1.06021)))}const et=U.sub(F)._mult(Ue)._add(F)._unit()._mult(Xe?-1:1);this.addHalfVertex(A,et.x,et.y,!1,Xe,0,I)}}L&&this.addCurrentVertex(A,U,-Ve,-Be,I)}else if(Ce==="butt")this.addCurrentVertex(A,se,0,0,I);else if(Ce==="square"){const $e=M?1:-1;this.addCurrentVertex(A,se,$e,$e,I)}else Ce==="round"&&(M&&(this.addCurrentVertex(A,F,0,0,I),this.addCurrentVertex(A,F,1,1,I,!0)),L&&(this.addCurrentVertex(A,U,-1,-1,I,!0),this.addCurrentVertex(A,U,0,0,I)));if(Le&&X<g-1){const $e=A.dist(L);if($e>2*w){const Ve=A.add(L.sub(A)._mult(w/$e)._round());this.updateDistance(A,Ve),this.addCurrentVertex(Ve,U,0,0,I),A=Ve}}}}addCurrentVertex(e,r,s,l,d,p=!1){const f=r.y*l-r.x,g=-r.y-r.x*l;this.addHalfVertex(e,r.x+r.y*s,r.y-r.x*s,p,!1,s,d),this.addHalfVertex(e,f,g,p,!0,-l,d),this.distance>od/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,r,s,l,d,p))}addHalfVertex({x:e,y:r},s,l,d,p,f,g){const x=.5*(this.lineClips?this.scaledDistance*(od-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(d?1:0),(r<<1)+(p?1:0),Math.round(63*s)+128,Math.round(63*l)+128,1+(f===0?0:f<0?-1:1)|(63&x)<<2,x>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const w=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,w),g.primitiveLength++),p?this.e2=w:this.e1=w}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 ad,ld;Fe("LineBucket",mh,{omit:["layers","patternFeatures"]});var cd={get paint(){return ld=ld||new o({"line-opacity":new Je(ue.paint_line["line-opacity"]),"line-color":new Je(ue.paint_line["line-color"]),"line-translate":new qe(ue.paint_line["line-translate"]),"line-translate-anchor":new qe(ue.paint_line["line-translate-anchor"]),"line-width":new Je(ue.paint_line["line-width"]),"line-gap-width":new Je(ue.paint_line["line-gap-width"]),"line-offset":new Je(ue.paint_line["line-offset"]),"line-blur":new Je(ue.paint_line["line-blur"]),"line-dasharray":new t(ue.paint_line["line-dasharray"]),"line-pattern":new h(ue.paint_line["line-pattern"]),"line-gradient":new n(ue.paint_line["line-gradient"])})},get layout(){return ad=ad||new o({"line-cap":new qe(ue.layout_line["line-cap"]),"line-join":new Je(ue.layout_line["line-join"]),"line-miter-limit":new qe(ue.layout_line["line-miter-limit"]),"line-round-limit":new qe(ue.layout_line["line-round-limit"]),"line-sort-key":new Je(ue.layout_line["line-sort-key"])})}};class Qg extends Je{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,s,l){return r=St({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,s,l)}}let ic;class e_ extends c{constructor(e){super(e,cd),this.gradientVersion=0,ic||(ic=new Qg(cd.paint.properties["line-width"].specification),ic.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){const r=this.gradientExpression();this.stepInterpolant=!!function(s){return s._styleExpression!==void 0}(r)&&r._styleExpression.expression instanceof zn,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"]=ic.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new mh(e)}queryRadius(e){const r=e,s=hd(Va("line-width",this,r),Va("line-gap-width",this,r)),l=Va("line-offset",this,r);return s/2+Math.abs(l)+Jl(this.paint.get("line-translate"))}queryIntersectsFeature(e,r,s,l,d,p,f){const g=Kl(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),p.angle,f),x=f/2*hd(this.paint.get("line-width").evaluate(r,s),this.paint.get("line-gap-width").evaluate(r,s)),w=this.paint.get("line-offset").evaluate(r,s);return w&&(l=function(I,A){const M=[];for(let L=0;L<I.length;L++){const F=I[L],U=[];for(let X=0;X<F.length;X++){const se=F[X-1],K=F[X],ie=F[X+1],de=X===0?new he(0,0):K.sub(se)._unit()._perp(),ye=X===F.length-1?new he(0,0):ie.sub(K)._unit()._perp(),Le=de._add(ye)._unit(),Xe=Le.x*ye.x+Le.y*ye.y;Xe!==0&&Le._mult(1/Xe),U.push(Le._mult(A)._add(K))}M.push(U)}return M}(l,w*f)),function(I,A,M){for(let L=0;L<A.length;L++){const F=A[L];if(I.length>=3){for(let U=0;U<F.length;U++)if(To(I,F[U]))return!0}if(cg(I,F,M))return!0}return!1}(g,l,x)}isTileClipped(){return!0}}function hd(i,e){return e>0?e+2*i:i}const t_=b([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),i_=b([{name:"a_projected_pos",components:3,type:"Float32"}],4);b([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const r_=b([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);b([{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 ud=b([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),n_=b([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function s_(i,e,r){return i.sections.forEach(s=>{s.text=function(l,d,p){const f=d.layout.get("text-transform").evaluate(p,{});return f==="uppercase"?l=l.toLocaleUpperCase():f==="lowercase"&&(l=l.toLocaleLowerCase()),Jr.applyArabicShaping&&(l=Jr.applyArabicShaping(l)),l}(s.text,e,r)}),i}b([{name:"triangle",components:3,type:"Uint16"}]),b([{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"}]),b([{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"}]),b([{type:"Float32",name:"offsetX"}]),b([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),b([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Ha={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var ii=24,dd=Tt,pd=function(i,e,r,s,l){var d,p,f=8*l-s-1,g=(1<<f)-1,x=g>>1,w=-7,I=l-1,A=-1,M=i[e+I];for(I+=A,d=M&(1<<-w)-1,M>>=-w,w+=f;w>0;d=256*d+i[e+I],I+=A,w-=8);for(p=d&(1<<-w)-1,d>>=-w,w+=s;w>0;p=256*p+i[e+I],I+=A,w-=8);if(d===0)d=1-x;else{if(d===g)return p?NaN:1/0*(M?-1:1);p+=Math.pow(2,s),d-=x}return(M?-1:1)*p*Math.pow(2,d-s)},fd=function(i,e,r,s,l,d){var p,f,g,x=8*d-l-1,w=(1<<x)-1,I=w>>1,A=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=0,L=1,F=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,p=w):(p=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-p))<1&&(p--,g*=2),(e+=p+I>=1?A/g:A*Math.pow(2,1-I))*g>=2&&(p++,g/=2),p+I>=w?(f=0,p=w):p+I>=1?(f=(e*g-1)*Math.pow(2,l),p+=I):(f=e*Math.pow(2,I-1)*Math.pow(2,l),p=0));l>=8;i[r+M]=255&f,M+=L,f/=256,l-=8);for(p=p<<l|f,x+=l;x>0;i[r+M]=255&p,M+=L,p/=256,x-=8);i[r+M-L]|=128*F};function Tt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}Tt.Varint=0,Tt.Fixed64=1,Tt.Bytes=2,Tt.Fixed32=5;var gh=4294967296,md=1/gh,gd=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function wn(i){return i.type===Tt.Bytes?i.readVarint()+i.pos:i.pos+1}function Ao(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function _d(i,e,r){var s=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(s);for(var l=r.pos-1;l>=i;l--)r.buf[l+s]=r.buf[l]}function o_(i,e){for(var r=0;r<i.length;r++)e.writeVarint(i[r])}function a_(i,e){for(var r=0;r<i.length;r++)e.writeSVarint(i[r])}function l_(i,e){for(var r=0;r<i.length;r++)e.writeFloat(i[r])}function c_(i,e){for(var r=0;r<i.length;r++)e.writeDouble(i[r])}function h_(i,e){for(var r=0;r<i.length;r++)e.writeBoolean(i[r])}function u_(i,e){for(var r=0;r<i.length;r++)e.writeFixed32(i[r])}function d_(i,e){for(var r=0;r<i.length;r++)e.writeSFixed32(i[r])}function p_(i,e){for(var r=0;r<i.length;r++)e.writeFixed64(i[r])}function f_(i,e){for(var r=0;r<i.length;r++)e.writeSFixed64(i[r])}function rc(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+16777216*i[e+3]}function Co(i,e,r){i[r]=e,i[r+1]=e>>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function yd(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}Tt.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos<r;){var s=this.readVarint(),l=s>>3,d=this.pos;this.type=7&s,i(l,e,this),this.pos===d&&this.skip(s)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=rc(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=yd(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=rc(this.buf,this.pos)+rc(this.buf,this.pos+4)*gh;return this.pos+=8,i},readSFixed64:function(){var i=rc(this.buf,this.pos)+yd(this.buf,this.pos+4)*gh;return this.pos+=8,i},readFloat:function(){var i=pd(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=pd(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,s=this.buf;return e=127&(r=s[this.pos++]),r<128?e:(e|=(127&(r=s[this.pos++]))<<7,r<128?e:(e|=(127&(r=s[this.pos++]))<<14,r<128?e:(e|=(127&(r=s[this.pos++]))<<21,r<128?e:function(l,d,p){var f,g,x=p.buf;if(f=(112&(g=x[p.pos++]))>>4,g<128||(f|=(127&(g=x[p.pos++]))<<3,g<128)||(f|=(127&(g=x[p.pos++]))<<10,g<128)||(f|=(127&(g=x[p.pos++]))<<17,g<128)||(f|=(127&(g=x[p.pos++]))<<24,g<128)||(f|=(1&(g=x[p.pos++]))<<31,g<128))return Ao(l,f,d);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=s[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&&gd?function(r,s,l){return gd.decode(r.subarray(s,l))}(this.buf,e,i):function(r,s,l){for(var d="",p=s;p<l;){var f,g,x,w=r[p],I=null,A=w>239?4:w>223?3:w>191?2:1;if(p+A>l)break;A===1?w<128&&(I=w):A===2?(192&(f=r[p+1]))==128&&(I=(31&w)<<6|63&f)<=127&&(I=null):A===3?(g=r[p+2],(192&(f=r[p+1]))==128&&(192&g)==128&&((I=(15&w)<<12|(63&f)<<6|63&g)<=2047||I>=55296&&I<=57343)&&(I=null)):A===4&&(g=r[p+2],x=r[p+3],(192&(f=r[p+1]))==128&&(192&g)==128&&(192&x)==128&&((I=(15&w)<<18|(63&f)<<12|(63&g)<<6|63&x)<=65535||I>=1114112)&&(I=null)),I===null?(I=65533,A=1):I>65535&&(I-=65536,d+=String.fromCharCode(I>>>10&1023|55296),I=56320|1023&I),d+=String.fromCharCode(I),p+=A}return d}(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!==Tt.Bytes)return i.push(this.readVarint(e));var r=wn(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(e));return i},readPackedSVarint:function(i){if(this.type!==Tt.Bytes)return i.push(this.readSVarint());var e=wn(this);for(i=i||[];this.pos<e;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==Tt.Bytes)return i.push(this.readBoolean());var e=wn(this);for(i=i||[];this.pos<e;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==Tt.Bytes)return i.push(this.readFloat());var e=wn(this);for(i=i||[];this.pos<e;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==Tt.Bytes)return i.push(this.readDouble());var e=wn(this);for(i=i||[];this.pos<e;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==Tt.Bytes)return i.push(this.readFixed32());var e=wn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==Tt.Bytes)return i.push(this.readSFixed32());var e=wn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==Tt.Bytes)return i.push(this.readFixed64());var e=wn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==Tt.Bytes)return i.push(this.readSFixed64());var e=wn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed64());return i},skip:function(i){var e=7&i;if(e===Tt.Varint)for(;this.buf[this.pos++]>127;);else if(e===Tt.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Tt.Fixed32)this.pos+=4;else{if(e!==Tt.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),Co(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),Co(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),Co(this.buf,-1&i,this.pos),Co(this.buf,Math.floor(i*md),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),Co(this.buf,-1&i,this.pos),Co(this.buf,Math.floor(i*md),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?function(e,r){var s,l;if(e>=0?(s=e%4294967296|0,l=e/4294967296|0):(l=~(-e/4294967296),4294967295^(s=~(-e%4294967296))?s=s+1|0:(s=0,l=l+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(d,p,f){f.buf[f.pos++]=127&d|128,d>>>=7,f.buf[f.pos++]=127&d|128,d>>>=7,f.buf[f.pos++]=127&d|128,d>>>=7,f.buf[f.pos++]=127&d|128,f.buf[f.pos]=127&(d>>>=7)}(s,0,r),function(d,p){var f=(7&d)<<4;p.buf[p.pos++]|=f|((d>>>=3)?128:0),d&&(p.buf[p.pos++]=127&d|((d>>>=7)?128:0),d&&(p.buf[p.pos++]=127&d|((d>>>=7)?128:0),d&&(p.buf[p.pos++]=127&d|((d>>>=7)?128:0),d&&(p.buf[p.pos++]=127&d|((d>>>=7)?128:0),d&&(p.buf[p.pos++]=127&d)))))}(l,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(s,l,d){for(var p,f,g=0;g<l.length;g++){if((p=l.charCodeAt(g))>55295&&p<57344){if(!f){p>56319||g+1===l.length?(s[d++]=239,s[d++]=191,s[d++]=189):f=p;continue}if(p<56320){s[d++]=239,s[d++]=191,s[d++]=189,f=p;continue}p=f-55296<<10|p-56320|65536,f=null}else f&&(s[d++]=239,s[d++]=191,s[d++]=189,f=null);p<128?s[d++]=p:(p<2048?s[d++]=p>>6|192:(p<65536?s[d++]=p>>12|224:(s[d++]=p>>18|240,s[d++]=p>>12&63|128),s[d++]=p>>6&63|128),s[d++]=63&p|128)}return d}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&_d(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),fd(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),fd(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 s=this.pos-r;s>=128&&_d(r,s,this),this.pos=r-1,this.writeVarint(s),this.pos+=s},writeMessage:function(i,e,r){this.writeTag(i,Tt.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,o_,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,a_,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,h_,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,l_,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,c_,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,u_,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,d_,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,p_,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,f_,e)},writeBytesField:function(i,e){this.writeTag(i,Tt.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,Tt.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,Tt.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,Tt.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,Tt.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,Tt.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,Tt.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,Tt.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,Tt.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,Tt.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,!!e)}};var _h=Ie(dd);const yh=3;function m_(i,e,r){i===1&&r.readMessage(g_,e)}function g_(i,e,r){if(i===3){const{id:s,bitmap:l,width:d,height:p,left:f,top:g,advance:x}=r.readMessage(__,{});e.push({id:s,bitmap:new ja({width:d+2*yh,height:p+2*yh},l),metrics:{width:d,height:p,left:f,top:g,advance:x}})}}function __(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 xd=yh;function vd(i){let e=0,r=0;for(const p of i)e+=p.w*p.h,r=Math.max(r,p.w);i.sort((p,f)=>f.h-p.h);const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let l=0,d=0;for(const p of i)for(let f=s.length-1;f>=0;f--){const g=s[f];if(!(p.w>g.w||p.h>g.h)){if(p.x=g.x,p.y=g.y,d=Math.max(d,p.y+p.h),l=Math.max(l,p.x+p.w),p.w===g.w&&p.h===g.h){const x=s.pop();f<s.length&&(s[f]=x)}else p.h===g.h?(g.x+=p.w,g.w-=p.w):p.w===g.w?(g.y+=p.h,g.h-=p.h):(s.push({x:g.x+p.w,y:g.y,w:g.w-p.w,h:p.h}),g.y+=p.h,g.h-=p.h);break}}return{w:l,h:d,fill:e/(l*d)||0}}const qi=1;class xh{constructor(e,{pixelRatio:r,version:s,stretchX:l,stretchY:d,content:p,textFitWidth:f,textFitHeight:g}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=l,this.stretchY=d,this.content=p,this.version=s,this.textFitWidth=f,this.textFitHeight=g}get tl(){return[this.paddedRect.x+qi,this.paddedRect.y+qi]}get br(){return[this.paddedRect.x+this.paddedRect.w-qi,this.paddedRect.y+this.paddedRect.h-qi]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*qi)/this.pixelRatio,(this.paddedRect.h-2*qi)/this.pixelRatio]}}class bd{constructor(e,r){const s={},l={};this.haveRenderCallbacks=[];const d=[];this.addImages(e,s,d),this.addImages(r,l,d);const{w:p,h:f}=vd(d),g=new lr({width:p||1,height:f||1});for(const x in e){const w=e[x],I=s[x].paddedRect;lr.copy(w.data,g,{x:0,y:0},{x:I.x+qi,y:I.y+qi},w.data)}for(const x in r){const w=r[x],I=l[x].paddedRect,A=I.x+qi,M=I.y+qi,L=w.data.width,F=w.data.height;lr.copy(w.data,g,{x:0,y:0},{x:A,y:M},w.data),lr.copy(w.data,g,{x:0,y:F-1},{x:A,y:M-1},{width:L,height:1}),lr.copy(w.data,g,{x:0,y:0},{x:A,y:M+F},{width:L,height:1}),lr.copy(w.data,g,{x:L-1,y:0},{x:A-1,y:M},{width:1,height:F}),lr.copy(w.data,g,{x:0,y:0},{x:A+L,y:M},{width:1,height:F})}this.image=g,this.iconPositions=s,this.patternPositions=l}addImages(e,r,s){for(const l in e){const d=e[l],p={x:0,y:0,w:d.data.width+2*qi,h:d.data.height+2*qi};s.push(p),r[l]=new xh(p,d),d.hasRenderCallback&&this.haveRenderCallbacks.push(l)}}patchUpdatedImages(e,r){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const s in e.updatedImages)this.patchUpdatedImage(this.iconPositions[s],e.getImage(s),r),this.patchUpdatedImage(this.patternPositions[s],e.getImage(s),r)}patchUpdatedImage(e,r,s){if(!e||!r||e.version===r.version)return;e.version=r.version;const[l,d]=e.tl;s.update(r.data,void 0,{x:l,y:d})}}var Wn;Fe("ImagePosition",xh),Fe("ImageAtlas",bd),S.ai=void 0,(Wn=S.ai||(S.ai={}))[Wn.none=0]="none",Wn[Wn.horizontal=1]="horizontal",Wn[Wn.vertical=2]="vertical",Wn[Wn.horizontalOnly=3]="horizontalOnly";const Xa=-17;class Wa{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){const s=new Wa;return s.scale=e||1,s.fontStack=r,s}static forImage(e){const r=new Wa;return r.imageName=e,r}}class ko{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){const s=new ko;for(let l=0;l<e.sections.length;l++){const d=e.sections[l];d.image?s.addImageSection(d):s.addTextSection(d,r)}return s}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 s=0;s<e.length;s++){const l=e.charCodeAt(s+1)||null,d=e.charCodeAt(s-1)||null;r+=l&&Ul(l)&&!Ha[e[s+1]]||d&&Ul(d)&&!Ha[e[s-1]]||!Ha[e[s]]?e[s]:Ha[e[s]]}return r}(this.text)}trim(){let e=0;for(let s=0;s<this.text.length&&sc[this.text.charCodeAt(s)];s++)e++;let r=this.text.length;for(let s=this.text.length-1;s>=0&&s>=e&&sc[this.text.charCodeAt(s)];s--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const s=new ko;return s.text=this.text.substring(e,r),s.sectionIndex=this.sectionIndex.slice(e,r),s.sections=this.sections,s}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(Wa.forText(e.scale,e.fontStack||r));const s=this.sections.length-1;for(let l=0;l<e.text.length;++l)this.sectionIndex.push(s)}addImageSection(e){const r=e.image?e.image.name:"";if(r.length===0)return void ci("Can't add FormattedSection with an empty image.");const s=this.getNextImageSectionCharCode();s?(this.text+=String.fromCharCode(s),this.sections.push(Wa.forImage(r)),this.sectionIndex.push(this.sections.length-1)):ci("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function nc(i,e,r,s,l,d,p,f,g,x,w,I,A,M,L){const F=ko.fromFeature(i,l);let U;I===S.ai.vertical&&F.verticalizePunctuation();const{processBidirectionalText:X,processStyledBidirectionalText:se}=Jr;if(X&&F.sections.length===1){U=[];const de=X(F.toString(),vh(F,x,d,e,s,M));for(const ye of de){const Le=new ko;Le.text=ye,Le.sections=F.sections;for(let Xe=0;Xe<ye.length;Xe++)Le.sectionIndex.push(0);U.push(Le)}}else if(se){U=[];const de=se(F.text,F.sectionIndex,vh(F,x,d,e,s,M));for(const ye of de){const Le=new ko;Le.text=ye[0],Le.sectionIndex=ye[1],Le.sections=F.sections,U.push(Le)}}else U=function(de,ye){const Le=[],Xe=de.text;let Me=0;for(const Ce of ye)Le.push(de.substring(Me,Ce)),Me=Ce;return Me<Xe.length&&Le.push(de.substring(Me,Xe.length)),Le}(F,vh(F,x,d,e,s,M));const K=[],ie={positionedLines:K,text:F.toString(),top:w[1],bottom:w[1],left:w[0],right:w[0],writingMode:I,iconsInText:!1,verticalizable:!1};return function(de,ye,Le,Xe,Me,Ce,$e,Ve,Be,me,Ze,Ue){let et=0,Pt=Xa,It=0,si=0;const Sr=Ve==="right"?1:Ve==="left"?0:.5;let xi=0;for(const Ht of Me){Ht.trim();const oi=Ht.getMaxScale(),Pi=(oi-1)*ii,vi={positionedGlyphs:[],lineOffset:0};de.positionedLines[xi]=vi;const Bi=vi.positionedGlyphs;let bi=0;if(!Ht.length()){Pt+=Ce,++xi;continue}for(let Zi=0;Zi<Ht.length();Zi++){const gt=Ht.getSection(Zi),Mt=Ht.getSectionIndex(Zi),Ot=Ht.getCharCode(Zi);let Ji=0,Zt=null,Lo=null,en=null,tn=ii;const Tr=!(Be===S.ai.horizontal||!Ze&&!ka(Ot)||Ze&&(sc[Ot]||(Gt=Ot,ze.Arabic(Gt)||ze["Arabic Supplement"](Gt)||ze["Arabic Extended-A"](Gt)||ze["Arabic Presentation Forms-A"](Gt)||ze["Arabic Presentation Forms-B"](Gt))));if(gt.imageName){const ur=Xe[gt.imageName];if(!ur)continue;en=gt.imageName,de.iconsInText=de.iconsInText||!0,Lo=ur.paddedRect;const li=ur.displaySize;gt.scale=gt.scale*ii/Ue,Zt={width:li[0],height:li[1],left:qi,top:-xd,advance:Tr?li[1]:li[0]},Ji=Pi+(ii-li[1]*gt.scale),tn=Zt.advance;const Sn=Tr?li[0]*gt.scale-ii*oi:li[1]*gt.scale-ii*oi;Sn>0&&Sn>bi&&(bi=Sn)}else{const ur=Le[gt.fontStack],li=ur&&ur[Ot];if(li&&li.rect)Lo=li.rect,Zt=li.metrics;else{const Sn=ye[gt.fontStack],el=Sn&&Sn[Ot];if(!el)continue;Zt=el.metrics}Ji=(oi-gt.scale)*ii}Tr?(de.verticalizable=!0,Bi.push({glyph:Ot,imageName:en,x:et,y:Pt+Ji,vertical:Tr,scale:gt.scale,fontStack:gt.fontStack,sectionIndex:Mt,metrics:Zt,rect:Lo}),et+=tn*gt.scale+me):(Bi.push({glyph:Ot,imageName:en,x:et,y:Pt+Ji,vertical:Tr,scale:gt.scale,fontStack:gt.fontStack,sectionIndex:Mt,metrics:Zt,rect:Lo}),et+=Zt.advance*gt.scale+me)}Bi.length!==0&&(It=Math.max(et-me,It),b_(Bi,0,Bi.length-1,Sr,bi)),et=0;const hr=Ce*oi+bi;vi.lineOffset=Math.max(bi,Pi),Pt+=hr,si=Math.max(hr,si),++xi}var Gt;const Di=Pt-Xa,{horizontalAlign:Li,verticalAlign:Ri}=bh($e);(function(Ht,oi,Pi,vi,Bi,bi,hr,Zi,gt){const Mt=(oi-Pi)*Bi;let Ot=0;Ot=bi!==hr?-Zi*vi-Xa:(-vi*gt+.5)*hr;for(const Ji of Ht)for(const Zt of Ji.positionedGlyphs)Zt.x+=Mt,Zt.y+=Ot})(de.positionedLines,Sr,Li,Ri,It,si,Ce,Di,Me.length),de.top+=-Ri*Di,de.bottom=de.top+Di,de.left+=-Li*It,de.right=de.left+It}(ie,e,r,s,U,p,f,g,I,x,A,L),!function(de){for(const ye of de)if(ye.positionedGlyphs.length!==0)return!1;return!0}(K)&&ie}const sc={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},y_={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},x_={40:!0};function wd(i,e,r,s,l,d){if(e.imageName){const p=s[e.imageName];return p?p.displaySize[0]*e.scale*ii/d+l:0}{const p=r[e.fontStack],f=p&&p[i];return f?f.metrics.advance*e.scale+l:0}}function Sd(i,e,r,s){const l=Math.pow(i-e,2);return s?i<e?l/2:2*l:l+Math.abs(r)*r}function v_(i,e,r){let s=0;return i===10&&(s-=1e4),r&&(s+=150),i!==40&&i!==65288||(s+=50),e!==41&&e!==65289||(s+=50),s}function Td(i,e,r,s,l,d){let p=null,f=Sd(e,r,l,d);for(const g of s){const x=Sd(e-g.x,r,l,d)+g.badness;x<=f&&(p=g,f=x)}return{index:i,x:e,priorBreak:p,badness:f}}function Id(i){return i?Id(i.priorBreak).concat(i.index):[]}function vh(i,e,r,s,l,d){if(!i)return[];const p=[],f=function(I,A,M,L,F,U){let X=0;for(let se=0;se<I.length();se++){const K=I.getSection(se);X+=wd(I.getCharCode(se),K,L,F,A,U)}return X/Math.max(1,Math.ceil(X/M))}(i,e,r,s,l,d),g=i.text.indexOf("")>=0;let x=0;for(let I=0;I<i.length();I++){const A=i.getSection(I),M=i.getCharCode(I);if(sc[M]||(x+=wd(M,A,s,l,e,d)),I<i.length()-1){const L=!((w=M)<11904||!(ze["Bopomofo Extended"](w)||ze.Bopomofo(w)||ze["CJK Compatibility Forms"](w)||ze["CJK Compatibility Ideographs"](w)||ze["CJK Compatibility"](w)||ze["CJK Radicals Supplement"](w)||ze["CJK Strokes"](w)||ze["CJK Symbols and Punctuation"](w)||ze["CJK Unified Ideographs Extension A"](w)||ze["CJK Unified Ideographs"](w)||ze["Enclosed CJK Letters and Months"](w)||ze["Halfwidth and Fullwidth Forms"](w)||ze.Hiragana(w)||ze["Ideographic Description Characters"](w)||ze["Kangxi Radicals"](w)||ze["Katakana Phonetic Extensions"](w)||ze.Katakana(w)||ze["Vertical Forms"](w)||ze["Yi Radicals"](w)||ze["Yi Syllables"](w)));(y_[M]||L||A.imageName||I!==i.length()-2&&x_[i.getCharCode(I+1)])&&p.push(Td(I+1,x,f,p,v_(M,i.getCharCode(I+1),L&&g),!1))}}var w;return Id(Td(i.length(),x,f,p,0,!0))}function bh(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 b_(i,e,r,s,l){if(!s&&!l)return;const d=i[r],p=(i[r].x+d.metrics.advance*d.scale)*s;for(let f=e;f<=r;f++)i[f].x-=p,i[f].y+=l}function w_(i,e,r){const{horizontalAlign:s,verticalAlign:l}=bh(r),d=e[0]-i.displaySize[0]*s,p=e[1]-i.displaySize[1]*l;return{image:i,top:p,bottom:p+i.displaySize[1],left:d,right:d+i.displaySize[0]}}function Pd(i){var e,r;let s=i.left,l=i.top,d=i.right-s,p=i.bottom-l;const f=(e=i.image.textFitWidth)!==null&&e!==void 0?e:"stretchOrShrink",g=(r=i.image.textFitHeight)!==null&&r!==void 0?r:"stretchOrShrink",x=(i.image.content[2]-i.image.content[0])/(i.image.content[3]-i.image.content[1]);if(g==="proportional"){if(f==="stretchOnly"&&d/p<x||f==="proportional"){const w=Math.ceil(p*x);s*=w/d,d=w}}else if(f==="proportional"&&g==="stretchOnly"&&x!==0&&d/p>x){const w=Math.ceil(d/x);l*=w/p,p=w}return{x1:s,y1:l,x2:s+d,y2:l+p}}function Ed(i,e,r,s,l,d){const p=i.image;let f;if(p.content){const U=p.content,X=p.pixelRatio||1;f=[U[0]/X,U[1]/X,p.displaySize[0]-U[2]/X,p.displaySize[1]-U[3]/X]}const g=e.left*d,x=e.right*d;let w,I,A,M;r==="width"||r==="both"?(M=l[0]+g-s[3],I=l[0]+x+s[1]):(M=l[0]+(g+x-p.displaySize[0])/2,I=M+p.displaySize[0]);const L=e.top*d,F=e.bottom*d;return r==="height"||r==="both"?(w=l[1]+L-s[0],A=l[1]+F+s[2]):(w=l[1]+(L+F-p.displaySize[1])/2,A=w+p.displaySize[1]),{image:p,top:w,right:I,bottom:A,left:M,collisionPadding:f}}const Ja=255,Qr=128,Jn=Ja*Qr;function Ad(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:s,interpolationType:l}=r;let d=0;for(;d<s.length&&s[d]<=i;)d++;d=Math.max(0,d-1);let p=d;for(;p<s.length&&s[p]<i+1;)p++;p=Math.min(s.length-1,p);const f=s[d],g=s[p];return r.kind==="composite"?{kind:"composite",minZoom:f,maxZoom:g,interpolationType:l}:{kind:"camera",minZoom:f,maxZoom:g,minSize:r.evaluate(new kt(f)),maxSize:r.evaluate(new kt(g)),interpolationType:l}}}function wh(i,e,r){let s="never";const l=i.get(e);return l?s=l:i.get(r)&&(s="always"),s}const S_=Xn.VectorTileFeature.types,T_=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function oc(i,e,r,s,l,d,p,f,g,x,w,I,A){const M=f?Math.min(Jn,Math.round(f[0])):0,L=f?Math.min(Jn,Math.round(f[1])):0;i.emplaceBack(e,r,Math.round(32*s),Math.round(32*l),d,p,(M<<1)+(g?1:0),L,16*x,16*w,256*I,256*A)}function Sh(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 I_(i){for(const e of i.sections)if(Ma(e.text))return!0;return!1}class Th{constructor(e){this.layoutVertexArray=new ar,this.indexArray=new ni,this.programConfigurations=e,this.segments=new ti,this.dynamicLayoutVertexArray=new Kr,this.opacityVertexArray=new qn,this.hasVisibleVertices=!1,this.placedSymbolArray=new Bt}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,s,l){this.isEmpty()||(s&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,t_.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,i_.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,T_,!0),this.opacityVertexBuffer.itemSize=1),(s||l)&&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())}}Fe("SymbolBuffers",Th);class Ih{constructor(e,r,s){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new s,this.segments=new ti,this.collisionVertexArray=new _i}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,r_.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Fe("CollisionBuffers",Ih);class Mo{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(p=>p.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=sh([]),this.placementViewportMatrix=sh([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Ad(this.zoom,r["text-size"]),this.iconSizeData=Ad(this.zoom,r["icon-size"]);const s=this.layers[0].layout,l=s.get("symbol-sort-key"),d=s.get("symbol-z-order");this.canOverlap=wh(s,"text-overlap","text-allow-overlap")!=="never"||wh(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=d!=="viewport-y"&&!l.isConstant(),this.sortFeaturesByY=(d==="viewport-y"||d==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,s.get("symbol-placement")==="point"&&(this.writingModes=s.get("text-writing-mode").map(p=>S.ai[p])),this.stateDependentLayerIds=this.layers.filter(p=>p.isStateDependent()).map(p=>p.id),this.sourceID=e.sourceID}createArrays(){this.text=new Th(new zs(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Th(new zs(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Ft,this.lineVertexArray=new Mi,this.symbolInstances=new sr,this.textAnchorOffsets=new fi}calculateGlyphDependencies(e,r,s,l,d){for(let p=0;p<e.length;p++)if(r[e.charCodeAt(p)]=!0,(s||l)&&d){const f=Ha[e.charAt(p)];f&&(r[f.charCodeAt(0)]=!0)}}populate(e,r,s){const l=this.layers[0],d=l.layout,p=d.get("text-font"),f=d.get("text-field"),g=d.get("icon-image"),x=(f.value.kind!=="constant"||f.value.value instanceof Oi&&!f.value.value.isEmpty()||f.value.value.toString().length>0)&&(p.value.kind!=="constant"||p.value.value.length>0),w=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,I=d.get("symbol-sort-key");if(this.features=[],!x&&!w)return;const A=r.iconDependencies,M=r.glyphDependencies,L=r.availableImages,F=new kt(this.zoom);for(const{feature:U,id:X,index:se,sourceLayerIndex:K}of e){const ie=l._featureFilter.needGeometry,de=Ls(U,ie);if(!l._featureFilter.filter(F,de,s))continue;let ye,Le;if(ie||(de.geometry=Ds(U)),x){const Me=l.getValueAndResolveTokens("text-field",de,s,L),Ce=Oi.factory(Me),$e=this.hasRTLText=this.hasRTLText||I_(Ce);(!$e||Jr.getRTLTextPluginStatus()==="unavailable"||$e&&Jr.isParsed())&&(ye=s_(Ce,l,de))}if(w){const Me=l.getValueAndResolveTokens("icon-image",de,s,L);Le=Me instanceof di?Me:di.fromString(Me)}if(!ye&&!Le)continue;const Xe=this.sortFeaturesByKey?I.evaluate(de,{},s):void 0;if(this.features.push({id:X,text:ye,icon:Le,index:se,sourceLayerIndex:K,geometry:de.geometry,properties:U.properties,type:S_[U.type],sortKey:Xe}),Le&&(A[Le.name]=!0),ye){const Me=p.evaluate(de,{},s).join(","),Ce=d.get("text-rotation-alignment")!=="viewport"&&d.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(S.ai.vertical)>=0;for(const $e of ye.sections)if($e.image)A[$e.image.name]=!0;else{const Ve=Ca(ye.toString()),Be=$e.fontStack||Me,me=M[Be]=M[Be]||{};this.calculateGlyphDependencies($e.text,me,Ce,this.allowVerticalPlacement,Ve)}}}d.get("symbol-placement")==="line"&&(this.features=function(U){const X={},se={},K=[];let ie=0;function de(Me){K.push(U[Me]),ie++}function ye(Me,Ce,$e){const Ve=se[Me];return delete se[Me],se[Ce]=Ve,K[Ve].geometry[0].pop(),K[Ve].geometry[0]=K[Ve].geometry[0].concat($e[0]),Ve}function Le(Me,Ce,$e){const Ve=X[Ce];return delete X[Ce],X[Me]=Ve,K[Ve].geometry[0].shift(),K[Ve].geometry[0]=$e[0].concat(K[Ve].geometry[0]),Ve}function Xe(Me,Ce,$e){const Ve=$e?Ce[0][Ce[0].length-1]:Ce[0][0];return`${Me}:${Ve.x}:${Ve.y}`}for(let Me=0;Me<U.length;Me++){const Ce=U[Me],$e=Ce.geometry,Ve=Ce.text?Ce.text.toString():null;if(!Ve){de(Me);continue}const Be=Xe(Ve,$e),me=Xe(Ve,$e,!0);if(Be in se&&me in X&&se[Be]!==X[me]){const Ze=Le(Be,me,$e),Ue=ye(Be,me,K[Ze].geometry);delete X[Be],delete se[me],se[Xe(Ve,K[Ue].geometry,!0)]=Ue,K[Ze].geometry=null}else Be in se?ye(Be,me,$e):me in X?Le(Be,me,$e):(de(Me),X[Be]=ie-1,se[me]=ie-1)}return K.filter(Me=>Me.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((U,X)=>U.sortKey-X.sortKey)}update(e,r,s){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,s),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,s))}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 s=this.lineVertexArray.length;if(e.segment!==void 0){let l=e.dist(r[e.segment+1]),d=e.dist(r[e.segment]);const p={};for(let f=e.segment+1;f<r.length;f++)p[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:l},f<r.length-1&&(l+=r[f+1].dist(r[f]));for(let f=e.segment||0;f>=0;f--)p[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:d},f>0&&(d+=r[f-1].dist(r[f]));for(let f=0;f<r.length;f++){const g=p[f];this.lineVertexArray.emplaceBack(g.x,g.y,g.tileUnitDistanceFromAnchor)}}return{lineStartIndex:s,lineLength:this.lineVertexArray.length-s}}addSymbols(e,r,s,l,d,p,f,g,x,w,I,A){const M=e.indexArray,L=e.layoutVertexArray,F=e.segments.prepareSegment(4*r.length,L,M,this.canOverlap?p.sortKey:void 0),U=this.glyphOffsetArray.length,X=F.vertexLength,se=this.allowVerticalPlacement&&f===S.ai.vertical?Math.PI/2:0,K=p.text&&p.text.sections;for(let ie=0;ie<r.length;ie++){const{tl:de,tr:ye,bl:Le,br:Xe,tex:Me,pixelOffsetTL:Ce,pixelOffsetBR:$e,minFontScaleX:Ve,minFontScaleY:Be,glyphOffset:me,isSDF:Ze,sectionIndex:Ue}=r[ie],et=F.vertexLength,Pt=me[1];oc(L,g.x,g.y,de.x,Pt+de.y,Me.x,Me.y,s,Ze,Ce.x,Ce.y,Ve,Be),oc(L,g.x,g.y,ye.x,Pt+ye.y,Me.x+Me.w,Me.y,s,Ze,$e.x,Ce.y,Ve,Be),oc(L,g.x,g.y,Le.x,Pt+Le.y,Me.x,Me.y+Me.h,s,Ze,Ce.x,$e.y,Ve,Be),oc(L,g.x,g.y,Xe.x,Pt+Xe.y,Me.x+Me.w,Me.y+Me.h,s,Ze,$e.x,$e.y,Ve,Be),Sh(e.dynamicLayoutVertexArray,g,se),M.emplaceBack(et,et+1,et+2),M.emplaceBack(et+1,et+2,et+3),F.vertexLength+=4,F.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(me[0]),ie!==r.length-1&&Ue===r[ie+1].sectionIndex||e.programConfigurations.populatePaintArrays(L.length,p,p.index,{},A,K&&K[Ue])}e.placedSymbolArray.emplaceBack(g.x,g.y,U,this.glyphOffsetArray.length-U,X,x,w,g.segment,s?s[0]:0,s?s[1]:0,l[0],l[1],f,0,!1,0,I)}_addCollisionDebugVertex(e,r,s,l,d,p){return r.emplaceBack(0,0),e.emplaceBack(s.x,s.y,l,d,Math.round(p.x),Math.round(p.y))}addCollisionDebugVertices(e,r,s,l,d,p,f){const g=d.segments.prepareSegment(4,d.layoutVertexArray,d.indexArray),x=g.vertexLength,w=d.layoutVertexArray,I=d.collisionVertexArray,A=f.anchorX,M=f.anchorY;this._addCollisionDebugVertex(w,I,p,A,M,new he(e,r)),this._addCollisionDebugVertex(w,I,p,A,M,new he(s,r)),this._addCollisionDebugVertex(w,I,p,A,M,new he(s,l)),this._addCollisionDebugVertex(w,I,p,A,M,new he(e,l)),g.vertexLength+=4;const L=d.indexArray;L.emplaceBack(x,x+1),L.emplaceBack(x+1,x+2),L.emplaceBack(x+2,x+3),L.emplaceBack(x+3,x),g.primitiveLength+=4}addDebugCollisionBoxes(e,r,s,l){for(let d=e;d<r;d++){const p=this.collisionBoxArray.get(d);this.addCollisionDebugVertices(p.x1,p.y1,p.x2,p.y2,l?this.textCollisionBox:this.iconCollisionBox,p.anchorPoint,s)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Ih(gi,ud.members,jt),this.iconCollisionBox=new Ih(gi,ud.members,jt);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,s,l,d,p,f,g,x){const w={};for(let I=r;I<s;I++){const A=e.get(I);w.textBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},w.textFeatureIndex=A.featureIndex;break}for(let I=l;I<d;I++){const A=e.get(I);w.verticalTextBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},w.verticalTextFeatureIndex=A.featureIndex;break}for(let I=p;I<f;I++){const A=e.get(I);w.iconBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},w.iconFeatureIndex=A.featureIndex;break}for(let I=g;I<x;I++){const A=e.get(I);w.verticalIconBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},w.verticalIconFeatureIndex=A.featureIndex;break}return w}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const s=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,s.textBoxStartIndex,s.textBoxEndIndex,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s.iconBoxStartIndex,s.iconBoxEndIndex,s.verticalIconBoxStartIndex,s.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,r){const s=e.placedSymbolArray.get(r),l=s.vertexStartIndex+4*s.numGlyphs;for(let d=s.vertexStartIndex;d<l;d+=4)e.indexArray.emplaceBack(d,d+1,d+2),e.indexArray.emplaceBack(d+1,d+2,d+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(e),s=Math.cos(e),l=[],d=[],p=[];for(let f=0;f<this.symbolInstances.length;++f){p.push(f);const g=this.symbolInstances.get(f);l.push(0|Math.round(r*g.anchorX+s*g.anchorY)),d.push(g.featureIndex)}return p.sort((f,g)=>l[f]-l[g]||d[g]-d[f]),p}addToSortKeyRanges(e,r){const s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===r?s.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 s=this.symbolInstances.get(r);this.featureSortOrder.push(s.featureIndex),[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex].forEach((l,d,p)=>{l>=0&&p.indexOf(l)===d&&this.addIndicesForPlacedSymbol(this.text,l)}),s.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,s.verticalPlacedTextSymbolIndex),s.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.placedIconSymbolIndex),s.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Cd,kd;Fe("SymbolBucket",Mo,{omit:["layers","collisionBoxArray","features","compareText"]}),Mo.MAX_GLYPHS=65535,Mo.addDynamicAttributes=Sh;var Ph={get paint(){return kd=kd||new o({"icon-opacity":new Je(ue.paint_symbol["icon-opacity"]),"icon-color":new Je(ue.paint_symbol["icon-color"]),"icon-halo-color":new Je(ue.paint_symbol["icon-halo-color"]),"icon-halo-width":new Je(ue.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Je(ue.paint_symbol["icon-halo-blur"]),"icon-translate":new qe(ue.paint_symbol["icon-translate"]),"icon-translate-anchor":new qe(ue.paint_symbol["icon-translate-anchor"]),"text-opacity":new Je(ue.paint_symbol["text-opacity"]),"text-color":new Je(ue.paint_symbol["text-color"],{runtimeType:Ci,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new Je(ue.paint_symbol["text-halo-color"]),"text-halo-width":new Je(ue.paint_symbol["text-halo-width"]),"text-halo-blur":new Je(ue.paint_symbol["text-halo-blur"]),"text-translate":new qe(ue.paint_symbol["text-translate"]),"text-translate-anchor":new qe(ue.paint_symbol["text-translate-anchor"])})},get layout(){return Cd=Cd||new o({"symbol-placement":new qe(ue.layout_symbol["symbol-placement"]),"symbol-spacing":new qe(ue.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new qe(ue.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Je(ue.layout_symbol["symbol-sort-key"]),"symbol-z-order":new qe(ue.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new qe(ue.layout_symbol["icon-allow-overlap"]),"icon-overlap":new qe(ue.layout_symbol["icon-overlap"]),"icon-ignore-placement":new qe(ue.layout_symbol["icon-ignore-placement"]),"icon-optional":new qe(ue.layout_symbol["icon-optional"]),"icon-rotation-alignment":new qe(ue.layout_symbol["icon-rotation-alignment"]),"icon-size":new Je(ue.layout_symbol["icon-size"]),"icon-text-fit":new qe(ue.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new qe(ue.layout_symbol["icon-text-fit-padding"]),"icon-image":new Je(ue.layout_symbol["icon-image"]),"icon-rotate":new Je(ue.layout_symbol["icon-rotate"]),"icon-padding":new Je(ue.layout_symbol["icon-padding"]),"icon-keep-upright":new qe(ue.layout_symbol["icon-keep-upright"]),"icon-offset":new Je(ue.layout_symbol["icon-offset"]),"icon-anchor":new Je(ue.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new qe(ue.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new qe(ue.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new qe(ue.layout_symbol["text-rotation-alignment"]),"text-field":new Je(ue.layout_symbol["text-field"]),"text-font":new Je(ue.layout_symbol["text-font"]),"text-size":new Je(ue.layout_symbol["text-size"]),"text-max-width":new Je(ue.layout_symbol["text-max-width"]),"text-line-height":new qe(ue.layout_symbol["text-line-height"]),"text-letter-spacing":new Je(ue.layout_symbol["text-letter-spacing"]),"text-justify":new Je(ue.layout_symbol["text-justify"]),"text-radial-offset":new Je(ue.layout_symbol["text-radial-offset"]),"text-variable-anchor":new qe(ue.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Je(ue.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Je(ue.layout_symbol["text-anchor"]),"text-max-angle":new qe(ue.layout_symbol["text-max-angle"]),"text-writing-mode":new qe(ue.layout_symbol["text-writing-mode"]),"text-rotate":new Je(ue.layout_symbol["text-rotate"]),"text-padding":new qe(ue.layout_symbol["text-padding"]),"text-keep-upright":new qe(ue.layout_symbol["text-keep-upright"]),"text-transform":new Je(ue.layout_symbol["text-transform"]),"text-offset":new Je(ue.layout_symbol["text-offset"]),"text-allow-overlap":new qe(ue.layout_symbol["text-allow-overlap"]),"text-overlap":new qe(ue.layout_symbol["text-overlap"]),"text-ignore-placement":new qe(ue.layout_symbol["text-ignore-placement"]),"text-optional":new qe(ue.layout_symbol["text-optional"])})}};class Md{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:$r,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}}Fe("FormatSectionOverride",Md,{omit:["defaultValue"]});class ac extends c{constructor(e){super(e,Ph)}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 s=this.layout.get("text-writing-mode");if(s){const l=[];for(const d of s)l.indexOf(d)<0&&l.push(d);this.layout._values["text-writing-mode"]=l}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,s,l){const d=this.layout.get(e).evaluate(r,{},s,l),p=this._unevaluatedLayout._values[e];return p.isDataDriven()||ws(p.value)||!d?d:function(f,g){return g.replace(/{([^{}]+)}/g,(x,w)=>f&&w in f?String(f[w]):"")}(r.properties,d)}createBucket(e){return new Mo(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of Ph.paint.overridableProperties){if(!ac.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),s=new Md(r),l=new co(s,r.property.specification);let d=null;d=r.value.kind==="constant"||r.value.kind==="source"?new la("source",l):new ca("composite",l,r.value.zoomStops),this.paint._values[e]=new wr(r.property,d,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,s){return!(!this.layout||r.isDataDriven()||s.isDataDriven())&&ac.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const s=e.get("text-field"),l=Ph.paint.properties[r];let d=!1;const p=f=>{for(const g of f)if(l.overrides&&l.overrides.hasOverride(g))return void(d=!0)};if(s.value.kind==="constant"&&s.value.value instanceof Oi)p(s.value.value.sections);else if(s.value.kind==="source"){const f=x=>{d||(x instanceof cn&&Yt(x.value)===Mr?p(x.value.sections):x instanceof Js?p(x.sections):x.eachChild(f))},g=s.value;g._styleExpression&&f(g._styleExpression.expression)}return d}}let zd;var P_={get paint(){return zd=zd||new o({"background-color":new qe(ue.paint_background["background-color"]),"background-pattern":new t(ue.paint_background["background-pattern"]),"background-opacity":new qe(ue.paint_background["background-opacity"])})}};class E_ extends c{constructor(e){super(e,P_)}}let Dd;var A_={get paint(){return Dd=Dd||new o({"raster-opacity":new qe(ue.paint_raster["raster-opacity"]),"raster-hue-rotate":new qe(ue.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new qe(ue.paint_raster["raster-brightness-min"]),"raster-brightness-max":new qe(ue.paint_raster["raster-brightness-max"]),"raster-saturation":new qe(ue.paint_raster["raster-saturation"]),"raster-contrast":new qe(ue.paint_raster["raster-contrast"]),"raster-resampling":new qe(ue.paint_raster["raster-resampling"]),"raster-fade-duration":new qe(ue.paint_raster["raster-fade-duration"])})}};class C_ extends c{constructor(e){super(e,A_)}}class k_ extends c{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 M_{constructor(e){this._methodToThrottle=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const Eh=63710088e-1;class Kn{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 Kn(Et(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,s=this.lat*r,l=e.lat*r,d=Math.sin(s)*Math.sin(l)+Math.cos(s)*Math.cos(l)*Math.cos((e.lng-this.lng)*r);return Eh*Math.acos(Math.min(d,1))}static convert(e){if(e instanceof Kn)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Kn(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Kn(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 Ld=2*Math.PI*Eh;function Rd(i){return Ld*Math.cos(i*Math.PI/180)}function Bd(i){return(180+i)/360}function Fd(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function Od(i,e){return i/Rd(e)}function Ah(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class lc{constructor(e,r,s=0){this.x=+e,this.y=+r,this.z=+s}static fromLngLat(e,r=0){const s=Kn.convert(e);return new lc(Bd(s.lng),Fd(s.lat),Od(r,s.lat))}toLngLat(){return new Kn(360*this.x-180,Ah(this.y))}toAltitude(){return this.z*Rd(Ah(this.y))}meterInMercatorCoordinateUnits(){return 1/Ld*(e=Ah(this.y),1/Math.cos(e*Math.PI/180));var e}}function Vd(i,e,r){var s=2*Math.PI*6378137/256/Math.pow(2,r);return[i*s-2*Math.PI*6378137/2,e*s-2*Math.PI*6378137/2]}class Ch{constructor(e,r,s){if(e<0||e>25||s<0||s>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error(`x=${r}, y=${s}, 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=s,this.key=Ka(0,e,e,r,s)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,s){const l=(p=this.y,f=this.z,g=Vd(256*(d=this.x),256*(p=Math.pow(2,f)-p-1),f),x=Vd(256*(d+1),256*(p+1),f),g[0]+","+g[1]+","+x[0]+","+x[1]);var d,p,f,g,x;const w=function(I,A,M){let L,F="";for(let U=I;U>0;U--)L=1<<U-1,F+=(A&L?1:0)+(M&L?2:0);return F}(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(s==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,w).replace(/{bbox-epsg-3857}/g,l)}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 he((e.x*r-this.x)*Qt,(e.y*r-this.y)*Qt)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Nd{constructor(e,r){this.wrap=e,this.canonical=r,this.key=Ka(e,r.z,r.z,r.x,r.y)}}class cr{constructor(e,r,s,l,d){if(e<s)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${s}`);this.overscaledZ=e,this.wrap=r,this.canonical=new Ch(s,+l,+d),this.key=Ka(r,e,s,l,d)}clone(){return new cr(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 cr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new cr(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 s=this.canonical.z-e;return e>this.canonical.z?Ka(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Ka(this.wrap*+r,e,e,this.canonical.x>>s,this.canonical.y>>s)}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 cr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,s=2*this.canonical.x,l=2*this.canonical.y;return[new cr(r,this.wrap,r,s,l),new cr(r,this.wrap,r,s+1,l),new cr(r,this.wrap,r,s,l+1),new cr(r,this.wrap,r,s+1,l+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 cr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new cr(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 Nd(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new lc(e.x-this.wrap,e.y))}}function Ka(i,e,r,s,l){(i*=2)<0&&(i=-1*i-1);const d=1<<r;return(d*d*i+d*l+s).toString(36)+r.toString(36)+e.toString(36)}Fe("CanonicalTileID",Ch),Fe("OverscaledTileID",cr,{omit:["posMatrix"]});class jd{constructor(e,r,s,l=1,d=1,p=1,f=0){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(s&&!["mapbox","terrarium","custom"].includes(s))return void ci(`"${s}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=r.height;const g=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),s){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=l,this.greenFactor=d,this.blueFactor=p,this.baseShift=f;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let x=0;x<g;x++)this.data[this._idx(-1,x)]=this.data[this._idx(0,x)],this.data[this._idx(g,x)]=this.data[this._idx(g-1,x)],this.data[this._idx(x,-1)]=this.data[this._idx(x,0)],this.data[this._idx(x,g)]=this.data[this._idx(x,g-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(g,-1)]=this.data[this._idx(g-1,0)],this.data[this._idx(-1,g)]=this.data[this._idx(0,g-1)],this.data[this._idx(g,g)]=this.data[this._idx(g-1,g-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let x=0;x<g;x++)for(let w=0;w<g;w++){const I=this.get(x,w);I>this.max&&(this.max=I),I<this.min&&(this.min=I)}}get(e,r){const s=new Uint8Array(this.data.buffer),l=4*this._idx(e,r);return this.unpack(s[l],s[l+1],s[l+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,s){return e*this.redFactor+r*this.greenFactor+s*this.blueFactor-this.baseShift}getPixels(){return new lr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,s){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let l=r*this.dim,d=r*this.dim+this.dim,p=s*this.dim,f=s*this.dim+this.dim;switch(r){case-1:l=d-1;break;case 1:d=l+1}switch(s){case-1:p=f-1;break;case 1:f=p+1}const g=-r*this.dim,x=-s*this.dim;for(let w=p;w<f;w++)for(let I=l;I<d;I++)this.data[this._idx(I,w)]=e.data[this._idx(I+g,w+x)]}}Fe("DEMData",jd);class Ud{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){const s=e[r];this._stringToNumber[s]=r,this._numberToString[r]=s}}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 $d{constructor(e,r,s,l,d){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=s,e._y=l,this.properties=e.properties,this.id=d}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 qd{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Nn(Qt,16,0),this.grid3D=new Nn(Qt,16,0),this.featureIndexArray=new or,this.promoteId=r}insert(e,r,s,l,d,p){const f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,l,d);const g=p?this.grid3D:this.grid;for(let x=0;x<r.length;x++){const w=r[x],I=[1/0,1/0,-1/0,-1/0];for(let A=0;A<w.length;A++){const M=w[A];I[0]=Math.min(I[0],M.x),I[1]=Math.min(I[1],M.y),I[2]=Math.max(I[2],M.x),I[3]=Math.max(I[3],M.y)}I[0]<Qt&&I[1]<Qt&&I[2]>=0&&I[3]>=0&&g.insert(f,I[0],I[1],I[2],I[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Xn.VectorTile(new _h(this.rawTileData)).layers,this.sourceLayerCoder=new Ud(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,s,l){this.loadVTLayers();const d=e.params||{},p=Qt/e.tileSize/e.scale,f=Ti(d.filter),g=e.queryGeometry,x=e.queryPadding*p,w=Gd(g),I=this.grid.query(w.minX-x,w.minY-x,w.maxX+x,w.maxY+x),A=Gd(e.cameraQueryGeometry),M=this.grid3D.query(A.minX-x,A.minY-x,A.maxX+x,A.maxY+x,(U,X,se,K)=>function(ie,de,ye,Le,Xe){for(const Ce of ie)if(de<=Ce.x&&ye<=Ce.y&&Le>=Ce.x&&Xe>=Ce.y)return!0;const Me=[new he(de,ye),new he(de,Xe),new he(Le,Xe),new he(Le,ye)];if(ie.length>2){for(const Ce of Me)if(To(ie,Ce))return!0}for(let Ce=0;Ce<ie.length-1;Ce++)if(ug(ie[Ce],ie[Ce+1],Me))return!0;return!1}(e.cameraQueryGeometry,U-x,X-x,se+x,K+x));for(const U of M)I.push(U);I.sort(z_);const L={};let F;for(let U=0;U<I.length;U++){const X=I[U];if(X===F)continue;F=X;const se=this.featureIndexArray.get(X);let K=null;this.loadMatchingFeature(L,se.bucketIndex,se.sourceLayerIndex,se.featureIndex,f,d.layers,d.availableImages,r,s,l,(ie,de,ye)=>(K||(K=Ds(ie)),de.queryIntersectsFeature(g,ie,ye,K,this.z,e.transform,p,e.pixelPosMatrix)))}return L}loadMatchingFeature(e,r,s,l,d,p,f,g,x,w,I){const A=this.bucketLayerIDs[r];if(p&&!function(U,X){for(let se=0;se<U.length;se++)if(X.indexOf(U[se])>=0)return!0;return!1}(p,A))return;const M=this.sourceLayerCoder.decode(s),L=this.vtLayers[M].feature(l);if(d.needGeometry){const U=Ls(L,!0);if(!d.filter(new kt(this.tileID.overscaledZ),U,this.tileID.canonical))return}else if(!d.filter(new kt(this.tileID.overscaledZ),L))return;const F=this.getId(L,M);for(let U=0;U<A.length;U++){const X=A[U];if(p&&p.indexOf(X)<0)continue;const se=g[X];if(!se)continue;let K={};F&&w&&(K=w.getState(se.sourceLayer||"_geojsonTileLayer",F));const ie=St({},x[X]);ie.paint=Zd(ie.paint,se.paint,L,K,f),ie.layout=Zd(ie.layout,se.layout,L,K,f);const de=!I||I(L,se,K);if(!de)continue;const ye=new $d(L,this.z,this.x,this.y,F);ye.layer=ie;let Le=e[X];Le===void 0&&(Le=e[X]=[]),Le.push({featureIndex:l,feature:ye,intersectionZ:de})}}lookupSymbolFeatures(e,r,s,l,d,p,f,g){const x={};this.loadVTLayers();const w=Ti(d);for(const I of e)this.loadMatchingFeature(x,s,l,I,w,p,f,g,r);return x}hasLayer(e){for(const r of this.bucketLayerIDs)for(const s of r)if(e===s)return!0;return!1}getId(e,r){let s=e.id;return this.promoteId&&(s=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof s=="boolean"&&(s=Number(s))),s}}function Zd(i,e,r,s,l){return ri(i,(d,p)=>{const f=e instanceof _o?e.get(p):null;return f&&f.evaluate?f.evaluate(r,s,l):f})}function Gd(i){let e=1/0,r=1/0,s=-1/0,l=-1/0;for(const d of i)e=Math.min(e,d.x),r=Math.min(r,d.y),s=Math.max(s,d.x),l=Math.max(l,d.y);return{minX:e,minY:r,maxX:s,maxY:l}}function z_(i,e){return e-i}function Hd(i,e,r,s,l){const d=[];for(let p=0;p<i.length;p++){const f=i[p];let g;for(let x=0;x<f.length-1;x++){let w=f[x],I=f[x+1];w.x<e&&I.x<e||(w.x<e?w=new he(e,w.y+(e-w.x)/(I.x-w.x)*(I.y-w.y))._round():I.x<e&&(I=new he(e,w.y+(e-w.x)/(I.x-w.x)*(I.y-w.y))._round()),w.y<r&&I.y<r||(w.y<r?w=new he(w.x+(r-w.y)/(I.y-w.y)*(I.x-w.x),r)._round():I.y<r&&(I=new he(w.x+(r-w.y)/(I.y-w.y)*(I.x-w.x),r)._round()),w.x>=s&&I.x>=s||(w.x>=s?w=new he(s,w.y+(s-w.x)/(I.x-w.x)*(I.y-w.y))._round():I.x>=s&&(I=new he(s,w.y+(s-w.x)/(I.x-w.x)*(I.y-w.y))._round()),w.y>=l&&I.y>=l||(w.y>=l?w=new he(w.x+(l-w.y)/(I.y-w.y)*(I.x-w.x),l)._round():I.y>=l&&(I=new he(w.x+(l-w.y)/(I.y-w.y)*(I.x-w.x),l)._round()),g&&w.equals(g[g.length-1])||(g=[w],d.push(g)),g.push(I)))))}}return d}Fe("FeatureIndex",qd,{omit:["rawTileData","sourceLayerCoder"]});class Yn extends he{constructor(e,r,s,l){super(e,r),this.angle=s,l!==void 0&&(this.segment=l)}clone(){return new Yn(this.x,this.y,this.angle,this.segment)}}function Xd(i,e,r,s,l){if(e.segment===void 0||r===0)return!0;let d=e,p=e.segment+1,f=0;for(;f>-r/2;){if(p--,p<0)return!1;f-=i[p].dist(d),d=i[p]}f+=i[p].dist(i[p+1]),p++;const g=[];let x=0;for(;f<r/2;){const w=i[p],I=i[p+1];if(!I)return!1;let A=i[p-1].angleTo(w)-w.angleTo(I);for(A=Math.abs((A+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:f,angleDelta:A}),x+=A;f-g[0].distance>s;)x-=g.shift().angleDelta;if(x>l)return!1;p++,f+=w.dist(I)}return!0}function Wd(i){let e=0;for(let r=0;r<i.length-1;r++)e+=i[r].dist(i[r+1]);return e}function Jd(i,e,r){return i?.6*e*r:0}function Kd(i,e){return Math.max(i?i.right-i.left:0,e?e.right-e.left:0)}function D_(i,e,r,s,l,d){const p=Jd(r,l,d),f=Kd(r,s)*d;let g=0;const x=Wd(i)/2;for(let w=0;w<i.length-1;w++){const I=i[w],A=i[w+1],M=I.dist(A);if(g+M>x){const L=(x-g)/M,F=ji.number(I.x,A.x,L),U=ji.number(I.y,A.y,L),X=new Yn(F,U,A.angleTo(I),w);return X._round(),!p||Xd(i,X,f,p,e)?X:void 0}g+=M}}function L_(i,e,r,s,l,d,p,f,g){const x=Jd(s,d,p),w=Kd(s,l),I=w*p,A=i[0].x===0||i[0].x===g||i[0].y===0||i[0].y===g;return e-I<e/4&&(e=I+e/4),Yd(i,A?e/2*f%e:(w/2+2*d)*p*f%e,e,x,r,I,A,!1,g)}function Yd(i,e,r,s,l,d,p,f,g){const x=d/2,w=Wd(i);let I=0,A=e-r,M=[];for(let L=0;L<i.length-1;L++){const F=i[L],U=i[L+1],X=F.dist(U),se=U.angleTo(F);for(;A+r<I+X;){A+=r;const K=(A-I)/X,ie=ji.number(F.x,U.x,K),de=ji.number(F.y,U.y,K);if(ie>=0&&ie<g&&de>=0&&de<g&&A-x>=0&&A+x<=w){const ye=new Yn(ie,de,se,L);ye._round(),s&&!Xd(i,ye,d,s,l)||M.push(ye)}}I+=X}return f||M.length||p||(M=Yd(i,I/2,r,s,l,d,p,!0,g)),M}Fe("Anchor",Yn);const zo=qi;function Qd(i,e,r,s){const l=[],d=i.image,p=d.pixelRatio,f=d.paddedRect.w-2*zo,g=d.paddedRect.h-2*zo;let x={x1:i.left,y1:i.top,x2:i.right,y2:i.bottom};const w=d.stretchX||[[0,f]],I=d.stretchY||[[0,g]],A=(me,Ze)=>me+Ze[1]-Ze[0],M=w.reduce(A,0),L=I.reduce(A,0),F=f-M,U=g-L;let X=0,se=M,K=0,ie=L,de=0,ye=F,Le=0,Xe=U;if(d.content&&s){const me=d.content,Ze=me[2]-me[0],Ue=me[3]-me[1];(d.textFitWidth||d.textFitHeight)&&(x=Pd(i)),X=cc(w,0,me[0]),K=cc(I,0,me[1]),se=cc(w,me[0],me[2]),ie=cc(I,me[1],me[3]),de=me[0]-X,Le=me[1]-K,ye=Ze-se,Xe=Ue-ie}const Me=x.x1,Ce=x.y1,$e=x.x2-Me,Ve=x.y2-Ce,Be=(me,Ze,Ue,et)=>{const Pt=hc(me.stretch-X,se,$e,Me),It=uc(me.fixed-de,ye,me.stretch,M),si=hc(Ze.stretch-K,ie,Ve,Ce),Sr=uc(Ze.fixed-Le,Xe,Ze.stretch,L),xi=hc(Ue.stretch-X,se,$e,Me),Gt=uc(Ue.fixed-de,ye,Ue.stretch,M),Di=hc(et.stretch-K,ie,Ve,Ce),Li=uc(et.fixed-Le,Xe,et.stretch,L),Ri=new he(Pt,si),Ht=new he(xi,si),oi=new he(xi,Di),Pi=new he(Pt,Di),vi=new he(It/p,Sr/p),Bi=new he(Gt/p,Li/p),bi=e*Math.PI/180;if(bi){const gt=Math.sin(bi),Mt=Math.cos(bi),Ot=[Mt,-gt,gt,Mt];Ri._matMult(Ot),Ht._matMult(Ot),Pi._matMult(Ot),oi._matMult(Ot)}const hr=me.stretch+me.fixed,Zi=Ze.stretch+Ze.fixed;return{tl:Ri,tr:Ht,bl:Pi,br:oi,tex:{x:d.paddedRect.x+zo+hr,y:d.paddedRect.y+zo+Zi,w:Ue.stretch+Ue.fixed-hr,h:et.stretch+et.fixed-Zi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:vi,pixelOffsetBR:Bi,minFontScaleX:ye/p/$e,minFontScaleY:Xe/p/Ve,isSDF:r}};if(s&&(d.stretchX||d.stretchY)){const me=ep(w,F,M),Ze=ep(I,U,L);for(let Ue=0;Ue<me.length-1;Ue++){const et=me[Ue],Pt=me[Ue+1];for(let It=0;It<Ze.length-1;It++)l.push(Be(et,Ze[It],Pt,Ze[It+1]))}}else l.push(Be({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:f+1},{fixed:0,stretch:g+1}));return l}function cc(i,e,r){let s=0;for(const l of i)s+=Math.max(e,Math.min(r,l[1]))-Math.max(e,Math.min(r,l[0]));return s}function ep(i,e,r){const s=[{fixed:-zo,stretch:0}];for(const[l,d]of i){const p=s[s.length-1];s.push({fixed:l-p.stretch,stretch:p.stretch}),s.push({fixed:l-p.stretch,stretch:p.stretch+(d-l)})}return s.push({fixed:e+zo,stretch:r}),s}function hc(i,e,r,s){return i/e*r+s}function uc(i,e,r,s){return i-e*r/s}class dc{constructor(e,r,s,l,d,p,f,g,x,w){var I;if(this.boxStartIndex=e.length,x){let A=p.top,M=p.bottom;const L=p.collisionPadding;L&&(A-=L[1],M+=L[3]);let F=M-A;F>0&&(F=Math.max(10,F),this.circleDiameter=F)}else{const A=!((I=p.image)===null||I===void 0)&&I.content&&(p.image.textFitWidth||p.image.textFitHeight)?Pd(p):{x1:p.left,y1:p.top,x2:p.right,y2:p.bottom};A.y1=A.y1*f-g[0],A.y2=A.y2*f+g[2],A.x1=A.x1*f-g[3],A.x2=A.x2*f+g[1];const M=p.collisionPadding;if(M&&(A.x1-=M[0]*f,A.y1-=M[1]*f,A.x2+=M[2]*f,A.y2+=M[3]*f),w){const L=new he(A.x1,A.y1),F=new he(A.x2,A.y1),U=new he(A.x1,A.y2),X=new he(A.x2,A.y2),se=w*Math.PI/180;L._rotate(se),F._rotate(se),U._rotate(se),X._rotate(se),A.x1=Math.min(L.x,F.x,U.x,X.x),A.x2=Math.max(L.x,F.x,U.x,X.x),A.y1=Math.min(L.y,F.y,U.y,X.y),A.y2=Math.max(L.y,F.y,U.y,X.y)}e.emplaceBack(r.x,r.y,A.x1,A.y1,A.x2,A.y2,s,l,d)}this.boxEndIndex=e.length}}class R_{constructor(e=[],r=(s,l)=>s<l?-1:s>l?1:0){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:s}=this,l=r[e];for(;e>0;){const d=e-1>>1,p=r[d];if(s(l,p)>=0)break;r[e]=p,e=d}r[e]=l}_down(e){const{data:r,compare:s}=this,l=this.length>>1,d=r[e];for(;e<l;){let p=1+(e<<1);const f=p+1;if(f<this.length&&s(r[f],r[p])<0&&(p=f),s(r[p],d)>=0)break;r[e]=r[p],e=p}r[e]=d}}function B_(i,e=1,r=!1){let s=1/0,l=1/0,d=-1/0,p=-1/0;const f=i[0];for(let M=0;M<f.length;M++){const L=f[M];(!M||L.x<s)&&(s=L.x),(!M||L.y<l)&&(l=L.y),(!M||L.x>d)&&(d=L.x),(!M||L.y>p)&&(p=L.y)}const g=Math.min(d-s,p-l);let x=g/2;const w=new R_([],F_);if(g===0)return new he(s,l);for(let M=s;M<d;M+=g)for(let L=l;L<p;L+=g)w.push(new Do(M+x,L+x,x,i));let I=function(M){let L=0,F=0,U=0;const X=M[0];for(let se=0,K=X.length,ie=K-1;se<K;ie=se++){const de=X[se],ye=X[ie],Le=de.x*ye.y-ye.x*de.y;F+=(de.x+ye.x)*Le,U+=(de.y+ye.y)*Le,L+=3*Le}return new Do(F/L,U/L,0,M)}(i),A=w.length;for(;w.length;){const M=w.pop();(M.d>I.d||!I.d)&&(I=M,r&&console.log("found best %d after %d probes",Math.round(1e4*M.d)/1e4,A)),M.max-I.d<=e||(x=M.h/2,w.push(new Do(M.p.x-x,M.p.y-x,x,i)),w.push(new Do(M.p.x+x,M.p.y-x,x,i)),w.push(new Do(M.p.x-x,M.p.y+x,x,i)),w.push(new Do(M.p.x+x,M.p.y+x,x,i)),A+=4)}return r&&(console.log(`num probes: ${A}`),console.log(`best distance: ${I.d}`)),I.p}function F_(i,e){return e.max-i.max}function Do(i,e,r,s){this.p=new he(i,e),this.h=r,this.d=function(l,d){let p=!1,f=1/0;for(let g=0;g<d.length;g++){const x=d[g];for(let w=0,I=x.length,A=I-1;w<I;A=w++){const M=x[w],L=x[A];M.y>l.y!=L.y>l.y&&l.x<(L.x-M.x)*(l.y-M.y)/(L.y-M.y)+M.x&&(p=!p),f=Math.min(f,Fu(l,M,L))}}return(p?1:-1)*Math.sqrt(f)}(this.p,s),this.max=this.d+this.h*Math.SQRT2}var yi;S.ar=void 0,(yi=S.ar||(S.ar={}))[yi.center=1]="center",yi[yi.left=2]="left",yi[yi.right=3]="right",yi[yi.top=4]="top",yi[yi.bottom=5]="bottom",yi[yi["top-left"]=6]="top-left",yi[yi["top-right"]=7]="top-right",yi[yi["bottom-left"]=8]="bottom-left",yi[yi["bottom-right"]=9]="bottom-right";const Qn=7,kh=Number.POSITIVE_INFINITY;function tp(i,e){return e[1]!==kh?function(r,s,l){let d=0,p=0;switch(s=Math.abs(s),l=Math.abs(l),r){case"top-right":case"top-left":case"top":p=l-Qn;break;case"bottom-right":case"bottom-left":case"bottom":p=-l+Qn}switch(r){case"top-right":case"bottom-right":case"right":d=-s;break;case"top-left":case"bottom-left":case"left":d=s}return[d,p]}(i,e[0],e[1]):function(r,s){let l=0,d=0;s<0&&(s=0);const p=s/Math.SQRT2;switch(r){case"top-right":case"top-left":d=p-Qn;break;case"bottom-right":case"bottom-left":d=-p+Qn;break;case"bottom":d=-s+Qn;break;case"top":d=s-Qn}switch(r){case"top-right":case"bottom-right":l=-p;break;case"top-left":case"bottom-left":l=p;break;case"left":l=s;break;case"right":l=-s}return[l,d]}(i,e[0])}function ip(i,e,r){var s;const l=i.layout,d=(s=l.get("text-variable-anchor-offset"))===null||s===void 0?void 0:s.evaluate(e,{},r);if(d){const f=d.values,g=[];for(let x=0;x<f.length;x+=2){const w=g[x]=f[x],I=f[x+1].map(A=>A*ii);w.startsWith("top")?I[1]-=Qn:w.startsWith("bottom")&&(I[1]+=Qn),g[x+1]=I}return new Ni(g)}const p=l.get("text-variable-anchor");if(p){let f;f=i._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[l.get("text-radial-offset").evaluate(e,{},r)*ii,kh]:l.get("text-offset").evaluate(e,{},r).map(x=>x*ii);const g=[];for(const x of p)g.push(x,tp(x,f));return new Ni(g)}return null}function Mh(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 O_(i,e,r,s,l,d,p,f,g,x,w){let I=d.textMaxSize.evaluate(e,{});I===void 0&&(I=p);const A=i.layers[0].layout,M=A.get("icon-offset").evaluate(e,{},w),L=np(r.horizontal),F=p/24,U=i.tilePixelRatio*F,X=i.tilePixelRatio*I/24,se=i.tilePixelRatio*f,K=i.tilePixelRatio*A.get("symbol-spacing"),ie=A.get("text-padding")*i.tilePixelRatio,de=function(me,Ze,Ue,et=1){const Pt=me.get("icon-padding").evaluate(Ze,{},Ue),It=Pt&&Pt.values;return[It[0]*et,It[1]*et,It[2]*et,It[3]*et]}(A,e,w,i.tilePixelRatio),ye=A.get("text-max-angle")/180*Math.PI,Le=A.get("text-rotation-alignment")!=="viewport"&&A.get("symbol-placement")!=="point",Xe=A.get("icon-rotation-alignment")==="map"&&A.get("symbol-placement")!=="point",Me=A.get("symbol-placement"),Ce=K/2,$e=A.get("icon-text-fit");let Ve;s&&$e!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Ve=Ed(s,r.vertical,$e,A.get("icon-text-fit-padding"),M,F)),L&&(s=Ed(s,L,$e,A.get("icon-text-fit-padding"),M,F)));const Be=(me,Ze)=>{Ze.x<0||Ze.x>=Qt||Ze.y<0||Ze.y>=Qt||function(Ue,et,Pt,It,si,Sr,xi,Gt,Di,Li,Ri,Ht,oi,Pi,vi,Bi,bi,hr,Zi,gt,Mt,Ot,Ji,Zt,Lo){const en=Ue.addToLineVertexArray(et,Pt);let tn,Tr,ur,li,Sn=0,el=0,lp=0,cp=0,Vh=-1,Nh=-1;const Tn={};let hp=wo("");if(Ue.allowVerticalPlacement&&It.vertical){const Ei=Gt.layout.get("text-rotate").evaluate(Mt,{},Zt)+90;ur=new dc(Di,et,Li,Ri,Ht,It.vertical,oi,Pi,vi,Ei),xi&&(li=new dc(Di,et,Li,Ri,Ht,xi,bi,hr,vi,Ei))}if(si){const Ei=Gt.layout.get("icon-rotate").evaluate(Mt,{}),dr=Gt.layout.get("icon-text-fit")!=="none",Bs=Qd(si,Ei,Ji,dr),Or=xi?Qd(xi,Ei,Ji,dr):void 0;Tr=new dc(Di,et,Li,Ri,Ht,si,bi,hr,!1,Ei),Sn=4*Bs.length;const Fs=Ue.iconSizeData;let rn=null;Fs.kind==="source"?(rn=[Qr*Gt.layout.get("icon-size").evaluate(Mt,{})],rn[0]>Jn&&ci(`${Ue.layerIds[0]}: Value for "icon-size" is >= ${Ja}. Reduce your "icon-size".`)):Fs.kind==="composite"&&(rn=[Qr*Ot.compositeIconSizes[0].evaluate(Mt,{},Zt),Qr*Ot.compositeIconSizes[1].evaluate(Mt,{},Zt)],(rn[0]>Jn||rn[1]>Jn)&&ci(`${Ue.layerIds[0]}: Value for "icon-size" is >= ${Ja}. Reduce your "icon-size".`)),Ue.addSymbols(Ue.icon,Bs,rn,gt,Zi,Mt,S.ai.none,et,en.lineStartIndex,en.lineLength,-1,Zt),Vh=Ue.icon.placedSymbolArray.length-1,Or&&(el=4*Or.length,Ue.addSymbols(Ue.icon,Or,rn,gt,Zi,Mt,S.ai.vertical,et,en.lineStartIndex,en.lineLength,-1,Zt),Nh=Ue.icon.placedSymbolArray.length-1)}const up=Object.keys(It.horizontal);for(const Ei of up){const dr=It.horizontal[Ei];if(!tn){hp=wo(dr.text);const Or=Gt.layout.get("text-rotate").evaluate(Mt,{},Zt);tn=new dc(Di,et,Li,Ri,Ht,dr,oi,Pi,vi,Or)}const Bs=dr.positionedLines.length===1;if(lp+=rp(Ue,et,dr,Sr,Gt,vi,Mt,Bi,en,It.vertical?S.ai.horizontal:S.ai.horizontalOnly,Bs?up:[Ei],Tn,Vh,Ot,Zt),Bs)break}It.vertical&&(cp+=rp(Ue,et,It.vertical,Sr,Gt,vi,Mt,Bi,en,S.ai.vertical,["vertical"],Tn,Nh,Ot,Zt));const j_=tn?tn.boxStartIndex:Ue.collisionBoxArray.length,U_=tn?tn.boxEndIndex:Ue.collisionBoxArray.length,$_=ur?ur.boxStartIndex:Ue.collisionBoxArray.length,q_=ur?ur.boxEndIndex:Ue.collisionBoxArray.length,Z_=Tr?Tr.boxStartIndex:Ue.collisionBoxArray.length,G_=Tr?Tr.boxEndIndex:Ue.collisionBoxArray.length,H_=li?li.boxStartIndex:Ue.collisionBoxArray.length,X_=li?li.boxEndIndex:Ue.collisionBoxArray.length;let Fr=-1;const fc=(Ei,dr)=>Ei&&Ei.circleDiameter?Math.max(Ei.circleDiameter,dr):dr;Fr=fc(tn,Fr),Fr=fc(ur,Fr),Fr=fc(Tr,Fr),Fr=fc(li,Fr);const dp=Fr>-1?1:0;dp&&(Fr*=Lo/ii),Ue.glyphOffsetArray.length>=Mo.MAX_GLYPHS&&ci("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Mt.sortKey!==void 0&&Ue.addToSortKeyRanges(Ue.symbolInstances.length,Mt.sortKey);const W_=ip(Gt,Mt,Zt),[J_,K_]=function(Ei,dr){const Bs=Ei.length,Or=dr==null?void 0:dr.values;if((Or==null?void 0:Or.length)>0)for(let Fs=0;Fs<Or.length;Fs+=2){const rn=Or[Fs+1];Ei.emplaceBack(S.ar[Or[Fs]],rn[0],rn[1])}return[Bs,Ei.length]}(Ue.textAnchorOffsets,W_);Ue.symbolInstances.emplaceBack(et.x,et.y,Tn.right>=0?Tn.right:-1,Tn.center>=0?Tn.center:-1,Tn.left>=0?Tn.left:-1,Tn.vertical||-1,Vh,Nh,hp,j_,U_,$_,q_,Z_,G_,H_,X_,Li,lp,cp,Sn,el,dp,0,oi,Fr,J_,K_)}(i,Ze,me,r,s,l,Ve,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,U,[ie,ie,ie,ie],Le,g,se,de,Xe,M,e,d,x,w,p)};if(Me==="line")for(const me of Hd(e.geometry,0,0,Qt,Qt)){const Ze=L_(me,K,ye,r.vertical||L,s,24,X,i.overscaling,Qt);for(const Ue of Ze)L&&V_(i,L.text,Ce,Ue)||Be(me,Ue)}else if(Me==="line-center"){for(const me of e.geometry)if(me.length>1){const Ze=D_(me,ye,r.vertical||L,s,24,X);Ze&&Be(me,Ze)}}else if(e.type==="Polygon")for(const me of Ys(e.geometry,0)){const Ze=B_(me,16);Be(me[0],new Yn(Ze.x,Ze.y,0))}else if(e.type==="LineString")for(const me of e.geometry)Be(me,new Yn(me[0].x,me[0].y,0));else if(e.type==="Point")for(const me of e.geometry)for(const Ze of me)Be([Ze],new Yn(Ze.x,Ze.y,0))}function rp(i,e,r,s,l,d,p,f,g,x,w,I,A,M,L){const F=function(se,K,ie,de,ye,Le,Xe,Me){const Ce=de.layout.get("text-rotate").evaluate(Le,{})*Math.PI/180,$e=[];for(const Ve of K.positionedLines)for(const Be of Ve.positionedGlyphs){if(!Be.rect)continue;const me=Be.rect||{};let Ze=xd+1,Ue=!0,et=1,Pt=0;const It=(ye||Me)&&Be.vertical,si=Be.metrics.advance*Be.scale/2;if(Me&&K.verticalizable&&(Pt=Ve.lineOffset/2-(Be.imageName?-(ii-Be.metrics.width*Be.scale)/2:(Be.scale-1)*ii)),Be.imageName){const gt=Xe[Be.imageName];Ue=gt.sdf,et=gt.pixelRatio,Ze=qi/et}const Sr=ye?[Be.x+si,Be.y]:[0,0];let xi=ye?[0,0]:[Be.x+si+ie[0],Be.y+ie[1]-Pt],Gt=[0,0];It&&(Gt=xi,xi=[0,0]);const Di=Be.metrics.isDoubleResolution?2:1,Li=(Be.metrics.left-Ze)*Be.scale-si+xi[0],Ri=(-Be.metrics.top-Ze)*Be.scale+xi[1],Ht=Li+me.w/Di*Be.scale/et,oi=Ri+me.h/Di*Be.scale/et,Pi=new he(Li,Ri),vi=new he(Ht,Ri),Bi=new he(Li,oi),bi=new he(Ht,oi);if(It){const gt=new he(-si,si-Xa),Mt=-Math.PI/2,Ot=ii/2-si,Ji=new he(5-Xa-Ot,-(Be.imageName?Ot:0)),Zt=new he(...Gt);Pi._rotateAround(Mt,gt)._add(Ji)._add(Zt),vi._rotateAround(Mt,gt)._add(Ji)._add(Zt),Bi._rotateAround(Mt,gt)._add(Ji)._add(Zt),bi._rotateAround(Mt,gt)._add(Ji)._add(Zt)}if(Ce){const gt=Math.sin(Ce),Mt=Math.cos(Ce),Ot=[Mt,-gt,gt,Mt];Pi._matMult(Ot),vi._matMult(Ot),Bi._matMult(Ot),bi._matMult(Ot)}const hr=new he(0,0),Zi=new he(0,0);$e.push({tl:Pi,tr:vi,bl:Bi,br:bi,tex:me,writingMode:K.writingMode,glyphOffset:Sr,sectionIndex:Be.sectionIndex,isSDF:Ue,pixelOffsetTL:hr,pixelOffsetBR:Zi,minFontScaleX:0,minFontScaleY:0})}return $e}(0,r,f,l,d,p,s,i.allowVerticalPlacement),U=i.textSizeData;let X=null;U.kind==="source"?(X=[Qr*l.layout.get("text-size").evaluate(p,{})],X[0]>Jn&&ci(`${i.layerIds[0]}: Value for "text-size" is >= ${Ja}. Reduce your "text-size".`)):U.kind==="composite"&&(X=[Qr*M.compositeTextSizes[0].evaluate(p,{},L),Qr*M.compositeTextSizes[1].evaluate(p,{},L)],(X[0]>Jn||X[1]>Jn)&&ci(`${i.layerIds[0]}: Value for "text-size" is >= ${Ja}. Reduce your "text-size".`)),i.addSymbols(i.text,F,X,f,d,p,x,e,g.lineStartIndex,g.lineLength,A,L);for(const se of w)I[se]=i.text.placedSymbolArray.length-1;return 4*F.length}function np(i){for(const e in i)return i[e];return null}function V_(i,e,r,s){const l=i.compareText;if(e in l){const d=l[e];for(let p=d.length-1;p>=0;p--)if(s.dist(d[p])<r)return!0}else l[e]=[];return l[e].push(s),!1}const sp=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class zh{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[r,s]=new Uint8Array(e,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");const l=s>>4;if(l!==1)throw new Error(`Got v${l} data when expected v1.`);const d=sp[15&s];if(!d)throw new Error("Unrecognized array type.");const[p]=new Uint16Array(e,2,1),[f]=new Uint32Array(e,4,1);return new zh(f,p,d,e)}constructor(e,r=64,s=Float64Array,l){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=s,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const d=sp.indexOf(this.ArrayType),p=2*e*this.ArrayType.BYTES_PER_ELEMENT,f=e*this.IndexArrayType.BYTES_PER_ELEMENT,g=(8-f%8)%8;if(d<0)throw new Error(`Unexpected typed array class: ${s}.`);l&&l instanceof ArrayBuffer?(this.data=l,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+g,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+p+f+g),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+g,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+d]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=e)}add(e,r){const s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=e,this.coords[this._pos++]=r,s}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Dh(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,s,l){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:d,coords:p,nodeSize:f}=this,g=[0,d.length-1,0],x=[];for(;g.length;){const w=g.pop()||0,I=g.pop()||0,A=g.pop()||0;if(I-A<=f){for(let U=A;U<=I;U++){const X=p[2*U],se=p[2*U+1];X>=e&&X<=s&&se>=r&&se<=l&&x.push(d[U])}continue}const M=A+I>>1,L=p[2*M],F=p[2*M+1];L>=e&&L<=s&&F>=r&&F<=l&&x.push(d[M]),(w===0?e<=L:r<=F)&&(g.push(A),g.push(M-1),g.push(1-w)),(w===0?s>=L:l>=F)&&(g.push(M+1),g.push(I),g.push(1-w))}return x}within(e,r,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:d,nodeSize:p}=this,f=[0,l.length-1,0],g=[],x=s*s;for(;f.length;){const w=f.pop()||0,I=f.pop()||0,A=f.pop()||0;if(I-A<=p){for(let U=A;U<=I;U++)ap(d[2*U],d[2*U+1],e,r)<=x&&g.push(l[U]);continue}const M=A+I>>1,L=d[2*M],F=d[2*M+1];ap(L,F,e,r)<=x&&g.push(l[M]),(w===0?e-s<=L:r-s<=F)&&(f.push(A),f.push(M-1),f.push(1-w)),(w===0?e+s>=L:r+s>=F)&&(f.push(M+1),f.push(I),f.push(1-w))}return g}}function Dh(i,e,r,s,l,d){if(l-s<=r)return;const p=s+l>>1;op(i,e,p,s,l,d),Dh(i,e,r,s,p-1,1-d),Dh(i,e,r,p+1,l,1-d)}function op(i,e,r,s,l,d){for(;l>s;){if(l-s>600){const x=l-s+1,w=r-s+1,I=Math.log(x),A=.5*Math.exp(2*I/3),M=.5*Math.sqrt(I*A*(x-A)/x)*(w-x/2<0?-1:1);op(i,e,r,Math.max(s,Math.floor(r-w*A/x+M)),Math.min(l,Math.floor(r+(x-w)*A/x+M)),d)}const p=e[2*r+d];let f=s,g=l;for(Ya(i,e,s,r),e[2*l+d]>p&&Ya(i,e,s,l);f<g;){for(Ya(i,e,f,g),f++,g--;e[2*f+d]<p;)f++;for(;e[2*g+d]>p;)g--}e[2*s+d]===p?Ya(i,e,s,g):(g++,Ya(i,e,g,l)),g<=r&&(s=g+1),r<=g&&(l=g-1)}}function Ya(i,e,r,s){Lh(i,r,s),Lh(e,2*r,2*s),Lh(e,2*r+1,2*s+1)}function Lh(i,e,r){const s=i[e];i[e]=i[r],i[r]=s}function ap(i,e,r,s){const l=i-r,d=e-s;return l*l+d*d}var Rh;S.bf=void 0,(Rh=S.bf||(S.bf={})).create="create",Rh.load="load",Rh.fullLoad="fullLoad";let pc=null,Qa=[];const Bh=1e3/60,Fh="loadTime",Oh="fullLoadTime",N_={mark(i){performance.mark(i)},frame(i){const e=i;pc!=null&&Qa.push(e-pc),pc=e},clearMetrics(){pc=null,Qa=[],performance.clearMeasures(Fh),performance.clearMeasures(Oh);for(const i in S.bf)performance.clearMarks(S.bf[i])},getPerformanceMetrics(){performance.measure(Fh,S.bf.create,S.bf.load),performance.measure(Oh,S.bf.create,S.bf.fullLoad);const i=performance.getEntriesByName(Fh)[0].duration,e=performance.getEntriesByName(Oh)[0].duration,r=Qa.length,s=1/(Qa.reduce((d,p)=>d+p,0)/r/1e3),l=Qa.filter(d=>d>Bh).reduce((d,p)=>d+(p-Bh)/Bh,0);return{loadTime:i,fullLoadTime:e,fps:s,percentDroppedFrames:l/(r+l)*100,totalFrames:r}}};S.$=class extends B{},S.A=Io,S.B=Pa,S.C=function(i){if(En==null){const e=i.navigator?i.navigator.userAgent:null;En=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return En},S.D=qe,S.E=kn,S.F=class{constructor(i,e){this.target=i,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new M_(()=>this.process()),this.subscription=function(r,s,l,d){return r.addEventListener(s,l,!1),{unsubscribe:()=>{r.removeEventListener(s,l,!1)}}}(this.target,"message",r=>this.receive(r)),this.globalScope=Er(self)?i:window}registerMessageHandler(i,e){this.messageHandlers[i]=e}sendAsync(i,e){return new Promise((r,s)=>{const l=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[l]={resolve:r,reject:s},e&&e.signal.addEventListener("abort",()=>{delete this.resolveRejects[l];const f={id:l,type:"<cancel>",origin:location.origin,targetMapId:i.targetMapId,sourceMapId:this.mapId};this.target.postMessage(f)},{once:!0});const d=[],p=Object.assign(Object.assign({},i),{id:l,sourceMapId:this.mapId,origin:location.origin,data:Cs(i.data,d)});this.target.postMessage(p,{transfer:d})})}receive(i){const e=i.data,r=e.id;if(!(e.origin!=="file://"&&location.origin!=="file://"&&e.origin!=="resource://android"&&location.origin!=="resource://android"&&e.origin!==location.origin||e.targetMapId&&this.mapId!==e.targetMapId)){if(e.type==="<cancel>"){delete this.tasks[r];const s=this.abortControllers[r];return delete this.abortControllers[r],void(s&&s.abort())}if(Er(self)||e.mustQueue)return this.tasks[r]=e,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,e)}}process(){if(this.taskQueue.length===0)return;const i=this.taskQueue.shift(),e=this.tasks[i];delete this.tasks[i],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(i,e)}processTask(i,e){return u(this,void 0,void 0,function*(){if(e.type==="<response>"){const l=this.resolveRejects[i];return delete this.resolveRejects[i],l?void(e.error?l.reject(br(e.error)):l.resolve(br(e.data))):void 0}if(!this.messageHandlers[e.type])return void this.completeTask(i,new Error(`Could not find a registered handler for ${e.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const r=br(e.data),s=new AbortController;this.abortControllers[i]=s;try{const l=yield this.messageHandlers[e.type](e.sourceMapId,r,s);this.completeTask(i,null,l)}catch(l){this.completeTask(i,l)}})}completeTask(i,e,r){const s=[];delete this.abortControllers[i];const l={id:i,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?Cs(e):null,data:Cs(r,s)};this.target.postMessage(l,{transfer:s})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},S.G=Cn,S.H=function(){var i=new Io(16);return Io!=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},S.I=xh,S.J=function(i,e,r){var s,l,d,p,f,g,x,w,I,A,M,L,F=r[0],U=r[1],X=r[2];return e===i?(i[12]=e[0]*F+e[4]*U+e[8]*X+e[12],i[13]=e[1]*F+e[5]*U+e[9]*X+e[13],i[14]=e[2]*F+e[6]*U+e[10]*X+e[14],i[15]=e[3]*F+e[7]*U+e[11]*X+e[15]):(l=e[1],d=e[2],p=e[3],f=e[4],g=e[5],x=e[6],w=e[7],I=e[8],A=e[9],M=e[10],L=e[11],i[0]=s=e[0],i[1]=l,i[2]=d,i[3]=p,i[4]=f,i[5]=g,i[6]=x,i[7]=w,i[8]=I,i[9]=A,i[10]=M,i[11]=L,i[12]=s*F+f*U+I*X+e[12],i[13]=l*F+g*U+A*X+e[13],i[14]=d*F+x*U+M*X+e[14],i[15]=p*F+w*U+L*X+e[15]),i},S.K=function(i,e,r){var s=r[0],l=r[1],d=r[2];return i[0]=e[0]*s,i[1]=e[1]*s,i[2]=e[2]*s,i[3]=e[3]*s,i[4]=e[4]*l,i[5]=e[5]*l,i[6]=e[6]*l,i[7]=e[7]*l,i[8]=e[8]*d,i[9]=e[9]*d,i[10]=e[10]*d,i[11]=e[11]*d,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},S.L=ju,S.M=function(i,e){const r={};for(let s=0;s<e.length;s++){const l=e[s];l in i&&(r[l]=i[l])}return r},S.N=Kn,S.O=Bd,S.P=he,S.Q=Fd,S.R=lr,S.S=cr,S.T=Un,S.U=xt,S.V=tt,S.W=sn,S.X=Qt,S.Y=b,S.Z=lc,S._=u,S.a=Vr,S.a$=function(i,e){var r=i[0],s=i[1],l=i[2],d=i[3],p=i[4],f=i[5],g=i[6],x=i[7],w=i[8],I=i[9],A=i[10],M=i[11],L=i[12],F=i[13],U=i[14],X=i[15],se=e[0],K=e[1],ie=e[2],de=e[3],ye=e[4],Le=e[5],Xe=e[6],Me=e[7],Ce=e[8],$e=e[9],Ve=e[10],Be=e[11],me=e[12],Ze=e[13],Ue=e[14],et=e[15];return Math.abs(r-se)<=zi*Math.max(1,Math.abs(r),Math.abs(se))&&Math.abs(s-K)<=zi*Math.max(1,Math.abs(s),Math.abs(K))&&Math.abs(l-ie)<=zi*Math.max(1,Math.abs(l),Math.abs(ie))&&Math.abs(d-de)<=zi*Math.max(1,Math.abs(d),Math.abs(de))&&Math.abs(p-ye)<=zi*Math.max(1,Math.abs(p),Math.abs(ye))&&Math.abs(f-Le)<=zi*Math.max(1,Math.abs(f),Math.abs(Le))&&Math.abs(g-Xe)<=zi*Math.max(1,Math.abs(g),Math.abs(Xe))&&Math.abs(x-Me)<=zi*Math.max(1,Math.abs(x),Math.abs(Me))&&Math.abs(w-Ce)<=zi*Math.max(1,Math.abs(w),Math.abs(Ce))&&Math.abs(I-$e)<=zi*Math.max(1,Math.abs(I),Math.abs($e))&&Math.abs(A-Ve)<=zi*Math.max(1,Math.abs(A),Math.abs(Ve))&&Math.abs(M-Be)<=zi*Math.max(1,Math.abs(M),Math.abs(Be))&&Math.abs(L-me)<=zi*Math.max(1,Math.abs(L),Math.abs(me))&&Math.abs(F-Ze)<=zi*Math.max(1,Math.abs(F),Math.abs(Ze))&&Math.abs(U-Ue)<=zi*Math.max(1,Math.abs(U),Math.abs(Ue))&&Math.abs(X-et)<=zi*Math.max(1,Math.abs(X),Math.abs(et))},S.a0=ti,S.a1=Ch,S.a2=Te,S.a3=i=>{const e=window.document.createElement("video");return e.muted=!0,new Promise(r=>{e.onloadstart=()=>{r(e)};for(const s of i){const l=window.document.createElement("source");an(s)||(e.crossOrigin="Anonymous"),l.src=s,e.appendChild(l)}})},S.a4=function(){return Yi++},S.a5=ot,S.a6=Mo,S.a7=Ti,S.a8=Ls,S.a9=kt,S.aA=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]=ns(i[r],e[i[r].ref]));return i},S.aB=function(i){if(i.type==="custom")return new k_(i);switch(i.type){case"background":return new E_(i);case"circle":return new fg(i);case"fill":return new Mg(i);case"fill-extrusion":return new Gg(i);case"heatmap":return new gg(i);case"hillshade":return new yg(i);case"line":return new e_(i);case"raster":return new C_(i);case"symbol":return new ac(i)}},S.aC=vt,S.aD=function(i,e){if(!i)return[{command:"setStyle",args:[e]}];let r=[];try{if(!_t(i.version,e.version))return[{command:"setStyle",args:[e]}];_t(i.center,e.center)||r.push({command:"setCenter",args:[e.center]}),_t(i.zoom,e.zoom)||r.push({command:"setZoom",args:[e.zoom]}),_t(i.bearing,e.bearing)||r.push({command:"setBearing",args:[e.bearing]}),_t(i.pitch,e.pitch)||r.push({command:"setPitch",args:[e.pitch]}),_t(i.sprite,e.sprite)||r.push({command:"setSprite",args:[e.sprite]}),_t(i.glyphs,e.glyphs)||r.push({command:"setGlyphs",args:[e.glyphs]}),_t(i.transition,e.transition)||r.push({command:"setTransition",args:[e.transition]}),_t(i.light,e.light)||r.push({command:"setLight",args:[e.light]}),_t(i.terrain,e.terrain)||r.push({command:"setTerrain",args:[e.terrain]}),_t(i.sky,e.sky)||r.push({command:"setSky",args:[e.sky]}),_t(i.projection,e.projection)||r.push({command:"setProjection",args:[e.projection]});const s={},l=[];(function(p,f,g,x){let w;for(w in f=f||{},p=p||{})Object.prototype.hasOwnProperty.call(p,w)&&(Object.prototype.hasOwnProperty.call(f,w)||Ur(w,g,x));for(w in f)Object.prototype.hasOwnProperty.call(f,w)&&(Object.prototype.hasOwnProperty.call(p,w)?_t(p[w],f[w])||(p[w].type==="geojson"&&f[w].type==="geojson"&&Mn(p,f,w)?$t(g,{command:"setGeoJSONSourceData",args:[w,f[w].data]}):kr(w,f,g,x)):ss(w,f,g))})(i.sources,e.sources,l,s);const d=[];i.layers&&i.layers.forEach(p=>{"source"in p&&s[p.source]?r.push({command:"removeLayer",args:[p.id]}):d.push(p)}),r=r.concat(l),function(p,f,g){f=f||[];const x=(p=p||[]).map(os),w=f.map(os),I=p.reduce(as,{}),A=f.reduce(as,{}),M=x.slice(),L=Object.create(null);let F,U,X,se,K;for(let ie=0,de=0;ie<x.length;ie++)F=x[ie],Object.prototype.hasOwnProperty.call(A,F)?de++:($t(g,{command:"removeLayer",args:[F]}),M.splice(M.indexOf(F,de),1));for(let ie=0,de=0;ie<w.length;ie++)F=w[w.length-1-ie],M[M.length-1-ie]!==F&&(Object.prototype.hasOwnProperty.call(I,F)?($t(g,{command:"removeLayer",args:[F]}),M.splice(M.lastIndexOf(F,M.length-de),1)):de++,se=M[M.length-ie],$t(g,{command:"addLayer",args:[A[F],se]}),M.splice(M.length-ie,0,F),L[F]=!0);for(let ie=0;ie<w.length;ie++)if(F=w[ie],U=I[F],X=A[F],!L[F]&&!_t(U,X))if(_t(U.source,X.source)&&_t(U["source-layer"],X["source-layer"])&&_t(U.type,X.type)){for(K in Hi(U.layout,X.layout,g,F,null,"setLayoutProperty"),Hi(U.paint,X.paint,g,F,null,"setPaintProperty"),_t(U.filter,X.filter)||$t(g,{command:"setFilter",args:[F,X.filter]}),_t(U.minzoom,X.minzoom)&&_t(U.maxzoom,X.maxzoom)||$t(g,{command:"setLayerZoomRange",args:[F,X.minzoom,X.maxzoom]}),U)Object.prototype.hasOwnProperty.call(U,K)&&K!=="layout"&&K!=="paint"&&K!=="filter"&&K!=="metadata"&&K!=="minzoom"&&K!=="maxzoom"&&(K.indexOf("paint.")===0?Hi(U[K],X[K],g,F,K.slice(6),"setPaintProperty"):_t(U[K],X[K])||$t(g,{command:"setLayerProperty",args:[F,K,X[K]]}));for(K in X)Object.prototype.hasOwnProperty.call(X,K)&&!Object.prototype.hasOwnProperty.call(U,K)&&K!=="layout"&&K!=="paint"&&K!=="filter"&&K!=="metadata"&&K!=="minzoom"&&K!=="maxzoom"&&(K.indexOf("paint.")===0?Hi(U[K],X[K],g,F,K.slice(6),"setPaintProperty"):_t(U[K],X[K])||$t(g,{command:"setLayerProperty",args:[F,K,X[K]]}))}else $t(g,{command:"removeLayer",args:[F]}),se=M[M.lastIndexOf(F)+1],$t(g,{command:"addLayer",args:[X,se]})}(d,e.layers,r)}catch(s){console.warn("Unable to compute style diff:",s),r=[{command:"setStyle",args:[e]}]}return r},S.aE=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},S.aF=function i(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(let s=0;s<e.length;s++)if(!i(e[s],r[s]))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 s in e)if(!i(e[s],r[s]))return!1;return!0}return e===r},S.aG=ri,S.aH=Qi,S.aI=class extends Ms{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},S.aJ=Xl,S.aK=class extends Ms{constructor(i,e){super(i,e),this.current=og}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}}},S.aL=ku,S.aM=Mu,S.aN=wt,S.aO=class extends Ms{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]))}},S.aP=class extends Ms{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]))}},S.aQ=function(i,e,r,s,l,d,p){var f=1/(e-r),g=1/(s-l),x=1/(d-p);return i[0]=-2*f,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*g,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*x,i[11]=0,i[12]=(e+r)*f,i[13]=(l+s)*g,i[14]=(p+d)*x,i[15]=1,i},S.aR=pg,S.aS=class extends ge{},S.aT=n_,S.aU=class extends De{},S.aV=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},S.aW=Gu,S.aX=xn,S.aY=ni,S.aZ=class extends ke{},S.a_=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]},S.aa=$d,S.ab=function(i){const e={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,s,l,d)=>{const p=l||d;return e[s]=!p||p.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e},S.ac=function(i,e){const r=[];for(const s in i)s in e||r.push(s);return r},S.ad=zt,S.ae=function(i,e,r){var s=Math.sin(r),l=Math.cos(r),d=e[0],p=e[1],f=e[2],g=e[3],x=e[4],w=e[5],I=e[6],A=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]=d*l+x*s,i[1]=p*l+w*s,i[2]=f*l+I*s,i[3]=g*l+A*s,i[4]=x*l-d*s,i[5]=w*l-p*s,i[6]=I*l-f*s,i[7]=A*l-g*s,i},S.af=function(i){var e=new Io(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},S.ag=Yl,S.ah=function(i,e){let r=0,s=0;if(i.kind==="constant")s=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:l,minZoom:d,maxZoom:p}=i,f=l?zt(Ui.interpolationFactor(l,e,d,p),0,1):0;i.kind==="camera"?s=ji.number(i.minSize,i.maxSize,f):r=f}return{uSizeT:r,uSize:s}},S.aj=function(i,{uSize:e,uSizeT:r},{lowerSize:s,upperSize:l}){return i.kind==="source"?s/Qr:i.kind==="composite"?ji.number(s/Qr,l/Qr,r):e},S.ak=Sh,S.al=function(i,e,r,s){const l=e.y-i.y,d=e.x-i.x,p=s.y-r.y,f=s.x-r.x,g=p*d-f*l;if(g===0)return null;const x=(f*(i.y-r.y)-p*(i.x-r.x))/g;return new he(i.x+x*d,i.y+x*l)},S.am=Hd,S.an=Ru,S.ao=sh,S.ap=function(i){let e=1/0,r=1/0,s=-1/0,l=-1/0;for(const d of i)e=Math.min(e,d.x),r=Math.min(r,d.y),s=Math.max(s,d.x),l=Math.max(l,d.y);return[e,r,s,l]},S.aq=ii,S.as=wh,S.at=function(i,e){var r=e[0],s=e[1],l=e[2],d=e[3],p=e[4],f=e[5],g=e[6],x=e[7],w=e[8],I=e[9],A=e[10],M=e[11],L=e[12],F=e[13],U=e[14],X=e[15],se=r*f-s*p,K=r*g-l*p,ie=r*x-d*p,de=s*g-l*f,ye=s*x-d*f,Le=l*x-d*g,Xe=w*F-I*L,Me=w*U-A*L,Ce=w*X-M*L,$e=I*U-A*F,Ve=I*X-M*F,Be=A*X-M*U,me=se*Be-K*Ve+ie*$e+de*Ce-ye*Me+Le*Xe;return me?(i[0]=(f*Be-g*Ve+x*$e)*(me=1/me),i[1]=(l*Ve-s*Be-d*$e)*me,i[2]=(F*Le-U*ye+X*de)*me,i[3]=(A*ye-I*Le-M*de)*me,i[4]=(g*Ce-p*Be-x*Me)*me,i[5]=(r*Be-l*Ce+d*Me)*me,i[6]=(U*ie-L*Le-X*K)*me,i[7]=(w*Le-A*ie+M*K)*me,i[8]=(p*Ve-f*Ce+x*Xe)*me,i[9]=(s*Ce-r*Ve-d*Xe)*me,i[10]=(L*ye-F*ie+X*se)*me,i[11]=(I*ie-w*ye-M*se)*me,i[12]=(f*Me-p*$e-g*Xe)*me,i[13]=(r*$e-s*Me+l*Xe)*me,i[14]=(F*K-L*de-U*se)*me,i[15]=(w*de-I*K+A*se)*me,i):null},S.au=Mh,S.av=bh,S.aw=zh,S.ax=function(){const i={},e=ue.$version;for(const r in ue.$root){const s=ue.$root[r];if(s.required){let l=null;l=r==="version"?e:s.type==="array"?[]:{},l!=null&&(i[r]=l)}}return i},S.ay=Nl,S.az=tr,S.b=pr,S.b0=function(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},S.b1=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},S.b2=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},S.b3=Et,S.b4=Nd,S.b5=Od,S.b6=function(i,e,r,s,l){var d,p=1/Math.tan(e/2);return i[0]=p/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=p,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,l!=null&&l!==1/0?(i[10]=(l+s)*(d=1/(s-l)),i[14]=2*l*s*d):(i[10]=-1,i[14]=-2*s),i},S.b7=function(i,e,r){var s=Math.sin(r),l=Math.cos(r),d=e[4],p=e[5],f=e[6],g=e[7],x=e[8],w=e[9],I=e[10],A=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]=d*l+x*s,i[5]=p*l+w*s,i[6]=f*l+I*s,i[7]=g*l+A*s,i[8]=x*l-d*s,i[9]=w*l-p*s,i[10]=I*l-f*s,i[11]=A*l-g*s,i},S.b8=We,S.b9=Ut,S.bA=function(i){return i.message===er},S.bB=gn,S.bC=Jr,S.ba=function(i){return i*Math.PI/180},S.bb=function(i,e){return i[0]=e[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=e[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=e[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},S.bc=class extends z{},S.bd=Eh,S.be=N_,S.bg=Fi,S.bh=function(i,e){Vr.REGISTERED_PROTOCOLS[i]=e},S.bi=function(i){delete Vr.REGISTERED_PROTOCOLS[i]},S.bj=function(i,e){const r={};for(let l=0;l<i.length;l++){const d=e&&e[i[l].id]||fa(i[l]);e&&(e[i[l].id]=d);let p=r[d];p||(p=r[d]=[]),p.push(i[l])}const s=[];for(const l in r)s.push(r[l]);return s},S.bk=Fe,S.bl=Ud,S.bm=qd,S.bn=bd,S.bo=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=Qt/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const e=i.bucket.layers[0],r=e.layout,s=e._unevaluatedLayout._values,l={layoutIconSize:s["icon-size"].possiblyEvaluate(new kt(i.bucket.zoom+1),i.canonical),layoutTextSize:s["text-size"].possiblyEvaluate(new kt(i.bucket.zoom+1),i.canonical),textMaxSize:s["text-size"].possiblyEvaluate(new kt(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:x,maxZoom:w}=i.bucket.textSizeData;l.compositeTextSizes=[s["text-size"].possiblyEvaluate(new kt(x),i.canonical),s["text-size"].possiblyEvaluate(new kt(w),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:x,maxZoom:w}=i.bucket.iconSizeData;l.compositeIconSizes=[s["icon-size"].possiblyEvaluate(new kt(x),i.canonical),s["icon-size"].possiblyEvaluate(new kt(w),i.canonical)]}const d=r.get("text-line-height")*ii,p=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",f=r.get("text-keep-upright"),g=r.get("text-size");for(const x of i.bucket.features){const w=r.get("text-font").evaluate(x,{},i.canonical).join(","),I=g.evaluate(x,{},i.canonical),A=l.layoutTextSize.evaluate(x,{},i.canonical),M=l.layoutIconSize.evaluate(x,{},i.canonical),L={horizontal:{},vertical:void 0},F=x.text;let U,X=[0,0];if(F){const ie=F.toString(),de=r.get("text-letter-spacing").evaluate(x,{},i.canonical)*ii,ye=Yc(ie)?de:0,Le=r.get("text-anchor").evaluate(x,{},i.canonical),Xe=ip(e,x,i.canonical);if(!Xe){const Ve=r.get("text-radial-offset").evaluate(x,{},i.canonical);X=Ve?tp(Le,[Ve*ii,kh]):r.get("text-offset").evaluate(x,{},i.canonical).map(Be=>Be*ii)}let Me=p?"center":r.get("text-justify").evaluate(x,{},i.canonical);const Ce=r.get("symbol-placement")==="point"?r.get("text-max-width").evaluate(x,{},i.canonical)*ii:1/0,$e=()=>{i.bucket.allowVerticalPlacement&&Ca(ie)&&(L.vertical=nc(F,i.glyphMap,i.glyphPositions,i.imagePositions,w,Ce,d,Le,"left",ye,X,S.ai.vertical,!0,A,I))};if(!p&&Xe){const Ve=new Set;if(Me==="auto")for(let me=0;me<Xe.values.length;me+=2)Ve.add(Mh(Xe.values[me]));else Ve.add(Me);let Be=!1;for(const me of Ve)if(!L.horizontal[me])if(Be)L.horizontal[me]=L.horizontal[0];else{const Ze=nc(F,i.glyphMap,i.glyphPositions,i.imagePositions,w,Ce,d,"center",me,ye,X,S.ai.horizontal,!1,A,I);Ze&&(L.horizontal[me]=Ze,Be=Ze.positionedLines.length===1)}$e()}else{Me==="auto"&&(Me=Mh(Le));const Ve=nc(F,i.glyphMap,i.glyphPositions,i.imagePositions,w,Ce,d,Le,Me,ye,X,S.ai.horizontal,!1,A,I);Ve&&(L.horizontal[Me]=Ve),$e(),Ca(ie)&&p&&f&&(L.vertical=nc(F,i.glyphMap,i.glyphPositions,i.imagePositions,w,Ce,d,Le,Me,ye,X,S.ai.vertical,!1,A,I))}}let se=!1;if(x.icon&&x.icon.name){const ie=i.imageMap[x.icon.name];ie&&(U=w_(i.imagePositions[x.icon.name],r.get("icon-offset").evaluate(x,{},i.canonical),r.get("icon-anchor").evaluate(x,{},i.canonical)),se=!!ie.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=se:i.bucket.sdfIcons!==se&&ci("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(ie.pixelRatio!==i.bucket.pixelRatio||r.get("icon-rotate").constantOr(1)!==0)&&(i.bucket.iconsNeedLinear=!0))}const K=np(L.horizontal)||L.vertical;i.bucket.iconsInText=!!K&&K.iconsInText,(K||U)&&O_(i.bucket,x,L,U,i.imageMap,l,A,M,X,se,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},S.bp=mh,S.bq=dh,S.br=fh,S.bs=Xn,S.bt=_h,S.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}},S.bv=function(i,e,r,s,l){return u(this,void 0,void 0,function*(){if(tt())try{return yield sn(i,e,r,s,l)}catch{}return function(d,p,f,g,x){const w=d.width,I=d.height;Ar&&Ai||(Ar=new OffscreenCanvas(w,I),Ai=Ar.getContext("2d",{willReadFrequently:!0})),Ar.width=w,Ar.height=I,Ai.drawImage(d,0,0,w,I);const A=Ai.getImageData(p,f,g,x);return Ai.clearRect(0,0,w,I),A.data}(i,e,r,s,l)})},S.bw=jd,S.bx=Ie,S.by=xe,S.bz=dd,S.c=An,S.d=i=>u(void 0,void 0,void 0,function*(){if(i.byteLength===0)return createImageBitmap(new ImageData(1,1));const e=new Blob([new Uint8Array(i)],{type:"image/png"});try{return createImageBitmap(e)}catch(r){throw new Error(`Could not load image because of ${r.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),S.e=St,S.f=i=>new Promise((e,r)=>{const s=new Image;s.onload=()=>{e(s),URL.revokeObjectURL(s.src),s.onload=null,window.requestAnimationFrame(()=>{s.src=Ns})},s.onerror=()=>r(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const l=new Blob([new Uint8Array(i)],{type:"image/png"});s.src=i.byteLength?URL.createObjectURL(l):Ns}),S.g=fr,S.h=(i,e)=>on(St(i,{type:"json"}),e),S.i=Er,S.j=jr,S.k=Nr,S.l=(i,e)=>on(St(i,{type:"arrayBuffer"}),e),S.m=on,S.n=function(i){return new _h(i).readFields(m_,[])},S.o=ja,S.p=vd,S.q=o,S.r=Wc,S.s=an,S.t=Ea,S.u=ze,S.v=ue,S.w=ci,S.x=Rr,S.y=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)}},S.z=ji}),Z("worker",["./shared"],function(S){class u{constructor(k){this.keyCache={},k&&this.replace(k)}replace(k){this._layerConfigs={},this._layers={},this.update(k,[])}update(k,C){for(const $ of k){this._layerConfigs[$.id]=$;const Y=this._layers[$.id]=S.aB($);Y._featureFilter=S.a7(Y.filter),this.keyCache[$.id]&&delete this.keyCache[$.id]}for(const $ of C)delete this.keyCache[$],delete this._layerConfigs[$],delete this._layers[$];this.familiesBySource={};const O=S.bj(Object.values(this._layerConfigs),this.keyCache);for(const $ of O){const Y=$.map(ce=>this._layers[ce.id]),te=Y[0];if(te.visibility==="none")continue;const re=te.source||"";let W=this.familiesBySource[re];W||(W=this.familiesBySource[re]={});const pe=te.sourceLayer||"_geojsonTileLayer";let _e=W[pe];_e||(_e=W[pe]=[]),_e.push(Y)}}}class Ie{constructor(k){const C={},O=[];for(const re in k){const W=k[re],pe=C[re]={};for(const _e in W){const ce=W[+_e];if(!ce||ce.bitmap.width===0||ce.bitmap.height===0)continue;const Pe={x:0,y:0,w:ce.bitmap.width+2,h:ce.bitmap.height+2};O.push(Pe),pe[_e]={rect:Pe,metrics:ce.metrics}}}const{w:$,h:Y}=S.p(O),te=new S.o({width:$||1,height:Y||1});for(const re in k){const W=k[re];for(const pe in W){const _e=W[+pe];if(!_e||_e.bitmap.width===0||_e.bitmap.height===0)continue;const ce=C[re][pe].rect;S.o.copy(_e.bitmap,te,{x:0,y:0},{x:ce.x+1,y:ce.y+1},_e.bitmap)}}this.image=te,this.positions=C}}S.bk("GlyphAtlas",Ie);class xe{constructor(k){this.tileID=new S.S(k.tileID.overscaledZ,k.tileID.wrap,k.tileID.canonical.z,k.tileID.canonical.x,k.tileID.canonical.y),this.uid=k.uid,this.zoom=k.zoom,this.pixelRatio=k.pixelRatio,this.tileSize=k.tileSize,this.source=k.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=k.showCollisionBoxes,this.collectResourceTiming=!!k.collectResourceTiming,this.returnDependencies=!!k.returnDependencies,this.promoteId=k.promoteId,this.inFlightDependencies=[]}parse(k,C,O,$){return S._(this,void 0,void 0,function*(){this.status="parsing",this.data=k,this.collisionBoxArray=new S.a5;const Y=new S.bl(Object.keys(k.layers).sort()),te=new S.bm(this.tileID,this.promoteId);te.bucketLayerIDs=[];const re={},W={featureIndex:te,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:O},pe=C.familiesBySource[this.source];for(const lt in pe){const bt=k.layers[lt];if(!bt)continue;bt.version===1&&S.w(`Vector tile source "${this.source}" layer "${lt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Vt=Y.encode(lt),ei=[];for(let hi=0;hi<bt.length;hi++){const ui=bt.feature(hi),ls=te.getId(ui,lt);ei.push({feature:ui,id:ls,index:hi,sourceLayerIndex:Vt})}for(const hi of pe[lt]){const ui=hi[0];ui.source!==this.source&&S.w(`layer.source = ${ui.source} does not equal this.source = ${this.source}`),ui.minzoom&&this.zoom<Math.floor(ui.minzoom)||ui.maxzoom&&this.zoom>=ui.maxzoom||ui.visibility!=="none"&&(we(hi,this.zoom,O),(re[ui.id]=ui.createBucket({index:te.bucketLayerIDs.length,layers:hi,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Vt,sourceID:this.source})).populate(ei,W,this.tileID.canonical),te.bucketLayerIDs.push(hi.map(ls=>ls.id)))}}const _e=S.aG(W.glyphDependencies,lt=>Object.keys(lt).map(Number));this.inFlightDependencies.forEach(lt=>lt==null?void 0:lt.abort()),this.inFlightDependencies=[];let ce=Promise.resolve({});if(Object.keys(_e).length){const lt=new AbortController;this.inFlightDependencies.push(lt),ce=$.sendAsync({type:"GG",data:{stacks:_e,source:this.source,tileID:this.tileID,type:"glyphs"}},lt)}const Pe=Object.keys(W.iconDependencies);let Ge=Promise.resolve({});if(Pe.length){const lt=new AbortController;this.inFlightDependencies.push(lt),Ge=$.sendAsync({type:"GI",data:{icons:Pe,source:this.source,tileID:this.tileID,type:"icons"}},lt)}const He=Object.keys(W.patternDependencies);let st=Promise.resolve({});if(He.length){const lt=new AbortController;this.inFlightDependencies.push(lt),st=$.sendAsync({type:"GI",data:{icons:He,source:this.source,tileID:this.tileID,type:"patterns"}},lt)}const[ft,nt,At]=yield Promise.all([ce,Ge,st]),qt=new Ie(ft),Kt=new S.bn(nt,At);for(const lt in re){const bt=re[lt];bt instanceof S.a6?(we(bt.layers,this.zoom,O),S.bo({bucket:bt,glyphMap:ft,glyphPositions:qt.positions,imageMap:nt,imagePositions:Kt.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):bt.hasPattern&&(bt instanceof S.bp||bt instanceof S.bq||bt instanceof S.br)&&(we(bt.layers,this.zoom,O),bt.addFeatures(W,this.tileID.canonical,Kt.patternPositions))}return this.status="done",{buckets:Object.values(re).filter(lt=>!lt.isEmpty()),featureIndex:te,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:qt.image,imageAtlas:Kt,glyphMap:this.returnDependencies?ft:null,iconMap:this.returnDependencies?nt:null,glyphPositions:this.returnDependencies?qt.positions:null}})}}function we(G,k,C){const O=new S.a9(k);for(const $ of G)$.recalculate(O,C)}class he{constructor(k,C,O){this.actor=k,this.layerIndex=C,this.availableImages=O,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(k,C){return S._(this,void 0,void 0,function*(){const O=yield S.l(k.request,C);try{return{vectorTile:new S.bs.VectorTile(new S.bt(O.data)),rawData:O.data,cacheControl:O.cacheControl,expires:O.expires}}catch($){const Y=new Uint8Array(O.data);let te=`Unable to parse the tile at ${k.request.url}, `;throw te+=Y[0]===31&&Y[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${$.message}`,new Error(te)}})}loadTile(k){return S._(this,void 0,void 0,function*(){const C=k.uid,O=!!(k&&k.request&&k.request.collectResourceTiming)&&new S.bu(k.request),$=new xe(k);this.loading[C]=$;const Y=new AbortController;$.abort=Y;try{const te=yield this.loadVectorTile(k,Y);if(delete this.loading[C],!te)return null;const re=te.rawData,W={};te.expires&&(W.expires=te.expires),te.cacheControl&&(W.cacheControl=te.cacheControl);const pe={};if(O){const ce=O.finish();ce&&(pe.resourceTiming=JSON.parse(JSON.stringify(ce)))}$.vectorTile=te.vectorTile;const _e=$.parse(te.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[C]=$,this.fetching[C]={rawTileData:re,cacheControl:W,resourceTiming:pe};try{const ce=yield _e;return S.e({rawTileData:re.slice(0)},ce,W,pe)}finally{delete this.fetching[C]}}catch(te){throw delete this.loading[C],$.status="done",this.loaded[C]=$,te}})}reloadTile(k){return S._(this,void 0,void 0,function*(){const C=k.uid;if(!this.loaded||!this.loaded[C])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const O=this.loaded[C];if(O.showCollisionBoxes=k.showCollisionBoxes,O.status==="parsing"){const $=yield O.parse(O.vectorTile,this.layerIndex,this.availableImages,this.actor);let Y;if(this.fetching[C]){const{rawTileData:te,cacheControl:re,resourceTiming:W}=this.fetching[C];delete this.fetching[C],Y=S.e({rawTileData:te.slice(0)},$,re,W)}else Y=$;return Y}if(O.status==="done"&&O.vectorTile)return O.parse(O.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(k){return S._(this,void 0,void 0,function*(){const C=this.loading,O=k.uid;C&&C[O]&&C[O].abort&&(C[O].abort.abort(),delete C[O])})}removeTile(k){return S._(this,void 0,void 0,function*(){this.loaded&&this.loaded[k.uid]&&delete this.loaded[k.uid]})}}class ae{constructor(){this.loaded={}}loadTile(k){return S._(this,void 0,void 0,function*(){const{uid:C,encoding:O,rawImageData:$,redFactor:Y,greenFactor:te,blueFactor:re,baseShift:W}=k,pe=$.width+2,_e=$.height+2,ce=S.b($)?new S.R({width:pe,height:_e},yield S.bv($,-1,-1,pe,_e)):$,Pe=new S.bw(C,ce,O,Y,te,re,W);return this.loaded=this.loaded||{},this.loaded[C]=Pe,Pe})}removeTile(k){const C=this.loaded,O=k.uid;C&&C[O]&&delete C[O]}}function dt(G,k){if(G.length!==0){je(G[0],k);for(var C=1;C<G.length;C++)je(G[C],!k)}}function je(G,k){for(var C=0,O=0,$=0,Y=G.length,te=Y-1;$<Y;te=$++){var re=(G[$][0]-G[te][0])*(G[te][1]+G[$][1]),W=C+re;O+=Math.abs(C)>=Math.abs(re)?C-W+re:re-W+C,C=W}C+O>=0!=!!k&&G.reverse()}var Ke=S.bx(function G(k,C){var O,$=k&&k.type;if($==="FeatureCollection")for(O=0;O<k.features.length;O++)G(k.features[O],C);else if($==="GeometryCollection")for(O=0;O<k.geometries.length;O++)G(k.geometries[O],C);else if($==="Feature")G(k.geometry,C);else if($==="Polygon")dt(k.coordinates,C);else if($==="MultiPolygon")for(O=0;O<k.coordinates.length;O++)dt(k.coordinates[O],C);return k});const Oe=S.bs.VectorTileFeature.prototype.toGeoJSON;var xt={exports:{}},tt=S.by,We=S.bs.VectorTileFeature,Ut=zt;function zt(G,k){this.options=k||{},this.features=G,this.length=G.length}function Et(G,k){this.id=typeof G.id=="number"?G.id:void 0,this.type=G.type,this.rawGeometry=G.type===1?[G.geometry]:G.geometry,this.properties=G.tags,this.extent=k||4096}zt.prototype.feature=function(G){return new Et(this.features[G],this.options.extent)},Et.prototype.loadGeometry=function(){var G=this.rawGeometry;this.geometry=[];for(var k=0;k<G.length;k++){for(var C=G[k],O=[],$=0;$<C.length;$++)O.push(new tt(C[$][0],C[$][1]));this.geometry.push(O)}return this.geometry},Et.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var G=this.geometry,k=1/0,C=-1/0,O=1/0,$=-1/0,Y=0;Y<G.length;Y++)for(var te=G[Y],re=0;re<te.length;re++){var W=te[re];k=Math.min(k,W.x),C=Math.max(C,W.x),O=Math.min(O,W.y),$=Math.max($,W.y)}return[k,O,C,$]},Et.prototype.toGeoJSON=We.prototype.toGeoJSON;var St=S.bz,Yi=Ut;function ri(G){var k=new St;return function(C,O){for(var $ in C.layers)O.writeMessage(3,Qi,C.layers[$])}(G,k),k.finish()}function Qi(G,k){var C;k.writeVarintField(15,G.version||1),k.writeStringField(1,G.name||""),k.writeVarintField(5,G.extent||4096);var O={keys:[],values:[],keycache:{},valuecache:{}};for(C=0;C<G.length;C++)O.feature=G.feature(C),k.writeMessage(2,vt,O);var $=O.keys;for(C=0;C<$.length;C++)k.writeStringField(3,$[C]);var Y=O.values;for(C=0;C<Y.length;C++)k.writeMessage(4,En,Y[C])}function vt(G,k){var C=G.feature;C.id!==void 0&&k.writeVarintField(1,C.id),k.writeMessage(2,Pn,G),k.writeVarintField(3,C.type),k.writeMessage(4,Er,C)}function Pn(G,k){var C=G.feature,O=G.keys,$=G.values,Y=G.keycache,te=G.valuecache;for(var re in C.properties){var W=C.properties[re],pe=Y[re];if(W!==null){pe===void 0&&(O.push(re),Y[re]=pe=O.length-1),k.writeVarint(pe);var _e=typeof W;_e!=="string"&&_e!=="boolean"&&_e!=="number"&&(W=JSON.stringify(W));var ce=_e+":"+W,Pe=te[ce];Pe===void 0&&($.push(W),te[ce]=Pe=$.length-1),k.writeVarint(Pe)}}}function ci(G,k){return(k<<3)+(7&G)}function wi(G){return G<<1^G>>31}function Er(G,k){for(var C=G.loadGeometry(),O=G.type,$=0,Y=0,te=C.length,re=0;re<te;re++){var W=C[re],pe=1;O===1&&(pe=W.length),k.writeVarint(ci(1,pe));for(var _e=O===3?W.length-1:W.length,ce=0;ce<_e;ce++){ce===1&&O!==1&&k.writeVarint(ci(2,_e-1));var Pe=W[ce].x-$,Ge=W[ce].y-Y;k.writeVarint(wi(Pe)),k.writeVarint(wi(Ge)),$+=Pe,Y+=Ge}O===3&&k.writeVarint(ci(7,1))}}function En(G,k){var C=typeof G;C==="string"?k.writeStringField(1,G):C==="boolean"?k.writeBooleanField(7,G):C==="number"&&(G%1!=0?k.writeDoubleField(3,G):G<0?k.writeSVarintField(6,G):k.writeVarintField(5,G))}xt.exports=ri,xt.exports.fromVectorTileJs=ri,xt.exports.fromGeojsonVt=function(G,k){k=k||{};var C={};for(var O in G)C[O]=new Yi(G[O].features,k),C[O].name=O,C[O].version=k.version,C[O].extent=k.extent;return ri({layers:C})},xt.exports.GeoJSONWrapper=Yi;var pr=S.bx(xt.exports);const Ns={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:G=>G},sn=Math.fround||(Ar=new Float32Array(1),G=>(Ar[0]=+G,Ar[0]));var Ar;const Ai=3,er=5,An=6;class Vr{constructor(k){this.options=Object.assign(Object.create(Ns),k),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(k){const{log:C,minZoom:O,maxZoom:$}=this.options;C&&console.time("total time");const Y=`prepare ${k.length} points`;C&&console.time(Y),this.points=k;const te=[];for(let W=0;W<k.length;W++){const pe=k[W];if(!pe.geometry)continue;const[_e,ce]=pe.geometry.coordinates,Pe=sn(Fi(_e)),Ge=sn(tr(ce));te.push(Pe,Ge,1/0,W,-1,1),this.options.reduce&&te.push(0)}let re=this.trees[$+1]=this._createTree(te);C&&console.timeEnd(Y);for(let W=$;W>=O;W--){const pe=+Date.now();re=this.trees[W]=this._createTree(this._cluster(re,W)),C&&console.log("z%d: %d clusters in %dms",W,re.numItems,+Date.now()-pe)}return C&&console.timeEnd("total time"),this}getClusters(k,C){let O=((k[0]+180)%360+360)%360-180;const $=Math.max(-90,Math.min(90,k[1]));let Y=k[2]===180?180:((k[2]+180)%360+360)%360-180;const te=Math.max(-90,Math.min(90,k[3]));if(k[2]-k[0]>=360)O=-180,Y=180;else if(O>Y){const ce=this.getClusters([O,$,180,te],C),Pe=this.getClusters([-180,$,Y,te],C);return ce.concat(Pe)}const re=this.trees[this._limitZoom(C)],W=re.range(Fi(O),tr(te),Fi(Y),tr($)),pe=re.data,_e=[];for(const ce of W){const Pe=this.stride*ce;_e.push(pe[Pe+er]>1?fr(pe,Pe,this.clusterProps):this.points[pe[Pe+Ai]])}return _e}getChildren(k){const C=this._getOriginId(k),O=this._getOriginZoom(k),$="No cluster with the specified id.",Y=this.trees[O];if(!Y)throw new Error($);const te=Y.data;if(C*this.stride>=te.length)throw new Error($);const re=this.options.radius/(this.options.extent*Math.pow(2,O-1)),W=Y.within(te[C*this.stride],te[C*this.stride+1],re),pe=[];for(const _e of W){const ce=_e*this.stride;te[ce+4]===k&&pe.push(te[ce+er]>1?fr(te,ce,this.clusterProps):this.points[te[ce+Ai]])}if(pe.length===0)throw new Error($);return pe}getLeaves(k,C,O){const $=[];return this._appendLeaves($,k,C=C||10,O=O||0,0),$}getTile(k,C,O){const $=this.trees[this._limitZoom(k)],Y=Math.pow(2,k),{extent:te,radius:re}=this.options,W=re/te,pe=(O-W)/Y,_e=(O+1+W)/Y,ce={features:[]};return this._addTileFeatures($.range((C-W)/Y,pe,(C+1+W)/Y,_e),$.data,C,O,Y,ce),C===0&&this._addTileFeatures($.range(1-W/Y,pe,1,_e),$.data,Y,O,Y,ce),C===Y-1&&this._addTileFeatures($.range(0,pe,W/Y,_e),$.data,-1,O,Y,ce),ce.features.length?ce:null}getClusterExpansionZoom(k){let C=this._getOriginZoom(k)-1;for(;C<=this.options.maxZoom;){const O=this.getChildren(k);if(C++,O.length!==1)break;k=O[0].properties.cluster_id}return C}_appendLeaves(k,C,O,$,Y){const te=this.getChildren(C);for(const re of te){const W=re.properties;if(W&&W.cluster?Y+W.point_count<=$?Y+=W.point_count:Y=this._appendLeaves(k,W.cluster_id,O,$,Y):Y<$?Y++:k.push(re),k.length===O)break}return Y}_createTree(k){const C=new S.aw(k.length/this.stride|0,this.options.nodeSize,Float32Array);for(let O=0;O<k.length;O+=this.stride)C.add(k[O],k[O+1]);return C.finish(),C.data=k,C}_addTileFeatures(k,C,O,$,Y,te){for(const re of k){const W=re*this.stride,pe=C[W+er]>1;let _e,ce,Pe;if(pe)_e=Cn(C,W,this.clusterProps),ce=C[W],Pe=C[W+1];else{const st=this.points[C[W+Ai]];_e=st.properties;const[ft,nt]=st.geometry.coordinates;ce=Fi(ft),Pe=tr(nt)}const Ge={type:1,geometry:[[Math.round(this.options.extent*(ce*Y-O)),Math.round(this.options.extent*(Pe*Y-$))]],tags:_e};let He;He=pe||this.options.generateId?C[W+Ai]:this.points[C[W+Ai]].id,He!==void 0&&(Ge.id=He),te.features.push(Ge)}}_limitZoom(k){return Math.max(this.options.minZoom,Math.min(Math.floor(+k),this.options.maxZoom+1))}_cluster(k,C){const{radius:O,extent:$,reduce:Y,minPoints:te}=this.options,re=O/($*Math.pow(2,C)),W=k.data,pe=[],_e=this.stride;for(let ce=0;ce<W.length;ce+=_e){if(W[ce+2]<=C)continue;W[ce+2]=C;const Pe=W[ce],Ge=W[ce+1],He=k.within(W[ce],W[ce+1],re),st=W[ce+er];let ft=st;for(const nt of He){const At=nt*_e;W[At+2]>C&&(ft+=W[At+er])}if(ft>st&&ft>=te){let nt,At=Pe*st,qt=Ge*st,Kt=-1;const lt=((ce/_e|0)<<5)+(C+1)+this.points.length;for(const bt of He){const Vt=bt*_e;if(W[Vt+2]<=C)continue;W[Vt+2]=C;const ei=W[Vt+er];At+=W[Vt]*ei,qt+=W[Vt+1]*ei,W[Vt+4]=lt,Y&&(nt||(nt=this._map(W,ce,!0),Kt=this.clusterProps.length,this.clusterProps.push(nt)),Y(nt,this._map(W,Vt)))}W[ce+4]=lt,pe.push(At/ft,qt/ft,1/0,lt,-1,ft),Y&&pe.push(Kt)}else{for(let nt=0;nt<_e;nt++)pe.push(W[ce+nt]);if(ft>1)for(const nt of He){const At=nt*_e;if(!(W[At+2]<=C)){W[At+2]=C;for(let qt=0;qt<_e;qt++)pe.push(W[At+qt])}}}}return pe}_getOriginId(k){return k-this.points.length>>5}_getOriginZoom(k){return(k-this.points.length)%32}_map(k,C,O){if(k[C+er]>1){const te=this.clusterProps[k[C+An]];return O?Object.assign({},te):te}const $=this.points[k[C+Ai]].properties,Y=this.options.map($);return O&&Y===$?Object.assign({},Y):Y}}function fr(G,k,C){return{type:"Feature",id:G[k+Ai],properties:Cn(G,k,C),geometry:{type:"Point",coordinates:[(O=G[k],360*(O-.5)),on(G[k+1])]}};var O}function Cn(G,k,C){const O=G[k+er],$=O>=1e4?`${Math.round(O/1e3)}k`:O>=1e3?Math.round(O/100)/10+"k":O,Y=G[k+An],te=Y===-1?{}:Object.assign({},C[Y]);return Object.assign(te,{cluster:!0,cluster_id:G[k+Ai],point_count:O,point_count_abbreviated:$})}function Fi(G){return G/360+.5}function tr(G){const k=Math.sin(G*Math.PI/180),C=.5-.25*Math.log((1+k)/(1-k))/Math.PI;return C<0?0:C>1?1:C}function on(G){const k=(180-360*G)*Math.PI/180;return 360*Math.atan(Math.exp(k))/Math.PI-90}function an(G,k,C,O){let $=O;const Y=k+(C-k>>1);let te,re=C-k;const W=G[k],pe=G[k+1],_e=G[C],ce=G[C+1];for(let Pe=k+3;Pe<C;Pe+=3){const Ge=rs(G[Pe],G[Pe+1],W,pe,_e,ce);if(Ge>$)te=Pe,$=Ge;else if(Ge===$){const He=Math.abs(Pe-Y);He<re&&(te=Pe,re=He)}}$>O&&(te-k>3&&an(G,k,te,O),G[te+2]=$,C-te>3&&an(G,te,C,O))}function rs(G,k,C,O,$,Y){let te=$-C,re=Y-O;if(te!==0||re!==0){const W=((G-C)*te+(k-O)*re)/(te*te+re*re);W>1?(C=$,O=Y):W>0&&(C+=te*W,O+=re*W)}return te=G-C,re=k-O,te*te+re*re}function Cr(G,k,C,O){const $={id:G??null,type:k,geometry:C,tags:O,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(k==="Point"||k==="MultiPoint"||k==="LineString")Nr($,C);else if(k==="Polygon")Nr($,C[0]);else if(k==="MultiLineString")for(const Y of C)Nr($,Y);else if(k==="MultiPolygon")for(const Y of C)Nr($,Y[0]);return $}function Nr(G,k){for(let C=0;C<k.length;C+=3)G.minX=Math.min(G.minX,k[C]),G.minY=Math.min(G.minY,k[C+1]),G.maxX=Math.max(G.maxX,k[C]),G.maxY=Math.max(G.maxY,k[C+1])}function jr(G,k,C,O){if(!k.geometry)return;const $=k.geometry.coordinates;if($&&$.length===0)return;const Y=k.geometry.type,te=Math.pow(C.tolerance/((1<<C.maxZoom)*C.extent),2);let re=[],W=k.id;if(C.promoteId?W=k.properties[C.promoteId]:C.generateId&&(W=O||0),Y==="Point")kn($,re);else if(Y==="MultiPoint")for(const pe of $)kn(pe,re);else if(Y==="LineString")ue($,re,te,!1);else if(Y==="MultiLineString"){if(C.lineMetrics){for(const pe of $)re=[],ue(pe,re,te,!1),G.push(Cr(W,"LineString",re,k.properties));return}ln($,re,te,!1)}else if(Y==="Polygon")ln($,re,te,!0);else{if(Y!=="MultiPolygon"){if(Y==="GeometryCollection"){for(const pe of k.geometry.geometries)jr(G,{id:W,geometry:pe,properties:k.properties},C,O);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const pe of $){const _e=[];ln(pe,_e,te,!0),re.push(_e)}}G.push(Cr(W,Y,re,k.properties))}function kn(G,k){k.push(ns(G[0]),_t(G[1]),0)}function ue(G,k,C,O){let $,Y,te=0;for(let W=0;W<G.length;W++){const pe=ns(G[W][0]),_e=_t(G[W][1]);k.push(pe,_e,0),W>0&&(te+=O?($*_e-pe*Y)/2:Math.sqrt(Math.pow(pe-$,2)+Math.pow(_e-Y,2))),$=pe,Y=_e}const re=k.length-3;k[2]=1,an(k,0,re,C),k[re+2]=1,k.size=Math.abs(te),k.start=0,k.end=k.size}function ln(G,k,C,O){for(let $=0;$<G.length;$++){const Y=[];ue(G[$],Y,C,O),k.push(Y)}}function ns(G){return G/360+.5}function _t(G){const k=Math.sin(G*Math.PI/180),C=.5-.25*Math.log((1+k)/(1-k))/Math.PI;return C<0?0:C>1?1:C}function $t(G,k,C,O,$,Y,te,re){if(O/=k,Y>=(C/=k)&&te<O)return G;if(te<C||Y>=O)return null;const W=[];for(const pe of G){const _e=pe.geometry;let ce=pe.type;const Pe=$===0?pe.minX:pe.minY,Ge=$===0?pe.maxX:pe.maxY;if(Pe>=C&&Ge<O){W.push(pe);continue}if(Ge<C||Pe>=O)continue;let He=[];if(ce==="Point"||ce==="MultiPoint")ss(_e,He,C,O,$);else if(ce==="LineString")Ur(_e,He,C,O,$,!1,re.lineMetrics);else if(ce==="MultiLineString")Mn(_e,He,C,O,$,!1);else if(ce==="Polygon")Mn(_e,He,C,O,$,!0);else if(ce==="MultiPolygon")for(const st of _e){const ft=[];Mn(st,ft,C,O,$,!0),ft.length&&He.push(ft)}if(He.length){if(re.lineMetrics&&ce==="LineString"){for(const st of He)W.push(Cr(pe.id,ce,st,pe.tags));continue}ce!=="LineString"&&ce!=="MultiLineString"||(He.length===1?(ce="LineString",He=He[0]):ce="MultiLineString"),ce!=="Point"&&ce!=="MultiPoint"||(ce=He.length===3?"Point":"MultiPoint"),W.push(Cr(pe.id,ce,He,pe.tags))}}return W.length?W:null}function ss(G,k,C,O,$){for(let Y=0;Y<G.length;Y+=3){const te=G[Y+$];te>=C&&te<=O&&Hi(k,G[Y],G[Y+1],G[Y+2])}}function Ur(G,k,C,O,$,Y,te){let re=kr(G);const W=$===0?os:as;let pe,_e,ce=G.start;for(let ft=0;ft<G.length-3;ft+=3){const nt=G[ft],At=G[ft+1],qt=G[ft+2],Kt=G[ft+3],lt=G[ft+4],bt=$===0?nt:At,Vt=$===0?Kt:lt;let ei=!1;te&&(pe=Math.sqrt(Math.pow(nt-Kt,2)+Math.pow(At-lt,2))),bt<C?Vt>C&&(_e=W(re,nt,At,Kt,lt,C),te&&(re.start=ce+pe*_e)):bt>O?Vt<O&&(_e=W(re,nt,At,Kt,lt,O),te&&(re.start=ce+pe*_e)):Hi(re,nt,At,qt),Vt<C&&bt>=C&&(_e=W(re,nt,At,Kt,lt,C),ei=!0),Vt>O&&bt<=O&&(_e=W(re,nt,At,Kt,lt,O),ei=!0),!Y&&ei&&(te&&(re.end=ce+pe*_e),k.push(re),re=kr(G)),te&&(ce+=pe)}let Pe=G.length-3;const Ge=G[Pe],He=G[Pe+1],st=$===0?Ge:He;st>=C&&st<=O&&Hi(re,Ge,He,G[Pe+2]),Pe=re.length-3,Y&&Pe>=3&&(re[Pe]!==re[0]||re[Pe+1]!==re[1])&&Hi(re,re[0],re[1],re[2]),re.length&&k.push(re)}function kr(G){const k=[];return k.size=G.size,k.start=G.start,k.end=G.end,k}function Mn(G,k,C,O,$,Y){for(const te of G)Ur(te,k,C,O,$,Y,!1)}function Hi(G,k,C,O){G.push(k,C,O)}function os(G,k,C,O,$,Y){const te=(Y-k)/(O-k);return Hi(G,Y,C+($-C)*te,1),te}function as(G,k,C,O,$,Y){const te=(Y-C)/($-C);return Hi(G,k+(O-k)*te,Y,1),te}function Te(G,k){const C=[];for(let O=0;O<G.length;O++){const $=G[O],Y=$.type;let te;if(Y==="Point"||Y==="MultiPoint"||Y==="LineString")te=mr($.geometry,k);else if(Y==="MultiLineString"||Y==="Polygon"){te=[];for(const re of $.geometry)te.push(mr(re,k))}else if(Y==="MultiPolygon"){te=[];for(const re of $.geometry){const W=[];for(const pe of re)W.push(mr(pe,k));te.push(W)}}C.push(Cr($.id,Y,te,$.tags))}return C}function mr(G,k){const C=[];C.size=G.size,G.start!==void 0&&(C.start=G.start,C.end=G.end);for(let O=0;O<G.length;O+=3)C.push(G[O]+k,G[O+1],G[O+2]);return C}function Si(G,k){if(G.transformed)return G;const C=1<<G.z,O=G.x,$=G.y;for(const Y of G.features){const te=Y.geometry,re=Y.type;if(Y.geometry=[],re===1)for(let W=0;W<te.length;W+=2)Y.geometry.push(gr(te[W],te[W+1],k,C,O,$));else for(let W=0;W<te.length;W++){const pe=[];for(let _e=0;_e<te[W].length;_e+=2)pe.push(gr(te[W][_e],te[W][_e+1],k,C,O,$));Y.geometry.push(pe)}}return G.transformed=!0,G}function gr(G,k,C,O,$,Y){return[Math.round(C*(G*O-$)),Math.round(C*(k*O-Y))]}function $r(G,k,C,O,$){const Y=k===$.maxZoom?0:$.tolerance/((1<<k)*$.extent),te={features:[],numPoints:0,numSimplified:0,numFeatures:G.length,source:null,x:C,y:O,z:k,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const re of G)Ae(te,re,Y,$);return te}function Ae(G,k,C,O){const $=k.geometry,Y=k.type,te=[];if(G.minX=Math.min(G.minX,k.minX),G.minY=Math.min(G.minY,k.minY),G.maxX=Math.max(G.maxX,k.maxX),G.maxY=Math.max(G.maxY,k.maxY),Y==="Point"||Y==="MultiPoint")for(let re=0;re<$.length;re+=3)te.push($[re],$[re+1]),G.numPoints++,G.numSimplified++;else if(Y==="LineString")at(te,$,G,C,!1,!1);else if(Y==="MultiLineString"||Y==="Polygon")for(let re=0;re<$.length;re++)at(te,$[re],G,C,Y==="Polygon",re===0);else if(Y==="MultiPolygon")for(let re=0;re<$.length;re++){const W=$[re];for(let pe=0;pe<W.length;pe++)at(te,W[pe],G,C,!0,pe===0)}if(te.length){let re=k.tags||null;if(Y==="LineString"&&O.lineMetrics){re={};for(const pe in k.tags)re[pe]=k.tags[pe];re.mapbox_clip_start=$.start/$.size,re.mapbox_clip_end=$.end/$.size}const W={geometry:te,type:Y==="Polygon"||Y==="MultiPolygon"?3:Y==="LineString"||Y==="MultiLineString"?2:1,tags:re};k.id!==null&&(W.id=k.id),G.features.push(W)}}function at(G,k,C,O,$,Y){const te=O*O;if(O>0&&k.size<($?te:O))return void(C.numPoints+=k.length/3);const re=[];for(let W=0;W<k.length;W+=3)(O===0||k[W+2]>te)&&(C.numSimplified++,re.push(k[W],k[W+1])),C.numPoints++;$&&function(W,pe){let _e=0;for(let ce=0,Pe=W.length,Ge=Pe-2;ce<Pe;Ge=ce,ce+=2)_e+=(W[ce]-W[Ge])*(W[ce+1]+W[Ge+1]);if(_e>0===pe)for(let ce=0,Pe=W.length;ce<Pe/2;ce+=2){const Ge=W[ce],He=W[ce+1];W[ce]=W[Pe-2-ce],W[ce+1]=W[Pe-1-ce],W[Pe-2-ce]=Ge,W[Pe-1-ce]=He}}(re,Y),G.push(re)}const Ye={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Ci{constructor(k,C){const O=(C=this.options=function(Y,te){for(const re in te)Y[re]=te[re];return Y}(Object.create(Ye),C)).debug;if(O&&console.time("preprocess data"),C.maxZoom<0||C.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(C.promoteId&&C.generateId)throw new Error("promoteId and generateId cannot be used together.");let $=function(Y,te){const re=[];if(Y.type==="FeatureCollection")for(let W=0;W<Y.features.length;W++)jr(re,Y.features[W],te,W);else jr(re,Y.type==="Feature"?Y:{geometry:Y},te);return re}(k,C);this.tiles={},this.tileCoords=[],O&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",C.indexMaxZoom,C.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),$=function(Y,te){const re=te.buffer/te.extent;let W=Y;const pe=$t(Y,1,-1-re,re,0,-1,2,te),_e=$t(Y,1,1-re,2+re,0,-1,2,te);return(pe||_e)&&(W=$t(Y,1,-re,1+re,0,-1,2,te)||[],pe&&(W=Te(pe,1).concat(W)),_e&&(W=W.concat(Te(_e,-1)))),W}($,C),$.length&&this.splitTile($,0,0,0),O&&($.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(k,C,O,$,Y,te,re){const W=[k,C,O,$],pe=this.options,_e=pe.debug;for(;W.length;){$=W.pop(),O=W.pop(),C=W.pop(),k=W.pop();const ce=1<<C,Pe=ir(C,O,$);let Ge=this.tiles[Pe];if(!Ge&&(_e>1&&console.time("creation"),Ge=this.tiles[Pe]=$r(k,C,O,$,pe),this.tileCoords.push({z:C,x:O,y:$}),_e)){_e>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",C,O,$,Ge.numFeatures,Ge.numPoints,Ge.numSimplified),console.timeEnd("creation"));const ei=`z${C}`;this.stats[ei]=(this.stats[ei]||0)+1,this.total++}if(Ge.source=k,Y==null){if(C===pe.indexMaxZoom||Ge.numPoints<=pe.indexMaxPoints)continue}else{if(C===pe.maxZoom||C===Y)continue;if(Y!=null){const ei=Y-C;if(O!==te>>ei||$!==re>>ei)continue}}if(Ge.source=null,k.length===0)continue;_e>1&&console.time("clipping");const He=.5*pe.buffer/pe.extent,st=.5-He,ft=.5+He,nt=1+He;let At=null,qt=null,Kt=null,lt=null,bt=$t(k,ce,O-He,O+ft,0,Ge.minX,Ge.maxX,pe),Vt=$t(k,ce,O+st,O+nt,0,Ge.minX,Ge.maxX,pe);k=null,bt&&(At=$t(bt,ce,$-He,$+ft,1,Ge.minY,Ge.maxY,pe),qt=$t(bt,ce,$+st,$+nt,1,Ge.minY,Ge.maxY,pe),bt=null),Vt&&(Kt=$t(Vt,ce,$-He,$+ft,1,Ge.minY,Ge.maxY,pe),lt=$t(Vt,ce,$+st,$+nt,1,Ge.minY,Ge.maxY,pe),Vt=null),_e>1&&console.timeEnd("clipping"),W.push(At||[],C+1,2*O,2*$),W.push(qt||[],C+1,2*O,2*$+1),W.push(Kt||[],C+1,2*O+1,2*$),W.push(lt||[],C+1,2*O+1,2*$+1)}}getTile(k,C,O){k=+k,C=+C,O=+O;const $=this.options,{extent:Y,debug:te}=$;if(k<0||k>24)return null;const re=1<<k,W=ir(k,C=C+re&re-1,O);if(this.tiles[W])return Si(this.tiles[W],Y);te>1&&console.log("drilling down to z%d-%d-%d",k,C,O);let pe,_e=k,ce=C,Pe=O;for(;!pe&&_e>0;)_e--,ce>>=1,Pe>>=1,pe=this.tiles[ir(_e,ce,Pe)];return pe&&pe.source?(te>1&&(console.log("found parent tile z%d-%d-%d",_e,ce,Pe),console.time("drilling down")),this.splitTile(pe.source,_e,ce,Pe,k,C,O),te>1&&console.timeEnd("drilling down"),this.tiles[W]?Si(this.tiles[W],Y):null):null}}function ir(G,k,C){return 32*((1<<G)*C+k)+G}function rt(G,k){return k?G.properties[k]:G.id}function _r(G,k){if(G==null)return!0;if(G.type==="Feature")return rt(G,k)!=null;if(G.type==="FeatureCollection"){const C=new Set;for(const O of G.features){const $=rt(O,k);if($==null||C.has($))return!1;C.add($)}return!0}return!1}function Mr(G,k){const C=new Map;if(G!=null)if(G.type==="Feature")C.set(rt(G,k),G);else for(const O of G.features)C.set(rt(O,k),O);return C}class qr extends he{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(k,C){return S._(this,void 0,void 0,function*(){const O=k.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const $=this._geoJSONIndex.getTile(O.z,O.x,O.y);if(!$)return null;const Y=new class{constructor(re){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=S.X,this.length=re.length,this._features=re}feature(re){return new class{constructor(W){this._feature=W,this.extent=S.X,this.type=W.type,this.properties=W.tags,"id"in W&&!isNaN(W.id)&&(this.id=parseInt(W.id,10))}loadGeometry(){if(this._feature.type===1){const W=[];for(const pe of this._feature.geometry)W.push([new S.P(pe[0],pe[1])]);return W}{const W=[];for(const pe of this._feature.geometry){const _e=[];for(const ce of pe)_e.push(new S.P(ce[0],ce[1]));W.push(_e)}return W}}toGeoJSON(W,pe,_e){return Oe.call(this,W,pe,_e)}}(this._features[re])}}($.features);let te=pr(Y);return te.byteOffset===0&&te.byteLength===te.buffer.byteLength||(te=new Uint8Array(te)),{vectorTile:Y,rawData:te.buffer}})}loadData(k){return S._(this,void 0,void 0,function*(){var C;(C=this._pendingRequest)===null||C===void 0||C.abort();const O=!!(k&&k.request&&k.request.collectResourceTiming)&&new S.bu(k.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(k,this._pendingRequest),this._geoJSONIndex=k.cluster?new Vr(function({superclusterOptions:te,clusterProperties:re}){if(!re||!te)return te;const W={},pe={},_e={accumulated:null,zoom:0},ce={properties:null},Pe=Object.keys(re);for(const Ge of Pe){const[He,st]=re[Ge],ft=S.bB(st),nt=S.bB(typeof He=="string"?[He,["accumulated"],["get",Ge]]:He);W[Ge]=ft.value,pe[Ge]=nt.value}return te.map=Ge=>{ce.properties=Ge;const He={};for(const st of Pe)He[st]=W[st].evaluate(_e,ce);return He},te.reduce=(Ge,He)=>{ce.properties=He;for(const st of Pe)_e.accumulated=Ge[st],Ge[st]=pe[st].evaluate(_e,ce)},te}(k)).load((yield this._pendingData).features):($=yield this._pendingData,new Ci($,k.geojsonVtOptions)),this.loaded={};const Y={};if(O){const te=O.finish();te&&(Y.resourceTiming={},Y.resourceTiming[k.source]=JSON.parse(JSON.stringify(te)))}return Y}catch(Y){if(delete this._pendingRequest,S.bA(Y))return{abandoned:!0};throw Y}var $})}getData(){return S._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(k){const C=this.loaded;return C&&C[k.uid]?super.reloadTile(k):this.loadTile(k)}loadAndProcessGeoJSON(k,C){return S._(this,void 0,void 0,function*(){let O=yield this.loadGeoJSON(k,C);if(delete this._pendingRequest,typeof O!="object")throw new Error(`Input data given to '${k.source}' is not a valid GeoJSON object.`);if(Ke(O,!0),k.filter){const $=S.bB(k.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if($.result==="error")throw new Error($.value.map(te=>`${te.key}: ${te.message}`).join(", "));O={type:"FeatureCollection",features:O.features.filter(te=>$.value.evaluate({zoom:0},te))}}return O})}loadGeoJSON(k,C){return S._(this,void 0,void 0,function*(){const{promoteId:O}=k;if(k.request){const $=yield S.h(k.request,C);return this._dataUpdateable=_r($.data,O)?Mr($.data,O):void 0,$.data}if(typeof k.data=="string")try{const $=JSON.parse(k.data);return this._dataUpdateable=_r($,O)?Mr($,O):void 0,$}catch{throw new Error(`Input data given to '${k.source}' is not a valid GeoJSON object.`)}if(!k.dataDiff)throw new Error(`Input data given to '${k.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${k.source}`);return function($,Y,te){var re,W,pe,_e;if(Y.removeAll&&$.clear(),Y.remove)for(const ce of Y.remove)$.delete(ce);if(Y.add)for(const ce of Y.add){const Pe=rt(ce,te);Pe!=null&&$.set(Pe,ce)}if(Y.update)for(const ce of Y.update){let Pe=$.get(ce.id);if(Pe==null)continue;const Ge=!ce.removeAllProperties&&(((re=ce.removeProperties)===null||re===void 0?void 0:re.length)>0||((W=ce.addOrUpdateProperties)===null||W===void 0?void 0:W.length)>0);if((ce.newGeometry||ce.removeAllProperties||Ge)&&(Pe=Object.assign({},Pe),$.set(ce.id,Pe),Ge&&(Pe.properties=Object.assign({},Pe.properties))),ce.newGeometry&&(Pe.geometry=ce.newGeometry),ce.removeAllProperties)Pe.properties={};else if(((pe=ce.removeProperties)===null||pe===void 0?void 0:pe.length)>0)for(const He of ce.removeProperties)Object.prototype.hasOwnProperty.call(Pe.properties,He)&&delete Pe.properties[He];if(((_e=ce.addOrUpdateProperties)===null||_e===void 0?void 0:_e.length)>0)for(const{key:He,value:st}of ce.addOrUpdateProperties)Pe.properties[He]=st}}(this._dataUpdateable,k.dataDiff,O),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(k){return S._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(k){return this._geoJSONIndex.getClusterExpansionZoom(k.clusterId)}getClusterChildren(k){return this._geoJSONIndex.getChildren(k.clusterId)}getClusterLeaves(k){return this._geoJSONIndex.getLeaves(k.clusterId,k.limit,k.offset)}}class yr{constructor(k){this.self=k,this.actor=new S.F(k),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(C,O)=>{if(this.externalWorkerSourceTypes[C])throw new Error(`Worker source with name "${C}" already registered.`);this.externalWorkerSourceTypes[C]=O},this.self.addProtocol=S.bh,this.self.removeProtocol=S.bi,this.self.registerRTLTextPlugin=C=>{if(S.bC.isParsed())throw new Error("RTL text plugin already registered.");S.bC.setMethods(C)},this.actor.registerMessageHandler("LDT",(C,O)=>this._getDEMWorkerSource(C,O.source).loadTile(O)),this.actor.registerMessageHandler("RDT",(C,O)=>S._(this,void 0,void 0,function*(){this._getDEMWorkerSource(C,O.source).removeTile(O)})),this.actor.registerMessageHandler("GCEZ",(C,O)=>S._(this,void 0,void 0,function*(){return this._getWorkerSource(C,O.type,O.source).getClusterExpansionZoom(O)})),this.actor.registerMessageHandler("GCC",(C,O)=>S._(this,void 0,void 0,function*(){return this._getWorkerSource(C,O.type,O.source).getClusterChildren(O)})),this.actor.registerMessageHandler("GCL",(C,O)=>S._(this,void 0,void 0,function*(){return this._getWorkerSource(C,O.type,O.source).getClusterLeaves(O)})),this.actor.registerMessageHandler("LD",(C,O)=>this._getWorkerSource(C,O.type,O.source).loadData(O)),this.actor.registerMessageHandler("GD",(C,O)=>this._getWorkerSource(C,O.type,O.source).getData()),this.actor.registerMessageHandler("LT",(C,O)=>this._getWorkerSource(C,O.type,O.source).loadTile(O)),this.actor.registerMessageHandler("RT",(C,O)=>this._getWorkerSource(C,O.type,O.source).reloadTile(O)),this.actor.registerMessageHandler("AT",(C,O)=>this._getWorkerSource(C,O.type,O.source).abortTile(O)),this.actor.registerMessageHandler("RMT",(C,O)=>this._getWorkerSource(C,O.type,O.source).removeTile(O)),this.actor.registerMessageHandler("RS",(C,O)=>S._(this,void 0,void 0,function*(){if(!this.workerSources[C]||!this.workerSources[C][O.type]||!this.workerSources[C][O.type][O.source])return;const $=this.workerSources[C][O.type][O.source];delete this.workerSources[C][O.type][O.source],$.removeSource!==void 0&&$.removeSource(O)})),this.actor.registerMessageHandler("RM",C=>S._(this,void 0,void 0,function*(){delete this.layerIndexes[C],delete this.availableImages[C],delete this.workerSources[C],delete this.demWorkerSources[C]})),this.actor.registerMessageHandler("SR",(C,O)=>S._(this,void 0,void 0,function*(){this.referrer=O})),this.actor.registerMessageHandler("SRPS",(C,O)=>this._syncRTLPluginState(C,O)),this.actor.registerMessageHandler("IS",(C,O)=>S._(this,void 0,void 0,function*(){this.self.importScripts(O)})),this.actor.registerMessageHandler("SI",(C,O)=>this._setImages(C,O)),this.actor.registerMessageHandler("UL",(C,O)=>S._(this,void 0,void 0,function*(){this._getLayerIndex(C).update(O.layers,O.removedIds)})),this.actor.registerMessageHandler("SL",(C,O)=>S._(this,void 0,void 0,function*(){this._getLayerIndex(C).replace(O)}))}_setImages(k,C){return S._(this,void 0,void 0,function*(){this.availableImages[k]=C;for(const O in this.workerSources[k]){const $=this.workerSources[k][O];for(const Y in $)$[Y].availableImages=C}})}_syncRTLPluginState(k,C){return S._(this,void 0,void 0,function*(){if(S.bC.isParsed())return S.bC.getState();if(C.pluginStatus!=="loading")return S.bC.setState(C),C;const O=C.pluginURL;if(this.self.importScripts(O),S.bC.isParsed()){const $={pluginStatus:"loaded",pluginURL:O};return S.bC.setState($),$}throw S.bC.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${O}`)})}_getAvailableImages(k){let C=this.availableImages[k];return C||(C=[]),C}_getLayerIndex(k){let C=this.layerIndexes[k];return C||(C=this.layerIndexes[k]=new u),C}_getWorkerSource(k,C,O){if(this.workerSources[k]||(this.workerSources[k]={}),this.workerSources[k][C]||(this.workerSources[k][C]={}),!this.workerSources[k][C][O]){const $={sendAsync:(Y,te)=>(Y.targetMapId=k,this.actor.sendAsync(Y,te))};switch(C){case"vector":this.workerSources[k][C][O]=new he($,this._getLayerIndex(k),this._getAvailableImages(k));break;case"geojson":this.workerSources[k][C][O]=new qr($,this._getLayerIndex(k),this._getAvailableImages(k));break;default:this.workerSources[k][C][O]=new this.externalWorkerSourceTypes[C]($,this._getLayerIndex(k),this._getAvailableImages(k))}}return this.workerSources[k][C][O]}_getDEMWorkerSource(k,C){return this.demWorkerSources[k]||(this.demWorkerSources[k]={}),this.demWorkerSources[k][C]||(this.demWorkerSources[k][C]=new ae),this.demWorkerSources[k][C]}}return S.i(self)&&(self.worker=new yr(self)),yr}),Z("index",["exports","./shared"],function(S,u){var Ie="4.5.2";let xe,we;const he={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:h=>new Promise((t,n)=>{const o=requestAnimationFrame(t);h.signal.addEventListener("abort",()=>{cancelAnimationFrame(o),n(u.c())})}),getImageData(h,t=0){return this.getImageCanvasContext(h).getImageData(-t,-t,h.width+2*t,h.height+2*t)},getImageCanvasContext(h){const t=window.document.createElement("canvas"),n=t.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return t.width=h.width,t.height=h.height,n.drawImage(h,0,0,h.width,h.height),n},resolveURL:h=>(xe||(xe=document.createElement("a")),xe.href=h,xe.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(we==null&&(we=matchMedia("(prefers-reduced-motion: reduce)")),we.matches)}};class ae{static testProp(t){if(!ae.docStyle)return t[0];for(let n=0;n<t.length;n++)if(t[n]in ae.docStyle)return t[n];return t[0]}static create(t,n,o){const a=window.document.createElement(t);return n!==void 0&&(a.className=n),o&&o.appendChild(a),a}static createNS(t,n){return window.document.createElementNS(t,n)}static disableDrag(){ae.docStyle&&ae.selectProp&&(ae.userSelect=ae.docStyle[ae.selectProp],ae.docStyle[ae.selectProp]="none")}static enableDrag(){ae.docStyle&&ae.selectProp&&(ae.docStyle[ae.selectProp]=ae.userSelect)}static setTransform(t,n){t.style[ae.transformProp]=n}static addEventListener(t,n,o,a={}){t.addEventListener(n,o,"passive"in a?a:a.capture)}static removeEventListener(t,n,o,a={}){t.removeEventListener(n,o,"passive"in a?a:a.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",ae.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",ae.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",ae.suppressClickInternal,!0)},0)}static getScale(t){const n=t.getBoundingClientRect();return{x:n.width/t.offsetWidth||1,y:n.height/t.offsetHeight||1,boundingClientRect:n}}static getPoint(t,n,o){const a=n.boundingClientRect;return new u.P((o.clientX-a.left)/n.x-t.clientLeft,(o.clientY-a.top)/n.y-t.clientTop)}static mousePos(t,n){const o=ae.getScale(t);return ae.getPoint(t,o,n)}static touchPos(t,n){const o=[],a=ae.getScale(t);for(let c=0;c<n.length;c++)o.push(ae.getPoint(t,a,n[c]));return o}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}ae.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,ae.selectProp=ae.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),ae.transformProp=ae.testProp(["transform","WebkitTransform"]);const dt={supported:!1,testSupport:function(h){!Oe&&Ke&&(xt?tt(h):je=h)}};let je,Ke,Oe=!1,xt=!1;function tt(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,Ke),h.isContextLost())return;dt.supported=!0}catch{}h.deleteTexture(t),Oe=!0}var We;typeof document<"u"&&(Ke=document.createElement("img"),Ke.onload=()=>{je&&tt(je),je=null,xt=!0},Ke.onerror=()=>{Oe=!0,je=null},Ke.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(h){let t,n,o,a;h.resetRequestQueue=()=>{t=[],n=0,o=0,a={}},h.addThrottleControl=v=>{const b=o++;return a[b]=v,b},h.removeThrottleControl=v=>{delete a[v],m()},h.getImage=(v,b,P=!0)=>new Promise((E,z)=>{dt.supported&&(v.headers||(v.headers={}),v.headers.accept="image/webp,*/*"),u.e(v,{type:"image"}),t.push({abortController:b,requestParameters:v,supportImageRefresh:P,state:"queued",onError:B=>{z(B)},onSuccess:B=>{E(B)}}),m()});const c=v=>u._(this,void 0,void 0,function*(){v.state="running";const{requestParameters:b,supportImageRefresh:P,onError:E,onSuccess:z,abortController:B}=v,V=P===!1&&!u.i(self)&&!u.g(b.url)&&(!b.headers||Object.keys(b.headers).reduce((H,J)=>H&&J==="accept",!0));n++;const q=V?_(b,B):u.m(b,B);try{const H=yield q;delete v.abortController,v.state="completed",H.data instanceof HTMLImageElement||u.b(H.data)?z(H):H.data&&z({data:yield(j=H.data,typeof createImageBitmap=="function"?u.d(j):u.f(j)),cacheControl:H.cacheControl,expires:H.expires})}catch(H){delete v.abortController,E(H)}finally{n--,m()}var j}),m=()=>{const v=(()=>{for(const b of Object.keys(a))if(a[b]())return!0;return!1})()?u.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:u.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let b=n;b<v&&t.length>0;b++){const P=t.shift();P.abortController.signal.aborted?b--:c(P)}},_=(v,b)=>new Promise((P,E)=>{const z=new Image,B=v.url,V=v.credentials;V&&V==="include"?z.crossOrigin="use-credentials":(V&&V==="same-origin"||!u.s(B))&&(z.crossOrigin="anonymous"),b.signal.addEventListener("abort",()=>{z.src="",E(u.c())}),z.fetchPriority="high",z.onload=()=>{z.onerror=z.onload=null,P({data:z})},z.onerror=()=>{z.onerror=z.onload=null,b.signal.aborted||E(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},z.src=B})}(We||(We={})),We.resetRequestQueue();class Ut{constructor(t){this._transformRequestFn=t}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function zt(h){var t=new u.A(3);return t[0]=h[0],t[1]=h[1],t[2]=h[2],t}var Et,St=function(h,t,n){return h[0]=t[0]-n[0],h[1]=t[1]-n[1],h[2]=t[2]-n[2],h};Et=new u.A(3),u.A!=Float32Array&&(Et[0]=0,Et[1]=0,Et[2]=0);var Yi=function(h){var t=h[0],n=h[1];return t*t+n*n};function ri(h){const t=[];if(typeof h=="string")t.push({id:"default",url:h});else if(h&&h.length>0){const n=[];for(const{id:o,url:a}of h){const c=`${o}${a}`;n.indexOf(c)===-1&&(n.push(c),t.push({id:o,url:a}))}}return t}function Qi(h,t,n){const o=h.split("?");return o[0]+=`${t}${n}`,o.join("?")}(function(){var h=new u.A(2);u.A!=Float32Array&&(h[0]=0,h[1]=0)})();class vt{constructor(t,n,o,a){this.context=t,this.format=o,this.texture=t.gl.createTexture(),this.update(n,a)}update(t,n,o){const{width:a,height:c}=t,m=!(this.size&&this.size[0]===a&&this.size[1]===c||o),{context:_}=this,{gl:v}=_;if(this.useMipmap=!!(n&&n.useMipmap),v.bindTexture(v.TEXTURE_2D,this.texture),_.pixelStoreUnpackFlipY.set(!1),_.pixelStoreUnpack.set(1),_.pixelStoreUnpackPremultiplyAlpha.set(this.format===v.RGBA&&(!n||n.premultiply!==!1)),m)this.size=[a,c],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||u.b(t)?v.texImage2D(v.TEXTURE_2D,0,this.format,this.format,v.UNSIGNED_BYTE,t):v.texImage2D(v.TEXTURE_2D,0,this.format,a,c,0,this.format,v.UNSIGNED_BYTE,t.data);else{const{x:b,y:P}=o||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||u.b(t)?v.texSubImage2D(v.TEXTURE_2D,0,b,P,v.RGBA,v.UNSIGNED_BYTE,t):v.texSubImage2D(v.TEXTURE_2D,0,b,P,a,c,v.RGBA,v.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&v.generateMipmap(v.TEXTURE_2D)}bind(t,n,o){const{context:a}=this,{gl:c}=a;c.bindTexture(c.TEXTURE_2D,this.texture),o!==c.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(o=c.LINEAR),t!==this.filter&&(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,t),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,o||t),this.filter=t),n!==this.wrap&&(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,n),c.texParameteri(c.TEXTURE_2D,c.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 Pn(h){const{userImage:t}=h;return!!(t&&t.render&&t.render())&&(h.data.replace(new Uint8Array(t.data.buffer)),!0)}class ci extends u.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new u.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,promiseResolve:o}of this.requestors)o(this._getImagesForIds(n));this.requestors=[]}}getImage(t){const n=this.images[t];if(n&&!n.data&&n.spriteData){const o=n.spriteData;n.data=new u.R({width:o.width,height:o.height},o.context.getImageData(o.x,o.y,o.width,o.height).data),n.spriteData=null}return n}addImage(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 o=!0;const a=n.data||n.spriteData;return this._validateStretch(n.stretchX,a&&a.width)||(this.fire(new u.j(new Error(`Image "${t}" has invalid "stretchX" value`))),o=!1),this._validateStretch(n.stretchY,a&&a.height)||(this.fire(new u.j(new Error(`Image "${t}" has invalid "stretchY" value`))),o=!1),this._validateContent(n.content,n)||(this.fire(new u.j(new Error(`Image "${t}" has invalid "content" value`))),o=!1),o}_validateStretch(t,n){if(!t)return!0;let o=0;for(const a of t){if(a[0]<o||a[1]<a[0]||n<a[1])return!1;o=a[1]}return!0}_validateContent(t,n){if(!t)return!0;if(t.length!==4)return!1;const o=n.spriteData,a=o&&o.width||n.data.width,c=o&&o.height||n.data.height;return!(t[0]<0||a<t[0]||t[1]<0||c<t[1]||t[2]<0||a<t[2]||t[3]<0||c<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,n,o=!0){const a=this.getImage(t);if(o&&(a.data.width!==n.data.width||a.data.height!==n.data.height))throw new Error(`size mismatch between old image (${a.data.width}x${a.data.height}) and new image (${n.data.width}x${n.data.height}).`);n.version=a.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){return new Promise((n,o)=>{let a=!0;if(!this.isLoaded())for(const c of t)this.images[c]||(a=!1);this.isLoaded()||a?n(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:n})})}_getImagesForIds(t){const n={};for(const o of t){let a=this.getImage(o);a||(this.fire(new u.k("styleimagemissing",{id:o})),a=this.getImage(o)),a?n[o]={data:a.data.clone(),pixelRatio:a.pixelRatio,sdf:a.sdf,version:a.version,stretchX:a.stretchX,stretchY:a.stretchY,content:a.content,textFitWidth:a.textFitWidth,textFitHeight:a.textFitHeight,hasRenderCallback:!!(a.userImage&&a.userImage.render)}:u.w(`Image "${o}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return n}getPixelSize(){const{width:t,height:n}=this.atlasImage;return{width:t,height:n}}getPattern(t){const n=this.patterns[t],o=this.getImage(t);if(!o)return null;if(n&&n.position.version===o.version)return n.position;if(n)n.position.version=o.version;else{const a={w:o.data.width+2,h:o.data.height+2,x:0,y:0},c=new u.I(a,o);this.patterns[t]={bin:a,position:c}}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 vt(t,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const c in this.patterns)t.push(this.patterns[c].bin);const{w:n,h:o}=u.p(t),a=this.atlasImage;a.resize({width:n||1,height:o||1});for(const c in this.patterns){const{bin:m}=this.patterns[c],_=m.x+1,v=m.y+1,b=this.getImage(c).data,P=b.width,E=b.height;u.R.copy(b,a,{x:0,y:0},{x:_,y:v},{width:P,height:E}),u.R.copy(b,a,{x:0,y:E-1},{x:_,y:v-1},{width:P,height:1}),u.R.copy(b,a,{x:0,y:0},{x:_,y:v+E},{width:P,height:1}),u.R.copy(b,a,{x:P-1,y:0},{x:_-1,y:v},{width:1,height:E}),u.R.copy(b,a,{x:0,y:0},{x:_+P,y:v},{width:1,height:E})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const o=this.getImage(n);o||u.w(`Image with ID: "${n}" was not found`),Pn(o)&&this.updateImage(n,o)}}}const wi=1e20;function Er(h,t,n,o,a,c,m,_,v){for(let b=t;b<t+o;b++)En(h,n*c+b,c,a,m,_,v);for(let b=n;b<n+a;b++)En(h,b*c+t,1,o,m,_,v)}function En(h,t,n,o,a,c,m){c[0]=0,m[0]=-wi,m[1]=wi,a[0]=h[t];for(let _=1,v=0,b=0;_<o;_++){a[_]=h[t+_*n];const P=_*_;do{const E=c[v];b=(a[_]-a[E]+P-E*E)/(_-E)/2}while(b<=m[v]&&--v>-1);v++,c[v]=_,m[v]=b,m[v+1]=wi}for(let _=0,v=0;_<o;_++){for(;m[v+1]<_;)v++;const b=c[v],P=_-b;h[t+_*n]=a[b]+P*P}}class pr{constructor(t,n){this.requestManager=t,this.localIdeographFontFamily=n,this.entries={}}setURL(t){this.url=t}getGlyphs(t){return u._(this,void 0,void 0,function*(){const n=[];for(const c in t)for(const m of t[c])n.push(this._getAndCacheGlyphsPromise(c,m));const o=yield Promise.all(n),a={};for(const{stack:c,id:m,glyph:_}of o)a[c]||(a[c]={}),a[c][m]=_&&{id:_.id,bitmap:_.bitmap.clone(),metrics:_.metrics};return a})}_getAndCacheGlyphsPromise(t,n){return u._(this,void 0,void 0,function*(){let o=this.entries[t];o||(o=this.entries[t]={glyphs:{},requests:{},ranges:{}});let a=o.glyphs[n];if(a!==void 0)return{stack:t,id:n,glyph:a};if(a=this._tinySDF(o,t,n),a)return o.glyphs[n]=a,{stack:t,id:n,glyph:a};const c=Math.floor(n/256);if(256*c>65535)throw new Error("glyphs > 65535 not supported");if(o.ranges[c])return{stack:t,id:n,glyph:a};if(!this.url)throw new Error("glyphsUrl is not set");if(!o.requests[c]){const _=pr.loadGlyphRange(t,c,this.url,this.requestManager);o.requests[c]=_}const m=yield o.requests[c];for(const _ in m)this._doesCharSupportLocalGlyph(+_)||(o.glyphs[+_]=m[+_]);return o.ranges[c]=!0,{stack:t,id:n,glyph:m[n]||null}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(u.u["CJK Unified Ideographs"](t)||u.u["Hangul Syllables"](t)||u.u.Hiragana(t)||u.u.Katakana(t))}_tinySDF(t,n,o){const a=this.localIdeographFontFamily;if(!a||!this._doesCharSupportLocalGlyph(o))return;let c=t.tinySDF;if(!c){let _="400";/bold/i.test(n)?_="900":/medium/i.test(n)?_="500":/light/i.test(n)&&(_="200"),c=t.tinySDF=new pr.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:a,fontWeight:_})}const m=c.draw(String.fromCharCode(o));return{id:o,bitmap:new u.o({width:m.width||60,height:m.height||60},m.data),metrics:{width:m.glyphWidth/2||24,height:m.glyphHeight/2||24,left:m.glyphLeft/2+.5||0,top:m.glyphTop/2-27.5||-8,advance:m.glyphAdvance/2||24,isDoubleResolution:!0}}}}pr.loadGlyphRange=function(h,t,n,o){return u._(this,void 0,void 0,function*(){const a=256*t,c=a+255,m=o.transformRequest(n.replace("{fontstack}",h).replace("{range}",`${a}-${c}`),"Glyphs"),_=yield u.l(m,new AbortController);if(!_||!_.data)throw new Error(`Could not load glyph range. range: ${t}, ${a}-${c}`);const v={};for(const b of u.n(_.data))v[b.id]=b;return v})},pr.TinySDF=class{constructor({fontSize:h=24,buffer:t=3,radius:n=8,cutoff:o=.25,fontFamily:a="sans-serif",fontWeight:c="normal",fontStyle:m="normal"}={}){this.buffer=t,this.cutoff=o,this.radius=n;const _=this.size=h+4*t,v=this._createCanvas(_),b=this.ctx=v.getContext("2d",{willReadFrequently:!0});b.font=`${m} ${c} ${h}px ${a}`,b.textBaseline="alphabetic",b.textAlign="left",b.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:o,actualBoundingBoxLeft:a,actualBoundingBoxRight:c}=this.ctx.measureText(h),m=Math.ceil(n),_=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(c-a))),v=Math.min(this.size-this.buffer,m+Math.ceil(o)),b=_+2*this.buffer,P=v+2*this.buffer,E=Math.max(b*P,0),z=new Uint8ClampedArray(E),B={data:z,width:b,height:P,glyphWidth:_,glyphHeight:v,glyphTop:m,glyphLeft:0,glyphAdvance:t};if(_===0||v===0)return B;const{ctx:V,buffer:q,gridInner:j,gridOuter:H}=this;V.clearRect(q,q,_,v),V.fillText(h,q,q+m);const J=V.getImageData(q,q,_,v);H.fill(wi,0,E),j.fill(0,0,E);for(let N=0;N<v;N++)for(let ee=0;ee<_;ee++){const ne=J.data[4*(N*_+ee)+3]/255;if(ne===0)continue;const le=(N+q)*b+ee+q;if(ne===1)H[le]=0,j[le]=wi;else{const ge=.5-ne;H[le]=ge>0?ge*ge:0,j[le]=ge<0?ge*ge:0}}Er(H,0,0,b,P,b,this.f,this.v,this.z),Er(j,q,q,_,v,b,this.f,this.v,this.z);for(let N=0;N<E;N++){const ee=Math.sqrt(H[N])-Math.sqrt(j[N]);z[N]=Math.round(255-255*(ee/this.radius+this.cutoff))}return B}};class Ns{constructor(){this.specification=u.v.light.position}possiblyEvaluate(t,n){return u.y(t.expression.evaluate(n))}interpolate(t,n,o){return{x:u.z.number(t.x,n.x,o),y:u.z.number(t.y,n.y,o),z:u.z.number(t.z,n.z,o)}}}let sn;class Ar extends u.E{constructor(t){super(),sn=sn||new u.q({anchor:new u.D(u.v.light.anchor),position:new Ns,color:new u.D(u.v.light.color),intensity:new u.D(u.v.light.intensity)}),this._transitionable=new u.T(sn),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(u.r,t,n))for(const o in t){const a=t[o];o.endsWith("-transition")?this._transitionable.setTransition(o.slice(0,-11),a):this._transitionable.setValue(o,a)}}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,o){return(!o||o.validate!==!1)&&u.t(this,t.call(u.x,{value:n,style:{glyphs:!0,sprite:!0},styleSpec:u.v}))}}const Ai=new u.q({"sky-color":new u.D(u.v.sky["sky-color"]),"horizon-color":new u.D(u.v.sky["horizon-color"]),"fog-color":new u.D(u.v.sky["fog-color"]),"fog-ground-blend":new u.D(u.v.sky["fog-ground-blend"]),"horizon-fog-blend":new u.D(u.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new u.D(u.v.sky["sky-horizon-blend"]),"atmosphere-blend":new u.D(u.v.sky["atmosphere-blend"])});class er extends u.E{constructor(t){super(),this._transitionable=new u.T(Ai),this.setSky(t),this._transitioning=this._transitionable.untransitioned()}setSky(t,n={}){if(!this._validate(u.B,t,n))for(const o in t){const a=t[o];o.endsWith("-transition")?this._transitionable.setTransition(o.slice(0,-11),a):this._transitionable.setValue(o,a)}}getSky(){return this._transitionable.serialize()}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,o={}){return(o==null?void 0:o.validate)!==!1&&u.t(this,t.call(u.x,u.e({value:n,style:{glyphs:!0,sprite:!0},styleSpec:u.v})))}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}}class An{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 o=t.join(",")+String(n);return this.dashEntry[o]||(this.dashEntry[o]=this.addDash(t,n)),this.dashEntry[o]}getDashRanges(t,n,o){const a=[];let c=t.length%2==1?-t[t.length-1]*o:0,m=t[0]*o,_=!0;a.push({left:c,right:m,isDash:_,zeroLength:t[0]===0});let v=t[0];for(let b=1;b<t.length;b++){_=!_;const P=t[b];c=v*o,v+=P,m=v*o,a.push({left:c,right:m,isDash:_,zeroLength:P===0})}return a}addRoundDash(t,n,o){const a=n/2;for(let c=-o;c<=o;c++){const m=this.width*(this.nextRow+o+c);let _=0,v=t[_];for(let b=0;b<this.width;b++){b/v.right>1&&(v=t[++_]);const P=Math.abs(b-v.left),E=Math.abs(b-v.right),z=Math.min(P,E);let B;const V=c/o*(a+1);if(v.isDash){const q=a-Math.abs(V);B=Math.sqrt(z*z+q*q)}else B=a-Math.sqrt(z*z+V*V);this.data[m+b]=Math.max(0,Math.min(255,B+128))}}}addRegularDash(t){for(let _=t.length-1;_>=0;--_){const v=t[_],b=t[_+1];v.zeroLength?t.splice(_,1):b&&b.isDash===v.isDash&&(b.left=v.left,t.splice(_,1))}const n=t[0],o=t[t.length-1];n.isDash===o.isDash&&(n.left=o.left-this.width,o.right=n.right+this.width);const a=this.width*this.nextRow;let c=0,m=t[c];for(let _=0;_<this.width;_++){_/m.right>1&&(m=t[++c]);const v=Math.abs(_-m.left),b=Math.abs(_-m.right),P=Math.min(v,b);this.data[a+_]=Math.max(0,Math.min(255,(m.isDash?P:-P)+128))}}addDash(t,n){const o=n?7:0,a=2*o+1;if(this.nextRow+a>this.height)return u.w("LineAtlas out of space"),null;let c=0;for(let _=0;_<t.length;_++)c+=t[_];if(c!==0){const _=this.width/c,v=this.getDashRanges(t,this.width,_);n?this.addRoundDash(v,_,o):this.addRegularDash(v)}const m={y:(this.nextRow+o+.5)/this.height,height:2*o/this.height,width:c};return this.nextRow+=a,this.dirty=!0,m}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))}}const Vr="maplibre_preloaded_worker_pool";class fr{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<fr.workerCount;)this.workers.push(new Worker(u.a.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[Vr]}numActive(){return Object.keys(this.active).length}}const Cn=Math.floor(he.hardwareConcurrency/2);let Fi,tr;function on(){return Fi||(Fi=new fr),Fi}fr.workerCount=u.C(globalThis)?Math.max(Math.min(Cn,3),1):1;class an{constructor(t,n){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=n;const o=this.workerPool.acquire(n);for(let a=0;a<o.length;a++){const c=new u.F(o[a],n);c.name=`Worker ${a}`,this.actors.push(c)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n){const o=[];for(const a of this.actors)o.push(a.sendAsync({type:t,data:n}));return Promise.all(o)}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)}registerMessageHandler(t,n){for(const o of this.actors)o.registerMessageHandler(t,n)}}function rs(){return tr||(tr=new an(on(),u.G),tr.registerMessageHandler("GR",(h,t,n)=>u.m(t,n))),tr}function Cr(h,t){const n=u.H();return u.J(n,n,[1,1,0]),u.K(n,n,[.5*h.width,.5*h.height,1]),u.L(n,n,h.calculatePosMatrix(t.toUnwrapped()))}function Nr(h,t,n,o,a,c){const m=function(E,z,B){if(E)for(const V of E){const q=z[V];if(q&&q.source===B&&q.type==="fill-extrusion")return!0}else for(const V in z){const q=z[V];if(q.source===B&&q.type==="fill-extrusion")return!0}return!1}(a&&a.layers,t,h.id),_=c.maxPitchScaleFactor(),v=h.tilesIn(o,_,m);v.sort(jr);const b=[];for(const E of v)b.push({wrappedTileID:E.tileID.wrapped().key,queryResults:E.tile.queryRenderedFeatures(t,n,h._state,E.queryGeometry,E.cameraQueryGeometry,E.scale,a,c,_,Cr(h.transform,E.tileID))});const P=function(E){const z={},B={};for(const V of E){const q=V.queryResults,j=V.wrappedTileID,H=B[j]=B[j]||{};for(const J in q){const N=q[J],ee=H[J]=H[J]||{},ne=z[J]=z[J]||[];for(const le of N)ee[le.featureIndex]||(ee[le.featureIndex]=!0,ne.push(le))}}return z}(b);for(const E in P)P[E].forEach(z=>{const B=z.feature,V=h.getFeatureState(B.layer["source-layer"],B.id);B.source=B.layer.source,B.layer["source-layer"]&&(B.sourceLayer=B.layer["source-layer"]),B.state=V});return P}function jr(h,t){const n=h.tileID,o=t.tileID;return n.overscaledZ-o.overscaledZ||n.canonical.y-o.canonical.y||n.wrap-o.wrap||n.canonical.x-o.canonical.x}function kn(h,t,n){return u._(this,void 0,void 0,function*(){let o=h;if(h.url?o=(yield u.h(t.transformRequest(h.url,"Source"),n)).data:yield he.frameAsync(n),!o)return null;const a=u.M(u.e(o,h),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in o&&o.vector_layers&&(a.vectorLayerIds=o.vector_layers.map(c=>c.id)),a})}class ue{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 u.N?new u.N(t.lng,t.lat):u.N.convert(t),this}setSouthWest(t){return this._sw=t instanceof u.N?new u.N(t.lng,t.lat):u.N.convert(t),this}extend(t){const n=this._sw,o=this._ne;let a,c;if(t instanceof u.N)a=t,c=t;else{if(!(t instanceof ue))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(ue.convert(t)):this.extend(u.N.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(u.N.convert(t)):this;if(a=t._sw,c=t._ne,!a||!c)return this}return n||o?(n.lng=Math.min(a.lng,n.lng),n.lat=Math.min(a.lat,n.lat),o.lng=Math.max(c.lng,o.lng),o.lat=Math.max(c.lat,o.lat)):(this._sw=new u.N(a.lng,a.lat),this._ne=new u.N(c.lng,c.lat)),this}getCenter(){return new u.N((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new u.N(this.getWest(),this.getNorth())}getSouthEast(){return new u.N(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){const{lng:n,lat:o}=u.N.convert(t);let a=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=o&&o<=this._ne.lat&&a}static convert(t){return t instanceof ue?t:t&&new ue(t)}static fromLngLat(t,n=0){const o=360*n/40075017,a=o/Math.cos(Math.PI/180*t.lat);return new ue(new u.N(t.lng-a,t.lat-o),new u.N(t.lng+a,t.lat+o))}}class ln{constructor(t,n,o){this.bounds=ue.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=o||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),o=Math.floor(u.O(this.bounds.getWest())*n),a=Math.floor(u.Q(this.bounds.getNorth())*n),c=Math.ceil(u.O(this.bounds.getEast())*n),m=Math.ceil(u.Q(this.bounds.getSouth())*n);return t.x>=o&&t.x<c&&t.y>=a&&t.y<m}}class ns extends u.E{constructor(t,n,o,a){if(super(),this.id=t,this.dispatcher=o,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,u.e(this,u.M(n,["url","scheme","tileSize","promoteId"])),this._options=u.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(a)}load(){return u._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new u.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const t=yield kn(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t&&(u.e(this,t),t.bounds&&(this.tileBounds=new ln(t.bounds,this.minzoom,this.maxzoom)),this.fire(new u.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new u.k("data",{dataType:"source",sourceDataType:"content"})))}catch(t){this._tileJSONRequest=null,this.fire(new u.j(t))}})}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.abort(),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.abort(),this._tileJSONRequest=null)}serialize(){return u.e({},this._options)}loadTile(t){return u._(this,void 0,void 0,function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),o={request:this.map._requestManager.transformRequest(n,"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};o.request.collectResourceTiming=this._collectResourceTiming;let a="RT";if(t.actor&&t.state!=="expired"){if(t.state==="loading")return new Promise((c,m)=>{t.reloadPromise={resolve:c,reject:m}})}else t.actor=this.dispatcher.getActor(),a="LT";t.abortController=new AbortController;try{const c=yield t.actor.sendAsync({type:a,data:o},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,c)}catch(c){if(delete t.abortController,t.aborted)return;if(c&&c.status!==404)throw c;this._afterTileLoadWorkerResponse(t,null)}})}_afterTileLoadWorkerResponse(t,n){if(n&&n.resourceTiming&&(t.resourceTiming=n.resourceTiming),n&&this.map._refreshExpiredTiles&&t.setExpiryData(n),t.loadVectorData(n,this.map.painter),t.reloadPromise){const o=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(o.resolve).catch(o.reject)}}abortTile(t){return u._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.type,source:this.id}}))})}unloadTile(t){return u._(this,void 0,void 0,function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class _t extends u.E{constructor(t,n,o,a){super(),this.id=t,this.dispatcher=o,this.setEventedParent(a),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=u.e({type:"raster"},n),u.e(this,u.M(n,["url","scheme","tileSize"]))}load(){return u._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new u.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const t=yield kn(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,t&&(u.e(this,t),t.bounds&&(this.tileBounds=new ln(t.bounds,this.minzoom,this.maxzoom)),this.fire(new u.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new u.k("data",{dataType:"source",sourceDataType:"content"})))}catch(t){this._tileJSONRequest=null,this.fire(new u.j(t))}})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}serialize(){return u.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return u._(this,void 0,void 0,function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{const o=yield We.getImage(this.map._requestManager.transformRequest(n,"Tile"),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(o&&o.data){this.map._refreshExpiredTiles&&o.cacheControl&&o.expires&&t.setExpiryData({cacheControl:o.cacheControl,expires:o.expires});const a=this.map.painter.context,c=a.gl,m=o.data;t.texture=this.map.painter.getTileTexture(m.width),t.texture?t.texture.update(m,{useMipmap:!0}):(t.texture=new vt(a,m,c.RGBA,{useMipmap:!0}),t.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE,c.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(o){if(delete t.abortController,t.aborted)t.state="unloaded";else if(o)throw t.state="errored",o}})}abortTile(t){return u._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)})}unloadTile(t){return u._(this,void 0,void 0,function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)})}hasTransition(){return!1}}class $t extends _t{constructor(t,n,o,a){super(t,n,o,a),this.type="raster-dem",this.maxzoom=22,this._options=u.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){return u._(this,void 0,void 0,function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),o=this.map._requestManager.transformRequest(n,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{const a=yield We.getImage(o,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(a&&a.data){const c=a.data;this.map._refreshExpiredTiles&&a.cacheControl&&a.expires&&t.setExpiryData({cacheControl:a.cacheControl,expires:a.expires});const m=u.b(c)&&u.U()?c:yield this.readImageNow(c),_={type:this.type,uid:t.uid,source:this.id,rawImageData:m,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!t.actor||t.state==="expired"){t.actor=this.dispatcher.getActor();const v=yield t.actor.sendAsync({type:"LDT",data:_});t.dem=v,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}}catch(a){if(delete t.abortController,t.aborted)t.state="unloaded";else if(a)throw t.state="errored",a}})}readImageNow(t){return u._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&u.V()){const n=t.width+2,o=t.height+2;try{return new u.R({width:n,height:o},yield u.W(t,-1,-1,n,o))}catch{}}return he.getImageData(t,1)})}_getNeighboringTiles(t){const n=t.canonical,o=Math.pow(2,n.z),a=(n.x-1+o)%o,c=n.x===0?t.wrap-1:t.wrap,m=(n.x+1+o)%o,_=n.x+1===o?t.wrap+1:t.wrap,v={};return v[new u.S(t.overscaledZ,c,n.z,a,n.y).key]={backfilled:!1},v[new u.S(t.overscaledZ,_,n.z,m,n.y).key]={backfilled:!1},n.y>0&&(v[new u.S(t.overscaledZ,c,n.z,a,n.y-1).key]={backfilled:!1},v[new u.S(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},v[new u.S(t.overscaledZ,_,n.z,m,n.y-1).key]={backfilled:!1}),n.y+1<o&&(v[new u.S(t.overscaledZ,c,n.z,a,n.y+1).key]={backfilled:!1},v[new u.S(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},v[new u.S(t.overscaledZ,_,n.z,m,n.y+1).key]={backfilled:!1}),v}unloadTile(t){return u._(this,void 0,void 0,function*(){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&&(yield t.actor.sendAsync({type:"RDT",data:{type:this.type,uid:t.uid,source:this.id}}))})}}class ss extends u.E{constructor(t,n,o,a){super(),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=o.getActor(),this.setEventedParent(a),this._data=n.data,this._options=u.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 c=u.X/this.tileSize;this.workerOptions=u.e({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*c,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*c,extent:u.X,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:u.X,radius:(n.clusterRadius||50)*c,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}load(){return u._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData(),this}updateData(t){return this._updateWorkerData(t),this}getData(){return u._(this,void 0,void 0,function*(){const t=u.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:t})})}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){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:t,source:this.id}})}getClusterChildren(t){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:t,source:this.id}})}getClusterLeaves(t,n,o){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:n,offset:o}})}_updateWorkerData(t){return u._(this,void 0,void 0,function*(){const n=u.e({type:this.type},this.workerOptions);t?n.dataDiff=t:typeof this._data=="string"?(n.request=this.map._requestManager.transformRequest(he.resolveURL(this._data),"Source"),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new u.k("dataloading",{dataType:"source"}));try{const o=yield this.actor.sendAsync({type:"LD",data:n});if(this._pendingLoads--,this._removed||o.abandoned)return void this.fire(new u.k("dataabort",{dataType:"source"}));let a=null;o.resourceTiming&&o.resourceTiming[this.id]&&(a=o.resourceTiming[this.id].slice(0));const c={dataType:"source"};this._collectResourceTiming&&a&&a.length>0&&u.e(c,{resourceTiming:a}),this.fire(new u.k("data",Object.assign(Object.assign({},c),{sourceDataType:"metadata"}))),this.fire(new u.k("data",Object.assign(Object.assign({},c),{sourceDataType:"content"})))}catch(o){if(this._pendingLoads--,this._removed)return void this.fire(new u.k("dataabort",{dataType:"source"}));this.fire(new u.j(o))}})}loaded(){return this._pendingLoads===0}loadTile(t){return u._(this,void 0,void 0,function*(){const n=t.actor?"RT":"LT";t.actor=this.actor;const o={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.abortController=new AbortController;const a=yield this.actor.sendAsync({type:n,data:o},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(a,this.map.painter,n==="RT")})}abortTile(t){return u._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0})}unloadTile(t){return u._(this,void 0,void 0,function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return u.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Ur=u.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class kr extends u.E{constructor(t,n,o,a){super(),this.id=t,this.dispatcher=o,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(a),this.options=n}load(t){return u._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new u.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const n=yield We.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,n&&n.data&&(this.image=n.data,t&&(this.coordinates=t),this._finishLoading())}catch(n){this._request=null,this._loaded=!0,this.fire(new u.j(n))}})}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new u.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;const n=t.map(u.Z.fromLngLat);this.tileID=function(a){let c=1/0,m=1/0,_=-1/0,v=-1/0;for(const z of a)c=Math.min(c,z.x),m=Math.min(m,z.y),_=Math.max(_,z.x),v=Math.max(v,z.y);const b=Math.max(_-c,v-m),P=Math.max(0,Math.floor(-Math.log(b)/Math.LN2)),E=Math.pow(2,P);return new u.a1(P,Math.floor((c+_)/2*E),Math.floor((m+v)/2*E))}(n),this.minzoom=this.maxzoom=this.tileID.z;const o=n.map(a=>this.tileID.getTilePoint(a)._round());return this._boundsArray=new u.$,this._boundsArray.emplaceBack(o[0].x,o[0].y,0,0),this._boundsArray.emplaceBack(o[1].x,o[1].y,u.X,0),this._boundsArray.emplaceBack(o[3].x,o[3].y,0,u.X),this._boundsArray.emplaceBack(o[2].x,o[2].y,u.X,u.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new u.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Ur.members)),this.boundsSegments||(this.boundsSegments=u.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new vt(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let o=!1;for(const a in this.tiles){const c=this.tiles[a];c.state!=="loaded"&&(c.state="loaded",c.texture=this.texture,o=!0)}o&&this.fire(new u.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return u._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Mn extends kr{constructor(t,n,o,a){super(t,n,o,a),this.roundZoom=!0,this.type="video",this.options=n}load(){return u._(this,void 0,void 0,function*(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push(this.map._requestManager.transformRequest(n,"Source").url);try{const n=yield u.a3(this.urls);if(this._loaded=!0,!n)return;this.video=n,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(n){this.fire(new u.j(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 u.j(new u.a2(`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)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Ur.members)),this.boundsSegments||(this.boundsSegments=u.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new vt(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let o=!1;for(const a in this.tiles){const c=this.tiles[a];c.state!=="loaded"&&(c.state="loaded",c.texture=this.texture,o=!0)}o&&this.fire(new u.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Hi extends kr{constructor(t,n,o,a){super(t,n,o,a),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(c=>!Array.isArray(c)||c.length!==2||c.some(m=>typeof m!="number"))||this.fire(new u.j(new u.a2(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new u.j(new u.a2(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new u.j(new u.a2(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new u.j(new u.a2(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new u.j(new u.a2(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){return u._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new u.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const n=this.map.painter.context,o=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,Ur.members)),this.boundsSegments||(this.boundsSegments=u.a0.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new vt(n,this.canvas,o.RGBA,{premultiply:!0});let a=!1;for(const c in this.tiles){const m=this.tiles[c];m.state!=="loaded"&&(m.state="loaded",m.texture=this.texture,a=!0)}a&&this.fire(new u.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const os={},as=h=>{switch(h){case"geojson":return ss;case"image":return kr;case"raster":return _t;case"raster-dem":return $t;case"vector":return ns;case"video":return Mn;case"canvas":return Hi}return os[h]},Te="RTLPluginLoaded";class mr extends u.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=rs()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch(n=>{throw this.status="error",n})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return u._(this,arguments,void 0,function*(n,o=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=he.resolveURL(n),!this.url)throw new Error(`requested url ${n} is invalid`);if(this.status==="unavailable"){if(!o)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return u._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new u.k(Te))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Si=null;function gr(){return Si||(Si=new mr),Si}class $r{constructor(t,n){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=u.a4(),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,o){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(a,c){const m={};if(!c)return m;for(const _ of a){const v=_.layerIds.map(b=>c.getLayer(b)).filter(Boolean);if(v.length!==0){_.layers=v,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(b=>v.filter(P=>P.id===b)[0]));for(const b of v)m[b.id]=_}}return m}(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const a in this.buckets){const c=this.buckets[a];if(c instanceof u.a6){if(this.hasSymbolBuckets=!0,!o)break;c.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const a in this.buckets){const c=this.buckets[a];if(c instanceof u.a6&&c.hasRTLText){this.hasRTLText=!0,gr().lazyLoad();break}}this.queryPadding=0;for(const a in this.buckets){const c=this.buckets[a];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(a).queryRadius(c))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new u.a5}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const o in this.buckets){const a=this.buckets[o];a.uploadPending()&&a.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new vt(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new vt(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,o,a,c,m,_,v,b,P){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:a,cameraQueryGeometry:c,scale:m,tileSize:this.tileSize,pixelPosMatrix:P,transform:v,params:_,queryPadding:this.queryPadding*b},t,n,o):{}}querySourceFeatures(t,n){const o=this.latestFeatureIndex;if(!o||!o.rawTileData)return;const a=o.loadVTLayers(),c=n&&n.sourceLayer?n.sourceLayer:"",m=a._geojsonTileLayer||a[c];if(!m)return;const _=u.a7(n&&n.filter),{z:v,x:b,y:P}=this.tileID.canonical,E={z:v,x:b,y:P};for(let z=0;z<m.length;z++){const B=m.feature(z);if(_.needGeometry){const j=u.a8(B,!0);if(!_.filter(new u.a9(this.tileID.overscaledZ),j,this.tileID.canonical))continue}else if(!_.filter(new u.a9(this.tileID.overscaledZ),B))continue;const V=o.getId(B,c),q=new u.aa(B,v,b,P,V);q.tile=E,t.push(q)}}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 o=u.ab(t.cacheControl);o["max-age"]&&(this.expirationTime=Date.now()+1e3*o["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const o=Date.now();let a=!1;if(this.expirationTime>o)a=!1;else if(n)if(this.expirationTime<n)a=!0;else{const c=this.expirationTime-n;c?this.expirationTime=o+Math.max(c,3e4):a=!0}else a=!0;a?(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 o=this.latestFeatureIndex.loadVTLayers();for(const a in this.buckets){if(!n.style.hasLayer(a))continue;const c=this.buckets[a],m=c.layers[0].sourceLayer||"_geojsonTileLayer",_=o[m],v=t[m];if(!_||!v||Object.keys(v).length===0)continue;c.update(v,_,this.imageAtlas&&this.imageAtlas.patternPositions||{});const b=n&&n.style&&n.style.getLayer(a);b&&(this.queryPadding=Math.max(this.queryPadding,b.queryRadius(c)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<he.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=he.now()+t}setDependencies(t,n){const o={};for(const a of n)o[a]=!0;this.dependencies[t]=o}hasDependency(t,n){for(const o of t){const a=this.dependencies[o];if(a){for(const c of n)if(a[c])return!0}}return!1}}class Ae{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,o){const a=t.wrapped().key;this.data[a]===void 0&&(this.data[a]=[]);const c={value:n,timeout:void 0};if(o!==void 0&&(c.timeout=setTimeout(()=>{this.remove(t,c)},o)),this.data[a].push(c),this.order.push(a),this.order.length>this.max){const m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}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 o=t.wrapped().key,a=n===void 0?0:this.data[o].indexOf(n),c=this.data[o][a];return this.data[o].splice(a,1),c.timeout&&clearTimeout(c.timeout),this.data[o].length===0&&delete this.data[o],this.onRemove(c.value),this.order.splice(this.order.indexOf(o),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 o in this.data)for(const a of this.data[o])t(a.value)||n.push(a);for(const o of n)this.remove(o.value.tileID,o)}}class at{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,o){const a=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][a]=this.stateChanges[t][a]||{},u.e(this.stateChanges[t][a],o),this.deletedStates[t]===null){this.deletedStates[t]={};for(const c in this.state[t])c!==a&&(this.deletedStates[t][c]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][a]===null){this.deletedStates[t][a]={};for(const c in this.state[t][a])o[c]||(this.deletedStates[t][a][c]=null)}else for(const c in o)this.deletedStates[t]&&this.deletedStates[t][a]&&this.deletedStates[t][a][c]===null&&delete this.deletedStates[t][a][c]}removeFeatureState(t,n,o){if(this.deletedStates[t]===null)return;const a=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},o&&n!==void 0)this.deletedStates[t][a]!==null&&(this.deletedStates[t][a]=this.deletedStates[t][a]||{},this.deletedStates[t][a][o]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][a])for(o in this.deletedStates[t][a]={},this.stateChanges[t][a])this.deletedStates[t][a][o]=null;else this.deletedStates[t][a]=null;else this.deletedStates[t]=null}getState(t,n){const o=String(n),a=u.e({},(this.state[t]||{})[o],(this.stateChanges[t]||{})[o]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const c=this.deletedStates[t][n];if(c===null)return{};for(const m in c)delete a[m]}return a}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const o={};for(const a in this.stateChanges){this.state[a]=this.state[a]||{};const c={};for(const m in this.stateChanges[a])this.state[a][m]||(this.state[a][m]={}),u.e(this.state[a][m],this.stateChanges[a][m]),c[m]=this.state[a][m];o[a]=c}for(const a in this.deletedStates){this.state[a]=this.state[a]||{};const c={};if(this.deletedStates[a]===null)for(const m in this.state[a])c[m]={},this.state[a][m]={};else for(const m in this.deletedStates[a]){if(this.deletedStates[a][m]===null)this.state[a][m]={};else for(const _ of Object.keys(this.deletedStates[a][m]))delete this.state[a][m][_];c[m]=this.state[a][m]}o[a]=o[a]||{},u.e(o[a],c)}if(this.stateChanges={},this.deletedStates={},Object.keys(o).length!==0)for(const a in t)t[a].setFeatureState(o,n)}}class Ye extends u.E{constructor(t,n,o){super(),this.id=t,this.dispatcher=o,this.on("data",a=>this._dataHandler(a)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((a,c,m,_)=>{const v=new(as(c.type))(a,c,m,_);if(v.id!==a)throw new Error(`Expected Source id to be ${a} instead of ${v.id}`);return v})(t,n,o,this),this._tiles={},this._cache=new Ae(0,a=>this._unloadTile(a)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new at,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,o){return u._(this,void 0,void 0,function*(){try{yield this._source.loadTile(t),this._tileLoaded(t,n,o)}catch(a){t.state="errored",a.status!==404?this._source.fire(new u.j(a,{tile:t})):this.update(this.transform,this.terrain)}})}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new u.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 o=this._tiles[n];o.upload(t),o.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(Ci).map(t=>t.key)}getRenderableIds(t){const n=[];for(const o in this._tiles)this._isIdRenderable(o,t)&&n.push(this._tiles[o]);return t?n.sort((o,a)=>{const c=o.tileID,m=a.tileID,_=new u.P(c.canonical.x,c.canonical.y)._rotate(this.transform.angle),v=new u.P(m.canonical.x,m.canonical.y)._rotate(this.transform.angle);return c.overscaledZ-m.overscaledZ||v.y-_.y||v.x-_.x}).map(o=>o.tileID.key):n.map(o=>o.tileID).sort(Ci).map(o=>o.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){return u._(this,void 0,void 0,function*(){const o=this._tiles[t];o&&(o.state!=="loading"&&(o.state=n),yield this._loadTile(o,t,n))})}_tileLoaded(t,n,o){t.timeAdded=he.now(),o==="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 u.k("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const n=this.getRenderableIds();for(let a=0;a<n.length;a++){const c=n[a];if(t.neighboringTiles&&t.neighboringTiles[c]){const m=this.getTileByID(c);o(t,m),o(m,t)}}function o(a,c){a.needsHillshadePrepare=!0,a.needsTerrainPrepare=!0;let m=c.tileID.canonical.x-a.tileID.canonical.x;const _=c.tileID.canonical.y-a.tileID.canonical.y,v=Math.pow(2,a.tileID.canonical.z),b=c.tileID.key;m===0&&_===0||Math.abs(_)>1||(Math.abs(m)>1&&(Math.abs(m+v)===1?m+=v:Math.abs(m-v)===1&&(m-=v)),c.dem&&a.dem&&(a.dem.backfillBorder(c.dem,m,_),a.neighboringTiles&&a.neighboringTiles[b]&&(a.neighboringTiles[b].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,o,a){for(const c in this._tiles){let m=this._tiles[c];if(a[c]||!m.hasData()||m.tileID.overscaledZ<=n||m.tileID.overscaledZ>o)continue;let _=m.tileID;for(;m&&m.tileID.overscaledZ>n+1;){const b=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[b.key],m&&m.hasData()&&(_=b)}let v=_;for(;v.overscaledZ>n;)if(v=v.scaledTo(v.overscaledZ-1),t[v.key]){a[_.key]=_;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const o=this._loadedParentTiles[t.key];return o&&o.tileID.overscaledZ>=n?o:null}for(let o=t.overscaledZ-1;o>=n;o--){const a=t.scaledTo(o),c=this._getLoadedTile(a);if(c)return c}}findLoadedSibling(t){return this._getLoadedTile(t)}_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,o=Math.ceil(t.height/this._source.tileSize)+1,a=Math.floor(n*o*(this._maxTileCacheZoomLevels===null?u.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),c=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,a):a;this._cache.setMaxSize(c)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const o={};for(const a in this._tiles){const c=this._tiles[a];c.tileID=c.tileID.unwrapTo(c.tileID.wrap+n),o[c.tileID.key]=c}this._tiles=o;for(const a in this._timers)clearTimeout(this._timers[a]),delete this._timers[a];for(const a in this._tiles)this._setTileReloadTimer(a,this._tiles[a])}}_updateCoveredAndRetainedTiles(t,n,o,a,c,m){const _={},v={},b=Object.keys(t),P=he.now();for(const E of b){const z=t[E],B=this._tiles[E];if(!B||B.fadeEndTime!==0&&B.fadeEndTime<=P)continue;const V=this.findLoadedParent(z,n),q=this.findLoadedSibling(z),j=V||q||null;j&&(this._addTile(j.tileID),_[j.tileID.key]=j.tileID),v[E]=z}this._retainLoadedChildren(v,a,o,t);for(const E in _)t[E]||(this._coveredTiles[E]=!0,t[E]=_[E]);if(m){const E={},z={};for(const B of c)this._tiles[B.key].hasData()?E[B.key]=B:z[B.key]=B;for(const B in z){const V=z[B].children(this._source.maxzoom);this._tiles[V[0].key]&&this._tiles[V[1].key]&&this._tiles[V[2].key]&&this._tiles[V[3].key]&&(E[V[0].key]=t[V[0].key]=V[0],E[V[1].key]=t[V[1].key]=V[1],E[V[2].key]=t[V[2].key]=V[2],E[V[3].key]=t[V[3].key]=V[3],delete z[B])}for(const B in z){const V=z[B],q=this.findLoadedParent(V,this._source.minzoom),j=this.findLoadedSibling(V),H=q||j||null;if(H){E[H.tileID.key]=t[H.tileID.key]=H.tileID;for(const J in E)E[J].isChildOf(H.tileID)&&delete E[J]}}for(const B in this._tiles)E[B]||(this._coveredTiles[B]=!0)}}update(t,n){if(!this._sourceLoaded||this._paused)return;let o;this.transform=t,this.terrain=n,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?o=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(P=>new u.S(P.canonical.z,P.wrap,P.canonical.z,P.canonical.x,P.canonical.y)):(o=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&&(o=o.filter(P=>this._source.hasTile(P)))):o=[];const a=t.coveringZoomLevel(this._source),c=Math.max(a-Ye.maxOverzooming,this._source.minzoom),m=Math.max(a+Ye.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const P={};for(const E of o)if(E.canonical.z>this._source.minzoom){const z=E.scaledTo(E.canonical.z-1);P[z.key]=z;const B=E.scaledTo(Math.max(this._source.minzoom,Math.min(E.canonical.z,5)));P[B.key]=B}o=o.concat(Object.values(P))}const _=o.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,_&&this.fire(new u.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const v=this._updateRetainedTiles(o,a);ir(this._source.type)&&this._updateCoveredAndRetainedTiles(v,c,m,a,o,n);for(const P in v)this._tiles[P].clearFadeHold();const b=u.ac(this._tiles,v);for(const P of b){const E=this._tiles[P];E.hasSymbolBuckets&&!E.holdingForFade()?E.setHoldDuration(this.map._fadeDuration):E.hasSymbolBuckets&&!E.symbolFadeFinished()||this._removeTile(P)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){var o;const a={},c={},m=Math.max(n-Ye.maxOverzooming,this._source.minzoom),_=Math.max(n+Ye.maxUnderzooming,this._source.minzoom),v={};for(const b of t){const P=this._addTile(b);a[b.key]=b,P.hasData()||n<this._source.maxzoom&&(v[b.key]=b)}this._retainLoadedChildren(v,n,_,a);for(const b of t){let P=this._tiles[b.key];if(P.hasData())continue;if(n+1>this._source.maxzoom){const z=b.children(this._source.maxzoom)[0],B=this.getTile(z);if(B&&B.hasData()){a[z.key]=z;continue}}else{const z=b.children(this._source.maxzoom);if(a[z[0].key]&&a[z[1].key]&&a[z[2].key]&&a[z[3].key])continue}let E=P.wasRequested();for(let z=b.overscaledZ-1;z>=m;--z){const B=b.scaledTo(z);if(c[B.key])break;if(c[B.key]=!0,P=this.getTile(B),!P&&E&&(P=this._addTile(B)),P){const V=P.hasData();if((V||!(!((o=this.map)===null||o===void 0)&&o.cancelPendingTileRequestsWhileZooming)||E)&&(a[B.key]=B),E=P.wasRequested(),V)break}}}return a}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let o,a=this._tiles[t].tileID;for(;a.overscaledZ>0;){if(a.key in this._loadedParentTiles){o=this._loadedParentTiles[a.key];break}n.push(a.key);const c=a.scaledTo(a.overscaledZ-1);if(o=this._getLoadedTile(c),o)break;a=c}for(const c of n)this._loadedParentTiles[c]=o}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const t in this._tiles){const n=this._tiles[t].tileID,o=this._getLoadedTile(n);this._loadedSiblingTiles[n.key]=o}}_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 o=n;return n||(n=new $r(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,t.key,n.state)),n.uses++,this._tiles[t.key]=n,o||this._source.fire(new u.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 o=n.getExpiryTimeout();o&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},o))}_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))))}_dataHandler(t){const n=t.sourceDataType;t.dataType==="source"&&n==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&t.dataType==="source"&&n==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,n,o){const a=[],c=this.transform;if(!c)return a;const m=o?c.getCameraQueryGeometry(t):t,_=t.map(V=>c.pointCoordinate(V,this.terrain)),v=m.map(V=>c.pointCoordinate(V,this.terrain)),b=this.getIds();let P=1/0,E=1/0,z=-1/0,B=-1/0;for(const V of v)P=Math.min(P,V.x),E=Math.min(E,V.y),z=Math.max(z,V.x),B=Math.max(B,V.y);for(let V=0;V<b.length;V++){const q=this._tiles[b[V]];if(q.holdingForFade())continue;const j=q.tileID,H=Math.pow(2,c.zoom-q.tileID.overscaledZ),J=n*q.queryPadding*u.X/q.tileSize/H,N=[j.getTilePoint(new u.Z(P,E)),j.getTilePoint(new u.Z(z,B))];if(N[0].x-J<u.X&&N[0].y-J<u.X&&N[1].x+J>=0&&N[1].y+J>=0){const ee=_.map(le=>j.getTilePoint(le)),ne=v.map(le=>j.getTilePoint(le));a.push({tile:q,tileID:j,queryGeometry:ee,cameraQueryGeometry:ne,scale:H})}}return a}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map(o=>this._tiles[o].tileID);for(const o of n)o.posMatrix=this.transform.calculatePosMatrix(o.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(ir(this._source.type)){const t=he.now();for(const n in this._tiles)if(this._tiles[n].fadeEndTime>=t)return!0}return!1}setFeatureState(t,n,o){this._state.updateState(t=t||"_geojsonTileLayer",n,o)}removeFeatureState(t,n,o){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,o)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,o){const a=this._tiles[t];a&&a.setDependencies(n,o)}reloadTilesForDependencies(t,n){for(const o in this._tiles)this._tiles[o].hasDependency(t,n)&&this._reloadTile(o,"reloading");this._cache.filter(o=>!o.hasDependency(t,n))}}function Ci(h,t){const n=Math.abs(2*h.wrap)-+(h.wrap<0),o=Math.abs(2*t.wrap)-+(t.wrap<0);return h.overscaledZ-t.overscaledZ||o-n||t.canonical.y-h.canonical.y||t.canonical.x-h.canonical.x}function ir(h){return h==="raster"||h==="image"||h==="video"}Ye.maxOverzooming=10,Ye.maxUnderzooming=3;class rt{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let o=1;o<this.points.length;o++)this._distances[o]=this._distances[o-1]+this.points[o].dist(this.points[o-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=u.ad(t,0,1);let n=1,o=this._distances[n];const a=t*this.paddedLength+this.padding;for(;o<a&&n<this._distances.length;)o=this._distances[++n];const c=n-1,m=this._distances[c],_=o-m,v=_>0?(a-m)/_:0;return this.points[c].mult(1-v).add(this.points[n].mult(v))}}function _r(h,t){let n=!0;return h==="always"||h!=="never"&&t!=="never"||(n=!1),n}class Mr{constructor(t,n,o){const a=this.boxCells=[],c=this.circleCells=[];this.xCellCount=Math.ceil(t/o),this.yCellCount=Math.ceil(n/o);for(let m=0;m<this.xCellCount*this.yCellCount;m++)a.push([]),c.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,o,a,c){this._forEachCell(n,o,a,c,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(o),this.bboxes.push(a),this.bboxes.push(c)}insertCircle(t,n,o,a){this._forEachCell(n-a,o-a,n+a,o+a,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(o),this.circles.push(a)}_insertBoxCell(t,n,o,a,c,m){this.boxCells[c].push(m)}_insertCircleCell(t,n,o,a,c,m){this.circleCells[c].push(m)}_query(t,n,o,a,c,m,_){if(o<0||t>this.width||a<0||n>this.height)return[];const v=[];if(t<=0&&n<=0&&this.width<=o&&this.height<=a){if(c)return[{key:null,x1:t,y1:n,x2:o,y2:a}];for(let b=0;b<this.boxKeys.length;b++)v.push({key:this.boxKeys[b],x1:this.bboxes[4*b],y1:this.bboxes[4*b+1],x2:this.bboxes[4*b+2],y2:this.bboxes[4*b+3]});for(let b=0;b<this.circleKeys.length;b++){const P=this.circles[3*b],E=this.circles[3*b+1],z=this.circles[3*b+2];v.push({key:this.circleKeys[b],x1:P-z,y1:E-z,x2:P+z,y2:E+z})}}else this._forEachCell(t,n,o,a,this._queryCell,v,{hitTest:c,overlapMode:m,seenUids:{box:{},circle:{}}},_);return v}query(t,n,o,a){return this._query(t,n,o,a,!1,null)}hitTest(t,n,o,a,c,m){return this._query(t,n,o,a,!0,c,m).length>0}hitTestCircle(t,n,o,a,c){const m=t-o,_=t+o,v=n-o,b=n+o;if(_<0||m>this.width||b<0||v>this.height)return!1;const P=[];return this._forEachCell(m,v,_,b,this._queryCellCircle,P,{hitTest:!0,overlapMode:a,circle:{x:t,y:n,radius:o},seenUids:{box:{},circle:{}}},c),P.length>0}_queryCell(t,n,o,a,c,m,_,v){const{seenUids:b,hitTest:P,overlapMode:E}=_,z=this.boxCells[c];if(z!==null){const V=this.bboxes;for(const q of z)if(!b.box[q]){b.box[q]=!0;const j=4*q,H=this.boxKeys[q];if(t<=V[j+2]&&n<=V[j+3]&&o>=V[j+0]&&a>=V[j+1]&&(!v||v(H))&&(!P||!_r(E,H.overlapMode))&&(m.push({key:H,x1:V[j],y1:V[j+1],x2:V[j+2],y2:V[j+3]}),P))return!0}}const B=this.circleCells[c];if(B!==null){const V=this.circles;for(const q of B)if(!b.circle[q]){b.circle[q]=!0;const j=3*q,H=this.circleKeys[q];if(this._circleAndRectCollide(V[j],V[j+1],V[j+2],t,n,o,a)&&(!v||v(H))&&(!P||!_r(E,H.overlapMode))){const J=V[j],N=V[j+1],ee=V[j+2];if(m.push({key:H,x1:J-ee,y1:N-ee,x2:J+ee,y2:N+ee}),P)return!0}}}return!1}_queryCellCircle(t,n,o,a,c,m,_,v){const{circle:b,seenUids:P,overlapMode:E}=_,z=this.boxCells[c];if(z!==null){const V=this.bboxes;for(const q of z)if(!P.box[q]){P.box[q]=!0;const j=4*q,H=this.boxKeys[q];if(this._circleAndRectCollide(b.x,b.y,b.radius,V[j+0],V[j+1],V[j+2],V[j+3])&&(!v||v(H))&&!_r(E,H.overlapMode))return m.push(!0),!0}}const B=this.circleCells[c];if(B!==null){const V=this.circles;for(const q of B)if(!P.circle[q]){P.circle[q]=!0;const j=3*q,H=this.circleKeys[q];if(this._circlesCollide(V[j],V[j+1],V[j+2],b.x,b.y,b.radius)&&(!v||v(H))&&!_r(E,H.overlapMode))return m.push(!0),!0}}}_forEachCell(t,n,o,a,c,m,_,v){const b=this._convertToXCellCoord(t),P=this._convertToYCellCoord(n),E=this._convertToXCellCoord(o),z=this._convertToYCellCoord(a);for(let B=b;B<=E;B++)for(let V=P;V<=z;V++)if(c.call(this,t,n,o,a,this.xCellCount*V+B,m,_,v))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,o,a,c,m){const _=a-t,v=c-n,b=o+m;return b*b>_*_+v*v}_circleAndRectCollide(t,n,o,a,c,m,_){const v=(m-a)/2,b=Math.abs(t-(a+v));if(b>v+o)return!1;const P=(_-c)/2,E=Math.abs(n-(c+P));if(E>P+o)return!1;if(b<=v||E<=P)return!0;const z=b-v,B=E-P;return z*z+B*B<=o*o}}function qr(h,t,n,o,a){const c=u.H();return t?(u.K(c,c,[1/a,1/a,1]),n||u.ae(c,c,o.angle)):u.L(c,o.labelPlaneMatrix,h),c}function yr(h,t,n,o,a){if(t){const c=u.af(h);return u.K(c,c,[a,a,1]),n||u.ae(c,c,-o.angle),c}return o.glCoordMatrix}function G(h,t,n){let o;n?(o=[h.x,h.y,n(h.x,h.y),1],u.ag(o,o,t)):(o=[h.x,h.y,0,1],function(c,m,_){const v=m[0],b=m[1];c[0]=_[0]*v+_[4]*b+_[12],c[1]=_[1]*v+_[5]*b+_[13],c[3]=_[3]*v+_[7]*b+_[15]}(o,o,t));const a=o[3];return{point:new u.P(o[0]/a,o[1]/a),signedDistanceFromCamera:a,isOccluded:!1}}function k(h,t){return .5+h/t*.5}function C(h,t){return h.x>=-t[0]&&h.x<=t[0]&&h.y>=-t[1]&&h.y<=t[1]}function O(h,t,n,o,a,c,m,_,v,b,P,E,z,B,V){const q=o?h.textSizeData:h.iconSizeData,j=u.ah(q,n.transform.zoom),H=[256/n.width*2+1,256/n.height*2+1],J=o?h.text.dynamicLayoutVertexArray:h.icon.dynamicLayoutVertexArray;J.clear();const N=h.lineVertexArray,ee=o?h.text.placedSymbolArray:h.icon.placedSymbolArray,ne=n.transform.width/n.transform.height;let le=!1;for(let ge=0;ge<ee.length;ge++){const ve=ee.get(ge);if(ve.hidden||ve.writingMode===u.ai.vertical&&!le){He(ve.numGlyphs,J);continue}le=!1;const De=G(new u.P(ve.anchorX,ve.anchorY),t,V);if(!C(De.point,H)){He(ve.numGlyphs,J);continue}const Re=k(n.transform.cameraToCenterDistance,De.signedDistanceFromCamera),be=u.aj(q,j,ve),Se=m?be/Re:be*Re,Ne={getElevation:V,labelPlaneMatrix:a,lineVertexArray:N,pitchWithMap:m,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:b,tileAnchorPoint:new u.P(ve.anchorX,ve.anchorY),unwrappedTileID:P,width:E,height:z,translation:B},it=te(Ne,ve,Se,!1,_,t,c,h.glyphOffsetArray,J,ne,v);le=it.useVertical,(it.notEnoughRoom||le||it.needsFlipping&&te(Ne,ve,Se,!0,_,t,c,h.glyphOffsetArray,J,ne,v).notEnoughRoom)&&He(ve.numGlyphs,J)}o?h.text.dynamicLayoutVertexBuffer.updateData(J):h.icon.dynamicLayoutVertexBuffer.updateData(J)}function $(h,t,n,o,a,c,m,_){const v=c.glyphStartIndex+c.numGlyphs,b=c.lineStartIndex,P=c.lineStartIndex+c.lineLength,E=t.getoffsetX(c.glyphStartIndex),z=t.getoffsetX(v-1),B=Pe(h*E,n,o,a,c.segment,b,P,_,m);if(!B)return null;const V=Pe(h*z,n,o,a,c.segment,b,P,_,m);return V?_.projectionCache.anyProjectionOccluded?null:{first:B,last:V}:null}function Y(h,t,n,o){return h===u.ai.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*o?{useVertical:!0}:(h===u.ai.vertical?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function te(h,t,n,o,a,c,m,_,v,b,P){const E=n/24,z=t.lineOffsetX*E,B=t.lineOffsetY*E;let V;if(t.numGlyphs>1){const q=t.glyphStartIndex+t.numGlyphs,j=t.lineStartIndex,H=t.lineStartIndex+t.lineLength,J=$(E,_,z,B,o,t,P,h);if(!J)return{notEnoughRoom:!0};const N=G(J.first.point,m,h.getElevation).point,ee=G(J.last.point,m,h.getElevation).point;if(a&&!o){const ne=Y(t.writingMode,N,ee,b);if(ne)return ne}V=[J.first];for(let ne=t.glyphStartIndex+1;ne<q-1;ne++)V.push(Pe(E*_.getoffsetX(ne),z,B,o,t.segment,j,H,h,P));V.push(J.last)}else{if(a&&!o){const j=G(h.tileAnchorPoint,c,h.getElevation).point,H=t.lineStartIndex+t.segment+1,J=new u.P(h.lineVertexArray.getx(H),h.lineVertexArray.gety(H)),N=G(J,c,h.getElevation),ee=N.signedDistanceFromCamera>0?N.point:function(le,ge,ve,De,Re,be){return re(le,ge,ve,1,Re,be)}(h.tileAnchorPoint,J,j,0,c,h),ne=Y(t.writingMode,j,ee,b);if(ne)return ne}const q=Pe(E*_.getoffsetX(t.glyphStartIndex),z,B,o,t.segment,t.lineStartIndex,t.lineStartIndex+t.lineLength,h,P);if(!q||h.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};V=[q]}for(const q of V)u.ak(v,q.point,q.angle);return{}}function re(h,t,n,o,a,c){const m=h.add(h.sub(t)._unit()),_=a!==void 0?G(m,a,c.getElevation).point:pe(m.x,m.y,c).point,v=n.sub(_);return n.add(v._mult(o/v.mag()))}function W(h,t,n){const o=t.projectionCache;if(o.projections[h])return o.projections[h];const a=new u.P(t.lineVertexArray.getx(h),t.lineVertexArray.gety(h)),c=pe(a.x,a.y,t);if(c.signedDistanceFromCamera>0)return o.projections[h]=c.point,o.anyProjectionOccluded=o.anyProjectionOccluded||c.isOccluded,c.point;const m=h-n.direction;return function(_,v,b,P,E){return re(_,v,b,P,void 0,E)}(n.distanceFromAnchor===0?t.tileAnchorPoint:new u.P(t.lineVertexArray.getx(m),t.lineVertexArray.gety(m)),a,n.previousVertex,n.absOffsetX-n.distanceFromAnchor+1,t)}function pe(h,t,n){const o=h+n.translation[0],a=t+n.translation[1];let c;return!n.pitchWithMap&&n.projection.useSpecialProjectionForSymbols?(c=n.projection.projectTileCoordinates(o,a,n.unwrappedTileID,n.getElevation),c.point.x=(.5*c.point.x+.5)*n.width,c.point.y=(.5*-c.point.y+.5)*n.height):(c=G(new u.P(o,a),n.labelPlaneMatrix,n.getElevation),c.isOccluded=!1),c}function _e(h,t,n){return h._unit()._perp()._mult(t*n)}function ce(h,t,n,o,a,c,m,_,v){if(_.projectionCache.offsets[h])return _.projectionCache.offsets[h];const b=n.add(t);if(h+v.direction<o||h+v.direction>=a)return _.projectionCache.offsets[h]=b,b;const P=W(h+v.direction,_,v),E=_e(P.sub(n),m,v.direction),z=n.add(E),B=P.add(E);return _.projectionCache.offsets[h]=u.al(c,b,z,B)||b,_.projectionCache.offsets[h]}function Pe(h,t,n,o,a,c,m,_,v){const b=o?h-t:h+t;let P=b>0?1:-1,E=0;o&&(P*=-1,E=Math.PI),P<0&&(E+=Math.PI);let z,B=P>0?c+a:c+a+1;_.projectionCache.cachedAnchorPoint?z=_.projectionCache.cachedAnchorPoint:(z=pe(_.tileAnchorPoint.x,_.tileAnchorPoint.y,_).point,_.projectionCache.cachedAnchorPoint=z);let V,q,j=z,H=z,J=0,N=0;const ee=Math.abs(b),ne=[];let le;for(;J+N<=ee;){if(B+=P,B<c||B>=m)return null;J+=N,H=j,q=V;const De={absOffsetX:ee,direction:P,distanceFromAnchor:J,previousVertex:H};if(j=W(B,_,De),n===0)ne.push(H),le=j.sub(H);else{let Re;const be=j.sub(H);Re=be.mag()===0?_e(W(B+P,_,De).sub(j),n,P):_e(be,n,P),q||(q=H.add(Re)),V=ce(B,Re,j,c,m,q,n,_,De),ne.push(q),le=V.sub(q)}N=le.mag()}const ge=le._mult((ee-J)/N)._add(q||H),ve=E+Math.atan2(j.y-H.y,j.x-H.x);return ne.push(ge),{point:ge,angle:v?ve:0,path:ne}}const Ge=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function He(h,t){for(let n=0;n<h;n++){const o=t.length;t.resize(o+4),t.float32.set(Ge,3*o)}}const st=100;class ft{constructor(t,n,o=new Mr(t.width+200,t.height+200,25),a=new Mr(t.width+200,t.height+200,25)){this.transform=t,this.mapProjection=n,this.grid=o,this.ignoredGrid=a,this.pitchFactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+st,this.screenBottomBoundary=t.height+st,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,n,o,a,c,m,_,v,b,P,E){const z=t.anchorPointX+v[0],B=t.anchorPointY+v[1],V=this.projectAndGetPerspectiveRatio(a,z,B,c,P),q=this._projectCollisionBox(t,o,a,c,m,_,v,V,P,E),[j,H,J,N]=q.box;return this.mapProjection.useSpecialProjectionForSymbols&&(m?q.allPointsOccluded:this.mapProjection.isOccluded(z,B,c))||V.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid(j,H,J,N)||n!=="always"&&this.grid.hitTest(j,H,J,N,n,b)?{box:[j,H,J,N],placeable:!1,offscreen:!1}:{box:[j,H,J,N],placeable:!0,offscreen:this.isOffscreen(j,H,J,N)}}placeCollisionCircles(t,n,o,a,c,m,_,v,b,P,E,z,B,V,q,j){const H=[],J=new u.P(n.anchorX,n.anchorY),N=this.getPerspectiveRatio(m,J.x,J.y,_,j),ee=(E?c/N:c*N)/u.aq,ne={getElevation:j,labelPlaneMatrix:v,lineVertexArray:o,pitchWithMap:E,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:J,unwrappedTileID:_,width:this.transform.width,height:this.transform.height,translation:q},le=$(ee,a,n.lineOffsetX*ee,n.lineOffsetY*ee,!1,n,!1,ne);let ge=!1,ve=!1,De=!0;if(le){const Re=.5*B*N+V,be=new u.P(-100,-100),Se=new u.P(this.screenRightBoundary,this.screenBottomBoundary),Ne=new rt,it=le.first,Ee=le.last;let ke=[];for(let ot=it.path.length-1;ot>=1;ot--)ke.push(it.path[ot]);for(let ot=1;ot<Ee.path.length;ot++)ke.push(Ee.path[ot]);const Qe=2.5*Re;if(b){const ot=this.projectPathToScreenSpace(ke,ne,b);ke=ot.some(ut=>ut.signedDistanceFromCamera<=0)?[]:ot.map(ut=>ut.point)}let Rt=[];if(ke.length>0){const ot=ke[0].clone(),ut=ke[0].clone();for(let Bt=1;Bt<ke.length;Bt++)ot.x=Math.min(ot.x,ke[Bt].x),ot.y=Math.min(ot.y,ke[Bt].y),ut.x=Math.max(ut.x,ke[Bt].x),ut.y=Math.max(ut.y,ke[Bt].y);Rt=ot.x>=be.x&&ut.x<=Se.x&&ot.y>=be.y&&ut.y<=Se.y?[ke]:ut.x<be.x||ot.x>Se.x||ut.y<be.y||ot.y>Se.y?[]:u.am([ke],be.x,be.y,Se.x,Se.y)}for(const ot of Rt){Ne.reset(ot,.25*Re);let ut=0;ut=Ne.length<=.5*Re?1:Math.ceil(Ne.paddedLength/Qe)+1;for(let Bt=0;Bt<ut;Bt++){const pi=Bt/Math.max(ut-1,1),sr=Ne.lerp(pi),Ft=sr.x+st,Mi=sr.y+st;H.push(Ft,Mi,Re,0);const Ii=Ft-Re,fi=Mi-Re,mi=Ft+Re,or=Mi+Re;if(De=De&&this.isOffscreen(Ii,fi,mi,or),ve=ve||this.isInsideGrid(Ii,fi,mi,or),t!=="always"&&this.grid.hitTestCircle(Ft,Mi,Re,t,z)&&(ge=!0,!P))return{circles:[],offscreen:!1,collisionDetected:ge}}}}return{circles:!P&&ge||!ve||N<this.perspectiveRatioCutoff?[]:H,offscreen:De,collisionDetected:ge}}projectPathToScreenSpace(t,n,o){return t.map(a=>G(a,o,n.getElevation))}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[];let o=1/0,a=1/0,c=-1/0,m=-1/0;for(const P of t){const E=new u.P(P.x+st,P.y+st);o=Math.min(o,E.x),a=Math.min(a,E.y),c=Math.max(c,E.x),m=Math.max(m,E.y),n.push(E)}const _=this.grid.query(o,a,c,m).concat(this.ignoredGrid.query(o,a,c,m)),v={},b={};for(const P of _){const E=P.key;if(v[E.bucketInstanceId]===void 0&&(v[E.bucketInstanceId]={}),v[E.bucketInstanceId][E.featureIndex])continue;const z=[new u.P(P.x1,P.y1),new u.P(P.x2,P.y1),new u.P(P.x2,P.y2),new u.P(P.x1,P.y2)];u.an(n,z)&&(v[E.bucketInstanceId][E.featureIndex]=!0,b[E.bucketInstanceId]===void 0&&(b[E.bucketInstanceId]=[]),b[E.bucketInstanceId].push(E.featureIndex))}return b}insertCollisionBox(t,n,o,a,c,m){(o?this.ignoredGrid:this.grid).insert({bucketInstanceId:a,featureIndex:c,collisionGroupID:m,overlapMode:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,o,a,c,m){const _=o?this.ignoredGrid:this.grid,v={bucketInstanceId:a,featureIndex:c,collisionGroupID:m,overlapMode:n};for(let b=0;b<t.length;b+=4)_.insertCircle(v,t[b],t[b+1],t[b+2])}projectAndGetPerspectiveRatio(t,n,o,a,c){const m=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(n,o,a,c):G(new u.P(n,o),t,c);return{point:new u.P((m.point.x+1)/2*this.transform.width+st,(1-m.point.y)/2*this.transform.height+st),perspectiveRatio:.5+this.transform.cameraToCenterDistance/m.signedDistanceFromCamera*.5,isOccluded:m.isOccluded,signedDistanceFromCamera:m.signedDistanceFromCamera}}getPerspectiveRatio(t,n,o,a,c){const m=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(n,o,a,c):G(new u.P(n,o),t,c);return .5+this.transform.cameraToCenterDistance/m.signedDistanceFromCamera*.5}isOffscreen(t,n,o,a){return o<st||t>=this.screenRightBoundary||a<st||n>this.screenBottomBoundary}isInsideGrid(t,n,o,a){return o>=0&&t<this.gridRightBoundary&&a>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=u.ao([]);return u.J(t,t,[-100,-100,0]),t}_projectCollisionBox(t,n,o,a,c,m,_,v,b,P){const E=n*v.perspectiveRatio;let z=new u.P(1,0),B=new u.P(0,1);const V=new u.P(t.anchorPointX+_[0],t.anchorPointY+_[1]);if(m&&!c){const Re=this.projectAndGetPerspectiveRatio(o,V.x+1,V.y,a,b).point.sub(v.point).unit(),be=Math.atan(Re.y/Re.x)+(Re.x<0?Math.PI:0),Se=Math.sin(be),Ne=Math.cos(be);z=new u.P(Ne,Se),B=new u.P(-Se,Ne)}else if(!m&&c){const Re=-this.transform.angle,be=Math.sin(Re),Se=Math.cos(Re);z=new u.P(Se,be),B=new u.P(-be,Se)}let q=v.point,j=E;if(c){q=V;const Re=this.transform.zoom-Math.floor(this.transform.zoom);j=Math.pow(2,-Re),j*=this.mapProjection.getPitchedTextCorrection(this.transform,V,a),P||(j*=u.ad(.5+v.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))}P&&(q=q.add(z.mult(P.x*j)).add(B.mult(P.y*j)));const H=t.x1*j,J=t.x2*j,N=(H+J)/2,ee=t.y1*j,ne=t.y2*j,le=(ee+ne)/2,ge=[{offsetX:H,offsetY:ee},{offsetX:N,offsetY:ee},{offsetX:J,offsetY:ee},{offsetX:J,offsetY:le},{offsetX:J,offsetY:ne},{offsetX:N,offsetY:ne},{offsetX:H,offsetY:ne},{offsetX:H,offsetY:le}];let ve=[];for(const{offsetX:Re,offsetY:be}of ge)ve.push(new u.P(q.x+z.x*Re+B.x*be,q.y+z.y*Re+B.y*be));let De=!1;if(c){const Re=ve.map(be=>this.projectAndGetPerspectiveRatio(o,be.x,be.y,a,b));De=Re.some(be=>!be.isOccluded),ve=Re.map(be=>be.point)}else De=!0;return{box:u.ap(ve),allPointsOccluded:!De}}}function nt(h,t,n){return t*(u.X/(h.tileSize*Math.pow(2,n-h.tileID.overscaledZ)))}class At{constructor(t,n,o,a){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):a&&o?1:0,this.placed=o}isHidden(){return this.opacity===0&&!this.placed}}class qt{constructor(t,n,o,a,c){this.text=new At(t?t.text:null,n,o,c),this.icon=new At(t?t.icon:null,n,a,c)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Kt{constructor(t,n,o){this.text=t,this.icon=n,this.skipFade=o}}class lt{constructor(){this.invProjMatrix=u.H(),this.viewportMatrix=u.H(),this.circles=[]}}class bt{constructor(t,n,o,a,c){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=o,this.bucketIndex=a,this.tileID=c}}class Vt{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:o=>o.collisionGroupID===n}}return this.collisionGroups[t]}}function ei(h,t,n,o,a){const{horizontalAlign:c,verticalAlign:m}=u.av(h);return new u.P(-(c-.5)*t+o[0]*a,-(m-.5)*n+o[1]*a)}class hi{constructor(t,n,o,a,c,m){this.transform=t.clone(),this.terrain=o,this.collisionIndex=new ft(this.transform,n),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new Vt(c),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=m,m&&(m.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){const n=this.terrain;return n?(o,a)=>n.getElevation(t,o,a):null}getBucketParts(t,n,o,a){const c=o.getBucket(n),m=o.latestFeatureIndex;if(!c||!m||n.id!==c.layerIds[0])return;const _=o.collisionBoxArray,v=c.layers[0].layout,b=c.layers[0].paint,P=Math.pow(2,this.transform.zoom-o.tileID.overscaledZ),E=o.tileSize/u.X,z=o.tileID.toUnwrapped(),B=this.transform.calculatePosMatrix(z),V=v.get("text-pitch-alignment")==="map",q=v.get("text-rotation-alignment")==="map",j=nt(o,1,this.transform.zoom),H=this.collisionIndex.mapProjection.translatePosition(this.transform,o,b.get("text-translate"),b.get("text-translate-anchor")),J=this.collisionIndex.mapProjection.translatePosition(this.transform,o,b.get("icon-translate"),b.get("icon-translate-anchor")),N=qr(B,V,q,this.transform,j);let ee=null;if(V){const le=yr(B,V,q,this.transform,j);ee=u.L([],this.transform.labelPlaneMatrix,le)}this.retainedQueryData[c.bucketInstanceId]=new bt(c.bucketInstanceId,m,c.sourceLayerIndex,c.index,o.tileID);const ne={bucket:c,layout:v,translationText:H,translationIcon:J,posMatrix:B,unwrappedTileID:z,textLabelPlaneMatrix:N,labelToScreenMatrix:ee,scale:P,textPixelRatio:E,holdingForFade:o.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:u.ah(c.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(c.sourceID)};if(a)for(const le of c.sortKeyRanges){const{sortKey:ge,symbolInstanceStart:ve,symbolInstanceEnd:De}=le;t.push({sortKey:ge,symbolInstanceStart:ve,symbolInstanceEnd:De,parameters:ne})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:c.symbolInstances.length,parameters:ne})}attemptAnchorPlacement(t,n,o,a,c,m,_,v,b,P,E,z,B,V,q,j,H,J,N){const ee=u.ar[t.textAnchor],ne=[t.textOffset0,t.textOffset1],le=ei(ee,o,a,ne,c),ge=this.collisionIndex.placeCollisionBox(n,z,v,b,P,_,m,j,E.predicate,N,le);if((!J||this.collisionIndex.placeCollisionBox(J,z,v,b,P,_,m,H,E.predicate,N,le).placeable)&&ge.placeable){let ve;if(this.prevPlacement&&this.prevPlacement.variableOffsets[B.crossTileID]&&this.prevPlacement.placements[B.crossTileID]&&this.prevPlacement.placements[B.crossTileID].text&&(ve=this.prevPlacement.variableOffsets[B.crossTileID].anchor),B.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[B.crossTileID]={textOffset:ne,width:o,height:a,anchor:ee,textBoxScale:c,prevAnchor:ve},this.markUsedJustification(V,ee,B,q),V.allowVerticalPlacement&&(this.markUsedOrientation(V,q,B),this.placedOrientations[B.crossTileID]=q),{shift:le,placedGlyphBoxes:ge}}}placeLayerBucketPart(t,n,o){const{bucket:a,layout:c,translationText:m,translationIcon:_,posMatrix:v,unwrappedTileID:b,textLabelPlaneMatrix:P,labelToScreenMatrix:E,textPixelRatio:z,holdingForFade:B,collisionBoxArray:V,partiallyEvaluatedTextSize:q,collisionGroup:j}=t.parameters,H=c.get("text-optional"),J=c.get("icon-optional"),N=u.as(c,"text-overlap","text-allow-overlap"),ee=N==="always",ne=u.as(c,"icon-overlap","icon-allow-overlap"),le=ne==="always",ge=c.get("text-rotation-alignment")==="map",ve=c.get("text-pitch-alignment")==="map",De=c.get("icon-text-fit")!=="none",Re=c.get("symbol-z-order")==="viewport-y",be=ee&&(le||!a.hasIconData()||J),Se=le&&(ee||!a.hasTextData()||H);!a.collisionArrays&&V&&a.deserializeCollisionBoxes(V);const Ne=this._getTerrainElevationFunc(this.retainedQueryData[a.bucketInstanceId].tileID),it=(Ee,ke,Qe)=>{var Rt,ot;if(n[Ee.crossTileID])return;if(B)return void(this.placements[Ee.crossTileID]=new Kt(!1,!1,!1));let ut=!1,Bt=!1,pi=!0,sr=null,Ft={box:null,placeable:!1,offscreen:null},Mi={box:null,placeable:!1,offscreen:null},Ii=null,fi=null,mi=null,or=0,xn=0,yo=0;ke.textFeatureIndex?or=ke.textFeatureIndex:Ee.useRuntimeCollisionCircles&&(or=Ee.featureIndex),ke.verticalTextFeatureIndex&&(xn=ke.verticalTextFeatureIndex);const $n=ke.textBox;if($n){const ai=gi=>{let _i=u.ai.horizontal;if(a.allowVerticalPlacement&&!gi&&this.prevPlacement){const ni=this.prevPlacement.placedOrientations[Ee.crossTileID];ni&&(this.placedOrientations[Ee.crossTileID]=ni,_i=ni,this.markUsedOrientation(a,_i,Ee))}return _i},ar=(gi,_i)=>{if(a.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&ke.verticalTextBox){for(const ni of a.writingModes)if(ni===u.ai.vertical?(Ft=_i(),Mi=Ft):Ft=gi(),Ft&&Ft.placeable)break}else Ft=gi()},Kr=Ee.textAnchorOffsetStartIndex,qn=Ee.textAnchorOffsetEndIndex;if(qn===Kr){const gi=(_i,ni)=>{const jt=this.collisionIndex.placeCollisionBox(_i,N,z,v,b,ve,ge,m,j.predicate,Ne);return jt&&jt.placeable&&(this.markUsedOrientation(a,ni,Ee),this.placedOrientations[Ee.crossTileID]=ni),jt};ar(()=>gi($n,u.ai.horizontal),()=>{const _i=ke.verticalTextBox;return a.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&_i?gi(_i,u.ai.vertical):{box:null,offscreen:null}}),ai(Ft&&Ft.placeable)}else{let gi=u.ar[(ot=(Rt=this.prevPlacement)===null||Rt===void 0?void 0:Rt.variableOffsets[Ee.crossTileID])===null||ot===void 0?void 0:ot.anchor];const _i=(jt,Zn,La)=>{const ti=jt.x2-jt.x1,Zl=jt.y2-jt.y1,vo=Ee.textBoxScale,bo=De&&ne==="never"?Zn:null;let Yr=null,Gl=N==="never"?1:2,Ra="never";gi&&Gl++;for(let Ba=0;Ba<Gl;Ba++){for(let Fa=Kr;Fa<qn;Fa++){const wo=a.textAnchorOffsets.get(Fa);if(gi&&wo.textAnchor!==gi)continue;const Gn=this.attemptAnchorPlacement(wo,jt,ti,Zl,vo,ge,ve,z,v,b,j,Ra,Ee,a,La,m,_,bo,Ne);if(Gn&&(Yr=Gn.placedGlyphBoxes,Yr&&Yr.placeable))return ut=!0,sr=Gn.shift,Yr}gi?gi=null:Ra=N}return o&&!Yr&&(Yr={box:this.collisionIndex.placeCollisionBox($n,"always",z,v,b,ve,ge,m,j.predicate,Ne,new u.P(0,0)).box,offscreen:!1,placeable:!1}),Yr};ar(()=>_i($n,ke.iconBox,u.ai.horizontal),()=>{const jt=ke.verticalTextBox;return a.allowVerticalPlacement&&(!Ft||!Ft.placeable)&&Ee.numVerticalGlyphVertices>0&&jt?_i(jt,ke.verticalIconBox,u.ai.vertical):{box:null,occluded:!0,offscreen:null}}),Ft&&(ut=Ft.placeable,pi=Ft.offscreen);const ni=ai(Ft&&Ft.placeable);if(!ut&&this.prevPlacement){const jt=this.prevPlacement.variableOffsets[Ee.crossTileID];jt&&(this.variableOffsets[Ee.crossTileID]=jt,this.markUsedJustification(a,jt.anchor,Ee,ni))}}}if(Ii=Ft,ut=Ii&&Ii.placeable,pi=Ii&&Ii.offscreen,Ee.useRuntimeCollisionCircles){const ai=a.text.placedSymbolArray.get(Ee.centerJustifiedTextSymbolIndex),ar=u.aj(a.textSizeData,q,ai),Kr=c.get("text-padding");fi=this.collisionIndex.placeCollisionCircles(N,ai,a.lineVertexArray,a.glyphOffsetArray,ar,v,b,P,E,o,ve,j.predicate,Ee.collisionCircleDiameter,Kr,m,Ne),fi.circles.length&&fi.collisionDetected&&!o&&u.w("Collisions detected, but collision boxes are not shown"),ut=ee||fi.circles.length>0&&!fi.collisionDetected,pi=pi&&fi.offscreen}if(ke.iconFeatureIndex&&(yo=ke.iconFeatureIndex),ke.iconBox){const ai=ar=>this.collisionIndex.placeCollisionBox(ar,ne,z,v,b,ve,ge,_,j.predicate,Ne,De&&sr?sr:void 0);Mi&&Mi.placeable&&ke.verticalIconBox?(mi=ai(ke.verticalIconBox),Bt=mi.placeable):(mi=ai(ke.iconBox),Bt=mi.placeable),pi=pi&&mi.offscreen}const vn=H||Ee.numHorizontalGlyphVertices===0&&Ee.numVerticalGlyphVertices===0,xo=J||Ee.numIconVertices===0;vn||xo?xo?vn||(Bt=Bt&&ut):ut=Bt&&ut:Bt=ut=Bt&&ut;const Da=Bt&&mi.placeable;if(ut&&Ii.placeable&&this.collisionIndex.insertCollisionBox(Ii.box,N,c.get("text-ignore-placement"),a.bucketInstanceId,Mi&&Mi.placeable&&xn?xn:or,j.ID),Da&&this.collisionIndex.insertCollisionBox(mi.box,ne,c.get("icon-ignore-placement"),a.bucketInstanceId,yo,j.ID),fi&&ut&&this.collisionIndex.insertCollisionCircles(fi.circles,N,c.get("text-ignore-placement"),a.bucketInstanceId,or,j.ID),o&&this.storeCollisionData(a.bucketInstanceId,Qe,ke,Ii,mi,fi),Ee.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(a.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Ee.crossTileID]=new Kt(ut||be,Bt||Se,pi||a.justReloaded),n[Ee.crossTileID]=!0};if(Re){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ee=a.getSortedSymbolIndexes(this.transform.angle);for(let ke=Ee.length-1;ke>=0;--ke){const Qe=Ee[ke];it(a.symbolInstances.get(Qe),a.collisionArrays[Qe],Qe)}}else for(let Ee=t.symbolInstanceStart;Ee<t.symbolInstanceEnd;Ee++)it(a.symbolInstances.get(Ee),a.collisionArrays[Ee],Ee);if(o&&a.bucketInstanceId in this.collisionCircleArrays){const Ee=this.collisionCircleArrays[a.bucketInstanceId];u.at(Ee.invProjMatrix,v),Ee.viewportMatrix=this.collisionIndex.getViewportMatrix()}a.justReloaded=!1}storeCollisionData(t,n,o,a,c,m){if(o.textBox||o.iconBox){let _,v;this.collisionBoxArrays.has(t)?_=this.collisionBoxArrays.get(t):(_=new Map,this.collisionBoxArrays.set(t,_)),_.has(n)?v=_.get(n):(v={text:null,icon:null},_.set(n,v)),o.textBox&&(v.text=a.box),o.iconBox&&(v.icon=c.box)}if(m){let _=this.collisionCircleArrays[t];_===void 0&&(_=this.collisionCircleArrays[t]=new lt);for(let v=0;v<m.circles.length;v+=4)_.circles.push(m.circles[v+0]),_.circles.push(m.circles[v+1]),_.circles.push(m.circles[v+2]),_.circles.push(m.collisionDetected?1:0)}}markUsedJustification(t,n,o,a){let c;c=a===u.ai.vertical?o.verticalPlacedTextSymbolIndex:{left:o.leftJustifiedTextSymbolIndex,center:o.centerJustifiedTextSymbolIndex,right:o.rightJustifiedTextSymbolIndex}[u.au(n)];const m=[o.leftJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.rightJustifiedTextSymbolIndex,o.verticalPlacedTextSymbolIndex];for(const _ of m)_>=0&&(t.text.placedSymbolArray.get(_).crossTileID=c>=0&&_!==c?0:o.crossTileID)}markUsedOrientation(t,n,o){const a=n===u.ai.horizontal||n===u.ai.horizontalOnly?n:0,c=n===u.ai.vertical?n:0,m=[o.leftJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.rightJustifiedTextSymbolIndex];for(const _ of m)t.text.placedSymbolArray.get(_).placedOrientation=a;o.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(o.verticalPlacedTextSymbolIndex).placedOrientation=c)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let o=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const a=n?n.symbolFadeChange(t):1,c=n?n.opacities:{},m=n?n.variableOffsets:{},_=n?n.placedOrientations:{};for(const v in this.placements){const b=this.placements[v],P=c[v];P?(this.opacities[v]=new qt(P,a,b.text,b.icon),o=o||b.text!==P.text.placed||b.icon!==P.icon.placed):(this.opacities[v]=new qt(null,a,b.text,b.icon,b.skipFade),o=o||b.text||b.icon)}for(const v in c){const b=c[v];if(!this.opacities[v]){const P=new qt(b,a,!1,!1);P.isHidden()||(this.opacities[v]=P,o=o||b.text.placed||b.icon.placed)}}for(const v in m)this.variableOffsets[v]||!this.opacities[v]||this.opacities[v].isHidden()||(this.variableOffsets[v]=m[v]);for(const v in _)this.placedOrientations[v]||!this.opacities[v]||this.opacities[v].isHidden()||(this.placedOrientations[v]=_[v]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");o?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const o={};for(const a of n){const c=a.getBucket(t);c&&a.latestFeatureIndex&&t.id===c.layerIds[0]&&this.updateBucketOpacities(c,a.tileID,o,a.collisionBoxArray)}}updateBucketOpacities(t,n,o,a){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],m=c.layout,_=new qt(null,0,!1,!1,!0),v=m.get("text-allow-overlap"),b=m.get("icon-allow-overlap"),P=c._unevaluatedLayout.hasValue("text-variable-anchor")||c._unevaluatedLayout.hasValue("text-variable-anchor-offset"),E=m.get("text-rotation-alignment")==="map",z=m.get("text-pitch-alignment")==="map",B=m.get("icon-text-fit")!=="none",V=new qt(null,0,v&&(b||!t.hasIconData()||m.get("icon-optional")),b&&(v||!t.hasTextData()||m.get("text-optional")),!0);!t.collisionArrays&&a&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(a);const q=(H,J,N)=>{for(let ee=0;ee<J/4;ee++)H.opacityVertexArray.emplaceBack(N);H.hasVisibleVertices=H.hasVisibleVertices||N!==di},j=this.collisionBoxArrays.get(t.bucketInstanceId);for(let H=0;H<t.symbolInstances.length;H++){const J=t.symbolInstances.get(H),{numHorizontalGlyphVertices:N,numVerticalGlyphVertices:ee,crossTileID:ne}=J;let le=this.opacities[ne];o[ne]?le=_:le||(le=V,this.opacities[ne]=le),o[ne]=!0;const ge=J.numIconVertices>0,ve=this.placedOrientations[J.crossTileID],De=ve===u.ai.vertical,Re=ve===u.ai.horizontal||ve===u.ai.horizontalOnly;if(N>0||ee>0){const Se=Ni(le.text);q(t.text,N,De?di:Se),q(t.text,ee,Re?di:Se);const Ne=le.text.isHidden();[J.rightJustifiedTextSymbolIndex,J.centerJustifiedTextSymbolIndex,J.leftJustifiedTextSymbolIndex].forEach(ke=>{ke>=0&&(t.text.placedSymbolArray.get(ke).hidden=Ne||De?1:0)}),J.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(J.verticalPlacedTextSymbolIndex).hidden=Ne||Re?1:0);const it=this.variableOffsets[J.crossTileID];it&&this.markUsedJustification(t,it.anchor,J,ve);const Ee=this.placedOrientations[J.crossTileID];Ee&&(this.markUsedJustification(t,"left",J,Ee),this.markUsedOrientation(t,Ee,J))}if(ge){const Se=Ni(le.icon),Ne=!(B&&J.verticalPlacedIconSymbolIndex&&De);J.placedIconSymbolIndex>=0&&(q(t.icon,J.numIconVertices,Ne?Se:di),t.icon.placedSymbolArray.get(J.placedIconSymbolIndex).hidden=le.icon.isHidden()),J.verticalPlacedIconSymbolIndex>=0&&(q(t.icon,J.numVerticalIconVertices,Ne?di:Se),t.icon.placedSymbolArray.get(J.verticalPlacedIconSymbolIndex).hidden=le.icon.isHidden())}const be=j&&j.has(H)?j.get(H):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const Se=t.collisionArrays[H];if(Se){let Ne=new u.P(0,0);if(Se.textBox||Se.verticalTextBox){let it=!0;if(P){const Ee=this.variableOffsets[ne];Ee?(Ne=ei(Ee.anchor,Ee.width,Ee.height,Ee.textOffset,Ee.textBoxScale),E&&Ne._rotate(z?this.transform.angle:-this.transform.angle)):it=!1}if(Se.textBox||Se.verticalTextBox){let Ee;Se.textBox&&(Ee=De),Se.verticalTextBox&&(Ee=Re),ui(t.textCollisionBox.collisionVertexArray,le.text.placed,!it||Ee,be.text,Ne.x,Ne.y)}}if(Se.iconBox||Se.verticalIconBox){const it=!!(!Re&&Se.verticalIconBox);let Ee;Se.iconBox&&(Ee=it),Se.verticalIconBox&&(Ee=!it),ui(t.iconCollisionBox.collisionVertexArray,le.icon.placed,Ee,be.icon,B?Ne.x:0,B?Ne.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 H=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=H.invProjMatrix,t.placementViewportMatrix=H.viewportMatrix,t.collisionCircleArray=H.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 o=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*o>t}setStale(){this.stale=!0}}function ui(h,t,n,o,a,c){o&&o.length!==0||(o=[0,0,0,0]);const m=o[0]-st,_=o[1]-st,v=o[2]-st,b=o[3]-st;h.emplaceBack(t?1:0,n?1:0,a||0,c||0,m,_),h.emplaceBack(t?1:0,n?1:0,a||0,c||0,v,_),h.emplaceBack(t?1:0,n?1:0,a||0,c||0,v,b),h.emplaceBack(t?1:0,n?1:0,a||0,c||0,m,b)}const ls=Math.pow(2,25),wt=Math.pow(2,24),No=Math.pow(2,17),jo=Math.pow(2,16),Oi=Math.pow(2,9),Vi=Math.pow(2,8),Dc=Math.pow(2,1);function Ni(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*ls+t*wt+n*No+t*jo+n*Oi+t*Vi+n*Dc+t}const di=0;function js(){return{isOccluded:(h,t,n)=>!1,getPitchedTextCorrection:(h,t,n)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(h,t,n,o){throw new Error("Not implemented.")},translatePosition:(h,t,n,o)=>function(a,c,m,_,v=!1){if(!m[0]&&!m[1])return[0,0];const b=v?_==="map"?a.angle:0:_==="viewport"?-a.angle:0;if(b){const P=Math.sin(b),E=Math.cos(b);m=[m[0]*E-m[1]*P,m[0]*P+m[1]*E]}return[v?m[0]:nt(c,m[0],a.zoom),v?m[1]:nt(c,m[1],a.zoom)]}(h,t,n,o),getCircleRadiusCorrection:h=>1}}class cs{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,o,a,c){const m=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(m,a,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,c())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,m.sort((_,v)=>_.sortKey-v.sortKey));this._currentPartIndex<m.length;)if(n.placeLayerBucketPart(m[this._currentPartIndex],this._seenCrossTileIDs,o),this._currentPartIndex++,c())return!0;return!1}}class Yt{constructor(t,n,o,a,c,m,_,v){this.placement=new hi(t,js(),n,m,_,v),this._currentPlacementIndex=o.length-1,this._forceFullPlacement=a,this._showCollisionBoxes=c,this._done=!1}isDone(){return this._done}continuePlacement(t,n,o){const a=he.now(),c=()=>!this._forceFullPlacement&&he.now()-a>2;for(;this._currentPlacementIndex>=0;){const m=n[t[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(m.type==="symbol"&&(!m.minzoom||m.minzoom<=_)&&(!m.maxzoom||m.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new cs(m)),this._inProgressLayer.continuePlacement(o[m.source],this.placement,this._showCollisionBoxes,m,c))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const zr=512/u.X/2;class cn{constructor(t,n,o){this.tileID=t,this.bucketInstanceId=o,this._symbolsByKey={};const a=new Map;for(let c=0;c<n.length;c++){const m=n.get(c),_=m.key,v=a.get(_);v?v.push(m):a.set(_,[m])}for(const[c,m]of a){const _={positions:m.map(v=>({x:Math.floor(v.anchorX*zr),y:Math.floor(v.anchorY*zr)})),crossTileIDs:m.map(v=>v.crossTileID)};if(_.positions.length>128){const v=new u.aw(_.positions.length,16,Uint16Array);for(const{x:b,y:P}of _.positions)v.add(b,P);v.finish(),delete _.positions,_.index=v}this._symbolsByKey[c]=_}}getScaledCoordinates(t,n){const{x:o,y:a,z:c}=this.tileID.canonical,{x:m,y:_,z:v}=n.canonical,b=zr/Math.pow(2,v-c),P=(_*u.X+t.anchorY)*b,E=a*u.X*zr;return{x:Math.floor((m*u.X+t.anchorX)*b-o*u.X*zr),y:Math.floor(P-E)}}findMatches(t,n,o){const a=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let c=0;c<t.length;c++){const m=t.get(c);if(m.crossTileID)continue;const _=this._symbolsByKey[m.key];if(!_)continue;const v=this.getScaledCoordinates(m,n);if(_.index){const b=_.index.range(v.x-a,v.y-a,v.x+a,v.y+a).sort();for(const P of b){const E=_.crossTileIDs[P];if(!o[E]){o[E]=!0,m.crossTileID=E;break}}}else if(_.positions)for(let b=0;b<_.positions.length;b++){const P=_.positions[b],E=_.crossTileIDs[b];if(Math.abs(P.x-v.x)<=a&&Math.abs(P.y-v.y)<=a&&!o[E]){o[E]=!0,m.crossTileID=E;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:t})=>t)}}class Wt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Us{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const o in this.indexes){const a=this.indexes[o],c={};for(const m in a){const _=a[m];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+n),c[_.tileID.key]=_}this.indexes[o]=c}this.lng=t}addBucket(t,n,o){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 c=0;c<n.symbolInstances.length;c++)n.symbolInstances.get(c).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const a=this.usedCrossTileIDs[t.overscaledZ];for(const c in this.indexes){const m=this.indexes[c];if(Number(c)>t.overscaledZ)for(const _ in m){const v=m[_];v.tileID.isChildOf(t)&&v.findMatches(n.symbolInstances,t,a)}else{const _=m[t.scaledTo(Number(c)).key];_&&_.findMatches(n.symbolInstances,t,a)}}for(let c=0;c<n.symbolInstances.length;c++){const m=n.symbolInstances.get(c);m.crossTileID||(m.crossTileID=o.generate(),a[m.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new cn(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const o of n.getCrossTileIDsLists())for(const a of o)delete this.usedCrossTileIDs[t][a]}removeStaleBuckets(t){let n=!1;for(const o in this.indexes){const a=this.indexes[o];for(const c in a)t[a[c].bucketInstanceId]||(this.removeBucketCrossTileIDs(o,a[c]),delete a[c],n=!0)}return n}}class Xi{constructor(){this.layerIndexes={},this.crossTileIDs=new Wt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,o){let a=this.layerIndexes[t.id];a===void 0&&(a=this.layerIndexes[t.id]=new Us);let c=!1;const m={};a.handleWrapJump(o);for(const _ of n){const v=_.getBucket(t);v&&t.id===v.layerIds[0]&&(v.bucketInstanceId||(v.bucketInstanceId=++this.maxBucketInstanceId),a.addBucket(_.tileID,v,this.crossTileIDs)&&(c=!0),m[v.bucketInstanceId]=!0)}return a.removeStaleBuckets(m)&&(c=!0),c}pruneUnusedLayers(t){const n={};t.forEach(o=>{n[o]=!0});for(const o in this.layerIndexes)n[o]||delete this.layerIndexes[o]}}const hs=(h,t)=>u.t(h,t&&t.filter(n=>n.identifier!=="source.canvas")),Zr=u.ax();class Uo extends u.E{constructor(t,n={}){super(),this._rtlPluginLoaded=()=>{for(const o in this.sourceCaches){const a=this.sourceCaches[o].getSource().type;a!=="vector"&&a!=="geojson"||this.sourceCaches[o].reload()}},this.map=t,this.dispatcher=new an(on(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",(o,a)=>this.getGlyphs(o,a)),this.dispatcher.registerMessageHandler("GI",(o,a)=>this.getImages(o,a)),this.imageManager=new ci,this.imageManager.setEventedParent(this),this.glyphManager=new pr(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new An(256,512),this.crossTileSymbolIndex=new Xi,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new u.ay,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",u.az()),gr().on(Te,this._rtlPluginLoaded),this.on("data",o=>{if(o.dataType!=="source"||o.sourceDataType!=="metadata")return;const a=this.sourceCaches[o.sourceId];if(!a)return;const c=a.getSource();if(c&&c.vectorLayerIds)for(const m in this._layers){const _=this._layers[m];_.source===c.id&&this._validateLayer(_)}})}loadURL(t,n={},o){this.fire(new u.k("dataloading",{dataType:"style"})),n.validate=typeof n.validate!="boolean"||n.validate;const a=this.map._requestManager.transformRequest(t,"Style");this._loadStyleRequest=new AbortController;const c=this._loadStyleRequest;u.h(a,this._loadStyleRequest).then(m=>{this._loadStyleRequest=null,this._load(m.data,n,o)}).catch(m=>{this._loadStyleRequest=null,m&&!c.signal.aborted&&this.fire(new u.j(m))})}loadJSON(t,n={},o){this.fire(new u.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,he.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,n.validate=n.validate!==!1,this._load(t,n,o)}).catch(()=>{})}loadEmpty(){this.fire(new u.k("dataloading",{dataType:"style"})),this._load(Zr,{validate:!1})}_load(t,n,o){var a;const c=n.transformStyle?n.transformStyle(o,t):t;if(!n.validate||!hs(this,u.x(c))){this._loaded=!0,this.stylesheet=c;for(const m in c.sources)this.addSource(m,c.sources[m],{validate:!1});c.sprite?this._loadSprite(c.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(c.glyphs),this._createLayers(),this.light=new Ar(this.stylesheet.light),this.sky=new er(this.stylesheet.sky),this.map.setTerrain((a=this.stylesheet.terrain)!==null&&a!==void 0?a:null),this.fire(new u.k("data",{dataType:"style"})),this.fire(new u.k("style.load"))}}_createLayers(){const t=u.aA(this.stylesheet.layers);this.dispatcher.broadcast("SL",t),this._order=t.map(n=>n.id),this._layers={},this._serializedLayers=null;for(const n of t){const o=u.aB(n);o.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=o}}_loadSprite(t,n=!1,o=void 0){let a;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(c,m,_,v){return u._(this,void 0,void 0,function*(){const b=ri(c),P=_>1?"@2x":"",E={},z={};for(const{id:B,url:V}of b){const q=m.transformRequest(Qi(V,P,".json"),"SpriteJSON");E[B]=u.h(q,v);const j=m.transformRequest(Qi(V,P,".png"),"SpriteImage");z[B]=We.getImage(j,v)}return yield Promise.all([...Object.values(E),...Object.values(z)]),function(B,V){return u._(this,void 0,void 0,function*(){const q={};for(const j in B){q[j]={};const H=he.getImageCanvasContext((yield V[j]).data),J=(yield B[j]).data;for(const N in J){const{width:ee,height:ne,x:le,y:ge,sdf:ve,pixelRatio:De,stretchX:Re,stretchY:be,content:Se,textFitWidth:Ne,textFitHeight:it}=J[N];q[j][N]={data:null,pixelRatio:De,sdf:ve,stretchX:Re,stretchY:be,content:Se,textFitWidth:Ne,textFitHeight:it,spriteData:{width:ee,height:ne,x:le,y:ge,context:H}}}}return q})}(E,z)})}(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(c=>{if(this._spriteRequest=null,c)for(const m in c){this._spritesImagesIds[m]=[];const _=this._spritesImagesIds[m]?this._spritesImagesIds[m].filter(v=>!(v in c)):[];for(const v of _)this.imageManager.removeImage(v),this._changedImages[v]=!0;for(const v in c[m]){const b=m==="default"?v:`${m}:${v}`;this._spritesImagesIds[m].push(b),b in this.imageManager.images?this.imageManager.updateImage(b,c[m][v],!1):this.imageManager.addImage(b,c[m][v]),n&&(this._changedImages[b]=!0)}}}).catch(c=>{this._spriteRequest=null,a=c,this.fire(new u.j(a))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"})),o&&o(a)})}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}_validateLayer(t){const n=this.sourceCaches[t.source];if(!n)return;const o=t.sourceLayer;if(!o)return;const a=n.getSource();(a.type==="geojson"||a.vectorLayerIds&&a.vectorLayerIds.indexOf(o)===-1)&&this.fire(new u.j(new Error(`Source layer "${o}" does not exist on source "${a.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 o=[];for(const a of t)n[a]&&o.push(n[a]);return o}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const n=Object.keys(this._layers);for(const o of n){const a=this._layers[o];a.type!=="custom"&&(t[o]=a.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const n=this._changed;if(n){const a=Object.keys(this._updatedLayers),c=Object.keys(this._removedLayers);(a.length||c.length)&&this._updateWorkerLayers(a,c);for(const m in this._updatedSources){const _=this._updatedSources[m];if(_==="reload")this._reloadSource(m);else{if(_!=="clear")throw new Error(`Invalid action ${_}`);this._clearSource(m)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const m in this._updatedPaintProps)this._layers[m].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}const o={};for(const a in this.sourceCaches){const c=this.sourceCaches[a];o[a]=c.used,c.used=!1}for(const a of this._order){const c=this._layers[a];c.recalculate(t,this._availableImages),!c.isHidden(t.zoom)&&c.source&&(this.sourceCaches[c.source].used=!0)}for(const a in o){const c=this.sourceCaches[a];!!o[a]!=!!c.used&&c.fire(new u.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:a}))}this.light.recalculate(t),this.sky.recalculate(t),this.z=t.zoom,n&&this.fire(new u.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("UL",{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={}){var o;this._checkLoaded();const a=this.serialize();if(t=n.transformStyle?n.transformStyle(a,t):t,((o=n.validate)===null||o===void 0||o)&&hs(this,u.x(t)))return!1;(t=u.aC(t)).layers=u.aA(t.layers);const c=u.aD(a,t),m=this._getOperationsToPerform(c);if(m.unimplemented.length>0)throw new Error(`Unimplemented: ${m.unimplemented.join(", ")}.`);if(m.operations.length===0)return!1;for(const _ of m.operations)_();return this.stylesheet=t,this._serializedLayers=null,!0}_getOperationsToPerform(t){const n=[],o=[];for(const a of t)switch(a.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":n.push(()=>this.addLayer.apply(this,a.args));break;case"removeLayer":n.push(()=>this.removeLayer.apply(this,a.args));break;case"setPaintProperty":n.push(()=>this.setPaintProperty.apply(this,a.args));break;case"setLayoutProperty":n.push(()=>this.setLayoutProperty.apply(this,a.args));break;case"setFilter":n.push(()=>this.setFilter.apply(this,a.args));break;case"addSource":n.push(()=>this.addSource.apply(this,a.args));break;case"removeSource":n.push(()=>this.removeSource.apply(this,a.args));break;case"setLayerZoomRange":n.push(()=>this.setLayerZoomRange.apply(this,a.args));break;case"setLight":n.push(()=>this.setLight.apply(this,a.args));break;case"setGeoJSONSourceData":n.push(()=>this.setGeoJSONSourceData.apply(this,a.args));break;case"setGlyphs":n.push(()=>this.setGlyphs.apply(this,a.args));break;case"setSprite":n.push(()=>this.setSprite.apply(this,a.args));break;case"setSky":n.push(()=>this.setSky.apply(this,a.args));break;case"setTerrain":n.push(()=>this.map.setTerrain.apply(this,a.args));break;case"setTransition":n.push(()=>{});break;default:o.push(a.command)}return{operations:n,unimplemented:o}}addImage(t,n){if(this.getImage(t))return this.fire(new u.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 u.j(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,o={}){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(u.x.source,`sources.${t}`,n,null,o))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const a=this.sourceCaches[t]=new Ye(t,n,this.dispatcher);a.style=this,a.setEventedParent(this,()=>({isSourceLoaded:a.loaded(),source:a.serialize(),sourceId:t})),a.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 o in this._layers)if(this._layers[o].source===t)return this.fire(new u.j(new Error(`Source "${t}" cannot be removed while layer "${o}" is using it.`)));const n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new u.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 o=this.sourceCaches[t].getSource();if(o.type!=="geojson")throw new Error(`geojsonSource.type is ${o.type}, which is !== 'geojson`);o.setData(n),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,n,o={}){this._checkLoaded();const a=t.id;if(this.getLayer(a))return void this.fire(new u.j(new Error(`Layer "${a}" already exists on this map.`)));let c;if(t.type==="custom"){if(hs(this,u.aE(t)))return;c=u.aB(t)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(a,t.source),t=u.aC(t),t=u.e(t,{source:a})),this._validate(u.x.layer,`layers.${a}`,t,{arrayIndex:-1},o))return;c=u.aB(t),this._validateLayer(c),c.setEventedParent(this,{layer:{id:a}})}const m=n?this._order.indexOf(n):this._order.length;if(n&&m===-1)this.fire(new u.j(new Error(`Cannot add layer "${a}" before non-existing layer "${n}".`)));else{if(this._order.splice(m,0,a),this._layerOrderChanged=!0,this._layers[a]=c,this._removedLayers[a]&&c.source&&c.type!=="custom"){const _=this._removedLayers[a];delete this._removedLayers[a],_.type!==c.type?this._updatedSources[c.source]="clear":(this._updatedSources[c.source]="reload",this.sourceCaches[c.source].pause())}this._updateLayer(c),c.onAdd&&c.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new u.j(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const o=this._order.indexOf(t);this._order.splice(o,1);const a=n?this._order.indexOf(n):this._order.length;n&&a===-1?this.fire(new u.j(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(a,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new u.j(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const o=this._order.indexOf(t);this._order.splice(o,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,o){this._checkLoaded();const a=this.getLayer(t);a?a.minzoom===n&&a.maxzoom===o||(n!=null&&(a.minzoom=n),o!=null&&(a.maxzoom=o),this._updateLayer(a)):this.fire(new u.j(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,o={}){this._checkLoaded();const a=this.getLayer(t);if(a){if(!u.aF(a.filter,n))return n==null?(a.filter=void 0,void this._updateLayer(a)):void(this._validate(u.x.filter,`layers.${a.id}.filter`,n,null,o)||(a.filter=u.aC(n),this._updateLayer(a)))}else this.fire(new u.j(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return u.aC(this.getLayer(t).filter)}setLayoutProperty(t,n,o,a={}){this._checkLoaded();const c=this.getLayer(t);c?u.aF(c.getLayoutProperty(n),o)||(c.setLayoutProperty(n,o,a),this._updateLayer(c)):this.fire(new u.j(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const o=this.getLayer(t);if(o)return o.getLayoutProperty(n);this.fire(new u.j(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,o,a={}){this._checkLoaded();const c=this.getLayer(t);c?u.aF(c.getPaintProperty(n),o)||(c.setPaintProperty(n,o,a)&&this._updateLayer(c),this._changed=!0,this._updatedPaintProps[t]=!0,this._serializedLayers=null):this.fire(new u.j(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const o=t.source,a=t.sourceLayer,c=this.sourceCaches[o];if(c===void 0)return void this.fire(new u.j(new Error(`The source '${o}' does not exist in the map's style.`)));const m=c.getSource().type;m==="geojson"&&a?this.fire(new u.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):m!=="vector"||a?(t.id===void 0&&this.fire(new u.j(new Error("The feature id parameter must be provided."))),c.setFeatureState(a,t.id,n)):this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const o=t.source,a=this.sourceCaches[o];if(a===void 0)return void this.fire(new u.j(new Error(`The source '${o}' does not exist in the map's style.`)));const c=a.getSource().type,m=c==="vector"?t.sourceLayer:void 0;c!=="vector"||m?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new u.j(new Error("A feature id is required to remove its specific state property."))):a.removeFeatureState(m,t.id,n):this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,o=t.sourceLayer,a=this.sourceCaches[n];if(a!==void 0)return a.getSource().type!=="vector"||o?(t.id===void 0&&this.fire(new u.j(new Error("The feature id parameter must be provided."))),a.getFeatureState(o,t.id)):void this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new u.j(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return u.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=u.aG(this.sourceCaches,c=>c.serialize()),n=this._serializeByIds(this._order),o=this.map.getTerrain()||void 0,a=this.stylesheet;return u.aH({version:a.version,name:a.name,metadata:a.metadata,light:a.light,sky:a.sky,center:a.center,zoom:a.zoom,bearing:a.bearing,pitch:a.pitch,sprite:a.sprite,glyphs:a.glyphs,transition:a.transition,sources:t,layers:n,terrain:o},c=>c!==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=m=>this._layers[m].type==="fill-extrusion",o={},a=[];for(let m=this._order.length-1;m>=0;m--){const _=this._order[m];if(n(_)){o[_]=m;for(const v of t){const b=v[_];if(b)for(const P of b)a.push(P)}}}a.sort((m,_)=>_.intersectionZ-m.intersectionZ);const c=[];for(let m=this._order.length-1;m>=0;m--){const _=this._order[m];if(n(_))for(let v=a.length-1;v>=0;v--){const b=a[v].feature;if(o[b.layer.id]<m)break;c.push(b),a.pop()}else for(const v of t){const b=v[_];if(b)for(const P of b)c.push(P.feature)}}return c}queryRenderedFeatures(t,n,o){n&&n.filter&&this._validate(u.x.filter,"queryRenderedFeatures.filter",n.filter,null,n);const a={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new u.j(new Error("parameters.layers must be an Array."))),[];for(const _ of n.layers){const v=this._layers[_];if(!v)return this.fire(new u.j(new Error(`The layer '${_}' does not exist in the map's style and cannot be queried for features.`))),[];a[v.source]=!0}}const c=[];n.availableImages=this._availableImages;const m=this._serializedAllLayers();for(const _ in this.sourceCaches)n.layers&&!a[_]||c.push(Nr(this.sourceCaches[_],this._layers,m,t,n,o));return this.placement&&c.push(function(_,v,b,P,E,z,B){const V={},q=z.queryRenderedSymbols(P),j=[];for(const H of Object.keys(q).map(Number))j.push(B[H]);j.sort(jr);for(const H of j){const J=H.featureIndex.lookupSymbolFeatures(q[H.bucketInstanceId],v,H.bucketIndex,H.sourceLayerIndex,E.filter,E.layers,E.availableImages,_);for(const N in J){const ee=V[N]=V[N]||[],ne=J[N];ne.sort((le,ge)=>{const ve=H.featureSortOrder;if(ve){const De=ve.indexOf(le.featureIndex);return ve.indexOf(ge.featureIndex)-De}return ge.featureIndex-le.featureIndex});for(const le of ne)ee.push(le)}}for(const H in V)V[H].forEach(J=>{const N=J.feature,ee=b[_[H].source].getFeatureState(N.layer["source-layer"],N.id);N.source=N.layer.source,N.layer["source-layer"]&&(N.sourceLayer=N.layer["source-layer"]),N.state=ee});return V}(this._layers,m,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(c)}querySourceFeatures(t,n){n&&n.filter&&this._validate(u.x.filter,"querySourceFeatures.filter",n.filter,null,n);const o=this.sourceCaches[t];return o?function(a,c){const m=a.getRenderableIds().map(b=>a.getTileByID(b)),_=[],v={};for(let b=0;b<m.length;b++){const P=m[b],E=P.tileID.canonical.key;v[E]||(v[E]=!0,P.querySourceFeatures(_,c))}return _}(o,n):[]}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const o=this.light.getLight();let a=!1;for(const m in t)if(!u.aF(t[m],o[m])){a=!0;break}if(!a)return;const c={now:he.now(),transition:u.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(c)}getSky(){var t;return(t=this.stylesheet)===null||t===void 0?void 0:t.sky}setSky(t,n={}){const o=this.sky.getSky();let a=!1;t||o&&(a=!0);for(const m in t)if(!u.aF(t[m],o[m])){a=!0;break}if(!a)return;const c={now:he.now(),transition:u.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,n),this.sky.updateTransitions(c)}_validate(t,n,o,a,c={}){return(!c||c.validate!==!1)&&hs(this,t.call(u.x,u.e({key:n,style:this.serialize(),value:o,styleSpec:u.v},a)))}_remove(t=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),gr().off(Te,this._rtlPluginLoaded);for(const n in this._layers)this._layers[n].setEventedParent(null);for(const n in this.sourceCaches){const o=this.sourceCaches[n];o.setEventedParent(null),o.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),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,o,a,c=!1){let m=!1,_=!1;const v={};for(const b of this._order){const P=this._layers[b];if(P.type!=="symbol")continue;if(!v[P.source]){const z=this.sourceCaches[P.source];v[P.source]=z.getRenderableIds(!0).map(B=>z.getTileByID(B)).sort((B,V)=>V.tileID.overscaledZ-B.tileID.overscaledZ||(B.tileID.isLessThan(V.tileID)?-1:1))}const E=this.crossTileSymbolIndex.addLayer(P,v[P.source],t.center.lng);m=m||E}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((c=c||this._layerOrderChanged||o===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(he.now(),t.zoom))&&(this.pauseablePlacement=new Yt(t,this.map.terrain,this._order,c,n,o,a,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,v),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(he.now()),_=!0),m&&this.pauseablePlacement.placement.setStale()),_||m)for(const b of this._order){const P=this._layers[b];P.type==="symbol"&&this.placement.updateLayerOpacities(P,v[P.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(he.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,n){return u._(this,void 0,void 0,function*(){const o=yield this.imageManager.getImages(n.icons);this._updateTilesForChangedImages();const a=this.sourceCaches[n.source];return a&&a.setDependencies(n.tileID.key,n.type,n.icons),o})}getGlyphs(t,n){return u._(this,void 0,void 0,function*(){const o=yield this.glyphManager.getGlyphs(n.stacks),a=this.sourceCaches[n.source];return a&&a.setDependencies(n.tileID.key,n.type,[""]),o})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,n={}){this._checkLoaded(),t&&this._validate(u.x.glyphs,"glyphs",t,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,n,o={},a){this._checkLoaded();const c=[{id:t,url:n}],m=[...ri(this.stylesheet.sprite),...c];this._validate(u.x.sprite,"sprite",m,null,o)||(this.stylesheet.sprite=m,this._loadSprite(c,!0,a))}removeSprite(t){this._checkLoaded();const n=ri(this.stylesheet.sprite);if(n.find(o=>o.id===t)){if(this._spritesImagesIds[t])for(const o of this._spritesImagesIds[t])this.imageManager.removeImage(o),this._changedImages[o]=!0;n.splice(n.findIndex(o=>o.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("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}else this.fire(new u.j(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return ri(this.stylesheet.sprite)}setSprite(t,n={},o){this._checkLoaded(),t&&this._validate(u.x.sprite,"sprite",t,null,n)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,o):(this._unloadSprite(),o&&o(null)))}}var us=u.Y([{name:"a_pos",type:"Int16",components:2}]);const Gr={prelude:yt(`#ifdef GL_ES
|
6
6
|
precision mediump float;
|
7
7
|
#else
|
8
8
|
#if !defined(lowp)
|
@@ -57,15 +57,15 @@ vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=frac
|
|
57
57
|
#else
|
58
58
|
return 0.0;
|
59
59
|
#endif
|
60
|
-
}`),background:
|
60
|
+
}`),background:yt(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
|
61
61
|
#ifdef OVERDRAW_INSPECTOR
|
62
62
|
gl_FragColor=vec4(1.0);
|
63
63
|
#endif
|
64
|
-
}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:
|
64
|
+
}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:yt(`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;
|
65
65
|
#ifdef OVERDRAW_INSPECTOR
|
66
66
|
gl_FragColor=vec4(1.0);
|
67
67
|
#endif
|
68
|
-
}`,"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:
|
68
|
+
}`,"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:yt(`varying vec3 v_data;varying float v_visibility;
|
69
69
|
#pragma mapbox: define highp vec4 color
|
70
70
|
#pragma mapbox: define mediump float radius
|
71
71
|
#pragma mapbox: define lowp float blur
|
@@ -101,7 +101,7 @@ void main(void) {
|
|
101
101
|
#pragma mapbox: initialize highp vec4 stroke_color
|
102
102
|
#pragma mapbox: initialize mediump float stroke_width
|
103
103
|
#pragma mapbox: initialize lowp float stroke_opacity
|
104
|
-
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:
|
104
|
+
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:yt("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:yt(`uniform highp float u_intensity;varying vec2 v_extrude;
|
105
105
|
#pragma mapbox: define highp float weight
|
106
106
|
#define GAUSS_COEF 0.3989422804014327
|
107
107
|
void main() {
|
@@ -118,11 +118,11 @@ const highp float ZERO=1.0/255.0/16.0;
|
|
118
118
|
void main(void) {
|
119
119
|
#pragma mapbox: initialize highp float weight
|
120
120
|
#pragma mapbox: initialize mediump float radius
|
121
|
-
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:
|
121
|
+
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:yt(`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;
|
122
122
|
#ifdef OVERDRAW_INSPECTOR
|
123
123
|
gl_FragColor=vec4(0.0);
|
124
124
|
#endif
|
125
|
-
}`,"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:
|
125
|
+
}`,"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:yt("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_anchor_pos;attribute vec2 a_placed;attribute vec2 a_box_real;uniform mat4 u_matrix;uniform vec2 u_pixel_extrude_scale;varying float v_placed;varying float v_notUsed;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:yt("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:yt("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:yt(`#pragma mapbox: define highp vec4 color
|
126
126
|
#pragma mapbox: define lowp float opacity
|
127
127
|
void main() {
|
128
128
|
#pragma mapbox: initialize highp vec4 color
|
@@ -137,7 +137,7 @@ gl_FragColor=vec4(1.0);
|
|
137
137
|
void main() {
|
138
138
|
#pragma mapbox: initialize highp vec4 color
|
139
139
|
#pragma mapbox: initialize lowp float opacity
|
140
|
-
gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:
|
140
|
+
gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:yt(`varying vec2 v_pos;
|
141
141
|
#pragma mapbox: define highp vec4 outline_color
|
142
142
|
#pragma mapbox: define lowp float opacity
|
143
143
|
void main() {
|
@@ -153,7 +153,7 @@ gl_FragColor=vec4(1.0);
|
|
153
153
|
void main() {
|
154
154
|
#pragma mapbox: initialize highp vec4 outline_color
|
155
155
|
#pragma mapbox: initialize lowp float opacity
|
156
|
-
gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:
|
156
|
+
gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:yt(`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;
|
157
157
|
#pragma mapbox: define lowp float opacity
|
158
158
|
#pragma mapbox: define lowp vec4 pattern_from
|
159
159
|
#pragma mapbox: define lowp vec4 pattern_to
|
@@ -177,7 +177,7 @@ void main() {
|
|
177
177
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
178
178
|
#pragma mapbox: initialize lowp float pixel_ratio_from
|
179
179
|
#pragma mapbox: initialize lowp float pixel_ratio_to
|
180
|
-
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:
|
180
|
+
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:yt(`#ifdef GL_ES
|
181
181
|
precision highp float;
|
182
182
|
#endif
|
183
183
|
uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
|
@@ -204,7 +204,7 @@ void main() {
|
|
204
204
|
#pragma mapbox: initialize mediump vec4 pattern_to
|
205
205
|
#pragma mapbox: initialize lowp float pixel_ratio_from
|
206
206
|
#pragma mapbox: initialize lowp float pixel_ratio_to
|
207
|
-
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:
|
207
|
+
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:yt(`varying vec4 v_color;void main() {gl_FragColor=v_color;
|
208
208
|
#ifdef OVERDRAW_INSPECTOR
|
209
209
|
gl_FragColor=vec4(1.0);
|
210
210
|
#endif
|
@@ -226,7 +226,7 @@ float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_off
|
|
226
226
|
#else
|
227
227
|
float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
|
228
228
|
#endif
|
229
|
-
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:
|
229
|
+
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:yt(`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;
|
230
230
|
#pragma mapbox: define lowp float base
|
231
231
|
#pragma mapbox: define lowp float height
|
232
232
|
#pragma mapbox: define lowp vec4 pattern_from
|
@@ -270,20 +270,20 @@ float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
|
|
270
270
|
#endif
|
271
271
|
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
|
272
272
|
? a_pos
|
273
|
-
: 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:
|
273
|
+
: 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:yt(`#ifdef GL_ES
|
274
274
|
precision highp float;
|
275
275
|
#endif
|
276
276
|
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);
|
277
277
|
#ifdef OVERDRAW_INSPECTOR
|
278
278
|
gl_FragColor=vec4(1.0);
|
279
279
|
#endif
|
280
|
-
}`,"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:
|
280
|
+
}`,"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:yt(`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;
|
281
281
|
#define PI 3.141592653589793
|
282
282
|
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;
|
283
283
|
#ifdef OVERDRAW_INSPECTOR
|
284
284
|
gl_FragColor=vec4(1.0);
|
285
285
|
#endif
|
286
|
-
}`,"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:
|
286
|
+
}`,"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:yt(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
|
287
287
|
#pragma mapbox: define highp vec4 color
|
288
288
|
#pragma mapbox: define lowp float blur
|
289
289
|
#pragma mapbox: define lowp float opacity
|
@@ -317,7 +317,7 @@ v_gamma_scale=1.0;
|
|
317
317
|
#else
|
318
318
|
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;
|
319
319
|
#endif
|
320
|
-
v_width2=vec2(outset,inset);}`),lineGradient:
|
320
|
+
v_width2=vec2(outset,inset);}`),lineGradient:yt(`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;
|
321
321
|
#pragma mapbox: define lowp float blur
|
322
322
|
#pragma mapbox: define lowp float opacity
|
323
323
|
void main() {
|
@@ -347,7 +347,7 @@ v_gamma_scale=1.0;
|
|
347
347
|
#else
|
348
348
|
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;
|
349
349
|
#endif
|
350
|
-
v_width2=vec2(outset,inset);}`),linePattern:
|
350
|
+
v_width2=vec2(outset,inset);}`),linePattern:yt(`#ifdef GL_ES
|
351
351
|
precision highp float;
|
352
352
|
#endif
|
353
353
|
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;
|
@@ -399,7 +399,7 @@ v_gamma_scale=1.0;
|
|
399
399
|
#else
|
400
400
|
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;
|
401
401
|
#endif
|
402
|
-
v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:
|
402
|
+
v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:yt(`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;
|
403
403
|
#pragma mapbox: define highp vec4 color
|
404
404
|
#pragma mapbox: define lowp float blur
|
405
405
|
#pragma mapbox: define lowp float opacity
|
@@ -440,11 +440,11 @@ v_gamma_scale=1.0;
|
|
440
440
|
#else
|
441
441
|
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;
|
442
442
|
#endif
|
443
|
-
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:
|
443
|
+
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:yt(`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);
|
444
444
|
#ifdef OVERDRAW_INSPECTOR
|
445
445
|
gl_FragColor=vec4(1.0);
|
446
446
|
#endif
|
447
|
-
}`,"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:
|
447
|
+
}`,"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:yt(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
|
448
448
|
#pragma mapbox: define lowp float opacity
|
449
449
|
void main() {
|
450
450
|
#pragma mapbox: initialize lowp float opacity
|
@@ -458,7 +458,7 @@ void main() {
|
|
458
458
|
#pragma mapbox: initialize lowp float opacity
|
459
459
|
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
460
460
|
camera_to_anchor_distance/u_camera_to_center_distance :
|
461
|
-
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:
|
461
|
+
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:yt(`#define SDF_PX 8.0
|
462
462
|
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;
|
463
463
|
#pragma mapbox: define highp vec4 fill_color
|
464
464
|
#pragma mapbox: define highp vec4 halo_color
|
@@ -489,7 +489,7 @@ void main() {
|
|
489
489
|
#pragma mapbox: initialize lowp float halo_blur
|
490
490
|
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
491
491
|
camera_to_anchor_distance/u_camera_to_center_distance :
|
492
|
-
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:
|
492
|
+
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:yt(`#define SDF_PX 8.0
|
493
493
|
#define SDF 1.0
|
494
494
|
#define ICON 0.0
|
495
495
|
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;
|
@@ -526,60 +526,60 @@ void main() {
|
|
526
526
|
#pragma mapbox: initialize lowp float halo_blur
|
527
527
|
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
528
528
|
camera_to_anchor_distance/u_camera_to_center_distance :
|
529
|
-
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:
|
530
|
-
#ifndef HAS_UNIFORM_u_${
|
531
|
-
varying ${P} ${E} ${
|
529
|
+
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:yt("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;varying vec2 v_texture_pos;varying float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture2D(u_texture,v_texture_pos);if (v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);gl_FragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {gl_FragColor=surface_color;}}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform mat4 u_fog_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:yt("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:yt("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);}"),sky:yt("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform float u_horizon;uniform float u_sky_horizon_blend;void main() {float y=gl_FragCoord.y;if (y > u_horizon) {float blend=y-u_horizon;if (blend < u_sky_horizon_blend) {gl_FragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {gl_FragColor=u_sky_color;}}}","attribute vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function yt(h,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,o=t.match(/attribute ([\w]+) ([\w]+)/g),a=h.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),c=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),m=c?c.concat(a):a,_={};return{fragmentSource:h=h.replace(n,(v,b,P,E,z)=>(_[z]=!0,b==="define"?`
|
530
|
+
#ifndef HAS_UNIFORM_u_${z}
|
531
|
+
varying ${P} ${E} ${z};
|
532
532
|
#else
|
533
|
-
uniform ${P} ${E} u_${
|
533
|
+
uniform ${P} ${E} u_${z};
|
534
534
|
#endif
|
535
535
|
`:`
|
536
|
-
#ifdef HAS_UNIFORM_u_${
|
537
|
-
${P} ${E} ${
|
538
|
-
#endif
|
539
|
-
`)),vertexSource:t=t.replace(n,(v,b,P,E,
|
540
|
-
#ifndef HAS_UNIFORM_u_${
|
541
|
-
uniform lowp float u_${
|
542
|
-
attribute ${P} ${B} a_${
|
543
|
-
varying ${P} ${E} ${
|
536
|
+
#ifdef HAS_UNIFORM_u_${z}
|
537
|
+
${P} ${E} ${z} = u_${z};
|
538
|
+
#endif
|
539
|
+
`)),vertexSource:t=t.replace(n,(v,b,P,E,z)=>{const B=E==="float"?"vec2":"vec4",V=z.match(/color/)?"color":B;return _[z]?b==="define"?`
|
540
|
+
#ifndef HAS_UNIFORM_u_${z}
|
541
|
+
uniform lowp float u_${z}_t;
|
542
|
+
attribute ${P} ${B} a_${z};
|
543
|
+
varying ${P} ${E} ${z};
|
544
544
|
#else
|
545
|
-
uniform ${P} ${E} u_${
|
545
|
+
uniform ${P} ${E} u_${z};
|
546
546
|
#endif
|
547
547
|
`:V==="vec4"?`
|
548
|
-
#ifndef HAS_UNIFORM_u_${
|
549
|
-
${
|
548
|
+
#ifndef HAS_UNIFORM_u_${z}
|
549
|
+
${z} = a_${z};
|
550
550
|
#else
|
551
|
-
${P} ${E} ${
|
551
|
+
${P} ${E} ${z} = u_${z};
|
552
552
|
#endif
|
553
553
|
`:`
|
554
|
-
#ifndef HAS_UNIFORM_u_${
|
555
|
-
${
|
554
|
+
#ifndef HAS_UNIFORM_u_${z}
|
555
|
+
${z} = unpack_mix_${V}(a_${z}, u_${z}_t);
|
556
556
|
#else
|
557
|
-
${P} ${E} ${
|
557
|
+
${P} ${E} ${z} = u_${z};
|
558
558
|
#endif
|
559
559
|
`:b==="define"?`
|
560
|
-
#ifndef HAS_UNIFORM_u_${
|
561
|
-
uniform lowp float u_${
|
562
|
-
attribute ${P} ${B} a_${
|
560
|
+
#ifndef HAS_UNIFORM_u_${z}
|
561
|
+
uniform lowp float u_${z}_t;
|
562
|
+
attribute ${P} ${B} a_${z};
|
563
563
|
#else
|
564
|
-
uniform ${P} ${E} u_${
|
564
|
+
uniform ${P} ${E} u_${z};
|
565
565
|
#endif
|
566
566
|
`:V==="vec4"?`
|
567
|
-
#ifndef HAS_UNIFORM_u_${
|
568
|
-
${P} ${E} ${
|
567
|
+
#ifndef HAS_UNIFORM_u_${z}
|
568
|
+
${P} ${E} ${z} = a_${z};
|
569
569
|
#else
|
570
|
-
${P} ${E} ${
|
570
|
+
${P} ${E} ${z} = u_${z};
|
571
571
|
#endif
|
572
572
|
`:`
|
573
|
-
#ifndef HAS_UNIFORM_u_${
|
574
|
-
${P} ${E} ${
|
573
|
+
#ifndef HAS_UNIFORM_u_${z}
|
574
|
+
${P} ${E} ${z} = unpack_mix_${V}(a_${z}, u_${z}_t);
|
575
575
|
#else
|
576
|
-
${P} ${E} ${
|
577
|
-
#endif
|
578
|
-
`}),staticAttributes:o,staticUniforms:m}}class $s{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,n,o,a,
|
579
|
-
`),
|
580
|
-
`),j=_.createShader(_.FRAGMENT_SHADER);if(_.isContextLost())return void(this.failedToCreate=!0);if(_.shaderSource(j,H),_.compileShader(j),!_.getShaderParameter(j,_.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${_.getShaderInfoLog(j)}`);_.attachShader(this.program,j);const ee=_.createShader(_.VERTEX_SHADER);if(_.isContextLost())return void(this.failedToCreate=!0);if(_.shaderSource(ee,K),_.compileShader(ee),!_.getShaderParameter(ee,_.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${_.getShaderInfoLog(ee)}`);_.attachShader(this.program,ee),this.attributes={};const ne={};this.numAttributes=P.length;for(let ce=0;ce<this.numAttributes;ce++)P[ce]&&(_.bindAttribLocation(this.program,ce,P[ce]),this.attributes[P[ce]]=ce);if(_.linkProgram(this.program),!_.getProgramParameter(this.program,_.LINK_STATUS))throw new Error(`Program failed to link: ${_.getProgramInfoLog(this.program)}`);_.deleteShader(ee),_.deleteShader(j);for(let ce=0;ce<Z.length;ce++){const ge=Z[ce];if(ge&&!ne[ge]){const we=_.getUniformLocation(this.program,ge);we&&(ne[ge]=we)}}this.fixedUniforms=a(t,ne),this.terrainUniforms=((ce,ge)=>({u_depth:new c.aI(ce,ge.u_depth),u_terrain:new c.aI(ce,ge.u_terrain),u_terrain_dim:new c.aJ(ce,ge.u_terrain_dim),u_terrain_matrix:new c.aK(ce,ge.u_terrain_matrix),u_terrain_unpack:new c.aL(ce,ge.u_terrain_unpack),u_terrain_exaggeration:new c.aJ(ce,ge.u_terrain_exaggeration)}))(t,ne),this.binderUniforms=o?o.getUniforms(t,ne):[]}draw(t,n,o,a,h,m,_,v,b,P,E,L,B,V,Z,U,H,K){const j=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(o),t.setStencilMode(a),t.setColorMode(h),t.setCullFace(m),v){t.activeTexture.set(j.TEXTURE2),j.bindTexture(j.TEXTURE_2D,v.depthTexture),t.activeTexture.set(j.TEXTURE3),j.bindTexture(j.TEXTURE_2D,v.texture);for(const ne in this.terrainUniforms)this.terrainUniforms[ne].set(v[ne])}for(const ne in this.fixedUniforms)this.fixedUniforms[ne].set(_[ne]);Z&&Z.setUniforms(t,this.binderUniforms,B,{zoom:V});let ee=0;switch(n){case j.LINES:ee=2;break;case j.TRIANGLES:ee=3;break;case j.LINE_STRIP:ee=1}for(const ne of L.get()){const ce=ne.vaos||(ne.vaos={});(ce[b]||(ce[b]=new $s)).bind(t,this,P,Z?Z.getPaintVertexBuffers():[],E,ne.vertexOffset,U,H,K),j.drawElements(n,ne.primitiveLength*ee,j.UNSIGNED_SHORT,ne.primitiveOffset*ee*2)}}}function Zs(u,t,n){const o=1/nt(n,1,t.transform.tileZoom),a=Math.pow(2,n.tileID.overscaledZ),h=n.tileSize*Math.pow(2,t.transform.tileZoom)/a,m=h*(n.tileID.canonical.x+n.tileID.wrap*a),_=h*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[o,u.fromScale,u.toScale],u_fade:u.t,u_pixel_coord_upper:[m>>16,_>>16],u_pixel_coord_lower:[65535&m,65535&_]}}const Gs=(u,t,n,o)=>{const a=t.style.light,h=a.properties.get("position"),m=[h.x,h.y,h.z],_=function(){var b=new c.A(9);return c.A!=Float32Array&&(b[1]=0,b[2]=0,b[3]=0,b[5]=0,b[6]=0,b[7]=0),b[0]=1,b[4]=1,b[8]=1,b}();a.properties.get("anchor")==="viewport"&&function(b,P){var E=Math.sin(P),L=Math.cos(P);b[0]=L,b[1]=E,b[2]=0,b[3]=-E,b[4]=L,b[5]=0,b[6]=0,b[7]=0,b[8]=1}(_,-t.transform.angle),function(b,P,E){var L=P[0],B=P[1],V=P[2];b[0]=L*E[0]+B*E[3]+V*E[6],b[1]=L*E[1]+B*E[4]+V*E[7],b[2]=L*E[2]+B*E[5]+V*E[8]}(m,m,_);const v=a.properties.get("color");return{u_matrix:u,u_lightpos:m,u_lightintensity:a.properties.get("intensity"),u_lightcolor:[v.r,v.g,v.b],u_vertical_gradient:+n,u_opacity:o}},Hs=(u,t,n,o,a,h,m)=>c.e(Gs(u,t,n,o),Zs(h,t,m),{u_height_factor:-Math.pow(2,a.overscaledZ)/m.tileSize/8}),ds=u=>({u_matrix:u}),Mn=(u,t,n,o)=>c.e(ds(u),Zs(n,t,o)),Lc=(u,t)=>({u_matrix:u,u_world:t}),Rc=(u,t,n,o,a)=>c.e(Mn(u,t,n,o),{u_world:a}),hl=(u,t,n,o)=>{const a=u.transform;let h,m;if(o.paint.get("circle-pitch-alignment")==="map"){const _=nt(n,1,a.zoom);h=!0,m=[_,_]}else h=!1,m=a.pixelsToGLUnits;return{u_camera_to_center_distance:a.cameraToCenterDistance,u_scale_with_map:+(o.paint.get("circle-pitch-scale")==="map"),u_matrix:u.translatePosMatrix(t.posMatrix,n,o.paint.get("circle-translate"),o.paint.get("circle-translate-anchor")),u_pitch_with_map:+h,u_device_pixel_ratio:u.pixelRatio,u_extrude_scale:m}},Bc=(u,t,n)=>({u_matrix:u,u_inv_matrix:t,u_camera_to_center_distance:n.cameraToCenterDistance,u_viewport_size:[n.width,n.height]}),Hr=(u,t,n=1)=>({u_matrix:u,u_color:t,u_overlay:0,u_overlay_scale:n}),ps=u=>({u_matrix:u}),ji=(u,t,n,o)=>({u_matrix:u,u_extrude_scale:nt(t,1,n),u_intensity:o});function Ui(u,t){const n=Math.pow(2,t.canonical.z),o=t.canonical.y;return[new c.Z(0,o/n).toLngLat().lat,new c.Z(0,(o+1)/n).toLngLat().lat]}const fs=(u,t,n,o)=>{const a=u.transform;return{u_matrix:pl(u,t,n,o),u_ratio:1/nt(t,1,a.zoom),u_device_pixel_ratio:u.pixelRatio,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},Xs=(u,t,n,o,a)=>c.e(fs(u,t,n,a),{u_image:0,u_image_height:o}),ul=(u,t,n,o,a)=>{const h=u.transform,m=hn(t,h);return{u_matrix:pl(u,t,n,a),u_texsize:t.imageAtlasTexture.size,u_ratio:1/nt(t,1,h.zoom),u_device_pixel_ratio:u.pixelRatio,u_image:0,u_scale:[m,o.fromScale,o.toScale],u_fade:o.t,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]]}},dl=(u,t,n,o,a,h)=>{const m=u.lineAtlas,_=hn(t,u.transform),v=n.layout.get("line-cap")==="round",b=m.getDash(o.from,v),P=m.getDash(o.to,v),E=b.width*a.fromScale,L=P.width*a.toScale;return c.e(fs(u,t,n,h),{u_patternscale_a:[_/E,-b.height/2],u_patternscale_b:[_/L,-P.height/2],u_sdfgamma:m.width/(256*Math.min(E,L)*u.pixelRatio)/2,u_image:0,u_tex_y_a:b.y,u_tex_y_b:P.y,u_mix:a.t})};function hn(u,t){return 1/nt(u,1,t.tileZoom)}function pl(u,t,n,o){return u.translatePosMatrix(o?o.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const Fc=(u,t,n,o,a)=>{return{u_matrix:u,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:o.mix,u_opacity:o.opacity*a.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:a.paint.get("raster-brightness-min"),u_brightness_high:a.paint.get("raster-brightness-max"),u_saturation_factor:(m=a.paint.get("raster-saturation"),m>0?1-1/(1.001-m):-m),u_contrast_factor:(h=a.paint.get("raster-contrast"),h>0?1/(1-h):1+h),u_spin_weights:Oc(a.paint.get("raster-hue-rotate"))};var h,m};function Oc(u){u*=Math.PI/180;const t=Math.sin(u),n=Math.cos(u);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const fl=(u,t,n,o,a,h,m,_,v,b,P,E,L,B)=>{const V=m.transform;return{u_is_size_zoom_constant:+(u==="constant"||u==="source"),u_is_size_feature_constant:+(u==="constant"||u==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:V.cameraToCenterDistance,u_pitch:V.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:V.width/V.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_matrix:_,u_label_plane_matrix:v,u_coord_matrix:b,u_is_text:+E,u_pitch_with_map:+o,u_is_along_line:a,u_is_variable_anchor:h,u_texsize:L,u_texture:0,u_translation:P,u_pitched_scale:B}},ml=(u,t,n,o,a,h,m,_,v,b,P,E,L,B,V)=>{const Z=m.transform;return c.e(fl(u,t,n,o,a,h,m,_,v,b,P,E,L,V),{u_gamma_scale:o?Math.cos(Z._pitch)*Z.cameraToCenterDistance:1,u_device_pixel_ratio:m.pixelRatio,u_is_halo:+B})},Vc=(u,t,n,o,a,h,m,_,v,b,P,E,L,B)=>c.e(ml(u,t,n,o,a,h,m,_,v,b,P,!0,E,!0,B),{u_texsize_icon:L,u_texture_icon:1}),Ws=(u,t,n)=>({u_matrix:u,u_opacity:t,u_color:n}),qo=(u,t,n,o,a,h)=>c.e(function(m,_,v,b){const P=v.imageManager.getPattern(m.from.toString()),E=v.imageManager.getPattern(m.to.toString()),{width:L,height:B}=v.imageManager.getPixelSize(),V=Math.pow(2,b.tileID.overscaledZ),Z=b.tileSize*Math.pow(2,v.transform.tileZoom)/V,U=Z*(b.tileID.canonical.x+b.tileID.wrap*V),H=Z*b.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:P.tl,u_pattern_br_a:P.br,u_pattern_tl_b:E.tl,u_pattern_br_b:E.br,u_texsize:[L,B],u_mix:_.t,u_pattern_size_a:P.displaySize,u_pattern_size_b:E.displaySize,u_scale_a:_.fromScale,u_scale_b:_.toScale,u_tile_units_to_pixels:1/nt(b,1,v.transform.tileZoom),u_pixel_coord_upper:[U>>16,H>>16],u_pixel_coord_lower:[65535&U,65535&H]}}(o,h,n,a),{u_matrix:u,u_opacity:t}),Js={fillExtrusion:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_lightpos:new c.aO(u,t.u_lightpos),u_lightintensity:new c.aJ(u,t.u_lightintensity),u_lightcolor:new c.aO(u,t.u_lightcolor),u_vertical_gradient:new c.aJ(u,t.u_vertical_gradient),u_opacity:new c.aJ(u,t.u_opacity)}),fillExtrusionPattern:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_lightpos:new c.aO(u,t.u_lightpos),u_lightintensity:new c.aJ(u,t.u_lightintensity),u_lightcolor:new c.aO(u,t.u_lightcolor),u_vertical_gradient:new c.aJ(u,t.u_vertical_gradient),u_height_factor:new c.aJ(u,t.u_height_factor),u_image:new c.aI(u,t.u_image),u_texsize:new c.aP(u,t.u_texsize),u_pixel_coord_upper:new c.aP(u,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.aP(u,t.u_pixel_coord_lower),u_scale:new c.aO(u,t.u_scale),u_fade:new c.aJ(u,t.u_fade),u_opacity:new c.aJ(u,t.u_opacity)}),fill:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix)}),fillPattern:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_image:new c.aI(u,t.u_image),u_texsize:new c.aP(u,t.u_texsize),u_pixel_coord_upper:new c.aP(u,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.aP(u,t.u_pixel_coord_lower),u_scale:new c.aO(u,t.u_scale),u_fade:new c.aJ(u,t.u_fade)}),fillOutline:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_world:new c.aP(u,t.u_world)}),fillOutlinePattern:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_world:new c.aP(u,t.u_world),u_image:new c.aI(u,t.u_image),u_texsize:new c.aP(u,t.u_texsize),u_pixel_coord_upper:new c.aP(u,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.aP(u,t.u_pixel_coord_lower),u_scale:new c.aO(u,t.u_scale),u_fade:new c.aJ(u,t.u_fade)}),circle:(u,t)=>({u_camera_to_center_distance:new c.aJ(u,t.u_camera_to_center_distance),u_scale_with_map:new c.aI(u,t.u_scale_with_map),u_pitch_with_map:new c.aI(u,t.u_pitch_with_map),u_extrude_scale:new c.aP(u,t.u_extrude_scale),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_matrix:new c.aK(u,t.u_matrix)}),collisionBox:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_pixel_extrude_scale:new c.aP(u,t.u_pixel_extrude_scale)}),collisionCircle:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_inv_matrix:new c.aK(u,t.u_inv_matrix),u_camera_to_center_distance:new c.aJ(u,t.u_camera_to_center_distance),u_viewport_size:new c.aP(u,t.u_viewport_size)}),debug:(u,t)=>({u_color:new c.aM(u,t.u_color),u_matrix:new c.aK(u,t.u_matrix),u_overlay:new c.aI(u,t.u_overlay),u_overlay_scale:new c.aJ(u,t.u_overlay_scale)}),clippingMask:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix)}),heatmap:(u,t)=>({u_extrude_scale:new c.aJ(u,t.u_extrude_scale),u_intensity:new c.aJ(u,t.u_intensity),u_matrix:new c.aK(u,t.u_matrix)}),heatmapTexture:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_world:new c.aP(u,t.u_world),u_image:new c.aI(u,t.u_image),u_color_ramp:new c.aI(u,t.u_color_ramp),u_opacity:new c.aJ(u,t.u_opacity)}),hillshade:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_image:new c.aI(u,t.u_image),u_latrange:new c.aP(u,t.u_latrange),u_light:new c.aP(u,t.u_light),u_shadow:new c.aM(u,t.u_shadow),u_highlight:new c.aM(u,t.u_highlight),u_accent:new c.aM(u,t.u_accent)}),hillshadePrepare:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_image:new c.aI(u,t.u_image),u_dimension:new c.aP(u,t.u_dimension),u_zoom:new c.aJ(u,t.u_zoom),u_unpack:new c.aL(u,t.u_unpack)}),line:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_ratio:new c.aJ(u,t.u_ratio),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_units_to_pixels:new c.aP(u,t.u_units_to_pixels)}),lineGradient:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_ratio:new c.aJ(u,t.u_ratio),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_units_to_pixels:new c.aP(u,t.u_units_to_pixels),u_image:new c.aI(u,t.u_image),u_image_height:new c.aJ(u,t.u_image_height)}),linePattern:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_texsize:new c.aP(u,t.u_texsize),u_ratio:new c.aJ(u,t.u_ratio),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_image:new c.aI(u,t.u_image),u_units_to_pixels:new c.aP(u,t.u_units_to_pixels),u_scale:new c.aO(u,t.u_scale),u_fade:new c.aJ(u,t.u_fade)}),lineSDF:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_ratio:new c.aJ(u,t.u_ratio),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_units_to_pixels:new c.aP(u,t.u_units_to_pixels),u_patternscale_a:new c.aP(u,t.u_patternscale_a),u_patternscale_b:new c.aP(u,t.u_patternscale_b),u_sdfgamma:new c.aJ(u,t.u_sdfgamma),u_image:new c.aI(u,t.u_image),u_tex_y_a:new c.aJ(u,t.u_tex_y_a),u_tex_y_b:new c.aJ(u,t.u_tex_y_b),u_mix:new c.aJ(u,t.u_mix)}),raster:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_tl_parent:new c.aP(u,t.u_tl_parent),u_scale_parent:new c.aJ(u,t.u_scale_parent),u_buffer_scale:new c.aJ(u,t.u_buffer_scale),u_fade_t:new c.aJ(u,t.u_fade_t),u_opacity:new c.aJ(u,t.u_opacity),u_image0:new c.aI(u,t.u_image0),u_image1:new c.aI(u,t.u_image1),u_brightness_low:new c.aJ(u,t.u_brightness_low),u_brightness_high:new c.aJ(u,t.u_brightness_high),u_saturation_factor:new c.aJ(u,t.u_saturation_factor),u_contrast_factor:new c.aJ(u,t.u_contrast_factor),u_spin_weights:new c.aO(u,t.u_spin_weights)}),symbolIcon:(u,t)=>({u_is_size_zoom_constant:new c.aI(u,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aI(u,t.u_is_size_feature_constant),u_size_t:new c.aJ(u,t.u_size_t),u_size:new c.aJ(u,t.u_size),u_camera_to_center_distance:new c.aJ(u,t.u_camera_to_center_distance),u_pitch:new c.aJ(u,t.u_pitch),u_rotate_symbol:new c.aI(u,t.u_rotate_symbol),u_aspect_ratio:new c.aJ(u,t.u_aspect_ratio),u_fade_change:new c.aJ(u,t.u_fade_change),u_matrix:new c.aK(u,t.u_matrix),u_label_plane_matrix:new c.aK(u,t.u_label_plane_matrix),u_coord_matrix:new c.aK(u,t.u_coord_matrix),u_is_text:new c.aI(u,t.u_is_text),u_pitch_with_map:new c.aI(u,t.u_pitch_with_map),u_is_along_line:new c.aI(u,t.u_is_along_line),u_is_variable_anchor:new c.aI(u,t.u_is_variable_anchor),u_texsize:new c.aP(u,t.u_texsize),u_texture:new c.aI(u,t.u_texture),u_translation:new c.aP(u,t.u_translation),u_pitched_scale:new c.aJ(u,t.u_pitched_scale)}),symbolSDF:(u,t)=>({u_is_size_zoom_constant:new c.aI(u,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aI(u,t.u_is_size_feature_constant),u_size_t:new c.aJ(u,t.u_size_t),u_size:new c.aJ(u,t.u_size),u_camera_to_center_distance:new c.aJ(u,t.u_camera_to_center_distance),u_pitch:new c.aJ(u,t.u_pitch),u_rotate_symbol:new c.aI(u,t.u_rotate_symbol),u_aspect_ratio:new c.aJ(u,t.u_aspect_ratio),u_fade_change:new c.aJ(u,t.u_fade_change),u_matrix:new c.aK(u,t.u_matrix),u_label_plane_matrix:new c.aK(u,t.u_label_plane_matrix),u_coord_matrix:new c.aK(u,t.u_coord_matrix),u_is_text:new c.aI(u,t.u_is_text),u_pitch_with_map:new c.aI(u,t.u_pitch_with_map),u_is_along_line:new c.aI(u,t.u_is_along_line),u_is_variable_anchor:new c.aI(u,t.u_is_variable_anchor),u_texsize:new c.aP(u,t.u_texsize),u_texture:new c.aI(u,t.u_texture),u_gamma_scale:new c.aJ(u,t.u_gamma_scale),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_is_halo:new c.aI(u,t.u_is_halo),u_translation:new c.aP(u,t.u_translation),u_pitched_scale:new c.aJ(u,t.u_pitched_scale)}),symbolTextAndIcon:(u,t)=>({u_is_size_zoom_constant:new c.aI(u,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aI(u,t.u_is_size_feature_constant),u_size_t:new c.aJ(u,t.u_size_t),u_size:new c.aJ(u,t.u_size),u_camera_to_center_distance:new c.aJ(u,t.u_camera_to_center_distance),u_pitch:new c.aJ(u,t.u_pitch),u_rotate_symbol:new c.aI(u,t.u_rotate_symbol),u_aspect_ratio:new c.aJ(u,t.u_aspect_ratio),u_fade_change:new c.aJ(u,t.u_fade_change),u_matrix:new c.aK(u,t.u_matrix),u_label_plane_matrix:new c.aK(u,t.u_label_plane_matrix),u_coord_matrix:new c.aK(u,t.u_coord_matrix),u_is_text:new c.aI(u,t.u_is_text),u_pitch_with_map:new c.aI(u,t.u_pitch_with_map),u_is_along_line:new c.aI(u,t.u_is_along_line),u_is_variable_anchor:new c.aI(u,t.u_is_variable_anchor),u_texsize:new c.aP(u,t.u_texsize),u_texsize_icon:new c.aP(u,t.u_texsize_icon),u_texture:new c.aI(u,t.u_texture),u_texture_icon:new c.aI(u,t.u_texture_icon),u_gamma_scale:new c.aJ(u,t.u_gamma_scale),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_is_halo:new c.aI(u,t.u_is_halo),u_translation:new c.aP(u,t.u_translation),u_pitched_scale:new c.aJ(u,t.u_pitched_scale)}),background:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_opacity:new c.aJ(u,t.u_opacity),u_color:new c.aM(u,t.u_color)}),backgroundPattern:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_opacity:new c.aJ(u,t.u_opacity),u_image:new c.aI(u,t.u_image),u_pattern_tl_a:new c.aP(u,t.u_pattern_tl_a),u_pattern_br_a:new c.aP(u,t.u_pattern_br_a),u_pattern_tl_b:new c.aP(u,t.u_pattern_tl_b),u_pattern_br_b:new c.aP(u,t.u_pattern_br_b),u_texsize:new c.aP(u,t.u_texsize),u_mix:new c.aJ(u,t.u_mix),u_pattern_size_a:new c.aP(u,t.u_pattern_size_a),u_pattern_size_b:new c.aP(u,t.u_pattern_size_b),u_scale_a:new c.aJ(u,t.u_scale_a),u_scale_b:new c.aJ(u,t.u_scale_b),u_pixel_coord_upper:new c.aP(u,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.aP(u,t.u_pixel_coord_lower),u_tile_units_to_pixels:new c.aJ(u,t.u_tile_units_to_pixels)}),terrain:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_texture:new c.aI(u,t.u_texture),u_ele_delta:new c.aJ(u,t.u_ele_delta),u_fog_matrix:new c.aK(u,t.u_fog_matrix),u_fog_color:new c.aM(u,t.u_fog_color),u_fog_ground_blend:new c.aJ(u,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new c.aJ(u,t.u_fog_ground_blend_opacity),u_horizon_color:new c.aM(u,t.u_horizon_color),u_horizon_fog_blend:new c.aJ(u,t.u_horizon_fog_blend)}),terrainDepth:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_ele_delta:new c.aJ(u,t.u_ele_delta)}),terrainCoords:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_texture:new c.aI(u,t.u_texture),u_terrain_coords_id:new c.aJ(u,t.u_terrain_coords_id),u_ele_delta:new c.aJ(u,t.u_ele_delta)}),sky:(u,t)=>({u_sky_color:new c.aM(u,t.u_sky_color),u_horizon_color:new c.aM(u,t.u_horizon_color),u_horizon:new c.aJ(u,t.u_horizon),u_sky_horizon_blend:new c.aJ(u,t.u_sky_horizon_blend)})};class Zo{constructor(t,n,o){this.context=t;const a=t.gl;this.buffer=a.createBuffer(),this.dynamicDraw=!!o,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.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 Go={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class xr{constructor(t,n,o,a){this.length=n.length,this.attributes=o,this.itemSize=n.bytesPerElement,this.dynamicDraw=a,this.context=t;const h=t.gl;this.buffer=h.createBuffer(),t.bindVertexBuffer.set(this.buffer),h.bufferData(h.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?h.DYNAMIC_DRAW:h.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 o=0;o<this.attributes.length;o++){const a=n.attributes[this.attributes[o].name];a!==void 0&&t.enableVertexAttribArray(a)}}setVertexAttribPointers(t,n,o){for(let a=0;a<this.attributes.length;a++){const h=this.attributes[a],m=n.attributes[h.name];m!==void 0&&t.vertexAttribPointer(m,h.components,t[Go[h.type]],!1,this.itemSize,h.offset+this.itemSize*(o||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ho=new WeakMap;function zn(u){var t;if(Ho.has(u))return Ho.get(u);{const n=(t=u.getParameter(u.VERSION))===null||t===void 0?void 0:t.startsWith("WebGL 2.0");return Ho.set(u,n),n}}class ft{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 ms extends ft{getDefault(){return c.aN.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 Nc extends ft{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Ks extends ft{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class jc extends ft{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 Dn extends ft{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Uc extends ft{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class gl extends ft{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 $c extends ft{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 _l extends ft{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 Xo extends ft{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 yl extends ft{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 xl extends ft{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class vl extends ft{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 ft{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 un extends ft{getDefault(){return c.aN.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 wl extends ft{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class qc extends ft{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 Zc extends ft{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Sl extends ft{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class gs extends ft{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Gc extends ft{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Ys extends ft{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 Hc extends ft{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 Xc extends ft{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 Tl extends ft{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 Il extends ft{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 Pl extends ft{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Wo extends ft{getDefault(){return null}set(t){var n;if(t===this.current&&!this.dirty)return;const o=this.gl;zn(o)?o.bindVertexArray(t):(n=o.getExtension("OES_vertex_array_object"))===null||n===void 0||n.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class El extends ft{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 Qs extends ft{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 Dr extends ft{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 _s extends ft{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class Jo extends _s{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 Ko extends _s{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 Cl extends _s{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 Yo{constructor(t,n,o,a,h){this.context=t,this.width=n,this.height=o;const m=t.gl,_=this.framebuffer=m.createFramebuffer();if(this.colorAttachment=new Jo(t,_),a)this.depthAttachment=h?new Cl(t,_):new Ko(t,_);else if(h)throw new Error("Stencil cannot be set without depth");if(m.checkFramebufferStatus(m.FRAMEBUFFER)!==m.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 o=this.depthAttachment.get();o&&t.deleteRenderbuffer(o)}t.deleteFramebuffer(this.framebuffer)}}class Mt{constructor(t,n,o){this.blendFunction=t,this.blendColor=n,this.mask=o}}Mt.Replace=[1,0],Mt.disabled=new Mt(Mt.Replace,c.aN.transparent,[!1,!1,!1,!1]),Mt.unblended=new Mt(Mt.Replace,c.aN.transparent,[!0,!0,!0,!0]),Mt.alphaBlended=new Mt([1,771],c.aN.transparent,[!0,!0,!0,!0]);class Qo{constructor(t){var n,o;if(this.gl=t,this.clearColor=new ms(this),this.clearDepth=new Nc(this),this.clearStencil=new Ks(this),this.colorMask=new jc(this),this.depthMask=new Dn(this),this.stencilMask=new Uc(this),this.stencilFunc=new gl(this),this.stencilOp=new $c(this),this.stencilTest=new _l(this),this.depthRange=new Xo(this),this.depthTest=new yl(this),this.depthFunc=new xl(this),this.blend=new vl(this),this.blendFunc=new bl(this),this.blendColor=new un(this),this.blendEquation=new wl(this),this.cullFace=new qc(this),this.cullFaceSide=new Zc(this),this.frontFace=new Sl(this),this.program=new gs(this),this.activeTexture=new Gc(this),this.viewport=new Ys(this),this.bindFramebuffer=new Hc(this),this.bindRenderbuffer=new Xc(this),this.bindTexture=new Tl(this),this.bindVertexBuffer=new Il(this),this.bindElementBuffer=new Pl(this),this.bindVertexArray=new Wo(this),this.pixelStoreUnpack=new El(this),this.pixelStoreUnpackPremultiplyAlpha=new Qs(this),this.pixelStoreUnpackFlipY=new Dr(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),zn(t)){this.HALF_FLOAT=t.HALF_FLOAT;const a=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(n=t.RGBA16F)!==null&&n!==void 0?n:a==null?void 0:a.RGBA16F_EXT,this.RGB16F=(o=t.RGB16F)!==null&&o!==void 0?o:a==null?void 0:a.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const a=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=a==null?void 0:a.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 Zo(this,t,n)}createVertexBuffer(t,n,o){return new xr(this,t,n,o)}createRenderbuffer(t,n,o){const a=this.gl,h=a.createRenderbuffer();return this.bindRenderbuffer.set(h),a.renderbufferStorage(a.RENDERBUFFER,t,n,o),this.bindRenderbuffer.set(null),h}createFramebuffer(t,n,o,a){return new Yo(this,t,n,o,a)}clear({color:t,depth:n,stencil:o}){const a=this.gl;let h=0;t&&(h|=a.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(h|=a.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),o!==void 0&&(h|=a.STENCIL_BUFFER_BIT,this.clearStencil.set(o),this.stencilMask.set(255)),a.clear(h)}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){c.aF(t.blendFunction,Mt.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 zn(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 zn(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 dt{constructor(t,n,o){this.func=t,this.mask=n,this.range=o}}dt.ReadOnly=!1,dt.ReadWrite=!0,dt.disabled=new dt(519,dt.ReadOnly,[0,1]);const ea=7680;class jt{constructor(t,n,o,a,h,m){this.test=t,this.ref=n,this.mask=o,this.fail=a,this.depthFail=h,this.pass=m}}jt.disabled=new jt({func:519,mask:0},0,0,ea,ea,ea);class Lt{constructor(t,n,o){this.enable=t,this.mode=n,this.frontFace=o}}let ys;function Al(u,t,n,o,a){const h=u.context,m=h.gl,_=u.useProgram("collisionBox"),v=[];let b=0,P=0;for(let H=0;H<o.length;H++){const K=o[H],j=t.getTile(K).getBucket(n);if(!j)continue;const ee=a?j.textCollisionBox:j.iconCollisionBox,ne=j.collisionCircleArray;if(ne.length>0){const ce=c.H();c.aR(ce,j.placementInvProjMatrix,u.transform.glCoordMatrix),c.aR(ce,ce,j.placementViewportMatrix),v.push({circleArray:ne,circleOffset:P,transform:K.posMatrix,invTransform:ce,coord:K}),b+=ne.length/4,P=b}ee&&_.draw(h,m.LINES,dt.disabled,jt.disabled,u.colorModeForRenderPass(),Lt.disabled,{u_matrix:K.posMatrix,u_pixel_extrude_scale:[1/(E=u.transform).width,1/E.height]},u.style.map.terrain&&u.style.map.terrain.getTerrainData(K),n.id,ee.layoutVertexBuffer,ee.indexBuffer,ee.segments,null,u.transform.zoom,null,null,ee.collisionVertexBuffer)}var E;if(!a||!v.length)return;const L=u.useProgram("collisionCircle"),B=new c.aS;B.resize(4*b),B._trim();let V=0;for(const H of v)for(let K=0;K<H.circleArray.length/4;K++){const j=4*K,ee=H.circleArray[j+0],ne=H.circleArray[j+1],ce=H.circleArray[j+2],ge=H.circleArray[j+3];B.emplace(V++,ee,ne,ce,ge,0),B.emplace(V++,ee,ne,ce,ge,1),B.emplace(V++,ee,ne,ce,ge,2),B.emplace(V++,ee,ne,ce,ge,3)}(!ys||ys.length<2*b)&&(ys=function(H){const K=2*H,j=new c.aU;j.resize(K),j._trim();for(let ee=0;ee<K;ee++){const ne=6*ee;j.uint16[ne+0]=4*ee+0,j.uint16[ne+1]=4*ee+1,j.uint16[ne+2]=4*ee+2,j.uint16[ne+3]=4*ee+2,j.uint16[ne+4]=4*ee+3,j.uint16[ne+5]=4*ee+0}return j}(b));const Z=h.createIndexBuffer(ys,!0),U=h.createVertexBuffer(B,c.aT.members,!0);for(const H of v){const K=Bc(H.transform,H.invTransform,u.transform);L.draw(h,m.TRIANGLES,dt.disabled,jt.disabled,u.colorModeForRenderPass(),Lt.disabled,K,u.style.map.terrain&&u.style.map.terrain.getTerrainData(H.coord),n.id,U,Z,c.a0.simpleSegment(0,2*H.circleOffset,H.circleArray.length,H.circleArray.length/2),null,u.transform.zoom,null,null,null)}U.destroy(),Z.destroy()}Lt.disabled=new Lt(!1,1029,2305),Lt.backCCW=new Lt(!0,1029,2305);const ta=c.ao(new Float32Array(16));function eo(u,t,n,o,a,h){const{horizontalAlign:m,verticalAlign:_}=c.av(u);return new c.P((-(m-.5)*t/a+o[0])*h,(-(_-.5)*n/a+o[1])*h)}function to(u,t,n,o,a,h){const m=t.tileAnchorPoint.add(new c.P(t.translation[0],t.translation[1]));if(t.pitchWithMap){let _=o.mult(h);return n||(_=_.rotate(-a)),G(m.add(_),t.labelPlaneMatrix,t.getElevation).point}if(n){const _=pe(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(u),v=Math.atan(_.y/_.x)+(_.x<0?Math.PI:0);return u.add(o.rotate(v))}return u.add(o)}function io(u,t,n,o,a,h,m,_,v,b,P,E,L,B){const V=u.text.placedSymbolArray,Z=u.text.dynamicLayoutVertexArray,U=u.icon.dynamicLayoutVertexArray,H={};Z.clear();for(let K=0;K<V.length;K++){const j=V.get(K),ee=j.hidden||!j.crossTileID||u.allowVerticalPlacement&&!j.placedOrientation?null:o[j.crossTileID];if(ee){const ne=new c.P(j.anchorX,j.anchorY),ce={getElevation:B,width:a.width,height:a.height,labelPlaneMatrix:h,lineVertexArray:null,pitchWithMap:n,projection:P,projectionCache:null,tileAnchorPoint:ne,translation:E,unwrappedTileID:L},ge=n?G(ne,m,B):pe(ne.x,ne.y,ce),we=k(a.cameraToCenterDistance,ge.signedDistanceFromCamera);let De=c.aj(u.textSizeData,v,j)*we/c.aq;n&&(De*=u.tilePixelRatio/_);const{width:Re,height:Se,anchor:Te,textOffset:Ne,textBoxScale:it}=ee,Ee=eo(Te,Re,Se,Ne,it,De),ke=P.getPitchedTextCorrection(a,ne.add(new c.P(E[0],E[1])),L),et=to(ge.point,ce,t,Ee,a.angle,ke),Bt=u.allowVerticalPlacement&&j.placedOrientation===c.ai.vertical?Math.PI/2:0;for(let ot=0;ot<j.numGlyphs;ot++)c.ak(Z,et,Bt);b&&j.associatedIconIndex>=0&&(H[j.associatedIconIndex]={shiftedAnchor:et,angle:Bt})}else Xe(j.numGlyphs,Z)}if(b){U.clear();const K=u.icon.placedSymbolArray;for(let j=0;j<K.length;j++){const ee=K.get(j);if(ee.hidden)Xe(ee.numGlyphs,U);else{const ne=H[j];if(ne)for(let ce=0;ce<ee.numGlyphs;ce++)c.ak(U,ne.shiftedAnchor,ne.angle);else Xe(ee.numGlyphs,U)}}u.icon.dynamicLayoutVertexBuffer.updateData(U)}u.text.dynamicLayoutVertexBuffer.updateData(Z)}function ia(u,t,n){return n.iconsInText&&t?"symbolTextAndIcon":u?"symbolSDF":"symbolIcon"}function Xr(u,t,n,o,a,h,m,_,v,b,P,E){const L=u.context,B=L.gl,V=u.transform,Z=js(),U=_==="map",H=v==="map",K=_!=="viewport"&&n.layout.get("symbol-placement")!=="point",j=U&&!H&&!K,ee=!H&&K,ne=!n.layout.get("symbol-sort-key").isConstant();let ce=!1;const ge=u.depthModeForSublayer(0,dt.ReadOnly),we=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),De=[],Re=Z.getCircleRadiusCorrection(V);for(const Se of o){const Te=t.getTile(Se),Ne=Te.getBucket(n);if(!Ne)continue;const it=a?Ne.text:Ne.icon;if(!it||!it.segments.get().length||!it.hasVisibleVertices)continue;const Ee=it.programConfigurations.get(n.id),ke=a||Ne.sdfIcons,et=a?Ne.textSizeData:Ne.iconSizeData,Bt=H||V.pitch!==0,ot=u.useProgram(ia(ke,a,Ne),Ee),pt=c.ah(et,V.zoom),Ft=u.style.map.terrain&&u.style.map.terrain.getTerrainData(Se);let pi,sr,Ot,Mi,Ii=[0,0],fi=null;if(a)sr=Te.glyphAtlasTexture,Ot=B.LINEAR,pi=Te.glyphAtlasTexture.size,Ne.iconsInText&&(Ii=Te.imageAtlasTexture.size,fi=Te.imageAtlasTexture,Mi=Bt||u.options.rotating||u.options.zooming||et.kind==="composite"||et.kind==="camera"?B.LINEAR:B.NEAREST);else{const Ut=n.layout.get("icon-size").constantOr(0)!==1||Ne.iconsNeedLinear;sr=Te.imageAtlasTexture,Ot=ke||u.options.rotating||u.options.zooming||Ut||Bt?B.LINEAR:B.NEAREST,pi=Te.imageAtlasTexture.size}const mi=nt(Te,1,u.transform.zoom),or=ee?Se.posMatrix:ta,xn=qr(or,H,U,u.transform,mi),yo=yr(or,H,U,u.transform,mi),Un=yr(Se.posMatrix,H,U,u.transform,mi),vn=Z.translatePosition(u.transform,Te,h,m),xo=we&&Ne.hasTextData(),Da=n.layout.get("icon-text-fit")!=="none"&&xo&&Ne.hasIconData();if(K){const Ut=u.style.map.terrain?(La,ti)=>u.style.map.terrain.getElevation(Se,La,ti):null,qn=n.layout.get("text-rotation-alignment")==="map";O(Ne,Se.posMatrix,u,a,xn,Un,H,b,qn,Z,Se.toUnwrapped(),V.width,V.height,vn,Ut)}const ai=Se.posMatrix,ar=a&&we||Da,Kr=K||ar?ta:xn,$n=yo,gi=ke&&n.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let _i;_i=ke?Ne.iconsInText?Vc(et.kind,pt,j,H,K,ar,u,ai,Kr,$n,vn,pi,Ii,Re):ml(et.kind,pt,j,H,K,ar,u,ai,Kr,$n,vn,a,pi,!0,Re):fl(et.kind,pt,j,H,K,ar,u,ai,Kr,$n,vn,a,pi,Re);const ni={program:ot,buffers:it,uniformValues:_i,atlasTexture:sr,atlasTextureIcon:fi,atlasInterpolation:Ot,atlasInterpolationIcon:Mi,isSDF:ke,hasHalo:gi};if(ne&&Ne.canOverlap){ce=!0;const Ut=it.segments.get();for(const qn of Ut)De.push({segments:new c.a0([qn]),sortKey:qn.sortKey,state:ni,terrainData:Ft})}else De.push({segments:it.segments,sortKey:0,state:ni,terrainData:Ft})}ce&&De.sort((Se,Te)=>Se.sortKey-Te.sortKey);for(const Se of De){const Te=Se.state;if(L.activeTexture.set(B.TEXTURE0),Te.atlasTexture.bind(Te.atlasInterpolation,B.CLAMP_TO_EDGE),Te.atlasTextureIcon&&(L.activeTexture.set(B.TEXTURE1),Te.atlasTextureIcon&&Te.atlasTextureIcon.bind(Te.atlasInterpolationIcon,B.CLAMP_TO_EDGE)),Te.isSDF){const Ne=Te.uniformValues;Te.hasHalo&&(Ne.u_is_halo=1,dn(Te.buffers,Se.segments,n,u,Te.program,ge,P,E,Ne,Se.terrainData)),Ne.u_is_halo=0}dn(Te.buffers,Se.segments,n,u,Te.program,ge,P,E,Te.uniformValues,Se.terrainData)}}function dn(u,t,n,o,a,h,m,_,v,b){const P=o.context;a.draw(P,P.gl.TRIANGLES,h,m,_,Lt.disabled,v,b,n.id,u.layoutVertexBuffer,u.indexBuffer,t,n.paint,o.transform.zoom,u.programConfigurations.get(n.id),u.dynamicLayoutVertexBuffer,u.opacityVertexBuffer)}function $i(u,t,n,o,a){if(!n||!o||!o.imageAtlas)return;const h=o.imageAtlas.patternPositions;let m=h[n.to.toString()],_=h[n.from.toString()];if(!m&&_&&(m=_),!_&&m&&(_=m),!m||!_){const v=a.getPaintProperty(t);m=h[v],_=h[v]}m&&_&&u.setConstantPatternPositions(m,_)}function ra(u,t,n,o,a,h,m){const _=u.context.gl,v="fill-pattern",b=n.paint.get(v),P=b&&b.constantOr(1),E=n.getCrossfadeParameters();let L,B,V,Z,U;m?(B=P&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",L=_.LINES):(B=P?"fillPattern":"fill",L=_.TRIANGLES);const H=b.constantOr(null);for(const K of o){const j=t.getTile(K);if(P&&!j.patternsLoaded())continue;const ee=j.getBucket(n);if(!ee)continue;const ne=ee.programConfigurations.get(n.id),ce=u.useProgram(B,ne),ge=u.style.map.terrain&&u.style.map.terrain.getTerrainData(K);P&&(u.context.activeTexture.set(_.TEXTURE0),j.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),ne.updatePaintBuffers(E)),$i(ne,v,H,j,n);const we=ge?K:null,De=u.translatePosMatrix(we?we.posMatrix:K.posMatrix,j,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(m){Z=ee.indexBuffer2,U=ee.segments2;const Re=[_.drawingBufferWidth,_.drawingBufferHeight];V=B==="fillOutlinePattern"&&P?Rc(De,u,E,j,Re):Lc(De,Re)}else Z=ee.indexBuffer,U=ee.segments,V=P?Mn(De,u,E,j):ds(De);ce.draw(u.context,L,a,u.stencilModeForClipping(K),h,Lt.disabled,V,ge,n.id,ee.layoutVertexBuffer,Z,U,n.paint,u.transform.zoom,ne)}}function ro(u,t,n,o,a,h,m){const _=u.context,v=_.gl,b="fill-extrusion-pattern",P=n.paint.get(b),E=P.constantOr(1),L=n.getCrossfadeParameters(),B=n.paint.get("fill-extrusion-opacity"),V=P.constantOr(null);for(const Z of o){const U=t.getTile(Z),H=U.getBucket(n);if(!H)continue;const K=u.style.map.terrain&&u.style.map.terrain.getTerrainData(Z),j=H.programConfigurations.get(n.id),ee=u.useProgram(E?"fillExtrusionPattern":"fillExtrusion",j);E&&(u.context.activeTexture.set(v.TEXTURE0),U.imageAtlasTexture.bind(v.LINEAR,v.CLAMP_TO_EDGE),j.updatePaintBuffers(L)),$i(j,b,V,U,n);const ne=u.translatePosMatrix(Z.posMatrix,U,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),ce=n.paint.get("fill-extrusion-vertical-gradient"),ge=E?Hs(ne,u,ce,B,Z,L,U):Gs(ne,u,ce,B);ee.draw(_,_.gl.TRIANGLES,a,h,m,Lt.backCCW,ge,K,n.id,H.layoutVertexBuffer,H.indexBuffer,H.segments,n.paint,u.transform.zoom,j,u.style.map.terrain&&H.centroidVertexBuffer)}}function na(u,t,n,o,a,h,m){const _=u.context,v=_.gl,b=n.fbo;if(!b)return;const P=u.useProgram("hillshade"),E=u.style.map.terrain&&u.style.map.terrain.getTerrainData(t);_.activeTexture.set(v.TEXTURE0),v.bindTexture(v.TEXTURE_2D,b.colorAttachment.get()),P.draw(_,v.TRIANGLES,a,h,m,Lt.disabled,((L,B,V,Z)=>{const U=V.paint.get("hillshade-shadow-color"),H=V.paint.get("hillshade-highlight-color"),K=V.paint.get("hillshade-accent-color");let j=V.paint.get("hillshade-illumination-direction")*(Math.PI/180);V.paint.get("hillshade-illumination-anchor")==="viewport"&&(j-=L.transform.angle);const ee=!L.options.moving;return{u_matrix:Z?Z.posMatrix:L.transform.calculatePosMatrix(B.tileID.toUnwrapped(),ee),u_image:0,u_latrange:Ui(0,B.tileID),u_light:[V.paint.get("hillshade-exaggeration"),j],u_shadow:U,u_highlight:H,u_accent:K}})(u,n,o,E?t:null),E,o.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments)}function pn(u,t,n,o,a,h){const m=u.context,_=m.gl,v=t.dem;if(v&&v.data){const b=v.dim,P=v.stride,E=v.getPixels();if(m.activeTexture.set(_.TEXTURE1),m.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||u.getTileTexture(P),t.demTexture){const B=t.demTexture;B.update(E,{premultiply:!1}),B.bind(_.NEAREST,_.CLAMP_TO_EDGE)}else t.demTexture=new wt(m,E,_.RGBA,{premultiply:!1}),t.demTexture.bind(_.NEAREST,_.CLAMP_TO_EDGE);m.activeTexture.set(_.TEXTURE0);let L=t.fbo;if(!L){const B=new wt(m,{width:b,height:b,data:null},_.RGBA);B.bind(_.LINEAR,_.CLAMP_TO_EDGE),L=t.fbo=m.createFramebuffer(b,b,!0,!1),L.colorAttachment.set(B.texture)}m.bindFramebuffer.set(L.framebuffer),m.viewport.set([0,0,b,b]),u.useProgram("hillshadePrepare").draw(m,_.TRIANGLES,o,a,h,Lt.disabled,((B,V)=>{const Z=V.stride,U=c.H();return c.aQ(U,0,c.X,-c.X,0,0,1),c.J(U,U,[0,-c.X,0]),{u_matrix:U,u_image:1,u_dimension:[Z,Z],u_zoom:B.overscaledZ,u_unpack:V.getUnpackVector()}})(t.tileID,v),null,n.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function no(u,t,n,o,a,h){const m=o.paint.get("raster-fade-duration");if(!h&&m>0){const _=le.now(),v=(_-u.timeAdded)/m,b=t?(_-t.timeAdded)/m:-1,P=n.getSource(),E=a.coveringZoomLevel({tileSize:P.tileSize,roundZoom:P.roundZoom}),L=!t||Math.abs(t.tileID.overscaledZ-E)>Math.abs(u.tileID.overscaledZ-E),B=L&&u.refreshedUponExpiration?1:c.ad(L?v:1-b,0,1);return u.refreshedUponExpiration&&v>=1&&(u.refreshedUponExpiration=!1),t?{opacity:1,mix:1-B}:{opacity:B,mix:0}}return{opacity:1,mix:0}}const so=new c.aN(1,0,0,1),xs=new c.aN(0,1,0,1),oo=new c.aN(0,0,1,1),kl=new c.aN(1,0,1,1),Ln=new c.aN(0,1,1,1);function fn(u,t,n,o){Rn(u,0,t+n/2,u.transform.width,n,o)}function sa(u,t,n,o){Rn(u,t-n/2,0,n,u.transform.height,o)}function Rn(u,t,n,o,a,h){const m=u.context,_=m.gl;_.enable(_.SCISSOR_TEST),_.scissor(t*u.pixelRatio,n*u.pixelRatio,o*u.pixelRatio,a*u.pixelRatio),m.clear({color:h}),_.disable(_.SCISSOR_TEST)}function gt(u,t,n){const o=u.context,a=o.gl,h=n.posMatrix,m=u.useProgram("debug"),_=dt.disabled,v=jt.disabled,b=u.colorModeForRenderPass(),P="$debug",E=u.style.map.terrain&&u.style.map.terrain.getTerrainData(n);o.activeTexture.set(a.TEXTURE0);const L=t.getTileByID(n.key).latestRawTileData,B=Math.floor((L&&L.byteLength||0)/1024),V=t.getTile(n).tileSize,Z=512/Math.min(V,512)*(n.overscaledZ/u.transform.zoom)*.5;let U=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(U+=` => ${n.overscaledZ}`),function(H,K){H.initDebugOverlayCanvas();const j=H.debugOverlayCanvas,ee=H.context.gl,ne=H.debugOverlayCanvas.getContext("2d");ne.clearRect(0,0,j.width,j.height),ne.shadowColor="white",ne.shadowBlur=2,ne.lineWidth=1.5,ne.strokeStyle="white",ne.textBaseline="top",ne.font="bold 36px Open Sans, sans-serif",ne.fillText(K,5,5),ne.strokeText(K,5,5),H.debugOverlayTexture.update(j),H.debugOverlayTexture.bind(ee.LINEAR,ee.CLAMP_TO_EDGE)}(u,`${U} ${B}kB`),m.draw(o,a.TRIANGLES,_,v,Mt.alphaBlended,Lt.disabled,Hr(h,c.aN.transparent,Z),null,P,u.debugBuffer,u.quadTriangleIndexBuffer,u.debugSegments),m.draw(o,a.LINE_STRIP,_,v,b,Lt.disabled,Hr(h,c.aN.red),E,P,u.debugBuffer,u.tileBorderIndexBuffer,u.debugSegments)}function vs(u,t,n){const o=u.context,a=o.gl,h=u.colorModeForRenderPass(),m=new dt(a.LEQUAL,dt.ReadWrite,u.depthRangeFor3D),_=u.useProgram("terrain"),v=t.getTerrainMesh();o.bindFramebuffer.set(null),o.viewport.set([0,0,u.width,u.height]);for(const b of n){const P=u.renderToTexture.getTexture(b),E=t.getTerrainData(b.tileID);o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,P.texture);const L=u.transform.calculatePosMatrix(b.tileID.toUnwrapped()),B=t.getMeshFrameDelta(u.transform.zoom),V=u.transform.calculateFogMatrix(b.tileID.toUnwrapped()),Z=$o(L,B,V,u.style.sky,u.transform.pitch);_.draw(o,a.TRIANGLES,m,jt.disabled,h,Lt.backCCW,Z,E,"terrain",v.vertexBuffer,v.indexBuffer,v.segments)}}class Ml{constructor(t,n,o){this.vertexBuffer=t,this.indexBuffer=n,this.segments=o}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class zl{constructor(t,n){this.context=new Qo(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.ao(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Qe.maxUnderzooming+Qe.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Xi}resize(t,n,o){if(this.width=Math.floor(t*o),this.height=Math.floor(n*o),this.pixelRatio=o,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const a of this.style._order)this.style._layers[a].resize()}setup(){const t=this.context,n=new c.aX;n.emplaceBack(0,0),n.emplaceBack(c.X,0),n.emplaceBack(0,c.X),n.emplaceBack(c.X,c.X),this.tileExtentBuffer=t.createVertexBuffer(n,hs.members),this.tileExtentSegments=c.a0.simpleSegment(0,0,4,2);const o=new c.aX;o.emplaceBack(0,0),o.emplaceBack(c.X,0),o.emplaceBack(0,c.X),o.emplaceBack(c.X,c.X),this.debugBuffer=t.createVertexBuffer(o,hs.members),this.debugSegments=c.a0.simpleSegment(0,0,4,5);const a=new c.$;a.emplaceBack(0,0,0,0),a.emplaceBack(c.X,0,c.X,0),a.emplaceBack(0,c.X,0,c.X),a.emplaceBack(c.X,c.X,c.X,c.X),this.rasterBoundsBuffer=t.createVertexBuffer(a,Ur.members),this.rasterBoundsSegments=c.a0.simpleSegment(0,0,4,2);const h=new c.aX;h.emplaceBack(0,0),h.emplaceBack(1,0),h.emplaceBack(0,1),h.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(h,hs.members),this.viewportSegments=c.a0.simpleSegment(0,0,4,2);const m=new c.aZ;m.emplaceBack(0),m.emplaceBack(1),m.emplaceBack(3),m.emplaceBack(2),m.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(m);const _=new c.aY;_.emplaceBack(0,1,2),_.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(_);const v=this.context.gl;this.stencilClearMode=new jt({func:v.ALWAYS,mask:0},0,255,v.ZERO,v.ZERO,v.ZERO)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const o=c.H();c.aQ(o,0,this.width,this.height,0,0,1),c.K(o,o,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,dt.disabled,this.stencilClearMode,Mt.disabled,Lt.disabled,ps(o),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 o=this.context,a=o.gl;this.nextStencilID+n.length>256&&this.clearStencil(),o.setColorMode(Mt.disabled),o.setDepthMode(dt.disabled);const h=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const m of n){const _=this._tileClippingMaskIDs[m.key]=this.nextStencilID++,v=this.style.map.terrain&&this.style.map.terrain.getTerrainData(m);h.draw(o,a.TRIANGLES,dt.disabled,new jt({func:a.ALWAYS,mask:0},_,255,a.KEEP,a.KEEP,a.REPLACE),Mt.disabled,Lt.disabled,ps(m.posMatrix),v,"$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 jt({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new jt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,o=t.sort((m,_)=>_.overscaledZ-m.overscaledZ),a=o[o.length-1].overscaledZ,h=o[0].overscaledZ-a+1;if(h>1){this.currentStencilSource=void 0,this.nextStencilID+h>256&&this.clearStencil();const m={};for(let _=0;_<h;_++)m[_+a]=new jt({func:n.GEQUAL,mask:255},_+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=h,[m,o]}return[{[a]:jt.disabled},o]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new Mt([t.CONSTANT_COLOR,t.ONE],new c.aN(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Mt.unblended:Mt.alphaBlended}depthModeForSublayer(t,n,o){if(!this.opaquePassEnabledForLayer())return dt.disabled;const a=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new dt(o||this.context.gl.LEQUAL,n,[a,a])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){var o;this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(le.now()),this.imageManager.beginFrame();const a=this.style._order,h=this.style.sourceCaches,m={},_={},v={};for(const b in h){const P=h[b];P.used&&P.prepare(this.context),m[b]=P.getVisibleCoordinates(),_[b]=m[b].slice().reverse(),v[b]=P.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let b=0;b<a.length;b++)if(this.style._layers[a[b]].is3D()){this.opaquePassCutoff=b;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const b of a){const P=this.style._layers[b];if(!P.hasOffscreenPass()||P.isHidden(this.transform.zoom))continue;const E=_[P.source];(P.type==="custom"||E.length)&&this.renderLayer(this,h[P.source],P,E)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?c.aN.black:c.aN.transparent,depth:1}),this.clearStencil(),!((o=this.style.stylesheet)===null||o===void 0)&&o.sky&&function(b,P){const E=b.context,L=E.gl,B=((K,j,ee)=>({u_sky_color:K.properties.get("sky-color"),u_horizon_color:K.properties.get("horizon-color"),u_horizon:(j.height/2+j.getHorizon())*ee,u_sky_horizon_blend:K.properties.get("sky-horizon-blend")*j.height/2*ee}))(P,b.style.map.transform,b.pixelRatio),V=new dt(L.LEQUAL,dt.ReadWrite,[0,1]),Z=jt.disabled,U=b.colorModeForRenderPass(),H=b.useProgram("sky");if(!P.mesh){const K=new c.aX;K.emplaceBack(-1,-1),K.emplaceBack(1,-1),K.emplaceBack(1,1),K.emplaceBack(-1,1);const j=new c.aY;j.emplaceBack(0,1,2),j.emplaceBack(0,2,3),P.mesh=new Ml(E.createVertexBuffer(K,hs.members),E.createIndexBuffer(j),c.a0.simpleSegment(0,0,K.length,j.length))}H.draw(E,L.TRIANGLES,V,Z,U,Lt.disabled,B,void 0,"sky",P.mesh.vertexBuffer,P.mesh.indexBuffer,P.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=a.length-1;this.currentLayer>=0;this.currentLayer--){const b=this.style._layers[a[this.currentLayer]],P=h[b.source],E=m[b.source];this._renderTileClippingMasks(b,E),this.renderLayer(this,P,b,E)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<a.length;this.currentLayer++){const b=this.style._layers[a[this.currentLayer]],P=h[b.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(b))continue;const E=(b.type==="symbol"?v:_)[b.source];this._renderTileClippingMasks(b,m[b.source]),this.renderLayer(this,P,b,E)}if(this.options.showTileBoundaries){const b=function(P,E){let L=null;const B=Object.values(P._layers).flatMap(H=>H.source&&!H.isHidden(E)?[P.sourceCaches[H.source]]:[]),V=B.filter(H=>H.getSource().type==="vector"),Z=B.filter(H=>H.getSource().type!=="vector"),U=H=>{(!L||L.getSource().maxzoom<H.getSource().maxzoom)&&(L=H)};return V.forEach(H=>U(H)),L||Z.forEach(H=>U(H)),L}(this.style,this.transform.zoom);b&&function(P,E,L){for(let B=0;B<L.length;B++)gt(P,E,L[B])}(this,b,b.getVisibleCoordinates())}this.options.showPadding&&function(b){const P=b.transform.padding;fn(b,b.transform.height-(P.top||0),3,so),fn(b,P.bottom||0,3,xs),sa(b,P.left||0,3,oo),sa(b,b.transform.width-(P.right||0),3,kl);const E=b.transform.centerPoint;(function(L,B,V,Z){Rn(L,B-1,V-10,2,20,Z),Rn(L,B-10,V-1,20,2,Z)})(b,E.x,b.transform.height-E.y,Ln)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(t){if(!this.style||!this.style.map||!this.style.map.terrain)return;const n=this.terrainFacilitator.matrix,o=this.transform.modelViewProjectionMatrix;let a=this.terrainFacilitator.dirty;a||(a=t?!c.a_(n,o):!c.a$(n,o)),a||(a=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),a&&(c.b0(n,o),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(h,m){const _=h.context,v=_.gl,b=Mt.unblended,P=new dt(v.LEQUAL,dt.ReadWrite,[0,1]),E=m.getTerrainMesh(),L=m.sourceCache.getRenderableTiles(),B=h.useProgram("terrainDepth");_.bindFramebuffer.set(m.getFramebuffer("depth").framebuffer),_.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),_.clear({color:c.aN.transparent,depth:1});for(const V of L){const Z=m.getTerrainData(V.tileID),U={u_matrix:h.transform.calculatePosMatrix(V.tileID.toUnwrapped()),u_ele_delta:m.getMeshFrameDelta(h.transform.zoom)};B.draw(_,v.TRIANGLES,P,jt.disabled,b,Lt.backCCW,U,Z,"terrain",E.vertexBuffer,E.indexBuffer,E.segments)}_.bindFramebuffer.set(null),_.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain),function(h,m){const _=h.context,v=_.gl,b=Mt.unblended,P=new dt(v.LEQUAL,dt.ReadWrite,[0,1]),E=m.getTerrainMesh(),L=m.getCoordsTexture(),B=m.sourceCache.getRenderableTiles(),V=h.useProgram("terrainCoords");_.bindFramebuffer.set(m.getFramebuffer("coords").framebuffer),_.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),_.clear({color:c.aN.transparent,depth:1}),m.coordsIndex=[];for(const Z of B){const U=m.getTerrainData(Z.tileID);_.activeTexture.set(v.TEXTURE0),v.bindTexture(v.TEXTURE_2D,L.texture);const H={u_matrix:h.transform.calculatePosMatrix(Z.tileID.toUnwrapped()),u_terrain_coords_id:(255-m.coordsIndex.length)/255,u_texture:0,u_ele_delta:m.getMeshFrameDelta(h.transform.zoom)};V.draw(_,v.TRIANGLES,P,jt.disabled,b,Lt.backCCW,H,U,"terrain",E.vertexBuffer,E.indexBuffer,E.segments),m.coordsIndex.push(Z.tileID.key)}_.bindFramebuffer.set(null),_.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain))}renderLayer(t,n,o,a){if(!o.isHidden(this.transform.zoom)&&(o.type==="background"||o.type==="custom"||(a||[]).length))switch(this.id=o.id,o.type){case"symbol":(function(h,m,_,v,b){if(h.renderPass!=="translucent")return;const P=jt.disabled,E=h.colorModeForRenderPass();(_._unevaluatedLayout.hasValue("text-variable-anchor")||_._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(L,B,V,Z,U,H,K,j,ee){const ne=B.transform,ce=js(),ge=U==="map",we=H==="map";for(const De of L){const Re=Z.getTile(De),Se=Re.getBucket(V);if(!Se||!Se.text||!Se.text.segments.get().length)continue;const Te=c.ah(Se.textSizeData,ne.zoom),Ne=nt(Re,1,B.transform.zoom),it=qr(De.posMatrix,we,ge,B.transform,Ne),Ee=V.layout.get("icon-text-fit")!=="none"&&Se.hasIconData();if(Te){const ke=Math.pow(2,ne.zoom-Re.tileID.overscaledZ),et=B.style.map.terrain?(ot,pt)=>B.style.map.terrain.getElevation(De,ot,pt):null,Bt=ce.translatePosition(ne,Re,K,j);io(Se,ge,we,ee,ne,it,De.posMatrix,ke,Te,Ee,ce,Bt,De.toUnwrapped(),et)}}}(v,h,_,m,_.layout.get("text-rotation-alignment"),_.layout.get("text-pitch-alignment"),_.paint.get("text-translate"),_.paint.get("text-translate-anchor"),b),_.paint.get("icon-opacity").constantOr(1)!==0&&Xr(h,m,_,v,!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"),P,E),_.paint.get("text-opacity").constantOr(1)!==0&&Xr(h,m,_,v,!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"),P,E),m.map.showCollisionBoxes&&(Al(h,m,_,v,!0),Al(h,m,_,v,!1))})(t,n,o,a,this.style.placement.variableOffsets);break;case"circle":(function(h,m,_,v){if(h.renderPass!=="translucent")return;const b=_.paint.get("circle-opacity"),P=_.paint.get("circle-stroke-width"),E=_.paint.get("circle-stroke-opacity"),L=!_.layout.get("circle-sort-key").isConstant();if(b.constantOr(1)===0&&(P.constantOr(1)===0||E.constantOr(1)===0))return;const B=h.context,V=B.gl,Z=h.depthModeForSublayer(0,dt.ReadOnly),U=jt.disabled,H=h.colorModeForRenderPass(),K=[];for(let j=0;j<v.length;j++){const ee=v[j],ne=m.getTile(ee),ce=ne.getBucket(_);if(!ce)continue;const ge=ce.programConfigurations.get(_.id),we=h.useProgram("circle",ge),De=ce.layoutVertexBuffer,Re=ce.indexBuffer,Se=h.style.map.terrain&&h.style.map.terrain.getTerrainData(ee),Te={programConfiguration:ge,program:we,layoutVertexBuffer:De,indexBuffer:Re,uniformValues:hl(h,ee,ne,_),terrainData:Se};if(L){const Ne=ce.segments.get();for(const it of Ne)K.push({segments:new c.a0([it]),sortKey:it.sortKey,state:Te})}else K.push({segments:ce.segments,sortKey:0,state:Te})}L&&K.sort((j,ee)=>j.sortKey-ee.sortKey);for(const j of K){const{programConfiguration:ee,program:ne,layoutVertexBuffer:ce,indexBuffer:ge,uniformValues:we,terrainData:De}=j.state;ne.draw(B,V.TRIANGLES,Z,U,H,Lt.disabled,we,De,_.id,ce,ge,j.segments,_.paint,h.transform.zoom,ee)}})(t,n,o,a);break;case"heatmap":(function(h,m,_,v){if(_.paint.get("heatmap-opacity")!==0)if(h.renderPass==="offscreen"){const b=h.context,P=b.gl,E=jt.disabled,L=new Mt([P.ONE,P.ONE],c.aN.transparent,[!0,!0,!0,!0]);(function(B,V,Z){const U=B.gl;B.activeTexture.set(U.TEXTURE1),B.viewport.set([0,0,V.width/4,V.height/4]);let H=Z.heatmapFbo;if(H)U.bindTexture(U.TEXTURE_2D,H.colorAttachment.get()),B.bindFramebuffer.set(H.framebuffer);else{const K=U.createTexture();U.bindTexture(U.TEXTURE_2D,K),U.texParameteri(U.TEXTURE_2D,U.TEXTURE_WRAP_S,U.CLAMP_TO_EDGE),U.texParameteri(U.TEXTURE_2D,U.TEXTURE_WRAP_T,U.CLAMP_TO_EDGE),U.texParameteri(U.TEXTURE_2D,U.TEXTURE_MIN_FILTER,U.LINEAR),U.texParameteri(U.TEXTURE_2D,U.TEXTURE_MAG_FILTER,U.LINEAR),H=Z.heatmapFbo=B.createFramebuffer(V.width/4,V.height/4,!1,!1),function(j,ee,ne,ce){var ge,we;const De=j.gl,Re=(ge=j.HALF_FLOAT)!==null&&ge!==void 0?ge:De.UNSIGNED_BYTE,Se=(we=j.RGBA16F)!==null&&we!==void 0?we:De.RGBA;De.texImage2D(De.TEXTURE_2D,0,Se,ee.width/4,ee.height/4,0,De.RGBA,Re,null),ce.colorAttachment.set(ne)}(B,V,K,H)}})(b,h,_),b.clear({color:c.aN.transparent});for(let B=0;B<v.length;B++){const V=v[B];if(m.hasRenderableParent(V))continue;const Z=m.getTile(V),U=Z.getBucket(_);if(!U)continue;const H=U.programConfigurations.get(_.id),K=h.useProgram("heatmap",H),{zoom:j}=h.transform;K.draw(b,P.TRIANGLES,dt.disabled,E,L,Lt.disabled,ji(V.posMatrix,Z,j,_.paint.get("heatmap-intensity")),null,_.id,U.layoutVertexBuffer,U.indexBuffer,U.segments,_.paint,h.transform.zoom,H)}b.viewport.set([0,0,h.width,h.height])}else h.renderPass==="translucent"&&(h.context.setColorMode(h.colorModeForRenderPass()),function(b,P){const E=b.context,L=E.gl,B=P.heatmapFbo;if(!B)return;E.activeTexture.set(L.TEXTURE0),L.bindTexture(L.TEXTURE_2D,B.colorAttachment.get()),E.activeTexture.set(L.TEXTURE1);let V=P.colorRampTexture;V||(V=P.colorRampTexture=new wt(E,P.colorRamp,L.RGBA)),V.bind(L.LINEAR,L.CLAMP_TO_EDGE),b.useProgram("heatmapTexture").draw(E,L.TRIANGLES,dt.disabled,jt.disabled,b.colorModeForRenderPass(),Lt.disabled,((Z,U,H,K)=>{const j=c.H();c.aQ(j,0,Z.width,Z.height,0,0,1);const ee=Z.context.gl;return{u_matrix:j,u_world:[ee.drawingBufferWidth,ee.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:U.paint.get("heatmap-opacity")}})(b,P),null,P.id,b.viewportBuffer,b.quadTriangleIndexBuffer,b.viewportSegments,P.paint,b.transform.zoom)}(h,_))})(t,n,o,a);break;case"line":(function(h,m,_,v){if(h.renderPass!=="translucent")return;const b=_.paint.get("line-opacity"),P=_.paint.get("line-width");if(b.constantOr(1)===0||P.constantOr(1)===0)return;const E=h.depthModeForSublayer(0,dt.ReadOnly),L=h.colorModeForRenderPass(),B=_.paint.get("line-dasharray"),V=_.paint.get("line-pattern"),Z=V.constantOr(1),U=_.paint.get("line-gradient"),H=_.getCrossfadeParameters(),K=Z?"linePattern":B?"lineSDF":U?"lineGradient":"line",j=h.context,ee=j.gl;let ne=!0;for(const ce of v){const ge=m.getTile(ce);if(Z&&!ge.patternsLoaded())continue;const we=ge.getBucket(_);if(!we)continue;const De=we.programConfigurations.get(_.id),Re=h.context.program.get(),Se=h.useProgram(K,De),Te=ne||Se.program!==Re,Ne=h.style.map.terrain&&h.style.map.terrain.getTerrainData(ce),it=V.constantOr(null);if(it&&ge.imageAtlas){const et=ge.imageAtlas,Bt=et.patternPositions[it.to.toString()],ot=et.patternPositions[it.from.toString()];Bt&&ot&&De.setConstantPatternPositions(Bt,ot)}const Ee=Ne?ce:null,ke=Z?ul(h,ge,_,H,Ee):B?dl(h,ge,_,B,H,Ee):U?Xs(h,ge,_,we.lineClipsArray.length,Ee):fs(h,ge,_,Ee);if(Z)j.activeTexture.set(ee.TEXTURE0),ge.imageAtlasTexture.bind(ee.LINEAR,ee.CLAMP_TO_EDGE),De.updatePaintBuffers(H);else if(B&&(Te||h.lineAtlas.dirty))j.activeTexture.set(ee.TEXTURE0),h.lineAtlas.bind(j);else if(U){const et=we.gradients[_.id];let Bt=et.texture;if(_.gradientVersion!==et.version){let ot=256;if(_.stepInterpolant){const pt=m.getSource().maxzoom,Ft=ce.canonical.z===pt?Math.ceil(1<<h.transform.maxZoom-ce.canonical.z):1;ot=c.ad(c.aV(we.maxLineLength/c.X*1024*Ft),256,j.maxTextureSize)}et.gradient=c.aW({expression:_.gradientExpression(),evaluationKey:"lineProgress",resolution:ot,image:et.gradient||void 0,clips:we.lineClipsArray}),et.texture?et.texture.update(et.gradient):et.texture=new wt(j,et.gradient,ee.RGBA),et.version=_.gradientVersion,Bt=et.texture}j.activeTexture.set(ee.TEXTURE0),Bt.bind(_.stepInterpolant?ee.NEAREST:ee.LINEAR,ee.CLAMP_TO_EDGE)}Se.draw(j,ee.TRIANGLES,E,h.stencilModeForClipping(ce),L,Lt.disabled,ke,Ne,_.id,we.layoutVertexBuffer,we.indexBuffer,we.segments,_.paint,h.transform.zoom,De,we.layoutVertexBuffer2),ne=!1}})(t,n,o,a);break;case"fill":(function(h,m,_,v){const b=_.paint.get("fill-color"),P=_.paint.get("fill-opacity");if(P.constantOr(1)===0)return;const E=h.colorModeForRenderPass(),L=_.paint.get("fill-pattern"),B=h.opaquePassEnabledForLayer()&&!L.constantOr(1)&&b.constantOr(c.aN.transparent).a===1&&P.constantOr(0)===1?"opaque":"translucent";if(h.renderPass===B){const V=h.depthModeForSublayer(1,h.renderPass==="opaque"?dt.ReadWrite:dt.ReadOnly);ra(h,m,_,v,V,E,!1)}if(h.renderPass==="translucent"&&_.paint.get("fill-antialias")){const V=h.depthModeForSublayer(_.getPaintProperty("fill-outline-color")?2:0,dt.ReadOnly);ra(h,m,_,v,V,E,!0)}})(t,n,o,a);break;case"fill-extrusion":(function(h,m,_,v){const b=_.paint.get("fill-extrusion-opacity");if(b!==0&&h.renderPass==="translucent"){const P=new dt(h.context.gl.LEQUAL,dt.ReadWrite,h.depthRangeFor3D);if(b!==1||_.paint.get("fill-extrusion-pattern").constantOr(1))ro(h,m,_,v,P,jt.disabled,Mt.disabled),ro(h,m,_,v,P,h.stencilModeFor3D(),h.colorModeForRenderPass());else{const E=h.colorModeForRenderPass();ro(h,m,_,v,P,jt.disabled,E)}}})(t,n,o,a);break;case"hillshade":(function(h,m,_,v){if(h.renderPass!=="offscreen"&&h.renderPass!=="translucent")return;const b=h.context,P=h.depthModeForSublayer(0,dt.ReadOnly),E=h.colorModeForRenderPass(),[L,B]=h.renderPass==="translucent"?h.stencilConfigForOverlap(v):[{},v];for(const V of B){const Z=m.getTile(V);Z.needsHillshadePrepare!==void 0&&Z.needsHillshadePrepare&&h.renderPass==="offscreen"?pn(h,Z,_,P,jt.disabled,E):h.renderPass==="translucent"&&na(h,V,Z,_,P,L[V.overscaledZ],E)}b.viewport.set([0,0,h.width,h.height])})(t,n,o,a);break;case"raster":(function(h,m,_,v){if(h.renderPass!=="translucent"||_.paint.get("raster-opacity")===0||!v.length)return;const b=h.context,P=b.gl,E=m.getSource(),L=h.useProgram("raster"),B=h.colorModeForRenderPass(),[V,Z]=E instanceof kr?[{},v]:h.stencilConfigForOverlap(v),U=Z[Z.length-1].overscaledZ,H=!h.options.moving;for(const K of Z){const j=h.depthModeForSublayer(K.overscaledZ-U,_.paint.get("raster-opacity")===1?dt.ReadWrite:dt.ReadOnly,P.LESS),ee=m.getTile(K);ee.registerFadeDuration(_.paint.get("raster-fade-duration"));const ne=m.findLoadedParent(K,0),ce=m.findLoadedSibling(K),ge=no(ee,ne||ce||null,m,_,h.transform,h.style.map.terrain);let we,De;const Re=_.paint.get("raster-resampling")==="nearest"?P.NEAREST:P.LINEAR;b.activeTexture.set(P.TEXTURE0),ee.texture.bind(Re,P.CLAMP_TO_EDGE,P.LINEAR_MIPMAP_NEAREST),b.activeTexture.set(P.TEXTURE1),ne?(ne.texture.bind(Re,P.CLAMP_TO_EDGE,P.LINEAR_MIPMAP_NEAREST),we=Math.pow(2,ne.tileID.overscaledZ-ee.tileID.overscaledZ),De=[ee.tileID.canonical.x*we%1,ee.tileID.canonical.y*we%1]):ee.texture.bind(Re,P.CLAMP_TO_EDGE,P.LINEAR_MIPMAP_NEAREST),ee.texture.useMipmap&&b.extTextureFilterAnisotropic&&h.transform.pitch>20&&P.texParameterf(P.TEXTURE_2D,b.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,b.extTextureFilterAnisotropicMax);const Se=h.style.map.terrain&&h.style.map.terrain.getTerrainData(K),Te=Se?K:null,Ne=Te?Te.posMatrix:h.transform.calculatePosMatrix(K.toUnwrapped(),H),it=Fc(Ne,De||[0,0],we||1,ge,_);E instanceof kr?L.draw(b,P.TRIANGLES,j,jt.disabled,B,Lt.disabled,it,Se,_.id,E.boundsBuffer,h.quadTriangleIndexBuffer,E.boundsSegments):L.draw(b,P.TRIANGLES,j,V[K.overscaledZ],B,Lt.disabled,it,Se,_.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments)}})(t,n,o,a);break;case"background":(function(h,m,_,v){const b=_.paint.get("background-color"),P=_.paint.get("background-opacity");if(P===0)return;const E=h.context,L=E.gl,B=h.transform,V=B.tileSize,Z=_.paint.get("background-pattern");if(h.isPatternMissing(Z))return;const U=!Z&&b.a===1&&P===1&&h.opaquePassEnabledForLayer()?"opaque":"translucent";if(h.renderPass!==U)return;const H=jt.disabled,K=h.depthModeForSublayer(0,U==="opaque"?dt.ReadWrite:dt.ReadOnly),j=h.colorModeForRenderPass(),ee=h.useProgram(Z?"backgroundPattern":"background"),ne=v||B.coveringTiles({tileSize:V,terrain:h.style.map.terrain});Z&&(E.activeTexture.set(L.TEXTURE0),h.imageManager.bind(h.context));const ce=_.getCrossfadeParameters();for(const ge of ne){const we=v?ge.posMatrix:h.transform.calculatePosMatrix(ge.toUnwrapped()),De=Z?qo(we,P,h,Z,{tileID:ge,tileSize:V},ce):Ws(we,P,b),Re=h.style.map.terrain&&h.style.map.terrain.getTerrainData(ge);ee.draw(E,L.TRIANGLES,K,H,j,Lt.disabled,De,Re,_.id,h.tileExtentBuffer,h.quadTriangleIndexBuffer,h.tileExtentSegments)}})(t,0,o,a);break;case"custom":(function(h,m,_){const v=h.context,b=_.implementation;if(h.renderPass==="offscreen"){const P=b.prerender;P&&(h.setCustomLayerDefaults(),v.setColorMode(h.colorModeForRenderPass()),P.call(b,v.gl,h.transform.customLayerMatrix()),v.setDirty(),h.setBaseState())}else if(h.renderPass==="translucent"){h.setCustomLayerDefaults(),v.setColorMode(h.colorModeForRenderPass()),v.setStencilMode(jt.disabled);const P=b.renderingMode==="3d"?new dt(h.context.gl.LEQUAL,dt.ReadWrite,h.depthRangeFor3D):h.depthModeForSublayer(0,dt.ReadOnly);v.setDepthMode(P),b.render(v.gl,h.transform.customLayerMatrix(),{farZ:h.transform.farZ,nearZ:h.transform.nearZ,fov:h.transform._fov,modelViewProjectionMatrix:h.transform.modelViewProjectionMatrix,projectionMatrix:h.transform.projectionMatrix}),v.setDirty(),h.setBaseState(),v.bindFramebuffer.set(null)}})(t,0,o)}}translatePosMatrix(t,n,o,a,h){if(!o[0]&&!o[1])return t;const m=h?a==="map"?this.transform.angle:0:a==="viewport"?-this.transform.angle:0;if(m){const b=Math.sin(m),P=Math.cos(m);o=[o[0]*P-o[1]*b,o[0]*b+o[1]*P]}const _=[h?o[0]:nt(n,o[0],this.transform.zoom),h?o[1]:nt(n,o[1],this.transform.zoom),0],v=new Float32Array(16);return c.J(v,t,_),v}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()),o=this.imageManager.getPattern(t.to.toString());return!n||!o}useProgram(t,n){this.cache=this.cache||{};const o=t+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[o]||(this.cache[o]=new qs(this.context,Gr[t],n,Js[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[o]}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 wt(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 mn{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,o){const a=Math.pow(2,o),h=[[-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 v=1/(_=c.ag([],_,t))[3]/n*a;return c.b1(_,_,[v,v,1/_[3],v])}),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(_=>{const v=function(L,B){var V=B[0],Z=B[1],U=B[2],H=V*V+Z*Z+U*U;return H>0&&(H=1/Math.sqrt(H)),L[0]=B[0]*H,L[1]=B[1]*H,L[2]=B[2]*H,L}([],function(L,B,V){var Z=B[0],U=B[1],H=B[2],K=V[0],j=V[1],ee=V[2];return L[0]=U*ee-H*j,L[1]=H*K-Z*ee,L[2]=Z*j-U*K,L}([],It([],h[_[0]],h[_[1]]),It([],h[_[2]],h[_[1]]))),b=-((P=v)[0]*(E=h[_[1]])[0]+P[1]*E[1]+P[2]*E[2]);var P,E;return v.concat(b)});return new mn(h,m)}}class ao{constructor(t,n){this.min=t,this.max=n,this.center=function(o,a,h){return o[0]=.5*a[0],o[1]=.5*a[1],o[2]=.5*a[2],o}([],function(o,a,h){return o[0]=a[0]+h[0],o[1]=a[1]+h[1],o[2]=a[2]+h[2],o}([],this.min,this.max))}quadrant(t){const n=[t%2==0,t<2],o=yt(this.min),a=yt(this.max);for(let h=0;h<n.length;h++)o[h]=n[h]?this.min[h]:this.center[h],a[h]=n[h]?this.center[h]:this.max[h];return a[2]=this.max[2],new ao(o,a)}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 o=!0;for(let a=0;a<t.planes.length;a++){const h=t.planes[a];let m=0;for(let _=0;_<n.length;_++)c.b2(h,n[_])>=0&&m++;if(m===0)return 0;m!==n.length&&(o=!1)}if(o)return 2;for(let a=0;a<3;a++){let h=Number.MAX_VALUE,m=-Number.MAX_VALUE;for(let _=0;_<t.points.length;_++){const v=t.points[_][a]-this.min[a];h=Math.min(h,v),m=Math.max(m,v)}if(m<0||h>this.max[a]-this.min[a])return 0}return 1}}class lo{constructor(t=0,n=0,o=0,a=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(o)||o<0||isNaN(a)||a<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=o,this.right=a}interpolate(t,n,o){return n.top!=null&&t.top!=null&&(this.top=c.z.number(t.top,n.top,o)),n.bottom!=null&&t.bottom!=null&&(this.bottom=c.z.number(t.bottom,n.bottom,o)),n.left!=null&&t.left!=null&&(this.left=c.z.number(t.left,n.left,o)),n.right!=null&&t.right!=null&&(this.right=c.z.number(t.right,n.right,o)),this}getCenter(t,n){const o=c.ad((this.left+t-this.right)/2,0,t),a=c.ad((this.top+n-this.bottom)/2,0,n);return new c.P(o,a)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new lo(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const oa=85.051129;class aa{constructor(t,n,o,a,h){this.tileSize=512,this._renderWorldCopies=h===void 0||!!h,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=o??0,this._maxPitch=a??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new c.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new lo,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const t=new aa(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this.minElevationForCurrentTile=t.minElevationForCurrentTile,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new c.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-c.b3(t,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=function(){var o=new c.A(4);return c.A!=Float32Array&&(o[1]=0,o[2]=0),o[0]=1,o[3]=1,o}(),function(o,a,h){var m=a[0],_=a[1],v=a[2],b=a[3],P=Math.sin(h),E=Math.cos(h);o[0]=m*E+v*P,o[1]=_*E+b*P,o[2]=m*-P+v*E,o[3]=_*-P+b*E}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=c.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,o){this._unmodified=!1,this._edgeInsets.interpolate(t,n,o),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 c.b4(0,t)];if(this._renderWorldCopies){const o=this.pointCoordinate(new c.P(0,0)),a=this.pointCoordinate(new c.P(this.width,0)),h=this.pointCoordinate(new c.P(this.width,this.height)),m=this.pointCoordinate(new c.P(0,this.height)),_=Math.floor(Math.min(o.x,a.x,h.x,m.x)),v=Math.floor(Math.max(o.x,a.x,h.x,m.x)),b=1;for(let P=_-b;P<=v+b;P++)P!==0&&n.push(new c.b4(P,t))}return n}coveringTiles(t){var n,o;let a=this.coveringZoomLevel(t);const h=a;if(t.minzoom!==void 0&&a<t.minzoom)return[];t.maxzoom!==void 0&&a>t.maxzoom&&(a=t.maxzoom);const m=this.pointCoordinate(this.getCameraPoint()),_=c.Z.fromLngLat(this.center),v=Math.pow(2,a),b=[v*m.x,v*m.y,0],P=[v*_.x,v*_.y,0],E=mn.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,a);let L=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(L=a);const B=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,V=j=>({aabb:new ao([j*v,0,0],[(j+1)*v,v,0]),zoom:0,x:0,y:0,wrap:j,fullyVisible:!1}),Z=[],U=[],H=a,K=t.reparseOverscaled?h:a;if(this._renderWorldCopies)for(let j=1;j<=3;j++)Z.push(V(-j)),Z.push(V(j));for(Z.push(V(0));Z.length>0;){const j=Z.pop(),ee=j.x,ne=j.y;let ce=j.fullyVisible;if(!ce){const Se=j.aabb.intersects(E);if(Se===0)continue;ce=Se===2}const ge=t.terrain?b:P,we=j.aabb.distanceX(ge),De=j.aabb.distanceY(ge),Re=Math.max(Math.abs(we),Math.abs(De));if(j.zoom===H||Re>B+(1<<H-j.zoom)-2&&j.zoom>=L){const Se=H-j.zoom,Te=b[0]-.5-(ee<<Se),Ne=b[1]-.5-(ne<<Se);U.push({tileID:new c.S(j.zoom===H?K:j.zoom,j.wrap,j.zoom,ee,ne),distanceSq:Yi([P[0]-.5-ee,P[1]-.5-ne]),tileDistanceToCamera:Math.sqrt(Te*Te+Ne*Ne)})}else for(let Se=0;Se<4;Se++){const Te=(ee<<1)+Se%2,Ne=(ne<<1)+(Se>>1),it=j.zoom+1;let Ee=j.aabb.quadrant(Se);if(t.terrain){const ke=new c.S(it,j.wrap,it,Te,Ne),et=t.terrain.getMinMaxElevation(ke),Bt=(n=et.minElevation)!==null&&n!==void 0?n:this.elevation,ot=(o=et.maxElevation)!==null&&o!==void 0?o:this.elevation;Ee=new ao([Ee.min[0],Ee.min[1],Bt],[Ee.max[0],Ee.max[1],ot])}Z.push({aabb:Ee,zoom:it,x:Te,y:Ne,wrap:j.wrap,fullyVisible:ce})}}return U.sort((j,ee)=>j.distanceSq-ee.distanceSq).map(j=>j.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=c.ad(t.lat,-85.051129,oa);return new c.P(c.O(t.lng)*this.worldSize,c.Q(n)*this.worldSize)}unproject(t){return new c.Z(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const n=this.elevation,o=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,a=this.pointLocation(this.centerPoint,t),h=t.getElevationForLngLatZoom(a,this.tileZoom);if(!(this.elevation-h))return;const m=o+n-h,_=Math.cos(this._pitch)*this.cameraToCenterDistance/m/c.b5(1,a.lat),v=this.scaleZoom(_/this.tileSize);this._elevation=h,this._center=a,this.zoom=v}setLocationAtPoint(t,n){const o=this.pointCoordinate(n),a=this.pointCoordinate(this.centerPoint),h=this.locationCoordinate(t),m=new c.Z(h.x-(o.x-a.x),h.y-(o.y-a.y));this.center=this.coordinateLocation(m),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 c.Z.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,n){if(n){const L=n.pointCoordinate(t);if(L!=null)return L}const o=[t.x,t.y,0,1],a=[t.x,t.y,1,1];c.ag(o,o,this.pixelMatrixInverse),c.ag(a,a,this.pixelMatrixInverse);const h=o[3],m=a[3],_=o[1]/h,v=a[1]/m,b=o[2]/h,P=a[2]/m,E=b===P?0:(0-b)/(P-b);return new c.Z(c.z.number(o[0]/h,a[0]/m,E)/this.worldSize,c.z.number(_,v,E)/this.worldSize)}coordinatePoint(t,n=0,o=this.pixelMatrix){const a=[t.x*this.worldSize,t.y*this.worldSize,n,1];return c.ag(a,a,o),new c.P(a[0]/a[3],a[1]/a[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new ue().extend(this.pointLocation(new c.P(0,t))).extend(this.pointLocation(new c.P(this.width,t))).extend(this.pointLocation(new c.P(this.width,this.height))).extend(this.pointLocation(new c.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new ue([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,oa])}calculateTileMatrix(t){const n=t.canonical,o=this.worldSize/this.zoomScale(n.z),a=n.x+Math.pow(2,n.z)*t.wrap,h=c.ao(new Float64Array(16));return c.J(h,h,[a*o,n.y*o,0]),c.K(h,h,[o/c.X,o/c.X,1]),h}calculatePosMatrix(t,n=!1){const o=t.key,a=n?this._alignedPosMatrixCache:this._posMatrixCache;if(a[o])return a[o];const h=this.calculateTileMatrix(t);return c.L(h,n?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,h),a[o]=new Float32Array(h),a[o]}calculateFogMatrix(t){const n=t.key,o=this._fogMatrixCache;if(o[n])return o[n];const a=this.calculateTileMatrix(t);return c.L(a,this.fogMatrix,a),o[n]=new Float32Array(a),o[n]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(t,n){n=c.ad(+n,this.minZoom,this.maxZoom);const o={center:new c.N(t.lng,t.lat),zoom:n};let a=this.lngRange;if(!this._renderWorldCopies&&a===null){const j=179.9999999999;a=[-j,j]}const h=this.tileSize*this.zoomScale(o.zoom);let m=0,_=h,v=0,b=h,P=0,E=0;const{x:L,y:B}=this.size;if(this.latRange){const j=this.latRange;m=c.Q(j[1])*h,_=c.Q(j[0])*h,_-m<B&&(P=B/(_-m))}a&&(v=c.b3(c.O(a[0])*h,0,h),b=c.b3(c.O(a[1])*h,0,h),b<v&&(b+=h),b-v<L&&(E=L/(b-v)));const{x:V,y:Z}=this.project.call({worldSize:h},t);let U,H;const K=Math.max(E||0,P||0);if(K){const j=new c.P(E?(b+v)/2:V,P?(_+m)/2:Z);return o.center=this.unproject.call({worldSize:h},j).wrap(),o.zoom+=this.scaleZoom(K),o}if(this.latRange){const j=B/2;Z-j<m&&(H=m+j),Z+j>_&&(H=_-j)}if(a){const j=(v+b)/2;let ee=V;this._renderWorldCopies&&(ee=c.b3(V,j-h/2,j+h/2));const ne=L/2;ee-ne<v&&(U=v+ne),ee+ne>b&&(U=b-ne)}if(U!==void 0||H!==void 0){const j=new c.P(U??V,H??Z);o.center=this.unproject.call({worldSize:h},j).wrap()}return o}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:n,zoom:o}=this.getConstrained(this.center,this.zoom);this.center=n,this.zoom=o,this._unmodified=t,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,o=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=c.b5(1,this.center.lat)*this.worldSize;let a=c.ao(new Float64Array(16));c.K(a,a,[this.width/2,-this.height/2,1]),c.J(a,a,[1,-1,0]),this.labelPlaneMatrix=a,a=c.ao(new Float64Array(16)),c.K(a,a,[1,-1,1]),c.J(a,a,[-1,-1,0]),c.K(a,a,[2/this.width,2/this.height,1]),this.glCoordMatrix=a;const h=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),m=Math.min(this.elevation,this.minElevationForCurrentTile),_=h-m*this._pixelPerMeter/Math.cos(this._pitch),v=m<0?_:h,b=Math.PI/2+this._pitch,P=this._fov*(.5+t.y/this.height),E=Math.sin(P)*v/Math.sin(c.ad(Math.PI-b-P,.01,Math.PI-.01)),L=this.getHorizon(),B=2*Math.atan(L/this.cameraToCenterDistance)*(.5+t.y/(2*L)),V=Math.sin(B)*v/Math.sin(c.ad(Math.PI-b-B,.01,Math.PI-.01)),Z=Math.min(E,V);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*Z+v),this.nearZ=this.height/50,a=new Float64Array(16),c.b6(a,this._fov,this.width/this.height,this.nearZ,this.farZ),a[8]=2*-t.x/this.width,a[9]=2*t.y/this.height,this.projectionMatrix=c.af(a),c.K(a,a,[1,-1,1]),c.J(a,a,[0,0,-this.cameraToCenterDistance]),c.b7(a,a,this._pitch),c.ae(a,a,this.angle),c.J(a,a,[-n,-o,0]),this.mercatorMatrix=c.K([],a,[this.worldSize,this.worldSize,this.worldSize]),c.K(a,a,[1,1,this._pixelPerMeter]),this.pixelMatrix=c.L(new Float64Array(16),this.labelPlaneMatrix,a),c.J(a,a,[0,0,-this.elevation]),this.modelViewProjectionMatrix=a,this.invModelViewProjectionMatrix=c.at([],a),this.fogMatrix=new Float64Array(16),c.b6(this.fogMatrix,this._fov,this.width/this.height,h,this.farZ),this.fogMatrix[8]=2*-t.x/this.width,this.fogMatrix[9]=2*t.y/this.height,c.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),c.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),c.b7(this.fogMatrix,this.fogMatrix,this._pitch),c.ae(this.fogMatrix,this.fogMatrix,this.angle),c.J(this.fogMatrix,this.fogMatrix,[-n,-o,0]),c.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),c.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=c.L(new Float64Array(16),this.labelPlaneMatrix,a);const U=this.width%2/2,H=this.height%2/2,K=Math.cos(this.angle),j=Math.sin(this.angle),ee=n-Math.round(n)+K*U+j*H,ne=o-Math.round(o)+K*H+j*U,ce=new Float64Array(a);if(c.J(ce,ce,[ee>.5?ee-1:ee,ne>.5?ne-1:ne,0]),this.alignedModelViewProjectionMatrix=ce,a=c.at(new Float64Array(16),this.pixelMatrix),!a)throw new Error("failed to invert matrix");this.pixelMatrixInverse=a,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new c.P(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return c.ag(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new c.P(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let o=n.x,a=n.y,h=n.x,m=n.y;for(const _ of t)o=Math.min(o,_.x),a=Math.min(a,_.y),h=Math.max(h,_.x),m=Math.max(m,_.y);return[new c.P(o,a),new c.P(h,a),new c.P(h,m),new c.P(o,m),new c.P(o,a)]}}lngLatToCameraDepth(t,n){const o=this.locationCoordinate(t),a=[o.x*this.worldSize,o.y*this.worldSize,n,1];return c.ag(a,a,this.modelViewProjectionMatrix),a[2]/a[3]}}function co(u,t){let n,o=!1,a=null,h=null;const m=()=>{a=null,o&&(u.apply(h,n),a=setTimeout(m,t),o=!1)};return(..._)=>(o=!0,h=this,n=_,a||m(),a)}class bs{constructor(t){this._getCurrentHash=()=>{const n=window.location.hash.replace("#","");if(this._hashName){let o;return n.split("&").map(a=>a.split("=")).forEach(a=>{a[0]===this._hashName&&(o=a)}),(o&&o[1]||"").split("/")}return n.split("/")},this._onHashChange=()=>{const n=this._getCurrentHash();if(n.length>=3&&!n.some(o=>isNaN(o))){const o=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(n[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+n[2],+n[1]],zoom:+n[0],bearing:o,pitch:+(n[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const n=window.location.href.replace(/(#.+)?$/,this.getHashString());window.history.replaceState(window.history.state,null,n)},this._removeHash=()=>{const n=this._getCurrentHash();if(n.length===0)return;const o=n.join("/");let a=o;a.split("&").length>0&&(a=a.split("&")[0]),this._hashName&&(a=`${this._hashName}=${o}`);let h=window.location.hash.replace(a,"");h.startsWith("#&")?h=h.slice(0,1)+h.slice(2):h==="#"&&(h="");let m=window.location.href.replace(/(#.+)?$/,h);m=m.replace("&&","&"),window.history.replaceState(window.history.state,null,m)},this._updateHash=co(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(t){const n=this._map.getCenter(),o=Math.round(100*this._map.getZoom())/100,a=Math.ceil((o*Math.LN2+Math.log(512/360/.5))/Math.LN10),h=Math.pow(10,a),m=Math.round(n.lng*h)/h,_=Math.round(n.lat*h)/h,v=this._map.getBearing(),b=this._map.getPitch();let P="";if(P+=t?`/${m}/${_}/${o}`:`${o}/${_}/${m}`,(v||b)&&(P+="/"+Math.round(10*v)/10),b&&(P+=`/${Math.round(b)}`),this._hashName){const E=this._hashName;let L=!1;const B=window.location.hash.slice(1).split("&").map(V=>{const Z=V.split("=")[0];return Z===E?(L=!0,`${Z}=${P}`):V}).filter(V=>V);return L||B.push(`${E}=${P}`),`#${B.join("&")}`}return`#${P}`}}const gn={linearity:.3,easing:c.b8(0,0,.3,1)},la=c.e({deceleration:2500,maxSpeed:1400},gn),ca=c.e({deceleration:20,maxSpeed:1400},gn),Dl=c.e({deceleration:1e3,maxSpeed:360},gn),ho=c.e({deceleration:1e3,maxSpeed:90},gn);class uo{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:le.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=le.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 c.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:h}of this._inertiaBuffer)n.zoom+=h.zoomDelta||0,n.bearing+=h.bearingDelta||0,n.pitch+=h.pitchDelta||0,h.panDelta&&n.pan._add(h.panDelta),h.around&&(n.around=h.around),h.pinchAround&&(n.pinchAround=h.pinchAround);const o=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,a={};if(n.pan.mag()){const h=po(n.pan.mag(),o,c.e({},la,t||{}));a.offset=n.pan.mult(h.amount/n.pan.mag()),a.center=this._map.transform.center,Bn(a,h)}if(n.zoom){const h=po(n.zoom,o,ca);a.zoom=this._map.transform.zoom+h.amount,Bn(a,h)}if(n.bearing){const h=po(n.bearing,o,Dl);a.bearing=this._map.transform.bearing+c.ad(h.amount,-179,179),Bn(a,h)}if(n.pitch){const h=po(n.pitch,o,ho);a.pitch=this._map.transform.pitch+h.amount,Bn(a,h)}if(a.zoom||a.bearing){const h=n.pinchAround===void 0?n.around:n.pinchAround;a.around=h?this._map.unproject(h):this._map.getCenter()}return this.clear(),c.e(a,{noMoveStart:!0})}}function Bn(u,t){(!u.duration||u.duration<t.duration)&&(u.duration=t.duration,u.easing=t.easing)}function po(u,t,n){const{maxSpeed:o,linearity:a,deceleration:h}=n,m=c.ad(u*a/(t/1e3),-o,o),_=Math.abs(m)/(h*a);return{easing:n.easing,duration:1e3*_,amount:m*(_/2)}}class Ti extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,o,a={}){const h=ae.mousePos(n.getCanvas(),o),m=n.unproject(h);super(t,c.e({point:h,lngLat:m,originalEvent:o},a)),this._defaultPrevented=!1,this.target=n}}class ws extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,o){const a=t==="touchend"?o.changedTouches:o.touches,h=ae.touchPos(n.getCanvasContainer(),a),m=h.map(v=>n.unproject(v)),_=h.reduce((v,b,P,E)=>v.add(b.div(E.length)),new c.P(0,0));super(t,{points:h,point:_,lngLats:m,lngLat:n.unproject(_),originalEvent:o}),this._defaultPrevented=!1}}class ha extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,o){super(t,{originalEvent:o}),this._defaultPrevented=!1}}class fo{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new ha(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Ti(t.type,this._map,t))}mouseup(t){this._map.fire(new Ti(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Ti(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Ti(t.type,this._map,t))}mouseover(t){this._map.fire(new Ti(t.type,this._map,t))}mouseout(t){this._map.fire(new Ti(t.type,this._map,t))}touchstart(t){return this._firePreventable(new ws(t.type,this._map,t))}touchmove(t){this._map.fire(new ws(t.type,this._map,t))}touchend(t){this._map.fire(new ws(t.type,this._map,t))}touchcancel(t){this._map.fire(new ws(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ua{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Ti(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ti("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Ti(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Fn{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(c.P.convert(t),this._map.terrain)}}class da{constructor(t,n){this._map=t,this._tr=new Fn(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&&(ae.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const o=n;if(this._lastPos.equals(o)||!this._box&&o.dist(this._startPos)<this._clickTolerance)return;const a=this._startPos;this._lastPos=o,this._box||(this._box=ae.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const h=Math.min(a.x,o.x),m=Math.max(a.x,o.x),_=Math.min(a.y,o.y),v=Math.max(a.y,o.y);ae.setTransform(this._box,`translate(${h}px,${_}px)`),this._box.style.width=m-h+"px",this._box.style.height=v-_+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const o=this._startPos,a=n;if(this.reset(),ae.suppressClick(),o.x!==a.x||o.y!==a.y)return this._map.fire(new c.k("boxzoomend",{originalEvent:t})),{cameraAnimation:h=>h.fitScreenCoordinates(o,a,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&&(ae.remove(this._box),this._box=null),ae.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new c.k(t,{originalEvent:n}))}}function On(u,t){if(u.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${u.length}, points ${t.length}`);const n={};for(let o=0;o<u.length;o++)n[u[o].identifier]=t[o];return n}class pa{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,o){(this.centroid||o.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),o.length===this.numTouches&&(this.centroid=function(a){const h=new c.P(0,0);for(const m of a)h._add(m);return h.div(a.length)}(n),this.touches=On(o,n)))}touchmove(t,n,o){if(this.aborted||!this.centroid)return;const a=On(o,n);for(const h in this.touches){const m=a[h];(!m||m.dist(this.touches[h])>30)&&(this.aborted=!0)}}touchend(t,n,o){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),o.length===0){const a=!this.aborted&&this.centroid;if(this.reset(),a)return a}}}class fa{constructor(t){this.singleTap=new pa(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,o){this.singleTap.touchstart(t,n,o)}touchmove(t,n,o){this.singleTap.touchmove(t,n,o)}touchend(t,n,o){const a=this.singleTap.touchend(t,n,o);if(a){const h=t.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(a)<30;if(h&&m||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=a,this.count===this.numTaps)return this.reset(),a}}}class Ll{constructor(t){this._tr=new Fn(t),this._zoomIn=new fa({numTouches:1,numTaps:2}),this._zoomOut=new fa({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,o){this._zoomIn.touchstart(t,n,o),this._zoomOut.touchstart(t,n,o)}touchmove(t,n,o){this._zoomIn.touchmove(t,n,o),this._zoomOut.touchmove(t,n,o)}touchend(t,n,o){const a=this._zoomIn.touchend(t,n,o),h=this._zoomOut.touchend(t,n,o),m=this._tr;return a?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:m.zoom+1,around:m.unproject(a)},{originalEvent:t})}):h?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:m.zoom-1,around:m.unproject(h)},{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 Rt{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 o=this._lastPoint;if(!o)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const a=n.length?n[0]:n;return!this._moved&&a.dist(o)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=a,this._move(o,a))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&ae.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 _n={0:1,2:2};class ki{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const n=ae.mouseButton(t);this._eventButton=n}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!function(n,o){const a=_n[o];return n.buttons===void 0||(n.buttons&a)!==a}(t,this._eventButton)}isValidEndEvent(t){return ae.mouseButton(t)===this._eventButton}}class mo{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 Ss=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=t=>{t.preventDefault()}},ma=({enable:u,clickTolerance:t,bearingDegreesPerPixelMoved:n=.8})=>{const o=new ki({checkCorrectEvent:a=>ae.mouseButton(a)===0&&a.ctrlKey||ae.mouseButton(a)===2});return new Rt({clickTolerance:t,move:(a,h)=>({bearingDelta:(h.x-a.x)*n}),moveStateManager:o,enable:u,assignEvents:Ss})},yn=({enable:u,clickTolerance:t,pitchDegreesPerPixelMoved:n=-.5})=>{const o=new ki({checkCorrectEvent:a=>ae.mouseButton(a)===0&&a.ctrlKey||ae.mouseButton(a)===2});return new Rt({clickTolerance:t,move:(a,h)=>({pitchDelta:(h.y-a.y)*n}),moveStateManager:o,enable:u,assignEvents:Ss})};class Ts{constructor(t,n){this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new c.P(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,n,o){return this._calculateTransform(t,n,o)}touchmove(t,n,o){if(this._active){if(!this._shouldBePrevented(o.length))return t.preventDefault(),this._calculateTransform(t,n,o);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,n,o){this._calculateTransform(t,n,o),this._active&&this._shouldBePrevented(o.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,o){o.length>0&&(this._active=!0);const a=On(o,n),h=new c.P(0,0),m=new c.P(0,0);let _=0;for(const b in a){const P=a[b],E=this._touches[b];E&&(h._add(P),m._add(P.sub(E)),_++,a[b]=P)}if(this._touches=a,this._shouldBePrevented(_)||!m.mag())return;const v=m.div(_);return this._sum._add(v),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(_),panDelta:v}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Is{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,n,o){this._firstTwoTouches||o.length<2||(this._firstTwoTouches=[o[0].identifier,o[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,o){if(!this._firstTwoTouches)return;t.preventDefault();const[a,h]=this._firstTwoTouches,m=Ps(o,n,a),_=Ps(o,n,h);if(!m||!_)return;const v=this._aroundCenter?null:m.add(_).div(2);return this._move([m,_],v,t)}touchend(t,n,o){if(!this._firstTwoTouches)return;const[a,h]=this._firstTwoTouches,m=Ps(o,n,a),_=Ps(o,n,h);m&&_||(this._active&&ae.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 Ps(u,t,n){for(let o=0;o<u.length;o++)if(u[o].identifier===n)return t[o]}function ga(u,t){return Math.log(u/t)/Math.LN2}class _a extends Is{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const o=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(ga(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:ga(this._distance,o),pinchAround:n}}}function ya(u,t){return 180*u.angleWith(t)/Math.PI}class xa extends Is{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,o){const a=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:ya(this._vector,a),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,o=ya(t,this._startVector);return Math.abs(o)<n}}function Lr(u){return Math.abs(u.y)>Math.abs(u.x)}class va extends Is{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,o){super.touchstart(t,n,o),this._currentTouchCount=o.length}_start(t){this._lastPoints=t,Lr(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,o){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const a=t[0].sub(this._lastPoints[0]),h=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(a,h,o.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(a.y+h.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,o){if(this._valid!==void 0)return this._valid;const a=t.mag()>=2,h=n.mag()>=2;if(!a&&!h)return;if(!a||!h)return this._firstMove===void 0&&(this._firstMove=o),o-this._firstMove<100&&void 0;const m=t.y>0==n.y>0;return Lr(t)&&Lr(n)&&m}}const Rl={panStep:100,bearingStep:15,pitchStep:10};class ba{constructor(t){this._tr=new Fn(t);const n=Rl;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,o=0,a=0,h=0,m=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?o=-1:(t.preventDefault(),h=-1);break;case 39:t.shiftKey?o=1:(t.preventDefault(),h=1);break;case 38:t.shiftKey?a=1:(t.preventDefault(),m=-1);break;case 40:t.shiftKey?a=-1:(t.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(o=0,a=0),{cameraAnimation:_=>{const v=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:Bl,zoom:n?Math.round(v.zoom)+n*(t.shiftKey?2:1):v.zoom,bearing:v.bearing+o*this._bearingStep,pitch:v.pitch+a*this._pitchStep,offset:[-h*this._panStep,-m*this._panStep],center:v.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 Bl(u){return u*(2-u)}const wa=4.000244140625;class Sa{constructor(t,n){this._onTimeout=o=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(o)},this._map=t,this._tr=new Fn(t),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)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const o=le.now(),a=o-(this._lastWheelEventTime||0);this._lastWheelEventTime=o,n!==0&&n%wa==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":a>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(a*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=ae.mousePos(this._map.getCanvas(),t),o=this._tr;this._around=n.y>o.transform.height/2-o.transform.getHorizon()?c.N.convert(this._aroundCenter?o.center:o.unproject(n)):c.N.convert(o.center),this._aroundPoint=o.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 v=this._type==="wheel"&&Math.abs(this._delta)>wa?this._wheelZoomRate:this._defaultZoomRate;let b=2/(1+Math.exp(-Math.abs(this._delta*v)));this._delta<0&&b!==0&&(b=1/b);const P=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(P*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,o=this._startZoom,a=this._easing;let h,m=!1;const _=le.now()-this._lastWheelEventTime;if(this._type==="wheel"&&o&&a&&_){const v=Math.min(_/200,1),b=a(v);h=c.z.number(o,n,b),v<1?this._frameId||(this._frameId=!0):m=!0}else h=n,m=!0;return this._active=!0,m&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!m,zoomDelta:h-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=c.b9;if(this._prevEase){const o=this._prevEase,a=(le.now()-o.start)/o.duration,h=o.easing(a+.01)-o.easing(a),m=.27/Math.sqrt(h*h+1e-4)*.01,_=Math.sqrt(.0729-m*m);n=c.b8(m,_,.25,1)}return this._prevEase={start:le.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 Ta{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 Es{constructor(t){this._tr=new Fn(t),this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:o=>{o.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 Fl{constructor(){this._tap=new fa({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,o){if(!this._swipePoint)if(this._tapTime){const a=n[0],h=t.timeStamp-this._tapTime<500,m=this._tapPoint.dist(a)<30;h&&m?o.length>0&&(this._swipePoint=a,this._swipeTouch=o[0].identifier):this.reset()}else this._tap.touchstart(t,n,o)}touchmove(t,n,o){if(this._tapTime){if(this._swipePoint){if(o[0].identifier!==this._swipeTouch)return;const a=n[0],h=a.y-this._swipePoint.y;return this._swipePoint=a,t.preventDefault(),this._active=!0,{zoomDelta:h/128}}}else this._tap.touchmove(t,n,o)}touchend(t,n,o){if(this._tapTime)this._swipePoint&&o.length===0&&this.reset();else{const a=this._tap.touchend(t,n,o);a&&(this._tapTime=t.timeStamp,this._tapPoint=a)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Wi{constructor(t,n,o){this._el=t,this._mousePan=n,this._touchPan=o}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 rr{constructor(t,n,o){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,this._mousePitch=o}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 Ia{constructor(t,n,o,a){this._el=t,this._touchZoom=n,this._touchRotate=o,this._tapDragZoom=a,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class nr{constructor(t,n){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=t,this._options=n,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=ae.create("div","maplibregl-cooperative-gesture-screen",t);let n=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(n=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const o=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),a=document.createElement("div");a.className="maplibregl-desktop-message",a.textContent=n,this._container.appendChild(a);const h=document.createElement("div");h.className="maplibregl-mobile-message",h.textContent=o,this._container.appendChild(h),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(ae.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(t){return t[this._bypassKey]}notifyGestureBlocked(t,n){this._enabled&&(this._map.fire(new c.k("cooperativegestureprevented",{gestureType:t,originalEvent:n})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Rr=u=>u.zoom||u.drag||u.pitch||u.rotate;class Wc extends c.k{}function Pa(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta}class Jc{constructor(t,n){this.handleWindowEvent=a=>{this.handleEvent(a,`${a.type}Window`)},this.handleEvent=(a,h)=>{if(a.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const m=a.type==="renderFrame"?void 0:a,_={needsRenderFrame:!1},v={},b={},P=a.touches,E=P?this._getMapTouches(P):void 0,L=E?ae.touchPos(this._map.getCanvas(),E):ae.mousePos(this._map.getCanvas(),a);for(const{handlerName:Z,handler:U,allowed:H}of this._handlers){if(!U.isEnabled())continue;let K;this._blockedByActive(b,H,Z)?U.reset():U[h||a.type]&&(K=U[h||a.type](a,L,E),this.mergeHandlerResult(_,v,K,Z,m),K&&K.needsRenderFrame&&this._triggerRenderFrame()),(K||U.isActive())&&(b[Z]=U)}const B={};for(const Z in this._previousActiveHandlers)b[Z]||(B[Z]=m);this._previousActiveHandlers=b,(Object.keys(B).length||Pa(_))&&(this._changes.push([_,v,B]),this._triggerRenderFrame()),(Object.keys(b).length||Pa(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:V}=_;V&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],V(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new uo(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);const o=this._el;this._listeners=[[o,"touchstart",{passive:!0}],[o,"touchmove",{passive:!1}],[o,"touchend",void 0],[o,"touchcancel",void 0],[o,"mousedown",void 0],[o,"mousemove",void 0],[o,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[o,"mouseover",void 0],[o,"mouseout",void 0],[o,"dblclick",void 0],[o,"click",void 0],[o,"keydown",{capture:!1}],[o,"keyup",void 0],[o,"wheel",{passive:!1}],[o,"contextmenu",void 0],[window,"blur",void 0]];for(const[a,h,m]of this._listeners)ae.addEventListener(a,h,a===document?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(const[t,n,o]of this._listeners)ae.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,o)}_addDefaultHandlers(t){const n=this._map,o=n.getCanvasContainer();this._add("mapEvent",new fo(n,t));const a=n.boxZoom=new da(n,t);this._add("boxZoom",a),t.interactive&&t.boxZoom&&a.enable();const h=n.cooperativeGestures=new nr(n,t.cooperativeGestures);this._add("cooperativeGestures",h),t.cooperativeGestures&&h.enable();const m=new Ll(n),_=new Es(n);n.doubleClickZoom=new Ta(_,m),this._add("tapZoom",m),this._add("clickZoom",_),t.interactive&&t.doubleClickZoom&&n.doubleClickZoom.enable();const v=new Fl;this._add("tapDragZoom",v);const b=n.touchPitch=new va(n);this._add("touchPitch",b),t.interactive&&t.touchPitch&&n.touchPitch.enable(t.touchPitch);const P=ma(t),E=yn(t);n.dragRotate=new rr(t,P,E),this._add("mouseRotate",P,["mousePitch"]),this._add("mousePitch",E,["mouseRotate"]),t.interactive&&t.dragRotate&&n.dragRotate.enable();const L=(({enable:K,clickTolerance:j})=>{const ee=new ki({checkCorrectEvent:ne=>ae.mouseButton(ne)===0&&!ne.ctrlKey});return new Rt({clickTolerance:j,move:(ne,ce)=>({around:ce,panDelta:ce.sub(ne)}),activateOnStart:!0,moveStateManager:ee,enable:K,assignEvents:Ss})})(t),B=new Ts(t,n);n.dragPan=new Wi(o,L,B),this._add("mousePan",L),this._add("touchPan",B,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&n.dragPan.enable(t.dragPan);const V=new xa,Z=new _a;n.touchZoomRotate=new Ia(o,Z,V,v),this._add("touchRotate",V,["touchPan","touchZoom"]),this._add("touchZoom",Z,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&n.touchZoomRotate.enable(t.touchZoomRotate);const U=n.scrollZoom=new Sa(n,()=>this._triggerRenderFrame());this._add("scrollZoom",U,["mousePan"]),t.interactive&&t.scrollZoom&&n.scrollZoom.enable(t.scrollZoom);const H=n.keyboard=new ba(n);this._add("keyboard",H),t.interactive&&t.keyboard&&n.keyboard.enable(),this._add("blockableMapEvent",new ua(n))}_add(t,n,o){this._handlers.push({handlerName:t,handler:n,allowed:o}),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!!Rr(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,n,o){for(const a in t)if(a!==o&&(!n||n.indexOf(a)<0))return!0;return!1}_getMapTouches(t){const n=[];for(const o of t)this._el.contains(o.target)&&n.push(o);return n}mergeHandlerResult(t,n,o,a,h){if(!o)return;c.e(t,o);const m={handlerName:a,originalEvent:o.originalEvent||h};o.zoomDelta!==void 0&&(n.zoom=m),o.panDelta!==void 0&&(n.drag=m),o.pitchDelta!==void 0&&(n.pitch=m),o.bearingDelta!==void 0&&(n.rotate=m)}_applyChanges(){const t={},n={},o={};for(const[a,h,m]of this._changes)a.panDelta&&(t.panDelta=(t.panDelta||new c.P(0,0))._add(a.panDelta)),a.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+a.zoomDelta),a.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+a.bearingDelta),a.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+a.pitchDelta),a.around!==void 0&&(t.around=a.around),a.pinchAround!==void 0&&(t.pinchAround=a.pinchAround),a.noInertia&&(t.noInertia=a.noInertia),c.e(n,h),c.e(o,m);this._updateMapTransform(t,n,o),this._changes=[]}_updateMapTransform(t,n,o){const a=this._map,h=a._getTransformForUpdate(),m=a.terrain;if(!(Pa(t)||m&&this._terrainMovement))return this._fireEvents(n,o,!0);let{panDelta:_,zoomDelta:v,bearingDelta:b,pitchDelta:P,around:E,pinchAround:L}=t;L!==void 0&&(E=L),a._stop(!0),E=E||a.transform.centerPoint;const B=h.pointLocation(_?E.sub(_):E);b&&(h.bearing+=b),P&&(h.pitch+=P),v&&(h.zoom+=v),m?this._terrainMovement||!n.drag&&!n.zoom?n.drag&&this._terrainMovement?h.center=h.pointLocation(h.centerPoint.sub(_)):h.setLocationAtPoint(B,E):(this._terrainMovement=!0,this._map._elevationFreeze=!0,h.setLocationAtPoint(B,E)):h.setLocationAtPoint(B,E),a._applyUpdatedTransform(h),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,o,!0)}_fireEvents(t,n,o){const a=Rr(this._eventsInProgress),h=Rr(t),m={};for(const E in t){const{originalEvent:L}=t[E];this._eventsInProgress[E]||(m[`${E}start`]=L),this._eventsInProgress[E]=t[E]}!a&&h&&this._fireEvent("movestart",h.originalEvent);for(const E in m)this._fireEvent(E,m[E]);h&&this._fireEvent("move",h.originalEvent);for(const E in t){const{originalEvent:L}=t[E];this._fireEvent(E,L)}const _={};let v;for(const E in this._eventsInProgress){const{handlerName:L,originalEvent:B}=this._eventsInProgress[E];this._handlersById[L].isActive()||(delete this._eventsInProgress[E],v=n[L]||B,_[`${E}end`]=v)}for(const E in _)this._fireEvent(E,_[E]);const b=Rr(this._eventsInProgress),P=(a||h)&&!b;if(P&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const E=this._map._getTransformForUpdate();E.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(E)}if(o&&P){this._updatingCamera=!0;const E=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),L=B=>B!==0&&-this._bearingSnap<B&&B<this._bearingSnap;!E||!E.essential&&le.prefersReducedMotion?(this._map.fire(new c.k("moveend",{originalEvent:v})),L(this._map.getBearing())&&this._map.resetNorth()):(L(E.bearing||this._map.getBearing())&&(E.bearing=0),E.freezeElevation=!0,this._map.easeTo(E,{originalEvent:v})),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new c.k(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new Wc("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Kc extends c.E{constructor(t,n){super(),this._renderFrameCallback=()=>{const o=Math.min((le.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(o)),o<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 c.N(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,o){return t=c.P.convert(t).mult(-1),this.panTo(this.transform.center,c.e({offset:t},n),o)}panTo(t,n,o){return this.easeTo(c.e({center:t},n),o)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,o){return this.easeTo(c.e({zoom:t},n),o)}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,o){return this.easeTo(c.e({bearing:t},n),o)}resetNorth(t,n){return this.rotateTo(0,c.e({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(c.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=ue.convert(t);const o=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),o,n)}_cameraForBoxAndBearing(t,n,o,a){const h={top:0,bottom:0,right:0,left:0};if(typeof(a=c.e({padding:h,offset:[0,0],maxZoom:this.transform.maxZoom},a)).padding=="number"){const Se=a.padding;a.padding={top:Se,bottom:Se,right:Se,left:Se}}a.padding=c.e(h,a.padding);const m=this.transform,_=m.padding,v=new ue(t,n),b=m.project(v.getNorthWest()),P=m.project(v.getNorthEast()),E=m.project(v.getSouthEast()),L=m.project(v.getSouthWest()),B=c.ba(-o),V=b.rotate(B),Z=P.rotate(B),U=E.rotate(B),H=L.rotate(B),K=new c.P(Math.max(V.x,Z.x,H.x,U.x),Math.max(V.y,Z.y,H.y,U.y)),j=new c.P(Math.min(V.x,Z.x,H.x,U.x),Math.min(V.y,Z.y,H.y,U.y)),ee=K.sub(j),ne=(m.width-(_.left+_.right+a.padding.left+a.padding.right))/ee.x,ce=(m.height-(_.top+_.bottom+a.padding.top+a.padding.bottom))/ee.y;if(ce<0||ne<0)return void c.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const ge=Math.min(m.scaleZoom(m.scale*Math.min(ne,ce)),a.maxZoom),we=c.P.convert(a.offset),De=new c.P((a.padding.left-a.padding.right)/2,(a.padding.top-a.padding.bottom)/2).rotate(c.ba(o)),Re=we.add(De).mult(m.scale/m.zoomScale(ge));return{center:m.unproject(b.add(E).div(2).sub(Re)),zoom:ge,bearing:o}}fitBounds(t,n,o){return this._fitInternal(this.cameraForBounds(t,n),n,o)}fitScreenCoordinates(t,n,o,a,h){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(c.P.convert(t)),this.transform.pointLocation(c.P.convert(n)),o,a),a,h)}_fitInternal(t,n,o){return t?(delete(n=c.e(t,n)).padding,n.linear?this.easeTo(n,o):this.flyTo(n,o)):this}jumpTo(t,n){this.stop();const o=this._getTransformForUpdate();let a=!1,h=!1,m=!1;return"zoom"in t&&o.zoom!==+t.zoom&&(a=!0,o.zoom=+t.zoom),t.center!==void 0&&(o.center=c.N.convert(t.center)),"bearing"in t&&o.bearing!==+t.bearing&&(h=!0,o.bearing=+t.bearing),"pitch"in t&&o.pitch!==+t.pitch&&(m=!0,o.pitch=+t.pitch),t.padding==null||o.isPaddingEqual(t.padding)||(o.padding=t.padding),this._applyUpdatedTransform(o),this.fire(new c.k("movestart",n)).fire(new c.k("move",n)),a&&this.fire(new c.k("zoomstart",n)).fire(new c.k("zoom",n)).fire(new c.k("zoomend",n)),h&&this.fire(new c.k("rotatestart",n)).fire(new c.k("rotate",n)).fire(new c.k("rotateend",n)),m&&this.fire(new c.k("pitchstart",n)).fire(new c.k("pitch",n)).fire(new c.k("pitchend",n)),this.fire(new c.k("moveend",n))}calculateCameraOptionsFromTo(t,n,o,a=0){const h=c.Z.fromLngLat(t,n),m=c.Z.fromLngLat(o,a),_=m.x-h.x,v=m.y-h.y,b=m.z-h.z,P=Math.hypot(_,v,b);if(P===0)throw new Error("Can't calculate camera options with same From and To");const E=Math.hypot(_,v),L=this.transform.scaleZoom(this.transform.cameraToCenterDistance/P/this.transform.tileSize),B=180*Math.atan2(_,-v)/Math.PI;let V=180*Math.acos(E/P)/Math.PI;return V=b<0?90-V:90+V,{center:m.toLngLat(),zoom:L,pitch:V,bearing:B}}easeTo(t,n){var o;this._stop(!1,t.easeId),((t=c.e({offset:[0,0],duration:500,easing:c.b9},t)).animate===!1||!t.essential&&le.prefersReducedMotion)&&(t.duration=0);const a=this._getTransformForUpdate(),h=a.zoom,m=a.bearing,_=a.pitch,v=a.padding,b="bearing"in t?this._normalizeBearing(t.bearing,m):m,P="pitch"in t?+t.pitch:_,E="padding"in t?t.padding:a.padding,L=c.P.convert(t.offset);let B=a.centerPoint.add(L);const V=a.pointLocation(B),{center:Z,zoom:U}=a.getConstrained(c.N.convert(t.center||V),(o=t.zoom)!==null&&o!==void 0?o:h);this._normalizeCenter(Z,a);const H=a.project(V),K=a.project(Z).sub(H),j=a.zoomScale(U-h);let ee,ne;t.around&&(ee=c.N.convert(t.around),ne=a.locationPoint(ee));const ce={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||U!==h,this._rotating=this._rotating||m!==b,this._pitching=this._pitching||P!==_,this._padding=!a.isPaddingEqual(E),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,ce),this.terrain&&this._prepareElevation(Z),this._ease(ge=>{if(this._zooming&&(a.zoom=c.z.number(h,U,ge)),this._rotating&&(a.bearing=c.z.number(m,b,ge)),this._pitching&&(a.pitch=c.z.number(_,P,ge)),this._padding&&(a.interpolatePadding(v,E,ge),B=a.centerPoint.add(L)),this.terrain&&!t.freezeElevation&&this._updateElevation(ge),ee)a.setLocationAtPoint(ee,ne);else{const we=a.zoomScale(a.zoom-h),De=U>h?Math.min(2,j):Math.max(.5,j),Re=Math.pow(De,1-ge),Se=a.unproject(H.add(K.mult(ge*Re)).mult(we));a.setLocationAtPoint(a.renderWorldCopies?Se.wrap():Se,B)}this._applyUpdatedTransform(a),this._fireMoveEvents(n)},ge=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n,ge)},t),this}_prepareEase(t,n,o={}){this._moving=!0,n||o.moving||this.fire(new c.k("movestart",t)),this._zooming&&!o.zooming&&this.fire(new c.k("zoomstart",t)),this._rotating&&!o.rotating&&this.fire(new c.k("rotatestart",t)),this._pitching&&!o.pitching&&this.fire(new c.k("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&n!==this._elevationTarget){const o=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(o-(n-(o*t+this._elevationStart))/(1-t)),this._elevationTarget=n}this.transform.elevation=c.z.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){const n=t.getCameraPosition(),o=this.terrain.getElevationForLngLatZoom(n.lngLat,t.zoom);if(n.altitude<o){const a=this.calculateCameraOptionsFromTo(n.lngLat,o,t.center,t.elevation);return{pitch:a.pitch,zoom:a.zoom}}return{}}_applyUpdatedTransform(t){const n=[];if(this.terrain&&n.push(a=>this._elevateCameraIfInsideTerrain(a)),this.transformCameraUpdate&&n.push(a=>this.transformCameraUpdate(a)),!n.length)return;const o=t.clone();for(const a of n){const h=o.clone(),{center:m,zoom:_,pitch:v,bearing:b,elevation:P}=a(h);m&&(h.center=m),_!==void 0&&(h.zoom=_),v!==void 0&&(h.pitch=v),b!==void 0&&(h.bearing=b),P!==void 0&&(h.elevation=P),o.apply(h)}this.transform.apply(o)}_fireMoveEvents(t){this.fire(new c.k("move",t)),this._zooming&&this.fire(new c.k("zoom",t)),this._rotating&&this.fire(new c.k("rotate",t)),this._pitching&&this.fire(new c.k("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const o=this._zooming,a=this._rotating,h=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,o&&this.fire(new c.k("zoomend",t)),a&&this.fire(new c.k("rotateend",t)),h&&this.fire(new c.k("pitchend",t)),this.fire(new c.k("moveend",t))}flyTo(t,n){var o;if(!t.essential&&le.prefersReducedMotion){const ke=c.M(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(ke,n)}this.stop(),t=c.e({offset:[0,0],speed:1.2,curve:1.42,easing:c.b9},t);const a=this._getTransformForUpdate(),h=a.zoom,m=a.bearing,_=a.pitch,v=a.padding,b="bearing"in t?this._normalizeBearing(t.bearing,m):m,P="pitch"in t?+t.pitch:_,E="padding"in t?t.padding:a.padding,L=c.P.convert(t.offset);let B=a.centerPoint.add(L);const V=a.pointLocation(B),{center:Z,zoom:U}=a.getConstrained(c.N.convert(t.center||V),(o=t.zoom)!==null&&o!==void 0?o:h);this._normalizeCenter(Z,a);const H=a.zoomScale(U-h),K=a.project(V),j=a.project(Z).sub(K);let ee=t.curve;const ne=Math.max(a.width,a.height),ce=ne/H,ge=j.mag();if("minZoom"in t){const ke=c.ad(Math.min(t.minZoom,h,U),a.minZoom,a.maxZoom),et=ne/a.zoomScale(ke-h);ee=Math.sqrt(et/ge*2)}const we=ee*ee;function De(ke){const et=(ce*ce-ne*ne+(ke?-1:1)*we*we*ge*ge)/(2*(ke?ce:ne)*we*ge);return Math.log(Math.sqrt(et*et+1)-et)}function Re(ke){return(Math.exp(ke)-Math.exp(-ke))/2}function Se(ke){return(Math.exp(ke)+Math.exp(-ke))/2}const Te=De(!1);let Ne=function(ke){return Se(Te)/Se(Te+ee*ke)},it=function(ke){return ne*((Se(Te)*(Re(et=Te+ee*ke)/Se(et))-Re(Te))/we)/ge;var et},Ee=(De(!0)-Te)/ee;if(Math.abs(ge)<1e-6||!isFinite(Ee)){if(Math.abs(ne-ce)<1e-6)return this.easeTo(t,n);const ke=ce<ne?-1:1;Ee=Math.abs(Math.log(ce/ne))/ee,it=()=>0,Ne=et=>Math.exp(ke*ee*et)}return t.duration="duration"in t?+t.duration:1e3*Ee/("screenSpeed"in t?+t.screenSpeed/ee:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=m!==b,this._pitching=P!==_,this._padding=!a.isPaddingEqual(E),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(Z),this._ease(ke=>{const et=ke*Ee,Bt=1/Ne(et);a.zoom=ke===1?U:h+a.scaleZoom(Bt),this._rotating&&(a.bearing=c.z.number(m,b,ke)),this._pitching&&(a.pitch=c.z.number(_,P,ke)),this._padding&&(a.interpolatePadding(v,E,ke),B=a.centerPoint.add(L)),this.terrain&&!t.freezeElevation&&this._updateElevation(ke);const ot=ke===1?Z:a.unproject(K.add(j.mult(it(et))).mult(Bt));a.setLocationAtPoint(a.renderWorldCopies?ot.wrap():ot,B),this._applyUpdatedTransform(a),this._fireMoveEvents(n)},()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){var o;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const a=this._onEaseEnd;delete this._onEaseEnd,a.call(this,n)}return t||(o=this.handlers)===null||o===void 0||o.stop(!1),this}_ease(t,n,o){o.animate===!1||o.duration===0?(t(1),n()):(this._easeStart=le.now(),this._easeOptions=o,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,n){t=c.b3(t,-180,180);const o=Math.abs(t-n);return Math.abs(t-360-n)<o&&(t-=360),Math.abs(t+360-n)<o&&(t+=360),t}_normalizeCenter(t,n){if(!n.renderWorldCopies||n.lngRange)return;const o=t.lng-n.center.lng;t.lng+=o>180?-360:o<-180?360:0}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(c.N.convert(t),this.transform.tileZoom)-this.transform.elevation:null}}const Ea={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Vn{constructor(t=Ea){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.compact,this._container=ae.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=ae.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ae.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(){ae.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 o=this._map._getUIString(`AttributionControl.${n}`);t.title=o,t.setAttribute("aria-label",o)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(a=>typeof a!="string"?"":a)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const a=this._map.style.stylesheet;this.styleOwner=a.owner,this.styleId=a.id}const n=this._map.style.sourceCaches;for(const a in n){const h=n[a];if(h.used||h.usedForTerrain){const m=h.getSource();m.attribution&&t.indexOf(m.attribution)<0&&t.push(m.attribution)}}t=t.filter(a=>String(a).trim()),t.sort((a,h)=>a.length-h.length),t=t.filter((a,h)=>{for(let m=h+1;m<t.length;m++)if(t[m].indexOf(a)>=0)return!1;return!0});const o=t.join(" | ");o!==this._attribHTML&&(this._attribHTML=o,t.length?(this._innerContainer.innerHTML=o,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class vr{constructor(t={}){this._updateCompact=()=>{const n=this._container.children;if(n.length){const o=n[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&o.classList.add("maplibregl-compact"):o.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=ae.create("div","maplibregl-ctrl");const n=ae.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(){ae.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Oe{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,o=n?this._queue.concat(n):this._queue;for(const a of o)if(a.id===t)return void(a.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 o of n)if(!o.cancelled&&(o.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Ol=c.Y([{name:"a_pos3d",type:"Int16",components:3}]);class Ca extends c.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 o={};for(const a of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))o[a.key]=!0,this._renderableTilesKeys.push(a.key),this._tiles[a.key]||(a.posMatrix=new Float64Array(16),c.aQ(a.posMatrix,0,c.X,0,c.X,0,1),this._tiles[a.key]=new $r(a,this.tileSize));for(const a in this._tiles)o[a]||delete this._tiles[a]}freeRtt(t){for(const n in this._tiles){const o=this._tiles[n];(!t||o.tileID.equals(t)||o.tileID.isChildOf(t)||t.isChildOf(o.tileID))&&(o.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const n={};for(const o of this._renderableTilesKeys){const a=this._tiles[o].tileID;if(a.canonical.equals(t.canonical)){const h=t.clone();h.posMatrix=new Float64Array(16),c.aQ(h.posMatrix,0,c.X,0,c.X,0,1),n[o]=h}else if(a.canonical.isChildOf(t.canonical)){const h=t.clone();h.posMatrix=new Float64Array(16);const m=a.canonical.z-t.canonical.z,_=a.canonical.x-(a.canonical.x>>m<<m),v=a.canonical.y-(a.canonical.y>>m<<m),b=c.X>>m;c.aQ(h.posMatrix,0,b,0,b,0,1),c.J(h.posMatrix,h.posMatrix,[-_*b,-v*b,0]),n[o]=h}else if(t.canonical.isChildOf(a.canonical)){const h=t.clone();h.posMatrix=new Float64Array(16);const m=t.canonical.z-a.canonical.z,_=t.canonical.x-(t.canonical.x>>m<<m),v=t.canonical.y-(t.canonical.y>>m<<m),b=c.X>>m;c.aQ(h.posMatrix,0,c.X,0,c.X,0,1),c.J(h.posMatrix,h.posMatrix,[_*b,v*b,0]),c.K(h.posMatrix,h.posMatrix,[1/2**m,1/2**m,0]),n[o]=h}}return n}getSourceTile(t,n){const o=this.sourceCache._source;let a=t.overscaledZ-this.deltaZoom;if(a>o.maxzoom&&(a=o.maxzoom),a<o.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(a).key);let h=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!h||!h.dem)&&n)for(;a>=o.minzoom&&(!h||!h.dem);)h=this.sourceCache.getTileByID(t.scaledTo(a--).key);return h}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(n=>n.timeAdded>=t)}}class Vl{constructor(t,n,o){this.painter=t,this.sourceCache=new Ca(n),this.options=o,this.exaggeration=typeof o.exaggeration=="number"?o.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,n,o,a=c.X){var h;if(!(n>=0&&n<a&&o>=0&&o<a))return 0;const m=this.getTerrainData(t),_=(h=m.tile)===null||h===void 0?void 0:h.dem;if(!_)return 0;const v=function(V,Z,U){var H=Z[0],K=Z[1];return V[0]=U[0]*H+U[4]*K+U[12],V[1]=U[1]*H+U[5]*K+U[13],V}([],[n/a*c.X,o/a*c.X],m.u_terrain_matrix),b=[v[0]*_.dim,v[1]*_.dim],P=Math.floor(b[0]),E=Math.floor(b[1]),L=b[0]-P,B=b[1]-E;return _.get(P,E)*(1-L)*(1-B)+_.get(P+1,E)*L*(1-B)+_.get(P,E+1)*(1-L)*B+_.get(P+1,E+1)*L*B}getElevationForLngLatZoom(t,n){const{tileID:o,mercatorX:a,mercatorY:h}=this._getOverscaledTileIDFromLngLatZoom(t,n);return this.getElevation(o,a%c.X,h%c.X,c.X)}getElevation(t,n,o,a=c.X){return this.getDEMElevation(t,n,o,a)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const a=this.painter.context,h=new c.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new wt(a,h,a.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new wt(a,new c.R({width:1,height:1}),a.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(a.gl.NEAREST,a.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=c.ao([])}const n=this.sourceCache.getSourceTile(t,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const a=this.painter.context;n.demTexture=this.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new wt(a,n.dem.getPixels(),a.gl.RGBA,{premultiply:!1}),n.demTexture.bind(a.gl.NEAREST,a.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const o=n&&n+n.tileID.key+t.key;if(o&&!this._demMatrixCache[o]){const a=this.sourceCache.sourceCache._source.maxzoom;let h=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=a?h=t.canonical.z-a:c.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const m=t.canonical.x-(t.canonical.x>>h<<h),_=t.canonical.y-(t.canonical.y>>h<<h),v=c.bb(new Float64Array(16),[1/(c.X<<h),1/(c.X<<h),0]);c.J(v,v,[m*c.X,_*c.X,0]),this._demMatrixCache[t.key]={matrix:v,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:o?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,o=n.width/devicePixelRatio,a=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===o&&this._fbo.height===a||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new wt(n.context,{width:o,height:a,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 wt(n.context,{width:o,height:a,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=n.context.createFramebuffer(o,a,!0,!1),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,o,a))),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 h=0,m=0;h<this._coordsTextureSize;h++)for(let _=0;_<this._coordsTextureSize;_++,m+=4)n[m+0]=255&_,n[m+1]=255&h,n[m+2]=_>>8<<4|h>>8,n[m+3]=0;const o=new c.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),a=new wt(t,o,t.gl.RGBA,{premultiply:!1});return a.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=a,a}pointCoordinate(t){this.painter.maybeDrawDepthAndCoords(!0);const n=new Uint8Array(4),o=this.painter.context,a=o.gl,h=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),m=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),_=Math.round(this.painter.height/devicePixelRatio);o.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),a.readPixels(h,_-m-1,1,1,a.RGBA,a.UNSIGNED_BYTE,n),o.bindFramebuffer.set(null);const v=n[0]+(n[2]>>4<<8),b=n[1]+((15&n[2])<<8),P=this.coordsIndex[255-n[3]],E=P&&this.sourceCache.getTileByID(P);if(!E)return null;const L=this._coordsTextureSize,B=(1<<E.tileID.canonical.z)*L;return new c.Z((E.tileID.canonical.x*L+v)/B+E.tileID.wrap,(E.tileID.canonical.y*L+b)/B,this.getElevation(E.tileID,v,b,L))}depthAtPoint(t){const n=new Uint8Array(4),o=this.painter.context,a=o.gl;return o.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),a.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,a.RGBA,a.UNSIGNED_BYTE,n),o.bindFramebuffer.set(null),(n[0]/16777216+n[1]/65536+n[2]/256+n[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.painter.context,n=new c.bc,o=new c.aY,a=this.meshSize,h=c.X/a,m=a*a;for(let E=0;E<=a;E++)for(let L=0;L<=a;L++)n.emplaceBack(L*h,E*h,0);for(let E=0;E<m;E+=a+1)for(let L=0;L<a;L++)o.emplaceBack(L+E,a+L+E+1,a+L+E+2),o.emplaceBack(L+E,a+L+E+2,L+E+1);const _=n.length,v=_+2*(a+1);for(const E of[0,1])for(let L=0;L<=a;L++)for(const B of[0,1])n.emplaceBack(L*h,E*c.X,B);for(let E=0;E<2*a;E+=2)o.emplaceBack(v+E,v+E+1,v+E+3),o.emplaceBack(v+E,v+E+3,v+E+2),o.emplaceBack(_+E,_+E+3,_+E+1),o.emplaceBack(_+E,_+E+2,_+E+3);const b=n.length,P=b+2*(a+1);for(const E of[0,1])for(let L=0;L<=a;L++)for(const B of[0,1])n.emplaceBack(E*c.X,L*h,B);for(let E=0;E<2*a;E+=2)o.emplaceBack(b+E,b+E+1,b+E+3),o.emplaceBack(b+E,b+E+3,b+E+2),o.emplaceBack(P+E,P+E+3,P+E+1),o.emplaceBack(P+E,P+E+2,P+E+3);return this._mesh=new Ml(t.createVertexBuffer(n,Ol.members),t.createIndexBuffer(o),c.a0.simpleSegment(0,0,n.length,o.length)),this._mesh}getMeshFrameDelta(t){return 2*Math.PI*c.bd/Math.pow(2,t)/5}getMinTileElevationForLngLatZoom(t,n){var o;const{tileID:a}=this._getOverscaledTileIDFromLngLatZoom(t,n);return(o=this.getMinMaxElevation(a).minElevation)!==null&&o!==void 0?o:0}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,o={minElevation:null,maxElevation:null};return n&&n.dem&&(o.minElevation=n.dem.min*this.exaggeration,o.maxElevation=n.dem.max*this.exaggeration),o}_getOverscaledTileIDFromLngLatZoom(t,n){const o=c.Z.fromLngLat(t.wrap()),a=(1<<n)*c.X,h=o.x*a,m=o.y*a,_=Math.floor(h/c.X),v=Math.floor(m/c.X);return{tileID:new c.S(n,0,n,_,v),mercatorX:h,mercatorY:m}}}class Cs{constructor(t,n,o){this._context=t,this._size=n,this._tileSize=o,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),o=new wt(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return o.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),n.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),n.colorAttachment.set(o.texture),{id:t,fbo:n,texture:o,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 br={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Nl{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new Cs(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(o=>!t._layers[o].isHidden(n)),this._coordsDescendingInv={};for(const o in t.sourceCaches){this._coordsDescendingInv[o]={};const a=t.sourceCaches[o].getVisibleCoordinates();for(const h of a){const m=this.terrain.sourceCache.getTerrainCoords(h);for(const _ in m)this._coordsDescendingInv[o][_]||(this._coordsDescendingInv[o][_]=[]),this._coordsDescendingInv[o][_].push(m[_])}}this._coordsDescendingInvStr={};for(const o of t._order){const a=t._layers[o],h=a.source;if(br[a.type]&&!this._coordsDescendingInvStr[h]){this._coordsDescendingInvStr[h]={};for(const m in this._coordsDescendingInv[h])this._coordsDescendingInvStr[h][m]=this._coordsDescendingInv[h][m].map(_=>_.key).sort().join()}}for(const o of this._renderableTiles)for(const a in this._coordsDescendingInvStr){const h=this._coordsDescendingInvStr[a][o.tileID.key];h&&h!==o.rttCoords[a]&&(o.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const n=t.type,o=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(br[n]&&(this._prevType&&br[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!a))return!0;if(br[this._prevType]||br[n]&&a){this._prevType=n;const h=this._stacks.length-1,m=this._stacks[h]||[];for(const _ of this._renderableTiles){if(this.pool.isFull()&&(vs(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(_),_.rtt[h]){const b=this.pool.getObjectForId(_.rtt[h].id);if(b.stamp===_.rtt[h].stamp){this.pool.useObject(b);continue}}const v=this.pool.getOrCreateFreeObject();this.pool.useObject(v),this.pool.stampObject(v),_.rtt[h]={id:v.id,stamp:v.stamp},o.context.bindFramebuffer.set(v.fbo.framebuffer),o.context.clear({color:c.aN.transparent,stencil:0}),o.currentStencilSource=void 0;for(let b=0;b<m.length;b++){const P=o.style._layers[m[b]],E=P.source?this._coordsDescendingInv[P.source][_.tileID.key]:[_.tileID];o.context.viewport.set([0,0,v.fbo.width,v.fbo.height]),o._renderTileClippingMasks(P,E),o.renderLayer(o,o.style.sourceCaches[P.source],P,E),P.source&&(_.rttCoords[P.source]=this._coordsDescendingInvStr[P.source][_.tileID.key])}}return vs(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),br[n]}return!1}}const ze={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},Aa=ve,Yc={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Ea,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,refreshExpiredTiles:!0,scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],zoom:0,bearing:0,pitch:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:c.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0},jl=u=>{u.touchstart=u.dragStart,u.touchmoveWindow=u.dragMove,u.touchend=u.dragEnd},ka={showCompass:!0,showZoom:!0,visualizePitch:!1};class Ul{constructor(t,n,o=!1){this.mousedown=m=>{this.startMouse(c.e({},m,{ctrlKey:!0,preventDefault:()=>m.preventDefault()}),ae.mousePos(this.element,m)),ae.addEventListener(window,"mousemove",this.mousemove),ae.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=m=>{this.moveMouse(m,ae.mousePos(this.element,m))},this.mouseup=m=>{this.mouseRotate.dragEnd(m),this.mousePitch&&this.mousePitch.dragEnd(m),this.offTemp()},this.touchstart=m=>{m.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=ae.touchPos(this.element,m.targetTouches)[0],this.startTouch(m,this._startPos),ae.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),ae.addEventListener(window,"touchend",this.touchend))},this.touchmove=m=>{m.targetTouches.length!==1?this.reset():(this._lastPos=ae.touchPos(this.element,m.targetTouches)[0],this.moveTouch(m,this._lastPos))},this.touchend=m=>{m.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 a=t.dragRotate._mouseRotate.getClickTolerance(),h=t.dragRotate._mousePitch.getClickTolerance();this.element=n,this.mouseRotate=ma({clickTolerance:a,enable:!0}),this.touchRotate=(({enable:m,clickTolerance:_,bearingDegreesPerPixelMoved:v=.8})=>{const b=new mo;return new Rt({clickTolerance:_,move:(P,E)=>({bearingDelta:(E.x-P.x)*v}),moveStateManager:b,enable:m,assignEvents:jl})})({clickTolerance:a,enable:!0}),this.map=t,o&&(this.mousePitch=yn({clickTolerance:h,enable:!0}),this.touchPitch=(({enable:m,clickTolerance:_,pitchDegreesPerPixelMoved:v=-.5})=>{const b=new mo;return new Rt({clickTolerance:_,move:(P,E)=>({pitchDelta:(E.y-P.y)*v}),moveStateManager:b,enable:m,assignEvents:jl})})({clickTolerance:h,enable:!0})),ae.addEventListener(n,"mousedown",this.mousedown),ae.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),ae.addEventListener(n,"touchcancel",this.reset)}startMouse(t,n){this.mouseRotate.dragStart(t,n),this.mousePitch&&this.mousePitch.dragStart(t,n),ae.disableDrag()}startTouch(t,n){this.touchRotate.dragStart(t,n),this.touchPitch&&this.touchPitch.dragStart(t,n),ae.disableDrag()}moveMouse(t,n){const o=this.map,{bearingDelta:a}=this.mouseRotate.dragMove(t,n)||{};if(a&&o.setBearing(o.getBearing()+a),this.mousePitch){const{pitchDelta:h}=this.mousePitch.dragMove(t,n)||{};h&&o.setPitch(o.getPitch()+h)}}moveTouch(t,n){const o=this.map,{bearingDelta:a}=this.touchRotate.dragMove(t,n)||{};if(a&&o.setBearing(o.getBearing()+a),this.touchPitch){const{pitchDelta:h}=this.touchPitch.dragMove(t,n)||{};h&&o.setPitch(o.getPitch()+h)}}off(){const t=this.element;ae.removeEventListener(t,"mousedown",this.mousedown),ae.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),ae.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ae.removeEventListener(window,"touchend",this.touchend),ae.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){ae.enableDrag(),ae.removeEventListener(window,"mousemove",this.mousemove),ae.removeEventListener(window,"mouseup",this.mouseup),ae.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ae.removeEventListener(window,"touchend",this.touchend)}}let Wr;function $l(u,t,n){const o=new c.N(u.lng,u.lat);if(u=new c.N(u.lng,u.lat),t){const a=new c.N(u.lng-360,u.lat),h=new c.N(u.lng+360,u.lat),m=n.locationPoint(u).distSqr(t);n.locationPoint(a).distSqr(t)<m?u=a:n.locationPoint(h).distSqr(t)<m&&(u=h)}for(;Math.abs(u.lng-n.center.lng)>180;){const a=n.locationPoint(u);if(a.x>=0&&a.y>=0&&a.x<=n.width&&a.y<=n.height)break;u.lng>n.center.lng?u.lng-=360:u.lng+=360}return u.lng!==o.lng&&n.locationPoint(u).y>n.height/2-n.getHorizon()?u:o}const Ma={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 Jr(u,t,n){const o=u.classList;for(const a in Ma)o.remove(`maplibregl-${n}-anchor-${a}`);o.add(`maplibregl-${n}-anchor-${t}`)}class zt extends c.E{constructor(t){if(super(),this._onKeyPress=n=>{const o=n.code,a=n.charCode||n.keyCode;o!=="Space"&&o!=="Enter"&&a!==32&&a!==13||this.togglePopup()},this._onMapClick=n=>{const o=n.originalEvent.target,a=this._element;this._popup&&(o===a||a.contains(o))&&this.togglePopup()},this._update=n=>{var o;if(!this._map)return;const a=this._map.loaded()&&!this._map.isMoving();((n==null?void 0:n.type)==="terrain"||(n==null?void 0:n.type)==="render"&&!a)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?$l(this._lngLat,this._flatPos,this._map.transform):(o=this._lngLat)===null||o===void 0?void 0:o.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let h="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?h=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(h=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let m="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?m="rotateX(0deg)":this._pitchAlignment==="map"&&(m=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||n&&n.type!=="moveend"||(this._pos=this._pos.round()),ae.setTransform(this._element,`${Ma[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${m} ${h}`),le.frameAsync(new AbortController).then(()=>{this._updateOpacity(n&&n.type==="moveend")}).catch(()=>{})},this._onMove=n=>{if(!this._isDragging){const o=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=o}this._isDragging&&(this._pos=n.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new c.k("dragstart"))),this.fire(new c.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 c.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._subpixelPositioning=t&&t.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(t==null?void 0:t.opacity,t==null?void 0:t.opacityWhenCovered),t&&t.element)this._element=t.element,this._offset=c.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=ae.create("div");const n=ae.createNS("http://www.w3.org/2000/svg","svg"),o=41,a=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${o}px`),n.setAttributeNS(null,"width",`${a}px`),n.setAttributeNS(null,"viewBox",`0 0 ${a} ${o}`);const h=ae.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"stroke","none"),h.setAttributeNS(null,"stroke-width","1"),h.setAttributeNS(null,"fill","none"),h.setAttributeNS(null,"fill-rule","evenodd");const m=ae.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"fill-rule","nonzero");const _=ae.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const v=[{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 H of v){const K=ae.createNS("http://www.w3.org/2000/svg","ellipse");K.setAttributeNS(null,"opacity","0.04"),K.setAttributeNS(null,"cx","10.5"),K.setAttributeNS(null,"cy","5.80029008"),K.setAttributeNS(null,"rx",H.rx),K.setAttributeNS(null,"ry",H.ry),_.appendChild(K)}const b=ae.createNS("http://www.w3.org/2000/svg","g");b.setAttributeNS(null,"fill",this._color);const P=ae.createNS("http://www.w3.org/2000/svg","path");P.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),b.appendChild(P);const E=ae.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"opacity","0.25"),E.setAttributeNS(null,"fill","#000000");const L=ae.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"),E.appendChild(L);const B=ae.createNS("http://www.w3.org/2000/svg","g");B.setAttributeNS(null,"transform","translate(6.0, 7.0)"),B.setAttributeNS(null,"fill","#FFFFFF");const V=ae.createNS("http://www.w3.org/2000/svg","g");V.setAttributeNS(null,"transform","translate(8.0, 8.0)");const Z=ae.createNS("http://www.w3.org/2000/svg","circle");Z.setAttributeNS(null,"fill","#000000"),Z.setAttributeNS(null,"opacity","0.25"),Z.setAttributeNS(null,"cx","5.5"),Z.setAttributeNS(null,"cy","5.5"),Z.setAttributeNS(null,"r","5.4999962");const U=ae.createNS("http://www.w3.org/2000/svg","circle");U.setAttributeNS(null,"fill","#FFFFFF"),U.setAttributeNS(null,"cx","5.5"),U.setAttributeNS(null,"cy","5.5"),U.setAttributeNS(null,"r","5.4999962"),V.appendChild(Z),V.appendChild(U),m.appendChild(_),m.appendChild(b),m.appendChild(E),m.appendChild(B),m.appendChild(V),n.appendChild(m),n.setAttributeNS(null,"height",o*this._scale+"px"),n.setAttributeNS(null,"width",a*this._scale+"px"),this._element.appendChild(n),this._offset=c.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()}),Jr(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,this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),ae.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=c.N.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const a=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":[a,-1*(38.1-13.5+a)],"bottom-right":[-a,-1*(38.1-13.5+a)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var n,o;if(!(!((n=this._map)===null||n===void 0)&&n.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const a=this._map,h=a.terrain.depthAtPoint(this._pos),m=a.terrain.getElevationForLngLatZoom(this._lngLat,a.transform.tileZoom);if(a.transform.lngLatToCameraDepth(this._lngLat,m)-h<.006)return void(this._element.style.opacity=this._opacity);const _=-this._offset.y/a.transform._pixelPerMeter,v=Math.sin(a.getPitch()*Math.PI/180)*_,b=a.terrain.depthAtPoint(new c.P(this._pos.x,this._pos.y-this._offset.y)),P=a.transform.lngLatToCameraDepth(this._lngLat,m+v)-b>.006;!((o=this._popup)===null||o===void 0)&&o.isOpen()&&P&&this._popup.remove(),this._element.style.opacity=P?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=c.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,n){return t===void 0&&n===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=t),n!==void 0&&(this._opacityWhenCovered=n),this._map&&this._updateOpacity(!0),this}}const go={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Nn=0,jn=!1;const ql={maxWidth:100,unit:"metric"};function za(u,t,n){const o=n&&n.maxWidth||100,a=u._container.clientHeight/2,h=u.unproject([0,a]),m=u.unproject([o,a]),_=h.distanceTo(m);if(n&&n.unit==="imperial"){const v=3.2808*_;v>5280?As(t,o,v/5280,u._getUIString("ScaleControl.Miles")):As(t,o,v,u._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?As(t,o,_/1852,u._getUIString("ScaleControl.NauticalMiles")):_>=1e3?As(t,o,_/1e3,u._getUIString("ScaleControl.Kilometers")):As(t,o,_,u._getUIString("ScaleControl.Meters"))}function As(u,t,n,o){const a=function(h){const m=Math.pow(10,`${Math.floor(h)}`.length-1);let _=h/m;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(v){const b=Math.pow(10,Math.ceil(-Math.log(v)/Math.LN10));return Math.round(v*b)/b}(_),m*_}(n);u.style.width=t*(a/n)+"px",u.innerHTML=`${a} ${o}`}const wr={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},_o=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ze(u){if(u){if(typeof u=="number"){const t=Math.round(Math.abs(u)/Math.SQRT2);return{center:new c.P(0,0),top:new c.P(0,u),"top-left":new c.P(t,t),"top-right":new c.P(-t,t),bottom:new c.P(0,-u),"bottom-left":new c.P(t,-t),"bottom-right":new c.P(-t,-t),left:new c.P(u,0),right:new c.P(-u,0)}}if(u instanceof c.P||Array.isArray(u)){const t=c.P.convert(u);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:c.P.convert(u.center||[0,0]),top:c.P.convert(u.top||[0,0]),"top-left":c.P.convert(u["top-left"]||[0,0]),"top-right":c.P.convert(u["top-right"]||[0,0]),bottom:c.P.convert(u.bottom||[0,0]),"bottom-left":c.P.convert(u["bottom-left"]||[0,0]),"bottom-right":c.P.convert(u["bottom-right"]||[0,0]),left:c.P.convert(u.left||[0,0]),right:c.P.convert(u.right||[0,0])}}return Ze(new c.P(0,0))}const Je=ve;S.AJAXError=c.bg,S.Evented=c.E,S.LngLat=c.N,S.MercatorCoordinate=c.Z,S.Point=c.P,S.addProtocol=c.bh,S.config=c.a,S.removeProtocol=c.bi,S.AttributionControl=Vn,S.BoxZoomHandler=da,S.CanvasSource=Hi,S.CooperativeGesturesHandler=nr,S.DoubleClickZoomHandler=Ta,S.DragPanHandler=Wi,S.DragRotateHandler=rr,S.EdgeInsets=lo,S.FullscreenControl=class extends c.E{constructor(u={}){super(),this._onFullscreenChange=()=>{var t;let n=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((t=n==null?void 0:n.shadowRoot)===null||t===void 0)&&t.fullscreenElement;)n=n.shadowRoot.fullscreenElement;n===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,u&&u.container&&(u.container instanceof HTMLElement?this._container=u.container:c.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(u){return this._map=u,this._container||(this._container=this._map.getContainer()),this._controlContainer=ae.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){ae.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=ae.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);ae.create("span","maplibregl-ctrl-icon",u).setAttribute("aria-hidden","true"),u.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const u=this._getTitle();this._fullscreenButton.setAttribute("aria-label",u),this._fullscreenButton.title=u}_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 c.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new c.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},S.GeoJSONSource=ns,S.GeolocateControl=class extends c.E{constructor(u){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new c.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 c.k("geolocate",t)),this._finish()}},this._updateCamera=t=>{const n=new c.N(t.coords.longitude,t.coords.latitude),o=t.coords.accuracy,a=this._map.getBearing(),h=c.e({bearing:a},this.options.fitBoundsOptions),m=ue.fromLngLat(n,o);this._map.fitBounds(m,h,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const n=new c.N(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&&jn)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.k("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=ae.create("button","maplibregl-ctrl-geolocate",this._container),ae.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=t=>{if(this._map){if(t===!1){c.w("Geolocation support is not available so the GeolocateControl will be disabled.");const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}else{const n=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=ae.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new zt({element:this._dotElement}),this._circleElement=ae.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new zt({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",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 c.k("trackuserlocationend")),this.fire(new c.k("userlocationlostfocus")))})}},this.options=c.e({},go,u)}onAdd(u){return this._map=u,this._container=ae.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return c._(this,arguments,void 0,function*(t=!1){if(Wr!==void 0&&!t)return Wr;if(window.navigator.permissions===void 0)return Wr=!!window.navigator.geolocation,Wr;try{Wr=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Wr=!!window.navigator.geolocation}return Wr})}().then(t=>this._finishSetupUI(t)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),ae.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Nn=0,jn=!1}_isOutOfMapMaxBounds(u){const t=this._map.getMaxBounds(),n=u.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 u=this._map.getBounds(),t=u.getSouthEast(),n=u.getNorthEast(),o=t.distanceTo(n),a=Math.ceil(this._accuracy/(o/this._map._container.clientHeight)*2);this._circleElement.style.width=`${a}px`,this._circleElement.style.height=`${a}px`}trigger(){if(!this._setup)return c.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 c.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Nn--,jn=!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 c.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 c.k("trackuserlocationstart")),this.fire(new c.k("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let u;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Nn++,Nn>1?(u={maximumAge:6e5,timeout:0},jn=!0):(u=this.options.positionOptions,jn=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,u)}}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)}},S.Hash=bs,S.ImageSource=kr,S.KeyboardHandler=ba,S.LngLatBounds=ue,S.LogoControl=vr,S.Map=class extends Kc{constructor(u){c.be.mark(c.bf.create);const t=Object.assign(Object.assign({},Yc),u);if(t.minZoom!=null&&t.maxZoom!=null&&t.minZoom>t.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(t.minPitch!=null&&t.maxPitch!=null&&t.minPitch>t.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(t.minPitch!=null&&t.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(t.maxPitch!=null&&t.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new aa(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies),{bearingSnap:t.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Oe,this._controls=[],this._mapId=c.a4(),this._contextLost=n=>{n.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new c.k("webglcontextlost",{originalEvent:n}))},this._contextRestored=n=>{this._setupPainter(),this.resize(),this._update(),this.fire(new c.k("webglcontextrestored",{originalEvent:n}))},this._onMapScroll=n=>{if(n.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=t.interactive,this._maxTileCacheSize=t.maxTileCacheSize,this._maxTileCacheZoomLevels=t.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=t.preserveDrawingBuffer===!0,this._antialias=t.antialias===!0,this._trackResize=t.trackResize===!0,this._bearingSnap=t.bearingSnap,this._refreshExpiredTiles=t.refreshExpiredTiles===!0,this._fadeDuration=t.fadeDuration,this._crossSourceCollisions=t.crossSourceCollisions===!0,this._collectResourceTiming=t.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},ze),t.locale),this._clickTolerance=t.clickTolerance,this._overridePixelRatio=t.pixelRatio,this._maxCanvasSize=t.maxCanvasSize,this.transformCameraUpdate=t.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=t.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=Ue.addThrottleControl(()=>this.isMoving()),this._requestManager=new bt(t.transformRequest),typeof t.container=="string"){if(this._container=document.getElementById(t.container),!this._container)throw new Error(`Container '${t.container}' not found.`)}else{if(!(t.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=t.container}if(t.maxBounds&&this.setMaxBounds(t.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)).on("moveend",()=>this._update(!1)).on("zoom",()=>this._update(!0)).on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}).once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let n=!1;const o=co(a=>{this._trackResize&&!this._removed&&this.resize(a)._update()},50);this._resizeObserver=new ResizeObserver(a=>{n?o(a):n=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Jc(this,t),this._hash=t.hash&&new bs(typeof t.hash=="string"&&t.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,c.e({},t.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=t.localIdeographFontFamily,this._validateStyle=t.validateStyle,t.style&&this.setStyle(t.style,{localIdeographFontFamily:t.localIdeographFontFamily}),t.attributionControl&&this.addControl(new Vn(typeof t.attributionControl=="boolean"?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new vr,t.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new c.k(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new c.k(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new c.k("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(u,t){if(t===void 0&&(t=u.getDefaultPosition?u.getDefaultPosition():"top-right"),!u||!u.onAdd)return this.fire(new c.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=u.onAdd(this);this._controls.push(u);const o=this._controlPositions[t];return t.indexOf("bottom")!==-1?o.insertBefore(n,o.firstChild):o.appendChild(n),this}removeControl(u){if(!u||!u.onRemove)return this.fire(new c.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(u);return t>-1&&this._controls.splice(t,1),u.onRemove(this),this}hasControl(u){return this._controls.indexOf(u)>-1}calculateCameraOptionsFromTo(u,t,n,o){return o==null&&this.terrain&&(o=this.terrain.getElevationForLngLatZoom(n,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(u,t,n,o)}resize(u){var t;const n=this._containerDimensions(),o=n[0],a=n[1],h=this._getClampedPixelRatio(o,a);if(this._resizeCanvas(o,a,h),this.painter.resize(o,a,h),this.painter.overLimit()){const _=this.painter.context.gl;this._maxCanvasSize=[_.drawingBufferWidth,_.drawingBufferHeight];const v=this._getClampedPixelRatio(o,a);this._resizeCanvas(o,a,v),this.painter.resize(o,a,v)}this.transform.resize(o,a),(t=this._requestedCameraState)===null||t===void 0||t.resize(o,a);const m=!this._moving;return m&&(this.stop(),this.fire(new c.k("movestart",u)).fire(new c.k("move",u))),this.fire(new c.k("resize",u)),m&&this.fire(new c.k("moveend",u)),this}_getClampedPixelRatio(u,t){const{0:n,1:o}=this._maxCanvasSize,a=this.getPixelRatio(),h=u*a,m=t*a;return Math.min(h>n?n/h:1,m>o?o/m:1)*a}getPixelRatio(){var u;return(u=this._overridePixelRatio)!==null&&u!==void 0?u:devicePixelRatio}setPixelRatio(u){this._overridePixelRatio=u,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(u){return this.transform.setMaxBounds(ue.convert(u)),this._update()}setMinZoom(u){if((u=u??-2)>=-2&&u<=this.transform.maxZoom)return this.transform.minZoom=u,this._update(),this.getZoom()<u&&this.setZoom(u),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(u){if((u=u??22)>=this.transform.minZoom)return this.transform.maxZoom=u,this._update(),this.getZoom()>u&&this.setZoom(u),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(u){if((u=u??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(u>=0&&u<=this.transform.maxPitch)return this.transform.minPitch=u,this._update(),this.getPitch()<u&&this.setPitch(u),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(u){if((u=u??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(u>=this.transform.minPitch)return this.transform.maxPitch=u,this._update(),this.getPitch()>u&&this.setPitch(u),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(u){return this.transform.renderWorldCopies=u,this._update()}project(u){return this.transform.locationPoint(c.N.convert(u),this.style&&this.terrain)}unproject(u){return this.transform.pointLocation(c.P.convert(u),this.terrain)}isMoving(){var u;return this._moving||((u=this.handlers)===null||u===void 0?void 0:u.isMoving())}isZooming(){var u;return this._zooming||((u=this.handlers)===null||u===void 0?void 0:u.isZooming())}isRotating(){var u;return this._rotating||((u=this.handlers)===null||u===void 0?void 0:u.isRotating())}_createDelegatedListener(u,t,n){if(u==="mouseenter"||u==="mouseover"){let o=!1;return{layer:t,listener:n,delegates:{mousemove:h=>{const m=this.getLayer(t)?this.queryRenderedFeatures(h.point,{layers:[t]}):[];m.length?o||(o=!0,n.call(this,new Ti(u,this,h.originalEvent,{features:m}))):o=!1},mouseout:()=>{o=!1}}}}if(u==="mouseleave"||u==="mouseout"){let o=!1;return{layer:t,listener:n,delegates:{mousemove:m=>{(this.getLayer(t)?this.queryRenderedFeatures(m.point,{layers:[t]}):[]).length?o=!0:o&&(o=!1,n.call(this,new Ti(u,this,m.originalEvent)))},mouseout:m=>{o&&(o=!1,n.call(this,new Ti(u,this,m.originalEvent)))}}}}{const o=a=>{const h=this.getLayer(t)?this.queryRenderedFeatures(a.point,{layers:[t]}):[];h.length&&(a.features=h,n.call(this,a),delete a.features)};return{layer:t,listener:n,delegates:{[u]:o}}}}on(u,t,n){if(n===void 0)return super.on(u,t);const o=this._createDelegatedListener(u,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[u]=this._delegatedListeners[u]||[],this._delegatedListeners[u].push(o);for(const a in o.delegates)this.on(a,o.delegates[a]);return this}once(u,t,n){if(n===void 0)return super.once(u,t);const o=this._createDelegatedListener(u,t,n);for(const a in o.delegates)this.once(a,o.delegates[a]);return this}off(u,t,n){return n===void 0?super.off(u,t):(this._delegatedListeners&&this._delegatedListeners[u]&&(o=>{const a=this._delegatedListeners[u];for(let h=0;h<a.length;h++){const m=a[h];if(m.layer===t&&m.listener===n){for(const _ in m.delegates)this.off(_,m.delegates[_]);return a.splice(h,1),this}}})(),this)}queryRenderedFeatures(u,t){if(!this.style)return[];let n;const o=u instanceof c.P||Array.isArray(u),a=o?u:[[0,0],[this.transform.width,this.transform.height]];if(t=t||(o?{}:u)||{},a instanceof c.P||typeof a[0]=="number")n=[c.P.convert(a)];else{const h=c.P.convert(a[0]),m=c.P.convert(a[1]);n=[h,new c.P(m.x,h.y),m,new c.P(h.x,m.y),h]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(u,t){return this.style.querySourceFeatures(u,t)}setStyle(u,t){return(t=c.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&u?(this._diffStyle(u,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(u,t))}setTransformRequest(u){return this._requestManager.setTransformRequest(u),this}_getUIString(u){const t=this._locale[u];if(t==null)throw new Error(`Missing UI string '${u}'`);return t}_updateStyle(u,t){if(t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(u,t));const n=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!u)),u?(this.style=new Uo(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof u=="string"?this.style.loadURL(u,t,n):this.style.loadJSON(u,t,n),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Uo(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(u,t){if(typeof u=="string"){const n=this._requestManager.transformRequest(u,"Style");c.h(n,new AbortController).then(o=>{this._updateDiff(o.data,t)}).catch(o=>{o&&this.fire(new c.j(o))})}else typeof u=="object"&&this._updateDiff(u,t)}_updateDiff(u,t){try{this.style.setState(u,t)&&this._update(!0)}catch(n){c.w(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(u,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():c.w("There is no style added to the map.")}addSource(u,t){return this._lazyInitEmptyStyle(),this.style.addSource(u,t),this._update(!0)}isSourceLoaded(u){const t=this.style&&this.style.sourceCaches[u];if(t!==void 0)return t.loaded();this.fire(new c.j(new Error(`There is no source with ID '${u}'`)))}setTerrain(u){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),u){const t=this.style.sourceCaches[u.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${u.source}`);this.terrain===null&&t.reload();for(const n in this.style._layers){const o=this.style._layers[n];o.type==="hillshade"&&o.source===u.source&&c.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 Vl(this.painter,t,u),this.painter.renderToTexture=new Nl(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=n=>{n.dataType==="style"?this.terrain.sourceCache.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId!==u.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(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.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new c.k("terrain",{terrain:u})),this}getTerrain(){var u,t;return(t=(u=this.terrain)===null||u===void 0?void 0:u.options)!==null&&t!==void 0?t:null}areTilesLoaded(){const u=this.style&&this.style.sourceCaches;for(const t in u){const n=u[t]._tiles;for(const o in n){const a=n[o];if(a.state!=="loaded"&&a.state!=="errored")return!1}}return!0}removeSource(u){return this.style.removeSource(u),this._update(!0)}getSource(u){return this.style.getSource(u)}addImage(u,t,n={}){const{pixelRatio:o=1,sdf:a=!1,stretchX:h,stretchY:m,content:_,textFitWidth:v,textFitHeight:b}=n;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||c.b(t))){if(t.width===void 0||t.height===void 0)return this.fire(new c.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:P,height:E,data:L}=t,B=t;return this.style.addImage(u,{data:new c.R({width:P,height:E},new Uint8Array(L)),pixelRatio:o,stretchX:h,stretchY:m,content:_,textFitWidth:v,textFitHeight:b,sdf:a,version:0,userImage:B}),B.onAdd&&B.onAdd(this,u),this}}{const{width:P,height:E,data:L}=le.getImageData(t);this.style.addImage(u,{data:new c.R({width:P,height:E},L),pixelRatio:o,stretchX:h,stretchY:m,content:_,textFitWidth:v,textFitHeight:b,sdf:a,version:0})}}updateImage(u,t){const n=this.style.getImage(u);if(!n)return this.fire(new c.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const o=t instanceof HTMLImageElement||c.b(t)?le.getImageData(t):t,{width:a,height:h,data:m}=o;if(a===void 0||h===void 0)return this.fire(new c.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(a!==n.data.width||h!==n.data.height)return this.fire(new c.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||c.b(t));return n.data.replace(m,_),this.style.updateImage(u,n),this}getImage(u){return this.style.getImage(u)}hasImage(u){return u?!!this.style.getImage(u):(this.fire(new c.j(new Error("Missing required image id"))),!1)}removeImage(u){this.style.removeImage(u)}loadImage(u){return Ue.getImage(this._requestManager.transformRequest(u,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(u,t){return this._lazyInitEmptyStyle(),this.style.addLayer(u,t),this._update(!0)}moveLayer(u,t){return this.style.moveLayer(u,t),this._update(!0)}removeLayer(u){return this.style.removeLayer(u),this._update(!0)}getLayer(u){return this.style.getLayer(u)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(u,t,n){return this.style.setLayerZoomRange(u,t,n),this._update(!0)}setFilter(u,t,n={}){return this.style.setFilter(u,t,n),this._update(!0)}getFilter(u){return this.style.getFilter(u)}setPaintProperty(u,t,n,o={}){return this.style.setPaintProperty(u,t,n,o),this._update(!0)}getPaintProperty(u,t){return this.style.getPaintProperty(u,t)}setLayoutProperty(u,t,n,o={}){return this.style.setLayoutProperty(u,t,n,o),this._update(!0)}getLayoutProperty(u,t){return this.style.getLayoutProperty(u,t)}setGlyphs(u,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(u,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(u,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(u,t,n,o=>{o||this._update(!0)}),this}removeSprite(u){return this._lazyInitEmptyStyle(),this.style.removeSprite(u),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(u,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(u,t,n=>{n||this._update(!0)}),this}setLight(u,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(u,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(u){return this._lazyInitEmptyStyle(),this.style.setSky(u),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(u,t){return this.style.setFeatureState(u,t),this._update()}removeFeatureState(u,t){return this.style.removeFeatureState(u,t),this._update()}getFeatureState(u){return this.style.getFeatureState(u)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let u=0,t=0;return this._container&&(u=this._container.clientWidth||400,t=this._container.clientHeight||300),[u,t]}_setupContainer(){const u=this._container;u.classList.add("maplibregl-map");const t=this._canvasContainer=ae.create("div","maplibregl-canvas-container",u);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=ae.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const n=this._containerDimensions(),o=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],o);const a=this._controlContainer=ae.create("div","maplibregl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(m=>{h[m]=ae.create("div",`maplibregl-ctrl-${m} `,a)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(u,t,n){this._canvas.width=Math.floor(n*u),this._canvas.height=Math.floor(n*t),this._canvas.style.width=`${u}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const u={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let t=null;this._canvas.addEventListener("webglcontextcreationerror",o=>{t={requestedAttributes:u},o&&(t.statusMessage=o.statusMessage,t.type=o.type)},{once:!0});const n=this._canvas.getContext("webgl2",u)||this._canvas.getContext("webgl",u);if(!n){const o="Failed to initialize WebGL";throw t?(t.message=o,new Error(JSON.stringify(t))):new Error(o)}this.painter=new zl(n,this.transform),ut.testSupport(n)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(u){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||u,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(u){return this._update(),this._renderTaskQueue.add(u)}_cancelRenderFrame(u){this._renderTaskQueue.remove(u)}_render(u){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(u),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const a=this.transform.zoom,h=le.now();this.style.zoomHistory.update(a,h);const m=new c.a9(a,{now:h,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),_=m.crossFadingFactor();_===1&&_===this._crossFadingFactor||(n=!0,this._crossFadingFactor=_),this.style.update(m)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,t,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding}),this.fire(new c.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.be.mark(c.bf.load),this.fire(new c.k("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const o=this._sourcesDirty||this._styleDirty||this._placementDirty;return o||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new c.k("idle")),!this._loaded||this._fullyLoaded||o||(this._fullyLoaded=!0,c.be.mark(c.bf.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var u;this._hash&&this._hash.remove();for(const n of this._controls)n.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),Ue.removeThrottleControl(this._imageQueueHandle),(u=this._resizeObserver)===null||u===void 0||u.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t!=null&&t.loseContext&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),ae.remove(this._canvasContainer),ae.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),c.be.clearMetrics(),this._removed=!0,this.fire(new c.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,le.frameAsync(this._frameRequest).then(u=>{c.be.frame(u),this._frameRequest=null,this._render(u)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(u){this._showTileBoundaries!==u&&(this._showTileBoundaries=u,this._update())}get showPadding(){return!!this._showPadding}set showPadding(u){this._showPadding!==u&&(this._showPadding=u,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(u){this._showCollisionBoxes!==u&&(this._showCollisionBoxes=u,u?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(u){this._showOverdrawInspector!==u&&(this._showOverdrawInspector=u,this._update())}get repaint(){return!!this._repaint}set repaint(u){this._repaint!==u&&(this._repaint=u,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(u){this._vertices=u,this._update()}get version(){return Aa}getCameraTargetElevation(){return this.transform.elevation}},S.MapMouseEvent=Ti,S.MapTouchEvent=ws,S.MapWheelEvent=ha,S.Marker=zt,S.NavigationControl=class{constructor(u){this._updateZoomButtons=()=>{const t=this._map.getZoom(),n=t===this._map.getMaxZoom(),o=t===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=o,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",o.toString())},this._rotateCompassArrow=()=>{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 o=this._map._getUIString(`NavigationControl.${n}`);t.title=o,t.setAttribute("aria-label",o)},this.options=c.e({},ka,u),this._container=ae.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})),ae.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})),ae.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=ae.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(u){return this._map=u,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 Ul(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){ae.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(u,t){const n=ae.create("button",u,this._container);return n.type="button",n.addEventListener("click",t),n}},S.Popup=class extends c.E{constructor(u){super(),this.remove=()=>(this._content&&ae.remove(this._content),this._container&&(ae.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new c.k("close"))),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{var n;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=ae.create("div","maplibregl-popup",this._map.getContainer()),this._tip=ae.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const _ of this.options.className.split(" "))this._container.classList.add(_);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?$l(this._lngLat,this._flatPos,this._map.transform):(n=this._lngLat)===null||n===void 0?void 0:n.wrap(),this._trackPointer&&!t)return;const o=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationPoint(this._lngLat));let a=this.options.anchor;const h=Ze(this.options.offset);if(!a){const _=this._container.offsetWidth,v=this._container.offsetHeight;let b;b=o.y+h.bottom.y<v?["top"]:o.y>this._map.transform.height-v?["bottom"]:[],o.x<_/2?b.push("left"):o.x>this._map.transform.width-_/2&&b.push("right"),a=b.length===0?"bottom":b.join("-")}let m=o.add(h[a]);this.options.subpixelPositioning||(m=m.round()),ae.setTransform(this._container,`${Ma[a]} translate(${m.x}px,${m.y}px)`),Jr(this._container,a,"popup")},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(wr),u)}addTo(u){return this._map&&this.remove(),this._map=u,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 c.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(u){return this._lngLat=c.N.convert(u),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(u){return this.setDOMContent(document.createTextNode(u))}setHTML(u){const t=document.createDocumentFragment(),n=document.createElement("body");let o;for(n.innerHTML=u;o=n.firstChild,o;)t.appendChild(o);return this.setDOMContent(t)}getMaxWidth(){var u;return(u=this._container)===null||u===void 0?void 0:u.style.maxWidth}setMaxWidth(u){return this.options.maxWidth=u,this._update(),this}setDOMContent(u){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=ae.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(u),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(u){return this._container&&this._container.classList.add(u),this}removeClassName(u){return this._container&&this._container.classList.remove(u),this}setOffset(u){return this.options.offset=u,this._update(),this}toggleClassName(u){if(this._container)return this._container.classList.toggle(u)}setSubpixelPositioning(u){this.options.subpixelPositioning=u}_createCloseButton(){this.options.closeButton&&(this._closeButton=ae.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const u=this._container.querySelector(_o);u&&u.focus()}},S.RasterDEMTileSource=$t,S.RasterTileSource=xt,S.ScaleControl=class{constructor(u){this._onMove=()=>{za(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,za(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},ql),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=ae.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){ae.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},S.ScrollZoomHandler=Sa,S.Style=Uo,S.TerrainControl=class{constructor(u){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=u}onAdd(u){return this._map=u,this._container=ae.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=ae.create("button","maplibregl-ctrl-terrain",this._container),ae.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(){ae.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},S.TwoFingersTouchPitchHandler=va,S.TwoFingersTouchRotateHandler=xa,S.TwoFingersTouchZoomHandler=_a,S.TwoFingersTouchZoomRotateHandler=Ia,S.VectorTileSource=rs,S.VideoSource=kn,S.addSourceType=(u,t)=>c._(void 0,void 0,void 0,function*(){if(os(u))throw new Error(`A source type called "${u}" already exists.`);((n,o)=>{ss[n]=o})(u,t)}),S.clearPrewarmedResources=function(){const u=Fi;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(Vr),Fi=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()"))},S.getMaxParallelImageRequests=function(){return c.a.MAX_PARALLEL_IMAGE_REQUESTS},S.getRTLTextPluginStatus=function(){return gr().getRTLTextPluginStatus()},S.getVersion=function(){return Je},S.getWorkerCount=function(){return fr.workerCount},S.getWorkerUrl=function(){return c.a.WORKER_URL},S.importScriptInWorkers=function(u){return is().broadcast("IS",u)},S.prewarm=function(){on().acquire(Vr)},S.setMaxParallelImageRequests=function(u){c.a.MAX_PARALLEL_IMAGE_REQUESTS=u},S.setRTLTextPlugin=function(u,t){return gr().setRTLTextPlugin(u,t)},S.setWorkerCount=function(u){fr.workerCount=u},S.setWorkerUrl=function(u){c.a.WORKER_URL=u}});var J=M;return J})})(jh);var xp=jh.exports;const mc=yp(xp);function vp(y){return[{type:"fill",paint:{"fill-color":y.color||"#ccc","fill-outline-color":y.color||"blue","fill-opacity":y.opacity||1}}]}function bp(y){return[{type:"line",paint:{"line-color":y.color||"#ccc","line-opacity":y.opacity||1}}]}function wp(y){return[{type:"circle",paint:{"circle-radius":y.radius||6,"circle-stroke-color":y.stroke||"#ccc","circle-stroke-width":y.width||1,"circle-color":y.color||"blue"}}]}function Uh(y){if(!y)return null;const T=y.type||"point";return T==="polygon"?vp(y):T==="line"?bp(y):wp(y)}const gc={data(){return{layerList:[],activeLayer:""}},computed:{interactiveSources(){return this.layerList.filter(y=>y==null?void 0:y.interactive).map(y=>y.id)}},methods:{moveLayer(y,T=this.map){T.getStyle().layers.forEach(M=>{M.id.match(y)&&T.moveLayer(M.id)})},async setVisible(y,T=!0,M=this.map){if(!y)return;const D=(y==null?void 0:y.id)||y,N=this.layerList.find(S=>S.id===y)||y;if(!(N!=null&&N.id))throw new Error("MixinError: Layer has no id");const J=M.getStyle().layers.filter(S=>S.id.match(D));J.forEach(S=>{M.setLayoutProperty(S.id,"visibility",T?"visible":"none")}),!J.length&&T&&await this.addLayer(N)},async addLayer(y,T={},M=this==null?void 0:this.map){var J,S;const D=this.layerList.find(c=>c.id===y)||y;this.map.getStyle().layers.find(c=>c.id===D.id)||(this.layerList.find(c=>c.id===D.id)||this.layerList.push(D),(D.service==="vtile"||D.service==="vector"||(J=D.url)!=null&&J.includes(".vmt"))&&this.addVtileLayer(D,M),D.service==="geojson"&&this.addGeoJsonLayer(D,M),((S=D.url)!=null&&S.includes(".png")||["tms","raster"].includes(D.service))&&await this.addRasterLayer(D,T,M))},async addRasterLayer(y,T,M=this==null?void 0:this.map){await M.addSource(y.id,{type:"raster",tiles:[y==null?void 0:y.url],tileSize:256,...y!=null&&y.scheme?{scheme:y==null?void 0:y.scheme}:{}});const D=T.order===0?this.getOrder(T.order):null;await M.addLayer({id:y.id,type:"raster",source:y.id,minzoom:0,maxzoom:(y==null?void 0:y.maxzoom)||22},D)},async addVtileLayer(y,T=this==null?void 0:this.map){var J;const M=["props","pointZoom"].filter(S=>y[S]).map(S=>`&${S}=${y[S]}`),D={type:"vector",tiles:[`${(J=y==null?void 0:y.url)!=null&&J.startsWith("http")?"":window.location.origin}${y==null?void 0:y.url}${M}`],minzoom:y.minzoom||5,maxzoom:y.maxzoom||24};T.addSource(y.id,D),(Uh(y.style)||y.layers||[]).forEach((S,c)=>{const ve={...S,id:`${y.id}-${c}`,source:y.id,"source-layer":S["source-layer"]||y.source||y.id,maxzoom:+S.maxzoom||24,minzoom:+S.minzoom||0};T.addLayer(ve)})},async addGeoJsonLayer(y,T=this.map){var N;const M=y.data||((N=y==null?void 0:y.url)!=null&&N.startsWith("http")?"":window.location.origin)+y.url;T.addSource(y.id,{type:"geojson",data:M}),(Uh(y.style)||y.layers||[]).forEach(J=>{const S={...J,source:y.id,id:J.id||y.id,maxzoom:+J.maxzoom||24,minzoom:+J.minzoom||0,type:J.type||"circle"};T.addLayer(S)})},setLayerData(y,T){this.layerList=this.layerList.map(M=>M.id===y?{...M,...T}:M)},async removeLayer(y,T=this.map){await T.getStyle().layers.forEach(async M=>{M.source===y&&await T.removeLayer(M.id)}),T.getSource(y)&&await T.removeSource(y)},async setFilter(y,T){const M=this.layerList.find(N=>N.id===y);await(await this.map.getSource(y)).setTiles([`${window.location.origin}${M.url}${M.url.includes("?")?"&":"?"}filter=${T}${M.props?`&props=${M.props}`:""}`])},getOrder(y){var T;return((T=this.map.getStyle().layers[y])==null?void 0:T.id)||null},async changeBaseLayer(y){y!==this.activeLayer&&(this.activeLayer&&this.map.setLayoutProperty(this.activeLayer,"visibility","none"),await this.addLayer(y,{order:0}),this.map.setLayoutProperty(y,"visibility","visible"),this.activeLayer=y)},async refreshLayer(y,T=this.map){await T.getStyle().layers.forEach(M=>{M.source===y&&T.removeLayer(M.id)}),await T.removeSource(y),this.setVisible(y)}}},nn=(y,T)=>{const M=y.__vccOpts||y;for(const[D,N]of T)M[D]=N;return M},Sp={},Tp={class:"w-48 mx-auto mb-4",width:"178",height:"90",viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Ip=[oe.createStaticVNode('<rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-stone-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-stone-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-stone-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-stone-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-stone-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-stone-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-stone-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-stone-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter2)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-stone-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-stone-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-stone-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-stone-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter2" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs>',12)];function Pp(y,T){return oe.openBlock(),oe.createElementBlock("svg",Tp,Ip)}const Ep=nn(Sp,[["render",Pp]]);function $h(y,T){return function(){return y.apply(T,arguments)}}const{toString:Cp}=Object.prototype,{getPrototypeOf:_c}=Object,tl=(y=>T=>{const M=Cp.call(T);return y[M]||(y[M]=M.slice(8,-1).toLowerCase())})(Object.create(null)),Ir=y=>(y=y.toLowerCase(),T=>tl(T)===y),il=y=>T=>typeof T===y,{isArray:Fs}=Array,Bo=il("undefined");function Ap(y){return y!==null&&!Bo(y)&&y.constructor!==null&&!Bo(y.constructor)&&Ki(y.constructor.isBuffer)&&y.constructor.isBuffer(y)}const qh=Ir("ArrayBuffer");function kp(y){let T;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?T=ArrayBuffer.isView(y):T=y&&y.buffer&&qh(y.buffer),T}const Mp=il("string"),Ki=il("function"),Zh=il("number"),rl=y=>y!==null&&typeof y=="object",zp=y=>y===!0||y===!1,nl=y=>{if(tl(y)!=="object")return!1;const T=_c(y);return(T===null||T===Object.prototype||Object.getPrototypeOf(T)===null)&&!(Symbol.toStringTag in y)&&!(Symbol.iterator in y)},Dp=Ir("Date"),Lp=Ir("File"),Rp=Ir("Blob"),Bp=Ir("FileList"),Fp=y=>rl(y)&&Ki(y.pipe),Op=y=>{let T;return y&&(typeof FormData=="function"&&y instanceof FormData||Ki(y.append)&&((T=tl(y))==="formdata"||T==="object"&&Ki(y.toString)&&y.toString()==="[object FormData]"))},Vp=Ir("URLSearchParams"),[Np,jp,Up,$p]=["ReadableStream","Request","Response","Headers"].map(Ir),qp=y=>y.trim?y.trim():y.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Fo(y,T,{allOwnKeys:M=!1}={}){if(y===null||typeof y>"u")return;let D,N;if(typeof y!="object"&&(y=[y]),Fs(y))for(D=0,N=y.length;D<N;D++)T.call(null,y[D],D,y);else{const J=M?Object.getOwnPropertyNames(y):Object.keys(y),S=J.length;let c;for(D=0;D<S;D++)c=J[D],T.call(null,y[c],c,y)}}function Gh(y,T){T=T.toLowerCase();const M=Object.keys(y);let D=M.length,N;for(;D-- >0;)if(N=M[D],T===N.toLowerCase())return N;return null}const Qn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Hh=y=>!Bo(y)&&y!==Qn;function yc(){const{caseless:y}=Hh(this)&&this||{},T={},M=(D,N)=>{const J=y&&Gh(T,N)||N;nl(T[J])&&nl(D)?T[J]=yc(T[J],D):nl(D)?T[J]=yc({},D):Fs(D)?T[J]=D.slice():T[J]=D};for(let D=0,N=arguments.length;D<N;D++)arguments[D]&&Fo(arguments[D],M);return T}const Zp=(y,T,M,{allOwnKeys:D}={})=>(Fo(T,(N,J)=>{M&&Ki(N)?y[J]=$h(N,M):y[J]=N},{allOwnKeys:D}),y),Gp=y=>(y.charCodeAt(0)===65279&&(y=y.slice(1)),y),Hp=(y,T,M,D)=>{y.prototype=Object.create(T.prototype,D),y.prototype.constructor=y,Object.defineProperty(y,"super",{value:T.prototype}),M&&Object.assign(y.prototype,M)},Xp=(y,T,M,D)=>{let N,J,S;const c={};if(T=T||{},y==null)return T;do{for(N=Object.getOwnPropertyNames(y),J=N.length;J-- >0;)S=N[J],(!D||D(S,y,T))&&!c[S]&&(T[S]=y[S],c[S]=!0);y=M!==!1&&_c(y)}while(y&&(!M||M(y,T))&&y!==Object.prototype);return T},Wp=(y,T,M)=>{y=String(y),(M===void 0||M>y.length)&&(M=y.length),M-=T.length;const D=y.indexOf(T,M);return D!==-1&&D===M},Jp=y=>{if(!y)return null;if(Fs(y))return y;let T=y.length;if(!Zh(T))return null;const M=new Array(T);for(;T-- >0;)M[T]=y[T];return M},Kp=(y=>T=>y&&T instanceof y)(typeof Uint8Array<"u"&&_c(Uint8Array)),Yp=(y,T)=>{const D=(y&&y[Symbol.iterator]).call(y);let N;for(;(N=D.next())&&!N.done;){const J=N.value;T.call(y,J[0],J[1])}},Qp=(y,T)=>{let M;const D=[];for(;(M=y.exec(T))!==null;)D.push(M);return D},ef=Ir("HTMLFormElement"),tf=y=>y.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(M,D,N){return D.toUpperCase()+N}),Xh=(({hasOwnProperty:y})=>(T,M)=>y.call(T,M))(Object.prototype),rf=Ir("RegExp"),Wh=(y,T)=>{const M=Object.getOwnPropertyDescriptors(y),D={};Fo(M,(N,J)=>{let S;(S=T(N,J,y))!==!1&&(D[J]=S||N)}),Object.defineProperties(y,D)},nf=y=>{Wh(y,(T,M)=>{if(Ki(y)&&["arguments","caller","callee"].indexOf(M)!==-1)return!1;const D=y[M];if(Ki(D)){if(T.enumerable=!1,"writable"in T){T.writable=!1;return}T.set||(T.set=()=>{throw Error("Can not rewrite read-only method '"+M+"'")})}})},sf=(y,T)=>{const M={},D=N=>{N.forEach(J=>{M[J]=!0})};return Fs(y)?D(y):D(String(y).split(T)),M},of=()=>{},af=(y,T)=>y!=null&&Number.isFinite(y=+y)?y:T,xc="abcdefghijklmnopqrstuvwxyz",Jh="0123456789",Kh={DIGIT:Jh,ALPHA:xc,ALPHA_DIGIT:xc+xc.toUpperCase()+Jh},lf=(y=16,T=Kh.ALPHA_DIGIT)=>{let M="";const{length:D}=T;for(;y--;)M+=T[Math.random()*D|0];return M};function cf(y){return!!(y&&Ki(y.append)&&y[Symbol.toStringTag]==="FormData"&&y[Symbol.iterator])}const hf=y=>{const T=new Array(10),M=(D,N)=>{if(rl(D)){if(T.indexOf(D)>=0)return;if(!("toJSON"in D)){T[N]=D;const J=Fs(D)?[]:{};return Fo(D,(S,c)=>{const ve=M(S,N+1);!Bo(ve)&&(J[c]=ve)}),T[N]=void 0,J}}return D};return M(y,0)},uf=Ir("AsyncFunction"),df=y=>y&&(rl(y)||Ki(y))&&Ki(y.then)&&Ki(y.catch),Yh=((y,T)=>y?setImmediate:T?((M,D)=>(Qn.addEventListener("message",({source:N,data:J})=>{N===Qn&&J===M&&D.length&&D.shift()()},!1),N=>{D.push(N),Qn.postMessage(M,"*")}))(`axios@${Math.random()}`,[]):M=>setTimeout(M))(typeof setImmediate=="function",Ki(Qn.postMessage)),pf=typeof queueMicrotask<"u"?queueMicrotask.bind(Qn):typeof process<"u"&&process.nextTick||Yh,fe={isArray:Fs,isArrayBuffer:qh,isBuffer:Ap,isFormData:Op,isArrayBufferView:kp,isString:Mp,isNumber:Zh,isBoolean:zp,isObject:rl,isPlainObject:nl,isReadableStream:Np,isRequest:jp,isResponse:Up,isHeaders:$p,isUndefined:Bo,isDate:Dp,isFile:Lp,isBlob:Rp,isRegExp:rf,isFunction:Ki,isStream:Fp,isURLSearchParams:Vp,isTypedArray:Kp,isFileList:Bp,forEach:Fo,merge:yc,extend:Zp,trim:qp,stripBOM:Gp,inherits:Hp,toFlatObject:Xp,kindOf:tl,kindOfTest:Ir,endsWith:Wp,toArray:Jp,forEachEntry:Yp,matchAll:Qp,isHTMLForm:ef,hasOwnProperty:Xh,hasOwnProp:Xh,reduceDescriptors:Wh,freezeMethods:nf,toObjectSet:sf,toCamelCase:tf,noop:of,toFiniteNumber:af,findKey:Gh,global:Qn,isContextDefined:Hh,ALPHABET:Kh,generateString:lf,isSpecCompliantForm:cf,toJSONObject:hf,isAsyncFn:uf,isThenable:df,setImmediate:Yh,asap:pf};function ct(y,T,M,D,N){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=y,this.name="AxiosError",T&&(this.code=T),M&&(this.config=M),D&&(this.request=D),N&&(this.response=N)}fe.inherits(ct,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:fe.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Qh=ct.prototype,eu={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(y=>{eu[y]={value:y}}),Object.defineProperties(ct,eu),Object.defineProperty(Qh,"isAxiosError",{value:!0}),ct.from=(y,T,M,D,N,J)=>{const S=Object.create(Qh);return fe.toFlatObject(y,S,function(ve){return ve!==Error.prototype},c=>c!=="isAxiosError"),ct.call(S,y.message,T,M,D,N),S.cause=y,S.name=y.name,J&&Object.assign(S,J),S};const ff=null;function vc(y){return fe.isPlainObject(y)||fe.isArray(y)}function tu(y){return fe.endsWith(y,"[]")?y.slice(0,-2):y}function iu(y,T,M){return y?y.concat(T).map(function(N,J){return N=tu(N),!M&&J?"["+N+"]":N}).join(M?".":""):T}function mf(y){return fe.isArray(y)&&!y.some(vc)}const gf=fe.toFlatObject(fe,{},null,function(T){return/^is[A-Z]/.test(T)});function sl(y,T,M){if(!fe.isObject(y))throw new TypeError("target must be an object");T=T||new FormData,M=fe.toFlatObject(M,{metaTokens:!0,dots:!1,indexes:!1},!1,function(Ke,Fe){return!fe.isUndefined(Fe[Ke])});const D=M.metaTokens,N=M.visitor||be,J=M.dots,S=M.indexes,ve=(M.Blob||typeof Blob<"u"&&Blob)&&fe.isSpecCompliantForm(T);if(!fe.isFunction(N))throw new TypeError("visitor must be a function");function ye(je){if(je===null)return"";if(fe.isDate(je))return je.toISOString();if(!ve&&fe.isBlob(je))throw new ct("Blob is not supported. Use a Buffer instead.");return fe.isArrayBuffer(je)||fe.isTypedArray(je)?ve&&typeof Blob=="function"?new Blob([je]):Buffer.from(je):je}function be(je,Ke,Fe){let ht=je;if(je&&!Fe&&typeof je=="object"){if(fe.endsWith(Ke,"{}"))Ke=D?Ke:Ke.slice(0,-2),je=JSON.stringify(je);else if(fe.isArray(je)&&mf(je)||(fe.isFileList(je)||fe.endsWith(Ke,"[]"))&&(ht=fe.toArray(je)))return Ke=tu(Ke),ht.forEach(function(Ue,bt){!(fe.isUndefined(Ue)||Ue===null)&&T.append(S===!0?iu([Ke],bt,J):S===null?Ke:Ke+"[]",ye(Ue))}),!1}return vc(je)?!0:(T.append(iu(Fe,Ke,J),ye(je)),!1)}const le=[],ae=Object.assign(gf,{defaultVisitor:be,convertValue:ye,isVisitable:vc});function ut(je,Ke){if(!fe.isUndefined(je)){if(le.indexOf(je)!==-1)throw Error("Circular reference detected in "+Ke.join("."));le.push(je),fe.forEach(je,function(ht,Ye){(!(fe.isUndefined(ht)||ht===null)&&N.call(T,ht,fe.isString(Ye)?Ye.trim():Ye,Ke,ae))===!0&&ut(ht,Ke?Ke.concat(Ye):[Ye])}),le.pop()}}if(!fe.isObject(y))throw new TypeError("data must be an object");return ut(y),T}function ru(y){const T={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(y).replace(/[!'()~]|%20|%00/g,function(D){return T[D]})}function bc(y,T){this._pairs=[],y&&sl(y,this,T)}const nu=bc.prototype;nu.append=function(T,M){this._pairs.push([T,M])},nu.toString=function(T){const M=T?function(D){return T.call(this,D,ru)}:ru;return this._pairs.map(function(N){return M(N[0])+"="+M(N[1])},"").join("&")};function _f(y){return encodeURIComponent(y).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function su(y,T,M){if(!T)return y;const D=M&&M.encode||_f,N=M&&M.serialize;let J;if(N?J=N(T,M):J=fe.isURLSearchParams(T)?T.toString():new bc(T,M).toString(D),J){const S=y.indexOf("#");S!==-1&&(y=y.slice(0,S)),y+=(y.indexOf("?")===-1?"?":"&")+J}return y}class ou{constructor(){this.handlers=[]}use(T,M,D){return this.handlers.push({fulfilled:T,rejected:M,synchronous:D?D.synchronous:!1,runWhen:D?D.runWhen:null}),this.handlers.length-1}eject(T){this.handlers[T]&&(this.handlers[T]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(T){fe.forEach(this.handlers,function(D){D!==null&&T(D)})}}const au={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},yf={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:bc,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},wc=typeof window<"u"&&typeof document<"u",xf=(y=>wc&&["ReactNative","NativeScript","NS"].indexOf(y)<0)(typeof navigator<"u"&&navigator.product),vf=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",bf=wc&&window.location.href||"http://localhost",Pr={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:wc,hasStandardBrowserEnv:xf,hasStandardBrowserWebWorkerEnv:vf,origin:bf},Symbol.toStringTag,{value:"Module"})),...yf};function wf(y,T){return sl(y,new Pr.classes.URLSearchParams,Object.assign({visitor:function(M,D,N,J){return Pr.isNode&&fe.isBuffer(M)?(this.append(D,M.toString("base64")),!1):J.defaultVisitor.apply(this,arguments)}},T))}function Sf(y){return fe.matchAll(/\w+|\[(\w*)]/g,y).map(T=>T[0]==="[]"?"":T[1]||T[0])}function Tf(y){const T={},M=Object.keys(y);let D;const N=M.length;let J;for(D=0;D<N;D++)J=M[D],T[J]=y[J];return T}function lu(y){function T(M,D,N,J){let S=M[J++];if(S==="__proto__")return!0;const c=Number.isFinite(+S),ve=J>=M.length;return S=!S&&fe.isArray(N)?N.length:S,ve?(fe.hasOwnProp(N,S)?N[S]=[N[S],D]:N[S]=D,!c):((!N[S]||!fe.isObject(N[S]))&&(N[S]=[]),T(M,D,N[S],J)&&fe.isArray(N[S])&&(N[S]=Tf(N[S])),!c)}if(fe.isFormData(y)&&fe.isFunction(y.entries)){const M={};return fe.forEachEntry(y,(D,N)=>{T(Sf(D),N,M,0)}),M}return null}function If(y,T,M){if(fe.isString(y))try{return(T||JSON.parse)(y),fe.trim(y)}catch(D){if(D.name!=="SyntaxError")throw D}return(M||JSON.stringify)(y)}const Oo={transitional:au,adapter:["xhr","http","fetch"],transformRequest:[function(T,M){const D=M.getContentType()||"",N=D.indexOf("application/json")>-1,J=fe.isObject(T);if(J&&fe.isHTMLForm(T)&&(T=new FormData(T)),fe.isFormData(T))return N?JSON.stringify(lu(T)):T;if(fe.isArrayBuffer(T)||fe.isBuffer(T)||fe.isStream(T)||fe.isFile(T)||fe.isBlob(T)||fe.isReadableStream(T))return T;if(fe.isArrayBufferView(T))return T.buffer;if(fe.isURLSearchParams(T))return M.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),T.toString();let c;if(J){if(D.indexOf("application/x-www-form-urlencoded")>-1)return wf(T,this.formSerializer).toString();if((c=fe.isFileList(T))||D.indexOf("multipart/form-data")>-1){const ve=this.env&&this.env.FormData;return sl(c?{"files[]":T}:T,ve&&new ve,this.formSerializer)}}return J||N?(M.setContentType("application/json",!1),If(T)):T}],transformResponse:[function(T){const M=this.transitional||Oo.transitional,D=M&&M.forcedJSONParsing,N=this.responseType==="json";if(fe.isResponse(T)||fe.isReadableStream(T))return T;if(T&&fe.isString(T)&&(D&&!this.responseType||N)){const S=!(M&&M.silentJSONParsing)&&N;try{return JSON.parse(T)}catch(c){if(S)throw c.name==="SyntaxError"?ct.from(c,ct.ERR_BAD_RESPONSE,this,null,this.response):c}}return T}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Pr.classes.FormData,Blob:Pr.classes.Blob},validateStatus:function(T){return T>=200&&T<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};fe.forEach(["delete","get","head","post","put","patch"],y=>{Oo.headers[y]={}});const Pf=fe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Ef=y=>{const T={};let M,D,N;return y&&y.split(`
|
581
|
-
`).forEach(function(S){
|
582
|
-
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(T){return T instanceof this?T:new this(T)}static concat(T,...M){const D=new this(T);return M.forEach(N=>D.set(N)),D}static accessor(T){const D=(this[cu]=this[cu]={accessors:{}}).accessors,N=this.prototype;function J(S){const c=Vo(S);D[c]||(Mf(N,S),D[c]=!0)}return fe.isArray(T)?T.forEach(J):J(T),this}}Gi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),fe.reduceDescriptors(Gi.prototype,({value:y},T)=>{let M=T[0].toUpperCase()+T.slice(1);return{get:()=>y,set(D){this[M]=D}}}),fe.freezeMethods(Gi);function Tc(y,T){const M=this||Oo,D=T||M,N=Gi.from(D.headers);let J=D.data;return fe.forEach(y,function(c){J=c.call(M,J,N.normalize(),T?T.status:void 0)}),N.normalize(),J}function hu(y){return!!(y&&y.__CANCEL__)}function Os(y,T,M){ct.call(this,y??"canceled",ct.ERR_CANCELED,T,M),this.name="CanceledError"}fe.inherits(Os,ct,{__CANCEL__:!0});function uu(y,T,M){const D=M.config.validateStatus;!M.status||!D||D(M.status)?y(M):T(new ct("Request failed with status code "+M.status,[ct.ERR_BAD_REQUEST,ct.ERR_BAD_RESPONSE][Math.floor(M.status/100)-4],M.config,M.request,M))}function zf(y){const T=/^([-+\w]{1,25})(:?\/\/|:)/.exec(y);return T&&T[1]||""}function Df(y,T){y=y||10;const M=new Array(y),D=new Array(y);let N=0,J=0,S;return T=T!==void 0?T:1e3,function(ve){const ye=Date.now(),be=D[J];S||(S=ye),M[N]=ve,D[N]=ye;let le=J,ae=0;for(;le!==N;)ae+=M[le++],le=le%y;if(N=(N+1)%y,N===J&&(J=(J+1)%y),ye-S<T)return;const ut=be&&ye-be;return ut?Math.round(ae*1e3/ut):void 0}}function Lf(y,T){let M=0,D=1e3/T,N,J;const S=(ye,be=Date.now())=>{M=be,N=null,J&&(clearTimeout(J),J=null),y.apply(null,ye)};return[(...ye)=>{const be=Date.now(),le=be-M;le>=D?S(ye,be):(N=ye,J||(J=setTimeout(()=>{J=null,S(N)},D-le)))},()=>N&&S(N)]}const al=(y,T,M=3)=>{let D=0;const N=Df(50,250);return Lf(J=>{const S=J.loaded,c=J.lengthComputable?J.total:void 0,ve=S-D,ye=N(ve),be=S<=c;D=S;const le={loaded:S,total:c,progress:c?S/c:void 0,bytes:ve,rate:ye||void 0,estimated:ye&&c&&be?(c-S)/ye:void 0,event:J,lengthComputable:c!=null,[T?"download":"upload"]:!0};y(le)},M)},du=(y,T)=>{const M=y!=null;return[D=>T[0]({lengthComputable:M,total:y,loaded:D}),T[1]]},pu=y=>(...T)=>fe.asap(()=>y(...T)),Rf=Pr.hasStandardBrowserEnv?function(){const T=/(msie|trident)/i.test(navigator.userAgent),M=document.createElement("a");let D;function N(J){let S=J;return T&&(M.setAttribute("href",S),S=M.href),M.setAttribute("href",S),{href:M.href,protocol:M.protocol?M.protocol.replace(/:$/,""):"",host:M.host,search:M.search?M.search.replace(/^\?/,""):"",hash:M.hash?M.hash.replace(/^#/,""):"",hostname:M.hostname,port:M.port,pathname:M.pathname.charAt(0)==="/"?M.pathname:"/"+M.pathname}}return D=N(window.location.href),function(S){const c=fe.isString(S)?N(S):S;return c.protocol===D.protocol&&c.host===D.host}}():function(){return function(){return!0}}(),Bf=Pr.hasStandardBrowserEnv?{write(y,T,M,D,N,J){const S=[y+"="+encodeURIComponent(T)];fe.isNumber(M)&&S.push("expires="+new Date(M).toGMTString()),fe.isString(D)&&S.push("path="+D),fe.isString(N)&&S.push("domain="+N),J===!0&&S.push("secure"),document.cookie=S.join("; ")},read(y){const T=document.cookie.match(new RegExp("(^|;\\s*)("+y+")=([^;]*)"));return T?decodeURIComponent(T[3]):null},remove(y){this.write(y,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Ff(y){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(y)}function Of(y,T){return T?y.replace(/\/?\/$/,"")+"/"+T.replace(/^\/+/,""):y}function fu(y,T){return y&&!Ff(T)?Of(y,T):T}const mu=y=>y instanceof Gi?{...y}:y;function es(y,T){T=T||{};const M={};function D(ye,be,le){return fe.isPlainObject(ye)&&fe.isPlainObject(be)?fe.merge.call({caseless:le},ye,be):fe.isPlainObject(be)?fe.merge({},be):fe.isArray(be)?be.slice():be}function N(ye,be,le){if(fe.isUndefined(be)){if(!fe.isUndefined(ye))return D(void 0,ye,le)}else return D(ye,be,le)}function J(ye,be){if(!fe.isUndefined(be))return D(void 0,be)}function S(ye,be){if(fe.isUndefined(be)){if(!fe.isUndefined(ye))return D(void 0,ye)}else return D(void 0,be)}function c(ye,be,le){if(le in T)return D(ye,be);if(le in y)return D(void 0,ye)}const ve={url:J,method:J,data:J,baseURL:S,transformRequest:S,transformResponse:S,paramsSerializer:S,timeout:S,timeoutMessage:S,withCredentials:S,withXSRFToken:S,adapter:S,responseType:S,xsrfCookieName:S,xsrfHeaderName:S,onUploadProgress:S,onDownloadProgress:S,decompress:S,maxContentLength:S,maxBodyLength:S,beforeRedirect:S,transport:S,httpAgent:S,httpsAgent:S,cancelToken:S,socketPath:S,responseEncoding:S,validateStatus:c,headers:(ye,be)=>N(mu(ye),mu(be),!0)};return fe.forEach(Object.keys(Object.assign({},y,T)),function(be){const le=ve[be]||N,ae=le(y[be],T[be],be);fe.isUndefined(ae)&&le!==c||(M[be]=ae)}),M}const gu=y=>{const T=es({},y);let{data:M,withXSRFToken:D,xsrfHeaderName:N,xsrfCookieName:J,headers:S,auth:c}=T;T.headers=S=Gi.from(S),T.url=su(fu(T.baseURL,T.url),y.params,y.paramsSerializer),c&&S.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));let ve;if(fe.isFormData(M)){if(Pr.hasStandardBrowserEnv||Pr.hasStandardBrowserWebWorkerEnv)S.setContentType(void 0);else if((ve=S.getContentType())!==!1){const[ye,...be]=ve?ve.split(";").map(le=>le.trim()).filter(Boolean):[];S.setContentType([ye||"multipart/form-data",...be].join("; "))}}if(Pr.hasStandardBrowserEnv&&(D&&fe.isFunction(D)&&(D=D(T)),D||D!==!1&&Rf(T.url))){const ye=N&&J&&Bf.read(J);ye&&S.set(N,ye)}return T},Vf=typeof XMLHttpRequest<"u"&&function(y){return new Promise(function(M,D){const N=gu(y);let J=N.data;const S=Gi.from(N.headers).normalize();let{responseType:c,onUploadProgress:ve,onDownloadProgress:ye}=N,be,le,ae,ut,je;function Ke(){ut&&ut(),je&&je(),N.cancelToken&&N.cancelToken.unsubscribe(be),N.signal&&N.signal.removeEventListener("abort",be)}let Fe=new XMLHttpRequest;Fe.open(N.method.toUpperCase(),N.url,!0),Fe.timeout=N.timeout;function ht(){if(!Fe)return;const Ue=Gi.from("getAllResponseHeaders"in Fe&&Fe.getAllResponseHeaders()),yt={data:!c||c==="text"||c==="json"?Fe.responseText:Fe.response,status:Fe.status,statusText:Fe.statusText,headers:Ue,config:y,request:Fe};uu(function(It){M(It),Ke()},function(It){D(It),Ke()},yt),Fe=null}"onloadend"in Fe?Fe.onloadend=ht:Fe.onreadystatechange=function(){!Fe||Fe.readyState!==4||Fe.status===0&&!(Fe.responseURL&&Fe.responseURL.indexOf("file:")===0)||setTimeout(ht)},Fe.onabort=function(){Fe&&(D(new ct("Request aborted",ct.ECONNABORTED,y,Fe)),Fe=null)},Fe.onerror=function(){D(new ct("Network Error",ct.ERR_NETWORK,y,Fe)),Fe=null},Fe.ontimeout=function(){let bt=N.timeout?"timeout of "+N.timeout+"ms exceeded":"timeout exceeded";const yt=N.transitional||au;N.timeoutErrorMessage&&(bt=N.timeoutErrorMessage),D(new ct(bt,yt.clarifyTimeoutError?ct.ETIMEDOUT:ct.ECONNABORTED,y,Fe)),Fe=null},J===void 0&&S.setContentType(null),"setRequestHeader"in Fe&&fe.forEach(S.toJSON(),function(bt,yt){Fe.setRequestHeader(yt,bt)}),fe.isUndefined(N.withCredentials)||(Fe.withCredentials=!!N.withCredentials),c&&c!=="json"&&(Fe.responseType=N.responseType),ye&&([ae,je]=al(ye,!0),Fe.addEventListener("progress",ae)),ve&&Fe.upload&&([le,ut]=al(ve),Fe.upload.addEventListener("progress",le),Fe.upload.addEventListener("loadend",ut)),(N.cancelToken||N.signal)&&(be=Ue=>{Fe&&(D(!Ue||Ue.type?new Os(null,y,Fe):Ue),Fe.abort(),Fe=null)},N.cancelToken&&N.cancelToken.subscribe(be),N.signal&&(N.signal.aborted?be():N.signal.addEventListener("abort",be)));const Ye=zf(N.url);if(Ye&&Pr.protocols.indexOf(Ye)===-1){D(new ct("Unsupported protocol "+Ye+":",ct.ERR_BAD_REQUEST,y));return}Fe.send(J||null)})},Nf=(y,T)=>{let M=new AbortController,D;const N=function(ve){if(!D){D=!0,S();const ye=ve instanceof Error?ve:this.reason;M.abort(ye instanceof ct?ye:new Os(ye instanceof Error?ye.message:ye))}};let J=T&&setTimeout(()=>{N(new ct(`timeout ${T} of ms exceeded`,ct.ETIMEDOUT))},T);const S=()=>{y&&(J&&clearTimeout(J),J=null,y.forEach(ve=>{ve&&(ve.removeEventListener?ve.removeEventListener("abort",N):ve.unsubscribe(N))}),y=null)};y.forEach(ve=>ve&&ve.addEventListener&&ve.addEventListener("abort",N));const{signal:c}=M;return c.unsubscribe=S,[c,()=>{J&&clearTimeout(J),J=null}]},jf=function*(y,T){let M=y.byteLength;if(!T||M<T){yield y;return}let D=0,N;for(;D<M;)N=D+T,yield y.slice(D,N),D=N},Uf=async function*(y,T,M){for await(const D of y)yield*jf(ArrayBuffer.isView(D)?D:await M(String(D)),T)},_u=(y,T,M,D,N)=>{const J=Uf(y,T,N);let S=0,c,ve=ye=>{c||(c=!0,D&&D(ye))};return new ReadableStream({async pull(ye){try{const{done:be,value:le}=await J.next();if(be){ve(),ye.close();return}let ae=le.byteLength;if(M){let ut=S+=ae;M(ut)}ye.enqueue(new Uint8Array(le))}catch(be){throw ve(be),be}},cancel(ye){return ve(ye),J.return()}},{highWaterMark:2})},ll=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",yu=ll&&typeof ReadableStream=="function",Ic=ll&&(typeof TextEncoder=="function"?(y=>T=>y.encode(T))(new TextEncoder):async y=>new Uint8Array(await new Response(y).arrayBuffer())),xu=(y,...T)=>{try{return!!y(...T)}catch{return!1}},$f=yu&&xu(()=>{let y=!1;const T=new Request(Pr.origin,{body:new ReadableStream,method:"POST",get duplex(){return y=!0,"half"}}).headers.has("Content-Type");return y&&!T}),vu=64*1024,Pc=yu&&xu(()=>fe.isReadableStream(new Response("").body)),cl={stream:Pc&&(y=>y.body)};ll&&(y=>{["text","arrayBuffer","blob","formData","stream"].forEach(T=>{!cl[T]&&(cl[T]=fe.isFunction(y[T])?M=>M[T]():(M,D)=>{throw new ct(`Response type '${T}' is not supported`,ct.ERR_NOT_SUPPORT,D)})})})(new Response);const qf=async y=>{if(y==null)return 0;if(fe.isBlob(y))return y.size;if(fe.isSpecCompliantForm(y))return(await new Request(y).arrayBuffer()).byteLength;if(fe.isArrayBufferView(y)||fe.isArrayBuffer(y))return y.byteLength;if(fe.isURLSearchParams(y)&&(y=y+""),fe.isString(y))return(await Ic(y)).byteLength},Zf=async(y,T)=>{const M=fe.toFiniteNumber(y.getContentLength());return M??qf(T)},Ec={http:ff,xhr:Vf,fetch:ll&&(async y=>{let{url:T,method:M,data:D,signal:N,cancelToken:J,timeout:S,onDownloadProgress:c,onUploadProgress:ve,responseType:ye,headers:be,withCredentials:le="same-origin",fetchOptions:ae}=gu(y);ye=ye?(ye+"").toLowerCase():"text";let[ut,je]=N||J||S?Nf([N,J],S):[],Ke,Fe;const ht=()=>{!Ke&&setTimeout(()=>{ut&&ut.unsubscribe()}),Ke=!0};let Ye;try{if(ve&&$f&&M!=="get"&&M!=="head"&&(Ye=await Zf(be,D))!==0){let At=new Request(T,{method:"POST",body:D,duplex:"half"}),It;if(fe.isFormData(D)&&(It=At.headers.get("content-type"))&&be.setContentType(It),At.body){const[Yi,ri]=du(Ye,al(pu(ve)));D=_u(At.body,vu,Yi,ri,Ic)}}fe.isString(le)||(le=le?"include":"omit"),Fe=new Request(T,{...ae,signal:ut,method:M.toUpperCase(),headers:be.normalize().toJSON(),body:D,duplex:"half",credentials:le});let Ue=await fetch(Fe);const bt=Pc&&(ye==="stream"||ye==="response");if(Pc&&(c||bt)){const At={};["status","statusText","headers"].forEach(Qi=>{At[Qi]=Ue[Qi]});const It=fe.toFiniteNumber(Ue.headers.get("content-length")),[Yi,ri]=c&&du(It,al(pu(c),!0))||[];Ue=new Response(_u(Ue.body,vu,Yi,()=>{ri&&ri(),bt&&ht()},Ic),At)}ye=ye||"text";let yt=await cl[fe.findKey(cl,ye)||"text"](Ue,y);return!bt&&ht(),je&&je(),await new Promise((At,It)=>{uu(At,It,{data:yt,headers:Gi.from(Ue.headers),status:Ue.status,statusText:Ue.statusText,config:y,request:Fe})})}catch(Ue){throw ht(),Ue&&Ue.name==="TypeError"&&/fetch/i.test(Ue.message)?Object.assign(new ct("Network Error",ct.ERR_NETWORK,y,Fe),{cause:Ue.cause||Ue}):ct.from(Ue,Ue&&Ue.code,y,Fe)}})};fe.forEach(Ec,(y,T)=>{if(y){try{Object.defineProperty(y,"name",{value:T})}catch{}Object.defineProperty(y,"adapterName",{value:T})}});const bu=y=>`- ${y}`,Gf=y=>fe.isFunction(y)||y===null||y===!1,wu={getAdapter:y=>{y=fe.isArray(y)?y:[y];const{length:T}=y;let M,D;const N={};for(let J=0;J<T;J++){M=y[J];let S;if(D=M,!Gf(M)&&(D=Ec[(S=String(M)).toLowerCase()],D===void 0))throw new ct(`Unknown adapter '${S}'`);if(D)break;N[S||"#"+J]=D}if(!D){const J=Object.entries(N).map(([c,ve])=>`adapter ${c} `+(ve===!1?"is not supported by the environment":"is not available in the build"));let S=T?J.length>1?`since :
|
583
|
-
`+
|
584
|
-
`):" "+bu(
|
585
|
-
`+J):D.stack=J}catch{}}throw D}}_request(T,M){typeof T=="string"?(M=M||{},M.url=T):M=T||{},M=es(this.defaults,M);const{transitional:D,paramsSerializer:N,headers:J}=M;D!==void 0&&kc.assertOptions(D,{silentJSONParsing:In.transitional(In.boolean),forcedJSONParsing:In.transitional(In.boolean),clarifyTimeoutError:In.transitional(In.boolean)},!1),N!=null&&(fe.isFunction(N)?M.paramsSerializer={serialize:N}:kc.assertOptions(N,{encode:In.function,serialize:In.function},!0)),M.method=(M.method||this.defaults.method||"get").toLowerCase();let S=J&&fe.merge(J.common,J[M.method]);J&&fe.forEach(["delete","get","head","post","put","patch","common"],je=>{delete J[je]}),M.headers=Gi.concat(S,J);const c=[];let ve=!0;this.interceptors.request.forEach(function(Ke){typeof Ke.runWhen=="function"&&Ke.runWhen(M)===!1||(ve=ve&&Ke.synchronous,c.unshift(Ke.fulfilled,Ke.rejected))});const ye=[];this.interceptors.response.forEach(function(Ke){ye.push(Ke.fulfilled,Ke.rejected)});let be,le=0,ae;if(!ve){const je=[Su.bind(this),void 0];for(je.unshift.apply(je,c),je.push.apply(je,ye),ae=je.length,be=Promise.resolve(M);le<ae;)be=be.then(je[le++],je[le++]);return be}ae=c.length;let ut=M;for(le=0;le<ae;){const je=c[le++],Ke=c[le++];try{ut=je(ut)}catch(Fe){Ke.call(this,Fe);break}}try{be=Su.call(this,ut)}catch(je){return Promise.reject(je)}for(le=0,ae=ye.length;le<ae;)be=be.then(ye[le++],ye[le++]);return be}getUri(T){T=es(this.defaults,T);const M=fu(T.baseURL,T.url);return su(M,T.params,T.paramsSerializer)}}fe.forEach(["delete","get","head","options"],function(T){ts.prototype[T]=function(M,D){return this.request(es(D||{},{method:T,url:M,data:(D||{}).data}))}}),fe.forEach(["post","put","patch"],function(T){function M(D){return function(J,S,c){return this.request(es(c||{},{method:T,headers:D?{"Content-Type":"multipart/form-data"}:{},url:J,data:S}))}}ts.prototype[T]=M(),ts.prototype[T+"Form"]=M(!0)});class Mc{constructor(T){if(typeof T!="function")throw new TypeError("executor must be a function.");let M;this.promise=new Promise(function(J){M=J});const D=this;this.promise.then(N=>{if(!D._listeners)return;let J=D._listeners.length;for(;J-- >0;)D._listeners[J](N);D._listeners=null}),this.promise.then=N=>{let J;const S=new Promise(c=>{D.subscribe(c),J=c}).then(N);return S.cancel=function(){D.unsubscribe(J)},S},T(function(J,S,c){D.reason||(D.reason=new Os(J,S,c),M(D.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(T){if(this.reason){T(this.reason);return}this._listeners?this._listeners.push(T):this._listeners=[T]}unsubscribe(T){if(!this._listeners)return;const M=this._listeners.indexOf(T);M!==-1&&this._listeners.splice(M,1)}static source(){let T;return{token:new Mc(function(N){T=N}),cancel:T}}}function Xf(y){return function(M){return y.apply(null,M)}}function Wf(y){return fe.isObject(y)&&y.isAxiosError===!0}const zc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(zc).forEach(([y,T])=>{zc[T]=y});function Pu(y){const T=new ts(y),M=$h(ts.prototype.request,T);return fe.extend(M,ts.prototype,T,{allOwnKeys:!0}),fe.extend(M,T,null,{allOwnKeys:!0}),M.create=function(N){return Pu(es(y,N))},M}const Xt=Pu(Oo);Xt.Axios=ts,Xt.CanceledError=Os,Xt.CancelToken=Mc,Xt.isCancel=hu,Xt.VERSION=Tu,Xt.toFormData=sl,Xt.AxiosError=ct,Xt.Cancel=Xt.CanceledError,Xt.all=function(T){return Promise.all(T)},Xt.spread=Xf,Xt.isAxiosError=Wf,Xt.mergeConfig=es,Xt.AxiosHeaders=Gi,Xt.formToJSON=y=>lu(fe.isHTMLForm(y)?new FormData(y):y),Xt.getAdapter=wu.getAdapter,Xt.HttpStatusCode=zc,Xt.default=Xt;const Jf=(y,T=300)=>{let M;return function(...N){clearTimeout(M),M=setTimeout(()=>{y.apply(this,N)},T)}};function Eu(y,T,M={}){const D={type:"Feature"};return(M.id===0||M.id)&&(D.id=M.id),M.bbox&&(D.bbox=M.bbox),D.properties=T||{},D.geometry=y,D}function Kf(y,T,M={}){if(!y)throw new Error("coordinates is required");if(!Array.isArray(y))throw new Error("coordinates must be an Array");if(y.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Au(y[0])||!Au(y[1]))throw new Error("coordinates must contain numbers");return Eu({type:"Point",coordinates:y},T,M)}function Cu(y,T,M={}){for(const N of y){if(N.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(N[N.length-1].length!==N[0].length)throw new Error("First and last Position are not equivalent.");for(let J=0;J<N[N.length-1].length;J++)if(N[N.length-1][J]!==N[0][J])throw new Error("First and last Position are not equivalent.")}return Eu({type:"Polygon",coordinates:y},T,M)}function Au(y){return!isNaN(y)&&y!==null&&!Array.isArray(y)}function ku(y,T,M){if(y!==null)for(var D,N,J,S,c,ve,ye,be=0,le=0,ae,ut=y.type,je=ut==="FeatureCollection",Ke=ut==="Feature",Fe=je?y.features.length:1,ht=0;ht<Fe;ht++){ye=je?y.features[ht].geometry:Ke?y.geometry:y,ae=ye?ye.type==="GeometryCollection":!1,c=ae?ye.geometries.length:1;for(var Ye=0;Ye<c;Ye++){var Ue=0,bt=0;if(S=ae?ye.geometries[Ye]:ye,S!==null){ve=S.coordinates;var yt=S.type;switch(be=0,yt){case null:break;case"Point":if(T(ve,le,ht,Ue,bt)===!1)return!1;le++,Ue++;break;case"LineString":case"MultiPoint":for(D=0;D<ve.length;D++){if(T(ve[D],le,ht,Ue,bt)===!1)return!1;le++,yt==="MultiPoint"&&Ue++}yt==="LineString"&&Ue++;break;case"Polygon":case"MultiLineString":for(D=0;D<ve.length;D++){for(N=0;N<ve[D].length-be;N++){if(T(ve[D][N],le,ht,Ue,bt)===!1)return!1;le++}yt==="MultiLineString"&&Ue++,yt==="Polygon"&&bt++}yt==="Polygon"&&Ue++;break;case"MultiPolygon":for(D=0;D<ve.length;D++){for(bt=0,N=0;N<ve[D].length;N++){for(J=0;J<ve[D][N].length-be;J++){if(T(ve[D][N][J],le,ht,Ue,bt)===!1)return!1;le++}bt++}Ue++}break;case"GeometryCollection":for(D=0;D<S.geometries.length;D++)if(ku(S.geometries[D],T)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Yf(y,T={}){if(y.bbox!=null&&T.recompute!==!0)return y.bbox;const M=[1/0,1/0,-1/0,-1/0];return ku(y,D=>{M[0]>D[0]&&(M[0]=D[0]),M[1]>D[1]&&(M[1]=D[1]),M[2]<D[0]&&(M[2]=D[0]),M[3]<D[1]&&(M[3]=D[1])}),M}function Qf(y,T={}){const M=Yf(y),D=(M[0]+M[2])/2,N=(M[1]+M[3])/2;return Kf([D,N],T.properties,T)}const em={mixins:[gc],props:{map:{type:Object},baseLayers:{type:Array,default:[{id:"orto10",name:"Ortophoto 1:10К",url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",service:"TMS",category:"Національна інфраструктура геопросторових даних",scale:1e4,year:2020,bounds:"ua",maxzoom:18,owner:"НДІГК (Інститут геодезії та картографії)",image:"https://data.gki.com.ua/api-user/rtile/orto10/ua/13/4954/2876.png",basemap:!0},{id:"graymap",name:"Сіра карта",url:"https://basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",service:"TMS",category:"Базові карти",attribution:"© <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a>, © <a href='https://carto.com/attributions'>CARTO</a>",bounds1:"ua",image:"https://basemaps.cartocdn.com/light_all/10/601/348.png",position:0,owner:"OSM",basemap:!0},{id:"darkmap_carto",name:"Темна карта України",image:"https://basemaps.cartocdn.com/dark_all/13/4791/2762.png?ver=2023-04-14",url:"https://basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png",service:"TMS",category:"Базові карти",active:!1}]}},data(){return{selectedLayer:null}},watch:{map(y){y&&y.on("load",this.handleMapLoad)}},methods:{handleMapLoad(){this.baseLayers.forEach(y=>{this.layerList.push(y)}),this.toggleLayerVisibility("graymap")},toggleLayerVisibility(y){this.selectedLayer=y,this.changeBaseLayer(this.selectedLayer)}}},tm={class:"vs-map-slot-layers"},im=["onClick"],rm=["src","alt"];function nm(y,T,M,D,N,J){return oe.openBlock(),oe.createElementBlock("div",tm,[(oe.openBlock(!0),oe.createElementBlock(oe.Fragment,null,oe.renderList(M.baseLayers,S=>(oe.openBlock(),oe.createElementBlock("div",{key:S.id,class:oe.normalizeClass(["vs-map-slot-layers__layer",{focused:S.id==N.selectedLayer}]),onClick:c=>J.toggleLayerVisibility(S.id)},[oe.createElementVNode("img",{width:"50",height:"50",src:S.image,class:"vs-map-slot-layers__image",alt:S==null?void 0:S.name},null,8,rm)],10,im))),128))])}const sm=nn(em,[["render",nm],["__scopeId","data-v-6644a27d"]]),om={props:["colors"]},am={class:"absolute left-[20px] bottom-[74px] bg-white max-w-[250px] p-[10px] rounded-lg"},lm={class:"legend-item"},cm={key:0,class:"flex justify-start items-center gap-2"},hm={class:"ml-1"};function um(y,T,M,D,N,J){return oe.openBlock(),oe.createElementBlock("div",am,[(oe.openBlock(!0),oe.createElementBlock(oe.Fragment,null,oe.renderList(M.colors,S=>(oe.openBlock(),oe.createElementBlock("div",lm,[S.id>0?(oe.openBlock(),oe.createElementBlock("div",cm,[oe.createElementVNode("div",{class:"w-[15px] h-[15px] rounded-[50%] min-w-[15px]",style:oe.normalizeStyle({backgroundColor:S.color})},null,4),oe.createElementVNode("div",hm,oe.toDisplayString(S.text),1)])):oe.createCommentVNode("",!0)]))),256))])}const dm={components:{MapSlotLayers:sm,MapLegend:nn(om,[["render",um]])},props:{colorAttr:null,height:{type:String,default:()=>"100vh"},width:{type:String,default:"100vw"},center:{type:Array,default:[32,49]},maxBounds:{type:Array,default:[[22,44],[40,52]]},table:{type:String,default:""},zoom:{type:[String,Number],default:5},basemap:Array,filtersParam:{type:String,default:""},row:{type:Object,default:{}}},mixins:[gc],data(){return{map:null,hoverObject:null,popup:null,colors:[]}},async mounted(){var y,T,M,D,N,J,S,c,ve,ye,be,le,ae,ut,je,Ke,Fe,ht,Ye,Ue,bt,yt,At,It,Yi,ri,Qi;if(await this.createMap(),(y=this.row)!=null&&y.geom){const wt=new URLSearchParams(window.location.search);((M=(T=this.row)==null?void 0:T.geom)==null?void 0:M.coordinates.length)<=1&&wt.has("id")?typeof((c=(S=(J=(N=(D=this.row)==null?void 0:D.geom)==null?void 0:N.coordinates)==null?void 0:J[0])==null?void 0:S[0])==null?void 0:c[0])=="number"?(le=this.map)==null||le.fitBounds((be=(ye=(ve=this.row)==null?void 0:ve.geom)==null?void 0:ye.coordinates)==null?void 0:be[0],{maxZoom:13,padding:30}):typeof((Fe=(Ke=(je=(ut=(ae=this.row)==null?void 0:ae.geom)==null?void 0:ut.coordinates)==null?void 0:je[0])==null?void 0:Ke[0])==null?void 0:Fe[0])=="object"&&((yt=this.map)==null||yt.fitBounds((bt=(Ue=(Ye=(ht=this.row)==null?void 0:ht.geom)==null?void 0:Ye.coordinates)==null?void 0:Ue[0])==null?void 0:bt[0],{maxZoom:13,padding:30})):(Qi=this.map)==null||Qi.fitBounds((ri=(Yi=(It=(At=this.row)==null?void 0:At.geom)==null?void 0:It.coordinates)==null?void 0:Yi[0])==null?void 0:ri[0],{maxZoom:13,padding:30})}},watch:{filtersParam(y){this.setFilter(this.table,y)}},methods:{async getColorStyle(){var y=[["#69D2E7","#A7DBD8","#E0E4CC","#F38630","#FA6900"],["#FE4365","#FC9D9A","#F9CDAD","#C8C8A9","#83AF9B"],["#ECD078","#D95B43","#C02942","#542437","#53777A"]];if(!this.colorAttr)return"blue";try{const{data:{rows:T}}=await Xt.get(`/api/data/${this.table}/${this.colorAttr}`),M=T.reduce((D,N,J)=>N!=null&&N.id?[...D,N.id.toString(),N.color||y[0][J%5]]:D,["match",["get",this.colorAttr]]);return this.colors=[...T],M.push("gray"),M}catch(T){console.log(T)}},async handleMapLoad(){const y=await this.getColorStyle();await this.addLayer({id:this.table,service:"vector",url:`/api/vtile/${this.table}/ua/{z}/{x}/{y}.vmt?pointZoom=12&nocache=1`,layers:[{type:"fill","source-layer":this.table,paint:{"fill-color":y,"fill-opacity":.3,"fill-outline-color":["case",["==",["feature-state","hover"],!0],"red","#000000"]},filter:["all",["==",["geometry-type"],"Polygon"]]},{type:"circle","source-layer":this.table,filter:["all",["==",["geometry-type"],"Point"]],paint:{"circle-radius":{base:1.75,stops:[[10,5],[12,6],[18,12]]},"circle-stroke-color":["case",["==",["feature-state","hover"],!0],"red","#ccc"],"circle-stroke-width":["case",["==",["feature-state","hover"],!0],2,1],"circle-color":y}}]})},async createMap(){const y={version:8,glyphs:"https://cdn.softpro.ua/data/fonts/{fontstack}/{range}.pbf",sources:{},layers:[]};this.map=await new mc.Map({container:"maplibre-map",style:y,center:this.center,zoom:this.zoom,minZoom:5,extend:this.maxBounds}),this.$parent.map=this.map,this.map.addControl(new mc.NavigationControl({visualizePitch:!0})),this.map.on("load",this.handleMapLoad)}}},pm={class:"vs-map-portal relative"};function fm(y,T,M,D,N,J){const S=oe.resolveComponent("MapLegend"),c=oe.resolveComponent("MapSlotLayers");return oe.openBlock(),oe.createElementBlock("div",pm,[oe.createElementVNode("div",{id:"maplibre-map",ref:"maplibreMap",style:oe.normalizeStyle({height:M.height,width:M.width})},null,4),oe.createVNode(S,{colors:N.colors},null,8,["colors"]),oe.createVNode(c,{map:N.map,baseLayers:M.basemap},null,8,["map","baseLayers"])])}const mm=nn(dm,[["render",fm]]),gm={},_m={class:"flex-shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},ym=[oe.createStaticVNode('<line x1="21" x2="14" y1="4" y2="4"></line><line x1="10" x2="3" y1="4" y2="4"></line><line x1="21" x2="12" y1="12" y2="12"></line><line x1="8" x2="3" y1="12" y2="12"></line><line x1="21" x2="16" y1="20" y2="20"></line><line x1="12" x2="3" y1="20" y2="20"></line><line x1="14" x2="14" y1="2" y2="6"></line><line x1="8" x2="8" y1="10" y2="14"></line><line x1="16" x2="16" y1="18" y2="22"></line>',9)];function xm(y,T){return oe.openBlock(),oe.createElementBlock("svg",_m,ym)}const vm=nn(gm,[["render",xm]]),bm={},wm={xmlns:"http://www.w3.org/2000/svg",width:"21",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-layout-sidebar-right-collapse"},Sm=[oe.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),oe.createElementVNode("path",{d:"M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"},null,-1),oe.createElementVNode("path",{d:"M15 4v16"},null,-1),oe.createElementVNode("path",{d:"M9 10l2 2l-2 2"},null,-1)];function Tm(y,T){return oe.openBlock(),oe.createElementBlock("svg",wm,Sm)}const Im=nn(bm,[["render",Tm]]),Pm={},Em={xmlns:"http://www.w3.org/2000/svg",width:"21",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-layout-sidebar-right-expand"},Cm=[oe.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),oe.createElementVNode("path",{d:"M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"},null,-1),oe.createElementVNode("path",{d:"M15 4v16"},null,-1),oe.createElementVNode("path",{d:"M10 10l-2 2l2 2"},null,-1)];function Am(y,T){return oe.openBlock(),oe.createElementBlock("svg",Em,Cm)}const km=nn(Pm,[["render",Am]]),Mm={},zm={class:"shrink-0 size-3",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Dm=[oe.createElementVNode("path",{d:"M18 6 6 18"},null,-1),oe.createElementVNode("path",{d:"m6 6 12 12"},null,-1)];function Lm(y,T){return oe.openBlock(),oe.createElementBlock("svg",zm,Dm)}const Rm=nn(Mm,[["render",Lm]]),Bm=oe.defineComponent({props:["title","table","tableComponent","rows","initTotal","colorAttr"],mixins:[gc],components:{MapPortal:mm,NoData:Ep,FilterIcon:vm,VisibleMapIcon:Im,HiddenMapIcon:km,CloseIcon:Rm},data(){return{filters:"",search:"",limit:20,filtersParam:"",isSelectObj:!1,selectedId:"",searchRegion:"",searchRegionResult:[],isRegionDropdownVisible:!1,selectedRow:"",activeFilters:"",isMapVisible:!0,tabsIsVisible:!1,filterUrl:"",currentPage:1,isFilterVisible:!1,tableData:null,hoverData:null,atuData:[],map:null,total:null,filterValues:"",activeFiltersCount:"",marinaTest:null,visibleTrue:!0,regionSelectValue:null,optionRowsCount:[{value:10,label:"10"},{value:20,label:"20"},{value:30,label:"30"}],handleDebouncedUpdateValue:Jf(y=>{this.handleSearchValue(y)},500)}},computed:{},watch:{map(){this.map.on("mousemove",this.handleMapHover),this.map.on("click",this.handleMapClick)},activeFiltersCount(){var y,T;return(T=(y=this.$refs)==null?void 0:y.filter)==null?void 0:T.filteredActiveFiltersLength},activeFilters(){var y,T;return(T=(y=this.$refs)==null?void 0:y.filter)==null?void 0:T.activeFilters},isFilterVisible(y){y||this.getData()},searchRegion(y){this.getReginOptions()},async regionSelectValue(){var N,J,S,c,ve,ye;const y=(S=(J=(N=this.regionSelectValue)==null?void 0:N.geom)==null?void 0:J.coordinates)==null?void 0:S[0],T=this.map.getSource("region-search-id");T?T.setData({type:"Feature",geometry:(ve=this.regionSelectValue)==null?void 0:ve.geom}):this.map.addSource("region-search-id",{type:"geojson",data:{type:"Feature",geometry:(c=this.regionSelectValue)==null?void 0:c.geom}}),this.map.getLayer("region-search-id")&&this.map.removeLayer("region-search-id");const D={id:"region-search-id",type:"fill",source:"region-search-id",paint:{"fill-color":"blue","fill-opacity":.1}};await this.map.addLayer(D),this.moveLayer("site.prc.parcel_object.table"),(ye=this.map)==null||ye.fitBounds(y,{zoom:10,padding:20})}},created(){this.tableData=this.rows,this.total=this.initTotal},mounted(){this.rows||this.getData(),this.checkUrl(),this.getFilter()},updated(){this.checkFilterLength()},methods:{async getData(){try{const y={search:this.search||null,limit:this.limit,page:this.currentPage};this.filtersParam!==""&&this.filtersParam!=="no-url"&&(y.filter=this.filtersParam);const{data:T}=await Xt.get(`/api/data/${this.table}`,{params:y});this.tableData=T.rows,this.total=T.total}catch(y){console.error(y.message)}},async handleClick(){await this.getReginOptions()},regionFullName(y){return`${y.text} / ${y.region}`},getLabelById(y){const T=this.filters.find(M=>M.id===y);return T?T.label:y},getOptionsLabelById(y,T){return Array.isArray(T)?this.filters.find(D=>D.id===y).options.filter(D=>T.includes(D.id)).map(D=>D.text).join(", "):T},async clearFilter(y){var T,M;await((M=(T=this.$refs)==null?void 0:T.filter)==null?void 0:M.clearFilter(y)),await this.updateTableAndMap(),await this.getData()},async getReginOptions(){try{const{data:y}=await Xt.get(`https://data.softpro.ua/api-user/suggest/atu.codifier.type.full.select?parent=H&key=${this.searchRegion}`);this.searchRegionResult=y}catch(y){console.error(y.message)}},handlePageChange(y){this.currentPage=y,this.getData()},async getFilter(){try{const{data:y}=await Xt.get(`/api/filter/${this.table}`);this.filters=y.list}catch(y){console.error(y.message)}},async handleSearchValue(y){this.search=y,await this.getData()},async handleSearchRegionValue(y){var T;this.searchRegion=y,y===""&&((T=this.map)==null||T.fitBounds([[22,44.4],[40,52.5]],{}))},handleFilterChange(y){this.currentPage=y.state.page||1,this.filterUrl=y.url.split("|").filter(T=>!T.includes("page=")).join("|")},async updateTableAndMap(){var y,T;this.filtersParam=this.filterUrl,this.activeFilters=(T=(y=this.$refs)==null?void 0:y.filter)==null?void 0:T.activeFilters,this.isFilterVisible=!1},handleFilterSubmit(){var y;this.isSelectObj="",this.selectedId="",this.selectedId=!1,(y=this.map)==null||y.fitBounds([[22,44.4],[40,52.5]],{}),this.isFilterVisible=!1},toggleFilterShown(){this.isFilterVisible=!this.isFilterVisible},closeFilterShown(){this.isFilterVisible=!1},toggleMapVisible(){this.isMapVisible=!this.isMapVisible},checkUrl(){const y=new URLSearchParams(window.location.search);y.has("id")?(this.isSelectObj=!0,this.isMapVisible=!0,this.selectedId=y.get("id")):(this.isSelectObj=!1,this.selectedId="")},changeLimit(y){this.limit=y,this.currentPage=1,this.getData()},filterModalClose(){this.toggleFilterShown(),this.isFilterVisible=!1},resetFilters(){this.$refs.filter&&(this.$refs.filter.clearAll(),this.search="",this.isFilterVisible=!1,this.filtersParam="",this.activeFilters=null,this.tabsIsVisible=!1,this.getData())},checkFilterLength(){var T,M;const y=(M=(T=this.$refs)==null?void 0:T.filter)==null?void 0:M.filteredActiveFiltersLength;y!==this.previousLength&&(this.previousLength=y,this.activeFiltersCount=y)},async handleMapClick(y){var J,S,c,ve,ye;const T=this.map.queryRenderedFeatures(y.point),M=window.location.pathname,D=new URLSearchParams(window.location.search);D.set("id",`${T[0].properties.id}`);const N=`${M}?${D.toString()}`;window.history.pushState({},"",N),this.isSelectObj=!0,y.lngLat&&((ye=this.map)==null||ye.fitBounds([[(J=y.lngLat)==null?void 0:J.lng,(S=y.lngLat)==null?void 0:S.lat],[(c=y.lngLat)==null?void 0:c.lng,(ve=y.lngLat)==null?void 0:ve.lat]],{maxZoom:13,padding:30})),this.checkUrl()},async selectRow(y){var N,J,S,c,ve,ye,be,le,ae,ut,je,Ke,Fe,ht,Ye,Ue,bt,yt,At,It;this.isMapVisible=!0,this.selectedRow=y;const T=window.location.pathname,M=new URLSearchParams(window.location.search);M.set("id",`${y.id}`);const D=`${T}?${M.toString()}`;window.history.pushState({},"",D),this.checkUrl(),y!=null&&y.geom&&(((N=y==null?void 0:y.geom)==null?void 0:N.coordinates.length)<=1?typeof((ve=(c=(S=(J=y==null?void 0:y.geom)==null?void 0:J.coordinates)==null?void 0:S[0])==null?void 0:c[0])==null?void 0:ve[0])=="number"?(le=this.map)==null||le.fitBounds((be=(ye=y==null?void 0:y.geom)==null?void 0:ye.coordinates)==null?void 0:be[0],{maxZoom:13,padding:30}):typeof((Ke=(je=(ut=(ae=y==null?void 0:y.geom)==null?void 0:ae.coordinates)==null?void 0:ut[0])==null?void 0:je[0])==null?void 0:Ke[0])=="object"&&((Ue=this.map)==null||Ue.fitBounds((Ye=(ht=(Fe=y==null?void 0:y.geom)==null?void 0:Fe.coordinates)==null?void 0:ht[0])==null?void 0:Ye[0],{maxZoom:13,padding:30})):(It=this.map)==null||It.fitBounds((At=(yt=(bt=y==null?void 0:y.geom)==null?void 0:bt.coordinates)==null?void 0:yt[0])==null?void 0:At[0],{maxZoom:13,padding:30})),this.isSelectObj=!0},async handleMapHover(y){var N,J,S,c,ve,ye;this.hoverObject&&(this.map.setFeatureState(this.hoverObject,{hover:!1}),this.hoverObject=null),this.popup||(this.popup=new mc.Popup({maxWidth:"400px",closeButton:!1,closeOnClick:!1}));const T=this.map.queryRenderedFeatures(y.point);if(this.map.getCanvas().style.cursor="pointer",!T.length||((N=T==null?void 0:T[0])==null?void 0:N.source)==="region-search-id"){this.map.getCanvas().style.cursor="",this.popup.remove();return}const M=T[0].geometry.coordinates.slice();this.hoverData=T[0].properties;const D={source:T[0].source,sourceLayer:T[0].sourceLayer,id:T[0].id};if(D.source!=="region-search-id"){for(this.map.setFeatureState(D,{hover:!0}),this.hoverObject=D;Math.abs(y.lngLat.lng-M[0])>180;)M[0]+=y.lngLat.lng>M[0]?360:-360;if(typeof(M==null?void 0:M[0])=="object"){let be;typeof((S=(J=M==null?void 0:M[0])==null?void 0:J[0])==null?void 0:S[0])=="number"?be=Cu([M==null?void 0:M[0]]):typeof((ve=(c=M==null?void 0:M[0])==null?void 0:c[0])==null?void 0:ve[0])=="object"&&(be=Cu([(ye=M==null?void 0:M[0])==null?void 0:ye[0]]));const le=Qf(be).geometry.coordinates;this.popup.setLngLat(le).setHTML(this.$refs.popup.innerHTML).addTo(this.map)}else typeof(M==null?void 0:M[0])=="number"&&this.popup.setLngLat(M).setHTML(this.$refs.popup.innerHTML).addTo(this.map)}}}}),Fm={class:"ml-3 pt-5"},Om={class:"w-full gap-5 flex justify-between mb-[10px] pr-3"},Vm={class:"flex gap-[20px]"},Nm={key:0,class:"font-medium text-[10px] min-w-[16px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full"},jm={class:"p-4 flex-1 flex flex-wrap justify-end items-center gap-2"},Um=["title"],$m=oe.createElementVNode("span",{class:"sr-only"},"Відкрити мапу",-1),qm={class:"flex"},Zm={class:"py-[15px] pb-[24px] pl-2"},Gm={class:"font-bold text-2xl mr-[10px]"},Hm={class:"text-sm text-stone-500 font-medium"},Xm=oe.createElementVNode("span",{class:"text-sm text-stone-500 font-medium"}," об'єктів",-1),Wm={class:"wrapperTable flex flex-col",style:{height:"calc(100vh - 302px)"}},Jm={key:0,class:"flex gap-x-2 flex-wrap"},Km={class:"font-medium"},Ym=oe.createElementVNode("span",{class:"h-3 mx-2 border-s border-gray-200"},null,-1),Qm={class:"text-gray-500"},eg=["onClick"],tg={key:0,class:"mb-[10px] py-1 ps-3 pe-1 inline-flex items-center bg-white border border-gray-200 text-gray-800 text-xs rounded-full"},ig=oe.createElementVNode("span",{class:"font-medium"}," Очистити ",-1),rg={key:2,class:"text-center py-28"},ng=oe.createElementVNode("h2",{class:"font-medium text-base text-gray-500 rounded-xl"}," За ваши запитом даних не знайдено! ",-1),sg=oe.createElementVNode("p",{class:"font-normal text-sm text-gray-500 rounded-xl"}," Введіть, будь ласка,інші значення для пошуку. ",-1),og={key:0},ag={key:1,class:"my-5 pr-2"},lg={class:"flex justify-between"},cg={key:1,class:"w-2/4"},hg={class:"map-section"},ug={ref:"popup",style:{display:"none"}};function dg(y,T,M,D,N,J){const S=oe.resolveComponent("VsAutocompleteOption"),c=oe.resolveComponent("vs-autocomplete"),ve=oe.resolveComponent("vs-text"),ye=oe.resolveComponent("FilterIcon"),be=oe.resolveComponent("VsFilter"),le=oe.resolveComponent("VsDialog"),ae=oe.resolveComponent("VisibleMapIcon"),ut=oe.resolveComponent("HiddenMapIcon"),je=oe.resolveComponent("CloseIcon"),Ke=oe.resolveComponent("NoData"),Fe=oe.resolveComponent("VsPagination"),ht=oe.resolveComponent("MapPortal");return oe.openBlock(),oe.createElementBlock("section",Fm,[oe.createElementVNode("div",null,[oe.createElementVNode("div",Om,[oe.createElementVNode("div",Vm,[oe.createVNode(c,{modelValue:y.regionSelectValue,"onUpdate:modelValue":[T[0]||(T[0]=Ye=>y.regionSelectValue=Ye),y.handleSearchRegionValue],searchable:"",clearable:"",searchPlaceholder:"Введіть назву громади",placeholder:"Обрати область чи громаду",onOnSearch:T[1]||(T[1]=Ye=>y.searchRegion=Ye),onClick:y.handleClick,class:"w-[350px]"},{default:oe.withCtx(()=>[(oe.openBlock(!0),oe.createElementBlock(oe.Fragment,null,oe.renderList(y.searchRegionResult,Ye=>(oe.openBlock(),oe.createBlock(S,{class:"px-0 py-0",key:Ye==null?void 0:Ye.id,value:Ye,label:y.regionFullName(Ye)},null,8,["value","label"]))),128))]),_:1},8,["modelValue","onUpdate:modelValue","onClick"]),oe.createVNode(ve,{"model-value":y.search,"onUpdate:modelValue":y.handleDebouncedUpdateValue,class:"w-full table-interface-search [&>input:focus]:ring-1",placeholder:"Пошук",icon:"ti-search","icon-position":"left",clearable:"",style:{height:"38px","min-width":"300px","max-width":"300px"},ref:"searchInput"},null,8,["model-value","onUpdate:modelValue"]),y.total>=1?(oe.openBlock(),oe.createElementBlock("button",{key:0,type:"button",class:"py-2 px-2.5 max-h-[38px] inline-flex items-center gap-x-1.5 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50",onClick:T[2]||(T[2]=(...Ye)=>y.toggleFilterShown&&y.toggleFilterShown(...Ye))},[oe.createVNode(ye),oe.createTextVNode(" Фільтри "),y.activeFiltersCount>=1?(oe.openBlock(),oe.createElementBlock("span",Nm,oe.toDisplayString(y.activeFiltersCount),1)):oe.createCommentVNode("",!0)])):oe.createCommentVNode("",!0),oe.withDirectives(oe.createVNode(le,{visible:y.visibleTrue,"onUpdate:visible":T[5]||(T[5]=Ye=>y.visibleTrue=Ye),title:"Фільтри",size:"small",onOnClose:T[6]||(T[6]=()=>{y.visibleTrue=!0,y.isFilterVisible=!1})},{footer:oe.withCtx(()=>[oe.createElementVNode("div",jm,[oe.createElementVNode("button",{onClick:T[3]||(T[3]=(...Ye)=>y.resetFilters&&y.resetFilters(...Ye)),class:"py-2 px-3 inline-flex justify-center items-center text-start bg-white border border-gray-200 text-gray-800 text-sm font-medium rounded-lg shadow-sm align-middle hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"}," Очистити все "),oe.createElementVNode("button",{onClick:T[4]||(T[4]=(...Ye)=>y.updateTableAndMap&&y.updateTableAndMap(...Ye)),class:"py-2 px-3 inline-flex justify-center items-center gap-x-2 text-start bg-blue-600 border border-blue-600 text-white text-sm font-medium rounded-lg shadow-sm align-middle hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-500"}," Застосувати ")])]),default:oe.withCtx(()=>[y.filters?(oe.openBlock(),oe.createBlock(be,{key:0,ref:"filter",scheme:y.filters,closeFilterBtn:!0,onFilterClose:y.closeFilterShown,name:"filter",layout:"default",onFilterChange:y.handleFilterChange},null,8,["scheme","onFilterClose","onFilterChange"])):oe.createCommentVNode("",!0)]),_:1},8,["visible"]),[[oe.vShow,y.isFilterVisible]])]),oe.createElementVNode("button",{type:"button",class:"py-2 px-2 inline-flex items-center gap-x-1.5 text-sm rounded-lg border border-gray-200 bg-white text-gray-600 shadow-sm hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100",title:y.isMapVisible?"Приховати карту":"Показати карту",onClick:T[7]||(T[7]=(...Ye)=>y.toggleMapVisible&&y.toggleMapVisible(...Ye))},[y.isMapVisible?(oe.openBlock(),oe.createBlock(ae,{key:0})):(oe.openBlock(),oe.createBlock(ut,{key:1})),$m],8,Um)]),oe.createElementVNode("div",qm,[oe.createElementVNode("div",{class:oe.normalizeClass(["relative overflow-hidden",y.isMapVisible?"w-2/4 mr-0":"w-full mr-3",y.isSelectObj?"hidden":""])},[oe.createElementVNode("h1",Zm,[oe.createElementVNode("span",Gm,oe.toDisplayString(y.title),1),oe.createElementVNode("span",Hm,oe.toDisplayString(y.total),1),Xm]),oe.createElementVNode("div",Wm,[y.activeFilters?(oe.openBlock(),oe.createElementBlock("div",Jm,[(oe.openBlock(!0),oe.createElementBlock(oe.Fragment,null,oe.renderList(y.activeFilters,(Ye,Ue,bt)=>(oe.openBlock(),oe.createElementBlock("span",{class:"mb-[10px] py-1 ps-3 pe-1 inline-flex items-center bg-white border border-gray-200 text-gray-800 text-xs rounded-full",key:bt},[oe.createElementVNode("span",Km,oe.toDisplayString(y.getLabelById(Ue)),1),Ym,oe.createElementVNode("span",Qm,oe.toDisplayString(y.getOptionsLabelById(Ue,Ye)),1),oe.createElementVNode("button",{type:"button",class:"inline-flex shrink-0 justify-center items-center size-5 ms-1 rounded-full text-gray-600 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 text-sm",onClick:yt=>y.clearFilter(Ue)},[oe.createVNode(je)],8,eg)]))),128)),Object.keys(y.activeFilters).length>=2?(oe.openBlock(),oe.createElementBlock("span",tg,[ig,oe.createElementVNode("button",{type:"button",class:"inline-flex shrink-0 justify-center items-center size-5 ms-1 rounded-full text-gray-600 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 text-sm",onClick:T[8]||(T[8]=(...Ye)=>y.resetFilters&&y.resetFilters(...Ye))},[oe.createVNode(je)])])):oe.createCommentVNode("",!0)])):oe.createCommentVNode("",!0),y.total>=1?oe.renderSlot(y.$slots,"table",{key:1,rows:y.tableData,map:y.map,selectRow:y.selectRow}):(oe.openBlock(),oe.createElementBlock("div",rg,[oe.createVNode(Ke),ng,sg,oe.createElementVNode("button",{type:"button",class:"mt-[10px] py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs rounded-lg border border-stone-200 bg-white text-stone-800 shadow-sm hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100",onClick:T[9]||(T[9]=(...Ye)=>y.resetFilters&&y.resetFilters(...Ye))}," Очистити дані пошуку ")]))]),y.total>=1?(oe.openBlock(),oe.createElementBlock("hr",og)):oe.createCommentVNode("",!0),y.total>=1?(oe.openBlock(),oe.createElementBlock("div",ag,[oe.createElementVNode("div",lg,[oe.createVNode(Fe,{total:y.total,maxPages:7,defaultPage:y.currentPage,pageSize:y.limit,goTo:!1,size:"medium",onPageChange:y.handlePageChange,backgroundColor:"#e5e7eb",borderedCellSelected:"true",pageSizes:[10,20,30],onPageSizeChange:y.changeLimit},null,8,["total","defaultPage","pageSize","onPageChange","onPageSizeChange"])])])):oe.createCommentVNode("",!0)],2),y.isSelectObj?(oe.openBlock(),oe.createElementBlock("div",{key:0,class:oe.normalizeClass(y.isMapVisible?"w-2/4 mr-0 pb-5":"w-full pb-5 mr-3"),style:{height:"calc(100vh - 152px)"}},[oe.renderSlot(y.$slots,"details",{table:y.table,selectedId:y.selectedId,selectedRow:y.selectedRow,map:y.map})],2)):oe.createCommentVNode("",!0),y.isMapVisible?(oe.openBlock(),oe.createElementBlock("div",cg,[oe.createElementVNode("section",hg,[oe.createVNode(ht,{height:"calc(100vh - 152px)",width:"w-2/4",table:y.table,filtersParam:y.filtersParam,row:y.selectedRow,colorAttr:y.colorAttr},null,8,["table","filtersParam","row","colorAttr"])])])):oe.createCommentVNode("",!0)]),oe.createElementVNode("div",ug,[oe.renderSlot(y.$slots,"popup",{data:y.hoverData})],512)])])}const Mu=nn(Bm,[["render",dg]]),zu={install:y=>{y.component("VsPartsMap",Mu)},components:{VsPartsMap:Mu}};return typeof window<"u"&&(window.PartsMap=zu),zu});
|
576
|
+
${P} ${E} ${z} = u_${z};
|
577
|
+
#endif
|
578
|
+
`}),staticAttributes:o,staticUniforms:m}}class $s{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,n,o,a,c,m,_,v,b){this.context=t;let P=this.boundPaintVertexBuffers.length!==a.length;for(let E=0;!P&&E<a.length;E++)this.boundPaintVertexBuffers[E]!==a[E]&&(P=!0);!this.vao||this.boundProgram!==n||this.boundLayoutVertexBuffer!==o||P||this.boundIndexBuffer!==c||this.boundVertexOffset!==m||this.boundDynamicVertexBuffer!==_||this.boundDynamicVertexBuffer2!==v||this.boundDynamicVertexBuffer3!==b?this.freshBind(n,o,a,c,m,_,v,b):(t.bindVertexArray.set(this.vao),_&&_.bind(),c&&c.dynamicDraw&&c.bind(),v&&v.bind(),b&&b.bind())}freshBind(t,n,o,a,c,m,_,v){const b=t.numAttributes,P=this.context,E=P.gl;this.vao&&this.destroy(),this.vao=P.createVertexArray(),P.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=o,this.boundIndexBuffer=a,this.boundVertexOffset=c,this.boundDynamicVertexBuffer=m,this.boundDynamicVertexBuffer2=_,this.boundDynamicVertexBuffer3=v,n.enableAttributes(E,t);for(const z of o)z.enableAttributes(E,t);m&&m.enableAttributes(E,t),_&&_.enableAttributes(E,t),v&&v.enableAttributes(E,t),n.bind(),n.setVertexAttribPointers(E,t,c);for(const z of o)z.bind(),z.setVertexAttribPointers(E,t,c);m&&(m.bind(),m.setVertexAttribPointers(E,t,c)),a&&a.bind(),_&&(_.bind(),_.setVertexAttribPointers(E,t,c)),v&&(v.bind(),v.setVertexAttribPointers(E,t,c)),P.currentNumAttributes=b}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const $o=(h,t,n,o,a)=>({u_matrix:h,u_texture:0,u_ele_delta:t,u_fog_matrix:n,u_fog_color:o?o.properties.get("fog-color"):u.aN.white,u_fog_ground_blend:o?o.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:o?o.calculateFogBlendOpacity(a):0,u_horizon_color:o?o.properties.get("horizon-color"):u.aN.white,u_horizon_fog_blend:o?o.properties.get("horizon-fog-blend"):1});function ds(h){const t=[];for(let n=0;n<h.length;n++){if(h[n]===null)continue;const o=h[n].split(" ");t.push(o.pop())}return t}class qs{constructor(t,n,o,a,c,m){const _=t.gl;this.program=_.createProgram();const v=ds(n.staticAttributes),b=o?o.getBinderAttributes():[],P=v.concat(b),E=Gr.prelude.staticUniforms?ds(Gr.prelude.staticUniforms):[],z=n.staticUniforms?ds(n.staticUniforms):[],B=o?o.getBinderUniforms():[],V=E.concat(z).concat(B),q=[];for(const le of V)q.indexOf(le)<0&&q.push(le);const j=o?o.defines():[];c&&j.push("#define OVERDRAW_INSPECTOR;"),m&&j.push("#define TERRAIN3D;");const H=j.concat(Gr.prelude.fragmentSource,n.fragmentSource).join(`
|
579
|
+
`),J=j.concat(Gr.prelude.vertexSource,n.vertexSource).join(`
|
580
|
+
`),N=_.createShader(_.FRAGMENT_SHADER);if(_.isContextLost())return void(this.failedToCreate=!0);if(_.shaderSource(N,H),_.compileShader(N),!_.getShaderParameter(N,_.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${_.getShaderInfoLog(N)}`);_.attachShader(this.program,N);const ee=_.createShader(_.VERTEX_SHADER);if(_.isContextLost())return void(this.failedToCreate=!0);if(_.shaderSource(ee,J),_.compileShader(ee),!_.getShaderParameter(ee,_.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${_.getShaderInfoLog(ee)}`);_.attachShader(this.program,ee),this.attributes={};const ne={};this.numAttributes=P.length;for(let le=0;le<this.numAttributes;le++)P[le]&&(_.bindAttribLocation(this.program,le,P[le]),this.attributes[P[le]]=le);if(_.linkProgram(this.program),!_.getProgramParameter(this.program,_.LINK_STATUS))throw new Error(`Program failed to link: ${_.getProgramInfoLog(this.program)}`);_.deleteShader(ee),_.deleteShader(N);for(let le=0;le<q.length;le++){const ge=q[le];if(ge&&!ne[ge]){const ve=_.getUniformLocation(this.program,ge);ve&&(ne[ge]=ve)}}this.fixedUniforms=a(t,ne),this.terrainUniforms=((le,ge)=>({u_depth:new u.aI(le,ge.u_depth),u_terrain:new u.aI(le,ge.u_terrain),u_terrain_dim:new u.aJ(le,ge.u_terrain_dim),u_terrain_matrix:new u.aK(le,ge.u_terrain_matrix),u_terrain_unpack:new u.aL(le,ge.u_terrain_unpack),u_terrain_exaggeration:new u.aJ(le,ge.u_terrain_exaggeration)}))(t,ne),this.binderUniforms=o?o.getUniforms(t,ne):[]}draw(t,n,o,a,c,m,_,v,b,P,E,z,B,V,q,j,H,J){const N=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(o),t.setStencilMode(a),t.setColorMode(c),t.setCullFace(m),v){t.activeTexture.set(N.TEXTURE2),N.bindTexture(N.TEXTURE_2D,v.depthTexture),t.activeTexture.set(N.TEXTURE3),N.bindTexture(N.TEXTURE_2D,v.texture);for(const ne in this.terrainUniforms)this.terrainUniforms[ne].set(v[ne])}for(const ne in this.fixedUniforms)this.fixedUniforms[ne].set(_[ne]);q&&q.setUniforms(t,this.binderUniforms,B,{zoom:V});let ee=0;switch(n){case N.LINES:ee=2;break;case N.TRIANGLES:ee=3;break;case N.LINE_STRIP:ee=1}for(const ne of z.get()){const le=ne.vaos||(ne.vaos={});(le[b]||(le[b]=new $s)).bind(t,this,P,q?q.getPaintVertexBuffers():[],E,ne.vertexOffset,j,H,J),N.drawElements(n,ne.primitiveLength*ee,N.UNSIGNED_SHORT,ne.primitiveOffset*ee*2)}}}function Zs(h,t,n){const o=1/nt(n,1,t.transform.tileZoom),a=Math.pow(2,n.tileID.overscaledZ),c=n.tileSize*Math.pow(2,t.transform.tileZoom)/a,m=c*(n.tileID.canonical.x+n.tileID.wrap*a),_=c*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[o,h.fromScale,h.toScale],u_fade:h.t,u_pixel_coord_upper:[m>>16,_>>16],u_pixel_coord_lower:[65535&m,65535&_]}}const Gs=(h,t,n,o)=>{const a=t.style.light,c=a.properties.get("position"),m=[c.x,c.y,c.z],_=function(){var b=new u.A(9);return u.A!=Float32Array&&(b[1]=0,b[2]=0,b[3]=0,b[5]=0,b[6]=0,b[7]=0),b[0]=1,b[4]=1,b[8]=1,b}();a.properties.get("anchor")==="viewport"&&function(b,P){var E=Math.sin(P),z=Math.cos(P);b[0]=z,b[1]=E,b[2]=0,b[3]=-E,b[4]=z,b[5]=0,b[6]=0,b[7]=0,b[8]=1}(_,-t.transform.angle),function(b,P,E){var z=P[0],B=P[1],V=P[2];b[0]=z*E[0]+B*E[3]+V*E[6],b[1]=z*E[1]+B*E[4]+V*E[7],b[2]=z*E[2]+B*E[5]+V*E[8]}(m,m,_);const v=a.properties.get("color");return{u_matrix:h,u_lightpos:m,u_lightintensity:a.properties.get("intensity"),u_lightcolor:[v.r,v.g,v.b],u_vertical_gradient:+n,u_opacity:o}},Hs=(h,t,n,o,a,c,m)=>u.e(Gs(h,t,n,o),Zs(c,t,m),{u_height_factor:-Math.pow(2,a.overscaledZ)/m.tileSize/8}),ps=h=>({u_matrix:h}),zn=(h,t,n,o)=>u.e(ps(h),Zs(n,t,o)),Lc=(h,t)=>({u_matrix:h,u_world:t}),Rc=(h,t,n,o,a)=>u.e(zn(h,t,n,o),{u_world:a}),hl=(h,t,n,o)=>{const a=h.transform;let c,m;if(o.paint.get("circle-pitch-alignment")==="map"){const _=nt(n,1,a.zoom);c=!0,m=[_,_]}else c=!1,m=a.pixelsToGLUnits;return{u_camera_to_center_distance:a.cameraToCenterDistance,u_scale_with_map:+(o.paint.get("circle-pitch-scale")==="map"),u_matrix:h.translatePosMatrix(t.posMatrix,n,o.paint.get("circle-translate"),o.paint.get("circle-translate-anchor")),u_pitch_with_map:+c,u_device_pixel_ratio:h.pixelRatio,u_extrude_scale:m}},Bc=(h,t,n)=>({u_matrix:h,u_inv_matrix:t,u_camera_to_center_distance:n.cameraToCenterDistance,u_viewport_size:[n.width,n.height]}),Hr=(h,t,n=1)=>({u_matrix:h,u_color:t,u_overlay:0,u_overlay_scale:n}),fs=h=>({u_matrix:h}),ji=(h,t,n,o)=>({u_matrix:h,u_extrude_scale:nt(t,1,n),u_intensity:o});function Ui(h,t){const n=Math.pow(2,t.canonical.z),o=t.canonical.y;return[new u.Z(0,o/n).toLngLat().lat,new u.Z(0,(o+1)/n).toLngLat().lat]}const ms=(h,t,n,o)=>{const a=h.transform;return{u_matrix:pl(h,t,n,o),u_ratio:1/nt(t,1,a.zoom),u_device_pixel_ratio:h.pixelRatio,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},Xs=(h,t,n,o,a)=>u.e(ms(h,t,n,a),{u_image:0,u_image_height:o}),ul=(h,t,n,o,a)=>{const c=h.transform,m=hn(t,c);return{u_matrix:pl(h,t,n,a),u_texsize:t.imageAtlasTexture.size,u_ratio:1/nt(t,1,c.zoom),u_device_pixel_ratio:h.pixelRatio,u_image:0,u_scale:[m,o.fromScale,o.toScale],u_fade:o.t,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]]}},dl=(h,t,n,o,a,c)=>{const m=h.lineAtlas,_=hn(t,h.transform),v=n.layout.get("line-cap")==="round",b=m.getDash(o.from,v),P=m.getDash(o.to,v),E=b.width*a.fromScale,z=P.width*a.toScale;return u.e(ms(h,t,n,c),{u_patternscale_a:[_/E,-b.height/2],u_patternscale_b:[_/z,-P.height/2],u_sdfgamma:m.width/(256*Math.min(E,z)*h.pixelRatio)/2,u_image:0,u_tex_y_a:b.y,u_tex_y_b:P.y,u_mix:a.t})};function hn(h,t){return 1/nt(h,1,t.tileZoom)}function pl(h,t,n,o){return h.translatePosMatrix(o?o.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const Fc=(h,t,n,o,a)=>{return{u_matrix:h,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:o.mix,u_opacity:o.opacity*a.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:a.paint.get("raster-brightness-min"),u_brightness_high:a.paint.get("raster-brightness-max"),u_saturation_factor:(m=a.paint.get("raster-saturation"),m>0?1-1/(1.001-m):-m),u_contrast_factor:(c=a.paint.get("raster-contrast"),c>0?1/(1-c):1+c),u_spin_weights:Oc(a.paint.get("raster-hue-rotate"))};var c,m};function Oc(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 fl=(h,t,n,o,a,c,m,_,v,b,P,E,z,B)=>{const V=m.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:V.cameraToCenterDistance,u_pitch:V.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:V.width/V.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_matrix:_,u_label_plane_matrix:v,u_coord_matrix:b,u_is_text:+E,u_pitch_with_map:+o,u_is_along_line:a,u_is_variable_anchor:c,u_texsize:z,u_texture:0,u_translation:P,u_pitched_scale:B}},ml=(h,t,n,o,a,c,m,_,v,b,P,E,z,B,V)=>{const q=m.transform;return u.e(fl(h,t,n,o,a,c,m,_,v,b,P,E,z,V),{u_gamma_scale:o?Math.cos(q._pitch)*q.cameraToCenterDistance:1,u_device_pixel_ratio:m.pixelRatio,u_is_halo:+B})},Vc=(h,t,n,o,a,c,m,_,v,b,P,E,z,B)=>u.e(ml(h,t,n,o,a,c,m,_,v,b,P,!0,E,!0,B),{u_texsize_icon:z,u_texture_icon:1}),Ws=(h,t,n)=>({u_matrix:h,u_opacity:t,u_color:n}),qo=(h,t,n,o,a,c)=>u.e(function(m,_,v,b){const P=v.imageManager.getPattern(m.from.toString()),E=v.imageManager.getPattern(m.to.toString()),{width:z,height:B}=v.imageManager.getPixelSize(),V=Math.pow(2,b.tileID.overscaledZ),q=b.tileSize*Math.pow(2,v.transform.tileZoom)/V,j=q*(b.tileID.canonical.x+b.tileID.wrap*V),H=q*b.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:P.tl,u_pattern_br_a:P.br,u_pattern_tl_b:E.tl,u_pattern_br_b:E.br,u_texsize:[z,B],u_mix:_.t,u_pattern_size_a:P.displaySize,u_pattern_size_b:E.displaySize,u_scale_a:_.fromScale,u_scale_b:_.toScale,u_tile_units_to_pixels:1/nt(b,1,v.transform.tileZoom),u_pixel_coord_upper:[j>>16,H>>16],u_pixel_coord_lower:[65535&j,65535&H]}}(o,c,n,a),{u_matrix:h,u_opacity:t}),Js={fillExtrusion:(h,t)=>({u_matrix:new u.aK(h,t.u_matrix),u_lightpos:new u.aO(h,t.u_lightpos),u_lightintensity:new u.aJ(h,t.u_lightintensity),u_lightcolor:new u.aO(h,t.u_lightcolor),u_vertical_gradient:new u.aJ(h,t.u_vertical_gradient),u_opacity:new u.aJ(h,t.u_opacity)}),fillExtrusionPattern:(h,t)=>({u_matrix:new u.aK(h,t.u_matrix),u_lightpos:new u.aO(h,t.u_lightpos),u_lightintensity:new u.aJ(h,t.u_lightintensity),u_lightcolor:new u.aO(h,t.u_lightcolor),u_vertical_gradient:new u.aJ(h,t.u_vertical_gradient),u_height_factor:new u.aJ(h,t.u_height_factor),u_image:new u.aI(h,t.u_image),u_texsize:new u.aP(h,t.u_texsize),u_pixel_coord_upper:new u.aP(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new u.aP(h,t.u_pixel_coord_lower),u_scale:new u.aO(h,t.u_scale),u_fade:new u.aJ(h,t.u_fade),u_opacity:new u.aJ(h,t.u_opacity)}),fill:(h,t)=>({u_matrix:new u.aK(h,t.u_matrix)}),fillPattern:(h,t)=>({u_matrix:new u.aK(h,t.u_matrix),u_image:new u.aI(h,t.u_image),u_texsize:new u.aP(h,t.u_texsize),u_pixel_coord_upper:new u.aP(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new u.aP(h,t.u_pixel_coord_lower),u_scale:new u.aO(h,t.u_scale),u_fade:new u.aJ(h,t.u_fade)}),fillOutline:(h,t)=>({u_matrix:new u.aK(h,t.u_matrix),u_world:new u.aP(h,t.u_world)}),fillOutlinePattern:(h,t)=>({u_matrix:new u.aK(h,t.u_matrix),u_world:new u.aP(h,t.u_world),u_image:new u.aI(h,t.u_image),u_texsize:new u.aP(h,t.u_texsize),u_pixel_coord_upper:new u.aP(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new u.aP(h,t.u_pixel_coord_lower),u_scale:new u.aO(h,t.u_scale),u_fade:new u.aJ(h,t.u_fade)}),circle:(h,t)=>({u_camera_to_center_distance:new u.aJ(h,t.u_camera_to_center_distance),u_scale_with_map:new u.aI(h,t.u_scale_with_map),u_pitch_with_map:new u.aI(h,t.u_pitch_with_map),u_extrude_scale:new u.aP(h,t.u_extrude_scale),u_device_pixel_ratio:new u.aJ(h,t.u_device_pixel_ratio),u_matrix:new u.aK(h,t.u_matrix)}),collisionBox:(h,t)=>({u_matrix:new u.aK(h,t.u_matrix),u_pixel_extrude_scale:new u.aP(h,t.u_pixel_extrude_scale)}),collisionCircle:(h,t)=>({u_matrix:new u.aK(h,t.u_matrix),u_inv_matrix:new u.aK(h,t.u_inv_matrix),u_camera_to_center_distance:new u.aJ(h,t.u_camera_to_center_distance),u_viewport_size:new u.aP(h,t.u_viewport_size)}),debug:(h,t)=>({u_color:new u.aM(h,t.u_color),u_matrix:new u.aK(h,t.u_matrix),u_overlay:new u.aI(h,t.u_overlay),u_overlay_scale:new u.aJ(h,t.u_overlay_scale)}),clippingMask:(h,t)=>({u_matrix:new u.aK(h,t.u_matrix)}),heatmap:(h,t)=>({u_extrude_scale:new u.aJ(h,t.u_extrude_scale),u_intensity:new u.aJ(h,t.u_intensity),u_matrix:new u.aK(h,t.u_matrix)}),heatmapTexture:(h,t)=>({u_matrix:new u.aK(h,t.u_matrix),u_world:new u.aP(h,t.u_world),u_image:new u.aI(h,t.u_image),u_color_ramp:new u.aI(h,t.u_color_ramp),u_opacity:new u.aJ(h,t.u_opacity)}),hillshade:(h,t)=>({u_matrix:new u.aK(h,t.u_matrix),u_image:new u.aI(h,t.u_image),u_latrange:new u.aP(h,t.u_latrange),u_light:new u.aP(h,t.u_light),u_shadow:new u.aM(h,t.u_shadow),u_highlight:new u.aM(h,t.u_highlight),u_accent:new u.aM(h,t.u_accent)}),hillshadePrepare:(h,t)=>({u_matrix:new u.aK(h,t.u_matrix),u_image:new u.aI(h,t.u_image),u_dimension:new u.aP(h,t.u_dimension),u_zoom:new u.aJ(h,t.u_zoom),u_unpack:new u.aL(h,t.u_unpack)}),line:(h,t)=>({u_matrix:new u.aK(h,t.u_matrix),u_ratio:new u.aJ(h,t.u_ratio),u_device_pixel_ratio:new u.aJ(h,t.u_device_pixel_ratio),u_units_to_pixels:new u.aP(h,t.u_units_to_pixels)}),lineGradient:(h,t)=>({u_matrix:new u.aK(h,t.u_matrix),u_ratio:new u.aJ(h,t.u_ratio),u_device_pixel_ratio:new u.aJ(h,t.u_device_pixel_ratio),u_units_to_pixels:new u.aP(h,t.u_units_to_pixels),u_image:new u.aI(h,t.u_image),u_image_height:new u.aJ(h,t.u_image_height)}),linePattern:(h,t)=>({u_matrix:new u.aK(h,t.u_matrix),u_texsize:new u.aP(h,t.u_texsize),u_ratio:new u.aJ(h,t.u_ratio),u_device_pixel_ratio:new u.aJ(h,t.u_device_pixel_ratio),u_image:new u.aI(h,t.u_image),u_units_to_pixels:new u.aP(h,t.u_units_to_pixels),u_scale:new u.aO(h,t.u_scale),u_fade:new u.aJ(h,t.u_fade)}),lineSDF:(h,t)=>({u_matrix:new u.aK(h,t.u_matrix),u_ratio:new u.aJ(h,t.u_ratio),u_device_pixel_ratio:new u.aJ(h,t.u_device_pixel_ratio),u_units_to_pixels:new u.aP(h,t.u_units_to_pixels),u_patternscale_a:new u.aP(h,t.u_patternscale_a),u_patternscale_b:new u.aP(h,t.u_patternscale_b),u_sdfgamma:new u.aJ(h,t.u_sdfgamma),u_image:new u.aI(h,t.u_image),u_tex_y_a:new u.aJ(h,t.u_tex_y_a),u_tex_y_b:new u.aJ(h,t.u_tex_y_b),u_mix:new u.aJ(h,t.u_mix)}),raster:(h,t)=>({u_matrix:new u.aK(h,t.u_matrix),u_tl_parent:new u.aP(h,t.u_tl_parent),u_scale_parent:new u.aJ(h,t.u_scale_parent),u_buffer_scale:new u.aJ(h,t.u_buffer_scale),u_fade_t:new u.aJ(h,t.u_fade_t),u_opacity:new u.aJ(h,t.u_opacity),u_image0:new u.aI(h,t.u_image0),u_image1:new u.aI(h,t.u_image1),u_brightness_low:new u.aJ(h,t.u_brightness_low),u_brightness_high:new u.aJ(h,t.u_brightness_high),u_saturation_factor:new u.aJ(h,t.u_saturation_factor),u_contrast_factor:new u.aJ(h,t.u_contrast_factor),u_spin_weights:new u.aO(h,t.u_spin_weights)}),symbolIcon:(h,t)=>({u_is_size_zoom_constant:new u.aI(h,t.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aI(h,t.u_is_size_feature_constant),u_size_t:new u.aJ(h,t.u_size_t),u_size:new u.aJ(h,t.u_size),u_camera_to_center_distance:new u.aJ(h,t.u_camera_to_center_distance),u_pitch:new u.aJ(h,t.u_pitch),u_rotate_symbol:new u.aI(h,t.u_rotate_symbol),u_aspect_ratio:new u.aJ(h,t.u_aspect_ratio),u_fade_change:new u.aJ(h,t.u_fade_change),u_matrix:new u.aK(h,t.u_matrix),u_label_plane_matrix:new u.aK(h,t.u_label_plane_matrix),u_coord_matrix:new u.aK(h,t.u_coord_matrix),u_is_text:new u.aI(h,t.u_is_text),u_pitch_with_map:new u.aI(h,t.u_pitch_with_map),u_is_along_line:new u.aI(h,t.u_is_along_line),u_is_variable_anchor:new u.aI(h,t.u_is_variable_anchor),u_texsize:new u.aP(h,t.u_texsize),u_texture:new u.aI(h,t.u_texture),u_translation:new u.aP(h,t.u_translation),u_pitched_scale:new u.aJ(h,t.u_pitched_scale)}),symbolSDF:(h,t)=>({u_is_size_zoom_constant:new u.aI(h,t.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aI(h,t.u_is_size_feature_constant),u_size_t:new u.aJ(h,t.u_size_t),u_size:new u.aJ(h,t.u_size),u_camera_to_center_distance:new u.aJ(h,t.u_camera_to_center_distance),u_pitch:new u.aJ(h,t.u_pitch),u_rotate_symbol:new u.aI(h,t.u_rotate_symbol),u_aspect_ratio:new u.aJ(h,t.u_aspect_ratio),u_fade_change:new u.aJ(h,t.u_fade_change),u_matrix:new u.aK(h,t.u_matrix),u_label_plane_matrix:new u.aK(h,t.u_label_plane_matrix),u_coord_matrix:new u.aK(h,t.u_coord_matrix),u_is_text:new u.aI(h,t.u_is_text),u_pitch_with_map:new u.aI(h,t.u_pitch_with_map),u_is_along_line:new u.aI(h,t.u_is_along_line),u_is_variable_anchor:new u.aI(h,t.u_is_variable_anchor),u_texsize:new u.aP(h,t.u_texsize),u_texture:new u.aI(h,t.u_texture),u_gamma_scale:new u.aJ(h,t.u_gamma_scale),u_device_pixel_ratio:new u.aJ(h,t.u_device_pixel_ratio),u_is_halo:new u.aI(h,t.u_is_halo),u_translation:new u.aP(h,t.u_translation),u_pitched_scale:new u.aJ(h,t.u_pitched_scale)}),symbolTextAndIcon:(h,t)=>({u_is_size_zoom_constant:new u.aI(h,t.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aI(h,t.u_is_size_feature_constant),u_size_t:new u.aJ(h,t.u_size_t),u_size:new u.aJ(h,t.u_size),u_camera_to_center_distance:new u.aJ(h,t.u_camera_to_center_distance),u_pitch:new u.aJ(h,t.u_pitch),u_rotate_symbol:new u.aI(h,t.u_rotate_symbol),u_aspect_ratio:new u.aJ(h,t.u_aspect_ratio),u_fade_change:new u.aJ(h,t.u_fade_change),u_matrix:new u.aK(h,t.u_matrix),u_label_plane_matrix:new u.aK(h,t.u_label_plane_matrix),u_coord_matrix:new u.aK(h,t.u_coord_matrix),u_is_text:new u.aI(h,t.u_is_text),u_pitch_with_map:new u.aI(h,t.u_pitch_with_map),u_is_along_line:new u.aI(h,t.u_is_along_line),u_is_variable_anchor:new u.aI(h,t.u_is_variable_anchor),u_texsize:new u.aP(h,t.u_texsize),u_texsize_icon:new u.aP(h,t.u_texsize_icon),u_texture:new u.aI(h,t.u_texture),u_texture_icon:new u.aI(h,t.u_texture_icon),u_gamma_scale:new u.aJ(h,t.u_gamma_scale),u_device_pixel_ratio:new u.aJ(h,t.u_device_pixel_ratio),u_is_halo:new u.aI(h,t.u_is_halo),u_translation:new u.aP(h,t.u_translation),u_pitched_scale:new u.aJ(h,t.u_pitched_scale)}),background:(h,t)=>({u_matrix:new u.aK(h,t.u_matrix),u_opacity:new u.aJ(h,t.u_opacity),u_color:new u.aM(h,t.u_color)}),backgroundPattern:(h,t)=>({u_matrix:new u.aK(h,t.u_matrix),u_opacity:new u.aJ(h,t.u_opacity),u_image:new u.aI(h,t.u_image),u_pattern_tl_a:new u.aP(h,t.u_pattern_tl_a),u_pattern_br_a:new u.aP(h,t.u_pattern_br_a),u_pattern_tl_b:new u.aP(h,t.u_pattern_tl_b),u_pattern_br_b:new u.aP(h,t.u_pattern_br_b),u_texsize:new u.aP(h,t.u_texsize),u_mix:new u.aJ(h,t.u_mix),u_pattern_size_a:new u.aP(h,t.u_pattern_size_a),u_pattern_size_b:new u.aP(h,t.u_pattern_size_b),u_scale_a:new u.aJ(h,t.u_scale_a),u_scale_b:new u.aJ(h,t.u_scale_b),u_pixel_coord_upper:new u.aP(h,t.u_pixel_coord_upper),u_pixel_coord_lower:new u.aP(h,t.u_pixel_coord_lower),u_tile_units_to_pixels:new u.aJ(h,t.u_tile_units_to_pixels)}),terrain:(h,t)=>({u_matrix:new u.aK(h,t.u_matrix),u_texture:new u.aI(h,t.u_texture),u_ele_delta:new u.aJ(h,t.u_ele_delta),u_fog_matrix:new u.aK(h,t.u_fog_matrix),u_fog_color:new u.aM(h,t.u_fog_color),u_fog_ground_blend:new u.aJ(h,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new u.aJ(h,t.u_fog_ground_blend_opacity),u_horizon_color:new u.aM(h,t.u_horizon_color),u_horizon_fog_blend:new u.aJ(h,t.u_horizon_fog_blend)}),terrainDepth:(h,t)=>({u_matrix:new u.aK(h,t.u_matrix),u_ele_delta:new u.aJ(h,t.u_ele_delta)}),terrainCoords:(h,t)=>({u_matrix:new u.aK(h,t.u_matrix),u_texture:new u.aI(h,t.u_texture),u_terrain_coords_id:new u.aJ(h,t.u_terrain_coords_id),u_ele_delta:new u.aJ(h,t.u_ele_delta)}),sky:(h,t)=>({u_sky_color:new u.aM(h,t.u_sky_color),u_horizon_color:new u.aM(h,t.u_horizon_color),u_horizon:new u.aJ(h,t.u_horizon),u_sky_horizon_blend:new u.aJ(h,t.u_sky_horizon_blend)})};class Zo{constructor(t,n,o){this.context=t;const a=t.gl;this.buffer=a.createBuffer(),this.dynamicDraw=!!o,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.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 Go={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class xr{constructor(t,n,o,a){this.length=n.length,this.attributes=o,this.itemSize=n.bytesPerElement,this.dynamicDraw=a,this.context=t;const c=t.gl;this.buffer=c.createBuffer(),t.bindVertexBuffer.set(this.buffer),c.bufferData(c.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?c.DYNAMIC_DRAW:c.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 o=0;o<this.attributes.length;o++){const a=n.attributes[this.attributes[o].name];a!==void 0&&t.enableVertexAttribArray(a)}}setVertexAttribPointers(t,n,o){for(let a=0;a<this.attributes.length;a++){const c=this.attributes[a],m=n.attributes[c.name];m!==void 0&&t.vertexAttribPointer(m,c.components,t[Go[c.type]],!1,this.itemSize,c.offset+this.itemSize*(o||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ho=new WeakMap;function Dn(h){var t;if(Ho.has(h))return Ho.get(h);{const n=(t=h.getParameter(h.VERSION))===null||t===void 0?void 0:t.startsWith("WebGL 2.0");return Ho.set(h,n),n}}class pt{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 gs extends pt{getDefault(){return u.aN.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 Nc extends pt{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Ks extends pt{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class jc extends pt{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 Ln extends pt{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Uc extends pt{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class gl extends pt{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 $c extends pt{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 _l extends pt{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 Xo extends pt{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 yl extends pt{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 xl extends pt{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class vl extends pt{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 pt{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 un extends pt{getDefault(){return u.aN.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 wl extends pt{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class qc extends pt{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 Zc extends pt{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Sl extends pt{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class _s extends pt{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Gc extends pt{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Ys extends pt{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 Hc extends pt{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 Xc extends pt{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 Tl extends pt{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 Il extends pt{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 Pl extends pt{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Wo extends pt{getDefault(){return null}set(t){var n;if(t===this.current&&!this.dirty)return;const o=this.gl;Dn(o)?o.bindVertexArray(t):(n=o.getExtension("OES_vertex_array_object"))===null||n===void 0||n.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class El extends pt{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 Qs extends pt{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 Dr extends pt{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 ys extends pt{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class Jo extends ys{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 Ko extends ys{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 Al extends ys{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 Yo{constructor(t,n,o,a,c){this.context=t,this.width=n,this.height=o;const m=t.gl,_=this.framebuffer=m.createFramebuffer();if(this.colorAttachment=new Jo(t,_),a)this.depthAttachment=c?new Al(t,_):new Ko(t,_);else if(c)throw new Error("Stencil cannot be set without depth");if(m.checkFramebufferStatus(m.FRAMEBUFFER)!==m.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 o=this.depthAttachment.get();o&&t.deleteRenderbuffer(o)}t.deleteFramebuffer(this.framebuffer)}}class Ct{constructor(t,n,o){this.blendFunction=t,this.blendColor=n,this.mask=o}}Ct.Replace=[1,0],Ct.disabled=new Ct(Ct.Replace,u.aN.transparent,[!1,!1,!1,!1]),Ct.unblended=new Ct(Ct.Replace,u.aN.transparent,[!0,!0,!0,!0]),Ct.alphaBlended=new Ct([1,771],u.aN.transparent,[!0,!0,!0,!0]);class Qo{constructor(t){var n,o;if(this.gl=t,this.clearColor=new gs(this),this.clearDepth=new Nc(this),this.clearStencil=new Ks(this),this.colorMask=new jc(this),this.depthMask=new Ln(this),this.stencilMask=new Uc(this),this.stencilFunc=new gl(this),this.stencilOp=new $c(this),this.stencilTest=new _l(this),this.depthRange=new Xo(this),this.depthTest=new yl(this),this.depthFunc=new xl(this),this.blend=new vl(this),this.blendFunc=new bl(this),this.blendColor=new un(this),this.blendEquation=new wl(this),this.cullFace=new qc(this),this.cullFaceSide=new Zc(this),this.frontFace=new Sl(this),this.program=new _s(this),this.activeTexture=new Gc(this),this.viewport=new Ys(this),this.bindFramebuffer=new Hc(this),this.bindRenderbuffer=new Xc(this),this.bindTexture=new Tl(this),this.bindVertexBuffer=new Il(this),this.bindElementBuffer=new Pl(this),this.bindVertexArray=new Wo(this),this.pixelStoreUnpack=new El(this),this.pixelStoreUnpackPremultiplyAlpha=new Qs(this),this.pixelStoreUnpackFlipY=new Dr(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),Dn(t)){this.HALF_FLOAT=t.HALF_FLOAT;const a=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(n=t.RGBA16F)!==null&&n!==void 0?n:a==null?void 0:a.RGBA16F_EXT,this.RGB16F=(o=t.RGB16F)!==null&&o!==void 0?o:a==null?void 0:a.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const a=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=a==null?void 0:a.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 Zo(this,t,n)}createVertexBuffer(t,n,o){return new xr(this,t,n,o)}createRenderbuffer(t,n,o){const a=this.gl,c=a.createRenderbuffer();return this.bindRenderbuffer.set(c),a.renderbufferStorage(a.RENDERBUFFER,t,n,o),this.bindRenderbuffer.set(null),c}createFramebuffer(t,n,o,a){return new Yo(this,t,n,o,a)}clear({color:t,depth:n,stencil:o}){const a=this.gl;let c=0;t&&(c|=a.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(c|=a.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),o!==void 0&&(c|=a.STENCIL_BUFFER_BIT,this.clearStencil.set(o),this.stencilMask.set(255)),a.clear(c)}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){u.aF(t.blendFunction,Ct.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 Dn(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 Dn(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 ht{constructor(t,n,o){this.func=t,this.mask=n,this.range=o}}ht.ReadOnly=!1,ht.ReadWrite=!0,ht.disabled=new ht(519,ht.ReadOnly,[0,1]);const ea=7680;class Nt{constructor(t,n,o,a,c,m){this.test=t,this.ref=n,this.mask=o,this.fail=a,this.depthFail=c,this.pass=m}}Nt.disabled=new Nt({func:519,mask:0},0,0,ea,ea,ea);class Dt{constructor(t,n,o){this.enable=t,this.mode=n,this.frontFace=o}}let xs;function Cl(h,t,n,o,a){const c=h.context,m=c.gl,_=h.useProgram("collisionBox"),v=[];let b=0,P=0;for(let H=0;H<o.length;H++){const J=o[H],N=t.getTile(J).getBucket(n);if(!N)continue;const ee=a?N.textCollisionBox:N.iconCollisionBox,ne=N.collisionCircleArray;if(ne.length>0){const le=u.H();u.aR(le,N.placementInvProjMatrix,h.transform.glCoordMatrix),u.aR(le,le,N.placementViewportMatrix),v.push({circleArray:ne,circleOffset:P,transform:J.posMatrix,invTransform:le,coord:J}),b+=ne.length/4,P=b}ee&&_.draw(c,m.LINES,ht.disabled,Nt.disabled,h.colorModeForRenderPass(),Dt.disabled,{u_matrix:J.posMatrix,u_pixel_extrude_scale:[1/(E=h.transform).width,1/E.height]},h.style.map.terrain&&h.style.map.terrain.getTerrainData(J),n.id,ee.layoutVertexBuffer,ee.indexBuffer,ee.segments,null,h.transform.zoom,null,null,ee.collisionVertexBuffer)}var E;if(!a||!v.length)return;const z=h.useProgram("collisionCircle"),B=new u.aS;B.resize(4*b),B._trim();let V=0;for(const H of v)for(let J=0;J<H.circleArray.length/4;J++){const N=4*J,ee=H.circleArray[N+0],ne=H.circleArray[N+1],le=H.circleArray[N+2],ge=H.circleArray[N+3];B.emplace(V++,ee,ne,le,ge,0),B.emplace(V++,ee,ne,le,ge,1),B.emplace(V++,ee,ne,le,ge,2),B.emplace(V++,ee,ne,le,ge,3)}(!xs||xs.length<2*b)&&(xs=function(H){const J=2*H,N=new u.aU;N.resize(J),N._trim();for(let ee=0;ee<J;ee++){const ne=6*ee;N.uint16[ne+0]=4*ee+0,N.uint16[ne+1]=4*ee+1,N.uint16[ne+2]=4*ee+2,N.uint16[ne+3]=4*ee+2,N.uint16[ne+4]=4*ee+3,N.uint16[ne+5]=4*ee+0}return N}(b));const q=c.createIndexBuffer(xs,!0),j=c.createVertexBuffer(B,u.aT.members,!0);for(const H of v){const J=Bc(H.transform,H.invTransform,h.transform);z.draw(c,m.TRIANGLES,ht.disabled,Nt.disabled,h.colorModeForRenderPass(),Dt.disabled,J,h.style.map.terrain&&h.style.map.terrain.getTerrainData(H.coord),n.id,j,q,u.a0.simpleSegment(0,2*H.circleOffset,H.circleArray.length,H.circleArray.length/2),null,h.transform.zoom,null,null,null)}j.destroy(),q.destroy()}Dt.disabled=new Dt(!1,1029,2305),Dt.backCCW=new Dt(!0,1029,2305);const ta=u.ao(new Float32Array(16));function eo(h,t,n,o,a,c){const{horizontalAlign:m,verticalAlign:_}=u.av(h);return new u.P((-(m-.5)*t/a+o[0])*c,(-(_-.5)*n/a+o[1])*c)}function to(h,t,n,o,a,c){const m=t.tileAnchorPoint.add(new u.P(t.translation[0],t.translation[1]));if(t.pitchWithMap){let _=o.mult(c);return n||(_=_.rotate(-a)),G(m.add(_),t.labelPlaneMatrix,t.getElevation).point}if(n){const _=pe(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(h),v=Math.atan(_.y/_.x)+(_.x<0?Math.PI:0);return h.add(o.rotate(v))}return h.add(o)}function io(h,t,n,o,a,c,m,_,v,b,P,E,z,B){const V=h.text.placedSymbolArray,q=h.text.dynamicLayoutVertexArray,j=h.icon.dynamicLayoutVertexArray,H={};q.clear();for(let J=0;J<V.length;J++){const N=V.get(J),ee=N.hidden||!N.crossTileID||h.allowVerticalPlacement&&!N.placedOrientation?null:o[N.crossTileID];if(ee){const ne=new u.P(N.anchorX,N.anchorY),le={getElevation:B,width:a.width,height:a.height,labelPlaneMatrix:c,lineVertexArray:null,pitchWithMap:n,projection:P,projectionCache:null,tileAnchorPoint:ne,translation:E,unwrappedTileID:z},ge=n?G(ne,m,B):pe(ne.x,ne.y,le),ve=k(a.cameraToCenterDistance,ge.signedDistanceFromCamera);let De=u.aj(h.textSizeData,v,N)*ve/u.aq;n&&(De*=h.tilePixelRatio/_);const{width:Re,height:be,anchor:Se,textOffset:Ne,textBoxScale:it}=ee,Ee=eo(Se,Re,be,Ne,it,De),ke=P.getPitchedTextCorrection(a,ne.add(new u.P(E[0],E[1])),z),Qe=to(ge.point,le,t,Ee,a.angle,ke),Rt=h.allowVerticalPlacement&&N.placedOrientation===u.ai.vertical?Math.PI/2:0;for(let ot=0;ot<N.numGlyphs;ot++)u.ak(q,Qe,Rt);b&&N.associatedIconIndex>=0&&(H[N.associatedIconIndex]={shiftedAnchor:Qe,angle:Rt})}else He(N.numGlyphs,q)}if(b){j.clear();const J=h.icon.placedSymbolArray;for(let N=0;N<J.length;N++){const ee=J.get(N);if(ee.hidden)He(ee.numGlyphs,j);else{const ne=H[N];if(ne)for(let le=0;le<ee.numGlyphs;le++)u.ak(j,ne.shiftedAnchor,ne.angle);else He(ee.numGlyphs,j)}}h.icon.dynamicLayoutVertexBuffer.updateData(j)}h.text.dynamicLayoutVertexBuffer.updateData(q)}function ia(h,t,n){return n.iconsInText&&t?"symbolTextAndIcon":h?"symbolSDF":"symbolIcon"}function Xr(h,t,n,o,a,c,m,_,v,b,P,E){const z=h.context,B=z.gl,V=h.transform,q=js(),j=_==="map",H=v==="map",J=_!=="viewport"&&n.layout.get("symbol-placement")!=="point",N=j&&!H&&!J,ee=!H&&J,ne=!n.layout.get("symbol-sort-key").isConstant();let le=!1;const ge=h.depthModeForSublayer(0,ht.ReadOnly),ve=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),De=[],Re=q.getCircleRadiusCorrection(V);for(const be of o){const Se=t.getTile(be),Ne=Se.getBucket(n);if(!Ne)continue;const it=a?Ne.text:Ne.icon;if(!it||!it.segments.get().length||!it.hasVisibleVertices)continue;const Ee=it.programConfigurations.get(n.id),ke=a||Ne.sdfIcons,Qe=a?Ne.textSizeData:Ne.iconSizeData,Rt=H||V.pitch!==0,ot=h.useProgram(ia(ke,a,Ne),Ee),ut=u.ah(Qe,V.zoom),Bt=h.style.map.terrain&&h.style.map.terrain.getTerrainData(be);let pi,sr,Ft,Mi,Ii=[0,0],fi=null;if(a)sr=Se.glyphAtlasTexture,Ft=B.LINEAR,pi=Se.glyphAtlasTexture.size,Ne.iconsInText&&(Ii=Se.imageAtlasTexture.size,fi=Se.imageAtlasTexture,Mi=Rt||h.options.rotating||h.options.zooming||Qe.kind==="composite"||Qe.kind==="camera"?B.LINEAR:B.NEAREST);else{const jt=n.layout.get("icon-size").constantOr(0)!==1||Ne.iconsNeedLinear;sr=Se.imageAtlasTexture,Ft=ke||h.options.rotating||h.options.zooming||jt||Rt?B.LINEAR:B.NEAREST,pi=Se.imageAtlasTexture.size}const mi=nt(Se,1,h.transform.zoom),or=ee?be.posMatrix:ta,xn=qr(or,H,j,h.transform,mi),yo=yr(or,H,j,h.transform,mi),$n=yr(be.posMatrix,H,j,h.transform,mi),vn=q.translatePosition(h.transform,Se,c,m),xo=ve&&Ne.hasTextData(),Da=n.layout.get("icon-text-fit")!=="none"&&xo&&Ne.hasIconData();if(J){const jt=h.style.map.terrain?(La,ti)=>h.style.map.terrain.getElevation(be,La,ti):null,Zn=n.layout.get("text-rotation-alignment")==="map";O(Ne,be.posMatrix,h,a,xn,$n,H,b,Zn,q,be.toUnwrapped(),V.width,V.height,vn,jt)}const ai=be.posMatrix,ar=a&&ve||Da,Kr=J||ar?ta:xn,qn=yo,gi=ke&&n.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let _i;_i=ke?Ne.iconsInText?Vc(Qe.kind,ut,N,H,J,ar,h,ai,Kr,qn,vn,pi,Ii,Re):ml(Qe.kind,ut,N,H,J,ar,h,ai,Kr,qn,vn,a,pi,!0,Re):fl(Qe.kind,ut,N,H,J,ar,h,ai,Kr,qn,vn,a,pi,Re);const ni={program:ot,buffers:it,uniformValues:_i,atlasTexture:sr,atlasTextureIcon:fi,atlasInterpolation:Ft,atlasInterpolationIcon:Mi,isSDF:ke,hasHalo:gi};if(ne&&Ne.canOverlap){le=!0;const jt=it.segments.get();for(const Zn of jt)De.push({segments:new u.a0([Zn]),sortKey:Zn.sortKey,state:ni,terrainData:Bt})}else De.push({segments:it.segments,sortKey:0,state:ni,terrainData:Bt})}le&&De.sort((be,Se)=>be.sortKey-Se.sortKey);for(const be of De){const Se=be.state;if(z.activeTexture.set(B.TEXTURE0),Se.atlasTexture.bind(Se.atlasInterpolation,B.CLAMP_TO_EDGE),Se.atlasTextureIcon&&(z.activeTexture.set(B.TEXTURE1),Se.atlasTextureIcon&&Se.atlasTextureIcon.bind(Se.atlasInterpolationIcon,B.CLAMP_TO_EDGE)),Se.isSDF){const Ne=Se.uniformValues;Se.hasHalo&&(Ne.u_is_halo=1,dn(Se.buffers,be.segments,n,h,Se.program,ge,P,E,Ne,be.terrainData)),Ne.u_is_halo=0}dn(Se.buffers,be.segments,n,h,Se.program,ge,P,E,Se.uniformValues,be.terrainData)}}function dn(h,t,n,o,a,c,m,_,v,b){const P=o.context;a.draw(P,P.gl.TRIANGLES,c,m,_,Dt.disabled,v,b,n.id,h.layoutVertexBuffer,h.indexBuffer,t,n.paint,o.transform.zoom,h.programConfigurations.get(n.id),h.dynamicLayoutVertexBuffer,h.opacityVertexBuffer)}function $i(h,t,n,o,a){if(!n||!o||!o.imageAtlas)return;const c=o.imageAtlas.patternPositions;let m=c[n.to.toString()],_=c[n.from.toString()];if(!m&&_&&(m=_),!_&&m&&(_=m),!m||!_){const v=a.getPaintProperty(t);m=c[v],_=c[v]}m&&_&&h.setConstantPatternPositions(m,_)}function ra(h,t,n,o,a,c,m){const _=h.context.gl,v="fill-pattern",b=n.paint.get(v),P=b&&b.constantOr(1),E=n.getCrossfadeParameters();let z,B,V,q,j;m?(B=P&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",z=_.LINES):(B=P?"fillPattern":"fill",z=_.TRIANGLES);const H=b.constantOr(null);for(const J of o){const N=t.getTile(J);if(P&&!N.patternsLoaded())continue;const ee=N.getBucket(n);if(!ee)continue;const ne=ee.programConfigurations.get(n.id),le=h.useProgram(B,ne),ge=h.style.map.terrain&&h.style.map.terrain.getTerrainData(J);P&&(h.context.activeTexture.set(_.TEXTURE0),N.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),ne.updatePaintBuffers(E)),$i(ne,v,H,N,n);const ve=ge?J:null,De=h.translatePosMatrix(ve?ve.posMatrix:J.posMatrix,N,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(m){q=ee.indexBuffer2,j=ee.segments2;const Re=[_.drawingBufferWidth,_.drawingBufferHeight];V=B==="fillOutlinePattern"&&P?Rc(De,h,E,N,Re):Lc(De,Re)}else q=ee.indexBuffer,j=ee.segments,V=P?zn(De,h,E,N):ps(De);le.draw(h.context,z,a,h.stencilModeForClipping(J),c,Dt.disabled,V,ge,n.id,ee.layoutVertexBuffer,q,j,n.paint,h.transform.zoom,ne)}}function ro(h,t,n,o,a,c,m){const _=h.context,v=_.gl,b="fill-extrusion-pattern",P=n.paint.get(b),E=P.constantOr(1),z=n.getCrossfadeParameters(),B=n.paint.get("fill-extrusion-opacity"),V=P.constantOr(null);for(const q of o){const j=t.getTile(q),H=j.getBucket(n);if(!H)continue;const J=h.style.map.terrain&&h.style.map.terrain.getTerrainData(q),N=H.programConfigurations.get(n.id),ee=h.useProgram(E?"fillExtrusionPattern":"fillExtrusion",N);E&&(h.context.activeTexture.set(v.TEXTURE0),j.imageAtlasTexture.bind(v.LINEAR,v.CLAMP_TO_EDGE),N.updatePaintBuffers(z)),$i(N,b,V,j,n);const ne=h.translatePosMatrix(q.posMatrix,j,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),le=n.paint.get("fill-extrusion-vertical-gradient"),ge=E?Hs(ne,h,le,B,q,z,j):Gs(ne,h,le,B);ee.draw(_,_.gl.TRIANGLES,a,c,m,Dt.backCCW,ge,J,n.id,H.layoutVertexBuffer,H.indexBuffer,H.segments,n.paint,h.transform.zoom,N,h.style.map.terrain&&H.centroidVertexBuffer)}}function na(h,t,n,o,a,c,m){const _=h.context,v=_.gl,b=n.fbo;if(!b)return;const P=h.useProgram("hillshade"),E=h.style.map.terrain&&h.style.map.terrain.getTerrainData(t);_.activeTexture.set(v.TEXTURE0),v.bindTexture(v.TEXTURE_2D,b.colorAttachment.get()),P.draw(_,v.TRIANGLES,a,c,m,Dt.disabled,((z,B,V,q)=>{const j=V.paint.get("hillshade-shadow-color"),H=V.paint.get("hillshade-highlight-color"),J=V.paint.get("hillshade-accent-color");let N=V.paint.get("hillshade-illumination-direction")*(Math.PI/180);V.paint.get("hillshade-illumination-anchor")==="viewport"&&(N-=z.transform.angle);const ee=!z.options.moving;return{u_matrix:q?q.posMatrix:z.transform.calculatePosMatrix(B.tileID.toUnwrapped(),ee),u_image:0,u_latrange:Ui(0,B.tileID),u_light:[V.paint.get("hillshade-exaggeration"),N],u_shadow:j,u_highlight:H,u_accent:J}})(h,n,o,E?t:null),E,o.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments)}function pn(h,t,n,o,a,c){const m=h.context,_=m.gl,v=t.dem;if(v&&v.data){const b=v.dim,P=v.stride,E=v.getPixels();if(m.activeTexture.set(_.TEXTURE1),m.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||h.getTileTexture(P),t.demTexture){const B=t.demTexture;B.update(E,{premultiply:!1}),B.bind(_.NEAREST,_.CLAMP_TO_EDGE)}else t.demTexture=new vt(m,E,_.RGBA,{premultiply:!1}),t.demTexture.bind(_.NEAREST,_.CLAMP_TO_EDGE);m.activeTexture.set(_.TEXTURE0);let z=t.fbo;if(!z){const B=new vt(m,{width:b,height:b,data:null},_.RGBA);B.bind(_.LINEAR,_.CLAMP_TO_EDGE),z=t.fbo=m.createFramebuffer(b,b,!0,!1),z.colorAttachment.set(B.texture)}m.bindFramebuffer.set(z.framebuffer),m.viewport.set([0,0,b,b]),h.useProgram("hillshadePrepare").draw(m,_.TRIANGLES,o,a,c,Dt.disabled,((B,V)=>{const q=V.stride,j=u.H();return u.aQ(j,0,u.X,-u.X,0,0,1),u.J(j,j,[0,-u.X,0]),{u_matrix:j,u_image:1,u_dimension:[q,q],u_zoom:B.overscaledZ,u_unpack:V.getUnpackVector()}})(t.tileID,v),null,n.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function no(h,t,n,o,a,c){const m=o.paint.get("raster-fade-duration");if(!c&&m>0){const _=he.now(),v=(_-h.timeAdded)/m,b=t?(_-t.timeAdded)/m:-1,P=n.getSource(),E=a.coveringZoomLevel({tileSize:P.tileSize,roundZoom:P.roundZoom}),z=!t||Math.abs(t.tileID.overscaledZ-E)>Math.abs(h.tileID.overscaledZ-E),B=z&&h.refreshedUponExpiration?1:u.ad(z?v:1-b,0,1);return h.refreshedUponExpiration&&v>=1&&(h.refreshedUponExpiration=!1),t?{opacity:1,mix:1-B}:{opacity:B,mix:0}}return{opacity:1,mix:0}}const so=new u.aN(1,0,0,1),vs=new u.aN(0,1,0,1),oo=new u.aN(0,0,1,1),kl=new u.aN(1,0,1,1),Rn=new u.aN(0,1,1,1);function fn(h,t,n,o){Bn(h,0,t+n/2,h.transform.width,n,o)}function sa(h,t,n,o){Bn(h,t-n/2,0,n,h.transform.height,o)}function Bn(h,t,n,o,a,c){const m=h.context,_=m.gl;_.enable(_.SCISSOR_TEST),_.scissor(t*h.pixelRatio,n*h.pixelRatio,o*h.pixelRatio,a*h.pixelRatio),m.clear({color:c}),_.disable(_.SCISSOR_TEST)}function mt(h,t,n){const o=h.context,a=o.gl,c=n.posMatrix,m=h.useProgram("debug"),_=ht.disabled,v=Nt.disabled,b=h.colorModeForRenderPass(),P="$debug",E=h.style.map.terrain&&h.style.map.terrain.getTerrainData(n);o.activeTexture.set(a.TEXTURE0);const z=t.getTileByID(n.key).latestRawTileData,B=Math.floor((z&&z.byteLength||0)/1024),V=t.getTile(n).tileSize,q=512/Math.min(V,512)*(n.overscaledZ/h.transform.zoom)*.5;let j=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(j+=` => ${n.overscaledZ}`),function(H,J){H.initDebugOverlayCanvas();const N=H.debugOverlayCanvas,ee=H.context.gl,ne=H.debugOverlayCanvas.getContext("2d");ne.clearRect(0,0,N.width,N.height),ne.shadowColor="white",ne.shadowBlur=2,ne.lineWidth=1.5,ne.strokeStyle="white",ne.textBaseline="top",ne.font="bold 36px Open Sans, sans-serif",ne.fillText(J,5,5),ne.strokeText(J,5,5),H.debugOverlayTexture.update(N),H.debugOverlayTexture.bind(ee.LINEAR,ee.CLAMP_TO_EDGE)}(h,`${j} ${B}kB`),m.draw(o,a.TRIANGLES,_,v,Ct.alphaBlended,Dt.disabled,Hr(c,u.aN.transparent,q),null,P,h.debugBuffer,h.quadTriangleIndexBuffer,h.debugSegments),m.draw(o,a.LINE_STRIP,_,v,b,Dt.disabled,Hr(c,u.aN.red),E,P,h.debugBuffer,h.tileBorderIndexBuffer,h.debugSegments)}function bs(h,t,n){const o=h.context,a=o.gl,c=h.colorModeForRenderPass(),m=new ht(a.LEQUAL,ht.ReadWrite,h.depthRangeFor3D),_=h.useProgram("terrain"),v=t.getTerrainMesh();o.bindFramebuffer.set(null),o.viewport.set([0,0,h.width,h.height]);for(const b of n){const P=h.renderToTexture.getTexture(b),E=t.getTerrainData(b.tileID);o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,P.texture);const z=h.transform.calculatePosMatrix(b.tileID.toUnwrapped()),B=t.getMeshFrameDelta(h.transform.zoom),V=h.transform.calculateFogMatrix(b.tileID.toUnwrapped()),q=$o(z,B,V,h.style.sky,h.transform.pitch);_.draw(o,a.TRIANGLES,m,Nt.disabled,c,Dt.backCCW,q,E,"terrain",v.vertexBuffer,v.indexBuffer,v.segments)}}class Ml{constructor(t,n,o){this.vertexBuffer=t,this.indexBuffer=n,this.segments=o}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class zl{constructor(t,n){this.context=new Qo(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:u.ao(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Ye.maxUnderzooming+Ye.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Xi}resize(t,n,o){if(this.width=Math.floor(t*o),this.height=Math.floor(n*o),this.pixelRatio=o,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const a of this.style._order)this.style._layers[a].resize()}setup(){const t=this.context,n=new u.aX;n.emplaceBack(0,0),n.emplaceBack(u.X,0),n.emplaceBack(0,u.X),n.emplaceBack(u.X,u.X),this.tileExtentBuffer=t.createVertexBuffer(n,us.members),this.tileExtentSegments=u.a0.simpleSegment(0,0,4,2);const o=new u.aX;o.emplaceBack(0,0),o.emplaceBack(u.X,0),o.emplaceBack(0,u.X),o.emplaceBack(u.X,u.X),this.debugBuffer=t.createVertexBuffer(o,us.members),this.debugSegments=u.a0.simpleSegment(0,0,4,5);const a=new u.$;a.emplaceBack(0,0,0,0),a.emplaceBack(u.X,0,u.X,0),a.emplaceBack(0,u.X,0,u.X),a.emplaceBack(u.X,u.X,u.X,u.X),this.rasterBoundsBuffer=t.createVertexBuffer(a,Ur.members),this.rasterBoundsSegments=u.a0.simpleSegment(0,0,4,2);const c=new u.aX;c.emplaceBack(0,0),c.emplaceBack(1,0),c.emplaceBack(0,1),c.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(c,us.members),this.viewportSegments=u.a0.simpleSegment(0,0,4,2);const m=new u.aZ;m.emplaceBack(0),m.emplaceBack(1),m.emplaceBack(3),m.emplaceBack(2),m.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(m);const _=new u.aY;_.emplaceBack(0,1,2),_.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(_);const v=this.context.gl;this.stencilClearMode=new Nt({func:v.ALWAYS,mask:0},0,255,v.ZERO,v.ZERO,v.ZERO)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const o=u.H();u.aQ(o,0,this.width,this.height,0,0,1),u.K(o,o,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,ht.disabled,this.stencilClearMode,Ct.disabled,Dt.disabled,fs(o),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 o=this.context,a=o.gl;this.nextStencilID+n.length>256&&this.clearStencil(),o.setColorMode(Ct.disabled),o.setDepthMode(ht.disabled);const c=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const m of n){const _=this._tileClippingMaskIDs[m.key]=this.nextStencilID++,v=this.style.map.terrain&&this.style.map.terrain.getTerrainData(m);c.draw(o,a.TRIANGLES,ht.disabled,new Nt({func:a.ALWAYS,mask:0},_,255,a.KEEP,a.KEEP,a.REPLACE),Ct.disabled,Dt.disabled,fs(m.posMatrix),v,"$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 Nt({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new Nt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,o=t.sort((m,_)=>_.overscaledZ-m.overscaledZ),a=o[o.length-1].overscaledZ,c=o[0].overscaledZ-a+1;if(c>1){this.currentStencilSource=void 0,this.nextStencilID+c>256&&this.clearStencil();const m={};for(let _=0;_<c;_++)m[_+a]=new Nt({func:n.GEQUAL,mask:255},_+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=c,[m,o]}return[{[a]:Nt.disabled},o]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new Ct([t.CONSTANT_COLOR,t.ONE],new u.aN(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Ct.unblended:Ct.alphaBlended}depthModeForSublayer(t,n,o){if(!this.opaquePassEnabledForLayer())return ht.disabled;const a=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new ht(o||this.context.gl.LEQUAL,n,[a,a])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){var o;this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(he.now()),this.imageManager.beginFrame();const a=this.style._order,c=this.style.sourceCaches,m={},_={},v={};for(const b in c){const P=c[b];P.used&&P.prepare(this.context),m[b]=P.getVisibleCoordinates(),_[b]=m[b].slice().reverse(),v[b]=P.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let b=0;b<a.length;b++)if(this.style._layers[a[b]].is3D()){this.opaquePassCutoff=b;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const b of a){const P=this.style._layers[b];if(!P.hasOffscreenPass()||P.isHidden(this.transform.zoom))continue;const E=_[P.source];(P.type==="custom"||E.length)&&this.renderLayer(this,c[P.source],P,E)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?u.aN.black:u.aN.transparent,depth:1}),this.clearStencil(),!((o=this.style.stylesheet)===null||o===void 0)&&o.sky&&function(b,P){const E=b.context,z=E.gl,B=((J,N,ee)=>({u_sky_color:J.properties.get("sky-color"),u_horizon_color:J.properties.get("horizon-color"),u_horizon:(N.height/2+N.getHorizon())*ee,u_sky_horizon_blend:J.properties.get("sky-horizon-blend")*N.height/2*ee}))(P,b.style.map.transform,b.pixelRatio),V=new ht(z.LEQUAL,ht.ReadWrite,[0,1]),q=Nt.disabled,j=b.colorModeForRenderPass(),H=b.useProgram("sky");if(!P.mesh){const J=new u.aX;J.emplaceBack(-1,-1),J.emplaceBack(1,-1),J.emplaceBack(1,1),J.emplaceBack(-1,1);const N=new u.aY;N.emplaceBack(0,1,2),N.emplaceBack(0,2,3),P.mesh=new Ml(E.createVertexBuffer(J,us.members),E.createIndexBuffer(N),u.a0.simpleSegment(0,0,J.length,N.length))}H.draw(E,z.TRIANGLES,V,q,j,Dt.disabled,B,void 0,"sky",P.mesh.vertexBuffer,P.mesh.indexBuffer,P.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=a.length-1;this.currentLayer>=0;this.currentLayer--){const b=this.style._layers[a[this.currentLayer]],P=c[b.source],E=m[b.source];this._renderTileClippingMasks(b,E),this.renderLayer(this,P,b,E)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<a.length;this.currentLayer++){const b=this.style._layers[a[this.currentLayer]],P=c[b.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(b))continue;const E=(b.type==="symbol"?v:_)[b.source];this._renderTileClippingMasks(b,m[b.source]),this.renderLayer(this,P,b,E)}if(this.options.showTileBoundaries){const b=function(P,E){let z=null;const B=Object.values(P._layers).flatMap(H=>H.source&&!H.isHidden(E)?[P.sourceCaches[H.source]]:[]),V=B.filter(H=>H.getSource().type==="vector"),q=B.filter(H=>H.getSource().type!=="vector"),j=H=>{(!z||z.getSource().maxzoom<H.getSource().maxzoom)&&(z=H)};return V.forEach(H=>j(H)),z||q.forEach(H=>j(H)),z}(this.style,this.transform.zoom);b&&function(P,E,z){for(let B=0;B<z.length;B++)mt(P,E,z[B])}(this,b,b.getVisibleCoordinates())}this.options.showPadding&&function(b){const P=b.transform.padding;fn(b,b.transform.height-(P.top||0),3,so),fn(b,P.bottom||0,3,vs),sa(b,P.left||0,3,oo),sa(b,b.transform.width-(P.right||0),3,kl);const E=b.transform.centerPoint;(function(z,B,V,q){Bn(z,B-1,V-10,2,20,q),Bn(z,B-10,V-1,20,2,q)})(b,E.x,b.transform.height-E.y,Rn)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(t){if(!this.style||!this.style.map||!this.style.map.terrain)return;const n=this.terrainFacilitator.matrix,o=this.transform.modelViewProjectionMatrix;let a=this.terrainFacilitator.dirty;a||(a=t?!u.a_(n,o):!u.a$(n,o)),a||(a=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),a&&(u.b0(n,o),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(c,m){const _=c.context,v=_.gl,b=Ct.unblended,P=new ht(v.LEQUAL,ht.ReadWrite,[0,1]),E=m.getTerrainMesh(),z=m.sourceCache.getRenderableTiles(),B=c.useProgram("terrainDepth");_.bindFramebuffer.set(m.getFramebuffer("depth").framebuffer),_.viewport.set([0,0,c.width/devicePixelRatio,c.height/devicePixelRatio]),_.clear({color:u.aN.transparent,depth:1});for(const V of z){const q=m.getTerrainData(V.tileID),j={u_matrix:c.transform.calculatePosMatrix(V.tileID.toUnwrapped()),u_ele_delta:m.getMeshFrameDelta(c.transform.zoom)};B.draw(_,v.TRIANGLES,P,Nt.disabled,b,Dt.backCCW,j,q,"terrain",E.vertexBuffer,E.indexBuffer,E.segments)}_.bindFramebuffer.set(null),_.viewport.set([0,0,c.width,c.height])}(this,this.style.map.terrain),function(c,m){const _=c.context,v=_.gl,b=Ct.unblended,P=new ht(v.LEQUAL,ht.ReadWrite,[0,1]),E=m.getTerrainMesh(),z=m.getCoordsTexture(),B=m.sourceCache.getRenderableTiles(),V=c.useProgram("terrainCoords");_.bindFramebuffer.set(m.getFramebuffer("coords").framebuffer),_.viewport.set([0,0,c.width/devicePixelRatio,c.height/devicePixelRatio]),_.clear({color:u.aN.transparent,depth:1}),m.coordsIndex=[];for(const q of B){const j=m.getTerrainData(q.tileID);_.activeTexture.set(v.TEXTURE0),v.bindTexture(v.TEXTURE_2D,z.texture);const H={u_matrix:c.transform.calculatePosMatrix(q.tileID.toUnwrapped()),u_terrain_coords_id:(255-m.coordsIndex.length)/255,u_texture:0,u_ele_delta:m.getMeshFrameDelta(c.transform.zoom)};V.draw(_,v.TRIANGLES,P,Nt.disabled,b,Dt.backCCW,H,j,"terrain",E.vertexBuffer,E.indexBuffer,E.segments),m.coordsIndex.push(q.tileID.key)}_.bindFramebuffer.set(null),_.viewport.set([0,0,c.width,c.height])}(this,this.style.map.terrain))}renderLayer(t,n,o,a){if(!o.isHidden(this.transform.zoom)&&(o.type==="background"||o.type==="custom"||(a||[]).length))switch(this.id=o.id,o.type){case"symbol":(function(c,m,_,v,b){if(c.renderPass!=="translucent")return;const P=Nt.disabled,E=c.colorModeForRenderPass();(_._unevaluatedLayout.hasValue("text-variable-anchor")||_._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(z,B,V,q,j,H,J,N,ee){const ne=B.transform,le=js(),ge=j==="map",ve=H==="map";for(const De of z){const Re=q.getTile(De),be=Re.getBucket(V);if(!be||!be.text||!be.text.segments.get().length)continue;const Se=u.ah(be.textSizeData,ne.zoom),Ne=nt(Re,1,B.transform.zoom),it=qr(De.posMatrix,ve,ge,B.transform,Ne),Ee=V.layout.get("icon-text-fit")!=="none"&&be.hasIconData();if(Se){const ke=Math.pow(2,ne.zoom-Re.tileID.overscaledZ),Qe=B.style.map.terrain?(ot,ut)=>B.style.map.terrain.getElevation(De,ot,ut):null,Rt=le.translatePosition(ne,Re,J,N);io(be,ge,ve,ee,ne,it,De.posMatrix,ke,Se,Ee,le,Rt,De.toUnwrapped(),Qe)}}}(v,c,_,m,_.layout.get("text-rotation-alignment"),_.layout.get("text-pitch-alignment"),_.paint.get("text-translate"),_.paint.get("text-translate-anchor"),b),_.paint.get("icon-opacity").constantOr(1)!==0&&Xr(c,m,_,v,!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"),P,E),_.paint.get("text-opacity").constantOr(1)!==0&&Xr(c,m,_,v,!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"),P,E),m.map.showCollisionBoxes&&(Cl(c,m,_,v,!0),Cl(c,m,_,v,!1))})(t,n,o,a,this.style.placement.variableOffsets);break;case"circle":(function(c,m,_,v){if(c.renderPass!=="translucent")return;const b=_.paint.get("circle-opacity"),P=_.paint.get("circle-stroke-width"),E=_.paint.get("circle-stroke-opacity"),z=!_.layout.get("circle-sort-key").isConstant();if(b.constantOr(1)===0&&(P.constantOr(1)===0||E.constantOr(1)===0))return;const B=c.context,V=B.gl,q=c.depthModeForSublayer(0,ht.ReadOnly),j=Nt.disabled,H=c.colorModeForRenderPass(),J=[];for(let N=0;N<v.length;N++){const ee=v[N],ne=m.getTile(ee),le=ne.getBucket(_);if(!le)continue;const ge=le.programConfigurations.get(_.id),ve=c.useProgram("circle",ge),De=le.layoutVertexBuffer,Re=le.indexBuffer,be=c.style.map.terrain&&c.style.map.terrain.getTerrainData(ee),Se={programConfiguration:ge,program:ve,layoutVertexBuffer:De,indexBuffer:Re,uniformValues:hl(c,ee,ne,_),terrainData:be};if(z){const Ne=le.segments.get();for(const it of Ne)J.push({segments:new u.a0([it]),sortKey:it.sortKey,state:Se})}else J.push({segments:le.segments,sortKey:0,state:Se})}z&&J.sort((N,ee)=>N.sortKey-ee.sortKey);for(const N of J){const{programConfiguration:ee,program:ne,layoutVertexBuffer:le,indexBuffer:ge,uniformValues:ve,terrainData:De}=N.state;ne.draw(B,V.TRIANGLES,q,j,H,Dt.disabled,ve,De,_.id,le,ge,N.segments,_.paint,c.transform.zoom,ee)}})(t,n,o,a);break;case"heatmap":(function(c,m,_,v){if(_.paint.get("heatmap-opacity")!==0)if(c.renderPass==="offscreen"){const b=c.context,P=b.gl,E=Nt.disabled,z=new Ct([P.ONE,P.ONE],u.aN.transparent,[!0,!0,!0,!0]);(function(B,V,q){const j=B.gl;B.activeTexture.set(j.TEXTURE1),B.viewport.set([0,0,V.width/4,V.height/4]);let H=q.heatmapFbo;if(H)j.bindTexture(j.TEXTURE_2D,H.colorAttachment.get()),B.bindFramebuffer.set(H.framebuffer);else{const J=j.createTexture();j.bindTexture(j.TEXTURE_2D,J),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.LINEAR),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.LINEAR),H=q.heatmapFbo=B.createFramebuffer(V.width/4,V.height/4,!1,!1),function(N,ee,ne,le){var ge,ve;const De=N.gl,Re=(ge=N.HALF_FLOAT)!==null&&ge!==void 0?ge:De.UNSIGNED_BYTE,be=(ve=N.RGBA16F)!==null&&ve!==void 0?ve:De.RGBA;De.texImage2D(De.TEXTURE_2D,0,be,ee.width/4,ee.height/4,0,De.RGBA,Re,null),le.colorAttachment.set(ne)}(B,V,J,H)}})(b,c,_),b.clear({color:u.aN.transparent});for(let B=0;B<v.length;B++){const V=v[B];if(m.hasRenderableParent(V))continue;const q=m.getTile(V),j=q.getBucket(_);if(!j)continue;const H=j.programConfigurations.get(_.id),J=c.useProgram("heatmap",H),{zoom:N}=c.transform;J.draw(b,P.TRIANGLES,ht.disabled,E,z,Dt.disabled,ji(V.posMatrix,q,N,_.paint.get("heatmap-intensity")),null,_.id,j.layoutVertexBuffer,j.indexBuffer,j.segments,_.paint,c.transform.zoom,H)}b.viewport.set([0,0,c.width,c.height])}else c.renderPass==="translucent"&&(c.context.setColorMode(c.colorModeForRenderPass()),function(b,P){const E=b.context,z=E.gl,B=P.heatmapFbo;if(!B)return;E.activeTexture.set(z.TEXTURE0),z.bindTexture(z.TEXTURE_2D,B.colorAttachment.get()),E.activeTexture.set(z.TEXTURE1);let V=P.colorRampTexture;V||(V=P.colorRampTexture=new vt(E,P.colorRamp,z.RGBA)),V.bind(z.LINEAR,z.CLAMP_TO_EDGE),b.useProgram("heatmapTexture").draw(E,z.TRIANGLES,ht.disabled,Nt.disabled,b.colorModeForRenderPass(),Dt.disabled,((q,j,H,J)=>{const N=u.H();u.aQ(N,0,q.width,q.height,0,0,1);const ee=q.context.gl;return{u_matrix:N,u_world:[ee.drawingBufferWidth,ee.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:j.paint.get("heatmap-opacity")}})(b,P),null,P.id,b.viewportBuffer,b.quadTriangleIndexBuffer,b.viewportSegments,P.paint,b.transform.zoom)}(c,_))})(t,n,o,a);break;case"line":(function(c,m,_,v){if(c.renderPass!=="translucent")return;const b=_.paint.get("line-opacity"),P=_.paint.get("line-width");if(b.constantOr(1)===0||P.constantOr(1)===0)return;const E=c.depthModeForSublayer(0,ht.ReadOnly),z=c.colorModeForRenderPass(),B=_.paint.get("line-dasharray"),V=_.paint.get("line-pattern"),q=V.constantOr(1),j=_.paint.get("line-gradient"),H=_.getCrossfadeParameters(),J=q?"linePattern":B?"lineSDF":j?"lineGradient":"line",N=c.context,ee=N.gl;let ne=!0;for(const le of v){const ge=m.getTile(le);if(q&&!ge.patternsLoaded())continue;const ve=ge.getBucket(_);if(!ve)continue;const De=ve.programConfigurations.get(_.id),Re=c.context.program.get(),be=c.useProgram(J,De),Se=ne||be.program!==Re,Ne=c.style.map.terrain&&c.style.map.terrain.getTerrainData(le),it=V.constantOr(null);if(it&&ge.imageAtlas){const Qe=ge.imageAtlas,Rt=Qe.patternPositions[it.to.toString()],ot=Qe.patternPositions[it.from.toString()];Rt&&ot&&De.setConstantPatternPositions(Rt,ot)}const Ee=Ne?le:null,ke=q?ul(c,ge,_,H,Ee):B?dl(c,ge,_,B,H,Ee):j?Xs(c,ge,_,ve.lineClipsArray.length,Ee):ms(c,ge,_,Ee);if(q)N.activeTexture.set(ee.TEXTURE0),ge.imageAtlasTexture.bind(ee.LINEAR,ee.CLAMP_TO_EDGE),De.updatePaintBuffers(H);else if(B&&(Se||c.lineAtlas.dirty))N.activeTexture.set(ee.TEXTURE0),c.lineAtlas.bind(N);else if(j){const Qe=ve.gradients[_.id];let Rt=Qe.texture;if(_.gradientVersion!==Qe.version){let ot=256;if(_.stepInterpolant){const ut=m.getSource().maxzoom,Bt=le.canonical.z===ut?Math.ceil(1<<c.transform.maxZoom-le.canonical.z):1;ot=u.ad(u.aV(ve.maxLineLength/u.X*1024*Bt),256,N.maxTextureSize)}Qe.gradient=u.aW({expression:_.gradientExpression(),evaluationKey:"lineProgress",resolution:ot,image:Qe.gradient||void 0,clips:ve.lineClipsArray}),Qe.texture?Qe.texture.update(Qe.gradient):Qe.texture=new vt(N,Qe.gradient,ee.RGBA),Qe.version=_.gradientVersion,Rt=Qe.texture}N.activeTexture.set(ee.TEXTURE0),Rt.bind(_.stepInterpolant?ee.NEAREST:ee.LINEAR,ee.CLAMP_TO_EDGE)}be.draw(N,ee.TRIANGLES,E,c.stencilModeForClipping(le),z,Dt.disabled,ke,Ne,_.id,ve.layoutVertexBuffer,ve.indexBuffer,ve.segments,_.paint,c.transform.zoom,De,ve.layoutVertexBuffer2),ne=!1}})(t,n,o,a);break;case"fill":(function(c,m,_,v){const b=_.paint.get("fill-color"),P=_.paint.get("fill-opacity");if(P.constantOr(1)===0)return;const E=c.colorModeForRenderPass(),z=_.paint.get("fill-pattern"),B=c.opaquePassEnabledForLayer()&&!z.constantOr(1)&&b.constantOr(u.aN.transparent).a===1&&P.constantOr(0)===1?"opaque":"translucent";if(c.renderPass===B){const V=c.depthModeForSublayer(1,c.renderPass==="opaque"?ht.ReadWrite:ht.ReadOnly);ra(c,m,_,v,V,E,!1)}if(c.renderPass==="translucent"&&_.paint.get("fill-antialias")){const V=c.depthModeForSublayer(_.getPaintProperty("fill-outline-color")?2:0,ht.ReadOnly);ra(c,m,_,v,V,E,!0)}})(t,n,o,a);break;case"fill-extrusion":(function(c,m,_,v){const b=_.paint.get("fill-extrusion-opacity");if(b!==0&&c.renderPass==="translucent"){const P=new ht(c.context.gl.LEQUAL,ht.ReadWrite,c.depthRangeFor3D);if(b!==1||_.paint.get("fill-extrusion-pattern").constantOr(1))ro(c,m,_,v,P,Nt.disabled,Ct.disabled),ro(c,m,_,v,P,c.stencilModeFor3D(),c.colorModeForRenderPass());else{const E=c.colorModeForRenderPass();ro(c,m,_,v,P,Nt.disabled,E)}}})(t,n,o,a);break;case"hillshade":(function(c,m,_,v){if(c.renderPass!=="offscreen"&&c.renderPass!=="translucent")return;const b=c.context,P=c.depthModeForSublayer(0,ht.ReadOnly),E=c.colorModeForRenderPass(),[z,B]=c.renderPass==="translucent"?c.stencilConfigForOverlap(v):[{},v];for(const V of B){const q=m.getTile(V);q.needsHillshadePrepare!==void 0&&q.needsHillshadePrepare&&c.renderPass==="offscreen"?pn(c,q,_,P,Nt.disabled,E):c.renderPass==="translucent"&&na(c,V,q,_,P,z[V.overscaledZ],E)}b.viewport.set([0,0,c.width,c.height])})(t,n,o,a);break;case"raster":(function(c,m,_,v){if(c.renderPass!=="translucent"||_.paint.get("raster-opacity")===0||!v.length)return;const b=c.context,P=b.gl,E=m.getSource(),z=c.useProgram("raster"),B=c.colorModeForRenderPass(),[V,q]=E instanceof kr?[{},v]:c.stencilConfigForOverlap(v),j=q[q.length-1].overscaledZ,H=!c.options.moving;for(const J of q){const N=c.depthModeForSublayer(J.overscaledZ-j,_.paint.get("raster-opacity")===1?ht.ReadWrite:ht.ReadOnly,P.LESS),ee=m.getTile(J);ee.registerFadeDuration(_.paint.get("raster-fade-duration"));const ne=m.findLoadedParent(J,0),le=m.findLoadedSibling(J),ge=no(ee,ne||le||null,m,_,c.transform,c.style.map.terrain);let ve,De;const Re=_.paint.get("raster-resampling")==="nearest"?P.NEAREST:P.LINEAR;b.activeTexture.set(P.TEXTURE0),ee.texture.bind(Re,P.CLAMP_TO_EDGE,P.LINEAR_MIPMAP_NEAREST),b.activeTexture.set(P.TEXTURE1),ne?(ne.texture.bind(Re,P.CLAMP_TO_EDGE,P.LINEAR_MIPMAP_NEAREST),ve=Math.pow(2,ne.tileID.overscaledZ-ee.tileID.overscaledZ),De=[ee.tileID.canonical.x*ve%1,ee.tileID.canonical.y*ve%1]):ee.texture.bind(Re,P.CLAMP_TO_EDGE,P.LINEAR_MIPMAP_NEAREST),ee.texture.useMipmap&&b.extTextureFilterAnisotropic&&c.transform.pitch>20&&P.texParameterf(P.TEXTURE_2D,b.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,b.extTextureFilterAnisotropicMax);const be=c.style.map.terrain&&c.style.map.terrain.getTerrainData(J),Se=be?J:null,Ne=Se?Se.posMatrix:c.transform.calculatePosMatrix(J.toUnwrapped(),H),it=Fc(Ne,De||[0,0],ve||1,ge,_);E instanceof kr?z.draw(b,P.TRIANGLES,N,Nt.disabled,B,Dt.disabled,it,be,_.id,E.boundsBuffer,c.quadTriangleIndexBuffer,E.boundsSegments):z.draw(b,P.TRIANGLES,N,V[J.overscaledZ],B,Dt.disabled,it,be,_.id,c.rasterBoundsBuffer,c.quadTriangleIndexBuffer,c.rasterBoundsSegments)}})(t,n,o,a);break;case"background":(function(c,m,_,v){const b=_.paint.get("background-color"),P=_.paint.get("background-opacity");if(P===0)return;const E=c.context,z=E.gl,B=c.transform,V=B.tileSize,q=_.paint.get("background-pattern");if(c.isPatternMissing(q))return;const j=!q&&b.a===1&&P===1&&c.opaquePassEnabledForLayer()?"opaque":"translucent";if(c.renderPass!==j)return;const H=Nt.disabled,J=c.depthModeForSublayer(0,j==="opaque"?ht.ReadWrite:ht.ReadOnly),N=c.colorModeForRenderPass(),ee=c.useProgram(q?"backgroundPattern":"background"),ne=v||B.coveringTiles({tileSize:V,terrain:c.style.map.terrain});q&&(E.activeTexture.set(z.TEXTURE0),c.imageManager.bind(c.context));const le=_.getCrossfadeParameters();for(const ge of ne){const ve=v?ge.posMatrix:c.transform.calculatePosMatrix(ge.toUnwrapped()),De=q?qo(ve,P,c,q,{tileID:ge,tileSize:V},le):Ws(ve,P,b),Re=c.style.map.terrain&&c.style.map.terrain.getTerrainData(ge);ee.draw(E,z.TRIANGLES,J,H,N,Dt.disabled,De,Re,_.id,c.tileExtentBuffer,c.quadTriangleIndexBuffer,c.tileExtentSegments)}})(t,0,o,a);break;case"custom":(function(c,m,_){const v=c.context,b=_.implementation;if(c.renderPass==="offscreen"){const P=b.prerender;P&&(c.setCustomLayerDefaults(),v.setColorMode(c.colorModeForRenderPass()),P.call(b,v.gl,c.transform.customLayerMatrix()),v.setDirty(),c.setBaseState())}else if(c.renderPass==="translucent"){c.setCustomLayerDefaults(),v.setColorMode(c.colorModeForRenderPass()),v.setStencilMode(Nt.disabled);const P=b.renderingMode==="3d"?new ht(c.context.gl.LEQUAL,ht.ReadWrite,c.depthRangeFor3D):c.depthModeForSublayer(0,ht.ReadOnly);v.setDepthMode(P),b.render(v.gl,c.transform.customLayerMatrix(),{farZ:c.transform.farZ,nearZ:c.transform.nearZ,fov:c.transform._fov,modelViewProjectionMatrix:c.transform.modelViewProjectionMatrix,projectionMatrix:c.transform.projectionMatrix}),v.setDirty(),c.setBaseState(),v.bindFramebuffer.set(null)}})(t,0,o)}}translatePosMatrix(t,n,o,a,c){if(!o[0]&&!o[1])return t;const m=c?a==="map"?this.transform.angle:0:a==="viewport"?-this.transform.angle:0;if(m){const b=Math.sin(m),P=Math.cos(m);o=[o[0]*P-o[1]*b,o[0]*b+o[1]*P]}const _=[c?o[0]:nt(n,o[0],this.transform.zoom),c?o[1]:nt(n,o[1],this.transform.zoom),0],v=new Float32Array(16);return u.J(v,t,_),v}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()),o=this.imageManager.getPattern(t.to.toString());return!n||!o}useProgram(t,n){this.cache=this.cache||{};const o=t+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[o]||(this.cache[o]=new qs(this.context,Gr[t],n,Js[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[o]}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 vt(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 mn{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,o){const a=Math.pow(2,o),c=[[-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 v=1/(_=u.ag([],_,t))[3]/n*a;return u.b1(_,_,[v,v,1/_[3],v])}),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(_=>{const v=function(z,B){var V=B[0],q=B[1],j=B[2],H=V*V+q*q+j*j;return H>0&&(H=1/Math.sqrt(H)),z[0]=B[0]*H,z[1]=B[1]*H,z[2]=B[2]*H,z}([],function(z,B,V){var q=B[0],j=B[1],H=B[2],J=V[0],N=V[1],ee=V[2];return z[0]=j*ee-H*N,z[1]=H*J-q*ee,z[2]=q*N-j*J,z}([],St([],c[_[0]],c[_[1]]),St([],c[_[2]],c[_[1]]))),b=-((P=v)[0]*(E=c[_[1]])[0]+P[1]*E[1]+P[2]*E[2]);var P,E;return v.concat(b)});return new mn(c,m)}}class ao{constructor(t,n){this.min=t,this.max=n,this.center=function(o,a,c){return o[0]=.5*a[0],o[1]=.5*a[1],o[2]=.5*a[2],o}([],function(o,a,c){return o[0]=a[0]+c[0],o[1]=a[1]+c[1],o[2]=a[2]+c[2],o}([],this.min,this.max))}quadrant(t){const n=[t%2==0,t<2],o=zt(this.min),a=zt(this.max);for(let c=0;c<n.length;c++)o[c]=n[c]?this.min[c]:this.center[c],a[c]=n[c]?this.center[c]:this.max[c];return a[2]=this.max[2],new ao(o,a)}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 o=!0;for(let a=0;a<t.planes.length;a++){const c=t.planes[a];let m=0;for(let _=0;_<n.length;_++)u.b2(c,n[_])>=0&&m++;if(m===0)return 0;m!==n.length&&(o=!1)}if(o)return 2;for(let a=0;a<3;a++){let c=Number.MAX_VALUE,m=-Number.MAX_VALUE;for(let _=0;_<t.points.length;_++){const v=t.points[_][a]-this.min[a];c=Math.min(c,v),m=Math.max(m,v)}if(m<0||c>this.max[a]-this.min[a])return 0}return 1}}class lo{constructor(t=0,n=0,o=0,a=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(o)||o<0||isNaN(a)||a<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=o,this.right=a}interpolate(t,n,o){return n.top!=null&&t.top!=null&&(this.top=u.z.number(t.top,n.top,o)),n.bottom!=null&&t.bottom!=null&&(this.bottom=u.z.number(t.bottom,n.bottom,o)),n.left!=null&&t.left!=null&&(this.left=u.z.number(t.left,n.left,o)),n.right!=null&&t.right!=null&&(this.right=u.z.number(t.right,n.right,o)),this}getCenter(t,n){const o=u.ad((this.left+t-this.right)/2,0,t),a=u.ad((this.top+n-this.bottom)/2,0,n);return new u.P(o,a)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new lo(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const oa=85.051129;class aa{constructor(t,n,o,a,c){this.tileSize=512,this._renderWorldCopies=c===void 0||!!c,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=o??0,this._maxPitch=a??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new u.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new lo,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const t=new aa(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this.minElevationForCurrentTile=t.minElevationForCurrentTile,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new u.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-u.b3(t,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=function(){var o=new u.A(4);return u.A!=Float32Array&&(o[1]=0,o[2]=0),o[0]=1,o[3]=1,o}(),function(o,a,c){var m=a[0],_=a[1],v=a[2],b=a[3],P=Math.sin(c),E=Math.cos(c);o[0]=m*E+v*P,o[1]=_*E+b*P,o[2]=m*-P+v*E,o[3]=_*-P+b*E}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=u.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,o){this._unmodified=!1,this._edgeInsets.interpolate(t,n,o),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 u.b4(0,t)];if(this._renderWorldCopies){const o=this.pointCoordinate(new u.P(0,0)),a=this.pointCoordinate(new u.P(this.width,0)),c=this.pointCoordinate(new u.P(this.width,this.height)),m=this.pointCoordinate(new u.P(0,this.height)),_=Math.floor(Math.min(o.x,a.x,c.x,m.x)),v=Math.floor(Math.max(o.x,a.x,c.x,m.x)),b=1;for(let P=_-b;P<=v+b;P++)P!==0&&n.push(new u.b4(P,t))}return n}coveringTiles(t){var n,o;let a=this.coveringZoomLevel(t);const c=a;if(t.minzoom!==void 0&&a<t.minzoom)return[];t.maxzoom!==void 0&&a>t.maxzoom&&(a=t.maxzoom);const m=this.pointCoordinate(this.getCameraPoint()),_=u.Z.fromLngLat(this.center),v=Math.pow(2,a),b=[v*m.x,v*m.y,0],P=[v*_.x,v*_.y,0],E=mn.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,a);let z=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(z=a);const B=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,V=N=>({aabb:new ao([N*v,0,0],[(N+1)*v,v,0]),zoom:0,x:0,y:0,wrap:N,fullyVisible:!1}),q=[],j=[],H=a,J=t.reparseOverscaled?c:a;if(this._renderWorldCopies)for(let N=1;N<=3;N++)q.push(V(-N)),q.push(V(N));for(q.push(V(0));q.length>0;){const N=q.pop(),ee=N.x,ne=N.y;let le=N.fullyVisible;if(!le){const be=N.aabb.intersects(E);if(be===0)continue;le=be===2}const ge=t.terrain?b:P,ve=N.aabb.distanceX(ge),De=N.aabb.distanceY(ge),Re=Math.max(Math.abs(ve),Math.abs(De));if(N.zoom===H||Re>B+(1<<H-N.zoom)-2&&N.zoom>=z){const be=H-N.zoom,Se=b[0]-.5-(ee<<be),Ne=b[1]-.5-(ne<<be);j.push({tileID:new u.S(N.zoom===H?J:N.zoom,N.wrap,N.zoom,ee,ne),distanceSq:Yi([P[0]-.5-ee,P[1]-.5-ne]),tileDistanceToCamera:Math.sqrt(Se*Se+Ne*Ne)})}else for(let be=0;be<4;be++){const Se=(ee<<1)+be%2,Ne=(ne<<1)+(be>>1),it=N.zoom+1;let Ee=N.aabb.quadrant(be);if(t.terrain){const ke=new u.S(it,N.wrap,it,Se,Ne),Qe=t.terrain.getMinMaxElevation(ke),Rt=(n=Qe.minElevation)!==null&&n!==void 0?n:this.elevation,ot=(o=Qe.maxElevation)!==null&&o!==void 0?o:this.elevation;Ee=new ao([Ee.min[0],Ee.min[1],Rt],[Ee.max[0],Ee.max[1],ot])}q.push({aabb:Ee,zoom:it,x:Se,y:Ne,wrap:N.wrap,fullyVisible:le})}}return j.sort((N,ee)=>N.distanceSq-ee.distanceSq).map(N=>N.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=u.ad(t.lat,-85.051129,oa);return new u.P(u.O(t.lng)*this.worldSize,u.Q(n)*this.worldSize)}unproject(t){return new u.Z(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const n=this.elevation,o=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,a=this.pointLocation(this.centerPoint,t),c=t.getElevationForLngLatZoom(a,this.tileZoom);if(!(this.elevation-c))return;const m=o+n-c,_=Math.cos(this._pitch)*this.cameraToCenterDistance/m/u.b5(1,a.lat),v=this.scaleZoom(_/this.tileSize);this._elevation=c,this._center=a,this.zoom=v}setLocationAtPoint(t,n){const o=this.pointCoordinate(n),a=this.pointCoordinate(this.centerPoint),c=this.locationCoordinate(t),m=new u.Z(c.x-(o.x-a.x),c.y-(o.y-a.y));this.center=this.coordinateLocation(m),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 u.Z.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,n){if(n){const z=n.pointCoordinate(t);if(z!=null)return z}const o=[t.x,t.y,0,1],a=[t.x,t.y,1,1];u.ag(o,o,this.pixelMatrixInverse),u.ag(a,a,this.pixelMatrixInverse);const c=o[3],m=a[3],_=o[1]/c,v=a[1]/m,b=o[2]/c,P=a[2]/m,E=b===P?0:(0-b)/(P-b);return new u.Z(u.z.number(o[0]/c,a[0]/m,E)/this.worldSize,u.z.number(_,v,E)/this.worldSize)}coordinatePoint(t,n=0,o=this.pixelMatrix){const a=[t.x*this.worldSize,t.y*this.worldSize,n,1];return u.ag(a,a,o),new u.P(a[0]/a[3],a[1]/a[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new ue().extend(this.pointLocation(new u.P(0,t))).extend(this.pointLocation(new u.P(this.width,t))).extend(this.pointLocation(new u.P(this.width,this.height))).extend(this.pointLocation(new u.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new ue([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,oa])}calculateTileMatrix(t){const n=t.canonical,o=this.worldSize/this.zoomScale(n.z),a=n.x+Math.pow(2,n.z)*t.wrap,c=u.ao(new Float64Array(16));return u.J(c,c,[a*o,n.y*o,0]),u.K(c,c,[o/u.X,o/u.X,1]),c}calculatePosMatrix(t,n=!1){const o=t.key,a=n?this._alignedPosMatrixCache:this._posMatrixCache;if(a[o])return a[o];const c=this.calculateTileMatrix(t);return u.L(c,n?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,c),a[o]=new Float32Array(c),a[o]}calculateFogMatrix(t){const n=t.key,o=this._fogMatrixCache;if(o[n])return o[n];const a=this.calculateTileMatrix(t);return u.L(a,this.fogMatrix,a),o[n]=new Float32Array(a),o[n]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(t,n){n=u.ad(+n,this.minZoom,this.maxZoom);const o={center:new u.N(t.lng,t.lat),zoom:n};let a=this.lngRange;if(!this._renderWorldCopies&&a===null){const N=179.9999999999;a=[-N,N]}const c=this.tileSize*this.zoomScale(o.zoom);let m=0,_=c,v=0,b=c,P=0,E=0;const{x:z,y:B}=this.size;if(this.latRange){const N=this.latRange;m=u.Q(N[1])*c,_=u.Q(N[0])*c,_-m<B&&(P=B/(_-m))}a&&(v=u.b3(u.O(a[0])*c,0,c),b=u.b3(u.O(a[1])*c,0,c),b<v&&(b+=c),b-v<z&&(E=z/(b-v)));const{x:V,y:q}=this.project.call({worldSize:c},t);let j,H;const J=Math.max(E||0,P||0);if(J){const N=new u.P(E?(b+v)/2:V,P?(_+m)/2:q);return o.center=this.unproject.call({worldSize:c},N).wrap(),o.zoom+=this.scaleZoom(J),o}if(this.latRange){const N=B/2;q-N<m&&(H=m+N),q+N>_&&(H=_-N)}if(a){const N=(v+b)/2;let ee=V;this._renderWorldCopies&&(ee=u.b3(V,N-c/2,N+c/2));const ne=z/2;ee-ne<v&&(j=v+ne),ee+ne>b&&(j=b-ne)}if(j!==void 0||H!==void 0){const N=new u.P(j??V,H??q);o.center=this.unproject.call({worldSize:c},N).wrap()}return o}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:n,zoom:o}=this.getConstrained(this.center,this.zoom);this.center=n,this.zoom=o,this._unmodified=t,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,o=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=u.b5(1,this.center.lat)*this.worldSize;let a=u.ao(new Float64Array(16));u.K(a,a,[this.width/2,-this.height/2,1]),u.J(a,a,[1,-1,0]),this.labelPlaneMatrix=a,a=u.ao(new Float64Array(16)),u.K(a,a,[1,-1,1]),u.J(a,a,[-1,-1,0]),u.K(a,a,[2/this.width,2/this.height,1]),this.glCoordMatrix=a;const c=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),m=Math.min(this.elevation,this.minElevationForCurrentTile),_=c-m*this._pixelPerMeter/Math.cos(this._pitch),v=m<0?_:c,b=Math.PI/2+this._pitch,P=this._fov*(.5+t.y/this.height),E=Math.sin(P)*v/Math.sin(u.ad(Math.PI-b-P,.01,Math.PI-.01)),z=this.getHorizon(),B=2*Math.atan(z/this.cameraToCenterDistance)*(.5+t.y/(2*z)),V=Math.sin(B)*v/Math.sin(u.ad(Math.PI-b-B,.01,Math.PI-.01)),q=Math.min(E,V);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*q+v),this.nearZ=this.height/50,a=new Float64Array(16),u.b6(a,this._fov,this.width/this.height,this.nearZ,this.farZ),a[8]=2*-t.x/this.width,a[9]=2*t.y/this.height,this.projectionMatrix=u.af(a),u.K(a,a,[1,-1,1]),u.J(a,a,[0,0,-this.cameraToCenterDistance]),u.b7(a,a,this._pitch),u.ae(a,a,this.angle),u.J(a,a,[-n,-o,0]),this.mercatorMatrix=u.K([],a,[this.worldSize,this.worldSize,this.worldSize]),u.K(a,a,[1,1,this._pixelPerMeter]),this.pixelMatrix=u.L(new Float64Array(16),this.labelPlaneMatrix,a),u.J(a,a,[0,0,-this.elevation]),this.modelViewProjectionMatrix=a,this.invModelViewProjectionMatrix=u.at([],a),this.fogMatrix=new Float64Array(16),u.b6(this.fogMatrix,this._fov,this.width/this.height,c,this.farZ),this.fogMatrix[8]=2*-t.x/this.width,this.fogMatrix[9]=2*t.y/this.height,u.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),u.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),u.b7(this.fogMatrix,this.fogMatrix,this._pitch),u.ae(this.fogMatrix,this.fogMatrix,this.angle),u.J(this.fogMatrix,this.fogMatrix,[-n,-o,0]),u.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),u.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=u.L(new Float64Array(16),this.labelPlaneMatrix,a);const j=this.width%2/2,H=this.height%2/2,J=Math.cos(this.angle),N=Math.sin(this.angle),ee=n-Math.round(n)+J*j+N*H,ne=o-Math.round(o)+J*H+N*j,le=new Float64Array(a);if(u.J(le,le,[ee>.5?ee-1:ee,ne>.5?ne-1:ne,0]),this.alignedModelViewProjectionMatrix=le,a=u.at(new Float64Array(16),this.pixelMatrix),!a)throw new Error("failed to invert matrix");this.pixelMatrixInverse=a,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new u.P(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return u.ag(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new u.P(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let o=n.x,a=n.y,c=n.x,m=n.y;for(const _ of t)o=Math.min(o,_.x),a=Math.min(a,_.y),c=Math.max(c,_.x),m=Math.max(m,_.y);return[new u.P(o,a),new u.P(c,a),new u.P(c,m),new u.P(o,m),new u.P(o,a)]}}lngLatToCameraDepth(t,n){const o=this.locationCoordinate(t),a=[o.x*this.worldSize,o.y*this.worldSize,n,1];return u.ag(a,a,this.modelViewProjectionMatrix),a[2]/a[3]}}function co(h,t){let n,o=!1,a=null,c=null;const m=()=>{a=null,o&&(h.apply(c,n),a=setTimeout(m,t),o=!1)};return(..._)=>(o=!0,c=this,n=_,a||m(),a)}class ws{constructor(t){this._getCurrentHash=()=>{const n=window.location.hash.replace("#","");if(this._hashName){let o;return n.split("&").map(a=>a.split("=")).forEach(a=>{a[0]===this._hashName&&(o=a)}),(o&&o[1]||"").split("/")}return n.split("/")},this._onHashChange=()=>{const n=this._getCurrentHash();if(n.length>=3&&!n.some(o=>isNaN(o))){const o=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(n[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+n[2],+n[1]],zoom:+n[0],bearing:o,pitch:+(n[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const n=window.location.href.replace(/(#.+)?$/,this.getHashString());window.history.replaceState(window.history.state,null,n)},this._removeHash=()=>{const n=this._getCurrentHash();if(n.length===0)return;const o=n.join("/");let a=o;a.split("&").length>0&&(a=a.split("&")[0]),this._hashName&&(a=`${this._hashName}=${o}`);let c=window.location.hash.replace(a,"");c.startsWith("#&")?c=c.slice(0,1)+c.slice(2):c==="#"&&(c="");let m=window.location.href.replace(/(#.+)?$/,c);m=m.replace("&&","&"),window.history.replaceState(window.history.state,null,m)},this._updateHash=co(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(t){const n=this._map.getCenter(),o=Math.round(100*this._map.getZoom())/100,a=Math.ceil((o*Math.LN2+Math.log(512/360/.5))/Math.LN10),c=Math.pow(10,a),m=Math.round(n.lng*c)/c,_=Math.round(n.lat*c)/c,v=this._map.getBearing(),b=this._map.getPitch();let P="";if(P+=t?`/${m}/${_}/${o}`:`${o}/${_}/${m}`,(v||b)&&(P+="/"+Math.round(10*v)/10),b&&(P+=`/${Math.round(b)}`),this._hashName){const E=this._hashName;let z=!1;const B=window.location.hash.slice(1).split("&").map(V=>{const q=V.split("=")[0];return q===E?(z=!0,`${q}=${P}`):V}).filter(V=>V);return z||B.push(`${E}=${P}`),`#${B.join("&")}`}return`#${P}`}}const gn={linearity:.3,easing:u.b8(0,0,.3,1)},la=u.e({deceleration:2500,maxSpeed:1400},gn),ca=u.e({deceleration:20,maxSpeed:1400},gn),Dl=u.e({deceleration:1e3,maxSpeed:360},gn),ho=u.e({deceleration:1e3,maxSpeed:90},gn);class uo{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:he.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=he.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 u.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:c}of this._inertiaBuffer)n.zoom+=c.zoomDelta||0,n.bearing+=c.bearingDelta||0,n.pitch+=c.pitchDelta||0,c.panDelta&&n.pan._add(c.panDelta),c.around&&(n.around=c.around),c.pinchAround&&(n.pinchAround=c.pinchAround);const o=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,a={};if(n.pan.mag()){const c=po(n.pan.mag(),o,u.e({},la,t||{}));a.offset=n.pan.mult(c.amount/n.pan.mag()),a.center=this._map.transform.center,Fn(a,c)}if(n.zoom){const c=po(n.zoom,o,ca);a.zoom=this._map.transform.zoom+c.amount,Fn(a,c)}if(n.bearing){const c=po(n.bearing,o,Dl);a.bearing=this._map.transform.bearing+u.ad(c.amount,-179,179),Fn(a,c)}if(n.pitch){const c=po(n.pitch,o,ho);a.pitch=this._map.transform.pitch+c.amount,Fn(a,c)}if(a.zoom||a.bearing){const c=n.pinchAround===void 0?n.around:n.pinchAround;a.around=c?this._map.unproject(c):this._map.getCenter()}return this.clear(),u.e(a,{noMoveStart:!0})}}function Fn(h,t){(!h.duration||h.duration<t.duration)&&(h.duration=t.duration,h.easing=t.easing)}function po(h,t,n){const{maxSpeed:o,linearity:a,deceleration:c}=n,m=u.ad(h*a/(t/1e3),-o,o),_=Math.abs(m)/(c*a);return{easing:n.easing,duration:1e3*_,amount:m*(_/2)}}class Ti extends u.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,o,a={}){const c=ae.mousePos(n.getCanvas(),o),m=n.unproject(c);super(t,u.e({point:c,lngLat:m,originalEvent:o},a)),this._defaultPrevented=!1,this.target=n}}class Ss extends u.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,o){const a=t==="touchend"?o.changedTouches:o.touches,c=ae.touchPos(n.getCanvasContainer(),a),m=c.map(v=>n.unproject(v)),_=c.reduce((v,b,P,E)=>v.add(b.div(E.length)),new u.P(0,0));super(t,{points:c,point:_,lngLats:m,lngLat:n.unproject(_),originalEvent:o}),this._defaultPrevented=!1}}class ha extends u.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,o){super(t,{originalEvent:o}),this._defaultPrevented=!1}}class fo{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new ha(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Ti(t.type,this._map,t))}mouseup(t){this._map.fire(new Ti(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Ti(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Ti(t.type,this._map,t))}mouseover(t){this._map.fire(new Ti(t.type,this._map,t))}mouseout(t){this._map.fire(new Ti(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Ss(t.type,this._map,t))}touchmove(t){this._map.fire(new Ss(t.type,this._map,t))}touchend(t){this._map.fire(new Ss(t.type,this._map,t))}touchcancel(t){this._map.fire(new Ss(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ua{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Ti(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ti("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Ti(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class On{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(u.P.convert(t),this._map.terrain)}}class da{constructor(t,n){this._map=t,this._tr=new On(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&&(ae.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const o=n;if(this._lastPos.equals(o)||!this._box&&o.dist(this._startPos)<this._clickTolerance)return;const a=this._startPos;this._lastPos=o,this._box||(this._box=ae.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const c=Math.min(a.x,o.x),m=Math.max(a.x,o.x),_=Math.min(a.y,o.y),v=Math.max(a.y,o.y);ae.setTransform(this._box,`translate(${c}px,${_}px)`),this._box.style.width=m-c+"px",this._box.style.height=v-_+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const o=this._startPos,a=n;if(this.reset(),ae.suppressClick(),o.x!==a.x||o.y!==a.y)return this._map.fire(new u.k("boxzoomend",{originalEvent:t})),{cameraAnimation:c=>c.fitScreenCoordinates(o,a,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&&(ae.remove(this._box),this._box=null),ae.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new u.k(t,{originalEvent:n}))}}function Vn(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 o=0;o<h.length;o++)n[h[o].identifier]=t[o];return n}class pa{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,o){(this.centroid||o.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),o.length===this.numTouches&&(this.centroid=function(a){const c=new u.P(0,0);for(const m of a)c._add(m);return c.div(a.length)}(n),this.touches=Vn(o,n)))}touchmove(t,n,o){if(this.aborted||!this.centroid)return;const a=Vn(o,n);for(const c in this.touches){const m=a[c];(!m||m.dist(this.touches[c])>30)&&(this.aborted=!0)}}touchend(t,n,o){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),o.length===0){const a=!this.aborted&&this.centroid;if(this.reset(),a)return a}}}class fa{constructor(t){this.singleTap=new pa(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,o){this.singleTap.touchstart(t,n,o)}touchmove(t,n,o){this.singleTap.touchmove(t,n,o)}touchend(t,n,o){const a=this.singleTap.touchend(t,n,o);if(a){const c=t.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(a)<30;if(c&&m||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=a,this.count===this.numTaps)return this.reset(),a}}}class Ll{constructor(t){this._tr=new On(t),this._zoomIn=new fa({numTouches:1,numTaps:2}),this._zoomOut=new fa({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,o){this._zoomIn.touchstart(t,n,o),this._zoomOut.touchstart(t,n,o)}touchmove(t,n,o){this._zoomIn.touchmove(t,n,o),this._zoomOut.touchmove(t,n,o)}touchend(t,n,o){const a=this._zoomIn.touchend(t,n,o),c=this._zoomOut.touchend(t,n,o),m=this._tr;return a?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:m.zoom+1,around:m.unproject(a)},{originalEvent:t})}):c?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:m.zoom-1,around:m.unproject(c)},{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 Lt{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 o=this._lastPoint;if(!o)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const a=n.length?n[0]:n;return!this._moved&&a.dist(o)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=a,this._move(o,a))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&ae.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 _n={0:1,2:2};class ki{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const n=ae.mouseButton(t);this._eventButton=n}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!function(n,o){const a=_n[o];return n.buttons===void 0||(n.buttons&a)!==a}(t,this._eventButton)}isValidEndEvent(t){return ae.mouseButton(t)===this._eventButton}}class mo{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 Ts=h=>{h.mousedown=h.dragStart,h.mousemoveWindow=h.dragMove,h.mouseup=h.dragEnd,h.contextmenu=t=>{t.preventDefault()}},ma=({enable:h,clickTolerance:t,bearingDegreesPerPixelMoved:n=.8})=>{const o=new ki({checkCorrectEvent:a=>ae.mouseButton(a)===0&&a.ctrlKey||ae.mouseButton(a)===2});return new Lt({clickTolerance:t,move:(a,c)=>({bearingDelta:(c.x-a.x)*n}),moveStateManager:o,enable:h,assignEvents:Ts})},yn=({enable:h,clickTolerance:t,pitchDegreesPerPixelMoved:n=-.5})=>{const o=new ki({checkCorrectEvent:a=>ae.mouseButton(a)===0&&a.ctrlKey||ae.mouseButton(a)===2});return new Lt({clickTolerance:t,move:(a,c)=>({pitchDelta:(c.y-a.y)*n}),moveStateManager:o,enable:h,assignEvents:Ts})};class Is{constructor(t,n){this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new u.P(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,n,o){return this._calculateTransform(t,n,o)}touchmove(t,n,o){if(this._active){if(!this._shouldBePrevented(o.length))return t.preventDefault(),this._calculateTransform(t,n,o);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,n,o){this._calculateTransform(t,n,o),this._active&&this._shouldBePrevented(o.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,o){o.length>0&&(this._active=!0);const a=Vn(o,n),c=new u.P(0,0),m=new u.P(0,0);let _=0;for(const b in a){const P=a[b],E=this._touches[b];E&&(c._add(P),m._add(P.sub(E)),_++,a[b]=P)}if(this._touches=a,this._shouldBePrevented(_)||!m.mag())return;const v=m.div(_);return this._sum._add(v),this._sum.mag()<this._clickTolerance?void 0:{around:c.div(_),panDelta:v}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ps{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,n,o){this._firstTwoTouches||o.length<2||(this._firstTwoTouches=[o[0].identifier,o[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,o){if(!this._firstTwoTouches)return;t.preventDefault();const[a,c]=this._firstTwoTouches,m=Es(o,n,a),_=Es(o,n,c);if(!m||!_)return;const v=this._aroundCenter?null:m.add(_).div(2);return this._move([m,_],v,t)}touchend(t,n,o){if(!this._firstTwoTouches)return;const[a,c]=this._firstTwoTouches,m=Es(o,n,a),_=Es(o,n,c);m&&_||(this._active&&ae.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 Es(h,t,n){for(let o=0;o<h.length;o++)if(h[o].identifier===n)return t[o]}function ga(h,t){return Math.log(h/t)/Math.LN2}class _a extends Ps{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const o=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(ga(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:ga(this._distance,o),pinchAround:n}}}function ya(h,t){return 180*h.angleWith(t)/Math.PI}class xa extends Ps{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,o){const a=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:ya(this._vector,a),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,o=ya(t,this._startVector);return Math.abs(o)<n}}function Lr(h){return Math.abs(h.y)>Math.abs(h.x)}class va extends Ps{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,o){super.touchstart(t,n,o),this._currentTouchCount=o.length}_start(t){this._lastPoints=t,Lr(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,o){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const a=t[0].sub(this._lastPoints[0]),c=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(a,c,o.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(a.y+c.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,o){if(this._valid!==void 0)return this._valid;const a=t.mag()>=2,c=n.mag()>=2;if(!a&&!c)return;if(!a||!c)return this._firstMove===void 0&&(this._firstMove=o),o-this._firstMove<100&&void 0;const m=t.y>0==n.y>0;return Lr(t)&&Lr(n)&&m}}const Rl={panStep:100,bearingStep:15,pitchStep:10};class ba{constructor(t){this._tr=new On(t);const n=Rl;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,o=0,a=0,c=0,m=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?o=-1:(t.preventDefault(),c=-1);break;case 39:t.shiftKey?o=1:(t.preventDefault(),c=1);break;case 38:t.shiftKey?a=1:(t.preventDefault(),m=-1);break;case 40:t.shiftKey?a=-1:(t.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(o=0,a=0),{cameraAnimation:_=>{const v=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:Bl,zoom:n?Math.round(v.zoom)+n*(t.shiftKey?2:1):v.zoom,bearing:v.bearing+o*this._bearingStep,pitch:v.pitch+a*this._pitchStep,offset:[-c*this._panStep,-m*this._panStep],center:v.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 Bl(h){return h*(2-h)}const wa=4.000244140625;class Sa{constructor(t,n){this._onTimeout=o=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(o)},this._map=t,this._tr=new On(t),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)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const o=he.now(),a=o-(this._lastWheelEventTime||0);this._lastWheelEventTime=o,n!==0&&n%wa==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":a>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(a*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=ae.mousePos(this._map.getCanvas(),t),o=this._tr;this._around=n.y>o.transform.height/2-o.transform.getHorizon()?u.N.convert(this._aroundCenter?o.center:o.unproject(n)):u.N.convert(o.center),this._aroundPoint=o.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 v=this._type==="wheel"&&Math.abs(this._delta)>wa?this._wheelZoomRate:this._defaultZoomRate;let b=2/(1+Math.exp(-Math.abs(this._delta*v)));this._delta<0&&b!==0&&(b=1/b);const P=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(P*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,o=this._startZoom,a=this._easing;let c,m=!1;const _=he.now()-this._lastWheelEventTime;if(this._type==="wheel"&&o&&a&&_){const v=Math.min(_/200,1),b=a(v);c=u.z.number(o,n,b),v<1?this._frameId||(this._frameId=!0):m=!0}else c=n,m=!0;return this._active=!0,m&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!m,zoomDelta:c-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=u.b9;if(this._prevEase){const o=this._prevEase,a=(he.now()-o.start)/o.duration,c=o.easing(a+.01)-o.easing(a),m=.27/Math.sqrt(c*c+1e-4)*.01,_=Math.sqrt(.0729-m*m);n=u.b8(m,_,.25,1)}return this._prevEase={start:he.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 Ta{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 As{constructor(t){this._tr=new On(t),this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:o=>{o.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 Fl{constructor(){this._tap=new fa({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,o){if(!this._swipePoint)if(this._tapTime){const a=n[0],c=t.timeStamp-this._tapTime<500,m=this._tapPoint.dist(a)<30;c&&m?o.length>0&&(this._swipePoint=a,this._swipeTouch=o[0].identifier):this.reset()}else this._tap.touchstart(t,n,o)}touchmove(t,n,o){if(this._tapTime){if(this._swipePoint){if(o[0].identifier!==this._swipeTouch)return;const a=n[0],c=a.y-this._swipePoint.y;return this._swipePoint=a,t.preventDefault(),this._active=!0,{zoomDelta:c/128}}}else this._tap.touchmove(t,n,o)}touchend(t,n,o){if(this._tapTime)this._swipePoint&&o.length===0&&this.reset();else{const a=this._tap.touchend(t,n,o);a&&(this._tapTime=t.timeStamp,this._tapPoint=a)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Wi{constructor(t,n,o){this._el=t,this._mousePan=n,this._touchPan=o}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 rr{constructor(t,n,o){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,this._mousePitch=o}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 Ia{constructor(t,n,o,a){this._el=t,this._touchZoom=n,this._touchRotate=o,this._tapDragZoom=a,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class nr{constructor(t,n){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=t,this._options=n,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=ae.create("div","maplibregl-cooperative-gesture-screen",t);let n=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(n=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const o=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),a=document.createElement("div");a.className="maplibregl-desktop-message",a.textContent=n,this._container.appendChild(a);const c=document.createElement("div");c.className="maplibregl-mobile-message",c.textContent=o,this._container.appendChild(c),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(ae.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(t){return t[this._bypassKey]}notifyGestureBlocked(t,n){this._enabled&&(this._map.fire(new u.k("cooperativegestureprevented",{gestureType:t,originalEvent:n})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Rr=h=>h.zoom||h.drag||h.pitch||h.rotate;class Wc extends u.k{}function Pa(h){return h.panDelta&&h.panDelta.mag()||h.zoomDelta||h.bearingDelta||h.pitchDelta}class Jc{constructor(t,n){this.handleWindowEvent=a=>{this.handleEvent(a,`${a.type}Window`)},this.handleEvent=(a,c)=>{if(a.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const m=a.type==="renderFrame"?void 0:a,_={needsRenderFrame:!1},v={},b={},P=a.touches,E=P?this._getMapTouches(P):void 0,z=E?ae.touchPos(this._map.getCanvas(),E):ae.mousePos(this._map.getCanvas(),a);for(const{handlerName:q,handler:j,allowed:H}of this._handlers){if(!j.isEnabled())continue;let J;this._blockedByActive(b,H,q)?j.reset():j[c||a.type]&&(J=j[c||a.type](a,z,E),this.mergeHandlerResult(_,v,J,q,m),J&&J.needsRenderFrame&&this._triggerRenderFrame()),(J||j.isActive())&&(b[q]=j)}const B={};for(const q in this._previousActiveHandlers)b[q]||(B[q]=m);this._previousActiveHandlers=b,(Object.keys(B).length||Pa(_))&&(this._changes.push([_,v,B]),this._triggerRenderFrame()),(Object.keys(b).length||Pa(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:V}=_;V&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],V(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new uo(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);const o=this._el;this._listeners=[[o,"touchstart",{passive:!0}],[o,"touchmove",{passive:!1}],[o,"touchend",void 0],[o,"touchcancel",void 0],[o,"mousedown",void 0],[o,"mousemove",void 0],[o,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[o,"mouseover",void 0],[o,"mouseout",void 0],[o,"dblclick",void 0],[o,"click",void 0],[o,"keydown",{capture:!1}],[o,"keyup",void 0],[o,"wheel",{passive:!1}],[o,"contextmenu",void 0],[window,"blur",void 0]];for(const[a,c,m]of this._listeners)ae.addEventListener(a,c,a===document?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(const[t,n,o]of this._listeners)ae.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,o)}_addDefaultHandlers(t){const n=this._map,o=n.getCanvasContainer();this._add("mapEvent",new fo(n,t));const a=n.boxZoom=new da(n,t);this._add("boxZoom",a),t.interactive&&t.boxZoom&&a.enable();const c=n.cooperativeGestures=new nr(n,t.cooperativeGestures);this._add("cooperativeGestures",c),t.cooperativeGestures&&c.enable();const m=new Ll(n),_=new As(n);n.doubleClickZoom=new Ta(_,m),this._add("tapZoom",m),this._add("clickZoom",_),t.interactive&&t.doubleClickZoom&&n.doubleClickZoom.enable();const v=new Fl;this._add("tapDragZoom",v);const b=n.touchPitch=new va(n);this._add("touchPitch",b),t.interactive&&t.touchPitch&&n.touchPitch.enable(t.touchPitch);const P=ma(t),E=yn(t);n.dragRotate=new rr(t,P,E),this._add("mouseRotate",P,["mousePitch"]),this._add("mousePitch",E,["mouseRotate"]),t.interactive&&t.dragRotate&&n.dragRotate.enable();const z=(({enable:J,clickTolerance:N})=>{const ee=new ki({checkCorrectEvent:ne=>ae.mouseButton(ne)===0&&!ne.ctrlKey});return new Lt({clickTolerance:N,move:(ne,le)=>({around:le,panDelta:le.sub(ne)}),activateOnStart:!0,moveStateManager:ee,enable:J,assignEvents:Ts})})(t),B=new Is(t,n);n.dragPan=new Wi(o,z,B),this._add("mousePan",z),this._add("touchPan",B,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&n.dragPan.enable(t.dragPan);const V=new xa,q=new _a;n.touchZoomRotate=new Ia(o,q,V,v),this._add("touchRotate",V,["touchPan","touchZoom"]),this._add("touchZoom",q,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&n.touchZoomRotate.enable(t.touchZoomRotate);const j=n.scrollZoom=new Sa(n,()=>this._triggerRenderFrame());this._add("scrollZoom",j,["mousePan"]),t.interactive&&t.scrollZoom&&n.scrollZoom.enable(t.scrollZoom);const H=n.keyboard=new ba(n);this._add("keyboard",H),t.interactive&&t.keyboard&&n.keyboard.enable(),this._add("blockableMapEvent",new ua(n))}_add(t,n,o){this._handlers.push({handlerName:t,handler:n,allowed:o}),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!!Rr(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,n,o){for(const a in t)if(a!==o&&(!n||n.indexOf(a)<0))return!0;return!1}_getMapTouches(t){const n=[];for(const o of t)this._el.contains(o.target)&&n.push(o);return n}mergeHandlerResult(t,n,o,a,c){if(!o)return;u.e(t,o);const m={handlerName:a,originalEvent:o.originalEvent||c};o.zoomDelta!==void 0&&(n.zoom=m),o.panDelta!==void 0&&(n.drag=m),o.pitchDelta!==void 0&&(n.pitch=m),o.bearingDelta!==void 0&&(n.rotate=m)}_applyChanges(){const t={},n={},o={};for(const[a,c,m]of this._changes)a.panDelta&&(t.panDelta=(t.panDelta||new u.P(0,0))._add(a.panDelta)),a.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+a.zoomDelta),a.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+a.bearingDelta),a.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+a.pitchDelta),a.around!==void 0&&(t.around=a.around),a.pinchAround!==void 0&&(t.pinchAround=a.pinchAround),a.noInertia&&(t.noInertia=a.noInertia),u.e(n,c),u.e(o,m);this._updateMapTransform(t,n,o),this._changes=[]}_updateMapTransform(t,n,o){const a=this._map,c=a._getTransformForUpdate(),m=a.terrain;if(!(Pa(t)||m&&this._terrainMovement))return this._fireEvents(n,o,!0);let{panDelta:_,zoomDelta:v,bearingDelta:b,pitchDelta:P,around:E,pinchAround:z}=t;z!==void 0&&(E=z),a._stop(!0),E=E||a.transform.centerPoint;const B=c.pointLocation(_?E.sub(_):E);b&&(c.bearing+=b),P&&(c.pitch+=P),v&&(c.zoom+=v),m?this._terrainMovement||!n.drag&&!n.zoom?n.drag&&this._terrainMovement?c.center=c.pointLocation(c.centerPoint.sub(_)):c.setLocationAtPoint(B,E):(this._terrainMovement=!0,this._map._elevationFreeze=!0,c.setLocationAtPoint(B,E)):c.setLocationAtPoint(B,E),a._applyUpdatedTransform(c),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,o,!0)}_fireEvents(t,n,o){const a=Rr(this._eventsInProgress),c=Rr(t),m={};for(const E in t){const{originalEvent:z}=t[E];this._eventsInProgress[E]||(m[`${E}start`]=z),this._eventsInProgress[E]=t[E]}!a&&c&&this._fireEvent("movestart",c.originalEvent);for(const E in m)this._fireEvent(E,m[E]);c&&this._fireEvent("move",c.originalEvent);for(const E in t){const{originalEvent:z}=t[E];this._fireEvent(E,z)}const _={};let v;for(const E in this._eventsInProgress){const{handlerName:z,originalEvent:B}=this._eventsInProgress[E];this._handlersById[z].isActive()||(delete this._eventsInProgress[E],v=n[z]||B,_[`${E}end`]=v)}for(const E in _)this._fireEvent(E,_[E]);const b=Rr(this._eventsInProgress),P=(a||c)&&!b;if(P&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const E=this._map._getTransformForUpdate();E.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(E)}if(o&&P){this._updatingCamera=!0;const E=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),z=B=>B!==0&&-this._bearingSnap<B&&B<this._bearingSnap;!E||!E.essential&&he.prefersReducedMotion?(this._map.fire(new u.k("moveend",{originalEvent:v})),z(this._map.getBearing())&&this._map.resetNorth()):(z(E.bearing||this._map.getBearing())&&(E.bearing=0),E.freezeElevation=!0,this._map.easeTo(E,{originalEvent:v})),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new u.k(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new Wc("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Kc extends u.E{constructor(t,n){super(),this._renderFrameCallback=()=>{const o=Math.min((he.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(o)),o<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 u.N(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,o){return t=u.P.convert(t).mult(-1),this.panTo(this.transform.center,u.e({offset:t},n),o)}panTo(t,n,o){return this.easeTo(u.e({center:t},n),o)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,o){return this.easeTo(u.e({zoom:t},n),o)}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,o){return this.easeTo(u.e({bearing:t},n),o)}resetNorth(t,n){return this.rotateTo(0,u.e({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(u.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=ue.convert(t);const o=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),o,n)}_cameraForBoxAndBearing(t,n,o,a){const c={top:0,bottom:0,right:0,left:0};if(typeof(a=u.e({padding:c,offset:[0,0],maxZoom:this.transform.maxZoom},a)).padding=="number"){const be=a.padding;a.padding={top:be,bottom:be,right:be,left:be}}a.padding=u.e(c,a.padding);const m=this.transform,_=m.padding,v=new ue(t,n),b=m.project(v.getNorthWest()),P=m.project(v.getNorthEast()),E=m.project(v.getSouthEast()),z=m.project(v.getSouthWest()),B=u.ba(-o),V=b.rotate(B),q=P.rotate(B),j=E.rotate(B),H=z.rotate(B),J=new u.P(Math.max(V.x,q.x,H.x,j.x),Math.max(V.y,q.y,H.y,j.y)),N=new u.P(Math.min(V.x,q.x,H.x,j.x),Math.min(V.y,q.y,H.y,j.y)),ee=J.sub(N),ne=(m.width-(_.left+_.right+a.padding.left+a.padding.right))/ee.x,le=(m.height-(_.top+_.bottom+a.padding.top+a.padding.bottom))/ee.y;if(le<0||ne<0)return void u.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const ge=Math.min(m.scaleZoom(m.scale*Math.min(ne,le)),a.maxZoom),ve=u.P.convert(a.offset),De=new u.P((a.padding.left-a.padding.right)/2,(a.padding.top-a.padding.bottom)/2).rotate(u.ba(o)),Re=ve.add(De).mult(m.scale/m.zoomScale(ge));return{center:m.unproject(b.add(E).div(2).sub(Re)),zoom:ge,bearing:o}}fitBounds(t,n,o){return this._fitInternal(this.cameraForBounds(t,n),n,o)}fitScreenCoordinates(t,n,o,a,c){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(u.P.convert(t)),this.transform.pointLocation(u.P.convert(n)),o,a),a,c)}_fitInternal(t,n,o){return t?(delete(n=u.e(t,n)).padding,n.linear?this.easeTo(n,o):this.flyTo(n,o)):this}jumpTo(t,n){this.stop();const o=this._getTransformForUpdate();let a=!1,c=!1,m=!1;return"zoom"in t&&o.zoom!==+t.zoom&&(a=!0,o.zoom=+t.zoom),t.center!==void 0&&(o.center=u.N.convert(t.center)),"bearing"in t&&o.bearing!==+t.bearing&&(c=!0,o.bearing=+t.bearing),"pitch"in t&&o.pitch!==+t.pitch&&(m=!0,o.pitch=+t.pitch),t.padding==null||o.isPaddingEqual(t.padding)||(o.padding=t.padding),this._applyUpdatedTransform(o),this.fire(new u.k("movestart",n)).fire(new u.k("move",n)),a&&this.fire(new u.k("zoomstart",n)).fire(new u.k("zoom",n)).fire(new u.k("zoomend",n)),c&&this.fire(new u.k("rotatestart",n)).fire(new u.k("rotate",n)).fire(new u.k("rotateend",n)),m&&this.fire(new u.k("pitchstart",n)).fire(new u.k("pitch",n)).fire(new u.k("pitchend",n)),this.fire(new u.k("moveend",n))}calculateCameraOptionsFromTo(t,n,o,a=0){const c=u.Z.fromLngLat(t,n),m=u.Z.fromLngLat(o,a),_=m.x-c.x,v=m.y-c.y,b=m.z-c.z,P=Math.hypot(_,v,b);if(P===0)throw new Error("Can't calculate camera options with same From and To");const E=Math.hypot(_,v),z=this.transform.scaleZoom(this.transform.cameraToCenterDistance/P/this.transform.tileSize),B=180*Math.atan2(_,-v)/Math.PI;let V=180*Math.acos(E/P)/Math.PI;return V=b<0?90-V:90+V,{center:m.toLngLat(),zoom:z,pitch:V,bearing:B}}easeTo(t,n){var o;this._stop(!1,t.easeId),((t=u.e({offset:[0,0],duration:500,easing:u.b9},t)).animate===!1||!t.essential&&he.prefersReducedMotion)&&(t.duration=0);const a=this._getTransformForUpdate(),c=a.zoom,m=a.bearing,_=a.pitch,v=a.padding,b="bearing"in t?this._normalizeBearing(t.bearing,m):m,P="pitch"in t?+t.pitch:_,E="padding"in t?t.padding:a.padding,z=u.P.convert(t.offset);let B=a.centerPoint.add(z);const V=a.pointLocation(B),{center:q,zoom:j}=a.getConstrained(u.N.convert(t.center||V),(o=t.zoom)!==null&&o!==void 0?o:c);this._normalizeCenter(q,a);const H=a.project(V),J=a.project(q).sub(H),N=a.zoomScale(j-c);let ee,ne;t.around&&(ee=u.N.convert(t.around),ne=a.locationPoint(ee));const le={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||j!==c,this._rotating=this._rotating||m!==b,this._pitching=this._pitching||P!==_,this._padding=!a.isPaddingEqual(E),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,le),this.terrain&&this._prepareElevation(q),this._ease(ge=>{if(this._zooming&&(a.zoom=u.z.number(c,j,ge)),this._rotating&&(a.bearing=u.z.number(m,b,ge)),this._pitching&&(a.pitch=u.z.number(_,P,ge)),this._padding&&(a.interpolatePadding(v,E,ge),B=a.centerPoint.add(z)),this.terrain&&!t.freezeElevation&&this._updateElevation(ge),ee)a.setLocationAtPoint(ee,ne);else{const ve=a.zoomScale(a.zoom-c),De=j>c?Math.min(2,N):Math.max(.5,N),Re=Math.pow(De,1-ge),be=a.unproject(H.add(J.mult(ge*Re)).mult(ve));a.setLocationAtPoint(a.renderWorldCopies?be.wrap():be,B)}this._applyUpdatedTransform(a),this._fireMoveEvents(n)},ge=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n,ge)},t),this}_prepareEase(t,n,o={}){this._moving=!0,n||o.moving||this.fire(new u.k("movestart",t)),this._zooming&&!o.zooming&&this.fire(new u.k("zoomstart",t)),this._rotating&&!o.rotating&&this.fire(new u.k("rotatestart",t)),this._pitching&&!o.pitching&&this.fire(new u.k("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&n!==this._elevationTarget){const o=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(o-(n-(o*t+this._elevationStart))/(1-t)),this._elevationTarget=n}this.transform.elevation=u.z.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){const n=t.getCameraPosition(),o=this.terrain.getElevationForLngLatZoom(n.lngLat,t.zoom);if(n.altitude<o){const a=this.calculateCameraOptionsFromTo(n.lngLat,o,t.center,t.elevation);return{pitch:a.pitch,zoom:a.zoom}}return{}}_applyUpdatedTransform(t){const n=[];if(this.terrain&&n.push(a=>this._elevateCameraIfInsideTerrain(a)),this.transformCameraUpdate&&n.push(a=>this.transformCameraUpdate(a)),!n.length)return;const o=t.clone();for(const a of n){const c=o.clone(),{center:m,zoom:_,pitch:v,bearing:b,elevation:P}=a(c);m&&(c.center=m),_!==void 0&&(c.zoom=_),v!==void 0&&(c.pitch=v),b!==void 0&&(c.bearing=b),P!==void 0&&(c.elevation=P),o.apply(c)}this.transform.apply(o)}_fireMoveEvents(t){this.fire(new u.k("move",t)),this._zooming&&this.fire(new u.k("zoom",t)),this._rotating&&this.fire(new u.k("rotate",t)),this._pitching&&this.fire(new u.k("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const o=this._zooming,a=this._rotating,c=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,o&&this.fire(new u.k("zoomend",t)),a&&this.fire(new u.k("rotateend",t)),c&&this.fire(new u.k("pitchend",t)),this.fire(new u.k("moveend",t))}flyTo(t,n){var o;if(!t.essential&&he.prefersReducedMotion){const ke=u.M(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(ke,n)}this.stop(),t=u.e({offset:[0,0],speed:1.2,curve:1.42,easing:u.b9},t);const a=this._getTransformForUpdate(),c=a.zoom,m=a.bearing,_=a.pitch,v=a.padding,b="bearing"in t?this._normalizeBearing(t.bearing,m):m,P="pitch"in t?+t.pitch:_,E="padding"in t?t.padding:a.padding,z=u.P.convert(t.offset);let B=a.centerPoint.add(z);const V=a.pointLocation(B),{center:q,zoom:j}=a.getConstrained(u.N.convert(t.center||V),(o=t.zoom)!==null&&o!==void 0?o:c);this._normalizeCenter(q,a);const H=a.zoomScale(j-c),J=a.project(V),N=a.project(q).sub(J);let ee=t.curve;const ne=Math.max(a.width,a.height),le=ne/H,ge=N.mag();if("minZoom"in t){const ke=u.ad(Math.min(t.minZoom,c,j),a.minZoom,a.maxZoom),Qe=ne/a.zoomScale(ke-c);ee=Math.sqrt(Qe/ge*2)}const ve=ee*ee;function De(ke){const Qe=(le*le-ne*ne+(ke?-1:1)*ve*ve*ge*ge)/(2*(ke?le:ne)*ve*ge);return Math.log(Math.sqrt(Qe*Qe+1)-Qe)}function Re(ke){return(Math.exp(ke)-Math.exp(-ke))/2}function be(ke){return(Math.exp(ke)+Math.exp(-ke))/2}const Se=De(!1);let Ne=function(ke){return be(Se)/be(Se+ee*ke)},it=function(ke){return ne*((be(Se)*(Re(Qe=Se+ee*ke)/be(Qe))-Re(Se))/ve)/ge;var Qe},Ee=(De(!0)-Se)/ee;if(Math.abs(ge)<1e-6||!isFinite(Ee)){if(Math.abs(ne-le)<1e-6)return this.easeTo(t,n);const ke=le<ne?-1:1;Ee=Math.abs(Math.log(le/ne))/ee,it=()=>0,Ne=Qe=>Math.exp(ke*ee*Qe)}return t.duration="duration"in t?+t.duration:1e3*Ee/("screenSpeed"in t?+t.screenSpeed/ee:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=m!==b,this._pitching=P!==_,this._padding=!a.isPaddingEqual(E),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(q),this._ease(ke=>{const Qe=ke*Ee,Rt=1/Ne(Qe);a.zoom=ke===1?j:c+a.scaleZoom(Rt),this._rotating&&(a.bearing=u.z.number(m,b,ke)),this._pitching&&(a.pitch=u.z.number(_,P,ke)),this._padding&&(a.interpolatePadding(v,E,ke),B=a.centerPoint.add(z)),this.terrain&&!t.freezeElevation&&this._updateElevation(ke);const ot=ke===1?q:a.unproject(J.add(N.mult(it(Qe))).mult(Rt));a.setLocationAtPoint(a.renderWorldCopies?ot.wrap():ot,B),this._applyUpdatedTransform(a),this._fireMoveEvents(n)},()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){var o;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const a=this._onEaseEnd;delete this._onEaseEnd,a.call(this,n)}return t||(o=this.handlers)===null||o===void 0||o.stop(!1),this}_ease(t,n,o){o.animate===!1||o.duration===0?(t(1),n()):(this._easeStart=he.now(),this._easeOptions=o,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,n){t=u.b3(t,-180,180);const o=Math.abs(t-n);return Math.abs(t-360-n)<o&&(t-=360),Math.abs(t+360-n)<o&&(t+=360),t}_normalizeCenter(t,n){if(!n.renderWorldCopies||n.lngRange)return;const o=t.lng-n.center.lng;t.lng+=o>180?-360:o<-180?360:0}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(u.N.convert(t),this.transform.tileZoom)-this.transform.elevation:null}}const Ea={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Nn{constructor(t=Ea){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.compact,this._container=ae.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=ae.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ae.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(){ae.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 o=this._map._getUIString(`AttributionControl.${n}`);t.title=o,t.setAttribute("aria-label",o)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(a=>typeof a!="string"?"":a)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const a=this._map.style.stylesheet;this.styleOwner=a.owner,this.styleId=a.id}const n=this._map.style.sourceCaches;for(const a in n){const c=n[a];if(c.used||c.usedForTerrain){const m=c.getSource();m.attribution&&t.indexOf(m.attribution)<0&&t.push(m.attribution)}}t=t.filter(a=>String(a).trim()),t.sort((a,c)=>a.length-c.length),t=t.filter((a,c)=>{for(let m=c+1;m<t.length;m++)if(t[m].indexOf(a)>=0)return!1;return!0});const o=t.join(" | ");o!==this._attribHTML&&(this._attribHTML=o,t.length?(this._innerContainer.innerHTML=o,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class vr{constructor(t={}){this._updateCompact=()=>{const n=this._container.children;if(n.length){const o=n[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&o.classList.add("maplibregl-compact"):o.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=ae.create("div","maplibregl-ctrl");const n=ae.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(){ae.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Fe{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,o=n?this._queue.concat(n):this._queue;for(const a of o)if(a.id===t)return void(a.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 o of n)if(!o.cancelled&&(o.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Ol=u.Y([{name:"a_pos3d",type:"Int16",components:3}]);class Aa extends u.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 o={};for(const a of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))o[a.key]=!0,this._renderableTilesKeys.push(a.key),this._tiles[a.key]||(a.posMatrix=new Float64Array(16),u.aQ(a.posMatrix,0,u.X,0,u.X,0,1),this._tiles[a.key]=new $r(a,this.tileSize));for(const a in this._tiles)o[a]||delete this._tiles[a]}freeRtt(t){for(const n in this._tiles){const o=this._tiles[n];(!t||o.tileID.equals(t)||o.tileID.isChildOf(t)||t.isChildOf(o.tileID))&&(o.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const n={};for(const o of this._renderableTilesKeys){const a=this._tiles[o].tileID;if(a.canonical.equals(t.canonical)){const c=t.clone();c.posMatrix=new Float64Array(16),u.aQ(c.posMatrix,0,u.X,0,u.X,0,1),n[o]=c}else if(a.canonical.isChildOf(t.canonical)){const c=t.clone();c.posMatrix=new Float64Array(16);const m=a.canonical.z-t.canonical.z,_=a.canonical.x-(a.canonical.x>>m<<m),v=a.canonical.y-(a.canonical.y>>m<<m),b=u.X>>m;u.aQ(c.posMatrix,0,b,0,b,0,1),u.J(c.posMatrix,c.posMatrix,[-_*b,-v*b,0]),n[o]=c}else if(t.canonical.isChildOf(a.canonical)){const c=t.clone();c.posMatrix=new Float64Array(16);const m=t.canonical.z-a.canonical.z,_=t.canonical.x-(t.canonical.x>>m<<m),v=t.canonical.y-(t.canonical.y>>m<<m),b=u.X>>m;u.aQ(c.posMatrix,0,u.X,0,u.X,0,1),u.J(c.posMatrix,c.posMatrix,[_*b,v*b,0]),u.K(c.posMatrix,c.posMatrix,[1/2**m,1/2**m,0]),n[o]=c}}return n}getSourceTile(t,n){const o=this.sourceCache._source;let a=t.overscaledZ-this.deltaZoom;if(a>o.maxzoom&&(a=o.maxzoom),a<o.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(a).key);let c=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!c||!c.dem)&&n)for(;a>=o.minzoom&&(!c||!c.dem);)c=this.sourceCache.getTileByID(t.scaledTo(a--).key);return c}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(n=>n.timeAdded>=t)}}class Vl{constructor(t,n,o){this.painter=t,this.sourceCache=new Aa(n),this.options=o,this.exaggeration=typeof o.exaggeration=="number"?o.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,n,o,a=u.X){var c;if(!(n>=0&&n<a&&o>=0&&o<a))return 0;const m=this.getTerrainData(t),_=(c=m.tile)===null||c===void 0?void 0:c.dem;if(!_)return 0;const v=function(V,q,j){var H=q[0],J=q[1];return V[0]=j[0]*H+j[4]*J+j[12],V[1]=j[1]*H+j[5]*J+j[13],V}([],[n/a*u.X,o/a*u.X],m.u_terrain_matrix),b=[v[0]*_.dim,v[1]*_.dim],P=Math.floor(b[0]),E=Math.floor(b[1]),z=b[0]-P,B=b[1]-E;return _.get(P,E)*(1-z)*(1-B)+_.get(P+1,E)*z*(1-B)+_.get(P,E+1)*(1-z)*B+_.get(P+1,E+1)*z*B}getElevationForLngLatZoom(t,n){const{tileID:o,mercatorX:a,mercatorY:c}=this._getOverscaledTileIDFromLngLatZoom(t,n);return this.getElevation(o,a%u.X,c%u.X,u.X)}getElevation(t,n,o,a=u.X){return this.getDEMElevation(t,n,o,a)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const a=this.painter.context,c=new u.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new vt(a,c,a.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new vt(a,new u.R({width:1,height:1}),a.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(a.gl.NEAREST,a.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=u.ao([])}const n=this.sourceCache.getSourceTile(t,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const a=this.painter.context;n.demTexture=this.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new vt(a,n.dem.getPixels(),a.gl.RGBA,{premultiply:!1}),n.demTexture.bind(a.gl.NEAREST,a.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const o=n&&n+n.tileID.key+t.key;if(o&&!this._demMatrixCache[o]){const a=this.sourceCache.sourceCache._source.maxzoom;let c=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=a?c=t.canonical.z-a:u.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const m=t.canonical.x-(t.canonical.x>>c<<c),_=t.canonical.y-(t.canonical.y>>c<<c),v=u.bb(new Float64Array(16),[1/(u.X<<c),1/(u.X<<c),0]);u.J(v,v,[m*u.X,_*u.X,0]),this._demMatrixCache[t.key]={matrix:v,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:o?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,o=n.width/devicePixelRatio,a=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===o&&this._fbo.height===a||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new vt(n.context,{width:o,height:a,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 vt(n.context,{width:o,height:a,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=n.context.createFramebuffer(o,a,!0,!1),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,o,a))),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 c=0,m=0;c<this._coordsTextureSize;c++)for(let _=0;_<this._coordsTextureSize;_++,m+=4)n[m+0]=255&_,n[m+1]=255&c,n[m+2]=_>>8<<4|c>>8,n[m+3]=0;const o=new u.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),a=new vt(t,o,t.gl.RGBA,{premultiply:!1});return a.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=a,a}pointCoordinate(t){this.painter.maybeDrawDepthAndCoords(!0);const n=new Uint8Array(4),o=this.painter.context,a=o.gl,c=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),m=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),_=Math.round(this.painter.height/devicePixelRatio);o.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),a.readPixels(c,_-m-1,1,1,a.RGBA,a.UNSIGNED_BYTE,n),o.bindFramebuffer.set(null);const v=n[0]+(n[2]>>4<<8),b=n[1]+((15&n[2])<<8),P=this.coordsIndex[255-n[3]],E=P&&this.sourceCache.getTileByID(P);if(!E)return null;const z=this._coordsTextureSize,B=(1<<E.tileID.canonical.z)*z;return new u.Z((E.tileID.canonical.x*z+v)/B+E.tileID.wrap,(E.tileID.canonical.y*z+b)/B,this.getElevation(E.tileID,v,b,z))}depthAtPoint(t){const n=new Uint8Array(4),o=this.painter.context,a=o.gl;return o.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),a.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,a.RGBA,a.UNSIGNED_BYTE,n),o.bindFramebuffer.set(null),(n[0]/16777216+n[1]/65536+n[2]/256+n[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.painter.context,n=new u.bc,o=new u.aY,a=this.meshSize,c=u.X/a,m=a*a;for(let E=0;E<=a;E++)for(let z=0;z<=a;z++)n.emplaceBack(z*c,E*c,0);for(let E=0;E<m;E+=a+1)for(let z=0;z<a;z++)o.emplaceBack(z+E,a+z+E+1,a+z+E+2),o.emplaceBack(z+E,a+z+E+2,z+E+1);const _=n.length,v=_+2*(a+1);for(const E of[0,1])for(let z=0;z<=a;z++)for(const B of[0,1])n.emplaceBack(z*c,E*u.X,B);for(let E=0;E<2*a;E+=2)o.emplaceBack(v+E,v+E+1,v+E+3),o.emplaceBack(v+E,v+E+3,v+E+2),o.emplaceBack(_+E,_+E+3,_+E+1),o.emplaceBack(_+E,_+E+2,_+E+3);const b=n.length,P=b+2*(a+1);for(const E of[0,1])for(let z=0;z<=a;z++)for(const B of[0,1])n.emplaceBack(E*u.X,z*c,B);for(let E=0;E<2*a;E+=2)o.emplaceBack(b+E,b+E+1,b+E+3),o.emplaceBack(b+E,b+E+3,b+E+2),o.emplaceBack(P+E,P+E+3,P+E+1),o.emplaceBack(P+E,P+E+2,P+E+3);return this._mesh=new Ml(t.createVertexBuffer(n,Ol.members),t.createIndexBuffer(o),u.a0.simpleSegment(0,0,n.length,o.length)),this._mesh}getMeshFrameDelta(t){return 2*Math.PI*u.bd/Math.pow(2,t)/5}getMinTileElevationForLngLatZoom(t,n){var o;const{tileID:a}=this._getOverscaledTileIDFromLngLatZoom(t,n);return(o=this.getMinMaxElevation(a).minElevation)!==null&&o!==void 0?o:0}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,o={minElevation:null,maxElevation:null};return n&&n.dem&&(o.minElevation=n.dem.min*this.exaggeration,o.maxElevation=n.dem.max*this.exaggeration),o}_getOverscaledTileIDFromLngLatZoom(t,n){const o=u.Z.fromLngLat(t.wrap()),a=(1<<n)*u.X,c=o.x*a,m=o.y*a,_=Math.floor(c/u.X),v=Math.floor(m/u.X);return{tileID:new u.S(n,0,n,_,v),mercatorX:c,mercatorY:m}}}class Cs{constructor(t,n,o){this._context=t,this._size=n,this._tileSize=o,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),o=new vt(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return o.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),n.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),n.colorAttachment.set(o.texture),{id:t,fbo:n,texture:o,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 br={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Nl{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new Cs(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(o=>!t._layers[o].isHidden(n)),this._coordsDescendingInv={};for(const o in t.sourceCaches){this._coordsDescendingInv[o]={};const a=t.sourceCaches[o].getVisibleCoordinates();for(const c of a){const m=this.terrain.sourceCache.getTerrainCoords(c);for(const _ in m)this._coordsDescendingInv[o][_]||(this._coordsDescendingInv[o][_]=[]),this._coordsDescendingInv[o][_].push(m[_])}}this._coordsDescendingInvStr={};for(const o of t._order){const a=t._layers[o],c=a.source;if(br[a.type]&&!this._coordsDescendingInvStr[c]){this._coordsDescendingInvStr[c]={};for(const m in this._coordsDescendingInv[c])this._coordsDescendingInvStr[c][m]=this._coordsDescendingInv[c][m].map(_=>_.key).sort().join()}}for(const o of this._renderableTiles)for(const a in this._coordsDescendingInvStr){const c=this._coordsDescendingInvStr[a][o.tileID.key];c&&c!==o.rttCoords[a]&&(o.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const n=t.type,o=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(br[n]&&(this._prevType&&br[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!a))return!0;if(br[this._prevType]||br[n]&&a){this._prevType=n;const c=this._stacks.length-1,m=this._stacks[c]||[];for(const _ of this._renderableTiles){if(this.pool.isFull()&&(bs(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(_),_.rtt[c]){const b=this.pool.getObjectForId(_.rtt[c].id);if(b.stamp===_.rtt[c].stamp){this.pool.useObject(b);continue}}const v=this.pool.getOrCreateFreeObject();this.pool.useObject(v),this.pool.stampObject(v),_.rtt[c]={id:v.id,stamp:v.stamp},o.context.bindFramebuffer.set(v.fbo.framebuffer),o.context.clear({color:u.aN.transparent,stencil:0}),o.currentStencilSource=void 0;for(let b=0;b<m.length;b++){const P=o.style._layers[m[b]],E=P.source?this._coordsDescendingInv[P.source][_.tileID.key]:[_.tileID];o.context.viewport.set([0,0,v.fbo.width,v.fbo.height]),o._renderTileClippingMasks(P,E),o.renderLayer(o,o.style.sourceCaches[P.source],P,E),P.source&&(_.rttCoords[P.source]=this._coordsDescendingInvStr[P.source][_.tileID.key])}}return bs(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),br[n]}return!1}}const ze={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},Ca=Ie,Yc={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Ea,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,refreshExpiredTiles:!0,scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],zoom:0,bearing:0,pitch:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:u.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0},jl=h=>{h.touchstart=h.dragStart,h.touchmoveWindow=h.dragMove,h.touchend=h.dragEnd},ka={showCompass:!0,showZoom:!0,visualizePitch:!1};class Ul{constructor(t,n,o=!1){this.mousedown=m=>{this.startMouse(u.e({},m,{ctrlKey:!0,preventDefault:()=>m.preventDefault()}),ae.mousePos(this.element,m)),ae.addEventListener(window,"mousemove",this.mousemove),ae.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=m=>{this.moveMouse(m,ae.mousePos(this.element,m))},this.mouseup=m=>{this.mouseRotate.dragEnd(m),this.mousePitch&&this.mousePitch.dragEnd(m),this.offTemp()},this.touchstart=m=>{m.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=ae.touchPos(this.element,m.targetTouches)[0],this.startTouch(m,this._startPos),ae.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),ae.addEventListener(window,"touchend",this.touchend))},this.touchmove=m=>{m.targetTouches.length!==1?this.reset():(this._lastPos=ae.touchPos(this.element,m.targetTouches)[0],this.moveTouch(m,this._lastPos))},this.touchend=m=>{m.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 a=t.dragRotate._mouseRotate.getClickTolerance(),c=t.dragRotate._mousePitch.getClickTolerance();this.element=n,this.mouseRotate=ma({clickTolerance:a,enable:!0}),this.touchRotate=(({enable:m,clickTolerance:_,bearingDegreesPerPixelMoved:v=.8})=>{const b=new mo;return new Lt({clickTolerance:_,move:(P,E)=>({bearingDelta:(E.x-P.x)*v}),moveStateManager:b,enable:m,assignEvents:jl})})({clickTolerance:a,enable:!0}),this.map=t,o&&(this.mousePitch=yn({clickTolerance:c,enable:!0}),this.touchPitch=(({enable:m,clickTolerance:_,pitchDegreesPerPixelMoved:v=-.5})=>{const b=new mo;return new Lt({clickTolerance:_,move:(P,E)=>({pitchDelta:(E.y-P.y)*v}),moveStateManager:b,enable:m,assignEvents:jl})})({clickTolerance:c,enable:!0})),ae.addEventListener(n,"mousedown",this.mousedown),ae.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),ae.addEventListener(n,"touchcancel",this.reset)}startMouse(t,n){this.mouseRotate.dragStart(t,n),this.mousePitch&&this.mousePitch.dragStart(t,n),ae.disableDrag()}startTouch(t,n){this.touchRotate.dragStart(t,n),this.touchPitch&&this.touchPitch.dragStart(t,n),ae.disableDrag()}moveMouse(t,n){const o=this.map,{bearingDelta:a}=this.mouseRotate.dragMove(t,n)||{};if(a&&o.setBearing(o.getBearing()+a),this.mousePitch){const{pitchDelta:c}=this.mousePitch.dragMove(t,n)||{};c&&o.setPitch(o.getPitch()+c)}}moveTouch(t,n){const o=this.map,{bearingDelta:a}=this.touchRotate.dragMove(t,n)||{};if(a&&o.setBearing(o.getBearing()+a),this.touchPitch){const{pitchDelta:c}=this.touchPitch.dragMove(t,n)||{};c&&o.setPitch(o.getPitch()+c)}}off(){const t=this.element;ae.removeEventListener(t,"mousedown",this.mousedown),ae.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),ae.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ae.removeEventListener(window,"touchend",this.touchend),ae.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){ae.enableDrag(),ae.removeEventListener(window,"mousemove",this.mousemove),ae.removeEventListener(window,"mouseup",this.mouseup),ae.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ae.removeEventListener(window,"touchend",this.touchend)}}let Wr;function $l(h,t,n){const o=new u.N(h.lng,h.lat);if(h=new u.N(h.lng,h.lat),t){const a=new u.N(h.lng-360,h.lat),c=new u.N(h.lng+360,h.lat),m=n.locationPoint(h).distSqr(t);n.locationPoint(a).distSqr(t)<m?h=a:n.locationPoint(c).distSqr(t)<m&&(h=c)}for(;Math.abs(h.lng-n.center.lng)>180;){const a=n.locationPoint(h);if(a.x>=0&&a.y>=0&&a.x<=n.width&&a.y<=n.height)break;h.lng>n.center.lng?h.lng-=360:h.lng+=360}return h.lng!==o.lng&&n.locationPoint(h).y>n.height/2-n.getHorizon()?h:o}const Ma={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 Jr(h,t,n){const o=h.classList;for(const a in Ma)o.remove(`maplibregl-${n}-anchor-${a}`);o.add(`maplibregl-${n}-anchor-${t}`)}class kt extends u.E{constructor(t){if(super(),this._onKeyPress=n=>{const o=n.code,a=n.charCode||n.keyCode;o!=="Space"&&o!=="Enter"&&a!==32&&a!==13||this.togglePopup()},this._onMapClick=n=>{const o=n.originalEvent.target,a=this._element;this._popup&&(o===a||a.contains(o))&&this.togglePopup()},this._update=n=>{var o;if(!this._map)return;const a=this._map.loaded()&&!this._map.isMoving();((n==null?void 0:n.type)==="terrain"||(n==null?void 0:n.type)==="render"&&!a)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?$l(this._lngLat,this._flatPos,this._map.transform):(o=this._lngLat)===null||o===void 0?void 0:o.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let c="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?c=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(c=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let m="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?m="rotateX(0deg)":this._pitchAlignment==="map"&&(m=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||n&&n.type!=="moveend"||(this._pos=this._pos.round()),ae.setTransform(this._element,`${Ma[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${m} ${c}`),he.frameAsync(new AbortController).then(()=>{this._updateOpacity(n&&n.type==="moveend")}).catch(()=>{})},this._onMove=n=>{if(!this._isDragging){const o=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=o}this._isDragging&&(this._pos=n.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new u.k("dragstart"))),this.fire(new u.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 u.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._subpixelPositioning=t&&t.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(t==null?void 0:t.opacity,t==null?void 0:t.opacityWhenCovered),t&&t.element)this._element=t.element,this._offset=u.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=ae.create("div");const n=ae.createNS("http://www.w3.org/2000/svg","svg"),o=41,a=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${o}px`),n.setAttributeNS(null,"width",`${a}px`),n.setAttributeNS(null,"viewBox",`0 0 ${a} ${o}`);const c=ae.createNS("http://www.w3.org/2000/svg","g");c.setAttributeNS(null,"stroke","none"),c.setAttributeNS(null,"stroke-width","1"),c.setAttributeNS(null,"fill","none"),c.setAttributeNS(null,"fill-rule","evenodd");const m=ae.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"fill-rule","nonzero");const _=ae.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const v=[{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 H of v){const J=ae.createNS("http://www.w3.org/2000/svg","ellipse");J.setAttributeNS(null,"opacity","0.04"),J.setAttributeNS(null,"cx","10.5"),J.setAttributeNS(null,"cy","5.80029008"),J.setAttributeNS(null,"rx",H.rx),J.setAttributeNS(null,"ry",H.ry),_.appendChild(J)}const b=ae.createNS("http://www.w3.org/2000/svg","g");b.setAttributeNS(null,"fill",this._color);const P=ae.createNS("http://www.w3.org/2000/svg","path");P.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),b.appendChild(P);const E=ae.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"opacity","0.25"),E.setAttributeNS(null,"fill","#000000");const z=ae.createNS("http://www.w3.org/2000/svg","path");z.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),E.appendChild(z);const B=ae.createNS("http://www.w3.org/2000/svg","g");B.setAttributeNS(null,"transform","translate(6.0, 7.0)"),B.setAttributeNS(null,"fill","#FFFFFF");const V=ae.createNS("http://www.w3.org/2000/svg","g");V.setAttributeNS(null,"transform","translate(8.0, 8.0)");const q=ae.createNS("http://www.w3.org/2000/svg","circle");q.setAttributeNS(null,"fill","#000000"),q.setAttributeNS(null,"opacity","0.25"),q.setAttributeNS(null,"cx","5.5"),q.setAttributeNS(null,"cy","5.5"),q.setAttributeNS(null,"r","5.4999962");const j=ae.createNS("http://www.w3.org/2000/svg","circle");j.setAttributeNS(null,"fill","#FFFFFF"),j.setAttributeNS(null,"cx","5.5"),j.setAttributeNS(null,"cy","5.5"),j.setAttributeNS(null,"r","5.4999962"),V.appendChild(q),V.appendChild(j),m.appendChild(_),m.appendChild(b),m.appendChild(E),m.appendChild(B),m.appendChild(V),n.appendChild(m),n.setAttributeNS(null,"height",o*this._scale+"px"),n.setAttributeNS(null,"width",a*this._scale+"px"),this._element.appendChild(n),this._offset=u.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()}),Jr(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,this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),ae.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=u.N.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const a=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":[a,-1*(38.1-13.5+a)],"bottom-right":[-a,-1*(38.1-13.5+a)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var n,o;if(!(!((n=this._map)===null||n===void 0)&&n.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const a=this._map,c=a.terrain.depthAtPoint(this._pos),m=a.terrain.getElevationForLngLatZoom(this._lngLat,a.transform.tileZoom);if(a.transform.lngLatToCameraDepth(this._lngLat,m)-c<.006)return void(this._element.style.opacity=this._opacity);const _=-this._offset.y/a.transform._pixelPerMeter,v=Math.sin(a.getPitch()*Math.PI/180)*_,b=a.terrain.depthAtPoint(new u.P(this._pos.x,this._pos.y-this._offset.y)),P=a.transform.lngLatToCameraDepth(this._lngLat,m+v)-b>.006;!((o=this._popup)===null||o===void 0)&&o.isOpen()&&P&&this._popup.remove(),this._element.style.opacity=P?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=u.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,n){return t===void 0&&n===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=t),n!==void 0&&(this._opacityWhenCovered=n),this._map&&this._updateOpacity(!0),this}}const go={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let jn=0,Un=!1;const ql={maxWidth:100,unit:"metric"};function za(h,t,n){const o=n&&n.maxWidth||100,a=h._container.clientHeight/2,c=h.unproject([0,a]),m=h.unproject([o,a]),_=c.distanceTo(m);if(n&&n.unit==="imperial"){const v=3.2808*_;v>5280?ks(t,o,v/5280,h._getUIString("ScaleControl.Miles")):ks(t,o,v,h._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?ks(t,o,_/1852,h._getUIString("ScaleControl.NauticalMiles")):_>=1e3?ks(t,o,_/1e3,h._getUIString("ScaleControl.Kilometers")):ks(t,o,_,h._getUIString("ScaleControl.Meters"))}function ks(h,t,n,o){const a=function(c){const m=Math.pow(10,`${Math.floor(c)}`.length-1);let _=c/m;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(v){const b=Math.pow(10,Math.ceil(-Math.log(v)/Math.LN10));return Math.round(v*b)/b}(_),m*_}(n);h.style.width=t*(a/n)+"px",h.innerHTML=`${a} ${o}`}const wr={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},_o=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function qe(h){if(h){if(typeof h=="number"){const t=Math.round(Math.abs(h)/Math.SQRT2);return{center:new u.P(0,0),top:new u.P(0,h),"top-left":new u.P(t,t),"top-right":new u.P(-t,t),bottom:new u.P(0,-h),"bottom-left":new u.P(t,-t),"bottom-right":new u.P(-t,-t),left:new u.P(h,0),right:new u.P(-h,0)}}if(h instanceof u.P||Array.isArray(h)){const t=u.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:u.P.convert(h.center||[0,0]),top:u.P.convert(h.top||[0,0]),"top-left":u.P.convert(h["top-left"]||[0,0]),"top-right":u.P.convert(h["top-right"]||[0,0]),bottom:u.P.convert(h.bottom||[0,0]),"bottom-left":u.P.convert(h["bottom-left"]||[0,0]),"bottom-right":u.P.convert(h["bottom-right"]||[0,0]),left:u.P.convert(h.left||[0,0]),right:u.P.convert(h.right||[0,0])}}return qe(new u.P(0,0))}const Je=Ie;S.AJAXError=u.bg,S.Evented=u.E,S.LngLat=u.N,S.MercatorCoordinate=u.Z,S.Point=u.P,S.addProtocol=u.bh,S.config=u.a,S.removeProtocol=u.bi,S.AttributionControl=Nn,S.BoxZoomHandler=da,S.CanvasSource=Hi,S.CooperativeGesturesHandler=nr,S.DoubleClickZoomHandler=Ta,S.DragPanHandler=Wi,S.DragRotateHandler=rr,S.EdgeInsets=lo,S.FullscreenControl=class extends u.E{constructor(h={}){super(),this._onFullscreenChange=()=>{var t;let n=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((t=n==null?void 0:n.shadowRoot)===null||t===void 0)&&t.fullscreenElement;)n=n.shadowRoot.fullscreenElement;n===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:u.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=ae.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){ae.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const h=this._fullscreenButton=ae.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);ae.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 u.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new u.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},S.GeoJSONSource=ss,S.GeolocateControl=class extends u.E{constructor(h){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new u.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 u.k("geolocate",t)),this._finish()}},this._updateCamera=t=>{const n=new u.N(t.coords.longitude,t.coords.latitude),o=t.coords.accuracy,a=this._map.getBearing(),c=u.e({bearing:a},this.options.fitBoundsOptions),m=ue.fromLngLat(n,o);this._map.fitBounds(m,c,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const n=new u.N(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&&Un)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new u.k("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=ae.create("button","maplibregl-ctrl-geolocate",this._container),ae.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=t=>{if(this._map){if(t===!1){u.w("Geolocation support is not available so the GeolocateControl will be disabled.");const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}else{const n=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=ae.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new kt({element:this._dotElement}),this._circleElement=ae.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new kt({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",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 u.k("trackuserlocationend")),this.fire(new u.k("userlocationlostfocus")))})}},this.options=u.e({},go,h)}onAdd(h){return this._map=h,this._container=ae.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return u._(this,arguments,void 0,function*(t=!1){if(Wr!==void 0&&!t)return Wr;if(window.navigator.permissions===void 0)return Wr=!!window.navigator.geolocation,Wr;try{Wr=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Wr=!!window.navigator.geolocation}return Wr})}().then(t=>this._finishSetupUI(t)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),ae.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,jn=0,Un=!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(),o=t.distanceTo(n),a=Math.ceil(this._accuracy/(o/this._map._container.clientHeight)*2);this._circleElement.style.width=`${a}px`,this._circleElement.style.height=`${a}px`}trigger(){if(!this._setup)return u.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 u.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":jn--,Un=!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 u.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 u.k("trackuserlocationstart")),this.fire(new u.k("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let h;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),jn++,jn>1?(h={maximumAge:6e5,timeout:0},Un=!0):(h=this.options.positionOptions,Un=!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)}},S.Hash=ws,S.ImageSource=kr,S.KeyboardHandler=ba,S.LngLatBounds=ue,S.LogoControl=vr,S.Map=class extends Kc{constructor(h){u.be.mark(u.bf.create);const t=Object.assign(Object.assign({},Yc),h);if(t.minZoom!=null&&t.maxZoom!=null&&t.minZoom>t.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(t.minPitch!=null&&t.maxPitch!=null&&t.minPitch>t.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(t.minPitch!=null&&t.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(t.maxPitch!=null&&t.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new aa(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies),{bearingSnap:t.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Fe,this._controls=[],this._mapId=u.a4(),this._contextLost=n=>{n.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new u.k("webglcontextlost",{originalEvent:n}))},this._contextRestored=n=>{this._setupPainter(),this.resize(),this._update(),this.fire(new u.k("webglcontextrestored",{originalEvent:n}))},this._onMapScroll=n=>{if(n.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=t.interactive,this._maxTileCacheSize=t.maxTileCacheSize,this._maxTileCacheZoomLevels=t.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=t.preserveDrawingBuffer===!0,this._antialias=t.antialias===!0,this._trackResize=t.trackResize===!0,this._bearingSnap=t.bearingSnap,this._refreshExpiredTiles=t.refreshExpiredTiles===!0,this._fadeDuration=t.fadeDuration,this._crossSourceCollisions=t.crossSourceCollisions===!0,this._collectResourceTiming=t.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},ze),t.locale),this._clickTolerance=t.clickTolerance,this._overridePixelRatio=t.pixelRatio,this._maxCanvasSize=t.maxCanvasSize,this.transformCameraUpdate=t.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=t.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=We.addThrottleControl(()=>this.isMoving()),this._requestManager=new Ut(t.transformRequest),typeof t.container=="string"){if(this._container=document.getElementById(t.container),!this._container)throw new Error(`Container '${t.container}' not found.`)}else{if(!(t.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=t.container}if(t.maxBounds&&this.setMaxBounds(t.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)).on("moveend",()=>this._update(!1)).on("zoom",()=>this._update(!0)).on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}).once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let n=!1;const o=co(a=>{this._trackResize&&!this._removed&&this.resize(a)._update()},50);this._resizeObserver=new ResizeObserver(a=>{n?o(a):n=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Jc(this,t),this._hash=t.hash&&new ws(typeof t.hash=="string"&&t.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,u.e({},t.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=t.localIdeographFontFamily,this._validateStyle=t.validateStyle,t.style&&this.setStyle(t.style,{localIdeographFontFamily:t.localIdeographFontFamily}),t.attributionControl&&this.addControl(new Nn(typeof t.attributionControl=="boolean"?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new vr,t.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new u.k(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new u.k(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new u.k("sourcedataabort",n))})}_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 u.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 o=this._controlPositions[t];return t.indexOf("bottom")!==-1?o.insertBefore(n,o.firstChild):o.appendChild(n),this}removeControl(h){if(!h||!h.onRemove)return this.fire(new u.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,o){return o==null&&this.terrain&&(o=this.terrain.getElevationForLngLatZoom(n,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(h,t,n,o)}resize(h){var t;const n=this._containerDimensions(),o=n[0],a=n[1],c=this._getClampedPixelRatio(o,a);if(this._resizeCanvas(o,a,c),this.painter.resize(o,a,c),this.painter.overLimit()){const _=this.painter.context.gl;this._maxCanvasSize=[_.drawingBufferWidth,_.drawingBufferHeight];const v=this._getClampedPixelRatio(o,a);this._resizeCanvas(o,a,v),this.painter.resize(o,a,v)}this.transform.resize(o,a),(t=this._requestedCameraState)===null||t===void 0||t.resize(o,a);const m=!this._moving;return m&&(this.stop(),this.fire(new u.k("movestart",h)).fire(new u.k("move",h))),this.fire(new u.k("resize",h)),m&&this.fire(new u.k("moveend",h)),this}_getClampedPixelRatio(h,t){const{0:n,1:o}=this._maxCanvasSize,a=this.getPixelRatio(),c=h*a,m=t*a;return Math.min(c>n?n/c:1,m>o?o/m:1)*a}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(ue.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()}project(h){return this.transform.locationPoint(u.N.convert(h),this.style&&this.terrain)}unproject(h){return this.transform.pointLocation(u.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 o=!1;return{layer:t,listener:n,delegates:{mousemove:c=>{const m=this.getLayer(t)?this.queryRenderedFeatures(c.point,{layers:[t]}):[];m.length?o||(o=!0,n.call(this,new Ti(h,this,c.originalEvent,{features:m}))):o=!1},mouseout:()=>{o=!1}}}}if(h==="mouseleave"||h==="mouseout"){let o=!1;return{layer:t,listener:n,delegates:{mousemove:m=>{(this.getLayer(t)?this.queryRenderedFeatures(m.point,{layers:[t]}):[]).length?o=!0:o&&(o=!1,n.call(this,new Ti(h,this,m.originalEvent)))},mouseout:m=>{o&&(o=!1,n.call(this,new Ti(h,this,m.originalEvent)))}}}}{const o=a=>{const c=this.getLayer(t)?this.queryRenderedFeatures(a.point,{layers:[t]}):[];c.length&&(a.features=c,n.call(this,a),delete a.features)};return{layer:t,listener:n,delegates:{[h]:o}}}}on(h,t,n){if(n===void 0)return super.on(h,t);const o=this._createDelegatedListener(h,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[h]=this._delegatedListeners[h]||[],this._delegatedListeners[h].push(o);for(const a in o.delegates)this.on(a,o.delegates[a]);return this}once(h,t,n){if(n===void 0)return super.once(h,t);const o=this._createDelegatedListener(h,t,n);for(const a in o.delegates)this.once(a,o.delegates[a]);return this}off(h,t,n){return n===void 0?super.off(h,t):(this._delegatedListeners&&this._delegatedListeners[h]&&(o=>{const a=this._delegatedListeners[h];for(let c=0;c<a.length;c++){const m=a[c];if(m.layer===t&&m.listener===n){for(const _ in m.delegates)this.off(_,m.delegates[_]);return a.splice(c,1),this}}})(),this)}queryRenderedFeatures(h,t){if(!this.style)return[];let n;const o=h instanceof u.P||Array.isArray(h),a=o?h:[[0,0],[this.transform.width,this.transform.height]];if(t=t||(o?{}:h)||{},a instanceof u.P||typeof a[0]=="number")n=[u.P.convert(a)];else{const c=u.P.convert(a[0]),m=u.P.convert(a[1]);n=[c,new u.P(m.x,c.y),m,new u.P(c.x,m.y),c]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(h,t){return this.style.querySourceFeatures(h,t)}setStyle(h,t){return(t=u.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 Uo(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 Uo(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(h,t){if(typeof h=="string"){const n=this._requestManager.transformRequest(h,"Style");u.h(n,new AbortController).then(o=>{this._updateDiff(o.data,t)}).catch(o=>{o&&this.fire(new u.j(o))})}else typeof h=="object"&&this._updateDiff(h,t)}_updateDiff(h,t){try{this.style.setState(h,t)&&this._update(!0)}catch(n){u.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():u.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 u.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}`);this.terrain===null&&t.reload();for(const n in this.style._layers){const o=this.style._layers[n];o.type==="hillshade"&&o.source===h.source&&u.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 Vl(this.painter,t,h),this.painter.renderToTexture=new Nl(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=n=>{n.dataType==="style"?this.terrain.sourceCache.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId!==h.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(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.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new u.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 o in n){const a=n[o];if(a.state!=="loaded"&&a.state!=="errored")return!1}}return!0}removeSource(h){return this.style.removeSource(h),this._update(!0)}getSource(h){return this.style.getSource(h)}addImage(h,t,n={}){const{pixelRatio:o=1,sdf:a=!1,stretchX:c,stretchY:m,content:_,textFitWidth:v,textFitHeight:b}=n;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||u.b(t))){if(t.width===void 0||t.height===void 0)return this.fire(new u.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:P,height:E,data:z}=t,B=t;return this.style.addImage(h,{data:new u.R({width:P,height:E},new Uint8Array(z)),pixelRatio:o,stretchX:c,stretchY:m,content:_,textFitWidth:v,textFitHeight:b,sdf:a,version:0,userImage:B}),B.onAdd&&B.onAdd(this,h),this}}{const{width:P,height:E,data:z}=he.getImageData(t);this.style.addImage(h,{data:new u.R({width:P,height:E},z),pixelRatio:o,stretchX:c,stretchY:m,content:_,textFitWidth:v,textFitHeight:b,sdf:a,version:0})}}updateImage(h,t){const n=this.style.getImage(h);if(!n)return this.fire(new u.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const o=t instanceof HTMLImageElement||u.b(t)?he.getImageData(t):t,{width:a,height:c,data:m}=o;if(a===void 0||c===void 0)return this.fire(new u.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(a!==n.data.width||c!==n.data.height)return this.fire(new u.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||u.b(t));return n.data.replace(m,_),this.style.updateImage(h,n),this}getImage(h){return this.style.getImage(h)}hasImage(h){return h?!!this.style.getImage(h):(this.fire(new u.j(new Error("Missing required image id"))),!1)}removeImage(h){this.style.removeImage(h)}loadImage(h){return We.getImage(this._requestManager.transformRequest(h,"Image"),new AbortController)}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,o={}){return this.style.setPaintProperty(h,t,n,o),this._update(!0)}getPaintProperty(h,t){return this.style.getPaintProperty(h,t)}setLayoutProperty(h,t,n,o={}){return this.style.setLayoutProperty(h,t,n,o),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,o=>{o||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()}setSky(h){return this._lazyInitEmptyStyle(),this.style.setSky(h),this._update(!0)}getSky(){return this.style.getSky()}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=ae.create("div","maplibregl-canvas-container",h);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=ae.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const n=this._containerDimensions(),o=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],o);const a=this._controlContainer=ae.create("div","maplibregl-control-container",h),c=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(m=>{c[m]=ae.create("div",`maplibregl-ctrl-${m} `,a)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_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",o=>{t={requestedAttributes:h},o&&(t.statusMessage=o.statusMessage,t.type=o.type)},{once:!0});const n=this._canvas.getContext("webgl2",h)||this._canvas.getContext("webgl",h);if(!n){const o="Failed to initialize WebGL";throw t?(t.message=o,new Error(JSON.stringify(t))):new Error(o)}this.painter=new zl(n,this.transform),dt.testSupport(n)}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 a=this.transform.zoom,c=he.now();this.style.zoomHistory.update(a,c);const m=new u.a9(a,{now:c,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),_=m.crossFadingFactor();_===1&&_===this._crossFadingFactor||(n=!0,this._crossFadingFactor=_),this.style.update(m)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,t,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding}),this.fire(new u.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,u.be.mark(u.bf.load),this.fire(new u.k("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const o=this._sourcesDirty||this._styleDirty||this._placementDirty;return o||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new u.k("idle")),!this._loaded||this._fullyLoaded||o||(this._fullyLoaded=!0,u.be.mark(u.bf.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=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._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),We.removeThrottleControl(this._imageQueueHandle),(h=this._resizeObserver)===null||h===void 0||h.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t!=null&&t.loseContext&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),ae.remove(this._canvasContainer),ae.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),u.be.clearMetrics(),this._removed=!0,this.fire(new u.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,he.frameAsync(this._frameRequest).then(h=>{u.be.frame(h),this._frameRequest=null,this._render(h)}).catch(()=>{}))}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 Ca}getCameraTargetElevation(){return this.transform.elevation}},S.MapMouseEvent=Ti,S.MapTouchEvent=Ss,S.MapWheelEvent=ha,S.Marker=kt,S.NavigationControl=class{constructor(h){this._updateZoomButtons=()=>{const t=this._map.getZoom(),n=t===this._map.getMaxZoom(),o=t===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=o,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",o.toString())},this._rotateCompassArrow=()=>{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 o=this._map._getUIString(`NavigationControl.${n}`);t.title=o,t.setAttribute("aria-label",o)},this.options=u.e({},ka,h),this._container=ae.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})),ae.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})),ae.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=ae.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 Ul(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){ae.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=ae.create("button",h,this._container);return n.type="button",n.addEventListener("click",t),n}},S.Popup=class extends u.E{constructor(h){super(),this.remove=()=>(this._content&&ae.remove(this._content),this._container&&(ae.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new u.k("close"))),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{var n;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=ae.create("div","maplibregl-popup",this._map.getContainer()),this._tip=ae.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const _ of this.options.className.split(" "))this._container.classList.add(_);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?$l(this._lngLat,this._flatPos,this._map.transform):(n=this._lngLat)===null||n===void 0?void 0:n.wrap(),this._trackPointer&&!t)return;const o=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationPoint(this._lngLat));let a=this.options.anchor;const c=qe(this.options.offset);if(!a){const _=this._container.offsetWidth,v=this._container.offsetHeight;let b;b=o.y+c.bottom.y<v?["top"]:o.y>this._map.transform.height-v?["bottom"]:[],o.x<_/2?b.push("left"):o.x>this._map.transform.width-_/2&&b.push("right"),a=b.length===0?"bottom":b.join("-")}let m=o.add(c[a]);this.options.subpixelPositioning||(m=m.round()),ae.setTransform(this._container,`${Ma[a]} translate(${m.x}px,${m.y}px)`),Jr(this._container,a,"popup")},this._onClose=()=>{this.remove()},this.options=u.e(Object.create(wr),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 u.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(h){return this._lngLat=u.N.convert(h),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(h){return this.setDOMContent(document.createTextNode(h))}setHTML(h){const t=document.createDocumentFragment(),n=document.createElement("body");let o;for(n.innerHTML=h;o=n.firstChild,o;)t.appendChild(o);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=ae.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(h),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(h){return this._container&&this._container.classList.add(h),this}removeClassName(h){return this._container&&this._container.classList.remove(h),this}setOffset(h){return this.options.offset=h,this._update(),this}toggleClassName(h){if(this._container)return this._container.classList.toggle(h)}setSubpixelPositioning(h){this.options.subpixelPositioning=h}_createCloseButton(){this.options.closeButton&&(this._closeButton=ae.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const h=this._container.querySelector(_o);h&&h.focus()}},S.RasterDEMTileSource=$t,S.RasterTileSource=_t,S.ScaleControl=class{constructor(h){this._onMove=()=>{za(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,za(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},ql),h)}getDefaultPosition(){return"bottom-left"}onAdd(h){return this._map=h,this._container=ae.create("div","maplibregl-ctrl maplibregl-ctrl-scale",h.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){ae.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},S.ScrollZoomHandler=Sa,S.Style=Uo,S.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.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=h}onAdd(h){return this._map=h,this._container=ae.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=ae.create("button","maplibregl-ctrl-terrain",this._container),ae.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(){ae.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},S.TwoFingersTouchPitchHandler=va,S.TwoFingersTouchRotateHandler=xa,S.TwoFingersTouchZoomHandler=_a,S.TwoFingersTouchZoomRotateHandler=Ia,S.VectorTileSource=ns,S.VideoSource=Mn,S.addSourceType=(h,t)=>u._(void 0,void 0,void 0,function*(){if(as(h))throw new Error(`A source type called "${h}" already exists.`);((n,o)=>{os[n]=o})(h,t)}),S.clearPrewarmedResources=function(){const h=Fi;h&&(h.isPreloaded()&&h.numActive()===1?(h.release(Vr),Fi=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()"))},S.getMaxParallelImageRequests=function(){return u.a.MAX_PARALLEL_IMAGE_REQUESTS},S.getRTLTextPluginStatus=function(){return gr().getRTLTextPluginStatus()},S.getVersion=function(){return Je},S.getWorkerCount=function(){return fr.workerCount},S.getWorkerUrl=function(){return u.a.WORKER_URL},S.importScriptInWorkers=function(h){return rs().broadcast("IS",h)},S.prewarm=function(){on().acquire(Vr)},S.setMaxParallelImageRequests=function(h){u.a.MAX_PARALLEL_IMAGE_REQUESTS=h},S.setRTLTextPlugin=function(h,t){return gr().setRTLTextPlugin(h,t)},S.setWorkerCount=function(h){fr.workerCount=h},S.setWorkerUrl=function(h){u.a.WORKER_URL=h}});var Q=D;return Q})})(jh);var mp=jh.exports;const mc=fp(mp);function gp(y){return[{type:"fill",paint:{"fill-color":y.color||"#ccc","fill-outline-color":y.color||"blue","fill-opacity":y.opacity||1}}]}function _p(y){return[{type:"line",paint:{"line-color":y.color||"#ccc","line-opacity":y.opacity||1}}]}function yp(y){return[{type:"circle",paint:{"circle-radius":y.radius||6,"circle-stroke-color":y.stroke||"#ccc","circle-stroke-width":y.width||1,"circle-color":y.color||"blue"}}]}function Uh(y){if(!y)return null;const T=y.type||"point";return T==="polygon"?gp(y):T==="line"?_p(y):yp(y)}const gc={data(){return{layerList:[],activeLayer:""}},computed:{interactiveSources(){return this.layerList.filter(y=>y==null?void 0:y.interactive).map(y=>y.id)}},methods:{moveLayer(y,T=this.map){T.getStyle().layers.forEach(D=>{D.id.match(y)&&T.moveLayer(D.id)})},async setVisible(y,T=!0,D=this.map){if(!y)return;const R=(y==null?void 0:y.id)||y,Z=this.layerList.find(S=>S.id===y)||y;if(!(Z!=null&&Z.id))throw new Error("MixinError: Layer has no id");const Q=D.getStyle().layers.filter(S=>S.id.match(R));Q.forEach(S=>{D.setLayoutProperty(S.id,"visibility",T?"visible":"none")}),!Q.length&&T&&await this.addLayer(Z)},async addLayer(y,T={},D=this==null?void 0:this.map){var Q,S;const R=this.layerList.find(u=>u.id===y)||y;this.map.getStyle().layers.find(u=>u.id===R.id)||(this.layerList.find(u=>u.id===R.id)||this.layerList.push(R),(R.service==="vtile"||R.service==="vector"||(Q=R.url)!=null&&Q.includes(".vmt"))&&this.addVtileLayer(R,D),R.service==="geojson"&&this.addGeoJsonLayer(R,D),((S=R.url)!=null&&S.includes(".png")||["tms","raster"].includes(R.service))&&await this.addRasterLayer(R,T,D))},async addRasterLayer(y,T,D=this==null?void 0:this.map){await D.addSource(y.id,{type:"raster",tiles:[y==null?void 0:y.url],tileSize:256,...y!=null&&y.scheme?{scheme:y==null?void 0:y.scheme}:{}});const R=T.order===0?this.getOrder(T.order):null;await D.addLayer({id:y.id,type:"raster",source:y.id,minzoom:0,maxzoom:(y==null?void 0:y.maxzoom)||22},R)},async addVtileLayer(y,T=this==null?void 0:this.map){var Q;const D=["props","pointZoom"].filter(S=>y[S]).map(S=>`&${S}=${y[S]}`),R={type:"vector",tiles:[`${(Q=y==null?void 0:y.url)!=null&&Q.startsWith("http")?"":window.location.origin}${y==null?void 0:y.url}${D}`],minzoom:y.minzoom||5,maxzoom:y.maxzoom||24};T.addSource(y.id,R),(Uh(y.style)||y.layers||[]).forEach((S,u)=>{const Ie={...S,id:`${y.id}-${u}`,source:y.id,"source-layer":S["source-layer"]||y.source||y.id,maxzoom:+S.maxzoom||24,minzoom:+S.minzoom||0};T.addLayer(Ie)})},async addGeoJsonLayer(y,T=this.map){var Z;const D=y.data||((Z=y==null?void 0:y.url)!=null&&Z.startsWith("http")?"":window.location.origin)+y.url;T.addSource(y.id,{type:"geojson",data:D}),(Uh(y.style)||y.layers||[]).forEach(Q=>{const S={...Q,source:y.id,id:Q.id||y.id,maxzoom:+Q.maxzoom||24,minzoom:+Q.minzoom||0,type:Q.type||"circle"};T.addLayer(S)})},setLayerData(y,T){this.layerList=this.layerList.map(D=>D.id===y?{...D,...T}:D)},async removeLayer(y,T=this.map){await T.getStyle().layers.forEach(async D=>{D.source===y&&await T.removeLayer(D.id)}),T.getSource(y)&&await T.removeSource(y)},async setFilter(y,T){const D=this.layerList.find(Z=>Z.id===y);await(await this.map.getSource(y)).setTiles([`${window.location.origin}${D.url}${D.url.includes("?")?"&":"?"}filter=${T}${D.props?`&props=${D.props}`:""}`])},getOrder(y){var T;return((T=this.map.getStyle().layers[y])==null?void 0:T.id)||null},async changeBaseLayer(y){y!==this.activeLayer&&(this.activeLayer&&this.map.setLayoutProperty(this.activeLayer,"visibility","none"),await this.addLayer(y,{order:0}),this.map.setLayoutProperty(y,"visibility","visible"),this.activeLayer=y)},async refreshLayer(y,T=this.map){await T.getStyle().layers.forEach(D=>{D.source===y&&T.removeLayer(D.id)}),await T.removeSource(y),this.setVisible(y)}}},nn=(y,T)=>{const D=y.__vccOpts||y;for(const[R,Z]of T)D[R]=Z;return D},xp={},vp={class:"w-48 mx-auto mb-4",width:"178",height:"90",viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"},bp=[oe.createStaticVNode('<rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-stone-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-stone-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-stone-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-stone-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-stone-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-stone-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-stone-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-stone-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter2)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-stone-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-stone-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-stone-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-stone-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter2" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs>',12)];function wp(y,T){return oe.openBlock(),oe.createElementBlock("svg",vp,bp)}const Sp=nn(xp,[["render",wp]]);function $h(y,T){return function(){return y.apply(T,arguments)}}const{toString:Tp}=Object.prototype,{getPrototypeOf:_c}=Object,tl=(y=>T=>{const D=Tp.call(T);return y[D]||(y[D]=D.slice(8,-1).toLowerCase())})(Object.create(null)),Ir=y=>(y=y.toLowerCase(),T=>tl(T)===y),il=y=>T=>typeof T===y,{isArray:Os}=Array,Bo=il("undefined");function Ip(y){return y!==null&&!Bo(y)&&y.constructor!==null&&!Bo(y.constructor)&&Ki(y.constructor.isBuffer)&&y.constructor.isBuffer(y)}const qh=Ir("ArrayBuffer");function Pp(y){let T;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?T=ArrayBuffer.isView(y):T=y&&y.buffer&&qh(y.buffer),T}const Ep=il("string"),Ki=il("function"),Zh=il("number"),rl=y=>y!==null&&typeof y=="object",Ap=y=>y===!0||y===!1,nl=y=>{if(tl(y)!=="object")return!1;const T=_c(y);return(T===null||T===Object.prototype||Object.getPrototypeOf(T)===null)&&!(Symbol.toStringTag in y)&&!(Symbol.iterator in y)},Cp=Ir("Date"),kp=Ir("File"),Mp=Ir("Blob"),zp=Ir("FileList"),Dp=y=>rl(y)&&Ki(y.pipe),Lp=y=>{let T;return y&&(typeof FormData=="function"&&y instanceof FormData||Ki(y.append)&&((T=tl(y))==="formdata"||T==="object"&&Ki(y.toString)&&y.toString()==="[object FormData]"))},Rp=Ir("URLSearchParams"),[Bp,Fp,Op,Vp]=["ReadableStream","Request","Response","Headers"].map(Ir),Np=y=>y.trim?y.trim():y.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Fo(y,T,{allOwnKeys:D=!1}={}){if(y===null||typeof y>"u")return;let R,Z;if(typeof y!="object"&&(y=[y]),Os(y))for(R=0,Z=y.length;R<Z;R++)T.call(null,y[R],R,y);else{const Q=D?Object.getOwnPropertyNames(y):Object.keys(y),S=Q.length;let u;for(R=0;R<S;R++)u=Q[R],T.call(null,y[u],u,y)}}function Gh(y,T){T=T.toLowerCase();const D=Object.keys(y);let R=D.length,Z;for(;R-- >0;)if(Z=D[R],T===Z.toLowerCase())return Z;return null}const es=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Hh=y=>!Bo(y)&&y!==es;function yc(){const{caseless:y}=Hh(this)&&this||{},T={},D=(R,Z)=>{const Q=y&&Gh(T,Z)||Z;nl(T[Q])&&nl(R)?T[Q]=yc(T[Q],R):nl(R)?T[Q]=yc({},R):Os(R)?T[Q]=R.slice():T[Q]=R};for(let R=0,Z=arguments.length;R<Z;R++)arguments[R]&&Fo(arguments[R],D);return T}const jp=(y,T,D,{allOwnKeys:R}={})=>(Fo(T,(Z,Q)=>{D&&Ki(Z)?y[Q]=$h(Z,D):y[Q]=Z},{allOwnKeys:R}),y),Up=y=>(y.charCodeAt(0)===65279&&(y=y.slice(1)),y),$p=(y,T,D,R)=>{y.prototype=Object.create(T.prototype,R),y.prototype.constructor=y,Object.defineProperty(y,"super",{value:T.prototype}),D&&Object.assign(y.prototype,D)},qp=(y,T,D,R)=>{let Z,Q,S;const u={};if(T=T||{},y==null)return T;do{for(Z=Object.getOwnPropertyNames(y),Q=Z.length;Q-- >0;)S=Z[Q],(!R||R(S,y,T))&&!u[S]&&(T[S]=y[S],u[S]=!0);y=D!==!1&&_c(y)}while(y&&(!D||D(y,T))&&y!==Object.prototype);return T},Zp=(y,T,D)=>{y=String(y),(D===void 0||D>y.length)&&(D=y.length),D-=T.length;const R=y.indexOf(T,D);return R!==-1&&R===D},Gp=y=>{if(!y)return null;if(Os(y))return y;let T=y.length;if(!Zh(T))return null;const D=new Array(T);for(;T-- >0;)D[T]=y[T];return D},Hp=(y=>T=>y&&T instanceof y)(typeof Uint8Array<"u"&&_c(Uint8Array)),Xp=(y,T)=>{const R=(y&&y[Symbol.iterator]).call(y);let Z;for(;(Z=R.next())&&!Z.done;){const Q=Z.value;T.call(y,Q[0],Q[1])}},Wp=(y,T)=>{let D;const R=[];for(;(D=y.exec(T))!==null;)R.push(D);return R},Jp=Ir("HTMLFormElement"),Kp=y=>y.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(D,R,Z){return R.toUpperCase()+Z}),Xh=(({hasOwnProperty:y})=>(T,D)=>y.call(T,D))(Object.prototype),Yp=Ir("RegExp"),Wh=(y,T)=>{const D=Object.getOwnPropertyDescriptors(y),R={};Fo(D,(Z,Q)=>{let S;(S=T(Z,Q,y))!==!1&&(R[Q]=S||Z)}),Object.defineProperties(y,R)},Qp=y=>{Wh(y,(T,D)=>{if(Ki(y)&&["arguments","caller","callee"].indexOf(D)!==-1)return!1;const R=y[D];if(Ki(R)){if(T.enumerable=!1,"writable"in T){T.writable=!1;return}T.set||(T.set=()=>{throw Error("Can not rewrite read-only method '"+D+"'")})}})},ef=(y,T)=>{const D={},R=Z=>{Z.forEach(Q=>{D[Q]=!0})};return Os(y)?R(y):R(String(y).split(T)),D},tf=()=>{},rf=(y,T)=>y!=null&&Number.isFinite(y=+y)?y:T,xc="abcdefghijklmnopqrstuvwxyz",Jh="0123456789",Kh={DIGIT:Jh,ALPHA:xc,ALPHA_DIGIT:xc+xc.toUpperCase()+Jh},nf=(y=16,T=Kh.ALPHA_DIGIT)=>{let D="";const{length:R}=T;for(;y--;)D+=T[Math.random()*R|0];return D};function sf(y){return!!(y&&Ki(y.append)&&y[Symbol.toStringTag]==="FormData"&&y[Symbol.iterator])}const of=y=>{const T=new Array(10),D=(R,Z)=>{if(rl(R)){if(T.indexOf(R)>=0)return;if(!("toJSON"in R)){T[Z]=R;const Q=Os(R)?[]:{};return Fo(R,(S,u)=>{const Ie=D(S,Z+1);!Bo(Ie)&&(Q[u]=Ie)}),T[Z]=void 0,Q}}return R};return D(y,0)},af=Ir("AsyncFunction"),lf=y=>y&&(rl(y)||Ki(y))&&Ki(y.then)&&Ki(y.catch),Yh=((y,T)=>y?setImmediate:T?((D,R)=>(es.addEventListener("message",({source:Z,data:Q})=>{Z===es&&Q===D&&R.length&&R.shift()()},!1),Z=>{R.push(Z),es.postMessage(D,"*")}))(`axios@${Math.random()}`,[]):D=>setTimeout(D))(typeof setImmediate=="function",Ki(es.postMessage)),cf=typeof queueMicrotask<"u"?queueMicrotask.bind(es):typeof process<"u"&&process.nextTick||Yh,fe={isArray:Os,isArrayBuffer:qh,isBuffer:Ip,isFormData:Lp,isArrayBufferView:Pp,isString:Ep,isNumber:Zh,isBoolean:Ap,isObject:rl,isPlainObject:nl,isReadableStream:Bp,isRequest:Fp,isResponse:Op,isHeaders:Vp,isUndefined:Bo,isDate:Cp,isFile:kp,isBlob:Mp,isRegExp:Yp,isFunction:Ki,isStream:Dp,isURLSearchParams:Rp,isTypedArray:Hp,isFileList:zp,forEach:Fo,merge:yc,extend:jp,trim:Np,stripBOM:Up,inherits:$p,toFlatObject:qp,kindOf:tl,kindOfTest:Ir,endsWith:Zp,toArray:Gp,forEachEntry:Xp,matchAll:Wp,isHTMLForm:Jp,hasOwnProperty:Xh,hasOwnProp:Xh,reduceDescriptors:Wh,freezeMethods:Qp,toObjectSet:ef,toCamelCase:Kp,noop:tf,toFiniteNumber:rf,findKey:Gh,global:es,isContextDefined:Hh,ALPHABET:Kh,generateString:nf,isSpecCompliantForm:sf,toJSONObject:of,isAsyncFn:af,isThenable:lf,setImmediate:Yh,asap:cf};function ct(y,T,D,R,Z){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=y,this.name="AxiosError",T&&(this.code=T),D&&(this.config=D),R&&(this.request=R),Z&&(this.response=Z)}fe.inherits(ct,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:fe.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Qh=ct.prototype,eu={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(y=>{eu[y]={value:y}}),Object.defineProperties(ct,eu),Object.defineProperty(Qh,"isAxiosError",{value:!0}),ct.from=(y,T,D,R,Z,Q)=>{const S=Object.create(Qh);return fe.toFlatObject(y,S,function(Ie){return Ie!==Error.prototype},u=>u!=="isAxiosError"),ct.call(S,y.message,T,D,R,Z),S.cause=y,S.name=y.name,Q&&Object.assign(S,Q),S};const hf=null;function vc(y){return fe.isPlainObject(y)||fe.isArray(y)}function tu(y){return fe.endsWith(y,"[]")?y.slice(0,-2):y}function iu(y,T,D){return y?y.concat(T).map(function(Z,Q){return Z=tu(Z),!D&&Q?"["+Z+"]":Z}).join(D?".":""):T}function uf(y){return fe.isArray(y)&&!y.some(vc)}const df=fe.toFlatObject(fe,{},null,function(T){return/^is[A-Z]/.test(T)});function sl(y,T,D){if(!fe.isObject(y))throw new TypeError("target must be an object");T=T||new FormData,D=fe.toFlatObject(D,{metaTokens:!0,dots:!1,indexes:!1},!1,function(Ke,Oe){return!fe.isUndefined(Oe[Ke])});const R=D.metaTokens,Z=D.visitor||we,Q=D.dots,S=D.indexes,Ie=(D.Blob||typeof Blob<"u"&&Blob)&&fe.isSpecCompliantForm(T);if(!fe.isFunction(Z))throw new TypeError("visitor must be a function");function xe(je){if(je===null)return"";if(fe.isDate(je))return je.toISOString();if(!Ie&&fe.isBlob(je))throw new ct("Blob is not supported. Use a Buffer instead.");return fe.isArrayBuffer(je)||fe.isTypedArray(je)?Ie&&typeof Blob=="function"?new Blob([je]):Buffer.from(je):je}function we(je,Ke,Oe){let xt=je;if(je&&!Oe&&typeof je=="object"){if(fe.endsWith(Ke,"{}"))Ke=R?Ke:Ke.slice(0,-2),je=JSON.stringify(je);else if(fe.isArray(je)&&uf(je)||(fe.isFileList(je)||fe.endsWith(Ke,"[]"))&&(xt=fe.toArray(je)))return Ke=tu(Ke),xt.forEach(function(We,Ut){!(fe.isUndefined(We)||We===null)&&T.append(S===!0?iu([Ke],Ut,Q):S===null?Ke:Ke+"[]",xe(We))}),!1}return vc(je)?!0:(T.append(iu(Oe,Ke,Q),xe(je)),!1)}const he=[],ae=Object.assign(df,{defaultVisitor:we,convertValue:xe,isVisitable:vc});function dt(je,Ke){if(!fe.isUndefined(je)){if(he.indexOf(je)!==-1)throw Error("Circular reference detected in "+Ke.join("."));he.push(je),fe.forEach(je,function(xt,tt){(!(fe.isUndefined(xt)||xt===null)&&Z.call(T,xt,fe.isString(tt)?tt.trim():tt,Ke,ae))===!0&&dt(xt,Ke?Ke.concat(tt):[tt])}),he.pop()}}if(!fe.isObject(y))throw new TypeError("data must be an object");return dt(y),T}function ru(y){const T={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(y).replace(/[!'()~]|%20|%00/g,function(R){return T[R]})}function bc(y,T){this._pairs=[],y&&sl(y,this,T)}const nu=bc.prototype;nu.append=function(T,D){this._pairs.push([T,D])},nu.toString=function(T){const D=T?function(R){return T.call(this,R,ru)}:ru;return this._pairs.map(function(Z){return D(Z[0])+"="+D(Z[1])},"").join("&")};function pf(y){return encodeURIComponent(y).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function su(y,T,D){if(!T)return y;const R=D&&D.encode||pf,Z=D&&D.serialize;let Q;if(Z?Q=Z(T,D):Q=fe.isURLSearchParams(T)?T.toString():new bc(T,D).toString(R),Q){const S=y.indexOf("#");S!==-1&&(y=y.slice(0,S)),y+=(y.indexOf("?")===-1?"?":"&")+Q}return y}class ou{constructor(){this.handlers=[]}use(T,D,R){return this.handlers.push({fulfilled:T,rejected:D,synchronous:R?R.synchronous:!1,runWhen:R?R.runWhen:null}),this.handlers.length-1}eject(T){this.handlers[T]&&(this.handlers[T]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(T){fe.forEach(this.handlers,function(R){R!==null&&T(R)})}}const au={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ff={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:bc,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},wc=typeof window<"u"&&typeof document<"u",mf=(y=>wc&&["ReactNative","NativeScript","NS"].indexOf(y)<0)(typeof navigator<"u"&&navigator.product),gf=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",_f=wc&&window.location.href||"http://localhost",Pr={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:wc,hasStandardBrowserEnv:mf,hasStandardBrowserWebWorkerEnv:gf,origin:_f},Symbol.toStringTag,{value:"Module"})),...ff};function yf(y,T){return sl(y,new Pr.classes.URLSearchParams,Object.assign({visitor:function(D,R,Z,Q){return Pr.isNode&&fe.isBuffer(D)?(this.append(R,D.toString("base64")),!1):Q.defaultVisitor.apply(this,arguments)}},T))}function xf(y){return fe.matchAll(/\w+|\[(\w*)]/g,y).map(T=>T[0]==="[]"?"":T[1]||T[0])}function vf(y){const T={},D=Object.keys(y);let R;const Z=D.length;let Q;for(R=0;R<Z;R++)Q=D[R],T[Q]=y[Q];return T}function lu(y){function T(D,R,Z,Q){let S=D[Q++];if(S==="__proto__")return!0;const u=Number.isFinite(+S),Ie=Q>=D.length;return S=!S&&fe.isArray(Z)?Z.length:S,Ie?(fe.hasOwnProp(Z,S)?Z[S]=[Z[S],R]:Z[S]=R,!u):((!Z[S]||!fe.isObject(Z[S]))&&(Z[S]=[]),T(D,R,Z[S],Q)&&fe.isArray(Z[S])&&(Z[S]=vf(Z[S])),!u)}if(fe.isFormData(y)&&fe.isFunction(y.entries)){const D={};return fe.forEachEntry(y,(R,Z)=>{T(xf(R),Z,D,0)}),D}return null}function bf(y,T,D){if(fe.isString(y))try{return(T||JSON.parse)(y),fe.trim(y)}catch(R){if(R.name!=="SyntaxError")throw R}return(D||JSON.stringify)(y)}const Oo={transitional:au,adapter:["xhr","http","fetch"],transformRequest:[function(T,D){const R=D.getContentType()||"",Z=R.indexOf("application/json")>-1,Q=fe.isObject(T);if(Q&&fe.isHTMLForm(T)&&(T=new FormData(T)),fe.isFormData(T))return Z?JSON.stringify(lu(T)):T;if(fe.isArrayBuffer(T)||fe.isBuffer(T)||fe.isStream(T)||fe.isFile(T)||fe.isBlob(T)||fe.isReadableStream(T))return T;if(fe.isArrayBufferView(T))return T.buffer;if(fe.isURLSearchParams(T))return D.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),T.toString();let u;if(Q){if(R.indexOf("application/x-www-form-urlencoded")>-1)return yf(T,this.formSerializer).toString();if((u=fe.isFileList(T))||R.indexOf("multipart/form-data")>-1){const Ie=this.env&&this.env.FormData;return sl(u?{"files[]":T}:T,Ie&&new Ie,this.formSerializer)}}return Q||Z?(D.setContentType("application/json",!1),bf(T)):T}],transformResponse:[function(T){const D=this.transitional||Oo.transitional,R=D&&D.forcedJSONParsing,Z=this.responseType==="json";if(fe.isResponse(T)||fe.isReadableStream(T))return T;if(T&&fe.isString(T)&&(R&&!this.responseType||Z)){const S=!(D&&D.silentJSONParsing)&&Z;try{return JSON.parse(T)}catch(u){if(S)throw u.name==="SyntaxError"?ct.from(u,ct.ERR_BAD_RESPONSE,this,null,this.response):u}}return T}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Pr.classes.FormData,Blob:Pr.classes.Blob},validateStatus:function(T){return T>=200&&T<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};fe.forEach(["delete","get","head","post","put","patch"],y=>{Oo.headers[y]={}});const wf=fe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Sf=y=>{const T={};let D,R,Z;return y&&y.split(`
|
581
|
+
`).forEach(function(S){Z=S.indexOf(":"),D=S.substring(0,Z).trim().toLowerCase(),R=S.substring(Z+1).trim(),!(!D||T[D]&&wf[D])&&(D==="set-cookie"?T[D]?T[D].push(R):T[D]=[R]:T[D]=T[D]?T[D]+", "+R:R)}),T},cu=Symbol("internals");function Vo(y){return y&&String(y).trim().toLowerCase()}function ol(y){return y===!1||y==null?y:fe.isArray(y)?y.map(ol):String(y)}function Tf(y){const T=Object.create(null),D=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let R;for(;R=D.exec(y);)T[R[1]]=R[2];return T}const If=y=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(y.trim());function Sc(y,T,D,R,Z){if(fe.isFunction(R))return R.call(this,T,D);if(Z&&(T=D),!!fe.isString(T)){if(fe.isString(R))return T.indexOf(R)!==-1;if(fe.isRegExp(R))return R.test(T)}}function Pf(y){return y.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(T,D,R)=>D.toUpperCase()+R)}function Ef(y,T){const D=fe.toCamelCase(" "+T);["get","set","has"].forEach(R=>{Object.defineProperty(y,R+D,{value:function(Z,Q,S){return this[R].call(this,T,Z,Q,S)},configurable:!0})})}class Gi{constructor(T){T&&this.set(T)}set(T,D,R){const Z=this;function Q(u,Ie,xe){const we=Vo(Ie);if(!we)throw new Error("header name must be a non-empty string");const he=fe.findKey(Z,we);(!he||Z[he]===void 0||xe===!0||xe===void 0&&Z[he]!==!1)&&(Z[he||Ie]=ol(u))}const S=(u,Ie)=>fe.forEach(u,(xe,we)=>Q(xe,we,Ie));if(fe.isPlainObject(T)||T instanceof this.constructor)S(T,D);else if(fe.isString(T)&&(T=T.trim())&&!If(T))S(Sf(T),D);else if(fe.isHeaders(T))for(const[u,Ie]of T.entries())Q(Ie,u,R);else T!=null&&Q(D,T,R);return this}get(T,D){if(T=Vo(T),T){const R=fe.findKey(this,T);if(R){const Z=this[R];if(!D)return Z;if(D===!0)return Tf(Z);if(fe.isFunction(D))return D.call(this,Z,R);if(fe.isRegExp(D))return D.exec(Z);throw new TypeError("parser must be boolean|regexp|function")}}}has(T,D){if(T=Vo(T),T){const R=fe.findKey(this,T);return!!(R&&this[R]!==void 0&&(!D||Sc(this,this[R],R,D)))}return!1}delete(T,D){const R=this;let Z=!1;function Q(S){if(S=Vo(S),S){const u=fe.findKey(R,S);u&&(!D||Sc(R,R[u],u,D))&&(delete R[u],Z=!0)}}return fe.isArray(T)?T.forEach(Q):Q(T),Z}clear(T){const D=Object.keys(this);let R=D.length,Z=!1;for(;R--;){const Q=D[R];(!T||Sc(this,this[Q],Q,T,!0))&&(delete this[Q],Z=!0)}return Z}normalize(T){const D=this,R={};return fe.forEach(this,(Z,Q)=>{const S=fe.findKey(R,Q);if(S){D[S]=ol(Z),delete D[Q];return}const u=T?Pf(Q):String(Q).trim();u!==Q&&delete D[Q],D[u]=ol(Z),R[u]=!0}),this}concat(...T){return this.constructor.concat(this,...T)}toJSON(T){const D=Object.create(null);return fe.forEach(this,(R,Z)=>{R!=null&&R!==!1&&(D[Z]=T&&fe.isArray(R)?R.join(", "):R)}),D}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([T,D])=>T+": "+D).join(`
|
582
|
+
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(T){return T instanceof this?T:new this(T)}static concat(T,...D){const R=new this(T);return D.forEach(Z=>R.set(Z)),R}static accessor(T){const R=(this[cu]=this[cu]={accessors:{}}).accessors,Z=this.prototype;function Q(S){const u=Vo(S);R[u]||(Ef(Z,S),R[u]=!0)}return fe.isArray(T)?T.forEach(Q):Q(T),this}}Gi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),fe.reduceDescriptors(Gi.prototype,({value:y},T)=>{let D=T[0].toUpperCase()+T.slice(1);return{get:()=>y,set(R){this[D]=R}}}),fe.freezeMethods(Gi);function Tc(y,T){const D=this||Oo,R=T||D,Z=Gi.from(R.headers);let Q=R.data;return fe.forEach(y,function(u){Q=u.call(D,Q,Z.normalize(),T?T.status:void 0)}),Z.normalize(),Q}function hu(y){return!!(y&&y.__CANCEL__)}function Vs(y,T,D){ct.call(this,y??"canceled",ct.ERR_CANCELED,T,D),this.name="CanceledError"}fe.inherits(Vs,ct,{__CANCEL__:!0});function uu(y,T,D){const R=D.config.validateStatus;!D.status||!R||R(D.status)?y(D):T(new ct("Request failed with status code "+D.status,[ct.ERR_BAD_REQUEST,ct.ERR_BAD_RESPONSE][Math.floor(D.status/100)-4],D.config,D.request,D))}function Af(y){const T=/^([-+\w]{1,25})(:?\/\/|:)/.exec(y);return T&&T[1]||""}function Cf(y,T){y=y||10;const D=new Array(y),R=new Array(y);let Z=0,Q=0,S;return T=T!==void 0?T:1e3,function(Ie){const xe=Date.now(),we=R[Q];S||(S=xe),D[Z]=Ie,R[Z]=xe;let he=Q,ae=0;for(;he!==Z;)ae+=D[he++],he=he%y;if(Z=(Z+1)%y,Z===Q&&(Q=(Q+1)%y),xe-S<T)return;const dt=we&&xe-we;return dt?Math.round(ae*1e3/dt):void 0}}function kf(y,T){let D=0,R=1e3/T,Z,Q;const S=(xe,we=Date.now())=>{D=we,Z=null,Q&&(clearTimeout(Q),Q=null),y.apply(null,xe)};return[(...xe)=>{const we=Date.now(),he=we-D;he>=R?S(xe,we):(Z=xe,Q||(Q=setTimeout(()=>{Q=null,S(Z)},R-he)))},()=>Z&&S(Z)]}const al=(y,T,D=3)=>{let R=0;const Z=Cf(50,250);return kf(Q=>{const S=Q.loaded,u=Q.lengthComputable?Q.total:void 0,Ie=S-R,xe=Z(Ie),we=S<=u;R=S;const he={loaded:S,total:u,progress:u?S/u:void 0,bytes:Ie,rate:xe||void 0,estimated:xe&&u&&we?(u-S)/xe:void 0,event:Q,lengthComputable:u!=null,[T?"download":"upload"]:!0};y(he)},D)},du=(y,T)=>{const D=y!=null;return[R=>T[0]({lengthComputable:D,total:y,loaded:R}),T[1]]},pu=y=>(...T)=>fe.asap(()=>y(...T)),Mf=Pr.hasStandardBrowserEnv?function(){const T=/(msie|trident)/i.test(navigator.userAgent),D=document.createElement("a");let R;function Z(Q){let S=Q;return T&&(D.setAttribute("href",S),S=D.href),D.setAttribute("href",S),{href:D.href,protocol:D.protocol?D.protocol.replace(/:$/,""):"",host:D.host,search:D.search?D.search.replace(/^\?/,""):"",hash:D.hash?D.hash.replace(/^#/,""):"",hostname:D.hostname,port:D.port,pathname:D.pathname.charAt(0)==="/"?D.pathname:"/"+D.pathname}}return R=Z(window.location.href),function(S){const u=fe.isString(S)?Z(S):S;return u.protocol===R.protocol&&u.host===R.host}}():function(){return function(){return!0}}(),zf=Pr.hasStandardBrowserEnv?{write(y,T,D,R,Z,Q){const S=[y+"="+encodeURIComponent(T)];fe.isNumber(D)&&S.push("expires="+new Date(D).toGMTString()),fe.isString(R)&&S.push("path="+R),fe.isString(Z)&&S.push("domain="+Z),Q===!0&&S.push("secure"),document.cookie=S.join("; ")},read(y){const T=document.cookie.match(new RegExp("(^|;\\s*)("+y+")=([^;]*)"));return T?decodeURIComponent(T[3]):null},remove(y){this.write(y,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Df(y){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(y)}function Lf(y,T){return T?y.replace(/\/?\/$/,"")+"/"+T.replace(/^\/+/,""):y}function fu(y,T){return y&&!Df(T)?Lf(y,T):T}const mu=y=>y instanceof Gi?{...y}:y;function ts(y,T){T=T||{};const D={};function R(xe,we,he){return fe.isPlainObject(xe)&&fe.isPlainObject(we)?fe.merge.call({caseless:he},xe,we):fe.isPlainObject(we)?fe.merge({},we):fe.isArray(we)?we.slice():we}function Z(xe,we,he){if(fe.isUndefined(we)){if(!fe.isUndefined(xe))return R(void 0,xe,he)}else return R(xe,we,he)}function Q(xe,we){if(!fe.isUndefined(we))return R(void 0,we)}function S(xe,we){if(fe.isUndefined(we)){if(!fe.isUndefined(xe))return R(void 0,xe)}else return R(void 0,we)}function u(xe,we,he){if(he in T)return R(xe,we);if(he in y)return R(void 0,xe)}const Ie={url:Q,method:Q,data:Q,baseURL:S,transformRequest:S,transformResponse:S,paramsSerializer:S,timeout:S,timeoutMessage:S,withCredentials:S,withXSRFToken:S,adapter:S,responseType:S,xsrfCookieName:S,xsrfHeaderName:S,onUploadProgress:S,onDownloadProgress:S,decompress:S,maxContentLength:S,maxBodyLength:S,beforeRedirect:S,transport:S,httpAgent:S,httpsAgent:S,cancelToken:S,socketPath:S,responseEncoding:S,validateStatus:u,headers:(xe,we)=>Z(mu(xe),mu(we),!0)};return fe.forEach(Object.keys(Object.assign({},y,T)),function(we){const he=Ie[we]||Z,ae=he(y[we],T[we],we);fe.isUndefined(ae)&&he!==u||(D[we]=ae)}),D}const gu=y=>{const T=ts({},y);let{data:D,withXSRFToken:R,xsrfHeaderName:Z,xsrfCookieName:Q,headers:S,auth:u}=T;T.headers=S=Gi.from(S),T.url=su(fu(T.baseURL,T.url),y.params,y.paramsSerializer),u&&S.set("Authorization","Basic "+btoa((u.username||"")+":"+(u.password?unescape(encodeURIComponent(u.password)):"")));let Ie;if(fe.isFormData(D)){if(Pr.hasStandardBrowserEnv||Pr.hasStandardBrowserWebWorkerEnv)S.setContentType(void 0);else if((Ie=S.getContentType())!==!1){const[xe,...we]=Ie?Ie.split(";").map(he=>he.trim()).filter(Boolean):[];S.setContentType([xe||"multipart/form-data",...we].join("; "))}}if(Pr.hasStandardBrowserEnv&&(R&&fe.isFunction(R)&&(R=R(T)),R||R!==!1&&Mf(T.url))){const xe=Z&&Q&&zf.read(Q);xe&&S.set(Z,xe)}return T},Rf=typeof XMLHttpRequest<"u"&&function(y){return new Promise(function(D,R){const Z=gu(y);let Q=Z.data;const S=Gi.from(Z.headers).normalize();let{responseType:u,onUploadProgress:Ie,onDownloadProgress:xe}=Z,we,he,ae,dt,je;function Ke(){dt&&dt(),je&&je(),Z.cancelToken&&Z.cancelToken.unsubscribe(we),Z.signal&&Z.signal.removeEventListener("abort",we)}let Oe=new XMLHttpRequest;Oe.open(Z.method.toUpperCase(),Z.url,!0),Oe.timeout=Z.timeout;function xt(){if(!Oe)return;const We=Gi.from("getAllResponseHeaders"in Oe&&Oe.getAllResponseHeaders()),zt={data:!u||u==="text"||u==="json"?Oe.responseText:Oe.response,status:Oe.status,statusText:Oe.statusText,headers:We,config:y,request:Oe};uu(function(St){D(St),Ke()},function(St){R(St),Ke()},zt),Oe=null}"onloadend"in Oe?Oe.onloadend=xt:Oe.onreadystatechange=function(){!Oe||Oe.readyState!==4||Oe.status===0&&!(Oe.responseURL&&Oe.responseURL.indexOf("file:")===0)||setTimeout(xt)},Oe.onabort=function(){Oe&&(R(new ct("Request aborted",ct.ECONNABORTED,y,Oe)),Oe=null)},Oe.onerror=function(){R(new ct("Network Error",ct.ERR_NETWORK,y,Oe)),Oe=null},Oe.ontimeout=function(){let Ut=Z.timeout?"timeout of "+Z.timeout+"ms exceeded":"timeout exceeded";const zt=Z.transitional||au;Z.timeoutErrorMessage&&(Ut=Z.timeoutErrorMessage),R(new ct(Ut,zt.clarifyTimeoutError?ct.ETIMEDOUT:ct.ECONNABORTED,y,Oe)),Oe=null},Q===void 0&&S.setContentType(null),"setRequestHeader"in Oe&&fe.forEach(S.toJSON(),function(Ut,zt){Oe.setRequestHeader(zt,Ut)}),fe.isUndefined(Z.withCredentials)||(Oe.withCredentials=!!Z.withCredentials),u&&u!=="json"&&(Oe.responseType=Z.responseType),xe&&([ae,je]=al(xe,!0),Oe.addEventListener("progress",ae)),Ie&&Oe.upload&&([he,dt]=al(Ie),Oe.upload.addEventListener("progress",he),Oe.upload.addEventListener("loadend",dt)),(Z.cancelToken||Z.signal)&&(we=We=>{Oe&&(R(!We||We.type?new Vs(null,y,Oe):We),Oe.abort(),Oe=null)},Z.cancelToken&&Z.cancelToken.subscribe(we),Z.signal&&(Z.signal.aborted?we():Z.signal.addEventListener("abort",we)));const tt=Af(Z.url);if(tt&&Pr.protocols.indexOf(tt)===-1){R(new ct("Unsupported protocol "+tt+":",ct.ERR_BAD_REQUEST,y));return}Oe.send(Q||null)})},Bf=(y,T)=>{let D=new AbortController,R;const Z=function(Ie){if(!R){R=!0,S();const xe=Ie instanceof Error?Ie:this.reason;D.abort(xe instanceof ct?xe:new Vs(xe instanceof Error?xe.message:xe))}};let Q=T&&setTimeout(()=>{Z(new ct(`timeout ${T} of ms exceeded`,ct.ETIMEDOUT))},T);const S=()=>{y&&(Q&&clearTimeout(Q),Q=null,y.forEach(Ie=>{Ie&&(Ie.removeEventListener?Ie.removeEventListener("abort",Z):Ie.unsubscribe(Z))}),y=null)};y.forEach(Ie=>Ie&&Ie.addEventListener&&Ie.addEventListener("abort",Z));const{signal:u}=D;return u.unsubscribe=S,[u,()=>{Q&&clearTimeout(Q),Q=null}]},Ff=function*(y,T){let D=y.byteLength;if(!T||D<T){yield y;return}let R=0,Z;for(;R<D;)Z=R+T,yield y.slice(R,Z),R=Z},Of=async function*(y,T,D){for await(const R of y)yield*Ff(ArrayBuffer.isView(R)?R:await D(String(R)),T)},_u=(y,T,D,R,Z)=>{const Q=Of(y,T,Z);let S=0,u,Ie=xe=>{u||(u=!0,R&&R(xe))};return new ReadableStream({async pull(xe){try{const{done:we,value:he}=await Q.next();if(we){Ie(),xe.close();return}let ae=he.byteLength;if(D){let dt=S+=ae;D(dt)}xe.enqueue(new Uint8Array(he))}catch(we){throw Ie(we),we}},cancel(xe){return Ie(xe),Q.return()}},{highWaterMark:2})},ll=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",yu=ll&&typeof ReadableStream=="function",Ic=ll&&(typeof TextEncoder=="function"?(y=>T=>y.encode(T))(new TextEncoder):async y=>new Uint8Array(await new Response(y).arrayBuffer())),xu=(y,...T)=>{try{return!!y(...T)}catch{return!1}},Vf=yu&&xu(()=>{let y=!1;const T=new Request(Pr.origin,{body:new ReadableStream,method:"POST",get duplex(){return y=!0,"half"}}).headers.has("Content-Type");return y&&!T}),vu=64*1024,Pc=yu&&xu(()=>fe.isReadableStream(new Response("").body)),cl={stream:Pc&&(y=>y.body)};ll&&(y=>{["text","arrayBuffer","blob","formData","stream"].forEach(T=>{!cl[T]&&(cl[T]=fe.isFunction(y[T])?D=>D[T]():(D,R)=>{throw new ct(`Response type '${T}' is not supported`,ct.ERR_NOT_SUPPORT,R)})})})(new Response);const Nf=async y=>{if(y==null)return 0;if(fe.isBlob(y))return y.size;if(fe.isSpecCompliantForm(y))return(await new Request(y).arrayBuffer()).byteLength;if(fe.isArrayBufferView(y)||fe.isArrayBuffer(y))return y.byteLength;if(fe.isURLSearchParams(y)&&(y=y+""),fe.isString(y))return(await Ic(y)).byteLength},jf=async(y,T)=>{const D=fe.toFiniteNumber(y.getContentLength());return D??Nf(T)},Ec={http:hf,xhr:Rf,fetch:ll&&(async y=>{let{url:T,method:D,data:R,signal:Z,cancelToken:Q,timeout:S,onDownloadProgress:u,onUploadProgress:Ie,responseType:xe,headers:we,withCredentials:he="same-origin",fetchOptions:ae}=gu(y);xe=xe?(xe+"").toLowerCase():"text";let[dt,je]=Z||Q||S?Bf([Z,Q],S):[],Ke,Oe;const xt=()=>{!Ke&&setTimeout(()=>{dt&&dt.unsubscribe()}),Ke=!0};let tt;try{if(Ie&&Vf&&D!=="get"&&D!=="head"&&(tt=await jf(we,R))!==0){let Et=new Request(T,{method:"POST",body:R,duplex:"half"}),St;if(fe.isFormData(R)&&(St=Et.headers.get("content-type"))&&we.setContentType(St),Et.body){const[Yi,ri]=du(tt,al(pu(Ie)));R=_u(Et.body,vu,Yi,ri,Ic)}}fe.isString(he)||(he=he?"include":"omit"),Oe=new Request(T,{...ae,signal:dt,method:D.toUpperCase(),headers:we.normalize().toJSON(),body:R,duplex:"half",credentials:he});let We=await fetch(Oe);const Ut=Pc&&(xe==="stream"||xe==="response");if(Pc&&(u||Ut)){const Et={};["status","statusText","headers"].forEach(Qi=>{Et[Qi]=We[Qi]});const St=fe.toFiniteNumber(We.headers.get("content-length")),[Yi,ri]=u&&du(St,al(pu(u),!0))||[];We=new Response(_u(We.body,vu,Yi,()=>{ri&&ri(),Ut&&xt()},Ic),Et)}xe=xe||"text";let zt=await cl[fe.findKey(cl,xe)||"text"](We,y);return!Ut&&xt(),je&&je(),await new Promise((Et,St)=>{uu(Et,St,{data:zt,headers:Gi.from(We.headers),status:We.status,statusText:We.statusText,config:y,request:Oe})})}catch(We){throw xt(),We&&We.name==="TypeError"&&/fetch/i.test(We.message)?Object.assign(new ct("Network Error",ct.ERR_NETWORK,y,Oe),{cause:We.cause||We}):ct.from(We,We&&We.code,y,Oe)}})};fe.forEach(Ec,(y,T)=>{if(y){try{Object.defineProperty(y,"name",{value:T})}catch{}Object.defineProperty(y,"adapterName",{value:T})}});const bu=y=>`- ${y}`,Uf=y=>fe.isFunction(y)||y===null||y===!1,wu={getAdapter:y=>{y=fe.isArray(y)?y:[y];const{length:T}=y;let D,R;const Z={};for(let Q=0;Q<T;Q++){D=y[Q];let S;if(R=D,!Uf(D)&&(R=Ec[(S=String(D)).toLowerCase()],R===void 0))throw new ct(`Unknown adapter '${S}'`);if(R)break;Z[S||"#"+Q]=R}if(!R){const Q=Object.entries(Z).map(([u,Ie])=>`adapter ${u} `+(Ie===!1?"is not supported by the environment":"is not available in the build"));let S=T?Q.length>1?`since :
|
583
|
+
`+Q.map(bu).join(`
|
584
|
+
`):" "+bu(Q[0]):"as no adapter specified";throw new ct("There is no suitable adapter to dispatch the request "+S,"ERR_NOT_SUPPORT")}return R},adapters:Ec};function Ac(y){if(y.cancelToken&&y.cancelToken.throwIfRequested(),y.signal&&y.signal.aborted)throw new Vs(null,y)}function Su(y){return Ac(y),y.headers=Gi.from(y.headers),y.data=Tc.call(y,y.transformRequest),["post","put","patch"].indexOf(y.method)!==-1&&y.headers.setContentType("application/x-www-form-urlencoded",!1),wu.getAdapter(y.adapter||Oo.adapter)(y).then(function(R){return Ac(y),R.data=Tc.call(y,y.transformResponse,R),R.headers=Gi.from(R.headers),R},function(R){return hu(R)||(Ac(y),R&&R.response&&(R.response.data=Tc.call(y,y.transformResponse,R.response),R.response.headers=Gi.from(R.response.headers))),Promise.reject(R)})}const Tu="1.7.4",Cc={};["object","boolean","number","function","string","symbol"].forEach((y,T)=>{Cc[y]=function(R){return typeof R===y||"a"+(T<1?"n ":" ")+y}});const Iu={};Cc.transitional=function(T,D,R){function Z(Q,S){return"[Axios v"+Tu+"] Transitional option '"+Q+"'"+S+(R?". "+R:"")}return(Q,S,u)=>{if(T===!1)throw new ct(Z(S," has been removed"+(D?" in "+D:"")),ct.ERR_DEPRECATED);return D&&!Iu[S]&&(Iu[S]=!0,console.warn(Z(S," has been deprecated since v"+D+" and will be removed in the near future"))),T?T(Q,S,u):!0}};function $f(y,T,D){if(typeof y!="object")throw new ct("options must be an object",ct.ERR_BAD_OPTION_VALUE);const R=Object.keys(y);let Z=R.length;for(;Z-- >0;){const Q=R[Z],S=T[Q];if(S){const u=y[Q],Ie=u===void 0||S(u,Q,y);if(Ie!==!0)throw new ct("option "+Q+" must be "+Ie,ct.ERR_BAD_OPTION_VALUE);continue}if(D!==!0)throw new ct("Unknown option "+Q,ct.ERR_BAD_OPTION)}}const kc={assertOptions:$f,validators:Cc},In=kc.validators;class is{constructor(T){this.defaults=T,this.interceptors={request:new ou,response:new ou}}async request(T,D){try{return await this._request(T,D)}catch(R){if(R instanceof Error){let Z;Error.captureStackTrace?Error.captureStackTrace(Z={}):Z=new Error;const Q=Z.stack?Z.stack.replace(/^.+\n/,""):"";try{R.stack?Q&&!String(R.stack).endsWith(Q.replace(/^.+\n.+\n/,""))&&(R.stack+=`
|
585
|
+
`+Q):R.stack=Q}catch{}}throw R}}_request(T,D){typeof T=="string"?(D=D||{},D.url=T):D=T||{},D=ts(this.defaults,D);const{transitional:R,paramsSerializer:Z,headers:Q}=D;R!==void 0&&kc.assertOptions(R,{silentJSONParsing:In.transitional(In.boolean),forcedJSONParsing:In.transitional(In.boolean),clarifyTimeoutError:In.transitional(In.boolean)},!1),Z!=null&&(fe.isFunction(Z)?D.paramsSerializer={serialize:Z}:kc.assertOptions(Z,{encode:In.function,serialize:In.function},!0)),D.method=(D.method||this.defaults.method||"get").toLowerCase();let S=Q&&fe.merge(Q.common,Q[D.method]);Q&&fe.forEach(["delete","get","head","post","put","patch","common"],je=>{delete Q[je]}),D.headers=Gi.concat(S,Q);const u=[];let Ie=!0;this.interceptors.request.forEach(function(Ke){typeof Ke.runWhen=="function"&&Ke.runWhen(D)===!1||(Ie=Ie&&Ke.synchronous,u.unshift(Ke.fulfilled,Ke.rejected))});const xe=[];this.interceptors.response.forEach(function(Ke){xe.push(Ke.fulfilled,Ke.rejected)});let we,he=0,ae;if(!Ie){const je=[Su.bind(this),void 0];for(je.unshift.apply(je,u),je.push.apply(je,xe),ae=je.length,we=Promise.resolve(D);he<ae;)we=we.then(je[he++],je[he++]);return we}ae=u.length;let dt=D;for(he=0;he<ae;){const je=u[he++],Ke=u[he++];try{dt=je(dt)}catch(Oe){Ke.call(this,Oe);break}}try{we=Su.call(this,dt)}catch(je){return Promise.reject(je)}for(he=0,ae=xe.length;he<ae;)we=we.then(xe[he++],xe[he++]);return we}getUri(T){T=ts(this.defaults,T);const D=fu(T.baseURL,T.url);return su(D,T.params,T.paramsSerializer)}}fe.forEach(["delete","get","head","options"],function(T){is.prototype[T]=function(D,R){return this.request(ts(R||{},{method:T,url:D,data:(R||{}).data}))}}),fe.forEach(["post","put","patch"],function(T){function D(R){return function(Q,S,u){return this.request(ts(u||{},{method:T,headers:R?{"Content-Type":"multipart/form-data"}:{},url:Q,data:S}))}}is.prototype[T]=D(),is.prototype[T+"Form"]=D(!0)});class Mc{constructor(T){if(typeof T!="function")throw new TypeError("executor must be a function.");let D;this.promise=new Promise(function(Q){D=Q});const R=this;this.promise.then(Z=>{if(!R._listeners)return;let Q=R._listeners.length;for(;Q-- >0;)R._listeners[Q](Z);R._listeners=null}),this.promise.then=Z=>{let Q;const S=new Promise(u=>{R.subscribe(u),Q=u}).then(Z);return S.cancel=function(){R.unsubscribe(Q)},S},T(function(Q,S,u){R.reason||(R.reason=new Vs(Q,S,u),D(R.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(T){if(this.reason){T(this.reason);return}this._listeners?this._listeners.push(T):this._listeners=[T]}unsubscribe(T){if(!this._listeners)return;const D=this._listeners.indexOf(T);D!==-1&&this._listeners.splice(D,1)}static source(){let T;return{token:new Mc(function(Z){T=Z}),cancel:T}}}function qf(y){return function(D){return y.apply(null,D)}}function Zf(y){return fe.isObject(y)&&y.isAxiosError===!0}const zc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(zc).forEach(([y,T])=>{zc[T]=y});function Pu(y){const T=new is(y),D=$h(is.prototype.request,T);return fe.extend(D,is.prototype,T,{allOwnKeys:!0}),fe.extend(D,T,null,{allOwnKeys:!0}),D.create=function(Z){return Pu(ts(y,Z))},D}const Xt=Pu(Oo);Xt.Axios=is,Xt.CanceledError=Vs,Xt.CancelToken=Mc,Xt.isCancel=hu,Xt.VERSION=Tu,Xt.toFormData=sl,Xt.AxiosError=ct,Xt.Cancel=Xt.CanceledError,Xt.all=function(T){return Promise.all(T)},Xt.spread=qf,Xt.isAxiosError=Zf,Xt.mergeConfig=ts,Xt.AxiosHeaders=Gi,Xt.formToJSON=y=>lu(fe.isHTMLForm(y)?new FormData(y):y),Xt.getAdapter=wu.getAdapter,Xt.HttpStatusCode=zc,Xt.default=Xt;const Gf=(y,T=300)=>{let D;return function(...Z){clearTimeout(D),D=setTimeout(()=>{y.apply(this,Z)},T)}},Hf={mixins:[gc],props:{map:{type:Object},baseLayers:{type:Array,default:[{id:"orto10",name:"Ortophoto 1:10К",url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",service:"TMS",category:"Національна інфраструктура геопросторових даних",scale:1e4,year:2020,bounds:"ua",maxzoom:18,owner:"НДІГК (Інститут геодезії та картографії)",image:"https://data.gki.com.ua/api-user/rtile/orto10/ua/13/4954/2876.png",basemap:!0},{id:"graymap",name:"Сіра карта",url:"https://basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",service:"TMS",category:"Базові карти",attribution:"© <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a>, © <a href='https://carto.com/attributions'>CARTO</a>",bounds1:"ua",image:"https://basemaps.cartocdn.com/light_all/10/601/348.png",position:0,owner:"OSM",basemap:!0},{id:"darkmap_carto",name:"Темна карта України",image:"https://basemaps.cartocdn.com/dark_all/13/4791/2762.png?ver=2023-04-14",url:"https://basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png",service:"TMS",category:"Базові карти",active:!1}]}},data(){return{selectedLayer:null}},watch:{map(y){y&&y.on("load",this.handleMapLoad)}},methods:{handleMapLoad(){this.baseLayers.forEach(y=>{this.layerList.push(y)}),this.toggleLayerVisibility("graymap")},toggleLayerVisibility(y){this.selectedLayer=y,this.changeBaseLayer(this.selectedLayer)}}},Xf={class:"vs-map-slot-layers"},Wf=["onClick"],Jf=["src","alt"];function Kf(y,T,D,R,Z,Q){return oe.openBlock(),oe.createElementBlock("div",Xf,[(oe.openBlock(!0),oe.createElementBlock(oe.Fragment,null,oe.renderList(D.baseLayers,S=>(oe.openBlock(),oe.createElementBlock("div",{key:S.id,class:oe.normalizeClass(["vs-map-slot-layers__layer",{focused:S.id==Z.selectedLayer}]),onClick:u=>Q.toggleLayerVisibility(S.id)},[oe.createElementVNode("img",{width:"50",height:"50",src:S.image,class:"vs-map-slot-layers__image",alt:S==null?void 0:S.name},null,8,Jf)],10,Wf))),128))])}const Yf=nn(Hf,[["render",Kf],["__scopeId","data-v-6644a27d"]]),Qf={props:["colors"]},em={class:"absolute left-[20px] bottom-[74px] bg-white max-w-[250px] p-[10px] rounded-lg"},tm={class:"legend-item"},im={key:0,class:"flex justify-start items-center gap-2"},rm={class:"ml-1"};function nm(y,T,D,R,Z,Q){return oe.openBlock(),oe.createElementBlock("div",em,[(oe.openBlock(!0),oe.createElementBlock(oe.Fragment,null,oe.renderList(D.colors,S=>(oe.openBlock(),oe.createElementBlock("div",tm,[S.id>0?(oe.openBlock(),oe.createElementBlock("div",im,[oe.createElementVNode("div",{class:"w-[15px] h-[15px] rounded-[50%] min-w-[15px]",style:oe.normalizeStyle({backgroundColor:S.color})},null,4),oe.createElementVNode("div",rm,oe.toDisplayString(S.text),1)])):oe.createCommentVNode("",!0)]))),256))])}const sm={components:{MapSlotLayers:Yf,MapLegend:nn(Qf,[["render",nm]])},props:{colorAttr:null,height:{type:String,default:()=>"100vh"},width:{type:String,default:"100vw"},center:{type:Array,default:[32,49]},maxBounds:{type:Array,default:[[22,44],[40,52]]},table:{type:String,default:""},zoom:{type:[String,Number],default:5},basemap:Array,filtersParam:{type:String,default:""},row:{type:Object,default:{}}},mixins:[gc],data(){return{map:null,hoverObject:null,popup:null,colors:[]}},async mounted(){var y,T,D,R,Z,Q,S,u,Ie,xe,we,he,ae,dt,je,Ke,Oe,xt,tt,We,Ut,zt,Et,St,Yi,ri,Qi,vt;if(await this.createMap(),(y=this.row)!=null&&y.geom){const Pn=new URLSearchParams(window.location.search);if(((D=(T=this.row)==null?void 0:T.geom)==null?void 0:D.coordinates.length)<=1&&Pn.has("id")){if(typeof((u=(S=(Q=(Z=(R=this.row)==null?void 0:R.geom)==null?void 0:Z.coordinates)==null?void 0:Q[0])==null?void 0:S[0])==null?void 0:u[0])=="number")(he=this.map)==null||he.fitBounds((we=(xe=(Ie=this.row)==null?void 0:Ie.geom)==null?void 0:xe.coordinates)==null?void 0:we[0],{maxZoom:13,padding:30});else if(typeof((Oe=(Ke=(je=(dt=(ae=this.row)==null?void 0:ae.geom)==null?void 0:dt.coordinates)==null?void 0:je[0])==null?void 0:Ke[0])==null?void 0:Oe[0])=="object"){debugger;(zt=this.map)==null||zt.fitBounds((Ut=(We=(tt=(xt=this.row)==null?void 0:xt.geom)==null?void 0:tt.coordinates)==null?void 0:We[0])==null?void 0:Ut[0],{maxZoom:13,padding:30})}}else(Qi=this.map)==null||Qi.fitBounds((ri=(Yi=(St=(Et=this.row)==null?void 0:Et.geom)==null?void 0:St.coordinates)==null?void 0:Yi[0])==null?void 0:ri[0],{maxZoom:13,padding:30})}else(vt=this.map)==null||vt.fitBounds(this.maxBounds)},watch:{filtersParam(y){this.setFilter(this.table,y)}},methods:{async getColorStyle(){var y=[["#69D2E7","#A7DBD8","#E0E4CC","#F38630","#FA6900"],["#FE4365","#FC9D9A","#F9CDAD","#C8C8A9","#83AF9B"],["#ECD078","#D95B43","#C02942","#542437","#53777A"]];if(!this.colorAttr)return"blue";try{const{data:{rows:T}}=await Xt.get(`/api/data/${this.table}/${this.colorAttr}`),D=T.reduce((R,Z,Q)=>Z!=null&&Z.id?[...R,Z.id.toString(),Z.color||y[0][Q%5]]:R,["match",["get",this.colorAttr]]);return this.colors=[...T],D.push("gray"),D}catch(T){console.log(T)}},async handleMapLoad(){const y=await this.getColorStyle();await this.addLayer({id:this.table,service:"vector",url:`/api/vtile/${this.table}/ua/{z}/{x}/{y}.vmt?pointZoom=12&nocache=1`,layers:[{type:"fill","source-layer":this.table,paint:{"fill-color":y,"fill-opacity":.3,"fill-outline-color":["case",["==",["feature-state","hover"],!0],"red","#000000"]},filter:["all",["==",["geometry-type"],"Polygon"]]},{type:"circle","source-layer":this.table,filter:["all",["==",["geometry-type"],"Point"]],paint:{"circle-radius":{base:1.75,stops:[[10,5],[12,6],[18,12]]},"circle-stroke-color":["case",["==",["feature-state","hover"],!0],"red","#ccc"],"circle-stroke-width":["case",["==",["feature-state","hover"],!0],2,1],"circle-color":y}}]})},async createMap(){const y={version:8,glyphs:"https://cdn.softpro.ua/data/fonts/{fontstack}/{range}.pbf",sources:{},layers:[]};this.map=await new mc.Map({container:"maplibre-map",style:y,center:this.center,zoom:this.zoom,minZoom:5,extend:this.maxBounds}),this.$parent.map=this.map,this.map.addControl(new mc.NavigationControl({visualizePitch:!0})),this.map.on("load",this.handleMapLoad)}}},om={class:"vs-map-portal relative"};function am(y,T,D,R,Z,Q){const S=oe.resolveComponent("MapLegend"),u=oe.resolveComponent("MapSlotLayers");return oe.openBlock(),oe.createElementBlock("div",om,[oe.createElementVNode("div",{id:"maplibre-map",ref:"maplibreMap",style:oe.normalizeStyle({height:D.height,width:D.width})},null,4),oe.createVNode(S,{colors:Z.colors},null,8,["colors"]),oe.createVNode(u,{map:Z.map,baseLayers:D.basemap},null,8,["map","baseLayers"])])}const lm=nn(sm,[["render",am]]),cm={},hm={class:"flex-shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},um=[oe.createStaticVNode('<line x1="21" x2="14" y1="4" y2="4"></line><line x1="10" x2="3" y1="4" y2="4"></line><line x1="21" x2="12" y1="12" y2="12"></line><line x1="8" x2="3" y1="12" y2="12"></line><line x1="21" x2="16" y1="20" y2="20"></line><line x1="12" x2="3" y1="20" y2="20"></line><line x1="14" x2="14" y1="2" y2="6"></line><line x1="8" x2="8" y1="10" y2="14"></line><line x1="16" x2="16" y1="18" y2="22"></line>',9)];function dm(y,T){return oe.openBlock(),oe.createElementBlock("svg",hm,um)}const pm=nn(cm,[["render",dm]]),fm={},mm={xmlns:"http://www.w3.org/2000/svg",width:"21",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-layout-sidebar-right-collapse"},gm=[oe.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),oe.createElementVNode("path",{d:"M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"},null,-1),oe.createElementVNode("path",{d:"M15 4v16"},null,-1),oe.createElementVNode("path",{d:"M9 10l2 2l-2 2"},null,-1)];function _m(y,T){return oe.openBlock(),oe.createElementBlock("svg",mm,gm)}const ym=nn(fm,[["render",_m]]),xm={},vm={xmlns:"http://www.w3.org/2000/svg",width:"21",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-layout-sidebar-right-expand"},bm=[oe.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),oe.createElementVNode("path",{d:"M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"},null,-1),oe.createElementVNode("path",{d:"M15 4v16"},null,-1),oe.createElementVNode("path",{d:"M10 10l-2 2l2 2"},null,-1)];function wm(y,T){return oe.openBlock(),oe.createElementBlock("svg",vm,bm)}const Sm=nn(xm,[["render",wm]]),Tm={},Im={class:"shrink-0 size-3",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Pm=[oe.createElementVNode("path",{d:"M18 6 6 18"},null,-1),oe.createElementVNode("path",{d:"m6 6 12 12"},null,-1)];function Em(y,T){return oe.openBlock(),oe.createElementBlock("svg",Im,Pm)}const Am=nn(Tm,[["render",Em]]),Cm=oe.defineComponent({props:["title","table","tableComponent","rows","initTotal","colorAttr","maxBounds","isAutocomplete"],mixins:[gc],components:{MapPortal:lm,NoData:Sp,FilterIcon:pm,VisibleMapIcon:ym,HiddenMapIcon:Sm,CloseIcon:Am},data(){return{filters:"",search:"",limit:20,filtersParam:"",isSelectObj:!1,selectedId:"",searchRegion:"",searchRegionResult:[],isRegionDropdownVisible:!1,selectedRow:"",activeFilters:"",isMapVisible:!0,tabsIsVisible:!1,filterUrl:"",currentPage:1,isFilterVisible:!1,tableData:null,hoverData:null,atuData:[],map:null,total:null,filterValues:"",activeFiltersCount:"",visibleTrue:!0,regionSelectValue:null,optionRowsCount:[{value:10,label:"10"},{value:20,label:"20"},{value:30,label:"30"}],handleDebouncedUpdateValue:Gf(y=>{this.handleSearchValue(y)},500)}},computed:{},watch:{map(){this.map.on("mousemove",this.handleMapHover),this.map.on("click",this.handleMapClick)},activeFiltersCount(){var y,T;return(T=(y=this.$refs)==null?void 0:y.filter)==null?void 0:T.filteredActiveFiltersLength},activeFilters(){var y,T;return this.isSelectObj&&this.moveToDefaultPage(),(T=(y=this.$refs)==null?void 0:y.filter)==null?void 0:T.activeFilters},isFilterVisible(y){y||this.getData()},searchRegion(y){this.getReginOptions()},async regionSelectValue(){var Z,Q,S,u,Ie,xe;const y=(S=(Q=(Z=this.regionSelectValue)==null?void 0:Z.geom)==null?void 0:Q.coordinates)==null?void 0:S[0],T=this.map.getSource("region-search-id");T?T.setData({type:"Feature",geometry:(Ie=this.regionSelectValue)==null?void 0:Ie.geom}):this.map.addSource("region-search-id",{type:"geojson",data:{type:"Feature",geometry:(u=this.regionSelectValue)==null?void 0:u.geom}}),this.map.getLayer("region-search-id")&&this.map.removeLayer("region-search-id");const R={id:"region-search-id",type:"fill",source:"region-search-id",paint:{"fill-color":"blue","fill-opacity":.1}};await this.map.addLayer(R),this.moveLayer("site.prc.parcel_object.table"),(xe=this.map)==null||xe.fitBounds(y,{zoom:10,padding:20})}},created(){this.tableData=this.rows,this.total=this.initTotal},mounted(){this.rows||this.getData(),this.checkUrl(),this.getFilter()},updated(){this.checkFilterLength()},methods:{async getData(){try{const y={search:this.search||null,limit:this.limit,page:this.currentPage};this.filtersParam!==""&&this.filtersParam!=="no-url"&&(y.filter=this.filtersParam);const{data:T}=await Xt.get(`/api/data/${this.table}`,{params:y});this.tableData=T.rows,this.total=T.total}catch(y){console.error(y.message)}},async handleClick(){await this.getReginOptions()},moveToDefaultPage(){var R;const y=new URLSearchParams(window.location.search);y.delete("id");const D=`${window.location.pathname}?${y.toString()}`;(R=this.map)==null||R.fitBounds(this.maxBounds,{}),window.history.pushState({},"",D),this.isSelectObj=!1},regionFullName(y){return`${y.text} / ${y.region}`},getLabelById(y){const T=this.filters.find(D=>D.id===y);return T?T.label:y},getOptionsLabelById(y,T){return Array.isArray(T)?this.filters.find(R=>R.id===y).options.filter(R=>T.includes(R.id)).map(R=>R.text).join(", "):T},async clearFilter(y){var T,D;await((D=(T=this.$refs)==null?void 0:T.filter)==null?void 0:D.clearFilter(y)),await this.updateTableAndMap(),await this.getData()},async getReginOptions(){try{const{data:y}=await Xt.get(`https://data.softpro.ua/api-user/suggest/atu.codifier.type.full.select?parent=H&key=${this.searchRegion}`);this.searchRegionResult=y}catch(y){console.error(y.message)}},handlePageChange(y){this.currentPage=y,this.getData()},async getFilter(){try{const{data:y}=await Xt.get(`/api/filter/${this.table}`);this.filters=y.list}catch(y){console.error(y.message)}},async handleSearchValue(y){this.search=y,await this.getData()},async handleSearchRegionValue(y){var T;this.searchRegion=y,y===""&&((T=this.map)==null||T.fitBounds([[22,44.4],[40,52.5]],{}))},handleFilterChange(y){this.currentPage=y.state.page||1,this.filterUrl=y.url.split("|").filter(T=>!T.includes("page=")).join("|")},async updateTableAndMap(){var y,T;this.filtersParam=this.filterUrl,this.activeFilters=(T=(y=this.$refs)==null?void 0:y.filter)==null?void 0:T.activeFilters,this.isFilterVisible=!1},handleFilterSubmit(){var y;this.isSelectObj="",this.selectedId="",this.selectedId=!1,(y=this.map)==null||y.fitBounds([[22,44.4],[40,52.5]],{}),this.isFilterVisible=!1},toggleFilterShown(){this.isFilterVisible=!this.isFilterVisible},closeFilterShown(){this.isFilterVisible=!1},toggleMapVisible(){this.isMapVisible=!this.isMapVisible},checkUrl(){const y=new URLSearchParams(window.location.search);y.has("id")?(this.isSelectObj=!0,this.isMapVisible=!0,this.selectedId=y.get("id")):(this.isSelectObj=!1,this.selectedId="")},changeLimit(y){this.limit=y,this.currentPage=1,this.getData()},filterModalClose(){this.toggleFilterShown(),this.isFilterVisible=!1},resetFilters(){this.$refs.filter&&(this.$refs.filter.clearAll(),this.search="",this.isFilterVisible=!1,this.filtersParam="",this.activeFilters=null,this.tabsIsVisible=!1,this.getData())},checkFilterLength(){var T,D;const y=(D=(T=this.$refs)==null?void 0:T.filter)==null?void 0:D.filteredActiveFiltersLength;y!==this.previousLength&&(this.previousLength=y,this.activeFiltersCount=y)},async handleMapClick(y){var Q,S,u,Ie,xe;const T=this.map.queryRenderedFeatures(y.point),D=window.location.pathname,R=new URLSearchParams(window.location.search);R.set("id",`${T[0].properties.id}`);const Z=`${D}?${R.toString()}`;window.history.pushState({},"",Z),this.isSelectObj=!0,y.lngLat&&((xe=this.map)==null||xe.fitBounds([[(Q=y.lngLat)==null?void 0:Q.lng,(S=y.lngLat)==null?void 0:S.lat],[(u=y.lngLat)==null?void 0:u.lng,(Ie=y.lngLat)==null?void 0:Ie.lat]],{maxZoom:13,padding:30})),this.checkUrl()},async selectRow(y){var Z,Q,S,u,Ie,xe,we,he,ae,dt,je,Ke,Oe,xt,tt,We,Ut,zt,Et,St;this.isMapVisible=!0,this.selectedRow=y;const T=window.location.pathname,D=new URLSearchParams(window.location.search);D.set("id",`${y.id}`);const R=`${T}?${D.toString()}`;window.history.pushState({},"",R),this.checkUrl(),y!=null&&y.geom&&(((Z=y==null?void 0:y.geom)==null?void 0:Z.coordinates.length)<=1?typeof((Ie=(u=(S=(Q=y==null?void 0:y.geom)==null?void 0:Q.coordinates)==null?void 0:S[0])==null?void 0:u[0])==null?void 0:Ie[0])=="number"?(he=this.map)==null||he.fitBounds((we=(xe=y==null?void 0:y.geom)==null?void 0:xe.coordinates)==null?void 0:we[0],{maxZoom:13,padding:30}):typeof((Ke=(je=(dt=(ae=y==null?void 0:y.geom)==null?void 0:ae.coordinates)==null?void 0:dt[0])==null?void 0:je[0])==null?void 0:Ke[0])=="object"&&((We=this.map)==null||We.fitBounds((tt=(xt=(Oe=y==null?void 0:y.geom)==null?void 0:Oe.coordinates)==null?void 0:xt[0])==null?void 0:tt[0],{maxZoom:13,padding:30})):(St=this.map)==null||St.fitBounds((Et=(zt=(Ut=y==null?void 0:y.geom)==null?void 0:Ut.coordinates)==null?void 0:zt[0])==null?void 0:Et[0],{maxZoom:13,padding:30})),this.isSelectObj=!0},async handleMapHover(y){var Z;this.hoverObject&&(this.map.setFeatureState(this.hoverObject,{hover:!1}),this.hoverObject=null),this.popup||(this.popup=new mc.Popup({maxWidth:"400px",closeButton:!1,closeOnClick:!1}));const T=this.map.queryRenderedFeatures(y.point);if(this.map.getCanvas().style.cursor="pointer",!T.length||((Z=T==null?void 0:T[0])==null?void 0:Z.source)==="region-search-id"){this.map.getCanvas().style.cursor="",this.popup.remove();return}const D=T[0].geometry.coordinates.slice();this.hoverData=T[0].properties;const R={source:T[0].source,sourceLayer:T[0].sourceLayer,id:T[0].id};if(R.source!=="region-search-id"){for(this.map.setFeatureState(R,{hover:!0}),this.hoverObject=R;Math.abs(y.lngLat.lng-D[0])>180;)D[0]+=y.lngLat.lng>D[0]?360:-360;this.popup.setLngLat(y.lngLat).setHTML(this.$refs.popup.innerHTML).addTo(this.map)}}}}),km={class:"ml-3 pt-5"},Mm={class:"w-full gap-5 flex justify-between mb-[10px] pr-3"},zm={class:"flex gap-[20px]"},Dm={key:0,class:"font-medium text-[10px] min-w-[16px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full"},Lm={class:"p-4 flex-1 flex flex-wrap justify-end items-center gap-2"},Rm=["title"],Bm=oe.createElementVNode("span",{class:"sr-only"},"Відкрити мапу",-1),Fm={class:"flex"},Om={class:"py-[15px] pb-[24px] pl-2"},Vm={class:"font-bold text-2xl mr-[10px]"},Nm={class:"text-sm text-stone-500 font-medium"},jm=oe.createElementVNode("span",{class:"text-sm text-stone-500 font-medium"}," об'єктів",-1),Um={class:"wrapperTable flex flex-col",style:{height:"calc(100vh - 302px)"}},$m={key:0,class:"flex gap-x-2 flex-wrap"},qm={class:"font-medium"},Zm=oe.createElementVNode("span",{class:"h-3 mx-2 border-s border-gray-200"},null,-1),Gm={class:"text-gray-500"},Hm=["onClick"],Xm={key:0,class:"mb-[10px] py-1 ps-3 pe-1 inline-flex items-center bg-white border border-gray-200 text-gray-800 text-xs rounded-full"},Wm=oe.createElementVNode("span",{class:"font-medium"}," Очистити ",-1),Jm={key:2,class:"text-center py-28"},Km=oe.createElementVNode("h2",{class:"font-medium text-base text-gray-500 rounded-xl"}," За ваши запитом даних не знайдено! ",-1),Ym=oe.createElementVNode("p",{class:"font-normal text-sm text-gray-500 rounded-xl"}," Введіть, будь ласка,інші значення для пошуку. ",-1),Qm={key:0},eg={key:1,class:"my-5 pr-2"},tg={class:"flex justify-between"},ig={key:1,class:"w-2/4"},rg={class:"map-section"},ng={ref:"popup",style:{display:"none"}};function sg(y,T,D,R,Z,Q){const S=oe.resolveComponent("VsAutocompleteOption"),u=oe.resolveComponent("vs-autocomplete"),Ie=oe.resolveComponent("vs-text"),xe=oe.resolveComponent("FilterIcon"),we=oe.resolveComponent("VsFilter"),he=oe.resolveComponent("VsDialog"),ae=oe.resolveComponent("VisibleMapIcon"),dt=oe.resolveComponent("HiddenMapIcon"),je=oe.resolveComponent("CloseIcon"),Ke=oe.resolveComponent("NoData"),Oe=oe.resolveComponent("VsPagination"),xt=oe.resolveComponent("MapPortal");return oe.openBlock(),oe.createElementBlock("section",km,[oe.createElementVNode("div",null,[oe.createElementVNode("div",Mm,[oe.createElementVNode("div",zm,[y.isAutocomplete?(oe.openBlock(),oe.createBlock(u,{key:0,modelValue:y.regionSelectValue,"onUpdate:modelValue":[T[0]||(T[0]=tt=>y.regionSelectValue=tt),y.handleSearchRegionValue],searchable:"",clearable:"",searchPlaceholder:"Введіть назву громади",placeholder:"Обрати область чи громаду",onOnSearch:T[1]||(T[1]=tt=>y.searchRegion=tt),onClick:y.handleClick,class:"w-[350px]"},{default:oe.withCtx(()=>[(oe.openBlock(!0),oe.createElementBlock(oe.Fragment,null,oe.renderList(y.searchRegionResult,tt=>(oe.openBlock(),oe.createBlock(S,{class:"px-0 py-0",key:tt==null?void 0:tt.id,value:tt,label:y.regionFullName(tt)},null,8,["value","label"]))),128))]),_:1},8,["modelValue","onUpdate:modelValue","onClick"])):oe.createCommentVNode("",!0),oe.createVNode(Ie,{"model-value":y.search,"onUpdate:modelValue":y.handleDebouncedUpdateValue,class:"w-full table-interface-search [&>input:focus]:ring-1",placeholder:"Пошук",icon:"ti-search","icon-position":"left",clearable:"",style:{height:"38px","min-width":"300px","max-width":"300px"},ref:"searchInput"},null,8,["model-value","onUpdate:modelValue"]),y.total>=1?(oe.openBlock(),oe.createElementBlock("button",{key:1,type:"button",class:"py-2 px-2.5 max-h-[38px] inline-flex items-center gap-x-1.5 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50",onClick:T[2]||(T[2]=(...tt)=>y.toggleFilterShown&&y.toggleFilterShown(...tt))},[oe.createVNode(xe),oe.createTextVNode(" Фільтри "),y.activeFiltersCount>=1?(oe.openBlock(),oe.createElementBlock("span",Dm,oe.toDisplayString(y.activeFiltersCount),1)):oe.createCommentVNode("",!0)])):oe.createCommentVNode("",!0),oe.withDirectives(oe.createVNode(he,{visible:y.visibleTrue,"onUpdate:visible":T[5]||(T[5]=tt=>y.visibleTrue=tt),title:"Фільтри",size:"small",onOnClose:T[6]||(T[6]=()=>{y.visibleTrue=!0,y.isFilterVisible=!1})},{footer:oe.withCtx(()=>[oe.createElementVNode("div",Lm,[oe.createElementVNode("button",{onClick:T[3]||(T[3]=(...tt)=>y.resetFilters&&y.resetFilters(...tt)),class:"py-2 px-3 inline-flex justify-center items-center text-start bg-white border border-gray-200 text-gray-800 text-sm font-medium rounded-lg shadow-sm align-middle hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"}," Очистити все "),oe.createElementVNode("button",{onClick:T[4]||(T[4]=(...tt)=>y.updateTableAndMap&&y.updateTableAndMap(...tt)),class:"py-2 px-3 inline-flex justify-center items-center gap-x-2 text-start bg-blue-600 border border-blue-600 text-white text-sm font-medium rounded-lg shadow-sm align-middle hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-500"}," Застосувати ")])]),default:oe.withCtx(()=>[y.filters?(oe.openBlock(),oe.createBlock(we,{key:0,ref:"filter",scheme:y.filters,closeFilterBtn:!0,onFilterClose:y.closeFilterShown,name:"filter",layout:"default",onFilterChange:y.handleFilterChange},null,8,["scheme","onFilterClose","onFilterChange"])):oe.createCommentVNode("",!0)]),_:1},8,["visible"]),[[oe.vShow,y.isFilterVisible]])]),oe.createElementVNode("button",{type:"button",class:"py-2 px-2 inline-flex items-center gap-x-1.5 text-sm rounded-lg border border-gray-200 bg-white text-gray-600 shadow-sm hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100",title:y.isMapVisible?"Приховати карту":"Показати карту",onClick:T[7]||(T[7]=(...tt)=>y.toggleMapVisible&&y.toggleMapVisible(...tt))},[y.isMapVisible?(oe.openBlock(),oe.createBlock(ae,{key:0})):(oe.openBlock(),oe.createBlock(dt,{key:1})),Bm],8,Rm)]),oe.createElementVNode("div",Fm,[oe.createElementVNode("div",{class:oe.normalizeClass(["relative overflow-hidden",y.isMapVisible?"w-2/4 mr-0":"w-full mr-3",y.isSelectObj?"hidden":""])},[oe.createElementVNode("h1",Om,[oe.createElementVNode("span",Vm,oe.toDisplayString(y.title),1),oe.createElementVNode("span",Nm,oe.toDisplayString(y.total),1),jm]),oe.createElementVNode("div",Um,[y.activeFilters?(oe.openBlock(),oe.createElementBlock("div",$m,[(oe.openBlock(!0),oe.createElementBlock(oe.Fragment,null,oe.renderList(y.activeFilters,(tt,We,Ut)=>(oe.openBlock(),oe.createElementBlock("span",{class:"mb-[10px] py-1 ps-3 pe-1 inline-flex items-center bg-white border border-gray-200 text-gray-800 text-xs rounded-full",key:Ut},[oe.createElementVNode("span",qm,oe.toDisplayString(y.getLabelById(We)),1),Zm,oe.createElementVNode("span",Gm,oe.toDisplayString(y.getOptionsLabelById(We,tt)),1),oe.createElementVNode("button",{type:"button",class:"inline-flex shrink-0 justify-center items-center size-5 ms-1 rounded-full text-gray-600 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 text-sm",onClick:zt=>y.clearFilter(We)},[oe.createVNode(je)],8,Hm)]))),128)),Object.keys(y.activeFilters).length>=2?(oe.openBlock(),oe.createElementBlock("span",Xm,[Wm,oe.createElementVNode("button",{type:"button",class:"inline-flex shrink-0 justify-center items-center size-5 ms-1 rounded-full text-gray-600 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 text-sm",onClick:T[8]||(T[8]=(...tt)=>y.resetFilters&&y.resetFilters(...tt))},[oe.createVNode(je)])])):oe.createCommentVNode("",!0)])):oe.createCommentVNode("",!0),y.total>=1?oe.renderSlot(y.$slots,"table",{key:1,rows:y.tableData,map:y.map,selectRow:y.selectRow,getData:y.getData}):(oe.openBlock(),oe.createElementBlock("div",Jm,[oe.createVNode(Ke),Km,Ym,oe.createElementVNode("button",{type:"button",class:"mt-[10px] py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs rounded-lg border border-stone-200 bg-white text-stone-800 shadow-sm hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100",onClick:T[9]||(T[9]=(...tt)=>y.resetFilters&&y.resetFilters(...tt))}," Очистити дані пошуку ")]))]),y.total>=1?(oe.openBlock(),oe.createElementBlock("hr",Qm)):oe.createCommentVNode("",!0),y.total>=1?(oe.openBlock(),oe.createElementBlock("div",eg,[oe.createElementVNode("div",tg,[oe.createVNode(Oe,{total:y.total,maxPages:7,defaultPage:y.currentPage,pageSize:y.limit,goTo:!1,size:"medium",onPageChange:y.handlePageChange,backgroundColor:"#e5e7eb",borderedCellSelected:"true",pageSizes:[10,20,30],onPageSizeChange:y.changeLimit},null,8,["total","defaultPage","pageSize","onPageChange","onPageSizeChange"])])])):oe.createCommentVNode("",!0)],2),y.isSelectObj?(oe.openBlock(),oe.createElementBlock("div",{key:0,class:oe.normalizeClass(y.isMapVisible?"w-2/4 mr-0 pb-5":"w-full pb-5 mr-3"),style:{height:"calc(100vh - 152px)"}},[oe.renderSlot(y.$slots,"details",{table:y.table,selectedId:y.selectedId,selectedRow:y.selectedRow,map:y.map})],2)):oe.createCommentVNode("",!0),y.isMapVisible?(oe.openBlock(),oe.createElementBlock("div",ig,[oe.createElementVNode("section",rg,[oe.createVNode(xt,{height:"calc(100vh - 152px)",width:"w-2/4",table:y.table,filtersParam:y.filtersParam,row:y.selectedRow,colorAttr:y.colorAttr,maxBounds:y.maxBounds},null,8,["table","filtersParam","row","colorAttr","maxBounds"])])])):oe.createCommentVNode("",!0)]),oe.createElementVNode("div",ng,[oe.renderSlot(y.$slots,"popup",{data:y.hoverData})],512)])])}const Eu=nn(Cm,[["render",sg]]),Au={install:y=>{y.component("VsPartsMap",Eu)},components:{VsPartsMap:Eu}};return typeof window<"u"&&(window.PartsMap=Au),Au});
|