@opengis/partsmap 0.0.97 → 0.0.99
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 +7785 -7704
- package/dist/PartsMap.umd.cjs +52 -52
- package/package.json +1 -1
package/dist/PartsMap.umd.cjs
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
(function(
|
1
|
+
(function(m,b){typeof exports=="object"&&typeof module<"u"?module.exports=b(require("vue")):typeof define=="function"&&define.amd?define(["vue"],b):(m=typeof globalThis<"u"?globalThis:m||self,m.PartsMap=b(m.Vue))})(this,function(vue){"use strict";var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(m){return m&&m.__esModule&&Object.prototype.hasOwnProperty.call(m,"default")?m.default:m}var maplibreGl={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(g,b){(function(P,C){g.exports=C()})(Bo,function(){var P={},C={};function B(T,c,ge){if(C[T]=ge,T==="index"){var xe="var sharedModule = {}; ("+C.shared+")(sharedModule); ("+C.worker+")(sharedModule);",ve={};return C.shared(ve),C.index(P,ve),typeof window<"u"&&P.setWorkerUrl(window.URL.createObjectURL(new Blob([xe],{type:"text/javascript"}))),P}}B("shared",["exports"],function(T){function c(i,e,r,s){return new(r||(r=Promise))(function(l,d){function p(x){try{_(s.next(x))}catch(S){d(S)}}function f(x){try{_(s.throw(x))}catch(S){d(S)}}function _(x){var S;x.done?l(x.value):(S=x.value,S instanceof r?S:new r(function(I){I(S)})).then(p,f)}_((s=s.apply(i,e||[])).next())})}function ge(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}typeof SuppressedError=="function"&&SuppressedError;var xe=ve;function ve(i,e){this.x=i,this.y=e}ve.prototype={clone:function(){return new ve(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}},ve.convert=function(i){return i instanceof ve?i:Array.isArray(i)?new ve(i[0],i[1]):i};var le=ge(xe),ae=ct;function ct(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}ct.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 Ue=ge(ae);let Ke,Ve;function pt(){return Ke==null&&(Ke=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Ke}function Mt(){if(Ve==null&&(Ve=!1,pt())){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){Ve=!0;break}}}return Ve||!1}function ze(i,e,r,s){const l=new Ue(i,e,r,s);return d=>l.solve(d)}const Pt=ze(.25,.1,.25,1);function xt(i,e,r){return Math.min(r,Math.max(e,i))}function Gt(i,e,r){const s=r-e,l=((i-e)%s+s)%s+e;return l===e?r:l}function jt(i,...e){for(const r of e)for(const s in r)i[s]=r[s];return i}let Fr=1;function bi(i,e,r){const s={};for(const l in i)s[l]=e.call(this,i[l],l,i);return s}function Or(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?bi(i,wt):i}const Ns={};function li(i){Ns[i]||(typeof console<"u"&&console.warn(i),Ns[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 Ir(i){return typeof WorkerGlobalScope<"u"&&i!==void 0&&i instanceof WorkerGlobalScope}let Pn=null;function ur(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const js="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"),_=new Uint8ClampedArray(s*l*4);if(yield d.copyTo(_,function(x,S,I,A,D){const R=4*Math.max(-S,0),O=(Math.max(0,I)-I)*A*4+R,$=4*A,W=Math.max(0,S),oe=Math.max(0,I);return{rect:{x:W,y:oe,width:Math.min(x.width,S+A)-W,height:Math.min(x.height,I+D)-oe},layout:[{offset:O,stride:$}]}}(i,e,r,s,l)),f)for(let x=0;x<_.length;x+=4){const S=_[x];_[x]=_[x+2],_[x+2]=S}return _}finally{d.close()}})}let Pr,Ei;const Yi="AbortError";function kn(){return new Error(Yi)}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 dr(i){return Vr.REGISTERED_PROTOCOLS[i.substring(0,i.indexOf("://"))]}const En="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 Qi=()=>Ir(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=dr(i.url);if(s)return s(i,e);if(Ir(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,targetMapId:En},e)}if(!(/^file:/.test(r=i.url)||/^file:/.test(Qi())&&!/^\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:Qi(),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 _=yield f;if(l.signal.aborted)throw kn();return{data:_,cacheControl:p.headers.get("Cache-Control"),expires:p.headers.get("Expires")}})}(i,e);if(Ir(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,mustQueue:!0,targetMapId:En},e)}var r;return function(s,l){return new Promise((d,p)=>{var f;const _=new XMLHttpRequest;_.open(s.method||"GET",s.url,!0),s.type!=="arrayBuffer"&&s.type!=="image"||(_.responseType="arraybuffer");for(const x in s.headers)_.setRequestHeader(x,s.headers[x]);s.type==="json"&&(_.responseType="text",!((f=s.headers)===null||f===void 0)&&f.Accept||_.setRequestHeader("Accept","application/json")),_.withCredentials=s.credentials==="include",_.onerror=()=>{p(new Error(_.statusText))},_.onload=()=>{if(!l.signal.aborted)if((_.status>=200&&_.status<300||_.status===0)&&_.response!==null){let x=_.response;if(s.type==="json")try{x=JSON.parse(_.response)}catch(S){return void p(S)}d({data:x,cacheControl:_.getResponseHeader("Cache-Control"),expires:_.getResponseHeader("Expires")})}else{const x=new Blob([_.response],{type:_.getResponseHeader("Content-Type")});p(new Fi(_.status,_.statusText,s.url,x))}},l.signal.addEventListener("abort",()=>{_.abort(),p(kn())}),_.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 kr(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={}){jt(this,r),this.type=e}}class jr extends Nr{constructor(e,r={}){super("error",jt({error:e},r))}}class An{on(e,r){return this._listeners=this._listeners||{},is(e,r,this._listeners),this}off(e,r){return kr(e,r,this._listeners),kr(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)kr(s,f,this._oneTimeListeners),f.call(this,e);const p=this._eventedParent;p&&(jt(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 _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 Ut(i,e){i.push(e)}function ns(i,e,r){Ut(r,{command:"addSource",args:[i,e[i]]})}function Ur(i,e,r){Ut(e,{command:"removeSource",args:[i]}),r[i]=!0}function Er(i,e,r,s){Ur(i,r,s),ns(i,e,r)}function Cn(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 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 pr(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 fr{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[s,l]of r)this.bindings[s]=l}concat(e){return new fr(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"},Ee={kind:"number"},ot={kind:"string"},Ye={kind:"boolean"},Ai={kind:"color"},er={kind:"object"},it={kind:"value"},mr={kind:"collator"},Ar={kind:"formatted"},qr={kind:"padding"},gr={kind:"resolvedImage"},G={kind:"variableAnchorOffsetCollection"};function z(i,e){return{kind:"array",itemType:i,N:e}}function M(i){if(i.kind==="array"){const e=M(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const V=[$r,Ee,ot,Ye,Ai,Ar,er,z(it),qr,gr,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 V)if(!q(r,e))return null}}return`Expected ${M(i)} but found ${M(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 ne(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const J=.96422,pe=.82521,ye=4/29,he=6/29,Pe=3*he*he,He=he*he*he,We=Math.PI/180,nt=180/Math.PI;function ft(i){return(i%=360)<0&&(i+=360),i}function rt([i,e,r,s]){let l,d;const p=$t((.2225045*(i=kt(i))+.7168786*(e=kt(e))+.0606169*(r=kt(r)))/1);i===e&&e===r?l=d=p:(l=$t((.4360747*i+.3850649*e+.1430804*r)/J),d=$t((.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 $t(i){return i>He?Math.pow(i,1/3):i/Pe+ye}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*vt(l),d=J*vt(d),p=pe*vt(p),[at(3.1338561*d-1.6168667*l-.4906146*p),at(-.9787684*d+1.9161415*l+.033454*p),at(.0719453*d-.2289914*l+1.4052427*p),s]}function at(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function vt(i){return i>he?i*i*i:Pe*(i-ye)}function Ot(i){return parseInt(i.padEnd(2,i),16)/255}function ei(i,e){return ci(e?i/100:i,0,1)}function ci(i,e,r){return Math.min(Math.max(e,i),r)}function hi(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 bt{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 bt)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,_]=l;return[p/255,f/255,_/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[Ot(s.slice(f,f+=p)),Ot(s.slice(f,f+=p)),Ot(s.slice(f,f+=p)),Ot(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,_,x,S,I,A,D,R,O,$,W,oe]=p,Y=[S||" ",D||" ",$].join("");if(Y===" "||Y===" /"||Y===",,"||Y===",,,"){const ie=[x,A,O].join(""),de=ie==="%%%"?100:ie===""?255:0;if(de){const be=[ci(+_/de,0,1),ci(+I/de,0,1),ci(+R/de,0,1),W?ei(+W,oe):1];if(hi(be))return be}}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,_,x,S,I,A,D,R]=d,O=[_||" ",S||" ",A].join("");if(O===" "||O===" /"||O===",,"||O===",,,"){const $=[+f,ci(+x,0,100),ci(+I,0,100),D?ei(+D,R):1];if(hi($))return function([W,oe,Y,ie]){function de(be){const Re=(be+W/30)%12,Xe=oe*Math.min(Y,1-Y);return Y-Xe*Math.max(-1,Math.min(Re-3,9-Re,1))}return W=ft(W),oe/=100,Y/=100,[de(0),de(8),de(4),ie]}($)}}}(e);return r?new bt(...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]=rt(e),p=Math.sqrt(s*s+l*l);return[Math.round(1e4*p)?ft(Math.atan2(l,s)*nt):NaN,p,r,d]}(this.rgb))}get lab(){return this.overwriteGetter("lab",rt(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})`}}bt.black=new bt(0,0,0,1),bt.white=new bt(1,1,1,1),bt.transparent=new bt(0,0,0,0),bt.red=new bt(1,0,0,1);class Uo{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 $o{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 $o(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 Oc=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"||!Oc.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 ui{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new ui({name:e,available:!1}):null}}function Us(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 bt||i instanceof Uo||i instanceof Oi||i instanceof Vi||i instanceof Ni||i instanceof ui)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 ot;if(typeof i=="boolean")return Ye;if(typeof i=="number")return Ee;if(i instanceof bt)return Ai;if(i instanceof Uo)return mr;if(i instanceof Oi)return Ar;if(i instanceof Vi)return qr;if(i instanceof Ni)return G;if(i instanceof ui)return gr;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=it;break}r=l}return z(r||it,e)}return er}function Cr(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof bt||i instanceof Oi||i instanceof Vi||i instanceof Ni||i instanceof ui?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 Xt{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const $s={string:ot,number:Ee,boolean:Ye,object:er};class Wi{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,_;if(e.length>2){const x=e[1];if(typeof x!="string"||!(x in $s)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);f=$s[x],l++}else f=it;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);_=e[2],l++}s=z(f,_)}else{if(!$s[d])throw new Error(`Types doesn't contain name = ${d}`);s=$s[d]}const p=[];for(;l<e.length;l++){const f=r.parse(e[l],l,it);if(!f)return null;p.push(f)}return new Wi(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 Xt(`Expected value to be of type ${M(this.type)}, but found ${M(Yt(s))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const cs={"to-boolean":Ye,"to-color":Ai,"to-number":Ee,"to-string":ot};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,it);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 bt)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.`:Us(r[0],r[1],r[2],r[3]),!s))return new bt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Xt(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 Xt(`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 Xt(`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 Xt(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return Oi.fromString(Cr(this.args[0].evaluate(e)));case"resolvedImage":return ui.fromString(Cr(this.args[0].evaluate(e)));default:return Cr(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const qo=["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"?qo[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let r=this._parseColorCache[e];return r||(r=this._parseColorCache[e]=bt.parse(e)),r}}class Gr{constructor(e,r,s=[],l,d=new fr,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 Wi(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,_=p.type;if(f.kind!=="string"&&f.kind!=="number"&&f.kind!=="boolean"&&f.kind!=="object"&&f.kind!=="array"||_.kind!=="value")if(f.kind!=="color"&&f.kind!=="formatted"&&f.kind!=="resolvedImage"||_.kind!=="value"&&_.kind!=="string")if(f.kind!=="padding"||_.kind!=="value"&&_.kind!=="number"&&_.kind!=="array")if(f.kind!=="variableAnchorOffsetCollection"||_.kind!=="value"&&_.kind!=="array"){if(this.checkSubtype(f,_))return null}else 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(_){return this.error(_.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 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 qs{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 qs(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 Zo{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,Ee),l=r.parse(e[2],2,z(r.expectedType||it));return s&&l?new Zo(l.type.itemType,s,l):null}evaluate(e){const r=this.index.evaluate(e),s=this.input.evaluate(e);if(r<0)throw new Xt(`Array index out of bounds: ${r} < 0.`);if(r>=s.length)throw new Xt(`Array index out of bounds: ${r} > ${s.length-1}.`);if(r!==Math.floor(r))throw new Xt(`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=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,it),l=r.parse(e[2],2,it);return s&&l?Q(s.type,[Ye,ot,Ee,$r,it])?new us(s,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${M(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 Xt(`Expected first argument to be of type boolean, string, number or null, but found ${M(Yt(r))} instead.`);if(!te(s,["string","array"]))throw new Xt(`Expected second argument to be of type array or string, but found ${M(Yt(s))} instead.`);return s.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Zs{constructor(e,r,s){this.type=Ee,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,it),l=r.parse(e[2],2,it);if(!s||!l)return null;if(!Q(s.type,[Ye,ot,Ee,$r,it]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${M(s.type)} instead`);if(e.length===4){const d=r.parse(e[3],3,Ee);return d?new Zs(s,l,d):null}return new Zs(s,l)}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!te(r,["boolean","string","number","null"]))throw new Xt(`Expected first argument to be of type boolean, string, number or null, but found ${M(Yt(r))} instead.`);if(!te(s,["string","array"]))throw new Xt(`Expected second argument to be of type array or string, but found ${M(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 Gs{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 S=e[x];const I=e[x+1];Array.isArray(S)||(S=[S]);const A=r.concat(x);if(S.length===0)return A.error("Expected at least one branch label.");for(const R of S){if(typeof R!="number"&&typeof R!="string")return A.error("Branch labels must be numbers or strings.");if(typeof R=="number"&&Math.abs(R)>Number.MAX_SAFE_INTEGER)return A.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof R=="number"&&Math.floor(R)!==R)return A.error("Numeric branch labels must be integer values.");if(s){if(A.checkSubtype(s,Yt(R)))return null}else s=Yt(R);if(d[String(R)]!==void 0)return A.error("Branch labels must be unique.");d[String(R)]=p.length}const D=r.parse(I,x,l);if(!D)return null;l=l||D.type,p.push(D)}const f=r.parse(e[1],1,it);if(!f)return null;const _=r.parse(e[e.length-1],e.length-1,l);return _?f.type.kind!=="value"&&r.concat(1).checkSubtype(s,f.type)?null:new Gs(s,l,f,d,p,_):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 Hs{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 _=r.parse(e[p+1],p+1,s);if(!_)return null;l.push([f,_]),s=s||_.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 Hs(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 Ws{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,it),l=r.parse(e[2],2,Ee);if(!s||!l)return null;if(!Q(s.type,[z(it),ot,it]))return r.error(`Expected first argument to be of type array or string, but found ${M(s.type)} instead`);if(e.length===4){const d=r.parse(e[3],3,Ee);return d?new Ws(s.type,s,l,d):null}return new Ws(s.type,s,l)}evaluate(e){const r=this.input.evaluate(e),s=this.beginIndex.evaluate(e);if(!te(r,["string","array"]))throw new Xt(`Expected first argument to be of type array or string, but found ${M(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 Xt("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,Ee);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],_=e[p+1],x=p,S=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(_,S,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 Vc(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Nc=fl;function fl(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}fl.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 jc=Vc(Nc);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 bt(l,d,p,f,!1)}case"hcl":{const[l,d,p,f]=i.hcl,[_,x,S,I]=e.hcl;let A,D;if(isNaN(l)||isNaN(_))isNaN(l)?isNaN(_)?A=NaN:(A=_,p!==1&&p!==0||(D=x)):(A=l,S!==1&&S!==0||(D=d));else{let oe=_-l;_>l&&oe>180?oe-=360:_<l&&l-_>180&&(oe+=360),A=l+r*oe}const[R,O,$,W]=function([oe,Y,ie,de]){return oe=isNaN(oe)?0:oe*We,Kt([ie,Math.cos(oe)*Y,Math.sin(oe)*Y,de])}([A,D??Hr(d,x,r),Hr(p,S,r),Hr(f,I,r)]);return new bt(R,O,$,W,!1)}case"lab":{const[l,d,p,f]=Kt(ps(i.lab,e.lab,r));return new bt(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 Xt(`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 Xt(`Cannot interpolate values containing mismatched anchors. from[${p}]: ${s[p]}, to[${p}]: ${l[p]}`);d.push(s[p]);const[f,_]=s[p+1],[x,S]=l[p+1];d.push([Hr(f,x,r),Hr(_,S,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 jc(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(S=>typeof S!="number"||S<0||S>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,Ee),!d)return null;const f=[];let _=null;s==="interpolate-hcl"||s==="interpolate-lab"?_=Ai:r.expectedType&&r.expectedType.kind!=="value"&&(_=r.expectedType);for(let x=0;x<p.length;x+=2){const S=p[x],I=p[x+1],A=x+3,D=x+4;if(typeof S!="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]>=S)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',A);const R=r.parse(I,D,_);if(!R)return null;_=_||R.type,f.push([S,R])}return ne(_,Ee)||ne(_,Ai)||ne(_,qr)||ne(_,G)||ne(_,z(Ee))?new Ui(_,s,l,d,f):r.error(`Type ${M(_)} 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]),_=s[p].evaluate(e),x=s[p+1].evaluate(e);switch(this.operator){case"interpolate":return ji[this.type.kind](_,x,f);case"interpolate-hcl":return ji.color(_,x,f,"hcl");case"interpolate-lab":return ji.color(_,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 _=r.parse(f,1+d.length,s,void 0,{typeAnnotation:"omit"});if(!_)return null;s=s||_.type,d.push(_)}if(!s)throw new Error("No output type");const p=l&&d.some(f=>q(l,f.type));return new Xs(p?it: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 ui&&!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 ml(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function gl(i,e,r,s){return s.compare(e,r)===0}function hn(i,e,r){const s=i!=="=="&&i!=="!=";return class Ip{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 _=p.parse(d[1],1,it);if(!_)return null;if(!ml(f,_.type))return p.concat(1).error(`"${f}" comparisons are not supported for type '${M(_.type)}'.`);let x=p.parse(d[2],2,it);if(!x)return null;if(!ml(f,x.type))return p.concat(2).error(`"${f}" comparisons are not supported for type '${M(x.type)}'.`);if(_.type.kind!==x.type.kind&&_.type.kind!=="value"&&x.type.kind!=="value")return p.error(`Cannot compare types '${M(_.type)}' and '${M(x.type)}'.`);s&&(_.type.kind==="value"&&x.type.kind!=="value"?_=new Wi(x.type,[_]):_.type.kind!=="value"&&x.type.kind==="value"&&(x=new Wi(_.type,[x])));let S=null;if(d.length===4){if(_.type.kind!=="string"&&x.type.kind!=="string"&&_.type.kind!=="value"&&x.type.kind!=="value")return p.error("Cannot use collator to compare non-string types.");if(S=p.parse(d[3],3,mr),!S)return null}return new Ip(_,x,S)}evaluate(d){const p=this.lhs.evaluate(d),f=this.rhs.evaluate(d);if(s&&this.hasUntypedArgument){const _=Yt(p),x=Yt(f);if(_.kind!==x.kind||_.kind!=="string"&&_.kind!=="number")throw new Xt(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${_.kind}, ${x.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const _=Yt(p),x=Yt(f);if(_.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 _l=hn("==",function(i,e,r){return e===r},gl),Uc=hn("!=",function(i,e,r){return e!==r},function(i,e,r,s){return!gl(0,e,r,s)}),$c=hn("<",function(i,e,r){return e<r},function(i,e,r,s){return s.compare(e,r)<0}),yl=hn(">",function(i,e,r){return e>r},function(i,e,r,s){return s.compare(e,r)>0}),xl=hn("<=",function(i,e,r){return e<=r},function(i,e,r,s){return s.compare(e,r)<=0}),qc=hn(">=",function(i,e,r){return e>=r},function(i,e,r,s){return s.compare(e,r)>=0});class Js{constructor(e,r,s){this.type=mr,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,ot),!p)?null:new Js(l,d,p)}evaluate(e){return new Uo(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 Go{constructor(e,r,s,l,d){this.type=ot,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,Ee);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,ot),!d))return null;let p=null;if(l.currency&&(p=r.parse(l.currency,1,ot),!p))return null;let f=null;if(l["min-fraction-digits"]&&(f=r.parse(l["min-fraction-digits"],1,Ee),!f))return null;let _=null;return l["max-fraction-digits"]&&(_=r.parse(l["max-fraction-digits"],1,Ee),!_)?null:new Go(s,d,p,f,_)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class Ks{constructor(e){this.type=Ar,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 _=null;if(f["font-scale"]&&(_=r.parse(f["font-scale"],1,Ee),!_))return null;let x=null;if(f["text-font"]&&(x=r.parse(f["text-font"],1,z(ot)),!x))return null;let S=null;if(f["text-color"]&&(S=r.parse(f["text-color"],1,Ai),!S))return null;const I=l[l.length-1];I.scale=_,I.font=x,I.textColor=S}else{const _=r.parse(e[p],1,it);if(!_)return null;const x=_.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:_,scale:null,font:null,textColor:null})}}return new Ks(l)}evaluate(e){return new Oi(this.sections.map(r=>{const s=r.content.evaluate(e);return Yt(s)===gr?new $o("",s,null,null,null):new $o(Cr(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 Ho{constructor(e){this.type=gr,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const s=r.parse(e[1],1,ot);return s?new Ho(s):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),s=ui.fromString(r);return s&&e.availableImages&&(s.available=e.availableImages.indexOf(r)>-1),s}eachChild(e){e(this.input)}outputDefined(){return!1}}class Wo{constructor(e){this.type=Ee,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 ${M(s.type)} instead.`):new Wo(s):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new Xt(`Expected value to be of type string or array, but found ${M(Yt(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const _r=8192;function Xo(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*_r),Math.round(s*l*_r)]}function zn(i,e){const r=Math.pow(2,e.z);return[(l=(i[0]/_r+e.x)/r,360*l-180),(s=(i[1]/_r+e.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90)];var s,l}function dt(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 Zc(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 Ys(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&&!(!bl(i,e,r,s)||!bl(r,s,i,e));var l,d}function Gc(i,e,r){for(const s of r)for(let l=0;l<s.length-1;++l)if(Ys(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 _=0;_<f.length-1;_++){if(Zc(i,f[_],f[_+1]))return r;(d=f[_])[1]>(l=i)[1]!=(p=f[_+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 Hc(i,e){for(const r of e)if(Dn(i,r))return!0;return!1}function vl(i,e){for(const r of i)if(!Dn(r,e))return!1;for(let r=0;r<i.length-1;++r)if(Gc(i[r],i[r+1],e))return!1;return!0}function Wc(i,e){for(const r of e)if(vl(i,r))return!0;return!1}function bl(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 Jo(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=Xo(i[l][p],r);dt(e,f),d.push(f)}s.push(d)}return s}function wl(i,e,r){const s=[];for(let l=0;l<i.length;l++){const d=Jo(i[l],e,r);s.push(d)}return s}function Sl(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}dt(e,i)}function Tl(i,e,r,s){const l=Math.pow(2,s.z)*_r,d=[s.x*_r,s.y*_r],p=[];for(const f of i)for(const _ of f){const x=[_.x+d[0],_.y+d[1]];Sl(x,e,r,l),p.push(x)}return p}function Il(i,e,r,s){const l=Math.pow(2,s.z)*_r,d=[s.x*_r,s.y*_r],p=[];for(const _ of i){const x=[];for(const S of _){const I=[S.x+d[0],S.y+d[1]];dt(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 _ of p)for(const x of _)Sl(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(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=Jo(s.coordinates,d,p),_=Tl(r.geometry(),l,d,p);if(!ms(l,d))return!1;for(const x of _)if(!Dn(x,f))return!1}if(s.type==="MultiPolygon"){const f=wl(s.coordinates,d,p),_=Tl(r.geometry(),l,d,p);if(!ms(l,d))return!1;for(const x of _)if(!Hc(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=Jo(s.coordinates,d,p),_=Il(r.geometry(),l,d,p);if(!ms(l,d))return!1;for(const x of _)if(!vl(x,f))return!1}if(s.type==="MultiPolygon"){const f=wl(s.coordinates,d,p),_=Il(r.geometry(),l,d,p);if(!ms(l,d))return!1;for(const x of _)if(!Wc(x,f))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Pl=class{constructor(i=[],e=Xc){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 Xc(i,e){return i<e?-1:i>e?1:0}function Jc(i,e,r,s,l){kl(i,e,r,s||i.length-1,l||Kc)}function kl(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),_=.5*Math.exp(2*f/3),x=.5*Math.sqrt(f*_*(d-_)/d)*(p-d/2<0?-1:1);kl(i,e,Math.max(r,Math.floor(e-p*_/d+x)),Math.min(s,Math.floor(e+(d-p)*_/d+x)),l)}var S=i[e],I=r,A=s;for(gs(i,r,e),l(i[s],S)>0&&gs(i,r,s);I<A;){for(gs(i,I,A),I++,A--;l(i[I],S)<0;)I++;for(;l(i[A],S)>0;)A--}l(i[r],S)===0?gs(i,r,A):gs(i,++A,s),A<=e&&(r=A+1),e<=A&&(s=A-1)}}function gs(i,e,r){var s=i[e];i[e]=i[r],i[r]=s}function Kc(i,e){return i<e?-1:i>e?1:0}function Qs(i,e){if(i.length<=1)return[i];const r=[];let s,l;for(const d of i){const p=Qc(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||(Jc(r[d],e,1,r[d].length-1,Yc),r[d]=r[d].slice(0,e));return r}function Yc(i,e){return e.area-i.area}function Qc(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 El=1/298.257223563,Al=El*(2-El),Cl=Math.PI/180;class Ko{constructor(e){const r=6378.137*Cl*1e3,s=Math.cos(e*Cl),l=1/(1-Al*(1-s*s)),d=Math.sqrt(l);this.kx=r*d*s,this.ky=r*d*l*(1-Al)}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 _=0;_<e.length-1;_++){let x=e[_][0],S=e[_][1],I=this.wrap(e[_+1][0]-x)*this.kx,A=(e[_+1][1]-S)*this.ky,D=0;I===0&&A===0||(D=(this.wrap(r[0]-x)*this.kx*I+(r[1]-S)*this.ky*A)/(I*I+A*A),D>1?(x=e[_+1][0],S=e[_+1][1]):D>0&&(x+=I/this.kx*D,S+=A/this.ky*D)),I=this.wrap(r[0]-x)*this.kx,A=(r[1]-S)*this.ky;const R=I*I+A*A;R<f&&(f=R,s=x,l=S,d=_,p=D)}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 Ml(i,e){return e[0]-i[0]}function eo(i){return i[1]-i[0]+1}function Mr(i,e){return i[1]>=i[0]&&i[1]<e}function _s(i,e){if(i[0]>i[1])return[null,null];const r=eo(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 Yo(i,e){if(!Mr(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)dt(r,i[s]);return r}function Qo(i){const e=[1/0,1/0,-1/0,-1/0];for(const r of i)for(const s of r)dt(e,s);return e}function zl(i){return i[0]!==-1/0&&i[1]!==-1/0&&i[2]!==1/0&&i[3]!==1/0}function ea(i,e,r){if(!zl(i)||!zl(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 Et(i,e,r){const s=r.pointOnLine(e,i);return r.distance(i,s.point)}function ta(i,e,r,s,l){const d=Math.min(Et(i,[r,s],l),Et(e,[r,s],l)),p=Math.min(Et(r,[i,e],l),Et(s,[i,e],l));return Math.min(d,p)}function ht(i,e,r,s,l){if(!Mr(e,i.length)||!Mr(s,r.length))return 1/0;let d=1/0;for(let p=e[0];p<e[1];++p){const f=i[p],_=i[p+1];for(let x=s[0];x<s[1];++x){const S=r[x],I=r[x+1];if(Ys(f,_,S,I))return 0;d=Math.min(d,ta(f,_,S,I,l))}}return d}function ia(i,e,r,s,l){if(!Mr(e,i.length)||!Mr(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 Vt(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,Et(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 zt(i,e,r,s){if(!Mr(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 _ of r)for(let x=0,S=_.length,I=S-1;x<S;I=x++){const A=_[I],D=_[x];if(Ys(p,f,A,D))return 0;l=Math.min(l,ta(p,f,A,D,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 Dl(i,e,r,s=1/0){const l=Qo(i),d=Qo(e);if(s!==1/0&&ea(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 _=0,x=f.length,S=x-1;_<x;S=_++){const I=f[S],A=f[_];for(const D of e)for(let R=0,O=D.length,$=O-1;R<O;$=R++){const W=D[$],oe=D[R];if(Ys(I,A,W,oe))return 0;p=Math.min(p,ta(I,A,W,oe,r))}}return p}function ra(i,e,r,s,l,d){if(!d)return;const p=ea(Yo(s,d),l,r);p<e&&i.push([p,d,[0,0]])}function to(i,e,r,s,l,d,p){if(!d||!p)return;const f=ea(Yo(s,d),Yo(l,p),r);f<e&&i.push([f,d,p])}function io(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 Pl([[0,[0,i.length-1],[0,0]]],Ml),f=Qo(r);for(;p.length>0;){const _=p.pop();if(_[0]>=d)continue;const x=_[1],S=e?50:100;if(eo(x)<=S){if(!Mr(x,i.length))return NaN;if(e){const I=zt(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=Vt(i[I],r,s);if(d=Math.min(d,A),d===0)return 0}}else{const I=_s(x,e);ra(p,d,s,i,f,I[0]),ra(p,d,s,i,f,I[1])}}return d}function ro(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 Pl([[0,[0,i.length-1],[0,r.length-1]]],Ml);for(;f.length>0;){const _=f.pop();if(_[0]>=p)continue;const x=_[1],S=_[2],I=e?50:100,A=s?50:100;if(eo(x)<=I&&eo(S)<=A){if(!Mr(x,i.length)&&Mr(S,r.length))return NaN;let D;if(e&&s)D=ht(i,x,r,S,l),p=Math.min(p,D);else if(e&&!s){const R=i.slice(x[0],x[1]+1);for(let O=S[0];O<=S[1];++O)if(D=Et(r[O],R,l),p=Math.min(p,D),p===0)return p}else if(!e&&s){const R=r.slice(S[0],S[1]+1);for(let O=x[0];O<=x[1];++O)if(D=Et(i[O],R,l),p=Math.min(p,D),p===0)return p}else D=ia(i,x,r,S,l),p=Math.min(p,D)}else{const D=_s(x,e),R=_s(S,s);to(f,p,l,i,r,D[0],R[0]),to(f,p,l,i,r,D[0],R[1]),to(f,p,l,i,r,D[1],R[0]),to(f,p,l,i,r,D[1],R[1])}}return p}function na(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 Wr{constructor(e,r){this.type=Ee,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 Wr(s,s.features.map(l=>na(l.geometry)).flat());if(s.type==="Feature")return new Wr(s,na(s.geometry));if("type"in s&&"coordinates"in s)return new Wr(s,na(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(_=>zn([_.x,_.y],r.canonical));if(l.length===0)return NaN;const p=new Ko(d[0][1]);let f=1/0;for(const _ of s){switch(_.type){case"Point":f=Math.min(f,ro(d,!1,[_.coordinates],!1,p,f));break;case"LineString":f=Math.min(f,ro(d,!1,_.coordinates,!0,p,f));break;case"Polygon":f=Math.min(f,io(d,!1,_.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(_=>zn([_.x,_.y],r.canonical));if(l.length===0)return NaN;const p=new Ko(d[0][1]);let f=1/0;for(const _ of s){switch(_.type){case"Point":f=Math.min(f,ro(d,!0,[_.coordinates],!1,p,f));break;case"LineString":f=Math.min(f,ro(d,!0,_.coordinates,!0,p,f));break;case"Polygon":f=Math.min(f,io(d,!0,_.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=Qs(l,0).map(_=>_.map(x=>x.map(S=>zn([S.x,S.y],r.canonical)))),p=new Ko(d[0][0][0][1]);let f=1/0;for(const _ of s)for(const x of d){switch(_.type){case"Point":f=Math.min(f,io([_.coordinates],!1,x,p,f));break;case"LineString":f=Math.min(f,io(_.coordinates,!0,x,p,f));break;case"Polygon":f=Math.min(f,Dl(x,_.coordinates,p,f))}if(f===0)return f}return f}(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const dn={"==":_l,"!=":Uc,">":yl,"<":$c,">=":qc,"<=":xl,array:Wi,at:Zo,boolean:Wi,case:Hs,coalesce:Xs,collator:Js,format:Ks,image:Ho,in:us,"index-of":Zs,interpolate:Ui,"interpolate-hcl":Ui,"interpolate-lab":Ui,length:Wo,let:yt,literal:cn,match:Gs,number:Wi,"number-format":Go,object:Wi,slice:Ws,step:Mn,string:Wi,"to-boolean":Zr,"to-color":Zr,"to-number":Zr,"to-string":Zr,var:qs,within:un,distance:Wr};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 _=null;for(const[x,S]of f){_=new Gr(r.registry,so,r.path,null,r.scope);const I=[];let A=!1;for(let D=1;D<e.length;D++){const R=e[D],O=Array.isArray(x)?x[D-1]:x.type,$=_.parse(R,1+I.length,O);if(!$){A=!0;break}I.push($)}if(!A)if(Array.isArray(x)&&x.length!==I.length)_.error(`Expected ${x.length} arguments, but found ${I.length} instead.`);else{for(let D=0;D<I.length;D++){const R=Array.isArray(x)?x[D]:x.type,O=I[D];_.concat(D+1).checkSubtype(R,O.type)}if(_.errors.length===0)return new $i(s,d,S,I)}}if(f.length===1)r.errors.push(..._.errors);else{const x=(f.length?f:p).map(([I])=>{return A=I,Array.isArray(A)?`(${A.map(M).join(", ")})`:`(${M(A.type)}...)`;var A}).join(" | "),S=[];for(let I=1;I<e.length;I++){const A=r.parse(e[I],1+S.length);if(!A)return null;S.push(M(A.type))}r.error(`Expected arguments of type ${x}, but found (${S.join(", ")}) instead.`)}return null}static register(e,r){$i.definitions=r;for(const s in r)e[s]=$i}}function sa(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=Us(e,r,s,d);if(p)throw new Xt(p);return new bt(e/255,r/255,s/255,d,!1)}function no(i,e){return i in e}function oa(i,e){const r=e[i];return r===void 0?null:r}function pn(i){return{type:i}}function so(i){if(i instanceof qs)return so(i.boundExpression);if(i instanceof $i&&i.name==="error"||i instanceof Js||i instanceof un||i instanceof Wr)return!1;const e=i instanceof Zr||i instanceof Wi;let r=!0;return i.eachChild(s=>{r=e?r&&so(s):r&&s instanceof cn}),!!r&&oo(i)&&ao(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function oo(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 Wr)return!1;let e=!0;return i.eachChild(r=>{e&&!oo(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 ao(i,e){if(i instanceof $i&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(s=>{r&&!ao(s,e)&&(r=!1)}),r}function Ll(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 aa(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function Rn(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 vs(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Rl(i){return i}function Bl(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 S=r?bt.parse:Vi.parse;(i=pr({},i)).stops&&(i.stops=i.stops.map(I=>[I[0],S(I[1])])),i.default=S(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,_,x;if(d==="exponential")f=la;else if(d==="interval")f=co;else if(d==="categorical"){f=lo,_=Object.create(null);for(const S of i.stops)_[S[0]]=S[1];x=typeof i.stops[0][0]}else{if(d!=="identity")throw new Error(`Unknown function type "${d}"`);f=ca}if(s){const S={},I=[];for(let R=0;R<i.stops.length;R++){const O=i.stops[R],$=O[0].zoom;S[$]===void 0&&(S[$]={zoom:$,type:i.type,property:i.property,default:i.default,stops:[]},I.push($)),S[$].stops.push([O[0].value,O[1]])}const A=[];for(const R of I)A.push([S[R].zoom,Bl(S[R],e)]);const D={name:"linear"};return{kind:"composite",interpolationType:D,interpolationFactor:Ui.interpolationFactor.bind(void 0,D),zoomStops:A.map(R=>R[0]),evaluate:({zoom:R},O)=>la({stops:A,base:i.base},e,R).evaluate(R,O)}}if(l){const S=d==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:S,interpolationFactor:Ui.interpolationFactor.bind(void 0,S),zoomStops:i.stops.map(I=>I[0]),evaluate:({zoom:I})=>f(i,e,I,_,x)}}return{kind:"source",evaluate(S,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,_,x)}}}function mn(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function lo(i,e,r,s,l){return mn(typeof r===l?s[r]:void 0,i.default,e.default)}function co(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=ds(i.stops.map(d=>d[0]),r);return i.stops[l][1]}function la(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=ds(i.stops.map(S=>S[0]),r),p=function(S,I,A,D){const R=D-A,O=S-A;return R===0?0:I===1?O/R:(Math.pow(I,O)-1)/(Math.pow(I,R)-1)}(r,s,i.stops[d][0],i.stops[d+1][0]),f=i.stops[d][1],_=i.stops[d+1][1],x=ji[e.type]||Rl;return typeof f.evaluate=="function"?{evaluate(...S){const I=f.evaluate.apply(void 0,S),A=_.evaluate.apply(void 0,S);if(I!==void 0&&A!==void 0)return x(I,A,p,i.colorSpace)}}:x(f,_,p,i.colorSpace)}function ca(i,e,r){switch(e.type){case"color":r=bt.parse(r);break;case"formatted":r=Oi.fromString(r.toString());break;case"resolvedImage":r=ui.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"},[ot],(i,[e])=>{throw new Xt(e.evaluate(i))}],typeof:[ot,[it],(i,[e])=>M(Yt(e.evaluate(i)))],"to-rgba":[z(Ee,4),[Ai],(i,[e])=>{const[r,s,l,d]=e.evaluate(i).rgb;return[255*r,255*s,255*l,d]}],rgb:[Ai,[Ee,Ee,Ee],sa],rgba:[Ai,[Ee,Ee,Ee,Ee],sa],has:{type:Ye,overloads:[[[ot],(i,[e])=>no(e.evaluate(i),i.properties())],[[ot,er],(i,[e,r])=>no(e.evaluate(i),r.evaluate(i))]]},get:{type:it,overloads:[[[ot],(i,[e])=>oa(e.evaluate(i),i.properties())],[[ot,er],(i,[e,r])=>oa(e.evaluate(i),r.evaluate(i))]]},"feature-state":[it,[ot],(i,[e])=>oa(e.evaluate(i),i.featureState||{})],properties:[er,[],i=>i.properties()],"geometry-type":[ot,[],i=>i.geometryType()],id:[it,[],i=>i.id()],zoom:[Ee,[],i=>i.globals.zoom],"heatmap-density":[Ee,[],i=>i.globals.heatmapDensity||0],"line-progress":[Ee,[],i=>i.globals.lineProgress||0],accumulated:[it,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Ee,pn(Ee),(i,e)=>{let r=0;for(const s of e)r+=s.evaluate(i);return r}],"*":[Ee,pn(Ee),(i,e)=>{let r=1;for(const s of e)r*=s.evaluate(i);return r}],"-":{type:Ee,overloads:[[[Ee,Ee],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[Ee],(i,[e])=>-e.evaluate(i)]]},"/":[Ee,[Ee,Ee],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[Ee,[Ee,Ee],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[Ee,[],()=>Math.LN2],pi:[Ee,[],()=>Math.PI],e:[Ee,[],()=>Math.E],"^":[Ee,[Ee,Ee],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[Ee,[Ee],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[Ee,[Ee],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[Ee,[Ee],(i,[e])=>Math.log(e.evaluate(i))],log2:[Ee,[Ee],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[Ee,[Ee],(i,[e])=>Math.sin(e.evaluate(i))],cos:[Ee,[Ee],(i,[e])=>Math.cos(e.evaluate(i))],tan:[Ee,[Ee],(i,[e])=>Math.tan(e.evaluate(i))],asin:[Ee,[Ee],(i,[e])=>Math.asin(e.evaluate(i))],acos:[Ee,[Ee],(i,[e])=>Math.acos(e.evaluate(i))],atan:[Ee,[Ee],(i,[e])=>Math.atan(e.evaluate(i))],min:[Ee,pn(Ee),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[Ee,pn(Ee),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[Ee,[Ee],(i,[e])=>Math.abs(e.evaluate(i))],round:[Ee,[Ee],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Ee,[Ee],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[Ee,[Ee],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[Ye,[ot,it],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[Ye,[it],(i,[e])=>i.id()===e.value],"filter-type-==":[Ye,[ot],(i,[e])=>i.geometryType()===e.value],"filter-<":[Ye,[ot,it],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s<l}],"filter-id-<":[Ye,[it],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r<s}],"filter->":[Ye,[ot,it],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>l}],"filter-id->":[Ye,[it],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>s}],"filter-<=":[Ye,[ot,it],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s<=l}],"filter-id-<=":[Ye,[it],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r<=s}],"filter->=":[Ye,[ot,it],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>=l}],"filter-id->=":[Ye,[it],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>=s}],"filter-has":[Ye,[it],(i,[e])=>e.value in i.properties()],"filter-has-id":[Ye,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Ye,[z(ot)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[Ye,[z(it)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[Ye,[ot,z(it)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[Ye,[ot,z(it)],(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,[ot],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[ot,[ot],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[ot,[ot],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[ot,pn(it),(i,e)=>e.map(r=>Cr(r.evaluate(i))).join("")],"resolved-locale":[ot,[mr],(i,[e])=>e.evaluate(i).resolvedLocale()]});class ho{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 bt(0,0,0,0):s.type==="color"?bt.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 Xt(`Expected value to be one of ${Object.keys(this._enumValues).map(_=>JSON.stringify(_)).join(", ")}, but found ${JSON.stringify(f)} instead.`);return f}catch(f){return this._warningHistory[f.message]||(this._warningHistory[f.message]=!0,typeof console<"u"&&console.warn(f.message)),this._defaultValue}}}function 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,so,[],e?function(l){const d={color:Ai,string:ot,number:Ee,enum:ot,boolean:Ye,formatted:Ar,padding:qr,resolvedImage:gr,variableAnchorOffsetCollection:G};return l.type==="array"?z(d[l.value]||it,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?Ll(new ho(s,e)):Ln(r.errors)}class ha{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 ua{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 Fl(i,e){const r=gn(i,e);if(r.result==="error")return r;const s=r.value.expression,l=oo(s);if(!l&&!fn(e))return Ln([new Si("","data expressions not supported")]);const d=ao(s,["zoom"]);if(!d&&!aa(e))return Ln([new Si("","zoom expressions not supported")]);const p=po(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')]):Ll(p?new ua(l?"camera":"composite",r.value,p.labels,p instanceof Ui?p.interpolation:void 0):new ha(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 uo{constructor(e,r){this._parameters=e,this._specification=r,pr(this,Bl(this._parameters,this._specification))}static deserialize(e){return new uo(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function po(i){let e=null;if(i instanceof yt)e=po(i.result);else if(i instanceof Xs){for(const r of i.args)if(e=po(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=po(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 fo={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=mo(i));const e=gn(i,fo);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:da(i)}}function ws(i,e){return i<e?-1:i>e?1:0}function da(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(da(i[e]))return!0;return!1}function mo(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?pa(i[1],i[2],"=="):e==="!="?On(pa(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?pa(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(mo))):e==="all"?["all"].concat(i.slice(1).map(mo)):e==="none"?["all"].concat(i.slice(1).map(mo).map(On)):e==="in"?Fn(i[1],i.slice(2)):e==="!in"?On(Fn(i[1],i.slice(2))):e==="has"?fa(i[1]):e!=="!has"||On(fa(i[1]));var r}function pa(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 fa(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function On(i){return["!",i]}function ma(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+=`${ma(d)},`;return`${l}]`}const r=Object.keys(i).sort();let s="{";for(let l=0;l<r.length;l++)s+=`${JSON.stringify(r[l])}:${ma(i[r[l]])},`;return`${s}}`}function ga(i){let e="";for(const r of ln)e+=`/${ma(i[r])}`;return e}function Ol(i){const e=i.value;return e?[new Ie(i.key,e,"constants have been deprecated as of v8")]:[]}function Dt(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 Dt(i)}function Ci(i){const e=i.key,r=i.value,s=i.valueSpec||{},l=i.objectElementValidators||{},d=i.style,p=i.styleSpec,f=i.validateSpec;let _=[];const x=mt(r);if(x!=="object")return[new Ie(e,r,`object expected, ${x} found`)];for(const S in r){const I=S.split(".")[0],A=s[I]||s["*"];let D;if(l[I])D=l[I];else if(s[I])D=f;else if(l["*"])D=l["*"];else{if(!s["*"]){_.push(new Ie(e,r[S],`unknown property "${S}"`));continue}D=f}_=_.concat(D({key:(e&&`${e}.`)+S,value:r[S],valueSpec:A,style:d,styleSpec:p,object:r,objectKey:S,validateSpec:f},r))}for(const S in s)l[S]||s[S].required&&s[S].default===void 0&&r[S]===void 0&&_.push(new Ie(e,r,`missing required property "${S}"`));return _}function go(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 Ie(d,e,`array expected, ${mt(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),mt(r.value)==="object"&&(f=r.value);let _=[];for(let x=0;x<e.length;x++)_=_.concat(p({array:e,arrayIndex:x,value:e[x],valueSpec:f,validateSpec:i.validateSpec,style:s,styleSpec:l,key:`${d}[${x}]`}));return _}function Ss(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 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 _a(i){const e=i.valueSpec,r=Dt(i.value.type);let s,l,d,p={};const f=r!=="categorical"&&i.value.property===void 0,_=!f,x=mt(i.value.stops)==="array"&&mt(i.value.stops[0])==="array"&&mt(i.value.stops[0][0])==="object",S=Ci({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(D){if(r==="identity")return[new Ie(D.key,D.value,'identity function may not have a "stops" property')];let R=[];const O=D.value;return R=R.concat(go({key:D.key,value:O,valueSpec:D.valueSpec,validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec,arrayElementValidator:I})),mt(O)==="array"&&O.length===0&&R.push(new Ie(D.key,O,"array must have at least one stop")),R},default:function(D){return D.validateSpec({key:D.key,value:D.value,valueSpec:e,validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec})}}});return r==="identity"&&f&&S.push(new Ie(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||S.push(new Ie(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!Rn(i.valueSpec)&&S.push(new Ie(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(_&&!fn(i.valueSpec)?S.push(new Ie(i.key,i.value,"property functions not supported")):f&&!aa(i.valueSpec)&&S.push(new Ie(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!x||i.value.property!==void 0||S.push(new Ie(i.key,i.value,'"property" property is required')),S;function I(D){let R=[];const O=D.value,$=D.key;if(mt(O)!=="array")return[new Ie($,O,`array expected, ${mt(O)} found`)];if(O.length!==2)return[new Ie($,O,`array length 2 expected, length ${O.length} found`)];if(x){if(mt(O[0])!=="object")return[new Ie($,O,`object expected, ${mt(O[0])} found`)];if(O[0].zoom===void 0)return[new Ie($,O,"object stop key must have zoom")];if(O[0].value===void 0)return[new Ie($,O,"object stop key must have value")];if(d&&d>Dt(O[0].zoom))return[new Ie($,O[0].zoom,"stop zoom values must appear in ascending order")];Dt(O[0].zoom)!==d&&(d=Dt(O[0].zoom),l=void 0,p={}),R=R.concat(Ci({key:`${$}[0]`,value:O[0],valueSpec:{zoom:{}},validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec,objectElementValidators:{zoom:Ss,value:A}}))}else R=R.concat(A({key:`${$}[0]`,value:O[0],valueSpec:{},validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec},O));return bs(_n(O[1]))?R.concat([new Ie(`${$}[1]`,O[1],"expressions are not allowed in function stops.")]):R.concat(D.validateSpec({key:`${$}[1]`,value:O[1],valueSpec:e,validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec}))}function A(D,R){const O=mt(D.value),$=Dt(D.value),W=D.value!==null?D.value:R;if(s){if(O!==s)return[new Ie(D.key,W,`${O} stop domain type must match previous stop domain type ${s}`)]}else s=O;if(O!=="number"&&O!=="string"&&O!=="boolean")return[new Ie(D.key,W,"stop domain value must be a number, string, or boolean")];if(O!=="number"&&r!=="categorical"){let oe=`number expected, ${O} found`;return fn(e)&&r===void 0&&(oe+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ie(D.key,W,oe)]}return r!=="categorical"||O!=="number"||isFinite($)&&Math.floor($)===$?r!=="categorical"&&O==="number"&&l!==void 0&&$<l?[new Ie(D.key,W,"stop domain values must appear in ascending order")]:(l=$,r==="categorical"&&$ in p?[new Ie(D.key,W,"stop domain values must be unique")]:(p[$]=!0,[])):[new Ie(D.key,W,`integer expected, found ${$}`)]}}function yn(i){const e=(i.expressionContext==="property"?Fl: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(!ao(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"&&!oo(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(Dt(r))===-1&&l.push(new Ie(e,r,`expected one of [${s.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(s.values).indexOf(Dt(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(pr({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Ps(i)}function Ps(i){const e=i.value,r=i.key;if(mt(e)!=="array")return[new Ie(r,e,`array expected, ${mt(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})),Dt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Dt(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=mt(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=mt(e[p]),Dt(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=mt(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 ya(i,e){const r=i.key,s=i.validateSpec,l=i.style,d=i.styleSpec,p=i.value,f=i.objectKey,_=d[`${e}_${i.layerType}`];if(!_)return[];const x=f.match(/^(.*)-transition$/);if(e==="paint"&&x&&_[x[1]]&&_[x[1]].transition)return s({key:r,value:p,valueSpec:d.transition,style:l,styleSpec:d});const S=i.valueSpec||_[f];if(!S)return[new Ie(r,p,`unknown property "${f}"`)];let I;if(mt(p)==="string"&&fn(S)&&!S.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 A=[];return i.layerType==="symbol"&&(f==="text-field"&&l&&!l.glyphs&&A.push(new Ie(r,p,'use of "text-field" requires a style "glyphs" property')),f==="text-font"&&vs(_n(p))&&Dt(p.type)==="identity"&&A.push(new Ie(r,p,'"text-font" does not support identity functions'))),A.concat(s({key:i.key,value:p,valueSpec:S,style:l,styleSpec:d,expressionContext:"property",propertyType:e,propertyKey:f}))}function xa(i){return ya(i,"paint")}function va(i){return ya(i,"layout")}function ba(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=Dt(r.type);const f=Dt(r.ref);if(r.id){const _=Dt(r.id);for(let x=0;x<i.arrayIndex;x++){const S=l.layers[x];Dt(S.id)===_&&e.push(new Ie(s,r.id,`duplicate layer id "${r.id}", previously used at line ${S.id.__line__}`))}}if("ref"in r){let _;["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=>{Dt(x.id)===f&&(_=x)}),_?_.ref?e.push(new Ie(s,r.ref,"ref cannot reference another ref layer")):p=Dt(_.type):e.push(new Ie(s,r.ref,`ref layer "${f}" not found`))}else if(p!=="background")if(r.source){const _=l.sources&&l.sources[r.source],x=_&&Dt(_.type);_?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"&&_.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(Ci({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:_=>Ci({layer:r,key:_.key,value:_.value,style:_.style,styleSpec:_.styleSpec,validateSpec:_.validateSpec,objectElementValidators:{"*":x=>va(pr({layerType:p},x))}}),paint:_=>Ci({layer:r,key:_.key,value:_.value,style:_.style,styleSpec:_.styleSpec,validateSpec:_.validateSpec,objectElementValidators:{"*":x=>xa(pr({layerType:p},x))}})}})),e}function zr(i){const e=i.value,r=i.key,s=mt(e);return s!=="string"?[new Ie(r,e,`string expected, ${s} found`)]:[]}const wa={promoteId:function({key:i,value:e}){if(mt(e)==="string")return zr({key:i,value:e});{const r=[];for(const s in e)r.push(...zr({key:`${i}.${s}`,value:e[s]}));return r}}};function Vl(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=Dt(e.type);let f;switch(p){case"vector":case"raster":return f=Ci({key:r,value:e,valueSpec:s[`source_${p.replace("-","_")}`],style:i.style,styleSpec:s,objectElementValidators:wa,validateSpec:d}),f;case"raster-dem":return f=function(_){var x;const S=(x=_.sourceName)!==null&&x!==void 0?x:"",I=_.value,A=_.styleSpec,D=A.source_raster_dem,R=_.style;let O=[];const $=mt(I);if(I===void 0)return O;if($!=="object")return O.push(new Ie("source_raster_dem",I,`object expected, ${$} found`)),O;const W=Dt(I.encoding)==="custom",oe=["redFactor","greenFactor","blueFactor","baseShift"],Y=_.value.encoding?`"${_.value.encoding}"`:"Default";for(const ie in I)!W&&oe.includes(ie)?O.push(new Ie(ie,I[ie],`In "${S}": "${ie}" is only valid when "encoding" is set to "custom". ${Y} encoding found`)):D[ie]?O=O.concat(_.validateSpec({key:ie,value:I[ie],valueSpec:D[ie],validateSpec:_.validateSpec,style:R,styleSpec:A})):O.push(new Ie(ie,I[ie],`unknown property "${ie}"`));return O}({sourceName:r,value:e,style:i.style,styleSpec:s,validateSpec:d}),f;case"geojson":if(f=Ci({key:r,value:e,valueSpec:s.source_geojson,style:l,styleSpec:s,validateSpec:d,objectElementValidators:wa}),e.cluster)for(const _ in e.clusterProperties){const[x,S]=e.clusterProperties[_],I=typeof x=="string"?[x,["accumulated"],["get",_]]:x;f.push(...yn({key:`${r}.${_}.map`,value:S,validateSpec:d,expressionContext:"cluster-map"})),f.push(...yn({key:`${r}.${_}.reduce`,value:I,validateSpec:d,expressionContext:"cluster-reduce"}))}return f;case"video":return Ci({key:r,value:e,valueSpec:s.source_video,style:l,validateSpec:d,styleSpec:s});case"image":return Ci({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 Sa(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 Ie("light",e,`object expected, ${p} found`)]),d;for(const f in e){const _=f.match(/^(.*)-transition$/);d=d.concat(_&&s[_[1]]&&s[_[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 Nl(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 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 Ta(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 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 Ia(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(Ci({key:`${s}[${p}]`,value:r[p],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return e}return zr({key:s,value:r})}const Pa={"*":()=>[],array:go,boolean:function(i){const e=i.value,r=i.key,s=mt(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=mt(r);return s!=="string"?[new Ie(e,r,`color expected, ${s} found`)]:bt.parse(String(r))?[]:[new Ie(e,r,`color expected, "${r}" found`)]},constants:Ol,enum:Ts,filter:Is,function:_a,layer:ba,object:Ci,source:Vl,light:Sa,sky:Nl,terrain:Ta,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 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:zr,formatted:function(i){return zr(i).length===0?[]:yn(i)},resolvedImage:function(i){return zr(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 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=mt(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(go({key:`${e}[${p+1}]`,value:r[p+1],valueSpec:{length:2,value:"number"},validateSpec:i.validateSpec,style:i.style,styleSpec:l}));return d},sprite:Ia};function ks(i){const e=i.value,r=i.valueSpec,s=i.styleSpec;return i.validateSpec=ks,r.expression&&vs(Dt(e))?_a(i):r.expression&&bs(_n(e))?yn(i):r.type&&Pa[r.type]?Pa[r.type](i):Ci(pr({},i,{valueSpec:r.type?s[r.type]:r}))}function jl(i){const e=i.value,r=i.key,s=zr(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 Xi(i,e=ue){let r=[];return r=r.concat(ks({key:"",value:i,valueSpec:e.$root,styleSpec:e,style:i,validateSpec:ks,objectElementValidators:{glyphs:jl,"*":()=>[]}})),i.constants&&(r=r.concat(Ol({key:"constants",value:i.constants,style:i,styleSpec:e,validateSpec:ks}))),ka(r)}function tr(i){return function(e){return i({...e,validateSpec:ks})}}function ka(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function ir(i){return function(...e){return ka(i.apply(this,e))}}Xi.source=ir(tr(Vl)),Xi.sprite=ir(tr(Ia)),Xi.glyphs=ir(tr(jl)),Xi.light=ir(tr(Sa)),Xi.sky=ir(tr(Nl)),Xi.terrain=ir(tr(Ta)),Xi.layer=ir(tr(ba)),Xi.filter=ir(tr(Is)),Xi.paintProperty=ir(tr(xa)),Xi.layoutProperty=ir(tr(va));const Dr=Xi,eh=Dr.light,Ea=Dr.sky,th=Dr.paintProperty,ih=Dr.layoutProperty;function Aa(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 _=0;_<this.d*this.d;_++){const x=p[3+_],S=p[3+_+1];l.push(x===S?null:p.subarray(x,S))}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 _=[];return this._forEachCell(e,r,s,l,this._queryCell,_,{},d),_}}_queryCell(e,r,s,l,d,p,f,_){const x=this.cells[d];if(x!==null){const S=this.keys,I=this.bboxes;for(let A=0;A<x.length;A++){const D=x[A];if(f[D]===void 0){const R=4*D;(_?_(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[D]=!0,p.push(S[D])):f[D]=!1}}}}_forEachCell(e,r,s,l,d,p,f,_){const x=this._convertToCellCoord(e),S=this._convertToCellCoord(r),I=this._convertToCellCoord(s),A=this._convertToCellCoord(l);for(let D=x;D<=I;D++)for(let R=S;R<=A;R++){const O=this.d*R+D;if((!_||_(this._convertFromCellCoord(D),this._convertFromCellCoord(R),this._convertFromCellCoord(D+1),this._convertFromCellCoord(R+1)))&&d.call(this,e,r,s,l,O,p,f,_))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,r=3+this.cells.length+1+1;let 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 yr={};function Oe(i,e,r={}){if(yr[i])throw new Error(`${i} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),yr[i]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}Oe("Object",Object),Oe("TransferableGridIndex",Vn),Oe("Color",bt),Oe("Error",Error),Oe("AJAXError",Fi),Oe("ResolvedImage",ui),Oe("StylePropertyFunction",uo),Oe("StyleExpression",ho,{omit:["_evaluator"]}),Oe("ZoomDependentExpression",ua),Oe("ZoomConstantExpression",ha),Oe("CompoundExpression",$i,{omit:["_evaluate"]});for(const i in dn)dn[i]._classRegistryKey||Oe(`Expression_${i}`,dn[i]);function Ul(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 $l(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||Ul(i)||ur(i)||ArrayBuffer.isView(i)||i instanceof ImageData)}function Es(i,e){if($l(i))return(Ul(i)||ur(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(Es(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(!yr[r])throw new Error(`${r} is not registered.`);const{klass:s}=yr[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)||yr[r].omit.indexOf(d)>=0)continue;const p=i[d];l[d]=yr[r].shallow.indexOf(d)>=0?p:Es(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 xr(i){if($l(i))return i;if(Array.isArray(i))return i.map(xr);if(typeof i!="object")throw new Error("can't deserialize object of type "+typeof i);const e=Ca(i)||"Object";if(!yr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=yr[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]=yr[e].shallow.indexOf(l)>=0?d:xr(d)}return s}class ql{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 De={"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 Ma(i){for(const e of i)if(za(e.charCodeAt(0)))return!0;return!1}function rh(i){for(const e of i)if(!Zl(e.charCodeAt(0)))return!1;return!0}function Zl(i){return!(De.Arabic(i)||De["Arabic Supplement"](i)||De["Arabic Extended-A"](i)||De["Arabic Presentation Forms-A"](i)||De["Arabic Presentation Forms-B"](i))}function za(i){return!(i!==746&&i!==747&&(i<4352||!(De["Bopomofo Extended"](i)||De.Bopomofo(i)||De["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||De["CJK Compatibility Ideographs"](i)||De["CJK Compatibility"](i)||De["CJK Radicals Supplement"](i)||De["CJK Strokes"](i)||!(!De["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||De["CJK Unified Ideographs Extension A"](i)||De["CJK Unified Ideographs"](i)||De["Enclosed CJK Letters and Months"](i)||De["Hangul Compatibility Jamo"](i)||De["Hangul Jamo Extended-A"](i)||De["Hangul Jamo Extended-B"](i)||De["Hangul Jamo"](i)||De["Hangul Syllables"](i)||De.Hiragana(i)||De["Ideographic Description Characters"](i)||De.Kanbun(i)||De["Kangxi Radicals"](i)||De["Katakana Phonetic Extensions"](i)||De.Katakana(i)&&i!==12540||!(!De["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)||!(!De["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||De["Unified Canadian Aboriginal Syllabics"](i)||De["Unified Canadian Aboriginal Syllabics Extended"](i)||De["Vertical Forms"](i)||De["Yijing Hexagram Symbols"](i)||De["Yi Syllables"](i)||De["Yi Radicals"](i))))}function Gl(i){return!(za(i)||function(e){return!!(De["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||De["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)||De["Letterlike Symbols"](e)||De["Number Forms"](e)||De["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)||De["Control Pictures"](e)&&e!==9251||De["Optical Character Recognition"](e)||De["Enclosed Alphanumerics"](e)||De["Geometric Shapes"](e)||De["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||De["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||De["CJK Symbols and Punctuation"](e)||De.Katakana(e)||De["Private Use Area"](e)||De["CJK Compatibility Forms"](e)||De["Small Form Variants"](e)||De["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 Xr(i){return i>=1424&&i<=2303||De["Arabic Presentation Forms-A"](i)||De["Arabic Presentation Forms-B"](i)}function Hl(i,e){return!(!e&&Xr(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||De.Khmer(i))}function Da(i){for(const e of i)if(Xr(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 At{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 ql,this.transition={})}isSupportedScript(e){return function(r,s){for(const l of r)if(!Hl(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 _o{constructor(e,r){this.property=e,this.value=r,this.expression=function(s,l){if(vs(s))return new uo(s,l);if(bs(s)){const d=Fl(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=bt.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 _o(e,void 0)}transitioned(e,r){return new Wl(this.property,this.value,r,jt({},e.transition,this.transition),e.now)}untransitioned(){return new Wl(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 _o(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 La(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 La(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class Wl{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(_){if(_<=0)return 0;if(_>=1)return 1;const x=_*_,S=x*_;return 4*(_<.5?S:3*(_-x)+S-.75)}(f))}}return d}}class La{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,s){const l=new yo(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 _o(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 yo(this._properties);for(const d of Object.keys(this._values))l._values[d]=this._values[d].possiblyEvaluate(e,r,s);return l}}class vr{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 yo{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 vr(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 vr(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 vr(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 vr(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 vr(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 vr(this,{kind:"constant",value:d},r)}return new vr(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 At(Math.floor(r.zoom-1),r)),e.expression.evaluate(new At(Math.floor(r.zoom),r)),e.expression.evaluate(new At(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 _o(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 yo(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(ih,`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(th,`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 _=this._transitionablePaint._values[e].value;return _.isDataDriven()||p||d||this._handleOverridablePaintPropertyUpdate(e,f,_)}}_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),Or(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)&&Aa(this,e.call(Dr,{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 vr&&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 y{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 w(i,e=1){let r=0,s=0;return{members:i.map(l=>{const d=m[l.type].BYTES_PER_ELEMENT,p=r=k(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:k(r,Math.max(s,e)),alignment:e}}function k(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 F 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}}F.prototype.bytesPerElement=8,Oe("StructArrayLayout4i8",F);class N 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 _=6*e;return this.int16[_+0]=r,this.int16[_+1]=s,this.int16[_+2]=l,this.int16[_+3]=d,this.int16[_+4]=p,this.int16[_+5]=f,e}}N.prototype.bytesPerElement=12,Oe("StructArrayLayout2i4i12",N);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 _=4*e,x=8*e;return this.int16[_+0]=r,this.int16[_+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,_,x,S){const I=this.length;return this.resize(I+1),this.emplace(I,e,r,s,l,d,p,f,_,x,S)}emplace(e,r,s,l,d,p,f,_,x,S,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]=_,this.uint16[A+7]=x,this.uint16[A+8]=S,this.uint16[A+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,_,x,S,I,A){const D=this.length;return this.resize(D+1),this.emplace(D,e,r,s,l,d,p,f,_,x,S,I,A)}emplace(e,r,s,l,d,p,f,_,x,S,I,A,D){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]=_,this.uint16[R+7]=x,this.int16[R+8]=S,this.int16[R+9]=I,this.int16[R+10]=A,this.int16[R+11]=D,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 se 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,_,x){const S=this.length;return this.resize(S+1),this.emplace(S,e,r,s,l,d,p,f,_,x)}emplace(e,r,s,l,d,p,f,_,x,S){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]=_,this.uint16[I+8]=x,this.uint16[I+9]=S,e}}se.prototype.bytesPerElement=20,Oe("StructArrayLayout6i1ul2ui20",se);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 _=6*e;return this.int16[_+0]=r,this.int16[_+1]=s,this.int16[_+2]=l,this.int16[_+3]=d,this.int16[_+4]=p,this.int16[_+5]=f,e}}ce.prototype.bytesPerElement=12,Oe("StructArrayLayout2i2i2i12",ce);class _e 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,_=8*e;return this.float32[f+0]=r,this.float32[f+1]=s,this.float32[f+2]=l,this.int16[_+6]=d,this.int16[_+7]=p,e}}_e.prototype.bytesPerElement=16,Oe("StructArrayLayout2f1f2i16",_e);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 _=16*e,x=4*e,S=8*e;return this.uint8[_+0]=r,this.uint8[_+1]=s,this.float32[x+1]=l,this.float32[x+2]=d,this.int16[S+6]=p,this.int16[S+7]=f,e}}we.prototype.bytesPerElement=16,Oe("StructArrayLayout2ub2f2i16",we);class Le 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}}Le.prototype.bytesPerElement=6,Oe("StructArrayLayout3ui6",Le);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,_,x,S,I,A,D,R,O,$,W){const oe=this.length;return this.resize(oe+1),this.emplace(oe,e,r,s,l,d,p,f,_,x,S,I,A,D,R,O,$,W)}emplace(e,r,s,l,d,p,f,_,x,S,I,A,D,R,O,$,W,oe){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]=_,this.uint16[Y+10]=x,this.uint16[Y+11]=S,this.uint16[Y+12]=I,this.float32[ie+7]=A,this.float32[ie+8]=D,this.uint8[de+36]=R,this.uint8[de+37]=O,this.uint8[de+38]=$,this.uint32[ie+10]=W,this.int16[Y+22]=oe,e}}Be.prototype.bytesPerElement=48,Oe("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Be);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,_,x,S,I,A,D,R,O,$,W,oe,Y,ie,de,be,Re,Xe,Me,Ae,qe,Ne){const Fe=this.length;return this.resize(Fe+1),this.emplace(Fe,e,r,s,l,d,p,f,_,x,S,I,A,D,R,O,$,W,oe,Y,ie,de,be,Re,Xe,Me,Ae,qe,Ne)}emplace(e,r,s,l,d,p,f,_,x,S,I,A,D,R,O,$,W,oe,Y,ie,de,be,Re,Xe,Me,Ae,qe,Ne,Fe){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]=_,this.int16[me+7]=x,this.uint16[me+8]=S,this.uint16[me+9]=I,this.uint16[me+10]=A,this.uint16[me+11]=D,this.uint16[me+12]=R,this.uint16[me+13]=O,this.uint16[me+14]=$,this.uint16[me+15]=W,this.uint16[me+16]=oe,this.uint16[me+17]=Y,this.uint16[me+18]=ie,this.uint16[me+19]=de,this.uint16[me+20]=be,this.uint16[me+21]=Re,this.uint16[me+22]=Xe,this.uint32[Ge+12]=Me,this.float32[Ge+13]=Ae,this.float32[Ge+14]=qe,this.uint16[me+30]=Ne,this.uint16[me+31]=Fe,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 je 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}}je.prototype.bytesPerElement=12,Oe("StructArrayLayout1ui2f12",je);class tt 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}}tt.prototype.bytesPerElement=8,Oe("StructArrayLayout1ul2ui8",tt);class ke 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}}ke.prototype.bytesPerElement=4,Oe("StructArrayLayout2ui4",ke);class Ce 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}}Ce.prototype.bytesPerElement=2,Oe("StructArrayLayout1ui2",Ce);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,Oe("StructArrayLayout4f16",Qe);class Lt extends y{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)}}Lt.prototype.size=20;class st extends se{get(e){return new Lt(this,e)}}Oe("CollisionBoxArray",st);class ut extends y{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 Rt extends Be{get(e){return new ut(this,e)}}Oe("PlacedSymbolArray",Rt);class di extends y{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]}}di.prototype.size=64;class rr extends Se{get(e){return new di(this,e)}}Oe("SymbolInstanceArray",rr);class Bt extends Te{getoffsetX(e){return this.float32[1*e+0]}}Oe("GlyphOffsetArray",Bt);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 y{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 pi extends je{get(e){return new Ii(this,e)}}Oe("TextAnchorOffsetArray",pi);class fi extends y{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]}}fi.prototype.size=8;class nr extends tt{get(e){return new fi(this,e)}}Oe("FeatureIndexArray",nr);class xn extends E{}class xo extends E{}class Un extends E{}class vn extends N{}class vo extends Z{}class Ra extends U{}class oi extends H{}class sr extends K{}class Kr extends j{}class $n extends ee{}class mi extends ce{}class gi extends we{}class ri extends Le{}class Nt extends ke{}const qn=w([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ba}=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&&li(`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 Xl(i,e){return 256*(i=xt(Math.floor(i),0,255))+xt(Math.floor(e),0,255)}ti.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Oe("SegmentVector",ti);const bo=w([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var wo={exports:{}},Yr={exports:{}};Yr.exports=function(i,e){var r,s,l,d,p,f,_,x;for(s=i.length-(r=3&i.length),l=e,p=3432918353,f=461845907,x=0;x<s;)_=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^=_=(65535&(_=(_=(65535&_)*p+(((_>>>16)*p&65535)<<16)&4294967295)<<15|_>>>17))*f+(((_>>>16)*f&65535)<<16)&4294967295)<<13|l>>>19))+((5*(l>>>16)&65535)<<16)&4294967295))+((58964+(d>>>16)&65535)<<16);switch(_=0,r){case 3:_^=(255&i.charCodeAt(x+2))<<16;case 2:_^=(255&i.charCodeAt(x+1))<<8;case 1:l^=_=(65535&(_=(_=(65535&(_^=255&i.charCodeAt(x)))*p+(((_>>>16)*p&65535)<<16)&4294967295)<<15|_>>>17))*f+(((_>>>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 Jl=Yr.exports,Fa={exports:{}};Fa.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 Oa=Jl,Va=Fa.exports;wo.exports=Oa,wo.exports.murmur3=Oa,wo.exports.murmur2=Va;var So=ge(wo.exports);class Zn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,s,l){this.ids.push(ju(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=ju(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 nh(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 ju(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:So(String(i))}function nh(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;Kl(i,d,p),Kl(e,3*d,3*p),Kl(e,3*d+1,3*p+1),Kl(e,3*d+2,3*p+2)}p-r<s-p?(nh(i,e,r,p),r=p+1):(nh(i,e,p+1,s),s=p)}}function Kl(i,e,r){const s=i[e];i[e]=i[r],i[r]=s}Oe("FeaturePositionMap",Zn);class Cs{constructor(e,r){this.gl=e.gl,this.location=r}}class Yl extends Cs{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Uu extends Cs{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 $u extends Cs{constructor(e,r){super(e,r),this.current=bt.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}const Eg=new Float32Array(16);function sh(i){return[Xl(255*i.r,255*i.g),Xl(255*i.b,255*i.a)]}class Na{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 $u(e,r):new Yl(e,r)}}class To{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 Uu(e,r):new Yl(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 At(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=sh(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 Lr{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 At(this.zoom),r,{},l,[],d),f=this.expression.evaluate(new At(this.zoom+1),r,{},l,[],d),_=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(_,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=sh(s),p=sh(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=xt(this.expression.interpolationFactor(s,this.zoom,this.zoom+1),0,1);e.set(l)}getBinding(e,r,s){return new Yl(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,_=l[d],x=l[p],S=l[f];if(_&&x&&S)for(let I=e;I<r;I++)this.zoomInPaintVertexArray.emplace(I,x.tl[0],x.tl[1],x.br[0],x.br[1],_.tl[0],_.tl[1],_.br[0],_.br[1],x.pixelRatio,_.pixelRatio),this.zoomOutPaintVertexArray.emplace(I,x.tl[0],x.tl[1],x.br[0],x.br[1],S.tl[0],S.tl[1],S.br[0],S.br[1],x.pixelRatio,S.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,bo.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,bo.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class qu{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 vr&&fn(p.property.specification)))continue;const f=Ag(d,e.type),_=p.value,x=p.property.specification.type,S=p.property.useIntegerZoom,I=p.property.specification["property-type"],A=I==="cross-faded"||I==="cross-faded-data-driven";if(_.kind==="constant")this.binders[d]=A?new To(_.value,f):new Na(_.value,f,x),l.push(`/u_${d}`);else if(_.kind==="source"||A){const D=Zu(d,x,"source");this.binders[d]=A?new Gn(_,x,S,r,D,e.id):new bn(_,f,x,D),l.push(`/a_${d}`)}else{const D=Zu(d,x,"composite");this.binders[d]=new Lr(_,f,x,S,r,D),l.push(`/z_${d}`)}}this.cacheKey=l.sort().join("")}getMaxValue(e){const r=this.binders[e];return r instanceof bn||r instanceof Lr?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 Lr||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 To&&l.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,s,l,d){let p=!1;for(const f in e){const _=r.getPositions(f);for(const x of _){const S=s.feature(x.index);for(const I in this.binders){const A=this.binders[I];if((A instanceof bn||A instanceof Lr||A instanceof Gn)&&A.expression.isStateDependent===!0){const D=l.paint.get(I);A.expression=D.value,A.updatePaintArray(x.start,x.end,S,e[f],d),p=!0}}}}return p}defines(){const e=[];for(const r in this.binders){const s=this.binders[r];(s instanceof Na||s instanceof To)&&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 Lr)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<bo.members.length;l++)e.push(bo.members[l].name)}return e}getBinderUniforms(){const e=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof Na||s instanceof To||s instanceof Lr)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 Na||d instanceof To||d instanceof Lr){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 Lr)&&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 Lr||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 Lr||r instanceof Gn)&&r.destroy()}}}class Ms{constructor(e,r,s=()=>!0){this.programConfigurations={};for(const l of e)this.programConfigurations[l.id]=new qu(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 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 Zu(i,e,r){const s={color:{source:U,composite:Qe},number:{source:Te,composite:U}},l=function(d){return{"line-pattern":{source:oi,composite:oi},"fill-pattern":{source:oi,composite:oi},"fill-extrusion-pattern":{source:oi,composite:oi}}[d]}(i);return l&&l[r]||s[e][r]}Oe("ConstantBinder",Na),Oe("CrossFadedConstantBinder",To),Oe("SourceExpressionBinder",bn),Oe("CrossFadedCompositeBinder",Gn),Oe("CompositeExpressionBinder",Lr),Oe("ProgramConfiguration",qu,{omit:["_buffers"]}),Oe("ProgramConfigurationSet",Ms);const Qt=8192,oh=Math.pow(2,14)-1,Gu=-oh-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),_=Math.round(p.y*e);p.x=xt(f,Gu,oh),p.y=xt(_,Gu,oh),(f<p.x||f>p.x+1||_<p.y||_>p.y+1)&&li("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 Ql(i,e,r,s,l){i.emplaceBack(2*e+(s+1)/2,2*r+(l+1)/2)}class ah{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 xo,this.indexArray=new ri,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:_,id:x,index:S,sourceLayerIndex:I}of e){const A=this.layers[0]._featureFilter.needGeometry,D=Ds(_,A);if(!this.layers[0]._featureFilter.filter(new At(this.zoom),D,s))continue;const R=f?p.evaluate(D,{},s):void 0,O={id:x,properties:_.properties,type:_.type,sourceLayerIndex:I,index:S,geometry:A?D.geometry:zs(_),patterns:{},sortKey:R};d.push(O)}f&&d.sort((_,x)=>_.sortKey-x.sortKey);for(const _ of d){const{geometry:x,index:S,sourceLayerIndex:I}=_,A=e[S].feature;this.addFeature(_,x,S,s),r.featureIndex.insert(A,x,S,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,Ba),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,_=p.y;if(f<0||f>=Qt||_<0||_>=Qt)continue;const x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),S=x.vertexLength;Ql(this.layoutVertexArray,f,_,-1,-1),Ql(this.layoutVertexArray,f,_,1,-1),Ql(this.layoutVertexArray,f,_,1,1),Ql(this.layoutVertexArray,f,_,-1,1),this.indexArray.emplaceBack(S,S+1,S+2),this.indexArray.emplaceBack(S,S+3,S+2),x.vertexLength+=4,x.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{},l)}}function Hu(i,e){for(let r=0;r<i.length;r++)if(Io(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Io(i,e[r]))return!0;return!!lh(i,e)}function Cg(i,e,r){return!!Io(i,e)||!!ch(e,i,r)}function Wu(i,e){if(i.length===1)return Ju(e,i[0]);for(let r=0;r<e.length;r++){const s=e[r];for(let l=0;l<s.length;l++)if(Io(i,s[l]))return!0}for(let r=0;r<i.length;r++)if(Ju(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(lh(i,e[r]))return!0;return!1}function Mg(i,e,r){if(i.length>1){if(lh(i,e))return!0;for(let s=0;s<e.length;s++)if(ch(e[s],i,r))return!0}for(let s=0;s<i.length;s++)if(ch(i[s],e,r))return!0;return!1}function lh(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(zg(s,l,e[d],e[d+1]))return!0}return!1}function zg(i,e,r,s){return wi(i,r,s)!==wi(e,r,s)&&wi(i,e,r)!==wi(i,e,s)}function ch(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(Xu(i,e[l-1],e[l])<s)return!0;return!1}function Xu(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 Ju(i,e){let r,s,l,d=!1;for(let p=0;p<i.length;p++){r=i[p];for(let f=0,_=r.length-1;f<r.length;_=f++)s=r[f],l=r[_],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 Io(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 Dg(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 ja(i,e,r){const s=e.paint.get(i).value;return s.kind==="constant"?s.value:r.programConfigurations.get(e.id).getMaxValue(i)}function ec(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function tc(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 Ku,Yu;Oe("CircleBucket",ah,{omit:["layers"]});var Lg={get paint(){return Yu=Yu||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 Ku=Ku||new o({"circle-sort-key":new Je(ue.layout_circle["circle-sort-key"])})}},zi=1e-6,Po=typeof Float32Array<"u"?Float32Array:Array;function hh(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 Qu(i,e,r){var s=e[0],l=e[1],d=e[2],p=e[3],f=e[4],_=e[5],x=e[6],S=e[7],I=e[8],A=e[9],D=e[10],R=e[11],O=e[12],$=e[13],W=e[14],oe=e[15],Y=r[0],ie=r[1],de=r[2],be=r[3];return i[0]=Y*s+ie*f+de*I+be*O,i[1]=Y*l+ie*_+de*A+be*$,i[2]=Y*d+ie*x+de*D+be*W,i[3]=Y*p+ie*S+de*R+be*oe,i[4]=(Y=r[4])*s+(ie=r[5])*f+(de=r[6])*I+(be=r[7])*O,i[5]=Y*l+ie*_+de*A+be*$,i[6]=Y*d+ie*x+de*D+be*W,i[7]=Y*p+ie*S+de*R+be*oe,i[8]=(Y=r[8])*s+(ie=r[9])*f+(de=r[10])*I+(be=r[11])*O,i[9]=Y*l+ie*_+de*A+be*$,i[10]=Y*d+ie*x+de*D+be*W,i[11]=Y*p+ie*S+de*R+be*oe,i[12]=(Y=r[12])*s+(ie=r[13])*f+(de=r[14])*I+(be=r[15])*O,i[13]=Y*l+ie*_+de*A+be*$,i[14]=Y*d+ie*x+de*D+be*W,i[15]=Y*p+ie*S+de*R+be*oe,i}Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});var Ua,Rg=Qu;function ic(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}Ua=new Po(4),Po!=Float32Array&&(Ua[0]=0,Ua[1]=0,Ua[2]=0,Ua[3]=0);class Bg extends h{constructor(e){super(e,Lg)}createBucket(e){return new ah(e)}queryRadius(e){const r=e;return ja("circle-radius",this,r)+ja("circle-stroke-width",this,r)+ec(this.paint.get("circle-translate"))}queryIntersectsFeature(e,r,s,l,d,p,f,_){const x=tc(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),p.angle,f),S=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(R,O){return R.map($=>ed($,O))}(x,_),D=I?S*f:S;for(const R of l)for(const O of R){const $=I?O:ed(O,_);let W=D;const oe=ic([],[O.x,O.y,0,1],_);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?W*=oe[3]/p.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(W*=p.cameraToCenterDistance/oe[3]),Cg(A,$,W))return!0}return!1}}function ed(i,e){const r=ic([],[i.x,i.y,0,1],e);return new le(r[0]/r[3],r[1]/r[3])}class td extends ah{}let id;Oe("HeatmapBucket",td,{omit:["layers"]});var Fg={get paint(){return id=id||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 uh(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 rd(i,{width:e,height:r},s){if(e===i.width&&r===i.height)return;const l=uh({},{width:e,height:r},s);dh(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 dh(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 _=0;_<l.height;_++){const x=((r.y+_)*i.width+r.x)*d,S=((s.y+_)*e.width+s.x)*d;for(let I=0;I<l.width*d;I++)f[S+I]=p[x+I]}return e}class $a{constructor(e,r){uh(this,e,1,r)}resize(e){rd(this,e,1)}clone(){return new $a({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,s,l,d){dh(e,r,s,l,d,1)}}class or{constructor(e,r){uh(this,e,4,r)}resize(e){rd(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new or({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,s,l,d){dh(e,r,s,l,d,4)}}function nd(i){const e={},r=i.resolution||256,s=i.clips?i.clips.length:1,l=i.image||new or({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,_)=>{e[i.evaluationKey]=_;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 _=0,x=0;_<r;_++,x+=4){const S=_/(r-1),{start:I,end:A}=i.clips[p];d(f,x,I*(1-S)+A*S)}else for(let p=0,f=0;p<r;p++,f+=4)d(0,f,p/(r-1));return l}Oe("AlphaImage",$a),Oe("RGBAImage",or);class Og extends h{createBucket(e){return new td(e)}constructor(e){super(e,Fg),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=nd({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 sd;var Vg={get paint(){return sd=sd||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 Ng extends h{constructor(e){super(e,Vg)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const jg=w([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ug}=jg;function od(i,e,r=2){const s=e&&e.length,l=s?e[0]*r:i.length;let d=ad(i,0,l,r,!0);const p=[];if(!d||d.next===d.prev)return p;let f,_,x;if(s&&(d=function(S,I,A,D){const R=[];for(let O=0,$=I.length;O<$;O++){const W=ad(S,I[O]*D,O<$-1?I[O+1]*D:S.length,D,!1);W===W.next&&(W.steiner=!0),R.push(Jg(W))}R.sort(Hg);for(let O=0;O<R.length;O++)A=Wg(R[O],A);return A}(i,e,d,r)),i.length>80*r){f=1/0,_=1/0;let S=-1/0,I=-1/0;for(let A=r;A<l;A+=r){const D=i[A],R=i[A+1];D<f&&(f=D),R<_&&(_=R),D>S&&(S=D),R>I&&(I=R)}x=Math.max(S-f,I-_),x=x!==0?32767/x:0}return qa(d,p,r,f,_,x,0),p}function ad(i,e,r,s,l){let d;if(l===function(p,f,_,x){let S=0;for(let I=f,A=_-x;I<_;I+=x)S+=(p[A]-p[I])*(p[I+1]+p[A+1]),A=I;return S}(i,e,r,s)>0)for(let p=e;p<r;p+=s)d=hd(p/s|0,i[p],i[p+1],d);else for(let p=r-s;p>=e;p-=s)d=hd(p/s|0,i[p],i[p+1],d);return d&&rc(d,d.next)&&(Ga(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||!rc(s,s.next)&&Jt(s.prev,s,s.next)!==0)s=s.next;else{if(Ga(s),s=e=s.prev,s===s.next)break;r=!0}while(r||s!==e);return e}function qa(i,e,r,s,l,d,p){if(!i)return;!p&&d&&function(_,x,S,I){let A=_;do A.z===0&&(A.z=ph(A.x,A.y,x,S,I)),A.prevZ=A.prev,A.nextZ=A.next,A=A.next;while(A!==_);A.prevZ.nextZ=null,A.prevZ=null,function(D){let R,O=1;do{let $,W=D;D=null;let oe=null;for(R=0;W;){R++;let Y=W,ie=0;for(let be=0;be<O&&(ie++,Y=Y.nextZ,Y);be++);let de=O;for(;ie>0||de>0&&Y;)ie!==0&&(de===0||!Y||W.z<=Y.z)?($=W,W=W.nextZ,ie--):($=Y,Y=Y.nextZ,de--),oe?oe.nextZ=$:D=$,$.prevZ=oe,oe=$;W=Y}oe.nextZ=null,O*=2}while(R>1)}(A)}(i,s,l,d);let f=i;for(;i.prev!==i.next;){const _=i.prev,x=i.next;if(d?qg(i,s,l,d):$g(i))e.push(_.i,i.i,x.i),Ga(i),i=x.next,f=x.next;else if((i=x)===f){p?p===1?qa(i=Zg(Ls(i),e),e,r,s,l,d,2):p===2&&Gg(i,e,r,s,l,d):qa(Ls(i),e,r,s,l,d,1);break}}}function $g(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,_=r.y,x=s.y,S=l<d?l<p?l:p:d<p?d:p,I=f<_?f<x?f:x:_<x?_:x,A=l>d?l>p?l:p:d>p?d:p,D=f>_?f>x?f:x:_>x?_:x;let R=s.next;for(;R!==e;){if(R.x>=S&&R.x<=A&&R.y>=I&&R.y<=D&&ko(l,f,d,_,p,x,R.x,R.y)&&Jt(R.prev,R,R.next)>=0)return!1;R=R.next}return!0}function qg(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,_=d.x,x=p.x,S=l.y,I=d.y,A=p.y,D=f<_?f<x?f:x:_<x?_:x,R=S<I?S<A?S:A:I<A?I:A,O=f>_?f>x?f:x:_>x?_:x,$=S>I?S>A?S:A:I>A?I:A,W=ph(D,R,e,r,s),oe=ph(O,$,e,r,s);let Y=i.prevZ,ie=i.nextZ;for(;Y&&Y.z>=W&&ie&&ie.z<=oe;){if(Y.x>=D&&Y.x<=O&&Y.y>=R&&Y.y<=$&&Y!==l&&Y!==p&&ko(f,S,_,I,x,A,Y.x,Y.y)&&Jt(Y.prev,Y,Y.next)>=0||(Y=Y.prevZ,ie.x>=D&&ie.x<=O&&ie.y>=R&&ie.y<=$&&ie!==l&&ie!==p&&ko(f,S,_,I,x,A,ie.x,ie.y)&&Jt(ie.prev,ie,ie.next)>=0))return!1;ie=ie.nextZ}for(;Y&&Y.z>=W;){if(Y.x>=D&&Y.x<=O&&Y.y>=R&&Y.y<=$&&Y!==l&&Y!==p&&ko(f,S,_,I,x,A,Y.x,Y.y)&&Jt(Y.prev,Y,Y.next)>=0)return!1;Y=Y.prevZ}for(;ie&&ie.z<=oe;){if(ie.x>=D&&ie.x<=O&&ie.y>=R&&ie.y<=$&&ie!==l&&ie!==p&&ko(f,S,_,I,x,A,ie.x,ie.y)&&Jt(ie.prev,ie,ie.next)>=0)return!1;ie=ie.nextZ}return!0}function Zg(i,e){let r=i;do{const s=r.prev,l=r.next.next;!rc(s,l)&&ld(s,r,r.next,l)&&Za(s,l)&&Za(l,s)&&(e.push(s.i,r.i,l.i),Ga(r),Ga(r.next),r=i=l),r=r.next}while(r!==i);return Ls(r)}function Gg(i,e,r,s,l,d){let p=i;do{let f=p.next.next;for(;f!==p.prev;){if(p.i!==f.i&&Kg(p,f)){let _=cd(p,f);return p=Ls(p,p.next),_=Ls(_,_.next),qa(p,e,r,s,l,d,0),void qa(_,e,r,s,l,d,0)}f=f.next}p=p.next}while(p!==i)}function Hg(i,e){return i.x-e.x}function Wg(i,e){const r=function(l,d){let p=d;const f=l.x,_=l.y;let x,S=-1/0;do{if(_<=p.y&&_>=p.next.y&&p.next.y!==p.y){const O=p.x+(_-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(O<=f&&O>S&&(S=O,x=p.x<p.next.x?p:p.next,O===f))return x}p=p.next}while(p!==d);if(!x)return null;const I=x,A=x.x,D=x.y;let R=1/0;p=x;do{if(f>=p.x&&p.x>=A&&f!==p.x&&ko(_<D?f:S,_,A,D,_<D?S:f,_,p.x,p.y)){const O=Math.abs(_-p.y)/(f-p.x);Za(p,l)&&(O<R||O===R&&(p.x>x.x||p.x===x.x&&Xg(x,p)))&&(x=p,R=O)}p=p.next}while(p!==I);return x}(i,e);if(!r)return e;const s=cd(r,i);return Ls(s,s.next),Ls(r,r.next)}function Xg(i,e){return Jt(i.prev,i,e.prev)<0&&Jt(e.next,i,i.next)<0}function ph(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 Jg(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 ko(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 Kg(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&&ld(l,l.next,r,s))return!0;l=l.next}while(l!==r);return!1}(i,e)&&(Za(i,e)&&Za(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))||rc(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 rc(i,e){return i.x===e.x&&i.y===e.y}function ld(i,e,r,s){const l=sc(Jt(i,e,r)),d=sc(Jt(i,e,s)),p=sc(Jt(r,s,i)),f=sc(Jt(r,s,e));return l!==d&&p!==f||!(l!==0||!nc(i,r,e))||!(d!==0||!nc(i,s,e))||!(p!==0||!nc(r,i,s))||!(f!==0||!nc(r,e,s))}function nc(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 sc(i){return i>0?1:i<0?-1:0}function Za(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 cd(i,e){const r=fh(i.i,i.x,i.y),s=fh(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 hd(i,e,r,s){const l=fh(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 Ga(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 fh(i,e,r){return{i,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function mh(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 gh(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 _=f.evaluate({zoom:s-1},r,{},l.availableImages),x=f.evaluate({zoom:s},r,{},l.availableImages),S=f.evaluate({zoom:s+1},r,{},l.availableImages);_=_&&_.name?_.name:_,x=x&&x.name?x.name:x,S=S&&S.name?S.name:S,d[_]=!0,d[x]=!0,d[S]=!0,r.patterns[p.id]={min:_,mid:x,max:S}}}return r}class _h{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 ri,this.indexArray2=new Nt,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=mh("fill",this.layers,r);const l=this.layers[0].layout.get("fill-sort-key"),d=!l.isConstant(),p=[];for(const{feature:f,id:_,index:x,sourceLayerIndex:S}of e){const I=this.layers[0]._featureFilter.needGeometry,A=Ds(f,I);if(!this.layers[0]._featureFilter.filter(new At(this.zoom),A,s))continue;const D=d?l.evaluate(A,{},s,r.availableImages):void 0,R={id:_,properties:f.properties,type:f.type,sourceLayerIndex:S,index:x,geometry:I?A.geometry:zs(f),patterns:{},sortKey:D};p.push(R)}d&&p.sort((f,_)=>f.sortKey-_.sortKey);for(const f of p){const{geometry:_,index:x,sourceLayerIndex:S}=f;if(this.hasPattern){const I=gh("fill",this.layers,f,this.zoom,r);this.patternFeatures.push(I)}else this.addFeature(f,_,x,s,{});r.featureIndex.insert(e[x].feature,_,x,S,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,Ug),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 Qs(r,500)){let f=0;for(const D of p)f+=D.length;const _=this.segments.prepareSegment(f,this.layoutVertexArray,this.indexArray),x=_.vertexLength,S=[],I=[];for(const D of p){if(D.length===0)continue;D!==p[0]&&I.push(S.length/2);const R=this.segments2.prepareSegment(D.length,this.layoutVertexArray,this.indexArray2),O=R.vertexLength;this.layoutVertexArray.emplaceBack(D[0].x,D[0].y),this.indexArray2.emplaceBack(O+D.length-1,O),S.push(D[0].x),S.push(D[0].y);for(let $=1;$<D.length;$++)this.layoutVertexArray.emplaceBack(D[$].x,D[$].y),this.indexArray2.emplaceBack(O+$-1,O+$),S.push(D[$].x),S.push(D[$].y);R.vertexLength+=D.length,R.primitiveLength+=D.length}const A=od(S,I);for(let D=0;D<A.length;D+=3)this.indexArray.emplaceBack(x+A[D],x+A[D+1],x+A[D+2]);_.vertexLength+=f,_.primitiveLength+=A.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,d,l)}}let ud,dd;Oe("FillBucket",_h,{omit:["layers","patternFeatures"]});var Yg={get paint(){return dd=dd||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 ud=ud||new o({"fill-sort-key":new Je(ue.layout_fill["fill-sort-key"])})}};class Qg extends h{constructor(e){super(e,Yg)}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 _h(e)}queryRadius(){return ec(this.paint.get("fill-translate"))}queryIntersectsFeature(e,r,s,l,d,p,f){return Wu(tc(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),p.angle,f),l)}isTileClipped(){return!0}}const e_=w([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),t_=w([{name:"a_centroid",components:2,type:"Int16"}],4),{members:i_}=e_;var Hn={},r_=xe,pd=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(n_,this,e)}function n_(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 s_(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 _=i.readVarint();s=7&_,l=_>>3}if(l--,s===1||s===2)d+=i.readSVarint(),p+=i.readSVarint(),s===1&&(e&&f.push(e),e=[]),e.push(new r_(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,_=1/0,x=-1/0;i.pos<e;){if(s<=0){var S=i.readVarint();r=7&S,s=S>>3}if(s--,r===1||r===2)(l+=i.readSVarint())<p&&(p=l),l>f&&(f=l),(d+=i.readSVarint())<_&&(_=d),d>x&&(x=d);else if(r!==7)throw new Error("unknown command "+r)}return[p,_,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,_=this.loadGeometry(),x=Eo.types[this.type];function S(D){for(var R=0;R<D.length;R++){var O=D[R];D[R]=[360*(O.x+p)/d-180,360/Math.PI*Math.atan(Math.exp((180-360*(O.y+f)/d)*Math.PI/180))-90]}}switch(this.type){case 1:var I=[];for(s=0;s<_.length;s++)I[s]=_[s][0];S(_=I);break;case 2:for(s=0;s<_.length;s++)S(_[s]);break;case 3:for(_=function(D){var R=D.length;if(R<=1)return[D];for(var O,$,W=[],oe=0;oe<R;oe++){var Y=s_(D[oe]);Y!==0&&($===void 0&&($=Y<0),$===Y<0?(O&&W.push(O),O=[D[oe]]):O.push(D[oe]))}return O&&W.push(O),W}(_),s=0;s<_.length;s++)for(l=0;l<_[s].length;l++)S(_[s][l])}_.length===1?_=_[0]:x="Multi"+x;var A={type:"Feature",geometry:{type:x,coordinates:_},properties:this.properties};return"id"in this&&(A.id=this.id),A};var o_=pd,fd=md;function md(i,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(a_,this,e),this.length=this._features.length}function a_(i,e,r){i===15?e.version=r.readVarint():i===1?e.name=r.readString():i===5?e.extent=r.readVarint():i===2?e._features.push(r.pos):i===3?e._keys.push(r.readString()):i===4&&e._values.push(function(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))}md.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 o_(this._pbf,e,this.extent,this._keys,this._values)};var l_=fd;function c_(i,e,r){if(i===3){var s=new l_(r,r.readVarint()+r.pos);s.length&&(e[s.name]=s)}}Hn.VectorTile=function(i,e){this.layers=i.readFields(c_,{},e)},Hn.VectorTileFeature=pd,Hn.VectorTileLayer=fd;const h_=Hn.VectorTileFeature.types,yh=Math.pow(2,13);function Ha(i,e,r,s,l,d,p,f){i.emplaceBack(e,r,2*Math.floor(s*yh)+p,l*yh*2,d*yh*2,Math.round(f))}class xh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new vn,this.centroidVertexArray=new xn,this.indexArray=new ri,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=mh("fill-extrusion",this.layers,r);for(const{feature:l,id:d,index:p,sourceLayerIndex:f}of e){const _=this.layers[0]._featureFilter.needGeometry,x=Ds(l,_);if(!this.layers[0]._featureFilter.filter(new At(this.zoom),x,s))continue;const S={id:d,sourceLayerIndex:f,index:p,geometry:_?x.geometry:zs(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(gh("fill-extrusion",this.layers,S,this.zoom,r)):this.addFeature(S,S.geometry,p,s,{}),r.featureIndex.insert(l,S.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,i_),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,t_.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 Qs(r,500)){const f={x:0,y:0,vertexCount:0};let _=0;for(const R of p)_+=R.length;let x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const R of p){if(R.length===0||d_(R))continue;let O=0;for(let $=0;$<R.length;$++){const W=R[$];if($>=1){const oe=R[$-1];if(!u_(W,oe)){x.vertexLength+4>ti.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const Y=W.sub(oe)._perp()._unit(),ie=oe.dist(W);O+ie>32768&&(O=0),Ha(this.layoutVertexArray,W.x,W.y,Y.x,Y.y,0,0,O),Ha(this.layoutVertexArray,W.x,W.y,Y.x,Y.y,0,1,O),f.x+=2*W.x,f.y+=2*W.y,f.vertexCount+=2,O+=ie,Ha(this.layoutVertexArray,oe.x,oe.y,Y.x,Y.y,0,0,O),Ha(this.layoutVertexArray,oe.x,oe.y,Y.x,Y.y,0,1,O),f.x+=2*oe.x,f.y+=2*oe.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+_>ti.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(_,this.layoutVertexArray,this.indexArray)),h_[e.type]!=="Polygon")continue;const S=[],I=[],A=x.vertexLength;for(const R of p)if(R.length!==0){R!==p[0]&&I.push(S.length/2);for(let O=0;O<R.length;O++){const $=R[O];Ha(this.layoutVertexArray,$.x,$.y,0,0,1,1,0),f.x+=$.x,f.y+=$.y,f.vertexCount+=1,S.push($.x),S.push($.y)}}const D=od(S,I);for(let R=0;R<D.length;R+=3)this.indexArray.emplaceBack(A+D[R],A+D[R+2],A+D[R+1]);x.primitiveLength+=D.length/3,x.vertexLength+=_;for(let R=0;R<f.vertexCount;R++){const O=Math.floor(f.x/f.vertexCount),$=Math.floor(f.y/f.vertexCount);this.centroidVertexArray.emplaceBack(O,$)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,d,l)}}function u_(i,e){return i.x===e.x&&(i.x<0||i.x>Qt)||i.y===e.y&&(i.y<0||i.y>Qt)}function d_(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 gd;Oe("FillExtrusionBucket",xh,{omit:["layers","features"]});var p_={get paint(){return gd=gd||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 f_ extends h{constructor(e){super(e,p_)}createBucket(e){return new xh(e)}queryRadius(){return ec(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,r,s,l,d,p,f,_){const x=tc(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),p.angle,f),S=this.paint.get("fill-extrusion-height").evaluate(r,s),I=this.paint.get("fill-extrusion-base").evaluate(r,s),A=function(R,O,$,W){const oe=[];for(const Y of R){const ie=[Y.x,Y.y,0,1];ic(ie,ie,O),oe.push(new le(ie[0]/ie[3],ie[1]/ie[3]))}return oe}(x,_),D=function(R,O,$,W){const oe=[],Y=[],ie=W[8]*O,de=W[9]*O,be=W[10]*O,Re=W[11]*O,Xe=W[8]*$,Me=W[9]*$,Ae=W[10]*$,qe=W[11]*$;for(const Ne of R){const Fe=[],me=[];for(const Ge of Ne){const $e=Ge.x,et=Ge.y,It=W[0]*$e+W[4]*et+W[12],Tt=W[1]*$e+W[5]*et+W[13],ni=W[2]*$e+W[6]*et+W[14],br=W[3]*$e+W[7]*et+W[15],yi=ni+be,Ht=br+Re,Di=It+Xe,Li=Tt+Me,Ri=ni+Ae,Wt=br+qe,si=new le((It+ie)/Ht,(Tt+de)/Ht);si.z=yi/Ht,Fe.push(si);const Pi=new le(Di/Wt,Li/Wt);Pi.z=Ri/Wt,me.push(Pi)}oe.push(Fe),Y.push(me)}return[oe,Y]}(l,I,S,_);return function(R,O,$){let W=1/0;Wu($,O)&&(W=_d($,O[0]));for(let oe=0;oe<O.length;oe++){const Y=O[oe],ie=R[oe];for(let de=0;de<Y.length-1;de++){const be=Y[de],Re=[be,Y[de+1],ie[de+1],ie[de],be];Hu($,Re)&&(W=Math.min(W,_d($,Re)))}}return W!==1/0&&W}(D[0],D[1],A)}}function Wa(i,e){return i.x*e.x+i.y*e.y}function _d(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),_=d.sub(s),x=p.sub(s),S=Wa(f,f),I=Wa(f,_),A=Wa(_,_),D=Wa(x,f),R=Wa(x,_),O=S*A-I*I,$=(A*D-I*R)/O,W=(S*R-I*D)/O,oe=s.z*(1-$-W)+l.z*$+d.z*W;if(isFinite(oe))return oe}return 1/0}{let r=1/0;for(const s of e)r=Math.min(r,s.z);return r}}const m_=w([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:g_}=m_,__=w([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:y_}=__,x_=Hn.VectorTileFeature.types,v_=Math.cos(Math.PI/180*37.5),yd=Math.pow(2,14)/.5;class vh{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 vo,this.layoutVertexArray2=new Ra,this.indexArray=new ri,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=mh("line",this.layers,r);const l=this.layers[0].layout.get("line-sort-key"),d=!l.isConstant(),p=[];for(const{feature:f,id:_,index:x,sourceLayerIndex:S}of e){const I=this.layers[0]._featureFilter.needGeometry,A=Ds(f,I);if(!this.layers[0]._featureFilter.filter(new At(this.zoom),A,s))continue;const D=d?l.evaluate(A,{},s):void 0,R={id:_,properties:f.properties,type:f.type,sourceLayerIndex:S,index:x,geometry:I?A.geometry:zs(f),patterns:{},sortKey:D};p.push(R)}d&&p.sort((f,_)=>f.sortKey-_.sortKey);for(const f of p){const{geometry:_,index:x,sourceLayerIndex:S}=f;if(this.hasPattern){const I=gh("line",this.layers,f,this.zoom,r);this.patternFeatures.push(I)}else this.addFeature(f,_,x,s,{});r.featureIndex.insert(e[x].feature,_,x,S,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,y_)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,g_),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,{}),_=p.get("line-cap"),x=p.get("line-miter-limit"),S=p.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const I of r)this.addLine(I,e,f,_,x,S);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 W=0;W<e.length-1;W++)this.totalDistance+=e[W].dist(e[W+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const f=x_[r.type]==="Polygon";let _=e.length;for(;_>=2&&e[_-1].equals(e[_-2]);)_--;let x=0;for(;x<_-1&&e[x].equals(e[x+1]);)x++;if(_<(f?3:2))return;s==="bevel"&&(d=1.05);const S=this.overscaling<=16?15*Qt/(512*this.overscaling):0,I=this.segments.prepareSegment(10*_,this.layoutVertexArray,this.indexArray);let A,D,R,O,$;this.e1=this.e2=-1,f&&(A=e[_-2],$=e[x].sub(A)._unit()._perp());for(let W=x;W<_;W++){if(R=W===_-1?f?e[x+1]:void 0:e[W+1],R&&e[W].equals(R))continue;$&&(O=$),A&&(D=A),A=e[W],$=R?R.sub(A)._unit()._perp():O,O=O||$;let oe=O.add($);oe.x===0&&oe.y===0||oe._unit();const Y=O.x*$.x+O.y*$.y,ie=oe.x*$.x+oe.y*$.y,de=ie!==0?1/ie:1/0,be=2*Math.sqrt(2-2*ie),Re=ie<v_&&D&&R,Xe=O.x*$.y-O.y*$.x>0;if(Re&&W>x){const qe=A.dist(D);if(qe>2*S){const Ne=A.sub(A.sub(D)._mult(S/qe)._round());this.updateDistance(D,Ne),this.addCurrentVertex(Ne,O,0,0,I),D=Ne}}const Me=D&&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")),D&&this.updateDistance(D,A),Ae==="miter")oe._mult(de),this.addCurrentVertex(A,oe,0,0,I);else if(Ae==="flipbevel"){if(de>100)oe=$.mult(-1);else{const qe=de*O.add($).mag()/O.sub($).mag();oe._perp()._mult(qe*(Xe?-1:1))}this.addCurrentVertex(A,oe,0,0,I),this.addCurrentVertex(A,oe.mult(-1),0,0,I)}else if(Ae==="bevel"||Ae==="fakeround"){const qe=-Math.sqrt(de*de-1),Ne=Xe?qe:0,Fe=Xe?0:qe;if(D&&this.addCurrentVertex(A,O,Ne,Fe,I),Ae==="fakeround"){const me=Math.round(180*be/Math.PI/20);for(let Ge=1;Ge<me;Ge++){let $e=Ge/me;if($e!==.5){const It=$e-.5;$e+=$e*It*($e-1)*((1.0904+Y*(Y*(3.55645-1.43519*Y)-3.2452))*It*It+(.848013+Y*(.215638*Y-1.06021)))}const et=$.sub(O)._mult($e)._add(O)._unit()._mult(Xe?-1:1);this.addHalfVertex(A,et.x,et.y,!1,Xe,0,I)}}R&&this.addCurrentVertex(A,$,-Ne,-Fe,I)}else if(Ae==="butt")this.addCurrentVertex(A,oe,0,0,I);else if(Ae==="square"){const qe=D?1:-1;this.addCurrentVertex(A,oe,qe,qe,I)}else Ae==="round"&&(D&&(this.addCurrentVertex(A,O,0,0,I),this.addCurrentVertex(A,O,1,1,I,!0)),R&&(this.addCurrentVertex(A,$,-1,-1,I,!0),this.addCurrentVertex(A,$,0,0,I)));if(Re&&W<_-1){const qe=A.dist(R);if(qe>2*S){const Ne=A.add(R.sub(A)._mult(S/qe)._round());this.updateDistance(A,Ne),this.addCurrentVertex(Ne,$,0,0,I),A=Ne}}}}addCurrentVertex(e,r,s,l,d,p=!1){const f=r.y*l-r.x,_=-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,_,p,!0,-l,d),this.distance>yd/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,_){const x=.5*(this.lineClips?this.scaledDistance*(yd-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 S=_.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,S),_.primitiveLength++),p?this.e2=S:this.e1=S}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 xd,vd;Oe("LineBucket",vh,{omit:["layers","patternFeatures"]});var bd={get paint(){return vd=vd||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 xd=xd||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 b_ extends Je{possiblyEvaluate(e,r){return r=new At(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=jt({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,s,l)}}let oc;class w_ extends h{constructor(e){super(e,bd),this.gradientVersion=0,oc||(oc=new b_(bd.paint.properties["line-width"].specification),oc.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"]=oc.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new vh(e)}queryRadius(e){const r=e,s=wd(ja("line-width",this,r),ja("line-gap-width",this,r)),l=ja("line-offset",this,r);return s/2+Math.abs(l)+ec(this.paint.get("line-translate"))}queryIntersectsFeature(e,r,s,l,d,p,f){const _=tc(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),p.angle,f),x=f/2*wd(this.paint.get("line-width").evaluate(r,s),this.paint.get("line-gap-width").evaluate(r,s)),S=this.paint.get("line-offset").evaluate(r,s);return S&&(l=function(I,A){const D=[];for(let R=0;R<I.length;R++){const O=I[R],$=[];for(let W=0;W<O.length;W++){const oe=O[W-1],Y=O[W],ie=O[W+1],de=W===0?new le(0,0):Y.sub(oe)._unit()._perp(),be=W===O.length-1?new le(0,0):ie.sub(Y)._unit()._perp(),Re=de._add(be)._unit(),Xe=Re.x*be.x+Re.y*be.y;Xe!==0&&Re._mult(1/Xe),$.push(Re._mult(A)._add(Y))}D.push($)}return D}(l,S*f)),function(I,A,D){for(let R=0;R<A.length;R++){const O=A[R];if(I.length>=3){for(let $=0;$<O.length;$++)if(Io(I,O[$]))return!0}if(Mg(I,O,D))return!0}return!1}(_,l,x)}isTileClipped(){return!0}}function wd(i,e){return e>0?e+2*i:i}const S_=w([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),T_=w([{name:"a_projected_pos",components:3,type:"Float32"}],4);w([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const I_=w([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);w([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Sd=w([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),P_=w([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function k_(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}w([{name:"triangle",components:3,type:"Uint16"}]),w([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),w([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),w([{type:"Float32",name:"offsetX"}]),w([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),w([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Xa={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var ii=24,Td=St,Id=function(i,e,r,s,l){var d,p,f=8*l-s-1,_=(1<<f)-1,x=_>>1,S=-7,I=l-1,A=-1,D=i[e+I];for(I+=A,d=D&(1<<-S)-1,D>>=-S,S+=f;S>0;d=256*d+i[e+I],I+=A,S-=8);for(p=d&(1<<-S)-1,d>>=-S,S+=s;S>0;p=256*p+i[e+I],I+=A,S-=8);if(d===0)d=1-x;else{if(d===_)return p?NaN:1/0*(D?-1:1);p+=Math.pow(2,s),d-=x}return(D?-1:1)*p*Math.pow(2,d-s)},Pd=function(i,e,r,s,l,d){var p,f,_,x=8*d-l-1,S=(1<<x)-1,I=S>>1,A=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,D=0,R=1,O=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,p=S):(p=Math.floor(Math.log(e)/Math.LN2),e*(_=Math.pow(2,-p))<1&&(p--,_*=2),(e+=p+I>=1?A/_:A*Math.pow(2,1-I))*_>=2&&(p++,_/=2),p+I>=S?(f=0,p=S):p+I>=1?(f=(e*_-1)*Math.pow(2,l),p+=I):(f=e*Math.pow(2,I-1)*Math.pow(2,l),p=0));l>=8;i[r+D]=255&f,D+=R,f/=256,l-=8);for(p=p<<l|f,x+=l;x>0;i[r+D]=255&p,D+=R,p/=256,x-=8);i[r+D-R]|=128*O};function St(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}St.Varint=0,St.Fixed64=1,St.Bytes=2,St.Fixed32=5;var bh=4294967296,kd=1/bh,Ed=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function wn(i){return i.type===St.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 Ad(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 E_(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 C_(i,e){for(var r=0;r<i.length;r++)e.writeFloat(i[r])}function M_(i,e){for(var r=0;r<i.length;r++)e.writeDouble(i[r])}function z_(i,e){for(var r=0;r<i.length;r++)e.writeBoolean(i[r])}function D_(i,e){for(var r=0;r<i.length;r++)e.writeFixed32(i[r])}function L_(i,e){for(var r=0;r<i.length;r++)e.writeSFixed32(i[r])}function R_(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 ac(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 Cd(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}St.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=ac(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=Cd(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=ac(this.buf,this.pos)+ac(this.buf,this.pos+4)*bh;return this.pos+=8,i},readSFixed64:function(){var i=ac(this.buf,this.pos)+Cd(this.buf,this.pos+4)*bh;return this.pos+=8,i},readFloat:function(){var i=Id(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Id(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,_,x=p.buf;if(f=(112&(_=x[p.pos++]))>>4,_<128||(f|=(127&(_=x[p.pos++]))<<3,_<128)||(f|=(127&(_=x[p.pos++]))<<10,_<128)||(f|=(127&(_=x[p.pos++]))<<17,_<128)||(f|=(127&(_=x[p.pos++]))<<24,_<128)||(f|=(1&(_=x[p.pos++]))<<31,_<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&&Ed?function(r,s,l){return Ed.decode(r.subarray(s,l))}(this.buf,e,i):function(r,s,l){for(var d="",p=s;p<l;){var f,_,x,S=r[p],I=null,A=S>239?4:S>223?3:S>191?2:1;if(p+A>l)break;A===1?S<128&&(I=S):A===2?(192&(f=r[p+1]))==128&&(I=(31&S)<<6|63&f)<=127&&(I=null):A===3?(_=r[p+2],(192&(f=r[p+1]))==128&&(192&_)==128&&((I=(15&S)<<12|(63&f)<<6|63&_)<=2047||I>=55296&&I<=57343)&&(I=null)):A===4&&(_=r[p+2],x=r[p+3],(192&(f=r[p+1]))==128&&(192&_)==128&&(192&x)==128&&((I=(15&S)<<18|(63&f)<<12|(63&_)<<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!==St.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!==St.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!==St.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!==St.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!==St.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!==St.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!==St.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!==St.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!==St.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===St.Varint)for(;this.buf[this.pos++]>127;);else if(e===St.Bytes)this.pos=this.readVarint()+this.pos;else if(e===St.Fixed32)this.pos+=4;else{if(e!==St.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*kd),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*kd),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,_=0;_<l.length;_++){if((p=l.charCodeAt(_))>55295&&p<57344){if(!f){p>56319||_+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&&Ad(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Pd(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Pd(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&&Ad(r,s,this),this.pos=r-1,this.writeVarint(s),this.pos+=s},writeMessage:function(i,e,r){this.writeTag(i,St.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,E_,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,A_,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,z_,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,C_,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,M_,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,D_,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,L_,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,R_,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,B_,e)},writeBytesField:function(i,e){this.writeTag(i,St.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,St.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,St.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,St.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,St.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,St.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,St.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,St.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,St.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,St.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,!!e)}};var wh=ge(Td);const Sh=3;function F_(i,e,r){i===1&&r.readMessage(O_,e)}function O_(i,e,r){if(i===3){const{id:s,bitmap:l,width:d,height:p,left:f,top:_,advance:x}=r.readMessage(V_,{});e.push({id:s,bitmap:new $a({width:d+2*Sh,height:p+2*Sh},l),metrics:{width:d,height:p,left:f,top:_,advance:x}})}}function V_(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 Md=Sh;function zd(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 _=s[f];if(!(p.w>_.w||p.h>_.h)){if(p.x=_.x,p.y=_.y,d=Math.max(d,p.y+p.h),l=Math.max(l,p.x+p.w),p.w===_.w&&p.h===_.h){const x=s.pop();f<s.length&&(s[f]=x)}else p.h===_.h?(_.x+=p.w,_.w-=p.w):p.w===_.w?(_.y+=p.h,_.h-=p.h):(s.push({x:_.x+p.w,y:_.y,w:_.w-p.w,h:p.h}),_.y+=p.h,_.h-=p.h);break}}return{w:l,h:d,fill:e/(l*d)||0}}const qi=1;class Th{constructor(e,{pixelRatio:r,version:s,stretchX:l,stretchY:d,content:p,textFitWidth:f,textFitHeight:_}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=l,this.stretchY=d,this.content=p,this.version=s,this.textFitWidth=f,this.textFitHeight=_}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 Dd{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}=zd(d),_=new or({width:p||1,height:f||1});for(const x in e){const S=e[x],I=s[x].paddedRect;or.copy(S.data,_,{x:0,y:0},{x:I.x+qi,y:I.y+qi},S.data)}for(const x in r){const S=r[x],I=l[x].paddedRect,A=I.x+qi,D=I.y+qi,R=S.data.width,O=S.data.height;or.copy(S.data,_,{x:0,y:0},{x:A,y:D},S.data),or.copy(S.data,_,{x:0,y:O-1},{x:A,y:D-1},{width:R,height:1}),or.copy(S.data,_,{x:0,y:0},{x:A,y:D+O},{width:R,height:1}),or.copy(S.data,_,{x:R-1,y:0},{x:A-1,y:D},{width:1,height:O}),or.copy(S.data,_,{x:0,y:0},{x:A+R,y:D},{width:1,height:O})}this.image=_,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 Th(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;Oe("ImagePosition",Th),Oe("ImageAtlas",Dd),T.ai=void 0,(Wn=T.ai||(T.ai={}))[Wn.none=0]="none",Wn[Wn.horizontal=1]="horizontal",Wn[Wn.vertical=2]="vertical",Wn[Wn.horizontalOnly=3]="horizontalOnly";const Ja=-17;class Ka{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){const s=new Ka;return s.scale=e||1,s.fontStack=r,s}static forImage(e){const r=new Ka;return r.imageName=e,r}}class Mo{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){const s=new Mo;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&&Gl(l)&&!Xa[e[s+1]]||d&&Gl(d)&&!Xa[e[s-1]]||!Xa[e[s]]?e[s]:Xa[e[s]]}return r}(this.text)}trim(){let e=0;for(let s=0;s<this.text.length&&cc[this.text.charCodeAt(s)];s++)e++;let r=this.text.length;for(let s=this.text.length-1;s>=0&&s>=e&&cc[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 Mo;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(Ka.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 li("Can't add FormattedSection with an empty image.");const s=this.getNextImageSectionCharCode();s?(this.text+=String.fromCharCode(s),this.sections.push(Ka.forImage(r)),this.sectionIndex.push(this.sections.length-1)):li("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function lc(i,e,r,s,l,d,p,f,_,x,S,I,A,D,R){const O=Mo.fromFeature(i,l);let $;I===T.ai.vertical&&O.verticalizePunctuation();const{processBidirectionalText:W,processStyledBidirectionalText:oe}=Jr;if(W&&O.sections.length===1){$=[];const de=W(O.toString(),Ih(O,x,d,e,s,D));for(const be of de){const Re=new Mo;Re.text=be,Re.sections=O.sections;for(let Xe=0;Xe<be.length;Xe++)Re.sectionIndex.push(0);$.push(Re)}}else if(oe){$=[];const de=oe(O.text,O.sectionIndex,Ih(O,x,d,e,s,D));for(const be of de){const Re=new Mo;Re.text=be[0],Re.sectionIndex=be[1],Re.sections=O.sections,$.push(Re)}}else $=function(de,be){const Re=[],Xe=de.text;let Me=0;for(const Ae of be)Re.push(de.substring(Me,Ae)),Me=Ae;return Me<Xe.length&&Re.push(de.substring(Me,Xe.length)),Re}(O,Ih(O,x,d,e,s,D));const Y=[],ie={positionedLines:Y,text:O.toString(),top:S[1],bottom:S[1],left:S[0],right:S[0],writingMode:I,iconsInText:!1,verticalizable:!1};return function(de,be,Re,Xe,Me,Ae,qe,Ne,Fe,me,Ge,$e){let et=0,It=Ja,Tt=0,ni=0;const br=Ne==="right"?1:Ne==="left"?0:.5;let yi=0;for(const Wt of Me){Wt.trim();const si=Wt.getMaxScale(),Pi=(si-1)*ii,xi={positionedGlyphs:[],lineOffset:0};de.positionedLines[yi]=xi;const Bi=xi.positionedGlyphs;let vi=0;if(!Wt.length()){It+=Ae,++yi;continue}for(let Zi=0;Zi<Wt.length();Zi++){const gt=Wt.getSection(Zi),Ct=Wt.getSectionIndex(Zi),Ft=Wt.getCharCode(Zi);let Ji=0,qt=null,Ro=null,en=null,tn=ii;const wr=!(Fe===T.ai.horizontal||!Ge&&!za(Ft)||Ge&&(cc[Ft]||(Ht=Ft,De.Arabic(Ht)||De["Arabic Supplement"](Ht)||De["Arabic Extended-A"](Ht)||De["Arabic Presentation Forms-A"](Ht)||De["Arabic Presentation Forms-B"](Ht))));if(gt.imageName){const cr=Xe[gt.imageName];if(!cr)continue;en=gt.imageName,de.iconsInText=de.iconsInText||!0,Ro=cr.paddedRect;const ai=cr.displaySize;gt.scale=gt.scale*ii/$e,qt={width:ai[0],height:ai[1],left:qi,top:-Md,advance:wr?ai[1]:ai[0]},Ji=Pi+(ii-ai[1]*gt.scale),tn=qt.advance;const Sn=wr?ai[0]*gt.scale-ii*si:ai[1]*gt.scale-ii*si;Sn>0&&Sn>vi&&(vi=Sn)}else{const cr=Re[gt.fontStack],ai=cr&&cr[Ft];if(ai&&ai.rect)Ro=ai.rect,qt=ai.metrics;else{const Sn=be[gt.fontStack],il=Sn&&Sn[Ft];if(!il)continue;qt=il.metrics}Ji=(si-gt.scale)*ii}wr?(de.verticalizable=!0,Bi.push({glyph:Ft,imageName:en,x:et,y:It+Ji,vertical:wr,scale:gt.scale,fontStack:gt.fontStack,sectionIndex:Ct,metrics:qt,rect:Ro}),et+=tn*gt.scale+me):(Bi.push({glyph:Ft,imageName:en,x:et,y:It+Ji,vertical:wr,scale:gt.scale,fontStack:gt.fontStack,sectionIndex:Ct,metrics:qt,rect:Ro}),et+=qt.advance*gt.scale+me)}Bi.length!==0&&(Tt=Math.max(et-me,Tt),$_(Bi,0,Bi.length-1,br,vi)),et=0;const lr=Ae*si+vi;xi.lineOffset=Math.max(vi,Pi),It+=lr,ni=Math.max(lr,ni),++yi}var Ht;const Di=It-Ja,{horizontalAlign:Li,verticalAlign:Ri}=Ph(qe);(function(Wt,si,Pi,xi,Bi,vi,lr,Zi,gt){const Ct=(si-Pi)*Bi;let Ft=0;Ft=vi!==lr?-Zi*xi-Ja:(-xi*gt+.5)*lr;for(const Ji of Wt)for(const qt of Ji.positionedGlyphs)qt.x+=Ct,qt.y+=Ft})(de.positionedLines,br,Li,Ri,Tt,ni,Ae,Di,Me.length),de.top+=-Ri*Di,de.bottom=de.top+Di,de.left+=-Li*Tt,de.right=de.left+Tt}(ie,e,r,s,$,p,f,_,I,x,A,R),!function(de){for(const be of de)if(be.positionedGlyphs.length!==0)return!1;return!0}(Y)&&ie}const cc={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},N_={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},j_={40:!0};function Ld(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 Rd(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 U_(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 Bd(i,e,r,s,l,d){let p=null,f=Rd(e,r,l,d);for(const _ of s){const x=Rd(e-_.x,r,l,d)+_.badness;x<=f&&(p=_,f=x)}return{index:i,x:e,priorBreak:p,badness:f}}function Fd(i){return i?Fd(i.priorBreak).concat(i.index):[]}function Ih(i,e,r,s,l,d){if(!i)return[];const p=[],f=function(I,A,D,R,O,$){let W=0;for(let oe=0;oe<I.length();oe++){const Y=I.getSection(oe);W+=Ld(I.getCharCode(oe),Y,R,O,A,$)}return W/Math.max(1,Math.ceil(W/D))}(i,e,r,s,l,d),_=i.text.indexOf("")>=0;let x=0;for(let I=0;I<i.length();I++){const A=i.getSection(I),D=i.getCharCode(I);if(cc[D]||(x+=Ld(D,A,s,l,e,d)),I<i.length()-1){const R=!((S=D)<11904||!(De["Bopomofo Extended"](S)||De.Bopomofo(S)||De["CJK Compatibility Forms"](S)||De["CJK Compatibility Ideographs"](S)||De["CJK Compatibility"](S)||De["CJK Radicals Supplement"](S)||De["CJK Strokes"](S)||De["CJK Symbols and Punctuation"](S)||De["CJK Unified Ideographs Extension A"](S)||De["CJK Unified Ideographs"](S)||De["Enclosed CJK Letters and Months"](S)||De["Halfwidth and Fullwidth Forms"](S)||De.Hiragana(S)||De["Ideographic Description Characters"](S)||De["Kangxi Radicals"](S)||De["Katakana Phonetic Extensions"](S)||De.Katakana(S)||De["Vertical Forms"](S)||De["Yi Radicals"](S)||De["Yi Syllables"](S)));(N_[D]||R||A.imageName||I!==i.length()-2&&j_[i.getCharCode(I+1)])&&p.push(Bd(I+1,x,f,p,U_(D,i.getCharCode(I+1),R&&_),!1))}}var S;return Fd(Bd(i.length(),x,f,p,0,!0))}function Ph(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 $_(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 q_(i,e,r){const{horizontalAlign:s,verticalAlign:l}=Ph(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 Od(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",_=(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(_==="proportional"){if(f==="stretchOnly"&&d/p<x||f==="proportional"){const S=Math.ceil(p*x);s*=S/d,d=S}}else if(f==="proportional"&&_==="stretchOnly"&&x!==0&&d/p>x){const S=Math.ceil(d/x);l*=S/p,p=S}return{x1:s,y1:l,x2:s+d,y2:l+p}}function Vd(i,e,r,s,l,d){const p=i.image;let f;if(p.content){const $=p.content,W=p.pixelRatio||1;f=[$[0]/W,$[1]/W,p.displaySize[0]-$[2]/W,p.displaySize[1]-$[3]/W]}const _=e.left*d,x=e.right*d;let S,I,A,D;r==="width"||r==="both"?(D=l[0]+_-s[3],I=l[0]+x+s[1]):(D=l[0]+(_+x-p.displaySize[0])/2,I=D+p.displaySize[0]);const R=e.top*d,O=e.bottom*d;return r==="height"||r==="both"?(S=l[1]+R-s[0],A=l[1]+O+s[2]):(S=l[1]+(R+O-p.displaySize[1])/2,A=S+p.displaySize[1]),{image:p,top:S,right:I,bottom:A,left:D,collisionPadding:f}}const Ya=255,Qr=128,Xn=Ya*Qr;function Nd(i,e){const{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new At(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],_=s[p];return r.kind==="composite"?{kind:"composite",minZoom:f,maxZoom:_,interpolationType:l}:{kind:"camera",minZoom:f,maxZoom:_,minSize:r.evaluate(new At(f)),maxSize:r.evaluate(new At(_)),interpolationType:l}}}function kh(i,e,r){let s="never";const l=i.get(e);return l?s=l:i.get(r)&&(s="always"),s}const Z_=Hn.VectorTileFeature.types,G_=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function hc(i,e,r,s,l,d,p,f,_,x,S,I,A){const D=f?Math.min(Xn,Math.round(f[0])):0,R=f?Math.min(Xn,Math.round(f[1])):0;i.emplaceBack(e,r,Math.round(32*s),Math.round(32*l),d,p,(D<<1)+(_?1:0),R,16*x,16*S,256*I,256*A)}function Eh(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 H_(i){for(const e of i.sections)if(Da(e.text))return!0;return!1}class Ah{constructor(e){this.layoutVertexArray=new sr,this.indexArray=new ri,this.programConfigurations=e,this.segments=new ti,this.dynamicLayoutVertexArray=new Kr,this.opacityVertexArray=new $n,this.hasVisibleVertices=!1,this.placedSymbolArray=new Rt}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,S_.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,T_.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,G_,!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",Ah);class Ch{constructor(e,r,s){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new s,this.segments=new ti,this.collisionVertexArray=new gi}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,I_.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Oe("CollisionBuffers",Ch);class zo{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=hh([]),this.placementViewportMatrix=hh([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Nd(this.zoom,r["text-size"]),this.iconSizeData=Nd(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=kh(s,"text-overlap","text-allow-overlap")!=="never"||kh(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=>T.ai[p])),this.stateDependentLayerIds=this.layers.filter(p=>p.isStateDependent()).map(p=>p.id),this.sourceID=e.sourceID}createArrays(){this.text=new Ah(new Ms(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Ah(new Ms(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Bt,this.lineVertexArray=new Mi,this.symbolInstances=new rr,this.textAnchorOffsets=new pi}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=Xa[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"),_=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),S=_.value.kind!=="constant"||!!_.value.value||Object.keys(_.parameters).length>0,I=d.get("symbol-sort-key");if(this.features=[],!x&&!S)return;const A=r.iconDependencies,D=r.glyphDependencies,R=r.availableImages,O=new At(this.zoom);for(const{feature:$,id:W,index:oe,sourceLayerIndex:Y}of e){const ie=l._featureFilter.needGeometry,de=Ds($,ie);if(!l._featureFilter.filter(O,de,s))continue;let be,Re;if(ie||(de.geometry=zs($)),x){const Me=l.getValueAndResolveTokens("text-field",de,s,R),Ae=Oi.factory(Me),qe=this.hasRTLText=this.hasRTLText||H_(Ae);(!qe||Jr.getRTLTextPluginStatus()==="unavailable"||qe&&Jr.isParsed())&&(be=k_(Ae,l,de))}if(S){const Me=l.getValueAndResolveTokens("icon-image",de,s,R);Re=Me instanceof ui?Me:ui.fromString(Me)}if(!be&&!Re)continue;const Xe=this.sortFeaturesByKey?I.evaluate(de,{},s):void 0;if(this.features.push({id:W,text:be,icon:Re,index:oe,sourceLayerIndex:Y,geometry:de.geometry,properties:$.properties,type:Z_[$.type],sortKey:Xe}),Re&&(A[Re.name]=!0),be){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(T.ai.vertical)>=0;for(const qe of be.sections)if(qe.image)A[qe.image.name]=!0;else{const Ne=Ma(be.toString()),Fe=qe.fontStack||Me,me=D[Fe]=D[Fe]||{};this.calculateGlyphDependencies(qe.text,me,Ae,this.allowVerticalPlacement,Ne)}}}d.get("symbol-placement")==="line"&&(this.features=function($){const W={},oe={},Y=[];let ie=0;function de(Me){Y.push($[Me]),ie++}function be(Me,Ae,qe){const Ne=oe[Me];return delete oe[Me],oe[Ae]=Ne,Y[Ne].geometry[0].pop(),Y[Ne].geometry[0]=Y[Ne].geometry[0].concat(qe[0]),Ne}function Re(Me,Ae,qe){const Ne=W[Ae];return delete W[Ae],W[Me]=Ne,Y[Ne].geometry[0].shift(),Y[Ne].geometry[0]=qe[0].concat(Y[Ne].geometry[0]),Ne}function Xe(Me,Ae,qe){const Ne=qe?Ae[0][Ae[0].length-1]:Ae[0][0];return`${Me}:${Ne.x}:${Ne.y}`}for(let Me=0;Me<$.length;Me++){const Ae=$[Me],qe=Ae.geometry,Ne=Ae.text?Ae.text.toString():null;if(!Ne){de(Me);continue}const Fe=Xe(Ne,qe),me=Xe(Ne,qe,!0);if(Fe in oe&&me in W&&oe[Fe]!==W[me]){const Ge=Re(Fe,me,qe),$e=be(Fe,me,Y[Ge].geometry);delete W[Fe],delete oe[me],oe[Xe(Ne,Y[$e].geometry,!0)]=$e,Y[Ge].geometry=null}else Fe in oe?be(Fe,me,qe):me in W?Re(Fe,me,qe):(de(Me),W[Fe]=ie-1,oe[me]=ie-1)}return Y.filter(Me=>Me.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort(($,W)=>$.sortKey-W.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 _=p[f];this.lineVertexArray.emplaceBack(_.x,_.y,_.tileUnitDistanceFromAnchor)}}return{lineStartIndex:s,lineLength:this.lineVertexArray.length-s}}addSymbols(e,r,s,l,d,p,f,_,x,S,I,A){const D=e.indexArray,R=e.layoutVertexArray,O=e.segments.prepareSegment(4*r.length,R,D,this.canOverlap?p.sortKey:void 0),$=this.glyphOffsetArray.length,W=O.vertexLength,oe=this.allowVerticalPlacement&&f===T.ai.vertical?Math.PI/2:0,Y=p.text&&p.text.sections;for(let ie=0;ie<r.length;ie++){const{tl:de,tr:be,bl:Re,br:Xe,tex:Me,pixelOffsetTL:Ae,pixelOffsetBR:qe,minFontScaleX:Ne,minFontScaleY:Fe,glyphOffset:me,isSDF:Ge,sectionIndex:$e}=r[ie],et=O.vertexLength,It=me[1];hc(R,_.x,_.y,de.x,It+de.y,Me.x,Me.y,s,Ge,Ae.x,Ae.y,Ne,Fe),hc(R,_.x,_.y,be.x,It+be.y,Me.x+Me.w,Me.y,s,Ge,qe.x,Ae.y,Ne,Fe),hc(R,_.x,_.y,Re.x,It+Re.y,Me.x,Me.y+Me.h,s,Ge,Ae.x,qe.y,Ne,Fe),hc(R,_.x,_.y,Xe.x,It+Xe.y,Me.x+Me.w,Me.y+Me.h,s,Ge,qe.x,qe.y,Ne,Fe),Eh(e.dynamicLayoutVertexArray,_,oe),D.emplaceBack(et,et+1,et+2),D.emplaceBack(et+1,et+2,et+3),O.vertexLength+=4,O.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(me[0]),ie!==r.length-1&&$e===r[ie+1].sectionIndex||e.programConfigurations.populatePaintArrays(R.length,p,p.index,{},A,Y&&Y[$e])}e.placedSymbolArray.emplaceBack(_.x,_.y,$,this.glyphOffsetArray.length-$,W,x,S,_.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 _=d.segments.prepareSegment(4,d.layoutVertexArray,d.indexArray),x=_.vertexLength,S=d.layoutVertexArray,I=d.collisionVertexArray,A=f.anchorX,D=f.anchorY;this._addCollisionDebugVertex(S,I,p,A,D,new le(e,r)),this._addCollisionDebugVertex(S,I,p,A,D,new le(s,r)),this._addCollisionDebugVertex(S,I,p,A,D,new le(s,l)),this._addCollisionDebugVertex(S,I,p,A,D,new le(e,l)),_.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),_.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 Ch(mi,Sd.members,Nt),this.iconCollisionBox=new Ch(mi,Sd.members,Nt);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,_,x){const S={};for(let I=r;I<s;I++){const A=e.get(I);S.textBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},S.textFeatureIndex=A.featureIndex;break}for(let I=l;I<d;I++){const A=e.get(I);S.verticalTextBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},S.verticalTextFeatureIndex=A.featureIndex;break}for(let I=p;I<f;I++){const A=e.get(I);S.iconBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},S.iconFeatureIndex=A.featureIndex;break}for(let I=_;I<x;I++){const A=e.get(I);S.verticalIconBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},S.verticalIconFeatureIndex=A.featureIndex;break}return S}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 _=this.symbolInstances.get(f);l.push(0|Math.round(r*_.anchorX+s*_.anchorY)),d.push(_.featureIndex)}return p.sort((f,_)=>l[f]-l[_]||d[_]-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 jd,Ud;Oe("SymbolBucket",zo,{omit:["layers","collisionBoxArray","features","compareText"]}),zo.MAX_GLYPHS=65535,zo.addDynamicAttributes=Eh;var Mh={get paint(){return Ud=Ud||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 jd=jd||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 $d{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",$d,{omit:["defaultValue"]});class uc extends h{constructor(e){super(e,Mh)}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,_){return _.replace(/{([^{}]+)}/g,(x,S)=>f&&S in f?String(f[S]):"")}(r.properties,d)}createBucket(e){return new zo(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of Mh.paint.overridableProperties){if(!uc.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),s=new $d(r),l=new ho(s,r.property.specification);let d=null;d=r.value.kind==="constant"||r.value.kind==="source"?new ha("source",l):new ua("composite",l,r.value.zoomStops),this.paint._values[e]=new vr(r.property,d,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,s){return!(!this.layout||r.isDataDriven()||s.isDataDriven())&&uc.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const s=e.get("text-field"),l=Mh.paint.properties[r];let d=!1;const p=f=>{for(const _ of f)if(l.overrides&&l.overrides.hasOverride(_))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)===Ar?p(x.value.sections):x instanceof Ks?p(x.sections):x.eachChild(f))},_=s.value;_._styleExpression&&f(_._styleExpression.expression)}return d}}let qd;var W_={get paint(){return qd=qd||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 X_ extends h{constructor(e){super(e,W_)}}let Zd;var J_={get paint(){return Zd=Zd||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 K_ extends h{constructor(e){super(e,J_)}}class Y_ 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 Q_{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 zh=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(Gt(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 zh*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 Gd=2*Math.PI*zh;function Hd(i){return Gd*Math.cos(i*Math.PI/180)}function Wd(i){return(180+i)/360}function Xd(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function Jd(i,e){return i/Hd(e)}function Dh(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class dc{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 dc(Wd(s.lng),Xd(s.lat),Jd(r,s.lat))}toLngLat(){return new Jn(360*this.x-180,Dh(this.y))}toAltitude(){return this.z*Hd(Dh(this.y))}meterInMercatorCoordinateUnits(){return 1/Gd*(e=Dh(this.y),1/Math.cos(e*Math.PI/180));var e}}function Kd(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 Lh{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=Qa(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,_=Kd(256*(d=this.x),256*(p=Math.pow(2,f)-p-1),f),x=Kd(256*(d+1),256*(p+1),f),_[0]+","+_[1]+","+x[0]+","+x[1]);var d,p,f,_,x;const S=function(I,A,D){let R,O="";for(let $=I;$>0;$--)R=1<<$-1,O+=(A&R?1:0)+(D&R?2:0);return O}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(s==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,S).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 Yd{constructor(e,r){this.wrap=e,this.canonical=r,this.key=Qa(e,r.z,r.z,r.x,r.y)}}class ar{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 Lh(s,+l,+d),this.key=Qa(r,e,s,l,d)}clone(){return new ar(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 ar(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ar(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?Qa(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Qa(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 ar(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 ar(r,this.wrap,r,s,l),new ar(r,this.wrap,r,s+1,l),new ar(r,this.wrap,r,s,l+1),new ar(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 ar(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new ar(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 Yd(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new dc(e.x-this.wrap,e.y))}}function Qa(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",Lh),Oe("OverscaledTileID",ar,{omit:["posMatrix"]});class Qd{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 li(`"${s}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=r.height;const _=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),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<_;x++)this.data[this._idx(-1,x)]=this.data[this._idx(0,x)],this.data[this._idx(_,x)]=this.data[this._idx(_-1,x)],this.data[this._idx(x,-1)]=this.data[this._idx(x,0)],this.data[this._idx(x,_)]=this.data[this._idx(x,_-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(_,-1)]=this.data[this._idx(_-1,0)],this.data[this._idx(-1,_)]=this.data[this._idx(0,_-1)],this.data[this._idx(_,_)]=this.data[this._idx(_-1,_-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let x=0;x<_;x++)for(let S=0;S<_;S++){const I=this.get(x,S);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 or({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 _=-r*this.dim,x=-s*this.dim;for(let S=p;S<f;S++)for(let I=l;I<d;I++)this.data[this._idx(I,S)]=e.data[this._idx(I+_,S+x)]}}Oe("DEMData",Qd);class ep{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 tp{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 ip{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 nr,this.promoteId=r}insert(e,r,s,l,d,p){const f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,l,d);const _=p?this.grid3D:this.grid;for(let x=0;x<r.length;x++){const S=r[x],I=[1/0,1/0,-1/0,-1/0];for(let A=0;A<S.length;A++){const D=S[A];I[0]=Math.min(I[0],D.x),I[1]=Math.min(I[1],D.y),I[2]=Math.max(I[2],D.x),I[3]=Math.max(I[3],D.y)}I[0]<Qt&&I[1]<Qt&&I[2]>=0&&I[3]>=0&&_.insert(f,I[0],I[1],I[2],I[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Hn.VectorTile(new wh(this.rawTileData)).layers,this.sourceLayerCoder=new ep(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),_=e.queryGeometry,x=e.queryPadding*p,S=np(_),I=this.grid.query(S.minX-x,S.minY-x,S.maxX+x,S.maxY+x),A=np(e.cameraQueryGeometry),D=this.grid3D.query(A.minX-x,A.minY-x,A.maxX+x,A.maxY+x,($,W,oe,Y)=>function(ie,de,be,Re,Xe){for(const Ae of ie)if(de<=Ae.x&&be<=Ae.y&&Re>=Ae.x&&Xe>=Ae.y)return!0;const Me=[new le(de,be),new le(de,Xe),new le(Re,Xe),new le(Re,be)];if(ie.length>2){for(const Ae of Me)if(Io(ie,Ae))return!0}for(let Ae=0;Ae<ie.length-1;Ae++)if(Dg(ie[Ae],ie[Ae+1],Me))return!0;return!1}(e.cameraQueryGeometry,$-x,W-x,oe+x,Y+x));for(const $ of D)I.push($);I.sort(ey);const R={};let O;for(let $=0;$<I.length;$++){const W=I[$];if(W===O)continue;O=W;const oe=this.featureIndexArray.get(W);let Y=null;this.loadMatchingFeature(R,oe.bucketIndex,oe.sourceLayerIndex,oe.featureIndex,f,d.layers,d.availableImages,r,s,l,(ie,de,be)=>(Y||(Y=zs(ie)),de.queryIntersectsFeature(_,ie,be,Y,this.z,e.transform,p,e.pixelPosMatrix)))}return R}loadMatchingFeature(e,r,s,l,d,p,f,_,x,S,I){const A=this.bucketLayerIDs[r];if(p&&!function($,W){for(let oe=0;oe<$.length;oe++)if(W.indexOf($[oe])>=0)return!0;return!1}(p,A))return;const D=this.sourceLayerCoder.decode(s),R=this.vtLayers[D].feature(l);if(d.needGeometry){const $=Ds(R,!0);if(!d.filter(new At(this.tileID.overscaledZ),$,this.tileID.canonical))return}else if(!d.filter(new At(this.tileID.overscaledZ),R))return;const O=this.getId(R,D);for(let $=0;$<A.length;$++){const W=A[$];if(p&&p.indexOf(W)<0)continue;const oe=_[W];if(!oe)continue;let Y={};O&&S&&(Y=S.getState(oe.sourceLayer||"_geojsonTileLayer",O));const ie=jt({},x[W]);ie.paint=rp(ie.paint,oe.paint,R,Y,f),ie.layout=rp(ie.layout,oe.layout,R,Y,f);const de=!I||I(R,oe,Y);if(!de)continue;const be=new tp(R,this.z,this.x,this.y,O);be.layer=ie;let Re=e[W];Re===void 0&&(Re=e[W]=[]),Re.push({featureIndex:l,feature:be,intersectionZ:de})}}lookupSymbolFeatures(e,r,s,l,d,p,f,_){const x={};this.loadVTLayers();const S=Ti(d);for(const I of e)this.loadMatchingFeature(x,s,l,I,S,p,f,_,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 rp(i,e,r,s,l){return bi(i,(d,p)=>{const f=e instanceof yo?e.get(p):null;return f&&f.evaluate?f.evaluate(r,s,l):f})}function np(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 ey(i,e){return e-i}function sp(i,e,r,s,l){const d=[];for(let p=0;p<i.length;p++){const f=i[p];let _;for(let x=0;x<f.length-1;x++){let S=f[x],I=f[x+1];S.x<e&&I.x<e||(S.x<e?S=new le(e,S.y+(e-S.x)/(I.x-S.x)*(I.y-S.y))._round():I.x<e&&(I=new le(e,S.y+(e-S.x)/(I.x-S.x)*(I.y-S.y))._round()),S.y<r&&I.y<r||(S.y<r?S=new le(S.x+(r-S.y)/(I.y-S.y)*(I.x-S.x),r)._round():I.y<r&&(I=new le(S.x+(r-S.y)/(I.y-S.y)*(I.x-S.x),r)._round()),S.x>=s&&I.x>=s||(S.x>=s?S=new le(s,S.y+(s-S.x)/(I.x-S.x)*(I.y-S.y))._round():I.x>=s&&(I=new le(s,S.y+(s-S.x)/(I.x-S.x)*(I.y-S.y))._round()),S.y>=l&&I.y>=l||(S.y>=l?S=new le(S.x+(l-S.y)/(I.y-S.y)*(I.x-S.x),l)._round():I.y>=l&&(I=new le(S.x+(l-S.y)/(I.y-S.y)*(I.x-S.x),l)._round()),_&&S.equals(_[_.length-1])||(_=[S],d.push(_)),_.push(I)))))}}return d}Oe("FeatureIndex",ip,{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 op(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 _=[];let x=0;for(;f<r/2;){const S=i[p],I=i[p+1];if(!I)return!1;let A=i[p-1].angleTo(S)-S.angleTo(I);for(A=Math.abs((A+3*Math.PI)%(2*Math.PI)-Math.PI),_.push({distance:f,angleDelta:A}),x+=A;f-_[0].distance>s;)x-=_.shift().angleDelta;if(x>l)return!1;p++,f+=S.dist(I)}return!0}function ap(i){let e=0;for(let r=0;r<i.length-1;r++)e+=i[r].dist(i[r+1]);return e}function lp(i,e,r){return i?.6*e*r:0}function cp(i,e){return Math.max(i?i.right-i.left:0,e?e.right-e.left:0)}function ty(i,e,r,s,l,d){const p=lp(r,l,d),f=cp(r,s)*d;let _=0;const x=ap(i)/2;for(let S=0;S<i.length-1;S++){const I=i[S],A=i[S+1],D=I.dist(A);if(_+D>x){const R=(x-_)/D,O=ji.number(I.x,A.x,R),$=ji.number(I.y,A.y,R),W=new Kn(O,$,A.angleTo(I),S);return W._round(),!p||op(i,W,f,p,e)?W:void 0}_+=D}}function iy(i,e,r,s,l,d,p,f,_){const x=lp(s,d,p),S=cp(s,l),I=S*p,A=i[0].x===0||i[0].x===_||i[0].y===0||i[0].y===_;return e-I<e/4&&(e=I+e/4),hp(i,A?e/2*f%e:(S/2+2*d)*p*f%e,e,x,r,I,A,!1,_)}function hp(i,e,r,s,l,d,p,f,_){const x=d/2,S=ap(i);let I=0,A=e-r,D=[];for(let R=0;R<i.length-1;R++){const O=i[R],$=i[R+1],W=O.dist($),oe=$.angleTo(O);for(;A+r<I+W;){A+=r;const Y=(A-I)/W,ie=ji.number(O.x,$.x,Y),de=ji.number(O.y,$.y,Y);if(ie>=0&&ie<_&&de>=0&&de<_&&A-x>=0&&A+x<=S){const be=new Kn(ie,de,oe,R);be._round(),s&&!op(i,be,d,s,l)||D.push(be)}}I+=W}return f||D.length||p||(D=hp(i,I/2,r,s,l,d,p,!0,_)),D}Oe("Anchor",Kn);const Do=qi;function up(i,e,r,s){const l=[],d=i.image,p=d.pixelRatio,f=d.paddedRect.w-2*Do,_=d.paddedRect.h-2*Do;let x={x1:i.left,y1:i.top,x2:i.right,y2:i.bottom};const S=d.stretchX||[[0,f]],I=d.stretchY||[[0,_]],A=(me,Ge)=>me+Ge[1]-Ge[0],D=S.reduce(A,0),R=I.reduce(A,0),O=f-D,$=_-R;let W=0,oe=D,Y=0,ie=R,de=0,be=O,Re=0,Xe=$;if(d.content&&s){const me=d.content,Ge=me[2]-me[0],$e=me[3]-me[1];(d.textFitWidth||d.textFitHeight)&&(x=Od(i)),W=pc(S,0,me[0]),Y=pc(I,0,me[1]),oe=pc(S,me[0],me[2]),ie=pc(I,me[1],me[3]),de=me[0]-W,Re=me[1]-Y,be=Ge-oe,Xe=$e-ie}const Me=x.x1,Ae=x.y1,qe=x.x2-Me,Ne=x.y2-Ae,Fe=(me,Ge,$e,et)=>{const It=fc(me.stretch-W,oe,qe,Me),Tt=mc(me.fixed-de,be,me.stretch,D),ni=fc(Ge.stretch-Y,ie,Ne,Ae),br=mc(Ge.fixed-Re,Xe,Ge.stretch,R),yi=fc($e.stretch-W,oe,qe,Me),Ht=mc($e.fixed-de,be,$e.stretch,D),Di=fc(et.stretch-Y,ie,Ne,Ae),Li=mc(et.fixed-Re,Xe,et.stretch,R),Ri=new le(It,ni),Wt=new le(yi,ni),si=new le(yi,Di),Pi=new le(It,Di),xi=new le(Tt/p,br/p),Bi=new le(Ht/p,Li/p),vi=e*Math.PI/180;if(vi){const gt=Math.sin(vi),Ct=Math.cos(vi),Ft=[Ct,-gt,gt,Ct];Ri._matMult(Ft),Wt._matMult(Ft),Pi._matMult(Ft),si._matMult(Ft)}const lr=me.stretch+me.fixed,Zi=Ge.stretch+Ge.fixed;return{tl:Ri,tr:Wt,bl:Pi,br:si,tex:{x:d.paddedRect.x+Do+lr,y:d.paddedRect.y+Do+Zi,w:$e.stretch+$e.fixed-lr,h:et.stretch+et.fixed-Zi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:xi,pixelOffsetBR:Bi,minFontScaleX:be/p/qe,minFontScaleY:Xe/p/Ne,isSDF:r}};if(s&&(d.stretchX||d.stretchY)){const me=dp(S,O,D),Ge=dp(I,$,R);for(let $e=0;$e<me.length-1;$e++){const et=me[$e],It=me[$e+1];for(let Tt=0;Tt<Ge.length-1;Tt++)l.push(Fe(et,Ge[Tt],It,Ge[Tt+1]))}}else l.push(Fe({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:f+1},{fixed:0,stretch:_+1}));return l}function pc(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 dp(i,e,r){const s=[{fixed:-Do,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+Do,stretch:r}),s}function fc(i,e,r,s){return i/e*r+s}function mc(i,e,r,s){return i-e*r/s}class gc{constructor(e,r,s,l,d,p,f,_,x,S){var I;if(this.boxStartIndex=e.length,x){let A=p.top,D=p.bottom;const R=p.collisionPadding;R&&(A-=R[1],D+=R[3]);let O=D-A;O>0&&(O=Math.max(10,O),this.circleDiameter=O)}else{const A=!((I=p.image)===null||I===void 0)&&I.content&&(p.image.textFitWidth||p.image.textFitHeight)?Od(p):{x1:p.left,y1:p.top,x2:p.right,y2:p.bottom};A.y1=A.y1*f-_[0],A.y2=A.y2*f+_[2],A.x1=A.x1*f-_[3],A.x2=A.x2*f+_[1];const D=p.collisionPadding;if(D&&(A.x1-=D[0]*f,A.y1-=D[1]*f,A.x2+=D[2]*f,A.y2+=D[3]*f),S){const R=new le(A.x1,A.y1),O=new le(A.x2,A.y1),$=new le(A.x1,A.y2),W=new le(A.x2,A.y2),oe=S*Math.PI/180;R._rotate(oe),O._rotate(oe),$._rotate(oe),W._rotate(oe),A.x1=Math.min(R.x,O.x,$.x,W.x),A.x2=Math.max(R.x,O.x,$.x,W.x),A.y1=Math.min(R.y,O.y,$.y,W.y),A.y2=Math.max(R.y,O.y,$.y,W.y)}e.emplaceBack(r.x,r.y,A.x1,A.y1,A.x2,A.y2,s,l,d)}this.boxEndIndex=e.length}}class ry{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 ny(i,e=1,r=!1){let s=1/0,l=1/0,d=-1/0,p=-1/0;const f=i[0];for(let D=0;D<f.length;D++){const R=f[D];(!D||R.x<s)&&(s=R.x),(!D||R.y<l)&&(l=R.y),(!D||R.x>d)&&(d=R.x),(!D||R.y>p)&&(p=R.y)}const _=Math.min(d-s,p-l);let x=_/2;const S=new ry([],sy);if(_===0)return new le(s,l);for(let D=s;D<d;D+=_)for(let R=l;R<p;R+=_)S.push(new Lo(D+x,R+x,x,i));let I=function(D){let R=0,O=0,$=0;const W=D[0];for(let oe=0,Y=W.length,ie=Y-1;oe<Y;ie=oe++){const de=W[oe],be=W[ie],Re=de.x*be.y-be.x*de.y;O+=(de.x+be.x)*Re,$+=(de.y+be.y)*Re,R+=3*Re}return new Lo(O/R,$/R,0,D)}(i),A=S.length;for(;S.length;){const D=S.pop();(D.d>I.d||!I.d)&&(I=D,r&&console.log("found best %d after %d probes",Math.round(1e4*D.d)/1e4,A)),D.max-I.d<=e||(x=D.h/2,S.push(new Lo(D.p.x-x,D.p.y-x,x,i)),S.push(new Lo(D.p.x+x,D.p.y-x,x,i)),S.push(new Lo(D.p.x-x,D.p.y+x,x,i)),S.push(new Lo(D.p.x+x,D.p.y+x,x,i)),A+=4)}return r&&(console.log(`num probes: ${A}`),console.log(`best distance: ${I.d}`)),I.p}function sy(i,e){return e.max-i.max}function Lo(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 _=0;_<d.length;_++){const x=d[_];for(let S=0,I=x.length,A=I-1;S<I;A=S++){const D=x[S],R=x[A];D.y>l.y!=R.y>l.y&&l.x<(R.x-D.x)*(l.y-D.y)/(R.y-D.y)+D.x&&(p=!p),f=Math.min(f,Xu(l,D,R))}}return(p?1:-1)*Math.sqrt(f)}(this.p,s),this.max=this.d+this.h*Math.SQRT2}var _i;T.ar=void 0,(_i=T.ar||(T.ar={}))[_i.center=1]="center",_i[_i.left=2]="left",_i[_i.right=3]="right",_i[_i.top=4]="top",_i[_i.bottom=5]="bottom",_i[_i["top-left"]=6]="top-left",_i[_i["top-right"]=7]="top-right",_i[_i["bottom-left"]=8]="bottom-left",_i[_i["bottom-right"]=9]="bottom-right";const Yn=7,Rh=Number.POSITIVE_INFINITY;function pp(i,e){return e[1]!==Rh?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 fp(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,_=[];for(let x=0;x<f.length;x+=2){const S=_[x]=f[x],I=f[x+1].map(A=>A*ii);S.startsWith("top")?I[1]-=Yn:S.startsWith("bottom")&&(I[1]+=Yn),_[x+1]=I}return new Ni(_)}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,Rh]:l.get("text-offset").evaluate(e,{},r).map(x=>x*ii);const _=[];for(const x of p)_.push(x,pp(x,f));return new Ni(_)}return null}function Bh(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 oy(i,e,r,s,l,d,p,f,_,x,S){let I=d.textMaxSize.evaluate(e,{});I===void 0&&(I=p);const A=i.layers[0].layout,D=A.get("icon-offset").evaluate(e,{},S),R=gp(r.horizontal),O=p/24,$=i.tilePixelRatio*O,W=i.tilePixelRatio*I/24,oe=i.tilePixelRatio*f,Y=i.tilePixelRatio*A.get("symbol-spacing"),ie=A.get("text-padding")*i.tilePixelRatio,de=function(me,Ge,$e,et=1){const It=me.get("icon-padding").evaluate(Ge,{},$e),Tt=It&&It.values;return[Tt[0]*et,Tt[1]*et,Tt[2]*et,Tt[3]*et]}(A,e,S,i.tilePixelRatio),be=A.get("text-max-angle")/180*Math.PI,Re=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"),Ae=Y/2,qe=A.get("icon-text-fit");let Ne;s&&qe!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Ne=Vd(s,r.vertical,qe,A.get("icon-text-fit-padding"),D,O)),R&&(s=Vd(s,R,qe,A.get("icon-text-fit-padding"),D,O)));const Fe=(me,Ge)=>{Ge.x<0||Ge.x>=Qt||Ge.y<0||Ge.y>=Qt||function($e,et,It,Tt,ni,br,yi,Ht,Di,Li,Ri,Wt,si,Pi,xi,Bi,vi,lr,Zi,gt,Ct,Ft,Ji,qt,Ro){const en=$e.addToLineVertexArray(et,It);let tn,wr,cr,ai,Sn=0,il=0,vp=0,bp=0,qh=-1,Zh=-1;const Tn={};let wp=So("");if($e.allowVerticalPlacement&&Tt.vertical){const ki=Ht.layout.get("text-rotate").evaluate(Ct,{},qt)+90;cr=new gc(Di,et,Li,Ri,Wt,Tt.vertical,si,Pi,xi,ki),yi&&(ai=new gc(Di,et,Li,Ri,Wt,yi,vi,lr,xi,ki))}if(ni){const ki=Ht.layout.get("icon-rotate").evaluate(Ct,{}),hr=Ht.layout.get("icon-text-fit")!=="none",Rs=up(ni,ki,Ji,hr),Br=yi?up(yi,ki,Ji,hr):void 0;wr=new gc(Di,et,Li,Ri,Wt,ni,vi,lr,!1,ki),Sn=4*Rs.length;const Bs=$e.iconSizeData;let rn=null;Bs.kind==="source"?(rn=[Qr*Ht.layout.get("icon-size").evaluate(Ct,{})],rn[0]>Xn&&li(`${$e.layerIds[0]}: Value for "icon-size" is >= ${Ya}. Reduce your "icon-size".`)):Bs.kind==="composite"&&(rn=[Qr*Ft.compositeIconSizes[0].evaluate(Ct,{},qt),Qr*Ft.compositeIconSizes[1].evaluate(Ct,{},qt)],(rn[0]>Xn||rn[1]>Xn)&&li(`${$e.layerIds[0]}: Value for "icon-size" is >= ${Ya}. Reduce your "icon-size".`)),$e.addSymbols($e.icon,Rs,rn,gt,Zi,Ct,T.ai.none,et,en.lineStartIndex,en.lineLength,-1,qt),qh=$e.icon.placedSymbolArray.length-1,Br&&(il=4*Br.length,$e.addSymbols($e.icon,Br,rn,gt,Zi,Ct,T.ai.vertical,et,en.lineStartIndex,en.lineLength,-1,qt),Zh=$e.icon.placedSymbolArray.length-1)}const Sp=Object.keys(Tt.horizontal);for(const ki of Sp){const hr=Tt.horizontal[ki];if(!tn){wp=So(hr.text);const Br=Ht.layout.get("text-rotate").evaluate(Ct,{},qt);tn=new gc(Di,et,Li,Ri,Wt,hr,si,Pi,xi,Br)}const Rs=hr.positionedLines.length===1;if(vp+=mp($e,et,hr,br,Ht,xi,Ct,Bi,en,Tt.vertical?T.ai.horizontal:T.ai.horizontalOnly,Rs?Sp:[ki],Tn,qh,Ft,qt),Rs)break}Tt.vertical&&(bp+=mp($e,et,Tt.vertical,br,Ht,xi,Ct,Bi,en,T.ai.vertical,["vertical"],Tn,Zh,Ft,qt));const cy=tn?tn.boxStartIndex:$e.collisionBoxArray.length,hy=tn?tn.boxEndIndex:$e.collisionBoxArray.length,uy=cr?cr.boxStartIndex:$e.collisionBoxArray.length,dy=cr?cr.boxEndIndex:$e.collisionBoxArray.length,py=wr?wr.boxStartIndex:$e.collisionBoxArray.length,fy=wr?wr.boxEndIndex:$e.collisionBoxArray.length,my=ai?ai.boxStartIndex:$e.collisionBoxArray.length,gy=ai?ai.boxEndIndex:$e.collisionBoxArray.length;let Rr=-1;const yc=(ki,hr)=>ki&&ki.circleDiameter?Math.max(ki.circleDiameter,hr):hr;Rr=yc(tn,Rr),Rr=yc(cr,Rr),Rr=yc(wr,Rr),Rr=yc(ai,Rr);const Tp=Rr>-1?1:0;Tp&&(Rr*=Ro/ii),$e.glyphOffsetArray.length>=zo.MAX_GLYPHS&&li("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Ct.sortKey!==void 0&&$e.addToSortKeyRanges($e.symbolInstances.length,Ct.sortKey);const _y=fp(Ht,Ct,qt),[yy,xy]=function(ki,hr){const Rs=ki.length,Br=hr==null?void 0:hr.values;if((Br==null?void 0:Br.length)>0)for(let Bs=0;Bs<Br.length;Bs+=2){const rn=Br[Bs+1];ki.emplaceBack(T.ar[Br[Bs]],rn[0],rn[1])}return[Rs,ki.length]}($e.textAnchorOffsets,_y);$e.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,qh,Zh,wp,cy,hy,uy,dy,py,fy,my,gy,Li,vp,bp,Sn,il,Tp,0,si,Rr,yy,xy)}(i,Ge,me,r,s,l,Ne,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,$,[ie,ie,ie,ie],Re,_,oe,de,Xe,D,e,d,x,S,p)};if(Me==="line")for(const me of sp(e.geometry,0,0,Qt,Qt)){const Ge=iy(me,Y,be,r.vertical||R,s,24,W,i.overscaling,Qt);for(const $e of Ge)R&&ay(i,R.text,Ae,$e)||Fe(me,$e)}else if(Me==="line-center"){for(const me of e.geometry)if(me.length>1){const Ge=ty(me,be,r.vertical||R,s,24,W);Ge&&Fe(me,Ge)}}else if(e.type==="Polygon")for(const me of Qs(e.geometry,0)){const Ge=ny(me,16);Fe(me[0],new Kn(Ge.x,Ge.y,0))}else if(e.type==="LineString")for(const me of e.geometry)Fe(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)Fe([Ge],new Kn(Ge.x,Ge.y,0))}function mp(i,e,r,s,l,d,p,f,_,x,S,I,A,D,R){const O=function(oe,Y,ie,de,be,Re,Xe,Me){const Ae=de.layout.get("text-rotate").evaluate(Re,{})*Math.PI/180,qe=[];for(const Ne of Y.positionedLines)for(const Fe of Ne.positionedGlyphs){if(!Fe.rect)continue;const me=Fe.rect||{};let Ge=Md+1,$e=!0,et=1,It=0;const Tt=(be||Me)&&Fe.vertical,ni=Fe.metrics.advance*Fe.scale/2;if(Me&&Y.verticalizable&&(It=Ne.lineOffset/2-(Fe.imageName?-(ii-Fe.metrics.width*Fe.scale)/2:(Fe.scale-1)*ii)),Fe.imageName){const gt=Xe[Fe.imageName];$e=gt.sdf,et=gt.pixelRatio,Ge=qi/et}const br=be?[Fe.x+ni,Fe.y]:[0,0];let yi=be?[0,0]:[Fe.x+ni+ie[0],Fe.y+ie[1]-It],Ht=[0,0];Tt&&(Ht=yi,yi=[0,0]);const Di=Fe.metrics.isDoubleResolution?2:1,Li=(Fe.metrics.left-Ge)*Fe.scale-ni+yi[0],Ri=(-Fe.metrics.top-Ge)*Fe.scale+yi[1],Wt=Li+me.w/Di*Fe.scale/et,si=Ri+me.h/Di*Fe.scale/et,Pi=new le(Li,Ri),xi=new le(Wt,Ri),Bi=new le(Li,si),vi=new le(Wt,si);if(Tt){const gt=new le(-ni,ni-Ja),Ct=-Math.PI/2,Ft=ii/2-ni,Ji=new le(5-Ja-Ft,-(Fe.imageName?Ft:0)),qt=new le(...Ht);Pi._rotateAround(Ct,gt)._add(Ji)._add(qt),xi._rotateAround(Ct,gt)._add(Ji)._add(qt),Bi._rotateAround(Ct,gt)._add(Ji)._add(qt),vi._rotateAround(Ct,gt)._add(Ji)._add(qt)}if(Ae){const gt=Math.sin(Ae),Ct=Math.cos(Ae),Ft=[Ct,-gt,gt,Ct];Pi._matMult(Ft),xi._matMult(Ft),Bi._matMult(Ft),vi._matMult(Ft)}const lr=new le(0,0),Zi=new le(0,0);qe.push({tl:Pi,tr:xi,bl:Bi,br:vi,tex:me,writingMode:Y.writingMode,glyphOffset:br,sectionIndex:Fe.sectionIndex,isSDF:$e,pixelOffsetTL:lr,pixelOffsetBR:Zi,minFontScaleX:0,minFontScaleY:0})}return qe}(0,r,f,l,d,p,s,i.allowVerticalPlacement),$=i.textSizeData;let W=null;$.kind==="source"?(W=[Qr*l.layout.get("text-size").evaluate(p,{})],W[0]>Xn&&li(`${i.layerIds[0]}: Value for "text-size" is >= ${Ya}. Reduce your "text-size".`)):$.kind==="composite"&&(W=[Qr*D.compositeTextSizes[0].evaluate(p,{},R),Qr*D.compositeTextSizes[1].evaluate(p,{},R)],(W[0]>Xn||W[1]>Xn)&&li(`${i.layerIds[0]}: Value for "text-size" is >= ${Ya}. Reduce your "text-size".`)),i.addSymbols(i.text,O,W,f,d,p,x,e,_.lineStartIndex,_.lineLength,A,R);for(const oe of S)I[oe]=i.text.placedSymbolArray.length-1;return 4*O.length}function gp(i){for(const e in i)return i[e];return null}function ay(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 _p=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Fh{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=_p[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 Fh(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=_p.indexOf(this.ArrayType),p=2*e*this.ArrayType.BYTES_PER_ELEMENT,f=e*this.IndexArrayType.BYTES_PER_ELEMENT,_=(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+_,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+p+f+_),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+_,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+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 Oh(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,_=[0,d.length-1,0],x=[];for(;_.length;){const S=_.pop()||0,I=_.pop()||0,A=_.pop()||0;if(I-A<=f){for(let $=A;$<=I;$++){const W=p[2*$],oe=p[2*$+1];W>=e&&W<=s&&oe>=r&&oe<=l&&x.push(d[$])}continue}const D=A+I>>1,R=p[2*D],O=p[2*D+1];R>=e&&R<=s&&O>=r&&O<=l&&x.push(d[D]),(S===0?e<=R:r<=O)&&(_.push(A),_.push(D-1),_.push(1-S)),(S===0?s>=R:l>=O)&&(_.push(D+1),_.push(I),_.push(1-S))}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],_=[],x=s*s;for(;f.length;){const S=f.pop()||0,I=f.pop()||0,A=f.pop()||0;if(I-A<=p){for(let $=A;$<=I;$++)xp(d[2*$],d[2*$+1],e,r)<=x&&_.push(l[$]);continue}const D=A+I>>1,R=d[2*D],O=d[2*D+1];xp(R,O,e,r)<=x&&_.push(l[D]),(S===0?e-s<=R:r-s<=O)&&(f.push(A),f.push(D-1),f.push(1-S)),(S===0?e+s>=R:r+s>=O)&&(f.push(D+1),f.push(I),f.push(1-S))}return _}}function Oh(i,e,r,s,l,d){if(l-s<=r)return;const p=s+l>>1;yp(i,e,p,s,l,d),Oh(i,e,r,s,p-1,1-d),Oh(i,e,r,p+1,l,1-d)}function yp(i,e,r,s,l,d){for(;l>s;){if(l-s>600){const x=l-s+1,S=r-s+1,I=Math.log(x),A=.5*Math.exp(2*I/3),D=.5*Math.sqrt(I*A*(x-A)/x)*(S-x/2<0?-1:1);yp(i,e,r,Math.max(s,Math.floor(r-S*A/x+D)),Math.min(l,Math.floor(r+(x-S)*A/x+D)),d)}const p=e[2*r+d];let f=s,_=l;for(el(i,e,s,r),e[2*l+d]>p&&el(i,e,s,l);f<_;){for(el(i,e,f,_),f++,_--;e[2*f+d]<p;)f++;for(;e[2*_+d]>p;)_--}e[2*s+d]===p?el(i,e,s,_):(_++,el(i,e,_,l)),_<=r&&(s=_+1),r<=_&&(l=_-1)}}function el(i,e,r,s){Vh(i,r,s),Vh(e,2*r,2*s),Vh(e,2*r+1,2*s+1)}function Vh(i,e,r){const s=i[e];i[e]=i[r],i[r]=s}function xp(i,e,r,s){const l=i-r,d=e-s;return l*l+d*d}var Nh;T.bf=void 0,(Nh=T.bf||(T.bf={})).create="create",Nh.load="load",Nh.fullLoad="fullLoad";let _c=null,tl=[];const jh=1e3/60,Uh="loadTime",$h="fullLoadTime",ly={mark(i){performance.mark(i)},frame(i){const e=i;_c!=null&&tl.push(e-_c),_c=e},clearMetrics(){_c=null,tl=[],performance.clearMeasures(Uh),performance.clearMeasures($h);for(const i in T.bf)performance.clearMarks(T.bf[i])},getPerformanceMetrics(){performance.measure(Uh,T.bf.create,T.bf.load),performance.measure($h,T.bf.create,T.bf.fullLoad);const i=performance.getEntriesByName(Uh)[0].duration,e=performance.getEntriesByName($h)[0].duration,r=tl.length,s=1/(tl.reduce((d,p)=>d+p,0)/r/1e3),l=tl.filter(d=>d>jh).reduce((d,p)=>d+(p-jh)/jh,0);return{loadTime:i,fullLoadTime:e,fps:s,percentDroppedFrames:l/(r+l)*100,totalFrames:r}}};T.$=class extends F{},T.A=Po,T.B=Ea,T.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},T.D=Ze,T.E=An,T.F=class{constructor(i,e){this.target=i,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Q_(()=>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=Ir(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:Es(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(Ir(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(xr(e.error)):l.resolve(xr(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=xr(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?Es(e):null,data:Es(r,s)};this.target.postMessage(l,{transfer:s})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},T.G=En,T.H=function(){var i=new Po(16);return Po!=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},T.I=Th,T.J=function(i,e,r){var s,l,d,p,f,_,x,S,I,A,D,R,O=r[0],$=r[1],W=r[2];return e===i?(i[12]=e[0]*O+e[4]*$+e[8]*W+e[12],i[13]=e[1]*O+e[5]*$+e[9]*W+e[13],i[14]=e[2]*O+e[6]*$+e[10]*W+e[14],i[15]=e[3]*O+e[7]*$+e[11]*W+e[15]):(l=e[1],d=e[2],p=e[3],f=e[4],_=e[5],x=e[6],S=e[7],I=e[8],A=e[9],D=e[10],R=e[11],i[0]=s=e[0],i[1]=l,i[2]=d,i[3]=p,i[4]=f,i[5]=_,i[6]=x,i[7]=S,i[8]=I,i[9]=A,i[10]=D,i[11]=R,i[12]=s*O+f*$+I*W+e[12],i[13]=l*O+_*$+A*W+e[13],i[14]=d*O+x*$+D*W+e[14],i[15]=p*O+S*$+R*W+e[15]),i},T.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},T.L=Qu,T.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},T.N=Jn,T.O=Wd,T.P=le,T.Q=Xd,T.R=or,T.S=ar,T.T=jn,T.U=pt,T.V=Mt,T.W=sn,T.X=Qt,T.Y=w,T.Z=dc,T._=c,T.a=Vr,T.a$=function(i,e){var r=i[0],s=i[1],l=i[2],d=i[3],p=i[4],f=i[5],_=i[6],x=i[7],S=i[8],I=i[9],A=i[10],D=i[11],R=i[12],O=i[13],$=i[14],W=i[15],oe=e[0],Y=e[1],ie=e[2],de=e[3],be=e[4],Re=e[5],Xe=e[6],Me=e[7],Ae=e[8],qe=e[9],Ne=e[10],Fe=e[11],me=e[12],Ge=e[13],$e=e[14],et=e[15];return Math.abs(r-oe)<=zi*Math.max(1,Math.abs(r),Math.abs(oe))&&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-be)<=zi*Math.max(1,Math.abs(p),Math.abs(be))&&Math.abs(f-Re)<=zi*Math.max(1,Math.abs(f),Math.abs(Re))&&Math.abs(_-Xe)<=zi*Math.max(1,Math.abs(_),Math.abs(Xe))&&Math.abs(x-Me)<=zi*Math.max(1,Math.abs(x),Math.abs(Me))&&Math.abs(S-Ae)<=zi*Math.max(1,Math.abs(S),Math.abs(Ae))&&Math.abs(I-qe)<=zi*Math.max(1,Math.abs(I),Math.abs(qe))&&Math.abs(A-Ne)<=zi*Math.max(1,Math.abs(A),Math.abs(Ne))&&Math.abs(D-Fe)<=zi*Math.max(1,Math.abs(D),Math.abs(Fe))&&Math.abs(R-me)<=zi*Math.max(1,Math.abs(R),Math.abs(me))&&Math.abs(O-Ge)<=zi*Math.max(1,Math.abs(O),Math.abs(Ge))&&Math.abs($-$e)<=zi*Math.max(1,Math.abs($),Math.abs($e))&&Math.abs(W-et)<=zi*Math.max(1,Math.abs(W),Math.abs(et))},T.a0=ti,T.a1=Lh,T.a2=Ie,T.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)}})},T.a4=function(){return Fr++},T.a5=st,T.a6=zo,T.a7=Ti,T.a8=Ds,T.a9=At,T.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},T.aB=function(i){if(i.type==="custom")return new Y_(i);switch(i.type){case"background":return new X_(i);case"circle":return new Bg(i);case"fill":return new Qg(i);case"fill-extrusion":return new f_(i);case"heatmap":return new Og(i);case"hillshade":return new Ng(i);case"line":return new w_(i);case"raster":return new K_(i);case"symbol":return new uc(i)}},T.aC=wt,T.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,_,x){let S;for(S in f=f||{},p=p||{})Object.prototype.hasOwnProperty.call(p,S)&&(Object.prototype.hasOwnProperty.call(f,S)||Ur(S,_,x));for(S in f)Object.prototype.hasOwnProperty.call(f,S)&&(Object.prototype.hasOwnProperty.call(p,S)?_t(p[S],f[S])||(p[S].type==="geojson"&&f[S].type==="geojson"&&Cn(p,f,S)?Ut(_,{command:"setGeoJSONSourceData",args:[S,f[S].data]}):Er(S,f,_,x)):ns(S,f,_))})(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,_){f=f||[];const x=(p=p||[]).map(ss),S=f.map(ss),I=p.reduce(os,{}),A=f.reduce(os,{}),D=x.slice(),R=Object.create(null);let O,$,W,oe,Y;for(let ie=0,de=0;ie<x.length;ie++)O=x[ie],Object.prototype.hasOwnProperty.call(A,O)?de++:(Ut(_,{command:"removeLayer",args:[O]}),D.splice(D.indexOf(O,de),1));for(let ie=0,de=0;ie<S.length;ie++)O=S[S.length-1-ie],D[D.length-1-ie]!==O&&(Object.prototype.hasOwnProperty.call(I,O)?(Ut(_,{command:"removeLayer",args:[O]}),D.splice(D.lastIndexOf(O,D.length-de),1)):de++,oe=D[D.length-ie],Ut(_,{command:"addLayer",args:[A[O],oe]}),D.splice(D.length-ie,0,O),R[O]=!0);for(let ie=0;ie<S.length;ie++)if(O=S[ie],$=I[O],W=A[O],!R[O]&&!_t($,W))if(_t($.source,W.source)&&_t($["source-layer"],W["source-layer"])&&_t($.type,W.type)){for(Y in Hi($.layout,W.layout,_,O,null,"setLayoutProperty"),Hi($.paint,W.paint,_,O,null,"setPaintProperty"),_t($.filter,W.filter)||Ut(_,{command:"setFilter",args:[O,W.filter]}),_t($.minzoom,W.minzoom)&&_t($.maxzoom,W.maxzoom)||Ut(_,{command:"setLayerZoomRange",args:[O,W.minzoom,W.maxzoom]}),$)Object.prototype.hasOwnProperty.call($,Y)&&Y!=="layout"&&Y!=="paint"&&Y!=="filter"&&Y!=="metadata"&&Y!=="minzoom"&&Y!=="maxzoom"&&(Y.indexOf("paint.")===0?Hi($[Y],W[Y],_,O,Y.slice(6),"setPaintProperty"):_t($[Y],W[Y])||Ut(_,{command:"setLayerProperty",args:[O,Y,W[Y]]}));for(Y in W)Object.prototype.hasOwnProperty.call(W,Y)&&!Object.prototype.hasOwnProperty.call($,Y)&&Y!=="layout"&&Y!=="paint"&&Y!=="filter"&&Y!=="metadata"&&Y!=="minzoom"&&Y!=="maxzoom"&&(Y.indexOf("paint.")===0?Hi($[Y],W[Y],_,O,Y.slice(6),"setPaintProperty"):_t($[Y],W[Y])||Ut(_,{command:"setLayerProperty",args:[O,Y,W[Y]]}))}else Ut(_,{command:"removeLayer",args:[O]}),oe=D[D.lastIndexOf(O)+1],Ut(_,{command:"addLayer",args:[W,oe]})}(d,e.layers,r)}catch(s){console.warn("Unable to compute style diff:",s),r=[{command:"setStyle",args:[e]}]}return r},T.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},T.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},T.aG=bi,T.aH=Or,T.aI=class extends Cs{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},T.aJ=Yl,T.aK=class extends Cs{constructor(i,e){super(i,e),this.current=Eg}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}}},T.aL=Uu,T.aM=$u,T.aN=bt,T.aO=class extends Cs{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]))}},T.aP=class extends Cs{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]))}},T.aQ=function(i,e,r,s,l,d,p){var f=1/(e-r),_=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*_,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)*_,i[14]=(p+d)*x,i[15]=1,i},T.aR=Rg,T.aS=class extends _e{},T.aT=P_,T.aU=class extends Le{},T.aV=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},T.aW=nd,T.aX=xn,T.aY=ri,T.aZ=class extends Ce{},T.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]},T.aa=tp,T.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},T.ac=function(i,e){const r=[];for(const s in i)s in e||r.push(s);return r},T.ad=xt,T.ae=function(i,e,r){var s=Math.sin(r),l=Math.cos(r),d=e[0],p=e[1],f=e[2],_=e[3],x=e[4],S=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+S*s,i[2]=f*l+I*s,i[3]=_*l+A*s,i[4]=x*l-d*s,i[5]=S*l-p*s,i[6]=I*l-f*s,i[7]=A*l-_*s,i},T.af=function(i){var e=new Po(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},T.ag=ic,T.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?xt(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}},T.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},T.ak=Eh,T.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,_=p*d-f*l;if(_===0)return null;const x=(f*(i.y-r.y)-p*(i.x-r.x))/_;return new le(i.x+x*d,i.y+x*l)},T.am=sp,T.an=Hu,T.ao=hh,T.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]},T.aq=ii,T.as=kh,T.at=function(i,e){var r=e[0],s=e[1],l=e[2],d=e[3],p=e[4],f=e[5],_=e[6],x=e[7],S=e[8],I=e[9],A=e[10],D=e[11],R=e[12],O=e[13],$=e[14],W=e[15],oe=r*f-s*p,Y=r*_-l*p,ie=r*x-d*p,de=s*_-l*f,be=s*x-d*f,Re=l*x-d*_,Xe=S*O-I*R,Me=S*$-A*R,Ae=S*W-D*R,qe=I*$-A*O,Ne=I*W-D*O,Fe=A*W-D*$,me=oe*Fe-Y*Ne+ie*qe+de*Ae-be*Me+Re*Xe;return me?(i[0]=(f*Fe-_*Ne+x*qe)*(me=1/me),i[1]=(l*Ne-s*Fe-d*qe)*me,i[2]=(O*Re-$*be+W*de)*me,i[3]=(A*be-I*Re-D*de)*me,i[4]=(_*Ae-p*Fe-x*Me)*me,i[5]=(r*Fe-l*Ae+d*Me)*me,i[6]=($*ie-R*Re-W*Y)*me,i[7]=(S*Re-A*ie+D*Y)*me,i[8]=(p*Ne-f*Ae+x*Xe)*me,i[9]=(s*Ae-r*Ne-d*Xe)*me,i[10]=(R*be-O*ie+W*oe)*me,i[11]=(I*ie-S*be-D*oe)*me,i[12]=(f*Me-p*qe-_*Xe)*me,i[13]=(r*qe-s*Me+l*Xe)*me,i[14]=(O*Y-R*de-$*oe)*me,i[15]=(S*de-I*Y+A*oe)*me,i):null},T.au=Bh,T.av=Ph,T.aw=Fh,T.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},T.ay=ql,T.az=Qi,T.b=ur,T.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},T.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},T.b2=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},T.b3=Gt,T.b4=Yd,T.b5=Jd,T.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},T.b7=function(i,e,r){var s=Math.sin(r),l=Math.cos(r),d=e[4],p=e[5],f=e[6],_=e[7],x=e[8],S=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+S*s,i[6]=f*l+I*s,i[7]=_*l+A*s,i[8]=x*l-d*s,i[9]=S*l-p*s,i[10]=I*l-f*s,i[11]=A*l-_*s,i},T.b8=ze,T.b9=Pt,T.bA=function(i){return i.message===Yi},T.bB=gn,T.bC=Jr,T.ba=function(i){return i*Math.PI/180},T.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},T.bc=class extends L{},T.bd=zh,T.be=ly,T.bg=Fi,T.bh=function(i,e){Vr.REGISTERED_PROTOCOLS[i]=e},T.bi=function(i){delete Vr.REGISTERED_PROTOCOLS[i]},T.bj=function(i,e){const r={};for(let l=0;l<i.length;l++){const d=e&&e[i[l].id]||ga(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},T.bk=Oe,T.bl=ep,T.bm=ip,T.bn=Dd,T.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 At(i.bucket.zoom+1),i.canonical),layoutTextSize:s["text-size"].possiblyEvaluate(new At(i.bucket.zoom+1),i.canonical),textMaxSize:s["text-size"].possiblyEvaluate(new At(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:x,maxZoom:S}=i.bucket.textSizeData;l.compositeTextSizes=[s["text-size"].possiblyEvaluate(new At(x),i.canonical),s["text-size"].possiblyEvaluate(new At(S),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:x,maxZoom:S}=i.bucket.iconSizeData;l.compositeIconSizes=[s["icon-size"].possiblyEvaluate(new At(x),i.canonical),s["icon-size"].possiblyEvaluate(new At(S),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"),_=r.get("text-size");for(const x of i.bucket.features){const S=r.get("text-font").evaluate(x,{},i.canonical).join(","),I=_.evaluate(x,{},i.canonical),A=l.layoutTextSize.evaluate(x,{},i.canonical),D=l.layoutIconSize.evaluate(x,{},i.canonical),R={horizontal:{},vertical:void 0},O=x.text;let $,W=[0,0];if(O){const ie=O.toString(),de=r.get("text-letter-spacing").evaluate(x,{},i.canonical)*ii,be=rh(ie)?de:0,Re=r.get("text-anchor").evaluate(x,{},i.canonical),Xe=fp(e,x,i.canonical);if(!Xe){const Ne=r.get("text-radial-offset").evaluate(x,{},i.canonical);W=Ne?pp(Re,[Ne*ii,Rh]):r.get("text-offset").evaluate(x,{},i.canonical).map(Fe=>Fe*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&&Ma(ie)&&(R.vertical=lc(O,i.glyphMap,i.glyphPositions,i.imagePositions,S,Ae,d,Re,"left",be,W,T.ai.vertical,!0,A,I))};if(!p&&Xe){const Ne=new Set;if(Me==="auto")for(let me=0;me<Xe.values.length;me+=2)Ne.add(Bh(Xe.values[me]));else Ne.add(Me);let Fe=!1;for(const me of Ne)if(!R.horizontal[me])if(Fe)R.horizontal[me]=R.horizontal[0];else{const Ge=lc(O,i.glyphMap,i.glyphPositions,i.imagePositions,S,Ae,d,"center",me,be,W,T.ai.horizontal,!1,A,I);Ge&&(R.horizontal[me]=Ge,Fe=Ge.positionedLines.length===1)}qe()}else{Me==="auto"&&(Me=Bh(Re));const Ne=lc(O,i.glyphMap,i.glyphPositions,i.imagePositions,S,Ae,d,Re,Me,be,W,T.ai.horizontal,!1,A,I);Ne&&(R.horizontal[Me]=Ne),qe(),Ma(ie)&&p&&f&&(R.vertical=lc(O,i.glyphMap,i.glyphPositions,i.imagePositions,S,Ae,d,Re,Me,be,W,T.ai.vertical,!1,A,I))}}let oe=!1;if(x.icon&&x.icon.name){const ie=i.imageMap[x.icon.name];ie&&($=q_(i.imagePositions[x.icon.name],r.get("icon-offset").evaluate(x,{},i.canonical),r.get("icon-anchor").evaluate(x,{},i.canonical)),oe=!!ie.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=oe:i.bucket.sdfIcons!==oe&&li("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=gp(R.horizontal)||R.vertical;i.bucket.iconsInText=!!Y&&Y.iconsInText,(Y||$)&&oy(i.bucket,x,R,$,i.imageMap,l,A,D,W,oe,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},T.bp=vh,T.bq=_h,T.br=xh,T.bs=Hn,T.bt=wh,T.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}},T.bv=function(i,e,r,s,l){return c(this,void 0,void 0,function*(){if(Mt())try{return yield sn(i,e,r,s,l)}catch{}return function(d,p,f,_,x){const S=d.width,I=d.height;Pr&&Ei||(Pr=new OffscreenCanvas(S,I),Ei=Pr.getContext("2d",{willReadFrequently:!0})),Pr.width=S,Pr.height=I,Ei.drawImage(d,0,0,S,I);const A=Ei.getImageData(p,f,_,x);return Ei.clearRect(0,0,S,I),A.data}(i,e,r,s,l)})},T.bw=Qd,T.bx=ge,T.by=xe,T.bz=Td,T.c=kn,T.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.`)}}),T.e=jt,T.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=js})},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):js}),T.g=dr,T.h=(i,e)=>on(jt(i,{type:"json"}),e),T.i=Ir,T.j=jr,T.k=Nr,T.l=(i,e)=>on(jt(i,{type:"arrayBuffer"}),e),T.m=on,T.n=function(i){return new wh(i).readFields(F_,[])},T.o=$a,T.p=zd,T.q=o,T.r=eh,T.s=an,T.t=Aa,T.u=De,T.v=ue,T.w=li,T.x=Dr,T.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)}},T.z=ji}),B("worker",["./shared"],function(T){class c{constructor(z){this.keyCache={},z&&this.replace(z)}replace(z){this._layerConfigs={},this._layers={},this.update(z,[])}update(z,M){for(const q of z){this._layerConfigs[q.id]=q;const Q=this._layers[q.id]=T.aB(q);Q._featureFilter=T.a7(Q.filter),this.keyCache[q.id]&&delete this.keyCache[q.id]}for(const q of M)delete this.keyCache[q],delete this._layerConfigs[q],delete this._layers[q];this.familiesBySource={};const V=T.bj(Object.values(this._layerConfigs),this.keyCache);for(const q of V){const Q=q.map(he=>this._layers[he.id]),te=Q[0];if(te.visibility==="none")continue;const ne=te.source||"";let J=this.familiesBySource[ne];J||(J=this.familiesBySource[ne]={});const pe=te.sourceLayer||"_geojsonTileLayer";let ye=J[pe];ye||(ye=J[pe]=[]),ye.push(Q)}}}class ge{constructor(z){const M={},V=[];for(const ne in z){const J=z[ne],pe=M[ne]={};for(const ye in J){const he=J[+ye];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};V.push(Pe),pe[ye]={rect:Pe,metrics:he.metrics}}}const{w:q,h:Q}=T.p(V),te=new T.o({width:q||1,height:Q||1});for(const ne in z){const J=z[ne];for(const pe in J){const ye=J[+pe];if(!ye||ye.bitmap.width===0||ye.bitmap.height===0)continue;const he=M[ne][pe].rect;T.o.copy(ye.bitmap,te,{x:0,y:0},{x:he.x+1,y:he.y+1},ye.bitmap)}}this.image=te,this.positions=M}}T.bk("GlyphAtlas",ge);class xe{constructor(z){this.tileID=new T.S(z.tileID.overscaledZ,z.tileID.wrap,z.tileID.canonical.z,z.tileID.canonical.x,z.tileID.canonical.y),this.uid=z.uid,this.zoom=z.zoom,this.pixelRatio=z.pixelRatio,this.tileSize=z.tileSize,this.source=z.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=z.showCollisionBoxes,this.collectResourceTiming=!!z.collectResourceTiming,this.returnDependencies=!!z.returnDependencies,this.promoteId=z.promoteId,this.inFlightDependencies=[]}parse(z,M,V,q){return T._(this,void 0,void 0,function*(){this.status="parsing",this.data=z,this.collisionBoxArray=new T.a5;const Q=new T.bl(Object.keys(z.layers).sort()),te=new T.bm(this.tileID,this.promoteId);te.bucketLayerIDs=[];const ne={},J={featureIndex:te,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:V},pe=M.familiesBySource[this.source];for(const at in pe){const vt=z.layers[at];if(!vt)continue;vt.version===1&&T.w(`Vector tile source "${this.source}" layer "${at}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Ot=Q.encode(at),ei=[];for(let ci=0;ci<vt.length;ci++){const hi=vt.feature(ci),as=te.getId(hi,at);ei.push({feature:hi,id:as,index:ci,sourceLayerIndex:Ot})}for(const ci of pe[at]){const hi=ci[0];hi.source!==this.source&&T.w(`layer.source = ${hi.source} does not equal this.source = ${this.source}`),hi.minzoom&&this.zoom<Math.floor(hi.minzoom)||hi.maxzoom&&this.zoom>=hi.maxzoom||hi.visibility!=="none"&&(ve(ci,this.zoom,V),(ne[hi.id]=hi.createBucket({index:te.bucketLayerIDs.length,layers:ci,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Ot,sourceID:this.source})).populate(ei,J,this.tileID.canonical),te.bucketLayerIDs.push(ci.map(as=>as.id)))}}const ye=T.aG(J.glyphDependencies,at=>Object.keys(at).map(Number));this.inFlightDependencies.forEach(at=>at==null?void 0:at.abort()),this.inFlightDependencies=[];let he=Promise.resolve({});if(Object.keys(ye).length){const at=new AbortController;this.inFlightDependencies.push(at),he=q.sendAsync({type:"GG",data:{stacks:ye,source:this.source,tileID:this.tileID,type:"glyphs"}},at)}const Pe=Object.keys(J.iconDependencies);let He=Promise.resolve({});if(Pe.length){const at=new AbortController;this.inFlightDependencies.push(at),He=q.sendAsync({type:"GI",data:{icons:Pe,source:this.source,tileID:this.tileID,type:"icons"}},at)}const We=Object.keys(J.patternDependencies);let nt=Promise.resolve({});if(We.length){const at=new AbortController;this.inFlightDependencies.push(at),nt=q.sendAsync({type:"GI",data:{icons:We,source:this.source,tileID:this.tileID,type:"patterns"}},at)}const[ft,rt,kt]=yield Promise.all([he,He,nt]),$t=new ge(ft),Kt=new T.bn(rt,kt);for(const at in ne){const vt=ne[at];vt instanceof T.a6?(ve(vt.layers,this.zoom,V),T.bo({bucket:vt,glyphMap:ft,glyphPositions:$t.positions,imageMap:rt,imagePositions:Kt.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):vt.hasPattern&&(vt instanceof T.bp||vt instanceof T.bq||vt instanceof T.br)&&(ve(vt.layers,this.zoom,V),vt.addFeatures(J,this.tileID.canonical,Kt.patternPositions))}return this.status="done",{buckets:Object.values(ne).filter(at=>!at.isEmpty()),featureIndex:te,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:$t.image,imageAtlas:Kt,glyphMap:this.returnDependencies?ft:null,iconMap:this.returnDependencies?rt:null,glyphPositions:this.returnDependencies?$t.positions:null}})}}function ve(G,z,M){const V=new T.a9(z);for(const q of G)q.recalculate(V,M)}class le{constructor(z,M,V){this.actor=z,this.layerIndex=M,this.availableImages=V,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(z,M){return T._(this,void 0,void 0,function*(){const V=yield T.l(z.request,M);try{return{vectorTile:new T.bs.VectorTile(new T.bt(V.data)),rawData:V.data,cacheControl:V.cacheControl,expires:V.expires}}catch(q){const Q=new Uint8Array(V.data);let te=`Unable to parse the tile at ${z.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(z){return T._(this,void 0,void 0,function*(){const M=z.uid,V=!!(z&&z.request&&z.request.collectResourceTiming)&&new T.bu(z.request),q=new xe(z);this.loading[M]=q;const Q=new AbortController;q.abort=Q;try{const te=yield this.loadVectorTile(z,Q);if(delete this.loading[M],!te)return null;const ne=te.rawData,J={};te.expires&&(J.expires=te.expires),te.cacheControl&&(J.cacheControl=te.cacheControl);const pe={};if(V){const he=V.finish();he&&(pe.resourceTiming=JSON.parse(JSON.stringify(he)))}q.vectorTile=te.vectorTile;const ye=q.parse(te.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[M]=q,this.fetching[M]={rawTileData:ne,cacheControl:J,resourceTiming:pe};try{const he=yield ye;return T.e({rawTileData:ne.slice(0)},he,J,pe)}finally{delete this.fetching[M]}}catch(te){throw delete this.loading[M],q.status="done",this.loaded[M]=q,te}})}reloadTile(z){return T._(this,void 0,void 0,function*(){const M=z.uid;if(!this.loaded||!this.loaded[M])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const V=this.loaded[M];if(V.showCollisionBoxes=z.showCollisionBoxes,V.status==="parsing"){const q=yield V.parse(V.vectorTile,this.layerIndex,this.availableImages,this.actor);let Q;if(this.fetching[M]){const{rawTileData:te,cacheControl:ne,resourceTiming:J}=this.fetching[M];delete this.fetching[M],Q=T.e({rawTileData:te.slice(0)},q,ne,J)}else Q=q;return Q}if(V.status==="done"&&V.vectorTile)return V.parse(V.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(z){return T._(this,void 0,void 0,function*(){const M=this.loading,V=z.uid;M&&M[V]&&M[V].abort&&(M[V].abort.abort(),delete M[V])})}removeTile(z){return T._(this,void 0,void 0,function*(){this.loaded&&this.loaded[z.uid]&&delete this.loaded[z.uid]})}}class ae{constructor(){this.loaded={}}loadTile(z){return T._(this,void 0,void 0,function*(){const{uid:M,encoding:V,rawImageData:q,redFactor:Q,greenFactor:te,blueFactor:ne,baseShift:J}=z,pe=q.width+2,ye=q.height+2,he=T.b(q)?new T.R({width:pe,height:ye},yield T.bv(q,-1,-1,pe,ye)):q,Pe=new T.bw(M,he,V,Q,te,ne,J);return this.loaded=this.loaded||{},this.loaded[M]=Pe,Pe})}removeTile(z){const M=this.loaded,V=z.uid;M&&M[V]&&delete M[V]}}function ct(G,z){if(G.length!==0){Ue(G[0],z);for(var M=1;M<G.length;M++)Ue(G[M],!z)}}function Ue(G,z){for(var M=0,V=0,q=0,Q=G.length,te=Q-1;q<Q;te=q++){var ne=(G[q][0]-G[te][0])*(G[te][1]+G[q][1]),J=M+ne;V+=Math.abs(M)>=Math.abs(ne)?M-J+ne:ne-J+M,M=J}M+V>=0!=!!z&&G.reverse()}var Ke=T.bx(function G(z,M){var V,q=z&&z.type;if(q==="FeatureCollection")for(V=0;V<z.features.length;V++)G(z.features[V],M);else if(q==="GeometryCollection")for(V=0;V<z.geometries.length;V++)G(z.geometries[V],M);else if(q==="Feature")G(z.geometry,M);else if(q==="Polygon")ct(z.coordinates,M);else if(q==="MultiPolygon")for(V=0;V<z.coordinates.length;V++)ct(z.coordinates[V],M);return z});const Ve=T.bs.VectorTileFeature.prototype.toGeoJSON;var pt={exports:{}},Mt=T.by,ze=T.bs.VectorTileFeature,Pt=xt;function xt(G,z){this.options=z||{},this.features=G,this.length=G.length}function Gt(G,z){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=z||4096}xt.prototype.feature=function(G){return new Gt(this.features[G],this.options.extent)},Gt.prototype.loadGeometry=function(){var G=this.rawGeometry;this.geometry=[];for(var z=0;z<G.length;z++){for(var M=G[z],V=[],q=0;q<M.length;q++)V.push(new Mt(M[q][0],M[q][1]));this.geometry.push(V)}return this.geometry},Gt.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var G=this.geometry,z=1/0,M=-1/0,V=1/0,q=-1/0,Q=0;Q<G.length;Q++)for(var te=G[Q],ne=0;ne<te.length;ne++){var J=te[ne];z=Math.min(z,J.x),M=Math.max(M,J.x),V=Math.min(V,J.y),q=Math.max(q,J.y)}return[z,V,M,q]},Gt.prototype.toGeoJSON=ze.prototype.toGeoJSON;var jt=T.bz,Fr=Pt;function bi(G){var z=new jt;return function(M,V){for(var q in M.layers)V.writeMessage(3,Or,M.layers[q])}(G,z),z.finish()}function Or(G,z){var M;z.writeVarintField(15,G.version||1),z.writeStringField(1,G.name||""),z.writeVarintField(5,G.extent||4096);var V={keys:[],values:[],keycache:{},valuecache:{}};for(M=0;M<G.length;M++)V.feature=G.feature(M),z.writeMessage(2,wt,V);var q=V.keys;for(M=0;M<q.length;M++)z.writeStringField(3,q[M]);var Q=V.values;for(M=0;M<Q.length;M++)z.writeMessage(4,Pn,Q[M])}function wt(G,z){var M=G.feature;M.id!==void 0&&z.writeVarintField(1,M.id),z.writeMessage(2,Ns,G),z.writeVarintField(3,M.type),z.writeMessage(4,Ir,M)}function Ns(G,z){var M=G.feature,V=G.keys,q=G.values,Q=G.keycache,te=G.valuecache;for(var ne in M.properties){var J=M.properties[ne],pe=Q[ne];if(J!==null){pe===void 0&&(V.push(ne),Q[ne]=pe=V.length-1),z.writeVarint(pe);var ye=typeof J;ye!=="string"&&ye!=="boolean"&&ye!=="number"&&(J=JSON.stringify(J));var he=ye+":"+J,Pe=te[he];Pe===void 0&&(q.push(J),te[he]=Pe=q.length-1),z.writeVarint(Pe)}}}function li(G,z){return(z<<3)+(7&G)}function wi(G){return G<<1^G>>31}function Ir(G,z){for(var M=G.loadGeometry(),V=G.type,q=0,Q=0,te=M.length,ne=0;ne<te;ne++){var J=M[ne],pe=1;V===1&&(pe=J.length),z.writeVarint(li(1,pe));for(var ye=V===3?J.length-1:J.length,he=0;he<ye;he++){he===1&&V!==1&&z.writeVarint(li(2,ye-1));var Pe=J[he].x-q,He=J[he].y-Q;z.writeVarint(wi(Pe)),z.writeVarint(wi(He)),q+=Pe,Q+=He}V===3&&z.writeVarint(li(7,1))}}function Pn(G,z){var M=typeof G;M==="string"?z.writeStringField(1,G):M==="boolean"?z.writeBooleanField(7,G):M==="number"&&(G%1!=0?z.writeDoubleField(3,G):G<0?z.writeSVarintField(6,G):z.writeVarintField(5,G))}pt.exports=bi,pt.exports.fromVectorTileJs=bi,pt.exports.fromGeojsonVt=function(G,z){z=z||{};var M={};for(var V in G)M[V]=new Fr(G[V].features,z),M[V].name=V,M[V].version=z.version,M[V].extent=z.extent;return bi({layers:M})},pt.exports.GeoJSONWrapper=Fr;var ur=T.bx(pt.exports);const js={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:G=>G},sn=Math.fround||(Pr=new Float32Array(1),G=>(Pr[0]=+G,Pr[0]));var Pr;const Ei=3,Yi=5,kn=6;class Vr{constructor(z){this.options=Object.assign(Object.create(js),z),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(z){const{log:M,minZoom:V,maxZoom:q}=this.options;M&&console.time("total time");const Q=`prepare ${z.length} points`;M&&console.time(Q),this.points=z;const te=[];for(let J=0;J<z.length;J++){const pe=z[J];if(!pe.geometry)continue;const[ye,he]=pe.geometry.coordinates,Pe=sn(Fi(ye)),He=sn(Qi(he));te.push(Pe,He,1/0,J,-1,1),this.options.reduce&&te.push(0)}let ne=this.trees[q+1]=this._createTree(te);M&&console.timeEnd(Q);for(let J=q;J>=V;J--){const pe=+Date.now();ne=this.trees[J]=this._createTree(this._cluster(ne,J)),M&&console.log("z%d: %d clusters in %dms",J,ne.numItems,+Date.now()-pe)}return M&&console.timeEnd("total time"),this}getClusters(z,M){let V=((z[0]+180)%360+360)%360-180;const q=Math.max(-90,Math.min(90,z[1]));let Q=z[2]===180?180:((z[2]+180)%360+360)%360-180;const te=Math.max(-90,Math.min(90,z[3]));if(z[2]-z[0]>=360)V=-180,Q=180;else if(V>Q){const he=this.getClusters([V,q,180,te],M),Pe=this.getClusters([-180,q,Q,te],M);return he.concat(Pe)}const ne=this.trees[this._limitZoom(M)],J=ne.range(Fi(V),Qi(te),Fi(Q),Qi(q)),pe=ne.data,ye=[];for(const he of J){const Pe=this.stride*he;ye.push(pe[Pe+Yi]>1?dr(pe,Pe,this.clusterProps):this.points[pe[Pe+Ei]])}return ye}getChildren(z){const M=this._getOriginId(z),V=this._getOriginZoom(z),q="No cluster with the specified id.",Q=this.trees[V];if(!Q)throw new Error(q);const te=Q.data;if(M*this.stride>=te.length)throw new Error(q);const ne=this.options.radius/(this.options.extent*Math.pow(2,V-1)),J=Q.within(te[M*this.stride],te[M*this.stride+1],ne),pe=[];for(const ye of J){const he=ye*this.stride;te[he+4]===z&&pe.push(te[he+Yi]>1?dr(te,he,this.clusterProps):this.points[te[he+Ei]])}if(pe.length===0)throw new Error(q);return pe}getLeaves(z,M,V){const q=[];return this._appendLeaves(q,z,M=M||10,V=V||0,0),q}getTile(z,M,V){const q=this.trees[this._limitZoom(z)],Q=Math.pow(2,z),{extent:te,radius:ne}=this.options,J=ne/te,pe=(V-J)/Q,ye=(V+1+J)/Q,he={features:[]};return this._addTileFeatures(q.range((M-J)/Q,pe,(M+1+J)/Q,ye),q.data,M,V,Q,he),M===0&&this._addTileFeatures(q.range(1-J/Q,pe,1,ye),q.data,Q,V,Q,he),M===Q-1&&this._addTileFeatures(q.range(0,pe,J/Q,ye),q.data,-1,V,Q,he),he.features.length?he:null}getClusterExpansionZoom(z){let M=this._getOriginZoom(z)-1;for(;M<=this.options.maxZoom;){const V=this.getChildren(z);if(M++,V.length!==1)break;z=V[0].properties.cluster_id}return M}_appendLeaves(z,M,V,q,Q){const te=this.getChildren(M);for(const ne of te){const J=ne.properties;if(J&&J.cluster?Q+J.point_count<=q?Q+=J.point_count:Q=this._appendLeaves(z,J.cluster_id,V,q,Q):Q<q?Q++:z.push(ne),z.length===V)break}return Q}_createTree(z){const M=new T.aw(z.length/this.stride|0,this.options.nodeSize,Float32Array);for(let V=0;V<z.length;V+=this.stride)M.add(z[V],z[V+1]);return M.finish(),M.data=z,M}_addTileFeatures(z,M,V,q,Q,te){for(const ne of z){const J=ne*this.stride,pe=M[J+Yi]>1;let ye,he,Pe;if(pe)ye=En(M,J,this.clusterProps),he=M[J],Pe=M[J+1];else{const nt=this.points[M[J+Ei]];ye=nt.properties;const[ft,rt]=nt.geometry.coordinates;he=Fi(ft),Pe=Qi(rt)}const He={type:1,geometry:[[Math.round(this.options.extent*(he*Q-V)),Math.round(this.options.extent*(Pe*Q-q))]],tags:ye};let We;We=pe||this.options.generateId?M[J+Ei]:this.points[M[J+Ei]].id,We!==void 0&&(He.id=We),te.features.push(He)}}_limitZoom(z){return Math.max(this.options.minZoom,Math.min(Math.floor(+z),this.options.maxZoom+1))}_cluster(z,M){const{radius:V,extent:q,reduce:Q,minPoints:te}=this.options,ne=V/(q*Math.pow(2,M)),J=z.data,pe=[],ye=this.stride;for(let he=0;he<J.length;he+=ye){if(J[he+2]<=M)continue;J[he+2]=M;const Pe=J[he],He=J[he+1],We=z.within(J[he],J[he+1],ne),nt=J[he+Yi];let ft=nt;for(const rt of We){const kt=rt*ye;J[kt+2]>M&&(ft+=J[kt+Yi])}if(ft>nt&&ft>=te){let rt,kt=Pe*nt,$t=He*nt,Kt=-1;const at=((he/ye|0)<<5)+(M+1)+this.points.length;for(const vt of We){const Ot=vt*ye;if(J[Ot+2]<=M)continue;J[Ot+2]=M;const ei=J[Ot+Yi];kt+=J[Ot]*ei,$t+=J[Ot+1]*ei,J[Ot+4]=at,Q&&(rt||(rt=this._map(J,he,!0),Kt=this.clusterProps.length,this.clusterProps.push(rt)),Q(rt,this._map(J,Ot)))}J[he+4]=at,pe.push(kt/ft,$t/ft,1/0,at,-1,ft),Q&&pe.push(Kt)}else{for(let rt=0;rt<ye;rt++)pe.push(J[he+rt]);if(ft>1)for(const rt of We){const kt=rt*ye;if(!(J[kt+2]<=M)){J[kt+2]=M;for(let $t=0;$t<ye;$t++)pe.push(J[kt+$t])}}}}return pe}_getOriginId(z){return z-this.points.length>>5}_getOriginZoom(z){return(z-this.points.length)%32}_map(z,M,V){if(z[M+Yi]>1){const te=this.clusterProps[z[M+kn]];return V?Object.assign({},te):te}const q=this.points[z[M+Ei]].properties,Q=this.options.map(q);return V&&Q===q?Object.assign({},Q):Q}}function dr(G,z,M){return{type:"Feature",id:G[z+Ei],properties:En(G,z,M),geometry:{type:"Point",coordinates:[(V=G[z],360*(V-.5)),on(G[z+1])]}};var V}function En(G,z,M){const V=G[z+Yi],q=V>=1e4?`${Math.round(V/1e3)}k`:V>=1e3?Math.round(V/100)/10+"k":V,Q=G[z+kn],te=Q===-1?{}:Object.assign({},M[Q]);return Object.assign(te,{cluster:!0,cluster_id:G[z+Ei],point_count:V,point_count_abbreviated:q})}function Fi(G){return G/360+.5}function Qi(G){const z=Math.sin(G*Math.PI/180),M=.5-.25*Math.log((1+z)/(1-z))/Math.PI;return M<0?0:M>1?1:M}function on(G){const z=(180-360*G)*Math.PI/180;return 360*Math.atan(Math.exp(z))/Math.PI-90}function an(G,z,M,V){let q=V;const Q=z+(M-z>>1);let te,ne=M-z;const J=G[z],pe=G[z+1],ye=G[M],he=G[M+1];for(let Pe=z+3;Pe<M;Pe+=3){const He=is(G[Pe],G[Pe+1],J,pe,ye,he);if(He>q)te=Pe,q=He;else if(He===q){const We=Math.abs(Pe-Q);We<ne&&(te=Pe,ne=We)}}q>V&&(te-z>3&&an(G,z,te,V),G[te+2]=q,M-te>3&&an(G,te,M,V))}function is(G,z,M,V,q,Q){let te=q-M,ne=Q-V;if(te!==0||ne!==0){const J=((G-M)*te+(z-V)*ne)/(te*te+ne*ne);J>1?(M=q,V=Q):J>0&&(M+=te*J,V+=ne*J)}return te=G-M,ne=z-V,te*te+ne*ne}function kr(G,z,M,V){const q={id:G??null,type:z,geometry:M,tags:V,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(z==="Point"||z==="MultiPoint"||z==="LineString")Nr(q,M);else if(z==="Polygon")Nr(q,M[0]);else if(z==="MultiLineString")for(const Q of M)Nr(q,Q);else if(z==="MultiPolygon")for(const Q of M)Nr(q,Q[0]);return q}function Nr(G,z){for(let M=0;M<z.length;M+=3)G.minX=Math.min(G.minX,z[M]),G.minY=Math.min(G.minY,z[M+1]),G.maxX=Math.max(G.maxX,z[M]),G.maxY=Math.max(G.maxY,z[M+1])}function jr(G,z,M,V){if(!z.geometry)return;const q=z.geometry.coordinates;if(q&&q.length===0)return;const Q=z.geometry.type,te=Math.pow(M.tolerance/((1<<M.maxZoom)*M.extent),2);let ne=[],J=z.id;if(M.promoteId?J=z.properties[M.promoteId]:M.generateId&&(J=V||0),Q==="Point")An(q,ne);else if(Q==="MultiPoint")for(const pe of q)An(pe,ne);else if(Q==="LineString")ue(q,ne,te,!1);else if(Q==="MultiLineString"){if(M.lineMetrics){for(const pe of q)ne=[],ue(pe,ne,te,!1),G.push(kr(J,"LineString",ne,z.properties));return}ln(q,ne,te,!1)}else if(Q==="Polygon")ln(q,ne,te,!0);else{if(Q!=="MultiPolygon"){if(Q==="GeometryCollection"){for(const pe of z.geometry.geometries)jr(G,{id:J,geometry:pe,properties:z.properties},M,V);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const pe of q){const ye=[];ln(pe,ye,te,!0),ne.push(ye)}}G.push(kr(J,Q,ne,z.properties))}function An(G,z){z.push(rs(G[0]),_t(G[1]),0)}function ue(G,z,M,V){let q,Q,te=0;for(let J=0;J<G.length;J++){const pe=rs(G[J][0]),ye=_t(G[J][1]);z.push(pe,ye,0),J>0&&(te+=V?(q*ye-pe*Q)/2:Math.sqrt(Math.pow(pe-q,2)+Math.pow(ye-Q,2))),q=pe,Q=ye}const ne=z.length-3;z[2]=1,an(z,0,ne,M),z[ne+2]=1,z.size=Math.abs(te),z.start=0,z.end=z.size}function ln(G,z,M,V){for(let q=0;q<G.length;q++){const Q=[];ue(G[q],Q,M,V),z.push(Q)}}function rs(G){return G/360+.5}function _t(G){const z=Math.sin(G*Math.PI/180),M=.5-.25*Math.log((1+z)/(1-z))/Math.PI;return M<0?0:M>1?1:M}function Ut(G,z,M,V,q,Q,te,ne){if(V/=z,Q>=(M/=z)&&te<V)return G;if(te<M||Q>=V)return null;const J=[];for(const pe of G){const ye=pe.geometry;let he=pe.type;const Pe=q===0?pe.minX:pe.minY,He=q===0?pe.maxX:pe.maxY;if(Pe>=M&&He<V){J.push(pe);continue}if(He<M||Pe>=V)continue;let We=[];if(he==="Point"||he==="MultiPoint")ns(ye,We,M,V,q);else if(he==="LineString")Ur(ye,We,M,V,q,!1,ne.lineMetrics);else if(he==="MultiLineString")Cn(ye,We,M,V,q,!1);else if(he==="Polygon")Cn(ye,We,M,V,q,!0);else if(he==="MultiPolygon")for(const nt of ye){const ft=[];Cn(nt,ft,M,V,q,!0),ft.length&&We.push(ft)}if(We.length){if(ne.lineMetrics&&he==="LineString"){for(const nt of We)J.push(kr(pe.id,he,nt,pe.tags));continue}he!=="LineString"&&he!=="MultiLineString"||(We.length===1?(he="LineString",We=We[0]):he="MultiLineString"),he!=="Point"&&he!=="MultiPoint"||(he=We.length===3?"Point":"MultiPoint"),J.push(kr(pe.id,he,We,pe.tags))}}return J.length?J:null}function ns(G,z,M,V,q){for(let Q=0;Q<G.length;Q+=3){const te=G[Q+q];te>=M&&te<=V&&Hi(z,G[Q],G[Q+1],G[Q+2])}}function Ur(G,z,M,V,q,Q,te){let ne=Er(G);const J=q===0?ss:os;let pe,ye,he=G.start;for(let ft=0;ft<G.length-3;ft+=3){const rt=G[ft],kt=G[ft+1],$t=G[ft+2],Kt=G[ft+3],at=G[ft+4],vt=q===0?rt:kt,Ot=q===0?Kt:at;let ei=!1;te&&(pe=Math.sqrt(Math.pow(rt-Kt,2)+Math.pow(kt-at,2))),vt<M?Ot>M&&(ye=J(ne,rt,kt,Kt,at,M),te&&(ne.start=he+pe*ye)):vt>V?Ot<V&&(ye=J(ne,rt,kt,Kt,at,V),te&&(ne.start=he+pe*ye)):Hi(ne,rt,kt,$t),Ot<M&&vt>=M&&(ye=J(ne,rt,kt,Kt,at,M),ei=!0),Ot>V&&vt<=V&&(ye=J(ne,rt,kt,Kt,at,V),ei=!0),!Q&&ei&&(te&&(ne.end=he+pe*ye),z.push(ne),ne=Er(G)),te&&(he+=pe)}let Pe=G.length-3;const He=G[Pe],We=G[Pe+1],nt=q===0?He:We;nt>=M&&nt<=V&&Hi(ne,He,We,G[Pe+2]),Pe=ne.length-3,Q&&Pe>=3&&(ne[Pe]!==ne[0]||ne[Pe+1]!==ne[1])&&Hi(ne,ne[0],ne[1],ne[2]),ne.length&&z.push(ne)}function Er(G){const z=[];return z.size=G.size,z.start=G.start,z.end=G.end,z}function Cn(G,z,M,V,q,Q){for(const te of G)Ur(te,z,M,V,q,Q,!1)}function Hi(G,z,M,V){G.push(z,M,V)}function ss(G,z,M,V,q,Q){const te=(Q-z)/(V-z);return Hi(G,Q,M+(q-M)*te,1),te}function os(G,z,M,V,q,Q){const te=(Q-M)/(q-M);return Hi(G,z+(V-z)*te,Q,1),te}function Ie(G,z){const M=[];for(let V=0;V<G.length;V++){const q=G[V],Q=q.type;let te;if(Q==="Point"||Q==="MultiPoint"||Q==="LineString")te=pr(q.geometry,z);else if(Q==="MultiLineString"||Q==="Polygon"){te=[];for(const ne of q.geometry)te.push(pr(ne,z))}else if(Q==="MultiPolygon"){te=[];for(const ne of q.geometry){const J=[];for(const pe of ne)J.push(pr(pe,z));te.push(J)}}M.push(kr(q.id,Q,te,q.tags))}return M}function pr(G,z){const M=[];M.size=G.size,G.start!==void 0&&(M.start=G.start,M.end=G.end);for(let V=0;V<G.length;V+=3)M.push(G[V]+z,G[V+1],G[V+2]);return M}function Si(G,z){if(G.transformed)return G;const M=1<<G.z,V=G.x,q=G.y;for(const Q of G.features){const te=Q.geometry,ne=Q.type;if(Q.geometry=[],ne===1)for(let J=0;J<te.length;J+=2)Q.geometry.push(fr(te[J],te[J+1],z,M,V,q));else for(let J=0;J<te.length;J++){const pe=[];for(let ye=0;ye<te[J].length;ye+=2)pe.push(fr(te[J][ye],te[J][ye+1],z,M,V,q));Q.geometry.push(pe)}}return G.transformed=!0,G}function fr(G,z,M,V,q,Q){return[Math.round(M*(G*V-q)),Math.round(M*(z*V-Q))]}function $r(G,z,M,V,q){const Q=z===q.maxZoom?0:q.tolerance/((1<<z)*q.extent),te={features:[],numPoints:0,numSimplified:0,numFeatures:G.length,source:null,x:M,y:V,z,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const ne of G)Ee(te,ne,Q,q);return te}function Ee(G,z,M,V){const q=z.geometry,Q=z.type,te=[];if(G.minX=Math.min(G.minX,z.minX),G.minY=Math.min(G.minY,z.minY),G.maxX=Math.max(G.maxX,z.maxX),G.maxY=Math.max(G.maxY,z.maxY),Q==="Point"||Q==="MultiPoint")for(let ne=0;ne<q.length;ne+=3)te.push(q[ne],q[ne+1]),G.numPoints++,G.numSimplified++;else if(Q==="LineString")ot(te,q,G,M,!1,!1);else if(Q==="MultiLineString"||Q==="Polygon")for(let ne=0;ne<q.length;ne++)ot(te,q[ne],G,M,Q==="Polygon",ne===0);else if(Q==="MultiPolygon")for(let ne=0;ne<q.length;ne++){const J=q[ne];for(let pe=0;pe<J.length;pe++)ot(te,J[pe],G,M,!0,pe===0)}if(te.length){let ne=z.tags||null;if(Q==="LineString"&&V.lineMetrics){ne={};for(const pe in z.tags)ne[pe]=z.tags[pe];ne.mapbox_clip_start=q.start/q.size,ne.mapbox_clip_end=q.end/q.size}const J={geometry:te,type:Q==="Polygon"||Q==="MultiPolygon"?3:Q==="LineString"||Q==="MultiLineString"?2:1,tags:ne};z.id!==null&&(J.id=z.id),G.features.push(J)}}function ot(G,z,M,V,q,Q){const te=V*V;if(V>0&&z.size<(q?te:V))return void(M.numPoints+=z.length/3);const ne=[];for(let J=0;J<z.length;J+=3)(V===0||z[J+2]>te)&&(M.numSimplified++,ne.push(z[J],z[J+1])),M.numPoints++;q&&function(J,pe){let ye=0;for(let he=0,Pe=J.length,He=Pe-2;he<Pe;He=he,he+=2)ye+=(J[he]-J[He])*(J[he+1]+J[He+1]);if(ye>0===pe)for(let he=0,Pe=J.length;he<Pe/2;he+=2){const He=J[he],We=J[he+1];J[he]=J[Pe-2-he],J[he+1]=J[Pe-1-he],J[Pe-2-he]=He,J[Pe-1-he]=We}}(ne,Q),G.push(ne)}const Ye={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Ai{constructor(z,M){const V=(M=this.options=function(Q,te){for(const ne in te)Q[ne]=te[ne];return Q}(Object.create(Ye),M)).debug;if(V&&console.time("preprocess data"),M.maxZoom<0||M.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(M.promoteId&&M.generateId)throw new Error("promoteId and generateId cannot be used together.");let q=function(Q,te){const ne=[];if(Q.type==="FeatureCollection")for(let J=0;J<Q.features.length;J++)jr(ne,Q.features[J],te,J);else jr(ne,Q.type==="Feature"?Q:{geometry:Q},te);return ne}(z,M);this.tiles={},this.tileCoords=[],V&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",M.indexMaxZoom,M.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),q=function(Q,te){const ne=te.buffer/te.extent;let J=Q;const pe=Ut(Q,1,-1-ne,ne,0,-1,2,te),ye=Ut(Q,1,1-ne,2+ne,0,-1,2,te);return(pe||ye)&&(J=Ut(Q,1,-ne,1+ne,0,-1,2,te)||[],pe&&(J=Ie(pe,1).concat(J)),ye&&(J=J.concat(Ie(ye,-1)))),J}(q,M),q.length&&this.splitTile(q,0,0,0),V&&(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(z,M,V,q,Q,te,ne){const J=[z,M,V,q],pe=this.options,ye=pe.debug;for(;J.length;){q=J.pop(),V=J.pop(),M=J.pop(),z=J.pop();const he=1<<M,Pe=er(M,V,q);let He=this.tiles[Pe];if(!He&&(ye>1&&console.time("creation"),He=this.tiles[Pe]=$r(z,M,V,q,pe),this.tileCoords.push({z:M,x:V,y:q}),ye)){ye>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",M,V,q,He.numFeatures,He.numPoints,He.numSimplified),console.timeEnd("creation"));const ei=`z${M}`;this.stats[ei]=(this.stats[ei]||0)+1,this.total++}if(He.source=z,Q==null){if(M===pe.indexMaxZoom||He.numPoints<=pe.indexMaxPoints)continue}else{if(M===pe.maxZoom||M===Q)continue;if(Q!=null){const ei=Q-M;if(V!==te>>ei||q!==ne>>ei)continue}}if(He.source=null,z.length===0)continue;ye>1&&console.time("clipping");const We=.5*pe.buffer/pe.extent,nt=.5-We,ft=.5+We,rt=1+We;let kt=null,$t=null,Kt=null,at=null,vt=Ut(z,he,V-We,V+ft,0,He.minX,He.maxX,pe),Ot=Ut(z,he,V+nt,V+rt,0,He.minX,He.maxX,pe);z=null,vt&&(kt=Ut(vt,he,q-We,q+ft,1,He.minY,He.maxY,pe),$t=Ut(vt,he,q+nt,q+rt,1,He.minY,He.maxY,pe),vt=null),Ot&&(Kt=Ut(Ot,he,q-We,q+ft,1,He.minY,He.maxY,pe),at=Ut(Ot,he,q+nt,q+rt,1,He.minY,He.maxY,pe),Ot=null),ye>1&&console.timeEnd("clipping"),J.push(kt||[],M+1,2*V,2*q),J.push($t||[],M+1,2*V,2*q+1),J.push(Kt||[],M+1,2*V+1,2*q),J.push(at||[],M+1,2*V+1,2*q+1)}}getTile(z,M,V){z=+z,M=+M,V=+V;const q=this.options,{extent:Q,debug:te}=q;if(z<0||z>24)return null;const ne=1<<z,J=er(z,M=M+ne&ne-1,V);if(this.tiles[J])return Si(this.tiles[J],Q);te>1&&console.log("drilling down to z%d-%d-%d",z,M,V);let pe,ye=z,he=M,Pe=V;for(;!pe&&ye>0;)ye--,he>>=1,Pe>>=1,pe=this.tiles[er(ye,he,Pe)];return pe&&pe.source?(te>1&&(console.log("found parent tile z%d-%d-%d",ye,he,Pe),console.time("drilling down")),this.splitTile(pe.source,ye,he,Pe,z,M,V),te>1&&console.timeEnd("drilling down"),this.tiles[J]?Si(this.tiles[J],Q):null):null}}function er(G,z,M){return 32*((1<<G)*M+z)+G}function it(G,z){return z?G.properties[z]:G.id}function mr(G,z){if(G==null)return!0;if(G.type==="Feature")return it(G,z)!=null;if(G.type==="FeatureCollection"){const M=new Set;for(const V of G.features){const q=it(V,z);if(q==null||M.has(q))return!1;M.add(q)}return!0}return!1}function Ar(G,z){const M=new Map;if(G!=null)if(G.type==="Feature")M.set(it(G,z),G);else for(const V of G.features)M.set(it(V,z),V);return M}class qr extends le{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(z,M){return T._(this,void 0,void 0,function*(){const V=z.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const q=this._geoJSONIndex.getTile(V.z,V.x,V.y);if(!q)return null;const Q=new class{constructor(ne){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=T.X,this.length=ne.length,this._features=ne}feature(ne){return new class{constructor(J){this._feature=J,this.extent=T.X,this.type=J.type,this.properties=J.tags,"id"in J&&!isNaN(J.id)&&(this.id=parseInt(J.id,10))}loadGeometry(){if(this._feature.type===1){const J=[];for(const pe of this._feature.geometry)J.push([new T.P(pe[0],pe[1])]);return J}{const J=[];for(const pe of this._feature.geometry){const ye=[];for(const he of pe)ye.push(new T.P(he[0],he[1]));J.push(ye)}return J}}toGeoJSON(J,pe,ye){return Ve.call(this,J,pe,ye)}}(this._features[ne])}}(q.features);let te=ur(Q);return te.byteOffset===0&&te.byteLength===te.buffer.byteLength||(te=new Uint8Array(te)),{vectorTile:Q,rawData:te.buffer}})}loadData(z){return T._(this,void 0,void 0,function*(){var M;(M=this._pendingRequest)===null||M===void 0||M.abort();const V=!!(z&&z.request&&z.request.collectResourceTiming)&&new T.bu(z.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(z,this._pendingRequest),this._geoJSONIndex=z.cluster?new Vr(function({superclusterOptions:te,clusterProperties:ne}){if(!ne||!te)return te;const J={},pe={},ye={accumulated:null,zoom:0},he={properties:null},Pe=Object.keys(ne);for(const He of Pe){const[We,nt]=ne[He],ft=T.bB(nt),rt=T.bB(typeof We=="string"?[We,["accumulated"],["get",He]]:We);J[He]=ft.value,pe[He]=rt.value}return te.map=He=>{he.properties=He;const We={};for(const nt of Pe)We[nt]=J[nt].evaluate(ye,he);return We},te.reduce=(He,We)=>{he.properties=We;for(const nt of Pe)ye.accumulated=He[nt],He[nt]=pe[nt].evaluate(ye,he)},te}(z)).load((yield this._pendingData).features):(q=yield this._pendingData,new Ai(q,z.geojsonVtOptions)),this.loaded={};const Q={};if(V){const te=V.finish();te&&(Q.resourceTiming={},Q.resourceTiming[z.source]=JSON.parse(JSON.stringify(te)))}return Q}catch(Q){if(delete this._pendingRequest,T.bA(Q))return{abandoned:!0};throw Q}var q})}getData(){return T._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(z){const M=this.loaded;return M&&M[z.uid]?super.reloadTile(z):this.loadTile(z)}loadAndProcessGeoJSON(z,M){return T._(this,void 0,void 0,function*(){let V=yield this.loadGeoJSON(z,M);if(delete this._pendingRequest,typeof V!="object")throw new Error(`Input data given to '${z.source}' is not a valid GeoJSON object.`);if(Ke(V,!0),z.filter){const q=T.bB(z.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(", "));V={type:"FeatureCollection",features:V.features.filter(te=>q.value.evaluate({zoom:0},te))}}return V})}loadGeoJSON(z,M){return T._(this,void 0,void 0,function*(){const{promoteId:V}=z;if(z.request){const q=yield T.h(z.request,M);return this._dataUpdateable=mr(q.data,V)?Ar(q.data,V):void 0,q.data}if(typeof z.data=="string")try{const q=JSON.parse(z.data);return this._dataUpdateable=mr(q,V)?Ar(q,V):void 0,q}catch{throw new Error(`Input data given to '${z.source}' is not a valid GeoJSON object.`)}if(!z.dataDiff)throw new Error(`Input data given to '${z.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${z.source}`);return function(q,Q,te){var ne,J,pe,ye;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=it(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&&(((ne=he.removeProperties)===null||ne===void 0?void 0:ne.length)>0||((J=he.addOrUpdateProperties)===null||J===void 0?void 0:J.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 We of he.removeProperties)Object.prototype.hasOwnProperty.call(Pe.properties,We)&&delete Pe.properties[We];if(((ye=he.addOrUpdateProperties)===null||ye===void 0?void 0:ye.length)>0)for(const{key:We,value:nt}of he.addOrUpdateProperties)Pe.properties[We]=nt}}(this._dataUpdateable,z.dataDiff,V),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(z){return T._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(z){return this._geoJSONIndex.getClusterExpansionZoom(z.clusterId)}getClusterChildren(z){return this._geoJSONIndex.getChildren(z.clusterId)}getClusterLeaves(z){return this._geoJSONIndex.getLeaves(z.clusterId,z.limit,z.offset)}}class gr{constructor(z){this.self=z,this.actor=new T.F(z),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(M,V)=>{if(this.externalWorkerSourceTypes[M])throw new Error(`Worker source with name "${M}" already registered.`);this.externalWorkerSourceTypes[M]=V},this.self.addProtocol=T.bh,this.self.removeProtocol=T.bi,this.self.registerRTLTextPlugin=M=>{if(T.bC.isParsed())throw new Error("RTL text plugin already registered.");T.bC.setMethods(M)},this.actor.registerMessageHandler("LDT",(M,V)=>this._getDEMWorkerSource(M,V.source).loadTile(V)),this.actor.registerMessageHandler("RDT",(M,V)=>T._(this,void 0,void 0,function*(){this._getDEMWorkerSource(M,V.source).removeTile(V)})),this.actor.registerMessageHandler("GCEZ",(M,V)=>T._(this,void 0,void 0,function*(){return this._getWorkerSource(M,V.type,V.source).getClusterExpansionZoom(V)})),this.actor.registerMessageHandler("GCC",(M,V)=>T._(this,void 0,void 0,function*(){return this._getWorkerSource(M,V.type,V.source).getClusterChildren(V)})),this.actor.registerMessageHandler("GCL",(M,V)=>T._(this,void 0,void 0,function*(){return this._getWorkerSource(M,V.type,V.source).getClusterLeaves(V)})),this.actor.registerMessageHandler("LD",(M,V)=>this._getWorkerSource(M,V.type,V.source).loadData(V)),this.actor.registerMessageHandler("GD",(M,V)=>this._getWorkerSource(M,V.type,V.source).getData()),this.actor.registerMessageHandler("LT",(M,V)=>this._getWorkerSource(M,V.type,V.source).loadTile(V)),this.actor.registerMessageHandler("RT",(M,V)=>this._getWorkerSource(M,V.type,V.source).reloadTile(V)),this.actor.registerMessageHandler("AT",(M,V)=>this._getWorkerSource(M,V.type,V.source).abortTile(V)),this.actor.registerMessageHandler("RMT",(M,V)=>this._getWorkerSource(M,V.type,V.source).removeTile(V)),this.actor.registerMessageHandler("RS",(M,V)=>T._(this,void 0,void 0,function*(){if(!this.workerSources[M]||!this.workerSources[M][V.type]||!this.workerSources[M][V.type][V.source])return;const q=this.workerSources[M][V.type][V.source];delete this.workerSources[M][V.type][V.source],q.removeSource!==void 0&&q.removeSource(V)})),this.actor.registerMessageHandler("RM",M=>T._(this,void 0,void 0,function*(){delete this.layerIndexes[M],delete this.availableImages[M],delete this.workerSources[M],delete this.demWorkerSources[M]})),this.actor.registerMessageHandler("SR",(M,V)=>T._(this,void 0,void 0,function*(){this.referrer=V})),this.actor.registerMessageHandler("SRPS",(M,V)=>this._syncRTLPluginState(M,V)),this.actor.registerMessageHandler("IS",(M,V)=>T._(this,void 0,void 0,function*(){this.self.importScripts(V)})),this.actor.registerMessageHandler("SI",(M,V)=>this._setImages(M,V)),this.actor.registerMessageHandler("UL",(M,V)=>T._(this,void 0,void 0,function*(){this._getLayerIndex(M).update(V.layers,V.removedIds)})),this.actor.registerMessageHandler("SL",(M,V)=>T._(this,void 0,void 0,function*(){this._getLayerIndex(M).replace(V)}))}_setImages(z,M){return T._(this,void 0,void 0,function*(){this.availableImages[z]=M;for(const V in this.workerSources[z]){const q=this.workerSources[z][V];for(const Q in q)q[Q].availableImages=M}})}_syncRTLPluginState(z,M){return T._(this,void 0,void 0,function*(){if(T.bC.isParsed())return T.bC.getState();if(M.pluginStatus!=="loading")return T.bC.setState(M),M;const V=M.pluginURL;if(this.self.importScripts(V),T.bC.isParsed()){const q={pluginStatus:"loaded",pluginURL:V};return T.bC.setState(q),q}throw T.bC.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${V}`)})}_getAvailableImages(z){let M=this.availableImages[z];return M||(M=[]),M}_getLayerIndex(z){let M=this.layerIndexes[z];return M||(M=this.layerIndexes[z]=new c),M}_getWorkerSource(z,M,V){if(this.workerSources[z]||(this.workerSources[z]={}),this.workerSources[z][M]||(this.workerSources[z][M]={}),!this.workerSources[z][M][V]){const q={sendAsync:(Q,te)=>(Q.targetMapId=z,this.actor.sendAsync(Q,te))};switch(M){case"vector":this.workerSources[z][M][V]=new le(q,this._getLayerIndex(z),this._getAvailableImages(z));break;case"geojson":this.workerSources[z][M][V]=new qr(q,this._getLayerIndex(z),this._getAvailableImages(z));break;default:this.workerSources[z][M][V]=new this.externalWorkerSourceTypes[M](q,this._getLayerIndex(z),this._getAvailableImages(z))}}return this.workerSources[z][M][V]}_getDEMWorkerSource(z,M){return this.demWorkerSources[z]||(this.demWorkerSources[z]={}),this.demWorkerSources[z][M]||(this.demWorkerSources[z][M]=new ae),this.demWorkerSources[z][M]}}return T.i(self)&&(self.worker=new gr(self)),gr}),B("index",["exports","./shared"],function(T,c){var ge="4.5.2";let xe,ve;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=>(xe||(xe=document.createElement("a")),xe.href=u,xe.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(ve==null&&(ve=matchMedia("(prefers-reduced-motion: reduce)")),ve.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 ct={supported:!1,testSupport:function(u){!Ve&&Ke&&(pt?Mt(u):Ue=u)}};let Ue,Ke,Ve=!1,pt=!1;function Mt(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;ct.supported=!0}catch{}u.deleteTexture(t),Ve=!0}var ze;typeof document<"u"&&(Ke=document.createElement("img"),Ke.onload=()=>{Ue&&Mt(Ue),Ue=null,pt=!0},Ke.onerror=()=>{Ve=!0,Ue=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 w=o++;return a[w]=v,w},u.removeThrottleControl=v=>{delete a[v],m()},u.getImage=(v,w,k=!0)=>new Promise((E,L)=>{ct.supported&&(v.headers||(v.headers={}),v.headers.accept="image/webp,*/*"),c.e(v,{type:"image"}),t.push({abortController:w,requestParameters:v,supportImageRefresh:k,state:"queued",onError:F=>{L(F)},onSuccess:F=>{E(F)}}),m()});const h=v=>c._(this,void 0,void 0,function*(){v.state="running";const{requestParameters:w,supportImageRefresh:k,onError:E,onSuccess:L,abortController:F}=v,N=k===!1&&!c.i(self)&&!c.g(w.url)&&(!w.headers||Object.keys(w.headers).reduce((H,K)=>H&&K==="accept",!0));n++;const Z=N?y(w,F):c.m(w,F);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 w of Object.keys(a))if(a[w]())return!0;return!1})()?c.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:c.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let w=n;w<v&&t.length>0;w++){const k=t.shift();k.abortController.signal.aborted?w--:h(k)}},y=(v,w)=>new Promise((k,E)=>{const L=new Image,F=v.url,N=v.credentials;N&&N==="include"?L.crossOrigin="use-credentials":(N&&N==="same-origin"||!c.s(F))&&(L.crossOrigin="anonymous"),w.signal.addEventListener("abort",()=>{L.src="",E(c.c())}),L.fetchPriority="high",L.onload=()=>{L.onerror=L.onload=null,k({data:L})},L.onerror=()=>{L.onerror=L.onload=null,w.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=F})}(ze||(ze={})),ze.resetRequestQueue();class Pt{constructor(t){this._transformRequestFn=t}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function xt(u){var t=new c.A(3);return t[0]=u[0],t[1]=u[1],t[2]=u[2],t}var Gt,jt=function(u,t,n){return u[0]=t[0]-n[0],u[1]=t[1]-n[1],u[2]=t[2]-n[2],u};Gt=new c.A(3),c.A!=Float32Array&&(Gt[0]=0,Gt[1]=0,Gt[2]=0);var Fr=function(u){var t=u[0],n=u[1];return t*t+n*n};function bi(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 Or(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:y}=this,{gl:v}=y;if(this.useMipmap=!!(n&&n.useMipmap),v.bindTexture(v.TEXTURE_2D,this.texture),y.pixelStoreUnpackFlipY.set(!1),y.pixelStoreUnpack.set(1),y.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:w,y:k}=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,w,k,v.RGBA,v.UNSIGNED_BYTE,t):v.texSubImage2D(v.TEXTURE_2D,0,w,k,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 Ns(u){const{userImage:t}=u;return!!(t&&t.render&&t.render())&&(u.data.replace(new Uint8Array(t.data.buffer)),!0)}class li 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],y=m.x+1,v=m.y+1,w=this.getImage(h).data,k=w.width,E=w.height;c.R.copy(w,a,{x:0,y:0},{x:y,y:v},{width:k,height:E}),c.R.copy(w,a,{x:0,y:E-1},{x:y,y:v-1},{width:k,height:1}),c.R.copy(w,a,{x:0,y:0},{x:y,y:v+E},{width:k,height:1}),c.R.copy(w,a,{x:k-1,y:0},{x:y-1,y:v},{width:1,height:E}),c.R.copy(w,a,{x:0,y:0},{x:y+k,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`),Ns(o)&&this.updateImage(n,o)}}}const wi=1e20;function Ir(u,t,n,o,a,h,m,y,v){for(let w=t;w<t+o;w++)Pn(u,n*h+w,h,a,m,y,v);for(let w=n;w<n+a;w++)Pn(u,w*h+t,1,o,m,y,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 y=1,v=0,w=0;y<o;y++){a[y]=u[t+y*n];const k=y*y;do{const E=h[v];w=(a[y]-a[E]+k-E*E)/(y-E)/2}while(w<=m[v]&&--v>-1);v++,h[v]=y,m[v]=w,m[v+1]=wi}for(let y=0,v=0;y<o;y++){for(;m[v+1]<y;)v++;const w=h[v],k=y-w;u[t+y*n]=a[w]+k*k}}class ur{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:y}of o)a[h]||(a[h]={}),a[h][m]=y&&{id:y.id,bitmap:y.bitmap.clone(),metrics:y.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 y=ur.loadGlyphRange(t,h,this.url,this.requestManager);o.requests[h]=y}const m=yield o.requests[h];for(const y in m)this._doesCharSupportLocalGlyph(+y)||(o.glyphs[+y]=m[+y]);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 y="400";/bold/i.test(n)?y="900":/medium/i.test(n)?y="500":/light/i.test(n)&&(y="200"),h=t.tinySDF=new ur.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:a,fontWeight:y})}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}}}}ur.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"),y=yield c.l(m,new AbortController);if(!y||!y.data)throw new Error(`Could not load glyph range. range: ${t}, ${a}-${h}`);const v={};for(const w of c.n(y.data))v[w.id]=w;return v})},ur.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 y=this.size=u+4*t,v=this._createCanvas(y),w=this.ctx=v.getContext("2d",{willReadFrequently:!0});w.font=`${m} ${h} ${u}px ${a}`,w.textBaseline="alphabetic",w.textAlign="left",w.fillStyle="black",this.gridOuter=new Float64Array(y*y),this.gridInner=new Float64Array(y*y),this.f=new Float64Array(y),this.z=new Float64Array(y+1),this.v=new Uint16Array(y)}_createCanvas(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),y=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(h-a))),v=Math.min(this.size-this.buffer,m+Math.ceil(o)),w=y+2*this.buffer,k=v+2*this.buffer,E=Math.max(w*k,0),L=new Uint8ClampedArray(E),F={data:L,width:w,height:k,glyphWidth:y,glyphHeight:v,glyphTop:m,glyphLeft:0,glyphAdvance:t};if(y===0||v===0)return F;const{ctx:N,buffer:Z,gridInner:U,gridOuter:H}=this;N.clearRect(Z,Z,y,v),N.fillText(u,Z,Z+m);const K=N.getImageData(Z,Z,y,v);H.fill(wi,0,E),U.fill(0,0,E);for(let j=0;j<v;j++)for(let ee=0;ee<y;ee++){const se=K.data[4*(j*y+ee)+3]/255;if(se===0)continue;const ce=(j+Z)*w+ee+Z;if(se===1)H[ce]=0,U[ce]=wi;else{const _e=.5-se;H[ce]=_e>0?_e*_e:0,U[ce]=_e<0?_e*_e:0}}Ir(H,0,0,w,k,w,this.f,this.v,this.z),Ir(U,Z,Z,y,v,w,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 F}};class js{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 Pr extends c.E{constructor(t){super(),sn=sn||new c.q({anchor:new c.D(c.v.light.anchor),position:new js,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 Ei=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 Yi extends c.E{constructor(t){super(),this._transitionable=new c.T(Ei),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 kn{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,y=!0;a.push({left:h,right:m,isDash:y,zeroLength:t[0]===0});let v=t[0];for(let w=1;w<t.length;w++){y=!y;const k=t[w];h=v*o,v+=k,m=v*o,a.push({left:h,right:m,isDash:y,zeroLength:k===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 y=0,v=t[y];for(let w=0;w<this.width;w++){w/v.right>1&&(v=t[++y]);const k=Math.abs(w-v.left),E=Math.abs(w-v.right),L=Math.min(k,E);let F;const N=h/o*(a+1);if(v.isDash){const Z=a-Math.abs(N);F=Math.sqrt(L*L+Z*Z)}else F=a-Math.sqrt(L*L+N*N);this.data[m+w]=Math.max(0,Math.min(255,F+128))}}}addRegularDash(t){for(let y=t.length-1;y>=0;--y){const v=t[y],w=t[y+1];v.zeroLength?t.splice(y,1):w&&w.isDash===v.isDash&&(w.left=v.left,t.splice(y,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 y=0;y<this.width;y++){y/m.right>1&&(m=t[++h]);const v=Math.abs(y-m.left),w=Math.abs(y-m.right),k=Math.min(v,w);this.data[a+y]=Math.max(0,Math.min(255,(m.isDash?k:-k)+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 y=0;y<t.length;y++)h+=t[y];if(h!==0){const y=this.width/h,v=this.getDashRanges(t,this.width,y);n?this.addRoundDash(v,y,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 dr{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<dr.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 En=Math.floor(le.hardwareConcurrency/2);let Fi,Qi;function on(){return Fi||(Fi=new dr),Fi}dr.workerCount=c.C(globalThis)?Math.max(Math.min(En,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 Qi||(Qi=new an(on(),c.G),Qi.registerMessageHandler("GR",(u,t,n)=>c.m(t,n))),Qi}function kr(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,F){if(E)for(const N of E){const Z=L[N];if(Z&&Z.source===F&&Z.type==="fill-extrusion")return!0}else for(const N in L){const Z=L[N];if(Z.source===F&&Z.type==="fill-extrusion")return!0}return!1}(a&&a.layers,t,u.id),y=h.maxPitchScaleFactor(),v=u.tilesIn(o,y,m);v.sort(jr);const w=[];for(const E of v)w.push({wrappedTileID:E.tileID.wrapped().key,queryResults:E.tile.queryRenderedFeatures(t,n,u._state,E.queryGeometry,E.cameraQueryGeometry,E.scale,a,h,y,kr(u.transform,E.tileID))});const k=function(E){const L={},F={};for(const N of E){const Z=N.queryResults,U=N.wrappedTileID,H=F[U]=F[U]||{};for(const K in Z){const j=Z[K],ee=H[K]=H[K]||{},se=L[K]=L[K]||[];for(const ce of j)ee[ce.featureIndex]||(ee[ce.featureIndex]=!0,se.push(ce))}}return L}(w);for(const E in k)k[E].forEach(L=>{const F=L.feature,N=u.getFeatureState(F.layer["source-layer"],F.id);F.source=F.layer.source,F.layer["source-layer"]&&(F.sourceLayer=F.layer["source-layer"]),F.state=N});return k}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 _t 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 ze.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 Ut extends _t{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 ze.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),y={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:y});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,y=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,y,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,y,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,y,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 Er 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 ze.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,y=-1/0,v=-1/0;for(const L of a)h=Math.min(h,L.x),m=Math.min(m,L.y),y=Math.max(y,L.x),v=Math.max(v,L.y);const w=Math.max(y-h,v-m),k=Math.max(0,Math.floor(-Math.log(w)/Math.LN2)),E=Math.pow(2,k);return new c.a1(k,Math.floor((h+y)/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 Cn extends Er{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 Er{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 Er;case"raster":return _t;case"raster-dem":return Ut;case"vector":return rs;case"video":return Cn;case"canvas":return Hi}return ss[u]},Ie="RTLPluginLoaded";class pr 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 fr(){return Si||(Si=new pr),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 y of a){const v=y.layerIds.map(w=>h.getLayer(w)).filter(Boolean);if(v.length!==0){y.layers=v,y.stateDependentLayerIds&&(y.stateDependentLayers=y.stateDependentLayerIds.map(w=>v.filter(k=>k.id===w)[0]));for(const w of v)m[w.id]=y}}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,fr().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,y,v,w,k){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:a,cameraQueryGeometry:h,scale:m,tileSize:this.tileSize,pixelPosMatrix:k,transform:v,params:y,queryPadding:this.queryPadding*w},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 y=c.a7(n&&n.filter),{z:v,x:w,y:k}=this.tileID.canonical,E={z:v,x:w,y:k};for(let L=0;L<m.length;L++){const F=m.feature(L);if(y.needGeometry){const U=c.a8(F,!0);if(!y.filter(new c.a9(this.tileID.overscaledZ),U,this.tileID.canonical))continue}else if(!y.filter(new c.a9(this.tileID.overscaledZ),F))continue;const N=o.getId(F,h),Z=new c.aa(F,v,w,k,N);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",y=o[m],v=t[m];if(!y||!v||Object.keys(v).length===0)continue;h.update(v,y,this.imageAtlas&&this.imageAtlas.patternPositions||{});const w=n&&n.style&&n.style.getLayer(a);w&&(this.queryPadding=Math.max(this.queryPadding,w.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 Ee{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 ot{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 y of Object.keys(this.deletedStates[a][m]))delete this.state[a][m][y];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 Ye 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,y)=>{const v=new(os(h.type))(a,h,m,y);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 Ee(0,a=>this._unloadTile(a)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new ot,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,y=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.y||v.x-y.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 y=h.tileID.canonical.y-a.tileID.canonical.y,v=Math.pow(2,a.tileID.canonical.z),w=h.tileID.key;m===0&&y===0||Math.abs(y)>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,y),a.neighboringTiles&&a.neighboringTiles[w]&&(a.neighboringTiles[w].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 y=m.tileID;for(;m&&m.tileID.overscaledZ>n+1;){const w=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[w.key],m&&m.hasData()&&(y=w)}let v=y;for(;v.overscaledZ>n;)if(v=v.scaledTo(v.overscaledZ-1),t[v.key]){a[y.key]=y;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 y={},v={},w=Object.keys(t),k=le.now();for(const E of w){const L=t[E],F=this._tiles[E];if(!F||F.fadeEndTime!==0&&F.fadeEndTime<=k)continue;const N=this.findLoadedParent(L,n),Z=this.findLoadedSibling(L),U=N||Z||null;U&&(this._addTile(U.tileID),y[U.tileID.key]=U.tileID),v[E]=L}this._retainLoadedChildren(v,a,o,t);for(const E in y)t[E]||(this._coveredTiles[E]=!0,t[E]=y[E]);if(m){const E={},L={};for(const F of h)this._tiles[F.key].hasData()?E[F.key]=F:L[F.key]=F;for(const F in L){const N=L[F].children(this._source.maxzoom);this._tiles[N[0].key]&&this._tiles[N[1].key]&&this._tiles[N[2].key]&&this._tiles[N[3].key]&&(E[N[0].key]=t[N[0].key]=N[0],E[N[1].key]=t[N[1].key]=N[1],E[N[2].key]=t[N[2].key]=N[2],E[N[3].key]=t[N[3].key]=N[3],delete L[F])}for(const F in L){const N=L[F],Z=this.findLoadedParent(N,this._source.minzoom),U=this.findLoadedSibling(N),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 F in this._tiles)E[F]||(this._coveredTiles[F]=!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(k=>new c.S(k.canonical.z,k.wrap,k.canonical.z,k.canonical.x,k.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(k=>this._source.hasTile(k)))):o=[];const a=t.coveringZoomLevel(this._source),h=Math.max(a-Ye.maxOverzooming,this._source.minzoom),m=Math.max(a+Ye.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const k={};for(const E of o)if(E.canonical.z>this._source.minzoom){const L=E.scaledTo(E.canonical.z-1);k[L.key]=L;const F=E.scaledTo(Math.max(this._source.minzoom,Math.min(E.canonical.z,5)));k[F.key]=F}o=o.concat(Object.values(k))}const y=o.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,y&&this.fire(new c.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const v=this._updateRetainedTiles(o,a);er(this._source.type)&&this._updateCoveredAndRetainedTiles(v,h,m,a,o,n);for(const k in v)this._tiles[k].clearFadeHold();const w=c.ac(this._tiles,v);for(const k of w){const E=this._tiles[k];E.hasSymbolBuckets&&!E.holdingForFade()?E.setHoldDuration(this.map._fadeDuration):E.hasSymbolBuckets&&!E.symbolFadeFinished()||this._removeTile(k)}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-Ye.maxOverzooming,this._source.minzoom),y=Math.max(n+Ye.maxUnderzooming,this._source.minzoom),v={};for(const w of t){const k=this._addTile(w);a[w.key]=w,k.hasData()||n<this._source.maxzoom&&(v[w.key]=w)}this._retainLoadedChildren(v,n,y,a);for(const w of t){let k=this._tiles[w.key];if(k.hasData())continue;if(n+1>this._source.maxzoom){const L=w.children(this._source.maxzoom)[0],F=this.getTile(L);if(F&&F.hasData()){a[L.key]=L;continue}}else{const L=w.children(this._source.maxzoom);if(a[L[0].key]&&a[L[1].key]&&a[L[2].key]&&a[L[3].key])continue}let E=k.wasRequested();for(let L=w.overscaledZ-1;L>=m;--L){const F=w.scaledTo(L);if(h[F.key])break;if(h[F.key]=!0,k=this.getTile(F),!k&&E&&(k=this._addTile(F)),k){const N=k.hasData();if((N||!(!((o=this.map)===null||o===void 0)&&o.cancelPendingTileRequestsWhileZooming)||E)&&(a[F.key]=F),E=k.wasRequested(),N)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,y=t.map(N=>h.pointCoordinate(N,this.terrain)),v=m.map(N=>h.pointCoordinate(N,this.terrain)),w=this.getIds();let k=1/0,E=1/0,L=-1/0,F=-1/0;for(const N of v)k=Math.min(k,N.x),E=Math.min(E,N.y),L=Math.max(L,N.x),F=Math.max(F,N.y);for(let N=0;N<w.length;N++){const Z=this._tiles[w[N]];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(k,E)),U.getTilePoint(new c.Z(L,F))];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=y.map(ce=>U.getTilePoint(ce)),se=v.map(ce=>U.getTilePoint(ce));a.push({tile:Z,tileID:U,queryGeometry:ee,cameraQueryGeometry:se,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(er(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 er(u){return u==="raster"||u==="image"||u==="video"}Ye.maxOverzooming=10,Ye.maxUnderzooming=3;class it{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],y=o-m,v=y>0?(a-m)/y:0;return this.points[h].mult(1-v).add(this.points[n].mult(v))}}function mr(u,t){let n=!0;return u==="always"||u!=="never"&&t!=="never"||(n=!1),n}class Ar{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,y){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 w=0;w<this.boxKeys.length;w++)v.push({key:this.boxKeys[w],x1:this.bboxes[4*w],y1:this.bboxes[4*w+1],x2:this.bboxes[4*w+2],y2:this.bboxes[4*w+3]});for(let w=0;w<this.circleKeys.length;w++){const k=this.circles[3*w],E=this.circles[3*w+1],L=this.circles[3*w+2];v.push({key:this.circleKeys[w],x1:k-L,y1:E-L,x2:k+L,y2:E+L})}}else this._forEachCell(t,n,o,a,this._queryCell,v,{hitTest:h,overlapMode:m,seenUids:{box:{},circle:{}}},y);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,y=t+o,v=n-o,w=n+o;if(y<0||m>this.width||w<0||v>this.height)return!1;const k=[];return this._forEachCell(m,v,y,w,this._queryCellCircle,k,{hitTest:!0,overlapMode:a,circle:{x:t,y:n,radius:o},seenUids:{box:{},circle:{}}},h),k.length>0}_queryCell(t,n,o,a,h,m,y,v){const{seenUids:w,hitTest:k,overlapMode:E}=y,L=this.boxCells[h];if(L!==null){const N=this.bboxes;for(const Z of L)if(!w.box[Z]){w.box[Z]=!0;const U=4*Z,H=this.boxKeys[Z];if(t<=N[U+2]&&n<=N[U+3]&&o>=N[U+0]&&a>=N[U+1]&&(!v||v(H))&&(!k||!mr(E,H.overlapMode))&&(m.push({key:H,x1:N[U],y1:N[U+1],x2:N[U+2],y2:N[U+3]}),k))return!0}}const F=this.circleCells[h];if(F!==null){const N=this.circles;for(const Z of F)if(!w.circle[Z]){w.circle[Z]=!0;const U=3*Z,H=this.circleKeys[Z];if(this._circleAndRectCollide(N[U],N[U+1],N[U+2],t,n,o,a)&&(!v||v(H))&&(!k||!mr(E,H.overlapMode))){const K=N[U],j=N[U+1],ee=N[U+2];if(m.push({key:H,x1:K-ee,y1:j-ee,x2:K+ee,y2:j+ee}),k)return!0}}}return!1}_queryCellCircle(t,n,o,a,h,m,y,v){const{circle:w,seenUids:k,overlapMode:E}=y,L=this.boxCells[h];if(L!==null){const N=this.bboxes;for(const Z of L)if(!k.box[Z]){k.box[Z]=!0;const U=4*Z,H=this.boxKeys[Z];if(this._circleAndRectCollide(w.x,w.y,w.radius,N[U+0],N[U+1],N[U+2],N[U+3])&&(!v||v(H))&&!mr(E,H.overlapMode))return m.push(!0),!0}}const F=this.circleCells[h];if(F!==null){const N=this.circles;for(const Z of F)if(!k.circle[Z]){k.circle[Z]=!0;const U=3*Z,H=this.circleKeys[Z];if(this._circlesCollide(N[U],N[U+1],N[U+2],w.x,w.y,w.radius)&&(!v||v(H))&&!mr(E,H.overlapMode))return m.push(!0),!0}}}_forEachCell(t,n,o,a,h,m,y,v){const w=this._convertToXCellCoord(t),k=this._convertToYCellCoord(n),E=this._convertToXCellCoord(o),L=this._convertToYCellCoord(a);for(let F=w;F<=E;F++)for(let N=k;N<=L;N++)if(h.call(this,t,n,o,a,this.xCellCount*N+F,m,y,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 y=a-t,v=h-n,w=o+m;return w*w>y*y+v*v}_circleAndRectCollide(t,n,o,a,h,m,y){const v=(m-a)/2,w=Math.abs(t-(a+v));if(w>v+o)return!1;const k=(y-h)/2,E=Math.abs(n-(h+k));if(E>k+o)return!1;if(w<=v||E<=k)return!0;const L=w-v,F=E-k;return L*L+F*F<=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 gr(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,y){const v=m[0],w=m[1];h[0]=y[0]*v+y[4]*w+y[12],h[1]=y[1]*v+y[5]*w+y[13],h[3]=y[3]*v+y[7]*w+y[15]}(o,o,t));const a=o[3];return{point:new c.P(o[0]/a,o[1]/a),signedDistanceFromCamera:a,isOccluded:!1}}function z(u,t){return .5+u/t*.5}function M(u,t){return u.x>=-t[0]&&u.x<=t[0]&&u.y>=-t[1]&&u.y<=t[1]}function V(u,t,n,o,a,h,m,y,v,w,k,E,L,F,N){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,se=n.transform.width/n.transform.height;let ce=!1;for(let _e=0;_e<ee.length;_e++){const we=ee.get(_e);if(we.hidden||we.writingMode===c.ai.vertical&&!ce){We(we.numGlyphs,K);continue}ce=!1;const Le=G(new c.P(we.anchorX,we.anchorY),t,N);if(!M(Le.point,H)){We(we.numGlyphs,K);continue}const Be=z(n.transform.cameraToCenterDistance,Le.signedDistanceFromCamera),Se=c.aj(Z,U,we),Te=m?Se/Be:Se*Be,je={getElevation:N,labelPlaneMatrix:a,lineVertexArray:j,pitchWithMap:m,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:w,tileAnchorPoint:new c.P(we.anchorX,we.anchorY),unwrappedTileID:k,width:E,height:L,translation:F},tt=te(je,we,Te,!1,y,t,h,u.glyphOffsetArray,K,se,v);ce=tt.useVertical,(tt.notEnoughRoom||ce||tt.needsFlipping&&te(je,we,Te,!0,y,t,h,u.glyphOffsetArray,K,se,v).notEnoughRoom)&&We(we.numGlyphs,K)}o?u.text.dynamicLayoutVertexBuffer.updateData(K):u.icon.dynamicLayoutVertexBuffer.updateData(K)}function q(u,t,n,o,a,h,m,y){const v=h.glyphStartIndex+h.numGlyphs,w=h.lineStartIndex,k=h.lineStartIndex+h.lineLength,E=t.getoffsetX(h.glyphStartIndex),L=t.getoffsetX(v-1),F=Pe(u*E,n,o,a,h.segment,w,k,y,m);if(!F)return null;const N=Pe(u*L,n,o,a,h.segment,w,k,y,m);return N?y.projectionCache.anyProjectionOccluded?null:{first:F,last:N}: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,y,v,w,k){const E=n/24,L=t.lineOffsetX*E,F=t.lineOffsetY*E;let N;if(t.numGlyphs>1){const Z=t.glyphStartIndex+t.numGlyphs,U=t.lineStartIndex,H=t.lineStartIndex+t.lineLength,K=q(E,y,L,F,o,t,k,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 se=Q(t.writingMode,j,ee,w);if(se)return se}N=[K.first];for(let se=t.glyphStartIndex+1;se<Z-1;se++)N.push(Pe(E*y.getoffsetX(se),L,F,o,t.segment,U,H,u,k));N.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,_e,we,Le,Be,Se){return ne(ce,_e,we,1,Be,Se)}(u.tileAnchorPoint,K,U,0,h,u),se=Q(t.writingMode,U,ee,w);if(se)return se}const Z=Pe(E*y.getoffsetX(t.glyphStartIndex),L,F,o,t.segment,t.lineStartIndex,t.lineStartIndex+t.lineLength,u,k);if(!Z||u.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};N=[Z]}for(const Z of N)c.ak(v,Z.point,Z.angle);return{}}function ne(u,t,n,o,a,h){const m=u.add(u.sub(t)._unit()),y=a!==void 0?G(m,a,h.getElevation).point:pe(m.x,m.y,h).point,v=n.sub(y);return n.add(v._mult(o/v.mag()))}function J(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(y,v,w,k,E){return ne(y,v,w,k,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 ye(u,t,n){return u._unit()._perp()._mult(t*n)}function he(u,t,n,o,a,h,m,y,v){if(y.projectionCache.offsets[u])return y.projectionCache.offsets[u];const w=n.add(t);if(u+v.direction<o||u+v.direction>=a)return y.projectionCache.offsets[u]=w,w;const k=J(u+v.direction,y,v),E=ye(k.sub(n),m,v.direction),L=n.add(E),F=k.add(E);return y.projectionCache.offsets[u]=c.al(h,w,L,F)||w,y.projectionCache.offsets[u]}function Pe(u,t,n,o,a,h,m,y,v){const w=o?u-t:u+t;let k=w>0?1:-1,E=0;o&&(k*=-1,E=Math.PI),k<0&&(E+=Math.PI);let L,F=k>0?h+a:h+a+1;y.projectionCache.cachedAnchorPoint?L=y.projectionCache.cachedAnchorPoint:(L=pe(y.tileAnchorPoint.x,y.tileAnchorPoint.y,y).point,y.projectionCache.cachedAnchorPoint=L);let N,Z,U=L,H=L,K=0,j=0;const ee=Math.abs(w),se=[];let ce;for(;K+j<=ee;){if(F+=k,F<h||F>=m)return null;K+=j,H=U,Z=N;const Le={absOffsetX:ee,direction:k,distanceFromAnchor:K,previousVertex:H};if(U=J(F,y,Le),n===0)se.push(H),ce=U.sub(H);else{let Be;const Se=U.sub(H);Be=Se.mag()===0?ye(J(F+k,y,Le).sub(U),n,k):ye(Se,n,k),Z||(Z=H.add(Be)),N=he(F,Be,U,h,m,Z,n,y,Le),se.push(Z),ce=N.sub(Z)}j=ce.mag()}const _e=ce._mult((ee-K)/j)._add(Z||H),we=E+Math.atan2(U.y-H.y,U.x-H.x);return se.push(_e),{point:_e,angle:v?we:0,path:se}}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 We(u,t){for(let n=0;n<u;n++){const o=t.length;t.resize(o+4),t.float32.set(He,3*o)}}const nt=100;class ft{constructor(t,n,o=new Ar(t.width+200,t.height+200,25),a=new Ar(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+nt,this.screenBottomBoundary=t.height+nt,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,n,o,a,h,m,y,v,w,k,E){const L=t.anchorPointX+v[0],F=t.anchorPointY+v[1],N=this.projectAndGetPerspectiveRatio(a,L,F,h,k),Z=this._projectCollisionBox(t,o,a,h,m,y,v,N,k,E),[U,H,K,j]=Z.box;return this.mapProjection.useSpecialProjectionForSymbols&&(m?Z.allPointsOccluded:this.mapProjection.isOccluded(L,F,h))||N.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid(U,H,K,j)||n!=="always"&&this.grid.hitTest(U,H,K,j,n,w)?{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,y,v,w,k,E,L,F,N,Z,U){const H=[],K=new c.P(n.anchorX,n.anchorY),j=this.getPerspectiveRatio(m,K.x,K.y,y,U),ee=(E?h/j:h*j)/c.aq,se={getElevation:U,labelPlaneMatrix:v,lineVertexArray:o,pitchWithMap:E,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:K,unwrappedTileID:y,width:this.transform.width,height:this.transform.height,translation:Z},ce=q(ee,a,n.lineOffsetX*ee,n.lineOffsetY*ee,!1,n,!1,se);let _e=!1,we=!1,Le=!0;if(ce){const Be=.5*F*j+N,Se=new c.P(-100,-100),Te=new c.P(this.screenRightBoundary,this.screenBottomBoundary),je=new it,tt=ce.first,ke=ce.last;let Ce=[];for(let st=tt.path.length-1;st>=1;st--)Ce.push(tt.path[st]);for(let st=1;st<ke.path.length;st++)Ce.push(ke.path[st]);const Qe=2.5*Be;if(w){const st=this.projectPathToScreenSpace(Ce,se,w);Ce=st.some(ut=>ut.signedDistanceFromCamera<=0)?[]:st.map(ut=>ut.point)}let Lt=[];if(Ce.length>0){const st=Ce[0].clone(),ut=Ce[0].clone();for(let Rt=1;Rt<Ce.length;Rt++)st.x=Math.min(st.x,Ce[Rt].x),st.y=Math.min(st.y,Ce[Rt].y),ut.x=Math.max(ut.x,Ce[Rt].x),ut.y=Math.max(ut.y,Ce[Rt].y);Lt=st.x>=Se.x&&ut.x<=Te.x&&st.y>=Se.y&&ut.y<=Te.y?[Ce]:ut.x<Se.x||st.x>Te.x||ut.y<Se.y||st.y>Te.y?[]:c.am([Ce],Se.x,Se.y,Te.x,Te.y)}for(const st of Lt){je.reset(st,.25*Be);let ut=0;ut=je.length<=.5*Be?1:Math.ceil(je.paddedLength/Qe)+1;for(let Rt=0;Rt<ut;Rt++){const di=Rt/Math.max(ut-1,1),rr=je.lerp(di),Bt=rr.x+nt,Mi=rr.y+nt;H.push(Bt,Mi,Be,0);const Ii=Bt-Be,pi=Mi-Be,fi=Bt+Be,nr=Mi+Be;if(Le=Le&&this.isOffscreen(Ii,pi,fi,nr),we=we||this.isInsideGrid(Ii,pi,fi,nr),t!=="always"&&this.grid.hitTestCircle(Bt,Mi,Be,t,L)&&(_e=!0,!k))return{circles:[],offscreen:!1,collisionDetected:_e}}}}return{circles:!k&&_e||!we||j<this.perspectiveRatioCutoff?[]:H,offscreen:Le,collisionDetected:_e}}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 k of t){const E=new c.P(k.x+nt,k.y+nt);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 y=this.grid.query(o,a,h,m).concat(this.ignoredGrid.query(o,a,h,m)),v={},w={};for(const k of y){const E=k.key;if(v[E.bucketInstanceId]===void 0&&(v[E.bucketInstanceId]={}),v[E.bucketInstanceId][E.featureIndex])continue;const L=[new c.P(k.x1,k.y1),new c.P(k.x2,k.y1),new c.P(k.x2,k.y2),new c.P(k.x1,k.y2)];c.an(n,L)&&(v[E.bucketInstanceId][E.featureIndex]=!0,w[E.bucketInstanceId]===void 0&&(w[E.bucketInstanceId]=[]),w[E.bucketInstanceId].push(E.featureIndex))}return w}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 y=o?this.ignoredGrid:this.grid,v={bucketInstanceId:a,featureIndex:h,collisionGroupID:m,overlapMode:n};for(let w=0;w<t.length;w+=4)y.insertCircle(v,t[w],t[w+1],t[w+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+nt,(1-m.point.y)/2*this.transform.height+nt),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<nt||t>=this.screenRightBoundary||a<nt||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,y,v,w,k){const E=n*v.perspectiveRatio;let L=new c.P(1,0),F=new c.P(0,1);const N=new c.P(t.anchorPointX+y[0],t.anchorPointY+y[1]);if(m&&!h){const Be=this.projectAndGetPerspectiveRatio(o,N.x+1,N.y,a,w).point.sub(v.point).unit(),Se=Math.atan(Be.y/Be.x)+(Be.x<0?Math.PI:0),Te=Math.sin(Se),je=Math.cos(Se);L=new c.P(je,Te),F=new c.P(-Te,je)}else if(!m&&h){const Be=-this.transform.angle,Se=Math.sin(Be),Te=Math.cos(Be);L=new c.P(Te,Se),F=new c.P(-Se,Te)}let Z=v.point,U=E;if(h){Z=N;const Be=this.transform.zoom-Math.floor(this.transform.zoom);U=Math.pow(2,-Be),U*=this.mapProjection.getPitchedTextCorrection(this.transform,N,a),k||(U*=c.ad(.5+v.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))}k&&(Z=Z.add(L.mult(k.x*U)).add(F.mult(k.y*U)));const H=t.x1*U,K=t.x2*U,j=(H+K)/2,ee=t.y1*U,se=t.y2*U,ce=(ee+se)/2,_e=[{offsetX:H,offsetY:ee},{offsetX:j,offsetY:ee},{offsetX:K,offsetY:ee},{offsetX:K,offsetY:ce},{offsetX:K,offsetY:se},{offsetX:j,offsetY:se},{offsetX:H,offsetY:se},{offsetX:H,offsetY:ce}];let we=[];for(const{offsetX:Be,offsetY:Se}of _e)we.push(new c.P(Z.x+L.x*Be+F.x*Se,Z.y+L.y*Be+F.y*Se));let Le=!1;if(h){const Be=we.map(Se=>this.projectAndGetPerspectiveRatio(o,Se.x,Se.y,a,w));Le=Be.some(Se=>!Se.isOccluded),we=Be.map(Se=>Se.point)}else Le=!0;return{box:c.ap(we),allPointsOccluded:!Le}}}function rt(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 $t{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 at{constructor(){this.invProjMatrix=c.H(),this.viewportMatrix=c.H(),this.circles=[]}}class vt{constructor(t,n,o,a,h){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=o,this.bucketIndex=a,this.tileID=h}}class Ot{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 ci{constructor(t,n,o,a,h,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 Ot(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 y=o.collisionBoxArray,v=h.layers[0].layout,w=h.layers[0].paint,k=Math.pow(2,this.transform.zoom-o.tileID.overscaledZ),E=o.tileSize/c.X,L=o.tileID.toUnwrapped(),F=this.transform.calculatePosMatrix(L),N=v.get("text-pitch-alignment")==="map",Z=v.get("text-rotation-alignment")==="map",U=rt(o,1,this.transform.zoom),H=this.collisionIndex.mapProjection.translatePosition(this.transform,o,w.get("text-translate"),w.get("text-translate-anchor")),K=this.collisionIndex.mapProjection.translatePosition(this.transform,o,w.get("icon-translate"),w.get("icon-translate-anchor")),j=qr(F,N,Z,this.transform,U);let ee=null;if(N){const ce=gr(F,N,Z,this.transform,U);ee=c.L([],this.transform.labelPlaneMatrix,ce)}this.retainedQueryData[h.bucketInstanceId]=new vt(h.bucketInstanceId,m,h.sourceLayerIndex,h.index,o.tileID);const se={bucket:h,layout:v,translationText:H,translationIcon:K,posMatrix:F,unwrappedTileID:L,textLabelPlaneMatrix:j,labelToScreenMatrix:ee,scale:k,textPixelRatio:E,holdingForFade:o.holdingForFade(),collisionBoxArray:y,partiallyEvaluatedTextSize:c.ah(h.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(h.sourceID)};if(a)for(const ce of h.sortKeyRanges){const{sortKey:_e,symbolInstanceStart:we,symbolInstanceEnd:Le}=ce;t.push({sortKey:_e,symbolInstanceStart:we,symbolInstanceEnd:Le,parameters:se})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:h.symbolInstances.length,parameters:se})}attemptAnchorPlacement(t,n,o,a,h,m,y,v,w,k,E,L,F,N,Z,U,H,K,j){const ee=c.ar[t.textAnchor],se=[t.textOffset0,t.textOffset1],ce=ei(ee,o,a,se,h),_e=this.collisionIndex.placeCollisionBox(n,L,v,w,k,y,m,U,E.predicate,j,ce);if((!K||this.collisionIndex.placeCollisionBox(K,L,v,w,k,y,m,H,E.predicate,j,ce).placeable)&&_e.placeable){let we;if(this.prevPlacement&&this.prevPlacement.variableOffsets[F.crossTileID]&&this.prevPlacement.placements[F.crossTileID]&&this.prevPlacement.placements[F.crossTileID].text&&(we=this.prevPlacement.variableOffsets[F.crossTileID].anchor),F.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[F.crossTileID]={textOffset:se,width:o,height:a,anchor:ee,textBoxScale:h,prevAnchor:we},this.markUsedJustification(N,ee,F,Z),N.allowVerticalPlacement&&(this.markUsedOrientation(N,Z,F),this.placedOrientations[F.crossTileID]=Z),{shift:ce,placedGlyphBoxes:_e}}}placeLayerBucketPart(t,n,o){const{bucket:a,layout:h,translationText:m,translationIcon:y,posMatrix:v,unwrappedTileID:w,textLabelPlaneMatrix:k,labelToScreenMatrix:E,textPixelRatio:L,holdingForFade:F,collisionBoxArray:N,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",se=c.as(h,"icon-overlap","icon-allow-overlap"),ce=se==="always",_e=h.get("text-rotation-alignment")==="map",we=h.get("text-pitch-alignment")==="map",Le=h.get("icon-text-fit")!=="none",Be=h.get("symbol-z-order")==="viewport-y",Se=ee&&(ce||!a.hasIconData()||K),Te=ce&&(ee||!a.hasTextData()||H);!a.collisionArrays&&N&&a.deserializeCollisionBoxes(N);const je=this._getTerrainElevationFunc(this.retainedQueryData[a.bucketInstanceId].tileID),tt=(ke,Ce,Qe)=>{var Lt,st;if(n[ke.crossTileID])return;if(F)return void(this.placements[ke.crossTileID]=new Kt(!1,!1,!1));let ut=!1,Rt=!1,di=!0,rr=null,Bt={box:null,placeable:!1,offscreen:null},Mi={box:null,placeable:!1,offscreen:null},Ii=null,pi=null,fi=null,nr=0,xn=0,xo=0;Ce.textFeatureIndex?nr=Ce.textFeatureIndex:ke.useRuntimeCollisionCircles&&(nr=ke.featureIndex),Ce.verticalTextFeatureIndex&&(xn=Ce.verticalTextFeatureIndex);const Un=Ce.textBox;if(Un){const oi=mi=>{let gi=c.ai.horizontal;if(a.allowVerticalPlacement&&!mi&&this.prevPlacement){const ri=this.prevPlacement.placedOrientations[ke.crossTileID];ri&&(this.placedOrientations[ke.crossTileID]=ri,gi=ri,this.markUsedOrientation(a,gi,ke))}return gi},sr=(mi,gi)=>{if(a.allowVerticalPlacement&&ke.numVerticalGlyphVertices>0&&Ce.verticalTextBox){for(const ri of a.writingModes)if(ri===c.ai.vertical?(Bt=gi(),Mi=Bt):Bt=mi(),Bt&&Bt.placeable)break}else Bt=mi()},Kr=ke.textAnchorOffsetStartIndex,$n=ke.textAnchorOffsetEndIndex;if($n===Kr){const mi=(gi,ri)=>{const Nt=this.collisionIndex.placeCollisionBox(gi,j,L,v,w,we,_e,m,U.predicate,je);return Nt&&Nt.placeable&&(this.markUsedOrientation(a,ri,ke),this.placedOrientations[ke.crossTileID]=ri),Nt};sr(()=>mi(Un,c.ai.horizontal),()=>{const gi=Ce.verticalTextBox;return a.allowVerticalPlacement&&ke.numVerticalGlyphVertices>0&&gi?mi(gi,c.ai.vertical):{box:null,offscreen:null}}),oi(Bt&&Bt.placeable)}else{let mi=c.ar[(st=(Lt=this.prevPlacement)===null||Lt===void 0?void 0:Lt.variableOffsets[ke.crossTileID])===null||st===void 0?void 0:st.anchor];const gi=(Nt,qn,Ba)=>{const ti=Nt.x2-Nt.x1,Xl=Nt.y2-Nt.y1,bo=ke.textBoxScale,wo=Le&&se==="never"?qn:null;let Yr=null,Jl=j==="never"?1:2,Fa="never";mi&&Jl++;for(let Oa=0;Oa<Jl;Oa++){for(let Va=Kr;Va<$n;Va++){const So=a.textAnchorOffsets.get(Va);if(mi&&So.textAnchor!==mi)continue;const Zn=this.attemptAnchorPlacement(So,Nt,ti,Xl,bo,_e,we,L,v,w,U,Fa,ke,a,Ba,m,y,wo,je);if(Zn&&(Yr=Zn.placedGlyphBoxes,Yr&&Yr.placeable))return ut=!0,rr=Zn.shift,Yr}mi?mi=null:Fa=j}return o&&!Yr&&(Yr={box:this.collisionIndex.placeCollisionBox(Un,"always",L,v,w,we,_e,m,U.predicate,je,new c.P(0,0)).box,offscreen:!1,placeable:!1}),Yr};sr(()=>gi(Un,Ce.iconBox,c.ai.horizontal),()=>{const Nt=Ce.verticalTextBox;return a.allowVerticalPlacement&&(!Bt||!Bt.placeable)&&ke.numVerticalGlyphVertices>0&&Nt?gi(Nt,Ce.verticalIconBox,c.ai.vertical):{box:null,occluded:!0,offscreen:null}}),Bt&&(ut=Bt.placeable,di=Bt.offscreen);const ri=oi(Bt&&Bt.placeable);if(!ut&&this.prevPlacement){const Nt=this.prevPlacement.variableOffsets[ke.crossTileID];Nt&&(this.variableOffsets[ke.crossTileID]=Nt,this.markUsedJustification(a,Nt.anchor,ke,ri))}}}if(Ii=Bt,ut=Ii&&Ii.placeable,di=Ii&&Ii.offscreen,ke.useRuntimeCollisionCircles){const oi=a.text.placedSymbolArray.get(ke.centerJustifiedTextSymbolIndex),sr=c.aj(a.textSizeData,Z,oi),Kr=h.get("text-padding");pi=this.collisionIndex.placeCollisionCircles(j,oi,a.lineVertexArray,a.glyphOffsetArray,sr,v,w,k,E,o,we,U.predicate,ke.collisionCircleDiameter,Kr,m,je),pi.circles.length&&pi.collisionDetected&&!o&&c.w("Collisions detected, but collision boxes are not shown"),ut=ee||pi.circles.length>0&&!pi.collisionDetected,di=di&&pi.offscreen}if(Ce.iconFeatureIndex&&(xo=Ce.iconFeatureIndex),Ce.iconBox){const oi=sr=>this.collisionIndex.placeCollisionBox(sr,se,L,v,w,we,_e,y,U.predicate,je,Le&&rr?rr:void 0);Mi&&Mi.placeable&&Ce.verticalIconBox?(fi=oi(Ce.verticalIconBox),Rt=fi.placeable):(fi=oi(Ce.iconBox),Rt=fi.placeable),di=di&&fi.offscreen}const vn=H||ke.numHorizontalGlyphVertices===0&&ke.numVerticalGlyphVertices===0,vo=K||ke.numIconVertices===0;vn||vo?vo?vn||(Rt=Rt&&ut):ut=Rt&&ut:Rt=ut=Rt&&ut;const Ra=Rt&&fi.placeable;if(ut&&Ii.placeable&&this.collisionIndex.insertCollisionBox(Ii.box,j,h.get("text-ignore-placement"),a.bucketInstanceId,Mi&&Mi.placeable&&xn?xn:nr,U.ID),Ra&&this.collisionIndex.insertCollisionBox(fi.box,se,h.get("icon-ignore-placement"),a.bucketInstanceId,xo,U.ID),pi&&ut&&this.collisionIndex.insertCollisionCircles(pi.circles,j,h.get("text-ignore-placement"),a.bucketInstanceId,nr,U.ID),o&&this.storeCollisionData(a.bucketInstanceId,Qe,Ce,Ii,fi,pi),ke.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[ke.crossTileID]=new Kt(ut||Se,Rt||Te,di||a.justReloaded),n[ke.crossTileID]=!0};if(Be){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const ke=a.getSortedSymbolIndexes(this.transform.angle);for(let Ce=ke.length-1;Ce>=0;--Ce){const Qe=ke[Ce];tt(a.symbolInstances.get(Qe),a.collisionArrays[Qe],Qe)}}else for(let ke=t.symbolInstanceStart;ke<t.symbolInstanceEnd;ke++)tt(a.symbolInstances.get(ke),a.collisionArrays[ke],ke);if(o&&a.bucketInstanceId in this.collisionCircleArrays){const ke=this.collisionCircleArrays[a.bucketInstanceId];c.at(ke.invProjMatrix,v),ke.viewportMatrix=this.collisionIndex.getViewportMatrix()}a.justReloaded=!1}storeCollisionData(t,n,o,a,h,m){if(o.textBox||o.iconBox){let y,v;this.collisionBoxArrays.has(t)?y=this.collisionBoxArrays.get(t):(y=new Map,this.collisionBoxArrays.set(t,y)),y.has(n)?v=y.get(n):(v={text:null,icon:null},y.set(n,v)),o.textBox&&(v.text=a.box),o.iconBox&&(v.icon=h.box)}if(m){let y=this.collisionCircleArrays[t];y===void 0&&(y=this.collisionCircleArrays[t]=new at);for(let v=0;v<m.circles.length;v+=4)y.circles.push(m.circles[v+0]),y.circles.push(m.circles[v+1]),y.circles.push(m.circles[v+2]),y.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 y of m)y>=0&&(t.text.placedSymbolArray.get(y).crossTileID=h>=0&&y!==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 y of m)t.text.placedSymbolArray.get(y).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:{},y=n?n.placedOrientations:{};for(const v in this.placements){const w=this.placements[v],k=h[v];k?(this.opacities[v]=new $t(k,a,w.text,w.icon),o=o||w.text!==k.text.placed||w.icon!==k.icon.placed):(this.opacities[v]=new $t(null,a,w.text,w.icon,w.skipFade),o=o||w.text||w.icon)}for(const v in h){const w=h[v];if(!this.opacities[v]){const k=new $t(w,a,!1,!1);k.isHidden()||(this.opacities[v]=k,o=o||w.text.placed||w.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 y)this.placedOrientations[v]||!this.opacities[v]||this.opacities[v].isHidden()||(this.placedOrientations[v]=y[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,y=new $t(null,0,!1,!1,!0),v=m.get("text-allow-overlap"),w=m.get("icon-allow-overlap"),k=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",F=m.get("icon-text-fit")!=="none",N=new $t(null,0,v&&(w||!t.hasIconData()||m.get("icon-optional")),w&&(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!==ui},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:se}=K;let ce=this.opacities[se];o[se]?ce=y:ce||(ce=N,this.opacities[se]=ce),o[se]=!0;const _e=K.numIconVertices>0,we=this.placedOrientations[K.crossTileID],Le=we===c.ai.vertical,Be=we===c.ai.horizontal||we===c.ai.horizontalOnly;if(j>0||ee>0){const Te=Ni(ce.text);Z(t.text,j,Le?ui:Te),Z(t.text,ee,Be?ui:Te);const je=ce.text.isHidden();[K.rightJustifiedTextSymbolIndex,K.centerJustifiedTextSymbolIndex,K.leftJustifiedTextSymbolIndex].forEach(Ce=>{Ce>=0&&(t.text.placedSymbolArray.get(Ce).hidden=je||Le?1:0)}),K.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(K.verticalPlacedTextSymbolIndex).hidden=je||Be?1:0);const tt=this.variableOffsets[K.crossTileID];tt&&this.markUsedJustification(t,tt.anchor,K,we);const ke=this.placedOrientations[K.crossTileID];ke&&(this.markUsedJustification(t,"left",K,ke),this.markUsedOrientation(t,ke,K))}if(_e){const Te=Ni(ce.icon),je=!(F&&K.verticalPlacedIconSymbolIndex&&Le);K.placedIconSymbolIndex>=0&&(Z(t.icon,K.numIconVertices,je?Te:ui),t.icon.placedSymbolArray.get(K.placedIconSymbolIndex).hidden=ce.icon.isHidden()),K.verticalPlacedIconSymbolIndex>=0&&(Z(t.icon,K.numVerticalIconVertices,je?ui: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 je=new c.P(0,0);if(Te.textBox||Te.verticalTextBox){let tt=!0;if(k){const ke=this.variableOffsets[se];ke?(je=ei(ke.anchor,ke.width,ke.height,ke.textOffset,ke.textBoxScale),E&&je._rotate(L?this.transform.angle:-this.transform.angle)):tt=!1}if(Te.textBox||Te.verticalTextBox){let ke;Te.textBox&&(ke=Le),Te.verticalTextBox&&(ke=Be),hi(t.textCollisionBox.collisionVertexArray,ce.text.placed,!tt||ke,Se.text,je.x,je.y)}}if(Te.iconBox||Te.verticalIconBox){const tt=!!(!Be&&Te.verticalIconBox);let ke;Te.iconBox&&(ke=tt),Te.verticalIconBox&&(ke=!tt),hi(t.iconCollisionBox.collisionVertexArray,ce.icon.placed,ke,Se.icon,F?je.x:0,F?je.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 hi(u,t,n,o,a,h){o&&o.length!==0||(o=[0,0,0,0]);const m=o[0]-nt,y=o[1]-nt,v=o[2]-nt,w=o[3]-nt;u.emplaceBack(t?1:0,n?1:0,a||0,h||0,m,y),u.emplaceBack(t?1:0,n?1:0,a||0,h||0,v,y),u.emplaceBack(t?1:0,n?1:0,a||0,h||0,v,w),u.emplaceBack(t?1:0,n?1:0,a||0,h||0,m,w)}const as=Math.pow(2,25),bt=Math.pow(2,24),Uo=Math.pow(2,17),$o=Math.pow(2,16),Oi=Math.pow(2,9),Vi=Math.pow(2,8),Oc=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*bt+n*Uo+t*$o+n*Oi+t*Vi+n*Oc+t}const ui=0;function Us(){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,y,v=!1){if(!m[0]&&!m[1])return[0,0];const w=v?y==="map"?a.angle:0:y==="viewport"?-a.angle:0;if(w){const k=Math.sin(w),E=Math.cos(w);m=[m[0]*E-m[1]*k,m[0]*k+m[1]*E]}return[v?m[0]:rt(h,m[0],a.zoom),v?m[1]:rt(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((y,v)=>y.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,y,v){this.placement=new ci(t,Us(),n,m,y,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]],y=this.placement.collisionIndex.transform.zoom;if(m.type==="symbol"&&(!m.minzoom||m.minzoom<=y)&&(!m.maxzoom||m.maxzoom>y)){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 Cr=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),y=m.key,v=a.get(y);v?v.push(m):a.set(y,[m])}for(const[h,m]of a){const y={positions:m.map(v=>({x:Math.floor(v.anchorX*Cr),y:Math.floor(v.anchorY*Cr)})),crossTileIDs:m.map(v=>v.crossTileID)};if(y.positions.length>128){const v=new c.aw(y.positions.length,16,Uint16Array);for(const{x:w,y:k}of y.positions)v.add(w,k);v.finish(),delete y.positions,y.index=v}this._symbolsByKey[h]=y}}getScaledCoordinates(t,n){const{x:o,y:a,z:h}=this.tileID.canonical,{x:m,y,z:v}=n.canonical,w=Cr/Math.pow(2,v-h),k=(y*c.X+t.anchorY)*w,E=a*c.X*Cr;return{x:Math.floor((m*c.X+t.anchorX)*w-o*c.X*Cr),y:Math.floor(k-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 y=this._symbolsByKey[m.key];if(!y)continue;const v=this.getScaledCoordinates(m,n);if(y.index){const w=y.index.range(v.x-a,v.y-a,v.x+a,v.y+a).sort();for(const k of w){const E=y.crossTileIDs[k];if(!o[E]){o[E]=!0,m.crossTileID=E;break}}}else if(y.positions)for(let w=0;w<y.positions.length;w++){const k=y.positions[w],E=y.crossTileIDs[w];if(Math.abs(k.x-v.x)<=a&&Math.abs(k.y-v.y)<=a&&!o[E]){o[E]=!0,m.crossTileID=E;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:t})=>t)}}class Xt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class $s{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 y=a[m];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+n),h[y.tileID.key]=y}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 y in m){const v=m[y];v.tileID.isChildOf(t)&&v.findMatches(n.symbolInstances,t,a)}else{const y=m[t.scaledTo(Number(h)).key];y&&y.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 Wi{constructor(){this.layerIndexes={},this.crossTileIDs=new Xt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,o){let a=this.layerIndexes[t.id];a===void 0&&(a=this.layerIndexes[t.id]=new $s);let h=!1;const m={};a.handleWrapJump(o);for(const y of n){const v=y.getBucket(t);v&&t.id===v.layerIds[0]&&(v.bucketInstanceId||(v.bucketInstanceId=++this.maxBucketInstanceId),a.addBucket(y.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 qo 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 li,this.imageManager.setEventedParent(this),this.glyphManager=new ur(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new kn(256,512),this.crossTileSymbolIndex=new Wi,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()),fr().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 y=this._layers[m];y.source===h.id&&this._validateLayer(y)}})}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 Pr(this.stylesheet.light),this.sky=new Yi(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,y,v){return c._(this,void 0,void 0,function*(){const w=bi(h),k=y>1?"@2x":"",E={},L={};for(const{id:F,url:N}of w){const Z=m.transformRequest(Or(N,k,".json"),"SpriteJSON");E[F]=c.h(Z,v);const U=m.transformRequest(Or(N,k,".png"),"SpriteImage");L[F]=ze.getImage(U,v)}return yield Promise.all([...Object.values(E),...Object.values(L)]),function(F,N){return c._(this,void 0,void 0,function*(){const Z={};for(const U in F){Z[U]={};const H=le.getImageCanvasContext((yield N[U]).data),K=(yield F[U]).data;for(const j in K){const{width:ee,height:se,x:ce,y:_e,sdf:we,pixelRatio:Le,stretchX:Be,stretchY:Se,content:Te,textFitWidth:je,textFitHeight:tt}=K[j];Z[U][j]={data:null,pixelRatio:Le,sdf:we,stretchX:Be,stretchY:Se,content:Te,textFitWidth:je,textFitHeight:tt,spriteData:{width:ee,height:se,x:ce,y:_e,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 y=this._spritesImagesIds[m]?this._spritesImagesIds[m].filter(v=>!(v in h)):[];for(const v of y)this.imageManager.removeImage(v),this._changedImages[v]=!0;for(const v in h[m]){const w=m==="default"?v:`${m}:${v}`;this._spritesImagesIds[m].push(w),w in this.imageManager.images?this.imageManager.updateImage(w,h[m][v],!1):this.imageManager.addImage(w,h[m][v]),n&&(this._changedImages[w]=!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 y=this._updatedSources[m];if(y==="reload")this._reloadSource(m);else{if(y!=="clear")throw new Error(`Invalid action ${y}`);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 y of m.operations)y();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 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 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 y=this._removedLayers[a];delete this._removedLayers[a],y.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 y=this._order[m];if(n(y)){o[y]=m;for(const v of t){const w=v[y];if(w)for(const k of w)a.push(k)}}}a.sort((m,y)=>y.intersectionZ-m.intersectionZ);const h=[];for(let m=this._order.length-1;m>=0;m--){const y=this._order[m];if(n(y))for(let v=a.length-1;v>=0;v--){const w=a[v].feature;if(o[w.layer.id]<m)break;h.push(w),a.pop()}else for(const v of t){const w=v[y];if(w)for(const k of w)h.push(k.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 y of n.layers){const v=this._layers[y];if(!v)return this.fire(new c.j(new Error(`The layer '${y}' 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 y in this.sourceCaches)n.layers&&!a[y]||h.push(Nr(this.sourceCaches[y],this._layers,m,t,n,o));return this.placement&&h.push(function(y,v,w,k,E,L,F){const N={},Z=L.queryRenderedSymbols(k),U=[];for(const H of Object.keys(Z).map(Number))U.push(F[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,y);for(const j in K){const ee=N[j]=N[j]||[],se=K[j];se.sort((ce,_e)=>{const we=H.featureSortOrder;if(we){const Le=we.indexOf(ce.featureIndex);return we.indexOf(_e.featureIndex)-Le}return _e.featureIndex-ce.featureIndex});for(const ce of se)ee.push(ce)}}for(const H in N)N[H].forEach(K=>{const j=K.feature,ee=w[y[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 N}(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(w=>a.getTileByID(w)),y=[],v={};for(let w=0;w<m.length;w++){const k=m[w],E=k.tileID.canonical.key;v[E]||(v[E]=!0,k.querySourceFeatures(y,h))}return y}(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),fr().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,y=!1;const v={};for(const w of this._order){const k=this._layers[w];if(k.type!=="symbol")continue;if(!v[k.source]){const L=this.sourceCaches[k.source];v[k.source]=L.getRenderableIds(!0).map(F=>L.getTileByID(F)).sort((F,N)=>N.tileID.overscaledZ-F.tileID.overscaledZ||(F.tileID.isLessThan(N.tileID)?-1:1))}const E=this.crossTileSymbolIndex.addLayer(k,v[k.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()),y=!0),m&&this.pauseablePlacement.placement.setStale()),y||m)for(const w of this._order){const k=this._layers[w];k.type==="symbol"&&this.placement.updateLayerOpacities(k,v[k.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=[...bi(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=bi(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 bi(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:yt(`#ifdef GL_ES
|
4
|
+
*/(function(m,b){(function(P,C){m.exports=C()})(commonjsGlobal,function(){var P={},C={};function B(T,c,fe){if(C[T]=fe,T==="index"){var _e="var sharedModule = {}; ("+C.shared+")(sharedModule); ("+C.worker+")(sharedModule);",ye={};return C.shared(ye),C.index(P,ye),typeof window<"u"&&P.setWorkerUrl(window.URL.createObjectURL(new Blob([_e],{type:"text/javascript"}))),P}}B("shared",["exports"],function(T){function c(i,e,r,n){return new(r||(r=Promise))(function(l,d){function p(x){try{_(n.next(x))}catch(S){d(S)}}function f(x){try{_(n.throw(x))}catch(S){d(S)}}function _(x){var S;x.done?l(x.value):(S=x.value,S instanceof r?S:new r(function(E){E(S)})).then(p,f)}_((n=n.apply(i,e||[])).next())})}function fe(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}typeof SuppressedError=="function"&&SuppressedError;var _e=ye;function ye(i,e){this.x=i,this.y=e}ye.prototype={clone:function(){return new ye(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),n=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=n,this},_rotateAround:function(i,e){var r=Math.cos(i),n=Math.sin(i),l=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-n*(this.y-e.y),this.y=l,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},ye.convert=function(i){return i instanceof ye?i:Array.isArray(i)?new ye(i[0],i[1]):i};var ae=fe(_e),oe=at;function at(i,e,r,n){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*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=n}at.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,n=0;n<8;n++){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,n=0;n<20&&(l=this.sampleCurveX(r),!(Math.abs(l-i)<e));n++)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 Ve=fe(oe);let Xe,Fe;function ut(){return Xe==null&&(Xe=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Xe}function kt(){if(Fe==null&&(Fe=!1,ut())){const e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let n=0;n<5*5;n++){const l=4*n;e.fillStyle=`rgb(${l},${l+1},${l+2})`,e.fillRect(n%5,Math.floor(n/5),1,1)}const r=e.getImageData(0,0,5,5).data;for(let n=0;n<5*5*4;n++)if(n%4!=3&&r[n]!==n){Fe=!0;break}}}return Fe||!1}function Ze(i,e,r,n){const l=new Ve(i,e,r,n);return d=>l.solve(d)}const Ct=Ze(.25,.1,.25,1);function xt(i,e,r){return Math.min(r,Math.max(e,i))}function et(i,e,r){const n=r-e,l=((i-e)%n+n)%n+e;return l===e?r:l}function Tt(i,...e){for(const r of e)for(const n in r)i[n]=r[n];return i}let nr=1;function si(i,e,r){const n={};for(const l in i)n[l]=e.call(this,i[l],l,i);return n}function Cr(i,e,r){const n={};for(const l in i)e.call(this,i[l],l,i)&&(n[l]=i[l]);return n}function vt(i){return Array.isArray(i)?i.map(vt):typeof i=="object"&&i?si(i,vt):i}const Tn={};function ni(i){Tn[i]||(typeof console<"u"&&console.warn(i),Tn[i]=!0)}function yi(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function yr(i){return typeof WorkerGlobalScope<"u"&&i!==void 0&&i instanceof WorkerGlobalScope}let ms=null;function or(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const En="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Xr(i,e,r,n,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"),_=new Uint8ClampedArray(n*l*4);if(yield d.copyTo(_,function(x,S,E,k,D){const R=4*Math.max(-S,0),O=(Math.max(0,E)-E)*k*4+R,U=4*k,W=Math.max(0,S),ne=Math.max(0,E);return{rect:{x:W,y:ne,width:Math.min(x.width,S+k)-W,height:Math.min(x.height,E+D)-ne},layout:[{offset:O,stride:U}]}}(i,e,r,n,l)),f)for(let x=0;x<_.length;x+=4){const S=_[x];_[x]=_[x+2],_[x+2]=S}return _}finally{d.close()}})}let xr,Ti;const Gi="AbortError";function gs(){return new Error(Gi)}const Mr={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function ar(i){return Mr.REGISTERED_PROTOCOLS[i.substring(0,i.indexOf("://"))]}const _s="global-dispatcher";class Di extends Error{constructor(e,r,n,l){super(`AJAXError: ${r} (${e}): ${n}`),this.status=e,this.statusText=r,this.url=n,this.body=l}}const Hi=()=>yr(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Jr=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){const n=ar(i.url);if(n)return n(i,e);if(yr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,targetMapId:_s},e)}if(!(/^file:/.test(r=i.url)||/^file:/.test(Hi())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(n,l){return c(this,void 0,void 0,function*(){const d=new Request(n.url,{method:n.method||"GET",body:n.body,credentials:n.credentials,headers:n.headers,cache:n.cache,referrer:Hi(),signal:l.signal});n.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 Di(p.status,p.statusText,n.url,x)}let f;f=n.type==="arrayBuffer"||n.type==="image"?p.arrayBuffer():n.type==="json"?p.json():p.text();const _=yield f;if(l.signal.aborted)throw gs();return{data:_,cacheControl:p.headers.get("Cache-Control"),expires:p.headers.get("Expires")}})}(i,e);if(yr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,mustQueue:!0,targetMapId:_s},e)}var r;return function(n,l){return new Promise((d,p)=>{var f;const _=new XMLHttpRequest;_.open(n.method||"GET",n.url,!0),n.type!=="arrayBuffer"&&n.type!=="image"||(_.responseType="arraybuffer");for(const x in n.headers)_.setRequestHeader(x,n.headers[x]);n.type==="json"&&(_.responseType="text",!((f=n.headers)===null||f===void 0)&&f.Accept||_.setRequestHeader("Accept","application/json")),_.withCredentials=n.credentials==="include",_.onerror=()=>{p(new Error(_.statusText))},_.onload=()=>{if(!l.signal.aborted)if((_.status>=200&&_.status<300||_.status===0)&&_.response!==null){let x=_.response;if(n.type==="json")try{x=JSON.parse(_.response)}catch(S){return void p(S)}d({data:x,cacheControl:_.getResponseHeader("Cache-Control"),expires:_.getResponseHeader("Expires")})}else{const x=new Blob([_.response],{type:_.getResponseHeader("Content-Type")});p(new Di(_.status,_.statusText,n.url,x))}},l.signal.addEventListener("abort",()=>{_.abort(),p(gs())}),_.send(n.body)})}(i,e)};function Kr(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 js(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function vr(i,e,r){if(r&&r[i]){const n=r[i].indexOf(e);n!==-1&&r[i].splice(n,1)}}class zr{constructor(e,r={}){Tt(this,r),this.type=e}}class Dr extends zr{constructor(e,r={}){super("error",Tt({error:e},r))}}class ys{on(e,r){return this._listeners=this._listeners||{},js(e,r,this._listeners),this}off(e,r){return vr(e,r,this._listeners),vr(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},js(e,r,this._oneTimeListeners),this):new Promise(n=>this.once(e,n))}fire(e,r){typeof e=="string"&&(e=new zr(e,r||{}));const n=e.type;if(this.listens(n)){e.target=this;const l=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(const f of l)f.call(this,e);const d=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(const f of d)vr(n,f,this._oneTimeListeners),f.call(this,e);const p=this._eventedParent;p&&(Tt(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(e))}else e instanceof Dr&&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 he={$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 Yr=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Us(i,e){const r={};for(const n in i)n!=="ref"&&(r[n]=i[n]);return Yr.forEach(n=>{n in e&&(r[n]=e[n])}),r}function mt(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(!mt(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(!mt(i[r],e[r]))return!1;return!0}return i===e}function $t(i,e){i.push(e)}function qs(i,e,r){$t(r,{command:"addSource",args:[i,e[i]]})}function Lr(i,e,r){$t(e,{command:"removeSource",args:[i]}),r[i]=!0}function br(i,e,r,n){Lr(i,r,n),qs(i,e,r)}function xs(i,e,r){let n;for(n in i[r])if(Object.prototype.hasOwnProperty.call(i[r],n)&&n!=="data"&&!mt(i[r][n],e[r][n]))return!1;for(n in e[r])if(Object.prototype.hasOwnProperty.call(e[r],n)&&n!=="data"&&!mt(i[r][n],e[r][n]))return!1;return!0}function ji(i,e,r,n,l,d){i=i||{},e=e||{};for(const p in i)Object.prototype.hasOwnProperty.call(i,p)&&(mt(i[p],e[p])||r.push({command:d,args:[n,p,e[p],l]}));for(const p in e)Object.prototype.hasOwnProperty.call(e,p)&&!Object.prototype.hasOwnProperty.call(i,p)&&(mt(i[p],e[p])||r.push({command:d,args:[n,p,e[p],l]}))}function Zs(i){return i.id}function Gs(i,e){return i[e.id]=e,i}class Se{constructor(e,r,n,l){this.message=(e?`${e}: `:"")+n,l&&(this.identifier=l),r!=null&&r.__line__&&(this.line=r.__line__)}}function lr(i,...e){for(const r of e)for(const n in r)i[n]=r[n];return i}class xi extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}class cr{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[n,l]of r)this.bindings[n]=l}concat(e){return new cr(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 Rr={kind:"null"},Ae={kind:"number"},nt={kind:"string"},Je={kind:"boolean"},Ei={kind:"color"},Wi={kind:"object"},tt={kind:"value"},hr={kind:"collator"},wr={kind:"formatted"},Br={kind:"padding"},ur={kind:"resolvedImage"},G={kind:"variableAnchorOffsetCollection"};function z(i,e){return{kind:"array",itemType:i,N:e}}function M(i){if(i.kind==="array"){const e=M(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const V=[Rr,Ae,nt,Je,Ei,wr,Wi,z(tt),Br,ur,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 V)if(!q(r,e))return null}}return`Expected ${M(i)} but found ${M(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 J=.96422,de=.82521,ge=4/29,ce=6/29,Te=3*ce*ce,qe=ce*ce*ce,Ge=Math.PI/180,rt=180/Math.PI;function dt(i){return(i%=360)<0&&(i+=360),i}function it([i,e,r,n]){let l,d;const p=Nt((.2225045*(i=Et(i))+.7168786*(e=Et(e))+.0606169*(r=Et(r)))/1);i===e&&e===r?l=d=p:(l=Nt((.4360747*i+.3850649*e+.1430804*r)/J),d=Nt((.0139322*i+.0971045*e+.7141733*r)/de));const f=116*p-16;return[f<0?0:f,500*(l-p),200*(p-d),n]}function Et(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Nt(i){return i>qe?Math.pow(i,1/3):i/Te+ge}function Ht([i,e,r,n]){let l=(i+16)/116,d=isNaN(e)?l:l+e/500,p=isNaN(r)?l:l-r/200;return l=1*_t(l),d=J*_t(d),p=de*_t(p),[ot(3.1338561*d-1.6168667*l-.4906146*p),ot(-.9787684*d+1.9161415*l+.033454*p),ot(.0719453*d-.2289914*l+1.4052427*p),n]}function ot(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function _t(i){return i>ce?i*i*i:Te*(i-ge)}function Ft(i){return parseInt(i.padEnd(2,i),16)/255}function Jt(i,e){return oi(e?i/100:i,0,1)}function oi(i,e,r){return Math.min(Math.max(e,i),r)}function ai(i){return!i.some(Number.isNaN)}const Hs={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 yt{constructor(e,r,n,l=1,d=!0){this.r=e,this.g=r,this.b=n,this.a=l,d||(this.r*=l,this.g*=l,this.b*=l,l||this.overwriteGetter("rgb",[e,r,n,l]))}static parse(e){if(e instanceof yt)return e;if(typeof e!="string")return;const r=function(n){if((n=n.toLowerCase().trim())==="transparent")return[0,0,0,0];const l=Hs[n];if(l){const[p,f,_]=l;return[p/255,f/255,_/255,1]}if(n.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(n)){const p=n.length<6?1:2;let f=1;return[Ft(n.slice(f,f+=p)),Ft(n.slice(f,f+=p)),Ft(n.slice(f,f+=p)),Ft(n.slice(f,f+p)||"ff")]}if(n.startsWith("rgb")){const p=n.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(p){const[f,_,x,S,E,k,D,R,O,U,W,ne]=p,Y=[S||" ",D||" ",U].join("");if(Y===" "||Y===" /"||Y===",,"||Y===",,,"){const ie=[x,k,O].join(""),ue=ie==="%%%"?100:ie===""?255:0;if(ue){const xe=[oi(+_/ue,0,1),oi(+E/ue,0,1),oi(+R/ue,0,1),W?Jt(+W,ne):1];if(ai(xe))return xe}}return}}const d=n.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){const[p,f,_,x,S,E,k,D,R]=d,O=[_||" ",S||" ",k].join("");if(O===" "||O===" /"||O===",,"||O===",,,"){const U=[+f,oi(+x,0,100),oi(+E,0,100),D?Jt(+D,R):1];if(ai(U))return function([W,ne,Y,ie]){function ue(xe){const ze=(xe+W/30)%12,He=ne*Math.min(Y,1-Y);return Y-He*Math.max(-1,Math.min(ze-3,9-ze,1))}return W=dt(W),ne/=100,Y/=100,[ue(0),ue(8),ue(4),ie]}(U)}}}(e);return r?new yt(...r,!1):void 0}get rgb(){const{r:e,g:r,b:n,a:l}=this,d=l||1/0;return this.overwriteGetter("rgb",[e/d,r/d,n/d,l])}get hcl(){return this.overwriteGetter("hcl",function(e){const[r,n,l,d]=it(e),p=Math.sqrt(n*n+l*l);return[Math.round(1e4*p)?dt(Math.atan2(l,n)*rt):NaN,p,r,d]}(this.rgb))}get lab(){return this.overwriteGetter("lab",it(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){const[e,r,n,l]=this.rgb;return`rgba(${[e,r,n].map(d=>Math.round(255*d)).join(",")},${l})`}}yt.black=new yt(0,0,0,1),yt.white=new yt(1,1,1,1),yt.transparent=new yt(0,0,0,0),yt.red=new yt(1,0,0,1);class vo{constructor(e,r,n){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=n,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 bo{constructor(e,r,n,l,d){this.text=e,this.image=r,this.scale=n,this.fontStack=l,this.textColor=d}}class Li{constructor(e){this.sections=e}static fromString(e){return new Li([new bo(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 Li?e:Li.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class Ri{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ri)return e;if(typeof e=="number")return new Ri([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 Ri(e)}}toString(){return JSON.stringify(this.values)}}const $l=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Bi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Bi)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let r=0;r<e.length;r+=2){const n=e[r],l=e[r+1];if(typeof n!="string"||!$l.has(n)||!Array.isArray(l)||l.length!==2||typeof l[0]!="number"||typeof l[1]!="number")return}return new Bi(e)}}toString(){return JSON.stringify(this.values)}}class li{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new li({name:e,available:!1}):null}}function An(i,e,r,n){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?n===void 0||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[i,e,r,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[i,e,r,n]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ws(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof yt||i instanceof vo||i instanceof Li||i instanceof Ri||i instanceof Bi||i instanceof li)return!0;if(Array.isArray(i)){for(const e of i)if(!Ws(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!Ws(i[e]))return!1;return!0}return!1}function Wt(i){if(i===null)return Rr;if(typeof i=="string")return nt;if(typeof i=="boolean")return Je;if(typeof i=="number")return Ae;if(i instanceof yt)return Ei;if(i instanceof vo)return hr;if(i instanceof Li)return wr;if(i instanceof Ri)return Br;if(i instanceof Bi)return G;if(i instanceof li)return ur;if(Array.isArray(i)){const e=i.length;let r;for(const n of i){const l=Wt(n);if(r){if(r===l)continue;r=tt;break}r=l}return z(r||tt,e)}return Wi}function Sr(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof yt||i instanceof Li||i instanceof Ri||i instanceof Bi||i instanceof li?i.toString():JSON.stringify(i)}class Qr{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(!Ws(e[1]))return r.error("invalid value");const n=e[1];let l=Wt(n);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 Qr(l,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Zt{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const In={string:nt,number:Ae,boolean:Je,object:Wi};class Ui{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 n,l=1;const d=e[0];if(d==="array"){let f,_;if(e.length>2){const x=e[1];if(typeof x!="string"||!(x in In)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);f=In[x],l++}else f=tt;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);_=e[2],l++}n=z(f,_)}else{if(!In[d])throw new Error(`Types doesn't contain name = ${d}`);n=In[d]}const p=[];for(;l<e.length;l++){const f=r.parse(e[l],l,tt);if(!f)return null;p.push(f)}return new Ui(n,p)}evaluate(e){for(let r=0;r<this.args.length;r++){const n=this.args[r].evaluate(e);if(!q(this.type,Wt(n)))return n;if(r===this.args.length-1)throw new Zt(`Expected value to be of type ${M(this.type)}, but found ${M(Wt(n))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Xs={"to-boolean":Je,"to-color":Ei,"to-number":Ae,"to-string":nt};class Fr{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 n=e[0];if(!Xs[n])throw new Error(`Can't parse ${n} as it is not part of the known types`);if((n==="to-boolean"||n==="to-string")&&e.length!==2)return r.error("Expected one argument.");const l=Xs[n],d=[];for(let p=1;p<e.length;p++){const f=r.parse(e[p],p,tt);if(!f)return null;d.push(f)}return new Fr(l,d)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let r,n;for(const l of this.args){if(r=l.evaluate(e),n=null,r instanceof yt)return r;if(typeof r=="string"){const d=e.parseColor(r);if(d)return d}else if(Array.isArray(r)&&(n=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:An(r[0],r[1],r[2],r[3]),!n))return new yt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Zt(n||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(const n of this.args){r=n.evaluate(e);const l=Ri.parse(r);if(l)return l}throw new Zt(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(const n of this.args){r=n.evaluate(e);const l=Bi.parse(r);if(l)return l}throw new Zt(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(const n of this.args){if(r=n.evaluate(e),r===null)return 0;const l=Number(r);if(!isNaN(l))return l}throw new Zt(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return Li.fromString(Sr(this.args[0].evaluate(e)));case"resolvedImage":return li.fromString(Sr(this.args[0].evaluate(e)));default:return Sr(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const wo=["Unknown","Point","LineString","Polygon"];class Js{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"?wo[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]=yt.parse(e)),r}}class Or{constructor(e,r,n=[],l,d=new cr,p=[]){this.registry=e,this.path=n,this.key=n.map(f=>`[${f}]`).join(""),this.scope=d,this.errors=p,this.expectedType=l,this._isConstant=r}parse(e,r,n,l,d={}){return r?this.concat(r,n,l)._parse(e,d):this._parse(e,d)}_parse(e,r){function n(l,d,p){return p==="assert"?new Ui(d,[l]):p==="coerce"?new Fr(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,_=p.type;if(f.kind!=="string"&&f.kind!=="number"&&f.kind!=="boolean"&&f.kind!=="object"&&f.kind!=="array"||_.kind!=="value")if(f.kind!=="color"&&f.kind!=="formatted"&&f.kind!=="resolvedImage"||_.kind!=="value"&&_.kind!=="string")if(f.kind!=="padding"||_.kind!=="value"&&_.kind!=="number"&&_.kind!=="array")if(f.kind!=="variableAnchorOffsetCollection"||_.kind!=="value"&&_.kind!=="array"){if(this.checkSubtype(f,_))return null}else p=n(p,f,r.typeAnnotation||"coerce");else p=n(p,f,r.typeAnnotation||"coerce");else p=n(p,f,r.typeAnnotation||"coerce");else p=n(p,f,r.typeAnnotation||"assert")}if(!(p instanceof Qr)&&p.type.kind!=="resolvedImage"&&this._isConstant(p)){const f=new Js;try{p=new Qr(p.type,p.evaluate(f))}catch(_){return this.error(_.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,n){const l=typeof e=="number"?this.path.concat(e):this.path,d=n?this.scope.concat(n):this.scope;return new Or(this.registry,this._isConstant,l,r||null,d,this.errors)}error(e,...r){const n=`${this.key}${r.map(l=>`[${l}]`).join("")}`;this.errors.push(new xi(n,e))}checkSubtype(e,r){const n=q(e,r);return n&&this.error(n),n}}class gt{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 n=[];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;n.push([p,f])}const l=r.parse(e[e.length-1],e.length-1,r.expectedType,n);return l?new gt(n,l):null}outputDefined(){return this.result.outputDefined()}}class Pn{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 n=e[1];return r.scope.has(n)?new Pn(n,r.scope.get(n)):r.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class So{constructor(e,r,n){this.type=e,this.index=r,this.input=n}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=r.parse(e[1],1,Ae),l=r.parse(e[2],2,z(r.expectedType||tt));return n&&l?new So(l.type.itemType,n,l):null}evaluate(e){const r=this.index.evaluate(e),n=this.input.evaluate(e);if(r<0)throw new Zt(`Array index out of bounds: ${r} < 0.`);if(r>=n.length)throw new Zt(`Array index out of bounds: ${r} > ${n.length-1}.`);if(r!==Math.floor(r))throw new Zt(`Array index must be an integer, but found ${r} instead.`);return n[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class Ks{constructor(e,r){this.type=Je,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 n=r.parse(e[1],1,tt),l=r.parse(e[2],2,tt);return n&&l?Q(n.type,[Je,nt,Ae,Rr,tt])?new Ks(n,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${M(n.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!te(r,["boolean","string","number","null"]))throw new Zt(`Expected first argument to be of type boolean, string, number or null, but found ${M(Wt(r))} instead.`);if(!te(n,["string","array"]))throw new Zt(`Expected second argument to be of type array or string, but found ${M(Wt(n))} instead.`);return n.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class kn{constructor(e,r,n){this.type=Ae,this.needle=e,this.haystack=r,this.fromIndex=n}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 n=r.parse(e[1],1,tt),l=r.parse(e[2],2,tt);if(!n||!l)return null;if(!Q(n.type,[Je,nt,Ae,Rr,tt]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${M(n.type)} instead`);if(e.length===4){const d=r.parse(e[3],3,Ae);return d?new kn(n,l,d):null}return new kn(n,l)}evaluate(e){const r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!te(r,["boolean","string","number","null"]))throw new Zt(`Expected first argument to be of type boolean, string, number or null, but found ${M(Wt(r))} instead.`);if(!te(n,["string","array"]))throw new Zt(`Expected second argument to be of type array or string, but found ${M(Wt(n))} instead.`);if(this.fromIndex){const l=this.fromIndex.evaluate(e);return n.indexOf(r,l)}return n.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class Cn{constructor(e,r,n,l,d,p){this.inputType=e,this.type=r,this.input=n,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 n,l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);const d={},p=[];for(let x=2;x<e.length-1;x+=2){let S=e[x];const E=e[x+1];Array.isArray(S)||(S=[S]);const k=r.concat(x);if(S.length===0)return k.error("Expected at least one branch label.");for(const R of S){if(typeof R!="number"&&typeof R!="string")return k.error("Branch labels must be numbers or strings.");if(typeof R=="number"&&Math.abs(R)>Number.MAX_SAFE_INTEGER)return k.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof R=="number"&&Math.floor(R)!==R)return k.error("Numeric branch labels must be integer values.");if(n){if(k.checkSubtype(n,Wt(R)))return null}else n=Wt(R);if(d[String(R)]!==void 0)return k.error("Branch labels must be unique.");d[String(R)]=p.length}const D=r.parse(E,x,l);if(!D)return null;l=l||D.type,p.push(D)}const f=r.parse(e[1],1,tt);if(!f)return null;const _=r.parse(e[e.length-1],e.length-1,l);return _?f.type.kind!=="value"&&r.concat(1).checkSubtype(n,f.type)?null:new Cn(n,l,f,d,p,_):null}evaluate(e){const r=this.input.evaluate(e);return(Wt(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 Mn{constructor(e,r,n){this.type=e,this.branches=r,this.otherwise=n}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 n;r.expectedType&&r.expectedType.kind!=="value"&&(n=r.expectedType);const l=[];for(let p=1;p<e.length-1;p+=2){const f=r.parse(e[p],p,Je);if(!f)return null;const _=r.parse(e[p+1],p+1,n);if(!_)return null;l.push([f,_]),n=n||_.type}const d=r.parse(e[e.length-1],e.length-1,n);if(!d)return null;if(!n)throw new Error("Can't infer output type");return new Mn(n,l,d)}evaluate(e){for(const[r,n]of this.branches)if(r.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[r,n]of this.branches)e(r),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}}class zn{constructor(e,r,n,l){this.type=e,this.input=r,this.beginIndex=n,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 n=r.parse(e[1],1,tt),l=r.parse(e[2],2,Ae);if(!n||!l)return null;if(!Q(n.type,[z(tt),nt,tt]))return r.error(`Expected first argument to be of type array or string, but found ${M(n.type)} instead`);if(e.length===4){const d=r.parse(e[3],3,Ae);return d?new zn(n.type,n,l,d):null}return new zn(n.type,n,l)}evaluate(e){const r=this.input.evaluate(e),n=this.beginIndex.evaluate(e);if(!te(r,["string","array"]))throw new Zt(`Expected first argument to be of type array or string, but found ${M(Wt(r))} instead.`);if(this.endIndex){const l=this.endIndex.evaluate(e);return r.slice(n,l)}return r.slice(n)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Ys(i,e){const r=i.length-1;let n,l,d=0,p=r,f=0;for(;d<=p;)if(f=Math.floor((d+p)/2),n=i[f],l=i[f+1],n<=e){if(f===r||e<l)return f;d=f+1}else{if(!(n>e))throw new Zt("Input is not a number.");p=f-1}return 0}class vs{constructor(e,r,n){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[l,d]of n)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 n=r.parse(e[1],1,Ae);if(!n)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],_=e[p+1],x=p,S=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 E=r.parse(_,S,d);if(!E)return null;d=d||E.type,l.push([f,E])}return new vs(d,n,l)}evaluate(e){const r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return n[0].evaluate(e);const d=r.length;return l>=r[d-1]?n[d-1].evaluate(e):n[Ys(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 Nl(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var jl=Ra;function Ra(i,e,r,n){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*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=n}Ra.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,n=0;n<8;n++){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,n=0;n<20&&(l=this.sampleCurveX(r),!(Math.abs(l-i)<e));n++)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 Ul=Nl(jl);function Vr(i,e,r){return i+r*(e-i)}function Qs(i,e,r){return i.map((n,l)=>Vr(n,e[l],r))}const Fi={number:Vr,color:function(i,e,r,n="rgb"){switch(n){case"rgb":{const[l,d,p,f]=Qs(i.rgb,e.rgb,r);return new yt(l,d,p,f,!1)}case"hcl":{const[l,d,p,f]=i.hcl,[_,x,S,E]=e.hcl;let k,D;if(isNaN(l)||isNaN(_))isNaN(l)?isNaN(_)?k=NaN:(k=_,p!==1&&p!==0||(D=x)):(k=l,S!==1&&S!==0||(D=d));else{let ne=_-l;_>l&&ne>180?ne-=360:_<l&&l-_>180&&(ne+=360),k=l+r*ne}const[R,O,U,W]=function([ne,Y,ie,ue]){return ne=isNaN(ne)?0:ne*Ge,Ht([ie,Math.cos(ne)*Y,Math.sin(ne)*Y,ue])}([k,D??Vr(d,x,r),Vr(p,S,r),Vr(f,E,r)]);return new yt(R,O,U,W,!1)}case"lab":{const[l,d,p,f]=Ht(Qs(i.lab,e.lab,r));return new yt(l,d,p,f,!1)}}},array:Qs,padding:function(i,e,r){return new Ri(Qs(i.values,e.values,r))},variableAnchorOffsetCollection:function(i,e,r){const n=i.values,l=e.values;if(n.length!==l.length)throw new Zt(`Cannot interpolate values of different length. from: ${i.toString()}, to: ${e.toString()}`);const d=[];for(let p=0;p<n.length;p+=2){if(n[p]!==l[p])throw new Zt(`Cannot interpolate values containing mismatched anchors. from[${p}]: ${n[p]}, to[${p}]: ${l[p]}`);d.push(n[p]);const[f,_]=n[p+1],[x,S]=l[p+1];d.push([Vr(f,x,r),Vr(_,S,r)])}return new Bi(d)}};class Oi{constructor(e,r,n,l,d){this.type=e,this.operator=r,this.interpolation=n,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,n,l){let d=0;if(e.name==="exponential")d=en(r,e.base,n,l);else if(e.name==="linear")d=en(r,1,n,l);else if(e.name==="cubic-bezier"){const p=e.controlPoints;d=new Ul(p[0],p[1],p[2],p[3]).solve(en(r,1,n,l))}return d}static parse(e,r){let[n,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(S=>typeof S!="number"||S<0||S>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 _=null;n==="interpolate-hcl"||n==="interpolate-lab"?_=Ei:r.expectedType&&r.expectedType.kind!=="value"&&(_=r.expectedType);for(let x=0;x<p.length;x+=2){const S=p[x],E=p[x+1],k=x+3,D=x+4;if(typeof S!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',k);if(f.length&&f[f.length-1][0]>=S)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',k);const R=r.parse(E,D,_);if(!R)return null;_=_||R.type,f.push([S,R])}return re(_,Ae)||re(_,Ei)||re(_,Br)||re(_,G)||re(_,z(Ae))?new Oi(_,n,l,d,f):r.error(`Type ${M(_)} is not interpolatable.`)}evaluate(e){const r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return n[0].evaluate(e);const d=r.length;if(l>=r[d-1])return n[d-1].evaluate(e);const p=Ys(r,l),f=Oi.interpolationFactor(this.interpolation,l,r[p],r[p+1]),_=n[p].evaluate(e),x=n[p+1].evaluate(e);switch(this.operator){case"interpolate":return Fi[this.type.kind](_,x,f);case"interpolate-hcl":return Fi.color(_,x,f,"hcl");case"interpolate-lab":return Fi.color(_,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 en(i,e,r,n){const l=n-r,d=i-r;return l===0?0:e===1?d/l:(Math.pow(e,d)-1)/(Math.pow(e,l)-1)}class Dn{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 n=null;const l=r.expectedType;l&&l.kind!=="value"&&(n=l);const d=[];for(const f of e.slice(1)){const _=r.parse(f,1+d.length,n,void 0,{typeAnnotation:"omit"});if(!_)return null;n=n||_.type,d.push(_)}if(!n)throw new Error("No output type");const p=l&&d.some(f=>q(l,f.type));return new Dn(p?tt:n,d)}evaluate(e){let r,n=null,l=0;for(const d of this.args)if(l++,n=d.evaluate(e),n&&n instanceof li&&!n.available&&(r||(r=n.name),n=null,l===this.args.length&&(n=r)),n!==null)break;return n}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}function Ba(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 Fa(i,e,r,n){return n.compare(e,r)===0}function es(i,e,r){const n=i!=="=="&&i!=="!=";return class zu{constructor(d,p,f){this.type=Je,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 _=p.parse(d[1],1,tt);if(!_)return null;if(!Ba(f,_.type))return p.concat(1).error(`"${f}" comparisons are not supported for type '${M(_.type)}'.`);let x=p.parse(d[2],2,tt);if(!x)return null;if(!Ba(f,x.type))return p.concat(2).error(`"${f}" comparisons are not supported for type '${M(x.type)}'.`);if(_.type.kind!==x.type.kind&&_.type.kind!=="value"&&x.type.kind!=="value")return p.error(`Cannot compare types '${M(_.type)}' and '${M(x.type)}'.`);n&&(_.type.kind==="value"&&x.type.kind!=="value"?_=new Ui(x.type,[_]):_.type.kind!=="value"&&x.type.kind==="value"&&(x=new Ui(_.type,[x])));let S=null;if(d.length===4){if(_.type.kind!=="string"&&x.type.kind!=="string"&&_.type.kind!=="value"&&x.type.kind!=="value")return p.error("Cannot use collator to compare non-string types.");if(S=p.parse(d[3],3,hr),!S)return null}return new zu(_,x,S)}evaluate(d){const p=this.lhs.evaluate(d),f=this.rhs.evaluate(d);if(n&&this.hasUntypedArgument){const _=Wt(p),x=Wt(f);if(_.kind!==x.kind||_.kind!=="string"&&_.kind!=="number")throw new Zt(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${_.kind}, ${x.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const _=Wt(p),x=Wt(f);if(_.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 Oa=es("==",function(i,e,r){return e===r},Fa),ql=es("!=",function(i,e,r){return e!==r},function(i,e,r,n){return!Fa(0,e,r,n)}),Zl=es("<",function(i,e,r){return e<r},function(i,e,r,n){return n.compare(e,r)<0}),Va=es(">",function(i,e,r){return e>r},function(i,e,r,n){return n.compare(e,r)>0}),$a=es("<=",function(i,e,r){return e<=r},function(i,e,r,n){return n.compare(e,r)<=0}),Gl=es(">=",function(i,e,r){return e>=r},function(i,e,r,n){return n.compare(e,r)>=0});class Ln{constructor(e,r,n){this.type=hr,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const n=e[1];if(typeof n!="object"||Array.isArray(n))return r.error("Collator options argument must be an object.");const l=r.parse(n["case-sensitive"]!==void 0&&n["case-sensitive"],1,Je);if(!l)return null;const d=r.parse(n["diacritic-sensitive"]!==void 0&&n["diacritic-sensitive"],1,Je);if(!d)return null;let p=null;return n.locale&&(p=r.parse(n.locale,1,nt),!p)?null:new Ln(l,d,p)}evaluate(e){return new vo(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 To{constructor(e,r,n,l,d){this.type=nt,this.number=e,this.locale=r,this.currency=n,this.minFractionDigits=l,this.maxFractionDigits=d}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const n=r.parse(e[1],1,Ae);if(!n)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,nt),!d))return null;let p=null;if(l.currency&&(p=r.parse(l.currency,1,nt),!p))return null;let f=null;if(l["min-fraction-digits"]&&(f=r.parse(l["min-fraction-digits"],1,Ae),!f))return null;let _=null;return l["max-fraction-digits"]&&(_=r.parse(l["max-fraction-digits"],1,Ae),!_)?null:new To(n,d,p,f,_)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class Rn{constructor(e){this.type=wr,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const n=e[1];if(!Array.isArray(n)&&typeof n=="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 _=null;if(f["font-scale"]&&(_=r.parse(f["font-scale"],1,Ae),!_))return null;let x=null;if(f["text-font"]&&(x=r.parse(f["text-font"],1,z(nt)),!x))return null;let S=null;if(f["text-color"]&&(S=r.parse(f["text-color"],1,Ei),!S))return null;const E=l[l.length-1];E.scale=_,E.font=x,E.textColor=S}else{const _=r.parse(e[p],1,tt);if(!_)return null;const x=_.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:_,scale:null,font:null,textColor:null})}}return new Rn(l)}evaluate(e){return new Li(this.sections.map(r=>{const n=r.content.evaluate(e);return Wt(n)===ur?new bo("",n,null,null,null):new bo(Sr(n),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 Eo{constructor(e){this.type=ur,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const n=r.parse(e[1],1,nt);return n?new Eo(n):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),n=li.fromString(r);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(r)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}}class Ao{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 n=r.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${M(n.type)} instead.`):new Ao(n):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new Zt(`Expected value to be of type string or array, but found ${M(Wt(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const dr=8192;function Io(i,e){const r=(180+i[0])/360,n=(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*dr),Math.round(n*l*dr)]}function bs(i,e){const r=Math.pow(2,e.z);return[(l=(i[0]/dr+e.x)/r,360*l-180),(n=(i[1]/dr+e.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*n)*Math.PI/180))-90)];var n,l}function ht(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 tn(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function Hl(i,e,r){const n=i[0]-e[0],l=i[1]-e[1],d=i[0]-r[0],p=i[1]-r[1];return n*p-d*l==0&&n*d<=0&&l*p<=0}function Bn(i,e,r,n){return(l=[n[0]-r[0],n[1]-r[1]])[0]*(d=[e[0]-i[0],e[1]-i[1]])[1]-l[1]*d[0]!=0&&!(!ja(i,e,r,n)||!ja(r,n,i,e));var l,d}function Wl(i,e,r){for(const n of r)for(let l=0;l<n.length-1;++l)if(Bn(i,e,n[l],n[l+1]))return!0;return!1}function ws(i,e,r=!1){let n=!1;for(const f of e)for(let _=0;_<f.length-1;_++){if(Hl(i,f[_],f[_+1]))return r;(d=f[_])[1]>(l=i)[1]!=(p=f[_+1])[1]>l[1]&&l[0]<(p[0]-d[0])*(l[1]-d[1])/(p[1]-d[1])+d[0]&&(n=!n)}var l,d,p;return n}function Xl(i,e){for(const r of e)if(ws(i,r))return!0;return!1}function Na(i,e){for(const r of i)if(!ws(r,e))return!1;for(let r=0;r<i.length-1;++r)if(Wl(i[r],i[r+1],e))return!1;return!0}function Jl(i,e){for(const r of e)if(Na(i,r))return!0;return!1}function ja(i,e,r,n){const l=n[0]-r[0],d=n[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 Po(i,e,r){const n=[];for(let l=0;l<i.length;l++){const d=[];for(let p=0;p<i[l].length;p++){const f=Io(i[l][p],r);ht(e,f),d.push(f)}n.push(d)}return n}function Ua(i,e,r){const n=[];for(let l=0;l<i.length;l++){const d=Po(i[l],e,r);n.push(d)}return n}function qa(i,e,r,n){if(i[0]<r[0]||i[0]>r[2]){const l=.5*n;let d=i[0]-r[0]>l?-n:r[0]-i[0]>l?n:0;d===0&&(d=i[0]-r[2]>l?-n:r[2]-i[0]>l?n:0),i[0]+=d}ht(e,i)}function Za(i,e,r,n){const l=Math.pow(2,n.z)*dr,d=[n.x*dr,n.y*dr],p=[];for(const f of i)for(const _ of f){const x=[_.x+d[0],_.y+d[1]];qa(x,e,r,l),p.push(x)}return p}function Ga(i,e,r,n){const l=Math.pow(2,n.z)*dr,d=[n.x*dr,n.y*dr],p=[];for(const _ of i){const x=[];for(const S of _){const E=[S.x+d[0],S.y+d[1]];ht(e,E),x.push(E)}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 _ of p)for(const x of _)qa(x,e,r,l)}var f;return p}class ts{constructor(e,r){this.type=Je,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(Ws(e[1])){const n=e[1];if(n.type==="FeatureCollection"){const l=[];for(const d of n.features){const{type:p,coordinates:f}=d.geometry;p==="Polygon"&&l.push(f),p==="MultiPolygon"&&l.push(...f)}if(l.length)return new ts(n,{type:"MultiPolygon",coordinates:l})}else if(n.type==="Feature"){const l=n.geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new ts(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new ts(n,n)}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,n){const l=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(n.type==="Polygon"){const f=Po(n.coordinates,d,p),_=Za(r.geometry(),l,d,p);if(!tn(l,d))return!1;for(const x of _)if(!ws(x,f))return!1}if(n.type==="MultiPolygon"){const f=Ua(n.coordinates,d,p),_=Za(r.geometry(),l,d,p);if(!tn(l,d))return!1;for(const x of _)if(!Xl(x,f))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,n){const l=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(n.type==="Polygon"){const f=Po(n.coordinates,d,p),_=Ga(r.geometry(),l,d,p);if(!tn(l,d))return!1;for(const x of _)if(!Na(x,f))return!1}if(n.type==="MultiPolygon"){const f=Ua(n.coordinates,d,p),_=Ga(r.geometry(),l,d,p);if(!tn(l,d))return!1;for(const x of _)if(!Jl(x,f))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Ha=class{constructor(i=[],e=Kl){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,n=e[i];for(;i>0;){const l=i-1>>1,d=e[l];if(r(n,d)>=0)break;e[i]=d,i=l}e[i]=n}_down(i){const{data:e,compare:r}=this,n=this.length>>1,l=e[i];for(;i<n;){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 Kl(i,e){return i<e?-1:i>e?1:0}function Yl(i,e,r,n,l){Wa(i,e,r,n||i.length-1,l||Ql)}function Wa(i,e,r,n,l){for(;n>r;){if(n-r>600){var d=n-r+1,p=e-r+1,f=Math.log(d),_=.5*Math.exp(2*f/3),x=.5*Math.sqrt(f*_*(d-_)/d)*(p-d/2<0?-1:1);Wa(i,e,Math.max(r,Math.floor(e-p*_/d+x)),Math.min(n,Math.floor(e+(d-p)*_/d+x)),l)}var S=i[e],E=r,k=n;for(rn(i,r,e),l(i[n],S)>0&&rn(i,r,n);E<k;){for(rn(i,E,k),E++,k--;l(i[E],S)<0;)E++;for(;l(i[k],S)>0;)k--}l(i[r],S)===0?rn(i,r,k):rn(i,++k,n),k<=e&&(r=k+1),e<=k&&(n=k-1)}}function rn(i,e,r){var n=i[e];i[e]=i[r],i[r]=n}function Ql(i,e){return i<e?-1:i>e?1:0}function Fn(i,e){if(i.length<=1)return[i];const r=[];let n,l;for(const d of i){const p=tc(d);p!==0&&(d.area=Math.abs(p),l===void 0&&(l=p<0),l===p<0?(n&&r.push(n),n=[d]):n.push(d))}if(n&&r.push(n),e>1)for(let d=0;d<r.length;d++)r[d].length<=e||(Yl(r[d],e,1,r[d].length-1,ec),r[d]=r[d].slice(0,e));return r}function ec(i,e){return e.area-i.area}function tc(i){let e=0;for(let r,n,l=0,d=i.length,p=d-1;l<d;p=l++)r=i[l],n=i[p],e+=(n.x-r.x)*(r.y+n.y);return e}const Xa=1/298.257223563,Ja=Xa*(2-Xa),Ka=Math.PI/180;class ko{constructor(e){const r=6378.137*Ka*1e3,n=Math.cos(e*Ka),l=1/(1-Ja*(1-n*n)),d=Math.sqrt(l);this.kx=r*d*n,this.ky=r*d*l*(1-Ja)}distance(e,r){const n=this.wrap(e[0]-r[0])*this.kx,l=(e[1]-r[1])*this.ky;return Math.sqrt(n*n+l*l)}pointOnLine(e,r){let n,l,d,p,f=1/0;for(let _=0;_<e.length-1;_++){let x=e[_][0],S=e[_][1],E=this.wrap(e[_+1][0]-x)*this.kx,k=(e[_+1][1]-S)*this.ky,D=0;E===0&&k===0||(D=(this.wrap(r[0]-x)*this.kx*E+(r[1]-S)*this.ky*k)/(E*E+k*k),D>1?(x=e[_+1][0],S=e[_+1][1]):D>0&&(x+=E/this.kx*D,S+=k/this.ky*D)),E=this.wrap(r[0]-x)*this.kx,k=(r[1]-S)*this.ky;const R=E*E+k*k;R<f&&(f=R,n=x,l=S,d=_,p=D)}return{point:[n,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 Ya(i,e){return e[0]-i[0]}function On(i){return i[1]-i[0]+1}function Tr(i,e){return i[1]>=i[0]&&i[1]<e}function sn(i,e){if(i[0]>i[1])return[null,null];const r=On(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 n=Math.floor(r/2)-1;return[[i[0],i[0]+n],[i[0]+n+1,i[1]]]}function Co(i,e){if(!Tr(e,i.length))return[1/0,1/0,-1/0,-1/0];const r=[1/0,1/0,-1/0,-1/0];for(let n=e[0];n<=e[1];++n)ht(r,i[n]);return r}function Mo(i){const e=[1/0,1/0,-1/0,-1/0];for(const r of i)for(const n of r)ht(e,n);return e}function Qa(i){return i[0]!==-1/0&&i[1]!==-1/0&&i[2]!==1/0&&i[3]!==1/0}function zo(i,e,r){if(!Qa(i)||!Qa(e))return NaN;let n=0,l=0;return i[2]<e[0]&&(n=e[0]-i[2]),i[0]>e[2]&&(n=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],[n,l])}function At(i,e,r){const n=r.pointOnLine(e,i);return r.distance(i,n.point)}function Do(i,e,r,n,l){const d=Math.min(At(i,[r,n],l),At(e,[r,n],l)),p=Math.min(At(r,[i,e],l),At(n,[i,e],l));return Math.min(d,p)}function lt(i,e,r,n,l){if(!Tr(e,i.length)||!Tr(n,r.length))return 1/0;let d=1/0;for(let p=e[0];p<e[1];++p){const f=i[p],_=i[p+1];for(let x=n[0];x<n[1];++x){const S=r[x],E=r[x+1];if(Bn(f,_,S,E))return 0;d=Math.min(d,Do(f,_,S,E,l))}}return d}function Lo(i,e,r,n,l){if(!Tr(e,i.length)||!Tr(n,r.length))return NaN;let d=1/0;for(let p=e[0];p<=e[1];++p)for(let f=n[0];f<=n[1];++f)if(d=Math.min(d,l.distance(i[p],r[f])),d===0)return d;return d}function Ot(i,e,r){if(ws(i,e,!0))return 0;let n=1/0;for(const l of e){const d=l[0],p=l[l.length-1];if(d!==p&&(n=Math.min(n,At(i,[p,d],r)),n===0))return n;const f=r.pointOnLine(l,i);if(n=Math.min(n,r.distance(i,f.point)),n===0)return n}return n}function Mt(i,e,r,n){if(!Tr(e,i.length))return NaN;for(let d=e[0];d<=e[1];++d)if(ws(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 _ of r)for(let x=0,S=_.length,E=S-1;x<S;E=x++){const k=_[E],D=_[x];if(Bn(p,f,k,D))return 0;l=Math.min(l,Do(p,f,k,D,n))}}return l}function nn(i,e){for(const r of i)for(const n of r)if(ws(n,e,!0))return!0;return!1}function el(i,e,r,n=1/0){const l=Mo(i),d=Mo(e);if(n!==1/0&&zo(l,d,r)>=n)return n;if(tn(l,d)){if(nn(i,e))return 0}else if(nn(e,i))return 0;let p=1/0;for(const f of i)for(let _=0,x=f.length,S=x-1;_<x;S=_++){const E=f[S],k=f[_];for(const D of e)for(let R=0,O=D.length,U=O-1;R<O;U=R++){const W=D[U],ne=D[R];if(Bn(E,k,W,ne))return 0;p=Math.min(p,Do(E,k,W,ne,r))}}return p}function Ro(i,e,r,n,l,d){if(!d)return;const p=zo(Co(n,d),l,r);p<e&&i.push([p,d,[0,0]])}function Vn(i,e,r,n,l,d,p){if(!d||!p)return;const f=zo(Co(n,d),Co(l,p),r);f<e&&i.push([f,d,p])}function $n(i,e,r,n,l=1/0){let d=Math.min(n.distance(i[0],r[0][0]),l);if(d===0)return d;const p=new Ha([[0,[0,i.length-1],[0,0]]],Ya),f=Mo(r);for(;p.length>0;){const _=p.pop();if(_[0]>=d)continue;const x=_[1],S=e?50:100;if(On(x)<=S){if(!Tr(x,i.length))return NaN;if(e){const E=Mt(i,x,r,n);if(isNaN(E)||E===0)return E;d=Math.min(d,E)}else for(let E=x[0];E<=x[1];++E){const k=Ot(i[E],r,n);if(d=Math.min(d,k),d===0)return 0}}else{const E=sn(x,e);Ro(p,d,n,i,f,E[0]),Ro(p,d,n,i,f,E[1])}}return d}function Nn(i,e,r,n,l,d=1/0){let p=Math.min(d,l.distance(i[0],r[0]));if(p===0)return p;const f=new Ha([[0,[0,i.length-1],[0,r.length-1]]],Ya);for(;f.length>0;){const _=f.pop();if(_[0]>=p)continue;const x=_[1],S=_[2],E=e?50:100,k=n?50:100;if(On(x)<=E&&On(S)<=k){if(!Tr(x,i.length)&&Tr(S,r.length))return NaN;let D;if(e&&n)D=lt(i,x,r,S,l),p=Math.min(p,D);else if(e&&!n){const R=i.slice(x[0],x[1]+1);for(let O=S[0];O<=S[1];++O)if(D=At(r[O],R,l),p=Math.min(p,D),p===0)return p}else if(!e&&n){const R=r.slice(S[0],S[1]+1);for(let O=x[0];O<=x[1];++O)if(D=At(i[O],R,l),p=Math.min(p,D),p===0)return p}else D=Lo(i,x,r,S,l),p=Math.min(p,D)}else{const D=sn(x,e),R=sn(S,n);Vn(f,p,l,i,r,D[0],R[0]),Vn(f,p,l,i,r,D[0],R[1]),Vn(f,p,l,i,r,D[1],R[0]),Vn(f,p,l,i,r,D[1],R[1])}}return p}function Bo(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 $r{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(Ws(e[1])){const n=e[1];if(n.type==="FeatureCollection")return new $r(n,n.features.map(l=>Bo(l.geometry)).flat());if(n.type==="Feature")return new $r(n,Bo(n.geometry));if("type"in n&&"coordinates"in n)return new $r(n,Bo(n))}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,n){const l=r.geometry(),d=l.flat().map(_=>bs([_.x,_.y],r.canonical));if(l.length===0)return NaN;const p=new ko(d[0][1]);let f=1/0;for(const _ of n){switch(_.type){case"Point":f=Math.min(f,Nn(d,!1,[_.coordinates],!1,p,f));break;case"LineString":f=Math.min(f,Nn(d,!1,_.coordinates,!0,p,f));break;case"Polygon":f=Math.min(f,$n(d,!1,_.coordinates,p,f))}if(f===0)return f}return f}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,n){const l=r.geometry(),d=l.flat().map(_=>bs([_.x,_.y],r.canonical));if(l.length===0)return NaN;const p=new ko(d[0][1]);let f=1/0;for(const _ of n){switch(_.type){case"Point":f=Math.min(f,Nn(d,!0,[_.coordinates],!1,p,f));break;case"LineString":f=Math.min(f,Nn(d,!0,_.coordinates,!0,p,f));break;case"Polygon":f=Math.min(f,$n(d,!0,_.coordinates,p,f))}if(f===0)return f}return f}(e,this.geometries);if(e.geometryType()==="Polygon")return function(r,n){const l=r.geometry();if(l.length===0||l[0].length===0)return NaN;const d=Fn(l,0).map(_=>_.map(x=>x.map(S=>bs([S.x,S.y],r.canonical)))),p=new ko(d[0][0][0][1]);let f=1/0;for(const _ of n)for(const x of d){switch(_.type){case"Point":f=Math.min(f,$n([_.coordinates],!1,x,p,f));break;case"LineString":f=Math.min(f,$n(_.coordinates,!0,x,p,f));break;case"Polygon":f=Math.min(f,el(x,_.coordinates,p,f))}if(f===0)return f}return f}(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const is={"==":Oa,"!=":ql,">":Va,"<":Zl,">=":Gl,"<=":$a,array:Ui,at:So,boolean:Ui,case:Mn,coalesce:Dn,collator:Ln,format:Rn,image:Eo,in:Ks,"index-of":kn,interpolate:Oi,"interpolate-hcl":Oi,"interpolate-lab":Oi,length:Ao,let:gt,literal:Qr,match:Cn,number:Ui,"number-format":To,object:Ui,slice:zn,step:vs,string:Ui,"to-boolean":Fr,"to-color":Fr,"to-number":Fr,"to-string":Fr,var:Pn,within:ts,distance:$r};class Vi{constructor(e,r,n,l){this.name=e,this.type=r,this._evaluate=n,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 n=e[0],l=Vi.definitions[n];if(!l)return r.error(`Unknown expression "${n}". 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 _=null;for(const[x,S]of f){_=new Or(r.registry,Un,r.path,null,r.scope);const E=[];let k=!1;for(let D=1;D<e.length;D++){const R=e[D],O=Array.isArray(x)?x[D-1]:x.type,U=_.parse(R,1+E.length,O);if(!U){k=!0;break}E.push(U)}if(!k)if(Array.isArray(x)&&x.length!==E.length)_.error(`Expected ${x.length} arguments, but found ${E.length} instead.`);else{for(let D=0;D<E.length;D++){const R=Array.isArray(x)?x[D]:x.type,O=E[D];_.concat(D+1).checkSubtype(R,O.type)}if(_.errors.length===0)return new Vi(n,d,S,E)}}if(f.length===1)r.errors.push(..._.errors);else{const x=(f.length?f:p).map(([E])=>{return k=E,Array.isArray(k)?`(${k.map(M).join(", ")})`:`(${M(k.type)}...)`;var k}).join(" | "),S=[];for(let E=1;E<e.length;E++){const k=r.parse(e[E],1+S.length);if(!k)return null;S.push(M(k.type))}r.error(`Expected arguments of type ${x}, but found (${S.join(", ")}) instead.`)}return null}static register(e,r){Vi.definitions=r;for(const n in r)e[n]=Vi}}function Fo(i,[e,r,n,l]){e=e.evaluate(i),r=r.evaluate(i),n=n.evaluate(i);const d=l?l.evaluate(i):1,p=An(e,r,n,d);if(p)throw new Zt(p);return new yt(e/255,r/255,n/255,d,!1)}function jn(i,e){return i in e}function Oo(i,e){const r=e[i];return r===void 0?null:r}function rs(i){return{type:i}}function Un(i){if(i instanceof Pn)return Un(i.boundExpression);if(i instanceof Vi&&i.name==="error"||i instanceof Ln||i instanceof ts||i instanceof $r)return!1;const e=i instanceof Fr||i instanceof Ui;let r=!0;return i.eachChild(n=>{r=e?r&&Un(n):r&&n instanceof Qr}),!!r&&qn(i)&&Zn(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function qn(i){if(i instanceof Vi&&(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 ts||i instanceof $r)return!1;let e=!0;return i.eachChild(r=>{e&&!qn(r)&&(e=!1)}),e}function on(i){if(i instanceof Vi&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!on(r)&&(e=!1)}),e}function Zn(i,e){if(i instanceof Vi&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(n=>{r&&!Zn(n,e)&&(r=!1)}),r}function tl(i){return{result:"success",value:i}}function Ss(i){return{result:"error",value:i}}function ss(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function Vo(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function Ts(i){return!!i.expression&&i.expression.interpolated}function pt(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function an(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function il(i){return i}function rl(i,e){const r=e.type==="color",n=i.stops&&typeof i.stops[0][0]=="object",l=n||!(n||i.property!==void 0),d=i.type||(Ts(e)?"exponential":"interval");if(r||e.type==="padding"){const S=r?yt.parse:Ri.parse;(i=lr({},i)).stops&&(i.stops=i.stops.map(E=>[E[0],S(E[1])])),i.default=S(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,_,x;if(d==="exponential")f=$o;else if(d==="interval")f=Hn;else if(d==="categorical"){f=Gn,_=Object.create(null);for(const S of i.stops)_[S[0]]=S[1];x=typeof i.stops[0][0]}else{if(d!=="identity")throw new Error(`Unknown function type "${d}"`);f=No}if(n){const S={},E=[];for(let R=0;R<i.stops.length;R++){const O=i.stops[R],U=O[0].zoom;S[U]===void 0&&(S[U]={zoom:U,type:i.type,property:i.property,default:i.default,stops:[]},E.push(U)),S[U].stops.push([O[0].value,O[1]])}const k=[];for(const R of E)k.push([S[R].zoom,rl(S[R],e)]);const D={name:"linear"};return{kind:"composite",interpolationType:D,interpolationFactor:Oi.interpolationFactor.bind(void 0,D),zoomStops:k.map(R=>R[0]),evaluate:({zoom:R},O)=>$o({stops:k,base:i.base},e,R).evaluate(R,O)}}if(l){const S=d==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:S,interpolationFactor:Oi.interpolationFactor.bind(void 0,S),zoomStops:i.stops.map(E=>E[0]),evaluate:({zoom:E})=>f(i,e,E,_,x)}}return{kind:"source",evaluate(S,E){const k=E&&E.properties?E.properties[i.property]:void 0;return k===void 0?ns(i.default,e.default):f(i,e,k,_,x)}}}function ns(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function Gn(i,e,r,n,l){return ns(typeof r===l?n[r]:void 0,i.default,e.default)}function Hn(i,e,r){if(pt(r)!=="number")return ns(i.default,e.default);const n=i.stops.length;if(n===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[n-1][0])return i.stops[n-1][1];const l=Ys(i.stops.map(d=>d[0]),r);return i.stops[l][1]}function $o(i,e,r){const n=i.base!==void 0?i.base:1;if(pt(r)!=="number")return ns(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=Ys(i.stops.map(S=>S[0]),r),p=function(S,E,k,D){const R=D-k,O=S-k;return R===0?0:E===1?O/R:(Math.pow(E,O)-1)/(Math.pow(E,R)-1)}(r,n,i.stops[d][0],i.stops[d+1][0]),f=i.stops[d][1],_=i.stops[d+1][1],x=Fi[e.type]||il;return typeof f.evaluate=="function"?{evaluate(...S){const E=f.evaluate.apply(void 0,S),k=_.evaluate.apply(void 0,S);if(E!==void 0&&k!==void 0)return x(E,k,p,i.colorSpace)}}:x(f,_,p,i.colorSpace)}function No(i,e,r){switch(e.type){case"color":r=yt.parse(r);break;case"formatted":r=Li.fromString(r.toString());break;case"resolvedImage":r=li.fromString(r.toString());break;case"padding":r=Ri.parse(r);break;default:pt(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return ns(r,i.default,e.default)}Vi.register(is,{error:[{kind:"error"},[nt],(i,[e])=>{throw new Zt(e.evaluate(i))}],typeof:[nt,[tt],(i,[e])=>M(Wt(e.evaluate(i)))],"to-rgba":[z(Ae,4),[Ei],(i,[e])=>{const[r,n,l,d]=e.evaluate(i).rgb;return[255*r,255*n,255*l,d]}],rgb:[Ei,[Ae,Ae,Ae],Fo],rgba:[Ei,[Ae,Ae,Ae,Ae],Fo],has:{type:Je,overloads:[[[nt],(i,[e])=>jn(e.evaluate(i),i.properties())],[[nt,Wi],(i,[e,r])=>jn(e.evaluate(i),r.evaluate(i))]]},get:{type:tt,overloads:[[[nt],(i,[e])=>Oo(e.evaluate(i),i.properties())],[[nt,Wi],(i,[e,r])=>Oo(e.evaluate(i),r.evaluate(i))]]},"feature-state":[tt,[nt],(i,[e])=>Oo(e.evaluate(i),i.featureState||{})],properties:[Wi,[],i=>i.properties()],"geometry-type":[nt,[],i=>i.geometryType()],id:[tt,[],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:[tt,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Ae,rs(Ae),(i,e)=>{let r=0;for(const n of e)r+=n.evaluate(i);return r}],"*":[Ae,rs(Ae),(i,e)=>{let r=1;for(const n of e)r*=n.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,rs(Ae),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[Ae,rs(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-==":[Je,[nt,tt],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[Je,[tt],(i,[e])=>i.id()===e.value],"filter-type-==":[Je,[nt],(i,[e])=>i.geometryType()===e.value],"filter-<":[Je,[nt,tt],(i,[e,r])=>{const n=i.properties()[e.value],l=r.value;return typeof n==typeof l&&n<l}],"filter-id-<":[Je,[tt],(i,[e])=>{const r=i.id(),n=e.value;return typeof r==typeof n&&r<n}],"filter->":[Je,[nt,tt],(i,[e,r])=>{const n=i.properties()[e.value],l=r.value;return typeof n==typeof l&&n>l}],"filter-id->":[Je,[tt],(i,[e])=>{const r=i.id(),n=e.value;return typeof r==typeof n&&r>n}],"filter-<=":[Je,[nt,tt],(i,[e,r])=>{const n=i.properties()[e.value],l=r.value;return typeof n==typeof l&&n<=l}],"filter-id-<=":[Je,[tt],(i,[e])=>{const r=i.id(),n=e.value;return typeof r==typeof n&&r<=n}],"filter->=":[Je,[nt,tt],(i,[e,r])=>{const n=i.properties()[e.value],l=r.value;return typeof n==typeof l&&n>=l}],"filter-id->=":[Je,[tt],(i,[e])=>{const r=i.id(),n=e.value;return typeof r==typeof n&&r>=n}],"filter-has":[Je,[tt],(i,[e])=>e.value in i.properties()],"filter-has-id":[Je,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Je,[z(nt)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[Je,[z(tt)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[Je,[nt,z(tt)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[Je,[nt,z(tt)],(i,[e,r])=>function(n,l,d,p){for(;d<=p;){const f=d+p>>1;if(l[f]===n)return!0;l[f]>n?p=f-1:d=f+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:Je,overloads:[[[Je,Je],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[rs(Je),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:Je,overloads:[[[Je,Je],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[rs(Je),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[Je,[Je],(i,[e])=>!e.evaluate(i)],"is-supported-script":[Je,[nt],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[nt,[nt],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[nt,[nt],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[nt,rs(tt),(i,e)=>e.map(r=>Sr(r.evaluate(i))).join("")],"resolved-locale":[nt,[hr],(i,[e])=>e.evaluate(i).resolvedLocale()]});class Wn{constructor(e,r){var n;this.expression=e,this._warningHistory={},this._evaluator=new Js,this._defaultValue=r?(n=r).type==="color"&&an(n.default)?new yt(0,0,0,0):n.type==="color"?yt.parse(n.default)||null:n.type==="padding"?Ri.parse(n.default)||null:n.type==="variableAnchorOffsetCollection"?Bi.parse(n.default)||null:n.default===void 0?null:n.default:null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,n,l,d,p){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=n,this._evaluator.canonical=l,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p,this.expression.evaluate(this._evaluator)}evaluate(e,r,n,l,d,p){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=n||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 Zt(`Expected value to be one of ${Object.keys(this._enumValues).map(_=>JSON.stringify(_)).join(", ")}, but found ${JSON.stringify(f)} instead.`);return f}catch(f){return this._warningHistory[f.message]||(this._warningHistory[f.message]=!0,typeof console<"u"&&console.warn(f.message)),this._defaultValue}}}function ln(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in is}function os(i,e){const r=new Or(is,Un,[],e?function(l){const d={color:Ei,string:nt,number:Ae,enum:nt,boolean:Je,formatted:wr,padding:Br,resolvedImage:ur,variableAnchorOffsetCollection:G};return l.type==="array"?z(d[l.value]||tt,l.length):d[l.type]}(e):void 0),n=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?tl(new Wn(n,e)):Ss(r.errors)}class jo{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!on(r.expression)}evaluateWithoutErrorHandling(e,r,n,l,d,p){return this._styleExpression.evaluateWithoutErrorHandling(e,r,n,l,d,p)}evaluate(e,r,n,l,d,p){return this._styleExpression.evaluate(e,r,n,l,d,p)}}class Uo{constructor(e,r,n,l){this.kind=e,this.zoomStops=n,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!on(r.expression),this.interpolationType=l}evaluateWithoutErrorHandling(e,r,n,l,d,p){return this._styleExpression.evaluateWithoutErrorHandling(e,r,n,l,d,p)}evaluate(e,r,n,l,d,p){return this._styleExpression.evaluate(e,r,n,l,d,p)}interpolationFactor(e,r,n){return this.interpolationType?Oi.interpolationFactor(this.interpolationType,e,r,n):0}}function sl(i,e){const r=os(i,e);if(r.result==="error")return r;const n=r.value.expression,l=qn(n);if(!l&&!ss(e))return Ss([new xi("","data expressions not supported")]);const d=Zn(n,["zoom"]);if(!d&&!Vo(e))return Ss([new xi("","zoom expressions not supported")]);const p=Jn(n);return p||d?p instanceof xi?Ss([p]):p instanceof Oi&&!Ts(e)?Ss([new xi("",'"interpolate" expressions cannot be used with this property')]):tl(p?new Uo(l?"camera":"composite",r.value,p.labels,p instanceof Oi?p.interpolation:void 0):new jo(l?"constant":"source",r.value)):Ss([new xi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Xn{constructor(e,r){this._parameters=e,this._specification=r,lr(this,rl(this._parameters,this._specification))}static deserialize(e){return new Xn(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Jn(i){let e=null;if(i instanceof gt)e=Jn(i.result);else if(i instanceof Dn){for(const r of i.args)if(e=Jn(r),e)break}else(i instanceof vs||i instanceof Oi)&&i.input instanceof Vi&&i.input.name==="zoom"&&(e=i);return e instanceof xi||i.eachChild(r=>{const n=Jn(r);n instanceof xi?e=n:!e&&n?e=new xi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&n&&e!==n&&(e=new xi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Es(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(!Es(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const Kn={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function vi(i){if(i==null)return{filter:()=>!0,needGeometry:!1};Es(i)||(i=Yn(i));const e=os(i,Kn);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,n,l)=>e.value.evaluate(r,n,{},l),needGeometry:qo(i)}}function cn(i,e){return i<e?-1:i>e?1:0}function qo(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(qo(i[e]))return!0;return!1}function Yn(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?Zo(i[1],i[2],"=="):e==="!="?Is(Zo(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Zo(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(Yn))):e==="all"?["all"].concat(i.slice(1).map(Yn)):e==="none"?["all"].concat(i.slice(1).map(Yn).map(Is)):e==="in"?As(i[1],i.slice(2)):e==="!in"?Is(As(i[1],i.slice(2))):e==="has"?Go(i[1]):e!=="!has"||Is(Go(i[1]));var r}function Zo(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 As(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(cn)]]:["filter-in-small",i,["literal",e]]}}function Go(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Is(i){return["!",i]}function Ho(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+=`${Ho(d)},`;return`${l}]`}const r=Object.keys(i).sort();let n="{";for(let l=0;l<r.length;l++)n+=`${JSON.stringify(r[l])}:${Ho(i[r[l]])},`;return`${n}}`}function Wo(i){let e="";for(const r of Yr)e+=`/${Ho(i[r])}`;return e}function nl(i){const e=i.value;return e?[new Se(i.key,e,"constants have been deprecated as of v8")]:[]}function zt(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function as(i){if(Array.isArray(i))return i.map(as);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={};for(const r in i)e[r]=as(i[r]);return e}return zt(i)}function Ai(i){const e=i.key,r=i.value,n=i.valueSpec||{},l=i.objectElementValidators||{},d=i.style,p=i.styleSpec,f=i.validateSpec;let _=[];const x=pt(r);if(x!=="object")return[new Se(e,r,`object expected, ${x} found`)];for(const S in r){const E=S.split(".")[0],k=n[E]||n["*"];let D;if(l[E])D=l[E];else if(n[E])D=f;else if(l["*"])D=l["*"];else{if(!n["*"]){_.push(new Se(e,r[S],`unknown property "${S}"`));continue}D=f}_=_.concat(D({key:(e&&`${e}.`)+S,value:r[S],valueSpec:k,style:d,styleSpec:p,object:r,objectKey:S,validateSpec:f},r))}for(const S in n)l[S]||n[S].required&&n[S].default===void 0&&r[S]===void 0&&_.push(new Se(e,r,`missing required property "${S}"`));return _}function Qn(i){const e=i.value,r=i.valueSpec,n=i.style,l=i.styleSpec,d=i.key,p=i.arrayElementValidator||i.validateSpec;if(pt(e)!=="array")return[new Se(d,e,`array expected, ${pt(e)} found`)];if(r.length&&e.length!==r.length)return[new Se(d,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new Se(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),pt(r.value)==="object"&&(f=r.value);let _=[];for(let x=0;x<e.length;x++)_=_.concat(p({array:e,arrayIndex:x,value:e[x],valueSpec:f,validateSpec:i.validateSpec,style:n,styleSpec:l,key:`${d}[${x}]`}));return _}function hn(i){const e=i.key,r=i.value,n=i.valueSpec;let l=pt(r);return l==="number"&&r!=r&&(l="NaN"),l!=="number"?[new Se(e,r,`number expected, ${l} found`)]:"minimum"in n&&r<n.minimum?[new Se(e,r,`${r} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&r>n.maximum?[new Se(e,r,`${r} is greater than the maximum value ${n.maximum}`)]:[]}function Xo(i){const e=i.valueSpec,r=zt(i.value.type);let n,l,d,p={};const f=r!=="categorical"&&i.value.property===void 0,_=!f,x=pt(i.value.stops)==="array"&&pt(i.value.stops[0])==="array"&&pt(i.value.stops[0][0])==="object",S=Ai({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(D){if(r==="identity")return[new Se(D.key,D.value,'identity function may not have a "stops" property')];let R=[];const O=D.value;return R=R.concat(Qn({key:D.key,value:O,valueSpec:D.valueSpec,validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec,arrayElementValidator:E})),pt(O)==="array"&&O.length===0&&R.push(new Se(D.key,O,"array must have at least one stop")),R},default:function(D){return D.validateSpec({key:D.key,value:D.value,valueSpec:e,validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec})}}});return r==="identity"&&f&&S.push(new Se(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||S.push(new Se(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!Ts(i.valueSpec)&&S.push(new Se(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(_&&!ss(i.valueSpec)?S.push(new Se(i.key,i.value,"property functions not supported")):f&&!Vo(i.valueSpec)&&S.push(new Se(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!x||i.value.property!==void 0||S.push(new Se(i.key,i.value,'"property" property is required')),S;function E(D){let R=[];const O=D.value,U=D.key;if(pt(O)!=="array")return[new Se(U,O,`array expected, ${pt(O)} found`)];if(O.length!==2)return[new Se(U,O,`array length 2 expected, length ${O.length} found`)];if(x){if(pt(O[0])!=="object")return[new Se(U,O,`object expected, ${pt(O[0])} found`)];if(O[0].zoom===void 0)return[new Se(U,O,"object stop key must have zoom")];if(O[0].value===void 0)return[new Se(U,O,"object stop key must have value")];if(d&&d>zt(O[0].zoom))return[new Se(U,O[0].zoom,"stop zoom values must appear in ascending order")];zt(O[0].zoom)!==d&&(d=zt(O[0].zoom),l=void 0,p={}),R=R.concat(Ai({key:`${U}[0]`,value:O[0],valueSpec:{zoom:{}},validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec,objectElementValidators:{zoom:hn,value:k}}))}else R=R.concat(k({key:`${U}[0]`,value:O[0],valueSpec:{},validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec},O));return ln(as(O[1]))?R.concat([new Se(`${U}[1]`,O[1],"expressions are not allowed in function stops.")]):R.concat(D.validateSpec({key:`${U}[1]`,value:O[1],valueSpec:e,validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec}))}function k(D,R){const O=pt(D.value),U=zt(D.value),W=D.value!==null?D.value:R;if(n){if(O!==n)return[new Se(D.key,W,`${O} stop domain type must match previous stop domain type ${n}`)]}else n=O;if(O!=="number"&&O!=="string"&&O!=="boolean")return[new Se(D.key,W,"stop domain value must be a number, string, or boolean")];if(O!=="number"&&r!=="categorical"){let ne=`number expected, ${O} found`;return ss(e)&&r===void 0&&(ne+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Se(D.key,W,ne)]}return r!=="categorical"||O!=="number"||isFinite(U)&&Math.floor(U)===U?r!=="categorical"&&O==="number"&&l!==void 0&&U<l?[new Se(D.key,W,"stop domain values must appear in ascending order")]:(l=U,r==="categorical"&&U in p?[new Se(D.key,W,"stop domain values must be unique")]:(p[U]=!0,[])):[new Se(D.key,W,`integer expected, found ${U}`)]}}function ls(i){const e=(i.expressionContext==="property"?sl:os)(as(i.value),i.valueSpec);if(e.result==="error")return e.value.map(n=>new Se(`${i.key}${n.key}`,i.value,n.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new Se(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!on(r))return[new Se(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!on(r))return[new Se(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Zn(r,["zoom","feature-state"]))return[new Se(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!qn(r))return[new Se(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function un(i){const e=i.key,r=i.value,n=i.valueSpec,l=[];return Array.isArray(n.values)?n.values.indexOf(zt(r))===-1&&l.push(new Se(e,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(n.values).indexOf(zt(r))===-1&&l.push(new Se(e,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),l}function dn(i){return Es(as(i.value))?ls(lr({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):pn(i)}function pn(i){const e=i.value,r=i.key;if(pt(e)!=="array")return[new Se(r,e,`array expected, ${pt(e)} found`)];const n=i.styleSpec;let l,d=[];if(e.length<1)return[new Se(r,e,"filter array must have at least 1 element")];switch(d=d.concat(un({key:`${r}[0]`,value:e[0],valueSpec:n.filter_operator,style:i.style,styleSpec:i.styleSpec})),zt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&zt(e[1])==="$type"&&d.push(new Se(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&d.push(new Se(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(l=pt(e[1]),l!=="string"&&d.push(new Se(`${r}[1]`,e[1],`string expected, ${l} found`)));for(let p=2;p<e.length;p++)l=pt(e[p]),zt(e[1])==="$type"?d=d.concat(un({key:`${r}[${p}]`,value:e[p],valueSpec:n.geometry_type,style:i.style,styleSpec:i.styleSpec})):l!=="string"&&l!=="number"&&l!=="boolean"&&d.push(new Se(`${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(pn({key:`${r}[${p}]`,value:e[p],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":l=pt(e[1]),e.length!==2?d.push(new Se(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):l!=="string"&&d.push(new Se(`${r}[1]`,e[1],`string expected, ${l} found`))}return d}function Jo(i,e){const r=i.key,n=i.validateSpec,l=i.style,d=i.styleSpec,p=i.value,f=i.objectKey,_=d[`${e}_${i.layerType}`];if(!_)return[];const x=f.match(/^(.*)-transition$/);if(e==="paint"&&x&&_[x[1]]&&_[x[1]].transition)return n({key:r,value:p,valueSpec:d.transition,style:l,styleSpec:d});const S=i.valueSpec||_[f];if(!S)return[new Se(r,p,`unknown property "${f}"`)];let E;if(pt(p)==="string"&&ss(S)&&!S.tokens&&(E=/^{([^}]+)}$/.exec(p)))return[new Se(r,p,`"${f}" does not support interpolation syntax
|
5
|
+
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(E[1])} }\`.`)];const k=[];return i.layerType==="symbol"&&(f==="text-field"&&l&&!l.glyphs&&k.push(new Se(r,p,'use of "text-field" requires a style "glyphs" property')),f==="text-font"&&an(as(p))&&zt(p.type)==="identity"&&k.push(new Se(r,p,'"text-font" does not support identity functions'))),k.concat(n({key:i.key,value:p,valueSpec:S,style:l,styleSpec:d,expressionContext:"property",propertyType:e,propertyKey:f}))}function Ko(i){return Jo(i,"paint")}function Yo(i){return Jo(i,"layout")}function Qo(i){let e=[];const r=i.value,n=i.key,l=i.style,d=i.styleSpec;r.type||r.ref||e.push(new Se(n,r,'either "type" or "ref" is required'));let p=zt(r.type);const f=zt(r.ref);if(r.id){const _=zt(r.id);for(let x=0;x<i.arrayIndex;x++){const S=l.layers[x];zt(S.id)===_&&e.push(new Se(n,r.id,`duplicate layer id "${r.id}", previously used at line ${S.id.__line__}`))}}if("ref"in r){let _;["type","source","source-layer","filter","layout"].forEach(x=>{x in r&&e.push(new Se(n,r[x],`"${x}" is prohibited for ref layers`))}),l.layers.forEach(x=>{zt(x.id)===f&&(_=x)}),_?_.ref?e.push(new Se(n,r.ref,"ref cannot reference another ref layer")):p=zt(_.type):e.push(new Se(n,r.ref,`ref layer "${f}" not found`))}else if(p!=="background")if(r.source){const _=l.sources&&l.sources[r.source],x=_&&zt(_.type);_?x==="vector"&&p==="raster"?e.push(new Se(n,r.source,`layer "${r.id}" requires a raster source`)):x!=="raster-dem"&&p==="hillshade"?e.push(new Se(n,r.source,`layer "${r.id}" requires a raster-dem source`)):x==="raster"&&p!=="raster"?e.push(new Se(n,r.source,`layer "${r.id}" requires a vector source`)):x!=="vector"||r["source-layer"]?x==="raster-dem"&&p!=="hillshade"?e.push(new Se(n,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):p!=="line"||!r.paint||!r.paint["line-gradient"]||x==="geojson"&&_.lineMetrics||e.push(new Se(n,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Se(n,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new Se(n,r.source,`source "${r.source}" not found`))}else e.push(new Se(n,r,'missing required property "source"'));return e=e.concat(Ai({key:n,value:r,valueSpec:d.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${n}.type`,value:r.type,valueSpec:d.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:dn,layout:_=>Ai({layer:r,key:_.key,value:_.value,style:_.style,styleSpec:_.styleSpec,validateSpec:_.validateSpec,objectElementValidators:{"*":x=>Yo(lr({layerType:p},x))}}),paint:_=>Ai({layer:r,key:_.key,value:_.value,style:_.style,styleSpec:_.styleSpec,validateSpec:_.validateSpec,objectElementValidators:{"*":x=>Ko(lr({layerType:p},x))}})}})),e}function Er(i){const e=i.value,r=i.key,n=pt(e);return n!=="string"?[new Se(r,e,`string expected, ${n} found`)]:[]}const ea={promoteId:function({key:i,value:e}){if(pt(e)==="string")return Er({key:i,value:e});{const r=[];for(const n in e)r.push(...Er({key:`${i}.${n}`,value:e[n]}));return r}}};function ol(i){const e=i.value,r=i.key,n=i.styleSpec,l=i.style,d=i.validateSpec;if(!e.type)return[new Se(r,e,'"type" is required')];const p=zt(e.type);let f;switch(p){case"vector":case"raster":return f=Ai({key:r,value:e,valueSpec:n[`source_${p.replace("-","_")}`],style:i.style,styleSpec:n,objectElementValidators:ea,validateSpec:d}),f;case"raster-dem":return f=function(_){var x;const S=(x=_.sourceName)!==null&&x!==void 0?x:"",E=_.value,k=_.styleSpec,D=k.source_raster_dem,R=_.style;let O=[];const U=pt(E);if(E===void 0)return O;if(U!=="object")return O.push(new Se("source_raster_dem",E,`object expected, ${U} found`)),O;const W=zt(E.encoding)==="custom",ne=["redFactor","greenFactor","blueFactor","baseShift"],Y=_.value.encoding?`"${_.value.encoding}"`:"Default";for(const ie in E)!W&&ne.includes(ie)?O.push(new Se(ie,E[ie],`In "${S}": "${ie}" is only valid when "encoding" is set to "custom". ${Y} encoding found`)):D[ie]?O=O.concat(_.validateSpec({key:ie,value:E[ie],valueSpec:D[ie],validateSpec:_.validateSpec,style:R,styleSpec:k})):O.push(new Se(ie,E[ie],`unknown property "${ie}"`));return O}({sourceName:r,value:e,style:i.style,styleSpec:n,validateSpec:d}),f;case"geojson":if(f=Ai({key:r,value:e,valueSpec:n.source_geojson,style:l,styleSpec:n,validateSpec:d,objectElementValidators:ea}),e.cluster)for(const _ in e.clusterProperties){const[x,S]=e.clusterProperties[_],E=typeof x=="string"?[x,["accumulated"],["get",_]]:x;f.push(...ls({key:`${r}.${_}.map`,value:S,validateSpec:d,expressionContext:"cluster-map"})),f.push(...ls({key:`${r}.${_}.reduce`,value:E,validateSpec:d,expressionContext:"cluster-reduce"}))}return f;case"video":return Ai({key:r,value:e,valueSpec:n.source_video,style:l,validateSpec:d,styleSpec:n});case"image":return Ai({key:r,value:e,valueSpec:n.source_image,style:l,validateSpec:d,styleSpec:n});case"canvas":return[new Se(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return un({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:l,validateSpec:d,styleSpec:n})}}function ta(i){const e=i.value,r=i.styleSpec,n=r.light,l=i.style;let d=[];const p=pt(e);if(e===void 0)return d;if(p!=="object")return d=d.concat([new Se("light",e,`object expected, ${p} found`)]),d;for(const f in e){const _=f.match(/^(.*)-transition$/);d=d.concat(_&&n[_[1]]&&n[_[1]].transition?i.validateSpec({key:f,value:e[f],valueSpec:r.transition,validateSpec:i.validateSpec,style:l,styleSpec:r}):n[f]?i.validateSpec({key:f,value:e[f],valueSpec:n[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new Se(f,e[f],`unknown property "${f}"`)])}return d}function al(i){const e=i.value,r=i.styleSpec,n=r.sky,l=i.style,d=pt(e);if(e===void 0)return[];if(d!=="object")return[new Se("sky",e,`object expected, ${d} found`)];let p=[];for(const f in e)p=p.concat(n[f]?i.validateSpec({key:f,value:e[f],valueSpec:n[f],style:l,styleSpec:r}):[new Se(f,e[f],`unknown property "${f}"`)]);return p}function ia(i){const e=i.value,r=i.styleSpec,n=r.terrain,l=i.style;let d=[];const p=pt(e);if(e===void 0)return d;if(p!=="object")return d=d.concat([new Se("terrain",e,`object expected, ${p} found`)]),d;for(const f in e)d=d.concat(n[f]?i.validateSpec({key:f,value:e[f],valueSpec:n[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new Se(f,e[f],`unknown property "${f}"`)]);return d}function ra(i){let e=[];const r=i.value,n=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 Se(n,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 Se(n,r,`all the sprites' URLs must be unique, but ${r[p].url} is duplicated`)),d.push(r[p].url),e=e.concat(Ai({key:`${n}[${p}]`,value:r[p],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return e}return Er({key:n,value:r})}const sa={"*":()=>[],array:Qn,boolean:function(i){const e=i.value,r=i.key,n=pt(e);return n!=="boolean"?[new Se(r,e,`boolean expected, ${n} found`)]:[]},number:hn,color:function(i){const e=i.key,r=i.value,n=pt(r);return n!=="string"?[new Se(e,r,`color expected, ${n} found`)]:yt.parse(String(r))?[]:[new Se(e,r,`color expected, "${r}" found`)]},constants:nl,enum:un,filter:dn,function:Xo,layer:Qo,object:Ai,source:ol,light:ta,sky:al,terrain:ia,projection:function(i){const e=i.value,r=i.styleSpec,n=r.projection,l=i.style,d=pt(e);if(e===void 0)return[];if(d!=="object")return[new Se("projection",e,`object expected, ${d} found`)];let p=[];for(const f in e)p=p.concat(n[f]?i.validateSpec({key:f,value:e[f],valueSpec:n[f],style:l,styleSpec:r}):[new Se(f,e[f],`unknown property "${f}"`)]);return p},string:Er,formatted:function(i){return Er(i).length===0?[]:ls(i)},resolvedImage:function(i){return Er(i).length===0?[]:ls(i)},padding:function(i){const e=i.key,r=i.value;if(pt(r)==="array"){if(r.length<1||r.length>4)return[new Se(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const n={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:n}));return l}return hn({key:e,value:r,valueSpec:{}})},variableAnchorOffsetCollection:function(i){const e=i.key,r=i.value,n=pt(r),l=i.styleSpec;if(n!=="array"||r.length<1||r.length%2!=0)return[new Se(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(un({key:`${e}[${p}]`,value:r[p],valueSpec:l.layout_symbol["text-anchor"]})),d=d.concat(Qn({key:`${e}[${p+1}]`,value:r[p+1],valueSpec:{length:2,value:"number"},validateSpec:i.validateSpec,style:i.style,styleSpec:l}));return d},sprite:ra};function fn(i){const e=i.value,r=i.valueSpec,n=i.styleSpec;return i.validateSpec=fn,r.expression&&an(zt(e))?Xo(i):r.expression&&ln(as(e))?ls(i):r.type&&sa[r.type]?sa[r.type](i):Ai(lr({},i,{valueSpec:r.type?n[r.type]:r}))}function ll(i){const e=i.value,r=i.key,n=Er(i);return n.length||(e.indexOf("{fontstack}")===-1&&n.push(new Se(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&n.push(new Se(r,e,'"glyphs" url must include a "{range}" token'))),n}function qi(i,e=he){let r=[];return r=r.concat(fn({key:"",value:i,valueSpec:e.$root,styleSpec:e,style:i,validateSpec:fn,objectElementValidators:{glyphs:ll,"*":()=>[]}})),i.constants&&(r=r.concat(nl({key:"constants",value:i.constants,style:i,styleSpec:e,validateSpec:fn}))),na(r)}function Xi(i){return function(e){return i({...e,validateSpec:fn})}}function na(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function Ji(i){return function(...e){return na(i.apply(this,e))}}qi.source=Ji(Xi(ol)),qi.sprite=Ji(Xi(ra)),qi.glyphs=Ji(Xi(ll)),qi.light=Ji(Xi(ta)),qi.sky=Ji(Xi(al)),qi.terrain=Ji(Xi(ia)),qi.layer=Ji(Xi(Qo)),qi.filter=Ji(Xi(dn)),qi.paintProperty=Ji(Xi(Ko)),qi.layoutProperty=Ji(Xi(Yo));const Ar=qi,ic=Ar.light,oa=Ar.sky,rc=Ar.paintProperty,sc=Ar.layoutProperty;function aa(i,e){let r=!1;if(e&&e.length)for(const n of e)i.fire(new Dr(new Error(n.message))),r=!0;return r}class Ps{constructor(e,r,n){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*(n=p[2]);for(let _=0;_<this.d*this.d;_++){const x=p[3+_],S=p[3+_+1];l.push(x===S?null:p.subarray(x,S))}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*n;for(let p=0;p<this.d*this.d;p++)l.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=n,this.scale=r/e,this.uid=0;const d=n/r*e;this.min=-d,this.max=e+d}insert(e,r,n,l,d){this._forEachCell(r,n,l,d,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(l),this.bboxes.push(d)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,n,l,d,p){this.cells[d].push(p)}query(e,r,n,l,d){const p=this.min,f=this.max;if(e<=p&&r<=p&&f<=n&&f<=l&&!d)return Array.prototype.slice.call(this.keys);{const _=[];return this._forEachCell(e,r,n,l,this._queryCell,_,{},d),_}}_queryCell(e,r,n,l,d,p,f,_){const x=this.cells[d];if(x!==null){const S=this.keys,E=this.bboxes;for(let k=0;k<x.length;k++){const D=x[k];if(f[D]===void 0){const R=4*D;(_?_(E[R+0],E[R+1],E[R+2],E[R+3]):e<=E[R+2]&&r<=E[R+3]&&n>=E[R+0]&&l>=E[R+1])?(f[D]=!0,p.push(S[D])):f[D]=!1}}}}_forEachCell(e,r,n,l,d,p,f,_){const x=this._convertToCellCoord(e),S=this._convertToCellCoord(r),E=this._convertToCellCoord(n),k=this._convertToCellCoord(l);for(let D=x;D<=E;D++)for(let R=S;R<=k;R++){const O=this.d*R+D;if((!_||_(this._convertFromCellCoord(D),this._convertFromCellCoord(R),this._convertFromCellCoord(D+1),this._convertFromCellCoord(R+1)))&&d.call(this,e,r,n,l,O,p,f,_))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,r=3+this.cells.length+1+1;let n=0;for(let p=0;p<this.cells.length;p++)n+=this.cells[p].length;const l=new Int32Array(r+n+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 n=e.toArrayBuffer();return r&&r.push(n),{buffer:n}}static deserialize(e){return new Ps(e.buffer)}}const pr={};function Re(i,e,r={}){if(pr[i])throw new Error(`${i} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),pr[i]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}Re("Object",Object),Re("TransferableGridIndex",Ps),Re("Color",yt),Re("Error",Error),Re("AJAXError",Di),Re("ResolvedImage",li),Re("StylePropertyFunction",Xn),Re("StyleExpression",Wn,{omit:["_evaluator"]}),Re("ZoomDependentExpression",Uo),Re("ZoomConstantExpression",jo),Re("CompoundExpression",Vi,{omit:["_evaluate"]});for(const i in is)is[i]._classRegistryKey||Re(`Expression_${i}`,is[i]);function cl(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function la(i){return i.$name||i.constructor._classRegistryKey}function hl(i){return!function(e){if(e===null||typeof e!="object")return!1;const r=la(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||cl(i)||or(i)||ArrayBuffer.isView(i)||i instanceof ImageData)}function mn(i,e){if(hl(i))return(cl(i)||or(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(mn(p,e));return d}if(typeof i!="object")throw new Error("can't serialize object of type "+typeof i);const r=la(i);if(!r)throw new Error(`can't serialize object of unregistered class ${i.constructor.name}`);if(!pr[r])throw new Error(`${r} is not registered.`);const{klass:n}=pr[r],l=n.serialize?n.serialize(i,e):{};if(n.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)||pr[r].omit.indexOf(d)>=0)continue;const p=i[d];l[d]=pr[r].shallow.indexOf(d)>=0?p:mn(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 fr(i){if(hl(i))return i;if(Array.isArray(i))return i.map(fr);if(typeof i!="object")throw new Error("can't deserialize object of type "+typeof i);const e=la(i)||"Object";if(!pr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=pr[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const n=Object.create(r.prototype);for(const l of Object.keys(i)){if(l==="$name")continue;const d=i[l];n[l]=pr[e].shallow.indexOf(l)>=0?d:fr(d)}return n}class ul{constructor(){this.first=!0}update(e,r){const n=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<n&&(this.lastIntegerZoom=n,this.lastIntegerZoomTime=r),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=n,!0))}}const Ce={"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(ha(e.charCodeAt(0)))return!0;return!1}function nc(i){for(const e of i)if(!dl(e.charCodeAt(0)))return!1;return!0}function dl(i){return!(Ce.Arabic(i)||Ce["Arabic Supplement"](i)||Ce["Arabic Extended-A"](i)||Ce["Arabic Presentation Forms-A"](i)||Ce["Arabic Presentation Forms-B"](i))}function ha(i){return!(i!==746&&i!==747&&(i<4352||!(Ce["Bopomofo Extended"](i)||Ce.Bopomofo(i)||Ce["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||Ce["CJK Compatibility Ideographs"](i)||Ce["CJK Compatibility"](i)||Ce["CJK Radicals Supplement"](i)||Ce["CJK Strokes"](i)||!(!Ce["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Ce["CJK Unified Ideographs Extension A"](i)||Ce["CJK Unified Ideographs"](i)||Ce["Enclosed CJK Letters and Months"](i)||Ce["Hangul Compatibility Jamo"](i)||Ce["Hangul Jamo Extended-A"](i)||Ce["Hangul Jamo Extended-B"](i)||Ce["Hangul Jamo"](i)||Ce["Hangul Syllables"](i)||Ce.Hiragana(i)||Ce["Ideographic Description Characters"](i)||Ce.Kanbun(i)||Ce["Kangxi Radicals"](i)||Ce["Katakana Phonetic Extensions"](i)||Ce.Katakana(i)&&i!==12540||!(!Ce["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)||!(!Ce["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||Ce["Unified Canadian Aboriginal Syllabics"](i)||Ce["Unified Canadian Aboriginal Syllabics Extended"](i)||Ce["Vertical Forms"](i)||Ce["Yijing Hexagram Symbols"](i)||Ce["Yi Syllables"](i)||Ce["Yi Radicals"](i))))}function pl(i){return!(ha(i)||function(e){return!!(Ce["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||Ce["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)||Ce["Letterlike Symbols"](e)||Ce["Number Forms"](e)||Ce["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)||Ce["Control Pictures"](e)&&e!==9251||Ce["Optical Character Recognition"](e)||Ce["Enclosed Alphanumerics"](e)||Ce["Geometric Shapes"](e)||Ce["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Ce["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Ce["CJK Symbols and Punctuation"](e)||Ce.Katakana(e)||Ce["Private Use Area"](e)||Ce["CJK Compatibility Forms"](e)||Ce["Small Form Variants"](e)||Ce["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 Nr(i){return i>=1424&&i<=2303||Ce["Arabic Presentation Forms-A"](i)||Ce["Arabic Presentation Forms-B"](i)}function fl(i,e){return!(!e&&Nr(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Ce.Khmer(i))}function ua(i){for(const e of i)if(Nr(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 It{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 ul,this.transition={})}isSupportedScript(e){return function(r,n){for(const l of r)if(!fl(l.charCodeAt(0),n))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),n=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*r}}}class eo{constructor(e,r){this.property=e,this.value=r,this.expression=function(n,l){if(an(n))return new Xn(n,l);if(ln(n)){const d=sl(n,l);if(d.result==="error")throw new Error(d.value.map(p=>`${p.key}: ${p.message}`).join(", "));return d.value}{let d=n;return l.type==="color"&&typeof n=="string"?d=yt.parse(n):l.type!=="padding"||typeof n!="number"&&!Array.isArray(n)?l.type==="variableAnchorOffsetCollection"&&Array.isArray(n)&&(d=Bi.parse(n)):d=Ri.parse(n),{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,n){return this.property.possiblyEvaluate(this,e,r,n)}}class ks{constructor(e){this.property=e,this.value=new eo(e,void 0)}transitioned(e,r){return new ml(this.property,this.value,r,Tt({},e.transition,this.transition),e.now)}untransitioned(){return new ml(this.property,this.value,null,{},0)}}class Cs{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 ks(this._values[e].property)),this._values[e].value=new eo(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 ks(this._values[e].property)),this._values[e].transition=vt(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const n=this.getValue(r);n!==void 0&&(e[r]=n);const l=this.getTransition(r);l!==void 0&&(e[`${r}-transition`]=l)}return e}transitioned(e,r){const n=new da(this._properties);for(const l of Object.keys(this._values))n._values[l]=this._values[l].transitioned(e,r._values[l]);return n}untransitioned(){const e=new da(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class ml{constructor(e,r,n,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=n)}possiblyEvaluate(e,r,n){const l=e.now||0,d=this.value.possiblyEvaluate(e,r,n),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,n);{const f=(l-this.begin)/(this.end-this.begin);return this.property.interpolate(p.possiblyEvaluate(e,r,n),d,function(_){if(_<=0)return 0;if(_>=1)return 1;const x=_*_,S=x*_;return 4*(_<.5?S:3*(_-x)+S-.75)}(f))}}return d}}class da{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,n){const l=new to(this._properties);for(const d of Object.keys(this._values))l._values[d]=this._values[d].possiblyEvaluate(e,r,n);return l}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class gn{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 eo(this._values[e].property,r===null?void 0:vt(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const n=this.getValue(r);n!==void 0&&(e[r]=n)}return e}possiblyEvaluate(e,r,n){const l=new to(this._properties);for(const d of Object.keys(this._values))l._values[d]=this._values[d].possiblyEvaluate(e,r,n);return l}}class mr{constructor(e,r,n){this.property=e,this.value=r,this.parameters=n}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,n,l){return this.property.evaluate(this.value,this.parameters,e,r,n,l)}}class to{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class je{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,n){const l=Fi[this.specification.type];return l?l(e,r,n):e}}class We{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,n,l){return new mr(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},n,l)}:e.expression,r)}interpolate(e,r,n){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new mr(this,{kind:"constant",value:void 0},e.parameters);const l=Fi[this.specification.type];if(l){const d=l(e.value.value,r.value.value,n);return new mr(this,{kind:"constant",value:d},e.parameters)}return e}evaluate(e,r,n,l,d,p){return e.kind==="constant"?e.value:e.evaluate(r,n,l,d,p)}}class u extends We{possiblyEvaluate(e,r,n,l){if(e.value===void 0)return new mr(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const d=e.expression.evaluate(r,null,{},n,l),p=e.property.specification.type==="resolvedImage"&&typeof d!="string"?d.name:d,f=this._calculate(p,p,p,r);return new mr(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 mr(this,{kind:"constant",value:d},r)}return new mr(this,e.expression,r)}evaluate(e,r,n,l,d,p){if(e.kind==="source"){const f=e.evaluate(r,n,l,d,p);return this._calculate(f,f,f,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},n,l),e.evaluate({zoom:Math.floor(r.zoom)},n,l),e.evaluate({zoom:Math.floor(r.zoom)+1},n,l),r):e.value}_calculate(e,r,n,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:n,to:r}}interpolate(e){return e}}class t{constructor(e){this.specification=e}possiblyEvaluate(e,r,n,l){if(e.value!==void 0){if(e.expression.kind==="constant"){const d=e.expression.evaluate(r,null,{},n,l);return this._calculate(d,d,d,r)}return this._calculate(e.expression.evaluate(new It(Math.floor(r.zoom-1),r)),e.expression.evaluate(new It(Math.floor(r.zoom),r)),e.expression.evaluate(new It(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,n,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:n,to:r}}interpolate(e){return e}}class s{constructor(e){this.specification=e}possiblyEvaluate(e,r,n,l){return!!e.expression.evaluate(r,null,{},n,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 n=e[r];n.specification.overridable&&this.overridableProperties.push(r);const l=this.defaultPropertyValues[r]=new eo(n,void 0),d=this.defaultTransitionablePropertyValues[r]=new ks(n);this.defaultTransitioningPropertyValues[r]=d.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=l.possiblyEvaluate({})}}}Re("DataDrivenProperty",We),Re("DataConstantProperty",je),Re("CrossFadedDataDrivenProperty",u),Re("CrossFadedProperty",t),Re("ColorRampProperty",s);const a="-transition";class h extends ys{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 gn(r.layout)),r.paint)){this._transitionablePaint=new Cs(r.paint);for(const n in e.paint)this.setPaintProperty(n,e.paint[n],{validate:!1});for(const n in e.layout)this.setLayoutProperty(n,e.layout[n],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new to(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,n={}){r!=null&&this._validate(sc,`layers.${this.id}.layout.${e}`,e,r,n)||(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,n={}){if(r!=null&&this._validate(rc,`layers.${this.id}.paint.${e}`,e,r,n))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 _=this._transitionablePaint._values[e].value;return _.isDataDriven()||p||d||this._handleOverridablePaintPropertyUpdate(e,f,_)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,n){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),Cr(e,(r,n)=>!(r===void 0||n==="layout"&&!Object.keys(r).length||n==="paint"&&!Object.keys(r).length))}_validate(e,r,n,l,d={}){return(!d||d.validate!==!1)&&aa(this,e.call(Ar,{key:r,layerType:this.type,objectKey:n,value:l,styleSpec:he,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 mr&&ss(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const g={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class y{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 w(i,e=1){let r=0,n=0;return{members:i.map(l=>{const d=g[l.type].BYTES_PER_ELEMENT,p=r=A(r,Math.max(e,d)),f=l.components||1;return n=Math.max(n,d),r+=d*f,{name:l.name,type:l.type,components:f,offset:p}}),size:A(r,Math.max(n,e)),alignment:e}}function A(i,e){return Math.ceil(i/e)*e}class I extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){const l=2*e;return this.int16[l+0]=r,this.int16[l+1]=n,e}}I.prototype.bytesPerElement=4,Re("StructArrayLayout2i4",I);class L extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,n)}emplace(e,r,n,l){const d=3*e;return this.int16[d+0]=r,this.int16[d+1]=n,this.int16[d+2]=l,e}}L.prototype.bytesPerElement=6,Re("StructArrayLayout3i6",L);class F extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,l){const d=this.length;return this.resize(d+1),this.emplace(d,e,r,n,l)}emplace(e,r,n,l,d){const p=4*e;return this.int16[p+0]=r,this.int16[p+1]=n,this.int16[p+2]=l,this.int16[p+3]=d,e}}F.prototype.bytesPerElement=8,Re("StructArrayLayout4i8",F);class $ extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,l,d,p){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,n,l,d,p)}emplace(e,r,n,l,d,p,f){const _=6*e;return this.int16[_+0]=r,this.int16[_+1]=n,this.int16[_+2]=l,this.int16[_+3]=d,this.int16[_+4]=p,this.int16[_+5]=f,e}}$.prototype.bytesPerElement=12,Re("StructArrayLayout2i4i12",$);class Z extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,l,d,p){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,n,l,d,p)}emplace(e,r,n,l,d,p,f){const _=4*e,x=8*e;return this.int16[_+0]=r,this.int16[_+1]=n,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,Re("StructArrayLayout2i4ub8",Z);class j extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){const l=2*e;return this.float32[l+0]=r,this.float32[l+1]=n,e}}j.prototype.bytesPerElement=8,Re("StructArrayLayout2f8",j);class H extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n,l,d,p,f,_,x,S){const E=this.length;return this.resize(E+1),this.emplace(E,e,r,n,l,d,p,f,_,x,S)}emplace(e,r,n,l,d,p,f,_,x,S,E){const k=10*e;return this.uint16[k+0]=r,this.uint16[k+1]=n,this.uint16[k+2]=l,this.uint16[k+3]=d,this.uint16[k+4]=p,this.uint16[k+5]=f,this.uint16[k+6]=_,this.uint16[k+7]=x,this.uint16[k+8]=S,this.uint16[k+9]=E,e}}H.prototype.bytesPerElement=20,Re("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,n,l,d,p,f,_,x,S,E,k){const D=this.length;return this.resize(D+1),this.emplace(D,e,r,n,l,d,p,f,_,x,S,E,k)}emplace(e,r,n,l,d,p,f,_,x,S,E,k,D){const R=12*e;return this.int16[R+0]=r,this.int16[R+1]=n,this.int16[R+2]=l,this.int16[R+3]=d,this.uint16[R+4]=p,this.uint16[R+5]=f,this.uint16[R+6]=_,this.uint16[R+7]=x,this.int16[R+8]=S,this.int16[R+9]=E,this.int16[R+10]=k,this.int16[R+11]=D,e}}K.prototype.bytesPerElement=24,Re("StructArrayLayout4i4ui4i24",K);class N extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,n)}emplace(e,r,n,l){const d=3*e;return this.float32[d+0]=r,this.float32[d+1]=n,this.float32[d+2]=l,e}}N.prototype.bytesPerElement=12,Re("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,Re("StructArrayLayout1ul4",ee);class se 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,n,l,d,p,f,_,x){const S=this.length;return this.resize(S+1),this.emplace(S,e,r,n,l,d,p,f,_,x)}emplace(e,r,n,l,d,p,f,_,x,S){const E=10*e,k=5*e;return this.int16[E+0]=r,this.int16[E+1]=n,this.int16[E+2]=l,this.int16[E+3]=d,this.int16[E+4]=p,this.int16[E+5]=f,this.uint32[k+3]=_,this.uint16[E+8]=x,this.uint16[E+9]=S,e}}se.prototype.bytesPerElement=20,Re("StructArrayLayout6i1ul2ui20",se);class le extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,l,d,p){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,n,l,d,p)}emplace(e,r,n,l,d,p,f){const _=6*e;return this.int16[_+0]=r,this.int16[_+1]=n,this.int16[_+2]=l,this.int16[_+3]=d,this.int16[_+4]=p,this.int16[_+5]=f,e}}le.prototype.bytesPerElement=12,Re("StructArrayLayout2i2i2i12",le);class me extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,l,d){const p=this.length;return this.resize(p+1),this.emplace(p,e,r,n,l,d)}emplace(e,r,n,l,d,p){const f=4*e,_=8*e;return this.float32[f+0]=r,this.float32[f+1]=n,this.float32[f+2]=l,this.int16[_+6]=d,this.int16[_+7]=p,e}}me.prototype.bytesPerElement=16,Re("StructArrayLayout2f1f2i16",me);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,n,l,d,p){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,n,l,d,p)}emplace(e,r,n,l,d,p,f){const _=16*e,x=4*e,S=8*e;return this.uint8[_+0]=r,this.uint8[_+1]=n,this.float32[x+1]=l,this.float32[x+2]=d,this.int16[S+6]=p,this.int16[S+7]=f,e}}ve.prototype.bytesPerElement=16,Re("StructArrayLayout2ub2f2i16",ve);class Me extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,n)}emplace(e,r,n,l){const d=3*e;return this.uint16[d+0]=r,this.uint16[d+1]=n,this.uint16[d+2]=l,e}}Me.prototype.bytesPerElement=6,Re("StructArrayLayout3ui6",Me);class De 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,n,l,d,p,f,_,x,S,E,k,D,R,O,U,W){const ne=this.length;return this.resize(ne+1),this.emplace(ne,e,r,n,l,d,p,f,_,x,S,E,k,D,R,O,U,W)}emplace(e,r,n,l,d,p,f,_,x,S,E,k,D,R,O,U,W,ne){const Y=24*e,ie=12*e,ue=48*e;return this.int16[Y+0]=r,this.int16[Y+1]=n,this.uint16[Y+2]=l,this.uint16[Y+3]=d,this.uint32[ie+2]=p,this.uint32[ie+3]=f,this.uint32[ie+4]=_,this.uint16[Y+10]=x,this.uint16[Y+11]=S,this.uint16[Y+12]=E,this.float32[ie+7]=k,this.float32[ie+8]=D,this.uint8[ue+36]=R,this.uint8[ue+37]=O,this.uint8[ue+38]=U,this.uint32[ie+10]=W,this.int16[Y+22]=ne,e}}De.prototype.bytesPerElement=48,Re("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",De);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,n,l,d,p,f,_,x,S,E,k,D,R,O,U,W,ne,Y,ie,ue,xe,ze,He,ke,Ie,Ne,Be){const Le=this.length;return this.resize(Le+1),this.emplace(Le,e,r,n,l,d,p,f,_,x,S,E,k,D,R,O,U,W,ne,Y,ie,ue,xe,ze,He,ke,Ie,Ne,Be)}emplace(e,r,n,l,d,p,f,_,x,S,E,k,D,R,O,U,W,ne,Y,ie,ue,xe,ze,He,ke,Ie,Ne,Be,Le){const pe=32*e,Ue=16*e;return this.int16[pe+0]=r,this.int16[pe+1]=n,this.int16[pe+2]=l,this.int16[pe+3]=d,this.int16[pe+4]=p,this.int16[pe+5]=f,this.int16[pe+6]=_,this.int16[pe+7]=x,this.uint16[pe+8]=S,this.uint16[pe+9]=E,this.uint16[pe+10]=k,this.uint16[pe+11]=D,this.uint16[pe+12]=R,this.uint16[pe+13]=O,this.uint16[pe+14]=U,this.uint16[pe+15]=W,this.uint16[pe+16]=ne,this.uint16[pe+17]=Y,this.uint16[pe+18]=ie,this.uint16[pe+19]=ue,this.uint16[pe+20]=xe,this.uint16[pe+21]=ze,this.uint16[pe+22]=He,this.uint32[Ue+12]=ke,this.float32[Ue+13]=Ie,this.float32[Ue+14]=Ne,this.uint16[pe+30]=Be,this.uint16[pe+31]=Le,e}}be.prototype.bytesPerElement=64,Re("StructArrayLayout8i15ui1ul2f2ui64",be);class we 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}}we.prototype.bytesPerElement=4,Re("StructArrayLayout1f4",we);class Oe extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,n)}emplace(e,r,n,l){const d=3*e;return this.uint16[6*e+0]=r,this.float32[d+1]=n,this.float32[d+2]=l,e}}Oe.prototype.bytesPerElement=12,Re("StructArrayLayout1ui2f12",Oe);class Qe extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,n)}emplace(e,r,n,l){const d=4*e;return this.uint32[2*e+0]=r,this.uint16[d+2]=n,this.uint16[d+3]=l,e}}Qe.prototype.bytesPerElement=8,Re("StructArrayLayout1ul2ui8",Qe);class Ee extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){const l=2*e;return this.uint16[l+0]=r,this.uint16[l+1]=n,e}}Ee.prototype.bytesPerElement=4,Re("StructArrayLayout2ui4",Ee);class Pe 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}}Pe.prototype.bytesPerElement=2,Re("StructArrayLayout1ui2",Pe);class Ke extends v{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,l){const d=this.length;return this.resize(d+1),this.emplace(d,e,r,n,l)}emplace(e,r,n,l,d){const p=4*e;return this.float32[p+0]=r,this.float32[p+1]=n,this.float32[p+2]=l,this.float32[p+3]=d,e}}Ke.prototype.bytesPerElement=16,Re("StructArrayLayout4f16",Ke);class Dt extends y{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 ae(this.anchorPointX,this.anchorPointY)}}Dt.prototype.size=20;class st extends se{get(e){return new Dt(this,e)}}Re("CollisionBoxArray",st);class ct extends y{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]}}ct.prototype.size=48;class Lt extends De{get(e){return new ct(this,e)}}Re("PlacedSymbolArray",Lt);class ci extends y{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]}}ci.prototype.size=64;class Ki extends be{get(e){return new ci(this,e)}}Re("SymbolInstanceArray",Ki);class Rt extends we{getoffsetX(e){return this.float32[1*e+0]}}Re("GlyphOffsetArray",Rt);class Ii 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]}}Re("SymbolLineVertexArray",Ii);class bi extends y{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]}}bi.prototype.size=12;class hi extends Oe{get(e){return new bi(this,e)}}Re("TextAnchorOffsetArray",hi);class ui extends y{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]}}ui.prototype.size=8;class Yi extends Qe{get(e){return new ui(this,e)}}Re("FeatureIndexArray",Yi);class cs extends I{}class io extends I{}class Ms extends I{}class hs extends ${}class ro extends Z{}class pa extends j{}class ii extends H{}class Qi extends K{}class Ur extends N{}class zs extends ee{}class di extends le{}class pi extends ve{}class Qt extends Me{}class Vt extends Ee{}const Ds=w([{name:"a_pos",components:2,type:"Int16"}],4),{members:fa}=Ds;class Kt{constructor(e=[]){this.segments=e}prepareSegment(e,r,n,l){let d=this.segments[this.segments.length-1];return e>Kt.MAX_VERTEX_ARRAY_LENGTH&&ni(`Max vertices per segment is ${Kt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!d||d.vertexLength+e>Kt.MAX_VERTEX_ARRAY_LENGTH||d.sortKey!==l)&&(d={vertexOffset:r.length,primitiveOffset:n.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,n,l){return new Kt([{vertexOffset:e,primitiveOffset:r,vertexLength:n,primitiveLength:l,vaos:{},sortKey:0}])}}function gl(i,e){return 256*(i=xt(Math.floor(i),0,255))+xt(Math.floor(e),0,255)}Kt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Re("SegmentVector",Kt);const so=w([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var no={exports:{}},qr={exports:{}};qr.exports=function(i,e){var r,n,l,d,p,f,_,x;for(n=i.length-(r=3&i.length),l=e,p=3432918353,f=461845907,x=0;x<n;)_=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^=_=(65535&(_=(_=(65535&_)*p+(((_>>>16)*p&65535)<<16)&4294967295)<<15|_>>>17))*f+(((_>>>16)*f&65535)<<16)&4294967295)<<13|l>>>19))+((5*(l>>>16)&65535)<<16)&4294967295))+((58964+(d>>>16)&65535)<<16);switch(_=0,r){case 3:_^=(255&i.charCodeAt(x+2))<<16;case 2:_^=(255&i.charCodeAt(x+1))<<8;case 1:l^=_=(65535&(_=(_=(65535&(_^=255&i.charCodeAt(x)))*p+(((_>>>16)*p&65535)<<16)&4294967295)<<15|_>>>17))*f+(((_>>>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 _l=qr.exports,ma={exports:{}};ma.exports=function(i,e){for(var r,n=i.length,l=e^n,d=0;n>=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)),n-=4,++d;switch(n){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 ga=_l,_a=ma.exports;no.exports=ga,no.exports.murmur3=ga,no.exports.murmur2=_a;var oo=fe(no.exports);class Ls{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,n,l){this.ids.push(Wc(e)),this.positions.push(r,n,l)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=Wc(e);let n=0,l=this.ids.length-1;for(;n<l;){const p=n+l>>1;this.ids[p]>=r?l=p:n=p+1}const d=[];for(;this.ids[n]===r;)d.push({index:this.positions[3*n],start:this.positions[3*n+1],end:this.positions[3*n+2]}),n++;return d}static serialize(e,r){const n=new Float64Array(e.ids),l=new Uint32Array(e.positions);return oc(n,l,0,n.length-1),r&&r.push(n.buffer,l.buffer),{ids:n,positions:l}}static deserialize(e){const r=new Ls;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function Wc(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:oo(String(i))}function oc(i,e,r,n){for(;r<n;){const l=i[r+n>>1];let d=r-1,p=n+1;for(;;){do d++;while(i[d]<l);do p--;while(i[p]>l);if(d>=p)break;yl(i,d,p),yl(e,3*d,3*p),yl(e,3*d+1,3*p+1),yl(e,3*d+2,3*p+2)}p-r<n-p?(oc(i,e,r,p),r=p+1):(oc(i,e,p+1,n),n=p)}}function yl(i,e,r){const n=i[e];i[e]=i[r],i[r]=n}Re("FeaturePositionMap",Ls);class _n{constructor(e,r){this.gl=e.gl,this.location=r}}class xl extends _n{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Xc extends _n{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 Jc extends _n{constructor(e,r){super(e,r),this.current=yt.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 Du=new Float32Array(16);function ac(i){return[gl(255*i.r,255*i.g),gl(255*i.b,255*i.a)]}class ya{constructor(e,r,n){this.value=e,this.uniformNames=r.map(l=>`u_${l}`),this.type=n}setUniform(e,r,n){e.set(n.constantOr(this.value))}getBinding(e,r,n){return this.type==="color"?new Jc(e,r):new xl(e,r)}}class ao{constructor(e,r){this.uniformNames=r.map(n=>`u_${n}`),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,n,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,n){return n.substr(0,9)==="u_pattern"?new Xc(e,r):new xl(e,r)}}class us{constructor(e,r,n,l){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=r.map(d=>({name:`a_${d}`,type:"Float32",components:n==="color"?2:1,offset:0})),this.paintVertexArray=new l}populatePaintArray(e,r,n,l,d){const p=this.paintVertexArray.length,f=this.expression.evaluate(new It(0),r,{},l,[],d);this.paintVertexArray.resize(e),this._setPaintValue(p,e,f)}updatePaintArray(e,r,n,l){const d=this.expression.evaluate({zoom:0},n,l);this._setPaintValue(e,r,d)}_setPaintValue(e,r,n){if(this.type==="color"){const l=ac(n);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,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}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 Ir{constructor(e,r,n,l,d,p){this.expression=e,this.uniformNames=r.map(f=>`u_${f}_t`),this.type=n,this.useIntegerZoom=l,this.zoom=d,this.maxValue=0,this.paintVertexAttributes=r.map(f=>({name:`a_${f}`,type:"Float32",components:n==="color"?4:2,offset:0})),this.paintVertexArray=new p}populatePaintArray(e,r,n,l,d){const p=this.expression.evaluate(new It(this.zoom),r,{},l,[],d),f=this.expression.evaluate(new It(this.zoom+1),r,{},l,[],d),_=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(_,e,p,f)}updatePaintArray(e,r,n,l){const d=this.expression.evaluate({zoom:this.zoom},n,l),p=this.expression.evaluate({zoom:this.zoom+1},n,l);this._setPaintValue(e,r,d,p)}_setPaintValue(e,r,n,l){if(this.type==="color"){const d=ac(n),p=ac(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,n,l);this.maxValue=Math.max(this.maxValue,Math.abs(n),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 n=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,l=xt(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);e.set(l)}getBinding(e,r,n){return new xl(e,r)}}class Rs{constructor(e,r,n,l,d,p){this.expression=e,this.type=r,this.useIntegerZoom=n,this.zoom=l,this.layerId=p,this.zoomInPaintVertexArray=new d,this.zoomOutPaintVertexArray=new d}populatePaintArray(e,r,n){const l=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(l,e,r.patterns&&r.patterns[this.layerId],n)}updatePaintArray(e,r,n,l,d){this._setPaintValues(e,r,n.patterns&&n.patterns[this.layerId],d)}_setPaintValues(e,r,n,l){if(!l||!n)return;const{min:d,mid:p,max:f}=n,_=l[d],x=l[p],S=l[f];if(_&&x&&S)for(let E=e;E<r;E++)this.zoomInPaintVertexArray.emplace(E,x.tl[0],x.tl[1],x.br[0],x.br[1],_.tl[0],_.tl[1],_.br[0],_.br[1],x.pixelRatio,_.pixelRatio),this.zoomOutPaintVertexArray.emplace(E,x.tl[0],x.tl[1],x.br[0],x.br[1],S.tl[0],S.tl[1],S.br[0],S.br[1],x.pixelRatio,S.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,so.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,so.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Kc{constructor(e,r,n){this.binders={},this._buffers=[];const l=[];for(const d in e.paint._values){if(!n(d))continue;const p=e.paint.get(d);if(!(p instanceof mr&&ss(p.property.specification)))continue;const f=Lu(d,e.type),_=p.value,x=p.property.specification.type,S=p.property.useIntegerZoom,E=p.property.specification["property-type"],k=E==="cross-faded"||E==="cross-faded-data-driven";if(_.kind==="constant")this.binders[d]=k?new ao(_.value,f):new ya(_.value,f,x),l.push(`/u_${d}`);else if(_.kind==="source"||k){const D=Yc(d,x,"source");this.binders[d]=k?new Rs(_,x,S,r,D,e.id):new us(_,f,x,D),l.push(`/a_${d}`)}else{const D=Yc(d,x,"composite");this.binders[d]=new Ir(_,f,x,S,r,D),l.push(`/z_${d}`)}}this.cacheKey=l.sort().join("")}getMaxValue(e){const r=this.binders[e];return r instanceof us||r instanceof Ir?r.maxValue:0}populatePaintArrays(e,r,n,l,d){for(const p in this.binders){const f=this.binders[p];(f instanceof us||f instanceof Ir||f instanceof Rs)&&f.populatePaintArray(e,r,n,l,d)}}setConstantPatternPositions(e,r){for(const n in this.binders){const l=this.binders[n];l instanceof ao&&l.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,n,l,d){let p=!1;for(const f in e){const _=r.getPositions(f);for(const x of _){const S=n.feature(x.index);for(const E in this.binders){const k=this.binders[E];if((k instanceof us||k instanceof Ir||k instanceof Rs)&&k.expression.isStateDependent===!0){const D=l.paint.get(E);k.expression=D.value,k.updatePaintArray(x.start,x.end,S,e[f],d),p=!0}}}}return p}defines(){const e=[];for(const r in this.binders){const n=this.binders[r];(n instanceof ya||n instanceof ao)&&e.push(...n.uniformNames.map(l=>`#define HAS_UNIFORM_${l}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const n=this.binders[r];if(n instanceof us||n instanceof Ir)for(let l=0;l<n.paintVertexAttributes.length;l++)e.push(n.paintVertexAttributes[l].name);else if(n instanceof Rs)for(let l=0;l<so.members.length;l++)e.push(so.members[l].name)}return e}getBinderUniforms(){const e=[];for(const r in this.binders){const n=this.binders[r];if(n instanceof ya||n instanceof ao||n instanceof Ir)for(const l of n.uniformNames)e.push(l)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,r){const n=[];for(const l in this.binders){const d=this.binders[l];if(d instanceof ya||d instanceof ao||d instanceof Ir){for(const p of d.uniformNames)if(r[p]){const f=d.getBinding(e,r[p],p);n.push({name:p,property:l,binding:f})}}}return n}setUniforms(e,r,n,l){for(const{name:d,property:p,binding:f}of r)this.binders[p].setUniform(f,l,n.get(p),d)}updatePaintBuffers(e){this._buffers=[];for(const r in this.binders){const n=this.binders[r];if(e&&n instanceof Rs){const l=e.fromScale===2?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;l&&this._buffers.push(l)}else(n instanceof us||n instanceof Ir)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer)}}upload(e){for(const r in this.binders){const n=this.binders[r];(n instanceof us||n instanceof Ir||n instanceof Rs)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const r=this.binders[e];(r instanceof us||r instanceof Ir||r instanceof Rs)&&r.destroy()}}}class yn{constructor(e,r,n=()=>!0){this.programConfigurations={};for(const l of e)this.programConfigurations[l.id]=new Kc(l,r,n);this.needsUpload=!1,this._featureMap=new Ls,this._bufferOffset=0}populatePaintArrays(e,r,n,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,n,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,n,l){for(const d of n)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 Lu(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 Yc(i,e,r){const n={color:{source:j,composite:Ke},number:{source:we,composite:j}},l=function(d){return{"line-pattern":{source:ii,composite:ii},"fill-pattern":{source:ii,composite:ii},"fill-extrusion-pattern":{source:ii,composite:ii}}[d]}(i);return l&&l[r]||n[e][r]}Re("ConstantBinder",ya),Re("CrossFadedConstantBinder",ao),Re("SourceExpressionBinder",us),Re("CrossFadedCompositeBinder",Rs),Re("CompositeExpressionBinder",Ir),Re("ProgramConfiguration",Kc,{omit:["_buffers"]}),Re("ProgramConfigurationSet",yn);const Xt=8192,lc=Math.pow(2,14)-1,Qc=-lc-1;function xn(i){const e=Xt/i.extent,r=i.loadGeometry();for(let n=0;n<r.length;n++){const l=r[n];for(let d=0;d<l.length;d++){const p=l[d],f=Math.round(p.x*e),_=Math.round(p.y*e);p.x=xt(f,Qc,lc),p.y=xt(_,Qc,lc),(f<p.x||f>p.x+1||_<p.y||_>p.y+1)&&ni("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function vn(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?xn(i):[]}}function vl(i,e,r,n,l){i.emplaceBack(2*e+(n+1)/2,2*r+(l+1)/2)}class cc{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 io,this.indexArray=new Qt,this.segments=new Kt,this.programConfigurations=new yn(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){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:_,id:x,index:S,sourceLayerIndex:E}of e){const k=this.layers[0]._featureFilter.needGeometry,D=vn(_,k);if(!this.layers[0]._featureFilter.filter(new It(this.zoom),D,n))continue;const R=f?p.evaluate(D,{},n):void 0,O={id:x,properties:_.properties,type:_.type,sourceLayerIndex:E,index:S,geometry:k?D.geometry:xn(_),patterns:{},sortKey:R};d.push(O)}f&&d.sort((_,x)=>_.sortKey-x.sortKey);for(const _ of d){const{geometry:x,index:S,sourceLayerIndex:E}=_,k=e[S].feature;this.addFeature(_,x,S,n),r.featureIndex.insert(k,x,S,E,this.index)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,fa),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,n,l){for(const d of r)for(const p of d){const f=p.x,_=p.y;if(f<0||f>=Xt||_<0||_>=Xt)continue;const x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),S=x.vertexLength;vl(this.layoutVertexArray,f,_,-1,-1),vl(this.layoutVertexArray,f,_,1,-1),vl(this.layoutVertexArray,f,_,1,1),vl(this.layoutVertexArray,f,_,-1,1),this.indexArray.emplaceBack(S,S+1,S+2),this.indexArray.emplaceBack(S,S+3,S+2),x.vertexLength+=4,x.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},l)}}function eh(i,e){for(let r=0;r<i.length;r++)if(lo(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(lo(i,e[r]))return!0;return!!hc(i,e)}function Ru(i,e,r){return!!lo(i,e)||!!uc(e,i,r)}function th(i,e){if(i.length===1)return rh(e,i[0]);for(let r=0;r<e.length;r++){const n=e[r];for(let l=0;l<n.length;l++)if(lo(i,n[l]))return!0}for(let r=0;r<i.length;r++)if(rh(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(hc(i,e[r]))return!0;return!1}function Bu(i,e,r){if(i.length>1){if(hc(i,e))return!0;for(let n=0;n<e.length;n++)if(uc(e[n],i,r))return!0}for(let n=0;n<i.length;n++)if(uc(i[n],e,r))return!0;return!1}function hc(i,e){if(i.length===0||e.length===0)return!1;for(let r=0;r<i.length-1;r++){const n=i[r],l=i[r+1];for(let d=0;d<e.length-1;d++)if(Fu(n,l,e[d],e[d+1]))return!0}return!1}function Fu(i,e,r,n){return yi(i,r,n)!==yi(e,r,n)&&yi(i,e,r)!==yi(i,e,n)}function uc(i,e,r){const n=r*r;if(e.length===1)return i.distSqr(e[0])<n;for(let l=1;l<e.length;l++)if(ih(i,e[l-1],e[l])<n)return!0;return!1}function ih(i,e,r){const n=e.distSqr(r);if(n===0)return i.distSqr(e);const l=((i.x-e.x)*(r.x-e.x)+(i.y-e.y)*(r.y-e.y))/n;return i.distSqr(l<0?e:l>1?r:r.sub(e)._mult(l)._add(e))}function rh(i,e){let r,n,l,d=!1;for(let p=0;p<i.length;p++){r=i[p];for(let f=0,_=r.length-1;f<r.length;_=f++)n=r[f],l=r[_],n.y>e.y!=l.y>e.y&&e.x<(l.x-n.x)*(e.y-n.y)/(l.y-n.y)+n.x&&(d=!d)}return d}function lo(i,e){let r=!1;for(let n=0,l=i.length-1;n<i.length;l=n++){const d=i[n],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 Ou(i,e,r){const n=r[0],l=r[2];if(i.x<n.x&&e.x<n.x||i.x>l.x&&e.x>l.x||i.y<n.y&&e.y<n.y||i.y>l.y&&e.y>l.y)return!1;const d=yi(i,e,r[0]);return d!==yi(i,e,r[1])||d!==yi(i,e,r[2])||d!==yi(i,e,r[3])}function xa(i,e,r){const n=e.paint.get(i).value;return n.kind==="constant"?n.value:r.programConfigurations.get(e.id).getMaxValue(i)}function bl(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function wl(i,e,r,n,l){if(!e[0]&&!e[1])return i;const d=ae.convert(e)._mult(l);r==="viewport"&&d._rotate(-n);const p=[];for(let f=0;f<i.length;f++)p.push(i[f].sub(d));return p}let sh,nh;Re("CircleBucket",cc,{omit:["layers"]});var Vu={get paint(){return nh=nh||new o({"circle-radius":new We(he.paint_circle["circle-radius"]),"circle-color":new We(he.paint_circle["circle-color"]),"circle-blur":new We(he.paint_circle["circle-blur"]),"circle-opacity":new We(he.paint_circle["circle-opacity"]),"circle-translate":new je(he.paint_circle["circle-translate"]),"circle-translate-anchor":new je(he.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new je(he.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new je(he.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new We(he.paint_circle["circle-stroke-width"]),"circle-stroke-color":new We(he.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new We(he.paint_circle["circle-stroke-opacity"])})},get layout(){return sh=sh||new o({"circle-sort-key":new We(he.layout_circle["circle-sort-key"])})}},Pi=1e-6,co=typeof Float32Array<"u"?Float32Array:Array;function dc(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 oh(i,e,r){var n=e[0],l=e[1],d=e[2],p=e[3],f=e[4],_=e[5],x=e[6],S=e[7],E=e[8],k=e[9],D=e[10],R=e[11],O=e[12],U=e[13],W=e[14],ne=e[15],Y=r[0],ie=r[1],ue=r[2],xe=r[3];return i[0]=Y*n+ie*f+ue*E+xe*O,i[1]=Y*l+ie*_+ue*k+xe*U,i[2]=Y*d+ie*x+ue*D+xe*W,i[3]=Y*p+ie*S+ue*R+xe*ne,i[4]=(Y=r[4])*n+(ie=r[5])*f+(ue=r[6])*E+(xe=r[7])*O,i[5]=Y*l+ie*_+ue*k+xe*U,i[6]=Y*d+ie*x+ue*D+xe*W,i[7]=Y*p+ie*S+ue*R+xe*ne,i[8]=(Y=r[8])*n+(ie=r[9])*f+(ue=r[10])*E+(xe=r[11])*O,i[9]=Y*l+ie*_+ue*k+xe*U,i[10]=Y*d+ie*x+ue*D+xe*W,i[11]=Y*p+ie*S+ue*R+xe*ne,i[12]=(Y=r[12])*n+(ie=r[13])*f+(ue=r[14])*E+(xe=r[15])*O,i[13]=Y*l+ie*_+ue*k+xe*U,i[14]=Y*d+ie*x+ue*D+xe*W,i[15]=Y*p+ie*S+ue*R+xe*ne,i}Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});var va,$u=oh;function Sl(i,e,r){var n=e[0],l=e[1],d=e[2],p=e[3];return i[0]=r[0]*n+r[4]*l+r[8]*d+r[12]*p,i[1]=r[1]*n+r[5]*l+r[9]*d+r[13]*p,i[2]=r[2]*n+r[6]*l+r[10]*d+r[14]*p,i[3]=r[3]*n+r[7]*l+r[11]*d+r[15]*p,i}va=new co(4),co!=Float32Array&&(va[0]=0,va[1]=0,va[2]=0,va[3]=0);class Nu extends h{constructor(e){super(e,Vu)}createBucket(e){return new cc(e)}queryRadius(e){const r=e;return xa("circle-radius",this,r)+xa("circle-stroke-width",this,r)+bl(this.paint.get("circle-translate"))}queryIntersectsFeature(e,r,n,l,d,p,f,_){const x=wl(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),p.angle,f),S=this.paint.get("circle-radius").evaluate(r,n)+this.paint.get("circle-stroke-width").evaluate(r,n),E=this.paint.get("circle-pitch-alignment")==="map",k=E?x:function(R,O){return R.map(U=>ah(U,O))}(x,_),D=E?S*f:S;for(const R of l)for(const O of R){const U=E?O:ah(O,_);let W=D;const ne=Sl([],[O.x,O.y,0,1],_);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?W*=ne[3]/p.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(W*=p.cameraToCenterDistance/ne[3]),Ru(k,U,W))return!0}return!1}}function ah(i,e){const r=Sl([],[i.x,i.y,0,1],e);return new ae(r[0]/r[3],r[1]/r[3])}class lh extends cc{}let ch;Re("HeatmapBucket",lh,{omit:["layers"]});var ju={get paint(){return ch=ch||new o({"heatmap-radius":new We(he.paint_heatmap["heatmap-radius"]),"heatmap-weight":new We(he.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new je(he.paint_heatmap["heatmap-intensity"]),"heatmap-color":new s(he.paint_heatmap["heatmap-color"]),"heatmap-opacity":new je(he.paint_heatmap["heatmap-opacity"])})}};function pc(i,{width:e,height:r},n,l){if(l){if(l instanceof Uint8ClampedArray)l=new Uint8Array(l.buffer);else if(l.length!==e*r*n)throw new RangeError(`mismatched image size. expected: ${l.length} but got: ${e*r*n}`)}else l=new Uint8Array(e*r*n);return i.width=e,i.height=r,i.data=l,i}function hh(i,{width:e,height:r},n){if(e===i.width&&r===i.height)return;const l=pc({},{width:e,height:r},n);fc(i,l,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,e),height:Math.min(i.height,r)},n),i.width=e,i.height=r,i.data=l.data}function fc(i,e,r,n,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||n.x>e.width-l.width||n.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 _=0;_<l.height;_++){const x=((r.y+_)*i.width+r.x)*d,S=((n.y+_)*e.width+n.x)*d;for(let E=0;E<l.width*d;E++)f[S+E]=p[x+E]}return e}class ba{constructor(e,r){pc(this,e,1,r)}resize(e){hh(this,e,1)}clone(){return new ba({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,n,l,d){fc(e,r,n,l,d,1)}}class er{constructor(e,r){pc(this,e,4,r)}resize(e){hh(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new er({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,n,l,d){fc(e,r,n,l,d,4)}}function uh(i){const e={},r=i.resolution||256,n=i.clips?i.clips.length:1,l=i.image||new er({width:r,height:n});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const d=(p,f,_)=>{e[i.evaluationKey]=_;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<n;++p,f+=4*r)for(let _=0,x=0;_<r;_++,x+=4){const S=_/(r-1),{start:E,end:k}=i.clips[p];d(f,x,E*(1-S)+k*S)}else for(let p=0,f=0;p<r;p++,f+=4)d(0,f,p/(r-1));return l}Re("AlphaImage",ba),Re("RGBAImage",er);class Uu extends h{createBucket(e){return new lh(e)}constructor(e){super(e,ju),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=uh({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 dh;var qu={get paint(){return dh=dh||new o({"hillshade-illumination-direction":new je(he.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new je(he.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new je(he.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new je(he.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new je(he.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new je(he.paint_hillshade["hillshade-accent-color"])})}};class Zu extends h{constructor(e){super(e,qu)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const Gu=w([{name:"a_pos",components:2,type:"Int16"}],4),{members:Hu}=Gu;function ph(i,e,r=2){const n=e&&e.length,l=n?e[0]*r:i.length;let d=fh(i,0,l,r,!0);const p=[];if(!d||d.next===d.prev)return p;let f,_,x;if(n&&(d=function(S,E,k,D){const R=[];for(let O=0,U=E.length;O<U;O++){const W=fh(S,E[O]*D,O<U-1?E[O+1]*D:S.length,D,!1);W===W.next&&(W.steiner=!0),R.push(td(W))}R.sort(Yu);for(let O=0;O<R.length;O++)k=Qu(R[O],k);return k}(i,e,d,r)),i.length>80*r){f=1/0,_=1/0;let S=-1/0,E=-1/0;for(let k=r;k<l;k+=r){const D=i[k],R=i[k+1];D<f&&(f=D),R<_&&(_=R),D>S&&(S=D),R>E&&(E=R)}x=Math.max(S-f,E-_),x=x!==0?32767/x:0}return wa(d,p,r,f,_,x,0),p}function fh(i,e,r,n,l){let d;if(l===function(p,f,_,x){let S=0;for(let E=f,k=_-x;E<_;E+=x)S+=(p[k]-p[E])*(p[E+1]+p[k+1]),k=E;return S}(i,e,r,n)>0)for(let p=e;p<r;p+=n)d=_h(p/n|0,i[p],i[p+1],d);else for(let p=r-n;p>=e;p-=n)d=_h(p/n|0,i[p],i[p+1],d);return d&&Tl(d,d.next)&&(Ta(d),d=d.next),d}function bn(i,e){if(!i)return i;e||(e=i);let r,n=i;do if(r=!1,n.steiner||!Tl(n,n.next)&&Gt(n.prev,n,n.next)!==0)n=n.next;else{if(Ta(n),n=e=n.prev,n===n.next)break;r=!0}while(r||n!==e);return e}function wa(i,e,r,n,l,d,p){if(!i)return;!p&&d&&function(_,x,S,E){let k=_;do k.z===0&&(k.z=mc(k.x,k.y,x,S,E)),k.prevZ=k.prev,k.nextZ=k.next,k=k.next;while(k!==_);k.prevZ.nextZ=null,k.prevZ=null,function(D){let R,O=1;do{let U,W=D;D=null;let ne=null;for(R=0;W;){R++;let Y=W,ie=0;for(let xe=0;xe<O&&(ie++,Y=Y.nextZ,Y);xe++);let ue=O;for(;ie>0||ue>0&&Y;)ie!==0&&(ue===0||!Y||W.z<=Y.z)?(U=W,W=W.nextZ,ie--):(U=Y,Y=Y.nextZ,ue--),ne?ne.nextZ=U:D=U,U.prevZ=ne,ne=U;W=Y}ne.nextZ=null,O*=2}while(R>1)}(k)}(i,n,l,d);let f=i;for(;i.prev!==i.next;){const _=i.prev,x=i.next;if(d?Xu(i,n,l,d):Wu(i))e.push(_.i,i.i,x.i),Ta(i),i=x.next,f=x.next;else if((i=x)===f){p?p===1?wa(i=Ju(bn(i),e),e,r,n,l,d,2):p===2&&Ku(i,e,r,n,l,d):wa(bn(i),e,r,n,l,d,1);break}}}function Wu(i){const e=i.prev,r=i,n=i.next;if(Gt(e,r,n)>=0)return!1;const l=e.x,d=r.x,p=n.x,f=e.y,_=r.y,x=n.y,S=l<d?l<p?l:p:d<p?d:p,E=f<_?f<x?f:x:_<x?_:x,k=l>d?l>p?l:p:d>p?d:p,D=f>_?f>x?f:x:_>x?_:x;let R=n.next;for(;R!==e;){if(R.x>=S&&R.x<=k&&R.y>=E&&R.y<=D&&ho(l,f,d,_,p,x,R.x,R.y)&&Gt(R.prev,R,R.next)>=0)return!1;R=R.next}return!0}function Xu(i,e,r,n){const l=i.prev,d=i,p=i.next;if(Gt(l,d,p)>=0)return!1;const f=l.x,_=d.x,x=p.x,S=l.y,E=d.y,k=p.y,D=f<_?f<x?f:x:_<x?_:x,R=S<E?S<k?S:k:E<k?E:k,O=f>_?f>x?f:x:_>x?_:x,U=S>E?S>k?S:k:E>k?E:k,W=mc(D,R,e,r,n),ne=mc(O,U,e,r,n);let Y=i.prevZ,ie=i.nextZ;for(;Y&&Y.z>=W&&ie&&ie.z<=ne;){if(Y.x>=D&&Y.x<=O&&Y.y>=R&&Y.y<=U&&Y!==l&&Y!==p&&ho(f,S,_,E,x,k,Y.x,Y.y)&&Gt(Y.prev,Y,Y.next)>=0||(Y=Y.prevZ,ie.x>=D&&ie.x<=O&&ie.y>=R&&ie.y<=U&&ie!==l&&ie!==p&&ho(f,S,_,E,x,k,ie.x,ie.y)&&Gt(ie.prev,ie,ie.next)>=0))return!1;ie=ie.nextZ}for(;Y&&Y.z>=W;){if(Y.x>=D&&Y.x<=O&&Y.y>=R&&Y.y<=U&&Y!==l&&Y!==p&&ho(f,S,_,E,x,k,Y.x,Y.y)&&Gt(Y.prev,Y,Y.next)>=0)return!1;Y=Y.prevZ}for(;ie&&ie.z<=ne;){if(ie.x>=D&&ie.x<=O&&ie.y>=R&&ie.y<=U&&ie!==l&&ie!==p&&ho(f,S,_,E,x,k,ie.x,ie.y)&&Gt(ie.prev,ie,ie.next)>=0)return!1;ie=ie.nextZ}return!0}function Ju(i,e){let r=i;do{const n=r.prev,l=r.next.next;!Tl(n,l)&&mh(n,r,r.next,l)&&Sa(n,l)&&Sa(l,n)&&(e.push(n.i,r.i,l.i),Ta(r),Ta(r.next),r=i=l),r=r.next}while(r!==i);return bn(r)}function Ku(i,e,r,n,l,d){let p=i;do{let f=p.next.next;for(;f!==p.prev;){if(p.i!==f.i&&rd(p,f)){let _=gh(p,f);return p=bn(p,p.next),_=bn(_,_.next),wa(p,e,r,n,l,d,0),void wa(_,e,r,n,l,d,0)}f=f.next}p=p.next}while(p!==i)}function Yu(i,e){return i.x-e.x}function Qu(i,e){const r=function(l,d){let p=d;const f=l.x,_=l.y;let x,S=-1/0;do{if(_<=p.y&&_>=p.next.y&&p.next.y!==p.y){const O=p.x+(_-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(O<=f&&O>S&&(S=O,x=p.x<p.next.x?p:p.next,O===f))return x}p=p.next}while(p!==d);if(!x)return null;const E=x,k=x.x,D=x.y;let R=1/0;p=x;do{if(f>=p.x&&p.x>=k&&f!==p.x&&ho(_<D?f:S,_,k,D,_<D?S:f,_,p.x,p.y)){const O=Math.abs(_-p.y)/(f-p.x);Sa(p,l)&&(O<R||O===R&&(p.x>x.x||p.x===x.x&&ed(x,p)))&&(x=p,R=O)}p=p.next}while(p!==E);return x}(i,e);if(!r)return e;const n=gh(r,i);return bn(n,n.next),bn(r,r.next)}function ed(i,e){return Gt(i.prev,i,e.prev)<0&&Gt(e.next,i,i.next)<0}function mc(i,e,r,n,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-n)*l|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function td(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 ho(i,e,r,n,l,d,p,f){return(l-p)*(e-f)>=(i-p)*(d-f)&&(i-p)*(n-f)>=(r-p)*(e-f)&&(r-p)*(d-f)>=(l-p)*(n-f)}function rd(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,n){let l=r;do{if(l.i!==r.i&&l.next.i!==r.i&&l.i!==n.i&&l.next.i!==n.i&&mh(l,l.next,r,n))return!0;l=l.next}while(l!==r);return!1}(i,e)&&(Sa(i,e)&&Sa(e,i)&&function(r,n){let l=r,d=!1;const p=(r.x+n.x)/2,f=(r.y+n.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)&&(Gt(i.prev,i,e.prev)||Gt(i,e.prev,e))||Tl(i,e)&&Gt(i.prev,i,i.next)>0&&Gt(e.prev,e,e.next)>0)}function Gt(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function Tl(i,e){return i.x===e.x&&i.y===e.y}function mh(i,e,r,n){const l=Al(Gt(i,e,r)),d=Al(Gt(i,e,n)),p=Al(Gt(r,n,i)),f=Al(Gt(r,n,e));return l!==d&&p!==f||!(l!==0||!El(i,r,e))||!(d!==0||!El(i,n,e))||!(p!==0||!El(r,i,n))||!(f!==0||!El(r,e,n))}function El(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 Al(i){return i>0?1:i<0?-1:0}function Sa(i,e){return Gt(i.prev,i,i.next)<0?Gt(i,e,i.next)>=0&&Gt(i,i.prev,e)>=0:Gt(i,e,i.prev)<0||Gt(i,i.next,e)<0}function gh(i,e){const r=gc(i.i,i.x,i.y),n=gc(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,n.next=r,r.prev=n,d.next=n,n.prev=d,n}function _h(i,e,r,n){const l=gc(i,e,r);return n?(l.next=n.next,l.prev=n,n.next.prev=l,n.next=l):(l.prev=l,l.next=l),l}function Ta(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 gc(i,e,r){return{i,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function _c(i,e,r){const n=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,n[f.to]=!0,n[f.from]=!0)}return l}function yc(i,e,r,n,l){const d=l.patternDependencies;for(const p of e){const f=p.paint.get(`${i}-pattern`).value;if(f.kind!=="constant"){let _=f.evaluate({zoom:n-1},r,{},l.availableImages),x=f.evaluate({zoom:n},r,{},l.availableImages),S=f.evaluate({zoom:n+1},r,{},l.availableImages);_=_&&_.name?_.name:_,x=x&&x.name?x.name:x,S=S&&S.name?S.name:S,d[_]=!0,d[x]=!0,d[S]=!0,r.patterns[p.id]={min:_,mid:x,max:S}}}return r}class xc{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 Ms,this.indexArray=new Qt,this.indexArray2=new Vt,this.programConfigurations=new yn(e.layers,e.zoom),this.segments=new Kt,this.segments2=new Kt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.hasPattern=_c("fill",this.layers,r);const l=this.layers[0].layout.get("fill-sort-key"),d=!l.isConstant(),p=[];for(const{feature:f,id:_,index:x,sourceLayerIndex:S}of e){const E=this.layers[0]._featureFilter.needGeometry,k=vn(f,E);if(!this.layers[0]._featureFilter.filter(new It(this.zoom),k,n))continue;const D=d?l.evaluate(k,{},n,r.availableImages):void 0,R={id:_,properties:f.properties,type:f.type,sourceLayerIndex:S,index:x,geometry:E?k.geometry:xn(f),patterns:{},sortKey:D};p.push(R)}d&&p.sort((f,_)=>f.sortKey-_.sortKey);for(const f of p){const{geometry:_,index:x,sourceLayerIndex:S}=f;if(this.hasPattern){const E=yc("fill",this.layers,f,this.zoom,r);this.patternFeatures.push(E)}else this.addFeature(f,_,x,n,{});r.featureIndex.insert(e[x].feature,_,x,S,this.index)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}addFeatures(e,r,n){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Hu),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,n,l,d){for(const p of Fn(r,500)){let f=0;for(const D of p)f+=D.length;const _=this.segments.prepareSegment(f,this.layoutVertexArray,this.indexArray),x=_.vertexLength,S=[],E=[];for(const D of p){if(D.length===0)continue;D!==p[0]&&E.push(S.length/2);const R=this.segments2.prepareSegment(D.length,this.layoutVertexArray,this.indexArray2),O=R.vertexLength;this.layoutVertexArray.emplaceBack(D[0].x,D[0].y),this.indexArray2.emplaceBack(O+D.length-1,O),S.push(D[0].x),S.push(D[0].y);for(let U=1;U<D.length;U++)this.layoutVertexArray.emplaceBack(D[U].x,D[U].y),this.indexArray2.emplaceBack(O+U-1,O+U),S.push(D[U].x),S.push(D[U].y);R.vertexLength+=D.length,R.primitiveLength+=D.length}const k=ph(S,E);for(let D=0;D<k.length;D+=3)this.indexArray.emplaceBack(x+k[D],x+k[D+1],x+k[D+2]);_.vertexLength+=f,_.primitiveLength+=k.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,d,l)}}let yh,xh;Re("FillBucket",xc,{omit:["layers","patternFeatures"]});var sd={get paint(){return xh=xh||new o({"fill-antialias":new je(he.paint_fill["fill-antialias"]),"fill-opacity":new We(he.paint_fill["fill-opacity"]),"fill-color":new We(he.paint_fill["fill-color"]),"fill-outline-color":new We(he.paint_fill["fill-outline-color"]),"fill-translate":new je(he.paint_fill["fill-translate"]),"fill-translate-anchor":new je(he.paint_fill["fill-translate-anchor"]),"fill-pattern":new u(he.paint_fill["fill-pattern"])})},get layout(){return yh=yh||new o({"fill-sort-key":new We(he.layout_fill["fill-sort-key"])})}};class nd extends h{constructor(e){super(e,sd)}recalculate(e,r){super.recalculate(e,r);const n=this.paint._values["fill-outline-color"];n.value.kind==="constant"&&n.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new xc(e)}queryRadius(){return bl(this.paint.get("fill-translate"))}queryIntersectsFeature(e,r,n,l,d,p,f){return th(wl(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),p.angle,f),l)}isTileClipped(){return!0}}const od=w([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),ad=w([{name:"a_centroid",components:2,type:"Int16"}],4),{members:ld}=od;var Bs={},cd=_e,vh=uo;function uo(i,e,r,n,l){this.properties={},this.extent=r,this.type=0,this._pbf=i,this._geometry=-1,this._keys=n,this._values=l,i.readFields(hd,this,e)}function hd(i,e,r){i==1?e.id=r.readVarint():i==2?function(n,l){for(var d=n.readVarint()+n.pos;n.pos<d;){var p=l._keys[n.readVarint()],f=l._values[n.readVarint()];l.properties[p]=f}}(r,e):i==3?e.type=r.readVarint():i==4&&(e._geometry=r.pos)}function ud(i){for(var e,r,n=0,l=0,d=i.length,p=d-1;l<d;p=l++)n+=((r=i[p]).x-(e=i[l]).x)*(e.y+r.y);return n}uo.types=["Unknown","Point","LineString","Polygon"],uo.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var e,r=i.readVarint()+i.pos,n=1,l=0,d=0,p=0,f=[];i.pos<r;){if(l<=0){var _=i.readVarint();n=7&_,l=_>>3}if(l--,n===1||n===2)d+=i.readSVarint(),p+=i.readSVarint(),n===1&&(e&&f.push(e),e=[]),e.push(new cd(d,p));else{if(n!==7)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&f.push(e),f},uo.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,n=0,l=0,d=0,p=1/0,f=-1/0,_=1/0,x=-1/0;i.pos<e;){if(n<=0){var S=i.readVarint();r=7&S,n=S>>3}if(n--,r===1||r===2)(l+=i.readSVarint())<p&&(p=l),l>f&&(f=l),(d+=i.readSVarint())<_&&(_=d),d>x&&(x=d);else if(r!==7)throw new Error("unknown command "+r)}return[p,_,f,x]},uo.prototype.toGeoJSON=function(i,e,r){var n,l,d=this.extent*Math.pow(2,r),p=this.extent*i,f=this.extent*e,_=this.loadGeometry(),x=uo.types[this.type];function S(D){for(var R=0;R<D.length;R++){var O=D[R];D[R]=[360*(O.x+p)/d-180,360/Math.PI*Math.atan(Math.exp((180-360*(O.y+f)/d)*Math.PI/180))-90]}}switch(this.type){case 1:var E=[];for(n=0;n<_.length;n++)E[n]=_[n][0];S(_=E);break;case 2:for(n=0;n<_.length;n++)S(_[n]);break;case 3:for(_=function(D){var R=D.length;if(R<=1)return[D];for(var O,U,W=[],ne=0;ne<R;ne++){var Y=ud(D[ne]);Y!==0&&(U===void 0&&(U=Y<0),U===Y<0?(O&&W.push(O),O=[D[ne]]):O.push(D[ne]))}return O&&W.push(O),W}(_),n=0;n<_.length;n++)for(l=0;l<_[n].length;l++)S(_[n][l])}_.length===1?_=_[0]:x="Multi"+x;var k={type:"Feature",geometry:{type:x,coordinates:_},properties:this.properties};return"id"in this&&(k.id=this.id),k};var dd=vh,bh=wh;function wh(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(pd,this,e),this.length=this._features.length}function pd(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(n){for(var l=null,d=n.readVarint()+n.pos;n.pos<d;){var p=n.readVarint()>>3;l=p===1?n.readString():p===2?n.readFloat():p===3?n.readDouble():p===4?n.readVarint64():p===5?n.readVarint():p===6?n.readSVarint():p===7?n.readBoolean():null}return l}(r))}wh.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 dd(this._pbf,e,this.extent,this._keys,this._values)};var fd=bh;function md(i,e,r){if(i===3){var n=new fd(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}Bs.VectorTile=function(i,e){this.layers=i.readFields(md,{},e)},Bs.VectorTileFeature=vh,Bs.VectorTileLayer=bh;const gd=Bs.VectorTileFeature.types,vc=Math.pow(2,13);function Ea(i,e,r,n,l,d,p,f){i.emplaceBack(e,r,2*Math.floor(n*vc)+p,l*vc*2,d*vc*2,Math.round(f))}class bc{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 hs,this.centroidVertexArray=new cs,this.indexArray=new Qt,this.programConfigurations=new yn(e.layers,e.zoom),this.segments=new Kt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.features=[],this.hasPattern=_c("fill-extrusion",this.layers,r);for(const{feature:l,id:d,index:p,sourceLayerIndex:f}of e){const _=this.layers[0]._featureFilter.needGeometry,x=vn(l,_);if(!this.layers[0]._featureFilter.filter(new It(this.zoom),x,n))continue;const S={id:d,sourceLayerIndex:f,index:p,geometry:_?x.geometry:xn(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(yc("fill-extrusion",this.layers,S,this.zoom,r)):this.addFeature(S,S.geometry,p,n,{}),r.featureIndex.insert(l,S.geometry,p,f,this.index,!0)}}addFeatures(e,r,n){for(const l of this.features){const{geometry:d}=l;this.addFeature(l,d,l.index,r,n)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}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,ld),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,ad.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,n,l,d){for(const p of Fn(r,500)){const f={x:0,y:0,vertexCount:0};let _=0;for(const R of p)_+=R.length;let x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const R of p){if(R.length===0||yd(R))continue;let O=0;for(let U=0;U<R.length;U++){const W=R[U];if(U>=1){const ne=R[U-1];if(!_d(W,ne)){x.vertexLength+4>Kt.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const Y=W.sub(ne)._perp()._unit(),ie=ne.dist(W);O+ie>32768&&(O=0),Ea(this.layoutVertexArray,W.x,W.y,Y.x,Y.y,0,0,O),Ea(this.layoutVertexArray,W.x,W.y,Y.x,Y.y,0,1,O),f.x+=2*W.x,f.y+=2*W.y,f.vertexCount+=2,O+=ie,Ea(this.layoutVertexArray,ne.x,ne.y,Y.x,Y.y,0,0,O),Ea(this.layoutVertexArray,ne.x,ne.y,Y.x,Y.y,0,1,O),f.x+=2*ne.x,f.y+=2*ne.y,f.vertexCount+=2;const ue=x.vertexLength;this.indexArray.emplaceBack(ue,ue+2,ue+1),this.indexArray.emplaceBack(ue+1,ue+2,ue+3),x.vertexLength+=4,x.primitiveLength+=2}}}}if(x.vertexLength+_>Kt.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(_,this.layoutVertexArray,this.indexArray)),gd[e.type]!=="Polygon")continue;const S=[],E=[],k=x.vertexLength;for(const R of p)if(R.length!==0){R!==p[0]&&E.push(S.length/2);for(let O=0;O<R.length;O++){const U=R[O];Ea(this.layoutVertexArray,U.x,U.y,0,0,1,1,0),f.x+=U.x,f.y+=U.y,f.vertexCount+=1,S.push(U.x),S.push(U.y)}}const D=ph(S,E);for(let R=0;R<D.length;R+=3)this.indexArray.emplaceBack(k+D[R],k+D[R+2],k+D[R+1]);x.primitiveLength+=D.length/3,x.vertexLength+=_;for(let R=0;R<f.vertexCount;R++){const O=Math.floor(f.x/f.vertexCount),U=Math.floor(f.y/f.vertexCount);this.centroidVertexArray.emplaceBack(O,U)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,d,l)}}function _d(i,e){return i.x===e.x&&(i.x<0||i.x>Xt)||i.y===e.y&&(i.y<0||i.y>Xt)}function yd(i){return i.every(e=>e.x<0)||i.every(e=>e.x>Xt)||i.every(e=>e.y<0)||i.every(e=>e.y>Xt)}let Sh;Re("FillExtrusionBucket",bc,{omit:["layers","features"]});var xd={get paint(){return Sh=Sh||new o({"fill-extrusion-opacity":new je(he["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new We(he["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new je(he["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new je(he["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new u(he["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new We(he["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new We(he["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new je(he["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class vd extends h{constructor(e){super(e,xd)}createBucket(e){return new bc(e)}queryRadius(){return bl(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,r,n,l,d,p,f,_){const x=wl(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),p.angle,f),S=this.paint.get("fill-extrusion-height").evaluate(r,n),E=this.paint.get("fill-extrusion-base").evaluate(r,n),k=function(R,O,U,W){const ne=[];for(const Y of R){const ie=[Y.x,Y.y,0,1];Sl(ie,ie,O),ne.push(new ae(ie[0]/ie[3],ie[1]/ie[3]))}return ne}(x,_),D=function(R,O,U,W){const ne=[],Y=[],ie=W[8]*O,ue=W[9]*O,xe=W[10]*O,ze=W[11]*O,He=W[8]*U,ke=W[9]*U,Ie=W[10]*U,Ne=W[11]*U;for(const Be of R){const Le=[],pe=[];for(const Ue of Be){const $e=Ue.x,Ye=Ue.y,St=W[0]*$e+W[4]*Ye+W[12],wt=W[1]*$e+W[5]*Ye+W[13],ei=W[2]*$e+W[6]*Ye+W[14],gr=W[3]*$e+W[7]*Ye+W[15],mi=ei+xe,Ut=gr+ze,ki=St+He,Ci=wt+ke,Mi=ei+Ie,qt=gr+Ne,ti=new ae((St+ie)/Ut,(wt+ue)/Ut);ti.z=mi/Ut,Le.push(ti);const wi=new ae(ki/qt,Ci/qt);wi.z=Mi/qt,pe.push(wi)}ne.push(Le),Y.push(pe)}return[ne,Y]}(l,E,S,_);return function(R,O,U){let W=1/0;th(U,O)&&(W=Th(U,O[0]));for(let ne=0;ne<O.length;ne++){const Y=O[ne],ie=R[ne];for(let ue=0;ue<Y.length-1;ue++){const xe=Y[ue],ze=[xe,Y[ue+1],ie[ue+1],ie[ue],xe];eh(U,ze)&&(W=Math.min(W,Th(U,ze)))}}return W!==1/0&&W}(D[0],D[1],k)}}function Aa(i,e){return i.x*e.x+i.y*e.y}function Th(i,e){if(i.length===1){let r=0;const n=e[r++];let l;for(;!l||n.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(n),_=d.sub(n),x=p.sub(n),S=Aa(f,f),E=Aa(f,_),k=Aa(_,_),D=Aa(x,f),R=Aa(x,_),O=S*k-E*E,U=(k*D-E*R)/O,W=(S*R-E*D)/O,ne=n.z*(1-U-W)+l.z*U+d.z*W;if(isFinite(ne))return ne}return 1/0}{let r=1/0;for(const n of e)r=Math.min(r,n.z);return r}}const bd=w([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:wd}=bd,Sd=w([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Td}=Sd,Ed=Bs.VectorTileFeature.types,Ad=Math.cos(Math.PI/180*37.5),Eh=Math.pow(2,14)/.5;class wc{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 ro,this.layoutVertexArray2=new pa,this.indexArray=new Qt,this.programConfigurations=new yn(e.layers,e.zoom),this.segments=new Kt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.hasPattern=_c("line",this.layers,r);const l=this.layers[0].layout.get("line-sort-key"),d=!l.isConstant(),p=[];for(const{feature:f,id:_,index:x,sourceLayerIndex:S}of e){const E=this.layers[0]._featureFilter.needGeometry,k=vn(f,E);if(!this.layers[0]._featureFilter.filter(new It(this.zoom),k,n))continue;const D=d?l.evaluate(k,{},n):void 0,R={id:_,properties:f.properties,type:f.type,sourceLayerIndex:S,index:x,geometry:E?k.geometry:xn(f),patterns:{},sortKey:D};p.push(R)}d&&p.sort((f,_)=>f.sortKey-_.sortKey);for(const f of p){const{geometry:_,index:x,sourceLayerIndex:S}=f;if(this.hasPattern){const E=yc("line",this.layers,f,this.zoom,r);this.patternFeatures.push(E)}else this.addFeature(f,_,x,n,{});r.featureIndex.insert(e[x].feature,_,x,S,this.index)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}addFeatures(e,r,n){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,n)}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,Td)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,wd),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,n,l,d){const p=this.layers[0].layout,f=p.get("line-join").evaluate(e,{}),_=p.get("line-cap"),x=p.get("line-miter-limit"),S=p.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const E of r)this.addLine(E,e,f,_,x,S);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,d,l)}addLine(e,r,n,l,d,p){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let W=0;W<e.length-1;W++)this.totalDistance+=e[W].dist(e[W+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const f=Ed[r.type]==="Polygon";let _=e.length;for(;_>=2&&e[_-1].equals(e[_-2]);)_--;let x=0;for(;x<_-1&&e[x].equals(e[x+1]);)x++;if(_<(f?3:2))return;n==="bevel"&&(d=1.05);const S=this.overscaling<=16?15*Xt/(512*this.overscaling):0,E=this.segments.prepareSegment(10*_,this.layoutVertexArray,this.indexArray);let k,D,R,O,U;this.e1=this.e2=-1,f&&(k=e[_-2],U=e[x].sub(k)._unit()._perp());for(let W=x;W<_;W++){if(R=W===_-1?f?e[x+1]:void 0:e[W+1],R&&e[W].equals(R))continue;U&&(O=U),k&&(D=k),k=e[W],U=R?R.sub(k)._unit()._perp():O,O=O||U;let ne=O.add(U);ne.x===0&&ne.y===0||ne._unit();const Y=O.x*U.x+O.y*U.y,ie=ne.x*U.x+ne.y*U.y,ue=ie!==0?1/ie:1/0,xe=2*Math.sqrt(2-2*ie),ze=ie<Ad&&D&&R,He=O.x*U.y-O.y*U.x>0;if(ze&&W>x){const Ne=k.dist(D);if(Ne>2*S){const Be=k.sub(k.sub(D)._mult(S/Ne)._round());this.updateDistance(D,Be),this.addCurrentVertex(Be,O,0,0,E),D=Be}}const ke=D&&R;let Ie=ke?n:f?"butt":l;if(ke&&Ie==="round"&&(ue<p?Ie="miter":ue<=2&&(Ie="fakeround")),Ie==="miter"&&ue>d&&(Ie="bevel"),Ie==="bevel"&&(ue>2&&(Ie="flipbevel"),ue<d&&(Ie="miter")),D&&this.updateDistance(D,k),Ie==="miter")ne._mult(ue),this.addCurrentVertex(k,ne,0,0,E);else if(Ie==="flipbevel"){if(ue>100)ne=U.mult(-1);else{const Ne=ue*O.add(U).mag()/O.sub(U).mag();ne._perp()._mult(Ne*(He?-1:1))}this.addCurrentVertex(k,ne,0,0,E),this.addCurrentVertex(k,ne.mult(-1),0,0,E)}else if(Ie==="bevel"||Ie==="fakeround"){const Ne=-Math.sqrt(ue*ue-1),Be=He?Ne:0,Le=He?0:Ne;if(D&&this.addCurrentVertex(k,O,Be,Le,E),Ie==="fakeround"){const pe=Math.round(180*xe/Math.PI/20);for(let Ue=1;Ue<pe;Ue++){let $e=Ue/pe;if($e!==.5){const St=$e-.5;$e+=$e*St*($e-1)*((1.0904+Y*(Y*(3.55645-1.43519*Y)-3.2452))*St*St+(.848013+Y*(.215638*Y-1.06021)))}const Ye=U.sub(O)._mult($e)._add(O)._unit()._mult(He?-1:1);this.addHalfVertex(k,Ye.x,Ye.y,!1,He,0,E)}}R&&this.addCurrentVertex(k,U,-Be,-Le,E)}else if(Ie==="butt")this.addCurrentVertex(k,ne,0,0,E);else if(Ie==="square"){const Ne=D?1:-1;this.addCurrentVertex(k,ne,Ne,Ne,E)}else Ie==="round"&&(D&&(this.addCurrentVertex(k,O,0,0,E),this.addCurrentVertex(k,O,1,1,E,!0)),R&&(this.addCurrentVertex(k,U,-1,-1,E,!0),this.addCurrentVertex(k,U,0,0,E)));if(ze&&W<_-1){const Ne=k.dist(R);if(Ne>2*S){const Be=k.add(R.sub(k)._mult(S/Ne)._round());this.updateDistance(k,Be),this.addCurrentVertex(Be,U,0,0,E),k=Be}}}}addCurrentVertex(e,r,n,l,d,p=!1){const f=r.y*l-r.x,_=-r.y-r.x*l;this.addHalfVertex(e,r.x+r.y*n,r.y-r.x*n,p,!1,n,d),this.addHalfVertex(e,f,_,p,!0,-l,d),this.distance>Eh/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,r,n,l,d,p))}addHalfVertex({x:e,y:r},n,l,d,p,f,_){const x=.5*(this.lineClips?this.scaledDistance*(Eh-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(d?1:0),(r<<1)+(p?1:0),Math.round(63*n)+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 S=_.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,S),_.primitiveLength++),p?this.e2=S:this.e1=S}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 Ah,Ih;Re("LineBucket",wc,{omit:["layers","patternFeatures"]});var Ph={get paint(){return Ih=Ih||new o({"line-opacity":new We(he.paint_line["line-opacity"]),"line-color":new We(he.paint_line["line-color"]),"line-translate":new je(he.paint_line["line-translate"]),"line-translate-anchor":new je(he.paint_line["line-translate-anchor"]),"line-width":new We(he.paint_line["line-width"]),"line-gap-width":new We(he.paint_line["line-gap-width"]),"line-offset":new We(he.paint_line["line-offset"]),"line-blur":new We(he.paint_line["line-blur"]),"line-dasharray":new t(he.paint_line["line-dasharray"]),"line-pattern":new u(he.paint_line["line-pattern"]),"line-gradient":new s(he.paint_line["line-gradient"])})},get layout(){return Ah=Ah||new o({"line-cap":new je(he.layout_line["line-cap"]),"line-join":new We(he.layout_line["line-join"]),"line-miter-limit":new je(he.layout_line["line-miter-limit"]),"line-round-limit":new je(he.layout_line["line-round-limit"]),"line-sort-key":new We(he.layout_line["line-sort-key"])})}};class Id extends We{possiblyEvaluate(e,r){return r=new It(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(e,r)}evaluate(e,r,n,l){return r=Tt({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,n,l)}}let Il;class Pd extends h{constructor(e){super(e,Ph),this.gradientVersion=0,Il||(Il=new Id(Ph.paint.properties["line-width"].specification),Il.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){const r=this.gradientExpression();this.stepInterpolant=!!function(n){return n._styleExpression!==void 0}(r)&&r._styleExpression.expression instanceof vs,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"]=Il.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new wc(e)}queryRadius(e){const r=e,n=kh(xa("line-width",this,r),xa("line-gap-width",this,r)),l=xa("line-offset",this,r);return n/2+Math.abs(l)+bl(this.paint.get("line-translate"))}queryIntersectsFeature(e,r,n,l,d,p,f){const _=wl(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),p.angle,f),x=f/2*kh(this.paint.get("line-width").evaluate(r,n),this.paint.get("line-gap-width").evaluate(r,n)),S=this.paint.get("line-offset").evaluate(r,n);return S&&(l=function(E,k){const D=[];for(let R=0;R<E.length;R++){const O=E[R],U=[];for(let W=0;W<O.length;W++){const ne=O[W-1],Y=O[W],ie=O[W+1],ue=W===0?new ae(0,0):Y.sub(ne)._unit()._perp(),xe=W===O.length-1?new ae(0,0):ie.sub(Y)._unit()._perp(),ze=ue._add(xe)._unit(),He=ze.x*xe.x+ze.y*xe.y;He!==0&&ze._mult(1/He),U.push(ze._mult(k)._add(Y))}D.push(U)}return D}(l,S*f)),function(E,k,D){for(let R=0;R<k.length;R++){const O=k[R];if(E.length>=3){for(let U=0;U<O.length;U++)if(lo(E,O[U]))return!0}if(Bu(E,O,D))return!0}return!1}(_,l,x)}isTileClipped(){return!0}}function kh(i,e){return e>0?e+2*i:i}const kd=w([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Cd=w([{name:"a_projected_pos",components:3,type:"Float32"}],4);w([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Md=w([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);w([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Ch=w([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),zd=w([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Dd(i,e,r){return i.sections.forEach(n=>{n.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}(n.text,e,r)}),i}w([{name:"triangle",components:3,type:"Uint16"}]),w([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),w([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),w([{type:"Float32",name:"offsetX"}]),w([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),w([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Ia={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Yt=24,Mh=bt,zh=function(i,e,r,n,l){var d,p,f=8*l-n-1,_=(1<<f)-1,x=_>>1,S=-7,E=l-1,k=-1,D=i[e+E];for(E+=k,d=D&(1<<-S)-1,D>>=-S,S+=f;S>0;d=256*d+i[e+E],E+=k,S-=8);for(p=d&(1<<-S)-1,d>>=-S,S+=n;S>0;p=256*p+i[e+E],E+=k,S-=8);if(d===0)d=1-x;else{if(d===_)return p?NaN:1/0*(D?-1:1);p+=Math.pow(2,n),d-=x}return(D?-1:1)*p*Math.pow(2,d-n)},Dh=function(i,e,r,n,l,d){var p,f,_,x=8*d-l-1,S=(1<<x)-1,E=S>>1,k=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,D=0,R=1,O=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,p=S):(p=Math.floor(Math.log(e)/Math.LN2),e*(_=Math.pow(2,-p))<1&&(p--,_*=2),(e+=p+E>=1?k/_:k*Math.pow(2,1-E))*_>=2&&(p++,_/=2),p+E>=S?(f=0,p=S):p+E>=1?(f=(e*_-1)*Math.pow(2,l),p+=E):(f=e*Math.pow(2,E-1)*Math.pow(2,l),p=0));l>=8;i[r+D]=255&f,D+=R,f/=256,l-=8);for(p=p<<l|f,x+=l;x>0;i[r+D]=255&p,D+=R,p/=256,x-=8);i[r+D-R]|=128*O};function bt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}bt.Varint=0,bt.Fixed64=1,bt.Bytes=2,bt.Fixed32=5;var Sc=4294967296,Lh=1/Sc,Rh=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function ds(i){return i.type===bt.Bytes?i.readVarint()+i.pos:i.pos+1}function po(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function Bh(i,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var l=r.pos-1;l>=i;l--)r.buf[l+n]=r.buf[l]}function Ld(i,e){for(var r=0;r<i.length;r++)e.writeVarint(i[r])}function Rd(i,e){for(var r=0;r<i.length;r++)e.writeSVarint(i[r])}function Bd(i,e){for(var r=0;r<i.length;r++)e.writeFloat(i[r])}function Fd(i,e){for(var r=0;r<i.length;r++)e.writeDouble(i[r])}function Od(i,e){for(var r=0;r<i.length;r++)e.writeBoolean(i[r])}function Vd(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 Nd(i,e){for(var r=0;r<i.length;r++)e.writeFixed64(i[r])}function jd(i,e){for(var r=0;r<i.length;r++)e.writeSFixed64(i[r])}function Pl(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+16777216*i[e+3]}function fo(i,e,r){i[r]=e,i[r+1]=e>>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function Fh(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}bt.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),l=n>>3,d=this.pos;this.type=7&n,i(l,e,this),this.pos===d&&this.skip(n)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=Pl(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=Fh(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=Pl(this.buf,this.pos)+Pl(this.buf,this.pos+4)*Sc;return this.pos+=8,i},readSFixed64:function(){var i=Pl(this.buf,this.pos)+Fh(this.buf,this.pos+4)*Sc;return this.pos+=8,i},readFloat:function(){var i=zh(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=zh(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(l,d,p){var f,_,x=p.buf;if(f=(112&(_=x[p.pos++]))>>4,_<128||(f|=(127&(_=x[p.pos++]))<<3,_<128)||(f|=(127&(_=x[p.pos++]))<<10,_<128)||(f|=(127&(_=x[p.pos++]))<<17,_<128)||(f|=(127&(_=x[p.pos++]))<<24,_<128)||(f|=(1&(_=x[p.pos++]))<<31,_<128))return po(l,f,d);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[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&&Rh?function(r,n,l){return Rh.decode(r.subarray(n,l))}(this.buf,e,i):function(r,n,l){for(var d="",p=n;p<l;){var f,_,x,S=r[p],E=null,k=S>239?4:S>223?3:S>191?2:1;if(p+k>l)break;k===1?S<128&&(E=S):k===2?(192&(f=r[p+1]))==128&&(E=(31&S)<<6|63&f)<=127&&(E=null):k===3?(_=r[p+2],(192&(f=r[p+1]))==128&&(192&_)==128&&((E=(15&S)<<12|(63&f)<<6|63&_)<=2047||E>=55296&&E<=57343)&&(E=null)):k===4&&(_=r[p+2],x=r[p+3],(192&(f=r[p+1]))==128&&(192&_)==128&&(192&x)==128&&((E=(15&S)<<18|(63&f)<<12|(63&_)<<6|63&x)<=65535||E>=1114112)&&(E=null)),E===null?(E=65533,k=1):E>65535&&(E-=65536,d+=String.fromCharCode(E>>>10&1023|55296),E=56320|1023&E),d+=String.fromCharCode(E),p+=k}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!==bt.Bytes)return i.push(this.readVarint(e));var r=ds(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(e));return i},readPackedSVarint:function(i){if(this.type!==bt.Bytes)return i.push(this.readSVarint());var e=ds(this);for(i=i||[];this.pos<e;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==bt.Bytes)return i.push(this.readBoolean());var e=ds(this);for(i=i||[];this.pos<e;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==bt.Bytes)return i.push(this.readFloat());var e=ds(this);for(i=i||[];this.pos<e;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==bt.Bytes)return i.push(this.readDouble());var e=ds(this);for(i=i||[];this.pos<e;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==bt.Bytes)return i.push(this.readFixed32());var e=ds(this);for(i=i||[];this.pos<e;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==bt.Bytes)return i.push(this.readSFixed32());var e=ds(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==bt.Bytes)return i.push(this.readFixed64());var e=ds(this);for(i=i||[];this.pos<e;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==bt.Bytes)return i.push(this.readSFixed64());var e=ds(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed64());return i},skip:function(i){var e=7&i;if(e===bt.Varint)for(;this.buf[this.pos++]>127;);else if(e===bt.Bytes)this.pos=this.readVarint()+this.pos;else if(e===bt.Fixed32)this.pos+=4;else{if(e!==bt.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),fo(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),fo(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),fo(this.buf,-1&i,this.pos),fo(this.buf,Math.floor(i*Lh),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),fo(this.buf,-1&i,this.pos),fo(this.buf,Math.floor(i*Lh),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?function(e,r){var n,l;if(e>=0?(n=e%4294967296|0,l=e/4294967296|0):(l=~(-e/4294967296),4294967295^(n=~(-e%4294967296))?n=n+1|0:(n=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)}(n,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(n,l,d){for(var p,f,_=0;_<l.length;_++){if((p=l.charCodeAt(_))>55295&&p<57344){if(!f){p>56319||_+1===l.length?(n[d++]=239,n[d++]=191,n[d++]=189):f=p;continue}if(p<56320){n[d++]=239,n[d++]=191,n[d++]=189,f=p;continue}p=f-55296<<10|p-56320|65536,f=null}else f&&(n[d++]=239,n[d++]=191,n[d++]=189,f=null);p<128?n[d++]=p:(p<2048?n[d++]=p>>6|192:(p<65536?n[d++]=p>>12|224:(n[d++]=p>>18|240,n[d++]=p>>12&63|128),n[d++]=p>>6&63|128),n[d++]=63&p|128)}return d}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&Bh(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Dh(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Dh(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 n=this.pos-r;n>=128&&Bh(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(i,e,r){this.writeTag(i,bt.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,Ld,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,Rd,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,Od,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,Bd,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,Fd,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,Vd,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,$d,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,Nd,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,jd,e)},writeBytesField:function(i,e){this.writeTag(i,bt.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,bt.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,bt.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,bt.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,bt.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,bt.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,bt.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,bt.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,bt.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,bt.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,!!e)}};var Tc=fe(Mh);const Ec=3;function Ud(i,e,r){i===1&&r.readMessage(qd,e)}function qd(i,e,r){if(i===3){const{id:n,bitmap:l,width:d,height:p,left:f,top:_,advance:x}=r.readMessage(Zd,{});e.push({id:n,bitmap:new ba({width:d+2*Ec,height:p+2*Ec},l),metrics:{width:d,height:p,left:f,top:_,advance:x}})}}function Zd(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 Oh=Ec;function Vh(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 n=[{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=n.length-1;f>=0;f--){const _=n[f];if(!(p.w>_.w||p.h>_.h)){if(p.x=_.x,p.y=_.y,d=Math.max(d,p.y+p.h),l=Math.max(l,p.x+p.w),p.w===_.w&&p.h===_.h){const x=n.pop();f<n.length&&(n[f]=x)}else p.h===_.h?(_.x+=p.w,_.w-=p.w):p.w===_.w?(_.y+=p.h,_.h-=p.h):(n.push({x:_.x+p.w,y:_.y,w:_.w-p.w,h:p.h}),_.y+=p.h,_.h-=p.h);break}}return{w:l,h:d,fill:e/(l*d)||0}}const $i=1;class Ac{constructor(e,{pixelRatio:r,version:n,stretchX:l,stretchY:d,content:p,textFitWidth:f,textFitHeight:_}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=l,this.stretchY=d,this.content=p,this.version=n,this.textFitWidth=f,this.textFitHeight=_}get tl(){return[this.paddedRect.x+$i,this.paddedRect.y+$i]}get br(){return[this.paddedRect.x+this.paddedRect.w-$i,this.paddedRect.y+this.paddedRect.h-$i]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*$i)/this.pixelRatio,(this.paddedRect.h-2*$i)/this.pixelRatio]}}class $h{constructor(e,r){const n={},l={};this.haveRenderCallbacks=[];const d=[];this.addImages(e,n,d),this.addImages(r,l,d);const{w:p,h:f}=Vh(d),_=new er({width:p||1,height:f||1});for(const x in e){const S=e[x],E=n[x].paddedRect;er.copy(S.data,_,{x:0,y:0},{x:E.x+$i,y:E.y+$i},S.data)}for(const x in r){const S=r[x],E=l[x].paddedRect,k=E.x+$i,D=E.y+$i,R=S.data.width,O=S.data.height;er.copy(S.data,_,{x:0,y:0},{x:k,y:D},S.data),er.copy(S.data,_,{x:0,y:O-1},{x:k,y:D-1},{width:R,height:1}),er.copy(S.data,_,{x:0,y:0},{x:k,y:D+O},{width:R,height:1}),er.copy(S.data,_,{x:R-1,y:0},{x:k-1,y:D},{width:1,height:O}),er.copy(S.data,_,{x:0,y:0},{x:k+R,y:D},{width:1,height:O})}this.image=_,this.iconPositions=n,this.patternPositions=l}addImages(e,r,n){for(const l in e){const d=e[l],p={x:0,y:0,w:d.data.width+2*$i,h:d.data.height+2*$i};n.push(p),r[l]=new Ac(p,d),d.hasRenderCallback&&this.haveRenderCallbacks.push(l)}}patchUpdatedImages(e,r){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const n in e.updatedImages)this.patchUpdatedImage(this.iconPositions[n],e.getImage(n),r),this.patchUpdatedImage(this.patternPositions[n],e.getImage(n),r)}patchUpdatedImage(e,r,n){if(!e||!r||e.version===r.version)return;e.version=r.version;const[l,d]=e.tl;n.update(r.data,void 0,{x:l,y:d})}}var Fs;Re("ImagePosition",Ac),Re("ImageAtlas",$h),T.ai=void 0,(Fs=T.ai||(T.ai={}))[Fs.none=0]="none",Fs[Fs.horizontal=1]="horizontal",Fs[Fs.vertical=2]="vertical",Fs[Fs.horizontalOnly=3]="horizontalOnly";const Pa=-17;class ka{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){const n=new ka;return n.scale=e||1,n.fontStack=r,n}static forImage(e){const r=new ka;return r.imageName=e,r}}class mo{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){const n=new mo;for(let l=0;l<e.sections.length;l++){const d=e.sections[l];d.image?n.addImageSection(d):n.addTextSection(d,r)}return n}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 n=0;n<e.length;n++){const l=e.charCodeAt(n+1)||null,d=e.charCodeAt(n-1)||null;r+=l&&pl(l)&&!Ia[e[n+1]]||d&&pl(d)&&!Ia[e[n-1]]||!Ia[e[n]]?e[n]:Ia[e[n]]}return r}(this.text)}trim(){let e=0;for(let n=0;n<this.text.length&&Cl[this.text.charCodeAt(n)];n++)e++;let r=this.text.length;for(let n=this.text.length-1;n>=0&&n>=e&&Cl[this.text.charCodeAt(n)];n--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const n=new mo;return n.text=this.text.substring(e,r),n.sectionIndex=this.sectionIndex.slice(e,r),n.sections=this.sections,n}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(ka.forText(e.scale,e.fontStack||r));const n=this.sections.length-1;for(let l=0;l<e.text.length;++l)this.sectionIndex.push(n)}addImageSection(e){const r=e.image?e.image.name:"";if(r.length===0)return void ni("Can't add FormattedSection with an empty image.");const n=this.getNextImageSectionCharCode();n?(this.text+=String.fromCharCode(n),this.sections.push(ka.forImage(r)),this.sectionIndex.push(this.sections.length-1)):ni("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function kl(i,e,r,n,l,d,p,f,_,x,S,E,k,D,R){const O=mo.fromFeature(i,l);let U;E===T.ai.vertical&&O.verticalizePunctuation();const{processBidirectionalText:W,processStyledBidirectionalText:ne}=jr;if(W&&O.sections.length===1){U=[];const ue=W(O.toString(),Ic(O,x,d,e,n,D));for(const xe of ue){const ze=new mo;ze.text=xe,ze.sections=O.sections;for(let He=0;He<xe.length;He++)ze.sectionIndex.push(0);U.push(ze)}}else if(ne){U=[];const ue=ne(O.text,O.sectionIndex,Ic(O,x,d,e,n,D));for(const xe of ue){const ze=new mo;ze.text=xe[0],ze.sectionIndex=xe[1],ze.sections=O.sections,U.push(ze)}}else U=function(ue,xe){const ze=[],He=ue.text;let ke=0;for(const Ie of xe)ze.push(ue.substring(ke,Ie)),ke=Ie;return ke<He.length&&ze.push(ue.substring(ke,He.length)),ze}(O,Ic(O,x,d,e,n,D));const Y=[],ie={positionedLines:Y,text:O.toString(),top:S[1],bottom:S[1],left:S[0],right:S[0],writingMode:E,iconsInText:!1,verticalizable:!1};return function(ue,xe,ze,He,ke,Ie,Ne,Be,Le,pe,Ue,$e){let Ye=0,St=Pa,wt=0,ei=0;const gr=Be==="right"?1:Be==="left"?0:.5;let mi=0;for(const qt of ke){qt.trim();const ti=qt.getMaxScale(),wi=(ti-1)*Yt,gi={positionedGlyphs:[],lineOffset:0};ue.positionedLines[mi]=gi;const zi=gi.positionedGlyphs;let _i=0;if(!qt.length()){St+=Ie,++mi;continue}for(let Ni=0;Ni<qt.length();Ni++){const ft=qt.getSection(Ni),Pt=qt.getSectionIndex(Ni),Bt=qt.getCharCode(Ni);let Zi=0,jt=null,xo=null,Gr=null,Hr=Yt;const _r=!(Le===T.ai.horizontal||!Ue&&!ha(Bt)||Ue&&(Cl[Bt]||(Ut=Bt,Ce.Arabic(Ut)||Ce["Arabic Supplement"](Ut)||Ce["Arabic Extended-A"](Ut)||Ce["Arabic Presentation Forms-A"](Ut)||Ce["Arabic Presentation Forms-B"](Ut))));if(ft.imageName){const rr=He[ft.imageName];if(!rr)continue;Gr=ft.imageName,ue.iconsInText=ue.iconsInText||!0,xo=rr.paddedRect;const ri=rr.displaySize;ft.scale=ft.scale*Yt/$e,jt={width:ri[0],height:ri[1],left:$i,top:-Oh,advance:_r?ri[1]:ri[0]},Zi=wi+(Yt-ri[1]*ft.scale),Hr=jt.advance;const ps=_r?ri[0]*ft.scale-Yt*ti:ri[1]*ft.scale-Yt*ti;ps>0&&ps>_i&&(_i=ps)}else{const rr=ze[ft.fontStack],ri=rr&&rr[Bt];if(ri&&ri.rect)xo=ri.rect,jt=ri.metrics;else{const ps=xe[ft.fontStack],La=ps&&ps[Bt];if(!La)continue;jt=La.metrics}Zi=(ti-ft.scale)*Yt}_r?(ue.verticalizable=!0,zi.push({glyph:Bt,imageName:Gr,x:Ye,y:St+Zi,vertical:_r,scale:ft.scale,fontStack:ft.fontStack,sectionIndex:Pt,metrics:jt,rect:xo}),Ye+=Hr*ft.scale+pe):(zi.push({glyph:Bt,imageName:Gr,x:Ye,y:St+Zi,vertical:_r,scale:ft.scale,fontStack:ft.fontStack,sectionIndex:Pt,metrics:jt,rect:xo}),Ye+=jt.advance*ft.scale+pe)}zi.length!==0&&(wt=Math.max(Ye-pe,wt),Xd(zi,0,zi.length-1,gr,_i)),Ye=0;const ir=Ie*ti+_i;gi.lineOffset=Math.max(_i,wi),St+=ir,ei=Math.max(ir,ei),++mi}var Ut;const ki=St-Pa,{horizontalAlign:Ci,verticalAlign:Mi}=Pc(Ne);(function(qt,ti,wi,gi,zi,_i,ir,Ni,ft){const Pt=(ti-wi)*zi;let Bt=0;Bt=_i!==ir?-Ni*gi-Pa:(-gi*ft+.5)*ir;for(const Zi of qt)for(const jt of Zi.positionedGlyphs)jt.x+=Pt,jt.y+=Bt})(ue.positionedLines,gr,Ci,Mi,wt,ei,Ie,ki,ke.length),ue.top+=-Mi*ki,ue.bottom=ue.top+ki,ue.left+=-Ci*wt,ue.right=ue.left+wt}(ie,e,r,n,U,p,f,_,E,x,k,R),!function(ue){for(const xe of ue)if(xe.positionedGlyphs.length!==0)return!1;return!0}(Y)&&ie}const Cl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Gd={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},Hd={40:!0};function Nh(i,e,r,n,l,d){if(e.imageName){const p=n[e.imageName];return p?p.displaySize[0]*e.scale*Yt/d+l:0}{const p=r[e.fontStack],f=p&&p[i];return f?f.metrics.advance*e.scale+l:0}}function jh(i,e,r,n){const l=Math.pow(i-e,2);return n?i<e?l/2:2*l:l+Math.abs(r)*r}function Wd(i,e,r){let n=0;return i===10&&(n-=1e4),r&&(n+=150),i!==40&&i!==65288||(n+=50),e!==41&&e!==65289||(n+=50),n}function Uh(i,e,r,n,l,d){let p=null,f=jh(e,r,l,d);for(const _ of n){const x=jh(e-_.x,r,l,d)+_.badness;x<=f&&(p=_,f=x)}return{index:i,x:e,priorBreak:p,badness:f}}function qh(i){return i?qh(i.priorBreak).concat(i.index):[]}function Ic(i,e,r,n,l,d){if(!i)return[];const p=[],f=function(E,k,D,R,O,U){let W=0;for(let ne=0;ne<E.length();ne++){const Y=E.getSection(ne);W+=Nh(E.getCharCode(ne),Y,R,O,k,U)}return W/Math.max(1,Math.ceil(W/D))}(i,e,r,n,l,d),_=i.text.indexOf("")>=0;let x=0;for(let E=0;E<i.length();E++){const k=i.getSection(E),D=i.getCharCode(E);if(Cl[D]||(x+=Nh(D,k,n,l,e,d)),E<i.length()-1){const R=!((S=D)<11904||!(Ce["Bopomofo Extended"](S)||Ce.Bopomofo(S)||Ce["CJK Compatibility Forms"](S)||Ce["CJK Compatibility Ideographs"](S)||Ce["CJK Compatibility"](S)||Ce["CJK Radicals Supplement"](S)||Ce["CJK Strokes"](S)||Ce["CJK Symbols and Punctuation"](S)||Ce["CJK Unified Ideographs Extension A"](S)||Ce["CJK Unified Ideographs"](S)||Ce["Enclosed CJK Letters and Months"](S)||Ce["Halfwidth and Fullwidth Forms"](S)||Ce.Hiragana(S)||Ce["Ideographic Description Characters"](S)||Ce["Kangxi Radicals"](S)||Ce["Katakana Phonetic Extensions"](S)||Ce.Katakana(S)||Ce["Vertical Forms"](S)||Ce["Yi Radicals"](S)||Ce["Yi Syllables"](S)));(Gd[D]||R||k.imageName||E!==i.length()-2&&Hd[i.getCharCode(E+1)])&&p.push(Uh(E+1,x,f,p,Wd(D,i.getCharCode(E+1),R&&_),!1))}}var S;return qh(Uh(i.length(),x,f,p,0,!0))}function Pc(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 Xd(i,e,r,n,l){if(!n&&!l)return;const d=i[r],p=(i[r].x+d.metrics.advance*d.scale)*n;for(let f=e;f<=r;f++)i[f].x-=p,i[f].y+=l}function Jd(i,e,r){const{horizontalAlign:n,verticalAlign:l}=Pc(r),d=e[0]-i.displaySize[0]*n,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 Zh(i){var e,r;let n=i.left,l=i.top,d=i.right-n,p=i.bottom-l;const f=(e=i.image.textFitWidth)!==null&&e!==void 0?e:"stretchOrShrink",_=(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(_==="proportional"){if(f==="stretchOnly"&&d/p<x||f==="proportional"){const S=Math.ceil(p*x);n*=S/d,d=S}}else if(f==="proportional"&&_==="stretchOnly"&&x!==0&&d/p>x){const S=Math.ceil(d/x);l*=S/p,p=S}return{x1:n,y1:l,x2:n+d,y2:l+p}}function Gh(i,e,r,n,l,d){const p=i.image;let f;if(p.content){const U=p.content,W=p.pixelRatio||1;f=[U[0]/W,U[1]/W,p.displaySize[0]-U[2]/W,p.displaySize[1]-U[3]/W]}const _=e.left*d,x=e.right*d;let S,E,k,D;r==="width"||r==="both"?(D=l[0]+_-n[3],E=l[0]+x+n[1]):(D=l[0]+(_+x-p.displaySize[0])/2,E=D+p.displaySize[0]);const R=e.top*d,O=e.bottom*d;return r==="height"||r==="both"?(S=l[1]+R-n[0],k=l[1]+O+n[2]):(S=l[1]+(R+O-p.displaySize[1])/2,k=S+p.displaySize[1]),{image:p,top:S,right:E,bottom:k,left:D,collisionPadding:f}}const Ca=255,Zr=128,Os=Ca*Zr;function Hh(i,e){const{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new It(i+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:n,interpolationType:l}=r;let d=0;for(;d<n.length&&n[d]<=i;)d++;d=Math.max(0,d-1);let p=d;for(;p<n.length&&n[p]<i+1;)p++;p=Math.min(n.length-1,p);const f=n[d],_=n[p];return r.kind==="composite"?{kind:"composite",minZoom:f,maxZoom:_,interpolationType:l}:{kind:"camera",minZoom:f,maxZoom:_,minSize:r.evaluate(new It(f)),maxSize:r.evaluate(new It(_)),interpolationType:l}}}function kc(i,e,r){let n="never";const l=i.get(e);return l?n=l:i.get(r)&&(n="always"),n}const Kd=Bs.VectorTileFeature.types,Yd=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Ml(i,e,r,n,l,d,p,f,_,x,S,E,k){const D=f?Math.min(Os,Math.round(f[0])):0,R=f?Math.min(Os,Math.round(f[1])):0;i.emplaceBack(e,r,Math.round(32*n),Math.round(32*l),d,p,(D<<1)+(_?1:0),R,16*x,16*S,256*E,256*k)}function Cc(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 Qd(i){for(const e of i.sections)if(ua(e.text))return!0;return!1}class Mc{constructor(e){this.layoutVertexArray=new Qi,this.indexArray=new Qt,this.programConfigurations=e,this.segments=new Kt,this.dynamicLayoutVertexArray=new Ur,this.opacityVertexArray=new zs,this.hasVisibleVertices=!1,this.placedSymbolArray=new Lt}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,n,l){this.isEmpty()||(n&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,kd.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Cd.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Yd,!0),this.opacityVertexBuffer.itemSize=1),(n||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())}}Re("SymbolBuffers",Mc);class zc{constructor(e,r,n){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new n,this.segments=new Kt,this.collisionVertexArray=new pi}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Md.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Re("CollisionBuffers",zc);class go{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=dc([]),this.placementViewportMatrix=dc([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Hh(this.zoom,r["text-size"]),this.iconSizeData=Hh(this.zoom,r["icon-size"]);const n=this.layers[0].layout,l=n.get("symbol-sort-key"),d=n.get("symbol-z-order");this.canOverlap=kc(n,"text-overlap","text-allow-overlap")!=="never"||kc(n,"icon-overlap","icon-allow-overlap")!=="never"||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey=d!=="viewport-y"&&!l.isConstant(),this.sortFeaturesByY=(d==="viewport-y"||d==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,n.get("symbol-placement")==="point"&&(this.writingModes=n.get("text-writing-mode").map(p=>T.ai[p])),this.stateDependentLayerIds=this.layers.filter(p=>p.isStateDependent()).map(p=>p.id),this.sourceID=e.sourceID}createArrays(){this.text=new Mc(new yn(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Mc(new yn(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Rt,this.lineVertexArray=new Ii,this.symbolInstances=new Ki,this.textAnchorOffsets=new hi}calculateGlyphDependencies(e,r,n,l,d){for(let p=0;p<e.length;p++)if(r[e.charCodeAt(p)]=!0,(n||l)&&d){const f=Ia[e.charAt(p)];f&&(r[f.charCodeAt(0)]=!0)}}populate(e,r,n){const l=this.layers[0],d=l.layout,p=d.get("text-font"),f=d.get("text-field"),_=d.get("icon-image"),x=(f.value.kind!=="constant"||f.value.value instanceof Li&&!f.value.value.isEmpty()||f.value.value.toString().length>0)&&(p.value.kind!=="constant"||p.value.value.length>0),S=_.value.kind!=="constant"||!!_.value.value||Object.keys(_.parameters).length>0,E=d.get("symbol-sort-key");if(this.features=[],!x&&!S)return;const k=r.iconDependencies,D=r.glyphDependencies,R=r.availableImages,O=new It(this.zoom);for(const{feature:U,id:W,index:ne,sourceLayerIndex:Y}of e){const ie=l._featureFilter.needGeometry,ue=vn(U,ie);if(!l._featureFilter.filter(O,ue,n))continue;let xe,ze;if(ie||(ue.geometry=xn(U)),x){const ke=l.getValueAndResolveTokens("text-field",ue,n,R),Ie=Li.factory(ke),Ne=this.hasRTLText=this.hasRTLText||Qd(Ie);(!Ne||jr.getRTLTextPluginStatus()==="unavailable"||Ne&&jr.isParsed())&&(xe=Dd(Ie,l,ue))}if(S){const ke=l.getValueAndResolveTokens("icon-image",ue,n,R);ze=ke instanceof li?ke:li.fromString(ke)}if(!xe&&!ze)continue;const He=this.sortFeaturesByKey?E.evaluate(ue,{},n):void 0;if(this.features.push({id:W,text:xe,icon:ze,index:ne,sourceLayerIndex:Y,geometry:ue.geometry,properties:U.properties,type:Kd[U.type],sortKey:He}),ze&&(k[ze.name]=!0),xe){const ke=p.evaluate(ue,{},n).join(","),Ie=d.get("text-rotation-alignment")!=="viewport"&&d.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(T.ai.vertical)>=0;for(const Ne of xe.sections)if(Ne.image)k[Ne.image.name]=!0;else{const Be=ca(xe.toString()),Le=Ne.fontStack||ke,pe=D[Le]=D[Le]||{};this.calculateGlyphDependencies(Ne.text,pe,Ie,this.allowVerticalPlacement,Be)}}}d.get("symbol-placement")==="line"&&(this.features=function(U){const W={},ne={},Y=[];let ie=0;function ue(ke){Y.push(U[ke]),ie++}function xe(ke,Ie,Ne){const Be=ne[ke];return delete ne[ke],ne[Ie]=Be,Y[Be].geometry[0].pop(),Y[Be].geometry[0]=Y[Be].geometry[0].concat(Ne[0]),Be}function ze(ke,Ie,Ne){const Be=W[Ie];return delete W[Ie],W[ke]=Be,Y[Be].geometry[0].shift(),Y[Be].geometry[0]=Ne[0].concat(Y[Be].geometry[0]),Be}function He(ke,Ie,Ne){const Be=Ne?Ie[0][Ie[0].length-1]:Ie[0][0];return`${ke}:${Be.x}:${Be.y}`}for(let ke=0;ke<U.length;ke++){const Ie=U[ke],Ne=Ie.geometry,Be=Ie.text?Ie.text.toString():null;if(!Be){ue(ke);continue}const Le=He(Be,Ne),pe=He(Be,Ne,!0);if(Le in ne&&pe in W&&ne[Le]!==W[pe]){const Ue=ze(Le,pe,Ne),$e=xe(Le,pe,Y[Ue].geometry);delete W[Le],delete ne[pe],ne[He(Be,Y[$e].geometry,!0)]=$e,Y[Ue].geometry=null}else Le in ne?xe(Le,pe,Ne):pe in W?ze(Le,pe,Ne):(ue(ke),W[Le]=ie-1,ne[pe]=ie-1)}return Y.filter(ke=>ke.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((U,W)=>U.sortKey-W.sortKey)}update(e,r,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,n),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,n))}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 n=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 _=p[f];this.lineVertexArray.emplaceBack(_.x,_.y,_.tileUnitDistanceFromAnchor)}}return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(e,r,n,l,d,p,f,_,x,S,E,k){const D=e.indexArray,R=e.layoutVertexArray,O=e.segments.prepareSegment(4*r.length,R,D,this.canOverlap?p.sortKey:void 0),U=this.glyphOffsetArray.length,W=O.vertexLength,ne=this.allowVerticalPlacement&&f===T.ai.vertical?Math.PI/2:0,Y=p.text&&p.text.sections;for(let ie=0;ie<r.length;ie++){const{tl:ue,tr:xe,bl:ze,br:He,tex:ke,pixelOffsetTL:Ie,pixelOffsetBR:Ne,minFontScaleX:Be,minFontScaleY:Le,glyphOffset:pe,isSDF:Ue,sectionIndex:$e}=r[ie],Ye=O.vertexLength,St=pe[1];Ml(R,_.x,_.y,ue.x,St+ue.y,ke.x,ke.y,n,Ue,Ie.x,Ie.y,Be,Le),Ml(R,_.x,_.y,xe.x,St+xe.y,ke.x+ke.w,ke.y,n,Ue,Ne.x,Ie.y,Be,Le),Ml(R,_.x,_.y,ze.x,St+ze.y,ke.x,ke.y+ke.h,n,Ue,Ie.x,Ne.y,Be,Le),Ml(R,_.x,_.y,He.x,St+He.y,ke.x+ke.w,ke.y+ke.h,n,Ue,Ne.x,Ne.y,Be,Le),Cc(e.dynamicLayoutVertexArray,_,ne),D.emplaceBack(Ye,Ye+1,Ye+2),D.emplaceBack(Ye+1,Ye+2,Ye+3),O.vertexLength+=4,O.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(pe[0]),ie!==r.length-1&&$e===r[ie+1].sectionIndex||e.programConfigurations.populatePaintArrays(R.length,p,p.index,{},k,Y&&Y[$e])}e.placedSymbolArray.emplaceBack(_.x,_.y,U,this.glyphOffsetArray.length-U,W,x,S,_.segment,n?n[0]:0,n?n[1]:0,l[0],l[1],f,0,!1,0,E)}_addCollisionDebugVertex(e,r,n,l,d,p){return r.emplaceBack(0,0),e.emplaceBack(n.x,n.y,l,d,Math.round(p.x),Math.round(p.y))}addCollisionDebugVertices(e,r,n,l,d,p,f){const _=d.segments.prepareSegment(4,d.layoutVertexArray,d.indexArray),x=_.vertexLength,S=d.layoutVertexArray,E=d.collisionVertexArray,k=f.anchorX,D=f.anchorY;this._addCollisionDebugVertex(S,E,p,k,D,new ae(e,r)),this._addCollisionDebugVertex(S,E,p,k,D,new ae(n,r)),this._addCollisionDebugVertex(S,E,p,k,D,new ae(n,l)),this._addCollisionDebugVertex(S,E,p,k,D,new ae(e,l)),_.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),_.primitiveLength+=4}addDebugCollisionBoxes(e,r,n,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,n)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new zc(di,Ch.members,Vt),this.iconCollisionBox=new zc(di,Ch.members,Vt);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,n,l,d,p,f,_,x){const S={};for(let E=r;E<n;E++){const k=e.get(E);S.textBox={x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2,anchorPointX:k.anchorPointX,anchorPointY:k.anchorPointY},S.textFeatureIndex=k.featureIndex;break}for(let E=l;E<d;E++){const k=e.get(E);S.verticalTextBox={x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2,anchorPointX:k.anchorPointX,anchorPointY:k.anchorPointY},S.verticalTextFeatureIndex=k.featureIndex;break}for(let E=p;E<f;E++){const k=e.get(E);S.iconBox={x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2,anchorPointX:k.anchorPointX,anchorPointY:k.anchorPointY},S.iconFeatureIndex=k.featureIndex;break}for(let E=_;E<x;E++){const k=e.get(E);S.verticalIconBox={x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2,anchorPointX:k.anchorPointX,anchorPointY:k.anchorPointY},S.verticalIconFeatureIndex=k.featureIndex;break}return S}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const n=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,n.textBoxStartIndex,n.textBoxEndIndex,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex,n.verticalIconBoxStartIndex,n.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 n=e.placedSymbolArray.get(r),l=n.vertexStartIndex+4*n.numGlyphs;for(let d=n.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),n=Math.cos(e),l=[],d=[],p=[];for(let f=0;f<this.symbolInstances.length;++f){p.push(f);const _=this.symbolInstances.get(f);l.push(0|Math.round(r*_.anchorX+n*_.anchorY)),d.push(_.featureIndex)}return p.sort((f,_)=>l[f]-l[_]||d[_]-d[f]),p}addToSortKeyRanges(e,r){const n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===r?n.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 n=this.symbolInstances.get(r);this.featureSortOrder.push(n.featureIndex),[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach((l,d,p)=>{l>=0&&p.indexOf(l)===d&&this.addIndicesForPlacedSymbol(this.text,l)}),n.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,n.verticalPlacedTextSymbolIndex),n.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.placedIconSymbolIndex),n.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Wh,Xh;Re("SymbolBucket",go,{omit:["layers","collisionBoxArray","features","compareText"]}),go.MAX_GLYPHS=65535,go.addDynamicAttributes=Cc;var Dc={get paint(){return Xh=Xh||new o({"icon-opacity":new We(he.paint_symbol["icon-opacity"]),"icon-color":new We(he.paint_symbol["icon-color"]),"icon-halo-color":new We(he.paint_symbol["icon-halo-color"]),"icon-halo-width":new We(he.paint_symbol["icon-halo-width"]),"icon-halo-blur":new We(he.paint_symbol["icon-halo-blur"]),"icon-translate":new je(he.paint_symbol["icon-translate"]),"icon-translate-anchor":new je(he.paint_symbol["icon-translate-anchor"]),"text-opacity":new We(he.paint_symbol["text-opacity"]),"text-color":new We(he.paint_symbol["text-color"],{runtimeType:Ei,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new We(he.paint_symbol["text-halo-color"]),"text-halo-width":new We(he.paint_symbol["text-halo-width"]),"text-halo-blur":new We(he.paint_symbol["text-halo-blur"]),"text-translate":new je(he.paint_symbol["text-translate"]),"text-translate-anchor":new je(he.paint_symbol["text-translate-anchor"])})},get layout(){return Wh=Wh||new o({"symbol-placement":new je(he.layout_symbol["symbol-placement"]),"symbol-spacing":new je(he.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new je(he.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new We(he.layout_symbol["symbol-sort-key"]),"symbol-z-order":new je(he.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new je(he.layout_symbol["icon-allow-overlap"]),"icon-overlap":new je(he.layout_symbol["icon-overlap"]),"icon-ignore-placement":new je(he.layout_symbol["icon-ignore-placement"]),"icon-optional":new je(he.layout_symbol["icon-optional"]),"icon-rotation-alignment":new je(he.layout_symbol["icon-rotation-alignment"]),"icon-size":new We(he.layout_symbol["icon-size"]),"icon-text-fit":new je(he.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new je(he.layout_symbol["icon-text-fit-padding"]),"icon-image":new We(he.layout_symbol["icon-image"]),"icon-rotate":new We(he.layout_symbol["icon-rotate"]),"icon-padding":new We(he.layout_symbol["icon-padding"]),"icon-keep-upright":new je(he.layout_symbol["icon-keep-upright"]),"icon-offset":new We(he.layout_symbol["icon-offset"]),"icon-anchor":new We(he.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new je(he.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new je(he.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new je(he.layout_symbol["text-rotation-alignment"]),"text-field":new We(he.layout_symbol["text-field"]),"text-font":new We(he.layout_symbol["text-font"]),"text-size":new We(he.layout_symbol["text-size"]),"text-max-width":new We(he.layout_symbol["text-max-width"]),"text-line-height":new je(he.layout_symbol["text-line-height"]),"text-letter-spacing":new We(he.layout_symbol["text-letter-spacing"]),"text-justify":new We(he.layout_symbol["text-justify"]),"text-radial-offset":new We(he.layout_symbol["text-radial-offset"]),"text-variable-anchor":new je(he.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new We(he.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new We(he.layout_symbol["text-anchor"]),"text-max-angle":new je(he.layout_symbol["text-max-angle"]),"text-writing-mode":new je(he.layout_symbol["text-writing-mode"]),"text-rotate":new We(he.layout_symbol["text-rotate"]),"text-padding":new je(he.layout_symbol["text-padding"]),"text-keep-upright":new je(he.layout_symbol["text-keep-upright"]),"text-transform":new We(he.layout_symbol["text-transform"]),"text-offset":new We(he.layout_symbol["text-offset"]),"text-allow-overlap":new je(he.layout_symbol["text-allow-overlap"]),"text-overlap":new je(he.layout_symbol["text-overlap"]),"text-ignore-placement":new je(he.layout_symbol["text-ignore-placement"]),"text-optional":new je(he.layout_symbol["text-optional"])})}};class Jh{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:Rr,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}}Re("FormatSectionOverride",Jh,{omit:["defaultValue"]});class zl extends h{constructor(e){super(e,Dc)}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 n=this.layout.get("text-writing-mode");if(n){const l=[];for(const d of n)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,n,l){const d=this.layout.get(e).evaluate(r,{},n,l),p=this._unevaluatedLayout._values[e];return p.isDataDriven()||ln(p.value)||!d?d:function(f,_){return _.replace(/{([^{}]+)}/g,(x,S)=>f&&S in f?String(f[S]):"")}(r.properties,d)}createBucket(e){return new go(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of Dc.paint.overridableProperties){if(!zl.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),n=new Jh(r),l=new Wn(n,r.property.specification);let d=null;d=r.value.kind==="constant"||r.value.kind==="source"?new jo("source",l):new Uo("composite",l,r.value.zoomStops),this.paint._values[e]=new mr(r.property,d,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,n){return!(!this.layout||r.isDataDriven()||n.isDataDriven())&&zl.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const n=e.get("text-field"),l=Dc.paint.properties[r];let d=!1;const p=f=>{for(const _ of f)if(l.overrides&&l.overrides.hasOverride(_))return void(d=!0)};if(n.value.kind==="constant"&&n.value.value instanceof Li)p(n.value.value.sections);else if(n.value.kind==="source"){const f=x=>{d||(x instanceof Qr&&Wt(x.value)===wr?p(x.value.sections):x instanceof Rn?p(x.sections):x.eachChild(f))},_=n.value;_._styleExpression&&f(_._styleExpression.expression)}return d}}let Kh;var ep={get paint(){return Kh=Kh||new o({"background-color":new je(he.paint_background["background-color"]),"background-pattern":new t(he.paint_background["background-pattern"]),"background-opacity":new je(he.paint_background["background-opacity"])})}};class tp extends h{constructor(e){super(e,ep)}}let Yh;var ip={get paint(){return Yh=Yh||new o({"raster-opacity":new je(he.paint_raster["raster-opacity"]),"raster-hue-rotate":new je(he.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new je(he.paint_raster["raster-brightness-min"]),"raster-brightness-max":new je(he.paint_raster["raster-brightness-max"]),"raster-saturation":new je(he.paint_raster["raster-saturation"]),"raster-contrast":new je(he.paint_raster["raster-contrast"]),"raster-resampling":new je(he.paint_raster["raster-resampling"]),"raster-fade-duration":new je(he.paint_raster["raster-fade-duration"])})}};class rp extends h{constructor(e){super(e,ip)}}class sp 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 np{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 Lc=63710088e-1;class Vs{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 Vs(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,n=this.lat*r,l=e.lat*r,d=Math.sin(n)*Math.sin(l)+Math.cos(n)*Math.cos(l)*Math.cos((e.lng-this.lng)*r);return Lc*Math.acos(Math.min(d,1))}static convert(e){if(e instanceof Vs)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Vs(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Vs(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 Qh=2*Math.PI*Lc;function eu(i){return Qh*Math.cos(i*Math.PI/180)}function tu(i){return(180+i)/360}function iu(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function ru(i,e){return i/eu(e)}function Rc(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class Dl{constructor(e,r,n=0){this.x=+e,this.y=+r,this.z=+n}static fromLngLat(e,r=0){const n=Vs.convert(e);return new Dl(tu(n.lng),iu(n.lat),ru(r,n.lat))}toLngLat(){return new Vs(360*this.x-180,Rc(this.y))}toAltitude(){return this.z*eu(Rc(this.y))}meterInMercatorCoordinateUnits(){return 1/Qh*(e=Rc(this.y),1/Math.cos(e*Math.PI/180));var e}}function su(i,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r);return[i*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}class Bc{constructor(e,r,n){if(e<0||e>25||n<0||n>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error(`x=${r}, y=${n}, 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=n,this.key=Ma(0,e,e,r,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,n){const l=(p=this.y,f=this.z,_=su(256*(d=this.x),256*(p=Math.pow(2,f)-p-1),f),x=su(256*(d+1),256*(p+1),f),_[0]+","+_[1]+","+x[0]+","+x[1]);var d,p,f,_,x;const S=function(E,k,D){let R,O="";for(let U=E;U>0;U--)R=1<<U-1,O+=(k&R?1:0)+(D&R?2:0);return O}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(n==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,S).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 ae((e.x*r-this.x)*Xt,(e.y*r-this.y)*Xt)}toString(){return`${this.z}/${this.x}/${this.y}`}}class nu{constructor(e,r){this.wrap=e,this.canonical=r,this.key=Ma(e,r.z,r.z,r.x,r.y)}}class tr{constructor(e,r,n,l,d){if(e<n)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${n}`);this.overscaledZ=e,this.wrap=r,this.canonical=new Bc(n,+l,+d),this.key=Ma(r,e,n,l,d)}clone(){return new tr(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 tr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new tr(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 n=this.canonical.z-e;return e>this.canonical.z?Ma(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Ma(this.wrap*+r,e,e,this.canonical.x>>n,this.canonical.y>>n)}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 tr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,n=2*this.canonical.x,l=2*this.canonical.y;return[new tr(r,this.wrap,r,n,l),new tr(r,this.wrap,r,n+1,l),new tr(r,this.wrap,r,n,l+1),new tr(r,this.wrap,r,n+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 tr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new tr(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 nu(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new Dl(e.x-this.wrap,e.y))}}function Ma(i,e,r,n,l){(i*=2)<0&&(i=-1*i-1);const d=1<<r;return(d*d*i+d*l+n).toString(36)+r.toString(36)+e.toString(36)}Re("CanonicalTileID",Bc),Re("OverscaledTileID",tr,{omit:["posMatrix"]});class ou{constructor(e,r,n,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(n&&!["mapbox","terrarium","custom"].includes(n))return void ni(`"${n}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=r.height;const _=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),n){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<_;x++)this.data[this._idx(-1,x)]=this.data[this._idx(0,x)],this.data[this._idx(_,x)]=this.data[this._idx(_-1,x)],this.data[this._idx(x,-1)]=this.data[this._idx(x,0)],this.data[this._idx(x,_)]=this.data[this._idx(x,_-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(_,-1)]=this.data[this._idx(_-1,0)],this.data[this._idx(-1,_)]=this.data[this._idx(0,_-1)],this.data[this._idx(_,_)]=this.data[this._idx(_-1,_-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let x=0;x<_;x++)for(let S=0;S<_;S++){const E=this.get(x,S);E>this.max&&(this.max=E),E<this.min&&(this.min=E)}}get(e,r){const n=new Uint8Array(this.data.buffer),l=4*this._idx(e,r);return this.unpack(n[l],n[l+1],n[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,n){return e*this.redFactor+r*this.greenFactor+n*this.blueFactor-this.baseShift}getPixels(){return new er({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,n){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let l=r*this.dim,d=r*this.dim+this.dim,p=n*this.dim,f=n*this.dim+this.dim;switch(r){case-1:l=d-1;break;case 1:d=l+1}switch(n){case-1:p=f-1;break;case 1:f=p+1}const _=-r*this.dim,x=-n*this.dim;for(let S=p;S<f;S++)for(let E=l;E<d;E++)this.data[this._idx(E,S)]=e.data[this._idx(E+_,S+x)]}}Re("DEMData",ou);class au{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){const n=e[r];this._stringToNumber[n]=r,this._numberToString[r]=n}}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 lu{constructor(e,r,n,l,d){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=n,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 cu{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Ps(Xt,16,0),this.grid3D=new Ps(Xt,16,0),this.featureIndexArray=new Yi,this.promoteId=r}insert(e,r,n,l,d,p){const f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,l,d);const _=p?this.grid3D:this.grid;for(let x=0;x<r.length;x++){const S=r[x],E=[1/0,1/0,-1/0,-1/0];for(let k=0;k<S.length;k++){const D=S[k];E[0]=Math.min(E[0],D.x),E[1]=Math.min(E[1],D.y),E[2]=Math.max(E[2],D.x),E[3]=Math.max(E[3],D.y)}E[0]<Xt&&E[1]<Xt&&E[2]>=0&&E[3]>=0&&_.insert(f,E[0],E[1],E[2],E[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Bs.VectorTile(new Tc(this.rawTileData)).layers,this.sourceLayerCoder=new au(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,n,l){this.loadVTLayers();const d=e.params||{},p=Xt/e.tileSize/e.scale,f=vi(d.filter),_=e.queryGeometry,x=e.queryPadding*p,S=uu(_),E=this.grid.query(S.minX-x,S.minY-x,S.maxX+x,S.maxY+x),k=uu(e.cameraQueryGeometry),D=this.grid3D.query(k.minX-x,k.minY-x,k.maxX+x,k.maxY+x,(U,W,ne,Y)=>function(ie,ue,xe,ze,He){for(const Ie of ie)if(ue<=Ie.x&&xe<=Ie.y&&ze>=Ie.x&&He>=Ie.y)return!0;const ke=[new ae(ue,xe),new ae(ue,He),new ae(ze,He),new ae(ze,xe)];if(ie.length>2){for(const Ie of ke)if(lo(ie,Ie))return!0}for(let Ie=0;Ie<ie.length-1;Ie++)if(Ou(ie[Ie],ie[Ie+1],ke))return!0;return!1}(e.cameraQueryGeometry,U-x,W-x,ne+x,Y+x));for(const U of D)E.push(U);E.sort(op);const R={};let O;for(let U=0;U<E.length;U++){const W=E[U];if(W===O)continue;O=W;const ne=this.featureIndexArray.get(W);let Y=null;this.loadMatchingFeature(R,ne.bucketIndex,ne.sourceLayerIndex,ne.featureIndex,f,d.layers,d.availableImages,r,n,l,(ie,ue,xe)=>(Y||(Y=xn(ie)),ue.queryIntersectsFeature(_,ie,xe,Y,this.z,e.transform,p,e.pixelPosMatrix)))}return R}loadMatchingFeature(e,r,n,l,d,p,f,_,x,S,E){const k=this.bucketLayerIDs[r];if(p&&!function(U,W){for(let ne=0;ne<U.length;ne++)if(W.indexOf(U[ne])>=0)return!0;return!1}(p,k))return;const D=this.sourceLayerCoder.decode(n),R=this.vtLayers[D].feature(l);if(d.needGeometry){const U=vn(R,!0);if(!d.filter(new It(this.tileID.overscaledZ),U,this.tileID.canonical))return}else if(!d.filter(new It(this.tileID.overscaledZ),R))return;const O=this.getId(R,D);for(let U=0;U<k.length;U++){const W=k[U];if(p&&p.indexOf(W)<0)continue;const ne=_[W];if(!ne)continue;let Y={};O&&S&&(Y=S.getState(ne.sourceLayer||"_geojsonTileLayer",O));const ie=Tt({},x[W]);ie.paint=hu(ie.paint,ne.paint,R,Y,f),ie.layout=hu(ie.layout,ne.layout,R,Y,f);const ue=!E||E(R,ne,Y);if(!ue)continue;const xe=new lu(R,this.z,this.x,this.y,O);xe.layer=ie;let ze=e[W];ze===void 0&&(ze=e[W]=[]),ze.push({featureIndex:l,feature:xe,intersectionZ:ue})}}lookupSymbolFeatures(e,r,n,l,d,p,f,_){const x={};this.loadVTLayers();const S=vi(d);for(const E of e)this.loadMatchingFeature(x,n,l,E,S,p,f,_,r);return x}hasLayer(e){for(const r of this.bucketLayerIDs)for(const n of r)if(e===n)return!0;return!1}getId(e,r){let n=e.id;return this.promoteId&&(n=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof n=="boolean"&&(n=Number(n))),n}}function hu(i,e,r,n,l){return si(i,(d,p)=>{const f=e instanceof to?e.get(p):null;return f&&f.evaluate?f.evaluate(r,n,l):f})}function uu(i){let e=1/0,r=1/0,n=-1/0,l=-1/0;for(const d of i)e=Math.min(e,d.x),r=Math.min(r,d.y),n=Math.max(n,d.x),l=Math.max(l,d.y);return{minX:e,minY:r,maxX:n,maxY:l}}function op(i,e){return e-i}function du(i,e,r,n,l){const d=[];for(let p=0;p<i.length;p++){const f=i[p];let _;for(let x=0;x<f.length-1;x++){let S=f[x],E=f[x+1];S.x<e&&E.x<e||(S.x<e?S=new ae(e,S.y+(e-S.x)/(E.x-S.x)*(E.y-S.y))._round():E.x<e&&(E=new ae(e,S.y+(e-S.x)/(E.x-S.x)*(E.y-S.y))._round()),S.y<r&&E.y<r||(S.y<r?S=new ae(S.x+(r-S.y)/(E.y-S.y)*(E.x-S.x),r)._round():E.y<r&&(E=new ae(S.x+(r-S.y)/(E.y-S.y)*(E.x-S.x),r)._round()),S.x>=n&&E.x>=n||(S.x>=n?S=new ae(n,S.y+(n-S.x)/(E.x-S.x)*(E.y-S.y))._round():E.x>=n&&(E=new ae(n,S.y+(n-S.x)/(E.x-S.x)*(E.y-S.y))._round()),S.y>=l&&E.y>=l||(S.y>=l?S=new ae(S.x+(l-S.y)/(E.y-S.y)*(E.x-S.x),l)._round():E.y>=l&&(E=new ae(S.x+(l-S.y)/(E.y-S.y)*(E.x-S.x),l)._round()),_&&S.equals(_[_.length-1])||(_=[S],d.push(_)),_.push(E)))))}}return d}Re("FeatureIndex",cu,{omit:["rawTileData","sourceLayerCoder"]});class $s extends ae{constructor(e,r,n,l){super(e,r),this.angle=n,l!==void 0&&(this.segment=l)}clone(){return new $s(this.x,this.y,this.angle,this.segment)}}function pu(i,e,r,n,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 _=[];let x=0;for(;f<r/2;){const S=i[p],E=i[p+1];if(!E)return!1;let k=i[p-1].angleTo(S)-S.angleTo(E);for(k=Math.abs((k+3*Math.PI)%(2*Math.PI)-Math.PI),_.push({distance:f,angleDelta:k}),x+=k;f-_[0].distance>n;)x-=_.shift().angleDelta;if(x>l)return!1;p++,f+=S.dist(E)}return!0}function fu(i){let e=0;for(let r=0;r<i.length-1;r++)e+=i[r].dist(i[r+1]);return e}function mu(i,e,r){return i?.6*e*r:0}function gu(i,e){return Math.max(i?i.right-i.left:0,e?e.right-e.left:0)}function ap(i,e,r,n,l,d){const p=mu(r,l,d),f=gu(r,n)*d;let _=0;const x=fu(i)/2;for(let S=0;S<i.length-1;S++){const E=i[S],k=i[S+1],D=E.dist(k);if(_+D>x){const R=(x-_)/D,O=Fi.number(E.x,k.x,R),U=Fi.number(E.y,k.y,R),W=new $s(O,U,k.angleTo(E),S);return W._round(),!p||pu(i,W,f,p,e)?W:void 0}_+=D}}function lp(i,e,r,n,l,d,p,f,_){const x=mu(n,d,p),S=gu(n,l),E=S*p,k=i[0].x===0||i[0].x===_||i[0].y===0||i[0].y===_;return e-E<e/4&&(e=E+e/4),_u(i,k?e/2*f%e:(S/2+2*d)*p*f%e,e,x,r,E,k,!1,_)}function _u(i,e,r,n,l,d,p,f,_){const x=d/2,S=fu(i);let E=0,k=e-r,D=[];for(let R=0;R<i.length-1;R++){const O=i[R],U=i[R+1],W=O.dist(U),ne=U.angleTo(O);for(;k+r<E+W;){k+=r;const Y=(k-E)/W,ie=Fi.number(O.x,U.x,Y),ue=Fi.number(O.y,U.y,Y);if(ie>=0&&ie<_&&ue>=0&&ue<_&&k-x>=0&&k+x<=S){const xe=new $s(ie,ue,ne,R);xe._round(),n&&!pu(i,xe,d,n,l)||D.push(xe)}}E+=W}return f||D.length||p||(D=_u(i,E/2,r,n,l,d,p,!0,_)),D}Re("Anchor",$s);const _o=$i;function yu(i,e,r,n){const l=[],d=i.image,p=d.pixelRatio,f=d.paddedRect.w-2*_o,_=d.paddedRect.h-2*_o;let x={x1:i.left,y1:i.top,x2:i.right,y2:i.bottom};const S=d.stretchX||[[0,f]],E=d.stretchY||[[0,_]],k=(pe,Ue)=>pe+Ue[1]-Ue[0],D=S.reduce(k,0),R=E.reduce(k,0),O=f-D,U=_-R;let W=0,ne=D,Y=0,ie=R,ue=0,xe=O,ze=0,He=U;if(d.content&&n){const pe=d.content,Ue=pe[2]-pe[0],$e=pe[3]-pe[1];(d.textFitWidth||d.textFitHeight)&&(x=Zh(i)),W=Ll(S,0,pe[0]),Y=Ll(E,0,pe[1]),ne=Ll(S,pe[0],pe[2]),ie=Ll(E,pe[1],pe[3]),ue=pe[0]-W,ze=pe[1]-Y,xe=Ue-ne,He=$e-ie}const ke=x.x1,Ie=x.y1,Ne=x.x2-ke,Be=x.y2-Ie,Le=(pe,Ue,$e,Ye)=>{const St=Rl(pe.stretch-W,ne,Ne,ke),wt=Bl(pe.fixed-ue,xe,pe.stretch,D),ei=Rl(Ue.stretch-Y,ie,Be,Ie),gr=Bl(Ue.fixed-ze,He,Ue.stretch,R),mi=Rl($e.stretch-W,ne,Ne,ke),Ut=Bl($e.fixed-ue,xe,$e.stretch,D),ki=Rl(Ye.stretch-Y,ie,Be,Ie),Ci=Bl(Ye.fixed-ze,He,Ye.stretch,R),Mi=new ae(St,ei),qt=new ae(mi,ei),ti=new ae(mi,ki),wi=new ae(St,ki),gi=new ae(wt/p,gr/p),zi=new ae(Ut/p,Ci/p),_i=e*Math.PI/180;if(_i){const ft=Math.sin(_i),Pt=Math.cos(_i),Bt=[Pt,-ft,ft,Pt];Mi._matMult(Bt),qt._matMult(Bt),wi._matMult(Bt),ti._matMult(Bt)}const ir=pe.stretch+pe.fixed,Ni=Ue.stretch+Ue.fixed;return{tl:Mi,tr:qt,bl:wi,br:ti,tex:{x:d.paddedRect.x+_o+ir,y:d.paddedRect.y+_o+Ni,w:$e.stretch+$e.fixed-ir,h:Ye.stretch+Ye.fixed-Ni},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:gi,pixelOffsetBR:zi,minFontScaleX:xe/p/Ne,minFontScaleY:He/p/Be,isSDF:r}};if(n&&(d.stretchX||d.stretchY)){const pe=xu(S,O,D),Ue=xu(E,U,R);for(let $e=0;$e<pe.length-1;$e++){const Ye=pe[$e],St=pe[$e+1];for(let wt=0;wt<Ue.length-1;wt++)l.push(Le(Ye,Ue[wt],St,Ue[wt+1]))}}else l.push(Le({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:f+1},{fixed:0,stretch:_+1}));return l}function Ll(i,e,r){let n=0;for(const l of i)n+=Math.max(e,Math.min(r,l[1]))-Math.max(e,Math.min(r,l[0]));return n}function xu(i,e,r){const n=[{fixed:-_o,stretch:0}];for(const[l,d]of i){const p=n[n.length-1];n.push({fixed:l-p.stretch,stretch:p.stretch}),n.push({fixed:l-p.stretch,stretch:p.stretch+(d-l)})}return n.push({fixed:e+_o,stretch:r}),n}function Rl(i,e,r,n){return i/e*r+n}function Bl(i,e,r,n){return i-e*r/n}class Fl{constructor(e,r,n,l,d,p,f,_,x,S){var E;if(this.boxStartIndex=e.length,x){let k=p.top,D=p.bottom;const R=p.collisionPadding;R&&(k-=R[1],D+=R[3]);let O=D-k;O>0&&(O=Math.max(10,O),this.circleDiameter=O)}else{const k=!((E=p.image)===null||E===void 0)&&E.content&&(p.image.textFitWidth||p.image.textFitHeight)?Zh(p):{x1:p.left,y1:p.top,x2:p.right,y2:p.bottom};k.y1=k.y1*f-_[0],k.y2=k.y2*f+_[2],k.x1=k.x1*f-_[3],k.x2=k.x2*f+_[1];const D=p.collisionPadding;if(D&&(k.x1-=D[0]*f,k.y1-=D[1]*f,k.x2+=D[2]*f,k.y2+=D[3]*f),S){const R=new ae(k.x1,k.y1),O=new ae(k.x2,k.y1),U=new ae(k.x1,k.y2),W=new ae(k.x2,k.y2),ne=S*Math.PI/180;R._rotate(ne),O._rotate(ne),U._rotate(ne),W._rotate(ne),k.x1=Math.min(R.x,O.x,U.x,W.x),k.x2=Math.max(R.x,O.x,U.x,W.x),k.y1=Math.min(R.y,O.y,U.y,W.y),k.y2=Math.max(R.y,O.y,U.y,W.y)}e.emplaceBack(r.x,r.y,k.x1,k.y1,k.x2,k.y2,n,l,d)}this.boxEndIndex=e.length}}class cp{constructor(e=[],r=(n,l)=>n<l?-1:n>l?1:0){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}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:n}=this,l=r[e];for(;e>0;){const d=e-1>>1,p=r[d];if(n(l,p)>=0)break;r[e]=p,e=d}r[e]=l}_down(e){const{data:r,compare:n}=this,l=this.length>>1,d=r[e];for(;e<l;){let p=1+(e<<1);const f=p+1;if(f<this.length&&n(r[f],r[p])<0&&(p=f),n(r[p],d)>=0)break;r[e]=r[p],e=p}r[e]=d}}function hp(i,e=1,r=!1){let n=1/0,l=1/0,d=-1/0,p=-1/0;const f=i[0];for(let D=0;D<f.length;D++){const R=f[D];(!D||R.x<n)&&(n=R.x),(!D||R.y<l)&&(l=R.y),(!D||R.x>d)&&(d=R.x),(!D||R.y>p)&&(p=R.y)}const _=Math.min(d-n,p-l);let x=_/2;const S=new cp([],up);if(_===0)return new ae(n,l);for(let D=n;D<d;D+=_)for(let R=l;R<p;R+=_)S.push(new yo(D+x,R+x,x,i));let E=function(D){let R=0,O=0,U=0;const W=D[0];for(let ne=0,Y=W.length,ie=Y-1;ne<Y;ie=ne++){const ue=W[ne],xe=W[ie],ze=ue.x*xe.y-xe.x*ue.y;O+=(ue.x+xe.x)*ze,U+=(ue.y+xe.y)*ze,R+=3*ze}return new yo(O/R,U/R,0,D)}(i),k=S.length;for(;S.length;){const D=S.pop();(D.d>E.d||!E.d)&&(E=D,r&&console.log("found best %d after %d probes",Math.round(1e4*D.d)/1e4,k)),D.max-E.d<=e||(x=D.h/2,S.push(new yo(D.p.x-x,D.p.y-x,x,i)),S.push(new yo(D.p.x+x,D.p.y-x,x,i)),S.push(new yo(D.p.x-x,D.p.y+x,x,i)),S.push(new yo(D.p.x+x,D.p.y+x,x,i)),k+=4)}return r&&(console.log(`num probes: ${k}`),console.log(`best distance: ${E.d}`)),E.p}function up(i,e){return e.max-i.max}function yo(i,e,r,n){this.p=new ae(i,e),this.h=r,this.d=function(l,d){let p=!1,f=1/0;for(let _=0;_<d.length;_++){const x=d[_];for(let S=0,E=x.length,k=E-1;S<E;k=S++){const D=x[S],R=x[k];D.y>l.y!=R.y>l.y&&l.x<(R.x-D.x)*(l.y-D.y)/(R.y-D.y)+D.x&&(p=!p),f=Math.min(f,ih(l,D,R))}}return(p?1:-1)*Math.sqrt(f)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}var fi;T.ar=void 0,(fi=T.ar||(T.ar={}))[fi.center=1]="center",fi[fi.left=2]="left",fi[fi.right=3]="right",fi[fi.top=4]="top",fi[fi.bottom=5]="bottom",fi[fi["top-left"]=6]="top-left",fi[fi["top-right"]=7]="top-right",fi[fi["bottom-left"]=8]="bottom-left",fi[fi["bottom-right"]=9]="bottom-right";const Ns=7,Fc=Number.POSITIVE_INFINITY;function vu(i,e){return e[1]!==Fc?function(r,n,l){let d=0,p=0;switch(n=Math.abs(n),l=Math.abs(l),r){case"top-right":case"top-left":case"top":p=l-Ns;break;case"bottom-right":case"bottom-left":case"bottom":p=-l+Ns}switch(r){case"top-right":case"bottom-right":case"right":d=-n;break;case"top-left":case"bottom-left":case"left":d=n}return[d,p]}(i,e[0],e[1]):function(r,n){let l=0,d=0;n<0&&(n=0);const p=n/Math.SQRT2;switch(r){case"top-right":case"top-left":d=p-Ns;break;case"bottom-right":case"bottom-left":d=-p+Ns;break;case"bottom":d=-n+Ns;break;case"top":d=n-Ns}switch(r){case"top-right":case"bottom-right":l=-p;break;case"top-left":case"bottom-left":l=p;break;case"left":l=n;break;case"right":l=-n}return[l,d]}(i,e[0])}function bu(i,e,r){var n;const l=i.layout,d=(n=l.get("text-variable-anchor-offset"))===null||n===void 0?void 0:n.evaluate(e,{},r);if(d){const f=d.values,_=[];for(let x=0;x<f.length;x+=2){const S=_[x]=f[x],E=f[x+1].map(k=>k*Yt);S.startsWith("top")?E[1]-=Ns:S.startsWith("bottom")&&(E[1]+=Ns),_[x+1]=E}return new Bi(_)}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)*Yt,Fc]:l.get("text-offset").evaluate(e,{},r).map(x=>x*Yt);const _=[];for(const x of p)_.push(x,vu(x,f));return new Bi(_)}return null}function Oc(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 dp(i,e,r,n,l,d,p,f,_,x,S){let E=d.textMaxSize.evaluate(e,{});E===void 0&&(E=p);const k=i.layers[0].layout,D=k.get("icon-offset").evaluate(e,{},S),R=Su(r.horizontal),O=p/24,U=i.tilePixelRatio*O,W=i.tilePixelRatio*E/24,ne=i.tilePixelRatio*f,Y=i.tilePixelRatio*k.get("symbol-spacing"),ie=k.get("text-padding")*i.tilePixelRatio,ue=function(pe,Ue,$e,Ye=1){const St=pe.get("icon-padding").evaluate(Ue,{},$e),wt=St&&St.values;return[wt[0]*Ye,wt[1]*Ye,wt[2]*Ye,wt[3]*Ye]}(k,e,S,i.tilePixelRatio),xe=k.get("text-max-angle")/180*Math.PI,ze=k.get("text-rotation-alignment")!=="viewport"&&k.get("symbol-placement")!=="point",He=k.get("icon-rotation-alignment")==="map"&&k.get("symbol-placement")!=="point",ke=k.get("symbol-placement"),Ie=Y/2,Ne=k.get("icon-text-fit");let Be;n&&Ne!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Be=Gh(n,r.vertical,Ne,k.get("icon-text-fit-padding"),D,O)),R&&(n=Gh(n,R,Ne,k.get("icon-text-fit-padding"),D,O)));const Le=(pe,Ue)=>{Ue.x<0||Ue.x>=Xt||Ue.y<0||Ue.y>=Xt||function($e,Ye,St,wt,ei,gr,mi,Ut,ki,Ci,Mi,qt,ti,wi,gi,zi,_i,ir,Ni,ft,Pt,Bt,Zi,jt,xo){const Gr=$e.addToLineVertexArray(Ye,St);let Hr,_r,rr,ri,ps=0,La=0,Iu=0,Pu=0,Gc=-1,Hc=-1;const fs={};let ku=oo("");if($e.allowVerticalPlacement&&wt.vertical){const Si=Ut.layout.get("text-rotate").evaluate(Pt,{},jt)+90;rr=new Fl(ki,Ye,Ci,Mi,qt,wt.vertical,ti,wi,gi,Si),mi&&(ri=new Fl(ki,Ye,Ci,Mi,qt,mi,_i,ir,gi,Si))}if(ei){const Si=Ut.layout.get("icon-rotate").evaluate(Pt,{}),sr=Ut.layout.get("icon-text-fit")!=="none",wn=yu(ei,Si,Zi,sr),kr=mi?yu(mi,Si,Zi,sr):void 0;_r=new Fl(ki,Ye,Ci,Mi,qt,ei,_i,ir,!1,Si),ps=4*wn.length;const Sn=$e.iconSizeData;let Wr=null;Sn.kind==="source"?(Wr=[Zr*Ut.layout.get("icon-size").evaluate(Pt,{})],Wr[0]>Os&&ni(`${$e.layerIds[0]}: Value for "icon-size" is >= ${Ca}. Reduce your "icon-size".`)):Sn.kind==="composite"&&(Wr=[Zr*Bt.compositeIconSizes[0].evaluate(Pt,{},jt),Zr*Bt.compositeIconSizes[1].evaluate(Pt,{},jt)],(Wr[0]>Os||Wr[1]>Os)&&ni(`${$e.layerIds[0]}: Value for "icon-size" is >= ${Ca}. Reduce your "icon-size".`)),$e.addSymbols($e.icon,wn,Wr,ft,Ni,Pt,T.ai.none,Ye,Gr.lineStartIndex,Gr.lineLength,-1,jt),Gc=$e.icon.placedSymbolArray.length-1,kr&&(La=4*kr.length,$e.addSymbols($e.icon,kr,Wr,ft,Ni,Pt,T.ai.vertical,Ye,Gr.lineStartIndex,Gr.lineLength,-1,jt),Hc=$e.icon.placedSymbolArray.length-1)}const Cu=Object.keys(wt.horizontal);for(const Si of Cu){const sr=wt.horizontal[Si];if(!Hr){ku=oo(sr.text);const kr=Ut.layout.get("text-rotate").evaluate(Pt,{},jt);Hr=new Fl(ki,Ye,Ci,Mi,qt,sr,ti,wi,gi,kr)}const wn=sr.positionedLines.length===1;if(Iu+=wu($e,Ye,sr,gr,Ut,gi,Pt,zi,Gr,wt.vertical?T.ai.horizontal:T.ai.horizontalOnly,wn?Cu:[Si],fs,Gc,Bt,jt),wn)break}wt.vertical&&(Pu+=wu($e,Ye,wt.vertical,gr,Ut,gi,Pt,zi,Gr,T.ai.vertical,["vertical"],fs,Hc,Bt,jt));const mp=Hr?Hr.boxStartIndex:$e.collisionBoxArray.length,gp=Hr?Hr.boxEndIndex:$e.collisionBoxArray.length,_p=rr?rr.boxStartIndex:$e.collisionBoxArray.length,yp=rr?rr.boxEndIndex:$e.collisionBoxArray.length,xp=_r?_r.boxStartIndex:$e.collisionBoxArray.length,vp=_r?_r.boxEndIndex:$e.collisionBoxArray.length,bp=ri?ri.boxStartIndex:$e.collisionBoxArray.length,wp=ri?ri.boxEndIndex:$e.collisionBoxArray.length;let Pr=-1;const Vl=(Si,sr)=>Si&&Si.circleDiameter?Math.max(Si.circleDiameter,sr):sr;Pr=Vl(Hr,Pr),Pr=Vl(rr,Pr),Pr=Vl(_r,Pr),Pr=Vl(ri,Pr);const Mu=Pr>-1?1:0;Mu&&(Pr*=xo/Yt),$e.glyphOffsetArray.length>=go.MAX_GLYPHS&&ni("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Pt.sortKey!==void 0&&$e.addToSortKeyRanges($e.symbolInstances.length,Pt.sortKey);const Sp=bu(Ut,Pt,jt),[Tp,Ep]=function(Si,sr){const wn=Si.length,kr=sr==null?void 0:sr.values;if((kr==null?void 0:kr.length)>0)for(let Sn=0;Sn<kr.length;Sn+=2){const Wr=kr[Sn+1];Si.emplaceBack(T.ar[kr[Sn]],Wr[0],Wr[1])}return[wn,Si.length]}($e.textAnchorOffsets,Sp);$e.symbolInstances.emplaceBack(Ye.x,Ye.y,fs.right>=0?fs.right:-1,fs.center>=0?fs.center:-1,fs.left>=0?fs.left:-1,fs.vertical||-1,Gc,Hc,ku,mp,gp,_p,yp,xp,vp,bp,wp,Ci,Iu,Pu,ps,La,Mu,0,ti,Pr,Tp,Ep)}(i,Ue,pe,r,n,l,Be,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,U,[ie,ie,ie,ie],ze,_,ne,ue,He,D,e,d,x,S,p)};if(ke==="line")for(const pe of du(e.geometry,0,0,Xt,Xt)){const Ue=lp(pe,Y,xe,r.vertical||R,n,24,W,i.overscaling,Xt);for(const $e of Ue)R&&pp(i,R.text,Ie,$e)||Le(pe,$e)}else if(ke==="line-center"){for(const pe of e.geometry)if(pe.length>1){const Ue=ap(pe,xe,r.vertical||R,n,24,W);Ue&&Le(pe,Ue)}}else if(e.type==="Polygon")for(const pe of Fn(e.geometry,0)){const Ue=hp(pe,16);Le(pe[0],new $s(Ue.x,Ue.y,0))}else if(e.type==="LineString")for(const pe of e.geometry)Le(pe,new $s(pe[0].x,pe[0].y,0));else if(e.type==="Point")for(const pe of e.geometry)for(const Ue of pe)Le([Ue],new $s(Ue.x,Ue.y,0))}function wu(i,e,r,n,l,d,p,f,_,x,S,E,k,D,R){const O=function(ne,Y,ie,ue,xe,ze,He,ke){const Ie=ue.layout.get("text-rotate").evaluate(ze,{})*Math.PI/180,Ne=[];for(const Be of Y.positionedLines)for(const Le of Be.positionedGlyphs){if(!Le.rect)continue;const pe=Le.rect||{};let Ue=Oh+1,$e=!0,Ye=1,St=0;const wt=(xe||ke)&&Le.vertical,ei=Le.metrics.advance*Le.scale/2;if(ke&&Y.verticalizable&&(St=Be.lineOffset/2-(Le.imageName?-(Yt-Le.metrics.width*Le.scale)/2:(Le.scale-1)*Yt)),Le.imageName){const ft=He[Le.imageName];$e=ft.sdf,Ye=ft.pixelRatio,Ue=$i/Ye}const gr=xe?[Le.x+ei,Le.y]:[0,0];let mi=xe?[0,0]:[Le.x+ei+ie[0],Le.y+ie[1]-St],Ut=[0,0];wt&&(Ut=mi,mi=[0,0]);const ki=Le.metrics.isDoubleResolution?2:1,Ci=(Le.metrics.left-Ue)*Le.scale-ei+mi[0],Mi=(-Le.metrics.top-Ue)*Le.scale+mi[1],qt=Ci+pe.w/ki*Le.scale/Ye,ti=Mi+pe.h/ki*Le.scale/Ye,wi=new ae(Ci,Mi),gi=new ae(qt,Mi),zi=new ae(Ci,ti),_i=new ae(qt,ti);if(wt){const ft=new ae(-ei,ei-Pa),Pt=-Math.PI/2,Bt=Yt/2-ei,Zi=new ae(5-Pa-Bt,-(Le.imageName?Bt:0)),jt=new ae(...Ut);wi._rotateAround(Pt,ft)._add(Zi)._add(jt),gi._rotateAround(Pt,ft)._add(Zi)._add(jt),zi._rotateAround(Pt,ft)._add(Zi)._add(jt),_i._rotateAround(Pt,ft)._add(Zi)._add(jt)}if(Ie){const ft=Math.sin(Ie),Pt=Math.cos(Ie),Bt=[Pt,-ft,ft,Pt];wi._matMult(Bt),gi._matMult(Bt),zi._matMult(Bt),_i._matMult(Bt)}const ir=new ae(0,0),Ni=new ae(0,0);Ne.push({tl:wi,tr:gi,bl:zi,br:_i,tex:pe,writingMode:Y.writingMode,glyphOffset:gr,sectionIndex:Le.sectionIndex,isSDF:$e,pixelOffsetTL:ir,pixelOffsetBR:Ni,minFontScaleX:0,minFontScaleY:0})}return Ne}(0,r,f,l,d,p,n,i.allowVerticalPlacement),U=i.textSizeData;let W=null;U.kind==="source"?(W=[Zr*l.layout.get("text-size").evaluate(p,{})],W[0]>Os&&ni(`${i.layerIds[0]}: Value for "text-size" is >= ${Ca}. Reduce your "text-size".`)):U.kind==="composite"&&(W=[Zr*D.compositeTextSizes[0].evaluate(p,{},R),Zr*D.compositeTextSizes[1].evaluate(p,{},R)],(W[0]>Os||W[1]>Os)&&ni(`${i.layerIds[0]}: Value for "text-size" is >= ${Ca}. Reduce your "text-size".`)),i.addSymbols(i.text,O,W,f,d,p,x,e,_.lineStartIndex,_.lineLength,k,R);for(const ne of S)E[ne]=i.text.placedSymbolArray.length-1;return 4*O.length}function Su(i){for(const e in i)return i[e];return null}function pp(i,e,r,n){const l=i.compareText;if(e in l){const d=l[e];for(let p=d.length-1;p>=0;p--)if(n.dist(d[p])<r)return!0}else l[e]=[];return l[e].push(n),!1}const Tu=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Vc{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[r,n]=new Uint8Array(e,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");const l=n>>4;if(l!==1)throw new Error(`Got v${l} data when expected v1.`);const d=Tu[15&n];if(!d)throw new Error("Unrecognized array type.");const[p]=new Uint16Array(e,2,1),[f]=new Uint32Array(e,4,1);return new Vc(f,p,d,e)}constructor(e,r=64,n=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=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const d=Tu.indexOf(this.ArrayType),p=2*e*this.ArrayType.BYTES_PER_ELEMENT,f=e*this.IndexArrayType.BYTES_PER_ELEMENT,_=(8-f%8)%8;if(d<0)throw new Error(`Unexpected typed array class: ${n}.`);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+_,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+p+f+_),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+_,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+d]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=e)}add(e,r){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=r,n}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return $c(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,n,l){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:d,coords:p,nodeSize:f}=this,_=[0,d.length-1,0],x=[];for(;_.length;){const S=_.pop()||0,E=_.pop()||0,k=_.pop()||0;if(E-k<=f){for(let U=k;U<=E;U++){const W=p[2*U],ne=p[2*U+1];W>=e&&W<=n&&ne>=r&&ne<=l&&x.push(d[U])}continue}const D=k+E>>1,R=p[2*D],O=p[2*D+1];R>=e&&R<=n&&O>=r&&O<=l&&x.push(d[D]),(S===0?e<=R:r<=O)&&(_.push(k),_.push(D-1),_.push(1-S)),(S===0?n>=R:l>=O)&&(_.push(D+1),_.push(E),_.push(1-S))}return x}within(e,r,n){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],_=[],x=n*n;for(;f.length;){const S=f.pop()||0,E=f.pop()||0,k=f.pop()||0;if(E-k<=p){for(let U=k;U<=E;U++)Au(d[2*U],d[2*U+1],e,r)<=x&&_.push(l[U]);continue}const D=k+E>>1,R=d[2*D],O=d[2*D+1];Au(R,O,e,r)<=x&&_.push(l[D]),(S===0?e-n<=R:r-n<=O)&&(f.push(k),f.push(D-1),f.push(1-S)),(S===0?e+n>=R:r+n>=O)&&(f.push(D+1),f.push(E),f.push(1-S))}return _}}function $c(i,e,r,n,l,d){if(l-n<=r)return;const p=n+l>>1;Eu(i,e,p,n,l,d),$c(i,e,r,n,p-1,1-d),$c(i,e,r,p+1,l,1-d)}function Eu(i,e,r,n,l,d){for(;l>n;){if(l-n>600){const x=l-n+1,S=r-n+1,E=Math.log(x),k=.5*Math.exp(2*E/3),D=.5*Math.sqrt(E*k*(x-k)/x)*(S-x/2<0?-1:1);Eu(i,e,r,Math.max(n,Math.floor(r-S*k/x+D)),Math.min(l,Math.floor(r+(x-S)*k/x+D)),d)}const p=e[2*r+d];let f=n,_=l;for(za(i,e,n,r),e[2*l+d]>p&&za(i,e,n,l);f<_;){for(za(i,e,f,_),f++,_--;e[2*f+d]<p;)f++;for(;e[2*_+d]>p;)_--}e[2*n+d]===p?za(i,e,n,_):(_++,za(i,e,_,l)),_<=r&&(n=_+1),r<=_&&(l=_-1)}}function za(i,e,r,n){Nc(i,r,n),Nc(e,2*r,2*n),Nc(e,2*r+1,2*n+1)}function Nc(i,e,r){const n=i[e];i[e]=i[r],i[r]=n}function Au(i,e,r,n){const l=i-r,d=e-n;return l*l+d*d}var jc;T.bf=void 0,(jc=T.bf||(T.bf={})).create="create",jc.load="load",jc.fullLoad="fullLoad";let Ol=null,Da=[];const Uc=1e3/60,qc="loadTime",Zc="fullLoadTime",fp={mark(i){performance.mark(i)},frame(i){const e=i;Ol!=null&&Da.push(e-Ol),Ol=e},clearMetrics(){Ol=null,Da=[],performance.clearMeasures(qc),performance.clearMeasures(Zc);for(const i in T.bf)performance.clearMarks(T.bf[i])},getPerformanceMetrics(){performance.measure(qc,T.bf.create,T.bf.load),performance.measure(Zc,T.bf.create,T.bf.fullLoad);const i=performance.getEntriesByName(qc)[0].duration,e=performance.getEntriesByName(Zc)[0].duration,r=Da.length,n=1/(Da.reduce((d,p)=>d+p,0)/r/1e3),l=Da.filter(d=>d>Uc).reduce((d,p)=>d+(p-Uc)/Uc,0);return{loadTime:i,fullLoadTime:e,fps:n,percentDroppedFrames:l/(r+l)*100,totalFrames:r}}};T.$=class extends F{},T.A=co,T.B=oa,T.C=function(i){if(ms==null){const e=i.navigator?i.navigator.userAgent:null;ms=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return ms},T.D=je,T.E=ys,T.F=class{constructor(i,e){this.target=i,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new np(()=>this.process()),this.subscription=function(r,n,l,d){return r.addEventListener(n,l,!1),{unsubscribe:()=>{r.removeEventListener(n,l,!1)}}}(this.target,"message",r=>this.receive(r)),this.globalScope=yr(self)?i:window}registerMessageHandler(i,e){this.messageHandlers[i]=e}sendAsync(i,e){return new Promise((r,n)=>{const l=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[l]={resolve:r,reject:n},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:mn(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 n=this.abortControllers[r];return delete this.abortControllers[r],void(n&&n.abort())}if(yr(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(fr(e.error)):l.resolve(fr(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=fr(e.data),n=new AbortController;this.abortControllers[i]=n;try{const l=yield this.messageHandlers[e.type](e.sourceMapId,r,n);this.completeTask(i,null,l)}catch(l){this.completeTask(i,l)}})}completeTask(i,e,r){const n=[];delete this.abortControllers[i];const l={id:i,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?mn(e):null,data:mn(r,n)};this.target.postMessage(l,{transfer:n})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},T.G=_s,T.H=function(){var i=new co(16);return co!=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},T.I=Ac,T.J=function(i,e,r){var n,l,d,p,f,_,x,S,E,k,D,R,O=r[0],U=r[1],W=r[2];return e===i?(i[12]=e[0]*O+e[4]*U+e[8]*W+e[12],i[13]=e[1]*O+e[5]*U+e[9]*W+e[13],i[14]=e[2]*O+e[6]*U+e[10]*W+e[14],i[15]=e[3]*O+e[7]*U+e[11]*W+e[15]):(l=e[1],d=e[2],p=e[3],f=e[4],_=e[5],x=e[6],S=e[7],E=e[8],k=e[9],D=e[10],R=e[11],i[0]=n=e[0],i[1]=l,i[2]=d,i[3]=p,i[4]=f,i[5]=_,i[6]=x,i[7]=S,i[8]=E,i[9]=k,i[10]=D,i[11]=R,i[12]=n*O+f*U+E*W+e[12],i[13]=l*O+_*U+k*W+e[13],i[14]=d*O+x*U+D*W+e[14],i[15]=p*O+S*U+R*W+e[15]),i},T.K=function(i,e,r){var n=r[0],l=r[1],d=r[2];return i[0]=e[0]*n,i[1]=e[1]*n,i[2]=e[2]*n,i[3]=e[3]*n,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},T.L=oh,T.M=function(i,e){const r={};for(let n=0;n<e.length;n++){const l=e[n];l in i&&(r[l]=i[l])}return r},T.N=Vs,T.O=tu,T.P=ae,T.Q=iu,T.R=er,T.S=tr,T.T=Cs,T.U=ut,T.V=kt,T.W=Xr,T.X=Xt,T.Y=w,T.Z=Dl,T._=c,T.a=Mr,T.a$=function(i,e){var r=i[0],n=i[1],l=i[2],d=i[3],p=i[4],f=i[5],_=i[6],x=i[7],S=i[8],E=i[9],k=i[10],D=i[11],R=i[12],O=i[13],U=i[14],W=i[15],ne=e[0],Y=e[1],ie=e[2],ue=e[3],xe=e[4],ze=e[5],He=e[6],ke=e[7],Ie=e[8],Ne=e[9],Be=e[10],Le=e[11],pe=e[12],Ue=e[13],$e=e[14],Ye=e[15];return Math.abs(r-ne)<=Pi*Math.max(1,Math.abs(r),Math.abs(ne))&&Math.abs(n-Y)<=Pi*Math.max(1,Math.abs(n),Math.abs(Y))&&Math.abs(l-ie)<=Pi*Math.max(1,Math.abs(l),Math.abs(ie))&&Math.abs(d-ue)<=Pi*Math.max(1,Math.abs(d),Math.abs(ue))&&Math.abs(p-xe)<=Pi*Math.max(1,Math.abs(p),Math.abs(xe))&&Math.abs(f-ze)<=Pi*Math.max(1,Math.abs(f),Math.abs(ze))&&Math.abs(_-He)<=Pi*Math.max(1,Math.abs(_),Math.abs(He))&&Math.abs(x-ke)<=Pi*Math.max(1,Math.abs(x),Math.abs(ke))&&Math.abs(S-Ie)<=Pi*Math.max(1,Math.abs(S),Math.abs(Ie))&&Math.abs(E-Ne)<=Pi*Math.max(1,Math.abs(E),Math.abs(Ne))&&Math.abs(k-Be)<=Pi*Math.max(1,Math.abs(k),Math.abs(Be))&&Math.abs(D-Le)<=Pi*Math.max(1,Math.abs(D),Math.abs(Le))&&Math.abs(R-pe)<=Pi*Math.max(1,Math.abs(R),Math.abs(pe))&&Math.abs(O-Ue)<=Pi*Math.max(1,Math.abs(O),Math.abs(Ue))&&Math.abs(U-$e)<=Pi*Math.max(1,Math.abs(U),Math.abs($e))&&Math.abs(W-Ye)<=Pi*Math.max(1,Math.abs(W),Math.abs(Ye))},T.a0=Kt,T.a1=Bc,T.a2=Se,T.a3=i=>{const e=window.document.createElement("video");return e.muted=!0,new Promise(r=>{e.onloadstart=()=>{r(e)};for(const n of i){const l=window.document.createElement("source");Kr(n)||(e.crossOrigin="Anonymous"),l.src=n,e.appendChild(l)}})},T.a4=function(){return nr++},T.a5=st,T.a6=go,T.a7=vi,T.a8=vn,T.a9=It,T.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]=Us(i[r],e[i[r].ref]));return i},T.aB=function(i){if(i.type==="custom")return new sp(i);switch(i.type){case"background":return new tp(i);case"circle":return new Nu(i);case"fill":return new nd(i);case"fill-extrusion":return new vd(i);case"heatmap":return new Uu(i);case"hillshade":return new Zu(i);case"line":return new Pd(i);case"raster":return new rp(i);case"symbol":return new zl(i)}},T.aC=vt,T.aD=function(i,e){if(!i)return[{command:"setStyle",args:[e]}];let r=[];try{if(!mt(i.version,e.version))return[{command:"setStyle",args:[e]}];mt(i.center,e.center)||r.push({command:"setCenter",args:[e.center]}),mt(i.zoom,e.zoom)||r.push({command:"setZoom",args:[e.zoom]}),mt(i.bearing,e.bearing)||r.push({command:"setBearing",args:[e.bearing]}),mt(i.pitch,e.pitch)||r.push({command:"setPitch",args:[e.pitch]}),mt(i.sprite,e.sprite)||r.push({command:"setSprite",args:[e.sprite]}),mt(i.glyphs,e.glyphs)||r.push({command:"setGlyphs",args:[e.glyphs]}),mt(i.transition,e.transition)||r.push({command:"setTransition",args:[e.transition]}),mt(i.light,e.light)||r.push({command:"setLight",args:[e.light]}),mt(i.terrain,e.terrain)||r.push({command:"setTerrain",args:[e.terrain]}),mt(i.sky,e.sky)||r.push({command:"setSky",args:[e.sky]}),mt(i.projection,e.projection)||r.push({command:"setProjection",args:[e.projection]});const n={},l=[];(function(p,f,_,x){let S;for(S in f=f||{},p=p||{})Object.prototype.hasOwnProperty.call(p,S)&&(Object.prototype.hasOwnProperty.call(f,S)||Lr(S,_,x));for(S in f)Object.prototype.hasOwnProperty.call(f,S)&&(Object.prototype.hasOwnProperty.call(p,S)?mt(p[S],f[S])||(p[S].type==="geojson"&&f[S].type==="geojson"&&xs(p,f,S)?$t(_,{command:"setGeoJSONSourceData",args:[S,f[S].data]}):br(S,f,_,x)):qs(S,f,_))})(i.sources,e.sources,l,n);const d=[];i.layers&&i.layers.forEach(p=>{"source"in p&&n[p.source]?r.push({command:"removeLayer",args:[p.id]}):d.push(p)}),r=r.concat(l),function(p,f,_){f=f||[];const x=(p=p||[]).map(Zs),S=f.map(Zs),E=p.reduce(Gs,{}),k=f.reduce(Gs,{}),D=x.slice(),R=Object.create(null);let O,U,W,ne,Y;for(let ie=0,ue=0;ie<x.length;ie++)O=x[ie],Object.prototype.hasOwnProperty.call(k,O)?ue++:($t(_,{command:"removeLayer",args:[O]}),D.splice(D.indexOf(O,ue),1));for(let ie=0,ue=0;ie<S.length;ie++)O=S[S.length-1-ie],D[D.length-1-ie]!==O&&(Object.prototype.hasOwnProperty.call(E,O)?($t(_,{command:"removeLayer",args:[O]}),D.splice(D.lastIndexOf(O,D.length-ue),1)):ue++,ne=D[D.length-ie],$t(_,{command:"addLayer",args:[k[O],ne]}),D.splice(D.length-ie,0,O),R[O]=!0);for(let ie=0;ie<S.length;ie++)if(O=S[ie],U=E[O],W=k[O],!R[O]&&!mt(U,W))if(mt(U.source,W.source)&&mt(U["source-layer"],W["source-layer"])&&mt(U.type,W.type)){for(Y in ji(U.layout,W.layout,_,O,null,"setLayoutProperty"),ji(U.paint,W.paint,_,O,null,"setPaintProperty"),mt(U.filter,W.filter)||$t(_,{command:"setFilter",args:[O,W.filter]}),mt(U.minzoom,W.minzoom)&&mt(U.maxzoom,W.maxzoom)||$t(_,{command:"setLayerZoomRange",args:[O,W.minzoom,W.maxzoom]}),U)Object.prototype.hasOwnProperty.call(U,Y)&&Y!=="layout"&&Y!=="paint"&&Y!=="filter"&&Y!=="metadata"&&Y!=="minzoom"&&Y!=="maxzoom"&&(Y.indexOf("paint.")===0?ji(U[Y],W[Y],_,O,Y.slice(6),"setPaintProperty"):mt(U[Y],W[Y])||$t(_,{command:"setLayerProperty",args:[O,Y,W[Y]]}));for(Y in W)Object.prototype.hasOwnProperty.call(W,Y)&&!Object.prototype.hasOwnProperty.call(U,Y)&&Y!=="layout"&&Y!=="paint"&&Y!=="filter"&&Y!=="metadata"&&Y!=="minzoom"&&Y!=="maxzoom"&&(Y.indexOf("paint.")===0?ji(U[Y],W[Y],_,O,Y.slice(6),"setPaintProperty"):mt(U[Y],W[Y])||$t(_,{command:"setLayerProperty",args:[O,Y,W[Y]]}))}else $t(_,{command:"removeLayer",args:[O]}),ne=D[D.lastIndexOf(O)+1],$t(_,{command:"addLayer",args:[W,ne]})}(d,e.layers,r)}catch(n){console.warn("Unable to compute style diff:",n),r=[{command:"setStyle",args:[e]}]}return r},T.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},T.aF=function i(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(let n=0;n<e.length;n++)if(!i(e[n],r[n]))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 n in e)if(!i(e[n],r[n]))return!1;return!0}return e===r},T.aG=si,T.aH=Cr,T.aI=class extends _n{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},T.aJ=xl,T.aK=class extends _n{constructor(i,e){super(i,e),this.current=Du}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}}},T.aL=Xc,T.aM=Jc,T.aN=yt,T.aO=class extends _n{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]))}},T.aP=class extends _n{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]))}},T.aQ=function(i,e,r,n,l,d,p){var f=1/(e-r),_=1/(n-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*_,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+n)*_,i[14]=(p+d)*x,i[15]=1,i},T.aR=$u,T.aS=class extends me{},T.aT=zd,T.aU=class extends Me{},T.aV=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},T.aW=uh,T.aX=cs,T.aY=Qt,T.aZ=class extends Pe{},T.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]},T.aa=lu,T.ab=function(i){const e={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,n,l,d)=>{const p=l||d;return e[n]=!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},T.ac=function(i,e){const r=[];for(const n in i)n in e||r.push(n);return r},T.ad=xt,T.ae=function(i,e,r){var n=Math.sin(r),l=Math.cos(r),d=e[0],p=e[1],f=e[2],_=e[3],x=e[4],S=e[5],E=e[6],k=e[7];return e!==i&&(i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[0]=d*l+x*n,i[1]=p*l+S*n,i[2]=f*l+E*n,i[3]=_*l+k*n,i[4]=x*l-d*n,i[5]=S*l-p*n,i[6]=E*l-f*n,i[7]=k*l-_*n,i},T.af=function(i){var e=new co(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},T.ag=Sl,T.ah=function(i,e){let r=0,n=0;if(i.kind==="constant")n=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:l,minZoom:d,maxZoom:p}=i,f=l?xt(Oi.interpolationFactor(l,e,d,p),0,1):0;i.kind==="camera"?n=Fi.number(i.minSize,i.maxSize,f):r=f}return{uSizeT:r,uSize:n}},T.aj=function(i,{uSize:e,uSizeT:r},{lowerSize:n,upperSize:l}){return i.kind==="source"?n/Zr:i.kind==="composite"?Fi.number(n/Zr,l/Zr,r):e},T.ak=Cc,T.al=function(i,e,r,n){const l=e.y-i.y,d=e.x-i.x,p=n.y-r.y,f=n.x-r.x,_=p*d-f*l;if(_===0)return null;const x=(f*(i.y-r.y)-p*(i.x-r.x))/_;return new ae(i.x+x*d,i.y+x*l)},T.am=du,T.an=eh,T.ao=dc,T.ap=function(i){let e=1/0,r=1/0,n=-1/0,l=-1/0;for(const d of i)e=Math.min(e,d.x),r=Math.min(r,d.y),n=Math.max(n,d.x),l=Math.max(l,d.y);return[e,r,n,l]},T.aq=Yt,T.as=kc,T.at=function(i,e){var r=e[0],n=e[1],l=e[2],d=e[3],p=e[4],f=e[5],_=e[6],x=e[7],S=e[8],E=e[9],k=e[10],D=e[11],R=e[12],O=e[13],U=e[14],W=e[15],ne=r*f-n*p,Y=r*_-l*p,ie=r*x-d*p,ue=n*_-l*f,xe=n*x-d*f,ze=l*x-d*_,He=S*O-E*R,ke=S*U-k*R,Ie=S*W-D*R,Ne=E*U-k*O,Be=E*W-D*O,Le=k*W-D*U,pe=ne*Le-Y*Be+ie*Ne+ue*Ie-xe*ke+ze*He;return pe?(i[0]=(f*Le-_*Be+x*Ne)*(pe=1/pe),i[1]=(l*Be-n*Le-d*Ne)*pe,i[2]=(O*ze-U*xe+W*ue)*pe,i[3]=(k*xe-E*ze-D*ue)*pe,i[4]=(_*Ie-p*Le-x*ke)*pe,i[5]=(r*Le-l*Ie+d*ke)*pe,i[6]=(U*ie-R*ze-W*Y)*pe,i[7]=(S*ze-k*ie+D*Y)*pe,i[8]=(p*Be-f*Ie+x*He)*pe,i[9]=(n*Ie-r*Be-d*He)*pe,i[10]=(R*xe-O*ie+W*ne)*pe,i[11]=(E*ie-S*xe-D*ne)*pe,i[12]=(f*ke-p*Ne-_*He)*pe,i[13]=(r*Ne-n*ke+l*He)*pe,i[14]=(O*Y-R*ue-U*ne)*pe,i[15]=(S*ue-E*Y+k*ne)*pe,i):null},T.au=Oc,T.av=Pc,T.aw=Vc,T.ax=function(){const i={},e=he.$version;for(const r in he.$root){const n=he.$root[r];if(n.required){let l=null;l=r==="version"?e:n.type==="array"?[]:{},l!=null&&(i[r]=l)}}return i},T.ay=ul,T.az=Hi,T.b=or,T.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},T.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},T.b2=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},T.b3=et,T.b4=nu,T.b5=ru,T.b6=function(i,e,r,n,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+n)*(d=1/(n-l)),i[14]=2*l*n*d):(i[10]=-1,i[14]=-2*n),i},T.b7=function(i,e,r){var n=Math.sin(r),l=Math.cos(r),d=e[4],p=e[5],f=e[6],_=e[7],x=e[8],S=e[9],E=e[10],k=e[11];return e!==i&&(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[4]=d*l+x*n,i[5]=p*l+S*n,i[6]=f*l+E*n,i[7]=_*l+k*n,i[8]=x*l-d*n,i[9]=S*l-p*n,i[10]=E*l-f*n,i[11]=k*l-_*n,i},T.b8=Ze,T.b9=Ct,T.bA=function(i){return i.message===Gi},T.bB=os,T.bC=jr,T.ba=function(i){return i*Math.PI/180},T.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},T.bc=class extends L{},T.bd=Lc,T.be=fp,T.bg=Di,T.bh=function(i,e){Mr.REGISTERED_PROTOCOLS[i]=e},T.bi=function(i){delete Mr.REGISTERED_PROTOCOLS[i]},T.bj=function(i,e){const r={};for(let l=0;l<i.length;l++){const d=e&&e[i[l].id]||Wo(i[l]);e&&(e[i[l].id]=d);let p=r[d];p||(p=r[d]=[]),p.push(i[l])}const n=[];for(const l in r)n.push(r[l]);return n},T.bk=Re,T.bl=au,T.bm=cu,T.bn=$h,T.bo=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=Xt/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const e=i.bucket.layers[0],r=e.layout,n=e._unevaluatedLayout._values,l={layoutIconSize:n["icon-size"].possiblyEvaluate(new It(i.bucket.zoom+1),i.canonical),layoutTextSize:n["text-size"].possiblyEvaluate(new It(i.bucket.zoom+1),i.canonical),textMaxSize:n["text-size"].possiblyEvaluate(new It(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:x,maxZoom:S}=i.bucket.textSizeData;l.compositeTextSizes=[n["text-size"].possiblyEvaluate(new It(x),i.canonical),n["text-size"].possiblyEvaluate(new It(S),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:x,maxZoom:S}=i.bucket.iconSizeData;l.compositeIconSizes=[n["icon-size"].possiblyEvaluate(new It(x),i.canonical),n["icon-size"].possiblyEvaluate(new It(S),i.canonical)]}const d=r.get("text-line-height")*Yt,p=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",f=r.get("text-keep-upright"),_=r.get("text-size");for(const x of i.bucket.features){const S=r.get("text-font").evaluate(x,{},i.canonical).join(","),E=_.evaluate(x,{},i.canonical),k=l.layoutTextSize.evaluate(x,{},i.canonical),D=l.layoutIconSize.evaluate(x,{},i.canonical),R={horizontal:{},vertical:void 0},O=x.text;let U,W=[0,0];if(O){const ie=O.toString(),ue=r.get("text-letter-spacing").evaluate(x,{},i.canonical)*Yt,xe=nc(ie)?ue:0,ze=r.get("text-anchor").evaluate(x,{},i.canonical),He=bu(e,x,i.canonical);if(!He){const Be=r.get("text-radial-offset").evaluate(x,{},i.canonical);W=Be?vu(ze,[Be*Yt,Fc]):r.get("text-offset").evaluate(x,{},i.canonical).map(Le=>Le*Yt)}let ke=p?"center":r.get("text-justify").evaluate(x,{},i.canonical);const Ie=r.get("symbol-placement")==="point"?r.get("text-max-width").evaluate(x,{},i.canonical)*Yt:1/0,Ne=()=>{i.bucket.allowVerticalPlacement&&ca(ie)&&(R.vertical=kl(O,i.glyphMap,i.glyphPositions,i.imagePositions,S,Ie,d,ze,"left",xe,W,T.ai.vertical,!0,k,E))};if(!p&&He){const Be=new Set;if(ke==="auto")for(let pe=0;pe<He.values.length;pe+=2)Be.add(Oc(He.values[pe]));else Be.add(ke);let Le=!1;for(const pe of Be)if(!R.horizontal[pe])if(Le)R.horizontal[pe]=R.horizontal[0];else{const Ue=kl(O,i.glyphMap,i.glyphPositions,i.imagePositions,S,Ie,d,"center",pe,xe,W,T.ai.horizontal,!1,k,E);Ue&&(R.horizontal[pe]=Ue,Le=Ue.positionedLines.length===1)}Ne()}else{ke==="auto"&&(ke=Oc(ze));const Be=kl(O,i.glyphMap,i.glyphPositions,i.imagePositions,S,Ie,d,ze,ke,xe,W,T.ai.horizontal,!1,k,E);Be&&(R.horizontal[ke]=Be),Ne(),ca(ie)&&p&&f&&(R.vertical=kl(O,i.glyphMap,i.glyphPositions,i.imagePositions,S,Ie,d,ze,ke,xe,W,T.ai.vertical,!1,k,E))}}let ne=!1;if(x.icon&&x.icon.name){const ie=i.imageMap[x.icon.name];ie&&(U=Jd(i.imagePositions[x.icon.name],r.get("icon-offset").evaluate(x,{},i.canonical),r.get("icon-anchor").evaluate(x,{},i.canonical)),ne=!!ie.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=ne:i.bucket.sdfIcons!==ne&&ni("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=Su(R.horizontal)||R.vertical;i.bucket.iconsInText=!!Y&&Y.iconsInText,(Y||U)&&dp(i.bucket,x,R,U,i.imageMap,l,k,D,W,ne,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},T.bp=wc,T.bq=xc,T.br=bc,T.bs=Bs,T.bt=Tc,T.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}},T.bv=function(i,e,r,n,l){return c(this,void 0,void 0,function*(){if(kt())try{return yield Xr(i,e,r,n,l)}catch{}return function(d,p,f,_,x){const S=d.width,E=d.height;xr&&Ti||(xr=new OffscreenCanvas(S,E),Ti=xr.getContext("2d",{willReadFrequently:!0})),xr.width=S,xr.height=E,Ti.drawImage(d,0,0,S,E);const k=Ti.getImageData(p,f,_,x);return Ti.clearRect(0,0,S,E),k.data}(i,e,r,n,l)})},T.bw=ou,T.bx=fe,T.by=_e,T.bz=Mh,T.c=gs,T.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.`)}}),T.e=Tt,T.f=i=>new Promise((e,r)=>{const n=new Image;n.onload=()=>{e(n),URL.revokeObjectURL(n.src),n.onload=null,window.requestAnimationFrame(()=>{n.src=En})},n.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"});n.src=i.byteLength?URL.createObjectURL(l):En}),T.g=ar,T.h=(i,e)=>Jr(Tt(i,{type:"json"}),e),T.i=yr,T.j=Dr,T.k=zr,T.l=(i,e)=>Jr(Tt(i,{type:"arrayBuffer"}),e),T.m=Jr,T.n=function(i){return new Tc(i).readFields(Ud,[])},T.o=ba,T.p=Vh,T.q=o,T.r=ic,T.s=Kr,T.t=aa,T.u=Ce,T.v=he,T.w=ni,T.x=Ar,T.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)}},T.z=Fi}),B("worker",["./shared"],function(T){class c{constructor(z){this.keyCache={},z&&this.replace(z)}replace(z){this._layerConfigs={},this._layers={},this.update(z,[])}update(z,M){for(const q of z){this._layerConfigs[q.id]=q;const Q=this._layers[q.id]=T.aB(q);Q._featureFilter=T.a7(Q.filter),this.keyCache[q.id]&&delete this.keyCache[q.id]}for(const q of M)delete this.keyCache[q],delete this._layerConfigs[q],delete this._layers[q];this.familiesBySource={};const V=T.bj(Object.values(this._layerConfigs),this.keyCache);for(const q of V){const Q=q.map(ce=>this._layers[ce.id]),te=Q[0];if(te.visibility==="none")continue;const re=te.source||"";let J=this.familiesBySource[re];J||(J=this.familiesBySource[re]={});const de=te.sourceLayer||"_geojsonTileLayer";let ge=J[de];ge||(ge=J[de]=[]),ge.push(Q)}}}class fe{constructor(z){const M={},V=[];for(const re in z){const J=z[re],de=M[re]={};for(const ge in J){const ce=J[+ge];if(!ce||ce.bitmap.width===0||ce.bitmap.height===0)continue;const Te={x:0,y:0,w:ce.bitmap.width+2,h:ce.bitmap.height+2};V.push(Te),de[ge]={rect:Te,metrics:ce.metrics}}}const{w:q,h:Q}=T.p(V),te=new T.o({width:q||1,height:Q||1});for(const re in z){const J=z[re];for(const de in J){const ge=J[+de];if(!ge||ge.bitmap.width===0||ge.bitmap.height===0)continue;const ce=M[re][de].rect;T.o.copy(ge.bitmap,te,{x:0,y:0},{x:ce.x+1,y:ce.y+1},ge.bitmap)}}this.image=te,this.positions=M}}T.bk("GlyphAtlas",fe);class _e{constructor(z){this.tileID=new T.S(z.tileID.overscaledZ,z.tileID.wrap,z.tileID.canonical.z,z.tileID.canonical.x,z.tileID.canonical.y),this.uid=z.uid,this.zoom=z.zoom,this.pixelRatio=z.pixelRatio,this.tileSize=z.tileSize,this.source=z.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=z.showCollisionBoxes,this.collectResourceTiming=!!z.collectResourceTiming,this.returnDependencies=!!z.returnDependencies,this.promoteId=z.promoteId,this.inFlightDependencies=[]}parse(z,M,V,q){return T._(this,void 0,void 0,function*(){this.status="parsing",this.data=z,this.collisionBoxArray=new T.a5;const Q=new T.bl(Object.keys(z.layers).sort()),te=new T.bm(this.tileID,this.promoteId);te.bucketLayerIDs=[];const re={},J={featureIndex:te,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:V},de=M.familiesBySource[this.source];for(const ot in de){const _t=z.layers[ot];if(!_t)continue;_t.version===1&&T.w(`Vector tile source "${this.source}" layer "${ot}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Ft=Q.encode(ot),Jt=[];for(let oi=0;oi<_t.length;oi++){const ai=_t.feature(oi),Hs=te.getId(ai,ot);Jt.push({feature:ai,id:Hs,index:oi,sourceLayerIndex:Ft})}for(const oi of de[ot]){const ai=oi[0];ai.source!==this.source&&T.w(`layer.source = ${ai.source} does not equal this.source = ${this.source}`),ai.minzoom&&this.zoom<Math.floor(ai.minzoom)||ai.maxzoom&&this.zoom>=ai.maxzoom||ai.visibility!=="none"&&(ye(oi,this.zoom,V),(re[ai.id]=ai.createBucket({index:te.bucketLayerIDs.length,layers:oi,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Ft,sourceID:this.source})).populate(Jt,J,this.tileID.canonical),te.bucketLayerIDs.push(oi.map(Hs=>Hs.id)))}}const ge=T.aG(J.glyphDependencies,ot=>Object.keys(ot).map(Number));this.inFlightDependencies.forEach(ot=>ot==null?void 0:ot.abort()),this.inFlightDependencies=[];let ce=Promise.resolve({});if(Object.keys(ge).length){const ot=new AbortController;this.inFlightDependencies.push(ot),ce=q.sendAsync({type:"GG",data:{stacks:ge,source:this.source,tileID:this.tileID,type:"glyphs"}},ot)}const Te=Object.keys(J.iconDependencies);let qe=Promise.resolve({});if(Te.length){const ot=new AbortController;this.inFlightDependencies.push(ot),qe=q.sendAsync({type:"GI",data:{icons:Te,source:this.source,tileID:this.tileID,type:"icons"}},ot)}const Ge=Object.keys(J.patternDependencies);let rt=Promise.resolve({});if(Ge.length){const ot=new AbortController;this.inFlightDependencies.push(ot),rt=q.sendAsync({type:"GI",data:{icons:Ge,source:this.source,tileID:this.tileID,type:"patterns"}},ot)}const[dt,it,Et]=yield Promise.all([ce,qe,rt]),Nt=new fe(dt),Ht=new T.bn(it,Et);for(const ot in re){const _t=re[ot];_t instanceof T.a6?(ye(_t.layers,this.zoom,V),T.bo({bucket:_t,glyphMap:dt,glyphPositions:Nt.positions,imageMap:it,imagePositions:Ht.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):_t.hasPattern&&(_t instanceof T.bp||_t instanceof T.bq||_t instanceof T.br)&&(ye(_t.layers,this.zoom,V),_t.addFeatures(J,this.tileID.canonical,Ht.patternPositions))}return this.status="done",{buckets:Object.values(re).filter(ot=>!ot.isEmpty()),featureIndex:te,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Nt.image,imageAtlas:Ht,glyphMap:this.returnDependencies?dt:null,iconMap:this.returnDependencies?it:null,glyphPositions:this.returnDependencies?Nt.positions:null}})}}function ye(G,z,M){const V=new T.a9(z);for(const q of G)q.recalculate(V,M)}class ae{constructor(z,M,V){this.actor=z,this.layerIndex=M,this.availableImages=V,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(z,M){return T._(this,void 0,void 0,function*(){const V=yield T.l(z.request,M);try{return{vectorTile:new T.bs.VectorTile(new T.bt(V.data)),rawData:V.data,cacheControl:V.cacheControl,expires:V.expires}}catch(q){const Q=new Uint8Array(V.data);let te=`Unable to parse the tile at ${z.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(z){return T._(this,void 0,void 0,function*(){const M=z.uid,V=!!(z&&z.request&&z.request.collectResourceTiming)&&new T.bu(z.request),q=new _e(z);this.loading[M]=q;const Q=new AbortController;q.abort=Q;try{const te=yield this.loadVectorTile(z,Q);if(delete this.loading[M],!te)return null;const re=te.rawData,J={};te.expires&&(J.expires=te.expires),te.cacheControl&&(J.cacheControl=te.cacheControl);const de={};if(V){const ce=V.finish();ce&&(de.resourceTiming=JSON.parse(JSON.stringify(ce)))}q.vectorTile=te.vectorTile;const ge=q.parse(te.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[M]=q,this.fetching[M]={rawTileData:re,cacheControl:J,resourceTiming:de};try{const ce=yield ge;return T.e({rawTileData:re.slice(0)},ce,J,de)}finally{delete this.fetching[M]}}catch(te){throw delete this.loading[M],q.status="done",this.loaded[M]=q,te}})}reloadTile(z){return T._(this,void 0,void 0,function*(){const M=z.uid;if(!this.loaded||!this.loaded[M])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const V=this.loaded[M];if(V.showCollisionBoxes=z.showCollisionBoxes,V.status==="parsing"){const q=yield V.parse(V.vectorTile,this.layerIndex,this.availableImages,this.actor);let Q;if(this.fetching[M]){const{rawTileData:te,cacheControl:re,resourceTiming:J}=this.fetching[M];delete this.fetching[M],Q=T.e({rawTileData:te.slice(0)},q,re,J)}else Q=q;return Q}if(V.status==="done"&&V.vectorTile)return V.parse(V.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(z){return T._(this,void 0,void 0,function*(){const M=this.loading,V=z.uid;M&&M[V]&&M[V].abort&&(M[V].abort.abort(),delete M[V])})}removeTile(z){return T._(this,void 0,void 0,function*(){this.loaded&&this.loaded[z.uid]&&delete this.loaded[z.uid]})}}class oe{constructor(){this.loaded={}}loadTile(z){return T._(this,void 0,void 0,function*(){const{uid:M,encoding:V,rawImageData:q,redFactor:Q,greenFactor:te,blueFactor:re,baseShift:J}=z,de=q.width+2,ge=q.height+2,ce=T.b(q)?new T.R({width:de,height:ge},yield T.bv(q,-1,-1,de,ge)):q,Te=new T.bw(M,ce,V,Q,te,re,J);return this.loaded=this.loaded||{},this.loaded[M]=Te,Te})}removeTile(z){const M=this.loaded,V=z.uid;M&&M[V]&&delete M[V]}}function at(G,z){if(G.length!==0){Ve(G[0],z);for(var M=1;M<G.length;M++)Ve(G[M],!z)}}function Ve(G,z){for(var M=0,V=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]),J=M+re;V+=Math.abs(M)>=Math.abs(re)?M-J+re:re-J+M,M=J}M+V>=0!=!!z&&G.reverse()}var Xe=T.bx(function G(z,M){var V,q=z&&z.type;if(q==="FeatureCollection")for(V=0;V<z.features.length;V++)G(z.features[V],M);else if(q==="GeometryCollection")for(V=0;V<z.geometries.length;V++)G(z.geometries[V],M);else if(q==="Feature")G(z.geometry,M);else if(q==="Polygon")at(z.coordinates,M);else if(q==="MultiPolygon")for(V=0;V<z.coordinates.length;V++)at(z.coordinates[V],M);return z});const Fe=T.bs.VectorTileFeature.prototype.toGeoJSON;var ut={exports:{}},kt=T.by,Ze=T.bs.VectorTileFeature,Ct=xt;function xt(G,z){this.options=z||{},this.features=G,this.length=G.length}function et(G,z){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=z||4096}xt.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 z=0;z<G.length;z++){for(var M=G[z],V=[],q=0;q<M.length;q++)V.push(new kt(M[q][0],M[q][1]));this.geometry.push(V)}return this.geometry},et.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var G=this.geometry,z=1/0,M=-1/0,V=1/0,q=-1/0,Q=0;Q<G.length;Q++)for(var te=G[Q],re=0;re<te.length;re++){var J=te[re];z=Math.min(z,J.x),M=Math.max(M,J.x),V=Math.min(V,J.y),q=Math.max(q,J.y)}return[z,V,M,q]},et.prototype.toGeoJSON=Ze.prototype.toGeoJSON;var Tt=T.bz,nr=Ct;function si(G){var z=new Tt;return function(M,V){for(var q in M.layers)V.writeMessage(3,Cr,M.layers[q])}(G,z),z.finish()}function Cr(G,z){var M;z.writeVarintField(15,G.version||1),z.writeStringField(1,G.name||""),z.writeVarintField(5,G.extent||4096);var V={keys:[],values:[],keycache:{},valuecache:{}};for(M=0;M<G.length;M++)V.feature=G.feature(M),z.writeMessage(2,vt,V);var q=V.keys;for(M=0;M<q.length;M++)z.writeStringField(3,q[M]);var Q=V.values;for(M=0;M<Q.length;M++)z.writeMessage(4,ms,Q[M])}function vt(G,z){var M=G.feature;M.id!==void 0&&z.writeVarintField(1,M.id),z.writeMessage(2,Tn,G),z.writeVarintField(3,M.type),z.writeMessage(4,yr,M)}function Tn(G,z){var M=G.feature,V=G.keys,q=G.values,Q=G.keycache,te=G.valuecache;for(var re in M.properties){var J=M.properties[re],de=Q[re];if(J!==null){de===void 0&&(V.push(re),Q[re]=de=V.length-1),z.writeVarint(de);var ge=typeof J;ge!=="string"&&ge!=="boolean"&&ge!=="number"&&(J=JSON.stringify(J));var ce=ge+":"+J,Te=te[ce];Te===void 0&&(q.push(J),te[ce]=Te=q.length-1),z.writeVarint(Te)}}}function ni(G,z){return(z<<3)+(7&G)}function yi(G){return G<<1^G>>31}function yr(G,z){for(var M=G.loadGeometry(),V=G.type,q=0,Q=0,te=M.length,re=0;re<te;re++){var J=M[re],de=1;V===1&&(de=J.length),z.writeVarint(ni(1,de));for(var ge=V===3?J.length-1:J.length,ce=0;ce<ge;ce++){ce===1&&V!==1&&z.writeVarint(ni(2,ge-1));var Te=J[ce].x-q,qe=J[ce].y-Q;z.writeVarint(yi(Te)),z.writeVarint(yi(qe)),q+=Te,Q+=qe}V===3&&z.writeVarint(ni(7,1))}}function ms(G,z){var M=typeof G;M==="string"?z.writeStringField(1,G):M==="boolean"?z.writeBooleanField(7,G):M==="number"&&(G%1!=0?z.writeDoubleField(3,G):G<0?z.writeSVarintField(6,G):z.writeVarintField(5,G))}ut.exports=si,ut.exports.fromVectorTileJs=si,ut.exports.fromGeojsonVt=function(G,z){z=z||{};var M={};for(var V in G)M[V]=new nr(G[V].features,z),M[V].name=V,M[V].version=z.version,M[V].extent=z.extent;return si({layers:M})},ut.exports.GeoJSONWrapper=nr;var or=T.bx(ut.exports);const En={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:G=>G},Xr=Math.fround||(xr=new Float32Array(1),G=>(xr[0]=+G,xr[0]));var xr;const Ti=3,Gi=5,gs=6;class Mr{constructor(z){this.options=Object.assign(Object.create(En),z),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(z){const{log:M,minZoom:V,maxZoom:q}=this.options;M&&console.time("total time");const Q=`prepare ${z.length} points`;M&&console.time(Q),this.points=z;const te=[];for(let J=0;J<z.length;J++){const de=z[J];if(!de.geometry)continue;const[ge,ce]=de.geometry.coordinates,Te=Xr(Di(ge)),qe=Xr(Hi(ce));te.push(Te,qe,1/0,J,-1,1),this.options.reduce&&te.push(0)}let re=this.trees[q+1]=this._createTree(te);M&&console.timeEnd(Q);for(let J=q;J>=V;J--){const de=+Date.now();re=this.trees[J]=this._createTree(this._cluster(re,J)),M&&console.log("z%d: %d clusters in %dms",J,re.numItems,+Date.now()-de)}return M&&console.timeEnd("total time"),this}getClusters(z,M){let V=((z[0]+180)%360+360)%360-180;const q=Math.max(-90,Math.min(90,z[1]));let Q=z[2]===180?180:((z[2]+180)%360+360)%360-180;const te=Math.max(-90,Math.min(90,z[3]));if(z[2]-z[0]>=360)V=-180,Q=180;else if(V>Q){const ce=this.getClusters([V,q,180,te],M),Te=this.getClusters([-180,q,Q,te],M);return ce.concat(Te)}const re=this.trees[this._limitZoom(M)],J=re.range(Di(V),Hi(te),Di(Q),Hi(q)),de=re.data,ge=[];for(const ce of J){const Te=this.stride*ce;ge.push(de[Te+Gi]>1?ar(de,Te,this.clusterProps):this.points[de[Te+Ti]])}return ge}getChildren(z){const M=this._getOriginId(z),V=this._getOriginZoom(z),q="No cluster with the specified id.",Q=this.trees[V];if(!Q)throw new Error(q);const te=Q.data;if(M*this.stride>=te.length)throw new Error(q);const re=this.options.radius/(this.options.extent*Math.pow(2,V-1)),J=Q.within(te[M*this.stride],te[M*this.stride+1],re),de=[];for(const ge of J){const ce=ge*this.stride;te[ce+4]===z&&de.push(te[ce+Gi]>1?ar(te,ce,this.clusterProps):this.points[te[ce+Ti]])}if(de.length===0)throw new Error(q);return de}getLeaves(z,M,V){const q=[];return this._appendLeaves(q,z,M=M||10,V=V||0,0),q}getTile(z,M,V){const q=this.trees[this._limitZoom(z)],Q=Math.pow(2,z),{extent:te,radius:re}=this.options,J=re/te,de=(V-J)/Q,ge=(V+1+J)/Q,ce={features:[]};return this._addTileFeatures(q.range((M-J)/Q,de,(M+1+J)/Q,ge),q.data,M,V,Q,ce),M===0&&this._addTileFeatures(q.range(1-J/Q,de,1,ge),q.data,Q,V,Q,ce),M===Q-1&&this._addTileFeatures(q.range(0,de,J/Q,ge),q.data,-1,V,Q,ce),ce.features.length?ce:null}getClusterExpansionZoom(z){let M=this._getOriginZoom(z)-1;for(;M<=this.options.maxZoom;){const V=this.getChildren(z);if(M++,V.length!==1)break;z=V[0].properties.cluster_id}return M}_appendLeaves(z,M,V,q,Q){const te=this.getChildren(M);for(const re of te){const J=re.properties;if(J&&J.cluster?Q+J.point_count<=q?Q+=J.point_count:Q=this._appendLeaves(z,J.cluster_id,V,q,Q):Q<q?Q++:z.push(re),z.length===V)break}return Q}_createTree(z){const M=new T.aw(z.length/this.stride|0,this.options.nodeSize,Float32Array);for(let V=0;V<z.length;V+=this.stride)M.add(z[V],z[V+1]);return M.finish(),M.data=z,M}_addTileFeatures(z,M,V,q,Q,te){for(const re of z){const J=re*this.stride,de=M[J+Gi]>1;let ge,ce,Te;if(de)ge=_s(M,J,this.clusterProps),ce=M[J],Te=M[J+1];else{const rt=this.points[M[J+Ti]];ge=rt.properties;const[dt,it]=rt.geometry.coordinates;ce=Di(dt),Te=Hi(it)}const qe={type:1,geometry:[[Math.round(this.options.extent*(ce*Q-V)),Math.round(this.options.extent*(Te*Q-q))]],tags:ge};let Ge;Ge=de||this.options.generateId?M[J+Ti]:this.points[M[J+Ti]].id,Ge!==void 0&&(qe.id=Ge),te.features.push(qe)}}_limitZoom(z){return Math.max(this.options.minZoom,Math.min(Math.floor(+z),this.options.maxZoom+1))}_cluster(z,M){const{radius:V,extent:q,reduce:Q,minPoints:te}=this.options,re=V/(q*Math.pow(2,M)),J=z.data,de=[],ge=this.stride;for(let ce=0;ce<J.length;ce+=ge){if(J[ce+2]<=M)continue;J[ce+2]=M;const Te=J[ce],qe=J[ce+1],Ge=z.within(J[ce],J[ce+1],re),rt=J[ce+Gi];let dt=rt;for(const it of Ge){const Et=it*ge;J[Et+2]>M&&(dt+=J[Et+Gi])}if(dt>rt&&dt>=te){let it,Et=Te*rt,Nt=qe*rt,Ht=-1;const ot=((ce/ge|0)<<5)+(M+1)+this.points.length;for(const _t of Ge){const Ft=_t*ge;if(J[Ft+2]<=M)continue;J[Ft+2]=M;const Jt=J[Ft+Gi];Et+=J[Ft]*Jt,Nt+=J[Ft+1]*Jt,J[Ft+4]=ot,Q&&(it||(it=this._map(J,ce,!0),Ht=this.clusterProps.length,this.clusterProps.push(it)),Q(it,this._map(J,Ft)))}J[ce+4]=ot,de.push(Et/dt,Nt/dt,1/0,ot,-1,dt),Q&&de.push(Ht)}else{for(let it=0;it<ge;it++)de.push(J[ce+it]);if(dt>1)for(const it of Ge){const Et=it*ge;if(!(J[Et+2]<=M)){J[Et+2]=M;for(let Nt=0;Nt<ge;Nt++)de.push(J[Et+Nt])}}}}return de}_getOriginId(z){return z-this.points.length>>5}_getOriginZoom(z){return(z-this.points.length)%32}_map(z,M,V){if(z[M+Gi]>1){const te=this.clusterProps[z[M+gs]];return V?Object.assign({},te):te}const q=this.points[z[M+Ti]].properties,Q=this.options.map(q);return V&&Q===q?Object.assign({},Q):Q}}function ar(G,z,M){return{type:"Feature",id:G[z+Ti],properties:_s(G,z,M),geometry:{type:"Point",coordinates:[(V=G[z],360*(V-.5)),Jr(G[z+1])]}};var V}function _s(G,z,M){const V=G[z+Gi],q=V>=1e4?`${Math.round(V/1e3)}k`:V>=1e3?Math.round(V/100)/10+"k":V,Q=G[z+gs],te=Q===-1?{}:Object.assign({},M[Q]);return Object.assign(te,{cluster:!0,cluster_id:G[z+Ti],point_count:V,point_count_abbreviated:q})}function Di(G){return G/360+.5}function Hi(G){const z=Math.sin(G*Math.PI/180),M=.5-.25*Math.log((1+z)/(1-z))/Math.PI;return M<0?0:M>1?1:M}function Jr(G){const z=(180-360*G)*Math.PI/180;return 360*Math.atan(Math.exp(z))/Math.PI-90}function Kr(G,z,M,V){let q=V;const Q=z+(M-z>>1);let te,re=M-z;const J=G[z],de=G[z+1],ge=G[M],ce=G[M+1];for(let Te=z+3;Te<M;Te+=3){const qe=js(G[Te],G[Te+1],J,de,ge,ce);if(qe>q)te=Te,q=qe;else if(qe===q){const Ge=Math.abs(Te-Q);Ge<re&&(te=Te,re=Ge)}}q>V&&(te-z>3&&Kr(G,z,te,V),G[te+2]=q,M-te>3&&Kr(G,te,M,V))}function js(G,z,M,V,q,Q){let te=q-M,re=Q-V;if(te!==0||re!==0){const J=((G-M)*te+(z-V)*re)/(te*te+re*re);J>1?(M=q,V=Q):J>0&&(M+=te*J,V+=re*J)}return te=G-M,re=z-V,te*te+re*re}function vr(G,z,M,V){const q={id:G??null,type:z,geometry:M,tags:V,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(z==="Point"||z==="MultiPoint"||z==="LineString")zr(q,M);else if(z==="Polygon")zr(q,M[0]);else if(z==="MultiLineString")for(const Q of M)zr(q,Q);else if(z==="MultiPolygon")for(const Q of M)zr(q,Q[0]);return q}function zr(G,z){for(let M=0;M<z.length;M+=3)G.minX=Math.min(G.minX,z[M]),G.minY=Math.min(G.minY,z[M+1]),G.maxX=Math.max(G.maxX,z[M]),G.maxY=Math.max(G.maxY,z[M+1])}function Dr(G,z,M,V){if(!z.geometry)return;const q=z.geometry.coordinates;if(q&&q.length===0)return;const Q=z.geometry.type,te=Math.pow(M.tolerance/((1<<M.maxZoom)*M.extent),2);let re=[],J=z.id;if(M.promoteId?J=z.properties[M.promoteId]:M.generateId&&(J=V||0),Q==="Point")ys(q,re);else if(Q==="MultiPoint")for(const de of q)ys(de,re);else if(Q==="LineString")he(q,re,te,!1);else if(Q==="MultiLineString"){if(M.lineMetrics){for(const de of q)re=[],he(de,re,te,!1),G.push(vr(J,"LineString",re,z.properties));return}Yr(q,re,te,!1)}else if(Q==="Polygon")Yr(q,re,te,!0);else{if(Q!=="MultiPolygon"){if(Q==="GeometryCollection"){for(const de of z.geometry.geometries)Dr(G,{id:J,geometry:de,properties:z.properties},M,V);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const de of q){const ge=[];Yr(de,ge,te,!0),re.push(ge)}}G.push(vr(J,Q,re,z.properties))}function ys(G,z){z.push(Us(G[0]),mt(G[1]),0)}function he(G,z,M,V){let q,Q,te=0;for(let J=0;J<G.length;J++){const de=Us(G[J][0]),ge=mt(G[J][1]);z.push(de,ge,0),J>0&&(te+=V?(q*ge-de*Q)/2:Math.sqrt(Math.pow(de-q,2)+Math.pow(ge-Q,2))),q=de,Q=ge}const re=z.length-3;z[2]=1,Kr(z,0,re,M),z[re+2]=1,z.size=Math.abs(te),z.start=0,z.end=z.size}function Yr(G,z,M,V){for(let q=0;q<G.length;q++){const Q=[];he(G[q],Q,M,V),z.push(Q)}}function Us(G){return G/360+.5}function mt(G){const z=Math.sin(G*Math.PI/180),M=.5-.25*Math.log((1+z)/(1-z))/Math.PI;return M<0?0:M>1?1:M}function $t(G,z,M,V,q,Q,te,re){if(V/=z,Q>=(M/=z)&&te<V)return G;if(te<M||Q>=V)return null;const J=[];for(const de of G){const ge=de.geometry;let ce=de.type;const Te=q===0?de.minX:de.minY,qe=q===0?de.maxX:de.maxY;if(Te>=M&&qe<V){J.push(de);continue}if(qe<M||Te>=V)continue;let Ge=[];if(ce==="Point"||ce==="MultiPoint")qs(ge,Ge,M,V,q);else if(ce==="LineString")Lr(ge,Ge,M,V,q,!1,re.lineMetrics);else if(ce==="MultiLineString")xs(ge,Ge,M,V,q,!1);else if(ce==="Polygon")xs(ge,Ge,M,V,q,!0);else if(ce==="MultiPolygon")for(const rt of ge){const dt=[];xs(rt,dt,M,V,q,!0),dt.length&&Ge.push(dt)}if(Ge.length){if(re.lineMetrics&&ce==="LineString"){for(const rt of Ge)J.push(vr(de.id,ce,rt,de.tags));continue}ce!=="LineString"&&ce!=="MultiLineString"||(Ge.length===1?(ce="LineString",Ge=Ge[0]):ce="MultiLineString"),ce!=="Point"&&ce!=="MultiPoint"||(ce=Ge.length===3?"Point":"MultiPoint"),J.push(vr(de.id,ce,Ge,de.tags))}}return J.length?J:null}function qs(G,z,M,V,q){for(let Q=0;Q<G.length;Q+=3){const te=G[Q+q];te>=M&&te<=V&&ji(z,G[Q],G[Q+1],G[Q+2])}}function Lr(G,z,M,V,q,Q,te){let re=br(G);const J=q===0?Zs:Gs;let de,ge,ce=G.start;for(let dt=0;dt<G.length-3;dt+=3){const it=G[dt],Et=G[dt+1],Nt=G[dt+2],Ht=G[dt+3],ot=G[dt+4],_t=q===0?it:Et,Ft=q===0?Ht:ot;let Jt=!1;te&&(de=Math.sqrt(Math.pow(it-Ht,2)+Math.pow(Et-ot,2))),_t<M?Ft>M&&(ge=J(re,it,Et,Ht,ot,M),te&&(re.start=ce+de*ge)):_t>V?Ft<V&&(ge=J(re,it,Et,Ht,ot,V),te&&(re.start=ce+de*ge)):ji(re,it,Et,Nt),Ft<M&&_t>=M&&(ge=J(re,it,Et,Ht,ot,M),Jt=!0),Ft>V&&_t<=V&&(ge=J(re,it,Et,Ht,ot,V),Jt=!0),!Q&&Jt&&(te&&(re.end=ce+de*ge),z.push(re),re=br(G)),te&&(ce+=de)}let Te=G.length-3;const qe=G[Te],Ge=G[Te+1],rt=q===0?qe:Ge;rt>=M&&rt<=V&&ji(re,qe,Ge,G[Te+2]),Te=re.length-3,Q&&Te>=3&&(re[Te]!==re[0]||re[Te+1]!==re[1])&&ji(re,re[0],re[1],re[2]),re.length&&z.push(re)}function br(G){const z=[];return z.size=G.size,z.start=G.start,z.end=G.end,z}function xs(G,z,M,V,q,Q){for(const te of G)Lr(te,z,M,V,q,Q,!1)}function ji(G,z,M,V){G.push(z,M,V)}function Zs(G,z,M,V,q,Q){const te=(Q-z)/(V-z);return ji(G,Q,M+(q-M)*te,1),te}function Gs(G,z,M,V,q,Q){const te=(Q-M)/(q-M);return ji(G,z+(V-z)*te,Q,1),te}function Se(G,z){const M=[];for(let V=0;V<G.length;V++){const q=G[V],Q=q.type;let te;if(Q==="Point"||Q==="MultiPoint"||Q==="LineString")te=lr(q.geometry,z);else if(Q==="MultiLineString"||Q==="Polygon"){te=[];for(const re of q.geometry)te.push(lr(re,z))}else if(Q==="MultiPolygon"){te=[];for(const re of q.geometry){const J=[];for(const de of re)J.push(lr(de,z));te.push(J)}}M.push(vr(q.id,Q,te,q.tags))}return M}function lr(G,z){const M=[];M.size=G.size,G.start!==void 0&&(M.start=G.start,M.end=G.end);for(let V=0;V<G.length;V+=3)M.push(G[V]+z,G[V+1],G[V+2]);return M}function xi(G,z){if(G.transformed)return G;const M=1<<G.z,V=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 J=0;J<te.length;J+=2)Q.geometry.push(cr(te[J],te[J+1],z,M,V,q));else for(let J=0;J<te.length;J++){const de=[];for(let ge=0;ge<te[J].length;ge+=2)de.push(cr(te[J][ge],te[J][ge+1],z,M,V,q));Q.geometry.push(de)}}return G.transformed=!0,G}function cr(G,z,M,V,q,Q){return[Math.round(M*(G*V-q)),Math.round(M*(z*V-Q))]}function Rr(G,z,M,V,q){const Q=z===q.maxZoom?0:q.tolerance/((1<<z)*q.extent),te={features:[],numPoints:0,numSimplified:0,numFeatures:G.length,source:null,x:M,y:V,z,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const re of G)Ae(te,re,Q,q);return te}function Ae(G,z,M,V){const q=z.geometry,Q=z.type,te=[];if(G.minX=Math.min(G.minX,z.minX),G.minY=Math.min(G.minY,z.minY),G.maxX=Math.max(G.maxX,z.maxX),G.maxY=Math.max(G.maxY,z.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")nt(te,q,G,M,!1,!1);else if(Q==="MultiLineString"||Q==="Polygon")for(let re=0;re<q.length;re++)nt(te,q[re],G,M,Q==="Polygon",re===0);else if(Q==="MultiPolygon")for(let re=0;re<q.length;re++){const J=q[re];for(let de=0;de<J.length;de++)nt(te,J[de],G,M,!0,de===0)}if(te.length){let re=z.tags||null;if(Q==="LineString"&&V.lineMetrics){re={};for(const de in z.tags)re[de]=z.tags[de];re.mapbox_clip_start=q.start/q.size,re.mapbox_clip_end=q.end/q.size}const J={geometry:te,type:Q==="Polygon"||Q==="MultiPolygon"?3:Q==="LineString"||Q==="MultiLineString"?2:1,tags:re};z.id!==null&&(J.id=z.id),G.features.push(J)}}function nt(G,z,M,V,q,Q){const te=V*V;if(V>0&&z.size<(q?te:V))return void(M.numPoints+=z.length/3);const re=[];for(let J=0;J<z.length;J+=3)(V===0||z[J+2]>te)&&(M.numSimplified++,re.push(z[J],z[J+1])),M.numPoints++;q&&function(J,de){let ge=0;for(let ce=0,Te=J.length,qe=Te-2;ce<Te;qe=ce,ce+=2)ge+=(J[ce]-J[qe])*(J[ce+1]+J[qe+1]);if(ge>0===de)for(let ce=0,Te=J.length;ce<Te/2;ce+=2){const qe=J[ce],Ge=J[ce+1];J[ce]=J[Te-2-ce],J[ce+1]=J[Te-1-ce],J[Te-2-ce]=qe,J[Te-1-ce]=Ge}}(re,Q),G.push(re)}const Je={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Ei{constructor(z,M){const V=(M=this.options=function(Q,te){for(const re in te)Q[re]=te[re];return Q}(Object.create(Je),M)).debug;if(V&&console.time("preprocess data"),M.maxZoom<0||M.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(M.promoteId&&M.generateId)throw new Error("promoteId and generateId cannot be used together.");let q=function(Q,te){const re=[];if(Q.type==="FeatureCollection")for(let J=0;J<Q.features.length;J++)Dr(re,Q.features[J],te,J);else Dr(re,Q.type==="Feature"?Q:{geometry:Q},te);return re}(z,M);this.tiles={},this.tileCoords=[],V&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",M.indexMaxZoom,M.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),q=function(Q,te){const re=te.buffer/te.extent;let J=Q;const de=$t(Q,1,-1-re,re,0,-1,2,te),ge=$t(Q,1,1-re,2+re,0,-1,2,te);return(de||ge)&&(J=$t(Q,1,-re,1+re,0,-1,2,te)||[],de&&(J=Se(de,1).concat(J)),ge&&(J=J.concat(Se(ge,-1)))),J}(q,M),q.length&&this.splitTile(q,0,0,0),V&&(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(z,M,V,q,Q,te,re){const J=[z,M,V,q],de=this.options,ge=de.debug;for(;J.length;){q=J.pop(),V=J.pop(),M=J.pop(),z=J.pop();const ce=1<<M,Te=Wi(M,V,q);let qe=this.tiles[Te];if(!qe&&(ge>1&&console.time("creation"),qe=this.tiles[Te]=Rr(z,M,V,q,de),this.tileCoords.push({z:M,x:V,y:q}),ge)){ge>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",M,V,q,qe.numFeatures,qe.numPoints,qe.numSimplified),console.timeEnd("creation"));const Jt=`z${M}`;this.stats[Jt]=(this.stats[Jt]||0)+1,this.total++}if(qe.source=z,Q==null){if(M===de.indexMaxZoom||qe.numPoints<=de.indexMaxPoints)continue}else{if(M===de.maxZoom||M===Q)continue;if(Q!=null){const Jt=Q-M;if(V!==te>>Jt||q!==re>>Jt)continue}}if(qe.source=null,z.length===0)continue;ge>1&&console.time("clipping");const Ge=.5*de.buffer/de.extent,rt=.5-Ge,dt=.5+Ge,it=1+Ge;let Et=null,Nt=null,Ht=null,ot=null,_t=$t(z,ce,V-Ge,V+dt,0,qe.minX,qe.maxX,de),Ft=$t(z,ce,V+rt,V+it,0,qe.minX,qe.maxX,de);z=null,_t&&(Et=$t(_t,ce,q-Ge,q+dt,1,qe.minY,qe.maxY,de),Nt=$t(_t,ce,q+rt,q+it,1,qe.minY,qe.maxY,de),_t=null),Ft&&(Ht=$t(Ft,ce,q-Ge,q+dt,1,qe.minY,qe.maxY,de),ot=$t(Ft,ce,q+rt,q+it,1,qe.minY,qe.maxY,de),Ft=null),ge>1&&console.timeEnd("clipping"),J.push(Et||[],M+1,2*V,2*q),J.push(Nt||[],M+1,2*V,2*q+1),J.push(Ht||[],M+1,2*V+1,2*q),J.push(ot||[],M+1,2*V+1,2*q+1)}}getTile(z,M,V){z=+z,M=+M,V=+V;const q=this.options,{extent:Q,debug:te}=q;if(z<0||z>24)return null;const re=1<<z,J=Wi(z,M=M+re&re-1,V);if(this.tiles[J])return xi(this.tiles[J],Q);te>1&&console.log("drilling down to z%d-%d-%d",z,M,V);let de,ge=z,ce=M,Te=V;for(;!de&&ge>0;)ge--,ce>>=1,Te>>=1,de=this.tiles[Wi(ge,ce,Te)];return de&&de.source?(te>1&&(console.log("found parent tile z%d-%d-%d",ge,ce,Te),console.time("drilling down")),this.splitTile(de.source,ge,ce,Te,z,M,V),te>1&&console.timeEnd("drilling down"),this.tiles[J]?xi(this.tiles[J],Q):null):null}}function Wi(G,z,M){return 32*((1<<G)*M+z)+G}function tt(G,z){return z?G.properties[z]:G.id}function hr(G,z){if(G==null)return!0;if(G.type==="Feature")return tt(G,z)!=null;if(G.type==="FeatureCollection"){const M=new Set;for(const V of G.features){const q=tt(V,z);if(q==null||M.has(q))return!1;M.add(q)}return!0}return!1}function wr(G,z){const M=new Map;if(G!=null)if(G.type==="Feature")M.set(tt(G,z),G);else for(const V of G.features)M.set(tt(V,z),V);return M}class Br extends ae{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(z,M){return T._(this,void 0,void 0,function*(){const V=z.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const q=this._geoJSONIndex.getTile(V.z,V.x,V.y);if(!q)return null;const Q=new class{constructor(re){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=T.X,this.length=re.length,this._features=re}feature(re){return new class{constructor(J){this._feature=J,this.extent=T.X,this.type=J.type,this.properties=J.tags,"id"in J&&!isNaN(J.id)&&(this.id=parseInt(J.id,10))}loadGeometry(){if(this._feature.type===1){const J=[];for(const de of this._feature.geometry)J.push([new T.P(de[0],de[1])]);return J}{const J=[];for(const de of this._feature.geometry){const ge=[];for(const ce of de)ge.push(new T.P(ce[0],ce[1]));J.push(ge)}return J}}toGeoJSON(J,de,ge){return Fe.call(this,J,de,ge)}}(this._features[re])}}(q.features);let te=or(Q);return te.byteOffset===0&&te.byteLength===te.buffer.byteLength||(te=new Uint8Array(te)),{vectorTile:Q,rawData:te.buffer}})}loadData(z){return T._(this,void 0,void 0,function*(){var M;(M=this._pendingRequest)===null||M===void 0||M.abort();const V=!!(z&&z.request&&z.request.collectResourceTiming)&&new T.bu(z.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(z,this._pendingRequest),this._geoJSONIndex=z.cluster?new Mr(function({superclusterOptions:te,clusterProperties:re}){if(!re||!te)return te;const J={},de={},ge={accumulated:null,zoom:0},ce={properties:null},Te=Object.keys(re);for(const qe of Te){const[Ge,rt]=re[qe],dt=T.bB(rt),it=T.bB(typeof Ge=="string"?[Ge,["accumulated"],["get",qe]]:Ge);J[qe]=dt.value,de[qe]=it.value}return te.map=qe=>{ce.properties=qe;const Ge={};for(const rt of Te)Ge[rt]=J[rt].evaluate(ge,ce);return Ge},te.reduce=(qe,Ge)=>{ce.properties=Ge;for(const rt of Te)ge.accumulated=qe[rt],qe[rt]=de[rt].evaluate(ge,ce)},te}(z)).load((yield this._pendingData).features):(q=yield this._pendingData,new Ei(q,z.geojsonVtOptions)),this.loaded={};const Q={};if(V){const te=V.finish();te&&(Q.resourceTiming={},Q.resourceTiming[z.source]=JSON.parse(JSON.stringify(te)))}return Q}catch(Q){if(delete this._pendingRequest,T.bA(Q))return{abandoned:!0};throw Q}var q})}getData(){return T._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(z){const M=this.loaded;return M&&M[z.uid]?super.reloadTile(z):this.loadTile(z)}loadAndProcessGeoJSON(z,M){return T._(this,void 0,void 0,function*(){let V=yield this.loadGeoJSON(z,M);if(delete this._pendingRequest,typeof V!="object")throw new Error(`Input data given to '${z.source}' is not a valid GeoJSON object.`);if(Xe(V,!0),z.filter){const q=T.bB(z.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(", "));V={type:"FeatureCollection",features:V.features.filter(te=>q.value.evaluate({zoom:0},te))}}return V})}loadGeoJSON(z,M){return T._(this,void 0,void 0,function*(){const{promoteId:V}=z;if(z.request){const q=yield T.h(z.request,M);return this._dataUpdateable=hr(q.data,V)?wr(q.data,V):void 0,q.data}if(typeof z.data=="string")try{const q=JSON.parse(z.data);return this._dataUpdateable=hr(q,V)?wr(q,V):void 0,q}catch{throw new Error(`Input data given to '${z.source}' is not a valid GeoJSON object.`)}if(!z.dataDiff)throw new Error(`Input data given to '${z.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${z.source}`);return function(q,Q,te){var re,J,de,ge;if(Q.removeAll&&q.clear(),Q.remove)for(const ce of Q.remove)q.delete(ce);if(Q.add)for(const ce of Q.add){const Te=tt(ce,te);Te!=null&&q.set(Te,ce)}if(Q.update)for(const ce of Q.update){let Te=q.get(ce.id);if(Te==null)continue;const qe=!ce.removeAllProperties&&(((re=ce.removeProperties)===null||re===void 0?void 0:re.length)>0||((J=ce.addOrUpdateProperties)===null||J===void 0?void 0:J.length)>0);if((ce.newGeometry||ce.removeAllProperties||qe)&&(Te=Object.assign({},Te),q.set(ce.id,Te),qe&&(Te.properties=Object.assign({},Te.properties))),ce.newGeometry&&(Te.geometry=ce.newGeometry),ce.removeAllProperties)Te.properties={};else if(((de=ce.removeProperties)===null||de===void 0?void 0:de.length)>0)for(const Ge of ce.removeProperties)Object.prototype.hasOwnProperty.call(Te.properties,Ge)&&delete Te.properties[Ge];if(((ge=ce.addOrUpdateProperties)===null||ge===void 0?void 0:ge.length)>0)for(const{key:Ge,value:rt}of ce.addOrUpdateProperties)Te.properties[Ge]=rt}}(this._dataUpdateable,z.dataDiff,V),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(z){return T._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(z){return this._geoJSONIndex.getClusterExpansionZoom(z.clusterId)}getClusterChildren(z){return this._geoJSONIndex.getChildren(z.clusterId)}getClusterLeaves(z){return this._geoJSONIndex.getLeaves(z.clusterId,z.limit,z.offset)}}class ur{constructor(z){this.self=z,this.actor=new T.F(z),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(M,V)=>{if(this.externalWorkerSourceTypes[M])throw new Error(`Worker source with name "${M}" already registered.`);this.externalWorkerSourceTypes[M]=V},this.self.addProtocol=T.bh,this.self.removeProtocol=T.bi,this.self.registerRTLTextPlugin=M=>{if(T.bC.isParsed())throw new Error("RTL text plugin already registered.");T.bC.setMethods(M)},this.actor.registerMessageHandler("LDT",(M,V)=>this._getDEMWorkerSource(M,V.source).loadTile(V)),this.actor.registerMessageHandler("RDT",(M,V)=>T._(this,void 0,void 0,function*(){this._getDEMWorkerSource(M,V.source).removeTile(V)})),this.actor.registerMessageHandler("GCEZ",(M,V)=>T._(this,void 0,void 0,function*(){return this._getWorkerSource(M,V.type,V.source).getClusterExpansionZoom(V)})),this.actor.registerMessageHandler("GCC",(M,V)=>T._(this,void 0,void 0,function*(){return this._getWorkerSource(M,V.type,V.source).getClusterChildren(V)})),this.actor.registerMessageHandler("GCL",(M,V)=>T._(this,void 0,void 0,function*(){return this._getWorkerSource(M,V.type,V.source).getClusterLeaves(V)})),this.actor.registerMessageHandler("LD",(M,V)=>this._getWorkerSource(M,V.type,V.source).loadData(V)),this.actor.registerMessageHandler("GD",(M,V)=>this._getWorkerSource(M,V.type,V.source).getData()),this.actor.registerMessageHandler("LT",(M,V)=>this._getWorkerSource(M,V.type,V.source).loadTile(V)),this.actor.registerMessageHandler("RT",(M,V)=>this._getWorkerSource(M,V.type,V.source).reloadTile(V)),this.actor.registerMessageHandler("AT",(M,V)=>this._getWorkerSource(M,V.type,V.source).abortTile(V)),this.actor.registerMessageHandler("RMT",(M,V)=>this._getWorkerSource(M,V.type,V.source).removeTile(V)),this.actor.registerMessageHandler("RS",(M,V)=>T._(this,void 0,void 0,function*(){if(!this.workerSources[M]||!this.workerSources[M][V.type]||!this.workerSources[M][V.type][V.source])return;const q=this.workerSources[M][V.type][V.source];delete this.workerSources[M][V.type][V.source],q.removeSource!==void 0&&q.removeSource(V)})),this.actor.registerMessageHandler("RM",M=>T._(this,void 0,void 0,function*(){delete this.layerIndexes[M],delete this.availableImages[M],delete this.workerSources[M],delete this.demWorkerSources[M]})),this.actor.registerMessageHandler("SR",(M,V)=>T._(this,void 0,void 0,function*(){this.referrer=V})),this.actor.registerMessageHandler("SRPS",(M,V)=>this._syncRTLPluginState(M,V)),this.actor.registerMessageHandler("IS",(M,V)=>T._(this,void 0,void 0,function*(){this.self.importScripts(V)})),this.actor.registerMessageHandler("SI",(M,V)=>this._setImages(M,V)),this.actor.registerMessageHandler("UL",(M,V)=>T._(this,void 0,void 0,function*(){this._getLayerIndex(M).update(V.layers,V.removedIds)})),this.actor.registerMessageHandler("SL",(M,V)=>T._(this,void 0,void 0,function*(){this._getLayerIndex(M).replace(V)}))}_setImages(z,M){return T._(this,void 0,void 0,function*(){this.availableImages[z]=M;for(const V in this.workerSources[z]){const q=this.workerSources[z][V];for(const Q in q)q[Q].availableImages=M}})}_syncRTLPluginState(z,M){return T._(this,void 0,void 0,function*(){if(T.bC.isParsed())return T.bC.getState();if(M.pluginStatus!=="loading")return T.bC.setState(M),M;const V=M.pluginURL;if(this.self.importScripts(V),T.bC.isParsed()){const q={pluginStatus:"loaded",pluginURL:V};return T.bC.setState(q),q}throw T.bC.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${V}`)})}_getAvailableImages(z){let M=this.availableImages[z];return M||(M=[]),M}_getLayerIndex(z){let M=this.layerIndexes[z];return M||(M=this.layerIndexes[z]=new c),M}_getWorkerSource(z,M,V){if(this.workerSources[z]||(this.workerSources[z]={}),this.workerSources[z][M]||(this.workerSources[z][M]={}),!this.workerSources[z][M][V]){const q={sendAsync:(Q,te)=>(Q.targetMapId=z,this.actor.sendAsync(Q,te))};switch(M){case"vector":this.workerSources[z][M][V]=new ae(q,this._getLayerIndex(z),this._getAvailableImages(z));break;case"geojson":this.workerSources[z][M][V]=new Br(q,this._getLayerIndex(z),this._getAvailableImages(z));break;default:this.workerSources[z][M][V]=new this.externalWorkerSourceTypes[M](q,this._getLayerIndex(z),this._getAvailableImages(z))}}return this.workerSources[z][M][V]}_getDEMWorkerSource(z,M){return this.demWorkerSources[z]||(this.demWorkerSources[z]={}),this.demWorkerSources[z][M]||(this.demWorkerSources[z][M]=new oe),this.demWorkerSources[z][M]}}return T.i(self)&&(self.worker=new ur(self)),ur}),B("index",["exports","./shared"],function(T,c){var fe="4.5.2";let _e,ye;const ae={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:u=>new Promise((t,s)=>{const o=requestAnimationFrame(t);u.signal.addEventListener("abort",()=>{cancelAnimationFrame(o),s(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"),s=t.getContext("2d",{willReadFrequently:!0});if(!s)throw new Error("failed to create canvas 2d context");return t.width=u.width,t.height=u.height,s.drawImage(u,0,0,u.width,u.height),s},resolveURL:u=>(_e||(_e=document.createElement("a")),_e.href=u,_e.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(ye==null&&(ye=matchMedia("(prefers-reduced-motion: reduce)")),ye.matches)}};class oe{static testProp(t){if(!oe.docStyle)return t[0];for(let s=0;s<t.length;s++)if(t[s]in oe.docStyle)return t[s];return t[0]}static create(t,s,o){const a=window.document.createElement(t);return s!==void 0&&(a.className=s),o&&o.appendChild(a),a}static createNS(t,s){return window.document.createElementNS(t,s)}static disableDrag(){oe.docStyle&&oe.selectProp&&(oe.userSelect=oe.docStyle[oe.selectProp],oe.docStyle[oe.selectProp]="none")}static enableDrag(){oe.docStyle&&oe.selectProp&&(oe.docStyle[oe.selectProp]=oe.userSelect)}static setTransform(t,s){t.style[oe.transformProp]=s}static addEventListener(t,s,o,a={}){t.addEventListener(s,o,"passive"in a?a:a.capture)}static removeEventListener(t,s,o,a={}){t.removeEventListener(s,o,"passive"in a?a:a.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",oe.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",oe.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",oe.suppressClickInternal,!0)},0)}static getScale(t){const s=t.getBoundingClientRect();return{x:s.width/t.offsetWidth||1,y:s.height/t.offsetHeight||1,boundingClientRect:s}}static getPoint(t,s,o){const a=s.boundingClientRect;return new c.P((o.clientX-a.left)/s.x-t.clientLeft,(o.clientY-a.top)/s.y-t.clientTop)}static mousePos(t,s){const o=oe.getScale(t);return oe.getPoint(t,o,s)}static touchPos(t,s){const o=[],a=oe.getScale(t);for(let h=0;h<s.length;h++)o.push(oe.getPoint(t,a,s[h]));return o}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}oe.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,oe.selectProp=oe.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),oe.transformProp=oe.testProp(["transform","WebkitTransform"]);const at={supported:!1,testSupport:function(u){!Fe&&Xe&&(ut?kt(u):Ve=u)}};let Ve,Xe,Fe=!1,ut=!1;function kt(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,Xe),u.isContextLost())return;at.supported=!0}catch{}u.deleteTexture(t),Fe=!0}var Ze;typeof document<"u"&&(Xe=document.createElement("img"),Xe.onload=()=>{Ve&&kt(Ve),Ve=null,ut=!0},Xe.onerror=()=>{Fe=!0,Ve=null},Xe.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(u){let t,s,o,a;u.resetRequestQueue=()=>{t=[],s=0,o=0,a={}},u.addThrottleControl=v=>{const w=o++;return a[w]=v,w},u.removeThrottleControl=v=>{delete a[v],g()},u.getImage=(v,w,A=!0)=>new Promise((I,L)=>{at.supported&&(v.headers||(v.headers={}),v.headers.accept="image/webp,*/*"),c.e(v,{type:"image"}),t.push({abortController:w,requestParameters:v,supportImageRefresh:A,state:"queued",onError:F=>{L(F)},onSuccess:F=>{I(F)}}),g()});const h=v=>c._(this,void 0,void 0,function*(){v.state="running";const{requestParameters:w,supportImageRefresh:A,onError:I,onSuccess:L,abortController:F}=v,$=A===!1&&!c.i(self)&&!c.g(w.url)&&(!w.headers||Object.keys(w.headers).reduce((H,K)=>H&&K==="accept",!0));s++;const Z=$?y(w,F):c.m(w,F);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(j=H.data,typeof createImageBitmap=="function"?c.d(j):c.f(j)),cacheControl:H.cacheControl,expires:H.expires})}catch(H){delete v.abortController,I(H)}finally{s--,g()}var j}),g=()=>{const v=(()=>{for(const w of Object.keys(a))if(a[w]())return!0;return!1})()?c.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:c.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let w=s;w<v&&t.length>0;w++){const A=t.shift();A.abortController.signal.aborted?w--:h(A)}},y=(v,w)=>new Promise((A,I)=>{const L=new Image,F=v.url,$=v.credentials;$&&$==="include"?L.crossOrigin="use-credentials":($&&$==="same-origin"||!c.s(F))&&(L.crossOrigin="anonymous"),w.signal.addEventListener("abort",()=>{L.src="",I(c.c())}),L.fetchPriority="high",L.onload=()=>{L.onerror=L.onload=null,A({data:L})},L.onerror=()=>{L.onerror=L.onload=null,w.signal.aborted||I(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},L.src=F})}(Ze||(Ze={})),Ze.resetRequestQueue();class Ct{constructor(t){this._transformRequestFn=t}transformRequest(t,s){return this._transformRequestFn&&this._transformRequestFn(t,s)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function xt(u){var t=new c.A(3);return t[0]=u[0],t[1]=u[1],t[2]=u[2],t}var et,Tt=function(u,t,s){return u[0]=t[0]-s[0],u[1]=t[1]-s[1],u[2]=t[2]-s[2],u};et=new c.A(3),c.A!=Float32Array&&(et[0]=0,et[1]=0,et[2]=0);var nr=function(u){var t=u[0],s=u[1];return t*t+s*s};function si(u){const t=[];if(typeof u=="string")t.push({id:"default",url:u});else if(u&&u.length>0){const s=[];for(const{id:o,url:a}of u){const h=`${o}${a}`;s.indexOf(h)===-1&&(s.push(h),t.push({id:o,url:a}))}}return t}function Cr(u,t,s){const o=u.split("?");return o[0]+=`${t}${s}`,o.join("?")}(function(){var u=new c.A(2);c.A!=Float32Array&&(u[0]=0,u[1]=0)})();class vt{constructor(t,s,o,a){this.context=t,this.format=o,this.texture=t.gl.createTexture(),this.update(s,a)}update(t,s,o){const{width:a,height:h}=t,g=!(this.size&&this.size[0]===a&&this.size[1]===h||o),{context:y}=this,{gl:v}=y;if(this.useMipmap=!!(s&&s.useMipmap),v.bindTexture(v.TEXTURE_2D,this.texture),y.pixelStoreUnpackFlipY.set(!1),y.pixelStoreUnpack.set(1),y.pixelStoreUnpackPremultiplyAlpha.set(this.format===v.RGBA&&(!s||s.premultiply!==!1)),g)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:w,y:A}=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,w,A,v.RGBA,v.UNSIGNED_BYTE,t):v.texSubImage2D(v.TEXTURE_2D,0,w,A,a,h,v.RGBA,v.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&v.generateMipmap(v.TEXTURE_2D)}bind(t,s,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),s!==this.wrap&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,s),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,s),this.wrap=s)}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 Tn(u){const{userImage:t}=u;return!!(t&&t.render&&t.render())&&(u.data.replace(new Uint8Array(t.data.buffer)),!0)}class ni 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:s,promiseResolve:o}of this.requestors)o(this._getImagesForIds(s));this.requestors=[]}}getImage(t){const s=this.images[t];if(s&&!s.data&&s.spriteData){const o=s.spriteData;s.data=new c.R({width:o.width,height:o.height},o.context.getImageData(o.x,o.y,o.width,o.height).data),s.spriteData=null}return s}addImage(t,s){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,s)&&(this.images[t]=s)}_validate(t,s){let o=!0;const a=s.data||s.spriteData;return this._validateStretch(s.stretchX,a&&a.width)||(this.fire(new c.j(new Error(`Image "${t}" has invalid "stretchX" value`))),o=!1),this._validateStretch(s.stretchY,a&&a.height)||(this.fire(new c.j(new Error(`Image "${t}" has invalid "stretchY" value`))),o=!1),this._validateContent(s.content,s)||(this.fire(new c.j(new Error(`Image "${t}" has invalid "content" value`))),o=!1),o}_validateStretch(t,s){if(!t)return!0;let o=0;for(const a of t){if(a[0]<o||a[1]<a[0]||s<a[1])return!1;o=a[1]}return!0}_validateContent(t,s){if(!t)return!0;if(t.length!==4)return!1;const o=s.spriteData,a=o&&o.width||s.data.width,h=o&&o.height||s.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,s,o=!0){const a=this.getImage(t);if(o&&(a.data.width!==s.data.width||a.data.height!==s.data.height))throw new Error(`size mismatch between old image (${a.data.width}x${a.data.height}) and new image (${s.data.width}x${s.data.height}).`);s.version=a.version+1,this.images[t]=s,this.updatedImages[t]=!0}removeImage(t){const s=this.images[t];delete this.images[t],delete this.patterns[t],s.userImage&&s.userImage.onRemove&&s.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t){return new Promise((s,o)=>{let a=!0;if(!this.isLoaded())for(const h of t)this.images[h]||(a=!1);this.isLoaded()||a?s(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:s})})}_getImagesForIds(t){const s={};for(const o of t){let a=this.getImage(o);a||(this.fire(new c.k("styleimagemissing",{id:o})),a=this.getImage(o)),a?s[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 s}getPixelSize(){const{width:t,height:s}=this.atlasImage;return{width:t,height:s}}getPattern(t){const s=this.patterns[t],o=this.getImage(t);if(!o)return null;if(s&&s.position.version===o.version)return s.position;if(s)s.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 s=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new vt(t,this.atlasImage,s.RGBA),this.atlasTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const h in this.patterns)t.push(this.patterns[h].bin);const{w:s,h:o}=c.p(t),a=this.atlasImage;a.resize({width:s||1,height:o||1});for(const h in this.patterns){const{bin:g}=this.patterns[h],y=g.x+1,v=g.y+1,w=this.getImage(h).data,A=w.width,I=w.height;c.R.copy(w,a,{x:0,y:0},{x:y,y:v},{width:A,height:I}),c.R.copy(w,a,{x:0,y:I-1},{x:y,y:v-1},{width:A,height:1}),c.R.copy(w,a,{x:0,y:0},{x:y,y:v+I},{width:A,height:1}),c.R.copy(w,a,{x:A-1,y:0},{x:y-1,y:v},{width:1,height:I}),c.R.copy(w,a,{x:0,y:0},{x:y+A,y:v},{width:1,height:I})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const s of t){if(this.callbackDispatchedThisFrame[s])continue;this.callbackDispatchedThisFrame[s]=!0;const o=this.getImage(s);o||c.w(`Image with ID: "${s}" was not found`),Tn(o)&&this.updateImage(s,o)}}}const yi=1e20;function yr(u,t,s,o,a,h,g,y,v){for(let w=t;w<t+o;w++)ms(u,s*h+w,h,a,g,y,v);for(let w=s;w<s+a;w++)ms(u,w*h+t,1,o,g,y,v)}function ms(u,t,s,o,a,h,g){h[0]=0,g[0]=-yi,g[1]=yi,a[0]=u[t];for(let y=1,v=0,w=0;y<o;y++){a[y]=u[t+y*s];const A=y*y;do{const I=h[v];w=(a[y]-a[I]+A-I*I)/(y-I)/2}while(w<=g[v]&&--v>-1);v++,h[v]=y,g[v]=w,g[v+1]=yi}for(let y=0,v=0;y<o;y++){for(;g[v+1]<y;)v++;const w=h[v],A=y-w;u[t+y*s]=a[w]+A*A}}class or{constructor(t,s){this.requestManager=t,this.localIdeographFontFamily=s,this.entries={}}setURL(t){this.url=t}getGlyphs(t){return c._(this,void 0,void 0,function*(){const s=[];for(const h in t)for(const g of t[h])s.push(this._getAndCacheGlyphsPromise(h,g));const o=yield Promise.all(s),a={};for(const{stack:h,id:g,glyph:y}of o)a[h]||(a[h]={}),a[h][g]=y&&{id:y.id,bitmap:y.bitmap.clone(),metrics:y.metrics};return a})}_getAndCacheGlyphsPromise(t,s){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[s];if(a!==void 0)return{stack:t,id:s,glyph:a};if(a=this._tinySDF(o,t,s),a)return o.glyphs[s]=a,{stack:t,id:s,glyph:a};const h=Math.floor(s/256);if(256*h>65535)throw new Error("glyphs > 65535 not supported");if(o.ranges[h])return{stack:t,id:s,glyph:a};if(!this.url)throw new Error("glyphsUrl is not set");if(!o.requests[h]){const y=or.loadGlyphRange(t,h,this.url,this.requestManager);o.requests[h]=y}const g=yield o.requests[h];for(const y in g)this._doesCharSupportLocalGlyph(+y)||(o.glyphs[+y]=g[+y]);return o.ranges[h]=!0,{stack:t,id:s,glyph:g[s]||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,s,o){const a=this.localIdeographFontFamily;if(!a||!this._doesCharSupportLocalGlyph(o))return;let h=t.tinySDF;if(!h){let y="400";/bold/i.test(s)?y="900":/medium/i.test(s)?y="500":/light/i.test(s)&&(y="200"),h=t.tinySDF=new or.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:a,fontWeight:y})}const g=h.draw(String.fromCharCode(o));return{id:o,bitmap:new c.o({width:g.width||60,height:g.height||60},g.data),metrics:{width:g.glyphWidth/2||24,height:g.glyphHeight/2||24,left:g.glyphLeft/2+.5||0,top:g.glyphTop/2-27.5||-8,advance:g.glyphAdvance/2||24,isDoubleResolution:!0}}}}or.loadGlyphRange=function(u,t,s,o){return c._(this,void 0,void 0,function*(){const a=256*t,h=a+255,g=o.transformRequest(s.replace("{fontstack}",u).replace("{range}",`${a}-${h}`),"Glyphs"),y=yield c.l(g,new AbortController);if(!y||!y.data)throw new Error(`Could not load glyph range. range: ${t}, ${a}-${h}`);const v={};for(const w of c.n(y.data))v[w.id]=w;return v})},or.TinySDF=class{constructor({fontSize:u=24,buffer:t=3,radius:s=8,cutoff:o=.25,fontFamily:a="sans-serif",fontWeight:h="normal",fontStyle:g="normal"}={}){this.buffer=t,this.cutoff=o,this.radius=s;const y=this.size=u+4*t,v=this._createCanvas(y),w=this.ctx=v.getContext("2d",{willReadFrequently:!0});w.font=`${g} ${h} ${u}px ${a}`,w.textBaseline="alphabetic",w.textAlign="left",w.fillStyle="black",this.gridOuter=new Float64Array(y*y),this.gridInner=new Float64Array(y*y),this.f=new Float64Array(y),this.z=new Float64Array(y+1),this.v=new Uint16Array(y)}_createCanvas(u){const t=document.createElement("canvas");return t.width=t.height=u,t}draw(u){const{width:t,actualBoundingBoxAscent:s,actualBoundingBoxDescent:o,actualBoundingBoxLeft:a,actualBoundingBoxRight:h}=this.ctx.measureText(u),g=Math.ceil(s),y=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(h-a))),v=Math.min(this.size-this.buffer,g+Math.ceil(o)),w=y+2*this.buffer,A=v+2*this.buffer,I=Math.max(w*A,0),L=new Uint8ClampedArray(I),F={data:L,width:w,height:A,glyphWidth:y,glyphHeight:v,glyphTop:g,glyphLeft:0,glyphAdvance:t};if(y===0||v===0)return F;const{ctx:$,buffer:Z,gridInner:j,gridOuter:H}=this;$.clearRect(Z,Z,y,v),$.fillText(u,Z,Z+g);const K=$.getImageData(Z,Z,y,v);H.fill(yi,0,I),j.fill(0,0,I);for(let N=0;N<v;N++)for(let ee=0;ee<y;ee++){const se=K.data[4*(N*y+ee)+3]/255;if(se===0)continue;const le=(N+Z)*w+ee+Z;if(se===1)H[le]=0,j[le]=yi;else{const me=.5-se;H[le]=me>0?me*me:0,j[le]=me<0?me*me:0}}yr(H,0,0,w,A,w,this.f,this.v,this.z),yr(j,Z,Z,y,v,w,this.f,this.v,this.z);for(let N=0;N<I;N++){const ee=Math.sqrt(H[N])-Math.sqrt(j[N]);L[N]=Math.round(255-255*(ee/this.radius+this.cutoff))}return F}};class En{constructor(){this.specification=c.v.light.position}possiblyEvaluate(t,s){return c.y(t.expression.evaluate(s))}interpolate(t,s,o){return{x:c.z.number(t.x,s.x,o),y:c.z.number(t.y,s.y,o),z:c.z.number(t.z,s.z,o)}}}let Xr;class xr extends c.E{constructor(t){super(),Xr=Xr||new c.q({anchor:new c.D(c.v.light.anchor),position:new En,color:new c.D(c.v.light.color),intensity:new c.D(c.v.light.intensity)}),this._transitionable=new c.T(Xr),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,s={}){if(!this._validate(c.r,t,s))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,s,o){return(!o||o.validate!==!1)&&c.t(this,t.call(c.x,{value:s,style:{glyphs:!0,sprite:!0},styleSpec:c.v}))}}const Ti=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 Gi extends c.E{constructor(t){super(),this._transitionable=new c.T(Ti),this.setSky(t),this._transitioning=this._transitionable.untransitioned()}setSky(t,s={}){if(!this._validate(c.B,t,s))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,s,o={}){return(o==null?void 0:o.validate)!==!1&&c.t(this,t.call(c.x,c.e({value:s,style:{glyphs:!0,sprite:!0},styleSpec:c.v})))}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}}class gs{constructor(t,s){this.width=t,this.height=s,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,s){const o=t.join(",")+String(s);return this.dashEntry[o]||(this.dashEntry[o]=this.addDash(t,s)),this.dashEntry[o]}getDashRanges(t,s,o){const a=[];let h=t.length%2==1?-t[t.length-1]*o:0,g=t[0]*o,y=!0;a.push({left:h,right:g,isDash:y,zeroLength:t[0]===0});let v=t[0];for(let w=1;w<t.length;w++){y=!y;const A=t[w];h=v*o,v+=A,g=v*o,a.push({left:h,right:g,isDash:y,zeroLength:A===0})}return a}addRoundDash(t,s,o){const a=s/2;for(let h=-o;h<=o;h++){const g=this.width*(this.nextRow+o+h);let y=0,v=t[y];for(let w=0;w<this.width;w++){w/v.right>1&&(v=t[++y]);const A=Math.abs(w-v.left),I=Math.abs(w-v.right),L=Math.min(A,I);let F;const $=h/o*(a+1);if(v.isDash){const Z=a-Math.abs($);F=Math.sqrt(L*L+Z*Z)}else F=a-Math.sqrt(L*L+$*$);this.data[g+w]=Math.max(0,Math.min(255,F+128))}}}addRegularDash(t){for(let y=t.length-1;y>=0;--y){const v=t[y],w=t[y+1];v.zeroLength?t.splice(y,1):w&&w.isDash===v.isDash&&(w.left=v.left,t.splice(y,1))}const s=t[0],o=t[t.length-1];s.isDash===o.isDash&&(s.left=o.left-this.width,o.right=s.right+this.width);const a=this.width*this.nextRow;let h=0,g=t[h];for(let y=0;y<this.width;y++){y/g.right>1&&(g=t[++h]);const v=Math.abs(y-g.left),w=Math.abs(y-g.right),A=Math.min(v,w);this.data[a+y]=Math.max(0,Math.min(255,(g.isDash?A:-A)+128))}}addDash(t,s){const o=s?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 y=0;y<t.length;y++)h+=t[y];if(h!==0){const y=this.width/h,v=this.getDashRanges(t,this.width,y);s?this.addRoundDash(v,y,o):this.addRegularDash(v)}const g={y:(this.nextRow+o+.5)/this.height,height:2*o/this.height,width:h};return this.nextRow+=a,this.dirty=!0,g}bind(t){const s=t.gl;this.texture?(s.bindTexture(s.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,s.texSubImage2D(s.TEXTURE_2D,0,0,0,this.width,this.height,s.ALPHA,s.UNSIGNED_BYTE,this.data))):(this.texture=s.createTexture(),s.bindTexture(s.TEXTURE_2D,this.texture),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.REPEAT),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.REPEAT),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texImage2D(s.TEXTURE_2D,0,s.ALPHA,this.width,this.height,0,s.ALPHA,s.UNSIGNED_BYTE,this.data))}}const Mr="maplibre_preloaded_worker_pool";class ar{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<ar.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(s=>{s.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Mr]}numActive(){return Object.keys(this.active).length}}const _s=Math.floor(ae.hardwareConcurrency/2);let Di,Hi;function Jr(){return Di||(Di=new ar),Di}ar.workerCount=c.C(globalThis)?Math.max(Math.min(_s,3),1):1;class Kr{constructor(t,s){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=s;const o=this.workerPool.acquire(s);for(let a=0;a<o.length;a++){const h=new c.F(o[a],s);h.name=`Worker ${a}`,this.actors.push(h)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,s){const o=[];for(const a of this.actors)o.push(a.sendAsync({type:t,data:s}));return Promise.all(o)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach(s=>{s.remove()}),this.actors=[],t&&this.workerPool.release(this.id)}registerMessageHandler(t,s){for(const o of this.actors)o.registerMessageHandler(t,s)}}function js(){return Hi||(Hi=new Kr(Jr(),c.G),Hi.registerMessageHandler("GR",(u,t,s)=>c.m(t,s))),Hi}function vr(u,t){const s=c.H();return c.J(s,s,[1,1,0]),c.K(s,s,[.5*u.width,.5*u.height,1]),c.L(s,s,u.calculatePosMatrix(t.toUnwrapped()))}function zr(u,t,s,o,a,h){const g=function(I,L,F){if(I)for(const $ of I){const Z=L[$];if(Z&&Z.source===F&&Z.type==="fill-extrusion")return!0}else for(const $ in L){const Z=L[$];if(Z.source===F&&Z.type==="fill-extrusion")return!0}return!1}(a&&a.layers,t,u.id),y=h.maxPitchScaleFactor(),v=u.tilesIn(o,y,g);v.sort(Dr);const w=[];for(const I of v)w.push({wrappedTileID:I.tileID.wrapped().key,queryResults:I.tile.queryRenderedFeatures(t,s,u._state,I.queryGeometry,I.cameraQueryGeometry,I.scale,a,h,y,vr(u.transform,I.tileID))});const A=function(I){const L={},F={};for(const $ of I){const Z=$.queryResults,j=$.wrappedTileID,H=F[j]=F[j]||{};for(const K in Z){const N=Z[K],ee=H[K]=H[K]||{},se=L[K]=L[K]||[];for(const le of N)ee[le.featureIndex]||(ee[le.featureIndex]=!0,se.push(le))}}return L}(w);for(const I in A)A[I].forEach(L=>{const F=L.feature,$=u.getFeatureState(F.layer["source-layer"],F.id);F.source=F.layer.source,F.layer["source-layer"]&&(F.sourceLayer=F.layer["source-layer"]),F.state=$});return A}function Dr(u,t){const s=u.tileID,o=t.tileID;return s.overscaledZ-o.overscaledZ||s.canonical.y-o.canonical.y||s.wrap-o.wrap||s.canonical.x-o.canonical.x}function ys(u,t,s){return c._(this,void 0,void 0,function*(){let o=u;if(u.url?o=(yield c.h(t.transformRequest(u.url,"Source"),s)).data:yield ae.frameAsync(s),!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 he{constructor(t,s){t&&(s?this.setSouthWest(t).setNorthEast(s):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 s=this._sw,o=this._ne;let a,h;if(t instanceof c.N)a=t,h=t;else{if(!(t instanceof he))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(he.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 s||o?(s.lng=Math.min(a.lng,s.lng),s.lat=Math.min(a.lat,s.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:s,lat:o}=c.N.convert(t);let a=this._sw.lng<=s&&s<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=s&&s>=this._ne.lng),this._sw.lat<=o&&o<=this._ne.lat&&a}static convert(t){return t instanceof he?t:t&&new he(t)}static fromLngLat(t,s=0){const o=360*s/40075017,a=o/Math.cos(Math.PI/180*t.lat);return new he(new c.N(t.lng-a,t.lat-o),new c.N(t.lng+a,t.lat+o))}}class Yr{constructor(t,s,o){this.bounds=he.convert(this.validateBounds(t)),this.minzoom=s||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 s=Math.pow(2,t.z),o=Math.floor(c.O(this.bounds.getWest())*s),a=Math.floor(c.Q(this.bounds.getNorth())*s),h=Math.ceil(c.O(this.bounds.getEast())*s),g=Math.ceil(c.Q(this.bounds.getSouth())*s);return t.x>=o&&t.x<h&&t.y>=a&&t.y<g}}class Us extends c.E{constructor(t,s,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(s,["url","scheme","tileSize","promoteId"])),this._options=c.e({type:"vector"},s),this._collectResourceTiming=s.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 ys(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 Yr(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 s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),o={request:this.map._requestManager.transformRequest(s,"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,g)=>{t.reloadPromise={resolve:h,reject:g}})}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,s){if(s&&s.resourceTiming&&(t.resourceTiming=s.resourceTiming),s&&this.map._refreshExpiredTiles&&t.setExpiryData(s),t.loadVectorData(s,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 mt extends c.E{constructor(t,s,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"},s),c.e(this,c.M(s,["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 ys(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,t&&(c.e(this,t),t.bounds&&(this.tileBounds=new Yr(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 s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{const o=yield Ze.getImage(this.map._requestManager.transformRequest(s,"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,g=o.data;t.texture=this.map.painter.getTileTexture(g.width),t.texture?t.texture.update(g,{useMipmap:!0}):(t.texture=new vt(a,g,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 mt{constructor(t,s,o,a){super(t,s,o,a),this.type="raster-dem",this.maxzoom=22,this._options=c.e({type:"raster-dem"},s),this.encoding=s.encoding||"mapbox",this.redFactor=s.redFactor,this.greenFactor=s.greenFactor,this.blueFactor=s.blueFactor,this.baseShift=s.baseShift}loadTile(t){return c._(this,void 0,void 0,function*(){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),o=this.map._requestManager.transformRequest(s,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{const a=yield Ze.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 g=c.b(h)&&c.U()?h:yield this.readImageNow(h),y={type:this.type,uid:t.uid,source:this.id,rawImageData:g,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:y});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 s=t.width+2,o=t.height+2;try{return new c.R({width:s,height:o},yield c.W(t,-1,-1,s,o))}catch{}}return ae.getImageData(t,1)})}_getNeighboringTiles(t){const s=t.canonical,o=Math.pow(2,s.z),a=(s.x-1+o)%o,h=s.x===0?t.wrap-1:t.wrap,g=(s.x+1+o)%o,y=s.x+1===o?t.wrap+1:t.wrap,v={};return v[new c.S(t.overscaledZ,h,s.z,a,s.y).key]={backfilled:!1},v[new c.S(t.overscaledZ,y,s.z,g,s.y).key]={backfilled:!1},s.y>0&&(v[new c.S(t.overscaledZ,h,s.z,a,s.y-1).key]={backfilled:!1},v[new c.S(t.overscaledZ,t.wrap,s.z,s.x,s.y-1).key]={backfilled:!1},v[new c.S(t.overscaledZ,y,s.z,g,s.y-1).key]={backfilled:!1}),s.y+1<o&&(v[new c.S(t.overscaledZ,h,s.z,a,s.y+1).key]={backfilled:!1},v[new c.S(t.overscaledZ,t.wrap,s.z,s.x,s.y+1).key]={backfilled:!1},v[new c.S(t.overscaledZ,y,s.z,g,s.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 qs extends c.E{constructor(t,s,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=s.data,this._options=c.e({},s),this._collectResourceTiming=s.collectResourceTiming,s.maxzoom!==void 0&&(this.maxzoom=s.maxzoom),s.type&&(this.type=s.type),s.attribution&&(this.attribution=s.attribution),this.promoteId=s.promoteId;const h=c.X/this.tileSize;this.workerOptions=c.e({source:this.id,cluster:s.cluster||!1,geojsonVtOptions:{buffer:(s.buffer!==void 0?s.buffer:128)*h,tolerance:(s.tolerance!==void 0?s.tolerance:.375)*h,extent:c.X,maxZoom:this.maxzoom,lineMetrics:s.lineMetrics||!1,generateId:s.generateId||!1},superclusterOptions:{maxZoom:s.clusterMaxZoom!==void 0?s.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,s.clusterMinPoints||2),extent:c.X,radius:(s.clusterRadius||50)*h,log:!1,generateId:s.generateId||!1},clusterProperties:s.clusterProperties,filter:s.filter},s.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,s,o){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:s,offset:o}})}_updateWorkerData(t){return c._(this,void 0,void 0,function*(){const s=c.e({type:this.type},this.workerOptions);t?s.dataDiff=t:typeof this._data=="string"?(s.request=this.map._requestManager.transformRequest(ae.resolveURL(this._data),"Source"),s.request.collectResourceTiming=this._collectResourceTiming):s.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:s});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 s=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:s,data:o},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(a,this.map.painter,s==="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 Lr=c.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class br extends c.E{constructor(t,s,o,a){super(),this.id=t,this.dispatcher=o,this.coordinates=s.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(a),this.options=s}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 s=yield Ze.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,s&&s.data&&(this.image=s.data,t&&(this.coordinates=t),this._finishLoading())}catch(s){this._request=null,this._loaded=!0,this.fire(new c.j(s))}})}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 s=t.map(c.Z.fromLngLat);this.tileID=function(a){let h=1/0,g=1/0,y=-1/0,v=-1/0;for(const L of a)h=Math.min(h,L.x),g=Math.min(g,L.y),y=Math.max(y,L.x),v=Math.max(v,L.y);const w=Math.max(y-h,v-g),A=Math.max(0,Math.floor(-Math.log(w)/Math.LN2)),I=Math.pow(2,A);return new c.a1(A,Math.floor((h+y)/2*I),Math.floor((g+v)/2*I))}(s),this.minzoom=this.maxzoom=this.tileID.z;const o=s.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,s=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Lr.members)),this.boundsSegments||(this.boundsSegments=c.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new vt(t,this.image,s.RGBA),this.texture.bind(s.LINEAR,s.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 xs extends br{constructor(t,s,o,a){super(t,s,o,a),this.roundZoom=!0,this.type="video",this.options=s}load(){return c._(this,void 0,void 0,function*(){this._loaded=!1;const t=this.options;this.urls=[];for(const s of t.urls)this.urls.push(this.map._requestManager.transformRequest(s,"Source").url);try{const s=yield c.a3(this.urls);if(this._loaded=!0,!s)return;this.video=s,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(s){this.fire(new c.j(s))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const s=this.video.seekable;t<s.start(0)||t>s.end(0)?this.fire(new c.j(new c.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${s.start(0)} and ${s.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,s=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Lr.members)),this.boundsSegments||(this.boundsSegments=c.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE),s.texSubImage2D(s.TEXTURE_2D,0,0,0,s.RGBA,s.UNSIGNED_BYTE,this.video)):(this.texture=new vt(t,this.video,s.RGBA),this.texture.bind(s.LINEAR,s.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 ji extends br{constructor(t,s,o,a){super(t,s,o,a),s.coordinates?Array.isArray(s.coordinates)&&s.coordinates.length===4&&!s.coordinates.some(h=>!Array.isArray(h)||h.length!==2||h.some(g=>typeof g!="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"'))),s.animate&&typeof s.animate!="boolean"&&this.fire(new c.j(new c.a2(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),s.canvas?typeof s.canvas=="string"||s.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=s,this.animate=s.animate===void 0||s.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 s=this.map.painter.context,o=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,Lr.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 vt(s,this.canvas,o.RGBA,{premultiply:!0});let a=!1;for(const h in this.tiles){const g=this.tiles[h];g.state!=="loaded"&&(g.state="loaded",g.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 Zs={},Gs=u=>{switch(u){case"geojson":return qs;case"image":return br;case"raster":return mt;case"raster-dem":return $t;case"vector":return Us;case"video":return xs;case"canvas":return ji}return Zs[u]},Se="RTLPluginLoaded";class lr extends c.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=js()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch(s=>{throw this.status="error",s})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return c._(this,arguments,void 0,function*(s,o=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=ae.resolveURL(s),!this.url)throw new Error(`requested url ${s} 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(Se))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let xi=null;function cr(){return xi||(xi=new lr),xi}class Rr{constructor(t,s){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=c.a4(),this.uses=0,this.tileSize=s,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 s=t+this.timeAdded;s<this.fadeEndTime||(this.fadeEndTime=s)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,s,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 g={};if(!h)return g;for(const y of a){const v=y.layerIds.map(w=>h.getLayer(w)).filter(Boolean);if(v.length!==0){y.layers=v,y.stateDependentLayerIds&&(y.stateDependentLayers=y.stateDependentLayerIds.map(w=>v.filter(A=>A.id===w)[0]));for(const w of v)g[w.id]=y}}return g}(t.buckets,s.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,cr().lazyLoad();break}}this.queryPadding=0;for(const a in this.buckets){const h=this.buckets[a];this.queryPadding=Math.max(this.queryPadding,s.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 s=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new vt(t,this.imageAtlas.image,s.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new vt(t,this.glyphAtlasImage,s.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,s,o,a,h,g,y,v,w,A){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:a,cameraQueryGeometry:h,scale:g,tileSize:this.tileSize,pixelPosMatrix:A,transform:v,params:y,queryPadding:this.queryPadding*w},t,s,o):{}}querySourceFeatures(t,s){const o=this.latestFeatureIndex;if(!o||!o.rawTileData)return;const a=o.loadVTLayers(),h=s&&s.sourceLayer?s.sourceLayer:"",g=a._geojsonTileLayer||a[h];if(!g)return;const y=c.a7(s&&s.filter),{z:v,x:w,y:A}=this.tileID.canonical,I={z:v,x:w,y:A};for(let L=0;L<g.length;L++){const F=g.feature(L);if(y.needGeometry){const j=c.a8(F,!0);if(!y.filter(new c.a9(this.tileID.overscaledZ),j,this.tileID.canonical))continue}else if(!y.filter(new c.a9(this.tileID.overscaledZ),F))continue;const $=o.getId(F,h),Z=new c.aa(F,v,w,A,$);Z.tile=I,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 s=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(s)if(this.expirationTime<s)a=!0;else{const h=this.expirationTime-s;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,s){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(t).length===0)return;const o=this.latestFeatureIndex.loadVTLayers();for(const a in this.buckets){if(!s.style.hasLayer(a))continue;const h=this.buckets[a],g=h.layers[0].sourceLayer||"_geojsonTileLayer",y=o[g],v=t[g];if(!y||!v||Object.keys(v).length===0)continue;h.update(v,y,this.imageAtlas&&this.imageAtlas.patternPositions||{});const w=s&&s.style&&s.style.getLayer(a);w&&(this.queryPadding=Math.max(this.queryPadding,w.queryRadius(h)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<ae.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=ae.now()+t}setDependencies(t,s){const o={};for(const a of s)o[a]=!0;this.dependencies[t]=o}hasDependency(t,s){for(const o of t){const a=this.dependencies[o];if(a){for(const h of s)if(a[h])return!0}}return!1}}class Ae{constructor(t,s){this.max=t,this.onRemove=s,this.reset()}reset(){for(const t in this.data)for(const s of this.data[t])s.timeout&&clearTimeout(s.timeout),this.onRemove(s.value);return this.data={},this.order=[],this}add(t,s,o){const a=t.wrapped().key;this.data[a]===void 0&&(this.data[a]=[]);const h={value:s,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 g=this._getAndRemoveByKey(this.order[0]);g&&this.onRemove(g)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const s=this.data[t].shift();return s.timeout&&clearTimeout(s.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),s.value}getByKey(t){const s=this.data[t];return s?s[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,s){if(!this.has(t))return this;const o=t.wrapped().key,a=s===void 0?0:this.data[o].indexOf(s),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 s=this._getAndRemoveByKey(this.order[0]);s&&this.onRemove(s)}return this}filter(t){const s=[];for(const o in this.data)for(const a of this.data[o])t(a.value)||s.push(a);for(const o of s)this.remove(o.value.tileID,o)}}class nt{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,s,o){const a=String(s);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,s,o){if(this.deletedStates[t]===null)return;const a=String(s);if(this.deletedStates[t]=this.deletedStates[t]||{},o&&s!==void 0)this.deletedStates[t][a]!==null&&(this.deletedStates[t][a]=this.deletedStates[t][a]||{},this.deletedStates[t][a][o]=null);else if(s!==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,s){const o=String(s),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][s];if(h===null)return{};for(const g in h)delete a[g]}return a}initializeTileState(t,s){t.setFeatureState(this.state,s)}coalesceChanges(t,s){const o={};for(const a in this.stateChanges){this.state[a]=this.state[a]||{};const h={};for(const g in this.stateChanges[a])this.state[a][g]||(this.state[a][g]={}),c.e(this.state[a][g],this.stateChanges[a][g]),h[g]=this.state[a][g];o[a]=h}for(const a in this.deletedStates){this.state[a]=this.state[a]||{};const h={};if(this.deletedStates[a]===null)for(const g in this.state[a])h[g]={},this.state[a][g]={};else for(const g in this.deletedStates[a]){if(this.deletedStates[a][g]===null)this.state[a][g]={};else for(const y of Object.keys(this.deletedStates[a][g]))delete this.state[a][g][y];h[g]=this.state[a][g]}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,s)}}class Je extends c.E{constructor(t,s,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,g,y)=>{const v=new(Gs(h.type))(a,h,g,y);if(v.id!==a)throw new Error(`Expected Source id to be ${a} instead of ${v.id}`);return v})(t,s,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 nt,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 s=this._tiles[t];if(s.state!=="loaded"&&s.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,s,o){return c._(this,void 0,void 0,function*(){try{yield this._source.loadTile(t),this._tileLoaded(t,s,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 s in this._tiles){const o=this._tiles[s];o.upload(t),o.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(Ei).map(t=>t.key)}getRenderableIds(t){const s=[];for(const o in this._tiles)this._isIdRenderable(o,t)&&s.push(this._tiles[o]);return t?s.sort((o,a)=>{const h=o.tileID,g=a.tileID,y=new c.P(h.canonical.x,h.canonical.y)._rotate(this.transform.angle),v=new c.P(g.canonical.x,g.canonical.y)._rotate(this.transform.angle);return h.overscaledZ-g.overscaledZ||v.y-y.y||v.x-y.x}).map(o=>o.tileID.key):s.map(o=>o.tileID).sort(Ei).map(o=>o.key)}hasRenderableParent(t){const s=this.findLoadedParent(t,0);return!!s&&this._isIdRenderable(s.tileID.key)}_isIdRenderable(t,s){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(s||!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,s){return c._(this,void 0,void 0,function*(){const o=this._tiles[t];o&&(o.state!=="loading"&&(o.state=s),yield this._loadTile(o,t,s))})}_tileLoaded(t,s,o){t.timeAdded=ae.now(),o==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(s,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 s=this.getRenderableIds();for(let a=0;a<s.length;a++){const h=s[a];if(t.neighboringTiles&&t.neighboringTiles[h]){const g=this.getTileByID(h);o(t,g),o(g,t)}}function o(a,h){a.needsHillshadePrepare=!0,a.needsTerrainPrepare=!0;let g=h.tileID.canonical.x-a.tileID.canonical.x;const y=h.tileID.canonical.y-a.tileID.canonical.y,v=Math.pow(2,a.tileID.canonical.z),w=h.tileID.key;g===0&&y===0||Math.abs(y)>1||(Math.abs(g)>1&&(Math.abs(g+v)===1?g+=v:Math.abs(g-v)===1&&(g-=v)),h.dem&&a.dem&&(a.dem.backfillBorder(h.dem,g,y),a.neighboringTiles&&a.neighboringTiles[w]&&(a.neighboringTiles[w].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,s,o,a){for(const h in this._tiles){let g=this._tiles[h];if(a[h]||!g.hasData()||g.tileID.overscaledZ<=s||g.tileID.overscaledZ>o)continue;let y=g.tileID;for(;g&&g.tileID.overscaledZ>s+1;){const w=g.tileID.scaledTo(g.tileID.overscaledZ-1);g=this._tiles[w.key],g&&g.hasData()&&(y=w)}let v=y;for(;v.overscaledZ>s;)if(v=v.scaledTo(v.overscaledZ-1),t[v.key]){a[y.key]=y;break}}}findLoadedParent(t,s){if(t.key in this._loadedParentTiles){const o=this._loadedParentTiles[t.key];return o&&o.tileID.overscaledZ>=s?o:null}for(let o=t.overscaledZ-1;o>=s;o--){const a=t.scaledTo(o),h=this._getLoadedTile(a);if(h)return h}}findLoadedSibling(t){return this._getLoadedTile(t)}_getLoadedTile(t){const s=this._tiles[t.key];return s&&s.hasData()?s:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const s=Math.ceil(t.width/this._source.tileSize)+1,o=Math.ceil(t.height/this._source.tileSize)+1,a=Math.floor(s*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 s=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,s){const o={};for(const a in this._tiles){const h=this._tiles[a];h.tileID=h.tileID.unwrapTo(h.tileID.wrap+s),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,s,o,a,h,g){const y={},v={},w=Object.keys(t),A=ae.now();for(const I of w){const L=t[I],F=this._tiles[I];if(!F||F.fadeEndTime!==0&&F.fadeEndTime<=A)continue;const $=this.findLoadedParent(L,s),Z=this.findLoadedSibling(L),j=$||Z||null;j&&(this._addTile(j.tileID),y[j.tileID.key]=j.tileID),v[I]=L}this._retainLoadedChildren(v,a,o,t);for(const I in y)t[I]||(this._coveredTiles[I]=!0,t[I]=y[I]);if(g){const I={},L={};for(const F of h)this._tiles[F.key].hasData()?I[F.key]=F:L[F.key]=F;for(const F in L){const $=L[F].children(this._source.maxzoom);this._tiles[$[0].key]&&this._tiles[$[1].key]&&this._tiles[$[2].key]&&this._tiles[$[3].key]&&(I[$[0].key]=t[$[0].key]=$[0],I[$[1].key]=t[$[1].key]=$[1],I[$[2].key]=t[$[2].key]=$[2],I[$[3].key]=t[$[3].key]=$[3],delete L[F])}for(const F in L){const $=L[F],Z=this.findLoadedParent($,this._source.minzoom),j=this.findLoadedSibling($),H=Z||j||null;if(H){I[H.tileID.key]=t[H.tileID.key]=H.tileID;for(const K in I)I[K].isChildOf(H.tileID)&&delete I[K]}}for(const F in this._tiles)I[F]||(this._coveredTiles[F]=!0)}}update(t,s){if(!this._sourceLoaded||this._paused)return;let o;this.transform=t,this.terrain=s,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(A=>new c.S(A.canonical.z,A.wrap,A.canonical.z,A.canonical.x,A.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:s}),this._source.hasTile&&(o=o.filter(A=>this._source.hasTile(A)))):o=[];const a=t.coveringZoomLevel(this._source),h=Math.max(a-Je.maxOverzooming,this._source.minzoom),g=Math.max(a+Je.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const A={};for(const I of o)if(I.canonical.z>this._source.minzoom){const L=I.scaledTo(I.canonical.z-1);A[L.key]=L;const F=I.scaledTo(Math.max(this._source.minzoom,Math.min(I.canonical.z,5)));A[F.key]=F}o=o.concat(Object.values(A))}const y=o.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,y&&this.fire(new c.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const v=this._updateRetainedTiles(o,a);Wi(this._source.type)&&this._updateCoveredAndRetainedTiles(v,h,g,a,o,s);for(const A in v)this._tiles[A].clearFadeHold();const w=c.ac(this._tiles,v);for(const A of w){const I=this._tiles[A];I.hasSymbolBuckets&&!I.holdingForFade()?I.setHoldDuration(this.map._fadeDuration):I.hasSymbolBuckets&&!I.symbolFadeFinished()||this._removeTile(A)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,s){var o;const a={},h={},g=Math.max(s-Je.maxOverzooming,this._source.minzoom),y=Math.max(s+Je.maxUnderzooming,this._source.minzoom),v={};for(const w of t){const A=this._addTile(w);a[w.key]=w,A.hasData()||s<this._source.maxzoom&&(v[w.key]=w)}this._retainLoadedChildren(v,s,y,a);for(const w of t){let A=this._tiles[w.key];if(A.hasData())continue;if(s+1>this._source.maxzoom){const L=w.children(this._source.maxzoom)[0],F=this.getTile(L);if(F&&F.hasData()){a[L.key]=L;continue}}else{const L=w.children(this._source.maxzoom);if(a[L[0].key]&&a[L[1].key]&&a[L[2].key]&&a[L[3].key])continue}let I=A.wasRequested();for(let L=w.overscaledZ-1;L>=g;--L){const F=w.scaledTo(L);if(h[F.key])break;if(h[F.key]=!0,A=this.getTile(F),!A&&I&&(A=this._addTile(F)),A){const $=A.hasData();if(($||!(!((o=this.map)===null||o===void 0)&&o.cancelPendingTileRequestsWhileZooming)||I)&&(a[F.key]=F),I=A.wasRequested(),$)break}}}return a}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const s=[];let o,a=this._tiles[t].tileID;for(;a.overscaledZ>0;){if(a.key in this._loadedParentTiles){o=this._loadedParentTiles[a.key];break}s.push(a.key);const h=a.scaledTo(a.overscaledZ-1);if(o=this._getLoadedTile(h),o)break;a=h}for(const h of s)this._loadedParentTiles[h]=o}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const t in this._tiles){const s=this._tiles[t].tileID,o=this._getLoadedTile(s);this._loadedSiblingTiles[s.key]=o}}_addTile(t){let s=this._tiles[t.key];if(s)return s;s=this._cache.getAndRemove(t),s&&(this._setTileReloadTimer(t.key,s),s.tileID=t,this._state.initializeTileState(s,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,s)));const o=s;return s||(s=new Rr(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(s,t.key,s.state)),s.uses++,this._tiles[t.key]=s,o||this._source.fire(new c.k("dataloading",{tile:s,coord:s.tileID,dataType:"source"})),s}_setTileReloadTimer(t,s){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const o=s.getExpiryTimeout();o&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},o))}_removeTile(t){const s=this._tiles[t];s&&(s.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),s.uses>0||(s.hasData()&&s.state!=="reloading"?this._cache.add(s.tileID,s,s.getExpiryTimeout()):(s.aborted=!0,this._abortTile(s),this._unloadTile(s))))}_dataHandler(t){const s=t.sourceDataType;t.dataType==="source"&&s==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&t.dataType==="source"&&s==="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,s,o){const a=[],h=this.transform;if(!h)return a;const g=o?h.getCameraQueryGeometry(t):t,y=t.map($=>h.pointCoordinate($,this.terrain)),v=g.map($=>h.pointCoordinate($,this.terrain)),w=this.getIds();let A=1/0,I=1/0,L=-1/0,F=-1/0;for(const $ of v)A=Math.min(A,$.x),I=Math.min(I,$.y),L=Math.max(L,$.x),F=Math.max(F,$.y);for(let $=0;$<w.length;$++){const Z=this._tiles[w[$]];if(Z.holdingForFade())continue;const j=Z.tileID,H=Math.pow(2,h.zoom-Z.tileID.overscaledZ),K=s*Z.queryPadding*c.X/Z.tileSize/H,N=[j.getTilePoint(new c.Z(A,I)),j.getTilePoint(new c.Z(L,F))];if(N[0].x-K<c.X&&N[0].y-K<c.X&&N[1].x+K>=0&&N[1].y+K>=0){const ee=y.map(le=>j.getTilePoint(le)),se=v.map(le=>j.getTilePoint(le));a.push({tile:Z,tileID:j,queryGeometry:ee,cameraQueryGeometry:se,scale:H})}}return a}getVisibleCoordinates(t){const s=this.getRenderableIds(t).map(o=>this._tiles[o].tileID);for(const o of s)o.posMatrix=this.transform.calculatePosMatrix(o.toUnwrapped());return s}hasTransition(){if(this._source.hasTransition())return!0;if(Wi(this._source.type)){const t=ae.now();for(const s in this._tiles)if(this._tiles[s].fadeEndTime>=t)return!0}return!1}setFeatureState(t,s,o){this._state.updateState(t=t||"_geojsonTileLayer",s,o)}removeFeatureState(t,s,o){this._state.removeFeatureState(t=t||"_geojsonTileLayer",s,o)}getFeatureState(t,s){return this._state.getState(t=t||"_geojsonTileLayer",s)}setDependencies(t,s,o){const a=this._tiles[t];a&&a.setDependencies(s,o)}reloadTilesForDependencies(t,s){for(const o in this._tiles)this._tiles[o].hasDependency(t,s)&&this._reloadTile(o,"reloading");this._cache.filter(o=>!o.hasDependency(t,s))}}function Ei(u,t){const s=Math.abs(2*u.wrap)-+(u.wrap<0),o=Math.abs(2*t.wrap)-+(t.wrap<0);return u.overscaledZ-t.overscaledZ||o-s||t.canonical.y-u.canonical.y||t.canonical.x-u.canonical.x}function Wi(u){return u==="raster"||u==="image"||u==="video"}Je.maxOverzooming=10,Je.maxUnderzooming=3;class tt{constructor(t,s){this.reset(t,s)}reset(t,s){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(s||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 s=1,o=this._distances[s];const a=t*this.paddedLength+this.padding;for(;o<a&&s<this._distances.length;)o=this._distances[++s];const h=s-1,g=this._distances[h],y=o-g,v=y>0?(a-g)/y:0;return this.points[h].mult(1-v).add(this.points[s].mult(v))}}function hr(u,t){let s=!0;return u==="always"||u!=="never"&&t!=="never"||(s=!1),s}class wr{constructor(t,s,o){const a=this.boxCells=[],h=this.circleCells=[];this.xCellCount=Math.ceil(t/o),this.yCellCount=Math.ceil(s/o);for(let g=0;g<this.xCellCount*this.yCellCount;g++)a.push([]),h.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=s,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/s,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,s,o,a,h){this._forEachCell(s,o,a,h,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(s),this.bboxes.push(o),this.bboxes.push(a),this.bboxes.push(h)}insertCircle(t,s,o,a){this._forEachCell(s-a,o-a,s+a,o+a,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(s),this.circles.push(o),this.circles.push(a)}_insertBoxCell(t,s,o,a,h,g){this.boxCells[h].push(g)}_insertCircleCell(t,s,o,a,h,g){this.circleCells[h].push(g)}_query(t,s,o,a,h,g,y){if(o<0||t>this.width||a<0||s>this.height)return[];const v=[];if(t<=0&&s<=0&&this.width<=o&&this.height<=a){if(h)return[{key:null,x1:t,y1:s,x2:o,y2:a}];for(let w=0;w<this.boxKeys.length;w++)v.push({key:this.boxKeys[w],x1:this.bboxes[4*w],y1:this.bboxes[4*w+1],x2:this.bboxes[4*w+2],y2:this.bboxes[4*w+3]});for(let w=0;w<this.circleKeys.length;w++){const A=this.circles[3*w],I=this.circles[3*w+1],L=this.circles[3*w+2];v.push({key:this.circleKeys[w],x1:A-L,y1:I-L,x2:A+L,y2:I+L})}}else this._forEachCell(t,s,o,a,this._queryCell,v,{hitTest:h,overlapMode:g,seenUids:{box:{},circle:{}}},y);return v}query(t,s,o,a){return this._query(t,s,o,a,!1,null)}hitTest(t,s,o,a,h,g){return this._query(t,s,o,a,!0,h,g).length>0}hitTestCircle(t,s,o,a,h){const g=t-o,y=t+o,v=s-o,w=s+o;if(y<0||g>this.width||w<0||v>this.height)return!1;const A=[];return this._forEachCell(g,v,y,w,this._queryCellCircle,A,{hitTest:!0,overlapMode:a,circle:{x:t,y:s,radius:o},seenUids:{box:{},circle:{}}},h),A.length>0}_queryCell(t,s,o,a,h,g,y,v){const{seenUids:w,hitTest:A,overlapMode:I}=y,L=this.boxCells[h];if(L!==null){const $=this.bboxes;for(const Z of L)if(!w.box[Z]){w.box[Z]=!0;const j=4*Z,H=this.boxKeys[Z];if(t<=$[j+2]&&s<=$[j+3]&&o>=$[j+0]&&a>=$[j+1]&&(!v||v(H))&&(!A||!hr(I,H.overlapMode))&&(g.push({key:H,x1:$[j],y1:$[j+1],x2:$[j+2],y2:$[j+3]}),A))return!0}}const F=this.circleCells[h];if(F!==null){const $=this.circles;for(const Z of F)if(!w.circle[Z]){w.circle[Z]=!0;const j=3*Z,H=this.circleKeys[Z];if(this._circleAndRectCollide($[j],$[j+1],$[j+2],t,s,o,a)&&(!v||v(H))&&(!A||!hr(I,H.overlapMode))){const K=$[j],N=$[j+1],ee=$[j+2];if(g.push({key:H,x1:K-ee,y1:N-ee,x2:K+ee,y2:N+ee}),A)return!0}}}return!1}_queryCellCircle(t,s,o,a,h,g,y,v){const{circle:w,seenUids:A,overlapMode:I}=y,L=this.boxCells[h];if(L!==null){const $=this.bboxes;for(const Z of L)if(!A.box[Z]){A.box[Z]=!0;const j=4*Z,H=this.boxKeys[Z];if(this._circleAndRectCollide(w.x,w.y,w.radius,$[j+0],$[j+1],$[j+2],$[j+3])&&(!v||v(H))&&!hr(I,H.overlapMode))return g.push(!0),!0}}const F=this.circleCells[h];if(F!==null){const $=this.circles;for(const Z of F)if(!A.circle[Z]){A.circle[Z]=!0;const j=3*Z,H=this.circleKeys[Z];if(this._circlesCollide($[j],$[j+1],$[j+2],w.x,w.y,w.radius)&&(!v||v(H))&&!hr(I,H.overlapMode))return g.push(!0),!0}}}_forEachCell(t,s,o,a,h,g,y,v){const w=this._convertToXCellCoord(t),A=this._convertToYCellCoord(s),I=this._convertToXCellCoord(o),L=this._convertToYCellCoord(a);for(let F=w;F<=I;F++)for(let $=A;$<=L;$++)if(h.call(this,t,s,o,a,this.xCellCount*$+F,g,y,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,s,o,a,h,g){const y=a-t,v=h-s,w=o+g;return w*w>y*y+v*v}_circleAndRectCollide(t,s,o,a,h,g,y){const v=(g-a)/2,w=Math.abs(t-(a+v));if(w>v+o)return!1;const A=(y-h)/2,I=Math.abs(s-(h+A));if(I>A+o)return!1;if(w<=v||I<=A)return!0;const L=w-v,F=I-A;return L*L+F*F<=o*o}}function Br(u,t,s,o,a){const h=c.H();return t?(c.K(h,h,[1/a,1/a,1]),s||c.ae(h,h,o.angle)):c.L(h,o.labelPlaneMatrix,u),h}function ur(u,t,s,o,a){if(t){const h=c.af(u);return c.K(h,h,[a,a,1]),s||c.ae(h,h,-o.angle),h}return o.glCoordMatrix}function G(u,t,s){let o;s?(o=[u.x,u.y,s(u.x,u.y),1],c.ag(o,o,t)):(o=[u.x,u.y,0,1],function(h,g,y){const v=g[0],w=g[1];h[0]=y[0]*v+y[4]*w+y[12],h[1]=y[1]*v+y[5]*w+y[13],h[3]=y[3]*v+y[7]*w+y[15]}(o,o,t));const a=o[3];return{point:new c.P(o[0]/a,o[1]/a),signedDistanceFromCamera:a,isOccluded:!1}}function z(u,t){return .5+u/t*.5}function M(u,t){return u.x>=-t[0]&&u.x<=t[0]&&u.y>=-t[1]&&u.y<=t[1]}function V(u,t,s,o,a,h,g,y,v,w,A,I,L,F,$){const Z=o?u.textSizeData:u.iconSizeData,j=c.ah(Z,s.transform.zoom),H=[256/s.width*2+1,256/s.height*2+1],K=o?u.text.dynamicLayoutVertexArray:u.icon.dynamicLayoutVertexArray;K.clear();const N=u.lineVertexArray,ee=o?u.text.placedSymbolArray:u.icon.placedSymbolArray,se=s.transform.width/s.transform.height;let le=!1;for(let me=0;me<ee.length;me++){const ve=ee.get(me);if(ve.hidden||ve.writingMode===c.ai.vertical&&!le){Ge(ve.numGlyphs,K);continue}le=!1;const Me=G(new c.P(ve.anchorX,ve.anchorY),t,$);if(!M(Me.point,H)){Ge(ve.numGlyphs,K);continue}const De=z(s.transform.cameraToCenterDistance,Me.signedDistanceFromCamera),be=c.aj(Z,j,ve),we=g?be/De:be*De,Oe={getElevation:$,labelPlaneMatrix:a,lineVertexArray:N,pitchWithMap:g,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:w,tileAnchorPoint:new c.P(ve.anchorX,ve.anchorY),unwrappedTileID:A,width:I,height:L,translation:F},Qe=te(Oe,ve,we,!1,y,t,h,u.glyphOffsetArray,K,se,v);le=Qe.useVertical,(Qe.notEnoughRoom||le||Qe.needsFlipping&&te(Oe,ve,we,!0,y,t,h,u.glyphOffsetArray,K,se,v).notEnoughRoom)&&Ge(ve.numGlyphs,K)}o?u.text.dynamicLayoutVertexBuffer.updateData(K):u.icon.dynamicLayoutVertexBuffer.updateData(K)}function q(u,t,s,o,a,h,g,y){const v=h.glyphStartIndex+h.numGlyphs,w=h.lineStartIndex,A=h.lineStartIndex+h.lineLength,I=t.getoffsetX(h.glyphStartIndex),L=t.getoffsetX(v-1),F=Te(u*I,s,o,a,h.segment,w,A,y,g);if(!F)return null;const $=Te(u*L,s,o,a,h.segment,w,A,y,g);return $?y.projectionCache.anyProjectionOccluded?null:{first:F,last:$}:null}function Q(u,t,s,o){return u===c.ai.horizontal&&Math.abs(s.y-t.y)>Math.abs(s.x-t.x)*o?{useVertical:!0}:(u===c.ai.vertical?t.y<s.y:t.x>s.x)?{needsFlipping:!0}:null}function te(u,t,s,o,a,h,g,y,v,w,A){const I=s/24,L=t.lineOffsetX*I,F=t.lineOffsetY*I;let $;if(t.numGlyphs>1){const Z=t.glyphStartIndex+t.numGlyphs,j=t.lineStartIndex,H=t.lineStartIndex+t.lineLength,K=q(I,y,L,F,o,t,A,u);if(!K)return{notEnoughRoom:!0};const N=G(K.first.point,g,u.getElevation).point,ee=G(K.last.point,g,u.getElevation).point;if(a&&!o){const se=Q(t.writingMode,N,ee,w);if(se)return se}$=[K.first];for(let se=t.glyphStartIndex+1;se<Z-1;se++)$.push(Te(I*y.getoffsetX(se),L,F,o,t.segment,j,H,u,A));$.push(K.last)}else{if(a&&!o){const j=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)),N=G(K,h,u.getElevation),ee=N.signedDistanceFromCamera>0?N.point:function(le,me,ve,Me,De,be){return re(le,me,ve,1,De,be)}(u.tileAnchorPoint,K,j,0,h,u),se=Q(t.writingMode,j,ee,w);if(se)return se}const Z=Te(I*y.getoffsetX(t.glyphStartIndex),L,F,o,t.segment,t.lineStartIndex,t.lineStartIndex+t.lineLength,u,A);if(!Z||u.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};$=[Z]}for(const Z of $)c.ak(v,Z.point,Z.angle);return{}}function re(u,t,s,o,a,h){const g=u.add(u.sub(t)._unit()),y=a!==void 0?G(g,a,h.getElevation).point:de(g.x,g.y,h).point,v=s.sub(y);return s.add(v._mult(o/v.mag()))}function J(u,t,s){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=de(a.x,a.y,t);if(h.signedDistanceFromCamera>0)return o.projections[u]=h.point,o.anyProjectionOccluded=o.anyProjectionOccluded||h.isOccluded,h.point;const g=u-s.direction;return function(y,v,w,A,I){return re(y,v,w,A,void 0,I)}(s.distanceFromAnchor===0?t.tileAnchorPoint:new c.P(t.lineVertexArray.getx(g),t.lineVertexArray.gety(g)),a,s.previousVertex,s.absOffsetX-s.distanceFromAnchor+1,t)}function de(u,t,s){const o=u+s.translation[0],a=t+s.translation[1];let h;return!s.pitchWithMap&&s.projection.useSpecialProjectionForSymbols?(h=s.projection.projectTileCoordinates(o,a,s.unwrappedTileID,s.getElevation),h.point.x=(.5*h.point.x+.5)*s.width,h.point.y=(.5*-h.point.y+.5)*s.height):(h=G(new c.P(o,a),s.labelPlaneMatrix,s.getElevation),h.isOccluded=!1),h}function ge(u,t,s){return u._unit()._perp()._mult(t*s)}function ce(u,t,s,o,a,h,g,y,v){if(y.projectionCache.offsets[u])return y.projectionCache.offsets[u];const w=s.add(t);if(u+v.direction<o||u+v.direction>=a)return y.projectionCache.offsets[u]=w,w;const A=J(u+v.direction,y,v),I=ge(A.sub(s),g,v.direction),L=s.add(I),F=A.add(I);return y.projectionCache.offsets[u]=c.al(h,w,L,F)||w,y.projectionCache.offsets[u]}function Te(u,t,s,o,a,h,g,y,v){const w=o?u-t:u+t;let A=w>0?1:-1,I=0;o&&(A*=-1,I=Math.PI),A<0&&(I+=Math.PI);let L,F=A>0?h+a:h+a+1;y.projectionCache.cachedAnchorPoint?L=y.projectionCache.cachedAnchorPoint:(L=de(y.tileAnchorPoint.x,y.tileAnchorPoint.y,y).point,y.projectionCache.cachedAnchorPoint=L);let $,Z,j=L,H=L,K=0,N=0;const ee=Math.abs(w),se=[];let le;for(;K+N<=ee;){if(F+=A,F<h||F>=g)return null;K+=N,H=j,Z=$;const Me={absOffsetX:ee,direction:A,distanceFromAnchor:K,previousVertex:H};if(j=J(F,y,Me),s===0)se.push(H),le=j.sub(H);else{let De;const be=j.sub(H);De=be.mag()===0?ge(J(F+A,y,Me).sub(j),s,A):ge(be,s,A),Z||(Z=H.add(De)),$=ce(F,De,j,h,g,Z,s,y,Me),se.push(Z),le=$.sub(Z)}N=le.mag()}const me=le._mult((ee-K)/N)._add(Z||H),ve=I+Math.atan2(j.y-H.y,j.x-H.x);return se.push(me),{point:me,angle:v?ve:0,path:se}}const qe=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ge(u,t){for(let s=0;s<u;s++){const o=t.length;t.resize(o+4),t.float32.set(qe,3*o)}}const rt=100;class dt{constructor(t,s,o=new wr(t.width+200,t.height+200,25),a=new wr(t.width+200,t.height+200,25)){this.transform=t,this.mapProjection=s,this.grid=o,this.ignoredGrid=a,this.pitchFactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+rt,this.screenBottomBoundary=t.height+rt,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,s,o,a,h,g,y,v,w,A,I){const L=t.anchorPointX+v[0],F=t.anchorPointY+v[1],$=this.projectAndGetPerspectiveRatio(a,L,F,h,A),Z=this._projectCollisionBox(t,o,a,h,g,y,v,$,A,I),[j,H,K,N]=Z.box;return this.mapProjection.useSpecialProjectionForSymbols&&(g?Z.allPointsOccluded:this.mapProjection.isOccluded(L,F,h))||$.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid(j,H,K,N)||s!=="always"&&this.grid.hitTest(j,H,K,N,s,w)?{box:[j,H,K,N],placeable:!1,offscreen:!1}:{box:[j,H,K,N],placeable:!0,offscreen:this.isOffscreen(j,H,K,N)}}placeCollisionCircles(t,s,o,a,h,g,y,v,w,A,I,L,F,$,Z,j){const H=[],K=new c.P(s.anchorX,s.anchorY),N=this.getPerspectiveRatio(g,K.x,K.y,y,j),ee=(I?h/N:h*N)/c.aq,se={getElevation:j,labelPlaneMatrix:v,lineVertexArray:o,pitchWithMap:I,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:K,unwrappedTileID:y,width:this.transform.width,height:this.transform.height,translation:Z},le=q(ee,a,s.lineOffsetX*ee,s.lineOffsetY*ee,!1,s,!1,se);let me=!1,ve=!1,Me=!0;if(le){const De=.5*F*N+$,be=new c.P(-100,-100),we=new c.P(this.screenRightBoundary,this.screenBottomBoundary),Oe=new tt,Qe=le.first,Ee=le.last;let Pe=[];for(let st=Qe.path.length-1;st>=1;st--)Pe.push(Qe.path[st]);for(let st=1;st<Ee.path.length;st++)Pe.push(Ee.path[st]);const Ke=2.5*De;if(w){const st=this.projectPathToScreenSpace(Pe,se,w);Pe=st.some(ct=>ct.signedDistanceFromCamera<=0)?[]:st.map(ct=>ct.point)}let Dt=[];if(Pe.length>0){const st=Pe[0].clone(),ct=Pe[0].clone();for(let Lt=1;Lt<Pe.length;Lt++)st.x=Math.min(st.x,Pe[Lt].x),st.y=Math.min(st.y,Pe[Lt].y),ct.x=Math.max(ct.x,Pe[Lt].x),ct.y=Math.max(ct.y,Pe[Lt].y);Dt=st.x>=be.x&&ct.x<=we.x&&st.y>=be.y&&ct.y<=we.y?[Pe]:ct.x<be.x||st.x>we.x||ct.y<be.y||st.y>we.y?[]:c.am([Pe],be.x,be.y,we.x,we.y)}for(const st of Dt){Oe.reset(st,.25*De);let ct=0;ct=Oe.length<=.5*De?1:Math.ceil(Oe.paddedLength/Ke)+1;for(let Lt=0;Lt<ct;Lt++){const ci=Lt/Math.max(ct-1,1),Ki=Oe.lerp(ci),Rt=Ki.x+rt,Ii=Ki.y+rt;H.push(Rt,Ii,De,0);const bi=Rt-De,hi=Ii-De,ui=Rt+De,Yi=Ii+De;if(Me=Me&&this.isOffscreen(bi,hi,ui,Yi),ve=ve||this.isInsideGrid(bi,hi,ui,Yi),t!=="always"&&this.grid.hitTestCircle(Rt,Ii,De,t,L)&&(me=!0,!A))return{circles:[],offscreen:!1,collisionDetected:me}}}}return{circles:!A&&me||!ve||N<this.perspectiveRatioCutoff?[]:H,offscreen:Me,collisionDetected:me}}projectPathToScreenSpace(t,s,o){return t.map(a=>G(a,o,s.getElevation))}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const s=[];let o=1/0,a=1/0,h=-1/0,g=-1/0;for(const A of t){const I=new c.P(A.x+rt,A.y+rt);o=Math.min(o,I.x),a=Math.min(a,I.y),h=Math.max(h,I.x),g=Math.max(g,I.y),s.push(I)}const y=this.grid.query(o,a,h,g).concat(this.ignoredGrid.query(o,a,h,g)),v={},w={};for(const A of y){const I=A.key;if(v[I.bucketInstanceId]===void 0&&(v[I.bucketInstanceId]={}),v[I.bucketInstanceId][I.featureIndex])continue;const L=[new c.P(A.x1,A.y1),new c.P(A.x2,A.y1),new c.P(A.x2,A.y2),new c.P(A.x1,A.y2)];c.an(s,L)&&(v[I.bucketInstanceId][I.featureIndex]=!0,w[I.bucketInstanceId]===void 0&&(w[I.bucketInstanceId]=[]),w[I.bucketInstanceId].push(I.featureIndex))}return w}insertCollisionBox(t,s,o,a,h,g){(o?this.ignoredGrid:this.grid).insert({bucketInstanceId:a,featureIndex:h,collisionGroupID:g,overlapMode:s},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,s,o,a,h,g){const y=o?this.ignoredGrid:this.grid,v={bucketInstanceId:a,featureIndex:h,collisionGroupID:g,overlapMode:s};for(let w=0;w<t.length;w+=4)y.insertCircle(v,t[w],t[w+1],t[w+2])}projectAndGetPerspectiveRatio(t,s,o,a,h){const g=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(s,o,a,h):G(new c.P(s,o),t,h);return{point:new c.P((g.point.x+1)/2*this.transform.width+rt,(1-g.point.y)/2*this.transform.height+rt),perspectiveRatio:.5+this.transform.cameraToCenterDistance/g.signedDistanceFromCamera*.5,isOccluded:g.isOccluded,signedDistanceFromCamera:g.signedDistanceFromCamera}}getPerspectiveRatio(t,s,o,a,h){const g=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(s,o,a,h):G(new c.P(s,o),t,h);return .5+this.transform.cameraToCenterDistance/g.signedDistanceFromCamera*.5}isOffscreen(t,s,o,a){return o<rt||t>=this.screenRightBoundary||a<rt||s>this.screenBottomBoundary}isInsideGrid(t,s,o,a){return o>=0&&t<this.gridRightBoundary&&a>=0&&s<this.gridBottomBoundary}getViewportMatrix(){const t=c.ao([]);return c.J(t,t,[-100,-100,0]),t}_projectCollisionBox(t,s,o,a,h,g,y,v,w,A){const I=s*v.perspectiveRatio;let L=new c.P(1,0),F=new c.P(0,1);const $=new c.P(t.anchorPointX+y[0],t.anchorPointY+y[1]);if(g&&!h){const De=this.projectAndGetPerspectiveRatio(o,$.x+1,$.y,a,w).point.sub(v.point).unit(),be=Math.atan(De.y/De.x)+(De.x<0?Math.PI:0),we=Math.sin(be),Oe=Math.cos(be);L=new c.P(Oe,we),F=new c.P(-we,Oe)}else if(!g&&h){const De=-this.transform.angle,be=Math.sin(De),we=Math.cos(De);L=new c.P(we,be),F=new c.P(-be,we)}let Z=v.point,j=I;if(h){Z=$;const De=this.transform.zoom-Math.floor(this.transform.zoom);j=Math.pow(2,-De),j*=this.mapProjection.getPitchedTextCorrection(this.transform,$,a),A||(j*=c.ad(.5+v.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))}A&&(Z=Z.add(L.mult(A.x*j)).add(F.mult(A.y*j)));const H=t.x1*j,K=t.x2*j,N=(H+K)/2,ee=t.y1*j,se=t.y2*j,le=(ee+se)/2,me=[{offsetX:H,offsetY:ee},{offsetX:N,offsetY:ee},{offsetX:K,offsetY:ee},{offsetX:K,offsetY:le},{offsetX:K,offsetY:se},{offsetX:N,offsetY:se},{offsetX:H,offsetY:se},{offsetX:H,offsetY:le}];let ve=[];for(const{offsetX:De,offsetY:be}of me)ve.push(new c.P(Z.x+L.x*De+F.x*be,Z.y+L.y*De+F.y*be));let Me=!1;if(h){const De=ve.map(be=>this.projectAndGetPerspectiveRatio(o,be.x,be.y,a,w));Me=De.some(be=>!be.isOccluded),ve=De.map(be=>be.point)}else Me=!0;return{box:c.ap(ve),allPointsOccluded:!Me}}}function it(u,t,s){return t*(c.X/(u.tileSize*Math.pow(2,s-u.tileID.overscaledZ)))}class Et{constructor(t,s,o,a){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?s:-s))):a&&o?1:0,this.placed=o}isHidden(){return this.opacity===0&&!this.placed}}class Nt{constructor(t,s,o,a,h){this.text=new Et(t?t.text:null,s,o,h),this.icon=new Et(t?t.icon:null,s,a,h)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Ht{constructor(t,s,o){this.text=t,this.icon=s,this.skipFade=o}}class ot{constructor(){this.invProjMatrix=c.H(),this.viewportMatrix=c.H(),this.circles=[]}}class _t{constructor(t,s,o,a,h){this.bucketInstanceId=t,this.featureIndex=s,this.sourceLayerIndex=o,this.bucketIndex=a,this.tileID=h}}class Ft{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 s=++this.maxGroupID;this.collisionGroups[t]={ID:s,predicate:o=>o.collisionGroupID===s}}return this.collisionGroups[t]}}function Jt(u,t,s,o,a){const{horizontalAlign:h,verticalAlign:g}=c.av(u);return new c.P(-(h-.5)*t+o[0]*a,-(g-.5)*s+o[1]*a)}class oi{constructor(t,s,o,a,h,g){this.transform=t.clone(),this.terrain=o,this.collisionIndex=new dt(this.transform,s),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new Ft(h),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=g,g&&(g.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){const s=this.terrain;return s?(o,a)=>s.getElevation(t,o,a):null}getBucketParts(t,s,o,a){const h=o.getBucket(s),g=o.latestFeatureIndex;if(!h||!g||s.id!==h.layerIds[0])return;const y=o.collisionBoxArray,v=h.layers[0].layout,w=h.layers[0].paint,A=Math.pow(2,this.transform.zoom-o.tileID.overscaledZ),I=o.tileSize/c.X,L=o.tileID.toUnwrapped(),F=this.transform.calculatePosMatrix(L),$=v.get("text-pitch-alignment")==="map",Z=v.get("text-rotation-alignment")==="map",j=it(o,1,this.transform.zoom),H=this.collisionIndex.mapProjection.translatePosition(this.transform,o,w.get("text-translate"),w.get("text-translate-anchor")),K=this.collisionIndex.mapProjection.translatePosition(this.transform,o,w.get("icon-translate"),w.get("icon-translate-anchor")),N=Br(F,$,Z,this.transform,j);let ee=null;if($){const le=ur(F,$,Z,this.transform,j);ee=c.L([],this.transform.labelPlaneMatrix,le)}this.retainedQueryData[h.bucketInstanceId]=new _t(h.bucketInstanceId,g,h.sourceLayerIndex,h.index,o.tileID);const se={bucket:h,layout:v,translationText:H,translationIcon:K,posMatrix:F,unwrappedTileID:L,textLabelPlaneMatrix:N,labelToScreenMatrix:ee,scale:A,textPixelRatio:I,holdingForFade:o.holdingForFade(),collisionBoxArray:y,partiallyEvaluatedTextSize:c.ah(h.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(h.sourceID)};if(a)for(const le of h.sortKeyRanges){const{sortKey:me,symbolInstanceStart:ve,symbolInstanceEnd:Me}=le;t.push({sortKey:me,symbolInstanceStart:ve,symbolInstanceEnd:Me,parameters:se})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:h.symbolInstances.length,parameters:se})}attemptAnchorPlacement(t,s,o,a,h,g,y,v,w,A,I,L,F,$,Z,j,H,K,N){const ee=c.ar[t.textAnchor],se=[t.textOffset0,t.textOffset1],le=Jt(ee,o,a,se,h),me=this.collisionIndex.placeCollisionBox(s,L,v,w,A,y,g,j,I.predicate,N,le);if((!K||this.collisionIndex.placeCollisionBox(K,L,v,w,A,y,g,H,I.predicate,N,le).placeable)&&me.placeable){let ve;if(this.prevPlacement&&this.prevPlacement.variableOffsets[F.crossTileID]&&this.prevPlacement.placements[F.crossTileID]&&this.prevPlacement.placements[F.crossTileID].text&&(ve=this.prevPlacement.variableOffsets[F.crossTileID].anchor),F.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[F.crossTileID]={textOffset:se,width:o,height:a,anchor:ee,textBoxScale:h,prevAnchor:ve},this.markUsedJustification($,ee,F,Z),$.allowVerticalPlacement&&(this.markUsedOrientation($,Z,F),this.placedOrientations[F.crossTileID]=Z),{shift:le,placedGlyphBoxes:me}}}placeLayerBucketPart(t,s,o){const{bucket:a,layout:h,translationText:g,translationIcon:y,posMatrix:v,unwrappedTileID:w,textLabelPlaneMatrix:A,labelToScreenMatrix:I,textPixelRatio:L,holdingForFade:F,collisionBoxArray:$,partiallyEvaluatedTextSize:Z,collisionGroup:j}=t.parameters,H=h.get("text-optional"),K=h.get("icon-optional"),N=c.as(h,"text-overlap","text-allow-overlap"),ee=N==="always",se=c.as(h,"icon-overlap","icon-allow-overlap"),le=se==="always",me=h.get("text-rotation-alignment")==="map",ve=h.get("text-pitch-alignment")==="map",Me=h.get("icon-text-fit")!=="none",De=h.get("symbol-z-order")==="viewport-y",be=ee&&(le||!a.hasIconData()||K),we=le&&(ee||!a.hasTextData()||H);!a.collisionArrays&&$&&a.deserializeCollisionBoxes($);const Oe=this._getTerrainElevationFunc(this.retainedQueryData[a.bucketInstanceId].tileID),Qe=(Ee,Pe,Ke)=>{var Dt,st;if(s[Ee.crossTileID])return;if(F)return void(this.placements[Ee.crossTileID]=new Ht(!1,!1,!1));let ct=!1,Lt=!1,ci=!0,Ki=null,Rt={box:null,placeable:!1,offscreen:null},Ii={box:null,placeable:!1,offscreen:null},bi=null,hi=null,ui=null,Yi=0,cs=0,io=0;Pe.textFeatureIndex?Yi=Pe.textFeatureIndex:Ee.useRuntimeCollisionCircles&&(Yi=Ee.featureIndex),Pe.verticalTextFeatureIndex&&(cs=Pe.verticalTextFeatureIndex);const Ms=Pe.textBox;if(Ms){const ii=di=>{let pi=c.ai.horizontal;if(a.allowVerticalPlacement&&!di&&this.prevPlacement){const Qt=this.prevPlacement.placedOrientations[Ee.crossTileID];Qt&&(this.placedOrientations[Ee.crossTileID]=Qt,pi=Qt,this.markUsedOrientation(a,pi,Ee))}return pi},Qi=(di,pi)=>{if(a.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&Pe.verticalTextBox){for(const Qt of a.writingModes)if(Qt===c.ai.vertical?(Rt=pi(),Ii=Rt):Rt=di(),Rt&&Rt.placeable)break}else Rt=di()},Ur=Ee.textAnchorOffsetStartIndex,zs=Ee.textAnchorOffsetEndIndex;if(zs===Ur){const di=(pi,Qt)=>{const Vt=this.collisionIndex.placeCollisionBox(pi,N,L,v,w,ve,me,g,j.predicate,Oe);return Vt&&Vt.placeable&&(this.markUsedOrientation(a,Qt,Ee),this.placedOrientations[Ee.crossTileID]=Qt),Vt};Qi(()=>di(Ms,c.ai.horizontal),()=>{const pi=Pe.verticalTextBox;return a.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&pi?di(pi,c.ai.vertical):{box:null,offscreen:null}}),ii(Rt&&Rt.placeable)}else{let di=c.ar[(st=(Dt=this.prevPlacement)===null||Dt===void 0?void 0:Dt.variableOffsets[Ee.crossTileID])===null||st===void 0?void 0:st.anchor];const pi=(Vt,Ds,fa)=>{const Kt=Vt.x2-Vt.x1,gl=Vt.y2-Vt.y1,so=Ee.textBoxScale,no=Me&&se==="never"?Ds:null;let qr=null,_l=N==="never"?1:2,ma="never";di&&_l++;for(let ga=0;ga<_l;ga++){for(let _a=Ur;_a<zs;_a++){const oo=a.textAnchorOffsets.get(_a);if(di&&oo.textAnchor!==di)continue;const Ls=this.attemptAnchorPlacement(oo,Vt,Kt,gl,so,me,ve,L,v,w,j,ma,Ee,a,fa,g,y,no,Oe);if(Ls&&(qr=Ls.placedGlyphBoxes,qr&&qr.placeable))return ct=!0,Ki=Ls.shift,qr}di?di=null:ma=N}return o&&!qr&&(qr={box:this.collisionIndex.placeCollisionBox(Ms,"always",L,v,w,ve,me,g,j.predicate,Oe,new c.P(0,0)).box,offscreen:!1,placeable:!1}),qr};Qi(()=>pi(Ms,Pe.iconBox,c.ai.horizontal),()=>{const Vt=Pe.verticalTextBox;return a.allowVerticalPlacement&&(!Rt||!Rt.placeable)&&Ee.numVerticalGlyphVertices>0&&Vt?pi(Vt,Pe.verticalIconBox,c.ai.vertical):{box:null,occluded:!0,offscreen:null}}),Rt&&(ct=Rt.placeable,ci=Rt.offscreen);const Qt=ii(Rt&&Rt.placeable);if(!ct&&this.prevPlacement){const Vt=this.prevPlacement.variableOffsets[Ee.crossTileID];Vt&&(this.variableOffsets[Ee.crossTileID]=Vt,this.markUsedJustification(a,Vt.anchor,Ee,Qt))}}}if(bi=Rt,ct=bi&&bi.placeable,ci=bi&&bi.offscreen,Ee.useRuntimeCollisionCircles){const ii=a.text.placedSymbolArray.get(Ee.centerJustifiedTextSymbolIndex),Qi=c.aj(a.textSizeData,Z,ii),Ur=h.get("text-padding");hi=this.collisionIndex.placeCollisionCircles(N,ii,a.lineVertexArray,a.glyphOffsetArray,Qi,v,w,A,I,o,ve,j.predicate,Ee.collisionCircleDiameter,Ur,g,Oe),hi.circles.length&&hi.collisionDetected&&!o&&c.w("Collisions detected, but collision boxes are not shown"),ct=ee||hi.circles.length>0&&!hi.collisionDetected,ci=ci&&hi.offscreen}if(Pe.iconFeatureIndex&&(io=Pe.iconFeatureIndex),Pe.iconBox){const ii=Qi=>this.collisionIndex.placeCollisionBox(Qi,se,L,v,w,ve,me,y,j.predicate,Oe,Me&&Ki?Ki:void 0);Ii&&Ii.placeable&&Pe.verticalIconBox?(ui=ii(Pe.verticalIconBox),Lt=ui.placeable):(ui=ii(Pe.iconBox),Lt=ui.placeable),ci=ci&&ui.offscreen}const hs=H||Ee.numHorizontalGlyphVertices===0&&Ee.numVerticalGlyphVertices===0,ro=K||Ee.numIconVertices===0;hs||ro?ro?hs||(Lt=Lt&&ct):ct=Lt&&ct:Lt=ct=Lt&&ct;const pa=Lt&&ui.placeable;if(ct&&bi.placeable&&this.collisionIndex.insertCollisionBox(bi.box,N,h.get("text-ignore-placement"),a.bucketInstanceId,Ii&&Ii.placeable&&cs?cs:Yi,j.ID),pa&&this.collisionIndex.insertCollisionBox(ui.box,se,h.get("icon-ignore-placement"),a.bucketInstanceId,io,j.ID),hi&&ct&&this.collisionIndex.insertCollisionCircles(hi.circles,N,h.get("text-ignore-placement"),a.bucketInstanceId,Yi,j.ID),o&&this.storeCollisionData(a.bucketInstanceId,Ke,Pe,bi,ui,hi),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 Ht(ct||be,Lt||we,ci||a.justReloaded),s[Ee.crossTileID]=!0};if(De){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ee=a.getSortedSymbolIndexes(this.transform.angle);for(let Pe=Ee.length-1;Pe>=0;--Pe){const Ke=Ee[Pe];Qe(a.symbolInstances.get(Ke),a.collisionArrays[Ke],Ke)}}else for(let Ee=t.symbolInstanceStart;Ee<t.symbolInstanceEnd;Ee++)Qe(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,s,o,a,h,g){if(o.textBox||o.iconBox){let y,v;this.collisionBoxArrays.has(t)?y=this.collisionBoxArrays.get(t):(y=new Map,this.collisionBoxArrays.set(t,y)),y.has(s)?v=y.get(s):(v={text:null,icon:null},y.set(s,v)),o.textBox&&(v.text=a.box),o.iconBox&&(v.icon=h.box)}if(g){let y=this.collisionCircleArrays[t];y===void 0&&(y=this.collisionCircleArrays[t]=new ot);for(let v=0;v<g.circles.length;v+=4)y.circles.push(g.circles[v+0]),y.circles.push(g.circles[v+1]),y.circles.push(g.circles[v+2]),y.circles.push(g.collisionDetected?1:0)}}markUsedJustification(t,s,o,a){let h;h=a===c.ai.vertical?o.verticalPlacedTextSymbolIndex:{left:o.leftJustifiedTextSymbolIndex,center:o.centerJustifiedTextSymbolIndex,right:o.rightJustifiedTextSymbolIndex}[c.au(s)];const g=[o.leftJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.rightJustifiedTextSymbolIndex,o.verticalPlacedTextSymbolIndex];for(const y of g)y>=0&&(t.text.placedSymbolArray.get(y).crossTileID=h>=0&&y!==h?0:o.crossTileID)}markUsedOrientation(t,s,o){const a=s===c.ai.horizontal||s===c.ai.horizontalOnly?s:0,h=s===c.ai.vertical?s:0,g=[o.leftJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.rightJustifiedTextSymbolIndex];for(const y of g)t.text.placedSymbolArray.get(y).placedOrientation=a;o.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(o.verticalPlacedTextSymbolIndex).placedOrientation=h)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const s=this.prevPlacement;let o=!1;this.prevZoomAdjustment=s?s.zoomAdjustment(this.transform.zoom):0;const a=s?s.symbolFadeChange(t):1,h=s?s.opacities:{},g=s?s.variableOffsets:{},y=s?s.placedOrientations:{};for(const v in this.placements){const w=this.placements[v],A=h[v];A?(this.opacities[v]=new Nt(A,a,w.text,w.icon),o=o||w.text!==A.text.placed||w.icon!==A.icon.placed):(this.opacities[v]=new Nt(null,a,w.text,w.icon,w.skipFade),o=o||w.text||w.icon)}for(const v in h){const w=h[v];if(!this.opacities[v]){const A=new Nt(w,a,!1,!1);A.isHidden()||(this.opacities[v]=A,o=o||w.text.placed||w.icon.placed)}}for(const v in g)this.variableOffsets[v]||!this.opacities[v]||this.opacities[v].isHidden()||(this.variableOffsets[v]=g[v]);for(const v in y)this.placedOrientations[v]||!this.opacities[v]||this.opacities[v].isHidden()||(this.placedOrientations[v]=y[v]);if(s&&s.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=s?s.lastPlacementChangeTime:t)}updateLayerOpacities(t,s){const o={};for(const a of s){const h=a.getBucket(t);h&&a.latestFeatureIndex&&t.id===h.layerIds[0]&&this.updateBucketOpacities(h,a.tileID,o,a.collisionBoxArray)}}updateBucketOpacities(t,s,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],g=h.layout,y=new Nt(null,0,!1,!1,!0),v=g.get("text-allow-overlap"),w=g.get("icon-allow-overlap"),A=h._unevaluatedLayout.hasValue("text-variable-anchor")||h._unevaluatedLayout.hasValue("text-variable-anchor-offset"),I=g.get("text-rotation-alignment")==="map",L=g.get("text-pitch-alignment")==="map",F=g.get("icon-text-fit")!=="none",$=new Nt(null,0,v&&(w||!t.hasIconData()||g.get("icon-optional")),w&&(v||!t.hasTextData()||g.get("text-optional")),!0);!t.collisionArrays&&a&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(a);const Z=(H,K,N)=>{for(let ee=0;ee<K/4;ee++)H.opacityVertexArray.emplaceBack(N);H.hasVisibleVertices=H.hasVisibleVertices||N!==li},j=this.collisionBoxArrays.get(t.bucketInstanceId);for(let H=0;H<t.symbolInstances.length;H++){const K=t.symbolInstances.get(H),{numHorizontalGlyphVertices:N,numVerticalGlyphVertices:ee,crossTileID:se}=K;let le=this.opacities[se];o[se]?le=y:le||(le=$,this.opacities[se]=le),o[se]=!0;const me=K.numIconVertices>0,ve=this.placedOrientations[K.crossTileID],Me=ve===c.ai.vertical,De=ve===c.ai.horizontal||ve===c.ai.horizontalOnly;if(N>0||ee>0){const we=Bi(le.text);Z(t.text,N,Me?li:we),Z(t.text,ee,De?li:we);const Oe=le.text.isHidden();[K.rightJustifiedTextSymbolIndex,K.centerJustifiedTextSymbolIndex,K.leftJustifiedTextSymbolIndex].forEach(Pe=>{Pe>=0&&(t.text.placedSymbolArray.get(Pe).hidden=Oe||Me?1:0)}),K.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(K.verticalPlacedTextSymbolIndex).hidden=Oe||De?1:0);const Qe=this.variableOffsets[K.crossTileID];Qe&&this.markUsedJustification(t,Qe.anchor,K,ve);const Ee=this.placedOrientations[K.crossTileID];Ee&&(this.markUsedJustification(t,"left",K,Ee),this.markUsedOrientation(t,Ee,K))}if(me){const we=Bi(le.icon),Oe=!(F&&K.verticalPlacedIconSymbolIndex&&Me);K.placedIconSymbolIndex>=0&&(Z(t.icon,K.numIconVertices,Oe?we:li),t.icon.placedSymbolArray.get(K.placedIconSymbolIndex).hidden=le.icon.isHidden()),K.verticalPlacedIconSymbolIndex>=0&&(Z(t.icon,K.numVerticalIconVertices,Oe?li:we),t.icon.placedSymbolArray.get(K.verticalPlacedIconSymbolIndex).hidden=le.icon.isHidden())}const be=j&&j.has(H)?j.get(H):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const we=t.collisionArrays[H];if(we){let Oe=new c.P(0,0);if(we.textBox||we.verticalTextBox){let Qe=!0;if(A){const Ee=this.variableOffsets[se];Ee?(Oe=Jt(Ee.anchor,Ee.width,Ee.height,Ee.textOffset,Ee.textBoxScale),I&&Oe._rotate(L?this.transform.angle:-this.transform.angle)):Qe=!1}if(we.textBox||we.verticalTextBox){let Ee;we.textBox&&(Ee=Me),we.verticalTextBox&&(Ee=De),ai(t.textCollisionBox.collisionVertexArray,le.text.placed,!Qe||Ee,be.text,Oe.x,Oe.y)}}if(we.iconBox||we.verticalIconBox){const Qe=!!(!De&&we.verticalIconBox);let Ee;we.iconBox&&(Ee=Qe),we.verticalIconBox&&(Ee=!Qe),ai(t.iconCollisionBox.collisionVertexArray,le.icon.placed,Ee,be.icon,F?Oe.x:0,F?Oe.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,s){const o=this.zoomAtLastRecencyCheck===s?1-this.zoomAdjustment(s):1;return this.zoomAtLastRecencyCheck=s,this.commitTime+this.fadeDuration*o>t}setStale(){this.stale=!0}}function ai(u,t,s,o,a,h){o&&o.length!==0||(o=[0,0,0,0]);const g=o[0]-rt,y=o[1]-rt,v=o[2]-rt,w=o[3]-rt;u.emplaceBack(t?1:0,s?1:0,a||0,h||0,g,y),u.emplaceBack(t?1:0,s?1:0,a||0,h||0,v,y),u.emplaceBack(t?1:0,s?1:0,a||0,h||0,v,w),u.emplaceBack(t?1:0,s?1:0,a||0,h||0,g,w)}const Hs=Math.pow(2,25),yt=Math.pow(2,24),vo=Math.pow(2,17),bo=Math.pow(2,16),Li=Math.pow(2,9),Ri=Math.pow(2,8),$l=Math.pow(2,1);function Bi(u){if(u.opacity===0&&!u.placed)return 0;if(u.opacity===1&&u.placed)return 4294967295;const t=u.placed?1:0,s=Math.floor(127*u.opacity);return s*Hs+t*yt+s*vo+t*bo+s*Li+t*Ri+s*$l+t}const li=0;function An(){return{isOccluded:(u,t,s)=>!1,getPitchedTextCorrection:(u,t,s)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(u,t,s,o){throw new Error("Not implemented.")},translatePosition:(u,t,s,o)=>function(a,h,g,y,v=!1){if(!g[0]&&!g[1])return[0,0];const w=v?y==="map"?a.angle:0:y==="viewport"?-a.angle:0;if(w){const A=Math.sin(w),I=Math.cos(w);g=[g[0]*I-g[1]*A,g[0]*A+g[1]*I]}return[v?g[0]:it(h,g[0],a.zoom),v?g[1]:it(h,g[1],a.zoom)]}(u,t,s,o),getCircleRadiusCorrection:u=>1}}class Ws{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,s,o,a,h){const g=this._bucketParts;for(;this._currentTileIndex<t.length;)if(s.getBucketParts(g,a,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,h())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,g.sort((y,v)=>y.sortKey-v.sortKey));this._currentPartIndex<g.length;)if(s.placeLayerBucketPart(g[this._currentPartIndex],this._seenCrossTileIDs,o),this._currentPartIndex++,h())return!0;return!1}}class Wt{constructor(t,s,o,a,h,g,y,v){this.placement=new oi(t,An(),s,g,y,v),this._currentPlacementIndex=o.length-1,this._forceFullPlacement=a,this._showCollisionBoxes=h,this._done=!1}isDone(){return this._done}continuePlacement(t,s,o){const a=ae.now(),h=()=>!this._forceFullPlacement&&ae.now()-a>2;for(;this._currentPlacementIndex>=0;){const g=s[t[this._currentPlacementIndex]],y=this.placement.collisionIndex.transform.zoom;if(g.type==="symbol"&&(!g.minzoom||g.minzoom<=y)&&(!g.maxzoom||g.maxzoom>y)){if(this._inProgressLayer||(this._inProgressLayer=new Ws(g)),this._inProgressLayer.continuePlacement(o[g.source],this.placement,this._showCollisionBoxes,g,h))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Sr=512/c.X/2;class Qr{constructor(t,s,o){this.tileID=t,this.bucketInstanceId=o,this._symbolsByKey={};const a=new Map;for(let h=0;h<s.length;h++){const g=s.get(h),y=g.key,v=a.get(y);v?v.push(g):a.set(y,[g])}for(const[h,g]of a){const y={positions:g.map(v=>({x:Math.floor(v.anchorX*Sr),y:Math.floor(v.anchorY*Sr)})),crossTileIDs:g.map(v=>v.crossTileID)};if(y.positions.length>128){const v=new c.aw(y.positions.length,16,Uint16Array);for(const{x:w,y:A}of y.positions)v.add(w,A);v.finish(),delete y.positions,y.index=v}this._symbolsByKey[h]=y}}getScaledCoordinates(t,s){const{x:o,y:a,z:h}=this.tileID.canonical,{x:g,y,z:v}=s.canonical,w=Sr/Math.pow(2,v-h),A=(y*c.X+t.anchorY)*w,I=a*c.X*Sr;return{x:Math.floor((g*c.X+t.anchorX)*w-o*c.X*Sr),y:Math.floor(A-I)}}findMatches(t,s,o){const a=this.tileID.canonical.z<s.canonical.z?1:Math.pow(2,this.tileID.canonical.z-s.canonical.z);for(let h=0;h<t.length;h++){const g=t.get(h);if(g.crossTileID)continue;const y=this._symbolsByKey[g.key];if(!y)continue;const v=this.getScaledCoordinates(g,s);if(y.index){const w=y.index.range(v.x-a,v.y-a,v.x+a,v.y+a).sort();for(const A of w){const I=y.crossTileIDs[A];if(!o[I]){o[I]=!0,g.crossTileID=I;break}}}else if(y.positions)for(let w=0;w<y.positions.length;w++){const A=y.positions[w],I=y.crossTileIDs[w];if(Math.abs(A.x-v.x)<=a&&Math.abs(A.y-v.y)<=a&&!o[I]){o[I]=!0,g.crossTileID=I;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:t})=>t)}}class Zt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class In{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const s=Math.round((t-this.lng)/360);if(s!==0)for(const o in this.indexes){const a=this.indexes[o],h={};for(const g in a){const y=a[g];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+s),h[y.tileID.key]=y}this.indexes[o]=h}this.lng=t}addBucket(t,s,o){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===s.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let h=0;h<s.symbolInstances.length;h++)s.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 g=this.indexes[h];if(Number(h)>t.overscaledZ)for(const y in g){const v=g[y];v.tileID.isChildOf(t)&&v.findMatches(s.symbolInstances,t,a)}else{const y=g[t.scaledTo(Number(h)).key];y&&y.findMatches(s.symbolInstances,t,a)}}for(let h=0;h<s.symbolInstances.length;h++){const g=s.symbolInstances.get(h);g.crossTileID||(g.crossTileID=o.generate(),a[g.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Qr(t,s.symbolInstances,s.bucketInstanceId),!0}removeBucketCrossTileIDs(t,s){for(const o of s.getCrossTileIDsLists())for(const a of o)delete this.usedCrossTileIDs[t][a]}removeStaleBuckets(t){let s=!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],s=!0)}return s}}class Ui{constructor(){this.layerIndexes={},this.crossTileIDs=new Zt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,s,o){let a=this.layerIndexes[t.id];a===void 0&&(a=this.layerIndexes[t.id]=new In);let h=!1;const g={};a.handleWrapJump(o);for(const y of s){const v=y.getBucket(t);v&&t.id===v.layerIds[0]&&(v.bucketInstanceId||(v.bucketInstanceId=++this.maxBucketInstanceId),a.addBucket(y.tileID,v,this.crossTileIDs)&&(h=!0),g[v.bucketInstanceId]=!0)}return a.removeStaleBuckets(g)&&(h=!0),h}pruneUnusedLayers(t){const s={};t.forEach(o=>{s[o]=!0});for(const o in this.layerIndexes)s[o]||delete this.layerIndexes[o]}}const Xs=(u,t)=>c.t(u,t&&t.filter(s=>s.identifier!=="source.canvas")),Fr=c.ax();class wo extends c.E{constructor(t,s={}){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 Kr(Jr(),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 ni,this.imageManager.setEventedParent(this),this.glyphManager=new or(t._requestManager,s.localIdeographFontFamily),this.lineAtlas=new gs(256,512),this.crossTileSymbolIndex=new Ui,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()),cr().on(Se,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 g in this._layers){const y=this._layers[g];y.source===h.id&&this._validateLayer(y)}})}loadURL(t,s={},o){this.fire(new c.k("dataloading",{dataType:"style"})),s.validate=typeof s.validate!="boolean"||s.validate;const a=this.map._requestManager.transformRequest(t,"Style");this._loadStyleRequest=new AbortController;const h=this._loadStyleRequest;c.h(a,this._loadStyleRequest).then(g=>{this._loadStyleRequest=null,this._load(g.data,s,o)}).catch(g=>{this._loadStyleRequest=null,g&&!h.signal.aborted&&this.fire(new c.j(g))})}loadJSON(t,s={},o){this.fire(new c.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,ae.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,s.validate=s.validate!==!1,this._load(t,s,o)}).catch(()=>{})}loadEmpty(){this.fire(new c.k("dataloading",{dataType:"style"})),this._load(Fr,{validate:!1})}_load(t,s,o){var a;const h=s.transformStyle?s.transformStyle(o,t):t;if(!s.validate||!Xs(this,c.x(h))){this._loaded=!0,this.stylesheet=h;for(const g in h.sources)this.addSource(g,h.sources[g],{validate:!1});h.sprite?this._loadSprite(h.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(h.glyphs),this._createLayers(),this.light=new xr(this.stylesheet.light),this.sky=new Gi(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(s=>s.id),this._layers={},this._serializedLayers=null;for(const s of t){const o=c.aB(s);o.setEventedParent(this,{layer:{id:s.id}}),this._layers[s.id]=o}}_loadSprite(t,s=!1,o=void 0){let a;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(h,g,y,v){return c._(this,void 0,void 0,function*(){const w=si(h),A=y>1?"@2x":"",I={},L={};for(const{id:F,url:$}of w){const Z=g.transformRequest(Cr($,A,".json"),"SpriteJSON");I[F]=c.h(Z,v);const j=g.transformRequest(Cr($,A,".png"),"SpriteImage");L[F]=Ze.getImage(j,v)}return yield Promise.all([...Object.values(I),...Object.values(L)]),function(F,$){return c._(this,void 0,void 0,function*(){const Z={};for(const j in F){Z[j]={};const H=ae.getImageCanvasContext((yield $[j]).data),K=(yield F[j]).data;for(const N in K){const{width:ee,height:se,x:le,y:me,sdf:ve,pixelRatio:Me,stretchX:De,stretchY:be,content:we,textFitWidth:Oe,textFitHeight:Qe}=K[N];Z[j][N]={data:null,pixelRatio:Me,sdf:ve,stretchX:De,stretchY:be,content:we,textFitWidth:Oe,textFitHeight:Qe,spriteData:{width:ee,height:se,x:le,y:me,context:H}}}}return Z})}(I,L)})}(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(h=>{if(this._spriteRequest=null,h)for(const g in h){this._spritesImagesIds[g]=[];const y=this._spritesImagesIds[g]?this._spritesImagesIds[g].filter(v=>!(v in h)):[];for(const v of y)this.imageManager.removeImage(v),this._changedImages[v]=!0;for(const v in h[g]){const w=g==="default"?v:`${g}:${v}`;this._spritesImagesIds[g].push(w),w in this.imageManager.images?this.imageManager.updateImage(w,h[g][v],!1):this.imageManager.addImage(w,h[g][v]),s&&(this._changedImages[w]=!0)}}}).catch(h=>{this._spriteRequest=null,a=h,this.fire(new c.j(a))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),s&&(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 s=this.sourceCaches[t.source];if(!s)return;const o=t.sourceLayer;if(!o)return;const a=s.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 s=this._serializedAllLayers();if(!t||t.length===0)return Object.values(s);const o=[];for(const a of t)s[a]&&o.push(s[a]);return o}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const s=Object.keys(this._layers);for(const o of s){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 s=this._changed;if(s){const a=Object.keys(this._updatedLayers),h=Object.keys(this._removedLayers);(a.length||h.length)&&this._updateWorkerLayers(a,h);for(const g in this._updatedSources){const y=this._updatedSources[g];if(y==="reload")this._reloadSource(g);else{if(y!=="clear")throw new Error(`Invalid action ${y}`);this._clearSource(g)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const g in this._updatedPaintProps)this._layers[g].updateTransitions(t);this.light.updateTransitions(t),this.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,s&&this.fire(new c.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const s in this.sourceCaches)this.sourceCaches[s].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,s){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t),removedIds:s})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,s={}){var o;this._checkLoaded();const a=this.serialize();if(t=s.transformStyle?s.transformStyle(a,t):t,((o=s.validate)===null||o===void 0||o)&&Xs(this,c.x(t)))return!1;(t=c.aC(t)).layers=c.aA(t.layers);const h=c.aD(a,t),g=this._getOperationsToPerform(h);if(g.unimplemented.length>0)throw new Error(`Unimplemented: ${g.unimplemented.join(", ")}.`);if(g.operations.length===0)return!1;for(const y of g.operations)y();return this.stylesheet=t,this._serializedLayers=null,!0}_getOperationsToPerform(t){const s=[],o=[];for(const a of t)switch(a.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":s.push(()=>this.addLayer.apply(this,a.args));break;case"removeLayer":s.push(()=>this.removeLayer.apply(this,a.args));break;case"setPaintProperty":s.push(()=>this.setPaintProperty.apply(this,a.args));break;case"setLayoutProperty":s.push(()=>this.setLayoutProperty.apply(this,a.args));break;case"setFilter":s.push(()=>this.setFilter.apply(this,a.args));break;case"addSource":s.push(()=>this.addSource.apply(this,a.args));break;case"removeSource":s.push(()=>this.removeSource.apply(this,a.args));break;case"setLayerZoomRange":s.push(()=>this.setLayerZoomRange.apply(this,a.args));break;case"setLight":s.push(()=>this.setLight.apply(this,a.args));break;case"setGeoJSONSourceData":s.push(()=>this.setGeoJSONSourceData.apply(this,a.args));break;case"setGlyphs":s.push(()=>this.setGlyphs.apply(this,a.args));break;case"setSprite":s.push(()=>this.setSprite.apply(this,a.args));break;case"setSky":s.push(()=>this.setSky.apply(this,a.args));break;case"setTerrain":s.push(()=>this.map.setTerrain.apply(this,a.args));break;case"setTransition":s.push(()=>{});break;default:o.push(a.command)}return{operations:s,unimplemented:o}}addImage(t,s){if(this.getImage(t))return this.fire(new c.j(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,s),this._afterImageUpdated(t)}updateImage(t,s){this.imageManager.updateImage(t,s)}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,s,o={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!s.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(s).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(s.type)>=0&&this._validate(c.x.source,`sources.${t}`,s,null,o))return;this.map&&this.map._collectResourceTiming&&(s.collectResourceTiming=!0);const a=this.sourceCaches[t]=new Je(t,s,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 s=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],s.fire(new c.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),s.setEventedParent(null),s.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,s){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(s),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,s,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(Xs(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 g=s?this._order.indexOf(s):this._order.length;if(s&&g===-1)this.fire(new c.j(new Error(`Cannot add layer "${a}" before non-existing layer "${s}".`)));else{if(this._order.splice(g,0,a),this._layerOrderChanged=!0,this._layers[a]=h,this._removedLayers[a]&&h.source&&h.type!=="custom"){const y=this._removedLayers[a];delete this._removedLayers[a],y.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,s){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===s)return;const o=this._order.indexOf(t);this._order.splice(o,1);const a=s?this._order.indexOf(s):this._order.length;s&&a===-1?this.fire(new c.j(new Error(`Cannot move layer "${t}" before non-existing layer "${s}".`))):(this._order.splice(a,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const s=this._layers[t];if(!s)return void this.fire(new c.j(new Error(`Cannot remove non-existing layer "${t}".`)));s.setEventedParent(null);const o=this._order.indexOf(t);this._order.splice(o,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=s,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],s.onRemove&&s.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,s,o){this._checkLoaded();const a=this.getLayer(t);a?a.minzoom===s&&a.maxzoom===o||(s!=null&&(a.minzoom=s),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,s,o={}){this._checkLoaded();const a=this.getLayer(t);if(a){if(!c.aF(a.filter,s))return s==null?(a.filter=void 0,void this._updateLayer(a)):void(this._validate(c.x.filter,`layers.${a.id}.filter`,s,null,o)||(a.filter=c.aC(s),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,s,o,a={}){this._checkLoaded();const h=this.getLayer(t);h?c.aF(h.getLayoutProperty(s),o)||(h.setLayoutProperty(s,o,a),this._updateLayer(h)):this.fire(new c.j(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,s){const o=this.getLayer(t);if(o)return o.getLayoutProperty(s);this.fire(new c.j(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,s,o,a={}){this._checkLoaded();const h=this.getLayer(t);h?c.aF(h.getPaintProperty(s),o)||(h.setPaintProperty(s,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,s){return this.getLayer(t).getPaintProperty(s)}setFeatureState(t,s){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 g=h.getSource().type;g==="geojson"&&a?this.fire(new c.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):g!=="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,s)):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,s){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,g=h==="vector"?t.sourceLayer:void 0;h!=="vector"||g?s&&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(g,t.id,s):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const s=t.source,o=t.sourceLayer,a=this.sourceCaches[s];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 '${s}' 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()),s=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:s,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 s=g=>this._layers[g].type==="fill-extrusion",o={},a=[];for(let g=this._order.length-1;g>=0;g--){const y=this._order[g];if(s(y)){o[y]=g;for(const v of t){const w=v[y];if(w)for(const A of w)a.push(A)}}}a.sort((g,y)=>y.intersectionZ-g.intersectionZ);const h=[];for(let g=this._order.length-1;g>=0;g--){const y=this._order[g];if(s(y))for(let v=a.length-1;v>=0;v--){const w=a[v].feature;if(o[w.layer.id]<g)break;h.push(w),a.pop()}else for(const v of t){const w=v[y];if(w)for(const A of w)h.push(A.feature)}}return h}queryRenderedFeatures(t,s,o){s&&s.filter&&this._validate(c.x.filter,"queryRenderedFeatures.filter",s.filter,null,s);const a={};if(s&&s.layers){if(!Array.isArray(s.layers))return this.fire(new c.j(new Error("parameters.layers must be an Array."))),[];for(const y of s.layers){const v=this._layers[y];if(!v)return this.fire(new c.j(new Error(`The layer '${y}' does not exist in the map's style and cannot be queried for features.`))),[];a[v.source]=!0}}const h=[];s.availableImages=this._availableImages;const g=this._serializedAllLayers();for(const y in this.sourceCaches)s.layers&&!a[y]||h.push(zr(this.sourceCaches[y],this._layers,g,t,s,o));return this.placement&&h.push(function(y,v,w,A,I,L,F){const $={},Z=L.queryRenderedSymbols(A),j=[];for(const H of Object.keys(Z).map(Number))j.push(F[H]);j.sort(Dr);for(const H of j){const K=H.featureIndex.lookupSymbolFeatures(Z[H.bucketInstanceId],v,H.bucketIndex,H.sourceLayerIndex,I.filter,I.layers,I.availableImages,y);for(const N in K){const ee=$[N]=$[N]||[],se=K[N];se.sort((le,me)=>{const ve=H.featureSortOrder;if(ve){const Me=ve.indexOf(le.featureIndex);return ve.indexOf(me.featureIndex)-Me}return me.featureIndex-le.featureIndex});for(const le of se)ee.push(le)}}for(const H in $)$[H].forEach(K=>{const N=K.feature,ee=w[y[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 $}(this._layers,g,this.sourceCaches,t,s,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(h)}querySourceFeatures(t,s){s&&s.filter&&this._validate(c.x.filter,"querySourceFeatures.filter",s.filter,null,s);const o=this.sourceCaches[t];return o?function(a,h){const g=a.getRenderableIds().map(w=>a.getTileByID(w)),y=[],v={};for(let w=0;w<g.length;w++){const A=g[w],I=A.tileID.canonical.key;v[I]||(v[I]=!0,A.querySourceFeatures(y,h))}return y}(o,s):[]}getLight(){return this.light.getLight()}setLight(t,s={}){this._checkLoaded();const o=this.light.getLight();let a=!1;for(const g in t)if(!c.aF(t[g],o[g])){a=!0;break}if(!a)return;const h={now:ae.now(),transition:c.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,s),this.light.updateTransitions(h)}getSky(){var t;return(t=this.stylesheet)===null||t===void 0?void 0:t.sky}setSky(t,s={}){const o=this.sky.getSky();let a=!1;t||o&&(a=!0);for(const g in t)if(!c.aF(t[g],o[g])){a=!0;break}if(!a)return;const h={now:ae.now(),transition:c.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,s),this.sky.updateTransitions(h)}_validate(t,s,o,a,h={}){return(!h||h.validate!==!1)&&Xs(this,t.call(c.x,c.e({key:s,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),cr().off(Se,this._rtlPluginLoaded);for(const s in this._layers)this._layers[s].setEventedParent(null);for(const s in this.sourceCaches){const o=this.sourceCaches[s];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 s in this.sourceCaches)this.sourceCaches[s].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,s,o,a,h=!1){let g=!1,y=!1;const v={};for(const w of this._order){const A=this._layers[w];if(A.type!=="symbol")continue;if(!v[A.source]){const L=this.sourceCaches[A.source];v[A.source]=L.getRenderableIds(!0).map(F=>L.getTileByID(F)).sort((F,$)=>$.tileID.overscaledZ-F.tileID.overscaledZ||(F.tileID.isLessThan($.tileID)?-1:1))}const I=this.crossTileSymbolIndex.addLayer(A,v[A.source],t.center.lng);g=g||I}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((h=h||this._layerOrderChanged||o===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(ae.now(),t.zoom))&&(this.pauseablePlacement=new Wt(t,this.map.terrain,this._order,h,s,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(ae.now()),y=!0),g&&this.pauseablePlacement.placement.setStale()),y||g)for(const w of this._order){const A=this._layers[w];A.type==="symbol"&&this.placement.updateLayerOpacities(A,v[A.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(ae.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,s){return c._(this,void 0,void 0,function*(){const o=yield this.imageManager.getImages(s.icons);this._updateTilesForChangedImages();const a=this.sourceCaches[s.source];return a&&a.setDependencies(s.tileID.key,s.type,s.icons),o})}getGlyphs(t,s){return c._(this,void 0,void 0,function*(){const o=yield this.glyphManager.getGlyphs(s.stacks),a=this.sourceCaches[s.source];return a&&a.setDependencies(s.tileID.key,s.type,[""]),o})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,s={}){this._checkLoaded(),t&&this._validate(c.x.glyphs,"glyphs",t,null,s)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,s,o={},a){this._checkLoaded();const h=[{id:t,url:s}],g=[...si(this.stylesheet.sprite),...h];this._validate(c.x.sprite,"sprite",g,null,o)||(this.stylesheet.sprite=g,this._loadSprite(h,!0,a))}removeSprite(t){this._checkLoaded();const s=si(this.stylesheet.sprite);if(s.find(o=>o.id===t)){if(this._spritesImagesIds[t])for(const o of this._spritesImagesIds[t])this.imageManager.removeImage(o),this._changedImages[o]=!0;s.splice(s.findIndex(o=>o.id===t),1),this.stylesheet.sprite=s.length>0?s: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 si(this.stylesheet.sprite)}setSprite(t,s={},o){this._checkLoaded(),t&&this._validate(c.x.sprite,"sprite",t,null,s)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,o):(this._unloadSprite(),o&&o(null)))}}var Js=c.Y([{name:"a_pos",type:"Int16",components:2}]);const Or={prelude:gt(`#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:gt(`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:gt(`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:gt(`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:gt("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:gt(`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:gt(`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:gt("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:gt("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:gt("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:gt(`#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:gt(`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:gt(`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:gt(`#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:gt(`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:gt(`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:gt(`#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:gt(`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:gt(`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:gt(`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:gt(`#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:gt(`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:gt(`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:gt(`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:gt(`#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:gt(`#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:
|
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:gt("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:gt("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:gt("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:gt("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 gt(u,t){const s=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,o=t.match(/attribute ([\w]+) ([\w]+)/g),a=u.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),h=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),g=h?h.concat(a):a,y={};return{fragmentSource:u=u.replace(s,(v,w,A,I,L)=>(y[L]=!0,w==="define"?`
|
530
530
|
#ifndef HAS_UNIFORM_u_${L}
|
531
|
-
varying ${
|
531
|
+
varying ${A} ${I} ${L};
|
532
532
|
#else
|
533
|
-
uniform ${
|
533
|
+
uniform ${A} ${I} u_${L};
|
534
534
|
#endif
|
535
535
|
`:`
|
536
536
|
#ifdef HAS_UNIFORM_u_${L}
|
537
|
-
${
|
537
|
+
${A} ${I} ${L} = u_${L};
|
538
538
|
#endif
|
539
|
-
`)),vertexSource:t=t.replace(
|
539
|
+
`)),vertexSource:t=t.replace(s,(v,w,A,I,L)=>{const F=I==="float"?"vec2":"vec4",$=L.match(/color/)?"color":F;return y[L]?w==="define"?`
|
540
540
|
#ifndef HAS_UNIFORM_u_${L}
|
541
541
|
uniform lowp float u_${L}_t;
|
542
|
-
attribute ${
|
543
|
-
varying ${
|
542
|
+
attribute ${A} ${F} a_${L};
|
543
|
+
varying ${A} ${I} ${L};
|
544
544
|
#else
|
545
|
-
uniform ${
|
545
|
+
uniform ${A} ${I} u_${L};
|
546
546
|
#endif
|
547
|
-
|
547
|
+
`:$==="vec4"?`
|
548
548
|
#ifndef HAS_UNIFORM_u_${L}
|
549
549
|
${L} = a_${L};
|
550
550
|
#else
|
551
|
-
${
|
551
|
+
${A} ${I} ${L} = u_${L};
|
552
552
|
#endif
|
553
553
|
`:`
|
554
554
|
#ifndef HAS_UNIFORM_u_${L}
|
555
|
-
${L} = unpack_mix_${
|
555
|
+
${L} = unpack_mix_${$}(a_${L}, u_${L}_t);
|
556
556
|
#else
|
557
|
-
${
|
557
|
+
${A} ${I} ${L} = u_${L};
|
558
558
|
#endif
|
559
559
|
`:w==="define"?`
|
560
560
|
#ifndef HAS_UNIFORM_u_${L}
|
561
561
|
uniform lowp float u_${L}_t;
|
562
|
-
attribute ${
|
562
|
+
attribute ${A} ${F} a_${L};
|
563
563
|
#else
|
564
|
-
uniform ${
|
564
|
+
uniform ${A} ${I} u_${L};
|
565
565
|
#endif
|
566
|
-
|
566
|
+
`:$==="vec4"?`
|
567
567
|
#ifndef HAS_UNIFORM_u_${L}
|
568
|
-
${
|
568
|
+
${A} ${I} ${L} = a_${L};
|
569
569
|
#else
|
570
|
-
${
|
570
|
+
${A} ${I} ${L} = u_${L};
|
571
571
|
#endif
|
572
572
|
`:`
|
573
573
|
#ifndef HAS_UNIFORM_u_${L}
|
574
|
-
${
|
574
|
+
${A} ${I} ${L} = unpack_mix_${$}(a_${L}, u_${L}_t);
|
575
575
|
#else
|
576
|
-
${
|
577
|
-
#endif
|
578
|
-
`}),staticAttributes:o,staticUniforms:
|
579
|
-
`),K=
|
580
|
-
`),j=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);if(y.shaderSource(j,H),y.compileShader(j),!y.getShaderParameter(j,y.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${y.getShaderInfoLog(j)}`);y.attachShader(this.program,j);const ee=y.createShader(y.VERTEX_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);if(y.shaderSource(ee,K),y.compileShader(ee),!y.getShaderParameter(ee,y.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${y.getShaderInfoLog(ee)}`);y.attachShader(this.program,ee),this.attributes={};const se={};this.numAttributes=k.length;for(let ce=0;ce<this.numAttributes;ce++)k[ce]&&(y.bindAttribLocation(this.program,ce,k[ce]),this.attributes[k[ce]]=ce);if(y.linkProgram(this.program),!y.getProgramParameter(this.program,y.LINK_STATUS))throw new Error(`Program failed to link: ${y.getProgramInfoLog(this.program)}`);y.deleteShader(ee),y.deleteShader(j);for(let ce=0;ce<Z.length;ce++){const _e=Z[ce];if(_e&&!se[_e]){const we=y.getUniformLocation(this.program,_e);we&&(se[_e]=we)}}this.fixedUniforms=a(t,se),this.terrainUniforms=((ce,_e)=>({u_depth:new c.aI(ce,_e.u_depth),u_terrain:new c.aI(ce,_e.u_terrain),u_terrain_dim:new c.aJ(ce,_e.u_terrain_dim),u_terrain_matrix:new c.aK(ce,_e.u_terrain_matrix),u_terrain_unpack:new c.aL(ce,_e.u_terrain_unpack),u_terrain_exaggeration:new c.aJ(ce,_e.u_terrain_exaggeration)}))(t,se),this.binderUniforms=o?o.getUniforms(t,se):[]}draw(t,n,o,a,h,m,y,v,w,k,E,L,F,N,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 se in this.terrainUniforms)this.terrainUniforms[se].set(v[se])}for(const se in this.fixedUniforms)this.fixedUniforms[se].set(y[se]);Z&&Z.setUniforms(t,this.binderUniforms,F,{zoom:N});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 se of L.get()){const ce=se.vaos||(se.vaos={});(ce[w]||(ce[w]=new qs)).bind(t,this,k,Z?Z.getPaintVertexBuffers():[],E,se.vertexOffset,U,H,K),j.drawElements(n,se.primitiveLength*ee,j.UNSIGNED_SHORT,se.primitiveOffset*ee*2)}}}function Gs(u,t,n){const o=1/rt(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),y=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,y>>16],u_pixel_coord_lower:[65535&m,65535&y]}}const Hs=(u,t,n,o)=>{const a=t.style.light,h=a.properties.get("position"),m=[h.x,h.y,h.z],y=function(){var w=new c.A(9);return c.A!=Float32Array&&(w[1]=0,w[2]=0,w[3]=0,w[5]=0,w[6]=0,w[7]=0),w[0]=1,w[4]=1,w[8]=1,w}();a.properties.get("anchor")==="viewport"&&function(w,k){var E=Math.sin(k),L=Math.cos(k);w[0]=L,w[1]=E,w[2]=0,w[3]=-E,w[4]=L,w[5]=0,w[6]=0,w[7]=0,w[8]=1}(y,-t.transform.angle),function(w,k,E){var L=k[0],F=k[1],N=k[2];w[0]=L*E[0]+F*E[3]+N*E[6],w[1]=L*E[1]+F*E[4]+N*E[7],w[2]=L*E[2]+F*E[5]+N*E[8]}(m,m,y);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}},Ws=(u,t,n,o,a,h,m)=>c.e(Hs(u,t,n,o),Gs(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),Gs(n,t,o)),Vc=(u,t)=>({u_matrix:u,u_world:t}),Nc=(u,t,n,o,a)=>c.e(Mn(u,t,n,o),{u_world:a}),fl=(u,t,n,o)=>{const a=u.transform;let h,m;if(o.paint.get("circle-pitch-alignment")==="map"){const y=rt(n,1,a.zoom);h=!0,m=[y,y]}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}},jc=(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:rt(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:_l(u,t,n,o),u_ratio:1/rt(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}),ml=(u,t,n,o,a)=>{const h=u.transform,m=hn(t,h);return{u_matrix:_l(u,t,n,a),u_texsize:t.imageAtlasTexture.size,u_ratio:1/rt(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]]}},gl=(u,t,n,o,a,h)=>{const m=u.lineAtlas,y=hn(t,u.transform),v=n.layout.get("line-cap")==="round",w=m.getDash(o.from,v),k=m.getDash(o.to,v),E=w.width*a.fromScale,L=k.width*a.toScale;return c.e(fs(u,t,n,h),{u_patternscale_a:[y/E,-w.height/2],u_patternscale_b:[y/L,-k.height/2],u_sdfgamma:m.width/(256*Math.min(E,L)*u.pixelRatio)/2,u_image:0,u_tex_y_a:w.y,u_tex_y_b:k.y,u_mix:a.t})};function hn(u,t){return 1/rt(u,1,t.tileZoom)}function _l(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 Uc=(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:$c(a.paint.get("raster-hue-rotate"))};var h,m};function $c(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 yl=(u,t,n,o,a,h,m,y,v,w,k,E,L,F)=>{const N=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:N.cameraToCenterDistance,u_pitch:N.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:N.width/N.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_matrix:y,u_label_plane_matrix:v,u_coord_matrix:w,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:k,u_pitched_scale:F}},xl=(u,t,n,o,a,h,m,y,v,w,k,E,L,F,N)=>{const Z=m.transform;return c.e(yl(u,t,n,o,a,h,m,y,v,w,k,E,L,N),{u_gamma_scale:o?Math.cos(Z._pitch)*Z.cameraToCenterDistance:1,u_device_pixel_ratio:m.pixelRatio,u_is_halo:+F})},qc=(u,t,n,o,a,h,m,y,v,w,k,E,L,F)=>c.e(xl(u,t,n,o,a,h,m,y,v,w,k,!0,E,!0,F),{u_texsize_icon:L,u_texture_icon:1}),Js=(u,t,n)=>({u_matrix:u,u_opacity:t,u_color:n}),Go=(u,t,n,o,a,h)=>c.e(function(m,y,v,w){const k=v.imageManager.getPattern(m.from.toString()),E=v.imageManager.getPattern(m.to.toString()),{width:L,height:F}=v.imageManager.getPixelSize(),N=Math.pow(2,w.tileID.overscaledZ),Z=w.tileSize*Math.pow(2,v.transform.tileZoom)/N,U=Z*(w.tileID.canonical.x+w.tileID.wrap*N),H=Z*w.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:k.tl,u_pattern_br_a:k.br,u_pattern_tl_b:E.tl,u_pattern_br_b:E.br,u_texsize:[L,F],u_mix:y.t,u_pattern_size_a:k.displaySize,u_pattern_size_b:E.displaySize,u_scale_a:y.fromScale,u_scale_b:y.toScale,u_tile_units_to_pixels:1/rt(w,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}),Ks={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 Ho{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 Wo={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class _r{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[Wo[h.type]],!1,this.itemSize,h.offset+this.itemSize*(o||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Xo=new WeakMap;function zn(u){var t;if(Xo.has(u))return Xo.get(u);{const n=(t=u.getParameter(u.VERSION))===null||t===void 0?void 0:t.startsWith("WebGL 2.0");return Xo.set(u,n),n}}class dt{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 dt{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 Zc extends dt{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Ys extends dt{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Gc extends dt{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 dt{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Hc extends dt{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class vl extends dt{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 Wc extends dt{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 bl extends dt{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 Jo extends dt{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 wl extends dt{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 Sl extends dt{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Tl extends dt{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 Il extends dt{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 dt{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 Pl extends dt{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Xc extends dt{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 Jc extends dt{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class kl extends dt{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 dt{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Kc extends dt{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Qs extends dt{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 Yc extends dt{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 Qc extends dt{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 El extends dt{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 Al extends dt{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 Cl extends dt{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Ko extends dt{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 Ml extends dt{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 eo extends dt{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 Mr extends dt{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 dt{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class Yo 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 Qo 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 zl 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 ea{constructor(t,n,o,a,h){this.context=t,this.width=n,this.height=o;const m=t.gl,y=this.framebuffer=m.createFramebuffer();if(this.colorAttachment=new Yo(t,y),a)this.depthAttachment=h?new zl(t,y):new Qo(t,y);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 Et{constructor(t,n,o){this.blendFunction=t,this.blendColor=n,this.mask=o}}Et.Replace=[1,0],Et.disabled=new Et(Et.Replace,c.aN.transparent,[!1,!1,!1,!1]),Et.unblended=new Et(Et.Replace,c.aN.transparent,[!0,!0,!0,!0]),Et.alphaBlended=new Et([1,771],c.aN.transparent,[!0,!0,!0,!0]);class ta{constructor(t){var n,o;if(this.gl=t,this.clearColor=new ms(this),this.clearDepth=new Zc(this),this.clearStencil=new Ys(this),this.colorMask=new Gc(this),this.depthMask=new Dn(this),this.stencilMask=new Hc(this),this.stencilFunc=new vl(this),this.stencilOp=new Wc(this),this.stencilTest=new bl(this),this.depthRange=new Jo(this),this.depthTest=new wl(this),this.depthFunc=new Sl(this),this.blend=new Tl(this),this.blendFunc=new Il(this),this.blendColor=new un(this),this.blendEquation=new Pl(this),this.cullFace=new Xc(this),this.cullFaceSide=new Jc(this),this.frontFace=new kl(this),this.program=new gs(this),this.activeTexture=new Kc(this),this.viewport=new Qs(this),this.bindFramebuffer=new Yc(this),this.bindRenderbuffer=new Qc(this),this.bindTexture=new El(this),this.bindVertexBuffer=new Al(this),this.bindElementBuffer=new Cl(this),this.bindVertexArray=new Ko(this),this.pixelStoreUnpack=new Ml(this),this.pixelStoreUnpackPremultiplyAlpha=new eo(this),this.pixelStoreUnpackFlipY=new Mr(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 Ho(this,t,n)}createVertexBuffer(t,n,o){return new _r(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 ea(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,Et.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 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 ia=7680;class Vt{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}}Vt.disabled=new Vt({func:519,mask:0},0,0,ia,ia,ia);class zt{constructor(t,n,o){this.enable=t,this.mode=n,this.frontFace=o}}let ys;function Dl(u,t,n,o,a){const h=u.context,m=h.gl,y=u.useProgram("collisionBox"),v=[];let w=0,k=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,se=j.collisionCircleArray;if(se.length>0){const ce=c.H();c.aR(ce,j.placementInvProjMatrix,u.transform.glCoordMatrix),c.aR(ce,ce,j.placementViewportMatrix),v.push({circleArray:se,circleOffset:k,transform:K.posMatrix,invTransform:ce,coord:K}),w+=se.length/4,k=w}ee&&y.draw(h,m.LINES,ht.disabled,Vt.disabled,u.colorModeForRenderPass(),zt.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"),F=new c.aS;F.resize(4*w),F._trim();let N=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],se=H.circleArray[j+1],ce=H.circleArray[j+2],_e=H.circleArray[j+3];F.emplace(N++,ee,se,ce,_e,0),F.emplace(N++,ee,se,ce,_e,1),F.emplace(N++,ee,se,ce,_e,2),F.emplace(N++,ee,se,ce,_e,3)}(!ys||ys.length<2*w)&&(ys=function(H){const K=2*H,j=new c.aU;j.resize(K),j._trim();for(let ee=0;ee<K;ee++){const se=6*ee;j.uint16[se+0]=4*ee+0,j.uint16[se+1]=4*ee+1,j.uint16[se+2]=4*ee+2,j.uint16[se+3]=4*ee+2,j.uint16[se+4]=4*ee+3,j.uint16[se+5]=4*ee+0}return j}(w));const Z=h.createIndexBuffer(ys,!0),U=h.createVertexBuffer(F,c.aT.members,!0);for(const H of v){const K=jc(H.transform,H.invTransform,u.transform);L.draw(h,m.TRIANGLES,ht.disabled,Vt.disabled,u.colorModeForRenderPass(),zt.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()}zt.disabled=new zt(!1,1029,2305),zt.backCCW=new zt(!0,1029,2305);const ra=c.ao(new Float32Array(16));function to(u,t,n,o,a,h){const{horizontalAlign:m,verticalAlign:y}=c.av(u);return new c.P((-(m-.5)*t/a+o[0])*h,(-(y-.5)*n/a+o[1])*h)}function io(u,t,n,o,a,h){const m=t.tileAnchorPoint.add(new c.P(t.translation[0],t.translation[1]));if(t.pitchWithMap){let y=o.mult(h);return n||(y=y.rotate(-a)),G(m.add(y),t.labelPlaneMatrix,t.getElevation).point}if(n){const y=pe(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(u),v=Math.atan(y.y/y.x)+(y.x<0?Math.PI:0);return u.add(o.rotate(v))}return u.add(o)}function ro(u,t,n,o,a,h,m,y,v,w,k,E,L,F){const N=u.text.placedSymbolArray,Z=u.text.dynamicLayoutVertexArray,U=u.icon.dynamicLayoutVertexArray,H={};Z.clear();for(let K=0;K<N.length;K++){const j=N.get(K),ee=j.hidden||!j.crossTileID||u.allowVerticalPlacement&&!j.placedOrientation?null:o[j.crossTileID];if(ee){const se=new c.P(j.anchorX,j.anchorY),ce={getElevation:F,width:a.width,height:a.height,labelPlaneMatrix:h,lineVertexArray:null,pitchWithMap:n,projection:k,projectionCache:null,tileAnchorPoint:se,translation:E,unwrappedTileID:L},_e=n?G(se,m,F):pe(se.x,se.y,ce),we=z(a.cameraToCenterDistance,_e.signedDistanceFromCamera);let Le=c.aj(u.textSizeData,v,j)*we/c.aq;n&&(Le*=u.tilePixelRatio/y);const{width:Be,height:Se,anchor:Te,textOffset:je,textBoxScale:tt}=ee,ke=to(Te,Be,Se,je,tt,Le),Ce=k.getPitchedTextCorrection(a,se.add(new c.P(E[0],E[1])),L),Qe=io(_e.point,ce,t,ke,a.angle,Ce),Lt=u.allowVerticalPlacement&&j.placedOrientation===c.ai.vertical?Math.PI/2:0;for(let st=0;st<j.numGlyphs;st++)c.ak(Z,Qe,Lt);w&&j.associatedIconIndex>=0&&(H[j.associatedIconIndex]={shiftedAnchor:Qe,angle:Lt})}else We(j.numGlyphs,Z)}if(w){U.clear();const K=u.icon.placedSymbolArray;for(let j=0;j<K.length;j++){const ee=K.get(j);if(ee.hidden)We(ee.numGlyphs,U);else{const se=H[j];if(se)for(let ce=0;ce<ee.numGlyphs;ce++)c.ak(U,se.shiftedAnchor,se.angle);else We(ee.numGlyphs,U)}}u.icon.dynamicLayoutVertexBuffer.updateData(U)}u.text.dynamicLayoutVertexBuffer.updateData(Z)}function na(u,t,n){return n.iconsInText&&t?"symbolTextAndIcon":u?"symbolSDF":"symbolIcon"}function Wr(u,t,n,o,a,h,m,y,v,w,k,E){const L=u.context,F=L.gl,N=u.transform,Z=Us(),U=y==="map",H=v==="map",K=y!=="viewport"&&n.layout.get("symbol-placement")!=="point",j=U&&!H&&!K,ee=!H&&K,se=!n.layout.get("symbol-sort-key").isConstant();let ce=!1;const _e=u.depthModeForSublayer(0,ht.ReadOnly),we=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Le=[],Be=Z.getCircleRadiusCorrection(N);for(const Se of o){const Te=t.getTile(Se),je=Te.getBucket(n);if(!je)continue;const tt=a?je.text:je.icon;if(!tt||!tt.segments.get().length||!tt.hasVisibleVertices)continue;const ke=tt.programConfigurations.get(n.id),Ce=a||je.sdfIcons,Qe=a?je.textSizeData:je.iconSizeData,Lt=H||N.pitch!==0,st=u.useProgram(na(Ce,a,je),ke),ut=c.ah(Qe,N.zoom),Rt=u.style.map.terrain&&u.style.map.terrain.getTerrainData(Se);let di,rr,Bt,Mi,Ii=[0,0],pi=null;if(a)rr=Te.glyphAtlasTexture,Bt=F.LINEAR,di=Te.glyphAtlasTexture.size,je.iconsInText&&(Ii=Te.imageAtlasTexture.size,pi=Te.imageAtlasTexture,Mi=Lt||u.options.rotating||u.options.zooming||Qe.kind==="composite"||Qe.kind==="camera"?F.LINEAR:F.NEAREST);else{const Nt=n.layout.get("icon-size").constantOr(0)!==1||je.iconsNeedLinear;rr=Te.imageAtlasTexture,Bt=Ce||u.options.rotating||u.options.zooming||Nt||Lt?F.LINEAR:F.NEAREST,di=Te.imageAtlasTexture.size}const fi=rt(Te,1,u.transform.zoom),nr=ee?Se.posMatrix:ra,xn=qr(nr,H,U,u.transform,fi),xo=gr(nr,H,U,u.transform,fi),Un=gr(Se.posMatrix,H,U,u.transform,fi),vn=Z.translatePosition(u.transform,Te,h,m),vo=we&&je.hasTextData(),Ra=n.layout.get("icon-text-fit")!=="none"&&vo&&je.hasIconData();if(K){const Nt=u.style.map.terrain?(Ba,ti)=>u.style.map.terrain.getElevation(Se,Ba,ti):null,qn=n.layout.get("text-rotation-alignment")==="map";V(je,Se.posMatrix,u,a,xn,Un,H,w,qn,Z,Se.toUnwrapped(),N.width,N.height,vn,Nt)}const oi=Se.posMatrix,sr=a&&we||Ra,Kr=K||sr?ra:xn,$n=xo,mi=Ce&&n.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let gi;gi=Ce?je.iconsInText?qc(Qe.kind,ut,j,H,K,sr,u,oi,Kr,$n,vn,di,Ii,Be):xl(Qe.kind,ut,j,H,K,sr,u,oi,Kr,$n,vn,a,di,!0,Be):yl(Qe.kind,ut,j,H,K,sr,u,oi,Kr,$n,vn,a,di,Be);const ri={program:st,buffers:tt,uniformValues:gi,atlasTexture:rr,atlasTextureIcon:pi,atlasInterpolation:Bt,atlasInterpolationIcon:Mi,isSDF:Ce,hasHalo:mi};if(se&&je.canOverlap){ce=!0;const Nt=tt.segments.get();for(const qn of Nt)Le.push({segments:new c.a0([qn]),sortKey:qn.sortKey,state:ri,terrainData:Rt})}else Le.push({segments:tt.segments,sortKey:0,state:ri,terrainData:Rt})}ce&&Le.sort((Se,Te)=>Se.sortKey-Te.sortKey);for(const Se of Le){const Te=Se.state;if(L.activeTexture.set(F.TEXTURE0),Te.atlasTexture.bind(Te.atlasInterpolation,F.CLAMP_TO_EDGE),Te.atlasTextureIcon&&(L.activeTexture.set(F.TEXTURE1),Te.atlasTextureIcon&&Te.atlasTextureIcon.bind(Te.atlasInterpolationIcon,F.CLAMP_TO_EDGE)),Te.isSDF){const je=Te.uniformValues;Te.hasHalo&&(je.u_is_halo=1,dn(Te.buffers,Se.segments,n,u,Te.program,_e,k,E,je,Se.terrainData)),je.u_is_halo=0}dn(Te.buffers,Se.segments,n,u,Te.program,_e,k,E,Te.uniformValues,Se.terrainData)}}function dn(u,t,n,o,a,h,m,y,v,w){const k=o.context;a.draw(k,k.gl.TRIANGLES,h,m,y,zt.disabled,v,w,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()],y=h[n.from.toString()];if(!m&&y&&(m=y),!y&&m&&(y=m),!m||!y){const v=a.getPaintProperty(t);m=h[v],y=h[v]}m&&y&&u.setConstantPatternPositions(m,y)}function sa(u,t,n,o,a,h,m){const y=u.context.gl,v="fill-pattern",w=n.paint.get(v),k=w&&w.constantOr(1),E=n.getCrossfadeParameters();let L,F,N,Z,U;m?(F=k&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",L=y.LINES):(F=k?"fillPattern":"fill",L=y.TRIANGLES);const H=w.constantOr(null);for(const K of o){const j=t.getTile(K);if(k&&!j.patternsLoaded())continue;const ee=j.getBucket(n);if(!ee)continue;const se=ee.programConfigurations.get(n.id),ce=u.useProgram(F,se),_e=u.style.map.terrain&&u.style.map.terrain.getTerrainData(K);k&&(u.context.activeTexture.set(y.TEXTURE0),j.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),se.updatePaintBuffers(E)),$i(se,v,H,j,n);const we=_e?K:null,Le=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 Be=[y.drawingBufferWidth,y.drawingBufferHeight];N=F==="fillOutlinePattern"&&k?Nc(Le,u,E,j,Be):Vc(Le,Be)}else Z=ee.indexBuffer,U=ee.segments,N=k?Mn(Le,u,E,j):ds(Le);ce.draw(u.context,L,a,u.stencilModeForClipping(K),h,zt.disabled,N,_e,n.id,ee.layoutVertexBuffer,Z,U,n.paint,u.transform.zoom,se)}}function no(u,t,n,o,a,h,m){const y=u.context,v=y.gl,w="fill-extrusion-pattern",k=n.paint.get(w),E=k.constantOr(1),L=n.getCrossfadeParameters(),F=n.paint.get("fill-extrusion-opacity"),N=k.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,w,N,U,n);const se=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"),_e=E?Ws(se,u,ce,F,Z,L,U):Hs(se,u,ce,F);ee.draw(y,y.gl.TRIANGLES,a,h,m,zt.backCCW,_e,K,n.id,H.layoutVertexBuffer,H.indexBuffer,H.segments,n.paint,u.transform.zoom,j,u.style.map.terrain&&H.centroidVertexBuffer)}}function oa(u,t,n,o,a,h,m){const y=u.context,v=y.gl,w=n.fbo;if(!w)return;const k=u.useProgram("hillshade"),E=u.style.map.terrain&&u.style.map.terrain.getTerrainData(t);y.activeTexture.set(v.TEXTURE0),v.bindTexture(v.TEXTURE_2D,w.colorAttachment.get()),k.draw(y,v.TRIANGLES,a,h,m,zt.disabled,((L,F,N,Z)=>{const U=N.paint.get("hillshade-shadow-color"),H=N.paint.get("hillshade-highlight-color"),K=N.paint.get("hillshade-accent-color");let j=N.paint.get("hillshade-illumination-direction")*(Math.PI/180);N.paint.get("hillshade-illumination-anchor")==="viewport"&&(j-=L.transform.angle);const ee=!L.options.moving;return{u_matrix:Z?Z.posMatrix:L.transform.calculatePosMatrix(F.tileID.toUnwrapped(),ee),u_image:0,u_latrange:Ui(0,F.tileID),u_light:[N.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,y=m.gl,v=t.dem;if(v&&v.data){const w=v.dim,k=v.stride,E=v.getPixels();if(m.activeTexture.set(y.TEXTURE1),m.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||u.getTileTexture(k),t.demTexture){const F=t.demTexture;F.update(E,{premultiply:!1}),F.bind(y.NEAREST,y.CLAMP_TO_EDGE)}else t.demTexture=new wt(m,E,y.RGBA,{premultiply:!1}),t.demTexture.bind(y.NEAREST,y.CLAMP_TO_EDGE);m.activeTexture.set(y.TEXTURE0);let L=t.fbo;if(!L){const F=new wt(m,{width:w,height:w,data:null},y.RGBA);F.bind(y.LINEAR,y.CLAMP_TO_EDGE),L=t.fbo=m.createFramebuffer(w,w,!0,!1),L.colorAttachment.set(F.texture)}m.bindFramebuffer.set(L.framebuffer),m.viewport.set([0,0,w,w]),u.useProgram("hillshadePrepare").draw(m,y.TRIANGLES,o,a,h,zt.disabled,((F,N)=>{const Z=N.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:F.overscaledZ,u_unpack:N.getUnpackVector()}})(t.tileID,v),null,n.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function so(u,t,n,o,a,h){const m=o.paint.get("raster-fade-duration");if(!h&&m>0){const y=le.now(),v=(y-u.timeAdded)/m,w=t?(y-t.timeAdded)/m:-1,k=n.getSource(),E=a.coveringZoomLevel({tileSize:k.tileSize,roundZoom:k.roundZoom}),L=!t||Math.abs(t.tileID.overscaledZ-E)>Math.abs(u.tileID.overscaledZ-E),F=L&&u.refreshedUponExpiration?1:c.ad(L?v:1-w,0,1);return u.refreshedUponExpiration&&v>=1&&(u.refreshedUponExpiration=!1),t?{opacity:1,mix:1-F}:{opacity:F,mix:0}}return{opacity:1,mix:0}}const oo=new c.aN(1,0,0,1),xs=new c.aN(0,1,0,1),ao=new c.aN(0,0,1,1),Ll=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 aa(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,y=m.gl;y.enable(y.SCISSOR_TEST),y.scissor(t*u.pixelRatio,n*u.pixelRatio,o*u.pixelRatio,a*u.pixelRatio),m.clear({color:h}),y.disable(y.SCISSOR_TEST)}function mt(u,t,n){const o=u.context,a=o.gl,h=n.posMatrix,m=u.useProgram("debug"),y=ht.disabled,v=Vt.disabled,w=u.colorModeForRenderPass(),k="$debug",E=u.style.map.terrain&&u.style.map.terrain.getTerrainData(n);o.activeTexture.set(a.TEXTURE0);const L=t.getTileByID(n.key).latestRawTileData,F=Math.floor((L&&L.byteLength||0)/1024),N=t.getTile(n).tileSize,Z=512/Math.min(N,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,se=H.debugOverlayCanvas.getContext("2d");se.clearRect(0,0,j.width,j.height),se.shadowColor="white",se.shadowBlur=2,se.lineWidth=1.5,se.strokeStyle="white",se.textBaseline="top",se.font="bold 36px Open Sans, sans-serif",se.fillText(K,5,5),se.strokeText(K,5,5),H.debugOverlayTexture.update(j),H.debugOverlayTexture.bind(ee.LINEAR,ee.CLAMP_TO_EDGE)}(u,`${U} ${F}kB`),m.draw(o,a.TRIANGLES,y,v,Et.alphaBlended,zt.disabled,Hr(h,c.aN.transparent,Z),null,k,u.debugBuffer,u.quadTriangleIndexBuffer,u.debugSegments),m.draw(o,a.LINE_STRIP,y,v,w,zt.disabled,Hr(h,c.aN.red),E,k,u.debugBuffer,u.tileBorderIndexBuffer,u.debugSegments)}function vs(u,t,n){const o=u.context,a=o.gl,h=u.colorModeForRenderPass(),m=new ht(a.LEQUAL,ht.ReadWrite,u.depthRangeFor3D),y=u.useProgram("terrain"),v=t.getTerrainMesh();o.bindFramebuffer.set(null),o.viewport.set([0,0,u.width,u.height]);for(const w of n){const k=u.renderToTexture.getTexture(w),E=t.getTerrainData(w.tileID);o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,k.texture);const L=u.transform.calculatePosMatrix(w.tileID.toUnwrapped()),F=t.getMeshFrameDelta(u.transform.zoom),N=u.transform.calculateFogMatrix(w.tileID.toUnwrapped()),Z=Zo(L,F,N,u.style.sky,u.transform.pitch);y.draw(o,a.TRIANGLES,m,Vt.disabled,h,zt.backCCW,Z,E,"terrain",v.vertexBuffer,v.indexBuffer,v.segments)}}class Rl{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 Bl{constructor(t,n){this.context=new ta(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.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 Wi}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 y=new c.aY;y.emplaceBack(0,1,2),y.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(y);const v=this.context.gl;this.stencilClearMode=new Vt({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,ht.disabled,this.stencilClearMode,Et.disabled,zt.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(Et.disabled),o.setDepthMode(ht.disabled);const h=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const m of n){const y=this._tileClippingMaskIDs[m.key]=this.nextStencilID++,v=this.style.map.terrain&&this.style.map.terrain.getTerrainData(m);h.draw(o,a.TRIANGLES,ht.disabled,new Vt({func:a.ALWAYS,mask:0},y,255,a.KEEP,a.KEEP,a.REPLACE),Et.disabled,zt.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 Vt({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new Vt({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,y)=>y.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 y=0;y<h;y++)m[y+a]=new Vt({func:n.GEQUAL,mask:255},y+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=h,[m,o]}return[{[a]:Vt.disabled},o]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new Et([t.CONSTANT_COLOR,t.ONE],new c.aN(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Et.unblended:Et.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(le.now()),this.imageManager.beginFrame();const a=this.style._order,h=this.style.sourceCaches,m={},y={},v={};for(const w in h){const k=h[w];k.used&&k.prepare(this.context),m[w]=k.getVisibleCoordinates(),y[w]=m[w].slice().reverse(),v[w]=k.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let w=0;w<a.length;w++)if(this.style._layers[a[w]].is3D()){this.opaquePassCutoff=w;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const w of a){const k=this.style._layers[w];if(!k.hasOffscreenPass()||k.isHidden(this.transform.zoom))continue;const E=y[k.source];(k.type==="custom"||E.length)&&this.renderLayer(this,h[k.source],k,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(w,k){const E=w.context,L=E.gl,F=((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}))(k,w.style.map.transform,w.pixelRatio),N=new ht(L.LEQUAL,ht.ReadWrite,[0,1]),Z=Vt.disabled,U=w.colorModeForRenderPass(),H=w.useProgram("sky");if(!k.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),k.mesh=new Rl(E.createVertexBuffer(K,hs.members),E.createIndexBuffer(j),c.a0.simpleSegment(0,0,K.length,j.length))}H.draw(E,L.TRIANGLES,N,Z,U,zt.disabled,F,void 0,"sky",k.mesh.vertexBuffer,k.mesh.indexBuffer,k.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 w=this.style._layers[a[this.currentLayer]],k=h[w.source],E=m[w.source];this._renderTileClippingMasks(w,E),this.renderLayer(this,k,w,E)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<a.length;this.currentLayer++){const w=this.style._layers[a[this.currentLayer]],k=h[w.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(w))continue;const E=(w.type==="symbol"?v:y)[w.source];this._renderTileClippingMasks(w,m[w.source]),this.renderLayer(this,k,w,E)}if(this.options.showTileBoundaries){const w=function(k,E){let L=null;const F=Object.values(k._layers).flatMap(H=>H.source&&!H.isHidden(E)?[k.sourceCaches[H.source]]:[]),N=F.filter(H=>H.getSource().type==="vector"),Z=F.filter(H=>H.getSource().type!=="vector"),U=H=>{(!L||L.getSource().maxzoom<H.getSource().maxzoom)&&(L=H)};return N.forEach(H=>U(H)),L||Z.forEach(H=>U(H)),L}(this.style,this.transform.zoom);w&&function(k,E,L){for(let F=0;F<L.length;F++)mt(k,E,L[F])}(this,w,w.getVisibleCoordinates())}this.options.showPadding&&function(w){const k=w.transform.padding;fn(w,w.transform.height-(k.top||0),3,oo),fn(w,k.bottom||0,3,xs),aa(w,k.left||0,3,ao),aa(w,w.transform.width-(k.right||0),3,Ll);const E=w.transform.centerPoint;(function(L,F,N,Z){Rn(L,F-1,N-10,2,20,Z),Rn(L,F-10,N-1,20,2,Z)})(w,E.x,w.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 y=h.context,v=y.gl,w=Et.unblended,k=new ht(v.LEQUAL,ht.ReadWrite,[0,1]),E=m.getTerrainMesh(),L=m.sourceCache.getRenderableTiles(),F=h.useProgram("terrainDepth");y.bindFramebuffer.set(m.getFramebuffer("depth").framebuffer),y.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),y.clear({color:c.aN.transparent,depth:1});for(const N of L){const Z=m.getTerrainData(N.tileID),U={u_matrix:h.transform.calculatePosMatrix(N.tileID.toUnwrapped()),u_ele_delta:m.getMeshFrameDelta(h.transform.zoom)};F.draw(y,v.TRIANGLES,k,Vt.disabled,w,zt.backCCW,U,Z,"terrain",E.vertexBuffer,E.indexBuffer,E.segments)}y.bindFramebuffer.set(null),y.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain),function(h,m){const y=h.context,v=y.gl,w=Et.unblended,k=new ht(v.LEQUAL,ht.ReadWrite,[0,1]),E=m.getTerrainMesh(),L=m.getCoordsTexture(),F=m.sourceCache.getRenderableTiles(),N=h.useProgram("terrainCoords");y.bindFramebuffer.set(m.getFramebuffer("coords").framebuffer),y.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),y.clear({color:c.aN.transparent,depth:1}),m.coordsIndex=[];for(const Z of F){const U=m.getTerrainData(Z.tileID);y.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)};N.draw(y,v.TRIANGLES,k,Vt.disabled,w,zt.backCCW,H,U,"terrain",E.vertexBuffer,E.indexBuffer,E.segments),m.coordsIndex.push(Z.tileID.key)}y.bindFramebuffer.set(null),y.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,y,v,w){if(h.renderPass!=="translucent")return;const k=Vt.disabled,E=h.colorModeForRenderPass();(y._unevaluatedLayout.hasValue("text-variable-anchor")||y._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(L,F,N,Z,U,H,K,j,ee){const se=F.transform,ce=Us(),_e=U==="map",we=H==="map";for(const Le of L){const Be=Z.getTile(Le),Se=Be.getBucket(N);if(!Se||!Se.text||!Se.text.segments.get().length)continue;const Te=c.ah(Se.textSizeData,se.zoom),je=rt(Be,1,F.transform.zoom),tt=qr(Le.posMatrix,we,_e,F.transform,je),ke=N.layout.get("icon-text-fit")!=="none"&&Se.hasIconData();if(Te){const Ce=Math.pow(2,se.zoom-Be.tileID.overscaledZ),Qe=F.style.map.terrain?(st,ut)=>F.style.map.terrain.getElevation(Le,st,ut):null,Lt=ce.translatePosition(se,Be,K,j);ro(Se,_e,we,ee,se,tt,Le.posMatrix,Ce,Te,ke,ce,Lt,Le.toUnwrapped(),Qe)}}}(v,h,y,m,y.layout.get("text-rotation-alignment"),y.layout.get("text-pitch-alignment"),y.paint.get("text-translate"),y.paint.get("text-translate-anchor"),w),y.paint.get("icon-opacity").constantOr(1)!==0&&Wr(h,m,y,v,!1,y.paint.get("icon-translate"),y.paint.get("icon-translate-anchor"),y.layout.get("icon-rotation-alignment"),y.layout.get("icon-pitch-alignment"),y.layout.get("icon-keep-upright"),k,E),y.paint.get("text-opacity").constantOr(1)!==0&&Wr(h,m,y,v,!0,y.paint.get("text-translate"),y.paint.get("text-translate-anchor"),y.layout.get("text-rotation-alignment"),y.layout.get("text-pitch-alignment"),y.layout.get("text-keep-upright"),k,E),m.map.showCollisionBoxes&&(Dl(h,m,y,v,!0),Dl(h,m,y,v,!1))})(t,n,o,a,this.style.placement.variableOffsets);break;case"circle":(function(h,m,y,v){if(h.renderPass!=="translucent")return;const w=y.paint.get("circle-opacity"),k=y.paint.get("circle-stroke-width"),E=y.paint.get("circle-stroke-opacity"),L=!y.layout.get("circle-sort-key").isConstant();if(w.constantOr(1)===0&&(k.constantOr(1)===0||E.constantOr(1)===0))return;const F=h.context,N=F.gl,Z=h.depthModeForSublayer(0,ht.ReadOnly),U=Vt.disabled,H=h.colorModeForRenderPass(),K=[];for(let j=0;j<v.length;j++){const ee=v[j],se=m.getTile(ee),ce=se.getBucket(y);if(!ce)continue;const _e=ce.programConfigurations.get(y.id),we=h.useProgram("circle",_e),Le=ce.layoutVertexBuffer,Be=ce.indexBuffer,Se=h.style.map.terrain&&h.style.map.terrain.getTerrainData(ee),Te={programConfiguration:_e,program:we,layoutVertexBuffer:Le,indexBuffer:Be,uniformValues:fl(h,ee,se,y),terrainData:Se};if(L){const je=ce.segments.get();for(const tt of je)K.push({segments:new c.a0([tt]),sortKey:tt.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:se,layoutVertexBuffer:ce,indexBuffer:_e,uniformValues:we,terrainData:Le}=j.state;se.draw(F,N.TRIANGLES,Z,U,H,zt.disabled,we,Le,y.id,ce,_e,j.segments,y.paint,h.transform.zoom,ee)}})(t,n,o,a);break;case"heatmap":(function(h,m,y,v){if(y.paint.get("heatmap-opacity")!==0)if(h.renderPass==="offscreen"){const w=h.context,k=w.gl,E=Vt.disabled,L=new Et([k.ONE,k.ONE],c.aN.transparent,[!0,!0,!0,!0]);(function(F,N,Z){const U=F.gl;F.activeTexture.set(U.TEXTURE1),F.viewport.set([0,0,N.width/4,N.height/4]);let H=Z.heatmapFbo;if(H)U.bindTexture(U.TEXTURE_2D,H.colorAttachment.get()),F.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=F.createFramebuffer(N.width/4,N.height/4,!1,!1),function(j,ee,se,ce){var _e,we;const Le=j.gl,Be=(_e=j.HALF_FLOAT)!==null&&_e!==void 0?_e:Le.UNSIGNED_BYTE,Se=(we=j.RGBA16F)!==null&&we!==void 0?we:Le.RGBA;Le.texImage2D(Le.TEXTURE_2D,0,Se,ee.width/4,ee.height/4,0,Le.RGBA,Be,null),ce.colorAttachment.set(se)}(F,N,K,H)}})(w,h,y),w.clear({color:c.aN.transparent});for(let F=0;F<v.length;F++){const N=v[F];if(m.hasRenderableParent(N))continue;const Z=m.getTile(N),U=Z.getBucket(y);if(!U)continue;const H=U.programConfigurations.get(y.id),K=h.useProgram("heatmap",H),{zoom:j}=h.transform;K.draw(w,k.TRIANGLES,ht.disabled,E,L,zt.disabled,ji(N.posMatrix,Z,j,y.paint.get("heatmap-intensity")),null,y.id,U.layoutVertexBuffer,U.indexBuffer,U.segments,y.paint,h.transform.zoom,H)}w.viewport.set([0,0,h.width,h.height])}else h.renderPass==="translucent"&&(h.context.setColorMode(h.colorModeForRenderPass()),function(w,k){const E=w.context,L=E.gl,F=k.heatmapFbo;if(!F)return;E.activeTexture.set(L.TEXTURE0),L.bindTexture(L.TEXTURE_2D,F.colorAttachment.get()),E.activeTexture.set(L.TEXTURE1);let N=k.colorRampTexture;N||(N=k.colorRampTexture=new wt(E,k.colorRamp,L.RGBA)),N.bind(L.LINEAR,L.CLAMP_TO_EDGE),w.useProgram("heatmapTexture").draw(E,L.TRIANGLES,ht.disabled,Vt.disabled,w.colorModeForRenderPass(),zt.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")}})(w,k),null,k.id,w.viewportBuffer,w.quadTriangleIndexBuffer,w.viewportSegments,k.paint,w.transform.zoom)}(h,y))})(t,n,o,a);break;case"line":(function(h,m,y,v){if(h.renderPass!=="translucent")return;const w=y.paint.get("line-opacity"),k=y.paint.get("line-width");if(w.constantOr(1)===0||k.constantOr(1)===0)return;const E=h.depthModeForSublayer(0,ht.ReadOnly),L=h.colorModeForRenderPass(),F=y.paint.get("line-dasharray"),N=y.paint.get("line-pattern"),Z=N.constantOr(1),U=y.paint.get("line-gradient"),H=y.getCrossfadeParameters(),K=Z?"linePattern":F?"lineSDF":U?"lineGradient":"line",j=h.context,ee=j.gl;let se=!0;for(const ce of v){const _e=m.getTile(ce);if(Z&&!_e.patternsLoaded())continue;const we=_e.getBucket(y);if(!we)continue;const Le=we.programConfigurations.get(y.id),Be=h.context.program.get(),Se=h.useProgram(K,Le),Te=se||Se.program!==Be,je=h.style.map.terrain&&h.style.map.terrain.getTerrainData(ce),tt=N.constantOr(null);if(tt&&_e.imageAtlas){const Qe=_e.imageAtlas,Lt=Qe.patternPositions[tt.to.toString()],st=Qe.patternPositions[tt.from.toString()];Lt&&st&&Le.setConstantPatternPositions(Lt,st)}const ke=je?ce:null,Ce=Z?ml(h,_e,y,H,ke):F?gl(h,_e,y,F,H,ke):U?Xs(h,_e,y,we.lineClipsArray.length,ke):fs(h,_e,y,ke);if(Z)j.activeTexture.set(ee.TEXTURE0),_e.imageAtlasTexture.bind(ee.LINEAR,ee.CLAMP_TO_EDGE),Le.updatePaintBuffers(H);else if(F&&(Te||h.lineAtlas.dirty))j.activeTexture.set(ee.TEXTURE0),h.lineAtlas.bind(j);else if(U){const Qe=we.gradients[y.id];let Lt=Qe.texture;if(y.gradientVersion!==Qe.version){let st=256;if(y.stepInterpolant){const ut=m.getSource().maxzoom,Rt=ce.canonical.z===ut?Math.ceil(1<<h.transform.maxZoom-ce.canonical.z):1;st=c.ad(c.aV(we.maxLineLength/c.X*1024*Rt),256,j.maxTextureSize)}Qe.gradient=c.aW({expression:y.gradientExpression(),evaluationKey:"lineProgress",resolution:st,image:Qe.gradient||void 0,clips:we.lineClipsArray}),Qe.texture?Qe.texture.update(Qe.gradient):Qe.texture=new wt(j,Qe.gradient,ee.RGBA),Qe.version=y.gradientVersion,Lt=Qe.texture}j.activeTexture.set(ee.TEXTURE0),Lt.bind(y.stepInterpolant?ee.NEAREST:ee.LINEAR,ee.CLAMP_TO_EDGE)}Se.draw(j,ee.TRIANGLES,E,h.stencilModeForClipping(ce),L,zt.disabled,Ce,je,y.id,we.layoutVertexBuffer,we.indexBuffer,we.segments,y.paint,h.transform.zoom,Le,we.layoutVertexBuffer2),se=!1}})(t,n,o,a);break;case"fill":(function(h,m,y,v){const w=y.paint.get("fill-color"),k=y.paint.get("fill-opacity");if(k.constantOr(1)===0)return;const E=h.colorModeForRenderPass(),L=y.paint.get("fill-pattern"),F=h.opaquePassEnabledForLayer()&&!L.constantOr(1)&&w.constantOr(c.aN.transparent).a===1&&k.constantOr(0)===1?"opaque":"translucent";if(h.renderPass===F){const N=h.depthModeForSublayer(1,h.renderPass==="opaque"?ht.ReadWrite:ht.ReadOnly);sa(h,m,y,v,N,E,!1)}if(h.renderPass==="translucent"&&y.paint.get("fill-antialias")){const N=h.depthModeForSublayer(y.getPaintProperty("fill-outline-color")?2:0,ht.ReadOnly);sa(h,m,y,v,N,E,!0)}})(t,n,o,a);break;case"fill-extrusion":(function(h,m,y,v){const w=y.paint.get("fill-extrusion-opacity");if(w!==0&&h.renderPass==="translucent"){const k=new ht(h.context.gl.LEQUAL,ht.ReadWrite,h.depthRangeFor3D);if(w!==1||y.paint.get("fill-extrusion-pattern").constantOr(1))no(h,m,y,v,k,Vt.disabled,Et.disabled),no(h,m,y,v,k,h.stencilModeFor3D(),h.colorModeForRenderPass());else{const E=h.colorModeForRenderPass();no(h,m,y,v,k,Vt.disabled,E)}}})(t,n,o,a);break;case"hillshade":(function(h,m,y,v){if(h.renderPass!=="offscreen"&&h.renderPass!=="translucent")return;const w=h.context,k=h.depthModeForSublayer(0,ht.ReadOnly),E=h.colorModeForRenderPass(),[L,F]=h.renderPass==="translucent"?h.stencilConfigForOverlap(v):[{},v];for(const N of F){const Z=m.getTile(N);Z.needsHillshadePrepare!==void 0&&Z.needsHillshadePrepare&&h.renderPass==="offscreen"?pn(h,Z,y,k,Vt.disabled,E):h.renderPass==="translucent"&&oa(h,N,Z,y,k,L[N.overscaledZ],E)}w.viewport.set([0,0,h.width,h.height])})(t,n,o,a);break;case"raster":(function(h,m,y,v){if(h.renderPass!=="translucent"||y.paint.get("raster-opacity")===0||!v.length)return;const w=h.context,k=w.gl,E=m.getSource(),L=h.useProgram("raster"),F=h.colorModeForRenderPass(),[N,Z]=E instanceof Er?[{},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,y.paint.get("raster-opacity")===1?ht.ReadWrite:ht.ReadOnly,k.LESS),ee=m.getTile(K);ee.registerFadeDuration(y.paint.get("raster-fade-duration"));const se=m.findLoadedParent(K,0),ce=m.findLoadedSibling(K),_e=so(ee,se||ce||null,m,y,h.transform,h.style.map.terrain);let we,Le;const Be=y.paint.get("raster-resampling")==="nearest"?k.NEAREST:k.LINEAR;w.activeTexture.set(k.TEXTURE0),ee.texture.bind(Be,k.CLAMP_TO_EDGE,k.LINEAR_MIPMAP_NEAREST),w.activeTexture.set(k.TEXTURE1),se?(se.texture.bind(Be,k.CLAMP_TO_EDGE,k.LINEAR_MIPMAP_NEAREST),we=Math.pow(2,se.tileID.overscaledZ-ee.tileID.overscaledZ),Le=[ee.tileID.canonical.x*we%1,ee.tileID.canonical.y*we%1]):ee.texture.bind(Be,k.CLAMP_TO_EDGE,k.LINEAR_MIPMAP_NEAREST),ee.texture.useMipmap&&w.extTextureFilterAnisotropic&&h.transform.pitch>20&&k.texParameterf(k.TEXTURE_2D,w.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,w.extTextureFilterAnisotropicMax);const Se=h.style.map.terrain&&h.style.map.terrain.getTerrainData(K),Te=Se?K:null,je=Te?Te.posMatrix:h.transform.calculatePosMatrix(K.toUnwrapped(),H),tt=Uc(je,Le||[0,0],we||1,_e,y);E instanceof Er?L.draw(w,k.TRIANGLES,j,Vt.disabled,F,zt.disabled,tt,Se,y.id,E.boundsBuffer,h.quadTriangleIndexBuffer,E.boundsSegments):L.draw(w,k.TRIANGLES,j,N[K.overscaledZ],F,zt.disabled,tt,Se,y.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments)}})(t,n,o,a);break;case"background":(function(h,m,y,v){const w=y.paint.get("background-color"),k=y.paint.get("background-opacity");if(k===0)return;const E=h.context,L=E.gl,F=h.transform,N=F.tileSize,Z=y.paint.get("background-pattern");if(h.isPatternMissing(Z))return;const U=!Z&&w.a===1&&k===1&&h.opaquePassEnabledForLayer()?"opaque":"translucent";if(h.renderPass!==U)return;const H=Vt.disabled,K=h.depthModeForSublayer(0,U==="opaque"?ht.ReadWrite:ht.ReadOnly),j=h.colorModeForRenderPass(),ee=h.useProgram(Z?"backgroundPattern":"background"),se=v||F.coveringTiles({tileSize:N,terrain:h.style.map.terrain});Z&&(E.activeTexture.set(L.TEXTURE0),h.imageManager.bind(h.context));const ce=y.getCrossfadeParameters();for(const _e of se){const we=v?_e.posMatrix:h.transform.calculatePosMatrix(_e.toUnwrapped()),Le=Z?Go(we,k,h,Z,{tileID:_e,tileSize:N},ce):Js(we,k,w),Be=h.style.map.terrain&&h.style.map.terrain.getTerrainData(_e);ee.draw(E,L.TRIANGLES,K,H,j,zt.disabled,Le,Be,y.id,h.tileExtentBuffer,h.quadTriangleIndexBuffer,h.tileExtentSegments)}})(t,0,o,a);break;case"custom":(function(h,m,y){const v=h.context,w=y.implementation;if(h.renderPass==="offscreen"){const k=w.prerender;k&&(h.setCustomLayerDefaults(),v.setColorMode(h.colorModeForRenderPass()),k.call(w,v.gl,h.transform.customLayerMatrix()),v.setDirty(),h.setBaseState())}else if(h.renderPass==="translucent"){h.setCustomLayerDefaults(),v.setColorMode(h.colorModeForRenderPass()),v.setStencilMode(Vt.disabled);const k=w.renderingMode==="3d"?new ht(h.context.gl.LEQUAL,ht.ReadWrite,h.depthRangeFor3D):h.depthModeForSublayer(0,ht.ReadOnly);v.setDepthMode(k),w.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 w=Math.sin(m),k=Math.cos(m);o=[o[0]*k-o[1]*w,o[0]*w+o[1]*k]}const y=[h?o[0]:rt(n,o[0],this.transform.zoom),h?o[1]:rt(n,o[1],this.transform.zoom),0],v=new Float32Array(16);return c.J(v,t,y),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 Zs(this.context,Gr[t],n,Ks[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(y=>{const v=1/(y=c.ag([],y,t))[3]/n*a;return c.b1(y,y,[v,v,1/y[3],v])}),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(y=>{const v=function(L,F){var N=F[0],Z=F[1],U=F[2],H=N*N+Z*Z+U*U;return H>0&&(H=1/Math.sqrt(H)),L[0]=F[0]*H,L[1]=F[1]*H,L[2]=F[2]*H,L}([],function(L,F,N){var Z=F[0],U=F[1],H=F[2],K=N[0],j=N[1],ee=N[2];return L[0]=U*ee-H*j,L[1]=H*K-Z*ee,L[2]=Z*j-U*K,L}([],jt([],h[y[0]],h[y[1]]),jt([],h[y[2]],h[y[1]]))),w=-((k=v)[0]*(E=h[y[1]])[0]+k[1]*E[1]+k[2]*E[2]);var k,E;return v.concat(w)});return new mn(h,m)}}class lo{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=xt(this.min),a=xt(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 lo(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 y=0;y<n.length;y++)c.b2(h,n[y])>=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 y=0;y<t.points.length;y++){const v=t.points[y][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 co{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 co(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const la=85.051129;class ca{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 co,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const t=new ca(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],y=a[1],v=a[2],w=a[3],k=Math.sin(h),E=Math.cos(h);o[0]=m*E+v*k,o[1]=y*E+w*k,o[2]=m*-k+v*E,o[3]=y*-k+w*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)),y=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)),w=1;for(let k=y-w;k<=v+w;k++)k!==0&&n.push(new c.b4(k,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()),y=c.Z.fromLngLat(this.center),v=Math.pow(2,a),w=[v*m.x,v*m.y,0],k=[v*y.x,v*y.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 F=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,N=j=>({aabb:new lo([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(N(-j)),Z.push(N(j));for(Z.push(N(0));Z.length>0;){const j=Z.pop(),ee=j.x,se=j.y;let ce=j.fullyVisible;if(!ce){const Se=j.aabb.intersects(E);if(Se===0)continue;ce=Se===2}const _e=t.terrain?w:k,we=j.aabb.distanceX(_e),Le=j.aabb.distanceY(_e),Be=Math.max(Math.abs(we),Math.abs(Le));if(j.zoom===H||Be>F+(1<<H-j.zoom)-2&&j.zoom>=L){const Se=H-j.zoom,Te=w[0]-.5-(ee<<Se),je=w[1]-.5-(se<<Se);U.push({tileID:new c.S(j.zoom===H?K:j.zoom,j.wrap,j.zoom,ee,se),distanceSq:Fr([k[0]-.5-ee,k[1]-.5-se]),tileDistanceToCamera:Math.sqrt(Te*Te+je*je)})}else for(let Se=0;Se<4;Se++){const Te=(ee<<1)+Se%2,je=(se<<1)+(Se>>1),tt=j.zoom+1;let ke=j.aabb.quadrant(Se);if(t.terrain){const Ce=new c.S(tt,j.wrap,tt,Te,je),Qe=t.terrain.getMinMaxElevation(Ce),Lt=(n=Qe.minElevation)!==null&&n!==void 0?n:this.elevation,st=(o=Qe.maxElevation)!==null&&o!==void 0?o:this.elevation;ke=new lo([ke.min[0],ke.min[1],Lt],[ke.max[0],ke.max[1],st])}Z.push({aabb:ke,zoom:tt,x:Te,y:je,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,la);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,y=Math.cos(this._pitch)*this.cameraToCenterDistance/m/c.b5(1,a.lat),v=this.scaleZoom(y/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],y=o[1]/h,v=a[1]/m,w=o[2]/h,k=a[2]/m,E=w===k?0:(0-w)/(k-w);return new c.Z(c.z.number(o[0]/h,a[0]/m,E)/this.worldSize,c.z.number(y,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,la])}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,y=h,v=0,w=h,k=0,E=0;const{x:L,y:F}=this.size;if(this.latRange){const j=this.latRange;m=c.Q(j[1])*h,y=c.Q(j[0])*h,y-m<F&&(k=F/(y-m))}a&&(v=c.b3(c.O(a[0])*h,0,h),w=c.b3(c.O(a[1])*h,0,h),w<v&&(w+=h),w-v<L&&(E=L/(w-v)));const{x:N,y:Z}=this.project.call({worldSize:h},t);let U,H;const K=Math.max(E||0,k||0);if(K){const j=new c.P(E?(w+v)/2:N,k?(y+m)/2:Z);return o.center=this.unproject.call({worldSize:h},j).wrap(),o.zoom+=this.scaleZoom(K),o}if(this.latRange){const j=F/2;Z-j<m&&(H=m+j),Z+j>y&&(H=y-j)}if(a){const j=(v+w)/2;let ee=N;this._renderWorldCopies&&(ee=c.b3(N,j-h/2,j+h/2));const se=L/2;ee-se<v&&(U=v+se),ee+se>w&&(U=w-se)}if(U!==void 0||H!==void 0){const j=new c.P(U??N,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),y=h-m*this._pixelPerMeter/Math.cos(this._pitch),v=m<0?y:h,w=Math.PI/2+this._pitch,k=this._fov*(.5+t.y/this.height),E=Math.sin(k)*v/Math.sin(c.ad(Math.PI-w-k,.01,Math.PI-.01)),L=this.getHorizon(),F=2*Math.atan(L/this.cameraToCenterDistance)*(.5+t.y/(2*L)),N=Math.sin(F)*v/Math.sin(c.ad(Math.PI-w-F,.01,Math.PI-.01)),Z=Math.min(E,N);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,se=o-Math.round(o)+K*H+j*U,ce=new Float64Array(a);if(c.J(ce,ce,[ee>.5?ee-1:ee,se>.5?se-1:se,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 y of t)o=Math.min(o,y.x),a=Math.min(a,y.y),h=Math.max(h,y.x),m=Math.max(m,y.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 ho(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(...y)=>(o=!0,h=this,n=y,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=ho(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,y=Math.round(n.lat*h)/h,v=this._map.getBearing(),w=this._map.getPitch();let k="";if(k+=t?`/${m}/${y}/${o}`:`${o}/${y}/${m}`,(v||w)&&(k+="/"+Math.round(10*v)/10),w&&(k+=`/${Math.round(w)}`),this._hashName){const E=this._hashName;let L=!1;const F=window.location.hash.slice(1).split("&").map(N=>{const Z=N.split("=")[0];return Z===E?(L=!0,`${Z}=${k}`):N}).filter(N=>N);return L||F.push(`${E}=${k}`),`#${F.join("&")}`}return`#${k}`}}const gn={linearity:.3,easing:c.b8(0,0,.3,1)},ha=c.e({deceleration:2500,maxSpeed:1400},gn),ua=c.e({deceleration:20,maxSpeed:1400},gn),Fl=c.e({deceleration:1e3,maxSpeed:360},gn),uo=c.e({deceleration:1e3,maxSpeed:90},gn);class po{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=fo(n.pan.mag(),o,c.e({},ha,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=fo(n.zoom,o,ua);a.zoom=this._map.transform.zoom+h.amount,Bn(a,h)}if(n.bearing){const h=fo(n.bearing,o,Fl);a.bearing=this._map.transform.bearing+c.ad(h.amount,-179,179),Bn(a,h)}if(n.pitch){const h=fo(n.pitch,o,uo);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 fo(u,t,n){const{maxSpeed:o,linearity:a,deceleration:h}=n,m=c.ad(u*a/(t/1e3),-o,o),y=Math.abs(m)/(h*a);return{easing:n.easing,duration:1e3*y,amount:m*(y/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)),y=h.reduce((v,w,k,E)=>v.add(w.div(E.length)),new c.P(0,0));super(t,{points:h,point:y,lngLats:m,lngLat:n.unproject(y),originalEvent:o}),this._defaultPrevented=!1}}class da extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,o){super(t,{originalEvent:o}),this._defaultPrevented=!1}}class mo{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new da(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 pa{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 fa{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),y=Math.min(a.y,o.y),v=Math.max(a.y,o.y);ae.setTransform(this._box,`translate(${h}px,${y}px)`),this._box.style.width=m-h+"px",this._box.style.height=v-y+"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 ma{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 ga{constructor(t){this.singleTap=new ma(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 Ol{constructor(t){this._tr=new Fn(t),this._zoomIn=new ga({numTouches:1,numTaps:2}),this._zoomOut=new ga({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:y=>y.easeTo({duration:300,zoom:m.zoom+1,around:m.unproject(a)},{originalEvent:t})}):h?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.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 Dt{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 Ci{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 go{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()}},_a=({enable:u,clickTolerance:t,bearingDegreesPerPixelMoved:n=.8})=>{const o=new Ci({checkCorrectEvent:a=>ae.mouseButton(a)===0&&a.ctrlKey||ae.mouseButton(a)===2});return new Dt({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 Ci({checkCorrectEvent:a=>ae.mouseButton(a)===0&&a.ctrlKey||ae.mouseButton(a)===2});return new Dt({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 y=0;for(const w in a){const k=a[w],E=this._touches[w];E&&(h._add(k),m._add(k.sub(E)),y++,a[w]=k)}if(this._touches=a,this._shouldBePrevented(y)||!m.mag())return;const v=m.div(y);return this._sum._add(v),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(y),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),y=Ps(o,n,h);if(!m||!y)return;const v=this._aroundCenter?null:m.add(y).div(2);return this._move([m,y],v,t)}touchend(t,n,o){if(!this._firstTwoTouches)return;const[a,h]=this._firstTwoTouches,m=Ps(o,n,a),y=Ps(o,n,h);m&&y||(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 ya(u,t){return Math.log(u/t)/Math.LN2}class xa 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(ya(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:ya(this._distance,o),pinchAround:n}}}function va(u,t){return 180*u.angleWith(t)/Math.PI}class ba 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:va(this._vector,a),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,o=va(t,this._startVector);return Math.abs(o)<n}}function zr(u){return Math.abs(u.y)>Math.abs(u.x)}class wa 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,zr(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 zr(t)&&zr(n)&&m}}const Vl={panStep:100,bearingStep:15,pitchStep:10};class Sa{constructor(t){this._tr=new Fn(t);const n=Vl;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:y=>{const v=this._tr;y.easeTo({duration:300,easeId:"keyboardHandler",easing:Nl,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 Nl(u){return u*(2-u)}const Ta=4.000244140625;class Ia{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%Ta==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)>Ta?this._wheelZoomRate:this._defaultZoomRate;let w=2/(1+Math.exp(-Math.abs(this._delta*v)));this._delta<0&&w!==0&&(w=1/w);const k=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(k*w))),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 y=le.now()-this._lastWheelEventTime;if(this._type==="wheel"&&o&&a&&y){const v=Math.min(y/200,1),w=a(v);h=c.z.number(o,n,w),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,y=Math.sqrt(.0729-m*m);n=c.b8(m,y,.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 Pa{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 ks{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 jl{constructor(){this._tap=new ga({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 Xi{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 tr{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 ka{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 ir{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 Dr=u=>u.zoom||u.drag||u.pitch||u.rotate;class eh extends c.k{}function Ea(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta}class th{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,y={needsRenderFrame:!1},v={},w={},k=a.touches,E=k?this._getMapTouches(k):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(w,H,Z)?U.reset():U[h||a.type]&&(K=U[h||a.type](a,L,E),this.mergeHandlerResult(y,v,K,Z,m),K&&K.needsRenderFrame&&this._triggerRenderFrame()),(K||U.isActive())&&(w[Z]=U)}const F={};for(const Z in this._previousActiveHandlers)w[Z]||(F[Z]=m);this._previousActiveHandlers=w,(Object.keys(F).length||Ea(y))&&(this._changes.push([y,v,F]),this._triggerRenderFrame()),(Object.keys(w).length||Ea(y))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:N}=y;N&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],N(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new po(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 mo(n,t));const a=n.boxZoom=new fa(n,t);this._add("boxZoom",a),t.interactive&&t.boxZoom&&a.enable();const h=n.cooperativeGestures=new ir(n,t.cooperativeGestures);this._add("cooperativeGestures",h),t.cooperativeGestures&&h.enable();const m=new Ol(n),y=new ks(n);n.doubleClickZoom=new Pa(y,m),this._add("tapZoom",m),this._add("clickZoom",y),t.interactive&&t.doubleClickZoom&&n.doubleClickZoom.enable();const v=new jl;this._add("tapDragZoom",v);const w=n.touchPitch=new wa(n);this._add("touchPitch",w),t.interactive&&t.touchPitch&&n.touchPitch.enable(t.touchPitch);const k=_a(t),E=yn(t);n.dragRotate=new tr(t,k,E),this._add("mouseRotate",k,["mousePitch"]),this._add("mousePitch",E,["mouseRotate"]),t.interactive&&t.dragRotate&&n.dragRotate.enable();const L=(({enable:K,clickTolerance:j})=>{const ee=new Ci({checkCorrectEvent:se=>ae.mouseButton(se)===0&&!se.ctrlKey});return new Dt({clickTolerance:j,move:(se,ce)=>({around:ce,panDelta:ce.sub(se)}),activateOnStart:!0,moveStateManager:ee,enable:K,assignEvents:Ss})})(t),F=new Ts(t,n);n.dragPan=new Xi(o,L,F),this._add("mousePan",L),this._add("touchPan",F,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&n.dragPan.enable(t.dragPan);const N=new ba,Z=new xa;n.touchZoomRotate=new ka(o,Z,N,v),this._add("touchRotate",N,["touchPan","touchZoom"]),this._add("touchZoom",Z,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&n.touchZoomRotate.enable(t.touchZoomRotate);const U=n.scrollZoom=new Ia(n,()=>this._triggerRenderFrame());this._add("scrollZoom",U,["mousePan"]),t.interactive&&t.scrollZoom&&n.scrollZoom.enable(t.scrollZoom);const H=n.keyboard=new Sa(n);this._add("keyboard",H),t.interactive&&t.keyboard&&n.keyboard.enable(),this._add("blockableMapEvent",new pa(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!!Dr(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(!(Ea(t)||m&&this._terrainMovement))return this._fireEvents(n,o,!0);let{panDelta:y,zoomDelta:v,bearingDelta:w,pitchDelta:k,around:E,pinchAround:L}=t;L!==void 0&&(E=L),a._stop(!0),E=E||a.transform.centerPoint;const F=h.pointLocation(y?E.sub(y):E);w&&(h.bearing+=w),k&&(h.pitch+=k),v&&(h.zoom+=v),m?this._terrainMovement||!n.drag&&!n.zoom?n.drag&&this._terrainMovement?h.center=h.pointLocation(h.centerPoint.sub(y)):h.setLocationAtPoint(F,E):(this._terrainMovement=!0,this._map._elevationFreeze=!0,h.setLocationAtPoint(F,E)):h.setLocationAtPoint(F,E),a._applyUpdatedTransform(h),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,o,!0)}_fireEvents(t,n,o){const a=Dr(this._eventsInProgress),h=Dr(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 y={};let v;for(const E in this._eventsInProgress){const{handlerName:L,originalEvent:F}=this._eventsInProgress[E];this._handlersById[L].isActive()||(delete this._eventsInProgress[E],v=n[L]||F,y[`${E}end`]=v)}for(const E in y)this._fireEvent(E,y[E]);const w=Dr(this._eventsInProgress),k=(a||h)&&!w;if(k&&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&&k){this._updatingCamera=!0;const E=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),L=F=>F!==0&&-this._bearingSnap<F&&F<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 eh("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class ih 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,y=m.padding,v=new ue(t,n),w=m.project(v.getNorthWest()),k=m.project(v.getNorthEast()),E=m.project(v.getSouthEast()),L=m.project(v.getSouthWest()),F=c.ba(-o),N=w.rotate(F),Z=k.rotate(F),U=E.rotate(F),H=L.rotate(F),K=new c.P(Math.max(N.x,Z.x,H.x,U.x),Math.max(N.y,Z.y,H.y,U.y)),j=new c.P(Math.min(N.x,Z.x,H.x,U.x),Math.min(N.y,Z.y,H.y,U.y)),ee=K.sub(j),se=(m.width-(y.left+y.right+a.padding.left+a.padding.right))/ee.x,ce=(m.height-(y.top+y.bottom+a.padding.top+a.padding.bottom))/ee.y;if(ce<0||se<0)return void c.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const _e=Math.min(m.scaleZoom(m.scale*Math.min(se,ce)),a.maxZoom),we=c.P.convert(a.offset),Le=new c.P((a.padding.left-a.padding.right)/2,(a.padding.top-a.padding.bottom)/2).rotate(c.ba(o)),Be=we.add(Le).mult(m.scale/m.zoomScale(_e));return{center:m.unproject(w.add(E).div(2).sub(Be)),zoom:_e,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),y=m.x-h.x,v=m.y-h.y,w=m.z-h.z,k=Math.hypot(y,v,w);if(k===0)throw new Error("Can't calculate camera options with same From and To");const E=Math.hypot(y,v),L=this.transform.scaleZoom(this.transform.cameraToCenterDistance/k/this.transform.tileSize),F=180*Math.atan2(y,-v)/Math.PI;let N=180*Math.acos(E/k)/Math.PI;return N=w<0?90-N:90+N,{center:m.toLngLat(),zoom:L,pitch:N,bearing:F}}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,y=a.pitch,v=a.padding,w="bearing"in t?this._normalizeBearing(t.bearing,m):m,k="pitch"in t?+t.pitch:y,E="padding"in t?t.padding:a.padding,L=c.P.convert(t.offset);let F=a.centerPoint.add(L);const N=a.pointLocation(F),{center:Z,zoom:U}=a.getConstrained(c.N.convert(t.center||N),(o=t.zoom)!==null&&o!==void 0?o:h);this._normalizeCenter(Z,a);const H=a.project(N),K=a.project(Z).sub(H),j=a.zoomScale(U-h);let ee,se;t.around&&(ee=c.N.convert(t.around),se=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!==w,this._pitching=this._pitching||k!==y,this._padding=!a.isPaddingEqual(E),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,ce),this.terrain&&this._prepareElevation(Z),this._ease(_e=>{if(this._zooming&&(a.zoom=c.z.number(h,U,_e)),this._rotating&&(a.bearing=c.z.number(m,w,_e)),this._pitching&&(a.pitch=c.z.number(y,k,_e)),this._padding&&(a.interpolatePadding(v,E,_e),F=a.centerPoint.add(L)),this.terrain&&!t.freezeElevation&&this._updateElevation(_e),ee)a.setLocationAtPoint(ee,se);else{const we=a.zoomScale(a.zoom-h),Le=U>h?Math.min(2,j):Math.max(.5,j),Be=Math.pow(Le,1-_e),Se=a.unproject(H.add(K.mult(_e*Be)).mult(we));a.setLocationAtPoint(a.renderWorldCopies?Se.wrap():Se,F)}this._applyUpdatedTransform(a),this._fireMoveEvents(n)},_e=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n,_e)},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:y,pitch:v,bearing:w,elevation:k}=a(h);m&&(h.center=m),y!==void 0&&(h.zoom=y),v!==void 0&&(h.pitch=v),w!==void 0&&(h.bearing=w),k!==void 0&&(h.elevation=k),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 Ce=c.M(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Ce,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,y=a.pitch,v=a.padding,w="bearing"in t?this._normalizeBearing(t.bearing,m):m,k="pitch"in t?+t.pitch:y,E="padding"in t?t.padding:a.padding,L=c.P.convert(t.offset);let F=a.centerPoint.add(L);const N=a.pointLocation(F),{center:Z,zoom:U}=a.getConstrained(c.N.convert(t.center||N),(o=t.zoom)!==null&&o!==void 0?o:h);this._normalizeCenter(Z,a);const H=a.zoomScale(U-h),K=a.project(N),j=a.project(Z).sub(K);let ee=t.curve;const se=Math.max(a.width,a.height),ce=se/H,_e=j.mag();if("minZoom"in t){const Ce=c.ad(Math.min(t.minZoom,h,U),a.minZoom,a.maxZoom),Qe=se/a.zoomScale(Ce-h);ee=Math.sqrt(Qe/_e*2)}const we=ee*ee;function Le(Ce){const Qe=(ce*ce-se*se+(Ce?-1:1)*we*we*_e*_e)/(2*(Ce?ce:se)*we*_e);return Math.log(Math.sqrt(Qe*Qe+1)-Qe)}function Be(Ce){return(Math.exp(Ce)-Math.exp(-Ce))/2}function Se(Ce){return(Math.exp(Ce)+Math.exp(-Ce))/2}const Te=Le(!1);let je=function(Ce){return Se(Te)/Se(Te+ee*Ce)},tt=function(Ce){return se*((Se(Te)*(Be(Qe=Te+ee*Ce)/Se(Qe))-Be(Te))/we)/_e;var Qe},ke=(Le(!0)-Te)/ee;if(Math.abs(_e)<1e-6||!isFinite(ke)){if(Math.abs(se-ce)<1e-6)return this.easeTo(t,n);const Ce=ce<se?-1:1;ke=Math.abs(Math.log(ce/se))/ee,tt=()=>0,je=Qe=>Math.exp(Ce*ee*Qe)}return t.duration="duration"in t?+t.duration:1e3*ke/("screenSpeed"in t?+t.screenSpeed/ee:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=m!==w,this._pitching=k!==y,this._padding=!a.isPaddingEqual(E),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(Z),this._ease(Ce=>{const Qe=Ce*ke,Lt=1/je(Qe);a.zoom=Ce===1?U:h+a.scaleZoom(Lt),this._rotating&&(a.bearing=c.z.number(m,w,Ce)),this._pitching&&(a.pitch=c.z.number(y,k,Ce)),this._padding&&(a.interpolatePadding(v,E,Ce),F=a.centerPoint.add(L)),this.terrain&&!t.freezeElevation&&this._updateElevation(Ce);const st=Ce===1?Z:a.unproject(K.add(j.mult(tt(Qe))).mult(Lt));a.setLocationAtPoint(a.renderWorldCopies?st.wrap():st,F),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 Aa={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Vn{constructor(t=Aa){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 yr{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 Ul=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,y=a.canonical.x-(a.canonical.x>>m<<m),v=a.canonical.y-(a.canonical.y>>m<<m),w=c.X>>m;c.aQ(h.posMatrix,0,w,0,w,0,1),c.J(h.posMatrix,h.posMatrix,[-y*w,-v*w,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,y=t.canonical.x-(t.canonical.x>>m<<m),v=t.canonical.y-(t.canonical.y>>m<<m),w=c.X>>m;c.aQ(h.posMatrix,0,c.X,0,c.X,0,1),c.J(h.posMatrix,h.posMatrix,[y*w,v*w,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 $l{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),y=(h=m.tile)===null||h===void 0?void 0:h.dem;if(!y)return 0;const v=function(N,Z,U){var H=Z[0],K=Z[1];return N[0]=U[0]*H+U[4]*K+U[12],N[1]=U[1]*H+U[5]*K+U[13],N}([],[n/a*c.X,o/a*c.X],m.u_terrain_matrix),w=[v[0]*y.dim,v[1]*y.dim],k=Math.floor(w[0]),E=Math.floor(w[1]),L=w[0]-k,F=w[1]-E;return y.get(k,E)*(1-L)*(1-F)+y.get(k+1,E)*L*(1-F)+y.get(k,E+1)*(1-L)*F+y.get(k+1,E+1)*L*F}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),y=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,y*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 y=0;y<this._coordsTextureSize;y++,m+=4)n[m+0]=255&y,n[m+1]=255&h,n[m+2]=y>>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),y=Math.round(this.painter.height/devicePixelRatio);o.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),a.readPixels(h,y-m-1,1,1,a.RGBA,a.UNSIGNED_BYTE,n),o.bindFramebuffer.set(null);const v=n[0]+(n[2]>>4<<8),w=n[1]+((15&n[2])<<8),k=this.coordsIndex[255-n[3]],E=k&&this.sourceCache.getTileByID(k);if(!E)return null;const L=this._coordsTextureSize,F=(1<<E.tileID.canonical.z)*L;return new c.Z((E.tileID.canonical.x*L+v)/F+E.tileID.wrap,(E.tileID.canonical.y*L+w)/F,this.getElevation(E.tileID,v,w,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 y=n.length,v=y+2*(a+1);for(const E of[0,1])for(let L=0;L<=a;L++)for(const F of[0,1])n.emplaceBack(L*h,E*c.X,F);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(y+E,y+E+3,y+E+1),o.emplaceBack(y+E,y+E+2,y+E+3);const w=n.length,k=w+2*(a+1);for(const E of[0,1])for(let L=0;L<=a;L++)for(const F of[0,1])n.emplaceBack(E*c.X,L*h,F);for(let E=0;E<2*a;E+=2)o.emplaceBack(w+E,w+E+1,w+E+3),o.emplaceBack(w+E,w+E+3,w+E+2),o.emplaceBack(k+E,k+E+3,k+E+1),o.emplaceBack(k+E,k+E+2,k+E+3);return this._mesh=new Rl(t.createVertexBuffer(n,Ul.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,y=Math.floor(h/c.X),v=Math.floor(m/c.X);return{tileID:new c.S(n,0,n,y,v),mercatorX:h,mercatorY:m}}}class Es{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 xr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class ql{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new Es(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 y in m)this._coordsDescendingInv[o][y]||(this._coordsDescendingInv[o][y]=[]),this._coordsDescendingInv[o][y].push(m[y])}}this._coordsDescendingInvStr={};for(const o of t._order){const a=t._layers[o],h=a.source;if(xr[a.type]&&!this._coordsDescendingInvStr[h]){this._coordsDescendingInvStr[h]={};for(const m in this._coordsDescendingInv[h])this._coordsDescendingInvStr[h][m]=this._coordsDescendingInv[h][m].map(y=>y.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(xr[n]&&(this._prevType&&xr[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!a))return!0;if(xr[this._prevType]||xr[n]&&a){this._prevType=n;const h=this._stacks.length-1,m=this._stacks[h]||[];for(const y of this._renderableTiles){if(this.pool.isFull()&&(vs(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(y),y.rtt[h]){const w=this.pool.getObjectForId(y.rtt[h].id);if(w.stamp===y.rtt[h].stamp){this.pool.useObject(w);continue}}const v=this.pool.getOrCreateFreeObject();this.pool.useObject(v),this.pool.stampObject(v),y.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 w=0;w<m.length;w++){const k=o.style._layers[m[w]],E=k.source?this._coordsDescendingInv[k.source][y.tileID.key]:[y.tileID];o.context.viewport.set([0,0,v.fbo.width,v.fbo.height]),o._renderTileClippingMasks(k,E),o.renderLayer(o,o.style.sourceCaches[k.source],k,E),k.source&&(y.rttCoords[k.source]=this._coordsDescendingInvStr[k.source][y.tileID.key])}}return vs(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),xr[n]}return!1}}const De={"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"},Ma=ge,rh={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Aa,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},Zl=u=>{u.touchstart=u.dragStart,u.touchmoveWindow=u.dragMove,u.touchend=u.dragEnd},za={showCompass:!0,showZoom:!0,visualizePitch:!1};class Gl{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=_a({clickTolerance:a,enable:!0}),this.touchRotate=(({enable:m,clickTolerance:y,bearingDegreesPerPixelMoved:v=.8})=>{const w=new go;return new Dt({clickTolerance:y,move:(k,E)=>({bearingDelta:(E.x-k.x)*v}),moveStateManager:w,enable:m,assignEvents:Zl})})({clickTolerance:a,enable:!0}),this.map=t,o&&(this.mousePitch=yn({clickTolerance:h,enable:!0}),this.touchPitch=(({enable:m,clickTolerance:y,pitchDegreesPerPixelMoved:v=-.5})=>{const w=new go;return new Dt({clickTolerance:y,move:(k,E)=>({pitchDelta:(E.y-k.y)*v}),moveStateManager:w,enable:m,assignEvents:Zl})})({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 Xr;function Hl(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 Da={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 Da)o.remove(`maplibregl-${n}-anchor-${a}`);o.add(`maplibregl-${n}-anchor-${t}`)}class At 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?Hl(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,`${Da[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 y=ae.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(3.0, 29.0)"),y.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),y.appendChild(K)}const w=ae.createNS("http://www.w3.org/2000/svg","g");w.setAttributeNS(null,"fill",this._color);const k=ae.createNS("http://www.w3.org/2000/svg","path");k.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"),w.appendChild(k);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 F=ae.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"transform","translate(6.0, 7.0)"),F.setAttributeNS(null,"fill","#FFFFFF");const N=ae.createNS("http://www.w3.org/2000/svg","g");N.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"),N.appendChild(Z),N.appendChild(U),m.appendChild(y),m.appendChild(w),m.appendChild(E),m.appendChild(F),m.appendChild(N),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 y=-this._offset.y/a.transform._pixelPerMeter,v=Math.sin(a.getPitch()*Math.PI/180)*y,w=a.terrain.depthAtPoint(new c.P(this._pos.x,this._pos.y-this._offset.y)),k=a.transform.lngLatToCameraDepth(this._lngLat,m+v)-w>.006;!((o=this._popup)===null||o===void 0)&&o.isOpen()&&k&&this._popup.remove(),this._element.style.opacity=k?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 _o={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Nn=0,jn=!1;const Wl={maxWidth:100,unit:"metric"};function La(u,t,n){const o=n&&n.maxWidth||100,a=u._container.clientHeight/2,h=u.unproject([0,a]),m=u.unproject([o,a]),y=h.distanceTo(m);if(n&&n.unit==="imperial"){const v=3.2808*y;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,y/1852,u._getUIString("ScaleControl.NauticalMiles")):y>=1e3?As(t,o,y/1e3,u._getUIString("ScaleControl.Kilometers")):As(t,o,y,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 y=h/m;return y=y>=10?10:y>=5?5:y>=3?3:y>=2?2:y>=1?1:function(v){const w=Math.pow(10,Math.ceil(-Math.log(v)/Math.LN10));return Math.round(v*w)/w}(y),m*y}(n);u.style.width=t*(a/n)+"px",u.innerHTML=`${a} ${o}`}const vr={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},yo=["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=ge;T.AJAXError=c.bg,T.Evented=c.E,T.LngLat=c.N,T.MercatorCoordinate=c.Z,T.Point=c.P,T.addProtocol=c.bh,T.config=c.a,T.removeProtocol=c.bi,T.AttributionControl=Vn,T.BoxZoomHandler=fa,T.CanvasSource=Hi,T.CooperativeGesturesHandler=ir,T.DoubleClickZoomHandler=Pa,T.DragPanHandler=Xi,T.DragRotateHandler=tr,T.EdgeInsets=co,T.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()}},T.GeoJSONSource=ns,T.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 At({element:this._dotElement}),this._circleElement=ae.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new At({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({},_o,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(Xr!==void 0&&!t)return Xr;if(window.navigator.permissions===void 0)return Xr=!!window.navigator.geolocation,Xr;try{Xr=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Xr=!!window.navigator.geolocation}return Xr})}().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)}},T.Hash=bs,T.ImageSource=Er,T.KeyboardHandler=Sa,T.LngLatBounds=ue,T.LogoControl=yr,T.Map=class extends ih{constructor(u){c.be.mark(c.bf.create);const t=Object.assign(Object.assign({},rh),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 ca(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({},De),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=ze.addThrottleControl(()=>this.isMoving()),this._requestManager=new Pt(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=ho(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 th(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 yr,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 y=this.painter.context.gl;this._maxCanvasSize=[y.drawingBufferWidth,y.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 y in m.delegates)this.off(y,m.delegates[y]);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 qo(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 qo(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 $l(this.painter,t,u),this.painter.renderToTexture=new ql(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:y,textFitWidth:v,textFitHeight:w}=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:k,height:E,data:L}=t,F=t;return this.style.addImage(u,{data:new c.R({width:k,height:E},new Uint8Array(L)),pixelRatio:o,stretchX:h,stretchY:m,content:y,textFitWidth:v,textFitHeight:w,sdf:a,version:0,userImage:F}),F.onAdd&&F.onAdd(this,u),this}}{const{width:k,height:E,data:L}=le.getImageData(t);this.style.addImage(u,{data:new c.R({width:k,height:E},L),pixelRatio:o,stretchX:h,stretchY:m,content:y,textFitWidth:v,textFitHeight:w,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 y=!(t instanceof HTMLImageElement||c.b(t));return n.data.replace(m,y),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 ze.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 Bl(n,this.transform),ct.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()}),y=m.crossFadingFactor();y===1&&y===this._crossFadingFactor||(n=!0,this._crossFadingFactor=y),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),ze.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 Ma}getCameraTargetElevation(){return this.transform.elevation}},T.MapMouseEvent=Ti,T.MapTouchEvent=ws,T.MapWheelEvent=da,T.Marker=At,T.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({},za,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 Gl(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}},T.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 y of this.options.className.split(" "))this._container.classList.add(y);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?Hl(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 y=this._container.offsetWidth,v=this._container.offsetHeight;let w;w=o.y+h.bottom.y<v?["top"]:o.y>this._map.transform.height-v?["bottom"]:[],o.x<y/2?w.push("left"):o.x>this._map.transform.width-y/2&&w.push("right"),a=w.length===0?"bottom":w.join("-")}let m=o.add(h[a]);this.options.subpixelPositioning||(m=m.round()),ae.setTransform(this._container,`${Da[a]} translate(${m.x}px,${m.y}px)`),Jr(this._container,a,"popup")},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(vr),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(yo);u&&u.focus()}},T.RasterDEMTileSource=Ut,T.RasterTileSource=_t,T.ScaleControl=class{constructor(u){this._onMove=()=>{La(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,La(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Wl),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}},T.ScrollZoomHandler=Ia,T.Style=qo,T.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}},T.TwoFingersTouchPitchHandler=wa,T.TwoFingersTouchRotateHandler=ba,T.TwoFingersTouchZoomHandler=xa,T.TwoFingersTouchZoomRotateHandler=ka,T.VectorTileSource=rs,T.VideoSource=Cn,T.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)}),T.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()"))},T.getMaxParallelImageRequests=function(){return c.a.MAX_PARALLEL_IMAGE_REQUESTS},T.getRTLTextPluginStatus=function(){return fr().getRTLTextPluginStatus()},T.getVersion=function(){return Je},T.getWorkerCount=function(){return dr.workerCount},T.getWorkerUrl=function(){return c.a.WORKER_URL},T.importScriptInWorkers=function(u){return is().broadcast("IS",u)},T.prewarm=function(){on().acquire(Vr)},T.setMaxParallelImageRequests=function(u){c.a.MAX_PARALLEL_IMAGE_REQUESTS=u},T.setRTLTextPlugin=function(u,t){return fr().setRTLTextPlugin(u,t)},T.setWorkerCount=function(u){dr.workerCount=u},T.setWorkerUrl=function(u){c.a.WORKER_URL=u}});var X=P;return X})})(Gh);var kp=Gh.exports;const Fo=Pp(kp);function Ep(g){const b=[{type:"fill",minzoom:g.pointZoom||0,paint:{"fill-color":g.color||"#ccc","fill-outline-color":g.stroke||"#blue","fill-opacity":g.opacity||1}}];return g.pointZoom&&b.push({type:"circle",maxzoom:g.pointZoom,paint:{"circle-color":g.color||"#ccc","circle-stroke-color":g.stroke||"#ccc","circle-stroke-width":g.width||1,"circle-opacity":g.opacity||1}}),g.label&&b.push({type:"symbol",layout:{"text-field":["get",g.label],"text-font":["Open Sans Regular"],"text-size":12,"text-anchor":"center"},paint:{"text-color":"#000","text-halo-color":"#fff","text-halo-width":1.5}}),b}function Ap(g){const b=[{type:"line",paint:{"line-color":g.color||"#ccc","line-opacity":g.opacity||1}}];return g.label&&b.push({type:"symbol",layout:{"text-field":["get",g.label],"text-font":["Open Sans Regular"],"text-size":12,"symbol-placement":"line-center"},paint:{"text-color":"#000","text-halo-color":"#fff","text-halo-width":1.5}}),b}function Cp(g){const b=[{type:"circle",maxzoom:g.icon&&+g.iconZoom||22,paint:{"circle-radius":g.radius||6,"circle-stroke-color":g.stroke||"#ccc","circle-stroke-width":g.width||1,"circle-color":g.color||"blue","circle-opacity":g.opacity||1}}];return g!=null&&g.clusterZoom&&(b.push({type:"circle",filter:["has","point_count"],paint:{"circle-color":["step",["get","point_count"],"#51bbd6",100,"#f1f075",750,"#f28cb1"],"circle-radius":["step",["get","point_count"],20,100,30,750,40]}}),b.push({type:"symbol",filter:["has","point_count"],layout:{"text-field":["get","point_count"],"text-font":["Open Sans Regular"],"text-size":12}})),g.icon&&b.push({type:"symbol",minzoom:+g.iconZoom||16,layout:{"icon-image":g.icon,"icon-allow-overlap":!0}}),g.label&&b.push({type:"symbol",layout:{"text-field":["get",g.label],"text-font":["Open Sans Regular"],"text-size":12,"text-anchor":"top"},paint:{"text-color":"#000","text-halo-color":"#fff","text-halo-width":1.5}}),b}function Mp(g){if(!g)return null;const b=g.type||"point";return b==="polygon"?Ep(g):b==="line"?Ap(g):Cp(g)}const Hh=["#69D2E7","yellow","#FE4365","#125B9A","#41B3A2","#D7C3F1","#F1D3CE"],zp=["ma-star","ma-water","ma-swimming","fa-home","fa-search","fa-trash","fa-check"],Wh={};async function Xh(g,b,P="api"){const C=await fetch(`${P}/gis-layer/${g}/${b}`),{rows:B}=await C.json();return B}async function xc(g,b,P,C){if(!g)return null;const B=JSON.parse(JSON.stringify(g)),X=B.colorAttr?await Xh(b,B.colorAttr,C):null;X==null||X.forEach((c,ge)=>{var xe,ve;c.color=c.color||((xe=B.colorSet)==null?void 0:xe[c.id])||((ve=B.colorSet)==null?void 0:ve[ge])||Hh[ge%Hh.length],c.icon=B.icon?B.icon.split("+")[0]+"+"+c.color.replace("#","")+".png":null});const T=B.iconAttr?await Xh(b,B.iconAttr,C):null;if(T==null||T.forEach((c,ge)=>{var ct,Ue,Ke,Ve;const xe=c.icon||((ct=B.iconSet)==null?void 0:ct[c.id])||((Ue=B.iconPattern)==null?void 0:Ue.replace("{id}",c.id))||((Ke=B.iconSet)==null?void 0:Ke[ge])||(B.iconPrefix?null:zp[ge]);if(!xe)return;const ve=c.color||((Ve=B.color)==null?void 0:Ve.replace("#",""))||"red",[le="pin6",ae="m"]=B.icon?B.icon.split("-"):[];c.icon=B.iconPrefix||xe!=null&&xe.includes("/")?(B.iconPrefix||"")+xe:`${le}-${ae}-${xe}+${ve}.png`}),B.colorAttr&&X){const c=["match",["get",B.colorAttr]];X.filter(ge=>ge.id).forEach(ge=>{c.push(ge.id),c.push(ge.color)}),c.push(B.color||"gray"),B.color=c}if(B.icon&&B.iconAttr&&T){const c=["match",["get",B.iconAttr]];T.filter(ge=>ge.icon).forEach(({id:ge,icon:xe})=>{if(B.colorAttr&&X){c.push(ge);const ve=["match",["get",B.colorAttr]];X.forEach(le=>{ve.push(le.id);const ae=xe.split("+")[0]+"+"+le.color.replace("#","")+".png";ve.push(ae),Fs(ae,P,C)}),ve.push(B.icon),c.push(ve)}else c.push(ge),c.push(xe),Fs(xe,P,C)}),c.push((B.iconPrefix||"")+B.icon),Fs((B.iconPrefix||"")+B.icon,P,C),B.icon=c}else if(B.icon&&B.colorAttr&&X){const c=["match",["get",B.colorAttr]];X.forEach(ge=>{c.push(ge.id),c.push(ge.icon),Fs(ge.icon,P,C)}),c.push(B.icon),Fs(B.icon,P,C),B.icon=c}else B.icon&&await Fs(B.icon,P,C);return Dp({style:g,colors:X,icons:T,map:P,id:b}),Mp(B)}async function Fs(g="pin4-sm-mi-plumber+f45942.png",b=null,P){if(Wh[g])return null;Wh[g]=!0;const C=await(b==null?void 0:b.loadImage(g!=null&&g.startsWith("/")||g!=null&&g.includes("//")?g:`${P}/marker_icon/${g.replace(".png","")}.png`));b==null||b.addImage(g,C.data)}function Dp({style:g,colors:b,icons:P,map:C,id:B}){C.legend||Object.assign(C,{legend:{}}),window.map||(window.map=C),Object.assign(C.legend,{[B]:{icon:g.icon,colors:b,icons:P,color:g.color||"blue",type:g.type||"point"}})}const vc={data(){return{layerList:[],activeLayer:""}},computed:{interactiveSources(){return this.layerList.filter(g=>g==null?void 0:g.interactive).map(g=>g.id)}},methods:{moveLayer(g,b=this.map){b.getStyle().layers.forEach(P=>{P.id.match(g)&&b.moveLayer(P.id)})},async setVisible(g,b=!0,P=this.map){if(!g)return;const C=(g==null?void 0:g.id)||g,B=this.layerList.find(T=>T.id===g)||g;if(!(B!=null&&B.id))throw new Error("MixinError: Layer has no id");P.getStyle().layers.filter(T=>T.id.match(C)).forEach(T=>{P.setLayoutProperty(T.id,"visibility",b?"visible":"none")}),b&&await this.addLayer(B)},async addLayer(g,b=this==null?void 0:this.map){var B,X;const P=this.layerList.find(T=>T.id===g)||g;!this.map.getStyle()||this.map.getStyle().layers.find(T=>T.id===P.id)||(this.layerList.find(T=>T.id===P.id)||this.layerList.push(P),(P.service==="vtile"||P.service==="vector"||(B=P.url)!=null&&B.includes(".vmt"))&&this.addVtileLayer(P,b),P.service==="geojson"&&this.addGeoJsonLayer(P,b),((X=P.url)!=null&&X.includes(".png")||["tms","raster"].includes(P.service))&&await this.addRasterLayer(P,b))},async addRasterLayer(g,b=this==null?void 0:this.map){var P;b.getSource(g.id)||(typeof g.bounds=="string"&&Object.assign(g,{bounds:g.bounds.split(",")}),await b.addSource(g.id,{type:"raster",tiles:[(P=g==null?void 0:g.url)!=null&&P.startsWith("http")?g==null?void 0:g.url:`${this.prefix?g==null?void 0:g.url.replace(/(\/api[^\/]*)/,this.prefix):g==null?void 0:g.url}${g!=null&&g.url.includes("?")?"&":"?"}dt=${new Date().toISOString().split("T")[0]}`],tileSize:256,...Array.isArray(g.bounds)&&g.bounds.length===4?{bounds:g.bounds}:{},...g!=null&&g.scheme?{scheme:g==null?void 0:g.scheme}:{}}),await b.addLayer({id:g.id,type:"raster",source:g.id,minzoom:0,maxzoom:(g==null?void 0:g.maxzoom)||22}))},async updateStyle(g,b=this==null?void 0:this.map){const P=g.id;b.getStyle().layers.forEach(async B=>{B.source===P&&b.getLayer(B.id)&&await b.removeLayer(B.id)}),(await xc(g.style,g.source||g.id,b,this.prefix)||g.layers||[]).forEach((B,X)=>{const T={...B,id:`${g.id}-${X}`,source:g.id,"source-layer":B["source-layer"]||g.source||g.id,maxzoom:+B.maxzoom||24,minzoom:+B.minzoom||0};b.addLayer(T)})},async addVtileLayer(g,b=this==null?void 0:this.map){var X;const P=["props","pointZoom","clusterZoom"].filter(T=>g[T]).map(T=>`&${T}=${g[T]}`),C={type:"vector",tiles:[`${(X=g==null?void 0:g.url)!=null&&X.startsWith("http")?"":window.location.origin}${g==null?void 0:g.url}${P}`],minzoom:g.minzoom||5,maxzoom:g.maxzoom||24};b.addSource(g.id,C),(g.layers||await xc(g.style,g.source||g.id,b,this.prefix)||[]).forEach((T,c)=>{const ge={...T,id:`${g.id}-${c}`,source:g.id,"source-layer":T["source-layer"]||g.source||g.id,maxzoom:+T.maxzoom||24,minzoom:+T.minzoom||0};b.addLayer(ge)})},async addGeoJsonLayer(g,b=this.map){var B;const P=g.data||((B=g==null?void 0:g.url)!=null&&B.startsWith("http")?"":window.location.origin)+g.url;b.addSource(g.id,{type:"geojson",data:P}),(await xc(g.style,P.source||P.id,b,this.prefix)||g.layers||[]).forEach(X=>{const T={...X,source:g.id,id:X.id||g.id,maxzoom:+X.maxzoom||24,minzoom:+X.minzoom||0,type:X.type||"circle"};b.addLayer(T)})},setLayerData(g,b){this.layerList=this.layerList.map(P=>P.id===g?{...P,...b}:P)},async removeLayer(g,b=this.map){b.getSource(g)&&(await b.getStyle().layers.forEach(async P=>{P.source===g&&await b.removeLayer(P.id)}),b.getSource(g)&&await b.removeSource(g))},async setFilter(g,b){const P=this.layerList.find(B=>B.id===g);await(await this.map.getSource(g)).setTiles([`${window.location.origin}${P.url}${P.url.includes("?")?"&":"?"}filter=${b}${P.props?`&props=${P.props}`:""}`])},async changeBaseLayer(g){g!==this.activeLayer&&(this.activeLayer&&this.map.setLayoutProperty(this.activeLayer,"visibility","none"),await this.setVisible(this.activeLayer,!1),await this.setVisible(g,!0),this.map.getStyle().layers.forEach(b=>{b.source!==g&&b.type!=="background"&&this.map.moveLayer(b.id)}),this.activeLayer=g)},async refreshLayer(g,b=this.map){await b.getStyle().layers.forEach(P=>{P.source===g&&b.removeLayer(P.id)}),b.getSource(g)&&await b.removeSource(g),this.setVisible(g)}}},nn=(g,b)=>{const P=g.__vccOpts||g;for(const[C,B]of b)P[C]=B;return P},Lp={},Rp={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=[re.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 Fp(g,b){return re.openBlock(),re.createElementBlock("svg",Rp,Bp)}const Op=nn(Lp,[["render",Fp]]);function Jh(g,b){return function(){return g.apply(b,arguments)}}const{toString:Vp}=Object.prototype,{getPrototypeOf:bc}=Object,rl=(g=>b=>{const P=Vp.call(b);return g[P]||(g[P]=P.slice(8,-1).toLowerCase())})(Object.create(null)),Sr=g=>(g=g.toLowerCase(),b=>rl(b)===g),nl=g=>b=>typeof b===g,{isArray:Os}=Array,Oo=nl("undefined");function Np(g){return g!==null&&!Oo(g)&&g.constructor!==null&&!Oo(g.constructor)&&Ki(g.constructor.isBuffer)&&g.constructor.isBuffer(g)}const Kh=Sr("ArrayBuffer");function jp(g){let b;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?b=ArrayBuffer.isView(g):b=g&&g.buffer&&Kh(g.buffer),b}const Up=nl("string"),Ki=nl("function"),Yh=nl("number"),sl=g=>g!==null&&typeof g=="object",$p=g=>g===!0||g===!1,ol=g=>{if(rl(g)!=="object")return!1;const b=bc(g);return(b===null||b===Object.prototype||Object.getPrototypeOf(b)===null)&&!(Symbol.toStringTag in g)&&!(Symbol.iterator in g)},qp=Sr("Date"),Zp=Sr("File"),Gp=Sr("Blob"),Hp=Sr("FileList"),Wp=g=>sl(g)&&Ki(g.pipe),Xp=g=>{let b;return g&&(typeof FormData=="function"&&g instanceof FormData||Ki(g.append)&&((b=rl(g))==="formdata"||b==="object"&&Ki(g.toString)&&g.toString()==="[object FormData]"))},Jp=Sr("URLSearchParams"),[Kp,Yp,Qp,ef]=["ReadableStream","Request","Response","Headers"].map(Sr),tf=g=>g.trim?g.trim():g.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Vo(g,b,{allOwnKeys:P=!1}={}){if(g===null||typeof g>"u")return;let C,B;if(typeof g!="object"&&(g=[g]),Os(g))for(C=0,B=g.length;C<B;C++)b.call(null,g[C],C,g);else{const X=P?Object.getOwnPropertyNames(g):Object.keys(g),T=X.length;let c;for(C=0;C<T;C++)c=X[C],b.call(null,g[c],c,g)}}function Qh(g,b){b=b.toLowerCase();const P=Object.keys(g);let C=P.length,B;for(;C-- >0;)if(B=P[C],b===B.toLowerCase())return B;return null}const Qn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,eu=g=>!Oo(g)&&g!==Qn;function wc(){const{caseless:g}=eu(this)&&this||{},b={},P=(C,B)=>{const X=g&&Qh(b,B)||B;ol(b[X])&&ol(C)?b[X]=wc(b[X],C):ol(C)?b[X]=wc({},C):Os(C)?b[X]=C.slice():b[X]=C};for(let C=0,B=arguments.length;C<B;C++)arguments[C]&&Vo(arguments[C],P);return b}const rf=(g,b,P,{allOwnKeys:C}={})=>(Vo(b,(B,X)=>{P&&Ki(B)?g[X]=Jh(B,P):g[X]=B},{allOwnKeys:C}),g),nf=g=>(g.charCodeAt(0)===65279&&(g=g.slice(1)),g),sf=(g,b,P,C)=>{g.prototype=Object.create(b.prototype,C),g.prototype.constructor=g,Object.defineProperty(g,"super",{value:b.prototype}),P&&Object.assign(g.prototype,P)},of=(g,b,P,C)=>{let B,X,T;const c={};if(b=b||{},g==null)return b;do{for(B=Object.getOwnPropertyNames(g),X=B.length;X-- >0;)T=B[X],(!C||C(T,g,b))&&!c[T]&&(b[T]=g[T],c[T]=!0);g=P!==!1&&bc(g)}while(g&&(!P||P(g,b))&&g!==Object.prototype);return b},af=(g,b,P)=>{g=String(g),(P===void 0||P>g.length)&&(P=g.length),P-=b.length;const C=g.indexOf(b,P);return C!==-1&&C===P},lf=g=>{if(!g)return null;if(Os(g))return g;let b=g.length;if(!Yh(b))return null;const P=new Array(b);for(;b-- >0;)P[b]=g[b];return P},cf=(g=>b=>g&&b instanceof g)(typeof Uint8Array<"u"&&bc(Uint8Array)),hf=(g,b)=>{const C=(g&&g[Symbol.iterator]).call(g);let B;for(;(B=C.next())&&!B.done;){const X=B.value;b.call(g,X[0],X[1])}},uf=(g,b)=>{let P;const C=[];for(;(P=g.exec(b))!==null;)C.push(P);return C},df=Sr("HTMLFormElement"),pf=g=>g.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(P,C,B){return C.toUpperCase()+B}),tu=(({hasOwnProperty:g})=>(b,P)=>g.call(b,P))(Object.prototype),ff=Sr("RegExp"),iu=(g,b)=>{const P=Object.getOwnPropertyDescriptors(g),C={};Vo(P,(B,X)=>{let T;(T=b(B,X,g))!==!1&&(C[X]=T||B)}),Object.defineProperties(g,C)},mf=g=>{iu(g,(b,P)=>{if(Ki(g)&&["arguments","caller","callee"].indexOf(P)!==-1)return!1;const C=g[P];if(Ki(C)){if(b.enumerable=!1,"writable"in b){b.writable=!1;return}b.set||(b.set=()=>{throw Error("Can not rewrite read-only method '"+P+"'")})}})},gf=(g,b)=>{const P={},C=B=>{B.forEach(X=>{P[X]=!0})};return Os(g)?C(g):C(String(g).split(b)),P},_f=()=>{},yf=(g,b)=>g!=null&&Number.isFinite(g=+g)?g:b,Sc="abcdefghijklmnopqrstuvwxyz",ru="0123456789",nu={DIGIT:ru,ALPHA:Sc,ALPHA_DIGIT:Sc+Sc.toUpperCase()+ru},xf=(g=16,b=nu.ALPHA_DIGIT)=>{let P="";const{length:C}=b;for(;g--;)P+=b[Math.random()*C|0];return P};function vf(g){return!!(g&&Ki(g.append)&&g[Symbol.toStringTag]==="FormData"&&g[Symbol.iterator])}const bf=g=>{const b=new Array(10),P=(C,B)=>{if(sl(C)){if(b.indexOf(C)>=0)return;if(!("toJSON"in C)){b[B]=C;const X=Os(C)?[]:{};return Vo(C,(T,c)=>{const ge=P(T,B+1);!Oo(ge)&&(X[c]=ge)}),b[B]=void 0,X}}return C};return P(g,0)},wf=Sr("AsyncFunction"),Sf=g=>g&&(sl(g)||Ki(g))&&Ki(g.then)&&Ki(g.catch),su=((g,b)=>g?setImmediate:b?((P,C)=>(Qn.addEventListener("message",({source:B,data:X})=>{B===Qn&&X===P&&C.length&&C.shift()()},!1),B=>{C.push(B),Qn.postMessage(P,"*")}))(`axios@${Math.random()}`,[]):P=>setTimeout(P))(typeof setImmediate=="function",Ki(Qn.postMessage)),Tf=typeof queueMicrotask<"u"?queueMicrotask.bind(Qn):typeof process<"u"&&process.nextTick||su,fe={isArray:Os,isArrayBuffer:Kh,isBuffer:Np,isFormData:Xp,isArrayBufferView:jp,isString:Up,isNumber:Yh,isBoolean:$p,isObject:sl,isPlainObject:ol,isReadableStream:Kp,isRequest:Yp,isResponse:Qp,isHeaders:ef,isUndefined:Oo,isDate:qp,isFile:Zp,isBlob:Gp,isRegExp:ff,isFunction:Ki,isStream:Wp,isURLSearchParams:Jp,isTypedArray:cf,isFileList:Hp,forEach:Vo,merge:wc,extend:rf,trim:tf,stripBOM:nf,inherits:sf,toFlatObject:of,kindOf:rl,kindOfTest:Sr,endsWith:af,toArray:lf,forEachEntry:hf,matchAll:uf,isHTMLForm:df,hasOwnProperty:tu,hasOwnProp:tu,reduceDescriptors:iu,freezeMethods:mf,toObjectSet:gf,toCamelCase:pf,noop:_f,toFiniteNumber:yf,findKey:Qh,global:Qn,isContextDefined:eu,ALPHABET:nu,generateString:xf,isSpecCompliantForm:vf,toJSONObject:bf,isAsyncFn:wf,isThenable:Sf,setImmediate:su,asap:Tf};function lt(g,b,P,C,B){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=g,this.name="AxiosError",b&&(this.code=b),P&&(this.config=P),C&&(this.request=C),B&&(this.response=B)}fe.inherits(lt,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 ou=lt.prototype,au={};["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(g=>{au[g]={value:g}}),Object.defineProperties(lt,au),Object.defineProperty(ou,"isAxiosError",{value:!0}),lt.from=(g,b,P,C,B,X)=>{const T=Object.create(ou);return fe.toFlatObject(g,T,function(ge){return ge!==Error.prototype},c=>c!=="isAxiosError"),lt.call(T,g.message,b,P,C,B),T.cause=g,T.name=g.name,X&&Object.assign(T,X),T};const If=null;function Tc(g){return fe.isPlainObject(g)||fe.isArray(g)}function lu(g){return fe.endsWith(g,"[]")?g.slice(0,-2):g}function cu(g,b,P){return g?g.concat(b).map(function(B,X){return B=lu(B),!P&&X?"["+B+"]":B}).join(P?".":""):b}function Pf(g){return fe.isArray(g)&&!g.some(Tc)}const kf=fe.toFlatObject(fe,{},null,function(b){return/^is[A-Z]/.test(b)});function al(g,b,P){if(!fe.isObject(g))throw new TypeError("target must be an object");b=b||new FormData,P=fe.toFlatObject(P,{metaTokens:!0,dots:!1,indexes:!1},!1,function(Ke,Ve){return!fe.isUndefined(Ve[Ke])});const C=P.metaTokens,B=P.visitor||ve,X=P.dots,T=P.indexes,ge=(P.Blob||typeof Blob<"u"&&Blob)&&fe.isSpecCompliantForm(b);if(!fe.isFunction(B))throw new TypeError("visitor must be a function");function xe(Ue){if(Ue===null)return"";if(fe.isDate(Ue))return Ue.toISOString();if(!ge&&fe.isBlob(Ue))throw new lt("Blob is not supported. Use a Buffer instead.");return fe.isArrayBuffer(Ue)||fe.isTypedArray(Ue)?ge&&typeof Blob=="function"?new Blob([Ue]):Buffer.from(Ue):Ue}function ve(Ue,Ke,Ve){let pt=Ue;if(Ue&&!Ve&&typeof Ue=="object"){if(fe.endsWith(Ke,"{}"))Ke=C?Ke:Ke.slice(0,-2),Ue=JSON.stringify(Ue);else if(fe.isArray(Ue)&&Pf(Ue)||(fe.isFileList(Ue)||fe.endsWith(Ke,"[]"))&&(pt=fe.toArray(Ue)))return Ke=lu(Ke),pt.forEach(function(ze,Pt){!(fe.isUndefined(ze)||ze===null)&&b.append(T===!0?cu([Ke],Pt,X):T===null?Ke:Ke+"[]",xe(ze))}),!1}return Tc(Ue)?!0:(b.append(cu(Ve,Ke,X),xe(Ue)),!1)}const le=[],ae=Object.assign(kf,{defaultVisitor:ve,convertValue:xe,isVisitable:Tc});function ct(Ue,Ke){if(!fe.isUndefined(Ue)){if(le.indexOf(Ue)!==-1)throw Error("Circular reference detected in "+Ke.join("."));le.push(Ue),fe.forEach(Ue,function(pt,Mt){(!(fe.isUndefined(pt)||pt===null)&&B.call(b,pt,fe.isString(Mt)?Mt.trim():Mt,Ke,ae))===!0&&ct(pt,Ke?Ke.concat(Mt):[Mt])}),le.pop()}}if(!fe.isObject(g))throw new TypeError("data must be an object");return ct(g),b}function hu(g){const b={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(g).replace(/[!'()~]|%20|%00/g,function(C){return b[C]})}function Ic(g,b){this._pairs=[],g&&al(g,this,b)}const uu=Ic.prototype;uu.append=function(b,P){this._pairs.push([b,P])},uu.toString=function(b){const P=b?function(C){return b.call(this,C,hu)}:hu;return this._pairs.map(function(B){return P(B[0])+"="+P(B[1])},"").join("&")};function Ef(g){return encodeURIComponent(g).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function du(g,b,P){if(!b)return g;const C=P&&P.encode||Ef,B=P&&P.serialize;let X;if(B?X=B(b,P):X=fe.isURLSearchParams(b)?b.toString():new Ic(b,P).toString(C),X){const T=g.indexOf("#");T!==-1&&(g=g.slice(0,T)),g+=(g.indexOf("?")===-1?"?":"&")+X}return g}class pu{constructor(){this.handlers=[]}use(b,P,C){return this.handlers.push({fulfilled:b,rejected:P,synchronous:C?C.synchronous:!1,runWhen:C?C.runWhen:null}),this.handlers.length-1}eject(b){this.handlers[b]&&(this.handlers[b]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(b){fe.forEach(this.handlers,function(C){C!==null&&b(C)})}}const fu={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Af={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Ic,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Pc=typeof window<"u"&&typeof document<"u",Cf=(g=>Pc&&["ReactNative","NativeScript","NS"].indexOf(g)<0)(typeof navigator<"u"&&navigator.product),Mf=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",zf=Pc&&window.location.href||"http://localhost",Tr={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Pc,hasStandardBrowserEnv:Cf,hasStandardBrowserWebWorkerEnv:Mf,origin:zf},Symbol.toStringTag,{value:"Module"})),...Af};function Df(g,b){return al(g,new Tr.classes.URLSearchParams,Object.assign({visitor:function(P,C,B,X){return Tr.isNode&&fe.isBuffer(P)?(this.append(C,P.toString("base64")),!1):X.defaultVisitor.apply(this,arguments)}},b))}function Lf(g){return fe.matchAll(/\w+|\[(\w*)]/g,g).map(b=>b[0]==="[]"?"":b[1]||b[0])}function Rf(g){const b={},P=Object.keys(g);let C;const B=P.length;let X;for(C=0;C<B;C++)X=P[C],b[X]=g[X];return b}function mu(g){function b(P,C,B,X){let T=P[X++];if(T==="__proto__")return!0;const c=Number.isFinite(+T),ge=X>=P.length;return T=!T&&fe.isArray(B)?B.length:T,ge?(fe.hasOwnProp(B,T)?B[T]=[B[T],C]:B[T]=C,!c):((!B[T]||!fe.isObject(B[T]))&&(B[T]=[]),b(P,C,B[T],X)&&fe.isArray(B[T])&&(B[T]=Rf(B[T])),!c)}if(fe.isFormData(g)&&fe.isFunction(g.entries)){const P={};return fe.forEachEntry(g,(C,B)=>{b(Lf(C),B,P,0)}),P}return null}function Bf(g,b,P){if(fe.isString(g))try{return(b||JSON.parse)(g),fe.trim(g)}catch(C){if(C.name!=="SyntaxError")throw C}return(P||JSON.stringify)(g)}const No={transitional:fu,adapter:["xhr","http","fetch"],transformRequest:[function(b,P){const C=P.getContentType()||"",B=C.indexOf("application/json")>-1,X=fe.isObject(b);if(X&&fe.isHTMLForm(b)&&(b=new FormData(b)),fe.isFormData(b))return B?JSON.stringify(mu(b)):b;if(fe.isArrayBuffer(b)||fe.isBuffer(b)||fe.isStream(b)||fe.isFile(b)||fe.isBlob(b)||fe.isReadableStream(b))return b;if(fe.isArrayBufferView(b))return b.buffer;if(fe.isURLSearchParams(b))return P.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),b.toString();let c;if(X){if(C.indexOf("application/x-www-form-urlencoded")>-1)return Df(b,this.formSerializer).toString();if((c=fe.isFileList(b))||C.indexOf("multipart/form-data")>-1){const ge=this.env&&this.env.FormData;return al(c?{"files[]":b}:b,ge&&new ge,this.formSerializer)}}return X||B?(P.setContentType("application/json",!1),Bf(b)):b}],transformResponse:[function(b){const P=this.transitional||No.transitional,C=P&&P.forcedJSONParsing,B=this.responseType==="json";if(fe.isResponse(b)||fe.isReadableStream(b))return b;if(b&&fe.isString(b)&&(C&&!this.responseType||B)){const T=!(P&&P.silentJSONParsing)&&B;try{return JSON.parse(b)}catch(c){if(T)throw c.name==="SyntaxError"?lt.from(c,lt.ERR_BAD_RESPONSE,this,null,this.response):c}}return b}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Tr.classes.FormData,Blob:Tr.classes.Blob},validateStatus:function(b){return b>=200&&b<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};fe.forEach(["delete","get","head","post","put","patch"],g=>{No.headers[g]={}});const Ff=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"]),Of=g=>{const b={};let P,C,B;return g&&g.split(`
|
581
|
-
`).forEach(function(T){B=T.indexOf(":"),P=T.substring(0,B).trim().toLowerCase(),C=T.substring(B+1).trim(),!(!P||b[P]&&
|
582
|
-
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(b){return b instanceof this?b:new this(b)}static concat(b,...P){const C=new this(b);return P.forEach(B=>C.set(B)),C}static accessor(b){const C=(this[gu]=this[gu]={accessors:{}}).accessors,B=this.prototype;function X(T){const c=jo(T);C[c]||(Uf(B,T),C[c]=!0)}return fe.isArray(b)?b.forEach(X):X(b),this}}Gi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),fe.reduceDescriptors(Gi.prototype,({value:g},b)=>{let P=b[0].toUpperCase()+b.slice(1);return{get:()=>g,set(C){this[P]=C}}}),fe.freezeMethods(Gi);function Ec(g,b){const P=this||No,C=b||P,B=Gi.from(C.headers);let X=C.data;return fe.forEach(g,function(c){X=c.call(P,X,B.normalize(),b?b.status:void 0)}),B.normalize(),X}function _u(g){return!!(g&&g.__CANCEL__)}function Vs(g,b,P){lt.call(this,g??"canceled",lt.ERR_CANCELED,b,P),this.name="CanceledError"}fe.inherits(Vs,lt,{__CANCEL__:!0});function yu(g,b,P){const C=P.config.validateStatus;!P.status||!C||C(P.status)?g(P):b(new lt("Request failed with status code "+P.status,[lt.ERR_BAD_REQUEST,lt.ERR_BAD_RESPONSE][Math.floor(P.status/100)-4],P.config,P.request,P))}function $f(g){const b=/^([-+\w]{1,25})(:?\/\/|:)/.exec(g);return b&&b[1]||""}function qf(g,b){g=g||10;const P=new Array(g),C=new Array(g);let B=0,X=0,T;return b=b!==void 0?b:1e3,function(ge){const xe=Date.now(),ve=C[X];T||(T=xe),P[B]=ge,C[B]=xe;let le=X,ae=0;for(;le!==B;)ae+=P[le++],le=le%g;if(B=(B+1)%g,B===X&&(X=(X+1)%g),xe-T<b)return;const ct=ve&&xe-ve;return ct?Math.round(ae*1e3/ct):void 0}}function Zf(g,b){let P=0,C=1e3/b,B,X;const T=(xe,ve=Date.now())=>{P=ve,B=null,X&&(clearTimeout(X),X=null),g.apply(null,xe)};return[(...xe)=>{const ve=Date.now(),le=ve-P;le>=C?T(xe,ve):(B=xe,X||(X=setTimeout(()=>{X=null,T(B)},C-le)))},()=>B&&T(B)]}const cl=(g,b,P=3)=>{let C=0;const B=qf(50,250);return Zf(X=>{const T=X.loaded,c=X.lengthComputable?X.total:void 0,ge=T-C,xe=B(ge),ve=T<=c;C=T;const le={loaded:T,total:c,progress:c?T/c:void 0,bytes:ge,rate:xe||void 0,estimated:xe&&c&&ve?(c-T)/xe:void 0,event:X,lengthComputable:c!=null,[b?"download":"upload"]:!0};g(le)},P)},xu=(g,b)=>{const P=g!=null;return[C=>b[0]({lengthComputable:P,total:g,loaded:C}),b[1]]},vu=g=>(...b)=>fe.asap(()=>g(...b)),Gf=Tr.hasStandardBrowserEnv?function(){const b=/(msie|trident)/i.test(navigator.userAgent),P=document.createElement("a");let C;function B(X){let T=X;return b&&(P.setAttribute("href",T),T=P.href),P.setAttribute("href",T),{href:P.href,protocol:P.protocol?P.protocol.replace(/:$/,""):"",host:P.host,search:P.search?P.search.replace(/^\?/,""):"",hash:P.hash?P.hash.replace(/^#/,""):"",hostname:P.hostname,port:P.port,pathname:P.pathname.charAt(0)==="/"?P.pathname:"/"+P.pathname}}return C=B(window.location.href),function(T){const c=fe.isString(T)?B(T):T;return c.protocol===C.protocol&&c.host===C.host}}():function(){return function(){return!0}}(),Hf=Tr.hasStandardBrowserEnv?{write(g,b,P,C,B,X){const T=[g+"="+encodeURIComponent(b)];fe.isNumber(P)&&T.push("expires="+new Date(P).toGMTString()),fe.isString(C)&&T.push("path="+C),fe.isString(B)&&T.push("domain="+B),X===!0&&T.push("secure"),document.cookie=T.join("; ")},read(g){const b=document.cookie.match(new RegExp("(^|;\\s*)("+g+")=([^;]*)"));return b?decodeURIComponent(b[3]):null},remove(g){this.write(g,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Wf(g){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(g)}function Xf(g,b){return b?g.replace(/\/?\/$/,"")+"/"+b.replace(/^\/+/,""):g}function bu(g,b){return g&&!Wf(b)?Xf(g,b):b}const wu=g=>g instanceof Gi?{...g}:g;function es(g,b){b=b||{};const P={};function C(xe,ve,le){return fe.isPlainObject(xe)&&fe.isPlainObject(ve)?fe.merge.call({caseless:le},xe,ve):fe.isPlainObject(ve)?fe.merge({},ve):fe.isArray(ve)?ve.slice():ve}function B(xe,ve,le){if(fe.isUndefined(ve)){if(!fe.isUndefined(xe))return C(void 0,xe,le)}else return C(xe,ve,le)}function X(xe,ve){if(!fe.isUndefined(ve))return C(void 0,ve)}function T(xe,ve){if(fe.isUndefined(ve)){if(!fe.isUndefined(xe))return C(void 0,xe)}else return C(void 0,ve)}function c(xe,ve,le){if(le in b)return C(xe,ve);if(le in g)return C(void 0,xe)}const ge={url:X,method:X,data:X,baseURL:T,transformRequest:T,transformResponse:T,paramsSerializer:T,timeout:T,timeoutMessage:T,withCredentials:T,withXSRFToken:T,adapter:T,responseType:T,xsrfCookieName:T,xsrfHeaderName:T,onUploadProgress:T,onDownloadProgress:T,decompress:T,maxContentLength:T,maxBodyLength:T,beforeRedirect:T,transport:T,httpAgent:T,httpsAgent:T,cancelToken:T,socketPath:T,responseEncoding:T,validateStatus:c,headers:(xe,ve)=>B(wu(xe),wu(ve),!0)};return fe.forEach(Object.keys(Object.assign({},g,b)),function(ve){const le=ge[ve]||B,ae=le(g[ve],b[ve],ve);fe.isUndefined(ae)&&le!==c||(P[ve]=ae)}),P}const Su=g=>{const b=es({},g);let{data:P,withXSRFToken:C,xsrfHeaderName:B,xsrfCookieName:X,headers:T,auth:c}=b;b.headers=T=Gi.from(T),b.url=du(bu(b.baseURL,b.url),g.params,g.paramsSerializer),c&&T.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));let ge;if(fe.isFormData(P)){if(Tr.hasStandardBrowserEnv||Tr.hasStandardBrowserWebWorkerEnv)T.setContentType(void 0);else if((ge=T.getContentType())!==!1){const[xe,...ve]=ge?ge.split(";").map(le=>le.trim()).filter(Boolean):[];T.setContentType([xe||"multipart/form-data",...ve].join("; "))}}if(Tr.hasStandardBrowserEnv&&(C&&fe.isFunction(C)&&(C=C(b)),C||C!==!1&&Gf(b.url))){const xe=B&&X&&Hf.read(X);xe&&T.set(B,xe)}return b},Jf=typeof XMLHttpRequest<"u"&&function(g){return new Promise(function(P,C){const B=Su(g);let X=B.data;const T=Gi.from(B.headers).normalize();let{responseType:c,onUploadProgress:ge,onDownloadProgress:xe}=B,ve,le,ae,ct,Ue;function Ke(){ct&&ct(),Ue&&Ue(),B.cancelToken&&B.cancelToken.unsubscribe(ve),B.signal&&B.signal.removeEventListener("abort",ve)}let Ve=new XMLHttpRequest;Ve.open(B.method.toUpperCase(),B.url,!0),Ve.timeout=B.timeout;function pt(){if(!Ve)return;const ze=Gi.from("getAllResponseHeaders"in Ve&&Ve.getAllResponseHeaders()),xt={data:!c||c==="text"||c==="json"?Ve.responseText:Ve.response,status:Ve.status,statusText:Ve.statusText,headers:ze,config:g,request:Ve};yu(function(jt){P(jt),Ke()},function(jt){C(jt),Ke()},xt),Ve=null}"onloadend"in Ve?Ve.onloadend=pt:Ve.onreadystatechange=function(){!Ve||Ve.readyState!==4||Ve.status===0&&!(Ve.responseURL&&Ve.responseURL.indexOf("file:")===0)||setTimeout(pt)},Ve.onabort=function(){Ve&&(C(new lt("Request aborted",lt.ECONNABORTED,g,Ve)),Ve=null)},Ve.onerror=function(){C(new lt("Network Error",lt.ERR_NETWORK,g,Ve)),Ve=null},Ve.ontimeout=function(){let Pt=B.timeout?"timeout of "+B.timeout+"ms exceeded":"timeout exceeded";const xt=B.transitional||fu;B.timeoutErrorMessage&&(Pt=B.timeoutErrorMessage),C(new lt(Pt,xt.clarifyTimeoutError?lt.ETIMEDOUT:lt.ECONNABORTED,g,Ve)),Ve=null},X===void 0&&T.setContentType(null),"setRequestHeader"in Ve&&fe.forEach(T.toJSON(),function(Pt,xt){Ve.setRequestHeader(xt,Pt)}),fe.isUndefined(B.withCredentials)||(Ve.withCredentials=!!B.withCredentials),c&&c!=="json"&&(Ve.responseType=B.responseType),xe&&([ae,Ue]=cl(xe,!0),Ve.addEventListener("progress",ae)),ge&&Ve.upload&&([le,ct]=cl(ge),Ve.upload.addEventListener("progress",le),Ve.upload.addEventListener("loadend",ct)),(B.cancelToken||B.signal)&&(ve=ze=>{Ve&&(C(!ze||ze.type?new Vs(null,g,Ve):ze),Ve.abort(),Ve=null)},B.cancelToken&&B.cancelToken.subscribe(ve),B.signal&&(B.signal.aborted?ve():B.signal.addEventListener("abort",ve)));const Mt=$f(B.url);if(Mt&&Tr.protocols.indexOf(Mt)===-1){C(new lt("Unsupported protocol "+Mt+":",lt.ERR_BAD_REQUEST,g));return}Ve.send(X||null)})},Kf=(g,b)=>{let P=new AbortController,C;const B=function(ge){if(!C){C=!0,T();const xe=ge instanceof Error?ge:this.reason;P.abort(xe instanceof lt?xe:new Vs(xe instanceof Error?xe.message:xe))}};let X=b&&setTimeout(()=>{B(new lt(`timeout ${b} of ms exceeded`,lt.ETIMEDOUT))},b);const T=()=>{g&&(X&&clearTimeout(X),X=null,g.forEach(ge=>{ge&&(ge.removeEventListener?ge.removeEventListener("abort",B):ge.unsubscribe(B))}),g=null)};g.forEach(ge=>ge&&ge.addEventListener&&ge.addEventListener("abort",B));const{signal:c}=P;return c.unsubscribe=T,[c,()=>{X&&clearTimeout(X),X=null}]},Yf=function*(g,b){let P=g.byteLength;if(!b||P<b){yield g;return}let C=0,B;for(;C<P;)B=C+b,yield g.slice(C,B),C=B},Qf=async function*(g,b,P){for await(const C of g)yield*Yf(ArrayBuffer.isView(C)?C:await P(String(C)),b)},Tu=(g,b,P,C,B)=>{const X=Qf(g,b,B);let T=0,c,ge=xe=>{c||(c=!0,C&&C(xe))};return new ReadableStream({async pull(xe){try{const{done:ve,value:le}=await X.next();if(ve){ge(),xe.close();return}let ae=le.byteLength;if(P){let ct=T+=ae;P(ct)}xe.enqueue(new Uint8Array(le))}catch(ve){throw ge(ve),ve}},cancel(xe){return ge(xe),X.return()}},{highWaterMark:2})},hl=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Iu=hl&&typeof ReadableStream=="function",Ac=hl&&(typeof TextEncoder=="function"?(g=>b=>g.encode(b))(new TextEncoder):async g=>new Uint8Array(await new Response(g).arrayBuffer())),Pu=(g,...b)=>{try{return!!g(...b)}catch{return!1}},em=Iu&&Pu(()=>{let g=!1;const b=new Request(Tr.origin,{body:new ReadableStream,method:"POST",get duplex(){return g=!0,"half"}}).headers.has("Content-Type");return g&&!b}),ku=64*1024,Cc=Iu&&Pu(()=>fe.isReadableStream(new Response("").body)),ul={stream:Cc&&(g=>g.body)};hl&&(g=>{["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!ul[b]&&(ul[b]=fe.isFunction(g[b])?P=>P[b]():(P,C)=>{throw new lt(`Response type '${b}' is not supported`,lt.ERR_NOT_SUPPORT,C)})})})(new Response);const tm=async g=>{if(g==null)return 0;if(fe.isBlob(g))return g.size;if(fe.isSpecCompliantForm(g))return(await new Request(g).arrayBuffer()).byteLength;if(fe.isArrayBufferView(g)||fe.isArrayBuffer(g))return g.byteLength;if(fe.isURLSearchParams(g)&&(g=g+""),fe.isString(g))return(await Ac(g)).byteLength},im=async(g,b)=>{const P=fe.toFiniteNumber(g.getContentLength());return P??tm(b)},Mc={http:If,xhr:Jf,fetch:hl&&(async g=>{let{url:b,method:P,data:C,signal:B,cancelToken:X,timeout:T,onDownloadProgress:c,onUploadProgress:ge,responseType:xe,headers:ve,withCredentials:le="same-origin",fetchOptions:ae}=Su(g);xe=xe?(xe+"").toLowerCase():"text";let[ct,Ue]=B||X||T?Kf([B,X],T):[],Ke,Ve;const pt=()=>{!Ke&&setTimeout(()=>{ct&&ct.unsubscribe()}),Ke=!0};let Mt;try{if(ge&&em&&P!=="get"&&P!=="head"&&(Mt=await im(ve,C))!==0){let Gt=new Request(b,{method:"POST",body:C,duplex:"half"}),jt;if(fe.isFormData(C)&&(jt=Gt.headers.get("content-type"))&&ve.setContentType(jt),Gt.body){const[Fr,bi]=xu(Mt,cl(vu(ge)));C=Tu(Gt.body,ku,Fr,bi,Ac)}}fe.isString(le)||(le=le?"include":"omit"),Ve=new Request(b,{...ae,signal:ct,method:P.toUpperCase(),headers:ve.normalize().toJSON(),body:C,duplex:"half",credentials:le});let ze=await fetch(Ve);const Pt=Cc&&(xe==="stream"||xe==="response");if(Cc&&(c||Pt)){const Gt={};["status","statusText","headers"].forEach(Or=>{Gt[Or]=ze[Or]});const jt=fe.toFiniteNumber(ze.headers.get("content-length")),[Fr,bi]=c&&xu(jt,cl(vu(c),!0))||[];ze=new Response(Tu(ze.body,ku,Fr,()=>{bi&&bi(),Pt&&pt()},Ac),Gt)}xe=xe||"text";let xt=await ul[fe.findKey(ul,xe)||"text"](ze,g);return!Pt&&pt(),Ue&&Ue(),await new Promise((Gt,jt)=>{yu(Gt,jt,{data:xt,headers:Gi.from(ze.headers),status:ze.status,statusText:ze.statusText,config:g,request:Ve})})}catch(ze){throw pt(),ze&&ze.name==="TypeError"&&/fetch/i.test(ze.message)?Object.assign(new lt("Network Error",lt.ERR_NETWORK,g,Ve),{cause:ze.cause||ze}):lt.from(ze,ze&&ze.code,g,Ve)}})};fe.forEach(Mc,(g,b)=>{if(g){try{Object.defineProperty(g,"name",{value:b})}catch{}Object.defineProperty(g,"adapterName",{value:b})}});const Eu=g=>`- ${g}`,rm=g=>fe.isFunction(g)||g===null||g===!1,Au={getAdapter:g=>{g=fe.isArray(g)?g:[g];const{length:b}=g;let P,C;const B={};for(let X=0;X<b;X++){P=g[X];let T;if(C=P,!rm(P)&&(C=Mc[(T=String(P)).toLowerCase()],C===void 0))throw new lt(`Unknown adapter '${T}'`);if(C)break;B[T||"#"+X]=C}if(!C){const X=Object.entries(B).map(([c,ge])=>`adapter ${c} `+(ge===!1?"is not supported by the environment":"is not available in the build"));let T=b?X.length>1?`since :
|
583
|
-
`+X.map(
|
584
|
-
`):" "+
|
585
|
-
`+X):C.stack=X}catch{}}throw C}}_request(b,P){typeof b=="string"?(P=P||{},P.url=b):P=b||{},P=es(this.defaults,P);const{transitional:C,paramsSerializer:B,headers:X}=P;C!==void 0&&Lc.assertOptions(C,{silentJSONParsing:In.transitional(In.boolean),forcedJSONParsing:In.transitional(In.boolean),clarifyTimeoutError:In.transitional(In.boolean)},!1),B!=null&&(fe.isFunction(B)?P.paramsSerializer={serialize:B}:Lc.assertOptions(B,{encode:In.function,serialize:In.function},!0)),P.method=(P.method||this.defaults.method||"get").toLowerCase();let T=X&&fe.merge(X.common,X[P.method]);X&&fe.forEach(["delete","get","head","post","put","patch","common"],Ue=>{delete X[Ue]}),P.headers=Gi.concat(T,X);const c=[];let ge=!0;this.interceptors.request.forEach(function(Ke){typeof Ke.runWhen=="function"&&Ke.runWhen(P)===!1||(ge=ge&&Ke.synchronous,c.unshift(Ke.fulfilled,Ke.rejected))});const xe=[];this.interceptors.response.forEach(function(Ke){xe.push(Ke.fulfilled,Ke.rejected)});let ve,le=0,ae;if(!ge){const Ue=[Cu.bind(this),void 0];for(Ue.unshift.apply(Ue,c),Ue.push.apply(Ue,xe),ae=Ue.length,ve=Promise.resolve(P);le<ae;)ve=ve.then(Ue[le++],Ue[le++]);return ve}ae=c.length;let ct=P;for(le=0;le<ae;){const Ue=c[le++],Ke=c[le++];try{ct=Ue(ct)}catch(Ve){Ke.call(this,Ve);break}}try{ve=Cu.call(this,ct)}catch(Ue){return Promise.reject(Ue)}for(le=0,ae=xe.length;le<ae;)ve=ve.then(xe[le++],xe[le++]);return ve}getUri(b){b=es(this.defaults,b);const P=bu(b.baseURL,b.url);return du(P,b.params,b.paramsSerializer)}}fe.forEach(["delete","get","head","options"],function(b){ts.prototype[b]=function(P,C){return this.request(es(C||{},{method:b,url:P,data:(C||{}).data}))}}),fe.forEach(["post","put","patch"],function(b){function P(C){return function(X,T,c){return this.request(es(c||{},{method:b,headers:C?{"Content-Type":"multipart/form-data"}:{},url:X,data:T}))}}ts.prototype[b]=P(),ts.prototype[b+"Form"]=P(!0)});class Rc{constructor(b){if(typeof b!="function")throw new TypeError("executor must be a function.");let P;this.promise=new Promise(function(X){P=X});const C=this;this.promise.then(B=>{if(!C._listeners)return;let X=C._listeners.length;for(;X-- >0;)C._listeners[X](B);C._listeners=null}),this.promise.then=B=>{let X;const T=new Promise(c=>{C.subscribe(c),X=c}).then(B);return T.cancel=function(){C.unsubscribe(X)},T},b(function(X,T,c){C.reason||(C.reason=new Vs(X,T,c),P(C.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(b){if(this.reason){b(this.reason);return}this._listeners?this._listeners.push(b):this._listeners=[b]}unsubscribe(b){if(!this._listeners)return;const P=this._listeners.indexOf(b);P!==-1&&this._listeners.splice(P,1)}static source(){let b;return{token:new Rc(function(B){b=B}),cancel:b}}}function sm(g){return function(P){return g.apply(null,P)}}function om(g){return fe.isObject(g)&&g.isAxiosError===!0}const Bc={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(Bc).forEach(([g,b])=>{Bc[b]=g});function Du(g){const b=new ts(g),P=Jh(ts.prototype.request,b);return fe.extend(P,ts.prototype,b,{allOwnKeys:!0}),fe.extend(P,b,null,{allOwnKeys:!0}),P.create=function(B){return Du(es(g,B))},P}const Zt=Du(No);Zt.Axios=ts,Zt.CanceledError=Vs,Zt.CancelToken=Rc,Zt.isCancel=_u,Zt.VERSION=Mu,Zt.toFormData=al,Zt.AxiosError=lt,Zt.Cancel=Zt.CanceledError,Zt.all=function(b){return Promise.all(b)},Zt.spread=sm,Zt.isAxiosError=om,Zt.mergeConfig=es,Zt.AxiosHeaders=Gi,Zt.formToJSON=g=>mu(fe.isHTMLForm(g)?new FormData(g):g),Zt.getAdapter=Au.getAdapter,Zt.HttpStatusCode=Bc,Zt.default=Zt;const am=(g,b=300)=>{let P;return function(...B){clearTimeout(P),P=setTimeout(()=>{g.apply(this,B)},b)}};function dl(g,b,P={}){const C={type:"Feature"};return(P.id===0||P.id)&&(C.id=P.id),P.bbox&&(C.bbox=P.bbox),C.properties=b||{},C.geometry=g,C}function Lu(g,b,P={}){if(!g)throw new Error("coordinates is required");if(!Array.isArray(g))throw new Error("coordinates must be an Array");if(g.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Ou(g[0])||!Ou(g[1]))throw new Error("coordinates must contain numbers");return dl({type:"Point",coordinates:g},b,P)}function Ru(g,b,P={}){for(const B of g){if(B.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(B[B.length-1].length!==B[0].length)throw new Error("First and last Position are not equivalent.");for(let X=0;X<B[B.length-1].length;X++)if(B[B.length-1][X]!==B[0][X])throw new Error("First and last Position are not equivalent.")}return dl({type:"Polygon",coordinates:g},b,P)}function Bu(g,b,P={}){return dl({type:"MultiPoint",coordinates:g},b,P)}function Fu(g,b,P={}){return dl({type:"MultiPolygon",coordinates:g},b,P)}function Ou(g){return!isNaN(g)&&g!==null&&!Array.isArray(g)}function Fc(g,b,P){if(g!==null)for(var C,B,X,T,c,ge,xe,ve=0,le=0,ae,ct=g.type,Ue=ct==="FeatureCollection",Ke=ct==="Feature",Ve=Ue?g.features.length:1,pt=0;pt<Ve;pt++){xe=Ue?g.features[pt].geometry:Ke?g.geometry:g,ae=xe?xe.type==="GeometryCollection":!1,c=ae?xe.geometries.length:1;for(var Mt=0;Mt<c;Mt++){var ze=0,Pt=0;if(T=ae?xe.geometries[Mt]:xe,T!==null){ge=T.coordinates;var xt=T.type;switch(ve=P&&(xt==="Polygon"||xt==="MultiPolygon")?1:0,xt){case null:break;case"Point":if(b(ge,le,pt,ze,Pt)===!1)return!1;le++,ze++;break;case"LineString":case"MultiPoint":for(C=0;C<ge.length;C++){if(b(ge[C],le,pt,ze,Pt)===!1)return!1;le++,xt==="MultiPoint"&&ze++}xt==="LineString"&&ze++;break;case"Polygon":case"MultiLineString":for(C=0;C<ge.length;C++){for(B=0;B<ge[C].length-ve;B++){if(b(ge[C][B],le,pt,ze,Pt)===!1)return!1;le++}xt==="MultiLineString"&&ze++,xt==="Polygon"&&Pt++}xt==="Polygon"&&ze++;break;case"MultiPolygon":for(C=0;C<ge.length;C++){for(Pt=0,B=0;B<ge[C].length;B++){for(X=0;X<ge[C][B].length-ve;X++){if(b(ge[C][B][X],le,pt,ze,Pt)===!1)return!1;le++}Pt++}ze++}break;case"GeometryCollection":for(C=0;C<T.geometries.length;C++)if(Fc(T.geometries[C],b,P)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function pl(g,b={}){if(g.bbox!=null&&b.recompute!==!0)return g.bbox;const P=[1/0,1/0,-1/0,-1/0];return Fc(g,C=>{P[0]>C[0]&&(P[0]=C[0]),P[1]>C[1]&&(P[1]=C[1]),P[2]<C[0]&&(P[2]=C[0]),P[3]<C[1]&&(P[3]=C[1])}),P}function lm(g,b={}){const P=pl(g),C=(P[0]+P[2])/2,B=(P[1]+P[3])/2;return Lu([C,B],b.properties,b)}function cm(g,b={}){let P=0,C=0,B=0;return Fc(g,function(X){P+=X[0],C+=X[1],B++},!0),Lu([P/B,C/B],b.properties)}const hm={mixins:[vc],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}]},selectedLayer:{type:String,required:!0}},watch:{map(g){g&&g.on("load",this.handleMapLoad)}},methods:{handleMapLoad(){var g;this.baseLayers.forEach(b=>{this.layerList.push(b)}),this.toggleLayerVisibility((g=this.baseLayers[0])==null?void 0:g.id)},toggleLayerVisibility(g){this.$emit("update:selectedLayer",g),this.changeBaseLayer(g)}}},um={class:"vs-map-slot-layers z-10 select-none"},dm=["onClick"],pm=["src"];function fm(g,b,P,C,B,X){return re.openBlock(),re.createElementBlock("div",um,[(re.openBlock(!0),re.createElementBlock(re.Fragment,null,re.renderList(P.baseLayers,(T,c)=>(re.openBlock(),re.createElementBlock("div",{key:T.id,class:re.normalizeClass(["vs-map-slot-layers__layer relative",{focused:T.id==P.selectedLayer}]),onClick:ge=>X.toggleLayerVisibility(T.id)},[re.createElementVNode("img",{src:T.image,class:"vs-map-slot-layers__image"},null,8,pm),re.createElementVNode("div",{class:re.normalizeClass(["absolute py-2 px-4 text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg top-[-46px] text-nowrap p-2 hidden whitespace-nowrap",[c===0?"left-[-10px]":"left-[50%] translate-x-[-50%]"]])},re.toDisplayString(T==null?void 0:T.name),3)],10,dm))),128))])}const mm=nn(hm,[["render",fm],["__scopeId","data-v-8959e540"]]),gm={props:["colors","strokes","title"],methods:{capitalizeFirstLetter(g){return g?g.charAt(0).toUpperCase()+g.slice(1):""}}},_m={class:"absolute left-[20px] bottom-[74px] bg-white max-w-[250px] p-[10px] rounded-lg z-10 border"},ym={key:0,class:"mb-[10px] text-[1rem]"},xm={key:1},vm={class:"legend-item flex items-center gap-2 mb-[10px]"},bm={class:"ml-1 text-[0.875rem]"},wm={class:"legend-item"},Sm={key:0,class:"flex justify-start items-center gap-2"},Tm={class:"ml-1 text-[0.875rem]"};function Im(g,b,P,C,B,X){var T;return re.openBlock(),re.createElementBlock("div",_m,[P.title?(re.openBlock(),re.createElementBlock("div",ym,re.toDisplayString(P.title),1)):re.createCommentVNode("",!0),(T=P.strokes)!=null&&T.length?(re.openBlock(),re.createElementBlock("div",xm,[(re.openBlock(!0),re.createElementBlock(re.Fragment,null,re.renderList(P.strokes,c=>(re.openBlock(),re.createElementBlock("div",vm,[re.createElementVNode("div",{class:"w-[15px] h-[4px]",style:re.normalizeStyle({background:`repeating-linear-gradient(to right, ${c.color}, ${c.color} 5px, transparent 5px, transparent 8px)`})},null,4),re.createElementVNode("div",bm,re.toDisplayString(X.capitalizeFirstLetter(c.text)),1)]))),256))])):re.createCommentVNode("",!0),(re.openBlock(!0),re.createElementBlock(re.Fragment,null,re.renderList(P.colors,c=>(re.openBlock(),re.createElementBlock("div",wm,[c.id>0?(re.openBlock(),re.createElementBlock("div",Sm,[re.createElementVNode("div",{class:"w-[15px] h-[15px] rounded-[50%] min-w-[15px]",style:re.normalizeStyle({backgroundColor:c.color})},null,4),re.createElementVNode("div",Tm,re.toDisplayString(X.capitalizeFirstLetter(c.text)),1)])):re.createCommentVNode("",!0)]))),256))])}const Pm={components:{MapSlotLayers:mm,MapLegend:nn(gm,[["render",Im]])},props:{isMapCompare:{type:Boolean,default:!0},polygonOpacity:{type:Number,default:()=>null},polygonStrokeWidth:{type:Number,default:()=>4},dashedLine:{type:Boolean,default:()=>!1},colorAttr:null,strokeAttr:null,zoom:{type:Array,default:()=>8},defaultColor:{type:String,default:"blue"},selectedBaseLayer:{type:String,required:!0},legendname:{type:String,default:()=>""},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:13},minZoom:{type:[String,Number],default:1},basemap:Array,filtersParam:{type:String,default:""},row:{type:Object,default:{}},pointZoom:{type:String,default:"12"},legend:{type:Boolean,default:()=>!0}},mixins:[vc],inject:["prefix"],data(){return{map:null,hoverObject:null,popup:null,colors:[],strokes:null}},async mounted(){var g,b,P,C;try{if(await this.createMap(),(g=this.row)!=null&&g.geom){const{type:B,coordinates:X}=this.row.geom;let T;switch(B){case"Polygon":T=Ru(X);break;case"MultiPolygon":T=Fu(X);break;case"MultiPoint":T=Bu(X);break;default:(b=this.map)==null||b.fitBounds([X,X],{maxZoom:this.zoom,padding:30,duration:0}),this.isSelectObj=!0;return}const c=lm(T).geometry.coordinates;(P=this.map)==null||P.fitBounds([c,c],{maxZoom:this.zoom,padding:30,duration:0})}(C=this.map)==null||C.fitBounds(this.center,{duration:0})}catch{}},watch:{filtersParam(g){this.setFilter(this.table,g)},selectedBaseLayer(g){this.$emit("update:selectedBaseLayer",g)},row:{handler(g){g!=null&&g.geom&&this.fitToBounds(g.geom),this.map&&this.map.getStyle()&&this.map.getStyle().layers.filter(C=>C.source===this.table&&C.type==="line").forEach(C=>{var B;this.map.setPaintProperty(C.id,"line-width",((B=this.row)==null?void 0:B.id)!=null?["case",["==",["get","id"],this.row.id.toString()],(this.polygonStrokeWidth??2.5)*2,this.polygonStrokeWidth??2.5]:this.polygonStrokeWidth??2.5)})},immediate:!0}},computed:{basemapIds(){return this.basemap.map(g=>g==null?void 0:g.id)}},methods:{async getColorStyle(){var g=[["#69D2E7","#A7DBD8","#E0E4CC","#F38630","#FA6900"],["#FE4365","#FC9D9A","#F9CDAD","#C8C8A9","#83AF9B"],["#ECD078","#D95B43","#C02942","#542437","#53777A"]];if(!this.colorAttr)return this.defaultColor;try{const{data:{rows:b}}=await Zt.get(`${this.prefix}/data/${this.table}/${this.colorAttr}`),P=b.reduce((C,B,X)=>B!=null&&B.id?[...C,B.id.toString(),B.color||g[0][X%5]]:C,["match",["get",this.colorAttr]]);return this.colors=[...b],P.push("gray"),P}catch(b){console.log(b)}},async getStrokeStyle(){if(!this.strokeAttr)return"transparent";try{const{data:{rows:g}}=await Zt.get(`${this.prefix}/data/${this.table}/${this.strokeAttr}`),b=g.reduce((P,C,B)=>C!=null&&C.id?[...P,{id:C.id.toString(),color:C.color||"#000000",dash:C.dash||[2,2],text:C.text||C.id.toString()}]:P,[]);return this.strokes=[...b],["match",["get",this.strokeAttr],...b.flatMap(({id:P,color:C})=>[P,C]),"transparent"]}catch(g){return console.log(g),"transparent"}},async handleMapLoad(){var C,B,X,T,c;(C=this.row)!=null&&C.geom&&this.fitToBounds(this.row.geom),this.$emit("map",this.map);const g=await this.getStrokeStyle(),b=await this.getColorStyle(),P=((X=(B=location.search.split("&").find(ge=>ge.includes("filter=")))==null?void 0:B.split("filter="))==null?void 0:X[1])||"";await this.addLayer({id:this.table,service:"vector",url:`${this.prefix}/vtile/${this.table}/ua/{z}/{x}/{y}.vmt?pointZoom=${this.pointZoom}&dt=${new Date().toISOString()}`,layers:[{type:"fill","source-layer":this.table,paint:{"fill-color":b,"fill-opacity":this.polygonOpacity??.5,"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":b}},{type:"line",paint:{"line-color":b,"line-width":((T=this.row)==null?void 0:T.id)!=null?["case",["==",["get","id"],this.row.id.toString()],(this.polygonStrokeWidth??2.5)*2,this.polygonStrokeWidth??2.5]:this.polygonStrokeWidth??2.5}},...this.dashedLine?[{type:"line",paint:{"line-color":g,"line-width":((c=this.row)==null?void 0:c.id)!=null?["case",["==",["get","id"],this.row.id.toString()],(this.polygonStrokeWidth??2.5)*2,this.polygonStrokeWidth??2.5]:this.polygonStrokeWidth??2.5,"line-dasharray":[2,2]}}]:[]]}),P&&this.setFilter(this.table,P)},async createMap(){const g={version:8,glyphs:"https://cdn.softpro.ua/data/fonts/{fontstack}/{range}.pbf",sources:{},layers:[]};this.map=await new Fo.Map({container:"maplibre-map",style:g,zoom:this.zoom,center:this.center,minZoom:this.minZoom}),this.$parent.map=this.map,this.map.addControl(new Fo.NavigationControl({visualizePitch:!0})),this.map.on("load",this.handleMapLoad)},fitToBounds(g){if(!this.map)return;const{type:b,coordinates:P}=g;let C,B;switch(b){case"Polygon":C=Ru(P),B=pl(C),this.map.fitBounds(B,{padding:30,maxZoom:15,duration:0});break;case"MultiPolygon":C=Fu(P),B=pl(C),this.map.fitBounds(B,{padding:30,maxZoom:15,duration:0});break;case"MultiPoint":C=Bu(P),B=pl(C),this.map.fitBounds(B,{padding:30,maxZoom:15,duration:0});break;case"Point":this.map.flyTo({center:P,zoom:15,duration:0,essential:!0});break;default:console.warn("Невідомий тип геометрії:",b)}}}},km={class:"vs-map-portal relative z-1 mt-2",id:"mapwrapper"};function Em(g,b,P,C,B,X){const T=re.resolveComponent("MapLegend"),c=re.resolveComponent("MapSlotLayers");return re.openBlock(),re.createElementBlock("div",km,[re.createElementVNode("div",{id:"maplibre-map",ref:"maplibreMap",class:"w-full compare_main_map",style:re.normalizeStyle({height:P.height})},null,4),re.withDirectives(re.createVNode(T,{colors:B.colors,strokes:B.strokes,title:P.legendname},null,8,["colors","strokes","title"]),[[re.vShow,P.legend]]),re.createVNode(c,{map:B.map,baseLayers:P.basemap,selectedLayer:P.selectedBaseLayer,"onUpdate:selectedLayer":b[0]||(b[0]=ge=>g.$emit("update:selectedBaseLayer",ge))},null,8,["map","baseLayers","selectedLayer"])])}const Am=nn(Pm,[["render",Em]]),Cm={},Mm={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"},zm=[re.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(g,b){return re.openBlock(),re.createElementBlock("svg",Mm,zm)}const Lm=nn(Cm,[["render",Dm]]),Rm={},Bm={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"},Fm=[re.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),re.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),re.createElementVNode("path",{d:"M15 4v16"},null,-1),re.createElementVNode("path",{d:"M9 10l2 2l-2 2"},null,-1)];function Om(g,b){return re.openBlock(),re.createElementBlock("svg",Bm,Fm)}const Vm=nn(Rm,[["render",Om]]),Nm={},jm={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"},Um=[re.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),re.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),re.createElementVNode("path",{d:"M15 4v16"},null,-1),re.createElementVNode("path",{d:"M10 10l-2 2l2 2"},null,-1)];function $m(g,b){return re.openBlock(),re.createElementBlock("svg",jm,Um)}const qm=nn(Nm,[["render",$m]]),Zm={},Gm={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"},Hm=[re.createElementVNode("path",{d:"M18 6 6 18"},null,-1),re.createElementVNode("path",{d:"m6 6 12 12"},null,-1)];function Wm(g,b){return re.openBlock(),re.createElementBlock("svg",Gm,Hm)}const Xm=nn(Zm,[["render",Wm]]),Jm=re.defineComponent({props:{prefix:{type:String,default:"/api"},applyVueRouter:{type:Boolean,default:!0},dashedLine:{type:Boolean,default:!1},title:{type:String,default:()=>""},table:{type:String,default:()=>""},rows:{type:Object,default:()=>null},initTotal:{type:[Number,String],default:()=>""},colorAttr:{type:String,default:()=>""},strokeAttr:{type:String,default:()=>""},legendname:{type:String,default:()=>""},center:{type:Array},maxBounds:{type:Array,default:()=>[[22,44.4],[40,52.5]]},id:{type:String,default:()=>""},zoom:{type:[Number,String],default:()=>"13"},minZoom:{type:[Number,String],default:()=>"1"},maskForSearch:{type:String,default:()=>null},searchShow:{type:Boolean,default:()=>!0},basemap:{type:Array},pointZoom:{type:String,default:()=>"12"},legend:{type:Boolean,default:()=>!0},defaultColor:{type:String,default:()=>"blue"},polygonOpacity:{type:Number,default:()=>null},history:{type:Boolean,default:!0}},mixins:[vc],components:{MapPortal:Am,NoData:Op,FilterIcon:Lm,VisibleMapIcon:Vm,HiddenMapIcon:qm,CloseIcon:Xm},data(){return{filters:"",search:"",limit:20,polyline:null,filtersParam:"",isSelectObj:!1,selectedId:"",searchRegion:"",searchAddress:"",map:null,selectedBaseLayer:"",marker:null,selectedRow:null,activeFilters:"",isMapVisible:!0,tabsIsVisible:!1,filterUrl:"",currentPage:1,isFilterVisible:!1,tableData:null,hoverData:null,map:null,legendName:null,total:null,filtered:null,activeFiltersCount:"",regionSelectValue:null,addressSelectValue:null,currentBbox:null,mountedFilter:{},isCompareOpen:!1,handleDebouncedUpdateValue:am(g=>{this.handleSearchValue(g)},300)}},provide(){return{prefix:this.prefix}},watch:{map(){this.map.on("mousemove",this.handleMapHover),this.map.on("click",this.handleMapClick),this.$emit("update:map",this.map)},activeFiltersCount(){var g,b;return(b=(g=this.$refs)==null?void 0:g.filter)==null?void 0:b.filteredActiveFiltersLength},activeFilters(){var g,b;return(b=(g=this.$refs)==null?void 0:g.filter)==null?void 0:b.activeFilters}},created(){this.tableData=this.rows,this.total=this.initTotal,this.id&&(this.selectedRow=this.rows[0],this.selectedId=this.id,this.isSelectObj=!0)},mounted(){this.rows||this.getData();const b=new URLSearchParams(window.location.search).get("filter"),P=b==null?void 0:b.split("|");P==null||P.forEach(B=>{const[X,T]=B.split("=");T!=null&&T.includes(",")?this.mountedFilter[X]=T==null?void 0:T.split(","):this.mountedFilter[X]=T,this.activeFilters=this.mountedFilter});const C=new URLSearchParams(window.location.search);this.currentPage=C.get("page")||1,this.getFilter()},updated(){this.checkFilterLength()},computed:{setAtuZoom(){var g,b,P;return((g=this.regionSelectValue)==null?void 0:g.id)==="UA80000000000093317"||((b=this.regionSelectValue)==null?void 0:b.id)==="UA85000000000065278"?10:((P=this.regionSelectValue)==null?void 0:P.region)===""?7.5:11}},methods:{async getData(){try{const g={search:this.search||null,limit:this.limit,page:this.currentPage,polyline:this.polyline};g.filter=this.filtersParam;const{data:b}=await Zt.get(`${this.prefix}/data/${this.table}`,{params:g});this.tableData=b==null?void 0:b.rows,this.total=b.filtered,this.filtered=b.filtered}catch(g){console.error(g.message)}},moveToDefaultPage(){var P;const g=new URLSearchParams(window.location.search);g.delete("id"),`${window.location.pathname}${g.toString()}`,(P=this.map)==null||P.fitBounds(this.maxBounds,{duration:0}),this.history&&window.history.pushState({},"",newUrl),this.isSelectObj=!1},regionFullName(g){return g.region?`${g.text} / ${g.region}`:g.text},getLabelById(g){const b=this.filters.find(P=>P.id===g);return b?b.label:g},getOptionsLabelById(g,b){if(Array.isArray(b)){const P=this.filters.find(C=>C.id===g);return P!=null&&P.options?P==null?void 0:P.options.filter(C=>b.includes(C.id)).map(C=>C.text).join(", "):b==null?void 0:b.length}else return b},async clearFilter(g){var b,P,C;await((P=(b=this.$refs)==null?void 0:b.filter)==null?void 0:P.clearFilter(g)),this.filterUrl=(C=this.$refs)==null?void 0:C.filter.filterUrl,(g==="region_katottg"||g==="katottg")&&this.$emit("update:filterState",{}),await this.updateTableAndMap(),await this.getData()},handlePageChange(g){this.currentPage=g;const b=new URL(window.location.href),P=new URLSearchParams(window.location.search);P.set("page",g),b.search=decodeURI(P.toString()),window.history.pushState({},"",b),this.getData()},async getFilter(){var g;try{const{data:b}=await Zt.get(`${this.prefix}/filter/${this.table}`);this.filters=(g=b==null?void 0:b.list)==null?void 0:g.map(P=>({...P,label:(P==null?void 0:P.label)||(P==null?void 0:P.ua),id:(P==null?void 0:P.id)||(P==null?void 0:P.name)}))}catch(b){console.error(b.message)}},async handleSearchValue(g){this.search=g,await this.getData()},closeObjCard(){var C;const g=new URLSearchParams(window.location.search);g.delete("id"),this.deletePulsePoint();const P=`${window.location.pathname}?${g.toString()}`;(this.currentBbox||this.center)&&((C=this.map)==null||C.fitBounds(this.currentBbox||[this.center,this.center],{maxZoom:this.zoom,duration:0})),window.history.pushState({},"",P),this.isSelectObj=!1,this.selectedRow=null,this.getData()},handleFilterChange(g){this.$emit("update:filterState",g),this.currentPage=g.state.page||1,this.filterUrl=g.url==="no-url"?null:g.url.split("|").filter(b=>!b.includes("page=")).join("|")},async updateTableAndMap(){var g,b;this.selectedRow||(this.filtersParam=this.filterUrl,this.activeFilters=(b=(g=this.$refs)==null?void 0:g.filter)==null?void 0:b.activeFilters,this.isFilterVisible=!1,this.getData())},toggleMapVisible(){this.isMapVisible=!this.isMapVisible},checkUrl(g=!0){const b=new URLSearchParams(window.location.search);b.has("id")?(this.isSelectObj=!0,this.isMapVisible=g,this.selectedId=b.get("id")):(this.isSelectObj=!1,this.selectedId="")},changeLimit(g){this.limit=g,this.currentPage=1,this.getData()},resetFilters(){this.$refs.filter&&(this.$refs.filter.clearAll(),this.search="",this.filtersParam="",this.polyline=null,this.regionSelectValue=null,this.addressSelectValue=null,this.currentBbox=null,this.activeFilters=null,this.tabsIsVisible=!1)},checkFilterLength(){var b,P;const g=(P=(b=this.$refs)==null?void 0:b.filter)==null?void 0:P.filteredActiveFiltersLength;g!==this.previousLength&&(this.previousLength=g,this.activeFiltersCount=g)},async handleMapClick(g){var X,T,c,ge,xe,ve,le,ae,ct,Ue;const b=this.map.queryRenderedFeatures(g.point);if((b==null?void 0:b.length)<1||((X=b[0])==null?void 0:X.source)==="region-search-id"||((T=b[0])==null?void 0:T.source)==="route-line")return;const P=window.location.pathname,C=new URLSearchParams(window.location.search);C.set("id",`${(c=b[0])==null?void 0:c.properties.id}`),this.getObjectData((xe=(ge=b[0])==null?void 0:ge.properties)==null?void 0:xe.id);const B=`${P}?${C.toString()}`;this.history&&window.history.pushState({},"",B),this.isSelectObj=!0,g.lngLat&&((Ue=this.map)==null||Ue.fitBounds([[(ve=g.lngLat)==null?void 0:ve.lng,(le=g.lngLat)==null?void 0:le.lat],[(ae=g.lngLat)==null?void 0:ae.lng,(ct=g.lngLat)==null?void 0:ct.lat]],{padding:30,duration:0})),this.checkUrl()},async getObjectData(g){var b,P;try{const{data:C}=await Zt.get(`${this.prefix}/data/${this.table}/${g}`);this.selectRow((b=C==null?void 0:C.rows)==null?void 0:b[0]),((P=C==null?void 0:C.rows)==null?void 0:P.lenght)<1&&this.deletePulsePoint()}catch(C){console.error(C.message)}},async selectRow(g,b=!0){var c;this.isMapVisible=b;const C=await(await fetch(`${this.prefix}/data/${this.table}/${g.id}`)).json();this.selectedRow=((c=C==null?void 0:C.rows)==null?void 0:c[0])||g;const B=window.location.pathname,X=new URLSearchParams(window.location.search);X.set("id",`${g.id}`);const T=`${B}?${X.toString()}`;this.history&&window.history.pushState({},"",T),this.checkUrl(b),this.isSelectObj=!0},deletePulsePoint(){this.marker&&this.marker.remove()},addPulsePoint(g){this.deletePulsePoint();const b=document.createElement("div");b.className="gps-marker",b.style.width="10px",b.style.height="10px",b.style.position="relative";const P=document.createElement("div");P.className="gps-wave",b.appendChild(P),this.marker=new Fo.Marker({element:b,anchor:"center"}).setLngLat(g).addTo(this.map)},async handleMapHover(g){var T,c,ge;this.hoverObject&&(this.map.setFeatureState(this.hoverObject,{hover:!1}),this.hoverObject=null),this.popup||(this.popup=new Fo.Popup({maxWidth:"400px",closeButton:!1,closeOnClick:!1}));const b=this.map.queryRenderedFeatures(g.point);if(this.map.getCanvas().style.cursor="pointer",!(b!=null&&b.length)||((T=b==null?void 0:b[0])==null?void 0:T.source)==="region-search-id"){this.map.getCanvas().style.cursor="",this.popup.remove();return}const P=["route-line"];if(!b.filter(xe=>!P.some(ve=>{var le;return(le=xe.layer)==null?void 0:le.source.includes(ve)})).length)return;const B=b[0].geometry.coordinates.slice();b[0].source==="highlighted-polygon"&&b[1]?this.hoverData=(c=b[1])==null?void 0:c.properties:this.hoverData=(ge=b[0])==null?void 0:ge.properties;const X={source:b[0].source,sourceLayer:b[0].sourceLayer,id:b[0].id};if(X.source!=="region-search-id"){for(this.map.setFeatureState(X,{hover:!0}),this.hoverObject=X;Math.abs(g.lngLat.lng-B[0])>180;)B[0]+=g.lngLat.lng>B[0]?360:-360;this.popup.setLngLat(g.lngLat).setHTML(this.$refs.popup.innerHTML).addTo(this.map)}},addGeomMarker(g){if(!this.map||!g)return;this.marker&&this.marker.remove();let b;(g==null?void 0:g.type)==="Point"?b=g.coordinates:b=cm(g).geometry.coordinates,this.marker=new Fo.Marker({color:"green"}).setLngLat(b).addTo(this.map)}}}),Km={class:"ml-3 pt-[20px]"},Ym={class:"w-full gap-5 flex justify-between mb-[6px] pr-3"},Qm={class:"flex items-center gap-2 max-h-[38px] pt-[4px]"},eg={class:"custom-filter-list"},tg={key:0,class:"font-medium text-[10px] min-w-[16px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full"},ig={class:"flex items-center"},rg=["title"],ng=re.createElementVNode("span",{class:"sr-only"},"Відкрити мапу",-1),sg={class:"flex"},og={key:0,class:"py-[15px] pb-[24px] pl-2"},ag={class:"font-bold text-2xl mr-[10px]"},lg={class:"text-sm text-stone-500 font-medium"},cg=re.createElementVNode("span",{class:"text-sm text-stone-500 font-medium"}," об'єктів",-1),hg={class:"wrapperTable flex flex-col",style:{height:"calc(100vh - 302px)"}},ug={key:0,class:"flex gap-x-2 flex-wrap"},dg={class:"font-medium"},pg=re.createElementVNode("span",{class:"h-3 mx-2 border-s border-gray-200"},null,-1),fg={class:"text-gray-500"},mg=["onClick"],gg={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"},_g=re.createElementVNode("span",{class:"font-medium"}," Очистити ",-1),yg={key:2,class:"text-center py-28"},xg=re.createElementVNode("h2",{class:"font-medium text-base text-gray-500 rounded-xl"}," За вашим запитом даних не знайдено! ",-1),vg=re.createElementVNode("p",{class:"font-normal text-sm text-gray-500 rounded-xl"}," Введіть, будь ласка, інші значення для пошуку. ",-1),bg={key:1},wg={key:2,class:"my-5 pr-2"},Sg={class:"flex justify-between"},Tg={class:"w-2/4"},Ig={class:"map-section relative"},Pg={ref:"popup",style:{display:"none"}};function kg(g,b,P,C,B,X){var Ve,pt,Mt;const T=re.resolveComponent("VsTextMask"),c=re.resolveComponent("vs-text"),ge=re.resolveComponent("FilterIcon"),xe=re.resolveComponent("VsFilterList"),ve=re.resolveComponent("VisibleMapIcon"),le=re.resolveComponent("HiddenMapIcon"),ae=re.resolveComponent("CloseIcon"),ct=re.resolveComponent("NoData"),Ue=re.resolveComponent("VsPagination"),Ke=re.resolveComponent("MapPortal");return re.openBlock(),re.createElementBlock("section",Km,[re.renderSlot(g.$slots,"header",{title:g.title,total:g.total}),re.createElementVNode("div",null,[re.createElementVNode("div",Ym,[re.createElementVNode("div",Qm,[g.maskForSearch?(re.openBlock(),re.createBlock(T,{key:0,"model-value":g.search,"onUpdate:modelValue":g.handleDebouncedUpdateValue,class:"w-full table-interface-search",placeholder:"Пошук",mask:g.maskForSearch,icon:"search",iconPosition:"left",clearable:"",style:{height:"38px","min-width":"300px","max-width":"300px"},ref:"searchInput"},null,8,["model-value","onUpdate:modelValue","mask"])):g.searchShow?(re.openBlock(),re.createBlock(c,{key:1,"model-value":g.search,"onUpdate:modelValue":g.handleDebouncedUpdateValue,class:"[&>input]:py-[7px] [&>input]:max-h-[38px] [&>input]:w-[220px] [&>input]:ps-10 [&>input]:pe-8 [&>input]:block [&>input]:w-full [&>input]:bg-gray-100 [&>input]:border-transparent [&>input]:rounded-lg [&>input]:text-sm [&>input]:focus:bg-white [&>input]:focus:border-blue-500 [&>input]:focus:ring-blue-500 [&>input]:disabled:opacity-50 [&>input]:disabled:pointer-events-none [&>input]:dark:bg-neutral-700 [&>input]:dark:border-transparent [&>input]:dark:text-neutral-400 [&>input]:dark:placeholder:text-neutral-400 dark:focus:bg-neutral-800 dark:focus:ring-neutral-600",placeholder:"Пошук",icon:"search","icon-position":"left",clearable:"",style:{height:"38px"},ref:"searchInput"},null,8,["model-value","onUpdate:modelValue"])):re.createCommentVNode("",!0),re.createElementVNode("div",eg,[g.filters?(re.openBlock(),re.createBlock(xe,{key:0,ref:"filter",modelValue:g.mountedFilter,"onUpdate:modelValue":b[0]||(b[0]=ze=>g.mountedFilter=ze),scheme:g.filters,isDialog:(Ve=g.filters)==null?void 0:Ve.some(ze=>!(ze!=null&&ze.inline)),"apply-vue-router":g.applyVueRouter,history:"",view:"plain",clearable:!1,name:"filter",onFilterChange:b[1]||(b[1]=async ze=>{await g.handleFilterChange(ze),await g.updateTableAndMap()})},{button:re.withCtx(({visible:ze})=>[re.createElementVNode("button",{type:"button",class:re.normalizeClass(["py-2 px-2.5 h-[40px] inline-flex items-center gap-x-1.5 text-sm font-medium rounded-lg bg-white text-gray-800 hover:bg-gray-50 focus:outline-none focus:bg-gray-50",[ze?"border border-blue-600 border-2":"border border-gray-200"]])},[re.createVNode(ge),re.createTextVNode(" Фільтри "),g.activeFiltersCount>=1?(re.openBlock(),re.createElementBlock("span",tg,re.toDisplayString(g.activeFiltersCount),1)):re.createCommentVNode("",!0)],2)]),_:1},8,["modelValue","scheme","isDialog","apply-vue-router"])):re.createCommentVNode("",!0)])]),re.createElementVNode("div",ig,[re.renderSlot(g.$slots,"buttons"),re.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:g.isMapVisible?"Приховати карту":"Показати карту",onClick:b[2]||(b[2]=(...ze)=>g.toggleMapVisible&&g.toggleMapVisible(...ze))},[g.isMapVisible?(re.openBlock(),re.createBlock(ve,{key:0})):(re.openBlock(),re.createBlock(le,{key:1})),ng],8,rg)])]),re.createElementVNode("div",sg,[re.createElementVNode("div",{class:re.normalizeClass(["relative overflow-hidden",g.isMapVisible?"w-2/4 mr-0":"w-full mr-3",g.isSelectObj?"hidden":""])},[(pt=g.$slots)!=null&&pt.header?re.createCommentVNode("",!0):(re.openBlock(),re.createElementBlock("h1",og,[re.createElementVNode("span",ag,re.toDisplayString(g.title),1),re.createElementVNode("span",lg,re.toDisplayString(g.total),1),cg])),re.createElementVNode("div",hg,[g.activeFilters?(re.openBlock(),re.createElementBlock("div",ug,[(re.openBlock(!0),re.createElementBlock(re.Fragment,null,re.renderList(g.activeFilters,(ze,Pt,xt)=>(re.openBlock(),re.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:xt},[re.createElementVNode("span",dg,re.toDisplayString(g.getLabelById(Pt)),1),pg,re.createElementVNode("span",fg,re.toDisplayString(g.getOptionsLabelById(Pt,ze)),1),re.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:Gt=>g.clearFilter(Pt)},[re.createVNode(ae)],8,mg)]))),128)),((Mt=Object.keys(g.activeFilters))==null?void 0:Mt.length)>=2?(re.openBlock(),re.createElementBlock("span",gg,[_g,re.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:b[3]||(b[3]=ze=>g.mountedFilter={})},[re.createVNode(ae)])])):re.createCommentVNode("",!0)])):re.createCommentVNode("",!0),g.total>=1?re.renderSlot(g.$slots,"table",{key:1,rows:g.tableData,map:g.map,marker:g.marker,selectRow:g.selectRow,getData:g.getData,addGeomMarker:g.addGeomMarker,isMapVisible:g.isMapVisible}):(re.openBlock(),re.createElementBlock("div",yg,[re.createVNode(ct),xg,vg,re.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:b[4]||(b[4]=(...ze)=>g.resetFilters&&g.resetFilters(...ze))}," Очистити дані пошуку ")]))]),g.total>=1?(re.openBlock(),re.createElementBlock("hr",bg)):re.createCommentVNode("",!0),g.total>=1?(re.openBlock(),re.createElementBlock("div",wg,[re.createElementVNode("div",Sg,[re.createVNode(Ue,{total:g.total,maxPages:7,defaultPage:g.currentPage,pageSize:g.limit,goTo:!1,size:"medium",onPageChange:g.handlePageChange,backgroundColor:"#e5e7eb",borderedCellSelected:!0,pageSizes:[10,20,30],onPageSizeChange:g.changeLimit},null,8,["total","defaultPage","pageSize","onPageChange","onPageSizeChange"])])])):re.createCommentVNode("",!0)],2),g.isSelectObj?(re.openBlock(),re.createElementBlock("div",{key:0,class:re.normalizeClass(g.isMapVisible?"w-2/4 mr-0 pb-5":"w-full pb-5 mr-3"),style:{height:"calc(100vh - 152px)"}},[re.renderSlot(g.$slots,"details",{table:g.table,selectedId:g.selectedId,selectedRow:g.selectedRow,map:g.map,closeObjCard:g.closeObjCard,isMapVisible:g.isMapVisible})],2)):re.createCommentVNode("",!0),re.withDirectives(re.createElementVNode("div",Tg,[re.createElementVNode("section",Ig,[re.renderSlot(g.$slots,"default",{map:g.map,removeSelectedBaseLayer:()=>g.selectedBaseLayer="",selectedBaseLayer:g.selectedBaseLayer,selectedRow:g.selectedRow}),re.createVNode(Ke,{height:"calc(100vh - 152px)",width:"w-2/4",table:g.table,filtersParam:g.filtersParam,row:g.selectedRow,legendname:g.legendname,legend:g.legend,colorAttr:g.colorAttr,strokeAttr:g.strokeAttr,polygonOpacity:g.polygonOpacity,maxBounds:g.maxBounds,center:g.center,zoom:g.zoom,dashedLine:g.dashedLine,minZoom:g.minZoom,basemap:g.basemap,pointZoom:g.pointZoom,defaultColor:g.defaultColor,onMap:b[5]||(b[5]=ze=>g.map=ze),selectedBaseLayer:g.selectedBaseLayer,"onUpdate:selectedBaseLayer":b[6]||(b[6]=ze=>g.selectedBaseLayer=ze),onIsCompareOpen:b[7]||(b[7]=ze=>g.isCompareOpen=ze)},null,8,["table","filtersParam","row","legendname","legend","colorAttr","strokeAttr","polygonOpacity","maxBounds","center","zoom","dashedLine","minZoom","basemap","pointZoom","defaultColor","selectedBaseLayer"])])],512),[[re.vShow,g.isMapVisible]])]),re.createElementVNode("div",Pg,[re.renderSlot(g.$slots,"popup",{data:g.hoverData})],512)])])}const Vu=nn(Jm,[["render",kg]]),Nu={install:g=>{g.component("VsPartsMap",Vu)},components:{VsPartsMap:Vu}};return typeof window<"u"&&(window.PartsMap=Nu),Nu});
|
576
|
+
${A} ${I} ${L} = u_${L};
|
577
|
+
#endif
|
578
|
+
`}),staticAttributes:o,staticUniforms:g}}class Pn{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,s,o,a,h,g,y,v,w){this.context=t;let A=this.boundPaintVertexBuffers.length!==a.length;for(let I=0;!A&&I<a.length;I++)this.boundPaintVertexBuffers[I]!==a[I]&&(A=!0);!this.vao||this.boundProgram!==s||this.boundLayoutVertexBuffer!==o||A||this.boundIndexBuffer!==h||this.boundVertexOffset!==g||this.boundDynamicVertexBuffer!==y||this.boundDynamicVertexBuffer2!==v||this.boundDynamicVertexBuffer3!==w?this.freshBind(s,o,a,h,g,y,v,w):(t.bindVertexArray.set(this.vao),y&&y.bind(),h&&h.dynamicDraw&&h.bind(),v&&v.bind(),w&&w.bind())}freshBind(t,s,o,a,h,g,y,v){const w=t.numAttributes,A=this.context,I=A.gl;this.vao&&this.destroy(),this.vao=A.createVertexArray(),A.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=s,this.boundPaintVertexBuffers=o,this.boundIndexBuffer=a,this.boundVertexOffset=h,this.boundDynamicVertexBuffer=g,this.boundDynamicVertexBuffer2=y,this.boundDynamicVertexBuffer3=v,s.enableAttributes(I,t);for(const L of o)L.enableAttributes(I,t);g&&g.enableAttributes(I,t),y&&y.enableAttributes(I,t),v&&v.enableAttributes(I,t),s.bind(),s.setVertexAttribPointers(I,t,h);for(const L of o)L.bind(),L.setVertexAttribPointers(I,t,h);g&&(g.bind(),g.setVertexAttribPointers(I,t,h)),a&&a.bind(),y&&(y.bind(),y.setVertexAttribPointers(I,t,h)),v&&(v.bind(),v.setVertexAttribPointers(I,t,h)),A.currentNumAttributes=w}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const So=(u,t,s,o,a)=>({u_matrix:u,u_texture:0,u_ele_delta:t,u_fog_matrix:s,u_fog_color:o?o.properties.get("fog-color"):c.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"):c.aN.white,u_horizon_fog_blend:o?o.properties.get("horizon-fog-blend"):1});function Ks(u){const t=[];for(let s=0;s<u.length;s++){if(u[s]===null)continue;const o=u[s].split(" ");t.push(o.pop())}return t}class kn{constructor(t,s,o,a,h,g){const y=t.gl;this.program=y.createProgram();const v=Ks(s.staticAttributes),w=o?o.getBinderAttributes():[],A=v.concat(w),I=Or.prelude.staticUniforms?Ks(Or.prelude.staticUniforms):[],L=s.staticUniforms?Ks(s.staticUniforms):[],F=o?o.getBinderUniforms():[],$=I.concat(L).concat(F),Z=[];for(const le of $)Z.indexOf(le)<0&&Z.push(le);const j=o?o.defines():[];h&&j.push("#define OVERDRAW_INSPECTOR;"),g&&j.push("#define TERRAIN3D;");const H=j.concat(Or.prelude.fragmentSource,s.fragmentSource).join(`
|
579
|
+
`),K=j.concat(Or.prelude.vertexSource,s.vertexSource).join(`
|
580
|
+
`),N=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);if(y.shaderSource(N,H),y.compileShader(N),!y.getShaderParameter(N,y.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${y.getShaderInfoLog(N)}`);y.attachShader(this.program,N);const ee=y.createShader(y.VERTEX_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);if(y.shaderSource(ee,K),y.compileShader(ee),!y.getShaderParameter(ee,y.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${y.getShaderInfoLog(ee)}`);y.attachShader(this.program,ee),this.attributes={};const se={};this.numAttributes=A.length;for(let le=0;le<this.numAttributes;le++)A[le]&&(y.bindAttribLocation(this.program,le,A[le]),this.attributes[A[le]]=le);if(y.linkProgram(this.program),!y.getProgramParameter(this.program,y.LINK_STATUS))throw new Error(`Program failed to link: ${y.getProgramInfoLog(this.program)}`);y.deleteShader(ee),y.deleteShader(N);for(let le=0;le<Z.length;le++){const me=Z[le];if(me&&!se[me]){const ve=y.getUniformLocation(this.program,me);ve&&(se[me]=ve)}}this.fixedUniforms=a(t,se),this.terrainUniforms=((le,me)=>({u_depth:new c.aI(le,me.u_depth),u_terrain:new c.aI(le,me.u_terrain),u_terrain_dim:new c.aJ(le,me.u_terrain_dim),u_terrain_matrix:new c.aK(le,me.u_terrain_matrix),u_terrain_unpack:new c.aL(le,me.u_terrain_unpack),u_terrain_exaggeration:new c.aJ(le,me.u_terrain_exaggeration)}))(t,se),this.binderUniforms=o?o.getUniforms(t,se):[]}draw(t,s,o,a,h,g,y,v,w,A,I,L,F,$,Z,j,H,K){const N=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(o),t.setStencilMode(a),t.setColorMode(h),t.setCullFace(g),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 se in this.terrainUniforms)this.terrainUniforms[se].set(v[se])}for(const se in this.fixedUniforms)this.fixedUniforms[se].set(y[se]);Z&&Z.setUniforms(t,this.binderUniforms,F,{zoom:$});let ee=0;switch(s){case N.LINES:ee=2;break;case N.TRIANGLES:ee=3;break;case N.LINE_STRIP:ee=1}for(const se of L.get()){const le=se.vaos||(se.vaos={});(le[w]||(le[w]=new Pn)).bind(t,this,A,Z?Z.getPaintVertexBuffers():[],I,se.vertexOffset,j,H,K),N.drawElements(s,se.primitiveLength*ee,N.UNSIGNED_SHORT,se.primitiveOffset*ee*2)}}}function Cn(u,t,s){const o=1/it(s,1,t.transform.tileZoom),a=Math.pow(2,s.tileID.overscaledZ),h=s.tileSize*Math.pow(2,t.transform.tileZoom)/a,g=h*(s.tileID.canonical.x+s.tileID.wrap*a),y=h*s.tileID.canonical.y;return{u_image:0,u_texsize:s.imageAtlasTexture.size,u_scale:[o,u.fromScale,u.toScale],u_fade:u.t,u_pixel_coord_upper:[g>>16,y>>16],u_pixel_coord_lower:[65535&g,65535&y]}}const Mn=(u,t,s,o)=>{const a=t.style.light,h=a.properties.get("position"),g=[h.x,h.y,h.z],y=function(){var w=new c.A(9);return c.A!=Float32Array&&(w[1]=0,w[2]=0,w[3]=0,w[5]=0,w[6]=0,w[7]=0),w[0]=1,w[4]=1,w[8]=1,w}();a.properties.get("anchor")==="viewport"&&function(w,A){var I=Math.sin(A),L=Math.cos(A);w[0]=L,w[1]=I,w[2]=0,w[3]=-I,w[4]=L,w[5]=0,w[6]=0,w[7]=0,w[8]=1}(y,-t.transform.angle),function(w,A,I){var L=A[0],F=A[1],$=A[2];w[0]=L*I[0]+F*I[3]+$*I[6],w[1]=L*I[1]+F*I[4]+$*I[7],w[2]=L*I[2]+F*I[5]+$*I[8]}(g,g,y);const v=a.properties.get("color");return{u_matrix:u,u_lightpos:g,u_lightintensity:a.properties.get("intensity"),u_lightcolor:[v.r,v.g,v.b],u_vertical_gradient:+s,u_opacity:o}},zn=(u,t,s,o,a,h,g)=>c.e(Mn(u,t,s,o),Cn(h,t,g),{u_height_factor:-Math.pow(2,a.overscaledZ)/g.tileSize/8}),Ys=u=>({u_matrix:u}),vs=(u,t,s,o)=>c.e(Ys(u),Cn(s,t,o)),Nl=(u,t)=>({u_matrix:u,u_world:t}),jl=(u,t,s,o,a)=>c.e(vs(u,t,s,o),{u_world:a}),Ra=(u,t,s,o)=>{const a=u.transform;let h,g;if(o.paint.get("circle-pitch-alignment")==="map"){const y=it(s,1,a.zoom);h=!0,g=[y,y]}else h=!1,g=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,s,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:g}},Ul=(u,t,s)=>({u_matrix:u,u_inv_matrix:t,u_camera_to_center_distance:s.cameraToCenterDistance,u_viewport_size:[s.width,s.height]}),Vr=(u,t,s=1)=>({u_matrix:u,u_color:t,u_overlay:0,u_overlay_scale:s}),Qs=u=>({u_matrix:u}),Fi=(u,t,s,o)=>({u_matrix:u,u_extrude_scale:it(t,1,s),u_intensity:o});function Oi(u,t){const s=Math.pow(2,t.canonical.z),o=t.canonical.y;return[new c.Z(0,o/s).toLngLat().lat,new c.Z(0,(o+1)/s).toLngLat().lat]}const en=(u,t,s,o)=>{const a=u.transform;return{u_matrix:Oa(u,t,s,o),u_ratio:1/it(t,1,a.zoom),u_device_pixel_ratio:u.pixelRatio,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},Dn=(u,t,s,o,a)=>c.e(en(u,t,s,a),{u_image:0,u_image_height:o}),Ba=(u,t,s,o,a)=>{const h=u.transform,g=es(t,h);return{u_matrix:Oa(u,t,s,a),u_texsize:t.imageAtlasTexture.size,u_ratio:1/it(t,1,h.zoom),u_device_pixel_ratio:u.pixelRatio,u_image:0,u_scale:[g,o.fromScale,o.toScale],u_fade:o.t,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]]}},Fa=(u,t,s,o,a,h)=>{const g=u.lineAtlas,y=es(t,u.transform),v=s.layout.get("line-cap")==="round",w=g.getDash(o.from,v),A=g.getDash(o.to,v),I=w.width*a.fromScale,L=A.width*a.toScale;return c.e(en(u,t,s,h),{u_patternscale_a:[y/I,-w.height/2],u_patternscale_b:[y/L,-A.height/2],u_sdfgamma:g.width/(256*Math.min(I,L)*u.pixelRatio)/2,u_image:0,u_tex_y_a:w.y,u_tex_y_b:A.y,u_mix:a.t})};function es(u,t){return 1/it(u,1,t.tileZoom)}function Oa(u,t,s,o){return u.translatePosMatrix(o?o.posMatrix:t.tileID.posMatrix,t,s.paint.get("line-translate"),s.paint.get("line-translate-anchor"))}const ql=(u,t,s,o,a)=>{return{u_matrix:u,u_tl_parent:t,u_scale_parent:s,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:(g=a.paint.get("raster-saturation"),g>0?1-1/(1.001-g):-g),u_contrast_factor:(h=a.paint.get("raster-contrast"),h>0?1/(1-h):1+h),u_spin_weights:Zl(a.paint.get("raster-hue-rotate"))};var h,g};function Zl(u){u*=Math.PI/180;const t=Math.sin(u),s=Math.cos(u);return[(2*s+1)/3,(-Math.sqrt(3)*t-s+1)/3,(Math.sqrt(3)*t-s+1)/3]}const Va=(u,t,s,o,a,h,g,y,v,w,A,I,L,F)=>{const $=g.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:$.cameraToCenterDistance,u_pitch:$.pitch/360*2*Math.PI,u_rotate_symbol:+s,u_aspect_ratio:$.width/$.height,u_fade_change:g.options.fadeDuration?g.symbolFadeChange:1,u_matrix:y,u_label_plane_matrix:v,u_coord_matrix:w,u_is_text:+I,u_pitch_with_map:+o,u_is_along_line:a,u_is_variable_anchor:h,u_texsize:L,u_texture:0,u_translation:A,u_pitched_scale:F}},$a=(u,t,s,o,a,h,g,y,v,w,A,I,L,F,$)=>{const Z=g.transform;return c.e(Va(u,t,s,o,a,h,g,y,v,w,A,I,L,$),{u_gamma_scale:o?Math.cos(Z._pitch)*Z.cameraToCenterDistance:1,u_device_pixel_ratio:g.pixelRatio,u_is_halo:+F})},Gl=(u,t,s,o,a,h,g,y,v,w,A,I,L,F)=>c.e($a(u,t,s,o,a,h,g,y,v,w,A,!0,I,!0,F),{u_texsize_icon:L,u_texture_icon:1}),Ln=(u,t,s)=>({u_matrix:u,u_opacity:t,u_color:s}),To=(u,t,s,o,a,h)=>c.e(function(g,y,v,w){const A=v.imageManager.getPattern(g.from.toString()),I=v.imageManager.getPattern(g.to.toString()),{width:L,height:F}=v.imageManager.getPixelSize(),$=Math.pow(2,w.tileID.overscaledZ),Z=w.tileSize*Math.pow(2,v.transform.tileZoom)/$,j=Z*(w.tileID.canonical.x+w.tileID.wrap*$),H=Z*w.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:A.tl,u_pattern_br_a:A.br,u_pattern_tl_b:I.tl,u_pattern_br_b:I.br,u_texsize:[L,F],u_mix:y.t,u_pattern_size_a:A.displaySize,u_pattern_size_b:I.displaySize,u_scale_a:y.fromScale,u_scale_b:y.toScale,u_tile_units_to_pixels:1/it(w,1,v.transform.tileZoom),u_pixel_coord_upper:[j>>16,H>>16],u_pixel_coord_lower:[65535&j,65535&H]}}(o,h,s,a),{u_matrix:u,u_opacity:t}),Rn={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 Eo{constructor(t,s,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,s.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||delete s.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const s=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),s.bufferSubData(s.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ao={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class dr{constructor(t,s,o,a){this.length=s.length,this.attributes=o,this.itemSize=s.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,s.arrayBuffer,this.dynamicDraw?h.DYNAMIC_DRAW:h.STATIC_DRAW),this.dynamicDraw||delete s.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 s=this.context.gl;this.bind(),s.bufferSubData(s.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,s){for(let o=0;o<this.attributes.length;o++){const a=s.attributes[this.attributes[o].name];a!==void 0&&t.enableVertexAttribArray(a)}}setVertexAttribPointers(t,s,o){for(let a=0;a<this.attributes.length;a++){const h=this.attributes[a],g=s.attributes[h.name];g!==void 0&&t.vertexAttribPointer(g,h.components,t[Ao[h.type]],!1,this.itemSize,h.offset+this.itemSize*(o||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Io=new WeakMap;function bs(u){var t;if(Io.has(u))return Io.get(u);{const s=(t=u.getParameter(u.VERSION))===null||t===void 0?void 0:t.startsWith("WebGL 2.0");return Io.set(u,s),s}}class ht{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 tn extends ht{getDefault(){return c.aN.transparent}set(t){const s=this.current;(t.r!==s.r||t.g!==s.g||t.b!==s.b||t.a!==s.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Hl extends ht{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Bn extends ht{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Wl extends ht{getDefault(){return[!0,!0,!0,!0]}set(t){const s=this.current;(t[0]!==s[0]||t[1]!==s[1]||t[2]!==s[2]||t[3]!==s[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class ws extends ht{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Xl extends ht{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class Na extends ht{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const s=this.current;(t.func!==s.func||t.ref!==s.ref||t.mask!==s.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class Jl extends ht{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const s=this.current;(t[0]!==s[0]||t[1]!==s[1]||t[2]!==s[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class ja extends ht{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const s=this.gl;t?s.enable(s.STENCIL_TEST):s.disable(s.STENCIL_TEST),this.current=t,this.dirty=!1}}class Po extends ht{getDefault(){return[0,1]}set(t){const s=this.current;(t[0]!==s[0]||t[1]!==s[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class Ua extends ht{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const s=this.gl;t?s.enable(s.DEPTH_TEST):s.disable(s.DEPTH_TEST),this.current=t,this.dirty=!1}}class qa extends ht{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Za extends ht{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const s=this.gl;t?s.enable(s.BLEND):s.disable(s.BLEND),this.current=t,this.dirty=!1}}class Ga extends ht{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const s=this.current;(t[0]!==s[0]||t[1]!==s[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class ts extends ht{getDefault(){return c.aN.transparent}set(t){const s=this.current;(t.r!==s.r||t.g!==s.g||t.b!==s.b||t.a!==s.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Ha extends ht{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Kl extends ht{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const s=this.gl;t?s.enable(s.CULL_FACE):s.disable(s.CULL_FACE),this.current=t,this.dirty=!1}}class Yl extends ht{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Wa extends ht{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class rn extends ht{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Ql extends ht{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Fn extends ht{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const s=this.current;(t[0]!==s[0]||t[1]!==s[1]||t[2]!==s[2]||t[3]!==s[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class ec extends ht{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const s=this.gl;s.bindFramebuffer(s.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class tc extends ht{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const s=this.gl;s.bindRenderbuffer(s.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Xa extends ht{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const s=this.gl;s.bindTexture(s.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class Ja extends ht{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const s=this.gl;s.bindBuffer(s.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Ka extends ht{getDefault(){return null}set(t){const s=this.gl;s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class ko extends ht{getDefault(){return null}set(t){var s;if(t===this.current&&!this.dirty)return;const o=this.gl;bs(o)?o.bindVertexArray(t):(s=o.getExtension("OES_vertex_array_object"))===null||s===void 0||s.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class Ya extends ht{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const s=this.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class On extends ht{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const s=this.gl;s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class Tr extends ht{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const s=this.gl;s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class sn extends ht{constructor(t,s){super(t),this.context=t,this.parent=s}getDefault(){return null}}class Co extends sn{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const s=this.gl;s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Mo extends sn{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const s=this.gl;s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Qa extends sn{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const s=this.gl;s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class zo{constructor(t,s,o,a,h){this.context=t,this.width=s,this.height=o;const g=t.gl,y=this.framebuffer=g.createFramebuffer();if(this.colorAttachment=new Co(t,y),a)this.depthAttachment=h?new Qa(t,y):new Mo(t,y);else if(h)throw new Error("Stencil cannot be set without depth");if(g.checkFramebufferStatus(g.FRAMEBUFFER)!==g.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const t=this.context.gl,s=this.colorAttachment.get();if(s&&t.deleteTexture(s),this.depthAttachment){const o=this.depthAttachment.get();o&&t.deleteRenderbuffer(o)}t.deleteFramebuffer(this.framebuffer)}}class At{constructor(t,s,o){this.blendFunction=t,this.blendColor=s,this.mask=o}}At.Replace=[1,0],At.disabled=new At(At.Replace,c.aN.transparent,[!1,!1,!1,!1]),At.unblended=new At(At.Replace,c.aN.transparent,[!0,!0,!0,!0]),At.alphaBlended=new At([1,771],c.aN.transparent,[!0,!0,!0,!0]);class Do{constructor(t){var s,o;if(this.gl=t,this.clearColor=new tn(this),this.clearDepth=new Hl(this),this.clearStencil=new Bn(this),this.colorMask=new Wl(this),this.depthMask=new ws(this),this.stencilMask=new Xl(this),this.stencilFunc=new Na(this),this.stencilOp=new Jl(this),this.stencilTest=new ja(this),this.depthRange=new Po(this),this.depthTest=new Ua(this),this.depthFunc=new qa(this),this.blend=new Za(this),this.blendFunc=new Ga(this),this.blendColor=new ts(this),this.blendEquation=new Ha(this),this.cullFace=new Kl(this),this.cullFaceSide=new Yl(this),this.frontFace=new Wa(this),this.program=new rn(this),this.activeTexture=new Ql(this),this.viewport=new Fn(this),this.bindFramebuffer=new ec(this),this.bindRenderbuffer=new tc(this),this.bindTexture=new Xa(this),this.bindVertexBuffer=new Ja(this),this.bindElementBuffer=new Ka(this),this.bindVertexArray=new ko(this),this.pixelStoreUnpack=new Ya(this),this.pixelStoreUnpackPremultiplyAlpha=new On(this),this.pixelStoreUnpackFlipY=new Tr(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),bs(t)){this.HALF_FLOAT=t.HALF_FLOAT;const a=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(s=t.RGBA16F)!==null&&s!==void 0?s: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,s){return new Eo(this,t,s)}createVertexBuffer(t,s,o){return new dr(this,t,s,o)}createRenderbuffer(t,s,o){const a=this.gl,h=a.createRenderbuffer();return this.bindRenderbuffer.set(h),a.renderbufferStorage(a.RENDERBUFFER,t,s,o),this.bindRenderbuffer.set(null),h}createFramebuffer(t,s,o,a){return new zo(this,t,s,o,a)}clear({color:t,depth:s,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])),s!==void 0&&(h|=a.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(s),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,At.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 bs(this.gl)?this.gl.createVertexArray():(t=this.gl.getExtension("OES_vertex_array_object"))===null||t===void 0?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var s;return bs(this.gl)?this.gl.deleteVertexArray(t):(s=this.gl.getExtension("OES_vertex_array_object"))===null||s===void 0?void 0:s.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}class lt{constructor(t,s,o){this.func=t,this.mask=s,this.range=o}}lt.ReadOnly=!1,lt.ReadWrite=!0,lt.disabled=new lt(519,lt.ReadOnly,[0,1]);const Lo=7680;class Ot{constructor(t,s,o,a,h,g){this.test=t,this.ref=s,this.mask=o,this.fail=a,this.depthFail=h,this.pass=g}}Ot.disabled=new Ot({func:519,mask:0},0,0,Lo,Lo,Lo);class Mt{constructor(t,s,o){this.enable=t,this.mode=s,this.frontFace=o}}let nn;function el(u,t,s,o,a){const h=u.context,g=h.gl,y=u.useProgram("collisionBox"),v=[];let w=0,A=0;for(let H=0;H<o.length;H++){const K=o[H],N=t.getTile(K).getBucket(s);if(!N)continue;const ee=a?N.textCollisionBox:N.iconCollisionBox,se=N.collisionCircleArray;if(se.length>0){const le=c.H();c.aR(le,N.placementInvProjMatrix,u.transform.glCoordMatrix),c.aR(le,le,N.placementViewportMatrix),v.push({circleArray:se,circleOffset:A,transform:K.posMatrix,invTransform:le,coord:K}),w+=se.length/4,A=w}ee&&y.draw(h,g.LINES,lt.disabled,Ot.disabled,u.colorModeForRenderPass(),Mt.disabled,{u_matrix:K.posMatrix,u_pixel_extrude_scale:[1/(I=u.transform).width,1/I.height]},u.style.map.terrain&&u.style.map.terrain.getTerrainData(K),s.id,ee.layoutVertexBuffer,ee.indexBuffer,ee.segments,null,u.transform.zoom,null,null,ee.collisionVertexBuffer)}var I;if(!a||!v.length)return;const L=u.useProgram("collisionCircle"),F=new c.aS;F.resize(4*w),F._trim();let $=0;for(const H of v)for(let K=0;K<H.circleArray.length/4;K++){const N=4*K,ee=H.circleArray[N+0],se=H.circleArray[N+1],le=H.circleArray[N+2],me=H.circleArray[N+3];F.emplace($++,ee,se,le,me,0),F.emplace($++,ee,se,le,me,1),F.emplace($++,ee,se,le,me,2),F.emplace($++,ee,se,le,me,3)}(!nn||nn.length<2*w)&&(nn=function(H){const K=2*H,N=new c.aU;N.resize(K),N._trim();for(let ee=0;ee<K;ee++){const se=6*ee;N.uint16[se+0]=4*ee+0,N.uint16[se+1]=4*ee+1,N.uint16[se+2]=4*ee+2,N.uint16[se+3]=4*ee+2,N.uint16[se+4]=4*ee+3,N.uint16[se+5]=4*ee+0}return N}(w));const Z=h.createIndexBuffer(nn,!0),j=h.createVertexBuffer(F,c.aT.members,!0);for(const H of v){const K=Ul(H.transform,H.invTransform,u.transform);L.draw(h,g.TRIANGLES,lt.disabled,Ot.disabled,u.colorModeForRenderPass(),Mt.disabled,K,u.style.map.terrain&&u.style.map.terrain.getTerrainData(H.coord),s.id,j,Z,c.a0.simpleSegment(0,2*H.circleOffset,H.circleArray.length,H.circleArray.length/2),null,u.transform.zoom,null,null,null)}j.destroy(),Z.destroy()}Mt.disabled=new Mt(!1,1029,2305),Mt.backCCW=new Mt(!0,1029,2305);const Ro=c.ao(new Float32Array(16));function Vn(u,t,s,o,a,h){const{horizontalAlign:g,verticalAlign:y}=c.av(u);return new c.P((-(g-.5)*t/a+o[0])*h,(-(y-.5)*s/a+o[1])*h)}function $n(u,t,s,o,a,h){const g=t.tileAnchorPoint.add(new c.P(t.translation[0],t.translation[1]));if(t.pitchWithMap){let y=o.mult(h);return s||(y=y.rotate(-a)),G(g.add(y),t.labelPlaneMatrix,t.getElevation).point}if(s){const y=de(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(u),v=Math.atan(y.y/y.x)+(y.x<0?Math.PI:0);return u.add(o.rotate(v))}return u.add(o)}function Nn(u,t,s,o,a,h,g,y,v,w,A,I,L,F){const $=u.text.placedSymbolArray,Z=u.text.dynamicLayoutVertexArray,j=u.icon.dynamicLayoutVertexArray,H={};Z.clear();for(let K=0;K<$.length;K++){const N=$.get(K),ee=N.hidden||!N.crossTileID||u.allowVerticalPlacement&&!N.placedOrientation?null:o[N.crossTileID];if(ee){const se=new c.P(N.anchorX,N.anchorY),le={getElevation:F,width:a.width,height:a.height,labelPlaneMatrix:h,lineVertexArray:null,pitchWithMap:s,projection:A,projectionCache:null,tileAnchorPoint:se,translation:I,unwrappedTileID:L},me=s?G(se,g,F):de(se.x,se.y,le),ve=z(a.cameraToCenterDistance,me.signedDistanceFromCamera);let Me=c.aj(u.textSizeData,v,N)*ve/c.aq;s&&(Me*=u.tilePixelRatio/y);const{width:De,height:be,anchor:we,textOffset:Oe,textBoxScale:Qe}=ee,Ee=Vn(we,De,be,Oe,Qe,Me),Pe=A.getPitchedTextCorrection(a,se.add(new c.P(I[0],I[1])),L),Ke=$n(me.point,le,t,Ee,a.angle,Pe),Dt=u.allowVerticalPlacement&&N.placedOrientation===c.ai.vertical?Math.PI/2:0;for(let st=0;st<N.numGlyphs;st++)c.ak(Z,Ke,Dt);w&&N.associatedIconIndex>=0&&(H[N.associatedIconIndex]={shiftedAnchor:Ke,angle:Dt})}else Ge(N.numGlyphs,Z)}if(w){j.clear();const K=u.icon.placedSymbolArray;for(let N=0;N<K.length;N++){const ee=K.get(N);if(ee.hidden)Ge(ee.numGlyphs,j);else{const se=H[N];if(se)for(let le=0;le<ee.numGlyphs;le++)c.ak(j,se.shiftedAnchor,se.angle);else Ge(ee.numGlyphs,j)}}u.icon.dynamicLayoutVertexBuffer.updateData(j)}u.text.dynamicLayoutVertexBuffer.updateData(Z)}function Bo(u,t,s){return s.iconsInText&&t?"symbolTextAndIcon":u?"symbolSDF":"symbolIcon"}function $r(u,t,s,o,a,h,g,y,v,w,A,I){const L=u.context,F=L.gl,$=u.transform,Z=An(),j=y==="map",H=v==="map",K=y!=="viewport"&&s.layout.get("symbol-placement")!=="point",N=j&&!H&&!K,ee=!H&&K,se=!s.layout.get("symbol-sort-key").isConstant();let le=!1;const me=u.depthModeForSublayer(0,lt.ReadOnly),ve=s._unevaluatedLayout.hasValue("text-variable-anchor")||s._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Me=[],De=Z.getCircleRadiusCorrection($);for(const be of o){const we=t.getTile(be),Oe=we.getBucket(s);if(!Oe)continue;const Qe=a?Oe.text:Oe.icon;if(!Qe||!Qe.segments.get().length||!Qe.hasVisibleVertices)continue;const Ee=Qe.programConfigurations.get(s.id),Pe=a||Oe.sdfIcons,Ke=a?Oe.textSizeData:Oe.iconSizeData,Dt=H||$.pitch!==0,st=u.useProgram(Bo(Pe,a,Oe),Ee),ct=c.ah(Ke,$.zoom),Lt=u.style.map.terrain&&u.style.map.terrain.getTerrainData(be);let ci,Ki,Rt,Ii,bi=[0,0],hi=null;if(a)Ki=we.glyphAtlasTexture,Rt=F.LINEAR,ci=we.glyphAtlasTexture.size,Oe.iconsInText&&(bi=we.imageAtlasTexture.size,hi=we.imageAtlasTexture,Ii=Dt||u.options.rotating||u.options.zooming||Ke.kind==="composite"||Ke.kind==="camera"?F.LINEAR:F.NEAREST);else{const Vt=s.layout.get("icon-size").constantOr(0)!==1||Oe.iconsNeedLinear;Ki=we.imageAtlasTexture,Rt=Pe||u.options.rotating||u.options.zooming||Vt||Dt?F.LINEAR:F.NEAREST,ci=we.imageAtlasTexture.size}const ui=it(we,1,u.transform.zoom),Yi=ee?be.posMatrix:Ro,cs=Br(Yi,H,j,u.transform,ui),io=ur(Yi,H,j,u.transform,ui),Ms=ur(be.posMatrix,H,j,u.transform,ui),hs=Z.translatePosition(u.transform,we,h,g),ro=ve&&Oe.hasTextData(),pa=s.layout.get("icon-text-fit")!=="none"&&ro&&Oe.hasIconData();if(K){const Vt=u.style.map.terrain?(fa,Kt)=>u.style.map.terrain.getElevation(be,fa,Kt):null,Ds=s.layout.get("text-rotation-alignment")==="map";V(Oe,be.posMatrix,u,a,cs,Ms,H,w,Ds,Z,be.toUnwrapped(),$.width,$.height,hs,Vt)}const ii=be.posMatrix,Qi=a&&ve||pa,Ur=K||Qi?Ro:cs,zs=io,di=Pe&&s.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let pi;pi=Pe?Oe.iconsInText?Gl(Ke.kind,ct,N,H,K,Qi,u,ii,Ur,zs,hs,ci,bi,De):$a(Ke.kind,ct,N,H,K,Qi,u,ii,Ur,zs,hs,a,ci,!0,De):Va(Ke.kind,ct,N,H,K,Qi,u,ii,Ur,zs,hs,a,ci,De);const Qt={program:st,buffers:Qe,uniformValues:pi,atlasTexture:Ki,atlasTextureIcon:hi,atlasInterpolation:Rt,atlasInterpolationIcon:Ii,isSDF:Pe,hasHalo:di};if(se&&Oe.canOverlap){le=!0;const Vt=Qe.segments.get();for(const Ds of Vt)Me.push({segments:new c.a0([Ds]),sortKey:Ds.sortKey,state:Qt,terrainData:Lt})}else Me.push({segments:Qe.segments,sortKey:0,state:Qt,terrainData:Lt})}le&&Me.sort((be,we)=>be.sortKey-we.sortKey);for(const be of Me){const we=be.state;if(L.activeTexture.set(F.TEXTURE0),we.atlasTexture.bind(we.atlasInterpolation,F.CLAMP_TO_EDGE),we.atlasTextureIcon&&(L.activeTexture.set(F.TEXTURE1),we.atlasTextureIcon&&we.atlasTextureIcon.bind(we.atlasInterpolationIcon,F.CLAMP_TO_EDGE)),we.isSDF){const Oe=we.uniformValues;we.hasHalo&&(Oe.u_is_halo=1,is(we.buffers,be.segments,s,u,we.program,me,A,I,Oe,be.terrainData)),Oe.u_is_halo=0}is(we.buffers,be.segments,s,u,we.program,me,A,I,we.uniformValues,be.terrainData)}}function is(u,t,s,o,a,h,g,y,v,w){const A=o.context;a.draw(A,A.gl.TRIANGLES,h,g,y,Mt.disabled,v,w,s.id,u.layoutVertexBuffer,u.indexBuffer,t,s.paint,o.transform.zoom,u.programConfigurations.get(s.id),u.dynamicLayoutVertexBuffer,u.opacityVertexBuffer)}function Vi(u,t,s,o,a){if(!s||!o||!o.imageAtlas)return;const h=o.imageAtlas.patternPositions;let g=h[s.to.toString()],y=h[s.from.toString()];if(!g&&y&&(g=y),!y&&g&&(y=g),!g||!y){const v=a.getPaintProperty(t);g=h[v],y=h[v]}g&&y&&u.setConstantPatternPositions(g,y)}function Fo(u,t,s,o,a,h,g){const y=u.context.gl,v="fill-pattern",w=s.paint.get(v),A=w&&w.constantOr(1),I=s.getCrossfadeParameters();let L,F,$,Z,j;g?(F=A&&!s.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",L=y.LINES):(F=A?"fillPattern":"fill",L=y.TRIANGLES);const H=w.constantOr(null);for(const K of o){const N=t.getTile(K);if(A&&!N.patternsLoaded())continue;const ee=N.getBucket(s);if(!ee)continue;const se=ee.programConfigurations.get(s.id),le=u.useProgram(F,se),me=u.style.map.terrain&&u.style.map.terrain.getTerrainData(K);A&&(u.context.activeTexture.set(y.TEXTURE0),N.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),se.updatePaintBuffers(I)),Vi(se,v,H,N,s);const ve=me?K:null,Me=u.translatePosMatrix(ve?ve.posMatrix:K.posMatrix,N,s.paint.get("fill-translate"),s.paint.get("fill-translate-anchor"));if(g){Z=ee.indexBuffer2,j=ee.segments2;const De=[y.drawingBufferWidth,y.drawingBufferHeight];$=F==="fillOutlinePattern"&&A?jl(Me,u,I,N,De):Nl(Me,De)}else Z=ee.indexBuffer,j=ee.segments,$=A?vs(Me,u,I,N):Ys(Me);le.draw(u.context,L,a,u.stencilModeForClipping(K),h,Mt.disabled,$,me,s.id,ee.layoutVertexBuffer,Z,j,s.paint,u.transform.zoom,se)}}function jn(u,t,s,o,a,h,g){const y=u.context,v=y.gl,w="fill-extrusion-pattern",A=s.paint.get(w),I=A.constantOr(1),L=s.getCrossfadeParameters(),F=s.paint.get("fill-extrusion-opacity"),$=A.constantOr(null);for(const Z of o){const j=t.getTile(Z),H=j.getBucket(s);if(!H)continue;const K=u.style.map.terrain&&u.style.map.terrain.getTerrainData(Z),N=H.programConfigurations.get(s.id),ee=u.useProgram(I?"fillExtrusionPattern":"fillExtrusion",N);I&&(u.context.activeTexture.set(v.TEXTURE0),j.imageAtlasTexture.bind(v.LINEAR,v.CLAMP_TO_EDGE),N.updatePaintBuffers(L)),Vi(N,w,$,j,s);const se=u.translatePosMatrix(Z.posMatrix,j,s.paint.get("fill-extrusion-translate"),s.paint.get("fill-extrusion-translate-anchor")),le=s.paint.get("fill-extrusion-vertical-gradient"),me=I?zn(se,u,le,F,Z,L,j):Mn(se,u,le,F);ee.draw(y,y.gl.TRIANGLES,a,h,g,Mt.backCCW,me,K,s.id,H.layoutVertexBuffer,H.indexBuffer,H.segments,s.paint,u.transform.zoom,N,u.style.map.terrain&&H.centroidVertexBuffer)}}function Oo(u,t,s,o,a,h,g){const y=u.context,v=y.gl,w=s.fbo;if(!w)return;const A=u.useProgram("hillshade"),I=u.style.map.terrain&&u.style.map.terrain.getTerrainData(t);y.activeTexture.set(v.TEXTURE0),v.bindTexture(v.TEXTURE_2D,w.colorAttachment.get()),A.draw(y,v.TRIANGLES,a,h,g,Mt.disabled,((L,F,$,Z)=>{const j=$.paint.get("hillshade-shadow-color"),H=$.paint.get("hillshade-highlight-color"),K=$.paint.get("hillshade-accent-color");let N=$.paint.get("hillshade-illumination-direction")*(Math.PI/180);$.paint.get("hillshade-illumination-anchor")==="viewport"&&(N-=L.transform.angle);const ee=!L.options.moving;return{u_matrix:Z?Z.posMatrix:L.transform.calculatePosMatrix(F.tileID.toUnwrapped(),ee),u_image:0,u_latrange:Oi(0,F.tileID),u_light:[$.paint.get("hillshade-exaggeration"),N],u_shadow:j,u_highlight:H,u_accent:K}})(u,s,o,I?t:null),I,o.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments)}function rs(u,t,s,o,a,h){const g=u.context,y=g.gl,v=t.dem;if(v&&v.data){const w=v.dim,A=v.stride,I=v.getPixels();if(g.activeTexture.set(y.TEXTURE1),g.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||u.getTileTexture(A),t.demTexture){const F=t.demTexture;F.update(I,{premultiply:!1}),F.bind(y.NEAREST,y.CLAMP_TO_EDGE)}else t.demTexture=new vt(g,I,y.RGBA,{premultiply:!1}),t.demTexture.bind(y.NEAREST,y.CLAMP_TO_EDGE);g.activeTexture.set(y.TEXTURE0);let L=t.fbo;if(!L){const F=new vt(g,{width:w,height:w,data:null},y.RGBA);F.bind(y.LINEAR,y.CLAMP_TO_EDGE),L=t.fbo=g.createFramebuffer(w,w,!0,!1),L.colorAttachment.set(F.texture)}g.bindFramebuffer.set(L.framebuffer),g.viewport.set([0,0,w,w]),u.useProgram("hillshadePrepare").draw(g,y.TRIANGLES,o,a,h,Mt.disabled,((F,$)=>{const Z=$.stride,j=c.H();return c.aQ(j,0,c.X,-c.X,0,0,1),c.J(j,j,[0,-c.X,0]),{u_matrix:j,u_image:1,u_dimension:[Z,Z],u_zoom:F.overscaledZ,u_unpack:$.getUnpackVector()}})(t.tileID,v),null,s.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function Un(u,t,s,o,a,h){const g=o.paint.get("raster-fade-duration");if(!h&&g>0){const y=ae.now(),v=(y-u.timeAdded)/g,w=t?(y-t.timeAdded)/g:-1,A=s.getSource(),I=a.coveringZoomLevel({tileSize:A.tileSize,roundZoom:A.roundZoom}),L=!t||Math.abs(t.tileID.overscaledZ-I)>Math.abs(u.tileID.overscaledZ-I),F=L&&u.refreshedUponExpiration?1:c.ad(L?v:1-w,0,1);return u.refreshedUponExpiration&&v>=1&&(u.refreshedUponExpiration=!1),t?{opacity:1,mix:1-F}:{opacity:F,mix:0}}return{opacity:1,mix:0}}const qn=new c.aN(1,0,0,1),on=new c.aN(0,1,0,1),Zn=new c.aN(0,0,1,1),tl=new c.aN(1,0,1,1),Ss=new c.aN(0,1,1,1);function ss(u,t,s,o){Ts(u,0,t+s/2,u.transform.width,s,o)}function Vo(u,t,s,o){Ts(u,t-s/2,0,s,u.transform.height,o)}function Ts(u,t,s,o,a,h){const g=u.context,y=g.gl;y.enable(y.SCISSOR_TEST),y.scissor(t*u.pixelRatio,s*u.pixelRatio,o*u.pixelRatio,a*u.pixelRatio),g.clear({color:h}),y.disable(y.SCISSOR_TEST)}function pt(u,t,s){const o=u.context,a=o.gl,h=s.posMatrix,g=u.useProgram("debug"),y=lt.disabled,v=Ot.disabled,w=u.colorModeForRenderPass(),A="$debug",I=u.style.map.terrain&&u.style.map.terrain.getTerrainData(s);o.activeTexture.set(a.TEXTURE0);const L=t.getTileByID(s.key).latestRawTileData,F=Math.floor((L&&L.byteLength||0)/1024),$=t.getTile(s).tileSize,Z=512/Math.min($,512)*(s.overscaledZ/u.transform.zoom)*.5;let j=s.canonical.toString();s.overscaledZ!==s.canonical.z&&(j+=` => ${s.overscaledZ}`),function(H,K){H.initDebugOverlayCanvas();const N=H.debugOverlayCanvas,ee=H.context.gl,se=H.debugOverlayCanvas.getContext("2d");se.clearRect(0,0,N.width,N.height),se.shadowColor="white",se.shadowBlur=2,se.lineWidth=1.5,se.strokeStyle="white",se.textBaseline="top",se.font="bold 36px Open Sans, sans-serif",se.fillText(K,5,5),se.strokeText(K,5,5),H.debugOverlayTexture.update(N),H.debugOverlayTexture.bind(ee.LINEAR,ee.CLAMP_TO_EDGE)}(u,`${j} ${F}kB`),g.draw(o,a.TRIANGLES,y,v,At.alphaBlended,Mt.disabled,Vr(h,c.aN.transparent,Z),null,A,u.debugBuffer,u.quadTriangleIndexBuffer,u.debugSegments),g.draw(o,a.LINE_STRIP,y,v,w,Mt.disabled,Vr(h,c.aN.red),I,A,u.debugBuffer,u.tileBorderIndexBuffer,u.debugSegments)}function an(u,t,s){const o=u.context,a=o.gl,h=u.colorModeForRenderPass(),g=new lt(a.LEQUAL,lt.ReadWrite,u.depthRangeFor3D),y=u.useProgram("terrain"),v=t.getTerrainMesh();o.bindFramebuffer.set(null),o.viewport.set([0,0,u.width,u.height]);for(const w of s){const A=u.renderToTexture.getTexture(w),I=t.getTerrainData(w.tileID);o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,A.texture);const L=u.transform.calculatePosMatrix(w.tileID.toUnwrapped()),F=t.getMeshFrameDelta(u.transform.zoom),$=u.transform.calculateFogMatrix(w.tileID.toUnwrapped()),Z=So(L,F,$,u.style.sky,u.transform.pitch);y.draw(o,a.TRIANGLES,g,Ot.disabled,h,Mt.backCCW,Z,I,"terrain",v.vertexBuffer,v.indexBuffer,v.segments)}}class il{constructor(t,s,o){this.vertexBuffer=t,this.indexBuffer=s,this.segments=o}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class rl{constructor(t,s){this.context=new Do(t),this.transform=s,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.ao(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Je.maxUnderzooming+Je.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Ui}resize(t,s,o){if(this.width=Math.floor(t*o),this.height=Math.floor(s*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,s=new c.aX;s.emplaceBack(0,0),s.emplaceBack(c.X,0),s.emplaceBack(0,c.X),s.emplaceBack(c.X,c.X),this.tileExtentBuffer=t.createVertexBuffer(s,Js.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,Js.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,Lr.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,Js.members),this.viewportSegments=c.a0.simpleSegment(0,0,4,2);const g=new c.aZ;g.emplaceBack(0),g.emplaceBack(1),g.emplaceBack(3),g.emplaceBack(2),g.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(g);const y=new c.aY;y.emplaceBack(0,1,2),y.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(y);const v=this.context.gl;this.stencilClearMode=new Ot({func:v.ALWAYS,mask:0},0,255,v.ZERO,v.ZERO,v.ZERO)}clearStencil(){const t=this.context,s=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,[s.drawingBufferWidth,s.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,s.TRIANGLES,lt.disabled,this.stencilClearMode,At.disabled,Mt.disabled,Qs(o),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,s){if(this.currentStencilSource===t.source||!t.isTileClipped()||!s||!s.length)return;this.currentStencilSource=t.source;const o=this.context,a=o.gl;this.nextStencilID+s.length>256&&this.clearStencil(),o.setColorMode(At.disabled),o.setDepthMode(lt.disabled);const h=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const g of s){const y=this._tileClippingMaskIDs[g.key]=this.nextStencilID++,v=this.style.map.terrain&&this.style.map.terrain.getTerrainData(g);h.draw(o,a.TRIANGLES,lt.disabled,new Ot({func:a.ALWAYS,mask:0},y,255,a.KEEP,a.KEEP,a.REPLACE),At.disabled,Mt.disabled,Qs(g.posMatrix),v,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,s=this.context.gl;return new Ot({func:s.NOTEQUAL,mask:255},t,255,s.KEEP,s.KEEP,s.REPLACE)}stencilModeForClipping(t){const s=this.context.gl;return new Ot({func:s.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,s.KEEP,s.KEEP,s.REPLACE)}stencilConfigForOverlap(t){const s=this.context.gl,o=t.sort((g,y)=>y.overscaledZ-g.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 g={};for(let y=0;y<h;y++)g[y+a]=new Ot({func:s.GEQUAL,mask:255},y+this.nextStencilID,255,s.KEEP,s.KEEP,s.REPLACE);return this.nextStencilID+=h,[g,o]}return[{[a]:Ot.disabled},o]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new At([t.CONSTANT_COLOR,t.ONE],new c.aN(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?At.unblended:At.alphaBlended}depthModeForSublayer(t,s,o){if(!this.opaquePassEnabledForLayer())return lt.disabled;const a=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new lt(o||this.context.gl.LEQUAL,s,[a,a])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,s){var o;this.style=t,this.options=s,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(ae.now()),this.imageManager.beginFrame();const a=this.style._order,h=this.style.sourceCaches,g={},y={},v={};for(const w in h){const A=h[w];A.used&&A.prepare(this.context),g[w]=A.getVisibleCoordinates(),y[w]=g[w].slice().reverse(),v[w]=A.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let w=0;w<a.length;w++)if(this.style._layers[a[w]].is3D()){this.opaquePassCutoff=w;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const w of a){const A=this.style._layers[w];if(!A.hasOffscreenPass()||A.isHidden(this.transform.zoom))continue;const I=y[A.source];(A.type==="custom"||I.length)&&this.renderLayer(this,h[A.source],A,I)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:s.showOverdrawInspector?c.aN.black:c.aN.transparent,depth:1}),this.clearStencil(),!((o=this.style.stylesheet)===null||o===void 0)&&o.sky&&function(w,A){const I=w.context,L=I.gl,F=((K,N,ee)=>({u_sky_color:K.properties.get("sky-color"),u_horizon_color:K.properties.get("horizon-color"),u_horizon:(N.height/2+N.getHorizon())*ee,u_sky_horizon_blend:K.properties.get("sky-horizon-blend")*N.height/2*ee}))(A,w.style.map.transform,w.pixelRatio),$=new lt(L.LEQUAL,lt.ReadWrite,[0,1]),Z=Ot.disabled,j=w.colorModeForRenderPass(),H=w.useProgram("sky");if(!A.mesh){const K=new c.aX;K.emplaceBack(-1,-1),K.emplaceBack(1,-1),K.emplaceBack(1,1),K.emplaceBack(-1,1);const N=new c.aY;N.emplaceBack(0,1,2),N.emplaceBack(0,2,3),A.mesh=new il(I.createVertexBuffer(K,Js.members),I.createIndexBuffer(N),c.a0.simpleSegment(0,0,K.length,N.length))}H.draw(I,L.TRIANGLES,$,Z,j,Mt.disabled,F,void 0,"sky",A.mesh.vertexBuffer,A.mesh.indexBuffer,A.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=s.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 w=this.style._layers[a[this.currentLayer]],A=h[w.source],I=g[w.source];this._renderTileClippingMasks(w,I),this.renderLayer(this,A,w,I)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<a.length;this.currentLayer++){const w=this.style._layers[a[this.currentLayer]],A=h[w.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(w))continue;const I=(w.type==="symbol"?v:y)[w.source];this._renderTileClippingMasks(w,g[w.source]),this.renderLayer(this,A,w,I)}if(this.options.showTileBoundaries){const w=function(A,I){let L=null;const F=Object.values(A._layers).flatMap(H=>H.source&&!H.isHidden(I)?[A.sourceCaches[H.source]]:[]),$=F.filter(H=>H.getSource().type==="vector"),Z=F.filter(H=>H.getSource().type!=="vector"),j=H=>{(!L||L.getSource().maxzoom<H.getSource().maxzoom)&&(L=H)};return $.forEach(H=>j(H)),L||Z.forEach(H=>j(H)),L}(this.style,this.transform.zoom);w&&function(A,I,L){for(let F=0;F<L.length;F++)pt(A,I,L[F])}(this,w,w.getVisibleCoordinates())}this.options.showPadding&&function(w){const A=w.transform.padding;ss(w,w.transform.height-(A.top||0),3,qn),ss(w,A.bottom||0,3,on),Vo(w,A.left||0,3,Zn),Vo(w,w.transform.width-(A.right||0),3,tl);const I=w.transform.centerPoint;(function(L,F,$,Z){Ts(L,F-1,$-10,2,20,Z),Ts(L,F-10,$-1,20,2,Z)})(w,I.x,w.transform.height-I.y,Ss)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(t){if(!this.style||!this.style.map||!this.style.map.terrain)return;const s=this.terrainFacilitator.matrix,o=this.transform.modelViewProjectionMatrix;let a=this.terrainFacilitator.dirty;a||(a=t?!c.a_(s,o):!c.a$(s,o)),a||(a=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),a&&(c.b0(s,o),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(h,g){const y=h.context,v=y.gl,w=At.unblended,A=new lt(v.LEQUAL,lt.ReadWrite,[0,1]),I=g.getTerrainMesh(),L=g.sourceCache.getRenderableTiles(),F=h.useProgram("terrainDepth");y.bindFramebuffer.set(g.getFramebuffer("depth").framebuffer),y.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),y.clear({color:c.aN.transparent,depth:1});for(const $ of L){const Z=g.getTerrainData($.tileID),j={u_matrix:h.transform.calculatePosMatrix($.tileID.toUnwrapped()),u_ele_delta:g.getMeshFrameDelta(h.transform.zoom)};F.draw(y,v.TRIANGLES,A,Ot.disabled,w,Mt.backCCW,j,Z,"terrain",I.vertexBuffer,I.indexBuffer,I.segments)}y.bindFramebuffer.set(null),y.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain),function(h,g){const y=h.context,v=y.gl,w=At.unblended,A=new lt(v.LEQUAL,lt.ReadWrite,[0,1]),I=g.getTerrainMesh(),L=g.getCoordsTexture(),F=g.sourceCache.getRenderableTiles(),$=h.useProgram("terrainCoords");y.bindFramebuffer.set(g.getFramebuffer("coords").framebuffer),y.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),y.clear({color:c.aN.transparent,depth:1}),g.coordsIndex=[];for(const Z of F){const j=g.getTerrainData(Z.tileID);y.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-g.coordsIndex.length)/255,u_texture:0,u_ele_delta:g.getMeshFrameDelta(h.transform.zoom)};$.draw(y,v.TRIANGLES,A,Ot.disabled,w,Mt.backCCW,H,j,"terrain",I.vertexBuffer,I.indexBuffer,I.segments),g.coordsIndex.push(Z.tileID.key)}y.bindFramebuffer.set(null),y.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain))}renderLayer(t,s,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,g,y,v,w){if(h.renderPass!=="translucent")return;const A=Ot.disabled,I=h.colorModeForRenderPass();(y._unevaluatedLayout.hasValue("text-variable-anchor")||y._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(L,F,$,Z,j,H,K,N,ee){const se=F.transform,le=An(),me=j==="map",ve=H==="map";for(const Me of L){const De=Z.getTile(Me),be=De.getBucket($);if(!be||!be.text||!be.text.segments.get().length)continue;const we=c.ah(be.textSizeData,se.zoom),Oe=it(De,1,F.transform.zoom),Qe=Br(Me.posMatrix,ve,me,F.transform,Oe),Ee=$.layout.get("icon-text-fit")!=="none"&&be.hasIconData();if(we){const Pe=Math.pow(2,se.zoom-De.tileID.overscaledZ),Ke=F.style.map.terrain?(st,ct)=>F.style.map.terrain.getElevation(Me,st,ct):null,Dt=le.translatePosition(se,De,K,N);Nn(be,me,ve,ee,se,Qe,Me.posMatrix,Pe,we,Ee,le,Dt,Me.toUnwrapped(),Ke)}}}(v,h,y,g,y.layout.get("text-rotation-alignment"),y.layout.get("text-pitch-alignment"),y.paint.get("text-translate"),y.paint.get("text-translate-anchor"),w),y.paint.get("icon-opacity").constantOr(1)!==0&&$r(h,g,y,v,!1,y.paint.get("icon-translate"),y.paint.get("icon-translate-anchor"),y.layout.get("icon-rotation-alignment"),y.layout.get("icon-pitch-alignment"),y.layout.get("icon-keep-upright"),A,I),y.paint.get("text-opacity").constantOr(1)!==0&&$r(h,g,y,v,!0,y.paint.get("text-translate"),y.paint.get("text-translate-anchor"),y.layout.get("text-rotation-alignment"),y.layout.get("text-pitch-alignment"),y.layout.get("text-keep-upright"),A,I),g.map.showCollisionBoxes&&(el(h,g,y,v,!0),el(h,g,y,v,!1))})(t,s,o,a,this.style.placement.variableOffsets);break;case"circle":(function(h,g,y,v){if(h.renderPass!=="translucent")return;const w=y.paint.get("circle-opacity"),A=y.paint.get("circle-stroke-width"),I=y.paint.get("circle-stroke-opacity"),L=!y.layout.get("circle-sort-key").isConstant();if(w.constantOr(1)===0&&(A.constantOr(1)===0||I.constantOr(1)===0))return;const F=h.context,$=F.gl,Z=h.depthModeForSublayer(0,lt.ReadOnly),j=Ot.disabled,H=h.colorModeForRenderPass(),K=[];for(let N=0;N<v.length;N++){const ee=v[N],se=g.getTile(ee),le=se.getBucket(y);if(!le)continue;const me=le.programConfigurations.get(y.id),ve=h.useProgram("circle",me),Me=le.layoutVertexBuffer,De=le.indexBuffer,be=h.style.map.terrain&&h.style.map.terrain.getTerrainData(ee),we={programConfiguration:me,program:ve,layoutVertexBuffer:Me,indexBuffer:De,uniformValues:Ra(h,ee,se,y),terrainData:be};if(L){const Oe=le.segments.get();for(const Qe of Oe)K.push({segments:new c.a0([Qe]),sortKey:Qe.sortKey,state:we})}else K.push({segments:le.segments,sortKey:0,state:we})}L&&K.sort((N,ee)=>N.sortKey-ee.sortKey);for(const N of K){const{programConfiguration:ee,program:se,layoutVertexBuffer:le,indexBuffer:me,uniformValues:ve,terrainData:Me}=N.state;se.draw(F,$.TRIANGLES,Z,j,H,Mt.disabled,ve,Me,y.id,le,me,N.segments,y.paint,h.transform.zoom,ee)}})(t,s,o,a);break;case"heatmap":(function(h,g,y,v){if(y.paint.get("heatmap-opacity")!==0)if(h.renderPass==="offscreen"){const w=h.context,A=w.gl,I=Ot.disabled,L=new At([A.ONE,A.ONE],c.aN.transparent,[!0,!0,!0,!0]);(function(F,$,Z){const j=F.gl;F.activeTexture.set(j.TEXTURE1),F.viewport.set([0,0,$.width/4,$.height/4]);let H=Z.heatmapFbo;if(H)j.bindTexture(j.TEXTURE_2D,H.colorAttachment.get()),F.bindFramebuffer.set(H.framebuffer);else{const K=j.createTexture();j.bindTexture(j.TEXTURE_2D,K),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=Z.heatmapFbo=F.createFramebuffer($.width/4,$.height/4,!1,!1),function(N,ee,se,le){var me,ve;const Me=N.gl,De=(me=N.HALF_FLOAT)!==null&&me!==void 0?me:Me.UNSIGNED_BYTE,be=(ve=N.RGBA16F)!==null&&ve!==void 0?ve:Me.RGBA;Me.texImage2D(Me.TEXTURE_2D,0,be,ee.width/4,ee.height/4,0,Me.RGBA,De,null),le.colorAttachment.set(se)}(F,$,K,H)}})(w,h,y),w.clear({color:c.aN.transparent});for(let F=0;F<v.length;F++){const $=v[F];if(g.hasRenderableParent($))continue;const Z=g.getTile($),j=Z.getBucket(y);if(!j)continue;const H=j.programConfigurations.get(y.id),K=h.useProgram("heatmap",H),{zoom:N}=h.transform;K.draw(w,A.TRIANGLES,lt.disabled,I,L,Mt.disabled,Fi($.posMatrix,Z,N,y.paint.get("heatmap-intensity")),null,y.id,j.layoutVertexBuffer,j.indexBuffer,j.segments,y.paint,h.transform.zoom,H)}w.viewport.set([0,0,h.width,h.height])}else h.renderPass==="translucent"&&(h.context.setColorMode(h.colorModeForRenderPass()),function(w,A){const I=w.context,L=I.gl,F=A.heatmapFbo;if(!F)return;I.activeTexture.set(L.TEXTURE0),L.bindTexture(L.TEXTURE_2D,F.colorAttachment.get()),I.activeTexture.set(L.TEXTURE1);let $=A.colorRampTexture;$||($=A.colorRampTexture=new vt(I,A.colorRamp,L.RGBA)),$.bind(L.LINEAR,L.CLAMP_TO_EDGE),w.useProgram("heatmapTexture").draw(I,L.TRIANGLES,lt.disabled,Ot.disabled,w.colorModeForRenderPass(),Mt.disabled,((Z,j,H,K)=>{const N=c.H();c.aQ(N,0,Z.width,Z.height,0,0,1);const ee=Z.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")}})(w,A),null,A.id,w.viewportBuffer,w.quadTriangleIndexBuffer,w.viewportSegments,A.paint,w.transform.zoom)}(h,y))})(t,s,o,a);break;case"line":(function(h,g,y,v){if(h.renderPass!=="translucent")return;const w=y.paint.get("line-opacity"),A=y.paint.get("line-width");if(w.constantOr(1)===0||A.constantOr(1)===0)return;const I=h.depthModeForSublayer(0,lt.ReadOnly),L=h.colorModeForRenderPass(),F=y.paint.get("line-dasharray"),$=y.paint.get("line-pattern"),Z=$.constantOr(1),j=y.paint.get("line-gradient"),H=y.getCrossfadeParameters(),K=Z?"linePattern":F?"lineSDF":j?"lineGradient":"line",N=h.context,ee=N.gl;let se=!0;for(const le of v){const me=g.getTile(le);if(Z&&!me.patternsLoaded())continue;const ve=me.getBucket(y);if(!ve)continue;const Me=ve.programConfigurations.get(y.id),De=h.context.program.get(),be=h.useProgram(K,Me),we=se||be.program!==De,Oe=h.style.map.terrain&&h.style.map.terrain.getTerrainData(le),Qe=$.constantOr(null);if(Qe&&me.imageAtlas){const Ke=me.imageAtlas,Dt=Ke.patternPositions[Qe.to.toString()],st=Ke.patternPositions[Qe.from.toString()];Dt&&st&&Me.setConstantPatternPositions(Dt,st)}const Ee=Oe?le:null,Pe=Z?Ba(h,me,y,H,Ee):F?Fa(h,me,y,F,H,Ee):j?Dn(h,me,y,ve.lineClipsArray.length,Ee):en(h,me,y,Ee);if(Z)N.activeTexture.set(ee.TEXTURE0),me.imageAtlasTexture.bind(ee.LINEAR,ee.CLAMP_TO_EDGE),Me.updatePaintBuffers(H);else if(F&&(we||h.lineAtlas.dirty))N.activeTexture.set(ee.TEXTURE0),h.lineAtlas.bind(N);else if(j){const Ke=ve.gradients[y.id];let Dt=Ke.texture;if(y.gradientVersion!==Ke.version){let st=256;if(y.stepInterpolant){const ct=g.getSource().maxzoom,Lt=le.canonical.z===ct?Math.ceil(1<<h.transform.maxZoom-le.canonical.z):1;st=c.ad(c.aV(ve.maxLineLength/c.X*1024*Lt),256,N.maxTextureSize)}Ke.gradient=c.aW({expression:y.gradientExpression(),evaluationKey:"lineProgress",resolution:st,image:Ke.gradient||void 0,clips:ve.lineClipsArray}),Ke.texture?Ke.texture.update(Ke.gradient):Ke.texture=new vt(N,Ke.gradient,ee.RGBA),Ke.version=y.gradientVersion,Dt=Ke.texture}N.activeTexture.set(ee.TEXTURE0),Dt.bind(y.stepInterpolant?ee.NEAREST:ee.LINEAR,ee.CLAMP_TO_EDGE)}be.draw(N,ee.TRIANGLES,I,h.stencilModeForClipping(le),L,Mt.disabled,Pe,Oe,y.id,ve.layoutVertexBuffer,ve.indexBuffer,ve.segments,y.paint,h.transform.zoom,Me,ve.layoutVertexBuffer2),se=!1}})(t,s,o,a);break;case"fill":(function(h,g,y,v){const w=y.paint.get("fill-color"),A=y.paint.get("fill-opacity");if(A.constantOr(1)===0)return;const I=h.colorModeForRenderPass(),L=y.paint.get("fill-pattern"),F=h.opaquePassEnabledForLayer()&&!L.constantOr(1)&&w.constantOr(c.aN.transparent).a===1&&A.constantOr(0)===1?"opaque":"translucent";if(h.renderPass===F){const $=h.depthModeForSublayer(1,h.renderPass==="opaque"?lt.ReadWrite:lt.ReadOnly);Fo(h,g,y,v,$,I,!1)}if(h.renderPass==="translucent"&&y.paint.get("fill-antialias")){const $=h.depthModeForSublayer(y.getPaintProperty("fill-outline-color")?2:0,lt.ReadOnly);Fo(h,g,y,v,$,I,!0)}})(t,s,o,a);break;case"fill-extrusion":(function(h,g,y,v){const w=y.paint.get("fill-extrusion-opacity");if(w!==0&&h.renderPass==="translucent"){const A=new lt(h.context.gl.LEQUAL,lt.ReadWrite,h.depthRangeFor3D);if(w!==1||y.paint.get("fill-extrusion-pattern").constantOr(1))jn(h,g,y,v,A,Ot.disabled,At.disabled),jn(h,g,y,v,A,h.stencilModeFor3D(),h.colorModeForRenderPass());else{const I=h.colorModeForRenderPass();jn(h,g,y,v,A,Ot.disabled,I)}}})(t,s,o,a);break;case"hillshade":(function(h,g,y,v){if(h.renderPass!=="offscreen"&&h.renderPass!=="translucent")return;const w=h.context,A=h.depthModeForSublayer(0,lt.ReadOnly),I=h.colorModeForRenderPass(),[L,F]=h.renderPass==="translucent"?h.stencilConfigForOverlap(v):[{},v];for(const $ of F){const Z=g.getTile($);Z.needsHillshadePrepare!==void 0&&Z.needsHillshadePrepare&&h.renderPass==="offscreen"?rs(h,Z,y,A,Ot.disabled,I):h.renderPass==="translucent"&&Oo(h,$,Z,y,A,L[$.overscaledZ],I)}w.viewport.set([0,0,h.width,h.height])})(t,s,o,a);break;case"raster":(function(h,g,y,v){if(h.renderPass!=="translucent"||y.paint.get("raster-opacity")===0||!v.length)return;const w=h.context,A=w.gl,I=g.getSource(),L=h.useProgram("raster"),F=h.colorModeForRenderPass(),[$,Z]=I instanceof br?[{},v]:h.stencilConfigForOverlap(v),j=Z[Z.length-1].overscaledZ,H=!h.options.moving;for(const K of Z){const N=h.depthModeForSublayer(K.overscaledZ-j,y.paint.get("raster-opacity")===1?lt.ReadWrite:lt.ReadOnly,A.LESS),ee=g.getTile(K);ee.registerFadeDuration(y.paint.get("raster-fade-duration"));const se=g.findLoadedParent(K,0),le=g.findLoadedSibling(K),me=Un(ee,se||le||null,g,y,h.transform,h.style.map.terrain);let ve,Me;const De=y.paint.get("raster-resampling")==="nearest"?A.NEAREST:A.LINEAR;w.activeTexture.set(A.TEXTURE0),ee.texture.bind(De,A.CLAMP_TO_EDGE,A.LINEAR_MIPMAP_NEAREST),w.activeTexture.set(A.TEXTURE1),se?(se.texture.bind(De,A.CLAMP_TO_EDGE,A.LINEAR_MIPMAP_NEAREST),ve=Math.pow(2,se.tileID.overscaledZ-ee.tileID.overscaledZ),Me=[ee.tileID.canonical.x*ve%1,ee.tileID.canonical.y*ve%1]):ee.texture.bind(De,A.CLAMP_TO_EDGE,A.LINEAR_MIPMAP_NEAREST),ee.texture.useMipmap&&w.extTextureFilterAnisotropic&&h.transform.pitch>20&&A.texParameterf(A.TEXTURE_2D,w.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,w.extTextureFilterAnisotropicMax);const be=h.style.map.terrain&&h.style.map.terrain.getTerrainData(K),we=be?K:null,Oe=we?we.posMatrix:h.transform.calculatePosMatrix(K.toUnwrapped(),H),Qe=ql(Oe,Me||[0,0],ve||1,me,y);I instanceof br?L.draw(w,A.TRIANGLES,N,Ot.disabled,F,Mt.disabled,Qe,be,y.id,I.boundsBuffer,h.quadTriangleIndexBuffer,I.boundsSegments):L.draw(w,A.TRIANGLES,N,$[K.overscaledZ],F,Mt.disabled,Qe,be,y.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments)}})(t,s,o,a);break;case"background":(function(h,g,y,v){const w=y.paint.get("background-color"),A=y.paint.get("background-opacity");if(A===0)return;const I=h.context,L=I.gl,F=h.transform,$=F.tileSize,Z=y.paint.get("background-pattern");if(h.isPatternMissing(Z))return;const j=!Z&&w.a===1&&A===1&&h.opaquePassEnabledForLayer()?"opaque":"translucent";if(h.renderPass!==j)return;const H=Ot.disabled,K=h.depthModeForSublayer(0,j==="opaque"?lt.ReadWrite:lt.ReadOnly),N=h.colorModeForRenderPass(),ee=h.useProgram(Z?"backgroundPattern":"background"),se=v||F.coveringTiles({tileSize:$,terrain:h.style.map.terrain});Z&&(I.activeTexture.set(L.TEXTURE0),h.imageManager.bind(h.context));const le=y.getCrossfadeParameters();for(const me of se){const ve=v?me.posMatrix:h.transform.calculatePosMatrix(me.toUnwrapped()),Me=Z?To(ve,A,h,Z,{tileID:me,tileSize:$},le):Ln(ve,A,w),De=h.style.map.terrain&&h.style.map.terrain.getTerrainData(me);ee.draw(I,L.TRIANGLES,K,H,N,Mt.disabled,Me,De,y.id,h.tileExtentBuffer,h.quadTriangleIndexBuffer,h.tileExtentSegments)}})(t,0,o,a);break;case"custom":(function(h,g,y){const v=h.context,w=y.implementation;if(h.renderPass==="offscreen"){const A=w.prerender;A&&(h.setCustomLayerDefaults(),v.setColorMode(h.colorModeForRenderPass()),A.call(w,v.gl,h.transform.customLayerMatrix()),v.setDirty(),h.setBaseState())}else if(h.renderPass==="translucent"){h.setCustomLayerDefaults(),v.setColorMode(h.colorModeForRenderPass()),v.setStencilMode(Ot.disabled);const A=w.renderingMode==="3d"?new lt(h.context.gl.LEQUAL,lt.ReadWrite,h.depthRangeFor3D):h.depthModeForSublayer(0,lt.ReadOnly);v.setDepthMode(A),w.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,s,o,a,h){if(!o[0]&&!o[1])return t;const g=h?a==="map"?this.transform.angle:0:a==="viewport"?-this.transform.angle:0;if(g){const w=Math.sin(g),A=Math.cos(g);o=[o[0]*A-o[1]*w,o[0]*w+o[1]*A]}const y=[h?o[0]:it(s,o[0],this.transform.zoom),h?o[1]:it(s,o[1],this.transform.zoom),0],v=new Float32Array(16);return c.J(v,t,y),v}saveTileTexture(t){const s=this._tileTextures[t.size[0]];s?s.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const s=this._tileTextures[t];return s&&s.length>0?s.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const s=this.imageManager.getPattern(t.from.toString()),o=this.imageManager.getPattern(t.to.toString());return!s||!o}useProgram(t,s){this.cache=this.cache||{};const o=t+(s?s.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[o]||(this.cache[o]=new kn(this.context,Or[t],s,Rn[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:s}=this.context.gl;return this.width!==t||this.height!==s}}class ns{constructor(t,s){this.points=t,this.planes=s}static fromInvProjectionMatrix(t,s,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(y=>{const v=1/(y=c.ag([],y,t))[3]/s*a;return c.b1(y,y,[v,v,1/y[3],v])}),g=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(y=>{const v=function(L,F){var $=F[0],Z=F[1],j=F[2],H=$*$+Z*Z+j*j;return H>0&&(H=1/Math.sqrt(H)),L[0]=F[0]*H,L[1]=F[1]*H,L[2]=F[2]*H,L}([],function(L,F,$){var Z=F[0],j=F[1],H=F[2],K=$[0],N=$[1],ee=$[2];return L[0]=j*ee-H*N,L[1]=H*K-Z*ee,L[2]=Z*N-j*K,L}([],Tt([],h[y[0]],h[y[1]]),Tt([],h[y[2]],h[y[1]]))),w=-((A=v)[0]*(I=h[y[1]])[0]+A[1]*I[1]+A[2]*I[2]);var A,I;return v.concat(w)});return new ns(h,g)}}class Gn{constructor(t,s){this.min=t,this.max=s,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 s=[t%2==0,t<2],o=xt(this.min),a=xt(this.max);for(let h=0;h<s.length;h++)o[h]=s[h]?this.min[h]:this.center[h],a[h]=s[h]?this.center[h]:this.max[h];return a[2]=this.max[2],new Gn(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 s=[[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 g=0;for(let y=0;y<s.length;y++)c.b2(h,s[y])>=0&&g++;if(g===0)return 0;g!==s.length&&(o=!1)}if(o)return 2;for(let a=0;a<3;a++){let h=Number.MAX_VALUE,g=-Number.MAX_VALUE;for(let y=0;y<t.points.length;y++){const v=t.points[y][a]-this.min[a];h=Math.min(h,v),g=Math.max(g,v)}if(g<0||h>this.max[a]-this.min[a])return 0}return 1}}class Hn{constructor(t=0,s=0,o=0,a=0){if(isNaN(t)||t<0||isNaN(s)||s<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=s,this.left=o,this.right=a}interpolate(t,s,o){return s.top!=null&&t.top!=null&&(this.top=c.z.number(t.top,s.top,o)),s.bottom!=null&&t.bottom!=null&&(this.bottom=c.z.number(t.bottom,s.bottom,o)),s.left!=null&&t.left!=null&&(this.left=c.z.number(t.left,s.left,o)),s.right!=null&&t.right!=null&&(this.right=c.z.number(t.right,s.right,o)),this}getCenter(t,s){const o=c.ad((this.left+t-this.right)/2,0,t),a=c.ad((this.top+s-this.bottom)/2,0,s);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 Hn(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const $o=85.051129;class No{constructor(t,s,o,a,h){this.tileSize=512,this._renderWorldCopies=h===void 0||!!h,this._minZoom=t||0,this._maxZoom=s||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 Hn,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const t=new No(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 s=-c.b3(t,-180,180)*Math.PI/180;this.angle!==s&&(this._unmodified=!1,this.angle=s,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 g=a[0],y=a[1],v=a[2],w=a[3],A=Math.sin(h),I=Math.cos(h);o[0]=g*I+v*A,o[1]=y*I+w*A,o[2]=g*-A+v*I,o[3]=y*-A+w*I}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const s=c.ad(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==s&&(this._unmodified=!1,this._pitch=s,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 s=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==s&&(this._unmodified=!1,this._zoom=s,this.tileZoom=Math.max(0,Math.floor(s)),this.scale=this.zoomScale(s),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,s,o){this._unmodified=!1,this._edgeInsets.interpolate(t,s,o),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const s=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,s)}getVisibleUnwrappedCoordinates(t){const s=[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)),g=this.pointCoordinate(new c.P(0,this.height)),y=Math.floor(Math.min(o.x,a.x,h.x,g.x)),v=Math.floor(Math.max(o.x,a.x,h.x,g.x)),w=1;for(let A=y-w;A<=v+w;A++)A!==0&&s.push(new c.b4(A,t))}return s}coveringTiles(t){var s,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 g=this.pointCoordinate(this.getCameraPoint()),y=c.Z.fromLngLat(this.center),v=Math.pow(2,a),w=[v*g.x,v*g.y,0],A=[v*y.x,v*y.y,0],I=ns.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,a);let L=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(L=a);const F=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,$=N=>({aabb:new Gn([N*v,0,0],[(N+1)*v,v,0]),zoom:0,x:0,y:0,wrap:N,fullyVisible:!1}),Z=[],j=[],H=a,K=t.reparseOverscaled?h:a;if(this._renderWorldCopies)for(let N=1;N<=3;N++)Z.push($(-N)),Z.push($(N));for(Z.push($(0));Z.length>0;){const N=Z.pop(),ee=N.x,se=N.y;let le=N.fullyVisible;if(!le){const be=N.aabb.intersects(I);if(be===0)continue;le=be===2}const me=t.terrain?w:A,ve=N.aabb.distanceX(me),Me=N.aabb.distanceY(me),De=Math.max(Math.abs(ve),Math.abs(Me));if(N.zoom===H||De>F+(1<<H-N.zoom)-2&&N.zoom>=L){const be=H-N.zoom,we=w[0]-.5-(ee<<be),Oe=w[1]-.5-(se<<be);j.push({tileID:new c.S(N.zoom===H?K:N.zoom,N.wrap,N.zoom,ee,se),distanceSq:nr([A[0]-.5-ee,A[1]-.5-se]),tileDistanceToCamera:Math.sqrt(we*we+Oe*Oe)})}else for(let be=0;be<4;be++){const we=(ee<<1)+be%2,Oe=(se<<1)+(be>>1),Qe=N.zoom+1;let Ee=N.aabb.quadrant(be);if(t.terrain){const Pe=new c.S(Qe,N.wrap,Qe,we,Oe),Ke=t.terrain.getMinMaxElevation(Pe),Dt=(s=Ke.minElevation)!==null&&s!==void 0?s:this.elevation,st=(o=Ke.maxElevation)!==null&&o!==void 0?o:this.elevation;Ee=new Gn([Ee.min[0],Ee.min[1],Dt],[Ee.max[0],Ee.max[1],st])}Z.push({aabb:Ee,zoom:Qe,x:we,y:Oe,wrap:N.wrap,fullyVisible:le})}}return j.sort((N,ee)=>N.distanceSq-ee.distanceSq).map(N=>N.tileID)}resize(t,s){this.width=t,this.height=s,this.pixelsToGLUnits=[2/t,-2/s],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 s=c.ad(t.lat,-85.051129,$o);return new c.P(c.O(t.lng)*this.worldSize,c.Q(s)*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 s=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 g=o+s-h,y=Math.cos(this._pitch)*this.cameraToCenterDistance/g/c.b5(1,a.lat),v=this.scaleZoom(y/this.tileSize);this._elevation=h,this._center=a,this.zoom=v}setLocationAtPoint(t,s){const o=this.pointCoordinate(s),a=this.pointCoordinate(this.centerPoint),h=this.locationCoordinate(t),g=new c.Z(h.x-(o.x-a.x),h.y-(o.y-a.y));this.center=this.coordinateLocation(g),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,s){return s?this.coordinatePoint(this.locationCoordinate(t),s.getElevationForLngLatZoom(t,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,s){return this.coordinateLocation(this.pointCoordinate(t,s))}locationCoordinate(t){return c.Z.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,s){if(s){const L=s.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],g=a[3],y=o[1]/h,v=a[1]/g,w=o[2]/h,A=a[2]/g,I=w===A?0:(0-w)/(A-w);return new c.Z(c.z.number(o[0]/h,a[0]/g,I)/this.worldSize,c.z.number(y,v,I)/this.worldSize)}coordinatePoint(t,s=0,o=this.pixelMatrix){const a=[t.x*this.worldSize,t.y*this.worldSize,s,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 he().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 he([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,$o])}calculateTileMatrix(t){const s=t.canonical,o=this.worldSize/this.zoomScale(s.z),a=s.x+Math.pow(2,s.z)*t.wrap,h=c.ao(new Float64Array(16));return c.J(h,h,[a*o,s.y*o,0]),c.K(h,h,[o/c.X,o/c.X,1]),h}calculatePosMatrix(t,s=!1){const o=t.key,a=s?this._alignedPosMatrixCache:this._posMatrixCache;if(a[o])return a[o];const h=this.calculateTileMatrix(t);return c.L(h,s?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,h),a[o]=new Float32Array(h),a[o]}calculateFogMatrix(t){const s=t.key,o=this._fogMatrixCache;if(o[s])return o[s];const a=this.calculateTileMatrix(t);return c.L(a,this.fogMatrix,a),o[s]=new Float32Array(a),o[s]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(t,s){s=c.ad(+s,this.minZoom,this.maxZoom);const o={center:new c.N(t.lng,t.lat),zoom:s};let a=this.lngRange;if(!this._renderWorldCopies&&a===null){const N=179.9999999999;a=[-N,N]}const h=this.tileSize*this.zoomScale(o.zoom);let g=0,y=h,v=0,w=h,A=0,I=0;const{x:L,y:F}=this.size;if(this.latRange){const N=this.latRange;g=c.Q(N[1])*h,y=c.Q(N[0])*h,y-g<F&&(A=F/(y-g))}a&&(v=c.b3(c.O(a[0])*h,0,h),w=c.b3(c.O(a[1])*h,0,h),w<v&&(w+=h),w-v<L&&(I=L/(w-v)));const{x:$,y:Z}=this.project.call({worldSize:h},t);let j,H;const K=Math.max(I||0,A||0);if(K){const N=new c.P(I?(w+v)/2:$,A?(y+g)/2:Z);return o.center=this.unproject.call({worldSize:h},N).wrap(),o.zoom+=this.scaleZoom(K),o}if(this.latRange){const N=F/2;Z-N<g&&(H=g+N),Z+N>y&&(H=y-N)}if(a){const N=(v+w)/2;let ee=$;this._renderWorldCopies&&(ee=c.b3($,N-h/2,N+h/2));const se=L/2;ee-se<v&&(j=v+se),ee+se>w&&(j=w-se)}if(j!==void 0||H!==void 0){const N=new c.P(j??$,H??Z);o.center=this.unproject.call({worldSize:h},N).wrap()}return o}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:s,zoom:o}=this.getConstrained(this.center,this.zoom);this.center=s,this.zoom=o,this._unmodified=t,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,s=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),g=Math.min(this.elevation,this.minElevationForCurrentTile),y=h-g*this._pixelPerMeter/Math.cos(this._pitch),v=g<0?y:h,w=Math.PI/2+this._pitch,A=this._fov*(.5+t.y/this.height),I=Math.sin(A)*v/Math.sin(c.ad(Math.PI-w-A,.01,Math.PI-.01)),L=this.getHorizon(),F=2*Math.atan(L/this.cameraToCenterDistance)*(.5+t.y/(2*L)),$=Math.sin(F)*v/Math.sin(c.ad(Math.PI-w-F,.01,Math.PI-.01)),Z=Math.min(I,$);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,[-s,-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,[-s,-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 j=this.width%2/2,H=this.height%2/2,K=Math.cos(this.angle),N=Math.sin(this.angle),ee=s-Math.round(s)+K*j+N*H,se=o-Math.round(o)+K*H+N*j,le=new Float64Array(a);if(c.J(le,le,[ee>.5?ee-1:ee,se>.5?se-1:se,0]),this.alignedModelViewProjectionMatrix=le,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)),s=[t.x*this.worldSize,t.y*this.worldSize,0,1];return c.ag(s,s,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 s=this.getCameraPoint();if(t.length===1)return[t[0],s];{let o=s.x,a=s.y,h=s.x,g=s.y;for(const y of t)o=Math.min(o,y.x),a=Math.min(a,y.y),h=Math.max(h,y.x),g=Math.max(g,y.y);return[new c.P(o,a),new c.P(h,a),new c.P(h,g),new c.P(o,g),new c.P(o,a)]}}lngLatToCameraDepth(t,s){const o=this.locationCoordinate(t),a=[o.x*this.worldSize,o.y*this.worldSize,s,1];return c.ag(a,a,this.modelViewProjectionMatrix),a[2]/a[3]}}function Wn(u,t){let s,o=!1,a=null,h=null;const g=()=>{a=null,o&&(u.apply(h,s),a=setTimeout(g,t),o=!1)};return(...y)=>(o=!0,h=this,s=y,a||g(),a)}class ln{constructor(t){this._getCurrentHash=()=>{const s=window.location.hash.replace("#","");if(this._hashName){let o;return s.split("&").map(a=>a.split("=")).forEach(a=>{a[0]===this._hashName&&(o=a)}),(o&&o[1]||"").split("/")}return s.split("/")},this._onHashChange=()=>{const s=this._getCurrentHash();if(s.length>=3&&!s.some(o=>isNaN(o))){const o=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(s[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+s[2],+s[1]],zoom:+s[0],bearing:o,pitch:+(s[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const s=window.location.href.replace(/(#.+)?$/,this.getHashString());window.history.replaceState(window.history.state,null,s)},this._removeHash=()=>{const s=this._getCurrentHash();if(s.length===0)return;const o=s.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 g=window.location.href.replace(/(#.+)?$/,h);g=g.replace("&&","&"),window.history.replaceState(window.history.state,null,g)},this._updateHash=Wn(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 s=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),g=Math.round(s.lng*h)/h,y=Math.round(s.lat*h)/h,v=this._map.getBearing(),w=this._map.getPitch();let A="";if(A+=t?`/${g}/${y}/${o}`:`${o}/${y}/${g}`,(v||w)&&(A+="/"+Math.round(10*v)/10),w&&(A+=`/${Math.round(w)}`),this._hashName){const I=this._hashName;let L=!1;const F=window.location.hash.slice(1).split("&").map($=>{const Z=$.split("=")[0];return Z===I?(L=!0,`${Z}=${A}`):$}).filter($=>$);return L||F.push(`${I}=${A}`),`#${F.join("&")}`}return`#${A}`}}const os={linearity:.3,easing:c.b8(0,0,.3,1)},jo=c.e({deceleration:2500,maxSpeed:1400},os),Uo=c.e({deceleration:20,maxSpeed:1400},os),sl=c.e({deceleration:1e3,maxSpeed:360},os),Xn=c.e({deceleration:1e3,maxSpeed:90},os);class Jn{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:ae.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,s=ae.now();for(;t.length>0&&s-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const s={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)s.zoom+=h.zoomDelta||0,s.bearing+=h.bearingDelta||0,s.pitch+=h.pitchDelta||0,h.panDelta&&s.pan._add(h.panDelta),h.around&&(s.around=h.around),h.pinchAround&&(s.pinchAround=h.pinchAround);const o=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,a={};if(s.pan.mag()){const h=Kn(s.pan.mag(),o,c.e({},jo,t||{}));a.offset=s.pan.mult(h.amount/s.pan.mag()),a.center=this._map.transform.center,Es(a,h)}if(s.zoom){const h=Kn(s.zoom,o,Uo);a.zoom=this._map.transform.zoom+h.amount,Es(a,h)}if(s.bearing){const h=Kn(s.bearing,o,sl);a.bearing=this._map.transform.bearing+c.ad(h.amount,-179,179),Es(a,h)}if(s.pitch){const h=Kn(s.pitch,o,Xn);a.pitch=this._map.transform.pitch+h.amount,Es(a,h)}if(a.zoom||a.bearing){const h=s.pinchAround===void 0?s.around:s.pinchAround;a.around=h?this._map.unproject(h):this._map.getCenter()}return this.clear(),c.e(a,{noMoveStart:!0})}}function Es(u,t){(!u.duration||u.duration<t.duration)&&(u.duration=t.duration,u.easing=t.easing)}function Kn(u,t,s){const{maxSpeed:o,linearity:a,deceleration:h}=s,g=c.ad(u*a/(t/1e3),-o,o),y=Math.abs(g)/(h*a);return{easing:s.easing,duration:1e3*y,amount:g*(y/2)}}class vi extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,s,o,a={}){const h=oe.mousePos(s.getCanvas(),o),g=s.unproject(h);super(t,c.e({point:h,lngLat:g,originalEvent:o},a)),this._defaultPrevented=!1,this.target=s}}class cn extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,s,o){const a=t==="touchend"?o.changedTouches:o.touches,h=oe.touchPos(s.getCanvasContainer(),a),g=h.map(v=>s.unproject(v)),y=h.reduce((v,w,A,I)=>v.add(w.div(I.length)),new c.P(0,0));super(t,{points:h,point:y,lngLats:g,lngLat:s.unproject(y),originalEvent:o}),this._defaultPrevented=!1}}class qo extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,s,o){super(t,{originalEvent:o}),this._defaultPrevented=!1}}class Yn{constructor(t,s){this._map=t,this._clickTolerance=s.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new qo(t.type,this._map,t))}mousedown(t,s){return this._mousedownPos=s,this._firePreventable(new vi(t.type,this._map,t))}mouseup(t){this._map.fire(new vi(t.type,this._map,t))}click(t,s){this._mousedownPos&&this._mousedownPos.dist(s)>=this._clickTolerance||this._map.fire(new vi(t.type,this._map,t))}dblclick(t){return this._firePreventable(new vi(t.type,this._map,t))}mouseover(t){this._map.fire(new vi(t.type,this._map,t))}mouseout(t){this._map.fire(new vi(t.type,this._map,t))}touchstart(t){return this._firePreventable(new cn(t.type,this._map,t))}touchmove(t){this._map.fire(new cn(t.type,this._map,t))}touchend(t){this._map.fire(new cn(t.type,this._map,t))}touchcancel(t){this._map.fire(new cn(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Zo{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new vi(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new vi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new vi(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class As{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 Go{constructor(t,s){this._map=t,this._tr=new As(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=s.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,s){this.isEnabled()&&t.shiftKey&&t.button===0&&(oe.disableDrag(),this._startPos=this._lastPos=s,this._active=!0)}mousemoveWindow(t,s){if(!this._active)return;const o=s;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=oe.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const h=Math.min(a.x,o.x),g=Math.max(a.x,o.x),y=Math.min(a.y,o.y),v=Math.max(a.y,o.y);oe.setTransform(this._box,`translate(${h}px,${y}px)`),this._box.style.width=g-h+"px",this._box.style.height=v-y+"px"}mouseupWindow(t,s){if(!this._active||t.button!==0)return;const o=this._startPos,a=s;if(this.reset(),oe.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&&(oe.remove(this._box),this._box=null),oe.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,s){return this._map.fire(new c.k(t,{originalEvent:s}))}}function Is(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 s={};for(let o=0;o<u.length;o++)s[u[o].identifier]=t[o];return s}class Ho{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,s,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 g of a)h._add(g);return h.div(a.length)}(s),this.touches=Is(o,s)))}touchmove(t,s,o){if(this.aborted||!this.centroid)return;const a=Is(o,s);for(const h in this.touches){const g=a[h];(!g||g.dist(this.touches[h])>30)&&(this.aborted=!0)}}touchend(t,s,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 Wo{constructor(t){this.singleTap=new Ho(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,s,o){this.singleTap.touchstart(t,s,o)}touchmove(t,s,o){this.singleTap.touchmove(t,s,o)}touchend(t,s,o){const a=this.singleTap.touchend(t,s,o);if(a){const h=t.timeStamp-this.lastTime<500,g=!this.lastTap||this.lastTap.dist(a)<30;if(h&&g||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=a,this.count===this.numTaps)return this.reset(),a}}}class nl{constructor(t){this._tr=new As(t),this._zoomIn=new Wo({numTouches:1,numTaps:2}),this._zoomOut=new Wo({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,s,o){this._zoomIn.touchstart(t,s,o),this._zoomOut.touchstart(t,s,o)}touchmove(t,s,o){this._zoomIn.touchmove(t,s,o),this._zoomOut.touchmove(t,s,o)}touchend(t,s,o){const a=this._zoomIn.touchend(t,s,o),h=this._zoomOut.touchend(t,s,o),g=this._tr;return a?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.easeTo({duration:300,zoom:g.zoom+1,around:g.unproject(a)},{originalEvent:t})}):h?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.easeTo({duration:300,zoom:g.zoom-1,around:g.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 zt{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 s=this._moveFunction(...t);if(s.bearingDelta||s.pitchDelta||s.around||s.panDelta)return this._active=!0,s}dragStart(t,s){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=s.length?s[0]:s,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,s){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=s.length?s[0]:s;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&&oe.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 as={0:1,2:2};class Ai{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const s=oe.mouseButton(t);this._eventButton=s}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!function(s,o){const a=as[o];return s.buttons===void 0||(s.buttons&a)!==a}(t,this._eventButton)}isValidEndEvent(t){return oe.mouseButton(t)===this._eventButton}}class Qn{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 hn=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=t=>{t.preventDefault()}},Xo=({enable:u,clickTolerance:t,bearingDegreesPerPixelMoved:s=.8})=>{const o=new Ai({checkCorrectEvent:a=>oe.mouseButton(a)===0&&a.ctrlKey||oe.mouseButton(a)===2});return new zt({clickTolerance:t,move:(a,h)=>({bearingDelta:(h.x-a.x)*s}),moveStateManager:o,enable:u,assignEvents:hn})},ls=({enable:u,clickTolerance:t,pitchDegreesPerPixelMoved:s=-.5})=>{const o=new Ai({checkCorrectEvent:a=>oe.mouseButton(a)===0&&a.ctrlKey||oe.mouseButton(a)===2});return new zt({clickTolerance:t,move:(a,h)=>({pitchDelta:(h.y-a.y)*s}),moveStateManager:o,enable:u,assignEvents:hn})};class un{constructor(t,s){this._clickTolerance=t.clickTolerance||1,this._map=s,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,s,o){return this._calculateTransform(t,s,o)}touchmove(t,s,o){if(this._active){if(!this._shouldBePrevented(o.length))return t.preventDefault(),this._calculateTransform(t,s,o);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,s,o){this._calculateTransform(t,s,o),this._active&&this._shouldBePrevented(o.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,s,o){o.length>0&&(this._active=!0);const a=Is(o,s),h=new c.P(0,0),g=new c.P(0,0);let y=0;for(const w in a){const A=a[w],I=this._touches[w];I&&(h._add(A),g._add(A.sub(I)),y++,a[w]=A)}if(this._touches=a,this._shouldBePrevented(y)||!g.mag())return;const v=g.div(y);return this._sum._add(v),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(y),panDelta:v}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class dn{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,s,o){this._firstTwoTouches||o.length<2||(this._firstTwoTouches=[o[0].identifier,o[1].identifier],this._start([s[0],s[1]]))}touchmove(t,s,o){if(!this._firstTwoTouches)return;t.preventDefault();const[a,h]=this._firstTwoTouches,g=pn(o,s,a),y=pn(o,s,h);if(!g||!y)return;const v=this._aroundCenter?null:g.add(y).div(2);return this._move([g,y],v,t)}touchend(t,s,o){if(!this._firstTwoTouches)return;const[a,h]=this._firstTwoTouches,g=pn(o,s,a),y=pn(o,s,h);g&&y||(this._active&&oe.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 pn(u,t,s){for(let o=0;o<u.length;o++)if(u[o].identifier===s)return t[o]}function Jo(u,t){return Math.log(u/t)/Math.LN2}class Ko extends dn{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,s){const o=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Jo(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Jo(this._distance,o),pinchAround:s}}}function Yo(u,t){return 180*u.angleWith(t)/Math.PI}class Qo extends dn{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,s,o){const a=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Yo(this._vector,a),pinchAround:s}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const s=25/(Math.PI*this._minDiameter)*360,o=Yo(t,this._startVector);return Math.abs(o)<s}}function Er(u){return Math.abs(u.y)>Math.abs(u.x)}class ea extends dn{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,s,o){super.touchstart(t,s,o),this._currentTouchCount=o.length}_start(t){this._lastPoints=t,Er(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,s,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,s,o){if(this._valid!==void 0)return this._valid;const a=t.mag()>=2,h=s.mag()>=2;if(!a&&!h)return;if(!a||!h)return this._firstMove===void 0&&(this._firstMove=o),o-this._firstMove<100&&void 0;const g=t.y>0==s.y>0;return Er(t)&&Er(s)&&g}}const ol={panStep:100,bearingStep:15,pitchStep:10};class ta{constructor(t){this._tr=new As(t);const s=ol;this._panStep=s.panStep,this._bearingStep=s.bearingStep,this._pitchStep=s.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let s=0,o=0,a=0,h=0,g=0;switch(t.keyCode){case 61:case 107:case 171:case 187:s=1;break;case 189:case 109:case 173:s=-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(),g=-1);break;case 40:t.shiftKey?a=-1:(t.preventDefault(),g=1);break;default:return}return this._rotationDisabled&&(o=0,a=0),{cameraAnimation:y=>{const v=this._tr;y.easeTo({duration:300,easeId:"keyboardHandler",easing:al,zoom:s?Math.round(v.zoom)+s*(t.shiftKey?2:1):v.zoom,bearing:v.bearing+o*this._bearingStep,pitch:v.pitch+a*this._pitchStep,offset:[-h*this._panStep,-g*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 al(u){return u*(2-u)}const ia=4.000244140625;class ra{constructor(t,s){this._onTimeout=o=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(o)},this._map=t,this._tr=new As(t),this._triggerRenderFrame=s,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 s=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const o=ae.now(),a=o-(this._lastWheelEventTime||0);this._lastWheelEventTime=o,s!==0&&s%ia==0?this._type="wheel":s!==0&&Math.abs(s)<4?this._type="trackpad":a>400?(this._type=null,this._lastValue=s,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(a*s)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,s+=this._lastValue)),t.shiftKey&&s&&(s/=4),this._type&&(this._lastWheelEvent=t,this._delta-=s,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 s=oe.mousePos(this._map.getCanvas(),t),o=this._tr;this._around=s.y>o.transform.height/2-o.transform.getHorizon()?c.N.convert(this._aroundCenter?o.center:o.unproject(s)):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)>ia?this._wheelZoomRate:this._defaultZoomRate;let w=2/(1+Math.exp(-Math.abs(this._delta*v)));this._delta<0&&w!==0&&(w=1/w);const A=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(A*w))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const s=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,o=this._startZoom,a=this._easing;let h,g=!1;const y=ae.now()-this._lastWheelEventTime;if(this._type==="wheel"&&o&&a&&y){const v=Math.min(y/200,1),w=a(v);h=c.z.number(o,s,w),v<1?this._frameId||(this._frameId=!0):g=!0}else h=s,g=!0;return this._active=!0,g&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!g,zoomDelta:h-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let s=c.b9;if(this._prevEase){const o=this._prevEase,a=(ae.now()-o.start)/o.duration,h=o.easing(a+.01)-o.easing(a),g=.27/Math.sqrt(h*h+1e-4)*.01,y=Math.sqrt(.0729-g*g);s=c.b8(g,y,.25,1)}return this._prevEase={start:ae.now(),duration:t,easing:s},s}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class sa{constructor(t,s){this._clickZoom=t,this._tapZoom=s}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 fn{constructor(t){this._tr=new As(t),this.reset()}reset(){this._active=!1}dblclick(t,s){return t.preventDefault(),{cameraAnimation:o=>{o.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(s)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ll{constructor(){this._tap=new Wo({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,s,o){if(!this._swipePoint)if(this._tapTime){const a=s[0],h=t.timeStamp-this._tapTime<500,g=this._tapPoint.dist(a)<30;h&&g?o.length>0&&(this._swipePoint=a,this._swipeTouch=o[0].identifier):this.reset()}else this._tap.touchstart(t,s,o)}touchmove(t,s,o){if(this._tapTime){if(this._swipePoint){if(o[0].identifier!==this._swipeTouch)return;const a=s[0],h=a.y-this._swipePoint.y;return this._swipePoint=a,t.preventDefault(),this._active=!0,{zoomDelta:h/128}}}else this._tap.touchmove(t,s,o)}touchend(t,s,o){if(this._tapTime)this._swipePoint&&o.length===0&&this.reset();else{const a=this._tap.touchend(t,s,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 qi{constructor(t,s,o){this._el=t,this._mousePan=s,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 Xi{constructor(t,s,o){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=s,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 na{constructor(t,s,o,a){this._el=t,this._touchZoom=s,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 Ji{constructor(t,s){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=t,this._options=s,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=oe.create("div","maplibregl-cooperative-gesture-screen",t);let s=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(s=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const o=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),a=document.createElement("div");a.className="maplibregl-desktop-message",a.textContent=s,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&&(oe.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,s){this._enabled&&(this._map.fire(new c.k("cooperativegestureprevented",{gestureType:t,originalEvent:s})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Ar=u=>u.zoom||u.drag||u.pitch||u.rotate;class ic extends c.k{}function oa(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta}class rc{constructor(t,s){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 g=a.type==="renderFrame"?void 0:a,y={needsRenderFrame:!1},v={},w={},A=a.touches,I=A?this._getMapTouches(A):void 0,L=I?oe.touchPos(this._map.getCanvas(),I):oe.mousePos(this._map.getCanvas(),a);for(const{handlerName:Z,handler:j,allowed:H}of this._handlers){if(!j.isEnabled())continue;let K;this._blockedByActive(w,H,Z)?j.reset():j[h||a.type]&&(K=j[h||a.type](a,L,I),this.mergeHandlerResult(y,v,K,Z,g),K&&K.needsRenderFrame&&this._triggerRenderFrame()),(K||j.isActive())&&(w[Z]=j)}const F={};for(const Z in this._previousActiveHandlers)w[Z]||(F[Z]=g);this._previousActiveHandlers=w,(Object.keys(F).length||oa(y))&&(this._changes.push([y,v,F]),this._triggerRenderFrame()),(Object.keys(w).length||oa(y))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:$}=y;$&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],$(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Jn(t),this._bearingSnap=s.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(s);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,g]of this._listeners)oe.addEventListener(a,h,a===document?this.handleWindowEvent:this.handleEvent,g)}destroy(){for(const[t,s,o]of this._listeners)oe.removeEventListener(t,s,t===document?this.handleWindowEvent:this.handleEvent,o)}_addDefaultHandlers(t){const s=this._map,o=s.getCanvasContainer();this._add("mapEvent",new Yn(s,t));const a=s.boxZoom=new Go(s,t);this._add("boxZoom",a),t.interactive&&t.boxZoom&&a.enable();const h=s.cooperativeGestures=new Ji(s,t.cooperativeGestures);this._add("cooperativeGestures",h),t.cooperativeGestures&&h.enable();const g=new nl(s),y=new fn(s);s.doubleClickZoom=new sa(y,g),this._add("tapZoom",g),this._add("clickZoom",y),t.interactive&&t.doubleClickZoom&&s.doubleClickZoom.enable();const v=new ll;this._add("tapDragZoom",v);const w=s.touchPitch=new ea(s);this._add("touchPitch",w),t.interactive&&t.touchPitch&&s.touchPitch.enable(t.touchPitch);const A=Xo(t),I=ls(t);s.dragRotate=new Xi(t,A,I),this._add("mouseRotate",A,["mousePitch"]),this._add("mousePitch",I,["mouseRotate"]),t.interactive&&t.dragRotate&&s.dragRotate.enable();const L=(({enable:K,clickTolerance:N})=>{const ee=new Ai({checkCorrectEvent:se=>oe.mouseButton(se)===0&&!se.ctrlKey});return new zt({clickTolerance:N,move:(se,le)=>({around:le,panDelta:le.sub(se)}),activateOnStart:!0,moveStateManager:ee,enable:K,assignEvents:hn})})(t),F=new un(t,s);s.dragPan=new qi(o,L,F),this._add("mousePan",L),this._add("touchPan",F,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&s.dragPan.enable(t.dragPan);const $=new Qo,Z=new Ko;s.touchZoomRotate=new na(o,Z,$,v),this._add("touchRotate",$,["touchPan","touchZoom"]),this._add("touchZoom",Z,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&s.touchZoomRotate.enable(t.touchZoomRotate);const j=s.scrollZoom=new ra(s,()=>this._triggerRenderFrame());this._add("scrollZoom",j,["mousePan"]),t.interactive&&t.scrollZoom&&s.scrollZoom.enable(t.scrollZoom);const H=s.keyboard=new ta(s);this._add("keyboard",H),t.interactive&&t.keyboard&&s.keyboard.enable(),this._add("blockableMapEvent",new Zo(s))}_add(t,s,o){this._handlers.push({handlerName:t,handler:s,allowed:o}),this._handlersById[t]=s}stop(t){if(!this._updatingCamera){for(const{handler:s}of this._handlers)s.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!!Ar(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,s,o){for(const a in t)if(a!==o&&(!s||s.indexOf(a)<0))return!0;return!1}_getMapTouches(t){const s=[];for(const o of t)this._el.contains(o.target)&&s.push(o);return s}mergeHandlerResult(t,s,o,a,h){if(!o)return;c.e(t,o);const g={handlerName:a,originalEvent:o.originalEvent||h};o.zoomDelta!==void 0&&(s.zoom=g),o.panDelta!==void 0&&(s.drag=g),o.pitchDelta!==void 0&&(s.pitch=g),o.bearingDelta!==void 0&&(s.rotate=g)}_applyChanges(){const t={},s={},o={};for(const[a,h,g]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(s,h),c.e(o,g);this._updateMapTransform(t,s,o),this._changes=[]}_updateMapTransform(t,s,o){const a=this._map,h=a._getTransformForUpdate(),g=a.terrain;if(!(oa(t)||g&&this._terrainMovement))return this._fireEvents(s,o,!0);let{panDelta:y,zoomDelta:v,bearingDelta:w,pitchDelta:A,around:I,pinchAround:L}=t;L!==void 0&&(I=L),a._stop(!0),I=I||a.transform.centerPoint;const F=h.pointLocation(y?I.sub(y):I);w&&(h.bearing+=w),A&&(h.pitch+=A),v&&(h.zoom+=v),g?this._terrainMovement||!s.drag&&!s.zoom?s.drag&&this._terrainMovement?h.center=h.pointLocation(h.centerPoint.sub(y)):h.setLocationAtPoint(F,I):(this._terrainMovement=!0,this._map._elevationFreeze=!0,h.setLocationAtPoint(F,I)):h.setLocationAtPoint(F,I),a._applyUpdatedTransform(h),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(s,o,!0)}_fireEvents(t,s,o){const a=Ar(this._eventsInProgress),h=Ar(t),g={};for(const I in t){const{originalEvent:L}=t[I];this._eventsInProgress[I]||(g[`${I}start`]=L),this._eventsInProgress[I]=t[I]}!a&&h&&this._fireEvent("movestart",h.originalEvent);for(const I in g)this._fireEvent(I,g[I]);h&&this._fireEvent("move",h.originalEvent);for(const I in t){const{originalEvent:L}=t[I];this._fireEvent(I,L)}const y={};let v;for(const I in this._eventsInProgress){const{handlerName:L,originalEvent:F}=this._eventsInProgress[I];this._handlersById[L].isActive()||(delete this._eventsInProgress[I],v=s[L]||F,y[`${I}end`]=v)}for(const I in y)this._fireEvent(I,y[I]);const w=Ar(this._eventsInProgress),A=(a||h)&&!w;if(A&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const I=this._map._getTransformForUpdate();I.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(I)}if(o&&A){this._updatingCamera=!0;const I=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),L=F=>F!==0&&-this._bearingSnap<F&&F<this._bearingSnap;!I||!I.essential&&ae.prefersReducedMotion?(this._map.fire(new c.k("moveend",{originalEvent:v})),L(this._map.getBearing())&&this._map.resetNorth()):(L(I.bearing||this._map.getBearing())&&(I.bearing=0),I.freezeElevation=!0,this._map.easeTo(I,{originalEvent:v})),this._updatingCamera=!1}}_fireEvent(t,s){this._map.fire(new c.k(t,s?{originalEvent:s}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new ic("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class sc extends c.E{constructor(t,s){super(),this._renderFrameCallback=()=>{const o=Math.min((ae.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=s.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new c.N(this.transform.center.lng,this.transform.center.lat)}setCenter(t,s){return this.jumpTo({center:t},s)}panBy(t,s,o){return t=c.P.convert(t).mult(-1),this.panTo(this.transform.center,c.e({offset:t},s),o)}panTo(t,s,o){return this.easeTo(c.e({center:t},s),o)}getZoom(){return this.transform.zoom}setZoom(t,s){return this.jumpTo({zoom:t},s),this}zoomTo(t,s,o){return this.easeTo(c.e({zoom:t},s),o)}zoomIn(t,s){return this.zoomTo(this.getZoom()+1,t,s),this}zoomOut(t,s){return this.zoomTo(this.getZoom()-1,t,s),this}getBearing(){return this.transform.bearing}setBearing(t,s){return this.jumpTo({bearing:t},s),this}getPadding(){return this.transform.padding}setPadding(t,s){return this.jumpTo({padding:t},s),this}rotateTo(t,s,o){return this.easeTo(c.e({bearing:t},s),o)}resetNorth(t,s){return this.rotateTo(0,c.e({duration:1e3},t),s),this}resetNorthPitch(t,s){return this.easeTo(c.e({bearing:0,pitch:0,duration:1e3},t),s),this}snapToNorth(t,s){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,s):this}getPitch(){return this.transform.pitch}setPitch(t,s){return this.jumpTo({pitch:t},s),this}cameraForBounds(t,s){t=he.convert(t);const o=s&&s.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),o,s)}_cameraForBoxAndBearing(t,s,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 be=a.padding;a.padding={top:be,bottom:be,right:be,left:be}}a.padding=c.e(h,a.padding);const g=this.transform,y=g.padding,v=new he(t,s),w=g.project(v.getNorthWest()),A=g.project(v.getNorthEast()),I=g.project(v.getSouthEast()),L=g.project(v.getSouthWest()),F=c.ba(-o),$=w.rotate(F),Z=A.rotate(F),j=I.rotate(F),H=L.rotate(F),K=new c.P(Math.max($.x,Z.x,H.x,j.x),Math.max($.y,Z.y,H.y,j.y)),N=new c.P(Math.min($.x,Z.x,H.x,j.x),Math.min($.y,Z.y,H.y,j.y)),ee=K.sub(N),se=(g.width-(y.left+y.right+a.padding.left+a.padding.right))/ee.x,le=(g.height-(y.top+y.bottom+a.padding.top+a.padding.bottom))/ee.y;if(le<0||se<0)return void c.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const me=Math.min(g.scaleZoom(g.scale*Math.min(se,le)),a.maxZoom),ve=c.P.convert(a.offset),Me=new c.P((a.padding.left-a.padding.right)/2,(a.padding.top-a.padding.bottom)/2).rotate(c.ba(o)),De=ve.add(Me).mult(g.scale/g.zoomScale(me));return{center:g.unproject(w.add(I).div(2).sub(De)),zoom:me,bearing:o}}fitBounds(t,s,o){return this._fitInternal(this.cameraForBounds(t,s),s,o)}fitScreenCoordinates(t,s,o,a,h){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(c.P.convert(t)),this.transform.pointLocation(c.P.convert(s)),o,a),a,h)}_fitInternal(t,s,o){return t?(delete(s=c.e(t,s)).padding,s.linear?this.easeTo(s,o):this.flyTo(s,o)):this}jumpTo(t,s){this.stop();const o=this._getTransformForUpdate();let a=!1,h=!1,g=!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&&(g=!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",s)).fire(new c.k("move",s)),a&&this.fire(new c.k("zoomstart",s)).fire(new c.k("zoom",s)).fire(new c.k("zoomend",s)),h&&this.fire(new c.k("rotatestart",s)).fire(new c.k("rotate",s)).fire(new c.k("rotateend",s)),g&&this.fire(new c.k("pitchstart",s)).fire(new c.k("pitch",s)).fire(new c.k("pitchend",s)),this.fire(new c.k("moveend",s))}calculateCameraOptionsFromTo(t,s,o,a=0){const h=c.Z.fromLngLat(t,s),g=c.Z.fromLngLat(o,a),y=g.x-h.x,v=g.y-h.y,w=g.z-h.z,A=Math.hypot(y,v,w);if(A===0)throw new Error("Can't calculate camera options with same From and To");const I=Math.hypot(y,v),L=this.transform.scaleZoom(this.transform.cameraToCenterDistance/A/this.transform.tileSize),F=180*Math.atan2(y,-v)/Math.PI;let $=180*Math.acos(I/A)/Math.PI;return $=w<0?90-$:90+$,{center:g.toLngLat(),zoom:L,pitch:$,bearing:F}}easeTo(t,s){var o;this._stop(!1,t.easeId),((t=c.e({offset:[0,0],duration:500,easing:c.b9},t)).animate===!1||!t.essential&&ae.prefersReducedMotion)&&(t.duration=0);const a=this._getTransformForUpdate(),h=a.zoom,g=a.bearing,y=a.pitch,v=a.padding,w="bearing"in t?this._normalizeBearing(t.bearing,g):g,A="pitch"in t?+t.pitch:y,I="padding"in t?t.padding:a.padding,L=c.P.convert(t.offset);let F=a.centerPoint.add(L);const $=a.pointLocation(F),{center:Z,zoom:j}=a.getConstrained(c.N.convert(t.center||$),(o=t.zoom)!==null&&o!==void 0?o:h);this._normalizeCenter(Z,a);const H=a.project($),K=a.project(Z).sub(H),N=a.zoomScale(j-h);let ee,se;t.around&&(ee=c.N.convert(t.around),se=a.locationPoint(ee));const le={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||j!==h,this._rotating=this._rotating||g!==w,this._pitching=this._pitching||A!==y,this._padding=!a.isPaddingEqual(I),this._easeId=t.easeId,this._prepareEase(s,t.noMoveStart,le),this.terrain&&this._prepareElevation(Z),this._ease(me=>{if(this._zooming&&(a.zoom=c.z.number(h,j,me)),this._rotating&&(a.bearing=c.z.number(g,w,me)),this._pitching&&(a.pitch=c.z.number(y,A,me)),this._padding&&(a.interpolatePadding(v,I,me),F=a.centerPoint.add(L)),this.terrain&&!t.freezeElevation&&this._updateElevation(me),ee)a.setLocationAtPoint(ee,se);else{const ve=a.zoomScale(a.zoom-h),Me=j>h?Math.min(2,N):Math.max(.5,N),De=Math.pow(Me,1-me),be=a.unproject(H.add(K.mult(me*De)).mult(ve));a.setLocationAtPoint(a.renderWorldCopies?be.wrap():be,F)}this._applyUpdatedTransform(a),this._fireMoveEvents(s)},me=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(s,me)},t),this}_prepareEase(t,s,o={}){this._moving=!0,s||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 s=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&s!==this._elevationTarget){const o=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(o-(s-(o*t+this._elevationStart))/(1-t)),this._elevationTarget=s}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 s=t.getCameraPosition(),o=this.terrain.getElevationForLngLatZoom(s.lngLat,t.zoom);if(s.altitude<o){const a=this.calculateCameraOptionsFromTo(s.lngLat,o,t.center,t.elevation);return{pitch:a.pitch,zoom:a.zoom}}return{}}_applyUpdatedTransform(t){const s=[];if(this.terrain&&s.push(a=>this._elevateCameraIfInsideTerrain(a)),this.transformCameraUpdate&&s.push(a=>this.transformCameraUpdate(a)),!s.length)return;const o=t.clone();for(const a of s){const h=o.clone(),{center:g,zoom:y,pitch:v,bearing:w,elevation:A}=a(h);g&&(h.center=g),y!==void 0&&(h.zoom=y),v!==void 0&&(h.pitch=v),w!==void 0&&(h.bearing=w),A!==void 0&&(h.elevation=A),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,s){if(this._easeId&&s&&this._easeId===s)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,s){var o;if(!t.essential&&ae.prefersReducedMotion){const Pe=c.M(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Pe,s)}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,g=a.bearing,y=a.pitch,v=a.padding,w="bearing"in t?this._normalizeBearing(t.bearing,g):g,A="pitch"in t?+t.pitch:y,I="padding"in t?t.padding:a.padding,L=c.P.convert(t.offset);let F=a.centerPoint.add(L);const $=a.pointLocation(F),{center:Z,zoom:j}=a.getConstrained(c.N.convert(t.center||$),(o=t.zoom)!==null&&o!==void 0?o:h);this._normalizeCenter(Z,a);const H=a.zoomScale(j-h),K=a.project($),N=a.project(Z).sub(K);let ee=t.curve;const se=Math.max(a.width,a.height),le=se/H,me=N.mag();if("minZoom"in t){const Pe=c.ad(Math.min(t.minZoom,h,j),a.minZoom,a.maxZoom),Ke=se/a.zoomScale(Pe-h);ee=Math.sqrt(Ke/me*2)}const ve=ee*ee;function Me(Pe){const Ke=(le*le-se*se+(Pe?-1:1)*ve*ve*me*me)/(2*(Pe?le:se)*ve*me);return Math.log(Math.sqrt(Ke*Ke+1)-Ke)}function De(Pe){return(Math.exp(Pe)-Math.exp(-Pe))/2}function be(Pe){return(Math.exp(Pe)+Math.exp(-Pe))/2}const we=Me(!1);let Oe=function(Pe){return be(we)/be(we+ee*Pe)},Qe=function(Pe){return se*((be(we)*(De(Ke=we+ee*Pe)/be(Ke))-De(we))/ve)/me;var Ke},Ee=(Me(!0)-we)/ee;if(Math.abs(me)<1e-6||!isFinite(Ee)){if(Math.abs(se-le)<1e-6)return this.easeTo(t,s);const Pe=le<se?-1:1;Ee=Math.abs(Math.log(le/se))/ee,Qe=()=>0,Oe=Ke=>Math.exp(Pe*ee*Ke)}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=g!==w,this._pitching=A!==y,this._padding=!a.isPaddingEqual(I),this._prepareEase(s,!1),this.terrain&&this._prepareElevation(Z),this._ease(Pe=>{const Ke=Pe*Ee,Dt=1/Oe(Ke);a.zoom=Pe===1?j:h+a.scaleZoom(Dt),this._rotating&&(a.bearing=c.z.number(g,w,Pe)),this._pitching&&(a.pitch=c.z.number(y,A,Pe)),this._padding&&(a.interpolatePadding(v,I,Pe),F=a.centerPoint.add(L)),this.terrain&&!t.freezeElevation&&this._updateElevation(Pe);const st=Pe===1?Z:a.unproject(K.add(N.mult(Qe(Ke))).mult(Dt));a.setLocationAtPoint(a.renderWorldCopies?st.wrap():st,F),this._applyUpdatedTransform(a),this._fireMoveEvents(s)},()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(s)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,s){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,s)}return t||(o=this.handlers)===null||o===void 0||o.stop(!1),this}_ease(t,s,o){o.animate===!1||o.duration===0?(t(1),s()):(this._easeStart=ae.now(),this._easeOptions=o,this._onEaseFrame=t,this._onEaseEnd=s,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,s){t=c.b3(t,-180,180);const o=Math.abs(t-s);return Math.abs(t-360-s)<o&&(t-=360),Math.abs(t+360-s)<o&&(t+=360),t}_normalizeCenter(t,s){if(!s.renderWorldCopies||s.lngRange)return;const o=t.lng-s.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 aa={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Ps{constructor(t=aa){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=s=>{!s||s.sourceDataType!=="metadata"&&s.sourceDataType!=="visibility"&&s.dataType!=="style"&&s.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=oe.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=oe.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=oe.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(){oe.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,s){const o=this._map._getUIString(`AttributionControl.${s}`);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 s=this._map.style.sourceCaches;for(const a in s){const h=s[a];if(h.used||h.usedForTerrain){const g=h.getSource();g.attribution&&t.indexOf(g.attribution)<0&&t.push(g.attribution)}}t=t.filter(a=>String(a).trim()),t.sort((a,h)=>a.length-h.length),t=t.filter((a,h)=>{for(let g=h+1;g<t.length;g++)if(t[g].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 pr{constructor(t={}){this._updateCompact=()=>{const s=this._container.children;if(s.length){const o=s[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=oe.create("div","maplibregl-ctrl");const s=oe.create("a","maplibregl-ctrl-logo");return s.target="_blank",s.rel="noopener nofollow",s.href="https://maplibre.org/",s.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),s.setAttribute("rel","noopener nofollow"),this._container.appendChild(s),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){oe.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Re{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const s=++this._id;return this._queue.push({callback:t,id:s,cancelled:!1}),s}remove(t){const s=this._currentlyRunning,o=s?this._queue.concat(s):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 s=this._currentlyRunning=this._queue;this._queue=[];for(const o of s)if(!o.cancelled&&(o.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var cl=c.Y([{name:"a_pos3d",type:"Int16",components:3}]);class la 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,s){this.sourceCache.update(t,s),this._renderableTilesKeys=[];const o={};for(const a of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:s}))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 Rr(a,this.tileSize));for(const a in this._tiles)o[a]||delete this._tiles[a]}freeRtt(t){for(const s in this._tiles){const o=this._tiles[s];(!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 s={};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),s[o]=h}else if(a.canonical.isChildOf(t.canonical)){const h=t.clone();h.posMatrix=new Float64Array(16);const g=a.canonical.z-t.canonical.z,y=a.canonical.x-(a.canonical.x>>g<<g),v=a.canonical.y-(a.canonical.y>>g<<g),w=c.X>>g;c.aQ(h.posMatrix,0,w,0,w,0,1),c.J(h.posMatrix,h.posMatrix,[-y*w,-v*w,0]),s[o]=h}else if(t.canonical.isChildOf(a.canonical)){const h=t.clone();h.posMatrix=new Float64Array(16);const g=t.canonical.z-a.canonical.z,y=t.canonical.x-(t.canonical.x>>g<<g),v=t.canonical.y-(t.canonical.y>>g<<g),w=c.X>>g;c.aQ(h.posMatrix,0,c.X,0,c.X,0,1),c.J(h.posMatrix,h.posMatrix,[y*w,v*w,0]),c.K(h.posMatrix,h.posMatrix,[1/2**g,1/2**g,0]),s[o]=h}}return s}getSourceTile(t,s){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)&&s)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(s=>s.timeAdded>=t)}}class hl{constructor(t,s,o){this.painter=t,this.sourceCache=new la(s),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,s,o,a=c.X){var h;if(!(s>=0&&s<a&&o>=0&&o<a))return 0;const g=this.getTerrainData(t),y=(h=g.tile)===null||h===void 0?void 0:h.dem;if(!y)return 0;const v=function($,Z,j){var H=Z[0],K=Z[1];return $[0]=j[0]*H+j[4]*K+j[12],$[1]=j[1]*H+j[5]*K+j[13],$}([],[s/a*c.X,o/a*c.X],g.u_terrain_matrix),w=[v[0]*y.dim,v[1]*y.dim],A=Math.floor(w[0]),I=Math.floor(w[1]),L=w[0]-A,F=w[1]-I;return y.get(A,I)*(1-L)*(1-F)+y.get(A+1,I)*L*(1-F)+y.get(A,I+1)*(1-L)*F+y.get(A+1,I+1)*L*F}getElevationForLngLatZoom(t,s){const{tileID:o,mercatorX:a,mercatorY:h}=this._getOverscaledTileIDFromLngLatZoom(t,s);return this.getElevation(o,a%c.X,h%c.X,c.X)}getElevation(t,s,o,a=c.X){return this.getDEMElevation(t,s,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 vt(a,h,a.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new vt(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 s=this.sourceCache.getSourceTile(t,!0);if(s&&s.dem&&(!s.demTexture||s.needsTerrainPrepare)){const a=this.painter.context;s.demTexture=this.painter.getTileTexture(s.dem.stride),s.demTexture?s.demTexture.update(s.dem.getPixels(),{premultiply:!1}):s.demTexture=new vt(a,s.dem.getPixels(),a.gl.RGBA,{premultiply:!1}),s.demTexture.bind(a.gl.NEAREST,a.gl.CLAMP_TO_EDGE),s.needsTerrainPrepare=!1}const o=s&&s+s.tileID.key+t.key;if(o&&!this._demMatrixCache[o]){const a=this.sourceCache.sourceCache._source.maxzoom;let h=t.canonical.z-s.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 g=t.canonical.x-(t.canonical.x>>h<<h),y=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,[g*c.X,y*c.X,0]),this._demMatrixCache[t.key]={matrix:v,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:s&&s.dem&&s.dem.dim||1,u_terrain_matrix:o?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:s&&s.dem&&s.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(s&&s.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:s}}getFramebuffer(t){const s=this.painter,o=s.width/devicePixelRatio,a=s.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(s.context,{width:o,height:a,data:null},s.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(s.context.gl.NEAREST,s.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new vt(s.context,{width:o,height:a,data:null},s.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(s.context.gl.NEAREST,s.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=s.context.createFramebuffer(o,a,!0,!1),this._fbo.depthAttachment.set(s.context.createRenderbuffer(s.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 s=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let h=0,g=0;h<this._coordsTextureSize;h++)for(let y=0;y<this._coordsTextureSize;y++,g+=4)s[g+0]=255&y,s[g+1]=255&h,s[g+2]=y>>8<<4|h>>8,s[g+3]=0;const o=new c.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(s.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 s=new Uint8Array(4),o=this.painter.context,a=o.gl,h=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),g=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),y=Math.round(this.painter.height/devicePixelRatio);o.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),a.readPixels(h,y-g-1,1,1,a.RGBA,a.UNSIGNED_BYTE,s),o.bindFramebuffer.set(null);const v=s[0]+(s[2]>>4<<8),w=s[1]+((15&s[2])<<8),A=this.coordsIndex[255-s[3]],I=A&&this.sourceCache.getTileByID(A);if(!I)return null;const L=this._coordsTextureSize,F=(1<<I.tileID.canonical.z)*L;return new c.Z((I.tileID.canonical.x*L+v)/F+I.tileID.wrap,(I.tileID.canonical.y*L+w)/F,this.getElevation(I.tileID,v,w,L))}depthAtPoint(t){const s=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,s),o.bindFramebuffer.set(null),(s[0]/16777216+s[1]/65536+s[2]/256+s[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.painter.context,s=new c.bc,o=new c.aY,a=this.meshSize,h=c.X/a,g=a*a;for(let I=0;I<=a;I++)for(let L=0;L<=a;L++)s.emplaceBack(L*h,I*h,0);for(let I=0;I<g;I+=a+1)for(let L=0;L<a;L++)o.emplaceBack(L+I,a+L+I+1,a+L+I+2),o.emplaceBack(L+I,a+L+I+2,L+I+1);const y=s.length,v=y+2*(a+1);for(const I of[0,1])for(let L=0;L<=a;L++)for(const F of[0,1])s.emplaceBack(L*h,I*c.X,F);for(let I=0;I<2*a;I+=2)o.emplaceBack(v+I,v+I+1,v+I+3),o.emplaceBack(v+I,v+I+3,v+I+2),o.emplaceBack(y+I,y+I+3,y+I+1),o.emplaceBack(y+I,y+I+2,y+I+3);const w=s.length,A=w+2*(a+1);for(const I of[0,1])for(let L=0;L<=a;L++)for(const F of[0,1])s.emplaceBack(I*c.X,L*h,F);for(let I=0;I<2*a;I+=2)o.emplaceBack(w+I,w+I+1,w+I+3),o.emplaceBack(w+I,w+I+3,w+I+2),o.emplaceBack(A+I,A+I+3,A+I+1),o.emplaceBack(A+I,A+I+2,A+I+3);return this._mesh=new il(t.createVertexBuffer(s,cl.members),t.createIndexBuffer(o),c.a0.simpleSegment(0,0,s.length,o.length)),this._mesh}getMeshFrameDelta(t){return 2*Math.PI*c.bd/Math.pow(2,t)/5}getMinTileElevationForLngLatZoom(t,s){var o;const{tileID:a}=this._getOverscaledTileIDFromLngLatZoom(t,s);return(o=this.getMinMaxElevation(a).minElevation)!==null&&o!==void 0?o:0}getMinMaxElevation(t){const s=this.getTerrainData(t).tile,o={minElevation:null,maxElevation:null};return s&&s.dem&&(o.minElevation=s.dem.min*this.exaggeration,o.maxElevation=s.dem.max*this.exaggeration),o}_getOverscaledTileIDFromLngLatZoom(t,s){const o=c.Z.fromLngLat(t.wrap()),a=(1<<s)*c.X,h=o.x*a,g=o.y*a,y=Math.floor(h/c.X),v=Math.floor(g/c.X);return{tileID:new c.S(s,0,s,y,v),mercatorX:h,mercatorY:g}}}class mn{constructor(t,s,o){this._context=t,this._size=s,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 s=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),s.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),s.colorAttachment.set(o.texture),{id:t,fbo:s,texture:o,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(s=>t.id!==s),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const s of this._recentlyUsed)if(!this._objects[s].inUse)return this._objects[s];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 fr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class ul{constructor(t,s){this.painter=t,this.terrain=s,this.pool=new mn(t.context,30,s.sourceCache.tileSize*s.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,s){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(o=>!t._layers[o].isHidden(s)),this._coordsDescendingInv={};for(const o in t.sourceCaches){this._coordsDescendingInv[o]={};const a=t.sourceCaches[o].getVisibleCoordinates();for(const h of a){const g=this.terrain.sourceCache.getTerrainCoords(h);for(const y in g)this._coordsDescendingInv[o][y]||(this._coordsDescendingInv[o][y]=[]),this._coordsDescendingInv[o][y].push(g[y])}}this._coordsDescendingInvStr={};for(const o of t._order){const a=t._layers[o],h=a.source;if(fr[a.type]&&!this._coordsDescendingInvStr[h]){this._coordsDescendingInvStr[h]={};for(const g in this._coordsDescendingInv[h])this._coordsDescendingInvStr[h][g]=this._coordsDescendingInv[h][g].map(y=>y.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 s=t.type,o=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(fr[s]&&(this._prevType&&fr[this._prevType]||this._stacks.push([]),this._prevType=s,this._stacks[this._stacks.length-1].push(t.id),!a))return!0;if(fr[this._prevType]||fr[s]&&a){this._prevType=s;const h=this._stacks.length-1,g=this._stacks[h]||[];for(const y of this._renderableTiles){if(this.pool.isFull()&&(an(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(y),y.rtt[h]){const w=this.pool.getObjectForId(y.rtt[h].id);if(w.stamp===y.rtt[h].stamp){this.pool.useObject(w);continue}}const v=this.pool.getOrCreateFreeObject();this.pool.useObject(v),this.pool.stampObject(v),y.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 w=0;w<g.length;w++){const A=o.style._layers[g[w]],I=A.source?this._coordsDescendingInv[A.source][y.tileID.key]:[y.tileID];o.context.viewport.set([0,0,v.fbo.width,v.fbo.height]),o._renderTileClippingMasks(A,I),o.renderLayer(o,o.style.sourceCaches[A.source],A,I),A.source&&(y.rttCoords[A.source]=this._coordsDescendingInvStr[A.source][y.tileID.key])}}return an(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),fr[s]}return!1}}const Ce={"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=fe,nc={hash:!1,interactive:!0,bearingSnap:7,attributionControl:aa,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},dl=u=>{u.touchstart=u.dragStart,u.touchmoveWindow=u.dragMove,u.touchend=u.dragEnd},ha={showCompass:!0,showZoom:!0,visualizePitch:!1};class pl{constructor(t,s,o=!1){this.mousedown=g=>{this.startMouse(c.e({},g,{ctrlKey:!0,preventDefault:()=>g.preventDefault()}),oe.mousePos(this.element,g)),oe.addEventListener(window,"mousemove",this.mousemove),oe.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=g=>{this.moveMouse(g,oe.mousePos(this.element,g))},this.mouseup=g=>{this.mouseRotate.dragEnd(g),this.mousePitch&&this.mousePitch.dragEnd(g),this.offTemp()},this.touchstart=g=>{g.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=oe.touchPos(this.element,g.targetTouches)[0],this.startTouch(g,this._startPos),oe.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),oe.addEventListener(window,"touchend",this.touchend))},this.touchmove=g=>{g.targetTouches.length!==1?this.reset():(this._lastPos=oe.touchPos(this.element,g.targetTouches)[0],this.moveTouch(g,this._lastPos))},this.touchend=g=>{g.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const a=t.dragRotate._mouseRotate.getClickTolerance(),h=t.dragRotate._mousePitch.getClickTolerance();this.element=s,this.mouseRotate=Xo({clickTolerance:a,enable:!0}),this.touchRotate=(({enable:g,clickTolerance:y,bearingDegreesPerPixelMoved:v=.8})=>{const w=new Qn;return new zt({clickTolerance:y,move:(A,I)=>({bearingDelta:(I.x-A.x)*v}),moveStateManager:w,enable:g,assignEvents:dl})})({clickTolerance:a,enable:!0}),this.map=t,o&&(this.mousePitch=ls({clickTolerance:h,enable:!0}),this.touchPitch=(({enable:g,clickTolerance:y,pitchDegreesPerPixelMoved:v=-.5})=>{const w=new Qn;return new zt({clickTolerance:y,move:(A,I)=>({pitchDelta:(I.y-A.y)*v}),moveStateManager:w,enable:g,assignEvents:dl})})({clickTolerance:h,enable:!0})),oe.addEventListener(s,"mousedown",this.mousedown),oe.addEventListener(s,"touchstart",this.touchstart,{passive:!1}),oe.addEventListener(s,"touchcancel",this.reset)}startMouse(t,s){this.mouseRotate.dragStart(t,s),this.mousePitch&&this.mousePitch.dragStart(t,s),oe.disableDrag()}startTouch(t,s){this.touchRotate.dragStart(t,s),this.touchPitch&&this.touchPitch.dragStart(t,s),oe.disableDrag()}moveMouse(t,s){const o=this.map,{bearingDelta:a}=this.mouseRotate.dragMove(t,s)||{};if(a&&o.setBearing(o.getBearing()+a),this.mousePitch){const{pitchDelta:h}=this.mousePitch.dragMove(t,s)||{};h&&o.setPitch(o.getPitch()+h)}}moveTouch(t,s){const o=this.map,{bearingDelta:a}=this.touchRotate.dragMove(t,s)||{};if(a&&o.setBearing(o.getBearing()+a),this.touchPitch){const{pitchDelta:h}=this.touchPitch.dragMove(t,s)||{};h&&o.setPitch(o.getPitch()+h)}}off(){const t=this.element;oe.removeEventListener(t,"mousedown",this.mousedown),oe.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),oe.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),oe.removeEventListener(window,"touchend",this.touchend),oe.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){oe.enableDrag(),oe.removeEventListener(window,"mousemove",this.mousemove),oe.removeEventListener(window,"mouseup",this.mouseup),oe.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),oe.removeEventListener(window,"touchend",this.touchend)}}let Nr;function fl(u,t,s){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),g=s.locationPoint(u).distSqr(t);s.locationPoint(a).distSqr(t)<g?u=a:s.locationPoint(h).distSqr(t)<g&&(u=h)}for(;Math.abs(u.lng-s.center.lng)>180;){const a=s.locationPoint(u);if(a.x>=0&&a.y>=0&&a.x<=s.width&&a.y<=s.height)break;u.lng>s.center.lng?u.lng-=360:u.lng+=360}return u.lng!==o.lng&&s.locationPoint(u).y>s.height/2-s.getHorizon()?u:o}const ua={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,s){const o=u.classList;for(const a in ua)o.remove(`maplibregl-${s}-anchor-${a}`);o.add(`maplibregl-${s}-anchor-${t}`)}class It extends c.E{constructor(t){if(super(),this._onKeyPress=s=>{const o=s.code,a=s.charCode||s.keyCode;o!=="Space"&&o!=="Enter"&&a!==32&&a!==13||this.togglePopup()},this._onMapClick=s=>{const o=s.originalEvent.target,a=this._element;this._popup&&(o===a||a.contains(o))&&this.togglePopup()},this._update=s=>{var o;if(!this._map)return;const a=this._map.loaded()&&!this._map.isMoving();((s==null?void 0:s.type)==="terrain"||(s==null?void 0:s.type)==="render"&&!a)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?fl(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 g="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?g="rotateX(0deg)":this._pitchAlignment==="map"&&(g=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||s&&s.type!=="moveend"||(this._pos=this._pos.round()),oe.setTransform(this._element,`${ua[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${g} ${h}`),ae.frameAsync(new AbortController).then(()=>{this._updateOpacity(s&&s.type==="moveend")}).catch(()=>{})},this._onMove=s=>{if(!this._isDragging){const o=this._clickTolerance||this._map._clickTolerance;this._isDragging=s.point.dist(this._pointerdownPos)>=o}this._isDragging&&(this._pos=s.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=s=>{this._element.contains(s.originalEvent.target)&&(s.preventDefault(),this._positionDelta=s.point.sub(this._pos).add(this._offset),this._pointerdownPos=s.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=oe.create("div");const s=oe.createNS("http://www.w3.org/2000/svg","svg"),o=41,a=27;s.setAttributeNS(null,"display","block"),s.setAttributeNS(null,"height",`${o}px`),s.setAttributeNS(null,"width",`${a}px`),s.setAttributeNS(null,"viewBox",`0 0 ${a} ${o}`);const h=oe.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 g=oe.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"fill-rule","nonzero");const y=oe.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(3.0, 29.0)"),y.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=oe.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),y.appendChild(K)}const w=oe.createNS("http://www.w3.org/2000/svg","g");w.setAttributeNS(null,"fill",this._color);const A=oe.createNS("http://www.w3.org/2000/svg","path");A.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"),w.appendChild(A);const I=oe.createNS("http://www.w3.org/2000/svg","g");I.setAttributeNS(null,"opacity","0.25"),I.setAttributeNS(null,"fill","#000000");const L=oe.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"),I.appendChild(L);const F=oe.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"transform","translate(6.0, 7.0)"),F.setAttributeNS(null,"fill","#FFFFFF");const $=oe.createNS("http://www.w3.org/2000/svg","g");$.setAttributeNS(null,"transform","translate(8.0, 8.0)");const Z=oe.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 j=oe.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"),$.appendChild(Z),$.appendChild(j),g.appendChild(y),g.appendChild(w),g.appendChild(I),g.appendChild(F),g.appendChild($),s.appendChild(g),s.setAttributeNS(null,"height",o*this._scale+"px"),s.setAttributeNS(null,"width",a*this._scale+"px"),this._element.appendChild(s),this._offset=c.P.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",s=>{s.preventDefault()}),this._element.addEventListener("mousedown",s=>{s.preventDefault()}),jr(this._element,this._anchor,"marker"),t&&t.className)for(const s of t.className.split(" "))this._element.classList.add(s);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),oe.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 s,o;if(!(!((s=this._map)===null||s===void 0)&&s.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),g=a.terrain.getElevationForLngLatZoom(this._lngLat,a.transform.tileZoom);if(a.transform.lngLatToCameraDepth(this._lngLat,g)-h<.006)return void(this._element.style.opacity=this._opacity);const y=-this._offset.y/a.transform._pixelPerMeter,v=Math.sin(a.getPitch()*Math.PI/180)*y,w=a.terrain.depthAtPoint(new c.P(this._pos.x,this._pos.y-this._offset.y)),A=a.transform.lngLatToCameraDepth(this._lngLat,g+v)-w>.006;!((o=this._popup)===null||o===void 0)&&o.isOpen()&&A&&this._popup.remove(),this._element.style.opacity=A?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,s){return t===void 0&&s===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=t),s!==void 0&&(this._opacityWhenCovered=s),this._map&&this._updateOpacity(!0),this}}const eo={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let ks=0,Cs=!1;const ml={maxWidth:100,unit:"metric"};function da(u,t,s){const o=s&&s.maxWidth||100,a=u._container.clientHeight/2,h=u.unproject([0,a]),g=u.unproject([o,a]),y=h.distanceTo(g);if(s&&s.unit==="imperial"){const v=3.2808*y;v>5280?gn(t,o,v/5280,u._getUIString("ScaleControl.Miles")):gn(t,o,v,u._getUIString("ScaleControl.Feet"))}else s&&s.unit==="nautical"?gn(t,o,y/1852,u._getUIString("ScaleControl.NauticalMiles")):y>=1e3?gn(t,o,y/1e3,u._getUIString("ScaleControl.Kilometers")):gn(t,o,y,u._getUIString("ScaleControl.Meters"))}function gn(u,t,s,o){const a=function(h){const g=Math.pow(10,`${Math.floor(h)}`.length-1);let y=h/g;return y=y>=10?10:y>=5?5:y>=3?3:y>=2?2:y>=1?1:function(v){const w=Math.pow(10,Math.ceil(-Math.log(v)/Math.LN10));return Math.round(v*w)/w}(y),g*y}(s);u.style.width=t*(a/s)+"px",u.innerHTML=`${a} ${o}`}const mr={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},to=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function je(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 je(new c.P(0,0))}const We=fe;T.AJAXError=c.bg,T.Evented=c.E,T.LngLat=c.N,T.MercatorCoordinate=c.Z,T.Point=c.P,T.addProtocol=c.bh,T.config=c.a,T.removeProtocol=c.bi,T.AttributionControl=Ps,T.BoxZoomHandler=Go,T.CanvasSource=ji,T.CooperativeGesturesHandler=Ji,T.DoubleClickZoomHandler=sa,T.DragPanHandler=qi,T.DragRotateHandler=Xi,T.EdgeInsets=Hn,T.FullscreenControl=class extends c.E{constructor(u={}){super(),this._onFullscreenChange=()=>{var t;let s=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((t=s==null?void 0:s.shadowRoot)===null||t===void 0)&&t.fullscreenElement;)s=s.shadowRoot.fullscreenElement;s===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=oe.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){oe.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=oe.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);oe.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()}},T.GeoJSONSource=qs,T.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 s=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),g=he.fromLngLat(s,o);this._map.fitBounds(g,h,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const s=new c.N(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(s).addTo(this._map),this._userLocationDotMarker.setLngLat(s).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 s=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=s,this._geolocateButton.setAttribute("aria-label",s),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&Cs)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=oe.create("button","maplibregl-ctrl-geolocate",this._container),oe.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 s=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=s,this._geolocateButton.setAttribute("aria-label",s)}else{const s=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=s,this._geolocateButton.setAttribute("aria-label",s)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=oe.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new It({element:this._dotElement}),this._circleElement=oe.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new It({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",s=>{s.geolocateSource||this._watchState!=="ACTIVE_LOCK"||s.originalEvent&&s.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({},eo,u)}onAdd(u){return this._map=u,this._container=oe.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return c._(this,arguments,void 0,function*(t=!1){if(Nr!==void 0&&!t)return Nr;if(window.navigator.permissions===void 0)return Nr=!!window.navigator.geolocation,Nr;try{Nr=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Nr=!!window.navigator.geolocation}return Nr})}().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(),oe.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,ks=0,Cs=!1}_isOutOfMapMaxBounds(u){const t=this._map.getMaxBounds(),s=u.coords;return t&&(s.longitude<t.getWest()||s.longitude>t.getEast()||s.latitude<t.getSouth()||s.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(),s=u.getNorthEast(),o=t.distanceTo(s),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":ks--,Cs=!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"),ks++,ks>1?(u={maximumAge:6e5,timeout:0},Cs=!0):(u=this.options.positionOptions,Cs=!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)}},T.Hash=ln,T.ImageSource=br,T.KeyboardHandler=ta,T.LngLatBounds=he,T.LogoControl=pr,T.Map=class extends sc{constructor(u){c.be.mark(c.bf.create);const t=Object.assign(Object.assign({},nc),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 No(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies),{bearingSnap:t.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Re,this._controls=[],this._mapId=c.a4(),this._contextLost=s=>{s.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new c.k("webglcontextlost",{originalEvent:s}))},this._contextRestored=s=>{this._setupPainter(),this.resize(),this._update(),this.fire(new c.k("webglcontextrestored",{originalEvent:s}))},this._onMapScroll=s=>{if(s.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({},Ce),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=Ze.addThrottleControl(()=>this.isMoving()),this._requestManager=new Ct(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 s=!1;const o=Wn(a=>{this._trackResize&&!this._removed&&this.resize(a)._update()},50);this._resizeObserver=new ResizeObserver(a=>{s?o(a):s=!0}),this._resizeObserver.observe(this._container)}this.handlers=new rc(this,t),this._hash=t.hash&&new ln(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 Ps(typeof t.attributionControl=="boolean"?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new pr,t.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",s=>{this._update(s.dataType==="style"),this.fire(new c.k(`${s.dataType}data`,s))}),this.on("dataloading",s=>{this.fire(new c.k(`${s.dataType}dataloading`,s))}),this.on("dataabort",s=>{this.fire(new c.k("sourcedataabort",s))})}_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 s=u.onAdd(this);this._controls.push(u);const o=this._controlPositions[t];return t.indexOf("bottom")!==-1?o.insertBefore(s,o.firstChild):o.appendChild(s),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,s,o){return o==null&&this.terrain&&(o=this.terrain.getElevationForLngLatZoom(s,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(u,t,s,o)}resize(u){var t;const s=this._containerDimensions(),o=s[0],a=s[1],h=this._getClampedPixelRatio(o,a);if(this._resizeCanvas(o,a,h),this.painter.resize(o,a,h),this.painter.overLimit()){const y=this.painter.context.gl;this._maxCanvasSize=[y.drawingBufferWidth,y.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 g=!this._moving;return g&&(this.stop(),this.fire(new c.k("movestart",u)).fire(new c.k("move",u))),this.fire(new c.k("resize",u)),g&&this.fire(new c.k("moveend",u)),this}_getClampedPixelRatio(u,t){const{0:s,1:o}=this._maxCanvasSize,a=this.getPixelRatio(),h=u*a,g=t*a;return Math.min(h>s?s/h:1,g>o?o/g: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(he.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,s){if(u==="mouseenter"||u==="mouseover"){let o=!1;return{layer:t,listener:s,delegates:{mousemove:h=>{const g=this.getLayer(t)?this.queryRenderedFeatures(h.point,{layers:[t]}):[];g.length?o||(o=!0,s.call(this,new vi(u,this,h.originalEvent,{features:g}))):o=!1},mouseout:()=>{o=!1}}}}if(u==="mouseleave"||u==="mouseout"){let o=!1;return{layer:t,listener:s,delegates:{mousemove:g=>{(this.getLayer(t)?this.queryRenderedFeatures(g.point,{layers:[t]}):[]).length?o=!0:o&&(o=!1,s.call(this,new vi(u,this,g.originalEvent)))},mouseout:g=>{o&&(o=!1,s.call(this,new vi(u,this,g.originalEvent)))}}}}{const o=a=>{const h=this.getLayer(t)?this.queryRenderedFeatures(a.point,{layers:[t]}):[];h.length&&(a.features=h,s.call(this,a),delete a.features)};return{layer:t,listener:s,delegates:{[u]:o}}}}on(u,t,s){if(s===void 0)return super.on(u,t);const o=this._createDelegatedListener(u,t,s);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,s){if(s===void 0)return super.once(u,t);const o=this._createDelegatedListener(u,t,s);for(const a in o.delegates)this.once(a,o.delegates[a]);return this}off(u,t,s){return s===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 g=a[h];if(g.layer===t&&g.listener===s){for(const y in g.delegates)this.off(y,g.delegates[y]);return a.splice(h,1),this}}})(),this)}queryRenderedFeatures(u,t){if(!this.style)return[];let s;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")s=[c.P.convert(a)];else{const h=c.P.convert(a[0]),g=c.P.convert(a[1]);s=[h,new c.P(g.x,h.y),g,new c.P(h.x,g.y),h]}return this.style.queryRenderedFeatures(s,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 s=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!u)),u?(this.style=new wo(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof u=="string"?this.style.loadURL(u,t,s):this.style.loadJSON(u,t,s),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new wo(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(u,t){if(typeof u=="string"){const s=this._requestManager.transformRequest(u,"Style");c.h(s,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(s){c.w(`Unable to perform style diff: ${s.message||s.error||s}. 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 s in this.style._layers){const o=this.style._layers[s];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 hl(this.painter,t,u),this.painter.renderToTexture=new ul(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=s=>{s.dataType==="style"?this.terrain.sourceCache.freeRtt():s.dataType==="source"&&s.tile&&(s.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(s.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 s=u[t]._tiles;for(const o in s){const a=s[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,s={}){const{pixelRatio:o=1,sdf:a=!1,stretchX:h,stretchY:g,content:y,textFitWidth:v,textFitHeight:w}=s;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:A,height:I,data:L}=t,F=t;return this.style.addImage(u,{data:new c.R({width:A,height:I},new Uint8Array(L)),pixelRatio:o,stretchX:h,stretchY:g,content:y,textFitWidth:v,textFitHeight:w,sdf:a,version:0,userImage:F}),F.onAdd&&F.onAdd(this,u),this}}{const{width:A,height:I,data:L}=ae.getImageData(t);this.style.addImage(u,{data:new c.R({width:A,height:I},L),pixelRatio:o,stretchX:h,stretchY:g,content:y,textFitWidth:v,textFitHeight:w,sdf:a,version:0})}}updateImage(u,t){const s=this.style.getImage(u);if(!s)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)?ae.getImageData(t):t,{width:a,height:h,data:g}=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!==s.data.width||h!==s.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 y=!(t instanceof HTMLImageElement||c.b(t));return s.data.replace(g,y),this.style.updateImage(u,s),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 Ze.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,s){return this.style.setLayerZoomRange(u,t,s),this._update(!0)}setFilter(u,t,s={}){return this.style.setFilter(u,t,s),this._update(!0)}getFilter(u){return this.style.getFilter(u)}setPaintProperty(u,t,s,o={}){return this.style.setPaintProperty(u,t,s,o),this._update(!0)}getPaintProperty(u,t){return this.style.getPaintProperty(u,t)}setLayoutProperty(u,t,s,o={}){return this.style.setLayoutProperty(u,t,s,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,s={}){return this._lazyInitEmptyStyle(),this.style.addSprite(u,t,s,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,s=>{s||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=oe.create("div","maplibregl-canvas-container",u);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=oe.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 s=this._containerDimensions(),o=this._getClampedPixelRatio(s[0],s[1]);this._resizeCanvas(s[0],s[1],o);const a=this._controlContainer=oe.create("div","maplibregl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(g=>{h[g]=oe.create("div",`maplibregl-ctrl-${g} `,a)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(u,t,s){this._canvas.width=Math.floor(s*u),this._canvas.height=Math.floor(s*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 s=this._canvas.getContext("webgl2",u)||this._canvas.getContext("webgl",u);if(!s){const o="Failed to initialize WebGL";throw t?(t.message=o,new Error(JSON.stringify(t))):new Error(o)}this.painter=new rl(s,this.transform),at.testSupport(s)}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 s=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const a=this.transform.zoom,h=ae.now();this.style.zoomHistory.update(a,h);const g=new c.a9(a,{now:h,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),y=g.crossFadingFactor();y===1&&y===this._crossFadingFactor||(s=!0,this._crossFadingFactor=y),this.style.update(g)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.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()||s)&&(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 s of this._controls)s.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),Ze.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),oe.remove(this._canvasContainer),oe.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,ae.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 ca}getCameraTargetElevation(){return this.transform.elevation}},T.MapMouseEvent=vi,T.MapTouchEvent=cn,T.MapWheelEvent=qo,T.Marker=It,T.NavigationControl=class{constructor(u){this._updateZoomButtons=()=>{const t=this._map.getZoom(),s=t===this._map.getMaxZoom(),o=t===this._map.getMinZoom();this._zoomInButton.disabled=s,this._zoomOutButton.disabled=o,this._zoomInButton.setAttribute("aria-disabled",s.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,s)=>{const o=this._map._getUIString(`NavigationControl.${s}`);t.title=o,t.setAttribute("aria-label",o)},this.options=c.e({},ha,u),this._container=oe.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})),oe.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})),oe.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=oe.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 pl(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){oe.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 s=oe.create("button",u,this._container);return s.type="button",s.addEventListener("click",t),s}},T.Popup=class extends c.E{constructor(u){super(),this.remove=()=>(this._content&&oe.remove(this._content),this._container&&(oe.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 s;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=oe.create("div","maplibregl-popup",this._map.getContainer()),this._tip=oe.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const y of this.options.className.split(" "))this._container.classList.add(y);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?fl(this._lngLat,this._flatPos,this._map.transform):(s=this._lngLat)===null||s===void 0?void 0:s.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=je(this.options.offset);if(!a){const y=this._container.offsetWidth,v=this._container.offsetHeight;let w;w=o.y+h.bottom.y<v?["top"]:o.y>this._map.transform.height-v?["bottom"]:[],o.x<y/2?w.push("left"):o.x>this._map.transform.width-y/2&&w.push("right"),a=w.length===0?"bottom":w.join("-")}let g=o.add(h[a]);this.options.subpixelPositioning||(g=g.round()),oe.setTransform(this._container,`${ua[a]} translate(${g.x}px,${g.y}px)`),jr(this._container,a,"popup")},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(mr),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(),s=document.createElement("body");let o;for(s.innerHTML=u;o=s.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=oe.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=oe.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(to);u&&u.focus()}},T.RasterDEMTileSource=$t,T.RasterTileSource=mt,T.ScaleControl=class{constructor(u){this._onMove=()=>{da(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,da(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},ml),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=oe.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){oe.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},T.ScrollZoomHandler=ra,T.Style=wo,T.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=oe.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=oe.create("button","maplibregl-ctrl-terrain",this._container),oe.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(){oe.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},T.TwoFingersTouchPitchHandler=ea,T.TwoFingersTouchRotateHandler=Qo,T.TwoFingersTouchZoomHandler=Ko,T.TwoFingersTouchZoomRotateHandler=na,T.VectorTileSource=Us,T.VideoSource=xs,T.addSourceType=(u,t)=>c._(void 0,void 0,void 0,function*(){if(Gs(u))throw new Error(`A source type called "${u}" already exists.`);((s,o)=>{Zs[s]=o})(u,t)}),T.clearPrewarmedResources=function(){const u=Di;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(Mr),Di=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()"))},T.getMaxParallelImageRequests=function(){return c.a.MAX_PARALLEL_IMAGE_REQUESTS},T.getRTLTextPluginStatus=function(){return cr().getRTLTextPluginStatus()},T.getVersion=function(){return We},T.getWorkerCount=function(){return ar.workerCount},T.getWorkerUrl=function(){return c.a.WORKER_URL},T.importScriptInWorkers=function(u){return js().broadcast("IS",u)},T.prewarm=function(){Jr().acquire(Mr)},T.setMaxParallelImageRequests=function(u){c.a.MAX_PARALLEL_IMAGE_REQUESTS=u},T.setRTLTextPlugin=function(u,t){return cr().setRTLTextPlugin(u,t)},T.setWorkerCount=function(u){ar.workerCount=u},T.setWorkerUrl=function(u){c.a.WORKER_URL=u}});var X=P;return X})})(maplibreGl);var maplibreGlExports=maplibreGl.exports;const maplibregl=getDefaultExportFromCjs(maplibreGlExports);function polygon$1(m){const b=[{type:"fill",minzoom:m.pointZoom||0,paint:{"fill-color":m.color||"#ccc","fill-outline-color":m.stroke||"#blue","fill-opacity":m.opacity||1}}];return m.pointZoom&&b.push({type:"circle",maxzoom:m.pointZoom,paint:{"circle-color":m.color||"#ccc","circle-stroke-color":m.stroke||"#ccc","circle-stroke-width":m.width||1,"circle-opacity":m.opacity||1}}),m.label&&b.push({type:"symbol",layout:{"text-field":["get",m.label],"text-font":["Open Sans Regular"],"text-size":12,"text-anchor":"center"},paint:{"text-color":"#000","text-halo-color":"#fff","text-halo-width":1.5}}),b}function line(m){const b=[{type:"line",paint:{"line-color":m.color||"#ccc","line-opacity":m.opacity||1}}];return m.label&&b.push({type:"symbol",layout:{"text-field":["get",m.label],"text-font":["Open Sans Regular"],"text-size":12,"symbol-placement":"line-center"},paint:{"text-color":"#000","text-halo-color":"#fff","text-halo-width":1.5}}),b}function point$1(m){const b=[{type:"circle",maxzoom:m.icon&&+m.iconZoom||22,paint:{"circle-radius":m.radius||6,"circle-stroke-color":m.stroke||"#ccc","circle-stroke-width":m.width||1,"circle-color":m.color||"blue","circle-opacity":m.opacity||1}}];return m!=null&&m.clusterZoom&&(b.push({type:"circle",filter:["has","point_count"],paint:{"circle-color":["step",["get","point_count"],"#51bbd6",100,"#f1f075",750,"#f28cb1"],"circle-radius":["step",["get","point_count"],20,100,30,750,40]}}),b.push({type:"symbol",filter:["has","point_count"],layout:{"text-field":["get","point_count"],"text-font":["Open Sans Regular"],"text-size":12}})),m.icon&&b.push({type:"symbol",minzoom:+m.iconZoom||16,layout:{"icon-image":m.icon,"icon-allow-overlap":!0}}),m.label&&b.push({type:"symbol",layout:{"text-field":["get",m.label],"text-font":["Open Sans Regular"],"text-size":12,"text-anchor":"top"},paint:{"text-color":"#000","text-halo-color":"#fff","text-halo-width":1.5}}),b}function style2layers(m){if(!m)return null;const b=m.type||"point";return b==="polygon"?polygon$1(m):b==="line"?line(m):point$1(m)}const colorPalette=["#69D2E7","yellow","#FE4365","#125B9A","#41B3A2","#D7C3F1","#F1D3CE"],iconPalette=["ma-star","ma-water","ma-swimming","fa-home","fa-search","fa-trash","fa-check"],loadedImages={};async function getAttrs(m,b,P="api"){const C=await fetch(`${P}/gis-layer/${m}/${b}`),{rows:B}=await C.json();return B}async function style2layersExtend(m,b,P,C){if(!m)return null;const B=JSON.parse(JSON.stringify(m)),X=B.colorAttr?await getAttrs(b,B.colorAttr,C):null;X==null||X.forEach((c,fe)=>{var _e,ye;c.color=c.color||((_e=B.colorSet)==null?void 0:_e[c.id])||((ye=B.colorSet)==null?void 0:ye[fe])||colorPalette[fe%colorPalette.length],c.icon=B.icon?B.icon.split("+")[0]+"+"+c.color.replace("#","")+".png":null});const T=B.iconAttr?await getAttrs(b,B.iconAttr,C):null;if(T==null||T.forEach((c,fe)=>{var at,Ve,Xe,Fe;const _e=c.icon||((at=B.iconSet)==null?void 0:at[c.id])||((Ve=B.iconPattern)==null?void 0:Ve.replace("{id}",c.id))||((Xe=B.iconSet)==null?void 0:Xe[fe])||(B.iconPrefix?null:iconPalette[fe]);if(!_e)return;const ye=c.color||((Fe=B.color)==null?void 0:Fe.replace("#",""))||"red",[ae="pin6",oe="m"]=B.icon?B.icon.split("-"):[];c.icon=B.iconPrefix||_e!=null&&_e.includes("/")?(B.iconPrefix||"")+_e:`${ae}-${oe}-${_e}+${ye}.png`}),B.colorAttr&&X){const c=["match",["get",B.colorAttr]];X.filter(fe=>fe.id).forEach(fe=>{c.push(fe.id),c.push(fe.color)}),c.push(B.color||"gray"),B.color=c}if(B.icon&&B.iconAttr&&T){const c=["match",["get",B.iconAttr]];T.filter(fe=>fe.icon).forEach(({id:fe,icon:_e})=>{if(B.colorAttr&&X){c.push(fe);const ye=["match",["get",B.colorAttr]];X.forEach(ae=>{ye.push(ae.id);const oe=_e.split("+")[0]+"+"+ae.color.replace("#","")+".png";ye.push(oe),loadImage(oe,P,C)}),ye.push(B.icon),c.push(ye)}else c.push(fe),c.push(_e),loadImage(_e,P,C)}),c.push((B.iconPrefix||"")+B.icon),loadImage((B.iconPrefix||"")+B.icon,P,C),B.icon=c}else if(B.icon&&B.colorAttr&&X){const c=["match",["get",B.colorAttr]];X.forEach(fe=>{c.push(fe.id),c.push(fe.icon),loadImage(fe.icon,P,C)}),c.push(B.icon),loadImage(B.icon,P,C),B.icon=c}else B.icon&&await loadImage(B.icon,P,C);return legend({style:m,colors:X,icons:T,map:P,id:b}),style2layers(B)}async function loadImage(m="pin4-sm-mi-plumber+f45942.png",b=null,P){if(loadedImages[m])return null;loadedImages[m]=!0;const C=await(b==null?void 0:b.loadImage(m!=null&&m.startsWith("/")||m!=null&&m.includes("//")?m:`${P}/marker_icon/${m.replace(".png","")}.png`));b==null||b.addImage(m,C.data)}function legend({style:m,colors:b,icons:P,map:C,id:B}){C.legend||Object.assign(C,{legend:{}}),window.map||(window.map=C),Object.assign(C.legend,{[B]:{icon:m.icon,colors:b,icons:P,color:m.color||"blue",type:m.type||"point"}})}const layerMixin={data(){return{layerList:[],activeLayer:""}},computed:{interactiveSources(){return this.layerList.filter(m=>m==null?void 0:m.interactive).map(m=>m.id)}},methods:{moveLayer(m,b=this.map){b.getStyle().layers.forEach(P=>{P.id.match(m)&&b.moveLayer(P.id)})},async setVisible(m,b=!0,P=this.map){if(!m)return;const C=(m==null?void 0:m.id)||m,B=this.layerList.find(T=>T.id===m)||m;if(!(B!=null&&B.id))throw new Error("MixinError: Layer has no id");P.getStyle().layers.filter(T=>T.id.match(C)).forEach(T=>{P.setLayoutProperty(T.id,"visibility",b?"visible":"none")}),b&&await this.addLayer(B)},async addLayer(m,b=this==null?void 0:this.map){var B,X;const P=this.layerList.find(T=>T.id===m)||m;!this.map.getStyle()||this.map.getStyle().layers.find(T=>T.id===P.id)||(this.layerList.find(T=>T.id===P.id)||this.layerList.push(P),(P.service==="vtile"||P.service==="vector"||(B=P.url)!=null&&B.includes(".vmt"))&&this.addVtileLayer(P,b),P.service==="geojson"&&this.addGeoJsonLayer(P,b),((X=P.url)!=null&&X.includes(".png")||["tms","raster"].includes(P.service))&&await this.addRasterLayer(P,b))},async addRasterLayer(m,b=this==null?void 0:this.map){var P;b.getSource(m.id)||(typeof m.bounds=="string"&&Object.assign(m,{bounds:m.bounds.split(",")}),await b.addSource(m.id,{type:"raster",tiles:[(P=m==null?void 0:m.url)!=null&&P.startsWith("http")?m==null?void 0:m.url:`${this.prefix?m==null?void 0:m.url.replace(/(\/api[^\/]*)/,this.prefix):m==null?void 0:m.url}${m!=null&&m.url.includes("?")?"&":"?"}dt=${new Date().toISOString().split("T")[0]}`],tileSize:256,...Array.isArray(m.bounds)&&m.bounds.length===4?{bounds:m.bounds}:{},...m!=null&&m.scheme?{scheme:m==null?void 0:m.scheme}:{}}),await b.addLayer({id:m.id,type:"raster",source:m.id,minzoom:0,maxzoom:(m==null?void 0:m.maxzoom)||22}))},async updateStyle(m,b=this==null?void 0:this.map){const P=m.id;b.getStyle().layers.forEach(async B=>{B.source===P&&b.getLayer(B.id)&&await b.removeLayer(B.id)}),(await style2layersExtend(m.style,m.source||m.id,b,this.prefix)||m.layers||[]).forEach((B,X)=>{const T={...B,id:`${m.id}-${X}`,source:m.id,"source-layer":B["source-layer"]||m.source||m.id,maxzoom:+B.maxzoom||24,minzoom:+B.minzoom||0};b.addLayer(T)})},async addVtileLayer(m,b=this==null?void 0:this.map){var X;const P=["props","pointZoom","clusterZoom"].filter(T=>m[T]).map(T=>`&${T}=${m[T]}`),C={type:"vector",tiles:[`${(X=m==null?void 0:m.url)!=null&&X.startsWith("http")?"":window.location.origin}${m==null?void 0:m.url}${P}`],minzoom:m.minzoom||5,maxzoom:m.maxzoom||24};b.addSource(m.id,C),(m.layers||await style2layersExtend(m.style,m.source||m.id,b,this.prefix)||[]).forEach((T,c)=>{const fe={...T,id:`${m.id}-${c}`,source:m.id,"source-layer":T["source-layer"]||m.source||m.id,maxzoom:+T.maxzoom||24,minzoom:+T.minzoom||0};b.addLayer(fe)})},async addGeoJsonLayer(m,b=this.map){var B;const P=m.data||((B=m==null?void 0:m.url)!=null&&B.startsWith("http")?"":window.location.origin)+m.url;b.addSource(m.id,{type:"geojson",data:P}),(await style2layersExtend(m.style,P.source||P.id,b,this.prefix)||m.layers||[]).forEach(X=>{const T={...X,source:m.id,id:X.id||m.id,maxzoom:+X.maxzoom||24,minzoom:+X.minzoom||0,type:X.type||"circle"};b.addLayer(T)})},setLayerData(m,b){this.layerList=this.layerList.map(P=>P.id===m?{...P,...b}:P)},async removeLayer(m,b=this.map){b.getSource(m)&&(await b.getStyle().layers.forEach(async P=>{P.source===m&&await b.removeLayer(P.id)}),b.getSource(m)&&await b.removeSource(m))},async setFilter(m,b){const P=this.layerList.find(B=>B.id===m);await(await this.map.getSource(m)).setTiles([`${window.location.origin}${P.url}${P.url.includes("?")?"&":"?"}filter=${b}${P.props?`&props=${P.props}`:""}`])},async changeBaseLayer(m){m!==this.activeLayer&&(this.activeLayer&&this.map.setLayoutProperty(this.activeLayer,"visibility","none"),await this.setVisible(this.activeLayer,!1),await this.setVisible(m,!0),this.map.getStyle().layers.forEach(b=>{b.source!==m&&b.type!=="background"&&this.map.moveLayer(b.id)}),this.activeLayer=m)},async refreshLayer(m,b=this.map){await b.getStyle().layers.forEach(P=>{P.source===m&&b.removeLayer(P.id)}),b.getSource(m)&&await b.removeSource(m),this.setVisible(m)}}},_export_sfc=(m,b)=>{const P=m.__vccOpts||m;for(const[C,B]of b)P[C]=B;return P},_sfc_main$b={},_hoisted_1$a={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"},_hoisted_2$a=vue.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),_hoisted_14$1=[_hoisted_2$a];function _sfc_render$a(m,b){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$a,_hoisted_14$1)}const NoData=_export_sfc(_sfc_main$b,[["render",_sfc_render$a]]);function bind(m,b){return function(){return m.apply(b,arguments)}}const{toString}=Object.prototype,{getPrototypeOf}=Object,kindOf=(m=>b=>{const P=toString.call(b);return m[P]||(m[P]=P.slice(8,-1).toLowerCase())})(Object.create(null)),kindOfTest=m=>(m=m.toLowerCase(),b=>kindOf(b)===m),typeOfTest=m=>b=>typeof b===m,{isArray}=Array,isUndefined=typeOfTest("undefined");function isBuffer(m){return m!==null&&!isUndefined(m)&&m.constructor!==null&&!isUndefined(m.constructor)&&isFunction(m.constructor.isBuffer)&&m.constructor.isBuffer(m)}const isArrayBuffer=kindOfTest("ArrayBuffer");function isArrayBufferView(m){let b;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?b=ArrayBuffer.isView(m):b=m&&m.buffer&&isArrayBuffer(m.buffer),b}const isString=typeOfTest("string"),isFunction=typeOfTest("function"),isNumber$1=typeOfTest("number"),isObject=m=>m!==null&&typeof m=="object",isBoolean=m=>m===!0||m===!1,isPlainObject=m=>{if(kindOf(m)!=="object")return!1;const b=getPrototypeOf(m);return(b===null||b===Object.prototype||Object.getPrototypeOf(b)===null)&&!(Symbol.toStringTag in m)&&!(Symbol.iterator in m)},isDate=kindOfTest("Date"),isFile=kindOfTest("File"),isBlob=kindOfTest("Blob"),isFileList=kindOfTest("FileList"),isStream=m=>isObject(m)&&isFunction(m.pipe),isFormData=m=>{let b;return m&&(typeof FormData=="function"&&m instanceof FormData||isFunction(m.append)&&((b=kindOf(m))==="formdata"||b==="object"&&isFunction(m.toString)&&m.toString()==="[object FormData]"))},isURLSearchParams=kindOfTest("URLSearchParams"),[isReadableStream,isRequest,isResponse,isHeaders]=["ReadableStream","Request","Response","Headers"].map(kindOfTest),trim=m=>m.trim?m.trim():m.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function forEach(m,b,{allOwnKeys:P=!1}={}){if(m===null||typeof m>"u")return;let C,B;if(typeof m!="object"&&(m=[m]),isArray(m))for(C=0,B=m.length;C<B;C++)b.call(null,m[C],C,m);else{const X=P?Object.getOwnPropertyNames(m):Object.keys(m),T=X.length;let c;for(C=0;C<T;C++)c=X[C],b.call(null,m[c],c,m)}}function findKey(m,b){b=b.toLowerCase();const P=Object.keys(m);let C=P.length,B;for(;C-- >0;)if(B=P[C],b===B.toLowerCase())return B;return null}const _global=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,isContextDefined=m=>!isUndefined(m)&&m!==_global;function merge(){const{caseless:m}=isContextDefined(this)&&this||{},b={},P=(C,B)=>{const X=m&&findKey(b,B)||B;isPlainObject(b[X])&&isPlainObject(C)?b[X]=merge(b[X],C):isPlainObject(C)?b[X]=merge({},C):isArray(C)?b[X]=C.slice():b[X]=C};for(let C=0,B=arguments.length;C<B;C++)arguments[C]&&forEach(arguments[C],P);return b}const extend=(m,b,P,{allOwnKeys:C}={})=>(forEach(b,(B,X)=>{P&&isFunction(B)?m[X]=bind(B,P):m[X]=B},{allOwnKeys:C}),m),stripBOM=m=>(m.charCodeAt(0)===65279&&(m=m.slice(1)),m),inherits=(m,b,P,C)=>{m.prototype=Object.create(b.prototype,C),m.prototype.constructor=m,Object.defineProperty(m,"super",{value:b.prototype}),P&&Object.assign(m.prototype,P)},toFlatObject=(m,b,P,C)=>{let B,X,T;const c={};if(b=b||{},m==null)return b;do{for(B=Object.getOwnPropertyNames(m),X=B.length;X-- >0;)T=B[X],(!C||C(T,m,b))&&!c[T]&&(b[T]=m[T],c[T]=!0);m=P!==!1&&getPrototypeOf(m)}while(m&&(!P||P(m,b))&&m!==Object.prototype);return b},endsWith=(m,b,P)=>{m=String(m),(P===void 0||P>m.length)&&(P=m.length),P-=b.length;const C=m.indexOf(b,P);return C!==-1&&C===P},toArray=m=>{if(!m)return null;if(isArray(m))return m;let b=m.length;if(!isNumber$1(b))return null;const P=new Array(b);for(;b-- >0;)P[b]=m[b];return P},isTypedArray=(m=>b=>m&&b instanceof m)(typeof Uint8Array<"u"&&getPrototypeOf(Uint8Array)),forEachEntry=(m,b)=>{const C=(m&&m[Symbol.iterator]).call(m);let B;for(;(B=C.next())&&!B.done;){const X=B.value;b.call(m,X[0],X[1])}},matchAll=(m,b)=>{let P;const C=[];for(;(P=m.exec(b))!==null;)C.push(P);return C},isHTMLForm=kindOfTest("HTMLFormElement"),toCamelCase=m=>m.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(P,C,B){return C.toUpperCase()+B}),hasOwnProperty=(({hasOwnProperty:m})=>(b,P)=>m.call(b,P))(Object.prototype),isRegExp=kindOfTest("RegExp"),reduceDescriptors=(m,b)=>{const P=Object.getOwnPropertyDescriptors(m),C={};forEach(P,(B,X)=>{let T;(T=b(B,X,m))!==!1&&(C[X]=T||B)}),Object.defineProperties(m,C)},freezeMethods=m=>{reduceDescriptors(m,(b,P)=>{if(isFunction(m)&&["arguments","caller","callee"].indexOf(P)!==-1)return!1;const C=m[P];if(isFunction(C)){if(b.enumerable=!1,"writable"in b){b.writable=!1;return}b.set||(b.set=()=>{throw Error("Can not rewrite read-only method '"+P+"'")})}})},toObjectSet=(m,b)=>{const P={},C=B=>{B.forEach(X=>{P[X]=!0})};return isArray(m)?C(m):C(String(m).split(b)),P},noop=()=>{},toFiniteNumber=(m,b)=>m!=null&&Number.isFinite(m=+m)?m:b,ALPHA="abcdefghijklmnopqrstuvwxyz",DIGIT="0123456789",ALPHABET={DIGIT,ALPHA,ALPHA_DIGIT:ALPHA+ALPHA.toUpperCase()+DIGIT},generateString=(m=16,b=ALPHABET.ALPHA_DIGIT)=>{let P="";const{length:C}=b;for(;m--;)P+=b[Math.random()*C|0];return P};function isSpecCompliantForm(m){return!!(m&&isFunction(m.append)&&m[Symbol.toStringTag]==="FormData"&&m[Symbol.iterator])}const toJSONObject=m=>{const b=new Array(10),P=(C,B)=>{if(isObject(C)){if(b.indexOf(C)>=0)return;if(!("toJSON"in C)){b[B]=C;const X=isArray(C)?[]:{};return forEach(C,(T,c)=>{const fe=P(T,B+1);!isUndefined(fe)&&(X[c]=fe)}),b[B]=void 0,X}}return C};return P(m,0)},isAsyncFn=kindOfTest("AsyncFunction"),isThenable=m=>m&&(isObject(m)||isFunction(m))&&isFunction(m.then)&&isFunction(m.catch),_setImmediate=((m,b)=>m?setImmediate:b?((P,C)=>(_global.addEventListener("message",({source:B,data:X})=>{B===_global&&X===P&&C.length&&C.shift()()},!1),B=>{C.push(B),_global.postMessage(P,"*")}))(`axios@${Math.random()}`,[]):P=>setTimeout(P))(typeof setImmediate=="function",isFunction(_global.postMessage)),asap=typeof queueMicrotask<"u"?queueMicrotask.bind(_global):typeof process<"u"&&process.nextTick||_setImmediate,utils$1={isArray,isArrayBuffer,isBuffer,isFormData,isArrayBufferView,isString,isNumber:isNumber$1,isBoolean,isObject,isPlainObject,isReadableStream,isRequest,isResponse,isHeaders,isUndefined,isDate,isFile,isBlob,isRegExp,isFunction,isStream,isURLSearchParams,isTypedArray,isFileList,forEach,merge,extend,trim,stripBOM,inherits,toFlatObject,kindOf,kindOfTest,endsWith,toArray,forEachEntry,matchAll,isHTMLForm,hasOwnProperty,hasOwnProp:hasOwnProperty,reduceDescriptors,freezeMethods,toObjectSet,toCamelCase,noop,toFiniteNumber,findKey,global:_global,isContextDefined,ALPHABET,generateString,isSpecCompliantForm,toJSONObject,isAsyncFn,isThenable,setImmediate:_setImmediate,asap};function AxiosError(m,b,P,C,B){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=m,this.name="AxiosError",b&&(this.code=b),P&&(this.config=P),C&&(this.request=C),B&&(this.response=B)}utils$1.inherits(AxiosError,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:utils$1.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const prototype$1=AxiosError.prototype,descriptors={};["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(m=>{descriptors[m]={value:m}}),Object.defineProperties(AxiosError,descriptors),Object.defineProperty(prototype$1,"isAxiosError",{value:!0}),AxiosError.from=(m,b,P,C,B,X)=>{const T=Object.create(prototype$1);return utils$1.toFlatObject(m,T,function(fe){return fe!==Error.prototype},c=>c!=="isAxiosError"),AxiosError.call(T,m.message,b,P,C,B),T.cause=m,T.name=m.name,X&&Object.assign(T,X),T};const httpAdapter=null;function isVisitable(m){return utils$1.isPlainObject(m)||utils$1.isArray(m)}function removeBrackets(m){return utils$1.endsWith(m,"[]")?m.slice(0,-2):m}function renderKey(m,b,P){return m?m.concat(b).map(function(B,X){return B=removeBrackets(B),!P&&X?"["+B+"]":B}).join(P?".":""):b}function isFlatArray(m){return utils$1.isArray(m)&&!m.some(isVisitable)}const predicates=utils$1.toFlatObject(utils$1,{},null,function(b){return/^is[A-Z]/.test(b)});function toFormData(m,b,P){if(!utils$1.isObject(m))throw new TypeError("target must be an object");b=b||new FormData,P=utils$1.toFlatObject(P,{metaTokens:!0,dots:!1,indexes:!1},!1,function(Xe,Fe){return!utils$1.isUndefined(Fe[Xe])});const C=P.metaTokens,B=P.visitor||ye,X=P.dots,T=P.indexes,fe=(P.Blob||typeof Blob<"u"&&Blob)&&utils$1.isSpecCompliantForm(b);if(!utils$1.isFunction(B))throw new TypeError("visitor must be a function");function _e(Ve){if(Ve===null)return"";if(utils$1.isDate(Ve))return Ve.toISOString();if(!fe&&utils$1.isBlob(Ve))throw new AxiosError("Blob is not supported. Use a Buffer instead.");return utils$1.isArrayBuffer(Ve)||utils$1.isTypedArray(Ve)?fe&&typeof Blob=="function"?new Blob([Ve]):Buffer.from(Ve):Ve}function ye(Ve,Xe,Fe){let ut=Ve;if(Ve&&!Fe&&typeof Ve=="object"){if(utils$1.endsWith(Xe,"{}"))Xe=C?Xe:Xe.slice(0,-2),Ve=JSON.stringify(Ve);else if(utils$1.isArray(Ve)&&isFlatArray(Ve)||(utils$1.isFileList(Ve)||utils$1.endsWith(Xe,"[]"))&&(ut=utils$1.toArray(Ve)))return Xe=removeBrackets(Xe),ut.forEach(function(Ze,Ct){!(utils$1.isUndefined(Ze)||Ze===null)&&b.append(T===!0?renderKey([Xe],Ct,X):T===null?Xe:Xe+"[]",_e(Ze))}),!1}return isVisitable(Ve)?!0:(b.append(renderKey(Fe,Xe,X),_e(Ve)),!1)}const ae=[],oe=Object.assign(predicates,{defaultVisitor:ye,convertValue:_e,isVisitable});function at(Ve,Xe){if(!utils$1.isUndefined(Ve)){if(ae.indexOf(Ve)!==-1)throw Error("Circular reference detected in "+Xe.join("."));ae.push(Ve),utils$1.forEach(Ve,function(ut,kt){(!(utils$1.isUndefined(ut)||ut===null)&&B.call(b,ut,utils$1.isString(kt)?kt.trim():kt,Xe,oe))===!0&&at(ut,Xe?Xe.concat(kt):[kt])}),ae.pop()}}if(!utils$1.isObject(m))throw new TypeError("data must be an object");return at(m),b}function encode$1(m){const b={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(m).replace(/[!'()~]|%20|%00/g,function(C){return b[C]})}function AxiosURLSearchParams(m,b){this._pairs=[],m&&toFormData(m,this,b)}const prototype=AxiosURLSearchParams.prototype;prototype.append=function(b,P){this._pairs.push([b,P])},prototype.toString=function(b){const P=b?function(C){return b.call(this,C,encode$1)}:encode$1;return this._pairs.map(function(B){return P(B[0])+"="+P(B[1])},"").join("&")};function encode(m){return encodeURIComponent(m).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function buildURL(m,b,P){if(!b)return m;const C=P&&P.encode||encode,B=P&&P.serialize;let X;if(B?X=B(b,P):X=utils$1.isURLSearchParams(b)?b.toString():new AxiosURLSearchParams(b,P).toString(C),X){const T=m.indexOf("#");T!==-1&&(m=m.slice(0,T)),m+=(m.indexOf("?")===-1?"?":"&")+X}return m}class InterceptorManager{constructor(){this.handlers=[]}use(b,P,C){return this.handlers.push({fulfilled:b,rejected:P,synchronous:C?C.synchronous:!1,runWhen:C?C.runWhen:null}),this.handlers.length-1}eject(b){this.handlers[b]&&(this.handlers[b]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(b){utils$1.forEach(this.handlers,function(C){C!==null&&b(C)})}}const transitionalDefaults={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},URLSearchParams$1=typeof URLSearchParams<"u"?URLSearchParams:AxiosURLSearchParams,FormData$1=typeof FormData<"u"?FormData:null,Blob$1=typeof Blob<"u"?Blob:null,platform$1={isBrowser:!0,classes:{URLSearchParams:URLSearchParams$1,FormData:FormData$1,Blob:Blob$1},protocols:["http","https","file","blob","url","data"]},hasBrowserEnv=typeof window<"u"&&typeof document<"u",hasStandardBrowserEnv=(m=>hasBrowserEnv&&["ReactNative","NativeScript","NS"].indexOf(m)<0)(typeof navigator<"u"&&navigator.product),hasStandardBrowserWebWorkerEnv=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",origin=hasBrowserEnv&&window.location.href||"http://localhost",utils=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv,hasStandardBrowserEnv,hasStandardBrowserWebWorkerEnv,origin},Symbol.toStringTag,{value:"Module"})),platform={...utils,...platform$1};function toURLEncodedForm(m,b){return toFormData(m,new platform.classes.URLSearchParams,Object.assign({visitor:function(P,C,B,X){return platform.isNode&&utils$1.isBuffer(P)?(this.append(C,P.toString("base64")),!1):X.defaultVisitor.apply(this,arguments)}},b))}function parsePropPath(m){return utils$1.matchAll(/\w+|\[(\w*)]/g,m).map(b=>b[0]==="[]"?"":b[1]||b[0])}function arrayToObject(m){const b={},P=Object.keys(m);let C;const B=P.length;let X;for(C=0;C<B;C++)X=P[C],b[X]=m[X];return b}function formDataToJSON(m){function b(P,C,B,X){let T=P[X++];if(T==="__proto__")return!0;const c=Number.isFinite(+T),fe=X>=P.length;return T=!T&&utils$1.isArray(B)?B.length:T,fe?(utils$1.hasOwnProp(B,T)?B[T]=[B[T],C]:B[T]=C,!c):((!B[T]||!utils$1.isObject(B[T]))&&(B[T]=[]),b(P,C,B[T],X)&&utils$1.isArray(B[T])&&(B[T]=arrayToObject(B[T])),!c)}if(utils$1.isFormData(m)&&utils$1.isFunction(m.entries)){const P={};return utils$1.forEachEntry(m,(C,B)=>{b(parsePropPath(C),B,P,0)}),P}return null}function stringifySafely(m,b,P){if(utils$1.isString(m))try{return(b||JSON.parse)(m),utils$1.trim(m)}catch(C){if(C.name!=="SyntaxError")throw C}return(P||JSON.stringify)(m)}const defaults={transitional:transitionalDefaults,adapter:["xhr","http","fetch"],transformRequest:[function(b,P){const C=P.getContentType()||"",B=C.indexOf("application/json")>-1,X=utils$1.isObject(b);if(X&&utils$1.isHTMLForm(b)&&(b=new FormData(b)),utils$1.isFormData(b))return B?JSON.stringify(formDataToJSON(b)):b;if(utils$1.isArrayBuffer(b)||utils$1.isBuffer(b)||utils$1.isStream(b)||utils$1.isFile(b)||utils$1.isBlob(b)||utils$1.isReadableStream(b))return b;if(utils$1.isArrayBufferView(b))return b.buffer;if(utils$1.isURLSearchParams(b))return P.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),b.toString();let c;if(X){if(C.indexOf("application/x-www-form-urlencoded")>-1)return toURLEncodedForm(b,this.formSerializer).toString();if((c=utils$1.isFileList(b))||C.indexOf("multipart/form-data")>-1){const fe=this.env&&this.env.FormData;return toFormData(c?{"files[]":b}:b,fe&&new fe,this.formSerializer)}}return X||B?(P.setContentType("application/json",!1),stringifySafely(b)):b}],transformResponse:[function(b){const P=this.transitional||defaults.transitional,C=P&&P.forcedJSONParsing,B=this.responseType==="json";if(utils$1.isResponse(b)||utils$1.isReadableStream(b))return b;if(b&&utils$1.isString(b)&&(C&&!this.responseType||B)){const T=!(P&&P.silentJSONParsing)&&B;try{return JSON.parse(b)}catch(c){if(T)throw c.name==="SyntaxError"?AxiosError.from(c,AxiosError.ERR_BAD_RESPONSE,this,null,this.response):c}}return b}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:platform.classes.FormData,Blob:platform.classes.Blob},validateStatus:function(b){return b>=200&&b<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};utils$1.forEach(["delete","get","head","post","put","patch"],m=>{defaults.headers[m]={}});const ignoreDuplicateOf=utils$1.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"]),parseHeaders=m=>{const b={};let P,C,B;return m&&m.split(`
|
581
|
+
`).forEach(function(T){B=T.indexOf(":"),P=T.substring(0,B).trim().toLowerCase(),C=T.substring(B+1).trim(),!(!P||b[P]&&ignoreDuplicateOf[P])&&(P==="set-cookie"?b[P]?b[P].push(C):b[P]=[C]:b[P]=b[P]?b[P]+", "+C:C)}),b},$internals=Symbol("internals");function normalizeHeader(m){return m&&String(m).trim().toLowerCase()}function normalizeValue(m){return m===!1||m==null?m:utils$1.isArray(m)?m.map(normalizeValue):String(m)}function parseTokens(m){const b=Object.create(null),P=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let C;for(;C=P.exec(m);)b[C[1]]=C[2];return b}const isValidHeaderName=m=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(m.trim());function matchHeaderValue(m,b,P,C,B){if(utils$1.isFunction(C))return C.call(this,b,P);if(B&&(b=P),!!utils$1.isString(b)){if(utils$1.isString(C))return b.indexOf(C)!==-1;if(utils$1.isRegExp(C))return C.test(b)}}function formatHeader(m){return m.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(b,P,C)=>P.toUpperCase()+C)}function buildAccessors(m,b){const P=utils$1.toCamelCase(" "+b);["get","set","has"].forEach(C=>{Object.defineProperty(m,C+P,{value:function(B,X,T){return this[C].call(this,b,B,X,T)},configurable:!0})})}class AxiosHeaders{constructor(b){b&&this.set(b)}set(b,P,C){const B=this;function X(c,fe,_e){const ye=normalizeHeader(fe);if(!ye)throw new Error("header name must be a non-empty string");const ae=utils$1.findKey(B,ye);(!ae||B[ae]===void 0||_e===!0||_e===void 0&&B[ae]!==!1)&&(B[ae||fe]=normalizeValue(c))}const T=(c,fe)=>utils$1.forEach(c,(_e,ye)=>X(_e,ye,fe));if(utils$1.isPlainObject(b)||b instanceof this.constructor)T(b,P);else if(utils$1.isString(b)&&(b=b.trim())&&!isValidHeaderName(b))T(parseHeaders(b),P);else if(utils$1.isHeaders(b))for(const[c,fe]of b.entries())X(fe,c,C);else b!=null&&X(P,b,C);return this}get(b,P){if(b=normalizeHeader(b),b){const C=utils$1.findKey(this,b);if(C){const B=this[C];if(!P)return B;if(P===!0)return parseTokens(B);if(utils$1.isFunction(P))return P.call(this,B,C);if(utils$1.isRegExp(P))return P.exec(B);throw new TypeError("parser must be boolean|regexp|function")}}}has(b,P){if(b=normalizeHeader(b),b){const C=utils$1.findKey(this,b);return!!(C&&this[C]!==void 0&&(!P||matchHeaderValue(this,this[C],C,P)))}return!1}delete(b,P){const C=this;let B=!1;function X(T){if(T=normalizeHeader(T),T){const c=utils$1.findKey(C,T);c&&(!P||matchHeaderValue(C,C[c],c,P))&&(delete C[c],B=!0)}}return utils$1.isArray(b)?b.forEach(X):X(b),B}clear(b){const P=Object.keys(this);let C=P.length,B=!1;for(;C--;){const X=P[C];(!b||matchHeaderValue(this,this[X],X,b,!0))&&(delete this[X],B=!0)}return B}normalize(b){const P=this,C={};return utils$1.forEach(this,(B,X)=>{const T=utils$1.findKey(C,X);if(T){P[T]=normalizeValue(B),delete P[X];return}const c=b?formatHeader(X):String(X).trim();c!==X&&delete P[X],P[c]=normalizeValue(B),C[c]=!0}),this}concat(...b){return this.constructor.concat(this,...b)}toJSON(b){const P=Object.create(null);return utils$1.forEach(this,(C,B)=>{C!=null&&C!==!1&&(P[B]=b&&utils$1.isArray(C)?C.join(", "):C)}),P}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([b,P])=>b+": "+P).join(`
|
582
|
+
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(b){return b instanceof this?b:new this(b)}static concat(b,...P){const C=new this(b);return P.forEach(B=>C.set(B)),C}static accessor(b){const C=(this[$internals]=this[$internals]={accessors:{}}).accessors,B=this.prototype;function X(T){const c=normalizeHeader(T);C[c]||(buildAccessors(B,T),C[c]=!0)}return utils$1.isArray(b)?b.forEach(X):X(b),this}}AxiosHeaders.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),utils$1.reduceDescriptors(AxiosHeaders.prototype,({value:m},b)=>{let P=b[0].toUpperCase()+b.slice(1);return{get:()=>m,set(C){this[P]=C}}}),utils$1.freezeMethods(AxiosHeaders);function transformData(m,b){const P=this||defaults,C=b||P,B=AxiosHeaders.from(C.headers);let X=C.data;return utils$1.forEach(m,function(c){X=c.call(P,X,B.normalize(),b?b.status:void 0)}),B.normalize(),X}function isCancel(m){return!!(m&&m.__CANCEL__)}function CanceledError(m,b,P){AxiosError.call(this,m??"canceled",AxiosError.ERR_CANCELED,b,P),this.name="CanceledError"}utils$1.inherits(CanceledError,AxiosError,{__CANCEL__:!0});function settle(m,b,P){const C=P.config.validateStatus;!P.status||!C||C(P.status)?m(P):b(new AxiosError("Request failed with status code "+P.status,[AxiosError.ERR_BAD_REQUEST,AxiosError.ERR_BAD_RESPONSE][Math.floor(P.status/100)-4],P.config,P.request,P))}function parseProtocol(m){const b=/^([-+\w]{1,25})(:?\/\/|:)/.exec(m);return b&&b[1]||""}function speedometer(m,b){m=m||10;const P=new Array(m),C=new Array(m);let B=0,X=0,T;return b=b!==void 0?b:1e3,function(fe){const _e=Date.now(),ye=C[X];T||(T=_e),P[B]=fe,C[B]=_e;let ae=X,oe=0;for(;ae!==B;)oe+=P[ae++],ae=ae%m;if(B=(B+1)%m,B===X&&(X=(X+1)%m),_e-T<b)return;const at=ye&&_e-ye;return at?Math.round(oe*1e3/at):void 0}}function throttle(m,b){let P=0,C=1e3/b,B,X;const T=(_e,ye=Date.now())=>{P=ye,B=null,X&&(clearTimeout(X),X=null),m.apply(null,_e)};return[(..._e)=>{const ye=Date.now(),ae=ye-P;ae>=C?T(_e,ye):(B=_e,X||(X=setTimeout(()=>{X=null,T(B)},C-ae)))},()=>B&&T(B)]}const progressEventReducer=(m,b,P=3)=>{let C=0;const B=speedometer(50,250);return throttle(X=>{const T=X.loaded,c=X.lengthComputable?X.total:void 0,fe=T-C,_e=B(fe),ye=T<=c;C=T;const ae={loaded:T,total:c,progress:c?T/c:void 0,bytes:fe,rate:_e||void 0,estimated:_e&&c&&ye?(c-T)/_e:void 0,event:X,lengthComputable:c!=null,[b?"download":"upload"]:!0};m(ae)},P)},progressEventDecorator=(m,b)=>{const P=m!=null;return[C=>b[0]({lengthComputable:P,total:m,loaded:C}),b[1]]},asyncDecorator=m=>(...b)=>utils$1.asap(()=>m(...b)),isURLSameOrigin=platform.hasStandardBrowserEnv?function(){const b=/(msie|trident)/i.test(navigator.userAgent),P=document.createElement("a");let C;function B(X){let T=X;return b&&(P.setAttribute("href",T),T=P.href),P.setAttribute("href",T),{href:P.href,protocol:P.protocol?P.protocol.replace(/:$/,""):"",host:P.host,search:P.search?P.search.replace(/^\?/,""):"",hash:P.hash?P.hash.replace(/^#/,""):"",hostname:P.hostname,port:P.port,pathname:P.pathname.charAt(0)==="/"?P.pathname:"/"+P.pathname}}return C=B(window.location.href),function(T){const c=utils$1.isString(T)?B(T):T;return c.protocol===C.protocol&&c.host===C.host}}():function(){return function(){return!0}}(),cookies=platform.hasStandardBrowserEnv?{write(m,b,P,C,B,X){const T=[m+"="+encodeURIComponent(b)];utils$1.isNumber(P)&&T.push("expires="+new Date(P).toGMTString()),utils$1.isString(C)&&T.push("path="+C),utils$1.isString(B)&&T.push("domain="+B),X===!0&&T.push("secure"),document.cookie=T.join("; ")},read(m){const b=document.cookie.match(new RegExp("(^|;\\s*)("+m+")=([^;]*)"));return b?decodeURIComponent(b[3]):null},remove(m){this.write(m,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function isAbsoluteURL(m){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(m)}function combineURLs(m,b){return b?m.replace(/\/?\/$/,"")+"/"+b.replace(/^\/+/,""):m}function buildFullPath(m,b){return m&&!isAbsoluteURL(b)?combineURLs(m,b):b}const headersToObject=m=>m instanceof AxiosHeaders?{...m}:m;function mergeConfig(m,b){b=b||{};const P={};function C(_e,ye,ae){return utils$1.isPlainObject(_e)&&utils$1.isPlainObject(ye)?utils$1.merge.call({caseless:ae},_e,ye):utils$1.isPlainObject(ye)?utils$1.merge({},ye):utils$1.isArray(ye)?ye.slice():ye}function B(_e,ye,ae){if(utils$1.isUndefined(ye)){if(!utils$1.isUndefined(_e))return C(void 0,_e,ae)}else return C(_e,ye,ae)}function X(_e,ye){if(!utils$1.isUndefined(ye))return C(void 0,ye)}function T(_e,ye){if(utils$1.isUndefined(ye)){if(!utils$1.isUndefined(_e))return C(void 0,_e)}else return C(void 0,ye)}function c(_e,ye,ae){if(ae in b)return C(_e,ye);if(ae in m)return C(void 0,_e)}const fe={url:X,method:X,data:X,baseURL:T,transformRequest:T,transformResponse:T,paramsSerializer:T,timeout:T,timeoutMessage:T,withCredentials:T,withXSRFToken:T,adapter:T,responseType:T,xsrfCookieName:T,xsrfHeaderName:T,onUploadProgress:T,onDownloadProgress:T,decompress:T,maxContentLength:T,maxBodyLength:T,beforeRedirect:T,transport:T,httpAgent:T,httpsAgent:T,cancelToken:T,socketPath:T,responseEncoding:T,validateStatus:c,headers:(_e,ye)=>B(headersToObject(_e),headersToObject(ye),!0)};return utils$1.forEach(Object.keys(Object.assign({},m,b)),function(ye){const ae=fe[ye]||B,oe=ae(m[ye],b[ye],ye);utils$1.isUndefined(oe)&&ae!==c||(P[ye]=oe)}),P}const resolveConfig=m=>{const b=mergeConfig({},m);let{data:P,withXSRFToken:C,xsrfHeaderName:B,xsrfCookieName:X,headers:T,auth:c}=b;b.headers=T=AxiosHeaders.from(T),b.url=buildURL(buildFullPath(b.baseURL,b.url),m.params,m.paramsSerializer),c&&T.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));let fe;if(utils$1.isFormData(P)){if(platform.hasStandardBrowserEnv||platform.hasStandardBrowserWebWorkerEnv)T.setContentType(void 0);else if((fe=T.getContentType())!==!1){const[_e,...ye]=fe?fe.split(";").map(ae=>ae.trim()).filter(Boolean):[];T.setContentType([_e||"multipart/form-data",...ye].join("; "))}}if(platform.hasStandardBrowserEnv&&(C&&utils$1.isFunction(C)&&(C=C(b)),C||C!==!1&&isURLSameOrigin(b.url))){const _e=B&&X&&cookies.read(X);_e&&T.set(B,_e)}return b},isXHRAdapterSupported=typeof XMLHttpRequest<"u",xhrAdapter=isXHRAdapterSupported&&function(m){return new Promise(function(P,C){const B=resolveConfig(m);let X=B.data;const T=AxiosHeaders.from(B.headers).normalize();let{responseType:c,onUploadProgress:fe,onDownloadProgress:_e}=B,ye,ae,oe,at,Ve;function Xe(){at&&at(),Ve&&Ve(),B.cancelToken&&B.cancelToken.unsubscribe(ye),B.signal&&B.signal.removeEventListener("abort",ye)}let Fe=new XMLHttpRequest;Fe.open(B.method.toUpperCase(),B.url,!0),Fe.timeout=B.timeout;function ut(){if(!Fe)return;const Ze=AxiosHeaders.from("getAllResponseHeaders"in Fe&&Fe.getAllResponseHeaders()),xt={data:!c||c==="text"||c==="json"?Fe.responseText:Fe.response,status:Fe.status,statusText:Fe.statusText,headers:Ze,config:m,request:Fe};settle(function(Tt){P(Tt),Xe()},function(Tt){C(Tt),Xe()},xt),Fe=null}"onloadend"in Fe?Fe.onloadend=ut:Fe.onreadystatechange=function(){!Fe||Fe.readyState!==4||Fe.status===0&&!(Fe.responseURL&&Fe.responseURL.indexOf("file:")===0)||setTimeout(ut)},Fe.onabort=function(){Fe&&(C(new AxiosError("Request aborted",AxiosError.ECONNABORTED,m,Fe)),Fe=null)},Fe.onerror=function(){C(new AxiosError("Network Error",AxiosError.ERR_NETWORK,m,Fe)),Fe=null},Fe.ontimeout=function(){let Ct=B.timeout?"timeout of "+B.timeout+"ms exceeded":"timeout exceeded";const xt=B.transitional||transitionalDefaults;B.timeoutErrorMessage&&(Ct=B.timeoutErrorMessage),C(new AxiosError(Ct,xt.clarifyTimeoutError?AxiosError.ETIMEDOUT:AxiosError.ECONNABORTED,m,Fe)),Fe=null},X===void 0&&T.setContentType(null),"setRequestHeader"in Fe&&utils$1.forEach(T.toJSON(),function(Ct,xt){Fe.setRequestHeader(xt,Ct)}),utils$1.isUndefined(B.withCredentials)||(Fe.withCredentials=!!B.withCredentials),c&&c!=="json"&&(Fe.responseType=B.responseType),_e&&([oe,Ve]=progressEventReducer(_e,!0),Fe.addEventListener("progress",oe)),fe&&Fe.upload&&([ae,at]=progressEventReducer(fe),Fe.upload.addEventListener("progress",ae),Fe.upload.addEventListener("loadend",at)),(B.cancelToken||B.signal)&&(ye=Ze=>{Fe&&(C(!Ze||Ze.type?new CanceledError(null,m,Fe):Ze),Fe.abort(),Fe=null)},B.cancelToken&&B.cancelToken.subscribe(ye),B.signal&&(B.signal.aborted?ye():B.signal.addEventListener("abort",ye)));const kt=parseProtocol(B.url);if(kt&&platform.protocols.indexOf(kt)===-1){C(new AxiosError("Unsupported protocol "+kt+":",AxiosError.ERR_BAD_REQUEST,m));return}Fe.send(X||null)})},composeSignals=(m,b)=>{let P=new AbortController,C;const B=function(fe){if(!C){C=!0,T();const _e=fe instanceof Error?fe:this.reason;P.abort(_e instanceof AxiosError?_e:new CanceledError(_e instanceof Error?_e.message:_e))}};let X=b&&setTimeout(()=>{B(new AxiosError(`timeout ${b} of ms exceeded`,AxiosError.ETIMEDOUT))},b);const T=()=>{m&&(X&&clearTimeout(X),X=null,m.forEach(fe=>{fe&&(fe.removeEventListener?fe.removeEventListener("abort",B):fe.unsubscribe(B))}),m=null)};m.forEach(fe=>fe&&fe.addEventListener&&fe.addEventListener("abort",B));const{signal:c}=P;return c.unsubscribe=T,[c,()=>{X&&clearTimeout(X),X=null}]},streamChunk=function*(m,b){let P=m.byteLength;if(!b||P<b){yield m;return}let C=0,B;for(;C<P;)B=C+b,yield m.slice(C,B),C=B},readBytes=async function*(m,b,P){for await(const C of m)yield*streamChunk(ArrayBuffer.isView(C)?C:await P(String(C)),b)},trackStream=(m,b,P,C,B)=>{const X=readBytes(m,b,B);let T=0,c,fe=_e=>{c||(c=!0,C&&C(_e))};return new ReadableStream({async pull(_e){try{const{done:ye,value:ae}=await X.next();if(ye){fe(),_e.close();return}let oe=ae.byteLength;if(P){let at=T+=oe;P(at)}_e.enqueue(new Uint8Array(ae))}catch(ye){throw fe(ye),ye}},cancel(_e){return fe(_e),X.return()}},{highWaterMark:2})},isFetchSupported=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",isReadableStreamSupported=isFetchSupported&&typeof ReadableStream=="function",encodeText=isFetchSupported&&(typeof TextEncoder=="function"?(m=>b=>m.encode(b))(new TextEncoder):async m=>new Uint8Array(await new Response(m).arrayBuffer())),test=(m,...b)=>{try{return!!m(...b)}catch{return!1}},supportsRequestStream=isReadableStreamSupported&&test(()=>{let m=!1;const b=new Request(platform.origin,{body:new ReadableStream,method:"POST",get duplex(){return m=!0,"half"}}).headers.has("Content-Type");return m&&!b}),DEFAULT_CHUNK_SIZE=64*1024,supportsResponseStream=isReadableStreamSupported&&test(()=>utils$1.isReadableStream(new Response("").body)),resolvers={stream:supportsResponseStream&&(m=>m.body)};isFetchSupported&&(m=>{["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!resolvers[b]&&(resolvers[b]=utils$1.isFunction(m[b])?P=>P[b]():(P,C)=>{throw new AxiosError(`Response type '${b}' is not supported`,AxiosError.ERR_NOT_SUPPORT,C)})})})(new Response);const getBodyLength=async m=>{if(m==null)return 0;if(utils$1.isBlob(m))return m.size;if(utils$1.isSpecCompliantForm(m))return(await new Request(m).arrayBuffer()).byteLength;if(utils$1.isArrayBufferView(m)||utils$1.isArrayBuffer(m))return m.byteLength;if(utils$1.isURLSearchParams(m)&&(m=m+""),utils$1.isString(m))return(await encodeText(m)).byteLength},resolveBodyLength=async(m,b)=>{const P=utils$1.toFiniteNumber(m.getContentLength());return P??getBodyLength(b)},fetchAdapter=isFetchSupported&&(async m=>{let{url:b,method:P,data:C,signal:B,cancelToken:X,timeout:T,onDownloadProgress:c,onUploadProgress:fe,responseType:_e,headers:ye,withCredentials:ae="same-origin",fetchOptions:oe}=resolveConfig(m);_e=_e?(_e+"").toLowerCase():"text";let[at,Ve]=B||X||T?composeSignals([B,X],T):[],Xe,Fe;const ut=()=>{!Xe&&setTimeout(()=>{at&&at.unsubscribe()}),Xe=!0};let kt;try{if(fe&&supportsRequestStream&&P!=="get"&&P!=="head"&&(kt=await resolveBodyLength(ye,C))!==0){let et=new Request(b,{method:"POST",body:C,duplex:"half"}),Tt;if(utils$1.isFormData(C)&&(Tt=et.headers.get("content-type"))&&ye.setContentType(Tt),et.body){const[nr,si]=progressEventDecorator(kt,progressEventReducer(asyncDecorator(fe)));C=trackStream(et.body,DEFAULT_CHUNK_SIZE,nr,si,encodeText)}}utils$1.isString(ae)||(ae=ae?"include":"omit"),Fe=new Request(b,{...oe,signal:at,method:P.toUpperCase(),headers:ye.normalize().toJSON(),body:C,duplex:"half",credentials:ae});let Ze=await fetch(Fe);const Ct=supportsResponseStream&&(_e==="stream"||_e==="response");if(supportsResponseStream&&(c||Ct)){const et={};["status","statusText","headers"].forEach(Cr=>{et[Cr]=Ze[Cr]});const Tt=utils$1.toFiniteNumber(Ze.headers.get("content-length")),[nr,si]=c&&progressEventDecorator(Tt,progressEventReducer(asyncDecorator(c),!0))||[];Ze=new Response(trackStream(Ze.body,DEFAULT_CHUNK_SIZE,nr,()=>{si&&si(),Ct&&ut()},encodeText),et)}_e=_e||"text";let xt=await resolvers[utils$1.findKey(resolvers,_e)||"text"](Ze,m);return!Ct&&ut(),Ve&&Ve(),await new Promise((et,Tt)=>{settle(et,Tt,{data:xt,headers:AxiosHeaders.from(Ze.headers),status:Ze.status,statusText:Ze.statusText,config:m,request:Fe})})}catch(Ze){throw ut(),Ze&&Ze.name==="TypeError"&&/fetch/i.test(Ze.message)?Object.assign(new AxiosError("Network Error",AxiosError.ERR_NETWORK,m,Fe),{cause:Ze.cause||Ze}):AxiosError.from(Ze,Ze&&Ze.code,m,Fe)}}),knownAdapters={http:httpAdapter,xhr:xhrAdapter,fetch:fetchAdapter};utils$1.forEach(knownAdapters,(m,b)=>{if(m){try{Object.defineProperty(m,"name",{value:b})}catch{}Object.defineProperty(m,"adapterName",{value:b})}});const renderReason=m=>`- ${m}`,isResolvedHandle=m=>utils$1.isFunction(m)||m===null||m===!1,adapters={getAdapter:m=>{m=utils$1.isArray(m)?m:[m];const{length:b}=m;let P,C;const B={};for(let X=0;X<b;X++){P=m[X];let T;if(C=P,!isResolvedHandle(P)&&(C=knownAdapters[(T=String(P)).toLowerCase()],C===void 0))throw new AxiosError(`Unknown adapter '${T}'`);if(C)break;B[T||"#"+X]=C}if(!C){const X=Object.entries(B).map(([c,fe])=>`adapter ${c} `+(fe===!1?"is not supported by the environment":"is not available in the build"));let T=b?X.length>1?`since :
|
583
|
+
`+X.map(renderReason).join(`
|
584
|
+
`):" "+renderReason(X[0]):"as no adapter specified";throw new AxiosError("There is no suitable adapter to dispatch the request "+T,"ERR_NOT_SUPPORT")}return C},adapters:knownAdapters};function throwIfCancellationRequested(m){if(m.cancelToken&&m.cancelToken.throwIfRequested(),m.signal&&m.signal.aborted)throw new CanceledError(null,m)}function dispatchRequest(m){return throwIfCancellationRequested(m),m.headers=AxiosHeaders.from(m.headers),m.data=transformData.call(m,m.transformRequest),["post","put","patch"].indexOf(m.method)!==-1&&m.headers.setContentType("application/x-www-form-urlencoded",!1),adapters.getAdapter(m.adapter||defaults.adapter)(m).then(function(C){return throwIfCancellationRequested(m),C.data=transformData.call(m,m.transformResponse,C),C.headers=AxiosHeaders.from(C.headers),C},function(C){return isCancel(C)||(throwIfCancellationRequested(m),C&&C.response&&(C.response.data=transformData.call(m,m.transformResponse,C.response),C.response.headers=AxiosHeaders.from(C.response.headers))),Promise.reject(C)})}const VERSION="1.7.4",validators$1={};["object","boolean","number","function","string","symbol"].forEach((m,b)=>{validators$1[m]=function(C){return typeof C===m||"a"+(b<1?"n ":" ")+m}});const deprecatedWarnings={};validators$1.transitional=function(b,P,C){function B(X,T){return"[Axios v"+VERSION+"] Transitional option '"+X+"'"+T+(C?". "+C:"")}return(X,T,c)=>{if(b===!1)throw new AxiosError(B(T," has been removed"+(P?" in "+P:"")),AxiosError.ERR_DEPRECATED);return P&&!deprecatedWarnings[T]&&(deprecatedWarnings[T]=!0,console.warn(B(T," has been deprecated since v"+P+" and will be removed in the near future"))),b?b(X,T,c):!0}};function assertOptions(m,b,P){if(typeof m!="object")throw new AxiosError("options must be an object",AxiosError.ERR_BAD_OPTION_VALUE);const C=Object.keys(m);let B=C.length;for(;B-- >0;){const X=C[B],T=b[X];if(T){const c=m[X],fe=c===void 0||T(c,X,m);if(fe!==!0)throw new AxiosError("option "+X+" must be "+fe,AxiosError.ERR_BAD_OPTION_VALUE);continue}if(P!==!0)throw new AxiosError("Unknown option "+X,AxiosError.ERR_BAD_OPTION)}}const validator={assertOptions,validators:validators$1},validators=validator.validators;class Axios{constructor(b){this.defaults=b,this.interceptors={request:new InterceptorManager,response:new InterceptorManager}}async request(b,P){try{return await this._request(b,P)}catch(C){if(C instanceof Error){let B;Error.captureStackTrace?Error.captureStackTrace(B={}):B=new Error;const X=B.stack?B.stack.replace(/^.+\n/,""):"";try{C.stack?X&&!String(C.stack).endsWith(X.replace(/^.+\n.+\n/,""))&&(C.stack+=`
|
585
|
+
`+X):C.stack=X}catch{}}throw C}}_request(b,P){typeof b=="string"?(P=P||{},P.url=b):P=b||{},P=mergeConfig(this.defaults,P);const{transitional:C,paramsSerializer:B,headers:X}=P;C!==void 0&&validator.assertOptions(C,{silentJSONParsing:validators.transitional(validators.boolean),forcedJSONParsing:validators.transitional(validators.boolean),clarifyTimeoutError:validators.transitional(validators.boolean)},!1),B!=null&&(utils$1.isFunction(B)?P.paramsSerializer={serialize:B}:validator.assertOptions(B,{encode:validators.function,serialize:validators.function},!0)),P.method=(P.method||this.defaults.method||"get").toLowerCase();let T=X&&utils$1.merge(X.common,X[P.method]);X&&utils$1.forEach(["delete","get","head","post","put","patch","common"],Ve=>{delete X[Ve]}),P.headers=AxiosHeaders.concat(T,X);const c=[];let fe=!0;this.interceptors.request.forEach(function(Xe){typeof Xe.runWhen=="function"&&Xe.runWhen(P)===!1||(fe=fe&&Xe.synchronous,c.unshift(Xe.fulfilled,Xe.rejected))});const _e=[];this.interceptors.response.forEach(function(Xe){_e.push(Xe.fulfilled,Xe.rejected)});let ye,ae=0,oe;if(!fe){const Ve=[dispatchRequest.bind(this),void 0];for(Ve.unshift.apply(Ve,c),Ve.push.apply(Ve,_e),oe=Ve.length,ye=Promise.resolve(P);ae<oe;)ye=ye.then(Ve[ae++],Ve[ae++]);return ye}oe=c.length;let at=P;for(ae=0;ae<oe;){const Ve=c[ae++],Xe=c[ae++];try{at=Ve(at)}catch(Fe){Xe.call(this,Fe);break}}try{ye=dispatchRequest.call(this,at)}catch(Ve){return Promise.reject(Ve)}for(ae=0,oe=_e.length;ae<oe;)ye=ye.then(_e[ae++],_e[ae++]);return ye}getUri(b){b=mergeConfig(this.defaults,b);const P=buildFullPath(b.baseURL,b.url);return buildURL(P,b.params,b.paramsSerializer)}}utils$1.forEach(["delete","get","head","options"],function(b){Axios.prototype[b]=function(P,C){return this.request(mergeConfig(C||{},{method:b,url:P,data:(C||{}).data}))}}),utils$1.forEach(["post","put","patch"],function(b){function P(C){return function(X,T,c){return this.request(mergeConfig(c||{},{method:b,headers:C?{"Content-Type":"multipart/form-data"}:{},url:X,data:T}))}}Axios.prototype[b]=P(),Axios.prototype[b+"Form"]=P(!0)});class CancelToken{constructor(b){if(typeof b!="function")throw new TypeError("executor must be a function.");let P;this.promise=new Promise(function(X){P=X});const C=this;this.promise.then(B=>{if(!C._listeners)return;let X=C._listeners.length;for(;X-- >0;)C._listeners[X](B);C._listeners=null}),this.promise.then=B=>{let X;const T=new Promise(c=>{C.subscribe(c),X=c}).then(B);return T.cancel=function(){C.unsubscribe(X)},T},b(function(X,T,c){C.reason||(C.reason=new CanceledError(X,T,c),P(C.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(b){if(this.reason){b(this.reason);return}this._listeners?this._listeners.push(b):this._listeners=[b]}unsubscribe(b){if(!this._listeners)return;const P=this._listeners.indexOf(b);P!==-1&&this._listeners.splice(P,1)}static source(){let b;return{token:new CancelToken(function(B){b=B}),cancel:b}}}function spread(m){return function(P){return m.apply(null,P)}}function isAxiosError(m){return utils$1.isObject(m)&&m.isAxiosError===!0}const HttpStatusCode={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(HttpStatusCode).forEach(([m,b])=>{HttpStatusCode[b]=m});function createInstance(m){const b=new Axios(m),P=bind(Axios.prototype.request,b);return utils$1.extend(P,Axios.prototype,b,{allOwnKeys:!0}),utils$1.extend(P,b,null,{allOwnKeys:!0}),P.create=function(B){return createInstance(mergeConfig(m,B))},P}const axios=createInstance(defaults);axios.Axios=Axios,axios.CanceledError=CanceledError,axios.CancelToken=CancelToken,axios.isCancel=isCancel,axios.VERSION=VERSION,axios.toFormData=toFormData,axios.AxiosError=AxiosError,axios.Cancel=axios.CanceledError,axios.all=function(b){return Promise.all(b)},axios.spread=spread,axios.isAxiosError=isAxiosError,axios.mergeConfig=mergeConfig,axios.AxiosHeaders=AxiosHeaders,axios.formToJSON=m=>formDataToJSON(utils$1.isHTMLForm(m)?new FormData(m):m),axios.getAdapter=adapters.getAdapter,axios.HttpStatusCode=HttpStatusCode,axios.default=axios;const debounce=(m,b=300)=>{let P;return function(...B){clearTimeout(P),P=setTimeout(()=>{m.apply(this,B)},b)}},_sfc_main$a={mixins:[layerMixin],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}]},selectedLayer:{type:String,required:!0}},watch:{map(m){m&&m.on("load",this.handleMapLoad)}},methods:{handleMapLoad(){var m;this.baseLayers.forEach(b=>{this.layerList.push(b)}),this.toggleLayerVisibility((m=this.baseLayers[0])==null?void 0:m.id)},toggleLayerVisibility(m){this.$emit("update:selectedLayer",m),this.changeBaseLayer(m)}}},_hoisted_1$9={class:"vs-map-slot-layers z-10 select-none"},_hoisted_2$9=["onClick"],_hoisted_3$7=["src"];function _sfc_render$9(m,b,P,C,B,X){return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$9,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(P.baseLayers,(T,c)=>(vue.openBlock(),vue.createElementBlock("div",{key:T.id,class:vue.normalizeClass(["vs-map-slot-layers__layer relative",{focused:T.id==P.selectedLayer}]),onClick:fe=>X.toggleLayerVisibility(T.id)},[vue.createElementVNode("img",{src:T.image,class:"vs-map-slot-layers__image"},null,8,_hoisted_3$7),vue.createElementVNode("div",{class:vue.normalizeClass(["absolute py-2 px-4 text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg top-[-46px] text-nowrap p-2 hidden whitespace-nowrap",[c===0?"left-[-10px]":"left-[50%] translate-x-[-50%]"]])},vue.toDisplayString(T==null?void 0:T.name),3)],10,_hoisted_2$9))),128))])}const MapSlotLayers=_export_sfc(_sfc_main$a,[["render",_sfc_render$9],["__scopeId","data-v-8959e540"]]),_sfc_main$9={props:["colors","strokes","title"],methods:{capitalizeFirstLetter(m){return m?m.charAt(0).toUpperCase()+m.slice(1):""}}},_hoisted_1$8={class:"absolute left-[20px] bottom-[74px] bg-white max-w-[250px] p-[10px] rounded-lg z-10 border"},_hoisted_2$8={key:0,class:"mb-[10px] text-[1rem]"},_hoisted_3$6={key:1},_hoisted_4$6={class:"legend-item flex items-center gap-2 mb-[10px]"},_hoisted_5$5={class:"ml-1 text-[0.875rem]"},_hoisted_6$5={class:"legend-item"},_hoisted_7$1={key:0,class:"flex justify-start items-center gap-2"},_hoisted_8$1={class:"ml-1 text-[0.875rem]"};function _sfc_render$8(m,b,P,C,B,X){var T;return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$8,[P.title?(vue.openBlock(),vue.createElementBlock("div",_hoisted_2$8,vue.toDisplayString(P.title),1)):vue.createCommentVNode("",!0),(T=P.strokes)!=null&&T.length?(vue.openBlock(),vue.createElementBlock("div",_hoisted_3$6,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(P.strokes,c=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_4$6,[vue.createElementVNode("div",{class:"w-[15px] h-[4px]",style:vue.normalizeStyle({background:`repeating-linear-gradient(to right, ${c.color}, ${c.color} 5px, transparent 5px, transparent 8px)`})},null,4),vue.createElementVNode("div",_hoisted_5$5,vue.toDisplayString(X.capitalizeFirstLetter(c.text)),1)]))),256))])):vue.createCommentVNode("",!0),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(P.colors,c=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_6$5,[c.id>0?(vue.openBlock(),vue.createElementBlock("div",_hoisted_7$1,[vue.createElementVNode("div",{class:"w-[15px] h-[15px] rounded-[50%] min-w-[15px]",style:vue.normalizeStyle({backgroundColor:c.color})},null,4),vue.createElementVNode("div",_hoisted_8$1,vue.toDisplayString(X.capitalizeFirstLetter(c.text)),1)])):vue.createCommentVNode("",!0)]))),256))])}const MapLegend=_export_sfc(_sfc_main$9,[["render",_sfc_render$8]]);function feature(m,b,P={}){const C={type:"Feature"};return(P.id===0||P.id)&&(C.id=P.id),P.bbox&&(C.bbox=P.bbox),C.properties=b||{},C.geometry=m,C}function point(m,b,P={}){if(!m)throw new Error("coordinates is required");if(!Array.isArray(m))throw new Error("coordinates must be an Array");if(m.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!isNumber(m[0])||!isNumber(m[1]))throw new Error("coordinates must contain numbers");return feature({type:"Point",coordinates:m},b,P)}function polygon(m,b,P={}){for(const B of m){if(B.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(B[B.length-1].length!==B[0].length)throw new Error("First and last Position are not equivalent.");for(let X=0;X<B[B.length-1].length;X++)if(B[B.length-1][X]!==B[0][X])throw new Error("First and last Position are not equivalent.")}return feature({type:"Polygon",coordinates:m},b,P)}function multiPoint(m,b,P={}){return feature({type:"MultiPoint",coordinates:m},b,P)}function multiPolygon(m,b,P={}){return feature({type:"MultiPolygon",coordinates:m},b,P)}function isNumber(m){return!isNaN(m)&&m!==null&&!Array.isArray(m)}function coordEach(m,b,P){if(m!==null)for(var C,B,X,T,c,fe,_e,ye=0,ae=0,oe,at=m.type,Ve=at==="FeatureCollection",Xe=at==="Feature",Fe=Ve?m.features.length:1,ut=0;ut<Fe;ut++){_e=Ve?m.features[ut].geometry:Xe?m.geometry:m,oe=_e?_e.type==="GeometryCollection":!1,c=oe?_e.geometries.length:1;for(var kt=0;kt<c;kt++){var Ze=0,Ct=0;if(T=oe?_e.geometries[kt]:_e,T!==null){fe=T.coordinates;var xt=T.type;switch(ye=0,xt){case null:break;case"Point":if(b(fe,ae,ut,Ze,Ct)===!1)return!1;ae++,Ze++;break;case"LineString":case"MultiPoint":for(C=0;C<fe.length;C++){if(b(fe[C],ae,ut,Ze,Ct)===!1)return!1;ae++,xt==="MultiPoint"&&Ze++}xt==="LineString"&&Ze++;break;case"Polygon":case"MultiLineString":for(C=0;C<fe.length;C++){for(B=0;B<fe[C].length-ye;B++){if(b(fe[C][B],ae,ut,Ze,Ct)===!1)return!1;ae++}xt==="MultiLineString"&&Ze++,xt==="Polygon"&&Ct++}xt==="Polygon"&&Ze++;break;case"MultiPolygon":for(C=0;C<fe.length;C++){for(Ct=0,B=0;B<fe[C].length;B++){for(X=0;X<fe[C][B].length-ye;X++){if(b(fe[C][B][X],ae,ut,Ze,Ct)===!1)return!1;ae++}Ct++}Ze++}break;case"GeometryCollection":for(C=0;C<T.geometries.length;C++)if(coordEach(T.geometries[C],b)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function bbox(m,b={}){if(m.bbox!=null&&b.recompute!==!0)return m.bbox;const P=[1/0,1/0,-1/0,-1/0];return coordEach(m,C=>{P[0]>C[0]&&(P[0]=C[0]),P[1]>C[1]&&(P[1]=C[1]),P[2]<C[0]&&(P[2]=C[0]),P[3]<C[1]&&(P[3]=C[1])}),P}function center(m,b={}){const P=bbox(m),C=(P[0]+P[2])/2,B=(P[1]+P[3])/2;return point([C,B],b.properties,b)}const _sfc_main$8={components:{MapSlotLayers,MapLegend},props:{isMapCompare:{type:Boolean,default:!0},polygonOpacity:{type:Number,default:()=>null},polygonStrokeWidth:{type:Number,default:()=>4},dashedLine:{type:Boolean,default:()=>!1},colorAttr:null,strokeAttr:null,zoom:{type:Array,default:()=>8},defaultColor:{type:String,default:"blue"},selectedBaseLayer:{type:String,required:!0},legendname:{type:String,default:()=>""},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:13},minZoom:{type:[String,Number],default:1},basemap:Array,filtersParam:{type:String,default:""},row:{type:Object,default:{}},pointZoom:{type:String,default:"12"},legend:{type:Boolean,default:()=>!0}},mixins:[layerMixin],inject:["prefix"],data(){return{map:null,hoverObject:null,hoverData:null,popup:null,colors:[],strokes:null}},async mounted(){var m,b,P,C;try{if(await this.createMap(),(m=this.row)!=null&&m.geom){const{type:B,coordinates:X}=this.row.geom;let T;switch(B){case"Polygon":T=polygon(X);break;case"MultiPolygon":T=multiPolygon(X);break;case"MultiPoint":T=multiPoint(X);break;default:(b=this.map)==null||b.fitBounds([X,X],{maxZoom:this.zoom,padding:30,duration:0}),this.isSelectObj=!0;return}const c=center(T).geometry.coordinates;(P=this.map)==null||P.fitBounds([c,c],{maxZoom:this.zoom,padding:30,duration:0})}(C=this.map)==null||C.fitBounds(this.center,{duration:0})}catch{}},watch:{filtersParam(m){this.setFilter(this.table,m)},selectedBaseLayer(m){this.$emit("update:selectedBaseLayer",m)},row:{handler(m){m!=null&&m.geom&&this.fitToBounds(m.geom),this.map&&this.map.getStyle()&&this.map.getStyle().layers.filter(C=>C.source===this.table&&C.type==="line").forEach(C=>{var B;this.map.setPaintProperty(C.id,"line-width",((B=this.row)==null?void 0:B.id)!=null?["case",["==",["get","id"],this.row.id.toString()],(this.polygonStrokeWidth??2.5)*2,this.polygonStrokeWidth??2.5]:this.polygonStrokeWidth??2.5)})},immediate:!0}},computed:{basemapIds(){return this.basemap.map(m=>m==null?void 0:m.id)}},methods:{async getColorStyle(){var m=[["#69D2E7","#A7DBD8","#E0E4CC","#F38630","#FA6900"],["#FE4365","#FC9D9A","#F9CDAD","#C8C8A9","#83AF9B"],["#ECD078","#D95B43","#C02942","#542437","#53777A"]];if(!this.colorAttr)return this.defaultColor;try{const{data:{rows:b}}=await axios.get(`${this.prefix}/data/${this.table}/${this.colorAttr}`),P=b.reduce((C,B,X)=>B!=null&&B.id?[...C,B.id.toString(),B.color||m[0][X%5]]:C,["match",["get",this.colorAttr]]);return this.colors=[...b],P.push("gray"),P}catch(b){console.log(b)}},async getStrokeStyle(){if(!this.strokeAttr)return"transparent";try{const{data:{rows:m}}=await axios.get(`${this.prefix}/data/${this.table}/${this.strokeAttr}`),b=m.reduce((P,C,B)=>C!=null&&C.id?[...P,{id:C.id.toString(),color:C.color||"#000000",dash:C.dash||[2,2],text:C.text||C.id.toString()}]:P,[]);return this.strokes=[...b],["match",["get",this.strokeAttr],...b.flatMap(({id:P,color:C})=>[P,C]),"transparent"]}catch(m){return console.log(m),"transparent"}},async handleMapLoad(){var C,B,X,T,c;(C=this.row)!=null&&C.geom&&this.fitToBounds(this.row.geom),this.$emit("map",this.map),this.map.on("mousemove",this.handleMapHover);const m=await this.getStrokeStyle(),b=await this.getColorStyle(),P=((X=(B=location.search.split("&").find(fe=>fe.includes("filter=")))==null?void 0:B.split("filter="))==null?void 0:X[1])||"";await this.addLayer({id:this.table,service:"vector",url:`${this.prefix}/vtile/${this.table}/ua/{z}/{x}/{y}.vmt?pointZoom=${this.pointZoom}&dt=${new Date().toISOString()}`,layers:[{type:"fill","source-layer":this.table,paint:{"fill-color":b,"fill-opacity":this.polygonOpacity??.5,"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":b}},{type:"line",paint:{"line-color":b,"line-width":((T=this.row)==null?void 0:T.id)!=null?["case",["==",["get","id"],this.row.id.toString()],(this.polygonStrokeWidth??2.5)*2,this.polygonStrokeWidth??2.5]:this.polygonStrokeWidth??2.5}},...this.dashedLine?[{type:"line",paint:{"line-color":m,"line-width":((c=this.row)==null?void 0:c.id)!=null?["case",["==",["get","id"],this.row.id.toString()],(this.polygonStrokeWidth??2.5)*2,this.polygonStrokeWidth??2.5]:this.polygonStrokeWidth??2.5,"line-dasharray":[2,2]}}]:[]]}),P&&this.setFilter(this.table,P)},async createMap(){const m={version:8,glyphs:"https://cdn.softpro.ua/data/fonts/{fontstack}/{range}.pbf",sources:{},layers:[]};this.map=await new maplibregl.Map({container:"maplibre-map",style:m,zoom:this.zoom,center:this.center,minZoom:this.minZoom}),this.$parent.map=this.map,this.map.addControl(new maplibregl.NavigationControl({visualizePitch:!0})),this.map.on("load",this.handleMapLoad)},fitToBounds(m){if(!this.map)return;const{type:b,coordinates:P}=m;let C,B;switch(b){case"Polygon":C=polygon(P),B=bbox(C),this.map.fitBounds(B,{padding:30,maxZoom:15,duration:0});break;case"MultiPolygon":C=multiPolygon(P),B=bbox(C),this.map.fitBounds(B,{padding:30,maxZoom:15,duration:0});break;case"MultiPoint":C=multiPoint(P),B=bbox(C),this.map.fitBounds(B,{padding:30,maxZoom:15,duration:0});break;case"Point":this.map.flyTo({center:P,zoom:15,duration:0,essential:!0});break;default:console.warn("Невідомий тип геометрії:",b)}},async handleMapHover(m){var T,c,fe;this.hoverObject&&(this.map.setFeatureState(this.hoverObject,{hover:!1}),this.hoverObject=null),this.popup||(this.popup=new maplibregl.Popup({maxWidth:"400px",closeButton:!1,closeOnClick:!1}));const b=this.map.queryRenderedFeatures(m.point);if(this.map.getCanvas().style.cursor="pointer",!(b!=null&&b.length)||((T=b==null?void 0:b[0])==null?void 0:T.source)==="region-search-id"){this.map.getCanvas().style.cursor="",this.popup.remove();return}const P=["route-line"];if(!b.filter(_e=>!P.some(ye=>{var ae;return(ae=_e.layer)==null?void 0:ae.source.includes(ye)})).length)return;const B=b[0].geometry.coordinates.slice();b[0].source==="highlighted-polygon"&&b[1]?this.hoverData=(c=b[1])==null?void 0:c.properties:this.hoverData=(fe=b[0])==null?void 0:fe.properties;const X={source:b[0].source,sourceLayer:b[0].sourceLayer,id:b[0].id};if(X.source!=="region-search-id"){for(this.map.setFeatureState(X,{hover:!0}),this.hoverObject=X;Math.abs(m.lngLat.lng-B[0])>180;)B[0]+=m.lngLat.lng>B[0]?360:-360;this.popup.setLngLat(m.lngLat).setHTML(this.$refs.popup.innerHTML).addTo(this.map)}}}},_hoisted_1$7={class:"vs-map-portal relative z-1 mt-2",id:"mapwrapper"},_hoisted_2$7={ref:"popup",style:{display:"none"}};function _sfc_render$7(m,b,P,C,B,X){const T=vue.resolveComponent("MapLegend"),c=vue.resolveComponent("MapSlotLayers");return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$7,[vue.createElementVNode("div",{id:"maplibre-map",ref:"maplibreMap",class:"w-full compare_main_map",style:vue.normalizeStyle({height:P.height})},null,4),vue.withDirectives(vue.createVNode(T,{colors:B.colors,strokes:B.strokes,title:P.legendname},null,8,["colors","strokes","title"]),[[vue.vShow,P.legend]]),vue.createVNode(c,{map:B.map,baseLayers:P.basemap,selectedLayer:P.selectedBaseLayer,"onUpdate:selectedLayer":b[0]||(b[0]=fe=>m.$emit("update:selectedBaseLayer",fe))},null,8,["map","baseLayers","selectedLayer"]),vue.createElementVNode("div",_hoisted_2$7,[vue.renderSlot(m.$slots,"default",{hoverData:B.hoverData})],512)])}const MapPortal=_export_sfc(_sfc_main$8,[["render",_sfc_render$7]]),_sfc_main$7={},_hoisted_1$6={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"},_hoisted_2$6=vue.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),_hoisted_11$1=[_hoisted_2$6];function _sfc_render$6(m,b){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$6,_hoisted_11$1)}const FilterIcon=_export_sfc(_sfc_main$7,[["render",_sfc_render$6]]),_sfc_main$6={},_hoisted_1$5={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"},_hoisted_2$5=vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),_hoisted_3$5=vue.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),_hoisted_4$5=vue.createElementVNode("path",{d:"M15 4v16"},null,-1),_hoisted_5$4=vue.createElementVNode("path",{d:"M9 10l2 2l-2 2"},null,-1),_hoisted_6$4=[_hoisted_2$5,_hoisted_3$5,_hoisted_4$5,_hoisted_5$4];function _sfc_render$5(m,b){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$5,_hoisted_6$4)}const VisibleMapIcon=_export_sfc(_sfc_main$6,[["render",_sfc_render$5]]),_sfc_main$5={},_hoisted_1$4={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"},_hoisted_2$4=vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),_hoisted_3$4=vue.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),_hoisted_4$4=vue.createElementVNode("path",{d:"M15 4v16"},null,-1),_hoisted_5$3=vue.createElementVNode("path",{d:"M10 10l-2 2l2 2"},null,-1),_hoisted_6$3=[_hoisted_2$4,_hoisted_3$4,_hoisted_4$4,_hoisted_5$3];function _sfc_render$4(m,b){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$4,_hoisted_6$3)}const HiddenMapIcon=_export_sfc(_sfc_main$5,[["render",_sfc_render$4]]),_sfc_main$4={},_hoisted_1$3={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"},_hoisted_2$3=vue.createElementVNode("path",{d:"M18 6 6 18"},null,-1),_hoisted_3$3=vue.createElementVNode("path",{d:"m6 6 12 12"},null,-1),_hoisted_4$3=[_hoisted_2$3,_hoisted_3$3];function _sfc_render$3(m,b){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$3,_hoisted_4$3)}const CloseIcon=_export_sfc(_sfc_main$4,[["render",_sfc_render$3]]),_sfc_main$3={__name:"vs-partsmap-search",props:{modelValue:null,maskForSearch:null,searchShow:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(m,{emit:b}){const P=b;return(C,B)=>{const X=vue.resolveComponent("VsTextMask"),T=vue.resolveComponent("vs-text");return m.maskForSearch?(vue.openBlock(),vue.createBlock(X,{key:0,"model-value":m.modelValue,"onUpdate:modelValue":B[0]||(B[0]=c=>P("update:modelValue",c)),class:"w-full table-interface-search",placeholder:"Пошук",mask:m.maskForSearch,icon:"search",iconPosition:"left",clearable:"",style:{height:"38px","min-width":"300px","max-width":"300px"}},null,8,["model-value","mask"])):m.searchShow?(vue.openBlock(),vue.createBlock(T,{key:1,"model-value":m.modelValue,"onUpdate:modelValue":B[1]||(B[1]=c=>P("update:modelValue",c)),class:"[&>input]:py-[7px] [&>input]:max-h-[38px] [&>input]:w-[220px] [&>input]:ps-10 [&>input]:pe-8 [&>input]:block [&>input]:w-full [&>input]:bg-gray-100 [&>input]:border-transparent [&>input]:rounded-lg [&>input]:text-sm [&>input]:focus:bg-white [&>input]:focus:border-blue-500 [&>input]:focus:ring-blue-500 [&>input]:disabled:opacity-50 [&>input]:disabled:pointer-events-none [&>input]:dark:bg-neutral-700 [&>input]:dark:border-transparent [&>input]:dark:text-neutral-400 [&>input]:dark:placeholder:text-neutral-400 dark:focus:bg-neutral-800 dark:focus:ring-neutral-600",placeholder:"Пошук",icon:"search","icon-position":"left",clearable:"",style:{height:"38px"}},null,8,["model-value"])):vue.createCommentVNode("",!0)}}},_sfc_main$2={},_hoisted_1$2={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",class:"icon icon-tabler icons-tabler-outline icon-tabler-map"},_hoisted_2$2=vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),_hoisted_3$2=vue.createElementVNode("path",{d:"M3 7l6 -3l6 3l6 -3v13l-6 3l-6 -3l-6 3v-13"},null,-1),_hoisted_4$2=vue.createElementVNode("path",{d:"M9 4v13"},null,-1),_hoisted_5$2=vue.createElementVNode("path",{d:"M15 7v13"},null,-1),_hoisted_6$2=[_hoisted_2$2,_hoisted_3$2,_hoisted_4$2,_hoisted_5$2];function _sfc_render$2(m,b){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$2,_hoisted_6$2)}const IconMap=_export_sfc(_sfc_main$2,[["render",_sfc_render$2]]),_sfc_main$1={},_hoisted_1$1={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",class:"icon icon-tabler icons-tabler-outline icon-tabler-table"},_hoisted_2$1=vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),_hoisted_3$1=vue.createElementVNode("path",{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z"},null,-1),_hoisted_4$1=vue.createElementVNode("path",{d:"M3 10h18"},null,-1),_hoisted_5$1=vue.createElementVNode("path",{d:"M10 3v18"},null,-1),_hoisted_6$1=[_hoisted_2$1,_hoisted_3$1,_hoisted_4$1,_hoisted_5$1];function _sfc_render$1(m,b){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$1,_hoisted_6$1)}const IconTable=_export_sfc(_sfc_main$1,[["render",_sfc_render$1]]),_sfc_main=vue.defineComponent({props:{prefix:{type:String,default:"/api"},applyVueRouter:{type:Boolean,default:!0},dashedLine:{type:Boolean,default:!1},title:{type:String,default:()=>""},table:{type:String,default:()=>""},rows:{type:Object,default:()=>null},initTotal:{type:[Number,String],default:()=>""},colorAttr:{type:String,default:()=>""},strokeAttr:{type:String,default:()=>""},legendname:{type:String,default:()=>""},center:{type:Array},maxBounds:{type:Array,default:()=>[[22,44.4],[40,52.5]]},id:{type:String,default:()=>""},zoom:{type:[Number,String],default:()=>"13"},minZoom:{type:[Number,String],default:()=>"1"},maskForSearch:{type:String,default:()=>null},searchShow:{type:Boolean,default:()=>!0},basemap:{type:Array},pointZoom:{type:String,default:()=>"12"},legend:{type:Boolean,default:()=>!0},defaultColor:{type:String,default:()=>"blue"},polygonOpacity:{type:Number,default:()=>null},history:{type:Boolean,default:!0}},mixins:[layerMixin],components:{MapPortal,NoData,FilterIcon,VisibleMapIcon,HiddenMapIcon,CloseIcon,VsPartsmapSearch:_sfc_main$3,IconTable,IconMap},data(){return{filters:"",search:"",limit:20,polyline:null,filtersParam:"",isSelectObj:!1,selectedId:"",searchRegion:"",searchAddress:"",map:null,selectedBaseLayer:"",marker:null,selectedRow:null,activeFilters:"",isMapVisible:!0,tabsIsVisible:!1,filterUrl:"",currentPage:1,isFilterVisible:!1,tableData:null,map:null,legendName:null,total:null,filtered:null,activeFiltersCount:"",regionSelectValue:null,addressSelectValue:null,currentBbox:null,mountedFilter:{},isCompareOpen:!1,windowWidth:0,handleDebouncedUpdateValue:debounce(m=>{this.handleSearchValue(m)},300)}},provide(){return{prefix:this.prefix}},watch:{map(){this.map.on("click",this.handleMapClick),this.$emit("update:map",this.map)},activeFiltersCount(){var m,b;return(b=(m=this.$refs)==null?void 0:m.filter)==null?void 0:b.filteredActiveFiltersLength},activeFilters(){var m,b;return(b=(m=this.$refs)==null?void 0:m.filter)==null?void 0:b.activeFilters}},created(){this.tableData=this.rows,this.total=this.initTotal,this.id&&(this.selectedRow=this.rows[0],this.selectedId=this.id,this.isSelectObj=!0)},mounted(){this.windowWidth=window.innerWidth,this.rows||this.getData();const b=new URLSearchParams(window.location.search).get("filter"),P=b==null?void 0:b.split("|");P==null||P.forEach(B=>{const[X,T]=B.split("=");T!=null&&T.includes(",")?this.mountedFilter[X]=T==null?void 0:T.split(","):this.mountedFilter[X]=T,this.activeFilters=this.mountedFilter});const C=new URLSearchParams(window.location.search);this.currentPage=C.get("page")||1,this.getFilter(),addEventListener("resize",this.changeWidth)},updated(){this.checkFilterLength()},methods:{async getData(){try{const m={search:this.search||null,limit:this.limit,page:this.currentPage,polyline:this.polyline};m.filter=this.filtersParam;const{data:b}=await axios.get(`${this.prefix}/data/${this.table}`,{params:m});this.tableData=b==null?void 0:b.rows,this.total=b.filtered,this.filtered=b.filtered}catch(m){console.error(m.message)}},moveToDefaultPage(){var b;new URLSearchParams(window.location.search).delete("id"),(b=this.map)==null||b.fitBounds(this.maxBounds,{duration:0}),this.history&&window.history.pushState({},"",newUrl),this.isSelectObj=!1},regionFullName(m){return m.region?`${m.text} / ${m.region}`:m.text},getLabelById(m){var P;const b=(P=this.filters)==null?void 0:P.find(C=>C.id===m);return b?b.label:m},getOptionsLabelById(id,option){var m;const filter=(m=this.filters)==null?void 0:m.find(b=>b.id===id);if(filter!=null&&filter.formatter){const func=eval(filter==null?void 0:filter.formatter);return func(option)}return Array.isArray(option)?filter!=null&&filter.options?filter==null?void 0:filter.options.filter(b=>option.includes(b.id)).map(b=>b.text).join(", "):option==null?void 0:option.length:option},async clearFilter(m){var b,P,C;await((P=(b=this.$refs)==null?void 0:b.filter)==null?void 0:P.clearFilter(m)),this.filterUrl=(C=this.$refs)==null?void 0:C.filter.filterUrl,(m==="region_katottg"||m==="katottg")&&this.$emit("update:filterState",{}),await this.updateTableAndMap(),await this.getData()},handlePageChange(m){this.currentPage=m;const b=new URL(window.location.href),P=new URLSearchParams(window.location.search);P.set("page",m),b.search=decodeURI(P.toString()),window.history.pushState({},"",b),this.getData()},async getFilter(){var m;try{const{data:b}=await axios.get(`${this.prefix}/filter/${this.table}`);this.filters=(m=b==null?void 0:b.list)==null?void 0:m.map(P=>({...P,label:(P==null?void 0:P.label)||(P==null?void 0:P.ua),id:(P==null?void 0:P.id)||(P==null?void 0:P.name)}))}catch(b){console.error(b.message)}},async handleSearchValue(m){this.search=m,await this.getData()},closeObjCard(){var C;const m=new URLSearchParams(window.location.search);m.delete("id"),this.deletePulsePoint();const P=`${window.location.pathname}?${m.toString()}`;(this.currentBbox||this.center)&&((C=this.map)==null||C.fitBounds(this.currentBbox||[this.center,this.center],{maxZoom:this.zoom,duration:0})),window.history.pushState({},"",P),this.isSelectObj=!1,this.selectedRow=null,this.getData()},handleFilterChange(m){this.$emit("update:filterState",m),this.currentPage=m.state.page||1,this.filterUrl=m.url==="no-url"?null:m.url.split("|").filter(b=>!b.includes("page=")).join("|")},async updateTableAndMap(){var m,b;this.selectedRow||(this.filtersParam=this.filterUrl,this.activeFilters=(b=(m=this.$refs)==null?void 0:m.filter)==null?void 0:b.activeFilters,this.isFilterVisible=!1,this.getData())},toggleMapVisible(){this.isMapVisible=!this.isMapVisible},checkUrl(m=!0){const b=new URLSearchParams(window.location.search);b.has("id")?(this.isSelectObj=!0,this.isMapVisible=m,this.selectedId=b.get("id")):(this.isSelectObj=!1,this.selectedId="")},changeLimit(m){this.limit=m,this.currentPage=1,this.getData()},resetFilters(){this.$refs.filter&&(this.$refs.filter.clearAll(),this.search="",this.filtersParam="",this.polyline=null,this.regionSelectValue=null,this.addressSelectValue=null,this.currentBbox=null,this.activeFilters=null,this.tabsIsVisible=!1)},checkFilterLength(){var b,P;const m=(P=(b=this.$refs)==null?void 0:b.filter)==null?void 0:P.filteredActiveFiltersLength;m!==this.previousLength&&(this.previousLength=m,this.activeFiltersCount=m)},async handleMapClick(m){var X,T,c,fe,_e,ye,ae,oe,at,Ve;const b=this.map.queryRenderedFeatures(m.point);if((b==null?void 0:b.length)<1||((X=b[0])==null?void 0:X.source)==="region-search-id"||((T=b[0])==null?void 0:T.source)==="route-line")return;const P=window.location.pathname,C=new URLSearchParams(window.location.search);C.set("id",`${(c=b[0])==null?void 0:c.properties.id}`),this.getObjectData((_e=(fe=b[0])==null?void 0:fe.properties)==null?void 0:_e.id);const B=`${P}?${C.toString()}`;this.history&&window.history.pushState({},"",B),this.isSelectObj=!0,m.lngLat&&((Ve=this.map)==null||Ve.fitBounds([[(ye=m.lngLat)==null?void 0:ye.lng,(ae=m.lngLat)==null?void 0:ae.lat],[(oe=m.lngLat)==null?void 0:oe.lng,(at=m.lngLat)==null?void 0:at.lat]],{padding:30,duration:0})),this.checkUrl()},async getObjectData(m){var b,P;try{const{data:C}=await axios.get(`${this.prefix}/data/${this.table}/${m}`);this.selectRow((b=C==null?void 0:C.rows)==null?void 0:b[0]),((P=C==null?void 0:C.rows)==null?void 0:P.lenght)<1&&this.deletePulsePoint()}catch(C){console.error(C.message)}},async selectRow(m,b=!0){var c;this.isMapVisible=b;const C=await(await fetch(`${this.prefix}/data/${this.table}/${m.id}`)).json();this.selectedRow=((c=C==null?void 0:C.rows)==null?void 0:c[0])||m;const B=window.location.pathname,X=new URLSearchParams(window.location.search);X.set("id",`${m.id}`);const T=`${B}?${X.toString()}`;this.history&&window.history.pushState({},"",T),this.checkUrl(b),this.isSelectObj=!0},deletePulsePoint(){this.marker&&this.marker.remove()},addPulsePoint(m){this.deletePulsePoint();const b=document.createElement("div");b.className="gps-marker",b.style.width="10px",b.style.height="10px",b.style.position="relative";const P=document.createElement("div");P.className="gps-wave",b.appendChild(P),this.marker=new maplibregl.Marker({element:b,anchor:"center"}).setLngLat(m).addTo(this.map)}}}),_hoisted_1={class:"pt-[20px]"},_hoisted_2={key:0,class:"w-full gap-5 flex justify-between mb-[6px] pr-3"},_hoisted_3={class:"flex items-center gap-2 max-h-[38px] pt-[4px]"},_hoisted_4={class:"custom-filter-list"},_hoisted_5={key:0,class:"font-medium text-[10px] min-w-[16px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full"},_hoisted_6={class:"flex items-center"},_hoisted_7=["title"],_hoisted_8=vue.createElementVNode("span",{class:"sr-only"},"Відкрити мапу",-1),_hoisted_9={class:"max-[1000px]:flex gap-2 min-[1001px]:hidden"},_hoisted_10={class:"flex"},_hoisted_11={key:0,class:"py-[15px] pb-[24px] pl-2"},_hoisted_12={class:"font-bold text-2xl mr-[10px]"},_hoisted_13={class:"text-sm text-stone-500 font-medium"},_hoisted_14=vue.createElementVNode("span",{class:"text-sm text-stone-500 font-medium"}," об'єктів",-1),_hoisted_15={class:"wrapperTable flex flex-col",style:{height:"calc(100vh - 302px)"}},_hoisted_16={key:0,class:"flex gap-x-2 flex-wrap"},_hoisted_17={class:"font-medium"},_hoisted_18=vue.createElementVNode("span",{class:"h-3 mx-2 border-s border-gray-200"},null,-1),_hoisted_19={class:"text-gray-500"},_hoisted_20=["onClick"],_hoisted_21={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"},_hoisted_22=vue.createElementVNode("span",{class:"font-medium"}," Очистити ",-1),_hoisted_23={key:2,class:"text-center py-28"},_hoisted_24=vue.createElementVNode("h2",{class:"font-medium text-base text-gray-500 rounded-xl"}," За вашим запитом даних не знайдено! ",-1),_hoisted_25=vue.createElementVNode("p",{class:"font-normal text-sm text-gray-500 rounded-xl"}," Введіть, будь ласка, інші значення для пошуку. ",-1),_hoisted_26={key:1},_hoisted_27={key:2,class:"my-5 pr-2"},_hoisted_28={class:"flex justify-between"},_hoisted_29={class:"w-full lg:w-1/2 relative"},_hoisted_30={class:"map-section relative"};function _sfc_render(m,b,P,C,B,X){var ut,kt,Ze,Ct,xt;const T=vue.resolveComponent("VsPartsmapSearch"),c=vue.resolveComponent("FilterIcon"),fe=vue.resolveComponent("VsFilterList"),_e=vue.resolveComponent("VisibleMapIcon"),ye=vue.resolveComponent("HiddenMapIcon"),ae=vue.resolveComponent("IconTable"),oe=vue.resolveComponent("IconMap"),at=vue.resolveComponent("CloseIcon"),Ve=vue.resolveComponent("NoData"),Xe=vue.resolveComponent("VsPagination"),Fe=vue.resolveComponent("MapPortal");return vue.openBlock(),vue.createElementBlock("section",_hoisted_1,[vue.renderSlot(m.$slots,"header",{title:m.title,total:m.total,selectedRow:m.selectedRow}),vue.createElementVNode("div",null,[vue.renderSlot(m.$slots,"filters",{selectedRow:m.selectedRow}),(ut=m.$slots)!=null&&ut.filters?vue.createCommentVNode("",!0):(vue.openBlock(),vue.createElementBlock("div",_hoisted_2,[vue.createElementVNode("div",_hoisted_3,[vue.createVNode(T,{"model-value":m.search,"onUpdate:modelValue":m.handleDebouncedUpdateValue,maskForSearch:m.maskForSearch,searchShow:m.searchShow},null,8,["model-value","onUpdate:modelValue","maskForSearch","searchShow"]),vue.createElementVNode("div",_hoisted_4,[m.filters?(vue.openBlock(),vue.createBlock(fe,{key:0,ref:"filter",modelValue:m.mountedFilter,"onUpdate:modelValue":b[0]||(b[0]=et=>m.mountedFilter=et),scheme:parseInt(m.windowWidth)>=1e3?m.filters:(kt=m.filters)==null?void 0:kt.map(et=>({...et,inline:!1})),isDialog:(Ze=m.filters)==null?void 0:Ze.some(et=>!(et!=null&&et.inline)),"apply-vue-router":m.applyVueRouter,history:"",view:"plain",clearable:!1,name:"filter",onFilterChange:b[1]||(b[1]=async et=>{await m.handleFilterChange(et),await m.updateTableAndMap()})},{button:vue.withCtx(({visible:et})=>[vue.createElementVNode("button",{type:"button",class:vue.normalizeClass(["py-2 px-2.5 h-[40px] inline-flex items-center gap-x-1.5 text-sm font-medium rounded-lg bg-white text-gray-800 hover:bg-gray-50 focus:outline-none focus:bg-gray-50",[et?"border border-blue-600 border-2":"border border-gray-200"]])},[vue.createVNode(c),vue.createTextVNode(" Фільтри "),m.activeFiltersCount>=1?(vue.openBlock(),vue.createElementBlock("span",_hoisted_5,vue.toDisplayString(m.activeFiltersCount),1)):vue.createCommentVNode("",!0)],2)]),_:1},8,["modelValue","scheme","isDialog","apply-vue-router"])):vue.createCommentVNode("",!0)])]),vue.createElementVNode("div",_hoisted_6,[vue.renderSlot(m.$slots,"buttons"),vue.createElementVNode("button",{type:"button",class:"py-2 px-2 hidden min-[1001px]: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:m.isMapVisible?"Приховати карту":"Показати карту",onClick:b[2]||(b[2]=(...et)=>m.toggleMapVisible&&m.toggleMapVisible(...et))},[m.isMapVisible?(vue.openBlock(),vue.createBlock(_e,{key:0})):(vue.openBlock(),vue.createBlock(ye,{key:1})),_hoisted_8],8,_hoisted_7),vue.createElementVNode("div",_hoisted_9,[vue.createElementVNode("button",{onClick:b[3]||(b[3]=et=>m.isMapVisible=!1),class:"py-2 px-2 h-[38px] 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"},[vue.createVNode(ae)]),vue.createElementVNode("button",{onClick:b[4]||(b[4]=et=>m.isMapVisible=!0),class:"py-2 px-2 h-[38px] 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"},[vue.createVNode(oe)])])])])),vue.createElementVNode("div",_hoisted_10,[vue.withDirectives(vue.createElementVNode("div",{class:vue.normalizeClass(["relative overflow-hidden",m.isMapVisible?"w-2/4 mr-0":"w-full mr-3",m.isSelectObj?"hidden":""])},[(Ct=m.$slots)!=null&&Ct.header?vue.createCommentVNode("",!0):(vue.openBlock(),vue.createElementBlock("h1",_hoisted_11,[vue.createElementVNode("span",_hoisted_12,vue.toDisplayString(m.title),1),vue.createElementVNode("span",_hoisted_13,vue.toDisplayString(m.total),1),_hoisted_14])),vue.createElementVNode("div",_hoisted_15,[m.activeFilters?(vue.openBlock(),vue.createElementBlock("div",_hoisted_16,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(m.activeFilters,(et,Tt,nr)=>(vue.openBlock(),vue.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:nr},[vue.createElementVNode("span",_hoisted_17,vue.toDisplayString(m.getLabelById(Tt)),1),_hoisted_18,vue.createElementVNode("span",_hoisted_19,vue.toDisplayString(m.getOptionsLabelById(Tt,et)),1),vue.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:si=>m.clearFilter(Tt)},[vue.createVNode(at)],8,_hoisted_20)]))),128)),((xt=Object.keys(m.activeFilters))==null?void 0:xt.length)>=2?(vue.openBlock(),vue.createElementBlock("span",_hoisted_21,[_hoisted_22,vue.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:b[5]||(b[5]=et=>m.mountedFilter={})},[vue.createVNode(at)])])):vue.createCommentVNode("",!0)])):vue.createCommentVNode("",!0),m.total>=1?vue.renderSlot(m.$slots,"table",{key:1,rows:m.tableData,map:m.map,marker:m.marker,selectRow:m.selectRow,getData:m.getData,addGeomMarker:m.addGeomMarker,isMapVisible:m.isMapVisible}):(vue.openBlock(),vue.createElementBlock("div",_hoisted_23,[vue.createVNode(Ve),_hoisted_24,_hoisted_25,vue.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:b[6]||(b[6]=(...et)=>m.resetFilters&&m.resetFilters(...et))}," Очистити дані пошуку ")]))]),m.total>=1?(vue.openBlock(),vue.createElementBlock("hr",_hoisted_26)):vue.createCommentVNode("",!0),m.total>=1?(vue.openBlock(),vue.createElementBlock("div",_hoisted_27,[vue.createElementVNode("div",_hoisted_28,[vue.createVNode(Xe,{total:m.total,maxPages:7,defaultPage:m.currentPage,pageSize:m.limit,goTo:!1,size:"medium",onPageChange:m.handlePageChange,backgroundColor:"#e5e7eb",borderedCellSelected:!0,pageSizes:[10,20,30],onPageSizeChange:m.changeLimit},null,8,["total","defaultPage","pageSize","onPageChange","onPageSizeChange"])])])):vue.createCommentVNode("",!0)],2),[[vue.vShow,parseInt(m.windowWidth)>=1e3?!0:!m.isMapVisible]]),m.isSelectObj?(vue.openBlock(),vue.createElementBlock("div",{key:0,class:vue.normalizeClass(m.isMapVisible?"w-full fixed lg:static lg:w-1/2 mr-0 pb-5":"w-full pb-5 mr-3"),style:{height:"calc(100vh - 152px)"}},[vue.renderSlot(m.$slots,"details",{table:m.table,selectedId:m.selectedId,selectedRow:m.selectedRow,map:m.map,closeObjCard:m.closeObjCard,isMapVisible:m.isMapVisible})],2)):vue.createCommentVNode("",!0),vue.withDirectives(vue.createElementVNode("div",_hoisted_29,[vue.createElementVNode("section",_hoisted_30,[vue.renderSlot(m.$slots,"default",{map:m.map,removeSelectedBaseLayer:()=>m.selectedBaseLayer="",selectedBaseLayer:m.selectedBaseLayer,selectedRow:m.selectedRow}),vue.createVNode(Fe,{height:"calc(100vh - 152px)",width:"w-2/4",table:m.table,filtersParam:m.filtersParam,row:m.selectedRow,legendname:m.legendname,legend:m.legend,colorAttr:m.colorAttr,strokeAttr:m.strokeAttr,polygonOpacity:m.polygonOpacity,maxBounds:m.maxBounds,center:m.center,zoom:m.zoom,dashedLine:m.dashedLine,minZoom:m.minZoom,basemap:m.basemap,pointZoom:m.pointZoom,defaultColor:m.defaultColor,onMap:b[7]||(b[7]=et=>m.map=et),selectedBaseLayer:m.selectedBaseLayer,"onUpdate:selectedBaseLayer":b[8]||(b[8]=et=>m.selectedBaseLayer=et),onIsCompareOpen:b[9]||(b[9]=et=>m.isCompareOpen=et)},{default:vue.withCtx(({hoverData:et})=>[vue.renderSlot(m.$slots,"popup",{data:et})]),_:3},8,["table","filtersParam","row","legendname","legend","colorAttr","strokeAttr","polygonOpacity","maxBounds","center","zoom","dashedLine","minZoom","basemap","pointZoom","defaultColor","selectedBaseLayer"])])],512),[[vue.vShow,m.isMapVisible]])])])])}const VsPartsMap=_export_sfc(_sfc_main,[["render",_sfc_render]]),install=m=>{m.component("VsPartsMap",VsPartsMap)},PartsMap={install,components:{VsPartsMap}};return typeof window<"u"&&(window.PartsMap=PartsMap),PartsMap});
|