Ora-Ka — cinq agrégateurs Ka, une barre de recherche hybride (exact + sémantique)
Python 80%
TypeScript 12.9%
CSS 6.8%
1import{g as qp,c as Zp}from"./index-DKrZ0X1u.js";var Kh={exports:{}};/**2 * MapLibre GL JS3 * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.7.1/LICENSE.txt4 */(function(yt,Kt){(function(Nt,Bt){yt.exports=Bt()})(Zp,function(){var Nt={},Bt={};function rt(L,p,Ri){if(Bt[L]=Ri,L==="index"){var Qi="var sharedModule = {}; ("+Bt.shared+")(sharedModule); ("+Bt.worker+")(sharedModule);",Jt={};return Bt.shared(Jt),Bt.index(Nt,Jt),typeof window<"u"&&Nt.setWorkerUrl(window.URL.createObjectURL(new Blob([Qi],{type:"text/javascript"}))),Nt}}rt("shared",["exports"],function(L){function p(i,t,r,n){return new(r||(r=Promise))(function(l,h){function d(x){try{g(n.next(x))}catch(v){h(v)}}function f(x){try{g(n.throw(x))}catch(v){h(v)}}function g(x){var v;x.done?l(x.value):(v=x.value,v instanceof r?v:new r(function(w){w(v)})).then(d,f)}g((n=n.apply(i,t||[])).next())})}function Ri(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}typeof SuppressedError=="function"&&SuppressedError;var Qi=Jt;function Jt(i,t){this.x=i,this.y=t}Jt.prototype={clone:function(){return new Jt(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,t){return this.clone()._rotateAround(i,t)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var t=i.x-this.x,r=i.y-this.y;return t*t+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,t){return Math.atan2(this.x*t-this.y*i,this.x*i+this.y*t)},_matMult:function(i){var t=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=t,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var t=Math.cos(i),r=Math.sin(i),n=r*this.x+t*this.y;return this.x=t*this.x-r*this.y,this.y=n,this},_rotateAround:function(i,t){var r=Math.cos(i),n=Math.sin(i),l=t.y+n*(this.x-t.x)+r*(this.y-t.y);return this.x=t.x+r*(this.x-t.x)-n*(this.y-t.y),this.y=l,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Jt.convert=function(i){return i instanceof Jt?i:Array.isArray(i)?new Jt(i[0],i[1]):i};var me=Ri(Qi),ne=Ur;function Ur(i,t,r,n){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(n-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=t,this.p2x=r,this.p2y=n}Ur.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,t){if(t===void 0&&(t=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,n=0;n<8;n++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)<t)return r;var h=this.sampleCurveDerivativeX(r);if(Math.abs(h)<1e-6)break;r-=l/h}var d=0,f=1;for(r=i,n=0;n<20&&(l=this.sampleCurveX(r),!(Math.abs(l-i)<t));n++)i>l?d=r:f=r,r=.5*(f-d)+d;return r},solve:function(i,t){return this.sampleCurveY(this.solveCurveX(i,t))}};var Pr=Ri(ne);let er,Ar;function mr(){return er==null&&(er=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),er}function Js(){if(Ar==null&&(Ar=!1,mr())){const t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let n=0;n<5*5;n++){const l=4*n;t.fillStyle=`rgb(${l},${l+1},${l+2})`,t.fillRect(n%5,Math.floor(n/5),1,1)}const r=t.getImageData(0,0,5,5).data;for(let n=0;n<5*5*4;n++)if(n%4!=3&&r[n]!==n){Ar=!0;break}}}return Ar||!1}function mi(i,t,r,n){const l=new Pr(i,t,r,n);return h=>l.solve(h)}const ka=mi(.25,.1,.25,1);function Bi(i,t,r){return Math.min(r,Math.max(t,i))}function tr(i,t,r){const n=r-t,l=((i-t)%n+n)%n+t;return l===t?r:l}function Ii(i,...t){for(const r of t)for(const n in r)i[n]=r[n];return i}let Dn=1;function ir(i,t,r){const n={};for(const l in i)n[l]=t.call(this,i[l],l,i);return n}function Ys(i,t,r){const n={};for(const l in i)t.call(this,i[l],l,i)&&(n[l]=i[l]);return n}function at(i){return Array.isArray(i)?i.map(at):typeof i=="object"&&i?ir(i,at):i}const Ln={};function jt(i){Ln[i]||(typeof console<"u"&&console.warn(i),Ln[i]=!0)}function Yt(i,t,r){return(r.y-i.y)*(t.x-i.x)>(t.y-i.y)*(r.x-i.x)}function gr(i){return typeof WorkerGlobalScope<"u"&&i!==void 0&&i instanceof WorkerGlobalScope}let hs=null;function rr(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const Rn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function $r(i,t,r,n,l){return p(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const h=new VideoFrame(i,{timestamp:0});try{const d=h==null?void 0:h.format;if(!d||!d.startsWith("BGR")&&!d.startsWith("RGB"))throw new Error(`Unrecognized format ${d}`);const f=d.startsWith("BGR"),g=new Uint8ClampedArray(n*l*4);if(yield h.copyTo(g,function(x,v,w,I,M){const C=4*Math.max(-v,0),k=(Math.max(0,w)-w)*I*4+C,F=4*I,j=Math.max(0,v),Q=Math.max(0,w);return{rect:{x:j,y:Q,width:Math.min(x.width,v+I)-j,height:Math.min(x.height,w+M)-Q},layout:[{offset:k,stride:F}]}}(i,t,r,n,l)),f)for(let x=0;x<g.length;x+=4){const v=g[x];g[x]=g[x+2],g[x+2]=v}return g}finally{h.close()}})}let _r,ni;const Fi="AbortError";function ds(){return new Error(Fi)}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 sr(i){return Mr.REGISTERED_PROTOCOLS[i.substring(0,i.indexOf("://"))]}const ps="global-dispatcher";class gi extends Error{constructor(t,r,n,l){super(`AJAXError: ${r} (${t}): ${n}`),this.status=t,this.statusText=r,this.url=n,this.body=l}}const Oi=()=>gr(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,qr=function(i,t){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){const n=sr(i.url);if(n)return n(i,t);if(gr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,targetMapId:ps},t)}if(!(/^file:/.test(r=i.url)||/^file:/.test(Oi())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(n,l){return p(this,void 0,void 0,function*(){const h=new Request(n.url,{method:n.method||"GET",body:n.body,credentials:n.credentials,headers:n.headers,cache:n.cache,referrer:Oi(),signal:l.signal});n.type!=="json"||h.headers.has("Accept")||h.headers.set("Accept","application/json");const d=yield fetch(h);if(!d.ok){const x=yield d.blob();throw new gi(d.status,d.statusText,n.url,x)}let f;f=n.type==="arrayBuffer"||n.type==="image"?d.arrayBuffer():n.type==="json"?d.json():d.text();const g=yield f;if(l.signal.aborted)throw ds();return{data:g,cacheControl:d.headers.get("Cache-Control"),expires:d.headers.get("Expires")}})}(i,t);if(gr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,mustQueue:!0,targetMapId:ps},t)}var r;return function(n,l){return new Promise((h,d)=>{var f;const g=new XMLHttpRequest;g.open(n.method||"GET",n.url,!0),n.type!=="arrayBuffer"&&n.type!=="image"||(g.responseType="arraybuffer");for(const x in n.headers)g.setRequestHeader(x,n.headers[x]);n.type==="json"&&(g.responseType="text",!((f=n.headers)===null||f===void 0)&&f.Accept||g.setRequestHeader("Accept","application/json")),g.withCredentials=n.credentials==="include",g.onerror=()=>{d(new Error(g.statusText))},g.onload=()=>{if(!l.signal.aborted)if((g.status>=200&&g.status<300||g.status===0)&&g.response!==null){let x=g.response;if(n.type==="json")try{x=JSON.parse(g.response)}catch(v){return void d(v)}h({data:x,cacheControl:g.getResponseHeader("Cache-Control"),expires:g.getResponseHeader("Expires")})}else{const x=new Blob([g.response],{type:g.getResponseHeader("Content-Type")});d(new gi(g.status,g.statusText,n.url,x))}},l.signal.addEventListener("abort",()=>{g.abort(),d(ds())}),g.send(n.body)})}(i,t)};function Zr(i){if(!i||i.indexOf("://")<=0||i.indexOf("data:image/")===0||i.indexOf("blob:")===0)return!0;const t=new URL(i),r=window.location;return t.protocol===r.protocol&&t.host===r.host}function Qs(i,t,r){r[i]&&r[i].indexOf(t)!==-1||(r[i]=r[i]||[],r[i].push(t))}function yr(i,t,r){if(r&&r[i]){const n=r[i].indexOf(t);n!==-1&&r[i].splice(n,1)}}class zr{constructor(t,r={}){Ii(this,r),this.type=t}}class Cr extends zr{constructor(t,r={}){super("error",Ii({error:t},r))}}class fs{on(t,r){return this._listeners=this._listeners||{},Qs(t,r,this._listeners),this}off(t,r){return yr(t,r,this._listeners),yr(t,r,this._oneTimeListeners),this}once(t,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},Qs(t,r,this._oneTimeListeners),this):new Promise(n=>this.once(t,n))}fire(t,r){typeof t=="string"&&(t=new zr(t,r||{}));const n=t.type;if(this.listens(n)){t.target=this;const l=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(const f of l)f.call(this,t);const h=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(const f of h)yr(n,f,this._oneTimeListeners),f.call(this,t);const d=this._eventedParent;d&&(Ii(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(t))}else t instanceof Cr&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,r){return this._eventedParent=t,this._eventedParentData=r,this}}var ie={$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 Gr=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function en(i,t){const r={};for(const n in i)n!=="ref"&&(r[n]=i[n]);return Gr.forEach(n=>{n in t&&(r[n]=t[n])}),r}function et(i,t){if(Array.isArray(i)){if(!Array.isArray(t)||i.length!==t.length)return!1;for(let r=0;r<i.length;r++)if(!et(i[r],t[r]))return!1;return!0}if(typeof i=="object"&&i!==null&&t!==null){if(typeof t!="object"||Object.keys(i).length!==Object.keys(t).length)return!1;for(const r in i)if(!et(i[r],t[r]))return!1;return!0}return i===t}function vt(i,t){i.push(t)}function tn(i,t,r){vt(r,{command:"addSource",args:[i,t[i]]})}function kr(i,t,r){vt(t,{command:"removeSource",args:[i]}),r[i]=!0}function xr(i,t,r,n){kr(i,r,n),tn(i,t,r)}function ms(i,t,r){let n;for(n in i[r])if(Object.prototype.hasOwnProperty.call(i[r],n)&&n!=="data"&&!et(i[r][n],t[r][n]))return!1;for(n in t[r])if(Object.prototype.hasOwnProperty.call(t[r],n)&&n!=="data"&&!et(i[r][n],t[r][n]))return!1;return!0}function Pi(i,t,r,n,l,h){i=i||{},t=t||{};for(const d in i)Object.prototype.hasOwnProperty.call(i,d)&&(et(i[d],t[d])||r.push({command:h,args:[n,d,t[d],l]}));for(const d in t)Object.prototype.hasOwnProperty.call(t,d)&&!Object.prototype.hasOwnProperty.call(i,d)&&(et(i[d],t[d])||r.push({command:h,args:[n,d,t[d],l]}))}function rn(i){return i.id}function sn(i,t){return i[t.id]=t,i}class he{constructor(t,r,n,l){this.message=(t?`${t}: `:"")+n,l&&(this.identifier=l),r!=null&&r.__line__&&(this.line=r.__line__)}}function nr(i,...t){for(const r of t)for(const n in r)i[n]=r[n];return i}class Qt extends Error{constructor(t,r){super(r),this.message=r,this.key=t}}class ar{constructor(t,r=[]){this.parent=t,this.bindings={};for(const[n,l]of r)this.bindings[n]=l}concat(t){return new ar(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const Er={kind:"null"},ge={kind:"number"},$e={kind:"string"},Be={kind:"boolean"},ai={kind:"color"},Vi={kind:"object"},Ne={kind:"value"},or={kind:"collator"},vr={kind:"formatted"},Dr={kind:"padding"},lr={kind:"resolvedImage"},N={kind:"variableAnchorOffsetCollection"};function A(i,t){return{kind:"array",itemType:i,N:t}}function P(i){if(i.kind==="array"){const t=P(i.itemType);return typeof i.N=="number"?`array<${t}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${t}>`}return i.kind}const E=[Er,ge,$e,Be,ai,vr,Vi,A(Ne),Dr,lr,N];function O(i,t){if(t.kind==="error")return null;if(i.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!O(i.itemType,t.itemType))&&(typeof i.N!="number"||i.N===t.N))return null}else{if(i.kind===t.kind)return null;if(i.kind==="value"){for(const r of E)if(!O(r,t))return null}}return`Expected ${P(i)} but found ${P(t)} instead.`}function H(i,t){return t.some(r=>r.kind===i.kind)}function W(i,t){return t.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}function Y(i,t){return i.kind==="array"&&t.kind==="array"?i.itemType.kind===t.itemType.kind&&typeof i.N=="number":i.kind===t.kind}const q=.96422,se=.82521,le=4/29,te=6/29,de=3*te*te,Ee=te*te*te,De=Math.PI/180,Ke=180/Math.PI;function je(i){return(i%=360)<0&&(i+=360),i}function Je([i,t,r,n]){let l,h;const d=Mt((.2225045*(i=Ge(i))+.7168786*(t=Ge(t))+.0606169*(r=Ge(r)))/1);i===t&&t===r?l=h=d:(l=Mt((.4360747*i+.3850649*t+.1430804*r)/q),h=Mt((.0139322*i+.0971045*t+.7141733*r)/se));const f=116*d-16;return[f<0?0:f,500*(l-d),200*(d-h),n]}function Ge(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Mt(i){return i>Ee?Math.pow(i,1/3):i/de+le}function bt([i,t,r,n]){let l=(i+16)/116,h=isNaN(t)?l:l+t/500,d=isNaN(r)?l:l-r/200;return l=1*st(l),h=q*st(h),d=se*st(d),[qe(3.1338561*h-1.6168667*l-.4906146*d),qe(-.9787684*h+1.9161415*l+.033454*d),qe(.0719453*h-.2289914*l+1.4052427*d),n]}function qe(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function st(i){return i>te?i*i*i:de*(i-le)}function xt(i){return parseInt(i.padEnd(2,i),16)/255}function Et(i,t){return Ft(t?i/100:i,0,1)}function Ft(i,t,r){return Math.min(Math.max(t,i),r)}function ei(i){return!i.some(Number.isNaN)}const gs={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class nt{constructor(t,r,n,l=1,h=!0){this.r=t,this.g=r,this.b=n,this.a=l,h||(this.r*=l,this.g*=l,this.b*=l,l||this.overwriteGetter("rgb",[t,r,n,l]))}static parse(t){if(t instanceof nt)return t;if(typeof t!="string")return;const r=function(n){if((n=n.toLowerCase().trim())==="transparent")return[0,0,0,0];const l=gs[n];if(l){const[d,f,g]=l;return[d/255,f/255,g/255,1]}if(n.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(n)){const d=n.length<6?1:2;let f=1;return[xt(n.slice(f,f+=d)),xt(n.slice(f,f+=d)),xt(n.slice(f,f+=d)),xt(n.slice(f,f+d)||"ff")]}if(n.startsWith("rgb")){const d=n.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){const[f,g,x,v,w,I,M,C,k,F,j,Q]=d,G=[v||" ",M||" ",F].join("");if(G===" "||G===" /"||G===",,"||G===",,,"){const J=[x,I,k].join(""),re=J==="%%%"?100:J===""?255:0;if(re){const ce=[Ft(+g/re,0,1),Ft(+w/re,0,1),Ft(+C/re,0,1),j?Et(+j,Q):1];if(ei(ce))return ce}}return}}const h=n.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(h){const[d,f,g,x,v,w,I,M,C]=h,k=[g||" ",v||" ",I].join("");if(k===" "||k===" /"||k===",,"||k===",,,"){const F=[+f,Ft(+x,0,100),Ft(+w,0,100),M?Et(+M,C):1];if(ei(F))return function([j,Q,G,J]){function re(ce){const we=(ce+j/30)%12,Le=Q*Math.min(G,1-G);return G-Le*Math.max(-1,Math.min(we-3,9-we,1))}return j=je(j),Q/=100,G/=100,[re(0),re(8),re(4),J]}(F)}}}(t);return r?new nt(...r,!1):void 0}get rgb(){const{r:t,g:r,b:n,a:l}=this,h=l||1/0;return this.overwriteGetter("rgb",[t/h,r/h,n/h,l])}get hcl(){return this.overwriteGetter("hcl",function(t){const[r,n,l,h]=Je(t),d=Math.sqrt(n*n+l*l);return[Math.round(1e4*d)?je(Math.atan2(l,n)*Ke):NaN,d,r,h]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Je(this.rgb))}overwriteGetter(t,r){return Object.defineProperty(this,t,{value:r}),r}toString(){const[t,r,n,l]=this.rgb;return`rgba(${[t,r,n].map(h=>Math.round(255*h)).join(",")},${l})`}}nt.black=new nt(0,0,0,1),nt.white=new nt(1,1,1,1),nt.transparent=new nt(0,0,0,0),nt.red=new nt(1,0,0,1);class Ea{constructor(t,r,n){this.sensitivity=t?r?"variant":"case":r?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,r){return this.collator.compare(t,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Da{constructor(t,r,n,l,h){this.text=t,this.image=r,this.scale=n,this.fontStack=l,this.textColor=h}}class _i{constructor(t){this.sections=t}static fromString(t){return new _i([new Da(t,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(t=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof _i?t:_i.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}}class yi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof yi)return t;if(typeof t=="number")return new yi([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const r of t)if(typeof r!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new yi(t)}}toString(){return JSON.stringify(this.values)}}const $l=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Ai{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Ai)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let r=0;r<t.length;r+=2){const n=t[r],l=t[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 Ai(t)}}toString(){return JSON.stringify(this.values)}}class xi{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new xi({name:t,available:!1}):null}}function _s(i,t,r,n){return typeof i=="number"&&i>=0&&i<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof r=="number"&&r>=0&&r<=255?n===void 0||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[i,t,r,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[i,t,r,n]:[i,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Hr(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof nt||i instanceof Ea||i instanceof _i||i instanceof yi||i instanceof Ai||i instanceof xi)return!0;if(Array.isArray(i)){for(const t of i)if(!Hr(t))return!1;return!0}if(typeof i=="object"){for(const t in i)if(!Hr(i[t]))return!1;return!0}return!1}function zt(i){if(i===null)return Er;if(typeof i=="string")return $e;if(typeof i=="boolean")return Be;if(typeof i=="number")return ge;if(i instanceof nt)return ai;if(i instanceof Ea)return or;if(i instanceof _i)return vr;if(i instanceof yi)return Dr;if(i instanceof Ai)return N;if(i instanceof xi)return lr;if(Array.isArray(i)){const t=i.length;let r;for(const n of i){const l=zt(n);if(r){if(r===l)continue;r=Ne;break}r=l}return A(r||Ne,t)}return Vi}function nn(i){const t=typeof i;return i===null?"":t==="string"||t==="number"||t==="boolean"?String(i):i instanceof nt||i instanceof _i||i instanceof yi||i instanceof Ai||i instanceof xi?i.toString():JSON.stringify(i)}class Ni{constructor(t,r){this.type=t,this.value=r}static parse(t,r){if(t.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Hr(t[1]))return r.error("invalid value");const n=t[1];let l=zt(n);const h=r.expectedType;return l.kind!=="array"||l.N!==0||!h||h.kind!=="array"||typeof h.N=="number"&&h.N!==0||(l=h),new Ni(l,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Pt{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const Bn={string:$e,number:ge,boolean:Be,object:Vi};class ji{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let n,l=1;const h=t[0];if(h==="array"){let f,g;if(t.length>2){const x=t[1];if(typeof x!="string"||!(x in Bn)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);f=Bn[x],l++}else f=Ne;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return r.error('The length argument to "array" must be a positive integer literal',2);g=t[2],l++}n=A(f,g)}else{if(!Bn[h])throw new Error(`Types doesn't contain name = ${h}`);n=Bn[h]}const d=[];for(;l<t.length;l++){const f=r.parse(t[l],l,Ne);if(!f)return null;d.push(f)}return new ji(n,d)}evaluate(t){for(let r=0;r<this.args.length;r++){const n=this.args[r].evaluate(t);if(!O(this.type,zt(n)))return n;if(r===this.args.length-1)throw new Pt(`Expected value to be of type ${P(this.type)}, but found ${P(zt(n))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const La={"to-boolean":Be,"to-color":ai,"to-number":ge,"to-string":$e};class Ui{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");const n=t[0];if(!La[n])throw new Error(`Can't parse ${n} as it is not part of the known types`);if((n==="to-boolean"||n==="to-string")&&t.length!==2)return r.error("Expected one argument.");const l=La[n],h=[];for(let d=1;d<t.length;d++){const f=r.parse(t[d],d,Ne);if(!f)return null;h.push(f)}return new Ui(l,h)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let r,n;for(const l of this.args){if(r=l.evaluate(t),n=null,r instanceof nt)return r;if(typeof r=="string"){const h=t.parseColor(r);if(h)return h}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.`:_s(r[0],r[1],r[2],r[3]),!n))return new nt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Pt(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(t);const l=yi.parse(r);if(l)return l}throw new Pt(`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(t);const l=Ai.parse(r);if(l)return l}throw new Pt(`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(t),r===null)return 0;const l=Number(r);if(!isNaN(l))return l}throw new Pt(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return _i.fromString(nn(this.args[0].evaluate(t)));case"resolvedImage":return xi.fromString(nn(this.args[0].evaluate(t)));default:return nn(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const ql=["Unknown","Point","LineString","Polygon"];class Fn{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"?ql[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let r=this._parseColorCache[t];return r||(r=this._parseColorCache[t]=nt.parse(t)),r}}class Xr{constructor(t,r,n=[],l,h=new ar,d=[]){this.registry=t,this.path=n,this.key=n.map(f=>`[${f}]`).join(""),this.scope=h,this.errors=d,this.expectedType=l,this._isConstant=r}parse(t,r,n,l,h={}){return r?this.concat(r,n,l)._parse(t,h):this._parse(t,h)}_parse(t,r){function n(l,h,d){return d==="assert"?new ji(h,[l]):d==="coerce"?new Ui(h,[l]):l}if(t!==null&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"||(t=["literal",t]),Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const l=t[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 h=this.registry[l];if(h){let d=h.parse(t,this);if(!d)return null;if(this.expectedType){const f=this.expectedType,g=d.type;if(f.kind!=="string"&&f.kind!=="number"&&f.kind!=="boolean"&&f.kind!=="object"&&f.kind!=="array"||g.kind!=="value")if(f.kind!=="color"&&f.kind!=="formatted"&&f.kind!=="resolvedImage"||g.kind!=="value"&&g.kind!=="string")if(f.kind!=="padding"||g.kind!=="value"&&g.kind!=="number"&&g.kind!=="array")if(f.kind!=="variableAnchorOffsetCollection"||g.kind!=="value"&&g.kind!=="array"){if(this.checkSubtype(f,g))return null}else d=n(d,f,r.typeAnnotation||"coerce");else d=n(d,f,r.typeAnnotation||"coerce");else d=n(d,f,r.typeAnnotation||"coerce");else d=n(d,f,r.typeAnnotation||"assert")}if(!(d instanceof Ni)&&d.type.kind!=="resolvedImage"&&this._isConstant(d)){const f=new Fn;try{d=new Ni(d.type,d.evaluate(f))}catch(g){return this.error(g.message),null}}return d}return this.error(`Unknown expression "${l}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(t===void 0?"'undefined' value invalid. Use null instead.":typeof t=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,r,n){const l=typeof t=="number"?this.path.concat(t):this.path,h=n?this.scope.concat(n):this.scope;return new Xr(this.registry,this._isConstant,l,r||null,h,this.errors)}error(t,...r){const n=`${this.key}${r.map(l=>`[${l}]`).join("")}`;this.errors.push(new Qt(n,t))}checkSubtype(t,r){const n=O(t,r);return n&&this.error(n),n}}class Lr{constructor(t,r){this.type=r.type,this.bindings=[].concat(t),this.result=r}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const r of this.bindings)t(r[1]);t(this.result)}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const n=[];for(let h=1;h<t.length-1;h+=2){const d=t[h];if(typeof d!="string")return r.error(`Expected string, but found ${typeof d} instead.`,h);if(/[^a-zA-Z0-9_]/.test(d))return r.error("Variable names must contain only alphanumeric characters or '_'.",h);const f=r.parse(t[h+1],h+1);if(!f)return null;n.push([d,f])}const l=r.parse(t[t.length-1],t.length-1,r.expectedType,n);return l?new Lr(n,l):null}outputDefined(){return this.result.outputDefined()}}class tt{constructor(t,r){this.type=r.type,this.name=t,this.boundExpression=r}static parse(t,r){if(t.length!==2||typeof t[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const n=t[1];return r.scope.has(n)?new tt(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(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class Ra{constructor(t,r,n){this.type=t,this.index=r,this.input=n}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const n=r.parse(t[1],1,ge),l=r.parse(t[2],2,A(r.expectedType||Ne));return n&&l?new Ra(l.type.itemType,n,l):null}evaluate(t){const r=this.index.evaluate(t),n=this.input.evaluate(t);if(r<0)throw new Pt(`Array index out of bounds: ${r} < 0.`);if(r>=n.length)throw new Pt(`Array index out of bounds: ${r} > ${n.length-1}.`);if(r!==Math.floor(r))throw new Pt(`Array index must be an integer, but found ${r} instead.`);return n[r]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class Ba{constructor(t,r){this.type=Be,this.needle=t,this.haystack=r}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const n=r.parse(t[1],1,Ne),l=r.parse(t[2],2,Ne);return n&&l?H(n.type,[Be,$e,ge,Er,Ne])?new Ba(n,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${P(n.type)} instead`):null}evaluate(t){const r=this.needle.evaluate(t),n=this.haystack.evaluate(t);if(!n)return!1;if(!W(r,["boolean","string","number","null"]))throw new Pt(`Expected first argument to be of type boolean, string, number or null, but found ${P(zt(r))} instead.`);if(!W(n,["string","array"]))throw new Pt(`Expected second argument to be of type array or string, but found ${P(zt(n))} instead.`);return n.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class ys{constructor(t,r,n){this.type=ge,this.needle=t,this.haystack=r,this.fromIndex=n}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const n=r.parse(t[1],1,Ne),l=r.parse(t[2],2,Ne);if(!n||!l)return null;if(!H(n.type,[Be,$e,ge,Er,Ne]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${P(n.type)} instead`);if(t.length===4){const h=r.parse(t[3],3,ge);return h?new ys(n,l,h):null}return new ys(n,l)}evaluate(t){const r=this.needle.evaluate(t),n=this.haystack.evaluate(t);if(!W(r,["boolean","string","number","null"]))throw new Pt(`Expected first argument to be of type boolean, string, number or null, but found ${P(zt(r))} instead.`);let l;if(this.fromIndex&&(l=this.fromIndex.evaluate(t)),W(n,["string"])){const h=n.indexOf(r,l);return h===-1?-1:[...n.slice(0,h)].length}if(W(n,["array"]))return n.indexOf(r,l);throw new Pt(`Expected second argument to be of type array or string, but found ${P(zt(n))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class Fa{constructor(t,r,n,l,h,d){this.inputType=t,this.type=r,this.input=n,this.cases=l,this.outputs=h,this.otherwise=d}static parse(t,r){if(t.length<5)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return r.error("Expected an even number of arguments.");let n,l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);const h={},d=[];for(let x=2;x<t.length-1;x+=2){let v=t[x];const w=t[x+1];Array.isArray(v)||(v=[v]);const I=r.concat(x);if(v.length===0)return I.error("Expected at least one branch label.");for(const C of v){if(typeof C!="number"&&typeof C!="string")return I.error("Branch labels must be numbers or strings.");if(typeof C=="number"&&Math.abs(C)>Number.MAX_SAFE_INTEGER)return I.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof C=="number"&&Math.floor(C)!==C)return I.error("Numeric branch labels must be integer values.");if(n){if(I.checkSubtype(n,zt(C)))return null}else n=zt(C);if(h[String(C)]!==void 0)return I.error("Branch labels must be unique.");h[String(C)]=d.length}const M=r.parse(w,x,l);if(!M)return null;l=l||M.type,d.push(M)}const f=r.parse(t[1],1,Ne);if(!f)return null;const g=r.parse(t[t.length-1],t.length-1,l);return g?f.type.kind!=="value"&&r.concat(1).checkSubtype(n,f.type)?null:new Fa(n,l,f,h,d,g):null}evaluate(t){const r=this.input.evaluate(t);return(zt(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}}class On{constructor(t,r,n){this.type=t,this.branches=r,this.otherwise=n}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return r.error("Expected an odd number of arguments.");let n;r.expectedType&&r.expectedType.kind!=="value"&&(n=r.expectedType);const l=[];for(let d=1;d<t.length-1;d+=2){const f=r.parse(t[d],d,Be);if(!f)return null;const g=r.parse(t[d+1],d+1,n);if(!g)return null;l.push([f,g]),n=n||g.type}const h=r.parse(t[t.length-1],t.length-1,n);if(!h)return null;if(!n)throw new Error("Can't infer output type");return new On(n,l,h)}evaluate(t){for(const[r,n]of this.branches)if(r.evaluate(t))return n.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[r,n]of this.branches)t(r),t(n);t(this.otherwise)}outputDefined(){return this.branches.every(([t,r])=>r.outputDefined())&&this.otherwise.outputDefined()}}class an{constructor(t,r,n,l){this.type=t,this.input=r,this.beginIndex=n,this.endIndex=l}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const n=r.parse(t[1],1,Ne),l=r.parse(t[2],2,ge);if(!n||!l)return null;if(!H(n.type,[A(Ne),$e,Ne]))return r.error(`Expected first argument to be of type array or string, but found ${P(n.type)} instead`);if(t.length===4){const h=r.parse(t[3],3,ge);return h?new an(n.type,n,l,h):null}return new an(n.type,n,l)}evaluate(t){const r=this.input.evaluate(t),n=this.beginIndex.evaluate(t);let l;if(this.endIndex&&(l=this.endIndex.evaluate(t)),W(r,["string"]))return[...r].slice(n,l).join("");if(W(r,["array"]))return r.slice(n,l);throw new Pt(`Expected first argument to be of type array or string, but found ${P(zt(r))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function Vn(i,t){const r=i.length-1;let n,l,h=0,d=r,f=0;for(;h<=d;)if(f=Math.floor((h+d)/2),n=i[f],l=i[f+1],n<=t){if(f===r||t<l)return f;h=f+1}else{if(!(n>t))throw new Pt("Input is not a number.");d=f-1}return 0}class xs{constructor(t,r,n){this.type=t,this.input=r,this.labels=[],this.outputs=[];for(const[l,h]of n)this.labels.push(l),this.outputs.push(h)}static parse(t,r){if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");const n=r.parse(t[1],1,ge);if(!n)return null;const l=[];let h=null;r.expectedType&&r.expectedType.kind!=="value"&&(h=r.expectedType);for(let d=1;d<t.length;d+=2){const f=d===1?-1/0:t[d],g=t[d+1],x=d,v=d+1;if(typeof f!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',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 w=r.parse(g,v,h);if(!w)return null;h=h||w.type,l.push([f,w])}return new xs(h,n,l)}evaluate(t){const r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(t);const l=this.input.evaluate(t);if(l<=r[0])return n[0].evaluate(t);const h=r.length;return l>=r[h-1]?n[h-1].evaluate(t):n[Vn(r,l)].evaluate(t)}eachChild(t){t(this.input);for(const r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function jo(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Zl=Uo;function Uo(i,t,r,n){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(n-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=t,this.p2x=r,this.p2y=n}Uo.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,t){if(t===void 0&&(t=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,n=0;n<8;n++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)<t)return r;var h=this.sampleCurveDerivativeX(r);if(Math.abs(h)<1e-6)break;r-=l/h}var d=0,f=1;for(r=i,n=0;n<20&&(l=this.sampleCurveX(r),!(Math.abs(l-i)<t));n++)i>l?d=r:f=r,r=.5*(f-d)+d;return r},solve:function(i,t){return this.sampleCurveY(this.solveCurveX(i,t))}};var Gl=jo(Zl);function Wr(i,t,r){return i+r*(t-i)}function on(i,t,r){return i.map((n,l)=>Wr(n,t[l],r))}const oi={number:Wr,color:function(i,t,r,n="rgb"){switch(n){case"rgb":{const[l,h,d,f]=on(i.rgb,t.rgb,r);return new nt(l,h,d,f,!1)}case"hcl":{const[l,h,d,f]=i.hcl,[g,x,v,w]=t.hcl;let I,M;if(isNaN(l)||isNaN(g))isNaN(l)?isNaN(g)?I=NaN:(I=g,d!==1&&d!==0||(M=x)):(I=l,v!==1&&v!==0||(M=h));else{let Q=g-l;g>l&&Q>180?Q-=360:g<l&&l-g>180&&(Q+=360),I=l+r*Q}const[C,k,F,j]=function([Q,G,J,re]){return Q=isNaN(Q)?0:Q*De,bt([J,Math.cos(Q)*G,Math.sin(Q)*G,re])}([I,M??Wr(h,x,r),Wr(d,v,r),Wr(f,w,r)]);return new nt(C,k,F,j,!1)}case"lab":{const[l,h,d,f]=bt(on(i.lab,t.lab,r));return new nt(l,h,d,f,!1)}}},array:on,padding:function(i,t,r){return new yi(on(i.values,t.values,r))},variableAnchorOffsetCollection:function(i,t,r){const n=i.values,l=t.values;if(n.length!==l.length)throw new Pt(`Cannot interpolate values of different length. from: ${i.toString()}, to: ${t.toString()}`);const h=[];for(let d=0;d<n.length;d+=2){if(n[d]!==l[d])throw new Pt(`Cannot interpolate values containing mismatched anchors. from[${d}]: ${n[d]}, to[${d}]: ${l[d]}`);h.push(n[d]);const[f,g]=n[d+1],[x,v]=l[d+1];h.push([Wr(f,x,r),Wr(g,v,r)])}return new Ai(h)}};class li{constructor(t,r,n,l,h){this.type=t,this.operator=r,this.interpolation=n,this.input=l,this.labels=[],this.outputs=[];for(const[d,f]of h)this.labels.push(d),this.outputs.push(f)}static interpolationFactor(t,r,n,l){let h=0;if(t.name==="exponential")h=Nn(r,t.base,n,l);else if(t.name==="linear")h=Nn(r,1,n,l);else if(t.name==="cubic-bezier"){const d=t.controlPoints;h=new Gl(d[0],d[1],d[2],d[3]).solve(Nn(r,1,n,l))}return h}static parse(t,r){let[n,l,h,...d]=t;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(v=>typeof v!="number"||v<0||v>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(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(h=r.parse(h,2,ge),!h)return null;const f=[];let g=null;n==="interpolate-hcl"||n==="interpolate-lab"?g=ai:r.expectedType&&r.expectedType.kind!=="value"&&(g=r.expectedType);for(let x=0;x<d.length;x+=2){const v=d[x],w=d[x+1],I=x+3,M=x+4;if(typeof v!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',I);if(f.length&&f[f.length-1][0]>=v)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',I);const C=r.parse(w,M,g);if(!C)return null;g=g||C.type,f.push([v,C])}return Y(g,ge)||Y(g,ai)||Y(g,Dr)||Y(g,N)||Y(g,A(ge))?new li(g,n,l,h,f):r.error(`Type ${P(g)} is not interpolatable.`)}evaluate(t){const r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(t);const l=this.input.evaluate(t);if(l<=r[0])return n[0].evaluate(t);const h=r.length;if(l>=r[h-1])return n[h-1].evaluate(t);const d=Vn(r,l),f=li.interpolationFactor(this.interpolation,l,r[d],r[d+1]),g=n[d].evaluate(t),x=n[d+1].evaluate(t);switch(this.operator){case"interpolate":return oi[this.type.kind](g,x,f);case"interpolate-hcl":return oi.color(g,x,f,"hcl");case"interpolate-lab":return oi.color(g,x,f,"lab")}}eachChild(t){t(this.input);for(const r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Nn(i,t,r,n){const l=n-r,h=i-r;return l===0?0:t===1?h/l:(Math.pow(t,h)-1)/(Math.pow(t,l)-1)}class jn{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expectected at least one argument.");let n=null;const l=r.expectedType;l&&l.kind!=="value"&&(n=l);const h=[];for(const f of t.slice(1)){const g=r.parse(f,1+h.length,n,void 0,{typeAnnotation:"omit"});if(!g)return null;n=n||g.type,h.push(g)}if(!n)throw new Error("No output type");const d=l&&h.some(f=>O(l,f.type));return new jn(d?Ne:n,h)}evaluate(t){let r,n=null,l=0;for(const h of this.args)if(l++,n=h.evaluate(t),n&&n instanceof xi&&!n.available&&(r||(r=n.name),n=null,l===this.args.length&&(n=r)),n!==null)break;return n}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function Un(i,t){return i==="=="||i==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function $o(i,t,r,n){return n.compare(t,r)===0}function vs(i,t,r){const n=i!=="=="&&i!=="!=";return class Jh{constructor(h,d,f){this.type=Be,this.lhs=h,this.rhs=d,this.collator=f,this.hasUntypedArgument=h.type.kind==="value"||d.type.kind==="value"}static parse(h,d){if(h.length!==3&&h.length!==4)return d.error("Expected two or three arguments.");const f=h[0];let g=d.parse(h[1],1,Ne);if(!g)return null;if(!Un(f,g.type))return d.concat(1).error(`"${f}" comparisons are not supported for type '${P(g.type)}'.`);let x=d.parse(h[2],2,Ne);if(!x)return null;if(!Un(f,x.type))return d.concat(2).error(`"${f}" comparisons are not supported for type '${P(x.type)}'.`);if(g.type.kind!==x.type.kind&&g.type.kind!=="value"&&x.type.kind!=="value")return d.error(`Cannot compare types '${P(g.type)}' and '${P(x.type)}'.`);n&&(g.type.kind==="value"&&x.type.kind!=="value"?g=new ji(x.type,[g]):g.type.kind!=="value"&&x.type.kind==="value"&&(x=new ji(g.type,[x])));let v=null;if(h.length===4){if(g.type.kind!=="string"&&x.type.kind!=="string"&&g.type.kind!=="value"&&x.type.kind!=="value")return d.error("Cannot use collator to compare non-string types.");if(v=d.parse(h[3],3,or),!v)return null}return new Jh(g,x,v)}evaluate(h){const d=this.lhs.evaluate(h),f=this.rhs.evaluate(h);if(n&&this.hasUntypedArgument){const g=zt(d),x=zt(f);if(g.kind!==x.kind||g.kind!=="string"&&g.kind!=="number")throw new Pt(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${g.kind}, ${x.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const g=zt(d),x=zt(f);if(g.kind!=="string"||x.kind!=="string")return t(h,d,f)}return this.collator?r(h,d,f,this.collator.evaluate(h)):t(h,d,f)}eachChild(h){h(this.lhs),h(this.rhs),this.collator&&h(this.collator)}outputDefined(){return!0}}}const Hl=vs("==",function(i,t,r){return t===r},$o),qo=vs("!=",function(i,t,r){return t!==r},function(i,t,r,n){return!$o(0,t,r,n)}),Zo=vs("<",function(i,t,r){return t<r},function(i,t,r,n){return n.compare(t,r)<0}),Xl=vs(">",function(i,t,r){return t>r},function(i,t,r,n){return n.compare(t,r)>0}),Wl=vs("<=",function(i,t,r){return t<=r},function(i,t,r,n){return n.compare(t,r)<=0}),Go=vs(">=",function(i,t,r){return t>=r},function(i,t,r,n){return n.compare(t,r)>=0});class ln{constructor(t,r,n){this.type=or,this.locale=n,this.caseSensitive=t,this.diacriticSensitive=r}static parse(t,r){if(t.length!==2)return r.error("Expected one argument.");const n=t[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,Be);if(!l)return null;const h=r.parse(n["diacritic-sensitive"]!==void 0&&n["diacritic-sensitive"],1,Be);if(!h)return null;let d=null;return n.locale&&(d=r.parse(n.locale,1,$e),!d)?null:new ln(l,h,d)}evaluate(t){return new Ea(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class Oa{constructor(t,r,n,l,h){this.type=$e,this.number=t,this.locale=r,this.currency=n,this.minFractionDigits=l,this.maxFractionDigits=h}static parse(t,r){if(t.length!==3)return r.error("Expected two arguments.");const n=r.parse(t[1],1,ge);if(!n)return null;const l=t[2];if(typeof l!="object"||Array.isArray(l))return r.error("NumberFormat options argument must be an object.");let h=null;if(l.locale&&(h=r.parse(l.locale,1,$e),!h))return null;let d=null;if(l.currency&&(d=r.parse(l.currency,1,$e),!d))return null;let f=null;if(l["min-fraction-digits"]&&(f=r.parse(l["min-fraction-digits"],1,ge),!f))return null;let g=null;return l["max-fraction-digits"]&&(g=r.parse(l["max-fraction-digits"],1,ge),!g)?null:new Oa(n,h,d,f,g)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class $n{constructor(t){this.type=vr,this.sections=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");const n=t[1];if(!Array.isArray(n)&&typeof n=="object")return r.error("First argument must be an image or text section.");const l=[];let h=!1;for(let d=1;d<=t.length-1;++d){const f=t[d];if(h&&typeof f=="object"&&!Array.isArray(f)){h=!1;let g=null;if(f["font-scale"]&&(g=r.parse(f["font-scale"],1,ge),!g))return null;let x=null;if(f["text-font"]&&(x=r.parse(f["text-font"],1,A($e)),!x))return null;let v=null;if(f["text-color"]&&(v=r.parse(f["text-color"],1,ai),!v))return null;const w=l[l.length-1];w.scale=g,w.font=x,w.textColor=v}else{const g=r.parse(t[d],1,Ne);if(!g)return null;const x=g.type.kind;if(x!=="string"&&x!=="value"&&x!=="null"&&x!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");h=!0,l.push({content:g,scale:null,font:null,textColor:null})}}return new $n(l)}evaluate(t){return new _i(this.sections.map(r=>{const n=r.content.evaluate(t);return zt(n)===lr?new Da("",n,null,null,null):new Da(nn(n),null,r.scale?r.scale.evaluate(t):null,r.font?r.font.evaluate(t).join(","):null,r.textColor?r.textColor.evaluate(t):null)}))}eachChild(t){for(const r of this.sections)t(r.content),r.scale&&t(r.scale),r.font&&t(r.font),r.textColor&&t(r.textColor)}outputDefined(){return!1}}class Va{constructor(t){this.type=lr,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected two arguments.");const n=r.parse(t[1],1,$e);return n?new Va(n):r.error("No image name provided.")}evaluate(t){const r=this.input.evaluate(t),n=xi.fromString(r);return n&&t.availableImages&&(n.available=t.availableImages.indexOf(r)>-1),n}eachChild(t){t(this.input)}outputDefined(){return!1}}class Na{constructor(t){this.type=ge,this.input=t}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);const n=r.parse(t[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 ${P(n.type)} instead.`):new Na(n):null}evaluate(t){const r=this.input.evaluate(t);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new Pt(`Expected value to be of type string or array, but found ${P(zt(r))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const cr=8192;function Kl(i,t){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,t.z);return[Math.round(r*l*cr),Math.round(n*l*cr)]}function ja(i,t){const r=Math.pow(2,t.z);return[(l=(i[0]/cr+t.x)/r,360*l-180),(n=(i[1]/cr+t.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*n)*Math.PI/180))-90)];var n,l}function Kr(i,t){i[0]=Math.min(i[0],t[0]),i[1]=Math.min(i[1],t[1]),i[2]=Math.max(i[2],t[0]),i[3]=Math.max(i[3],t[1])}function Rr(i,t){return!(i[0]<=t[0]||i[2]>=t[2]||i[1]<=t[1]||i[3]>=t[3])}function it(i,t,r){const n=i[0]-t[0],l=i[1]-t[1],h=i[0]-r[0],d=i[1]-r[1];return n*d-h*l==0&&n*h<=0&&l*d<=0}function qn(i,t,r,n){return(l=[n[0]-r[0],n[1]-r[1]])[0]*(h=[t[0]-i[0],t[1]-i[1]])[1]-l[1]*h[0]!=0&&!(!Xo(i,t,r,n)||!Xo(r,n,i,t));var l,h}function Jl(i,t,r){for(const n of r)for(let l=0;l<n.length-1;++l)if(qn(i,t,n[l],n[l+1]))return!0;return!1}function bs(i,t,r=!1){let n=!1;for(const f of t)for(let g=0;g<f.length-1;g++){if(it(i,f[g],f[g+1]))return r;(h=f[g])[1]>(l=i)[1]!=(d=f[g+1])[1]>l[1]&&l[0]<(d[0]-h[0])*(l[1]-h[1])/(d[1]-h[1])+h[0]&&(n=!n)}var l,h,d;return n}function Yl(i,t){for(const r of t)if(bs(i,r))return!0;return!1}function Ho(i,t){for(const r of i)if(!bs(r,t))return!1;for(let r=0;r<i.length-1;++r)if(Jl(i[r],i[r+1],t))return!1;return!0}function Ql(i,t){for(const r of t)if(Ho(i,r))return!0;return!1}function Xo(i,t,r,n){const l=n[0]-r[0],h=n[1]-r[1],d=(i[0]-r[0])*h-l*(i[1]-r[1]),f=(t[0]-r[0])*h-l*(t[1]-r[1]);return d>0&&f<0||d<0&&f>0}function Ua(i,t,r){const n=[];for(let l=0;l<i.length;l++){const h=[];for(let d=0;d<i[l].length;d++){const f=Kl(i[l][d],r);Kr(t,f),h.push(f)}n.push(h)}return n}function Wo(i,t,r){const n=[];for(let l=0;l<i.length;l++){const h=Ua(i[l],t,r);n.push(h)}return n}function Ko(i,t,r,n){if(i[0]<r[0]||i[0]>r[2]){const l=.5*n;let h=i[0]-r[0]>l?-n:r[0]-i[0]>l?n:0;h===0&&(h=i[0]-r[2]>l?-n:r[2]-i[0]>l?n:0),i[0]+=h}Kr(t,i)}function Jo(i,t,r,n){const l=Math.pow(2,n.z)*cr,h=[n.x*cr,n.y*cr],d=[];for(const f of i)for(const g of f){const x=[g.x+h[0],g.y+h[1]];Ko(x,t,r,l),d.push(x)}return d}function Yo(i,t,r,n){const l=Math.pow(2,n.z)*cr,h=[n.x*cr,n.y*cr],d=[];for(const g of i){const x=[];for(const v of g){const w=[v.x+h[0],v.y+h[1]];Kr(t,w),x.push(w)}d.push(x)}if(t[2]-t[0]<=l/2){(f=t)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const g of d)for(const x of g)Ko(x,t,r,l)}var f;return d}class Jr{constructor(t,r){this.type=Be,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Hr(t[1])){const n=t[1];if(n.type==="FeatureCollection"){const l=[];for(const h of n.features){const{type:d,coordinates:f}=h.geometry;d==="Polygon"&&l.push(f),d==="MultiPolygon"&&l.push(...f)}if(l.length)return new Jr(n,{type:"MultiPolygon",coordinates:l})}else if(n.type==="Feature"){const l=n.geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new Jr(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new Jr(n,n)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(r,n){const l=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(n.type==="Polygon"){const f=Ua(n.coordinates,h,d),g=Jo(r.geometry(),l,h,d);if(!Rr(l,h))return!1;for(const x of g)if(!bs(x,f))return!1}if(n.type==="MultiPolygon"){const f=Wo(n.coordinates,h,d),g=Jo(r.geometry(),l,h,d);if(!Rr(l,h))return!1;for(const x of g)if(!Yl(x,f))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,n){const l=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(n.type==="Polygon"){const f=Ua(n.coordinates,h,d),g=Yo(r.geometry(),l,h,d);if(!Rr(l,h))return!1;for(const x of g)if(!Ho(x,f))return!1}if(n.type==="MultiPolygon"){const f=Wo(n.coordinates,h,d),g=Yo(r.geometry(),l,h,d);if(!Rr(l,h))return!1;for(const x of g)if(!Ql(x,f))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Qo=class{constructor(i=[],t=(r,n)=>r<n?-1:r>n?1:0){if(this.data=i,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(i){this.data.push(i),this._up(this.length++)}pop(){if(this.length===0)return;const i=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),i}peek(){return this.data[0]}_up(i){const{data:t,compare:r}=this,n=t[i];for(;i>0;){const l=i-1>>1,h=t[l];if(r(n,h)>=0)break;t[i]=h,i=l}t[i]=n}_down(i){const{data:t,compare:r}=this,n=this.length>>1,l=t[i];for(;i<n;){let h=1+(i<<1);const d=h+1;if(d<this.length&&r(t[d],t[h])<0&&(h=d),r(t[h],l)>=0)break;t[i]=t[h],i=h}t[i]=l}};function ec(i,t,r,n,l){el(i,t,r,n||i.length-1,l||tc)}function el(i,t,r,n,l){for(;n>r;){if(n-r>600){var h=n-r+1,d=t-r+1,f=Math.log(h),g=.5*Math.exp(2*f/3),x=.5*Math.sqrt(f*g*(h-g)/h)*(d-h/2<0?-1:1);el(i,t,Math.max(r,Math.floor(t-d*g/h+x)),Math.min(n,Math.floor(t+(h-d)*g/h+x)),l)}var v=i[t],w=r,I=n;for(cn(i,r,t),l(i[n],v)>0&&cn(i,r,n);w<I;){for(cn(i,w,I),w++,I--;l(i[w],v)<0;)w++;for(;l(i[I],v)>0;)I--}l(i[r],v)===0?cn(i,r,I):cn(i,++I,n),I<=t&&(r=I+1),t<=I&&(n=I-1)}}function cn(i,t,r){var n=i[t];i[t]=i[r],i[r]=n}function tc(i,t){return i<t?-1:i>t?1:0}function Zn(i,t){if(i.length<=1)return[i];const r=[];let n,l;for(const h of i){const d=rc(h);d!==0&&(h.area=Math.abs(d),l===void 0&&(l=d<0),l===d<0?(n&&r.push(n),n=[h]):n.push(h))}if(n&&r.push(n),t>1)for(let h=0;h<r.length;h++)r[h].length<=t||(ec(r[h],t,1,r[h].length-1,ic),r[h]=r[h].slice(0,t));return r}function ic(i,t){return t.area-i.area}function rc(i){let t=0;for(let r,n,l=0,h=i.length,d=h-1;l<h;d=l++)r=i[l],n=i[d],t+=(n.x-r.x)*(r.y+n.y);return t}const tl=1/298.257223563,il=tl*(2-tl),rl=Math.PI/180;class $a{constructor(t){const r=6378.137*rl*1e3,n=Math.cos(t*rl),l=1/(1-il*(1-n*n)),h=Math.sqrt(l);this.kx=r*h*n,this.ky=r*h*l*(1-il)}distance(t,r){const n=this.wrap(t[0]-r[0])*this.kx,l=(t[1]-r[1])*this.ky;return Math.sqrt(n*n+l*l)}pointOnLine(t,r){let n,l,h,d,f=1/0;for(let g=0;g<t.length-1;g++){let x=t[g][0],v=t[g][1],w=this.wrap(t[g+1][0]-x)*this.kx,I=(t[g+1][1]-v)*this.ky,M=0;w===0&&I===0||(M=(this.wrap(r[0]-x)*this.kx*w+(r[1]-v)*this.ky*I)/(w*w+I*I),M>1?(x=t[g+1][0],v=t[g+1][1]):M>0&&(x+=w/this.kx*M,v+=I/this.ky*M)),w=this.wrap(r[0]-x)*this.kx,I=(r[1]-v)*this.ky;const C=w*w+I*I;C<f&&(f=C,n=x,l=v,h=g,d=M)}return{point:[n,l],index:h,t:Math.max(0,Math.min(1,d))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function sl(i,t){return t[0]-i[0]}function Gn(i){return i[1]-i[0]+1}function br(i,t){return i[1]>=i[0]&&i[1]<t}function qa(i,t){if(i[0]>i[1])return[null,null];const r=Gn(i);if(t){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 Za(i,t){if(!br(t,i.length))return[1/0,1/0,-1/0,-1/0];const r=[1/0,1/0,-1/0,-1/0];for(let n=t[0];n<=t[1];++n)Kr(r,i[n]);return r}function Ga(i){const t=[1/0,1/0,-1/0,-1/0];for(const r of i)for(const n of r)Kr(t,n);return t}function Hn(i){return i[0]!==-1/0&&i[1]!==-1/0&&i[2]!==1/0&&i[3]!==1/0}function Ha(i,t,r){if(!Hn(i)||!Hn(t))return NaN;let n=0,l=0;return i[2]<t[0]&&(n=t[0]-i[2]),i[0]>t[2]&&(n=i[0]-t[2]),i[1]>t[3]&&(l=i[1]-t[3]),i[3]<t[1]&&(l=t[1]-i[3]),r.distance([0,0],[n,l])}function Yr(i,t,r){const n=r.pointOnLine(t,i);return r.distance(i,n.point)}function Xa(i,t,r,n,l){const h=Math.min(Yr(i,[r,n],l),Yr(t,[r,n],l)),d=Math.min(Yr(r,[i,t],l),Yr(n,[i,t],l));return Math.min(h,d)}function sc(i,t,r,n,l){if(!br(t,i.length)||!br(n,r.length))return 1/0;let h=1/0;for(let d=t[0];d<t[1];++d){const f=i[d],g=i[d+1];for(let x=n[0];x<n[1];++x){const v=r[x],w=r[x+1];if(qn(f,g,v,w))return 0;h=Math.min(h,Xa(f,g,v,w,l))}}return h}function Tt(i,t,r,n,l){if(!br(t,i.length)||!br(n,r.length))return NaN;let h=1/0;for(let d=t[0];d<=t[1];++d)for(let f=n[0];f<=n[1];++f)if(h=Math.min(h,l.distance(i[d],r[f])),h===0)return h;return h}function nc(i,t,r){if(bs(i,t,!0))return 0;let n=1/0;for(const l of t){const h=l[0],d=l[l.length-1];if(h!==d&&(n=Math.min(n,Yr(i,[d,h],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 Ze(i,t,r,n){if(!br(t,i.length))return NaN;for(let h=t[0];h<=t[1];++h)if(bs(i[h],r,!0))return 0;let l=1/0;for(let h=t[0];h<t[1];++h){const d=i[h],f=i[h+1];for(const g of r)for(let x=0,v=g.length,w=v-1;x<v;w=x++){const I=g[w],M=g[x];if(qn(d,f,I,M))return 0;l=Math.min(l,Xa(d,f,I,M,n))}}return l}function Xn(i,t){for(const r of i)for(const n of r)if(bs(n,t,!0))return!0;return!1}function ht(i,t,r,n=1/0){const l=Ga(i),h=Ga(t);if(n!==1/0&&Ha(l,h,r)>=n)return n;if(Rr(l,h)){if(Xn(i,t))return 0}else if(Xn(t,i))return 0;let d=1/0;for(const f of i)for(let g=0,x=f.length,v=x-1;g<x;v=g++){const w=f[v],I=f[g];for(const M of t)for(let C=0,k=M.length,F=k-1;C<k;F=C++){const j=M[F],Q=M[C];if(qn(w,I,j,Q))return 0;d=Math.min(d,Xa(w,I,j,Q,r))}}return d}function ot(i,t,r,n,l,h){if(!h)return;const d=Ha(Za(n,h),l,r);d<t&&i.push([d,h,[0,0]])}function Qr(i,t,r,n,l,h,d){if(!h||!d)return;const f=Ha(Za(n,h),Za(l,d),r);f<t&&i.push([f,h,d])}function un(i,t,r,n,l=1/0){let h=Math.min(n.distance(i[0],r[0][0]),l);if(h===0)return h;const d=new Qo([[0,[0,i.length-1],[0,0]]],sl),f=Ga(r);for(;d.length>0;){const g=d.pop();if(g[0]>=h)continue;const x=g[1],v=t?50:100;if(Gn(x)<=v){if(!br(x,i.length))return NaN;if(t){const w=Ze(i,x,r,n);if(isNaN(w)||w===0)return w;h=Math.min(h,w)}else for(let w=x[0];w<=x[1];++w){const I=nc(i[w],r,n);if(h=Math.min(h,I),h===0)return 0}}else{const w=qa(x,t);ot(d,h,n,i,f,w[0]),ot(d,h,n,i,f,w[1])}}return h}function hn(i,t,r,n,l,h=1/0){let d=Math.min(h,l.distance(i[0],r[0]));if(d===0)return d;const f=new Qo([[0,[0,i.length-1],[0,r.length-1]]],sl);for(;f.length>0;){const g=f.pop();if(g[0]>=d)continue;const x=g[1],v=g[2],w=t?50:100,I=n?50:100;if(Gn(x)<=w&&Gn(v)<=I){if(!br(x,i.length)&&br(v,r.length))return NaN;let M;if(t&&n)M=sc(i,x,r,v,l),d=Math.min(d,M);else if(t&&!n){const C=i.slice(x[0],x[1]+1);for(let k=v[0];k<=v[1];++k)if(M=Yr(r[k],C,l),d=Math.min(d,M),d===0)return d}else if(!t&&n){const C=r.slice(v[0],v[1]+1);for(let k=x[0];k<=x[1];++k)if(M=Yr(i[k],C,l),d=Math.min(d,M),d===0)return d}else M=Tt(i,x,r,v,l),d=Math.min(d,M)}else{const M=qa(x,t),C=qa(v,n);Qr(f,d,l,i,r,M[0],C[0]),Qr(f,d,l,i,r,M[0],C[1]),Qr(f,d,l,i,r,M[1],C[0]),Qr(f,d,l,i,r,M[1],C[1])}}return d}function Wa(i){return i.type==="MultiPolygon"?i.coordinates.map(t=>({type:"Polygon",coordinates:t})):i.type==="MultiLineString"?i.coordinates.map(t=>({type:"LineString",coordinates:t})):i.type==="MultiPoint"?i.coordinates.map(t=>({type:"Point",coordinates:t})):[i]}class es{constructor(t,r){this.type=ge,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Hr(t[1])){const n=t[1];if(n.type==="FeatureCollection")return new es(n,n.features.map(l=>Wa(l.geometry)).flat());if(n.type==="Feature")return new es(n,Wa(n.geometry));if("type"in n&&"coordinates"in n)return new es(n,Wa(n))}return r.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(r,n){const l=r.geometry(),h=l.flat().map(g=>ja([g.x,g.y],r.canonical));if(l.length===0)return NaN;const d=new $a(h[0][1]);let f=1/0;for(const g of n){switch(g.type){case"Point":f=Math.min(f,hn(h,!1,[g.coordinates],!1,d,f));break;case"LineString":f=Math.min(f,hn(h,!1,g.coordinates,!0,d,f));break;case"Polygon":f=Math.min(f,un(h,!1,g.coordinates,d,f))}if(f===0)return f}return f}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,n){const l=r.geometry(),h=l.flat().map(g=>ja([g.x,g.y],r.canonical));if(l.length===0)return NaN;const d=new $a(h[0][1]);let f=1/0;for(const g of n){switch(g.type){case"Point":f=Math.min(f,hn(h,!0,[g.coordinates],!1,d,f));break;case"LineString":f=Math.min(f,hn(h,!0,g.coordinates,!0,d,f));break;case"Polygon":f=Math.min(f,un(h,!0,g.coordinates,d,f))}if(f===0)return f}return f}(t,this.geometries);if(t.geometryType()==="Polygon")return function(r,n){const l=r.geometry();if(l.length===0||l[0].length===0)return NaN;const h=Zn(l,0).map(g=>g.map(x=>x.map(v=>ja([v.x,v.y],r.canonical)))),d=new $a(h[0][0][0][1]);let f=1/0;for(const g of n)for(const x of h){switch(g.type){case"Point":f=Math.min(f,un([g.coordinates],!1,x,d,f));break;case"LineString":f=Math.min(f,un(g.coordinates,!0,x,d,f));break;case"Polygon":f=Math.min(f,ht(x,g.coordinates,d,f))}if(f===0)return f}return f}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const ws={"==":Hl,"!=":qo,">":Xl,"<":Zo,">=":Go,"<=":Wl,array:ji,at:Ra,boolean:ji,case:On,coalesce:jn,collator:ln,format:$n,image:Va,in:Ba,"index-of":ys,interpolate:li,"interpolate-hcl":li,"interpolate-lab":li,length:Na,let:Lr,literal:Ni,match:Fa,number:ji,"number-format":Oa,object:ji,slice:an,step:xs,string:ji,"to-boolean":Ui,"to-color":Ui,"to-number":Ui,"to-string":Ui,var:tt,within:Jr,distance:es};class Mi{constructor(t,r,n,l){this.name=t,this.type=r,this._evaluate=n,this.args=l}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,r){const n=t[0],l=Mi.definitions[n];if(!l)return r.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const h=Array.isArray(l)?l[0]:l.type,d=Array.isArray(l)?[[l[1],l[2]]]:l.overloads,f=d.filter(([x])=>!Array.isArray(x)||x.length===t.length-1);let g=null;for(const[x,v]of f){g=new Xr(r.registry,dn,r.path,null,r.scope);const w=[];let I=!1;for(let M=1;M<t.length;M++){const C=t[M],k=Array.isArray(x)?x[M-1]:x.type,F=g.parse(C,1+w.length,k);if(!F){I=!0;break}w.push(F)}if(!I)if(Array.isArray(x)&&x.length!==w.length)g.error(`Expected ${x.length} arguments, but found ${w.length} instead.`);else{for(let M=0;M<w.length;M++){const C=Array.isArray(x)?x[M]:x.type,k=w[M];g.concat(M+1).checkSubtype(C,k.type)}if(g.errors.length===0)return new Mi(n,h,v,w)}}if(f.length===1)r.errors.push(...g.errors);else{const x=(f.length?f:d).map(([w])=>{return I=w,Array.isArray(I)?`(${I.map(P).join(", ")})`:`(${P(I.type)}...)`;var I}).join(" | "),v=[];for(let w=1;w<t.length;w++){const I=r.parse(t[w],1+v.length);if(!I)return null;v.push(P(I.type))}r.error(`Expected arguments of type ${x}, but found (${v.join(", ")}) instead.`)}return null}static register(t,r){Mi.definitions=r;for(const n in r)t[n]=Mi}}function Ka(i,[t,r,n,l]){t=t.evaluate(i),r=r.evaluate(i),n=n.evaluate(i);const h=l?l.evaluate(i):1,d=_s(t,r,n,h);if(d)throw new Pt(d);return new nt(t/255,r/255,n/255,h,!1)}function Ja(i,t){return i in t}function Ya(i,t){const r=t[i];return r===void 0?null:r}function ts(i){return{type:i}}function dn(i){if(i instanceof tt)return dn(i.boundExpression);if(i instanceof Mi&&i.name==="error"||i instanceof ln||i instanceof Jr||i instanceof es)return!1;const t=i instanceof Ui||i instanceof ji;let r=!0;return i.eachChild(n=>{r=t?r&&dn(n):r&&n instanceof Ni}),!!r&&pn(i)&&fn(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function pn(i){if(i instanceof Mi&&(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 Jr||i instanceof es)return!1;let t=!0;return i.eachChild(r=>{t&&!pn(r)&&(t=!1)}),t}function Ts(i){if(i instanceof Mi&&i.name==="feature-state")return!1;let t=!0;return i.eachChild(r=>{t&&!Ts(r)&&(t=!1)}),t}function fn(i,t){if(i instanceof Mi&&t.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(n=>{r&&!fn(n,t)&&(r=!1)}),r}function Wn(i){return{result:"success",value:i}}function Ss(i){return{result:"error",value:i}}function Is(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function nl(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function Qa(i){return!!i.expression&&i.expression.interpolated}function Ye(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function Kn(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function ac(i){return i}function al(i,t){const r=t.type==="color",n=i.stops&&typeof i.stops[0][0]=="object",l=n||!(n||i.property!==void 0),h=i.type||(Qa(t)?"exponential":"interval");if(r||t.type==="padding"){const v=r?nt.parse:yi.parse;(i=nr({},i)).stops&&(i.stops=i.stops.map(w=>[w[0],v(w[1])])),i.default=v(i.default?i.default:t.default)}if(i.colorSpace&&(d=i.colorSpace)!=="rgb"&&d!=="hcl"&&d!=="lab")throw new Error(`Unknown color space: "${i.colorSpace}"`);var d;let f,g,x;if(h==="exponential")f=ll;else if(h==="interval")f=Jn;else if(h==="categorical"){f=ol,g=Object.create(null);for(const v of i.stops)g[v[0]]=v[1];x=typeof i.stops[0][0]}else{if(h!=="identity")throw new Error(`Unknown function type "${h}"`);f=cl}if(n){const v={},w=[];for(let C=0;C<i.stops.length;C++){const k=i.stops[C],F=k[0].zoom;v[F]===void 0&&(v[F]={zoom:F,type:i.type,property:i.property,default:i.default,stops:[]},w.push(F)),v[F].stops.push([k[0].value,k[1]])}const I=[];for(const C of w)I.push([v[C].zoom,al(v[C],t)]);const M={name:"linear"};return{kind:"composite",interpolationType:M,interpolationFactor:li.interpolationFactor.bind(void 0,M),zoomStops:I.map(C=>C[0]),evaluate:({zoom:C},k)=>ll({stops:I,base:i.base},t,C).evaluate(C,k)}}if(l){const v=h==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:v,interpolationFactor:li.interpolationFactor.bind(void 0,v),zoomStops:i.stops.map(w=>w[0]),evaluate:({zoom:w})=>f(i,t,w,g,x)}}return{kind:"source",evaluate(v,w){const I=w&&w.properties?w.properties[i.property]:void 0;return I===void 0?Ps(i.default,t.default):f(i,t,I,g,x)}}}function Ps(i,t,r){return i!==void 0?i:t!==void 0?t:r!==void 0?r:void 0}function ol(i,t,r,n,l){return Ps(typeof r===l?n[r]:void 0,i.default,t.default)}function Jn(i,t,r){if(Ye(r)!=="number")return Ps(i.default,t.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=Vn(i.stops.map(h=>h[0]),r);return i.stops[l][1]}function ll(i,t,r){const n=i.base!==void 0?i.base:1;if(Ye(r)!=="number")return Ps(i.default,t.default);const l=i.stops.length;if(l===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[l-1][0])return i.stops[l-1][1];const h=Vn(i.stops.map(v=>v[0]),r),d=function(v,w,I,M){const C=M-I,k=v-I;return C===0?0:w===1?k/C:(Math.pow(w,k)-1)/(Math.pow(w,C)-1)}(r,n,i.stops[h][0],i.stops[h+1][0]),f=i.stops[h][1],g=i.stops[h+1][1],x=oi[t.type]||ac;return typeof f.evaluate=="function"?{evaluate(...v){const w=f.evaluate.apply(void 0,v),I=g.evaluate.apply(void 0,v);if(w!==void 0&&I!==void 0)return x(w,I,d,i.colorSpace)}}:x(f,g,d,i.colorSpace)}function cl(i,t,r){switch(t.type){case"color":r=nt.parse(r);break;case"formatted":r=_i.fromString(r.toString());break;case"resolvedImage":r=xi.fromString(r.toString());break;case"padding":r=yi.parse(r);break;default:Ye(r)===t.type||t.type==="enum"&&t.values[r]||(r=void 0)}return Ps(r,i.default,t.default)}Mi.register(ws,{error:[{kind:"error"},[$e],(i,[t])=>{throw new Pt(t.evaluate(i))}],typeof:[$e,[Ne],(i,[t])=>P(zt(t.evaluate(i)))],"to-rgba":[A(ge,4),[ai],(i,[t])=>{const[r,n,l,h]=t.evaluate(i).rgb;return[255*r,255*n,255*l,h]}],rgb:[ai,[ge,ge,ge],Ka],rgba:[ai,[ge,ge,ge,ge],Ka],has:{type:Be,overloads:[[[$e],(i,[t])=>Ja(t.evaluate(i),i.properties())],[[$e,Vi],(i,[t,r])=>Ja(t.evaluate(i),r.evaluate(i))]]},get:{type:Ne,overloads:[[[$e],(i,[t])=>Ya(t.evaluate(i),i.properties())],[[$e,Vi],(i,[t,r])=>Ya(t.evaluate(i),r.evaluate(i))]]},"feature-state":[Ne,[$e],(i,[t])=>Ya(t.evaluate(i),i.featureState||{})],properties:[Vi,[],i=>i.properties()],"geometry-type":[$e,[],i=>i.geometryType()],id:[Ne,[],i=>i.id()],zoom:[ge,[],i=>i.globals.zoom],"heatmap-density":[ge,[],i=>i.globals.heatmapDensity||0],"line-progress":[ge,[],i=>i.globals.lineProgress||0],accumulated:[Ne,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[ge,ts(ge),(i,t)=>{let r=0;for(const n of t)r+=n.evaluate(i);return r}],"*":[ge,ts(ge),(i,t)=>{let r=1;for(const n of t)r*=n.evaluate(i);return r}],"-":{type:ge,overloads:[[[ge,ge],(i,[t,r])=>t.evaluate(i)-r.evaluate(i)],[[ge],(i,[t])=>-t.evaluate(i)]]},"/":[ge,[ge,ge],(i,[t,r])=>t.evaluate(i)/r.evaluate(i)],"%":[ge,[ge,ge],(i,[t,r])=>t.evaluate(i)%r.evaluate(i)],ln2:[ge,[],()=>Math.LN2],pi:[ge,[],()=>Math.PI],e:[ge,[],()=>Math.E],"^":[ge,[ge,ge],(i,[t,r])=>Math.pow(t.evaluate(i),r.evaluate(i))],sqrt:[ge,[ge],(i,[t])=>Math.sqrt(t.evaluate(i))],log10:[ge,[ge],(i,[t])=>Math.log(t.evaluate(i))/Math.LN10],ln:[ge,[ge],(i,[t])=>Math.log(t.evaluate(i))],log2:[ge,[ge],(i,[t])=>Math.log(t.evaluate(i))/Math.LN2],sin:[ge,[ge],(i,[t])=>Math.sin(t.evaluate(i))],cos:[ge,[ge],(i,[t])=>Math.cos(t.evaluate(i))],tan:[ge,[ge],(i,[t])=>Math.tan(t.evaluate(i))],asin:[ge,[ge],(i,[t])=>Math.asin(t.evaluate(i))],acos:[ge,[ge],(i,[t])=>Math.acos(t.evaluate(i))],atan:[ge,[ge],(i,[t])=>Math.atan(t.evaluate(i))],min:[ge,ts(ge),(i,t)=>Math.min(...t.map(r=>r.evaluate(i)))],max:[ge,ts(ge),(i,t)=>Math.max(...t.map(r=>r.evaluate(i)))],abs:[ge,[ge],(i,[t])=>Math.abs(t.evaluate(i))],round:[ge,[ge],(i,[t])=>{const r=t.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[ge,[ge],(i,[t])=>Math.floor(t.evaluate(i))],ceil:[ge,[ge],(i,[t])=>Math.ceil(t.evaluate(i))],"filter-==":[Be,[$e,Ne],(i,[t,r])=>i.properties()[t.value]===r.value],"filter-id-==":[Be,[Ne],(i,[t])=>i.id()===t.value],"filter-type-==":[Be,[$e],(i,[t])=>i.geometryType()===t.value],"filter-<":[Be,[$e,Ne],(i,[t,r])=>{const n=i.properties()[t.value],l=r.value;return typeof n==typeof l&&n<l}],"filter-id-<":[Be,[Ne],(i,[t])=>{const r=i.id(),n=t.value;return typeof r==typeof n&&r<n}],"filter->":[Be,[$e,Ne],(i,[t,r])=>{const n=i.properties()[t.value],l=r.value;return typeof n==typeof l&&n>l}],"filter-id->":[Be,[Ne],(i,[t])=>{const r=i.id(),n=t.value;return typeof r==typeof n&&r>n}],"filter-<=":[Be,[$e,Ne],(i,[t,r])=>{const n=i.properties()[t.value],l=r.value;return typeof n==typeof l&&n<=l}],"filter-id-<=":[Be,[Ne],(i,[t])=>{const r=i.id(),n=t.value;return typeof r==typeof n&&r<=n}],"filter->=":[Be,[$e,Ne],(i,[t,r])=>{const n=i.properties()[t.value],l=r.value;return typeof n==typeof l&&n>=l}],"filter-id->=":[Be,[Ne],(i,[t])=>{const r=i.id(),n=t.value;return typeof r==typeof n&&r>=n}],"filter-has":[Be,[Ne],(i,[t])=>t.value in i.properties()],"filter-has-id":[Be,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Be,[A($e)],(i,[t])=>t.value.indexOf(i.geometryType())>=0],"filter-id-in":[Be,[A(Ne)],(i,[t])=>t.value.indexOf(i.id())>=0],"filter-in-small":[Be,[$e,A(Ne)],(i,[t,r])=>r.value.indexOf(i.properties()[t.value])>=0],"filter-in-large":[Be,[$e,A(Ne)],(i,[t,r])=>function(n,l,h,d){for(;h<=d;){const f=h+d>>1;if(l[f]===n)return!0;l[f]>n?d=f-1:h=f+1}return!1}(i.properties()[t.value],r.value,0,r.value.length-1)],all:{type:Be,overloads:[[[Be,Be],(i,[t,r])=>t.evaluate(i)&&r.evaluate(i)],[ts(Be),(i,t)=>{for(const r of t)if(!r.evaluate(i))return!1;return!0}]]},any:{type:Be,overloads:[[[Be,Be],(i,[t,r])=>t.evaluate(i)||r.evaluate(i)],[ts(Be),(i,t)=>{for(const r of t)if(r.evaluate(i))return!0;return!1}]]},"!":[Be,[Be],(i,[t])=>!t.evaluate(i)],"is-supported-script":[Be,[$e],(i,[t])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(t.evaluate(i))}],upcase:[$e,[$e],(i,[t])=>t.evaluate(i).toUpperCase()],downcase:[$e,[$e],(i,[t])=>t.evaluate(i).toLowerCase()],concat:[$e,ts(Ne),(i,t)=>t.map(r=>nn(r.evaluate(i))).join("")],"resolved-locale":[$e,[or],(i,[t])=>t.evaluate(i).resolvedLocale()]});class Yn{constructor(t,r){var n;this.expression=t,this._warningHistory={},this._evaluator=new Fn,this._defaultValue=r?(n=r).type==="color"&&Kn(n.default)?new nt(0,0,0,0):n.type==="color"?nt.parse(n.default)||null:n.type==="padding"?yi.parse(n.default)||null:n.type==="variableAnchorOffsetCollection"?Ai.parse(n.default)||null:n.default===void 0?null:n.default:null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(t,r,n,l,h,d){return this._evaluator.globals=t,this._evaluator.feature=r,this._evaluator.featureState=n,this._evaluator.canonical=l,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=d,this.expression.evaluate(this._evaluator)}evaluate(t,r,n,l,h,d){this._evaluator.globals=t,this._evaluator.feature=r||null,this._evaluator.featureState=n||null,this._evaluator.canonical=l,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=d||null;try{const f=this.expression.evaluate(this._evaluator);if(f==null||typeof f=="number"&&f!=f)return this._defaultValue;if(this._enumValues&&!(f in this._enumValues))throw new Pt(`Expected value to be one of ${Object.keys(this._enumValues).map(g=>JSON.stringify(g)).join(", ")}, but found ${JSON.stringify(f)} instead.`);return f}catch(f){return this._warningHistory[f.message]||(this._warningHistory[f.message]=!0,typeof console<"u"&&console.warn(f.message)),this._defaultValue}}}function Qn(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in ws}function As(i,t){const r=new Xr(ws,dn,[],t?function(l){const h={color:ai,string:$e,number:ge,enum:$e,boolean:Be,formatted:vr,padding:Dr,resolvedImage:lr,variableAnchorOffsetCollection:N};return l.type==="array"?A(h[l.value]||Ne,l.length):h[l.type]}(t):void 0),n=r.parse(i,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?Wn(new Yn(n,t)):Ss(r.errors)}class Ms{constructor(t,r){this.kind=t,this._styleExpression=r,this.isStateDependent=t!=="constant"&&!Ts(r.expression)}evaluateWithoutErrorHandling(t,r,n,l,h,d){return this._styleExpression.evaluateWithoutErrorHandling(t,r,n,l,h,d)}evaluate(t,r,n,l,h,d){return this._styleExpression.evaluate(t,r,n,l,h,d)}}class zs{constructor(t,r,n,l){this.kind=t,this.zoomStops=n,this._styleExpression=r,this.isStateDependent=t!=="camera"&&!Ts(r.expression),this.interpolationType=l}evaluateWithoutErrorHandling(t,r,n,l,h,d){return this._styleExpression.evaluateWithoutErrorHandling(t,r,n,l,h,d)}evaluate(t,r,n,l,h,d){return this._styleExpression.evaluate(t,r,n,l,h,d)}interpolationFactor(t,r,n){return this.interpolationType?li.interpolationFactor(this.interpolationType,t,r,n):0}}function eo(i,t){const r=As(i,t);if(r.result==="error")return r;const n=r.value.expression,l=pn(n);if(!l&&!Is(t))return Ss([new Qt("","data expressions not supported")]);const h=fn(n,["zoom"]);if(!h&&!nl(t))return Ss([new Qt("","zoom expressions not supported")]);const d=mn(n);return d||h?d instanceof Qt?Ss([d]):d instanceof li&&!Qa(t)?Ss([new Qt("",'"interpolate" expressions cannot be used with this property')]):Wn(d?new zs(l?"camera":"composite",r.value,d.labels,d instanceof li?d.interpolation:void 0):new Ms(l?"constant":"source",r.value)):Ss([new Qt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Cs{constructor(t,r){this._parameters=t,this._specification=r,nr(this,al(this._parameters,this._specification))}static deserialize(t){return new Cs(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function mn(i){let t=null;if(i instanceof Lr)t=mn(i.result);else if(i instanceof jn){for(const r of i.args)if(t=mn(r),t)break}else(i instanceof xs||i instanceof li)&&i.input instanceof Mi&&i.input.name==="zoom"&&(t=i);return t instanceof Qt||i.eachChild(r=>{const n=mn(r);n instanceof Qt?t=n:!t&&n?t=new Qt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&n&&t!==n&&(t=new Qt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function ea(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const t of i.slice(1))if(!ea(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}const ta={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function to(i){if(i==null)return{filter:()=>!0,needGeometry:!1};ea(i)||(i=ia(i));const t=As(i,ta);if(t.result==="error")throw new Error(t.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,n,l)=>t.value.evaluate(r,n,{},l),needGeometry:ul(i)}}function oc(i,t){return i<t?-1:i>t?1:0}function ul(i){if(!Array.isArray(i))return!1;if(i[0]==="within"||i[0]==="distance")return!0;for(let t=1;t<i.length;t++)if(ul(i[t]))return!0;return!1}function ia(i){if(!i)return!0;const t=i[0];return i.length<=1?t!=="any":t==="=="?io(i[1],i[2],"=="):t==="!="?Ut(io(i[1],i[2],"==")):t==="<"||t===">"||t==="<="||t===">="?io(i[1],i[2],t):t==="any"?(r=i.slice(1),["any"].concat(r.map(ia))):t==="all"?["all"].concat(i.slice(1).map(ia)):t==="none"?["all"].concat(i.slice(1).map(ia).map(Ut)):t==="in"?gn(i[1],i.slice(2)):t==="!in"?Ut(gn(i[1],i.slice(2))):t==="has"?_n(i[1]):t!=="!has"||Ut(_n(i[1]));var r}function io(i,t,r){switch(i){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,i,t]}}function gn(i,t){if(t.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(r=>typeof r!=typeof t[0])?["filter-in-large",i,["literal",t.sort(oc)]]:["filter-in-small",i,["literal",t]]}}function _n(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Ut(i){return["!",i]}function is(i){const t=typeof i;if(t==="number"||t==="boolean"||t==="string"||i==null)return JSON.stringify(i);if(Array.isArray(i)){let l="[";for(const h of i)l+=`${is(h)},`;return`${l}]`}const r=Object.keys(i).sort();let n="{";for(let l=0;l<r.length;l++)n+=`${JSON.stringify(r[l])}:${is(i[r[l]])},`;return`${n}}`}function hl(i){let t="";for(const r of Gr)t+=`/${is(i[r])}`;return t}function dl(i){const t=i.value;return t?[new he(i.key,t,"constants have been deprecated as of v8")]:[]}function St(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function $i(i){if(Array.isArray(i))return i.map($i);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const t={};for(const r in i)t[r]=$i(i[r]);return t}return St(i)}function vi(i){const t=i.key,r=i.value,n=i.valueSpec||{},l=i.objectElementValidators||{},h=i.style,d=i.styleSpec,f=i.validateSpec;let g=[];const x=Ye(r);if(x!=="object")return[new he(t,r,`object expected, ${x} found`)];for(const v in r){const w=v.split(".")[0],I=n[w]||n["*"];let M;if(l[w])M=l[w];else if(n[w])M=f;else if(l["*"])M=l["*"];else{if(!n["*"]){g.push(new he(t,r[v],`unknown property "${v}"`));continue}M=f}g=g.concat(M({key:(t&&`${t}.`)+v,value:r[v],valueSpec:I,style:h,styleSpec:d,object:r,objectKey:v,validateSpec:f},r))}for(const v in n)l[v]||n[v].required&&n[v].default===void 0&&r[v]===void 0&&g.push(new he(t,r,`missing required property "${v}"`));return g}function yn(i){const t=i.value,r=i.valueSpec,n=i.style,l=i.styleSpec,h=i.key,d=i.arrayElementValidator||i.validateSpec;if(Ye(t)!=="array")return[new he(h,t,`array expected, ${Ye(t)} found`)];if(r.length&&t.length!==r.length)return[new he(h,t,`array length ${r.length} expected, length ${t.length} found`)];if(r["min-length"]&&t.length<r["min-length"])return[new he(h,t,`array length at least ${r["min-length"]} expected, length ${t.length} found`)];let f={type:r.value,values:r.values};l.$version<7&&(f.function=r.function),Ye(r.value)==="object"&&(f=r.value);let g=[];for(let x=0;x<t.length;x++)g=g.concat(d({array:t,arrayIndex:x,value:t[x],valueSpec:f,validateSpec:i.validateSpec,style:n,styleSpec:l,key:`${h}[${x}]`}));return g}function ro(i){const t=i.key,r=i.value,n=i.valueSpec;let l=Ye(r);return l==="number"&&r!=r&&(l="NaN"),l!=="number"?[new he(t,r,`number expected, ${l} found`)]:"minimum"in n&&r<n.minimum?[new he(t,r,`${r} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&r>n.maximum?[new he(t,r,`${r} is greater than the maximum value ${n.maximum}`)]:[]}function ra(i){const t=i.valueSpec,r=St(i.value.type);let n,l,h,d={};const f=r!=="categorical"&&i.value.property===void 0,g=!f,x=Ye(i.value.stops)==="array"&&Ye(i.value.stops[0])==="array"&&Ye(i.value.stops[0][0])==="object",v=vi({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(M){if(r==="identity")return[new he(M.key,M.value,'identity function may not have a "stops" property')];let C=[];const k=M.value;return C=C.concat(yn({key:M.key,value:k,valueSpec:M.valueSpec,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec,arrayElementValidator:w})),Ye(k)==="array"&&k.length===0&&C.push(new he(M.key,k,"array must have at least one stop")),C},default:function(M){return M.validateSpec({key:M.key,value:M.value,valueSpec:t,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec})}}});return r==="identity"&&f&&v.push(new he(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||v.push(new he(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!Qa(i.valueSpec)&&v.push(new he(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(g&&!Is(i.valueSpec)?v.push(new he(i.key,i.value,"property functions not supported")):f&&!nl(i.valueSpec)&&v.push(new he(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!x||i.value.property!==void 0||v.push(new he(i.key,i.value,'"property" property is required')),v;function w(M){let C=[];const k=M.value,F=M.key;if(Ye(k)!=="array")return[new he(F,k,`array expected, ${Ye(k)} found`)];if(k.length!==2)return[new he(F,k,`array length 2 expected, length ${k.length} found`)];if(x){if(Ye(k[0])!=="object")return[new he(F,k,`object expected, ${Ye(k[0])} found`)];if(k[0].zoom===void 0)return[new he(F,k,"object stop key must have zoom")];if(k[0].value===void 0)return[new he(F,k,"object stop key must have value")];if(h&&h>St(k[0].zoom))return[new he(F,k[0].zoom,"stop zoom values must appear in ascending order")];St(k[0].zoom)!==h&&(h=St(k[0].zoom),l=void 0,d={}),C=C.concat(vi({key:`${F}[0]`,value:k[0],valueSpec:{zoom:{}},validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec,objectElementValidators:{zoom:ro,value:I}}))}else C=C.concat(I({key:`${F}[0]`,value:k[0],validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec},k));return Qn($i(k[1]))?C.concat([new he(`${F}[1]`,k[1],"expressions are not allowed in function stops.")]):C.concat(M.validateSpec({key:`${F}[1]`,value:k[1],valueSpec:t,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec}))}function I(M,C){const k=Ye(M.value),F=St(M.value),j=M.value!==null?M.value:C;if(n){if(k!==n)return[new he(M.key,j,`${k} stop domain type must match previous stop domain type ${n}`)]}else n=k;if(k!=="number"&&k!=="string"&&k!=="boolean")return[new he(M.key,j,"stop domain value must be a number, string, or boolean")];if(k!=="number"&&r!=="categorical"){let Q=`number expected, ${k} found`;return Is(t)&&r===void 0&&(Q+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new he(M.key,j,Q)]}return r!=="categorical"||k!=="number"||isFinite(F)&&Math.floor(F)===F?r!=="categorical"&&k==="number"&&l!==void 0&&F<l?[new he(M.key,j,"stop domain values must appear in ascending order")]:(l=F,r==="categorical"&&F in d?[new he(M.key,j,"stop domain values must be unique")]:(d[F]=!0,[])):[new he(M.key,j,`integer expected, found ${F}`)]}}function ks(i){const t=(i.expressionContext==="property"?eo:As)($i(i.value),i.valueSpec);if(t.result==="error")return t.value.map(n=>new he(`${i.key}${n.key}`,i.value,n.message));const r=t.value.expression||t.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new he(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"&&!Ts(r))return[new he(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!Ts(r))return[new he(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!fn(r,["zoom","feature-state"]))return[new he(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!pn(r))return[new he(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function wr(i){const t=i.key,r=i.value,n=i.valueSpec,l=[];return Array.isArray(n.values)?n.values.indexOf(St(r))===-1&&l.push(new he(t,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(n.values).indexOf(St(r))===-1&&l.push(new he(t,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),l}function so(i){return ea($i(i.value))?ks(nr({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):sa(i)}function sa(i){const t=i.value,r=i.key;if(Ye(t)!=="array")return[new he(r,t,`array expected, ${Ye(t)} found`)];const n=i.styleSpec;let l,h=[];if(t.length<1)return[new he(r,t,"filter array must have at least 1 element")];switch(h=h.concat(wr({key:`${r}[0]`,value:t[0],valueSpec:n.filter_operator,style:i.style,styleSpec:i.styleSpec})),St(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&St(t[1])==="$type"&&h.push(new he(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&h.push(new he(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(l=Ye(t[1]),l!=="string"&&h.push(new he(`${r}[1]`,t[1],`string expected, ${l} found`)));for(let d=2;d<t.length;d++)l=Ye(t[d]),St(t[1])==="$type"?h=h.concat(wr({key:`${r}[${d}]`,value:t[d],valueSpec:n.geometry_type,style:i.style,styleSpec:i.styleSpec})):l!=="string"&&l!=="number"&&l!=="boolean"&&h.push(new he(`${r}[${d}]`,t[d],`string, number, or boolean expected, ${l} found`));break;case"any":case"all":case"none":for(let d=1;d<t.length;d++)h=h.concat(sa({key:`${r}[${d}]`,value:t[d],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":l=Ye(t[1]),t.length!==2?h.push(new he(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):l!=="string"&&h.push(new he(`${r}[1]`,t[1],`string expected, ${l} found`))}return h}function no(i,t){const r=i.key,n=i.validateSpec,l=i.style,h=i.styleSpec,d=i.value,f=i.objectKey,g=h[`${t}_${i.layerType}`];if(!g)return[];const x=f.match(/^(.*)-transition$/);if(t==="paint"&&x&&g[x[1]]&&g[x[1]].transition)return n({key:r,value:d,valueSpec:h.transition,style:l,styleSpec:h});const v=i.valueSpec||g[f];if(!v)return[new he(r,d,`unknown property "${f}"`)];let w;if(Ye(d)==="string"&&Is(v)&&!v.tokens&&(w=/^{([^}]+)}$/.exec(d)))return[new he(r,d,`"${f}" does not support interpolation syntax5Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(w[1])} }\`.`)];const I=[];return i.layerType==="symbol"&&(f==="text-field"&&l&&!l.glyphs&&I.push(new he(r,d,'use of "text-field" requires a style "glyphs" property')),f==="text-font"&&Kn($i(d))&&St(d.type)==="identity"&&I.push(new he(r,d,'"text-font" does not support identity functions'))),I.concat(n({key:i.key,value:d,valueSpec:v,style:l,styleSpec:h,expressionContext:"property",propertyType:t,propertyKey:f}))}function na(i){return no(i,"paint")}function ao(i){return no(i,"layout")}function oo(i){let t=[];const r=i.value,n=i.key,l=i.style,h=i.styleSpec;r.type||r.ref||t.push(new he(n,r,'either "type" or "ref" is required'));let d=St(r.type);const f=St(r.ref);if(r.id){const g=St(r.id);for(let x=0;x<i.arrayIndex;x++){const v=l.layers[x];St(v.id)===g&&t.push(new he(n,r.id,`duplicate layer id "${r.id}", previously used at line ${v.id.__line__}`))}}if("ref"in r){let g;["type","source","source-layer","filter","layout"].forEach(x=>{x in r&&t.push(new he(n,r[x],`"${x}" is prohibited for ref layers`))}),l.layers.forEach(x=>{St(x.id)===f&&(g=x)}),g?g.ref?t.push(new he(n,r.ref,"ref cannot reference another ref layer")):d=St(g.type):t.push(new he(n,r.ref,`ref layer "${f}" not found`))}else if(d!=="background")if(r.source){const g=l.sources&&l.sources[r.source],x=g&&St(g.type);g?x==="vector"&&d==="raster"?t.push(new he(n,r.source,`layer "${r.id}" requires a raster source`)):x!=="raster-dem"&&d==="hillshade"?t.push(new he(n,r.source,`layer "${r.id}" requires a raster-dem source`)):x==="raster"&&d!=="raster"?t.push(new he(n,r.source,`layer "${r.id}" requires a vector source`)):x!=="vector"||r["source-layer"]?x==="raster-dem"&&d!=="hillshade"?t.push(new he(n,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):d!=="line"||!r.paint||!r.paint["line-gradient"]||x==="geojson"&&g.lineMetrics||t.push(new he(n,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new he(n,r,`layer "${r.id}" must specify a "source-layer"`)):t.push(new he(n,r.source,`source "${r.source}" not found`))}else t.push(new he(n,r,'missing required property "source"'));return t=t.concat(vi({key:n,value:r,valueSpec:h.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${n}.type`,value:r.type,valueSpec:h.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:so,layout:g=>vi({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":x=>ao(nr({layerType:d},x))}}),paint:g=>vi({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":x=>na(nr({layerType:d},x))}})}})),t}function rs(i){const t=i.value,r=i.key,n=Ye(t);return n!=="string"?[new he(r,t,`string expected, ${n} found`)]:[]}const aa={promoteId:function({key:i,value:t}){if(Ye(t)==="string")return rs({key:i,value:t});{const r=[];for(const n in t)r.push(...rs({key:`${i}.${n}`,value:t[n]}));return r}}};function xn(i){const t=i.value,r=i.key,n=i.styleSpec,l=i.style,h=i.validateSpec;if(!t.type)return[new he(r,t,'"type" is required')];const d=St(t.type);let f;switch(d){case"vector":case"raster":return f=vi({key:r,value:t,valueSpec:n[`source_${d.replace("-","_")}`],style:i.style,styleSpec:n,objectElementValidators:aa,validateSpec:h}),f;case"raster-dem":return f=function(g){var x;const v=(x=g.sourceName)!==null&&x!==void 0?x:"",w=g.value,I=g.styleSpec,M=I.source_raster_dem,C=g.style;let k=[];const F=Ye(w);if(w===void 0)return k;if(F!=="object")return k.push(new he("source_raster_dem",w,`object expected, ${F} found`)),k;const j=St(w.encoding)==="custom",Q=["redFactor","greenFactor","blueFactor","baseShift"],G=g.value.encoding?`"${g.value.encoding}"`:"Default";for(const J in w)!j&&Q.includes(J)?k.push(new he(J,w[J],`In "${v}": "${J}" is only valid when "encoding" is set to "custom". ${G} encoding found`)):M[J]?k=k.concat(g.validateSpec({key:J,value:w[J],valueSpec:M[J],validateSpec:g.validateSpec,style:C,styleSpec:I})):k.push(new he(J,w[J],`unknown property "${J}"`));return k}({sourceName:r,value:t,style:i.style,styleSpec:n,validateSpec:h}),f;case"geojson":if(f=vi({key:r,value:t,valueSpec:n.source_geojson,style:l,styleSpec:n,validateSpec:h,objectElementValidators:aa}),t.cluster)for(const g in t.clusterProperties){const[x,v]=t.clusterProperties[g],w=typeof x=="string"?[x,["accumulated"],["get",g]]:x;f.push(...ks({key:`${r}.${g}.map`,value:v,expressionContext:"cluster-map"})),f.push(...ks({key:`${r}.${g}.reduce`,value:w,expressionContext:"cluster-reduce"}))}return f;case"video":return vi({key:r,value:t,valueSpec:n.source_video,style:l,validateSpec:h,styleSpec:n});case"image":return vi({key:r,value:t,valueSpec:n.source_image,style:l,validateSpec:h,styleSpec:n});case"canvas":return[new he(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return wr({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function lo(i){const t=i.value,r=i.styleSpec,n=r.light,l=i.style;let h=[];const d=Ye(t);if(t===void 0)return h;if(d!=="object")return h=h.concat([new he("light",t,`object expected, ${d} found`)]),h;for(const f in t){const g=f.match(/^(.*)-transition$/);h=h.concat(g&&n[g[1]]&&n[g[1]].transition?i.validateSpec({key:f,value:t[f],valueSpec:r.transition,validateSpec:i.validateSpec,style:l,styleSpec:r}):n[f]?i.validateSpec({key:f,value:t[f],valueSpec:n[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new he(f,t[f],`unknown property "${f}"`)])}return h}function co(i){const t=i.value,r=i.styleSpec,n=r.sky,l=i.style,h=Ye(t);if(t===void 0)return[];if(h!=="object")return[new he("sky",t,`object expected, ${h} found`)];let d=[];for(const f in t)d=d.concat(n[f]?i.validateSpec({key:f,value:t[f],valueSpec:n[f],style:l,styleSpec:r}):[new he(f,t[f],`unknown property "${f}"`)]);return d}function uo(i){const t=i.value,r=i.styleSpec,n=r.terrain,l=i.style;let h=[];const d=Ye(t);if(t===void 0)return h;if(d!=="object")return h=h.concat([new he("terrain",t,`object expected, ${d} found`)]),h;for(const f in t)h=h.concat(n[f]?i.validateSpec({key:f,value:t[f],valueSpec:n[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new he(f,t[f],`unknown property "${f}"`)]);return h}function ho(i){let t=[];const r=i.value,n=i.key;if(Array.isArray(r)){const l=[],h=[];for(const d in r)r[d].id&&l.includes(r[d].id)&&t.push(new he(n,r,`all the sprites' ids must be unique, but ${r[d].id} is duplicated`)),l.push(r[d].id),r[d].url&&h.includes(r[d].url)&&t.push(new he(n,r,`all the sprites' URLs must be unique, but ${r[d].url} is duplicated`)),h.push(r[d].url),t=t.concat(vi({key:`${n}[${d}]`,value:r[d],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return t}return rs({key:n,value:r})}const oa={"*":()=>[],array:yn,boolean:function(i){const t=i.value,r=i.key,n=Ye(t);return n!=="boolean"?[new he(r,t,`boolean expected, ${n} found`)]:[]},number:ro,color:function(i){const t=i.key,r=i.value,n=Ye(r);return n!=="string"?[new he(t,r,`color expected, ${n} found`)]:nt.parse(String(r))?[]:[new he(t,r,`color expected, "${r}" found`)]},constants:dl,enum:wr,filter:so,function:ra,layer:oo,object:vi,source:xn,light:lo,sky:co,terrain:uo,projection:function(i){const t=i.value,r=i.styleSpec,n=r.projection,l=i.style,h=Ye(t);if(t===void 0)return[];if(h!=="object")return[new he("projection",t,`object expected, ${h} found`)];let d=[];for(const f in t)d=d.concat(n[f]?i.validateSpec({key:f,value:t[f],valueSpec:n[f],style:l,styleSpec:r}):[new he(f,t[f],`unknown property "${f}"`)]);return d},string:rs,formatted:function(i){return rs(i).length===0?[]:ks(i)},resolvedImage:function(i){return rs(i).length===0?[]:ks(i)},padding:function(i){const t=i.key,r=i.value;if(Ye(r)==="array"){if(r.length<1||r.length>4)return[new he(t,r,`padding requires 1 to 4 values; ${r.length} values found`)];const n={type:"number"};let l=[];for(let h=0;h<r.length;h++)l=l.concat(i.validateSpec({key:`${t}[${h}]`,value:r[h],validateSpec:i.validateSpec,valueSpec:n}));return l}return ro({key:t,value:r,valueSpec:{}})},variableAnchorOffsetCollection:function(i){const t=i.key,r=i.value,n=Ye(r),l=i.styleSpec;if(n!=="array"||r.length<1||r.length%2!=0)return[new he(t,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let h=[];for(let d=0;d<r.length;d+=2)h=h.concat(wr({key:`${t}[${d}]`,value:r[d],valueSpec:l.layout_symbol["text-anchor"]})),h=h.concat(yn({key:`${t}[${d+1}]`,value:r[d+1],valueSpec:{length:2,value:"number"},validateSpec:i.validateSpec,style:i.style,styleSpec:l}));return h},sprite:ho};function vn(i){const t=i.value,r=i.valueSpec,n=i.styleSpec;return i.validateSpec=vn,r.expression&&Kn(St(t))?ra(i):r.expression&&Qn($i(t))?ks(i):r.type&&oa[r.type]?oa[r.type](i):vi(nr({},i,{valueSpec:r.type?n[r.type]:r}))}function pl(i){const t=i.value,r=i.key,n=rs(i);return n.length||(t.indexOf("{fontstack}")===-1&&n.push(new he(r,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&n.push(new he(r,t,'"glyphs" url must include a "{range}" token'))),n}function zi(i,t=ie){let r=[];return r=r.concat(vn({key:"",value:i,valueSpec:t.$root,styleSpec:t,style:i,validateSpec:vn,objectElementValidators:{glyphs:pl,"*":()=>[]}})),i.constants&&(r=r.concat(dl({key:"constants",value:i.constants}))),po(r)}function ur(i){return function(t){return i({...t,validateSpec:vn})}}function po(i){return[].concat(i).sort((t,r)=>t.line-r.line)}function qi(i){return function(...t){return po(i.apply(this,t))}}zi.source=qi(ur(xn)),zi.sprite=qi(ur(ho)),zi.glyphs=qi(ur(pl)),zi.light=qi(ur(lo)),zi.sky=qi(ur(co)),zi.terrain=qi(ur(uo)),zi.layer=qi(ur(oo)),zi.filter=qi(ur(so)),zi.paintProperty=qi(ur(na)),zi.layoutProperty=qi(ur(ao));const ss=zi,lc=ss.light,cc=ss.sky,fl=ss.paintProperty,ml=ss.layoutProperty;function fo(i,t){let r=!1;if(t&&t.length)for(const n of t)i.fire(new Cr(new Error(n.message))),r=!0;return r}class Es{constructor(t,r,n){const l=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const d=new Int32Array(this.arrayBuffer);t=d[0],this.d=(r=d[1])+2*(n=d[2]);for(let g=0;g<this.d*this.d;g++){const x=d[3+g],v=d[3+g+1];l.push(x===v?null:d.subarray(x,v))}const f=d[3+l.length+1];this.keys=d.subarray(d[3+l.length],f),this.bboxes=d.subarray(f),this.insert=this._insertReadonly}else{this.d=r+2*n;for(let d=0;d<this.d*this.d;d++)l.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=t,this.padding=n,this.scale=r/t,this.uid=0;const h=n/r*t;this.min=-h,this.max=t+h}insert(t,r,n,l,h){this._forEachCell(r,n,l,h,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(l),this.bboxes.push(h)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,r,n,l,h,d){this.cells[h].push(d)}query(t,r,n,l,h){const d=this.min,f=this.max;if(t<=d&&r<=d&&f<=n&&f<=l&&!h)return Array.prototype.slice.call(this.keys);{const g=[];return this._forEachCell(t,r,n,l,this._queryCell,g,{},h),g}}_queryCell(t,r,n,l,h,d,f,g){const x=this.cells[h];if(x!==null){const v=this.keys,w=this.bboxes;for(let I=0;I<x.length;I++){const M=x[I];if(f[M]===void 0){const C=4*M;(g?g(w[C+0],w[C+1],w[C+2],w[C+3]):t<=w[C+2]&&r<=w[C+3]&&n>=w[C+0]&&l>=w[C+1])?(f[M]=!0,d.push(v[M])):f[M]=!1}}}}_forEachCell(t,r,n,l,h,d,f,g){const x=this._convertToCellCoord(t),v=this._convertToCellCoord(r),w=this._convertToCellCoord(n),I=this._convertToCellCoord(l);for(let M=x;M<=w;M++)for(let C=v;C<=I;C++){const k=this.d*C+M;if((!g||g(this._convertFromCellCoord(M),this._convertFromCellCoord(C),this._convertFromCellCoord(M+1),this._convertFromCellCoord(C+1)))&&h.call(this,t,r,n,l,k,d,f,g))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,r=3+this.cells.length+1+1;let n=0;for(let d=0;d<this.cells.length;d++)n+=this.cells[d].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 h=r;for(let d=0;d<t.length;d++){const f=t[d];l[3+d]=h,l.set(f,h),h+=f.length}return l[3+t.length]=h,l.set(this.keys,h),h+=this.keys.length,l[3+t.length+1]=h,l.set(this.bboxes,h),h+=this.bboxes.length,l.buffer}static serialize(t,r){const n=t.toArrayBuffer();return r&&r.push(n),{buffer:n}}static deserialize(t){return new Es(t.buffer)}}const Ci={};function Ie(i,t,r={}){if(Ci[i])throw new Error(`${i} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:i,writeable:!1}),Ci[i]={klass:t,omit:r.omit||[],shallow:r.shallow||[]}}Ie("Object",Object),Ie("TransferableGridIndex",Es),Ie("Color",nt),Ie("Error",Error),Ie("AJAXError",gi),Ie("ResolvedImage",xi),Ie("StylePropertyFunction",Cs),Ie("StyleExpression",Yn,{omit:["_evaluator"]}),Ie("ZoomDependentExpression",zs),Ie("ZoomConstantExpression",Ms),Ie("CompoundExpression",Mi,{omit:["_evaluate"]});for(const i in ws)ws[i]._classRegistryKey||Ie(`Expression_${i}`,ws[i]);function la(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function mo(i){return i.$name||i.constructor._classRegistryKey}function gl(i){return!function(t){if(t===null||typeof t!="object")return!1;const r=mo(t);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||la(i)||rr(i)||ArrayBuffer.isView(i)||i instanceof ImageData)}function Ds(i,t){if(gl(i))return(la(i)||rr(i))&&t&&t.push(i),ArrayBuffer.isView(i)&&t&&t.push(i.buffer),i instanceof ImageData&&t&&t.push(i.data.buffer),i;if(Array.isArray(i)){const h=[];for(const d of i)h.push(Ds(d,t));return h}if(typeof i!="object")throw new Error("can't serialize object of type "+typeof i);const r=mo(i);if(!r)throw new Error(`can't serialize object of unregistered class ${i.constructor.name}`);if(!Ci[r])throw new Error(`${r} is not registered.`);const{klass:n}=Ci[r],l=n.serialize?n.serialize(i,t):{};if(n.serialize){if(t&&l===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const h in i){if(!i.hasOwnProperty(h)||Ci[r].omit.indexOf(h)>=0)continue;const d=i[h];l[h]=Ci[r].shallow.indexOf(h)>=0?d:Ds(d,t)}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 Ls(i){if(gl(i))return i;if(Array.isArray(i))return i.map(Ls);if(typeof i!="object")throw new Error("can't deserialize object of type "+typeof i);const t=mo(i)||"Object";if(!Ci[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:r}=Ci[t];if(!r)throw new Error(`can't deserialize unregistered class ${t}`);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 h=i[l];n[l]=Ci[t].shallow.indexOf(l)>=0?h:Ls(h)}return n}class go{constructor(){this.first=!0}update(t,r){const n=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<n&&(this.lastIntegerZoom=n,this.lastIntegerZoomTime=r),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=n,!0))}}const Xe={"Latin-1 Supplement":i=>i>=128&&i<=255,"Hangul Jamo":i=>i>=4352&&i<=4607,Khmer:i=>i>=6016&&i<=6143,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Katakana:i=>i>=12448&&i<=12543,Kanbun:i=>i>=12688&&i<=12703,"CJK Strokes":i=>i>=12736&&i<=12783,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"Private Use Area":i=>i>=57344&&i<=63743,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function _o(i){for(const t of i)if(xo(t.charCodeAt(0)))return!0;return!1}function uc(i){for(const t of i)if(!Rs(t.charCodeAt(0)))return!1;return!0}function yo(i){const t=i.map(r=>{try{return new RegExp(`\\p{sc=${r}}`,"u").source}catch{return null}}).filter(r=>r);return new RegExp(t.join("|"),"u")}const hc=yo(["Arab","Dupl","Mong","Ougr","Syrc"]);function Rs(i){return!hc.test(String.fromCodePoint(i))}const _l=yo(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function xo(i){return!(i!==746&&i!==747&&(i<4352||!(Xe["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||Xe["CJK Compatibility"](i)||Xe["CJK Strokes"](i)||!(!Xe["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Xe["Enclosed CJK Letters and Months"](i)||Xe["Ideographic Description Characters"](i)||Xe.Kanbun(i)||Xe.Katakana(i)&&i!==12540||!(!Xe["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)||!(!Xe["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||Xe["Vertical Forms"](i)||Xe["Yijing Hexagram Symbols"](i)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(i))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(i))||_l.test(String.fromCodePoint(i)))))}function yl(i){return!(xo(i)||function(t){return!!(Xe["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||Xe["General Punctuation"](t)&&(t===8214||t===8224||t===8225||t===8240||t===8241||t===8251||t===8252||t===8258||t===8263||t===8264||t===8265||t===8273)||Xe["Letterlike Symbols"](t)||Xe["Number Forms"](t)||Xe["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||t===9003||t>=9085&&t<=9114||t>=9150&&t<=9165||t===9167||t>=9169&&t<=9179||t>=9186&&t<=9215)||Xe["Control Pictures"](t)&&t!==9251||Xe["Optical Character Recognition"](t)||Xe["Enclosed Alphanumerics"](t)||Xe["Geometric Shapes"](t)||Xe["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Xe["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Xe["CJK Symbols and Punctuation"](t)||Xe.Katakana(t)||Xe["Private Use Area"](t)||Xe["CJK Compatibility Forms"](t)||Xe["Small Form Variants"](t)||Xe["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}(i))}const dc=yo(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function vo(i){return dc.test(String.fromCodePoint(i))}function pc(i,t){return!(!t&&vo(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Xe.Khmer(i))}function fc(i){for(const t of i)if(vo(t.charCodeAt(0)))return!0;return!1}const bi=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 pt{constructor(t,r){this.zoom=t,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new go,this.transition={})}isSupportedScript(t){return function(r,n){for(const l of r)if(!pc(l.charCodeAt(0),n))return!1;return!0}(t,bi.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,r=t-Math.floor(t),n=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*r}}}class Bs{constructor(t,r){this.property=t,this.value=r,this.expression=function(n,l){if(Kn(n))return new Cs(n,l);if(Qn(n)){const h=eo(n,l);if(h.result==="error")throw new Error(h.value.map(d=>`${d.key}: ${d.message}`).join(", "));return h.value}{let h=n;return l.type==="color"&&typeof n=="string"?h=nt.parse(n):l.type!=="padding"||typeof n!="number"&&!Array.isArray(n)?l.type==="variableAnchorOffsetCollection"&&Array.isArray(n)&&(h=Ai.parse(n)):h=yi.parse(n),{kind:"constant",evaluate:()=>h}}}(r===void 0?t.specification.default:r,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(t,r,n){return this.property.possiblyEvaluate(this,t,r,n)}}class ca{constructor(t){this.property=t,this.value=new Bs(t,void 0)}transitioned(t,r){return new xl(this.property,this.value,r,Ii({},t.transition,this.transition),t.now)}untransitioned(){return new xl(this.property,this.value,null,{},0)}}class ua{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return at(this._values[t].value.value)}setValue(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new ca(this._values[t].property)),this._values[t].value=new Bs(this._values[t].property,r===null?void 0:at(r))}getTransition(t){return at(this._values[t].transition)}setTransition(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new ca(this._values[t].property)),this._values[t].transition=at(r)||void 0}serialize(){const t={};for(const r of Object.keys(this._values)){const n=this.getValue(r);n!==void 0&&(t[r]=n);const l=this.getTransition(r);l!==void 0&&(t[`${r}-transition`]=l)}return t}transitioned(t,r){const n=new bn(this._properties);for(const l of Object.keys(this._values))n._values[l]=this._values[l].transitioned(t,r._values[l]);return n}untransitioned(){const t=new bn(this._properties);for(const r of Object.keys(this._values))t._values[r]=this._values[r].untransitioned();return t}}class xl{constructor(t,r,n,l,h){this.property=t,this.value=r,this.begin=h+l.delay||0,this.end=this.begin+l.duration||0,t.specification.transition&&(l.delay||l.duration)&&(this.prior=n)}possiblyEvaluate(t,r,n){const l=t.now||0,h=this.value.possiblyEvaluate(t,r,n),d=this.prior;if(d){if(l>this.end)return this.prior=null,h;if(this.value.isDataDriven())return this.prior=null,h;if(l<this.begin)return d.possiblyEvaluate(t,r,n);{const f=(l-this.begin)/(this.end-this.begin);return this.property.interpolate(d.possiblyEvaluate(t,r,n),h,function(g){if(g<=0)return 0;if(g>=1)return 1;const x=g*g,v=x*g;return 4*(g<.5?v:3*(g-x)+v-.75)}(f))}}return h}}class bn{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,r,n){const l=new Tn(this._properties);for(const h of Object.keys(this._values))l._values[h]=this._values[h].possiblyEvaluate(t,r,n);return l}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class wn{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return this._values[t].value!==void 0}getValue(t){return at(this._values[t].value)}setValue(t,r){this._values[t]=new Bs(this._values[t].property,r===null?void 0:at(r))}serialize(){const t={};for(const r of Object.keys(this._values)){const n=this.getValue(r);n!==void 0&&(t[r]=n)}return t}possiblyEvaluate(t,r,n){const l=new Tn(this._properties);for(const h of Object.keys(this._values))l._values[h]=this._values[h].possiblyEvaluate(t,r,n);return l}}class hr{constructor(t,r,n){this.property=t,this.value=r,this.parameters=n}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,r,n,l){return this.property.evaluate(this.value,this.parameters,t,r,n,l)}}class Tn{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Ae{constructor(t){this.specification=t}possiblyEvaluate(t,r){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(r)}interpolate(t,r,n){const l=oi[this.specification.type];return l?l(t,r,n):t}}class Re{constructor(t,r){this.specification=t,this.overrides=r}possiblyEvaluate(t,r,n,l){return new hr(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(r,null,{},n,l)}:t.expression,r)}interpolate(t,r,n){if(t.value.kind!=="constant"||r.value.kind!=="constant")return t;if(t.value.value===void 0||r.value.value===void 0)return new hr(this,{kind:"constant",value:void 0},t.parameters);const l=oi[this.specification.type];if(l){const h=l(t.value.value,r.value.value,n);return new hr(this,{kind:"constant",value:h},t.parameters)}return t}evaluate(t,r,n,l,h,d){return t.kind==="constant"?t.value:t.evaluate(r,n,l,h,d)}}class ha extends Re{possiblyEvaluate(t,r,n,l){if(t.value===void 0)return new hr(this,{kind:"constant",value:void 0},r);if(t.expression.kind==="constant"){const h=t.expression.evaluate(r,null,{},n,l),d=t.property.specification.type==="resolvedImage"&&typeof h!="string"?h.name:h,f=this._calculate(d,d,d,r);return new hr(this,{kind:"constant",value:f},r)}if(t.expression.kind==="camera"){const h=this._calculate(t.expression.evaluate({zoom:r.zoom-1}),t.expression.evaluate({zoom:r.zoom}),t.expression.evaluate({zoom:r.zoom+1}),r);return new hr(this,{kind:"constant",value:h},r)}return new hr(this,t.expression,r)}evaluate(t,r,n,l,h,d){if(t.kind==="source"){const f=t.evaluate(r,n,l,h,d);return this._calculate(f,f,f,r)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(r.zoom)-1},n,l),t.evaluate({zoom:Math.floor(r.zoom)},n,l),t.evaluate({zoom:Math.floor(r.zoom)+1},n,l),r):t.value}_calculate(t,r,n,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:n,to:r}}interpolate(t){return t}}class da{constructor(t){this.specification=t}possiblyEvaluate(t,r,n,l){if(t.value!==void 0){if(t.expression.kind==="constant"){const h=t.expression.evaluate(r,null,{},n,l);return this._calculate(h,h,h,r)}return this._calculate(t.expression.evaluate(new pt(Math.floor(r.zoom-1),r)),t.expression.evaluate(new pt(Math.floor(r.zoom),r)),t.expression.evaluate(new pt(Math.floor(r.zoom+1),r)),r)}}_calculate(t,r,n,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:n,to:r}}interpolate(t){return t}}class bo{constructor(t){this.specification=t}possiblyEvaluate(t,r,n,l){return!!t.expression.evaluate(r,null,{},n,l)}interpolate(){return!1}}class u{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in t){const n=t[r];n.specification.overridable&&this.overridableProperties.push(r);const l=this.defaultPropertyValues[r]=new Bs(n,void 0),h=this.defaultTransitionablePropertyValues[r]=new ca(n);this.defaultTransitioningPropertyValues[r]=h.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=l.possiblyEvaluate({})}}}Ie("DataDrivenProperty",Re),Ie("DataConstantProperty",Ae),Ie("CrossFadedDataDrivenProperty",ha),Ie("CrossFadedProperty",da),Ie("ColorRampProperty",bo);const e="-transition";class s extends fs{constructor(t,r){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},t.type!=="custom"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),r.layout&&(this._unevaluatedLayout=new wn(r.layout)),r.paint)){this._transitionablePaint=new ua(r.paint);for(const n in t.paint)this.setPaintProperty(n,t.paint[n],{validate:!1});for(const n in t.layout)this.setLayoutProperty(n,t.layout[n],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Tn(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,r,n={}){r!=null&&this._validate(ml,`layers.${this.id}.layout.${t}`,t,r,n)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,r):this.visibility=r)}getPaintProperty(t){return t.endsWith(e)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,r,n={}){if(r!=null&&this._validate(fl,`layers.${this.id}.paint.${t}`,t,r,n))return!1;if(t.endsWith(e))return this._transitionablePaint.setTransition(t.slice(0,-11),r||void 0),!1;{const l=this._transitionablePaint._values[t],h=l.property.specification["property-type"]==="cross-faded-data-driven",d=l.value.isDataDriven(),f=l.value;this._transitionablePaint.setValue(t,r),this._handleSpecialPaintPropertyUpdate(t);const g=this._transitionablePaint._values[t].value;return g.isDataDriven()||d||h||this._handleOverridablePaintPropertyUpdate(t,f,g)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,r,n){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||this.visibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,r){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,r)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),Ys(t,(r,n)=>!(r===void 0||n==="layout"&&!Object.keys(r).length||n==="paint"&&!Object.keys(r).length))}_validate(t,r,n,l,h={}){return(!h||h.validate!==!1)&&fo(this,t.call(ss,{key:r,layerType:this.type,objectKey:n,value:l,styleSpec:ie,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const r=this.paint.get(t);if(r instanceof hr&&Is(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const a={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class o{constructor(t,r){this._structArray=t,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class c{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,r){return t._trim(),r&&(t.isTransferred=!0,r.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const r=Object.create(this.prototype);return r.arrayBuffer=t.arrayBuffer,r.length=t.length,r.capacity=t.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function m(i,t=1){let r=0,n=0;return{members:i.map(l=>{const h=a[l.type].BYTES_PER_ELEMENT,d=r=_(r,Math.max(t,h)),f=l.components||1;return n=Math.max(n,h),r+=h*f,{name:l.name,type:l.type,components:f,offset:d}}),size:_(r,Math.max(n,t)),alignment:t}}function _(i,t){return Math.ceil(i/t)*t}class y extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,r)}emplace(t,r,n){const l=2*t;return this.int16[l+0]=r,this.int16[l+1]=n,t}}y.prototype.bytesPerElement=4,Ie("StructArrayLayout2i4",y);class b extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,n){const l=this.length;return this.resize(l+1),this.emplace(l,t,r,n)}emplace(t,r,n,l){const h=3*t;return this.int16[h+0]=r,this.int16[h+1]=n,this.int16[h+2]=l,t}}b.prototype.bytesPerElement=6,Ie("StructArrayLayout3i6",b);class T extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,n,l){const h=this.length;return this.resize(h+1),this.emplace(h,t,r,n,l)}emplace(t,r,n,l,h){const d=4*t;return this.int16[d+0]=r,this.int16[d+1]=n,this.int16[d+2]=l,this.int16[d+3]=h,t}}T.prototype.bytesPerElement=8,Ie("StructArrayLayout4i8",T);class S extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,n,l,h,d){const f=this.length;return this.resize(f+1),this.emplace(f,t,r,n,l,h,d)}emplace(t,r,n,l,h,d,f){const g=6*t;return this.int16[g+0]=r,this.int16[g+1]=n,this.int16[g+2]=l,this.int16[g+3]=h,this.int16[g+4]=d,this.int16[g+5]=f,t}}S.prototype.bytesPerElement=12,Ie("StructArrayLayout2i4i12",S);class z extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,n,l,h,d){const f=this.length;return this.resize(f+1),this.emplace(f,t,r,n,l,h,d)}emplace(t,r,n,l,h,d,f){const g=4*t,x=8*t;return this.int16[g+0]=r,this.int16[g+1]=n,this.uint8[x+4]=l,this.uint8[x+5]=h,this.uint8[x+6]=d,this.uint8[x+7]=f,t}}z.prototype.bytesPerElement=8,Ie("StructArrayLayout2i4ub8",z);class D extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,r)}emplace(t,r,n){const l=2*t;return this.float32[l+0]=r,this.float32[l+1]=n,t}}D.prototype.bytesPerElement=8,Ie("StructArrayLayout2f8",D);class R extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,n,l,h,d,f,g,x,v){const w=this.length;return this.resize(w+1),this.emplace(w,t,r,n,l,h,d,f,g,x,v)}emplace(t,r,n,l,h,d,f,g,x,v,w){const I=10*t;return this.uint16[I+0]=r,this.uint16[I+1]=n,this.uint16[I+2]=l,this.uint16[I+3]=h,this.uint16[I+4]=d,this.uint16[I+5]=f,this.uint16[I+6]=g,this.uint16[I+7]=x,this.uint16[I+8]=v,this.uint16[I+9]=w,t}}R.prototype.bytesPerElement=20,Ie("StructArrayLayout10ui20",R);class V extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,n,l,h,d,f,g,x,v,w,I){const M=this.length;return this.resize(M+1),this.emplace(M,t,r,n,l,h,d,f,g,x,v,w,I)}emplace(t,r,n,l,h,d,f,g,x,v,w,I,M){const C=12*t;return this.int16[C+0]=r,this.int16[C+1]=n,this.int16[C+2]=l,this.int16[C+3]=h,this.uint16[C+4]=d,this.uint16[C+5]=f,this.uint16[C+6]=g,this.uint16[C+7]=x,this.int16[C+8]=v,this.int16[C+9]=w,this.int16[C+10]=I,this.int16[C+11]=M,t}}V.prototype.bytesPerElement=24,Ie("StructArrayLayout4i4ui4i24",V);class U extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,n){const l=this.length;return this.resize(l+1),this.emplace(l,t,r,n)}emplace(t,r,n,l){const h=3*t;return this.float32[h+0]=r,this.float32[h+1]=n,this.float32[h+2]=l,t}}U.prototype.bytesPerElement=12,Ie("StructArrayLayout3f12",U);class $ extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint32[1*t+0]=r,t}}$.prototype.bytesPerElement=4,Ie("StructArrayLayout1ul4",$);class Z extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,n,l,h,d,f,g,x){const v=this.length;return this.resize(v+1),this.emplace(v,t,r,n,l,h,d,f,g,x)}emplace(t,r,n,l,h,d,f,g,x,v){const w=10*t,I=5*t;return this.int16[w+0]=r,this.int16[w+1]=n,this.int16[w+2]=l,this.int16[w+3]=h,this.int16[w+4]=d,this.int16[w+5]=f,this.uint32[I+3]=g,this.uint16[w+8]=x,this.uint16[w+9]=v,t}}Z.prototype.bytesPerElement=20,Ie("StructArrayLayout6i1ul2ui20",Z);class B extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,n,l,h,d){const f=this.length;return this.resize(f+1),this.emplace(f,t,r,n,l,h,d)}emplace(t,r,n,l,h,d,f){const g=6*t;return this.int16[g+0]=r,this.int16[g+1]=n,this.int16[g+2]=l,this.int16[g+3]=h,this.int16[g+4]=d,this.int16[g+5]=f,t}}B.prototype.bytesPerElement=12,Ie("StructArrayLayout2i2i2i12",B);class X extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,n,l,h){const d=this.length;return this.resize(d+1),this.emplace(d,t,r,n,l,h)}emplace(t,r,n,l,h,d){const f=4*t,g=8*t;return this.float32[f+0]=r,this.float32[f+1]=n,this.float32[f+2]=l,this.int16[g+6]=h,this.int16[g+7]=d,t}}X.prototype.bytesPerElement=16,Ie("StructArrayLayout2f1f2i16",X);class K extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,n,l,h,d){const f=this.length;return this.resize(f+1),this.emplace(f,t,r,n,l,h,d)}emplace(t,r,n,l,h,d,f){const g=16*t,x=4*t,v=8*t;return this.uint8[g+0]=r,this.uint8[g+1]=n,this.float32[x+1]=l,this.float32[x+2]=h,this.int16[v+6]=d,this.int16[v+7]=f,t}}K.prototype.bytesPerElement=16,Ie("StructArrayLayout2ub2f2i16",K);class ee extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,n){const l=this.length;return this.resize(l+1),this.emplace(l,t,r,n)}emplace(t,r,n,l){const h=3*t;return this.uint16[h+0]=r,this.uint16[h+1]=n,this.uint16[h+2]=l,t}}ee.prototype.bytesPerElement=6,Ie("StructArrayLayout3ui6",ee);class oe extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,n,l,h,d,f,g,x,v,w,I,M,C,k,F,j){const Q=this.length;return this.resize(Q+1),this.emplace(Q,t,r,n,l,h,d,f,g,x,v,w,I,M,C,k,F,j)}emplace(t,r,n,l,h,d,f,g,x,v,w,I,M,C,k,F,j,Q){const G=24*t,J=12*t,re=48*t;return this.int16[G+0]=r,this.int16[G+1]=n,this.uint16[G+2]=l,this.uint16[G+3]=h,this.uint32[J+2]=d,this.uint32[J+3]=f,this.uint32[J+4]=g,this.uint16[G+10]=x,this.uint16[G+11]=v,this.uint16[G+12]=w,this.float32[J+7]=I,this.float32[J+8]=M,this.uint8[re+36]=C,this.uint8[re+37]=k,this.uint8[re+38]=F,this.uint32[J+10]=j,this.int16[G+22]=Q,t}}oe.prototype.bytesPerElement=48,Ie("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",oe);class ue extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,n,l,h,d,f,g,x,v,w,I,M,C,k,F,j,Q,G,J,re,ce,we,Le,ve,ye,Ce,Pe){const Se=this.length;return this.resize(Se+1),this.emplace(Se,t,r,n,l,h,d,f,g,x,v,w,I,M,C,k,F,j,Q,G,J,re,ce,we,Le,ve,ye,Ce,Pe)}emplace(t,r,n,l,h,d,f,g,x,v,w,I,M,C,k,F,j,Q,G,J,re,ce,we,Le,ve,ye,Ce,Pe,Se){const ae=32*t,ke=16*t;return this.int16[ae+0]=r,this.int16[ae+1]=n,this.int16[ae+2]=l,this.int16[ae+3]=h,this.int16[ae+4]=d,this.int16[ae+5]=f,this.int16[ae+6]=g,this.int16[ae+7]=x,this.uint16[ae+8]=v,this.uint16[ae+9]=w,this.uint16[ae+10]=I,this.uint16[ae+11]=M,this.uint16[ae+12]=C,this.uint16[ae+13]=k,this.uint16[ae+14]=F,this.uint16[ae+15]=j,this.uint16[ae+16]=Q,this.uint16[ae+17]=G,this.uint16[ae+18]=J,this.uint16[ae+19]=re,this.uint16[ae+20]=ce,this.uint16[ae+21]=we,this.uint16[ae+22]=Le,this.uint32[ke+12]=ve,this.float32[ke+13]=ye,this.float32[ke+14]=Ce,this.uint16[ae+30]=Pe,this.uint16[ae+31]=Se,t}}ue.prototype.bytesPerElement=64,Ie("StructArrayLayout8i15ui1ul2f2ui64",ue);class xe extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.float32[1*t+0]=r,t}}xe.prototype.bytesPerElement=4,Ie("StructArrayLayout1f4",xe);class Te extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,n){const l=this.length;return this.resize(l+1),this.emplace(l,t,r,n)}emplace(t,r,n,l){const h=3*t;return this.uint16[6*t+0]=r,this.float32[h+1]=n,this.float32[h+2]=l,t}}Te.prototype.bytesPerElement=12,Ie("StructArrayLayout1ui2f12",Te);class fe extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,n){const l=this.length;return this.resize(l+1),this.emplace(l,t,r,n)}emplace(t,r,n,l){const h=4*t;return this.uint32[2*t+0]=r,this.uint16[h+2]=n,this.uint16[h+3]=l,t}}fe.prototype.bytesPerElement=8,Ie("StructArrayLayout1ul2ui8",fe);class pe extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,r)}emplace(t,r,n){const l=2*t;return this.uint16[l+0]=r,this.uint16[l+1]=n,t}}pe.prototype.bytesPerElement=4,Ie("StructArrayLayout2ui4",pe);class Me extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint16[1*t+0]=r,t}}Me.prototype.bytesPerElement=2,Ie("StructArrayLayout1ui2",Me);class Ve extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,n,l){const h=this.length;return this.resize(h+1),this.emplace(h,t,r,n,l)}emplace(t,r,n,l,h){const d=4*t;return this.float32[d+0]=r,this.float32[d+1]=n,this.float32[d+2]=l,this.float32[d+3]=h,t}}Ve.prototype.bytesPerElement=16,Ie("StructArrayLayout4f16",Ve);class _e extends o{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 me(this.anchorPointX,this.anchorPointY)}}_e.prototype.size=20;class be extends Z{get(t){return new _e(this,t)}}Ie("CollisionBoxArray",be);class Fe extends o{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Fe.prototype.size=48;class ft extends oe{get(t){return new Fe(this,t)}}Ie("PlacedSymbolArray",ft);class Ue extends o{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}Ue.prototype.size=64;class He extends ue{get(t){return new Ue(this,t)}}Ie("SymbolInstanceArray",He);class mt extends xe{getoffsetX(t){return this.float32[1*t+0]}}Ie("GlyphOffsetArray",mt);class $t extends b{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Ie("SymbolLineVertexArray",$t);class Zi extends o{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]}}Zi.prototype.size=12;class gt extends Te{get(t){return new Zi(this,t)}}Ie("TextAnchorOffsetArray",gt);class ci extends o{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]}}ci.prototype.size=8;class ti extends fe{get(t){return new ci(this,t)}}Ie("FeatureIndexArray",ti);class qt extends y{}class ii extends y{}class dr extends y{}class Fs extends S{}class pa extends z{}class Os extends D{}class ki extends R{}class fa extends V{}class wo extends U{}class Ei extends ${}class Di extends B{}class Br extends K{}class Gi extends ee{}class Ot extends pe{}const Zt=m([{name:"a_pos",components:2,type:"Int16"}],4),{members:wi}=Zt;class We{constructor(t=[]){this.segments=t}prepareSegment(t,r,n,l){let h=this.segments[this.segments.length-1];return t>We.MAX_VERTEX_ARRAY_LENGTH&&jt(`Max vertices per segment is ${We.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!h||h.vertexLength+t>We.MAX_VERTEX_ARRAY_LENGTH||h.sortKey!==l)&&(h={vertexOffset:r.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},l!==void 0&&(h.sortKey=l),this.segments.push(h)),h}get(){return this.segments}destroy(){for(const t of this.segments)for(const r in t.vaos)t.vaos[r].destroy()}static simpleSegment(t,r,n,l){return new We([{vertexOffset:t,primitiveOffset:r,vertexLength:n,primitiveLength:l,vaos:{},sortKey:0}])}}function ns(i,t){return 256*(i=Bi(Math.floor(i),0,255))+Bi(Math.floor(t),0,255)}We.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ie("SegmentVector",We);const Vs=m([{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 Ns={exports:{}},vl={exports:{}};vl.exports=function(i,t){var r,n,l,h,d,f,g,x;for(n=i.length-(r=3&i.length),l=t,d=3432918353,f=461845907,x=0;x<n;)g=255&i.charCodeAt(x)|(255&i.charCodeAt(++x))<<8|(255&i.charCodeAt(++x))<<16|(255&i.charCodeAt(++x))<<24,++x,l=27492+(65535&(h=5*(65535&(l=(l^=g=(65535&(g=(g=(65535&g)*d+(((g>>>16)*d&65535)<<16)&4294967295)<<15|g>>>17))*f+(((g>>>16)*f&65535)<<16)&4294967295)<<13|l>>>19))+((5*(l>>>16)&65535)<<16)&4294967295))+((58964+(h>>>16)&65535)<<16);switch(g=0,r){case 3:g^=(255&i.charCodeAt(x+2))<<16;case 2:g^=(255&i.charCodeAt(x+1))<<8;case 1:l^=g=(65535&(g=(g=(65535&(g^=255&i.charCodeAt(x)))*d+(((g>>>16)*d&65535)<<16)&4294967295)<<15|g>>>17))*f+(((g>>>16)*f&65535)<<16)&4294967295}return l^=i.length,l=2246822507*(65535&(l^=l>>>16))+((2246822507*(l>>>16)&65535)<<16)&4294967295,l=3266489909*(65535&(l^=l>>>13))+((3266489909*(l>>>16)&65535)<<16)&4294967295,(l^=l>>>16)>>>0};var mc=vl.exports,bl={exports:{}};bl.exports=function(i,t){for(var r,n=i.length,l=t^n,h=0;n>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(h)|(255&i.charCodeAt(++h))<<8|(255&i.charCodeAt(++h))<<16|(255&i.charCodeAt(++h))<<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,++h;switch(n){case 3:l^=(255&i.charCodeAt(h+2))<<16;case 2:l^=(255&i.charCodeAt(h+1))<<8;case 1:l=1540483477*(65535&(l^=255&i.charCodeAt(h)))+((1540483477*(l>>>16)&65535)<<16)}return l=1540483477*(65535&(l^=l>>>13))+((1540483477*(l>>>16)&65535)<<16),(l^=l>>>15)>>>0};var Fr=mc,wl=bl.exports;Ns.exports=Fr,Ns.exports.murmur3=Fr,Ns.exports.murmur2=wl;var ma=Ri(Ns.exports);class Sn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,r,n,l){this.ids.push(ga(t)),this.positions.push(r,n,l)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=ga(t);let n=0,l=this.ids.length-1;for(;n<l;){const d=n+l>>1;this.ids[d]>=r?l=d:n=d+1}const h=[];for(;this.ids[n]===r;)h.push({index:this.positions[3*n],start:this.positions[3*n+1],end:this.positions[3*n+2]}),n++;return h}static serialize(t,r){const n=new Float64Array(t.ids),l=new Uint32Array(t.positions);return _a(n,l,0,n.length-1),r&&r.push(n.buffer,l.buffer),{ids:n,positions:l}}static deserialize(t){const r=new Sn;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}}function ga(i){const t=+i;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:ma(String(i))}function _a(i,t,r,n){for(;r<n;){const l=i[r+n>>1];let h=r-1,d=n+1;for(;;){do h++;while(i[h]<l);do d--;while(i[d]>l);if(h>=d)break;js(i,h,d),js(t,3*h,3*d),js(t,3*h+1,3*d+1),js(t,3*h+2,3*d+2)}d-r<n-d?(_a(i,t,r,d),r=d+1):(_a(i,t,d+1,n),n=d)}}function js(i,t,r){const n=i[t];i[t]=i[r],i[r]=n}Ie("FeaturePositionMap",Sn);class In{constructor(t,r){this.gl=t.gl,this.location=r}}class Tl extends In{constructor(t,r){super(t,r),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class au extends In{constructor(t,r){super(t,r),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class ou extends In{constructor(t,r){super(t,r),this.current=nt.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}const Yh=new Float32Array(16);function gc(i){return[ns(255*i.r,255*i.g),ns(255*i.b,255*i.a)]}class To{constructor(t,r,n){this.value=t,this.uniformNames=r.map(l=>`u_${l}`),this.type=n}setUniform(t,r,n){t.set(n.constantOr(this.value))}getBinding(t,r,n){return this.type==="color"?new ou(t,r):new Tl(t,r)}}class ya{constructor(t,r){this.uniformNames=r.map(n=>`u_${n}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=t.tlbr}setUniform(t,r,n,l){const h=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;h&&t.set(h)}getBinding(t,r,n){return n.substr(0,9)==="u_pattern"?new au(t,r):new Tl(t,r)}}class as{constructor(t,r,n,l){this.expression=t,this.type=n,this.maxValue=0,this.paintVertexAttributes=r.map(h=>({name:`a_${h}`,type:"Float32",components:n==="color"?2:1,offset:0})),this.paintVertexArray=new l}populatePaintArray(t,r,n,l,h){const d=this.paintVertexArray.length,f=this.expression.evaluate(new pt(0),r,{},l,[],h);this.paintVertexArray.resize(t),this._setPaintValue(d,t,f)}updatePaintArray(t,r,n,l){const h=this.expression.evaluate({zoom:0},n,l);this._setPaintValue(t,r,h)}_setPaintValue(t,r,n){if(this.type==="color"){const l=gc(n);for(let h=t;h<r;h++)this.paintVertexArray.emplace(h,l[0],l[1])}else{for(let l=t;l<r;l++)this.paintVertexArray.emplace(l,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Tr{constructor(t,r,n,l,h,d){this.expression=t,this.uniformNames=r.map(f=>`u_${f}_t`),this.type=n,this.useIntegerZoom=l,this.zoom=h,this.maxValue=0,this.paintVertexAttributes=r.map(f=>({name:`a_${f}`,type:"Float32",components:n==="color"?4:2,offset:0})),this.paintVertexArray=new d}populatePaintArray(t,r,n,l,h){const d=this.expression.evaluate(new pt(this.zoom),r,{},l,[],h),f=this.expression.evaluate(new pt(this.zoom+1),r,{},l,[],h),g=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(g,t,d,f)}updatePaintArray(t,r,n,l){const h=this.expression.evaluate({zoom:this.zoom},n,l),d=this.expression.evaluate({zoom:this.zoom+1},n,l);this._setPaintValue(t,r,h,d)}_setPaintValue(t,r,n,l){if(this.type==="color"){const h=gc(n),d=gc(l);for(let f=t;f<r;f++)this.paintVertexArray.emplace(f,h[0],h[1],d[0],d[1])}else{for(let h=t;h<r;h++)this.paintVertexArray.emplace(h,n,l);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(l))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,r){const n=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,l=Bi(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);t.set(l)}getBinding(t,r,n){return new Tl(t,r)}}class Us{constructor(t,r,n,l,h,d){this.expression=t,this.type=r,this.useIntegerZoom=n,this.zoom=l,this.layerId=d,this.zoomInPaintVertexArray=new h,this.zoomOutPaintVertexArray=new h}populatePaintArray(t,r,n){const l=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(l,t,r.patterns&&r.patterns[this.layerId],n)}updatePaintArray(t,r,n,l,h){this._setPaintValues(t,r,n.patterns&&n.patterns[this.layerId],h)}_setPaintValues(t,r,n,l){if(!l||!n)return;const{min:h,mid:d,max:f}=n,g=l[h],x=l[d],v=l[f];if(g&&x&&v)for(let w=t;w<r;w++)this.zoomInPaintVertexArray.emplace(w,x.tl[0],x.tl[1],x.br[0],x.br[1],g.tl[0],g.tl[1],g.br[0],g.br[1],x.pixelRatio,g.pixelRatio),this.zoomOutPaintVertexArray.emplace(w,x.tl[0],x.tl[1],x.br[0],x.br[1],v.tl[0],v.tl[1],v.br[0],v.br[1],x.pixelRatio,v.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,Vs.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,Vs.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class lu{constructor(t,r,n){this.binders={},this._buffers=[];const l=[];for(const h in t.paint._values){if(!n(h))continue;const d=t.paint.get(h);if(!(d instanceof hr&&Is(d.property.specification)))continue;const f=Qh(h,t.type),g=d.value,x=d.property.specification.type,v=d.property.useIntegerZoom,w=d.property.specification["property-type"],I=w==="cross-faded"||w==="cross-faded-data-driven";if(g.kind==="constant")this.binders[h]=I?new ya(g.value,f):new To(g.value,f,x),l.push(`/u_${h}`);else if(g.kind==="source"||I){const M=cu(h,x,"source");this.binders[h]=I?new Us(g,x,v,r,M,t.id):new as(g,f,x,M),l.push(`/a_${h}`)}else{const M=cu(h,x,"composite");this.binders[h]=new Tr(g,f,x,v,r,M),l.push(`/z_${h}`)}}this.cacheKey=l.sort().join("")}getMaxValue(t){const r=this.binders[t];return r instanceof as||r instanceof Tr?r.maxValue:0}populatePaintArrays(t,r,n,l,h){for(const d in this.binders){const f=this.binders[d];(f instanceof as||f instanceof Tr||f instanceof Us)&&f.populatePaintArray(t,r,n,l,h)}}setConstantPatternPositions(t,r){for(const n in this.binders){const l=this.binders[n];l instanceof ya&&l.setConstantPatternPositions(t,r)}}updatePaintArrays(t,r,n,l,h){let d=!1;for(const f in t){const g=r.getPositions(f);for(const x of g){const v=n.feature(x.index);for(const w in this.binders){const I=this.binders[w];if((I instanceof as||I instanceof Tr||I instanceof Us)&&I.expression.isStateDependent===!0){const M=l.paint.get(w);I.expression=M.value,I.updatePaintArray(x.start,x.end,v,t[f],h),d=!0}}}}return d}defines(){const t=[];for(const r in this.binders){const n=this.binders[r];(n instanceof To||n instanceof ya)&&t.push(...n.uniformNames.map(l=>`#define HAS_UNIFORM_${l}`))}return t}getBinderAttributes(){const t=[];for(const r in this.binders){const n=this.binders[r];if(n instanceof as||n instanceof Tr)for(let l=0;l<n.paintVertexAttributes.length;l++)t.push(n.paintVertexAttributes[l].name);else if(n instanceof Us)for(let l=0;l<Vs.members.length;l++)t.push(Vs.members[l].name)}return t}getBinderUniforms(){const t=[];for(const r in this.binders){const n=this.binders[r];if(n instanceof To||n instanceof ya||n instanceof Tr)for(const l of n.uniformNames)t.push(l)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,r){const n=[];for(const l in this.binders){const h=this.binders[l];if(h instanceof To||h instanceof ya||h instanceof Tr){for(const d of h.uniformNames)if(r[d]){const f=h.getBinding(t,r[d],d);n.push({name:d,property:l,binding:f})}}}return n}setUniforms(t,r,n,l){for(const{name:h,property:d,binding:f}of r)this.binders[d].setUniform(f,l,n.get(d),h)}updatePaintBuffers(t){this._buffers=[];for(const r in this.binders){const n=this.binders[r];if(t&&n instanceof Us){const l=t.fromScale===2?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;l&&this._buffers.push(l)}else(n instanceof as||n instanceof Tr)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer)}}upload(t){for(const r in this.binders){const n=this.binders[r];(n instanceof as||n instanceof Tr||n instanceof Us)&&n.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const r=this.binders[t];(r instanceof as||r instanceof Tr||r instanceof Us)&&r.destroy()}}}class Pn{constructor(t,r,n=()=>!0){this.programConfigurations={};for(const l of t)this.programConfigurations[l.id]=new lu(l,r,n);this.needsUpload=!1,this._featureMap=new Sn,this._bufferOffset=0}populatePaintArrays(t,r,n,l,h,d){for(const f in this.programConfigurations)this.programConfigurations[f].populatePaintArrays(t,r,l,h,d);r.id!==void 0&&this._featureMap.add(r.id,n,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,r,n,l){for(const h of n)this.needsUpload=this.programConfigurations[h.id].updatePaintArrays(t,this._featureMap,r,h,l)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function Qh(i,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[i]||[i.replace(`${t}-`,"").replace(/-/g,"_")]}function cu(i,t,r){const n={color:{source:D,composite:Ve},number:{source:xe,composite:D}},l=function(h){return{"line-pattern":{source:ki,composite:ki},"fill-pattern":{source:ki,composite:ki},"fill-extrusion-pattern":{source:ki,composite:ki}}[h]}(i);return l&&l[r]||n[t][r]}Ie("ConstantBinder",To),Ie("CrossFadedConstantBinder",ya),Ie("SourceExpressionBinder",as),Ie("CrossFadedCompositeBinder",Us),Ie("CompositeExpressionBinder",Tr),Ie("ProgramConfiguration",lu,{omit:["_buffers"]}),Ie("ProgramConfigurationSet",Pn);const Ct=8192,_c=Math.pow(2,14)-1,uu=-_c-1;function An(i){const t=Ct/i.extent,r=i.loadGeometry();for(let n=0;n<r.length;n++){const l=r[n];for(let h=0;h<l.length;h++){const d=l[h],f=Math.round(d.x*t),g=Math.round(d.y*t);d.x=Bi(f,uu,_c),d.y=Bi(g,uu,_c),(f<d.x||f>d.x+1||g<d.y||g>d.y+1)&&jt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Mn(i,t){return{type:i.type,id:i.id,properties:i.properties,geometry:t?An(i):[]}}function Sl(i,t,r,n,l){i.emplaceBack(2*t+(n+1)/2,2*r+(l+1)/2)}class yc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new ii,this.indexArray=new Gi,this.segments=new We,this.programConfigurations=new Pn(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,n){const l=this.layers[0],h=[];let d=null,f=!1;l.type==="circle"&&(d=l.layout.get("circle-sort-key"),f=!d.isConstant());for(const{feature:g,id:x,index:v,sourceLayerIndex:w}of t){const I=this.layers[0]._featureFilter.needGeometry,M=Mn(g,I);if(!this.layers[0]._featureFilter.filter(new pt(this.zoom),M,n))continue;const C=f?d.evaluate(M,{},n):void 0,k={id:x,properties:g.properties,type:g.type,sourceLayerIndex:w,index:v,geometry:I?M.geometry:An(g),patterns:{},sortKey:C};h.push(k)}f&&h.sort((g,x)=>g.sortKey-x.sortKey);for(const g of h){const{geometry:x,index:v,sourceLayerIndex:w}=g,I=t[v].feature;this.addFeature(g,x,v,n),r.featureIndex.insert(I,x,v,w,this.index)}}update(t,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,wi),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,r,n,l){for(const h of r)for(const d of h){const f=d.x,g=d.y;if(f<0||f>=Ct||g<0||g>=Ct)continue;const x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),v=x.vertexLength;Sl(this.layoutVertexArray,f,g,-1,-1),Sl(this.layoutVertexArray,f,g,1,-1),Sl(this.layoutVertexArray,f,g,1,1),Sl(this.layoutVertexArray,f,g,-1,1),this.indexArray.emplaceBack(v,v+1,v+2),this.indexArray.emplaceBack(v,v+3,v+2),x.vertexLength+=4,x.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,{},l)}}function hu(i,t){for(let r=0;r<i.length;r++)if(xa(t,i[r]))return!0;for(let r=0;r<t.length;r++)if(xa(i,t[r]))return!0;return!!xc(i,t)}function ed(i,t,r){return!!xa(i,t)||!!vc(t,i,r)}function du(i,t){if(i.length===1)return fu(t,i[0]);for(let r=0;r<t.length;r++){const n=t[r];for(let l=0;l<n.length;l++)if(xa(i,n[l]))return!0}for(let r=0;r<i.length;r++)if(fu(t,i[r]))return!0;for(let r=0;r<t.length;r++)if(xc(i,t[r]))return!0;return!1}function td(i,t,r){if(i.length>1){if(xc(i,t))return!0;for(let n=0;n<t.length;n++)if(vc(t[n],i,r))return!0}for(let n=0;n<i.length;n++)if(vc(i[n],t,r))return!0;return!1}function xc(i,t){if(i.length===0||t.length===0)return!1;for(let r=0;r<i.length-1;r++){const n=i[r],l=i[r+1];for(let h=0;h<t.length-1;h++)if(id(n,l,t[h],t[h+1]))return!0}return!1}function id(i,t,r,n){return Yt(i,r,n)!==Yt(t,r,n)&&Yt(i,t,r)!==Yt(i,t,n)}function vc(i,t,r){const n=r*r;if(t.length===1)return i.distSqr(t[0])<n;for(let l=1;l<t.length;l++)if(pu(i,t[l-1],t[l])<n)return!0;return!1}function pu(i,t,r){const n=t.distSqr(r);if(n===0)return i.distSqr(t);const l=((i.x-t.x)*(r.x-t.x)+(i.y-t.y)*(r.y-t.y))/n;return i.distSqr(l<0?t:l>1?r:r.sub(t)._mult(l)._add(t))}function fu(i,t){let r,n,l,h=!1;for(let d=0;d<i.length;d++){r=i[d];for(let f=0,g=r.length-1;f<r.length;g=f++)n=r[f],l=r[g],n.y>t.y!=l.y>t.y&&t.x<(l.x-n.x)*(t.y-n.y)/(l.y-n.y)+n.x&&(h=!h)}return h}function xa(i,t){let r=!1;for(let n=0,l=i.length-1;n<i.length;l=n++){const h=i[n],d=i[l];h.y>t.y!=d.y>t.y&&t.x<(d.x-h.x)*(t.y-h.y)/(d.y-h.y)+h.x&&(r=!r)}return r}function rd(i,t,r){const n=r[0],l=r[2];if(i.x<n.x&&t.x<n.x||i.x>l.x&&t.x>l.x||i.y<n.y&&t.y<n.y||i.y>l.y&&t.y>l.y)return!1;const h=Yt(i,t,r[0]);return h!==Yt(i,t,r[1])||h!==Yt(i,t,r[2])||h!==Yt(i,t,r[3])}function So(i,t,r){const n=t.paint.get(i).value;return n.kind==="constant"?n.value:r.programConfigurations.get(t.id).getMaxValue(i)}function Il(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function Pl(i,t,r,n,l){if(!t[0]&&!t[1])return i;const h=me.convert(t)._mult(l);r==="viewport"&&h._rotate(-n);const d=[];for(let f=0;f<i.length;f++)d.push(i[f].sub(h));return d}let mu,gu;Ie("CircleBucket",yc,{omit:["layers"]});var sd={get paint(){return gu=gu||new u({"circle-radius":new Re(ie.paint_circle["circle-radius"]),"circle-color":new Re(ie.paint_circle["circle-color"]),"circle-blur":new Re(ie.paint_circle["circle-blur"]),"circle-opacity":new Re(ie.paint_circle["circle-opacity"]),"circle-translate":new Ae(ie.paint_circle["circle-translate"]),"circle-translate-anchor":new Ae(ie.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ae(ie.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ae(ie.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Re(ie.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Re(ie.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Re(ie.paint_circle["circle-stroke-opacity"])})},get layout(){return mu=mu||new u({"circle-sort-key":new Re(ie.layout_circle["circle-sort-key"])})}},ui=1e-6,va=typeof Float32Array<"u"?Float32Array:Array;function bc(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 _u(i,t,r){var n=t[0],l=t[1],h=t[2],d=t[3],f=t[4],g=t[5],x=t[6],v=t[7],w=t[8],I=t[9],M=t[10],C=t[11],k=t[12],F=t[13],j=t[14],Q=t[15],G=r[0],J=r[1],re=r[2],ce=r[3];return i[0]=G*n+J*f+re*w+ce*k,i[1]=G*l+J*g+re*I+ce*F,i[2]=G*h+J*x+re*M+ce*j,i[3]=G*d+J*v+re*C+ce*Q,i[4]=(G=r[4])*n+(J=r[5])*f+(re=r[6])*w+(ce=r[7])*k,i[5]=G*l+J*g+re*I+ce*F,i[6]=G*h+J*x+re*M+ce*j,i[7]=G*d+J*v+re*C+ce*Q,i[8]=(G=r[8])*n+(J=r[9])*f+(re=r[10])*w+(ce=r[11])*k,i[9]=G*l+J*g+re*I+ce*F,i[10]=G*h+J*x+re*M+ce*j,i[11]=G*d+J*v+re*C+ce*Q,i[12]=(G=r[12])*n+(J=r[13])*f+(re=r[14])*w+(ce=r[15])*k,i[13]=G*l+J*g+re*I+ce*F,i[14]=G*h+J*x+re*M+ce*j,i[15]=G*d+J*v+re*C+ce*Q,i}Math.hypot||(Math.hypot=function(){for(var i=0,t=arguments.length;t--;)i+=arguments[t]*arguments[t];return Math.sqrt(i)});var Io,nd=_u;function Al(i,t,r){var n=t[0],l=t[1],h=t[2],d=t[3];return i[0]=r[0]*n+r[4]*l+r[8]*h+r[12]*d,i[1]=r[1]*n+r[5]*l+r[9]*h+r[13]*d,i[2]=r[2]*n+r[6]*l+r[10]*h+r[14]*d,i[3]=r[3]*n+r[7]*l+r[11]*h+r[15]*d,i}Io=new va(4),va!=Float32Array&&(Io[0]=0,Io[1]=0,Io[2]=0,Io[3]=0);class ad extends s{constructor(t){super(t,sd)}createBucket(t){return new yc(t)}queryRadius(t){const r=t;return So("circle-radius",this,r)+So("circle-stroke-width",this,r)+Il(this.paint.get("circle-translate"))}queryIntersectsFeature(t,r,n,l,h,d,f,g){const x=Pl(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),d.angle,f),v=this.paint.get("circle-radius").evaluate(r,n)+this.paint.get("circle-stroke-width").evaluate(r,n),w=this.paint.get("circle-pitch-alignment")==="map",I=w?x:function(C,k){return C.map(F=>yu(F,k))}(x,g),M=w?v*f:v;for(const C of l)for(const k of C){const F=w?k:yu(k,g);let j=M;const Q=Al([],[k.x,k.y,0,1],g);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?j*=Q[3]/d.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(j*=d.cameraToCenterDistance/Q[3]),ed(I,F,j))return!0}return!1}}function yu(i,t){const r=Al([],[i.x,i.y,0,1],t);return new me(r[0]/r[3],r[1]/r[3])}class xu extends yc{}let vu;Ie("HeatmapBucket",xu,{omit:["layers"]});var od={get paint(){return vu=vu||new u({"heatmap-radius":new Re(ie.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Re(ie.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ae(ie.paint_heatmap["heatmap-intensity"]),"heatmap-color":new bo(ie.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ae(ie.paint_heatmap["heatmap-opacity"])})}};function wc(i,{width:t,height:r},n,l){if(l){if(l instanceof Uint8ClampedArray)l=new Uint8Array(l.buffer);else if(l.length!==t*r*n)throw new RangeError(`mismatched image size. expected: ${l.length} but got: ${t*r*n}`)}else l=new Uint8Array(t*r*n);return i.width=t,i.height=r,i.data=l,i}function bu(i,{width:t,height:r},n){if(t===i.width&&r===i.height)return;const l=wc({},{width:t,height:r},n);Tc(i,l,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,t),height:Math.min(i.height,r)},n),i.width=t,i.height=r,i.data=l.data}function Tc(i,t,r,n,l,h){if(l.width===0||l.height===0)return t;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>t.width||l.height>t.height||n.x>t.width-l.width||n.y>t.height-l.height)throw new RangeError("out of range destination coordinates for image copy");const d=i.data,f=t.data;if(d===f)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g<l.height;g++){const x=((r.y+g)*i.width+r.x)*h,v=((n.y+g)*t.width+n.x)*h;for(let w=0;w<l.width*h;w++)f[v+w]=d[x+w]}return t}class Po{constructor(t,r){wc(this,t,1,r)}resize(t){bu(this,t,1)}clone(){return new Po({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,n,l,h){Tc(t,r,n,l,h,1)}}class Hi{constructor(t,r){wc(this,t,4,r)}resize(t){bu(this,t,4)}replace(t,r){r?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new Hi({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,n,l,h){Tc(t,r,n,l,h,4)}}function wu(i){const t={},r=i.resolution||256,n=i.clips?i.clips.length:1,l=i.image||new Hi({width:r,height:n});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const h=(d,f,g)=>{t[i.evaluationKey]=g;const x=i.expression.evaluate(t);l.data[d+f+0]=Math.floor(255*x.r/x.a),l.data[d+f+1]=Math.floor(255*x.g/x.a),l.data[d+f+2]=Math.floor(255*x.b/x.a),l.data[d+f+3]=Math.floor(255*x.a)};if(i.clips)for(let d=0,f=0;d<n;++d,f+=4*r)for(let g=0,x=0;g<r;g++,x+=4){const v=g/(r-1),{start:w,end:I}=i.clips[d];h(f,x,w*(1-v)+I*v)}else for(let d=0,f=0;d<r;d++,f+=4)h(0,f,d/(r-1));return l}Ie("AlphaImage",Po),Ie("RGBAImage",Hi);const Sc="big-fb";class ld extends s{createBucket(t){return new xu(t)}constructor(t){super(t,od),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=wu({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Sc)&&this.heatmapFbos.delete(Sc)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let Tu;var cd={get paint(){return Tu=Tu||new u({"hillshade-illumination-direction":new Ae(ie.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ae(ie.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ae(ie.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ae(ie.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ae(ie.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ae(ie.paint_hillshade["hillshade-accent-color"])})}};class ud extends s{constructor(t){super(t,cd)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const hd=m([{name:"a_pos",components:2,type:"Int16"}],4),{members:dd}=hd;function Su(i,t,r=2){const n=t&&t.length,l=n?t[0]*r:i.length;let h=Iu(i,0,l,r,!0);const d=[];if(!h||h.next===h.prev)return d;let f,g,x;if(n&&(h=function(v,w,I,M){const C=[];for(let k=0,F=w.length;k<F;k++){const j=Iu(v,w[k]*M,k<F-1?w[k+1]*M:v.length,M,!1);j===j.next&&(j.steiner=!0),C.push(vd(j))}C.sort(_d);for(let k=0;k<C.length;k++)I=yd(C[k],I);return I}(i,t,h,r)),i.length>80*r){f=1/0,g=1/0;let v=-1/0,w=-1/0;for(let I=r;I<l;I+=r){const M=i[I],C=i[I+1];M<f&&(f=M),C<g&&(g=C),M>v&&(v=M),C>w&&(w=C)}x=Math.max(v-f,w-g),x=x!==0?32767/x:0}return Ao(h,d,r,f,g,x,0),d}function Iu(i,t,r,n,l){let h;if(l===function(d,f,g,x){let v=0;for(let w=f,I=g-x;w<g;w+=x)v+=(d[I]-d[w])*(d[w+1]+d[I+1]),I=w;return v}(i,t,r,n)>0)for(let d=t;d<r;d+=n)h=Mu(d/n|0,i[d],i[d+1],h);else for(let d=r-n;d>=t;d-=n)h=Mu(d/n|0,i[d],i[d+1],h);return h&&Ml(h,h.next)&&(zo(h),h=h.next),h}function zn(i,t){if(!i)return i;t||(t=i);let r,n=i;do if(r=!1,n.steiner||!Ml(n,n.next)&&At(n.prev,n,n.next)!==0)n=n.next;else{if(zo(n),n=t=n.prev,n===n.next)break;r=!0}while(r||n!==t);return t}function Ao(i,t,r,n,l,h,d){if(!i)return;!d&&h&&function(g,x,v,w){let I=g;do I.z===0&&(I.z=Ic(I.x,I.y,x,v,w)),I.prevZ=I.prev,I.nextZ=I.next,I=I.next;while(I!==g);I.prevZ.nextZ=null,I.prevZ=null,function(M){let C,k=1;do{let F,j=M;M=null;let Q=null;for(C=0;j;){C++;let G=j,J=0;for(let ce=0;ce<k&&(J++,G=G.nextZ,G);ce++);let re=k;for(;J>0||re>0&&G;)J!==0&&(re===0||!G||j.z<=G.z)?(F=j,j=j.nextZ,J--):(F=G,G=G.nextZ,re--),Q?Q.nextZ=F:M=F,F.prevZ=Q,Q=F;j=G}Q.nextZ=null,k*=2}while(C>1)}(I)}(i,n,l,h);let f=i;for(;i.prev!==i.next;){const g=i.prev,x=i.next;if(h?fd(i,n,l,h):pd(i))t.push(g.i,i.i,x.i),zo(i),i=x.next,f=x.next;else if((i=x)===f){d?d===1?Ao(i=md(zn(i),t),t,r,n,l,h,2):d===2&&gd(i,t,r,n,l,h):Ao(zn(i),t,r,n,l,h,1);break}}}function pd(i){const t=i.prev,r=i,n=i.next;if(At(t,r,n)>=0)return!1;const l=t.x,h=r.x,d=n.x,f=t.y,g=r.y,x=n.y,v=l<h?l<d?l:d:h<d?h:d,w=f<g?f<x?f:x:g<x?g:x,I=l>h?l>d?l:d:h>d?h:d,M=f>g?f>x?f:x:g>x?g:x;let C=n.next;for(;C!==t;){if(C.x>=v&&C.x<=I&&C.y>=w&&C.y<=M&&ba(l,f,h,g,d,x,C.x,C.y)&&At(C.prev,C,C.next)>=0)return!1;C=C.next}return!0}function fd(i,t,r,n){const l=i.prev,h=i,d=i.next;if(At(l,h,d)>=0)return!1;const f=l.x,g=h.x,x=d.x,v=l.y,w=h.y,I=d.y,M=f<g?f<x?f:x:g<x?g:x,C=v<w?v<I?v:I:w<I?w:I,k=f>g?f>x?f:x:g>x?g:x,F=v>w?v>I?v:I:w>I?w:I,j=Ic(M,C,t,r,n),Q=Ic(k,F,t,r,n);let G=i.prevZ,J=i.nextZ;for(;G&&G.z>=j&&J&&J.z<=Q;){if(G.x>=M&&G.x<=k&&G.y>=C&&G.y<=F&&G!==l&&G!==d&&ba(f,v,g,w,x,I,G.x,G.y)&&At(G.prev,G,G.next)>=0||(G=G.prevZ,J.x>=M&&J.x<=k&&J.y>=C&&J.y<=F&&J!==l&&J!==d&&ba(f,v,g,w,x,I,J.x,J.y)&&At(J.prev,J,J.next)>=0))return!1;J=J.nextZ}for(;G&&G.z>=j;){if(G.x>=M&&G.x<=k&&G.y>=C&&G.y<=F&&G!==l&&G!==d&&ba(f,v,g,w,x,I,G.x,G.y)&&At(G.prev,G,G.next)>=0)return!1;G=G.prevZ}for(;J&&J.z<=Q;){if(J.x>=M&&J.x<=k&&J.y>=C&&J.y<=F&&J!==l&&J!==d&&ba(f,v,g,w,x,I,J.x,J.y)&&At(J.prev,J,J.next)>=0)return!1;J=J.nextZ}return!0}function md(i,t){let r=i;do{const n=r.prev,l=r.next.next;!Ml(n,l)&&Pu(n,r,r.next,l)&&Mo(n,l)&&Mo(l,n)&&(t.push(n.i,r.i,l.i),zo(r),zo(r.next),r=i=l),r=r.next}while(r!==i);return zn(r)}function gd(i,t,r,n,l,h){let d=i;do{let f=d.next.next;for(;f!==d.prev;){if(d.i!==f.i&&bd(d,f)){let g=Au(d,f);return d=zn(d,d.next),g=zn(g,g.next),Ao(d,t,r,n,l,h,0),void Ao(g,t,r,n,l,h,0)}f=f.next}d=d.next}while(d!==i)}function _d(i,t){return i.x-t.x}function yd(i,t){const r=function(l,h){let d=h;const f=l.x,g=l.y;let x,v=-1/0;do{if(g<=d.y&&g>=d.next.y&&d.next.y!==d.y){const k=d.x+(g-d.y)*(d.next.x-d.x)/(d.next.y-d.y);if(k<=f&&k>v&&(v=k,x=d.x<d.next.x?d:d.next,k===f))return x}d=d.next}while(d!==h);if(!x)return null;const w=x,I=x.x,M=x.y;let C=1/0;d=x;do{if(f>=d.x&&d.x>=I&&f!==d.x&&ba(g<M?f:v,g,I,M,g<M?v:f,g,d.x,d.y)){const k=Math.abs(g-d.y)/(f-d.x);Mo(d,l)&&(k<C||k===C&&(d.x>x.x||d.x===x.x&&xd(x,d)))&&(x=d,C=k)}d=d.next}while(d!==w);return x}(i,t);if(!r)return t;const n=Au(r,i);return zn(n,n.next),zn(r,r.next)}function xd(i,t){return At(i.prev,i,t.prev)<0&&At(t.next,i,i.next)<0}function Ic(i,t,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))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*l|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function vd(i){let t=i,r=i;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==i);return r}function ba(i,t,r,n,l,h,d,f){return(l-d)*(t-f)>=(i-d)*(h-f)&&(i-d)*(n-f)>=(r-d)*(t-f)&&(r-d)*(h-f)>=(l-d)*(n-f)}function bd(i,t){return i.next.i!==t.i&&i.prev.i!==t.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&&Pu(l,l.next,r,n))return!0;l=l.next}while(l!==r);return!1}(i,t)&&(Mo(i,t)&&Mo(t,i)&&function(r,n){let l=r,h=!1;const d=(r.x+n.x)/2,f=(r.y+n.y)/2;do l.y>f!=l.next.y>f&&l.next.y!==l.y&&d<(l.next.x-l.x)*(f-l.y)/(l.next.y-l.y)+l.x&&(h=!h),l=l.next;while(l!==r);return h}(i,t)&&(At(i.prev,i,t.prev)||At(i,t.prev,t))||Ml(i,t)&&At(i.prev,i,i.next)>0&&At(t.prev,t,t.next)>0)}function At(i,t,r){return(t.y-i.y)*(r.x-t.x)-(t.x-i.x)*(r.y-t.y)}function Ml(i,t){return i.x===t.x&&i.y===t.y}function Pu(i,t,r,n){const l=Cl(At(i,t,r)),h=Cl(At(i,t,n)),d=Cl(At(r,n,i)),f=Cl(At(r,n,t));return l!==h&&d!==f||!(l!==0||!zl(i,r,t))||!(h!==0||!zl(i,n,t))||!(d!==0||!zl(r,i,n))||!(f!==0||!zl(r,t,n))}function zl(i,t,r){return t.x<=Math.max(i.x,r.x)&&t.x>=Math.min(i.x,r.x)&&t.y<=Math.max(i.y,r.y)&&t.y>=Math.min(i.y,r.y)}function Cl(i){return i>0?1:i<0?-1:0}function Mo(i,t){return At(i.prev,i,i.next)<0?At(i,t,i.next)>=0&&At(i,i.prev,t)>=0:At(i,t,i.prev)<0||At(i,i.next,t)<0}function Au(i,t){const r=Pc(i.i,i.x,i.y),n=Pc(t.i,t.x,t.y),l=i.next,h=t.prev;return i.next=t,t.prev=i,r.next=l,l.prev=r,n.next=r,r.prev=n,h.next=n,n.prev=h,n}function Mu(i,t,r,n){const l=Pc(i,t,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 zo(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 Pc(i,t,r){return{i,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Ac(i,t,r){const n=r.patternDependencies;let l=!1;for(const h of t){const d=h.paint.get(`${i}-pattern`);d.isConstant()||(l=!0);const f=d.constantOr(null);f&&(l=!0,n[f.to]=!0,n[f.from]=!0)}return l}function Mc(i,t,r,n,l){const h=l.patternDependencies;for(const d of t){const f=d.paint.get(`${i}-pattern`).value;if(f.kind!=="constant"){let g=f.evaluate({zoom:n-1},r,{},l.availableImages),x=f.evaluate({zoom:n},r,{},l.availableImages),v=f.evaluate({zoom:n+1},r,{},l.availableImages);g=g&&g.name?g.name:g,x=x&&x.name?x.name:x,v=v&&v.name?v.name:v,h[g]=!0,h[x]=!0,h[v]=!0,r.patterns[d.id]={min:g,mid:x,max:v}}}return r}class zc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new dr,this.indexArray=new Gi,this.indexArray2=new Ot,this.programConfigurations=new Pn(t.layers,t.zoom),this.segments=new We,this.segments2=new We,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,n){this.hasPattern=Ac("fill",this.layers,r);const l=this.layers[0].layout.get("fill-sort-key"),h=!l.isConstant(),d=[];for(const{feature:f,id:g,index:x,sourceLayerIndex:v}of t){const w=this.layers[0]._featureFilter.needGeometry,I=Mn(f,w);if(!this.layers[0]._featureFilter.filter(new pt(this.zoom),I,n))continue;const M=h?l.evaluate(I,{},n,r.availableImages):void 0,C={id:g,properties:f.properties,type:f.type,sourceLayerIndex:v,index:x,geometry:w?I.geometry:An(f),patterns:{},sortKey:M};d.push(C)}h&&d.sort((f,g)=>f.sortKey-g.sortKey);for(const f of d){const{geometry:g,index:x,sourceLayerIndex:v}=f;if(this.hasPattern){const w=Mc("fill",this.layers,f,this.zoom,r);this.patternFeatures.push(w)}else this.addFeature(f,g,x,n,{});r.featureIndex.insert(t[x].feature,g,x,v,this.index)}}update(t,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,n)}addFeatures(t,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(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,dd),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,r,n,l,h){for(const d of Zn(r,500)){let f=0;for(const M of d)f+=M.length;const g=this.segments.prepareSegment(f,this.layoutVertexArray,this.indexArray),x=g.vertexLength,v=[],w=[];for(const M of d){if(M.length===0)continue;M!==d[0]&&w.push(v.length/2);const C=this.segments2.prepareSegment(M.length,this.layoutVertexArray,this.indexArray2),k=C.vertexLength;this.layoutVertexArray.emplaceBack(M[0].x,M[0].y),this.indexArray2.emplaceBack(k+M.length-1,k),v.push(M[0].x),v.push(M[0].y);for(let F=1;F<M.length;F++)this.layoutVertexArray.emplaceBack(M[F].x,M[F].y),this.indexArray2.emplaceBack(k+F-1,k+F),v.push(M[F].x),v.push(M[F].y);C.vertexLength+=M.length,C.primitiveLength+=M.length}const I=Su(v,w);for(let M=0;M<I.length;M+=3)this.indexArray.emplaceBack(x+I[M],x+I[M+1],x+I[M+2]);g.vertexLength+=f,g.primitiveLength+=I.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,h,l)}}let zu,Cu;Ie("FillBucket",zc,{omit:["layers","patternFeatures"]});var wd={get paint(){return Cu=Cu||new u({"fill-antialias":new Ae(ie.paint_fill["fill-antialias"]),"fill-opacity":new Re(ie.paint_fill["fill-opacity"]),"fill-color":new Re(ie.paint_fill["fill-color"]),"fill-outline-color":new Re(ie.paint_fill["fill-outline-color"]),"fill-translate":new Ae(ie.paint_fill["fill-translate"]),"fill-translate-anchor":new Ae(ie.paint_fill["fill-translate-anchor"]),"fill-pattern":new ha(ie.paint_fill["fill-pattern"])})},get layout(){return zu=zu||new u({"fill-sort-key":new Re(ie.layout_fill["fill-sort-key"])})}};class Td extends s{constructor(t){super(t,wd)}recalculate(t,r){super.recalculate(t,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(t){return new zc(t)}queryRadius(){return Il(this.paint.get("fill-translate"))}queryIntersectsFeature(t,r,n,l,h,d,f){return du(Pl(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),d.angle,f),l)}isTileClipped(){return!0}}const Sd=m([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Id=m([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Pd}=Sd;var $s={},Ad=Qi,ku=wa;function wa(i,t,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(Md,this,t)}function Md(i,t,r){i==1?t.id=r.readVarint():i==2?function(n,l){for(var h=n.readVarint()+n.pos;n.pos<h;){var d=l._keys[n.readVarint()],f=l._values[n.readVarint()];l.properties[d]=f}}(r,t):i==3?t.type=r.readVarint():i==4&&(t._geometry=r.pos)}function zd(i){for(var t,r,n=0,l=0,h=i.length,d=h-1;l<h;d=l++)n+=((r=i[d]).x-(t=i[l]).x)*(t.y+r.y);return n}wa.types=["Unknown","Point","LineString","Polygon"],wa.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var t,r=i.readVarint()+i.pos,n=1,l=0,h=0,d=0,f=[];i.pos<r;){if(l<=0){var g=i.readVarint();n=7&g,l=g>>3}if(l--,n===1||n===2)h+=i.readSVarint(),d+=i.readSVarint(),n===1&&(t&&f.push(t),t=[]),t.push(new Ad(h,d));else{if(n!==7)throw new Error("unknown command "+n);t&&t.push(t[0].clone())}}return t&&f.push(t),f},wa.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var t=i.readVarint()+i.pos,r=1,n=0,l=0,h=0,d=1/0,f=-1/0,g=1/0,x=-1/0;i.pos<t;){if(n<=0){var v=i.readVarint();r=7&v,n=v>>3}if(n--,r===1||r===2)(l+=i.readSVarint())<d&&(d=l),l>f&&(f=l),(h+=i.readSVarint())<g&&(g=h),h>x&&(x=h);else if(r!==7)throw new Error("unknown command "+r)}return[d,g,f,x]},wa.prototype.toGeoJSON=function(i,t,r){var n,l,h=this.extent*Math.pow(2,r),d=this.extent*i,f=this.extent*t,g=this.loadGeometry(),x=wa.types[this.type];function v(M){for(var C=0;C<M.length;C++){var k=M[C];M[C]=[360*(k.x+d)/h-180,360/Math.PI*Math.atan(Math.exp((180-360*(k.y+f)/h)*Math.PI/180))-90]}}switch(this.type){case 1:var w=[];for(n=0;n<g.length;n++)w[n]=g[n][0];v(g=w);break;case 2:for(n=0;n<g.length;n++)v(g[n]);break;case 3:for(g=function(M){var C=M.length;if(C<=1)return[M];for(var k,F,j=[],Q=0;Q<C;Q++){var G=zd(M[Q]);G!==0&&(F===void 0&&(F=G<0),F===G<0?(k&&j.push(k),k=[M[Q]]):k.push(M[Q]))}return k&&j.push(k),j}(g),n=0;n<g.length;n++)for(l=0;l<g[n].length;l++)v(g[n][l])}g.length===1?g=g[0]:x="Multi"+x;var I={type:"Feature",geometry:{type:x,coordinates:g},properties:this.properties};return"id"in this&&(I.id=this.id),I};var Cd=ku,Eu=Du;function Du(i,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(kd,this,t),this.length=this._features.length}function kd(i,t,r){i===15?t.version=r.readVarint():i===1?t.name=r.readString():i===5?t.extent=r.readVarint():i===2?t._features.push(r.pos):i===3?t._keys.push(r.readString()):i===4&&t._values.push(function(n){for(var l=null,h=n.readVarint()+n.pos;n.pos<h;){var d=n.readVarint()>>3;l=d===1?n.readString():d===2?n.readFloat():d===3?n.readDouble():d===4?n.readVarint64():d===5?n.readVarint():d===6?n.readSVarint():d===7?n.readBoolean():null}return l}(r))}Du.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var t=this._pbf.readVarint()+this._pbf.pos;return new Cd(this._pbf,t,this.extent,this._keys,this._values)};var Ed=Eu;function Dd(i,t,r){if(i===3){var n=new Ed(r,r.readVarint()+r.pos);n.length&&(t[n.name]=n)}}$s.VectorTile=function(i,t){this.layers=i.readFields(Dd,{},t)},$s.VectorTileFeature=ku,$s.VectorTileLayer=Eu;const Ld=$s.VectorTileFeature.types,Cc=Math.pow(2,13);function Co(i,t,r,n,l,h,d,f){i.emplaceBack(t,r,2*Math.floor(n*Cc)+d,l*Cc*2,h*Cc*2,Math.round(f))}class kc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Fs,this.centroidVertexArray=new qt,this.indexArray=new Gi,this.programConfigurations=new Pn(t.layers,t.zoom),this.segments=new We,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,n){this.features=[],this.hasPattern=Ac("fill-extrusion",this.layers,r);for(const{feature:l,id:h,index:d,sourceLayerIndex:f}of t){const g=this.layers[0]._featureFilter.needGeometry,x=Mn(l,g);if(!this.layers[0]._featureFilter.filter(new pt(this.zoom),x,n))continue;const v={id:h,sourceLayerIndex:f,index:d,geometry:g?x.geometry:An(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(Mc("fill-extrusion",this.layers,v,this.zoom,r)):this.addFeature(v,v.geometry,d,n,{}),r.featureIndex.insert(l,v.geometry,d,f,this.index,!0)}}addFeatures(t,r,n){for(const l of this.features){const{geometry:h}=l;this.addFeature(l,h,l.index,r,n)}}update(t,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Pd),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Id.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,r,n,l,h){for(const d of Zn(r,500)){const f={x:0,y:0,vertexCount:0};let g=0;for(const C of d)g+=C.length;let x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const C of d){if(C.length===0||Bd(C))continue;let k=0;for(let F=0;F<C.length;F++){const j=C[F];if(F>=1){const Q=C[F-1];if(!Rd(j,Q)){x.vertexLength+4>We.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const G=j.sub(Q)._perp()._unit(),J=Q.dist(j);k+J>32768&&(k=0),Co(this.layoutVertexArray,j.x,j.y,G.x,G.y,0,0,k),Co(this.layoutVertexArray,j.x,j.y,G.x,G.y,0,1,k),f.x+=2*j.x,f.y+=2*j.y,f.vertexCount+=2,k+=J,Co(this.layoutVertexArray,Q.x,Q.y,G.x,G.y,0,0,k),Co(this.layoutVertexArray,Q.x,Q.y,G.x,G.y,0,1,k),f.x+=2*Q.x,f.y+=2*Q.y,f.vertexCount+=2;const re=x.vertexLength;this.indexArray.emplaceBack(re,re+2,re+1),this.indexArray.emplaceBack(re+1,re+2,re+3),x.vertexLength+=4,x.primitiveLength+=2}}}}if(x.vertexLength+g>We.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(g,this.layoutVertexArray,this.indexArray)),Ld[t.type]!=="Polygon")continue;const v=[],w=[],I=x.vertexLength;for(const C of d)if(C.length!==0){C!==d[0]&&w.push(v.length/2);for(let k=0;k<C.length;k++){const F=C[k];Co(this.layoutVertexArray,F.x,F.y,0,0,1,1,0),f.x+=F.x,f.y+=F.y,f.vertexCount+=1,v.push(F.x),v.push(F.y)}}const M=Su(v,w);for(let C=0;C<M.length;C+=3)this.indexArray.emplaceBack(I+M[C],I+M[C+2],I+M[C+1]);x.primitiveLength+=M.length/3,x.vertexLength+=g;for(let C=0;C<f.vertexCount;C++){const k=Math.floor(f.x/f.vertexCount),F=Math.floor(f.y/f.vertexCount);this.centroidVertexArray.emplaceBack(k,F)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,h,l)}}function Rd(i,t){return i.x===t.x&&(i.x<0||i.x>Ct)||i.y===t.y&&(i.y<0||i.y>Ct)}function Bd(i){return i.every(t=>t.x<0)||i.every(t=>t.x>Ct)||i.every(t=>t.y<0)||i.every(t=>t.y>Ct)}let Lu;Ie("FillExtrusionBucket",kc,{omit:["layers","features"]});var Fd={get paint(){return Lu=Lu||new u({"fill-extrusion-opacity":new Ae(ie["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Re(ie["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ae(ie["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ae(ie["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ha(ie["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Re(ie["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Re(ie["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ae(ie["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Od extends s{constructor(t){super(t,Fd)}createBucket(t){return new kc(t)}queryRadius(){return Il(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(t,r,n,l,h,d,f,g){const x=Pl(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),d.angle,f),v=this.paint.get("fill-extrusion-height").evaluate(r,n),w=this.paint.get("fill-extrusion-base").evaluate(r,n),I=function(C,k,F,j){const Q=[];for(const G of C){const J=[G.x,G.y,0,1];Al(J,J,k),Q.push(new me(J[0]/J[3],J[1]/J[3]))}return Q}(x,g),M=function(C,k,F,j){const Q=[],G=[],J=j[8]*k,re=j[9]*k,ce=j[10]*k,we=j[11]*k,Le=j[8]*F,ve=j[9]*F,ye=j[10]*F,Ce=j[11]*F;for(const Pe of C){const Se=[],ae=[];for(const ke of Pe){const ze=ke.x,Oe=ke.y,ut=j[0]*ze+j[4]*Oe+j[12],ct=j[1]*ze+j[5]*Oe+j[13],Dt=j[2]*ze+j[6]*Oe+j[14],pr=j[3]*ze+j[7]*Oe+j[15],Ht=Dt+ce,Lt=pr+we,hi=ut+Le,di=ct+ve,pi=Dt+ye,It=pr+Ce,Rt=new me((ut+J)/Lt,(ct+re)/Lt);Rt.z=Ht/Lt,Se.push(Rt);const ri=new me(hi/It,di/It);ri.z=pi/It,ae.push(ri)}Q.push(Se),G.push(ae)}return[Q,G]}(l,w,v,g);return function(C,k,F){let j=1/0;du(F,k)&&(j=Ru(F,k[0]));for(let Q=0;Q<k.length;Q++){const G=k[Q],J=C[Q];for(let re=0;re<G.length-1;re++){const ce=G[re],we=[ce,G[re+1],J[re+1],J[re],ce];hu(F,we)&&(j=Math.min(j,Ru(F,we)))}}return j!==1/0&&j}(M[0],M[1],I)}}function ko(i,t){return i.x*t.x+i.y*t.y}function Ru(i,t){if(i.length===1){let r=0;const n=t[r++];let l;for(;!l||n.equals(l);)if(l=t[r++],!l)return 1/0;for(;r<t.length;r++){const h=t[r],d=i[0],f=l.sub(n),g=h.sub(n),x=d.sub(n),v=ko(f,f),w=ko(f,g),I=ko(g,g),M=ko(x,f),C=ko(x,g),k=v*I-w*w,F=(I*M-w*C)/k,j=(v*C-w*M)/k,Q=n.z*(1-F-j)+l.z*F+h.z*j;if(isFinite(Q))return Q}return 1/0}{let r=1/0;for(const n of t)r=Math.min(r,n.z);return r}}const Vd=m([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Nd}=Vd,jd=m([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Ud}=jd,$d=$s.VectorTileFeature.types,qd=Math.cos(Math.PI/180*37.5),Bu=Math.pow(2,14)/.5;class Ec{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new pa,this.layoutVertexArray2=new Os,this.indexArray=new Gi,this.programConfigurations=new Pn(t.layers,t.zoom),this.segments=new We,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,n){this.hasPattern=Ac("line",this.layers,r);const l=this.layers[0].layout.get("line-sort-key"),h=!l.isConstant(),d=[];for(const{feature:f,id:g,index:x,sourceLayerIndex:v}of t){const w=this.layers[0]._featureFilter.needGeometry,I=Mn(f,w);if(!this.layers[0]._featureFilter.filter(new pt(this.zoom),I,n))continue;const M=h?l.evaluate(I,{},n):void 0,C={id:g,properties:f.properties,type:f.type,sourceLayerIndex:v,index:x,geometry:w?I.geometry:An(f),patterns:{},sortKey:M};d.push(C)}h&&d.sort((f,g)=>f.sortKey-g.sortKey);for(const f of d){const{geometry:g,index:x,sourceLayerIndex:v}=f;if(this.hasPattern){const w=Mc("line",this.layers,f,this.zoom,r);this.patternFeatures.push(w)}else this.addFeature(f,g,x,n,{});r.featureIndex.insert(t[x].feature,g,x,v,this.index)}}update(t,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,n)}addFeatures(t,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(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Ud)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Nd),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,r,n,l,h){const d=this.layers[0].layout,f=d.get("line-join").evaluate(t,{}),g=d.get("line-cap"),x=d.get("line-miter-limit"),v=d.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const w of r)this.addLine(w,t,f,g,x,v);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,h,l)}addLine(t,r,n,l,h,d){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let j=0;j<t.length-1;j++)this.totalDistance+=t[j].dist(t[j+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const f=$d[r.type]==="Polygon";let g=t.length;for(;g>=2&&t[g-1].equals(t[g-2]);)g--;let x=0;for(;x<g-1&&t[x].equals(t[x+1]);)x++;if(g<(f?3:2))return;n==="bevel"&&(h=1.05);const v=this.overscaling<=16?15*Ct/(512*this.overscaling):0,w=this.segments.prepareSegment(10*g,this.layoutVertexArray,this.indexArray);let I,M,C,k,F;this.e1=this.e2=-1,f&&(I=t[g-2],F=t[x].sub(I)._unit()._perp());for(let j=x;j<g;j++){if(C=j===g-1?f?t[x+1]:void 0:t[j+1],C&&t[j].equals(C))continue;F&&(k=F),I&&(M=I),I=t[j],F=C?C.sub(I)._unit()._perp():k,k=k||F;let Q=k.add(F);Q.x===0&&Q.y===0||Q._unit();const G=k.x*F.x+k.y*F.y,J=Q.x*F.x+Q.y*F.y,re=J!==0?1/J:1/0,ce=2*Math.sqrt(2-2*J),we=J<qd&&M&&C,Le=k.x*F.y-k.y*F.x>0;if(we&&j>x){const Ce=I.dist(M);if(Ce>2*v){const Pe=I.sub(I.sub(M)._mult(v/Ce)._round());this.updateDistance(M,Pe),this.addCurrentVertex(Pe,k,0,0,w),M=Pe}}const ve=M&&C;let ye=ve?n:f?"butt":l;if(ve&&ye==="round"&&(re<d?ye="miter":re<=2&&(ye="fakeround")),ye==="miter"&&re>h&&(ye="bevel"),ye==="bevel"&&(re>2&&(ye="flipbevel"),re<h&&(ye="miter")),M&&this.updateDistance(M,I),ye==="miter")Q._mult(re),this.addCurrentVertex(I,Q,0,0,w);else if(ye==="flipbevel"){if(re>100)Q=F.mult(-1);else{const Ce=re*k.add(F).mag()/k.sub(F).mag();Q._perp()._mult(Ce*(Le?-1:1))}this.addCurrentVertex(I,Q,0,0,w),this.addCurrentVertex(I,Q.mult(-1),0,0,w)}else if(ye==="bevel"||ye==="fakeround"){const Ce=-Math.sqrt(re*re-1),Pe=Le?Ce:0,Se=Le?0:Ce;if(M&&this.addCurrentVertex(I,k,Pe,Se,w),ye==="fakeround"){const ae=Math.round(180*ce/Math.PI/20);for(let ke=1;ke<ae;ke++){let ze=ke/ae;if(ze!==.5){const ut=ze-.5;ze+=ze*ut*(ze-1)*((1.0904+G*(G*(3.55645-1.43519*G)-3.2452))*ut*ut+(.848013+G*(.215638*G-1.06021)))}const Oe=F.sub(k)._mult(ze)._add(k)._unit()._mult(Le?-1:1);this.addHalfVertex(I,Oe.x,Oe.y,!1,Le,0,w)}}C&&this.addCurrentVertex(I,F,-Pe,-Se,w)}else if(ye==="butt")this.addCurrentVertex(I,Q,0,0,w);else if(ye==="square"){const Ce=M?1:-1;this.addCurrentVertex(I,Q,Ce,Ce,w)}else ye==="round"&&(M&&(this.addCurrentVertex(I,k,0,0,w),this.addCurrentVertex(I,k,1,1,w,!0)),C&&(this.addCurrentVertex(I,F,-1,-1,w,!0),this.addCurrentVertex(I,F,0,0,w)));if(we&&j<g-1){const Ce=I.dist(C);if(Ce>2*v){const Pe=I.add(C.sub(I)._mult(v/Ce)._round());this.updateDistance(I,Pe),this.addCurrentVertex(Pe,F,0,0,w),I=Pe}}}}addCurrentVertex(t,r,n,l,h,d=!1){const f=r.y*l-r.x,g=-r.y-r.x*l;this.addHalfVertex(t,r.x+r.y*n,r.y-r.x*n,d,!1,n,h),this.addHalfVertex(t,f,g,d,!0,-l,h),this.distance>Bu/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,r,n,l,h,d))}addHalfVertex({x:t,y:r},n,l,h,d,f,g){const x=.5*(this.lineClips?this.scaledDistance*(Bu-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(h?1:0),(r<<1)+(d?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 v=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,v),g.primitiveLength++),d?this.e2=v:this.e1=v}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,r){this.distance+=t.dist(r),this.updateScaledDistance()}}let Fu,Ou;Ie("LineBucket",Ec,{omit:["layers","patternFeatures"]});var Vu={get paint(){return Ou=Ou||new u({"line-opacity":new Re(ie.paint_line["line-opacity"]),"line-color":new Re(ie.paint_line["line-color"]),"line-translate":new Ae(ie.paint_line["line-translate"]),"line-translate-anchor":new Ae(ie.paint_line["line-translate-anchor"]),"line-width":new Re(ie.paint_line["line-width"]),"line-gap-width":new Re(ie.paint_line["line-gap-width"]),"line-offset":new Re(ie.paint_line["line-offset"]),"line-blur":new Re(ie.paint_line["line-blur"]),"line-dasharray":new da(ie.paint_line["line-dasharray"]),"line-pattern":new ha(ie.paint_line["line-pattern"]),"line-gradient":new bo(ie.paint_line["line-gradient"])})},get layout(){return Fu=Fu||new u({"line-cap":new Ae(ie.layout_line["line-cap"]),"line-join":new Re(ie.layout_line["line-join"]),"line-miter-limit":new Ae(ie.layout_line["line-miter-limit"]),"line-round-limit":new Ae(ie.layout_line["line-round-limit"]),"line-sort-key":new Re(ie.layout_line["line-sort-key"])})}};class Zd extends Re{possiblyEvaluate(t,r){return r=new pt(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(t,r)}evaluate(t,r,n,l){return r=Ii({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(t,r,n,l)}}let kl;class Gd extends s{constructor(t){super(t,Vu),this.gradientVersion=0,kl||(kl=new Zd(Vu.paint.properties["line-width"].specification),kl.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){const r=this.gradientExpression();this.stepInterpolant=!!function(n){return n._styleExpression!==void 0}(r)&&r._styleExpression.expression instanceof xs,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,r){super.recalculate(t,r),this.paint._values["line-floorwidth"]=kl.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Ec(t)}queryRadius(t){const r=t,n=Nu(So("line-width",this,r),So("line-gap-width",this,r)),l=So("line-offset",this,r);return n/2+Math.abs(l)+Il(this.paint.get("line-translate"))}queryIntersectsFeature(t,r,n,l,h,d,f){const g=Pl(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),d.angle,f),x=f/2*Nu(this.paint.get("line-width").evaluate(r,n),this.paint.get("line-gap-width").evaluate(r,n)),v=this.paint.get("line-offset").evaluate(r,n);return v&&(l=function(w,I){const M=[];for(let C=0;C<w.length;C++){const k=w[C],F=[];for(let j=0;j<k.length;j++){const Q=k[j-1],G=k[j],J=k[j+1],re=j===0?new me(0,0):G.sub(Q)._unit()._perp(),ce=j===k.length-1?new me(0,0):J.sub(G)._unit()._perp(),we=re._add(ce)._unit(),Le=we.x*ce.x+we.y*ce.y;Le!==0&&we._mult(1/Le),F.push(we._mult(I)._add(G))}M.push(F)}return M}(l,v*f)),function(w,I,M){for(let C=0;C<I.length;C++){const k=I[C];if(w.length>=3){for(let F=0;F<k.length;F++)if(xa(w,k[F]))return!0}if(td(w,k,M))return!0}return!1}(g,l,x)}isTileClipped(){return!0}}function Nu(i,t){return t>0?t+2*i:i}const Hd=m([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Xd=m([{name:"a_projected_pos",components:3,type:"Float32"}],4);m([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Wd=m([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);m([{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 ju=m([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Kd=m([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Jd(i,t,r){return i.sections.forEach(n=>{n.text=function(l,h,d){const f=h.layout.get("text-transform").evaluate(d,{});return f==="uppercase"?l=l.toLocaleUpperCase():f==="lowercase"&&(l=l.toLocaleLowerCase()),bi.applyArabicShaping&&(l=bi.applyArabicShaping(l)),l}(n.text,t,r)}),i}m([{name:"triangle",components:3,type:"Uint16"}]),m([{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"}]),m([{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"}]),m([{type:"Float32",name:"offsetX"}]),m([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),m([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Eo={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var kt=24,Uu=lt,$u=function(i,t,r,n,l){var h,d,f=8*l-n-1,g=(1<<f)-1,x=g>>1,v=-7,w=l-1,I=-1,M=i[t+w];for(w+=I,h=M&(1<<-v)-1,M>>=-v,v+=f;v>0;h=256*h+i[t+w],w+=I,v-=8);for(d=h&(1<<-v)-1,h>>=-v,v+=n;v>0;d=256*d+i[t+w],w+=I,v-=8);if(h===0)h=1-x;else{if(h===g)return d?NaN:1/0*(M?-1:1);d+=Math.pow(2,n),h-=x}return(M?-1:1)*d*Math.pow(2,h-n)},qu=function(i,t,r,n,l,h){var d,f,g,x=8*h-l-1,v=(1<<x)-1,w=v>>1,I=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=0,C=1,k=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(f=isNaN(t)?1:0,d=v):(d=Math.floor(Math.log(t)/Math.LN2),t*(g=Math.pow(2,-d))<1&&(d--,g*=2),(t+=d+w>=1?I/g:I*Math.pow(2,1-w))*g>=2&&(d++,g/=2),d+w>=v?(f=0,d=v):d+w>=1?(f=(t*g-1)*Math.pow(2,l),d+=w):(f=t*Math.pow(2,w-1)*Math.pow(2,l),d=0));l>=8;i[r+M]=255&f,M+=C,f/=256,l-=8);for(d=d<<l|f,x+=l;x>0;i[r+M]=255&d,M+=C,d/=256,x-=8);i[r+M-C]|=128*k};function lt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}lt.Varint=0,lt.Fixed64=1,lt.Bytes=2,lt.Fixed32=5;var Dc=4294967296,Zu=1/Dc,Gu=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function os(i){return i.type===lt.Bytes?i.readVarint()+i.pos:i.pos+1}function Ta(i,t,r){return r?4294967296*t+(i>>>0):4294967296*(t>>>0)+(i>>>0)}function Hu(i,t,r){var n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));r.realloc(n);for(var l=r.pos-1;l>=i;l--)r.buf[l+n]=r.buf[l]}function Yd(i,t){for(var r=0;r<i.length;r++)t.writeVarint(i[r])}function Qd(i,t){for(var r=0;r<i.length;r++)t.writeSVarint(i[r])}function ep(i,t){for(var r=0;r<i.length;r++)t.writeFloat(i[r])}function tp(i,t){for(var r=0;r<i.length;r++)t.writeDouble(i[r])}function ip(i,t){for(var r=0;r<i.length;r++)t.writeBoolean(i[r])}function rp(i,t){for(var r=0;r<i.length;r++)t.writeFixed32(i[r])}function sp(i,t){for(var r=0;r<i.length;r++)t.writeSFixed32(i[r])}function np(i,t){for(var r=0;r<i.length;r++)t.writeFixed64(i[r])}function ap(i,t){for(var r=0;r<i.length;r++)t.writeSFixed64(i[r])}function El(i,t){return(i[t]|i[t+1]<<8|i[t+2]<<16)+16777216*i[t+3]}function Sa(i,t,r){i[r]=t,i[r+1]=t>>>8,i[r+2]=t>>>16,i[r+3]=t>>>24}function Xu(i,t){return(i[t]|i[t+1]<<8|i[t+2]<<16)+(i[t+3]<<24)}lt.prototype={destroy:function(){this.buf=null},readFields:function(i,t,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),l=n>>3,h=this.pos;this.type=7&n,i(l,t,this),this.pos===h&&this.skip(n)}return t},readMessage:function(i,t){return this.readFields(i,t,this.readVarint()+this.pos)},readFixed32:function(){var i=El(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=Xu(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=El(this.buf,this.pos)+El(this.buf,this.pos+4)*Dc;return this.pos+=8,i},readSFixed64:function(){var i=El(this.buf,this.pos)+Xu(this.buf,this.pos+4)*Dc;return this.pos+=8,i},readFloat:function(){var i=$u(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=$u(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var t,r,n=this.buf;return t=127&(r=n[this.pos++]),r<128?t:(t|=(127&(r=n[this.pos++]))<<7,r<128?t:(t|=(127&(r=n[this.pos++]))<<14,r<128?t:(t|=(127&(r=n[this.pos++]))<<21,r<128?t:function(l,h,d){var f,g,x=d.buf;if(f=(112&(g=x[d.pos++]))>>4,g<128||(f|=(127&(g=x[d.pos++]))<<3,g<128)||(f|=(127&(g=x[d.pos++]))<<10,g<128)||(f|=(127&(g=x[d.pos++]))<<17,g<128)||(f|=(127&(g=x[d.pos++]))<<24,g<128)||(f|=(1&(g=x[d.pos++]))<<31,g<128))return Ta(l,f,h);throw new Error("Expected varint not more than 10 bytes")}(t|=(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,t=this.pos;return this.pos=i,i-t>=12&&Gu?function(r,n,l){return Gu.decode(r.subarray(n,l))}(this.buf,t,i):function(r,n,l){for(var h="",d=n;d<l;){var f,g,x,v=r[d],w=null,I=v>239?4:v>223?3:v>191?2:1;if(d+I>l)break;I===1?v<128&&(w=v):I===2?(192&(f=r[d+1]))==128&&(w=(31&v)<<6|63&f)<=127&&(w=null):I===3?(g=r[d+2],(192&(f=r[d+1]))==128&&(192&g)==128&&((w=(15&v)<<12|(63&f)<<6|63&g)<=2047||w>=55296&&w<=57343)&&(w=null)):I===4&&(g=r[d+2],x=r[d+3],(192&(f=r[d+1]))==128&&(192&g)==128&&(192&x)==128&&((w=(15&v)<<18|(63&f)<<12|(63&g)<<6|63&x)<=65535||w>=1114112)&&(w=null)),w===null?(w=65533,I=1):w>65535&&(w-=65536,h+=String.fromCharCode(w>>>10&1023|55296),w=56320|1023&w),h+=String.fromCharCode(w),d+=I}return h}(this.buf,t,i)},readBytes:function(){var i=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,i);return this.pos=i,t},readPackedVarint:function(i,t){if(this.type!==lt.Bytes)return i.push(this.readVarint(t));var r=os(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(t));return i},readPackedSVarint:function(i){if(this.type!==lt.Bytes)return i.push(this.readSVarint());var t=os(this);for(i=i||[];this.pos<t;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==lt.Bytes)return i.push(this.readBoolean());var t=os(this);for(i=i||[];this.pos<t;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==lt.Bytes)return i.push(this.readFloat());var t=os(this);for(i=i||[];this.pos<t;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==lt.Bytes)return i.push(this.readDouble());var t=os(this);for(i=i||[];this.pos<t;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==lt.Bytes)return i.push(this.readFixed32());var t=os(this);for(i=i||[];this.pos<t;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==lt.Bytes)return i.push(this.readSFixed32());var t=os(this);for(i=i||[];this.pos<t;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==lt.Bytes)return i.push(this.readFixed64());var t=os(this);for(i=i||[];this.pos<t;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==lt.Bytes)return i.push(this.readSFixed64());var t=os(this);for(i=i||[];this.pos<t;)i.push(this.readSFixed64());return i},skip:function(i){var t=7&i;if(t===lt.Varint)for(;this.buf[this.pos++]>127;);else if(t===lt.Bytes)this.pos=this.readVarint()+this.pos;else if(t===lt.Fixed32)this.pos+=4;else{if(t!==lt.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(i,t){this.writeVarint(i<<3|t)},realloc:function(i){for(var t=this.length||16;t<this.pos+i;)t*=2;if(t!==this.length){var r=new Uint8Array(t);r.set(this.buf),this.buf=r,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(i){this.realloc(4),Sa(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),Sa(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),Sa(this.buf,-1&i,this.pos),Sa(this.buf,Math.floor(i*Zu),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),Sa(this.buf,-1&i,this.pos),Sa(this.buf,Math.floor(i*Zu),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?function(t,r){var n,l;if(t>=0?(n=t%4294967296|0,l=t/4294967296|0):(l=~(-t/4294967296),4294967295^(n=~(-t%4294967296))?n=n+1|0:(n=0,l=l+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(h,d,f){f.buf[f.pos++]=127&h|128,h>>>=7,f.buf[f.pos++]=127&h|128,h>>>=7,f.buf[f.pos++]=127&h|128,h>>>=7,f.buf[f.pos++]=127&h|128,f.buf[f.pos]=127&(h>>>=7)}(n,0,r),function(h,d){var f=(7&h)<<4;d.buf[d.pos++]|=f|((h>>>=3)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h)))))}(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 t=this.pos;this.pos=function(n,l,h){for(var d,f,g=0;g<l.length;g++){if((d=l.charCodeAt(g))>55295&&d<57344){if(!f){d>56319||g+1===l.length?(n[h++]=239,n[h++]=191,n[h++]=189):f=d;continue}if(d<56320){n[h++]=239,n[h++]=191,n[h++]=189,f=d;continue}d=f-55296<<10|d-56320|65536,f=null}else f&&(n[h++]=239,n[h++]=191,n[h++]=189,f=null);d<128?n[h++]=d:(d<2048?n[h++]=d>>6|192:(d<65536?n[h++]=d>>12|224:(n[h++]=d>>18|240,n[h++]=d>>12&63|128),n[h++]=d>>6&63|128),n[h++]=63&d|128)}return h}(this.buf,i,this.pos);var r=this.pos-t;r>=128&&Hu(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),qu(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),qu(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var t=i.length;this.writeVarint(t),this.realloc(t);for(var r=0;r<t;r++)this.buf[this.pos++]=i[r]},writeRawMessage:function(i,t){this.pos++;var r=this.pos;i(t,this);var n=this.pos-r;n>=128&&Hu(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(i,t,r){this.writeTag(i,lt.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(i,t){t.length&&this.writeMessage(i,Yd,t)},writePackedSVarint:function(i,t){t.length&&this.writeMessage(i,Qd,t)},writePackedBoolean:function(i,t){t.length&&this.writeMessage(i,ip,t)},writePackedFloat:function(i,t){t.length&&this.writeMessage(i,ep,t)},writePackedDouble:function(i,t){t.length&&this.writeMessage(i,tp,t)},writePackedFixed32:function(i,t){t.length&&this.writeMessage(i,rp,t)},writePackedSFixed32:function(i,t){t.length&&this.writeMessage(i,sp,t)},writePackedFixed64:function(i,t){t.length&&this.writeMessage(i,np,t)},writePackedSFixed64:function(i,t){t.length&&this.writeMessage(i,ap,t)},writeBytesField:function(i,t){this.writeTag(i,lt.Bytes),this.writeBytes(t)},writeFixed32Field:function(i,t){this.writeTag(i,lt.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(i,t){this.writeTag(i,lt.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(i,t){this.writeTag(i,lt.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(i,t){this.writeTag(i,lt.Fixed64),this.writeSFixed64(t)},writeVarintField:function(i,t){this.writeTag(i,lt.Varint),this.writeVarint(t)},writeSVarintField:function(i,t){this.writeTag(i,lt.Varint),this.writeSVarint(t)},writeStringField:function(i,t){this.writeTag(i,lt.Bytes),this.writeString(t)},writeFloatField:function(i,t){this.writeTag(i,lt.Fixed32),this.writeFloat(t)},writeDoubleField:function(i,t){this.writeTag(i,lt.Fixed64),this.writeDouble(t)},writeBooleanField:function(i,t){this.writeVarintField(i,!!t)}};var Lc=Ri(Uu);const Rc=3;function op(i,t,r){i===1&&r.readMessage(lp,t)}function lp(i,t,r){if(i===3){const{id:n,bitmap:l,width:h,height:d,left:f,top:g,advance:x}=r.readMessage(cp,{});t.push({id:n,bitmap:new Po({width:h+2*Rc,height:d+2*Rc},l),metrics:{width:h,height:d,left:f,top:g,advance:x}})}}function cp(i,t,r){i===1?t.id=r.readVarint():i===2?t.bitmap=r.readBytes():i===3?t.width=r.readVarint():i===4?t.height=r.readVarint():i===5?t.left=r.readSVarint():i===6?t.top=r.readSVarint():i===7&&(t.advance=r.readVarint())}const Wu=Rc;function Ku(i){let t=0,r=0;for(const d of i)t+=d.w*d.h,r=Math.max(r,d.w);i.sort((d,f)=>f.h-d.h);const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}];let l=0,h=0;for(const d of i)for(let f=n.length-1;f>=0;f--){const g=n[f];if(!(d.w>g.w||d.h>g.h)){if(d.x=g.x,d.y=g.y,h=Math.max(h,d.y+d.h),l=Math.max(l,d.x+d.w),d.w===g.w&&d.h===g.h){const x=n.pop();f<n.length&&(n[f]=x)}else d.h===g.h?(g.x+=d.w,g.w-=d.w):d.w===g.w?(g.y+=d.h,g.h-=d.h):(n.push({x:g.x+d.w,y:g.y,w:g.w-d.w,h:d.h}),g.y+=d.h,g.h-=d.h);break}}return{w:l,h,fill:t/(l*h)||0}}const Ti=1;class Bc{constructor(t,{pixelRatio:r,version:n,stretchX:l,stretchY:h,content:d,textFitWidth:f,textFitHeight:g}){this.paddedRect=t,this.pixelRatio=r,this.stretchX=l,this.stretchY=h,this.content=d,this.version=n,this.textFitWidth=f,this.textFitHeight=g}get tl(){return[this.paddedRect.x+Ti,this.paddedRect.y+Ti]}get br(){return[this.paddedRect.x+this.paddedRect.w-Ti,this.paddedRect.y+this.paddedRect.h-Ti]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*Ti)/this.pixelRatio,(this.paddedRect.h-2*Ti)/this.pixelRatio]}}class Ju{constructor(t,r){const n={},l={};this.haveRenderCallbacks=[];const h=[];this.addImages(t,n,h),this.addImages(r,l,h);const{w:d,h:f}=Ku(h),g=new Hi({width:d||1,height:f||1});for(const x in t){const v=t[x],w=n[x].paddedRect;Hi.copy(v.data,g,{x:0,y:0},{x:w.x+Ti,y:w.y+Ti},v.data)}for(const x in r){const v=r[x],w=l[x].paddedRect,I=w.x+Ti,M=w.y+Ti,C=v.data.width,k=v.data.height;Hi.copy(v.data,g,{x:0,y:0},{x:I,y:M},v.data),Hi.copy(v.data,g,{x:0,y:k-1},{x:I,y:M-1},{width:C,height:1}),Hi.copy(v.data,g,{x:0,y:0},{x:I,y:M+k},{width:C,height:1}),Hi.copy(v.data,g,{x:C-1,y:0},{x:I-1,y:M},{width:1,height:k}),Hi.copy(v.data,g,{x:0,y:0},{x:I+C,y:M},{width:1,height:k})}this.image=g,this.iconPositions=n,this.patternPositions=l}addImages(t,r,n){for(const l in t){const h=t[l],d={x:0,y:0,w:h.data.width+2*Ti,h:h.data.height+2*Ti};n.push(d),r[l]=new Bc(d,h),h.hasRenderCallback&&this.haveRenderCallbacks.push(l)}}patchUpdatedImages(t,r){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const n in t.updatedImages)this.patchUpdatedImage(this.iconPositions[n],t.getImage(n),r),this.patchUpdatedImage(this.patternPositions[n],t.getImage(n),r)}patchUpdatedImage(t,r,n){if(!t||!r||t.version===r.version)return;t.version=r.version;const[l,h]=t.tl;n.update(r.data,void 0,{x:l,y:h})}}var qs;Ie("ImagePosition",Bc),Ie("ImageAtlas",Ju),L.ah=void 0,(qs=L.ah||(L.ah={}))[qs.none=0]="none",qs[qs.horizontal=1]="horizontal",qs[qs.vertical=2]="vertical",qs[qs.horizontalOnly=3]="horizontalOnly";const Do=-17;class Lo{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,r){const n=new Lo;return n.scale=t||1,n.fontStack=r,n}static forImage(t){const r=new Lo;return r.imageName=t,r}}class Ia{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,r){const n=new Ia;for(let l=0;l<t.sections.length;l++){const h=t.sections[l];h.image?n.addImageSection(h):n.addTextSection(h,r)}return n}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=function(t){let r="";for(let n=0;n<t.length;n++){const l=t.charCodeAt(n+1)||null,h=t.charCodeAt(n-1)||null;r+=l&&yl(l)&&!Eo[t[n+1]]||h&&yl(h)&&!Eo[t[n-1]]||!Eo[t[n]]?t[n]:Eo[t[n]]}return r}(this.text)}trim(){let t=0;for(let n=0;n<this.text.length&&Ll[this.text.charCodeAt(n)];n++)t++;let r=this.text.length;for(let n=this.text.length-1;n>=0&&n>=t&&Ll[this.text.charCodeAt(n)];n--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)}substring(t,r){const n=new Ia;return n.text=this.text.substring(t,r),n.sectionIndex=this.sectionIndex.slice(t,r),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,r)=>Math.max(t,this.sections[r].scale),0)}addTextSection(t,r){this.text+=t.text,this.sections.push(Lo.forText(t.scale,t.fontStack||r));const n=this.sections.length-1;for(let l=0;l<t.text.length;++l)this.sectionIndex.push(n)}addImageSection(t){const r=t.image?t.image.name:"";if(r.length===0)return void jt("Can't add FormattedSection with an empty image.");const n=this.getNextImageSectionCharCode();n?(this.text+=String.fromCharCode(n),this.sections.push(Lo.forImage(r)),this.sectionIndex.push(this.sections.length-1)):jt("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Dl(i,t,r,n,l,h,d,f,g,x,v,w,I,M,C){const k=Ia.fromFeature(i,l);let F;w===L.ah.vertical&&k.verticalizePunctuation();const{processBidirectionalText:j,processStyledBidirectionalText:Q}=bi;if(j&&k.sections.length===1){F=[];const re=j(k.toString(),Fc(k,x,h,t,n,M));for(const ce of re){const we=new Ia;we.text=ce,we.sections=k.sections;for(let Le=0;Le<ce.length;Le++)we.sectionIndex.push(0);F.push(we)}}else if(Q){F=[];const re=Q(k.text,k.sectionIndex,Fc(k,x,h,t,n,M));for(const ce of re){const we=new Ia;we.text=ce[0],we.sectionIndex=ce[1],we.sections=k.sections,F.push(we)}}else F=function(re,ce){const we=[],Le=re.text;let ve=0;for(const ye of ce)we.push(re.substring(ve,ye)),ve=ye;return ve<Le.length&&we.push(re.substring(ve,Le.length)),we}(k,Fc(k,x,h,t,n,M));const G=[],J={positionedLines:G,text:k.toString(),top:v[1],bottom:v[1],left:v[0],right:v[0],writingMode:w,iconsInText:!1,verticalizable:!1};return function(re,ce,we,Le,ve,ye,Ce,Pe,Se,ae,ke,ze){let Oe=0,ut=Do,ct=0,Dt=0;const pr=Pe==="right"?1:Pe==="left"?0:.5;let Ht=0;for(const It of ve){It.trim();const Rt=It.getMaxScale(),ri=(Rt-1)*kt,Xt={positionedGlyphs:[],lineOffset:0};re.positionedLines[Ht]=Xt;const fi=Xt.positionedGlyphs;let Wt=0;if(!It.length()){ut+=ye,++Ht;continue}for(let Si=0;Si<It.length();Si++){const Qe=It.getSection(Si),dt=It.getSectionIndex(Si),_t=It.getCharCode(Si);let Li=0,wt=null,za=null,Vr=null,Nr=kt;const fr=!(Se===L.ah.horizontal||!ke&&!xo(_t)||ke&&(Ll[_t]||(Lt=_t,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(Lt)))));if(Qe.imageName){const Ki=Le[Qe.imageName];if(!Ki)continue;Vr=Qe.imageName,re.iconsInText=re.iconsInText||!0,za=Ki.paddedRect;const Vt=Ki.displaySize;Qe.scale=Qe.scale*kt/ze,wt={width:Vt[0],height:Vt[1],left:Ti,top:-Wu,advance:fr?Vt[1]:Vt[0]},Li=ri+(kt-Vt[1]*Qe.scale),Nr=wt.advance;const ls=fr?Vt[0]*Qe.scale-kt*Rt:Vt[1]*Qe.scale-kt*Rt;ls>0&&ls>Wt&&(Wt=ls)}else{const Ki=we[Qe.fontStack],Vt=Ki&&Ki[_t];if(Vt&&Vt.rect)za=Vt.rect,wt=Vt.metrics;else{const ls=ce[Qe.fontStack],No=ls&&ls[_t];if(!No)continue;wt=No.metrics}Li=(Rt-Qe.scale)*kt}fr?(re.verticalizable=!0,fi.push({glyph:_t,imageName:Vr,x:Oe,y:ut+Li,vertical:fr,scale:Qe.scale,fontStack:Qe.fontStack,sectionIndex:dt,metrics:wt,rect:za}),Oe+=Nr*Qe.scale+ae):(fi.push({glyph:_t,imageName:Vr,x:Oe,y:ut+Li,vertical:fr,scale:Qe.scale,fontStack:Qe.fontStack,sectionIndex:dt,metrics:wt,rect:za}),Oe+=wt.advance*Qe.scale+ae)}fi.length!==0&&(ct=Math.max(Oe-ae,ct),pp(fi,0,fi.length-1,pr,Wt)),Oe=0;const Wi=ye*Rt+Wt;Xt.lineOffset=Math.max(Wt,ri),ut+=Wi,Dt=Math.max(Wi,Dt),++Ht}var Lt;const hi=ut-Do,{horizontalAlign:di,verticalAlign:pi}=Oc(Ce);(function(It,Rt,ri,Xt,fi,Wt,Wi,Si,Qe){const dt=(Rt-ri)*fi;let _t=0;_t=Wt!==Wi?-Si*Xt-Do:(-Xt*Qe+.5)*Wi;for(const Li of It)for(const wt of Li.positionedGlyphs)wt.x+=dt,wt.y+=_t})(re.positionedLines,pr,di,pi,ct,Dt,ye,hi,ve.length),re.top+=-pi*hi,re.bottom=re.top+hi,re.left+=-di*ct,re.right=re.left+ct}(J,t,r,n,F,d,f,g,w,x,I,C),!function(re){for(const ce of re)if(ce.positionedGlyphs.length!==0)return!1;return!0}(G)&&J}const Ll={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},up={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},hp={40:!0};function Yu(i,t,r,n,l,h){if(t.imageName){const d=n[t.imageName];return d?d.displaySize[0]*t.scale*kt/h+l:0}{const d=r[t.fontStack],f=d&&d[i];return f?f.metrics.advance*t.scale+l:0}}function Qu(i,t,r,n){const l=Math.pow(i-t,2);return n?i<t?l/2:2*l:l+Math.abs(r)*r}function dp(i,t,r){let n=0;return i===10&&(n-=1e4),r&&(n+=150),i!==40&&i!==65288||(n+=50),t!==41&&t!==65289||(n+=50),n}function eh(i,t,r,n,l,h){let d=null,f=Qu(t,r,l,h);for(const g of n){const x=Qu(t-g.x,r,l,h)+g.badness;x<=f&&(d=g,f=x)}return{index:i,x:t,priorBreak:d,badness:f}}function th(i){return i?th(i.priorBreak).concat(i.index):[]}function Fc(i,t,r,n,l,h){if(!i)return[];const d=[],f=function(w,I,M,C,k,F){let j=0;for(let Q=0;Q<w.length();Q++){const G=w.getSection(Q);j+=Yu(w.getCharCode(Q),G,C,k,I,F)}return j/Math.max(1,Math.ceil(j/M))}(i,t,r,n,l,h),g=i.text.indexOf("")>=0;let x=0;for(let w=0;w<i.length();w++){const I=i.getSection(w),M=i.getCharCode(w);if(Ll[M]||(x+=Yu(M,I,n,l,t,h)),w<i.length()-1){const C=!((v=M)<11904)&&(!!Xe["CJK Compatibility Forms"](v)||!!Xe["CJK Compatibility"](v)||!!Xe["CJK Strokes"](v)||!!Xe["CJK Symbols and Punctuation"](v)||!!Xe["Enclosed CJK Letters and Months"](v)||!!Xe["Halfwidth and Fullwidth Forms"](v)||!!Xe["Ideographic Description Characters"](v)||!!Xe["Vertical Forms"](v)||_l.test(String.fromCodePoint(v)));(up[M]||C||I.imageName||w!==i.length()-2&&hp[i.getCharCode(w+1)])&&d.push(eh(w+1,x,f,d,dp(M,i.getCharCode(w+1),C&&g),!1))}}var v;return th(eh(i.length(),x,f,d,0,!0))}function Oc(i){let t=.5,r=.5;switch(i){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=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:t,verticalAlign:r}}function pp(i,t,r,n,l){if(!n&&!l)return;const h=i[r],d=(i[r].x+h.metrics.advance*h.scale)*n;for(let f=t;f<=r;f++)i[f].x-=d,i[f].y+=l}function fp(i,t,r){const{horizontalAlign:n,verticalAlign:l}=Oc(r),h=t[0]-i.displaySize[0]*n,d=t[1]-i.displaySize[1]*l;return{image:i,top:d,bottom:d+i.displaySize[1],left:h,right:h+i.displaySize[0]}}function ih(i){var t,r;let n=i.left,l=i.top,h=i.right-n,d=i.bottom-l;const f=(t=i.image.textFitWidth)!==null&&t!==void 0?t:"stretchOrShrink",g=(r=i.image.textFitHeight)!==null&&r!==void 0?r:"stretchOrShrink",x=(i.image.content[2]-i.image.content[0])/(i.image.content[3]-i.image.content[1]);if(g==="proportional"){if(f==="stretchOnly"&&h/d<x||f==="proportional"){const v=Math.ceil(d*x);n*=v/h,h=v}}else if(f==="proportional"&&g==="stretchOnly"&&x!==0&&h/d>x){const v=Math.ceil(h/x);l*=v/d,d=v}return{x1:n,y1:l,x2:n+h,y2:l+d}}function rh(i,t,r,n,l,h){const d=i.image;let f;if(d.content){const F=d.content,j=d.pixelRatio||1;f=[F[0]/j,F[1]/j,d.displaySize[0]-F[2]/j,d.displaySize[1]-F[3]/j]}const g=t.left*h,x=t.right*h;let v,w,I,M;r==="width"||r==="both"?(M=l[0]+g-n[3],w=l[0]+x+n[1]):(M=l[0]+(g+x-d.displaySize[0])/2,w=M+d.displaySize[0]);const C=t.top*h,k=t.bottom*h;return r==="height"||r==="both"?(v=l[1]+C-n[0],I=l[1]+k+n[2]):(v=l[1]+(C+k-d.displaySize[1])/2,I=v+d.displaySize[1]),{image:d,top:v,right:w,bottom:I,left:M,collisionPadding:f}}const Ro=255,Or=128,Zs=Ro*Or;function sh(i,t){const{expression:r}=t;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new pt(i+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:n,interpolationType:l}=r;let h=0;for(;h<n.length&&n[h]<=i;)h++;h=Math.max(0,h-1);let d=h;for(;d<n.length&&n[d]<i+1;)d++;d=Math.min(n.length-1,d);const f=n[h],g=n[d];return r.kind==="composite"?{kind:"composite",minZoom:f,maxZoom:g,interpolationType:l}:{kind:"camera",minZoom:f,maxZoom:g,minSize:r.evaluate(new pt(f)),maxSize:r.evaluate(new pt(g)),interpolationType:l}}}function Vc(i,t,r){let n="never";const l=i.get(t);return l?n=l:i.get(r)&&(n="always"),n}const mp=$s.VectorTileFeature.types,gp=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Rl(i,t,r,n,l,h,d,f,g,x,v,w,I){const M=f?Math.min(Zs,Math.round(f[0])):0,C=f?Math.min(Zs,Math.round(f[1])):0;i.emplaceBack(t,r,Math.round(32*n),Math.round(32*l),h,d,(M<<1)+(g?1:0),C,16*x,16*v,256*w,256*I)}function Nc(i,t,r){i.emplaceBack(t.x,t.y,r),i.emplaceBack(t.x,t.y,r),i.emplaceBack(t.x,t.y,r),i.emplaceBack(t.x,t.y,r)}function _p(i){for(const t of i.sections)if(fc(t.text))return!0;return!1}class jc{constructor(t){this.layoutVertexArray=new fa,this.indexArray=new Gi,this.programConfigurations=t,this.segments=new We,this.dynamicLayoutVertexArray=new wo,this.opacityVertexArray=new Ei,this.hasVisibleVertices=!1,this.placedSymbolArray=new ft}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,r,n,l){this.isEmpty()||(n&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Hd.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Xd.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,gp,!0),this.opacityVertexBuffer.itemSize=1),(n||l)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}Ie("SymbolBuffers",jc);class Uc{constructor(t,r,n){this.layoutVertexArray=new t,this.layoutAttributes=r,this.indexArray=new n,this.segments=new We,this.collisionVertexArray=new Br}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Wd.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Ie("CollisionBuffers",Uc);class Pa{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(d=>d.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=bc([]),this.placementViewportMatrix=bc([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=sh(this.zoom,r["text-size"]),this.iconSizeData=sh(this.zoom,r["icon-size"]);const n=this.layers[0].layout,l=n.get("symbol-sort-key"),h=n.get("symbol-z-order");this.canOverlap=Vc(n,"text-overlap","text-allow-overlap")!=="never"||Vc(n,"icon-overlap","icon-allow-overlap")!=="never"||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey=h!=="viewport-y"&&!l.isConstant(),this.sortFeaturesByY=(h==="viewport-y"||h==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,n.get("symbol-placement")==="point"&&(this.writingModes=n.get("text-writing-mode").map(d=>L.ah[d])),this.stateDependentLayerIds=this.layers.filter(d=>d.isStateDependent()).map(d=>d.id),this.sourceID=t.sourceID}createArrays(){this.text=new jc(new Pn(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new jc(new Pn(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new mt,this.lineVertexArray=new $t,this.symbolInstances=new He,this.textAnchorOffsets=new gt}calculateGlyphDependencies(t,r,n,l,h){for(let d=0;d<t.length;d++)if(r[t.charCodeAt(d)]=!0,(n||l)&&h){const f=Eo[t.charAt(d)];f&&(r[f.charCodeAt(0)]=!0)}}populate(t,r,n){const l=this.layers[0],h=l.layout,d=h.get("text-font"),f=h.get("text-field"),g=h.get("icon-image"),x=(f.value.kind!=="constant"||f.value.value instanceof _i&&!f.value.value.isEmpty()||f.value.value.toString().length>0)&&(d.value.kind!=="constant"||d.value.value.length>0),v=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,w=h.get("symbol-sort-key");if(this.features=[],!x&&!v)return;const I=r.iconDependencies,M=r.glyphDependencies,C=r.availableImages,k=new pt(this.zoom);for(const{feature:F,id:j,index:Q,sourceLayerIndex:G}of t){const J=l._featureFilter.needGeometry,re=Mn(F,J);if(!l._featureFilter.filter(k,re,n))continue;let ce,we;if(J||(re.geometry=An(F)),x){const ve=l.getValueAndResolveTokens("text-field",re,n,C),ye=_i.factory(ve),Ce=this.hasRTLText=this.hasRTLText||_p(ye);(!Ce||bi.getRTLTextPluginStatus()==="unavailable"||Ce&&bi.isParsed())&&(ce=Jd(ye,l,re))}if(v){const ve=l.getValueAndResolveTokens("icon-image",re,n,C);we=ve instanceof xi?ve:xi.fromString(ve)}if(!ce&&!we)continue;const Le=this.sortFeaturesByKey?w.evaluate(re,{},n):void 0;if(this.features.push({id:j,text:ce,icon:we,index:Q,sourceLayerIndex:G,geometry:re.geometry,properties:F.properties,type:mp[F.type],sortKey:Le}),we&&(I[we.name]=!0),ce){const ve=d.evaluate(re,{},n).join(","),ye=h.get("text-rotation-alignment")!=="viewport"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(L.ah.vertical)>=0;for(const Ce of ce.sections)if(Ce.image)I[Ce.image.name]=!0;else{const Pe=_o(ce.toString()),Se=Ce.fontStack||ve,ae=M[Se]=M[Se]||{};this.calculateGlyphDependencies(Ce.text,ae,ye,this.allowVerticalPlacement,Pe)}}}h.get("symbol-placement")==="line"&&(this.features=function(F){const j={},Q={},G=[];let J=0;function re(ve){G.push(F[ve]),J++}function ce(ve,ye,Ce){const Pe=Q[ve];return delete Q[ve],Q[ye]=Pe,G[Pe].geometry[0].pop(),G[Pe].geometry[0]=G[Pe].geometry[0].concat(Ce[0]),Pe}function we(ve,ye,Ce){const Pe=j[ye];return delete j[ye],j[ve]=Pe,G[Pe].geometry[0].shift(),G[Pe].geometry[0]=Ce[0].concat(G[Pe].geometry[0]),Pe}function Le(ve,ye,Ce){const Pe=Ce?ye[0][ye[0].length-1]:ye[0][0];return`${ve}:${Pe.x}:${Pe.y}`}for(let ve=0;ve<F.length;ve++){const ye=F[ve],Ce=ye.geometry,Pe=ye.text?ye.text.toString():null;if(!Pe){re(ve);continue}const Se=Le(Pe,Ce),ae=Le(Pe,Ce,!0);if(Se in Q&&ae in j&&Q[Se]!==j[ae]){const ke=we(Se,ae,Ce),ze=ce(Se,ae,G[ke].geometry);delete j[Se],delete Q[ae],Q[Le(Pe,G[ze].geometry,!0)]=ze,G[ke].geometry=null}else Se in Q?ce(Se,ae,Ce):ae in j?we(Se,ae,Ce):(re(ve),j[Se]=J-1,Q[ae]=J-1)}return G.filter(ve=>ve.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((F,j)=>F.sortKey-j.sortKey)}update(t,r,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,r,this.layers,n),this.icon.programConfigurations.updatePaintArrays(t,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(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,r){const n=this.lineVertexArray.length;if(t.segment!==void 0){let l=t.dist(r[t.segment+1]),h=t.dist(r[t.segment]);const d={};for(let f=t.segment+1;f<r.length;f++)d[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=t.segment||0;f>=0;f--)d[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:h},f>0&&(h+=r[f-1].dist(r[f]));for(let f=0;f<r.length;f++){const g=d[f];this.lineVertexArray.emplaceBack(g.x,g.y,g.tileUnitDistanceFromAnchor)}}return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(t,r,n,l,h,d,f,g,x,v,w,I){const M=t.indexArray,C=t.layoutVertexArray,k=t.segments.prepareSegment(4*r.length,C,M,this.canOverlap?d.sortKey:void 0),F=this.glyphOffsetArray.length,j=k.vertexLength,Q=this.allowVerticalPlacement&&f===L.ah.vertical?Math.PI/2:0,G=d.text&&d.text.sections;for(let J=0;J<r.length;J++){const{tl:re,tr:ce,bl:we,br:Le,tex:ve,pixelOffsetTL:ye,pixelOffsetBR:Ce,minFontScaleX:Pe,minFontScaleY:Se,glyphOffset:ae,isSDF:ke,sectionIndex:ze}=r[J],Oe=k.vertexLength,ut=ae[1];Rl(C,g.x,g.y,re.x,ut+re.y,ve.x,ve.y,n,ke,ye.x,ye.y,Pe,Se),Rl(C,g.x,g.y,ce.x,ut+ce.y,ve.x+ve.w,ve.y,n,ke,Ce.x,ye.y,Pe,Se),Rl(C,g.x,g.y,we.x,ut+we.y,ve.x,ve.y+ve.h,n,ke,ye.x,Ce.y,Pe,Se),Rl(C,g.x,g.y,Le.x,ut+Le.y,ve.x+ve.w,ve.y+ve.h,n,ke,Ce.x,Ce.y,Pe,Se),Nc(t.dynamicLayoutVertexArray,g,Q),M.emplaceBack(Oe,Oe+1,Oe+2),M.emplaceBack(Oe+1,Oe+2,Oe+3),k.vertexLength+=4,k.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(ae[0]),J!==r.length-1&&ze===r[J+1].sectionIndex||t.programConfigurations.populatePaintArrays(C.length,d,d.index,{},I,G&&G[ze])}t.placedSymbolArray.emplaceBack(g.x,g.y,F,this.glyphOffsetArray.length-F,j,x,v,g.segment,n?n[0]:0,n?n[1]:0,l[0],l[1],f,0,!1,0,w)}_addCollisionDebugVertex(t,r,n,l,h,d){return r.emplaceBack(0,0),t.emplaceBack(n.x,n.y,l,h,Math.round(d.x),Math.round(d.y))}addCollisionDebugVertices(t,r,n,l,h,d,f){const g=h.segments.prepareSegment(4,h.layoutVertexArray,h.indexArray),x=g.vertexLength,v=h.layoutVertexArray,w=h.collisionVertexArray,I=f.anchorX,M=f.anchorY;this._addCollisionDebugVertex(v,w,d,I,M,new me(t,r)),this._addCollisionDebugVertex(v,w,d,I,M,new me(n,r)),this._addCollisionDebugVertex(v,w,d,I,M,new me(n,l)),this._addCollisionDebugVertex(v,w,d,I,M,new me(t,l)),g.vertexLength+=4;const C=h.indexArray;C.emplaceBack(x,x+1),C.emplaceBack(x+1,x+2),C.emplaceBack(x+2,x+3),C.emplaceBack(x+3,x),g.primitiveLength+=4}addDebugCollisionBoxes(t,r,n,l){for(let h=t;h<r;h++){const d=this.collisionBoxArray.get(h);this.addCollisionDebugVertices(d.x1,d.y1,d.x2,d.y2,l?this.textCollisionBox:this.iconCollisionBox,d.anchorPoint,n)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Uc(Di,ju.members,Ot),this.iconCollisionBox=new Uc(Di,ju.members,Ot);for(let t=0;t<this.symbolInstances.length;t++){const r=this.symbolInstances.get(t);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(t,r,n,l,h,d,f,g,x){const v={};for(let w=r;w<n;w++){const I=t.get(w);v.textBox={x1:I.x1,y1:I.y1,x2:I.x2,y2:I.y2,anchorPointX:I.anchorPointX,anchorPointY:I.anchorPointY},v.textFeatureIndex=I.featureIndex;break}for(let w=l;w<h;w++){const I=t.get(w);v.verticalTextBox={x1:I.x1,y1:I.y1,x2:I.x2,y2:I.y2,anchorPointX:I.anchorPointX,anchorPointY:I.anchorPointY},v.verticalTextFeatureIndex=I.featureIndex;break}for(let w=d;w<f;w++){const I=t.get(w);v.iconBox={x1:I.x1,y1:I.y1,x2:I.x2,y2:I.y2,anchorPointX:I.anchorPointX,anchorPointY:I.anchorPointY},v.iconFeatureIndex=I.featureIndex;break}for(let w=g;w<x;w++){const I=t.get(w);v.verticalIconBox={x1:I.x1,y1:I.y1,x2:I.x2,y2:I.y2,anchorPointX:I.anchorPointX,anchorPointY:I.anchorPointY},v.verticalIconFeatureIndex=I.featureIndex;break}return v}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const n=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,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(t,r){const n=t.placedSymbolArray.get(r),l=n.vertexStartIndex+4*n.numGlyphs;for(let h=n.vertexStartIndex;h<l;h+=4)t.indexArray.emplaceBack(h,h+1,h+2),t.indexArray.emplaceBack(h+1,h+2,h+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(t),n=Math.cos(t),l=[],h=[],d=[];for(let f=0;f<this.symbolInstances.length;++f){d.push(f);const g=this.symbolInstances.get(f);l.push(0|Math.round(r*g.anchorX+n*g.anchorY)),h.push(g.featureIndex)}return d.sort((f,g)=>l[f]-l[g]||h[g]-h[f]),d}addToSortKeyRanges(t,r){const n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===r?n.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const n=this.symbolInstances.get(r);this.featureSortOrder.push(n.featureIndex),[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach((l,h,d)=>{l>=0&&d.indexOf(l)===h&&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 nh,ah;Ie("SymbolBucket",Pa,{omit:["layers","collisionBoxArray","features","compareText"]}),Pa.MAX_GLYPHS=65535,Pa.addDynamicAttributes=Nc;var $c={get paint(){return ah=ah||new u({"icon-opacity":new Re(ie.paint_symbol["icon-opacity"]),"icon-color":new Re(ie.paint_symbol["icon-color"]),"icon-halo-color":new Re(ie.paint_symbol["icon-halo-color"]),"icon-halo-width":new Re(ie.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Re(ie.paint_symbol["icon-halo-blur"]),"icon-translate":new Ae(ie.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ae(ie.paint_symbol["icon-translate-anchor"]),"text-opacity":new Re(ie.paint_symbol["text-opacity"]),"text-color":new Re(ie.paint_symbol["text-color"],{runtimeType:ai,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new Re(ie.paint_symbol["text-halo-color"]),"text-halo-width":new Re(ie.paint_symbol["text-halo-width"]),"text-halo-blur":new Re(ie.paint_symbol["text-halo-blur"]),"text-translate":new Ae(ie.paint_symbol["text-translate"]),"text-translate-anchor":new Ae(ie.paint_symbol["text-translate-anchor"])})},get layout(){return nh=nh||new u({"symbol-placement":new Ae(ie.layout_symbol["symbol-placement"]),"symbol-spacing":new Ae(ie.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ae(ie.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Re(ie.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ae(ie.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ae(ie.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ae(ie.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ae(ie.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ae(ie.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ae(ie.layout_symbol["icon-rotation-alignment"]),"icon-size":new Re(ie.layout_symbol["icon-size"]),"icon-text-fit":new Ae(ie.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ae(ie.layout_symbol["icon-text-fit-padding"]),"icon-image":new Re(ie.layout_symbol["icon-image"]),"icon-rotate":new Re(ie.layout_symbol["icon-rotate"]),"icon-padding":new Re(ie.layout_symbol["icon-padding"]),"icon-keep-upright":new Ae(ie.layout_symbol["icon-keep-upright"]),"icon-offset":new Re(ie.layout_symbol["icon-offset"]),"icon-anchor":new Re(ie.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ae(ie.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ae(ie.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ae(ie.layout_symbol["text-rotation-alignment"]),"text-field":new Re(ie.layout_symbol["text-field"]),"text-font":new Re(ie.layout_symbol["text-font"]),"text-size":new Re(ie.layout_symbol["text-size"]),"text-max-width":new Re(ie.layout_symbol["text-max-width"]),"text-line-height":new Ae(ie.layout_symbol["text-line-height"]),"text-letter-spacing":new Re(ie.layout_symbol["text-letter-spacing"]),"text-justify":new Re(ie.layout_symbol["text-justify"]),"text-radial-offset":new Re(ie.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ae(ie.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Re(ie.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Re(ie.layout_symbol["text-anchor"]),"text-max-angle":new Ae(ie.layout_symbol["text-max-angle"]),"text-writing-mode":new Ae(ie.layout_symbol["text-writing-mode"]),"text-rotate":new Re(ie.layout_symbol["text-rotate"]),"text-padding":new Ae(ie.layout_symbol["text-padding"]),"text-keep-upright":new Ae(ie.layout_symbol["text-keep-upright"]),"text-transform":new Re(ie.layout_symbol["text-transform"]),"text-offset":new Re(ie.layout_symbol["text-offset"]),"text-allow-overlap":new Ae(ie.layout_symbol["text-allow-overlap"]),"text-overlap":new Ae(ie.layout_symbol["text-overlap"]),"text-ignore-placement":new Ae(ie.layout_symbol["text-ignore-placement"]),"text-optional":new Ae(ie.layout_symbol["text-optional"])})}};class oh{constructor(t){if(t.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:Er,this.defaultValue=t}evaluate(t){if(t.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(t.formattedSection))return r.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Ie("FormatSectionOverride",oh,{omit:["defaultValue"]});class Bl extends s{constructor(t){super(t,$c)}recalculate(t,r){if(super.recalculate(t,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const n=this.layout.get("text-writing-mode");if(n){const l=[];for(const h of n)l.indexOf(h)<0&&l.push(h);this.layout._values["text-writing-mode"]=l}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,r,n,l){const h=this.layout.get(t).evaluate(r,{},n,l),d=this._unevaluatedLayout._values[t];return d.isDataDriven()||Qn(d.value)||!h?h:function(f,g){return g.replace(/{([^{}]+)}/g,(x,v)=>f&&v in f?String(f[v]):"")}(r.properties,h)}createBucket(t){return new Pa(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of $c.paint.overridableProperties){if(!Bl.hasPaintOverride(this.layout,t))continue;const r=this.paint.get(t),n=new oh(r),l=new Yn(n,r.property.specification);let h=null;h=r.value.kind==="constant"||r.value.kind==="source"?new Ms("source",l):new zs("composite",l,r.value.zoomStops),this.paint._values[t]=new hr(r.property,h,r.parameters)}}_handleOverridablePaintPropertyUpdate(t,r,n){return!(!this.layout||r.isDataDriven()||n.isDataDriven())&&Bl.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,r){const n=t.get("text-field"),l=$c.paint.properties[r];let h=!1;const d=f=>{for(const g of f)if(l.overrides&&l.overrides.hasOverride(g))return void(h=!0)};if(n.value.kind==="constant"&&n.value.value instanceof _i)d(n.value.value.sections);else if(n.value.kind==="source"){const f=x=>{h||(x instanceof Ni&&zt(x.value)===vr?d(x.value.sections):x instanceof $n?d(x.sections):x.eachChild(f))},g=n.value;g._styleExpression&&f(g._styleExpression.expression)}return h}}let lh;var yp={get paint(){return lh=lh||new u({"background-color":new Ae(ie.paint_background["background-color"]),"background-pattern":new da(ie.paint_background["background-pattern"]),"background-opacity":new Ae(ie.paint_background["background-opacity"])})}};class xp extends s{constructor(t){super(t,yp)}}let ch;var vp={get paint(){return ch=ch||new u({"raster-opacity":new Ae(ie.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ae(ie.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ae(ie.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ae(ie.paint_raster["raster-brightness-max"]),"raster-saturation":new Ae(ie.paint_raster["raster-saturation"]),"raster-contrast":new Ae(ie.paint_raster["raster-contrast"]),"raster-resampling":new Ae(ie.paint_raster["raster-resampling"]),"raster-fade-duration":new Ae(ie.paint_raster["raster-fade-duration"])})}};class bp extends s{constructor(t){super(t,vp)}}class wp extends s{constructor(t){super(t,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=t}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class Tp{constructor(t){this._methodToThrottle=t,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const qc=63710088e-1;class Gs{constructor(t,r){if(isNaN(t)||isNaN(r))throw new Error(`Invalid LngLat object: (${t}, ${r})`);if(this.lng=+t,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Gs(tr(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const r=Math.PI/180,n=this.lat*r,l=t.lat*r,h=Math.sin(n)*Math.sin(l)+Math.cos(n)*Math.cos(l)*Math.cos((t.lng-this.lng)*r);return qc*Math.acos(Math.min(h,1))}static convert(t){if(t instanceof Gs)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new Gs(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new Gs(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const uh=2*Math.PI*qc;function hh(i){return uh*Math.cos(i*Math.PI/180)}function dh(i){return(180+i)/360}function ph(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function fh(i,t){return i/hh(t)}function Zc(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class Bo{constructor(t,r,n=0){this.x=+t,this.y=+r,this.z=+n}static fromLngLat(t,r=0){const n=Gs.convert(t);return new Bo(dh(n.lng),ph(n.lat),fh(r,n.lat))}toLngLat(){return new Gs(360*this.x-180,Zc(this.y))}toAltitude(){return this.z*hh(Zc(this.y))}meterInMercatorCoordinateUnits(){return 1/uh*(t=Zc(this.y),1/Math.cos(t*Math.PI/180));var t}}function mh(i,t,r){var n=2*Math.PI*6378137/256/Math.pow(2,r);return[i*n-2*Math.PI*6378137/2,t*n-2*Math.PI*6378137/2]}class Gc{constructor(t,r,n){if(!function(l,h,d){return!(l<0||l>25||d<0||d>=Math.pow(2,l)||h<0||h>=Math.pow(2,l))}(t,r,n))throw new Error(`x=${r}, y=${n}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=r,this.y=n,this.key=Fo(0,t,t,r,n)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,r,n){const l=(d=this.y,f=this.z,g=mh(256*(h=this.x),256*(d=Math.pow(2,f)-d-1),f),x=mh(256*(h+1),256*(d+1),f),g[0]+","+g[1]+","+x[0]+","+x[1]);var h,d,f,g,x;const v=function(w,I,M){let C,k="";for(let F=w;F>0;F--)C=1<<F-1,k+=(I&C?1:0)+(M&C?2:0);return k}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(n==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,v).replace(/{bbox-epsg-3857}/g,l)}isChildOf(t){const r=this.z-t.z;return r>0&&t.x===this.x>>r&&t.y===this.y>>r}getTilePoint(t){const r=Math.pow(2,this.z);return new me((t.x*r-this.x)*Ct,(t.y*r-this.y)*Ct)}toString(){return`${this.z}/${this.x}/${this.y}`}}class gh{constructor(t,r){this.wrap=t,this.canonical=r,this.key=Fo(t,r.z,r.z,r.x,r.y)}}class Xi{constructor(t,r,n,l,h){if(t<n)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${n}`);this.overscaledZ=t,this.wrap=r,this.canonical=new Gc(n,+l,+h),this.key=Fo(r,t,n,l,h)}clone(){return new Xi(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-t;return t>this.canonical.z?new Xi(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Xi(t,this.wrap,t,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(t,r){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const n=this.canonical.z-t;return t>this.canonical.z?Fo(this.wrap*+r,t,this.canonical.z,this.canonical.x,this.canonical.y):Fo(this.wrap*+r,t,t,this.canonical.x>>n,this.canonical.y>>n)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const r=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>r&&t.canonical.y===this.canonical.y>>r}children(t){if(this.overscaledZ>=t)return[new Xi(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 Xi(r,this.wrap,r,n,l),new Xi(r,this.wrap,r,n+1,l),new Xi(r,this.wrap,r,n,l+1),new Xi(r,this.wrap,r,n+1,l+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new Xi(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Xi(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new gh(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new Bo(t.x-this.wrap,t.y))}}function Fo(i,t,r,n,l){(i*=2)<0&&(i=-1*i-1);const h=1<<r;return(h*h*i+h*l+n).toString(36)+r.toString(36)+t.toString(36)}Ie("CanonicalTileID",Gc),Ie("OverscaledTileID",Xi,{omit:["posMatrix"]});class _h{constructor(t,r,n,l=1,h=1,d=1,f=0){if(this.uid=t,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(n&&!["mapbox","terrarium","custom"].includes(n))return void jt(`"${n}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=r.height;const g=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),n){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=l,this.greenFactor=h,this.blueFactor=d,this.baseShift=f;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let x=0;x<g;x++)this.data[this._idx(-1,x)]=this.data[this._idx(0,x)],this.data[this._idx(g,x)]=this.data[this._idx(g-1,x)],this.data[this._idx(x,-1)]=this.data[this._idx(x,0)],this.data[this._idx(x,g)]=this.data[this._idx(x,g-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(g,-1)]=this.data[this._idx(g-1,0)],this.data[this._idx(-1,g)]=this.data[this._idx(0,g-1)],this.data[this._idx(g,g)]=this.data[this._idx(g-1,g-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let x=0;x<g;x++)for(let v=0;v<g;v++){const w=this.get(x,v);w>this.max&&(this.max=w),w<this.min&&(this.min=w)}}get(t,r){const n=new Uint8Array(this.data.buffer),l=4*this._idx(t,r);return this.unpack(n[l],n[l+1],n[l+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,r){if(t<-1||t>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(t+1)}unpack(t,r,n){return t*this.redFactor+r*this.greenFactor+n*this.blueFactor-this.baseShift}getPixels(){return new Hi({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,r,n){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let l=r*this.dim,h=r*this.dim+this.dim,d=n*this.dim,f=n*this.dim+this.dim;switch(r){case-1:l=h-1;break;case 1:h=l+1}switch(n){case-1:d=f-1;break;case 1:f=d+1}const g=-r*this.dim,x=-n*this.dim;for(let v=d;v<f;v++)for(let w=l;w<h;w++)this.data[this._idx(w,v)]=t.data[this._idx(w+g,v+x)]}}Ie("DEMData",_h);class yh{constructor(t){this._stringToNumber={},this._numberToString=[];for(let r=0;r<t.length;r++){const n=t[r];this._stringToNumber[n]=r,this._numberToString[r]=n}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class xh{constructor(t,r,n,l,h){this.type="Feature",this._vectorTileFeature=t,t._z=r,t._x=n,t._y=l,this.properties=t.properties,this.id=h}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(t[r]=this[r]);return t}}class vh{constructor(t,r){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Es(Ct,16,0),this.grid3D=new Es(Ct,16,0),this.featureIndexArray=new ti,this.promoteId=r}insert(t,r,n,l,h,d){const f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,l,h);const g=d?this.grid3D:this.grid;for(let x=0;x<r.length;x++){const v=r[x],w=[1/0,1/0,-1/0,-1/0];for(let I=0;I<v.length;I++){const M=v[I];w[0]=Math.min(w[0],M.x),w[1]=Math.min(w[1],M.y),w[2]=Math.max(w[2],M.x),w[3]=Math.max(w[3],M.y)}w[0]<Ct&&w[1]<Ct&&w[2]>=0&&w[3]>=0&&g.insert(f,w[0],w[1],w[2],w[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new $s.VectorTile(new Lc(this.rawTileData)).layers,this.sourceLayerCoder=new yh(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,r,n,l){this.loadVTLayers();const h=t.params||{},d=Ct/t.tileSize/t.scale,f=to(h.filter),g=t.queryGeometry,x=t.queryPadding*d,v=wh(g),w=this.grid.query(v.minX-x,v.minY-x,v.maxX+x,v.maxY+x),I=wh(t.cameraQueryGeometry),M=this.grid3D.query(I.minX-x,I.minY-x,I.maxX+x,I.maxY+x,(F,j,Q,G)=>function(J,re,ce,we,Le){for(const ye of J)if(re<=ye.x&&ce<=ye.y&&we>=ye.x&&Le>=ye.y)return!0;const ve=[new me(re,ce),new me(re,Le),new me(we,Le),new me(we,ce)];if(J.length>2){for(const ye of ve)if(xa(J,ye))return!0}for(let ye=0;ye<J.length-1;ye++)if(rd(J[ye],J[ye+1],ve))return!0;return!1}(t.cameraQueryGeometry,F-x,j-x,Q+x,G+x));for(const F of M)w.push(F);w.sort(Sp);const C={};let k;for(let F=0;F<w.length;F++){const j=w[F];if(j===k)continue;k=j;const Q=this.featureIndexArray.get(j);let G=null;this.loadMatchingFeature(C,Q.bucketIndex,Q.sourceLayerIndex,Q.featureIndex,f,h.layers,h.availableImages,r,n,l,(J,re,ce)=>(G||(G=An(J)),re.queryIntersectsFeature(g,J,ce,G,this.z,t.transform,d,t.pixelPosMatrix)))}return C}loadMatchingFeature(t,r,n,l,h,d,f,g,x,v,w){const I=this.bucketLayerIDs[r];if(d&&!function(F,j){for(let Q=0;Q<F.length;Q++)if(j.indexOf(F[Q])>=0)return!0;return!1}(d,I))return;const M=this.sourceLayerCoder.decode(n),C=this.vtLayers[M].feature(l);if(h.needGeometry){const F=Mn(C,!0);if(!h.filter(new pt(this.tileID.overscaledZ),F,this.tileID.canonical))return}else if(!h.filter(new pt(this.tileID.overscaledZ),C))return;const k=this.getId(C,M);for(let F=0;F<I.length;F++){const j=I[F];if(d&&d.indexOf(j)<0)continue;const Q=g[j];if(!Q)continue;let G={};k&&v&&(G=v.getState(Q.sourceLayer||"_geojsonTileLayer",k));const J=Ii({},x[j]);J.paint=bh(J.paint,Q.paint,C,G,f),J.layout=bh(J.layout,Q.layout,C,G,f);const re=!w||w(C,Q,G);if(!re)continue;const ce=new xh(C,this.z,this.x,this.y,k);ce.layer=J;let we=t[j];we===void 0&&(we=t[j]=[]),we.push({featureIndex:l,feature:ce,intersectionZ:re})}}lookupSymbolFeatures(t,r,n,l,h,d,f,g){const x={};this.loadVTLayers();const v=to(h);for(const w of t)this.loadMatchingFeature(x,n,l,w,v,d,f,g,r);return x}hasLayer(t){for(const r of this.bucketLayerIDs)for(const n of r)if(t===n)return!0;return!1}getId(t,r){let n=t.id;return this.promoteId&&(n=t.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof n=="boolean"&&(n=Number(n))),n}}function bh(i,t,r,n,l){return ir(i,(h,d)=>{const f=t instanceof Tn?t.get(d):null;return f&&f.evaluate?f.evaluate(r,n,l):f})}function wh(i){let t=1/0,r=1/0,n=-1/0,l=-1/0;for(const h of i)t=Math.min(t,h.x),r=Math.min(r,h.y),n=Math.max(n,h.x),l=Math.max(l,h.y);return{minX:t,minY:r,maxX:n,maxY:l}}function Sp(i,t){return t-i}function Th(i,t,r,n,l){const h=[];for(let d=0;d<i.length;d++){const f=i[d];let g;for(let x=0;x<f.length-1;x++){let v=f[x],w=f[x+1];v.x<t&&w.x<t||(v.x<t?v=new me(t,v.y+(t-v.x)/(w.x-v.x)*(w.y-v.y))._round():w.x<t&&(w=new me(t,v.y+(t-v.x)/(w.x-v.x)*(w.y-v.y))._round()),v.y<r&&w.y<r||(v.y<r?v=new me(v.x+(r-v.y)/(w.y-v.y)*(w.x-v.x),r)._round():w.y<r&&(w=new me(v.x+(r-v.y)/(w.y-v.y)*(w.x-v.x),r)._round()),v.x>=n&&w.x>=n||(v.x>=n?v=new me(n,v.y+(n-v.x)/(w.x-v.x)*(w.y-v.y))._round():w.x>=n&&(w=new me(n,v.y+(n-v.x)/(w.x-v.x)*(w.y-v.y))._round()),v.y>=l&&w.y>=l||(v.y>=l?v=new me(v.x+(l-v.y)/(w.y-v.y)*(w.x-v.x),l)._round():w.y>=l&&(w=new me(v.x+(l-v.y)/(w.y-v.y)*(w.x-v.x),l)._round()),g&&v.equals(g[g.length-1])||(g=[v],h.push(g)),g.push(w)))))}}return h}Ie("FeatureIndex",vh,{omit:["rawTileData","sourceLayerCoder"]});class Hs extends me{constructor(t,r,n,l){super(t,r),this.angle=n,l!==void 0&&(this.segment=l)}clone(){return new Hs(this.x,this.y,this.angle,this.segment)}}function Sh(i,t,r,n,l){if(t.segment===void 0||r===0)return!0;let h=t,d=t.segment+1,f=0;for(;f>-r/2;){if(d--,d<0)return!1;f-=i[d].dist(h),h=i[d]}f+=i[d].dist(i[d+1]),d++;const g=[];let x=0;for(;f<r/2;){const v=i[d],w=i[d+1];if(!w)return!1;let I=i[d-1].angleTo(v)-v.angleTo(w);for(I=Math.abs((I+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:f,angleDelta:I}),x+=I;f-g[0].distance>n;)x-=g.shift().angleDelta;if(x>l)return!1;d++,f+=v.dist(w)}return!0}function Ih(i){let t=0;for(let r=0;r<i.length-1;r++)t+=i[r].dist(i[r+1]);return t}function Ph(i,t,r){return i?.6*t*r:0}function Ah(i,t){return Math.max(i?i.right-i.left:0,t?t.right-t.left:0)}function Ip(i,t,r,n,l,h){const d=Ph(r,l,h),f=Ah(r,n)*h;let g=0;const x=Ih(i)/2;for(let v=0;v<i.length-1;v++){const w=i[v],I=i[v+1],M=w.dist(I);if(g+M>x){const C=(x-g)/M,k=oi.number(w.x,I.x,C),F=oi.number(w.y,I.y,C),j=new Hs(k,F,I.angleTo(w),v);return j._round(),!d||Sh(i,j,f,d,t)?j:void 0}g+=M}}function Pp(i,t,r,n,l,h,d,f,g){const x=Ph(n,h,d),v=Ah(n,l),w=v*d,I=i[0].x===0||i[0].x===g||i[0].y===0||i[0].y===g;return t-w<t/4&&(t=w+t/4),Mh(i,I?t/2*f%t:(v/2+2*h)*d*f%t,t,x,r,w,I,!1,g)}function Mh(i,t,r,n,l,h,d,f,g){const x=h/2,v=Ih(i);let w=0,I=t-r,M=[];for(let C=0;C<i.length-1;C++){const k=i[C],F=i[C+1],j=k.dist(F),Q=F.angleTo(k);for(;I+r<w+j;){I+=r;const G=(I-w)/j,J=oi.number(k.x,F.x,G),re=oi.number(k.y,F.y,G);if(J>=0&&J<g&&re>=0&&re<g&&I-x>=0&&I+x<=v){const ce=new Hs(J,re,Q,C);ce._round(),n&&!Sh(i,ce,h,n,l)||M.push(ce)}}w+=j}return f||M.length||d||(M=Mh(i,w/2,r,n,l,h,d,!0,g)),M}Ie("Anchor",Hs);const Aa=Ti;function zh(i,t,r,n){const l=[],h=i.image,d=h.pixelRatio,f=h.paddedRect.w-2*Aa,g=h.paddedRect.h-2*Aa;let x={x1:i.left,y1:i.top,x2:i.right,y2:i.bottom};const v=h.stretchX||[[0,f]],w=h.stretchY||[[0,g]],I=(ae,ke)=>ae+ke[1]-ke[0],M=v.reduce(I,0),C=w.reduce(I,0),k=f-M,F=g-C;let j=0,Q=M,G=0,J=C,re=0,ce=k,we=0,Le=F;if(h.content&&n){const ae=h.content,ke=ae[2]-ae[0],ze=ae[3]-ae[1];(h.textFitWidth||h.textFitHeight)&&(x=ih(i)),j=Fl(v,0,ae[0]),G=Fl(w,0,ae[1]),Q=Fl(v,ae[0],ae[2]),J=Fl(w,ae[1],ae[3]),re=ae[0]-j,we=ae[1]-G,ce=ke-Q,Le=ze-J}const ve=x.x1,ye=x.y1,Ce=x.x2-ve,Pe=x.y2-ye,Se=(ae,ke,ze,Oe)=>{const ut=Ol(ae.stretch-j,Q,Ce,ve),ct=Vl(ae.fixed-re,ce,ae.stretch,M),Dt=Ol(ke.stretch-G,J,Pe,ye),pr=Vl(ke.fixed-we,Le,ke.stretch,C),Ht=Ol(ze.stretch-j,Q,Ce,ve),Lt=Vl(ze.fixed-re,ce,ze.stretch,M),hi=Ol(Oe.stretch-G,J,Pe,ye),di=Vl(Oe.fixed-we,Le,Oe.stretch,C),pi=new me(ut,Dt),It=new me(Ht,Dt),Rt=new me(Ht,hi),ri=new me(ut,hi),Xt=new me(ct/d,pr/d),fi=new me(Lt/d,di/d),Wt=t*Math.PI/180;if(Wt){const Qe=Math.sin(Wt),dt=Math.cos(Wt),_t=[dt,-Qe,Qe,dt];pi._matMult(_t),It._matMult(_t),ri._matMult(_t),Rt._matMult(_t)}const Wi=ae.stretch+ae.fixed,Si=ke.stretch+ke.fixed;return{tl:pi,tr:It,bl:ri,br:Rt,tex:{x:h.paddedRect.x+Aa+Wi,y:h.paddedRect.y+Aa+Si,w:ze.stretch+ze.fixed-Wi,h:Oe.stretch+Oe.fixed-Si},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Xt,pixelOffsetBR:fi,minFontScaleX:ce/d/Ce,minFontScaleY:Le/d/Pe,isSDF:r}};if(n&&(h.stretchX||h.stretchY)){const ae=Ch(v,k,M),ke=Ch(w,F,C);for(let ze=0;ze<ae.length-1;ze++){const Oe=ae[ze],ut=ae[ze+1];for(let ct=0;ct<ke.length-1;ct++)l.push(Se(Oe,ke[ct],ut,ke[ct+1]))}}else l.push(Se({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:f+1},{fixed:0,stretch:g+1}));return l}function Fl(i,t,r){let n=0;for(const l of i)n+=Math.max(t,Math.min(r,l[1]))-Math.max(t,Math.min(r,l[0]));return n}function Ch(i,t,r){const n=[{fixed:-Aa,stretch:0}];for(const[l,h]of i){const d=n[n.length-1];n.push({fixed:l-d.stretch,stretch:d.stretch}),n.push({fixed:l-d.stretch,stretch:d.stretch+(h-l)})}return n.push({fixed:t+Aa,stretch:r}),n}function Ol(i,t,r,n){return i/t*r+n}function Vl(i,t,r,n){return i-t*r/n}class Nl{constructor(t,r,n,l,h,d,f,g,x,v){var w;if(this.boxStartIndex=t.length,x){let I=d.top,M=d.bottom;const C=d.collisionPadding;C&&(I-=C[1],M+=C[3]);let k=M-I;k>0&&(k=Math.max(10,k),this.circleDiameter=k)}else{const I=!((w=d.image)===null||w===void 0)&&w.content&&(d.image.textFitWidth||d.image.textFitHeight)?ih(d):{x1:d.left,y1:d.top,x2:d.right,y2:d.bottom};I.y1=I.y1*f-g[0],I.y2=I.y2*f+g[2],I.x1=I.x1*f-g[3],I.x2=I.x2*f+g[1];const M=d.collisionPadding;if(M&&(I.x1-=M[0]*f,I.y1-=M[1]*f,I.x2+=M[2]*f,I.y2+=M[3]*f),v){const C=new me(I.x1,I.y1),k=new me(I.x2,I.y1),F=new me(I.x1,I.y2),j=new me(I.x2,I.y2),Q=v*Math.PI/180;C._rotate(Q),k._rotate(Q),F._rotate(Q),j._rotate(Q),I.x1=Math.min(C.x,k.x,F.x,j.x),I.x2=Math.max(C.x,k.x,F.x,j.x),I.y1=Math.min(C.y,k.y,F.y,j.y),I.y2=Math.max(C.y,k.y,F.y,j.y)}t.emplaceBack(r.x,r.y,I.x1,I.y1,I.x2,I.y2,n,l,h)}this.boxEndIndex=t.length}}class Ap{constructor(t=[],r=(n,l)=>n<l?-1:n>l?1:0){if(this.data=t,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(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;const t=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:r,compare:n}=this,l=r[t];for(;t>0;){const h=t-1>>1,d=r[h];if(n(l,d)>=0)break;r[t]=d,t=h}r[t]=l}_down(t){const{data:r,compare:n}=this,l=this.length>>1,h=r[t];for(;t<l;){let d=1+(t<<1);const f=d+1;if(f<this.length&&n(r[f],r[d])<0&&(d=f),n(r[d],h)>=0)break;r[t]=r[d],t=d}r[t]=h}}function Mp(i,t=1,r=!1){let n=1/0,l=1/0,h=-1/0,d=-1/0;const f=i[0];for(let M=0;M<f.length;M++){const C=f[M];(!M||C.x<n)&&(n=C.x),(!M||C.y<l)&&(l=C.y),(!M||C.x>h)&&(h=C.x),(!M||C.y>d)&&(d=C.y)}const g=Math.min(h-n,d-l);let x=g/2;const v=new Ap([],zp);if(g===0)return new me(n,l);for(let M=n;M<h;M+=g)for(let C=l;C<d;C+=g)v.push(new Ma(M+x,C+x,x,i));let w=function(M){let C=0,k=0,F=0;const j=M[0];for(let Q=0,G=j.length,J=G-1;Q<G;J=Q++){const re=j[Q],ce=j[J],we=re.x*ce.y-ce.x*re.y;k+=(re.x+ce.x)*we,F+=(re.y+ce.y)*we,C+=3*we}return new Ma(k/C,F/C,0,M)}(i),I=v.length;for(;v.length;){const M=v.pop();(M.d>w.d||!w.d)&&(w=M,r&&console.log("found best %d after %d probes",Math.round(1e4*M.d)/1e4,I)),M.max-w.d<=t||(x=M.h/2,v.push(new Ma(M.p.x-x,M.p.y-x,x,i)),v.push(new Ma(M.p.x+x,M.p.y-x,x,i)),v.push(new Ma(M.p.x-x,M.p.y+x,x,i)),v.push(new Ma(M.p.x+x,M.p.y+x,x,i)),I+=4)}return r&&(console.log(`num probes: ${I}`),console.log(`best distance: ${w.d}`)),w.p}function zp(i,t){return t.max-i.max}function Ma(i,t,r,n){this.p=new me(i,t),this.h=r,this.d=function(l,h){let d=!1,f=1/0;for(let g=0;g<h.length;g++){const x=h[g];for(let v=0,w=x.length,I=w-1;v<w;I=v++){const M=x[v],C=x[I];M.y>l.y!=C.y>l.y&&l.x<(C.x-M.x)*(l.y-M.y)/(C.y-M.y)+M.x&&(d=!d),f=Math.min(f,pu(l,M,C))}}return(d?1:-1)*Math.sqrt(f)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}var Gt;L.aq=void 0,(Gt=L.aq||(L.aq={}))[Gt.center=1]="center",Gt[Gt.left=2]="left",Gt[Gt.right=3]="right",Gt[Gt.top=4]="top",Gt[Gt.bottom=5]="bottom",Gt[Gt["top-left"]=6]="top-left",Gt[Gt["top-right"]=7]="top-right",Gt[Gt["bottom-left"]=8]="bottom-left",Gt[Gt["bottom-right"]=9]="bottom-right";const Xs=7,Hc=Number.POSITIVE_INFINITY;function kh(i,t){return t[1]!==Hc?function(r,n,l){let h=0,d=0;switch(n=Math.abs(n),l=Math.abs(l),r){case"top-right":case"top-left":case"top":d=l-Xs;break;case"bottom-right":case"bottom-left":case"bottom":d=-l+Xs}switch(r){case"top-right":case"bottom-right":case"right":h=-n;break;case"top-left":case"bottom-left":case"left":h=n}return[h,d]}(i,t[0],t[1]):function(r,n){let l=0,h=0;n<0&&(n=0);const d=n/Math.SQRT2;switch(r){case"top-right":case"top-left":h=d-Xs;break;case"bottom-right":case"bottom-left":h=-d+Xs;break;case"bottom":h=-n+Xs;break;case"top":h=n-Xs}switch(r){case"top-right":case"bottom-right":l=-d;break;case"top-left":case"bottom-left":l=d;break;case"left":l=n;break;case"right":l=-n}return[l,h]}(i,t[0])}function Eh(i,t,r){var n;const l=i.layout,h=(n=l.get("text-variable-anchor-offset"))===null||n===void 0?void 0:n.evaluate(t,{},r);if(h){const f=h.values,g=[];for(let x=0;x<f.length;x+=2){const v=g[x]=f[x],w=f[x+1].map(I=>I*kt);v.startsWith("top")?w[1]-=Xs:v.startsWith("bottom")&&(w[1]+=Xs),g[x+1]=w}return new Ai(g)}const d=l.get("text-variable-anchor");if(d){let f;f=i._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[l.get("text-radial-offset").evaluate(t,{},r)*kt,Hc]:l.get("text-offset").evaluate(t,{},r).map(x=>x*kt);const g=[];for(const x of d)g.push(x,kh(x,f));return new Ai(g)}return null}function Xc(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 Cp(i,t,r,n,l,h,d,f,g,x,v){let w=h.textMaxSize.evaluate(t,{});w===void 0&&(w=d);const I=i.layers[0].layout,M=I.get("icon-offset").evaluate(t,{},v),C=Lh(r.horizontal),k=d/24,F=i.tilePixelRatio*k,j=i.tilePixelRatio*w/24,Q=i.tilePixelRatio*f,G=i.tilePixelRatio*I.get("symbol-spacing"),J=I.get("text-padding")*i.tilePixelRatio,re=function(ae,ke,ze,Oe=1){const ut=ae.get("icon-padding").evaluate(ke,{},ze),ct=ut&&ut.values;return[ct[0]*Oe,ct[1]*Oe,ct[2]*Oe,ct[3]*Oe]}(I,t,v,i.tilePixelRatio),ce=I.get("text-max-angle")/180*Math.PI,we=I.get("text-rotation-alignment")!=="viewport"&&I.get("symbol-placement")!=="point",Le=I.get("icon-rotation-alignment")==="map"&&I.get("symbol-placement")!=="point",ve=I.get("symbol-placement"),ye=G/2,Ce=I.get("icon-text-fit");let Pe;n&&Ce!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Pe=rh(n,r.vertical,Ce,I.get("icon-text-fit-padding"),M,k)),C&&(n=rh(n,C,Ce,I.get("icon-text-fit-padding"),M,k)));const Se=(ae,ke)=>{ke.x<0||ke.x>=Ct||ke.y<0||ke.y>=Ct||function(ze,Oe,ut,ct,Dt,pr,Ht,Lt,hi,di,pi,It,Rt,ri,Xt,fi,Wt,Wi,Si,Qe,dt,_t,Li,wt,za){const Vr=ze.addToLineVertexArray(Oe,ut);let Nr,fr,Ki,Vt,ls=0,No=0,Oh=0,Vh=0,iu=-1,ru=-1;const cs={};let Nh=ma("");if(ze.allowVerticalPlacement&&ct.vertical){const si=Lt.layout.get("text-rotate").evaluate(dt,{},wt)+90;Ki=new Nl(hi,Oe,di,pi,It,ct.vertical,Rt,ri,Xt,si),Ht&&(Vt=new Nl(hi,Oe,di,pi,It,Ht,Wt,Wi,Xt,si))}if(Dt){const si=Lt.layout.get("icon-rotate").evaluate(dt,{}),Ji=Lt.layout.get("icon-text-fit")!=="none",Cn=zh(Dt,si,Li,Ji),Ir=Ht?zh(Ht,si,Li,Ji):void 0;fr=new Nl(hi,Oe,di,pi,It,Dt,Wt,Wi,!1,si),ls=4*Cn.length;const kn=ze.iconSizeData;let jr=null;kn.kind==="source"?(jr=[Or*Lt.layout.get("icon-size").evaluate(dt,{})],jr[0]>Zs&&jt(`${ze.layerIds[0]}: Value for "icon-size" is >= ${Ro}. Reduce your "icon-size".`)):kn.kind==="composite"&&(jr=[Or*_t.compositeIconSizes[0].evaluate(dt,{},wt),Or*_t.compositeIconSizes[1].evaluate(dt,{},wt)],(jr[0]>Zs||jr[1]>Zs)&&jt(`${ze.layerIds[0]}: Value for "icon-size" is >= ${Ro}. Reduce your "icon-size".`)),ze.addSymbols(ze.icon,Cn,jr,Qe,Si,dt,L.ah.none,Oe,Vr.lineStartIndex,Vr.lineLength,-1,wt),iu=ze.icon.placedSymbolArray.length-1,Ir&&(No=4*Ir.length,ze.addSymbols(ze.icon,Ir,jr,Qe,Si,dt,L.ah.vertical,Oe,Vr.lineStartIndex,Vr.lineLength,-1,wt),ru=ze.icon.placedSymbolArray.length-1)}const jh=Object.keys(ct.horizontal);for(const si of jh){const Ji=ct.horizontal[si];if(!Nr){Nh=ma(Ji.text);const Ir=Lt.layout.get("text-rotate").evaluate(dt,{},wt);Nr=new Nl(hi,Oe,di,pi,It,Ji,Rt,ri,Xt,Ir)}const Cn=Ji.positionedLines.length===1;if(Oh+=Dh(ze,Oe,Ji,pr,Lt,Xt,dt,fi,Vr,ct.vertical?L.ah.horizontal:L.ah.horizontalOnly,Cn?jh:[si],cs,iu,_t,wt),Cn)break}ct.vertical&&(Vh+=Dh(ze,Oe,ct.vertical,pr,Lt,Xt,dt,fi,Vr,L.ah.vertical,["vertical"],cs,ru,_t,wt));const Dp=Nr?Nr.boxStartIndex:ze.collisionBoxArray.length,Lp=Nr?Nr.boxEndIndex:ze.collisionBoxArray.length,Rp=Ki?Ki.boxStartIndex:ze.collisionBoxArray.length,Bp=Ki?Ki.boxEndIndex:ze.collisionBoxArray.length,Fp=fr?fr.boxStartIndex:ze.collisionBoxArray.length,Op=fr?fr.boxEndIndex:ze.collisionBoxArray.length,Vp=Vt?Vt.boxStartIndex:ze.collisionBoxArray.length,Np=Vt?Vt.boxEndIndex:ze.collisionBoxArray.length;let Sr=-1;const Ul=(si,Ji)=>si&&si.circleDiameter?Math.max(si.circleDiameter,Ji):Ji;Sr=Ul(Nr,Sr),Sr=Ul(Ki,Sr),Sr=Ul(fr,Sr),Sr=Ul(Vt,Sr);const Uh=Sr>-1?1:0;Uh&&(Sr*=za/kt),ze.glyphOffsetArray.length>=Pa.MAX_GLYPHS&&jt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),dt.sortKey!==void 0&&ze.addToSortKeyRanges(ze.symbolInstances.length,dt.sortKey);const jp=Eh(Lt,dt,wt),[Up,$p]=function(si,Ji){const Cn=si.length,Ir=Ji==null?void 0:Ji.values;if((Ir==null?void 0:Ir.length)>0)for(let kn=0;kn<Ir.length;kn+=2){const jr=Ir[kn+1];si.emplaceBack(L.aq[Ir[kn]],jr[0],jr[1])}return[Cn,si.length]}(ze.textAnchorOffsets,jp);ze.symbolInstances.emplaceBack(Oe.x,Oe.y,cs.right>=0?cs.right:-1,cs.center>=0?cs.center:-1,cs.left>=0?cs.left:-1,cs.vertical||-1,iu,ru,Nh,Dp,Lp,Rp,Bp,Fp,Op,Vp,Np,di,Oh,Vh,ls,No,Uh,0,Rt,Sr,Up,$p)}(i,ke,ae,r,n,l,Pe,i.layers[0],i.collisionBoxArray,t.index,t.sourceLayerIndex,i.index,F,[J,J,J,J],we,g,Q,re,Le,M,t,h,x,v,d)};if(ve==="line")for(const ae of Th(t.geometry,0,0,Ct,Ct)){const ke=Pp(ae,G,ce,r.vertical||C,n,24,j,i.overscaling,Ct);for(const ze of ke)C&&kp(i,C.text,ye,ze)||Se(ae,ze)}else if(ve==="line-center"){for(const ae of t.geometry)if(ae.length>1){const ke=Ip(ae,ce,r.vertical||C,n,24,j);ke&&Se(ae,ke)}}else if(t.type==="Polygon")for(const ae of Zn(t.geometry,0)){const ke=Mp(ae,16);Se(ae[0],new Hs(ke.x,ke.y,0))}else if(t.type==="LineString")for(const ae of t.geometry)Se(ae,new Hs(ae[0].x,ae[0].y,0));else if(t.type==="Point")for(const ae of t.geometry)for(const ke of ae)Se([ke],new Hs(ke.x,ke.y,0))}function Dh(i,t,r,n,l,h,d,f,g,x,v,w,I,M,C){const k=function(Q,G,J,re,ce,we,Le,ve){const ye=re.layout.get("text-rotate").evaluate(we,{})*Math.PI/180,Ce=[];for(const Pe of G.positionedLines)for(const Se of Pe.positionedGlyphs){if(!Se.rect)continue;const ae=Se.rect||{};let ke=Wu+1,ze=!0,Oe=1,ut=0;const ct=(ce||ve)&&Se.vertical,Dt=Se.metrics.advance*Se.scale/2;if(ve&&G.verticalizable&&(ut=Pe.lineOffset/2-(Se.imageName?-(kt-Se.metrics.width*Se.scale)/2:(Se.scale-1)*kt)),Se.imageName){const Qe=Le[Se.imageName];ze=Qe.sdf,Oe=Qe.pixelRatio,ke=Ti/Oe}const pr=ce?[Se.x+Dt,Se.y]:[0,0];let Ht=ce?[0,0]:[Se.x+Dt+J[0],Se.y+J[1]-ut],Lt=[0,0];ct&&(Lt=Ht,Ht=[0,0]);const hi=Se.metrics.isDoubleResolution?2:1,di=(Se.metrics.left-ke)*Se.scale-Dt+Ht[0],pi=(-Se.metrics.top-ke)*Se.scale+Ht[1],It=di+ae.w/hi*Se.scale/Oe,Rt=pi+ae.h/hi*Se.scale/Oe,ri=new me(di,pi),Xt=new me(It,pi),fi=new me(di,Rt),Wt=new me(It,Rt);if(ct){const Qe=new me(-Dt,Dt-Do),dt=-Math.PI/2,_t=kt/2-Dt,Li=new me(5-Do-_t,-(Se.imageName?_t:0)),wt=new me(...Lt);ri._rotateAround(dt,Qe)._add(Li)._add(wt),Xt._rotateAround(dt,Qe)._add(Li)._add(wt),fi._rotateAround(dt,Qe)._add(Li)._add(wt),Wt._rotateAround(dt,Qe)._add(Li)._add(wt)}if(ye){const Qe=Math.sin(ye),dt=Math.cos(ye),_t=[dt,-Qe,Qe,dt];ri._matMult(_t),Xt._matMult(_t),fi._matMult(_t),Wt._matMult(_t)}const Wi=new me(0,0),Si=new me(0,0);Ce.push({tl:ri,tr:Xt,bl:fi,br:Wt,tex:ae,writingMode:G.writingMode,glyphOffset:pr,sectionIndex:Se.sectionIndex,isSDF:ze,pixelOffsetTL:Wi,pixelOffsetBR:Si,minFontScaleX:0,minFontScaleY:0})}return Ce}(0,r,f,l,h,d,n,i.allowVerticalPlacement),F=i.textSizeData;let j=null;F.kind==="source"?(j=[Or*l.layout.get("text-size").evaluate(d,{})],j[0]>Zs&&jt(`${i.layerIds[0]}: Value for "text-size" is >= ${Ro}. Reduce your "text-size".`)):F.kind==="composite"&&(j=[Or*M.compositeTextSizes[0].evaluate(d,{},C),Or*M.compositeTextSizes[1].evaluate(d,{},C)],(j[0]>Zs||j[1]>Zs)&&jt(`${i.layerIds[0]}: Value for "text-size" is >= ${Ro}. Reduce your "text-size".`)),i.addSymbols(i.text,k,j,f,h,d,x,t,g.lineStartIndex,g.lineLength,I,C);for(const Q of v)w[Q]=i.text.placedSymbolArray.length-1;return 4*k.length}function Lh(i){for(const t in i)return i[t];return null}function kp(i,t,r,n){const l=i.compareText;if(t in l){const h=l[t];for(let d=h.length-1;d>=0;d--)if(n.dist(h[d])<r)return!0}else l[t]=[];return l[t].push(n),!1}const Rh=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Wc{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[r,n]=new Uint8Array(t,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 h=Rh[15&n];if(!h)throw new Error("Unrecognized array type.");const[d]=new Uint16Array(t,2,1),[f]=new Uint32Array(t,4,1);return new Wc(f,d,h,t)}constructor(t,r=64,n=Float64Array,l){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=n,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const h=Rh.indexOf(this.ArrayType),d=2*t*this.ArrayType.BYTES_PER_ELEMENT,f=t*this.IndexArrayType.BYTES_PER_ELEMENT,g=(8-f%8)%8;if(h<0)throw new Error(`Unexpected typed array class: ${n}.`);l&&l instanceof ArrayBuffer?(this.data=l,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+f+g,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+d+f+g),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+f+g,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+h]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=t)}add(t,r){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=t,this.coords[this._pos++]=r,n}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Kc(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,r,n,l){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:h,coords:d,nodeSize:f}=this,g=[0,h.length-1,0],x=[];for(;g.length;){const v=g.pop()||0,w=g.pop()||0,I=g.pop()||0;if(w-I<=f){for(let F=I;F<=w;F++){const j=d[2*F],Q=d[2*F+1];j>=t&&j<=n&&Q>=r&&Q<=l&&x.push(h[F])}continue}const M=I+w>>1,C=d[2*M],k=d[2*M+1];C>=t&&C<=n&&k>=r&&k<=l&&x.push(h[M]),(v===0?t<=C:r<=k)&&(g.push(I),g.push(M-1),g.push(1-v)),(v===0?n>=C:l>=k)&&(g.push(M+1),g.push(w),g.push(1-v))}return x}within(t,r,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:h,nodeSize:d}=this,f=[0,l.length-1,0],g=[],x=n*n;for(;f.length;){const v=f.pop()||0,w=f.pop()||0,I=f.pop()||0;if(w-I<=d){for(let F=I;F<=w;F++)Fh(h[2*F],h[2*F+1],t,r)<=x&&g.push(l[F]);continue}const M=I+w>>1,C=h[2*M],k=h[2*M+1];Fh(C,k,t,r)<=x&&g.push(l[M]),(v===0?t-n<=C:r-n<=k)&&(f.push(I),f.push(M-1),f.push(1-v)),(v===0?t+n>=C:r+n>=k)&&(f.push(M+1),f.push(w),f.push(1-v))}return g}}function Kc(i,t,r,n,l,h){if(l-n<=r)return;const d=n+l>>1;Bh(i,t,d,n,l,h),Kc(i,t,r,n,d-1,1-h),Kc(i,t,r,d+1,l,1-h)}function Bh(i,t,r,n,l,h){for(;l>n;){if(l-n>600){const x=l-n+1,v=r-n+1,w=Math.log(x),I=.5*Math.exp(2*w/3),M=.5*Math.sqrt(w*I*(x-I)/x)*(v-x/2<0?-1:1);Bh(i,t,r,Math.max(n,Math.floor(r-v*I/x+M)),Math.min(l,Math.floor(r+(x-v)*I/x+M)),h)}const d=t[2*r+h];let f=n,g=l;for(Oo(i,t,n,r),t[2*l+h]>d&&Oo(i,t,n,l);f<g;){for(Oo(i,t,f,g),f++,g--;t[2*f+h]<d;)f++;for(;t[2*g+h]>d;)g--}t[2*n+h]===d?Oo(i,t,n,g):(g++,Oo(i,t,g,l)),g<=r&&(n=g+1),r<=g&&(l=g-1)}}function Oo(i,t,r,n){Jc(i,r,n),Jc(t,2*r,2*n),Jc(t,2*r+1,2*n+1)}function Jc(i,t,r){const n=i[t];i[t]=i[r],i[r]=n}function Fh(i,t,r,n){const l=i-r,h=t-n;return l*l+h*h}var Yc;L.bg=void 0,(Yc=L.bg||(L.bg={})).create="create",Yc.load="load",Yc.fullLoad="fullLoad";let jl=null,Vo=[];const Qc=1e3/60,eu="loadTime",tu="fullLoadTime",Ep={mark(i){performance.mark(i)},frame(i){const t=i;jl!=null&&Vo.push(t-jl),jl=t},clearMetrics(){jl=null,Vo=[],performance.clearMeasures(eu),performance.clearMeasures(tu);for(const i in L.bg)performance.clearMarks(L.bg[i])},getPerformanceMetrics(){performance.measure(eu,L.bg.create,L.bg.load),performance.measure(tu,L.bg.create,L.bg.fullLoad);const i=performance.getEntriesByName(eu)[0].duration,t=performance.getEntriesByName(tu)[0].duration,r=Vo.length,n=1/(Vo.reduce((h,d)=>h+d,0)/r/1e3),l=Vo.filter(h=>h>Qc).reduce((h,d)=>h+(d-Qc)/Qc,0);return{loadTime:i,fullLoadTime:t,fps:n,percentDroppedFrames:l/(r+l)*100,totalFrames:r}}};L.$=class extends T{},L.A=va,L.B=cc,L.C=function(i){if(hs==null){const t=i.navigator?i.navigator.userAgent:null;hs=!!i.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return hs},L.D=Ae,L.E=fs,L.F=class{constructor(i,t){this.target=i,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Tp(()=>this.process()),this.subscription=function(r,n,l,h){return r.addEventListener(n,l,!1),{unsubscribe:()=>{r.removeEventListener(n,l,!1)}}}(this.target,"message",r=>this.receive(r)),this.globalScope=gr(self)?i:window}registerMessageHandler(i,t){this.messageHandlers[i]=t}sendAsync(i,t){return new Promise((r,n)=>{const l=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[l]={resolve:r,reject:n},t&&t.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 h=[],d=Object.assign(Object.assign({},i),{id:l,sourceMapId:this.mapId,origin:location.origin,data:Ds(i.data,h)});this.target.postMessage(d,{transfer:h})})}receive(i){const t=i.data,r=t.id;if(!(t.origin!=="file://"&&location.origin!=="file://"&&t.origin!=="resource://android"&&location.origin!=="resource://android"&&t.origin!==location.origin||t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type==="<cancel>"){delete this.tasks[r];const n=this.abortControllers[r];return delete this.abortControllers[r],void(n&&n.abort())}if(gr(self)||t.mustQueue)return this.tasks[r]=t,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,t)}}process(){if(this.taskQueue.length===0)return;const i=this.taskQueue.shift(),t=this.tasks[i];delete this.tasks[i],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(i,t)}processTask(i,t){return p(this,void 0,void 0,function*(){if(t.type==="<response>"){const l=this.resolveRejects[i];return delete this.resolveRejects[i],l?void(t.error?l.reject(Ls(t.error)):l.resolve(Ls(t.data))):void 0}if(!this.messageHandlers[t.type])return void this.completeTask(i,new Error(`Could not find a registered handler for ${t.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const r=Ls(t.data),n=new AbortController;this.abortControllers[i]=n;try{const l=yield this.messageHandlers[t.type](t.sourceMapId,r,n);this.completeTask(i,null,l)}catch(l){this.completeTask(i,l)}})}completeTask(i,t,r){const n=[];delete this.abortControllers[i];const l={id:i,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?Ds(t):null,data:Ds(r,n)};this.target.postMessage(l,{transfer:n})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},L.G=ps,L.H=function(){var i=new va(16);return va!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},L.I=Bc,L.J=function(i,t,r){var n,l,h,d,f,g,x,v,w,I,M,C,k=r[0],F=r[1],j=r[2];return t===i?(i[12]=t[0]*k+t[4]*F+t[8]*j+t[12],i[13]=t[1]*k+t[5]*F+t[9]*j+t[13],i[14]=t[2]*k+t[6]*F+t[10]*j+t[14],i[15]=t[3]*k+t[7]*F+t[11]*j+t[15]):(l=t[1],h=t[2],d=t[3],f=t[4],g=t[5],x=t[6],v=t[7],w=t[8],I=t[9],M=t[10],C=t[11],i[0]=n=t[0],i[1]=l,i[2]=h,i[3]=d,i[4]=f,i[5]=g,i[6]=x,i[7]=v,i[8]=w,i[9]=I,i[10]=M,i[11]=C,i[12]=n*k+f*F+w*j+t[12],i[13]=l*k+g*F+I*j+t[13],i[14]=h*k+x*F+M*j+t[14],i[15]=d*k+v*F+C*j+t[15]),i},L.K=function(i,t,r){var n=r[0],l=r[1],h=r[2];return i[0]=t[0]*n,i[1]=t[1]*n,i[2]=t[2]*n,i[3]=t[3]*n,i[4]=t[4]*l,i[5]=t[5]*l,i[6]=t[6]*l,i[7]=t[7]*l,i[8]=t[8]*h,i[9]=t[9]*h,i[10]=t[10]*h,i[11]=t[11]*h,i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15],i},L.L=_u,L.M=function(i,t){const r={};for(let n=0;n<t.length;n++){const l=t[n];l in i&&(r[l]=i[l])}return r},L.N=Gs,L.O=dh,L.P=me,L.Q=ph,L.R=Hi,L.S=Xi,L.T=ua,L.U=mr,L.V=Js,L.W=$r,L.X=Ct,L.Y=m,L.Z=Bo,L._=p,L.a=Mr,L.a$=function(i,t){var r=i[0],n=i[1],l=i[2],h=i[3],d=i[4],f=i[5],g=i[6],x=i[7],v=i[8],w=i[9],I=i[10],M=i[11],C=i[12],k=i[13],F=i[14],j=i[15],Q=t[0],G=t[1],J=t[2],re=t[3],ce=t[4],we=t[5],Le=t[6],ve=t[7],ye=t[8],Ce=t[9],Pe=t[10],Se=t[11],ae=t[12],ke=t[13],ze=t[14],Oe=t[15];return Math.abs(r-Q)<=ui*Math.max(1,Math.abs(r),Math.abs(Q))&&Math.abs(n-G)<=ui*Math.max(1,Math.abs(n),Math.abs(G))&&Math.abs(l-J)<=ui*Math.max(1,Math.abs(l),Math.abs(J))&&Math.abs(h-re)<=ui*Math.max(1,Math.abs(h),Math.abs(re))&&Math.abs(d-ce)<=ui*Math.max(1,Math.abs(d),Math.abs(ce))&&Math.abs(f-we)<=ui*Math.max(1,Math.abs(f),Math.abs(we))&&Math.abs(g-Le)<=ui*Math.max(1,Math.abs(g),Math.abs(Le))&&Math.abs(x-ve)<=ui*Math.max(1,Math.abs(x),Math.abs(ve))&&Math.abs(v-ye)<=ui*Math.max(1,Math.abs(v),Math.abs(ye))&&Math.abs(w-Ce)<=ui*Math.max(1,Math.abs(w),Math.abs(Ce))&&Math.abs(I-Pe)<=ui*Math.max(1,Math.abs(I),Math.abs(Pe))&&Math.abs(M-Se)<=ui*Math.max(1,Math.abs(M),Math.abs(Se))&&Math.abs(C-ae)<=ui*Math.max(1,Math.abs(C),Math.abs(ae))&&Math.abs(k-ke)<=ui*Math.max(1,Math.abs(k),Math.abs(ke))&&Math.abs(F-ze)<=ui*Math.max(1,Math.abs(F),Math.abs(ze))&&Math.abs(j-Oe)<=ui*Math.max(1,Math.abs(j),Math.abs(Oe))},L.a0=We,L.a1=Gc,L.a2=he,L.a3=i=>{const t=window.document.createElement("video");return t.muted=!0,new Promise(r=>{t.onloadstart=()=>{r(t)};for(const n of i){const l=window.document.createElement("source");Zr(n)||(t.crossOrigin="Anonymous"),l.src=n,t.appendChild(l)}})},L.a4=function(){return Dn++},L.a5=be,L.a6=Pa,L.a7=to,L.a8=Mn,L.a9=xh,L.aA=function(i){if(i.type==="custom")return new wp(i);switch(i.type){case"background":return new xp(i);case"circle":return new ad(i);case"fill":return new Td(i);case"fill-extrusion":return new Od(i);case"heatmap":return new ld(i);case"hillshade":return new ud(i);case"line":return new Gd(i);case"raster":return new bp(i);case"symbol":return new Bl(i)}},L.aB=at,L.aC=function(i,t){if(!i)return[{command:"setStyle",args:[t]}];let r=[];try{if(!et(i.version,t.version))return[{command:"setStyle",args:[t]}];et(i.center,t.center)||r.push({command:"setCenter",args:[t.center]}),et(i.zoom,t.zoom)||r.push({command:"setZoom",args:[t.zoom]}),et(i.bearing,t.bearing)||r.push({command:"setBearing",args:[t.bearing]}),et(i.pitch,t.pitch)||r.push({command:"setPitch",args:[t.pitch]}),et(i.sprite,t.sprite)||r.push({command:"setSprite",args:[t.sprite]}),et(i.glyphs,t.glyphs)||r.push({command:"setGlyphs",args:[t.glyphs]}),et(i.transition,t.transition)||r.push({command:"setTransition",args:[t.transition]}),et(i.light,t.light)||r.push({command:"setLight",args:[t.light]}),et(i.terrain,t.terrain)||r.push({command:"setTerrain",args:[t.terrain]}),et(i.sky,t.sky)||r.push({command:"setSky",args:[t.sky]}),et(i.projection,t.projection)||r.push({command:"setProjection",args:[t.projection]});const n={},l=[];(function(d,f,g,x){let v;for(v in f=f||{},d=d||{})Object.prototype.hasOwnProperty.call(d,v)&&(Object.prototype.hasOwnProperty.call(f,v)||kr(v,g,x));for(v in f)Object.prototype.hasOwnProperty.call(f,v)&&(Object.prototype.hasOwnProperty.call(d,v)?et(d[v],f[v])||(d[v].type==="geojson"&&f[v].type==="geojson"&&ms(d,f,v)?vt(g,{command:"setGeoJSONSourceData",args:[v,f[v].data]}):xr(v,f,g,x)):tn(v,f,g))})(i.sources,t.sources,l,n);const h=[];i.layers&&i.layers.forEach(d=>{"source"in d&&n[d.source]?r.push({command:"removeLayer",args:[d.id]}):h.push(d)}),r=r.concat(l),function(d,f,g){f=f||[];const x=(d=d||[]).map(rn),v=f.map(rn),w=d.reduce(sn,{}),I=f.reduce(sn,{}),M=x.slice(),C=Object.create(null);let k,F,j,Q,G;for(let J=0,re=0;J<x.length;J++)k=x[J],Object.prototype.hasOwnProperty.call(I,k)?re++:(vt(g,{command:"removeLayer",args:[k]}),M.splice(M.indexOf(k,re),1));for(let J=0,re=0;J<v.length;J++)k=v[v.length-1-J],M[M.length-1-J]!==k&&(Object.prototype.hasOwnProperty.call(w,k)?(vt(g,{command:"removeLayer",args:[k]}),M.splice(M.lastIndexOf(k,M.length-re),1)):re++,Q=M[M.length-J],vt(g,{command:"addLayer",args:[I[k],Q]}),M.splice(M.length-J,0,k),C[k]=!0);for(let J=0;J<v.length;J++)if(k=v[J],F=w[k],j=I[k],!C[k]&&!et(F,j))if(et(F.source,j.source)&&et(F["source-layer"],j["source-layer"])&&et(F.type,j.type)){for(G in Pi(F.layout,j.layout,g,k,null,"setLayoutProperty"),Pi(F.paint,j.paint,g,k,null,"setPaintProperty"),et(F.filter,j.filter)||vt(g,{command:"setFilter",args:[k,j.filter]}),et(F.minzoom,j.minzoom)&&et(F.maxzoom,j.maxzoom)||vt(g,{command:"setLayerZoomRange",args:[k,j.minzoom,j.maxzoom]}),F)Object.prototype.hasOwnProperty.call(F,G)&&G!=="layout"&&G!=="paint"&&G!=="filter"&&G!=="metadata"&&G!=="minzoom"&&G!=="maxzoom"&&(G.indexOf("paint.")===0?Pi(F[G],j[G],g,k,G.slice(6),"setPaintProperty"):et(F[G],j[G])||vt(g,{command:"setLayerProperty",args:[k,G,j[G]]}));for(G in j)Object.prototype.hasOwnProperty.call(j,G)&&!Object.prototype.hasOwnProperty.call(F,G)&&G!=="layout"&&G!=="paint"&&G!=="filter"&&G!=="metadata"&&G!=="minzoom"&&G!=="maxzoom"&&(G.indexOf("paint.")===0?Pi(F[G],j[G],g,k,G.slice(6),"setPaintProperty"):et(F[G],j[G])||vt(g,{command:"setLayerProperty",args:[k,G,j[G]]}))}else vt(g,{command:"removeLayer",args:[k]}),Q=M[M.lastIndexOf(k)+1],vt(g,{command:"addLayer",args:[j,Q]})}(h,t.layers,r)}catch(n){console.warn("Unable to compute style diff:",n),r=[{command:"setStyle",args:[t]}]}return r},L.aD=function(i){const t=[],r=i.id;return r===void 0&&t.push({message:`layers.${r}: missing required property "id"`}),i.render===void 0&&t.push({message:`layers.${r}: missing required method "render"`}),i.renderingMode&&i.renderingMode!=="2d"&&i.renderingMode!=="3d"&&t.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),t},L.aE=function i(t,r){if(Array.isArray(t)){if(!Array.isArray(r)||t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(!i(t[n],r[n]))return!1;return!0}if(typeof t=="object"&&t!==null&&r!==null){if(typeof r!="object"||Object.keys(t).length!==Object.keys(r).length)return!1;for(const n in t)if(!i(t[n],r[n]))return!1;return!0}return t===r},L.aF=ir,L.aG=Ys,L.aH=class extends In{constructor(i,t){super(i,t),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},L.aI=Tl,L.aJ=class extends In{constructor(i,t){super(i,t),this.current=Yh}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 t=1;t<16;t++)if(i[t]!==this.current[t]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},L.aK=au,L.aL=ou,L.aM=nt,L.aN=class extends In{constructor(i,t){super(i,t),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},L.aO=class extends In{constructor(i,t){super(i,t),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},L.aP=function(i,t,r,n,l,h,d){var f=1/(t-r),g=1/(n-l),x=1/(h-d);return i[0]=-2*f,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*g,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*x,i[11]=0,i[12]=(t+r)*f,i[13]=(l+n)*g,i[14]=(d+h)*x,i[15]=1,i},L.aQ=nd,L.aR=class extends X{},L.aS=Kd,L.aT=class extends ee{},L.aU=Sc,L.aV=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},L.aW=wu,L.aX=qt,L.aY=Gi,L.aZ=class extends Me{},L.a_=function(i,t){return i[0]===t[0]&&i[1]===t[1]&&i[2]===t[2]&&i[3]===t[3]&&i[4]===t[4]&&i[5]===t[5]&&i[6]===t[6]&&i[7]===t[7]&&i[8]===t[8]&&i[9]===t[9]&&i[10]===t[10]&&i[11]===t[11]&&i[12]===t[12]&&i[13]===t[13]&&i[14]===t[14]&&i[15]===t[15]},L.aa=function(i){const t={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,n,l,h)=>{const d=l||h;return t[n]=!d||d.toLowerCase(),""}),t["max-age"]){const r=parseInt(t["max-age"],10);isNaN(r)?delete t["max-age"]:t["max-age"]=r}return t},L.ab=function(i,t){const r=[];for(const n in i)n in t||r.push(n);return r},L.ac=Bi,L.ad=function(i,t,r){var n=Math.sin(r),l=Math.cos(r),h=t[0],d=t[1],f=t[2],g=t[3],x=t[4],v=t[5],w=t[6],I=t[7];return t!==i&&(i[8]=t[8],i[9]=t[9],i[10]=t[10],i[11]=t[11],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15]),i[0]=h*l+x*n,i[1]=d*l+v*n,i[2]=f*l+w*n,i[3]=g*l+I*n,i[4]=x*l-h*n,i[5]=v*l-d*n,i[6]=w*l-f*n,i[7]=I*l-g*n,i},L.ae=function(i){var t=new va(16);return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],t},L.af=Al,L.ag=function(i,t){let r=0,n=0;if(i.kind==="constant")n=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:l,minZoom:h,maxZoom:d}=i,f=l?Bi(li.interpolationFactor(l,t,h,d),0,1):0;i.kind==="camera"?n=oi.number(i.minSize,i.maxSize,f):r=f}return{uSizeT:r,uSize:n}},L.ai=function(i,{uSize:t,uSizeT:r},{lowerSize:n,upperSize:l}){return i.kind==="source"?n/Or:i.kind==="composite"?oi.number(n/Or,l/Or,r):t},L.aj=Nc,L.ak=function(i,t,r,n){const l=t.y-i.y,h=t.x-i.x,d=n.y-r.y,f=n.x-r.x,g=d*h-f*l;if(g===0)return null;const x=(f*(i.y-r.y)-d*(i.x-r.x))/g;return new me(i.x+x*h,i.y+x*l)},L.al=Th,L.am=hu,L.an=bc,L.ao=function(i){let t=1/0,r=1/0,n=-1/0,l=-1/0;for(const h of i)t=Math.min(t,h.x),r=Math.min(r,h.y),n=Math.max(n,h.x),l=Math.max(l,h.y);return[t,r,n,l]},L.ap=kt,L.ar=Vc,L.as=function(i,t){var r=t[0],n=t[1],l=t[2],h=t[3],d=t[4],f=t[5],g=t[6],x=t[7],v=t[8],w=t[9],I=t[10],M=t[11],C=t[12],k=t[13],F=t[14],j=t[15],Q=r*f-n*d,G=r*g-l*d,J=r*x-h*d,re=n*g-l*f,ce=n*x-h*f,we=l*x-h*g,Le=v*k-w*C,ve=v*F-I*C,ye=v*j-M*C,Ce=w*F-I*k,Pe=w*j-M*k,Se=I*j-M*F,ae=Q*Se-G*Pe+J*Ce+re*ye-ce*ve+we*Le;return ae?(i[0]=(f*Se-g*Pe+x*Ce)*(ae=1/ae),i[1]=(l*Pe-n*Se-h*Ce)*ae,i[2]=(k*we-F*ce+j*re)*ae,i[3]=(I*ce-w*we-M*re)*ae,i[4]=(g*ye-d*Se-x*ve)*ae,i[5]=(r*Se-l*ye+h*ve)*ae,i[6]=(F*J-C*we-j*G)*ae,i[7]=(v*we-I*J+M*G)*ae,i[8]=(d*Pe-f*ye+x*Le)*ae,i[9]=(n*ye-r*Pe-h*Le)*ae,i[10]=(C*ce-k*J+j*Q)*ae,i[11]=(w*J-v*ce-M*Q)*ae,i[12]=(f*ve-d*Ce-g*Le)*ae,i[13]=(r*Ce-n*ve+l*Le)*ae,i[14]=(k*G-C*re-F*Q)*ae,i[15]=(v*re-w*G+I*Q)*ae,i):null},L.at=Xc,L.au=Oc,L.av=Wc,L.aw=function(){const i={},t=ie.$version;for(const r in ie.$root){const n=ie.$root[r];if(n.required){let l=null;l=r==="version"?t:n.type==="array"?[]:{},l!=null&&(i[r]=l)}}return i},L.ax=go,L.ay=Oi,L.az=function(i){i=i.slice();const t=Object.create(null);for(let r=0;r<i.length;r++)t[i[r].id]=i[r];for(let r=0;r<i.length;r++)"ref"in i[r]&&(i[r]=en(i[r],t[i[r].ref]));return i},L.b=rr,L.b0=function(i,t){return i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[4]=t[4],i[5]=t[5],i[6]=t[6],i[7]=t[7],i[8]=t[8],i[9]=t[9],i[10]=t[10],i[11]=t[11],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15],i},L.b1=function(i,t,r){return i[0]=t[0]*r[0],i[1]=t[1]*r[1],i[2]=t[2]*r[2],i[3]=t[3]*r[3],i},L.b2=function(i,t){return i[0]*t[0]+i[1]*t[1]+i[2]*t[2]+i[3]*t[3]},L.b3=tr,L.b4=gh,L.b5=fh,L.b6=function(i,t,r,n,l){var h,d=1/Math.tan(t/2);return i[0]=d/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=d,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,l!=null&&l!==1/0?(i[10]=(l+n)*(h=1/(n-l)),i[14]=2*l*n*h):(i[10]=-1,i[14]=-2*n),i},L.b7=function(i,t,r){var n=Math.sin(r),l=Math.cos(r),h=t[4],d=t[5],f=t[6],g=t[7],x=t[8],v=t[9],w=t[10],I=t[11];return t!==i&&(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15]),i[4]=h*l+x*n,i[5]=d*l+v*n,i[6]=f*l+w*n,i[7]=g*l+I*n,i[8]=x*l-h*n,i[9]=v*l-d*n,i[10]=w*l-f*n,i[11]=I*l-g*n,i},L.b8=mi,L.b9=ka,L.bA=Uu,L.bB=function(i){return i.message===Fi},L.bC=As,L.bD=bi,L.ba=function(i){return i*Math.PI/180},L.bb=function(i,t){const{x:r,y:n}=Bo.fromLngLat(t);return!(i<0||i>25||n<0||n>=1||r<0||r>=1)},L.bc=function(i,t){return i[0]=t[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=t[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=t[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},L.bd=class extends b{},L.be=qc,L.bf=Ep,L.bh=gi,L.bi=function(i,t){Mr.REGISTERED_PROTOCOLS[i]=t},L.bj=function(i){delete Mr.REGISTERED_PROTOCOLS[i]},L.bk=function(i,t){const r={};for(let l=0;l<i.length;l++){const h=t&&t[i[l].id]||hl(i[l]);t&&(t[i[l].id]=h);let d=r[h];d||(d=r[h]=[]),d.push(i[l])}const n=[];for(const l in r)n.push(r[l]);return n},L.bl=Ie,L.bm=yh,L.bn=vh,L.bo=Ju,L.bp=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=Ct/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const t=i.bucket.layers[0],r=t.layout,n=t._unevaluatedLayout._values,l={layoutIconSize:n["icon-size"].possiblyEvaluate(new pt(i.bucket.zoom+1),i.canonical),layoutTextSize:n["text-size"].possiblyEvaluate(new pt(i.bucket.zoom+1),i.canonical),textMaxSize:n["text-size"].possiblyEvaluate(new pt(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:x,maxZoom:v}=i.bucket.textSizeData;l.compositeTextSizes=[n["text-size"].possiblyEvaluate(new pt(x),i.canonical),n["text-size"].possiblyEvaluate(new pt(v),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:x,maxZoom:v}=i.bucket.iconSizeData;l.compositeIconSizes=[n["icon-size"].possiblyEvaluate(new pt(x),i.canonical),n["icon-size"].possiblyEvaluate(new pt(v),i.canonical)]}const h=r.get("text-line-height")*kt,d=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",f=r.get("text-keep-upright"),g=r.get("text-size");for(const x of i.bucket.features){const v=r.get("text-font").evaluate(x,{},i.canonical).join(","),w=g.evaluate(x,{},i.canonical),I=l.layoutTextSize.evaluate(x,{},i.canonical),M=l.layoutIconSize.evaluate(x,{},i.canonical),C={horizontal:{},vertical:void 0},k=x.text;let F,j=[0,0];if(k){const J=k.toString(),re=r.get("text-letter-spacing").evaluate(x,{},i.canonical)*kt,ce=uc(J)?re:0,we=r.get("text-anchor").evaluate(x,{},i.canonical),Le=Eh(t,x,i.canonical);if(!Le){const Pe=r.get("text-radial-offset").evaluate(x,{},i.canonical);j=Pe?kh(we,[Pe*kt,Hc]):r.get("text-offset").evaluate(x,{},i.canonical).map(Se=>Se*kt)}let ve=d?"center":r.get("text-justify").evaluate(x,{},i.canonical);const ye=r.get("symbol-placement")==="point"?r.get("text-max-width").evaluate(x,{},i.canonical)*kt:1/0,Ce=()=>{i.bucket.allowVerticalPlacement&&_o(J)&&(C.vertical=Dl(k,i.glyphMap,i.glyphPositions,i.imagePositions,v,ye,h,we,"left",ce,j,L.ah.vertical,!0,I,w))};if(!d&&Le){const Pe=new Set;if(ve==="auto")for(let ae=0;ae<Le.values.length;ae+=2)Pe.add(Xc(Le.values[ae]));else Pe.add(ve);let Se=!1;for(const ae of Pe)if(!C.horizontal[ae])if(Se)C.horizontal[ae]=C.horizontal[0];else{const ke=Dl(k,i.glyphMap,i.glyphPositions,i.imagePositions,v,ye,h,"center",ae,ce,j,L.ah.horizontal,!1,I,w);ke&&(C.horizontal[ae]=ke,Se=ke.positionedLines.length===1)}Ce()}else{ve==="auto"&&(ve=Xc(we));const Pe=Dl(k,i.glyphMap,i.glyphPositions,i.imagePositions,v,ye,h,we,ve,ce,j,L.ah.horizontal,!1,I,w);Pe&&(C.horizontal[ve]=Pe),Ce(),_o(J)&&d&&f&&(C.vertical=Dl(k,i.glyphMap,i.glyphPositions,i.imagePositions,v,ye,h,we,ve,ce,j,L.ah.vertical,!1,I,w))}}let Q=!1;if(x.icon&&x.icon.name){const J=i.imageMap[x.icon.name];J&&(F=fp(i.imagePositions[x.icon.name],r.get("icon-offset").evaluate(x,{},i.canonical),r.get("icon-anchor").evaluate(x,{},i.canonical)),Q=!!J.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=Q:i.bucket.sdfIcons!==Q&&jt("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(J.pixelRatio!==i.bucket.pixelRatio||r.get("icon-rotate").constantOr(1)!==0)&&(i.bucket.iconsNeedLinear=!0))}const G=Lh(C.horizontal)||C.vertical;i.bucket.iconsInText=!!G&&G.iconsInText,(G||F)&&Cp(i.bucket,x,C,F,i.imageMap,l,I,M,j,Q,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},L.bq=Ec,L.br=zc,L.bs=kc,L.bt=$s,L.bu=Lc,L.bv=class{constructor(i){this._marks={start:[i.url,"start"].join("#"),end:[i.url,"end"].join("#"),measure:i.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let i=performance.getEntriesByName(this._marks.measure);return i.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),i=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),i}},L.bw=function(i,t,r,n,l){return p(this,void 0,void 0,function*(){if(Js())try{return yield $r(i,t,r,n,l)}catch{}return function(h,d,f,g,x){const v=h.width,w=h.height;_r&&ni||(_r=new OffscreenCanvas(v,w),ni=_r.getContext("2d",{willReadFrequently:!0})),_r.width=v,_r.height=w,ni.drawImage(h,0,0,v,w);const I=ni.getImageData(d,f,g,x);return ni.clearRect(0,0,v,w),I.data}(i,t,r,n,l)})},L.bx=_h,L.by=Ri,L.bz=Qi,L.c=ds,L.d=i=>p(void 0,void 0,void 0,function*(){if(i.byteLength===0)return createImageBitmap(new ImageData(1,1));const t=new Blob([new Uint8Array(i)],{type:"image/png"});try{return createImageBitmap(t)}catch(r){throw new Error(`Could not load image because of ${r.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),L.e=Ii,L.f=i=>new Promise((t,r)=>{const n=new Image;n.onload=()=>{t(n),URL.revokeObjectURL(n.src),n.onload=null,window.requestAnimationFrame(()=>{n.src=Rn})},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):Rn}),L.g=sr,L.h=(i,t)=>qr(Ii(i,{type:"json"}),t),L.i=gr,L.j=Cr,L.k=zr,L.l=(i,t)=>qr(Ii(i,{type:"arrayBuffer"}),t),L.m=qr,L.n=function(i){return new Lc(i).readFields(op,[])},L.o=Po,L.p=Ku,L.q=u,L.r=lc,L.s=Zr,L.t=fo,L.u=ss,L.v=ie,L.w=jt,L.x=function([i,t,r]){return t+=90,t*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(t)*Math.sin(r),y:i*Math.sin(t)*Math.sin(r),z:i*Math.cos(r)}},L.y=oi,L.z=pt}),rt("worker",["./shared"],function(L){class p{constructor(A){this.keyCache={},A&&this.replace(A)}replace(A){this._layerConfigs={},this._layers={},this.update(A,[])}update(A,P){for(const O of A){this._layerConfigs[O.id]=O;const H=this._layers[O.id]=L.aA(O);H._featureFilter=L.a7(H.filter),this.keyCache[O.id]&&delete this.keyCache[O.id]}for(const O of P)delete this.keyCache[O],delete this._layerConfigs[O],delete this._layers[O];this.familiesBySource={};const E=L.bk(Object.values(this._layerConfigs),this.keyCache);for(const O of E){const H=O.map(te=>this._layers[te.id]),W=H[0];if(W.visibility==="none")continue;const Y=W.source||"";let q=this.familiesBySource[Y];q||(q=this.familiesBySource[Y]={});const se=W.sourceLayer||"_geojsonTileLayer";let le=q[se];le||(le=q[se]=[]),le.push(H)}}}class Ri{constructor(A){const P={},E=[];for(const Y in A){const q=A[Y],se=P[Y]={};for(const le in q){const te=q[+le];if(!te||te.bitmap.width===0||te.bitmap.height===0)continue;const de={x:0,y:0,w:te.bitmap.width+2,h:te.bitmap.height+2};E.push(de),se[le]={rect:de,metrics:te.metrics}}}const{w:O,h:H}=L.p(E),W=new L.o({width:O||1,height:H||1});for(const Y in A){const q=A[Y];for(const se in q){const le=q[+se];if(!le||le.bitmap.width===0||le.bitmap.height===0)continue;const te=P[Y][se].rect;L.o.copy(le.bitmap,W,{x:0,y:0},{x:te.x+1,y:te.y+1},le.bitmap)}}this.image=W,this.positions=P}}L.bl("GlyphAtlas",Ri);class Qi{constructor(A){this.tileID=new L.S(A.tileID.overscaledZ,A.tileID.wrap,A.tileID.canonical.z,A.tileID.canonical.x,A.tileID.canonical.y),this.uid=A.uid,this.zoom=A.zoom,this.pixelRatio=A.pixelRatio,this.tileSize=A.tileSize,this.source=A.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=A.showCollisionBoxes,this.collectResourceTiming=!!A.collectResourceTiming,this.returnDependencies=!!A.returnDependencies,this.promoteId=A.promoteId,this.inFlightDependencies=[]}parse(A,P,E,O){return L._(this,void 0,void 0,function*(){this.status="parsing",this.data=A,this.collisionBoxArray=new L.a5;const H=new L.bm(Object.keys(A.layers).sort()),W=new L.bn(this.tileID,this.promoteId);W.bucketLayerIDs=[];const Y={},q={featureIndex:W,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:E},se=P.familiesBySource[this.source];for(const qe in se){const st=A.layers[qe];if(!st)continue;st.version===1&&L.w(`Vector tile source "${this.source}" layer "${qe}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const xt=H.encode(qe),Et=[];for(let Ft=0;Ft<st.length;Ft++){const ei=st.feature(Ft),gs=W.getId(ei,qe);Et.push({feature:ei,id:gs,index:Ft,sourceLayerIndex:xt})}for(const Ft of se[qe]){const ei=Ft[0];ei.source!==this.source&&L.w(`layer.source = ${ei.source} does not equal this.source = ${this.source}`),ei.minzoom&&this.zoom<Math.floor(ei.minzoom)||ei.maxzoom&&this.zoom>=ei.maxzoom||ei.visibility!=="none"&&(Jt(Ft,this.zoom,E),(Y[ei.id]=ei.createBucket({index:W.bucketLayerIDs.length,layers:Ft,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:xt,sourceID:this.source})).populate(Et,q,this.tileID.canonical),W.bucketLayerIDs.push(Ft.map(gs=>gs.id)))}}const le=L.aF(q.glyphDependencies,qe=>Object.keys(qe).map(Number));this.inFlightDependencies.forEach(qe=>qe==null?void 0:qe.abort()),this.inFlightDependencies=[];let te=Promise.resolve({});if(Object.keys(le).length){const qe=new AbortController;this.inFlightDependencies.push(qe),te=O.sendAsync({type:"GG",data:{stacks:le,source:this.source,tileID:this.tileID,type:"glyphs"}},qe)}const de=Object.keys(q.iconDependencies);let Ee=Promise.resolve({});if(de.length){const qe=new AbortController;this.inFlightDependencies.push(qe),Ee=O.sendAsync({type:"GI",data:{icons:de,source:this.source,tileID:this.tileID,type:"icons"}},qe)}const De=Object.keys(q.patternDependencies);let Ke=Promise.resolve({});if(De.length){const qe=new AbortController;this.inFlightDependencies.push(qe),Ke=O.sendAsync({type:"GI",data:{icons:De,source:this.source,tileID:this.tileID,type:"patterns"}},qe)}const[je,Je,Ge]=yield Promise.all([te,Ee,Ke]),Mt=new Ri(je),bt=new L.bo(Je,Ge);for(const qe in Y){const st=Y[qe];st instanceof L.a6?(Jt(st.layers,this.zoom,E),L.bp({bucket:st,glyphMap:je,glyphPositions:Mt.positions,imageMap:Je,imagePositions:bt.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):st.hasPattern&&(st instanceof L.bq||st instanceof L.br||st instanceof L.bs)&&(Jt(st.layers,this.zoom,E),st.addFeatures(q,this.tileID.canonical,bt.patternPositions))}return this.status="done",{buckets:Object.values(Y).filter(qe=>!qe.isEmpty()),featureIndex:W,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Mt.image,imageAtlas:bt,glyphMap:this.returnDependencies?je:null,iconMap:this.returnDependencies?Je:null,glyphPositions:this.returnDependencies?Mt.positions:null}})}}function Jt(N,A,P){const E=new L.z(A);for(const O of N)O.recalculate(E,P)}class me{constructor(A,P,E){this.actor=A,this.layerIndex=P,this.availableImages=E,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(A,P){return L._(this,void 0,void 0,function*(){const E=yield L.l(A.request,P);try{return{vectorTile:new L.bt.VectorTile(new L.bu(E.data)),rawData:E.data,cacheControl:E.cacheControl,expires:E.expires}}catch(O){const H=new Uint8Array(E.data);let W=`Unable to parse the tile at ${A.request.url}, `;throw W+=H[0]===31&&H[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${O.message}`,new Error(W)}})}loadTile(A){return L._(this,void 0,void 0,function*(){const P=A.uid,E=!!(A&&A.request&&A.request.collectResourceTiming)&&new L.bv(A.request),O=new Qi(A);this.loading[P]=O;const H=new AbortController;O.abort=H;try{const W=yield this.loadVectorTile(A,H);if(delete this.loading[P],!W)return null;const Y=W.rawData,q={};W.expires&&(q.expires=W.expires),W.cacheControl&&(q.cacheControl=W.cacheControl);const se={};if(E){const te=E.finish();te&&(se.resourceTiming=JSON.parse(JSON.stringify(te)))}O.vectorTile=W.vectorTile;const le=O.parse(W.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[P]=O,this.fetching[P]={rawTileData:Y,cacheControl:q,resourceTiming:se};try{const te=yield le;return L.e({rawTileData:Y.slice(0)},te,q,se)}finally{delete this.fetching[P]}}catch(W){throw delete this.loading[P],O.status="done",this.loaded[P]=O,W}})}reloadTile(A){return L._(this,void 0,void 0,function*(){const P=A.uid;if(!this.loaded||!this.loaded[P])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const E=this.loaded[P];if(E.showCollisionBoxes=A.showCollisionBoxes,E.status==="parsing"){const O=yield E.parse(E.vectorTile,this.layerIndex,this.availableImages,this.actor);let H;if(this.fetching[P]){const{rawTileData:W,cacheControl:Y,resourceTiming:q}=this.fetching[P];delete this.fetching[P],H=L.e({rawTileData:W.slice(0)},O,Y,q)}else H=O;return H}if(E.status==="done"&&E.vectorTile)return E.parse(E.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(A){return L._(this,void 0,void 0,function*(){const P=this.loading,E=A.uid;P&&P[E]&&P[E].abort&&(P[E].abort.abort(),delete P[E])})}removeTile(A){return L._(this,void 0,void 0,function*(){this.loaded&&this.loaded[A.uid]&&delete this.loaded[A.uid]})}}class ne{constructor(){this.loaded={}}loadTile(A){return L._(this,void 0,void 0,function*(){const{uid:P,encoding:E,rawImageData:O,redFactor:H,greenFactor:W,blueFactor:Y,baseShift:q}=A,se=O.width+2,le=O.height+2,te=L.b(O)?new L.R({width:se,height:le},yield L.bw(O,-1,-1,se,le)):O,de=new L.bx(P,te,E,H,W,Y,q);return this.loaded=this.loaded||{},this.loaded[P]=de,de})}removeTile(A){const P=this.loaded,E=A.uid;P&&P[E]&&delete P[E]}}function Ur(N,A){if(N.length!==0){Pr(N[0],A);for(var P=1;P<N.length;P++)Pr(N[P],!A)}}function Pr(N,A){for(var P=0,E=0,O=0,H=N.length,W=H-1;O<H;W=O++){var Y=(N[O][0]-N[W][0])*(N[W][1]+N[O][1]),q=P+Y;E+=Math.abs(P)>=Math.abs(Y)?P-q+Y:Y-q+P,P=q}P+E>=0!=!!A&&N.reverse()}var er=L.by(function N(A,P){var E,O=A&&A.type;if(O==="FeatureCollection")for(E=0;E<A.features.length;E++)N(A.features[E],P);else if(O==="GeometryCollection")for(E=0;E<A.geometries.length;E++)N(A.geometries[E],P);else if(O==="Feature")N(A.geometry,P);else if(O==="Polygon")Ur(A.coordinates,P);else if(O==="MultiPolygon")for(E=0;E<A.coordinates.length;E++)Ur(A.coordinates[E],P);return A});const Ar=L.bt.VectorTileFeature.prototype.toGeoJSON;var mr={exports:{}},Js=L.bz,mi=L.bt.VectorTileFeature,ka=Bi;function Bi(N,A){this.options=A||{},this.features=N,this.length=N.length}function tr(N,A){this.id=typeof N.id=="number"?N.id:void 0,this.type=N.type,this.rawGeometry=N.type===1?[N.geometry]:N.geometry,this.properties=N.tags,this.extent=A||4096}Bi.prototype.feature=function(N){return new tr(this.features[N],this.options.extent)},tr.prototype.loadGeometry=function(){var N=this.rawGeometry;this.geometry=[];for(var A=0;A<N.length;A++){for(var P=N[A],E=[],O=0;O<P.length;O++)E.push(new Js(P[O][0],P[O][1]));this.geometry.push(E)}return this.geometry},tr.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var N=this.geometry,A=1/0,P=-1/0,E=1/0,O=-1/0,H=0;H<N.length;H++)for(var W=N[H],Y=0;Y<W.length;Y++){var q=W[Y];A=Math.min(A,q.x),P=Math.max(P,q.x),E=Math.min(E,q.y),O=Math.max(O,q.y)}return[A,E,P,O]},tr.prototype.toGeoJSON=mi.prototype.toGeoJSON;var Ii=L.bA,Dn=ka;function ir(N){var A=new Ii;return function(P,E){for(var O in P.layers)E.writeMessage(3,Ys,P.layers[O])}(N,A),A.finish()}function Ys(N,A){var P;A.writeVarintField(15,N.version||1),A.writeStringField(1,N.name||""),A.writeVarintField(5,N.extent||4096);var E={keys:[],values:[],keycache:{},valuecache:{}};for(P=0;P<N.length;P++)E.feature=N.feature(P),A.writeMessage(2,at,E);var O=E.keys;for(P=0;P<O.length;P++)A.writeStringField(3,O[P]);var H=E.values;for(P=0;P<H.length;P++)A.writeMessage(4,hs,H[P])}function at(N,A){var P=N.feature;P.id!==void 0&&A.writeVarintField(1,P.id),A.writeMessage(2,Ln,N),A.writeVarintField(3,P.type),A.writeMessage(4,gr,P)}function Ln(N,A){var P=N.feature,E=N.keys,O=N.values,H=N.keycache,W=N.valuecache;for(var Y in P.properties){var q=P.properties[Y],se=H[Y];if(q!==null){se===void 0&&(E.push(Y),H[Y]=se=E.length-1),A.writeVarint(se);var le=typeof q;le!=="string"&&le!=="boolean"&&le!=="number"&&(q=JSON.stringify(q));var te=le+":"+q,de=W[te];de===void 0&&(O.push(q),W[te]=de=O.length-1),A.writeVarint(de)}}}function jt(N,A){return(A<<3)+(7&N)}function Yt(N){return N<<1^N>>31}function gr(N,A){for(var P=N.loadGeometry(),E=N.type,O=0,H=0,W=P.length,Y=0;Y<W;Y++){var q=P[Y],se=1;E===1&&(se=q.length),A.writeVarint(jt(1,se));for(var le=E===3?q.length-1:q.length,te=0;te<le;te++){te===1&&E!==1&&A.writeVarint(jt(2,le-1));var de=q[te].x-O,Ee=q[te].y-H;A.writeVarint(Yt(de)),A.writeVarint(Yt(Ee)),O+=de,H+=Ee}E===3&&A.writeVarint(jt(7,1))}}function hs(N,A){var P=typeof N;P==="string"?A.writeStringField(1,N):P==="boolean"?A.writeBooleanField(7,N):P==="number"&&(N%1!=0?A.writeDoubleField(3,N):N<0?A.writeSVarintField(6,N):A.writeVarintField(5,N))}mr.exports=ir,mr.exports.fromVectorTileJs=ir,mr.exports.fromGeojsonVt=function(N,A){A=A||{};var P={};for(var E in N)P[E]=new Dn(N[E].features,A),P[E].name=E,P[E].version=A.version,P[E].extent=A.extent;return ir({layers:P})},mr.exports.GeoJSONWrapper=Dn;var rr=L.by(mr.exports);const Rn={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:N=>N},$r=Math.fround||(_r=new Float32Array(1),N=>(_r[0]=+N,_r[0]));var _r;const ni=3,Fi=5,ds=6;class Mr{constructor(A){this.options=Object.assign(Object.create(Rn),A),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(A){const{log:P,minZoom:E,maxZoom:O}=this.options;P&&console.time("total time");const H=`prepare ${A.length} points`;P&&console.time(H),this.points=A;const W=[];for(let q=0;q<A.length;q++){const se=A[q];if(!se.geometry)continue;const[le,te]=se.geometry.coordinates,de=$r(gi(le)),Ee=$r(Oi(te));W.push(de,Ee,1/0,q,-1,1),this.options.reduce&&W.push(0)}let Y=this.trees[O+1]=this._createTree(W);P&&console.timeEnd(H);for(let q=O;q>=E;q--){const se=+Date.now();Y=this.trees[q]=this._createTree(this._cluster(Y,q)),P&&console.log("z%d: %d clusters in %dms",q,Y.numItems,+Date.now()-se)}return P&&console.timeEnd("total time"),this}getClusters(A,P){let E=((A[0]+180)%360+360)%360-180;const O=Math.max(-90,Math.min(90,A[1]));let H=A[2]===180?180:((A[2]+180)%360+360)%360-180;const W=Math.max(-90,Math.min(90,A[3]));if(A[2]-A[0]>=360)E=-180,H=180;else if(E>H){const te=this.getClusters([E,O,180,W],P),de=this.getClusters([-180,O,H,W],P);return te.concat(de)}const Y=this.trees[this._limitZoom(P)],q=Y.range(gi(E),Oi(W),gi(H),Oi(O)),se=Y.data,le=[];for(const te of q){const de=this.stride*te;le.push(se[de+Fi]>1?sr(se,de,this.clusterProps):this.points[se[de+ni]])}return le}getChildren(A){const P=this._getOriginId(A),E=this._getOriginZoom(A),O="No cluster with the specified id.",H=this.trees[E];if(!H)throw new Error(O);const W=H.data;if(P*this.stride>=W.length)throw new Error(O);const Y=this.options.radius/(this.options.extent*Math.pow(2,E-1)),q=H.within(W[P*this.stride],W[P*this.stride+1],Y),se=[];for(const le of q){const te=le*this.stride;W[te+4]===A&&se.push(W[te+Fi]>1?sr(W,te,this.clusterProps):this.points[W[te+ni]])}if(se.length===0)throw new Error(O);return se}getLeaves(A,P,E){const O=[];return this._appendLeaves(O,A,P=P||10,E=E||0,0),O}getTile(A,P,E){const O=this.trees[this._limitZoom(A)],H=Math.pow(2,A),{extent:W,radius:Y}=this.options,q=Y/W,se=(E-q)/H,le=(E+1+q)/H,te={features:[]};return this._addTileFeatures(O.range((P-q)/H,se,(P+1+q)/H,le),O.data,P,E,H,te),P===0&&this._addTileFeatures(O.range(1-q/H,se,1,le),O.data,H,E,H,te),P===H-1&&this._addTileFeatures(O.range(0,se,q/H,le),O.data,-1,E,H,te),te.features.length?te:null}getClusterExpansionZoom(A){let P=this._getOriginZoom(A)-1;for(;P<=this.options.maxZoom;){const E=this.getChildren(A);if(P++,E.length!==1)break;A=E[0].properties.cluster_id}return P}_appendLeaves(A,P,E,O,H){const W=this.getChildren(P);for(const Y of W){const q=Y.properties;if(q&&q.cluster?H+q.point_count<=O?H+=q.point_count:H=this._appendLeaves(A,q.cluster_id,E,O,H):H<O?H++:A.push(Y),A.length===E)break}return H}_createTree(A){const P=new L.av(A.length/this.stride|0,this.options.nodeSize,Float32Array);for(let E=0;E<A.length;E+=this.stride)P.add(A[E],A[E+1]);return P.finish(),P.data=A,P}_addTileFeatures(A,P,E,O,H,W){for(const Y of A){const q=Y*this.stride,se=P[q+Fi]>1;let le,te,de;if(se)le=ps(P,q,this.clusterProps),te=P[q],de=P[q+1];else{const Ke=this.points[P[q+ni]];le=Ke.properties;const[je,Je]=Ke.geometry.coordinates;te=gi(je),de=Oi(Je)}const Ee={type:1,geometry:[[Math.round(this.options.extent*(te*H-E)),Math.round(this.options.extent*(de*H-O))]],tags:le};let De;De=se||this.options.generateId?P[q+ni]:this.points[P[q+ni]].id,De!==void 0&&(Ee.id=De),W.features.push(Ee)}}_limitZoom(A){return Math.max(this.options.minZoom,Math.min(Math.floor(+A),this.options.maxZoom+1))}_cluster(A,P){const{radius:E,extent:O,reduce:H,minPoints:W}=this.options,Y=E/(O*Math.pow(2,P)),q=A.data,se=[],le=this.stride;for(let te=0;te<q.length;te+=le){if(q[te+2]<=P)continue;q[te+2]=P;const de=q[te],Ee=q[te+1],De=A.within(q[te],q[te+1],Y),Ke=q[te+Fi];let je=Ke;for(const Je of De){const Ge=Je*le;q[Ge+2]>P&&(je+=q[Ge+Fi])}if(je>Ke&&je>=W){let Je,Ge=de*Ke,Mt=Ee*Ke,bt=-1;const qe=((te/le|0)<<5)+(P+1)+this.points.length;for(const st of De){const xt=st*le;if(q[xt+2]<=P)continue;q[xt+2]=P;const Et=q[xt+Fi];Ge+=q[xt]*Et,Mt+=q[xt+1]*Et,q[xt+4]=qe,H&&(Je||(Je=this._map(q,te,!0),bt=this.clusterProps.length,this.clusterProps.push(Je)),H(Je,this._map(q,xt)))}q[te+4]=qe,se.push(Ge/je,Mt/je,1/0,qe,-1,je),H&&se.push(bt)}else{for(let Je=0;Je<le;Je++)se.push(q[te+Je]);if(je>1)for(const Je of De){const Ge=Je*le;if(!(q[Ge+2]<=P)){q[Ge+2]=P;for(let Mt=0;Mt<le;Mt++)se.push(q[Ge+Mt])}}}}return se}_getOriginId(A){return A-this.points.length>>5}_getOriginZoom(A){return(A-this.points.length)%32}_map(A,P,E){if(A[P+Fi]>1){const W=this.clusterProps[A[P+ds]];return E?Object.assign({},W):W}const O=this.points[A[P+ni]].properties,H=this.options.map(O);return E&&H===O?Object.assign({},H):H}}function sr(N,A,P){return{type:"Feature",id:N[A+ni],properties:ps(N,A,P),geometry:{type:"Point",coordinates:[(E=N[A],360*(E-.5)),qr(N[A+1])]}};var E}function ps(N,A,P){const E=N[A+Fi],O=E>=1e4?`${Math.round(E/1e3)}k`:E>=1e3?Math.round(E/100)/10+"k":E,H=N[A+ds],W=H===-1?{}:Object.assign({},P[H]);return Object.assign(W,{cluster:!0,cluster_id:N[A+ni],point_count:E,point_count_abbreviated:O})}function gi(N){return N/360+.5}function Oi(N){const A=Math.sin(N*Math.PI/180),P=.5-.25*Math.log((1+A)/(1-A))/Math.PI;return P<0?0:P>1?1:P}function qr(N){const A=(180-360*N)*Math.PI/180;return 360*Math.atan(Math.exp(A))/Math.PI-90}function Zr(N,A,P,E){let O=E;const H=A+(P-A>>1);let W,Y=P-A;const q=N[A],se=N[A+1],le=N[P],te=N[P+1];for(let de=A+3;de<P;de+=3){const Ee=Qs(N[de],N[de+1],q,se,le,te);if(Ee>O)W=de,O=Ee;else if(Ee===O){const De=Math.abs(de-H);De<Y&&(W=de,Y=De)}}O>E&&(W-A>3&&Zr(N,A,W,E),N[W+2]=O,P-W>3&&Zr(N,W,P,E))}function Qs(N,A,P,E,O,H){let W=O-P,Y=H-E;if(W!==0||Y!==0){const q=((N-P)*W+(A-E)*Y)/(W*W+Y*Y);q>1?(P=O,E=H):q>0&&(P+=W*q,E+=Y*q)}return W=N-P,Y=A-E,W*W+Y*Y}function yr(N,A,P,E){const O={id:N??null,type:A,geometry:P,tags:E,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(A==="Point"||A==="MultiPoint"||A==="LineString")zr(O,P);else if(A==="Polygon")zr(O,P[0]);else if(A==="MultiLineString")for(const H of P)zr(O,H);else if(A==="MultiPolygon")for(const H of P)zr(O,H[0]);return O}function zr(N,A){for(let P=0;P<A.length;P+=3)N.minX=Math.min(N.minX,A[P]),N.minY=Math.min(N.minY,A[P+1]),N.maxX=Math.max(N.maxX,A[P]),N.maxY=Math.max(N.maxY,A[P+1])}function Cr(N,A,P,E){if(!A.geometry)return;const O=A.geometry.coordinates;if(O&&O.length===0)return;const H=A.geometry.type,W=Math.pow(P.tolerance/((1<<P.maxZoom)*P.extent),2);let Y=[],q=A.id;if(P.promoteId?q=A.properties[P.promoteId]:P.generateId&&(q=E||0),H==="Point")fs(O,Y);else if(H==="MultiPoint")for(const se of O)fs(se,Y);else if(H==="LineString")ie(O,Y,W,!1);else if(H==="MultiLineString"){if(P.lineMetrics){for(const se of O)Y=[],ie(se,Y,W,!1),N.push(yr(q,"LineString",Y,A.properties));return}Gr(O,Y,W,!1)}else if(H==="Polygon")Gr(O,Y,W,!0);else{if(H!=="MultiPolygon"){if(H==="GeometryCollection"){for(const se of A.geometry.geometries)Cr(N,{id:q,geometry:se,properties:A.properties},P,E);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const se of O){const le=[];Gr(se,le,W,!0),Y.push(le)}}N.push(yr(q,H,Y,A.properties))}function fs(N,A){A.push(en(N[0]),et(N[1]),0)}function ie(N,A,P,E){let O,H,W=0;for(let q=0;q<N.length;q++){const se=en(N[q][0]),le=et(N[q][1]);A.push(se,le,0),q>0&&(W+=E?(O*le-se*H)/2:Math.sqrt(Math.pow(se-O,2)+Math.pow(le-H,2))),O=se,H=le}const Y=A.length-3;A[2]=1,Zr(A,0,Y,P),A[Y+2]=1,A.size=Math.abs(W),A.start=0,A.end=A.size}function Gr(N,A,P,E){for(let O=0;O<N.length;O++){const H=[];ie(N[O],H,P,E),A.push(H)}}function en(N){return N/360+.5}function et(N){const A=Math.sin(N*Math.PI/180),P=.5-.25*Math.log((1+A)/(1-A))/Math.PI;return P<0?0:P>1?1:P}function vt(N,A,P,E,O,H,W,Y){if(E/=A,H>=(P/=A)&&W<E)return N;if(W<P||H>=E)return null;const q=[];for(const se of N){const le=se.geometry;let te=se.type;const de=O===0?se.minX:se.minY,Ee=O===0?se.maxX:se.maxY;if(de>=P&&Ee<E){q.push(se);continue}if(Ee<P||de>=E)continue;let De=[];if(te==="Point"||te==="MultiPoint")tn(le,De,P,E,O);else if(te==="LineString")kr(le,De,P,E,O,!1,Y.lineMetrics);else if(te==="MultiLineString")ms(le,De,P,E,O,!1);else if(te==="Polygon")ms(le,De,P,E,O,!0);else if(te==="MultiPolygon")for(const Ke of le){const je=[];ms(Ke,je,P,E,O,!0),je.length&&De.push(je)}if(De.length){if(Y.lineMetrics&&te==="LineString"){for(const Ke of De)q.push(yr(se.id,te,Ke,se.tags));continue}te!=="LineString"&&te!=="MultiLineString"||(De.length===1?(te="LineString",De=De[0]):te="MultiLineString"),te!=="Point"&&te!=="MultiPoint"||(te=De.length===3?"Point":"MultiPoint"),q.push(yr(se.id,te,De,se.tags))}}return q.length?q:null}function tn(N,A,P,E,O){for(let H=0;H<N.length;H+=3){const W=N[H+O];W>=P&&W<=E&&Pi(A,N[H],N[H+1],N[H+2])}}function kr(N,A,P,E,O,H,W){let Y=xr(N);const q=O===0?rn:sn;let se,le,te=N.start;for(let je=0;je<N.length-3;je+=3){const Je=N[je],Ge=N[je+1],Mt=N[je+2],bt=N[je+3],qe=N[je+4],st=O===0?Je:Ge,xt=O===0?bt:qe;let Et=!1;W&&(se=Math.sqrt(Math.pow(Je-bt,2)+Math.pow(Ge-qe,2))),st<P?xt>P&&(le=q(Y,Je,Ge,bt,qe,P),W&&(Y.start=te+se*le)):st>E?xt<E&&(le=q(Y,Je,Ge,bt,qe,E),W&&(Y.start=te+se*le)):Pi(Y,Je,Ge,Mt),xt<P&&st>=P&&(le=q(Y,Je,Ge,bt,qe,P),Et=!0),xt>E&&st<=E&&(le=q(Y,Je,Ge,bt,qe,E),Et=!0),!H&&Et&&(W&&(Y.end=te+se*le),A.push(Y),Y=xr(N)),W&&(te+=se)}let de=N.length-3;const Ee=N[de],De=N[de+1],Ke=O===0?Ee:De;Ke>=P&&Ke<=E&&Pi(Y,Ee,De,N[de+2]),de=Y.length-3,H&&de>=3&&(Y[de]!==Y[0]||Y[de+1]!==Y[1])&&Pi(Y,Y[0],Y[1],Y[2]),Y.length&&A.push(Y)}function xr(N){const A=[];return A.size=N.size,A.start=N.start,A.end=N.end,A}function ms(N,A,P,E,O,H){for(const W of N)kr(W,A,P,E,O,H,!1)}function Pi(N,A,P,E){N.push(A,P,E)}function rn(N,A,P,E,O,H){const W=(H-A)/(E-A);return Pi(N,H,P+(O-P)*W,1),W}function sn(N,A,P,E,O,H){const W=(H-P)/(O-P);return Pi(N,A+(E-A)*W,H,1),W}function he(N,A){const P=[];for(let E=0;E<N.length;E++){const O=N[E],H=O.type;let W;if(H==="Point"||H==="MultiPoint"||H==="LineString")W=nr(O.geometry,A);else if(H==="MultiLineString"||H==="Polygon"){W=[];for(const Y of O.geometry)W.push(nr(Y,A))}else if(H==="MultiPolygon"){W=[];for(const Y of O.geometry){const q=[];for(const se of Y)q.push(nr(se,A));W.push(q)}}P.push(yr(O.id,H,W,O.tags))}return P}function nr(N,A){const P=[];P.size=N.size,N.start!==void 0&&(P.start=N.start,P.end=N.end);for(let E=0;E<N.length;E+=3)P.push(N[E]+A,N[E+1],N[E+2]);return P}function Qt(N,A){if(N.transformed)return N;const P=1<<N.z,E=N.x,O=N.y;for(const H of N.features){const W=H.geometry,Y=H.type;if(H.geometry=[],Y===1)for(let q=0;q<W.length;q+=2)H.geometry.push(ar(W[q],W[q+1],A,P,E,O));else for(let q=0;q<W.length;q++){const se=[];for(let le=0;le<W[q].length;le+=2)se.push(ar(W[q][le],W[q][le+1],A,P,E,O));H.geometry.push(se)}}return N.transformed=!0,N}function ar(N,A,P,E,O,H){return[Math.round(P*(N*E-O)),Math.round(P*(A*E-H))]}function Er(N,A,P,E,O){const H=A===O.maxZoom?0:O.tolerance/((1<<A)*O.extent),W={features:[],numPoints:0,numSimplified:0,numFeatures:N.length,source:null,x:P,y:E,z:A,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const Y of N)ge(W,Y,H,O);return W}function ge(N,A,P,E){const O=A.geometry,H=A.type,W=[];if(N.minX=Math.min(N.minX,A.minX),N.minY=Math.min(N.minY,A.minY),N.maxX=Math.max(N.maxX,A.maxX),N.maxY=Math.max(N.maxY,A.maxY),H==="Point"||H==="MultiPoint")for(let Y=0;Y<O.length;Y+=3)W.push(O[Y],O[Y+1]),N.numPoints++,N.numSimplified++;else if(H==="LineString")$e(W,O,N,P,!1,!1);else if(H==="MultiLineString"||H==="Polygon")for(let Y=0;Y<O.length;Y++)$e(W,O[Y],N,P,H==="Polygon",Y===0);else if(H==="MultiPolygon")for(let Y=0;Y<O.length;Y++){const q=O[Y];for(let se=0;se<q.length;se++)$e(W,q[se],N,P,!0,se===0)}if(W.length){let Y=A.tags||null;if(H==="LineString"&&E.lineMetrics){Y={};for(const se in A.tags)Y[se]=A.tags[se];Y.mapbox_clip_start=O.start/O.size,Y.mapbox_clip_end=O.end/O.size}const q={geometry:W,type:H==="Polygon"||H==="MultiPolygon"?3:H==="LineString"||H==="MultiLineString"?2:1,tags:Y};A.id!==null&&(q.id=A.id),N.features.push(q)}}function $e(N,A,P,E,O,H){const W=E*E;if(E>0&&A.size<(O?W:E))return void(P.numPoints+=A.length/3);const Y=[];for(let q=0;q<A.length;q+=3)(E===0||A[q+2]>W)&&(P.numSimplified++,Y.push(A[q],A[q+1])),P.numPoints++;O&&function(q,se){let le=0;for(let te=0,de=q.length,Ee=de-2;te<de;Ee=te,te+=2)le+=(q[te]-q[Ee])*(q[te+1]+q[Ee+1]);if(le>0===se)for(let te=0,de=q.length;te<de/2;te+=2){const Ee=q[te],De=q[te+1];q[te]=q[de-2-te],q[te+1]=q[de-1-te],q[de-2-te]=Ee,q[de-1-te]=De}}(Y,H),N.push(Y)}const Be={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class ai{constructor(A,P){const E=(P=this.options=function(H,W){for(const Y in W)H[Y]=W[Y];return H}(Object.create(Be),P)).debug;if(E&&console.time("preprocess data"),P.maxZoom<0||P.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(P.promoteId&&P.generateId)throw new Error("promoteId and generateId cannot be used together.");let O=function(H,W){const Y=[];if(H.type==="FeatureCollection")for(let q=0;q<H.features.length;q++)Cr(Y,H.features[q],W,q);else Cr(Y,H.type==="Feature"?H:{geometry:H},W);return Y}(A,P);this.tiles={},this.tileCoords=[],E&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",P.indexMaxZoom,P.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),O=function(H,W){const Y=W.buffer/W.extent;let q=H;const se=vt(H,1,-1-Y,Y,0,-1,2,W),le=vt(H,1,1-Y,2+Y,0,-1,2,W);return(se||le)&&(q=vt(H,1,-Y,1+Y,0,-1,2,W)||[],se&&(q=he(se,1).concat(q)),le&&(q=q.concat(he(le,-1)))),q}(O,P),O.length&&this.splitTile(O,0,0,0),E&&(O.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(A,P,E,O,H,W,Y){const q=[A,P,E,O],se=this.options,le=se.debug;for(;q.length;){O=q.pop(),E=q.pop(),P=q.pop(),A=q.pop();const te=1<<P,de=Vi(P,E,O);let Ee=this.tiles[de];if(!Ee&&(le>1&&console.time("creation"),Ee=this.tiles[de]=Er(A,P,E,O,se),this.tileCoords.push({z:P,x:E,y:O}),le)){le>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",P,E,O,Ee.numFeatures,Ee.numPoints,Ee.numSimplified),console.timeEnd("creation"));const Et=`z${P}`;this.stats[Et]=(this.stats[Et]||0)+1,this.total++}if(Ee.source=A,H==null){if(P===se.indexMaxZoom||Ee.numPoints<=se.indexMaxPoints)continue}else{if(P===se.maxZoom||P===H)continue;if(H!=null){const Et=H-P;if(E!==W>>Et||O!==Y>>Et)continue}}if(Ee.source=null,A.length===0)continue;le>1&&console.time("clipping");const De=.5*se.buffer/se.extent,Ke=.5-De,je=.5+De,Je=1+De;let Ge=null,Mt=null,bt=null,qe=null,st=vt(A,te,E-De,E+je,0,Ee.minX,Ee.maxX,se),xt=vt(A,te,E+Ke,E+Je,0,Ee.minX,Ee.maxX,se);A=null,st&&(Ge=vt(st,te,O-De,O+je,1,Ee.minY,Ee.maxY,se),Mt=vt(st,te,O+Ke,O+Je,1,Ee.minY,Ee.maxY,se),st=null),xt&&(bt=vt(xt,te,O-De,O+je,1,Ee.minY,Ee.maxY,se),qe=vt(xt,te,O+Ke,O+Je,1,Ee.minY,Ee.maxY,se),xt=null),le>1&&console.timeEnd("clipping"),q.push(Ge||[],P+1,2*E,2*O),q.push(Mt||[],P+1,2*E,2*O+1),q.push(bt||[],P+1,2*E+1,2*O),q.push(qe||[],P+1,2*E+1,2*O+1)}}getTile(A,P,E){A=+A,P=+P,E=+E;const O=this.options,{extent:H,debug:W}=O;if(A<0||A>24)return null;const Y=1<<A,q=Vi(A,P=P+Y&Y-1,E);if(this.tiles[q])return Qt(this.tiles[q],H);W>1&&console.log("drilling down to z%d-%d-%d",A,P,E);let se,le=A,te=P,de=E;for(;!se&&le>0;)le--,te>>=1,de>>=1,se=this.tiles[Vi(le,te,de)];return se&&se.source?(W>1&&(console.log("found parent tile z%d-%d-%d",le,te,de),console.time("drilling down")),this.splitTile(se.source,le,te,de,A,P,E),W>1&&console.timeEnd("drilling down"),this.tiles[q]?Qt(this.tiles[q],H):null):null}}function Vi(N,A,P){return 32*((1<<N)*P+A)+N}function Ne(N,A){return A?N.properties[A]:N.id}function or(N,A){if(N==null)return!0;if(N.type==="Feature")return Ne(N,A)!=null;if(N.type==="FeatureCollection"){const P=new Set;for(const E of N.features){const O=Ne(E,A);if(O==null||P.has(O))return!1;P.add(O)}return!0}return!1}function vr(N,A){const P=new Map;if(N!=null)if(N.type==="Feature")P.set(Ne(N,A),N);else for(const E of N.features)P.set(Ne(E,A),E);return P}class Dr extends me{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(A,P){return L._(this,void 0,void 0,function*(){const E=A.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const O=this._geoJSONIndex.getTile(E.z,E.x,E.y);if(!O)return null;const H=new class{constructor(Y){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=L.X,this.length=Y.length,this._features=Y}feature(Y){return new class{constructor(q){this._feature=q,this.extent=L.X,this.type=q.type,this.properties=q.tags,"id"in q&&!isNaN(q.id)&&(this.id=parseInt(q.id,10))}loadGeometry(){if(this._feature.type===1){const q=[];for(const se of this._feature.geometry)q.push([new L.P(se[0],se[1])]);return q}{const q=[];for(const se of this._feature.geometry){const le=[];for(const te of se)le.push(new L.P(te[0],te[1]));q.push(le)}return q}}toGeoJSON(q,se,le){return Ar.call(this,q,se,le)}}(this._features[Y])}}(O.features);let W=rr(H);return W.byteOffset===0&&W.byteLength===W.buffer.byteLength||(W=new Uint8Array(W)),{vectorTile:H,rawData:W.buffer}})}loadData(A){return L._(this,void 0,void 0,function*(){var P;(P=this._pendingRequest)===null||P===void 0||P.abort();const E=!!(A&&A.request&&A.request.collectResourceTiming)&&new L.bv(A.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(A,this._pendingRequest),this._geoJSONIndex=A.cluster?new Mr(function({superclusterOptions:W,clusterProperties:Y}){if(!Y||!W)return W;const q={},se={},le={accumulated:null,zoom:0},te={properties:null},de=Object.keys(Y);for(const Ee of de){const[De,Ke]=Y[Ee],je=L.bC(Ke),Je=L.bC(typeof De=="string"?[De,["accumulated"],["get",Ee]]:De);q[Ee]=je.value,se[Ee]=Je.value}return W.map=Ee=>{te.properties=Ee;const De={};for(const Ke of de)De[Ke]=q[Ke].evaluate(le,te);return De},W.reduce=(Ee,De)=>{te.properties=De;for(const Ke of de)le.accumulated=Ee[Ke],Ee[Ke]=se[Ke].evaluate(le,te)},W}(A)).load((yield this._pendingData).features):(O=yield this._pendingData,new ai(O,A.geojsonVtOptions)),this.loaded={};const H={};if(E){const W=E.finish();W&&(H.resourceTiming={},H.resourceTiming[A.source]=JSON.parse(JSON.stringify(W)))}return H}catch(H){if(delete this._pendingRequest,L.bB(H))return{abandoned:!0};throw H}var O})}getData(){return L._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(A){const P=this.loaded;return P&&P[A.uid]?super.reloadTile(A):this.loadTile(A)}loadAndProcessGeoJSON(A,P){return L._(this,void 0,void 0,function*(){let E=yield this.loadGeoJSON(A,P);if(delete this._pendingRequest,typeof E!="object")throw new Error(`Input data given to '${A.source}' is not a valid GeoJSON object.`);if(er(E,!0),A.filter){const O=L.bC(A.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(O.result==="error")throw new Error(O.value.map(W=>`${W.key}: ${W.message}`).join(", "));E={type:"FeatureCollection",features:E.features.filter(W=>O.value.evaluate({zoom:0},W))}}return E})}loadGeoJSON(A,P){return L._(this,void 0,void 0,function*(){const{promoteId:E}=A;if(A.request){const O=yield L.h(A.request,P);return this._dataUpdateable=or(O.data,E)?vr(O.data,E):void 0,O.data}if(typeof A.data=="string")try{const O=JSON.parse(A.data);return this._dataUpdateable=or(O,E)?vr(O,E):void 0,O}catch{throw new Error(`Input data given to '${A.source}' is not a valid GeoJSON object.`)}if(!A.dataDiff)throw new Error(`Input data given to '${A.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${A.source}`);return function(O,H,W){var Y,q,se,le;if(H.removeAll&&O.clear(),H.remove)for(const te of H.remove)O.delete(te);if(H.add)for(const te of H.add){const de=Ne(te,W);de!=null&&O.set(de,te)}if(H.update)for(const te of H.update){let de=O.get(te.id);if(de==null)continue;const Ee=!te.removeAllProperties&&(((Y=te.removeProperties)===null||Y===void 0?void 0:Y.length)>0||((q=te.addOrUpdateProperties)===null||q===void 0?void 0:q.length)>0);if((te.newGeometry||te.removeAllProperties||Ee)&&(de=Object.assign({},de),O.set(te.id,de),Ee&&(de.properties=Object.assign({},de.properties))),te.newGeometry&&(de.geometry=te.newGeometry),te.removeAllProperties)de.properties={};else if(((se=te.removeProperties)===null||se===void 0?void 0:se.length)>0)for(const De of te.removeProperties)Object.prototype.hasOwnProperty.call(de.properties,De)&&delete de.properties[De];if(((le=te.addOrUpdateProperties)===null||le===void 0?void 0:le.length)>0)for(const{key:De,value:Ke}of te.addOrUpdateProperties)de.properties[De]=Ke}}(this._dataUpdateable,A.dataDiff,E),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(A){return L._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(A){return this._geoJSONIndex.getClusterExpansionZoom(A.clusterId)}getClusterChildren(A){return this._geoJSONIndex.getChildren(A.clusterId)}getClusterLeaves(A){return this._geoJSONIndex.getLeaves(A.clusterId,A.limit,A.offset)}}class lr{constructor(A){this.self=A,this.actor=new L.F(A),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(P,E)=>{if(this.externalWorkerSourceTypes[P])throw new Error(`Worker source with name "${P}" already registered.`);this.externalWorkerSourceTypes[P]=E},this.self.addProtocol=L.bi,this.self.removeProtocol=L.bj,this.self.registerRTLTextPlugin=P=>{if(L.bD.isParsed())throw new Error("RTL text plugin already registered.");L.bD.setMethods(P)},this.actor.registerMessageHandler("LDT",(P,E)=>this._getDEMWorkerSource(P,E.source).loadTile(E)),this.actor.registerMessageHandler("RDT",(P,E)=>L._(this,void 0,void 0,function*(){this._getDEMWorkerSource(P,E.source).removeTile(E)})),this.actor.registerMessageHandler("GCEZ",(P,E)=>L._(this,void 0,void 0,function*(){return this._getWorkerSource(P,E.type,E.source).getClusterExpansionZoom(E)})),this.actor.registerMessageHandler("GCC",(P,E)=>L._(this,void 0,void 0,function*(){return this._getWorkerSource(P,E.type,E.source).getClusterChildren(E)})),this.actor.registerMessageHandler("GCL",(P,E)=>L._(this,void 0,void 0,function*(){return this._getWorkerSource(P,E.type,E.source).getClusterLeaves(E)})),this.actor.registerMessageHandler("LD",(P,E)=>this._getWorkerSource(P,E.type,E.source).loadData(E)),this.actor.registerMessageHandler("GD",(P,E)=>this._getWorkerSource(P,E.type,E.source).getData()),this.actor.registerMessageHandler("LT",(P,E)=>this._getWorkerSource(P,E.type,E.source).loadTile(E)),this.actor.registerMessageHandler("RT",(P,E)=>this._getWorkerSource(P,E.type,E.source).reloadTile(E)),this.actor.registerMessageHandler("AT",(P,E)=>this._getWorkerSource(P,E.type,E.source).abortTile(E)),this.actor.registerMessageHandler("RMT",(P,E)=>this._getWorkerSource(P,E.type,E.source).removeTile(E)),this.actor.registerMessageHandler("RS",(P,E)=>L._(this,void 0,void 0,function*(){if(!this.workerSources[P]||!this.workerSources[P][E.type]||!this.workerSources[P][E.type][E.source])return;const O=this.workerSources[P][E.type][E.source];delete this.workerSources[P][E.type][E.source],O.removeSource!==void 0&&O.removeSource(E)})),this.actor.registerMessageHandler("RM",P=>L._(this,void 0,void 0,function*(){delete this.layerIndexes[P],delete this.availableImages[P],delete this.workerSources[P],delete this.demWorkerSources[P]})),this.actor.registerMessageHandler("SR",(P,E)=>L._(this,void 0,void 0,function*(){this.referrer=E})),this.actor.registerMessageHandler("SRPS",(P,E)=>this._syncRTLPluginState(P,E)),this.actor.registerMessageHandler("IS",(P,E)=>L._(this,void 0,void 0,function*(){this.self.importScripts(E)})),this.actor.registerMessageHandler("SI",(P,E)=>this._setImages(P,E)),this.actor.registerMessageHandler("UL",(P,E)=>L._(this,void 0,void 0,function*(){this._getLayerIndex(P).update(E.layers,E.removedIds)})),this.actor.registerMessageHandler("SL",(P,E)=>L._(this,void 0,void 0,function*(){this._getLayerIndex(P).replace(E)}))}_setImages(A,P){return L._(this,void 0,void 0,function*(){this.availableImages[A]=P;for(const E in this.workerSources[A]){const O=this.workerSources[A][E];for(const H in O)O[H].availableImages=P}})}_syncRTLPluginState(A,P){return L._(this,void 0,void 0,function*(){if(L.bD.isParsed())return L.bD.getState();if(P.pluginStatus!=="loading")return L.bD.setState(P),P;const E=P.pluginURL;if(this.self.importScripts(E),L.bD.isParsed()){const O={pluginStatus:"loaded",pluginURL:E};return L.bD.setState(O),O}throw L.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${E}`)})}_getAvailableImages(A){let P=this.availableImages[A];return P||(P=[]),P}_getLayerIndex(A){let P=this.layerIndexes[A];return P||(P=this.layerIndexes[A]=new p),P}_getWorkerSource(A,P,E){if(this.workerSources[A]||(this.workerSources[A]={}),this.workerSources[A][P]||(this.workerSources[A][P]={}),!this.workerSources[A][P][E]){const O={sendAsync:(H,W)=>(H.targetMapId=A,this.actor.sendAsync(H,W))};switch(P){case"vector":this.workerSources[A][P][E]=new me(O,this._getLayerIndex(A),this._getAvailableImages(A));break;case"geojson":this.workerSources[A][P][E]=new Dr(O,this._getLayerIndex(A),this._getAvailableImages(A));break;default:this.workerSources[A][P][E]=new this.externalWorkerSourceTypes[P](O,this._getLayerIndex(A),this._getAvailableImages(A))}}return this.workerSources[A][P][E]}_getDEMWorkerSource(A,P){return this.demWorkerSources[A]||(this.demWorkerSources[A]={}),this.demWorkerSources[A][P]||(this.demWorkerSources[A][P]=new ne),this.demWorkerSources[A][P]}}return L.i(self)&&(self.worker=new lr(self)),lr}),rt("index",["exports","./shared"],function(L,p){var Ri="4.7.1";let Qi,Jt;const me={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:u=>new Promise((e,s)=>{const a=requestAnimationFrame(e);u.signal.addEventListener("abort",()=>{cancelAnimationFrame(a),s(p.c())})}),getImageData(u,e=0){return this.getImageCanvasContext(u).getImageData(-e,-e,u.width+2*e,u.height+2*e)},getImageCanvasContext(u){const e=window.document.createElement("canvas"),s=e.getContext("2d",{willReadFrequently:!0});if(!s)throw new Error("failed to create canvas 2d context");return e.width=u.width,e.height=u.height,s.drawImage(u,0,0,u.width,u.height),s},resolveURL:u=>(Qi||(Qi=document.createElement("a")),Qi.href=u,Qi.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Jt==null&&(Jt=matchMedia("(prefers-reduced-motion: reduce)")),Jt.matches)}};class ne{static testProp(e){if(!ne.docStyle)return e[0];for(let s=0;s<e.length;s++)if(e[s]in ne.docStyle)return e[s];return e[0]}static create(e,s,a){const o=window.document.createElement(e);return s!==void 0&&(o.className=s),a&&a.appendChild(o),o}static createNS(e,s){return window.document.createElementNS(e,s)}static disableDrag(){ne.docStyle&&ne.selectProp&&(ne.userSelect=ne.docStyle[ne.selectProp],ne.docStyle[ne.selectProp]="none")}static enableDrag(){ne.docStyle&&ne.selectProp&&(ne.docStyle[ne.selectProp]=ne.userSelect)}static setTransform(e,s){e.style[ne.transformProp]=s}static addEventListener(e,s,a,o={}){e.addEventListener(s,a,"passive"in o?o:o.capture)}static removeEventListener(e,s,a,o={}){e.removeEventListener(s,a,"passive"in o?o:o.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",ne.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",ne.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",ne.suppressClickInternal,!0)},0)}static getScale(e){const s=e.getBoundingClientRect();return{x:s.width/e.offsetWidth||1,y:s.height/e.offsetHeight||1,boundingClientRect:s}}static getPoint(e,s,a){const o=s.boundingClientRect;return new p.P((a.clientX-o.left)/s.x-e.clientLeft,(a.clientY-o.top)/s.y-e.clientTop)}static mousePos(e,s){const a=ne.getScale(e);return ne.getPoint(e,a,s)}static touchPos(e,s){const a=[],o=ne.getScale(e);for(let c=0;c<s.length;c++)a.push(ne.getPoint(e,o,s[c]));return a}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}}ne.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,ne.selectProp=ne.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),ne.transformProp=ne.testProp(["transform","WebkitTransform"]);const Ur={supported:!1,testSupport:function(u){!Ar&&er&&(mr?Js(u):Pr=u)}};let Pr,er,Ar=!1,mr=!1;function Js(u){const e=u.createTexture();u.bindTexture(u.TEXTURE_2D,e);try{if(u.texImage2D(u.TEXTURE_2D,0,u.RGBA,u.RGBA,u.UNSIGNED_BYTE,er),u.isContextLost())return;Ur.supported=!0}catch{}u.deleteTexture(e),Ar=!0}var mi;typeof document<"u"&&(er=document.createElement("img"),er.onload=()=>{Pr&&Js(Pr),Pr=null,mr=!0},er.onerror=()=>{Ar=!0,Pr=null},er.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(u){let e,s,a,o;u.resetRequestQueue=()=>{e=[],s=0,a=0,o={}},u.addThrottleControl=y=>{const b=a++;return o[b]=y,b},u.removeThrottleControl=y=>{delete o[y],m()},u.getImage=(y,b,T=!0)=>new Promise((S,z)=>{Ur.supported&&(y.headers||(y.headers={}),y.headers.accept="image/webp,*/*"),p.e(y,{type:"image"}),e.push({abortController:b,requestParameters:y,supportImageRefresh:T,state:"queued",onError:D=>{z(D)},onSuccess:D=>{S(D)}}),m()});const c=y=>p._(this,void 0,void 0,function*(){y.state="running";const{requestParameters:b,supportImageRefresh:T,onError:S,onSuccess:z,abortController:D}=y,R=T===!1&&!p.i(self)&&!p.g(b.url)&&(!b.headers||Object.keys(b.headers).reduce(($,Z)=>$&&Z==="accept",!0));s++;const V=R?_(b,D):p.m(b,D);try{const $=yield V;delete y.abortController,y.state="completed",$.data instanceof HTMLImageElement||p.b($.data)?z($):$.data&&z({data:yield(U=$.data,typeof createImageBitmap=="function"?p.d(U):p.f(U)),cacheControl:$.cacheControl,expires:$.expires})}catch($){delete y.abortController,S($)}finally{s--,m()}var U}),m=()=>{const y=(()=>{for(const b of Object.keys(o))if(o[b]())return!0;return!1})()?p.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:p.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let b=s;b<y&&e.length>0;b++){const T=e.shift();T.abortController.signal.aborted?b--:c(T)}},_=(y,b)=>new Promise((T,S)=>{const z=new Image,D=y.url,R=y.credentials;R&&R==="include"?z.crossOrigin="use-credentials":(R&&R==="same-origin"||!p.s(D))&&(z.crossOrigin="anonymous"),b.signal.addEventListener("abort",()=>{z.src="",S(p.c())}),z.fetchPriority="high",z.onload=()=>{z.onerror=z.onload=null,T({data:z})},z.onerror=()=>{z.onerror=z.onload=null,b.signal.aborted||S(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},z.src=D})}(mi||(mi={})),mi.resetRequestQueue();class ka{constructor(e){this._transformRequestFn=e}transformRequest(e,s){return this._transformRequestFn&&this._transformRequestFn(e,s)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function Bi(u){var e=new p.A(3);return e[0]=u[0],e[1]=u[1],e[2]=u[2],e}var tr,Ii=function(u,e,s){return u[0]=e[0]-s[0],u[1]=e[1]-s[1],u[2]=e[2]-s[2],u};tr=new p.A(3),p.A!=Float32Array&&(tr[0]=0,tr[1]=0,tr[2]=0);var Dn=function(u){var e=u[0],s=u[1];return e*e+s*s};function ir(u){const e=[];if(typeof u=="string")e.push({id:"default",url:u});else if(u&&u.length>0){const s=[];for(const{id:a,url:o}of u){const c=`${a}${o}`;s.indexOf(c)===-1&&(s.push(c),e.push({id:a,url:o}))}}return e}function Ys(u,e,s){const a=u.split("?");return a[0]+=`${e}${s}`,a.join("?")}(function(){var u=new p.A(2);p.A!=Float32Array&&(u[0]=0,u[1]=0)})();class at{constructor(e,s,a,o){this.context=e,this.format=a,this.texture=e.gl.createTexture(),this.update(s,o)}update(e,s,a){const{width:o,height:c}=e,m=!(this.size&&this.size[0]===o&&this.size[1]===c||a),{context:_}=this,{gl:y}=_;if(this.useMipmap=!!(s&&s.useMipmap),y.bindTexture(y.TEXTURE_2D,this.texture),_.pixelStoreUnpackFlipY.set(!1),_.pixelStoreUnpack.set(1),_.pixelStoreUnpackPremultiplyAlpha.set(this.format===y.RGBA&&(!s||s.premultiply!==!1)),m)this.size=[o,c],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||p.b(e)?y.texImage2D(y.TEXTURE_2D,0,this.format,this.format,y.UNSIGNED_BYTE,e):y.texImage2D(y.TEXTURE_2D,0,this.format,o,c,0,this.format,y.UNSIGNED_BYTE,e.data);else{const{x:b,y:T}=a||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||p.b(e)?y.texSubImage2D(y.TEXTURE_2D,0,b,T,y.RGBA,y.UNSIGNED_BYTE,e):y.texSubImage2D(y.TEXTURE_2D,0,b,T,o,c,y.RGBA,y.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&y.generateMipmap(y.TEXTURE_2D)}bind(e,s,a){const{context:o}=this,{gl:c}=o;c.bindTexture(c.TEXTURE_2D,this.texture),a!==c.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(a=c.LINEAR),e!==this.filter&&(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,e),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,a||e),this.filter=e),s!==this.wrap&&(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,s),c.texParameteri(c.TEXTURE_2D,c.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:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function Ln(u){const{userImage:e}=u;return!!(e&&e.render&&e.render())&&(u.data.replace(new Uint8Array(e.data.buffer)),!0)}class jt extends p.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new p.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(const{ids:s,promiseResolve:a}of this.requestors)a(this._getImagesForIds(s));this.requestors=[]}}getImage(e){const s=this.images[e];if(s&&!s.data&&s.spriteData){const a=s.spriteData;s.data=new p.R({width:a.width,height:a.height},a.context.getImageData(a.x,a.y,a.width,a.height).data),s.spriteData=null}return s}addImage(e,s){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,s)&&(this.images[e]=s)}_validate(e,s){let a=!0;const o=s.data||s.spriteData;return this._validateStretch(s.stretchX,o&&o.width)||(this.fire(new p.j(new Error(`Image "${e}" has invalid "stretchX" value`))),a=!1),this._validateStretch(s.stretchY,o&&o.height)||(this.fire(new p.j(new Error(`Image "${e}" has invalid "stretchY" value`))),a=!1),this._validateContent(s.content,s)||(this.fire(new p.j(new Error(`Image "${e}" has invalid "content" value`))),a=!1),a}_validateStretch(e,s){if(!e)return!0;let a=0;for(const o of e){if(o[0]<a||o[1]<o[0]||s<o[1])return!1;a=o[1]}return!0}_validateContent(e,s){if(!e)return!0;if(e.length!==4)return!1;const a=s.spriteData,o=a&&a.width||s.data.width,c=a&&a.height||s.data.height;return!(e[0]<0||o<e[0]||e[1]<0||c<e[1]||e[2]<0||o<e[2]||e[3]<0||c<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,s,a=!0){const o=this.getImage(e);if(a&&(o.data.width!==s.data.width||o.data.height!==s.data.height))throw new Error(`size mismatch between old image (${o.data.width}x${o.data.height}) and new image (${s.data.width}x${s.data.height}).`);s.version=o.version+1,this.images[e]=s,this.updatedImages[e]=!0}removeImage(e){const s=this.images[e];delete this.images[e],delete this.patterns[e],s.userImage&&s.userImage.onRemove&&s.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise((s,a)=>{let o=!0;if(!this.isLoaded())for(const c of e)this.images[c]||(o=!1);this.isLoaded()||o?s(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:s})})}_getImagesForIds(e){const s={};for(const a of e){let o=this.getImage(a);o||(this.fire(new p.k("styleimagemissing",{id:a})),o=this.getImage(a)),o?s[a]={data:o.data.clone(),pixelRatio:o.pixelRatio,sdf:o.sdf,version:o.version,stretchX:o.stretchX,stretchY:o.stretchY,content:o.content,textFitWidth:o.textFitWidth,textFitHeight:o.textFitHeight,hasRenderCallback:!!(o.userImage&&o.userImage.render)}:p.w(`Image "${a}" 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:e,height:s}=this.atlasImage;return{width:e,height:s}}getPattern(e){const s=this.patterns[e],a=this.getImage(e);if(!a)return null;if(s&&s.position.version===a.version)return s.position;if(s)s.position.version=a.version;else{const o={w:a.data.width+2,h:a.data.height+2,x:0,y:0},c=new p.I(o,a);this.patterns[e]={bin:o,position:c}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){const s=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new at(e,this.atlasImage,s.RGBA),this.atlasTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const c in this.patterns)e.push(this.patterns[c].bin);const{w:s,h:a}=p.p(e),o=this.atlasImage;o.resize({width:s||1,height:a||1});for(const c in this.patterns){const{bin:m}=this.patterns[c],_=m.x+1,y=m.y+1,b=this.getImage(c).data,T=b.width,S=b.height;p.R.copy(b,o,{x:0,y:0},{x:_,y},{width:T,height:S}),p.R.copy(b,o,{x:0,y:S-1},{x:_,y:y-1},{width:T,height:1}),p.R.copy(b,o,{x:0,y:0},{x:_,y:y+S},{width:T,height:1}),p.R.copy(b,o,{x:T-1,y:0},{x:_-1,y},{width:1,height:S}),p.R.copy(b,o,{x:0,y:0},{x:_+T,y},{width:1,height:S})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(const s of e){if(this.callbackDispatchedThisFrame[s])continue;this.callbackDispatchedThisFrame[s]=!0;const a=this.getImage(s);a||p.w(`Image with ID: "${s}" was not found`),Ln(a)&&this.updateImage(s,a)}}}const Yt=1e20;function gr(u,e,s,a,o,c,m,_,y){for(let b=e;b<e+a;b++)hs(u,s*c+b,c,o,m,_,y);for(let b=s;b<s+o;b++)hs(u,b*c+e,1,a,m,_,y)}function hs(u,e,s,a,o,c,m){c[0]=0,m[0]=-Yt,m[1]=Yt,o[0]=u[e];for(let _=1,y=0,b=0;_<a;_++){o[_]=u[e+_*s];const T=_*_;do{const S=c[y];b=(o[_]-o[S]+T-S*S)/(_-S)/2}while(b<=m[y]&&--y>-1);y++,c[y]=_,m[y]=b,m[y+1]=Yt}for(let _=0,y=0;_<a;_++){for(;m[y+1]<_;)y++;const b=c[y],T=_-b;u[e+_*s]=o[b]+T*T}}class rr{constructor(e,s){this.requestManager=e,this.localIdeographFontFamily=s,this.entries={}}setURL(e){this.url=e}getGlyphs(e){return p._(this,void 0,void 0,function*(){const s=[];for(const c in e)for(const m of e[c])s.push(this._getAndCacheGlyphsPromise(c,m));const a=yield Promise.all(s),o={};for(const{stack:c,id:m,glyph:_}of a)o[c]||(o[c]={}),o[c][m]=_&&{id:_.id,bitmap:_.bitmap.clone(),metrics:_.metrics};return o})}_getAndCacheGlyphsPromise(e,s){return p._(this,void 0,void 0,function*(){let a=this.entries[e];a||(a=this.entries[e]={glyphs:{},requests:{},ranges:{}});let o=a.glyphs[s];if(o!==void 0)return{stack:e,id:s,glyph:o};if(o=this._tinySDF(a,e,s),o)return a.glyphs[s]=o,{stack:e,id:s,glyph:o};const c=Math.floor(s/256);if(256*c>65535)throw new Error("glyphs > 65535 not supported");if(a.ranges[c])return{stack:e,id:s,glyph:o};if(!this.url)throw new Error("glyphsUrl is not set");if(!a.requests[c]){const _=rr.loadGlyphRange(e,c,this.url,this.requestManager);a.requests[c]=_}const m=yield a.requests[c];for(const _ in m)this._doesCharSupportLocalGlyph(+_)||(a.glyphs[+_]=m[+_]);return a.ranges[c]=!0,{stack:e,id:s,glyph:m[s]||null}})}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(e))}_tinySDF(e,s,a){const o=this.localIdeographFontFamily;if(!o||!this._doesCharSupportLocalGlyph(a))return;let c=e.tinySDF;if(!c){let _="400";/bold/i.test(s)?_="900":/medium/i.test(s)?_="500":/light/i.test(s)&&(_="200"),c=e.tinySDF=new rr.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:o,fontWeight:_})}const m=c.draw(String.fromCharCode(a));return{id:a,bitmap:new p.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}}}}rr.loadGlyphRange=function(u,e,s,a){return p._(this,void 0,void 0,function*(){const o=256*e,c=o+255,m=a.transformRequest(s.replace("{fontstack}",u).replace("{range}",`${o}-${c}`),"Glyphs"),_=yield p.l(m,new AbortController);if(!_||!_.data)throw new Error(`Could not load glyph range. range: ${e}, ${o}-${c}`);const y={};for(const b of p.n(_.data))y[b.id]=b;return y})},rr.TinySDF=class{constructor({fontSize:u=24,buffer:e=3,radius:s=8,cutoff:a=.25,fontFamily:o="sans-serif",fontWeight:c="normal",fontStyle:m="normal"}={}){this.buffer=e,this.cutoff=a,this.radius=s;const _=this.size=u+4*e,y=this._createCanvas(_),b=this.ctx=y.getContext("2d",{willReadFrequently:!0});b.font=`${m} ${c} ${u}px ${o}`,b.textBaseline="alphabetic",b.textAlign="left",b.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_createCanvas(u){const e=document.createElement("canvas");return e.width=e.height=u,e}draw(u){const{width:e,actualBoundingBoxAscent:s,actualBoundingBoxDescent:a,actualBoundingBoxLeft:o,actualBoundingBoxRight:c}=this.ctx.measureText(u),m=Math.ceil(s),_=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(c-o))),y=Math.min(this.size-this.buffer,m+Math.ceil(a)),b=_+2*this.buffer,T=y+2*this.buffer,S=Math.max(b*T,0),z=new Uint8ClampedArray(S),D={data:z,width:b,height:T,glyphWidth:_,glyphHeight:y,glyphTop:m,glyphLeft:0,glyphAdvance:e};if(_===0||y===0)return D;const{ctx:R,buffer:V,gridInner:U,gridOuter:$}=this;R.clearRect(V,V,_,y),R.fillText(u,V,V+m);const Z=R.getImageData(V,V,_,y);$.fill(Yt,0,S),U.fill(0,0,S);for(let B=0;B<y;B++)for(let X=0;X<_;X++){const K=Z.data[4*(B*_+X)+3]/255;if(K===0)continue;const ee=(B+V)*b+X+V;if(K===1)$[ee]=0,U[ee]=Yt;else{const oe=.5-K;$[ee]=oe>0?oe*oe:0,U[ee]=oe<0?oe*oe:0}}gr($,0,0,b,T,b,this.f,this.v,this.z),gr(U,V,V,_,y,b,this.f,this.v,this.z);for(let B=0;B<S;B++){const X=Math.sqrt($[B])-Math.sqrt(U[B]);z[B]=Math.round(255-255*(X/this.radius+this.cutoff))}return D}};class Rn{constructor(){this.specification=p.v.light.position}possiblyEvaluate(e,s){return p.x(e.expression.evaluate(s))}interpolate(e,s,a){return{x:p.y.number(e.x,s.x,a),y:p.y.number(e.y,s.y,a),z:p.y.number(e.z,s.z,a)}}}let $r;class _r extends p.E{constructor(e){super(),$r=$r||new p.q({anchor:new p.D(p.v.light.anchor),position:new Rn,color:new p.D(p.v.light.color),intensity:new p.D(p.v.light.intensity)}),this._transitionable=new p.T($r),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,s={}){if(!this._validate(p.r,e,s))for(const a in e){const o=e[a];a.endsWith("-transition")?this._transitionable.setTransition(a.slice(0,-11),o):this._transitionable.setValue(a,o)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,s,a){return(!a||a.validate!==!1)&&p.t(this,e.call(p.u,{value:s,style:{glyphs:!0,sprite:!0},styleSpec:p.v}))}}const ni=new p.q({"sky-color":new p.D(p.v.sky["sky-color"]),"horizon-color":new p.D(p.v.sky["horizon-color"]),"fog-color":new p.D(p.v.sky["fog-color"]),"fog-ground-blend":new p.D(p.v.sky["fog-ground-blend"]),"horizon-fog-blend":new p.D(p.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new p.D(p.v.sky["sky-horizon-blend"]),"atmosphere-blend":new p.D(p.v.sky["atmosphere-blend"])});class Fi extends p.E{constructor(e){super(),this._transitionable=new p.T(ni),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new p.z(0))}setSky(e,s={}){if(!this._validate(p.B,e,s)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const a in e){const o=e[a];a.endsWith("-transition")?this._transitionable.setTransition(a.slice(0,-11),o):this._transitionable.setValue(a,o)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,s,a={}){return(a==null?void 0:a.validate)!==!1&&p.t(this,e.call(p.u,p.e({value:s,style:{glyphs:!0,sprite:!0},styleSpec:p.v})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class ds{constructor(e,s){this.width=e,this.height=s,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,s){const a=e.join(",")+String(s);return this.dashEntry[a]||(this.dashEntry[a]=this.addDash(e,s)),this.dashEntry[a]}getDashRanges(e,s,a){const o=[];let c=e.length%2==1?-e[e.length-1]*a:0,m=e[0]*a,_=!0;o.push({left:c,right:m,isDash:_,zeroLength:e[0]===0});let y=e[0];for(let b=1;b<e.length;b++){_=!_;const T=e[b];c=y*a,y+=T,m=y*a,o.push({left:c,right:m,isDash:_,zeroLength:T===0})}return o}addRoundDash(e,s,a){const o=s/2;for(let c=-a;c<=a;c++){const m=this.width*(this.nextRow+a+c);let _=0,y=e[_];for(let b=0;b<this.width;b++){b/y.right>1&&(y=e[++_]);const T=Math.abs(b-y.left),S=Math.abs(b-y.right),z=Math.min(T,S);let D;const R=c/a*(o+1);if(y.isDash){const V=o-Math.abs(R);D=Math.sqrt(z*z+V*V)}else D=o-Math.sqrt(z*z+R*R);this.data[m+b]=Math.max(0,Math.min(255,D+128))}}}addRegularDash(e){for(let _=e.length-1;_>=0;--_){const y=e[_],b=e[_+1];y.zeroLength?e.splice(_,1):b&&b.isDash===y.isDash&&(b.left=y.left,e.splice(_,1))}const s=e[0],a=e[e.length-1];s.isDash===a.isDash&&(s.left=a.left-this.width,a.right=s.right+this.width);const o=this.width*this.nextRow;let c=0,m=e[c];for(let _=0;_<this.width;_++){_/m.right>1&&(m=e[++c]);const y=Math.abs(_-m.left),b=Math.abs(_-m.right),T=Math.min(y,b);this.data[o+_]=Math.max(0,Math.min(255,(m.isDash?T:-T)+128))}}addDash(e,s){const a=s?7:0,o=2*a+1;if(this.nextRow+o>this.height)return p.w("LineAtlas out of space"),null;let c=0;for(let _=0;_<e.length;_++)c+=e[_];if(c!==0){const _=this.width/c,y=this.getDashRanges(e,this.width,_);s?this.addRoundDash(y,_,a):this.addRegularDash(y)}const m={y:(this.nextRow+a+.5)/this.height,height:2*a/this.height,width:c};return this.nextRow+=o,this.dirty=!0,m}bind(e){const s=e.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 sr{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<sr.workerCount;)this.workers.push(new Worker(p.a.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],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 ps=Math.floor(me.hardwareConcurrency/2);let gi,Oi;function qr(){return gi||(gi=new sr),gi}sr.workerCount=p.C(globalThis)?Math.max(Math.min(ps,3),1):1;class Zr{constructor(e,s){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=s;const a=this.workerPool.acquire(s);for(let o=0;o<a.length;o++){const c=new p.F(a[o],s);c.name=`Worker ${o}`,this.actors.push(c)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,s){const a=[];for(const o of this.actors)a.push(o.sendAsync({type:e,data:s}));return Promise.all(a)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach(s=>{s.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,s){for(const a of this.actors)a.registerMessageHandler(e,s)}}function Qs(){return Oi||(Oi=new Zr(qr(),p.G),Oi.registerMessageHandler("GR",(u,e,s)=>p.m(e,s))),Oi}function yr(u,e){const s=p.H();return p.J(s,s,[1,1,0]),p.K(s,s,[.5*u.width,.5*u.height,1]),p.L(s,s,u.calculatePosMatrix(e.toUnwrapped()))}function zr(u,e,s,a,o,c){const m=function(S,z,D){if(S)for(const R of S){const V=z[R];if(V&&V.source===D&&V.type==="fill-extrusion")return!0}else for(const R in z){const V=z[R];if(V.source===D&&V.type==="fill-extrusion")return!0}return!1}(o&&o.layers,e,u.id),_=c.maxPitchScaleFactor(),y=u.tilesIn(a,_,m);y.sort(Cr);const b=[];for(const S of y)b.push({wrappedTileID:S.tileID.wrapped().key,queryResults:S.tile.queryRenderedFeatures(e,s,u._state,S.queryGeometry,S.cameraQueryGeometry,S.scale,o,c,_,yr(u.transform,S.tileID))});const T=function(S){const z={},D={};for(const R of S){const V=R.queryResults,U=R.wrappedTileID,$=D[U]=D[U]||{};for(const Z in V){const B=V[Z],X=$[Z]=$[Z]||{},K=z[Z]=z[Z]||[];for(const ee of B)X[ee.featureIndex]||(X[ee.featureIndex]=!0,K.push(ee))}}return z}(b);for(const S in T)T[S].forEach(z=>{const D=z.feature,R=u.getFeatureState(D.layer["source-layer"],D.id);D.source=D.layer.source,D.layer["source-layer"]&&(D.sourceLayer=D.layer["source-layer"]),D.state=R});return T}function Cr(u,e){const s=u.tileID,a=e.tileID;return s.overscaledZ-a.overscaledZ||s.canonical.y-a.canonical.y||s.wrap-a.wrap||s.canonical.x-a.canonical.x}function fs(u,e,s){return p._(this,void 0,void 0,function*(){let a=u;if(u.url?a=(yield p.h(e.transformRequest(u.url,"Source"),s)).data:yield me.frameAsync(s),!a)return null;const o=p.M(p.e(a,u),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in a&&a.vector_layers&&(o.vectorLayerIds=a.vector_layers.map(c=>c.id)),o})}class ie{constructor(e,s){e&&(s?this.setSouthWest(e).setNorthEast(s):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof p.N?new p.N(e.lng,e.lat):p.N.convert(e),this}setSouthWest(e){return this._sw=e instanceof p.N?new p.N(e.lng,e.lat):p.N.convert(e),this}extend(e){const s=this._sw,a=this._ne;let o,c;if(e instanceof p.N)o=e,c=e;else{if(!(e instanceof ie))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(ie.convert(e)):this.extend(p.N.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(p.N.convert(e)):this;if(o=e._sw,c=e._ne,!o||!c)return this}return s||a?(s.lng=Math.min(o.lng,s.lng),s.lat=Math.min(o.lat,s.lat),a.lng=Math.max(c.lng,a.lng),a.lat=Math.max(c.lat,a.lat)):(this._sw=new p.N(o.lng,o.lat),this._ne=new p.N(c.lng,c.lat)),this}getCenter(){return new p.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 p.N(this.getWest(),this.getNorth())}getSouthEast(){return new p.N(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:s,lat:a}=p.N.convert(e);let o=this._sw.lng<=s&&s<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=s&&s>=this._ne.lng),this._sw.lat<=a&&a<=this._ne.lat&&o}static convert(e){return e instanceof ie?e:e&&new ie(e)}static fromLngLat(e,s=0){const a=360*s/40075017,o=a/Math.cos(Math.PI/180*e.lat);return new ie(new p.N(e.lng-o,e.lat-a),new p.N(e.lng+o,e.lat+a))}adjustAntiMeridian(){const e=new p.N(this._sw.lng,this._sw.lat),s=new p.N(this._ne.lng,this._ne.lat);return new ie(e,e.lng>s.lng?new p.N(s.lng+360,s.lat):s)}}class Gr{constructor(e,s,a){this.bounds=ie.convert(this.validateBounds(e)),this.minzoom=s||0,this.maxzoom=a||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){const s=Math.pow(2,e.z),a=Math.floor(p.O(this.bounds.getWest())*s),o=Math.floor(p.Q(this.bounds.getNorth())*s),c=Math.ceil(p.O(this.bounds.getEast())*s),m=Math.ceil(p.Q(this.bounds.getSouth())*s);return e.x>=a&&e.x<c&&e.y>=o&&e.y<m}}class en extends p.E{constructor(e,s,a,o){if(super(),this.id=e,this.dispatcher=a,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,p.e(this,p.M(s,["url","scheme","tileSize","promoteId"])),this._options=p.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(o)}load(){return p._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new p.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const e=yield fs(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(p.e(this,e),e.bounds&&(this.tileBounds=new Gr(e.bounds,this.minzoom,this.maxzoom)),this.fire(new p.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new p.k("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new p.j(e))}})}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return p.e({},this._options)}loadTile(e){return p._(this,void 0,void 0,function*(){const s=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a={request:this.map._requestManager.transformRequest(s,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};a.request.collectResourceTiming=this._collectResourceTiming;let o="RT";if(e.actor&&e.state!=="expired"){if(e.state==="loading")return new Promise((c,m)=>{e.reloadPromise={resolve:c,reject:m}})}else e.actor=this.dispatcher.getActor(),o="LT";e.abortController=new AbortController;try{const c=yield e.actor.sendAsync({type:o,data:a},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,c)}catch(c){if(delete e.abortController,e.aborted)return;if(c&&c.status!==404)throw c;this._afterTileLoadWorkerResponse(e,null)}})}_afterTileLoadWorkerResponse(e,s){if(s&&s.resourceTiming&&(e.resourceTiming=s.resourceTiming),s&&this.map._refreshExpiredTiles&&e.setExpiryData(s),e.loadVectorData(s,this.map.painter),e.reloadPromise){const a=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(a.resolve).catch(a.reject)}}abortTile(e){return p._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}}))})}unloadTile(e){return p._(this,void 0,void 0,function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class et extends p.E{constructor(e,s,a,o){super(),this.id=e,this.dispatcher=a,this.setEventedParent(o),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=p.e({type:"raster"},s),p.e(this,p.M(s,["url","scheme","tileSize"]))}load(){return p._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new p.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const e=yield fs(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,e&&(p.e(this,e),e.bounds&&(this.tileBounds=new Gr(e.bounds,this.minzoom,this.maxzoom)),this.fire(new p.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new p.k("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new p.j(e))}})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return p.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return p._(this,void 0,void 0,function*(){const s=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{const a=yield mi.getImage(this.map._requestManager.transformRequest(s,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(a&&a.data){this.map._refreshExpiredTiles&&a.cacheControl&&a.expires&&e.setExpiryData({cacheControl:a.cacheControl,expires:a.expires});const o=this.map.painter.context,c=o.gl,m=a.data;e.texture=this.map.painter.getTileTexture(m.width),e.texture?e.texture.update(m,{useMipmap:!0}):(e.texture=new at(o,m,c.RGBA,{useMipmap:!0}),e.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE,c.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(a){if(delete e.abortController,e.aborted)e.state="unloaded";else if(a)throw e.state="errored",a}})}abortTile(e){return p._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)})}unloadTile(e){return p._(this,void 0,void 0,function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)})}hasTransition(){return!1}}class vt extends et{constructor(e,s,a,o){super(e,s,a,o),this.type="raster-dem",this.maxzoom=22,this._options=p.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(e){return p._(this,void 0,void 0,function*(){const s=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a=this.map._requestManager.transformRequest(s,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{const o=yield mi.getImage(a,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(o&&o.data){const c=o.data;this.map._refreshExpiredTiles&&o.cacheControl&&o.expires&&e.setExpiryData({cacheControl:o.cacheControl,expires:o.expires});const m=p.b(c)&&p.U()?c:yield this.readImageNow(c),_={type:this.type,uid:e.uid,source:this.id,rawImageData:m,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();const y=yield e.actor.sendAsync({type:"LDT",data:_});e.dem=y,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(o){if(delete e.abortController,e.aborted)e.state="unloaded";else if(o)throw e.state="errored",o}})}readImageNow(e){return p._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&p.V()){const s=e.width+2,a=e.height+2;try{return new p.R({width:s,height:a},yield p.W(e,-1,-1,s,a))}catch{}}return me.getImageData(e,1)})}_getNeighboringTiles(e){const s=e.canonical,a=Math.pow(2,s.z),o=(s.x-1+a)%a,c=s.x===0?e.wrap-1:e.wrap,m=(s.x+1+a)%a,_=s.x+1===a?e.wrap+1:e.wrap,y={};return y[new p.S(e.overscaledZ,c,s.z,o,s.y).key]={backfilled:!1},y[new p.S(e.overscaledZ,_,s.z,m,s.y).key]={backfilled:!1},s.y>0&&(y[new p.S(e.overscaledZ,c,s.z,o,s.y-1).key]={backfilled:!1},y[new p.S(e.overscaledZ,e.wrap,s.z,s.x,s.y-1).key]={backfilled:!1},y[new p.S(e.overscaledZ,_,s.z,m,s.y-1).key]={backfilled:!1}),s.y+1<a&&(y[new p.S(e.overscaledZ,c,s.z,o,s.y+1).key]={backfilled:!1},y[new p.S(e.overscaledZ,e.wrap,s.z,s.x,s.y+1).key]={backfilled:!1},y[new p.S(e.overscaledZ,_,s.z,m,s.y+1).key]={backfilled:!1}),y}unloadTile(e){return p._(this,void 0,void 0,function*(){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&(yield e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}}))})}}class tn extends p.E{constructor(e,s,a,o){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=a.getActor(),this.setEventedParent(o),this._data=s.data,this._options=p.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 c=p.X/this.tileSize;s.clusterMaxZoom!==void 0&&this.maxzoom<=s.clusterMaxZoom&&p.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${s.clusterMaxZoom}".`),this.workerOptions=p.e({source:this.id,cluster:s.cluster||!1,geojsonVtOptions:{buffer:(s.buffer!==void 0?s.buffer:128)*c,tolerance:(s.tolerance!==void 0?s.tolerance:.375)*c,extent:p.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:p.X,radius:(s.clusterRadius||50)*c,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 p._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}getData(){return p._(this,void 0,void 0,function*(){const e=p.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:e})})}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=e.clusterRadius),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=e.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,s,a){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:s,offset:a}})}_updateWorkerData(e){return p._(this,void 0,void 0,function*(){const s=p.e({type:this.type},this.workerOptions);e?s.dataDiff=e:typeof this._data=="string"?(s.request=this.map._requestManager.transformRequest(me.resolveURL(this._data),"Source"),s.request.collectResourceTiming=this._collectResourceTiming):s.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new p.k("dataloading",{dataType:"source"}));try{const a=yield this.actor.sendAsync({type:"LD",data:s});if(this._pendingLoads--,this._removed||a.abandoned)return void this.fire(new p.k("dataabort",{dataType:"source"}));let o=null;a.resourceTiming&&a.resourceTiming[this.id]&&(o=a.resourceTiming[this.id].slice(0));const c={dataType:"source"};this._collectResourceTiming&&o&&o.length>0&&p.e(c,{resourceTiming:o}),this.fire(new p.k("data",Object.assign(Object.assign({},c),{sourceDataType:"metadata"}))),this.fire(new p.k("data",Object.assign(Object.assign({},c),{sourceDataType:"content"})))}catch(a){if(this._pendingLoads--,this._removed)return void this.fire(new p.k("dataabort",{dataType:"source"}));this.fire(new p.j(a))}})}loaded(){return this._pendingLoads===0}loadTile(e){return p._(this,void 0,void 0,function*(){const s=e.actor?"RT":"LT";e.actor=this.actor;const a={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};e.abortController=new AbortController;const o=yield this.actor.sendAsync({type:s,data:a},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(o,this.map.painter,s==="RT")})}abortTile(e){return p._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0})}unloadTile(e){return p._(this,void 0,void 0,function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return p.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var kr=p.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class xr extends p.E{constructor(e,s,a,o){super(),this.id=e,this.dispatcher=a,this.coordinates=s.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(o),this.options=s}load(e){return p._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new p.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const s=yield mi.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,s&&s.data&&(this.image=s.data,e&&(this.coordinates=e),this._finishLoading())}catch(s){this._request=null,this._loaded=!0,this.fire(new p.j(s))}})}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new p.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;const s=e.map(p.Z.fromLngLat);this.tileID=function(o){let c=1/0,m=1/0,_=-1/0,y=-1/0;for(const z of o)c=Math.min(c,z.x),m=Math.min(m,z.y),_=Math.max(_,z.x),y=Math.max(y,z.y);const b=Math.max(_-c,y-m),T=Math.max(0,Math.floor(-Math.log(b)/Math.LN2)),S=Math.pow(2,T);return new p.a1(T,Math.floor((c+_)/2*S),Math.floor((m+y)/2*S))}(s),this.minzoom=this.maxzoom=this.tileID.z;const a=s.map(o=>this.tileID.getTilePoint(o)._round());return this._boundsArray=new p.$,this._boundsArray.emplaceBack(a[0].x,a[0].y,0,0),this._boundsArray.emplaceBack(a[1].x,a[1].y,p.X,0),this._boundsArray.emplaceBack(a[3].x,a[3].y,0,p.X),this._boundsArray.emplaceBack(a[2].x,a[2].y,p.X,p.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new p.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const e=this.map.painter.context,s=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,kr.members)),this.boundsSegments||(this.boundsSegments=p.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new at(e,this.image,s.RGBA),this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE));let a=!1;for(const o in this.tiles){const c=this.tiles[o];c.state!=="loaded"&&(c.state="loaded",c.texture=this.texture,a=!0)}a&&this.fire(new p.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return p._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class ms extends xr{constructor(e,s,a,o){super(e,s,a,o),this.roundZoom=!0,this.type="video",this.options=s}load(){return p._(this,void 0,void 0,function*(){this._loaded=!1;const e=this.options;this.urls=[];for(const s of e.urls)this.urls.push(this.map._requestManager.transformRequest(s,"Source").url);try{const s=yield p.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 p.j(s))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const s=this.video.seekable;e<s.start(0)||e>s.end(0)?this.fire(new p.j(new p.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=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const e=this.map.painter.context,s=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,kr.members)),this.boundsSegments||(this.boundsSegments=p.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 at(e,this.video,s.RGBA),this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE));let a=!1;for(const o in this.tiles){const c=this.tiles[o];c.state!=="loaded"&&(c.state="loaded",c.texture=this.texture,a=!0)}a&&this.fire(new p.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 Pi extends xr{constructor(e,s,a,o){super(e,s,a,o),s.coordinates?Array.isArray(s.coordinates)&&s.coordinates.length===4&&!s.coordinates.some(c=>!Array.isArray(c)||c.length!==2||c.some(m=>typeof m!="number"))||this.fire(new p.j(new p.a2(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new p.j(new p.a2(`sources.${e}`,null,'missing required property "coordinates"'))),s.animate&&typeof s.animate!="boolean"&&this.fire(new p.j(new p.a2(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),s.canvas?typeof s.canvas=="string"||s.canvas instanceof HTMLCanvasElement||this.fire(new p.j(new p.a2(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new p.j(new p.a2(`sources.${e}`,null,'missing required property "canvas"'))),this.options=s,this.animate=s.animate===void 0||s.animate}load(){return p._(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 p.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const s=this.map.painter.context,a=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,kr.members)),this.boundsSegments||(this.boundsSegments=p.a0.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new at(s,this.canvas,a.RGBA,{premultiply:!0});let o=!1;for(const c in this.tiles){const m=this.tiles[c];m.state!=="loaded"&&(m.state="loaded",m.texture=this.texture,o=!0)}o&&this.fire(new p.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}const rn={},sn=u=>{switch(u){case"geojson":return tn;case"image":return xr;case"raster":return et;case"raster-dem":return vt;case"vector":return en;case"video":return ms;case"canvas":return Pi}return rn[u]},he="RTLPluginLoaded";class nr extends p.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Qs()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(s=>{throw this.status="error",s})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return p._(this,arguments,void 0,function*(s,a=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=me.resolveURL(s),!this.url)throw new Error(`requested url ${s} is invalid`);if(this.status==="unavailable"){if(!a)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return p._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new p.k(he))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Qt=null;function ar(){return Qt||(Qt=new nr),Qt}class Er{constructor(e,s){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=p.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(e){const s=e+this.timeAdded;s<this.fadeEndTime||(this.fadeEndTime=s)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,s,a){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(o,c){const m={};if(!c)return m;for(const _ of o){const y=_.layerIds.map(b=>c.getLayer(b)).filter(Boolean);if(y.length!==0){_.layers=y,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(b=>y.filter(T=>T.id===b)[0]));for(const b of y)m[b.id]=_}}return m}(e.buckets,s.style),this.hasSymbolBuckets=!1;for(const o in this.buckets){const c=this.buckets[o];if(c instanceof p.a6){if(this.hasSymbolBuckets=!0,!a)break;c.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const o in this.buckets){const c=this.buckets[o];if(c instanceof p.a6&&c.hasRTLText){this.hasRTLText=!0,ar().lazyLoad();break}}this.queryPadding=0;for(const o in this.buckets){const c=this.buckets[o];this.queryPadding=Math.max(this.queryPadding,s.style.getLayer(o).queryRadius(c))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new p.a5}unloadVectorData(){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(const a in this.buckets){const o=this.buckets[a];o.uploadPending()&&o.upload(e)}const s=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new at(e,this.imageAtlas.image,s.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new at(e,this.glyphAtlasImage,s.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,s,a,o,c,m,_,y,b,T){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:o,cameraQueryGeometry:c,scale:m,tileSize:this.tileSize,pixelPosMatrix:T,transform:y,params:_,queryPadding:this.queryPadding*b},e,s,a):{}}querySourceFeatures(e,s){const a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;const o=a.loadVTLayers(),c=s&&s.sourceLayer?s.sourceLayer:"",m=o._geojsonTileLayer||o[c];if(!m)return;const _=p.a7(s&&s.filter),{z:y,x:b,y:T}=this.tileID.canonical,S={z:y,x:b,y:T};for(let z=0;z<m.length;z++){const D=m.feature(z);if(_.needGeometry){const U=p.a8(D,!0);if(!_.filter(new p.z(this.tileID.overscaledZ),U,this.tileID.canonical))continue}else if(!_.filter(new p.z(this.tileID.overscaledZ),D))continue;const R=a.getId(D,c),V=new p.a9(D,y,b,T,R);V.tile=S,e.push(V)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const s=this.expirationTime;if(e.cacheControl){const a=p.aa(e.cacheControl);a["max-age"]&&(this.expirationTime=Date.now()+1e3*a["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const a=Date.now();let o=!1;if(this.expirationTime>a)o=!1;else if(s)if(this.expirationTime<s)o=!0;else{const c=this.expirationTime-s;c?this.expirationTime=a+Math.max(c,3e4):o=!0}else o=!0;o?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(e,s){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;const a=this.latestFeatureIndex.loadVTLayers();for(const o in this.buckets){if(!s.style.hasLayer(o))continue;const c=this.buckets[o],m=c.layers[0].sourceLayer||"_geojsonTileLayer",_=a[m],y=e[m];if(!_||!y||Object.keys(y).length===0)continue;c.update(y,_,this.imageAtlas&&this.imageAtlas.patternPositions||{});const b=s&&s.style&&s.style.getLayer(o);b&&(this.queryPadding=Math.max(this.queryPadding,b.queryRadius(c)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<me.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=me.now()+e}setDependencies(e,s){const a={};for(const o of s)a[o]=!0;this.dependencies[e]=a}hasDependency(e,s){for(const a of e){const o=this.dependencies[a];if(o){for(const c of s)if(o[c])return!0}}return!1}}class ge{constructor(e,s){this.max=e,this.onRemove=s,this.reset()}reset(){for(const e in this.data)for(const s of this.data[e])s.timeout&&clearTimeout(s.timeout),this.onRemove(s.value);return this.data={},this.order=[],this}add(e,s,a){const o=e.wrapped().key;this.data[o]===void 0&&(this.data[o]=[]);const c={value:s,timeout:void 0};if(a!==void 0&&(c.timeout=setTimeout(()=>{this.remove(e,c)},a)),this.data[o].push(c),this.order.push(o),this.order.length>this.max){const m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const s=this.data[e].shift();return s.timeout&&clearTimeout(s.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),s.value}getByKey(e){const s=this.data[e];return s?s[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,s){if(!this.has(e))return this;const a=e.wrapped().key,o=s===void 0?0:this.data[a].indexOf(s),c=this.data[a][o];return this.data[a].splice(o,1),c.timeout&&clearTimeout(c.timeout),this.data[a].length===0&&delete this.data[a],this.onRemove(c.value),this.order.splice(this.order.indexOf(a),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const s=this._getAndRemoveByKey(this.order[0]);s&&this.onRemove(s)}return this}filter(e){const s=[];for(const a in this.data)for(const o of this.data[a])e(o.value)||s.push(o);for(const a of s)this.remove(a.value.tileID,a)}}class $e{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,s,a){const o=String(s);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][o]=this.stateChanges[e][o]||{},p.e(this.stateChanges[e][o],a),this.deletedStates[e]===null){this.deletedStates[e]={};for(const c in this.state[e])c!==o&&(this.deletedStates[e][c]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][o]===null){this.deletedStates[e][o]={};for(const c in this.state[e][o])a[c]||(this.deletedStates[e][o][c]=null)}else for(const c in a)this.deletedStates[e]&&this.deletedStates[e][o]&&this.deletedStates[e][o][c]===null&&delete this.deletedStates[e][o][c]}removeFeatureState(e,s,a){if(this.deletedStates[e]===null)return;const o=String(s);if(this.deletedStates[e]=this.deletedStates[e]||{},a&&s!==void 0)this.deletedStates[e][o]!==null&&(this.deletedStates[e][o]=this.deletedStates[e][o]||{},this.deletedStates[e][o][a]=null);else if(s!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][o])for(a in this.deletedStates[e][o]={},this.stateChanges[e][o])this.deletedStates[e][o][a]=null;else this.deletedStates[e][o]=null;else this.deletedStates[e]=null}getState(e,s){const a=String(s),o=p.e({},(this.state[e]||{})[a],(this.stateChanges[e]||{})[a]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){const c=this.deletedStates[e][s];if(c===null)return{};for(const m in c)delete o[m]}return o}initializeTileState(e,s){e.setFeatureState(this.state,s)}coalesceChanges(e,s){const a={};for(const o in this.stateChanges){this.state[o]=this.state[o]||{};const c={};for(const m in this.stateChanges[o])this.state[o][m]||(this.state[o][m]={}),p.e(this.state[o][m],this.stateChanges[o][m]),c[m]=this.state[o][m];a[o]=c}for(const o in this.deletedStates){this.state[o]=this.state[o]||{};const c={};if(this.deletedStates[o]===null)for(const m in this.state[o])c[m]={},this.state[o][m]={};else for(const m in this.deletedStates[o]){if(this.deletedStates[o][m]===null)this.state[o][m]={};else for(const _ of Object.keys(this.deletedStates[o][m]))delete this.state[o][m][_];c[m]=this.state[o][m]}a[o]=a[o]||{},p.e(a[o],c)}if(this.stateChanges={},this.deletedStates={},Object.keys(a).length!==0)for(const o in e)e[o].setFeatureState(a,s)}}class Be extends p.E{constructor(e,s,a){super(),this.id=e,this.dispatcher=a,this.on("data",o=>this._dataHandler(o)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((o,c,m,_)=>{const y=new(sn(c.type))(o,c,m,_);if(y.id!==o)throw new Error(`Expected Source id to be ${o} instead of ${y.id}`);return y})(e,s,a,this),this._tiles={},this._cache=new ge(0,o=>this._unloadTile(o)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new $e,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const e in this._tiles){const s=this._tiles[e];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 e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,s,a){return p._(this,void 0,void 0,function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,s,a)}catch(o){e.state="errored",o.status!==404?this._source.fire(new p.j(o,{tile:e})):this.update(this.transform,this.terrain)}})}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new p.k("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const s in this._tiles){const a=this._tiles[s];a.upload(e),a.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(ai).map(e=>e.key)}getRenderableIds(e){const s=[];for(const a in this._tiles)this._isIdRenderable(a,e)&&s.push(this._tiles[a]);return e?s.sort((a,o)=>{const c=a.tileID,m=o.tileID,_=new p.P(c.canonical.x,c.canonical.y)._rotate(this.transform.angle),y=new p.P(m.canonical.x,m.canonical.y)._rotate(this.transform.angle);return c.overscaledZ-m.overscaledZ||y.y-_.y||y.x-_.x}).map(a=>a.tileID.key):s.map(a=>a.tileID).sort(ai).map(a=>a.key)}hasRenderableParent(e){const s=this.findLoadedParent(e,0);return!!s&&this._isIdRenderable(s.tileID.key)}_isIdRenderable(e,s){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(s||!this._tiles[e].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const e in this._tiles)this._tiles[e].state!=="errored"&&this._reloadTile(e,"reloading")}}_reloadTile(e,s){return p._(this,void 0,void 0,function*(){const a=this._tiles[e];a&&(a.state!=="loading"&&(a.state=s),yield this._loadTile(a,e,s))})}_tileLoaded(e,s,a){e.timeAdded=me.now(),a==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(s,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new p.k("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){const s=this.getRenderableIds();for(let o=0;o<s.length;o++){const c=s[o];if(e.neighboringTiles&&e.neighboringTiles[c]){const m=this.getTileByID(c);a(e,m),a(m,e)}}function a(o,c){o.needsHillshadePrepare=!0,o.needsTerrainPrepare=!0;let m=c.tileID.canonical.x-o.tileID.canonical.x;const _=c.tileID.canonical.y-o.tileID.canonical.y,y=Math.pow(2,o.tileID.canonical.z),b=c.tileID.key;m===0&&_===0||Math.abs(_)>1||(Math.abs(m)>1&&(Math.abs(m+y)===1?m+=y:Math.abs(m-y)===1&&(m-=y)),c.dem&&o.dem&&(o.dem.backfillBorder(c.dem,m,_),o.neighboringTiles&&o.neighboringTiles[b]&&(o.neighboringTiles[b].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,s,a,o){for(const c in this._tiles){let m=this._tiles[c];if(o[c]||!m.hasData()||m.tileID.overscaledZ<=s||m.tileID.overscaledZ>a)continue;let _=m.tileID;for(;m&&m.tileID.overscaledZ>s+1;){const b=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[b.key],m&&m.hasData()&&(_=b)}let y=_;for(;y.overscaledZ>s;)if(y=y.scaledTo(y.overscaledZ-1),e[y.key]){o[_.key]=_;break}}}findLoadedParent(e,s){if(e.key in this._loadedParentTiles){const a=this._loadedParentTiles[e.key];return a&&a.tileID.overscaledZ>=s?a:null}for(let a=e.overscaledZ-1;a>=s;a--){const o=e.scaledTo(a),c=this._getLoadedTile(o);if(c)return c}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){const s=this._tiles[e.key];return s&&s.hasData()?s:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){const s=Math.ceil(e.width/this._source.tileSize)+1,a=Math.ceil(e.height/this._source.tileSize)+1,o=Math.floor(s*a*(this._maxTileCacheZoomLevels===null?p.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),c=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(c)}handleWrapJump(e){const s=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,s){const a={};for(const o in this._tiles){const c=this._tiles[o];c.tileID=c.tileID.unwrapTo(c.tileID.wrap+s),a[c.tileID.key]=c}this._tiles=a;for(const o in this._timers)clearTimeout(this._timers[o]),delete this._timers[o];for(const o in this._tiles)this._setTileReloadTimer(o,this._tiles[o])}}_updateCoveredAndRetainedTiles(e,s,a,o,c,m){const _={},y={},b=Object.keys(e),T=me.now();for(const S of b){const z=e[S],D=this._tiles[S];if(!D||D.fadeEndTime!==0&&D.fadeEndTime<=T)continue;const R=this.findLoadedParent(z,s),V=this.findLoadedSibling(z),U=R||V||null;U&&(this._addTile(U.tileID),_[U.tileID.key]=U.tileID),y[S]=z}this._retainLoadedChildren(y,o,a,e);for(const S in _)e[S]||(this._coveredTiles[S]=!0,e[S]=_[S]);if(m){const S={},z={};for(const D of c)this._tiles[D.key].hasData()?S[D.key]=D:z[D.key]=D;for(const D in z){const R=z[D].children(this._source.maxzoom);this._tiles[R[0].key]&&this._tiles[R[1].key]&&this._tiles[R[2].key]&&this._tiles[R[3].key]&&(S[R[0].key]=e[R[0].key]=R[0],S[R[1].key]=e[R[1].key]=R[1],S[R[2].key]=e[R[2].key]=R[2],S[R[3].key]=e[R[3].key]=R[3],delete z[D])}for(const D in z){const R=z[D],V=this.findLoadedParent(R,this._source.minzoom),U=this.findLoadedSibling(R),$=V||U||null;if($){S[$.tileID.key]=e[$.tileID.key]=$.tileID;for(const Z in S)S[Z].isChildOf($.tileID)&&delete S[Z]}}for(const D in this._tiles)S[D]||(this._coveredTiles[D]=!0)}}update(e,s){if(!this._sourceLoaded||this._paused)return;let a;this.transform=e,this.terrain=s,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?a=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(T=>new p.S(T.canonical.z,T.wrap,T.canonical.z,T.canonical.x,T.canonical.y)):(a=e.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:s}),this._source.hasTile&&(a=a.filter(T=>this._source.hasTile(T)))):a=[];const o=e.coveringZoomLevel(this._source),c=Math.max(o-Be.maxOverzooming,this._source.minzoom),m=Math.max(o+Be.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const T={};for(const S of a)if(S.canonical.z>this._source.minzoom){const z=S.scaledTo(S.canonical.z-1);T[z.key]=z;const D=S.scaledTo(Math.max(this._source.minzoom,Math.min(S.canonical.z,5)));T[D.key]=D}a=a.concat(Object.values(T))}const _=a.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,_&&this.fire(new p.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const y=this._updateRetainedTiles(a,o);Vi(this._source.type)&&this._updateCoveredAndRetainedTiles(y,c,m,o,a,s);for(const T in y)this._tiles[T].clearFadeHold();const b=p.ab(this._tiles,y);for(const T of b){const S=this._tiles[T];S.hasSymbolBuckets&&!S.holdingForFade()?S.setHoldDuration(this.map._fadeDuration):S.hasSymbolBuckets&&!S.symbolFadeFinished()||this._removeTile(T)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,s){var a;const o={},c={},m=Math.max(s-Be.maxOverzooming,this._source.minzoom),_=Math.max(s+Be.maxUnderzooming,this._source.minzoom),y={};for(const b of e){const T=this._addTile(b);o[b.key]=b,T.hasData()||s<this._source.maxzoom&&(y[b.key]=b)}this._retainLoadedChildren(y,s,_,o);for(const b of e){let T=this._tiles[b.key];if(T.hasData())continue;if(s+1>this._source.maxzoom){const z=b.children(this._source.maxzoom)[0],D=this.getTile(z);if(D&&D.hasData()){o[z.key]=z;continue}}else{const z=b.children(this._source.maxzoom);if(o[z[0].key]&&o[z[1].key]&&o[z[2].key]&&o[z[3].key])continue}let S=T.wasRequested();for(let z=b.overscaledZ-1;z>=m;--z){const D=b.scaledTo(z);if(c[D.key])break;if(c[D.key]=!0,T=this.getTile(D),!T&&S&&(T=this._addTile(D)),T){const R=T.hasData();if((R||!(!((a=this.map)===null||a===void 0)&&a.cancelPendingTileRequestsWhileZooming)||S)&&(o[D.key]=D),S=T.wasRequested(),R)break}}}return o}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const s=[];let a,o=this._tiles[e].tileID;for(;o.overscaledZ>0;){if(o.key in this._loadedParentTiles){a=this._loadedParentTiles[o.key];break}s.push(o.key);const c=o.scaledTo(o.overscaledZ-1);if(a=this._getLoadedTile(c),a)break;o=c}for(const c of s)this._loadedParentTiles[c]=a}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const e in this._tiles){const s=this._tiles[e].tileID,a=this._getLoadedTile(s);this._loadedSiblingTiles[s.key]=a}}_addTile(e){let s=this._tiles[e.key];if(s)return s;s=this._cache.getAndRemove(e),s&&(this._setTileReloadTimer(e.key,s),s.tileID=e,this._state.initializeTileState(s,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,s)));const a=s;return s||(s=new Er(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(s,e.key,s.state)),s.uses++,this._tiles[e.key]=s,a||this._source.fire(new p.k("dataloading",{tile:s,coord:s.tileID,dataType:"source"})),s}_setTileReloadTimer(e,s){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const a=s.getExpiryTimeout();a&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},a))}_removeTile(e){const s=this._tiles[e];s&&(s.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),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(e){const s=e.sourceDataType;e.dataType==="source"&&s==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.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 e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,s,a){const o=[],c=this.transform;if(!c)return o;const m=a?c.getCameraQueryGeometry(e):e,_=e.map(R=>c.pointCoordinate(R,this.terrain)),y=m.map(R=>c.pointCoordinate(R,this.terrain)),b=this.getIds();let T=1/0,S=1/0,z=-1/0,D=-1/0;for(const R of y)T=Math.min(T,R.x),S=Math.min(S,R.y),z=Math.max(z,R.x),D=Math.max(D,R.y);for(let R=0;R<b.length;R++){const V=this._tiles[b[R]];if(V.holdingForFade())continue;const U=V.tileID,$=Math.pow(2,c.zoom-V.tileID.overscaledZ),Z=s*V.queryPadding*p.X/V.tileSize/$,B=[U.getTilePoint(new p.Z(T,S)),U.getTilePoint(new p.Z(z,D))];if(B[0].x-Z<p.X&&B[0].y-Z<p.X&&B[1].x+Z>=0&&B[1].y+Z>=0){const X=_.map(ee=>U.getTilePoint(ee)),K=y.map(ee=>U.getTilePoint(ee));o.push({tile:V,tileID:U,queryGeometry:X,cameraQueryGeometry:K,scale:$})}}return o}getVisibleCoordinates(e){const s=this.getRenderableIds(e).map(a=>this._tiles[a].tileID);for(const a of s)a.posMatrix=this.transform.calculatePosMatrix(a.toUnwrapped());return s}hasTransition(){if(this._source.hasTransition())return!0;if(Vi(this._source.type)){const e=me.now();for(const s in this._tiles)if(this._tiles[s].fadeEndTime>=e)return!0}return!1}setFeatureState(e,s,a){this._state.updateState(e=e||"_geojsonTileLayer",s,a)}removeFeatureState(e,s,a){this._state.removeFeatureState(e=e||"_geojsonTileLayer",s,a)}getFeatureState(e,s){return this._state.getState(e=e||"_geojsonTileLayer",s)}setDependencies(e,s,a){const o=this._tiles[e];o&&o.setDependencies(s,a)}reloadTilesForDependencies(e,s){for(const a in this._tiles)this._tiles[a].hasDependency(e,s)&&this._reloadTile(a,"reloading");this._cache.filter(a=>!a.hasDependency(e,s))}}function ai(u,e){const s=Math.abs(2*u.wrap)-+(u.wrap<0),a=Math.abs(2*e.wrap)-+(e.wrap<0);return u.overscaledZ-e.overscaledZ||a-s||e.canonical.y-u.canonical.y||e.canonical.x-u.canonical.x}function Vi(u){return u==="raster"||u==="image"||u==="video"}Be.maxOverzooming=10,Be.maxUnderzooming=3;class Ne{constructor(e,s){this.reset(e,s)}reset(e,s){this.points=e||[],this._distances=[0];for(let a=1;a<this.points.length;a++)this._distances[a]=this._distances[a-1]+this.points[a].dist(this.points[a-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(e){if(this.points.length===1)return this.points[0];e=p.ac(e,0,1);let s=1,a=this._distances[s];const o=e*this.paddedLength+this.padding;for(;a<o&&s<this._distances.length;)a=this._distances[++s];const c=s-1,m=this._distances[c],_=a-m,y=_>0?(o-m)/_:0;return this.points[c].mult(1-y).add(this.points[s].mult(y))}}function or(u,e){let s=!0;return u==="always"||u!=="never"&&e!=="never"||(s=!1),s}class vr{constructor(e,s,a){const o=this.boxCells=[],c=this.circleCells=[];this.xCellCount=Math.ceil(e/a),this.yCellCount=Math.ceil(s/a);for(let m=0;m<this.xCellCount*this.yCellCount;m++)o.push([]),c.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=s,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/s,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,s,a,o,c){this._forEachCell(s,a,o,c,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(s),this.bboxes.push(a),this.bboxes.push(o),this.bboxes.push(c)}insertCircle(e,s,a,o){this._forEachCell(s-o,a-o,s+o,a+o,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(s),this.circles.push(a),this.circles.push(o)}_insertBoxCell(e,s,a,o,c,m){this.boxCells[c].push(m)}_insertCircleCell(e,s,a,o,c,m){this.circleCells[c].push(m)}_query(e,s,a,o,c,m,_){if(a<0||e>this.width||o<0||s>this.height)return[];const y=[];if(e<=0&&s<=0&&this.width<=a&&this.height<=o){if(c)return[{key:null,x1:e,y1:s,x2:a,y2:o}];for(let b=0;b<this.boxKeys.length;b++)y.push({key:this.boxKeys[b],x1:this.bboxes[4*b],y1:this.bboxes[4*b+1],x2:this.bboxes[4*b+2],y2:this.bboxes[4*b+3]});for(let b=0;b<this.circleKeys.length;b++){const T=this.circles[3*b],S=this.circles[3*b+1],z=this.circles[3*b+2];y.push({key:this.circleKeys[b],x1:T-z,y1:S-z,x2:T+z,y2:S+z})}}else this._forEachCell(e,s,a,o,this._queryCell,y,{hitTest:c,overlapMode:m,seenUids:{box:{},circle:{}}},_);return y}query(e,s,a,o){return this._query(e,s,a,o,!1,null)}hitTest(e,s,a,o,c,m){return this._query(e,s,a,o,!0,c,m).length>0}hitTestCircle(e,s,a,o,c){const m=e-a,_=e+a,y=s-a,b=s+a;if(_<0||m>this.width||b<0||y>this.height)return!1;const T=[];return this._forEachCell(m,y,_,b,this._queryCellCircle,T,{hitTest:!0,overlapMode:o,circle:{x:e,y:s,radius:a},seenUids:{box:{},circle:{}}},c),T.length>0}_queryCell(e,s,a,o,c,m,_,y){const{seenUids:b,hitTest:T,overlapMode:S}=_,z=this.boxCells[c];if(z!==null){const R=this.bboxes;for(const V of z)if(!b.box[V]){b.box[V]=!0;const U=4*V,$=this.boxKeys[V];if(e<=R[U+2]&&s<=R[U+3]&&a>=R[U+0]&&o>=R[U+1]&&(!y||y($))&&(!T||!or(S,$.overlapMode))&&(m.push({key:$,x1:R[U],y1:R[U+1],x2:R[U+2],y2:R[U+3]}),T))return!0}}const D=this.circleCells[c];if(D!==null){const R=this.circles;for(const V of D)if(!b.circle[V]){b.circle[V]=!0;const U=3*V,$=this.circleKeys[V];if(this._circleAndRectCollide(R[U],R[U+1],R[U+2],e,s,a,o)&&(!y||y($))&&(!T||!or(S,$.overlapMode))){const Z=R[U],B=R[U+1],X=R[U+2];if(m.push({key:$,x1:Z-X,y1:B-X,x2:Z+X,y2:B+X}),T)return!0}}}return!1}_queryCellCircle(e,s,a,o,c,m,_,y){const{circle:b,seenUids:T,overlapMode:S}=_,z=this.boxCells[c];if(z!==null){const R=this.bboxes;for(const V of z)if(!T.box[V]){T.box[V]=!0;const U=4*V,$=this.boxKeys[V];if(this._circleAndRectCollide(b.x,b.y,b.radius,R[U+0],R[U+1],R[U+2],R[U+3])&&(!y||y($))&&!or(S,$.overlapMode))return m.push(!0),!0}}const D=this.circleCells[c];if(D!==null){const R=this.circles;for(const V of D)if(!T.circle[V]){T.circle[V]=!0;const U=3*V,$=this.circleKeys[V];if(this._circlesCollide(R[U],R[U+1],R[U+2],b.x,b.y,b.radius)&&(!y||y($))&&!or(S,$.overlapMode))return m.push(!0),!0}}}_forEachCell(e,s,a,o,c,m,_,y){const b=this._convertToXCellCoord(e),T=this._convertToYCellCoord(s),S=this._convertToXCellCoord(a),z=this._convertToYCellCoord(o);for(let D=b;D<=S;D++)for(let R=T;R<=z;R++)if(c.call(this,e,s,a,o,this.xCellCount*R+D,m,_,y))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,s,a,o,c,m){const _=o-e,y=c-s,b=a+m;return b*b>_*_+y*y}_circleAndRectCollide(e,s,a,o,c,m,_){const y=(m-o)/2,b=Math.abs(e-(o+y));if(b>y+a)return!1;const T=(_-c)/2,S=Math.abs(s-(c+T));if(S>T+a)return!1;if(b<=y||S<=T)return!0;const z=b-y,D=S-T;return z*z+D*D<=a*a}}function Dr(u,e,s,a,o){const c=p.H();return e?(p.K(c,c,[1/o,1/o,1]),s||p.ad(c,c,a.angle)):p.L(c,a.labelPlaneMatrix,u),c}function lr(u,e,s,a,o){if(e){const c=p.ae(u);return p.K(c,c,[o,o,1]),s||p.ad(c,c,-a.angle),c}return a.glCoordMatrix}function N(u,e,s,a){let o;a?(o=[u,e,a(u,e),1],p.af(o,o,s)):(o=[u,e,0,1],Ke(o,o,s));const c=o[3];return{point:new p.P(o[0]/c,o[1]/c),signedDistanceFromCamera:c,isOccluded:!1}}function A(u,e){return .5+u/e*.5}function P(u,e){return u.x>=-e[0]&&u.x<=e[0]&&u.y>=-e[1]&&u.y<=e[1]}function E(u,e,s,a,o,c,m,_,y,b,T,S,z,D,R){const V=a?u.textSizeData:u.iconSizeData,U=p.ag(V,s.transform.zoom),$=[256/s.width*2+1,256/s.height*2+1],Z=a?u.text.dynamicLayoutVertexArray:u.icon.dynamicLayoutVertexArray;Z.clear();const B=u.lineVertexArray,X=a?u.text.placedSymbolArray:u.icon.placedSymbolArray,K=s.transform.width/s.transform.height;let ee=!1;for(let oe=0;oe<X.length;oe++){const ue=X.get(oe);if(ue.hidden||ue.writingMode===p.ah.vertical&&!ee){De(ue.numGlyphs,Z);continue}ee=!1;const xe=N(ue.anchorX,ue.anchorY,e,R);if(!P(xe.point,$)){De(ue.numGlyphs,Z);continue}const Te=A(s.transform.cameraToCenterDistance,xe.signedDistanceFromCamera),fe=p.ai(V,U,ue),pe=m?fe/Te:fe*Te,Me={getElevation:R,labelPlaneMatrix:o,lineVertexArray:B,pitchWithMap:m,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:b,tileAnchorPoint:new p.P(ue.anchorX,ue.anchorY),unwrappedTileID:T,width:S,height:z,translation:D},Ve=W(Me,ue,pe,!1,_,e,c,u.glyphOffsetArray,Z,K,y);ee=Ve.useVertical,(Ve.notEnoughRoom||ee||Ve.needsFlipping&&W(Me,ue,pe,!0,_,e,c,u.glyphOffsetArray,Z,K,y).notEnoughRoom)&&De(ue.numGlyphs,Z)}a?u.text.dynamicLayoutVertexBuffer.updateData(Z):u.icon.dynamicLayoutVertexBuffer.updateData(Z)}function O(u,e,s,a,o,c,m,_){const y=c.glyphStartIndex+c.numGlyphs,b=c.lineStartIndex,T=c.lineStartIndex+c.lineLength,S=e.getoffsetX(c.glyphStartIndex),z=e.getoffsetX(y-1),D=de(u*S,s,a,o,c.segment,b,T,_,m);if(!D)return null;const R=de(u*z,s,a,o,c.segment,b,T,_,m);return R?_.projectionCache.anyProjectionOccluded?null:{first:D,last:R}:null}function H(u,e,s,a){return u===p.ah.horizontal&&Math.abs(s.y-e.y)>Math.abs(s.x-e.x)*a?{useVertical:!0}:(u===p.ah.vertical?e.y<s.y:e.x>s.x)?{needsFlipping:!0}:null}function W(u,e,s,a,o,c,m,_,y,b,T){const S=s/24,z=e.lineOffsetX*S,D=e.lineOffsetY*S;let R;if(e.numGlyphs>1){const V=e.glyphStartIndex+e.numGlyphs,U=e.lineStartIndex,$=e.lineStartIndex+e.lineLength,Z=O(S,_,z,D,a,e,T,u);if(!Z)return{notEnoughRoom:!0};const B=N(Z.first.point.x,Z.first.point.y,m,u.getElevation).point,X=N(Z.last.point.x,Z.last.point.y,m,u.getElevation).point;if(o&&!a){const K=H(e.writingMode,B,X,b);if(K)return K}R=[Z.first];for(let K=e.glyphStartIndex+1;K<V-1;K++)R.push(de(S*_.getoffsetX(K),z,D,a,e.segment,U,$,u,T));R.push(Z.last)}else{if(o&&!a){const U=N(u.tileAnchorPoint.x,u.tileAnchorPoint.y,c,u.getElevation).point,$=e.lineStartIndex+e.segment+1,Z=new p.P(u.lineVertexArray.getx($),u.lineVertexArray.gety($)),B=N(Z.x,Z.y,c,u.getElevation),X=B.signedDistanceFromCamera>0?B.point:function(ee,oe,ue,xe,Te,fe){return Y(ee,oe,ue,1,Te,fe)}(u.tileAnchorPoint,Z,U,0,c,u),K=H(e.writingMode,U,X,b);if(K)return K}const V=de(S*_.getoffsetX(e.glyphStartIndex),z,D,a,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,u,T);if(!V||u.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};R=[V]}for(const V of R)p.aj(y,V.point,V.angle);return{}}function Y(u,e,s,a,o,c){const m=u.add(u.sub(e)._unit()),_=o!==void 0?N(m.x,m.y,o,c.getElevation).point:se(m.x,m.y,c).point,y=s.sub(_);return s.add(y._mult(a/y.mag()))}function q(u,e,s){const a=e.projectionCache;if(a.projections[u])return a.projections[u];const o=new p.P(e.lineVertexArray.getx(u),e.lineVertexArray.gety(u)),c=se(o.x,o.y,e);if(c.signedDistanceFromCamera>0)return a.projections[u]=c.point,a.anyProjectionOccluded=a.anyProjectionOccluded||c.isOccluded,c.point;const m=u-s.direction;return function(_,y,b,T,S){return Y(_,y,b,T,void 0,S)}(s.distanceFromAnchor===0?e.tileAnchorPoint:new p.P(e.lineVertexArray.getx(m),e.lineVertexArray.gety(m)),o,s.previousVertex,s.absOffsetX-s.distanceFromAnchor+1,e)}function se(u,e,s){const a=u+s.translation[0],o=e+s.translation[1];let c;return!s.pitchWithMap&&s.projection.useSpecialProjectionForSymbols?(c=s.projection.projectTileCoordinates(a,o,s.unwrappedTileID,s.getElevation),c.point.x=(.5*c.point.x+.5)*s.width,c.point.y=(.5*-c.point.y+.5)*s.height):(c=N(a,o,s.labelPlaneMatrix,s.getElevation),c.isOccluded=!1),c}function le(u,e,s){return u._unit()._perp()._mult(e*s)}function te(u,e,s,a,o,c,m,_,y){if(_.projectionCache.offsets[u])return _.projectionCache.offsets[u];const b=s.add(e);if(u+y.direction<a||u+y.direction>=o)return _.projectionCache.offsets[u]=b,b;const T=q(u+y.direction,_,y),S=le(T.sub(s),m,y.direction),z=s.add(S),D=T.add(S);return _.projectionCache.offsets[u]=p.ak(c,b,z,D)||b,_.projectionCache.offsets[u]}function de(u,e,s,a,o,c,m,_,y){const b=a?u-e:u+e;let T=b>0?1:-1,S=0;a&&(T*=-1,S=Math.PI),T<0&&(S+=Math.PI);let z,D=T>0?c+o:c+o+1;_.projectionCache.cachedAnchorPoint?z=_.projectionCache.cachedAnchorPoint:(z=se(_.tileAnchorPoint.x,_.tileAnchorPoint.y,_).point,_.projectionCache.cachedAnchorPoint=z);let R,V,U=z,$=z,Z=0,B=0;const X=Math.abs(b),K=[];let ee;for(;Z+B<=X;){if(D+=T,D<c||D>=m)return null;Z+=B,$=U,V=R;const xe={absOffsetX:X,direction:T,distanceFromAnchor:Z,previousVertex:$};if(U=q(D,_,xe),s===0)K.push($),ee=U.sub($);else{let Te;const fe=U.sub($);Te=fe.mag()===0?le(q(D+T,_,xe).sub(U),s,T):le(fe,s,T),V||(V=$.add(Te)),R=te(D,Te,U,c,m,V,s,_,xe),K.push(V),ee=R.sub(V)}B=ee.mag()}const oe=ee._mult((X-Z)/B)._add(V||$),ue=S+Math.atan2(U.y-$.y,U.x-$.x);return K.push(oe),{point:oe,angle:y?ue:0,path:K}}const Ee=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function De(u,e){for(let s=0;s<u;s++){const a=e.length;e.resize(a+4),e.float32.set(Ee,3*a)}}function Ke(u,e,s){const a=e[0],o=e[1];return u[0]=s[0]*a+s[4]*o+s[12],u[1]=s[1]*a+s[5]*o+s[13],u[3]=s[3]*a+s[7]*o+s[15],u}const je=100;class Je{constructor(e,s,a=new vr(e.width+200,e.height+200,25),o=new vr(e.width+200,e.height+200,25)){this.transform=e,this.mapProjection=s,this.grid=a,this.ignoredGrid=o,this.pitchFactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+je,this.screenBottomBoundary=e.height+je,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,s,a,o,c,m,_,y,b,T,S){const z=e.anchorPointX+y[0],D=e.anchorPointY+y[1],R=this.projectAndGetPerspectiveRatio(o,z,D,c,T),V=a*R.perspectiveRatio;let U;if(m||_)U=this._projectCollisionBox(e,V,o,c,m,_,y,R,T,S);else{const K=R.point.x+(S?S.x*V:0),ee=R.point.y+(S?S.y*V:0);U={allPointsOccluded:!1,box:[K+e.x1*V,ee+e.y1*V,K+e.x2*V,ee+e.y2*V]}}const[$,Z,B,X]=U.box;return this.mapProjection.useSpecialProjectionForSymbols&&(m?U.allPointsOccluded:this.mapProjection.isOccluded(z,D,c))||R.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid($,Z,B,X)||s!=="always"&&this.grid.hitTest($,Z,B,X,s,b)?{box:[$,Z,B,X],placeable:!1,offscreen:!1}:{box:[$,Z,B,X],placeable:!0,offscreen:this.isOffscreen($,Z,B,X)}}placeCollisionCircles(e,s,a,o,c,m,_,y,b,T,S,z,D,R,V,U){const $=[],Z=new p.P(s.anchorX,s.anchorY),B=this.getPerspectiveRatio(m,Z.x,Z.y,_,U),X=(S?c/B:c*B)/p.ap,K={getElevation:U,labelPlaneMatrix:y,lineVertexArray:a,pitchWithMap:S,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:Z,unwrappedTileID:_,width:this.transform.width,height:this.transform.height,translation:V},ee=O(X,o,s.lineOffsetX*X,s.lineOffsetY*X,!1,s,!1,K);let oe=!1,ue=!1,xe=!0;if(ee){const Te=.5*D*B+R,fe=new p.P(-100,-100),pe=new p.P(this.screenRightBoundary,this.screenBottomBoundary),Me=new Ne,Ve=ee.first,_e=ee.last;let be=[];for(let Ue=Ve.path.length-1;Ue>=1;Ue--)be.push(Ve.path[Ue]);for(let Ue=1;Ue<_e.path.length;Ue++)be.push(_e.path[Ue]);const Fe=2.5*Te;if(b){const Ue=this.projectPathToScreenSpace(be,K,b);be=Ue.some(He=>He.signedDistanceFromCamera<=0)?[]:Ue.map(He=>He.point)}let ft=[];if(be.length>0){const Ue=be[0].clone(),He=be[0].clone();for(let mt=1;mt<be.length;mt++)Ue.x=Math.min(Ue.x,be[mt].x),Ue.y=Math.min(Ue.y,be[mt].y),He.x=Math.max(He.x,be[mt].x),He.y=Math.max(He.y,be[mt].y);ft=Ue.x>=fe.x&&He.x<=pe.x&&Ue.y>=fe.y&&He.y<=pe.y?[be]:He.x<fe.x||Ue.x>pe.x||He.y<fe.y||Ue.y>pe.y?[]:p.al([be],fe.x,fe.y,pe.x,pe.y)}for(const Ue of ft){Me.reset(Ue,.25*Te);let He=0;He=Me.length<=.5*Te?1:Math.ceil(Me.paddedLength/Fe)+1;for(let mt=0;mt<He;mt++){const $t=mt/Math.max(He-1,1),Zi=Me.lerp($t),gt=Zi.x+je,ci=Zi.y+je;$.push(gt,ci,Te,0);const ti=gt-Te,qt=ci-Te,ii=gt+Te,dr=ci+Te;if(xe=xe&&this.isOffscreen(ti,qt,ii,dr),ue=ue||this.isInsideGrid(ti,qt,ii,dr),e!=="always"&&this.grid.hitTestCircle(gt,ci,Te,e,z)&&(oe=!0,!T))return{circles:[],offscreen:!1,collisionDetected:oe}}}}return{circles:!T&&oe||!ue||B<this.perspectiveRatioCutoff?[]:$,offscreen:xe,collisionDetected:oe}}projectPathToScreenSpace(e,s,a){return e.map(o=>N(o.x,o.y,a,s.getElevation))}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const s=[];let a=1/0,o=1/0,c=-1/0,m=-1/0;for(const T of e){const S=new p.P(T.x+je,T.y+je);a=Math.min(a,S.x),o=Math.min(o,S.y),c=Math.max(c,S.x),m=Math.max(m,S.y),s.push(S)}const _=this.grid.query(a,o,c,m).concat(this.ignoredGrid.query(a,o,c,m)),y={},b={};for(const T of _){const S=T.key;if(y[S.bucketInstanceId]===void 0&&(y[S.bucketInstanceId]={}),y[S.bucketInstanceId][S.featureIndex])continue;const z=[new p.P(T.x1,T.y1),new p.P(T.x2,T.y1),new p.P(T.x2,T.y2),new p.P(T.x1,T.y2)];p.am(s,z)&&(y[S.bucketInstanceId][S.featureIndex]=!0,b[S.bucketInstanceId]===void 0&&(b[S.bucketInstanceId]=[]),b[S.bucketInstanceId].push(S.featureIndex))}return b}insertCollisionBox(e,s,a,o,c,m){(a?this.ignoredGrid:this.grid).insert({bucketInstanceId:o,featureIndex:c,collisionGroupID:m,overlapMode:s},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,s,a,o,c,m){const _=a?this.ignoredGrid:this.grid,y={bucketInstanceId:o,featureIndex:c,collisionGroupID:m,overlapMode:s};for(let b=0;b<e.length;b+=4)_.insertCircle(y,e[b],e[b+1],e[b+2])}projectAndGetPerspectiveRatio(e,s,a,o,c){let m;c?(m=[s,a,c(s,a),1],p.af(m,m,e)):(m=[s,a,0,1],Ke(m,m,e));const _=m[3];return{point:new p.P((m[0]/_+1)/2*this.transform.width+je,(-m[1]/_+1)/2*this.transform.height+je),perspectiveRatio:.5+this.transform.cameraToCenterDistance/_*.5,isOccluded:!1,signedDistanceFromCamera:_}}getPerspectiveRatio(e,s,a,o,c){const m=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(s,a,o,c):N(s,a,e,c);return .5+this.transform.cameraToCenterDistance/m.signedDistanceFromCamera*.5}isOffscreen(e,s,a,o){return a<je||e>=this.screenRightBoundary||o<je||s>this.screenBottomBoundary}isInsideGrid(e,s,a,o){return a>=0&&e<this.gridRightBoundary&&o>=0&&s<this.gridBottomBoundary}getViewportMatrix(){const e=p.an([]);return p.J(e,e,[-100,-100,0]),e}_projectCollisionBox(e,s,a,o,c,m,_,y,b,T){let S=new p.P(1,0),z=new p.P(0,1);const D=new p.P(e.anchorPointX+_[0],e.anchorPointY+_[1]);if(m&&!c){const xe=this.projectAndGetPerspectiveRatio(a,D.x+1,D.y,o,b).point.sub(y.point).unit(),Te=Math.atan(xe.y/xe.x)+(xe.x<0?Math.PI:0),fe=Math.sin(Te),pe=Math.cos(Te);S=new p.P(pe,fe),z=new p.P(-fe,pe)}else if(!m&&c){const xe=-this.transform.angle,Te=Math.sin(xe),fe=Math.cos(xe);S=new p.P(fe,Te),z=new p.P(-Te,fe)}let R=y.point,V=s;if(c){R=D;const xe=this.transform.zoom-Math.floor(this.transform.zoom);V=Math.pow(2,-xe),V*=this.mapProjection.getPitchedTextCorrection(this.transform,D,o),T||(V*=p.ac(.5+y.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))}T&&(R=R.add(S.mult(T.x*V)).add(z.mult(T.y*V)));const U=e.x1*V,$=e.x2*V,Z=(U+$)/2,B=e.y1*V,X=e.y2*V,K=(B+X)/2,ee=[{offsetX:U,offsetY:B},{offsetX:Z,offsetY:B},{offsetX:$,offsetY:B},{offsetX:$,offsetY:K},{offsetX:$,offsetY:X},{offsetX:Z,offsetY:X},{offsetX:U,offsetY:X},{offsetX:U,offsetY:K}];let oe=[];for(const{offsetX:xe,offsetY:Te}of ee)oe.push(new p.P(R.x+S.x*xe+z.x*Te,R.y+S.y*xe+z.y*Te));let ue=!1;if(c){const xe=oe.map(Te=>this.projectAndGetPerspectiveRatio(a,Te.x,Te.y,o,b));ue=xe.some(Te=>!Te.isOccluded),oe=xe.map(Te=>Te.point)}else ue=!0;return{box:p.ao(oe),allPointsOccluded:!ue}}}function Ge(u,e,s){return e*(p.X/(u.tileSize*Math.pow(2,s-u.tileID.overscaledZ)))}class Mt{constructor(e,s,a,o){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?s:-s))):o&&a?1:0,this.placed=a}isHidden(){return this.opacity===0&&!this.placed}}class bt{constructor(e,s,a,o,c){this.text=new Mt(e?e.text:null,s,a,c),this.icon=new Mt(e?e.icon:null,s,o,c)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class qe{constructor(e,s,a){this.text=e,this.icon=s,this.skipFade=a}}class st{constructor(){this.invProjMatrix=p.H(),this.viewportMatrix=p.H(),this.circles=[]}}class xt{constructor(e,s,a,o,c){this.bucketInstanceId=e,this.featureIndex=s,this.sourceLayerIndex=a,this.bucketIndex=o,this.tileID=c}}class Et{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){const s=++this.maxGroupID;this.collisionGroups[e]={ID:s,predicate:a=>a.collisionGroupID===s}}return this.collisionGroups[e]}}function Ft(u,e,s,a,o){const{horizontalAlign:c,verticalAlign:m}=p.au(u);return new p.P(-(c-.5)*e+a[0]*o,-(m-.5)*s+a[1]*o)}class ei{constructor(e,s,a,o,c,m){this.transform=e.clone(),this.terrain=a,this.collisionIndex=new Je(this.transform,s),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=o,this.retainedQueryData={},this.collisionGroups=new Et(c),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=m,m&&(m.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){const s=this.terrain;return s?(a,o)=>s.getElevation(e,a,o):null}getBucketParts(e,s,a,o){const c=a.getBucket(s),m=a.latestFeatureIndex;if(!c||!m||s.id!==c.layerIds[0])return;const _=a.collisionBoxArray,y=c.layers[0].layout,b=c.layers[0].paint,T=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),S=a.tileSize/p.X,z=a.tileID.toUnwrapped(),D=this.transform.calculatePosMatrix(z),R=y.get("text-pitch-alignment")==="map",V=y.get("text-rotation-alignment")==="map",U=Ge(a,1,this.transform.zoom),$=this.collisionIndex.mapProjection.translatePosition(this.transform,a,b.get("text-translate"),b.get("text-translate-anchor")),Z=this.collisionIndex.mapProjection.translatePosition(this.transform,a,b.get("icon-translate"),b.get("icon-translate-anchor")),B=Dr(D,R,V,this.transform,U);let X=null;if(R){const ee=lr(D,R,V,this.transform,U);X=p.L([],this.transform.labelPlaneMatrix,ee)}this.retainedQueryData[c.bucketInstanceId]=new xt(c.bucketInstanceId,m,c.sourceLayerIndex,c.index,a.tileID);const K={bucket:c,layout:y,translationText:$,translationIcon:Z,posMatrix:D,unwrappedTileID:z,textLabelPlaneMatrix:B,labelToScreenMatrix:X,scale:T,textPixelRatio:S,holdingForFade:a.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:p.ag(c.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(c.sourceID)};if(o)for(const ee of c.sortKeyRanges){const{sortKey:oe,symbolInstanceStart:ue,symbolInstanceEnd:xe}=ee;e.push({sortKey:oe,symbolInstanceStart:ue,symbolInstanceEnd:xe,parameters:K})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:c.symbolInstances.length,parameters:K})}attemptAnchorPlacement(e,s,a,o,c,m,_,y,b,T,S,z,D,R,V,U,$,Z,B){const X=p.aq[e.textAnchor],K=[e.textOffset0,e.textOffset1],ee=Ft(X,a,o,K,c),oe=this.collisionIndex.placeCollisionBox(s,z,y,b,T,_,m,U,S.predicate,B,ee);if((!Z||this.collisionIndex.placeCollisionBox(Z,z,y,b,T,_,m,$,S.predicate,B,ee).placeable)&&oe.placeable){let ue;if(this.prevPlacement&&this.prevPlacement.variableOffsets[D.crossTileID]&&this.prevPlacement.placements[D.crossTileID]&&this.prevPlacement.placements[D.crossTileID].text&&(ue=this.prevPlacement.variableOffsets[D.crossTileID].anchor),D.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[D.crossTileID]={textOffset:K,width:a,height:o,anchor:X,textBoxScale:c,prevAnchor:ue},this.markUsedJustification(R,X,D,V),R.allowVerticalPlacement&&(this.markUsedOrientation(R,V,D),this.placedOrientations[D.crossTileID]=V),{shift:ee,placedGlyphBoxes:oe}}}placeLayerBucketPart(e,s,a){const{bucket:o,layout:c,translationText:m,translationIcon:_,posMatrix:y,unwrappedTileID:b,textLabelPlaneMatrix:T,labelToScreenMatrix:S,textPixelRatio:z,holdingForFade:D,collisionBoxArray:R,partiallyEvaluatedTextSize:V,collisionGroup:U}=e.parameters,$=c.get("text-optional"),Z=c.get("icon-optional"),B=p.ar(c,"text-overlap","text-allow-overlap"),X=B==="always",K=p.ar(c,"icon-overlap","icon-allow-overlap"),ee=K==="always",oe=c.get("text-rotation-alignment")==="map",ue=c.get("text-pitch-alignment")==="map",xe=c.get("icon-text-fit")!=="none",Te=c.get("symbol-z-order")==="viewport-y",fe=X&&(ee||!o.hasIconData()||Z),pe=ee&&(X||!o.hasTextData()||$);!o.collisionArrays&&R&&o.deserializeCollisionBoxes(R);const Me=this._getTerrainElevationFunc(this.retainedQueryData[o.bucketInstanceId].tileID),Ve=(_e,be,Fe)=>{var ft,Ue;if(s[_e.crossTileID])return;if(D)return void(this.placements[_e.crossTileID]=new qe(!1,!1,!1));let He=!1,mt=!1,$t=!0,Zi=null,gt={box:null,placeable:!1,offscreen:null},ci={placeable:!1},ti=null,qt=null,ii=null,dr=0,Fs=0,pa=0;be.textFeatureIndex?dr=be.textFeatureIndex:_e.useRuntimeCollisionCircles&&(dr=_e.featureIndex),be.verticalTextFeatureIndex&&(Fs=be.verticalTextFeatureIndex);const Os=be.textBox;if(Os){const Ei=Ot=>{let Zt=p.ah.horizontal;if(o.allowVerticalPlacement&&!Ot&&this.prevPlacement){const wi=this.prevPlacement.placedOrientations[_e.crossTileID];wi&&(this.placedOrientations[_e.crossTileID]=wi,Zt=wi,this.markUsedOrientation(o,Zt,_e))}return Zt},Di=(Ot,Zt)=>{if(o.allowVerticalPlacement&&_e.numVerticalGlyphVertices>0&&be.verticalTextBox){for(const wi of o.writingModes)if(wi===p.ah.vertical?(gt=Zt(),ci=gt):gt=Ot(),gt&>.placeable)break}else gt=Ot()},Br=_e.textAnchorOffsetStartIndex,Gi=_e.textAnchorOffsetEndIndex;if(Gi===Br){const Ot=(Zt,wi)=>{const We=this.collisionIndex.placeCollisionBox(Zt,B,z,y,b,ue,oe,m,U.predicate,Me);return We&&We.placeable&&(this.markUsedOrientation(o,wi,_e),this.placedOrientations[_e.crossTileID]=wi),We};Di(()=>Ot(Os,p.ah.horizontal),()=>{const Zt=be.verticalTextBox;return o.allowVerticalPlacement&&_e.numVerticalGlyphVertices>0&&Zt?Ot(Zt,p.ah.vertical):{box:null,offscreen:null}}),Ei(gt&>.placeable)}else{let Ot=p.aq[(Ue=(ft=this.prevPlacement)===null||ft===void 0?void 0:ft.variableOffsets[_e.crossTileID])===null||Ue===void 0?void 0:Ue.anchor];const Zt=(We,ns,Vs)=>{const Ns=We.x2-We.x1,vl=We.y2-We.y1,mc=_e.textBoxScale,bl=xe&&K==="never"?ns:null;let Fr=null,wl=B==="never"?1:2,ma="never";Ot&&wl++;for(let Sn=0;Sn<wl;Sn++){for(let ga=Br;ga<Gi;ga++){const _a=o.textAnchorOffsets.get(ga);if(Ot&&_a.textAnchor!==Ot)continue;const js=this.attemptAnchorPlacement(_a,We,Ns,vl,mc,oe,ue,z,y,b,U,ma,_e,o,Vs,m,_,bl,Me);if(js&&(Fr=js.placedGlyphBoxes,Fr&&Fr.placeable))return He=!0,Zi=js.shift,Fr}Ot?Ot=null:ma=B}return a&&!Fr&&(Fr={box:this.collisionIndex.placeCollisionBox(Os,"always",z,y,b,ue,oe,m,U.predicate,Me,new p.P(0,0)).box,offscreen:!1,placeable:!1}),Fr};Di(()=>Zt(Os,be.iconBox,p.ah.horizontal),()=>{const We=be.verticalTextBox;return o.allowVerticalPlacement&&(!gt||!gt.placeable)&&_e.numVerticalGlyphVertices>0&&We?Zt(We,be.verticalIconBox,p.ah.vertical):{box:null,occluded:!0,offscreen:null}}),gt&&(He=gt.placeable,$t=gt.offscreen);const wi=Ei(gt&>.placeable);if(!He&&this.prevPlacement){const We=this.prevPlacement.variableOffsets[_e.crossTileID];We&&(this.variableOffsets[_e.crossTileID]=We,this.markUsedJustification(o,We.anchor,_e,wi))}}}if(ti=gt,He=ti&&ti.placeable,$t=ti&&ti.offscreen,_e.useRuntimeCollisionCircles){const Ei=o.text.placedSymbolArray.get(_e.centerJustifiedTextSymbolIndex),Di=p.ai(o.textSizeData,V,Ei),Br=c.get("text-padding");qt=this.collisionIndex.placeCollisionCircles(B,Ei,o.lineVertexArray,o.glyphOffsetArray,Di,y,b,T,S,a,ue,U.predicate,_e.collisionCircleDiameter,Br,m,Me),qt.circles.length&&qt.collisionDetected&&!a&&p.w("Collisions detected, but collision boxes are not shown"),He=X||qt.circles.length>0&&!qt.collisionDetected,$t=$t&&qt.offscreen}if(be.iconFeatureIndex&&(pa=be.iconFeatureIndex),be.iconBox){const Ei=Di=>this.collisionIndex.placeCollisionBox(Di,K,z,y,b,ue,oe,_,U.predicate,Me,xe&&Zi?Zi:void 0);ci&&ci.placeable&&be.verticalIconBox?(ii=Ei(be.verticalIconBox),mt=ii.placeable):(ii=Ei(be.iconBox),mt=ii.placeable),$t=$t&&ii.offscreen}const ki=$||_e.numHorizontalGlyphVertices===0&&_e.numVerticalGlyphVertices===0,fa=Z||_e.numIconVertices===0;ki||fa?fa?ki||(mt=mt&&He):He=mt&&He:mt=He=mt&&He;const wo=mt&&ii.placeable;if(He&&ti.placeable&&this.collisionIndex.insertCollisionBox(ti.box,B,c.get("text-ignore-placement"),o.bucketInstanceId,ci&&ci.placeable&&Fs?Fs:dr,U.ID),wo&&this.collisionIndex.insertCollisionBox(ii.box,K,c.get("icon-ignore-placement"),o.bucketInstanceId,pa,U.ID),qt&&He&&this.collisionIndex.insertCollisionCircles(qt.circles,B,c.get("text-ignore-placement"),o.bucketInstanceId,dr,U.ID),a&&this.storeCollisionData(o.bucketInstanceId,Fe,be,ti,ii,qt),_e.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(o.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[_e.crossTileID]=new qe(He||fe,mt||pe,$t||o.justReloaded),s[_e.crossTileID]=!0};if(Te){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const _e=o.getSortedSymbolIndexes(this.transform.angle);for(let be=_e.length-1;be>=0;--be){const Fe=_e[be];Ve(o.symbolInstances.get(Fe),o.collisionArrays[Fe],Fe)}}else for(let _e=e.symbolInstanceStart;_e<e.symbolInstanceEnd;_e++)Ve(o.symbolInstances.get(_e),o.collisionArrays[_e],_e);if(a&&o.bucketInstanceId in this.collisionCircleArrays){const _e=this.collisionCircleArrays[o.bucketInstanceId];p.as(_e.invProjMatrix,y),_e.viewportMatrix=this.collisionIndex.getViewportMatrix()}o.justReloaded=!1}storeCollisionData(e,s,a,o,c,m){if(a.textBox||a.iconBox){let _,y;this.collisionBoxArrays.has(e)?_=this.collisionBoxArrays.get(e):(_=new Map,this.collisionBoxArrays.set(e,_)),_.has(s)?y=_.get(s):(y={text:null,icon:null},_.set(s,y)),a.textBox&&(y.text=o.box),a.iconBox&&(y.icon=c.box)}if(m){let _=this.collisionCircleArrays[e];_===void 0&&(_=this.collisionCircleArrays[e]=new st);for(let y=0;y<m.circles.length;y+=4)_.circles.push(m.circles[y+0]),_.circles.push(m.circles[y+1]),_.circles.push(m.circles[y+2]),_.circles.push(m.collisionDetected?1:0)}}markUsedJustification(e,s,a,o){let c;c=o===p.ah.vertical?a.verticalPlacedTextSymbolIndex:{left:a.leftJustifiedTextSymbolIndex,center:a.centerJustifiedTextSymbolIndex,right:a.rightJustifiedTextSymbolIndex}[p.at(s)];const m=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex,a.verticalPlacedTextSymbolIndex];for(const _ of m)_>=0&&(e.text.placedSymbolArray.get(_).crossTileID=c>=0&&_!==c?0:a.crossTileID)}markUsedOrientation(e,s,a){const o=s===p.ah.horizontal||s===p.ah.horizontalOnly?s:0,c=s===p.ah.vertical?s:0,m=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex];for(const _ of m)e.text.placedSymbolArray.get(_).placedOrientation=o;a.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).placedOrientation=c)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const s=this.prevPlacement;let a=!1;this.prevZoomAdjustment=s?s.zoomAdjustment(this.transform.zoom):0;const o=s?s.symbolFadeChange(e):1,c=s?s.opacities:{},m=s?s.variableOffsets:{},_=s?s.placedOrientations:{};for(const y in this.placements){const b=this.placements[y],T=c[y];T?(this.opacities[y]=new bt(T,o,b.text,b.icon),a=a||b.text!==T.text.placed||b.icon!==T.icon.placed):(this.opacities[y]=new bt(null,o,b.text,b.icon,b.skipFade),a=a||b.text||b.icon)}for(const y in c){const b=c[y];if(!this.opacities[y]){const T=new bt(b,o,!1,!1);T.isHidden()||(this.opacities[y]=T,a=a||b.text.placed||b.icon.placed)}}for(const y in m)this.variableOffsets[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.variableOffsets[y]=m[y]);for(const y in _)this.placedOrientations[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.placedOrientations[y]=_[y]);if(s&&s.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");a?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=s?s.lastPlacementChangeTime:e)}updateLayerOpacities(e,s){const a={};for(const o of s){const c=o.getBucket(e);c&&o.latestFeatureIndex&&e.id===c.layerIds[0]&&this.updateBucketOpacities(c,o.tileID,a,o.collisionBoxArray)}}updateBucketOpacities(e,s,a,o){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const c=e.layers[0],m=c.layout,_=new bt(null,0,!1,!1,!0),y=m.get("text-allow-overlap"),b=m.get("icon-allow-overlap"),T=c._unevaluatedLayout.hasValue("text-variable-anchor")||c._unevaluatedLayout.hasValue("text-variable-anchor-offset"),S=m.get("text-rotation-alignment")==="map",z=m.get("text-pitch-alignment")==="map",D=m.get("icon-text-fit")!=="none",R=new bt(null,0,y&&(b||!e.hasIconData()||m.get("icon-optional")),b&&(y||!e.hasTextData()||m.get("text-optional")),!0);!e.collisionArrays&&o&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(o);const V=($,Z,B)=>{for(let X=0;X<Z/4;X++)$.opacityVertexArray.emplaceBack(B);$.hasVisibleVertices=$.hasVisibleVertices||B!==_s},U=this.collisionBoxArrays.get(e.bucketInstanceId);for(let $=0;$<e.symbolInstances.length;$++){const Z=e.symbolInstances.get($),{numHorizontalGlyphVertices:B,numVerticalGlyphVertices:X,crossTileID:K}=Z;let ee=this.opacities[K];a[K]?ee=_:ee||(ee=R,this.opacities[K]=ee),a[K]=!0;const oe=Z.numIconVertices>0,ue=this.placedOrientations[Z.crossTileID],xe=ue===p.ah.vertical,Te=ue===p.ah.horizontal||ue===p.ah.horizontalOnly;if(B>0||X>0){const pe=xi(ee.text);V(e.text,B,xe?_s:pe),V(e.text,X,Te?_s:pe);const Me=ee.text.isHidden();[Z.rightJustifiedTextSymbolIndex,Z.centerJustifiedTextSymbolIndex,Z.leftJustifiedTextSymbolIndex].forEach(be=>{be>=0&&(e.text.placedSymbolArray.get(be).hidden=Me||xe?1:0)}),Z.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(Z.verticalPlacedTextSymbolIndex).hidden=Me||Te?1:0);const Ve=this.variableOffsets[Z.crossTileID];Ve&&this.markUsedJustification(e,Ve.anchor,Z,ue);const _e=this.placedOrientations[Z.crossTileID];_e&&(this.markUsedJustification(e,"left",Z,_e),this.markUsedOrientation(e,_e,Z))}if(oe){const pe=xi(ee.icon),Me=!(D&&Z.verticalPlacedIconSymbolIndex&&xe);Z.placedIconSymbolIndex>=0&&(V(e.icon,Z.numIconVertices,Me?pe:_s),e.icon.placedSymbolArray.get(Z.placedIconSymbolIndex).hidden=ee.icon.isHidden()),Z.verticalPlacedIconSymbolIndex>=0&&(V(e.icon,Z.numVerticalIconVertices,Me?_s:pe),e.icon.placedSymbolArray.get(Z.verticalPlacedIconSymbolIndex).hidden=ee.icon.isHidden())}const fe=U&&U.has($)?U.get($):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const pe=e.collisionArrays[$];if(pe){let Me=new p.P(0,0);if(pe.textBox||pe.verticalTextBox){let Ve=!0;if(T){const _e=this.variableOffsets[K];_e?(Me=Ft(_e.anchor,_e.width,_e.height,_e.textOffset,_e.textBoxScale),S&&Me._rotate(z?this.transform.angle:-this.transform.angle)):Ve=!1}if(pe.textBox||pe.verticalTextBox){let _e;pe.textBox&&(_e=xe),pe.verticalTextBox&&(_e=Te),gs(e.textCollisionBox.collisionVertexArray,ee.text.placed,!Ve||_e,fe.text,Me.x,Me.y)}}if(pe.iconBox||pe.verticalIconBox){const Ve=!!(!Te&&pe.verticalIconBox);let _e;pe.iconBox&&(_e=Ve),pe.verticalIconBox&&(_e=!Ve),gs(e.iconCollisionBox.collisionVertexArray,ee.icon.placed,_e,fe.icon,D?Me.x:0,D?Me.y:0)}}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);if(e.bucketInstanceId in this.collisionCircleArrays){const $=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=$.invProjMatrix,e.placementViewportMatrix=$.viewportMatrix,e.collisionCircleArray=$.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,s){const a=this.zoomAtLastRecencyCheck===s?1-this.zoomAdjustment(s):1;return this.zoomAtLastRecencyCheck=s,this.commitTime+this.fadeDuration*a>e}setStale(){this.stale=!0}}function gs(u,e,s,a,o,c){a&&a.length!==0||(a=[0,0,0,0]);const m=a[0]-je,_=a[1]-je,y=a[2]-je,b=a[3]-je;u.emplaceBack(e?1:0,s?1:0,o||0,c||0,m,_),u.emplaceBack(e?1:0,s?1:0,o||0,c||0,y,_),u.emplaceBack(e?1:0,s?1:0,o||0,c||0,y,b),u.emplaceBack(e?1:0,s?1:0,o||0,c||0,m,b)}const nt=Math.pow(2,25),Ea=Math.pow(2,24),Da=Math.pow(2,17),_i=Math.pow(2,16),yi=Math.pow(2,9),$l=Math.pow(2,8),Ai=Math.pow(2,1);function xi(u){if(u.opacity===0&&!u.placed)return 0;if(u.opacity===1&&u.placed)return 4294967295;const e=u.placed?1:0,s=Math.floor(127*u.opacity);return s*nt+e*Ea+s*Da+e*_i+s*yi+e*$l+s*Ai+e}const _s=0;function Hr(){return{isOccluded:(u,e,s)=>!1,getPitchedTextCorrection:(u,e,s)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(u,e,s,a){throw new Error("Not implemented.")},translatePosition:(u,e,s,a)=>function(o,c,m,_,y=!1){if(!m[0]&&!m[1])return[0,0];const b=y?_==="map"?o.angle:0:_==="viewport"?-o.angle:0;if(b){const T=Math.sin(b),S=Math.cos(b);m=[m[0]*S-m[1]*T,m[0]*T+m[1]*S]}return[y?m[0]:Ge(c,m[0],o.zoom),y?m[1]:Ge(c,m[1],o.zoom)]}(u,e,s,a),getCircleRadiusCorrection:u=>1}}class zt{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,s,a,o,c){const m=this._bucketParts;for(;this._currentTileIndex<e.length;)if(s.getBucketParts(m,o,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,c())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,m.sort((_,y)=>_.sortKey-y.sortKey));this._currentPartIndex<m.length;)if(s.placeLayerBucketPart(m[this._currentPartIndex],this._seenCrossTileIDs,a),this._currentPartIndex++,c())return!0;return!1}}class nn{constructor(e,s,a,o,c,m,_,y){this.placement=new ei(e,Hr(),s,m,_,y),this._currentPlacementIndex=a.length-1,this._forceFullPlacement=o,this._showCollisionBoxes=c,this._done=!1}isDone(){return this._done}continuePlacement(e,s,a){const o=me.now(),c=()=>!this._forceFullPlacement&&me.now()-o>2;for(;this._currentPlacementIndex>=0;){const m=s[e[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(m.type==="symbol"&&(!m.minzoom||m.minzoom<=_)&&(!m.maxzoom||m.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new zt(m)),this._inProgressLayer.continuePlacement(a[m.source],this.placement,this._showCollisionBoxes,m,c))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const Ni=512/p.X/2;class Pt{constructor(e,s,a){this.tileID=e,this.bucketInstanceId=a,this._symbolsByKey={};const o=new Map;for(let c=0;c<s.length;c++){const m=s.get(c),_=m.key,y=o.get(_);y?y.push(m):o.set(_,[m])}for(const[c,m]of o){const _={positions:m.map(y=>({x:Math.floor(y.anchorX*Ni),y:Math.floor(y.anchorY*Ni)})),crossTileIDs:m.map(y=>y.crossTileID)};if(_.positions.length>128){const y=new p.av(_.positions.length,16,Uint16Array);for(const{x:b,y:T}of _.positions)y.add(b,T);y.finish(),delete _.positions,_.index=y}this._symbolsByKey[c]=_}}getScaledCoordinates(e,s){const{x:a,y:o,z:c}=this.tileID.canonical,{x:m,y:_,z:y}=s.canonical,b=Ni/Math.pow(2,y-c),T=(_*p.X+e.anchorY)*b,S=o*p.X*Ni;return{x:Math.floor((m*p.X+e.anchorX)*b-a*p.X*Ni),y:Math.floor(T-S)}}findMatches(e,s,a){const o=this.tileID.canonical.z<s.canonical.z?1:Math.pow(2,this.tileID.canonical.z-s.canonical.z);for(let c=0;c<e.length;c++){const m=e.get(c);if(m.crossTileID)continue;const _=this._symbolsByKey[m.key];if(!_)continue;const y=this.getScaledCoordinates(m,s);if(_.index){const b=_.index.range(y.x-o,y.y-o,y.x+o,y.y+o).sort();for(const T of b){const S=_.crossTileIDs[T];if(!a[S]){a[S]=!0,m.crossTileID=S;break}}}else if(_.positions)for(let b=0;b<_.positions.length;b++){const T=_.positions[b],S=_.crossTileIDs[b];if(Math.abs(T.x-y.x)<=o&&Math.abs(T.y-y.y)<=o&&!a[S]){a[S]=!0,m.crossTileID=S;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}}class Bn{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class ji{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const s=Math.round((e-this.lng)/360);if(s!==0)for(const a in this.indexes){const o=this.indexes[a],c={};for(const m in o){const _=o[m];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+s),c[_.tileID.key]=_}this.indexes[a]=c}this.lng=e}addBucket(e,s,a){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===s.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let c=0;c<s.symbolInstances.length;c++)s.symbolInstances.get(c).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});const o=this.usedCrossTileIDs[e.overscaledZ];for(const c in this.indexes){const m=this.indexes[c];if(Number(c)>e.overscaledZ)for(const _ in m){const y=m[_];y.tileID.isChildOf(e)&&y.findMatches(s.symbolInstances,e,o)}else{const _=m[e.scaledTo(Number(c)).key];_&&_.findMatches(s.symbolInstances,e,o)}}for(let c=0;c<s.symbolInstances.length;c++){const m=s.symbolInstances.get(c);m.crossTileID||(m.crossTileID=a.generate(),o[m.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new Pt(e,s.symbolInstances,s.bucketInstanceId),!0}removeBucketCrossTileIDs(e,s){for(const a of s.getCrossTileIDsLists())for(const o of a)delete this.usedCrossTileIDs[e][o]}removeStaleBuckets(e){let s=!1;for(const a in this.indexes){const o=this.indexes[a];for(const c in o)e[o[c].bucketInstanceId]||(this.removeBucketCrossTileIDs(a,o[c]),delete o[c],s=!0)}return s}}class La{constructor(){this.layerIndexes={},this.crossTileIDs=new Bn,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,s,a){let o=this.layerIndexes[e.id];o===void 0&&(o=this.layerIndexes[e.id]=new ji);let c=!1;const m={};o.handleWrapJump(a);for(const _ of s){const y=_.getBucket(e);y&&e.id===y.layerIds[0]&&(y.bucketInstanceId||(y.bucketInstanceId=++this.maxBucketInstanceId),o.addBucket(_.tileID,y,this.crossTileIDs)&&(c=!0),m[y.bucketInstanceId]=!0)}return o.removeStaleBuckets(m)&&(c=!0),c}pruneUnusedLayers(e){const s={};e.forEach(a=>{s[a]=!0});for(const a in this.layerIndexes)s[a]||delete this.layerIndexes[a]}}const Ui=(u,e)=>p.t(u,e&&e.filter(s=>s.identifier!=="source.canvas")),ql=p.aw();class Fn extends p.E{constructor(e,s={}){super(),this._rtlPluginLoaded=()=>{for(const a in this.sourceCaches){const o=this.sourceCaches[a].getSource().type;o!=="vector"&&o!=="geojson"||this.sourceCaches[a].reload()}},this.map=e,this.dispatcher=new Zr(qr(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(a,o)=>this.getGlyphs(a,o)),this.dispatcher.registerMessageHandler("GI",(a,o)=>this.getImages(a,o)),this.imageManager=new jt,this.imageManager.setEventedParent(this),this.glyphManager=new rr(e._requestManager,s.localIdeographFontFamily),this.lineAtlas=new ds(256,512),this.crossTileSymbolIndex=new La,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new p.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",p.ay()),ar().on(he,this._rtlPluginLoaded),this.on("data",a=>{if(a.dataType!=="source"||a.sourceDataType!=="metadata")return;const o=this.sourceCaches[a.sourceId];if(!o)return;const c=o.getSource();if(c&&c.vectorLayerIds)for(const m in this._layers){const _=this._layers[m];_.source===c.id&&this._validateLayer(_)}})}loadURL(e,s={},a){this.fire(new p.k("dataloading",{dataType:"style"})),s.validate=typeof s.validate!="boolean"||s.validate;const o=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;const c=this._loadStyleRequest;p.h(o,this._loadStyleRequest).then(m=>{this._loadStyleRequest=null,this._load(m.data,s,a)}).catch(m=>{this._loadStyleRequest=null,m&&!c.signal.aborted&&this.fire(new p.j(m))})}loadJSON(e,s={},a){this.fire(new p.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,me.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,s.validate=s.validate!==!1,this._load(e,s,a)}).catch(()=>{})}loadEmpty(){this.fire(new p.k("dataloading",{dataType:"style"})),this._load(ql,{validate:!1})}_load(e,s,a){var o;const c=s.transformStyle?s.transformStyle(a,e):e;if(!s.validate||!Ui(this,p.u(c))){this._loaded=!0,this.stylesheet=c;for(const m in c.sources)this.addSource(m,c.sources[m],{validate:!1});c.sprite?this._loadSprite(c.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(c.glyphs),this._createLayers(),this.light=new _r(this.stylesheet.light),this.sky=new Fi(this.stylesheet.sky),this.map.setTerrain((o=this.stylesheet.terrain)!==null&&o!==void 0?o:null),this.fire(new p.k("data",{dataType:"style"})),this.fire(new p.k("style.load"))}}_createLayers(){const e=p.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",e),this._order=e.map(s=>s.id),this._layers={},this._serializedLayers=null;for(const s of e){const a=p.aA(s);a.setEventedParent(this,{layer:{id:s.id}}),this._layers[s.id]=a}}_loadSprite(e,s=!1,a=void 0){let o;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(c,m,_,y){return p._(this,void 0,void 0,function*(){const b=ir(c),T=_>1?"@2x":"",S={},z={};for(const{id:D,url:R}of b){const V=m.transformRequest(Ys(R,T,".json"),"SpriteJSON");S[D]=p.h(V,y);const U=m.transformRequest(Ys(R,T,".png"),"SpriteImage");z[D]=mi.getImage(U,y)}return yield Promise.all([...Object.values(S),...Object.values(z)]),function(D,R){return p._(this,void 0,void 0,function*(){const V={};for(const U in D){V[U]={};const $=me.getImageCanvasContext((yield R[U]).data),Z=(yield D[U]).data;for(const B in Z){const{width:X,height:K,x:ee,y:oe,sdf:ue,pixelRatio:xe,stretchX:Te,stretchY:fe,content:pe,textFitWidth:Me,textFitHeight:Ve}=Z[B];V[U][B]={data:null,pixelRatio:xe,sdf:ue,stretchX:Te,stretchY:fe,content:pe,textFitWidth:Me,textFitHeight:Ve,spriteData:{width:X,height:K,x:ee,y:oe,context:$}}}}return V})}(S,z)})}(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(c=>{if(this._spriteRequest=null,c)for(const m in c){this._spritesImagesIds[m]=[];const _=this._spritesImagesIds[m]?this._spritesImagesIds[m].filter(y=>!(y in c)):[];for(const y of _)this.imageManager.removeImage(y),this._changedImages[y]=!0;for(const y in c[m]){const b=m==="default"?y:`${m}:${y}`;this._spritesImagesIds[m].push(b),b in this.imageManager.images?this.imageManager.updateImage(b,c[m][y],!1):this.imageManager.addImage(b,c[m][y]),s&&(this._changedImages[b]=!0)}}}).catch(c=>{this._spriteRequest=null,o=c,this.fire(new p.j(o))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),s&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.k("data",{dataType:"style"})),a&&a(o)})}_unloadSprite(){for(const e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.k("data",{dataType:"style"}))}_validateLayer(e){const s=this.sourceCaches[e.source];if(!s)return;const a=e.sourceLayer;if(!a)return;const o=s.getSource();(o.type==="geojson"||o.vectorLayerIds&&o.vectorLayerIds.indexOf(a)===-1)&&this.fire(new p.j(new Error(`Source layer "${a}" does not exist on source "${o.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,s=!1){const a=this._serializedAllLayers();if(!e||e.length===0)return Object.values(s?p.aB(a):a);const o=[];for(const c of e)if(a[c]){const m=s?p.aB(a[c]):a[c];o.push(m)}return o}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};const s=Object.keys(this._layers);for(const a of s){const o=this._layers[a];o.type!=="custom"&&(e[a]=o.serialize())}return e}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(const e in this.sourceCaches)if(this.sourceCaches[e].hasTransition())return!0;for(const e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;const s=this._changed;if(s){const o=Object.keys(this._updatedLayers),c=Object.keys(this._removedLayers);(o.length||c.length)&&this._updateWorkerLayers(o,c);for(const m in this._updatedSources){const _=this._updatedSources[m];if(_==="reload")this._reloadSource(m);else{if(_!=="clear")throw new Error(`Invalid action ${_}`);this._clearSource(m)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const m in this._updatedPaintProps)this._layers[m].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}const a={};for(const o in this.sourceCaches){const c=this.sourceCaches[o];a[o]=c.used,c.used=!1}for(const o of this._order){const c=this._layers[o];c.recalculate(e,this._availableImages),!c.isHidden(e.zoom)&&c.source&&(this.sourceCaches[c.source].used=!0)}for(const o in a){const c=this.sourceCaches[o];!!a[o]!=!!c.used&&c.fire(new p.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:o}))}this.light.recalculate(e),this.sky.recalculate(e),this.z=e.zoom,s&&this.fire(new p.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const e=Object.keys(this._changedImages);if(e.length){for(const s in this.sourceCaches)this.sourceCaches[s].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,s){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:s})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,s={}){var a;this._checkLoaded();const o=this.serialize();if(e=s.transformStyle?s.transformStyle(o,e):e,((a=s.validate)===null||a===void 0||a)&&Ui(this,p.u(e)))return!1;(e=p.aB(e)).layers=p.az(e.layers);const c=p.aC(o,e),m=this._getOperationsToPerform(c);if(m.unimplemented.length>0)throw new Error(`Unimplemented: ${m.unimplemented.join(", ")}.`);if(m.operations.length===0)return!1;for(const _ of m.operations)_();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){const s=[],a=[];for(const o of e)switch(o.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":s.push(()=>this.addLayer.apply(this,o.args));break;case"removeLayer":s.push(()=>this.removeLayer.apply(this,o.args));break;case"setPaintProperty":s.push(()=>this.setPaintProperty.apply(this,o.args));break;case"setLayoutProperty":s.push(()=>this.setLayoutProperty.apply(this,o.args));break;case"setFilter":s.push(()=>this.setFilter.apply(this,o.args));break;case"addSource":s.push(()=>this.addSource.apply(this,o.args));break;case"removeSource":s.push(()=>this.removeSource.apply(this,o.args));break;case"setLayerZoomRange":s.push(()=>this.setLayerZoomRange.apply(this,o.args));break;case"setLight":s.push(()=>this.setLight.apply(this,o.args));break;case"setGeoJSONSourceData":s.push(()=>this.setGeoJSONSourceData.apply(this,o.args));break;case"setGlyphs":s.push(()=>this.setGlyphs.apply(this,o.args));break;case"setSprite":s.push(()=>this.setSprite.apply(this,o.args));break;case"setSky":s.push(()=>this.setSky.apply(this,o.args));break;case"setTerrain":s.push(()=>this.map.setTerrain.apply(this,o.args));break;case"setTransition":s.push(()=>{});break;default:a.push(o.command)}return{operations:s,unimplemented:a}}addImage(e,s){if(this.getImage(e))return this.fire(new p.j(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,s),this._afterImageUpdated(e)}updateImage(e,s){this.imageManager.updateImage(e,s)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new p.j(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,s,a={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw new Error(`Source "${e}" 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(p.u.source,`sources.${e}`,s,null,a))return;this.map&&this.map._collectResourceTiming&&(s.collectResourceTiming=!0);const o=this.sourceCaches[e]=new Be(e,s,this.dispatcher);o.style=this,o.setEventedParent(this,()=>({isSourceLoaded:o.loaded(),source:o.serialize(),sourceId:e})),o.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID");for(const a in this._layers)if(this._layers[a].source===e)return this.fire(new p.j(new Error(`Source "${e}" cannot be removed while layer "${a}" is using it.`)));const s=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],s.fire(new p.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),s.setEventedParent(null),s.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,s){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error(`There is no source with this ID=${e}`);const a=this.sourceCaches[e].getSource();if(a.type!=="geojson")throw new Error(`geojsonSource.type is ${a.type}, which is !== 'geojson`);a.setData(s),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,s,a={}){this._checkLoaded();const o=e.id;if(this.getLayer(o))return void this.fire(new p.j(new Error(`Layer "${o}" already exists on this map.`)));let c;if(e.type==="custom"){if(Ui(this,p.aD(e)))return;c=p.aA(e)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(o,e.source),e=p.aB(e),e=p.e(e,{source:o})),this._validate(p.u.layer,`layers.${o}`,e,{arrayIndex:-1},a))return;c=p.aA(e),this._validateLayer(c),c.setEventedParent(this,{layer:{id:o}})}const m=s?this._order.indexOf(s):this._order.length;if(s&&m===-1)this.fire(new p.j(new Error(`Cannot add layer "${o}" before non-existing layer "${s}".`)));else{if(this._order.splice(m,0,o),this._layerOrderChanged=!0,this._layers[o]=c,this._removedLayers[o]&&c.source&&c.type!=="custom"){const _=this._removedLayers[o];delete this._removedLayers[o],_.type!==c.type?this._updatedSources[c.source]="clear":(this._updatedSources[c.source]="reload",this.sourceCaches[c.source].pause())}this._updateLayer(c),c.onAdd&&c.onAdd(this.map)}}moveLayer(e,s){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new p.j(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===s)return;const a=this._order.indexOf(e);this._order.splice(a,1);const o=s?this._order.indexOf(s):this._order.length;s&&o===-1?this.fire(new p.j(new Error(`Cannot move layer "${e}" before non-existing layer "${s}".`))):(this._order.splice(o,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const s=this._layers[e];if(!s)return void this.fire(new p.j(new Error(`Cannot remove non-existing layer "${e}".`)));s.setEventedParent(null);const a=this._order.indexOf(e);this._order.splice(a,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=s,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],s.onRemove&&s.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,s,a){this._checkLoaded();const o=this.getLayer(e);o?o.minzoom===s&&o.maxzoom===a||(s!=null&&(o.minzoom=s),a!=null&&(o.maxzoom=a),this._updateLayer(o)):this.fire(new p.j(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,s,a={}){this._checkLoaded();const o=this.getLayer(e);if(o){if(!p.aE(o.filter,s))return s==null?(o.filter=void 0,void this._updateLayer(o)):void(this._validate(p.u.filter,`layers.${o.id}.filter`,s,null,a)||(o.filter=p.aB(s),this._updateLayer(o)))}else this.fire(new p.j(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return p.aB(this.getLayer(e).filter)}setLayoutProperty(e,s,a,o={}){this._checkLoaded();const c=this.getLayer(e);c?p.aE(c.getLayoutProperty(s),a)||(c.setLayoutProperty(s,a,o),this._updateLayer(c)):this.fire(new p.j(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,s){const a=this.getLayer(e);if(a)return a.getLayoutProperty(s);this.fire(new p.j(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,s,a,o={}){this._checkLoaded();const c=this.getLayer(e);c?p.aE(c.getPaintProperty(s),a)||(c.setPaintProperty(s,a,o)&&this._updateLayer(c),this._changed=!0,this._updatedPaintProps[e]=!0,this._serializedLayers=null):this.fire(new p.j(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(e,s){return this.getLayer(e).getPaintProperty(s)}setFeatureState(e,s){this._checkLoaded();const a=e.source,o=e.sourceLayer,c=this.sourceCaches[a];if(c===void 0)return void this.fire(new p.j(new Error(`The source '${a}' does not exist in the map's style.`)));const m=c.getSource().type;m==="geojson"&&o?this.fire(new p.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):m!=="vector"||o?(e.id===void 0&&this.fire(new p.j(new Error("The feature id parameter must be provided."))),c.setFeatureState(o,e.id,s)):this.fire(new p.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,s){this._checkLoaded();const a=e.source,o=this.sourceCaches[a];if(o===void 0)return void this.fire(new p.j(new Error(`The source '${a}' does not exist in the map's style.`)));const c=o.getSource().type,m=c==="vector"?e.sourceLayer:void 0;c!=="vector"||m?s&&typeof e.id!="string"&&typeof e.id!="number"?this.fire(new p.j(new Error("A feature id is required to remove its specific state property."))):o.removeFeatureState(m,e.id,s):this.fire(new p.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const s=e.source,a=e.sourceLayer,o=this.sourceCaches[s];if(o!==void 0)return o.getSource().type!=="vector"||a?(e.id===void 0&&this.fire(new p.j(new Error("The feature id parameter must be provided."))),o.getFeatureState(a,e.id)):void this.fire(new p.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new p.j(new Error(`The source '${s}' does not exist in the map's style.`)))}getTransition(){return p.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const e=p.aF(this.sourceCaches,c=>c.serialize()),s=this._serializeByIds(this._order,!0),a=this.map.getTerrain()||void 0,o=this.stylesheet;return p.aG({version:o.version,name:o.name,metadata:o.metadata,light:o.light,sky:o.sky,center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch,sprite:o.sprite,glyphs:o.glyphs,transition:o.transition,sources:e,layers:s,terrain:a},c=>c!==void 0)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.sourceCaches[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){const s=m=>this._layers[m].type==="fill-extrusion",a={},o=[];for(let m=this._order.length-1;m>=0;m--){const _=this._order[m];if(s(_)){a[_]=m;for(const y of e){const b=y[_];if(b)for(const T of b)o.push(T)}}}o.sort((m,_)=>_.intersectionZ-m.intersectionZ);const c=[];for(let m=this._order.length-1;m>=0;m--){const _=this._order[m];if(s(_))for(let y=o.length-1;y>=0;y--){const b=o[y].feature;if(a[b.layer.id]<m)break;c.push(b),o.pop()}else for(const y of e){const b=y[_];if(b)for(const T of b)c.push(T.feature)}}return c}queryRenderedFeatures(e,s,a){s&&s.filter&&this._validate(p.u.filter,"queryRenderedFeatures.filter",s.filter,null,s);const o={};if(s&&s.layers){if(!Array.isArray(s.layers))return this.fire(new p.j(new Error("parameters.layers must be an Array."))),[];for(const _ of s.layers){const y=this._layers[_];if(!y)return this.fire(new p.j(new Error(`The layer '${_}' does not exist in the map's style and cannot be queried for features.`))),[];o[y.source]=!0}}const c=[];s.availableImages=this._availableImages;const m=this._serializedAllLayers();for(const _ in this.sourceCaches)s.layers&&!o[_]||c.push(zr(this.sourceCaches[_],this._layers,m,e,s,a));return this.placement&&c.push(function(_,y,b,T,S,z,D){const R={},V=z.queryRenderedSymbols(T),U=[];for(const $ of Object.keys(V).map(Number))U.push(D[$]);U.sort(Cr);for(const $ of U){const Z=$.featureIndex.lookupSymbolFeatures(V[$.bucketInstanceId],y,$.bucketIndex,$.sourceLayerIndex,S.filter,S.layers,S.availableImages,_);for(const B in Z){const X=R[B]=R[B]||[],K=Z[B];K.sort((ee,oe)=>{const ue=$.featureSortOrder;if(ue){const xe=ue.indexOf(ee.featureIndex);return ue.indexOf(oe.featureIndex)-xe}return oe.featureIndex-ee.featureIndex});for(const ee of K)X.push(ee)}}for(const $ in R)R[$].forEach(Z=>{const B=Z.feature,X=b[_[$].source].getFeatureState(B.layer["source-layer"],B.id);B.source=B.layer.source,B.layer["source-layer"]&&(B.sourceLayer=B.layer["source-layer"]),B.state=X});return R}(this._layers,m,this.sourceCaches,e,s,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(c)}querySourceFeatures(e,s){s&&s.filter&&this._validate(p.u.filter,"querySourceFeatures.filter",s.filter,null,s);const a=this.sourceCaches[e];return a?function(o,c){const m=o.getRenderableIds().map(b=>o.getTileByID(b)),_=[],y={};for(let b=0;b<m.length;b++){const T=m[b],S=T.tileID.canonical.key;y[S]||(y[S]=!0,T.querySourceFeatures(_,c))}return _}(a,s):[]}getLight(){return this.light.getLight()}setLight(e,s={}){this._checkLoaded();const a=this.light.getLight();let o=!1;for(const m in e)if(!p.aE(e[m],a[m])){o=!0;break}if(!o)return;const c={now:me.now(),transition:p.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,s),this.light.updateTransitions(c)}getSky(){var e;return(e=this.stylesheet)===null||e===void 0?void 0:e.sky}setSky(e,s={}){const a=this.getSky();let o=!1;if(!e&&!a)return;if(e&&!a)o=!0;else if(!e&&a)o=!0;else for(const m in e)if(!p.aE(e[m],a[m])){o=!0;break}if(!o)return;const c={now:me.now(),transition:p.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,s),this.sky.updateTransitions(c)}_validate(e,s,a,o,c={}){return(!c||c.validate!==!1)&&Ui(this,e.call(p.u,p.e({key:s,style:this.serialize(),value:a,styleSpec:p.v},o)))}_remove(e=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),ar().off(he,this._rtlPluginLoaded);for(const s in this._layers)this._layers[s].setEventedParent(null);for(const s in this.sourceCaches){const a=this.sourceCaches[s];a.setEventedParent(null),a.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.sourceCaches[e].clearTiles()}_reloadSource(e){this.sourceCaches[e].resume(),this.sourceCaches[e].reload()}_updateSources(e){for(const s in this.sourceCaches)this.sourceCaches[s].update(e,this.map.terrain)}_generateCollisionBoxes(){for(const e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(e,s,a,o,c=!1){let m=!1,_=!1;const y={};for(const b of this._order){const T=this._layers[b];if(T.type!=="symbol")continue;if(!y[T.source]){const z=this.sourceCaches[T.source];y[T.source]=z.getRenderableIds(!0).map(D=>z.getTileByID(D)).sort((D,R)=>R.tileID.overscaledZ-D.tileID.overscaledZ||(D.tileID.isLessThan(R.tileID)?-1:1))}const S=this.crossTileSymbolIndex.addLayer(T,y[T.source],e.center.lng);m=m||S}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((c=c||this._layerOrderChanged||a===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(me.now(),e.zoom))&&(this.pauseablePlacement=new nn(e,this.map.terrain,this._order,c,s,a,o,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,y),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(me.now()),_=!0),m&&this.pauseablePlacement.placement.setStale()),_||m)for(const b of this._order){const T=this._layers[b];T.type==="symbol"&&this.placement.updateLayerOpacities(T,y[T.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(me.now())}_releaseSymbolFadeTiles(){for(const e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,s){return p._(this,void 0,void 0,function*(){const a=yield this.imageManager.getImages(s.icons);this._updateTilesForChangedImages();const o=this.sourceCaches[s.source];return o&&o.setDependencies(s.tileID.key,s.type,s.icons),a})}getGlyphs(e,s){return p._(this,void 0,void 0,function*(){const a=yield this.glyphManager.getGlyphs(s.stacks),o=this.sourceCaches[s.source];return o&&o.setDependencies(s.tileID.key,s.type,[""]),a})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,s={}){this._checkLoaded(),e&&this._validate(p.u.glyphs,"glyphs",e,null,s)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,s,a={},o){this._checkLoaded();const c=[{id:e,url:s}],m=[...ir(this.stylesheet.sprite),...c];this._validate(p.u.sprite,"sprite",m,null,a)||(this.stylesheet.sprite=m,this._loadSprite(c,!0,o))}removeSprite(e){this._checkLoaded();const s=ir(this.stylesheet.sprite);if(s.find(a=>a.id===e)){if(this._spritesImagesIds[e])for(const a of this._spritesImagesIds[e])this.imageManager.removeImage(a),this._changedImages[a]=!0;s.splice(s.findIndex(a=>a.id===e),1),this.stylesheet.sprite=s.length>0?s:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.k("data",{dataType:"style"}))}else this.fire(new p.j(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return ir(this.stylesheet.sprite)}setSprite(e,s={},a){this._checkLoaded(),e&&this._validate(p.u.sprite,"sprite",e,null,s)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,a):(this._unloadSprite(),a&&a(null)))}}var Xr=p.Y([{name:"a_pos",type:"Int16",components:2}]);const Lr={prelude:tt(`#ifdef GL_ES6precision mediump float;7#else8#if !defined(lowp)9#define lowp10#endif11#if !defined(mediump)12#define mediump13#endif14#if !defined(highp)15#define highp16#endif17#endif18`,`#ifdef GL_ES19precision highp float;20#else21#if !defined(lowp)22#define lowp23#endif24#if !defined(mediump)25#define mediump26#endif27#if !defined(highp)28#define highp29#endif30#endif31vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.032);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}33#ifdef TERRAIN3D34uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;35#endif36const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {37#ifdef TERRAIN3D38highp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));39#else40return 1.0;41#endif42}float calculate_visibility(vec4 pos) {43#ifdef TERRAIN3D44vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;45#else46return 1.0;47#endif48}float ele(vec2 pos) {49#ifdef TERRAIN3D50vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;51#else52return 0.0;53#endif54}float get_elevation(vec2 pos) {55#ifdef TERRAIN3D56vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;57#else58return 0.0;59#endif60}`),background:tt(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;61#ifdef OVERDRAW_INSPECTOR62gl_FragColor=vec4(1.0);63#endif64}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:tt(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;65#ifdef OVERDRAW_INSPECTOR66gl_FragColor=vec4(1.0);67#endif68}`,"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:tt(`varying vec3 v_data;varying float v_visibility;69#pragma mapbox: define highp vec4 color70#pragma mapbox: define mediump float radius71#pragma mapbox: define lowp float blur72#pragma mapbox: define lowp float opacity73#pragma mapbox: define highp vec4 stroke_color74#pragma mapbox: define mediump float stroke_width75#pragma mapbox: define lowp float stroke_opacity76void main() {77#pragma mapbox: initialize highp vec4 color78#pragma mapbox: initialize mediump float radius79#pragma mapbox: initialize lowp float blur80#pragma mapbox: initialize lowp float opacity81#pragma mapbox: initialize highp vec4 stroke_color82#pragma mapbox: initialize mediump float stroke_width83#pragma mapbox: initialize lowp float stroke_opacity84vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);85#ifdef OVERDRAW_INSPECTOR86gl_FragColor=vec4(1.0);87#endif88}`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;89#pragma mapbox: define highp vec4 color90#pragma mapbox: define mediump float radius91#pragma mapbox: define lowp float blur92#pragma mapbox: define lowp float opacity93#pragma mapbox: define highp vec4 stroke_color94#pragma mapbox: define mediump float stroke_width95#pragma mapbox: define lowp float stroke_opacity96void main(void) {97#pragma mapbox: initialize highp vec4 color98#pragma mapbox: initialize mediump float radius99#pragma mapbox: initialize lowp float blur100#pragma mapbox: initialize lowp float opacity101#pragma mapbox: initialize highp vec4 stroke_color102#pragma mapbox: initialize mediump float stroke_width103#pragma mapbox: initialize lowp float stroke_opacity104vec2 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;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:tt("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:tt(`uniform highp float u_intensity;varying vec2 v_extrude;105#pragma mapbox: define highp float weight106#define GAUSS_COEF 0.3989422804014327107void main() {108#pragma mapbox: initialize highp float weight109float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);110#ifdef OVERDRAW_INSPECTOR111gl_FragColor=vec4(1.0);112#endif113}`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;114#pragma mapbox: define highp float weight115#pragma mapbox: define mediump float radius116const highp float ZERO=1.0/255.0/16.0;117#define GAUSS_COEF 0.3989422804014327118void main(void) {119#pragma mapbox: initialize highp float weight120#pragma mapbox: initialize mediump float radius121vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,get_elevation(floor(a_pos*0.5)),1);gl_Position=u_matrix*pos;}`),heatmapTexture:tt(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;122#ifdef OVERDRAW_INSPECTOR123gl_FragColor=vec4(0.0);124#endif125}`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:tt("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_anchor_pos;attribute vec2 a_placed;attribute vec2 a_box_real;uniform mat4 u_matrix;uniform vec2 u_pixel_extrude_scale;varying float v_placed;varying float v_notUsed;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:tt("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:tt("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:tt(`#pragma mapbox: define highp vec4 color126#pragma mapbox: define lowp float opacity127void main() {128#pragma mapbox: initialize highp vec4 color129#pragma mapbox: initialize lowp float opacity130gl_FragColor=color*opacity;131#ifdef OVERDRAW_INSPECTOR132gl_FragColor=vec4(1.0);133#endif134}`,`attribute vec2 a_pos;uniform mat4 u_matrix;135#pragma mapbox: define highp vec4 color136#pragma mapbox: define lowp float opacity137void main() {138#pragma mapbox: initialize highp vec4 color139#pragma mapbox: initialize lowp float opacity140gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:tt(`varying vec2 v_pos;141#pragma mapbox: define highp vec4 outline_color142#pragma mapbox: define lowp float opacity143void main() {144#pragma mapbox: initialize highp vec4 outline_color145#pragma mapbox: initialize lowp float opacity146float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);147#ifdef OVERDRAW_INSPECTOR148gl_FragColor=vec4(1.0);149#endif150}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;151#pragma mapbox: define highp vec4 outline_color152#pragma mapbox: define lowp float opacity153void main() {154#pragma mapbox: initialize highp vec4 outline_color155#pragma mapbox: initialize lowp float opacity156gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:tt(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;157#pragma mapbox: define lowp float opacity158#pragma mapbox: define lowp vec4 pattern_from159#pragma mapbox: define lowp vec4 pattern_to160void main() {161#pragma mapbox: initialize lowp float opacity162#pragma mapbox: initialize mediump vec4 pattern_from163#pragma mapbox: initialize mediump vec4 pattern_to164vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;165#ifdef OVERDRAW_INSPECTOR166gl_FragColor=vec4(1.0);167#endif168}`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;169#pragma mapbox: define lowp float opacity170#pragma mapbox: define lowp vec4 pattern_from171#pragma mapbox: define lowp vec4 pattern_to172#pragma mapbox: define lowp float pixel_ratio_from173#pragma mapbox: define lowp float pixel_ratio_to174void main() {175#pragma mapbox: initialize lowp float opacity176#pragma mapbox: initialize mediump vec4 pattern_from177#pragma mapbox: initialize mediump vec4 pattern_to178#pragma mapbox: initialize lowp float pixel_ratio_from179#pragma mapbox: initialize lowp float pixel_ratio_to180vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:tt(`#ifdef GL_ES181precision highp float;182#endif183uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;184#pragma mapbox: define lowp float opacity185#pragma mapbox: define lowp vec4 pattern_from186#pragma mapbox: define lowp vec4 pattern_to187void main() {188#pragma mapbox: initialize lowp float opacity189#pragma mapbox: initialize mediump vec4 pattern_from190#pragma mapbox: initialize mediump vec4 pattern_to191vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;192#ifdef OVERDRAW_INSPECTOR193gl_FragColor=vec4(1.0);194#endif195}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;196#pragma mapbox: define lowp float opacity197#pragma mapbox: define lowp vec4 pattern_from198#pragma mapbox: define lowp vec4 pattern_to199#pragma mapbox: define lowp float pixel_ratio_from200#pragma mapbox: define lowp float pixel_ratio_to201void main() {202#pragma mapbox: initialize lowp float opacity203#pragma mapbox: initialize mediump vec4 pattern_from204#pragma mapbox: initialize mediump vec4 pattern_to205#pragma mapbox: initialize lowp float pixel_ratio_from206#pragma mapbox: initialize lowp float pixel_ratio_to207vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:tt(`varying vec4 v_color;void main() {gl_FragColor=v_color;208#ifdef OVERDRAW_INSPECTOR209gl_FragColor=vec4(1.0);210#endif211}`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;212#ifdef TERRAIN3D213attribute vec2 a_centroid;214#endif215varying vec4 v_color;216#pragma mapbox: define highp float base217#pragma mapbox: define highp float height218#pragma mapbox: define highp vec4 color219void main() {220#pragma mapbox: initialize highp float base221#pragma mapbox: initialize highp float height222#pragma mapbox: initialize highp vec4 color223vec3 normal=a_normal_ed.xyz;224#ifdef TERRAIN3D225float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);226#else227float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;228#endif229base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:tt(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;230#pragma mapbox: define lowp float base231#pragma mapbox: define lowp float height232#pragma mapbox: define lowp vec4 pattern_from233#pragma mapbox: define lowp vec4 pattern_to234#pragma mapbox: define lowp float pixel_ratio_from235#pragma mapbox: define lowp float pixel_ratio_to236void main() {237#pragma mapbox: initialize lowp float base238#pragma mapbox: initialize lowp float height239#pragma mapbox: initialize mediump vec4 pattern_from240#pragma mapbox: initialize mediump vec4 pattern_to241#pragma mapbox: initialize lowp float pixel_ratio_from242#pragma mapbox: initialize lowp float pixel_ratio_to243vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;244#ifdef OVERDRAW_INSPECTOR245gl_FragColor=vec4(1.0);246#endif247}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;248#ifdef TERRAIN3D249attribute vec2 a_centroid;250#endif251varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;252#pragma mapbox: define lowp float base253#pragma mapbox: define lowp float height254#pragma mapbox: define lowp vec4 pattern_from255#pragma mapbox: define lowp vec4 pattern_to256#pragma mapbox: define lowp float pixel_ratio_from257#pragma mapbox: define lowp float pixel_ratio_to258void main() {259#pragma mapbox: initialize lowp float base260#pragma mapbox: initialize lowp float height261#pragma mapbox: initialize mediump vec4 pattern_from262#pragma mapbox: initialize mediump vec4 pattern_to263#pragma mapbox: initialize lowp float pixel_ratio_from264#pragma mapbox: initialize lowp float pixel_ratio_to265vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;266#ifdef TERRAIN3D267float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);268#else269float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;270#endif271base=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.0272? a_pos273: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:tt(`#ifdef GL_ES274precision highp float;275#endif276uniform 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#ifdef OVERDRAW_INSPECTOR278gl_FragColor=vec4(1.0);279#endif280}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:tt(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;281#define PI 3.141592653589793282void 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#ifdef OVERDRAW_INSPECTOR284gl_FragColor=vec4(1.0);285#endif286}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:tt(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;287#pragma mapbox: define highp vec4 color288#pragma mapbox: define lowp float blur289#pragma mapbox: define lowp float opacity290void main() {291#pragma mapbox: initialize highp vec4 color292#pragma mapbox: initialize lowp float blur293#pragma mapbox: initialize lowp float opacity294float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);295#ifdef OVERDRAW_INSPECTOR296gl_FragColor=vec4(1.0);297#endif298}`,`299#define scale 0.015873016300attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;301#pragma mapbox: define highp vec4 color302#pragma mapbox: define lowp float blur303#pragma mapbox: define lowp float opacity304#pragma mapbox: define mediump float gapwidth305#pragma mapbox: define lowp float offset306#pragma mapbox: define mediump float width307void main() {308#pragma mapbox: initialize highp vec4 color309#pragma mapbox: initialize lowp float blur310#pragma mapbox: initialize lowp float opacity311#pragma mapbox: initialize mediump float gapwidth312#pragma mapbox: initialize lowp float offset313#pragma mapbox: initialize mediump float width314float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;315#ifdef TERRAIN3D316v_gamma_scale=1.0;317#else318float 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#endif320v_width2=vec2(outset,inset);}`),lineGradient:tt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;321#pragma mapbox: define lowp float blur322#pragma mapbox: define lowp float opacity323void main() {324#pragma mapbox: initialize lowp float blur325#pragma mapbox: initialize lowp float opacity326float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);327#ifdef OVERDRAW_INSPECTOR328gl_FragColor=vec4(1.0);329#endif330}`,`331#define scale 0.015873016332attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;333#pragma mapbox: define lowp float blur334#pragma mapbox: define lowp float opacity335#pragma mapbox: define mediump float gapwidth336#pragma mapbox: define lowp float offset337#pragma mapbox: define mediump float width338void main() {339#pragma mapbox: initialize lowp float blur340#pragma mapbox: initialize lowp float opacity341#pragma mapbox: initialize mediump float gapwidth342#pragma mapbox: initialize lowp float offset343#pragma mapbox: initialize mediump float width344float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;345#ifdef TERRAIN3D346v_gamma_scale=1.0;347#else348float 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#endif350v_width2=vec2(outset,inset);}`),linePattern:tt(`#ifdef GL_ES351precision highp float;352#endif353uniform 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;354#pragma mapbox: define lowp vec4 pattern_from355#pragma mapbox: define lowp vec4 pattern_to356#pragma mapbox: define lowp float pixel_ratio_from357#pragma mapbox: define lowp float pixel_ratio_to358#pragma mapbox: define lowp float blur359#pragma mapbox: define lowp float opacity360void main() {361#pragma mapbox: initialize mediump vec4 pattern_from362#pragma mapbox: initialize mediump vec4 pattern_to363#pragma mapbox: initialize lowp float pixel_ratio_from364#pragma mapbox: initialize lowp float pixel_ratio_to365#pragma mapbox: initialize lowp float blur366#pragma mapbox: initialize lowp float opacity367vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;368#ifdef OVERDRAW_INSPECTOR369gl_FragColor=vec4(1.0);370#endif371}`,`372#define scale 0.015873016373#define LINE_DISTANCE_SCALE 2.0374attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;375#pragma mapbox: define lowp float blur376#pragma mapbox: define lowp float opacity377#pragma mapbox: define lowp float offset378#pragma mapbox: define mediump float gapwidth379#pragma mapbox: define mediump float width380#pragma mapbox: define lowp float floorwidth381#pragma mapbox: define lowp vec4 pattern_from382#pragma mapbox: define lowp vec4 pattern_to383#pragma mapbox: define lowp float pixel_ratio_from384#pragma mapbox: define lowp float pixel_ratio_to385void main() {386#pragma mapbox: initialize lowp float blur387#pragma mapbox: initialize lowp float opacity388#pragma mapbox: initialize lowp float offset389#pragma mapbox: initialize mediump float gapwidth390#pragma mapbox: initialize mediump float width391#pragma mapbox: initialize lowp float floorwidth392#pragma mapbox: initialize mediump vec4 pattern_from393#pragma mapbox: initialize mediump vec4 pattern_to394#pragma mapbox: initialize lowp float pixel_ratio_from395#pragma mapbox: initialize lowp float pixel_ratio_to396float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;397#ifdef TERRAIN3D398v_gamma_scale=1.0;399#else400float 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#endif402v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:tt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;403#pragma mapbox: define highp vec4 color404#pragma mapbox: define lowp float blur405#pragma mapbox: define lowp float opacity406#pragma mapbox: define mediump float width407#pragma mapbox: define lowp float floorwidth408void main() {409#pragma mapbox: initialize highp vec4 color410#pragma mapbox: initialize lowp float blur411#pragma mapbox: initialize lowp float opacity412#pragma mapbox: initialize mediump float width413#pragma mapbox: initialize lowp float floorwidth414float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);415#ifdef OVERDRAW_INSPECTOR416gl_FragColor=vec4(1.0);417#endif418}`,`419#define scale 0.015873016420#define LINE_DISTANCE_SCALE 2.0421attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;422#pragma mapbox: define highp vec4 color423#pragma mapbox: define lowp float blur424#pragma mapbox: define lowp float opacity425#pragma mapbox: define mediump float gapwidth426#pragma mapbox: define lowp float offset427#pragma mapbox: define mediump float width428#pragma mapbox: define lowp float floorwidth429void main() {430#pragma mapbox: initialize highp vec4 color431#pragma mapbox: initialize lowp float blur432#pragma mapbox: initialize lowp float opacity433#pragma mapbox: initialize mediump float gapwidth434#pragma mapbox: initialize lowp float offset435#pragma mapbox: initialize mediump float width436#pragma mapbox: initialize lowp float floorwidth437float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;438#ifdef TERRAIN3D439v_gamma_scale=1.0;440#else441float 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#endif443v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:tt(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);444#ifdef OVERDRAW_INSPECTOR445gl_FragColor=vec4(1.0);446#endif447}`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:tt(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;448#pragma mapbox: define lowp float opacity449void main() {450#pragma mapbox: initialize lowp float opacity451lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;452#ifdef OVERDRAW_INSPECTOR453gl_FragColor=vec4(1.0);454#endif455}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_tex;varying float v_fade_opacity;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}456#pragma mapbox: define lowp float opacity457void main() {458#pragma mapbox: initialize lowp float opacity459vec2 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 ?460camera_to_anchor_distance/u_camera_to_center_distance :461u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:tt(`#define SDF_PX 8.0462uniform 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#pragma mapbox: define highp vec4 fill_color464#pragma mapbox: define highp vec4 halo_color465#pragma mapbox: define lowp float opacity466#pragma mapbox: define lowp float halo_width467#pragma mapbox: define lowp float halo_blur468void main() {469#pragma mapbox: initialize highp vec4 fill_color470#pragma mapbox: initialize highp vec4 halo_color471#pragma mapbox: initialize lowp float opacity472#pragma mapbox: initialize lowp float halo_width473#pragma mapbox: initialize lowp float halo_blur474float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity);475#ifdef OVERDRAW_INSPECTOR476gl_FragColor=vec4(1.0);477#endif478}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_data0;varying vec3 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}479#pragma mapbox: define highp vec4 fill_color480#pragma mapbox: define highp vec4 halo_color481#pragma mapbox: define lowp float opacity482#pragma mapbox: define lowp float halo_width483#pragma mapbox: define lowp float halo_blur484void main() {485#pragma mapbox: initialize highp vec4 fill_color486#pragma mapbox: initialize highp vec4 halo_color487#pragma mapbox: initialize lowp float opacity488#pragma mapbox: initialize lowp float halo_width489#pragma mapbox: initialize lowp float halo_blur490vec2 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 ?491camera_to_anchor_distance/u_camera_to_center_distance :492u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:tt(`#define SDF_PX 8.0493#define SDF 1.0494#define ICON 0.0495uniform 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;496#pragma mapbox: define highp vec4 fill_color497#pragma mapbox: define highp vec4 halo_color498#pragma mapbox: define lowp float opacity499#pragma mapbox: define lowp float halo_width500#pragma mapbox: define lowp float halo_blur501void main() {502#pragma mapbox: initialize highp vec4 fill_color503#pragma mapbox: initialize highp vec4 halo_color504#pragma mapbox: initialize lowp float opacity505#pragma mapbox: initialize lowp float halo_width506#pragma mapbox: initialize lowp float halo_blur507float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;508#ifdef OVERDRAW_INSPECTOR509gl_FragColor=vec4(1.0);510#endif511return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);512#ifdef OVERDRAW_INSPECTOR513gl_FragColor=vec4(1.0);514#endif515}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec4 v_data0;varying vec4 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}516#pragma mapbox: define highp vec4 fill_color517#pragma mapbox: define highp vec4 halo_color518#pragma mapbox: define lowp float opacity519#pragma mapbox: define lowp float halo_width520#pragma mapbox: define lowp float halo_blur521void main() {522#pragma mapbox: initialize highp vec4 fill_color523#pragma mapbox: initialize highp vec4 halo_color524#pragma mapbox: initialize lowp float opacity525#pragma mapbox: initialize lowp float halo_width526#pragma mapbox: initialize lowp float halo_blur527vec2 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 ?528camera_to_anchor_distance/u_camera_to_center_distance :529u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:tt("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;varying vec2 v_texture_pos;varying float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture2D(u_texture,v_texture_pos);if (v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);gl_FragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {gl_FragColor=surface_color;}}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform mat4 u_fog_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:tt("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:tt("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);}"),sky:tt("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform float u_horizon;uniform float u_sky_horizon_blend;void main() {float y=gl_FragCoord.y;if (y > u_horizon) {float blend=y-u_horizon;if (blend < u_sky_horizon_blend) {gl_FragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {gl_FragColor=u_sky_color;}}}","attribute vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function tt(u,e){const s=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,a=e.match(/attribute ([\w]+) ([\w]+)/g),o=u.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),c=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),m=c?c.concat(o):o,_={};return{fragmentSource:u=u.replace(s,(y,b,T,S,z)=>(_[z]=!0,b==="define"?`530#ifndef HAS_UNIFORM_u_${z}531varying ${T} ${S} ${z};532#else533uniform ${T} ${S} u_${z};534#endif535`:`536#ifdef HAS_UNIFORM_u_${z}537 ${T} ${S} ${z} = u_${z};538#endif539`)),vertexSource:e=e.replace(s,(y,b,T,S,z)=>{const D=S==="float"?"vec2":"vec4",R=z.match(/color/)?"color":D;return _[z]?b==="define"?`540#ifndef HAS_UNIFORM_u_${z}541uniform lowp float u_${z}_t;542attribute ${T} ${D} a_${z};543varying ${T} ${S} ${z};544#else545uniform ${T} ${S} u_${z};546#endif547`:R==="vec4"?`548#ifndef HAS_UNIFORM_u_${z}549 ${z} = a_${z};550#else551 ${T} ${S} ${z} = u_${z};552#endif553`:`554#ifndef HAS_UNIFORM_u_${z}555 ${z} = unpack_mix_${R}(a_${z}, u_${z}_t);556#else557 ${T} ${S} ${z} = u_${z};558#endif559`:b==="define"?`560#ifndef HAS_UNIFORM_u_${z}561uniform lowp float u_${z}_t;562attribute ${T} ${D} a_${z};563#else564uniform ${T} ${S} u_${z};565#endif566`:R==="vec4"?`567#ifndef HAS_UNIFORM_u_${z}568 ${T} ${S} ${z} = a_${z};569#else570 ${T} ${S} ${z} = u_${z};571#endif572`:`573#ifndef HAS_UNIFORM_u_${z}574 ${T} ${S} ${z} = unpack_mix_${R}(a_${z}, u_${z}_t);575#else576 ${T} ${S} ${z} = u_${z};577#endif578`}),staticAttributes:a,staticUniforms:m}}class Ra{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,s,a,o,c,m,_,y,b){this.context=e;let T=this.boundPaintVertexBuffers.length!==o.length;for(let S=0;!T&&S<o.length;S++)this.boundPaintVertexBuffers[S]!==o[S]&&(T=!0);!this.vao||this.boundProgram!==s||this.boundLayoutVertexBuffer!==a||T||this.boundIndexBuffer!==c||this.boundVertexOffset!==m||this.boundDynamicVertexBuffer!==_||this.boundDynamicVertexBuffer2!==y||this.boundDynamicVertexBuffer3!==b?this.freshBind(s,a,o,c,m,_,y,b):(e.bindVertexArray.set(this.vao),_&&_.bind(),c&&c.dynamicDraw&&c.bind(),y&&y.bind(),b&&b.bind())}freshBind(e,s,a,o,c,m,_,y){const b=e.numAttributes,T=this.context,S=T.gl;this.vao&&this.destroy(),this.vao=T.createVertexArray(),T.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=s,this.boundPaintVertexBuffers=a,this.boundIndexBuffer=o,this.boundVertexOffset=c,this.boundDynamicVertexBuffer=m,this.boundDynamicVertexBuffer2=_,this.boundDynamicVertexBuffer3=y,s.enableAttributes(S,e);for(const z of a)z.enableAttributes(S,e);m&&m.enableAttributes(S,e),_&&_.enableAttributes(S,e),y&&y.enableAttributes(S,e),s.bind(),s.setVertexAttribPointers(S,e,c);for(const z of a)z.bind(),z.setVertexAttribPointers(S,e,c);m&&(m.bind(),m.setVertexAttribPointers(S,e,c)),o&&o.bind(),_&&(_.bind(),_.setVertexAttribPointers(S,e,c)),y&&(y.bind(),y.setVertexAttribPointers(S,e,c)),T.currentNumAttributes=b}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const Ba=(u,e,s,a,o)=>({u_matrix:u,u_texture:0,u_ele_delta:e,u_fog_matrix:s,u_fog_color:a?a.properties.get("fog-color"):p.aM.white,u_fog_ground_blend:a?a.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:a?a.calculateFogBlendOpacity(o):0,u_horizon_color:a?a.properties.get("horizon-color"):p.aM.white,u_horizon_fog_blend:a?a.properties.get("horizon-fog-blend"):1});function ys(u){const e=[];for(let s=0;s<u.length;s++){if(u[s]===null)continue;const a=u[s].split(" ");e.push(a.pop())}return e}class Fa{constructor(e,s,a,o,c,m){const _=e.gl;this.program=_.createProgram();const y=ys(s.staticAttributes),b=a?a.getBinderAttributes():[],T=y.concat(b),S=Lr.prelude.staticUniforms?ys(Lr.prelude.staticUniforms):[],z=s.staticUniforms?ys(s.staticUniforms):[],D=a?a.getBinderUniforms():[],R=S.concat(z).concat(D),V=[];for(const ee of R)V.indexOf(ee)<0&&V.push(ee);const U=a?a.defines():[];c&&U.push("#define OVERDRAW_INSPECTOR;"),m&&U.push("#define TERRAIN3D;");const $=U.concat(Lr.prelude.fragmentSource,s.fragmentSource).join(`579`),Z=U.concat(Lr.prelude.vertexSource,s.vertexSource).join(`580`),B=_.createShader(_.FRAGMENT_SHADER);if(_.isContextLost())return void(this.failedToCreate=!0);if(_.shaderSource(B,$),_.compileShader(B),!_.getShaderParameter(B,_.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${_.getShaderInfoLog(B)}`);_.attachShader(this.program,B);const X=_.createShader(_.VERTEX_SHADER);if(_.isContextLost())return void(this.failedToCreate=!0);if(_.shaderSource(X,Z),_.compileShader(X),!_.getShaderParameter(X,_.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${_.getShaderInfoLog(X)}`);_.attachShader(this.program,X),this.attributes={};const K={};this.numAttributes=T.length;for(let ee=0;ee<this.numAttributes;ee++)T[ee]&&(_.bindAttribLocation(this.program,ee,T[ee]),this.attributes[T[ee]]=ee);if(_.linkProgram(this.program),!_.getProgramParameter(this.program,_.LINK_STATUS))throw new Error(`Program failed to link: ${_.getProgramInfoLog(this.program)}`);_.deleteShader(X),_.deleteShader(B);for(let ee=0;ee<V.length;ee++){const oe=V[ee];if(oe&&!K[oe]){const ue=_.getUniformLocation(this.program,oe);ue&&(K[oe]=ue)}}this.fixedUniforms=o(e,K),this.terrainUniforms=((ee,oe)=>({u_depth:new p.aH(ee,oe.u_depth),u_terrain:new p.aH(ee,oe.u_terrain),u_terrain_dim:new p.aI(ee,oe.u_terrain_dim),u_terrain_matrix:new p.aJ(ee,oe.u_terrain_matrix),u_terrain_unpack:new p.aK(ee,oe.u_terrain_unpack),u_terrain_exaggeration:new p.aI(ee,oe.u_terrain_exaggeration)}))(e,K),this.binderUniforms=a?a.getUniforms(e,K):[]}draw(e,s,a,o,c,m,_,y,b,T,S,z,D,R,V,U,$,Z){const B=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(a),e.setStencilMode(o),e.setColorMode(c),e.setCullFace(m),y){e.activeTexture.set(B.TEXTURE2),B.bindTexture(B.TEXTURE_2D,y.depthTexture),e.activeTexture.set(B.TEXTURE3),B.bindTexture(B.TEXTURE_2D,y.texture);for(const K in this.terrainUniforms)this.terrainUniforms[K].set(y[K])}for(const K in this.fixedUniforms)this.fixedUniforms[K].set(_[K]);V&&V.setUniforms(e,this.binderUniforms,D,{zoom:R});let X=0;switch(s){case B.LINES:X=2;break;case B.TRIANGLES:X=3;break;case B.LINE_STRIP:X=1}for(const K of z.get()){const ee=K.vaos||(K.vaos={});(ee[b]||(ee[b]=new Ra)).bind(e,this,T,V?V.getPaintVertexBuffers():[],S,K.vertexOffset,U,$,Z),B.drawElements(s,K.primitiveLength*X,B.UNSIGNED_SHORT,K.primitiveOffset*X*2)}}}function On(u,e,s){const a=1/Ge(s,1,e.transform.tileZoom),o=Math.pow(2,s.tileID.overscaledZ),c=s.tileSize*Math.pow(2,e.transform.tileZoom)/o,m=c*(s.tileID.canonical.x+s.tileID.wrap*o),_=c*s.tileID.canonical.y;return{u_image:0,u_texsize:s.imageAtlasTexture.size,u_scale:[a,u.fromScale,u.toScale],u_fade:u.t,u_pixel_coord_upper:[m>>16,_>>16],u_pixel_coord_lower:[65535&m,65535&_]}}const an=(u,e,s,a)=>{const o=e.style.light,c=o.properties.get("position"),m=[c.x,c.y,c.z],_=function(){var b=new p.A(9);return p.A!=Float32Array&&(b[1]=0,b[2]=0,b[3]=0,b[5]=0,b[6]=0,b[7]=0),b[0]=1,b[4]=1,b[8]=1,b}();o.properties.get("anchor")==="viewport"&&function(b,T){var S=Math.sin(T),z=Math.cos(T);b[0]=z,b[1]=S,b[2]=0,b[3]=-S,b[4]=z,b[5]=0,b[6]=0,b[7]=0,b[8]=1}(_,-e.transform.angle),function(b,T,S){var z=T[0],D=T[1],R=T[2];b[0]=z*S[0]+D*S[3]+R*S[6],b[1]=z*S[1]+D*S[4]+R*S[7],b[2]=z*S[2]+D*S[5]+R*S[8]}(m,m,_);const y=o.properties.get("color");return{u_matrix:u,u_lightpos:m,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[y.r,y.g,y.b],u_vertical_gradient:+s,u_opacity:a}},Vn=(u,e,s,a,o,c,m)=>p.e(an(u,e,s,a),On(c,e,m),{u_height_factor:-Math.pow(2,o.overscaledZ)/m.tileSize/8}),xs=u=>({u_matrix:u}),jo=(u,e,s,a)=>p.e(xs(u),On(s,e,a)),Zl=(u,e)=>({u_matrix:u,u_world:e}),Uo=(u,e,s,a,o)=>p.e(jo(u,e,s,a),{u_world:o}),Gl=(u,e,s,a)=>{const o=u.transform;let c,m;if(a.paint.get("circle-pitch-alignment")==="map"){const _=Ge(s,1,o.zoom);c=!0,m=[_,_]}else c=!1,m=o.pixelsToGLUnits;return{u_camera_to_center_distance:o.cameraToCenterDistance,u_scale_with_map:+(a.paint.get("circle-pitch-scale")==="map"),u_matrix:u.translatePosMatrix(e.posMatrix,s,a.paint.get("circle-translate"),a.paint.get("circle-translate-anchor")),u_pitch_with_map:+c,u_device_pixel_ratio:u.pixelRatio,u_extrude_scale:m}},Wr=(u,e,s)=>({u_matrix:u,u_inv_matrix:e,u_camera_to_center_distance:s.cameraToCenterDistance,u_viewport_size:[s.width,s.height]}),on=(u,e,s=1)=>({u_matrix:u,u_color:e,u_overlay:0,u_overlay_scale:s}),oi=u=>({u_matrix:u}),li=(u,e,s,a)=>({u_matrix:u,u_extrude_scale:Ge(e,1,s),u_intensity:a}),Nn=(u,e,s,a)=>{const o=p.H();p.aP(o,0,u.width,u.height,0,0,1);const c=u.context.gl;return{u_matrix:o,u_world:[c.drawingBufferWidth,c.drawingBufferHeight],u_image:s,u_color_ramp:a,u_opacity:e.paint.get("heatmap-opacity")}};function jn(u,e){const s=Math.pow(2,e.canonical.z),a=e.canonical.y;return[new p.Z(0,a/s).toLngLat().lat,new p.Z(0,(a+1)/s).toLngLat().lat]}const Un=(u,e,s,a)=>{const o=u.transform;return{u_matrix:Zo(u,e,s,a),u_ratio:1/Ge(e,1,o.zoom),u_device_pixel_ratio:u.pixelRatio,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},$o=(u,e,s,a,o)=>p.e(Un(u,e,s,o),{u_image:0,u_image_height:a}),vs=(u,e,s,a,o)=>{const c=u.transform,m=qo(e,c);return{u_matrix:Zo(u,e,s,o),u_texsize:e.imageAtlasTexture.size,u_ratio:1/Ge(e,1,c.zoom),u_device_pixel_ratio:u.pixelRatio,u_image:0,u_scale:[m,a.fromScale,a.toScale],u_fade:a.t,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]]}},Hl=(u,e,s,a,o,c)=>{const m=u.lineAtlas,_=qo(e,u.transform),y=s.layout.get("line-cap")==="round",b=m.getDash(a.from,y),T=m.getDash(a.to,y),S=b.width*o.fromScale,z=T.width*o.toScale;return p.e(Un(u,e,s,c),{u_patternscale_a:[_/S,-b.height/2],u_patternscale_b:[_/z,-T.height/2],u_sdfgamma:m.width/(256*Math.min(S,z)*u.pixelRatio)/2,u_image:0,u_tex_y_a:b.y,u_tex_y_b:T.y,u_mix:o.t})};function qo(u,e){return 1/Ge(u,1,e.tileZoom)}function Zo(u,e,s,a){return u.translatePosMatrix(a?a.posMatrix:e.tileID.posMatrix,e,s.paint.get("line-translate"),s.paint.get("line-translate-anchor"))}const Xl=(u,e,s,a,o)=>{return{u_matrix:u,u_tl_parent:e,u_scale_parent:s,u_buffer_scale:1,u_fade_t:a.mix,u_opacity:a.opacity*o.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:o.paint.get("raster-brightness-min"),u_brightness_high:o.paint.get("raster-brightness-max"),u_saturation_factor:(m=o.paint.get("raster-saturation"),m>0?1-1/(1.001-m):-m),u_contrast_factor:(c=o.paint.get("raster-contrast"),c>0?1/(1-c):1+c),u_spin_weights:Wl(o.paint.get("raster-hue-rotate"))};var c,m};function Wl(u){u*=Math.PI/180;const e=Math.sin(u),s=Math.cos(u);return[(2*s+1)/3,(-Math.sqrt(3)*e-s+1)/3,(Math.sqrt(3)*e-s+1)/3]}const Go=(u,e,s,a,o,c,m,_,y,b,T,S,z,D)=>{const R=m.transform;return{u_is_size_zoom_constant:+(u==="constant"||u==="source"),u_is_size_feature_constant:+(u==="constant"||u==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:R.cameraToCenterDistance,u_pitch:R.pitch/360*2*Math.PI,u_rotate_symbol:+s,u_aspect_ratio:R.width/R.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_matrix:_,u_label_plane_matrix:y,u_coord_matrix:b,u_is_text:+S,u_pitch_with_map:+a,u_is_along_line:o,u_is_variable_anchor:c,u_texsize:z,u_texture:0,u_translation:T,u_pitched_scale:D}},ln=(u,e,s,a,o,c,m,_,y,b,T,S,z,D,R)=>{const V=m.transform;return p.e(Go(u,e,s,a,o,c,m,_,y,b,T,S,z,R),{u_gamma_scale:a?Math.cos(V._pitch)*V.cameraToCenterDistance:1,u_device_pixel_ratio:m.pixelRatio,u_is_halo:1})},Oa=(u,e,s,a,o,c,m,_,y,b,T,S,z,D)=>p.e(ln(u,e,s,a,o,c,m,_,y,b,T,!0,S,!0,D),{u_texsize_icon:z,u_texture_icon:1}),$n=(u,e,s)=>({u_matrix:u,u_opacity:e,u_color:s}),Va=(u,e,s,a,o,c)=>p.e(function(m,_,y,b){const T=y.imageManager.getPattern(m.from.toString()),S=y.imageManager.getPattern(m.to.toString()),{width:z,height:D}=y.imageManager.getPixelSize(),R=Math.pow(2,b.tileID.overscaledZ),V=b.tileSize*Math.pow(2,y.transform.tileZoom)/R,U=V*(b.tileID.canonical.x+b.tileID.wrap*R),$=V*b.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:T.tl,u_pattern_br_a:T.br,u_pattern_tl_b:S.tl,u_pattern_br_b:S.br,u_texsize:[z,D],u_mix:_.t,u_pattern_size_a:T.displaySize,u_pattern_size_b:S.displaySize,u_scale_a:_.fromScale,u_scale_b:_.toScale,u_tile_units_to_pixels:1/Ge(b,1,y.transform.tileZoom),u_pixel_coord_upper:[U>>16,$>>16],u_pixel_coord_lower:[65535&U,65535&$]}}(a,c,s,o),{u_matrix:u,u_opacity:e}),Na={fillExtrusion:(u,e)=>({u_matrix:new p.aJ(u,e.u_matrix),u_lightpos:new p.aN(u,e.u_lightpos),u_lightintensity:new p.aI(u,e.u_lightintensity),u_lightcolor:new p.aN(u,e.u_lightcolor),u_vertical_gradient:new p.aI(u,e.u_vertical_gradient),u_opacity:new p.aI(u,e.u_opacity)}),fillExtrusionPattern:(u,e)=>({u_matrix:new p.aJ(u,e.u_matrix),u_lightpos:new p.aN(u,e.u_lightpos),u_lightintensity:new p.aI(u,e.u_lightintensity),u_lightcolor:new p.aN(u,e.u_lightcolor),u_vertical_gradient:new p.aI(u,e.u_vertical_gradient),u_height_factor:new p.aI(u,e.u_height_factor),u_image:new p.aH(u,e.u_image),u_texsize:new p.aO(u,e.u_texsize),u_pixel_coord_upper:new p.aO(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new p.aO(u,e.u_pixel_coord_lower),u_scale:new p.aN(u,e.u_scale),u_fade:new p.aI(u,e.u_fade),u_opacity:new p.aI(u,e.u_opacity)}),fill:(u,e)=>({u_matrix:new p.aJ(u,e.u_matrix)}),fillPattern:(u,e)=>({u_matrix:new p.aJ(u,e.u_matrix),u_image:new p.aH(u,e.u_image),u_texsize:new p.aO(u,e.u_texsize),u_pixel_coord_upper:new p.aO(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new p.aO(u,e.u_pixel_coord_lower),u_scale:new p.aN(u,e.u_scale),u_fade:new p.aI(u,e.u_fade)}),fillOutline:(u,e)=>({u_matrix:new p.aJ(u,e.u_matrix),u_world:new p.aO(u,e.u_world)}),fillOutlinePattern:(u,e)=>({u_matrix:new p.aJ(u,e.u_matrix),u_world:new p.aO(u,e.u_world),u_image:new p.aH(u,e.u_image),u_texsize:new p.aO(u,e.u_texsize),u_pixel_coord_upper:new p.aO(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new p.aO(u,e.u_pixel_coord_lower),u_scale:new p.aN(u,e.u_scale),u_fade:new p.aI(u,e.u_fade)}),circle:(u,e)=>({u_camera_to_center_distance:new p.aI(u,e.u_camera_to_center_distance),u_scale_with_map:new p.aH(u,e.u_scale_with_map),u_pitch_with_map:new p.aH(u,e.u_pitch_with_map),u_extrude_scale:new p.aO(u,e.u_extrude_scale),u_device_pixel_ratio:new p.aI(u,e.u_device_pixel_ratio),u_matrix:new p.aJ(u,e.u_matrix)}),collisionBox:(u,e)=>({u_matrix:new p.aJ(u,e.u_matrix),u_pixel_extrude_scale:new p.aO(u,e.u_pixel_extrude_scale)}),collisionCircle:(u,e)=>({u_matrix:new p.aJ(u,e.u_matrix),u_inv_matrix:new p.aJ(u,e.u_inv_matrix),u_camera_to_center_distance:new p.aI(u,e.u_camera_to_center_distance),u_viewport_size:new p.aO(u,e.u_viewport_size)}),debug:(u,e)=>({u_color:new p.aL(u,e.u_color),u_matrix:new p.aJ(u,e.u_matrix),u_overlay:new p.aH(u,e.u_overlay),u_overlay_scale:new p.aI(u,e.u_overlay_scale)}),clippingMask:(u,e)=>({u_matrix:new p.aJ(u,e.u_matrix)}),heatmap:(u,e)=>({u_extrude_scale:new p.aI(u,e.u_extrude_scale),u_intensity:new p.aI(u,e.u_intensity),u_matrix:new p.aJ(u,e.u_matrix)}),heatmapTexture:(u,e)=>({u_matrix:new p.aJ(u,e.u_matrix),u_world:new p.aO(u,e.u_world),u_image:new p.aH(u,e.u_image),u_color_ramp:new p.aH(u,e.u_color_ramp),u_opacity:new p.aI(u,e.u_opacity)}),hillshade:(u,e)=>({u_matrix:new p.aJ(u,e.u_matrix),u_image:new p.aH(u,e.u_image),u_latrange:new p.aO(u,e.u_latrange),u_light:new p.aO(u,e.u_light),u_shadow:new p.aL(u,e.u_shadow),u_highlight:new p.aL(u,e.u_highlight),u_accent:new p.aL(u,e.u_accent)}),hillshadePrepare:(u,e)=>({u_matrix:new p.aJ(u,e.u_matrix),u_image:new p.aH(u,e.u_image),u_dimension:new p.aO(u,e.u_dimension),u_zoom:new p.aI(u,e.u_zoom),u_unpack:new p.aK(u,e.u_unpack)}),line:(u,e)=>({u_matrix:new p.aJ(u,e.u_matrix),u_ratio:new p.aI(u,e.u_ratio),u_device_pixel_ratio:new p.aI(u,e.u_device_pixel_ratio),u_units_to_pixels:new p.aO(u,e.u_units_to_pixels)}),lineGradient:(u,e)=>({u_matrix:new p.aJ(u,e.u_matrix),u_ratio:new p.aI(u,e.u_ratio),u_device_pixel_ratio:new p.aI(u,e.u_device_pixel_ratio),u_units_to_pixels:new p.aO(u,e.u_units_to_pixels),u_image:new p.aH(u,e.u_image),u_image_height:new p.aI(u,e.u_image_height)}),linePattern:(u,e)=>({u_matrix:new p.aJ(u,e.u_matrix),u_texsize:new p.aO(u,e.u_texsize),u_ratio:new p.aI(u,e.u_ratio),u_device_pixel_ratio:new p.aI(u,e.u_device_pixel_ratio),u_image:new p.aH(u,e.u_image),u_units_to_pixels:new p.aO(u,e.u_units_to_pixels),u_scale:new p.aN(u,e.u_scale),u_fade:new p.aI(u,e.u_fade)}),lineSDF:(u,e)=>({u_matrix:new p.aJ(u,e.u_matrix),u_ratio:new p.aI(u,e.u_ratio),u_device_pixel_ratio:new p.aI(u,e.u_device_pixel_ratio),u_units_to_pixels:new p.aO(u,e.u_units_to_pixels),u_patternscale_a:new p.aO(u,e.u_patternscale_a),u_patternscale_b:new p.aO(u,e.u_patternscale_b),u_sdfgamma:new p.aI(u,e.u_sdfgamma),u_image:new p.aH(u,e.u_image),u_tex_y_a:new p.aI(u,e.u_tex_y_a),u_tex_y_b:new p.aI(u,e.u_tex_y_b),u_mix:new p.aI(u,e.u_mix)}),raster:(u,e)=>({u_matrix:new p.aJ(u,e.u_matrix),u_tl_parent:new p.aO(u,e.u_tl_parent),u_scale_parent:new p.aI(u,e.u_scale_parent),u_buffer_scale:new p.aI(u,e.u_buffer_scale),u_fade_t:new p.aI(u,e.u_fade_t),u_opacity:new p.aI(u,e.u_opacity),u_image0:new p.aH(u,e.u_image0),u_image1:new p.aH(u,e.u_image1),u_brightness_low:new p.aI(u,e.u_brightness_low),u_brightness_high:new p.aI(u,e.u_brightness_high),u_saturation_factor:new p.aI(u,e.u_saturation_factor),u_contrast_factor:new p.aI(u,e.u_contrast_factor),u_spin_weights:new p.aN(u,e.u_spin_weights)}),symbolIcon:(u,e)=>({u_is_size_zoom_constant:new p.aH(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new p.aH(u,e.u_is_size_feature_constant),u_size_t:new p.aI(u,e.u_size_t),u_size:new p.aI(u,e.u_size),u_camera_to_center_distance:new p.aI(u,e.u_camera_to_center_distance),u_pitch:new p.aI(u,e.u_pitch),u_rotate_symbol:new p.aH(u,e.u_rotate_symbol),u_aspect_ratio:new p.aI(u,e.u_aspect_ratio),u_fade_change:new p.aI(u,e.u_fade_change),u_matrix:new p.aJ(u,e.u_matrix),u_label_plane_matrix:new p.aJ(u,e.u_label_plane_matrix),u_coord_matrix:new p.aJ(u,e.u_coord_matrix),u_is_text:new p.aH(u,e.u_is_text),u_pitch_with_map:new p.aH(u,e.u_pitch_with_map),u_is_along_line:new p.aH(u,e.u_is_along_line),u_is_variable_anchor:new p.aH(u,e.u_is_variable_anchor),u_texsize:new p.aO(u,e.u_texsize),u_texture:new p.aH(u,e.u_texture),u_translation:new p.aO(u,e.u_translation),u_pitched_scale:new p.aI(u,e.u_pitched_scale)}),symbolSDF:(u,e)=>({u_is_size_zoom_constant:new p.aH(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new p.aH(u,e.u_is_size_feature_constant),u_size_t:new p.aI(u,e.u_size_t),u_size:new p.aI(u,e.u_size),u_camera_to_center_distance:new p.aI(u,e.u_camera_to_center_distance),u_pitch:new p.aI(u,e.u_pitch),u_rotate_symbol:new p.aH(u,e.u_rotate_symbol),u_aspect_ratio:new p.aI(u,e.u_aspect_ratio),u_fade_change:new p.aI(u,e.u_fade_change),u_matrix:new p.aJ(u,e.u_matrix),u_label_plane_matrix:new p.aJ(u,e.u_label_plane_matrix),u_coord_matrix:new p.aJ(u,e.u_coord_matrix),u_is_text:new p.aH(u,e.u_is_text),u_pitch_with_map:new p.aH(u,e.u_pitch_with_map),u_is_along_line:new p.aH(u,e.u_is_along_line),u_is_variable_anchor:new p.aH(u,e.u_is_variable_anchor),u_texsize:new p.aO(u,e.u_texsize),u_texture:new p.aH(u,e.u_texture),u_gamma_scale:new p.aI(u,e.u_gamma_scale),u_device_pixel_ratio:new p.aI(u,e.u_device_pixel_ratio),u_is_halo:new p.aH(u,e.u_is_halo),u_translation:new p.aO(u,e.u_translation),u_pitched_scale:new p.aI(u,e.u_pitched_scale)}),symbolTextAndIcon:(u,e)=>({u_is_size_zoom_constant:new p.aH(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new p.aH(u,e.u_is_size_feature_constant),u_size_t:new p.aI(u,e.u_size_t),u_size:new p.aI(u,e.u_size),u_camera_to_center_distance:new p.aI(u,e.u_camera_to_center_distance),u_pitch:new p.aI(u,e.u_pitch),u_rotate_symbol:new p.aH(u,e.u_rotate_symbol),u_aspect_ratio:new p.aI(u,e.u_aspect_ratio),u_fade_change:new p.aI(u,e.u_fade_change),u_matrix:new p.aJ(u,e.u_matrix),u_label_plane_matrix:new p.aJ(u,e.u_label_plane_matrix),u_coord_matrix:new p.aJ(u,e.u_coord_matrix),u_is_text:new p.aH(u,e.u_is_text),u_pitch_with_map:new p.aH(u,e.u_pitch_with_map),u_is_along_line:new p.aH(u,e.u_is_along_line),u_is_variable_anchor:new p.aH(u,e.u_is_variable_anchor),u_texsize:new p.aO(u,e.u_texsize),u_texsize_icon:new p.aO(u,e.u_texsize_icon),u_texture:new p.aH(u,e.u_texture),u_texture_icon:new p.aH(u,e.u_texture_icon),u_gamma_scale:new p.aI(u,e.u_gamma_scale),u_device_pixel_ratio:new p.aI(u,e.u_device_pixel_ratio),u_is_halo:new p.aH(u,e.u_is_halo),u_translation:new p.aO(u,e.u_translation),u_pitched_scale:new p.aI(u,e.u_pitched_scale)}),background:(u,e)=>({u_matrix:new p.aJ(u,e.u_matrix),u_opacity:new p.aI(u,e.u_opacity),u_color:new p.aL(u,e.u_color)}),backgroundPattern:(u,e)=>({u_matrix:new p.aJ(u,e.u_matrix),u_opacity:new p.aI(u,e.u_opacity),u_image:new p.aH(u,e.u_image),u_pattern_tl_a:new p.aO(u,e.u_pattern_tl_a),u_pattern_br_a:new p.aO(u,e.u_pattern_br_a),u_pattern_tl_b:new p.aO(u,e.u_pattern_tl_b),u_pattern_br_b:new p.aO(u,e.u_pattern_br_b),u_texsize:new p.aO(u,e.u_texsize),u_mix:new p.aI(u,e.u_mix),u_pattern_size_a:new p.aO(u,e.u_pattern_size_a),u_pattern_size_b:new p.aO(u,e.u_pattern_size_b),u_scale_a:new p.aI(u,e.u_scale_a),u_scale_b:new p.aI(u,e.u_scale_b),u_pixel_coord_upper:new p.aO(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new p.aO(u,e.u_pixel_coord_lower),u_tile_units_to_pixels:new p.aI(u,e.u_tile_units_to_pixels)}),terrain:(u,e)=>({u_matrix:new p.aJ(u,e.u_matrix),u_texture:new p.aH(u,e.u_texture),u_ele_delta:new p.aI(u,e.u_ele_delta),u_fog_matrix:new p.aJ(u,e.u_fog_matrix),u_fog_color:new p.aL(u,e.u_fog_color),u_fog_ground_blend:new p.aI(u,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new p.aI(u,e.u_fog_ground_blend_opacity),u_horizon_color:new p.aL(u,e.u_horizon_color),u_horizon_fog_blend:new p.aI(u,e.u_horizon_fog_blend)}),terrainDepth:(u,e)=>({u_matrix:new p.aJ(u,e.u_matrix),u_ele_delta:new p.aI(u,e.u_ele_delta)}),terrainCoords:(u,e)=>({u_matrix:new p.aJ(u,e.u_matrix),u_texture:new p.aH(u,e.u_texture),u_terrain_coords_id:new p.aI(u,e.u_terrain_coords_id),u_ele_delta:new p.aI(u,e.u_ele_delta)}),sky:(u,e)=>({u_sky_color:new p.aL(u,e.u_sky_color),u_horizon_color:new p.aL(u,e.u_horizon_color),u_horizon:new p.aI(u,e.u_horizon),u_sky_horizon_blend:new p.aI(u,e.u_sky_horizon_blend)})};class cr{constructor(e,s,a){this.context=e;const o=e.gl;this.buffer=o.createBuffer(),this.dynamicDraw=!!a,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,s.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||delete s.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){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,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Kl={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class ja{constructor(e,s,a,o){this.length=s.length,this.attributes=a,this.itemSize=s.bytesPerElement,this.dynamicDraw=o,this.context=e;const c=e.gl;this.buffer=c.createBuffer(),e.bindVertexBuffer.set(this.buffer),c.bufferData(c.ARRAY_BUFFER,s.arrayBuffer,this.dynamicDraw?c.DYNAMIC_DRAW:c.STATIC_DRAW),this.dynamicDraw||delete s.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);const s=this.context.gl;this.bind(),s.bufferSubData(s.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,s){for(let a=0;a<this.attributes.length;a++){const o=s.attributes[this.attributes[a].name];o!==void 0&&e.enableVertexAttribArray(o)}}setVertexAttribPointers(e,s,a){for(let o=0;o<this.attributes.length;o++){const c=this.attributes[o],m=s.attributes[c.name];m!==void 0&&e.vertexAttribPointer(m,c.components,e[Kl[c.type]],!1,this.itemSize,c.offset+this.itemSize*(a||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Kr=new WeakMap;function Rr(u){var e;if(Kr.has(u))return Kr.get(u);{const s=(e=u.getParameter(u.VERSION))===null||e===void 0?void 0:e.startsWith("WebGL 2.0");return Kr.set(u,s),s}}class it{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class qn extends it{getDefault(){return p.aM.transparent}set(e){const s=this.current;(e.r!==s.r||e.g!==s.g||e.b!==s.b||e.a!==s.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Jl extends it{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class bs extends it{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class Yl extends it{getDefault(){return[!0,!0,!0,!0]}set(e){const s=this.current;(e[0]!==s[0]||e[1]!==s[1]||e[2]!==s[2]||e[3]!==s[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Ho extends it{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class Ql extends it{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class Xo extends it{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){const s=this.current;(e.func!==s.func||e.ref!==s.ref||e.mask!==s.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class Ua extends it{getDefault(){const e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){const s=this.current;(e[0]!==s[0]||e[1]!==s[1]||e[2]!==s[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class Wo extends it{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const s=this.gl;e?s.enable(s.STENCIL_TEST):s.disable(s.STENCIL_TEST),this.current=e,this.dirty=!1}}class Ko extends it{getDefault(){return[0,1]}set(e){const s=this.current;(e[0]!==s[0]||e[1]!==s[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class Jo extends it{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const s=this.gl;e?s.enable(s.DEPTH_TEST):s.disable(s.DEPTH_TEST),this.current=e,this.dirty=!1}}class Yo extends it{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class Jr extends it{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const s=this.gl;e?s.enable(s.BLEND):s.disable(s.BLEND),this.current=e,this.dirty=!1}}class Qo extends it{getDefault(){const e=this.gl;return[e.ONE,e.ZERO]}set(e){const s=this.current;(e[0]!==s[0]||e[1]!==s[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}class ec extends it{getDefault(){return p.aM.transparent}set(e){const s=this.current;(e.r!==s.r||e.g!==s.g||e.b!==s.b||e.a!==s.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class el extends it{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class cn extends it{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const s=this.gl;e?s.enable(s.CULL_FACE):s.disable(s.CULL_FACE),this.current=e,this.dirty=!1}}class tc extends it{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class Zn extends it{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class ic extends it{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class rc extends it{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class tl extends it{getDefault(){const e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){const s=this.current;(e[0]!==s[0]||e[1]!==s[1]||e[2]!==s[2]||e[3]!==s[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class il extends it{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const s=this.gl;s.bindFramebuffer(s.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class rl extends it{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const s=this.gl;s.bindRenderbuffer(s.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class $a extends it{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const s=this.gl;s.bindTexture(s.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class sl extends it{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const s=this.gl;s.bindBuffer(s.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Gn extends it{getDefault(){return null}set(e){const s=this.gl;s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class br extends it{getDefault(){return null}set(e){var s;if(e===this.current&&!this.dirty)return;const a=this.gl;Rr(a)?a.bindVertexArray(e):(s=a.getExtension("OES_vertex_array_object"))===null||s===void 0||s.bindVertexArrayOES(e),this.current=e,this.dirty=!1}}class qa extends it{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;const s=this.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class Za extends it{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const s=this.gl;s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class Ga extends it{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const s=this.gl;s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class Hn extends it{constructor(e,s){super(e),this.context=e,this.parent=s}getDefault(){return null}}class Ha extends Hn{setDirty(){this.dirty=!0}set(e){if(e===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,e,0),this.current=e,this.dirty=!1}}class Yr extends Hn{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const s=this.gl;s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Xa extends Hn{set(e){if(e===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,e),this.current=e,this.dirty=!1}}class sc{constructor(e,s,a,o,c){this.context=e,this.width=s,this.height=a;const m=e.gl,_=this.framebuffer=m.createFramebuffer();if(this.colorAttachment=new Ha(e,_),o)this.depthAttachment=c?new Xa(e,_):new Yr(e,_);else if(c)throw new Error("Stencil cannot be set without depth");if(m.checkFramebufferStatus(m.FRAMEBUFFER)!==m.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const e=this.context.gl,s=this.colorAttachment.get();if(s&&e.deleteTexture(s),this.depthAttachment){const a=this.depthAttachment.get();a&&e.deleteRenderbuffer(a)}e.deleteFramebuffer(this.framebuffer)}}class Tt{constructor(e,s,a){this.blendFunction=e,this.blendColor=s,this.mask=a}}Tt.Replace=[1,0],Tt.disabled=new Tt(Tt.Replace,p.aM.transparent,[!1,!1,!1,!1]),Tt.unblended=new Tt(Tt.Replace,p.aM.transparent,[!0,!0,!0,!0]),Tt.alphaBlended=new Tt([1,771],p.aM.transparent,[!0,!0,!0,!0]);class nc{constructor(e){var s,a;if(this.gl=e,this.clearColor=new qn(this),this.clearDepth=new Jl(this),this.clearStencil=new bs(this),this.colorMask=new Yl(this),this.depthMask=new Ho(this),this.stencilMask=new Ql(this),this.stencilFunc=new Xo(this),this.stencilOp=new Ua(this),this.stencilTest=new Wo(this),this.depthRange=new Ko(this),this.depthTest=new Jo(this),this.depthFunc=new Yo(this),this.blend=new Jr(this),this.blendFunc=new Qo(this),this.blendColor=new ec(this),this.blendEquation=new el(this),this.cullFace=new cn(this),this.cullFaceSide=new tc(this),this.frontFace=new Zn(this),this.program=new ic(this),this.activeTexture=new rc(this),this.viewport=new tl(this),this.bindFramebuffer=new il(this),this.bindRenderbuffer=new rl(this),this.bindTexture=new $a(this),this.bindVertexBuffer=new sl(this),this.bindElementBuffer=new Gn(this),this.bindVertexArray=new br(this),this.pixelStoreUnpack=new qa(this),this.pixelStoreUnpackPremultiplyAlpha=new Za(this),this.pixelStoreUnpackFlipY=new Ga(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),Rr(e)){this.HALF_FLOAT=e.HALF_FLOAT;const o=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(s=e.RGBA16F)!==null&&s!==void 0?s:o==null?void 0:o.RGBA16F_EXT,this.RGB16F=(a=e.RGB16F)!==null&&a!==void 0?a:o==null?void 0:o.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");const o=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=o==null?void 0:o.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,s){return new cr(this,e,s)}createVertexBuffer(e,s,a){return new ja(this,e,s,a)}createRenderbuffer(e,s,a){const o=this.gl,c=o.createRenderbuffer();return this.bindRenderbuffer.set(c),o.renderbufferStorage(o.RENDERBUFFER,e,s,a),this.bindRenderbuffer.set(null),c}createFramebuffer(e,s,a,o){return new sc(this,e,s,a,o)}clear({color:e,depth:s,stencil:a}){const o=this.gl;let c=0;e&&(c|=o.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),s!==void 0&&(c|=o.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(s),this.depthMask.set(!0)),a!==void 0&&(c|=o.STENCIL_BUFFER_BIT,this.clearStencil.set(a),this.stencilMask.set(255)),o.clear(c)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){p.aE(e.blendFunction,Tt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var e;return Rr(this.gl)?this.gl.createVertexArray():(e=this.gl.getExtension("OES_vertex_array_object"))===null||e===void 0?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var s;return Rr(this.gl)?this.gl.deleteVertexArray(e):(s=this.gl.getExtension("OES_vertex_array_object"))===null||s===void 0?void 0:s.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}}class Ze{constructor(e,s,a){this.func=e,this.mask=s,this.range=a}}Ze.ReadOnly=!1,Ze.ReadWrite=!0,Ze.disabled=new Ze(519,Ze.ReadOnly,[0,1]);const Xn=7680;class ht{constructor(e,s,a,o,c,m){this.test=e,this.ref=s,this.mask=a,this.fail=o,this.depthFail=c,this.pass=m}}ht.disabled=new ht({func:519,mask:0},0,0,Xn,Xn,Xn);class ot{constructor(e,s,a){this.enable=e,this.mode=s,this.frontFace=a}}let Qr;function un(u,e,s,a,o){const c=u.context,m=c.gl,_=u.useProgram("collisionBox"),y=[];let b=0,T=0;for(let $=0;$<a.length;$++){const Z=a[$],B=e.getTile(Z).getBucket(s);if(!B)continue;const X=o?B.textCollisionBox:B.iconCollisionBox,K=B.collisionCircleArray;if(K.length>0){const ee=p.H();p.aQ(ee,B.placementInvProjMatrix,u.transform.glCoordMatrix),p.aQ(ee,ee,B.placementViewportMatrix),y.push({circleArray:K,circleOffset:T,transform:Z.posMatrix,invTransform:ee,coord:Z}),b+=K.length/4,T=b}X&&_.draw(c,m.LINES,Ze.disabled,ht.disabled,u.colorModeForRenderPass(),ot.disabled,{u_matrix:Z.posMatrix,u_pixel_extrude_scale:[1/(S=u.transform).width,1/S.height]},u.style.map.terrain&&u.style.map.terrain.getTerrainData(Z),s.id,X.layoutVertexBuffer,X.indexBuffer,X.segments,null,u.transform.zoom,null,null,X.collisionVertexBuffer)}var S;if(!o||!y.length)return;const z=u.useProgram("collisionCircle"),D=new p.aR;D.resize(4*b),D._trim();let R=0;for(const $ of y)for(let Z=0;Z<$.circleArray.length/4;Z++){const B=4*Z,X=$.circleArray[B+0],K=$.circleArray[B+1],ee=$.circleArray[B+2],oe=$.circleArray[B+3];D.emplace(R++,X,K,ee,oe,0),D.emplace(R++,X,K,ee,oe,1),D.emplace(R++,X,K,ee,oe,2),D.emplace(R++,X,K,ee,oe,3)}(!Qr||Qr.length<2*b)&&(Qr=function($){const Z=2*$,B=new p.aT;B.resize(Z),B._trim();for(let X=0;X<Z;X++){const K=6*X;B.uint16[K+0]=4*X+0,B.uint16[K+1]=4*X+1,B.uint16[K+2]=4*X+2,B.uint16[K+3]=4*X+2,B.uint16[K+4]=4*X+3,B.uint16[K+5]=4*X+0}return B}(b));const V=c.createIndexBuffer(Qr,!0),U=c.createVertexBuffer(D,p.aS.members,!0);for(const $ of y){const Z=Wr($.transform,$.invTransform,u.transform);z.draw(c,m.TRIANGLES,Ze.disabled,ht.disabled,u.colorModeForRenderPass(),ot.disabled,Z,u.style.map.terrain&&u.style.map.terrain.getTerrainData($.coord),s.id,U,V,p.a0.simpleSegment(0,2*$.circleOffset,$.circleArray.length,$.circleArray.length/2),null,u.transform.zoom,null,null,null)}U.destroy(),V.destroy()}ot.disabled=new ot(!1,1029,2305),ot.backCCW=new ot(!0,1029,2305);const hn=p.an(new Float32Array(16));function Wa(u,e,s,a,o,c){const{horizontalAlign:m,verticalAlign:_}=p.au(u);return new p.P((-(m-.5)*e/o+a[0])*c,(-(_-.5)*s/o+a[1])*c)}function es(u,e,s,a,o,c){const m=e.tileAnchorPoint.add(new p.P(e.translation[0],e.translation[1]));if(e.pitchWithMap){let _=a.mult(c);s||(_=_.rotate(-o));const y=m.add(_);return N(y.x,y.y,e.labelPlaneMatrix,e.getElevation).point}if(s){const _=se(e.tileAnchorPoint.x+1,e.tileAnchorPoint.y,e).point.sub(u),y=Math.atan(_.y/_.x)+(_.x<0?Math.PI:0);return u.add(a.rotate(y))}return u.add(a)}function ws(u,e,s,a,o,c,m,_,y,b,T,S,z,D){const R=u.text.placedSymbolArray,V=u.text.dynamicLayoutVertexArray,U=u.icon.dynamicLayoutVertexArray,$={};V.clear();for(let Z=0;Z<R.length;Z++){const B=R.get(Z),X=B.hidden||!B.crossTileID||u.allowVerticalPlacement&&!B.placedOrientation?null:a[B.crossTileID];if(X){const K=new p.P(B.anchorX,B.anchorY),ee={getElevation:D,width:o.width,height:o.height,labelPlaneMatrix:c,pitchWithMap:s,projection:T,tileAnchorPoint:K,translation:S,unwrappedTileID:z},oe=s?N(K.x,K.y,m,D):se(K.x,K.y,ee),ue=A(o.cameraToCenterDistance,oe.signedDistanceFromCamera);let xe=p.ai(u.textSizeData,y,B)*ue/p.ap;s&&(xe*=u.tilePixelRatio/_);const{width:Te,height:fe,anchor:pe,textOffset:Me,textBoxScale:Ve}=X,_e=Wa(pe,Te,fe,Me,Ve,xe),be=T.getPitchedTextCorrection(o,K.add(new p.P(S[0],S[1])),z),Fe=es(oe.point,ee,e,_e,o.angle,be),ft=u.allowVerticalPlacement&&B.placedOrientation===p.ah.vertical?Math.PI/2:0;for(let Ue=0;Ue<B.numGlyphs;Ue++)p.aj(V,Fe,ft);b&&B.associatedIconIndex>=0&&($[B.associatedIconIndex]={shiftedAnchor:Fe,angle:ft})}else De(B.numGlyphs,V)}if(b){U.clear();const Z=u.icon.placedSymbolArray;for(let B=0;B<Z.length;B++){const X=Z.get(B);if(X.hidden)De(X.numGlyphs,U);else{const K=$[B];if(K)for(let ee=0;ee<X.numGlyphs;ee++)p.aj(U,K.shiftedAnchor,K.angle);else De(X.numGlyphs,U)}}u.icon.dynamicLayoutVertexBuffer.updateData(U)}u.text.dynamicLayoutVertexBuffer.updateData(V)}function Mi(u,e,s){return s.iconsInText&&e?"symbolTextAndIcon":u?"symbolSDF":"symbolIcon"}function Ka(u,e,s,a,o,c,m,_,y,b,T,S){const z=u.context,D=z.gl,R=u.transform,V=Hr(),U=_==="map",$=y==="map",Z=_!=="viewport"&&s.layout.get("symbol-placement")!=="point",B=U&&!$&&!Z,X=!$&&Z,K=!s.layout.get("symbol-sort-key").isConstant();let ee=!1;const oe=u.depthModeForSublayer(0,Ze.ReadOnly),ue=s._unevaluatedLayout.hasValue("text-variable-anchor")||s._unevaluatedLayout.hasValue("text-variable-anchor-offset"),xe=[],Te=V.getCircleRadiusCorrection(R);for(const fe of a){const pe=e.getTile(fe),Me=pe.getBucket(s);if(!Me)continue;const Ve=o?Me.text:Me.icon;if(!Ve||!Ve.segments.get().length||!Ve.hasVisibleVertices)continue;const _e=Ve.programConfigurations.get(s.id),be=o||Me.sdfIcons,Fe=o?Me.textSizeData:Me.iconSizeData,ft=$||R.pitch!==0,Ue=u.useProgram(Mi(be,o,Me),_e),He=p.ag(Fe,R.zoom),mt=u.style.map.terrain&&u.style.map.terrain.getTerrainData(fe);let $t,Zi,gt,ci,ti=[0,0],qt=null;if(o)Zi=pe.glyphAtlasTexture,gt=D.LINEAR,$t=pe.glyphAtlasTexture.size,Me.iconsInText&&(ti=pe.imageAtlasTexture.size,qt=pe.imageAtlasTexture,ci=ft||u.options.rotating||u.options.zooming||Fe.kind==="composite"||Fe.kind==="camera"?D.LINEAR:D.NEAREST);else{const We=s.layout.get("icon-size").constantOr(0)!==1||Me.iconsNeedLinear;Zi=pe.imageAtlasTexture,gt=be||u.options.rotating||u.options.zooming||We||ft?D.LINEAR:D.NEAREST,$t=pe.imageAtlasTexture.size}const ii=Ge(pe,1,u.transform.zoom),dr=X?fe.posMatrix:hn,Fs=Dr(dr,$,U,u.transform,ii),pa=lr(dr,$,U,u.transform,ii),Os=lr(fe.posMatrix,$,U,u.transform,ii),ki=V.translatePosition(u.transform,pe,c,m),fa=ue&&Me.hasTextData(),wo=s.layout.get("icon-text-fit")!=="none"&&fa&&Me.hasIconData();if(Z){const We=u.style.map.terrain?(Vs,Ns)=>u.style.map.terrain.getElevation(fe,Vs,Ns):null,ns=s.layout.get("text-rotation-alignment")==="map";E(Me,fe.posMatrix,u,o,Fs,Os,$,b,ns,V,fe.toUnwrapped(),R.width,R.height,ki,We)}const Ei=fe.posMatrix,Di=o&&ue||wo,Br=Z||Di?hn:Fs,Gi=pa,Ot=be&&s.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Zt;Zt=be?Me.iconsInText?Oa(Fe.kind,He,B,$,Z,Di,u,Ei,Br,Gi,ki,$t,ti,Te):ln(Fe.kind,He,B,$,Z,Di,u,Ei,Br,Gi,ki,o,$t,!0,Te):Go(Fe.kind,He,B,$,Z,Di,u,Ei,Br,Gi,ki,o,$t,Te);const wi={program:Ue,buffers:Ve,uniformValues:Zt,atlasTexture:Zi,atlasTextureIcon:qt,atlasInterpolation:gt,atlasInterpolationIcon:ci,isSDF:be,hasHalo:Ot};if(K&&Me.canOverlap){ee=!0;const We=Ve.segments.get();for(const ns of We)xe.push({segments:new p.a0([ns]),sortKey:ns.sortKey,state:wi,terrainData:mt})}else xe.push({segments:Ve.segments,sortKey:0,state:wi,terrainData:mt})}ee&&xe.sort((fe,pe)=>fe.sortKey-pe.sortKey);for(const fe of xe){const pe=fe.state;if(z.activeTexture.set(D.TEXTURE0),pe.atlasTexture.bind(pe.atlasInterpolation,D.CLAMP_TO_EDGE),pe.atlasTextureIcon&&(z.activeTexture.set(D.TEXTURE1),pe.atlasTextureIcon&&pe.atlasTextureIcon.bind(pe.atlasInterpolationIcon,D.CLAMP_TO_EDGE)),pe.isSDF){const Me=pe.uniformValues;pe.hasHalo&&(Me.u_is_halo=1,Ja(pe.buffers,fe.segments,s,u,pe.program,oe,T,S,Me,fe.terrainData)),Me.u_is_halo=0}Ja(pe.buffers,fe.segments,s,u,pe.program,oe,T,S,pe.uniformValues,fe.terrainData)}}function Ja(u,e,s,a,o,c,m,_,y,b){const T=a.context;o.draw(T,T.gl.TRIANGLES,c,m,_,ot.disabled,y,b,s.id,u.layoutVertexBuffer,u.indexBuffer,e,s.paint,a.transform.zoom,u.programConfigurations.get(s.id),u.dynamicLayoutVertexBuffer,u.opacityVertexBuffer)}function Ya(u,e,s,a){const o=u.context,c=o.gl,m=ht.disabled,_=new Tt([c.ONE,c.ONE],p.aM.transparent,[!0,!0,!0,!0]),y=e.getBucket(s);if(!y)return;const b=a.key;let T=s.heatmapFbos.get(b);T||(T=dn(o,e.tileSize,e.tileSize),s.heatmapFbos.set(b,T)),o.bindFramebuffer.set(T.framebuffer),o.viewport.set([0,0,e.tileSize,e.tileSize]),o.clear({color:p.aM.transparent});const S=y.programConfigurations.get(s.id),z=u.useProgram("heatmap",S),D=u.style.map.terrain.getTerrainData(a);z.draw(o,c.TRIANGLES,Ze.disabled,m,_,ot.disabled,li(a.posMatrix,e,u.transform.zoom,s.paint.get("heatmap-intensity")),D,s.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,s.paint,u.transform.zoom,S)}function ts(u,e,s){const a=u.context,o=a.gl;a.setColorMode(u.colorModeForRenderPass());const c=pn(a,e),m=s.key,_=e.heatmapFbos.get(m);_&&(a.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,_.colorAttachment.get()),a.activeTexture.set(o.TEXTURE1),c.bind(o.LINEAR,o.CLAMP_TO_EDGE),u.useProgram("heatmapTexture").draw(a,o.TRIANGLES,Ze.disabled,ht.disabled,u.colorModeForRenderPass(),ot.disabled,Nn(u,e,0,1),null,e.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments,e.paint,u.transform.zoom),_.destroy(),e.heatmapFbos.delete(m))}function dn(u,e,s){var a,o;const c=u.gl,m=c.createTexture();c.bindTexture(c.TEXTURE_2D,m),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.LINEAR),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.LINEAR);const _=(a=u.HALF_FLOAT)!==null&&a!==void 0?a:c.UNSIGNED_BYTE,y=(o=u.RGBA16F)!==null&&o!==void 0?o:c.RGBA;c.texImage2D(c.TEXTURE_2D,0,y,e,s,0,c.RGBA,_,null);const b=u.createFramebuffer(e,s,!1,!1);return b.colorAttachment.set(m),b}function pn(u,e){return e.colorRampTexture||(e.colorRampTexture=new at(u,e.colorRamp,u.gl.RGBA)),e.colorRampTexture}function Ts(u,e,s,a,o){if(!s||!a||!a.imageAtlas)return;const c=a.imageAtlas.patternPositions;let m=c[s.to.toString()],_=c[s.from.toString()];if(!m&&_&&(m=_),!_&&m&&(_=m),!m||!_){const y=o.getPaintProperty(e);m=c[y],_=c[y]}m&&_&&u.setConstantPatternPositions(m,_)}function fn(u,e,s,a,o,c,m){const _=u.context.gl,y="fill-pattern",b=s.paint.get(y),T=b&&b.constantOr(1),S=s.getCrossfadeParameters();let z,D,R,V,U;m?(D=T&&!s.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",z=_.LINES):(D=T?"fillPattern":"fill",z=_.TRIANGLES);const $=b.constantOr(null);for(const Z of a){const B=e.getTile(Z);if(T&&!B.patternsLoaded())continue;const X=B.getBucket(s);if(!X)continue;const K=X.programConfigurations.get(s.id),ee=u.useProgram(D,K),oe=u.style.map.terrain&&u.style.map.terrain.getTerrainData(Z);T&&(u.context.activeTexture.set(_.TEXTURE0),B.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),K.updatePaintBuffers(S)),Ts(K,y,$,B,s);const ue=oe?Z:null,xe=u.translatePosMatrix(ue?ue.posMatrix:Z.posMatrix,B,s.paint.get("fill-translate"),s.paint.get("fill-translate-anchor"));if(m){V=X.indexBuffer2,U=X.segments2;const Te=[_.drawingBufferWidth,_.drawingBufferHeight];R=D==="fillOutlinePattern"&&T?Uo(xe,u,S,B,Te):Zl(xe,Te)}else V=X.indexBuffer,U=X.segments,R=T?jo(xe,u,S,B):xs(xe);ee.draw(u.context,z,o,u.stencilModeForClipping(Z),c,ot.disabled,R,oe,s.id,X.layoutVertexBuffer,V,U,s.paint,u.transform.zoom,K)}}function Wn(u,e,s,a,o,c,m){const _=u.context,y=_.gl,b="fill-extrusion-pattern",T=s.paint.get(b),S=T.constantOr(1),z=s.getCrossfadeParameters(),D=s.paint.get("fill-extrusion-opacity"),R=T.constantOr(null);for(const V of a){const U=e.getTile(V),$=U.getBucket(s);if(!$)continue;const Z=u.style.map.terrain&&u.style.map.terrain.getTerrainData(V),B=$.programConfigurations.get(s.id),X=u.useProgram(S?"fillExtrusionPattern":"fillExtrusion",B);S&&(u.context.activeTexture.set(y.TEXTURE0),U.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),B.updatePaintBuffers(z)),Ts(B,b,R,U,s);const K=u.translatePosMatrix(V.posMatrix,U,s.paint.get("fill-extrusion-translate"),s.paint.get("fill-extrusion-translate-anchor")),ee=s.paint.get("fill-extrusion-vertical-gradient"),oe=S?Vn(K,u,ee,D,V,z,U):an(K,u,ee,D);X.draw(_,_.gl.TRIANGLES,o,c,m,ot.backCCW,oe,Z,s.id,$.layoutVertexBuffer,$.indexBuffer,$.segments,s.paint,u.transform.zoom,B,u.style.map.terrain&&$.centroidVertexBuffer)}}function Ss(u,e,s,a,o,c,m){const _=u.context,y=_.gl,b=s.fbo;if(!b)return;const T=u.useProgram("hillshade"),S=u.style.map.terrain&&u.style.map.terrain.getTerrainData(e);_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,b.colorAttachment.get()),T.draw(_,y.TRIANGLES,o,c,m,ot.disabled,((z,D,R,V)=>{const U=R.paint.get("hillshade-shadow-color"),$=R.paint.get("hillshade-highlight-color"),Z=R.paint.get("hillshade-accent-color");let B=R.paint.get("hillshade-illumination-direction")*(Math.PI/180);R.paint.get("hillshade-illumination-anchor")==="viewport"&&(B-=z.transform.angle);const X=!z.options.moving;return{u_matrix:V?V.posMatrix:z.transform.calculatePosMatrix(D.tileID.toUnwrapped(),X),u_image:0,u_latrange:jn(0,D.tileID),u_light:[R.paint.get("hillshade-exaggeration"),B],u_shadow:U,u_highlight:$,u_accent:Z}})(u,s,a,S?e:null),S,a.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments)}function Is(u,e,s,a,o,c){const m=u.context,_=m.gl,y=e.dem;if(y&&y.data){const b=y.dim,T=y.stride,S=y.getPixels();if(m.activeTexture.set(_.TEXTURE1),m.pixelStoreUnpackPremultiplyAlpha.set(!1),e.demTexture=e.demTexture||u.getTileTexture(T),e.demTexture){const D=e.demTexture;D.update(S,{premultiply:!1}),D.bind(_.NEAREST,_.CLAMP_TO_EDGE)}else e.demTexture=new at(m,S,_.RGBA,{premultiply:!1}),e.demTexture.bind(_.NEAREST,_.CLAMP_TO_EDGE);m.activeTexture.set(_.TEXTURE0);let z=e.fbo;if(!z){const D=new at(m,{width:b,height:b,data:null},_.RGBA);D.bind(_.LINEAR,_.CLAMP_TO_EDGE),z=e.fbo=m.createFramebuffer(b,b,!0,!1),z.colorAttachment.set(D.texture)}m.bindFramebuffer.set(z.framebuffer),m.viewport.set([0,0,b,b]),u.useProgram("hillshadePrepare").draw(m,_.TRIANGLES,a,o,c,ot.disabled,((D,R)=>{const V=R.stride,U=p.H();return p.aP(U,0,p.X,-p.X,0,0,1),p.J(U,U,[0,-p.X,0]),{u_matrix:U,u_image:1,u_dimension:[V,V],u_zoom:D.overscaledZ,u_unpack:R.getUnpackVector()}})(e.tileID,y),null,s.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments),e.needsHillshadePrepare=!1}}function nl(u,e,s,a,o,c){const m=a.paint.get("raster-fade-duration");if(!c&&m>0){const _=me.now(),y=(_-u.timeAdded)/m,b=e?(_-e.timeAdded)/m:-1,T=s.getSource(),S=o.coveringZoomLevel({tileSize:T.tileSize,roundZoom:T.roundZoom}),z=!e||Math.abs(e.tileID.overscaledZ-S)>Math.abs(u.tileID.overscaledZ-S),D=z&&u.refreshedUponExpiration?1:p.ac(z?y:1-b,0,1);return u.refreshedUponExpiration&&y>=1&&(u.refreshedUponExpiration=!1),e?{opacity:1,mix:1-D}:{opacity:D,mix:0}}return{opacity:1,mix:0}}const Qa=new p.aM(1,0,0,1),Ye=new p.aM(0,1,0,1),Kn=new p.aM(0,0,1,1),ac=new p.aM(1,0,1,1),al=new p.aM(0,1,1,1);function Ps(u,e,s,a){Jn(u,0,e+s/2,u.transform.width,s,a)}function ol(u,e,s,a){Jn(u,e-s/2,0,s,u.transform.height,a)}function Jn(u,e,s,a,o,c){const m=u.context,_=m.gl;_.enable(_.SCISSOR_TEST),_.scissor(e*u.pixelRatio,s*u.pixelRatio,a*u.pixelRatio,o*u.pixelRatio),m.clear({color:c}),_.disable(_.SCISSOR_TEST)}function ll(u,e,s){const a=u.context,o=a.gl,c=s.posMatrix,m=u.useProgram("debug"),_=Ze.disabled,y=ht.disabled,b=u.colorModeForRenderPass(),T="$debug",S=u.style.map.terrain&&u.style.map.terrain.getTerrainData(s);a.activeTexture.set(o.TEXTURE0);const z=e.getTileByID(s.key).latestRawTileData,D=Math.floor((z&&z.byteLength||0)/1024),R=e.getTile(s).tileSize,V=512/Math.min(R,512)*(s.overscaledZ/u.transform.zoom)*.5;let U=s.canonical.toString();s.overscaledZ!==s.canonical.z&&(U+=` => ${s.overscaledZ}`),function($,Z){$.initDebugOverlayCanvas();const B=$.debugOverlayCanvas,X=$.context.gl,K=$.debugOverlayCanvas.getContext("2d");K.clearRect(0,0,B.width,B.height),K.shadowColor="white",K.shadowBlur=2,K.lineWidth=1.5,K.strokeStyle="white",K.textBaseline="top",K.font="bold 36px Open Sans, sans-serif",K.fillText(Z,5,5),K.strokeText(Z,5,5),$.debugOverlayTexture.update(B),$.debugOverlayTexture.bind(X.LINEAR,X.CLAMP_TO_EDGE)}(u,`${U} ${D}kB`),m.draw(a,o.TRIANGLES,_,y,Tt.alphaBlended,ot.disabled,on(c,p.aM.transparent,V),null,T,u.debugBuffer,u.quadTriangleIndexBuffer,u.debugSegments),m.draw(a,o.LINE_STRIP,_,y,b,ot.disabled,on(c,p.aM.red),S,T,u.debugBuffer,u.tileBorderIndexBuffer,u.debugSegments)}function cl(u,e,s){const a=u.context,o=a.gl,c=u.colorModeForRenderPass(),m=new Ze(o.LEQUAL,Ze.ReadWrite,u.depthRangeFor3D),_=u.useProgram("terrain"),y=e.getTerrainMesh();a.bindFramebuffer.set(null),a.viewport.set([0,0,u.width,u.height]);for(const b of s){const T=u.renderToTexture.getTexture(b),S=e.getTerrainData(b.tileID);a.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,T.texture);const z=u.transform.calculatePosMatrix(b.tileID.toUnwrapped()),D=e.getMeshFrameDelta(u.transform.zoom),R=u.transform.calculateFogMatrix(b.tileID.toUnwrapped()),V=Ba(z,D,R,u.style.sky,u.transform.pitch);_.draw(a,o.TRIANGLES,m,ht.disabled,c,ot.backCCW,V,S,"terrain",y.vertexBuffer,y.indexBuffer,y.segments)}}class Yn{constructor(e,s,a){this.vertexBuffer=e,this.indexBuffer=s,this.segments=a}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class Qn{constructor(e,s){this.context=new nc(e),this.transform=s,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:p.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Be.maxUnderzooming+Be.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new La}resize(e,s,a){if(this.width=Math.floor(e*a),this.height=Math.floor(s*a),this.pixelRatio=a,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const o of this.style._order)this.style._layers[o].resize()}setup(){const e=this.context,s=new p.aX;s.emplaceBack(0,0),s.emplaceBack(p.X,0),s.emplaceBack(0,p.X),s.emplaceBack(p.X,p.X),this.tileExtentBuffer=e.createVertexBuffer(s,Xr.members),this.tileExtentSegments=p.a0.simpleSegment(0,0,4,2);const a=new p.aX;a.emplaceBack(0,0),a.emplaceBack(p.X,0),a.emplaceBack(0,p.X),a.emplaceBack(p.X,p.X),this.debugBuffer=e.createVertexBuffer(a,Xr.members),this.debugSegments=p.a0.simpleSegment(0,0,4,5);const o=new p.$;o.emplaceBack(0,0,0,0),o.emplaceBack(p.X,0,p.X,0),o.emplaceBack(0,p.X,0,p.X),o.emplaceBack(p.X,p.X,p.X,p.X),this.rasterBoundsBuffer=e.createVertexBuffer(o,kr.members),this.rasterBoundsSegments=p.a0.simpleSegment(0,0,4,2);const c=new p.aX;c.emplaceBack(0,0),c.emplaceBack(1,0),c.emplaceBack(0,1),c.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(c,Xr.members),this.viewportSegments=p.a0.simpleSegment(0,0,4,2);const m=new p.aZ;m.emplaceBack(0),m.emplaceBack(1),m.emplaceBack(3),m.emplaceBack(2),m.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(m);const _=new p.aY;_.emplaceBack(0,1,2),_.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(_);const y=this.context.gl;this.stencilClearMode=new ht({func:y.ALWAYS,mask:0},0,255,y.ZERO,y.ZERO,y.ZERO)}clearStencil(){const e=this.context,s=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const a=p.H();p.aP(a,0,this.width,this.height,0,0,1),p.K(a,a,[s.drawingBufferWidth,s.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,s.TRIANGLES,Ze.disabled,this.stencilClearMode,Tt.disabled,ot.disabled,oi(a),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,s){if(this.currentStencilSource===e.source||!e.isTileClipped()||!s||!s.length)return;this.currentStencilSource=e.source;const a=this.context,o=a.gl;this.nextStencilID+s.length>256&&this.clearStencil(),a.setColorMode(Tt.disabled),a.setDepthMode(Ze.disabled);const c=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const m of s){const _=this._tileClippingMaskIDs[m.key]=this.nextStencilID++,y=this.style.map.terrain&&this.style.map.terrain.getTerrainData(m);c.draw(a,o.TRIANGLES,Ze.disabled,new ht({func:o.ALWAYS,mask:0},_,255,o.KEEP,o.KEEP,o.REPLACE),Tt.disabled,ot.disabled,oi(m.posMatrix),y,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,s=this.context.gl;return new ht({func:s.NOTEQUAL,mask:255},e,255,s.KEEP,s.KEEP,s.REPLACE)}stencilModeForClipping(e){const s=this.context.gl;return new ht({func:s.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,s.KEEP,s.KEEP,s.REPLACE)}stencilConfigForOverlap(e){const s=this.context.gl,a=e.sort((m,_)=>_.overscaledZ-m.overscaledZ),o=a[a.length-1].overscaledZ,c=a[0].overscaledZ-o+1;if(c>1){this.currentStencilSource=void 0,this.nextStencilID+c>256&&this.clearStencil();const m={};for(let _=0;_<c;_++)m[_+o]=new ht({func:s.GEQUAL,mask:255},_+this.nextStencilID,255,s.KEEP,s.KEEP,s.REPLACE);return this.nextStencilID+=c,[m,a]}return[{[o]:ht.disabled},a]}colorModeForRenderPass(){const e=this.context.gl;return this._showOverdrawInspector?new Tt([e.CONSTANT_COLOR,e.ONE],new p.aM(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Tt.unblended:Tt.alphaBlended}depthModeForSublayer(e,s,a){if(!this.opaquePassEnabledForLayer())return Ze.disabled;const o=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new Ze(a||this.context.gl.LEQUAL,s,[o,o])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,s){this.style=e,this.options=s,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(me.now()),this.imageManager.beginFrame();const a=this.style._order,o=this.style.sourceCaches,c={},m={},_={};for(const y in o){const b=o[y];b.used&&b.prepare(this.context),c[y]=b.getVisibleCoordinates(),m[y]=c[y].slice().reverse(),_[y]=b.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let y=0;y<a.length;y++)if(this.style._layers[a[y]].is3D()){this.opaquePassCutoff=y;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const y of a){const b=this.style._layers[y];if(!b.hasOffscreenPass()||b.isHidden(this.transform.zoom))continue;const T=m[b.source];(b.type==="custom"||T.length)&&this.renderLayer(this,o[b.source],b,T)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:s.showOverdrawInspector?p.aM.black:p.aM.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(y,b){const T=y.context,S=T.gl,z=(($,Z,B)=>({u_sky_color:$.properties.get("sky-color"),u_horizon_color:$.properties.get("horizon-color"),u_horizon:(Z.height/2+Z.getHorizon())*B,u_sky_horizon_blend:$.properties.get("sky-horizon-blend")*Z.height/2*B}))(b,y.style.map.transform,y.pixelRatio),D=new Ze(S.LEQUAL,Ze.ReadWrite,[0,1]),R=ht.disabled,V=y.colorModeForRenderPass(),U=y.useProgram("sky");if(!b.mesh){const $=new p.aX;$.emplaceBack(-1,-1),$.emplaceBack(1,-1),$.emplaceBack(1,1),$.emplaceBack(-1,1);const Z=new p.aY;Z.emplaceBack(0,1,2),Z.emplaceBack(0,2,3),b.mesh=new Yn(T.createVertexBuffer($,Xr.members),T.createIndexBuffer(Z),p.a0.simpleSegment(0,0,$.length,Z.length))}U.draw(T,S.TRIANGLES,D,R,V,ot.disabled,z,void 0,"sky",b.mesh.vertexBuffer,b.mesh.indexBuffer,b.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=s.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=a.length-1;this.currentLayer>=0;this.currentLayer--){const y=this.style._layers[a[this.currentLayer]],b=o[y.source],T=c[y.source];this._renderTileClippingMasks(y,T),this.renderLayer(this,b,y,T)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<a.length;this.currentLayer++){const y=this.style._layers[a[this.currentLayer]],b=o[y.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(y))continue;const T=(y.type==="symbol"?_:m)[y.source];this._renderTileClippingMasks(y,c[y.source]),this.renderLayer(this,b,y,T)}if(this.options.showTileBoundaries){const y=function(b,T){let S=null;const z=Object.values(b._layers).flatMap(U=>U.source&&!U.isHidden(T)?[b.sourceCaches[U.source]]:[]),D=z.filter(U=>U.getSource().type==="vector"),R=z.filter(U=>U.getSource().type!=="vector"),V=U=>{(!S||S.getSource().maxzoom<U.getSource().maxzoom)&&(S=U)};return D.forEach(U=>V(U)),S||R.forEach(U=>V(U)),S}(this.style,this.transform.zoom);y&&function(b,T,S){for(let z=0;z<S.length;z++)ll(b,T,S[z])}(this,y,y.getVisibleCoordinates())}this.options.showPadding&&function(y){const b=y.transform.padding;Ps(y,y.transform.height-(b.top||0),3,Qa),Ps(y,b.bottom||0,3,Ye),ol(y,b.left||0,3,Kn),ol(y,y.transform.width-(b.right||0),3,ac);const T=y.transform.centerPoint;(function(S,z,D,R){Jn(S,z-1,D-10,2,20,R),Jn(S,z-10,D-1,20,2,R)})(y,T.x,y.transform.height-T.y,al)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;const s=this.terrainFacilitator.matrix,a=this.transform.modelViewProjectionMatrix;let o=this.terrainFacilitator.dirty;o||(o=e?!p.a_(s,a):!p.a$(s,a)),o||(o=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),o&&(p.b0(s,a),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(c,m){const _=c.context,y=_.gl,b=Tt.unblended,T=new Ze(y.LEQUAL,Ze.ReadWrite,[0,1]),S=m.getTerrainMesh(),z=m.sourceCache.getRenderableTiles(),D=c.useProgram("terrainDepth");_.bindFramebuffer.set(m.getFramebuffer("depth").framebuffer),_.viewport.set([0,0,c.width/devicePixelRatio,c.height/devicePixelRatio]),_.clear({color:p.aM.transparent,depth:1});for(const R of z){const V=m.getTerrainData(R.tileID),U={u_matrix:c.transform.calculatePosMatrix(R.tileID.toUnwrapped()),u_ele_delta:m.getMeshFrameDelta(c.transform.zoom)};D.draw(_,y.TRIANGLES,T,ht.disabled,b,ot.backCCW,U,V,"terrain",S.vertexBuffer,S.indexBuffer,S.segments)}_.bindFramebuffer.set(null),_.viewport.set([0,0,c.width,c.height])}(this,this.style.map.terrain),function(c,m){const _=c.context,y=_.gl,b=Tt.unblended,T=new Ze(y.LEQUAL,Ze.ReadWrite,[0,1]),S=m.getTerrainMesh(),z=m.getCoordsTexture(),D=m.sourceCache.getRenderableTiles(),R=c.useProgram("terrainCoords");_.bindFramebuffer.set(m.getFramebuffer("coords").framebuffer),_.viewport.set([0,0,c.width/devicePixelRatio,c.height/devicePixelRatio]),_.clear({color:p.aM.transparent,depth:1}),m.coordsIndex=[];for(const V of D){const U=m.getTerrainData(V.tileID);_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,z.texture);const $={u_matrix:c.transform.calculatePosMatrix(V.tileID.toUnwrapped()),u_terrain_coords_id:(255-m.coordsIndex.length)/255,u_texture:0,u_ele_delta:m.getMeshFrameDelta(c.transform.zoom)};R.draw(_,y.TRIANGLES,T,ht.disabled,b,ot.backCCW,$,U,"terrain",S.vertexBuffer,S.indexBuffer,S.segments),m.coordsIndex.push(V.tileID.key)}_.bindFramebuffer.set(null),_.viewport.set([0,0,c.width,c.height])}(this,this.style.map.terrain))}renderLayer(e,s,a,o){if(!a.isHidden(this.transform.zoom)&&(a.type==="background"||a.type==="custom"||(o||[]).length))switch(this.id=a.id,a.type){case"symbol":(function(c,m,_,y,b){if(c.renderPass!=="translucent")return;const T=ht.disabled,S=c.colorModeForRenderPass();(_._unevaluatedLayout.hasValue("text-variable-anchor")||_._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(z,D,R,V,U,$,Z,B,X){const K=D.transform,ee=Hr(),oe=U==="map",ue=$==="map";for(const xe of z){const Te=V.getTile(xe),fe=Te.getBucket(R);if(!fe||!fe.text||!fe.text.segments.get().length)continue;const pe=p.ag(fe.textSizeData,K.zoom),Me=Ge(Te,1,D.transform.zoom),Ve=Dr(xe.posMatrix,ue,oe,D.transform,Me),_e=R.layout.get("icon-text-fit")!=="none"&&fe.hasIconData();if(pe){const be=Math.pow(2,K.zoom-Te.tileID.overscaledZ),Fe=D.style.map.terrain?(Ue,He)=>D.style.map.terrain.getElevation(xe,Ue,He):null,ft=ee.translatePosition(K,Te,Z,B);ws(fe,oe,ue,X,K,Ve,xe.posMatrix,be,pe,_e,ee,ft,xe.toUnwrapped(),Fe)}}}(y,c,_,m,_.layout.get("text-rotation-alignment"),_.layout.get("text-pitch-alignment"),_.paint.get("text-translate"),_.paint.get("text-translate-anchor"),b),_.paint.get("icon-opacity").constantOr(1)!==0&&Ka(c,m,_,y,!1,_.paint.get("icon-translate"),_.paint.get("icon-translate-anchor"),_.layout.get("icon-rotation-alignment"),_.layout.get("icon-pitch-alignment"),_.layout.get("icon-keep-upright"),T,S),_.paint.get("text-opacity").constantOr(1)!==0&&Ka(c,m,_,y,!0,_.paint.get("text-translate"),_.paint.get("text-translate-anchor"),_.layout.get("text-rotation-alignment"),_.layout.get("text-pitch-alignment"),_.layout.get("text-keep-upright"),T,S),m.map.showCollisionBoxes&&(un(c,m,_,y,!0),un(c,m,_,y,!1))})(e,s,a,o,this.style.placement.variableOffsets);break;case"circle":(function(c,m,_,y){if(c.renderPass!=="translucent")return;const b=_.paint.get("circle-opacity"),T=_.paint.get("circle-stroke-width"),S=_.paint.get("circle-stroke-opacity"),z=!_.layout.get("circle-sort-key").isConstant();if(b.constantOr(1)===0&&(T.constantOr(1)===0||S.constantOr(1)===0))return;const D=c.context,R=D.gl,V=c.depthModeForSublayer(0,Ze.ReadOnly),U=ht.disabled,$=c.colorModeForRenderPass(),Z=[];for(let B=0;B<y.length;B++){const X=y[B],K=m.getTile(X),ee=K.getBucket(_);if(!ee)continue;const oe=ee.programConfigurations.get(_.id),ue=c.useProgram("circle",oe),xe=ee.layoutVertexBuffer,Te=ee.indexBuffer,fe=c.style.map.terrain&&c.style.map.terrain.getTerrainData(X),pe={programConfiguration:oe,program:ue,layoutVertexBuffer:xe,indexBuffer:Te,uniformValues:Gl(c,X,K,_),terrainData:fe};if(z){const Me=ee.segments.get();for(const Ve of Me)Z.push({segments:new p.a0([Ve]),sortKey:Ve.sortKey,state:pe})}else Z.push({segments:ee.segments,sortKey:0,state:pe})}z&&Z.sort((B,X)=>B.sortKey-X.sortKey);for(const B of Z){const{programConfiguration:X,program:K,layoutVertexBuffer:ee,indexBuffer:oe,uniformValues:ue,terrainData:xe}=B.state;K.draw(D,R.TRIANGLES,V,U,$,ot.disabled,ue,xe,_.id,ee,oe,B.segments,_.paint,c.transform.zoom,X)}})(e,s,a,o);break;case"heatmap":(function(c,m,_,y){if(_.paint.get("heatmap-opacity")===0)return;const b=c.context;if(c.style.map.terrain){for(const T of y){const S=m.getTile(T);m.hasRenderableParent(T)||(c.renderPass==="offscreen"?Ya(c,S,_,T):c.renderPass==="translucent"&&ts(c,_,T))}b.viewport.set([0,0,c.width,c.height])}else c.renderPass==="offscreen"?function(T,S,z,D){const R=T.context,V=R.gl,U=ht.disabled,$=new Tt([V.ONE,V.ONE],p.aM.transparent,[!0,!0,!0,!0]);(function(Z,B,X){const K=Z.gl;Z.activeTexture.set(K.TEXTURE1),Z.viewport.set([0,0,B.width/4,B.height/4]);let ee=X.heatmapFbos.get(p.aU);ee?(K.bindTexture(K.TEXTURE_2D,ee.colorAttachment.get()),Z.bindFramebuffer.set(ee.framebuffer)):(ee=dn(Z,B.width/4,B.height/4),X.heatmapFbos.set(p.aU,ee))})(R,T,z),R.clear({color:p.aM.transparent});for(let Z=0;Z<D.length;Z++){const B=D[Z];if(S.hasRenderableParent(B))continue;const X=S.getTile(B),K=X.getBucket(z);if(!K)continue;const ee=K.programConfigurations.get(z.id),oe=T.useProgram("heatmap",ee),{zoom:ue}=T.transform;oe.draw(R,V.TRIANGLES,Ze.disabled,U,$,ot.disabled,li(B.posMatrix,X,ue,z.paint.get("heatmap-intensity")),null,z.id,K.layoutVertexBuffer,K.indexBuffer,K.segments,z.paint,T.transform.zoom,ee)}R.viewport.set([0,0,T.width,T.height])}(c,m,_,y):c.renderPass==="translucent"&&function(T,S){const z=T.context,D=z.gl;z.setColorMode(T.colorModeForRenderPass());const R=S.heatmapFbos.get(p.aU);R&&(z.activeTexture.set(D.TEXTURE0),D.bindTexture(D.TEXTURE_2D,R.colorAttachment.get()),z.activeTexture.set(D.TEXTURE1),pn(z,S).bind(D.LINEAR,D.CLAMP_TO_EDGE),T.useProgram("heatmapTexture").draw(z,D.TRIANGLES,Ze.disabled,ht.disabled,T.colorModeForRenderPass(),ot.disabled,Nn(T,S,0,1),null,S.id,T.viewportBuffer,T.quadTriangleIndexBuffer,T.viewportSegments,S.paint,T.transform.zoom))}(c,_)})(e,s,a,o);break;case"line":(function(c,m,_,y){if(c.renderPass!=="translucent")return;const b=_.paint.get("line-opacity"),T=_.paint.get("line-width");if(b.constantOr(1)===0||T.constantOr(1)===0)return;const S=c.depthModeForSublayer(0,Ze.ReadOnly),z=c.colorModeForRenderPass(),D=_.paint.get("line-dasharray"),R=_.paint.get("line-pattern"),V=R.constantOr(1),U=_.paint.get("line-gradient"),$=_.getCrossfadeParameters(),Z=V?"linePattern":D?"lineSDF":U?"lineGradient":"line",B=c.context,X=B.gl;let K=!0;for(const ee of y){const oe=m.getTile(ee);if(V&&!oe.patternsLoaded())continue;const ue=oe.getBucket(_);if(!ue)continue;const xe=ue.programConfigurations.get(_.id),Te=c.context.program.get(),fe=c.useProgram(Z,xe),pe=K||fe.program!==Te,Me=c.style.map.terrain&&c.style.map.terrain.getTerrainData(ee),Ve=R.constantOr(null);if(Ve&&oe.imageAtlas){const Fe=oe.imageAtlas,ft=Fe.patternPositions[Ve.to.toString()],Ue=Fe.patternPositions[Ve.from.toString()];ft&&Ue&&xe.setConstantPatternPositions(ft,Ue)}const _e=Me?ee:null,be=V?vs(c,oe,_,$,_e):D?Hl(c,oe,_,D,$,_e):U?$o(c,oe,_,ue.lineClipsArray.length,_e):Un(c,oe,_,_e);if(V)B.activeTexture.set(X.TEXTURE0),oe.imageAtlasTexture.bind(X.LINEAR,X.CLAMP_TO_EDGE),xe.updatePaintBuffers($);else if(D&&(pe||c.lineAtlas.dirty))B.activeTexture.set(X.TEXTURE0),c.lineAtlas.bind(B);else if(U){const Fe=ue.gradients[_.id];let ft=Fe.texture;if(_.gradientVersion!==Fe.version){let Ue=256;if(_.stepInterpolant){const He=m.getSource().maxzoom,mt=ee.canonical.z===He?Math.ceil(1<<c.transform.maxZoom-ee.canonical.z):1;Ue=p.ac(p.aV(ue.maxLineLength/p.X*1024*mt),256,B.maxTextureSize)}Fe.gradient=p.aW({expression:_.gradientExpression(),evaluationKey:"lineProgress",resolution:Ue,image:Fe.gradient||void 0,clips:ue.lineClipsArray}),Fe.texture?Fe.texture.update(Fe.gradient):Fe.texture=new at(B,Fe.gradient,X.RGBA),Fe.version=_.gradientVersion,ft=Fe.texture}B.activeTexture.set(X.TEXTURE0),ft.bind(_.stepInterpolant?X.NEAREST:X.LINEAR,X.CLAMP_TO_EDGE)}fe.draw(B,X.TRIANGLES,S,c.stencilModeForClipping(ee),z,ot.disabled,be,Me,_.id,ue.layoutVertexBuffer,ue.indexBuffer,ue.segments,_.paint,c.transform.zoom,xe,ue.layoutVertexBuffer2),K=!1}})(e,s,a,o);break;case"fill":(function(c,m,_,y){const b=_.paint.get("fill-color"),T=_.paint.get("fill-opacity");if(T.constantOr(1)===0)return;const S=c.colorModeForRenderPass(),z=_.paint.get("fill-pattern"),D=c.opaquePassEnabledForLayer()&&!z.constantOr(1)&&b.constantOr(p.aM.transparent).a===1&&T.constantOr(0)===1?"opaque":"translucent";if(c.renderPass===D){const R=c.depthModeForSublayer(1,c.renderPass==="opaque"?Ze.ReadWrite:Ze.ReadOnly);fn(c,m,_,y,R,S,!1)}if(c.renderPass==="translucent"&&_.paint.get("fill-antialias")){const R=c.depthModeForSublayer(_.getPaintProperty("fill-outline-color")?2:0,Ze.ReadOnly);fn(c,m,_,y,R,S,!0)}})(e,s,a,o);break;case"fill-extrusion":(function(c,m,_,y){const b=_.paint.get("fill-extrusion-opacity");if(b!==0&&c.renderPass==="translucent"){const T=new Ze(c.context.gl.LEQUAL,Ze.ReadWrite,c.depthRangeFor3D);if(b!==1||_.paint.get("fill-extrusion-pattern").constantOr(1))Wn(c,m,_,y,T,ht.disabled,Tt.disabled),Wn(c,m,_,y,T,c.stencilModeFor3D(),c.colorModeForRenderPass());else{const S=c.colorModeForRenderPass();Wn(c,m,_,y,T,ht.disabled,S)}}})(e,s,a,o);break;case"hillshade":(function(c,m,_,y){if(c.renderPass!=="offscreen"&&c.renderPass!=="translucent")return;const b=c.context,T=c.depthModeForSublayer(0,Ze.ReadOnly),S=c.colorModeForRenderPass(),[z,D]=c.renderPass==="translucent"?c.stencilConfigForOverlap(y):[{},y];for(const R of D){const V=m.getTile(R);V.needsHillshadePrepare!==void 0&&V.needsHillshadePrepare&&c.renderPass==="offscreen"?Is(c,V,_,T,ht.disabled,S):c.renderPass==="translucent"&&Ss(c,R,V,_,T,z[R.overscaledZ],S)}b.viewport.set([0,0,c.width,c.height])})(e,s,a,o);break;case"raster":(function(c,m,_,y){if(c.renderPass!=="translucent"||_.paint.get("raster-opacity")===0||!y.length)return;const b=c.context,T=b.gl,S=m.getSource(),z=c.useProgram("raster"),D=c.colorModeForRenderPass(),[R,V]=S instanceof xr?[{},y]:c.stencilConfigForOverlap(y),U=V[V.length-1].overscaledZ,$=!c.options.moving;for(const Z of V){const B=c.depthModeForSublayer(Z.overscaledZ-U,_.paint.get("raster-opacity")===1?Ze.ReadWrite:Ze.ReadOnly,T.LESS),X=m.getTile(Z);X.registerFadeDuration(_.paint.get("raster-fade-duration"));const K=m.findLoadedParent(Z,0),ee=m.findLoadedSibling(Z),oe=nl(X,K||ee||null,m,_,c.transform,c.style.map.terrain);let ue,xe;const Te=_.paint.get("raster-resampling")==="nearest"?T.NEAREST:T.LINEAR;b.activeTexture.set(T.TEXTURE0),X.texture.bind(Te,T.CLAMP_TO_EDGE,T.LINEAR_MIPMAP_NEAREST),b.activeTexture.set(T.TEXTURE1),K?(K.texture.bind(Te,T.CLAMP_TO_EDGE,T.LINEAR_MIPMAP_NEAREST),ue=Math.pow(2,K.tileID.overscaledZ-X.tileID.overscaledZ),xe=[X.tileID.canonical.x*ue%1,X.tileID.canonical.y*ue%1]):X.texture.bind(Te,T.CLAMP_TO_EDGE,T.LINEAR_MIPMAP_NEAREST),X.texture.useMipmap&&b.extTextureFilterAnisotropic&&c.transform.pitch>20&&T.texParameterf(T.TEXTURE_2D,b.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,b.extTextureFilterAnisotropicMax);const fe=c.style.map.terrain&&c.style.map.terrain.getTerrainData(Z),pe=fe?Z:null,Me=pe?pe.posMatrix:c.transform.calculatePosMatrix(Z.toUnwrapped(),$),Ve=Xl(Me,xe||[0,0],ue||1,oe,_);S instanceof xr?z.draw(b,T.TRIANGLES,B,ht.disabled,D,ot.disabled,Ve,fe,_.id,S.boundsBuffer,c.quadTriangleIndexBuffer,S.boundsSegments):z.draw(b,T.TRIANGLES,B,R[Z.overscaledZ],D,ot.disabled,Ve,fe,_.id,c.rasterBoundsBuffer,c.quadTriangleIndexBuffer,c.rasterBoundsSegments)}})(e,s,a,o);break;case"background":(function(c,m,_,y){const b=_.paint.get("background-color"),T=_.paint.get("background-opacity");if(T===0)return;const S=c.context,z=S.gl,D=c.transform,R=D.tileSize,V=_.paint.get("background-pattern");if(c.isPatternMissing(V))return;const U=!V&&b.a===1&&T===1&&c.opaquePassEnabledForLayer()?"opaque":"translucent";if(c.renderPass!==U)return;const $=ht.disabled,Z=c.depthModeForSublayer(0,U==="opaque"?Ze.ReadWrite:Ze.ReadOnly),B=c.colorModeForRenderPass(),X=c.useProgram(V?"backgroundPattern":"background"),K=y||D.coveringTiles({tileSize:R,terrain:c.style.map.terrain});V&&(S.activeTexture.set(z.TEXTURE0),c.imageManager.bind(c.context));const ee=_.getCrossfadeParameters();for(const oe of K){const ue=y?oe.posMatrix:c.transform.calculatePosMatrix(oe.toUnwrapped()),xe=V?Va(ue,T,c,V,{tileID:oe,tileSize:R},ee):$n(ue,T,b),Te=c.style.map.terrain&&c.style.map.terrain.getTerrainData(oe);X.draw(S,z.TRIANGLES,Z,$,B,ot.disabled,xe,Te,_.id,c.tileExtentBuffer,c.quadTriangleIndexBuffer,c.tileExtentSegments)}})(e,0,a,o);break;case"custom":(function(c,m,_){const y=c.context,b=_.implementation;if(c.renderPass==="offscreen"){const T=b.prerender;T&&(c.setCustomLayerDefaults(),y.setColorMode(c.colorModeForRenderPass()),T.call(b,y.gl,c.transform.customLayerMatrix()),y.setDirty(),c.setBaseState())}else if(c.renderPass==="translucent"){c.setCustomLayerDefaults(),y.setColorMode(c.colorModeForRenderPass()),y.setStencilMode(ht.disabled);const T=b.renderingMode==="3d"?new Ze(c.context.gl.LEQUAL,Ze.ReadWrite,c.depthRangeFor3D):c.depthModeForSublayer(0,Ze.ReadOnly);y.setDepthMode(T),b.render(y.gl,c.transform.customLayerMatrix(),{farZ:c.transform.farZ,nearZ:c.transform.nearZ,fov:c.transform._fov,modelViewProjectionMatrix:c.transform.modelViewProjectionMatrix,projectionMatrix:c.transform.projectionMatrix}),y.setDirty(),c.setBaseState(),y.bindFramebuffer.set(null)}})(e,0,a)}}translatePosMatrix(e,s,a,o,c){if(!a[0]&&!a[1])return e;const m=c?o==="map"?this.transform.angle:0:o==="viewport"?-this.transform.angle:0;if(m){const b=Math.sin(m),T=Math.cos(m);a=[a[0]*T-a[1]*b,a[0]*b+a[1]*T]}const _=[c?a[0]:Ge(s,a[0],this.transform.zoom),c?a[1]:Ge(s,a[1],this.transform.zoom),0],y=new Float32Array(16);return p.J(y,e,_),y}saveTileTexture(e){const s=this._tileTextures[e.size[0]];s?s.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const s=this._tileTextures[e];return s&&s.length>0?s.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const s=this.imageManager.getPattern(e.from.toString()),a=this.imageManager.getPattern(e.to.toString());return!s||!a}useProgram(e,s){this.cache=this.cache||{};const a=e+(s?s.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[a]||(this.cache[a]=new Fa(this.context,Lr[e],s,Na[e],this._showOverdrawInspector,this.style.map.terrain)),this.cache[a]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new at(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:e,drawingBufferHeight:s}=this.context.gl;return this.width!==e||this.height!==s}}class As{constructor(e,s){this.points=e,this.planes=s}static fromInvProjectionMatrix(e,s,a){const o=Math.pow(2,a),c=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(_=>{const y=1/(_=p.af([],_,e))[3]/s*o;return p.b1(_,_,[y,y,1/_[3],y])}),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(_=>{const y=function(z,D){var R=D[0],V=D[1],U=D[2],$=R*R+V*V+U*U;return $>0&&($=1/Math.sqrt($)),z[0]=D[0]*$,z[1]=D[1]*$,z[2]=D[2]*$,z}([],function(z,D,R){var V=D[0],U=D[1],$=D[2],Z=R[0],B=R[1],X=R[2];return z[0]=U*X-$*B,z[1]=$*Z-V*X,z[2]=V*B-U*Z,z}([],Ii([],c[_[0]],c[_[1]]),Ii([],c[_[2]],c[_[1]]))),b=-((T=y)[0]*(S=c[_[1]])[0]+T[1]*S[1]+T[2]*S[2]);var T,S;return y.concat(b)});return new As(c,m)}}class Ms{constructor(e,s){this.min=e,this.max=s,this.center=function(a,o,c){return a[0]=.5*o[0],a[1]=.5*o[1],a[2]=.5*o[2],a}([],function(a,o,c){return a[0]=o[0]+c[0],a[1]=o[1]+c[1],a[2]=o[2]+c[2],a}([],this.min,this.max))}quadrant(e){const s=[e%2==0,e<2],a=Bi(this.min),o=Bi(this.max);for(let c=0;c<s.length;c++)a[c]=s[c]?this.min[c]:this.center[c],o[c]=s[c]?this.center[c]:this.max[c];return o[2]=this.max[2],new Ms(a,o)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersects(e){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 a=!0;for(let o=0;o<e.planes.length;o++){const c=e.planes[o];let m=0;for(let _=0;_<s.length;_++)p.b2(c,s[_])>=0&&m++;if(m===0)return 0;m!==s.length&&(a=!1)}if(a)return 2;for(let o=0;o<3;o++){let c=Number.MAX_VALUE,m=-Number.MAX_VALUE;for(let _=0;_<e.points.length;_++){const y=e.points[_][o]-this.min[o];c=Math.min(c,y),m=Math.max(m,y)}if(m<0||c>this.max[o]-this.min[o])return 0}return 1}}class zs{constructor(e=0,s=0,a=0,o=0){if(isNaN(e)||e<0||isNaN(s)||s<0||isNaN(a)||a<0||isNaN(o)||o<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=s,this.left=a,this.right=o}interpolate(e,s,a){return s.top!=null&&e.top!=null&&(this.top=p.y.number(e.top,s.top,a)),s.bottom!=null&&e.bottom!=null&&(this.bottom=p.y.number(e.bottom,s.bottom,a)),s.left!=null&&e.left!=null&&(this.left=p.y.number(e.left,s.left,a)),s.right!=null&&e.right!=null&&(this.right=p.y.number(e.right,s.right,a)),this}getCenter(e,s){const a=p.ac((this.left+e-this.right)/2,0,e),o=p.ac((this.top+s-this.bottom)/2,0,s);return new p.P(a,o)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new zs(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const eo=85.051129;class Cs{constructor(e,s,a,o,c){this.tileSize=512,this._renderWorldCopies=c===void 0||!!c,this._minZoom=e||0,this._maxZoom=s||22,this._minPitch=a??0,this._maxPitch=o??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new p.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new zs,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const e=new Cs(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return e.apply(this),e}apply(e){this.tileSize=e.tileSize,this.latRange=e.latRange,this.lngRange=e.lngRange,this.width=e.width,this.height=e.height,this._center=e._center,this._elevation=e._elevation,this.minElevationForCurrentTile=e.minElevationForCurrentTile,this.zoom=e.zoom,this.angle=e.angle,this._fov=e._fov,this._pitch=e._pitch,this._unmodified=e._unmodified,this._edgeInsets=e._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new p.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){const s=-p.b3(e,-180,180)*Math.PI/180;this.angle!==s&&(this._unmodified=!1,this.angle=s,this._calcMatrices(),this.rotationMatrix=function(){var a=new p.A(4);return p.A!=Float32Array&&(a[1]=0,a[2]=0),a[0]=1,a[3]=1,a}(),function(a,o,c){var m=o[0],_=o[1],y=o[2],b=o[3],T=Math.sin(c),S=Math.cos(c);a[0]=m*S+y*T,a[1]=_*S+b*T,a[2]=m*-T+y*S,a[3]=_*-T+b*S}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){const s=p.ac(e,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(e){e=Math.max(.01,Math.min(60,e)),this._fov!==e&&(this._unmodified=!1,this._fov=e/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(e){const s=Math.min(Math.max(e,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(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,s,a){this._unmodified=!1,this._edgeInsets.interpolate(e,s,a),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){const s=(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,s)}getVisibleUnwrappedCoordinates(e){const s=[new p.b4(0,e)];if(this._renderWorldCopies){const a=this.pointCoordinate(new p.P(0,0)),o=this.pointCoordinate(new p.P(this.width,0)),c=this.pointCoordinate(new p.P(this.width,this.height)),m=this.pointCoordinate(new p.P(0,this.height)),_=Math.floor(Math.min(a.x,o.x,c.x,m.x)),y=Math.floor(Math.max(a.x,o.x,c.x,m.x)),b=1;for(let T=_-b;T<=y+b;T++)T!==0&&s.push(new p.b4(T,e))}return s}coveringTiles(e){var s,a;let o=this.coveringZoomLevel(e);const c=o;if(e.minzoom!==void 0&&o<e.minzoom)return[];e.maxzoom!==void 0&&o>e.maxzoom&&(o=e.maxzoom);const m=this.pointCoordinate(this.getCameraPoint()),_=p.Z.fromLngLat(this.center),y=Math.pow(2,o),b=[y*m.x,y*m.y,0],T=[y*_.x,y*_.y,0],S=As.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,o);let z=e.minzoom||0;!e.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(z=o);const D=e.terrain?2/Math.min(this.tileSize,e.tileSize)*this.tileSize:3,R=B=>({aabb:new Ms([B*y,0,0],[(B+1)*y,y,0]),zoom:0,x:0,y:0,wrap:B,fullyVisible:!1}),V=[],U=[],$=o,Z=e.reparseOverscaled?c:o;if(this._renderWorldCopies)for(let B=1;B<=3;B++)V.push(R(-B)),V.push(R(B));for(V.push(R(0));V.length>0;){const B=V.pop(),X=B.x,K=B.y;let ee=B.fullyVisible;if(!ee){const fe=B.aabb.intersects(S);if(fe===0)continue;ee=fe===2}const oe=e.terrain?b:T,ue=B.aabb.distanceX(oe),xe=B.aabb.distanceY(oe),Te=Math.max(Math.abs(ue),Math.abs(xe));if(B.zoom===$||Te>D+(1<<$-B.zoom)-2&&B.zoom>=z){const fe=$-B.zoom,pe=b[0]-.5-(X<<fe),Me=b[1]-.5-(K<<fe);U.push({tileID:new p.S(B.zoom===$?Z:B.zoom,B.wrap,B.zoom,X,K),distanceSq:Dn([T[0]-.5-X,T[1]-.5-K]),tileDistanceToCamera:Math.sqrt(pe*pe+Me*Me)})}else for(let fe=0;fe<4;fe++){const pe=(X<<1)+fe%2,Me=(K<<1)+(fe>>1),Ve=B.zoom+1;let _e=B.aabb.quadrant(fe);if(e.terrain){const be=new p.S(Ve,B.wrap,Ve,pe,Me),Fe=e.terrain.getMinMaxElevation(be),ft=(s=Fe.minElevation)!==null&&s!==void 0?s:this.elevation,Ue=(a=Fe.maxElevation)!==null&&a!==void 0?a:this.elevation;_e=new Ms([_e.min[0],_e.min[1],ft],[_e.max[0],_e.max[1],Ue])}V.push({aabb:_e,zoom:Ve,x:pe,y:Me,wrap:B.wrap,fullyVisible:ee})}}return U.sort((B,X)=>B.distanceSq-X.distanceSq).map(B=>B.tileID)}resize(e,s){this.width=e,this.height=s,this.pixelsToGLUnits=[2/e,-2/s],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(e){const s=p.ac(e.lat,-85.051129,eo);return new p.P(p.O(e.lng)*this.worldSize,p.Q(s)*this.worldSize)}unproject(e){return new p.Z(e.x/this.worldSize,e.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(e){const s=this.elevation,a=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,o=this.pointLocation(this.centerPoint,e),c=e.getElevationForLngLatZoom(o,this.tileZoom);if(!(this.elevation-c))return;const m=a+s-c,_=Math.cos(this._pitch)*this.cameraToCenterDistance/m/p.b5(1,o.lat),y=this.scaleZoom(_/this.tileSize);this._elevation=c,this._center=o,this.zoom=y}setLocationAtPoint(e,s){const a=this.pointCoordinate(s),o=this.pointCoordinate(this.centerPoint),c=this.locationCoordinate(e),m=new p.Z(c.x-(a.x-o.x),c.y-(a.y-o.y));this.center=this.coordinateLocation(m),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(e,s){return s?this.coordinatePoint(this.locationCoordinate(e),s.getElevationForLngLatZoom(e,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(e))}pointLocation(e,s){return this.coordinateLocation(this.pointCoordinate(e,s))}locationCoordinate(e){return p.Z.fromLngLat(e)}coordinateLocation(e){return e&&e.toLngLat()}pointCoordinate(e,s){if(s){const z=s.pointCoordinate(e);if(z!=null)return z}const a=[e.x,e.y,0,1],o=[e.x,e.y,1,1];p.af(a,a,this.pixelMatrixInverse),p.af(o,o,this.pixelMatrixInverse);const c=a[3],m=o[3],_=a[1]/c,y=o[1]/m,b=a[2]/c,T=o[2]/m,S=b===T?0:(0-b)/(T-b);return new p.Z(p.y.number(a[0]/c,o[0]/m,S)/this.worldSize,p.y.number(_,y,S)/this.worldSize)}coordinatePoint(e,s=0,a=this.pixelMatrix){const o=[e.x*this.worldSize,e.y*this.worldSize,s,1];return p.af(o,o,a),new p.P(o[0]/o[3],o[1]/o[3])}getBounds(){const e=Math.max(0,this.height/2-this.getHorizon());return new ie().extend(this.pointLocation(new p.P(0,e))).extend(this.pointLocation(new p.P(this.width,e))).extend(this.pointLocation(new p.P(this.width,this.height))).extend(this.pointLocation(new p.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new ie([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(e){e?(this.lngRange=[e.getWest(),e.getEast()],this.latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,eo])}calculateTileMatrix(e){const s=e.canonical,a=this.worldSize/this.zoomScale(s.z),o=s.x+Math.pow(2,s.z)*e.wrap,c=p.an(new Float64Array(16));return p.J(c,c,[o*a,s.y*a,0]),p.K(c,c,[a/p.X,a/p.X,1]),c}calculatePosMatrix(e,s=!1){const a=e.key,o=s?this._alignedPosMatrixCache:this._posMatrixCache;if(o[a])return o[a];const c=this.calculateTileMatrix(e);return p.L(c,s?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,c),o[a]=new Float32Array(c),o[a]}calculateFogMatrix(e){const s=e.key,a=this._fogMatrixCache;if(a[s])return a[s];const o=this.calculateTileMatrix(e);return p.L(o,this.fogMatrix,o),a[s]=new Float32Array(o),a[s]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(e,s){s=p.ac(+s,this.minZoom,this.maxZoom);const a={center:new p.N(e.lng,e.lat),zoom:s};let o=this.lngRange;if(!this._renderWorldCopies&&o===null){const B=179.9999999999;o=[-B,B]}const c=this.tileSize*this.zoomScale(a.zoom);let m=0,_=c,y=0,b=c,T=0,S=0;const{x:z,y:D}=this.size;if(this.latRange){const B=this.latRange;m=p.Q(B[1])*c,_=p.Q(B[0])*c,_-m<D&&(T=D/(_-m))}o&&(y=p.b3(p.O(o[0])*c,0,c),b=p.b3(p.O(o[1])*c,0,c),b<y&&(b+=c),b-y<z&&(S=z/(b-y)));const{x:R,y:V}=this.project.call({worldSize:c},e);let U,$;const Z=Math.max(S||0,T||0);if(Z){const B=new p.P(S?(b+y)/2:R,T?(_+m)/2:V);return a.center=this.unproject.call({worldSize:c},B).wrap(),a.zoom+=this.scaleZoom(Z),a}if(this.latRange){const B=D/2;V-B<m&&($=m+B),V+B>_&&($=_-B)}if(o){const B=(y+b)/2;let X=R;this._renderWorldCopies&&(X=p.b3(R,B-c/2,B+c/2));const K=z/2;X-K<y&&(U=y+K),X+K>b&&(U=b-K)}if(U!==void 0||$!==void 0){const B=new p.P(U??R,$??V);a.center=this.unproject.call({worldSize:c},B).wrap()}return a}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const e=this._unmodified,{center:s,zoom:a}=this.getConstrained(this.center,this.zoom);this.center=s,this.zoom=a,this._unmodified=e,this._constraining=!1}_calcMatrices(){if(!this.height)return;const e=this.centerOffset,s=this.point.x,a=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=p.b5(1,this.center.lat)*this.worldSize;let o=p.an(new Float64Array(16));p.K(o,o,[this.width/2,-this.height/2,1]),p.J(o,o,[1,-1,0]),this.labelPlaneMatrix=o,o=p.an(new Float64Array(16)),p.K(o,o,[1,-1,1]),p.J(o,o,[-1,-1,0]),p.K(o,o,[2/this.width,2/this.height,1]),this.glCoordMatrix=o;const c=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),m=Math.min(this.elevation,this.minElevationForCurrentTile),_=c-m*this._pixelPerMeter/Math.cos(this._pitch),y=m<0?_:c,b=Math.PI/2+this._pitch,T=this._fov*(.5+e.y/this.height),S=Math.sin(T)*y/Math.sin(p.ac(Math.PI-b-T,.01,Math.PI-.01)),z=this.getHorizon(),D=2*Math.atan(z/this.cameraToCenterDistance)*(.5+e.y/(2*z)),R=Math.sin(D)*y/Math.sin(p.ac(Math.PI-b-D,.01,Math.PI-.01)),V=Math.min(S,R);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*V+y),this.nearZ=this.height/50,o=new Float64Array(16),p.b6(o,this._fov,this.width/this.height,this.nearZ,this.farZ),o[8]=2*-e.x/this.width,o[9]=2*e.y/this.height,this.projectionMatrix=p.ae(o),p.K(o,o,[1,-1,1]),p.J(o,o,[0,0,-this.cameraToCenterDistance]),p.b7(o,o,this._pitch),p.ad(o,o,this.angle),p.J(o,o,[-s,-a,0]),this.mercatorMatrix=p.K([],o,[this.worldSize,this.worldSize,this.worldSize]),p.K(o,o,[1,1,this._pixelPerMeter]),this.pixelMatrix=p.L(new Float64Array(16),this.labelPlaneMatrix,o),p.J(o,o,[0,0,-this.elevation]),this.modelViewProjectionMatrix=o,this.invModelViewProjectionMatrix=p.as([],o),this.fogMatrix=new Float64Array(16),p.b6(this.fogMatrix,this._fov,this.width/this.height,c,this.farZ),this.fogMatrix[8]=2*-e.x/this.width,this.fogMatrix[9]=2*e.y/this.height,p.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),p.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),p.b7(this.fogMatrix,this.fogMatrix,this._pitch),p.ad(this.fogMatrix,this.fogMatrix,this.angle),p.J(this.fogMatrix,this.fogMatrix,[-s,-a,0]),p.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),p.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=p.L(new Float64Array(16),this.labelPlaneMatrix,o);const U=this.width%2/2,$=this.height%2/2,Z=Math.cos(this.angle),B=Math.sin(this.angle),X=s-Math.round(s)+Z*U+B*$,K=a-Math.round(a)+Z*$+B*U,ee=new Float64Array(o);if(p.J(ee,ee,[X>.5?X-1:X,K>.5?K-1:K,0]),this.alignedModelViewProjectionMatrix=ee,o=p.as(new Float64Array(16),this.pixelMatrix),!o)throw new Error("failed to invert matrix");this.pixelMatrixInverse=o,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const e=this.pointCoordinate(new p.P(0,0)),s=[e.x*this.worldSize,e.y*this.worldSize,0,1];return p.af(s,s,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new p.P(0,e))}getCameraQueryGeometry(e){const s=this.getCameraPoint();if(e.length===1)return[e[0],s];{let a=s.x,o=s.y,c=s.x,m=s.y;for(const _ of e)a=Math.min(a,_.x),o=Math.min(o,_.y),c=Math.max(c,_.x),m=Math.max(m,_.y);return[new p.P(a,o),new p.P(c,o),new p.P(c,m),new p.P(a,m),new p.P(a,o)]}}lngLatToCameraDepth(e,s){const a=this.locationCoordinate(e),o=[a.x*this.worldSize,a.y*this.worldSize,s,1];return p.af(o,o,this.modelViewProjectionMatrix),o[2]/o[3]}}function mn(u,e){let s,a=!1,o=null,c=null;const m=()=>{o=null,a&&(u.apply(c,s),o=setTimeout(m,e),a=!1)};return(..._)=>(a=!0,c=this,s=_,o||m(),o)}class ea{constructor(e){this._getCurrentHash=()=>{const s=window.location.hash.replace("#","");if(this._hashName){let a;return s.split("&").map(o=>o.split("=")).forEach(o=>{o[0]===this._hashName&&(a=o)}),(a&&a[1]||"").split("/")}return s.split("/")},this._onHashChange=()=>{const s=this._getCurrentHash();if(s.length>=3&&!s.some(a=>isNaN(a))){const a=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:a,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 a=s.join("/");let o=a;o.split("&").length>0&&(o=o.split("&")[0]),this._hashName&&(o=`${this._hashName}=${a}`);let c=window.location.hash.replace(o,"");c.startsWith("#&")?c=c.slice(0,1)+c.slice(2):c==="#"&&(c="");let m=window.location.href.replace(/(#.+)?$/,c);m=m.replace("&&","&"),window.history.replaceState(window.history.state,null,m)},this._updateHash=mn(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){const s=this._map.getCenter(),a=Math.round(100*this._map.getZoom())/100,o=Math.ceil((a*Math.LN2+Math.log(512/360/.5))/Math.LN10),c=Math.pow(10,o),m=Math.round(s.lng*c)/c,_=Math.round(s.lat*c)/c,y=this._map.getBearing(),b=this._map.getPitch();let T="";if(T+=e?`/${m}/${_}/${a}`:`${a}/${_}/${m}`,(y||b)&&(T+="/"+Math.round(10*y)/10),b&&(T+=`/${Math.round(b)}`),this._hashName){const S=this._hashName;let z=!1;const D=window.location.hash.slice(1).split("&").map(R=>{const V=R.split("=")[0];return V===S?(z=!0,`${V}=${T}`):R}).filter(R=>R);return z||D.push(`${S}=${T}`),`#${D.join("&")}`}return`#${T}`}}const ta={linearity:.3,easing:p.b8(0,0,.3,1)},to=p.e({deceleration:2500,maxSpeed:1400},ta),oc=p.e({deceleration:20,maxSpeed:1400},ta),ul=p.e({deceleration:1e3,maxSpeed:360},ta),ia=p.e({deceleration:1e3,maxSpeed:90},ta);class io{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:me.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,s=me.now();for(;e.length>0&&s-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const s={zoom:0,bearing:0,pitch:0,pan:new p.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:c}of this._inertiaBuffer)s.zoom+=c.zoomDelta||0,s.bearing+=c.bearingDelta||0,s.pitch+=c.pitchDelta||0,c.panDelta&&s.pan._add(c.panDelta),c.around&&(s.around=c.around),c.pinchAround&&(s.pinchAround=c.pinchAround);const a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,o={};if(s.pan.mag()){const c=_n(s.pan.mag(),a,p.e({},to,e||{}));o.offset=s.pan.mult(c.amount/s.pan.mag()),o.center=this._map.transform.center,gn(o,c)}if(s.zoom){const c=_n(s.zoom,a,oc);o.zoom=this._map.transform.zoom+c.amount,gn(o,c)}if(s.bearing){const c=_n(s.bearing,a,ul);o.bearing=this._map.transform.bearing+p.ac(c.amount,-179,179),gn(o,c)}if(s.pitch){const c=_n(s.pitch,a,ia);o.pitch=this._map.transform.pitch+c.amount,gn(o,c)}if(o.zoom||o.bearing){const c=s.pinchAround===void 0?s.around:s.pinchAround;o.around=c?this._map.unproject(c):this._map.getCenter()}return this.clear(),p.e(o,{noMoveStart:!0})}}function gn(u,e){(!u.duration||u.duration<e.duration)&&(u.duration=e.duration,u.easing=e.easing)}function _n(u,e,s){const{maxSpeed:a,linearity:o,deceleration:c}=s,m=p.ac(u*o/(e/1e3),-a,a),_=Math.abs(m)/(c*o);return{easing:s.easing,duration:1e3*_,amount:m*(_/2)}}class Ut extends p.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,s,a,o={}){const c=ne.mousePos(s.getCanvas(),a),m=s.unproject(c);super(e,p.e({point:c,lngLat:m,originalEvent:a},o)),this._defaultPrevented=!1,this.target=s}}class is extends p.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,s,a){const o=e==="touchend"?a.changedTouches:a.touches,c=ne.touchPos(s.getCanvasContainer(),o),m=c.map(y=>s.unproject(y)),_=c.reduce((y,b,T,S)=>y.add(b.div(S.length)),new p.P(0,0));super(e,{points:c,point:_,lngLats:m,lngLat:s.unproject(_),originalEvent:a}),this._defaultPrevented=!1}}class hl extends p.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,s,a){super(e,{originalEvent:a}),this._defaultPrevented=!1}}class dl{constructor(e,s){this._map=e,this._clickTolerance=s.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new hl(e.type,this._map,e))}mousedown(e,s){return this._mousedownPos=s,this._firePreventable(new Ut(e.type,this._map,e))}mouseup(e){this._map.fire(new Ut(e.type,this._map,e))}click(e,s){this._mousedownPos&&this._mousedownPos.dist(s)>=this._clickTolerance||this._map.fire(new Ut(e.type,this._map,e))}dblclick(e){return this._firePreventable(new Ut(e.type,this._map,e))}mouseover(e){this._map.fire(new Ut(e.type,this._map,e))}mouseout(e){this._map.fire(new Ut(e.type,this._map,e))}touchstart(e){return this._firePreventable(new is(e.type,this._map,e))}touchmove(e){this._map.fire(new is(e.type,this._map,e))}touchend(e){this._map.fire(new is(e.type,this._map,e))}touchcancel(e){this._map.fire(new is(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class St{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new Ut(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ut("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new Ut(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class $i{constructor(e){this._map=e}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.pointLocation(p.P.convert(e),this._map.terrain)}}class vi{constructor(e,s){this._map=e,this._tr=new $i(e),this._el=e.getCanvasContainer(),this._container=e.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(e,s){this.isEnabled()&&e.shiftKey&&e.button===0&&(ne.disableDrag(),this._startPos=this._lastPos=s,this._active=!0)}mousemoveWindow(e,s){if(!this._active)return;const a=s;if(this._lastPos.equals(a)||!this._box&&a.dist(this._startPos)<this._clickTolerance)return;const o=this._startPos;this._lastPos=a,this._box||(this._box=ne.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));const c=Math.min(o.x,a.x),m=Math.max(o.x,a.x),_=Math.min(o.y,a.y),y=Math.max(o.y,a.y);ne.setTransform(this._box,`translate(${c}px,${_}px)`),this._box.style.width=m-c+"px",this._box.style.height=y-_+"px"}mouseupWindow(e,s){if(!this._active||e.button!==0)return;const a=this._startPos,o=s;if(this.reset(),ne.suppressClick(),a.x!==o.x||a.y!==o.y)return this._map.fire(new p.k("boxzoomend",{originalEvent:e})),{cameraAnimation:c=>c.fitScreenCoordinates(a,o,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(ne.remove(this._box),this._box=null),ne.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,s){return this._map.fire(new p.k(e,{originalEvent:s}))}}function yn(u,e){if(u.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${u.length}, points ${e.length}`);const s={};for(let a=0;a<u.length;a++)s[u[a].identifier]=e[a];return s}class ro{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,s,a){(this.centroid||a.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),a.length===this.numTouches&&(this.centroid=function(o){const c=new p.P(0,0);for(const m of o)c._add(m);return c.div(o.length)}(s),this.touches=yn(a,s)))}touchmove(e,s,a){if(this.aborted||!this.centroid)return;const o=yn(a,s);for(const c in this.touches){const m=o[c];(!m||m.dist(this.touches[c])>30)&&(this.aborted=!0)}}touchend(e,s,a){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),a.length===0){const o=!this.aborted&&this.centroid;if(this.reset(),o)return o}}}class ra{constructor(e){this.singleTap=new ro(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,s,a){this.singleTap.touchstart(e,s,a)}touchmove(e,s,a){this.singleTap.touchmove(e,s,a)}touchend(e,s,a){const o=this.singleTap.touchend(e,s,a);if(o){const c=e.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(o)<30;if(c&&m||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=o,this.count===this.numTaps)return this.reset(),o}}}class ks{constructor(e){this._tr=new $i(e),this._zoomIn=new ra({numTouches:1,numTaps:2}),this._zoomOut=new ra({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,s,a){this._zoomIn.touchstart(e,s,a),this._zoomOut.touchstart(e,s,a)}touchmove(e,s,a){this._zoomIn.touchmove(e,s,a),this._zoomOut.touchmove(e,s,a)}touchend(e,s,a){const o=this._zoomIn.touchend(e,s,a),c=this._zoomOut.touchend(e,s,a),m=this._tr;return o?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:m.zoom+1,around:m.unproject(o)},{originalEvent:e})}):c?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:m.zoom-1,around:m.unproject(c)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class wr{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){const s=this._moveFunction(...e);if(s.bearingDelta||s.pitchDelta||s.around||s.panDelta)return this._active=!0,s}dragStart(e,s){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=s.length?s[0]:s,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,s){if(!this.isEnabled())return;const a=this._lastPoint;if(!a)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const o=s.length?s[0]:s;return!this._moved&&o.dist(a)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=o,this._move(a,o))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&ne.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const so={0:1,2:2};class sa{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const s=ne.mouseButton(e);this._eventButton=s}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(s,a){const o=so[a];return s.buttons===void 0||(s.buttons&o)!==o}(e,this._eventButton)}isValidEndEvent(e){return ne.mouseButton(e)===this._eventButton}}class no{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}}const na=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=e=>{e.preventDefault()}},ao=({enable:u,clickTolerance:e,bearingDegreesPerPixelMoved:s=.8})=>{const a=new sa({checkCorrectEvent:o=>ne.mouseButton(o)===0&&o.ctrlKey||ne.mouseButton(o)===2});return new wr({clickTolerance:e,move:(o,c)=>({bearingDelta:(c.x-o.x)*s}),moveStateManager:a,enable:u,assignEvents:na})},oo=({enable:u,clickTolerance:e,pitchDegreesPerPixelMoved:s=-.5})=>{const a=new sa({checkCorrectEvent:o=>ne.mouseButton(o)===0&&o.ctrlKey||ne.mouseButton(o)===2});return new wr({clickTolerance:e,move:(o,c)=>({pitchDelta:(c.y-o.y)*s}),moveStateManager:a,enable:u,assignEvents:na})};class rs{constructor(e,s){this._clickTolerance=e.clickTolerance||1,this._map=s,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new p.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,s,a){return this._calculateTransform(e,s,a)}touchmove(e,s,a){if(this._active){if(!this._shouldBePrevented(a.length))return e.preventDefault(),this._calculateTransform(e,s,a);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,s,a){this._calculateTransform(e,s,a),this._active&&this._shouldBePrevented(a.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,s,a){a.length>0&&(this._active=!0);const o=yn(a,s),c=new p.P(0,0),m=new p.P(0,0);let _=0;for(const b in o){const T=o[b],S=this._touches[b];S&&(c._add(T),m._add(T.sub(S)),_++,o[b]=T)}if(this._touches=o,this._shouldBePrevented(_)||!m.mag())return;const y=m.div(_);return this._sum._add(y),this._sum.mag()<this._clickTolerance?void 0:{around:c.div(_),panDelta:y}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class aa{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,s,a){this._firstTwoTouches||a.length<2||(this._firstTwoTouches=[a[0].identifier,a[1].identifier],this._start([s[0],s[1]]))}touchmove(e,s,a){if(!this._firstTwoTouches)return;e.preventDefault();const[o,c]=this._firstTwoTouches,m=xn(a,s,o),_=xn(a,s,c);if(!m||!_)return;const y=this._aroundCenter?null:m.add(_).div(2);return this._move([m,_],y,e)}touchend(e,s,a){if(!this._firstTwoTouches)return;const[o,c]=this._firstTwoTouches,m=xn(a,s,o),_=xn(a,s,c);m&&_||(this._active&&ne.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function xn(u,e,s){for(let a=0;a<u.length;a++)if(u[a].identifier===s)return e[a]}function lo(u,e){return Math.log(u/e)/Math.LN2}class co extends aa{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,s){const a=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(lo(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:lo(this._distance,a),pinchAround:s}}}function uo(u,e){return 180*u.angleWith(e)/Math.PI}class ho extends aa{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,s,a){const o=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:uo(this._vector,o),pinchAround:s}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const s=25/(Math.PI*this._minDiameter)*360,a=uo(e,this._startVector);return Math.abs(a)<s}}function oa(u){return Math.abs(u.y)>Math.abs(u.x)}class vn extends aa{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,s,a){super.touchstart(e,s,a),this._currentTouchCount=a.length}_start(e){this._lastPoints=e,oa(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,s,a){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const o=e[0].sub(this._lastPoints[0]),c=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(o,c,a.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(o.y+c.y)/2*-.5}):void 0}gestureBeginsVertically(e,s,a){if(this._valid!==void 0)return this._valid;const o=e.mag()>=2,c=s.mag()>=2;if(!o&&!c)return;if(!o||!c)return this._firstMove===void 0&&(this._firstMove=a),a-this._firstMove<100&&void 0;const m=e.y>0==s.y>0;return oa(e)&&oa(s)&&m}}const pl={panStep:100,bearingStep:15,pitchStep:10};class zi{constructor(e){this._tr=new $i(e);const s=pl;this._panStep=s.panStep,this._bearingStep=s.bearingStep,this._pitchStep=s.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let s=0,a=0,o=0,c=0,m=0;switch(e.keyCode){case 61:case 107:case 171:case 187:s=1;break;case 189:case 109:case 173:s=-1;break;case 37:e.shiftKey?a=-1:(e.preventDefault(),c=-1);break;case 39:e.shiftKey?a=1:(e.preventDefault(),c=1);break;case 38:e.shiftKey?o=1:(e.preventDefault(),m=-1);break;case 40:e.shiftKey?o=-1:(e.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(a=0,o=0),{cameraAnimation:_=>{const y=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:ur,zoom:s?Math.round(y.zoom)+s*(e.shiftKey?2:1):y.zoom,bearing:y.bearing+a*this._bearingStep,pitch:y.pitch+o*this._pitchStep,offset:[-c*this._panStep,-m*this._panStep],center:y.center},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function ur(u){return u*(2-u)}const po=4.000244140625;class qi{constructor(e,s){this._onTimeout=a=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(a)},this._map=e,this._tr=new $i(e),this._triggerRenderFrame=s,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let s=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const a=me.now(),o=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,s!==0&&s%po==0?this._type="wheel":s!==0&&Math.abs(s)<4?this._type="trackpad":o>400?(this._type=null,this._lastValue=s,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(o*s)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,s+=this._lastValue)),e.shiftKey&&s&&(s/=4),this._type&&(this._lastWheelEvent=e,this._delta-=s,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const s=ne.mousePos(this._map.getCanvas(),e),a=this._tr;this._around=s.y>a.transform.height/2-a.transform.getHorizon()?p.N.convert(this._aroundCenter?a.center:a.unproject(s)):p.N.convert(a.center),this._aroundPoint=a.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const e=this._tr.transform;if(this._delta!==0){const y=this._type==="wheel"&&Math.abs(this._delta)>po?this._wheelZoomRate:this._defaultZoomRate;let b=2/(1+Math.exp(-Math.abs(this._delta*y)));this._delta<0&&b!==0&&(b=1/b);const T=typeof this._targetZoom=="number"?e.zoomScale(this._targetZoom):e.scale;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(T*b))),this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const s=typeof this._targetZoom=="number"?this._targetZoom:e.zoom,a=this._startZoom,o=this._easing;let c,m=!1;const _=me.now()-this._lastWheelEventTime;if(this._type==="wheel"&&a&&o&&_){const y=Math.min(_/200,1),b=o(y);c=p.y.number(a,s,b),y<1?this._frameId||(this._frameId=!0):m=!0}else c=s,m=!0;return this._active=!0,m&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!m,zoomDelta:c-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let s=p.b9;if(this._prevEase){const a=this._prevEase,o=(me.now()-a.start)/a.duration,c=a.easing(o+.01)-a.easing(o),m=.27/Math.sqrt(c*c+1e-4)*.01,_=Math.sqrt(.0729-m*m);s=p.b8(m,_,.25,1)}return this._prevEase={start:me.now(),duration:e,easing:s},s}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class ss{constructor(e,s){this._clickZoom=e,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 lc{constructor(e){this._tr=new $i(e),this.reset()}reset(){this._active=!1}dblclick(e,s){return e.preventDefault(),{cameraAnimation:a=>{a.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(s)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class cc{constructor(){this._tap=new ra({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,s,a){if(!this._swipePoint)if(this._tapTime){const o=s[0],c=e.timeStamp-this._tapTime<500,m=this._tapPoint.dist(o)<30;c&&m?a.length>0&&(this._swipePoint=o,this._swipeTouch=a[0].identifier):this.reset()}else this._tap.touchstart(e,s,a)}touchmove(e,s,a){if(this._tapTime){if(this._swipePoint){if(a[0].identifier!==this._swipeTouch)return;const o=s[0],c=o.y-this._swipePoint.y;return this._swipePoint=o,e.preventDefault(),this._active=!0,{zoomDelta:c/128}}}else this._tap.touchmove(e,s,a)}touchend(e,s,a){if(this._tapTime)this._swipePoint&&a.length===0&&this.reset();else{const o=this._tap.touchend(e,s,a);o&&(this._tapTime=e.timeStamp,this._tapPoint=o)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class fl{constructor(e,s,a){this._el=e,this._mousePan=s,this._touchPan=a}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class ml{constructor(e,s,a){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=s,this._mousePitch=a}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 fo{constructor(e,s,a,o){this._el=e,this._touchZoom=s,this._touchRotate=a,this._tapDragZoom=o,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class Es{constructor(e,s){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=s,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=ne.create("div","maplibregl-cooperative-gesture-screen",e);let s=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(s=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const a=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),o=document.createElement("div");o.className="maplibregl-desktop-message",o.textContent=s,this._container.appendChild(o);const c=document.createElement("div");c.className="maplibregl-mobile-message",c.textContent=a,this._container.appendChild(c),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(ne.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,s){this._enabled&&(this._map.fire(new p.k("cooperativegestureprevented",{gestureType:e,originalEvent:s})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Ci=u=>u.zoom||u.drag||u.pitch||u.rotate;class Ie extends p.k{}function la(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta}class mo{constructor(e,s){this.handleWindowEvent=o=>{this.handleEvent(o,`${o.type}Window`)},this.handleEvent=(o,c)=>{if(o.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const m=o.type==="renderFrame"?void 0:o,_={needsRenderFrame:!1},y={},b={},T=o.touches,S=T?this._getMapTouches(T):void 0,z=S?ne.touchPos(this._map.getCanvas(),S):ne.mousePos(this._map.getCanvas(),o);for(const{handlerName:V,handler:U,allowed:$}of this._handlers){if(!U.isEnabled())continue;let Z;this._blockedByActive(b,$,V)?U.reset():U[c||o.type]&&(Z=U[c||o.type](o,z,S),this.mergeHandlerResult(_,y,Z,V,m),Z&&Z.needsRenderFrame&&this._triggerRenderFrame()),(Z||U.isActive())&&(b[V]=U)}const D={};for(const V in this._previousActiveHandlers)b[V]||(D[V]=m);this._previousActiveHandlers=b,(Object.keys(D).length||la(_))&&(this._changes.push([_,y,D]),this._triggerRenderFrame()),(Object.keys(b).length||la(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:R}=_;R&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],R(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new io(e),this._bearingSnap=s.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(s);const a=this._el;this._listeners=[[a,"touchstart",{passive:!0}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"contextmenu",void 0],[window,"blur",void 0]];for(const[o,c,m]of this._listeners)ne.addEventListener(o,c,o===document?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(const[e,s,a]of this._listeners)ne.removeEventListener(e,s,e===document?this.handleWindowEvent:this.handleEvent,a)}_addDefaultHandlers(e){const s=this._map,a=s.getCanvasContainer();this._add("mapEvent",new dl(s,e));const o=s.boxZoom=new vi(s,e);this._add("boxZoom",o),e.interactive&&e.boxZoom&&o.enable();const c=s.cooperativeGestures=new Es(s,e.cooperativeGestures);this._add("cooperativeGestures",c),e.cooperativeGestures&&c.enable();const m=new ks(s),_=new lc(s);s.doubleClickZoom=new ss(_,m),this._add("tapZoom",m),this._add("clickZoom",_),e.interactive&&e.doubleClickZoom&&s.doubleClickZoom.enable();const y=new cc;this._add("tapDragZoom",y);const b=s.touchPitch=new vn(s);this._add("touchPitch",b),e.interactive&&e.touchPitch&&s.touchPitch.enable(e.touchPitch);const T=ao(e),S=oo(e);s.dragRotate=new ml(e,T,S),this._add("mouseRotate",T,["mousePitch"]),this._add("mousePitch",S,["mouseRotate"]),e.interactive&&e.dragRotate&&s.dragRotate.enable();const z=(({enable:Z,clickTolerance:B})=>{const X=new sa({checkCorrectEvent:K=>ne.mouseButton(K)===0&&!K.ctrlKey});return new wr({clickTolerance:B,move:(K,ee)=>({around:ee,panDelta:ee.sub(K)}),activateOnStart:!0,moveStateManager:X,enable:Z,assignEvents:na})})(e),D=new rs(e,s);s.dragPan=new fl(a,z,D),this._add("mousePan",z),this._add("touchPan",D,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&s.dragPan.enable(e.dragPan);const R=new ho,V=new co;s.touchZoomRotate=new fo(a,V,R,y),this._add("touchRotate",R,["touchPan","touchZoom"]),this._add("touchZoom",V,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&s.touchZoomRotate.enable(e.touchZoomRotate);const U=s.scrollZoom=new qi(s,()=>this._triggerRenderFrame());this._add("scrollZoom",U,["mousePan"]),e.interactive&&e.scrollZoom&&s.scrollZoom.enable(e.scrollZoom);const $=s.keyboard=new zi(s);this._add("keyboard",$),e.interactive&&e.keyboard&&s.keyboard.enable(),this._add("blockableMapEvent",new St(s))}_add(e,s,a){this._handlers.push({handlerName:e,handler:s,allowed:a}),this._handlersById[e]=s}stop(e){if(!this._updatingCamera){for(const{handler:s}of this._handlers)s.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Ci(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,s,a){for(const o in e)if(o!==a&&(!s||s.indexOf(o)<0))return!0;return!1}_getMapTouches(e){const s=[];for(const a of e)this._el.contains(a.target)&&s.push(a);return s}mergeHandlerResult(e,s,a,o,c){if(!a)return;p.e(e,a);const m={handlerName:o,originalEvent:a.originalEvent||c};a.zoomDelta!==void 0&&(s.zoom=m),a.panDelta!==void 0&&(s.drag=m),a.pitchDelta!==void 0&&(s.pitch=m),a.bearingDelta!==void 0&&(s.rotate=m)}_applyChanges(){const e={},s={},a={};for(const[o,c,m]of this._changes)o.panDelta&&(e.panDelta=(e.panDelta||new p.P(0,0))._add(o.panDelta)),o.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+o.zoomDelta),o.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+o.bearingDelta),o.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+o.pitchDelta),o.around!==void 0&&(e.around=o.around),o.pinchAround!==void 0&&(e.pinchAround=o.pinchAround),o.noInertia&&(e.noInertia=o.noInertia),p.e(s,c),p.e(a,m);this._updateMapTransform(e,s,a),this._changes=[]}_updateMapTransform(e,s,a){const o=this._map,c=o._getTransformForUpdate(),m=o.terrain;if(!(la(e)||m&&this._terrainMovement))return this._fireEvents(s,a,!0);let{panDelta:_,zoomDelta:y,bearingDelta:b,pitchDelta:T,around:S,pinchAround:z}=e;z!==void 0&&(S=z),o._stop(!0),S=S||o.transform.centerPoint;const D=c.pointLocation(_?S.sub(_):S);b&&(c.bearing+=b),T&&(c.pitch+=T),y&&(c.zoom+=y),m?this._terrainMovement||!s.drag&&!s.zoom?s.drag&&this._terrainMovement?c.center=c.pointLocation(c.centerPoint.sub(_)):c.setLocationAtPoint(D,S):(this._terrainMovement=!0,this._map._elevationFreeze=!0,c.setLocationAtPoint(D,S)):c.setLocationAtPoint(D,S),o._applyUpdatedTransform(c),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(s,a,!0)}_fireEvents(e,s,a){const o=Ci(this._eventsInProgress),c=Ci(e),m={};for(const S in e){const{originalEvent:z}=e[S];this._eventsInProgress[S]||(m[`${S}start`]=z),this._eventsInProgress[S]=e[S]}!o&&c&&this._fireEvent("movestart",c.originalEvent);for(const S in m)this._fireEvent(S,m[S]);c&&this._fireEvent("move",c.originalEvent);for(const S in e){const{originalEvent:z}=e[S];this._fireEvent(S,z)}const _={};let y;for(const S in this._eventsInProgress){const{handlerName:z,originalEvent:D}=this._eventsInProgress[S];this._handlersById[z].isActive()||(delete this._eventsInProgress[S],y=s[z]||D,_[`${S}end`]=y)}for(const S in _)this._fireEvent(S,_[S]);const b=Ci(this._eventsInProgress),T=(o||c)&&!b;if(T&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const S=this._map._getTransformForUpdate();S.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(S)}if(a&&T){this._updatingCamera=!0;const S=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),z=D=>D!==0&&-this._bearingSnap<D&&D<this._bearingSnap;!S||!S.essential&&me.prefersReducedMotion?(this._map.fire(new p.k("moveend",{originalEvent:y})),z(this._map.getBearing())&&this._map.resetNorth()):(z(S.bearing||this._map.getBearing())&&(S.bearing=0),S.freezeElevation=!0,this._map.easeTo(S,{originalEvent:y})),this._updatingCamera=!1}}_fireEvent(e,s){this._map.fire(new p.k(e,s?{originalEvent:s}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new Ie("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class gl extends p.E{constructor(e,s){super(),this._renderFrameCallback=()=>{const a=Math.min((me.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(a)),a<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=s.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new p.N(this.transform.center.lng,this.transform.center.lat)}setCenter(e,s){return this.jumpTo({center:e},s)}panBy(e,s,a){return e=p.P.convert(e).mult(-1),this.panTo(this.transform.center,p.e({offset:e},s),a)}panTo(e,s,a){return this.easeTo(p.e({center:e},s),a)}getZoom(){return this.transform.zoom}setZoom(e,s){return this.jumpTo({zoom:e},s),this}zoomTo(e,s,a){return this.easeTo(p.e({zoom:e},s),a)}zoomIn(e,s){return this.zoomTo(this.getZoom()+1,e,s),this}zoomOut(e,s){return this.zoomTo(this.getZoom()-1,e,s),this}getBearing(){return this.transform.bearing}setBearing(e,s){return this.jumpTo({bearing:e},s),this}getPadding(){return this.transform.padding}setPadding(e,s){return this.jumpTo({padding:e},s),this}rotateTo(e,s,a){return this.easeTo(p.e({bearing:e},s),a)}resetNorth(e,s){return this.rotateTo(0,p.e({duration:1e3},e),s),this}resetNorthPitch(e,s){return this.easeTo(p.e({bearing:0,pitch:0,duration:1e3},e),s),this}snapToNorth(e,s){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,s):this}getPitch(){return this.transform.pitch}setPitch(e,s){return this.jumpTo({pitch:e},s),this}cameraForBounds(e,s){e=ie.convert(e).adjustAntiMeridian();const a=s&&s.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),a,s)}_cameraForBoxAndBearing(e,s,a,o){const c={top:0,bottom:0,right:0,left:0};if(typeof(o=p.e({padding:c,offset:[0,0],maxZoom:this.transform.maxZoom},o)).padding=="number"){const fe=o.padding;o.padding={top:fe,bottom:fe,right:fe,left:fe}}o.padding=p.e(c,o.padding);const m=this.transform,_=m.padding,y=new ie(e,s),b=m.project(y.getNorthWest()),T=m.project(y.getNorthEast()),S=m.project(y.getSouthEast()),z=m.project(y.getSouthWest()),D=p.ba(-a),R=b.rotate(D),V=T.rotate(D),U=S.rotate(D),$=z.rotate(D),Z=new p.P(Math.max(R.x,V.x,$.x,U.x),Math.max(R.y,V.y,$.y,U.y)),B=new p.P(Math.min(R.x,V.x,$.x,U.x),Math.min(R.y,V.y,$.y,U.y)),X=Z.sub(B),K=(m.width-(_.left+_.right+o.padding.left+o.padding.right))/X.x,ee=(m.height-(_.top+_.bottom+o.padding.top+o.padding.bottom))/X.y;if(ee<0||K<0)return void p.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const oe=Math.min(m.scaleZoom(m.scale*Math.min(K,ee)),o.maxZoom),ue=p.P.convert(o.offset),xe=new p.P((o.padding.left-o.padding.right)/2,(o.padding.top-o.padding.bottom)/2).rotate(p.ba(a)),Te=ue.add(xe).mult(m.scale/m.zoomScale(oe));return{center:m.unproject(b.add(S).div(2).sub(Te)),zoom:oe,bearing:a}}fitBounds(e,s,a){return this._fitInternal(this.cameraForBounds(e,s),s,a)}fitScreenCoordinates(e,s,a,o,c){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(p.P.convert(e)),this.transform.pointLocation(p.P.convert(s)),a,o),o,c)}_fitInternal(e,s,a){return e?(delete(s=p.e(e,s)).padding,s.linear?this.easeTo(s,a):this.flyTo(s,a)):this}jumpTo(e,s){this.stop();const a=this._getTransformForUpdate();let o=!1,c=!1,m=!1;return"zoom"in e&&a.zoom!==+e.zoom&&(o=!0,a.zoom=+e.zoom),e.center!==void 0&&(a.center=p.N.convert(e.center)),"bearing"in e&&a.bearing!==+e.bearing&&(c=!0,a.bearing=+e.bearing),"pitch"in e&&a.pitch!==+e.pitch&&(m=!0,a.pitch=+e.pitch),e.padding==null||a.isPaddingEqual(e.padding)||(a.padding=e.padding),this._applyUpdatedTransform(a),this.fire(new p.k("movestart",s)).fire(new p.k("move",s)),o&&this.fire(new p.k("zoomstart",s)).fire(new p.k("zoom",s)).fire(new p.k("zoomend",s)),c&&this.fire(new p.k("rotatestart",s)).fire(new p.k("rotate",s)).fire(new p.k("rotateend",s)),m&&this.fire(new p.k("pitchstart",s)).fire(new p.k("pitch",s)).fire(new p.k("pitchend",s)),this.fire(new p.k("moveend",s))}calculateCameraOptionsFromTo(e,s,a,o=0){const c=p.Z.fromLngLat(e,s),m=p.Z.fromLngLat(a,o),_=m.x-c.x,y=m.y-c.y,b=m.z-c.z,T=Math.hypot(_,y,b);if(T===0)throw new Error("Can't calculate camera options with same From and To");const S=Math.hypot(_,y),z=this.transform.scaleZoom(this.transform.cameraToCenterDistance/T/this.transform.tileSize),D=180*Math.atan2(_,-y)/Math.PI;let R=180*Math.acos(S/T)/Math.PI;return R=b<0?90-R:90+R,{center:m.toLngLat(),zoom:z,pitch:R,bearing:D}}easeTo(e,s){var a;this._stop(!1,e.easeId),((e=p.e({offset:[0,0],duration:500,easing:p.b9},e)).animate===!1||!e.essential&&me.prefersReducedMotion)&&(e.duration=0);const o=this._getTransformForUpdate(),c=o.zoom,m=o.bearing,_=o.pitch,y=o.padding,b="bearing"in e?this._normalizeBearing(e.bearing,m):m,T="pitch"in e?+e.pitch:_,S="padding"in e?e.padding:o.padding,z=p.P.convert(e.offset);let D=o.centerPoint.add(z);const R=o.pointLocation(D),{center:V,zoom:U}=o.getConstrained(p.N.convert(e.center||R),(a=e.zoom)!==null&&a!==void 0?a:c);this._normalizeCenter(V,o);const $=o.project(R),Z=o.project(V).sub($),B=o.zoomScale(U-c);let X,K;e.around&&(X=p.N.convert(e.around),K=o.locationPoint(X));const ee={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||U!==c,this._rotating=this._rotating||m!==b,this._pitching=this._pitching||T!==_,this._padding=!o.isPaddingEqual(S),this._easeId=e.easeId,this._prepareEase(s,e.noMoveStart,ee),this.terrain&&this._prepareElevation(V),this._ease(oe=>{if(this._zooming&&(o.zoom=p.y.number(c,U,oe)),this._rotating&&(o.bearing=p.y.number(m,b,oe)),this._pitching&&(o.pitch=p.y.number(_,T,oe)),this._padding&&(o.interpolatePadding(y,S,oe),D=o.centerPoint.add(z)),this.terrain&&!e.freezeElevation&&this._updateElevation(oe),X)o.setLocationAtPoint(X,K);else{const ue=o.zoomScale(o.zoom-c),xe=U>c?Math.min(2,B):Math.max(.5,B),Te=Math.pow(xe,1-oe),fe=o.unproject($.add(Z.mult(oe*Te)).mult(ue));o.setLocationAtPoint(o.renderWorldCopies?fe.wrap():fe,D)}this._applyUpdatedTransform(o),this._fireMoveEvents(s)},oe=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(s,oe)},e),this}_prepareEase(e,s,a={}){this._moving=!0,s||a.moving||this.fire(new p.k("movestart",e)),this._zooming&&!a.zooming&&this.fire(new p.k("zoomstart",e)),this._rotating&&!a.rotating&&this.fire(new p.k("rotatestart",e)),this._pitching&&!a.pitching&&this.fire(new p.k("pitchstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const s=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&s!==this._elevationTarget){const a=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(a-(s-(a*e+this._elevationStart))/(1-e)),this._elevationTarget=s}this.transform.elevation=p.y.number(this._elevationStart,this._elevationTarget,e)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){const s=e.getCameraPosition(),a=this.terrain.getElevationForLngLatZoom(s.lngLat,e.zoom);if(s.altitude<a){const o=this.calculateCameraOptionsFromTo(s.lngLat,a,e.center,e.elevation);return{pitch:o.pitch,zoom:o.zoom}}return{}}_applyUpdatedTransform(e){const s=[];if(this.terrain&&s.push(o=>this._elevateCameraIfInsideTerrain(o)),this.transformCameraUpdate&&s.push(o=>this.transformCameraUpdate(o)),!s.length)return;const a=e.clone();for(const o of s){const c=a.clone(),{center:m,zoom:_,pitch:y,bearing:b,elevation:T}=o(c);m&&(c.center=m),_!==void 0&&(c.zoom=_),y!==void 0&&(c.pitch=y),b!==void 0&&(c.bearing=b),T!==void 0&&(c.elevation=T),a.apply(c)}this.transform.apply(a)}_fireMoveEvents(e){this.fire(new p.k("move",e)),this._zooming&&this.fire(new p.k("zoom",e)),this._rotating&&this.fire(new p.k("rotate",e)),this._pitching&&this.fire(new p.k("pitch",e))}_afterEase(e,s){if(this._easeId&&s&&this._easeId===s)return;delete this._easeId;const a=this._zooming,o=this._rotating,c=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,a&&this.fire(new p.k("zoomend",e)),o&&this.fire(new p.k("rotateend",e)),c&&this.fire(new p.k("pitchend",e)),this.fire(new p.k("moveend",e))}flyTo(e,s){var a;if(!e.essential&&me.prefersReducedMotion){const be=p.M(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(be,s)}this.stop(),e=p.e({offset:[0,0],speed:1.2,curve:1.42,easing:p.b9},e);const o=this._getTransformForUpdate(),c=o.zoom,m=o.bearing,_=o.pitch,y=o.padding,b="bearing"in e?this._normalizeBearing(e.bearing,m):m,T="pitch"in e?+e.pitch:_,S="padding"in e?e.padding:o.padding,z=p.P.convert(e.offset);let D=o.centerPoint.add(z);const R=o.pointLocation(D),{center:V,zoom:U}=o.getConstrained(p.N.convert(e.center||R),(a=e.zoom)!==null&&a!==void 0?a:c);this._normalizeCenter(V,o);const $=o.zoomScale(U-c),Z=o.project(R),B=o.project(V).sub(Z);let X=e.curve;const K=Math.max(o.width,o.height),ee=K/$,oe=B.mag();if("minZoom"in e){const be=p.ac(Math.min(e.minZoom,c,U),o.minZoom,o.maxZoom),Fe=K/o.zoomScale(be-c);X=Math.sqrt(Fe/oe*2)}const ue=X*X;function xe(be){const Fe=(ee*ee-K*K+(be?-1:1)*ue*ue*oe*oe)/(2*(be?ee:K)*ue*oe);return Math.log(Math.sqrt(Fe*Fe+1)-Fe)}function Te(be){return(Math.exp(be)-Math.exp(-be))/2}function fe(be){return(Math.exp(be)+Math.exp(-be))/2}const pe=xe(!1);let Me=function(be){return fe(pe)/fe(pe+X*be)},Ve=function(be){return K*((fe(pe)*(Te(Fe=pe+X*be)/fe(Fe))-Te(pe))/ue)/oe;var Fe},_e=(xe(!0)-pe)/X;if(Math.abs(oe)<1e-6||!isFinite(_e)){if(Math.abs(K-ee)<1e-6)return this.easeTo(e,s);const be=ee<K?-1:1;_e=Math.abs(Math.log(ee/K))/X,Ve=()=>0,Me=Fe=>Math.exp(be*X*Fe)}return e.duration="duration"in e?+e.duration:1e3*_e/("screenSpeed"in e?+e.screenSpeed/X:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=m!==b,this._pitching=T!==_,this._padding=!o.isPaddingEqual(S),this._prepareEase(s,!1),this.terrain&&this._prepareElevation(V),this._ease(be=>{const Fe=be*_e,ft=1/Me(Fe);o.zoom=be===1?U:c+o.scaleZoom(ft),this._rotating&&(o.bearing=p.y.number(m,b,be)),this._pitching&&(o.pitch=p.y.number(_,T,be)),this._padding&&(o.interpolatePadding(y,S,be),D=o.centerPoint.add(z)),this.terrain&&!e.freezeElevation&&this._updateElevation(be);const Ue=be===1?V:o.unproject(Z.add(B.mult(Ve(Fe))).mult(ft));o.setLocationAtPoint(o.renderWorldCopies?Ue.wrap():Ue,D),this._applyUpdatedTransform(o),this._fireMoveEvents(s)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(s)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,s){var a;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const o=this._onEaseEnd;delete this._onEaseEnd,o.call(this,s)}return e||(a=this.handlers)===null||a===void 0||a.stop(!1),this}_ease(e,s,a){a.animate===!1||a.duration===0?(e(1),s()):(this._easeStart=me.now(),this._easeOptions=a,this._onEaseFrame=e,this._onEaseEnd=s,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,s){e=p.b3(e,-180,180);const a=Math.abs(e-s);return Math.abs(e-360-s)<a&&(e-=360),Math.abs(e+360-s)<a&&(e+=360),e}_normalizeCenter(e,s){if(!s.renderWorldCopies||s.lngRange)return;const a=e.lng-s.center.lng;e.lng+=a>180?-360:a<-180?360:0}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(p.N.convert(e),this.transform.tileZoom)-this.transform.elevation:null}}const Ds={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Ls{constructor(e=Ds){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=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=ne.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=ne.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ne.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(){ne.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,s){const a=this._map._getUIString(`AttributionControl.${s}`);e.title=a,e.setAttribute("aria-label",a)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(o=>typeof o!="string"?"":o)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const o=this._map.style.stylesheet;this.styleOwner=o.owner,this.styleId=o.id}const s=this._map.style.sourceCaches;for(const o in s){const c=s[o];if(c.used||c.usedForTerrain){const m=c.getSource();m.attribution&&e.indexOf(m.attribution)<0&&e.push(m.attribution)}}e=e.filter(o=>String(o).trim()),e.sort((o,c)=>o.length-c.length),e=e.filter((o,c)=>{for(let m=c+1;m<e.length;m++)if(e[m].indexOf(o)>=0)return!1;return!0});const a=e.join(" | ");a!==this._attribHTML&&(this._attribHTML=a,e.length?(this._innerContainer.innerHTML=a,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class go{constructor(e={}){this._updateCompact=()=>{const s=this._container.children;if(s.length){const a=s[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&a.classList.add("maplibregl-compact"):a.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=ne.create("div","maplibregl-ctrl");const s=ne.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(){ne.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Xe{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const s=++this._id;return this._queue.push({callback:e,id:s,cancelled:!1}),s}remove(e){const s=this._currentlyRunning,a=s?this._queue.concat(s):this._queue;for(const o of a)if(o.id===e)return void(o.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const s=this._currentlyRunning=this._queue;this._queue=[];for(const a of s)if(!a.cancelled&&(a.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var _o=p.Y([{name:"a_pos3d",type:"Int16",components:3}]);class uc extends p.E{constructor(e){super(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,e.usedForTerrain=!0,e.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,s){this.sourceCache.update(e,s),this._renderableTilesKeys=[];const a={};for(const o of e.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:s}))a[o.key]=!0,this._renderableTilesKeys.push(o.key),this._tiles[o.key]||(o.posMatrix=new Float64Array(16),p.aP(o.posMatrix,0,p.X,0,p.X,0,1),this._tiles[o.key]=new Er(o,this.tileSize));for(const o in this._tiles)a[o]||delete this._tiles[o]}freeRtt(e){for(const s in this._tiles){const a=this._tiles[s];(!e||a.tileID.equals(e)||a.tileID.isChildOf(e)||e.isChildOf(a.tileID))&&(a.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e){const s={};for(const a of this._renderableTilesKeys){const o=this._tiles[a].tileID;if(o.canonical.equals(e.canonical)){const c=e.clone();c.posMatrix=new Float64Array(16),p.aP(c.posMatrix,0,p.X,0,p.X,0,1),s[a]=c}else if(o.canonical.isChildOf(e.canonical)){const c=e.clone();c.posMatrix=new Float64Array(16);const m=o.canonical.z-e.canonical.z,_=o.canonical.x-(o.canonical.x>>m<<m),y=o.canonical.y-(o.canonical.y>>m<<m),b=p.X>>m;p.aP(c.posMatrix,0,b,0,b,0,1),p.J(c.posMatrix,c.posMatrix,[-_*b,-y*b,0]),s[a]=c}else if(e.canonical.isChildOf(o.canonical)){const c=e.clone();c.posMatrix=new Float64Array(16);const m=e.canonical.z-o.canonical.z,_=e.canonical.x-(e.canonical.x>>m<<m),y=e.canonical.y-(e.canonical.y>>m<<m),b=p.X>>m;p.aP(c.posMatrix,0,p.X,0,p.X,0,1),p.J(c.posMatrix,c.posMatrix,[_*b,y*b,0]),p.K(c.posMatrix,c.posMatrix,[1/2**m,1/2**m,0]),s[a]=c}}return s}getSourceTile(e,s){const a=this.sourceCache._source;let o=e.overscaledZ-this.deltaZoom;if(o>a.maxzoom&&(o=a.maxzoom),o<a.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(o).key);let c=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!c||!c.dem)&&s)for(;o>=a.minzoom&&(!c||!c.dem);)c=this.sourceCache.getTileByID(e.scaledTo(o--).key);return c}tilesAfterTime(e=Date.now()){return Object.values(this._tiles).filter(s=>s.timeAdded>=e)}}class yo{constructor(e,s,a){this.painter=e,this.sourceCache=new uc(s),this.options=a,this.exaggeration=typeof a.exaggeration=="number"?a.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,s,a,o=p.X){var c;if(!(s>=0&&s<o&&a>=0&&a<o))return 0;const m=this.getTerrainData(e),_=(c=m.tile)===null||c===void 0?void 0:c.dem;if(!_)return 0;const y=function(R,V,U){var $=V[0],Z=V[1];return R[0]=U[0]*$+U[4]*Z+U[12],R[1]=U[1]*$+U[5]*Z+U[13],R}([],[s/o*p.X,a/o*p.X],m.u_terrain_matrix),b=[y[0]*_.dim,y[1]*_.dim],T=Math.floor(b[0]),S=Math.floor(b[1]),z=b[0]-T,D=b[1]-S;return _.get(T,S)*(1-z)*(1-D)+_.get(T+1,S)*z*(1-D)+_.get(T,S+1)*(1-z)*D+_.get(T+1,S+1)*z*D}getElevationForLngLatZoom(e,s){if(!p.bb(s,e.wrap()))return 0;const{tileID:a,mercatorX:o,mercatorY:c}=this._getOverscaledTileIDFromLngLatZoom(e,s);return this.getElevation(a,o%p.X,c%p.X,p.X)}getElevation(e,s,a,o=p.X){return this.getDEMElevation(e,s,a,o)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const o=this.painter.context,c=new p.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new at(o,c,o.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new at(o,new p.R({width:1,height:1}),o.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(o.gl.NEAREST,o.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=p.an([])}const s=this.sourceCache.getSourceTile(e,!0);if(s&&s.dem&&(!s.demTexture||s.needsTerrainPrepare)){const o=this.painter.context;s.demTexture=this.painter.getTileTexture(s.dem.stride),s.demTexture?s.demTexture.update(s.dem.getPixels(),{premultiply:!1}):s.demTexture=new at(o,s.dem.getPixels(),o.gl.RGBA,{premultiply:!1}),s.demTexture.bind(o.gl.NEAREST,o.gl.CLAMP_TO_EDGE),s.needsTerrainPrepare=!1}const a=s&&s+s.tileID.key+e.key;if(a&&!this._demMatrixCache[a]){const o=this.sourceCache.sourceCache._source.maxzoom;let c=e.canonical.z-s.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=o?c=e.canonical.z-o:p.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const m=e.canonical.x-(e.canonical.x>>c<<c),_=e.canonical.y-(e.canonical.y>>c<<c),y=p.bc(new Float64Array(16),[1/(p.X<<c),1/(p.X<<c),0]);p.J(y,y,[m*p.X,_*p.X,0]),this._demMatrixCache[e.key]={matrix:y,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:s&&s.dem&&s.dem.dim||1,u_terrain_matrix:a?this._demMatrixCache[e.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(e){const s=this.painter,a=s.width/devicePixelRatio,o=s.height/devicePixelRatio;return!this._fbo||this._fbo.width===a&&this._fbo.height===o||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new at(s.context,{width:a,height:o,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 at(s.context,{width:a,height:o,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(a,o,!0,!1),this._fbo.depthAttachment.set(s.context.createRenderbuffer(s.context.gl.DEPTH_COMPONENT16,a,o))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const s=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let c=0,m=0;c<this._coordsTextureSize;c++)for(let _=0;_<this._coordsTextureSize;_++,m+=4)s[m+0]=255&_,s[m+1]=255&c,s[m+2]=_>>8<<4|c>>8,s[m+3]=0;const a=new p.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(s.buffer)),o=new at(e,a,e.gl.RGBA,{premultiply:!1});return o.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=o,o}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const s=new Uint8Array(4),a=this.painter.context,o=a.gl,c=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),m=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),_=Math.round(this.painter.height/devicePixelRatio);a.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),o.readPixels(c,_-m-1,1,1,o.RGBA,o.UNSIGNED_BYTE,s),a.bindFramebuffer.set(null);const y=s[0]+(s[2]>>4<<8),b=s[1]+((15&s[2])<<8),T=this.coordsIndex[255-s[3]],S=T&&this.sourceCache.getTileByID(T);if(!S)return null;const z=this._coordsTextureSize,D=(1<<S.tileID.canonical.z)*z;return new p.Z((S.tileID.canonical.x*z+y)/D+S.tileID.wrap,(S.tileID.canonical.y*z+b)/D,this.getElevation(S.tileID,y,b,z))}depthAtPoint(e){const s=new Uint8Array(4),a=this.painter.context,o=a.gl;return a.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),o.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,o.RGBA,o.UNSIGNED_BYTE,s),a.bindFramebuffer.set(null),(s[0]/16777216+s[1]/65536+s[2]/256+s[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;const e=this.painter.context,s=new p.bd,a=new p.aY,o=this.meshSize,c=p.X/o,m=o*o;for(let S=0;S<=o;S++)for(let z=0;z<=o;z++)s.emplaceBack(z*c,S*c,0);for(let S=0;S<m;S+=o+1)for(let z=0;z<o;z++)a.emplaceBack(z+S,o+z+S+1,o+z+S+2),a.emplaceBack(z+S,o+z+S+2,z+S+1);const _=s.length,y=_+2*(o+1);for(const S of[0,1])for(let z=0;z<=o;z++)for(const D of[0,1])s.emplaceBack(z*c,S*p.X,D);for(let S=0;S<2*o;S+=2)a.emplaceBack(y+S,y+S+1,y+S+3),a.emplaceBack(y+S,y+S+3,y+S+2),a.emplaceBack(_+S,_+S+3,_+S+1),a.emplaceBack(_+S,_+S+2,_+S+3);const b=s.length,T=b+2*(o+1);for(const S of[0,1])for(let z=0;z<=o;z++)for(const D of[0,1])s.emplaceBack(S*p.X,z*c,D);for(let S=0;S<2*o;S+=2)a.emplaceBack(b+S,b+S+1,b+S+3),a.emplaceBack(b+S,b+S+3,b+S+2),a.emplaceBack(T+S,T+S+3,T+S+1),a.emplaceBack(T+S,T+S+2,T+S+3);return this._mesh=new Yn(e.createVertexBuffer(s,_o.members),e.createIndexBuffer(a),p.a0.simpleSegment(0,0,s.length,a.length)),this._mesh}getMeshFrameDelta(e){return 2*Math.PI*p.be/Math.pow(2,e)/5}getMinTileElevationForLngLatZoom(e,s){var a;const{tileID:o}=this._getOverscaledTileIDFromLngLatZoom(e,s);return(a=this.getMinMaxElevation(o).minElevation)!==null&&a!==void 0?a:0}getMinMaxElevation(e){const s=this.getTerrainData(e).tile,a={minElevation:null,maxElevation:null};return s&&s.dem&&(a.minElevation=s.dem.min*this.exaggeration,a.maxElevation=s.dem.max*this.exaggeration),a}_getOverscaledTileIDFromLngLatZoom(e,s){const a=p.Z.fromLngLat(e.wrap()),o=(1<<s)*p.X,c=a.x*o,m=a.y*o,_=Math.floor(c/p.X),y=Math.floor(m/p.X);return{tileID:new p.S(s,0,s,_,y),mercatorX:c,mercatorY:m}}}class hc{constructor(e,s,a){this._context=e,this._size=s,this._tileSize=a,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){const s=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),a=new at(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return a.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(a.texture),{id:e,fbo:s,texture:a,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(s=>e.id!==s),this._recentlyUsed.push(e.id)}stampObject(e){e.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 e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(const e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(e=>!e.inUse)===!1}}const Rs={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class _l{constructor(e,s){this.painter=e,this.terrain=s,this.pool=new hc(e.context,30,s.sourceCache.tileSize*s.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,s){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(a=>!e._layers[a].isHidden(s)),this._coordsDescendingInv={};for(const a in e.sourceCaches){this._coordsDescendingInv[a]={};const o=e.sourceCaches[a].getVisibleCoordinates();for(const c of o){const m=this.terrain.sourceCache.getTerrainCoords(c);for(const _ in m)this._coordsDescendingInv[a][_]||(this._coordsDescendingInv[a][_]=[]),this._coordsDescendingInv[a][_].push(m[_])}}this._coordsDescendingInvStr={};for(const a of e._order){const o=e._layers[a],c=o.source;if(Rs[o.type]&&!this._coordsDescendingInvStr[c]){this._coordsDescendingInvStr[c]={};for(const m in this._coordsDescendingInv[c])this._coordsDescendingInvStr[c][m]=this._coordsDescendingInv[c][m].map(_=>_.key).sort().join()}}for(const a of this._renderableTiles)for(const o in this._coordsDescendingInvStr){const c=this._coordsDescendingInvStr[o][a.tileID.key];c&&c!==a.rttCoords[o]&&(a.rtt=[])}}renderLayer(e){if(e.isHidden(this.painter.transform.zoom))return!1;const s=e.type,a=this.painter,o=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(Rs[s]&&(this._prevType&&Rs[this._prevType]||this._stacks.push([]),this._prevType=s,this._stacks[this._stacks.length-1].push(e.id),!o))return!0;if(Rs[this._prevType]||Rs[s]&&o){this._prevType=s;const c=this._stacks.length-1,m=this._stacks[c]||[];for(const _ of this._renderableTiles){if(this.pool.isFull()&&(cl(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(_),_.rtt[c]){const b=this.pool.getObjectForId(_.rtt[c].id);if(b.stamp===_.rtt[c].stamp){this.pool.useObject(b);continue}}const y=this.pool.getOrCreateFreeObject();this.pool.useObject(y),this.pool.stampObject(y),_.rtt[c]={id:y.id,stamp:y.stamp},a.context.bindFramebuffer.set(y.fbo.framebuffer),a.context.clear({color:p.aM.transparent,stencil:0}),a.currentStencilSource=void 0;for(let b=0;b<m.length;b++){const T=a.style._layers[m[b]],S=T.source?this._coordsDescendingInv[T.source][_.tileID.key]:[_.tileID];a.context.viewport.set([0,0,y.fbo.width,y.fbo.height]),a._renderTileClippingMasks(T,S),a.renderLayer(a,a.style.sourceCaches[T.source],T,S),T.source&&(_.rttCoords[T.source]=this._coordsDescendingInvStr[T.source][_.tileID.key])}}return cl(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),Rs[s]}return!1}}const xo={"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"},yl=Ri,dc={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Ds,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:p.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},vo=u=>{u.touchstart=u.dragStart,u.touchmoveWindow=u.dragMove,u.touchend=u.dragEnd},pc={showCompass:!0,showZoom:!0,visualizePitch:!1};class fc{constructor(e,s,a=!1){this.mousedown=m=>{this.startMouse(p.e({},m,{ctrlKey:!0,preventDefault:()=>m.preventDefault()}),ne.mousePos(this.element,m)),ne.addEventListener(window,"mousemove",this.mousemove),ne.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=m=>{this.moveMouse(m,ne.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=ne.touchPos(this.element,m.targetTouches)[0],this.startTouch(m,this._startPos),ne.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),ne.addEventListener(window,"touchend",this.touchend))},this.touchmove=m=>{m.targetTouches.length!==1?this.reset():(this._lastPos=ne.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 o=e.dragRotate._mouseRotate.getClickTolerance(),c=e.dragRotate._mousePitch.getClickTolerance();this.element=s,this.mouseRotate=ao({clickTolerance:o,enable:!0}),this.touchRotate=(({enable:m,clickTolerance:_,bearingDegreesPerPixelMoved:y=.8})=>{const b=new no;return new wr({clickTolerance:_,move:(T,S)=>({bearingDelta:(S.x-T.x)*y}),moveStateManager:b,enable:m,assignEvents:vo})})({clickTolerance:o,enable:!0}),this.map=e,a&&(this.mousePitch=oo({clickTolerance:c,enable:!0}),this.touchPitch=(({enable:m,clickTolerance:_,pitchDegreesPerPixelMoved:y=-.5})=>{const b=new no;return new wr({clickTolerance:_,move:(T,S)=>({pitchDelta:(S.y-T.y)*y}),moveStateManager:b,enable:m,assignEvents:vo})})({clickTolerance:c,enable:!0})),ne.addEventListener(s,"mousedown",this.mousedown),ne.addEventListener(s,"touchstart",this.touchstart,{passive:!1}),ne.addEventListener(s,"touchcancel",this.reset)}startMouse(e,s){this.mouseRotate.dragStart(e,s),this.mousePitch&&this.mousePitch.dragStart(e,s),ne.disableDrag()}startTouch(e,s){this.touchRotate.dragStart(e,s),this.touchPitch&&this.touchPitch.dragStart(e,s),ne.disableDrag()}moveMouse(e,s){const a=this.map,{bearingDelta:o}=this.mouseRotate.dragMove(e,s)||{};if(o&&a.setBearing(a.getBearing()+o),this.mousePitch){const{pitchDelta:c}=this.mousePitch.dragMove(e,s)||{};c&&a.setPitch(a.getPitch()+c)}}moveTouch(e,s){const a=this.map,{bearingDelta:o}=this.touchRotate.dragMove(e,s)||{};if(o&&a.setBearing(a.getBearing()+o),this.touchPitch){const{pitchDelta:c}=this.touchPitch.dragMove(e,s)||{};c&&a.setPitch(a.getPitch()+c)}}off(){const e=this.element;ne.removeEventListener(e,"mousedown",this.mousedown),ne.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),ne.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ne.removeEventListener(window,"touchend",this.touchend),ne.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){ne.enableDrag(),ne.removeEventListener(window,"mousemove",this.mousemove),ne.removeEventListener(window,"mouseup",this.mouseup),ne.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ne.removeEventListener(window,"touchend",this.touchend)}}let bi;function pt(u,e,s){const a=new p.N(u.lng,u.lat);if(u=new p.N(u.lng,u.lat),e){const o=new p.N(u.lng-360,u.lat),c=new p.N(u.lng+360,u.lat),m=s.locationPoint(u).distSqr(e);s.locationPoint(o).distSqr(e)<m?u=o:s.locationPoint(c).distSqr(e)<m&&(u=c)}for(;Math.abs(u.lng-s.center.lng)>180;){const o=s.locationPoint(u);if(o.x>=0&&o.y>=0&&o.x<=s.width&&o.y<=s.height)break;u.lng>s.center.lng?u.lng-=360:u.lng+=360}return u.lng!==a.lng&&s.locationPoint(u).y>s.height/2-s.getHorizon()?u:a}const Bs={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function ca(u,e,s){const a=u.classList;for(const o in Bs)a.remove(`maplibregl-${s}-anchor-${o}`);a.add(`maplibregl-${s}-anchor-${e}`)}class ua extends p.E{constructor(e){if(super(),this._onKeyPress=s=>{const a=s.code,o=s.charCode||s.keyCode;a!=="Space"&&a!=="Enter"&&o!==32&&o!==13||this.togglePopup()},this._onMapClick=s=>{const a=s.originalEvent.target,o=this._element;this._popup&&(a===o||o.contains(a))&&this.togglePopup()},this._update=s=>{var a;if(!this._map)return;const o=this._map.loaded()&&!this._map.isMoving();((s==null?void 0:s.type)==="terrain"||(s==null?void 0:s.type)==="render"&&!o)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?pt(this._lngLat,this._flatPos,this._map.transform):(a=this._lngLat)===null||a===void 0?void 0:a.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let c="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?c=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(c=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let m="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?m="rotateX(0deg)":this._pitchAlignment==="map"&&(m=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||s&&s.type!=="moveend"||(this._pos=this._pos.round()),ne.setTransform(this._element,`${Bs[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${m} ${c}`),me.frameAsync(new AbortController).then(()=>{this._updateOpacity(s&&s.type==="moveend")}).catch(()=>{})},this._onMove=s=>{if(!this._isDragging){const a=this._clickTolerance||this._map._clickTolerance;this._isDragging=s.point.dist(this._pointerdownPos)>=a}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 p.k("dragstart"))),this.fire(new p.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 p.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=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(e==null?void 0:e.opacity,e==null?void 0:e.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=p.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=ne.create("div");const s=ne.createNS("http://www.w3.org/2000/svg","svg"),a=41,o=27;s.setAttributeNS(null,"display","block"),s.setAttributeNS(null,"height",`${a}px`),s.setAttributeNS(null,"width",`${o}px`),s.setAttributeNS(null,"viewBox",`0 0 ${o} ${a}`);const c=ne.createNS("http://www.w3.org/2000/svg","g");c.setAttributeNS(null,"stroke","none"),c.setAttributeNS(null,"stroke-width","1"),c.setAttributeNS(null,"fill","none"),c.setAttributeNS(null,"fill-rule","evenodd");const m=ne.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"fill-rule","nonzero");const _=ne.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const y=[{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 $ of y){const Z=ne.createNS("http://www.w3.org/2000/svg","ellipse");Z.setAttributeNS(null,"opacity","0.04"),Z.setAttributeNS(null,"cx","10.5"),Z.setAttributeNS(null,"cy","5.80029008"),Z.setAttributeNS(null,"rx",$.rx),Z.setAttributeNS(null,"ry",$.ry),_.appendChild(Z)}const b=ne.createNS("http://www.w3.org/2000/svg","g");b.setAttributeNS(null,"fill",this._color);const T=ne.createNS("http://www.w3.org/2000/svg","path");T.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),b.appendChild(T);const S=ne.createNS("http://www.w3.org/2000/svg","g");S.setAttributeNS(null,"opacity","0.25"),S.setAttributeNS(null,"fill","#000000");const z=ne.createNS("http://www.w3.org/2000/svg","path");z.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),S.appendChild(z);const D=ne.createNS("http://www.w3.org/2000/svg","g");D.setAttributeNS(null,"transform","translate(6.0, 7.0)"),D.setAttributeNS(null,"fill","#FFFFFF");const R=ne.createNS("http://www.w3.org/2000/svg","g");R.setAttributeNS(null,"transform","translate(8.0, 8.0)");const V=ne.createNS("http://www.w3.org/2000/svg","circle");V.setAttributeNS(null,"fill","#000000"),V.setAttributeNS(null,"opacity","0.25"),V.setAttributeNS(null,"cx","5.5"),V.setAttributeNS(null,"cy","5.5"),V.setAttributeNS(null,"r","5.4999962");const U=ne.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"),R.appendChild(V),R.appendChild(U),m.appendChild(_),m.appendChild(b),m.appendChild(S),m.appendChild(D),m.appendChild(R),s.appendChild(m),s.setAttributeNS(null,"height",a*this._scale+"px"),s.setAttributeNS(null,"width",o*this._scale+"px"),this._element.appendChild(s),this._offset=p.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",s=>{s.preventDefault()}),this._element.addEventListener("mousedown",s=>{s.preventDefault()}),ca(this._element,this._anchor,"marker"),e&&e.className)for(const s of e.className.split(" "))this._element.classList.add(s);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),ne.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=p.N.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const o=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[o,-1*(38.1-13.5+o)],"bottom-right":[-o,-1*(38.1-13.5+o)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){const e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var s,a;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(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const o=this._map,c=o.terrain.depthAtPoint(this._pos),m=o.terrain.getElevationForLngLatZoom(this._lngLat,o.transform.tileZoom);if(o.transform.lngLatToCameraDepth(this._lngLat,m)-c<.006)return void(this._element.style.opacity=this._opacity);const _=-this._offset.y/o.transform._pixelPerMeter,y=Math.sin(o.getPitch()*Math.PI/180)*_,b=o.terrain.depthAtPoint(new p.P(this._pos.x,this._pos.y-this._offset.y)),T=o.transform.lngLatToCameraDepth(this._lngLat,m+y)-b>.006;!((a=this._popup)===null||a===void 0)&&a.isOpen()&&T&&this._popup.remove(),this._element.style.opacity=T?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=p.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,s){return e===void 0&&s===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),s!==void 0&&(this._opacityWhenCovered=s),this._map&&this._updateOpacity(!0),this}}const xl={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let bn=0,wn=!1;const hr={maxWidth:100,unit:"metric"};function Tn(u,e,s){const a=s&&s.maxWidth||100,o=u._container.clientHeight/2,c=u.unproject([0,o]),m=u.unproject([a,o]),_=c.distanceTo(m);if(s&&s.unit==="imperial"){const y=3.2808*_;y>5280?Ae(e,a,y/5280,u._getUIString("ScaleControl.Miles")):Ae(e,a,y,u._getUIString("ScaleControl.Feet"))}else s&&s.unit==="nautical"?Ae(e,a,_/1852,u._getUIString("ScaleControl.NauticalMiles")):_>=1e3?Ae(e,a,_/1e3,u._getUIString("ScaleControl.Kilometers")):Ae(e,a,_,u._getUIString("ScaleControl.Meters"))}function Ae(u,e,s,a){const o=function(c){const m=Math.pow(10,`${Math.floor(c)}`.length-1);let _=c/m;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(y){const b=Math.pow(10,Math.ceil(-Math.log(y)/Math.LN10));return Math.round(y*b)/b}(_),m*_}(s);u.style.width=e*(o/s)+"px",u.innerHTML=`${o} ${a}`}const Re={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},ha=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function da(u){if(u){if(typeof u=="number"){const e=Math.round(Math.abs(u)/Math.SQRT2);return{center:new p.P(0,0),top:new p.P(0,u),"top-left":new p.P(e,e),"top-right":new p.P(-e,e),bottom:new p.P(0,-u),"bottom-left":new p.P(e,-e),"bottom-right":new p.P(-e,-e),left:new p.P(u,0),right:new p.P(-u,0)}}if(u instanceof p.P||Array.isArray(u)){const e=p.P.convert(u);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:p.P.convert(u.center||[0,0]),top:p.P.convert(u.top||[0,0]),"top-left":p.P.convert(u["top-left"]||[0,0]),"top-right":p.P.convert(u["top-right"]||[0,0]),bottom:p.P.convert(u.bottom||[0,0]),"bottom-left":p.P.convert(u["bottom-left"]||[0,0]),"bottom-right":p.P.convert(u["bottom-right"]||[0,0]),left:p.P.convert(u.left||[0,0]),right:p.P.convert(u.right||[0,0])}}return da(new p.P(0,0))}const bo=Ri;L.AJAXError=p.bh,L.Evented=p.E,L.LngLat=p.N,L.MercatorCoordinate=p.Z,L.Point=p.P,L.addProtocol=p.bi,L.config=p.a,L.removeProtocol=p.bj,L.AttributionControl=Ls,L.BoxZoomHandler=vi,L.CanvasSource=Pi,L.CooperativeGesturesHandler=Es,L.DoubleClickZoomHandler=ss,L.DragPanHandler=fl,L.DragRotateHandler=ml,L.EdgeInsets=zs,L.FullscreenControl=class extends p.E{constructor(u={}){super(),this._onFullscreenChange=()=>{var e;let s=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((e=s==null?void 0:s.shadowRoot)===null||e===void 0)&&e.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:p.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=ne.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){ne.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=ne.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);ne.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 p.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new p.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()}},L.GeoJSONSource=tn,L.GeolocateControl=class extends p.E{constructor(u){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new p.k("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(e),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new p.k("geolocate",e)),this._finish()}},this._updateCamera=e=>{const s=new p.N(e.coords.longitude,e.coords.latitude),a=e.coords.accuracy,o=this._map.getBearing(),c=p.e({bearing:o},this.options.fitBoundsOptions),m=ie.fromLngLat(s,a);this._map.fitBounds(m,c,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const s=new p.N(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(s).addTo(this._map),this._userLocationDotMarker.setLngLat(s).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=e=>{if(this._map){if(this.options.trackUserLocation)if(e.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const s=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=s,this._geolocateButton.setAttribute("aria-label",s),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&wn)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new p.k("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=ne.create("button","maplibregl-ctrl-geolocate",this._container),ne.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(e===!1){p.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=ne.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new ua({element:this._dotElement}),this._circleElement=ne.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ua({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 p.k("trackuserlocationend")),this.fire(new p.k("userlocationlostfocus")))})}},this.options=p.e({},xl,u)}onAdd(u){return this._map=u,this._container=ne.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return p._(this,arguments,void 0,function*(e=!1){if(bi!==void 0&&!e)return bi;if(window.navigator.permissions===void 0)return bi=!!window.navigator.geolocation,bi;try{bi=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{bi=!!window.navigator.geolocation}return bi})}().then(e=>this._finishSetupUI(e)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),ne.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,bn=0,wn=!1}_isOutOfMapMaxBounds(u){const e=this._map.getMaxBounds(),s=u.coords;return e&&(s.longitude<e.getWest()||s.longitude>e.getEast()||s.latitude<e.getSouth()||s.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const u=this._map.getBounds(),e=u.getSouthEast(),s=u.getNorthEast(),a=e.distanceTo(s),o=Math.ceil(this._accuracy/(a/this._map._container.clientHeight)*2);this._circleElement.style.width=`${o}px`,this._circleElement.style.height=`${o}px`}trigger(){if(!this._setup)return p.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 p.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":bn--,wn=!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 p.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 p.k("trackuserlocationstart")),this.fire(new p.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"),bn++,bn>1?(u={maximumAge:6e5,timeout:0},wn=!0):(u=this.options.positionOptions,wn=!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)}},L.Hash=ea,L.ImageSource=xr,L.KeyboardHandler=zi,L.LngLatBounds=ie,L.LogoControl=go,L.Map=class extends gl{constructor(u){p.bf.mark(p.bg.create);const e=Object.assign(Object.assign({},dc),u);if(e.minZoom!=null&&e.maxZoom!=null&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(e.minPitch!=null&&e.maxPitch!=null&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(e.minPitch!=null&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(e.maxPitch!=null&&e.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Cs(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies),{bearingSnap:e.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Xe,this._controls=[],this._mapId=p.a4(),this._contextLost=s=>{s.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new p.k("webglcontextlost",{originalEvent:s}))},this._contextRestored=s=>{this._setupPainter(),this.resize(),this._update(),this.fire(new p.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=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._maxTileCacheZoomLevels=e.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=e.preserveDrawingBuffer===!0,this._antialias=e.antialias===!0,this._trackResize=e.trackResize===!0,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles===!0,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions===!0,this._collectResourceTiming=e.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},xo),e.locale),this._clickTolerance=e.clickTolerance,this._overridePixelRatio=e.pixelRatio,this._maxCanvasSize=e.maxCanvasSize,this.transformCameraUpdate=e.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=e.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=mi.addThrottleControl(()=>this.isMoving()),this._requestManager=new ka(e.transformRequest),typeof e.container=="string"){if(this._container=document.getElementById(e.container),!this._container)throw new Error(`Container '${e.container}' not found.`)}else{if(!(e.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)).on("moveend",()=>this._update(!1)).on("zoom",()=>this._update(!0)).on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}).once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let s=!1;const a=mn(o=>{this._trackResize&&!this._removed&&(this.resize(o),this.redraw())},50);this._resizeObserver=new ResizeObserver(o=>{s?a(o):s=!0}),this._resizeObserver.observe(this._container)}this.handlers=new mo(this,e),this._hash=e.hash&&new ea(typeof e.hash=="string"&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,p.e({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,this._validateStyle=e.validateStyle,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new Ls(typeof e.attributionControl=="boolean"?void 0:e.attributionControl)),e.maplibreLogo&&this.addControl(new go,e.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 p.k(`${s.dataType}data`,s))}),this.on("dataloading",s=>{this.fire(new p.k(`${s.dataType}dataloading`,s))}),this.on("dataabort",s=>{this.fire(new p.k("sourcedataabort",s))})}_getMapId(){return this._mapId}addControl(u,e){if(e===void 0&&(e=u.getDefaultPosition?u.getDefaultPosition():"top-right"),!u||!u.onAdd)return this.fire(new p.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 a=this._controlPositions[e];return e.indexOf("bottom")!==-1?a.insertBefore(s,a.firstChild):a.appendChild(s),this}removeControl(u){if(!u||!u.onRemove)return this.fire(new p.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const e=this._controls.indexOf(u);return e>-1&&this._controls.splice(e,1),u.onRemove(this),this}hasControl(u){return this._controls.indexOf(u)>-1}calculateCameraOptionsFromTo(u,e,s,a){return a==null&&this.terrain&&(a=this.terrain.getElevationForLngLatZoom(s,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(u,e,s,a)}resize(u){var e;const s=this._containerDimensions(),a=s[0],o=s[1],c=this._getClampedPixelRatio(a,o);if(this._resizeCanvas(a,o,c),this.painter.resize(a,o,c),this.painter.overLimit()){const _=this.painter.context.gl;this._maxCanvasSize=[_.drawingBufferWidth,_.drawingBufferHeight];const y=this._getClampedPixelRatio(a,o);this._resizeCanvas(a,o,y),this.painter.resize(a,o,y)}this.transform.resize(a,o),(e=this._requestedCameraState)===null||e===void 0||e.resize(a,o);const m=!this._moving;return m&&(this.stop(),this.fire(new p.k("movestart",u)).fire(new p.k("move",u))),this.fire(new p.k("resize",u)),m&&this.fire(new p.k("moveend",u)),this}_getClampedPixelRatio(u,e){const{0:s,1:a}=this._maxCanvasSize,o=this.getPixelRatio(),c=u*o,m=e*o;return Math.min(c>s?s/c:1,m>a?a/m:1)*o}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(ie.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(p.N.convert(u),this.style&&this.terrain)}unproject(u){return this.transform.pointLocation(p.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,e,s){if(u==="mouseenter"||u==="mouseover"){let a=!1;return{layers:e,listener:s,delegates:{mousemove:c=>{const m=e.filter(y=>this.getLayer(y)),_=m.length!==0?this.queryRenderedFeatures(c.point,{layers:m}):[];_.length?a||(a=!0,s.call(this,new Ut(u,this,c.originalEvent,{features:_}))):a=!1},mouseout:()=>{a=!1}}}}if(u==="mouseleave"||u==="mouseout"){let a=!1;return{layers:e,listener:s,delegates:{mousemove:m=>{const _=e.filter(y=>this.getLayer(y));(_.length!==0?this.queryRenderedFeatures(m.point,{layers:_}):[]).length?a=!0:a&&(a=!1,s.call(this,new Ut(u,this,m.originalEvent)))},mouseout:m=>{a&&(a=!1,s.call(this,new Ut(u,this,m.originalEvent)))}}}}{const a=o=>{const c=e.filter(_=>this.getLayer(_)),m=c.length!==0?this.queryRenderedFeatures(o.point,{layers:c}):[];m.length&&(o.features=m,s.call(this,o),delete o.features)};return{layers:e,listener:s,delegates:{[u]:a}}}}_saveDelegatedListener(u,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[u]=this._delegatedListeners[u]||[],this._delegatedListeners[u].push(e)}_removeDelegatedListener(u,e,s){if(!this._delegatedListeners||!this._delegatedListeners[u])return;const a=this._delegatedListeners[u];for(let o=0;o<a.length;o++){const c=a[o];if(c.listener===s&&c.layers.length===e.length&&c.layers.every(m=>e.includes(m))){for(const m in c.delegates)this.off(m,c.delegates[m]);return void a.splice(o,1)}}}on(u,e,s){if(s===void 0)return super.on(u,e);const a=this._createDelegatedListener(u,typeof e=="string"?[e]:e,s);this._saveDelegatedListener(u,a);for(const o in a.delegates)this.on(o,a.delegates[o]);return this}once(u,e,s){if(s===void 0)return super.once(u,e);const a=typeof e=="string"?[e]:e,o=this._createDelegatedListener(u,a,s);for(const c in o.delegates){const m=o.delegates[c];o.delegates[c]=(..._)=>{this._removeDelegatedListener(u,a,s),m(..._)}}this._saveDelegatedListener(u,o);for(const c in o.delegates)this.once(c,o.delegates[c]);return this}off(u,e,s){return s===void 0?super.off(u,e):(this._removeDelegatedListener(u,typeof e=="string"?[e]:e,s),this)}queryRenderedFeatures(u,e){if(!this.style)return[];let s;const a=u instanceof p.P||Array.isArray(u),o=a?u:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(a?{}:u)||{},o instanceof p.P||typeof o[0]=="number")s=[p.P.convert(o)];else{const c=p.P.convert(o[0]),m=p.P.convert(o[1]);s=[c,new p.P(m.x,c.y),m,new p.P(c.x,m.y),c]}return this.style.queryRenderedFeatures(s,e,this.transform)}querySourceFeatures(u,e){return this.style.querySourceFeatures(u,e)}setStyle(u,e){return(e=p.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&u?(this._diffStyle(u,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(u,e))}setTransformRequest(u){return this._requestManager.setTransformRequest(u),this}_getUIString(u){const e=this._locale[u];if(e==null)throw new Error(`Missing UI string '${u}'`);return e}_updateStyle(u,e){if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(u,e));const s=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!u)),u?(this.style=new Fn(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof u=="string"?this.style.loadURL(u,e,s):this.style.loadJSON(u,e,s),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Fn(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(u,e){if(typeof u=="string"){const s=this._requestManager.transformRequest(u,"Style");p.h(s,new AbortController).then(a=>{this._updateDiff(a.data,e)}).catch(a=>{a&&this.fire(new p.j(a))})}else typeof u=="object"&&this._updateDiff(u,e)}_updateDiff(u,e){try{this.style.setState(u,e)&&this._update(!0)}catch(s){p.w(`Unable to perform style diff: ${s.message||s.error||s}. Rebuilding the style from scratch.`),this._updateStyle(u,e)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():p.w("There is no style added to the map.")}addSource(u,e){return this._lazyInitEmptyStyle(),this.style.addSource(u,e),this._update(!0)}isSourceLoaded(u){const e=this.style&&this.style.sourceCaches[u];if(e!==void 0)return e.loaded();this.fire(new p.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 e=this.style.sourceCaches[u.source];if(!e)throw new Error(`cannot load terrain, because there exists no source with ID: ${u.source}`);this.terrain===null&&e.reload();for(const s in this.style._layers){const a=this.style._layers[s];a.type==="hillshade"&&a.source===u.source&&p.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 yo(this.painter,e,u),this.painter.renderToTexture=new _l(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 p.k("terrain",{terrain:u})),this}getTerrain(){var u,e;return(e=(u=this.terrain)===null||u===void 0?void 0:u.options)!==null&&e!==void 0?e:null}areTilesLoaded(){const u=this.style&&this.style.sourceCaches;for(const e in u){const s=u[e]._tiles;for(const a in s){const o=s[a];if(o.state!=="loaded"&&o.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,e,s={}){const{pixelRatio:a=1,sdf:o=!1,stretchX:c,stretchY:m,content:_,textFitWidth:y,textFitHeight:b}=s;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||p.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new p.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:T,height:S,data:z}=e,D=e;return this.style.addImage(u,{data:new p.R({width:T,height:S},new Uint8Array(z)),pixelRatio:a,stretchX:c,stretchY:m,content:_,textFitWidth:y,textFitHeight:b,sdf:o,version:0,userImage:D}),D.onAdd&&D.onAdd(this,u),this}}{const{width:T,height:S,data:z}=me.getImageData(e);this.style.addImage(u,{data:new p.R({width:T,height:S},z),pixelRatio:a,stretchX:c,stretchY:m,content:_,textFitWidth:y,textFitHeight:b,sdf:o,version:0})}}updateImage(u,e){const s=this.style.getImage(u);if(!s)return this.fire(new p.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const a=e instanceof HTMLImageElement||p.b(e)?me.getImageData(e):e,{width:o,height:c,data:m}=a;if(o===void 0||c===void 0)return this.fire(new p.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(o!==s.data.width||c!==s.data.height)return this.fire(new p.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const _=!(e instanceof HTMLImageElement||p.b(e));return s.data.replace(m,_),this.style.updateImage(u,s),this}getImage(u){return this.style.getImage(u)}hasImage(u){return u?!!this.style.getImage(u):(this.fire(new p.j(new Error("Missing required image id"))),!1)}removeImage(u){this.style.removeImage(u)}loadImage(u){return mi.getImage(this._requestManager.transformRequest(u,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(u,e){return this._lazyInitEmptyStyle(),this.style.addLayer(u,e),this._update(!0)}moveLayer(u,e){return this.style.moveLayer(u,e),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,e,s){return this.style.setLayerZoomRange(u,e,s),this._update(!0)}setFilter(u,e,s={}){return this.style.setFilter(u,e,s),this._update(!0)}getFilter(u){return this.style.getFilter(u)}setPaintProperty(u,e,s,a={}){return this.style.setPaintProperty(u,e,s,a),this._update(!0)}getPaintProperty(u,e){return this.style.getPaintProperty(u,e)}setLayoutProperty(u,e,s,a={}){return this.style.setLayoutProperty(u,e,s,a),this._update(!0)}getLayoutProperty(u,e){return this.style.getLayoutProperty(u,e)}setGlyphs(u,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(u,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(u,e,s={}){return this._lazyInitEmptyStyle(),this.style.addSprite(u,e,s,a=>{a||this._update(!0)}),this}removeSprite(u){return this._lazyInitEmptyStyle(),this.style.removeSprite(u),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(u,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(u,e,s=>{s||this._update(!0)}),this}setLight(u,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(u,e),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,e){return this.style.setFeatureState(u,e),this._update()}removeFeatureState(u,e){return this.style.removeFeatureState(u,e),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,e=0;return this._container&&(u=this._container.clientWidth||400,e=this._container.clientHeight||300),[u,e]}_setupContainer(){const u=this._container;u.classList.add("maplibregl-map");const e=this._canvasContainer=ne.create("div","maplibregl-canvas-container",u);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=ne.create("canvas","maplibregl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const s=this._containerDimensions(),a=this._getClampedPixelRatio(s[0],s[1]);this._resizeCanvas(s[0],s[1],a);const o=this._controlContainer=ne.create("div","maplibregl-control-container",u),c=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(m=>{c[m]=ne.create("div",`maplibregl-ctrl-${m} `,o)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(u,e,s){this._canvas.width=Math.floor(s*u),this._canvas.height=Math.floor(s*e),this._canvas.style.width=`${u}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const u={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let e=null;this._canvas.addEventListener("webglcontextcreationerror",a=>{e={requestedAttributes:u},a&&(e.statusMessage=a.statusMessage,e.type=a.type)},{once:!0});const s=this._canvas.getContext("webgl2",u)||this._canvas.getContext("webgl",u);if(!s){const a="Failed to initialize WebGL";throw e?(e.message=a,new Error(JSON.stringify(e))):new Error(a)}this.painter=new Qn(s,this.transform),Ur.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 e=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 o=this.transform.zoom,c=me.now();this.style.zoomHistory.update(o,c);const m=new p.z(o,{now:c,fadeDuration:e,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),_=m.crossFadingFactor();_===1&&_===this._crossFadingFactor||(s=!0,this._crossFadingFactor=_),this.style.update(m)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,e,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:e,showPadding:this.showPadding}),this.fire(new p.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,p.bf.mark(p.bg.load),this.fire(new p.k("load"))),this.style&&(this.style.hasTransitions()||s)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const a=this._sourcesDirty||this._styleDirty||this._placementDirty;return a||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new p.k("idle")),!this._loaded||this._fullyLoaded||a||(this._fullyLoaded=!0,p.bf.mark(p.bg.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),mi.removeThrottleControl(this._imageQueueHandle),(u=this._resizeObserver)===null||u===void 0||u.disconnect();const e=this.painter.context.gl.getExtension("WEBGL_lose_context");e!=null&&e.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),ne.remove(this._canvasContainer),ne.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),p.bf.clearMetrics(),this._removed=!0,this.fire(new p.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,me.frameAsync(this._frameRequest).then(u=>{p.bf.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 yl}getCameraTargetElevation(){return this.transform.elevation}},L.MapMouseEvent=Ut,L.MapTouchEvent=is,L.MapWheelEvent=hl,L.Marker=ua,L.NavigationControl=class{constructor(u){this._updateZoomButtons=()=>{const e=this._map.getZoom(),s=e===this._map.getMaxZoom(),a=e===this._map.getMinZoom();this._zoomInButton.disabled=s,this._zoomOutButton.disabled=a,this._zoomInButton.setAttribute("aria-disabled",s.toString()),this._zoomOutButton.setAttribute("aria-disabled",a.toString())},this._rotateCompassArrow=()=>{const e=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=e},this._setButtonTitle=(e,s)=>{const a=this._map._getUIString(`NavigationControl.${s}`);e.title=a,e.setAttribute("aria-label",a)},this.options=p.e({},pc,u),this._container=ne.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),ne.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),ne.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=ne.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 fc(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){ne.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,e){const s=ne.create("button",u,this._container);return s.type="button",s.addEventListener("click",e),s}},L.Popup=class extends p.E{constructor(u){super(),this.remove=()=>(this._content&&ne.remove(this._content),this._container&&(ne.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 p.k("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{var s;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=ne.create("div","maplibregl-popup",this._map.getContainer()),this._tip=ne.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const _ of this.options.className.split(" "))this._container.classList.add(_);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?pt(this._lngLat,this._flatPos,this._map.transform):(s=this._lngLat)===null||s===void 0?void 0:s.wrap(),this._trackPointer&&!e)return;const a=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationPoint(this._lngLat));let o=this.options.anchor;const c=da(this.options.offset);if(!o){const _=this._container.offsetWidth,y=this._container.offsetHeight;let b;b=a.y+c.bottom.y<y?["top"]:a.y>this._map.transform.height-y?["bottom"]:[],a.x<_/2?b.push("left"):a.x>this._map.transform.width-_/2&&b.push("right"),o=b.length===0?"bottom":b.join("-")}let m=a.add(c[o]);this.options.subpixelPositioning||(m=m.round()),ne.setTransform(this._container,`${Bs[o]} translate(${m.x}px,${m.y}px)`),ca(this._container,o,"popup")},this._onClose=()=>{this.remove()},this.options=p.e(Object.create(Re),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 p.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(u){return this._lngLat=p.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 e=document.createDocumentFragment(),s=document.createElement("body");let a;for(s.innerHTML=u;a=s.firstChild,a;)e.appendChild(a);return this.setDOMContent(e)}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=ne.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=ne.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(ha);u&&u.focus()}},L.RasterDEMTileSource=vt,L.RasterTileSource=et,L.ScaleControl=class{constructor(u){this._onMove=()=>{Tn(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,Tn(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},hr),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=ne.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){ne.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},L.ScrollZoomHandler=qi,L.Style=Fn,L.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=ne.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=ne.create("button","maplibregl-ctrl-terrain",this._container),ne.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(){ne.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},L.TwoFingersTouchPitchHandler=vn,L.TwoFingersTouchRotateHandler=ho,L.TwoFingersTouchZoomHandler=co,L.TwoFingersTouchZoomRotateHandler=fo,L.VectorTileSource=en,L.VideoSource=ms,L.addSourceType=(u,e)=>p._(void 0,void 0,void 0,function*(){if(sn(u))throw new Error(`A source type called "${u}" already exists.`);((s,a)=>{rn[s]=a})(u,e)}),L.clearPrewarmedResources=function(){const u=gi;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(Mr),gi=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()"))},L.getMaxParallelImageRequests=function(){return p.a.MAX_PARALLEL_IMAGE_REQUESTS},L.getRTLTextPluginStatus=function(){return ar().getRTLTextPluginStatus()},L.getVersion=function(){return bo},L.getWorkerCount=function(){return sr.workerCount},L.getWorkerUrl=function(){return p.a.WORKER_URL},L.importScriptInWorkers=function(u){return Qs().broadcast("IS",u)},L.prewarm=function(){qr().acquire(Mr)},L.setMaxParallelImageRequests=function(u){p.a.MAX_PARALLEL_IMAGE_REQUESTS=u},L.setRTLTextPlugin=function(u,e){return ar().setRTLTextPlugin(u,e)},L.setWorkerCount=function(u){sr.workerCount=u},L.setWorkerUrl=function(u){p.a.WORKER_URL=u}});var us=Nt;return us})})(Kh);var Gp=Kh.exports;const hf=qp(Gp),En="#f6efe6",$h="#a6c7dd",Hp="#97bcd6",Xp="#dce8c6",Wp="#c4dcae",qh="#cbe3b3",Kp="#efe2d2",Jp="#e9e0e2",Yp="#f3e8c9",Qp="#e2cdbd",ef="#d2b7a4",tf="#e0584c",rf="#ad342d",sf="#f6d17c",nf="#cfa14a",Zh="#ffffff",Gh="#cfbcab",af="#dccbba",of="#a29191",su="#a77f8b",Hh="#2a2024",Xh="#6d5d60",lf="#3f6f92",cf="#5c7a45",df={version:8,name:"Immo-Ka · Groupe Ka (éditorial)",glyphs:"https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf",sources:{omt:{type:"vector",url:"https://tiles.openfreemap.org/planet"},relief:{type:"raster",maxzoom:6,tileSize:256,tiles:["https://tiles.openfreemap.org/natural_earth/ne2sr/{z}/{x}/{y}.png"]}},layers:[{id:"bg",type:"background",paint:{"background-color":En}},{id:"relief",type:"raster",source:"relief",maxzoom:7,paint:{"raster-opacity":["interpolate",["linear"],["zoom"],0,.55,5,.45,6.5,0]}},{id:"landcover-grass",type:"fill",source:"omt","source-layer":"landcover",filter:["in",["get","class"],["literal",["grass","farmland"]]],paint:{"fill-color":Xp,"fill-opacity":.85}},{id:"landcover-wetland",type:"fill",source:"omt","source-layer":"landcover",filter:["==",["get","class"],"wetland"],paint:{"fill-color":"#cfe0cf","fill-opacity":.7}},{id:"landcover-wood",type:"fill",source:"omt","source-layer":"landcover",filter:["==",["get","class"],"wood"],paint:{"fill-color":Wp,"fill-opacity":["interpolate",["linear"],["zoom"],5,.7,11,.9]}},{id:"landcover-sand",type:"fill",source:"omt","source-layer":"landcover",filter:["==",["get","class"],"sand"],paint:{"fill-color":Yp}},{id:"landcover-ice",type:"fill",source:"omt","source-layer":"landcover",filter:["==",["get","class"],"ice"],paint:{"fill-color":"#eef4f6"}},{id:"landuse-residential",type:"fill",source:"omt","source-layer":"landuse",filter:["in",["get","class"],["literal",["residential","suburb","neighbourhood"]]],paint:{"fill-color":Kp,"fill-opacity":["interpolate",["linear"],["zoom"],8,.5,12,.9]}},{id:"landuse-indus",type:"fill",source:"omt","source-layer":"landuse",filter:["in",["get","class"],["literal",["industrial","commercial","quarry","railway"]]],paint:{"fill-color":Jp,"fill-opacity":.7}},{id:"landuse-green",type:"fill",source:"omt","source-layer":"landuse",filter:["in",["get","class"],["literal",["cemetery","stadium","pitch","playground"]]],paint:{"fill-color":qh,"fill-opacity":.6}},{id:"park",type:"fill",source:"omt","source-layer":"park",paint:{"fill-color":qh,"fill-opacity":.75}},{id:"waterway",type:"line",source:"omt","source-layer":"waterway",paint:{"line-color":$h,"line-width":["interpolate",["exponential",1.4],["zoom"],8,.8,14,3,18,8]}},{id:"water",type:"fill",source:"omt","source-layer":"water",paint:{"fill-color":["case",["==",["get","class"],"ocean"],Hp,$h]}},{id:"aeroway",type:"line",source:"omt","source-layer":"aeroway",minzoom:11,filter:["in",["get","class"],["literal",["runway","taxiway"]]],paint:{"line-color":"#e6d9d2","line-width":["interpolate",["exponential",1.5],["zoom"],11,1,16,26]}},{id:"tunnel",type:"line",source:"omt","source-layer":"transportation",filter:["==",["get","brunnel"],"tunnel"],paint:{"line-color":Gh,"line-dasharray":[2,2],"line-width":["interpolate",["exponential",1.5],["zoom"],8,.8,14,3.5,18,12]}},{id:"road-minor-case",type:"line",source:"omt","source-layer":"transportation",minzoom:11,filter:["all",["!=",["get","brunnel"],"tunnel"],["in",["get","class"],["literal",["minor","service","track"]]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":af,"line-width":["interpolate",["exponential",1.5],["zoom"],11,1.2,15,5,18,16]}},{id:"road-mid-case",type:"line",source:"omt","source-layer":"transportation",minzoom:9,filter:["all",["!=",["get","brunnel"],"tunnel"],["in",["get","class"],["literal",["secondary","tertiary"]]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":Gh,"line-width":["interpolate",["exponential",1.5],["zoom"],9,2,14,7,18,22]}},{id:"road-prim-case",type:"line",source:"omt","source-layer":"transportation",minzoom:7,filter:["all",["!=",["get","brunnel"],"tunnel"],["in",["get","class"],["literal",["primary","trunk"]]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":nf,"line-width":["interpolate",["exponential",1.5],["zoom"],7,1.8,14,8,18,26]}},{id:"motorway-case",type:"line",source:"omt","source-layer":"transportation",minzoom:5,filter:["==",["get","class"],"motorway"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":rf,"line-width":["interpolate",["exponential",1.5],["zoom"],5,1.4,14,9,18,28]}},{id:"road-path",type:"line",source:"omt","source-layer":"transportation",minzoom:14,filter:["==",["get","class"],"path"],paint:{"line-color":"#b8a394","line-dasharray":[2.5,2],"line-width":["interpolate",["linear"],["zoom"],14,.8,18,2.5]}},{id:"road-minor",type:"line",source:"omt","source-layer":"transportation",minzoom:11,filter:["all",["!=",["get","brunnel"],"tunnel"],["in",["get","class"],["literal",["minor","service","track"]]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":Zh,"line-width":["interpolate",["exponential",1.5],["zoom"],11,.7,15,3.8,18,13]}},{id:"road-mid",type:"line",source:"omt","source-layer":"transportation",minzoom:9,filter:["all",["!=",["get","brunnel"],"tunnel"],["in",["get","class"],["literal",["secondary","tertiary"]]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":Zh,"line-width":["interpolate",["exponential",1.5],["zoom"],9,1.3,14,5.5,18,18]}},{id:"road-prim",type:"line",source:"omt","source-layer":"transportation",minzoom:7,filter:["all",["!=",["get","brunnel"],"tunnel"],["in",["get","class"],["literal",["primary","trunk"]]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":sf,"line-width":["interpolate",["exponential",1.5],["zoom"],7,1.1,14,6.5,18,22]}},{id:"motorway",type:"line",source:"omt","source-layer":"transportation",minzoom:5,filter:["==",["get","class"],"motorway"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":tf,"line-width":["interpolate",["exponential",1.5],["zoom"],5,.9,14,7,18,24]}},{id:"rail",type:"line",source:"omt","source-layer":"transportation",minzoom:10,filter:["==",["get","class"],"rail"],paint:{"line-color":of,"line-dasharray":[3,3],"line-width":["interpolate",["linear"],["zoom"],10,.7,16,2.2]}},{id:"bridge-case",type:"line",source:"omt","source-layer":"transportation",minzoom:12,filter:["==",["get","brunnel"],"bridge"],paint:{"line-color":"#b7a08e","line-gap-width":["interpolate",["exponential",1.5],["zoom"],12,3,18,20],"line-width":1.2}},{id:"building",type:"fill",source:"omt","source-layer":"building",minzoom:13,paint:{"fill-color":Qp,"fill-outline-color":ef,"fill-opacity":["interpolate",["linear"],["zoom"],13,.55,16,.95]}},{id:"boundary-prov",type:"line",source:"omt","source-layer":"boundary",filter:["all",["==",["get","admin_level"],4],["!=",["get","maritime"],1]],paint:{"line-color":su,"line-dasharray":[4,3],"line-width":["interpolate",["linear"],["zoom"],4,.8,10,1.6]}},{id:"boundary-country",type:"line",source:"omt","source-layer":"boundary",filter:["all",["==",["get","admin_level"],2],["!=",["get","maritime"],1]],paint:{"line-color":su,"line-width":["interpolate",["linear"],["zoom"],3,1.2,10,2.6]}},{id:"park-label",type:"symbol",source:"omt","source-layer":"park",minzoom:11,filter:["==",["geometry-type"],"Point"],layout:{"text-field":["coalesce",["get","name:fr"],["get","name"]],"text-font":["Noto Sans Italic"],"text-size":11.5},paint:{"text-color":cf,"text-halo-color":En,"text-halo-width":1.4}},{id:"water-label",type:"symbol",source:"omt","source-layer":"water_name",layout:{"text-field":["coalesce",["get","name:fr"],["get","name"]],"text-font":["Noto Sans Italic"],"text-size":["interpolate",["linear"],["zoom"],6,11,12,14]},paint:{"text-color":lf,"text-halo-color":"rgba(246,239,230,0.75)","text-halo-width":1.2}},{id:"road-label",type:"symbol",source:"omt","source-layer":"transportation_name",minzoom:12.5,layout:{"symbol-placement":"line","text-field":["coalesce",["get","name:fr"],["get","name"]],"text-font":["Noto Sans Regular"],"text-size":11.5},paint:{"text-color":Xh,"text-halo-color":En,"text-halo-width":1.6}},{id:"place-village",type:"symbol",source:"omt","source-layer":"place",minzoom:9,filter:["in",["get","class"],["literal",["village","suburb","neighbourhood","hamlet"]]],layout:{"text-field":["coalesce",["get","name:fr"],["get","name"]],"text-font":["Noto Sans Regular"],"text-size":["interpolate",["linear"],["zoom"],9,11,14,13.5]},paint:{"text-color":Xh,"text-halo-color":En,"text-halo-width":1.7}},{id:"place-town",type:"symbol",source:"omt","source-layer":"place",filter:["==",["get","class"],"town"],layout:{"text-field":["coalesce",["get","name:fr"],["get","name"]],"text-font":["Noto Sans Bold"],"text-size":["interpolate",["linear"],["zoom"],6,12,12,16]},paint:{"text-color":Hh,"text-halo-color":En,"text-halo-width":1.8}},{id:"place-city",type:"symbol",source:"omt","source-layer":"place",filter:["==",["get","class"],"city"],layout:{"text-field":["coalesce",["get","name:fr"],["get","name"]],"text-font":["Noto Sans Bold"],"text-size":["interpolate",["linear"],["zoom"],4,13,10,19]},paint:{"text-color":Hh,"text-halo-color":En,"text-halo-width":2}},{id:"place-state",type:"symbol",source:"omt","source-layer":"place",maxzoom:7,filter:["==",["get","class"],"state"],layout:{"text-field":["coalesce",["get","name:fr"],["get","name"]],"text-font":["Noto Sans Regular"],"text-size":11.5,"text-transform":"uppercase","text-letter-spacing":.18},paint:{"text-color":su,"text-halo-color":En,"text-halo-width":1.5}}]},Ca=13,Ws=30,Ks=64,Yi=2;function Wh(yt,Kt,Nt,Bt,rt,us){if(typeof yt.roundRect=="function"){yt.roundRect(Kt,Nt,Bt,rt,us);return}yt.moveTo(Kt+us,Nt),yt.arcTo(Kt+Bt,Nt,Kt+Bt,Nt+rt,us),yt.arcTo(Kt+Bt,Nt+rt,Kt,Nt+rt,us),yt.arcTo(Kt,Nt+rt,Kt,Nt,us),yt.arcTo(Kt,Nt,Kt+Bt,Nt,us),yt.closePath()}function nu(yt,Kt,Nt=!0){const Bt=document.createElement("canvas");Bt.width=Ks*Yi,Bt.height=(Ws+6)*Yi;const rt=Bt.getContext("2d");return rt.scale(Yi,Yi),Nt&&(rt.shadowColor="rgba(26,18,20,0.28)",rt.shadowBlur=5,rt.shadowOffsetY=2),rt.beginPath(),Wh(rt,1,1,Ks-2,Ws-2,Ca),rt.fillStyle=yt,rt.fill(),rt.shadowColor="transparent",rt.beginPath(),rt.moveTo(Ks/2-5,Ws-1.5),rt.lineTo(Ks/2,Ws+4),rt.lineTo(Ks/2+5,Ws-1.5),rt.closePath(),rt.fillStyle=yt,rt.fill(),rt.strokeStyle=Kt,rt.lineWidth=1.4,rt.beginPath(),Wh(rt,1,1,Ks-2,Ws-2,Ca),rt.stroke(),rt.getImageData(0,0,Bt.width,Bt.height)}function pf(yt){const Kt={pixelRatio:Yi,stretchX:[[(Ca+1)*Yi,(Ks-Ca-1)*Yi]],stretchY:[[(Ca+1)*Yi,(Ws-Ca-1)*Yi]],content:[8*Yi,5*Yi,(Ks-8)*Yi,(Ws-5)*Yi]};yt.hasImage("pill")||yt.addImage("pill",nu("#ffffff","rgba(26,18,20,0.35)"),Kt),yt.hasImage("pill-deal")||yt.addImage("pill-deal",nu("#e23744","#b3202b"),Kt),yt.hasImage("pill-active")||yt.addImage("pill-active",nu("#1a1214","#1a1214"),Kt)}function ff(yt){return yt==null?"•":yt>=1e6?`${(yt/1e6).toLocaleString("fr-CA",{maximumFractionDigits:2})} M$`:yt>=1e4?`${Math.round(yt/1e3)} k$`:`${yt.toLocaleString("fr-CA",{maximumFractionDigits:0})} $`}export{pf as a,ff as b,hf as m,df as s};581