@maptiler/sdk 1.0.7 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- (function(Je,oa){typeof exports=="object"&&typeof module<"u"?oa(exports):typeof define=="function"&&define.amd?define(["exports"],oa):(Je=typeof globalThis<"u"?globalThis:Je||self,oa(Je.maptilersdk={}))})(this,function(Je){"use strict";var oa=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function vp(C){return C&&C.__esModule&&Object.prototype.hasOwnProperty.call(C,"default")?C.default:C}var eh={exports:{}};(function(C,b){(function(k,Z){C.exports=Z()})(oa,function(){var k,Z,ie;function fe(c,ve){if(!k)k=ve;else if(!Z)Z=ve;else{var Ze="var sharedChunk = {}; ("+k+")(sharedChunk); ("+Z+")(sharedChunk);",lt={};k(lt),ie=ve(lt),typeof window<"u"&&(ie.workerUrl=window.URL.createObjectURL(new Blob([Ze],{type:"text/javascript"})))}}fe(["exports"],function(c){var ve=Ze;function Ze(i,e,r,s){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(s-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=s}function lt(i,e,r,s){const l=new ve(i,e,r,s);return function(u){return l.solve(u)}}Ze.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,s=0;s<8;s++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)<e)return r;var u=this.sampleCurveDerivativeX(r);if(Math.abs(u)<1e-6)break;r-=l/u}var d=0,f=1;for(r=i,s=0;s<20&&(l=this.sampleCurveX(r),!(Math.abs(l-i)<e));s++)i>l?d=r:f=r,r=.5*(f-d)+d;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};const St=lt(.25,.1,.25,1);function Me(i,e,r){return Math.min(r,Math.max(e,i))}function K(i,e,r){const s=r-e,l=((i-e)%s+s)%s+e;return l===e?r:l}function Ye(i,...e){for(const r of e)for(const s in r)i[s]=r[s];return i}let ti=1;function Jt(i,e){i.forEach(r=>{e[r]&&(e[r]=e[r].bind(e))})}function Dt(i,e,r){const s={};for(const l in i)s[l]=e.call(r||this,i[l],l,i);return s}function Vn(i,e,r){const s={};for(const l in i)e.call(r||this,i[l],l,i)&&(s[l]=i[l]);return s}function Ji(i){return Array.isArray(i)?i.map(Ji):typeof i=="object"&&i?Dt(i,Ji):i}const Dr={};function Yt(i){Dr[i]||(typeof console<"u"&&console.warn(i),Dr[i]=!0)}function nr(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function Rr(i){let e=0;for(let r,s,l=0,u=i.length,d=u-1;l<u;d=l++)r=i[l],s=i[d],e+=(s.x-r.x)*(r.y+s.y);return e}function Yi(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function Nn(i){const e={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,s,l,u)=>{const d=l||u;return e[s]=!d||d.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}let on=null;function Br(i){if(on==null){const e=i.navigator?i.navigator.userAgent:null;on=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return on}function Fr(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const ln="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let wr,cn;const hn={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(i){const e=requestAnimationFrame(i);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(i,e=0){const r=window.document.createElement("canvas"),s=r.getContext("2d",{willReadFrequently:!0});if(!s)throw new Error("failed to create canvas 2d context");return r.width=i.width,r.height=i.height,s.drawImage(i,0,0,i.width,i.height),s.getImageData(-e,-e,i.width+2*e,i.height+2*e)},resolveURL:i=>(wr||(wr=document.createElement("a")),wr.href=i,wr.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(cn==null&&(cn=matchMedia("(prefers-reduced-motion: reduce)")),cn.matches)}};var it=sr;function sr(i,e){this.x=i,this.y=e}sr.prototype={clone:function(){return new sr(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,r=i.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),r=Math.sin(i),s=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=s,this},_rotateAround:function(i,e){var r=Math.cos(i),s=Math.sin(i),l=e.y+s*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-s*(this.y-e.y),this.y=l,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},sr.convert=function(i){return i instanceof sr?i:Array.isArray(i)?new sr(i[0],i[1]):i};const Or={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},qr="mapbox-tiles";let ki,Zr,Ur=500,Vr=50;function $n(){typeof caches>"u"||ki||(ki=caches.open(qr))}let jn=1/0;const un={supported:!1,testSupport:function(i){!Nr&&Sr&&(di?Gn(i):Tr=i)}};let Tr,Sr,Nr=!1,di=!1;function Gn(i){const e=i.createTexture();i.bindTexture(i.TEXTURE_2D,e);try{if(i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,Sr),i.isContextLost())return;un.supported=!0}catch{}i.deleteTexture(e),Nr=!0}typeof document<"u"&&(Sr=document.createElement("img"),Sr.onload=function(){Tr&&Gn(Tr),Tr=null,di=!0},Sr.onerror=function(){Nr=!0,Tr=null},Sr.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Er={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(Er);class Ir extends Error{constructor(e,r,s,l){super(`AJAXError: ${r} (${e}): ${s}`),this.status=e,this.statusText=r,this.url=s,this.body=l}}const ar=Yi()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href;function pn(i,e){const r=new AbortController,s=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:ar(),signal:r.signal});let l=!1,u=!1;return i.type==="json"&&s.headers.set("Accept","application/json"),((d,f,g)=>{if(u)return;const x=Date.now();fetch(s).then(w=>w.ok?((T,A,I)=>{(i.type==="arrayBuffer"?T.arrayBuffer():i.type==="json"?T.json():T.text()).then(P=>{u||(A&&I&&function(F,O,G){if($n(),!ki)return;const Y={status:O.status,statusText:O.statusText,headers:new Headers};O.headers.forEach((J,pe)=>Y.headers.set(pe,J));const $=Nn(O.headers.get("Cache-Control")||"");$["no-store"]||($["max-age"]&&Y.headers.set("Expires",new Date(G+1e3*$["max-age"]).toUTCString()),new Date(Y.headers.get("Expires")).getTime()-G<42e4||function(J,pe){if(Zr===void 0)try{new Response(new ReadableStream),Zr=!0}catch{Zr=!1}Zr?pe(J.body):J.blob().then(pe)}(O,J=>{const pe=new Response(J,Y);$n(),ki&&ki.then(ue=>ue.put(function(Ne){const qe=Ne.indexOf("?");return qe<0?Ne:Ne.slice(0,qe)}(F.url),pe)).catch(ue=>Yt(ue.message))}))}(s,A,I),l=!0,e(null,P,T.headers.get("Cache-Control"),T.headers.get("Expires")))}).catch(P=>{u||e(new Error(P.message))})})(w,null,x):w.blob().then(T=>e(new Ir(w.status,w.statusText,i.url,T)))).catch(w=>{w.code!==20&&e(new Error(w.message))})})(),{cancel:()=>{u=!0,l||r.abort()}}}const Oi=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(Yi()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!Yi()){const s=i.url.substring(0,i.url.indexOf("://"));return(Or.REGISTERED_PROTOCOLS[s]||pn)(i,e)}}if(!(/^file:/.test(r=i.url)||/^file:/.test(ar())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return pn(i,e);if(Yi()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e,void 0,!0)}var r;return function(s,l){const u=new XMLHttpRequest;u.open(s.method||"GET",s.url,!0),s.type==="arrayBuffer"&&(u.responseType="arraybuffer");for(const d in s.headers)u.setRequestHeader(d,s.headers[d]);return s.type==="json"&&(u.responseType="text",u.setRequestHeader("Accept","application/json")),u.withCredentials=s.credentials==="include",u.onerror=()=>{l(new Error(u.statusText))},u.onload=()=>{if((u.status>=200&&u.status<300||u.status===0)&&u.response!==null){let d=u.response;if(s.type==="json")try{d=JSON.parse(u.response)}catch(f){return l(f)}l(null,d,u.getResponseHeader("Cache-Control"),u.getResponseHeader("Expires"))}else{const d=new Blob([u.response],{type:u.getResponseHeader("Content-Type")});l(new Ir(u.status,u.statusText,s.url,d))}},u.send(s.body),{cancel:()=>u.abort()}}(i,e)},Xr=function(i,e){return Oi(Ye(i,{type:"arrayBuffer"}),e)};function Is(i){const e=window.document.createElement("a");return e.href=i,e.protocol===window.document.location.protocol&&e.host===window.document.location.host}let Wr,ft;Wr=[],ft=0;const dn=function(i,e){if(un.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),ft>=Or.MAX_PARALLEL_IMAGE_REQUESTS){const u={requestParameters:i,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return Wr.push(u),u}ft++;let r=!1;const s=()=>{if(!r)for(r=!0,ft--;Wr.length&&ft<Or.MAX_PARALLEL_IMAGE_REQUESTS;){const u=Wr.shift(),{requestParameters:d,callback:f,cancelled:g}=u;g||(u.cancel=dn(d,f).cancel)}},l=Xr(i,(u,d,f,g)=>{s(),u?e(u):d&&function(x,w){typeof createImageBitmap=="function"?function(T,A){const I=new Blob([new Uint8Array(T)],{type:"image/png"});createImageBitmap(I).then(P=>{A(null,P)}).catch(P=>{A(new Error(`Could not load image because of ${P.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(x,w):function(T,A){const I=new Image;I.onload=()=>{A(null,I),URL.revokeObjectURL(I.src),I.onload=null,window.requestAnimationFrame(()=>{I.src=ln})},I.onerror=()=>A(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 P=new Blob([new Uint8Array(T)],{type:"image/png"});I.src=T.byteLength?URL.createObjectURL(P):ln}(x,w)}(d,(x,w)=>{x!=null?e(x):w!=null&&e(null,w,{cacheControl:f,expires:g})})});return{cancel:()=>{l.cancel(),s()}}};function re(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function z(i,e,r){if(r&&r[i]){const s=r[i].indexOf(e);s!==-1&&r[i].splice(s,1)}}class R{constructor(e,r={}){Ye(this,r),this.type=e}}class j extends R{constructor(e,r={}){super("error",Ye({error:e},r))}}class Q{on(e,r){return this._listeners=this._listeners||{},re(e,r,this._listeners),this}off(e,r){return z(e,r,this._listeners),z(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},re(e,r,this._oneTimeListeners),this):new Promise(s=>this.once(e,s))}fire(e,r){typeof e=="string"&&(e=new R(e,r||{}));const s=e.type;if(this.listens(s)){e.target=this;const l=this._listeners&&this._listeners[s]?this._listeners[s].slice():[];for(const f of l)f.call(this,e);const u=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(const f of u)z(s,f,this._oneTimeListeners),f.call(this,e);const d=this._eventedParent;d&&(Ye(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(e))}else e instanceof j&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}}var V={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},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-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};class H{constructor(e,r,s,l){this.message=(e?`${e}: `:"")+s,l&&(this.identifier=l),r!=null&&r.__line__&&(this.line=r.__line__)}}function be(i){const e=i.value;return e?[new H(i.key,e,"constants have been deprecated as of v8")]:[]}function ae(i,...e){for(const r of e)for(const s in r)i[s]=r[s];return i}function Ie(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function Pe(i){if(Array.isArray(i))return i.map(Pe);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={};for(const r in i)e[r]=Pe(i[r]);return e}return Ie(i)}class Ce extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}class at{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[s,l]of r)this.bindings[s]=l}concat(e){return new at(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const gt={kind:"null"},xe={kind:"number"},Le={kind:"string"},Fe={kind:"boolean"},vt={kind:"color"},Rt={kind:"object"},je={kind:"value"},It={kind:"collator"},Xt={kind:"formatted"},ii={kind:"padding"},Bt={kind:"resolvedImage"};function At(i,e){return{kind:"array",itemType:i,N:e}}function st(i){if(i.kind==="array"){const e=st(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const mn=[gt,xe,Le,Fe,vt,Xt,Rt,At(je),ii,Bt];function ee(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!ee(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const r of mn)if(!ee(r,e))return null}}return`Expected ${st(i)} but found ${st(e)} instead.`}function ne(i,e){return e.some(r=>r.kind===i.kind)}function ce(i,e){return e.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}var me,ge={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function we(i){return(i=Math.round(i))<0?0:i>255?255:i}function Se(i){return we(i[i.length-1]==="%"?parseFloat(i)/100*255:parseInt(i))}function _e(i){return(e=i[i.length-1]==="%"?parseFloat(i)/100:parseFloat(i))<0?0:e>1?1:e;var e}function ke(i,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?i+(e-i)*r*6:2*r<1?e:3*r<2?i+(e-i)*(2/3-r)*6:i}try{me={}.parseCSSColor=function(i){var e,r=i.replace(/ /g,"").toLowerCase();if(r in ge)return ge[r].slice();if(r[0]==="#")return r.length===4?(e=parseInt(r.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:r.length===7&&(e=parseInt(r.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var s=r.indexOf("("),l=r.indexOf(")");if(s!==-1&&l+1===r.length){var u=r.substr(0,s),d=r.substr(s+1,l-(s+1)).split(","),f=1;switch(u){case"rgba":if(d.length!==4)return null;f=_e(d.pop());case"rgb":return d.length!==3?null:[Se(d[0]),Se(d[1]),Se(d[2]),f];case"hsla":if(d.length!==4)return null;f=_e(d.pop());case"hsl":if(d.length!==3)return null;var g=(parseFloat(d[0])%360+360)%360/360,x=_e(d[1]),w=_e(d[2]),T=w<=.5?w*(x+1):w+x-w*x,A=2*w-T;return[we(255*ke(A,T,g+1/3)),we(255*ke(A,T,g)),we(255*ke(A,T,g-1/3)),f];default:return null}}return null}}catch{}class le{constructor(e,r,s,l=1){this.r=e,this.g=r,this.b=s,this.a=l}static parse(e){if(!e)return;if(e instanceof le)return e;if(typeof e!="string")return;const r=me(e);return r?new le(r[0]/255*r[3],r[1]/255*r[3],r[2]/255*r[3],r[3]):void 0}toString(){const[e,r,s,l]=this.toArray();return`rgba(${Math.round(e)},${Math.round(r)},${Math.round(s)},${l})`}toArray(){const{r:e,g:r,b:s,a:l}=this;return l===0?[0,0,0,0]:[255*e/l,255*r/l,255*s/l,l]}}le.black=new le(0,0,0,1),le.white=new le(1,1,1,1),le.transparent=new le(0,0,0,0),le.red=new le(1,0,0,1);class et{constructor(e,r,s){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=s,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class pt{constructor(e,r,s,l,u){this.text=e,this.image=r,this.scale=s,this.fontStack=l,this.textColor=u}}class De{constructor(e){this.sections=e}static fromString(e){return new De([new pt(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof De?e:De.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class ot{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof ot)return e;if(typeof e=="number")return new ot([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new ot(e)}}toString(){return JSON.stringify(this.values)}}class _t{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new _t({name:e,available:!1}):null}}function Ft(i,e,r,s){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[i,e,r,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[i,e,r,s]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ot(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof le||i instanceof et||i instanceof De||i instanceof ot||i instanceof _t)return!0;if(Array.isArray(i)){for(const e of i)if(!Ot(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!Ot(i[e]))return!1;return!0}return!1}function ut(i){if(i===null)return gt;if(typeof i=="string")return Le;if(typeof i=="boolean")return Fe;if(typeof i=="number")return xe;if(i instanceof le)return vt;if(i instanceof et)return It;if(i instanceof De)return Xt;if(i instanceof ot)return ii;if(i instanceof _t)return Bt;if(Array.isArray(i)){const e=i.length;let r;for(const s of i){const l=ut(s);if(r){if(r===l)continue;r=je;break}r=l}return At(r||je,e)}return Rt}function mi(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof le||i instanceof De||i instanceof ot||i instanceof _t?i.toString():JSON.stringify(i)}class li{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Ot(e[1]))return r.error("invalid value");const s=e[1];let l=ut(s);const u=r.expectedType;return l.kind!=="array"||l.N!==0||!u||u.kind!=="array"||typeof u.N=="number"&&u.N!==0||(l=u),new li(l,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class wt{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const si={string:Le,number:xe,boolean:Fe,object:Rt};class wi{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let s,l=1;const u=e[0];if(u==="array"){let f,g;if(e.length>2){const x=e[1];if(typeof x!="string"||!(x in si)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);f=si[x],l++}else f=je;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);g=e[2],l++}s=At(f,g)}else{if(!si[u])throw new Error(`Types doesn't contain name = ${u}`);s=si[u]}const d=[];for(;l<e.length;l++){const f=r.parse(e[l],l,je);if(!f)return null;d.push(f)}return new wi(s,d)}evaluate(e){for(let r=0;r<this.args.length;r++){const s=this.args[r].evaluate(e);if(!ee(this.type,ut(s)))return s;if(r===this.args.length-1)throw new wt(`Expected value to be of type ${st(this.type)}, but found ${st(ut(s))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const fn={"to-boolean":Fe,"to-color":vt,"to-number":xe,"to-string":Le};class Ui{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const s=e[0];if(!fn[s])throw new Error(`Can't parse ${s} as it is not part of the known types`);if((s==="to-boolean"||s==="to-string")&&e.length!==2)return r.error("Expected one argument.");const l=fn[s],u=[];for(let d=1;d<e.length;d++){const f=r.parse(e[d],d,je);if(!f)return null;u.push(f)}return new Ui(l,u)}evaluate(e){if(this.type.kind==="boolean")return Boolean(this.args[0].evaluate(e));if(this.type.kind==="color"){let r,s;for(const l of this.args){if(r=l.evaluate(e),s=null,r instanceof le)return r;if(typeof r=="string"){const u=e.parseColor(r);if(u)return u}else if(Array.isArray(r)&&(s=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:Ft(r[0],r[1],r[2],r[3]),!s))return new le(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new wt(s||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="padding"){let r;for(const s of this.args){r=s.evaluate(e);const l=ot.parse(r);if(l)return l}throw new wt(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="number"){let r=null;for(const s of this.args){if(r=s.evaluate(e),r===null)return 0;const l=Number(r);if(!isNaN(l))return l}throw new wt(`Could not convert ${JSON.stringify(r)} to number.`)}return this.type.kind==="formatted"?De.fromString(mi(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?_t.fromString(mi(this.args[0].evaluate(e))):mi(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const As=["Unknown","Point","LineString","Polygon"];class Co{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"?As[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let r=this._parseColorCache[e];return r||(r=this._parseColorCache[e]=le.parse(e)),r}}class Qi{constructor(e,r,s,l){this.name=e,this.type=r,this._evaluate=s,this.args=l}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){const s=e[0],l=Qi.definitions[s];if(!l)return r.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);const u=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===e.length-1);let g=null;for(const[x,w]of f){g=new Do(r.registry,r.path,null,r.scope);const T=[];let A=!1;for(let I=1;I<e.length;I++){const P=e[I],F=Array.isArray(x)?x[I-1]:x.type,O=g.parse(P,1+T.length,F);if(!O){A=!0;break}T.push(O)}if(!A)if(Array.isArray(x)&&x.length!==T.length)g.error(`Expected ${x.length} arguments, but found ${T.length} instead.`);else{for(let I=0;I<T.length;I++){const P=Array.isArray(x)?x[I]:x.type,F=T[I];g.concat(I+1).checkSubtype(P,F.type)}if(g.errors.length===0)return new Qi(s,u,w,T)}}if(f.length===1)r.errors.push(...g.errors);else{const x=(f.length?f:d).map(([T])=>{return A=T,Array.isArray(A)?`(${A.map(st).join(", ")})`:`(${st(A.type)}...)`;var A}).join(" | "),w=[];for(let T=1;T<e.length;T++){const A=r.parse(e[T],1+w.length);if(!A)return null;w.push(st(A.type))}r.error(`Expected arguments of type ${x}, but found (${w.join(", ")}) instead.`)}return null}static register(e,r){Qi.definitions=r;for(const s in r)e[s]=Qi}}class Cs{constructor(e,r,s){this.type=It,this.locale=s,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const s=e[1];if(typeof s!="object"||Array.isArray(s))return r.error("Collator options argument must be an object.");const l=r.parse(s["case-sensitive"]!==void 0&&s["case-sensitive"],1,Fe);if(!l)return null;const u=r.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,Fe);if(!u)return null;let d=null;return s.locale&&(d=r.parse(s.locale,1,Le),!d)?null:new Cs(l,u,d)}evaluate(e){return new et(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}const ui=8192;function qn(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function gn(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function Zn(i,e){const r=(180+i[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,l=Math.pow(2,e.z);return[Math.round(r*l*ui),Math.round(s*l*ui)]}function Ct(i,e,r){const s=i[0]-e[0],l=i[1]-e[1],u=i[0]-r[0],d=i[1]-r[1];return s*d-u*l==0&&s*u<=0&&l*d<=0}function ua(i,e){let r=!1;for(let d=0,f=e.length;d<f;d++){const g=e[d];for(let x=0,w=g.length;x<w-1;x++){if(Ct(i,g[x],g[x+1]))return!1;(l=g[x])[1]>(s=i)[1]!=(u=g[x+1])[1]>s[1]&&s[0]<(u[0]-l[0])*(s[1]-l[1])/(u[1]-l[1])+l[0]&&(r=!r)}}var s,l,u;return r}function pa(i,e){for(let r=0;r<e.length;r++)if(ua(i,e[r]))return!0;return!1}function Mo(i,e,r,s){const l=s[0]-r[0],u=s[1]-r[1],d=(i[0]-r[0])*u-l*(i[1]-r[1]),f=(e[0]-r[0])*u-l*(e[1]-r[1]);return d>0&&f<0||d<0&&f>0}function Po(i,e,r){for(const x of r)for(let w=0;w<x.length-1;++w)if((f=[(d=x[w+1])[0]-(u=x[w])[0],d[1]-u[1]])[0]*(g=[(l=e)[0]-(s=i)[0],l[1]-s[1]])[1]-f[1]*g[0]!=0&&Mo(s,l,u,d)&&Mo(u,d,s,l))return!0;var s,l,u,d,f,g;return!1}function da(i,e){for(let r=0;r<i.length;++r)if(!ua(i[r],e))return!1;for(let r=0;r<i.length-1;++r)if(Po(i[r],i[r+1],e))return!1;return!0}function Wl(i,e){for(let r=0;r<e.length;r++)if(da(i,e[r]))return!0;return!1}function Ms(i,e,r){const s=[];for(let l=0;l<i.length;l++){const u=[];for(let d=0;d<i[l].length;d++){const f=Zn(i[l][d],r);qn(e,f),u.push(f)}s.push(u)}return s}function ma(i,e,r){const s=[];for(let l=0;l<i.length;l++){const u=Ms(i[l],e,r);s.push(u)}return s}function ko(i,e,r,s){if(i[0]<r[0]||i[0]>r[2]){const l=.5*s;let u=i[0]-r[0]>l?-s:r[0]-i[0]>l?s:0;u===0&&(u=i[0]-r[2]>l?-s:r[2]-i[0]>l?s:0),i[0]+=u}qn(e,i)}function zo(i,e,r,s){const l=Math.pow(2,s.z)*ui,u=[s.x*ui,s.y*ui],d=[];for(const f of i)for(const g of f){const x=[g.x+u[0],g.y+u[1]];ko(x,e,r,l),d.push(x)}return d}function Lo(i,e,r,s){const l=Math.pow(2,s.z)*ui,u=[s.x*ui,s.y*ui],d=[];for(const g of i){const x=[];for(const w of g){const T=[w.x+u[0],w.y+u[1]];qn(e,T),x.push(T)}d.push(x)}if(e[2]-e[0]<=l/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const g of d)for(const x of g)ko(x,e,r,l)}var f;return d}class Hr{constructor(e,r){this.type=Fe,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Ot(e[1])){const s=e[1];if(s.type==="FeatureCollection")for(let l=0;l<s.features.length;++l){const u=s.features[l].geometry.type;if(u==="Polygon"||u==="MultiPolygon")return new Hr(s,s.features[l].geometry)}else if(s.type==="Feature"){const l=s.geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new Hr(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new Hr(s,s)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(r,s){const l=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(s.type==="Polygon"){const f=Ms(s.coordinates,u,d),g=zo(r.geometry(),l,u,d);if(!gn(l,u))return!1;for(const x of g)if(!ua(x,f))return!1}if(s.type==="MultiPolygon"){const f=ma(s.coordinates,u,d),g=zo(r.geometry(),l,u,d);if(!gn(l,u))return!1;for(const x of g)if(!pa(x,f))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,s){const l=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(s.type==="Polygon"){const f=Ms(s.coordinates,u,d),g=Lo(r.geometry(),l,u,d);if(!gn(l,u))return!1;for(const x of g)if(!da(x,f))return!1}if(s.type==="MultiPolygon"){const f=ma(s.coordinates,u,d),g=Lo(r.geometry(),l,u,d);if(!gn(l,u))return!1;for(const x of g)if(!Wl(x,f))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}function Xn(i){if(i instanceof Qi&&(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 Hr)return!1;let e=!0;return i.eachChild(r=>{e&&!Xn(r)&&(e=!1)}),e}function _n(i){if(i instanceof Qi&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!_n(r)&&(e=!1)}),e}function Ps(i,e){if(i instanceof Qi&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(s=>{r&&!Ps(s,e)&&(r=!1)}),r}class ks{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const s=e[1];return r.scope.has(s)?new ks(s,r.scope.get(s)):r.error(`Unknown variable "${s}". Make sure "${s}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Wn{constructor(e,r=[],s,l=new at,u=[]){this.registry=e,this.path=r,this.key=r.map(d=>`[${d}]`).join(""),this.scope=l,this.errors=u,this.expectedType=s}parse(e,r,s,l,u={}){return r?this.concat(r,s,l)._parse(e,u):this._parse(e,u)}_parse(e,r){function s(l,u,d){return d==="assert"?new wi(u,[l]):d==="coerce"?new Ui(u,[l]):l}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const l=e[0];if(typeof l!="string")return this.error(`Expression name must be a string, but found ${typeof l} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const u=this.registry[l];if(u){let d=u.parse(e,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(this.checkSubtype(f,g))return null}else d=s(d,f,r.typeAnnotation||"coerce");else d=s(d,f,r.typeAnnotation||"coerce");else d=s(d,f,r.typeAnnotation||"assert")}if(!(d instanceof li)&&d.type.kind!=="resolvedImage"&&fa(d)){const f=new Co;try{d=new li(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(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,r,s){const l=typeof e=="number"?this.path.concat(e):this.path,u=s?this.scope.concat(s):this.scope;return new Wn(this.registry,l,r||null,u,this.errors)}error(e,...r){const s=`${this.key}${r.map(l=>`[${l}]`).join("")}`;this.errors.push(new Ce(s,e))}checkSubtype(e,r){const s=ee(e,r);return s&&this.error(s),s}}var Do=Wn;function fa(i){if(i instanceof ks)return fa(i.boundExpression);if(i instanceof Qi&&i.name==="error"||i instanceof Cs||i instanceof Hr)return!1;const e=i instanceof Ui||i instanceof wi;let r=!0;return i.eachChild(s=>{r=e?r&&fa(s):r&&s instanceof li}),!!r&&Xn(i)&&Ps(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function zs(i,e){const r=i.length-1;let s,l,u=0,d=r,f=0;for(;u<=d;)if(f=Math.floor((u+d)/2),s=i[f],l=i[f+1],s<=e){if(f===r||e<l)return f;u=f+1}else{if(!(s>e))throw new wt("Input is not a number.");d=f-1}return 0}class yn{constructor(e,r,s){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[l,u]of s)this.labels.push(l),this.outputs.push(u)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");const s=r.parse(e[1],1,xe);if(!s)return null;const l=[];let u=null;r.expectedType&&r.expectedType.kind!=="value"&&(u=r.expectedType);for(let d=1;d<e.length;d+=2){const f=d===1?-1/0:e[d],g=e[d+1],x=d,w=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 T=r.parse(g,w,u);if(!T)return null;u=u||T.type,l.push([f,T])}return new yn(u,s,l)}evaluate(e){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return s[0].evaluate(e);const u=r.length;return l>=r[u-1]?s[u-1].evaluate(e):s[zs(r,l)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function qt(i,e,r){return i*(1-r)+e*r}var Ls=Object.freeze({__proto__:null,number:qt,color:function(i,e,r){return new le(qt(i.r,e.r,r),qt(i.g,e.g,r),qt(i.b,e.b,r),qt(i.a,e.a,r))},array:function(i,e,r){return i.map((s,l)=>qt(s,e[l],r))},padding:function(i,e,r){const s=i.values,l=e.values;return new ot([qt(s[0],l[0],r),qt(s[1],l[1],r),qt(s[2],l[2],r),qt(s[3],l[3],r)])}});const Ro=.95047,ga=1.08883,_a=4/29,ya=6/29,Bo=3*ya*ya,Hl=Math.PI/180,Kl=180/Math.PI;function xa(i){return i>.008856451679035631?Math.pow(i,1/3):i/Bo+_a}function va(i){return i>ya?i*i*i:Bo*(i-_a)}function ba(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function xt(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Fo(i){const e=xt(i.r),r=xt(i.g),s=xt(i.b),l=xa((.4124564*e+.3575761*r+.1804375*s)/Ro),u=xa((.2126729*e+.7151522*r+.072175*s)/1);return{l:116*u-16,a:500*(l-u),b:200*(u-xa((.0193339*e+.119192*r+.9503041*s)/ga)),alpha:i.a}}function Oo(i){let e=(i.l+16)/116,r=isNaN(i.a)?e:e+i.a/500,s=isNaN(i.b)?e:e-i.b/200;return e=1*va(e),r=Ro*va(r),s=ga*va(s),new le(ba(3.2404542*r-1.5371385*e-.4985314*s),ba(-.969266*r+1.8760108*e+.041556*s),ba(.0556434*r-.2040259*e+1.0572252*s),i.alpha)}function Jl(i,e,r){const s=e-i;return i+r*(s>180||s<-180?s-360*Math.round(s/360):s)}const Hn={forward:Fo,reverse:Oo,interpolate:function(i,e,r){return{l:qt(i.l,e.l,r),a:qt(i.a,e.a,r),b:qt(i.b,e.b,r),alpha:qt(i.alpha,e.alpha,r)}}},Kn={forward:function(i){const{l:e,a:r,b:s}=Fo(i),l=Math.atan2(s,r)*Kl;return{h:l<0?l+360:l,c:Math.sqrt(r*r+s*s),l:e,alpha:i.a}},reverse:function(i){const e=i.h*Hl,r=i.c;return Oo({l:i.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:i.alpha})},interpolate:function(i,e,r){return{h:Jl(i.h,e.h,r),c:qt(i.c,e.c,r),l:qt(i.l,e.l,r),alpha:qt(i.alpha,e.alpha,r)}}};var Uo=Object.freeze({__proto__:null,lab:Hn,hcl:Kn});class Vi{constructor(e,r,s,l,u){this.type=e,this.operator=r,this.interpolation=s,this.input=l,this.labels=[],this.outputs=[];for(const[d,f]of u)this.labels.push(d),this.outputs.push(f)}static interpolationFactor(e,r,s,l){let u=0;if(e.name==="exponential")u=wa(r,e.base,s,l);else if(e.name==="linear")u=wa(r,1,s,l);else if(e.name==="cubic-bezier"){const d=e.controlPoints;u=new ve(d[0],d[1],d[2],d[3]).solve(wa(r,1,s,l))}return u}static parse(e,r){let[s,l,u,...d]=e;if(!Array.isArray(l)||l.length===0)return r.error("Expected an interpolation type expression.",1);if(l[0]==="linear")l={name:"linear"};else if(l[0]==="exponential"){const x=l[1];if(typeof x!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);l={name:"exponential",base:x}}else{if(l[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(l[0])}`,1,0);{const x=l.slice(1);if(x.length!==4||x.some(w=>typeof w!="number"||w<0||w>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);l={name:"cubic-bezier",controlPoints:x}}}if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(u=r.parse(u,2,xe),!u)return null;const f=[];let g=null;s==="interpolate-hcl"||s==="interpolate-lab"?g=vt:r.expectedType&&r.expectedType.kind!=="value"&&(g=r.expectedType);for(let x=0;x<d.length;x+=2){const w=d[x],T=d[x+1],A=x+3,I=x+4;if(typeof w!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',A);if(f.length&&f[f.length-1][0]>=w)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',A);const P=r.parse(T,I,g);if(!P)return null;g=g||P.type,f.push([w,P])}return g.kind==="number"||g.kind==="color"||g.kind==="padding"||g.kind==="array"&&g.itemType.kind==="number"&&typeof g.N=="number"?new Vi(g,s,l,u,f):r.error(`Type ${st(g)} is not interpolatable.`)}evaluate(e){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return s[0].evaluate(e);const u=r.length;if(l>=r[u-1])return s[u-1].evaluate(e);const d=zs(r,l),f=Vi.interpolationFactor(this.interpolation,l,r[d],r[d+1]),g=s[d].evaluate(e),x=s[d+1].evaluate(e);return this.operator==="interpolate"?Ls[this.type.kind.toLowerCase()](g,x,f):this.operator==="interpolate-hcl"?Kn.reverse(Kn.interpolate(Kn.forward(g),Kn.forward(x),f)):Hn.reverse(Hn.interpolate(Hn.forward(g),Hn.forward(x),f))}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function wa(i,e,r,s){const l=s-r,u=i-r;return l===0?0:e===1?u/l:(Math.pow(e,u)-1)/(Math.pow(e,l)-1)}class Ds{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected at least one argument.");let s=null;const l=r.expectedType;l&&l.kind!=="value"&&(s=l);const u=[];for(const f of e.slice(1)){const g=r.parse(f,1+u.length,s,void 0,{typeAnnotation:"omit"});if(!g)return null;s=s||g.type,u.push(g)}if(!s)throw new Error("No output type");const d=l&&u.some(f=>ee(l,f.type));return new Ds(d?je:s,u)}evaluate(e){let r,s=null,l=0;for(const u of this.args)if(l++,s=u.evaluate(e),s&&s instanceof _t&&!s.available&&(r||(r=s.name),s=null,l===this.args.length&&(s=r)),s!==null)break;return s}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class Rs{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const s=[];for(let u=1;u<e.length-1;u+=2){const d=e[u];if(typeof d!="string")return r.error(`Expected string, but found ${typeof d} instead.`,u);if(/[^a-zA-Z0-9_]/.test(d))return r.error("Variable names must contain only alphanumeric characters or '_'.",u);const f=r.parse(e[u+1],u+1);if(!f)return null;s.push([d,f])}const l=r.parse(e[e.length-1],e.length-1,r.expectedType,s);return l?new Rs(s,l):null}outputDefined(){return this.result.outputDefined()}}class Ta{constructor(e,r,s){this.type=e,this.index=r,this.input=s}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,xe),l=r.parse(e[2],2,At(r.expectedType||je));return s&&l?new Ta(l.type.itemType,s,l):null}evaluate(e){const r=this.index.evaluate(e),s=this.input.evaluate(e);if(r<0)throw new wt(`Array index out of bounds: ${r} < 0.`);if(r>=s.length)throw new wt(`Array index out of bounds: ${r} > ${s.length-1}.`);if(r!==Math.floor(r))throw new wt(`Array index must be an integer, but found ${r} instead.`);return s[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class Sa{constructor(e,r){this.type=Fe,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,je),l=r.parse(e[2],2,je);return s&&l?ne(s.type,[Fe,Le,xe,gt,je])?new Sa(s,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${st(s.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!s)return!1;if(!ce(r,["boolean","string","number","null"]))throw new wt(`Expected first argument to be of type boolean, string, number or null, but found ${st(ut(r))} instead.`);if(!ce(s,["string","array"]))throw new wt(`Expected second argument to be of type array or string, but found ${st(ut(s))} instead.`);return s.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Bs{constructor(e,r,s){this.type=xe,this.needle=e,this.haystack=r,this.fromIndex=s}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,je),l=r.parse(e[2],2,je);if(!s||!l)return null;if(!ne(s.type,[Fe,Le,xe,gt,je]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${st(s.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,xe);return u?new Bs(s,l,u):null}return new Bs(s,l)}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!ce(r,["boolean","string","number","null"]))throw new wt(`Expected first argument to be of type boolean, string, number or null, but found ${st(ut(r))} instead.`);if(!ce(s,["string","array"]))throw new wt(`Expected second argument to be of type array or string, but found ${st(ut(s))} instead.`);if(this.fromIndex){const l=this.fromIndex.evaluate(e);return s.indexOf(r,l)}return s.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class Ea{constructor(e,r,s,l,u,d){this.inputType=e,this.type=r,this.input=s,this.cases=l,this.outputs=u,this.otherwise=d}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let s,l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);const u={},d=[];for(let x=2;x<e.length-1;x+=2){let w=e[x];const T=e[x+1];Array.isArray(w)||(w=[w]);const A=r.concat(x);if(w.length===0)return A.error("Expected at least one branch label.");for(const P of w){if(typeof P!="number"&&typeof P!="string")return A.error("Branch labels must be numbers or strings.");if(typeof P=="number"&&Math.abs(P)>Number.MAX_SAFE_INTEGER)return A.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof P=="number"&&Math.floor(P)!==P)return A.error("Numeric branch labels must be integer values.");if(s){if(A.checkSubtype(s,ut(P)))return null}else s=ut(P);if(u[String(P)]!==void 0)return A.error("Branch labels must be unique.");u[String(P)]=d.length}const I=r.parse(T,x,l);if(!I)return null;l=l||I.type,d.push(I)}const f=r.parse(e[1],1,je);if(!f)return null;const g=r.parse(e[e.length-1],e.length-1,l);return g?f.type.kind!=="value"&&r.concat(1).checkSubtype(s,f.type)?null:new Ea(s,l,f,u,d,g):null}evaluate(e){const r=this.input.evaluate(e);return(ut(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class Ia{constructor(e,r,s){this.type=e,this.branches=r,this.otherwise=s}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let s;r.expectedType&&r.expectedType.kind!=="value"&&(s=r.expectedType);const l=[];for(let d=1;d<e.length-1;d+=2){const f=r.parse(e[d],d,Fe);if(!f)return null;const g=r.parse(e[d+1],d+1,s);if(!g)return null;l.push([f,g]),s=s||g.type}const u=r.parse(e[e.length-1],e.length-1,s);if(!u)return null;if(!s)throw new Error("Can't infer output type");return new Ia(s,l,u)}evaluate(e){for(const[r,s]of this.branches)if(r.evaluate(e))return s.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[r,s]of this.branches)e(r),e(s);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}}class Fs{constructor(e,r,s,l){this.type=e,this.input=r,this.beginIndex=s,this.endIndex=l}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,je),l=r.parse(e[2],2,xe);if(!s||!l)return null;if(!ne(s.type,[At(je),Le,je]))return r.error(`Expected first argument to be of type array or string, but found ${st(s.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,xe);return u?new Fs(s.type,s,l,u):null}return new Fs(s.type,s,l)}evaluate(e){const r=this.input.evaluate(e),s=this.beginIndex.evaluate(e);if(!ce(r,["string","array"]))throw new wt(`Expected first argument to be of type array or string, but found ${st(ut(r))} instead.`);if(this.endIndex){const l=this.endIndex.evaluate(e);return r.slice(s,l)}return r.slice(s)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Vo(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function No(i,e,r,s){return s.compare(e,r)===0}function xn(i,e,r){const s=i!=="=="&&i!=="!=";return class xp{constructor(u,d,f){this.type=Fe,this.lhs=u,this.rhs=d,this.collator=f,this.hasUntypedArgument=u.type.kind==="value"||d.type.kind==="value"}static parse(u,d){if(u.length!==3&&u.length!==4)return d.error("Expected two or three arguments.");const f=u[0];let g=d.parse(u[1],1,je);if(!g)return null;if(!Vo(f,g.type))return d.concat(1).error(`"${f}" comparisons are not supported for type '${st(g.type)}'.`);let x=d.parse(u[2],2,je);if(!x)return null;if(!Vo(f,x.type))return d.concat(2).error(`"${f}" comparisons are not supported for type '${st(x.type)}'.`);if(g.type.kind!==x.type.kind&&g.type.kind!=="value"&&x.type.kind!=="value")return d.error(`Cannot compare types '${st(g.type)}' and '${st(x.type)}'.`);s&&(g.type.kind==="value"&&x.type.kind!=="value"?g=new wi(x.type,[g]):g.type.kind!=="value"&&x.type.kind==="value"&&(x=new wi(g.type,[x])));let w=null;if(u.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(w=d.parse(u[3],3,It),!w)return null}return new xp(g,x,w)}evaluate(u){const d=this.lhs.evaluate(u),f=this.rhs.evaluate(u);if(s&&this.hasUntypedArgument){const g=ut(d),x=ut(f);if(g.kind!==x.kind||g.kind!=="string"&&g.kind!=="number")throw new wt(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${g.kind}, ${x.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const g=ut(d),x=ut(f);if(g.kind!=="string"||x.kind!=="string")return e(u,d,f)}return this.collator?r(u,d,f,this.collator.evaluate(u)):e(u,d,f)}eachChild(u){u(this.lhs),u(this.rhs),this.collator&&u(this.collator)}outputDefined(){return!0}}}const Yl=xn("==",function(i,e,r){return e===r},No),Ql=xn("!=",function(i,e,r){return e!==r},function(i,e,r,s){return!No(0,e,r,s)}),ec=xn("<",function(i,e,r){return e<r},function(i,e,r,s){return s.compare(e,r)<0}),tc=xn(">",function(i,e,r){return e>r},function(i,e,r,s){return s.compare(e,r)>0}),ic=xn("<=",function(i,e,r){return e<=r},function(i,e,r,s){return s.compare(e,r)<=0}),rc=xn(">=",function(i,e,r){return e>=r},function(i,e,r,s){return s.compare(e,r)>=0});class Aa{constructor(e,r,s,l,u){this.type=Le,this.number=e,this.locale=r,this.currency=s,this.minFractionDigits=l,this.maxFractionDigits=u}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const s=r.parse(e[1],1,xe);if(!s)return null;const l=e[2];if(typeof l!="object"||Array.isArray(l))return r.error("NumberFormat options argument must be an object.");let u=null;if(l.locale&&(u=r.parse(l.locale,1,Le),!u))return null;let d=null;if(l.currency&&(d=r.parse(l.currency,1,Le),!d))return null;let f=null;if(l["min-fraction-digits"]&&(f=r.parse(l["min-fraction-digits"],1,xe),!f))return null;let g=null;return l["max-fraction-digits"]&&(g=r.parse(l["max-fraction-digits"],1,xe),!g)?null:new Aa(s,u,d,f,g)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class Os{constructor(e){this.type=Xt,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const s=e[1];if(!Array.isArray(s)&&typeof s=="object")return r.error("First argument must be an image or text section.");const l=[];let u=!1;for(let d=1;d<=e.length-1;++d){const f=e[d];if(u&&typeof f=="object"&&!Array.isArray(f)){u=!1;let g=null;if(f["font-scale"]&&(g=r.parse(f["font-scale"],1,xe),!g))return null;let x=null;if(f["text-font"]&&(x=r.parse(f["text-font"],1,At(Le)),!x))return null;let w=null;if(f["text-color"]&&(w=r.parse(f["text-color"],1,vt),!w))return null;const T=l[l.length-1];T.scale=g,T.font=x,T.textColor=w}else{const g=r.parse(e[d],1,je);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'.");u=!0,l.push({content:g,scale:null,font:null,textColor:null})}}return new Os(l)}evaluate(e){return new De(this.sections.map(r=>{const s=r.content.evaluate(e);return ut(s)===Bt?new pt("",s,null,null,null):new pt(mi(s),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null)}))}eachChild(e){for(const r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}}class Ca{constructor(e){this.type=Bt,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const s=r.parse(e[1],1,Le);return s?new Ca(s):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),s=_t.fromString(r);return s&&e.availableImages&&(s.available=e.availableImages.indexOf(r)>-1),s}eachChild(e){e(this.input)}outputDefined(){return!1}}class Ma{constructor(e){this.type=xe,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=r.parse(e[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${st(s.type)} instead.`):new Ma(s):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new wt(`Expected value to be of type string or array, but found ${st(ut(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const vn={"==":Yl,"!=":Ql,">":tc,"<":ec,">=":rc,"<=":ic,array:wi,at:Ta,boolean:wi,case:Ia,coalesce:Ds,collator:Cs,format:Os,image:Ca,in:Sa,"index-of":Bs,interpolate:Vi,"interpolate-hcl":Vi,"interpolate-lab":Vi,length:Ma,let:Rs,literal:li,match:Ea,number:wi,"number-format":Aa,object:wi,slice:Fs,step:yn,string:wi,"to-boolean":Ui,"to-color":Ui,"to-number":Ui,"to-string":Ui,var:ks,within:Hr};function $o(i,[e,r,s,l]){e=e.evaluate(i),r=r.evaluate(i),s=s.evaluate(i);const u=l?l.evaluate(i):1,d=Ft(e,r,s,u);if(d)throw new wt(d);return new le(e/255*u,r/255*u,s/255*u,u)}function Pa(i,e){return i in e}function ka(i,e){const r=e[i];return r===void 0?null:r}function Kr(i){return{type:i}}function jo(i){return{result:"success",value:i}}function Ut(i){return{result:"error",value:i}}function bn(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function dt(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function Jn(i){return!!i.expression&&i.expression.interpolated}function tt(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function kt(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Us(i){return i}function za(i,e){const r=e.type==="color",s=i.stops&&typeof i.stops[0][0]=="object",l=s||!(s||i.property!==void 0),u=i.type||(Jn(e)?"exponential":"interval");if(r||e.type==="padding"){const x=r?le.parse:ot.parse;(i=ae({},i)).stops&&(i.stops=i.stops.map(w=>[w[0],x(w[1])])),i.default=x(i.default?i.default:e.default)}if(i.colorSpace&&i.colorSpace!=="rgb"&&!Uo[i.colorSpace])throw new Error(`Unknown color space: ${i.colorSpace}`);let d,f,g;if(u==="exponential")d=Go;else if(u==="interval")d=sc;else if(u==="categorical"){d=nc,f=Object.create(null);for(const x of i.stops)f[x[0]]=x[1];g=typeof i.stops[0][0]}else{if(u!=="identity")throw new Error(`Unknown function type "${u}"`);d=qo}if(s){const x={},w=[];for(let I=0;I<i.stops.length;I++){const P=i.stops[I],F=P[0].zoom;x[F]===void 0&&(x[F]={zoom:F,type:i.type,property:i.property,default:i.default,stops:[]},w.push(F)),x[F].stops.push([P[0].value,P[1]])}const T=[];for(const I of w)T.push([x[I].zoom,za(x[I],e)]);const A={name:"linear"};return{kind:"composite",interpolationType:A,interpolationFactor:Vi.interpolationFactor.bind(void 0,A),zoomStops:T.map(I=>I[0]),evaluate:({zoom:I},P)=>Go({stops:T,base:i.base},e,I).evaluate(I,P)}}if(l){const x=u==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:x,interpolationFactor:Vi.interpolationFactor.bind(void 0,x),zoomStops:i.stops.map(w=>w[0]),evaluate:({zoom:w})=>d(i,e,w,f,g)}}return{kind:"source",evaluate(x,w){const T=w&&w.properties?w.properties[i.property]:void 0;return T===void 0?Yn(i.default,e.default):d(i,e,T,f,g)}}}function Yn(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function nc(i,e,r,s,l){return Yn(typeof r===l?s[r]:void 0,i.default,e.default)}function sc(i,e,r){if(tt(r)!=="number")return Yn(i.default,e.default);const s=i.stops.length;if(s===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[s-1][0])return i.stops[s-1][1];const l=zs(i.stops.map(u=>u[0]),r);return i.stops[l][1]}function Go(i,e,r){const s=i.base!==void 0?i.base:1;if(tt(r)!=="number")return Yn(i.default,e.default);const l=i.stops.length;if(l===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[l-1][0])return i.stops[l-1][1];const u=zs(i.stops.map(w=>w[0]),r),d=function(w,T,A,I){const P=I-A,F=w-A;return P===0?0:T===1?F/P:(Math.pow(T,F)-1)/(Math.pow(T,P)-1)}(r,s,i.stops[u][0],i.stops[u+1][0]),f=i.stops[u][1],g=i.stops[u+1][1];let x=Ls[e.type]||Us;if(i.colorSpace&&i.colorSpace!=="rgb"){const w=Uo[i.colorSpace];x=(T,A)=>w.reverse(w.interpolate(w.forward(T),w.forward(A),d))}return typeof f.evaluate=="function"?{evaluate(...w){const T=f.evaluate.apply(void 0,w),A=g.evaluate.apply(void 0,w);if(T!==void 0&&A!==void 0)return x(T,A,d)}}:x(f,g,d)}function qo(i,e,r){switch(e.type){case"color":r=le.parse(r);break;case"formatted":r=De.fromString(r.toString());break;case"resolvedImage":r=_t.fromString(r.toString());break;case"padding":r=ot.parse(r);break;default:tt(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return Yn(r,i.default,e.default)}Qi.register(vn,{error:[{kind:"error"},[Le],(i,[e])=>{throw new wt(e.evaluate(i))}],typeof:[Le,[je],(i,[e])=>st(ut(e.evaluate(i)))],"to-rgba":[At(xe,4),[vt],(i,[e])=>e.evaluate(i).toArray()],rgb:[vt,[xe,xe,xe],$o],rgba:[vt,[xe,xe,xe,xe],$o],has:{type:Fe,overloads:[[[Le],(i,[e])=>Pa(e.evaluate(i),i.properties())],[[Le,Rt],(i,[e,r])=>Pa(e.evaluate(i),r.evaluate(i))]]},get:{type:je,overloads:[[[Le],(i,[e])=>ka(e.evaluate(i),i.properties())],[[Le,Rt],(i,[e,r])=>ka(e.evaluate(i),r.evaluate(i))]]},"feature-state":[je,[Le],(i,[e])=>ka(e.evaluate(i),i.featureState||{})],properties:[Rt,[],i=>i.properties()],"geometry-type":[Le,[],i=>i.geometryType()],id:[je,[],i=>i.id()],zoom:[xe,[],i=>i.globals.zoom],"heatmap-density":[xe,[],i=>i.globals.heatmapDensity||0],"line-progress":[xe,[],i=>i.globals.lineProgress||0],accumulated:[je,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[xe,Kr(xe),(i,e)=>{let r=0;for(const s of e)r+=s.evaluate(i);return r}],"*":[xe,Kr(xe),(i,e)=>{let r=1;for(const s of e)r*=s.evaluate(i);return r}],"-":{type:xe,overloads:[[[xe,xe],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[xe],(i,[e])=>-e.evaluate(i)]]},"/":[xe,[xe,xe],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[xe,[xe,xe],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[xe,[],()=>Math.LN2],pi:[xe,[],()=>Math.PI],e:[xe,[],()=>Math.E],"^":[xe,[xe,xe],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[xe,[xe],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[xe,[xe],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[xe,[xe],(i,[e])=>Math.log(e.evaluate(i))],log2:[xe,[xe],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[xe,[xe],(i,[e])=>Math.sin(e.evaluate(i))],cos:[xe,[xe],(i,[e])=>Math.cos(e.evaluate(i))],tan:[xe,[xe],(i,[e])=>Math.tan(e.evaluate(i))],asin:[xe,[xe],(i,[e])=>Math.asin(e.evaluate(i))],acos:[xe,[xe],(i,[e])=>Math.acos(e.evaluate(i))],atan:[xe,[xe],(i,[e])=>Math.atan(e.evaluate(i))],min:[xe,Kr(xe),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[xe,Kr(xe),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[xe,[xe],(i,[e])=>Math.abs(e.evaluate(i))],round:[xe,[xe],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[xe,[xe],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[xe,[xe],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[Fe,[Le,je],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[Fe,[je],(i,[e])=>i.id()===e.value],"filter-type-==":[Fe,[Le],(i,[e])=>i.geometryType()===e.value],"filter-<":[Fe,[Le,je],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s<l}],"filter-id-<":[Fe,[je],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r<s}],"filter->":[Fe,[Le,je],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>l}],"filter-id->":[Fe,[je],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>s}],"filter-<=":[Fe,[Le,je],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s<=l}],"filter-id-<=":[Fe,[je],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r<=s}],"filter->=":[Fe,[Le,je],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>=l}],"filter-id->=":[Fe,[je],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>=s}],"filter-has":[Fe,[je],(i,[e])=>e.value in i.properties()],"filter-has-id":[Fe,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Fe,[At(Le)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[Fe,[At(je)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[Fe,[Le,At(je)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[Fe,[Le,At(je)],(i,[e,r])=>function(s,l,u,d){for(;u<=d;){const f=u+d>>1;if(l[f]===s)return!0;l[f]>s?d=f-1:u=f+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:Fe,overloads:[[[Fe,Fe],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[Kr(Fe),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:Fe,overloads:[[[Fe,Fe],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[Kr(Fe),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[Fe,[Fe],(i,[e])=>!e.evaluate(i)],"is-supported-script":[Fe,[Le],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[Le,[Le],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[Le,[Le],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[Le,Kr(je),(i,e)=>e.map(r=>mi(r.evaluate(i))).join("")],"resolved-locale":[Le,[It],(i,[e])=>e.evaluate(i).resolvedLocale()]});class Vs{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new Co,this._defaultValue=r?function(s){return s.type==="color"&&kt(s.default)?new le(0,0,0,0):s.type==="color"?le.parse(s.default)||null:s.type==="padding"?ot.parse(s.default)||null:s.default===void 0?null:s.default}(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,s,l,u,d){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=s,this._evaluator.canonical=l,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d,this.expression.evaluate(this._evaluator)}evaluate(e,r,s,l,u,d){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=s||null,this._evaluator.canonical=l,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d||null;try{const f=this.expression.evaluate(this._evaluator);if(f==null||typeof f=="number"&&f!=f)return this._defaultValue;if(this._enumValues&&!(f in this._enumValues))throw new wt(`Expected value to be one of ${Object.keys(this._enumValues).map(g=>JSON.stringify(g)).join(", ")}, but found ${JSON.stringify(f)} instead.`);return f}catch(f){return this._warningHistory[f.message]||(this._warningHistory[f.message]=!0,typeof console<"u"&&console.warn(f.message)),this._defaultValue}}}function Qn(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in vn}function es(i,e){const r=new Do(vn,[],e?function(l){const u={color:vt,string:Le,number:xe,enum:Le,boolean:Fe,formatted:Xt,padding:ii,resolvedImage:Bt};return l.type==="array"?At(u[l.value]||je,l.length):u[l.type]}(e):void 0),s=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?jo(new Vs(s,e)):Ut(r.errors)}class ts{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!_n(r.expression)}evaluateWithoutErrorHandling(e,r,s,l,u,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,l,u,d)}evaluate(e,r,s,l,u,d){return this._styleExpression.evaluate(e,r,s,l,u,d)}}class La{constructor(e,r,s,l){this.kind=e,this.zoomStops=s,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!_n(r.expression),this.interpolationType=l}evaluateWithoutErrorHandling(e,r,s,l,u,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,l,u,d)}evaluate(e,r,s,l,u,d){return this._styleExpression.evaluate(e,r,s,l,u,d)}interpolationFactor(e,r,s){return this.interpolationType?Vi.interpolationFactor(this.interpolationType,e,r,s):0}}function Zo(i,e){const r=es(i,e);if(r.result==="error")return r;const s=r.value.expression,l=Xn(s);if(!l&&!bn(e))return Ut([new Ce("","data expressions not supported")]);const u=Ps(s,["zoom"]);if(!u&&!dt(e))return Ut([new Ce("","zoom expressions not supported")]);const d=$s(s);return d||u?d instanceof Ce?Ut([d]):d instanceof Vi&&!Jn(e)?Ut([new Ce("",'"interpolate" expressions cannot be used with this property')]):jo(d?new La(l?"camera":"composite",r.value,d.labels,d instanceof Vi?d.interpolation:void 0):new ts(l?"constant":"source",r.value)):Ut([new Ce("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Ns{constructor(e,r){this._parameters=e,this._specification=r,ae(this,za(this._parameters,this._specification))}static deserialize(e){return new Ns(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function $s(i){let e=null;if(i instanceof Rs)e=$s(i.result);else if(i instanceof Ds){for(const r of i.args)if(e=$s(r),e)break}else(i instanceof yn||i instanceof Vi)&&i.input instanceof Qi&&i.input.name==="zoom"&&(e=i);return e instanceof Ce||i.eachChild(r=>{const s=$s(r);s instanceof Ce?e=s:!e&&s?e=new Ce("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&s&&e!==s&&(e=new Ce("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function er(i){const e=i.key,r=i.value,s=i.valueSpec||{},l=i.objectElementValidators||{},u=i.style,d=i.styleSpec,f=i.validateSpec;let g=[];const x=tt(r);if(x!=="object")return[new H(e,r,`object expected, ${x} found`)];for(const w in r){const T=w.split(".")[0],A=s[T]||s["*"];let I;if(l[T])I=l[T];else if(s[T])I=f;else if(l["*"])I=l["*"];else{if(!s["*"]){g.push(new H(e,r[w],`unknown property "${w}"`));continue}I=f}g=g.concat(I({key:(e&&`${e}.`)+w,value:r[w],valueSpec:A,style:u,styleSpec:d,object:r,objectKey:w,validateSpec:f},r))}for(const w in s)l[w]||s[w].required&&s[w].default===void 0&&r[w]===void 0&&g.push(new H(e,r,`missing required property "${w}"`));return g}function Xo(i){const e=i.value,r=i.valueSpec,s=i.style,l=i.styleSpec,u=i.key,d=i.arrayElementValidator||i.validateSpec;if(tt(e)!=="array")return[new H(u,e,`array expected, ${tt(e)} found`)];if(r.length&&e.length!==r.length)return[new H(u,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new H(u,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let f={type:r.value,values:r.values};l.$version<7&&(f.function=r.function),tt(r.value)==="object"&&(f=r.value);let g=[];for(let x=0;x<e.length;x++)g=g.concat(d({array:e,arrayIndex:x,value:e[x],valueSpec:f,validateSpec:i.validateSpec,style:s,styleSpec:l,key:`${u}[${x}]`}));return g}function Da(i){const e=i.key,r=i.value,s=i.valueSpec;let l=tt(r);return l==="number"&&r!=r&&(l="NaN"),l!=="number"?[new H(e,r,`number expected, ${l} found`)]:"minimum"in s&&r<s.minimum?[new H(e,r,`${r} is less than the minimum value ${s.minimum}`)]:"maximum"in s&&r>s.maximum?[new H(e,r,`${r} is greater than the maximum value ${s.maximum}`)]:[]}function Wo(i){const e=i.valueSpec,r=Ie(i.value.type);let s,l,u,d={};const f=r!=="categorical"&&i.value.property===void 0,g=!f,x=tt(i.value.stops)==="array"&&tt(i.value.stops[0])==="array"&&tt(i.value.stops[0][0])==="object",w=er({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(I){if(r==="identity")return[new H(I.key,I.value,'identity function may not have a "stops" property')];let P=[];const F=I.value;return P=P.concat(Xo({key:I.key,value:F,valueSpec:I.valueSpec,validateSpec:I.validateSpec,style:I.style,styleSpec:I.styleSpec,arrayElementValidator:T})),tt(F)==="array"&&F.length===0&&P.push(new H(I.key,F,"array must have at least one stop")),P},default:function(I){return I.validateSpec({key:I.key,value:I.value,valueSpec:e,validateSpec:I.validateSpec,style:I.style,styleSpec:I.styleSpec})}}});return r==="identity"&&f&&w.push(new H(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||w.push(new H(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!Jn(i.valueSpec)&&w.push(new H(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(g&&!bn(i.valueSpec)?w.push(new H(i.key,i.value,"property functions not supported")):f&&!dt(i.valueSpec)&&w.push(new H(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!x||i.value.property!==void 0||w.push(new H(i.key,i.value,'"property" property is required')),w;function T(I){let P=[];const F=I.value,O=I.key;if(tt(F)!=="array")return[new H(O,F,`array expected, ${tt(F)} found`)];if(F.length!==2)return[new H(O,F,`array length 2 expected, length ${F.length} found`)];if(x){if(tt(F[0])!=="object")return[new H(O,F,`object expected, ${tt(F[0])} found`)];if(F[0].zoom===void 0)return[new H(O,F,"object stop key must have zoom")];if(F[0].value===void 0)return[new H(O,F,"object stop key must have value")];if(u&&u>Ie(F[0].zoom))return[new H(O,F[0].zoom,"stop zoom values must appear in ascending order")];Ie(F[0].zoom)!==u&&(u=Ie(F[0].zoom),l=void 0,d={}),P=P.concat(er({key:`${O}[0]`,value:F[0],valueSpec:{zoom:{}},validateSpec:I.validateSpec,style:I.style,styleSpec:I.styleSpec,objectElementValidators:{zoom:Da,value:A}}))}else P=P.concat(A({key:`${O}[0]`,value:F[0],valueSpec:{},validateSpec:I.validateSpec,style:I.style,styleSpec:I.styleSpec},F));return Qn(Pe(F[1]))?P.concat([new H(`${O}[1]`,F[1],"expressions are not allowed in function stops.")]):P.concat(I.validateSpec({key:`${O}[1]`,value:F[1],valueSpec:e,validateSpec:I.validateSpec,style:I.style,styleSpec:I.styleSpec}))}function A(I,P){const F=tt(I.value),O=Ie(I.value),G=I.value!==null?I.value:P;if(s){if(F!==s)return[new H(I.key,G,`${F} stop domain type must match previous stop domain type ${s}`)]}else s=F;if(F!=="number"&&F!=="string"&&F!=="boolean")return[new H(I.key,G,"stop domain value must be a number, string, or boolean")];if(F!=="number"&&r!=="categorical"){let Y=`number expected, ${F} found`;return bn(e)&&r===void 0&&(Y+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new H(I.key,G,Y)]}return r!=="categorical"||F!=="number"||isFinite(O)&&Math.floor(O)===O?r!=="categorical"&&F==="number"&&l!==void 0&&O<l?[new H(I.key,G,"stop domain values must appear in ascending order")]:(l=O,r==="categorical"&&O in d?[new H(I.key,G,"stop domain values must be unique")]:(d[O]=!0,[])):[new H(I.key,G,`integer expected, found ${O}`)]}}function Jr(i){const e=(i.expressionContext==="property"?Zo:es)(Pe(i.value),i.valueSpec);if(e.result==="error")return e.value.map(s=>new H(`${i.key}${s.key}`,i.value,s.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new H(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"&&!_n(r))return[new H(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!_n(r))return[new H(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Ps(r,["zoom","feature-state"]))return[new H(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Xn(r))return[new H(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function is(i){const e=i.key,r=i.value,s=i.valueSpec,l=[];return Array.isArray(s.values)?s.values.indexOf(Ie(r))===-1&&l.push(new H(e,r,`expected one of [${s.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(s.values).indexOf(Ie(r))===-1&&l.push(new H(e,r,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(r)} found`)),l}function wn(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!wn(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const ac={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function js(i){if(i==null)return{filter:()=>!0,needGeometry:!1};wn(i)||(i=Tn(i));const e=es(i,ac);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,s,l)=>e.value.evaluate(r,s,{},l),needGeometry:Ko(i)}}function Ho(i,e){return i<e?-1:i>e?1:0}function Ko(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e<i.length;e++)if(Ko(i[e]))return!0;return!1}function Tn(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?Sn(i[1],i[2],"=="):e==="!="?Zs(Sn(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Sn(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(Tn))):e==="all"?["all"].concat(i.slice(1).map(Tn)):e==="none"?["all"].concat(i.slice(1).map(Tn).map(Zs)):e==="in"?Gs(i[1],i.slice(2)):e==="!in"?Zs(Gs(i[1],i.slice(2))):e==="has"?qs(i[1]):e==="!has"?Zs(qs(i[1])):e!=="within"||i;var r}function Sn(i,e,r){switch(i){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,i,e]}}function Gs(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",i,["literal",e.sort(Ho)]]:["filter-in-small",i,["literal",e]]}}function qs(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Zs(i){return["!",i]}function En(i){return wn(Pe(i.value))?Jr(ae({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Jo(i)}function Jo(i){const e=i.value,r=i.key;if(tt(e)!=="array")return[new H(r,e,`array expected, ${tt(e)} found`)];const s=i.styleSpec;let l,u=[];if(e.length<1)return[new H(r,e,"filter array must have at least 1 element")];switch(u=u.concat(is({key:`${r}[0]`,value:e[0],valueSpec:s.filter_operator,style:i.style,styleSpec:i.styleSpec})),Ie(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Ie(e[1])==="$type"&&u.push(new H(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&u.push(new H(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(l=tt(e[1]),l!=="string"&&u.push(new H(`${r}[1]`,e[1],`string expected, ${l} found`)));for(let d=2;d<e.length;d++)l=tt(e[d]),Ie(e[1])==="$type"?u=u.concat(is({key:`${r}[${d}]`,value:e[d],valueSpec:s.geometry_type,style:i.style,styleSpec:i.styleSpec})):l!=="string"&&l!=="number"&&l!=="boolean"&&u.push(new H(`${r}[${d}]`,e[d],`string, number, or boolean expected, ${l} found`));break;case"any":case"all":case"none":for(let d=1;d<e.length;d++)u=u.concat(Jo({key:`${r}[${d}]`,value:e[d],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":l=tt(e[1]),e.length!==2?u.push(new H(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):l!=="string"&&u.push(new H(`${r}[1]`,e[1],`string expected, ${l} found`));break;case"within":l=tt(e[1]),e.length!==2?u.push(new H(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):l!=="object"&&u.push(new H(`${r}[1]`,e[1],`object expected, ${l} found`))}return u}function Yo(i,e){const r=i.key,s=i.validateSpec,l=i.style,u=i.styleSpec,d=i.value,f=i.objectKey,g=u[`${e}_${i.layerType}`];if(!g)return[];const x=f.match(/^(.*)-transition$/);if(e==="paint"&&x&&g[x[1]]&&g[x[1]].transition)return s({key:r,value:d,valueSpec:u.transition,style:l,styleSpec:u});const w=i.valueSpec||g[f];if(!w)return[new H(r,d,`unknown property "${f}"`)];let T;if(tt(d)==="string"&&bn(w)&&!w.tokens&&(T=/^{([^}]+)}$/.exec(d)))return[new H(r,d,`"${f}" does not support interpolation syntax
2
- Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(T[1])} }\`.`)];const A=[];return i.layerType==="symbol"&&(f==="text-field"&&l&&!l.glyphs&&A.push(new H(r,d,'use of "text-field" requires a style "glyphs" property')),f==="text-font"&&kt(Pe(d))&&Ie(d.type)==="identity"&&A.push(new H(r,d,'"text-font" does not support identity functions'))),A.concat(s({key:i.key,value:d,valueSpec:w,style:l,styleSpec:u,expressionContext:"property",propertyType:e,propertyKey:f}))}function Qo(i){return Yo(i,"paint")}function el(i){return Yo(i,"layout")}function tl(i){let e=[];const r=i.value,s=i.key,l=i.style,u=i.styleSpec;r.type||r.ref||e.push(new H(s,r,'either "type" or "ref" is required'));let d=Ie(r.type);const f=Ie(r.ref);if(r.id){const g=Ie(r.id);for(let x=0;x<i.arrayIndex;x++){const w=l.layers[x];Ie(w.id)===g&&e.push(new H(s,r.id,`duplicate layer id "${r.id}", previously used at line ${w.id.__line__}`))}}if("ref"in r){let g;["type","source","source-layer","filter","layout"].forEach(x=>{x in r&&e.push(new H(s,r[x],`"${x}" is prohibited for ref layers`))}),l.layers.forEach(x=>{Ie(x.id)===f&&(g=x)}),g?g.ref?e.push(new H(s,r.ref,"ref cannot reference another ref layer")):d=Ie(g.type):e.push(new H(s,r.ref,`ref layer "${f}" not found`))}else if(d!=="background")if(r.source){const g=l.sources&&l.sources[r.source],x=g&&Ie(g.type);g?x==="vector"&&d==="raster"?e.push(new H(s,r.source,`layer "${r.id}" requires a raster source`)):x==="raster"&&d!=="raster"?e.push(new H(s,r.source,`layer "${r.id}" requires a vector source`)):x!=="vector"||r["source-layer"]?x==="raster-dem"&&d!=="hillshade"?e.push(new H(s,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||e.push(new H(s,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new H(s,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new H(s,r.source,`source "${r.source}" not found`))}else e.push(new H(s,r,'missing required property "source"'));return e=e.concat(er({key:s,value:r,valueSpec:u.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${s}.type`,value:r.type,valueSpec:u.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:En,layout:g=>er({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":x=>el(ae({layerType:d},x))}}),paint:g=>er({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":x=>Qo(ae({layerType:d},x))}})}})),e}function _r(i){const e=i.value,r=i.key,s=tt(e);return s!=="string"?[new H(r,e,`string expected, ${s} found`)]:[]}const rs={promoteId:function({key:i,value:e}){if(tt(e)==="string")return _r({key:i,value:e});{const r=[];for(const s in e)r.push(..._r({key:`${i}.${s}`,value:e[s]}));return r}}};function Ni(i){const e=i.value,r=i.key,s=i.styleSpec,l=i.style,u=i.validateSpec;if(!e.type)return[new H(r,e,'"type" is required')];const d=Ie(e.type);let f;switch(d){case"vector":case"raster":case"raster-dem":return f=er({key:r,value:e,valueSpec:s[`source_${d.replace("-","_")}`],style:i.style,styleSpec:s,objectElementValidators:rs,validateSpec:u}),f;case"geojson":if(f=er({key:r,value:e,valueSpec:s.source_geojson,style:l,styleSpec:s,validateSpec:u,objectElementValidators:rs}),e.cluster)for(const g in e.clusterProperties){const[x,w]=e.clusterProperties[g],T=typeof x=="string"?[x,["accumulated"],["get",g]]:x;f.push(...Jr({key:`${r}.${g}.map`,value:w,validateSpec:u,expressionContext:"cluster-map"})),f.push(...Jr({key:`${r}.${g}.reduce`,value:T,validateSpec:u,expressionContext:"cluster-reduce"}))}return f;case"video":return er({key:r,value:e,valueSpec:s.source_video,style:l,validateSpec:u,styleSpec:s});case"image":return er({key:r,value:e,valueSpec:s.source_image,style:l,validateSpec:u,styleSpec:s});case"canvas":return[new H(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return is({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:l,validateSpec:u,styleSpec:s})}}function ns(i){const e=i.value,r=i.styleSpec,s=r.light,l=i.style;let u=[];const d=tt(e);if(e===void 0)return u;if(d!=="object")return u=u.concat([new H("light",e,`object expected, ${d} found`)]),u;for(const f in e){const g=f.match(/^(.*)-transition$/);u=u.concat(g&&s[g[1]]&&s[g[1]].transition?i.validateSpec({key:f,value:e[f],valueSpec:r.transition,validateSpec:i.validateSpec,style:l,styleSpec:r}):s[f]?i.validateSpec({key:f,value:e[f],valueSpec:s[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new H(f,e[f],`unknown property "${f}"`)])}return u}function il(i){const e=i.value,r=i.styleSpec,s=r.terrain,l=i.style;let u=[];const d=tt(e);if(e===void 0)return u;if(d!=="object")return u=u.concat([new H("terrain",e,`object expected, ${d} found`)]),u;for(const f in e)u=u.concat(s[f]?i.validateSpec({key:f,value:e[f],valueSpec:s[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new H(f,e[f],`unknown property "${f}"`)]);return u}function rl(i){let e=[];const r=i.value,s=i.key;if(Array.isArray(r)){const l=[],u=[];for(const d in r)r[d].id&&l.includes(r[d].id)&&e.push(new H(s,r,`all the sprites' ids must be unique, but ${r[d].id} is duplicated`)),l.push(r[d].id),r[d].url&&u.includes(r[d].url)&&e.push(new H(s,r,`all the sprites' URLs must be unique, but ${r[d].url} is duplicated`)),u.push(r[d].url),e=e.concat(er({key:`${s}[${d}]`,value:r[d],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return e}return _r({key:s,value:r})}const nl={"*":()=>[],array:Xo,boolean:function(i){const e=i.value,r=i.key,s=tt(e);return s!=="boolean"?[new H(r,e,`boolean expected, ${s} found`)]:[]},number:Da,color:function(i){const e=i.key,r=i.value,s=tt(r);return s!=="string"?[new H(e,r,`color expected, ${s} found`)]:me(r)===null?[new H(e,r,`color expected, "${r}" found`)]:[]},constants:be,enum:is,filter:En,function:Wo,layer:tl,object:er,source:Ni,light:ns,terrain:il,string:_r,formatted:function(i){return _r(i).length===0?[]:Jr(i)},resolvedImage:function(i){return _r(i).length===0?[]:Jr(i)},padding:function(i){const e=i.key,r=i.value;if(tt(r)==="array"){if(r.length<1||r.length>4)return[new H(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const s={type:"number"};let l=[];for(let u=0;u<r.length;u++)l=l.concat(i.validateSpec({key:`${e}[${u}]`,value:r[u],validateSpec:i.validateSpec,valueSpec:s}));return l}return Da({key:e,value:r,valueSpec:{}})},sprite:rl};function ss(i){const e=i.value,r=i.valueSpec,s=i.styleSpec;return i.validateSpec=ss,r.expression&&kt(Ie(e))?Wo(i):r.expression&&Qn(Pe(e))?Jr(i):r.type&&nl[r.type]?nl[r.type](i):er(ae({},i,{valueSpec:r.type?s[r.type]:r}))}function Xs(i){const e=i.value,r=i.key,s=_r(i);return s.length||(e.indexOf("{fontstack}")===-1&&s.push(new H(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&s.push(new H(r,e,'"glyphs" url must include a "{range}" token'))),s}function yr(i,e=V){let r=[];return r=r.concat(ss({key:"",value:i,valueSpec:e.$root,styleSpec:e,style:i,validateSpec:ss,objectElementValidators:{glyphs:Xs,"*":()=>[]}})),i.constants&&(r=r.concat(be({key:"constants",value:i.constants,style:i,styleSpec:e,validateSpec:ss}))),sl(r)}function or(i){return function(e){return i({...e,validateSpec:ss})}}function sl(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function $i(i){return function(...e){return sl(i.apply(this,e))}}yr.source=$i(or(Ni)),yr.sprite=$i(or(rl)),yr.glyphs=$i(or(Xs)),yr.light=$i(or(ns)),yr.terrain=$i(or(il)),yr.layer=$i(or(tl)),yr.filter=$i(or(En)),yr.paintProperty=$i(or(Qo)),yr.layoutProperty=$i(or(el));const as=yr,Ra=as.light,al=as.paintProperty,Ba=as.layoutProperty;function Fa(i,e){let r=!1;if(e&&e.length)for(const s of e)i.fire(new j(new Error(s.message))),r=!0;return r}class In{constructor(e,r,s){const l=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const d=new Int32Array(this.arrayBuffer);e=d[0],this.d=(r=d[1])+2*(s=d[2]);for(let g=0;g<this.d*this.d;g++){const x=d[3+g],w=d[3+g+1];l.push(x===w?null:d.subarray(x,w))}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*s;for(let d=0;d<this.d*this.d;d++)l.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=s,this.scale=r/e,this.uid=0;const u=s/r*e;this.min=-u,this.max=e+u}insert(e,r,s,l,u){this._forEachCell(r,s,l,u,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(s),this.bboxes.push(l),this.bboxes.push(u)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,s,l,u,d){this.cells[u].push(d)}query(e,r,s,l,u){const d=this.min,f=this.max;if(e<=d&&r<=d&&f<=s&&f<=l&&!u)return Array.prototype.slice.call(this.keys);{const g=[];return this._forEachCell(e,r,s,l,this._queryCell,g,{},u),g}}_queryCell(e,r,s,l,u,d,f,g){const x=this.cells[u];if(x!==null){const w=this.keys,T=this.bboxes;for(let A=0;A<x.length;A++){const I=x[A];if(f[I]===void 0){const P=4*I;(g?g(T[P+0],T[P+1],T[P+2],T[P+3]):e<=T[P+2]&&r<=T[P+3]&&s>=T[P+0]&&l>=T[P+1])?(f[I]=!0,d.push(w[I])):f[I]=!1}}}}_forEachCell(e,r,s,l,u,d,f,g){const x=this._convertToCellCoord(e),w=this._convertToCellCoord(r),T=this._convertToCellCoord(s),A=this._convertToCellCoord(l);for(let I=x;I<=T;I++)for(let P=w;P<=A;P++){const F=this.d*P+I;if((!g||g(this._convertFromCellCoord(I),this._convertFromCellCoord(P),this._convertFromCellCoord(I+1),this._convertFromCellCoord(P+1)))&&u.call(this,e,r,s,l,F,d,f,g))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,r=3+this.cells.length+1+1;let s=0;for(let d=0;d<this.cells.length;d++)s+=this.cells[d].length;const l=new Int32Array(r+s+this.keys.length+this.bboxes.length);l[0]=this.extent,l[1]=this.n,l[2]=this.padding;let u=r;for(let d=0;d<e.length;d++){const f=e[d];l[3+d]=u,l.set(f,u),u+=f.length}return l[3+e.length]=u,l.set(this.keys,u),u+=this.keys.length,l[3+e.length+1]=u,l.set(this.bboxes,u),u+=this.bboxes.length,l.buffer}static serialize(e,r){const s=e.toArrayBuffer();return r&&r.push(s),{buffer:s}}static deserialize(e){return new In(e.buffer)}}const $r={};function $e(i,e,r={}){if($r[i])throw new Error(`${i} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),$r[i]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}$e("Object",Object),$e("TransferableGridIndex",In),$e("Color",le),$e("Error",Error),$e("AJAXError",Ir),$e("ResolvedImage",_t),$e("StylePropertyFunction",Ns),$e("StyleExpression",Vs,{omit:["_evaluator"]}),$e("ZoomDependentExpression",La),$e("ZoomConstantExpression",ts),$e("CompoundExpression",Qi,{omit:["_evaluate"]});for(const i in vn)vn[i]._classRegistryKey||$e(`Expression_${i}`,vn[i]);function os(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function An(i,e){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob)return i;if(os(i)||Fr(i))return e&&e.push(i),i;if(ArrayBuffer.isView(i)){const r=i;return e&&e.push(r.buffer),r}if(i instanceof ImageData)return e&&e.push(i.data.buffer),i;if(Array.isArray(i)){const r=[];for(const s of i)r.push(An(s,e));return r}if(typeof i=="object"){const r=i.constructor,s=r._classRegistryKey;if(!s)throw new Error("can't serialize object of unregistered class");if(!$r[s])throw new Error(`${s} is not registered.`);const l=r.serialize?r.serialize(i,e):{};if(r.serialize){if(e&&l===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const u in i){if(!i.hasOwnProperty(u)||$r[s].omit.indexOf(u)>=0)continue;const d=i[u];l[u]=$r[s].shallow.indexOf(u)>=0?d:An(d,e)}i instanceof Error&&(l.message=i.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return s!=="Object"&&(l.$name=s),l}throw new Error("can't serialize object of type "+typeof i)}function ls(i){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||os(i)||Fr(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(ls);if(typeof i=="object"){const e=i.$name||"Object";if(!$r[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=$r[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const s=Object.create(r.prototype);for(const l of Object.keys(i)){if(l==="$name")continue;const u=i[l];s[l]=$r[e].shallow.indexOf(l)>=0?u:ls(u)}return s}throw new Error("can't deserialize object of type "+typeof i)}class Oa{constructor(){this.first=!0}update(e,r){const s=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=s,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=s,!0):(this.lastFloorZoom>s?(this.lastIntegerZoom=s+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<s&&(this.lastIntegerZoom=s,this.lastIntegerZoomTime=r),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=s,!0))}}const Oe={"Latin-1 Supplement":i=>i>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function cs(i){for(const e of i)if(Ua(e.charCodeAt(0)))return!0;return!1}function oc(i){for(const e of i)if(!lc(e.charCodeAt(0)))return!1;return!0}function lc(i){return!(Oe.Arabic(i)||Oe["Arabic Supplement"](i)||Oe["Arabic Extended-A"](i)||Oe["Arabic Presentation Forms-A"](i)||Oe["Arabic Presentation Forms-B"](i))}function Ua(i){return!(i!==746&&i!==747&&(i<4352||!(Oe["Bopomofo Extended"](i)||Oe.Bopomofo(i)||Oe["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||Oe["CJK Compatibility Ideographs"](i)||Oe["CJK Compatibility"](i)||Oe["CJK Radicals Supplement"](i)||Oe["CJK Strokes"](i)||!(!Oe["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Oe["CJK Unified Ideographs Extension A"](i)||Oe["CJK Unified Ideographs"](i)||Oe["Enclosed CJK Letters and Months"](i)||Oe["Hangul Compatibility Jamo"](i)||Oe["Hangul Jamo Extended-A"](i)||Oe["Hangul Jamo Extended-B"](i)||Oe["Hangul Jamo"](i)||Oe["Hangul Syllables"](i)||Oe.Hiragana(i)||Oe["Ideographic Description Characters"](i)||Oe.Kanbun(i)||Oe["Kangxi Radicals"](i)||Oe["Katakana Phonetic Extensions"](i)||Oe.Katakana(i)&&i!==12540||!(!Oe["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)||!(!Oe["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||Oe["Unified Canadian Aboriginal Syllabics"](i)||Oe["Unified Canadian Aboriginal Syllabics Extended"](i)||Oe["Vertical Forms"](i)||Oe["Yijing Hexagram Symbols"](i)||Oe["Yi Syllables"](i)||Oe["Yi Radicals"](i))))}function ol(i){return!(Ua(i)||function(e){return!!(Oe["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||Oe["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||Oe["Letterlike Symbols"](e)||Oe["Number Forms"](e)||Oe["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||Oe["Control Pictures"](e)&&e!==9251||Oe["Optical Character Recognition"](e)||Oe["Enclosed Alphanumerics"](e)||Oe["Geometric Shapes"](e)||Oe["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Oe["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Oe["CJK Symbols and Punctuation"](e)||Oe.Katakana(e)||Oe["Private Use Area"](e)||Oe["CJK Compatibility Forms"](e)||Oe["Small Form Variants"](e)||Oe["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function Va(i){return i>=1424&&i<=2303||Oe["Arabic Presentation Forms-A"](i)||Oe["Arabic Presentation Forms-B"](i)}function cc(i,e){return!(!e&&Va(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Oe.Khmer(i))}function hc(i){for(const e of i)if(Va(e.charCodeAt(0)))return!0;return!1}const Na="deferred",$a="loading",ja="loaded";let Ga=null,zi="unavailable",lr=null;const ll=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(zi="error"),Ga&&Ga(i)};function hs(){qa.fire(new R("pluginStateChange",{pluginStatus:zi,pluginURL:lr}))}const qa=new Q,Za=function(){return zi},cl=function(){if(zi!==Na||!lr)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");zi=$a,hs(),lr&&Xr({url:lr},i=>{i?ll(i):(zi=ja,hs())})},ji={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>zi===ja||ji.applyArabicShaping!=null,isLoading:()=>zi===$a,setState(i){if(!Yi())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");zi=i.pluginStatus,lr=i.pluginURL},isParsed(){if(!Yi())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return ji.applyArabicShaping!=null&&ji.processBidirectionalText!=null&&ji.processStyledBidirectionalText!=null},getPluginURL(){if(!Yi())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return lr}};class Vt{constructor(e,r){this.zoom=e,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Oa,this.transition={})}isSupportedScript(e){return function(r,s){for(const l of r)if(!cc(l.charCodeAt(0),s))return!1;return!0}(e,ji.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,r=e-Math.floor(e),s=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*s}:{fromScale:.5,toScale:1,t:1-(1-s)*r}}}class Ws{constructor(e,r){this.property=e,this.value=r,this.expression=function(s,l){if(kt(s))return new Ns(s,l);if(Qn(s)){const u=Zo(s,l);if(u.result==="error")throw new Error(u.value.map(d=>`${d.key}: ${d.message}`).join(", "));return u.value}{let u=s;return l.type==="color"&&typeof s=="string"?u=le.parse(s):l.type!=="padding"||typeof s!="number"&&!Array.isArray(s)||(u=ot.parse(s)),{kind:"constant",evaluate:()=>u}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,s){return this.property.possiblyEvaluate(this,e,r,s)}}class Xa{constructor(e){this.property=e,this.value=new Ws(e,void 0)}transitioned(e,r){return new ul(this.property,this.value,r,Ye({},e.transition,this.transition),e.now)}untransitioned(){return new ul(this.property,this.value,null,{},0)}}class hl{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return Ji(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Xa(this._values[e].property)),this._values[e].value=new Ws(this._values[e].property,r===null?void 0:Ji(r))}getTransition(e){return Ji(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Xa(this._values[e].property)),this._values[e].transition=Ji(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(e[r]=s);const l=this.getTransition(r);l!==void 0&&(e[`${r}-transition`]=l)}return e}transitioned(e,r){const s=new pl(this._properties);for(const l of Object.keys(this._values))s._values[l]=this._values[l].transitioned(e,r._values[l]);return s}untransitioned(){const e=new pl(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class ul{constructor(e,r,s,l,u){this.property=e,this.value=r,this.begin=u+l.delay||0,this.end=this.begin+l.duration||0,e.specification.transition&&(l.delay||l.duration)&&(this.prior=s)}possiblyEvaluate(e,r,s){const l=e.now||0,u=this.value.possiblyEvaluate(e,r,s),d=this.prior;if(d){if(l>this.end)return this.prior=null,u;if(this.value.isDataDriven())return this.prior=null,u;if(l<this.begin)return d.possiblyEvaluate(e,r,s);{const f=(l-this.begin)/(this.end-this.begin);return this.property.interpolate(d.possiblyEvaluate(e,r,s),u,function(g){if(g<=0)return 0;if(g>=1)return 1;const x=g*g,w=x*g;return 4*(g<.5?w:3*(g-x)+w-.75)}(f))}}return u}}class pl{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,s){const l=new Hs(this._properties);for(const u of Object.keys(this._values))l._values[u]=this._values[u].possiblyEvaluate(e,r,s);return l}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class uc{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return Ji(this._values[e].value)}setValue(e,r){this._values[e]=new Ws(this._values[e].property,r===null?void 0:Ji(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(e[r]=s)}return e}possiblyEvaluate(e,r,s){const l=new Hs(this._properties);for(const u of Object.keys(this._values))l._values[u]=this._values[u].possiblyEvaluate(e,r,s);return l}}class Ti{constructor(e,r,s){this.property=e,this.value=r,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,s,l){return this.property.evaluate(this.value,this.parameters,e,r,s,l)}}class Hs{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class We{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,s){const l=Ls[this.specification.type];return l?l(e,r,s):e}}class Qe{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,s,l){return new Ti(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},s,l)}:e.expression,r)}interpolate(e,r,s){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new Ti(this,{kind:"constant",value:void 0},e.parameters);const l=Ls[this.specification.type];return l?new Ti(this,{kind:"constant",value:l(e.value.value,r.value.value,s)},e.parameters):e}evaluate(e,r,s,l,u,d){return e.kind==="constant"?e.value:e.evaluate(r,s,l,u,d)}}class us extends Qe{possiblyEvaluate(e,r,s,l){if(e.value===void 0)return new Ti(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const u=e.expression.evaluate(r,null,{},s,l),d=e.property.specification.type==="resolvedImage"&&typeof u!="string"?u.name:u,f=this._calculate(d,d,d,r);return new Ti(this,{kind:"constant",value:f},r)}if(e.expression.kind==="camera"){const u=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new Ti(this,{kind:"constant",value:u},r)}return new Ti(this,e.expression,r)}evaluate(e,r,s,l,u,d){if(e.kind==="source"){const f=e.evaluate(r,s,l,u,d);return this._calculate(f,f,f,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},s,l),e.evaluate({zoom:Math.floor(r.zoom)},s,l),e.evaluate({zoom:Math.floor(r.zoom)+1},s,l),r):e.value}_calculate(e,r,s,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:s,to:r}}interpolate(e){return e}}class Wa{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,l){if(e.value!==void 0){if(e.expression.kind==="constant"){const u=e.expression.evaluate(r,null,{},s,l);return this._calculate(u,u,u,r)}return this._calculate(e.expression.evaluate(new Vt(Math.floor(r.zoom-1),r)),e.expression.evaluate(new Vt(Math.floor(r.zoom),r)),e.expression.evaluate(new Vt(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,s,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:s,to:r}}interpolate(e){return e}}class Ha{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,l){return!!e.expression.evaluate(r,null,{},s,l)}interpolate(){return!1}}class Si{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in e){const s=e[r];s.specification.overridable&&this.overridableProperties.push(r);const l=this.defaultPropertyValues[r]=new Ws(s,void 0),u=this.defaultTransitionablePropertyValues[r]=new Xa(s);this.defaultTransitioningPropertyValues[r]=u.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=l.possiblyEvaluate({})}}}$e("DataDrivenProperty",Qe),$e("DataConstantProperty",We),$e("CrossFadedDataDrivenProperty",us),$e("CrossFadedProperty",Wa),$e("ColorRampProperty",Ha);const Cn="-transition";class cr extends Q{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new uc(r.layout)),r.paint)){this._transitionablePaint=new hl(r.paint);for(const s in e.paint)this.setPaintProperty(s,e.paint[s],{validate:!1});for(const s in e.layout)this.setLayoutProperty(s,e.layout[s],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Hs(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,s={}){r!=null&&this._validate(Ba,`layers.${this.id}.layout.${e}`,e,r,s)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(Cn)?this._transitionablePaint.getTransition(e.slice(0,-Cn.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,s={}){if(r!=null&&this._validate(al,`layers.${this.id}.paint.${e}`,e,r,s))return!1;if(e.endsWith(Cn))return this._transitionablePaint.setTransition(e.slice(0,-Cn.length),r||void 0),!1;{const l=this._transitionablePaint._values[e],u=l.property.specification["property-type"]==="cross-faded-data-driven",d=l.value.isDataDriven(),f=l.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const g=this._transitionablePaint._values[e].value;return g.isDataDriven()||d||u||this._handleOverridablePaintPropertyUpdate(e,f,g)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,s){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){const e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),Vn(e,(r,s)=>!(r===void 0||s==="layout"&&!Object.keys(r).length||s==="paint"&&!Object.keys(r).length))}_validate(e,r,s,l,u={}){return(!u||u.validate!==!1)&&Fa(this,e.call(as,{key:r,layerType:this.type,objectKey:s,value:l,styleSpec:V,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const r=this.paint.get(e);if(r instanceof Ti&&bn(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const Ka={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ks{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class zt{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Wt(i,e=1){let r=0,s=0;return{members:i.map(l=>{const u=Ka[l.type].BYTES_PER_ELEMENT,d=r=Mn(r,Math.max(e,u)),f=l.components||1;return s=Math.max(s,u),r+=u*f,{name:l.name,type:l.type,components:f,offset:d}}),size:Mn(r,Math.max(s,e)),alignment:e}}function Mn(i,e){return Math.ceil(i/e)*e}class ps extends zt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.int16[l+0]=r,this.int16[l+1]=s,e}}ps.prototype.bytesPerElement=4,$e("StructArrayLayout2i4",ps);class ds extends zt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const u=3*e;return this.int16[u+0]=r,this.int16[u+1]=s,this.int16[u+2]=l,e}}ds.prototype.bytesPerElement=6,$e("StructArrayLayout3i6",ds);class Yr extends zt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s,l)}emplace(e,r,s,l,u){const d=4*e;return this.int16[d+0]=r,this.int16[d+1]=s,this.int16[d+2]=l,this.int16[d+3]=u,e}}Yr.prototype.bytesPerElement=8,$e("StructArrayLayout4i8",Yr);class Ja extends zt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,u,d)}emplace(e,r,s,l,u,d,f){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=s,this.int16[g+2]=l,this.int16[g+3]=u,this.int16[g+4]=d,this.int16[g+5]=f,e}}Ja.prototype.bytesPerElement=12,$e("StructArrayLayout2i4i12",Ja);class Ya extends zt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,u,d)}emplace(e,r,s,l,u,d,f){const g=4*e,x=8*e;return this.int16[g+0]=r,this.int16[g+1]=s,this.uint8[x+4]=l,this.uint8[x+5]=u,this.uint8[x+6]=d,this.uint8[x+7]=f,e}}Ya.prototype.bytesPerElement=8,$e("StructArrayLayout2i4ub8",Ya);class Pn extends zt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.float32[l+0]=r,this.float32[l+1]=s,e}}Pn.prototype.bytesPerElement=8,$e("StructArrayLayout2f8",Pn);class Qa extends zt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d,f,g,x,w){const T=this.length;return this.resize(T+1),this.emplace(T,e,r,s,l,u,d,f,g,x,w)}emplace(e,r,s,l,u,d,f,g,x,w,T){const A=10*e;return this.uint16[A+0]=r,this.uint16[A+1]=s,this.uint16[A+2]=l,this.uint16[A+3]=u,this.uint16[A+4]=d,this.uint16[A+5]=f,this.uint16[A+6]=g,this.uint16[A+7]=x,this.uint16[A+8]=w,this.uint16[A+9]=T,e}}Qa.prototype.bytesPerElement=20,$e("StructArrayLayout10ui20",Qa);class ms extends zt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d,f,g,x,w,T,A){const I=this.length;return this.resize(I+1),this.emplace(I,e,r,s,l,u,d,f,g,x,w,T,A)}emplace(e,r,s,l,u,d,f,g,x,w,T,A,I){const P=12*e;return this.int16[P+0]=r,this.int16[P+1]=s,this.int16[P+2]=l,this.int16[P+3]=u,this.uint16[P+4]=d,this.uint16[P+5]=f,this.uint16[P+6]=g,this.uint16[P+7]=x,this.int16[P+8]=w,this.int16[P+9]=T,this.int16[P+10]=A,this.int16[P+11]=I,e}}ms.prototype.bytesPerElement=24,$e("StructArrayLayout4i4ui4i24",ms);class o extends zt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const u=3*e;return this.float32[u+0]=r,this.float32[u+1]=s,this.float32[u+2]=l,e}}o.prototype.bytesPerElement=12,$e("StructArrayLayout3f12",o);class t extends zt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint32[1*e+0]=r,e}}t.prototype.bytesPerElement=4,$e("StructArrayLayout1ul4",t);class n extends zt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d,f,g,x){const w=this.length;return this.resize(w+1),this.emplace(w,e,r,s,l,u,d,f,g,x)}emplace(e,r,s,l,u,d,f,g,x,w){const T=10*e,A=5*e;return this.int16[T+0]=r,this.int16[T+1]=s,this.int16[T+2]=l,this.int16[T+3]=u,this.int16[T+4]=d,this.int16[T+5]=f,this.uint32[A+3]=g,this.uint16[T+8]=x,this.uint16[T+9]=w,e}}n.prototype.bytesPerElement=20,$e("StructArrayLayout6i1ul2ui20",n);class a extends zt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,u,d)}emplace(e,r,s,l,u,d,f){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=s,this.int16[g+2]=l,this.int16[g+3]=u,this.int16[g+4]=d,this.int16[g+5]=f,e}}a.prototype.bytesPerElement=12,$e("StructArrayLayout2i2i2i12",a);class h extends zt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u){const d=this.length;return this.resize(d+1),this.emplace(d,e,r,s,l,u)}emplace(e,r,s,l,u,d){const f=4*e,g=8*e;return this.float32[f+0]=r,this.float32[f+1]=s,this.float32[f+2]=l,this.int16[g+6]=u,this.int16[g+7]=d,e}}h.prototype.bytesPerElement=16,$e("StructArrayLayout2f1f2i16",h);class p extends zt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s,l)}emplace(e,r,s,l,u){const d=12*e,f=3*e;return this.uint8[d+0]=r,this.uint8[d+1]=s,this.float32[f+1]=l,this.float32[f+2]=u,e}}p.prototype.bytesPerElement=12,$e("StructArrayLayout2ub2f12",p);class m extends zt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const u=3*e;return this.uint16[u+0]=r,this.uint16[u+1]=s,this.uint16[u+2]=l,e}}m.prototype.bytesPerElement=6,$e("StructArrayLayout3ui6",m);class _ extends zt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d,f,g,x,w,T,A,I,P,F,O,G){const Y=this.length;return this.resize(Y+1),this.emplace(Y,e,r,s,l,u,d,f,g,x,w,T,A,I,P,F,O,G)}emplace(e,r,s,l,u,d,f,g,x,w,T,A,I,P,F,O,G,Y){const $=24*e,J=12*e,pe=48*e;return this.int16[$+0]=r,this.int16[$+1]=s,this.uint16[$+2]=l,this.uint16[$+3]=u,this.uint32[J+2]=d,this.uint32[J+3]=f,this.uint32[J+4]=g,this.uint16[$+10]=x,this.uint16[$+11]=w,this.uint16[$+12]=T,this.float32[J+7]=A,this.float32[J+8]=I,this.uint8[pe+36]=P,this.uint8[pe+37]=F,this.uint8[pe+38]=O,this.uint32[J+10]=G,this.int16[$+22]=Y,e}}_.prototype.bytesPerElement=48,$e("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",_);class y extends zt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d,f,g,x,w,T,A,I,P,F,O,G,Y,$,J,pe,ue,Ne,qe,Ue,Re,ze,Ve){const Be=this.length;return this.resize(Be+1),this.emplace(Be,e,r,s,l,u,d,f,g,x,w,T,A,I,P,F,O,G,Y,$,J,pe,ue,Ne,qe,Ue,Re,ze,Ve)}emplace(e,r,s,l,u,d,f,g,x,w,T,A,I,P,F,O,G,Y,$,J,pe,ue,Ne,qe,Ue,Re,ze,Ve,Be){const Ee=34*e,Ke=17*e;return this.int16[Ee+0]=r,this.int16[Ee+1]=s,this.int16[Ee+2]=l,this.int16[Ee+3]=u,this.int16[Ee+4]=d,this.int16[Ee+5]=f,this.int16[Ee+6]=g,this.int16[Ee+7]=x,this.uint16[Ee+8]=w,this.uint16[Ee+9]=T,this.uint16[Ee+10]=A,this.uint16[Ee+11]=I,this.uint16[Ee+12]=P,this.uint16[Ee+13]=F,this.uint16[Ee+14]=O,this.uint16[Ee+15]=G,this.uint16[Ee+16]=Y,this.uint16[Ee+17]=$,this.uint16[Ee+18]=J,this.uint16[Ee+19]=pe,this.uint16[Ee+20]=ue,this.uint16[Ee+21]=Ne,this.uint16[Ee+22]=qe,this.uint32[Ke+12]=Ue,this.float32[Ke+13]=Re,this.float32[Ke+14]=ze,this.float32[Ke+15]=Ve,this.float32[Ke+16]=Be,e}}y.prototype.bytesPerElement=68,$e("StructArrayLayout8i15ui1ul4f68",y);class v extends zt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.float32[1*e+0]=r,e}}v.prototype.bytesPerElement=4,$e("StructArrayLayout1f4",v);class S extends zt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const u=4*e;return this.uint32[2*e+0]=r,this.uint16[u+2]=s,this.uint16[u+3]=l,e}}S.prototype.bytesPerElement=8,$e("StructArrayLayout1ul2ui8",S);class E extends zt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.uint16[l+0]=r,this.uint16[l+1]=s,e}}E.prototype.bytesPerElement=4,$e("StructArrayLayout2ui4",E);class M extends zt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint16[1*e+0]=r,e}}M.prototype.bytesPerElement=2,$e("StructArrayLayout1ui2",M);class D extends zt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s,l)}emplace(e,r,s,l,u){const d=4*e;return this.float32[d+0]=r,this.float32[d+1]=s,this.float32[d+2]=l,this.float32[d+3]=u,e}}D.prototype.bytesPerElement=16,$e("StructArrayLayout4f16",D);class B extends Ks{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 it(this.anchorPointX,this.anchorPointY)}}B.prototype.size=20;class L extends n{get(e){return new B(this,e)}}$e("CollisionBoxArray",L);class N extends Ks{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}N.prototype.size=48;class X extends _{get(e){return new N(this,e)}}$e("PlacedSymbolArray",X);class q extends Ks{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}q.prototype.size=68;class U extends y{get(e){return new q(this,e)}}$e("SymbolInstanceArray",U);class W extends v{getoffsetX(e){return this.float32[1*e+0]}}$e("GlyphOffsetArray",W);class te extends ds{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}$e("SymbolLineVertexArray",te);class se extends Ks{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]}}se.prototype.size=8;class he extends S{get(e){return new se(this,e)}}$e("FeatureIndexArray",he);class de extends ps{}class Te extends ps{}class ye extends ps{}class Ae extends Ja{}class Ge extends Ya{}class rt extends Pn{}class nt extends Qa{}class He extends ms{}class Mt extends o{}class Tt extends t{}class mt extends a{}class yt extends p{}class bt extends m{}class Ei extends E{}const xr=Wt([{name:"a_pos",components:2,type:"Int16"}],4),{members:hr}=xr;class Nt{constructor(e=[]){this.segments=e}prepareSegment(e,r,s,l){let u=this.segments[this.segments.length-1];return e>Nt.MAX_VERTEX_ARRAY_LENGTH&&Yt(`Max vertices per segment is ${Nt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!u||u.vertexLength+e>Nt.MAX_VERTEX_ARRAY_LENGTH||u.sortKey!==l)&&(u={vertexOffset:r.length,primitiveOffset:s.length,vertexLength:0,primitiveLength:0},l!==void 0&&(u.sortKey=l),this.segments.push(u)),u}get(){return this.segments}destroy(){for(const e of this.segments)for(const r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,s,l){return new Nt([{vertexOffset:e,primitiveOffset:r,vertexLength:s,primitiveLength:l,vaos:{},sortKey:0}])}}function jr(i,e){return 256*(i=Me(Math.floor(i),0,255))+Me(Math.floor(e),0,255)}Nt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,$e("SegmentVector",Nt);const Ii=Wt([{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 Ai={},Qr={get exports(){return Ai},set exports(i){Ai=i}},kn={};({get exports(){return kn},set exports(i){kn=i}}).exports=function(i,e){var r,s,l,u,d,f,g,x;for(s=i.length-(r=3&i.length),l=e,d=3432918353,f=461845907,x=0;x<s;)g=255&i.charCodeAt(x)|(255&i.charCodeAt(++x))<<8|(255&i.charCodeAt(++x))<<16|(255&i.charCodeAt(++x))<<24,++x,l=27492+(65535&(u=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+(u>>>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 Qt={};({get exports(){return Qt},set exports(i){Qt=i}}).exports=function(i,e){for(var r,s=i.length,l=e^s,u=0;s>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(u)|(255&i.charCodeAt(++u))<<8|(255&i.charCodeAt(++u))<<16|(255&i.charCodeAt(++u))<<24))+((1540483477*(r>>>16)&65535)<<16),l=1540483477*(65535&l)+((1540483477*(l>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),s-=4,++u;switch(s){case 3:l^=(255&i.charCodeAt(u+2))<<16;case 2:l^=(255&i.charCodeAt(u+1))<<8;case 1:l=1540483477*(65535&(l^=255&i.charCodeAt(u)))+((1540483477*(l>>>16)&65535)<<16)}return l=1540483477*(65535&(l^=l>>>13))+((1540483477*(l>>>16)&65535)<<16),(l^=l>>>15)>>>0};var $t=kn,Et=Qt;Qr.exports=$t,Ai.murmur3=$t,Ai.murmur2=Et;class ci{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,s,l){this.ids.push(Li(e)),this.positions.push(r,s,l)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=Li(e);let s=0,l=this.ids.length-1;for(;s<l;){const d=s+l>>1;this.ids[d]>=r?l=d:s=d+1}const u=[];for(;this.ids[s]===r;)u.push({index:this.positions[3*s],start:this.positions[3*s+1],end:this.positions[3*s+2]}),s++;return u}static serialize(e,r){const s=new Float64Array(e.ids),l=new Uint32Array(e.positions);return jt(s,l,0,s.length-1),r&&r.push(s.buffer,l.buffer),{ids:s,positions:l}}static deserialize(e){const r=new ci;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function Li(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Ai(String(i))}function jt(i,e,r,s){for(;r<s;){const l=i[r+s>>1];let u=r-1,d=s+1;for(;;){do u++;while(i[u]<l);do d--;while(i[d]>l);if(u>=d)break;tr(i,u,d),tr(e,3*u,3*d),tr(e,3*u+1,3*d+1),tr(e,3*u+2,3*d+2)}d-r<s-d?(jt(i,e,r,d),r=d+1):(jt(i,e,d+1,s),s=d)}}function tr(i,e,r){const s=i[e];i[e]=i[r],i[r]=s}$e("FeaturePositionMap",ci);class ir{constructor(e,r){this.gl=e.gl,this.location=r}}class zn extends ir{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Js extends ir{constructor(e,r){super(e,r),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class dl extends ir{constructor(e,r){super(e,r),this.current=le.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}const pc=new Float32Array(16);function en(i){return[jr(255*i.r,255*i.g),jr(255*i.b,255*i.a)]}class fs{constructor(e,r,s){this.value=e,this.uniformNames=r.map(l=>`u_${l}`),this.type=s}setUniform(e,r,s){e.set(s.constantOr(this.value))}getBinding(e,r,s){return this.type==="color"?new dl(e,r):new zn(e,r)}}class Ar{constructor(e,r){this.uniformNames=r.map(s=>`u_${s}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,s,l){const u=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;u&&e.set(u)}getBinding(e,r,s){return s.substr(0,9)==="u_pattern"?new Js(e,r):new zn(e,r)}}class ur{constructor(e,r,s,l){this.expression=e,this.type=s,this.maxValue=0,this.paintVertexAttributes=r.map(u=>({name:`a_${u}`,type:"Float32",components:s==="color"?2:1,offset:0})),this.paintVertexArray=new l}populatePaintArray(e,r,s,l,u){const d=this.paintVertexArray.length,f=this.expression.evaluate(new Vt(0),r,{},l,[],u);this.paintVertexArray.resize(e),this._setPaintValue(d,e,f)}updatePaintArray(e,r,s,l){const u=this.expression.evaluate({zoom:0},s,l);this._setPaintValue(e,r,u)}_setPaintValue(e,r,s){if(this.type==="color"){const l=en(s);for(let u=e;u<r;u++)this.paintVertexArray.emplace(u,l[0],l[1])}else{for(let l=e;l<r;l++)this.paintVertexArray.emplace(l,s);this.maxValue=Math.max(this.maxValue,Math.abs(s))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Cr{constructor(e,r,s,l,u,d){this.expression=e,this.uniformNames=r.map(f=>`u_${f}_t`),this.type=s,this.useIntegerZoom=l,this.zoom=u,this.maxValue=0,this.paintVertexAttributes=r.map(f=>({name:`a_${f}`,type:"Float32",components:s==="color"?4:2,offset:0})),this.paintVertexArray=new d}populatePaintArray(e,r,s,l,u){const d=this.expression.evaluate(new Vt(this.zoom),r,{},l,[],u),f=this.expression.evaluate(new Vt(this.zoom+1),r,{},l,[],u),g=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(g,e,d,f)}updatePaintArray(e,r,s,l){const u=this.expression.evaluate({zoom:this.zoom},s,l),d=this.expression.evaluate({zoom:this.zoom+1},s,l);this._setPaintValue(e,r,u,d)}_setPaintValue(e,r,s,l){if(this.type==="color"){const u=en(s),d=en(l);for(let f=e;f<r;f++)this.paintVertexArray.emplace(f,u[0],u[1],d[0],d[1])}else{for(let u=e;u<r;u++)this.paintVertexArray.emplace(u,s,l);this.maxValue=Math.max(this.maxValue,Math.abs(s),Math.abs(l))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,r){const s=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,l=Me(this.expression.interpolationFactor(s,this.zoom,this.zoom+1),0,1);e.set(l)}getBinding(e,r,s){return new zn(e,r)}}class Ln{constructor(e,r,s,l,u,d){this.expression=e,this.type=r,this.useIntegerZoom=s,this.zoom=l,this.layerId=d,this.zoomInPaintVertexArray=new u,this.zoomOutPaintVertexArray=new u}populatePaintArray(e,r,s){const l=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(l,e,r.patterns&&r.patterns[this.layerId],s)}updatePaintArray(e,r,s,l,u){this._setPaintValues(e,r,s.patterns&&s.patterns[this.layerId],u)}_setPaintValues(e,r,s,l){if(!l||!s)return;const{min:u,mid:d,max:f}=s,g=l[u],x=l[d],w=l[f];if(g&&x&&w)for(let T=e;T<r;T++)this.zoomInPaintVertexArray.emplace(T,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(T,x.tl[0],x.tl[1],x.br[0],x.br[1],w.tl[0],w.tl[1],w.br[0],w.br[1],x.pixelRatio,w.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,Ii.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,Ii.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Jh{constructor(e,r,s){this.binders={},this._buffers=[];const l=[];for(const u in e.paint._values){if(!s(u))continue;const d=e.paint.get(u);if(!(d instanceof Ti&&bn(d.property.specification)))continue;const f=dm(u,e.type),g=d.value,x=d.property.specification.type,w=d.property.useIntegerZoom,T=d.property.specification["property-type"],A=T==="cross-faded"||T==="cross-faded-data-driven";if(g.kind==="constant")this.binders[u]=A?new Ar(g.value,f):new fs(g.value,f,x),l.push(`/u_${u}`);else if(g.kind==="source"||A){const I=Yh(u,x,"source");this.binders[u]=A?new Ln(g,x,w,r,I,e.id):new ur(g,f,x,I),l.push(`/a_${u}`)}else{const I=Yh(u,x,"composite");this.binders[u]=new Cr(g,f,x,w,r,I),l.push(`/z_${u}`)}}this.cacheKey=l.sort().join("")}getMaxValue(e){const r=this.binders[e];return r instanceof ur||r instanceof Cr?r.maxValue:0}populatePaintArrays(e,r,s,l,u){for(const d in this.binders){const f=this.binders[d];(f instanceof ur||f instanceof Cr||f instanceof Ln)&&f.populatePaintArray(e,r,s,l,u)}}setConstantPatternPositions(e,r){for(const s in this.binders){const l=this.binders[s];l instanceof Ar&&l.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,s,l,u){let d=!1;for(const f in e){const g=r.getPositions(f);for(const x of g){const w=s.feature(x.index);for(const T in this.binders){const A=this.binders[T];if((A instanceof ur||A instanceof Cr||A instanceof Ln)&&A.expression.isStateDependent===!0){const I=l.paint.get(T);A.expression=I.value,A.updatePaintArray(x.start,x.end,w,e[f],u),d=!0}}}}return d}defines(){const e=[];for(const r in this.binders){const s=this.binders[r];(s instanceof fs||s instanceof Ar)&&e.push(...s.uniformNames.map(l=>`#define HAS_UNIFORM_${l}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof ur||s instanceof Cr)for(let l=0;l<s.paintVertexAttributes.length;l++)e.push(s.paintVertexAttributes[l].name);else if(s instanceof Ln)for(let l=0;l<Ii.members.length;l++)e.push(Ii.members[l].name)}return e}getBinderUniforms(){const e=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof fs||s instanceof Ar||s instanceof Cr)for(const l of s.uniformNames)e.push(l)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,r){const s=[];for(const l in this.binders){const u=this.binders[l];if(u instanceof fs||u instanceof Ar||u instanceof Cr){for(const d of u.uniformNames)if(r[d]){const f=u.getBinding(e,r[d],d);s.push({name:d,property:l,binding:f})}}}return s}setUniforms(e,r,s,l){for(const{name:u,property:d,binding:f}of r)this.binders[d].setUniform(f,l,s.get(d),u)}updatePaintBuffers(e){this._buffers=[];for(const r in this.binders){const s=this.binders[r];if(e&&s instanceof Ln){const l=e.fromScale===2?s.zoomInPaintVertexBuffer:s.zoomOutPaintVertexBuffer;l&&this._buffers.push(l)}else(s instanceof ur||s instanceof Cr)&&s.paintVertexBuffer&&this._buffers.push(s.paintVertexBuffer)}}upload(e){for(const r in this.binders){const s=this.binders[r];(s instanceof ur||s instanceof Cr||s instanceof Ln)&&s.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const r=this.binders[e];(r instanceof ur||r instanceof Cr||r instanceof Ln)&&r.destroy()}}}class gs{constructor(e,r,s=()=>!0){this.programConfigurations={};for(const l of e)this.programConfigurations[l.id]=new Jh(l,r,s);this.needsUpload=!1,this._featureMap=new ci,this._bufferOffset=0}populatePaintArrays(e,r,s,l,u,d){for(const f in this.programConfigurations)this.programConfigurations[f].populatePaintArrays(e,r,l,u,d);r.id!==void 0&&this._featureMap.add(r.id,s,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,s,l){for(const u of s)this.needsUpload=this.programConfigurations[u.id].updatePaintArrays(e,this._featureMap,r,u,l)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function dm(i,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}function Yh(i,e,r){const s={color:{source:Pn,composite:D},number:{source:v,composite:Pn}},l=function(u){return{"line-pattern":{source:nt,composite:nt},"fill-pattern":{source:nt,composite:nt},"fill-extrusion-pattern":{source:nt,composite:nt}}[u]}(i);return l&&l[r]||s[e][r]}$e("ConstantBinder",fs),$e("CrossFadedConstantBinder",Ar),$e("SourceExpressionBinder",ur),$e("CrossFadedCompositeBinder",Ln),$e("CompositeExpressionBinder",Cr),$e("ProgramConfiguration",Jh,{omit:["_buffers"]}),$e("ProgramConfigurationSet",gs);var ai=8192;const dc=Math.pow(2,14)-1,Qh=-dc-1;function _s(i){const e=ai/i.extent,r=i.loadGeometry();for(let s=0;s<r.length;s++){const l=r[s];for(let u=0;u<l.length;u++){const d=l[u],f=Math.round(d.x*e),g=Math.round(d.y*e);d.x=Me(f,Qh,dc),d.y=Me(g,Qh,dc),(f<d.x||f>d.x+1||g<d.y||g>d.y+1)&&Yt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function ys(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?_s(i):[]}}function ml(i,e,r,s,l){i.emplaceBack(2*e+(s+1)/2,2*r+(l+1)/2)}class mc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Te,this.indexArray=new bt,this.segments=new Nt,this.programConfigurations=new gs(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){const l=this.layers[0],u=[];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:w,sourceLayerIndex:T}of e){const A=this.layers[0]._featureFilter.needGeometry,I=ys(g,A);if(!this.layers[0]._featureFilter.filter(new Vt(this.zoom),I,s))continue;const P=f?d.evaluate(I,{},s):void 0,F={id:x,properties:g.properties,type:g.type,sourceLayerIndex:T,index:w,geometry:A?I.geometry:_s(g),patterns:{},sortKey:P};u.push(F)}f&&u.sort((g,x)=>g.sortKey-x.sortKey);for(const g of u){const{geometry:x,index:w,sourceLayerIndex:T}=g,A=e[w].feature;this.addFeature(g,x,w,s),r.featureIndex.insert(A,x,w,T,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,hr),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,s,l){for(const u of r)for(const d of u){const f=d.x,g=d.y;if(f<0||f>=ai||g<0||g>=ai)continue;const x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),w=x.vertexLength;ml(this.layoutVertexArray,f,g,-1,-1),ml(this.layoutVertexArray,f,g,1,-1),ml(this.layoutVertexArray,f,g,1,1),ml(this.layoutVertexArray,f,g,-1,1),this.indexArray.emplaceBack(w,w+1,w+2),this.indexArray.emplaceBack(w,w+3,w+2),x.vertexLength+=4,x.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{},l)}}function eu(i,e){for(let r=0;r<i.length;r++)if(Ys(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Ys(i,e[r]))return!0;return!!fc(i,e)}function mm(i,e,r){return!!Ys(i,e)||!!gc(e,i,r)}function tu(i,e){if(i.length===1)return ru(e,i[0]);for(let r=0;r<e.length;r++){const s=e[r];for(let l=0;l<s.length;l++)if(Ys(i,s[l]))return!0}for(let r=0;r<i.length;r++)if(ru(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(fc(i,e[r]))return!0;return!1}function fm(i,e,r){if(i.length>1){if(fc(i,e))return!0;for(let s=0;s<e.length;s++)if(gc(e[s],i,r))return!0}for(let s=0;s<i.length;s++)if(gc(i[s],e,r))return!0;return!1}function fc(i,e){if(i.length===0||e.length===0)return!1;for(let r=0;r<i.length-1;r++){const s=i[r],l=i[r+1];for(let u=0;u<e.length-1;u++)if(gm(s,l,e[u],e[u+1]))return!0}return!1}function gm(i,e,r,s){return nr(i,r,s)!==nr(e,r,s)&&nr(i,e,r)!==nr(i,e,s)}function gc(i,e,r){const s=r*r;if(e.length===1)return i.distSqr(e[0])<s;for(let l=1;l<e.length;l++)if(iu(i,e[l-1],e[l])<s)return!0;return!1}function iu(i,e,r){const s=e.distSqr(r);if(s===0)return i.distSqr(e);const l=((i.x-e.x)*(r.x-e.x)+(i.y-e.y)*(r.y-e.y))/s;return i.distSqr(l<0?e:l>1?r:r.sub(e)._mult(l)._add(e))}function ru(i,e){let r,s,l,u=!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++)s=r[f],l=r[g],s.y>e.y!=l.y>e.y&&e.x<(l.x-s.x)*(e.y-s.y)/(l.y-s.y)+s.x&&(u=!u)}return u}function Ys(i,e){let r=!1;for(let s=0,l=i.length-1;s<i.length;l=s++){const u=i[s],d=i[l];u.y>e.y!=d.y>e.y&&e.x<(d.x-u.x)*(e.y-u.y)/(d.y-u.y)+u.x&&(r=!r)}return r}function _m(i,e,r){const s=r[0],l=r[2];if(i.x<s.x&&e.x<s.x||i.x>l.x&&e.x>l.x||i.y<s.y&&e.y<s.y||i.y>l.y&&e.y>l.y)return!1;const u=nr(i,e,r[0]);return u!==nr(i,e,r[1])||u!==nr(i,e,r[2])||u!==nr(i,e,r[3])}function eo(i,e,r){const s=e.paint.get(i).value;return s.kind==="constant"?s.value:r.programConfigurations.get(e.id).getMaxValue(i)}function fl(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function gl(i,e,r,s,l){if(!e[0]&&!e[1])return i;const u=it.convert(e)._mult(l);r==="viewport"&&u._rotate(-s);const d=[];for(let f=0;f<i.length;f++)d.push(i[f].sub(u));return d}$e("CircleBucket",mc,{omit:["layers"]});const ym=new Si({"circle-sort-key":new Qe(V.layout_circle["circle-sort-key"])});var xm={paint:new Si({"circle-radius":new Qe(V.paint_circle["circle-radius"]),"circle-color":new Qe(V.paint_circle["circle-color"]),"circle-blur":new Qe(V.paint_circle["circle-blur"]),"circle-opacity":new Qe(V.paint_circle["circle-opacity"]),"circle-translate":new We(V.paint_circle["circle-translate"]),"circle-translate-anchor":new We(V.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new We(V.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new We(V.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Qe(V.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Qe(V.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Qe(V.paint_circle["circle-stroke-opacity"])}),layout:ym},Di=1e-6,Ri=typeof Float32Array<"u"?Float32Array:Array;function nu(){var i=new Ri(9);return Ri!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[5]=0,i[6]=0,i[7]=0),i[0]=1,i[4]=1,i[8]=1,i}function _c(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 su(i,e,r){var s=e[0],l=e[1],u=e[2],d=e[3],f=e[4],g=e[5],x=e[6],w=e[7],T=e[8],A=e[9],I=e[10],P=e[11],F=e[12],O=e[13],G=e[14],Y=e[15],$=r[0],J=r[1],pe=r[2],ue=r[3];return i[0]=$*s+J*f+pe*T+ue*F,i[1]=$*l+J*g+pe*A+ue*O,i[2]=$*u+J*x+pe*I+ue*G,i[3]=$*d+J*w+pe*P+ue*Y,i[4]=($=r[4])*s+(J=r[5])*f+(pe=r[6])*T+(ue=r[7])*F,i[5]=$*l+J*g+pe*A+ue*O,i[6]=$*u+J*x+pe*I+ue*G,i[7]=$*d+J*w+pe*P+ue*Y,i[8]=($=r[8])*s+(J=r[9])*f+(pe=r[10])*T+(ue=r[11])*F,i[9]=$*l+J*g+pe*A+ue*O,i[10]=$*u+J*x+pe*I+ue*G,i[11]=$*d+J*w+pe*P+ue*Y,i[12]=($=r[12])*s+(J=r[13])*f+(pe=r[14])*T+(ue=r[15])*F,i[13]=$*l+J*g+pe*A+ue*O,i[14]=$*u+J*x+pe*I+ue*G,i[15]=$*d+J*w+pe*P+ue*Y,i}Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});var to,vm=su;function au(){var i=new Ri(3);return Ri!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i}function ou(i,e,r){var s=new Ri(3);return s[0]=i,s[1]=e,s[2]=r,s}function _l(i,e,r){var s=e[0],l=e[1],u=e[2],d=e[3];return i[0]=r[0]*s+r[4]*l+r[8]*u+r[12]*d,i[1]=r[1]*s+r[5]*l+r[9]*u+r[13]*d,i[2]=r[2]*s+r[6]*l+r[10]*u+r[14]*d,i[3]=r[3]*s+r[7]*l+r[11]*u+r[15]*d,i}function lu(){var i=new Ri(4);return Ri!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i[3]=1,i}function cu(i,e){const r=_l([],[i.x,i.y,0,1],e);return new it(r[0]/r[3],r[1]/r[3])}au(),to=new Ri(4),Ri!=Float32Array&&(to[0]=0,to[1]=0,to[2]=0,to[3]=0),au(),ou(1,0,0),ou(0,1,0),lu(),lu(),nu(),function(){var i;i=new Ri(2),Ri!=Float32Array&&(i[0]=0,i[1]=0)}();class hu extends mc{}$e("HeatmapBucket",hu,{omit:["layers"]});var bm={paint:new Si({"heatmap-radius":new Qe(V.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Qe(V.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new We(V.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Ha(V.paint_heatmap["heatmap-color"]),"heatmap-opacity":new We(V.paint_heatmap["heatmap-opacity"])})};function yc(i,{width:e,height:r},s,l){if(l){if(l instanceof Uint8ClampedArray)l=new Uint8Array(l.buffer);else if(l.length!==e*r*s)throw new RangeError(`mismatched image size. expected: ${l.length} but got: ${e*r*s}`)}else l=new Uint8Array(e*r*s);return i.width=e,i.height=r,i.data=l,i}function uu(i,{width:e,height:r},s){if(e===i.width&&r===i.height)return;const l=yc({},{width:e,height:r},s);xc(i,l,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,e),height:Math.min(i.height,r)},s),i.width=e,i.height=r,i.data=l.data}function xc(i,e,r,s,l,u){if(l.width===0||l.height===0)return e;if(l.width>i.width||l.height>i.height||r.x>i.width-l.width||r.y>i.height-l.height)throw new RangeError("out of range source coordinates for image copy");if(l.width>e.width||l.height>e.height||s.x>e.width-l.width||s.y>e.height-l.height)throw new RangeError("out of range destination coordinates for image copy");const d=i.data,f=e.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)*u,w=((s.y+g)*e.width+s.x)*u;for(let T=0;T<l.width*u;T++)f[w+T]=d[x+T]}return e}class io{constructor(e,r){yc(this,e,1,r)}resize(e){uu(this,e,1)}clone(){return new io({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,s,l,u){xc(e,r,s,l,u,1)}}class pr{constructor(e,r){yc(this,e,4,r)}resize(e){uu(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new pr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,s,l,u){xc(e,r,s,l,u,4)}}function pu(i){const e={},r=i.resolution||256,s=i.clips?i.clips.length:1,l=i.image||new pr({width:r,height:s});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const u=(d,f,g)=>{e[i.evaluationKey]=g;const x=i.expression.evaluate(e);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<s;++d,f+=4*r)for(let g=0,x=0;g<r;g++,x+=4){const w=g/(r-1),{start:T,end:A}=i.clips[d];u(f,x,T*(1-w)+A*w)}else for(let d=0,f=0;d<r;d++,f+=4)u(0,f,d/(r-1));return l}$e("AlphaImage",io),$e("RGBAImage",pr);var wm={paint:new Si({"hillshade-illumination-direction":new We(V.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new We(V.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new We(V.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new We(V.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new We(V.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new We(V.paint_hillshade["hillshade-accent-color"])})};const Tm=Wt([{name:"a_pos",components:2,type:"Int16"}],4),{members:Sm}=Tm;var ro={};function yl(i,e,r){r=r||2;var s,l,u,d,f,g,x,w=e&&e.length,T=w?e[0]*r:i.length,A=du(i,0,T,r,!0),I=[];if(!A||A.next===A.prev)return I;if(w&&(A=function(F,O,G,Y){var $,J,pe,ue=[];for($=0,J=O.length;$<J;$++)(pe=du(F,O[$]*Y,$<J-1?O[$+1]*Y:F.length,Y,!1))===pe.next&&(pe.steiner=!0),ue.push(zm(pe));for(ue.sort(Mm),$=0;$<ue.length;$++)G=Pm(ue[$],G);return G}(i,e,A,r)),i.length>80*r){s=u=i[0],l=d=i[1];for(var P=r;P<T;P+=r)(f=i[P])<s&&(s=f),(g=i[P+1])<l&&(l=g),f>u&&(u=f),g>d&&(d=g);x=(x=Math.max(u-s,d-l))!==0?32767/x:0}return no(A,I,r,s,l,x,0),I}function du(i,e,r,s,l){var u,d;if(l===wc(i,e,r,s)>0)for(u=e;u<r;u+=s)d=gu(u,i[u],i[u+1],d);else for(u=r-s;u>=e;u-=s)d=gu(u,i[u],i[u+1],d);return d&&xl(d,d.next)&&(ao(d),d=d.next),d}function xs(i,e){if(!i)return i;e||(e=i);var r,s=i;do if(r=!1,s.steiner||!xl(s,s.next)&&ei(s.prev,s,s.next)!==0)s=s.next;else{if(ao(s),(s=e=s.prev)===s.next)break;r=!0}while(r||s!==e);return e}function no(i,e,r,s,l,u,d){if(i){!d&&u&&function(w,T,A,I){var P=w;do P.z===0&&(P.z=vc(P.x,P.y,T,A,I)),P.prevZ=P.prev,P.nextZ=P.next,P=P.next;while(P!==w);P.prevZ.nextZ=null,P.prevZ=null,function(F){var O,G,Y,$,J,pe,ue,Ne,qe=1;do{for(G=F,F=null,J=null,pe=0;G;){for(pe++,Y=G,ue=0,O=0;O<qe&&(ue++,Y=Y.nextZ);O++);for(Ne=qe;ue>0||Ne>0&&Y;)ue!==0&&(Ne===0||!Y||G.z<=Y.z)?($=G,G=G.nextZ,ue--):($=Y,Y=Y.nextZ,Ne--),J?J.nextZ=$:F=$,$.prevZ=J,J=$;G=Y}J.nextZ=null,qe*=2}while(pe>1)}(P)}(i,s,l,u);for(var f,g,x=i;i.prev!==i.next;)if(f=i.prev,g=i.next,u?Im(i,s,l,u):Em(i))e.push(f.i/r|0),e.push(i.i/r|0),e.push(g.i/r|0),ao(i),i=g.next,x=g.next;else if((i=g)===x){d?d===1?no(i=Am(xs(i),e,r),e,r,s,l,u,2):d===2&&Cm(i,e,r,s,l,u):no(xs(i),e,r,s,l,u,1);break}}}function Em(i){var e=i.prev,r=i,s=i.next;if(ei(e,r,s)>=0)return!1;for(var l=e.x,u=r.x,d=s.x,f=e.y,g=r.y,x=s.y,w=l<u?l<d?l:d:u<d?u:d,T=f<g?f<x?f:x:g<x?g:x,A=l>u?l>d?l:d:u>d?u:d,I=f>g?f>x?f:x:g>x?g:x,P=s.next;P!==e;){if(P.x>=w&&P.x<=A&&P.y>=T&&P.y<=I&&Qs(l,f,u,g,d,x,P.x,P.y)&&ei(P.prev,P,P.next)>=0)return!1;P=P.next}return!0}function Im(i,e,r,s){var l=i.prev,u=i,d=i.next;if(ei(l,u,d)>=0)return!1;for(var f=l.x,g=u.x,x=d.x,w=l.y,T=u.y,A=d.y,I=f<g?f<x?f:x:g<x?g:x,P=w<T?w<A?w:A:T<A?T:A,F=f>g?f>x?f:x:g>x?g:x,O=w>T?w>A?w:A:T>A?T:A,G=vc(I,P,e,r,s),Y=vc(F,O,e,r,s),$=i.prevZ,J=i.nextZ;$&&$.z>=G&&J&&J.z<=Y;){if($.x>=I&&$.x<=F&&$.y>=P&&$.y<=O&&$!==l&&$!==d&&Qs(f,w,g,T,x,A,$.x,$.y)&&ei($.prev,$,$.next)>=0||($=$.prevZ,J.x>=I&&J.x<=F&&J.y>=P&&J.y<=O&&J!==l&&J!==d&&Qs(f,w,g,T,x,A,J.x,J.y)&&ei(J.prev,J,J.next)>=0))return!1;J=J.nextZ}for(;$&&$.z>=G;){if($.x>=I&&$.x<=F&&$.y>=P&&$.y<=O&&$!==l&&$!==d&&Qs(f,w,g,T,x,A,$.x,$.y)&&ei($.prev,$,$.next)>=0)return!1;$=$.prevZ}for(;J&&J.z<=Y;){if(J.x>=I&&J.x<=F&&J.y>=P&&J.y<=O&&J!==l&&J!==d&&Qs(f,w,g,T,x,A,J.x,J.y)&&ei(J.prev,J,J.next)>=0)return!1;J=J.nextZ}return!0}function Am(i,e,r){var s=i;do{var l=s.prev,u=s.next.next;!xl(l,u)&&mu(l,s,s.next,u)&&so(l,u)&&so(u,l)&&(e.push(l.i/r|0),e.push(s.i/r|0),e.push(u.i/r|0),ao(s),ao(s.next),s=i=u),s=s.next}while(s!==i);return xs(s)}function Cm(i,e,r,s,l,u){var d=i;do{for(var f=d.next.next;f!==d.prev;){if(d.i!==f.i&&Lm(d,f)){var g=fu(d,f);return d=xs(d,d.next),g=xs(g,g.next),no(d,e,r,s,l,u,0),void no(g,e,r,s,l,u,0)}f=f.next}d=d.next}while(d!==i)}function Mm(i,e){return i.x-e.x}function Pm(i,e){var r=function(l,u){var d,f=u,g=l.x,x=l.y,w=-1/0;do{if(x<=f.y&&x>=f.next.y&&f.next.y!==f.y){var T=f.x+(x-f.y)*(f.next.x-f.x)/(f.next.y-f.y);if(T<=g&&T>w&&(w=T,d=f.x<f.next.x?f:f.next,T===g))return d}f=f.next}while(f!==u);if(!d)return null;var A,I=d,P=d.x,F=d.y,O=1/0;f=d;do g>=f.x&&f.x>=P&&g!==f.x&&Qs(x<F?g:w,x,P,F,x<F?w:g,x,f.x,f.y)&&(A=Math.abs(x-f.y)/(g-f.x),so(f,l)&&(A<O||A===O&&(f.x>d.x||f.x===d.x&&km(d,f)))&&(d=f,O=A)),f=f.next;while(f!==I);return d}(i,e);if(!r)return e;var s=fu(r,i);return xs(s,s.next),xs(r,r.next)}function km(i,e){return ei(i.prev,i,e.prev)<0&&ei(e.next,i,i.next)<0}function vc(i,e,r,s,l){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*l|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*l|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function zm(i){var e=i,r=i;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==i);return r}function Qs(i,e,r,s,l,u,d,f){return(l-d)*(e-f)>=(i-d)*(u-f)&&(i-d)*(s-f)>=(r-d)*(e-f)&&(r-d)*(u-f)>=(l-d)*(s-f)}function Lm(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,s){var l=r;do{if(l.i!==r.i&&l.next.i!==r.i&&l.i!==s.i&&l.next.i!==s.i&&mu(l,l.next,r,s))return!0;l=l.next}while(l!==r);return!1}(i,e)&&(so(i,e)&&so(e,i)&&function(r,s){var l=r,u=!1,d=(r.x+s.x)/2,f=(r.y+s.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&&(u=!u),l=l.next;while(l!==r);return u}(i,e)&&(ei(i.prev,i,e.prev)||ei(i,e.prev,e))||xl(i,e)&&ei(i.prev,i,i.next)>0&&ei(e.prev,e,e.next)>0)}function ei(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function xl(i,e){return i.x===e.x&&i.y===e.y}function mu(i,e,r,s){var l=bl(ei(i,e,r)),u=bl(ei(i,e,s)),d=bl(ei(r,s,i)),f=bl(ei(r,s,e));return l!==u&&d!==f||!(l!==0||!vl(i,r,e))||!(u!==0||!vl(i,s,e))||!(d!==0||!vl(r,i,s))||!(f!==0||!vl(r,e,s))}function vl(i,e,r){return e.x<=Math.max(i.x,r.x)&&e.x>=Math.min(i.x,r.x)&&e.y<=Math.max(i.y,r.y)&&e.y>=Math.min(i.y,r.y)}function bl(i){return i>0?1:i<0?-1:0}function so(i,e){return ei(i.prev,i,i.next)<0?ei(i,e,i.next)>=0&&ei(i,i.prev,e)>=0:ei(i,e,i.prev)<0||ei(i,i.next,e)<0}function fu(i,e){var r=new bc(i.i,i.x,i.y),s=new bc(e.i,e.x,e.y),l=i.next,u=e.prev;return i.next=e,e.prev=i,r.next=l,l.prev=r,s.next=r,r.prev=s,u.next=s,s.prev=u,s}function gu(i,e,r,s){var l=new bc(i,e,r);return s?(l.next=s.next,l.prev=s,s.next.prev=l,s.next=l):(l.prev=l,l.next=l),l}function ao(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 bc(i,e,r){this.i=i,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function wc(i,e,r,s){for(var l=0,u=e,d=r-s;u<r;u+=s)l+=(i[d]-i[u])*(i[u+1]+i[d+1]),d=u;return l}({get exports(){return ro},set exports(i){ro=i}}).exports=yl,ro.default=yl,yl.deviation=function(i,e,r,s){var l=e&&e.length,u=Math.abs(wc(i,0,l?e[0]*r:i.length,r));if(l)for(var d=0,f=e.length;d<f;d++)u-=Math.abs(wc(i,e[d]*r,d<f-1?e[d+1]*r:i.length,r));var g=0;for(d=0;d<s.length;d+=3){var x=s[d]*r,w=s[d+1]*r,T=s[d+2]*r;g+=Math.abs((i[x]-i[T])*(i[w+1]-i[x+1])-(i[x]-i[w])*(i[T+1]-i[x+1]))}return u===0&&g===0?0:Math.abs((g-u)/u)},yl.flatten=function(i){for(var e=i[0][0].length,r={vertices:[],holes:[],dimensions:e},s=0,l=0;l<i.length;l++){for(var u=0;u<i[l].length;u++)for(var d=0;d<e;d++)r.vertices.push(i[l][u][d]);l>0&&r.holes.push(s+=i[l-1].length)}return r};var Tc={};({get exports(){return Tc},set exports(i){Tc=i}}).exports=function(){function i(s,l,u,d,f){for(;d>u;){if(d-u>600){var g=d-u+1,x=l-u+1,w=Math.log(g),T=.5*Math.exp(2*w/3),A=.5*Math.sqrt(w*T*(g-T)/g)*(x-g/2<0?-1:1);i(s,l,Math.max(u,Math.floor(l-x*T/g+A)),Math.min(d,Math.floor(l+(g-x)*T/g+A)),f)}var I=s[l],P=u,F=d;for(e(s,u,l),f(s[d],I)>0&&e(s,u,d);P<F;){for(e(s,P,F),P++,F--;f(s[P],I)<0;)P++;for(;f(s[F],I)>0;)F--}f(s[u],I)===0?e(s,u,F):e(s,++F,d),F<=l&&(u=F+1),l<=F&&(d=F-1)}}function e(s,l,u){var d=s[l];s[l]=s[u],s[u]=d}function r(s,l){return s<l?-1:s>l?1:0}return function(s,l,u,d,f){i(s,l,u||0,d||s.length-1,f||r)}}();var Dm=Tc;function Sc(i,e){const r=i.length;if(r<=1)return[i];const s=[];let l,u;for(let d=0;d<r;d++){const f=Rr(i[d]);f!==0&&(i[d].area=Math.abs(f),u===void 0&&(u=f<0),u===f<0?(l&&s.push(l),l=[i[d]]):l.push(i[d]))}if(l&&s.push(l),e>1)for(let d=0;d<s.length;d++)s[d].length<=e||(Dm(s[d],e,1,s[d].length-1,Rm),s[d]=s[d].slice(0,e));return s}function Rm(i,e){return e.area-i.area}function Ec(i,e,r){const s=r.patternDependencies;let l=!1;for(const u of e){const d=u.paint.get(`${i}-pattern`);d.isConstant()||(l=!0);const f=d.constantOr(null);f&&(l=!0,s[f.to]=!0,s[f.from]=!0)}return l}function Ic(i,e,r,s,l){const u=l.patternDependencies;for(const d of e){const f=d.paint.get(`${i}-pattern`).value;if(f.kind!=="constant"){let g=f.evaluate({zoom:s-1},r,{},l.availableImages),x=f.evaluate({zoom:s},r,{},l.availableImages),w=f.evaluate({zoom:s+1},r,{},l.availableImages);g=g&&g.name?g.name:g,x=x&&x.name?x.name:x,w=w&&w.name?w.name:w,u[g]=!0,u[x]=!0,u[w]=!0,r.patterns[d.id]={min:g,mid:x,max:w}}}return r}class Ac{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ye,this.indexArray=new bt,this.indexArray2=new Ei,this.programConfigurations=new gs(e.layers,e.zoom),this.segments=new Nt,this.segments2=new Nt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=Ec("fill",this.layers,r);const l=this.layers[0].layout.get("fill-sort-key"),u=!l.isConstant(),d=[];for(const{feature:f,id:g,index:x,sourceLayerIndex:w}of e){const T=this.layers[0]._featureFilter.needGeometry,A=ys(f,T);if(!this.layers[0]._featureFilter.filter(new Vt(this.zoom),A,s))continue;const I=u?l.evaluate(A,{},s,r.availableImages):void 0,P={id:g,properties:f.properties,type:f.type,sourceLayerIndex:w,index:x,geometry:T?A.geometry:_s(f),patterns:{},sortKey:I};d.push(P)}u&&d.sort((f,g)=>f.sortKey-g.sortKey);for(const f of d){const{geometry:g,index:x,sourceLayerIndex:w}=f;if(this.hasPattern){const T=Ic("fill",this.layers,f,this.zoom,r);this.patternFeatures.push(T)}else this.addFeature(f,g,x,s,{});r.featureIndex.insert(e[x].feature,g,x,w,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}addFeatures(e,r,s){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Sm),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,r,s,l,u){for(const d of Sc(r,500)){let f=0;for(const I of d)f+=I.length;const g=this.segments.prepareSegment(f,this.layoutVertexArray,this.indexArray),x=g.vertexLength,w=[],T=[];for(const I of d){if(I.length===0)continue;I!==d[0]&&T.push(w.length/2);const P=this.segments2.prepareSegment(I.length,this.layoutVertexArray,this.indexArray2),F=P.vertexLength;this.layoutVertexArray.emplaceBack(I[0].x,I[0].y),this.indexArray2.emplaceBack(F+I.length-1,F),w.push(I[0].x),w.push(I[0].y);for(let O=1;O<I.length;O++)this.layoutVertexArray.emplaceBack(I[O].x,I[O].y),this.indexArray2.emplaceBack(F+O-1,F+O),w.push(I[O].x),w.push(I[O].y);P.vertexLength+=I.length,P.primitiveLength+=I.length}const A=ro(w,T);for(let I=0;I<A.length;I+=3)this.indexArray.emplaceBack(x+A[I],x+A[I+1],x+A[I+2]);g.vertexLength+=f,g.primitiveLength+=A.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,u,l)}}$e("FillBucket",Ac,{omit:["layers","patternFeatures"]});const Bm=new Si({"fill-sort-key":new Qe(V.layout_fill["fill-sort-key"])});var Fm={paint:new Si({"fill-antialias":new We(V.paint_fill["fill-antialias"]),"fill-opacity":new Qe(V.paint_fill["fill-opacity"]),"fill-color":new Qe(V.paint_fill["fill-color"]),"fill-outline-color":new Qe(V.paint_fill["fill-outline-color"]),"fill-translate":new We(V.paint_fill["fill-translate"]),"fill-translate-anchor":new We(V.paint_fill["fill-translate-anchor"]),"fill-pattern":new us(V.paint_fill["fill-pattern"])}),layout:Bm};const Om=Wt([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Um=Wt([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Vm}=Om;var Dn={},Nm=it,_u=ea;function ea(i,e,r,s,l){this.properties={},this.extent=r,this.type=0,this._pbf=i,this._geometry=-1,this._keys=s,this._values=l,i.readFields($m,this,e)}function $m(i,e,r){i==1?e.id=r.readVarint():i==2?function(s,l){for(var u=s.readVarint()+s.pos;s.pos<u;){var d=l._keys[s.readVarint()],f=l._values[s.readVarint()];l.properties[d]=f}}(r,e):i==3?e.type=r.readVarint():i==4&&(e._geometry=r.pos)}function jm(i){for(var e,r,s=0,l=0,u=i.length,d=u-1;l<u;d=l++)s+=((r=i[d]).x-(e=i[l]).x)*(e.y+r.y);return s}ea.types=["Unknown","Point","LineString","Polygon"],ea.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var e,r=i.readVarint()+i.pos,s=1,l=0,u=0,d=0,f=[];i.pos<r;){if(l<=0){var g=i.readVarint();s=7&g,l=g>>3}if(l--,s===1||s===2)u+=i.readSVarint(),d+=i.readSVarint(),s===1&&(e&&f.push(e),e=[]),e.push(new Nm(u,d));else{if(s!==7)throw new Error("unknown command "+s);e&&e.push(e[0].clone())}}return e&&f.push(e),f},ea.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,s=0,l=0,u=0,d=1/0,f=-1/0,g=1/0,x=-1/0;i.pos<e;){if(s<=0){var w=i.readVarint();r=7&w,s=w>>3}if(s--,r===1||r===2)(l+=i.readSVarint())<d&&(d=l),l>f&&(f=l),(u+=i.readSVarint())<g&&(g=u),u>x&&(x=u);else if(r!==7)throw new Error("unknown command "+r)}return[d,g,f,x]},ea.prototype.toGeoJSON=function(i,e,r){var s,l,u=this.extent*Math.pow(2,r),d=this.extent*i,f=this.extent*e,g=this.loadGeometry(),x=ea.types[this.type];function w(I){for(var P=0;P<I.length;P++){var F=I[P];I[P]=[360*(F.x+d)/u-180,360/Math.PI*Math.atan(Math.exp((180-360*(F.y+f)/u)*Math.PI/180))-90]}}switch(this.type){case 1:var T=[];for(s=0;s<g.length;s++)T[s]=g[s][0];w(g=T);break;case 2:for(s=0;s<g.length;s++)w(g[s]);break;case 3:for(g=function(I){var P=I.length;if(P<=1)return[I];for(var F,O,G=[],Y=0;Y<P;Y++){var $=jm(I[Y]);$!==0&&(O===void 0&&(O=$<0),O===$<0?(F&&G.push(F),F=[I[Y]]):F.push(I[Y]))}return F&&G.push(F),G}(g),s=0;s<g.length;s++)for(l=0;l<g[s].length;l++)w(g[s][l])}g.length===1?g=g[0]:x="Multi"+x;var A={type:"Feature",geometry:{type:x,coordinates:g},properties:this.properties};return"id"in this&&(A.id=this.id),A};var Gm=_u,yu=xu;function xu(i,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(qm,this,e),this.length=this._features.length}function qm(i,e,r){i===15?e.version=r.readVarint():i===1?e.name=r.readString():i===5?e.extent=r.readVarint():i===2?e._features.push(r.pos):i===3?e._keys.push(r.readString()):i===4&&e._values.push(function(s){for(var l=null,u=s.readVarint()+s.pos;s.pos<u;){var d=s.readVarint()>>3;l=d===1?s.readString():d===2?s.readFloat():d===3?s.readDouble():d===4?s.readVarint64():d===5?s.readVarint():d===6?s.readSVarint():d===7?s.readBoolean():null}return l}(r))}xu.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var e=this._pbf.readVarint()+this._pbf.pos;return new Gm(this._pbf,e,this.extent,this._keys,this._values)};var Zm=yu;function Xm(i,e,r){if(i===3){var s=new Zm(r,r.readVarint()+r.pos);s.length&&(e[s.name]=s)}}Dn.VectorTile=function(i,e){this.layers=i.readFields(Xm,{},e)},Dn.VectorTileFeature=_u,Dn.VectorTileLayer=yu;const Wm=Dn.VectorTileFeature.types,Cc=Math.pow(2,13);function oo(i,e,r,s,l,u,d,f){i.emplaceBack(e,r,2*Math.floor(s*Cc)+d,l*Cc*2,u*Cc*2,Math.round(f))}class Mc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Ae,this.centroidVertexArray=new de,this.indexArray=new bt,this.programConfigurations=new gs(e.layers,e.zoom),this.segments=new Nt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.features=[],this.hasPattern=Ec("fill-extrusion",this.layers,r);for(const{feature:l,id:u,index:d,sourceLayerIndex:f}of e){const g=this.layers[0]._featureFilter.needGeometry,x=ys(l,g);if(!this.layers[0]._featureFilter.filter(new Vt(this.zoom),x,s))continue;const w={id:u,sourceLayerIndex:f,index:d,geometry:g?x.geometry:_s(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(Ic("fill-extrusion",this.layers,w,this.zoom,r)):this.addFeature(w,w.geometry,d,s,{}),r.featureIndex.insert(l,w.geometry,d,f,this.index,!0)}}addFeatures(e,r,s){for(const l of this.features){const{geometry:u}=l;this.addFeature(l,u,l.index,r,s)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Vm),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Um.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,r,s,l,u){const d={x:0,y:0,vertexCount:0};for(const f of Sc(r,500)){let g=0;for(const P of f)g+=P.length;let x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const P of f){if(P.length===0||Km(P))continue;let F=0;for(let O=0;O<P.length;O++){const G=P[O];if(O>=1){const Y=P[O-1];if(!Hm(G,Y)){x.vertexLength+4>Nt.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const $=G.sub(Y)._perp()._unit(),J=Y.dist(G);F+J>32768&&(F=0),oo(this.layoutVertexArray,G.x,G.y,$.x,$.y,0,0,F),oo(this.layoutVertexArray,G.x,G.y,$.x,$.y,0,1,F),d.x+=2*G.x,d.y+=2*G.y,d.vertexCount+=2,F+=J,oo(this.layoutVertexArray,Y.x,Y.y,$.x,$.y,0,0,F),oo(this.layoutVertexArray,Y.x,Y.y,$.x,$.y,0,1,F),d.x+=2*Y.x,d.y+=2*Y.y,d.vertexCount+=2;const pe=x.vertexLength;this.indexArray.emplaceBack(pe,pe+2,pe+1),this.indexArray.emplaceBack(pe+1,pe+2,pe+3),x.vertexLength+=4,x.primitiveLength+=2}}}}if(x.vertexLength+g>Nt.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(g,this.layoutVertexArray,this.indexArray)),Wm[e.type]!=="Polygon")continue;const w=[],T=[],A=x.vertexLength;for(const P of f)if(P.length!==0){P!==f[0]&&T.push(w.length/2);for(let F=0;F<P.length;F++){const O=P[F];oo(this.layoutVertexArray,O.x,O.y,0,0,1,1,0),d.x+=O.x,d.y+=O.y,d.vertexCount+=1,w.push(O.x),w.push(O.y)}}const I=ro(w,T);for(let P=0;P<I.length;P+=3)this.indexArray.emplaceBack(A+I[P],A+I[P+2],A+I[P+1]);x.primitiveLength+=I.length/3,x.vertexLength+=g}for(let f=0;f<d.vertexCount;f++)this.centroidVertexArray.emplaceBack(Math.floor(d.x/d.vertexCount),Math.floor(d.y/d.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,u,l)}}function Hm(i,e){return i.x===e.x&&(i.x<0||i.x>ai)||i.y===e.y&&(i.y<0||i.y>ai)}function Km(i){return i.every(e=>e.x<0)||i.every(e=>e.x>ai)||i.every(e=>e.y<0)||i.every(e=>e.y>ai)}$e("FillExtrusionBucket",Mc,{omit:["layers","features"]});var Jm={paint:new Si({"fill-extrusion-opacity":new We(V["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Qe(V["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new We(V["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new We(V["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new us(V["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Qe(V["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Qe(V["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new We(V["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function lo(i,e){return i.x*e.x+i.y*e.y}function vu(i,e){if(i.length===1){let r=0;const s=e[r++];let l;for(;!l||s.equals(l);)if(l=e[r++],!l)return 1/0;for(;r<e.length;r++){const u=e[r],d=i[0],f=l.sub(s),g=u.sub(s),x=d.sub(s),w=lo(f,f),T=lo(f,g),A=lo(g,g),I=lo(x,f),P=lo(x,g),F=w*A-T*T,O=(A*I-T*P)/F,G=(w*P-T*I)/F,Y=s.z*(1-O-G)+l.z*O+u.z*G;if(isFinite(Y))return Y}return 1/0}{let r=1/0;for(const s of e)r=Math.min(r,s.z);return r}}const Ym=Wt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Qm}=Ym,ef=Wt([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:tf}=ef,rf=Dn.VectorTileFeature.types,nf=Math.cos(Math.PI/180*37.5),bu=Math.pow(2,14)/.5;class Pc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new Ge,this.layoutVertexArray2=new rt,this.indexArray=new bt,this.programConfigurations=new gs(e.layers,e.zoom),this.segments=new Nt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=Ec("line",this.layers,r);const l=this.layers[0].layout.get("line-sort-key"),u=!l.isConstant(),d=[];for(const{feature:f,id:g,index:x,sourceLayerIndex:w}of e){const T=this.layers[0]._featureFilter.needGeometry,A=ys(f,T);if(!this.layers[0]._featureFilter.filter(new Vt(this.zoom),A,s))continue;const I=u?l.evaluate(A,{},s):void 0,P={id:g,properties:f.properties,type:f.type,sourceLayerIndex:w,index:x,geometry:T?A.geometry:_s(f),patterns:{},sortKey:I};d.push(P)}u&&d.sort((f,g)=>f.sortKey-g.sortKey);for(const f of d){const{geometry:g,index:x,sourceLayerIndex:w}=f;if(this.hasPattern){const T=Ic("line",this.layers,f,this.zoom,r);this.patternFeatures.push(T)}else this.addFeature(f,g,x,s,{});r.featureIndex.insert(e[x].feature,g,x,w,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}addFeatures(e,r,s){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,tf)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Qm),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,r,s,l,u){const d=this.layers[0].layout,f=d.get("line-join").evaluate(e,{}),g=d.get("line-cap"),x=d.get("line-miter-limit"),w=d.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const T of r)this.addLine(T,e,f,g,x,w);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,u,l)}addLine(e,r,s,l,u,d){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let G=0;G<e.length-1;G++)this.totalDistance+=e[G].dist(e[G+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const f=rf[r.type]==="Polygon";let g=e.length;for(;g>=2&&e[g-1].equals(e[g-2]);)g--;let x=0;for(;x<g-1&&e[x].equals(e[x+1]);)x++;if(g<(f?3:2))return;s==="bevel"&&(u=1.05);const w=this.overscaling<=16?122880/(512*this.overscaling):0,T=this.segments.prepareSegment(10*g,this.layoutVertexArray,this.indexArray);let A,I,P,F,O;this.e1=this.e2=-1,f&&(A=e[g-2],O=e[x].sub(A)._unit()._perp());for(let G=x;G<g;G++){if(P=G===g-1?f?e[x+1]:void 0:e[G+1],P&&e[G].equals(P))continue;O&&(F=O),A&&(I=A),A=e[G],O=P?P.sub(A)._unit()._perp():F,F=F||O;let Y=F.add(O);Y.x===0&&Y.y===0||Y._unit();const $=F.x*O.x+F.y*O.y,J=Y.x*O.x+Y.y*O.y,pe=J!==0?1/J:1/0,ue=2*Math.sqrt(2-2*J),Ne=J<nf&&I&&P,qe=F.x*O.y-F.y*O.x>0;if(Ne&&G>x){const ze=A.dist(I);if(ze>2*w){const Ve=A.sub(A.sub(I)._mult(w/ze)._round());this.updateDistance(I,Ve),this.addCurrentVertex(Ve,F,0,0,T),I=Ve}}const Ue=I&&P;let Re=Ue?s:f?"butt":l;if(Ue&&Re==="round"&&(pe<d?Re="miter":pe<=2&&(Re="fakeround")),Re==="miter"&&pe>u&&(Re="bevel"),Re==="bevel"&&(pe>2&&(Re="flipbevel"),pe<u&&(Re="miter")),I&&this.updateDistance(I,A),Re==="miter")Y._mult(pe),this.addCurrentVertex(A,Y,0,0,T);else if(Re==="flipbevel"){if(pe>100)Y=O.mult(-1);else{const ze=pe*F.add(O).mag()/F.sub(O).mag();Y._perp()._mult(ze*(qe?-1:1))}this.addCurrentVertex(A,Y,0,0,T),this.addCurrentVertex(A,Y.mult(-1),0,0,T)}else if(Re==="bevel"||Re==="fakeround"){const ze=-Math.sqrt(pe*pe-1),Ve=qe?ze:0,Be=qe?0:ze;if(I&&this.addCurrentVertex(A,F,Ve,Be,T),Re==="fakeround"){const Ee=Math.round(180*ue/Math.PI/20);for(let Ke=1;Ke<Ee;Ke++){let Xe=Ke/Ee;if(Xe!==.5){const Gt=Xe-.5;Xe+=Xe*Gt*(Xe-1)*((1.0904+$*($*(3.55645-1.43519*$)-3.2452))*Gt*Gt+(.848013+$*(.215638*$-1.06021)))}const ct=O.sub(F)._mult(Xe)._add(F)._unit()._mult(qe?-1:1);this.addHalfVertex(A,ct.x,ct.y,!1,qe,0,T)}}P&&this.addCurrentVertex(A,O,-Ve,-Be,T)}else if(Re==="butt")this.addCurrentVertex(A,Y,0,0,T);else if(Re==="square"){const ze=I?1:-1;this.addCurrentVertex(A,Y,ze,ze,T)}else Re==="round"&&(I&&(this.addCurrentVertex(A,F,0,0,T),this.addCurrentVertex(A,F,1,1,T,!0)),P&&(this.addCurrentVertex(A,O,-1,-1,T,!0),this.addCurrentVertex(A,O,0,0,T)));if(Ne&&G<g-1){const ze=A.dist(P);if(ze>2*w){const Ve=A.add(P.sub(A)._mult(w/ze)._round());this.updateDistance(A,Ve),this.addCurrentVertex(Ve,O,0,0,T),A=Ve}}}}addCurrentVertex(e,r,s,l,u,d=!1){const f=r.y*l-r.x,g=-r.y-r.x*l;this.addHalfVertex(e,r.x+r.y*s,r.y-r.x*s,d,!1,s,u),this.addHalfVertex(e,f,g,d,!0,-l,u),this.distance>bu/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(e,r,s,l,u,d))}addHalfVertex({x:e,y:r},s,l,u,d,f,g){const x=.5*(this.lineClips?this.scaledDistance*(bu-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(u?1:0),(r<<1)+(d?1:0),Math.round(63*s)+128,Math.round(63*l)+128,1+(f===0?0:f<0?-1:1)|(63&x)<<2,x>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const w=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,w),g.primitiveLength++),d?this.e2=w:this.e1=w}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}}$e("LineBucket",Pc,{omit:["layers","patternFeatures"]});const sf=new Si({"line-cap":new We(V.layout_line["line-cap"]),"line-join":new Qe(V.layout_line["line-join"]),"line-miter-limit":new We(V.layout_line["line-miter-limit"]),"line-round-limit":new We(V.layout_line["line-round-limit"]),"line-sort-key":new Qe(V.layout_line["line-sort-key"])});var wu={paint:new Si({"line-opacity":new Qe(V.paint_line["line-opacity"]),"line-color":new Qe(V.paint_line["line-color"]),"line-translate":new We(V.paint_line["line-translate"]),"line-translate-anchor":new We(V.paint_line["line-translate-anchor"]),"line-width":new Qe(V.paint_line["line-width"]),"line-gap-width":new Qe(V.paint_line["line-gap-width"]),"line-offset":new Qe(V.paint_line["line-offset"]),"line-blur":new Qe(V.paint_line["line-blur"]),"line-dasharray":new Wa(V.paint_line["line-dasharray"]),"line-pattern":new us(V.paint_line["line-pattern"]),"line-gradient":new Ha(V.paint_line["line-gradient"])}),layout:sf};const Tu=new class extends Qe{possiblyEvaluate(i,e){return e=new Vt(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(i,e)}evaluate(i,e,r,s){return e=Ye({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(i,e,r,s)}}(wu.paint.properties["line-width"].specification);function Su(i,e){return e>0?e+2*i:i}Tu.useIntegerZoom=!0;const af=Wt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),of=Wt([{name:"a_projected_pos",components:3,type:"Float32"}],4);Wt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const lf=Wt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Wt([{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 Eu=Wt([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),cf=Wt([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function hf(i,e,r){return i.sections.forEach(s=>{s.text=function(l,u,d){const f=u.layout.get("text-transform").evaluate(d,{});return f==="uppercase"?l=l.toLocaleUpperCase():f==="lowercase"&&(l=l.toLocaleLowerCase()),ji.applyArabicShaping&&(l=ji.applyArabicShaping(l)),l}(s.text,e,r)}),i}Wt([{name:"triangle",components:3,type:"Uint16"}]),Wt([{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"}]),Wt([{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Wt([{type:"Float32",name:"offsetX"}]),Wt([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const co={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"};var pi=24,kc=Pt,Iu=function(i,e,r,s,l){var u,d,f=8*l-s-1,g=(1<<f)-1,x=g>>1,w=-7,T=r?l-1:0,A=r?-1:1,I=i[e+T];for(T+=A,u=I&(1<<-w)-1,I>>=-w,w+=f;w>0;u=256*u+i[e+T],T+=A,w-=8);for(d=u&(1<<-w)-1,u>>=-w,w+=s;w>0;d=256*d+i[e+T],T+=A,w-=8);if(u===0)u=1-x;else{if(u===g)return d?NaN:1/0*(I?-1:1);d+=Math.pow(2,s),u-=x}return(I?-1:1)*d*Math.pow(2,u-s)},Au=function(i,e,r,s,l,u){var d,f,g,x=8*u-l-1,w=(1<<x)-1,T=w>>1,A=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,I=s?0:u-1,P=s?1:-1,F=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,d=w):(d=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-d))<1&&(d--,g*=2),(e+=d+T>=1?A/g:A*Math.pow(2,1-T))*g>=2&&(d++,g/=2),d+T>=w?(f=0,d=w):d+T>=1?(f=(e*g-1)*Math.pow(2,l),d+=T):(f=e*Math.pow(2,T-1)*Math.pow(2,l),d=0));l>=8;i[r+I]=255&f,I+=P,f/=256,l-=8);for(d=d<<l|f,x+=l;x>0;i[r+I]=255&d,I+=P,d/=256,x-=8);i[r+I-P]|=128*F};function Pt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}Pt.Varint=0,Pt.Fixed64=1,Pt.Bytes=2,Pt.Fixed32=5;var Rn,zc=4294967296,Cu=1/zc,Mu=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function tn(i){return i.type===Pt.Bytes?i.readVarint()+i.pos:i.pos+1}function ta(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function Pu(i,e,r){var s=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(s);for(var l=r.pos-1;l>=i;l--)r.buf[l+s]=r.buf[l]}function uf(i,e){for(var r=0;r<i.length;r++)e.writeVarint(i[r])}function pf(i,e){for(var r=0;r<i.length;r++)e.writeSVarint(i[r])}function df(i,e){for(var r=0;r<i.length;r++)e.writeFloat(i[r])}function mf(i,e){for(var r=0;r<i.length;r++)e.writeDouble(i[r])}function ff(i,e){for(var r=0;r<i.length;r++)e.writeBoolean(i[r])}function gf(i,e){for(var r=0;r<i.length;r++)e.writeFixed32(i[r])}function _f(i,e){for(var r=0;r<i.length;r++)e.writeSFixed32(i[r])}function yf(i,e){for(var r=0;r<i.length;r++)e.writeFixed64(i[r])}function xf(i,e){for(var r=0;r<i.length;r++)e.writeSFixed64(i[r])}function wl(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+16777216*i[e+3]}function ia(i,e,r){i[r]=e,i[r+1]=e>>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function ku(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}function vf(i,e,r){i===1&&r.readMessage(bf,e)}function bf(i,e,r){if(i===3){const{id:s,bitmap:l,width:u,height:d,left:f,top:g,advance:x}=r.readMessage(wf,{});e.push({id:s,bitmap:new io({width:u+6,height:d+6},l),metrics:{width:u,height:d,left:f,top:g,advance:x}})}}function wf(i,e,r){i===1?e.id=r.readVarint():i===2?e.bitmap=r.readBytes():i===3?e.width=r.readVarint():i===4?e.height=r.readVarint():i===5?e.left=r.readSVarint():i===6?e.top=r.readSVarint():i===7&&(e.advance=r.readVarint())}function zu(i){let e=0,r=0;for(const d of i)e+=d.w*d.h,r=Math.max(r,d.w);i.sort((d,f)=>f.h-d.h);const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let l=0,u=0;for(const d of i)for(let f=s.length-1;f>=0;f--){const g=s[f];if(!(d.w>g.w||d.h>g.h)){if(d.x=g.x,d.y=g.y,u=Math.max(u,d.y+d.h),l=Math.max(l,d.x+d.w),d.w===g.w&&d.h===g.h){const x=s.pop();f<s.length&&(s[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):(s.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:u,fill:e/(l*u)||0}}Pt.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos<r;){var s=this.readVarint(),l=s>>3,u=this.pos;this.type=7&s,i(l,e,this),this.pos===u&&this.skip(s)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=wl(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=ku(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=wl(this.buf,this.pos)+wl(this.buf,this.pos+4)*zc;return this.pos+=8,i},readSFixed64:function(){var i=wl(this.buf,this.pos)+ku(this.buf,this.pos+4)*zc;return this.pos+=8,i},readFloat:function(){var i=Iu(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Iu(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,s=this.buf;return e=127&(r=s[this.pos++]),r<128?e:(e|=(127&(r=s[this.pos++]))<<7,r<128?e:(e|=(127&(r=s[this.pos++]))<<14,r<128?e:(e|=(127&(r=s[this.pos++]))<<21,r<128?e:function(l,u,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,u);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=s[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var i=this.readVarint()+this.pos,e=this.pos;return this.pos=i,i-e>=12&&Mu?function(r,s,l){return Mu.decode(r.subarray(s,l))}(this.buf,e,i):function(r,s,l){for(var u="",d=s;d<l;){var f,g,x,w=r[d],T=null,A=w>239?4:w>223?3:w>191?2:1;if(d+A>l)break;A===1?w<128&&(T=w):A===2?(192&(f=r[d+1]))==128&&(T=(31&w)<<6|63&f)<=127&&(T=null):A===3?(g=r[d+2],(192&(f=r[d+1]))==128&&(192&g)==128&&((T=(15&w)<<12|(63&f)<<6|63&g)<=2047||T>=55296&&T<=57343)&&(T=null)):A===4&&(g=r[d+2],x=r[d+3],(192&(f=r[d+1]))==128&&(192&g)==128&&(192&x)==128&&((T=(15&w)<<18|(63&f)<<12|(63&g)<<6|63&x)<=65535||T>=1114112)&&(T=null)),T===null?(T=65533,A=1):T>65535&&(T-=65536,u+=String.fromCharCode(T>>>10&1023|55296),T=56320|1023&T),u+=String.fromCharCode(T),d+=A}return u}(this.buf,e,i)},readBytes:function(){var i=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,i);return this.pos=i,e},readPackedVarint:function(i,e){if(this.type!==Pt.Bytes)return i.push(this.readVarint(e));var r=tn(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(e));return i},readPackedSVarint:function(i){if(this.type!==Pt.Bytes)return i.push(this.readSVarint());var e=tn(this);for(i=i||[];this.pos<e;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==Pt.Bytes)return i.push(this.readBoolean());var e=tn(this);for(i=i||[];this.pos<e;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==Pt.Bytes)return i.push(this.readFloat());var e=tn(this);for(i=i||[];this.pos<e;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==Pt.Bytes)return i.push(this.readDouble());var e=tn(this);for(i=i||[];this.pos<e;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==Pt.Bytes)return i.push(this.readFixed32());var e=tn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==Pt.Bytes)return i.push(this.readSFixed32());var e=tn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==Pt.Bytes)return i.push(this.readFixed64());var e=tn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==Pt.Bytes)return i.push(this.readSFixed64());var e=tn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed64());return i},skip:function(i){var e=7&i;if(e===Pt.Varint)for(;this.buf[this.pos++]>127;);else if(e===Pt.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Pt.Fixed32)this.pos+=4;else{if(e!==Pt.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e<this.pos+i;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(i){this.realloc(4),ia(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),ia(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),ia(this.buf,-1&i,this.pos),ia(this.buf,Math.floor(i*Cu),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),ia(this.buf,-1&i,this.pos),ia(this.buf,Math.floor(i*Cu),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?function(e,r){var s,l;if(e>=0?(s=e%4294967296|0,l=e/4294967296|0):(l=~(-e/4294967296),4294967295^(s=~(-e%4294967296))?s=s+1|0:(s=0,l=l+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(u,d,f){f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,f.buf[f.pos]=127&(u>>>=7)}(s,0,r),function(u,d){var f=(7&u)<<4;d.buf[d.pos++]|=f|((u>>>=3)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u)))))}(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(Boolean(i))},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var e=this.pos;this.pos=function(s,l,u){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?(s[u++]=239,s[u++]=191,s[u++]=189):f=d;continue}if(d<56320){s[u++]=239,s[u++]=191,s[u++]=189,f=d;continue}d=f-55296<<10|d-56320|65536,f=null}else f&&(s[u++]=239,s[u++]=191,s[u++]=189,f=null);d<128?s[u++]=d:(d<2048?s[u++]=d>>6|192:(d<65536?s[u++]=d>>12|224:(s[u++]=d>>18|240,s[u++]=d>>12&63|128),s[u++]=d>>6&63|128),s[u++]=63&d|128)}return u}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&Pu(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Au(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Au(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=i[r]},writeRawMessage:function(i,e){this.pos++;var r=this.pos;i(e,this);var s=this.pos-r;s>=128&&Pu(r,s,this),this.pos=r-1,this.writeVarint(s),this.pos+=s},writeMessage:function(i,e,r){this.writeTag(i,Pt.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,uf,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,pf,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,ff,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,df,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,mf,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,gf,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,_f,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,yf,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,xf,e)},writeBytesField:function(i,e){this.writeTag(i,Pt.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,Pt.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,Pt.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,Pt.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,Pt.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,Pt.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,Pt.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,Pt.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,Pt.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,Pt.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,Boolean(e))}};class Lc{constructor(e,{pixelRatio:r,version:s,stretchX:l,stretchY:u,content:d}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=l,this.stretchY=u,this.content=d,this.version=s}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class Lu{constructor(e,r){const s={},l={};this.haveRenderCallbacks=[];const u=[];this.addImages(e,s,u),this.addImages(r,l,u);const{w:d,h:f}=zu(u),g=new pr({width:d||1,height:f||1});for(const x in e){const w=e[x],T=s[x].paddedRect;pr.copy(w.data,g,{x:0,y:0},{x:T.x+1,y:T.y+1},w.data)}for(const x in r){const w=r[x],T=l[x].paddedRect,A=T.x+1,I=T.y+1,P=w.data.width,F=w.data.height;pr.copy(w.data,g,{x:0,y:0},{x:A,y:I},w.data),pr.copy(w.data,g,{x:0,y:F-1},{x:A,y:I-1},{width:P,height:1}),pr.copy(w.data,g,{x:0,y:0},{x:A,y:I+F},{width:P,height:1}),pr.copy(w.data,g,{x:P-1,y:0},{x:A-1,y:I},{width:1,height:F}),pr.copy(w.data,g,{x:0,y:0},{x:A+P,y:I},{width:1,height:F})}this.image=g,this.iconPositions=s,this.patternPositions=l}addImages(e,r,s){for(const l in e){const u=e[l],d={x:0,y:0,w:u.data.width+2,h:u.data.height+2};s.push(d),r[l]=new Lc(d,u),u.hasRenderCallback&&this.haveRenderCallbacks.push(l)}}patchUpdatedImages(e,r){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const s in e.updatedImages)this.patchUpdatedImage(this.iconPositions[s],e.getImage(s),r),this.patchUpdatedImage(this.patternPositions[s],e.getImage(s),r)}patchUpdatedImage(e,r,s){if(!e||!r||e.version===r.version)return;e.version=r.version;const[l,u]=e.tl;s.update(r.data,void 0,{x:l,y:u})}}$e("ImagePosition",Lc),$e("ImageAtlas",Lu),c.WritingMode=void 0,(Rn=c.WritingMode||(c.WritingMode={}))[Rn.none=0]="none",Rn[Rn.horizontal=1]="horizontal",Rn[Rn.vertical=2]="vertical",Rn[Rn.horizontalOnly=3]="horizontalOnly";const Tl=-17;class ho{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){const s=new ho;return s.scale=e||1,s.fontStack=r,s}static forImage(e){const r=new ho;return r.imageName=e,r}}class ra{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){const s=new ra;for(let l=0;l<e.sections.length;l++){const u=e.sections[l];u.image?s.addImageSection(u):s.addTextSection(u,r)}return s}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}getCharCode(e){return this.text.charCodeAt(e)}verticalizePunctuation(){this.text=function(e){let r="";for(let s=0;s<e.length;s++){const l=e.charCodeAt(s+1)||null,u=e.charCodeAt(s-1)||null;r+=l&&ol(l)&&!co[e[s+1]]||u&&ol(u)&&!co[e[s-1]]||!co[e[s]]?e[s]:co[e[s]]}return r}(this.text)}trim(){let e=0;for(let s=0;s<this.text.length&&El[this.text.charCodeAt(s)];s++)e++;let r=this.text.length;for(let s=this.text.length-1;s>=0&&s>=e&&El[this.text.charCodeAt(s)];s--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const s=new ra;return s.text=this.text.substring(e,r),s.sectionIndex=this.sectionIndex.slice(e,r),s.sections=this.sections,s}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}addTextSection(e,r){this.text+=e.text,this.sections.push(ho.forText(e.scale,e.fontStack||r));const s=this.sections.length-1;for(let l=0;l<e.text.length;++l)this.sectionIndex.push(s)}addImageSection(e){const r=e.image?e.image.name:"";if(r.length===0)return void Yt("Can't add FormattedSection with an empty image.");const s=this.getNextImageSectionCharCode();s?(this.text+=String.fromCharCode(s),this.sections.push(ho.forImage(r)),this.sectionIndex.push(this.sections.length-1)):Yt("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Sl(i,e,r,s,l,u,d,f,g,x,w,T,A,I,P,F){const O=ra.fromFeature(i,l);let G;T===c.WritingMode.vertical&&O.verticalizePunctuation();const{processBidirectionalText:Y,processStyledBidirectionalText:$}=ji;if(Y&&O.sections.length===1){G=[];const ue=Y(O.toString(),Dc(O,x,u,e,s,I,P));for(const Ne of ue){const qe=new ra;qe.text=Ne,qe.sections=O.sections;for(let Ue=0;Ue<Ne.length;Ue++)qe.sectionIndex.push(0);G.push(qe)}}else if($){G=[];const ue=$(O.text,O.sectionIndex,Dc(O,x,u,e,s,I,P));for(const Ne of ue){const qe=new ra;qe.text=Ne[0],qe.sectionIndex=Ne[1],qe.sections=O.sections,G.push(qe)}}else G=function(ue,Ne){const qe=[],Ue=ue.text;let Re=0;for(const ze of Ne)qe.push(ue.substring(Re,ze)),Re=ze;return Re<Ue.length&&qe.push(ue.substring(Re,Ue.length)),qe}(O,Dc(O,x,u,e,s,I,P));const J=[],pe={positionedLines:J,text:O.toString(),top:w[1],bottom:w[1],left:w[0],right:w[0],writingMode:T,iconsInText:!1,verticalizable:!1};return function(ue,Ne,qe,Ue,Re,ze,Ve,Be,Ee,Ke,Xe,ct){let Gt=0,Zt=Tl,oi=0,mr=0;const fi=Be==="right"?1:Be==="left"?0:.5;let ri=0;for(const ni of Re){ni.trim();const _i=ni.getMaxScale(),Mi=(_i-1)*pi,Bi={positionedGlyphs:[],lineOffset:0};ue.positionedLines[ri]=Bi;const qi=Bi.positionedGlyphs;let Zi=0;if(!ni.length()){Zt+=ze,++ri;continue}for(let yi=0;yi<ni.length();yi++){const ht=ni.getSection(yi),rr=ni.getSectionIndex(yi),xi=ni.getCharCode(yi);let Pi=0,vr=null,Mr=null,Pr=null,nn=pi;const br=!(Ee===c.WritingMode.horizontal||!Xe&&!Ua(xi)||Xe&&(El[xi]||(hi=xi,Oe.Arabic(hi)||Oe["Arabic Supplement"](hi)||Oe["Arabic Extended-A"](hi)||Oe["Arabic Presentation Forms-A"](hi)||Oe["Arabic Presentation Forms-B"](hi))));if(ht.imageName){const fr=Ue[ht.imageName];if(!fr)continue;Pr=ht.imageName,ue.iconsInText=ue.iconsInText||!0,Mr=fr.paddedRect;const Xi=fr.displaySize;ht.scale=ht.scale*pi/ct,vr={width:Xi[0],height:Xi[1],left:1,top:-3,advance:br?Xi[1]:Xi[0]},Pi=Mi+(pi-Xi[1]*ht.scale),nn=vr.advance;const sn=br?Xi[0]*ht.scale-pi*_i:Xi[1]*ht.scale-pi*_i;sn>0&&sn>Zi&&(Zi=sn)}else{const fr=qe[ht.fontStack],Xi=fr&&fr[xi];if(Xi&&Xi.rect)Mr=Xi.rect,vr=Xi.metrics;else{const sn=Ne[ht.fontStack],fo=sn&&sn[xi];if(!fo)continue;vr=fo.metrics}Pi=(_i-ht.scale)*pi}br?(ue.verticalizable=!0,qi.push({glyph:xi,imageName:Pr,x:Gt,y:Zt+Pi,vertical:br,scale:ht.scale,fontStack:ht.fontStack,sectionIndex:rr,metrics:vr,rect:Mr}),Gt+=nn*ht.scale+Ke):(qi.push({glyph:xi,imageName:Pr,x:Gt,y:Zt+Pi,vertical:br,scale:ht.scale,fontStack:ht.fontStack,sectionIndex:rr,metrics:vr,rect:Mr}),Gt+=vr.advance*ht.scale+Ke)}qi.length!==0&&(oi=Math.max(Gt-Ke,oi),Ef(qi,0,qi.length-1,fi,Zi)),Gt=0;const Kt=ze*_i+Zi;Bi.lineOffset=Math.max(Zi,Mi),Zt+=Kt,mr=Math.max(Kt,mr),++ri}var hi;const gi=Zt-Tl,{horizontalAlign:Ci,verticalAlign:Gi}=Rc(Ve);(function(ni,_i,Mi,Bi,qi,Zi,Kt,yi,ht){const rr=(_i-Mi)*qi;let xi=0;xi=Zi!==Kt?-yi*Bi-Tl:(-Bi*ht+.5)*Kt;for(const Pi of ni)for(const vr of Pi.positionedGlyphs)vr.x+=rr,vr.y+=xi})(ue.positionedLines,fi,Ci,Gi,oi,mr,ze,gi,Re.length),ue.top+=-Gi*gi,ue.bottom=ue.top+gi,ue.left+=-Ci*oi,ue.right=ue.left+oi}(pe,e,r,s,G,d,f,g,T,x,A,F),!function(ue){for(const Ne of ue)if(Ne.positionedGlyphs.length!==0)return!1;return!0}(J)&&pe}const El={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Tf={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Du(i,e,r,s,l,u){if(e.imageName){const d=s[e.imageName];return d?d.displaySize[0]*e.scale*pi/u+l:0}{const d=r[e.fontStack],f=d&&d[i];return f?f.metrics.advance*e.scale+l:0}}function Ru(i,e,r,s){const l=Math.pow(i-e,2);return s?i<e?l/2:2*l:l+Math.abs(r)*r}function Sf(i,e,r){let s=0;return i===10&&(s-=1e4),r&&(s+=150),i!==40&&i!==65288||(s+=50),e!==41&&e!==65289||(s+=50),s}function Bu(i,e,r,s,l,u){let d=null,f=Ru(e,r,l,u);for(const g of s){const x=Ru(e-g.x,r,l,u)+g.badness;x<=f&&(d=g,f=x)}return{index:i,x:e,priorBreak:d,badness:f}}function Fu(i){return i?Fu(i.priorBreak).concat(i.index):[]}function Dc(i,e,r,s,l,u,d){if(u!=="point")return[];if(!i)return[];const f=[],g=function(A,I,P,F,O,G){let Y=0;for(let $=0;$<A.length();$++){const J=A.getSection($);Y+=Du(A.getCharCode($),J,F,O,I,G)}return Y/Math.max(1,Math.ceil(Y/P))}(i,e,r,s,l,d),x=i.text.indexOf("\u200B")>=0;let w=0;for(let A=0;A<i.length();A++){const I=i.getSection(A),P=i.getCharCode(A);if(El[P]||(w+=Du(P,I,s,l,e,d)),A<i.length()-1){const F=!((T=P)<11904||!(Oe["Bopomofo Extended"](T)||Oe.Bopomofo(T)||Oe["CJK Compatibility Forms"](T)||Oe["CJK Compatibility Ideographs"](T)||Oe["CJK Compatibility"](T)||Oe["CJK Radicals Supplement"](T)||Oe["CJK Strokes"](T)||Oe["CJK Symbols and Punctuation"](T)||Oe["CJK Unified Ideographs Extension A"](T)||Oe["CJK Unified Ideographs"](T)||Oe["Enclosed CJK Letters and Months"](T)||Oe["Halfwidth and Fullwidth Forms"](T)||Oe.Hiragana(T)||Oe["Ideographic Description Characters"](T)||Oe["Kangxi Radicals"](T)||Oe["Katakana Phonetic Extensions"](T)||Oe.Katakana(T)||Oe["Vertical Forms"](T)||Oe["Yi Radicals"](T)||Oe["Yi Syllables"](T)));(Tf[P]||F||I.imageName)&&f.push(Bu(A+1,w,g,f,Sf(P,i.getCharCode(A+1),F&&x),!1))}}var T;return Fu(Bu(i.length(),w,g,f,0,!0))}function Rc(i){let e=.5,r=.5;switch(i){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(i){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function Ef(i,e,r,s,l){if(!s&&!l)return;const u=i[r],d=(i[r].x+u.metrics.advance*u.scale)*s;for(let f=e;f<=r;f++)i[f].x-=d,i[f].y+=l}function If(i,e,r){const{horizontalAlign:s,verticalAlign:l}=Rc(r),u=e[0]-i.displaySize[0]*s,d=e[1]-i.displaySize[1]*l;return{image:i,top:d,bottom:d+i.displaySize[1],left:u,right:u+i.displaySize[0]}}function Ou(i,e,r,s,l,u){const d=i.image;let f;if(d.content){const O=d.content,G=d.pixelRatio||1;f=[O[0]/G,O[1]/G,d.displaySize[0]-O[2]/G,d.displaySize[1]-O[3]/G]}const g=e.left*u,x=e.right*u;let w,T,A,I;r==="width"||r==="both"?(I=l[0]+g-s[3],T=l[0]+x+s[1]):(I=l[0]+(g+x-d.displaySize[0])/2,T=I+d.displaySize[0]);const P=e.top*u,F=e.bottom*u;return r==="height"||r==="both"?(w=l[1]+P-s[0],A=l[1]+F+s[2]):(w=l[1]+(P+F-d.displaySize[1])/2,A=w+d.displaySize[1]),{image:d,top:w,right:T,bottom:A,left:I,collisionPadding:f}}const rn=128;function Uu(i,e){const{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Vt(i+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:s,interpolationType:l}=r;let u=0;for(;u<s.length&&s[u]<=i;)u++;u=Math.max(0,u-1);let d=u;for(;d<s.length&&s[d]<i+1;)d++;d=Math.min(s.length-1,d);const f=s[u],g=s[d];return r.kind==="composite"?{kind:"composite",minZoom:f,maxZoom:g,interpolationType:l}:{kind:"camera",minZoom:f,maxZoom:g,minSize:r.evaluate(new Vt(f)),maxSize:r.evaluate(new Vt(g)),interpolationType:l}}}class Bn extends it{constructor(e,r,s,l){super(e,r),this.angle=s,l!==void 0&&(this.segment=l)}clone(){return new Bn(this.x,this.y,this.angle,this.segment)}}function Vu(i,e,r,s,l){if(e.segment===void 0)return!0;let u=e,d=e.segment+1,f=0;for(;f>-r/2;){if(d--,d<0)return!1;f-=i[d].dist(u),u=i[d]}f+=i[d].dist(i[d+1]),d++;const g=[];let x=0;for(;f<r/2;){const w=i[d],T=i[d+1];if(!T)return!1;let A=i[d-1].angleTo(w)-w.angleTo(T);for(A=Math.abs((A+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:f,angleDelta:A}),x+=A;f-g[0].distance>s;)x-=g.shift().angleDelta;if(x>l)return!1;d++,f+=w.dist(T)}return!0}function Nu(i){let e=0;for(let r=0;r<i.length-1;r++)e+=i[r].dist(i[r+1]);return e}function $u(i,e,r){return i?.6*e*r:0}function ju(i,e){return Math.max(i?i.right-i.left:0,e?e.right-e.left:0)}function Af(i,e,r,s,l,u){const d=$u(r,l,u),f=ju(r,s)*u;let g=0;const x=Nu(i)/2;for(let w=0;w<i.length-1;w++){const T=i[w],A=i[w+1],I=T.dist(A);if(g+I>x){const P=(x-g)/I,F=qt(T.x,A.x,P),O=qt(T.y,A.y,P),G=new Bn(F,O,A.angleTo(T),w);return G._round(),!d||Vu(i,G,f,d,e)?G:void 0}g+=I}}function Cf(i,e,r,s,l,u,d,f,g){const x=$u(s,u,d),w=ju(s,l),T=w*d,A=i[0].x===0||i[0].x===g||i[0].y===0||i[0].y===g;return e-T<e/4&&(e=T+e/4),Gu(i,A?e/2*f%e:(w/2+2*u)*d*f%e,e,x,r,T,A,!1,g)}function Gu(i,e,r,s,l,u,d,f,g){const x=u/2,w=Nu(i);let T=0,A=e-r,I=[];for(let P=0;P<i.length-1;P++){const F=i[P],O=i[P+1],G=F.dist(O),Y=O.angleTo(F);for(;A+r<T+G;){A+=r;const $=(A-T)/G,J=qt(F.x,O.x,$),pe=qt(F.y,O.y,$);if(J>=0&&J<g&&pe>=0&&pe<g&&A-x>=0&&A+x<=w){const ue=new Bn(J,pe,Y,P);ue._round(),s&&!Vu(i,ue,u,s,l)||I.push(ue)}}T+=G}return f||I.length||d||(I=Gu(i,T/2,r,s,l,u,d,!0,g)),I}function qu(i,e,r,s,l){const u=[];for(let d=0;d<i.length;d++){const f=i[d];let g;for(let x=0;x<f.length-1;x++){let w=f[x],T=f[x+1];w.x<e&&T.x<e||(w.x<e?w=new it(e,w.y+(e-w.x)/(T.x-w.x)*(T.y-w.y))._round():T.x<e&&(T=new it(e,w.y+(e-w.x)/(T.x-w.x)*(T.y-w.y))._round()),w.y<r&&T.y<r||(w.y<r?w=new it(w.x+(r-w.y)/(T.y-w.y)*(T.x-w.x),r)._round():T.y<r&&(T=new it(w.x+(r-w.y)/(T.y-w.y)*(T.x-w.x),r)._round()),w.x>=s&&T.x>=s||(w.x>=s?w=new it(s,w.y+(s-w.x)/(T.x-w.x)*(T.y-w.y))._round():T.x>=s&&(T=new it(s,w.y+(s-w.x)/(T.x-w.x)*(T.y-w.y))._round()),w.y>=l&&T.y>=l||(w.y>=l?w=new it(w.x+(l-w.y)/(T.y-w.y)*(T.x-w.x),l)._round():T.y>=l&&(T=new it(w.x+(l-w.y)/(T.y-w.y)*(T.x-w.x),l)._round()),g&&w.equals(g[g.length-1])||(g=[w],u.push(g)),g.push(T)))))}}return u}function Zu(i,e,r,s){const l=[],u=i.image,d=u.pixelRatio,f=u.paddedRect.w-2,g=u.paddedRect.h-2,x=i.right-i.left,w=i.bottom-i.top,T=u.stretchX||[[0,f]],A=u.stretchY||[[0,g]],I=(ze,Ve)=>ze+Ve[1]-Ve[0],P=T.reduce(I,0),F=A.reduce(I,0),O=f-P,G=g-F;let Y=0,$=P,J=0,pe=F,ue=0,Ne=O,qe=0,Ue=G;if(u.content&&s){const ze=u.content;Y=Il(T,0,ze[0]),J=Il(A,0,ze[1]),$=Il(T,ze[0],ze[2]),pe=Il(A,ze[1],ze[3]),ue=ze[0]-Y,qe=ze[1]-J,Ne=ze[2]-ze[0]-$,Ue=ze[3]-ze[1]-pe}const Re=(ze,Ve,Be,Ee)=>{const Ke=Al(ze.stretch-Y,$,x,i.left),Xe=Cl(ze.fixed-ue,Ne,ze.stretch,P),ct=Al(Ve.stretch-J,pe,w,i.top),Gt=Cl(Ve.fixed-qe,Ue,Ve.stretch,F),Zt=Al(Be.stretch-Y,$,x,i.left),oi=Cl(Be.fixed-ue,Ne,Be.stretch,P),mr=Al(Ee.stretch-J,pe,w,i.top),fi=Cl(Ee.fixed-qe,Ue,Ee.stretch,F),ri=new it(Ke,ct),hi=new it(Zt,ct),gi=new it(Zt,mr),Ci=new it(Ke,mr),Gi=new it(Xe/d,Gt/d),ni=new it(oi/d,fi/d),_i=e*Math.PI/180;if(_i){const qi=Math.sin(_i),Zi=Math.cos(_i),Kt=[Zi,-qi,qi,Zi];ri._matMult(Kt),hi._matMult(Kt),Ci._matMult(Kt),gi._matMult(Kt)}const Mi=ze.stretch+ze.fixed,Bi=Ve.stretch+Ve.fixed;return{tl:ri,tr:hi,bl:Ci,br:gi,tex:{x:u.paddedRect.x+1+Mi,y:u.paddedRect.y+1+Bi,w:Be.stretch+Be.fixed-Mi,h:Ee.stretch+Ee.fixed-Bi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Gi,pixelOffsetBR:ni,minFontScaleX:Ne/d/x,minFontScaleY:Ue/d/w,isSDF:r}};if(s&&(u.stretchX||u.stretchY)){const ze=Xu(T,O,P),Ve=Xu(A,G,F);for(let Be=0;Be<ze.length-1;Be++){const Ee=ze[Be],Ke=ze[Be+1];for(let Xe=0;Xe<Ve.length-1;Xe++)l.push(Re(Ee,Ve[Xe],Ke,Ve[Xe+1]))}}else l.push(Re({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:f+1},{fixed:0,stretch:g+1}));return l}function Il(i,e,r){let s=0;for(const l of i)s+=Math.max(e,Math.min(r,l[1]))-Math.max(e,Math.min(r,l[0]));return s}function Xu(i,e,r){const s=[{fixed:-1,stretch:0}];for(const[l,u]of i){const d=s[s.length-1];s.push({fixed:l-d.stretch,stretch:d.stretch}),s.push({fixed:l-d.stretch,stretch:d.stretch+(u-l)})}return s.push({fixed:e+1,stretch:r}),s}function Al(i,e,r,s){return i/e*r+s}function Cl(i,e,r,s){return i-e*r/s}$e("Anchor",Bn);class Ml{constructor(e,r,s,l,u,d,f,g,x,w){if(this.boxStartIndex=e.length,x){let T=d.top,A=d.bottom;const I=d.collisionPadding;I&&(T-=I[1],A+=I[3]);let P=A-T;P>0&&(P=Math.max(10,P),this.circleDiameter=P)}else{let T=d.top*f-g[0],A=d.bottom*f+g[2],I=d.left*f-g[3],P=d.right*f+g[1];const F=d.collisionPadding;if(F&&(I-=F[0]*f,T-=F[1]*f,P+=F[2]*f,A+=F[3]*f),w){const O=new it(I,T),G=new it(P,T),Y=new it(I,A),$=new it(P,A),J=w*Math.PI/180;O._rotate(J),G._rotate(J),Y._rotate(J),$._rotate(J),I=Math.min(O.x,G.x,Y.x,$.x),P=Math.max(O.x,G.x,Y.x,$.x),T=Math.min(O.y,G.y,Y.y,$.y),A=Math.max(O.y,G.y,Y.y,$.y)}e.emplaceBack(r.x,r.y,I,T,P,A,s,l,u)}this.boxEndIndex=e.length}}class Mf{constructor(e=[],r=Pf){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:s}=this,l=r[e];for(;e>0;){const u=e-1>>1,d=r[u];if(s(l,d)>=0)break;r[e]=d,e=u}r[e]=l}_down(e){const{data:r,compare:s}=this,l=this.length>>1,u=r[e];for(;e<l;){let d=1+(e<<1),f=r[d];const g=d+1;if(g<this.length&&s(r[g],f)<0&&(d=g,f=r[g]),s(f,u)>=0)break;r[e]=f,e=d}r[e]=u}}function Pf(i,e){return i<e?-1:i>e?1:0}function kf(i,e=1,r=!1){let s=1/0,l=1/0,u=-1/0,d=-1/0;const f=i[0];for(let I=0;I<f.length;I++){const P=f[I];(!I||P.x<s)&&(s=P.x),(!I||P.y<l)&&(l=P.y),(!I||P.x>u)&&(u=P.x),(!I||P.y>d)&&(d=P.y)}const g=Math.min(u-s,d-l);let x=g/2;const w=new Mf([],zf);if(g===0)return new it(s,l);for(let I=s;I<u;I+=g)for(let P=l;P<d;P+=g)w.push(new na(I+x,P+x,x,i));let T=function(I){let P=0,F=0,O=0;const G=I[0];for(let Y=0,$=G.length,J=$-1;Y<$;J=Y++){const pe=G[Y],ue=G[J],Ne=pe.x*ue.y-ue.x*pe.y;F+=(pe.x+ue.x)*Ne,O+=(pe.y+ue.y)*Ne,P+=3*Ne}return new na(F/P,O/P,0,I)}(i),A=w.length;for(;w.length;){const I=w.pop();(I.d>T.d||!T.d)&&(T=I,r&&console.log("found best %d after %d probes",Math.round(1e4*I.d)/1e4,A)),I.max-T.d<=e||(x=I.h/2,w.push(new na(I.p.x-x,I.p.y-x,x,i)),w.push(new na(I.p.x+x,I.p.y-x,x,i)),w.push(new na(I.p.x-x,I.p.y+x,x,i)),w.push(new na(I.p.x+x,I.p.y+x,x,i)),A+=4)}return r&&(console.log(`num probes: ${A}`),console.log(`best distance: ${T.d}`)),T.p}function zf(i,e){return e.max-i.max}function na(i,e,r,s){this.p=new it(i,e),this.h=r,this.d=function(l,u){let d=!1,f=1/0;for(let g=0;g<u.length;g++){const x=u[g];for(let w=0,T=x.length,A=T-1;w<T;A=w++){const I=x[w],P=x[A];I.y>l.y!=P.y>l.y&&l.x<(P.x-I.x)*(l.y-I.y)/(P.y-I.y)+I.x&&(d=!d),f=Math.min(f,iu(l,I,P))}}return(d?1:-1)*Math.sqrt(f)}(this.p,s),this.max=this.d+this.h*Math.SQRT2}const Bc=Number.POSITIVE_INFINITY;function Wu(i,e){return e[1]!==Bc?function(r,s,l){let u=0,d=0;switch(s=Math.abs(s),l=Math.abs(l),r){case"top-right":case"top-left":case"top":d=l-7;break;case"bottom-right":case"bottom-left":case"bottom":d=7-l}switch(r){case"top-right":case"bottom-right":case"right":u=-s;break;case"top-left":case"bottom-left":case"left":u=s}return[u,d]}(i,e[0],e[1]):function(r,s){let l=0,u=0;s<0&&(s=0);const d=s/Math.sqrt(2);switch(r){case"top-right":case"top-left":u=d-7;break;case"bottom-right":case"bottom-left":u=7-d;break;case"bottom":u=7-s;break;case"top":u=s-7}switch(r){case"top-right":case"bottom-right":l=-d;break;case"top-left":case"bottom-left":l=d;break;case"left":l=s;break;case"right":l=-s}return[l,u]}(i,e[0])}function Fc(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 Lf(i,e,r,s,l,u,d,f,g,x,w){let T=u.textMaxSize.evaluate(e,{});T===void 0&&(T=d);const A=i.layers[0].layout,I=A.get("icon-offset").evaluate(e,{},w),P=Ku(r.horizontal),F=d/24,O=i.tilePixelRatio*F,G=i.tilePixelRatio*T/24,Y=i.tilePixelRatio*f,$=i.tilePixelRatio*A.get("symbol-spacing"),J=A.get("text-padding")*i.tilePixelRatio,pe=function(Ee,Ke,Xe,ct=1){const Gt=Ee.get("icon-padding").evaluate(Ke,{},Xe),Zt=Gt&&Gt.values;return[Zt[0]*ct,Zt[1]*ct,Zt[2]*ct,Zt[3]*ct]}(A,e,w,i.tilePixelRatio),ue=A.get("text-max-angle")/180*Math.PI,Ne=A.get("text-rotation-alignment")!=="viewport"&&A.get("symbol-placement")!=="point",qe=A.get("icon-rotation-alignment")==="map"&&A.get("symbol-placement")!=="point",Ue=A.get("symbol-placement"),Re=$/2,ze=A.get("icon-text-fit");let Ve;s&&ze!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Ve=Ou(s,r.vertical,ze,A.get("icon-text-fit-padding"),I,F)),P&&(s=Ou(s,P,ze,A.get("icon-text-fit-padding"),I,F)));const Be=(Ee,Ke)=>{Ke.x<0||Ke.x>=ai||Ke.y<0||Ke.y>=ai||function(Xe,ct,Gt,Zt,oi,mr,fi,ri,hi,gi,Ci,Gi,ni,_i,Mi,Bi,qi,Zi,Kt,yi,ht,rr,xi,Pi,vr){const Mr=Xe.addToLineVertexArray(ct,Gt);let Pr,nn,br,fr,Xi=0,sn=0,fo=0,mp=0,Kc=-1,Jc=-1;const an={};let fp=Ai(""),Yc=0,Qc=0;if(ri._unevaluatedLayout.getValue("text-radial-offset")===void 0?[Yc,Qc]=ri.layout.get("text-offset").evaluate(ht,{},Pi).map(Wi=>Wi*pi):(Yc=ri.layout.get("text-radial-offset").evaluate(ht,{},Pi)*pi,Qc=Bc),Xe.allowVerticalPlacement&&Zt.vertical){const Wi=ri.layout.get("text-rotate").evaluate(ht,{},Pi)+90;br=new Ml(hi,ct,gi,Ci,Gi,Zt.vertical,ni,_i,Mi,Wi),fi&&(fr=new Ml(hi,ct,gi,Ci,Gi,fi,qi,Zi,Mi,Wi))}if(oi){const Wi=ri.layout.get("icon-rotate").evaluate(ht,{}),Gr=ri.layout.get("icon-text-fit")!=="none",go=Zu(oi,Wi,xi,Gr),_o=fi?Zu(fi,Wi,xi,Gr):void 0;nn=new Ml(hi,ct,gi,Ci,Gi,oi,qi,Zi,!1,Wi),Xi=4*go.length;const yp=Xe.iconSizeData;let vs=null;yp.kind==="source"?(vs=[rn*ri.layout.get("icon-size").evaluate(ht,{})],vs[0]>Fn&&Yt(`${Xe.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):yp.kind==="composite"&&(vs=[rn*rr.compositeIconSizes[0].evaluate(ht,{},Pi),rn*rr.compositeIconSizes[1].evaluate(ht,{},Pi)],(vs[0]>Fn||vs[1]>Fn)&&Yt(`${Xe.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),Xe.addSymbols(Xe.icon,go,vs,yi,Kt,ht,c.WritingMode.none,ct,Mr.lineStartIndex,Mr.lineLength,-1,Pi),Kc=Xe.icon.placedSymbolArray.length-1,_o&&(sn=4*_o.length,Xe.addSymbols(Xe.icon,_o,vs,yi,Kt,ht,c.WritingMode.vertical,ct,Mr.lineStartIndex,Mr.lineLength,-1,Pi),Jc=Xe.icon.placedSymbolArray.length-1)}const gp=Object.keys(Zt.horizontal);for(const Wi of gp){const Gr=Zt.horizontal[Wi];if(!Pr){fp=Ai(Gr.text);const _o=ri.layout.get("text-rotate").evaluate(ht,{},Pi);Pr=new Ml(hi,ct,gi,Ci,Gi,Gr,ni,_i,Mi,_o)}const go=Gr.positionedLines.length===1;if(fo+=Hu(Xe,ct,Gr,mr,ri,Mi,ht,Bi,Mr,Zt.vertical?c.WritingMode.horizontal:c.WritingMode.horizontalOnly,go?gp:[Wi],an,Kc,rr,Pi),go)break}Zt.vertical&&(mp+=Hu(Xe,ct,Zt.vertical,mr,ri,Mi,ht,Bi,Mr,c.WritingMode.vertical,["vertical"],an,Jc,rr,Pi));const Wf=Pr?Pr.boxStartIndex:Xe.collisionBoxArray.length,Hf=Pr?Pr.boxEndIndex:Xe.collisionBoxArray.length,Kf=br?br.boxStartIndex:Xe.collisionBoxArray.length,Jf=br?br.boxEndIndex:Xe.collisionBoxArray.length,Yf=nn?nn.boxStartIndex:Xe.collisionBoxArray.length,Qf=nn?nn.boxEndIndex:Xe.collisionBoxArray.length,eg=fr?fr.boxStartIndex:Xe.collisionBoxArray.length,tg=fr?fr.boxEndIndex:Xe.collisionBoxArray.length;let kr=-1;const Dl=(Wi,Gr)=>Wi&&Wi.circleDiameter?Math.max(Wi.circleDiameter,Gr):Gr;kr=Dl(Pr,kr),kr=Dl(br,kr),kr=Dl(nn,kr),kr=Dl(fr,kr);const _p=kr>-1?1:0;_p&&(kr*=vr/pi),Xe.glyphOffsetArray.length>=sa.MAX_GLYPHS&&Yt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),ht.sortKey!==void 0&&Xe.addToSortKeyRanges(Xe.symbolInstances.length,ht.sortKey),Xe.symbolInstances.emplaceBack(ct.x,ct.y,an.right>=0?an.right:-1,an.center>=0?an.center:-1,an.left>=0?an.left:-1,an.vertical||-1,Kc,Jc,fp,Wf,Hf,Kf,Jf,Yf,Qf,eg,tg,gi,fo,mp,Xi,sn,_p,0,ni,Yc,Qc,kr)}(i,Ke,Ee,r,s,l,Ve,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,O,[J,J,J,J],Ne,g,Y,pe,qe,I,e,u,x,w,d)};if(Ue==="line")for(const Ee of qu(e.geometry,0,0,ai,ai)){const Ke=Cf(Ee,$,ue,r.vertical||P,s,24,G,i.overscaling,ai);for(const Xe of Ke)P&&Df(i,P.text,Re,Xe)||Be(Ee,Xe)}else if(Ue==="line-center"){for(const Ee of e.geometry)if(Ee.length>1){const Ke=Af(Ee,ue,r.vertical||P,s,24,G);Ke&&Be(Ee,Ke)}}else if(e.type==="Polygon")for(const Ee of Sc(e.geometry,0)){const Ke=kf(Ee,16);Be(Ee[0],new Bn(Ke.x,Ke.y,0))}else if(e.type==="LineString")for(const Ee of e.geometry)Be(Ee,new Bn(Ee[0].x,Ee[0].y,0));else if(e.type==="Point")for(const Ee of e.geometry)for(const Ke of Ee)Be([Ke],new Bn(Ke.x,Ke.y,0))}const Fn=32640;function Hu(i,e,r,s,l,u,d,f,g,x,w,T,A,I,P){const F=function(Y,$,J,pe,ue,Ne,qe,Ue){const Re=pe.layout.get("text-rotate").evaluate(Ne,{})*Math.PI/180,ze=[];for(const Ve of $.positionedLines)for(const Be of Ve.positionedGlyphs){if(!Be.rect)continue;const Ee=Be.rect||{};let Ke=4,Xe=!0,ct=1,Gt=0;const Zt=(ue||Ue)&&Be.vertical,oi=Be.metrics.advance*Be.scale/2;if(Ue&&$.verticalizable&&(Gt=Ve.lineOffset/2-(Be.imageName?-(pi-Be.metrics.width*Be.scale)/2:(Be.scale-1)*pi)),Be.imageName){const Kt=qe[Be.imageName];Xe=Kt.sdf,ct=Kt.pixelRatio,Ke=1/ct}const mr=ue?[Be.x+oi,Be.y]:[0,0];let fi=ue?[0,0]:[Be.x+oi+J[0],Be.y+J[1]-Gt],ri=[0,0];Zt&&(ri=fi,fi=[0,0]);const hi=(Be.metrics.left-Ke)*Be.scale-oi+fi[0],gi=(-Be.metrics.top-Ke)*Be.scale+fi[1],Ci=hi+Ee.w*Be.scale/ct,Gi=gi+Ee.h*Be.scale/ct,ni=new it(hi,gi),_i=new it(Ci,gi),Mi=new it(hi,Gi),Bi=new it(Ci,Gi);if(Zt){const Kt=new it(-oi,oi-Tl),yi=-Math.PI/2,ht=12-oi,rr=new it(22-ht,-(Be.imageName?ht:0)),xi=new it(...ri);ni._rotateAround(yi,Kt)._add(rr)._add(xi),_i._rotateAround(yi,Kt)._add(rr)._add(xi),Mi._rotateAround(yi,Kt)._add(rr)._add(xi),Bi._rotateAround(yi,Kt)._add(rr)._add(xi)}if(Re){const Kt=Math.sin(Re),yi=Math.cos(Re),ht=[yi,-Kt,Kt,yi];ni._matMult(ht),_i._matMult(ht),Mi._matMult(ht),Bi._matMult(ht)}const qi=new it(0,0),Zi=new it(0,0);ze.push({tl:ni,tr:_i,bl:Mi,br:Bi,tex:Ee,writingMode:$.writingMode,glyphOffset:mr,sectionIndex:Be.sectionIndex,isSDF:Xe,pixelOffsetTL:qi,pixelOffsetBR:Zi,minFontScaleX:0,minFontScaleY:0})}return ze}(0,r,f,l,u,d,s,i.allowVerticalPlacement),O=i.textSizeData;let G=null;O.kind==="source"?(G=[rn*l.layout.get("text-size").evaluate(d,{})],G[0]>Fn&&Yt(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):O.kind==="composite"&&(G=[rn*I.compositeTextSizes[0].evaluate(d,{},P),rn*I.compositeTextSizes[1].evaluate(d,{},P)],(G[0]>Fn||G[1]>Fn)&&Yt(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),i.addSymbols(i.text,F,G,f,u,d,x,e,g.lineStartIndex,g.lineLength,A,P);for(const Y of w)T[Y]=i.text.placedSymbolArray.length-1;return 4*F.length}function Ku(i){for(const e in i)return i[e];return null}function Df(i,e,r,s){const l=i.compareText;if(e in l){const u=l[e];for(let d=u.length-1;d>=0;d--)if(s.dist(u[d])<r)return!0}else l[e]=[];return l[e].push(s),!1}const Rf=Dn.VectorTileFeature.types,Bf=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Pl(i,e,r,s,l,u,d,f,g,x,w,T,A){const I=f?Math.min(Fn,Math.round(f[0])):0,P=f?Math.min(Fn,Math.round(f[1])):0;i.emplaceBack(e,r,Math.round(32*s),Math.round(32*l),u,d,(I<<1)+(g?1:0),P,16*x,16*w,256*T,256*A)}function Oc(i,e,r){i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r)}function Ff(i){for(const e of i.sections)if(hc(e.text))return!0;return!1}class Uc{constructor(e){this.layoutVertexArray=new He,this.indexArray=new bt,this.programConfigurations=e,this.segments=new Nt,this.dynamicLayoutVertexArray=new Mt,this.opacityVertexArray=new Tt,this.hasVisibleVertices=!1,this.placedSymbolArray=new X}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,s,l){this.isEmpty()||(s&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,af.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,of.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Bf,!0),this.opacityVertexBuffer.itemSize=1),(s||l)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}$e("SymbolBuffers",Uc);class Vc{constructor(e,r,s){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new s,this.segments=new Nt,this.collisionVertexArray=new yt}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,lf.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}$e("CollisionBuffers",Vc);class sa{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(d=>d.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=_c([]),this.placementViewportMatrix=_c([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Uu(this.zoom,r["text-size"]),this.iconSizeData=Uu(this.zoom,r["icon-size"]);const s=this.layers[0].layout,l=s.get("symbol-sort-key"),u=s.get("symbol-z-order");this.canOverlap=$c(s,"text-overlap","text-allow-overlap")!=="never"||$c(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=u!=="viewport-y"&&!l.isConstant(),this.sortFeaturesByY=(u==="viewport-y"||u==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,s.get("symbol-placement")==="point"&&(this.writingModes=s.get("text-writing-mode").map(d=>c.WritingMode[d])),this.stateDependentLayerIds=this.layers.filter(d=>d.isStateDependent()).map(d=>d.id),this.sourceID=e.sourceID}createArrays(){this.text=new Uc(new gs(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Uc(new gs(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new W,this.lineVertexArray=new te,this.symbolInstances=new U}calculateGlyphDependencies(e,r,s,l,u){for(let d=0;d<e.length;d++)if(r[e.charCodeAt(d)]=!0,(s||l)&&u){const f=co[e.charAt(d)];f&&(r[f.charCodeAt(0)]=!0)}}populate(e,r,s){const l=this.layers[0],u=l.layout,d=u.get("text-font"),f=u.get("text-field"),g=u.get("icon-image"),x=(f.value.kind!=="constant"||f.value.value instanceof De&&!f.value.value.isEmpty()||f.value.value.toString().length>0)&&(d.value.kind!=="constant"||d.value.value.length>0),w=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,T=u.get("symbol-sort-key");if(this.features=[],!x&&!w)return;const A=r.iconDependencies,I=r.glyphDependencies,P=r.availableImages,F=new Vt(this.zoom);for(const{feature:O,id:G,index:Y,sourceLayerIndex:$}of e){const J=l._featureFilter.needGeometry,pe=ys(O,J);if(!l._featureFilter.filter(F,pe,s))continue;let ue,Ne;if(J||(pe.geometry=_s(O)),x){const Ue=l.getValueAndResolveTokens("text-field",pe,s,P),Re=De.factory(Ue);Ff(Re)&&(this.hasRTLText=!0),(!this.hasRTLText||Za()==="unavailable"||this.hasRTLText&&ji.isParsed())&&(ue=hf(Re,l,pe))}if(w){const Ue=l.getValueAndResolveTokens("icon-image",pe,s,P);Ne=Ue instanceof _t?Ue:_t.fromString(Ue)}if(!ue&&!Ne)continue;const qe=this.sortFeaturesByKey?T.evaluate(pe,{},s):void 0;if(this.features.push({id:G,text:ue,icon:Ne,index:Y,sourceLayerIndex:$,geometry:pe.geometry,properties:O.properties,type:Rf[O.type],sortKey:qe}),Ne&&(A[Ne.name]=!0),ue){const Ue=d.evaluate(pe,{},s).join(","),Re=u.get("text-rotation-alignment")!=="viewport"&&u.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(c.WritingMode.vertical)>=0;for(const ze of ue.sections)if(ze.image)A[ze.image.name]=!0;else{const Ve=cs(ue.toString()),Be=ze.fontStack||Ue,Ee=I[Be]=I[Be]||{};this.calculateGlyphDependencies(ze.text,Ee,Re,this.allowVerticalPlacement,Ve)}}}u.get("symbol-placement")==="line"&&(this.features=function(O){const G={},Y={},$=[];let J=0;function pe(Ue){$.push(O[Ue]),J++}function ue(Ue,Re,ze){const Ve=Y[Ue];return delete Y[Ue],Y[Re]=Ve,$[Ve].geometry[0].pop(),$[Ve].geometry[0]=$[Ve].geometry[0].concat(ze[0]),Ve}function Ne(Ue,Re,ze){const Ve=G[Re];return delete G[Re],G[Ue]=Ve,$[Ve].geometry[0].shift(),$[Ve].geometry[0]=ze[0].concat($[Ve].geometry[0]),Ve}function qe(Ue,Re,ze){const Ve=ze?Re[0][Re[0].length-1]:Re[0][0];return`${Ue}:${Ve.x}:${Ve.y}`}for(let Ue=0;Ue<O.length;Ue++){const Re=O[Ue],ze=Re.geometry,Ve=Re.text?Re.text.toString():null;if(!Ve){pe(Ue);continue}const Be=qe(Ve,ze),Ee=qe(Ve,ze,!0);if(Be in Y&&Ee in G&&Y[Be]!==G[Ee]){const Ke=Ne(Be,Ee,ze),Xe=ue(Be,Ee,$[Ke].geometry);delete G[Be],delete Y[Ee],Y[qe(Ve,$[Xe].geometry,!0)]=Xe,$[Ke].geometry=null}else Be in Y?ue(Be,Ee,ze):Ee in G?Ne(Be,Ee,ze):(pe(Ue),G[Be]=J-1,Y[Ee]=J-1)}return $.filter(Ue=>Ue.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((O,G)=>O.sortKey-G.sortKey)}update(e,r,s){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,s),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,s))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,r){const s=this.lineVertexArray.length;if(e.segment!==void 0){let l=e.dist(r[e.segment+1]),u=e.dist(r[e.segment]);const d={};for(let f=e.segment+1;f<r.length;f++)d[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:l},f<r.length-1&&(l+=r[f+1].dist(r[f]));for(let f=e.segment||0;f>=0;f--)d[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:u},f>0&&(u+=r[f-1].dist(r[f]));for(let f=0;f<r.length;f++){const g=d[f];this.lineVertexArray.emplaceBack(g.x,g.y,g.tileUnitDistanceFromAnchor)}}return{lineStartIndex:s,lineLength:this.lineVertexArray.length-s}}addSymbols(e,r,s,l,u,d,f,g,x,w,T,A){const I=e.indexArray,P=e.layoutVertexArray,F=e.segments.prepareSegment(4*r.length,P,I,this.canOverlap?d.sortKey:void 0),O=this.glyphOffsetArray.length,G=F.vertexLength,Y=this.allowVerticalPlacement&&f===c.WritingMode.vertical?Math.PI/2:0,$=d.text&&d.text.sections;for(let J=0;J<r.length;J++){const{tl:pe,tr:ue,bl:Ne,br:qe,tex:Ue,pixelOffsetTL:Re,pixelOffsetBR:ze,minFontScaleX:Ve,minFontScaleY:Be,glyphOffset:Ee,isSDF:Ke,sectionIndex:Xe}=r[J],ct=F.vertexLength,Gt=Ee[1];Pl(P,g.x,g.y,pe.x,Gt+pe.y,Ue.x,Ue.y,s,Ke,Re.x,Re.y,Ve,Be),Pl(P,g.x,g.y,ue.x,Gt+ue.y,Ue.x+Ue.w,Ue.y,s,Ke,ze.x,Re.y,Ve,Be),Pl(P,g.x,g.y,Ne.x,Gt+Ne.y,Ue.x,Ue.y+Ue.h,s,Ke,Re.x,ze.y,Ve,Be),Pl(P,g.x,g.y,qe.x,Gt+qe.y,Ue.x+Ue.w,Ue.y+Ue.h,s,Ke,ze.x,ze.y,Ve,Be),Oc(e.dynamicLayoutVertexArray,g,Y),I.emplaceBack(ct,ct+1,ct+2),I.emplaceBack(ct+1,ct+2,ct+3),F.vertexLength+=4,F.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Ee[0]),J!==r.length-1&&Xe===r[J+1].sectionIndex||e.programConfigurations.populatePaintArrays(P.length,d,d.index,{},A,$&&$[Xe])}e.placedSymbolArray.emplaceBack(g.x,g.y,O,this.glyphOffsetArray.length-O,G,x,w,g.segment,s?s[0]:0,s?s[1]:0,l[0],l[1],f,0,!1,0,T)}_addCollisionDebugVertex(e,r,s,l,u,d){return r.emplaceBack(0,0),e.emplaceBack(s.x,s.y,l,u,Math.round(d.x),Math.round(d.y))}addCollisionDebugVertices(e,r,s,l,u,d,f){const g=u.segments.prepareSegment(4,u.layoutVertexArray,u.indexArray),x=g.vertexLength,w=u.layoutVertexArray,T=u.collisionVertexArray,A=f.anchorX,I=f.anchorY;this._addCollisionDebugVertex(w,T,d,A,I,new it(e,r)),this._addCollisionDebugVertex(w,T,d,A,I,new it(s,r)),this._addCollisionDebugVertex(w,T,d,A,I,new it(s,l)),this._addCollisionDebugVertex(w,T,d,A,I,new it(e,l)),g.vertexLength+=4;const P=u.indexArray;P.emplaceBack(x,x+1),P.emplaceBack(x+1,x+2),P.emplaceBack(x+2,x+3),P.emplaceBack(x+3,x),g.primitiveLength+=4}addDebugCollisionBoxes(e,r,s,l){for(let u=e;u<r;u++){const d=this.collisionBoxArray.get(u);this.addCollisionDebugVertices(d.x1,d.y1,d.x2,d.y2,l?this.textCollisionBox:this.iconCollisionBox,d.anchorPoint,s)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Vc(mt,Eu.members,Ei),this.iconCollisionBox=new Vc(mt,Eu.members,Ei);for(let e=0;e<this.symbolInstances.length;e++){const r=this.symbolInstances.get(e);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(e,r,s,l,u,d,f,g,x){const w={};for(let T=r;T<s;T++){const A=e.get(T);w.textBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},w.textFeatureIndex=A.featureIndex;break}for(let T=l;T<u;T++){const A=e.get(T);w.verticalTextBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},w.verticalTextFeatureIndex=A.featureIndex;break}for(let T=d;T<f;T++){const A=e.get(T);w.iconBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},w.iconFeatureIndex=A.featureIndex;break}for(let T=g;T<x;T++){const A=e.get(T);w.verticalIconBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},w.verticalIconFeatureIndex=A.featureIndex;break}return w}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const s=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,s.textBoxStartIndex,s.textBoxEndIndex,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s.iconBoxStartIndex,s.iconBoxEndIndex,s.verticalIconBoxStartIndex,s.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,r){const s=e.placedSymbolArray.get(r),l=s.vertexStartIndex+4*s.numGlyphs;for(let u=s.vertexStartIndex;u<l;u+=4)e.indexArray.emplaceBack(u,u+1,u+2),e.indexArray.emplaceBack(u+1,u+2,u+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(e),s=Math.cos(e),l=[],u=[],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+s*g.anchorY)),u.push(g.featureIndex)}return d.sort((f,g)=>l[f]-l[g]||u[g]-u[f]),d}addToSortKeyRanges(e,r){const s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===r?s.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const s=this.symbolInstances.get(r);this.featureSortOrder.push(s.featureIndex),[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex].forEach((l,u,d)=>{l>=0&&d.indexOf(l)===u&&this.addIndicesForPlacedSymbol(this.text,l)}),s.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,s.verticalPlacedTextSymbolIndex),s.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.placedIconSymbolIndex),s.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}$e("SymbolBucket",sa,{omit:["layers","collisionBoxArray","features","compareText"]}),sa.MAX_GLYPHS=65535,sa.addDynamicAttributes=Oc;const Of=new Si({"symbol-placement":new We(V.layout_symbol["symbol-placement"]),"symbol-spacing":new We(V.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new We(V.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Qe(V.layout_symbol["symbol-sort-key"]),"symbol-z-order":new We(V.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new We(V.layout_symbol["icon-allow-overlap"]),"icon-overlap":new We(V.layout_symbol["icon-overlap"]),"icon-ignore-placement":new We(V.layout_symbol["icon-ignore-placement"]),"icon-optional":new We(V.layout_symbol["icon-optional"]),"icon-rotation-alignment":new We(V.layout_symbol["icon-rotation-alignment"]),"icon-size":new Qe(V.layout_symbol["icon-size"]),"icon-text-fit":new We(V.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new We(V.layout_symbol["icon-text-fit-padding"]),"icon-image":new Qe(V.layout_symbol["icon-image"]),"icon-rotate":new Qe(V.layout_symbol["icon-rotate"]),"icon-padding":new Qe(V.layout_symbol["icon-padding"]),"icon-keep-upright":new We(V.layout_symbol["icon-keep-upright"]),"icon-offset":new Qe(V.layout_symbol["icon-offset"]),"icon-anchor":new Qe(V.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new We(V.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new We(V.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new We(V.layout_symbol["text-rotation-alignment"]),"text-field":new Qe(V.layout_symbol["text-field"]),"text-font":new Qe(V.layout_symbol["text-font"]),"text-size":new Qe(V.layout_symbol["text-size"]),"text-max-width":new Qe(V.layout_symbol["text-max-width"]),"text-line-height":new We(V.layout_symbol["text-line-height"]),"text-letter-spacing":new Qe(V.layout_symbol["text-letter-spacing"]),"text-justify":new Qe(V.layout_symbol["text-justify"]),"text-radial-offset":new Qe(V.layout_symbol["text-radial-offset"]),"text-variable-anchor":new We(V.layout_symbol["text-variable-anchor"]),"text-anchor":new Qe(V.layout_symbol["text-anchor"]),"text-max-angle":new We(V.layout_symbol["text-max-angle"]),"text-writing-mode":new We(V.layout_symbol["text-writing-mode"]),"text-rotate":new Qe(V.layout_symbol["text-rotate"]),"text-padding":new We(V.layout_symbol["text-padding"]),"text-keep-upright":new We(V.layout_symbol["text-keep-upright"]),"text-transform":new Qe(V.layout_symbol["text-transform"]),"text-offset":new Qe(V.layout_symbol["text-offset"]),"text-allow-overlap":new We(V.layout_symbol["text-allow-overlap"]),"text-overlap":new We(V.layout_symbol["text-overlap"]),"text-ignore-placement":new We(V.layout_symbol["text-ignore-placement"]),"text-optional":new We(V.layout_symbol["text-optional"])});var Nc={paint:new Si({"icon-opacity":new Qe(V.paint_symbol["icon-opacity"]),"icon-color":new Qe(V.paint_symbol["icon-color"]),"icon-halo-color":new Qe(V.paint_symbol["icon-halo-color"]),"icon-halo-width":new Qe(V.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Qe(V.paint_symbol["icon-halo-blur"]),"icon-translate":new We(V.paint_symbol["icon-translate"]),"icon-translate-anchor":new We(V.paint_symbol["icon-translate-anchor"]),"text-opacity":new Qe(V.paint_symbol["text-opacity"]),"text-color":new Qe(V.paint_symbol["text-color"],{runtimeType:vt,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new Qe(V.paint_symbol["text-halo-color"]),"text-halo-width":new Qe(V.paint_symbol["text-halo-width"]),"text-halo-blur":new Qe(V.paint_symbol["text-halo-blur"]),"text-translate":new We(V.paint_symbol["text-translate"]),"text-translate-anchor":new We(V.paint_symbol["text-translate-anchor"])}),layout:Of};class Ju{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:gt,this.defaultValue=e}evaluate(e){if(e.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}$e("FormatSectionOverride",Ju,{omit:["defaultValue"]});class kl extends cr{constructor(e){super(e,Nc)}recalculate(e,r){if(super.recalculate(e,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const s=this.layout.get("text-writing-mode");if(s){const l=[];for(const u of s)l.indexOf(u)<0&&l.push(u);this.layout._values["text-writing-mode"]=l}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,s,l){const u=this.layout.get(e).evaluate(r,{},s,l),d=this._unevaluatedLayout._values[e];return d.isDataDriven()||Qn(d.value)||!u?u:function(f,g){return g.replace(/{([^{}]+)}/g,(x,w)=>w in f?String(f[w]):"")}(r.properties,u)}createBucket(e){return new sa(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of Nc.paint.overridableProperties){if(!kl.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),s=new Ju(r),l=new Vs(s,r.property.specification);let u=null;u=r.value.kind==="constant"||r.value.kind==="source"?new ts("source",l):new La("composite",l,r.value.zoomStops),this.paint._values[e]=new Ti(r.property,u,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,s){return!(!this.layout||r.isDataDriven()||s.isDataDriven())&&kl.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const s=e.get("text-field"),l=Nc.paint.properties[r];let u=!1;const d=f=>{for(const g of f)if(l.overrides&&l.overrides.hasOverride(g))return void(u=!0)};if(s.value.kind==="constant"&&s.value.value instanceof De)d(s.value.value.sections);else if(s.value.kind==="source"){const f=x=>{u||(x instanceof li&&ut(x.value)===Xt?d(x.value.sections):x instanceof Os?d(x.sections):x.eachChild(f))},g=s.value;g._styleExpression&&f(g._styleExpression.expression)}return u}}function $c(i,e,r){let s="never";const l=i.get(e);return l?s=l:i.get(r)&&(s="always"),s}var Uf={paint:new Si({"background-color":new We(V.paint_background["background-color"]),"background-pattern":new Wa(V.paint_background["background-pattern"]),"background-opacity":new We(V.paint_background["background-opacity"])})},Vf={paint:new Si({"raster-opacity":new We(V.paint_raster["raster-opacity"]),"raster-hue-rotate":new We(V.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new We(V.paint_raster["raster-brightness-min"]),"raster-brightness-max":new We(V.paint_raster["raster-brightness-max"]),"raster-saturation":new We(V.paint_raster["raster-saturation"]),"raster-contrast":new We(V.paint_raster["raster-contrast"]),"raster-resampling":new We(V.paint_raster["raster-resampling"]),"raster-fade-duration":new We(V.paint_raster["raster-fade-duration"])})};class Nf extends cr{constructor(e){super(e,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}const $f={circle:class extends cr{constructor(i){super(i,xm)}createBucket(i){return new mc(i)}queryRadius(i){const e=i;return eo("circle-radius",this,e)+eo("circle-stroke-width",this,e)+fl(this.paint.get("circle-translate"))}queryIntersectsFeature(i,e,r,s,l,u,d,f){const g=gl(i,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),u.angle,d),x=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),w=this.paint.get("circle-pitch-alignment")==="map",T=w?g:function(I,P){return I.map(F=>cu(F,P))}(g,f),A=w?x*d:x;for(const I of s)for(const P of I){const F=w?P:cu(P,f);let O=A;const G=_l([],[P.x,P.y,0,1],f);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?O*=G[3]/u.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(O*=u.cameraToCenterDistance/G[3]),mm(T,F,O))return!0}return!1}},heatmap:class extends cr{createBucket(i){return new hu(i)}constructor(i){super(i,bm),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=pu({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}},hillshade:class extends cr{constructor(i){super(i,wm)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends cr{constructor(i){super(i,Fm)}recalculate(i,e){super.recalculate(i,e);const r=this.paint._values["fill-outline-color"];r.value.kind==="constant"&&r.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new Ac(i)}queryRadius(){return fl(this.paint.get("fill-translate"))}queryIntersectsFeature(i,e,r,s,l,u,d){return tu(gl(i,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),u.angle,d),s)}isTileClipped(){return!0}},"fill-extrusion":class extends cr{constructor(i){super(i,Jm)}createBucket(i){return new Mc(i)}queryRadius(){return fl(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,e,r,s,l,u,d,f){const g=gl(i,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),u.angle,d),x=this.paint.get("fill-extrusion-height").evaluate(e,r),w=this.paint.get("fill-extrusion-base").evaluate(e,r),T=function(I,P,F,O){const G=[];for(const Y of I){const $=[Y.x,Y.y,0,1];_l($,$,P),G.push(new it($[0]/$[3],$[1]/$[3]))}return G}(g,f),A=function(I,P,F,O){const G=[],Y=[],$=O[8]*P,J=O[9]*P,pe=O[10]*P,ue=O[11]*P,Ne=O[8]*F,qe=O[9]*F,Ue=O[10]*F,Re=O[11]*F;for(const ze of I){const Ve=[],Be=[];for(const Ee of ze){const Ke=Ee.x,Xe=Ee.y,ct=O[0]*Ke+O[4]*Xe+O[12],Gt=O[1]*Ke+O[5]*Xe+O[13],Zt=O[2]*Ke+O[6]*Xe+O[14],oi=O[3]*Ke+O[7]*Xe+O[15],mr=Zt+pe,fi=oi+ue,ri=ct+Ne,hi=Gt+qe,gi=Zt+Ue,Ci=oi+Re,Gi=new it((ct+$)/fi,(Gt+J)/fi);Gi.z=mr/fi,Ve.push(Gi);const ni=new it(ri/Ci,hi/Ci);ni.z=gi/Ci,Be.push(ni)}G.push(Ve),Y.push(Be)}return[G,Y]}(s,w,x,f);return function(I,P,F){let O=1/0;tu(F,P)&&(O=vu(F,P[0]));for(let G=0;G<P.length;G++){const Y=P[G],$=I[G];for(let J=0;J<Y.length-1;J++){const pe=Y[J],ue=[pe,Y[J+1],$[J+1],$[J],pe];eu(F,ue)&&(O=Math.min(O,vu(F,ue)))}}return O!==1/0&&O}(A[0],A[1],T)}},line:class extends cr{constructor(i){super(i,wu),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(i){i==="line-gradient"&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof yn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(i,e){super.recalculate(i,e),this.paint._values["line-floorwidth"]=Tu.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new Pc(i)}queryRadius(i){const e=i,r=Su(eo("line-width",this,e),eo("line-gap-width",this,e)),s=eo("line-offset",this,e);return r/2+Math.abs(s)+fl(this.paint.get("line-translate"))}queryIntersectsFeature(i,e,r,s,l,u,d){const f=gl(i,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),u.angle,d),g=d/2*Su(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),x=this.paint.get("line-offset").evaluate(e,r);return x&&(s=function(w,T){const A=[];for(let I=0;I<w.length;I++){const P=w[I],F=[];for(let O=0;O<P.length;O++){const G=P[O-1],Y=P[O],$=P[O+1],J=O===0?new it(0,0):Y.sub(G)._unit()._perp(),pe=O===P.length-1?new it(0,0):$.sub(Y)._unit()._perp(),ue=J._add(pe)._unit(),Ne=ue.x*pe.x+ue.y*pe.y;Ne!==0&&ue._mult(1/Ne),F.push(ue._mult(T)._add(Y))}A.push(F)}return A}(s,x*d)),function(w,T,A){for(let I=0;I<T.length;I++){const P=T[I];if(w.length>=3){for(let F=0;F<P.length;F++)if(Ys(w,P[F]))return!0}if(fm(w,P,A))return!0}return!1}(f,s,g)}isTileClipped(){return!0}},symbol:kl,background:class extends cr{constructor(i){super(i,Uf)}},raster:class extends cr{constructor(i){super(i,Vf)}}};class jf{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const jc=63710088e-1;class Ht{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Ht(K(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const r=Math.PI/180,s=this.lat*r,l=e.lat*r,u=Math.sin(s)*Math.sin(l)+Math.cos(s)*Math.cos(l)*Math.cos((e.lng-this.lng)*r);return jc*Math.acos(Math.min(u,1))}toBounds(e=0){const r=360*e/40075017,s=r/Math.cos(Math.PI/180*this.lat);return new Yu(new Ht(this.lng-s,this.lat-r),new Ht(this.lng+s,this.lat+r))}static convert(e){if(e instanceof Ht)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Ht(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Ht(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class aa{constructor(e,r){e&&(r?this.setSouthWest(e).setNorthEast(r):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 Ht?new Ht(e.lng,e.lat):Ht.convert(e),this}setSouthWest(e){return this._sw=e instanceof Ht?new Ht(e.lng,e.lat):Ht.convert(e),this}extend(e){const r=this._sw,s=this._ne;let l,u;if(e instanceof Ht)l=e,u=e;else{if(!(e instanceof aa))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(aa.convert(e)):this.extend(Ht.convert(e)):this;if(l=e._sw,u=e._ne,!l||!u)return this}return r||s?(r.lng=Math.min(l.lng,r.lng),r.lat=Math.min(l.lat,r.lat),s.lng=Math.max(u.lng,s.lng),s.lat=Math.max(u.lat,s.lat)):(this._sw=new Ht(l.lng,l.lat),this._ne=new Ht(u.lng,u.lat)),this}getCenter(){return new Ht((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 Ht(this.getWest(),this.getNorth())}getSouthEast(){return new Ht(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:r,lat:s}=Ht.convert(e);let l=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(l=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=s&&s<=this._ne.lat&&l}static convert(e){return e instanceof aa?e:e&&new aa(e)}}var Yu=aa;const Qu=2*Math.PI*jc;function ep(i){return Qu*Math.cos(i*Math.PI/180)}function tp(i){return(180+i)/360}function ip(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function rp(i,e){return i/ep(e)}function Gc(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class zl{constructor(e,r,s=0){this.x=+e,this.y=+r,this.z=+s}static fromLngLat(e,r=0){const s=Ht.convert(e);return new zl(tp(s.lng),ip(s.lat),rp(r,s.lat))}toLngLat(){return new Ht(360*this.x-180,Gc(this.y))}toAltitude(){return this.z*ep(Gc(this.y))}meterInMercatorCoordinateUnits(){return 1/Qu*(e=Gc(this.y),1/Math.cos(e*Math.PI/180));var e}}var np={};(function(i,e){(function(r){function s(u,d,f){var g=l(256*u,256*(d=Math.pow(2,f)-d-1),f),x=l(256*(u+1),256*(d+1),f);return g[0]+","+g[1]+","+x[0]+","+x[1]}function l(u,d,f){var g=2*Math.PI*6378137/256/Math.pow(2,f);return[u*g-2*Math.PI*6378137/2,d*g-2*Math.PI*6378137/2]}r.getURL=function(u,d,f,g,x,w){return w=w||{},u+"?"+["bbox="+s(f,g,x),"format="+(w.format||"image/png"),"service="+(w.service||"WMS"),"version="+(w.version||"1.1.1"),"request="+(w.request||"GetMap"),"srs="+(w.srs||"EPSG:3857"),"width="+(w.width||256),"height="+(w.height||256),"layers="+d].join("&")},r.getTileBBox=s,r.getMercCoords=l,Object.defineProperty(r,"__esModule",{value:!0})})(e)})(0,np);class qc{constructor(e,r,s){if(e<0||e>25||s<0||s>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error(`x=${r}, y=${s}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=r,this.y=s,this.key=uo(0,e,e,r,s)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,s){const l=np.getTileBBox(this.x,this.y,this.z),u=function(d,f,g){let x,w="";for(let T=d;T>0;T--)x=1<<T-1,w+=(f&x?1:0)+(g&x?2:0);return w}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(s==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,u).replace(/{bbox-epsg-3857}/g,l)}isChildOf(e){const r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){const r=Math.pow(2,this.z);return new it((e.x*r-this.x)*ai,(e.y*r-this.y)*ai)}toString(){return`${this.z}/${this.x}/${this.y}`}}class sp{constructor(e,r){this.wrap=e,this.canonical=r,this.key=uo(e,r.z,r.z,r.x,r.y)}}class dr{constructor(e,r,s,l,u){if(e<s)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${s}`);this.overscaledZ=e,this.wrap=r,this.canonical=new qc(s,+l,+u),this.key=uo(r,e,s,l,u)}clone(){return new dr(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-e;return e>this.canonical.z?new dr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new dr(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const s=this.canonical.z-e;return e>this.canonical.z?uo(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):uo(this.wrap*+r,e,e,this.canonical.x>>s,this.canonical.y>>s)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new dr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,s=2*this.canonical.x,l=2*this.canonical.y;return[new dr(r,this.wrap,r,s,l),new dr(r,this.wrap,r,s+1,l),new dr(r,this.wrap,r,s,l+1),new dr(r,this.wrap,r,s+1,l+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new dr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new dr(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new sp(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new zl(e.x-this.wrap,e.y))}}function uo(i,e,r,s,l){(i*=2)<0&&(i=-1*i-1);const u=1<<r;return(u*u*i+u*l+s).toString(36)+r.toString(36)+e.toString(36)}$e("CanonicalTileID",qc),$e("OverscaledTileID",dr,{omit:["posMatrix"]});class ap{constructor(e,r,s){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(s&&s!=="mapbox"&&s!=="terrarium")return void Yt(`"${s}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=r.height;const l=this.dim=r.height-2;this.data=new Uint32Array(r.data.buffer),this.encoding=s||"mapbox";for(let u=0;u<l;u++)this.data[this._idx(-1,u)]=this.data[this._idx(0,u)],this.data[this._idx(l,u)]=this.data[this._idx(l-1,u)],this.data[this._idx(u,-1)]=this.data[this._idx(u,0)],this.data[this._idx(u,l)]=this.data[this._idx(u,l-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(l,-1)]=this.data[this._idx(l-1,0)],this.data[this._idx(-1,l)]=this.data[this._idx(0,l-1)],this.data[this._idx(l,l)]=this.data[this._idx(l-1,l-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let u=0;u<l;u++)for(let d=0;d<l;d++){const f=this.get(u,d);f>this.max&&(this.max=f),f<this.min&&(this.min=f)}}get(e,r){const s=new Uint8Array(this.data.buffer),l=4*this._idx(e,r);return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(s[l],s[l+1],s[l+2])}getUnpackVector(){return this.encoding==="terrarium"?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(e,r){if(e<-1||e>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(e+1)}_unpackMapbox(e,r,s){return(256*e*256+256*r+s)/10-1e4}_unpackTerrarium(e,r,s){return 256*e+r+s/256-32768}getPixels(){return new pr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,s){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let l=r*this.dim,u=r*this.dim+this.dim,d=s*this.dim,f=s*this.dim+this.dim;switch(r){case-1:l=u-1;break;case 1:u=l+1}switch(s){case-1:d=f-1;break;case 1:f=d+1}const g=-r*this.dim,x=-s*this.dim;for(let w=d;w<f;w++)for(let T=l;T<u;T++)this.data[this._idx(T,w)]=e.data[this._idx(T+g,w+x)]}}$e("DEMData",ap);class op{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){const s=e[r];this._stringToNumber[s]=r,this._numberToString[r]=s}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class lp{constructor(e,r,s,l,u){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=s,e._y=l,this.properties=e.properties,this.id=u}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(e[r]=this[r]);return e}}class cp{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new In(ai,16,0),this.grid3D=new In(ai,16,0),this.featureIndexArray=new he,this.promoteId=r}insert(e,r,s,l,u,d){const f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,l,u);const g=d?this.grid3D:this.grid;for(let x=0;x<r.length;x++){const w=r[x],T=[1/0,1/0,-1/0,-1/0];for(let A=0;A<w.length;A++){const I=w[A];T[0]=Math.min(T[0],I.x),T[1]=Math.min(T[1],I.y),T[2]=Math.max(T[2],I.x),T[3]=Math.max(T[3],I.y)}T[0]<ai&&T[1]<ai&&T[2]>=0&&T[3]>=0&&g.insert(f,T[0],T[1],T[2],T[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Dn.VectorTile(new kc(this.rawTileData)).layers,this.sourceLayerCoder=new op(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,s,l){this.loadVTLayers();const u=e.params||{},d=ai/e.tileSize/e.scale,f=js(u.filter),g=e.queryGeometry,x=e.queryPadding*d,w=up(g),T=this.grid.query(w.minX-x,w.minY-x,w.maxX+x,w.maxY+x),A=up(e.cameraQueryGeometry),I=this.grid3D.query(A.minX-x,A.minY-x,A.maxX+x,A.maxY+x,(O,G,Y,$)=>function(J,pe,ue,Ne,qe){for(const Re of J)if(pe<=Re.x&&ue<=Re.y&&Ne>=Re.x&&qe>=Re.y)return!0;const Ue=[new it(pe,ue),new it(pe,qe),new it(Ne,qe),new it(Ne,ue)];if(J.length>2){for(const Re of Ue)if(Ys(J,Re))return!0}for(let Re=0;Re<J.length-1;Re++)if(_m(J[Re],J[Re+1],Ue))return!0;return!1}(e.cameraQueryGeometry,O-x,G-x,Y+x,$+x));for(const O of I)T.push(O);T.sort(Gf);const P={};let F;for(let O=0;O<T.length;O++){const G=T[O];if(G===F)continue;F=G;const Y=this.featureIndexArray.get(G);let $=null;this.loadMatchingFeature(P,Y.bucketIndex,Y.sourceLayerIndex,Y.featureIndex,f,u.layers,u.availableImages,r,s,l,(J,pe,ue)=>($||($=_s(J)),pe.queryIntersectsFeature(g,J,ue,$,this.z,e.transform,d,e.pixelPosMatrix)))}return P}loadMatchingFeature(e,r,s,l,u,d,f,g,x,w,T){const A=this.bucketLayerIDs[r];if(d&&!function(O,G){for(let Y=0;Y<O.length;Y++)if(G.indexOf(O[Y])>=0)return!0;return!1}(d,A))return;const I=this.sourceLayerCoder.decode(s),P=this.vtLayers[I].feature(l);if(u.needGeometry){const O=ys(P,!0);if(!u.filter(new Vt(this.tileID.overscaledZ),O,this.tileID.canonical))return}else if(!u.filter(new Vt(this.tileID.overscaledZ),P))return;const F=this.getId(P,I);for(let O=0;O<A.length;O++){const G=A[O];if(d&&d.indexOf(G)<0)continue;const Y=g[G];if(!Y)continue;let $={};F&&w&&($=w.getState(Y.sourceLayer||"_geojsonTileLayer",F));const J=Ye({},x[G]);J.paint=hp(J.paint,Y.paint,P,$,f),J.layout=hp(J.layout,Y.layout,P,$,f);const pe=!T||T(P,Y,$);if(!pe)continue;const ue=new lp(P,this.z,this.x,this.y,F);ue.layer=J;let Ne=e[G];Ne===void 0&&(Ne=e[G]=[]),Ne.push({featureIndex:l,feature:ue,intersectionZ:pe})}}lookupSymbolFeatures(e,r,s,l,u,d,f,g){const x={};this.loadVTLayers();const w=js(u);for(const T of e)this.loadMatchingFeature(x,s,l,T,w,d,f,g,r);return x}hasLayer(e){for(const r of this.bucketLayerIDs)for(const s of r)if(e===s)return!0;return!1}getId(e,r){let s=e.id;return this.promoteId&&(s=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof s=="boolean"&&(s=Number(s))),s}}function hp(i,e,r,s,l){return Dt(i,(u,d)=>{const f=e instanceof Hs?e.get(d):null;return f&&f.evaluate?f.evaluate(r,s,l):f})}function up(i){let e=1/0,r=1/0,s=-1/0,l=-1/0;for(const u of i)e=Math.min(e,u.x),r=Math.min(r,u.y),s=Math.max(s,u.x),l=Math.max(l,u.y);return{minX:e,minY:r,maxX:s,maxY:l}}function Gf(i,e){return e-i}function Zc(i,e,r,s,l,u){if(l-s<=r)return;const d=s+l>>1;pp(i,e,d,s,l,u%2),Zc(i,e,r,s,d-1,u+1),Zc(i,e,r,d+1,l,u+1)}function pp(i,e,r,s,l,u){for(;l>s;){if(l-s>600){const x=l-s+1,w=r-s+1,T=Math.log(x),A=.5*Math.exp(2*T/3),I=.5*Math.sqrt(T*A*(x-A)/x)*(w-x/2<0?-1:1);pp(i,e,r,Math.max(s,Math.floor(r-w*A/x+I)),Math.min(l,Math.floor(r+(x-w)*A/x+I)),u)}const d=e[2*r+u];let f=s,g=l;for(po(i,e,s,r),e[2*l+u]>d&&po(i,e,s,l);f<g;){for(po(i,e,f,g),f++,g--;e[2*f+u]<d;)f++;for(;e[2*g+u]>d;)g--}e[2*s+u]===d?po(i,e,s,g):(g++,po(i,e,g,l)),g<=r&&(s=g+1),r<=g&&(l=g-1)}}function po(i,e,r,s){Xc(i,r,s),Xc(e,2*r,2*s),Xc(e,2*r+1,2*s+1)}function Xc(i,e,r){const s=i[e];i[e]=i[r],i[r]=s}function dp(i,e,r,s){const l=i-r,u=e-s;return l*l+u*u}$e("FeatureIndex",cp,{omit:["rawTileData","sourceLayerCoder"]});const qf=i=>i[0],Zf=i=>i[1];var Wc;c.PerformanceMarkers=void 0,(Wc=c.PerformanceMarkers||(c.PerformanceMarkers={})).create="create",Wc.load="load",Wc.fullLoad="fullLoad";let Ll=null,mo=[];const Hc=1e3/30,Xf={mark(i){performance.mark(i)},frame(i){const e=i;Ll!=null&&mo.push(e-Ll),Ll=e},clearMetrics(){Ll=null,mo=[],performance.clearMeasures("loadTime"),performance.clearMeasures("fullLoadTime");for(const i in c.PerformanceMarkers)performance.clearMarks(c.PerformanceMarkers[i])},getPerformanceMetrics(){performance.measure("loadTime",c.PerformanceMarkers.create,c.PerformanceMarkers.load),performance.measure("fullLoadTime",c.PerformanceMarkers.create,c.PerformanceMarkers.fullLoad);const i=performance.getEntriesByName("loadTime")[0].duration,e=performance.getEntriesByName("fullLoadTime")[0].duration,r=mo.length,s=1/(mo.reduce((u,d)=>u+d,0)/r/1e3),l=mo.filter(u=>u>Hc).reduce((u,d)=>u+(d-Hc)/Hc,0);return{loadTime:i,fullLoadTime:e,fps:s,percentDroppedFrames:l/(r+l)*100}}};c.AJAXError=Ir,c.ARRAY_TYPE=Ri,c.Actor=class{constructor(i,e,r){this.target=i,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},Jt(["receive","process"],this),this.invoker=new jf(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=Yi()?i:window}send(i,e,r,s,l=!1){const u=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[u]=r);const d=Br(this.globalScope)?void 0:[];return this.target.postMessage({id:u,type:i,hasCallback:!!r,targetMapId:s,mustQueue:l,sourceMapId:this.mapId,data:An(e,d)},d),{cancel:()=>{r&&delete this.callbacks[u],this.target.postMessage({id:u,type:"<cancel>",targetMapId:s,sourceMapId:this.mapId})}}}receive(i){const e=i.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(e.type==="<cancel>"){delete this.tasks[r];const s=this.cancelCallbacks[r];delete this.cancelCallbacks[r],s&&s()}else Yi()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)}process(){if(!this.taskQueue.length)return;const i=this.taskQueue.shift(),e=this.tasks[i];delete this.tasks[i],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(i,e)}processTask(i,e){if(e.type==="<response>"){const r=this.callbacks[i];delete this.callbacks[i],r&&(e.error?r(ls(e.error)):r(null,ls(e.data)))}else{let r=!1;const s=Br(this.globalScope)?void 0:[],l=e.hasCallback?(f,g)=>{r=!0,delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"<response>",sourceMapId:this.mapId,error:f?An(f):null,data:An(g,s)},s)}:f=>{r=!0};let u=null;const d=ls(e.data);if(this.parent[e.type])u=this.parent[e.type](e.sourceMapId,d,l);else if(this.parent.getWorkerSource){const f=e.type.split(".");u=this.parent.getWorkerSource(e.sourceMapId,f[0],d.source)[f[1]](d,l)}else l(new Error(`Could not find function ${e.type}`));!r&&u&&u.cancel&&(this.cancelCallbacks[i]=u.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},c.AlphaImage=io,c.CanonicalTileID=qc,c.CollisionBoxArray=L,c.CollisionCircleLayoutArray=class extends h{},c.Color=le,c.DEMData=ap,c.DataConstantProperty=We,c.DictionaryCoder=op,c.EXTENT=ai,c.ErrorEvent=j,c.EvaluationParameters=Vt,c.Event=R,c.Evented=Q,c.FeatureIndex=cp,c.FillBucket=Ac,c.FillExtrusionBucket=Mc,c.GeoJSONFeature=lp,c.ImageAtlas=Lu,c.ImagePosition=Lc,c.KDBush=class{constructor(i,e=qf,r=Zf,s=64,l=Float64Array){this.nodeSize=s,this.points=i;const u=i.length<65536?Uint16Array:Uint32Array,d=this.ids=new u(i.length),f=this.coords=new l(2*i.length);for(let g=0;g<i.length;g++)d[g]=g,f[2*g]=e(i[g]),f[2*g+1]=r(i[g]);Zc(d,f,s,0,d.length-1,0)}range(i,e,r,s){return function(l,u,d,f,g,x,w){const T=[0,l.length-1,0],A=[];let I,P;for(;T.length;){const F=T.pop(),O=T.pop(),G=T.pop();if(O-G<=w){for(let J=G;J<=O;J++)I=u[2*J],P=u[2*J+1],I>=d&&I<=g&&P>=f&&P<=x&&A.push(l[J]);continue}const Y=Math.floor((G+O)/2);I=u[2*Y],P=u[2*Y+1],I>=d&&I<=g&&P>=f&&P<=x&&A.push(l[Y]);const $=(F+1)%2;(F===0?d<=I:f<=P)&&(T.push(G),T.push(Y-1),T.push($)),(F===0?g>=I:x>=P)&&(T.push(Y+1),T.push(O),T.push($))}return A}(this.ids,this.coords,i,e,r,s,this.nodeSize)}within(i,e,r){return function(s,l,u,d,f,g){const x=[0,s.length-1,0],w=[],T=f*f;for(;x.length;){const A=x.pop(),I=x.pop(),P=x.pop();if(I-P<=g){for(let $=P;$<=I;$++)dp(l[2*$],l[2*$+1],u,d)<=T&&w.push(s[$]);continue}const F=Math.floor((P+I)/2),O=l[2*F],G=l[2*F+1];dp(O,G,u,d)<=T&&w.push(s[F]);const Y=(A+1)%2;(A===0?u-f<=O:d-f<=G)&&(x.push(P),x.push(F-1),x.push(Y)),(A===0?u+f>=O:d+f>=G)&&(x.push(F+1),x.push(I),x.push(Y))}return w}(this.ids,this.coords,i,e,r,this.nodeSize)}},c.LineBucket=Pc,c.LineStripIndexArray=class extends M{},c.LngLat=Ht,c.LngLatBounds=Yu,c.MercatorCoordinate=zl,c.ONE_EM=pi,c.OverscaledTileID=dr,c.PerformanceUtils=Xf,c.Pos3dArray=class extends ds{},c.PosArray=de,c.Properties=Si,c.QuadTriangleArray=class extends m{},c.RGBAImage=pr,c.RasterBoundsArray=class extends Yr{},c.RequestPerformance=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}},c.ResourceType=Er,c.SegmentVector=Nt,c.SymbolBucket=sa,c.Transitionable=hl,c.TriangleIndexArray=bt,c.Uniform1f=zn,c.Uniform1i=class extends ir{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},c.Uniform2f=class extends ir{constructor(i,e){super(i,e),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},c.Uniform3f=class extends ir{constructor(i,e){super(i,e),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},c.Uniform4f=Js,c.UniformColor=dl,c.UniformMatrix4f=class extends ir{constructor(i,e){super(i,e),this.current=pc}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let e=1;e<16;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},c.UnwrappedTileID=sp,c.ValidationError=H,c.ZoomHistory=Oa,c.add=function(i,e,r){return i[0]=e[0]+r[0],i[1]=e[1]+r[1],i[2]=e[2]+r[2],i},c.addDynamicAttributes=Oc,c.asyncAll=function(i,e,r){if(!i.length)return r(null,[]);let s=i.length;const l=new Array(i.length);let u=null;i.forEach((d,f)=>{e(d,(g,x)=>{g&&(u=g),l[f]=x,--s==0&&r(u,l)})})},c.bezier=lt,c.bindAll=Jt,c.cacheEntryPossiblyAdded=function(i){jn++,jn>Vr&&(i.getActor().send("enforceCacheSizeLimit",Ur),jn=0)},c.clamp=Me,c.clearTileCache=function(i){const e=caches.delete(qr);i&&e.catch(i).then(()=>i())},c.clipLine=qu,c.clone=function(i){var e=new Ri(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},c.clone$1=Ji,c.clone$2=function(i){var e=new Ri(3);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e},c.collisionCircleLayout=cf,c.config=Or,c.copy=function(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},c.create=function(){var i=new Ri(16);return Ri!=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},c.create$1=nu,c.createExpression=es,c.createFilter=js,c.createLayout=Wt,c.createStyleLayer=function(i){return i.type==="custom"?new Nf(i):new $f[i.type](i)},c.cross=function(i,e,r){var s=e[0],l=e[1],u=e[2],d=r[0],f=r[1],g=r[2];return i[0]=l*g-u*f,i[1]=u*d-s*g,i[2]=s*f-l*d,i},c.dot=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]},c.dot$1=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},c.earthRadius=jc,c.ease=St,c.emitValidationErrors=Fa,c.enforceCacheSizeLimit=function(i){$n(),ki&&ki.then(e=>{e.keys().then(r=>{for(let s=0;s<r.length-i;s++)e.delete(r[s])})})},c.equals=function(i,e){var r=i[0],s=i[1],l=i[2],u=i[3],d=i[4],f=i[5],g=i[6],x=i[7],w=i[8],T=i[9],A=i[10],I=i[11],P=i[12],F=i[13],O=i[14],G=i[15],Y=e[0],$=e[1],J=e[2],pe=e[3],ue=e[4],Ne=e[5],qe=e[6],Ue=e[7],Re=e[8],ze=e[9],Ve=e[10],Be=e[11],Ee=e[12],Ke=e[13],Xe=e[14],ct=e[15];return Math.abs(r-Y)<=Di*Math.max(1,Math.abs(r),Math.abs(Y))&&Math.abs(s-$)<=Di*Math.max(1,Math.abs(s),Math.abs($))&&Math.abs(l-J)<=Di*Math.max(1,Math.abs(l),Math.abs(J))&&Math.abs(u-pe)<=Di*Math.max(1,Math.abs(u),Math.abs(pe))&&Math.abs(d-ue)<=Di*Math.max(1,Math.abs(d),Math.abs(ue))&&Math.abs(f-Ne)<=Di*Math.max(1,Math.abs(f),Math.abs(Ne))&&Math.abs(g-qe)<=Di*Math.max(1,Math.abs(g),Math.abs(qe))&&Math.abs(x-Ue)<=Di*Math.max(1,Math.abs(x),Math.abs(Ue))&&Math.abs(w-Re)<=Di*Math.max(1,Math.abs(w),Math.abs(Re))&&Math.abs(T-ze)<=Di*Math.max(1,Math.abs(T),Math.abs(ze))&&Math.abs(A-Ve)<=Di*Math.max(1,Math.abs(A),Math.abs(Ve))&&Math.abs(I-Be)<=Di*Math.max(1,Math.abs(I),Math.abs(Be))&&Math.abs(P-Ee)<=Di*Math.max(1,Math.abs(P),Math.abs(Ee))&&Math.abs(F-Ke)<=Di*Math.max(1,Math.abs(F),Math.abs(Ke))&&Math.abs(O-Xe)<=Di*Math.max(1,Math.abs(O),Math.abs(Xe))&&Math.abs(G-ct)<=Di*Math.max(1,Math.abs(G),Math.abs(ct))},c.evaluateSizeForFeature=function(i,{uSize:e,uSizeT:r},{lowerSize:s,upperSize:l}){return i.kind==="source"?s/rn:i.kind==="composite"?qt(s/rn,l/rn,r):e},c.evaluateSizeForZoom=function(i,e){let r=0,s=0;if(i.kind==="constant")s=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:l,minZoom:u,maxZoom:d}=i,f=l?Me(Vi.interpolationFactor(l,e,u,d),0,1):0;i.kind==="camera"?s=qt(i.minSize,i.maxSize,f):r=f}return{uSizeT:r,uSize:s}},c.evaluateVariableOffset=Wu,c.evented=qa,c.exported=hn,c.exported$1=un,c.extend=Ye,c.filterObject=Vn,c.fromRotation=function(i,e){var r=Math.sin(e),s=Math.cos(e);return i[0]=s,i[1]=r,i[2]=0,i[3]=-r,i[4]=s,i[5]=0,i[6]=0,i[7]=0,i[8]=1,i},c.fromScaling=function(i,e){return i[0]=e[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=e[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=e[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},c.getAnchorAlignment=Rc,c.getAnchorJustification=Fc,c.getArrayBuffer=Xr,c.getImage=dn,c.getJSON=function(i,e){return Oi(Ye(i,{type:"json"}),e)},c.getOverlapMode=$c,c.getRTLTextPluginStatus=Za,c.getReferrer=ar,c.getVideo=function(i,e){const r=window.document.createElement("video");r.muted=!0,r.onloadstart=function(){e(null,r)};for(let s=0;s<i.length;s++){const l=window.document.createElement("source");Is(i[s])||(r.crossOrigin="Anonymous"),l.src=i[s],r.appendChild(l)}return{cancel:()=>{}}},c.identity=_c,c.invert=function(i,e){var r=e[0],s=e[1],l=e[2],u=e[3],d=e[4],f=e[5],g=e[6],x=e[7],w=e[8],T=e[9],A=e[10],I=e[11],P=e[12],F=e[13],O=e[14],G=e[15],Y=r*f-s*d,$=r*g-l*d,J=r*x-u*d,pe=s*g-l*f,ue=s*x-u*f,Ne=l*x-u*g,qe=w*F-T*P,Ue=w*O-A*P,Re=w*G-I*P,ze=T*O-A*F,Ve=T*G-I*F,Be=A*G-I*O,Ee=Y*Be-$*Ve+J*ze+pe*Re-ue*Ue+Ne*qe;return Ee?(i[0]=(f*Be-g*Ve+x*ze)*(Ee=1/Ee),i[1]=(l*Ve-s*Be-u*ze)*Ee,i[2]=(F*Ne-O*ue+G*pe)*Ee,i[3]=(A*ue-T*Ne-I*pe)*Ee,i[4]=(g*Re-d*Be-x*Ue)*Ee,i[5]=(r*Be-l*Re+u*Ue)*Ee,i[6]=(O*J-P*Ne-G*$)*Ee,i[7]=(w*Ne-A*J+I*$)*Ee,i[8]=(d*Ve-f*Re+x*qe)*Ee,i[9]=(s*Re-r*Ve-u*qe)*Ee,i[10]=(P*ue-F*J+G*Y)*Ee,i[11]=(T*J-w*ue-I*Y)*Ee,i[12]=(f*Ue-d*ze-g*qe)*Ee,i[13]=(r*ze-s*Ue+l*qe)*Ee,i[14]=(F*$-P*pe-O*Y)*Ee,i[15]=(w*pe-T*$+A*Y)*Ee,i):null},c.isImageBitmap=Fr,c.isSafari=Br,c.isWorker=Yi,c.keysDifference=function(i,e){const r=[];for(const s in i)s in e||r.push(s);return r},c.lazyLoadRTLTextPlugin=function(){ji.isLoading()||ji.isLoaded()||Za()!=="deferred"||cl()},c.makeRequest=Oi,c.mapObject=Dt,c.mercatorXfromLng=tp,c.mercatorYfromLat=ip,c.mercatorZfromAltitude=rp,c.mul=vm,c.mul$1=function(i,e,r){return i[0]=e[0]*r[0],i[1]=e[1]*r[1],i[2]=e[2]*r[2],i[3]=e[3]*r[3],i},c.multiply=su,c.nextPowerOfTwo=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},c.normalize=function(i,e){var r=e[0],s=e[1],l=e[2],u=r*r+s*s+l*l;return u>0&&(u=1/Math.sqrt(u)),i[0]=e[0]*u,i[1]=e[1]*u,i[2]=e[2]*u,i},c.number=qt,c.ortho=function(i,e,r,s,l,u,d){var f=1/(e-r),g=1/(s-l),x=1/(u-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]=(e+r)*f,i[13]=(l+s)*g,i[14]=(d+u)*x,i[15]=1,i},c.parseCacheControl=Nn,c.parseGlyphPbf=function(i){return new kc(i).readFields(vf,[])},c.pbf=kc,c.performSymbolLayout=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=ai/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const e=i.bucket.layers[0].layout,r=i.bucket.layers[0]._unevaluatedLayout._values,s={layoutIconSize:r["icon-size"].possiblyEvaluate(new Vt(i.bucket.zoom+1),i.canonical),layoutTextSize:r["text-size"].possiblyEvaluate(new Vt(i.bucket.zoom+1),i.canonical),textMaxSize:r["text-size"].possiblyEvaluate(new Vt(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:g,maxZoom:x}=i.bucket.textSizeData;s.compositeTextSizes=[r["text-size"].possiblyEvaluate(new Vt(g),i.canonical),r["text-size"].possiblyEvaluate(new Vt(x),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:g,maxZoom:x}=i.bucket.iconSizeData;s.compositeIconSizes=[r["icon-size"].possiblyEvaluate(new Vt(g),i.canonical),r["icon-size"].possiblyEvaluate(new Vt(x),i.canonical)]}const l=e.get("text-line-height")*pi,u=e.get("text-rotation-alignment")!=="viewport"&&e.get("symbol-placement")!=="point",d=e.get("text-keep-upright"),f=e.get("text-size");for(const g of i.bucket.features){const x=e.get("text-font").evaluate(g,{},i.canonical).join(","),w=f.evaluate(g,{},i.canonical),T=s.layoutTextSize.evaluate(g,{},i.canonical),A=s.layoutIconSize.evaluate(g,{},i.canonical),I={horizontal:{},vertical:void 0},P=g.text;let F,O=[0,0];if(P){const $=P.toString(),J=e.get("text-letter-spacing").evaluate(g,{},i.canonical)*pi,pe=oc($)?J:0,ue=e.get("text-anchor").evaluate(g,{},i.canonical),Ne=e.get("text-variable-anchor");if(!Ne){const Ve=e.get("text-radial-offset").evaluate(g,{},i.canonical);O=Ve?Wu(ue,[Ve*pi,Bc]):e.get("text-offset").evaluate(g,{},i.canonical).map(Be=>Be*pi)}let qe=u?"center":e.get("text-justify").evaluate(g,{},i.canonical);const Ue=e.get("symbol-placement"),Re=Ue==="point"?e.get("text-max-width").evaluate(g,{},i.canonical)*pi:0,ze=()=>{i.bucket.allowVerticalPlacement&&cs($)&&(I.vertical=Sl(P,i.glyphMap,i.glyphPositions,i.imagePositions,x,Re,l,ue,"left",pe,O,c.WritingMode.vertical,!0,Ue,T,w))};if(!u&&Ne){const Ve=qe==="auto"?Ne.map(Ee=>Fc(Ee)):[qe];let Be=!1;for(let Ee=0;Ee<Ve.length;Ee++){const Ke=Ve[Ee];if(!I.horizontal[Ke])if(Be)I.horizontal[Ke]=I.horizontal[0];else{const Xe=Sl(P,i.glyphMap,i.glyphPositions,i.imagePositions,x,Re,l,"center",Ke,pe,O,c.WritingMode.horizontal,!1,Ue,T,w);Xe&&(I.horizontal[Ke]=Xe,Be=Xe.positionedLines.length===1)}}ze()}else{qe==="auto"&&(qe=Fc(ue));const Ve=Sl(P,i.glyphMap,i.glyphPositions,i.imagePositions,x,Re,l,ue,qe,pe,O,c.WritingMode.horizontal,!1,Ue,T,w);Ve&&(I.horizontal[qe]=Ve),ze(),cs($)&&u&&d&&(I.vertical=Sl(P,i.glyphMap,i.glyphPositions,i.imagePositions,x,Re,l,ue,qe,pe,O,c.WritingMode.vertical,!1,Ue,T,w))}}let G=!1;if(g.icon&&g.icon.name){const $=i.imageMap[g.icon.name];$&&(F=If(i.imagePositions[g.icon.name],e.get("icon-offset").evaluate(g,{},i.canonical),e.get("icon-anchor").evaluate(g,{},i.canonical)),G=!!$.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=G:i.bucket.sdfIcons!==G&&Yt("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),($.pixelRatio!==i.bucket.pixelRatio||e.get("icon-rotate").constantOr(1)!==0)&&(i.bucket.iconsNeedLinear=!0))}const Y=Ku(I.horizontal)||I.vertical;i.bucket.iconsInText=!!Y&&Y.iconsInText,(Y||F)&&Lf(i.bucket,g,I,F,i.imageMap,s,T,A,O,G,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},c.perspective=function(i,e,r,s,l){var u,d=1/Math.tan(e/2);return i[0]=d/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=d,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,l!=null&&l!==1/0?(i[10]=(l+s)*(u=1/(s-l)),i[14]=2*l*s*u):(i[10]=-1,i[14]=-2*s),i},c.pick=function(i,e){const r={};for(let s=0;s<e.length;s++){const l=e[s];l in i&&(r[l]=i[l])}return r},c.plugin=ji,c.pointGeometry=it,c.polygonIntersectsPolygon=eu,c.potpack=zu,c.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],c.register=$e,c.registerForPluginStateChange=function(i){return i({pluginStatus:zi,pluginURL:lr}),qa.on("pluginStateChange",i),i},c.renderColorRamp=pu,c.rotateX=function(i,e,r){var s=Math.sin(r),l=Math.cos(r),u=e[4],d=e[5],f=e[6],g=e[7],x=e[8],w=e[9],T=e[10],A=e[11];return e!==i&&(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[4]=u*l+x*s,i[5]=d*l+w*s,i[6]=f*l+T*s,i[7]=g*l+A*s,i[8]=x*l-u*s,i[9]=w*l-d*s,i[10]=T*l-f*s,i[11]=A*l-g*s,i},c.rotateZ=function(i,e,r){var s=Math.sin(r),l=Math.cos(r),u=e[0],d=e[1],f=e[2],g=e[3],x=e[4],w=e[5],T=e[6],A=e[7];return e!==i&&(i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[0]=u*l+x*s,i[1]=d*l+w*s,i[2]=f*l+T*s,i[3]=g*l+A*s,i[4]=x*l-u*s,i[5]=w*l-d*s,i[6]=T*l-f*s,i[7]=A*l-g*s,i},c.scale=function(i,e,r){var s=r[0],l=r[1],u=r[2];return i[0]=e[0]*s,i[1]=e[1]*s,i[2]=e[2]*s,i[3]=e[3]*s,i[4]=e[4]*l,i[5]=e[5]*l,i[6]=e[6]*l,i[7]=e[7]*l,i[8]=e[8]*u,i[9]=e[9]*u,i[10]=e[10]*u,i[11]=e[11]*u,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},c.scale$1=function(i,e,r){return i[0]=e[0]*r,i[1]=e[1]*r,i[2]=e[2]*r,i},c.setCacheLimits=function(i,e){Ur=i,Vr=e},c.setRTLTextPlugin=function(i,e,r=!1){if(zi===Na||zi===$a||zi===ja)throw new Error("setRTLTextPlugin cannot be called multiple times.");lr=hn.resolveURL(i),zi=Na,Ga=e,hs(),r||cl()},c.spec=V,c.sphericalToCartesian=function([i,e,r]){return e+=90,e*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(e)*Math.sin(r),y:i*Math.sin(e)*Math.sin(r),z:i*Math.cos(r)}},c.sqrLen=function(i){var e=i[0],r=i[1];return e*e+r*r},c.sub=function(i,e,r){return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],i},c.toEvaluationFeature=ys,c.transformMat3=function(i,e,r){var s=e[0],l=e[1],u=e[2];return i[0]=s*r[0]+l*r[3]+u*r[6],i[1]=s*r[1]+l*r[4]+u*r[7],i[2]=s*r[2]+l*r[5]+u*r[8],i},c.transformMat4=_l,c.transformMat4$1=function(i,e,r){var s=e[0],l=e[1];return i[0]=r[0]*s+r[4]*l+r[12],i[1]=r[1]*s+r[5]*l+r[13],i},c.translate=function(i,e,r){var s,l,u,d,f,g,x,w,T,A,I,P,F=r[0],O=r[1],G=r[2];return e===i?(i[12]=e[0]*F+e[4]*O+e[8]*G+e[12],i[13]=e[1]*F+e[5]*O+e[9]*G+e[13],i[14]=e[2]*F+e[6]*O+e[10]*G+e[14],i[15]=e[3]*F+e[7]*O+e[11]*G+e[15]):(l=e[1],u=e[2],d=e[3],f=e[4],g=e[5],x=e[6],w=e[7],T=e[8],A=e[9],I=e[10],P=e[11],i[0]=s=e[0],i[1]=l,i[2]=u,i[3]=d,i[4]=f,i[5]=g,i[6]=x,i[7]=w,i[8]=T,i[9]=A,i[10]=I,i[11]=P,i[12]=s*F+f*O+T*G+e[12],i[13]=l*F+g*O+A*G+e[13],i[14]=u*F+x*O+I*G+e[14],i[15]=d*F+w*O+P*G+e[15]),i},c.triggerPluginCompletionEvent=ll,c.unicodeBlockLookup=Oe,c.uniqueId=function(){return ti++},c.validateCustomStyleLayer=function(i){const e=[],r=i.id;return r===void 0&&e.push({message:`layers.${r}: missing required property "id"`}),i.render===void 0&&e.push({message:`layers.${r}: missing required method "render"`}),i.renderingMode&&i.renderingMode!=="2d"&&i.renderingMode!=="3d"&&e.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),e},c.validateLight=Ra,c.validateStyle=as,c.vectorTile=Dn,c.warnOnce=Yt,c.wrap=K}),fe(["./shared"],function(c){function ve(re){const z=typeof re;if(z==="number"||z==="boolean"||z==="string"||re==null)return JSON.stringify(re);if(Array.isArray(re)){let Q="[";for(const V of re)Q+=`${ve(V)},`;return`${Q}]`}const R=Object.keys(re).sort();let j="{";for(let Q=0;Q<R.length;Q++)j+=`${JSON.stringify(R[Q])}:${ve(re[R[Q]])},`;return`${j}}`}function Ze(re){let z="";for(const R of c.refProperties)z+=`/${ve(re[R])}`;return z}class lt{constructor(z){this.keyCache={},z&&this.replace(z)}replace(z){this._layerConfigs={},this._layers={},this.update(z,[])}update(z,R){for(const Q of z){this._layerConfigs[Q.id]=Q;const V=this._layers[Q.id]=c.createStyleLayer(Q);V._featureFilter=c.createFilter(V.filter),this.keyCache[Q.id]&&delete this.keyCache[Q.id]}for(const Q of R)delete this.keyCache[Q],delete this._layerConfigs[Q],delete this._layers[Q];this.familiesBySource={};const j=function(Q,V){const H={};for(let ae=0;ae<Q.length;ae++){const Ie=V&&V[Q[ae].id]||Ze(Q[ae]);V&&(V[Q[ae].id]=Ie);let Pe=H[Ie];Pe||(Pe=H[Ie]=[]),Pe.push(Q[ae])}const be=[];for(const ae in H)be.push(H[ae]);return be}(Object.values(this._layerConfigs),this.keyCache);for(const Q of j){const V=Q.map(Ce=>this._layers[Ce.id]),H=V[0];if(H.visibility==="none")continue;const be=H.source||"";let ae=this.familiesBySource[be];ae||(ae=this.familiesBySource[be]={});const Ie=H.sourceLayer||"_geojsonTileLayer";let Pe=ae[Ie];Pe||(Pe=ae[Ie]=[]),Pe.push(V)}}}class St{constructor(z){const R={},j=[];for(const be in z){const ae=z[be],Ie=R[be]={};for(const Pe in ae){const Ce=ae[+Pe];if(!Ce||Ce.bitmap.width===0||Ce.bitmap.height===0)continue;const at={x:0,y:0,w:Ce.bitmap.width+2,h:Ce.bitmap.height+2};j.push(at),Ie[Pe]={rect:at,metrics:Ce.metrics}}}const{w:Q,h:V}=c.potpack(j),H=new c.AlphaImage({width:Q||1,height:V||1});for(const be in z){const ae=z[be];for(const Ie in ae){const Pe=ae[+Ie];if(!Pe||Pe.bitmap.width===0||Pe.bitmap.height===0)continue;const Ce=R[be][Ie].rect;c.AlphaImage.copy(Pe.bitmap,H,{x:0,y:0},{x:Ce.x+1,y:Ce.y+1},Pe.bitmap)}}this.image=H,this.positions=R}}c.register("GlyphAtlas",St);class Me{constructor(z){this.tileID=new c.OverscaledTileID(z.tileID.overscaledZ,z.tileID.wrap,z.tileID.canonical.z,z.tileID.canonical.x,z.tileID.canonical.y),this.uid=z.uid,this.zoom=z.zoom,this.pixelRatio=z.pixelRatio,this.tileSize=z.tileSize,this.source=z.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=z.showCollisionBoxes,this.collectResourceTiming=!!z.collectResourceTiming,this.returnDependencies=!!z.returnDependencies,this.promoteId=z.promoteId}parse(z,R,j,Q,V){this.status="parsing",this.data=z,this.collisionBoxArray=new c.CollisionBoxArray;const H=new c.DictionaryCoder(Object.keys(z.layers).sort()),be=new c.FeatureIndex(this.tileID,this.promoteId);be.bucketLayerIDs=[];const ae={},Ie={featureIndex:be,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:j},Pe=R.familiesBySource[this.source];for(const je in Pe){const It=z.layers[je];if(!It)continue;It.version===1&&c.warnOnce(`Vector tile source "${this.source}" layer "${je}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Xt=H.encode(je),ii=[];for(let Bt=0;Bt<It.length;Bt++){const At=It.feature(Bt),st=be.getId(At,je);ii.push({feature:At,id:st,index:Bt,sourceLayerIndex:Xt})}for(const Bt of Pe[je]){const At=Bt[0];At.source!==this.source&&c.warnOnce(`layer.source = ${At.source} does not equal this.source = ${this.source}`),At.minzoom&&this.zoom<Math.floor(At.minzoom)||At.maxzoom&&this.zoom>=At.maxzoom||At.visibility!=="none"&&(K(Bt,this.zoom,j),(ae[At.id]=At.createBucket({index:be.bucketLayerIDs.length,layers:Bt,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Xt,sourceID:this.source})).populate(ii,Ie,this.tileID.canonical),be.bucketLayerIDs.push(Bt.map(st=>st.id)))}}let Ce,at,gt,xe;const Le=c.mapObject(Ie.glyphDependencies,je=>Object.keys(je).map(Number));Object.keys(Le).length?Q.send("getGlyphs",{uid:this.uid,stacks:Le,source:this.source,tileID:this.tileID,type:"glyphs"},(je,It)=>{Ce||(Ce=je,at=It,Rt.call(this))}):at={};const Fe=Object.keys(Ie.iconDependencies);Fe.length?Q.send("getImages",{icons:Fe,source:this.source,tileID:this.tileID,type:"icons"},(je,It)=>{Ce||(Ce=je,gt=It,Rt.call(this))}):gt={};const vt=Object.keys(Ie.patternDependencies);function Rt(){if(Ce)return V(Ce);if(at&&gt&&xe){const je=new St(at),It=new c.ImageAtlas(gt,xe);for(const Xt in ae){const ii=ae[Xt];ii instanceof c.SymbolBucket?(K(ii.layers,this.zoom,j),c.performSymbolLayout({bucket:ii,glyphMap:at,glyphPositions:je.positions,imageMap:gt,imagePositions:It.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):ii.hasPattern&&(ii instanceof c.LineBucket||ii instanceof c.FillBucket||ii instanceof c.FillExtrusionBucket)&&(K(ii.layers,this.zoom,j),ii.addFeatures(Ie,this.tileID.canonical,It.patternPositions))}this.status="done",V(null,{buckets:Object.values(ae).filter(Xt=>!Xt.isEmpty()),featureIndex:be,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:je.image,imageAtlas:It,glyphMap:this.returnDependencies?at:null,iconMap:this.returnDependencies?gt:null,glyphPositions:this.returnDependencies?je.positions:null})}}vt.length?Q.send("getImages",{icons:vt,source:this.source,tileID:this.tileID,type:"patterns"},(je,It)=>{Ce||(Ce=je,xe=It,Rt.call(this))}):xe={},Rt.call(this)}}function K(re,z,R){const j=new c.EvaluationParameters(z);for(const Q of re)Q.recalculate(j,R)}function Ye(re,z){const R=c.getArrayBuffer(re.request,(j,Q,V,H)=>{j?z(j):Q&&z(null,{vectorTile:new c.vectorTile.VectorTile(new c.pbf(Q)),rawData:Q,cacheControl:V,expires:H})});return()=>{R.cancel(),z()}}class ti{constructor(z,R,j,Q){this.actor=z,this.layerIndex=R,this.availableImages=j,this.loadVectorData=Q||Ye,this.loading={},this.loaded={}}loadTile(z,R){const j=z.uid;this.loading||(this.loading={});const Q=!!(z&&z.request&&z.request.collectResourceTiming)&&new c.RequestPerformance(z.request),V=this.loading[j]=new Me(z);V.abort=this.loadVectorData(z,(H,be)=>{if(delete this.loading[j],H||!be)return V.status="done",this.loaded[j]=V,R(H);const ae=be.rawData,Ie={};be.expires&&(Ie.expires=be.expires),be.cacheControl&&(Ie.cacheControl=be.cacheControl);const Pe={};if(Q){const Ce=Q.finish();Ce&&(Pe.resourceTiming=JSON.parse(JSON.stringify(Ce)))}V.vectorTile=be.vectorTile,V.parse(be.vectorTile,this.layerIndex,this.availableImages,this.actor,(Ce,at)=>{if(Ce||!at)return R(Ce);R(null,c.extend({rawTileData:ae.slice(0)},at,Ie,Pe))}),this.loaded=this.loaded||{},this.loaded[j]=V})}reloadTile(z,R){const j=this.loaded,Q=z.uid,V=this;if(j&&j[Q]){const H=j[Q];H.showCollisionBoxes=z.showCollisionBoxes;const be=(ae,Ie)=>{const Pe=H.reloadCallback;Pe&&(delete H.reloadCallback,H.parse(H.vectorTile,V.layerIndex,this.availableImages,V.actor,Pe)),R(ae,Ie)};H.status==="parsing"?H.reloadCallback=be:H.status==="done"&&(H.vectorTile?H.parse(H.vectorTile,this.layerIndex,this.availableImages,this.actor,be):be())}}abortTile(z,R){const j=this.loading,Q=z.uid;j&&j[Q]&&j[Q].abort&&(j[Q].abort(),delete j[Q]),R()}removeTile(z,R){const j=this.loaded,Q=z.uid;j&&j[Q]&&delete j[Q],R()}}class Jt{constructor(){this.loaded={}}loadTile(z,R){const{uid:j,encoding:Q,rawImageData:V}=z,H=c.isImageBitmap(V)?this.getImageData(V):V,be=new c.DEMData(j,H,Q);this.loaded=this.loaded||{},this.loaded[j]=be,R(null,be)}getImageData(z){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(z.width,z.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=z.width,this.offscreenCanvas.height=z.height,this.offscreenCanvasContext.drawImage(z,0,0,z.width,z.height);const R=this.offscreenCanvasContext.getImageData(-1,-1,z.width+2,z.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new c.RGBAImage({width:R.width,height:R.height},R.data)}removeTile(z){const R=this.loaded,j=z.uid;R&&R[j]&&delete R[j]}}var Dt=function re(z,R){var j,Q=z&&z.type;if(Q==="FeatureCollection")for(j=0;j<z.features.length;j++)re(z.features[j],R);else if(Q==="GeometryCollection")for(j=0;j<z.geometries.length;j++)re(z.geometries[j],R);else if(Q==="Feature")re(z.geometry,R);else if(Q==="Polygon")Vn(z.coordinates,R);else if(Q==="MultiPolygon")for(j=0;j<z.coordinates.length;j++)Vn(z.coordinates[j],R);return z};function Vn(re,z){if(re.length!==0){Ji(re[0],z);for(var R=1;R<re.length;R++)Ji(re[R],!z)}}function Ji(re,z){for(var R=0,j=0,Q=0,V=re.length,H=V-1;Q<V;H=Q++){var be=(re[Q][0]-re[H][0])*(re[H][1]+re[Q][1]),ae=R+be;j+=Math.abs(R)>=Math.abs(be)?R-ae+be:be-ae+R,R=ae}R+j>=0!=!!z&&re.reverse()}const Dr=c.vectorTile.VectorTileFeature.prototype.toGeoJSON;var Yt={},nr={get exports(){return Yt},set exports(re){Yt=re}},Rr=c.pointGeometry,Yi=c.vectorTile.VectorTileFeature,Nn=on;function on(re,z){this.options=z||{},this.features=re,this.length=re.length}function Br(re,z){this.id=typeof re.id=="number"?re.id:void 0,this.type=re.type,this.rawGeometry=re.type===1?[re.geometry]:re.geometry,this.properties=re.tags,this.extent=z||4096}on.prototype.feature=function(re){return new Br(this.features[re],this.options.extent)},Br.prototype.loadGeometry=function(){var re=this.rawGeometry;this.geometry=[];for(var z=0;z<re.length;z++){for(var R=re[z],j=[],Q=0;Q<R.length;Q++)j.push(new Rr(R[Q][0],R[Q][1]));this.geometry.push(j)}return this.geometry},Br.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var re=this.geometry,z=1/0,R=-1/0,j=1/0,Q=-1/0,V=0;V<re.length;V++)for(var H=re[V],be=0;be<H.length;be++){var ae=H[be];z=Math.min(z,ae.x),R=Math.max(R,ae.x),j=Math.min(j,ae.y),Q=Math.max(Q,ae.y)}return[z,j,R,Q]},Br.prototype.toGeoJSON=Yi.prototype.toGeoJSON;var Fr=c.pbf,ln=Nn;function wr(re){var z=new Fr;return function(R,j){for(var Q in R.layers)j.writeMessage(3,cn,R.layers[Q])}(re,z),z.finish()}function cn(re,z){var R;z.writeVarintField(15,re.version||1),z.writeStringField(1,re.name||""),z.writeVarintField(5,re.extent||4096);var j={keys:[],values:[],keycache:{},valuecache:{}};for(R=0;R<re.length;R++)j.feature=re.feature(R),z.writeMessage(2,hn,j);var Q=j.keys;for(R=0;R<Q.length;R++)z.writeStringField(3,Q[R]);var V=j.values;for(R=0;R<V.length;R++)z.writeMessage(4,ki,V[R])}function hn(re,z){var R=re.feature;R.id!==void 0&&z.writeVarintField(1,R.id),z.writeMessage(2,it,re),z.writeVarintField(3,R.type),z.writeMessage(4,qr,R)}function it(re,z){var R=re.feature,j=re.keys,Q=re.values,V=re.keycache,H=re.valuecache;for(var be in R.properties){var ae=R.properties[be],Ie=V[be];if(ae!==null){Ie===void 0&&(j.push(be),V[be]=Ie=j.length-1),z.writeVarint(Ie);var Pe=typeof ae;Pe!=="string"&&Pe!=="boolean"&&Pe!=="number"&&(ae=JSON.stringify(ae));var Ce=Pe+":"+ae,at=H[Ce];at===void 0&&(Q.push(ae),H[Ce]=at=Q.length-1),z.writeVarint(at)}}}function sr(re,z){return(z<<3)+(7&re)}function Or(re){return re<<1^re>>31}function qr(re,z){for(var R=re.loadGeometry(),j=re.type,Q=0,V=0,H=R.length,be=0;be<H;be++){var ae=R[be],Ie=1;j===1&&(Ie=ae.length),z.writeVarint(sr(1,Ie));for(var Pe=j===3?ae.length-1:ae.length,Ce=0;Ce<Pe;Ce++){Ce===1&&j!==1&&z.writeVarint(sr(2,Pe-1));var at=ae[Ce].x-Q,gt=ae[Ce].y-V;z.writeVarint(Or(at)),z.writeVarint(Or(gt)),Q+=at,V+=gt}j===3&&z.writeVarint(sr(7,1))}}function ki(re,z){var R=typeof re;R==="string"?z.writeStringField(1,re):R==="boolean"?z.writeBooleanField(7,re):R==="number"&&(re%1!=0?z.writeDoubleField(3,re):re<0?z.writeSVarintField(6,re):z.writeVarintField(5,re))}nr.exports=wr,Yt.fromVectorTileJs=wr,Yt.fromGeojsonVt=function(re,z){z=z||{};var R={};for(var j in re)R[j]=new ln(re[j].features,z),R[j].name=j,R[j].version=z.version,R[j].extent=z.extent;return wr({layers:R})},Yt.GeoJSONWrapper=ln;const Zr={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:re=>re},Ur=Math.fround||(Vr=new Float32Array(1),re=>(Vr[0]=+re,Vr[0]));var Vr;class $n{constructor(z){this.options=Er(Object.create(Zr),z),this.trees=new Array(this.options.maxZoom+1)}load(z){const{log:R,minZoom:j,maxZoom:Q,nodeSize:V}=this.options;R&&console.time("total time");const H=`prepare ${z.length} points`;R&&console.time(H),this.points=z;let be=[];for(let ae=0;ae<z.length;ae++)z[ae].geometry&&be.push(un(z[ae],ae));this.trees[Q+1]=new c.KDBush(be,Ir,ar,V,Float32Array),R&&console.timeEnd(H);for(let ae=Q;ae>=j;ae--){const Ie=+Date.now();be=this._cluster(be,ae),this.trees[ae]=new c.KDBush(be,Ir,ar,V,Float32Array),R&&console.log("z%d: %d clusters in %dms",ae,be.length,+Date.now()-Ie)}return R&&console.timeEnd("total time"),this}getClusters(z,R){let j=((z[0]+180)%360+360)%360-180;const Q=Math.max(-90,Math.min(90,z[1]));let V=z[2]===180?180:((z[2]+180)%360+360)%360-180;const H=Math.max(-90,Math.min(90,z[3]));if(z[2]-z[0]>=360)j=-180,V=180;else if(j>V){const Pe=this.getClusters([j,Q,180,H],R),Ce=this.getClusters([-180,Q,V,H],R);return Pe.concat(Ce)}const be=this.trees[this._limitZoom(R)],ae=be.range(Nr(j),di(H),Nr(V),di(Q)),Ie=[];for(const Pe of ae){const Ce=be.points[Pe];Ie.push(Ce.numPoints?Tr(Ce):this.points[Ce.index])}return Ie}getChildren(z){const R=this._getOriginId(z),j=this._getOriginZoom(z),Q="No cluster with the specified id.",V=this.trees[j];if(!V)throw new Error(Q);const H=V.points[R];if(!H)throw new Error(Q);const be=this.options.radius/(this.options.extent*Math.pow(2,j-1)),ae=V.within(H.x,H.y,be),Ie=[];for(const Pe of ae){const Ce=V.points[Pe];Ce.parentId===z&&Ie.push(Ce.numPoints?Tr(Ce):this.points[Ce.index])}if(Ie.length===0)throw new Error(Q);return Ie}getLeaves(z,R,j){const Q=[];return this._appendLeaves(Q,z,R=R||10,j=j||0,0),Q}getTile(z,R,j){const Q=this.trees[this._limitZoom(z)],V=Math.pow(2,z),{extent:H,radius:be}=this.options,ae=be/H,Ie=(j-ae)/V,Pe=(j+1+ae)/V,Ce={features:[]};return this._addTileFeatures(Q.range((R-ae)/V,Ie,(R+1+ae)/V,Pe),Q.points,R,j,V,Ce),R===0&&this._addTileFeatures(Q.range(1-ae/V,Ie,1,Pe),Q.points,V,j,V,Ce),R===V-1&&this._addTileFeatures(Q.range(0,Ie,ae/V,Pe),Q.points,-1,j,V,Ce),Ce.features.length?Ce:null}getClusterExpansionZoom(z){let R=this._getOriginZoom(z)-1;for(;R<=this.options.maxZoom;){const j=this.getChildren(z);if(R++,j.length!==1)break;z=j[0].properties.cluster_id}return R}_appendLeaves(z,R,j,Q,V){const H=this.getChildren(R);for(const be of H){const ae=be.properties;if(ae&&ae.cluster?V+ae.point_count<=Q?V+=ae.point_count:V=this._appendLeaves(z,ae.cluster_id,j,Q,V):V<Q?V++:z.push(be),z.length===j)break}return V}_addTileFeatures(z,R,j,Q,V,H){for(const be of z){const ae=R[be],Ie=ae.numPoints;let Pe,Ce,at;if(Ie)Pe=Sr(ae),Ce=ae.x,at=ae.y;else{const Le=this.points[ae.index];Pe=Le.properties,Ce=Nr(Le.geometry.coordinates[0]),at=di(Le.geometry.coordinates[1])}const gt={type:1,geometry:[[Math.round(this.options.extent*(Ce*V-j)),Math.round(this.options.extent*(at*V-Q))]],tags:Pe};let xe;Ie?xe=ae.id:this.options.generateId?xe=ae.index:this.points[ae.index].id&&(xe=this.points[ae.index].id),xe!==void 0&&(gt.id=xe),H.features.push(gt)}}_limitZoom(z){return Math.max(this.options.minZoom,Math.min(Math.floor(+z),this.options.maxZoom+1))}_cluster(z,R){const j=[],{radius:Q,extent:V,reduce:H,minPoints:be}=this.options,ae=Q/(V*Math.pow(2,R));for(let Ie=0;Ie<z.length;Ie++){const Pe=z[Ie];if(Pe.zoom<=R)continue;Pe.zoom=R;const Ce=this.trees[R+1],at=Ce.within(Pe.x,Pe.y,ae),gt=Pe.numPoints||1;let xe=gt;for(const Le of at){const Fe=Ce.points[Le];Fe.zoom>R&&(xe+=Fe.numPoints||1)}if(xe>gt&&xe>=be){let Le=Pe.x*gt,Fe=Pe.y*gt,vt=H&&gt>1?this._map(Pe,!0):null;const Rt=(Ie<<5)+(R+1)+this.points.length;for(const je of at){const It=Ce.points[je];if(It.zoom<=R)continue;It.zoom=R;const Xt=It.numPoints||1;Le+=It.x*Xt,Fe+=It.y*Xt,It.parentId=Rt,H&&(vt||(vt=this._map(Pe,!0)),H(vt,this._map(It)))}Pe.parentId=Rt,j.push(jn(Le/xe,Fe/xe,Rt,xe,vt))}else if(j.push(Pe),xe>1)for(const Le of at){const Fe=Ce.points[Le];Fe.zoom<=R||(Fe.zoom=R,j.push(Fe))}}return j}_getOriginId(z){return z-this.points.length>>5}_getOriginZoom(z){return(z-this.points.length)%32}_map(z,R){if(z.numPoints)return R?Er({},z.properties):z.properties;const j=this.points[z.index].properties,Q=this.options.map(j);return R&&Q===j?Er({},Q):Q}}function jn(re,z,R,j,Q){return{x:Ur(re),y:Ur(z),zoom:1/0,id:R,parentId:-1,numPoints:j,properties:Q}}function un(re,z){const[R,j]=re.geometry.coordinates;return{x:Ur(Nr(R)),y:Ur(di(j)),zoom:1/0,index:z,parentId:-1}}function Tr(re){return{type:"Feature",id:re.id,properties:Sr(re),geometry:{type:"Point",coordinates:[(z=re.x,360*(z-.5)),Gn(re.y)]}};var z}function Sr(re){const z=re.numPoints,R=z>=1e4?`${Math.round(z/1e3)}k`:z>=1e3?Math.round(z/100)/10+"k":z;return Er(Er({},re.properties),{cluster:!0,cluster_id:re.id,point_count:z,point_count_abbreviated:R})}function Nr(re){return re/360+.5}function di(re){const z=Math.sin(re*Math.PI/180),R=.5-.25*Math.log((1+z)/(1-z))/Math.PI;return R<0?0:R>1?1:R}function Gn(re){const z=(180-360*re)*Math.PI/180;return 360*Math.atan(Math.exp(z))/Math.PI-90}function Er(re,z){for(const R in z)re[R]=z[R];return re}function Ir(re){return re.x}function ar(re){return re.y}var pn={};function Oi(re,z){return z?re.properties[z]:re.id}function Xr(re,z){if(re==null)return!0;if(re.type==="Feature")return Oi(re,z)!=null;if(re.type==="FeatureCollection"){const R=new Set;for(const j of re.features){const Q=Oi(j,z);if(Q==null||R.has(Q))return!1;R.add(Q)}return!0}return!1}function Is(re,z){const R=new Map;if(re!=null)if(re.type==="Feature")R.set(Oi(re,z),re);else for(const j of re.features)R.set(Oi(j,z),j);return R}function Wr(re,z){const R=re.tileID.canonical;if(!this._geoJSONIndex)return z(null,null);const j=this._geoJSONIndex.getTile(R.z,R.x,R.y);if(!j)return z(null,null);const Q=new class{constructor(H){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=c.EXTENT,this.length=H.length,this._features=H}feature(H){return new class{constructor(be){this._feature=be,this.extent=c.EXTENT,this.type=be.type,this.properties=be.tags,"id"in be&&!isNaN(be.id)&&(this.id=parseInt(be.id,10))}loadGeometry(){if(this._feature.type===1){const be=[];for(const ae of this._feature.geometry)be.push([new c.pointGeometry(ae[0],ae[1])]);return be}{const be=[];for(const ae of this._feature.geometry){const Ie=[];for(const Pe of ae)Ie.push(new c.pointGeometry(Pe[0],Pe[1]));be.push(Ie)}return be}}toGeoJSON(be,ae,Ie){return Dr.call(this,be,ae,Ie)}}(this._features[H])}}(j.features);let V=Yt(Q);V.byteOffset===0&&V.byteLength===V.buffer.byteLength||(V=new Uint8Array(V)),z(null,{vectorTile:Q,rawData:V.buffer})}({get exports(){return pn},set exports(re){pn=re}}).exports=function(){function re(ee,ne,ce,me){for(var ge,we=me,Se=ce-ne>>1,_e=ce-ne,ke=ee[ne],le=ee[ne+1],et=ee[ce],pt=ee[ce+1],De=ne+3;De<ce;De+=3){var ot=z(ee[De],ee[De+1],ke,le,et,pt);if(ot>we)ge=De,we=ot;else if(ot===we){var _t=Math.abs(De-Se);_t<_e&&(ge=De,_e=_t)}}we>me&&(ge-ne>3&&re(ee,ne,ge,me),ee[ge+2]=we,ce-ge>3&&re(ee,ge,ce,me))}function z(ee,ne,ce,me,ge,we){var Se=ge-ce,_e=we-me;if(Se!==0||_e!==0){var ke=((ee-ce)*Se+(ne-me)*_e)/(Se*Se+_e*_e);ke>1?(ce=ge,me=we):ke>0&&(ce+=Se*ke,me+=_e*ke)}return(Se=ee-ce)*Se+(_e=ne-me)*_e}function R(ee,ne,ce,me){var ge={id:ee===void 0?null:ee,type:ne,geometry:ce,tags:me,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(we){var Se=we.geometry,_e=we.type;if(_e==="Point"||_e==="MultiPoint"||_e==="LineString")j(we,Se);else if(_e==="Polygon"||_e==="MultiLineString")for(var ke=0;ke<Se.length;ke++)j(we,Se[ke]);else if(_e==="MultiPolygon")for(ke=0;ke<Se.length;ke++)for(var le=0;le<Se[ke].length;le++)j(we,Se[ke][le])}(ge),ge}function j(ee,ne){for(var ce=0;ce<ne.length;ce+=3)ee.minX=Math.min(ee.minX,ne[ce]),ee.minY=Math.min(ee.minY,ne[ce+1]),ee.maxX=Math.max(ee.maxX,ne[ce]),ee.maxY=Math.max(ee.maxY,ne[ce+1])}function Q(ee,ne,ce,me){if(ne.geometry){var ge=ne.geometry.coordinates,we=ne.geometry.type,Se=Math.pow(ce.tolerance/((1<<ce.maxZoom)*ce.extent),2),_e=[],ke=ne.id;if(ce.promoteId?ke=ne.properties[ce.promoteId]:ce.generateId&&(ke=me||0),we==="Point")V(ge,_e);else if(we==="MultiPoint")for(var le=0;le<ge.length;le++)V(ge[le],_e);else if(we==="LineString")H(ge,_e,Se,!1);else if(we==="MultiLineString"){if(ce.lineMetrics){for(le=0;le<ge.length;le++)H(ge[le],_e=[],Se,!1),ee.push(R(ke,"LineString",_e,ne.properties));return}be(ge,_e,Se,!1)}else if(we==="Polygon")be(ge,_e,Se,!0);else{if(we!=="MultiPolygon"){if(we==="GeometryCollection"){for(le=0;le<ne.geometry.geometries.length;le++)Q(ee,{id:ke,geometry:ne.geometry.geometries[le],properties:ne.properties},ce,me);return}throw new Error("Input data is not a valid GeoJSON object.")}for(le=0;le<ge.length;le++){var et=[];be(ge[le],et,Se,!0),_e.push(et)}}ee.push(R(ke,we,_e,ne.properties))}}function V(ee,ne){ne.push(ae(ee[0])),ne.push(Ie(ee[1])),ne.push(0)}function H(ee,ne,ce,me){for(var ge,we,Se=0,_e=0;_e<ee.length;_e++){var ke=ae(ee[_e][0]),le=Ie(ee[_e][1]);ne.push(ke),ne.push(le),ne.push(0),_e>0&&(Se+=me?(ge*le-ke*we)/2:Math.sqrt(Math.pow(ke-ge,2)+Math.pow(le-we,2))),ge=ke,we=le}var et=ne.length-3;ne[2]=1,re(ne,0,et,ce),ne[et+2]=1,ne.size=Math.abs(Se),ne.start=0,ne.end=ne.size}function be(ee,ne,ce,me){for(var ge=0;ge<ee.length;ge++){var we=[];H(ee[ge],we,ce,me),ne.push(we)}}function ae(ee){return ee/360+.5}function Ie(ee){var ne=Math.sin(ee*Math.PI/180),ce=.5-.25*Math.log((1+ne)/(1-ne))/Math.PI;return ce<0?0:ce>1?1:ce}function Pe(ee,ne,ce,me,ge,we,Se,_e){if(me/=ne,we>=(ce/=ne)&&Se<me)return ee;if(Se<ce||we>=me)return null;for(var ke=[],le=0;le<ee.length;le++){var et=ee[le],pt=et.geometry,De=et.type,ot=ge===0?et.minX:et.minY,_t=ge===0?et.maxX:et.maxY;if(ot>=ce&&_t<me)ke.push(et);else if(!(_t<ce||ot>=me)){var Ft=[];if(De==="Point"||De==="MultiPoint")Ce(pt,Ft,ce,me,ge);else if(De==="LineString")at(pt,Ft,ce,me,ge,!1,_e.lineMetrics);else if(De==="MultiLineString")xe(pt,Ft,ce,me,ge,!1);else if(De==="Polygon")xe(pt,Ft,ce,me,ge,!0);else if(De==="MultiPolygon")for(var Ot=0;Ot<pt.length;Ot++){var ut=[];xe(pt[Ot],ut,ce,me,ge,!0),ut.length&&Ft.push(ut)}if(Ft.length){if(_e.lineMetrics&&De==="LineString"){for(Ot=0;Ot<Ft.length;Ot++)ke.push(R(et.id,De,Ft[Ot],et.tags));continue}De!=="LineString"&&De!=="MultiLineString"||(Ft.length===1?(De="LineString",Ft=Ft[0]):De="MultiLineString"),De!=="Point"&&De!=="MultiPoint"||(De=Ft.length===3?"Point":"MultiPoint"),ke.push(R(et.id,De,Ft,et.tags))}}}return ke.length?ke:null}function Ce(ee,ne,ce,me,ge){for(var we=0;we<ee.length;we+=3){var Se=ee[we+ge];Se>=ce&&Se<=me&&(ne.push(ee[we]),ne.push(ee[we+1]),ne.push(ee[we+2]))}}function at(ee,ne,ce,me,ge,we,Se){for(var _e,ke,le=gt(ee),et=ge===0?Fe:vt,pt=ee.start,De=0;De<ee.length-3;De+=3){var ot=ee[De],_t=ee[De+1],Ft=ee[De+2],Ot=ee[De+3],ut=ee[De+4],mi=ge===0?ot:_t,li=ge===0?Ot:ut,wt=!1;Se&&(_e=Math.sqrt(Math.pow(ot-Ot,2)+Math.pow(_t-ut,2))),mi<ce?li>ce&&(ke=et(le,ot,_t,Ot,ut,ce),Se&&(le.start=pt+_e*ke)):mi>me?li<me&&(ke=et(le,ot,_t,Ot,ut,me),Se&&(le.start=pt+_e*ke)):Le(le,ot,_t,Ft),li<ce&&mi>=ce&&(ke=et(le,ot,_t,Ot,ut,ce),wt=!0),li>me&&mi<=me&&(ke=et(le,ot,_t,Ot,ut,me),wt=!0),!we&&wt&&(Se&&(le.end=pt+_e*ke),ne.push(le),le=gt(ee)),Se&&(pt+=_e)}var si=ee.length-3;ot=ee[si],_t=ee[si+1],Ft=ee[si+2],(mi=ge===0?ot:_t)>=ce&&mi<=me&&Le(le,ot,_t,Ft),si=le.length-3,we&&si>=3&&(le[si]!==le[0]||le[si+1]!==le[1])&&Le(le,le[0],le[1],le[2]),le.length&&ne.push(le)}function gt(ee){var ne=[];return ne.size=ee.size,ne.start=ee.start,ne.end=ee.end,ne}function xe(ee,ne,ce,me,ge,we){for(var Se=0;Se<ee.length;Se++)at(ee[Se],ne,ce,me,ge,we,!1)}function Le(ee,ne,ce,me){ee.push(ne),ee.push(ce),ee.push(me)}function Fe(ee,ne,ce,me,ge,we){var Se=(we-ne)/(me-ne);return ee.push(we),ee.push(ce+(ge-ce)*Se),ee.push(1),Se}function vt(ee,ne,ce,me,ge,we){var Se=(we-ce)/(ge-ce);return ee.push(ne+(me-ne)*Se),ee.push(we),ee.push(1),Se}function Rt(ee,ne){for(var ce=[],me=0;me<ee.length;me++){var ge,we=ee[me],Se=we.type;if(Se==="Point"||Se==="MultiPoint"||Se==="LineString")ge=je(we.geometry,ne);else if(Se==="MultiLineString"||Se==="Polygon"){ge=[];for(var _e=0;_e<we.geometry.length;_e++)ge.push(je(we.geometry[_e],ne))}else if(Se==="MultiPolygon")for(ge=[],_e=0;_e<we.geometry.length;_e++){for(var ke=[],le=0;le<we.geometry[_e].length;le++)ke.push(je(we.geometry[_e][le],ne));ge.push(ke)}ce.push(R(we.id,Se,ge,we.tags))}return ce}function je(ee,ne){var ce=[];ce.size=ee.size,ee.start!==void 0&&(ce.start=ee.start,ce.end=ee.end);for(var me=0;me<ee.length;me+=3)ce.push(ee[me]+ne,ee[me+1],ee[me+2]);return ce}function It(ee,ne){if(ee.transformed)return ee;var ce,me,ge,we=1<<ee.z,Se=ee.x,_e=ee.y;for(ce=0;ce<ee.features.length;ce++){var ke=ee.features[ce],le=ke.geometry,et=ke.type;if(ke.geometry=[],et===1)for(me=0;me<le.length;me+=2)ke.geometry.push(Xt(le[me],le[me+1],ne,we,Se,_e));else for(me=0;me<le.length;me++){var pt=[];for(ge=0;ge<le[me].length;ge+=2)pt.push(Xt(le[me][ge],le[me][ge+1],ne,we,Se,_e));ke.geometry.push(pt)}}return ee.transformed=!0,ee}function Xt(ee,ne,ce,me,ge,we){return[Math.round(ce*(ee*me-ge)),Math.round(ce*(ne*me-we))]}function ii(ee,ne,ce,me,ge){for(var we=ne===ge.maxZoom?0:ge.tolerance/((1<<ne)*ge.extent),Se={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:ce,y:me,z:ne,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},_e=0;_e<ee.length;_e++){Se.numFeatures++,Bt(Se,ee[_e],we,ge);var ke=ee[_e].minX,le=ee[_e].minY,et=ee[_e].maxX,pt=ee[_e].maxY;ke<Se.minX&&(Se.minX=ke),le<Se.minY&&(Se.minY=le),et>Se.maxX&&(Se.maxX=et),pt>Se.maxY&&(Se.maxY=pt)}return Se}function Bt(ee,ne,ce,me){var ge=ne.geometry,we=ne.type,Se=[];if(we==="Point"||we==="MultiPoint")for(var _e=0;_e<ge.length;_e+=3)Se.push(ge[_e]),Se.push(ge[_e+1]),ee.numPoints++,ee.numSimplified++;else if(we==="LineString")At(Se,ge,ee,ce,!1,!1);else if(we==="MultiLineString"||we==="Polygon")for(_e=0;_e<ge.length;_e++)At(Se,ge[_e],ee,ce,we==="Polygon",_e===0);else if(we==="MultiPolygon")for(var ke=0;ke<ge.length;ke++){var le=ge[ke];for(_e=0;_e<le.length;_e++)At(Se,le[_e],ee,ce,!0,_e===0)}if(Se.length){var et=ne.tags||null;if(we==="LineString"&&me.lineMetrics){for(var pt in et={},ne.tags)et[pt]=ne.tags[pt];et.mapbox_clip_start=ge.start/ge.size,et.mapbox_clip_end=ge.end/ge.size}var De={geometry:Se,type:we==="Polygon"||we==="MultiPolygon"?3:we==="LineString"||we==="MultiLineString"?2:1,tags:et};ne.id!==null&&(De.id=ne.id),ee.features.push(De)}}function At(ee,ne,ce,me,ge,we){var Se=me*me;if(me>0&&ne.size<(ge?Se:me))ce.numPoints+=ne.length/3;else{for(var _e=[],ke=0;ke<ne.length;ke+=3)(me===0||ne[ke+2]>Se)&&(ce.numSimplified++,_e.push(ne[ke]),_e.push(ne[ke+1])),ce.numPoints++;ge&&function(le,et){for(var pt=0,De=0,ot=le.length,_t=ot-2;De<ot;_t=De,De+=2)pt+=(le[De]-le[_t])*(le[De+1]+le[_t+1]);if(pt>0===et)for(De=0,ot=le.length;De<ot/2;De+=2){var Ft=le[De],Ot=le[De+1];le[De]=le[ot-2-De],le[De+1]=le[ot-1-De],le[ot-2-De]=Ft,le[ot-1-De]=Ot}}(_e,we),ee.push(_e)}}function st(ee,ne){var ce=(ne=this.options=function(ge,we){for(var Se in we)ge[Se]=we[Se];return ge}(Object.create(this.options),ne)).debug;if(ce&&console.time("preprocess data"),ne.maxZoom<0||ne.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(ne.promoteId&&ne.generateId)throw new Error("promoteId and generateId cannot be used together.");var me=function(ge,we){var Se=[];if(ge.type==="FeatureCollection")for(var _e=0;_e<ge.features.length;_e++)Q(Se,ge.features[_e],we,_e);else Q(Se,ge.type==="Feature"?ge:{geometry:ge},we);return Se}(ee,ne);this.tiles={},this.tileCoords=[],ce&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",ne.indexMaxZoom,ne.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(me=function(ge,we){var Se=we.buffer/we.extent,_e=ge,ke=Pe(ge,1,-1-Se,Se,0,-1,2,we),le=Pe(ge,1,1-Se,2+Se,0,-1,2,we);return(ke||le)&&(_e=Pe(ge,1,-Se,1+Se,0,-1,2,we)||[],ke&&(_e=Rt(ke,1).concat(_e)),le&&(_e=_e.concat(Rt(le,-1)))),_e}(me,ne)).length&&this.splitTile(me,0,0,0),ce&&(me.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function mn(ee,ne,ce){return 32*((1<<ee)*ce+ne)+ee}return st.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},st.prototype.splitTile=function(ee,ne,ce,me,ge,we,Se){for(var _e=[ee,ne,ce,me],ke=this.options,le=ke.debug;_e.length;){me=_e.pop(),ce=_e.pop(),ne=_e.pop(),ee=_e.pop();var et=1<<ne,pt=mn(ne,ce,me),De=this.tiles[pt];if(!De&&(le>1&&console.time("creation"),De=this.tiles[pt]=ii(ee,ne,ce,me,ke),this.tileCoords.push({z:ne,x:ce,y:me}),le)){le>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",ne,ce,me,De.numFeatures,De.numPoints,De.numSimplified),console.timeEnd("creation"));var ot="z"+ne;this.stats[ot]=(this.stats[ot]||0)+1,this.total++}if(De.source=ee,ge){if(ne===ke.maxZoom||ne===ge)continue;var _t=1<<ge-ne;if(ce!==Math.floor(we/_t)||me!==Math.floor(Se/_t))continue}else if(ne===ke.indexMaxZoom||De.numPoints<=ke.indexMaxPoints)continue;if(De.source=null,ee.length!==0){le>1&&console.time("clipping");var Ft,Ot,ut,mi,li,wt,si=.5*ke.buffer/ke.extent,wi=.5-si,fn=.5+si,Ui=1+si;Ft=Ot=ut=mi=null,li=Pe(ee,et,ce-si,ce+fn,0,De.minX,De.maxX,ke),wt=Pe(ee,et,ce+wi,ce+Ui,0,De.minX,De.maxX,ke),ee=null,li&&(Ft=Pe(li,et,me-si,me+fn,1,De.minY,De.maxY,ke),Ot=Pe(li,et,me+wi,me+Ui,1,De.minY,De.maxY,ke),li=null),wt&&(ut=Pe(wt,et,me-si,me+fn,1,De.minY,De.maxY,ke),mi=Pe(wt,et,me+wi,me+Ui,1,De.minY,De.maxY,ke),wt=null),le>1&&console.timeEnd("clipping"),_e.push(Ft||[],ne+1,2*ce,2*me),_e.push(Ot||[],ne+1,2*ce,2*me+1),_e.push(ut||[],ne+1,2*ce+1,2*me),_e.push(mi||[],ne+1,2*ce+1,2*me+1)}}},st.prototype.getTile=function(ee,ne,ce){var me=this.options,ge=me.extent,we=me.debug;if(ee<0||ee>24)return null;var Se=1<<ee,_e=mn(ee,ne=(ne%Se+Se)%Se,ce);if(this.tiles[_e])return It(this.tiles[_e],ge);we>1&&console.log("drilling down to z%d-%d-%d",ee,ne,ce);for(var ke,le=ee,et=ne,pt=ce;!ke&&le>0;)le--,et=Math.floor(et/2),pt=Math.floor(pt/2),ke=this.tiles[mn(le,et,pt)];return ke&&ke.source?(we>1&&console.log("found parent tile z%d-%d-%d",le,et,pt),we>1&&console.time("drilling down"),this.splitTile(ke.source,le,et,pt,ee,ne,ce),we>1&&console.timeEnd("drilling down"),this.tiles[_e]?It(this.tiles[_e],ge):null):null},function(ee,ne){return new st(ee,ne)}}();class ft extends ti{constructor(z,R,j,Q){super(z,R,j,Wr),this._dataUpdateable=new Map,this.loadGeoJSON=(V,H)=>{const{promoteId:be}=V;if(V.request)return c.getJSON(V.request,(ae,Ie,Pe,Ce)=>{this._dataUpdateable=Xr(Ie,be)?Is(Ie,be):void 0,H(ae,Ie,Pe,Ce)});if(typeof V.data=="string")try{const ae=JSON.parse(V.data);this._dataUpdateable=Xr(ae,be)?Is(ae,be):void 0,H(null,ae)}catch{H(new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`))}else V.dataDiff?this._dataUpdateable?(function(ae,Ie,Pe){var Ce,at,gt,xe;if(Ie.removeAll&&ae.clear(),Ie.remove)for(const Le of Ie.remove)ae.delete(Le);if(Ie.add)for(const Le of Ie.add){const Fe=Oi(Le,Pe);Fe!=null&&ae.set(Fe,Le)}if(Ie.update)for(const Le of Ie.update){let Fe=ae.get(Le.id);if(Fe==null)continue;const vt=!Le.removeAllProperties&&(((Ce=Le.removeProperties)===null||Ce===void 0?void 0:Ce.length)>0||((at=Le.addOrUpdateProperties)===null||at===void 0?void 0:at.length)>0);if((Le.newGeometry||Le.removeAllProperties||vt)&&(Fe={...Fe},ae.set(Le.id,Fe),vt&&(Fe.properties={...Fe.properties})),Le.newGeometry&&(Fe.geometry=Le.newGeometry),Le.removeAllProperties)Fe.properties={};else if(((gt=Le.removeProperties)===null||gt===void 0?void 0:gt.length)>0)for(const Rt of Le.removeProperties)Object.prototype.hasOwnProperty.call(Fe.properties,Rt)&&delete Fe.properties[Rt];if(((xe=Le.addOrUpdateProperties)===null||xe===void 0?void 0:xe.length)>0)for(const{key:Rt,value:je}of Le.addOrUpdateProperties)Fe.properties[Rt]=je}}(this._dataUpdateable,V.dataDiff,be),H(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):H(new Error(`Cannot update existing geojson data in ${V.source}`)):H(new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},Q&&(this.loadGeoJSON=Q)}loadData(z,R){var j;(j=this._pendingRequest)===null||j===void 0||j.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const Q=!!(z&&z.request&&z.request.collectResourceTiming)&&new c.RequestPerformance(z.request);this._pendingCallback=R,this._pendingRequest=this.loadGeoJSON(z,(V,H)=>{if(delete this._pendingCallback,delete this._pendingRequest,V||!H)return R(V);if(typeof H!="object")return R(new Error(`Input data given to '${z.source}' is not a valid GeoJSON object.`));{Dt(H,!0);try{if(z.filter){const ae=c.createExpression(z.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ae.result==="error")throw new Error(ae.value.map(Pe=>`${Pe.key}: ${Pe.message}`).join(", "));const Ie=H.features.filter(Pe=>ae.value.evaluate({zoom:0},Pe));H={type:"FeatureCollection",features:Ie}}this._geoJSONIndex=z.cluster?new $n(function({superclusterOptions:ae,clusterProperties:Ie}){if(!Ie||!ae)return ae;const Pe={},Ce={},at={accumulated:null,zoom:0},gt={properties:null},xe=Object.keys(Ie);for(const Le of xe){const[Fe,vt]=Ie[Le],Rt=c.createExpression(vt),je=c.createExpression(typeof Fe=="string"?[Fe,["accumulated"],["get",Le]]:Fe);Pe[Le]=Rt.value,Ce[Le]=je.value}return ae.map=Le=>{gt.properties=Le;const Fe={};for(const vt of xe)Fe[vt]=Pe[vt].evaluate(at,gt);return Fe},ae.reduce=(Le,Fe)=>{gt.properties=Fe;for(const vt of xe)at.accumulated=Le[vt],Le[vt]=Ce[vt].evaluate(at,gt)},ae}(z)).load(H.features):pn(H,z.geojsonVtOptions)}catch(ae){return R(ae)}this.loaded={};const be={};if(Q){const ae=Q.finish();ae&&(be.resourceTiming={},be.resourceTiming[z.source]=JSON.parse(JSON.stringify(ae)))}R(null,be)}})}reloadTile(z,R){const j=this.loaded;return j&&j[z.uid]?super.reloadTile(z,R):this.loadTile(z,R)}removeSource(z,R){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),R()}getClusterExpansionZoom(z,R){try{R(null,this._geoJSONIndex.getClusterExpansionZoom(z.clusterId))}catch(j){R(j)}}getClusterChildren(z,R){try{R(null,this._geoJSONIndex.getChildren(z.clusterId))}catch(j){R(j)}}getClusterLeaves(z,R){try{R(null,this._geoJSONIndex.getLeaves(z.clusterId,z.limit,z.offset))}catch(j){R(j)}}}class dn{constructor(z){this.self=z,this.actor=new c.Actor(z,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:ti,geojson:ft},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(R,j)=>{if(this.workerSourceTypes[R])throw new Error(`Worker source with name "${R}" already registered.`);this.workerSourceTypes[R]=j},this.self.registerRTLTextPlugin=R=>{if(c.plugin.isParsed())throw new Error("RTL text plugin already registered.");c.plugin.applyArabicShaping=R.applyArabicShaping,c.plugin.processBidirectionalText=R.processBidirectionalText,c.plugin.processStyledBidirectionalText=R.processStyledBidirectionalText}}setReferrer(z,R){this.referrer=R}setImages(z,R,j){this.availableImages[z]=R;for(const Q in this.workerSources[z]){const V=this.workerSources[z][Q];for(const H in V)V[H].availableImages=R}j()}setLayers(z,R,j){this.getLayerIndex(z).replace(R),j()}updateLayers(z,R,j){this.getLayerIndex(z).update(R.layers,R.removedIds),j()}loadTile(z,R,j){this.getWorkerSource(z,R.type,R.source).loadTile(R,j)}loadDEMTile(z,R,j){this.getDEMWorkerSource(z,R.source).loadTile(R,j)}reloadTile(z,R,j){this.getWorkerSource(z,R.type,R.source).reloadTile(R,j)}abortTile(z,R,j){this.getWorkerSource(z,R.type,R.source).abortTile(R,j)}removeTile(z,R,j){this.getWorkerSource(z,R.type,R.source).removeTile(R,j)}removeDEMTile(z,R){this.getDEMWorkerSource(z,R.source).removeTile(R)}removeSource(z,R,j){if(!this.workerSources[z]||!this.workerSources[z][R.type]||!this.workerSources[z][R.type][R.source])return;const Q=this.workerSources[z][R.type][R.source];delete this.workerSources[z][R.type][R.source],Q.removeSource!==void 0?Q.removeSource(R,j):j()}loadWorkerSource(z,R,j){try{this.self.importScripts(R.url),j()}catch(Q){j(Q.toString())}}syncRTLPluginState(z,R,j){try{c.plugin.setState(R);const Q=c.plugin.getPluginURL();if(c.plugin.isLoaded()&&!c.plugin.isParsed()&&Q!=null){this.self.importScripts(Q);const V=c.plugin.isParsed();j(V?void 0:new Error(`RTL Text Plugin failed to import scripts from ${Q}`),V)}}catch(Q){j(Q.toString())}}getAvailableImages(z){let R=this.availableImages[z];return R||(R=[]),R}getLayerIndex(z){let R=this.layerIndexes[z];return R||(R=this.layerIndexes[z]=new lt),R}getWorkerSource(z,R,j){if(this.workerSources[z]||(this.workerSources[z]={}),this.workerSources[z][R]||(this.workerSources[z][R]={}),!this.workerSources[z][R][j]){const Q={send:(V,H,be)=>{this.actor.send(V,H,be,z)}};this.workerSources[z][R][j]=new this.workerSourceTypes[R](Q,this.getLayerIndex(z),this.getAvailableImages(z))}return this.workerSources[z][R][j]}getDEMWorkerSource(z,R){return this.demWorkerSources[z]||(this.demWorkerSources[z]={}),this.demWorkerSources[z][R]||(this.demWorkerSources[z][R]=new Jt),this.demWorkerSources[z][R]}enforceCacheSizeLimit(z,R){c.enforceCacheSizeLimit(R)}}return c.isWorker()&&(self.worker=new dn(self)),dn}),fe(["./shared"],function(c){var ve=Ze;function Ze(o){return!function(t){return typeof window>"u"||typeof document>"u"?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var a,h,p=new Blob([""],{type:"text/javascript"}),m=URL.createObjectURL(p);try{h=new Worker(m),a=!0}catch{a=!1}return h&&h.terminate(),URL.revokeObjectURL(m),a}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var a=document.createElement("canvas");a.width=a.height=1;var h=a.getContext("2d");if(!h)return!1;var p=h.getImageData(0,0,1,1);return p&&p.width===a.width}()?(lt[n=t&&t.failIfMajorPerformanceCaveat]===void 0&&(lt[n]=function(a){var h,p=function(m){var _=document.createElement("canvas"),y=Object.create(Ze.webGLContextAttributes);return y.failIfMajorPerformanceCaveat=m,_.getContext("webgl",y)||_.getContext("experimental-webgl",y)}(a);if(!p)return!1;try{h=p.createShader(p.VERTEX_SHADER)}catch{return!1}return!(!h||p.isContextLost())&&(p.shaderSource(h,"void main() {}"),p.compileShader(h),p.getShaderParameter(h,p.COMPILE_STATUS)===!0)}(n)),lt[n]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var n}(o)}var lt={};Ze.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};var St="3.0.0-pre.3";function Me(o,t){if(Array.isArray(o)){if(!Array.isArray(t)||o.length!==t.length)return!1;for(let n=0;n<o.length;n++)if(!Me(o[n],t[n]))return!1;return!0}if(typeof o=="object"&&o!==null&&t!==null){if(typeof t!="object"||Object.keys(o).length!==Object.keys(t).length)return!1;for(const n in o)if(!Me(o[n],t[n]))return!1;return!0}return o===t}class K{static testProp(t){if(!K.docStyle)return t[0];for(let n=0;n<t.length;n++)if(t[n]in K.docStyle)return t[n];return t[0]}static create(t,n,a){const h=window.document.createElement(t);return n!==void 0&&(h.className=n),a&&a.appendChild(h),h}static createNS(t,n){return window.document.createElementNS(t,n)}static disableDrag(){K.docStyle&&K.selectProp&&(K.userSelect=K.docStyle[K.selectProp],K.docStyle[K.selectProp]="none")}static enableDrag(){K.docStyle&&K.selectProp&&(K.docStyle[K.selectProp]=K.userSelect)}static setTransform(t,n){t.style[K.transformProp]=n}static addEventListener(t,n,a,h={}){t.addEventListener(n,a,"passive"in h?h:h.capture)}static removeEventListener(t,n,a,h={}){t.removeEventListener(n,a,"passive"in h?h:h.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",K.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",K.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",K.suppressClickInternal,!0)},0)}static mousePos(t,n){const a=t.getBoundingClientRect();return new c.pointGeometry(n.clientX-a.left-t.clientLeft,n.clientY-a.top-t.clientTop)}static touchPos(t,n){const a=t.getBoundingClientRect(),h=[];for(let p=0;p<n.length;p++)h.push(new c.pointGeometry(n[p].clientX-a.left-t.clientLeft,n[p].clientY-a.top-t.clientTop));return h}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}K.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,K.selectProp=K.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),K.transformProp=K.testProp(["transform","WebkitTransform"]);class Ye{constructor(t){this._transformRequestFn=t}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}normalizeSpriteURL(t,n,a){const h=function(p){const m=p.match(ti);if(!m)throw new Error(`Unable to parse URL "${p}"`);return{protocol:m[1],authority:m[2],path:m[3]||"/",params:m[4]?m[4].split("&"):[]}}(t);return h.path+=`${n}${a}`,function(p){const m=p.params.length?`?${p.params.join("&")}`:"";return`${p.protocol}://${p.authority}${p.path}${m}`}(h)}setTransformRequest(t){this._transformRequestFn=t}}const ti=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Jt(o){return typeof o=="string"?[{id:"default",url:o}]:o??[]}class Dt{constructor(t,n,a,h){this.context=t,this.format=a,this.texture=t.gl.createTexture(),this.update(n,h)}update(t,n,a){const{width:h,height:p}=t,m=!(this.size&&this.size[0]===h&&this.size[1]===p||a),{context:_}=this,{gl:y}=_;if(this.useMipmap=Boolean(n&&n.useMipmap),y.bindTexture(y.TEXTURE_2D,this.texture),_.pixelStoreUnpackFlipY.set(!1),_.pixelStoreUnpack.set(1),_.pixelStoreUnpackPremultiplyAlpha.set(this.format===y.RGBA&&(!n||n.premultiply!==!1)),m)this.size=[h,p],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||c.isImageBitmap(t)?y.texImage2D(y.TEXTURE_2D,0,this.format,this.format,y.UNSIGNED_BYTE,t):y.texImage2D(y.TEXTURE_2D,0,this.format,h,p,0,this.format,y.UNSIGNED_BYTE,t.data);else{const{x:v,y:S}=a||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||c.isImageBitmap(t)?y.texSubImage2D(y.TEXTURE_2D,0,v,S,y.RGBA,y.UNSIGNED_BYTE,t):y.texSubImage2D(y.TEXTURE_2D,0,v,S,h,p,y.RGBA,y.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&y.generateMipmap(y.TEXTURE_2D)}bind(t,n,a){const{context:h}=this,{gl:p}=h;p.bindTexture(p.TEXTURE_2D,this.texture),a!==p.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(a=p.LINEAR),t!==this.filter&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,t),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,a||t),this.filter=t),n!==this.wrap&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,n),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,n),this.wrap=n)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function Vn(o){const{userImage:t}=o;return!!(t&&t.render&&t.render())&&(o.data.replace(new Uint8Array(t.data.buffer)),!0)}class Ji extends c.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new c.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:n,callback:a}of this.requestors)this._notify(n,a);this.requestors=[]}}getImage(t){return this.images[t]}addImage(t,n){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,n)&&(this.images[t]=n)}_validate(t,n){let a=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new c.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),a=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new c.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),a=!1),this._validateContent(n.content,n)||(this.fire(new c.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),a=!1),a}_validateStretch(t,n){if(!t)return!0;let a=0;for(const h of t){if(h[0]<a||h[1]<h[0]||n<h[1])return!1;a=h[1]}return!0}_validateContent(t,n){return!(t&&(t.length!==4||t[0]<0||n.data.width<t[0]||t[1]<0||n.data.height<t[1]||t[2]<0||n.data.width<t[2]||t[3]<0||n.data.height<t[3]||t[2]<t[0]||t[3]<t[1]))}updateImage(t,n,a=!0){const h=this.images[t];if(a&&(h.data.width!==n.data.width||h.data.height!==n.data.height))throw new Error(`size mismatch between old image (${h.data.width}x${h.data.height}) and new image (${n.data.width}x${n.data.height}).`);n.version=h.version+1,this.images[t]=n,this.updatedImages[t]=!0}removeImage(t){const n=this.images[t];delete this.images[t],delete this.patterns[t],n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t,n){let a=!0;if(!this.isLoaded())for(const h of t)this.images[h]||(a=!1);this.isLoaded()||a?this._notify(t,n):this.requestors.push({ids:t,callback:n})}_notify(t,n){const a={};for(const h of t){this.images[h]||this.fire(new c.Event("styleimagemissing",{id:h}));const p=this.images[h];p?a[h]={data:p.data.clone(),pixelRatio:p.pixelRatio,sdf:p.sdf,version:p.version,stretchX:p.stretchX,stretchY:p.stretchY,content:p.content,hasRenderCallback:Boolean(p.userImage&&p.userImage.render)}:c.warnOnce(`Image "${h}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}n(null,a)}getPixelSize(){const{width:t,height:n}=this.atlasImage;return{width:t,height:n}}getPattern(t){const n=this.patterns[t],a=this.getImage(t);if(!a)return null;if(n&&n.position.version===a.version)return n.position;if(n)n.position.version=a.version;else{const h={w:a.data.width+2,h:a.data.height+2,x:0,y:0},p=new c.ImagePosition(h,a);this.patterns[t]={bin:h,position:p}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const n=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Dt(t,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const p in this.patterns)t.push(this.patterns[p].bin);const{w:n,h:a}=c.potpack(t),h=this.atlasImage;h.resize({width:n||1,height:a||1});for(const p in this.patterns){const{bin:m}=this.patterns[p],_=m.x+1,y=m.y+1,v=this.images[p].data,S=v.width,E=v.height;c.RGBAImage.copy(v,h,{x:0,y:0},{x:_,y},{width:S,height:E}),c.RGBAImage.copy(v,h,{x:0,y:E-1},{x:_,y:y-1},{width:S,height:1}),c.RGBAImage.copy(v,h,{x:0,y:0},{x:_,y:y+E},{width:S,height:1}),c.RGBAImage.copy(v,h,{x:S-1,y:0},{x:_-1,y},{width:1,height:E}),c.RGBAImage.copy(v,h,{x:0,y:0},{x:_+S,y},{width:1,height:E})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const a=this.images[n];a||c.warnOnce(`Image with ID: "${n}" was not found`),Vn(a)&&this.updateImage(n,a)}}}const Dr=1e20;function Yt(o,t,n,a,h,p,m,_,y){for(let v=t;v<t+a;v++)nr(o,n*p+v,p,h,m,_,y);for(let v=n;v<n+h;v++)nr(o,v*p+t,1,a,m,_,y)}function nr(o,t,n,a,h,p,m){p[0]=0,m[0]=-Dr,m[1]=Dr,h[0]=o[t];for(let _=1,y=0,v=0;_<a;_++){h[_]=o[t+_*n];const S=_*_;do{const E=p[y];v=(h[_]-h[E]+S-E*E)/(_-E)/2}while(v<=m[y]&&--y>-1);y++,p[y]=_,m[y]=v,m[y+1]=Dr}for(let _=0,y=0;_<a;_++){for(;m[y+1]<_;)y++;const v=p[y],S=_-v;o[t+_*n]=h[v]+S*S}}class Rr{constructor(t,n){this.requestManager=t,this.localIdeographFontFamily=n,this.entries={}}setURL(t){this.url=t}getGlyphs(t,n){const a=[];for(const h in t)for(const p of t[h])a.push({stack:h,id:p});c.asyncAll(a,({stack:h,id:p},m)=>{let _=this.entries[h];_||(_=this.entries[h]={glyphs:{},requests:{},ranges:{}});let y=_.glyphs[p];if(y!==void 0)return void m(null,{stack:h,id:p,glyph:y});if(y=this._tinySDF(_,h,p),y)return _.glyphs[p]=y,void m(null,{stack:h,id:p,glyph:y});const v=Math.floor(p/256);if(256*v>65535)return void m(new Error("glyphs > 65535 not supported"));if(_.ranges[v])return void m(null,{stack:h,id:p,glyph:y});if(!this.url)return void m(new Error("glyphsUrl is not set"));let S=_.requests[v];S||(S=_.requests[v]=[],Rr.loadGlyphRange(h,v,this.url,this.requestManager,(E,M)=>{if(M){for(const D in M)this._doesCharSupportLocalGlyph(+D)||(_.glyphs[+D]=M[+D]);_.ranges[v]=!0}for(const D of S)D(E,M);delete _.requests[v]})),S.push((E,M)=>{E?m(E):M&&m(null,{stack:h,id:p,glyph:M[p]||null})})},(h,p)=>{if(h)n(h);else if(p){const m={};for(const{stack:_,id:y,glyph:v}of p)(m[_]||(m[_]={}))[y]=v&&{id:v.id,bitmap:v.bitmap.clone(),metrics:v.metrics};n(null,m)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(c.unicodeBlockLookup["CJK Unified Ideographs"](t)||c.unicodeBlockLookup["Hangul Syllables"](t)||c.unicodeBlockLookup.Hiragana(t)||c.unicodeBlockLookup.Katakana(t))}_tinySDF(t,n,a){const h=this.localIdeographFontFamily;if(!h||!this._doesCharSupportLocalGlyph(a))return;let p=t.tinySDF;if(!p){let _="400";/bold/i.test(n)?_="900":/medium/i.test(n)?_="500":/light/i.test(n)&&(_="200"),p=t.tinySDF=new Rr.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:h,fontWeight:_})}const m=p.draw(String.fromCharCode(a));return{id:a,bitmap:new c.AlphaImage({width:m.width||30,height:m.height||30},m.data),metrics:{width:m.glyphWidth||24,height:m.glyphHeight||24,left:m.glyphLeft||0,top:m.glyphTop-27||-8,advance:m.glyphAdvance||24}}}}Rr.loadGlyphRange=function(o,t,n,a,h){const p=256*t,m=p+255,_=a.transformRequest(n.replace("{fontstack}",o).replace("{range}",`${p}-${m}`),c.ResourceType.Glyphs);c.getArrayBuffer(_,(y,v)=>{if(y)h(y);else if(v){const S={};for(const E of c.parseGlyphPbf(v))S[E.id]=E;h(null,S)}})},Rr.TinySDF=class{constructor({fontSize:o=24,buffer:t=3,radius:n=8,cutoff:a=.25,fontFamily:h="sans-serif",fontWeight:p="normal",fontStyle:m="normal"}={}){this.buffer=t,this.cutoff=a,this.radius=n;const _=this.size=o+4*t,y=this._createCanvas(_),v=this.ctx=y.getContext("2d",{willReadFrequently:!0});v.font=`${m} ${p} ${o}px ${h}`,v.textBaseline="alphabetic",v.textAlign="left",v.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_createCanvas(o){const t=document.createElement("canvas");return t.width=t.height=o,t}draw(o){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:a,actualBoundingBoxLeft:h,actualBoundingBoxRight:p}=this.ctx.measureText(o),m=Math.ceil(n),_=Math.min(this.size-this.buffer,Math.ceil(p-h)),y=Math.min(this.size-this.buffer,m+Math.ceil(a)),v=_+2*this.buffer,S=y+2*this.buffer,E=Math.max(v*S,0),M=new Uint8ClampedArray(E),D={data:M,width:v,height:S,glyphWidth:_,glyphHeight:y,glyphTop:m,glyphLeft:0,glyphAdvance:t};if(_===0||y===0)return D;const{ctx:B,buffer:L,gridInner:N,gridOuter:X}=this;B.clearRect(L,L,_,y),B.fillText(o,L,L+m);const q=B.getImageData(L,L,_,y);X.fill(Dr,0,E),N.fill(0,0,E);for(let U=0;U<y;U++)for(let W=0;W<_;W++){const te=q.data[4*(U*_+W)+3]/255;if(te===0)continue;const se=(U+L)*v+W+L;if(te===1)X[se]=0,N[se]=Dr;else{const he=.5-te;X[se]=he>0?he*he:0,N[se]=he<0?he*he:0}}Yt(X,0,0,v,S,v,this.f,this.v,this.z),Yt(N,L,L,_,y,v,this.f,this.v,this.z);for(let U=0;U<E;U++){const W=Math.sqrt(X[U])-Math.sqrt(N[U]);M[U]=Math.round(255-255*(W/this.radius+this.cutoff))}return D}};const Yi=new c.Properties({anchor:new c.DataConstantProperty(c.spec.light.anchor),position:new class{constructor(){this.specification=c.spec.light.position}possiblyEvaluate(o,t){return c.sphericalToCartesian(o.expression.evaluate(t))}interpolate(o,t,n){return{x:c.number(o.x,t.x,n),y:c.number(o.y,t.y,n),z:c.number(o.z,t.z,n)}}},color:new c.DataConstantProperty(c.spec.light.color),intensity:new c.DataConstantProperty(c.spec.light.intensity)}),Nn="-transition";class on extends c.Evented{constructor(t){super(),this._transitionable=new c.Transitionable(Yi),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(c.validateLight,t,n))for(const a in t){const h=t[a];a.endsWith(Nn)?this._transitionable.setTransition(a.slice(0,-Nn.length),h):this._transitionable.setValue(a,h)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,a){return(!a||a.validate!==!1)&&c.emitValidationErrors(this,t.call(c.validateStyle,c.extend({value:n,style:{glyphs:!0,sprite:!0},styleSpec:c.spec})))}}class Br{constructor(t,n){this.width=t,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,n){const a=t.join(",")+String(n);return this.dashEntry[a]||(this.dashEntry[a]=this.addDash(t,n)),this.dashEntry[a]}getDashRanges(t,n,a){const h=[];let p=t.length%2==1?-t[t.length-1]*a:0,m=t[0]*a,_=!0;h.push({left:p,right:m,isDash:_,zeroLength:t[0]===0});let y=t[0];for(let v=1;v<t.length;v++){_=!_;const S=t[v];p=y*a,y+=S,m=y*a,h.push({left:p,right:m,isDash:_,zeroLength:S===0})}return h}addRoundDash(t,n,a){const h=n/2;for(let p=-a;p<=a;p++){const m=this.width*(this.nextRow+a+p);let _=0,y=t[_];for(let v=0;v<this.width;v++){v/y.right>1&&(y=t[++_]);const S=Math.abs(v-y.left),E=Math.abs(v-y.right),M=Math.min(S,E);let D;const B=p/a*(h+1);if(y.isDash){const L=h-Math.abs(B);D=Math.sqrt(M*M+L*L)}else D=h-Math.sqrt(M*M+B*B);this.data[m+v]=Math.max(0,Math.min(255,D+128))}}}addRegularDash(t){for(let _=t.length-1;_>=0;--_){const y=t[_],v=t[_+1];y.zeroLength?t.splice(_,1):v&&v.isDash===y.isDash&&(v.left=y.left,t.splice(_,1))}const n=t[0],a=t[t.length-1];n.isDash===a.isDash&&(n.left=a.left-this.width,a.right=n.right+this.width);const h=this.width*this.nextRow;let p=0,m=t[p];for(let _=0;_<this.width;_++){_/m.right>1&&(m=t[++p]);const y=Math.abs(_-m.left),v=Math.abs(_-m.right),S=Math.min(y,v);this.data[h+_]=Math.max(0,Math.min(255,(m.isDash?S:-S)+128))}}addDash(t,n){const a=n?7:0,h=2*a+1;if(this.nextRow+h>this.height)return c.warnOnce("LineAtlas out of space"),null;let p=0;for(let _=0;_<t.length;_++)p+=t[_];if(p!==0){const _=this.width/p,y=this.getDashRanges(t,this.width,_);n?this.addRoundDash(y,_,a):this.addRegularDash(y)}const m={y:(this.nextRow+a+.5)/this.height,height:2*a/this.height,width:p};return this.nextRow+=h,this.dirty=!0,m}bind(t){const n=t.gl;this.texture?(n.bindTexture(n.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,n.texSubImage2D(n.TEXTURE_2D,0,0,0,this.width,this.height,n.ALPHA,n.UNSIGNED_BYTE,this.data))):(this.texture=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texImage2D(n.TEXTURE_2D,0,n.ALPHA,this.width,this.height,0,n.ALPHA,n.UNSIGNED_BYTE,this.data))}}class Fr{constructor(t,n){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=c.uniqueId();const a=this.workerPool.acquire(this.id);for(let h=0;h<a.length;h++){const p=new Fr.Actor(a[h],n,this.id);p.name=`Worker ${h}`,this.actors.push(p)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n,a){c.asyncAll(this.actors,(h,p)=>{h.send(t,n,p)},a=a||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(t=>{t.remove()}),this.actors=[],this.workerPool.release(this.id)}}function ln(o,t,n){const a=function(h,p){if(h)return n(h);if(p){const m=c.pick(c.extend(p,o),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);p.vector_layers&&(m.vectorLayers=p.vector_layers,m.vectorLayerIds=m.vectorLayers.map(_=>_.id)),n(null,m)}};return o.url?c.getJSON(t.transformRequest(o.url,c.ResourceType.Source),a):c.exported.frame(()=>a(null,o))}Fr.Actor=c.Actor;class wr{constructor(t,n,a){this.bounds=c.LngLatBounds.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=a||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const n=Math.pow(2,t.z),a=Math.floor(c.mercatorXfromLng(this.bounds.getWest())*n),h=Math.floor(c.mercatorYfromLat(this.bounds.getNorth())*n),p=Math.ceil(c.mercatorXfromLng(this.bounds.getEast())*n),m=Math.ceil(c.mercatorYfromLat(this.bounds.getSouth())*n);return t.x>=a&&t.x<p&&t.y>=h&&t.y<m}}class cn extends c.Evented{constructor(t,n,a,h){if(super(),this.id=t,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,c.extend(this,c.pick(n,["url","scheme","tileSize","promoteId"])),this._options=c.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(h)}load(){this._loaded=!1,this.fire(new c.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=ln(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t?this.fire(new c.ErrorEvent(t)):n&&(c.extend(this,n),n.bounds&&(this.tileBounds=new wr(n.bounds,this.minzoom,this.maxzoom)),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return c.extend({},this._options)}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),h={request:this.map._requestManager.transformRequest(a,c.ResourceType.Tile),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function p(m,_){return delete t.request,t.aborted?n(null):m&&m.status!==404?n(m):(_&&_.resourceTiming&&(t.resourceTiming=_.resourceTiming),this.map._refreshExpiredTiles&&_&&t.setExpiryData(_),t.loadVectorData(_,this.map.painter),c.cacheEntryPossiblyAdded(this.dispatcher),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}h.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired"?t.state==="loading"?t.reloadCallback=n:t.request=t.actor.send("reloadTile",h,p.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",h,p.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class hn extends c.Evented{constructor(t,n,a,h){super(),this.id=t,this.dispatcher=a,this.setEventedParent(h),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=c.extend({type:"raster"},n),c.extend(this,c.pick(n,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new c.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=ln(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new c.ErrorEvent(t)):n&&(c.extend(this,n),n.bounds&&(this.tileBounds=new wr(n.bounds,this.minzoom,this.maxzoom)),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return c.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=c.getImage(this.map._requestManager.transformRequest(a,c.ResourceType.Tile),(h,p,m)=>{if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(h)t.state="errored",n(h);else if(p){this.map._refreshExpiredTiles&&t.setExpiryData(m);const _=this.map.painter.context,y=_.gl;t.texture=this.map.painter.getTileTexture(p.width),t.texture?t.texture.update(p,{useMipmap:!0}):(t.texture=new Dt(_,p,y.RGBA,{useMipmap:!0}),t.texture.bind(y.LINEAR,y.CLAMP_TO_EDGE,y.LINEAR_MIPMAP_NEAREST),_.extTextureFilterAnisotropic&&y.texParameterf(y.TEXTURE_2D,_.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,_.extTextureFilterAnisotropicMax)),t.state="loaded",c.cacheEntryPossiblyAdded(this.dispatcher),n(null)}})}abortTile(t,n){t.request&&(t.request.cancel(),delete t.request),n()}unloadTile(t,n){t.texture&&this.map.painter.saveTileTexture(t.texture),n()}hasTransition(){return!1}}let it;class sr extends hn{constructor(t,n,a,h){super(t,n,a,h),this.type="raster-dem",this.maxzoom=22,this._options=c.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function h(p,m){p&&(t.state="errored",n(p)),m&&(t.dem=m,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded",n(null))}t.request=c.getImage(this.map._requestManager.transformRequest(a,c.ResourceType.Tile),function(p,m){if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(p)t.state="errored",n(p);else if(m){this.map._refreshExpiredTiles&&t.setExpiryData(m),delete m.cacheControl,delete m.expires;const _=c.isImageBitmap(m)&&(it==null&&(it=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),it)?m:c.exported.getImageData(m,1),y={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:_,encoding:this.encoding};t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",y,h.bind(this)))}}.bind(this)),t.neighboringTiles=this._getNeighboringTiles(t.tileID)}_getNeighboringTiles(t){const n=t.canonical,a=Math.pow(2,n.z),h=(n.x-1+a)%a,p=n.x===0?t.wrap-1:t.wrap,m=(n.x+1+a)%a,_=n.x+1===a?t.wrap+1:t.wrap,y={};return y[new c.OverscaledTileID(t.overscaledZ,p,n.z,h,n.y).key]={backfilled:!1},y[new c.OverscaledTileID(t.overscaledZ,_,n.z,m,n.y).key]={backfilled:!1},n.y>0&&(y[new c.OverscaledTileID(t.overscaledZ,p,n.z,h,n.y-1).key]={backfilled:!1},y[new c.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},y[new c.OverscaledTileID(t.overscaledZ,_,n.z,m,n.y-1).key]={backfilled:!1}),n.y+1<a&&(y[new c.OverscaledTileID(t.overscaledZ,p,n.z,h,n.y+1).key]={backfilled:!1},y[new c.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},y[new c.OverscaledTileID(t.overscaledZ,_,n.z,m,n.y+1).key]={backfilled:!1}),y}unloadTile(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&t.actor.send("removeDEMTile",{uid:t.uid,source:this.id})}}class Or extends c.Evented{constructor(t,n,a,h){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=a.getActor(),this.setEventedParent(h),this._data=n.data,this._options=c.extend({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;const p=c.EXTENT/this.tileSize;this.workerOptions=c.extend({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*p,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*p,extent:c.EXTENT,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:n.clusterMaxZoom!==void 0?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:c.EXTENT,radius:(n.clusterRadius||50)*p,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}load(){this._updateWorkerData()}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData(),this}updateData(t){return this._updateWorkerData(t),this}getClusterExpansionZoom(t,n){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},n),this}getClusterChildren(t,n){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},n),this}getClusterLeaves(t,n,a,h){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:n,offset:a},h),this}_updateWorkerData(t){const n=c.extend({},this.workerOptions);t?n.dataDiff=t:typeof this._data=="string"?(n.request=this.map._requestManager.transformRequest(c.exported.resolveURL(this._data),c.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new c.Event("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,n,(a,h)=>{if(this._pendingLoads--,this._removed||h&&h.abandoned)return void this.fire(new c.Event("dataabort",{dataType:"source"}));let p=null;if(h&&h.resourceTiming&&h.resourceTiming[this.id]&&(p=h.resourceTiming[this.id].slice(0)),a)return void this.fire(new c.ErrorEvent(a));const m={dataType:"source"};this._collectResourceTiming&&p&&p.length>0&&c.extend(m,{resourceTiming:p}),this.fire(new c.Event("data",{...m,sourceDataType:"metadata"})),this.fire(new c.Event("data",{...m,sourceDataType:"content"}))})}loaded(){return this._pendingLoads===0}loadTile(t,n){const a=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const h={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.request=this.actor.send(a,h,(p,m)=>(delete t.request,t.unloadVectorData(),t.aborted?n(null):p?n(p):(t.loadVectorData(m,this.map.painter,a==="reloadTile"),n(null))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return c.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var qr=c.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class ki extends c.Evented{constructor(t,n,a,h){super(),this.id=t,this.dispatcher=a,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(h),this.options=n}load(t,n){this._loaded=!1,this.fire(new c.Event("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=c.getImage(this.map._requestManager.transformRequest(this.url,c.ResourceType.Image),(a,h)=>{this._request=null,this._loaded=!0,a?this.fire(new c.ErrorEvent(a)):h&&(this.image=h,t&&(this.coordinates=t),n&&n(),this._finishLoading())})}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=t.url,this.load(t.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(t){this.coordinates=t;const n=t.map(c.MercatorCoordinate.fromLngLat);this.tileID=function(h){let p=1/0,m=1/0,_=-1/0,y=-1/0;for(const M of h)p=Math.min(p,M.x),m=Math.min(m,M.y),_=Math.max(_,M.x),y=Math.max(y,M.y);const v=Math.max(_-p,y-m),S=Math.max(0,Math.floor(-Math.log(v)/Math.LN2)),E=Math.pow(2,S);return new c.CanonicalTileID(S,Math.floor((p+_)/2*E),Math.floor((m+y)/2*E))}(n),this.minzoom=this.maxzoom=this.tileID.z;const a=n.map(h=>this.tileID.getTilePoint(h)._round());return this._boundsArray=new c.RasterBoundsArray,this._boundsArray.emplaceBack(a[0].x,a[0].y,0,0),this._boundsArray.emplaceBack(a[1].x,a[1].y,c.EXTENT,0),this._boundsArray.emplaceBack(a[3].x,a[3].y,0,c.EXTENT),this._boundsArray.emplaceBack(a[2].x,a[2].y,c.EXTENT,c.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,qr.members)),this.boundsSegments||(this.boundsSegments=c.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Dt(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const a in this.tiles){const h=this.tiles[a];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture)}}loadTile(t,n){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},n(null)):(t.state="errored",n(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Zr extends ki{constructor(t,n,a,h){super(t,n,a,h),this.roundZoom=!0,this.type="video",this.options=n}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push(this.map._requestManager.transformRequest(n,c.ResourceType.Source).url);c.getVideo(this.urls,(n,a)=>{this._loaded=!0,n?this.fire(new c.ErrorEvent(n)):a&&(this.video=a,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;t<n.start(0)||t>n.end(0)?this.fire(new c.ErrorEvent(new c.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,qr.members)),this.boundsSegments||(this.boundsSegments=c.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new Dt(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const a in this.tiles){const h=this.tiles[a];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Ur extends ki{constructor(t,n,a,h){super(t,n,a,h),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(p=>!Array.isArray(p)||p.length!==2||p.some(m=>typeof m!="number"))||this.fire(new c.ErrorEvent(new c.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new c.ErrorEvent(new c.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new c.ErrorEvent(new c.ValidationError(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new c.ErrorEvent(new c.ValidationError(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new c.ErrorEvent(new c.ValidationError(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new c.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const n=this.map.painter.context,a=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,qr.members)),this.boundsSegments||(this.boundsSegments=c.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Dt(n,this.canvas,a.RGBA,{premultiply:!0});for(const h in this.tiles){const p=this.tiles[h];p.state!=="loaded"&&(p.state="loaded",p.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const Vr={vector:cn,raster:hn,"raster-dem":sr,geojson:Or,video:Zr,image:ki,canvas:Ur};function $n(o,t){const n=c.create();return c.translate(n,n,[1,1,0]),c.scale(n,n,[.5*o.width,.5*o.height,1]),c.multiply(n,n,o.calculatePosMatrix(t.toUnwrapped()))}function jn(o,t,n,a,h,p){const m=function(E,M,D){if(E)for(const B of E){const L=M[B];if(L&&L.source===D&&L.type==="fill-extrusion")return!0}else for(const B in M){const L=M[B];if(L.source===D&&L.type==="fill-extrusion")return!0}return!1}(h&&h.layers,t,o.id),_=p.maxPitchScaleFactor(),y=o.tilesIn(a,_,m);y.sort(un);const v=[];for(const E of y)v.push({wrappedTileID:E.tileID.wrapped().key,queryResults:E.tile.queryRenderedFeatures(t,n,o._state,E.queryGeometry,E.cameraQueryGeometry,E.scale,h,p,_,$n(o.transform,E.tileID))});const S=function(E){const M={},D={};for(const B of E){const L=B.queryResults,N=B.wrappedTileID,X=D[N]=D[N]||{};for(const q in L){const U=L[q],W=X[q]=X[q]||{},te=M[q]=M[q]||[];for(const se of U)W[se.featureIndex]||(W[se.featureIndex]=!0,te.push(se))}}return M}(v);for(const E in S)S[E].forEach(M=>{const D=M.feature,B=o.getFeatureState(D.layer["source-layer"],D.id);D.source=D.layer.source,D.layer["source-layer"]&&(D.sourceLayer=D.layer["source-layer"]),D.state=B});return S}function un(o,t){const n=o.tileID,a=t.tileID;return n.overscaledZ-a.overscaledZ||n.canonical.y-a.canonical.y||n.wrap-a.wrap||n.canonical.x-a.canonical.x}class Tr{constructor(t,n){this.tileID=t,this.uid=c.uniqueId(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){const n=t+this.timeAdded;n<c.exported.now()||this.fadeEndTime&&n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,n,a){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(h,p){const m={};if(!p)return m;for(const _ of h){const y=_.layerIds.map(v=>p.getLayer(v)).filter(Boolean);if(y.length!==0){_.layers=y,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(v=>y.filter(S=>S.id===v)[0]));for(const v of y)m[v.id]=_}}return m}(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const h in this.buckets){const p=this.buckets[h];if(p instanceof c.SymbolBucket){if(this.hasSymbolBuckets=!0,!a)break;p.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const h in this.buckets){const p=this.buckets[h];if(p instanceof c.SymbolBucket&&p.hasRTLText){this.hasRTLText=!0,c.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const h in this.buckets){const p=this.buckets[h];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(h).queryRadius(p))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new c.CollisionBoxArray}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const a in this.buckets){const h=this.buckets[a];h.uploadPending()&&h.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Dt(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Dt(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,a,h,p,m,_,y,v,S){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:h,cameraQueryGeometry:p,scale:m,tileSize:this.tileSize,pixelPosMatrix:S,transform:y,params:_,queryPadding:this.queryPadding*v},t,n,a):{}}querySourceFeatures(t,n){const a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;const h=a.loadVTLayers(),p=n&&n.sourceLayer?n.sourceLayer:"",m=h._geojsonTileLayer||h[p];if(!m)return;const _=c.createFilter(n&&n.filter),{z:y,x:v,y:S}=this.tileID.canonical,E={z:y,x:v,y:S};for(let M=0;M<m.length;M++){const D=m.feature(M);if(_.needGeometry){const N=c.toEvaluationFeature(D,!0);if(!_.filter(new c.EvaluationParameters(this.tileID.overscaledZ),N,this.tileID.canonical))continue}else if(!_.filter(new c.EvaluationParameters(this.tileID.overscaledZ),D))continue;const B=a.getId(D,p),L=new c.GeoJSONFeature(D,y,v,S,B);L.tile=E,t.push(L)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const n=this.expirationTime;if(t.cacheControl){const a=c.parseCacheControl(t.cacheControl);a["max-age"]&&(this.expirationTime=Date.now()+1e3*a["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const a=Date.now();let h=!1;if(this.expirationTime>a)h=!1;else if(n)if(this.expirationTime<n)h=!0;else{const p=this.expirationTime-n;p?this.expirationTime=a+Math.max(p,3e4):h=!0}else h=!0;h?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(t,n){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(t).length===0)return;const a=this.latestFeatureIndex.loadVTLayers();for(const h in this.buckets){if(!n.style.hasLayer(h))continue;const p=this.buckets[h],m=p.layers[0].sourceLayer||"_geojsonTileLayer",_=a[m],y=t[m];if(!_||!y||Object.keys(y).length===0)continue;p.update(y,_,this.imageAtlas&&this.imageAtlas.patternPositions||{});const v=n&&n.style&&n.style.getLayer(h);v&&(this.queryPadding=Math.max(this.queryPadding,v.queryRadius(p)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<c.exported.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=c.exported.now()+t}setDependencies(t,n){const a={};for(const h of n)a[h]=!0;this.dependencies[t]=a}hasDependency(t,n){for(const a of t){const h=this.dependencies[a];if(h){for(const p of n)if(h[p])return!0}}return!1}}class Sr{constructor(t,n){this.max=t,this.onRemove=n,this.reset()}reset(){for(const t in this.data)for(const n of this.data[t])n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value);return this.data={},this.order=[],this}add(t,n,a){const h=t.wrapped().key;this.data[h]===void 0&&(this.data[h]=[]);const p={value:n,timeout:void 0};if(a!==void 0&&(p.timeout=setTimeout(()=>{this.remove(t,p)},a)),this.data[h].push(p),this.order.push(h),this.order.length>this.max){const m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const n=this.data[t].shift();return n.timeout&&clearTimeout(n.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),n.value}getByKey(t){const n=this.data[t];return n?n[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,n){if(!this.has(t))return this;const a=t.wrapped().key,h=n===void 0?0:this.data[a].indexOf(n),p=this.data[a][h];return this.data[a].splice(h,1),p.timeout&&clearTimeout(p.timeout),this.data[a].length===0&&delete this.data[a],this.onRemove(p.value),this.order.splice(this.order.indexOf(a),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(t){const n=[];for(const a in this.data)for(const h of this.data[a])t(h.value)||n.push(h);for(const a of n)this.remove(a.value.tileID,a)}}class Nr{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,a){const h=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][h]=this.stateChanges[t][h]||{},c.extend(this.stateChanges[t][h],a),this.deletedStates[t]===null){this.deletedStates[t]={};for(const p in this.state[t])p!==h&&(this.deletedStates[t][p]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][h]===null){this.deletedStates[t][h]={};for(const p in this.state[t][h])a[p]||(this.deletedStates[t][h][p]=null)}else for(const p in a)this.deletedStates[t]&&this.deletedStates[t][h]&&this.deletedStates[t][h][p]===null&&delete this.deletedStates[t][h][p]}removeFeatureState(t,n,a){if(this.deletedStates[t]===null)return;const h=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},a&&n!==void 0)this.deletedStates[t][h]!==null&&(this.deletedStates[t][h]=this.deletedStates[t][h]||{},this.deletedStates[t][h][a]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][h])for(a in this.deletedStates[t][h]={},this.stateChanges[t][h])this.deletedStates[t][h][a]=null;else this.deletedStates[t][h]=null;else this.deletedStates[t]=null}getState(t,n){const a=String(n),h=c.extend({},(this.state[t]||{})[a],(this.stateChanges[t]||{})[a]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const p=this.deletedStates[t][n];if(p===null)return{};for(const m in p)delete h[m]}return h}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const a={};for(const h in this.stateChanges){this.state[h]=this.state[h]||{};const p={};for(const m in this.stateChanges[h])this.state[h][m]||(this.state[h][m]={}),c.extend(this.state[h][m],this.stateChanges[h][m]),p[m]=this.state[h][m];a[h]=p}for(const h in this.deletedStates){this.state[h]=this.state[h]||{};const p={};if(this.deletedStates[h]===null)for(const m in this.state[h])p[m]={},this.state[h][m]={};else for(const m in this.deletedStates[h]){if(this.deletedStates[h][m]===null)this.state[h][m]={};else for(const _ of Object.keys(this.deletedStates[h][m]))delete this.state[h][m][_];p[m]=this.state[h][m]}a[h]=a[h]||{},c.extend(a[h],p)}if(this.stateChanges={},this.deletedStates={},Object.keys(a).length!==0)for(const h in t)t[h].setFeatureState(a,n)}}class di extends c.Evented{constructor(t,n,a){super(),this.id=t,this.dispatcher=a,this.on("data",h=>{h.dataType==="source"&&h.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&h.dataType==="source"&&h.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain))}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=function(h,p,m,_){const y=new Vr[p.type](h,p,m,_);if(y.id!==h)throw new Error(`Expected Source id to be ${h} instead of ${y.id}`);return c.bindAll(["load","abort","unload","serialize","prepare"],y),y}(t,n,a,this),this._tiles={},this._cache=new Sr(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Nr}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const t in this._tiles){const n=this._tiles[t];if(n.state!=="loaded"&&n.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,n){return this._source.loadTile(t,n)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,()=>{}),this._source.fire(new c.Event("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const n in this._tiles){const a=this._tiles[n];a.upload(t),a.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(Gn).map(t=>t.key)}getRenderableIds(t){const n=[];for(const a in this._tiles)this._isIdRenderable(a,t)&&n.push(this._tiles[a]);return t?n.sort((a,h)=>{const p=a.tileID,m=h.tileID,_=new c.pointGeometry(p.canonical.x,p.canonical.y)._rotate(this.transform.angle),y=new c.pointGeometry(m.canonical.x,m.canonical.y)._rotate(this.transform.angle);return p.overscaledZ-m.overscaledZ||y.y-_.y||y.x-_.x}).map(a=>a.tileID.key):n.map(a=>a.tileID).sort(Gn).map(a=>a.key)}hasRenderableParent(t){const n=this.findLoadedParent(t,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(t,n){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(n||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}}_reloadTile(t,n){const a=this._tiles[t];a&&(a.state!=="loading"&&(a.state=n),this._loadTile(a,this._tileLoaded.bind(this,a,t,n)))}_tileLoaded(t,n,a,h){if(h)return t.state="errored",void(h.status!==404?this._source.fire(new c.ErrorEvent(h,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=c.exported.now(),a==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new c.Event("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const n=this.getRenderableIds();for(let h=0;h<n.length;h++){const p=n[h];if(t.neighboringTiles&&t.neighboringTiles[p]){const m=this.getTileByID(p);a(t,m),a(m,t)}}function a(h,p){h.needsHillshadePrepare=!0,h.needsTerrainPrepare=!0;let m=p.tileID.canonical.x-h.tileID.canonical.x;const _=p.tileID.canonical.y-h.tileID.canonical.y,y=Math.pow(2,h.tileID.canonical.z),v=p.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)),p.dem&&h.dem&&(h.dem.backfillBorder(p.dem,m,_),h.neighboringTiles&&h.neighboringTiles[v]&&(h.neighboringTiles[v].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,a,h){for(const p in this._tiles){let m=this._tiles[p];if(h[p]||!m.hasData()||m.tileID.overscaledZ<=n||m.tileID.overscaledZ>a)continue;let _=m.tileID;for(;m&&m.tileID.overscaledZ>n+1;){const v=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[v.key],m&&m.hasData()&&(_=v)}let y=_;for(;y.overscaledZ>n;)if(y=y.scaledTo(y.overscaledZ-1),t[y.key]){h[_.key]=_;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const a=this._loadedParentTiles[t.key];return a&&a.tileID.overscaledZ>=n?a:null}for(let a=t.overscaledZ-1;a>=n;a--){const h=t.scaledTo(a),p=this._getLoadedTile(h);if(p)return p}}_getLoadedTile(t){const n=this._tiles[t.key];return n&&n.hasData()?n:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const n=Math.ceil(t.width/this._source.tileSize)+1,a=Math.ceil(t.height/this._source.tileSize)+1,h=Math.floor(n*a*5),p=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,h):h;this._cache.setMaxSize(p)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const a={};for(const h in this._tiles){const p=this._tiles[h];p.tileID=p.tileID.unwrapTo(p.tileID.wrap+n),a[p.tileID.key]=p}this._tiles=a;for(const h in this._timers)clearTimeout(this._timers[h]),delete this._timers[h];for(const h in this._tiles)this._setTileReloadTimer(h,this._tiles[h])}}update(t,n){if(this.transform=t,this.terrain=n,!this._sourceLoaded||this._paused)return;let a;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?a=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(v=>new c.OverscaledTileID(v.canonical.z,v.wrap,v.canonical.z,v.canonical.x,v.canonical.y)):(a=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n}),this._source.hasTile&&(a=a.filter(v=>this._source.hasTile(v)))):a=[];const h=t.coveringZoomLevel(this._source),p=Math.max(h-di.maxOverzooming,this._source.minzoom),m=Math.max(h+di.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const v={};for(const S of a)if(S.canonical.z>this._source.minzoom){const E=S.scaledTo(S.canonical.z-1);v[E.key]=E;const M=S.scaledTo(Math.max(this._source.minzoom,Math.min(S.canonical.z,5)));v[M.key]=M}a=a.concat(Object.values(v))}const _=this._updateRetainedTiles(a,h);if(Er(this._source.type)){const v={},S={},E=Object.keys(_);for(const M of E){const D=_[M],B=this._tiles[M];if(!B||B.fadeEndTime&&B.fadeEndTime<=c.exported.now())continue;const L=this.findLoadedParent(D,p);L&&(this._addTile(L.tileID),v[L.tileID.key]=L.tileID),S[M]=D}this._retainLoadedChildren(S,h,m,_);for(const M in v)_[M]||(this._coveredTiles[M]=!0,_[M]=v[M]);if(n){const M={},D={};for(const B of a)this._tiles[B.key].hasData()?M[B.key]=B:D[B.key]=B;for(const B in D){const L=D[B].children(this._source.maxzoom);this._tiles[L[0].key]&&this._tiles[L[1].key]&&this._tiles[L[2].key]&&this._tiles[L[3].key]&&(M[L[0].key]=_[L[0].key]=L[0],M[L[1].key]=_[L[1].key]=L[1],M[L[2].key]=_[L[2].key]=L[2],M[L[3].key]=_[L[3].key]=L[3],delete D[B])}for(const B in D){const L=this.findLoadedParent(D[B],this._source.minzoom);if(L){M[L.tileID.key]=_[L.tileID.key]=L.tileID;for(const N in M)M[N].isChildOf(L.tileID)&&delete M[N]}}for(const B in this._tiles)M[B]||(this._coveredTiles[B]=!0)}}for(const v in _)this._tiles[v].clearFadeHold();const y=c.keysDifference(this._tiles,_);for(const v of y){const S=this._tiles[v];S.hasSymbolBuckets&&!S.holdingForFade()?S.setHoldDuration(this.map._fadeDuration):S.hasSymbolBuckets&&!S.symbolFadeFinished()||this._removeTile(v)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){const a={},h={},p=Math.max(n-di.maxOverzooming,this._source.minzoom),m=Math.max(n+di.maxUnderzooming,this._source.minzoom),_={};for(const y of t){const v=this._addTile(y);a[y.key]=y,v.hasData()||n<this._source.maxzoom&&(_[y.key]=y)}this._retainLoadedChildren(_,n,m,a);for(const y of t){let v=this._tiles[y.key];if(v.hasData())continue;if(n+1>this._source.maxzoom){const E=y.children(this._source.maxzoom)[0],M=this.getTile(E);if(M&&M.hasData()){a[E.key]=E;continue}}else{const E=y.children(this._source.maxzoom);if(a[E[0].key]&&a[E[1].key]&&a[E[2].key]&&a[E[3].key])continue}let S=v.wasRequested();for(let E=y.overscaledZ-1;E>=p;--E){const M=y.scaledTo(E);if(h[M.key]||(h[M.key]=!0,v=this.getTile(M),!v&&S&&(v=this._addTile(M)),v&&(a[M.key]=M,S=v.wasRequested(),v.hasData())))break}}return a}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let a,h=this._tiles[t].tileID;for(;h.overscaledZ>0;){if(h.key in this._loadedParentTiles){a=this._loadedParentTiles[h.key];break}n.push(h.key);const p=h.scaledTo(h.overscaledZ-1);if(a=this._getLoadedTile(p),a)break;h=p}for(const p of n)this._loadedParentTiles[p]=a}}_addTile(t){let n=this._tiles[t.key];if(n)return n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));const a=n;return n||(n=new Tr(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))),n.uses++,this._tiles[t.key]=n,a||this._source.fire(new c.Event("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const a=n.getExpiryTimeout();a&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},a))}_removeTile(t){const n=this._tiles[t];n&&(n.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,n,a){const h=[],p=this.transform;if(!p)return h;const m=a?p.getCameraQueryGeometry(t):t,_=t.map(B=>p.pointCoordinate(B,this.terrain)),y=m.map(B=>p.pointCoordinate(B,this.terrain)),v=this.getIds();let S=1/0,E=1/0,M=-1/0,D=-1/0;for(const B of y)S=Math.min(S,B.x),E=Math.min(E,B.y),M=Math.max(M,B.x),D=Math.max(D,B.y);for(let B=0;B<v.length;B++){const L=this._tiles[v[B]];if(L.holdingForFade())continue;const N=L.tileID,X=Math.pow(2,p.zoom-L.tileID.overscaledZ),q=n*L.queryPadding*c.EXTENT/L.tileSize/X,U=[N.getTilePoint(new c.MercatorCoordinate(S,E)),N.getTilePoint(new c.MercatorCoordinate(M,D))];if(U[0].x-q<c.EXTENT&&U[0].y-q<c.EXTENT&&U[1].x+q>=0&&U[1].y+q>=0){const W=_.map(se=>N.getTilePoint(se)),te=y.map(se=>N.getTilePoint(se));h.push({tile:L,tileID:N,queryGeometry:W,cameraQueryGeometry:te,scale:X})}}return h}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map(a=>this._tiles[a].tileID);for(const a of n)a.posMatrix=this.transform.calculatePosMatrix(a.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(Er(this._source.type))for(const t in this._tiles){const n=this._tiles[t];if(n.fadeEndTime!==void 0&&n.fadeEndTime>=c.exported.now())return!0}return!1}setFeatureState(t,n,a){this._state.updateState(t=t||"_geojsonTileLayer",n,a)}removeFeatureState(t,n,a){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,a)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,a){const h=this._tiles[t];h&&h.setDependencies(n,a)}reloadTilesForDependencies(t,n){for(const a in this._tiles)this._tiles[a].hasDependency(t,n)&&this._reloadTile(a,"reloading");this._cache.filter(a=>!a.hasDependency(t,n))}}function Gn(o,t){const n=Math.abs(2*o.wrap)-+(o.wrap<0),a=Math.abs(2*t.wrap)-+(t.wrap<0);return o.overscaledZ-t.overscaledZ||a-n||t.canonical.y-o.canonical.y||t.canonical.x-o.canonical.x}function Er(o){return o==="raster"||o==="image"||o==="video"}di.maxOverzooming=10,di.maxUnderzooming=3;const Ir="mapboxgl_preloaded_worker_pool";class ar{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<ar.workerCount;)this.workers.push(new Worker(ms.workerUrl));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach(n=>{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Ir]}numActive(){return Object.keys(this.active).length}}const pn=Math.floor(c.exported.hardwareConcurrency/2);let Oi;function Xr(){return Oi||(Oi=new ar),Oi}function Is(o,t){const n={};for(const a in o)a!=="ref"&&(n[a]=o[a]);return c.refProperties.forEach(a=>{a in t&&(n[a]=t[a])}),n}function Wr(o){o=o.slice();const t=Object.create(null);for(let n=0;n<o.length;n++)t[o[n].id]=o[n];for(let n=0;n<o.length;n++)"ref"in o[n]&&(o[n]=Is(o[n],t[o[n].ref]));return o}ar.workerCount=Math.max(Math.min(pn,6),1);const ft={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function dn(o,t,n){n.push({command:ft.addSource,args:[o,t[o]]})}function re(o,t,n){t.push({command:ft.removeSource,args:[o]}),n[o]=!0}function z(o,t,n,a){re(o,n,a),dn(o,t,n)}function R(o,t,n){let a;for(a in o[n])if(Object.prototype.hasOwnProperty.call(o[n],a)&&a!=="data"&&!Me(o[n][a],t[n][a]))return!1;for(a in t[n])if(Object.prototype.hasOwnProperty.call(t[n],a)&&a!=="data"&&!Me(o[n][a],t[n][a]))return!1;return!0}function j(o,t,n,a,h,p){let m;for(m in t=t||{},o=o||{})Object.prototype.hasOwnProperty.call(o,m)&&(Me(o[m],t[m])||n.push({command:p,args:[a,m,t[m],h]}));for(m in t)Object.prototype.hasOwnProperty.call(t,m)&&!Object.prototype.hasOwnProperty.call(o,m)&&(Me(o[m],t[m])||n.push({command:p,args:[a,m,t[m],h]}))}function Q(o){return o.id}function V(o,t){return o[t.id]=t,o}class H{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],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(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=c.clamp(t,0,1);let n=1,a=this._distances[n];const h=t*this.paddedLength+this.padding;for(;a<h&&n<this._distances.length;)a=this._distances[++n];const p=n-1,m=this._distances[p],_=a-m,y=_>0?(h-m)/_:0;return this.points[p].mult(1-y).add(this.points[n].mult(y))}}function be(o,t){let n=!0;return o==="always"||o!=="never"&&t!=="never"||(n=!1),n}class ae{constructor(t,n,a){const h=this.boxCells=[],p=this.circleCells=[];this.xCellCount=Math.ceil(t/a),this.yCellCount=Math.ceil(n/a);for(let m=0;m<this.xCellCount*this.yCellCount;m++)h.push([]),p.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=n,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,n,a,h,p){this._forEachCell(n,a,h,p,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(a),this.bboxes.push(h),this.bboxes.push(p)}insertCircle(t,n,a,h){this._forEachCell(n-h,a-h,n+h,a+h,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(a),this.circles.push(h)}_insertBoxCell(t,n,a,h,p,m){this.boxCells[p].push(m)}_insertCircleCell(t,n,a,h,p,m){this.circleCells[p].push(m)}_query(t,n,a,h,p,m,_){if(a<0||t>this.width||h<0||n>this.height)return[];const y=[];if(t<=0&&n<=0&&this.width<=a&&this.height<=h){if(p)return[{key:null,x1:t,y1:n,x2:a,y2:h}];for(let v=0;v<this.boxKeys.length;v++)y.push({key:this.boxKeys[v],x1:this.bboxes[4*v],y1:this.bboxes[4*v+1],x2:this.bboxes[4*v+2],y2:this.bboxes[4*v+3]});for(let v=0;v<this.circleKeys.length;v++){const S=this.circles[3*v],E=this.circles[3*v+1],M=this.circles[3*v+2];y.push({key:this.circleKeys[v],x1:S-M,y1:E-M,x2:S+M,y2:E+M})}}else this._forEachCell(t,n,a,h,this._queryCell,y,{hitTest:p,overlapMode:m,seenUids:{box:{},circle:{}}},_);return y}query(t,n,a,h){return this._query(t,n,a,h,!1,null)}hitTest(t,n,a,h,p,m){return this._query(t,n,a,h,!0,p,m).length>0}hitTestCircle(t,n,a,h,p){const m=t-a,_=t+a,y=n-a,v=n+a;if(_<0||m>this.width||v<0||y>this.height)return!1;const S=[];return this._forEachCell(m,y,_,v,this._queryCellCircle,S,{hitTest:!0,overlapMode:h,circle:{x:t,y:n,radius:a},seenUids:{box:{},circle:{}}},p),S.length>0}_queryCell(t,n,a,h,p,m,_,y){const{seenUids:v,hitTest:S,overlapMode:E}=_,M=this.boxCells[p];if(M!==null){const B=this.bboxes;for(const L of M)if(!v.box[L]){v.box[L]=!0;const N=4*L,X=this.boxKeys[L];if(t<=B[N+2]&&n<=B[N+3]&&a>=B[N+0]&&h>=B[N+1]&&(!y||y(X))&&(!S||!be(E,X.overlapMode))&&(m.push({key:X,x1:B[N],y1:B[N+1],x2:B[N+2],y2:B[N+3]}),S))return!0}}const D=this.circleCells[p];if(D!==null){const B=this.circles;for(const L of D)if(!v.circle[L]){v.circle[L]=!0;const N=3*L,X=this.circleKeys[L];if(this._circleAndRectCollide(B[N],B[N+1],B[N+2],t,n,a,h)&&(!y||y(X))&&(!S||!be(E,X.overlapMode))){const q=B[N],U=B[N+1],W=B[N+2];if(m.push({key:X,x1:q-W,y1:U-W,x2:q+W,y2:U+W}),S)return!0}}}return!1}_queryCellCircle(t,n,a,h,p,m,_,y){const{circle:v,seenUids:S,overlapMode:E}=_,M=this.boxCells[p];if(M!==null){const B=this.bboxes;for(const L of M)if(!S.box[L]){S.box[L]=!0;const N=4*L,X=this.boxKeys[L];if(this._circleAndRectCollide(v.x,v.y,v.radius,B[N+0],B[N+1],B[N+2],B[N+3])&&(!y||y(X))&&!be(E,X.overlapMode))return m.push(!0),!0}}const D=this.circleCells[p];if(D!==null){const B=this.circles;for(const L of D)if(!S.circle[L]){S.circle[L]=!0;const N=3*L,X=this.circleKeys[L];if(this._circlesCollide(B[N],B[N+1],B[N+2],v.x,v.y,v.radius)&&(!y||y(X))&&!be(E,X.overlapMode))return m.push(!0),!0}}}_forEachCell(t,n,a,h,p,m,_,y){const v=this._convertToXCellCoord(t),S=this._convertToYCellCoord(n),E=this._convertToXCellCoord(a),M=this._convertToYCellCoord(h);for(let D=v;D<=E;D++)for(let B=S;B<=M;B++)if(p.call(this,t,n,a,h,this.xCellCount*B+D,m,_,y))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,n,a,h,p,m){const _=h-t,y=p-n,v=a+m;return v*v>_*_+y*y}_circleAndRectCollide(t,n,a,h,p,m,_){const y=(m-h)/2,v=Math.abs(t-(h+y));if(v>y+a)return!1;const S=(_-p)/2,E=Math.abs(n-(p+S));if(E>S+a)return!1;if(v<=y||E<=S)return!0;const M=v-y,D=E-S;return M*M+D*D<=a*a}}function Ie(o,t,n,a,h){const p=c.create();return t?(c.scale(p,p,[1/h,1/h,1]),n||c.rotateZ(p,p,a.angle)):c.multiply(p,a.labelPlaneMatrix,o),p}function Pe(o,t,n,a,h){if(t){const p=c.clone(o);return c.scale(p,p,[h,h,1]),n||c.rotateZ(p,p,-a.angle),p}return a.glCoordMatrix}function Ce(o,t,n){let a;n?(a=[o.x,o.y,n(o.x,o.y),1],c.transformMat4(a,a,t)):(a=[o.x,o.y,0,1],ii(a,a,t));const h=a[3];return{point:new c.pointGeometry(a[0]/h,a[1]/h),signedDistanceFromCamera:h}}function at(o,t){return .5+o/t*.5}function gt(o,t){const n=o[0]/o[3],a=o[1]/o[3];return n>=-t[0]&&n<=t[0]&&a>=-t[1]&&a<=t[1]}function xe(o,t,n,a,h,p,m,_,y,v){const S=a?o.textSizeData:o.iconSizeData,E=c.evaluateSizeForZoom(S,n.transform.zoom),M=[256/n.width*2+1,256/n.height*2+1],D=a?o.text.dynamicLayoutVertexArray:o.icon.dynamicLayoutVertexArray;D.clear();const B=o.lineVertexArray,L=a?o.text.placedSymbolArray:o.icon.placedSymbolArray,N=n.transform.width/n.transform.height;let X=!1;for(let q=0;q<L.length;q++){const U=L.get(q);if(U.hidden||U.writingMode===c.WritingMode.vertical&&!X){Xt(U.numGlyphs,D);continue}let W;if(X=!1,v?(W=[U.anchorX,U.anchorY,v(U.anchorX,U.anchorY),1],c.transformMat4(W,W,t)):(W=[U.anchorX,U.anchorY,0,1],ii(W,W,t)),!gt(W,M)){Xt(U.numGlyphs,D);continue}const te=at(n.transform.cameraToCenterDistance,W[3]),se=c.evaluateSizeForFeature(S,E,U),he=m?se/te:se*te,de=new c.pointGeometry(U.anchorX,U.anchorY),Te=Ce(de,h,v).point,ye={},Ae=vt(U,he,!1,_,t,h,p,o.glyphOffsetArray,B,D,Te,de,ye,N,y,v);X=Ae.useVertical,(Ae.notEnoughRoom||X||Ae.needsFlipping&&vt(U,he,!0,_,t,h,p,o.glyphOffsetArray,B,D,Te,de,ye,N,y,v).notEnoughRoom)&&Xt(U.numGlyphs,D)}a?o.text.dynamicLayoutVertexBuffer.updateData(D):o.icon.dynamicLayoutVertexBuffer.updateData(D)}function Le(o,t,n,a,h,p,m,_,y,v,S,E,M){const D=_.glyphStartIndex+_.numGlyphs,B=_.lineStartIndex,L=_.lineStartIndex+_.lineLength,N=t.getoffsetX(_.glyphStartIndex),X=t.getoffsetX(D-1),q=je(o*N,n,a,h,p,m,_.segment,B,L,y,v,S,E,M);if(!q)return null;const U=je(o*X,n,a,h,p,m,_.segment,B,L,y,v,S,E,M);return U?{first:q,last:U}:null}function Fe(o,t,n,a){return o===c.WritingMode.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*a?{useVertical:!0}:(o===c.WritingMode.vertical?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function vt(o,t,n,a,h,p,m,_,y,v,S,E,M,D,B,L){const N=t/24,X=o.lineOffsetX*N,q=o.lineOffsetY*N;let U;if(o.numGlyphs>1){const W=o.glyphStartIndex+o.numGlyphs,te=o.lineStartIndex,se=o.lineStartIndex+o.lineLength,he=Le(N,_,X,q,n,S,E,o,y,p,M,B,L);if(!he)return{notEnoughRoom:!0};const de=Ce(he.first.point,m,L).point,Te=Ce(he.last.point,m,L).point;if(a&&!n){const ye=Fe(o.writingMode,de,Te,D);if(ye)return ye}U=[he.first];for(let ye=o.glyphStartIndex+1;ye<W-1;ye++)U.push(je(N*_.getoffsetX(ye),X,q,n,S,E,o.segment,te,se,y,p,M,B,L));U.push(he.last)}else{if(a&&!n){const te=Ce(E,h,L).point,se=o.lineStartIndex+o.segment+1,he=new c.pointGeometry(y.getx(se),y.gety(se)),de=Ce(he,h,L),Te=de.signedDistanceFromCamera>0?de.point:Rt(E,he,te,1,h,L),ye=Fe(o.writingMode,te,Te,D);if(ye)return ye}const W=je(N*_.getoffsetX(o.glyphStartIndex),X,q,n,S,E,o.segment,o.lineStartIndex,o.lineStartIndex+o.lineLength,y,p,M,B,L);if(!W)return{notEnoughRoom:!0};U=[W]}for(const W of U)c.addDynamicAttributes(v,W.point,W.angle);return{}}function Rt(o,t,n,a,h,p){const m=Ce(o.add(o.sub(t)._unit()),h,p).point,_=n.sub(m);return n.add(_._mult(a/_.mag()))}function je(o,t,n,a,h,p,m,_,y,v,S,E,M,D){const B=a?o-t:o+t;let L=B>0?1:-1,N=0;a&&(L*=-1,N=Math.PI),L<0&&(N+=Math.PI);let X=L>0?_+m:_+m+1,q=h,U=h,W=0,te=0;const se=Math.abs(B),he=[];for(;W+te<=se;){if(X+=L,X<_||X>=y)return null;if(U=q,he.push(q),q=E[X],q===void 0){const Ge=new c.pointGeometry(v.getx(X),v.gety(X)),rt=Ce(Ge,S,D);if(rt.signedDistanceFromCamera>0)q=E[X]=rt.point;else{const nt=X-L;q=Rt(W===0?p:new c.pointGeometry(v.getx(nt),v.gety(nt)),Ge,U,se-W+1,S,D)}}W+=te,te=U.dist(q)}const de=(se-W)/te,Te=q.sub(U),ye=Te.mult(de)._add(U);ye._add(Te._unit()._perp()._mult(n*L));const Ae=N+Math.atan2(q.y-U.y,q.x-U.x);return he.push(ye),{point:ye,angle:M?Ae:0,path:he}}const It=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Xt(o,t){for(let n=0;n<o;n++){const a=t.length;t.resize(a+4),t.float32.set(It,3*a)}}function ii(o,t,n){const a=t[0],h=t[1];return o[0]=n[0]*a+n[4]*h+n[12],o[1]=n[1]*a+n[5]*h+n[13],o[3]=n[3]*a+n[7]*h+n[15],o}const Bt=100;class At{constructor(t,n=new ae(t.width+200,t.height+200,25),a=new ae(t.width+200,t.height+200,25)){this.transform=t,this.grid=n,this.ignoredGrid=a,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+Bt,this.screenBottomBoundary=t.height+Bt,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,n,a,h,p,m){const _=this.projectAndGetPerspectiveRatio(h,t.anchorPointX,t.anchorPointY,m),y=a*_.perspectiveRatio,v=t.x1*y+_.point.x,S=t.y1*y+_.point.y,E=t.x2*y+_.point.x,M=t.y2*y+_.point.y;return!this.isInsideGrid(v,S,E,M)||n!=="always"&&this.grid.hitTest(v,S,E,M,n,p)||_.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[v,S,E,M],offscreen:this.isOffscreen(v,S,E,M)}}placeCollisionCircles(t,n,a,h,p,m,_,y,v,S,E,M,D,B){const L=[],N=new c.pointGeometry(n.anchorX,n.anchorY),X=Ce(N,m,B),q=at(this.transform.cameraToCenterDistance,X.signedDistanceFromCamera),U=(S?p/q:p*q)/c.ONE_EM,W=Ce(N,_,B).point,te=Le(U,h,n.lineOffsetX*U,n.lineOffsetY*U,!1,W,N,n,a,_,{},!1,B);let se=!1,he=!1,de=!0;if(te){const Te=.5*M*q+D,ye=new c.pointGeometry(-100,-100),Ae=new c.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),Ge=new H,rt=te.first,nt=te.last;let He=[];for(let mt=rt.path.length-1;mt>=1;mt--)He.push(rt.path[mt]);for(let mt=1;mt<nt.path.length;mt++)He.push(nt.path[mt]);const Mt=2.5*Te;if(y){const mt=He.map(yt=>Ce(yt,y,B));He=mt.some(yt=>yt.signedDistanceFromCamera<=0)?[]:mt.map(yt=>yt.point)}let Tt=[];if(He.length>0){const mt=He[0].clone(),yt=He[0].clone();for(let bt=1;bt<He.length;bt++)mt.x=Math.min(mt.x,He[bt].x),mt.y=Math.min(mt.y,He[bt].y),yt.x=Math.max(yt.x,He[bt].x),yt.y=Math.max(yt.y,He[bt].y);Tt=mt.x>=ye.x&&yt.x<=Ae.x&&mt.y>=ye.y&&yt.y<=Ae.y?[He]:yt.x<ye.x||mt.x>Ae.x||yt.y<ye.y||mt.y>Ae.y?[]:c.clipLine([He],ye.x,ye.y,Ae.x,Ae.y)}for(const mt of Tt){Ge.reset(mt,.25*Te);let yt=0;yt=Ge.length<=.5*Te?1:Math.ceil(Ge.paddedLength/Mt)+1;for(let bt=0;bt<yt;bt++){const Ei=bt/Math.max(yt-1,1),xr=Ge.lerp(Ei),hr=xr.x+Bt,Nt=xr.y+Bt;L.push(hr,Nt,Te,0);const jr=hr-Te,Ii=Nt-Te,Ai=hr+Te,Qr=Nt+Te;if(de=de&&this.isOffscreen(jr,Ii,Ai,Qr),he=he||this.isInsideGrid(jr,Ii,Ai,Qr),t!=="always"&&this.grid.hitTestCircle(hr,Nt,Te,t,E)&&(se=!0,!v))return{circles:[],offscreen:!1,collisionDetected:se}}}}return{circles:!v&&se||!he||q<this.perspectiveRatioCutoff?[]:L,offscreen:de,collisionDetected:se}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[];let a=1/0,h=1/0,p=-1/0,m=-1/0;for(const S of t){const E=new c.pointGeometry(S.x+Bt,S.y+Bt);a=Math.min(a,E.x),h=Math.min(h,E.y),p=Math.max(p,E.x),m=Math.max(m,E.y),n.push(E)}const _=this.grid.query(a,h,p,m).concat(this.ignoredGrid.query(a,h,p,m)),y={},v={};for(const S of _){const E=S.key;if(y[E.bucketInstanceId]===void 0&&(y[E.bucketInstanceId]={}),y[E.bucketInstanceId][E.featureIndex])continue;const M=[new c.pointGeometry(S.x1,S.y1),new c.pointGeometry(S.x2,S.y1),new c.pointGeometry(S.x2,S.y2),new c.pointGeometry(S.x1,S.y2)];c.polygonIntersectsPolygon(n,M)&&(y[E.bucketInstanceId][E.featureIndex]=!0,v[E.bucketInstanceId]===void 0&&(v[E.bucketInstanceId]=[]),v[E.bucketInstanceId].push(E.featureIndex))}return v}insertCollisionBox(t,n,a,h,p,m){(a?this.ignoredGrid:this.grid).insert({bucketInstanceId:h,featureIndex:p,collisionGroupID:m,overlapMode:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,a,h,p,m){const _=a?this.ignoredGrid:this.grid,y={bucketInstanceId:h,featureIndex:p,collisionGroupID:m,overlapMode:n};for(let v=0;v<t.length;v+=4)_.insertCircle(y,t[v],t[v+1],t[v+2])}projectAndGetPerspectiveRatio(t,n,a,h){let p;return h?(p=[n,a,h(n,a),1],c.transformMat4(p,p,t)):(p=[n,a,0,1],ii(p,p,t)),{point:new c.pointGeometry((p[0]/p[3]+1)/2*this.transform.width+Bt,(-p[1]/p[3]+1)/2*this.transform.height+Bt),perspectiveRatio:.5+this.transform.cameraToCenterDistance/p[3]*.5}}isOffscreen(t,n,a,h){return a<Bt||t>=this.screenRightBoundary||h<Bt||n>this.screenBottomBoundary}isInsideGrid(t,n,a,h){return a>=0&&t<this.gridRightBoundary&&h>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=c.identity([]);return c.translate(t,t,[-100,-100,0]),t}}function st(o,t,n){return t*(c.EXTENT/(o.tileSize*Math.pow(2,n-o.tileID.overscaledZ)))}class mn{constructor(t,n,a,h){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):h&&a?1:0,this.placed=a}isHidden(){return this.opacity===0&&!this.placed}}class ee{constructor(t,n,a,h,p){this.text=new mn(t?t.text:null,n,a,p),this.icon=new mn(t?t.icon:null,n,h,p)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class ne{constructor(t,n,a){this.text=t,this.icon=n,this.skipFade=a}}class ce{constructor(){this.invProjMatrix=c.create(),this.viewportMatrix=c.create(),this.circles=[]}}class me{constructor(t,n,a,h,p){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=a,this.bucketIndex=h,this.tileID=p}}class ge{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const n=++this.maxGroupID;this.collisionGroups[t]={ID:n,predicate:a=>a.collisionGroupID===n}}return this.collisionGroups[t]}}function we(o,t,n,a,h){const{horizontalAlign:p,verticalAlign:m}=c.getAnchorAlignment(o),_=-(p-.5)*t,y=-(m-.5)*n,v=c.evaluateVariableOffset(o,a);return new c.pointGeometry(_+v[0]*h,y+v[1]*h)}function Se(o,t,n,a,h,p){const{x1:m,x2:_,y1:y,y2:v,anchorPointX:S,anchorPointY:E}=o,M=new c.pointGeometry(t,n);return a&&M._rotate(h?p:-p),{x1:m+M.x,y1:y+M.y,x2:_+M.x,y2:v+M.y,anchorPointX:S,anchorPointY:E}}class _e{constructor(t,n,a,h,p){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new At(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new ge(h),this.collisionCircleArrays={},this.prevPlacement=p,p&&(p.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,a,h){const p=a.getBucket(n),m=a.latestFeatureIndex;if(!p||!m||n.id!==p.layerIds[0])return;const _=a.collisionBoxArray,y=p.layers[0].layout,v=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),S=a.tileSize/c.EXTENT,E=this.transform.calculatePosMatrix(a.tileID.toUnwrapped()),M=y.get("text-pitch-alignment")==="map",D=y.get("text-rotation-alignment")==="map",B=st(a,1,this.transform.zoom),L=Ie(E,M,D,this.transform,B);let N=null;if(M){const q=Pe(E,M,D,this.transform,B);N=c.multiply([],this.transform.labelPlaneMatrix,q)}this.retainedQueryData[p.bucketInstanceId]=new me(p.bucketInstanceId,m,p.sourceLayerIndex,p.index,a.tileID);const X={bucket:p,layout:y,posMatrix:E,textLabelPlaneMatrix:L,labelToScreenMatrix:N,scale:v,textPixelRatio:S,holdingForFade:a.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:c.evaluateSizeForZoom(p.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(p.sourceID)};if(h)for(const q of p.sortKeyRanges){const{sortKey:U,symbolInstanceStart:W,symbolInstanceEnd:te}=q;t.push({sortKey:U,symbolInstanceStart:W,symbolInstanceEnd:te,parameters:X})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:p.symbolInstances.length,parameters:X})}attemptAnchorPlacement(t,n,a,h,p,m,_,y,v,S,E,M,D,B,L,N){const X=[M.textOffset0,M.textOffset1],q=we(t,a,h,X,p),U=this.collisionIndex.placeCollisionBox(Se(n,q.x,q.y,m,_,this.transform.angle),E,y,v,S.predicate,N);if((!L||this.collisionIndex.placeCollisionBox(Se(L,q.x,q.y,m,_,this.transform.angle),E,y,v,S.predicate,N).box.length!==0)&&U.box.length>0){let W;if(this.prevPlacement&&this.prevPlacement.variableOffsets[M.crossTileID]&&this.prevPlacement.placements[M.crossTileID]&&this.prevPlacement.placements[M.crossTileID].text&&(W=this.prevPlacement.variableOffsets[M.crossTileID].anchor),M.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[M.crossTileID]={textOffset:X,width:a,height:h,anchor:t,textBoxScale:p,prevAnchor:W},this.markUsedJustification(D,t,M,B),D.allowVerticalPlacement&&(this.markUsedOrientation(D,B,M),this.placedOrientations[M.crossTileID]=B),{shift:q,placedGlyphBoxes:U}}}placeLayerBucketPart(t,n,a){const{bucket:h,layout:p,posMatrix:m,textLabelPlaneMatrix:_,labelToScreenMatrix:y,textPixelRatio:v,holdingForFade:S,collisionBoxArray:E,partiallyEvaluatedTextSize:M,collisionGroup:D}=t.parameters,B=p.get("text-optional"),L=p.get("icon-optional"),N=c.getOverlapMode(p,"text-overlap","text-allow-overlap"),X=N==="always",q=c.getOverlapMode(p,"icon-overlap","icon-allow-overlap"),U=q==="always",W=p.get("text-rotation-alignment")==="map",te=p.get("text-pitch-alignment")==="map",se=p.get("icon-text-fit")!=="none",he=p.get("symbol-z-order")==="viewport-y",de=X&&(U||!h.hasIconData()||L),Te=U&&(X||!h.hasTextData()||B);!h.collisionArrays&&E&&h.deserializeCollisionBoxes(E);const ye=(Ae,Ge)=>{if(n[Ae.crossTileID])return;if(S)return void(this.placements[Ae.crossTileID]=new ne(!1,!1,!1));let rt=!1,nt=!1,He=!0,Mt=null,Tt={box:null,offscreen:null},mt={box:null,offscreen:null},yt=null,bt=null,Ei=null,xr=0,hr=0,Nt=0;Ge.textFeatureIndex?xr=Ge.textFeatureIndex:Ae.useRuntimeCollisionCircles&&(xr=Ae.featureIndex),Ge.verticalTextFeatureIndex&&(hr=Ge.verticalTextFeatureIndex);const jr=this.retainedQueryData[h.bucketInstanceId].tileID,Ii=this.terrain?(Qt,$t)=>this.terrain.getElevation(jr,Qt,$t):null;for(const Qt of["textBox","verticalTextBox","iconBox","verticalIconBox"]){const $t=Ge[Qt];$t&&($t.elevation=Ii?Ii($t.anchorPointX,$t.anchorPointY):0)}const Ai=Ge.textBox;if(Ai){const Qt=Et=>{let ci=c.WritingMode.horizontal;if(h.allowVerticalPlacement&&!Et&&this.prevPlacement){const Li=this.prevPlacement.placedOrientations[Ae.crossTileID];Li&&(this.placedOrientations[Ae.crossTileID]=Li,ci=Li,this.markUsedOrientation(h,ci,Ae))}return ci},$t=(Et,ci)=>{if(h.allowVerticalPlacement&&Ae.numVerticalGlyphVertices>0&&Ge.verticalTextBox){for(const Li of h.writingModes)if(Li===c.WritingMode.vertical?(Tt=ci(),mt=Tt):Tt=Et(),Tt&&Tt.box&&Tt.box.length)break}else Tt=Et()};if(p.get("text-variable-anchor")){let Et=p.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Ae.crossTileID]){const jt=this.prevPlacement.variableOffsets[Ae.crossTileID];Et.indexOf(jt.anchor)>0&&(Et=Et.filter(tr=>tr!==jt.anchor),Et.unshift(jt.anchor))}const ci=(jt,tr,ir)=>{const zn=jt.x2-jt.x1,Js=jt.y2-jt.y1,dl=Ae.textBoxScale,pc=se&&q==="never"?tr:null;let en={box:[],offscreen:!1};const fs=N!=="never"?2*Et.length:Et.length;for(let Ar=0;Ar<fs;++Ar){const ur=this.attemptAnchorPlacement(Et[Ar%Et.length],jt,zn,Js,dl,W,te,v,m,D,Ar>=Et.length?N:"never",Ae,h,ir,pc,Ii);if(ur&&(en=ur.placedGlyphBoxes,en&&en.box&&en.box.length)){rt=!0,Mt=ur.shift;break}}return en};$t(()=>ci(Ai,Ge.iconBox,c.WritingMode.horizontal),()=>{const jt=Ge.verticalTextBox;return h.allowVerticalPlacement&&!(Tt&&Tt.box&&Tt.box.length)&&Ae.numVerticalGlyphVertices>0&&jt?ci(jt,Ge.verticalIconBox,c.WritingMode.vertical):{box:null,offscreen:null}}),Tt&&(rt=Tt.box,He=Tt.offscreen);const Li=Qt(Tt&&Tt.box);if(!rt&&this.prevPlacement){const jt=this.prevPlacement.variableOffsets[Ae.crossTileID];jt&&(this.variableOffsets[Ae.crossTileID]=jt,this.markUsedJustification(h,jt.anchor,Ae,Li))}}else{const Et=(ci,Li)=>{const jt=this.collisionIndex.placeCollisionBox(ci,N,v,m,D.predicate,Ii);return jt&&jt.box&&jt.box.length&&(this.markUsedOrientation(h,Li,Ae),this.placedOrientations[Ae.crossTileID]=Li),jt};$t(()=>Et(Ai,c.WritingMode.horizontal),()=>{const ci=Ge.verticalTextBox;return h.allowVerticalPlacement&&Ae.numVerticalGlyphVertices>0&&ci?Et(ci,c.WritingMode.vertical):{box:null,offscreen:null}}),Qt(Tt&&Tt.box&&Tt.box.length)}}if(yt=Tt,rt=yt&&yt.box&&yt.box.length>0,He=yt&&yt.offscreen,Ae.useRuntimeCollisionCircles){const Qt=h.text.placedSymbolArray.get(Ae.centerJustifiedTextSymbolIndex),$t=c.evaluateSizeForFeature(h.textSizeData,M,Qt),Et=p.get("text-padding");bt=this.collisionIndex.placeCollisionCircles(N,Qt,h.lineVertexArray,h.glyphOffsetArray,$t,m,_,y,a,te,D.predicate,Ae.collisionCircleDiameter,Et,Ii),bt.circles.length&&bt.collisionDetected&&!a&&c.warnOnce("Collisions detected, but collision boxes are not shown"),rt=X||bt.circles.length>0&&!bt.collisionDetected,He=He&&bt.offscreen}if(Ge.iconFeatureIndex&&(Nt=Ge.iconFeatureIndex),Ge.iconBox){const Qt=$t=>{const Et=se&&Mt?Se($t,Mt.x,Mt.y,W,te,this.transform.angle):$t;return this.collisionIndex.placeCollisionBox(Et,q,v,m,D.predicate,Ii)};mt&&mt.box&&mt.box.length&&Ge.verticalIconBox?(Ei=Qt(Ge.verticalIconBox),nt=Ei.box.length>0):(Ei=Qt(Ge.iconBox),nt=Ei.box.length>0),He=He&&Ei.offscreen}const Qr=B||Ae.numHorizontalGlyphVertices===0&&Ae.numVerticalGlyphVertices===0,kn=L||Ae.numIconVertices===0;if(Qr||kn?kn?Qr||(nt=nt&&rt):rt=nt&&rt:nt=rt=nt&&rt,rt&&yt&&yt.box&&this.collisionIndex.insertCollisionBox(yt.box,N,p.get("text-ignore-placement"),h.bucketInstanceId,mt&&mt.box&&hr?hr:xr,D.ID),nt&&Ei&&this.collisionIndex.insertCollisionBox(Ei.box,q,p.get("icon-ignore-placement"),h.bucketInstanceId,Nt,D.ID),bt&&(rt&&this.collisionIndex.insertCollisionCircles(bt.circles,N,p.get("text-ignore-placement"),h.bucketInstanceId,xr,D.ID),a)){const Qt=h.bucketInstanceId;let $t=this.collisionCircleArrays[Qt];$t===void 0&&($t=this.collisionCircleArrays[Qt]=new ce);for(let Et=0;Et<bt.circles.length;Et+=4)$t.circles.push(bt.circles[Et+0]),$t.circles.push(bt.circles[Et+1]),$t.circles.push(bt.circles[Et+2]),$t.circles.push(bt.collisionDetected?1:0)}if(Ae.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(h.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Ae.crossTileID]=new ne(rt||de,nt||Te,He||h.justReloaded),n[Ae.crossTileID]=!0};if(he){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ae=h.getSortedSymbolIndexes(this.transform.angle);for(let Ge=Ae.length-1;Ge>=0;--Ge){const rt=Ae[Ge];ye(h.symbolInstances.get(rt),h.collisionArrays[rt])}}else for(let Ae=t.symbolInstanceStart;Ae<t.symbolInstanceEnd;Ae++)ye(h.symbolInstances.get(Ae),h.collisionArrays[Ae]);if(a&&h.bucketInstanceId in this.collisionCircleArrays){const Ae=this.collisionCircleArrays[h.bucketInstanceId];c.invert(Ae.invProjMatrix,m),Ae.viewportMatrix=this.collisionIndex.getViewportMatrix()}h.justReloaded=!1}markUsedJustification(t,n,a,h){let p;p=h===c.WritingMode.vertical?a.verticalPlacedTextSymbolIndex:{left:a.leftJustifiedTextSymbolIndex,center:a.centerJustifiedTextSymbolIndex,right:a.rightJustifiedTextSymbolIndex}[c.getAnchorJustification(n)];const m=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex,a.verticalPlacedTextSymbolIndex];for(const _ of m)_>=0&&(t.text.placedSymbolArray.get(_).crossTileID=p>=0&&_!==p?0:a.crossTileID)}markUsedOrientation(t,n,a){const h=n===c.WritingMode.horizontal||n===c.WritingMode.horizontalOnly?n:0,p=n===c.WritingMode.vertical?n:0,m=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex];for(const _ of m)t.text.placedSymbolArray.get(_).placedOrientation=h;a.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).placedOrientation=p)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let a=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const h=n?n.symbolFadeChange(t):1,p=n?n.opacities:{},m=n?n.variableOffsets:{},_=n?n.placedOrientations:{};for(const y in this.placements){const v=this.placements[y],S=p[y];S?(this.opacities[y]=new ee(S,h,v.text,v.icon),a=a||v.text!==S.text.placed||v.icon!==S.icon.placed):(this.opacities[y]=new ee(null,h,v.text,v.icon,v.skipFade),a=a||v.text||v.icon)}for(const y in p){const v=p[y];if(!this.opacities[y]){const S=new ee(v,h,!1,!1);S.isHidden()||(this.opacities[y]=S,a=a||v.text.placed||v.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(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");a?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const a={};for(const h of n){const p=h.getBucket(t);p&&h.latestFeatureIndex&&t.id===p.layerIds[0]&&this.updateBucketOpacities(p,a,h.collisionBoxArray)}}updateBucketOpacities(t,n,a){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const h=t.layers[0].layout,p=new ee(null,0,!1,!1,!0),m=h.get("text-allow-overlap"),_=h.get("icon-allow-overlap"),y=h.get("text-variable-anchor"),v=h.get("text-rotation-alignment")==="map",S=h.get("text-pitch-alignment")==="map",E=h.get("icon-text-fit")!=="none",M=new ee(null,0,m&&(_||!t.hasIconData()||h.get("icon-optional")),_&&(m||!t.hasTextData()||h.get("text-optional")),!0);!t.collisionArrays&&a&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(a);const D=(B,L,N)=>{for(let X=0;X<L/4;X++)B.opacityVertexArray.emplaceBack(N);B.hasVisibleVertices=B.hasVisibleVertices||N!==ut};for(let B=0;B<t.symbolInstances.length;B++){const L=t.symbolInstances.get(B),{numHorizontalGlyphVertices:N,numVerticalGlyphVertices:X,crossTileID:q}=L;let U=this.opacities[q];n[q]?U=p:U||(U=M,this.opacities[q]=U),n[q]=!0;const W=L.numIconVertices>0,te=this.placedOrientations[L.crossTileID],se=te===c.WritingMode.vertical,he=te===c.WritingMode.horizontal||te===c.WritingMode.horizontalOnly;if(N>0||X>0){const de=Ot(U.text);D(t.text,N,se?ut:de),D(t.text,X,he?ut:de);const Te=U.text.isHidden();[L.rightJustifiedTextSymbolIndex,L.centerJustifiedTextSymbolIndex,L.leftJustifiedTextSymbolIndex].forEach(Ge=>{Ge>=0&&(t.text.placedSymbolArray.get(Ge).hidden=Te||se?1:0)}),L.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(L.verticalPlacedTextSymbolIndex).hidden=Te||he?1:0);const ye=this.variableOffsets[L.crossTileID];ye&&this.markUsedJustification(t,ye.anchor,L,te);const Ae=this.placedOrientations[L.crossTileID];Ae&&(this.markUsedJustification(t,"left",L,Ae),this.markUsedOrientation(t,Ae,L))}if(W){const de=Ot(U.icon),Te=!(E&&L.verticalPlacedIconSymbolIndex&&se);L.placedIconSymbolIndex>=0&&(D(t.icon,L.numIconVertices,Te?de:ut),t.icon.placedSymbolArray.get(L.placedIconSymbolIndex).hidden=U.icon.isHidden()),L.verticalPlacedIconSymbolIndex>=0&&(D(t.icon,L.numVerticalIconVertices,Te?ut:de),t.icon.placedSymbolArray.get(L.verticalPlacedIconSymbolIndex).hidden=U.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const de=t.collisionArrays[B];if(de){let Te=new c.pointGeometry(0,0);if(de.textBox||de.verticalTextBox){let Ae=!0;if(y){const Ge=this.variableOffsets[q];Ge?(Te=we(Ge.anchor,Ge.width,Ge.height,Ge.textOffset,Ge.textBoxScale),v&&Te._rotate(S?this.transform.angle:-this.transform.angle)):Ae=!1}de.textBox&&ke(t.textCollisionBox.collisionVertexArray,U.text.placed,!Ae||se,Te.x,Te.y),de.verticalTextBox&&ke(t.textCollisionBox.collisionVertexArray,U.text.placed,!Ae||he,Te.x,Te.y)}const ye=Boolean(!he&&de.verticalIconBox);de.iconBox&&ke(t.iconCollisionBox.collisionVertexArray,U.icon.placed,ye,E?Te.x:0,E?Te.y:0),de.verticalIconBox&&ke(t.iconCollisionBox.collisionVertexArray,U.icon.placed,!ye,E?Te.x:0,E?Te.y:0)}}}if(t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);if(t.bucketInstanceId in this.collisionCircleArrays){const B=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=B.invProjMatrix,t.placementViewportMatrix=B.viewportMatrix,t.collisionCircleArray=B.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,n){const a=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*a>t}setStale(){this.stale=!0}}function ke(o,t,n,a,h){o.emplaceBack(t?1:0,n?1:0,a||0,h||0),o.emplaceBack(t?1:0,n?1:0,a||0,h||0),o.emplaceBack(t?1:0,n?1:0,a||0,h||0),o.emplaceBack(t?1:0,n?1:0,a||0,h||0)}const le=Math.pow(2,25),et=Math.pow(2,24),pt=Math.pow(2,17),De=Math.pow(2,16),ot=Math.pow(2,9),_t=Math.pow(2,8),Ft=Math.pow(2,1);function Ot(o){if(o.opacity===0&&!o.placed)return 0;if(o.opacity===1&&o.placed)return 4294967295;const t=o.placed?1:0,n=Math.floor(127*o.opacity);return n*le+t*et+n*pt+t*De+n*ot+t*_t+n*Ft+t}const ut=0;class mi{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,n,a,h,p){const m=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(m,h,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,p())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,m.sort((_,y)=>_.sortKey-y.sortKey));this._currentPartIndex<m.length;)if(n.placeLayerBucketPart(m[this._currentPartIndex],this._seenCrossTileIDs,a),this._currentPartIndex++,p())return!0;return!1}}class li{constructor(t,n,a,h,p,m,_,y){this.placement=new _e(t,n,m,_,y),this._currentPlacementIndex=a.length-1,this._forceFullPlacement=h,this._showCollisionBoxes=p,this._done=!1}isDone(){return this._done}continuePlacement(t,n,a){const h=c.exported.now(),p=()=>{const m=c.exported.now()-h;return!this._forceFullPlacement&&m>2};for(;this._currentPlacementIndex>=0;){const m=n[t[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(m.type==="symbol"&&(!m.minzoom||m.minzoom<=_)&&(!m.maxzoom||m.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new mi(m)),this._inProgressLayer.continuePlacement(a[m.source],this.placement,this._showCollisionBoxes,m,p))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const wt=512/c.EXTENT/2;class si{constructor(t,n,a){this.tileID=t,this.bucketInstanceId=a,this._symbolsByKey={};const h=new Map;for(let p=0;p<n.length;p++){const m=n.get(p),_=m.key,y=h.get(_);y?y.push(m):h.set(_,[m])}for(const[p,m]of h){const _={positions:m.map(y=>({x:Math.floor(y.anchorX*wt),y:Math.floor(y.anchorY*wt)})),crossTileIDs:m.map(y=>y.crossTileID)};if(_.positions.length>128){const y=new c.KDBush(_.positions,v=>v.x,v=>v.y,16,Uint16Array);delete y.points,delete _.positions,_.index=y}this._symbolsByKey[p]=_}}getScaledCoordinates(t,n){const{x:a,y:h,z:p}=this.tileID.canonical,{x:m,y:_,z:y}=n.canonical,v=wt/Math.pow(2,y-p),S=(_*c.EXTENT+t.anchorY)*v,E=h*c.EXTENT*wt;return{x:Math.floor((m*c.EXTENT+t.anchorX)*v-a*c.EXTENT*wt),y:Math.floor(S-E)}}findMatches(t,n,a){const h=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let p=0;p<t.length;p++){const m=t.get(p);if(m.crossTileID)continue;const _=this._symbolsByKey[m.key];if(!_)continue;const y=this.getScaledCoordinates(m,n);if(_.index){const v=_.index.range(y.x-h,y.y-h,y.x+h,y.y+h).sort();for(const S of v){const E=_.crossTileIDs[S];if(!a[E]){a[E]=!0,m.crossTileID=E;break}}}else if(_.positions)for(let v=0;v<_.positions.length;v++){const S=_.positions[v],E=_.crossTileIDs[v];if(Math.abs(S.x-y.x)<=h&&Math.abs(S.y-y.y)<=h&&!a[E]){a[E]=!0,m.crossTileID=E;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:t})=>t)}}class wi{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class fn{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const a in this.indexes){const h=this.indexes[a],p={};for(const m in h){const _=h[m];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+n),p[_.tileID.key]=_}this.indexes[a]=p}this.lng=t}addBucket(t,n,a){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let p=0;p<n.symbolInstances.length;p++)n.symbolInstances.get(p).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const h=this.usedCrossTileIDs[t.overscaledZ];for(const p in this.indexes){const m=this.indexes[p];if(Number(p)>t.overscaledZ)for(const _ in m){const y=m[_];y.tileID.isChildOf(t)&&y.findMatches(n.symbolInstances,t,h)}else{const _=m[t.scaledTo(Number(p)).key];_&&_.findMatches(n.symbolInstances,t,h)}}for(let p=0;p<n.symbolInstances.length;p++){const m=n.symbolInstances.get(p);m.crossTileID||(m.crossTileID=a.generate(),h[m.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new si(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const a of n.getCrossTileIDsLists())for(const h of a)delete this.usedCrossTileIDs[t][h]}removeStaleBuckets(t){let n=!1;for(const a in this.indexes){const h=this.indexes[a];for(const p in h)t[h[p].bucketInstanceId]||(this.removeBucketCrossTileIDs(a,h[p]),delete h[p],n=!0)}return n}}class Ui{constructor(){this.layerIndexes={},this.crossTileIDs=new wi,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,a){let h=this.layerIndexes[t.id];h===void 0&&(h=this.layerIndexes[t.id]=new fn);let p=!1;const m={};h.handleWrapJump(a);for(const _ of n){const y=_.getBucket(t);y&&t.id===y.layerIds[0]&&(y.bucketInstanceId||(y.bucketInstanceId=++this.maxBucketInstanceId),h.addBucket(_.tileID,y,this.crossTileIDs)&&(p=!0),m[y.bucketInstanceId]=!0)}return h.removeStaleBuckets(m)&&(p=!0),p}pruneUnusedLayers(t){const n={};t.forEach(a=>{n[a]=!0});for(const a in this.layerIndexes)n[a]||delete this.layerIndexes[a]}}const As=(o,t)=>c.emitValidationErrors(o,t&&t.filter(n=>n.identifier!=="source.canvas")),Co=c.pick(ft,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),Qi=c.pick(ft,["setCenter","setZoom","setBearing","setPitch"]),Cs=function(){const o={},t=c.spec.$version;for(const n in c.spec.$root){const a=c.spec.$root[n];if(a.required){let h=null;h=n==="version"?t:a.type==="array"?[]:{},h!=null&&(o[n]=h)}}return o}();class ui extends c.Evented{constructor(t,n={}){super(),this.map=t,this.dispatcher=new Fr(Xr(),this),this.imageManager=new Ji,this.imageManager.setEventedParent(this),this.glyphManager=new Rr(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new Br(256,512),this.crossTileSymbolIndex=new Ui,this._spritesImagesIds={},this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new c.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",c.getReferrer());const a=this;this._rtlTextPluginCallback=ui.registerForPluginStateChange(h=>{a.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:h.pluginStatus,pluginURL:h.pluginURL},(p,m)=>{if(c.triggerPluginCompletionEvent(p),m&&m.every(_=>_))for(const _ in a.sourceCaches)a.sourceCaches[_].reload()})}),this.on("data",h=>{if(h.dataType!=="source"||h.sourceDataType!=="metadata")return;const p=this.sourceCaches[h.sourceId];if(!p)return;const m=p.getSource();if(m&&m.vectorLayerIds)for(const _ in this._layers){const y=this._layers[_];y.source===m.id&&this._validateLayer(y)}})}loadURL(t,n={},a){this.fire(new c.Event("dataloading",{dataType:"style"})),n.validate=typeof n.validate!="boolean"||n.validate;const h=this.map._requestManager.transformRequest(t,c.ResourceType.Style);this._request=c.getJSON(h,(p,m)=>{this._request=null,p?this.fire(new c.ErrorEvent(p)):m&&this._load(m,n,a)})}loadJSON(t,n={},a){this.fire(new c.Event("dataloading",{dataType:"style"})),this._request=c.exported.frame(()=>{this._request=null,n.validate=n.validate!==!1,this._load(t,n,a)})}loadEmpty(){this.fire(new c.Event("dataloading",{dataType:"style"})),this._load(Cs,{validate:!1})}_load(t,n,a){const h=n.transformStyle?n.transformStyle(a,t):t;if(n.validate&&As(this,c.validateStyle(h)))return;this._loaded=!0,this.stylesheet=h;for(const m in h.sources)this.addSource(m,h.sources[m],{validate:!1});h.sprite?this._loadSprite(h.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(h.glyphs);const p=Wr(this.stylesheet.layers);this._order=p.map(m=>m.id),this._layers={},this._serializedLayers={};for(let m of p)m=c.createStyleLayer(m),m.setEventedParent(this,{layer:{id:m.id}}),this._layers[m.id]=m,this._serializedLayers[m.id]=m.serialize();this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new on(this.stylesheet.light),this.map.setTerrain(this.stylesheet.terrain),this.fire(new c.Event("data",{dataType:"style"})),this.fire(new c.Event("style.load"))}_loadSprite(t,n=!1,a){this.imageManager.setLoaded(!1),this._spriteRequest=function(h,p,m,_){const y=Jt(h),v=m>1?"@2x":"";let S;const E=[],M=[],D={},B={};for(const{id:N,url:X}of y){const q=E.push(c.getJSON(p.transformRequest(p.normalizeSpriteURL(X,v,".json"),c.ResourceType.SpriteJSON),(W,te)=>{E.splice(q,1),S||(S=W,D[N]=te,L())})),U=M.push(c.getImage(p.transformRequest(p.normalizeSpriteURL(X,v,".png"),c.ResourceType.SpriteImage),(W,te)=>{M.splice(U,1),S||(S=W,B[N]=te,L())}))}function L(){const N=Object.values(D).length,X=Object.values(B).length;if(S)_(S);else if(y.length===N&&N===X){const q={};for(const U in D){q[U]={};const W=c.exported.getImageData(B[U]),te=D[U];for(const se in te){const{width:he,height:de,x:Te,y:ye,sdf:Ae,pixelRatio:Ge,stretchX:rt,stretchY:nt,content:He}=te[se],Mt=new c.RGBAImage({width:he,height:de});c.RGBAImage.copy(W,Mt,{x:Te,y:ye},{x:0,y:0},{width:he,height:de}),q[U][se]={data:Mt,pixelRatio:Ge,sdf:Ae,stretchX:rt,stretchY:nt,content:He}}}_(null,q)}}return{cancel(){if(E.length)for(const N of E)N.cancel(),E.splice(E.indexOf(N),1);if(M.length)for(const N of M)N.cancel(),M.splice(M.indexOf(N),1)}}}(t,this.map._requestManager,this.map.getPixelRatio(),(h,p)=>{if(this._spriteRequest=null,h)this.fire(new c.ErrorEvent(h));else if(p)for(const m in p){this._spritesImagesIds[m]=[];const _=this._spritesImagesIds[m]?this._spritesImagesIds[m].filter(y=>!(y in p)):[];for(const y of _)this.imageManager.removeImage(y),this._changedImages[y]=!0;for(const y in p[m]){const v=m==="default"?y:`${m}:${y}`;this._spritesImagesIds[m].push(v),v in this.imageManager.images?this.imageManager.updateImage(v,p[m][y],!1):this.imageManager.addImage(v,p[m][y]),n&&(this._changedImages[v]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new c.Event("data",{dataType:"style"})),a&&a(h)})}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new c.Event("data",{dataType:"style"}))}_validateLayer(t){const n=this.sourceCaches[t.source];if(!n)return;const a=t.sourceLayer;if(!a)return;const h=n.getSource();(h.type==="geojson"||h.vectorLayerIds&&h.vectorLayerIds.indexOf(a)===-1)&&this.fire(new c.ErrorEvent(new Error(`Source layer "${a}" does not exist on source "${h.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(t){const n=[];for(const a of t){const h=this._layers[a];h.type!=="custom"&&n.push(h.serialize())}return n}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const n=this._changed;if(this._changed){const h=Object.keys(this._updatedLayers),p=Object.keys(this._removedLayers);(h.length||p.length)&&this._updateWorkerLayers(h,p);for(const m in this._updatedSources){const _=this._updatedSources[m];if(_==="reload")this._reloadSource(m);else{if(_!=="clear")throw new Error(`Invalid action ${_}`);this._clearSource(m)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const m in this._updatedPaintProps)this._layers[m].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const a={};for(const h in this.sourceCaches){const p=this.sourceCaches[h];a[h]=p.used,p.used=!1}for(const h of this._order){const p=this._layers[h];p.recalculate(t,this._availableImages),!p.isHidden(t.zoom)&&p.source&&(this.sourceCaches[p.source].used=!0)}for(const h in a){const p=this.sourceCaches[h];a[h]!==p.used&&p.fire(new c.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:h}))}this.light.recalculate(t),this.z=t.zoom,n&&this.fire(new c.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,n){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,n={}){if(this._checkLoaded(),t=n.transformStyle?n.transformStyle(this.serialize(),t):t,As(this,c.validateStyle(t)))return!1;(t=c.clone$1(t)).layers=Wr(t.layers);const a=function(p,m){if(!p)return[{command:ft.setStyle,args:[m]}];let _=[];try{if(!Me(p.version,m.version))return[{command:ft.setStyle,args:[m]}];Me(p.center,m.center)||_.push({command:ft.setCenter,args:[m.center]}),Me(p.zoom,m.zoom)||_.push({command:ft.setZoom,args:[m.zoom]}),Me(p.bearing,m.bearing)||_.push({command:ft.setBearing,args:[m.bearing]}),Me(p.pitch,m.pitch)||_.push({command:ft.setPitch,args:[m.pitch]}),Me(p.sprite,m.sprite)||_.push({command:ft.setSprite,args:[m.sprite]}),Me(p.glyphs,m.glyphs)||_.push({command:ft.setGlyphs,args:[m.glyphs]}),Me(p.transition,m.transition)||_.push({command:ft.setTransition,args:[m.transition]}),Me(p.light,m.light)||_.push({command:ft.setLight,args:[m.light]});const y={},v=[];(function(E,M,D,B){let L;for(L in M=M||{},E=E||{})Object.prototype.hasOwnProperty.call(E,L)&&(Object.prototype.hasOwnProperty.call(M,L)||re(L,D,B));for(L in M)Object.prototype.hasOwnProperty.call(M,L)&&(Object.prototype.hasOwnProperty.call(E,L)?Me(E[L],M[L])||(E[L].type==="geojson"&&M[L].type==="geojson"&&R(E,M,L)?D.push({command:ft.setGeoJSONSourceData,args:[L,M[L].data]}):z(L,M,D,B)):dn(L,M,D))})(p.sources,m.sources,v,y);const S=[];p.layers&&p.layers.forEach(E=>{y[E.source]?_.push({command:ft.removeLayer,args:[E.id]}):S.push(E)}),_=_.concat(v),function(E,M,D){M=M||[];const B=(E=E||[]).map(Q),L=M.map(Q),N=E.reduce(V,{}),X=M.reduce(V,{}),q=B.slice(),U=Object.create(null);let W,te,se,he,de,Te,ye;for(W=0,te=0;W<B.length;W++)se=B[W],Object.prototype.hasOwnProperty.call(X,se)?te++:(D.push({command:ft.removeLayer,args:[se]}),q.splice(q.indexOf(se,te),1));for(W=0,te=0;W<L.length;W++)se=L[L.length-1-W],q[q.length-1-W]!==se&&(Object.prototype.hasOwnProperty.call(N,se)?(D.push({command:ft.removeLayer,args:[se]}),q.splice(q.lastIndexOf(se,q.length-te),1)):te++,Te=q[q.length-W],D.push({command:ft.addLayer,args:[X[se],Te]}),q.splice(q.length-W,0,se),U[se]=!0);for(W=0;W<L.length;W++)if(se=L[W],he=N[se],de=X[se],!U[se]&&!Me(he,de))if(Me(he.source,de.source)&&Me(he["source-layer"],de["source-layer"])&&Me(he.type,de.type)){for(ye in j(he.layout,de.layout,D,se,null,ft.setLayoutProperty),j(he.paint,de.paint,D,se,null,ft.setPaintProperty),Me(he.filter,de.filter)||D.push({command:ft.setFilter,args:[se,de.filter]}),Me(he.minzoom,de.minzoom)&&Me(he.maxzoom,de.maxzoom)||D.push({command:ft.setLayerZoomRange,args:[se,de.minzoom,de.maxzoom]}),he)Object.prototype.hasOwnProperty.call(he,ye)&&ye!=="layout"&&ye!=="paint"&&ye!=="filter"&&ye!=="metadata"&&ye!=="minzoom"&&ye!=="maxzoom"&&(ye.indexOf("paint.")===0?j(he[ye],de[ye],D,se,ye.slice(6),ft.setPaintProperty):Me(he[ye],de[ye])||D.push({command:ft.setLayerProperty,args:[se,ye,de[ye]]}));for(ye in de)Object.prototype.hasOwnProperty.call(de,ye)&&!Object.prototype.hasOwnProperty.call(he,ye)&&ye!=="layout"&&ye!=="paint"&&ye!=="filter"&&ye!=="metadata"&&ye!=="minzoom"&&ye!=="maxzoom"&&(ye.indexOf("paint.")===0?j(he[ye],de[ye],D,se,ye.slice(6),ft.setPaintProperty):Me(he[ye],de[ye])||D.push({command:ft.setLayerProperty,args:[se,ye,de[ye]]}))}else D.push({command:ft.removeLayer,args:[se]}),Te=q[q.lastIndexOf(se)+1],D.push({command:ft.addLayer,args:[de,Te]})}(S,m.layers,_)}catch(y){console.warn("Unable to compute style diff:",y),_=[{command:ft.setStyle,args:[m]}]}return _}(this.serialize(),t).filter(p=>!(p.command in Qi));if(a.length===0)return!1;const h=a.filter(p=>!(p.command in Co));if(h.length>0)throw new Error(`Unimplemented: ${h.map(p=>p.command).join(", ")}.`);return a.forEach(p=>{p.command!=="setTransition"&&this[p.command].apply(this,p.args)}),this.stylesheet=t,!0}addImage(t,n){if(this.getImage(t))return this.fire(new c.ErrorEvent(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(t,n){this.imageManager.updateImage(t,n)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new c.ErrorEvent(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new c.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,a={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(c.validateStyle.source,`sources.${t}`,n,null,a))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const h=this.sourceCaches[t]=new di(t,n,this.dispatcher);h.style=this,h.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:h.serialize(),sourceId:t})),h.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(const a in this._layers)if(this._layers[a].source===t)return this.fire(new c.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${a}" is using it.`)));const n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new c.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,n){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const a=this.sourceCaches[t].getSource();if(a.type!=="geojson")throw new Error(`geojsonSource.type is ${a.type}, which is !== 'geojson`);a.setData(n),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,n,a={}){this._checkLoaded();const h=t.id;if(this.getLayer(h))return void this.fire(new c.ErrorEvent(new Error(`Layer "${h}" already exists on this map.`)));let p;if(t.type==="custom"){if(As(this,c.validateCustomStyleLayer(t)))return;p=c.createStyleLayer(t)}else{if(typeof t.source=="object"&&(this.addSource(h,t.source),t=c.clone$1(t),t=c.extend(t,{source:h})),this._validate(c.validateStyle.layer,`layers.${h}`,t,{arrayIndex:-1},a))return;p=c.createStyleLayer(t),this._validateLayer(p),p.setEventedParent(this,{layer:{id:h}}),this._serializedLayers[p.id]=p.serialize()}const m=n?this._order.indexOf(n):this._order.length;if(n&&m===-1)this.fire(new c.ErrorEvent(new Error(`Cannot add layer "${h}" before non-existing layer "${n}".`)));else{if(this._order.splice(m,0,h),this._layerOrderChanged=!0,this._layers[h]=p,this._removedLayers[h]&&p.source&&p.type!=="custom"){const _=this._removedLayers[h];delete this._removedLayers[h],_.type!==p.type?this._updatedSources[p.source]="clear":(this._updatedSources[p.source]="reload",this.sourceCaches[p.source].pause())}this._updateLayer(p),p.onAdd&&p.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new c.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const a=this._order.indexOf(t);this._order.splice(a,1);const h=n?this._order.indexOf(n):this._order.length;n&&h===-1?this.fire(new c.ErrorEvent(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(h,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new c.ErrorEvent(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const a=this._order.indexOf(t);this._order.splice(a,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,a){this._checkLoaded();const h=this.getLayer(t);h?h.minzoom===n&&h.maxzoom===a||(n!=null&&(h.minzoom=n),a!=null&&(h.maxzoom=a),this._updateLayer(h)):this.fire(new c.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,a={}){this._checkLoaded();const h=this.getLayer(t);if(h){if(!Me(h.filter,n))return n==null?(h.filter=void 0,void this._updateLayer(h)):void(this._validate(c.validateStyle.filter,`layers.${h.id}.filter`,n,null,a)||(h.filter=c.clone$1(n),this._updateLayer(h)))}else this.fire(new c.ErrorEvent(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return c.clone$1(this.getLayer(t).filter)}setLayoutProperty(t,n,a,h={}){this._checkLoaded();const p=this.getLayer(t);p?Me(p.getLayoutProperty(n),a)||(p.setLayoutProperty(n,a,h),this._updateLayer(p)):this.fire(new c.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const a=this.getLayer(t);if(a)return a.getLayoutProperty(n);this.fire(new c.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,a,h={}){this._checkLoaded();const p=this.getLayer(t);p?Me(p.getPaintProperty(n),a)||(p.setPaintProperty(n,a,h)&&this._updateLayer(p),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new c.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const a=t.source,h=t.sourceLayer,p=this.sourceCaches[a];if(p===void 0)return void this.fire(new c.ErrorEvent(new Error(`The source '${a}' does not exist in the map's style.`)));const m=p.getSource().type;m==="geojson"&&h?this.fire(new c.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):m!=="vector"||h?(t.id===void 0&&this.fire(new c.ErrorEvent(new Error("The feature id parameter must be provided."))),p.setFeatureState(h,t.id,n)):this.fire(new c.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const a=t.source,h=this.sourceCaches[a];if(h===void 0)return void this.fire(new c.ErrorEvent(new Error(`The source '${a}' does not exist in the map's style.`)));const p=h.getSource().type,m=p==="vector"?t.sourceLayer:void 0;p!=="vector"||m?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new c.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):h.removeFeatureState(m,t.id,n):this.fire(new c.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,a=t.sourceLayer,h=this.sourceCaches[n];if(h!==void 0)return h.getSource().type!=="vector"||a?(t.id===void 0&&this.fire(new c.ErrorEvent(new Error("The feature id parameter must be provided."))),h.getFeatureState(a,t.id)):void this.fire(new c.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new c.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return c.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){return c.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:c.mapObject(this.sourceCaches,t=>t.serialize()),layers:this._serializeLayers(this._order)},t=>t!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0}_flattenAndSortRenderedFeatures(t){const n=m=>this._layers[m].type==="fill-extrusion",a={},h=[];for(let m=this._order.length-1;m>=0;m--){const _=this._order[m];if(n(_)){a[_]=m;for(const y of t){const v=y[_];if(v)for(const S of v)h.push(S)}}}h.sort((m,_)=>_.intersectionZ-m.intersectionZ);const p=[];for(let m=this._order.length-1;m>=0;m--){const _=this._order[m];if(n(_))for(let y=h.length-1;y>=0;y--){const v=h[y].feature;if(a[v.layer.id]<m)break;p.push(v),h.pop()}else for(const y of t){const v=y[_];if(v)for(const S of v)p.push(S.feature)}}return p}queryRenderedFeatures(t,n,a){n&&n.filter&&this._validate(c.validateStyle.filter,"queryRenderedFeatures.filter",n.filter,null,n);const h={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new c.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const m of n.layers){const _=this._layers[m];if(!_)return this.fire(new c.ErrorEvent(new Error(`The layer '${m}' does not exist in the map's style and cannot be queried for features.`))),[];h[_.source]=!0}}const p=[];n.availableImages=this._availableImages;for(const m in this.sourceCaches)n.layers&&!h[m]||p.push(jn(this.sourceCaches[m],this._layers,this._serializedLayers,t,n,a));return this.placement&&p.push(function(m,_,y,v,S,E,M){const D={},B=E.queryRenderedSymbols(v),L=[];for(const N of Object.keys(B).map(Number))L.push(M[N]);L.sort(un);for(const N of L){const X=N.featureIndex.lookupSymbolFeatures(B[N.bucketInstanceId],_,N.bucketIndex,N.sourceLayerIndex,S.filter,S.layers,S.availableImages,m);for(const q in X){const U=D[q]=D[q]||[],W=X[q];W.sort((te,se)=>{const he=N.featureSortOrder;if(he){const de=he.indexOf(te.featureIndex);return he.indexOf(se.featureIndex)-de}return se.featureIndex-te.featureIndex});for(const te of W)U.push(te)}}for(const N in D)D[N].forEach(X=>{const q=X.feature,U=y[m[N].source].getFeatureState(q.layer["source-layer"],q.id);q.source=q.layer.source,q.layer["source-layer"]&&(q.sourceLayer=q.layer["source-layer"]),q.state=U});return D}(this._layers,this._serializedLayers,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(p)}querySourceFeatures(t,n){n&&n.filter&&this._validate(c.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);const a=this.sourceCaches[t];return a?function(h,p){const m=h.getRenderableIds().map(v=>h.getTileByID(v)),_=[],y={};for(let v=0;v<m.length;v++){const S=m[v],E=S.tileID.canonical.key;y[E]||(y[E]=!0,S.querySourceFeatures(_,p))}return _}(a,n):[]}addSourceType(t,n,a){return ui.getSourceType(t)?a(new Error(`A source type called "${t}" already exists.`)):(ui.setSourceType(t,n),n.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:n.workerSourceURL},a):a(null,null))}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const a=this.light.getLight();let h=!1;for(const m in t)if(!Me(t[m],a[m])){h=!0;break}if(!h)return;const p={now:c.exported.now(),transition:c.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(p)}_validate(t,n,a,h,p={}){return(!p||p.validate!==!1)&&As(this,t.call(c.validateStyle,c.extend({key:n,style:this.serialize(),value:a,styleSpec:c.spec},h)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),c.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this.sourceCaches){const n=this.sourceCaches[t];n.setEventedParent(null),n.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const n in this.sourceCaches)this.sourceCaches[n].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,n,a,h,p=!1){let m=!1,_=!1;const y={};for(const v of this._order){const S=this._layers[v];if(S.type!=="symbol")continue;if(!y[S.source]){const M=this.sourceCaches[S.source];y[S.source]=M.getRenderableIds(!0).map(D=>M.getTileByID(D)).sort((D,B)=>B.tileID.overscaledZ-D.tileID.overscaledZ||(D.tileID.isLessThan(B.tileID)?-1:1))}const E=this.crossTileSymbolIndex.addLayer(S,y[S.source],t.center.lng);m=m||E}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((p=p||this._layerOrderChanged||a===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(c.exported.now(),t.zoom))&&(this.pauseablePlacement=new li(t,this.map.terrain,this._order,p,n,a,h,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(c.exported.now()),_=!0),m&&this.pauseablePlacement.placement.setStale()),_||m)for(const v of this._order){const S=this._layers[v];S.type==="symbol"&&this.placement.updateLayerOpacities(S,y[S.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(c.exported.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,n,a){this.imageManager.getImages(n.icons,a),this._updateTilesForChangedImages();const h=this.sourceCaches[n.source];h&&h.setDependencies(n.tileID.key,n.type,n.icons)}getGlyphs(t,n,a){this.glyphManager.getGlyphs(n.stacks,a);const h=this.sourceCaches[n.source];h&&h.setDependencies(n.tileID.key,n.type,[""])}getResource(t,n,a){return c.makeRequest(n,a)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,n={}){this._checkLoaded(),t&&this._validate(c.validateStyle.glyphs,"glyphs",t,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,n,a={},h){this._checkLoaded();const p=[{id:t,url:n}],m=[...Jt(this.stylesheet.sprite),...p];this._validate(c.validateStyle.sprite,"sprite",m,null,a)||(this.stylesheet.sprite=m,this._loadSprite(p,!0,h))}removeSprite(t){this._checkLoaded();const n=Jt(this.stylesheet.sprite);if(n.find(a=>a.id===t)){if(this._spritesImagesIds[t])for(const a of this._spritesImagesIds[t])this.imageManager.removeImage(a),this._changedImages[a]=!0;n.splice(n.findIndex(a=>a.id===t),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new c.Event("data",{dataType:"style"}))}else this.fire(new c.ErrorEvent(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return Jt(this.stylesheet.sprite)}setSprite(t,n={},a){this._checkLoaded(),t&&this._validate(c.validateStyle.sprite,"sprite",t,null,n)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,a):(this._unloadSprite(),a(null)))}}ui.getSourceType=function(o){return Vr[o]},ui.setSourceType=function(o,t){Vr[o]=t},ui.registerForPluginStateChange=c.registerForPluginStateChange;var qn=c.createLayout([{name:"a_pos",type:"Int16",components:2}]),gn="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";const Zn={prelude:Ct(`#ifdef GL_ES
1
+ (function(Ze,aa){typeof exports=="object"&&typeof module<"u"?aa(exports):typeof define=="function"&&define.amd?define(["exports"],aa):(Ze=typeof globalThis<"u"?globalThis:Ze||self,aa(Ze.maptilersdk={}))})(this,function(Ze){"use strict";var aa=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ad(I){return I&&I.__esModule&&Object.prototype.hasOwnProperty.call(I,"default")?I.default:I}var th={exports:{}};(function(I,v){(function(k,j){I.exports=j()})(aa,function(){var k,j,ie;function me(c,be){if(!k)k=be;else if(!j)j=be;else{var Je="var sharedChunk = {}; ("+k+")(sharedChunk); ("+j+")(sharedChunk);",lt={};k(lt),ie=be(lt),typeof window<"u"&&(ie.workerUrl=window.URL.createObjectURL(new Blob([Je],{type:"text/javascript"})))}}me(["exports"],function(c){var be=Je;function Je(i,e,r,s){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(s-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=s}function lt(i,e,r,s){const l=new be(i,e,r,s);return function(u){return l.solve(u)}}Je.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,s=0;s<8;s++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)<e)return r;var u=this.sampleCurveDerivativeX(r);if(Math.abs(u)<1e-6)break;r-=l/u}var p=0,f=1;for(r=i,s=0;s<20&&(l=this.sampleCurveX(r),!(Math.abs(l-i)<e));s++)i>l?p=r:f=r,r=.5*(f-p)+p;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};const Et=lt(.25,.1,.25,1);function Me(i,e,r){return Math.min(r,Math.max(e,i))}function K(i,e,r){const s=r-e,l=((i-e)%s+s)%s+e;return l===e?r:l}function Ye(i,...e){for(const r of e)for(const s in r)i[s]=r[s];return i}let ii=1;function Yt(i,e){i.forEach(r=>{e[r]&&(e[r]=e[r].bind(e))})}function Rt(i,e,r){const s={};for(const l in i)s[l]=e.call(r||this,i[l],l,i);return s}function Nn(i,e,r){const s={};for(const l in i)e.call(r||this,i[l],l,i)&&(s[l]=i[l]);return s}function Ki(i){return Array.isArray(i)?i.map(Ki):typeof i=="object"&&i?Rt(i,Ki):i}const Dr={};function Qt(i){Dr[i]||(typeof console<"u"&&console.warn(i),Dr[i]=!0)}function nr(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function Rr(i){let e=0;for(let r,s,l=0,u=i.length,p=u-1;l<u;p=l++)r=i[l],s=i[p],e+=(s.x-r.x)*(r.y+s.y);return e}function Ji(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function $n(i){const e={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,s,l,u)=>{const p=l||u;return e[s]=!p||p.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}let ln=null;function Br(i){if(ln==null){const e=i.navigator?i.navigator.userAgent:null;ln=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return ln}function Fr(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const cn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let Tr,hn;const un={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(i){const e=requestAnimationFrame(i);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(i,e=0){const r=window.document.createElement("canvas"),s=r.getContext("2d",{willReadFrequently:!0});if(!s)throw new Error("failed to create canvas 2d context");return r.width=i.width,r.height=i.height,s.drawImage(i,0,0,i.width,i.height),s.getImageData(-e,-e,i.width+2*e,i.height+2*e)},resolveURL:i=>(Tr||(Tr=document.createElement("a")),Tr.href=i,Tr.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(hn==null&&(hn=matchMedia("(prefers-reduced-motion: reduce)")),hn.matches)}};var it=sr;function sr(i,e){this.x=i,this.y=e}sr.prototype={clone:function(){return new sr(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,r=i.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),r=Math.sin(i),s=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=s,this},_rotateAround:function(i,e){var r=Math.cos(i),s=Math.sin(i),l=e.y+s*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-s*(this.y-e.y),this.y=l,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},sr.convert=function(i){return i instanceof sr?i:Array.isArray(i)?new sr(i[0],i[1]):i};const Or={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},qr="mapbox-tiles";let zi,Zr,Ur=500,Vr=50;function Gn(){typeof caches>"u"||zi||(zi=caches.open(qr))}let jn=1/0;const dn={supported:!1,testSupport:function(i){!Nr&&Er&&(mi?qn(i):Sr=i)}};let Sr,Er,Nr=!1,mi=!1;function qn(i){const e=i.createTexture();i.bindTexture(i.TEXTURE_2D,e);try{if(i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,Er),i.isContextLost())return;dn.supported=!0}catch{}i.deleteTexture(e),Nr=!0}typeof document<"u"&&(Er=document.createElement("img"),Er.onload=function(){Sr&&qn(Sr),Sr=null,mi=!0},Er.onerror=function(){Nr=!0,Sr=null},Er.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Ir={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(Ir);class Ar extends Error{constructor(e,r,s,l){super(`AJAXError: ${r} (${e}): ${s}`),this.status=e,this.statusText=r,this.url=s,this.body=l}}const ar=Ji()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href;function pn(i,e){const r=new AbortController,s=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:ar(),signal:r.signal});let l=!1,u=!1;return i.type==="json"&&s.headers.set("Accept","application/json"),((p,f,g)=>{if(u)return;const x=Date.now();fetch(s).then(w=>w.ok?((T,C,A)=>{(i.type==="arrayBuffer"?T.arrayBuffer():i.type==="json"?T.json():T.text()).then(P=>{u||(C&&A&&function(F,O,q){if(Gn(),!zi)return;const Y={status:O.status,statusText:O.statusText,headers:new Headers};O.headers.forEach((J,de)=>Y.headers.set(de,J));const $=$n(O.headers.get("Cache-Control")||"");$["no-store"]||($["max-age"]&&Y.headers.set("Expires",new Date(q+1e3*$["max-age"]).toUTCString()),new Date(Y.headers.get("Expires")).getTime()-q<42e4||function(J,de){if(Zr===void 0)try{new Response(new ReadableStream),Zr=!0}catch{Zr=!1}Zr?de(J.body):J.blob().then(de)}(O,J=>{const de=new Response(J,Y);Gn(),zi&&zi.then(ue=>ue.put(function(Ne){const qe=Ne.indexOf("?");return qe<0?Ne:Ne.slice(0,qe)}(F.url),de)).catch(ue=>Qt(ue.message))}))}(s,C,A),l=!0,e(null,P,T.headers.get("Cache-Control"),T.headers.get("Expires")))}).catch(P=>{u||e(new Error(P.message))})})(w,null,x):w.blob().then(T=>e(new Ar(w.status,w.statusText,i.url,T)))).catch(w=>{w.code!==20&&e(new Error(w.message))})})(),{cancel:()=>{u=!0,l||r.abort()}}}const Oi=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(Ji()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!Ji()){const s=i.url.substring(0,i.url.indexOf("://"));return(Or.REGISTERED_PROTOCOLS[s]||pn)(i,e)}}if(!(/^file:/.test(r=i.url)||/^file:/.test(ar())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return pn(i,e);if(Ji()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e,void 0,!0)}var r;return function(s,l){const u=new XMLHttpRequest;u.open(s.method||"GET",s.url,!0),s.type==="arrayBuffer"&&(u.responseType="arraybuffer");for(const p in s.headers)u.setRequestHeader(p,s.headers[p]);return s.type==="json"&&(u.responseType="text",u.setRequestHeader("Accept","application/json")),u.withCredentials=s.credentials==="include",u.onerror=()=>{l(new Error(u.statusText))},u.onload=()=>{if((u.status>=200&&u.status<300||u.status===0)&&u.response!==null){let p=u.response;if(s.type==="json")try{p=JSON.parse(u.response)}catch(f){return l(f)}l(null,p,u.getResponseHeader("Cache-Control"),u.getResponseHeader("Expires"))}else{const p=new Blob([u.response],{type:u.getResponseHeader("Content-Type")});l(new Ar(u.status,u.statusText,s.url,p))}},u.send(s.body),{cancel:()=>u.abort()}}(i,e)},Xr=function(i,e){return Oi(Ye(i,{type:"arrayBuffer"}),e)};function Es(i){const e=window.document.createElement("a");return e.href=i,e.protocol===window.document.location.protocol&&e.host===window.document.location.host}let Wr,gt;Wr=[],gt=0;const mn=function(i,e){if(dn.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),gt>=Or.MAX_PARALLEL_IMAGE_REQUESTS){const u={requestParameters:i,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return Wr.push(u),u}gt++;let r=!1;const s=()=>{if(!r)for(r=!0,gt--;Wr.length&&gt<Or.MAX_PARALLEL_IMAGE_REQUESTS;){const u=Wr.shift(),{requestParameters:p,callback:f,cancelled:g}=u;g||(u.cancel=mn(p,f).cancel)}},l=Xr(i,(u,p,f,g)=>{s(),u?e(u):p&&function(x,w){typeof createImageBitmap=="function"?function(T,C){const A=new Blob([new Uint8Array(T)],{type:"image/png"});createImageBitmap(A).then(P=>{C(null,P)}).catch(P=>{C(new Error(`Could not load image because of ${P.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(x,w):function(T,C){const A=new Image;A.onload=()=>{C(null,A),URL.revokeObjectURL(A.src),A.onload=null,window.requestAnimationFrame(()=>{A.src=cn})},A.onerror=()=>C(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 P=new Blob([new Uint8Array(T)],{type:"image/png"});A.src=T.byteLength?URL.createObjectURL(P):cn}(x,w)}(p,(x,w)=>{x!=null?e(x):w!=null&&e(null,w,{cacheControl:f,expires:g})})});return{cancel:()=>{l.cancel(),s()}}};function re(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function z(i,e,r){if(r&&r[i]){const s=r[i].indexOf(e);s!==-1&&r[i].splice(s,1)}}class R{constructor(e,r={}){Ye(this,r),this.type=e}}class G extends R{constructor(e,r={}){super("error",Ye({error:e},r))}}class Q{on(e,r){return this._listeners=this._listeners||{},re(e,r,this._listeners),this}off(e,r){return z(e,r,this._listeners),z(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},re(e,r,this._oneTimeListeners),this):new Promise(s=>this.once(e,s))}fire(e,r){typeof e=="string"&&(e=new R(e,r||{}));const s=e.type;if(this.listens(s)){e.target=this;const l=this._listeners&&this._listeners[s]?this._listeners[s].slice():[];for(const f of l)f.call(this,e);const u=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(const f of u)z(s,f,this._oneTimeListeners),f.call(this,e);const p=this._eventedParent;p&&(Ye(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(e))}else e instanceof G&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}}var V={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},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-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};class H{constructor(e,r,s,l){this.message=(e?`${e}: `:"")+s,l&&(this.identifier=l),r!=null&&r.__line__&&(this.line=r.__line__)}}function ve(i){const e=i.value;return e?[new H(i.key,e,"constants have been deprecated as of v8")]:[]}function ae(i,...e){for(const r of e)for(const s in r)i[s]=r[s];return i}function Ie(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function Pe(i){if(Array.isArray(i))return i.map(Pe);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={};for(const r in i)e[r]=Pe(i[r]);return e}return Ie(i)}class Ce extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}class at{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[s,l]of r)this.bindings[s]=l}concat(e){return new at(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const _t={kind:"null"},xe={kind:"number"},Le={kind:"string"},Fe={kind:"boolean"},bt={kind:"color"},Bt={kind:"object"},Ge={kind:"value"},At={kind:"collator"},Wt={kind:"formatted"},ri={kind:"padding"},Ft={kind:"resolvedImage"};function Ct(i,e){return{kind:"array",itemType:i,N:e}}function st(i){if(i.kind==="array"){const e=st(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const fn=[_t,xe,Le,Fe,bt,Wt,Bt,Ct(Ge),ri,Ft];function ee(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!ee(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const r of fn)if(!ee(r,e))return null}}return`Expected ${st(i)} but found ${st(e)} instead.`}function ne(i,e){return e.some(r=>r.kind===i.kind)}function ce(i,e){return e.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}var fe,ge={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function we(i){return(i=Math.round(i))<0?0:i>255?255:i}function Se(i){return we(i[i.length-1]==="%"?parseFloat(i)/100*255:parseInt(i))}function _e(i){return(e=i[i.length-1]==="%"?parseFloat(i)/100:parseFloat(i))<0?0:e>1?1:e;var e}function ke(i,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?i+(e-i)*r*6:2*r<1?e:3*r<2?i+(e-i)*(2/3-r)*6:i}try{fe={}.parseCSSColor=function(i){var e,r=i.replace(/ /g,"").toLowerCase();if(r in ge)return ge[r].slice();if(r[0]==="#")return r.length===4?(e=parseInt(r.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:r.length===7&&(e=parseInt(r.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var s=r.indexOf("("),l=r.indexOf(")");if(s!==-1&&l+1===r.length){var u=r.substr(0,s),p=r.substr(s+1,l-(s+1)).split(","),f=1;switch(u){case"rgba":if(p.length!==4)return null;f=_e(p.pop());case"rgb":return p.length!==3?null:[Se(p[0]),Se(p[1]),Se(p[2]),f];case"hsla":if(p.length!==4)return null;f=_e(p.pop());case"hsl":if(p.length!==3)return null;var g=(parseFloat(p[0])%360+360)%360/360,x=_e(p[1]),w=_e(p[2]),T=w<=.5?w*(x+1):w+x-w*x,C=2*w-T;return[we(255*ke(C,T,g+1/3)),we(255*ke(C,T,g)),we(255*ke(C,T,g-1/3)),f];default:return null}}return null}}catch{}class le{constructor(e,r,s,l=1){this.r=e,this.g=r,this.b=s,this.a=l}static parse(e){if(!e)return;if(e instanceof le)return e;if(typeof e!="string")return;const r=fe(e);return r?new le(r[0]/255*r[3],r[1]/255*r[3],r[2]/255*r[3],r[3]):void 0}toString(){const[e,r,s,l]=this.toArray();return`rgba(${Math.round(e)},${Math.round(r)},${Math.round(s)},${l})`}toArray(){const{r:e,g:r,b:s,a:l}=this;return l===0?[0,0,0,0]:[255*e/l,255*r/l,255*s/l,l]}}le.black=new le(0,0,0,1),le.white=new le(1,1,1,1),le.transparent=new le(0,0,0,0),le.red=new le(1,0,0,1);class et{constructor(e,r,s){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=s,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class pt{constructor(e,r,s,l,u){this.text=e,this.image=r,this.scale=s,this.fontStack=l,this.textColor=u}}class De{constructor(e){this.sections=e}static fromString(e){return new De([new pt(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof De?e:De.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class ot{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof ot)return e;if(typeof e=="number")return new ot([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new ot(e)}}toString(){return JSON.stringify(this.values)}}class yt{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new yt({name:e,available:!1}):null}}function Ot(i,e,r,s){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[i,e,r,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[i,e,r,s]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ut(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof le||i instanceof et||i instanceof De||i instanceof ot||i instanceof yt)return!0;if(Array.isArray(i)){for(const e of i)if(!Ut(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!Ut(i[e]))return!1;return!0}return!1}function dt(i){if(i===null)return _t;if(typeof i=="string")return Le;if(typeof i=="boolean")return Fe;if(typeof i=="number")return xe;if(i instanceof le)return bt;if(i instanceof et)return At;if(i instanceof De)return Wt;if(i instanceof ot)return ri;if(i instanceof yt)return Ft;if(Array.isArray(i)){const e=i.length;let r;for(const s of i){const l=dt(s);if(r){if(r===l)continue;r=Ge;break}r=l}return Ct(r||Ge,e)}return Bt}function fi(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof le||i instanceof De||i instanceof ot||i instanceof yt?i.toString():JSON.stringify(i)}class ci{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Ut(e[1]))return r.error("invalid value");const s=e[1];let l=dt(s);const u=r.expectedType;return l.kind!=="array"||l.N!==0||!u||u.kind!=="array"||typeof u.N=="number"&&u.N!==0||(l=u),new ci(l,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Tt{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const ai={string:Le,number:xe,boolean:Fe,object:Bt};class Ti{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let s,l=1;const u=e[0];if(u==="array"){let f,g;if(e.length>2){const x=e[1];if(typeof x!="string"||!(x in ai)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);f=ai[x],l++}else f=Ge;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);g=e[2],l++}s=Ct(f,g)}else{if(!ai[u])throw new Error(`Types doesn't contain name = ${u}`);s=ai[u]}const p=[];for(;l<e.length;l++){const f=r.parse(e[l],l,Ge);if(!f)return null;p.push(f)}return new Ti(s,p)}evaluate(e){for(let r=0;r<this.args.length;r++){const s=this.args[r].evaluate(e);if(!ee(this.type,dt(s)))return s;if(r===this.args.length-1)throw new Tt(`Expected value to be of type ${st(this.type)}, but found ${st(dt(s))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const gn={"to-boolean":Fe,"to-color":bt,"to-number":xe,"to-string":Le};class Ui{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const s=e[0];if(!gn[s])throw new Error(`Can't parse ${s} as it is not part of the known types`);if((s==="to-boolean"||s==="to-string")&&e.length!==2)return r.error("Expected one argument.");const l=gn[s],u=[];for(let p=1;p<e.length;p++){const f=r.parse(e[p],p,Ge);if(!f)return null;u.push(f)}return new Ui(l,u)}evaluate(e){if(this.type.kind==="boolean")return Boolean(this.args[0].evaluate(e));if(this.type.kind==="color"){let r,s;for(const l of this.args){if(r=l.evaluate(e),s=null,r instanceof le)return r;if(typeof r=="string"){const u=e.parseColor(r);if(u)return u}else if(Array.isArray(r)&&(s=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:Ot(r[0],r[1],r[2],r[3]),!s))return new le(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Tt(s||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="padding"){let r;for(const s of this.args){r=s.evaluate(e);const l=ot.parse(r);if(l)return l}throw new Tt(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="number"){let r=null;for(const s of this.args){if(r=s.evaluate(e),r===null)return 0;const l=Number(r);if(!isNaN(l))return l}throw new Tt(`Could not convert ${JSON.stringify(r)} to number.`)}return this.type.kind==="formatted"?De.fromString(fi(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?yt.fromString(fi(this.args[0].evaluate(e))):fi(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Is=["Unknown","Point","LineString","Polygon"];class Ao{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"?Is[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let r=this._parseColorCache[e];return r||(r=this._parseColorCache[e]=le.parse(e)),r}}class Yi{constructor(e,r,s,l){this.name=e,this.type=r,this._evaluate=s,this.args=l}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){const s=e[0],l=Yi.definitions[s];if(!l)return r.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);const u=Array.isArray(l)?l[0]:l.type,p=Array.isArray(l)?[[l[1],l[2]]]:l.overloads,f=p.filter(([x])=>!Array.isArray(x)||x.length===e.length-1);let g=null;for(const[x,w]of f){g=new Lo(r.registry,r.path,null,r.scope);const T=[];let C=!1;for(let A=1;A<e.length;A++){const P=e[A],F=Array.isArray(x)?x[A-1]:x.type,O=g.parse(P,1+T.length,F);if(!O){C=!0;break}T.push(O)}if(!C)if(Array.isArray(x)&&x.length!==T.length)g.error(`Expected ${x.length} arguments, but found ${T.length} instead.`);else{for(let A=0;A<T.length;A++){const P=Array.isArray(x)?x[A]:x.type,F=T[A];g.concat(A+1).checkSubtype(P,F.type)}if(g.errors.length===0)return new Yi(s,u,w,T)}}if(f.length===1)r.errors.push(...g.errors);else{const x=(f.length?f:p).map(([T])=>{return C=T,Array.isArray(C)?`(${C.map(st).join(", ")})`:`(${st(C.type)}...)`;var C}).join(" | "),w=[];for(let T=1;T<e.length;T++){const C=r.parse(e[T],1+w.length);if(!C)return null;w.push(st(C.type))}r.error(`Expected arguments of type ${x}, but found (${w.join(", ")}) instead.`)}return null}static register(e,r){Yi.definitions=r;for(const s in r)e[s]=Yi}}class As{constructor(e,r,s){this.type=At,this.locale=s,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const s=e[1];if(typeof s!="object"||Array.isArray(s))return r.error("Collator options argument must be an object.");const l=r.parse(s["case-sensitive"]!==void 0&&s["case-sensitive"],1,Fe);if(!l)return null;const u=r.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,Fe);if(!u)return null;let p=null;return s.locale&&(p=r.parse(s.locale,1,Le),!p)?null:new As(l,u,p)}evaluate(e){return new et(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}const di=8192;function Zn(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function _n(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function Xn(i,e){const r=(180+i[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,l=Math.pow(2,e.z);return[Math.round(r*l*di),Math.round(s*l*di)]}function Mt(i,e,r){const s=i[0]-e[0],l=i[1]-e[1],u=i[0]-r[0],p=i[1]-r[1];return s*p-u*l==0&&s*u<=0&&l*p<=0}function ua(i,e){let r=!1;for(let p=0,f=e.length;p<f;p++){const g=e[p];for(let x=0,w=g.length;x<w-1;x++){if(Mt(i,g[x],g[x+1]))return!1;(l=g[x])[1]>(s=i)[1]!=(u=g[x+1])[1]>s[1]&&s[0]<(u[0]-l[0])*(s[1]-l[1])/(u[1]-l[1])+l[0]&&(r=!r)}}var s,l,u;return r}function da(i,e){for(let r=0;r<e.length;r++)if(ua(i,e[r]))return!0;return!1}function Co(i,e,r,s){const l=s[0]-r[0],u=s[1]-r[1],p=(i[0]-r[0])*u-l*(i[1]-r[1]),f=(e[0]-r[0])*u-l*(e[1]-r[1]);return p>0&&f<0||p<0&&f>0}function Mo(i,e,r){for(const x of r)for(let w=0;w<x.length-1;++w)if((f=[(p=x[w+1])[0]-(u=x[w])[0],p[1]-u[1]])[0]*(g=[(l=e)[0]-(s=i)[0],l[1]-s[1]])[1]-f[1]*g[0]!=0&&Co(s,l,u,p)&&Co(u,p,s,l))return!0;var s,l,u,p,f,g;return!1}function pa(i,e){for(let r=0;r<i.length;++r)if(!ua(i[r],e))return!1;for(let r=0;r<i.length-1;++r)if(Mo(i[r],i[r+1],e))return!1;return!0}function Hl(i,e){for(let r=0;r<e.length;r++)if(pa(i,e[r]))return!0;return!1}function Cs(i,e,r){const s=[];for(let l=0;l<i.length;l++){const u=[];for(let p=0;p<i[l].length;p++){const f=Xn(i[l][p],r);Zn(e,f),u.push(f)}s.push(u)}return s}function ma(i,e,r){const s=[];for(let l=0;l<i.length;l++){const u=Cs(i[l],e,r);s.push(u)}return s}function Po(i,e,r,s){if(i[0]<r[0]||i[0]>r[2]){const l=.5*s;let u=i[0]-r[0]>l?-s:r[0]-i[0]>l?s:0;u===0&&(u=i[0]-r[2]>l?-s:r[2]-i[0]>l?s:0),i[0]+=u}Zn(e,i)}function ko(i,e,r,s){const l=Math.pow(2,s.z)*di,u=[s.x*di,s.y*di],p=[];for(const f of i)for(const g of f){const x=[g.x+u[0],g.y+u[1]];Po(x,e,r,l),p.push(x)}return p}function zo(i,e,r,s){const l=Math.pow(2,s.z)*di,u=[s.x*di,s.y*di],p=[];for(const g of i){const x=[];for(const w of g){const T=[w.x+u[0],w.y+u[1]];Zn(e,T),x.push(T)}p.push(x)}if(e[2]-e[0]<=l/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const g of p)for(const x of g)Po(x,e,r,l)}var f;return p}class Hr{constructor(e,r){this.type=Fe,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Ut(e[1])){const s=e[1];if(s.type==="FeatureCollection")for(let l=0;l<s.features.length;++l){const u=s.features[l].geometry.type;if(u==="Polygon"||u==="MultiPolygon")return new Hr(s,s.features[l].geometry)}else if(s.type==="Feature"){const l=s.geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new Hr(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new Hr(s,s)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(r,s){const l=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(s.type==="Polygon"){const f=Cs(s.coordinates,u,p),g=ko(r.geometry(),l,u,p);if(!_n(l,u))return!1;for(const x of g)if(!ua(x,f))return!1}if(s.type==="MultiPolygon"){const f=ma(s.coordinates,u,p),g=ko(r.geometry(),l,u,p);if(!_n(l,u))return!1;for(const x of g)if(!da(x,f))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,s){const l=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(s.type==="Polygon"){const f=Cs(s.coordinates,u,p),g=zo(r.geometry(),l,u,p);if(!_n(l,u))return!1;for(const x of g)if(!pa(x,f))return!1}if(s.type==="MultiPolygon"){const f=ma(s.coordinates,u,p),g=zo(r.geometry(),l,u,p);if(!_n(l,u))return!1;for(const x of g)if(!Hl(x,f))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}function Wn(i){if(i instanceof Yi&&(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 Hr)return!1;let e=!0;return i.eachChild(r=>{e&&!Wn(r)&&(e=!1)}),e}function yn(i){if(i instanceof Yi&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!yn(r)&&(e=!1)}),e}function Ms(i,e){if(i instanceof Yi&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(s=>{r&&!Ms(s,e)&&(r=!1)}),r}class Ps{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const s=e[1];return r.scope.has(s)?new Ps(s,r.scope.get(s)):r.error(`Unknown variable "${s}". Make sure "${s}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Hn{constructor(e,r=[],s,l=new at,u=[]){this.registry=e,this.path=r,this.key=r.map(p=>`[${p}]`).join(""),this.scope=l,this.errors=u,this.expectedType=s}parse(e,r,s,l,u={}){return r?this.concat(r,s,l)._parse(e,u):this._parse(e,u)}_parse(e,r){function s(l,u,p){return p==="assert"?new Ti(u,[l]):p==="coerce"?new Ui(u,[l]):l}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const l=e[0];if(typeof l!="string")return this.error(`Expression name must be a string, but found ${typeof l} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const u=this.registry[l];if(u){let p=u.parse(e,this);if(!p)return null;if(this.expectedType){const f=this.expectedType,g=p.type;if(f.kind!=="string"&&f.kind!=="number"&&f.kind!=="boolean"&&f.kind!=="object"&&f.kind!=="array"||g.kind!=="value")if(f.kind!=="color"&&f.kind!=="formatted"&&f.kind!=="resolvedImage"||g.kind!=="value"&&g.kind!=="string")if(f.kind!=="padding"||g.kind!=="value"&&g.kind!=="number"&&g.kind!=="array"){if(this.checkSubtype(f,g))return null}else p=s(p,f,r.typeAnnotation||"coerce");else p=s(p,f,r.typeAnnotation||"coerce");else p=s(p,f,r.typeAnnotation||"assert")}if(!(p instanceof ci)&&p.type.kind!=="resolvedImage"&&fa(p)){const f=new Ao;try{p=new ci(p.type,p.evaluate(f))}catch(g){return this.error(g.message),null}}return p}return this.error(`Unknown expression "${l}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,r,s){const l=typeof e=="number"?this.path.concat(e):this.path,u=s?this.scope.concat(s):this.scope;return new Hn(this.registry,l,r||null,u,this.errors)}error(e,...r){const s=`${this.key}${r.map(l=>`[${l}]`).join("")}`;this.errors.push(new Ce(s,e))}checkSubtype(e,r){const s=ee(e,r);return s&&this.error(s),s}}var Lo=Hn;function fa(i){if(i instanceof Ps)return fa(i.boundExpression);if(i instanceof Yi&&i.name==="error"||i instanceof As||i instanceof Hr)return!1;const e=i instanceof Ui||i instanceof Ti;let r=!0;return i.eachChild(s=>{r=e?r&&fa(s):r&&s instanceof ci}),!!r&&Wn(i)&&Ms(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function ks(i,e){const r=i.length-1;let s,l,u=0,p=r,f=0;for(;u<=p;)if(f=Math.floor((u+p)/2),s=i[f],l=i[f+1],s<=e){if(f===r||e<l)return f;u=f+1}else{if(!(s>e))throw new Tt("Input is not a number.");p=f-1}return 0}class xn{constructor(e,r,s){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[l,u]of s)this.labels.push(l),this.outputs.push(u)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");const s=r.parse(e[1],1,xe);if(!s)return null;const l=[];let u=null;r.expectedType&&r.expectedType.kind!=="value"&&(u=r.expectedType);for(let p=1;p<e.length;p+=2){const f=p===1?-1/0:e[p],g=e[p+1],x=p,w=p+1;if(typeof f!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',x);if(l.length&&l[l.length-1][0]>=f)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',x);const T=r.parse(g,w,u);if(!T)return null;u=u||T.type,l.push([f,T])}return new xn(u,s,l)}evaluate(e){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return s[0].evaluate(e);const u=r.length;return l>=r[u-1]?s[u-1].evaluate(e):s[ks(r,l)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Zt(i,e,r){return i*(1-r)+e*r}var zs=Object.freeze({__proto__:null,number:Zt,color:function(i,e,r){return new le(Zt(i.r,e.r,r),Zt(i.g,e.g,r),Zt(i.b,e.b,r),Zt(i.a,e.a,r))},array:function(i,e,r){return i.map((s,l)=>Zt(s,e[l],r))},padding:function(i,e,r){const s=i.values,l=e.values;return new ot([Zt(s[0],l[0],r),Zt(s[1],l[1],r),Zt(s[2],l[2],r),Zt(s[3],l[3],r)])}});const Do=.95047,ga=1.08883,_a=4/29,ya=6/29,Ro=3*ya*ya,Kl=Math.PI/180,Jl=180/Math.PI;function xa(i){return i>.008856451679035631?Math.pow(i,1/3):i/Ro+_a}function va(i){return i>ya?i*i*i:Ro*(i-_a)}function ba(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function vt(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Bo(i){const e=vt(i.r),r=vt(i.g),s=vt(i.b),l=xa((.4124564*e+.3575761*r+.1804375*s)/Do),u=xa((.2126729*e+.7151522*r+.072175*s)/1);return{l:116*u-16,a:500*(l-u),b:200*(u-xa((.0193339*e+.119192*r+.9503041*s)/ga)),alpha:i.a}}function Fo(i){let e=(i.l+16)/116,r=isNaN(i.a)?e:e+i.a/500,s=isNaN(i.b)?e:e-i.b/200;return e=1*va(e),r=Do*va(r),s=ga*va(s),new le(ba(3.2404542*r-1.5371385*e-.4985314*s),ba(-.969266*r+1.8760108*e+.041556*s),ba(.0556434*r-.2040259*e+1.0572252*s),i.alpha)}function Yl(i,e,r){const s=e-i;return i+r*(s>180||s<-180?s-360*Math.round(s/360):s)}const Kn={forward:Bo,reverse:Fo,interpolate:function(i,e,r){return{l:Zt(i.l,e.l,r),a:Zt(i.a,e.a,r),b:Zt(i.b,e.b,r),alpha:Zt(i.alpha,e.alpha,r)}}},Jn={forward:function(i){const{l:e,a:r,b:s}=Bo(i),l=Math.atan2(s,r)*Jl;return{h:l<0?l+360:l,c:Math.sqrt(r*r+s*s),l:e,alpha:i.a}},reverse:function(i){const e=i.h*Kl,r=i.c;return Fo({l:i.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:i.alpha})},interpolate:function(i,e,r){return{h:Yl(i.h,e.h,r),c:Zt(i.c,e.c,r),l:Zt(i.l,e.l,r),alpha:Zt(i.alpha,e.alpha,r)}}};var Oo=Object.freeze({__proto__:null,lab:Kn,hcl:Jn});class Vi{constructor(e,r,s,l,u){this.type=e,this.operator=r,this.interpolation=s,this.input=l,this.labels=[],this.outputs=[];for(const[p,f]of u)this.labels.push(p),this.outputs.push(f)}static interpolationFactor(e,r,s,l){let u=0;if(e.name==="exponential")u=wa(r,e.base,s,l);else if(e.name==="linear")u=wa(r,1,s,l);else if(e.name==="cubic-bezier"){const p=e.controlPoints;u=new be(p[0],p[1],p[2],p[3]).solve(wa(r,1,s,l))}return u}static parse(e,r){let[s,l,u,...p]=e;if(!Array.isArray(l)||l.length===0)return r.error("Expected an interpolation type expression.",1);if(l[0]==="linear")l={name:"linear"};else if(l[0]==="exponential"){const x=l[1];if(typeof x!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);l={name:"exponential",base:x}}else{if(l[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(l[0])}`,1,0);{const x=l.slice(1);if(x.length!==4||x.some(w=>typeof w!="number"||w<0||w>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);l={name:"cubic-bezier",controlPoints:x}}}if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(u=r.parse(u,2,xe),!u)return null;const f=[];let g=null;s==="interpolate-hcl"||s==="interpolate-lab"?g=bt:r.expectedType&&r.expectedType.kind!=="value"&&(g=r.expectedType);for(let x=0;x<p.length;x+=2){const w=p[x],T=p[x+1],C=x+3,A=x+4;if(typeof w!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',C);if(f.length&&f[f.length-1][0]>=w)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',C);const P=r.parse(T,A,g);if(!P)return null;g=g||P.type,f.push([w,P])}return g.kind==="number"||g.kind==="color"||g.kind==="padding"||g.kind==="array"&&g.itemType.kind==="number"&&typeof g.N=="number"?new Vi(g,s,l,u,f):r.error(`Type ${st(g)} is not interpolatable.`)}evaluate(e){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return s[0].evaluate(e);const u=r.length;if(l>=r[u-1])return s[u-1].evaluate(e);const p=ks(r,l),f=Vi.interpolationFactor(this.interpolation,l,r[p],r[p+1]),g=s[p].evaluate(e),x=s[p+1].evaluate(e);return this.operator==="interpolate"?zs[this.type.kind.toLowerCase()](g,x,f):this.operator==="interpolate-hcl"?Jn.reverse(Jn.interpolate(Jn.forward(g),Jn.forward(x),f)):Kn.reverse(Kn.interpolate(Kn.forward(g),Kn.forward(x),f))}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function wa(i,e,r,s){const l=s-r,u=i-r;return l===0?0:e===1?u/l:(Math.pow(e,u)-1)/(Math.pow(e,l)-1)}class Ls{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected at least one argument.");let s=null;const l=r.expectedType;l&&l.kind!=="value"&&(s=l);const u=[];for(const f of e.slice(1)){const g=r.parse(f,1+u.length,s,void 0,{typeAnnotation:"omit"});if(!g)return null;s=s||g.type,u.push(g)}if(!s)throw new Error("No output type");const p=l&&u.some(f=>ee(l,f.type));return new Ls(p?Ge:s,u)}evaluate(e){let r,s=null,l=0;for(const u of this.args)if(l++,s=u.evaluate(e),s&&s instanceof yt&&!s.available&&(r||(r=s.name),s=null,l===this.args.length&&(s=r)),s!==null)break;return s}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class Ds{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const s=[];for(let u=1;u<e.length-1;u+=2){const p=e[u];if(typeof p!="string")return r.error(`Expected string, but found ${typeof p} instead.`,u);if(/[^a-zA-Z0-9_]/.test(p))return r.error("Variable names must contain only alphanumeric characters or '_'.",u);const f=r.parse(e[u+1],u+1);if(!f)return null;s.push([p,f])}const l=r.parse(e[e.length-1],e.length-1,r.expectedType,s);return l?new Ds(s,l):null}outputDefined(){return this.result.outputDefined()}}class Ta{constructor(e,r,s){this.type=e,this.index=r,this.input=s}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,xe),l=r.parse(e[2],2,Ct(r.expectedType||Ge));return s&&l?new Ta(l.type.itemType,s,l):null}evaluate(e){const r=this.index.evaluate(e),s=this.input.evaluate(e);if(r<0)throw new Tt(`Array index out of bounds: ${r} < 0.`);if(r>=s.length)throw new Tt(`Array index out of bounds: ${r} > ${s.length-1}.`);if(r!==Math.floor(r))throw new Tt(`Array index must be an integer, but found ${r} instead.`);return s[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class Sa{constructor(e,r){this.type=Fe,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,Ge),l=r.parse(e[2],2,Ge);return s&&l?ne(s.type,[Fe,Le,xe,_t,Ge])?new Sa(s,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${st(s.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!s)return!1;if(!ce(r,["boolean","string","number","null"]))throw new Tt(`Expected first argument to be of type boolean, string, number or null, but found ${st(dt(r))} instead.`);if(!ce(s,["string","array"]))throw new Tt(`Expected second argument to be of type array or string, but found ${st(dt(s))} instead.`);return s.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Rs{constructor(e,r,s){this.type=xe,this.needle=e,this.haystack=r,this.fromIndex=s}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,Ge),l=r.parse(e[2],2,Ge);if(!s||!l)return null;if(!ne(s.type,[Fe,Le,xe,_t,Ge]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${st(s.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,xe);return u?new Rs(s,l,u):null}return new Rs(s,l)}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!ce(r,["boolean","string","number","null"]))throw new Tt(`Expected first argument to be of type boolean, string, number or null, but found ${st(dt(r))} instead.`);if(!ce(s,["string","array"]))throw new Tt(`Expected second argument to be of type array or string, but found ${st(dt(s))} instead.`);if(this.fromIndex){const l=this.fromIndex.evaluate(e);return s.indexOf(r,l)}return s.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class Ea{constructor(e,r,s,l,u,p){this.inputType=e,this.type=r,this.input=s,this.cases=l,this.outputs=u,this.otherwise=p}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let s,l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);const u={},p=[];for(let x=2;x<e.length-1;x+=2){let w=e[x];const T=e[x+1];Array.isArray(w)||(w=[w]);const C=r.concat(x);if(w.length===0)return C.error("Expected at least one branch label.");for(const P of w){if(typeof P!="number"&&typeof P!="string")return C.error("Branch labels must be numbers or strings.");if(typeof P=="number"&&Math.abs(P)>Number.MAX_SAFE_INTEGER)return C.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof P=="number"&&Math.floor(P)!==P)return C.error("Numeric branch labels must be integer values.");if(s){if(C.checkSubtype(s,dt(P)))return null}else s=dt(P);if(u[String(P)]!==void 0)return C.error("Branch labels must be unique.");u[String(P)]=p.length}const A=r.parse(T,x,l);if(!A)return null;l=l||A.type,p.push(A)}const f=r.parse(e[1],1,Ge);if(!f)return null;const g=r.parse(e[e.length-1],e.length-1,l);return g?f.type.kind!=="value"&&r.concat(1).checkSubtype(s,f.type)?null:new Ea(s,l,f,u,p,g):null}evaluate(e){const r=this.input.evaluate(e);return(dt(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class Ia{constructor(e,r,s){this.type=e,this.branches=r,this.otherwise=s}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let s;r.expectedType&&r.expectedType.kind!=="value"&&(s=r.expectedType);const l=[];for(let p=1;p<e.length-1;p+=2){const f=r.parse(e[p],p,Fe);if(!f)return null;const g=r.parse(e[p+1],p+1,s);if(!g)return null;l.push([f,g]),s=s||g.type}const u=r.parse(e[e.length-1],e.length-1,s);if(!u)return null;if(!s)throw new Error("Can't infer output type");return new Ia(s,l,u)}evaluate(e){for(const[r,s]of this.branches)if(r.evaluate(e))return s.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[r,s]of this.branches)e(r),e(s);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}}class Bs{constructor(e,r,s,l){this.type=e,this.input=r,this.beginIndex=s,this.endIndex=l}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,Ge),l=r.parse(e[2],2,xe);if(!s||!l)return null;if(!ne(s.type,[Ct(Ge),Le,Ge]))return r.error(`Expected first argument to be of type array or string, but found ${st(s.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,xe);return u?new Bs(s.type,s,l,u):null}return new Bs(s.type,s,l)}evaluate(e){const r=this.input.evaluate(e),s=this.beginIndex.evaluate(e);if(!ce(r,["string","array"]))throw new Tt(`Expected first argument to be of type array or string, but found ${st(dt(r))} instead.`);if(this.endIndex){const l=this.endIndex.evaluate(e);return r.slice(s,l)}return r.slice(s)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Uo(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Vo(i,e,r,s){return s.compare(e,r)===0}function vn(i,e,r){const s=i!=="=="&&i!=="!=";return class Id{constructor(u,p,f){this.type=Fe,this.lhs=u,this.rhs=p,this.collator=f,this.hasUntypedArgument=u.type.kind==="value"||p.type.kind==="value"}static parse(u,p){if(u.length!==3&&u.length!==4)return p.error("Expected two or three arguments.");const f=u[0];let g=p.parse(u[1],1,Ge);if(!g)return null;if(!Uo(f,g.type))return p.concat(1).error(`"${f}" comparisons are not supported for type '${st(g.type)}'.`);let x=p.parse(u[2],2,Ge);if(!x)return null;if(!Uo(f,x.type))return p.concat(2).error(`"${f}" comparisons are not supported for type '${st(x.type)}'.`);if(g.type.kind!==x.type.kind&&g.type.kind!=="value"&&x.type.kind!=="value")return p.error(`Cannot compare types '${st(g.type)}' and '${st(x.type)}'.`);s&&(g.type.kind==="value"&&x.type.kind!=="value"?g=new Ti(x.type,[g]):g.type.kind!=="value"&&x.type.kind==="value"&&(x=new Ti(g.type,[x])));let w=null;if(u.length===4){if(g.type.kind!=="string"&&x.type.kind!=="string"&&g.type.kind!=="value"&&x.type.kind!=="value")return p.error("Cannot use collator to compare non-string types.");if(w=p.parse(u[3],3,At),!w)return null}return new Id(g,x,w)}evaluate(u){const p=this.lhs.evaluate(u),f=this.rhs.evaluate(u);if(s&&this.hasUntypedArgument){const g=dt(p),x=dt(f);if(g.kind!==x.kind||g.kind!=="string"&&g.kind!=="number")throw new Tt(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${g.kind}, ${x.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const g=dt(p),x=dt(f);if(g.kind!=="string"||x.kind!=="string")return e(u,p,f)}return this.collator?r(u,p,f,this.collator.evaluate(u)):e(u,p,f)}eachChild(u){u(this.lhs),u(this.rhs),this.collator&&u(this.collator)}outputDefined(){return!0}}}const Ql=vn("==",function(i,e,r){return e===r},Vo),ec=vn("!=",function(i,e,r){return e!==r},function(i,e,r,s){return!Vo(0,e,r,s)}),tc=vn("<",function(i,e,r){return e<r},function(i,e,r,s){return s.compare(e,r)<0}),ic=vn(">",function(i,e,r){return e>r},function(i,e,r,s){return s.compare(e,r)>0}),rc=vn("<=",function(i,e,r){return e<=r},function(i,e,r,s){return s.compare(e,r)<=0}),nc=vn(">=",function(i,e,r){return e>=r},function(i,e,r,s){return s.compare(e,r)>=0});class Aa{constructor(e,r,s,l,u){this.type=Le,this.number=e,this.locale=r,this.currency=s,this.minFractionDigits=l,this.maxFractionDigits=u}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const s=r.parse(e[1],1,xe);if(!s)return null;const l=e[2];if(typeof l!="object"||Array.isArray(l))return r.error("NumberFormat options argument must be an object.");let u=null;if(l.locale&&(u=r.parse(l.locale,1,Le),!u))return null;let p=null;if(l.currency&&(p=r.parse(l.currency,1,Le),!p))return null;let f=null;if(l["min-fraction-digits"]&&(f=r.parse(l["min-fraction-digits"],1,xe),!f))return null;let g=null;return l["max-fraction-digits"]&&(g=r.parse(l["max-fraction-digits"],1,xe),!g)?null:new Aa(s,u,p,f,g)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class Fs{constructor(e){this.type=Wt,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const s=e[1];if(!Array.isArray(s)&&typeof s=="object")return r.error("First argument must be an image or text section.");const l=[];let u=!1;for(let p=1;p<=e.length-1;++p){const f=e[p];if(u&&typeof f=="object"&&!Array.isArray(f)){u=!1;let g=null;if(f["font-scale"]&&(g=r.parse(f["font-scale"],1,xe),!g))return null;let x=null;if(f["text-font"]&&(x=r.parse(f["text-font"],1,Ct(Le)),!x))return null;let w=null;if(f["text-color"]&&(w=r.parse(f["text-color"],1,bt),!w))return null;const T=l[l.length-1];T.scale=g,T.font=x,T.textColor=w}else{const g=r.parse(e[p],1,Ge);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'.");u=!0,l.push({content:g,scale:null,font:null,textColor:null})}}return new Fs(l)}evaluate(e){return new De(this.sections.map(r=>{const s=r.content.evaluate(e);return dt(s)===Ft?new pt("",s,null,null,null):new pt(fi(s),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null)}))}eachChild(e){for(const r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}}class Ca{constructor(e){this.type=Ft,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const s=r.parse(e[1],1,Le);return s?new Ca(s):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),s=yt.fromString(r);return s&&e.availableImages&&(s.available=e.availableImages.indexOf(r)>-1),s}eachChild(e){e(this.input)}outputDefined(){return!1}}class Ma{constructor(e){this.type=xe,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=r.parse(e[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${st(s.type)} instead.`):new Ma(s):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new Tt(`Expected value to be of type string or array, but found ${st(dt(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const bn={"==":Ql,"!=":ec,">":ic,"<":tc,">=":nc,"<=":rc,array:Ti,at:Ta,boolean:Ti,case:Ia,coalesce:Ls,collator:As,format:Fs,image:Ca,in:Sa,"index-of":Rs,interpolate:Vi,"interpolate-hcl":Vi,"interpolate-lab":Vi,length:Ma,let:Ds,literal:ci,match:Ea,number:Ti,"number-format":Aa,object:Ti,slice:Bs,step:xn,string:Ti,"to-boolean":Ui,"to-color":Ui,"to-number":Ui,"to-string":Ui,var:Ps,within:Hr};function No(i,[e,r,s,l]){e=e.evaluate(i),r=r.evaluate(i),s=s.evaluate(i);const u=l?l.evaluate(i):1,p=Ot(e,r,s,u);if(p)throw new Tt(p);return new le(e/255*u,r/255*u,s/255*u,u)}function Pa(i,e){return i in e}function ka(i,e){const r=e[i];return r===void 0?null:r}function Kr(i){return{type:i}}function $o(i){return{result:"success",value:i}}function Vt(i){return{result:"error",value:i}}function wn(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function mt(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function Yn(i){return!!i.expression&&i.expression.interpolated}function tt(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function zt(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Os(i){return i}function za(i,e){const r=e.type==="color",s=i.stops&&typeof i.stops[0][0]=="object",l=s||!(s||i.property!==void 0),u=i.type||(Yn(e)?"exponential":"interval");if(r||e.type==="padding"){const x=r?le.parse:ot.parse;(i=ae({},i)).stops&&(i.stops=i.stops.map(w=>[w[0],x(w[1])])),i.default=x(i.default?i.default:e.default)}if(i.colorSpace&&i.colorSpace!=="rgb"&&!Oo[i.colorSpace])throw new Error(`Unknown color space: ${i.colorSpace}`);let p,f,g;if(u==="exponential")p=Go;else if(u==="interval")p=ac;else if(u==="categorical"){p=sc,f=Object.create(null);for(const x of i.stops)f[x[0]]=x[1];g=typeof i.stops[0][0]}else{if(u!=="identity")throw new Error(`Unknown function type "${u}"`);p=jo}if(s){const x={},w=[];for(let A=0;A<i.stops.length;A++){const P=i.stops[A],F=P[0].zoom;x[F]===void 0&&(x[F]={zoom:F,type:i.type,property:i.property,default:i.default,stops:[]},w.push(F)),x[F].stops.push([P[0].value,P[1]])}const T=[];for(const A of w)T.push([x[A].zoom,za(x[A],e)]);const C={name:"linear"};return{kind:"composite",interpolationType:C,interpolationFactor:Vi.interpolationFactor.bind(void 0,C),zoomStops:T.map(A=>A[0]),evaluate:({zoom:A},P)=>Go({stops:T,base:i.base},e,A).evaluate(A,P)}}if(l){const x=u==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:x,interpolationFactor:Vi.interpolationFactor.bind(void 0,x),zoomStops:i.stops.map(w=>w[0]),evaluate:({zoom:w})=>p(i,e,w,f,g)}}return{kind:"source",evaluate(x,w){const T=w&&w.properties?w.properties[i.property]:void 0;return T===void 0?Qn(i.default,e.default):p(i,e,T,f,g)}}}function Qn(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function sc(i,e,r,s,l){return Qn(typeof r===l?s[r]:void 0,i.default,e.default)}function ac(i,e,r){if(tt(r)!=="number")return Qn(i.default,e.default);const s=i.stops.length;if(s===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[s-1][0])return i.stops[s-1][1];const l=ks(i.stops.map(u=>u[0]),r);return i.stops[l][1]}function Go(i,e,r){const s=i.base!==void 0?i.base:1;if(tt(r)!=="number")return Qn(i.default,e.default);const l=i.stops.length;if(l===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[l-1][0])return i.stops[l-1][1];const u=ks(i.stops.map(w=>w[0]),r),p=function(w,T,C,A){const P=A-C,F=w-C;return P===0?0:T===1?F/P:(Math.pow(T,F)-1)/(Math.pow(T,P)-1)}(r,s,i.stops[u][0],i.stops[u+1][0]),f=i.stops[u][1],g=i.stops[u+1][1];let x=zs[e.type]||Os;if(i.colorSpace&&i.colorSpace!=="rgb"){const w=Oo[i.colorSpace];x=(T,C)=>w.reverse(w.interpolate(w.forward(T),w.forward(C),p))}return typeof f.evaluate=="function"?{evaluate(...w){const T=f.evaluate.apply(void 0,w),C=g.evaluate.apply(void 0,w);if(T!==void 0&&C!==void 0)return x(T,C,p)}}:x(f,g,p)}function jo(i,e,r){switch(e.type){case"color":r=le.parse(r);break;case"formatted":r=De.fromString(r.toString());break;case"resolvedImage":r=yt.fromString(r.toString());break;case"padding":r=ot.parse(r);break;default:tt(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return Qn(r,i.default,e.default)}Yi.register(bn,{error:[{kind:"error"},[Le],(i,[e])=>{throw new Tt(e.evaluate(i))}],typeof:[Le,[Ge],(i,[e])=>st(dt(e.evaluate(i)))],"to-rgba":[Ct(xe,4),[bt],(i,[e])=>e.evaluate(i).toArray()],rgb:[bt,[xe,xe,xe],No],rgba:[bt,[xe,xe,xe,xe],No],has:{type:Fe,overloads:[[[Le],(i,[e])=>Pa(e.evaluate(i),i.properties())],[[Le,Bt],(i,[e,r])=>Pa(e.evaluate(i),r.evaluate(i))]]},get:{type:Ge,overloads:[[[Le],(i,[e])=>ka(e.evaluate(i),i.properties())],[[Le,Bt],(i,[e,r])=>ka(e.evaluate(i),r.evaluate(i))]]},"feature-state":[Ge,[Le],(i,[e])=>ka(e.evaluate(i),i.featureState||{})],properties:[Bt,[],i=>i.properties()],"geometry-type":[Le,[],i=>i.geometryType()],id:[Ge,[],i=>i.id()],zoom:[xe,[],i=>i.globals.zoom],"heatmap-density":[xe,[],i=>i.globals.heatmapDensity||0],"line-progress":[xe,[],i=>i.globals.lineProgress||0],accumulated:[Ge,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[xe,Kr(xe),(i,e)=>{let r=0;for(const s of e)r+=s.evaluate(i);return r}],"*":[xe,Kr(xe),(i,e)=>{let r=1;for(const s of e)r*=s.evaluate(i);return r}],"-":{type:xe,overloads:[[[xe,xe],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[xe],(i,[e])=>-e.evaluate(i)]]},"/":[xe,[xe,xe],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[xe,[xe,xe],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[xe,[],()=>Math.LN2],pi:[xe,[],()=>Math.PI],e:[xe,[],()=>Math.E],"^":[xe,[xe,xe],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[xe,[xe],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[xe,[xe],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[xe,[xe],(i,[e])=>Math.log(e.evaluate(i))],log2:[xe,[xe],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[xe,[xe],(i,[e])=>Math.sin(e.evaluate(i))],cos:[xe,[xe],(i,[e])=>Math.cos(e.evaluate(i))],tan:[xe,[xe],(i,[e])=>Math.tan(e.evaluate(i))],asin:[xe,[xe],(i,[e])=>Math.asin(e.evaluate(i))],acos:[xe,[xe],(i,[e])=>Math.acos(e.evaluate(i))],atan:[xe,[xe],(i,[e])=>Math.atan(e.evaluate(i))],min:[xe,Kr(xe),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[xe,Kr(xe),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[xe,[xe],(i,[e])=>Math.abs(e.evaluate(i))],round:[xe,[xe],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[xe,[xe],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[xe,[xe],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[Fe,[Le,Ge],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[Fe,[Ge],(i,[e])=>i.id()===e.value],"filter-type-==":[Fe,[Le],(i,[e])=>i.geometryType()===e.value],"filter-<":[Fe,[Le,Ge],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s<l}],"filter-id-<":[Fe,[Ge],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r<s}],"filter->":[Fe,[Le,Ge],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>l}],"filter-id->":[Fe,[Ge],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>s}],"filter-<=":[Fe,[Le,Ge],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s<=l}],"filter-id-<=":[Fe,[Ge],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r<=s}],"filter->=":[Fe,[Le,Ge],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>=l}],"filter-id->=":[Fe,[Ge],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>=s}],"filter-has":[Fe,[Ge],(i,[e])=>e.value in i.properties()],"filter-has-id":[Fe,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Fe,[Ct(Le)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[Fe,[Ct(Ge)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[Fe,[Le,Ct(Ge)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[Fe,[Le,Ct(Ge)],(i,[e,r])=>function(s,l,u,p){for(;u<=p;){const f=u+p>>1;if(l[f]===s)return!0;l[f]>s?p=f-1:u=f+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:Fe,overloads:[[[Fe,Fe],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[Kr(Fe),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:Fe,overloads:[[[Fe,Fe],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[Kr(Fe),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[Fe,[Fe],(i,[e])=>!e.evaluate(i)],"is-supported-script":[Fe,[Le],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[Le,[Le],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[Le,[Le],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[Le,Kr(Ge),(i,e)=>e.map(r=>fi(r.evaluate(i))).join("")],"resolved-locale":[Le,[At],(i,[e])=>e.evaluate(i).resolvedLocale()]});class Us{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new Ao,this._defaultValue=r?function(s){return s.type==="color"&&zt(s.default)?new le(0,0,0,0):s.type==="color"?le.parse(s.default)||null:s.type==="padding"?ot.parse(s.default)||null:s.default===void 0?null:s.default}(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,s,l,u,p){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=s,this._evaluator.canonical=l,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=p,this.expression.evaluate(this._evaluator)}evaluate(e,r,s,l,u,p){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=s||null,this._evaluator.canonical=l,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=p||null;try{const f=this.expression.evaluate(this._evaluator);if(f==null||typeof f=="number"&&f!=f)return this._defaultValue;if(this._enumValues&&!(f in this._enumValues))throw new Tt(`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 es(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in bn}function ts(i,e){const r=new Lo(bn,[],e?function(l){const u={color:bt,string:Le,number:xe,enum:Le,boolean:Fe,formatted:Wt,padding:ri,resolvedImage:Ft};return l.type==="array"?Ct(u[l.value]||Ge,l.length):u[l.type]}(e):void 0),s=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?$o(new Us(s,e)):Vt(r.errors)}class is{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!yn(r.expression)}evaluateWithoutErrorHandling(e,r,s,l,u,p){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,l,u,p)}evaluate(e,r,s,l,u,p){return this._styleExpression.evaluate(e,r,s,l,u,p)}}class La{constructor(e,r,s,l){this.kind=e,this.zoomStops=s,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!yn(r.expression),this.interpolationType=l}evaluateWithoutErrorHandling(e,r,s,l,u,p){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,l,u,p)}evaluate(e,r,s,l,u,p){return this._styleExpression.evaluate(e,r,s,l,u,p)}interpolationFactor(e,r,s){return this.interpolationType?Vi.interpolationFactor(this.interpolationType,e,r,s):0}}function qo(i,e){const r=ts(i,e);if(r.result==="error")return r;const s=r.value.expression,l=Wn(s);if(!l&&!wn(e))return Vt([new Ce("","data expressions not supported")]);const u=Ms(s,["zoom"]);if(!u&&!mt(e))return Vt([new Ce("","zoom expressions not supported")]);const p=Ns(s);return p||u?p instanceof Ce?Vt([p]):p instanceof Vi&&!Yn(e)?Vt([new Ce("",'"interpolate" expressions cannot be used with this property')]):$o(p?new La(l?"camera":"composite",r.value,p.labels,p instanceof Vi?p.interpolation:void 0):new is(l?"constant":"source",r.value)):Vt([new Ce("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Vs{constructor(e,r){this._parameters=e,this._specification=r,ae(this,za(this._parameters,this._specification))}static deserialize(e){return new Vs(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Ns(i){let e=null;if(i instanceof Ds)e=Ns(i.result);else if(i instanceof Ls){for(const r of i.args)if(e=Ns(r),e)break}else(i instanceof xn||i instanceof Vi)&&i.input instanceof Yi&&i.input.name==="zoom"&&(e=i);return e instanceof Ce||i.eachChild(r=>{const s=Ns(r);s instanceof Ce?e=s:!e&&s?e=new Ce("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&s&&e!==s&&(e=new Ce("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Qi(i){const e=i.key,r=i.value,s=i.valueSpec||{},l=i.objectElementValidators||{},u=i.style,p=i.styleSpec,f=i.validateSpec;let g=[];const x=tt(r);if(x!=="object")return[new H(e,r,`object expected, ${x} found`)];for(const w in r){const T=w.split(".")[0],C=s[T]||s["*"];let A;if(l[T])A=l[T];else if(s[T])A=f;else if(l["*"])A=l["*"];else{if(!s["*"]){g.push(new H(e,r[w],`unknown property "${w}"`));continue}A=f}g=g.concat(A({key:(e&&`${e}.`)+w,value:r[w],valueSpec:C,style:u,styleSpec:p,object:r,objectKey:w,validateSpec:f},r))}for(const w in s)l[w]||s[w].required&&s[w].default===void 0&&r[w]===void 0&&g.push(new H(e,r,`missing required property "${w}"`));return g}function Zo(i){const e=i.value,r=i.valueSpec,s=i.style,l=i.styleSpec,u=i.key,p=i.arrayElementValidator||i.validateSpec;if(tt(e)!=="array")return[new H(u,e,`array expected, ${tt(e)} found`)];if(r.length&&e.length!==r.length)return[new H(u,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new H(u,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let f={type:r.value,values:r.values};l.$version<7&&(f.function=r.function),tt(r.value)==="object"&&(f=r.value);let g=[];for(let x=0;x<e.length;x++)g=g.concat(p({array:e,arrayIndex:x,value:e[x],valueSpec:f,validateSpec:i.validateSpec,style:s,styleSpec:l,key:`${u}[${x}]`}));return g}function Da(i){const e=i.key,r=i.value,s=i.valueSpec;let l=tt(r);return l==="number"&&r!=r&&(l="NaN"),l!=="number"?[new H(e,r,`number expected, ${l} found`)]:"minimum"in s&&r<s.minimum?[new H(e,r,`${r} is less than the minimum value ${s.minimum}`)]:"maximum"in s&&r>s.maximum?[new H(e,r,`${r} is greater than the maximum value ${s.maximum}`)]:[]}function Xo(i){const e=i.valueSpec,r=Ie(i.value.type);let s,l,u,p={};const f=r!=="categorical"&&i.value.property===void 0,g=!f,x=tt(i.value.stops)==="array"&&tt(i.value.stops[0])==="array"&&tt(i.value.stops[0][0])==="object",w=Qi({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(A){if(r==="identity")return[new H(A.key,A.value,'identity function may not have a "stops" property')];let P=[];const F=A.value;return P=P.concat(Zo({key:A.key,value:F,valueSpec:A.valueSpec,validateSpec:A.validateSpec,style:A.style,styleSpec:A.styleSpec,arrayElementValidator:T})),tt(F)==="array"&&F.length===0&&P.push(new H(A.key,F,"array must have at least one stop")),P},default:function(A){return A.validateSpec({key:A.key,value:A.value,valueSpec:e,validateSpec:A.validateSpec,style:A.style,styleSpec:A.styleSpec})}}});return r==="identity"&&f&&w.push(new H(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||w.push(new H(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!Yn(i.valueSpec)&&w.push(new H(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(g&&!wn(i.valueSpec)?w.push(new H(i.key,i.value,"property functions not supported")):f&&!mt(i.valueSpec)&&w.push(new H(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!x||i.value.property!==void 0||w.push(new H(i.key,i.value,'"property" property is required')),w;function T(A){let P=[];const F=A.value,O=A.key;if(tt(F)!=="array")return[new H(O,F,`array expected, ${tt(F)} found`)];if(F.length!==2)return[new H(O,F,`array length 2 expected, length ${F.length} found`)];if(x){if(tt(F[0])!=="object")return[new H(O,F,`object expected, ${tt(F[0])} found`)];if(F[0].zoom===void 0)return[new H(O,F,"object stop key must have zoom")];if(F[0].value===void 0)return[new H(O,F,"object stop key must have value")];if(u&&u>Ie(F[0].zoom))return[new H(O,F[0].zoom,"stop zoom values must appear in ascending order")];Ie(F[0].zoom)!==u&&(u=Ie(F[0].zoom),l=void 0,p={}),P=P.concat(Qi({key:`${O}[0]`,value:F[0],valueSpec:{zoom:{}},validateSpec:A.validateSpec,style:A.style,styleSpec:A.styleSpec,objectElementValidators:{zoom:Da,value:C}}))}else P=P.concat(C({key:`${O}[0]`,value:F[0],valueSpec:{},validateSpec:A.validateSpec,style:A.style,styleSpec:A.styleSpec},F));return es(Pe(F[1]))?P.concat([new H(`${O}[1]`,F[1],"expressions are not allowed in function stops.")]):P.concat(A.validateSpec({key:`${O}[1]`,value:F[1],valueSpec:e,validateSpec:A.validateSpec,style:A.style,styleSpec:A.styleSpec}))}function C(A,P){const F=tt(A.value),O=Ie(A.value),q=A.value!==null?A.value:P;if(s){if(F!==s)return[new H(A.key,q,`${F} stop domain type must match previous stop domain type ${s}`)]}else s=F;if(F!=="number"&&F!=="string"&&F!=="boolean")return[new H(A.key,q,"stop domain value must be a number, string, or boolean")];if(F!=="number"&&r!=="categorical"){let Y=`number expected, ${F} found`;return wn(e)&&r===void 0&&(Y+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new H(A.key,q,Y)]}return r!=="categorical"||F!=="number"||isFinite(O)&&Math.floor(O)===O?r!=="categorical"&&F==="number"&&l!==void 0&&O<l?[new H(A.key,q,"stop domain values must appear in ascending order")]:(l=O,r==="categorical"&&O in p?[new H(A.key,q,"stop domain values must be unique")]:(p[O]=!0,[])):[new H(A.key,q,`integer expected, found ${O}`)]}}function Jr(i){const e=(i.expressionContext==="property"?qo:ts)(Pe(i.value),i.valueSpec);if(e.result==="error")return e.value.map(s=>new H(`${i.key}${s.key}`,i.value,s.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new H(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"&&!yn(r))return[new H(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!yn(r))return[new H(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Ms(r,["zoom","feature-state"]))return[new H(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Wn(r))return[new H(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function rs(i){const e=i.key,r=i.value,s=i.valueSpec,l=[];return Array.isArray(s.values)?s.values.indexOf(Ie(r))===-1&&l.push(new H(e,r,`expected one of [${s.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(s.values).indexOf(Ie(r))===-1&&l.push(new H(e,r,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(r)} found`)),l}function Tn(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!Tn(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const oc={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function $s(i){if(i==null)return{filter:()=>!0,needGeometry:!1};Tn(i)||(i=Sn(i));const e=ts(i,oc);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,s,l)=>e.value.evaluate(r,s,{},l),needGeometry:Ho(i)}}function Wo(i,e){return i<e?-1:i>e?1:0}function Ho(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e<i.length;e++)if(Ho(i[e]))return!0;return!1}function Sn(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?En(i[1],i[2],"=="):e==="!="?qs(En(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?En(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(Sn))):e==="all"?["all"].concat(i.slice(1).map(Sn)):e==="none"?["all"].concat(i.slice(1).map(Sn).map(qs)):e==="in"?Gs(i[1],i.slice(2)):e==="!in"?qs(Gs(i[1],i.slice(2))):e==="has"?js(i[1]):e==="!has"?qs(js(i[1])):e!=="within"||i;var r}function En(i,e,r){switch(i){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,i,e]}}function Gs(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",i,["literal",e.sort(Wo)]]:["filter-in-small",i,["literal",e]]}}function js(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function qs(i){return["!",i]}function In(i){return Tn(Pe(i.value))?Jr(ae({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Ko(i)}function Ko(i){const e=i.value,r=i.key;if(tt(e)!=="array")return[new H(r,e,`array expected, ${tt(e)} found`)];const s=i.styleSpec;let l,u=[];if(e.length<1)return[new H(r,e,"filter array must have at least 1 element")];switch(u=u.concat(rs({key:`${r}[0]`,value:e[0],valueSpec:s.filter_operator,style:i.style,styleSpec:i.styleSpec})),Ie(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Ie(e[1])==="$type"&&u.push(new H(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&u.push(new H(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(l=tt(e[1]),l!=="string"&&u.push(new H(`${r}[1]`,e[1],`string expected, ${l} found`)));for(let p=2;p<e.length;p++)l=tt(e[p]),Ie(e[1])==="$type"?u=u.concat(rs({key:`${r}[${p}]`,value:e[p],valueSpec:s.geometry_type,style:i.style,styleSpec:i.styleSpec})):l!=="string"&&l!=="number"&&l!=="boolean"&&u.push(new H(`${r}[${p}]`,e[p],`string, number, or boolean expected, ${l} found`));break;case"any":case"all":case"none":for(let p=1;p<e.length;p++)u=u.concat(Ko({key:`${r}[${p}]`,value:e[p],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":l=tt(e[1]),e.length!==2?u.push(new H(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):l!=="string"&&u.push(new H(`${r}[1]`,e[1],`string expected, ${l} found`));break;case"within":l=tt(e[1]),e.length!==2?u.push(new H(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):l!=="object"&&u.push(new H(`${r}[1]`,e[1],`object expected, ${l} found`))}return u}function Jo(i,e){const r=i.key,s=i.validateSpec,l=i.style,u=i.styleSpec,p=i.value,f=i.objectKey,g=u[`${e}_${i.layerType}`];if(!g)return[];const x=f.match(/^(.*)-transition$/);if(e==="paint"&&x&&g[x[1]]&&g[x[1]].transition)return s({key:r,value:p,valueSpec:u.transition,style:l,styleSpec:u});const w=i.valueSpec||g[f];if(!w)return[new H(r,p,`unknown property "${f}"`)];let T;if(tt(p)==="string"&&wn(w)&&!w.tokens&&(T=/^{([^}]+)}$/.exec(p)))return[new H(r,p,`"${f}" does not support interpolation syntax
2
+ Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(T[1])} }\`.`)];const C=[];return i.layerType==="symbol"&&(f==="text-field"&&l&&!l.glyphs&&C.push(new H(r,p,'use of "text-field" requires a style "glyphs" property')),f==="text-font"&&zt(Pe(p))&&Ie(p.type)==="identity"&&C.push(new H(r,p,'"text-font" does not support identity functions'))),C.concat(s({key:i.key,value:p,valueSpec:w,style:l,styleSpec:u,expressionContext:"property",propertyType:e,propertyKey:f}))}function Yo(i){return Jo(i,"paint")}function Qo(i){return Jo(i,"layout")}function el(i){let e=[];const r=i.value,s=i.key,l=i.style,u=i.styleSpec;r.type||r.ref||e.push(new H(s,r,'either "type" or "ref" is required'));let p=Ie(r.type);const f=Ie(r.ref);if(r.id){const g=Ie(r.id);for(let x=0;x<i.arrayIndex;x++){const w=l.layers[x];Ie(w.id)===g&&e.push(new H(s,r.id,`duplicate layer id "${r.id}", previously used at line ${w.id.__line__}`))}}if("ref"in r){let g;["type","source","source-layer","filter","layout"].forEach(x=>{x in r&&e.push(new H(s,r[x],`"${x}" is prohibited for ref layers`))}),l.layers.forEach(x=>{Ie(x.id)===f&&(g=x)}),g?g.ref?e.push(new H(s,r.ref,"ref cannot reference another ref layer")):p=Ie(g.type):e.push(new H(s,r.ref,`ref layer "${f}" not found`))}else if(p!=="background")if(r.source){const g=l.sources&&l.sources[r.source],x=g&&Ie(g.type);g?x==="vector"&&p==="raster"?e.push(new H(s,r.source,`layer "${r.id}" requires a raster source`)):x==="raster"&&p!=="raster"?e.push(new H(s,r.source,`layer "${r.id}" requires a vector source`)):x!=="vector"||r["source-layer"]?x==="raster-dem"&&p!=="hillshade"?e.push(new H(s,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):p!=="line"||!r.paint||!r.paint["line-gradient"]||x==="geojson"&&g.lineMetrics||e.push(new H(s,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new H(s,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new H(s,r.source,`source "${r.source}" not found`))}else e.push(new H(s,r,'missing required property "source"'));return e=e.concat(Qi({key:s,value:r,valueSpec:u.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${s}.type`,value:r.type,valueSpec:u.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:In,layout:g=>Qi({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":x=>Qo(ae({layerType:p},x))}}),paint:g=>Qi({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":x=>Yo(ae({layerType:p},x))}})}})),e}function gr(i){const e=i.value,r=i.key,s=tt(e);return s!=="string"?[new H(r,e,`string expected, ${s} found`)]:[]}const ns={promoteId:function({key:i,value:e}){if(tt(e)==="string")return gr({key:i,value:e});{const r=[];for(const s in e)r.push(...gr({key:`${i}.${s}`,value:e[s]}));return r}}};function Ni(i){const e=i.value,r=i.key,s=i.styleSpec,l=i.style,u=i.validateSpec;if(!e.type)return[new H(r,e,'"type" is required')];const p=Ie(e.type);let f;switch(p){case"vector":case"raster":case"raster-dem":return f=Qi({key:r,value:e,valueSpec:s[`source_${p.replace("-","_")}`],style:i.style,styleSpec:s,objectElementValidators:ns,validateSpec:u}),f;case"geojson":if(f=Qi({key:r,value:e,valueSpec:s.source_geojson,style:l,styleSpec:s,validateSpec:u,objectElementValidators:ns}),e.cluster)for(const g in e.clusterProperties){const[x,w]=e.clusterProperties[g],T=typeof x=="string"?[x,["accumulated"],["get",g]]:x;f.push(...Jr({key:`${r}.${g}.map`,value:w,validateSpec:u,expressionContext:"cluster-map"})),f.push(...Jr({key:`${r}.${g}.reduce`,value:T,validateSpec:u,expressionContext:"cluster-reduce"}))}return f;case"video":return Qi({key:r,value:e,valueSpec:s.source_video,style:l,validateSpec:u,styleSpec:s});case"image":return Qi({key:r,value:e,valueSpec:s.source_image,style:l,validateSpec:u,styleSpec:s});case"canvas":return[new H(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return rs({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:l,validateSpec:u,styleSpec:s})}}function ss(i){const e=i.value,r=i.styleSpec,s=r.light,l=i.style;let u=[];const p=tt(e);if(e===void 0)return u;if(p!=="object")return u=u.concat([new H("light",e,`object expected, ${p} found`)]),u;for(const f in e){const g=f.match(/^(.*)-transition$/);u=u.concat(g&&s[g[1]]&&s[g[1]].transition?i.validateSpec({key:f,value:e[f],valueSpec:r.transition,validateSpec:i.validateSpec,style:l,styleSpec:r}):s[f]?i.validateSpec({key:f,value:e[f],valueSpec:s[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new H(f,e[f],`unknown property "${f}"`)])}return u}function tl(i){const e=i.value,r=i.styleSpec,s=r.terrain,l=i.style;let u=[];const p=tt(e);if(e===void 0)return u;if(p!=="object")return u=u.concat([new H("terrain",e,`object expected, ${p} found`)]),u;for(const f in e)u=u.concat(s[f]?i.validateSpec({key:f,value:e[f],valueSpec:s[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new H(f,e[f],`unknown property "${f}"`)]);return u}function il(i){let e=[];const r=i.value,s=i.key;if(Array.isArray(r)){const l=[],u=[];for(const p in r)r[p].id&&l.includes(r[p].id)&&e.push(new H(s,r,`all the sprites' ids must be unique, but ${r[p].id} is duplicated`)),l.push(r[p].id),r[p].url&&u.includes(r[p].url)&&e.push(new H(s,r,`all the sprites' URLs must be unique, but ${r[p].url} is duplicated`)),u.push(r[p].url),e=e.concat(Qi({key:`${s}[${p}]`,value:r[p],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return e}return gr({key:s,value:r})}const rl={"*":()=>[],array:Zo,boolean:function(i){const e=i.value,r=i.key,s=tt(e);return s!=="boolean"?[new H(r,e,`boolean expected, ${s} found`)]:[]},number:Da,color:function(i){const e=i.key,r=i.value,s=tt(r);return s!=="string"?[new H(e,r,`color expected, ${s} found`)]:fe(r)===null?[new H(e,r,`color expected, "${r}" found`)]:[]},constants:ve,enum:rs,filter:In,function:Xo,layer:el,object:Qi,source:Ni,light:ss,terrain:tl,string:gr,formatted:function(i){return gr(i).length===0?[]:Jr(i)},resolvedImage:function(i){return gr(i).length===0?[]:Jr(i)},padding:function(i){const e=i.key,r=i.value;if(tt(r)==="array"){if(r.length<1||r.length>4)return[new H(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const s={type:"number"};let l=[];for(let u=0;u<r.length;u++)l=l.concat(i.validateSpec({key:`${e}[${u}]`,value:r[u],validateSpec:i.validateSpec,valueSpec:s}));return l}return Da({key:e,value:r,valueSpec:{}})},sprite:il};function as(i){const e=i.value,r=i.valueSpec,s=i.styleSpec;return i.validateSpec=as,r.expression&&zt(Ie(e))?Xo(i):r.expression&&es(Pe(e))?Jr(i):r.type&&rl[r.type]?rl[r.type](i):Qi(ae({},i,{valueSpec:r.type?s[r.type]:r}))}function Zs(i){const e=i.value,r=i.key,s=gr(i);return s.length||(e.indexOf("{fontstack}")===-1&&s.push(new H(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&s.push(new H(r,e,'"glyphs" url must include a "{range}" token'))),s}function _r(i,e=V){let r=[];return r=r.concat(as({key:"",value:i,valueSpec:e.$root,styleSpec:e,style:i,validateSpec:as,objectElementValidators:{glyphs:Zs,"*":()=>[]}})),i.constants&&(r=r.concat(ve({key:"constants",value:i.constants,style:i,styleSpec:e,validateSpec:as}))),nl(r)}function or(i){return function(e){return i({...e,validateSpec:as})}}function nl(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function $i(i){return function(...e){return nl(i.apply(this,e))}}_r.source=$i(or(Ni)),_r.sprite=$i(or(il)),_r.glyphs=$i(or(Zs)),_r.light=$i(or(ss)),_r.terrain=$i(or(tl)),_r.layer=$i(or(el)),_r.filter=$i(or(In)),_r.paintProperty=$i(or(Yo)),_r.layoutProperty=$i(or(Qo));const os=_r,Ra=os.light,sl=os.paintProperty,Ba=os.layoutProperty;function Fa(i,e){let r=!1;if(e&&e.length)for(const s of e)i.fire(new G(new Error(s.message))),r=!0;return r}class An{constructor(e,r,s){const l=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const p=new Int32Array(this.arrayBuffer);e=p[0],this.d=(r=p[1])+2*(s=p[2]);for(let g=0;g<this.d*this.d;g++){const x=p[3+g],w=p[3+g+1];l.push(x===w?null:p.subarray(x,w))}const f=p[3+l.length+1];this.keys=p.subarray(p[3+l.length],f),this.bboxes=p.subarray(f),this.insert=this._insertReadonly}else{this.d=r+2*s;for(let p=0;p<this.d*this.d;p++)l.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=s,this.scale=r/e,this.uid=0;const u=s/r*e;this.min=-u,this.max=e+u}insert(e,r,s,l,u){this._forEachCell(r,s,l,u,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(s),this.bboxes.push(l),this.bboxes.push(u)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,s,l,u,p){this.cells[u].push(p)}query(e,r,s,l,u){const p=this.min,f=this.max;if(e<=p&&r<=p&&f<=s&&f<=l&&!u)return Array.prototype.slice.call(this.keys);{const g=[];return this._forEachCell(e,r,s,l,this._queryCell,g,{},u),g}}_queryCell(e,r,s,l,u,p,f,g){const x=this.cells[u];if(x!==null){const w=this.keys,T=this.bboxes;for(let C=0;C<x.length;C++){const A=x[C];if(f[A]===void 0){const P=4*A;(g?g(T[P+0],T[P+1],T[P+2],T[P+3]):e<=T[P+2]&&r<=T[P+3]&&s>=T[P+0]&&l>=T[P+1])?(f[A]=!0,p.push(w[A])):f[A]=!1}}}}_forEachCell(e,r,s,l,u,p,f,g){const x=this._convertToCellCoord(e),w=this._convertToCellCoord(r),T=this._convertToCellCoord(s),C=this._convertToCellCoord(l);for(let A=x;A<=T;A++)for(let P=w;P<=C;P++){const F=this.d*P+A;if((!g||g(this._convertFromCellCoord(A),this._convertFromCellCoord(P),this._convertFromCellCoord(A+1),this._convertFromCellCoord(P+1)))&&u.call(this,e,r,s,l,F,p,f,g))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,r=3+this.cells.length+1+1;let s=0;for(let p=0;p<this.cells.length;p++)s+=this.cells[p].length;const l=new Int32Array(r+s+this.keys.length+this.bboxes.length);l[0]=this.extent,l[1]=this.n,l[2]=this.padding;let u=r;for(let p=0;p<e.length;p++){const f=e[p];l[3+p]=u,l.set(f,u),u+=f.length}return l[3+e.length]=u,l.set(this.keys,u),u+=this.keys.length,l[3+e.length+1]=u,l.set(this.bboxes,u),u+=this.bboxes.length,l.buffer}static serialize(e,r){const s=e.toArrayBuffer();return r&&r.push(s),{buffer:s}}static deserialize(e){return new An(e.buffer)}}const $r={};function $e(i,e,r={}){if($r[i])throw new Error(`${i} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),$r[i]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}$e("Object",Object),$e("TransferableGridIndex",An),$e("Color",le),$e("Error",Error),$e("AJAXError",Ar),$e("ResolvedImage",yt),$e("StylePropertyFunction",Vs),$e("StyleExpression",Us,{omit:["_evaluator"]}),$e("ZoomDependentExpression",La),$e("ZoomConstantExpression",is),$e("CompoundExpression",Yi,{omit:["_evaluate"]});for(const i in bn)bn[i]._classRegistryKey||$e(`Expression_${i}`,bn[i]);function ls(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function Cn(i,e){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob)return i;if(ls(i)||Fr(i))return e&&e.push(i),i;if(ArrayBuffer.isView(i)){const r=i;return e&&e.push(r.buffer),r}if(i instanceof ImageData)return e&&e.push(i.data.buffer),i;if(Array.isArray(i)){const r=[];for(const s of i)r.push(Cn(s,e));return r}if(typeof i=="object"){const r=i.constructor,s=r._classRegistryKey;if(!s)throw new Error("can't serialize object of unregistered class");if(!$r[s])throw new Error(`${s} is not registered.`);const l=r.serialize?r.serialize(i,e):{};if(r.serialize){if(e&&l===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const u in i){if(!i.hasOwnProperty(u)||$r[s].omit.indexOf(u)>=0)continue;const p=i[u];l[u]=$r[s].shallow.indexOf(u)>=0?p:Cn(p,e)}i instanceof Error&&(l.message=i.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return s!=="Object"&&(l.$name=s),l}throw new Error("can't serialize object of type "+typeof i)}function cs(i){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||ls(i)||Fr(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(cs);if(typeof i=="object"){const e=i.$name||"Object";if(!$r[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=$r[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const s=Object.create(r.prototype);for(const l of Object.keys(i)){if(l==="$name")continue;const u=i[l];s[l]=$r[e].shallow.indexOf(l)>=0?u:cs(u)}return s}throw new Error("can't deserialize object of type "+typeof i)}class Oa{constructor(){this.first=!0}update(e,r){const s=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=s,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=s,!0):(this.lastFloorZoom>s?(this.lastIntegerZoom=s+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<s&&(this.lastIntegerZoom=s,this.lastIntegerZoomTime=r),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=s,!0))}}const Oe={"Latin-1 Supplement":i=>i>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function hs(i){for(const e of i)if(Ua(e.charCodeAt(0)))return!0;return!1}function lc(i){for(const e of i)if(!cc(e.charCodeAt(0)))return!1;return!0}function cc(i){return!(Oe.Arabic(i)||Oe["Arabic Supplement"](i)||Oe["Arabic Extended-A"](i)||Oe["Arabic Presentation Forms-A"](i)||Oe["Arabic Presentation Forms-B"](i))}function Ua(i){return!(i!==746&&i!==747&&(i<4352||!(Oe["Bopomofo Extended"](i)||Oe.Bopomofo(i)||Oe["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||Oe["CJK Compatibility Ideographs"](i)||Oe["CJK Compatibility"](i)||Oe["CJK Radicals Supplement"](i)||Oe["CJK Strokes"](i)||!(!Oe["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Oe["CJK Unified Ideographs Extension A"](i)||Oe["CJK Unified Ideographs"](i)||Oe["Enclosed CJK Letters and Months"](i)||Oe["Hangul Compatibility Jamo"](i)||Oe["Hangul Jamo Extended-A"](i)||Oe["Hangul Jamo Extended-B"](i)||Oe["Hangul Jamo"](i)||Oe["Hangul Syllables"](i)||Oe.Hiragana(i)||Oe["Ideographic Description Characters"](i)||Oe.Kanbun(i)||Oe["Kangxi Radicals"](i)||Oe["Katakana Phonetic Extensions"](i)||Oe.Katakana(i)&&i!==12540||!(!Oe["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)||!(!Oe["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||Oe["Unified Canadian Aboriginal Syllabics"](i)||Oe["Unified Canadian Aboriginal Syllabics Extended"](i)||Oe["Vertical Forms"](i)||Oe["Yijing Hexagram Symbols"](i)||Oe["Yi Syllables"](i)||Oe["Yi Radicals"](i))))}function al(i){return!(Ua(i)||function(e){return!!(Oe["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||Oe["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||Oe["Letterlike Symbols"](e)||Oe["Number Forms"](e)||Oe["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||Oe["Control Pictures"](e)&&e!==9251||Oe["Optical Character Recognition"](e)||Oe["Enclosed Alphanumerics"](e)||Oe["Geometric Shapes"](e)||Oe["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Oe["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Oe["CJK Symbols and Punctuation"](e)||Oe.Katakana(e)||Oe["Private Use Area"](e)||Oe["CJK Compatibility Forms"](e)||Oe["Small Form Variants"](e)||Oe["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function Va(i){return i>=1424&&i<=2303||Oe["Arabic Presentation Forms-A"](i)||Oe["Arabic Presentation Forms-B"](i)}function hc(i,e){return!(!e&&Va(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Oe.Khmer(i))}function uc(i){for(const e of i)if(Va(e.charCodeAt(0)))return!0;return!1}const Na="deferred",$a="loading",Ga="loaded";let ja=null,Li="unavailable",lr=null;const ol=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(Li="error"),ja&&ja(i)};function us(){qa.fire(new R("pluginStateChange",{pluginStatus:Li,pluginURL:lr}))}const qa=new Q,Za=function(){return Li},ll=function(){if(Li!==Na||!lr)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Li=$a,us(),lr&&Xr({url:lr},i=>{i?ol(i):(Li=Ga,us())})},Gi={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Li===Ga||Gi.applyArabicShaping!=null,isLoading:()=>Li===$a,setState(i){if(!Ji())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Li=i.pluginStatus,lr=i.pluginURL},isParsed(){if(!Ji())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return Gi.applyArabicShaping!=null&&Gi.processBidirectionalText!=null&&Gi.processStyledBidirectionalText!=null},getPluginURL(){if(!Ji())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return lr}};class Nt{constructor(e,r){this.zoom=e,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Oa,this.transition={})}isSupportedScript(e){return function(r,s){for(const l of r)if(!hc(l.charCodeAt(0),s))return!1;return!0}(e,Gi.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,r=e-Math.floor(e),s=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*s}:{fromScale:.5,toScale:1,t:1-(1-s)*r}}}class Xs{constructor(e,r){this.property=e,this.value=r,this.expression=function(s,l){if(zt(s))return new Vs(s,l);if(es(s)){const u=qo(s,l);if(u.result==="error")throw new Error(u.value.map(p=>`${p.key}: ${p.message}`).join(", "));return u.value}{let u=s;return l.type==="color"&&typeof s=="string"?u=le.parse(s):l.type!=="padding"||typeof s!="number"&&!Array.isArray(s)||(u=ot.parse(s)),{kind:"constant",evaluate:()=>u}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,s){return this.property.possiblyEvaluate(this,e,r,s)}}class Xa{constructor(e){this.property=e,this.value=new Xs(e,void 0)}transitioned(e,r){return new hl(this.property,this.value,r,Ye({},e.transition,this.transition),e.now)}untransitioned(){return new hl(this.property,this.value,null,{},0)}}class cl{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return Ki(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Xa(this._values[e].property)),this._values[e].value=new Xs(this._values[e].property,r===null?void 0:Ki(r))}getTransition(e){return Ki(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Xa(this._values[e].property)),this._values[e].transition=Ki(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(e[r]=s);const l=this.getTransition(r);l!==void 0&&(e[`${r}-transition`]=l)}return e}transitioned(e,r){const s=new ul(this._properties);for(const l of Object.keys(this._values))s._values[l]=this._values[l].transitioned(e,r._values[l]);return s}untransitioned(){const e=new ul(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class hl{constructor(e,r,s,l,u){this.property=e,this.value=r,this.begin=u+l.delay||0,this.end=this.begin+l.duration||0,e.specification.transition&&(l.delay||l.duration)&&(this.prior=s)}possiblyEvaluate(e,r,s){const l=e.now||0,u=this.value.possiblyEvaluate(e,r,s),p=this.prior;if(p){if(l>this.end)return this.prior=null,u;if(this.value.isDataDriven())return this.prior=null,u;if(l<this.begin)return p.possiblyEvaluate(e,r,s);{const f=(l-this.begin)/(this.end-this.begin);return this.property.interpolate(p.possiblyEvaluate(e,r,s),u,function(g){if(g<=0)return 0;if(g>=1)return 1;const x=g*g,w=x*g;return 4*(g<.5?w:3*(g-x)+w-.75)}(f))}}return u}}class ul{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,s){const l=new Ws(this._properties);for(const u of Object.keys(this._values))l._values[u]=this._values[u].possiblyEvaluate(e,r,s);return l}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class dc{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return Ki(this._values[e].value)}setValue(e,r){this._values[e]=new Xs(this._values[e].property,r===null?void 0:Ki(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(e[r]=s)}return e}possiblyEvaluate(e,r,s){const l=new Ws(this._properties);for(const u of Object.keys(this._values))l._values[u]=this._values[u].possiblyEvaluate(e,r,s);return l}}class Si{constructor(e,r,s){this.property=e,this.value=r,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,s,l){return this.property.evaluate(this.value,this.parameters,e,r,s,l)}}class Ws{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class We{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,s){const l=zs[this.specification.type];return l?l(e,r,s):e}}class Qe{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,s,l){return new Si(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},s,l)}:e.expression,r)}interpolate(e,r,s){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new Si(this,{kind:"constant",value:void 0},e.parameters);const l=zs[this.specification.type];return l?new Si(this,{kind:"constant",value:l(e.value.value,r.value.value,s)},e.parameters):e}evaluate(e,r,s,l,u,p){return e.kind==="constant"?e.value:e.evaluate(r,s,l,u,p)}}class ds extends Qe{possiblyEvaluate(e,r,s,l){if(e.value===void 0)return new Si(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const u=e.expression.evaluate(r,null,{},s,l),p=e.property.specification.type==="resolvedImage"&&typeof u!="string"?u.name:u,f=this._calculate(p,p,p,r);return new Si(this,{kind:"constant",value:f},r)}if(e.expression.kind==="camera"){const u=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new Si(this,{kind:"constant",value:u},r)}return new Si(this,e.expression,r)}evaluate(e,r,s,l,u,p){if(e.kind==="source"){const f=e.evaluate(r,s,l,u,p);return this._calculate(f,f,f,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},s,l),e.evaluate({zoom:Math.floor(r.zoom)},s,l),e.evaluate({zoom:Math.floor(r.zoom)+1},s,l),r):e.value}_calculate(e,r,s,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:s,to:r}}interpolate(e){return e}}class Wa{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,l){if(e.value!==void 0){if(e.expression.kind==="constant"){const u=e.expression.evaluate(r,null,{},s,l);return this._calculate(u,u,u,r)}return this._calculate(e.expression.evaluate(new Nt(Math.floor(r.zoom-1),r)),e.expression.evaluate(new Nt(Math.floor(r.zoom),r)),e.expression.evaluate(new Nt(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,s,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:s,to:r}}interpolate(e){return e}}class Ha{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,l){return!!e.expression.evaluate(r,null,{},s,l)}interpolate(){return!1}}class Ei{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in e){const s=e[r];s.specification.overridable&&this.overridableProperties.push(r);const l=this.defaultPropertyValues[r]=new Xs(s,void 0),u=this.defaultTransitionablePropertyValues[r]=new Xa(s);this.defaultTransitioningPropertyValues[r]=u.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=l.possiblyEvaluate({})}}}$e("DataDrivenProperty",Qe),$e("DataConstantProperty",We),$e("CrossFadedDataDrivenProperty",ds),$e("CrossFadedProperty",Wa),$e("ColorRampProperty",Ha);const Mn="-transition";class cr extends Q{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new dc(r.layout)),r.paint)){this._transitionablePaint=new cl(r.paint);for(const s in e.paint)this.setPaintProperty(s,e.paint[s],{validate:!1});for(const s in e.layout)this.setLayoutProperty(s,e.layout[s],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ws(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,s={}){r!=null&&this._validate(Ba,`layers.${this.id}.layout.${e}`,e,r,s)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(Mn)?this._transitionablePaint.getTransition(e.slice(0,-Mn.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,s={}){if(r!=null&&this._validate(sl,`layers.${this.id}.paint.${e}`,e,r,s))return!1;if(e.endsWith(Mn))return this._transitionablePaint.setTransition(e.slice(0,-Mn.length),r||void 0),!1;{const l=this._transitionablePaint._values[e],u=l.property.specification["property-type"]==="cross-faded-data-driven",p=l.value.isDataDriven(),f=l.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const g=this._transitionablePaint._values[e].value;return g.isDataDriven()||p||u||this._handleOverridablePaintPropertyUpdate(e,f,g)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,s){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){const e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),Nn(e,(r,s)=>!(r===void 0||s==="layout"&&!Object.keys(r).length||s==="paint"&&!Object.keys(r).length))}_validate(e,r,s,l,u={}){return(!u||u.validate!==!1)&&Fa(this,e.call(os,{key:r,layerType:this.type,objectKey:s,value:l,styleSpec:V,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const r=this.paint.get(e);if(r instanceof Si&&wn(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const Ka={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Hs{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Lt{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Ht(i,e=1){let r=0,s=0;return{members:i.map(l=>{const u=Ka[l.type].BYTES_PER_ELEMENT,p=r=Pn(r,Math.max(e,u)),f=l.components||1;return s=Math.max(s,u),r+=u*f,{name:l.name,type:l.type,components:f,offset:p}}),size:Pn(r,Math.max(s,e)),alignment:e}}function Pn(i,e){return Math.ceil(i/e)*e}class ps extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.int16[l+0]=r,this.int16[l+1]=s,e}}ps.prototype.bytesPerElement=4,$e("StructArrayLayout2i4",ps);class ms extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const u=3*e;return this.int16[u+0]=r,this.int16[u+1]=s,this.int16[u+2]=l,e}}ms.prototype.bytesPerElement=6,$e("StructArrayLayout3i6",ms);class Yr extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s,l)}emplace(e,r,s,l,u){const p=4*e;return this.int16[p+0]=r,this.int16[p+1]=s,this.int16[p+2]=l,this.int16[p+3]=u,e}}Yr.prototype.bytesPerElement=8,$e("StructArrayLayout4i8",Yr);class Ja extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,p){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,u,p)}emplace(e,r,s,l,u,p,f){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=s,this.int16[g+2]=l,this.int16[g+3]=u,this.int16[g+4]=p,this.int16[g+5]=f,e}}Ja.prototype.bytesPerElement=12,$e("StructArrayLayout2i4i12",Ja);class Ya extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,p){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,u,p)}emplace(e,r,s,l,u,p,f){const g=4*e,x=8*e;return this.int16[g+0]=r,this.int16[g+1]=s,this.uint8[x+4]=l,this.uint8[x+5]=u,this.uint8[x+6]=p,this.uint8[x+7]=f,e}}Ya.prototype.bytesPerElement=8,$e("StructArrayLayout2i4ub8",Ya);class kn extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.float32[l+0]=r,this.float32[l+1]=s,e}}kn.prototype.bytesPerElement=8,$e("StructArrayLayout2f8",kn);class Qa extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,p,f,g,x,w){const T=this.length;return this.resize(T+1),this.emplace(T,e,r,s,l,u,p,f,g,x,w)}emplace(e,r,s,l,u,p,f,g,x,w,T){const C=10*e;return this.uint16[C+0]=r,this.uint16[C+1]=s,this.uint16[C+2]=l,this.uint16[C+3]=u,this.uint16[C+4]=p,this.uint16[C+5]=f,this.uint16[C+6]=g,this.uint16[C+7]=x,this.uint16[C+8]=w,this.uint16[C+9]=T,e}}Qa.prototype.bytesPerElement=20,$e("StructArrayLayout10ui20",Qa);class fs extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,p,f,g,x,w,T,C){const A=this.length;return this.resize(A+1),this.emplace(A,e,r,s,l,u,p,f,g,x,w,T,C)}emplace(e,r,s,l,u,p,f,g,x,w,T,C,A){const P=12*e;return this.int16[P+0]=r,this.int16[P+1]=s,this.int16[P+2]=l,this.int16[P+3]=u,this.uint16[P+4]=p,this.uint16[P+5]=f,this.uint16[P+6]=g,this.uint16[P+7]=x,this.int16[P+8]=w,this.int16[P+9]=T,this.int16[P+10]=C,this.int16[P+11]=A,e}}fs.prototype.bytesPerElement=24,$e("StructArrayLayout4i4ui4i24",fs);class o extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const u=3*e;return this.float32[u+0]=r,this.float32[u+1]=s,this.float32[u+2]=l,e}}o.prototype.bytesPerElement=12,$e("StructArrayLayout3f12",o);class t extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint32[1*e+0]=r,e}}t.prototype.bytesPerElement=4,$e("StructArrayLayout1ul4",t);class n extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,p,f,g,x){const w=this.length;return this.resize(w+1),this.emplace(w,e,r,s,l,u,p,f,g,x)}emplace(e,r,s,l,u,p,f,g,x,w){const T=10*e,C=5*e;return this.int16[T+0]=r,this.int16[T+1]=s,this.int16[T+2]=l,this.int16[T+3]=u,this.int16[T+4]=p,this.int16[T+5]=f,this.uint32[C+3]=g,this.uint16[T+8]=x,this.uint16[T+9]=w,e}}n.prototype.bytesPerElement=20,$e("StructArrayLayout6i1ul2ui20",n);class a extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,p){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,u,p)}emplace(e,r,s,l,u,p,f){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=s,this.int16[g+2]=l,this.int16[g+3]=u,this.int16[g+4]=p,this.int16[g+5]=f,e}}a.prototype.bytesPerElement=12,$e("StructArrayLayout2i2i2i12",a);class h extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u){const p=this.length;return this.resize(p+1),this.emplace(p,e,r,s,l,u)}emplace(e,r,s,l,u,p){const f=4*e,g=8*e;return this.float32[f+0]=r,this.float32[f+1]=s,this.float32[f+2]=l,this.int16[g+6]=u,this.int16[g+7]=p,e}}h.prototype.bytesPerElement=16,$e("StructArrayLayout2f1f2i16",h);class d extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s,l)}emplace(e,r,s,l,u){const p=12*e,f=3*e;return this.uint8[p+0]=r,this.uint8[p+1]=s,this.float32[f+1]=l,this.float32[f+2]=u,e}}d.prototype.bytesPerElement=12,$e("StructArrayLayout2ub2f12",d);class m extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const u=3*e;return this.uint16[u+0]=r,this.uint16[u+1]=s,this.uint16[u+2]=l,e}}m.prototype.bytesPerElement=6,$e("StructArrayLayout3ui6",m);class _ extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,p,f,g,x,w,T,C,A,P,F,O,q){const Y=this.length;return this.resize(Y+1),this.emplace(Y,e,r,s,l,u,p,f,g,x,w,T,C,A,P,F,O,q)}emplace(e,r,s,l,u,p,f,g,x,w,T,C,A,P,F,O,q,Y){const $=24*e,J=12*e,de=48*e;return this.int16[$+0]=r,this.int16[$+1]=s,this.uint16[$+2]=l,this.uint16[$+3]=u,this.uint32[J+2]=p,this.uint32[J+3]=f,this.uint32[J+4]=g,this.uint16[$+10]=x,this.uint16[$+11]=w,this.uint16[$+12]=T,this.float32[J+7]=C,this.float32[J+8]=A,this.uint8[de+36]=P,this.uint8[de+37]=F,this.uint8[de+38]=O,this.uint32[J+10]=q,this.int16[$+22]=Y,e}}_.prototype.bytesPerElement=48,$e("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",_);class y extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,p,f,g,x,w,T,C,A,P,F,O,q,Y,$,J,de,ue,Ne,qe,Ue,Re,ze,Ve){const Be=this.length;return this.resize(Be+1),this.emplace(Be,e,r,s,l,u,p,f,g,x,w,T,C,A,P,F,O,q,Y,$,J,de,ue,Ne,qe,Ue,Re,ze,Ve)}emplace(e,r,s,l,u,p,f,g,x,w,T,C,A,P,F,O,q,Y,$,J,de,ue,Ne,qe,Ue,Re,ze,Ve,Be){const Ee=34*e,Ke=17*e;return this.int16[Ee+0]=r,this.int16[Ee+1]=s,this.int16[Ee+2]=l,this.int16[Ee+3]=u,this.int16[Ee+4]=p,this.int16[Ee+5]=f,this.int16[Ee+6]=g,this.int16[Ee+7]=x,this.uint16[Ee+8]=w,this.uint16[Ee+9]=T,this.uint16[Ee+10]=C,this.uint16[Ee+11]=A,this.uint16[Ee+12]=P,this.uint16[Ee+13]=F,this.uint16[Ee+14]=O,this.uint16[Ee+15]=q,this.uint16[Ee+16]=Y,this.uint16[Ee+17]=$,this.uint16[Ee+18]=J,this.uint16[Ee+19]=de,this.uint16[Ee+20]=ue,this.uint16[Ee+21]=Ne,this.uint16[Ee+22]=qe,this.uint32[Ke+12]=Ue,this.float32[Ke+13]=Re,this.float32[Ke+14]=ze,this.float32[Ke+15]=Ve,this.float32[Ke+16]=Be,e}}y.prototype.bytesPerElement=68,$e("StructArrayLayout8i15ui1ul4f68",y);class b extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.float32[1*e+0]=r,e}}b.prototype.bytesPerElement=4,$e("StructArrayLayout1f4",b);class S extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const u=4*e;return this.uint32[2*e+0]=r,this.uint16[u+2]=s,this.uint16[u+3]=l,e}}S.prototype.bytesPerElement=8,$e("StructArrayLayout1ul2ui8",S);class E extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.uint16[l+0]=r,this.uint16[l+1]=s,e}}E.prototype.bytesPerElement=4,$e("StructArrayLayout2ui4",E);class M extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint16[1*e+0]=r,e}}M.prototype.bytesPerElement=2,$e("StructArrayLayout1ui2",M);class D extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s,l)}emplace(e,r,s,l,u){const p=4*e;return this.float32[p+0]=r,this.float32[p+1]=s,this.float32[p+2]=l,this.float32[p+3]=u,e}}D.prototype.bytesPerElement=16,$e("StructArrayLayout4f16",D);class B extends Hs{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 it(this.anchorPointX,this.anchorPointY)}}B.prototype.size=20;class L extends n{get(e){return new B(this,e)}}$e("CollisionBoxArray",L);class N extends Hs{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}N.prototype.size=48;class X extends _{get(e){return new N(this,e)}}$e("PlacedSymbolArray",X);class Z extends Hs{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}Z.prototype.size=68;class U extends y{get(e){return new Z(this,e)}}$e("SymbolInstanceArray",U);class W extends b{getoffsetX(e){return this.float32[1*e+0]}}$e("GlyphOffsetArray",W);class te extends ms{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}$e("SymbolLineVertexArray",te);class se extends Hs{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]}}se.prototype.size=8;class he extends S{get(e){return new se(this,e)}}$e("FeatureIndexArray",he);class pe extends ps{}class Te extends ps{}class ye extends ps{}class Ae extends Ja{}class je extends Ya{}class rt extends kn{}class nt extends Qa{}class He extends fs{}class Pt extends o{}class St extends t{}class ft extends a{}class xt extends d{}class wt extends m{}class Ii extends E{}const yr=Ht([{name:"a_pos",components:2,type:"Int16"}],4),{members:hr}=yr;class $t{constructor(e=[]){this.segments=e}prepareSegment(e,r,s,l){let u=this.segments[this.segments.length-1];return e>$t.MAX_VERTEX_ARRAY_LENGTH&&Qt(`Max vertices per segment is ${$t.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!u||u.vertexLength+e>$t.MAX_VERTEX_ARRAY_LENGTH||u.sortKey!==l)&&(u={vertexOffset:r.length,primitiveOffset:s.length,vertexLength:0,primitiveLength:0},l!==void 0&&(u.sortKey=l),this.segments.push(u)),u}get(){return this.segments}destroy(){for(const e of this.segments)for(const r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,s,l){return new $t([{vertexOffset:e,primitiveOffset:r,vertexLength:s,primitiveLength:l,vaos:{},sortKey:0}])}}function Gr(i,e){return 256*(i=Me(Math.floor(i),0,255))+Me(Math.floor(e),0,255)}$t.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,$e("SegmentVector",$t);const Ai=Ht([{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 Ci={},Qr={get exports(){return Ci},set exports(i){Ci=i}},zn={};({get exports(){return zn},set exports(i){zn=i}}).exports=function(i,e){var r,s,l,u,p,f,g,x;for(s=i.length-(r=3&i.length),l=e,p=3432918353,f=461845907,x=0;x<s;)g=255&i.charCodeAt(x)|(255&i.charCodeAt(++x))<<8|(255&i.charCodeAt(++x))<<16|(255&i.charCodeAt(++x))<<24,++x,l=27492+(65535&(u=5*(65535&(l=(l^=g=(65535&(g=(g=(65535&g)*p+(((g>>>16)*p&65535)<<16)&4294967295)<<15|g>>>17))*f+(((g>>>16)*f&65535)<<16)&4294967295)<<13|l>>>19))+((5*(l>>>16)&65535)<<16)&4294967295))+((58964+(u>>>16)&65535)<<16);switch(g=0,r){case 3:g^=(255&i.charCodeAt(x+2))<<16;case 2:g^=(255&i.charCodeAt(x+1))<<8;case 1:l^=g=(65535&(g=(g=(65535&(g^=255&i.charCodeAt(x)))*p+(((g>>>16)*p&65535)<<16)&4294967295)<<15|g>>>17))*f+(((g>>>16)*f&65535)<<16)&4294967295}return l^=i.length,l=2246822507*(65535&(l^=l>>>16))+((2246822507*(l>>>16)&65535)<<16)&4294967295,l=3266489909*(65535&(l^=l>>>13))+((3266489909*(l>>>16)&65535)<<16)&4294967295,(l^=l>>>16)>>>0};var ei={};({get exports(){return ei},set exports(i){ei=i}}).exports=function(i,e){for(var r,s=i.length,l=e^s,u=0;s>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(u)|(255&i.charCodeAt(++u))<<8|(255&i.charCodeAt(++u))<<16|(255&i.charCodeAt(++u))<<24))+((1540483477*(r>>>16)&65535)<<16),l=1540483477*(65535&l)+((1540483477*(l>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),s-=4,++u;switch(s){case 3:l^=(255&i.charCodeAt(u+2))<<16;case 2:l^=(255&i.charCodeAt(u+1))<<8;case 1:l=1540483477*(65535&(l^=255&i.charCodeAt(u)))+((1540483477*(l>>>16)&65535)<<16)}return l=1540483477*(65535&(l^=l>>>13))+((1540483477*(l>>>16)&65535)<<16),(l^=l>>>15)>>>0};var Gt=zn,It=ei;Qr.exports=Gt,Ci.murmur3=Gt,Ci.murmur2=It;class hi{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,s,l){this.ids.push(Di(e)),this.positions.push(r,s,l)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=Di(e);let s=0,l=this.ids.length-1;for(;s<l;){const p=s+l>>1;this.ids[p]>=r?l=p:s=p+1}const u=[];for(;this.ids[s]===r;)u.push({index:this.positions[3*s],start:this.positions[3*s+1],end:this.positions[3*s+2]}),s++;return u}static serialize(e,r){const s=new Float64Array(e.ids),l=new Uint32Array(e.positions);return jt(s,l,0,s.length-1),r&&r.push(s.buffer,l.buffer),{ids:s,positions:l}}static deserialize(e){const r=new hi;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function Di(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Ci(String(i))}function jt(i,e,r,s){for(;r<s;){const l=i[r+s>>1];let u=r-1,p=s+1;for(;;){do u++;while(i[u]<l);do p--;while(i[p]>l);if(u>=p)break;er(i,u,p),er(e,3*u,3*p),er(e,3*u+1,3*p+1),er(e,3*u+2,3*p+2)}p-r<s-p?(jt(i,e,r,p),r=p+1):(jt(i,e,p+1,s),s=p)}}function er(i,e,r){const s=i[e];i[e]=i[r],i[r]=s}$e("FeaturePositionMap",hi);class tr{constructor(e,r){this.gl=e.gl,this.location=r}}class Ln extends tr{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Ks extends tr{constructor(e,r){super(e,r),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class dl extends tr{constructor(e,r){super(e,r),this.current=le.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}const pc=new Float32Array(16);function en(i){return[Gr(255*i.r,255*i.g),Gr(255*i.b,255*i.a)]}class gs{constructor(e,r,s){this.value=e,this.uniformNames=r.map(l=>`u_${l}`),this.type=s}setUniform(e,r,s){e.set(s.constantOr(this.value))}getBinding(e,r,s){return this.type==="color"?new dl(e,r):new Ln(e,r)}}class Cr{constructor(e,r){this.uniformNames=r.map(s=>`u_${s}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,s,l){const u=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;u&&e.set(u)}getBinding(e,r,s){return s.substr(0,9)==="u_pattern"?new Ks(e,r):new Ln(e,r)}}class ur{constructor(e,r,s,l){this.expression=e,this.type=s,this.maxValue=0,this.paintVertexAttributes=r.map(u=>({name:`a_${u}`,type:"Float32",components:s==="color"?2:1,offset:0})),this.paintVertexArray=new l}populatePaintArray(e,r,s,l,u){const p=this.paintVertexArray.length,f=this.expression.evaluate(new Nt(0),r,{},l,[],u);this.paintVertexArray.resize(e),this._setPaintValue(p,e,f)}updatePaintArray(e,r,s,l){const u=this.expression.evaluate({zoom:0},s,l);this._setPaintValue(e,r,u)}_setPaintValue(e,r,s){if(this.type==="color"){const l=en(s);for(let u=e;u<r;u++)this.paintVertexArray.emplace(u,l[0],l[1])}else{for(let l=e;l<r;l++)this.paintVertexArray.emplace(l,s);this.maxValue=Math.max(this.maxValue,Math.abs(s))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Mr{constructor(e,r,s,l,u,p){this.expression=e,this.uniformNames=r.map(f=>`u_${f}_t`),this.type=s,this.useIntegerZoom=l,this.zoom=u,this.maxValue=0,this.paintVertexAttributes=r.map(f=>({name:`a_${f}`,type:"Float32",components:s==="color"?4:2,offset:0})),this.paintVertexArray=new p}populatePaintArray(e,r,s,l,u){const p=this.expression.evaluate(new Nt(this.zoom),r,{},l,[],u),f=this.expression.evaluate(new Nt(this.zoom+1),r,{},l,[],u),g=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(g,e,p,f)}updatePaintArray(e,r,s,l){const u=this.expression.evaluate({zoom:this.zoom},s,l),p=this.expression.evaluate({zoom:this.zoom+1},s,l);this._setPaintValue(e,r,u,p)}_setPaintValue(e,r,s,l){if(this.type==="color"){const u=en(s),p=en(l);for(let f=e;f<r;f++)this.paintVertexArray.emplace(f,u[0],u[1],p[0],p[1])}else{for(let u=e;u<r;u++)this.paintVertexArray.emplace(u,s,l);this.maxValue=Math.max(this.maxValue,Math.abs(s),Math.abs(l))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,r){const s=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,l=Me(this.expression.interpolationFactor(s,this.zoom,this.zoom+1),0,1);e.set(l)}getBinding(e,r,s){return new Ln(e,r)}}class Dn{constructor(e,r,s,l,u,p){this.expression=e,this.type=r,this.useIntegerZoom=s,this.zoom=l,this.layerId=p,this.zoomInPaintVertexArray=new u,this.zoomOutPaintVertexArray=new u}populatePaintArray(e,r,s){const l=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(l,e,r.patterns&&r.patterns[this.layerId],s)}updatePaintArray(e,r,s,l,u){this._setPaintValues(e,r,s.patterns&&s.patterns[this.layerId],u)}_setPaintValues(e,r,s,l){if(!l||!s)return;const{min:u,mid:p,max:f}=s,g=l[u],x=l[p],w=l[f];if(g&&x&&w)for(let T=e;T<r;T++)this.zoomInPaintVertexArray.emplace(T,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(T,x.tl[0],x.tl[1],x.br[0],x.br[1],w.tl[0],w.tl[1],w.br[0],w.br[1],x.pixelRatio,w.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,Ai.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,Ai.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class nu{constructor(e,r,s){this.binders={},this._buffers=[];const l=[];for(const u in e.paint._values){if(!s(u))continue;const p=e.paint.get(u);if(!(p instanceof Si&&wn(p.property.specification)))continue;const f=Im(u,e.type),g=p.value,x=p.property.specification.type,w=p.property.useIntegerZoom,T=p.property.specification["property-type"],C=T==="cross-faded"||T==="cross-faded-data-driven";if(g.kind==="constant")this.binders[u]=C?new Cr(g.value,f):new gs(g.value,f,x),l.push(`/u_${u}`);else if(g.kind==="source"||C){const A=su(u,x,"source");this.binders[u]=C?new Dn(g,x,w,r,A,e.id):new ur(g,f,x,A),l.push(`/a_${u}`)}else{const A=su(u,x,"composite");this.binders[u]=new Mr(g,f,x,w,r,A),l.push(`/z_${u}`)}}this.cacheKey=l.sort().join("")}getMaxValue(e){const r=this.binders[e];return r instanceof ur||r instanceof Mr?r.maxValue:0}populatePaintArrays(e,r,s,l,u){for(const p in this.binders){const f=this.binders[p];(f instanceof ur||f instanceof Mr||f instanceof Dn)&&f.populatePaintArray(e,r,s,l,u)}}setConstantPatternPositions(e,r){for(const s in this.binders){const l=this.binders[s];l instanceof Cr&&l.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,s,l,u){let p=!1;for(const f in e){const g=r.getPositions(f);for(const x of g){const w=s.feature(x.index);for(const T in this.binders){const C=this.binders[T];if((C instanceof ur||C instanceof Mr||C instanceof Dn)&&C.expression.isStateDependent===!0){const A=l.paint.get(T);C.expression=A.value,C.updatePaintArray(x.start,x.end,w,e[f],u),p=!0}}}}return p}defines(){const e=[];for(const r in this.binders){const s=this.binders[r];(s instanceof gs||s instanceof Cr)&&e.push(...s.uniformNames.map(l=>`#define HAS_UNIFORM_${l}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof ur||s instanceof Mr)for(let l=0;l<s.paintVertexAttributes.length;l++)e.push(s.paintVertexAttributes[l].name);else if(s instanceof Dn)for(let l=0;l<Ai.members.length;l++)e.push(Ai.members[l].name)}return e}getBinderUniforms(){const e=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof gs||s instanceof Cr||s instanceof Mr)for(const l of s.uniformNames)e.push(l)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,r){const s=[];for(const l in this.binders){const u=this.binders[l];if(u instanceof gs||u instanceof Cr||u instanceof Mr){for(const p of u.uniformNames)if(r[p]){const f=u.getBinding(e,r[p],p);s.push({name:p,property:l,binding:f})}}}return s}setUniforms(e,r,s,l){for(const{name:u,property:p,binding:f}of r)this.binders[p].setUniform(f,l,s.get(p),u)}updatePaintBuffers(e){this._buffers=[];for(const r in this.binders){const s=this.binders[r];if(e&&s instanceof Dn){const l=e.fromScale===2?s.zoomInPaintVertexBuffer:s.zoomOutPaintVertexBuffer;l&&this._buffers.push(l)}else(s instanceof ur||s instanceof Mr)&&s.paintVertexBuffer&&this._buffers.push(s.paintVertexBuffer)}}upload(e){for(const r in this.binders){const s=this.binders[r];(s instanceof ur||s instanceof Mr||s instanceof Dn)&&s.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const r=this.binders[e];(r instanceof ur||r instanceof Mr||r instanceof Dn)&&r.destroy()}}}class _s{constructor(e,r,s=()=>!0){this.programConfigurations={};for(const l of e)this.programConfigurations[l.id]=new nu(l,r,s);this.needsUpload=!1,this._featureMap=new hi,this._bufferOffset=0}populatePaintArrays(e,r,s,l,u,p){for(const f in this.programConfigurations)this.programConfigurations[f].populatePaintArrays(e,r,l,u,p);r.id!==void 0&&this._featureMap.add(r.id,s,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,s,l){for(const u of s)this.needsUpload=this.programConfigurations[u.id].updatePaintArrays(e,this._featureMap,r,u,l)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Im(i,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}function su(i,e,r){const s={color:{source:kn,composite:D},number:{source:b,composite:kn}},l=function(u){return{"line-pattern":{source:nt,composite:nt},"fill-pattern":{source:nt,composite:nt},"fill-extrusion-pattern":{source:nt,composite:nt}}[u]}(i);return l&&l[r]||s[e][r]}$e("ConstantBinder",gs),$e("CrossFadedConstantBinder",Cr),$e("SourceExpressionBinder",ur),$e("CrossFadedCompositeBinder",Dn),$e("CompositeExpressionBinder",Mr),$e("ProgramConfiguration",nu,{omit:["_buffers"]}),$e("ProgramConfigurationSet",_s);var oi=8192;const mc=Math.pow(2,14)-1,au=-mc-1;function ys(i){const e=oi/i.extent,r=i.loadGeometry();for(let s=0;s<r.length;s++){const l=r[s];for(let u=0;u<l.length;u++){const p=l[u],f=Math.round(p.x*e),g=Math.round(p.y*e);p.x=Me(f,au,mc),p.y=Me(g,au,mc),(f<p.x||f>p.x+1||g<p.y||g>p.y+1)&&Qt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function xs(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?ys(i):[]}}function pl(i,e,r,s,l){i.emplaceBack(2*e+(s+1)/2,2*r+(l+1)/2)}class fc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Te,this.indexArray=new wt,this.segments=new $t,this.programConfigurations=new _s(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){const l=this.layers[0],u=[];let p=null,f=!1;l.type==="circle"&&(p=l.layout.get("circle-sort-key"),f=!p.isConstant());for(const{feature:g,id:x,index:w,sourceLayerIndex:T}of e){const C=this.layers[0]._featureFilter.needGeometry,A=xs(g,C);if(!this.layers[0]._featureFilter.filter(new Nt(this.zoom),A,s))continue;const P=f?p.evaluate(A,{},s):void 0,F={id:x,properties:g.properties,type:g.type,sourceLayerIndex:T,index:w,geometry:C?A.geometry:ys(g),patterns:{},sortKey:P};u.push(F)}f&&u.sort((g,x)=>g.sortKey-x.sortKey);for(const g of u){const{geometry:x,index:w,sourceLayerIndex:T}=g,C=e[w].feature;this.addFeature(g,x,w,s),r.featureIndex.insert(C,x,w,T,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,hr),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,s,l){for(const u of r)for(const p of u){const f=p.x,g=p.y;if(f<0||f>=oi||g<0||g>=oi)continue;const x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),w=x.vertexLength;pl(this.layoutVertexArray,f,g,-1,-1),pl(this.layoutVertexArray,f,g,1,-1),pl(this.layoutVertexArray,f,g,1,1),pl(this.layoutVertexArray,f,g,-1,1),this.indexArray.emplaceBack(w,w+1,w+2),this.indexArray.emplaceBack(w,w+3,w+2),x.vertexLength+=4,x.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{},l)}}function ou(i,e){for(let r=0;r<i.length;r++)if(Js(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Js(i,e[r]))return!0;return!!gc(i,e)}function Am(i,e,r){return!!Js(i,e)||!!_c(e,i,r)}function lu(i,e){if(i.length===1)return hu(e,i[0]);for(let r=0;r<e.length;r++){const s=e[r];for(let l=0;l<s.length;l++)if(Js(i,s[l]))return!0}for(let r=0;r<i.length;r++)if(hu(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(gc(i,e[r]))return!0;return!1}function Cm(i,e,r){if(i.length>1){if(gc(i,e))return!0;for(let s=0;s<e.length;s++)if(_c(e[s],i,r))return!0}for(let s=0;s<i.length;s++)if(_c(i[s],e,r))return!0;return!1}function gc(i,e){if(i.length===0||e.length===0)return!1;for(let r=0;r<i.length-1;r++){const s=i[r],l=i[r+1];for(let u=0;u<e.length-1;u++)if(Mm(s,l,e[u],e[u+1]))return!0}return!1}function Mm(i,e,r,s){return nr(i,r,s)!==nr(e,r,s)&&nr(i,e,r)!==nr(i,e,s)}function _c(i,e,r){const s=r*r;if(e.length===1)return i.distSqr(e[0])<s;for(let l=1;l<e.length;l++)if(cu(i,e[l-1],e[l])<s)return!0;return!1}function cu(i,e,r){const s=e.distSqr(r);if(s===0)return i.distSqr(e);const l=((i.x-e.x)*(r.x-e.x)+(i.y-e.y)*(r.y-e.y))/s;return i.distSqr(l<0?e:l>1?r:r.sub(e)._mult(l)._add(e))}function hu(i,e){let r,s,l,u=!1;for(let p=0;p<i.length;p++){r=i[p];for(let f=0,g=r.length-1;f<r.length;g=f++)s=r[f],l=r[g],s.y>e.y!=l.y>e.y&&e.x<(l.x-s.x)*(e.y-s.y)/(l.y-s.y)+s.x&&(u=!u)}return u}function Js(i,e){let r=!1;for(let s=0,l=i.length-1;s<i.length;l=s++){const u=i[s],p=i[l];u.y>e.y!=p.y>e.y&&e.x<(p.x-u.x)*(e.y-u.y)/(p.y-u.y)+u.x&&(r=!r)}return r}function Pm(i,e,r){const s=r[0],l=r[2];if(i.x<s.x&&e.x<s.x||i.x>l.x&&e.x>l.x||i.y<s.y&&e.y<s.y||i.y>l.y&&e.y>l.y)return!1;const u=nr(i,e,r[0]);return u!==nr(i,e,r[1])||u!==nr(i,e,r[2])||u!==nr(i,e,r[3])}function eo(i,e,r){const s=e.paint.get(i).value;return s.kind==="constant"?s.value:r.programConfigurations.get(e.id).getMaxValue(i)}function ml(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function fl(i,e,r,s,l){if(!e[0]&&!e[1])return i;const u=it.convert(e)._mult(l);r==="viewport"&&u._rotate(-s);const p=[];for(let f=0;f<i.length;f++)p.push(i[f].sub(u));return p}$e("CircleBucket",fc,{omit:["layers"]});const km=new Ei({"circle-sort-key":new Qe(V.layout_circle["circle-sort-key"])});var zm={paint:new Ei({"circle-radius":new Qe(V.paint_circle["circle-radius"]),"circle-color":new Qe(V.paint_circle["circle-color"]),"circle-blur":new Qe(V.paint_circle["circle-blur"]),"circle-opacity":new Qe(V.paint_circle["circle-opacity"]),"circle-translate":new We(V.paint_circle["circle-translate"]),"circle-translate-anchor":new We(V.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new We(V.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new We(V.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Qe(V.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Qe(V.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Qe(V.paint_circle["circle-stroke-opacity"])}),layout:km},Ri=1e-6,Bi=typeof Float32Array<"u"?Float32Array:Array;function uu(){var i=new Bi(9);return Bi!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[5]=0,i[6]=0,i[7]=0),i[0]=1,i[4]=1,i[8]=1,i}function yc(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 du(i,e,r){var s=e[0],l=e[1],u=e[2],p=e[3],f=e[4],g=e[5],x=e[6],w=e[7],T=e[8],C=e[9],A=e[10],P=e[11],F=e[12],O=e[13],q=e[14],Y=e[15],$=r[0],J=r[1],de=r[2],ue=r[3];return i[0]=$*s+J*f+de*T+ue*F,i[1]=$*l+J*g+de*C+ue*O,i[2]=$*u+J*x+de*A+ue*q,i[3]=$*p+J*w+de*P+ue*Y,i[4]=($=r[4])*s+(J=r[5])*f+(de=r[6])*T+(ue=r[7])*F,i[5]=$*l+J*g+de*C+ue*O,i[6]=$*u+J*x+de*A+ue*q,i[7]=$*p+J*w+de*P+ue*Y,i[8]=($=r[8])*s+(J=r[9])*f+(de=r[10])*T+(ue=r[11])*F,i[9]=$*l+J*g+de*C+ue*O,i[10]=$*u+J*x+de*A+ue*q,i[11]=$*p+J*w+de*P+ue*Y,i[12]=($=r[12])*s+(J=r[13])*f+(de=r[14])*T+(ue=r[15])*F,i[13]=$*l+J*g+de*C+ue*O,i[14]=$*u+J*x+de*A+ue*q,i[15]=$*p+J*w+de*P+ue*Y,i}Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});var to,Lm=du;function pu(){var i=new Bi(3);return Bi!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i}function mu(i,e,r){var s=new Bi(3);return s[0]=i,s[1]=e,s[2]=r,s}function gl(i,e,r){var s=e[0],l=e[1],u=e[2],p=e[3];return i[0]=r[0]*s+r[4]*l+r[8]*u+r[12]*p,i[1]=r[1]*s+r[5]*l+r[9]*u+r[13]*p,i[2]=r[2]*s+r[6]*l+r[10]*u+r[14]*p,i[3]=r[3]*s+r[7]*l+r[11]*u+r[15]*p,i}function fu(){var i=new Bi(4);return Bi!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i[3]=1,i}function gu(i,e){const r=gl([],[i.x,i.y,0,1],e);return new it(r[0]/r[3],r[1]/r[3])}pu(),to=new Bi(4),Bi!=Float32Array&&(to[0]=0,to[1]=0,to[2]=0,to[3]=0),pu(),mu(1,0,0),mu(0,1,0),fu(),fu(),uu(),function(){var i;i=new Bi(2),Bi!=Float32Array&&(i[0]=0,i[1]=0)}();class _u extends fc{}$e("HeatmapBucket",_u,{omit:["layers"]});var Dm={paint:new Ei({"heatmap-radius":new Qe(V.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Qe(V.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new We(V.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Ha(V.paint_heatmap["heatmap-color"]),"heatmap-opacity":new We(V.paint_heatmap["heatmap-opacity"])})};function xc(i,{width:e,height:r},s,l){if(l){if(l instanceof Uint8ClampedArray)l=new Uint8Array(l.buffer);else if(l.length!==e*r*s)throw new RangeError(`mismatched image size. expected: ${l.length} but got: ${e*r*s}`)}else l=new Uint8Array(e*r*s);return i.width=e,i.height=r,i.data=l,i}function yu(i,{width:e,height:r},s){if(e===i.width&&r===i.height)return;const l=xc({},{width:e,height:r},s);vc(i,l,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,e),height:Math.min(i.height,r)},s),i.width=e,i.height=r,i.data=l.data}function vc(i,e,r,s,l,u){if(l.width===0||l.height===0)return e;if(l.width>i.width||l.height>i.height||r.x>i.width-l.width||r.y>i.height-l.height)throw new RangeError("out of range source coordinates for image copy");if(l.width>e.width||l.height>e.height||s.x>e.width-l.width||s.y>e.height-l.height)throw new RangeError("out of range destination coordinates for image copy");const p=i.data,f=e.data;if(p===f)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g<l.height;g++){const x=((r.y+g)*i.width+r.x)*u,w=((s.y+g)*e.width+s.x)*u;for(let T=0;T<l.width*u;T++)f[w+T]=p[x+T]}return e}class io{constructor(e,r){xc(this,e,1,r)}resize(e){yu(this,e,1)}clone(){return new io({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,s,l,u){vc(e,r,s,l,u,1)}}class dr{constructor(e,r){xc(this,e,4,r)}resize(e){yu(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new dr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,s,l,u){vc(e,r,s,l,u,4)}}function xu(i){const e={},r=i.resolution||256,s=i.clips?i.clips.length:1,l=i.image||new dr({width:r,height:s});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const u=(p,f,g)=>{e[i.evaluationKey]=g;const x=i.expression.evaluate(e);l.data[p+f+0]=Math.floor(255*x.r/x.a),l.data[p+f+1]=Math.floor(255*x.g/x.a),l.data[p+f+2]=Math.floor(255*x.b/x.a),l.data[p+f+3]=Math.floor(255*x.a)};if(i.clips)for(let p=0,f=0;p<s;++p,f+=4*r)for(let g=0,x=0;g<r;g++,x+=4){const w=g/(r-1),{start:T,end:C}=i.clips[p];u(f,x,T*(1-w)+C*w)}else for(let p=0,f=0;p<r;p++,f+=4)u(0,f,p/(r-1));return l}$e("AlphaImage",io),$e("RGBAImage",dr);var Rm={paint:new Ei({"hillshade-illumination-direction":new We(V.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new We(V.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new We(V.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new We(V.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new We(V.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new We(V.paint_hillshade["hillshade-accent-color"])})};const Bm=Ht([{name:"a_pos",components:2,type:"Int16"}],4),{members:Fm}=Bm;var ro={};function _l(i,e,r){r=r||2;var s,l,u,p,f,g,x,w=e&&e.length,T=w?e[0]*r:i.length,C=vu(i,0,T,r,!0),A=[];if(!C||C.next===C.prev)return A;if(w&&(C=function(F,O,q,Y){var $,J,de,ue=[];for($=0,J=O.length;$<J;$++)(de=vu(F,O[$]*Y,$<J-1?O[$+1]*Y:F.length,Y,!1))===de.next&&(de.steiner=!0),ue.push(qm(de));for(ue.sort($m),$=0;$<ue.length;$++)q=Gm(ue[$],q);return q}(i,e,C,r)),i.length>80*r){s=u=i[0],l=p=i[1];for(var P=r;P<T;P+=r)(f=i[P])<s&&(s=f),(g=i[P+1])<l&&(l=g),f>u&&(u=f),g>p&&(p=g);x=(x=Math.max(u-s,p-l))!==0?32767/x:0}return no(C,A,r,s,l,x,0),A}function vu(i,e,r,s,l){var u,p;if(l===Tc(i,e,r,s)>0)for(u=e;u<r;u+=s)p=Tu(u,i[u],i[u+1],p);else for(u=r-s;u>=e;u-=s)p=Tu(u,i[u],i[u+1],p);return p&&yl(p,p.next)&&(ao(p),p=p.next),p}function vs(i,e){if(!i)return i;e||(e=i);var r,s=i;do if(r=!1,s.steiner||!yl(s,s.next)&&ti(s.prev,s,s.next)!==0)s=s.next;else{if(ao(s),(s=e=s.prev)===s.next)break;r=!0}while(r||s!==e);return e}function no(i,e,r,s,l,u,p){if(i){!p&&u&&function(w,T,C,A){var P=w;do P.z===0&&(P.z=bc(P.x,P.y,T,C,A)),P.prevZ=P.prev,P.nextZ=P.next,P=P.next;while(P!==w);P.prevZ.nextZ=null,P.prevZ=null,function(F){var O,q,Y,$,J,de,ue,Ne,qe=1;do{for(q=F,F=null,J=null,de=0;q;){for(de++,Y=q,ue=0,O=0;O<qe&&(ue++,Y=Y.nextZ);O++);for(Ne=qe;ue>0||Ne>0&&Y;)ue!==0&&(Ne===0||!Y||q.z<=Y.z)?($=q,q=q.nextZ,ue--):($=Y,Y=Y.nextZ,Ne--),J?J.nextZ=$:F=$,$.prevZ=J,J=$;q=Y}J.nextZ=null,qe*=2}while(de>1)}(P)}(i,s,l,u);for(var f,g,x=i;i.prev!==i.next;)if(f=i.prev,g=i.next,u?Um(i,s,l,u):Om(i))e.push(f.i/r|0),e.push(i.i/r|0),e.push(g.i/r|0),ao(i),i=g.next,x=g.next;else if((i=g)===x){p?p===1?no(i=Vm(vs(i),e,r),e,r,s,l,u,2):p===2&&Nm(i,e,r,s,l,u):no(vs(i),e,r,s,l,u,1);break}}}function Om(i){var e=i.prev,r=i,s=i.next;if(ti(e,r,s)>=0)return!1;for(var l=e.x,u=r.x,p=s.x,f=e.y,g=r.y,x=s.y,w=l<u?l<p?l:p:u<p?u:p,T=f<g?f<x?f:x:g<x?g:x,C=l>u?l>p?l:p:u>p?u:p,A=f>g?f>x?f:x:g>x?g:x,P=s.next;P!==e;){if(P.x>=w&&P.x<=C&&P.y>=T&&P.y<=A&&Ys(l,f,u,g,p,x,P.x,P.y)&&ti(P.prev,P,P.next)>=0)return!1;P=P.next}return!0}function Um(i,e,r,s){var l=i.prev,u=i,p=i.next;if(ti(l,u,p)>=0)return!1;for(var f=l.x,g=u.x,x=p.x,w=l.y,T=u.y,C=p.y,A=f<g?f<x?f:x:g<x?g:x,P=w<T?w<C?w:C:T<C?T:C,F=f>g?f>x?f:x:g>x?g:x,O=w>T?w>C?w:C:T>C?T:C,q=bc(A,P,e,r,s),Y=bc(F,O,e,r,s),$=i.prevZ,J=i.nextZ;$&&$.z>=q&&J&&J.z<=Y;){if($.x>=A&&$.x<=F&&$.y>=P&&$.y<=O&&$!==l&&$!==p&&Ys(f,w,g,T,x,C,$.x,$.y)&&ti($.prev,$,$.next)>=0||($=$.prevZ,J.x>=A&&J.x<=F&&J.y>=P&&J.y<=O&&J!==l&&J!==p&&Ys(f,w,g,T,x,C,J.x,J.y)&&ti(J.prev,J,J.next)>=0))return!1;J=J.nextZ}for(;$&&$.z>=q;){if($.x>=A&&$.x<=F&&$.y>=P&&$.y<=O&&$!==l&&$!==p&&Ys(f,w,g,T,x,C,$.x,$.y)&&ti($.prev,$,$.next)>=0)return!1;$=$.prevZ}for(;J&&J.z<=Y;){if(J.x>=A&&J.x<=F&&J.y>=P&&J.y<=O&&J!==l&&J!==p&&Ys(f,w,g,T,x,C,J.x,J.y)&&ti(J.prev,J,J.next)>=0)return!1;J=J.nextZ}return!0}function Vm(i,e,r){var s=i;do{var l=s.prev,u=s.next.next;!yl(l,u)&&bu(l,s,s.next,u)&&so(l,u)&&so(u,l)&&(e.push(l.i/r|0),e.push(s.i/r|0),e.push(u.i/r|0),ao(s),ao(s.next),s=i=u),s=s.next}while(s!==i);return vs(s)}function Nm(i,e,r,s,l,u){var p=i;do{for(var f=p.next.next;f!==p.prev;){if(p.i!==f.i&&Zm(p,f)){var g=wu(p,f);return p=vs(p,p.next),g=vs(g,g.next),no(p,e,r,s,l,u,0),void no(g,e,r,s,l,u,0)}f=f.next}p=p.next}while(p!==i)}function $m(i,e){return i.x-e.x}function Gm(i,e){var r=function(l,u){var p,f=u,g=l.x,x=l.y,w=-1/0;do{if(x<=f.y&&x>=f.next.y&&f.next.y!==f.y){var T=f.x+(x-f.y)*(f.next.x-f.x)/(f.next.y-f.y);if(T<=g&&T>w&&(w=T,p=f.x<f.next.x?f:f.next,T===g))return p}f=f.next}while(f!==u);if(!p)return null;var C,A=p,P=p.x,F=p.y,O=1/0;f=p;do g>=f.x&&f.x>=P&&g!==f.x&&Ys(x<F?g:w,x,P,F,x<F?w:g,x,f.x,f.y)&&(C=Math.abs(x-f.y)/(g-f.x),so(f,l)&&(C<O||C===O&&(f.x>p.x||f.x===p.x&&jm(p,f)))&&(p=f,O=C)),f=f.next;while(f!==A);return p}(i,e);if(!r)return e;var s=wu(r,i);return vs(s,s.next),vs(r,r.next)}function jm(i,e){return ti(i.prev,i,e.prev)<0&&ti(e.next,i,i.next)<0}function bc(i,e,r,s,l){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*l|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*l|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function qm(i){var e=i,r=i;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==i);return r}function Ys(i,e,r,s,l,u,p,f){return(l-p)*(e-f)>=(i-p)*(u-f)&&(i-p)*(s-f)>=(r-p)*(e-f)&&(r-p)*(u-f)>=(l-p)*(s-f)}function Zm(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,s){var l=r;do{if(l.i!==r.i&&l.next.i!==r.i&&l.i!==s.i&&l.next.i!==s.i&&bu(l,l.next,r,s))return!0;l=l.next}while(l!==r);return!1}(i,e)&&(so(i,e)&&so(e,i)&&function(r,s){var l=r,u=!1,p=(r.x+s.x)/2,f=(r.y+s.y)/2;do l.y>f!=l.next.y>f&&l.next.y!==l.y&&p<(l.next.x-l.x)*(f-l.y)/(l.next.y-l.y)+l.x&&(u=!u),l=l.next;while(l!==r);return u}(i,e)&&(ti(i.prev,i,e.prev)||ti(i,e.prev,e))||yl(i,e)&&ti(i.prev,i,i.next)>0&&ti(e.prev,e,e.next)>0)}function ti(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function yl(i,e){return i.x===e.x&&i.y===e.y}function bu(i,e,r,s){var l=vl(ti(i,e,r)),u=vl(ti(i,e,s)),p=vl(ti(r,s,i)),f=vl(ti(r,s,e));return l!==u&&p!==f||!(l!==0||!xl(i,r,e))||!(u!==0||!xl(i,s,e))||!(p!==0||!xl(r,i,s))||!(f!==0||!xl(r,e,s))}function xl(i,e,r){return e.x<=Math.max(i.x,r.x)&&e.x>=Math.min(i.x,r.x)&&e.y<=Math.max(i.y,r.y)&&e.y>=Math.min(i.y,r.y)}function vl(i){return i>0?1:i<0?-1:0}function so(i,e){return ti(i.prev,i,i.next)<0?ti(i,e,i.next)>=0&&ti(i,i.prev,e)>=0:ti(i,e,i.prev)<0||ti(i,i.next,e)<0}function wu(i,e){var r=new wc(i.i,i.x,i.y),s=new wc(e.i,e.x,e.y),l=i.next,u=e.prev;return i.next=e,e.prev=i,r.next=l,l.prev=r,s.next=r,r.prev=s,u.next=s,s.prev=u,s}function Tu(i,e,r,s){var l=new wc(i,e,r);return s?(l.next=s.next,l.prev=s,s.next.prev=l,s.next=l):(l.prev=l,l.next=l),l}function ao(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 wc(i,e,r){this.i=i,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Tc(i,e,r,s){for(var l=0,u=e,p=r-s;u<r;u+=s)l+=(i[p]-i[u])*(i[u+1]+i[p+1]),p=u;return l}({get exports(){return ro},set exports(i){ro=i}}).exports=_l,ro.default=_l,_l.deviation=function(i,e,r,s){var l=e&&e.length,u=Math.abs(Tc(i,0,l?e[0]*r:i.length,r));if(l)for(var p=0,f=e.length;p<f;p++)u-=Math.abs(Tc(i,e[p]*r,p<f-1?e[p+1]*r:i.length,r));var g=0;for(p=0;p<s.length;p+=3){var x=s[p]*r,w=s[p+1]*r,T=s[p+2]*r;g+=Math.abs((i[x]-i[T])*(i[w+1]-i[x+1])-(i[x]-i[w])*(i[T+1]-i[x+1]))}return u===0&&g===0?0:Math.abs((g-u)/u)},_l.flatten=function(i){for(var e=i[0][0].length,r={vertices:[],holes:[],dimensions:e},s=0,l=0;l<i.length;l++){for(var u=0;u<i[l].length;u++)for(var p=0;p<e;p++)r.vertices.push(i[l][u][p]);l>0&&r.holes.push(s+=i[l-1].length)}return r};var Sc={};({get exports(){return Sc},set exports(i){Sc=i}}).exports=function(){function i(s,l,u,p,f){for(;p>u;){if(p-u>600){var g=p-u+1,x=l-u+1,w=Math.log(g),T=.5*Math.exp(2*w/3),C=.5*Math.sqrt(w*T*(g-T)/g)*(x-g/2<0?-1:1);i(s,l,Math.max(u,Math.floor(l-x*T/g+C)),Math.min(p,Math.floor(l+(g-x)*T/g+C)),f)}var A=s[l],P=u,F=p;for(e(s,u,l),f(s[p],A)>0&&e(s,u,p);P<F;){for(e(s,P,F),P++,F--;f(s[P],A)<0;)P++;for(;f(s[F],A)>0;)F--}f(s[u],A)===0?e(s,u,F):e(s,++F,p),F<=l&&(u=F+1),l<=F&&(p=F-1)}}function e(s,l,u){var p=s[l];s[l]=s[u],s[u]=p}function r(s,l){return s<l?-1:s>l?1:0}return function(s,l,u,p,f){i(s,l,u||0,p||s.length-1,f||r)}}();var Xm=Sc;function Ec(i,e){const r=i.length;if(r<=1)return[i];const s=[];let l,u;for(let p=0;p<r;p++){const f=Rr(i[p]);f!==0&&(i[p].area=Math.abs(f),u===void 0&&(u=f<0),u===f<0?(l&&s.push(l),l=[i[p]]):l.push(i[p]))}if(l&&s.push(l),e>1)for(let p=0;p<s.length;p++)s[p].length<=e||(Xm(s[p],e,1,s[p].length-1,Wm),s[p]=s[p].slice(0,e));return s}function Wm(i,e){return e.area-i.area}function Ic(i,e,r){const s=r.patternDependencies;let l=!1;for(const u of e){const p=u.paint.get(`${i}-pattern`);p.isConstant()||(l=!0);const f=p.constantOr(null);f&&(l=!0,s[f.to]=!0,s[f.from]=!0)}return l}function Ac(i,e,r,s,l){const u=l.patternDependencies;for(const p of e){const f=p.paint.get(`${i}-pattern`).value;if(f.kind!=="constant"){let g=f.evaluate({zoom:s-1},r,{},l.availableImages),x=f.evaluate({zoom:s},r,{},l.availableImages),w=f.evaluate({zoom:s+1},r,{},l.availableImages);g=g&&g.name?g.name:g,x=x&&x.name?x.name:x,w=w&&w.name?w.name:w,u[g]=!0,u[x]=!0,u[w]=!0,r.patterns[p.id]={min:g,mid:x,max:w}}}return r}class Cc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ye,this.indexArray=new wt,this.indexArray2=new Ii,this.programConfigurations=new _s(e.layers,e.zoom),this.segments=new $t,this.segments2=new $t,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=Ic("fill",this.layers,r);const l=this.layers[0].layout.get("fill-sort-key"),u=!l.isConstant(),p=[];for(const{feature:f,id:g,index:x,sourceLayerIndex:w}of e){const T=this.layers[0]._featureFilter.needGeometry,C=xs(f,T);if(!this.layers[0]._featureFilter.filter(new Nt(this.zoom),C,s))continue;const A=u?l.evaluate(C,{},s,r.availableImages):void 0,P={id:g,properties:f.properties,type:f.type,sourceLayerIndex:w,index:x,geometry:T?C.geometry:ys(f),patterns:{},sortKey:A};p.push(P)}u&&p.sort((f,g)=>f.sortKey-g.sortKey);for(const f of p){const{geometry:g,index:x,sourceLayerIndex:w}=f;if(this.hasPattern){const T=Ac("fill",this.layers,f,this.zoom,r);this.patternFeatures.push(T)}else this.addFeature(f,g,x,s,{});r.featureIndex.insert(e[x].feature,g,x,w,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}addFeatures(e,r,s){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Fm),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,r,s,l,u){for(const p of Ec(r,500)){let f=0;for(const A of p)f+=A.length;const g=this.segments.prepareSegment(f,this.layoutVertexArray,this.indexArray),x=g.vertexLength,w=[],T=[];for(const A of p){if(A.length===0)continue;A!==p[0]&&T.push(w.length/2);const P=this.segments2.prepareSegment(A.length,this.layoutVertexArray,this.indexArray2),F=P.vertexLength;this.layoutVertexArray.emplaceBack(A[0].x,A[0].y),this.indexArray2.emplaceBack(F+A.length-1,F),w.push(A[0].x),w.push(A[0].y);for(let O=1;O<A.length;O++)this.layoutVertexArray.emplaceBack(A[O].x,A[O].y),this.indexArray2.emplaceBack(F+O-1,F+O),w.push(A[O].x),w.push(A[O].y);P.vertexLength+=A.length,P.primitiveLength+=A.length}const C=ro(w,T);for(let A=0;A<C.length;A+=3)this.indexArray.emplaceBack(x+C[A],x+C[A+1],x+C[A+2]);g.vertexLength+=f,g.primitiveLength+=C.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,u,l)}}$e("FillBucket",Cc,{omit:["layers","patternFeatures"]});const Hm=new Ei({"fill-sort-key":new Qe(V.layout_fill["fill-sort-key"])});var Km={paint:new Ei({"fill-antialias":new We(V.paint_fill["fill-antialias"]),"fill-opacity":new Qe(V.paint_fill["fill-opacity"]),"fill-color":new Qe(V.paint_fill["fill-color"]),"fill-outline-color":new Qe(V.paint_fill["fill-outline-color"]),"fill-translate":new We(V.paint_fill["fill-translate"]),"fill-translate-anchor":new We(V.paint_fill["fill-translate-anchor"]),"fill-pattern":new ds(V.paint_fill["fill-pattern"])}),layout:Hm};const Jm=Ht([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Ym=Ht([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Qm}=Jm;var Rn={},ef=it,Su=Qs;function Qs(i,e,r,s,l){this.properties={},this.extent=r,this.type=0,this._pbf=i,this._geometry=-1,this._keys=s,this._values=l,i.readFields(tf,this,e)}function tf(i,e,r){i==1?e.id=r.readVarint():i==2?function(s,l){for(var u=s.readVarint()+s.pos;s.pos<u;){var p=l._keys[s.readVarint()],f=l._values[s.readVarint()];l.properties[p]=f}}(r,e):i==3?e.type=r.readVarint():i==4&&(e._geometry=r.pos)}function rf(i){for(var e,r,s=0,l=0,u=i.length,p=u-1;l<u;p=l++)s+=((r=i[p]).x-(e=i[l]).x)*(e.y+r.y);return s}Qs.types=["Unknown","Point","LineString","Polygon"],Qs.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var e,r=i.readVarint()+i.pos,s=1,l=0,u=0,p=0,f=[];i.pos<r;){if(l<=0){var g=i.readVarint();s=7&g,l=g>>3}if(l--,s===1||s===2)u+=i.readSVarint(),p+=i.readSVarint(),s===1&&(e&&f.push(e),e=[]),e.push(new ef(u,p));else{if(s!==7)throw new Error("unknown command "+s);e&&e.push(e[0].clone())}}return e&&f.push(e),f},Qs.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,s=0,l=0,u=0,p=1/0,f=-1/0,g=1/0,x=-1/0;i.pos<e;){if(s<=0){var w=i.readVarint();r=7&w,s=w>>3}if(s--,r===1||r===2)(l+=i.readSVarint())<p&&(p=l),l>f&&(f=l),(u+=i.readSVarint())<g&&(g=u),u>x&&(x=u);else if(r!==7)throw new Error("unknown command "+r)}return[p,g,f,x]},Qs.prototype.toGeoJSON=function(i,e,r){var s,l,u=this.extent*Math.pow(2,r),p=this.extent*i,f=this.extent*e,g=this.loadGeometry(),x=Qs.types[this.type];function w(A){for(var P=0;P<A.length;P++){var F=A[P];A[P]=[360*(F.x+p)/u-180,360/Math.PI*Math.atan(Math.exp((180-360*(F.y+f)/u)*Math.PI/180))-90]}}switch(this.type){case 1:var T=[];for(s=0;s<g.length;s++)T[s]=g[s][0];w(g=T);break;case 2:for(s=0;s<g.length;s++)w(g[s]);break;case 3:for(g=function(A){var P=A.length;if(P<=1)return[A];for(var F,O,q=[],Y=0;Y<P;Y++){var $=rf(A[Y]);$!==0&&(O===void 0&&(O=$<0),O===$<0?(F&&q.push(F),F=[A[Y]]):F.push(A[Y]))}return F&&q.push(F),q}(g),s=0;s<g.length;s++)for(l=0;l<g[s].length;l++)w(g[s][l])}g.length===1?g=g[0]:x="Multi"+x;var C={type:"Feature",geometry:{type:x,coordinates:g},properties:this.properties};return"id"in this&&(C.id=this.id),C};var nf=Su,Eu=Iu;function Iu(i,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(sf,this,e),this.length=this._features.length}function sf(i,e,r){i===15?e.version=r.readVarint():i===1?e.name=r.readString():i===5?e.extent=r.readVarint():i===2?e._features.push(r.pos):i===3?e._keys.push(r.readString()):i===4&&e._values.push(function(s){for(var l=null,u=s.readVarint()+s.pos;s.pos<u;){var p=s.readVarint()>>3;l=p===1?s.readString():p===2?s.readFloat():p===3?s.readDouble():p===4?s.readVarint64():p===5?s.readVarint():p===6?s.readSVarint():p===7?s.readBoolean():null}return l}(r))}Iu.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var e=this._pbf.readVarint()+this._pbf.pos;return new nf(this._pbf,e,this.extent,this._keys,this._values)};var af=Eu;function of(i,e,r){if(i===3){var s=new af(r,r.readVarint()+r.pos);s.length&&(e[s.name]=s)}}Rn.VectorTile=function(i,e){this.layers=i.readFields(of,{},e)},Rn.VectorTileFeature=Su,Rn.VectorTileLayer=Eu;const lf=Rn.VectorTileFeature.types,Mc=Math.pow(2,13);function oo(i,e,r,s,l,u,p,f){i.emplaceBack(e,r,2*Math.floor(s*Mc)+p,l*Mc*2,u*Mc*2,Math.round(f))}class Pc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Ae,this.centroidVertexArray=new pe,this.indexArray=new wt,this.programConfigurations=new _s(e.layers,e.zoom),this.segments=new $t,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.features=[],this.hasPattern=Ic("fill-extrusion",this.layers,r);for(const{feature:l,id:u,index:p,sourceLayerIndex:f}of e){const g=this.layers[0]._featureFilter.needGeometry,x=xs(l,g);if(!this.layers[0]._featureFilter.filter(new Nt(this.zoom),x,s))continue;const w={id:u,sourceLayerIndex:f,index:p,geometry:g?x.geometry:ys(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(Ac("fill-extrusion",this.layers,w,this.zoom,r)):this.addFeature(w,w.geometry,p,s,{}),r.featureIndex.insert(l,w.geometry,p,f,this.index,!0)}}addFeatures(e,r,s){for(const l of this.features){const{geometry:u}=l;this.addFeature(l,u,l.index,r,s)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Qm),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Ym.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,r,s,l,u){const p={x:0,y:0,vertexCount:0};for(const f of Ec(r,500)){let g=0;for(const P of f)g+=P.length;let x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const P of f){if(P.length===0||hf(P))continue;let F=0;for(let O=0;O<P.length;O++){const q=P[O];if(O>=1){const Y=P[O-1];if(!cf(q,Y)){x.vertexLength+4>$t.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const $=q.sub(Y)._perp()._unit(),J=Y.dist(q);F+J>32768&&(F=0),oo(this.layoutVertexArray,q.x,q.y,$.x,$.y,0,0,F),oo(this.layoutVertexArray,q.x,q.y,$.x,$.y,0,1,F),p.x+=2*q.x,p.y+=2*q.y,p.vertexCount+=2,F+=J,oo(this.layoutVertexArray,Y.x,Y.y,$.x,$.y,0,0,F),oo(this.layoutVertexArray,Y.x,Y.y,$.x,$.y,0,1,F),p.x+=2*Y.x,p.y+=2*Y.y,p.vertexCount+=2;const de=x.vertexLength;this.indexArray.emplaceBack(de,de+2,de+1),this.indexArray.emplaceBack(de+1,de+2,de+3),x.vertexLength+=4,x.primitiveLength+=2}}}}if(x.vertexLength+g>$t.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(g,this.layoutVertexArray,this.indexArray)),lf[e.type]!=="Polygon")continue;const w=[],T=[],C=x.vertexLength;for(const P of f)if(P.length!==0){P!==f[0]&&T.push(w.length/2);for(let F=0;F<P.length;F++){const O=P[F];oo(this.layoutVertexArray,O.x,O.y,0,0,1,1,0),p.x+=O.x,p.y+=O.y,p.vertexCount+=1,w.push(O.x),w.push(O.y)}}const A=ro(w,T);for(let P=0;P<A.length;P+=3)this.indexArray.emplaceBack(C+A[P],C+A[P+2],C+A[P+1]);x.primitiveLength+=A.length/3,x.vertexLength+=g}for(let f=0;f<p.vertexCount;f++)this.centroidVertexArray.emplaceBack(Math.floor(p.x/p.vertexCount),Math.floor(p.y/p.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,u,l)}}function cf(i,e){return i.x===e.x&&(i.x<0||i.x>oi)||i.y===e.y&&(i.y<0||i.y>oi)}function hf(i){return i.every(e=>e.x<0)||i.every(e=>e.x>oi)||i.every(e=>e.y<0)||i.every(e=>e.y>oi)}$e("FillExtrusionBucket",Pc,{omit:["layers","features"]});var uf={paint:new Ei({"fill-extrusion-opacity":new We(V["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Qe(V["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new We(V["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new We(V["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ds(V["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Qe(V["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Qe(V["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new We(V["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function lo(i,e){return i.x*e.x+i.y*e.y}function Au(i,e){if(i.length===1){let r=0;const s=e[r++];let l;for(;!l||s.equals(l);)if(l=e[r++],!l)return 1/0;for(;r<e.length;r++){const u=e[r],p=i[0],f=l.sub(s),g=u.sub(s),x=p.sub(s),w=lo(f,f),T=lo(f,g),C=lo(g,g),A=lo(x,f),P=lo(x,g),F=w*C-T*T,O=(C*A-T*P)/F,q=(w*P-T*A)/F,Y=s.z*(1-O-q)+l.z*O+u.z*q;if(isFinite(Y))return Y}return 1/0}{let r=1/0;for(const s of e)r=Math.min(r,s.z);return r}}const df=Ht([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:pf}=df,mf=Ht([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:ff}=mf,gf=Rn.VectorTileFeature.types,_f=Math.cos(Math.PI/180*37.5),Cu=Math.pow(2,14)/.5;class kc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new je,this.layoutVertexArray2=new rt,this.indexArray=new wt,this.programConfigurations=new _s(e.layers,e.zoom),this.segments=new $t,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=Ic("line",this.layers,r);const l=this.layers[0].layout.get("line-sort-key"),u=!l.isConstant(),p=[];for(const{feature:f,id:g,index:x,sourceLayerIndex:w}of e){const T=this.layers[0]._featureFilter.needGeometry,C=xs(f,T);if(!this.layers[0]._featureFilter.filter(new Nt(this.zoom),C,s))continue;const A=u?l.evaluate(C,{},s):void 0,P={id:g,properties:f.properties,type:f.type,sourceLayerIndex:w,index:x,geometry:T?C.geometry:ys(f),patterns:{},sortKey:A};p.push(P)}u&&p.sort((f,g)=>f.sortKey-g.sortKey);for(const f of p){const{geometry:g,index:x,sourceLayerIndex:w}=f;if(this.hasPattern){const T=Ac("line",this.layers,f,this.zoom,r);this.patternFeatures.push(T)}else this.addFeature(f,g,x,s,{});r.featureIndex.insert(e[x].feature,g,x,w,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}addFeatures(e,r,s){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,ff)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,pf),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,r,s,l,u){const p=this.layers[0].layout,f=p.get("line-join").evaluate(e,{}),g=p.get("line-cap"),x=p.get("line-miter-limit"),w=p.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const T of r)this.addLine(T,e,f,g,x,w);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,u,l)}addLine(e,r,s,l,u,p){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let q=0;q<e.length-1;q++)this.totalDistance+=e[q].dist(e[q+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const f=gf[r.type]==="Polygon";let g=e.length;for(;g>=2&&e[g-1].equals(e[g-2]);)g--;let x=0;for(;x<g-1&&e[x].equals(e[x+1]);)x++;if(g<(f?3:2))return;s==="bevel"&&(u=1.05);const w=this.overscaling<=16?122880/(512*this.overscaling):0,T=this.segments.prepareSegment(10*g,this.layoutVertexArray,this.indexArray);let C,A,P,F,O;this.e1=this.e2=-1,f&&(C=e[g-2],O=e[x].sub(C)._unit()._perp());for(let q=x;q<g;q++){if(P=q===g-1?f?e[x+1]:void 0:e[q+1],P&&e[q].equals(P))continue;O&&(F=O),C&&(A=C),C=e[q],O=P?P.sub(C)._unit()._perp():F,F=F||O;let Y=F.add(O);Y.x===0&&Y.y===0||Y._unit();const $=F.x*O.x+F.y*O.y,J=Y.x*O.x+Y.y*O.y,de=J!==0?1/J:1/0,ue=2*Math.sqrt(2-2*J),Ne=J<_f&&A&&P,qe=F.x*O.y-F.y*O.x>0;if(Ne&&q>x){const ze=C.dist(A);if(ze>2*w){const Ve=C.sub(C.sub(A)._mult(w/ze)._round());this.updateDistance(A,Ve),this.addCurrentVertex(Ve,F,0,0,T),A=Ve}}const Ue=A&&P;let Re=Ue?s:f?"butt":l;if(Ue&&Re==="round"&&(de<p?Re="miter":de<=2&&(Re="fakeround")),Re==="miter"&&de>u&&(Re="bevel"),Re==="bevel"&&(de>2&&(Re="flipbevel"),de<u&&(Re="miter")),A&&this.updateDistance(A,C),Re==="miter")Y._mult(de),this.addCurrentVertex(C,Y,0,0,T);else if(Re==="flipbevel"){if(de>100)Y=O.mult(-1);else{const ze=de*F.add(O).mag()/F.sub(O).mag();Y._perp()._mult(ze*(qe?-1:1))}this.addCurrentVertex(C,Y,0,0,T),this.addCurrentVertex(C,Y.mult(-1),0,0,T)}else if(Re==="bevel"||Re==="fakeround"){const ze=-Math.sqrt(de*de-1),Ve=qe?ze:0,Be=qe?0:ze;if(A&&this.addCurrentVertex(C,F,Ve,Be,T),Re==="fakeround"){const Ee=Math.round(180*ue/Math.PI/20);for(let Ke=1;Ke<Ee;Ke++){let Xe=Ke/Ee;if(Xe!==.5){const qt=Xe-.5;Xe+=Xe*qt*(Xe-1)*((1.0904+$*($*(3.55645-1.43519*$)-3.2452))*qt*qt+(.848013+$*(.215638*$-1.06021)))}const ct=O.sub(F)._mult(Xe)._add(F)._unit()._mult(qe?-1:1);this.addHalfVertex(C,ct.x,ct.y,!1,qe,0,T)}}P&&this.addCurrentVertex(C,O,-Ve,-Be,T)}else if(Re==="butt")this.addCurrentVertex(C,Y,0,0,T);else if(Re==="square"){const ze=A?1:-1;this.addCurrentVertex(C,Y,ze,ze,T)}else Re==="round"&&(A&&(this.addCurrentVertex(C,F,0,0,T),this.addCurrentVertex(C,F,1,1,T,!0)),P&&(this.addCurrentVertex(C,O,-1,-1,T,!0),this.addCurrentVertex(C,O,0,0,T)));if(Ne&&q<g-1){const ze=C.dist(P);if(ze>2*w){const Ve=C.add(P.sub(C)._mult(w/ze)._round());this.updateDistance(C,Ve),this.addCurrentVertex(Ve,O,0,0,T),C=Ve}}}}addCurrentVertex(e,r,s,l,u,p=!1){const f=r.y*l-r.x,g=-r.y-r.x*l;this.addHalfVertex(e,r.x+r.y*s,r.y-r.x*s,p,!1,s,u),this.addHalfVertex(e,f,g,p,!0,-l,u),this.distance>Cu/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(e,r,s,l,u,p))}addHalfVertex({x:e,y:r},s,l,u,p,f,g){const x=.5*(this.lineClips?this.scaledDistance*(Cu-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(u?1:0),(r<<1)+(p?1:0),Math.round(63*s)+128,Math.round(63*l)+128,1+(f===0?0:f<0?-1:1)|(63&x)<<2,x>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const w=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,w),g.primitiveLength++),p?this.e2=w:this.e1=w}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}}$e("LineBucket",kc,{omit:["layers","patternFeatures"]});const yf=new Ei({"line-cap":new We(V.layout_line["line-cap"]),"line-join":new Qe(V.layout_line["line-join"]),"line-miter-limit":new We(V.layout_line["line-miter-limit"]),"line-round-limit":new We(V.layout_line["line-round-limit"]),"line-sort-key":new Qe(V.layout_line["line-sort-key"])});var Mu={paint:new Ei({"line-opacity":new Qe(V.paint_line["line-opacity"]),"line-color":new Qe(V.paint_line["line-color"]),"line-translate":new We(V.paint_line["line-translate"]),"line-translate-anchor":new We(V.paint_line["line-translate-anchor"]),"line-width":new Qe(V.paint_line["line-width"]),"line-gap-width":new Qe(V.paint_line["line-gap-width"]),"line-offset":new Qe(V.paint_line["line-offset"]),"line-blur":new Qe(V.paint_line["line-blur"]),"line-dasharray":new Wa(V.paint_line["line-dasharray"]),"line-pattern":new ds(V.paint_line["line-pattern"]),"line-gradient":new Ha(V.paint_line["line-gradient"])}),layout:yf};const Pu=new class extends Qe{possiblyEvaluate(i,e){return e=new Nt(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(i,e)}evaluate(i,e,r,s){return e=Ye({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(i,e,r,s)}}(Mu.paint.properties["line-width"].specification);function ku(i,e){return e>0?e+2*i:i}Pu.useIntegerZoom=!0;const xf=Ht([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),vf=Ht([{name:"a_projected_pos",components:3,type:"Float32"}],4);Ht([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const bf=Ht([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Ht([{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 zu=Ht([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),wf=Ht([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Tf(i,e,r){return i.sections.forEach(s=>{s.text=function(l,u,p){const f=u.layout.get("text-transform").evaluate(p,{});return f==="uppercase"?l=l.toLocaleUpperCase():f==="lowercase"&&(l=l.toLocaleLowerCase()),Gi.applyArabicShaping&&(l=Gi.applyArabicShaping(l)),l}(s.text,e,r)}),i}Ht([{name:"triangle",components:3,type:"Uint16"}]),Ht([{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"}]),Ht([{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Ht([{type:"Float32",name:"offsetX"}]),Ht([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const co={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"};var pi=24,zc=kt,Lu=function(i,e,r,s,l){var u,p,f=8*l-s-1,g=(1<<f)-1,x=g>>1,w=-7,T=r?l-1:0,C=r?-1:1,A=i[e+T];for(T+=C,u=A&(1<<-w)-1,A>>=-w,w+=f;w>0;u=256*u+i[e+T],T+=C,w-=8);for(p=u&(1<<-w)-1,u>>=-w,w+=s;w>0;p=256*p+i[e+T],T+=C,w-=8);if(u===0)u=1-x;else{if(u===g)return p?NaN:1/0*(A?-1:1);p+=Math.pow(2,s),u-=x}return(A?-1:1)*p*Math.pow(2,u-s)},Du=function(i,e,r,s,l,u){var p,f,g,x=8*u-l-1,w=(1<<x)-1,T=w>>1,C=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=s?0:u-1,P=s?1:-1,F=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,p=w):(p=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-p))<1&&(p--,g*=2),(e+=p+T>=1?C/g:C*Math.pow(2,1-T))*g>=2&&(p++,g/=2),p+T>=w?(f=0,p=w):p+T>=1?(f=(e*g-1)*Math.pow(2,l),p+=T):(f=e*Math.pow(2,T-1)*Math.pow(2,l),p=0));l>=8;i[r+A]=255&f,A+=P,f/=256,l-=8);for(p=p<<l|f,x+=l;x>0;i[r+A]=255&p,A+=P,p/=256,x-=8);i[r+A-P]|=128*F};function kt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}kt.Varint=0,kt.Fixed64=1,kt.Bytes=2,kt.Fixed32=5;var Bn,Lc=4294967296,Ru=1/Lc,Bu=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function tn(i){return i.type===kt.Bytes?i.readVarint()+i.pos:i.pos+1}function ea(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function Fu(i,e,r){var s=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(s);for(var l=r.pos-1;l>=i;l--)r.buf[l+s]=r.buf[l]}function Sf(i,e){for(var r=0;r<i.length;r++)e.writeVarint(i[r])}function Ef(i,e){for(var r=0;r<i.length;r++)e.writeSVarint(i[r])}function If(i,e){for(var r=0;r<i.length;r++)e.writeFloat(i[r])}function Af(i,e){for(var r=0;r<i.length;r++)e.writeDouble(i[r])}function Cf(i,e){for(var r=0;r<i.length;r++)e.writeBoolean(i[r])}function Mf(i,e){for(var r=0;r<i.length;r++)e.writeFixed32(i[r])}function Pf(i,e){for(var r=0;r<i.length;r++)e.writeSFixed32(i[r])}function kf(i,e){for(var r=0;r<i.length;r++)e.writeFixed64(i[r])}function zf(i,e){for(var r=0;r<i.length;r++)e.writeSFixed64(i[r])}function bl(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+16777216*i[e+3]}function ta(i,e,r){i[r]=e,i[r+1]=e>>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function Ou(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}function Lf(i,e,r){i===1&&r.readMessage(Df,e)}function Df(i,e,r){if(i===3){const{id:s,bitmap:l,width:u,height:p,left:f,top:g,advance:x}=r.readMessage(Rf,{});e.push({id:s,bitmap:new io({width:u+6,height:p+6},l),metrics:{width:u,height:p,left:f,top:g,advance:x}})}}function Rf(i,e,r){i===1?e.id=r.readVarint():i===2?e.bitmap=r.readBytes():i===3?e.width=r.readVarint():i===4?e.height=r.readVarint():i===5?e.left=r.readSVarint():i===6?e.top=r.readSVarint():i===7&&(e.advance=r.readVarint())}function Uu(i){let e=0,r=0;for(const p of i)e+=p.w*p.h,r=Math.max(r,p.w);i.sort((p,f)=>f.h-p.h);const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let l=0,u=0;for(const p of i)for(let f=s.length-1;f>=0;f--){const g=s[f];if(!(p.w>g.w||p.h>g.h)){if(p.x=g.x,p.y=g.y,u=Math.max(u,p.y+p.h),l=Math.max(l,p.x+p.w),p.w===g.w&&p.h===g.h){const x=s.pop();f<s.length&&(s[f]=x)}else p.h===g.h?(g.x+=p.w,g.w-=p.w):p.w===g.w?(g.y+=p.h,g.h-=p.h):(s.push({x:g.x+p.w,y:g.y,w:g.w-p.w,h:p.h}),g.y+=p.h,g.h-=p.h);break}}return{w:l,h:u,fill:e/(l*u)||0}}kt.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos<r;){var s=this.readVarint(),l=s>>3,u=this.pos;this.type=7&s,i(l,e,this),this.pos===u&&this.skip(s)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=bl(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=Ou(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=bl(this.buf,this.pos)+bl(this.buf,this.pos+4)*Lc;return this.pos+=8,i},readSFixed64:function(){var i=bl(this.buf,this.pos)+Ou(this.buf,this.pos+4)*Lc;return this.pos+=8,i},readFloat:function(){var i=Lu(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Lu(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,s=this.buf;return e=127&(r=s[this.pos++]),r<128?e:(e|=(127&(r=s[this.pos++]))<<7,r<128?e:(e|=(127&(r=s[this.pos++]))<<14,r<128?e:(e|=(127&(r=s[this.pos++]))<<21,r<128?e:function(l,u,p){var f,g,x=p.buf;if(f=(112&(g=x[p.pos++]))>>4,g<128||(f|=(127&(g=x[p.pos++]))<<3,g<128)||(f|=(127&(g=x[p.pos++]))<<10,g<128)||(f|=(127&(g=x[p.pos++]))<<17,g<128)||(f|=(127&(g=x[p.pos++]))<<24,g<128)||(f|=(1&(g=x[p.pos++]))<<31,g<128))return ea(l,f,u);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=s[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var i=this.readVarint()+this.pos,e=this.pos;return this.pos=i,i-e>=12&&Bu?function(r,s,l){return Bu.decode(r.subarray(s,l))}(this.buf,e,i):function(r,s,l){for(var u="",p=s;p<l;){var f,g,x,w=r[p],T=null,C=w>239?4:w>223?3:w>191?2:1;if(p+C>l)break;C===1?w<128&&(T=w):C===2?(192&(f=r[p+1]))==128&&(T=(31&w)<<6|63&f)<=127&&(T=null):C===3?(g=r[p+2],(192&(f=r[p+1]))==128&&(192&g)==128&&((T=(15&w)<<12|(63&f)<<6|63&g)<=2047||T>=55296&&T<=57343)&&(T=null)):C===4&&(g=r[p+2],x=r[p+3],(192&(f=r[p+1]))==128&&(192&g)==128&&(192&x)==128&&((T=(15&w)<<18|(63&f)<<12|(63&g)<<6|63&x)<=65535||T>=1114112)&&(T=null)),T===null?(T=65533,C=1):T>65535&&(T-=65536,u+=String.fromCharCode(T>>>10&1023|55296),T=56320|1023&T),u+=String.fromCharCode(T),p+=C}return u}(this.buf,e,i)},readBytes:function(){var i=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,i);return this.pos=i,e},readPackedVarint:function(i,e){if(this.type!==kt.Bytes)return i.push(this.readVarint(e));var r=tn(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(e));return i},readPackedSVarint:function(i){if(this.type!==kt.Bytes)return i.push(this.readSVarint());var e=tn(this);for(i=i||[];this.pos<e;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==kt.Bytes)return i.push(this.readBoolean());var e=tn(this);for(i=i||[];this.pos<e;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==kt.Bytes)return i.push(this.readFloat());var e=tn(this);for(i=i||[];this.pos<e;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==kt.Bytes)return i.push(this.readDouble());var e=tn(this);for(i=i||[];this.pos<e;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==kt.Bytes)return i.push(this.readFixed32());var e=tn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==kt.Bytes)return i.push(this.readSFixed32());var e=tn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==kt.Bytes)return i.push(this.readFixed64());var e=tn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==kt.Bytes)return i.push(this.readSFixed64());var e=tn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed64());return i},skip:function(i){var e=7&i;if(e===kt.Varint)for(;this.buf[this.pos++]>127;);else if(e===kt.Bytes)this.pos=this.readVarint()+this.pos;else if(e===kt.Fixed32)this.pos+=4;else{if(e!==kt.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e<this.pos+i;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(i){this.realloc(4),ta(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),ta(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),ta(this.buf,-1&i,this.pos),ta(this.buf,Math.floor(i*Ru),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),ta(this.buf,-1&i,this.pos),ta(this.buf,Math.floor(i*Ru),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?function(e,r){var s,l;if(e>=0?(s=e%4294967296|0,l=e/4294967296|0):(l=~(-e/4294967296),4294967295^(s=~(-e%4294967296))?s=s+1|0:(s=0,l=l+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(u,p,f){f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,f.buf[f.pos]=127&(u>>>=7)}(s,0,r),function(u,p){var f=(7&u)<<4;p.buf[p.pos++]|=f|((u>>>=3)?128:0),u&&(p.buf[p.pos++]=127&u|((u>>>=7)?128:0),u&&(p.buf[p.pos++]=127&u|((u>>>=7)?128:0),u&&(p.buf[p.pos++]=127&u|((u>>>=7)?128:0),u&&(p.buf[p.pos++]=127&u|((u>>>=7)?128:0),u&&(p.buf[p.pos++]=127&u)))))}(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(Boolean(i))},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var e=this.pos;this.pos=function(s,l,u){for(var p,f,g=0;g<l.length;g++){if((p=l.charCodeAt(g))>55295&&p<57344){if(!f){p>56319||g+1===l.length?(s[u++]=239,s[u++]=191,s[u++]=189):f=p;continue}if(p<56320){s[u++]=239,s[u++]=191,s[u++]=189,f=p;continue}p=f-55296<<10|p-56320|65536,f=null}else f&&(s[u++]=239,s[u++]=191,s[u++]=189,f=null);p<128?s[u++]=p:(p<2048?s[u++]=p>>6|192:(p<65536?s[u++]=p>>12|224:(s[u++]=p>>18|240,s[u++]=p>>12&63|128),s[u++]=p>>6&63|128),s[u++]=63&p|128)}return u}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&Fu(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Du(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Du(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=i[r]},writeRawMessage:function(i,e){this.pos++;var r=this.pos;i(e,this);var s=this.pos-r;s>=128&&Fu(r,s,this),this.pos=r-1,this.writeVarint(s),this.pos+=s},writeMessage:function(i,e,r){this.writeTag(i,kt.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,Sf,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,Ef,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,Cf,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,If,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,Af,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,Mf,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,Pf,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,kf,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,zf,e)},writeBytesField:function(i,e){this.writeTag(i,kt.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,kt.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,kt.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,kt.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,kt.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,kt.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,kt.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,kt.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,kt.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,kt.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,Boolean(e))}};class Dc{constructor(e,{pixelRatio:r,version:s,stretchX:l,stretchY:u,content:p}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=l,this.stretchY=u,this.content=p,this.version=s}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class Vu{constructor(e,r){const s={},l={};this.haveRenderCallbacks=[];const u=[];this.addImages(e,s,u),this.addImages(r,l,u);const{w:p,h:f}=Uu(u),g=new dr({width:p||1,height:f||1});for(const x in e){const w=e[x],T=s[x].paddedRect;dr.copy(w.data,g,{x:0,y:0},{x:T.x+1,y:T.y+1},w.data)}for(const x in r){const w=r[x],T=l[x].paddedRect,C=T.x+1,A=T.y+1,P=w.data.width,F=w.data.height;dr.copy(w.data,g,{x:0,y:0},{x:C,y:A},w.data),dr.copy(w.data,g,{x:0,y:F-1},{x:C,y:A-1},{width:P,height:1}),dr.copy(w.data,g,{x:0,y:0},{x:C,y:A+F},{width:P,height:1}),dr.copy(w.data,g,{x:P-1,y:0},{x:C-1,y:A},{width:1,height:F}),dr.copy(w.data,g,{x:0,y:0},{x:C+P,y:A},{width:1,height:F})}this.image=g,this.iconPositions=s,this.patternPositions=l}addImages(e,r,s){for(const l in e){const u=e[l],p={x:0,y:0,w:u.data.width+2,h:u.data.height+2};s.push(p),r[l]=new Dc(p,u),u.hasRenderCallback&&this.haveRenderCallbacks.push(l)}}patchUpdatedImages(e,r){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const s in e.updatedImages)this.patchUpdatedImage(this.iconPositions[s],e.getImage(s),r),this.patchUpdatedImage(this.patternPositions[s],e.getImage(s),r)}patchUpdatedImage(e,r,s){if(!e||!r||e.version===r.version)return;e.version=r.version;const[l,u]=e.tl;s.update(r.data,void 0,{x:l,y:u})}}$e("ImagePosition",Dc),$e("ImageAtlas",Vu),c.WritingMode=void 0,(Bn=c.WritingMode||(c.WritingMode={}))[Bn.none=0]="none",Bn[Bn.horizontal=1]="horizontal",Bn[Bn.vertical=2]="vertical",Bn[Bn.horizontalOnly=3]="horizontalOnly";const wl=-17;class ho{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){const s=new ho;return s.scale=e||1,s.fontStack=r,s}static forImage(e){const r=new ho;return r.imageName=e,r}}class ia{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){const s=new ia;for(let l=0;l<e.sections.length;l++){const u=e.sections[l];u.image?s.addImageSection(u):s.addTextSection(u,r)}return s}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}getCharCode(e){return this.text.charCodeAt(e)}verticalizePunctuation(){this.text=function(e){let r="";for(let s=0;s<e.length;s++){const l=e.charCodeAt(s+1)||null,u=e.charCodeAt(s-1)||null;r+=l&&al(l)&&!co[e[s+1]]||u&&al(u)&&!co[e[s-1]]||!co[e[s]]?e[s]:co[e[s]]}return r}(this.text)}trim(){let e=0;for(let s=0;s<this.text.length&&Sl[this.text.charCodeAt(s)];s++)e++;let r=this.text.length;for(let s=this.text.length-1;s>=0&&s>=e&&Sl[this.text.charCodeAt(s)];s--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const s=new ia;return s.text=this.text.substring(e,r),s.sectionIndex=this.sectionIndex.slice(e,r),s.sections=this.sections,s}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}addTextSection(e,r){this.text+=e.text,this.sections.push(ho.forText(e.scale,e.fontStack||r));const s=this.sections.length-1;for(let l=0;l<e.text.length;++l)this.sectionIndex.push(s)}addImageSection(e){const r=e.image?e.image.name:"";if(r.length===0)return void Qt("Can't add FormattedSection with an empty image.");const s=this.getNextImageSectionCharCode();s?(this.text+=String.fromCharCode(s),this.sections.push(ho.forImage(r)),this.sectionIndex.push(this.sections.length-1)):Qt("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Tl(i,e,r,s,l,u,p,f,g,x,w,T,C,A,P,F){const O=ia.fromFeature(i,l);let q;T===c.WritingMode.vertical&&O.verticalizePunctuation();const{processBidirectionalText:Y,processStyledBidirectionalText:$}=Gi;if(Y&&O.sections.length===1){q=[];const ue=Y(O.toString(),Rc(O,x,u,e,s,A,P));for(const Ne of ue){const qe=new ia;qe.text=Ne,qe.sections=O.sections;for(let Ue=0;Ue<Ne.length;Ue++)qe.sectionIndex.push(0);q.push(qe)}}else if($){q=[];const ue=$(O.text,O.sectionIndex,Rc(O,x,u,e,s,A,P));for(const Ne of ue){const qe=new ia;qe.text=Ne[0],qe.sectionIndex=Ne[1],qe.sections=O.sections,q.push(qe)}}else q=function(ue,Ne){const qe=[],Ue=ue.text;let Re=0;for(const ze of Ne)qe.push(ue.substring(Re,ze)),Re=ze;return Re<Ue.length&&qe.push(ue.substring(Re,Ue.length)),qe}(O,Rc(O,x,u,e,s,A,P));const J=[],de={positionedLines:J,text:O.toString(),top:w[1],bottom:w[1],left:w[0],right:w[0],writingMode:T,iconsInText:!1,verticalizable:!1};return function(ue,Ne,qe,Ue,Re,ze,Ve,Be,Ee,Ke,Xe,ct){let qt=0,Xt=wl,li=0,mr=0;const gi=Be==="right"?1:Be==="left"?0:.5;let ni=0;for(const si of Re){si.trim();const yi=si.getMaxScale(),Pi=(yi-1)*pi,Fi={positionedGlyphs:[],lineOffset:0};ue.positionedLines[ni]=Fi;const qi=Fi.positionedGlyphs;let Zi=0;if(!si.length()){Xt+=ze,++ni;continue}for(let xi=0;xi<si.length();xi++){const ht=si.getSection(xi),ir=si.getSectionIndex(xi),vi=si.getCharCode(xi);let ki=0,xr=null,Pr=null,kr=null,nn=pi;const vr=!(Ee===c.WritingMode.horizontal||!Xe&&!Ua(vi)||Xe&&(Sl[vi]||(ui=vi,Oe.Arabic(ui)||Oe["Arabic Supplement"](ui)||Oe["Arabic Extended-A"](ui)||Oe["Arabic Presentation Forms-A"](ui)||Oe["Arabic Presentation Forms-B"](ui))));if(ht.imageName){const fr=Ue[ht.imageName];if(!fr)continue;kr=ht.imageName,ue.iconsInText=ue.iconsInText||!0,Pr=fr.paddedRect;const Xi=fr.displaySize;ht.scale=ht.scale*pi/ct,xr={width:Xi[0],height:Xi[1],left:1,top:-3,advance:vr?Xi[1]:Xi[0]},ki=Pi+(pi-Xi[1]*ht.scale),nn=xr.advance;const sn=vr?Xi[0]*ht.scale-pi*yi:Xi[1]*ht.scale-pi*yi;sn>0&&sn>Zi&&(Zi=sn)}else{const fr=qe[ht.fontStack],Xi=fr&&fr[vi];if(Xi&&Xi.rect)Pr=Xi.rect,xr=Xi.metrics;else{const sn=Ne[ht.fontStack],fo=sn&&sn[vi];if(!fo)continue;xr=fo.metrics}ki=(yi-ht.scale)*pi}vr?(ue.verticalizable=!0,qi.push({glyph:vi,imageName:kr,x:qt,y:Xt+ki,vertical:vr,scale:ht.scale,fontStack:ht.fontStack,sectionIndex:ir,metrics:xr,rect:Pr}),qt+=nn*ht.scale+Ke):(qi.push({glyph:vi,imageName:kr,x:qt,y:Xt+ki,vertical:vr,scale:ht.scale,fontStack:ht.fontStack,sectionIndex:ir,metrics:xr,rect:Pr}),qt+=xr.advance*ht.scale+Ke)}qi.length!==0&&(li=Math.max(qt-Ke,li),Of(qi,0,qi.length-1,gi,Zi)),qt=0;const Jt=ze*yi+Zi;Fi.lineOffset=Math.max(Zi,Pi),Xt+=Jt,mr=Math.max(Jt,mr),++ni}var ui;const _i=Xt-wl,{horizontalAlign:Mi,verticalAlign:ji}=Bc(Ve);(function(si,yi,Pi,Fi,qi,Zi,Jt,xi,ht){const ir=(yi-Pi)*qi;let vi=0;vi=Zi!==Jt?-xi*Fi-wl:(-Fi*ht+.5)*Jt;for(const ki of si)for(const xr of ki.positionedGlyphs)xr.x+=ir,xr.y+=vi})(ue.positionedLines,gi,Mi,ji,li,mr,ze,_i,Re.length),ue.top+=-ji*_i,ue.bottom=ue.top+_i,ue.left+=-Mi*li,ue.right=ue.left+li}(de,e,r,s,q,p,f,g,T,x,C,F),!function(ue){for(const Ne of ue)if(Ne.positionedGlyphs.length!==0)return!1;return!0}(J)&&de}const Sl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Bf={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Nu(i,e,r,s,l,u){if(e.imageName){const p=s[e.imageName];return p?p.displaySize[0]*e.scale*pi/u+l:0}{const p=r[e.fontStack],f=p&&p[i];return f?f.metrics.advance*e.scale+l:0}}function $u(i,e,r,s){const l=Math.pow(i-e,2);return s?i<e?l/2:2*l:l+Math.abs(r)*r}function Ff(i,e,r){let s=0;return i===10&&(s-=1e4),r&&(s+=150),i!==40&&i!==65288||(s+=50),e!==41&&e!==65289||(s+=50),s}function Gu(i,e,r,s,l,u){let p=null,f=$u(e,r,l,u);for(const g of s){const x=$u(e-g.x,r,l,u)+g.badness;x<=f&&(p=g,f=x)}return{index:i,x:e,priorBreak:p,badness:f}}function ju(i){return i?ju(i.priorBreak).concat(i.index):[]}function Rc(i,e,r,s,l,u,p){if(u!=="point")return[];if(!i)return[];const f=[],g=function(C,A,P,F,O,q){let Y=0;for(let $=0;$<C.length();$++){const J=C.getSection($);Y+=Nu(C.getCharCode($),J,F,O,A,q)}return Y/Math.max(1,Math.ceil(Y/P))}(i,e,r,s,l,p),x=i.text.indexOf("\u200B")>=0;let w=0;for(let C=0;C<i.length();C++){const A=i.getSection(C),P=i.getCharCode(C);if(Sl[P]||(w+=Nu(P,A,s,l,e,p)),C<i.length()-1){const F=!((T=P)<11904||!(Oe["Bopomofo Extended"](T)||Oe.Bopomofo(T)||Oe["CJK Compatibility Forms"](T)||Oe["CJK Compatibility Ideographs"](T)||Oe["CJK Compatibility"](T)||Oe["CJK Radicals Supplement"](T)||Oe["CJK Strokes"](T)||Oe["CJK Symbols and Punctuation"](T)||Oe["CJK Unified Ideographs Extension A"](T)||Oe["CJK Unified Ideographs"](T)||Oe["Enclosed CJK Letters and Months"](T)||Oe["Halfwidth and Fullwidth Forms"](T)||Oe.Hiragana(T)||Oe["Ideographic Description Characters"](T)||Oe["Kangxi Radicals"](T)||Oe["Katakana Phonetic Extensions"](T)||Oe.Katakana(T)||Oe["Vertical Forms"](T)||Oe["Yi Radicals"](T)||Oe["Yi Syllables"](T)));(Bf[P]||F||A.imageName)&&f.push(Gu(C+1,w,g,f,Ff(P,i.getCharCode(C+1),F&&x),!1))}}var T;return ju(Gu(i.length(),w,g,f,0,!0))}function Bc(i){let e=.5,r=.5;switch(i){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(i){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function Of(i,e,r,s,l){if(!s&&!l)return;const u=i[r],p=(i[r].x+u.metrics.advance*u.scale)*s;for(let f=e;f<=r;f++)i[f].x-=p,i[f].y+=l}function Uf(i,e,r){const{horizontalAlign:s,verticalAlign:l}=Bc(r),u=e[0]-i.displaySize[0]*s,p=e[1]-i.displaySize[1]*l;return{image:i,top:p,bottom:p+i.displaySize[1],left:u,right:u+i.displaySize[0]}}function qu(i,e,r,s,l,u){const p=i.image;let f;if(p.content){const O=p.content,q=p.pixelRatio||1;f=[O[0]/q,O[1]/q,p.displaySize[0]-O[2]/q,p.displaySize[1]-O[3]/q]}const g=e.left*u,x=e.right*u;let w,T,C,A;r==="width"||r==="both"?(A=l[0]+g-s[3],T=l[0]+x+s[1]):(A=l[0]+(g+x-p.displaySize[0])/2,T=A+p.displaySize[0]);const P=e.top*u,F=e.bottom*u;return r==="height"||r==="both"?(w=l[1]+P-s[0],C=l[1]+F+s[2]):(w=l[1]+(P+F-p.displaySize[1])/2,C=w+p.displaySize[1]),{image:p,top:w,right:T,bottom:C,left:A,collisionPadding:f}}const rn=128;function Zu(i,e){const{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Nt(i+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:s,interpolationType:l}=r;let u=0;for(;u<s.length&&s[u]<=i;)u++;u=Math.max(0,u-1);let p=u;for(;p<s.length&&s[p]<i+1;)p++;p=Math.min(s.length-1,p);const f=s[u],g=s[p];return r.kind==="composite"?{kind:"composite",minZoom:f,maxZoom:g,interpolationType:l}:{kind:"camera",minZoom:f,maxZoom:g,minSize:r.evaluate(new Nt(f)),maxSize:r.evaluate(new Nt(g)),interpolationType:l}}}class Fn extends it{constructor(e,r,s,l){super(e,r),this.angle=s,l!==void 0&&(this.segment=l)}clone(){return new Fn(this.x,this.y,this.angle,this.segment)}}function Xu(i,e,r,s,l){if(e.segment===void 0)return!0;let u=e,p=e.segment+1,f=0;for(;f>-r/2;){if(p--,p<0)return!1;f-=i[p].dist(u),u=i[p]}f+=i[p].dist(i[p+1]),p++;const g=[];let x=0;for(;f<r/2;){const w=i[p],T=i[p+1];if(!T)return!1;let C=i[p-1].angleTo(w)-w.angleTo(T);for(C=Math.abs((C+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:f,angleDelta:C}),x+=C;f-g[0].distance>s;)x-=g.shift().angleDelta;if(x>l)return!1;p++,f+=w.dist(T)}return!0}function Wu(i){let e=0;for(let r=0;r<i.length-1;r++)e+=i[r].dist(i[r+1]);return e}function Hu(i,e,r){return i?.6*e*r:0}function Ku(i,e){return Math.max(i?i.right-i.left:0,e?e.right-e.left:0)}function Vf(i,e,r,s,l,u){const p=Hu(r,l,u),f=Ku(r,s)*u;let g=0;const x=Wu(i)/2;for(let w=0;w<i.length-1;w++){const T=i[w],C=i[w+1],A=T.dist(C);if(g+A>x){const P=(x-g)/A,F=Zt(T.x,C.x,P),O=Zt(T.y,C.y,P),q=new Fn(F,O,C.angleTo(T),w);return q._round(),!p||Xu(i,q,f,p,e)?q:void 0}g+=A}}function Nf(i,e,r,s,l,u,p,f,g){const x=Hu(s,u,p),w=Ku(s,l),T=w*p,C=i[0].x===0||i[0].x===g||i[0].y===0||i[0].y===g;return e-T<e/4&&(e=T+e/4),Ju(i,C?e/2*f%e:(w/2+2*u)*p*f%e,e,x,r,T,C,!1,g)}function Ju(i,e,r,s,l,u,p,f,g){const x=u/2,w=Wu(i);let T=0,C=e-r,A=[];for(let P=0;P<i.length-1;P++){const F=i[P],O=i[P+1],q=F.dist(O),Y=O.angleTo(F);for(;C+r<T+q;){C+=r;const $=(C-T)/q,J=Zt(F.x,O.x,$),de=Zt(F.y,O.y,$);if(J>=0&&J<g&&de>=0&&de<g&&C-x>=0&&C+x<=w){const ue=new Fn(J,de,Y,P);ue._round(),s&&!Xu(i,ue,u,s,l)||A.push(ue)}}T+=q}return f||A.length||p||(A=Ju(i,T/2,r,s,l,u,p,!0,g)),A}function Yu(i,e,r,s,l){const u=[];for(let p=0;p<i.length;p++){const f=i[p];let g;for(let x=0;x<f.length-1;x++){let w=f[x],T=f[x+1];w.x<e&&T.x<e||(w.x<e?w=new it(e,w.y+(e-w.x)/(T.x-w.x)*(T.y-w.y))._round():T.x<e&&(T=new it(e,w.y+(e-w.x)/(T.x-w.x)*(T.y-w.y))._round()),w.y<r&&T.y<r||(w.y<r?w=new it(w.x+(r-w.y)/(T.y-w.y)*(T.x-w.x),r)._round():T.y<r&&(T=new it(w.x+(r-w.y)/(T.y-w.y)*(T.x-w.x),r)._round()),w.x>=s&&T.x>=s||(w.x>=s?w=new it(s,w.y+(s-w.x)/(T.x-w.x)*(T.y-w.y))._round():T.x>=s&&(T=new it(s,w.y+(s-w.x)/(T.x-w.x)*(T.y-w.y))._round()),w.y>=l&&T.y>=l||(w.y>=l?w=new it(w.x+(l-w.y)/(T.y-w.y)*(T.x-w.x),l)._round():T.y>=l&&(T=new it(w.x+(l-w.y)/(T.y-w.y)*(T.x-w.x),l)._round()),g&&w.equals(g[g.length-1])||(g=[w],u.push(g)),g.push(T)))))}}return u}function Qu(i,e,r,s){const l=[],u=i.image,p=u.pixelRatio,f=u.paddedRect.w-2,g=u.paddedRect.h-2,x=i.right-i.left,w=i.bottom-i.top,T=u.stretchX||[[0,f]],C=u.stretchY||[[0,g]],A=(ze,Ve)=>ze+Ve[1]-Ve[0],P=T.reduce(A,0),F=C.reduce(A,0),O=f-P,q=g-F;let Y=0,$=P,J=0,de=F,ue=0,Ne=O,qe=0,Ue=q;if(u.content&&s){const ze=u.content;Y=El(T,0,ze[0]),J=El(C,0,ze[1]),$=El(T,ze[0],ze[2]),de=El(C,ze[1],ze[3]),ue=ze[0]-Y,qe=ze[1]-J,Ne=ze[2]-ze[0]-$,Ue=ze[3]-ze[1]-de}const Re=(ze,Ve,Be,Ee)=>{const Ke=Il(ze.stretch-Y,$,x,i.left),Xe=Al(ze.fixed-ue,Ne,ze.stretch,P),ct=Il(Ve.stretch-J,de,w,i.top),qt=Al(Ve.fixed-qe,Ue,Ve.stretch,F),Xt=Il(Be.stretch-Y,$,x,i.left),li=Al(Be.fixed-ue,Ne,Be.stretch,P),mr=Il(Ee.stretch-J,de,w,i.top),gi=Al(Ee.fixed-qe,Ue,Ee.stretch,F),ni=new it(Ke,ct),ui=new it(Xt,ct),_i=new it(Xt,mr),Mi=new it(Ke,mr),ji=new it(Xe/p,qt/p),si=new it(li/p,gi/p),yi=e*Math.PI/180;if(yi){const qi=Math.sin(yi),Zi=Math.cos(yi),Jt=[Zi,-qi,qi,Zi];ni._matMult(Jt),ui._matMult(Jt),Mi._matMult(Jt),_i._matMult(Jt)}const Pi=ze.stretch+ze.fixed,Fi=Ve.stretch+Ve.fixed;return{tl:ni,tr:ui,bl:Mi,br:_i,tex:{x:u.paddedRect.x+1+Pi,y:u.paddedRect.y+1+Fi,w:Be.stretch+Be.fixed-Pi,h:Ee.stretch+Ee.fixed-Fi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:ji,pixelOffsetBR:si,minFontScaleX:Ne/p/x,minFontScaleY:Ue/p/w,isSDF:r}};if(s&&(u.stretchX||u.stretchY)){const ze=ed(T,O,P),Ve=ed(C,q,F);for(let Be=0;Be<ze.length-1;Be++){const Ee=ze[Be],Ke=ze[Be+1];for(let Xe=0;Xe<Ve.length-1;Xe++)l.push(Re(Ee,Ve[Xe],Ke,Ve[Xe+1]))}}else l.push(Re({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:f+1},{fixed:0,stretch:g+1}));return l}function El(i,e,r){let s=0;for(const l of i)s+=Math.max(e,Math.min(r,l[1]))-Math.max(e,Math.min(r,l[0]));return s}function ed(i,e,r){const s=[{fixed:-1,stretch:0}];for(const[l,u]of i){const p=s[s.length-1];s.push({fixed:l-p.stretch,stretch:p.stretch}),s.push({fixed:l-p.stretch,stretch:p.stretch+(u-l)})}return s.push({fixed:e+1,stretch:r}),s}function Il(i,e,r,s){return i/e*r+s}function Al(i,e,r,s){return i-e*r/s}$e("Anchor",Fn);class Cl{constructor(e,r,s,l,u,p,f,g,x,w){if(this.boxStartIndex=e.length,x){let T=p.top,C=p.bottom;const A=p.collisionPadding;A&&(T-=A[1],C+=A[3]);let P=C-T;P>0&&(P=Math.max(10,P),this.circleDiameter=P)}else{let T=p.top*f-g[0],C=p.bottom*f+g[2],A=p.left*f-g[3],P=p.right*f+g[1];const F=p.collisionPadding;if(F&&(A-=F[0]*f,T-=F[1]*f,P+=F[2]*f,C+=F[3]*f),w){const O=new it(A,T),q=new it(P,T),Y=new it(A,C),$=new it(P,C),J=w*Math.PI/180;O._rotate(J),q._rotate(J),Y._rotate(J),$._rotate(J),A=Math.min(O.x,q.x,Y.x,$.x),P=Math.max(O.x,q.x,Y.x,$.x),T=Math.min(O.y,q.y,Y.y,$.y),C=Math.max(O.y,q.y,Y.y,$.y)}e.emplaceBack(r.x,r.y,A,T,P,C,s,l,u)}this.boxEndIndex=e.length}}class $f{constructor(e=[],r=Gf){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:s}=this,l=r[e];for(;e>0;){const u=e-1>>1,p=r[u];if(s(l,p)>=0)break;r[e]=p,e=u}r[e]=l}_down(e){const{data:r,compare:s}=this,l=this.length>>1,u=r[e];for(;e<l;){let p=1+(e<<1),f=r[p];const g=p+1;if(g<this.length&&s(r[g],f)<0&&(p=g,f=r[g]),s(f,u)>=0)break;r[e]=f,e=p}r[e]=u}}function Gf(i,e){return i<e?-1:i>e?1:0}function jf(i,e=1,r=!1){let s=1/0,l=1/0,u=-1/0,p=-1/0;const f=i[0];for(let A=0;A<f.length;A++){const P=f[A];(!A||P.x<s)&&(s=P.x),(!A||P.y<l)&&(l=P.y),(!A||P.x>u)&&(u=P.x),(!A||P.y>p)&&(p=P.y)}const g=Math.min(u-s,p-l);let x=g/2;const w=new $f([],qf);if(g===0)return new it(s,l);for(let A=s;A<u;A+=g)for(let P=l;P<p;P+=g)w.push(new ra(A+x,P+x,x,i));let T=function(A){let P=0,F=0,O=0;const q=A[0];for(let Y=0,$=q.length,J=$-1;Y<$;J=Y++){const de=q[Y],ue=q[J],Ne=de.x*ue.y-ue.x*de.y;F+=(de.x+ue.x)*Ne,O+=(de.y+ue.y)*Ne,P+=3*Ne}return new ra(F/P,O/P,0,A)}(i),C=w.length;for(;w.length;){const A=w.pop();(A.d>T.d||!T.d)&&(T=A,r&&console.log("found best %d after %d probes",Math.round(1e4*A.d)/1e4,C)),A.max-T.d<=e||(x=A.h/2,w.push(new ra(A.p.x-x,A.p.y-x,x,i)),w.push(new ra(A.p.x+x,A.p.y-x,x,i)),w.push(new ra(A.p.x-x,A.p.y+x,x,i)),w.push(new ra(A.p.x+x,A.p.y+x,x,i)),C+=4)}return r&&(console.log(`num probes: ${C}`),console.log(`best distance: ${T.d}`)),T.p}function qf(i,e){return e.max-i.max}function ra(i,e,r,s){this.p=new it(i,e),this.h=r,this.d=function(l,u){let p=!1,f=1/0;for(let g=0;g<u.length;g++){const x=u[g];for(let w=0,T=x.length,C=T-1;w<T;C=w++){const A=x[w],P=x[C];A.y>l.y!=P.y>l.y&&l.x<(P.x-A.x)*(l.y-A.y)/(P.y-A.y)+A.x&&(p=!p),f=Math.min(f,cu(l,A,P))}}return(p?1:-1)*Math.sqrt(f)}(this.p,s),this.max=this.d+this.h*Math.SQRT2}const Fc=Number.POSITIVE_INFINITY;function td(i,e){return e[1]!==Fc?function(r,s,l){let u=0,p=0;switch(s=Math.abs(s),l=Math.abs(l),r){case"top-right":case"top-left":case"top":p=l-7;break;case"bottom-right":case"bottom-left":case"bottom":p=7-l}switch(r){case"top-right":case"bottom-right":case"right":u=-s;break;case"top-left":case"bottom-left":case"left":u=s}return[u,p]}(i,e[0],e[1]):function(r,s){let l=0,u=0;s<0&&(s=0);const p=s/Math.sqrt(2);switch(r){case"top-right":case"top-left":u=p-7;break;case"bottom-right":case"bottom-left":u=7-p;break;case"bottom":u=7-s;break;case"top":u=s-7}switch(r){case"top-right":case"bottom-right":l=-p;break;case"top-left":case"bottom-left":l=p;break;case"left":l=s;break;case"right":l=-s}return[l,u]}(i,e[0])}function Oc(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Zf(i,e,r,s,l,u,p,f,g,x,w){let T=u.textMaxSize.evaluate(e,{});T===void 0&&(T=p);const C=i.layers[0].layout,A=C.get("icon-offset").evaluate(e,{},w),P=rd(r.horizontal),F=p/24,O=i.tilePixelRatio*F,q=i.tilePixelRatio*T/24,Y=i.tilePixelRatio*f,$=i.tilePixelRatio*C.get("symbol-spacing"),J=C.get("text-padding")*i.tilePixelRatio,de=function(Ee,Ke,Xe,ct=1){const qt=Ee.get("icon-padding").evaluate(Ke,{},Xe),Xt=qt&&qt.values;return[Xt[0]*ct,Xt[1]*ct,Xt[2]*ct,Xt[3]*ct]}(C,e,w,i.tilePixelRatio),ue=C.get("text-max-angle")/180*Math.PI,Ne=C.get("text-rotation-alignment")!=="viewport"&&C.get("symbol-placement")!=="point",qe=C.get("icon-rotation-alignment")==="map"&&C.get("symbol-placement")!=="point",Ue=C.get("symbol-placement"),Re=$/2,ze=C.get("icon-text-fit");let Ve;s&&ze!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Ve=qu(s,r.vertical,ze,C.get("icon-text-fit-padding"),A,F)),P&&(s=qu(s,P,ze,C.get("icon-text-fit-padding"),A,F)));const Be=(Ee,Ke)=>{Ke.x<0||Ke.x>=oi||Ke.y<0||Ke.y>=oi||function(Xe,ct,qt,Xt,li,mr,gi,ni,ui,_i,Mi,ji,si,yi,Pi,Fi,qi,Zi,Jt,xi,ht,ir,vi,ki,xr){const Pr=Xe.addToLineVertexArray(ct,qt);let kr,nn,vr,fr,Xi=0,sn=0,fo=0,bd=0,Jc=-1,Yc=-1;const an={};let wd=Ci(""),Qc=0,eh=0;if(ni._unevaluatedLayout.getValue("text-radial-offset")===void 0?[Qc,eh]=ni.layout.get("text-offset").evaluate(ht,{},ki).map(Wi=>Wi*pi):(Qc=ni.layout.get("text-radial-offset").evaluate(ht,{},ki)*pi,eh=Fc),Xe.allowVerticalPlacement&&Xt.vertical){const Wi=ni.layout.get("text-rotate").evaluate(ht,{},ki)+90;vr=new Cl(ui,ct,_i,Mi,ji,Xt.vertical,si,yi,Pi,Wi),gi&&(fr=new Cl(ui,ct,_i,Mi,ji,gi,qi,Zi,Pi,Wi))}if(li){const Wi=ni.layout.get("icon-rotate").evaluate(ht,{}),jr=ni.layout.get("icon-text-fit")!=="none",go=Qu(li,Wi,vi,jr),_o=gi?Qu(gi,Wi,vi,jr):void 0;nn=new Cl(ui,ct,_i,Mi,ji,li,qi,Zi,!1,Wi),Xi=4*go.length;const Ed=Xe.iconSizeData;let bs=null;Ed.kind==="source"?(bs=[rn*ni.layout.get("icon-size").evaluate(ht,{})],bs[0]>On&&Qt(`${Xe.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Ed.kind==="composite"&&(bs=[rn*ir.compositeIconSizes[0].evaluate(ht,{},ki),rn*ir.compositeIconSizes[1].evaluate(ht,{},ki)],(bs[0]>On||bs[1]>On)&&Qt(`${Xe.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),Xe.addSymbols(Xe.icon,go,bs,xi,Jt,ht,c.WritingMode.none,ct,Pr.lineStartIndex,Pr.lineLength,-1,ki),Jc=Xe.icon.placedSymbolArray.length-1,_o&&(sn=4*_o.length,Xe.addSymbols(Xe.icon,_o,bs,xi,Jt,ht,c.WritingMode.vertical,ct,Pr.lineStartIndex,Pr.lineLength,-1,ki),Yc=Xe.icon.placedSymbolArray.length-1)}const Td=Object.keys(Xt.horizontal);for(const Wi of Td){const jr=Xt.horizontal[Wi];if(!kr){wd=Ci(jr.text);const _o=ni.layout.get("text-rotate").evaluate(ht,{},ki);kr=new Cl(ui,ct,_i,Mi,ji,jr,si,yi,Pi,_o)}const go=jr.positionedLines.length===1;if(fo+=id(Xe,ct,jr,mr,ni,Pi,ht,Fi,Pr,Xt.vertical?c.WritingMode.horizontal:c.WritingMode.horizontalOnly,go?Td:[Wi],an,Jc,ir,ki),go)break}Xt.vertical&&(bd+=id(Xe,ct,Xt.vertical,mr,ni,Pi,ht,Fi,Pr,c.WritingMode.vertical,["vertical"],an,Yc,ir,ki));const og=kr?kr.boxStartIndex:Xe.collisionBoxArray.length,lg=kr?kr.boxEndIndex:Xe.collisionBoxArray.length,cg=vr?vr.boxStartIndex:Xe.collisionBoxArray.length,hg=vr?vr.boxEndIndex:Xe.collisionBoxArray.length,ug=nn?nn.boxStartIndex:Xe.collisionBoxArray.length,dg=nn?nn.boxEndIndex:Xe.collisionBoxArray.length,pg=fr?fr.boxStartIndex:Xe.collisionBoxArray.length,mg=fr?fr.boxEndIndex:Xe.collisionBoxArray.length;let zr=-1;const Ll=(Wi,jr)=>Wi&&Wi.circleDiameter?Math.max(Wi.circleDiameter,jr):jr;zr=Ll(kr,zr),zr=Ll(vr,zr),zr=Ll(nn,zr),zr=Ll(fr,zr);const Sd=zr>-1?1:0;Sd&&(zr*=xr/pi),Xe.glyphOffsetArray.length>=na.MAX_GLYPHS&&Qt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),ht.sortKey!==void 0&&Xe.addToSortKeyRanges(Xe.symbolInstances.length,ht.sortKey),Xe.symbolInstances.emplaceBack(ct.x,ct.y,an.right>=0?an.right:-1,an.center>=0?an.center:-1,an.left>=0?an.left:-1,an.vertical||-1,Jc,Yc,wd,og,lg,cg,hg,ug,dg,pg,mg,_i,fo,bd,Xi,sn,Sd,0,si,Qc,eh,zr)}(i,Ke,Ee,r,s,l,Ve,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,O,[J,J,J,J],Ne,g,Y,de,qe,A,e,u,x,w,p)};if(Ue==="line")for(const Ee of Yu(e.geometry,0,0,oi,oi)){const Ke=Nf(Ee,$,ue,r.vertical||P,s,24,q,i.overscaling,oi);for(const Xe of Ke)P&&Xf(i,P.text,Re,Xe)||Be(Ee,Xe)}else if(Ue==="line-center"){for(const Ee of e.geometry)if(Ee.length>1){const Ke=Vf(Ee,ue,r.vertical||P,s,24,q);Ke&&Be(Ee,Ke)}}else if(e.type==="Polygon")for(const Ee of Ec(e.geometry,0)){const Ke=jf(Ee,16);Be(Ee[0],new Fn(Ke.x,Ke.y,0))}else if(e.type==="LineString")for(const Ee of e.geometry)Be(Ee,new Fn(Ee[0].x,Ee[0].y,0));else if(e.type==="Point")for(const Ee of e.geometry)for(const Ke of Ee)Be([Ke],new Fn(Ke.x,Ke.y,0))}const On=32640;function id(i,e,r,s,l,u,p,f,g,x,w,T,C,A,P){const F=function(Y,$,J,de,ue,Ne,qe,Ue){const Re=de.layout.get("text-rotate").evaluate(Ne,{})*Math.PI/180,ze=[];for(const Ve of $.positionedLines)for(const Be of Ve.positionedGlyphs){if(!Be.rect)continue;const Ee=Be.rect||{};let Ke=4,Xe=!0,ct=1,qt=0;const Xt=(ue||Ue)&&Be.vertical,li=Be.metrics.advance*Be.scale/2;if(Ue&&$.verticalizable&&(qt=Ve.lineOffset/2-(Be.imageName?-(pi-Be.metrics.width*Be.scale)/2:(Be.scale-1)*pi)),Be.imageName){const Jt=qe[Be.imageName];Xe=Jt.sdf,ct=Jt.pixelRatio,Ke=1/ct}const mr=ue?[Be.x+li,Be.y]:[0,0];let gi=ue?[0,0]:[Be.x+li+J[0],Be.y+J[1]-qt],ni=[0,0];Xt&&(ni=gi,gi=[0,0]);const ui=(Be.metrics.left-Ke)*Be.scale-li+gi[0],_i=(-Be.metrics.top-Ke)*Be.scale+gi[1],Mi=ui+Ee.w*Be.scale/ct,ji=_i+Ee.h*Be.scale/ct,si=new it(ui,_i),yi=new it(Mi,_i),Pi=new it(ui,ji),Fi=new it(Mi,ji);if(Xt){const Jt=new it(-li,li-wl),xi=-Math.PI/2,ht=12-li,ir=new it(22-ht,-(Be.imageName?ht:0)),vi=new it(...ni);si._rotateAround(xi,Jt)._add(ir)._add(vi),yi._rotateAround(xi,Jt)._add(ir)._add(vi),Pi._rotateAround(xi,Jt)._add(ir)._add(vi),Fi._rotateAround(xi,Jt)._add(ir)._add(vi)}if(Re){const Jt=Math.sin(Re),xi=Math.cos(Re),ht=[xi,-Jt,Jt,xi];si._matMult(ht),yi._matMult(ht),Pi._matMult(ht),Fi._matMult(ht)}const qi=new it(0,0),Zi=new it(0,0);ze.push({tl:si,tr:yi,bl:Pi,br:Fi,tex:Ee,writingMode:$.writingMode,glyphOffset:mr,sectionIndex:Be.sectionIndex,isSDF:Xe,pixelOffsetTL:qi,pixelOffsetBR:Zi,minFontScaleX:0,minFontScaleY:0})}return ze}(0,r,f,l,u,p,s,i.allowVerticalPlacement),O=i.textSizeData;let q=null;O.kind==="source"?(q=[rn*l.layout.get("text-size").evaluate(p,{})],q[0]>On&&Qt(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):O.kind==="composite"&&(q=[rn*A.compositeTextSizes[0].evaluate(p,{},P),rn*A.compositeTextSizes[1].evaluate(p,{},P)],(q[0]>On||q[1]>On)&&Qt(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),i.addSymbols(i.text,F,q,f,u,p,x,e,g.lineStartIndex,g.lineLength,C,P);for(const Y of w)T[Y]=i.text.placedSymbolArray.length-1;return 4*F.length}function rd(i){for(const e in i)return i[e];return null}function Xf(i,e,r,s){const l=i.compareText;if(e in l){const u=l[e];for(let p=u.length-1;p>=0;p--)if(s.dist(u[p])<r)return!0}else l[e]=[];return l[e].push(s),!1}const Wf=Rn.VectorTileFeature.types,Hf=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Ml(i,e,r,s,l,u,p,f,g,x,w,T,C){const A=f?Math.min(On,Math.round(f[0])):0,P=f?Math.min(On,Math.round(f[1])):0;i.emplaceBack(e,r,Math.round(32*s),Math.round(32*l),u,p,(A<<1)+(g?1:0),P,16*x,16*w,256*T,256*C)}function Uc(i,e,r){i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r)}function Kf(i){for(const e of i.sections)if(uc(e.text))return!0;return!1}class Vc{constructor(e){this.layoutVertexArray=new He,this.indexArray=new wt,this.programConfigurations=e,this.segments=new $t,this.dynamicLayoutVertexArray=new Pt,this.opacityVertexArray=new St,this.hasVisibleVertices=!1,this.placedSymbolArray=new X}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,s,l){this.isEmpty()||(s&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,xf.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,vf.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Hf,!0),this.opacityVertexBuffer.itemSize=1),(s||l)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}$e("SymbolBuffers",Vc);class Nc{constructor(e,r,s){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new s,this.segments=new $t,this.collisionVertexArray=new xt}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,bf.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}$e("CollisionBuffers",Nc);class na{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(p=>p.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=yc([]),this.placementViewportMatrix=yc([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Zu(this.zoom,r["text-size"]),this.iconSizeData=Zu(this.zoom,r["icon-size"]);const s=this.layers[0].layout,l=s.get("symbol-sort-key"),u=s.get("symbol-z-order");this.canOverlap=Gc(s,"text-overlap","text-allow-overlap")!=="never"||Gc(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=u!=="viewport-y"&&!l.isConstant(),this.sortFeaturesByY=(u==="viewport-y"||u==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,s.get("symbol-placement")==="point"&&(this.writingModes=s.get("text-writing-mode").map(p=>c.WritingMode[p])),this.stateDependentLayerIds=this.layers.filter(p=>p.isStateDependent()).map(p=>p.id),this.sourceID=e.sourceID}createArrays(){this.text=new Vc(new _s(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Vc(new _s(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new W,this.lineVertexArray=new te,this.symbolInstances=new U}calculateGlyphDependencies(e,r,s,l,u){for(let p=0;p<e.length;p++)if(r[e.charCodeAt(p)]=!0,(s||l)&&u){const f=co[e.charAt(p)];f&&(r[f.charCodeAt(0)]=!0)}}populate(e,r,s){const l=this.layers[0],u=l.layout,p=u.get("text-font"),f=u.get("text-field"),g=u.get("icon-image"),x=(f.value.kind!=="constant"||f.value.value instanceof De&&!f.value.value.isEmpty()||f.value.value.toString().length>0)&&(p.value.kind!=="constant"||p.value.value.length>0),w=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,T=u.get("symbol-sort-key");if(this.features=[],!x&&!w)return;const C=r.iconDependencies,A=r.glyphDependencies,P=r.availableImages,F=new Nt(this.zoom);for(const{feature:O,id:q,index:Y,sourceLayerIndex:$}of e){const J=l._featureFilter.needGeometry,de=xs(O,J);if(!l._featureFilter.filter(F,de,s))continue;let ue,Ne;if(J||(de.geometry=ys(O)),x){const Ue=l.getValueAndResolveTokens("text-field",de,s,P),Re=De.factory(Ue);Kf(Re)&&(this.hasRTLText=!0),(!this.hasRTLText||Za()==="unavailable"||this.hasRTLText&&Gi.isParsed())&&(ue=Tf(Re,l,de))}if(w){const Ue=l.getValueAndResolveTokens("icon-image",de,s,P);Ne=Ue instanceof yt?Ue:yt.fromString(Ue)}if(!ue&&!Ne)continue;const qe=this.sortFeaturesByKey?T.evaluate(de,{},s):void 0;if(this.features.push({id:q,text:ue,icon:Ne,index:Y,sourceLayerIndex:$,geometry:de.geometry,properties:O.properties,type:Wf[O.type],sortKey:qe}),Ne&&(C[Ne.name]=!0),ue){const Ue=p.evaluate(de,{},s).join(","),Re=u.get("text-rotation-alignment")!=="viewport"&&u.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(c.WritingMode.vertical)>=0;for(const ze of ue.sections)if(ze.image)C[ze.image.name]=!0;else{const Ve=hs(ue.toString()),Be=ze.fontStack||Ue,Ee=A[Be]=A[Be]||{};this.calculateGlyphDependencies(ze.text,Ee,Re,this.allowVerticalPlacement,Ve)}}}u.get("symbol-placement")==="line"&&(this.features=function(O){const q={},Y={},$=[];let J=0;function de(Ue){$.push(O[Ue]),J++}function ue(Ue,Re,ze){const Ve=Y[Ue];return delete Y[Ue],Y[Re]=Ve,$[Ve].geometry[0].pop(),$[Ve].geometry[0]=$[Ve].geometry[0].concat(ze[0]),Ve}function Ne(Ue,Re,ze){const Ve=q[Re];return delete q[Re],q[Ue]=Ve,$[Ve].geometry[0].shift(),$[Ve].geometry[0]=ze[0].concat($[Ve].geometry[0]),Ve}function qe(Ue,Re,ze){const Ve=ze?Re[0][Re[0].length-1]:Re[0][0];return`${Ue}:${Ve.x}:${Ve.y}`}for(let Ue=0;Ue<O.length;Ue++){const Re=O[Ue],ze=Re.geometry,Ve=Re.text?Re.text.toString():null;if(!Ve){de(Ue);continue}const Be=qe(Ve,ze),Ee=qe(Ve,ze,!0);if(Be in Y&&Ee in q&&Y[Be]!==q[Ee]){const Ke=Ne(Be,Ee,ze),Xe=ue(Be,Ee,$[Ke].geometry);delete q[Be],delete Y[Ee],Y[qe(Ve,$[Xe].geometry,!0)]=Xe,$[Ke].geometry=null}else Be in Y?ue(Be,Ee,ze):Ee in q?Ne(Be,Ee,ze):(de(Ue),q[Be]=J-1,Y[Ee]=J-1)}return $.filter(Ue=>Ue.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((O,q)=>O.sortKey-q.sortKey)}update(e,r,s){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,s),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,s))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,r){const s=this.lineVertexArray.length;if(e.segment!==void 0){let l=e.dist(r[e.segment+1]),u=e.dist(r[e.segment]);const p={};for(let f=e.segment+1;f<r.length;f++)p[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:l},f<r.length-1&&(l+=r[f+1].dist(r[f]));for(let f=e.segment||0;f>=0;f--)p[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:u},f>0&&(u+=r[f-1].dist(r[f]));for(let f=0;f<r.length;f++){const g=p[f];this.lineVertexArray.emplaceBack(g.x,g.y,g.tileUnitDistanceFromAnchor)}}return{lineStartIndex:s,lineLength:this.lineVertexArray.length-s}}addSymbols(e,r,s,l,u,p,f,g,x,w,T,C){const A=e.indexArray,P=e.layoutVertexArray,F=e.segments.prepareSegment(4*r.length,P,A,this.canOverlap?p.sortKey:void 0),O=this.glyphOffsetArray.length,q=F.vertexLength,Y=this.allowVerticalPlacement&&f===c.WritingMode.vertical?Math.PI/2:0,$=p.text&&p.text.sections;for(let J=0;J<r.length;J++){const{tl:de,tr:ue,bl:Ne,br:qe,tex:Ue,pixelOffsetTL:Re,pixelOffsetBR:ze,minFontScaleX:Ve,minFontScaleY:Be,glyphOffset:Ee,isSDF:Ke,sectionIndex:Xe}=r[J],ct=F.vertexLength,qt=Ee[1];Ml(P,g.x,g.y,de.x,qt+de.y,Ue.x,Ue.y,s,Ke,Re.x,Re.y,Ve,Be),Ml(P,g.x,g.y,ue.x,qt+ue.y,Ue.x+Ue.w,Ue.y,s,Ke,ze.x,Re.y,Ve,Be),Ml(P,g.x,g.y,Ne.x,qt+Ne.y,Ue.x,Ue.y+Ue.h,s,Ke,Re.x,ze.y,Ve,Be),Ml(P,g.x,g.y,qe.x,qt+qe.y,Ue.x+Ue.w,Ue.y+Ue.h,s,Ke,ze.x,ze.y,Ve,Be),Uc(e.dynamicLayoutVertexArray,g,Y),A.emplaceBack(ct,ct+1,ct+2),A.emplaceBack(ct+1,ct+2,ct+3),F.vertexLength+=4,F.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Ee[0]),J!==r.length-1&&Xe===r[J+1].sectionIndex||e.programConfigurations.populatePaintArrays(P.length,p,p.index,{},C,$&&$[Xe])}e.placedSymbolArray.emplaceBack(g.x,g.y,O,this.glyphOffsetArray.length-O,q,x,w,g.segment,s?s[0]:0,s?s[1]:0,l[0],l[1],f,0,!1,0,T)}_addCollisionDebugVertex(e,r,s,l,u,p){return r.emplaceBack(0,0),e.emplaceBack(s.x,s.y,l,u,Math.round(p.x),Math.round(p.y))}addCollisionDebugVertices(e,r,s,l,u,p,f){const g=u.segments.prepareSegment(4,u.layoutVertexArray,u.indexArray),x=g.vertexLength,w=u.layoutVertexArray,T=u.collisionVertexArray,C=f.anchorX,A=f.anchorY;this._addCollisionDebugVertex(w,T,p,C,A,new it(e,r)),this._addCollisionDebugVertex(w,T,p,C,A,new it(s,r)),this._addCollisionDebugVertex(w,T,p,C,A,new it(s,l)),this._addCollisionDebugVertex(w,T,p,C,A,new it(e,l)),g.vertexLength+=4;const P=u.indexArray;P.emplaceBack(x,x+1),P.emplaceBack(x+1,x+2),P.emplaceBack(x+2,x+3),P.emplaceBack(x+3,x),g.primitiveLength+=4}addDebugCollisionBoxes(e,r,s,l){for(let u=e;u<r;u++){const p=this.collisionBoxArray.get(u);this.addCollisionDebugVertices(p.x1,p.y1,p.x2,p.y2,l?this.textCollisionBox:this.iconCollisionBox,p.anchorPoint,s)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Nc(ft,zu.members,Ii),this.iconCollisionBox=new Nc(ft,zu.members,Ii);for(let e=0;e<this.symbolInstances.length;e++){const r=this.symbolInstances.get(e);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(e,r,s,l,u,p,f,g,x){const w={};for(let T=r;T<s;T++){const C=e.get(T);w.textBox={x1:C.x1,y1:C.y1,x2:C.x2,y2:C.y2,anchorPointX:C.anchorPointX,anchorPointY:C.anchorPointY},w.textFeatureIndex=C.featureIndex;break}for(let T=l;T<u;T++){const C=e.get(T);w.verticalTextBox={x1:C.x1,y1:C.y1,x2:C.x2,y2:C.y2,anchorPointX:C.anchorPointX,anchorPointY:C.anchorPointY},w.verticalTextFeatureIndex=C.featureIndex;break}for(let T=p;T<f;T++){const C=e.get(T);w.iconBox={x1:C.x1,y1:C.y1,x2:C.x2,y2:C.y2,anchorPointX:C.anchorPointX,anchorPointY:C.anchorPointY},w.iconFeatureIndex=C.featureIndex;break}for(let T=g;T<x;T++){const C=e.get(T);w.verticalIconBox={x1:C.x1,y1:C.y1,x2:C.x2,y2:C.y2,anchorPointX:C.anchorPointX,anchorPointY:C.anchorPointY},w.verticalIconFeatureIndex=C.featureIndex;break}return w}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const s=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,s.textBoxStartIndex,s.textBoxEndIndex,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s.iconBoxStartIndex,s.iconBoxEndIndex,s.verticalIconBoxStartIndex,s.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,r){const s=e.placedSymbolArray.get(r),l=s.vertexStartIndex+4*s.numGlyphs;for(let u=s.vertexStartIndex;u<l;u+=4)e.indexArray.emplaceBack(u,u+1,u+2),e.indexArray.emplaceBack(u+1,u+2,u+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(e),s=Math.cos(e),l=[],u=[],p=[];for(let f=0;f<this.symbolInstances.length;++f){p.push(f);const g=this.symbolInstances.get(f);l.push(0|Math.round(r*g.anchorX+s*g.anchorY)),u.push(g.featureIndex)}return p.sort((f,g)=>l[f]-l[g]||u[g]-u[f]),p}addToSortKeyRanges(e,r){const s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===r?s.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const s=this.symbolInstances.get(r);this.featureSortOrder.push(s.featureIndex),[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex].forEach((l,u,p)=>{l>=0&&p.indexOf(l)===u&&this.addIndicesForPlacedSymbol(this.text,l)}),s.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,s.verticalPlacedTextSymbolIndex),s.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.placedIconSymbolIndex),s.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}$e("SymbolBucket",na,{omit:["layers","collisionBoxArray","features","compareText"]}),na.MAX_GLYPHS=65535,na.addDynamicAttributes=Uc;const Jf=new Ei({"symbol-placement":new We(V.layout_symbol["symbol-placement"]),"symbol-spacing":new We(V.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new We(V.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Qe(V.layout_symbol["symbol-sort-key"]),"symbol-z-order":new We(V.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new We(V.layout_symbol["icon-allow-overlap"]),"icon-overlap":new We(V.layout_symbol["icon-overlap"]),"icon-ignore-placement":new We(V.layout_symbol["icon-ignore-placement"]),"icon-optional":new We(V.layout_symbol["icon-optional"]),"icon-rotation-alignment":new We(V.layout_symbol["icon-rotation-alignment"]),"icon-size":new Qe(V.layout_symbol["icon-size"]),"icon-text-fit":new We(V.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new We(V.layout_symbol["icon-text-fit-padding"]),"icon-image":new Qe(V.layout_symbol["icon-image"]),"icon-rotate":new Qe(V.layout_symbol["icon-rotate"]),"icon-padding":new Qe(V.layout_symbol["icon-padding"]),"icon-keep-upright":new We(V.layout_symbol["icon-keep-upright"]),"icon-offset":new Qe(V.layout_symbol["icon-offset"]),"icon-anchor":new Qe(V.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new We(V.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new We(V.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new We(V.layout_symbol["text-rotation-alignment"]),"text-field":new Qe(V.layout_symbol["text-field"]),"text-font":new Qe(V.layout_symbol["text-font"]),"text-size":new Qe(V.layout_symbol["text-size"]),"text-max-width":new Qe(V.layout_symbol["text-max-width"]),"text-line-height":new We(V.layout_symbol["text-line-height"]),"text-letter-spacing":new Qe(V.layout_symbol["text-letter-spacing"]),"text-justify":new Qe(V.layout_symbol["text-justify"]),"text-radial-offset":new Qe(V.layout_symbol["text-radial-offset"]),"text-variable-anchor":new We(V.layout_symbol["text-variable-anchor"]),"text-anchor":new Qe(V.layout_symbol["text-anchor"]),"text-max-angle":new We(V.layout_symbol["text-max-angle"]),"text-writing-mode":new We(V.layout_symbol["text-writing-mode"]),"text-rotate":new Qe(V.layout_symbol["text-rotate"]),"text-padding":new We(V.layout_symbol["text-padding"]),"text-keep-upright":new We(V.layout_symbol["text-keep-upright"]),"text-transform":new Qe(V.layout_symbol["text-transform"]),"text-offset":new Qe(V.layout_symbol["text-offset"]),"text-allow-overlap":new We(V.layout_symbol["text-allow-overlap"]),"text-overlap":new We(V.layout_symbol["text-overlap"]),"text-ignore-placement":new We(V.layout_symbol["text-ignore-placement"]),"text-optional":new We(V.layout_symbol["text-optional"])});var $c={paint:new Ei({"icon-opacity":new Qe(V.paint_symbol["icon-opacity"]),"icon-color":new Qe(V.paint_symbol["icon-color"]),"icon-halo-color":new Qe(V.paint_symbol["icon-halo-color"]),"icon-halo-width":new Qe(V.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Qe(V.paint_symbol["icon-halo-blur"]),"icon-translate":new We(V.paint_symbol["icon-translate"]),"icon-translate-anchor":new We(V.paint_symbol["icon-translate-anchor"]),"text-opacity":new Qe(V.paint_symbol["text-opacity"]),"text-color":new Qe(V.paint_symbol["text-color"],{runtimeType:bt,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new Qe(V.paint_symbol["text-halo-color"]),"text-halo-width":new Qe(V.paint_symbol["text-halo-width"]),"text-halo-blur":new Qe(V.paint_symbol["text-halo-blur"]),"text-translate":new We(V.paint_symbol["text-translate"]),"text-translate-anchor":new We(V.paint_symbol["text-translate-anchor"])}),layout:Jf};class nd{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:_t,this.defaultValue=e}evaluate(e){if(e.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}$e("FormatSectionOverride",nd,{omit:["defaultValue"]});class Pl extends cr{constructor(e){super(e,$c)}recalculate(e,r){if(super.recalculate(e,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const s=this.layout.get("text-writing-mode");if(s){const l=[];for(const u of s)l.indexOf(u)<0&&l.push(u);this.layout._values["text-writing-mode"]=l}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,s,l){const u=this.layout.get(e).evaluate(r,{},s,l),p=this._unevaluatedLayout._values[e];return p.isDataDriven()||es(p.value)||!u?u:function(f,g){return g.replace(/{([^{}]+)}/g,(x,w)=>w in f?String(f[w]):"")}(r.properties,u)}createBucket(e){return new na(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of $c.paint.overridableProperties){if(!Pl.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),s=new nd(r),l=new Us(s,r.property.specification);let u=null;u=r.value.kind==="constant"||r.value.kind==="source"?new is("source",l):new La("composite",l,r.value.zoomStops),this.paint._values[e]=new Si(r.property,u,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,s){return!(!this.layout||r.isDataDriven()||s.isDataDriven())&&Pl.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const s=e.get("text-field"),l=$c.paint.properties[r];let u=!1;const p=f=>{for(const g of f)if(l.overrides&&l.overrides.hasOverride(g))return void(u=!0)};if(s.value.kind==="constant"&&s.value.value instanceof De)p(s.value.value.sections);else if(s.value.kind==="source"){const f=x=>{u||(x instanceof ci&&dt(x.value)===Wt?p(x.value.sections):x instanceof Fs?p(x.sections):x.eachChild(f))},g=s.value;g._styleExpression&&f(g._styleExpression.expression)}return u}}function Gc(i,e,r){let s="never";const l=i.get(e);return l?s=l:i.get(r)&&(s="always"),s}var Yf={paint:new Ei({"background-color":new We(V.paint_background["background-color"]),"background-pattern":new Wa(V.paint_background["background-pattern"]),"background-opacity":new We(V.paint_background["background-opacity"])})},Qf={paint:new Ei({"raster-opacity":new We(V.paint_raster["raster-opacity"]),"raster-hue-rotate":new We(V.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new We(V.paint_raster["raster-brightness-min"]),"raster-brightness-max":new We(V.paint_raster["raster-brightness-max"]),"raster-saturation":new We(V.paint_raster["raster-saturation"]),"raster-contrast":new We(V.paint_raster["raster-contrast"]),"raster-resampling":new We(V.paint_raster["raster-resampling"]),"raster-fade-duration":new We(V.paint_raster["raster-fade-duration"])})};class eg extends cr{constructor(e){super(e,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}const tg={circle:class extends cr{constructor(i){super(i,zm)}createBucket(i){return new fc(i)}queryRadius(i){const e=i;return eo("circle-radius",this,e)+eo("circle-stroke-width",this,e)+ml(this.paint.get("circle-translate"))}queryIntersectsFeature(i,e,r,s,l,u,p,f){const g=fl(i,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),u.angle,p),x=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),w=this.paint.get("circle-pitch-alignment")==="map",T=w?g:function(A,P){return A.map(F=>gu(F,P))}(g,f),C=w?x*p:x;for(const A of s)for(const P of A){const F=w?P:gu(P,f);let O=C;const q=gl([],[P.x,P.y,0,1],f);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?O*=q[3]/u.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(O*=u.cameraToCenterDistance/q[3]),Am(T,F,O))return!0}return!1}},heatmap:class extends cr{createBucket(i){return new _u(i)}constructor(i){super(i,Dm),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=xu({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}},hillshade:class extends cr{constructor(i){super(i,Rm)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends cr{constructor(i){super(i,Km)}recalculate(i,e){super.recalculate(i,e);const r=this.paint._values["fill-outline-color"];r.value.kind==="constant"&&r.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new Cc(i)}queryRadius(){return ml(this.paint.get("fill-translate"))}queryIntersectsFeature(i,e,r,s,l,u,p){return lu(fl(i,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),u.angle,p),s)}isTileClipped(){return!0}},"fill-extrusion":class extends cr{constructor(i){super(i,uf)}createBucket(i){return new Pc(i)}queryRadius(){return ml(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,e,r,s,l,u,p,f){const g=fl(i,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),u.angle,p),x=this.paint.get("fill-extrusion-height").evaluate(e,r),w=this.paint.get("fill-extrusion-base").evaluate(e,r),T=function(A,P,F,O){const q=[];for(const Y of A){const $=[Y.x,Y.y,0,1];gl($,$,P),q.push(new it($[0]/$[3],$[1]/$[3]))}return q}(g,f),C=function(A,P,F,O){const q=[],Y=[],$=O[8]*P,J=O[9]*P,de=O[10]*P,ue=O[11]*P,Ne=O[8]*F,qe=O[9]*F,Ue=O[10]*F,Re=O[11]*F;for(const ze of A){const Ve=[],Be=[];for(const Ee of ze){const Ke=Ee.x,Xe=Ee.y,ct=O[0]*Ke+O[4]*Xe+O[12],qt=O[1]*Ke+O[5]*Xe+O[13],Xt=O[2]*Ke+O[6]*Xe+O[14],li=O[3]*Ke+O[7]*Xe+O[15],mr=Xt+de,gi=li+ue,ni=ct+Ne,ui=qt+qe,_i=Xt+Ue,Mi=li+Re,ji=new it((ct+$)/gi,(qt+J)/gi);ji.z=mr/gi,Ve.push(ji);const si=new it(ni/Mi,ui/Mi);si.z=_i/Mi,Be.push(si)}q.push(Ve),Y.push(Be)}return[q,Y]}(s,w,x,f);return function(A,P,F){let O=1/0;lu(F,P)&&(O=Au(F,P[0]));for(let q=0;q<P.length;q++){const Y=P[q],$=A[q];for(let J=0;J<Y.length-1;J++){const de=Y[J],ue=[de,Y[J+1],$[J+1],$[J],de];ou(F,ue)&&(O=Math.min(O,Au(F,ue)))}}return O!==1/0&&O}(C[0],C[1],T)}},line:class extends cr{constructor(i){super(i,Mu),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(i){i==="line-gradient"&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof xn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(i,e){super.recalculate(i,e),this.paint._values["line-floorwidth"]=Pu.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new kc(i)}queryRadius(i){const e=i,r=ku(eo("line-width",this,e),eo("line-gap-width",this,e)),s=eo("line-offset",this,e);return r/2+Math.abs(s)+ml(this.paint.get("line-translate"))}queryIntersectsFeature(i,e,r,s,l,u,p){const f=fl(i,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),u.angle,p),g=p/2*ku(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),x=this.paint.get("line-offset").evaluate(e,r);return x&&(s=function(w,T){const C=[];for(let A=0;A<w.length;A++){const P=w[A],F=[];for(let O=0;O<P.length;O++){const q=P[O-1],Y=P[O],$=P[O+1],J=O===0?new it(0,0):Y.sub(q)._unit()._perp(),de=O===P.length-1?new it(0,0):$.sub(Y)._unit()._perp(),ue=J._add(de)._unit(),Ne=ue.x*de.x+ue.y*de.y;Ne!==0&&ue._mult(1/Ne),F.push(ue._mult(T)._add(Y))}C.push(F)}return C}(s,x*p)),function(w,T,C){for(let A=0;A<T.length;A++){const P=T[A];if(w.length>=3){for(let F=0;F<P.length;F++)if(Js(w,P[F]))return!0}if(Cm(w,P,C))return!0}return!1}(f,s,g)}isTileClipped(){return!0}},symbol:Pl,background:class extends cr{constructor(i){super(i,Yf)}},raster:class extends cr{constructor(i){super(i,Qf)}}};class ig{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const jc=63710088e-1;class Kt{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Kt(K(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const r=Math.PI/180,s=this.lat*r,l=e.lat*r,u=Math.sin(s)*Math.sin(l)+Math.cos(s)*Math.cos(l)*Math.cos((e.lng-this.lng)*r);return jc*Math.acos(Math.min(u,1))}toBounds(e=0){const r=360*e/40075017,s=r/Math.cos(Math.PI/180*this.lat);return new sd(new Kt(this.lng-s,this.lat-r),new Kt(this.lng+s,this.lat+r))}static convert(e){if(e instanceof Kt)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Kt(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Kt(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class sa{constructor(e,r){e&&(r?this.setSouthWest(e).setNorthEast(r):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 Kt?new Kt(e.lng,e.lat):Kt.convert(e),this}setSouthWest(e){return this._sw=e instanceof Kt?new Kt(e.lng,e.lat):Kt.convert(e),this}extend(e){const r=this._sw,s=this._ne;let l,u;if(e instanceof Kt)l=e,u=e;else{if(!(e instanceof sa))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(sa.convert(e)):this.extend(Kt.convert(e)):this;if(l=e._sw,u=e._ne,!l||!u)return this}return r||s?(r.lng=Math.min(l.lng,r.lng),r.lat=Math.min(l.lat,r.lat),s.lng=Math.max(u.lng,s.lng),s.lat=Math.max(u.lat,s.lat)):(this._sw=new Kt(l.lng,l.lat),this._ne=new Kt(u.lng,u.lat)),this}getCenter(){return new Kt((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 Kt(this.getWest(),this.getNorth())}getSouthEast(){return new Kt(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:r,lat:s}=Kt.convert(e);let l=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(l=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=s&&s<=this._ne.lat&&l}static convert(e){return e instanceof sa?e:e&&new sa(e)}}var sd=sa;const ad=2*Math.PI*jc;function od(i){return ad*Math.cos(i*Math.PI/180)}function ld(i){return(180+i)/360}function cd(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function hd(i,e){return i/od(e)}function qc(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class kl{constructor(e,r,s=0){this.x=+e,this.y=+r,this.z=+s}static fromLngLat(e,r=0){const s=Kt.convert(e);return new kl(ld(s.lng),cd(s.lat),hd(r,s.lat))}toLngLat(){return new Kt(360*this.x-180,qc(this.y))}toAltitude(){return this.z*od(qc(this.y))}meterInMercatorCoordinateUnits(){return 1/ad*(e=qc(this.y),1/Math.cos(e*Math.PI/180));var e}}var ud={};(function(i,e){(function(r){function s(u,p,f){var g=l(256*u,256*(p=Math.pow(2,f)-p-1),f),x=l(256*(u+1),256*(p+1),f);return g[0]+","+g[1]+","+x[0]+","+x[1]}function l(u,p,f){var g=2*Math.PI*6378137/256/Math.pow(2,f);return[u*g-2*Math.PI*6378137/2,p*g-2*Math.PI*6378137/2]}r.getURL=function(u,p,f,g,x,w){return w=w||{},u+"?"+["bbox="+s(f,g,x),"format="+(w.format||"image/png"),"service="+(w.service||"WMS"),"version="+(w.version||"1.1.1"),"request="+(w.request||"GetMap"),"srs="+(w.srs||"EPSG:3857"),"width="+(w.width||256),"height="+(w.height||256),"layers="+p].join("&")},r.getTileBBox=s,r.getMercCoords=l,Object.defineProperty(r,"__esModule",{value:!0})})(e)})(0,ud);class Zc{constructor(e,r,s){if(e<0||e>25||s<0||s>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error(`x=${r}, y=${s}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=r,this.y=s,this.key=uo(0,e,e,r,s)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,s){const l=ud.getTileBBox(this.x,this.y,this.z),u=function(p,f,g){let x,w="";for(let T=p;T>0;T--)x=1<<T-1,w+=(f&x?1:0)+(g&x?2:0);return w}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(s==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,u).replace(/{bbox-epsg-3857}/g,l)}isChildOf(e){const r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){const r=Math.pow(2,this.z);return new it((e.x*r-this.x)*oi,(e.y*r-this.y)*oi)}toString(){return`${this.z}/${this.x}/${this.y}`}}class dd{constructor(e,r){this.wrap=e,this.canonical=r,this.key=uo(e,r.z,r.z,r.x,r.y)}}class pr{constructor(e,r,s,l,u){if(e<s)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${s}`);this.overscaledZ=e,this.wrap=r,this.canonical=new Zc(s,+l,+u),this.key=uo(r,e,s,l,u)}clone(){return new pr(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-e;return e>this.canonical.z?new pr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new pr(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const s=this.canonical.z-e;return e>this.canonical.z?uo(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):uo(this.wrap*+r,e,e,this.canonical.x>>s,this.canonical.y>>s)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new pr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,s=2*this.canonical.x,l=2*this.canonical.y;return[new pr(r,this.wrap,r,s,l),new pr(r,this.wrap,r,s+1,l),new pr(r,this.wrap,r,s,l+1),new pr(r,this.wrap,r,s+1,l+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new pr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new pr(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new dd(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new kl(e.x-this.wrap,e.y))}}function uo(i,e,r,s,l){(i*=2)<0&&(i=-1*i-1);const u=1<<r;return(u*u*i+u*l+s).toString(36)+r.toString(36)+e.toString(36)}$e("CanonicalTileID",Zc),$e("OverscaledTileID",pr,{omit:["posMatrix"]});class pd{constructor(e,r,s){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(s&&s!=="mapbox"&&s!=="terrarium")return void Qt(`"${s}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=r.height;const l=this.dim=r.height-2;this.data=new Uint32Array(r.data.buffer),this.encoding=s||"mapbox";for(let u=0;u<l;u++)this.data[this._idx(-1,u)]=this.data[this._idx(0,u)],this.data[this._idx(l,u)]=this.data[this._idx(l-1,u)],this.data[this._idx(u,-1)]=this.data[this._idx(u,0)],this.data[this._idx(u,l)]=this.data[this._idx(u,l-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(l,-1)]=this.data[this._idx(l-1,0)],this.data[this._idx(-1,l)]=this.data[this._idx(0,l-1)],this.data[this._idx(l,l)]=this.data[this._idx(l-1,l-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let u=0;u<l;u++)for(let p=0;p<l;p++){const f=this.get(u,p);f>this.max&&(this.max=f),f<this.min&&(this.min=f)}}get(e,r){const s=new Uint8Array(this.data.buffer),l=4*this._idx(e,r);return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(s[l],s[l+1],s[l+2])}getUnpackVector(){return this.encoding==="terrarium"?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(e,r){if(e<-1||e>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(e+1)}_unpackMapbox(e,r,s){return(256*e*256+256*r+s)/10-1e4}_unpackTerrarium(e,r,s){return 256*e+r+s/256-32768}getPixels(){return new dr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,s){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let l=r*this.dim,u=r*this.dim+this.dim,p=s*this.dim,f=s*this.dim+this.dim;switch(r){case-1:l=u-1;break;case 1:u=l+1}switch(s){case-1:p=f-1;break;case 1:f=p+1}const g=-r*this.dim,x=-s*this.dim;for(let w=p;w<f;w++)for(let T=l;T<u;T++)this.data[this._idx(T,w)]=e.data[this._idx(T+g,w+x)]}}$e("DEMData",pd);class md{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){const s=e[r];this._stringToNumber[s]=r,this._numberToString[r]=s}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class fd{constructor(e,r,s,l,u){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=s,e._y=l,this.properties=e.properties,this.id=u}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(e[r]=this[r]);return e}}class gd{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new An(oi,16,0),this.grid3D=new An(oi,16,0),this.featureIndexArray=new he,this.promoteId=r}insert(e,r,s,l,u,p){const f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,l,u);const g=p?this.grid3D:this.grid;for(let x=0;x<r.length;x++){const w=r[x],T=[1/0,1/0,-1/0,-1/0];for(let C=0;C<w.length;C++){const A=w[C];T[0]=Math.min(T[0],A.x),T[1]=Math.min(T[1],A.y),T[2]=Math.max(T[2],A.x),T[3]=Math.max(T[3],A.y)}T[0]<oi&&T[1]<oi&&T[2]>=0&&T[3]>=0&&g.insert(f,T[0],T[1],T[2],T[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Rn.VectorTile(new zc(this.rawTileData)).layers,this.sourceLayerCoder=new md(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,s,l){this.loadVTLayers();const u=e.params||{},p=oi/e.tileSize/e.scale,f=$s(u.filter),g=e.queryGeometry,x=e.queryPadding*p,w=yd(g),T=this.grid.query(w.minX-x,w.minY-x,w.maxX+x,w.maxY+x),C=yd(e.cameraQueryGeometry),A=this.grid3D.query(C.minX-x,C.minY-x,C.maxX+x,C.maxY+x,(O,q,Y,$)=>function(J,de,ue,Ne,qe){for(const Re of J)if(de<=Re.x&&ue<=Re.y&&Ne>=Re.x&&qe>=Re.y)return!0;const Ue=[new it(de,ue),new it(de,qe),new it(Ne,qe),new it(Ne,ue)];if(J.length>2){for(const Re of Ue)if(Js(J,Re))return!0}for(let Re=0;Re<J.length-1;Re++)if(Pm(J[Re],J[Re+1],Ue))return!0;return!1}(e.cameraQueryGeometry,O-x,q-x,Y+x,$+x));for(const O of A)T.push(O);T.sort(rg);const P={};let F;for(let O=0;O<T.length;O++){const q=T[O];if(q===F)continue;F=q;const Y=this.featureIndexArray.get(q);let $=null;this.loadMatchingFeature(P,Y.bucketIndex,Y.sourceLayerIndex,Y.featureIndex,f,u.layers,u.availableImages,r,s,l,(J,de,ue)=>($||($=ys(J)),de.queryIntersectsFeature(g,J,ue,$,this.z,e.transform,p,e.pixelPosMatrix)))}return P}loadMatchingFeature(e,r,s,l,u,p,f,g,x,w,T){const C=this.bucketLayerIDs[r];if(p&&!function(O,q){for(let Y=0;Y<O.length;Y++)if(q.indexOf(O[Y])>=0)return!0;return!1}(p,C))return;const A=this.sourceLayerCoder.decode(s),P=this.vtLayers[A].feature(l);if(u.needGeometry){const O=xs(P,!0);if(!u.filter(new Nt(this.tileID.overscaledZ),O,this.tileID.canonical))return}else if(!u.filter(new Nt(this.tileID.overscaledZ),P))return;const F=this.getId(P,A);for(let O=0;O<C.length;O++){const q=C[O];if(p&&p.indexOf(q)<0)continue;const Y=g[q];if(!Y)continue;let $={};F&&w&&($=w.getState(Y.sourceLayer||"_geojsonTileLayer",F));const J=Ye({},x[q]);J.paint=_d(J.paint,Y.paint,P,$,f),J.layout=_d(J.layout,Y.layout,P,$,f);const de=!T||T(P,Y,$);if(!de)continue;const ue=new fd(P,this.z,this.x,this.y,F);ue.layer=J;let Ne=e[q];Ne===void 0&&(Ne=e[q]=[]),Ne.push({featureIndex:l,feature:ue,intersectionZ:de})}}lookupSymbolFeatures(e,r,s,l,u,p,f,g){const x={};this.loadVTLayers();const w=$s(u);for(const T of e)this.loadMatchingFeature(x,s,l,T,w,p,f,g,r);return x}hasLayer(e){for(const r of this.bucketLayerIDs)for(const s of r)if(e===s)return!0;return!1}getId(e,r){let s=e.id;return this.promoteId&&(s=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof s=="boolean"&&(s=Number(s))),s}}function _d(i,e,r,s,l){return Rt(i,(u,p)=>{const f=e instanceof Ws?e.get(p):null;return f&&f.evaluate?f.evaluate(r,s,l):f})}function yd(i){let e=1/0,r=1/0,s=-1/0,l=-1/0;for(const u of i)e=Math.min(e,u.x),r=Math.min(r,u.y),s=Math.max(s,u.x),l=Math.max(l,u.y);return{minX:e,minY:r,maxX:s,maxY:l}}function rg(i,e){return e-i}function Xc(i,e,r,s,l,u){if(l-s<=r)return;const p=s+l>>1;xd(i,e,p,s,l,u%2),Xc(i,e,r,s,p-1,u+1),Xc(i,e,r,p+1,l,u+1)}function xd(i,e,r,s,l,u){for(;l>s;){if(l-s>600){const x=l-s+1,w=r-s+1,T=Math.log(x),C=.5*Math.exp(2*T/3),A=.5*Math.sqrt(T*C*(x-C)/x)*(w-x/2<0?-1:1);xd(i,e,r,Math.max(s,Math.floor(r-w*C/x+A)),Math.min(l,Math.floor(r+(x-w)*C/x+A)),u)}const p=e[2*r+u];let f=s,g=l;for(po(i,e,s,r),e[2*l+u]>p&&po(i,e,s,l);f<g;){for(po(i,e,f,g),f++,g--;e[2*f+u]<p;)f++;for(;e[2*g+u]>p;)g--}e[2*s+u]===p?po(i,e,s,g):(g++,po(i,e,g,l)),g<=r&&(s=g+1),r<=g&&(l=g-1)}}function po(i,e,r,s){Wc(i,r,s),Wc(e,2*r,2*s),Wc(e,2*r+1,2*s+1)}function Wc(i,e,r){const s=i[e];i[e]=i[r],i[r]=s}function vd(i,e,r,s){const l=i-r,u=e-s;return l*l+u*u}$e("FeatureIndex",gd,{omit:["rawTileData","sourceLayerCoder"]});const ng=i=>i[0],sg=i=>i[1];var Hc;c.PerformanceMarkers=void 0,(Hc=c.PerformanceMarkers||(c.PerformanceMarkers={})).create="create",Hc.load="load",Hc.fullLoad="fullLoad";let zl=null,mo=[];const Kc=1e3/30,ag={mark(i){performance.mark(i)},frame(i){const e=i;zl!=null&&mo.push(e-zl),zl=e},clearMetrics(){zl=null,mo=[],performance.clearMeasures("loadTime"),performance.clearMeasures("fullLoadTime");for(const i in c.PerformanceMarkers)performance.clearMarks(c.PerformanceMarkers[i])},getPerformanceMetrics(){performance.measure("loadTime",c.PerformanceMarkers.create,c.PerformanceMarkers.load),performance.measure("fullLoadTime",c.PerformanceMarkers.create,c.PerformanceMarkers.fullLoad);const i=performance.getEntriesByName("loadTime")[0].duration,e=performance.getEntriesByName("fullLoadTime")[0].duration,r=mo.length,s=1/(mo.reduce((u,p)=>u+p,0)/r/1e3),l=mo.filter(u=>u>Kc).reduce((u,p)=>u+(p-Kc)/Kc,0);return{loadTime:i,fullLoadTime:e,fps:s,percentDroppedFrames:l/(r+l)*100}}};c.AJAXError=Ar,c.ARRAY_TYPE=Bi,c.Actor=class{constructor(i,e,r){this.target=i,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},Yt(["receive","process"],this),this.invoker=new ig(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=Ji()?i:window}send(i,e,r,s,l=!1){const u=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[u]=r);const p=Br(this.globalScope)?void 0:[];return this.target.postMessage({id:u,type:i,hasCallback:!!r,targetMapId:s,mustQueue:l,sourceMapId:this.mapId,data:Cn(e,p)},p),{cancel:()=>{r&&delete this.callbacks[u],this.target.postMessage({id:u,type:"<cancel>",targetMapId:s,sourceMapId:this.mapId})}}}receive(i){const e=i.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(e.type==="<cancel>"){delete this.tasks[r];const s=this.cancelCallbacks[r];delete this.cancelCallbacks[r],s&&s()}else Ji()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)}process(){if(!this.taskQueue.length)return;const i=this.taskQueue.shift(),e=this.tasks[i];delete this.tasks[i],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(i,e)}processTask(i,e){if(e.type==="<response>"){const r=this.callbacks[i];delete this.callbacks[i],r&&(e.error?r(cs(e.error)):r(null,cs(e.data)))}else{let r=!1;const s=Br(this.globalScope)?void 0:[],l=e.hasCallback?(f,g)=>{r=!0,delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"<response>",sourceMapId:this.mapId,error:f?Cn(f):null,data:Cn(g,s)},s)}:f=>{r=!0};let u=null;const p=cs(e.data);if(this.parent[e.type])u=this.parent[e.type](e.sourceMapId,p,l);else if(this.parent.getWorkerSource){const f=e.type.split(".");u=this.parent.getWorkerSource(e.sourceMapId,f[0],p.source)[f[1]](p,l)}else l(new Error(`Could not find function ${e.type}`));!r&&u&&u.cancel&&(this.cancelCallbacks[i]=u.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},c.AlphaImage=io,c.CanonicalTileID=Zc,c.CollisionBoxArray=L,c.CollisionCircleLayoutArray=class extends h{},c.Color=le,c.DEMData=pd,c.DataConstantProperty=We,c.DictionaryCoder=md,c.EXTENT=oi,c.ErrorEvent=G,c.EvaluationParameters=Nt,c.Event=R,c.Evented=Q,c.FeatureIndex=gd,c.FillBucket=Cc,c.FillExtrusionBucket=Pc,c.GeoJSONFeature=fd,c.ImageAtlas=Vu,c.ImagePosition=Dc,c.KDBush=class{constructor(i,e=ng,r=sg,s=64,l=Float64Array){this.nodeSize=s,this.points=i;const u=i.length<65536?Uint16Array:Uint32Array,p=this.ids=new u(i.length),f=this.coords=new l(2*i.length);for(let g=0;g<i.length;g++)p[g]=g,f[2*g]=e(i[g]),f[2*g+1]=r(i[g]);Xc(p,f,s,0,p.length-1,0)}range(i,e,r,s){return function(l,u,p,f,g,x,w){const T=[0,l.length-1,0],C=[];let A,P;for(;T.length;){const F=T.pop(),O=T.pop(),q=T.pop();if(O-q<=w){for(let J=q;J<=O;J++)A=u[2*J],P=u[2*J+1],A>=p&&A<=g&&P>=f&&P<=x&&C.push(l[J]);continue}const Y=Math.floor((q+O)/2);A=u[2*Y],P=u[2*Y+1],A>=p&&A<=g&&P>=f&&P<=x&&C.push(l[Y]);const $=(F+1)%2;(F===0?p<=A:f<=P)&&(T.push(q),T.push(Y-1),T.push($)),(F===0?g>=A:x>=P)&&(T.push(Y+1),T.push(O),T.push($))}return C}(this.ids,this.coords,i,e,r,s,this.nodeSize)}within(i,e,r){return function(s,l,u,p,f,g){const x=[0,s.length-1,0],w=[],T=f*f;for(;x.length;){const C=x.pop(),A=x.pop(),P=x.pop();if(A-P<=g){for(let $=P;$<=A;$++)vd(l[2*$],l[2*$+1],u,p)<=T&&w.push(s[$]);continue}const F=Math.floor((P+A)/2),O=l[2*F],q=l[2*F+1];vd(O,q,u,p)<=T&&w.push(s[F]);const Y=(C+1)%2;(C===0?u-f<=O:p-f<=q)&&(x.push(P),x.push(F-1),x.push(Y)),(C===0?u+f>=O:p+f>=q)&&(x.push(F+1),x.push(A),x.push(Y))}return w}(this.ids,this.coords,i,e,r,this.nodeSize)}},c.LineBucket=kc,c.LineStripIndexArray=class extends M{},c.LngLat=Kt,c.LngLatBounds=sd,c.MercatorCoordinate=kl,c.ONE_EM=pi,c.OverscaledTileID=pr,c.PerformanceUtils=ag,c.Pos3dArray=class extends ms{},c.PosArray=pe,c.Properties=Ei,c.QuadTriangleArray=class extends m{},c.RGBAImage=dr,c.RasterBoundsArray=class extends Yr{},c.RequestPerformance=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}},c.ResourceType=Ir,c.SegmentVector=$t,c.SymbolBucket=na,c.Transitionable=cl,c.TriangleIndexArray=wt,c.Uniform1f=Ln,c.Uniform1i=class extends tr{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},c.Uniform2f=class extends tr{constructor(i,e){super(i,e),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},c.Uniform3f=class extends tr{constructor(i,e){super(i,e),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},c.Uniform4f=Ks,c.UniformColor=dl,c.UniformMatrix4f=class extends tr{constructor(i,e){super(i,e),this.current=pc}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let e=1;e<16;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},c.UnwrappedTileID=dd,c.ValidationError=H,c.ZoomHistory=Oa,c.add=function(i,e,r){return i[0]=e[0]+r[0],i[1]=e[1]+r[1],i[2]=e[2]+r[2],i},c.addDynamicAttributes=Uc,c.asyncAll=function(i,e,r){if(!i.length)return r(null,[]);let s=i.length;const l=new Array(i.length);let u=null;i.forEach((p,f)=>{e(p,(g,x)=>{g&&(u=g),l[f]=x,--s==0&&r(u,l)})})},c.bezier=lt,c.bindAll=Yt,c.cacheEntryPossiblyAdded=function(i){jn++,jn>Vr&&(i.getActor().send("enforceCacheSizeLimit",Ur),jn=0)},c.clamp=Me,c.clearTileCache=function(i){const e=caches.delete(qr);i&&e.catch(i).then(()=>i())},c.clipLine=Yu,c.clone=function(i){var e=new Bi(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},c.clone$1=Ki,c.clone$2=function(i){var e=new Bi(3);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e},c.collisionCircleLayout=wf,c.config=Or,c.copy=function(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},c.create=function(){var i=new Bi(16);return Bi!=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},c.create$1=uu,c.createExpression=ts,c.createFilter=$s,c.createLayout=Ht,c.createStyleLayer=function(i){return i.type==="custom"?new eg(i):new tg[i.type](i)},c.cross=function(i,e,r){var s=e[0],l=e[1],u=e[2],p=r[0],f=r[1],g=r[2];return i[0]=l*g-u*f,i[1]=u*p-s*g,i[2]=s*f-l*p,i},c.dot=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]},c.dot$1=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},c.earthRadius=jc,c.ease=Et,c.emitValidationErrors=Fa,c.enforceCacheSizeLimit=function(i){Gn(),zi&&zi.then(e=>{e.keys().then(r=>{for(let s=0;s<r.length-i;s++)e.delete(r[s])})})},c.equals=function(i,e){var r=i[0],s=i[1],l=i[2],u=i[3],p=i[4],f=i[5],g=i[6],x=i[7],w=i[8],T=i[9],C=i[10],A=i[11],P=i[12],F=i[13],O=i[14],q=i[15],Y=e[0],$=e[1],J=e[2],de=e[3],ue=e[4],Ne=e[5],qe=e[6],Ue=e[7],Re=e[8],ze=e[9],Ve=e[10],Be=e[11],Ee=e[12],Ke=e[13],Xe=e[14],ct=e[15];return Math.abs(r-Y)<=Ri*Math.max(1,Math.abs(r),Math.abs(Y))&&Math.abs(s-$)<=Ri*Math.max(1,Math.abs(s),Math.abs($))&&Math.abs(l-J)<=Ri*Math.max(1,Math.abs(l),Math.abs(J))&&Math.abs(u-de)<=Ri*Math.max(1,Math.abs(u),Math.abs(de))&&Math.abs(p-ue)<=Ri*Math.max(1,Math.abs(p),Math.abs(ue))&&Math.abs(f-Ne)<=Ri*Math.max(1,Math.abs(f),Math.abs(Ne))&&Math.abs(g-qe)<=Ri*Math.max(1,Math.abs(g),Math.abs(qe))&&Math.abs(x-Ue)<=Ri*Math.max(1,Math.abs(x),Math.abs(Ue))&&Math.abs(w-Re)<=Ri*Math.max(1,Math.abs(w),Math.abs(Re))&&Math.abs(T-ze)<=Ri*Math.max(1,Math.abs(T),Math.abs(ze))&&Math.abs(C-Ve)<=Ri*Math.max(1,Math.abs(C),Math.abs(Ve))&&Math.abs(A-Be)<=Ri*Math.max(1,Math.abs(A),Math.abs(Be))&&Math.abs(P-Ee)<=Ri*Math.max(1,Math.abs(P),Math.abs(Ee))&&Math.abs(F-Ke)<=Ri*Math.max(1,Math.abs(F),Math.abs(Ke))&&Math.abs(O-Xe)<=Ri*Math.max(1,Math.abs(O),Math.abs(Xe))&&Math.abs(q-ct)<=Ri*Math.max(1,Math.abs(q),Math.abs(ct))},c.evaluateSizeForFeature=function(i,{uSize:e,uSizeT:r},{lowerSize:s,upperSize:l}){return i.kind==="source"?s/rn:i.kind==="composite"?Zt(s/rn,l/rn,r):e},c.evaluateSizeForZoom=function(i,e){let r=0,s=0;if(i.kind==="constant")s=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:l,minZoom:u,maxZoom:p}=i,f=l?Me(Vi.interpolationFactor(l,e,u,p),0,1):0;i.kind==="camera"?s=Zt(i.minSize,i.maxSize,f):r=f}return{uSizeT:r,uSize:s}},c.evaluateVariableOffset=td,c.evented=qa,c.exported=un,c.exported$1=dn,c.extend=Ye,c.filterObject=Nn,c.fromRotation=function(i,e){var r=Math.sin(e),s=Math.cos(e);return i[0]=s,i[1]=r,i[2]=0,i[3]=-r,i[4]=s,i[5]=0,i[6]=0,i[7]=0,i[8]=1,i},c.fromScaling=function(i,e){return i[0]=e[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=e[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=e[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},c.getAnchorAlignment=Bc,c.getAnchorJustification=Oc,c.getArrayBuffer=Xr,c.getImage=mn,c.getJSON=function(i,e){return Oi(Ye(i,{type:"json"}),e)},c.getOverlapMode=Gc,c.getRTLTextPluginStatus=Za,c.getReferrer=ar,c.getVideo=function(i,e){const r=window.document.createElement("video");r.muted=!0,r.onloadstart=function(){e(null,r)};for(let s=0;s<i.length;s++){const l=window.document.createElement("source");Es(i[s])||(r.crossOrigin="Anonymous"),l.src=i[s],r.appendChild(l)}return{cancel:()=>{}}},c.identity=yc,c.invert=function(i,e){var r=e[0],s=e[1],l=e[2],u=e[3],p=e[4],f=e[5],g=e[6],x=e[7],w=e[8],T=e[9],C=e[10],A=e[11],P=e[12],F=e[13],O=e[14],q=e[15],Y=r*f-s*p,$=r*g-l*p,J=r*x-u*p,de=s*g-l*f,ue=s*x-u*f,Ne=l*x-u*g,qe=w*F-T*P,Ue=w*O-C*P,Re=w*q-A*P,ze=T*O-C*F,Ve=T*q-A*F,Be=C*q-A*O,Ee=Y*Be-$*Ve+J*ze+de*Re-ue*Ue+Ne*qe;return Ee?(i[0]=(f*Be-g*Ve+x*ze)*(Ee=1/Ee),i[1]=(l*Ve-s*Be-u*ze)*Ee,i[2]=(F*Ne-O*ue+q*de)*Ee,i[3]=(C*ue-T*Ne-A*de)*Ee,i[4]=(g*Re-p*Be-x*Ue)*Ee,i[5]=(r*Be-l*Re+u*Ue)*Ee,i[6]=(O*J-P*Ne-q*$)*Ee,i[7]=(w*Ne-C*J+A*$)*Ee,i[8]=(p*Ve-f*Re+x*qe)*Ee,i[9]=(s*Re-r*Ve-u*qe)*Ee,i[10]=(P*ue-F*J+q*Y)*Ee,i[11]=(T*J-w*ue-A*Y)*Ee,i[12]=(f*Ue-p*ze-g*qe)*Ee,i[13]=(r*ze-s*Ue+l*qe)*Ee,i[14]=(F*$-P*de-O*Y)*Ee,i[15]=(w*de-T*$+C*Y)*Ee,i):null},c.isImageBitmap=Fr,c.isSafari=Br,c.isWorker=Ji,c.keysDifference=function(i,e){const r=[];for(const s in i)s in e||r.push(s);return r},c.lazyLoadRTLTextPlugin=function(){Gi.isLoading()||Gi.isLoaded()||Za()!=="deferred"||ll()},c.makeRequest=Oi,c.mapObject=Rt,c.mercatorXfromLng=ld,c.mercatorYfromLat=cd,c.mercatorZfromAltitude=hd,c.mul=Lm,c.mul$1=function(i,e,r){return i[0]=e[0]*r[0],i[1]=e[1]*r[1],i[2]=e[2]*r[2],i[3]=e[3]*r[3],i},c.multiply=du,c.nextPowerOfTwo=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},c.normalize=function(i,e){var r=e[0],s=e[1],l=e[2],u=r*r+s*s+l*l;return u>0&&(u=1/Math.sqrt(u)),i[0]=e[0]*u,i[1]=e[1]*u,i[2]=e[2]*u,i},c.number=Zt,c.ortho=function(i,e,r,s,l,u,p){var f=1/(e-r),g=1/(s-l),x=1/(u-p);return i[0]=-2*f,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*g,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*x,i[11]=0,i[12]=(e+r)*f,i[13]=(l+s)*g,i[14]=(p+u)*x,i[15]=1,i},c.parseCacheControl=$n,c.parseGlyphPbf=function(i){return new zc(i).readFields(Lf,[])},c.pbf=zc,c.performSymbolLayout=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=oi/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const e=i.bucket.layers[0].layout,r=i.bucket.layers[0]._unevaluatedLayout._values,s={layoutIconSize:r["icon-size"].possiblyEvaluate(new Nt(i.bucket.zoom+1),i.canonical),layoutTextSize:r["text-size"].possiblyEvaluate(new Nt(i.bucket.zoom+1),i.canonical),textMaxSize:r["text-size"].possiblyEvaluate(new Nt(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:g,maxZoom:x}=i.bucket.textSizeData;s.compositeTextSizes=[r["text-size"].possiblyEvaluate(new Nt(g),i.canonical),r["text-size"].possiblyEvaluate(new Nt(x),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:g,maxZoom:x}=i.bucket.iconSizeData;s.compositeIconSizes=[r["icon-size"].possiblyEvaluate(new Nt(g),i.canonical),r["icon-size"].possiblyEvaluate(new Nt(x),i.canonical)]}const l=e.get("text-line-height")*pi,u=e.get("text-rotation-alignment")!=="viewport"&&e.get("symbol-placement")!=="point",p=e.get("text-keep-upright"),f=e.get("text-size");for(const g of i.bucket.features){const x=e.get("text-font").evaluate(g,{},i.canonical).join(","),w=f.evaluate(g,{},i.canonical),T=s.layoutTextSize.evaluate(g,{},i.canonical),C=s.layoutIconSize.evaluate(g,{},i.canonical),A={horizontal:{},vertical:void 0},P=g.text;let F,O=[0,0];if(P){const $=P.toString(),J=e.get("text-letter-spacing").evaluate(g,{},i.canonical)*pi,de=lc($)?J:0,ue=e.get("text-anchor").evaluate(g,{},i.canonical),Ne=e.get("text-variable-anchor");if(!Ne){const Ve=e.get("text-radial-offset").evaluate(g,{},i.canonical);O=Ve?td(ue,[Ve*pi,Fc]):e.get("text-offset").evaluate(g,{},i.canonical).map(Be=>Be*pi)}let qe=u?"center":e.get("text-justify").evaluate(g,{},i.canonical);const Ue=e.get("symbol-placement"),Re=Ue==="point"?e.get("text-max-width").evaluate(g,{},i.canonical)*pi:0,ze=()=>{i.bucket.allowVerticalPlacement&&hs($)&&(A.vertical=Tl(P,i.glyphMap,i.glyphPositions,i.imagePositions,x,Re,l,ue,"left",de,O,c.WritingMode.vertical,!0,Ue,T,w))};if(!u&&Ne){const Ve=qe==="auto"?Ne.map(Ee=>Oc(Ee)):[qe];let Be=!1;for(let Ee=0;Ee<Ve.length;Ee++){const Ke=Ve[Ee];if(!A.horizontal[Ke])if(Be)A.horizontal[Ke]=A.horizontal[0];else{const Xe=Tl(P,i.glyphMap,i.glyphPositions,i.imagePositions,x,Re,l,"center",Ke,de,O,c.WritingMode.horizontal,!1,Ue,T,w);Xe&&(A.horizontal[Ke]=Xe,Be=Xe.positionedLines.length===1)}}ze()}else{qe==="auto"&&(qe=Oc(ue));const Ve=Tl(P,i.glyphMap,i.glyphPositions,i.imagePositions,x,Re,l,ue,qe,de,O,c.WritingMode.horizontal,!1,Ue,T,w);Ve&&(A.horizontal[qe]=Ve),ze(),hs($)&&u&&p&&(A.vertical=Tl(P,i.glyphMap,i.glyphPositions,i.imagePositions,x,Re,l,ue,qe,de,O,c.WritingMode.vertical,!1,Ue,T,w))}}let q=!1;if(g.icon&&g.icon.name){const $=i.imageMap[g.icon.name];$&&(F=Uf(i.imagePositions[g.icon.name],e.get("icon-offset").evaluate(g,{},i.canonical),e.get("icon-anchor").evaluate(g,{},i.canonical)),q=!!$.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=q:i.bucket.sdfIcons!==q&&Qt("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),($.pixelRatio!==i.bucket.pixelRatio||e.get("icon-rotate").constantOr(1)!==0)&&(i.bucket.iconsNeedLinear=!0))}const Y=rd(A.horizontal)||A.vertical;i.bucket.iconsInText=!!Y&&Y.iconsInText,(Y||F)&&Zf(i.bucket,g,A,F,i.imageMap,s,T,C,O,q,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},c.perspective=function(i,e,r,s,l){var u,p=1/Math.tan(e/2);return i[0]=p/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=p,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,l!=null&&l!==1/0?(i[10]=(l+s)*(u=1/(s-l)),i[14]=2*l*s*u):(i[10]=-1,i[14]=-2*s),i},c.pick=function(i,e){const r={};for(let s=0;s<e.length;s++){const l=e[s];l in i&&(r[l]=i[l])}return r},c.plugin=Gi,c.pointGeometry=it,c.polygonIntersectsPolygon=ou,c.potpack=Uu,c.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],c.register=$e,c.registerForPluginStateChange=function(i){return i({pluginStatus:Li,pluginURL:lr}),qa.on("pluginStateChange",i),i},c.renderColorRamp=xu,c.rotateX=function(i,e,r){var s=Math.sin(r),l=Math.cos(r),u=e[4],p=e[5],f=e[6],g=e[7],x=e[8],w=e[9],T=e[10],C=e[11];return e!==i&&(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[4]=u*l+x*s,i[5]=p*l+w*s,i[6]=f*l+T*s,i[7]=g*l+C*s,i[8]=x*l-u*s,i[9]=w*l-p*s,i[10]=T*l-f*s,i[11]=C*l-g*s,i},c.rotateZ=function(i,e,r){var s=Math.sin(r),l=Math.cos(r),u=e[0],p=e[1],f=e[2],g=e[3],x=e[4],w=e[5],T=e[6],C=e[7];return e!==i&&(i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[0]=u*l+x*s,i[1]=p*l+w*s,i[2]=f*l+T*s,i[3]=g*l+C*s,i[4]=x*l-u*s,i[5]=w*l-p*s,i[6]=T*l-f*s,i[7]=C*l-g*s,i},c.scale=function(i,e,r){var s=r[0],l=r[1],u=r[2];return i[0]=e[0]*s,i[1]=e[1]*s,i[2]=e[2]*s,i[3]=e[3]*s,i[4]=e[4]*l,i[5]=e[5]*l,i[6]=e[6]*l,i[7]=e[7]*l,i[8]=e[8]*u,i[9]=e[9]*u,i[10]=e[10]*u,i[11]=e[11]*u,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},c.scale$1=function(i,e,r){return i[0]=e[0]*r,i[1]=e[1]*r,i[2]=e[2]*r,i},c.setCacheLimits=function(i,e){Ur=i,Vr=e},c.setRTLTextPlugin=function(i,e,r=!1){if(Li===Na||Li===$a||Li===Ga)throw new Error("setRTLTextPlugin cannot be called multiple times.");lr=un.resolveURL(i),Li=Na,ja=e,us(),r||ll()},c.spec=V,c.sphericalToCartesian=function([i,e,r]){return e+=90,e*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(e)*Math.sin(r),y:i*Math.sin(e)*Math.sin(r),z:i*Math.cos(r)}},c.sqrLen=function(i){var e=i[0],r=i[1];return e*e+r*r},c.sub=function(i,e,r){return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],i},c.toEvaluationFeature=xs,c.transformMat3=function(i,e,r){var s=e[0],l=e[1],u=e[2];return i[0]=s*r[0]+l*r[3]+u*r[6],i[1]=s*r[1]+l*r[4]+u*r[7],i[2]=s*r[2]+l*r[5]+u*r[8],i},c.transformMat4=gl,c.transformMat4$1=function(i,e,r){var s=e[0],l=e[1];return i[0]=r[0]*s+r[4]*l+r[12],i[1]=r[1]*s+r[5]*l+r[13],i},c.translate=function(i,e,r){var s,l,u,p,f,g,x,w,T,C,A,P,F=r[0],O=r[1],q=r[2];return e===i?(i[12]=e[0]*F+e[4]*O+e[8]*q+e[12],i[13]=e[1]*F+e[5]*O+e[9]*q+e[13],i[14]=e[2]*F+e[6]*O+e[10]*q+e[14],i[15]=e[3]*F+e[7]*O+e[11]*q+e[15]):(l=e[1],u=e[2],p=e[3],f=e[4],g=e[5],x=e[6],w=e[7],T=e[8],C=e[9],A=e[10],P=e[11],i[0]=s=e[0],i[1]=l,i[2]=u,i[3]=p,i[4]=f,i[5]=g,i[6]=x,i[7]=w,i[8]=T,i[9]=C,i[10]=A,i[11]=P,i[12]=s*F+f*O+T*q+e[12],i[13]=l*F+g*O+C*q+e[13],i[14]=u*F+x*O+A*q+e[14],i[15]=p*F+w*O+P*q+e[15]),i},c.triggerPluginCompletionEvent=ol,c.unicodeBlockLookup=Oe,c.uniqueId=function(){return ii++},c.validateCustomStyleLayer=function(i){const e=[],r=i.id;return r===void 0&&e.push({message:`layers.${r}: missing required property "id"`}),i.render===void 0&&e.push({message:`layers.${r}: missing required method "render"`}),i.renderingMode&&i.renderingMode!=="2d"&&i.renderingMode!=="3d"&&e.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),e},c.validateLight=Ra,c.validateStyle=os,c.vectorTile=Rn,c.warnOnce=Qt,c.wrap=K}),me(["./shared"],function(c){function be(re){const z=typeof re;if(z==="number"||z==="boolean"||z==="string"||re==null)return JSON.stringify(re);if(Array.isArray(re)){let Q="[";for(const V of re)Q+=`${be(V)},`;return`${Q}]`}const R=Object.keys(re).sort();let G="{";for(let Q=0;Q<R.length;Q++)G+=`${JSON.stringify(R[Q])}:${be(re[R[Q]])},`;return`${G}}`}function Je(re){let z="";for(const R of c.refProperties)z+=`/${be(re[R])}`;return z}class lt{constructor(z){this.keyCache={},z&&this.replace(z)}replace(z){this._layerConfigs={},this._layers={},this.update(z,[])}update(z,R){for(const Q of z){this._layerConfigs[Q.id]=Q;const V=this._layers[Q.id]=c.createStyleLayer(Q);V._featureFilter=c.createFilter(V.filter),this.keyCache[Q.id]&&delete this.keyCache[Q.id]}for(const Q of R)delete this.keyCache[Q],delete this._layerConfigs[Q],delete this._layers[Q];this.familiesBySource={};const G=function(Q,V){const H={};for(let ae=0;ae<Q.length;ae++){const Ie=V&&V[Q[ae].id]||Je(Q[ae]);V&&(V[Q[ae].id]=Ie);let Pe=H[Ie];Pe||(Pe=H[Ie]=[]),Pe.push(Q[ae])}const ve=[];for(const ae in H)ve.push(H[ae]);return ve}(Object.values(this._layerConfigs),this.keyCache);for(const Q of G){const V=Q.map(Ce=>this._layers[Ce.id]),H=V[0];if(H.visibility==="none")continue;const ve=H.source||"";let ae=this.familiesBySource[ve];ae||(ae=this.familiesBySource[ve]={});const Ie=H.sourceLayer||"_geojsonTileLayer";let Pe=ae[Ie];Pe||(Pe=ae[Ie]=[]),Pe.push(V)}}}class Et{constructor(z){const R={},G=[];for(const ve in z){const ae=z[ve],Ie=R[ve]={};for(const Pe in ae){const Ce=ae[+Pe];if(!Ce||Ce.bitmap.width===0||Ce.bitmap.height===0)continue;const at={x:0,y:0,w:Ce.bitmap.width+2,h:Ce.bitmap.height+2};G.push(at),Ie[Pe]={rect:at,metrics:Ce.metrics}}}const{w:Q,h:V}=c.potpack(G),H=new c.AlphaImage({width:Q||1,height:V||1});for(const ve in z){const ae=z[ve];for(const Ie in ae){const Pe=ae[+Ie];if(!Pe||Pe.bitmap.width===0||Pe.bitmap.height===0)continue;const Ce=R[ve][Ie].rect;c.AlphaImage.copy(Pe.bitmap,H,{x:0,y:0},{x:Ce.x+1,y:Ce.y+1},Pe.bitmap)}}this.image=H,this.positions=R}}c.register("GlyphAtlas",Et);class Me{constructor(z){this.tileID=new c.OverscaledTileID(z.tileID.overscaledZ,z.tileID.wrap,z.tileID.canonical.z,z.tileID.canonical.x,z.tileID.canonical.y),this.uid=z.uid,this.zoom=z.zoom,this.pixelRatio=z.pixelRatio,this.tileSize=z.tileSize,this.source=z.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=z.showCollisionBoxes,this.collectResourceTiming=!!z.collectResourceTiming,this.returnDependencies=!!z.returnDependencies,this.promoteId=z.promoteId}parse(z,R,G,Q,V){this.status="parsing",this.data=z,this.collisionBoxArray=new c.CollisionBoxArray;const H=new c.DictionaryCoder(Object.keys(z.layers).sort()),ve=new c.FeatureIndex(this.tileID,this.promoteId);ve.bucketLayerIDs=[];const ae={},Ie={featureIndex:ve,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:G},Pe=R.familiesBySource[this.source];for(const Ge in Pe){const At=z.layers[Ge];if(!At)continue;At.version===1&&c.warnOnce(`Vector tile source "${this.source}" layer "${Ge}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Wt=H.encode(Ge),ri=[];for(let Ft=0;Ft<At.length;Ft++){const Ct=At.feature(Ft),st=ve.getId(Ct,Ge);ri.push({feature:Ct,id:st,index:Ft,sourceLayerIndex:Wt})}for(const Ft of Pe[Ge]){const Ct=Ft[0];Ct.source!==this.source&&c.warnOnce(`layer.source = ${Ct.source} does not equal this.source = ${this.source}`),Ct.minzoom&&this.zoom<Math.floor(Ct.minzoom)||Ct.maxzoom&&this.zoom>=Ct.maxzoom||Ct.visibility!=="none"&&(K(Ft,this.zoom,G),(ae[Ct.id]=Ct.createBucket({index:ve.bucketLayerIDs.length,layers:Ft,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Wt,sourceID:this.source})).populate(ri,Ie,this.tileID.canonical),ve.bucketLayerIDs.push(Ft.map(st=>st.id)))}}let Ce,at,_t,xe;const Le=c.mapObject(Ie.glyphDependencies,Ge=>Object.keys(Ge).map(Number));Object.keys(Le).length?Q.send("getGlyphs",{uid:this.uid,stacks:Le,source:this.source,tileID:this.tileID,type:"glyphs"},(Ge,At)=>{Ce||(Ce=Ge,at=At,Bt.call(this))}):at={};const Fe=Object.keys(Ie.iconDependencies);Fe.length?Q.send("getImages",{icons:Fe,source:this.source,tileID:this.tileID,type:"icons"},(Ge,At)=>{Ce||(Ce=Ge,_t=At,Bt.call(this))}):_t={};const bt=Object.keys(Ie.patternDependencies);function Bt(){if(Ce)return V(Ce);if(at&&_t&&xe){const Ge=new Et(at),At=new c.ImageAtlas(_t,xe);for(const Wt in ae){const ri=ae[Wt];ri instanceof c.SymbolBucket?(K(ri.layers,this.zoom,G),c.performSymbolLayout({bucket:ri,glyphMap:at,glyphPositions:Ge.positions,imageMap:_t,imagePositions:At.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):ri.hasPattern&&(ri instanceof c.LineBucket||ri instanceof c.FillBucket||ri instanceof c.FillExtrusionBucket)&&(K(ri.layers,this.zoom,G),ri.addFeatures(Ie,this.tileID.canonical,At.patternPositions))}this.status="done",V(null,{buckets:Object.values(ae).filter(Wt=>!Wt.isEmpty()),featureIndex:ve,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Ge.image,imageAtlas:At,glyphMap:this.returnDependencies?at:null,iconMap:this.returnDependencies?_t:null,glyphPositions:this.returnDependencies?Ge.positions:null})}}bt.length?Q.send("getImages",{icons:bt,source:this.source,tileID:this.tileID,type:"patterns"},(Ge,At)=>{Ce||(Ce=Ge,xe=At,Bt.call(this))}):xe={},Bt.call(this)}}function K(re,z,R){const G=new c.EvaluationParameters(z);for(const Q of re)Q.recalculate(G,R)}function Ye(re,z){const R=c.getArrayBuffer(re.request,(G,Q,V,H)=>{G?z(G):Q&&z(null,{vectorTile:new c.vectorTile.VectorTile(new c.pbf(Q)),rawData:Q,cacheControl:V,expires:H})});return()=>{R.cancel(),z()}}class ii{constructor(z,R,G,Q){this.actor=z,this.layerIndex=R,this.availableImages=G,this.loadVectorData=Q||Ye,this.loading={},this.loaded={}}loadTile(z,R){const G=z.uid;this.loading||(this.loading={});const Q=!!(z&&z.request&&z.request.collectResourceTiming)&&new c.RequestPerformance(z.request),V=this.loading[G]=new Me(z);V.abort=this.loadVectorData(z,(H,ve)=>{if(delete this.loading[G],H||!ve)return V.status="done",this.loaded[G]=V,R(H);const ae=ve.rawData,Ie={};ve.expires&&(Ie.expires=ve.expires),ve.cacheControl&&(Ie.cacheControl=ve.cacheControl);const Pe={};if(Q){const Ce=Q.finish();Ce&&(Pe.resourceTiming=JSON.parse(JSON.stringify(Ce)))}V.vectorTile=ve.vectorTile,V.parse(ve.vectorTile,this.layerIndex,this.availableImages,this.actor,(Ce,at)=>{if(Ce||!at)return R(Ce);R(null,c.extend({rawTileData:ae.slice(0)},at,Ie,Pe))}),this.loaded=this.loaded||{},this.loaded[G]=V})}reloadTile(z,R){const G=this.loaded,Q=z.uid,V=this;if(G&&G[Q]){const H=G[Q];H.showCollisionBoxes=z.showCollisionBoxes;const ve=(ae,Ie)=>{const Pe=H.reloadCallback;Pe&&(delete H.reloadCallback,H.parse(H.vectorTile,V.layerIndex,this.availableImages,V.actor,Pe)),R(ae,Ie)};H.status==="parsing"?H.reloadCallback=ve:H.status==="done"&&(H.vectorTile?H.parse(H.vectorTile,this.layerIndex,this.availableImages,this.actor,ve):ve())}}abortTile(z,R){const G=this.loading,Q=z.uid;G&&G[Q]&&G[Q].abort&&(G[Q].abort(),delete G[Q]),R()}removeTile(z,R){const G=this.loaded,Q=z.uid;G&&G[Q]&&delete G[Q],R()}}class Yt{constructor(){this.loaded={}}loadTile(z,R){const{uid:G,encoding:Q,rawImageData:V}=z,H=c.isImageBitmap(V)?this.getImageData(V):V,ve=new c.DEMData(G,H,Q);this.loaded=this.loaded||{},this.loaded[G]=ve,R(null,ve)}getImageData(z){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(z.width,z.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=z.width,this.offscreenCanvas.height=z.height,this.offscreenCanvasContext.drawImage(z,0,0,z.width,z.height);const R=this.offscreenCanvasContext.getImageData(-1,-1,z.width+2,z.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new c.RGBAImage({width:R.width,height:R.height},R.data)}removeTile(z){const R=this.loaded,G=z.uid;R&&R[G]&&delete R[G]}}var Rt=function re(z,R){var G,Q=z&&z.type;if(Q==="FeatureCollection")for(G=0;G<z.features.length;G++)re(z.features[G],R);else if(Q==="GeometryCollection")for(G=0;G<z.geometries.length;G++)re(z.geometries[G],R);else if(Q==="Feature")re(z.geometry,R);else if(Q==="Polygon")Nn(z.coordinates,R);else if(Q==="MultiPolygon")for(G=0;G<z.coordinates.length;G++)Nn(z.coordinates[G],R);return z};function Nn(re,z){if(re.length!==0){Ki(re[0],z);for(var R=1;R<re.length;R++)Ki(re[R],!z)}}function Ki(re,z){for(var R=0,G=0,Q=0,V=re.length,H=V-1;Q<V;H=Q++){var ve=(re[Q][0]-re[H][0])*(re[H][1]+re[Q][1]),ae=R+ve;G+=Math.abs(R)>=Math.abs(ve)?R-ae+ve:ve-ae+R,R=ae}R+G>=0!=!!z&&re.reverse()}const Dr=c.vectorTile.VectorTileFeature.prototype.toGeoJSON;var Qt={},nr={get exports(){return Qt},set exports(re){Qt=re}},Rr=c.pointGeometry,Ji=c.vectorTile.VectorTileFeature,$n=ln;function ln(re,z){this.options=z||{},this.features=re,this.length=re.length}function Br(re,z){this.id=typeof re.id=="number"?re.id:void 0,this.type=re.type,this.rawGeometry=re.type===1?[re.geometry]:re.geometry,this.properties=re.tags,this.extent=z||4096}ln.prototype.feature=function(re){return new Br(this.features[re],this.options.extent)},Br.prototype.loadGeometry=function(){var re=this.rawGeometry;this.geometry=[];for(var z=0;z<re.length;z++){for(var R=re[z],G=[],Q=0;Q<R.length;Q++)G.push(new Rr(R[Q][0],R[Q][1]));this.geometry.push(G)}return this.geometry},Br.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var re=this.geometry,z=1/0,R=-1/0,G=1/0,Q=-1/0,V=0;V<re.length;V++)for(var H=re[V],ve=0;ve<H.length;ve++){var ae=H[ve];z=Math.min(z,ae.x),R=Math.max(R,ae.x),G=Math.min(G,ae.y),Q=Math.max(Q,ae.y)}return[z,G,R,Q]},Br.prototype.toGeoJSON=Ji.prototype.toGeoJSON;var Fr=c.pbf,cn=$n;function Tr(re){var z=new Fr;return function(R,G){for(var Q in R.layers)G.writeMessage(3,hn,R.layers[Q])}(re,z),z.finish()}function hn(re,z){var R;z.writeVarintField(15,re.version||1),z.writeStringField(1,re.name||""),z.writeVarintField(5,re.extent||4096);var G={keys:[],values:[],keycache:{},valuecache:{}};for(R=0;R<re.length;R++)G.feature=re.feature(R),z.writeMessage(2,un,G);var Q=G.keys;for(R=0;R<Q.length;R++)z.writeStringField(3,Q[R]);var V=G.values;for(R=0;R<V.length;R++)z.writeMessage(4,zi,V[R])}function un(re,z){var R=re.feature;R.id!==void 0&&z.writeVarintField(1,R.id),z.writeMessage(2,it,re),z.writeVarintField(3,R.type),z.writeMessage(4,qr,R)}function it(re,z){var R=re.feature,G=re.keys,Q=re.values,V=re.keycache,H=re.valuecache;for(var ve in R.properties){var ae=R.properties[ve],Ie=V[ve];if(ae!==null){Ie===void 0&&(G.push(ve),V[ve]=Ie=G.length-1),z.writeVarint(Ie);var Pe=typeof ae;Pe!=="string"&&Pe!=="boolean"&&Pe!=="number"&&(ae=JSON.stringify(ae));var Ce=Pe+":"+ae,at=H[Ce];at===void 0&&(Q.push(ae),H[Ce]=at=Q.length-1),z.writeVarint(at)}}}function sr(re,z){return(z<<3)+(7&re)}function Or(re){return re<<1^re>>31}function qr(re,z){for(var R=re.loadGeometry(),G=re.type,Q=0,V=0,H=R.length,ve=0;ve<H;ve++){var ae=R[ve],Ie=1;G===1&&(Ie=ae.length),z.writeVarint(sr(1,Ie));for(var Pe=G===3?ae.length-1:ae.length,Ce=0;Ce<Pe;Ce++){Ce===1&&G!==1&&z.writeVarint(sr(2,Pe-1));var at=ae[Ce].x-Q,_t=ae[Ce].y-V;z.writeVarint(Or(at)),z.writeVarint(Or(_t)),Q+=at,V+=_t}G===3&&z.writeVarint(sr(7,1))}}function zi(re,z){var R=typeof re;R==="string"?z.writeStringField(1,re):R==="boolean"?z.writeBooleanField(7,re):R==="number"&&(re%1!=0?z.writeDoubleField(3,re):re<0?z.writeSVarintField(6,re):z.writeVarintField(5,re))}nr.exports=Tr,Qt.fromVectorTileJs=Tr,Qt.fromGeojsonVt=function(re,z){z=z||{};var R={};for(var G in re)R[G]=new cn(re[G].features,z),R[G].name=G,R[G].version=z.version,R[G].extent=z.extent;return Tr({layers:R})},Qt.GeoJSONWrapper=cn;const Zr={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:re=>re},Ur=Math.fround||(Vr=new Float32Array(1),re=>(Vr[0]=+re,Vr[0]));var Vr;class Gn{constructor(z){this.options=Ir(Object.create(Zr),z),this.trees=new Array(this.options.maxZoom+1)}load(z){const{log:R,minZoom:G,maxZoom:Q,nodeSize:V}=this.options;R&&console.time("total time");const H=`prepare ${z.length} points`;R&&console.time(H),this.points=z;let ve=[];for(let ae=0;ae<z.length;ae++)z[ae].geometry&&ve.push(dn(z[ae],ae));this.trees[Q+1]=new c.KDBush(ve,Ar,ar,V,Float32Array),R&&console.timeEnd(H);for(let ae=Q;ae>=G;ae--){const Ie=+Date.now();ve=this._cluster(ve,ae),this.trees[ae]=new c.KDBush(ve,Ar,ar,V,Float32Array),R&&console.log("z%d: %d clusters in %dms",ae,ve.length,+Date.now()-Ie)}return R&&console.timeEnd("total time"),this}getClusters(z,R){let G=((z[0]+180)%360+360)%360-180;const Q=Math.max(-90,Math.min(90,z[1]));let V=z[2]===180?180:((z[2]+180)%360+360)%360-180;const H=Math.max(-90,Math.min(90,z[3]));if(z[2]-z[0]>=360)G=-180,V=180;else if(G>V){const Pe=this.getClusters([G,Q,180,H],R),Ce=this.getClusters([-180,Q,V,H],R);return Pe.concat(Ce)}const ve=this.trees[this._limitZoom(R)],ae=ve.range(Nr(G),mi(H),Nr(V),mi(Q)),Ie=[];for(const Pe of ae){const Ce=ve.points[Pe];Ie.push(Ce.numPoints?Sr(Ce):this.points[Ce.index])}return Ie}getChildren(z){const R=this._getOriginId(z),G=this._getOriginZoom(z),Q="No cluster with the specified id.",V=this.trees[G];if(!V)throw new Error(Q);const H=V.points[R];if(!H)throw new Error(Q);const ve=this.options.radius/(this.options.extent*Math.pow(2,G-1)),ae=V.within(H.x,H.y,ve),Ie=[];for(const Pe of ae){const Ce=V.points[Pe];Ce.parentId===z&&Ie.push(Ce.numPoints?Sr(Ce):this.points[Ce.index])}if(Ie.length===0)throw new Error(Q);return Ie}getLeaves(z,R,G){const Q=[];return this._appendLeaves(Q,z,R=R||10,G=G||0,0),Q}getTile(z,R,G){const Q=this.trees[this._limitZoom(z)],V=Math.pow(2,z),{extent:H,radius:ve}=this.options,ae=ve/H,Ie=(G-ae)/V,Pe=(G+1+ae)/V,Ce={features:[]};return this._addTileFeatures(Q.range((R-ae)/V,Ie,(R+1+ae)/V,Pe),Q.points,R,G,V,Ce),R===0&&this._addTileFeatures(Q.range(1-ae/V,Ie,1,Pe),Q.points,V,G,V,Ce),R===V-1&&this._addTileFeatures(Q.range(0,Ie,ae/V,Pe),Q.points,-1,G,V,Ce),Ce.features.length?Ce:null}getClusterExpansionZoom(z){let R=this._getOriginZoom(z)-1;for(;R<=this.options.maxZoom;){const G=this.getChildren(z);if(R++,G.length!==1)break;z=G[0].properties.cluster_id}return R}_appendLeaves(z,R,G,Q,V){const H=this.getChildren(R);for(const ve of H){const ae=ve.properties;if(ae&&ae.cluster?V+ae.point_count<=Q?V+=ae.point_count:V=this._appendLeaves(z,ae.cluster_id,G,Q,V):V<Q?V++:z.push(ve),z.length===G)break}return V}_addTileFeatures(z,R,G,Q,V,H){for(const ve of z){const ae=R[ve],Ie=ae.numPoints;let Pe,Ce,at;if(Ie)Pe=Er(ae),Ce=ae.x,at=ae.y;else{const Le=this.points[ae.index];Pe=Le.properties,Ce=Nr(Le.geometry.coordinates[0]),at=mi(Le.geometry.coordinates[1])}const _t={type:1,geometry:[[Math.round(this.options.extent*(Ce*V-G)),Math.round(this.options.extent*(at*V-Q))]],tags:Pe};let xe;Ie?xe=ae.id:this.options.generateId?xe=ae.index:this.points[ae.index].id&&(xe=this.points[ae.index].id),xe!==void 0&&(_t.id=xe),H.features.push(_t)}}_limitZoom(z){return Math.max(this.options.minZoom,Math.min(Math.floor(+z),this.options.maxZoom+1))}_cluster(z,R){const G=[],{radius:Q,extent:V,reduce:H,minPoints:ve}=this.options,ae=Q/(V*Math.pow(2,R));for(let Ie=0;Ie<z.length;Ie++){const Pe=z[Ie];if(Pe.zoom<=R)continue;Pe.zoom=R;const Ce=this.trees[R+1],at=Ce.within(Pe.x,Pe.y,ae),_t=Pe.numPoints||1;let xe=_t;for(const Le of at){const Fe=Ce.points[Le];Fe.zoom>R&&(xe+=Fe.numPoints||1)}if(xe>_t&&xe>=ve){let Le=Pe.x*_t,Fe=Pe.y*_t,bt=H&&_t>1?this._map(Pe,!0):null;const Bt=(Ie<<5)+(R+1)+this.points.length;for(const Ge of at){const At=Ce.points[Ge];if(At.zoom<=R)continue;At.zoom=R;const Wt=At.numPoints||1;Le+=At.x*Wt,Fe+=At.y*Wt,At.parentId=Bt,H&&(bt||(bt=this._map(Pe,!0)),H(bt,this._map(At)))}Pe.parentId=Bt,G.push(jn(Le/xe,Fe/xe,Bt,xe,bt))}else if(G.push(Pe),xe>1)for(const Le of at){const Fe=Ce.points[Le];Fe.zoom<=R||(Fe.zoom=R,G.push(Fe))}}return G}_getOriginId(z){return z-this.points.length>>5}_getOriginZoom(z){return(z-this.points.length)%32}_map(z,R){if(z.numPoints)return R?Ir({},z.properties):z.properties;const G=this.points[z.index].properties,Q=this.options.map(G);return R&&Q===G?Ir({},Q):Q}}function jn(re,z,R,G,Q){return{x:Ur(re),y:Ur(z),zoom:1/0,id:R,parentId:-1,numPoints:G,properties:Q}}function dn(re,z){const[R,G]=re.geometry.coordinates;return{x:Ur(Nr(R)),y:Ur(mi(G)),zoom:1/0,index:z,parentId:-1}}function Sr(re){return{type:"Feature",id:re.id,properties:Er(re),geometry:{type:"Point",coordinates:[(z=re.x,360*(z-.5)),qn(re.y)]}};var z}function Er(re){const z=re.numPoints,R=z>=1e4?`${Math.round(z/1e3)}k`:z>=1e3?Math.round(z/100)/10+"k":z;return Ir(Ir({},re.properties),{cluster:!0,cluster_id:re.id,point_count:z,point_count_abbreviated:R})}function Nr(re){return re/360+.5}function mi(re){const z=Math.sin(re*Math.PI/180),R=.5-.25*Math.log((1+z)/(1-z))/Math.PI;return R<0?0:R>1?1:R}function qn(re){const z=(180-360*re)*Math.PI/180;return 360*Math.atan(Math.exp(z))/Math.PI-90}function Ir(re,z){for(const R in z)re[R]=z[R];return re}function Ar(re){return re.x}function ar(re){return re.y}var pn={};function Oi(re,z){return z?re.properties[z]:re.id}function Xr(re,z){if(re==null)return!0;if(re.type==="Feature")return Oi(re,z)!=null;if(re.type==="FeatureCollection"){const R=new Set;for(const G of re.features){const Q=Oi(G,z);if(Q==null||R.has(Q))return!1;R.add(Q)}return!0}return!1}function Es(re,z){const R=new Map;if(re!=null)if(re.type==="Feature")R.set(Oi(re,z),re);else for(const G of re.features)R.set(Oi(G,z),G);return R}function Wr(re,z){const R=re.tileID.canonical;if(!this._geoJSONIndex)return z(null,null);const G=this._geoJSONIndex.getTile(R.z,R.x,R.y);if(!G)return z(null,null);const Q=new class{constructor(H){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=c.EXTENT,this.length=H.length,this._features=H}feature(H){return new class{constructor(ve){this._feature=ve,this.extent=c.EXTENT,this.type=ve.type,this.properties=ve.tags,"id"in ve&&!isNaN(ve.id)&&(this.id=parseInt(ve.id,10))}loadGeometry(){if(this._feature.type===1){const ve=[];for(const ae of this._feature.geometry)ve.push([new c.pointGeometry(ae[0],ae[1])]);return ve}{const ve=[];for(const ae of this._feature.geometry){const Ie=[];for(const Pe of ae)Ie.push(new c.pointGeometry(Pe[0],Pe[1]));ve.push(Ie)}return ve}}toGeoJSON(ve,ae,Ie){return Dr.call(this,ve,ae,Ie)}}(this._features[H])}}(G.features);let V=Qt(Q);V.byteOffset===0&&V.byteLength===V.buffer.byteLength||(V=new Uint8Array(V)),z(null,{vectorTile:Q,rawData:V.buffer})}({get exports(){return pn},set exports(re){pn=re}}).exports=function(){function re(ee,ne,ce,fe){for(var ge,we=fe,Se=ce-ne>>1,_e=ce-ne,ke=ee[ne],le=ee[ne+1],et=ee[ce],pt=ee[ce+1],De=ne+3;De<ce;De+=3){var ot=z(ee[De],ee[De+1],ke,le,et,pt);if(ot>we)ge=De,we=ot;else if(ot===we){var yt=Math.abs(De-Se);yt<_e&&(ge=De,_e=yt)}}we>fe&&(ge-ne>3&&re(ee,ne,ge,fe),ee[ge+2]=we,ce-ge>3&&re(ee,ge,ce,fe))}function z(ee,ne,ce,fe,ge,we){var Se=ge-ce,_e=we-fe;if(Se!==0||_e!==0){var ke=((ee-ce)*Se+(ne-fe)*_e)/(Se*Se+_e*_e);ke>1?(ce=ge,fe=we):ke>0&&(ce+=Se*ke,fe+=_e*ke)}return(Se=ee-ce)*Se+(_e=ne-fe)*_e}function R(ee,ne,ce,fe){var ge={id:ee===void 0?null:ee,type:ne,geometry:ce,tags:fe,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(we){var Se=we.geometry,_e=we.type;if(_e==="Point"||_e==="MultiPoint"||_e==="LineString")G(we,Se);else if(_e==="Polygon"||_e==="MultiLineString")for(var ke=0;ke<Se.length;ke++)G(we,Se[ke]);else if(_e==="MultiPolygon")for(ke=0;ke<Se.length;ke++)for(var le=0;le<Se[ke].length;le++)G(we,Se[ke][le])}(ge),ge}function G(ee,ne){for(var ce=0;ce<ne.length;ce+=3)ee.minX=Math.min(ee.minX,ne[ce]),ee.minY=Math.min(ee.minY,ne[ce+1]),ee.maxX=Math.max(ee.maxX,ne[ce]),ee.maxY=Math.max(ee.maxY,ne[ce+1])}function Q(ee,ne,ce,fe){if(ne.geometry){var ge=ne.geometry.coordinates,we=ne.geometry.type,Se=Math.pow(ce.tolerance/((1<<ce.maxZoom)*ce.extent),2),_e=[],ke=ne.id;if(ce.promoteId?ke=ne.properties[ce.promoteId]:ce.generateId&&(ke=fe||0),we==="Point")V(ge,_e);else if(we==="MultiPoint")for(var le=0;le<ge.length;le++)V(ge[le],_e);else if(we==="LineString")H(ge,_e,Se,!1);else if(we==="MultiLineString"){if(ce.lineMetrics){for(le=0;le<ge.length;le++)H(ge[le],_e=[],Se,!1),ee.push(R(ke,"LineString",_e,ne.properties));return}ve(ge,_e,Se,!1)}else if(we==="Polygon")ve(ge,_e,Se,!0);else{if(we!=="MultiPolygon"){if(we==="GeometryCollection"){for(le=0;le<ne.geometry.geometries.length;le++)Q(ee,{id:ke,geometry:ne.geometry.geometries[le],properties:ne.properties},ce,fe);return}throw new Error("Input data is not a valid GeoJSON object.")}for(le=0;le<ge.length;le++){var et=[];ve(ge[le],et,Se,!0),_e.push(et)}}ee.push(R(ke,we,_e,ne.properties))}}function V(ee,ne){ne.push(ae(ee[0])),ne.push(Ie(ee[1])),ne.push(0)}function H(ee,ne,ce,fe){for(var ge,we,Se=0,_e=0;_e<ee.length;_e++){var ke=ae(ee[_e][0]),le=Ie(ee[_e][1]);ne.push(ke),ne.push(le),ne.push(0),_e>0&&(Se+=fe?(ge*le-ke*we)/2:Math.sqrt(Math.pow(ke-ge,2)+Math.pow(le-we,2))),ge=ke,we=le}var et=ne.length-3;ne[2]=1,re(ne,0,et,ce),ne[et+2]=1,ne.size=Math.abs(Se),ne.start=0,ne.end=ne.size}function ve(ee,ne,ce,fe){for(var ge=0;ge<ee.length;ge++){var we=[];H(ee[ge],we,ce,fe),ne.push(we)}}function ae(ee){return ee/360+.5}function Ie(ee){var ne=Math.sin(ee*Math.PI/180),ce=.5-.25*Math.log((1+ne)/(1-ne))/Math.PI;return ce<0?0:ce>1?1:ce}function Pe(ee,ne,ce,fe,ge,we,Se,_e){if(fe/=ne,we>=(ce/=ne)&&Se<fe)return ee;if(Se<ce||we>=fe)return null;for(var ke=[],le=0;le<ee.length;le++){var et=ee[le],pt=et.geometry,De=et.type,ot=ge===0?et.minX:et.minY,yt=ge===0?et.maxX:et.maxY;if(ot>=ce&&yt<fe)ke.push(et);else if(!(yt<ce||ot>=fe)){var Ot=[];if(De==="Point"||De==="MultiPoint")Ce(pt,Ot,ce,fe,ge);else if(De==="LineString")at(pt,Ot,ce,fe,ge,!1,_e.lineMetrics);else if(De==="MultiLineString")xe(pt,Ot,ce,fe,ge,!1);else if(De==="Polygon")xe(pt,Ot,ce,fe,ge,!0);else if(De==="MultiPolygon")for(var Ut=0;Ut<pt.length;Ut++){var dt=[];xe(pt[Ut],dt,ce,fe,ge,!0),dt.length&&Ot.push(dt)}if(Ot.length){if(_e.lineMetrics&&De==="LineString"){for(Ut=0;Ut<Ot.length;Ut++)ke.push(R(et.id,De,Ot[Ut],et.tags));continue}De!=="LineString"&&De!=="MultiLineString"||(Ot.length===1?(De="LineString",Ot=Ot[0]):De="MultiLineString"),De!=="Point"&&De!=="MultiPoint"||(De=Ot.length===3?"Point":"MultiPoint"),ke.push(R(et.id,De,Ot,et.tags))}}}return ke.length?ke:null}function Ce(ee,ne,ce,fe,ge){for(var we=0;we<ee.length;we+=3){var Se=ee[we+ge];Se>=ce&&Se<=fe&&(ne.push(ee[we]),ne.push(ee[we+1]),ne.push(ee[we+2]))}}function at(ee,ne,ce,fe,ge,we,Se){for(var _e,ke,le=_t(ee),et=ge===0?Fe:bt,pt=ee.start,De=0;De<ee.length-3;De+=3){var ot=ee[De],yt=ee[De+1],Ot=ee[De+2],Ut=ee[De+3],dt=ee[De+4],fi=ge===0?ot:yt,ci=ge===0?Ut:dt,Tt=!1;Se&&(_e=Math.sqrt(Math.pow(ot-Ut,2)+Math.pow(yt-dt,2))),fi<ce?ci>ce&&(ke=et(le,ot,yt,Ut,dt,ce),Se&&(le.start=pt+_e*ke)):fi>fe?ci<fe&&(ke=et(le,ot,yt,Ut,dt,fe),Se&&(le.start=pt+_e*ke)):Le(le,ot,yt,Ot),ci<ce&&fi>=ce&&(ke=et(le,ot,yt,Ut,dt,ce),Tt=!0),ci>fe&&fi<=fe&&(ke=et(le,ot,yt,Ut,dt,fe),Tt=!0),!we&&Tt&&(Se&&(le.end=pt+_e*ke),ne.push(le),le=_t(ee)),Se&&(pt+=_e)}var ai=ee.length-3;ot=ee[ai],yt=ee[ai+1],Ot=ee[ai+2],(fi=ge===0?ot:yt)>=ce&&fi<=fe&&Le(le,ot,yt,Ot),ai=le.length-3,we&&ai>=3&&(le[ai]!==le[0]||le[ai+1]!==le[1])&&Le(le,le[0],le[1],le[2]),le.length&&ne.push(le)}function _t(ee){var ne=[];return ne.size=ee.size,ne.start=ee.start,ne.end=ee.end,ne}function xe(ee,ne,ce,fe,ge,we){for(var Se=0;Se<ee.length;Se++)at(ee[Se],ne,ce,fe,ge,we,!1)}function Le(ee,ne,ce,fe){ee.push(ne),ee.push(ce),ee.push(fe)}function Fe(ee,ne,ce,fe,ge,we){var Se=(we-ne)/(fe-ne);return ee.push(we),ee.push(ce+(ge-ce)*Se),ee.push(1),Se}function bt(ee,ne,ce,fe,ge,we){var Se=(we-ce)/(ge-ce);return ee.push(ne+(fe-ne)*Se),ee.push(we),ee.push(1),Se}function Bt(ee,ne){for(var ce=[],fe=0;fe<ee.length;fe++){var ge,we=ee[fe],Se=we.type;if(Se==="Point"||Se==="MultiPoint"||Se==="LineString")ge=Ge(we.geometry,ne);else if(Se==="MultiLineString"||Se==="Polygon"){ge=[];for(var _e=0;_e<we.geometry.length;_e++)ge.push(Ge(we.geometry[_e],ne))}else if(Se==="MultiPolygon")for(ge=[],_e=0;_e<we.geometry.length;_e++){for(var ke=[],le=0;le<we.geometry[_e].length;le++)ke.push(Ge(we.geometry[_e][le],ne));ge.push(ke)}ce.push(R(we.id,Se,ge,we.tags))}return ce}function Ge(ee,ne){var ce=[];ce.size=ee.size,ee.start!==void 0&&(ce.start=ee.start,ce.end=ee.end);for(var fe=0;fe<ee.length;fe+=3)ce.push(ee[fe]+ne,ee[fe+1],ee[fe+2]);return ce}function At(ee,ne){if(ee.transformed)return ee;var ce,fe,ge,we=1<<ee.z,Se=ee.x,_e=ee.y;for(ce=0;ce<ee.features.length;ce++){var ke=ee.features[ce],le=ke.geometry,et=ke.type;if(ke.geometry=[],et===1)for(fe=0;fe<le.length;fe+=2)ke.geometry.push(Wt(le[fe],le[fe+1],ne,we,Se,_e));else for(fe=0;fe<le.length;fe++){var pt=[];for(ge=0;ge<le[fe].length;ge+=2)pt.push(Wt(le[fe][ge],le[fe][ge+1],ne,we,Se,_e));ke.geometry.push(pt)}}return ee.transformed=!0,ee}function Wt(ee,ne,ce,fe,ge,we){return[Math.round(ce*(ee*fe-ge)),Math.round(ce*(ne*fe-we))]}function ri(ee,ne,ce,fe,ge){for(var we=ne===ge.maxZoom?0:ge.tolerance/((1<<ne)*ge.extent),Se={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:ce,y:fe,z:ne,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},_e=0;_e<ee.length;_e++){Se.numFeatures++,Ft(Se,ee[_e],we,ge);var ke=ee[_e].minX,le=ee[_e].minY,et=ee[_e].maxX,pt=ee[_e].maxY;ke<Se.minX&&(Se.minX=ke),le<Se.minY&&(Se.minY=le),et>Se.maxX&&(Se.maxX=et),pt>Se.maxY&&(Se.maxY=pt)}return Se}function Ft(ee,ne,ce,fe){var ge=ne.geometry,we=ne.type,Se=[];if(we==="Point"||we==="MultiPoint")for(var _e=0;_e<ge.length;_e+=3)Se.push(ge[_e]),Se.push(ge[_e+1]),ee.numPoints++,ee.numSimplified++;else if(we==="LineString")Ct(Se,ge,ee,ce,!1,!1);else if(we==="MultiLineString"||we==="Polygon")for(_e=0;_e<ge.length;_e++)Ct(Se,ge[_e],ee,ce,we==="Polygon",_e===0);else if(we==="MultiPolygon")for(var ke=0;ke<ge.length;ke++){var le=ge[ke];for(_e=0;_e<le.length;_e++)Ct(Se,le[_e],ee,ce,!0,_e===0)}if(Se.length){var et=ne.tags||null;if(we==="LineString"&&fe.lineMetrics){for(var pt in et={},ne.tags)et[pt]=ne.tags[pt];et.mapbox_clip_start=ge.start/ge.size,et.mapbox_clip_end=ge.end/ge.size}var De={geometry:Se,type:we==="Polygon"||we==="MultiPolygon"?3:we==="LineString"||we==="MultiLineString"?2:1,tags:et};ne.id!==null&&(De.id=ne.id),ee.features.push(De)}}function Ct(ee,ne,ce,fe,ge,we){var Se=fe*fe;if(fe>0&&ne.size<(ge?Se:fe))ce.numPoints+=ne.length/3;else{for(var _e=[],ke=0;ke<ne.length;ke+=3)(fe===0||ne[ke+2]>Se)&&(ce.numSimplified++,_e.push(ne[ke]),_e.push(ne[ke+1])),ce.numPoints++;ge&&function(le,et){for(var pt=0,De=0,ot=le.length,yt=ot-2;De<ot;yt=De,De+=2)pt+=(le[De]-le[yt])*(le[De+1]+le[yt+1]);if(pt>0===et)for(De=0,ot=le.length;De<ot/2;De+=2){var Ot=le[De],Ut=le[De+1];le[De]=le[ot-2-De],le[De+1]=le[ot-1-De],le[ot-2-De]=Ot,le[ot-1-De]=Ut}}(_e,we),ee.push(_e)}}function st(ee,ne){var ce=(ne=this.options=function(ge,we){for(var Se in we)ge[Se]=we[Se];return ge}(Object.create(this.options),ne)).debug;if(ce&&console.time("preprocess data"),ne.maxZoom<0||ne.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(ne.promoteId&&ne.generateId)throw new Error("promoteId and generateId cannot be used together.");var fe=function(ge,we){var Se=[];if(ge.type==="FeatureCollection")for(var _e=0;_e<ge.features.length;_e++)Q(Se,ge.features[_e],we,_e);else Q(Se,ge.type==="Feature"?ge:{geometry:ge},we);return Se}(ee,ne);this.tiles={},this.tileCoords=[],ce&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",ne.indexMaxZoom,ne.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(fe=function(ge,we){var Se=we.buffer/we.extent,_e=ge,ke=Pe(ge,1,-1-Se,Se,0,-1,2,we),le=Pe(ge,1,1-Se,2+Se,0,-1,2,we);return(ke||le)&&(_e=Pe(ge,1,-Se,1+Se,0,-1,2,we)||[],ke&&(_e=Bt(ke,1).concat(_e)),le&&(_e=_e.concat(Bt(le,-1)))),_e}(fe,ne)).length&&this.splitTile(fe,0,0,0),ce&&(fe.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function fn(ee,ne,ce){return 32*((1<<ee)*ce+ne)+ee}return st.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},st.prototype.splitTile=function(ee,ne,ce,fe,ge,we,Se){for(var _e=[ee,ne,ce,fe],ke=this.options,le=ke.debug;_e.length;){fe=_e.pop(),ce=_e.pop(),ne=_e.pop(),ee=_e.pop();var et=1<<ne,pt=fn(ne,ce,fe),De=this.tiles[pt];if(!De&&(le>1&&console.time("creation"),De=this.tiles[pt]=ri(ee,ne,ce,fe,ke),this.tileCoords.push({z:ne,x:ce,y:fe}),le)){le>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",ne,ce,fe,De.numFeatures,De.numPoints,De.numSimplified),console.timeEnd("creation"));var ot="z"+ne;this.stats[ot]=(this.stats[ot]||0)+1,this.total++}if(De.source=ee,ge){if(ne===ke.maxZoom||ne===ge)continue;var yt=1<<ge-ne;if(ce!==Math.floor(we/yt)||fe!==Math.floor(Se/yt))continue}else if(ne===ke.indexMaxZoom||De.numPoints<=ke.indexMaxPoints)continue;if(De.source=null,ee.length!==0){le>1&&console.time("clipping");var Ot,Ut,dt,fi,ci,Tt,ai=.5*ke.buffer/ke.extent,Ti=.5-ai,gn=.5+ai,Ui=1+ai;Ot=Ut=dt=fi=null,ci=Pe(ee,et,ce-ai,ce+gn,0,De.minX,De.maxX,ke),Tt=Pe(ee,et,ce+Ti,ce+Ui,0,De.minX,De.maxX,ke),ee=null,ci&&(Ot=Pe(ci,et,fe-ai,fe+gn,1,De.minY,De.maxY,ke),Ut=Pe(ci,et,fe+Ti,fe+Ui,1,De.minY,De.maxY,ke),ci=null),Tt&&(dt=Pe(Tt,et,fe-ai,fe+gn,1,De.minY,De.maxY,ke),fi=Pe(Tt,et,fe+Ti,fe+Ui,1,De.minY,De.maxY,ke),Tt=null),le>1&&console.timeEnd("clipping"),_e.push(Ot||[],ne+1,2*ce,2*fe),_e.push(Ut||[],ne+1,2*ce,2*fe+1),_e.push(dt||[],ne+1,2*ce+1,2*fe),_e.push(fi||[],ne+1,2*ce+1,2*fe+1)}}},st.prototype.getTile=function(ee,ne,ce){var fe=this.options,ge=fe.extent,we=fe.debug;if(ee<0||ee>24)return null;var Se=1<<ee,_e=fn(ee,ne=(ne%Se+Se)%Se,ce);if(this.tiles[_e])return At(this.tiles[_e],ge);we>1&&console.log("drilling down to z%d-%d-%d",ee,ne,ce);for(var ke,le=ee,et=ne,pt=ce;!ke&&le>0;)le--,et=Math.floor(et/2),pt=Math.floor(pt/2),ke=this.tiles[fn(le,et,pt)];return ke&&ke.source?(we>1&&console.log("found parent tile z%d-%d-%d",le,et,pt),we>1&&console.time("drilling down"),this.splitTile(ke.source,le,et,pt,ee,ne,ce),we>1&&console.timeEnd("drilling down"),this.tiles[_e]?At(this.tiles[_e],ge):null):null},function(ee,ne){return new st(ee,ne)}}();class gt extends ii{constructor(z,R,G,Q){super(z,R,G,Wr),this._dataUpdateable=new Map,this.loadGeoJSON=(V,H)=>{const{promoteId:ve}=V;if(V.request)return c.getJSON(V.request,(ae,Ie,Pe,Ce)=>{this._dataUpdateable=Xr(Ie,ve)?Es(Ie,ve):void 0,H(ae,Ie,Pe,Ce)});if(typeof V.data=="string")try{const ae=JSON.parse(V.data);this._dataUpdateable=Xr(ae,ve)?Es(ae,ve):void 0,H(null,ae)}catch{H(new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`))}else V.dataDiff?this._dataUpdateable?(function(ae,Ie,Pe){var Ce,at,_t,xe;if(Ie.removeAll&&ae.clear(),Ie.remove)for(const Le of Ie.remove)ae.delete(Le);if(Ie.add)for(const Le of Ie.add){const Fe=Oi(Le,Pe);Fe!=null&&ae.set(Fe,Le)}if(Ie.update)for(const Le of Ie.update){let Fe=ae.get(Le.id);if(Fe==null)continue;const bt=!Le.removeAllProperties&&(((Ce=Le.removeProperties)===null||Ce===void 0?void 0:Ce.length)>0||((at=Le.addOrUpdateProperties)===null||at===void 0?void 0:at.length)>0);if((Le.newGeometry||Le.removeAllProperties||bt)&&(Fe={...Fe},ae.set(Le.id,Fe),bt&&(Fe.properties={...Fe.properties})),Le.newGeometry&&(Fe.geometry=Le.newGeometry),Le.removeAllProperties)Fe.properties={};else if(((_t=Le.removeProperties)===null||_t===void 0?void 0:_t.length)>0)for(const Bt of Le.removeProperties)Object.prototype.hasOwnProperty.call(Fe.properties,Bt)&&delete Fe.properties[Bt];if(((xe=Le.addOrUpdateProperties)===null||xe===void 0?void 0:xe.length)>0)for(const{key:Bt,value:Ge}of Le.addOrUpdateProperties)Fe.properties[Bt]=Ge}}(this._dataUpdateable,V.dataDiff,ve),H(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):H(new Error(`Cannot update existing geojson data in ${V.source}`)):H(new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},Q&&(this.loadGeoJSON=Q)}loadData(z,R){var G;(G=this._pendingRequest)===null||G===void 0||G.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const Q=!!(z&&z.request&&z.request.collectResourceTiming)&&new c.RequestPerformance(z.request);this._pendingCallback=R,this._pendingRequest=this.loadGeoJSON(z,(V,H)=>{if(delete this._pendingCallback,delete this._pendingRequest,V||!H)return R(V);if(typeof H!="object")return R(new Error(`Input data given to '${z.source}' is not a valid GeoJSON object.`));{Rt(H,!0);try{if(z.filter){const ae=c.createExpression(z.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ae.result==="error")throw new Error(ae.value.map(Pe=>`${Pe.key}: ${Pe.message}`).join(", "));const Ie=H.features.filter(Pe=>ae.value.evaluate({zoom:0},Pe));H={type:"FeatureCollection",features:Ie}}this._geoJSONIndex=z.cluster?new Gn(function({superclusterOptions:ae,clusterProperties:Ie}){if(!Ie||!ae)return ae;const Pe={},Ce={},at={accumulated:null,zoom:0},_t={properties:null},xe=Object.keys(Ie);for(const Le of xe){const[Fe,bt]=Ie[Le],Bt=c.createExpression(bt),Ge=c.createExpression(typeof Fe=="string"?[Fe,["accumulated"],["get",Le]]:Fe);Pe[Le]=Bt.value,Ce[Le]=Ge.value}return ae.map=Le=>{_t.properties=Le;const Fe={};for(const bt of xe)Fe[bt]=Pe[bt].evaluate(at,_t);return Fe},ae.reduce=(Le,Fe)=>{_t.properties=Fe;for(const bt of xe)at.accumulated=Le[bt],Le[bt]=Ce[bt].evaluate(at,_t)},ae}(z)).load(H.features):pn(H,z.geojsonVtOptions)}catch(ae){return R(ae)}this.loaded={};const ve={};if(Q){const ae=Q.finish();ae&&(ve.resourceTiming={},ve.resourceTiming[z.source]=JSON.parse(JSON.stringify(ae)))}R(null,ve)}})}reloadTile(z,R){const G=this.loaded;return G&&G[z.uid]?super.reloadTile(z,R):this.loadTile(z,R)}removeSource(z,R){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),R()}getClusterExpansionZoom(z,R){try{R(null,this._geoJSONIndex.getClusterExpansionZoom(z.clusterId))}catch(G){R(G)}}getClusterChildren(z,R){try{R(null,this._geoJSONIndex.getChildren(z.clusterId))}catch(G){R(G)}}getClusterLeaves(z,R){try{R(null,this._geoJSONIndex.getLeaves(z.clusterId,z.limit,z.offset))}catch(G){R(G)}}}class mn{constructor(z){this.self=z,this.actor=new c.Actor(z,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:ii,geojson:gt},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(R,G)=>{if(this.workerSourceTypes[R])throw new Error(`Worker source with name "${R}" already registered.`);this.workerSourceTypes[R]=G},this.self.registerRTLTextPlugin=R=>{if(c.plugin.isParsed())throw new Error("RTL text plugin already registered.");c.plugin.applyArabicShaping=R.applyArabicShaping,c.plugin.processBidirectionalText=R.processBidirectionalText,c.plugin.processStyledBidirectionalText=R.processStyledBidirectionalText}}setReferrer(z,R){this.referrer=R}setImages(z,R,G){this.availableImages[z]=R;for(const Q in this.workerSources[z]){const V=this.workerSources[z][Q];for(const H in V)V[H].availableImages=R}G()}setLayers(z,R,G){this.getLayerIndex(z).replace(R),G()}updateLayers(z,R,G){this.getLayerIndex(z).update(R.layers,R.removedIds),G()}loadTile(z,R,G){this.getWorkerSource(z,R.type,R.source).loadTile(R,G)}loadDEMTile(z,R,G){this.getDEMWorkerSource(z,R.source).loadTile(R,G)}reloadTile(z,R,G){this.getWorkerSource(z,R.type,R.source).reloadTile(R,G)}abortTile(z,R,G){this.getWorkerSource(z,R.type,R.source).abortTile(R,G)}removeTile(z,R,G){this.getWorkerSource(z,R.type,R.source).removeTile(R,G)}removeDEMTile(z,R){this.getDEMWorkerSource(z,R.source).removeTile(R)}removeSource(z,R,G){if(!this.workerSources[z]||!this.workerSources[z][R.type]||!this.workerSources[z][R.type][R.source])return;const Q=this.workerSources[z][R.type][R.source];delete this.workerSources[z][R.type][R.source],Q.removeSource!==void 0?Q.removeSource(R,G):G()}loadWorkerSource(z,R,G){try{this.self.importScripts(R.url),G()}catch(Q){G(Q.toString())}}syncRTLPluginState(z,R,G){try{c.plugin.setState(R);const Q=c.plugin.getPluginURL();if(c.plugin.isLoaded()&&!c.plugin.isParsed()&&Q!=null){this.self.importScripts(Q);const V=c.plugin.isParsed();G(V?void 0:new Error(`RTL Text Plugin failed to import scripts from ${Q}`),V)}}catch(Q){G(Q.toString())}}getAvailableImages(z){let R=this.availableImages[z];return R||(R=[]),R}getLayerIndex(z){let R=this.layerIndexes[z];return R||(R=this.layerIndexes[z]=new lt),R}getWorkerSource(z,R,G){if(this.workerSources[z]||(this.workerSources[z]={}),this.workerSources[z][R]||(this.workerSources[z][R]={}),!this.workerSources[z][R][G]){const Q={send:(V,H,ve)=>{this.actor.send(V,H,ve,z)}};this.workerSources[z][R][G]=new this.workerSourceTypes[R](Q,this.getLayerIndex(z),this.getAvailableImages(z))}return this.workerSources[z][R][G]}getDEMWorkerSource(z,R){return this.demWorkerSources[z]||(this.demWorkerSources[z]={}),this.demWorkerSources[z][R]||(this.demWorkerSources[z][R]=new Yt),this.demWorkerSources[z][R]}enforceCacheSizeLimit(z,R){c.enforceCacheSizeLimit(R)}}return c.isWorker()&&(self.worker=new mn(self)),mn}),me(["./shared"],function(c){var be=Je;function Je(o){return!function(t){return typeof window>"u"||typeof document>"u"?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var a,h,d=new Blob([""],{type:"text/javascript"}),m=URL.createObjectURL(d);try{h=new Worker(m),a=!0}catch{a=!1}return h&&h.terminate(),URL.revokeObjectURL(m),a}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var a=document.createElement("canvas");a.width=a.height=1;var h=a.getContext("2d");if(!h)return!1;var d=h.getImageData(0,0,1,1);return d&&d.width===a.width}()?(lt[n=t&&t.failIfMajorPerformanceCaveat]===void 0&&(lt[n]=function(a){var h,d=function(m){var _=document.createElement("canvas"),y=Object.create(Je.webGLContextAttributes);return y.failIfMajorPerformanceCaveat=m,_.getContext("webgl",y)||_.getContext("experimental-webgl",y)}(a);if(!d)return!1;try{h=d.createShader(d.VERTEX_SHADER)}catch{return!1}return!(!h||d.isContextLost())&&(d.shaderSource(h,"void main() {}"),d.compileShader(h),d.getShaderParameter(h,d.COMPILE_STATUS)===!0)}(n)),lt[n]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var n}(o)}var lt={};Je.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};var Et="3.0.0-pre.3";function Me(o,t){if(Array.isArray(o)){if(!Array.isArray(t)||o.length!==t.length)return!1;for(let n=0;n<o.length;n++)if(!Me(o[n],t[n]))return!1;return!0}if(typeof o=="object"&&o!==null&&t!==null){if(typeof t!="object"||Object.keys(o).length!==Object.keys(t).length)return!1;for(const n in o)if(!Me(o[n],t[n]))return!1;return!0}return o===t}class K{static testProp(t){if(!K.docStyle)return t[0];for(let n=0;n<t.length;n++)if(t[n]in K.docStyle)return t[n];return t[0]}static create(t,n,a){const h=window.document.createElement(t);return n!==void 0&&(h.className=n),a&&a.appendChild(h),h}static createNS(t,n){return window.document.createElementNS(t,n)}static disableDrag(){K.docStyle&&K.selectProp&&(K.userSelect=K.docStyle[K.selectProp],K.docStyle[K.selectProp]="none")}static enableDrag(){K.docStyle&&K.selectProp&&(K.docStyle[K.selectProp]=K.userSelect)}static setTransform(t,n){t.style[K.transformProp]=n}static addEventListener(t,n,a,h={}){t.addEventListener(n,a,"passive"in h?h:h.capture)}static removeEventListener(t,n,a,h={}){t.removeEventListener(n,a,"passive"in h?h:h.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",K.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",K.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",K.suppressClickInternal,!0)},0)}static mousePos(t,n){const a=t.getBoundingClientRect();return new c.pointGeometry(n.clientX-a.left-t.clientLeft,n.clientY-a.top-t.clientTop)}static touchPos(t,n){const a=t.getBoundingClientRect(),h=[];for(let d=0;d<n.length;d++)h.push(new c.pointGeometry(n[d].clientX-a.left-t.clientLeft,n[d].clientY-a.top-t.clientTop));return h}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}K.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,K.selectProp=K.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),K.transformProp=K.testProp(["transform","WebkitTransform"]);class Ye{constructor(t){this._transformRequestFn=t}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}normalizeSpriteURL(t,n,a){const h=function(d){const m=d.match(ii);if(!m)throw new Error(`Unable to parse URL "${d}"`);return{protocol:m[1],authority:m[2],path:m[3]||"/",params:m[4]?m[4].split("&"):[]}}(t);return h.path+=`${n}${a}`,function(d){const m=d.params.length?`?${d.params.join("&")}`:"";return`${d.protocol}://${d.authority}${d.path}${m}`}(h)}setTransformRequest(t){this._transformRequestFn=t}}const ii=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Yt(o){return typeof o=="string"?[{id:"default",url:o}]:o??[]}class Rt{constructor(t,n,a,h){this.context=t,this.format=a,this.texture=t.gl.createTexture(),this.update(n,h)}update(t,n,a){const{width:h,height:d}=t,m=!(this.size&&this.size[0]===h&&this.size[1]===d||a),{context:_}=this,{gl:y}=_;if(this.useMipmap=Boolean(n&&n.useMipmap),y.bindTexture(y.TEXTURE_2D,this.texture),_.pixelStoreUnpackFlipY.set(!1),_.pixelStoreUnpack.set(1),_.pixelStoreUnpackPremultiplyAlpha.set(this.format===y.RGBA&&(!n||n.premultiply!==!1)),m)this.size=[h,d],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||c.isImageBitmap(t)?y.texImage2D(y.TEXTURE_2D,0,this.format,this.format,y.UNSIGNED_BYTE,t):y.texImage2D(y.TEXTURE_2D,0,this.format,h,d,0,this.format,y.UNSIGNED_BYTE,t.data);else{const{x:b,y:S}=a||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||c.isImageBitmap(t)?y.texSubImage2D(y.TEXTURE_2D,0,b,S,y.RGBA,y.UNSIGNED_BYTE,t):y.texSubImage2D(y.TEXTURE_2D,0,b,S,h,d,y.RGBA,y.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&y.generateMipmap(y.TEXTURE_2D)}bind(t,n,a){const{context:h}=this,{gl:d}=h;d.bindTexture(d.TEXTURE_2D,this.texture),a!==d.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(a=d.LINEAR),t!==this.filter&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,t),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,a||t),this.filter=t),n!==this.wrap&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,n),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,n),this.wrap=n)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function Nn(o){const{userImage:t}=o;return!!(t&&t.render&&t.render())&&(o.data.replace(new Uint8Array(t.data.buffer)),!0)}class Ki extends c.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new c.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:n,callback:a}of this.requestors)this._notify(n,a);this.requestors=[]}}getImage(t){return this.images[t]}addImage(t,n){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,n)&&(this.images[t]=n)}_validate(t,n){let a=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new c.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),a=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new c.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),a=!1),this._validateContent(n.content,n)||(this.fire(new c.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),a=!1),a}_validateStretch(t,n){if(!t)return!0;let a=0;for(const h of t){if(h[0]<a||h[1]<h[0]||n<h[1])return!1;a=h[1]}return!0}_validateContent(t,n){return!(t&&(t.length!==4||t[0]<0||n.data.width<t[0]||t[1]<0||n.data.height<t[1]||t[2]<0||n.data.width<t[2]||t[3]<0||n.data.height<t[3]||t[2]<t[0]||t[3]<t[1]))}updateImage(t,n,a=!0){const h=this.images[t];if(a&&(h.data.width!==n.data.width||h.data.height!==n.data.height))throw new Error(`size mismatch between old image (${h.data.width}x${h.data.height}) and new image (${n.data.width}x${n.data.height}).`);n.version=h.version+1,this.images[t]=n,this.updatedImages[t]=!0}removeImage(t){const n=this.images[t];delete this.images[t],delete this.patterns[t],n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t,n){let a=!0;if(!this.isLoaded())for(const h of t)this.images[h]||(a=!1);this.isLoaded()||a?this._notify(t,n):this.requestors.push({ids:t,callback:n})}_notify(t,n){const a={};for(const h of t){this.images[h]||this.fire(new c.Event("styleimagemissing",{id:h}));const d=this.images[h];d?a[h]={data:d.data.clone(),pixelRatio:d.pixelRatio,sdf:d.sdf,version:d.version,stretchX:d.stretchX,stretchY:d.stretchY,content:d.content,hasRenderCallback:Boolean(d.userImage&&d.userImage.render)}:c.warnOnce(`Image "${h}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}n(null,a)}getPixelSize(){const{width:t,height:n}=this.atlasImage;return{width:t,height:n}}getPattern(t){const n=this.patterns[t],a=this.getImage(t);if(!a)return null;if(n&&n.position.version===a.version)return n.position;if(n)n.position.version=a.version;else{const h={w:a.data.width+2,h:a.data.height+2,x:0,y:0},d=new c.ImagePosition(h,a);this.patterns[t]={bin:h,position:d}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const n=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Rt(t,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const d in this.patterns)t.push(this.patterns[d].bin);const{w:n,h:a}=c.potpack(t),h=this.atlasImage;h.resize({width:n||1,height:a||1});for(const d in this.patterns){const{bin:m}=this.patterns[d],_=m.x+1,y=m.y+1,b=this.images[d].data,S=b.width,E=b.height;c.RGBAImage.copy(b,h,{x:0,y:0},{x:_,y},{width:S,height:E}),c.RGBAImage.copy(b,h,{x:0,y:E-1},{x:_,y:y-1},{width:S,height:1}),c.RGBAImage.copy(b,h,{x:0,y:0},{x:_,y:y+E},{width:S,height:1}),c.RGBAImage.copy(b,h,{x:S-1,y:0},{x:_-1,y},{width:1,height:E}),c.RGBAImage.copy(b,h,{x:0,y:0},{x:_+S,y},{width:1,height:E})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const a=this.images[n];a||c.warnOnce(`Image with ID: "${n}" was not found`),Nn(a)&&this.updateImage(n,a)}}}const Dr=1e20;function Qt(o,t,n,a,h,d,m,_,y){for(let b=t;b<t+a;b++)nr(o,n*d+b,d,h,m,_,y);for(let b=n;b<n+h;b++)nr(o,b*d+t,1,a,m,_,y)}function nr(o,t,n,a,h,d,m){d[0]=0,m[0]=-Dr,m[1]=Dr,h[0]=o[t];for(let _=1,y=0,b=0;_<a;_++){h[_]=o[t+_*n];const S=_*_;do{const E=d[y];b=(h[_]-h[E]+S-E*E)/(_-E)/2}while(b<=m[y]&&--y>-1);y++,d[y]=_,m[y]=b,m[y+1]=Dr}for(let _=0,y=0;_<a;_++){for(;m[y+1]<_;)y++;const b=d[y],S=_-b;o[t+_*n]=h[b]+S*S}}class Rr{constructor(t,n){this.requestManager=t,this.localIdeographFontFamily=n,this.entries={}}setURL(t){this.url=t}getGlyphs(t,n){const a=[];for(const h in t)for(const d of t[h])a.push({stack:h,id:d});c.asyncAll(a,({stack:h,id:d},m)=>{let _=this.entries[h];_||(_=this.entries[h]={glyphs:{},requests:{},ranges:{}});let y=_.glyphs[d];if(y!==void 0)return void m(null,{stack:h,id:d,glyph:y});if(y=this._tinySDF(_,h,d),y)return _.glyphs[d]=y,void m(null,{stack:h,id:d,glyph:y});const b=Math.floor(d/256);if(256*b>65535)return void m(new Error("glyphs > 65535 not supported"));if(_.ranges[b])return void m(null,{stack:h,id:d,glyph:y});if(!this.url)return void m(new Error("glyphsUrl is not set"));let S=_.requests[b];S||(S=_.requests[b]=[],Rr.loadGlyphRange(h,b,this.url,this.requestManager,(E,M)=>{if(M){for(const D in M)this._doesCharSupportLocalGlyph(+D)||(_.glyphs[+D]=M[+D]);_.ranges[b]=!0}for(const D of S)D(E,M);delete _.requests[b]})),S.push((E,M)=>{E?m(E):M&&m(null,{stack:h,id:d,glyph:M[d]||null})})},(h,d)=>{if(h)n(h);else if(d){const m={};for(const{stack:_,id:y,glyph:b}of d)(m[_]||(m[_]={}))[y]=b&&{id:b.id,bitmap:b.bitmap.clone(),metrics:b.metrics};n(null,m)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(c.unicodeBlockLookup["CJK Unified Ideographs"](t)||c.unicodeBlockLookup["Hangul Syllables"](t)||c.unicodeBlockLookup.Hiragana(t)||c.unicodeBlockLookup.Katakana(t))}_tinySDF(t,n,a){const h=this.localIdeographFontFamily;if(!h||!this._doesCharSupportLocalGlyph(a))return;let d=t.tinySDF;if(!d){let _="400";/bold/i.test(n)?_="900":/medium/i.test(n)?_="500":/light/i.test(n)&&(_="200"),d=t.tinySDF=new Rr.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:h,fontWeight:_})}const m=d.draw(String.fromCharCode(a));return{id:a,bitmap:new c.AlphaImage({width:m.width||30,height:m.height||30},m.data),metrics:{width:m.glyphWidth||24,height:m.glyphHeight||24,left:m.glyphLeft||0,top:m.glyphTop-27||-8,advance:m.glyphAdvance||24}}}}Rr.loadGlyphRange=function(o,t,n,a,h){const d=256*t,m=d+255,_=a.transformRequest(n.replace("{fontstack}",o).replace("{range}",`${d}-${m}`),c.ResourceType.Glyphs);c.getArrayBuffer(_,(y,b)=>{if(y)h(y);else if(b){const S={};for(const E of c.parseGlyphPbf(b))S[E.id]=E;h(null,S)}})},Rr.TinySDF=class{constructor({fontSize:o=24,buffer:t=3,radius:n=8,cutoff:a=.25,fontFamily:h="sans-serif",fontWeight:d="normal",fontStyle:m="normal"}={}){this.buffer=t,this.cutoff=a,this.radius=n;const _=this.size=o+4*t,y=this._createCanvas(_),b=this.ctx=y.getContext("2d",{willReadFrequently:!0});b.font=`${m} ${d} ${o}px ${h}`,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(o){const t=document.createElement("canvas");return t.width=t.height=o,t}draw(o){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:a,actualBoundingBoxLeft:h,actualBoundingBoxRight:d}=this.ctx.measureText(o),m=Math.ceil(n),_=Math.min(this.size-this.buffer,Math.ceil(d-h)),y=Math.min(this.size-this.buffer,m+Math.ceil(a)),b=_+2*this.buffer,S=y+2*this.buffer,E=Math.max(b*S,0),M=new Uint8ClampedArray(E),D={data:M,width:b,height:S,glyphWidth:_,glyphHeight:y,glyphTop:m,glyphLeft:0,glyphAdvance:t};if(_===0||y===0)return D;const{ctx:B,buffer:L,gridInner:N,gridOuter:X}=this;B.clearRect(L,L,_,y),B.fillText(o,L,L+m);const Z=B.getImageData(L,L,_,y);X.fill(Dr,0,E),N.fill(0,0,E);for(let U=0;U<y;U++)for(let W=0;W<_;W++){const te=Z.data[4*(U*_+W)+3]/255;if(te===0)continue;const se=(U+L)*b+W+L;if(te===1)X[se]=0,N[se]=Dr;else{const he=.5-te;X[se]=he>0?he*he:0,N[se]=he<0?he*he:0}}Qt(X,0,0,b,S,b,this.f,this.v,this.z),Qt(N,L,L,_,y,b,this.f,this.v,this.z);for(let U=0;U<E;U++){const W=Math.sqrt(X[U])-Math.sqrt(N[U]);M[U]=Math.round(255-255*(W/this.radius+this.cutoff))}return D}};const Ji=new c.Properties({anchor:new c.DataConstantProperty(c.spec.light.anchor),position:new class{constructor(){this.specification=c.spec.light.position}possiblyEvaluate(o,t){return c.sphericalToCartesian(o.expression.evaluate(t))}interpolate(o,t,n){return{x:c.number(o.x,t.x,n),y:c.number(o.y,t.y,n),z:c.number(o.z,t.z,n)}}},color:new c.DataConstantProperty(c.spec.light.color),intensity:new c.DataConstantProperty(c.spec.light.intensity)}),$n="-transition";class ln extends c.Evented{constructor(t){super(),this._transitionable=new c.Transitionable(Ji),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(c.validateLight,t,n))for(const a in t){const h=t[a];a.endsWith($n)?this._transitionable.setTransition(a.slice(0,-$n.length),h):this._transitionable.setValue(a,h)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,a){return(!a||a.validate!==!1)&&c.emitValidationErrors(this,t.call(c.validateStyle,c.extend({value:n,style:{glyphs:!0,sprite:!0},styleSpec:c.spec})))}}class Br{constructor(t,n){this.width=t,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,n){const a=t.join(",")+String(n);return this.dashEntry[a]||(this.dashEntry[a]=this.addDash(t,n)),this.dashEntry[a]}getDashRanges(t,n,a){const h=[];let d=t.length%2==1?-t[t.length-1]*a:0,m=t[0]*a,_=!0;h.push({left:d,right:m,isDash:_,zeroLength:t[0]===0});let y=t[0];for(let b=1;b<t.length;b++){_=!_;const S=t[b];d=y*a,y+=S,m=y*a,h.push({left:d,right:m,isDash:_,zeroLength:S===0})}return h}addRoundDash(t,n,a){const h=n/2;for(let d=-a;d<=a;d++){const m=this.width*(this.nextRow+a+d);let _=0,y=t[_];for(let b=0;b<this.width;b++){b/y.right>1&&(y=t[++_]);const S=Math.abs(b-y.left),E=Math.abs(b-y.right),M=Math.min(S,E);let D;const B=d/a*(h+1);if(y.isDash){const L=h-Math.abs(B);D=Math.sqrt(M*M+L*L)}else D=h-Math.sqrt(M*M+B*B);this.data[m+b]=Math.max(0,Math.min(255,D+128))}}}addRegularDash(t){for(let _=t.length-1;_>=0;--_){const y=t[_],b=t[_+1];y.zeroLength?t.splice(_,1):b&&b.isDash===y.isDash&&(b.left=y.left,t.splice(_,1))}const n=t[0],a=t[t.length-1];n.isDash===a.isDash&&(n.left=a.left-this.width,a.right=n.right+this.width);const h=this.width*this.nextRow;let d=0,m=t[d];for(let _=0;_<this.width;_++){_/m.right>1&&(m=t[++d]);const y=Math.abs(_-m.left),b=Math.abs(_-m.right),S=Math.min(y,b);this.data[h+_]=Math.max(0,Math.min(255,(m.isDash?S:-S)+128))}}addDash(t,n){const a=n?7:0,h=2*a+1;if(this.nextRow+h>this.height)return c.warnOnce("LineAtlas out of space"),null;let d=0;for(let _=0;_<t.length;_++)d+=t[_];if(d!==0){const _=this.width/d,y=this.getDashRanges(t,this.width,_);n?this.addRoundDash(y,_,a):this.addRegularDash(y)}const m={y:(this.nextRow+a+.5)/this.height,height:2*a/this.height,width:d};return this.nextRow+=h,this.dirty=!0,m}bind(t){const n=t.gl;this.texture?(n.bindTexture(n.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,n.texSubImage2D(n.TEXTURE_2D,0,0,0,this.width,this.height,n.ALPHA,n.UNSIGNED_BYTE,this.data))):(this.texture=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texImage2D(n.TEXTURE_2D,0,n.ALPHA,this.width,this.height,0,n.ALPHA,n.UNSIGNED_BYTE,this.data))}}class Fr{constructor(t,n){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=c.uniqueId();const a=this.workerPool.acquire(this.id);for(let h=0;h<a.length;h++){const d=new Fr.Actor(a[h],n,this.id);d.name=`Worker ${h}`,this.actors.push(d)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n,a){c.asyncAll(this.actors,(h,d)=>{h.send(t,n,d)},a=a||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(t=>{t.remove()}),this.actors=[],this.workerPool.release(this.id)}}function cn(o,t,n){const a=function(h,d){if(h)return n(h);if(d){const m=c.pick(c.extend(d,o),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);d.vector_layers&&(m.vectorLayers=d.vector_layers,m.vectorLayerIds=m.vectorLayers.map(_=>_.id)),n(null,m)}};return o.url?c.getJSON(t.transformRequest(o.url,c.ResourceType.Source),a):c.exported.frame(()=>a(null,o))}Fr.Actor=c.Actor;class Tr{constructor(t,n,a){this.bounds=c.LngLatBounds.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=a||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const n=Math.pow(2,t.z),a=Math.floor(c.mercatorXfromLng(this.bounds.getWest())*n),h=Math.floor(c.mercatorYfromLat(this.bounds.getNorth())*n),d=Math.ceil(c.mercatorXfromLng(this.bounds.getEast())*n),m=Math.ceil(c.mercatorYfromLat(this.bounds.getSouth())*n);return t.x>=a&&t.x<d&&t.y>=h&&t.y<m}}class hn extends c.Evented{constructor(t,n,a,h){if(super(),this.id=t,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,c.extend(this,c.pick(n,["url","scheme","tileSize","promoteId"])),this._options=c.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(h)}load(){this._loaded=!1,this.fire(new c.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=cn(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t?this.fire(new c.ErrorEvent(t)):n&&(c.extend(this,n),n.bounds&&(this.tileBounds=new Tr(n.bounds,this.minzoom,this.maxzoom)),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return c.extend({},this._options)}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),h={request:this.map._requestManager.transformRequest(a,c.ResourceType.Tile),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function d(m,_){return delete t.request,t.aborted?n(null):m&&m.status!==404?n(m):(_&&_.resourceTiming&&(t.resourceTiming=_.resourceTiming),this.map._refreshExpiredTiles&&_&&t.setExpiryData(_),t.loadVectorData(_,this.map.painter),c.cacheEntryPossiblyAdded(this.dispatcher),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}h.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired"?t.state==="loading"?t.reloadCallback=n:t.request=t.actor.send("reloadTile",h,d.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",h,d.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class un extends c.Evented{constructor(t,n,a,h){super(),this.id=t,this.dispatcher=a,this.setEventedParent(h),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=c.extend({type:"raster"},n),c.extend(this,c.pick(n,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new c.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=cn(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new c.ErrorEvent(t)):n&&(c.extend(this,n),n.bounds&&(this.tileBounds=new Tr(n.bounds,this.minzoom,this.maxzoom)),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return c.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=c.getImage(this.map._requestManager.transformRequest(a,c.ResourceType.Tile),(h,d,m)=>{if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(h)t.state="errored",n(h);else if(d){this.map._refreshExpiredTiles&&t.setExpiryData(m);const _=this.map.painter.context,y=_.gl;t.texture=this.map.painter.getTileTexture(d.width),t.texture?t.texture.update(d,{useMipmap:!0}):(t.texture=new Rt(_,d,y.RGBA,{useMipmap:!0}),t.texture.bind(y.LINEAR,y.CLAMP_TO_EDGE,y.LINEAR_MIPMAP_NEAREST),_.extTextureFilterAnisotropic&&y.texParameterf(y.TEXTURE_2D,_.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,_.extTextureFilterAnisotropicMax)),t.state="loaded",c.cacheEntryPossiblyAdded(this.dispatcher),n(null)}})}abortTile(t,n){t.request&&(t.request.cancel(),delete t.request),n()}unloadTile(t,n){t.texture&&this.map.painter.saveTileTexture(t.texture),n()}hasTransition(){return!1}}let it;class sr extends un{constructor(t,n,a,h){super(t,n,a,h),this.type="raster-dem",this.maxzoom=22,this._options=c.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function h(d,m){d&&(t.state="errored",n(d)),m&&(t.dem=m,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded",n(null))}t.request=c.getImage(this.map._requestManager.transformRequest(a,c.ResourceType.Tile),function(d,m){if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(d)t.state="errored",n(d);else if(m){this.map._refreshExpiredTiles&&t.setExpiryData(m),delete m.cacheControl,delete m.expires;const _=c.isImageBitmap(m)&&(it==null&&(it=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),it)?m:c.exported.getImageData(m,1),y={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:_,encoding:this.encoding};t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",y,h.bind(this)))}}.bind(this)),t.neighboringTiles=this._getNeighboringTiles(t.tileID)}_getNeighboringTiles(t){const n=t.canonical,a=Math.pow(2,n.z),h=(n.x-1+a)%a,d=n.x===0?t.wrap-1:t.wrap,m=(n.x+1+a)%a,_=n.x+1===a?t.wrap+1:t.wrap,y={};return y[new c.OverscaledTileID(t.overscaledZ,d,n.z,h,n.y).key]={backfilled:!1},y[new c.OverscaledTileID(t.overscaledZ,_,n.z,m,n.y).key]={backfilled:!1},n.y>0&&(y[new c.OverscaledTileID(t.overscaledZ,d,n.z,h,n.y-1).key]={backfilled:!1},y[new c.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},y[new c.OverscaledTileID(t.overscaledZ,_,n.z,m,n.y-1).key]={backfilled:!1}),n.y+1<a&&(y[new c.OverscaledTileID(t.overscaledZ,d,n.z,h,n.y+1).key]={backfilled:!1},y[new c.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},y[new c.OverscaledTileID(t.overscaledZ,_,n.z,m,n.y+1).key]={backfilled:!1}),y}unloadTile(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&t.actor.send("removeDEMTile",{uid:t.uid,source:this.id})}}class Or extends c.Evented{constructor(t,n,a,h){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=a.getActor(),this.setEventedParent(h),this._data=n.data,this._options=c.extend({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;const d=c.EXTENT/this.tileSize;this.workerOptions=c.extend({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*d,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*d,extent:c.EXTENT,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:n.clusterMaxZoom!==void 0?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:c.EXTENT,radius:(n.clusterRadius||50)*d,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}load(){this._updateWorkerData()}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData(),this}updateData(t){return this._updateWorkerData(t),this}getClusterExpansionZoom(t,n){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},n),this}getClusterChildren(t,n){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},n),this}getClusterLeaves(t,n,a,h){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:n,offset:a},h),this}_updateWorkerData(t){const n=c.extend({},this.workerOptions);t?n.dataDiff=t:typeof this._data=="string"?(n.request=this.map._requestManager.transformRequest(c.exported.resolveURL(this._data),c.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new c.Event("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,n,(a,h)=>{if(this._pendingLoads--,this._removed||h&&h.abandoned)return void this.fire(new c.Event("dataabort",{dataType:"source"}));let d=null;if(h&&h.resourceTiming&&h.resourceTiming[this.id]&&(d=h.resourceTiming[this.id].slice(0)),a)return void this.fire(new c.ErrorEvent(a));const m={dataType:"source"};this._collectResourceTiming&&d&&d.length>0&&c.extend(m,{resourceTiming:d}),this.fire(new c.Event("data",{...m,sourceDataType:"metadata"})),this.fire(new c.Event("data",{...m,sourceDataType:"content"}))})}loaded(){return this._pendingLoads===0}loadTile(t,n){const a=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const h={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.request=this.actor.send(a,h,(d,m)=>(delete t.request,t.unloadVectorData(),t.aborted?n(null):d?n(d):(t.loadVectorData(m,this.map.painter,a==="reloadTile"),n(null))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return c.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var qr=c.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class zi extends c.Evented{constructor(t,n,a,h){super(),this.id=t,this.dispatcher=a,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(h),this.options=n}load(t,n){this._loaded=!1,this.fire(new c.Event("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=c.getImage(this.map._requestManager.transformRequest(this.url,c.ResourceType.Image),(a,h)=>{this._request=null,this._loaded=!0,a?this.fire(new c.ErrorEvent(a)):h&&(this.image=h,t&&(this.coordinates=t),n&&n(),this._finishLoading())})}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=t.url,this.load(t.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(t){this.coordinates=t;const n=t.map(c.MercatorCoordinate.fromLngLat);this.tileID=function(h){let d=1/0,m=1/0,_=-1/0,y=-1/0;for(const M of h)d=Math.min(d,M.x),m=Math.min(m,M.y),_=Math.max(_,M.x),y=Math.max(y,M.y);const b=Math.max(_-d,y-m),S=Math.max(0,Math.floor(-Math.log(b)/Math.LN2)),E=Math.pow(2,S);return new c.CanonicalTileID(S,Math.floor((d+_)/2*E),Math.floor((m+y)/2*E))}(n),this.minzoom=this.maxzoom=this.tileID.z;const a=n.map(h=>this.tileID.getTilePoint(h)._round());return this._boundsArray=new c.RasterBoundsArray,this._boundsArray.emplaceBack(a[0].x,a[0].y,0,0),this._boundsArray.emplaceBack(a[1].x,a[1].y,c.EXTENT,0),this._boundsArray.emplaceBack(a[3].x,a[3].y,0,c.EXTENT),this._boundsArray.emplaceBack(a[2].x,a[2].y,c.EXTENT,c.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new c.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,qr.members)),this.boundsSegments||(this.boundsSegments=c.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Rt(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const a in this.tiles){const h=this.tiles[a];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture)}}loadTile(t,n){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},n(null)):(t.state="errored",n(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Zr extends zi{constructor(t,n,a,h){super(t,n,a,h),this.roundZoom=!0,this.type="video",this.options=n}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push(this.map._requestManager.transformRequest(n,c.ResourceType.Source).url);c.getVideo(this.urls,(n,a)=>{this._loaded=!0,n?this.fire(new c.ErrorEvent(n)):a&&(this.video=a,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;t<n.start(0)||t>n.end(0)?this.fire(new c.ErrorEvent(new c.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,qr.members)),this.boundsSegments||(this.boundsSegments=c.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new Rt(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const a in this.tiles){const h=this.tiles[a];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Ur extends zi{constructor(t,n,a,h){super(t,n,a,h),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(d=>!Array.isArray(d)||d.length!==2||d.some(m=>typeof m!="number"))||this.fire(new c.ErrorEvent(new c.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new c.ErrorEvent(new c.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new c.ErrorEvent(new c.ValidationError(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new c.ErrorEvent(new c.ValidationError(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new c.ErrorEvent(new c.ValidationError(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new c.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const n=this.map.painter.context,a=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,qr.members)),this.boundsSegments||(this.boundsSegments=c.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Rt(n,this.canvas,a.RGBA,{premultiply:!0});for(const h in this.tiles){const d=this.tiles[h];d.state!=="loaded"&&(d.state="loaded",d.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const Vr={vector:hn,raster:un,"raster-dem":sr,geojson:Or,video:Zr,image:zi,canvas:Ur};function Gn(o,t){const n=c.create();return c.translate(n,n,[1,1,0]),c.scale(n,n,[.5*o.width,.5*o.height,1]),c.multiply(n,n,o.calculatePosMatrix(t.toUnwrapped()))}function jn(o,t,n,a,h,d){const m=function(E,M,D){if(E)for(const B of E){const L=M[B];if(L&&L.source===D&&L.type==="fill-extrusion")return!0}else for(const B in M){const L=M[B];if(L.source===D&&L.type==="fill-extrusion")return!0}return!1}(h&&h.layers,t,o.id),_=d.maxPitchScaleFactor(),y=o.tilesIn(a,_,m);y.sort(dn);const b=[];for(const E of y)b.push({wrappedTileID:E.tileID.wrapped().key,queryResults:E.tile.queryRenderedFeatures(t,n,o._state,E.queryGeometry,E.cameraQueryGeometry,E.scale,h,d,_,Gn(o.transform,E.tileID))});const S=function(E){const M={},D={};for(const B of E){const L=B.queryResults,N=B.wrappedTileID,X=D[N]=D[N]||{};for(const Z in L){const U=L[Z],W=X[Z]=X[Z]||{},te=M[Z]=M[Z]||[];for(const se of U)W[se.featureIndex]||(W[se.featureIndex]=!0,te.push(se))}}return M}(b);for(const E in S)S[E].forEach(M=>{const D=M.feature,B=o.getFeatureState(D.layer["source-layer"],D.id);D.source=D.layer.source,D.layer["source-layer"]&&(D.sourceLayer=D.layer["source-layer"]),D.state=B});return S}function dn(o,t){const n=o.tileID,a=t.tileID;return n.overscaledZ-a.overscaledZ||n.canonical.y-a.canonical.y||n.wrap-a.wrap||n.canonical.x-a.canonical.x}class Sr{constructor(t,n){this.tileID=t,this.uid=c.uniqueId(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){const n=t+this.timeAdded;n<c.exported.now()||this.fadeEndTime&&n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,n,a){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(h,d){const m={};if(!d)return m;for(const _ of h){const y=_.layerIds.map(b=>d.getLayer(b)).filter(Boolean);if(y.length!==0){_.layers=y,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(b=>y.filter(S=>S.id===b)[0]));for(const b of y)m[b.id]=_}}return m}(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const h in this.buckets){const d=this.buckets[h];if(d instanceof c.SymbolBucket){if(this.hasSymbolBuckets=!0,!a)break;d.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const h in this.buckets){const d=this.buckets[h];if(d instanceof c.SymbolBucket&&d.hasRTLText){this.hasRTLText=!0,c.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const h in this.buckets){const d=this.buckets[h];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(h).queryRadius(d))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new c.CollisionBoxArray}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const a in this.buckets){const h=this.buckets[a];h.uploadPending()&&h.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Rt(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Rt(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,a,h,d,m,_,y,b,S){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:h,cameraQueryGeometry:d,scale:m,tileSize:this.tileSize,pixelPosMatrix:S,transform:y,params:_,queryPadding:this.queryPadding*b},t,n,a):{}}querySourceFeatures(t,n){const a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;const h=a.loadVTLayers(),d=n&&n.sourceLayer?n.sourceLayer:"",m=h._geojsonTileLayer||h[d];if(!m)return;const _=c.createFilter(n&&n.filter),{z:y,x:b,y:S}=this.tileID.canonical,E={z:y,x:b,y:S};for(let M=0;M<m.length;M++){const D=m.feature(M);if(_.needGeometry){const N=c.toEvaluationFeature(D,!0);if(!_.filter(new c.EvaluationParameters(this.tileID.overscaledZ),N,this.tileID.canonical))continue}else if(!_.filter(new c.EvaluationParameters(this.tileID.overscaledZ),D))continue;const B=a.getId(D,d),L=new c.GeoJSONFeature(D,y,b,S,B);L.tile=E,t.push(L)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const n=this.expirationTime;if(t.cacheControl){const a=c.parseCacheControl(t.cacheControl);a["max-age"]&&(this.expirationTime=Date.now()+1e3*a["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const a=Date.now();let h=!1;if(this.expirationTime>a)h=!1;else if(n)if(this.expirationTime<n)h=!0;else{const d=this.expirationTime-n;d?this.expirationTime=a+Math.max(d,3e4):h=!0}else h=!0;h?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(t,n){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(t).length===0)return;const a=this.latestFeatureIndex.loadVTLayers();for(const h in this.buckets){if(!n.style.hasLayer(h))continue;const d=this.buckets[h],m=d.layers[0].sourceLayer||"_geojsonTileLayer",_=a[m],y=t[m];if(!_||!y||Object.keys(y).length===0)continue;d.update(y,_,this.imageAtlas&&this.imageAtlas.patternPositions||{});const b=n&&n.style&&n.style.getLayer(h);b&&(this.queryPadding=Math.max(this.queryPadding,b.queryRadius(d)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<c.exported.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=c.exported.now()+t}setDependencies(t,n){const a={};for(const h of n)a[h]=!0;this.dependencies[t]=a}hasDependency(t,n){for(const a of t){const h=this.dependencies[a];if(h){for(const d of n)if(h[d])return!0}}return!1}}class Er{constructor(t,n){this.max=t,this.onRemove=n,this.reset()}reset(){for(const t in this.data)for(const n of this.data[t])n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value);return this.data={},this.order=[],this}add(t,n,a){const h=t.wrapped().key;this.data[h]===void 0&&(this.data[h]=[]);const d={value:n,timeout:void 0};if(a!==void 0&&(d.timeout=setTimeout(()=>{this.remove(t,d)},a)),this.data[h].push(d),this.order.push(h),this.order.length>this.max){const m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const n=this.data[t].shift();return n.timeout&&clearTimeout(n.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),n.value}getByKey(t){const n=this.data[t];return n?n[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,n){if(!this.has(t))return this;const a=t.wrapped().key,h=n===void 0?0:this.data[a].indexOf(n),d=this.data[a][h];return this.data[a].splice(h,1),d.timeout&&clearTimeout(d.timeout),this.data[a].length===0&&delete this.data[a],this.onRemove(d.value),this.order.splice(this.order.indexOf(a),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(t){const n=[];for(const a in this.data)for(const h of this.data[a])t(h.value)||n.push(h);for(const a of n)this.remove(a.value.tileID,a)}}class Nr{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,a){const h=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][h]=this.stateChanges[t][h]||{},c.extend(this.stateChanges[t][h],a),this.deletedStates[t]===null){this.deletedStates[t]={};for(const d in this.state[t])d!==h&&(this.deletedStates[t][d]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][h]===null){this.deletedStates[t][h]={};for(const d in this.state[t][h])a[d]||(this.deletedStates[t][h][d]=null)}else for(const d in a)this.deletedStates[t]&&this.deletedStates[t][h]&&this.deletedStates[t][h][d]===null&&delete this.deletedStates[t][h][d]}removeFeatureState(t,n,a){if(this.deletedStates[t]===null)return;const h=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},a&&n!==void 0)this.deletedStates[t][h]!==null&&(this.deletedStates[t][h]=this.deletedStates[t][h]||{},this.deletedStates[t][h][a]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][h])for(a in this.deletedStates[t][h]={},this.stateChanges[t][h])this.deletedStates[t][h][a]=null;else this.deletedStates[t][h]=null;else this.deletedStates[t]=null}getState(t,n){const a=String(n),h=c.extend({},(this.state[t]||{})[a],(this.stateChanges[t]||{})[a]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const d=this.deletedStates[t][n];if(d===null)return{};for(const m in d)delete h[m]}return h}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const a={};for(const h in this.stateChanges){this.state[h]=this.state[h]||{};const d={};for(const m in this.stateChanges[h])this.state[h][m]||(this.state[h][m]={}),c.extend(this.state[h][m],this.stateChanges[h][m]),d[m]=this.state[h][m];a[h]=d}for(const h in this.deletedStates){this.state[h]=this.state[h]||{};const d={};if(this.deletedStates[h]===null)for(const m in this.state[h])d[m]={},this.state[h][m]={};else for(const m in this.deletedStates[h]){if(this.deletedStates[h][m]===null)this.state[h][m]={};else for(const _ of Object.keys(this.deletedStates[h][m]))delete this.state[h][m][_];d[m]=this.state[h][m]}a[h]=a[h]||{},c.extend(a[h],d)}if(this.stateChanges={},this.deletedStates={},Object.keys(a).length!==0)for(const h in t)t[h].setFeatureState(a,n)}}class mi extends c.Evented{constructor(t,n,a){super(),this.id=t,this.dispatcher=a,this.on("data",h=>{h.dataType==="source"&&h.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&h.dataType==="source"&&h.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain))}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=function(h,d,m,_){const y=new Vr[d.type](h,d,m,_);if(y.id!==h)throw new Error(`Expected Source id to be ${h} instead of ${y.id}`);return c.bindAll(["load","abort","unload","serialize","prepare"],y),y}(t,n,a,this),this._tiles={},this._cache=new Er(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Nr}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const t in this._tiles){const n=this._tiles[t];if(n.state!=="loaded"&&n.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,n){return this._source.loadTile(t,n)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,()=>{}),this._source.fire(new c.Event("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const n in this._tiles){const a=this._tiles[n];a.upload(t),a.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(qn).map(t=>t.key)}getRenderableIds(t){const n=[];for(const a in this._tiles)this._isIdRenderable(a,t)&&n.push(this._tiles[a]);return t?n.sort((a,h)=>{const d=a.tileID,m=h.tileID,_=new c.pointGeometry(d.canonical.x,d.canonical.y)._rotate(this.transform.angle),y=new c.pointGeometry(m.canonical.x,m.canonical.y)._rotate(this.transform.angle);return d.overscaledZ-m.overscaledZ||y.y-_.y||y.x-_.x}).map(a=>a.tileID.key):n.map(a=>a.tileID).sort(qn).map(a=>a.key)}hasRenderableParent(t){const n=this.findLoadedParent(t,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(t,n){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(n||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}}_reloadTile(t,n){const a=this._tiles[t];a&&(a.state!=="loading"&&(a.state=n),this._loadTile(a,this._tileLoaded.bind(this,a,t,n)))}_tileLoaded(t,n,a,h){if(h)return t.state="errored",void(h.status!==404?this._source.fire(new c.ErrorEvent(h,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=c.exported.now(),a==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new c.Event("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const n=this.getRenderableIds();for(let h=0;h<n.length;h++){const d=n[h];if(t.neighboringTiles&&t.neighboringTiles[d]){const m=this.getTileByID(d);a(t,m),a(m,t)}}function a(h,d){h.needsHillshadePrepare=!0,h.needsTerrainPrepare=!0;let m=d.tileID.canonical.x-h.tileID.canonical.x;const _=d.tileID.canonical.y-h.tileID.canonical.y,y=Math.pow(2,h.tileID.canonical.z),b=d.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)),d.dem&&h.dem&&(h.dem.backfillBorder(d.dem,m,_),h.neighboringTiles&&h.neighboringTiles[b]&&(h.neighboringTiles[b].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,a,h){for(const d in this._tiles){let m=this._tiles[d];if(h[d]||!m.hasData()||m.tileID.overscaledZ<=n||m.tileID.overscaledZ>a)continue;let _=m.tileID;for(;m&&m.tileID.overscaledZ>n+1;){const b=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[b.key],m&&m.hasData()&&(_=b)}let y=_;for(;y.overscaledZ>n;)if(y=y.scaledTo(y.overscaledZ-1),t[y.key]){h[_.key]=_;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const a=this._loadedParentTiles[t.key];return a&&a.tileID.overscaledZ>=n?a:null}for(let a=t.overscaledZ-1;a>=n;a--){const h=t.scaledTo(a),d=this._getLoadedTile(h);if(d)return d}}_getLoadedTile(t){const n=this._tiles[t.key];return n&&n.hasData()?n:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const n=Math.ceil(t.width/this._source.tileSize)+1,a=Math.ceil(t.height/this._source.tileSize)+1,h=Math.floor(n*a*5),d=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,h):h;this._cache.setMaxSize(d)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const a={};for(const h in this._tiles){const d=this._tiles[h];d.tileID=d.tileID.unwrapTo(d.tileID.wrap+n),a[d.tileID.key]=d}this._tiles=a;for(const h in this._timers)clearTimeout(this._timers[h]),delete this._timers[h];for(const h in this._tiles)this._setTileReloadTimer(h,this._tiles[h])}}update(t,n){if(this.transform=t,this.terrain=n,!this._sourceLoaded||this._paused)return;let a;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?a=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(b=>new c.OverscaledTileID(b.canonical.z,b.wrap,b.canonical.z,b.canonical.x,b.canonical.y)):(a=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n}),this._source.hasTile&&(a=a.filter(b=>this._source.hasTile(b)))):a=[];const h=t.coveringZoomLevel(this._source),d=Math.max(h-mi.maxOverzooming,this._source.minzoom),m=Math.max(h+mi.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const b={};for(const S of a)if(S.canonical.z>this._source.minzoom){const E=S.scaledTo(S.canonical.z-1);b[E.key]=E;const M=S.scaledTo(Math.max(this._source.minzoom,Math.min(S.canonical.z,5)));b[M.key]=M}a=a.concat(Object.values(b))}const _=this._updateRetainedTiles(a,h);if(Ir(this._source.type)){const b={},S={},E=Object.keys(_);for(const M of E){const D=_[M],B=this._tiles[M];if(!B||B.fadeEndTime&&B.fadeEndTime<=c.exported.now())continue;const L=this.findLoadedParent(D,d);L&&(this._addTile(L.tileID),b[L.tileID.key]=L.tileID),S[M]=D}this._retainLoadedChildren(S,h,m,_);for(const M in b)_[M]||(this._coveredTiles[M]=!0,_[M]=b[M]);if(n){const M={},D={};for(const B of a)this._tiles[B.key].hasData()?M[B.key]=B:D[B.key]=B;for(const B in D){const L=D[B].children(this._source.maxzoom);this._tiles[L[0].key]&&this._tiles[L[1].key]&&this._tiles[L[2].key]&&this._tiles[L[3].key]&&(M[L[0].key]=_[L[0].key]=L[0],M[L[1].key]=_[L[1].key]=L[1],M[L[2].key]=_[L[2].key]=L[2],M[L[3].key]=_[L[3].key]=L[3],delete D[B])}for(const B in D){const L=this.findLoadedParent(D[B],this._source.minzoom);if(L){M[L.tileID.key]=_[L.tileID.key]=L.tileID;for(const N in M)M[N].isChildOf(L.tileID)&&delete M[N]}}for(const B in this._tiles)M[B]||(this._coveredTiles[B]=!0)}}for(const b in _)this._tiles[b].clearFadeHold();const y=c.keysDifference(this._tiles,_);for(const b of y){const S=this._tiles[b];S.hasSymbolBuckets&&!S.holdingForFade()?S.setHoldDuration(this.map._fadeDuration):S.hasSymbolBuckets&&!S.symbolFadeFinished()||this._removeTile(b)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){const a={},h={},d=Math.max(n-mi.maxOverzooming,this._source.minzoom),m=Math.max(n+mi.maxUnderzooming,this._source.minzoom),_={};for(const y of t){const b=this._addTile(y);a[y.key]=y,b.hasData()||n<this._source.maxzoom&&(_[y.key]=y)}this._retainLoadedChildren(_,n,m,a);for(const y of t){let b=this._tiles[y.key];if(b.hasData())continue;if(n+1>this._source.maxzoom){const E=y.children(this._source.maxzoom)[0],M=this.getTile(E);if(M&&M.hasData()){a[E.key]=E;continue}}else{const E=y.children(this._source.maxzoom);if(a[E[0].key]&&a[E[1].key]&&a[E[2].key]&&a[E[3].key])continue}let S=b.wasRequested();for(let E=y.overscaledZ-1;E>=d;--E){const M=y.scaledTo(E);if(h[M.key]||(h[M.key]=!0,b=this.getTile(M),!b&&S&&(b=this._addTile(M)),b&&(a[M.key]=M,S=b.wasRequested(),b.hasData())))break}}return a}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let a,h=this._tiles[t].tileID;for(;h.overscaledZ>0;){if(h.key in this._loadedParentTiles){a=this._loadedParentTiles[h.key];break}n.push(h.key);const d=h.scaledTo(h.overscaledZ-1);if(a=this._getLoadedTile(d),a)break;h=d}for(const d of n)this._loadedParentTiles[d]=a}}_addTile(t){let n=this._tiles[t.key];if(n)return n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));const a=n;return n||(n=new Sr(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))),n.uses++,this._tiles[t.key]=n,a||this._source.fire(new c.Event("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const a=n.getExpiryTimeout();a&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},a))}_removeTile(t){const n=this._tiles[t];n&&(n.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,n,a){const h=[],d=this.transform;if(!d)return h;const m=a?d.getCameraQueryGeometry(t):t,_=t.map(B=>d.pointCoordinate(B,this.terrain)),y=m.map(B=>d.pointCoordinate(B,this.terrain)),b=this.getIds();let S=1/0,E=1/0,M=-1/0,D=-1/0;for(const B of y)S=Math.min(S,B.x),E=Math.min(E,B.y),M=Math.max(M,B.x),D=Math.max(D,B.y);for(let B=0;B<b.length;B++){const L=this._tiles[b[B]];if(L.holdingForFade())continue;const N=L.tileID,X=Math.pow(2,d.zoom-L.tileID.overscaledZ),Z=n*L.queryPadding*c.EXTENT/L.tileSize/X,U=[N.getTilePoint(new c.MercatorCoordinate(S,E)),N.getTilePoint(new c.MercatorCoordinate(M,D))];if(U[0].x-Z<c.EXTENT&&U[0].y-Z<c.EXTENT&&U[1].x+Z>=0&&U[1].y+Z>=0){const W=_.map(se=>N.getTilePoint(se)),te=y.map(se=>N.getTilePoint(se));h.push({tile:L,tileID:N,queryGeometry:W,cameraQueryGeometry:te,scale:X})}}return h}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map(a=>this._tiles[a].tileID);for(const a of n)a.posMatrix=this.transform.calculatePosMatrix(a.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(Ir(this._source.type))for(const t in this._tiles){const n=this._tiles[t];if(n.fadeEndTime!==void 0&&n.fadeEndTime>=c.exported.now())return!0}return!1}setFeatureState(t,n,a){this._state.updateState(t=t||"_geojsonTileLayer",n,a)}removeFeatureState(t,n,a){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,a)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,a){const h=this._tiles[t];h&&h.setDependencies(n,a)}reloadTilesForDependencies(t,n){for(const a in this._tiles)this._tiles[a].hasDependency(t,n)&&this._reloadTile(a,"reloading");this._cache.filter(a=>!a.hasDependency(t,n))}}function qn(o,t){const n=Math.abs(2*o.wrap)-+(o.wrap<0),a=Math.abs(2*t.wrap)-+(t.wrap<0);return o.overscaledZ-t.overscaledZ||a-n||t.canonical.y-o.canonical.y||t.canonical.x-o.canonical.x}function Ir(o){return o==="raster"||o==="image"||o==="video"}mi.maxOverzooming=10,mi.maxUnderzooming=3;const Ar="mapboxgl_preloaded_worker_pool";class ar{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<ar.workerCount;)this.workers.push(new Worker(fs.workerUrl));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach(n=>{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Ar]}numActive(){return Object.keys(this.active).length}}const pn=Math.floor(c.exported.hardwareConcurrency/2);let Oi;function Xr(){return Oi||(Oi=new ar),Oi}function Es(o,t){const n={};for(const a in o)a!=="ref"&&(n[a]=o[a]);return c.refProperties.forEach(a=>{a in t&&(n[a]=t[a])}),n}function Wr(o){o=o.slice();const t=Object.create(null);for(let n=0;n<o.length;n++)t[o[n].id]=o[n];for(let n=0;n<o.length;n++)"ref"in o[n]&&(o[n]=Es(o[n],t[o[n].ref]));return o}ar.workerCount=Math.max(Math.min(pn,6),1);const gt={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function mn(o,t,n){n.push({command:gt.addSource,args:[o,t[o]]})}function re(o,t,n){t.push({command:gt.removeSource,args:[o]}),n[o]=!0}function z(o,t,n,a){re(o,n,a),mn(o,t,n)}function R(o,t,n){let a;for(a in o[n])if(Object.prototype.hasOwnProperty.call(o[n],a)&&a!=="data"&&!Me(o[n][a],t[n][a]))return!1;for(a in t[n])if(Object.prototype.hasOwnProperty.call(t[n],a)&&a!=="data"&&!Me(o[n][a],t[n][a]))return!1;return!0}function G(o,t,n,a,h,d){let m;for(m in t=t||{},o=o||{})Object.prototype.hasOwnProperty.call(o,m)&&(Me(o[m],t[m])||n.push({command:d,args:[a,m,t[m],h]}));for(m in t)Object.prototype.hasOwnProperty.call(t,m)&&!Object.prototype.hasOwnProperty.call(o,m)&&(Me(o[m],t[m])||n.push({command:d,args:[a,m,t[m],h]}))}function Q(o){return o.id}function V(o,t){return o[t.id]=t,o}class H{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],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(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=c.clamp(t,0,1);let n=1,a=this._distances[n];const h=t*this.paddedLength+this.padding;for(;a<h&&n<this._distances.length;)a=this._distances[++n];const d=n-1,m=this._distances[d],_=a-m,y=_>0?(h-m)/_:0;return this.points[d].mult(1-y).add(this.points[n].mult(y))}}function ve(o,t){let n=!0;return o==="always"||o!=="never"&&t!=="never"||(n=!1),n}class ae{constructor(t,n,a){const h=this.boxCells=[],d=this.circleCells=[];this.xCellCount=Math.ceil(t/a),this.yCellCount=Math.ceil(n/a);for(let m=0;m<this.xCellCount*this.yCellCount;m++)h.push([]),d.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=n,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,n,a,h,d){this._forEachCell(n,a,h,d,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(a),this.bboxes.push(h),this.bboxes.push(d)}insertCircle(t,n,a,h){this._forEachCell(n-h,a-h,n+h,a+h,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(a),this.circles.push(h)}_insertBoxCell(t,n,a,h,d,m){this.boxCells[d].push(m)}_insertCircleCell(t,n,a,h,d,m){this.circleCells[d].push(m)}_query(t,n,a,h,d,m,_){if(a<0||t>this.width||h<0||n>this.height)return[];const y=[];if(t<=0&&n<=0&&this.width<=a&&this.height<=h){if(d)return[{key:null,x1:t,y1:n,x2:a,y2:h}];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 S=this.circles[3*b],E=this.circles[3*b+1],M=this.circles[3*b+2];y.push({key:this.circleKeys[b],x1:S-M,y1:E-M,x2:S+M,y2:E+M})}}else this._forEachCell(t,n,a,h,this._queryCell,y,{hitTest:d,overlapMode:m,seenUids:{box:{},circle:{}}},_);return y}query(t,n,a,h){return this._query(t,n,a,h,!1,null)}hitTest(t,n,a,h,d,m){return this._query(t,n,a,h,!0,d,m).length>0}hitTestCircle(t,n,a,h,d){const m=t-a,_=t+a,y=n-a,b=n+a;if(_<0||m>this.width||b<0||y>this.height)return!1;const S=[];return this._forEachCell(m,y,_,b,this._queryCellCircle,S,{hitTest:!0,overlapMode:h,circle:{x:t,y:n,radius:a},seenUids:{box:{},circle:{}}},d),S.length>0}_queryCell(t,n,a,h,d,m,_,y){const{seenUids:b,hitTest:S,overlapMode:E}=_,M=this.boxCells[d];if(M!==null){const B=this.bboxes;for(const L of M)if(!b.box[L]){b.box[L]=!0;const N=4*L,X=this.boxKeys[L];if(t<=B[N+2]&&n<=B[N+3]&&a>=B[N+0]&&h>=B[N+1]&&(!y||y(X))&&(!S||!ve(E,X.overlapMode))&&(m.push({key:X,x1:B[N],y1:B[N+1],x2:B[N+2],y2:B[N+3]}),S))return!0}}const D=this.circleCells[d];if(D!==null){const B=this.circles;for(const L of D)if(!b.circle[L]){b.circle[L]=!0;const N=3*L,X=this.circleKeys[L];if(this._circleAndRectCollide(B[N],B[N+1],B[N+2],t,n,a,h)&&(!y||y(X))&&(!S||!ve(E,X.overlapMode))){const Z=B[N],U=B[N+1],W=B[N+2];if(m.push({key:X,x1:Z-W,y1:U-W,x2:Z+W,y2:U+W}),S)return!0}}}return!1}_queryCellCircle(t,n,a,h,d,m,_,y){const{circle:b,seenUids:S,overlapMode:E}=_,M=this.boxCells[d];if(M!==null){const B=this.bboxes;for(const L of M)if(!S.box[L]){S.box[L]=!0;const N=4*L,X=this.boxKeys[L];if(this._circleAndRectCollide(b.x,b.y,b.radius,B[N+0],B[N+1],B[N+2],B[N+3])&&(!y||y(X))&&!ve(E,X.overlapMode))return m.push(!0),!0}}const D=this.circleCells[d];if(D!==null){const B=this.circles;for(const L of D)if(!S.circle[L]){S.circle[L]=!0;const N=3*L,X=this.circleKeys[L];if(this._circlesCollide(B[N],B[N+1],B[N+2],b.x,b.y,b.radius)&&(!y||y(X))&&!ve(E,X.overlapMode))return m.push(!0),!0}}}_forEachCell(t,n,a,h,d,m,_,y){const b=this._convertToXCellCoord(t),S=this._convertToYCellCoord(n),E=this._convertToXCellCoord(a),M=this._convertToYCellCoord(h);for(let D=b;D<=E;D++)for(let B=S;B<=M;B++)if(d.call(this,t,n,a,h,this.xCellCount*B+D,m,_,y))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,n,a,h,d,m){const _=h-t,y=d-n,b=a+m;return b*b>_*_+y*y}_circleAndRectCollide(t,n,a,h,d,m,_){const y=(m-h)/2,b=Math.abs(t-(h+y));if(b>y+a)return!1;const S=(_-d)/2,E=Math.abs(n-(d+S));if(E>S+a)return!1;if(b<=y||E<=S)return!0;const M=b-y,D=E-S;return M*M+D*D<=a*a}}function Ie(o,t,n,a,h){const d=c.create();return t?(c.scale(d,d,[1/h,1/h,1]),n||c.rotateZ(d,d,a.angle)):c.multiply(d,a.labelPlaneMatrix,o),d}function Pe(o,t,n,a,h){if(t){const d=c.clone(o);return c.scale(d,d,[h,h,1]),n||c.rotateZ(d,d,-a.angle),d}return a.glCoordMatrix}function Ce(o,t,n){let a;n?(a=[o.x,o.y,n(o.x,o.y),1],c.transformMat4(a,a,t)):(a=[o.x,o.y,0,1],ri(a,a,t));const h=a[3];return{point:new c.pointGeometry(a[0]/h,a[1]/h),signedDistanceFromCamera:h}}function at(o,t){return .5+o/t*.5}function _t(o,t){const n=o[0]/o[3],a=o[1]/o[3];return n>=-t[0]&&n<=t[0]&&a>=-t[1]&&a<=t[1]}function xe(o,t,n,a,h,d,m,_,y,b){const S=a?o.textSizeData:o.iconSizeData,E=c.evaluateSizeForZoom(S,n.transform.zoom),M=[256/n.width*2+1,256/n.height*2+1],D=a?o.text.dynamicLayoutVertexArray:o.icon.dynamicLayoutVertexArray;D.clear();const B=o.lineVertexArray,L=a?o.text.placedSymbolArray:o.icon.placedSymbolArray,N=n.transform.width/n.transform.height;let X=!1;for(let Z=0;Z<L.length;Z++){const U=L.get(Z);if(U.hidden||U.writingMode===c.WritingMode.vertical&&!X){Wt(U.numGlyphs,D);continue}let W;if(X=!1,b?(W=[U.anchorX,U.anchorY,b(U.anchorX,U.anchorY),1],c.transformMat4(W,W,t)):(W=[U.anchorX,U.anchorY,0,1],ri(W,W,t)),!_t(W,M)){Wt(U.numGlyphs,D);continue}const te=at(n.transform.cameraToCenterDistance,W[3]),se=c.evaluateSizeForFeature(S,E,U),he=m?se/te:se*te,pe=new c.pointGeometry(U.anchorX,U.anchorY),Te=Ce(pe,h,b).point,ye={},Ae=bt(U,he,!1,_,t,h,d,o.glyphOffsetArray,B,D,Te,pe,ye,N,y,b);X=Ae.useVertical,(Ae.notEnoughRoom||X||Ae.needsFlipping&&bt(U,he,!0,_,t,h,d,o.glyphOffsetArray,B,D,Te,pe,ye,N,y,b).notEnoughRoom)&&Wt(U.numGlyphs,D)}a?o.text.dynamicLayoutVertexBuffer.updateData(D):o.icon.dynamicLayoutVertexBuffer.updateData(D)}function Le(o,t,n,a,h,d,m,_,y,b,S,E,M){const D=_.glyphStartIndex+_.numGlyphs,B=_.lineStartIndex,L=_.lineStartIndex+_.lineLength,N=t.getoffsetX(_.glyphStartIndex),X=t.getoffsetX(D-1),Z=Ge(o*N,n,a,h,d,m,_.segment,B,L,y,b,S,E,M);if(!Z)return null;const U=Ge(o*X,n,a,h,d,m,_.segment,B,L,y,b,S,E,M);return U?{first:Z,last:U}:null}function Fe(o,t,n,a){return o===c.WritingMode.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*a?{useVertical:!0}:(o===c.WritingMode.vertical?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function bt(o,t,n,a,h,d,m,_,y,b,S,E,M,D,B,L){const N=t/24,X=o.lineOffsetX*N,Z=o.lineOffsetY*N;let U;if(o.numGlyphs>1){const W=o.glyphStartIndex+o.numGlyphs,te=o.lineStartIndex,se=o.lineStartIndex+o.lineLength,he=Le(N,_,X,Z,n,S,E,o,y,d,M,B,L);if(!he)return{notEnoughRoom:!0};const pe=Ce(he.first.point,m,L).point,Te=Ce(he.last.point,m,L).point;if(a&&!n){const ye=Fe(o.writingMode,pe,Te,D);if(ye)return ye}U=[he.first];for(let ye=o.glyphStartIndex+1;ye<W-1;ye++)U.push(Ge(N*_.getoffsetX(ye),X,Z,n,S,E,o.segment,te,se,y,d,M,B,L));U.push(he.last)}else{if(a&&!n){const te=Ce(E,h,L).point,se=o.lineStartIndex+o.segment+1,he=new c.pointGeometry(y.getx(se),y.gety(se)),pe=Ce(he,h,L),Te=pe.signedDistanceFromCamera>0?pe.point:Bt(E,he,te,1,h,L),ye=Fe(o.writingMode,te,Te,D);if(ye)return ye}const W=Ge(N*_.getoffsetX(o.glyphStartIndex),X,Z,n,S,E,o.segment,o.lineStartIndex,o.lineStartIndex+o.lineLength,y,d,M,B,L);if(!W)return{notEnoughRoom:!0};U=[W]}for(const W of U)c.addDynamicAttributes(b,W.point,W.angle);return{}}function Bt(o,t,n,a,h,d){const m=Ce(o.add(o.sub(t)._unit()),h,d).point,_=n.sub(m);return n.add(_._mult(a/_.mag()))}function Ge(o,t,n,a,h,d,m,_,y,b,S,E,M,D){const B=a?o-t:o+t;let L=B>0?1:-1,N=0;a&&(L*=-1,N=Math.PI),L<0&&(N+=Math.PI);let X=L>0?_+m:_+m+1,Z=h,U=h,W=0,te=0;const se=Math.abs(B),he=[];for(;W+te<=se;){if(X+=L,X<_||X>=y)return null;if(U=Z,he.push(Z),Z=E[X],Z===void 0){const je=new c.pointGeometry(b.getx(X),b.gety(X)),rt=Ce(je,S,D);if(rt.signedDistanceFromCamera>0)Z=E[X]=rt.point;else{const nt=X-L;Z=Bt(W===0?d:new c.pointGeometry(b.getx(nt),b.gety(nt)),je,U,se-W+1,S,D)}}W+=te,te=U.dist(Z)}const pe=(se-W)/te,Te=Z.sub(U),ye=Te.mult(pe)._add(U);ye._add(Te._unit()._perp()._mult(n*L));const Ae=N+Math.atan2(Z.y-U.y,Z.x-U.x);return he.push(ye),{point:ye,angle:M?Ae:0,path:he}}const At=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Wt(o,t){for(let n=0;n<o;n++){const a=t.length;t.resize(a+4),t.float32.set(At,3*a)}}function ri(o,t,n){const a=t[0],h=t[1];return o[0]=n[0]*a+n[4]*h+n[12],o[1]=n[1]*a+n[5]*h+n[13],o[3]=n[3]*a+n[7]*h+n[15],o}const Ft=100;class Ct{constructor(t,n=new ae(t.width+200,t.height+200,25),a=new ae(t.width+200,t.height+200,25)){this.transform=t,this.grid=n,this.ignoredGrid=a,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+Ft,this.screenBottomBoundary=t.height+Ft,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,n,a,h,d,m){const _=this.projectAndGetPerspectiveRatio(h,t.anchorPointX,t.anchorPointY,m),y=a*_.perspectiveRatio,b=t.x1*y+_.point.x,S=t.y1*y+_.point.y,E=t.x2*y+_.point.x,M=t.y2*y+_.point.y;return!this.isInsideGrid(b,S,E,M)||n!=="always"&&this.grid.hitTest(b,S,E,M,n,d)||_.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[b,S,E,M],offscreen:this.isOffscreen(b,S,E,M)}}placeCollisionCircles(t,n,a,h,d,m,_,y,b,S,E,M,D,B){const L=[],N=new c.pointGeometry(n.anchorX,n.anchorY),X=Ce(N,m,B),Z=at(this.transform.cameraToCenterDistance,X.signedDistanceFromCamera),U=(S?d/Z:d*Z)/c.ONE_EM,W=Ce(N,_,B).point,te=Le(U,h,n.lineOffsetX*U,n.lineOffsetY*U,!1,W,N,n,a,_,{},!1,B);let se=!1,he=!1,pe=!0;if(te){const Te=.5*M*Z+D,ye=new c.pointGeometry(-100,-100),Ae=new c.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),je=new H,rt=te.first,nt=te.last;let He=[];for(let ft=rt.path.length-1;ft>=1;ft--)He.push(rt.path[ft]);for(let ft=1;ft<nt.path.length;ft++)He.push(nt.path[ft]);const Pt=2.5*Te;if(y){const ft=He.map(xt=>Ce(xt,y,B));He=ft.some(xt=>xt.signedDistanceFromCamera<=0)?[]:ft.map(xt=>xt.point)}let St=[];if(He.length>0){const ft=He[0].clone(),xt=He[0].clone();for(let wt=1;wt<He.length;wt++)ft.x=Math.min(ft.x,He[wt].x),ft.y=Math.min(ft.y,He[wt].y),xt.x=Math.max(xt.x,He[wt].x),xt.y=Math.max(xt.y,He[wt].y);St=ft.x>=ye.x&&xt.x<=Ae.x&&ft.y>=ye.y&&xt.y<=Ae.y?[He]:xt.x<ye.x||ft.x>Ae.x||xt.y<ye.y||ft.y>Ae.y?[]:c.clipLine([He],ye.x,ye.y,Ae.x,Ae.y)}for(const ft of St){je.reset(ft,.25*Te);let xt=0;xt=je.length<=.5*Te?1:Math.ceil(je.paddedLength/Pt)+1;for(let wt=0;wt<xt;wt++){const Ii=wt/Math.max(xt-1,1),yr=je.lerp(Ii),hr=yr.x+Ft,$t=yr.y+Ft;L.push(hr,$t,Te,0);const Gr=hr-Te,Ai=$t-Te,Ci=hr+Te,Qr=$t+Te;if(pe=pe&&this.isOffscreen(Gr,Ai,Ci,Qr),he=he||this.isInsideGrid(Gr,Ai,Ci,Qr),t!=="always"&&this.grid.hitTestCircle(hr,$t,Te,t,E)&&(se=!0,!b))return{circles:[],offscreen:!1,collisionDetected:se}}}}return{circles:!b&&se||!he||Z<this.perspectiveRatioCutoff?[]:L,offscreen:pe,collisionDetected:se}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[];let a=1/0,h=1/0,d=-1/0,m=-1/0;for(const S of t){const E=new c.pointGeometry(S.x+Ft,S.y+Ft);a=Math.min(a,E.x),h=Math.min(h,E.y),d=Math.max(d,E.x),m=Math.max(m,E.y),n.push(E)}const _=this.grid.query(a,h,d,m).concat(this.ignoredGrid.query(a,h,d,m)),y={},b={};for(const S of _){const E=S.key;if(y[E.bucketInstanceId]===void 0&&(y[E.bucketInstanceId]={}),y[E.bucketInstanceId][E.featureIndex])continue;const M=[new c.pointGeometry(S.x1,S.y1),new c.pointGeometry(S.x2,S.y1),new c.pointGeometry(S.x2,S.y2),new c.pointGeometry(S.x1,S.y2)];c.polygonIntersectsPolygon(n,M)&&(y[E.bucketInstanceId][E.featureIndex]=!0,b[E.bucketInstanceId]===void 0&&(b[E.bucketInstanceId]=[]),b[E.bucketInstanceId].push(E.featureIndex))}return b}insertCollisionBox(t,n,a,h,d,m){(a?this.ignoredGrid:this.grid).insert({bucketInstanceId:h,featureIndex:d,collisionGroupID:m,overlapMode:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,a,h,d,m){const _=a?this.ignoredGrid:this.grid,y={bucketInstanceId:h,featureIndex:d,collisionGroupID:m,overlapMode:n};for(let b=0;b<t.length;b+=4)_.insertCircle(y,t[b],t[b+1],t[b+2])}projectAndGetPerspectiveRatio(t,n,a,h){let d;return h?(d=[n,a,h(n,a),1],c.transformMat4(d,d,t)):(d=[n,a,0,1],ri(d,d,t)),{point:new c.pointGeometry((d[0]/d[3]+1)/2*this.transform.width+Ft,(-d[1]/d[3]+1)/2*this.transform.height+Ft),perspectiveRatio:.5+this.transform.cameraToCenterDistance/d[3]*.5}}isOffscreen(t,n,a,h){return a<Ft||t>=this.screenRightBoundary||h<Ft||n>this.screenBottomBoundary}isInsideGrid(t,n,a,h){return a>=0&&t<this.gridRightBoundary&&h>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=c.identity([]);return c.translate(t,t,[-100,-100,0]),t}}function st(o,t,n){return t*(c.EXTENT/(o.tileSize*Math.pow(2,n-o.tileID.overscaledZ)))}class fn{constructor(t,n,a,h){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):h&&a?1:0,this.placed=a}isHidden(){return this.opacity===0&&!this.placed}}class ee{constructor(t,n,a,h,d){this.text=new fn(t?t.text:null,n,a,d),this.icon=new fn(t?t.icon:null,n,h,d)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class ne{constructor(t,n,a){this.text=t,this.icon=n,this.skipFade=a}}class ce{constructor(){this.invProjMatrix=c.create(),this.viewportMatrix=c.create(),this.circles=[]}}class fe{constructor(t,n,a,h,d){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=a,this.bucketIndex=h,this.tileID=d}}class ge{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const n=++this.maxGroupID;this.collisionGroups[t]={ID:n,predicate:a=>a.collisionGroupID===n}}return this.collisionGroups[t]}}function we(o,t,n,a,h){const{horizontalAlign:d,verticalAlign:m}=c.getAnchorAlignment(o),_=-(d-.5)*t,y=-(m-.5)*n,b=c.evaluateVariableOffset(o,a);return new c.pointGeometry(_+b[0]*h,y+b[1]*h)}function Se(o,t,n,a,h,d){const{x1:m,x2:_,y1:y,y2:b,anchorPointX:S,anchorPointY:E}=o,M=new c.pointGeometry(t,n);return a&&M._rotate(h?d:-d),{x1:m+M.x,y1:y+M.y,x2:_+M.x,y2:b+M.y,anchorPointX:S,anchorPointY:E}}class _e{constructor(t,n,a,h,d){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new Ct(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new ge(h),this.collisionCircleArrays={},this.prevPlacement=d,d&&(d.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,a,h){const d=a.getBucket(n),m=a.latestFeatureIndex;if(!d||!m||n.id!==d.layerIds[0])return;const _=a.collisionBoxArray,y=d.layers[0].layout,b=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),S=a.tileSize/c.EXTENT,E=this.transform.calculatePosMatrix(a.tileID.toUnwrapped()),M=y.get("text-pitch-alignment")==="map",D=y.get("text-rotation-alignment")==="map",B=st(a,1,this.transform.zoom),L=Ie(E,M,D,this.transform,B);let N=null;if(M){const Z=Pe(E,M,D,this.transform,B);N=c.multiply([],this.transform.labelPlaneMatrix,Z)}this.retainedQueryData[d.bucketInstanceId]=new fe(d.bucketInstanceId,m,d.sourceLayerIndex,d.index,a.tileID);const X={bucket:d,layout:y,posMatrix:E,textLabelPlaneMatrix:L,labelToScreenMatrix:N,scale:b,textPixelRatio:S,holdingForFade:a.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:c.evaluateSizeForZoom(d.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(d.sourceID)};if(h)for(const Z of d.sortKeyRanges){const{sortKey:U,symbolInstanceStart:W,symbolInstanceEnd:te}=Z;t.push({sortKey:U,symbolInstanceStart:W,symbolInstanceEnd:te,parameters:X})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:d.symbolInstances.length,parameters:X})}attemptAnchorPlacement(t,n,a,h,d,m,_,y,b,S,E,M,D,B,L,N){const X=[M.textOffset0,M.textOffset1],Z=we(t,a,h,X,d),U=this.collisionIndex.placeCollisionBox(Se(n,Z.x,Z.y,m,_,this.transform.angle),E,y,b,S.predicate,N);if((!L||this.collisionIndex.placeCollisionBox(Se(L,Z.x,Z.y,m,_,this.transform.angle),E,y,b,S.predicate,N).box.length!==0)&&U.box.length>0){let W;if(this.prevPlacement&&this.prevPlacement.variableOffsets[M.crossTileID]&&this.prevPlacement.placements[M.crossTileID]&&this.prevPlacement.placements[M.crossTileID].text&&(W=this.prevPlacement.variableOffsets[M.crossTileID].anchor),M.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[M.crossTileID]={textOffset:X,width:a,height:h,anchor:t,textBoxScale:d,prevAnchor:W},this.markUsedJustification(D,t,M,B),D.allowVerticalPlacement&&(this.markUsedOrientation(D,B,M),this.placedOrientations[M.crossTileID]=B),{shift:Z,placedGlyphBoxes:U}}}placeLayerBucketPart(t,n,a){const{bucket:h,layout:d,posMatrix:m,textLabelPlaneMatrix:_,labelToScreenMatrix:y,textPixelRatio:b,holdingForFade:S,collisionBoxArray:E,partiallyEvaluatedTextSize:M,collisionGroup:D}=t.parameters,B=d.get("text-optional"),L=d.get("icon-optional"),N=c.getOverlapMode(d,"text-overlap","text-allow-overlap"),X=N==="always",Z=c.getOverlapMode(d,"icon-overlap","icon-allow-overlap"),U=Z==="always",W=d.get("text-rotation-alignment")==="map",te=d.get("text-pitch-alignment")==="map",se=d.get("icon-text-fit")!=="none",he=d.get("symbol-z-order")==="viewport-y",pe=X&&(U||!h.hasIconData()||L),Te=U&&(X||!h.hasTextData()||B);!h.collisionArrays&&E&&h.deserializeCollisionBoxes(E);const ye=(Ae,je)=>{if(n[Ae.crossTileID])return;if(S)return void(this.placements[Ae.crossTileID]=new ne(!1,!1,!1));let rt=!1,nt=!1,He=!0,Pt=null,St={box:null,offscreen:null},ft={box:null,offscreen:null},xt=null,wt=null,Ii=null,yr=0,hr=0,$t=0;je.textFeatureIndex?yr=je.textFeatureIndex:Ae.useRuntimeCollisionCircles&&(yr=Ae.featureIndex),je.verticalTextFeatureIndex&&(hr=je.verticalTextFeatureIndex);const Gr=this.retainedQueryData[h.bucketInstanceId].tileID,Ai=this.terrain?(ei,Gt)=>this.terrain.getElevation(Gr,ei,Gt):null;for(const ei of["textBox","verticalTextBox","iconBox","verticalIconBox"]){const Gt=je[ei];Gt&&(Gt.elevation=Ai?Ai(Gt.anchorPointX,Gt.anchorPointY):0)}const Ci=je.textBox;if(Ci){const ei=It=>{let hi=c.WritingMode.horizontal;if(h.allowVerticalPlacement&&!It&&this.prevPlacement){const Di=this.prevPlacement.placedOrientations[Ae.crossTileID];Di&&(this.placedOrientations[Ae.crossTileID]=Di,hi=Di,this.markUsedOrientation(h,hi,Ae))}return hi},Gt=(It,hi)=>{if(h.allowVerticalPlacement&&Ae.numVerticalGlyphVertices>0&&je.verticalTextBox){for(const Di of h.writingModes)if(Di===c.WritingMode.vertical?(St=hi(),ft=St):St=It(),St&&St.box&&St.box.length)break}else St=It()};if(d.get("text-variable-anchor")){let It=d.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Ae.crossTileID]){const jt=this.prevPlacement.variableOffsets[Ae.crossTileID];It.indexOf(jt.anchor)>0&&(It=It.filter(er=>er!==jt.anchor),It.unshift(jt.anchor))}const hi=(jt,er,tr)=>{const Ln=jt.x2-jt.x1,Ks=jt.y2-jt.y1,dl=Ae.textBoxScale,pc=se&&Z==="never"?er:null;let en={box:[],offscreen:!1};const gs=N!=="never"?2*It.length:It.length;for(let Cr=0;Cr<gs;++Cr){const ur=this.attemptAnchorPlacement(It[Cr%It.length],jt,Ln,Ks,dl,W,te,b,m,D,Cr>=It.length?N:"never",Ae,h,tr,pc,Ai);if(ur&&(en=ur.placedGlyphBoxes,en&&en.box&&en.box.length)){rt=!0,Pt=ur.shift;break}}return en};Gt(()=>hi(Ci,je.iconBox,c.WritingMode.horizontal),()=>{const jt=je.verticalTextBox;return h.allowVerticalPlacement&&!(St&&St.box&&St.box.length)&&Ae.numVerticalGlyphVertices>0&&jt?hi(jt,je.verticalIconBox,c.WritingMode.vertical):{box:null,offscreen:null}}),St&&(rt=St.box,He=St.offscreen);const Di=ei(St&&St.box);if(!rt&&this.prevPlacement){const jt=this.prevPlacement.variableOffsets[Ae.crossTileID];jt&&(this.variableOffsets[Ae.crossTileID]=jt,this.markUsedJustification(h,jt.anchor,Ae,Di))}}else{const It=(hi,Di)=>{const jt=this.collisionIndex.placeCollisionBox(hi,N,b,m,D.predicate,Ai);return jt&&jt.box&&jt.box.length&&(this.markUsedOrientation(h,Di,Ae),this.placedOrientations[Ae.crossTileID]=Di),jt};Gt(()=>It(Ci,c.WritingMode.horizontal),()=>{const hi=je.verticalTextBox;return h.allowVerticalPlacement&&Ae.numVerticalGlyphVertices>0&&hi?It(hi,c.WritingMode.vertical):{box:null,offscreen:null}}),ei(St&&St.box&&St.box.length)}}if(xt=St,rt=xt&&xt.box&&xt.box.length>0,He=xt&&xt.offscreen,Ae.useRuntimeCollisionCircles){const ei=h.text.placedSymbolArray.get(Ae.centerJustifiedTextSymbolIndex),Gt=c.evaluateSizeForFeature(h.textSizeData,M,ei),It=d.get("text-padding");wt=this.collisionIndex.placeCollisionCircles(N,ei,h.lineVertexArray,h.glyphOffsetArray,Gt,m,_,y,a,te,D.predicate,Ae.collisionCircleDiameter,It,Ai),wt.circles.length&&wt.collisionDetected&&!a&&c.warnOnce("Collisions detected, but collision boxes are not shown"),rt=X||wt.circles.length>0&&!wt.collisionDetected,He=He&&wt.offscreen}if(je.iconFeatureIndex&&($t=je.iconFeatureIndex),je.iconBox){const ei=Gt=>{const It=se&&Pt?Se(Gt,Pt.x,Pt.y,W,te,this.transform.angle):Gt;return this.collisionIndex.placeCollisionBox(It,Z,b,m,D.predicate,Ai)};ft&&ft.box&&ft.box.length&&je.verticalIconBox?(Ii=ei(je.verticalIconBox),nt=Ii.box.length>0):(Ii=ei(je.iconBox),nt=Ii.box.length>0),He=He&&Ii.offscreen}const Qr=B||Ae.numHorizontalGlyphVertices===0&&Ae.numVerticalGlyphVertices===0,zn=L||Ae.numIconVertices===0;if(Qr||zn?zn?Qr||(nt=nt&&rt):rt=nt&&rt:nt=rt=nt&&rt,rt&&xt&&xt.box&&this.collisionIndex.insertCollisionBox(xt.box,N,d.get("text-ignore-placement"),h.bucketInstanceId,ft&&ft.box&&hr?hr:yr,D.ID),nt&&Ii&&this.collisionIndex.insertCollisionBox(Ii.box,Z,d.get("icon-ignore-placement"),h.bucketInstanceId,$t,D.ID),wt&&(rt&&this.collisionIndex.insertCollisionCircles(wt.circles,N,d.get("text-ignore-placement"),h.bucketInstanceId,yr,D.ID),a)){const ei=h.bucketInstanceId;let Gt=this.collisionCircleArrays[ei];Gt===void 0&&(Gt=this.collisionCircleArrays[ei]=new ce);for(let It=0;It<wt.circles.length;It+=4)Gt.circles.push(wt.circles[It+0]),Gt.circles.push(wt.circles[It+1]),Gt.circles.push(wt.circles[It+2]),Gt.circles.push(wt.collisionDetected?1:0)}if(Ae.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(h.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Ae.crossTileID]=new ne(rt||pe,nt||Te,He||h.justReloaded),n[Ae.crossTileID]=!0};if(he){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ae=h.getSortedSymbolIndexes(this.transform.angle);for(let je=Ae.length-1;je>=0;--je){const rt=Ae[je];ye(h.symbolInstances.get(rt),h.collisionArrays[rt])}}else for(let Ae=t.symbolInstanceStart;Ae<t.symbolInstanceEnd;Ae++)ye(h.symbolInstances.get(Ae),h.collisionArrays[Ae]);if(a&&h.bucketInstanceId in this.collisionCircleArrays){const Ae=this.collisionCircleArrays[h.bucketInstanceId];c.invert(Ae.invProjMatrix,m),Ae.viewportMatrix=this.collisionIndex.getViewportMatrix()}h.justReloaded=!1}markUsedJustification(t,n,a,h){let d;d=h===c.WritingMode.vertical?a.verticalPlacedTextSymbolIndex:{left:a.leftJustifiedTextSymbolIndex,center:a.centerJustifiedTextSymbolIndex,right:a.rightJustifiedTextSymbolIndex}[c.getAnchorJustification(n)];const m=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex,a.verticalPlacedTextSymbolIndex];for(const _ of m)_>=0&&(t.text.placedSymbolArray.get(_).crossTileID=d>=0&&_!==d?0:a.crossTileID)}markUsedOrientation(t,n,a){const h=n===c.WritingMode.horizontal||n===c.WritingMode.horizontalOnly?n:0,d=n===c.WritingMode.vertical?n:0,m=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex];for(const _ of m)t.text.placedSymbolArray.get(_).placedOrientation=h;a.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).placedOrientation=d)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let a=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const h=n?n.symbolFadeChange(t):1,d=n?n.opacities:{},m=n?n.variableOffsets:{},_=n?n.placedOrientations:{};for(const y in this.placements){const b=this.placements[y],S=d[y];S?(this.opacities[y]=new ee(S,h,b.text,b.icon),a=a||b.text!==S.text.placed||b.icon!==S.icon.placed):(this.opacities[y]=new ee(null,h,b.text,b.icon,b.skipFade),a=a||b.text||b.icon)}for(const y in d){const b=d[y];if(!this.opacities[y]){const S=new ee(b,h,!1,!1);S.isHidden()||(this.opacities[y]=S,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(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");a?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const a={};for(const h of n){const d=h.getBucket(t);d&&h.latestFeatureIndex&&t.id===d.layerIds[0]&&this.updateBucketOpacities(d,a,h.collisionBoxArray)}}updateBucketOpacities(t,n,a){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const h=t.layers[0].layout,d=new ee(null,0,!1,!1,!0),m=h.get("text-allow-overlap"),_=h.get("icon-allow-overlap"),y=h.get("text-variable-anchor"),b=h.get("text-rotation-alignment")==="map",S=h.get("text-pitch-alignment")==="map",E=h.get("icon-text-fit")!=="none",M=new ee(null,0,m&&(_||!t.hasIconData()||h.get("icon-optional")),_&&(m||!t.hasTextData()||h.get("text-optional")),!0);!t.collisionArrays&&a&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(a);const D=(B,L,N)=>{for(let X=0;X<L/4;X++)B.opacityVertexArray.emplaceBack(N);B.hasVisibleVertices=B.hasVisibleVertices||N!==dt};for(let B=0;B<t.symbolInstances.length;B++){const L=t.symbolInstances.get(B),{numHorizontalGlyphVertices:N,numVerticalGlyphVertices:X,crossTileID:Z}=L;let U=this.opacities[Z];n[Z]?U=d:U||(U=M,this.opacities[Z]=U),n[Z]=!0;const W=L.numIconVertices>0,te=this.placedOrientations[L.crossTileID],se=te===c.WritingMode.vertical,he=te===c.WritingMode.horizontal||te===c.WritingMode.horizontalOnly;if(N>0||X>0){const pe=Ut(U.text);D(t.text,N,se?dt:pe),D(t.text,X,he?dt:pe);const Te=U.text.isHidden();[L.rightJustifiedTextSymbolIndex,L.centerJustifiedTextSymbolIndex,L.leftJustifiedTextSymbolIndex].forEach(je=>{je>=0&&(t.text.placedSymbolArray.get(je).hidden=Te||se?1:0)}),L.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(L.verticalPlacedTextSymbolIndex).hidden=Te||he?1:0);const ye=this.variableOffsets[L.crossTileID];ye&&this.markUsedJustification(t,ye.anchor,L,te);const Ae=this.placedOrientations[L.crossTileID];Ae&&(this.markUsedJustification(t,"left",L,Ae),this.markUsedOrientation(t,Ae,L))}if(W){const pe=Ut(U.icon),Te=!(E&&L.verticalPlacedIconSymbolIndex&&se);L.placedIconSymbolIndex>=0&&(D(t.icon,L.numIconVertices,Te?pe:dt),t.icon.placedSymbolArray.get(L.placedIconSymbolIndex).hidden=U.icon.isHidden()),L.verticalPlacedIconSymbolIndex>=0&&(D(t.icon,L.numVerticalIconVertices,Te?dt:pe),t.icon.placedSymbolArray.get(L.verticalPlacedIconSymbolIndex).hidden=U.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const pe=t.collisionArrays[B];if(pe){let Te=new c.pointGeometry(0,0);if(pe.textBox||pe.verticalTextBox){let Ae=!0;if(y){const je=this.variableOffsets[Z];je?(Te=we(je.anchor,je.width,je.height,je.textOffset,je.textBoxScale),b&&Te._rotate(S?this.transform.angle:-this.transform.angle)):Ae=!1}pe.textBox&&ke(t.textCollisionBox.collisionVertexArray,U.text.placed,!Ae||se,Te.x,Te.y),pe.verticalTextBox&&ke(t.textCollisionBox.collisionVertexArray,U.text.placed,!Ae||he,Te.x,Te.y)}const ye=Boolean(!he&&pe.verticalIconBox);pe.iconBox&&ke(t.iconCollisionBox.collisionVertexArray,U.icon.placed,ye,E?Te.x:0,E?Te.y:0),pe.verticalIconBox&&ke(t.iconCollisionBox.collisionVertexArray,U.icon.placed,!ye,E?Te.x:0,E?Te.y:0)}}}if(t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);if(t.bucketInstanceId in this.collisionCircleArrays){const B=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=B.invProjMatrix,t.placementViewportMatrix=B.viewportMatrix,t.collisionCircleArray=B.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,n){const a=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*a>t}setStale(){this.stale=!0}}function ke(o,t,n,a,h){o.emplaceBack(t?1:0,n?1:0,a||0,h||0),o.emplaceBack(t?1:0,n?1:0,a||0,h||0),o.emplaceBack(t?1:0,n?1:0,a||0,h||0),o.emplaceBack(t?1:0,n?1:0,a||0,h||0)}const le=Math.pow(2,25),et=Math.pow(2,24),pt=Math.pow(2,17),De=Math.pow(2,16),ot=Math.pow(2,9),yt=Math.pow(2,8),Ot=Math.pow(2,1);function Ut(o){if(o.opacity===0&&!o.placed)return 0;if(o.opacity===1&&o.placed)return 4294967295;const t=o.placed?1:0,n=Math.floor(127*o.opacity);return n*le+t*et+n*pt+t*De+n*ot+t*yt+n*Ot+t}const dt=0;class fi{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,n,a,h,d){const m=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(m,h,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,d())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,m.sort((_,y)=>_.sortKey-y.sortKey));this._currentPartIndex<m.length;)if(n.placeLayerBucketPart(m[this._currentPartIndex],this._seenCrossTileIDs,a),this._currentPartIndex++,d())return!0;return!1}}class ci{constructor(t,n,a,h,d,m,_,y){this.placement=new _e(t,n,m,_,y),this._currentPlacementIndex=a.length-1,this._forceFullPlacement=h,this._showCollisionBoxes=d,this._done=!1}isDone(){return this._done}continuePlacement(t,n,a){const h=c.exported.now(),d=()=>{const m=c.exported.now()-h;return!this._forceFullPlacement&&m>2};for(;this._currentPlacementIndex>=0;){const m=n[t[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(m.type==="symbol"&&(!m.minzoom||m.minzoom<=_)&&(!m.maxzoom||m.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new fi(m)),this._inProgressLayer.continuePlacement(a[m.source],this.placement,this._showCollisionBoxes,m,d))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Tt=512/c.EXTENT/2;class ai{constructor(t,n,a){this.tileID=t,this.bucketInstanceId=a,this._symbolsByKey={};const h=new Map;for(let d=0;d<n.length;d++){const m=n.get(d),_=m.key,y=h.get(_);y?y.push(m):h.set(_,[m])}for(const[d,m]of h){const _={positions:m.map(y=>({x:Math.floor(y.anchorX*Tt),y:Math.floor(y.anchorY*Tt)})),crossTileIDs:m.map(y=>y.crossTileID)};if(_.positions.length>128){const y=new c.KDBush(_.positions,b=>b.x,b=>b.y,16,Uint16Array);delete y.points,delete _.positions,_.index=y}this._symbolsByKey[d]=_}}getScaledCoordinates(t,n){const{x:a,y:h,z:d}=this.tileID.canonical,{x:m,y:_,z:y}=n.canonical,b=Tt/Math.pow(2,y-d),S=(_*c.EXTENT+t.anchorY)*b,E=h*c.EXTENT*Tt;return{x:Math.floor((m*c.EXTENT+t.anchorX)*b-a*c.EXTENT*Tt),y:Math.floor(S-E)}}findMatches(t,n,a){const h=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let d=0;d<t.length;d++){const m=t.get(d);if(m.crossTileID)continue;const _=this._symbolsByKey[m.key];if(!_)continue;const y=this.getScaledCoordinates(m,n);if(_.index){const b=_.index.range(y.x-h,y.y-h,y.x+h,y.y+h).sort();for(const S of b){const E=_.crossTileIDs[S];if(!a[E]){a[E]=!0,m.crossTileID=E;break}}}else if(_.positions)for(let b=0;b<_.positions.length;b++){const S=_.positions[b],E=_.crossTileIDs[b];if(Math.abs(S.x-y.x)<=h&&Math.abs(S.y-y.y)<=h&&!a[E]){a[E]=!0,m.crossTileID=E;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:t})=>t)}}class Ti{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class gn{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const a in this.indexes){const h=this.indexes[a],d={};for(const m in h){const _=h[m];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+n),d[_.tileID.key]=_}this.indexes[a]=d}this.lng=t}addBucket(t,n,a){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let d=0;d<n.symbolInstances.length;d++)n.symbolInstances.get(d).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const h=this.usedCrossTileIDs[t.overscaledZ];for(const d in this.indexes){const m=this.indexes[d];if(Number(d)>t.overscaledZ)for(const _ in m){const y=m[_];y.tileID.isChildOf(t)&&y.findMatches(n.symbolInstances,t,h)}else{const _=m[t.scaledTo(Number(d)).key];_&&_.findMatches(n.symbolInstances,t,h)}}for(let d=0;d<n.symbolInstances.length;d++){const m=n.symbolInstances.get(d);m.crossTileID||(m.crossTileID=a.generate(),h[m.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new ai(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const a of n.getCrossTileIDsLists())for(const h of a)delete this.usedCrossTileIDs[t][h]}removeStaleBuckets(t){let n=!1;for(const a in this.indexes){const h=this.indexes[a];for(const d in h)t[h[d].bucketInstanceId]||(this.removeBucketCrossTileIDs(a,h[d]),delete h[d],n=!0)}return n}}class Ui{constructor(){this.layerIndexes={},this.crossTileIDs=new Ti,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,a){let h=this.layerIndexes[t.id];h===void 0&&(h=this.layerIndexes[t.id]=new gn);let d=!1;const m={};h.handleWrapJump(a);for(const _ of n){const y=_.getBucket(t);y&&t.id===y.layerIds[0]&&(y.bucketInstanceId||(y.bucketInstanceId=++this.maxBucketInstanceId),h.addBucket(_.tileID,y,this.crossTileIDs)&&(d=!0),m[y.bucketInstanceId]=!0)}return h.removeStaleBuckets(m)&&(d=!0),d}pruneUnusedLayers(t){const n={};t.forEach(a=>{n[a]=!0});for(const a in this.layerIndexes)n[a]||delete this.layerIndexes[a]}}const Is=(o,t)=>c.emitValidationErrors(o,t&&t.filter(n=>n.identifier!=="source.canvas")),Ao=c.pick(gt,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),Yi=c.pick(gt,["setCenter","setZoom","setBearing","setPitch"]),As=function(){const o={},t=c.spec.$version;for(const n in c.spec.$root){const a=c.spec.$root[n];if(a.required){let h=null;h=n==="version"?t:a.type==="array"?[]:{},h!=null&&(o[n]=h)}}return o}();class di extends c.Evented{constructor(t,n={}){super(),this.map=t,this.dispatcher=new Fr(Xr(),this),this.imageManager=new Ki,this.imageManager.setEventedParent(this),this.glyphManager=new Rr(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new Br(256,512),this.crossTileSymbolIndex=new Ui,this._spritesImagesIds={},this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new c.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",c.getReferrer());const a=this;this._rtlTextPluginCallback=di.registerForPluginStateChange(h=>{a.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:h.pluginStatus,pluginURL:h.pluginURL},(d,m)=>{if(c.triggerPluginCompletionEvent(d),m&&m.every(_=>_))for(const _ in a.sourceCaches)a.sourceCaches[_].reload()})}),this.on("data",h=>{if(h.dataType!=="source"||h.sourceDataType!=="metadata")return;const d=this.sourceCaches[h.sourceId];if(!d)return;const m=d.getSource();if(m&&m.vectorLayerIds)for(const _ in this._layers){const y=this._layers[_];y.source===m.id&&this._validateLayer(y)}})}loadURL(t,n={},a){this.fire(new c.Event("dataloading",{dataType:"style"})),n.validate=typeof n.validate!="boolean"||n.validate;const h=this.map._requestManager.transformRequest(t,c.ResourceType.Style);this._request=c.getJSON(h,(d,m)=>{this._request=null,d?this.fire(new c.ErrorEvent(d)):m&&this._load(m,n,a)})}loadJSON(t,n={},a){this.fire(new c.Event("dataloading",{dataType:"style"})),this._request=c.exported.frame(()=>{this._request=null,n.validate=n.validate!==!1,this._load(t,n,a)})}loadEmpty(){this.fire(new c.Event("dataloading",{dataType:"style"})),this._load(As,{validate:!1})}_load(t,n,a){const h=n.transformStyle?n.transformStyle(a,t):t;if(n.validate&&Is(this,c.validateStyle(h)))return;this._loaded=!0,this.stylesheet=h;for(const m in h.sources)this.addSource(m,h.sources[m],{validate:!1});h.sprite?this._loadSprite(h.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(h.glyphs);const d=Wr(this.stylesheet.layers);this._order=d.map(m=>m.id),this._layers={},this._serializedLayers={};for(let m of d)m=c.createStyleLayer(m),m.setEventedParent(this,{layer:{id:m.id}}),this._layers[m.id]=m,this._serializedLayers[m.id]=m.serialize();this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new ln(this.stylesheet.light),this.map.setTerrain(this.stylesheet.terrain),this.fire(new c.Event("data",{dataType:"style"})),this.fire(new c.Event("style.load"))}_loadSprite(t,n=!1,a){this.imageManager.setLoaded(!1),this._spriteRequest=function(h,d,m,_){const y=Yt(h),b=m>1?"@2x":"";let S;const E=[],M=[],D={},B={};for(const{id:N,url:X}of y){const Z=E.push(c.getJSON(d.transformRequest(d.normalizeSpriteURL(X,b,".json"),c.ResourceType.SpriteJSON),(W,te)=>{E.splice(Z,1),S||(S=W,D[N]=te,L())})),U=M.push(c.getImage(d.transformRequest(d.normalizeSpriteURL(X,b,".png"),c.ResourceType.SpriteImage),(W,te)=>{M.splice(U,1),S||(S=W,B[N]=te,L())}))}function L(){const N=Object.values(D).length,X=Object.values(B).length;if(S)_(S);else if(y.length===N&&N===X){const Z={};for(const U in D){Z[U]={};const W=c.exported.getImageData(B[U]),te=D[U];for(const se in te){const{width:he,height:pe,x:Te,y:ye,sdf:Ae,pixelRatio:je,stretchX:rt,stretchY:nt,content:He}=te[se],Pt=new c.RGBAImage({width:he,height:pe});c.RGBAImage.copy(W,Pt,{x:Te,y:ye},{x:0,y:0},{width:he,height:pe}),Z[U][se]={data:Pt,pixelRatio:je,sdf:Ae,stretchX:rt,stretchY:nt,content:He}}}_(null,Z)}}return{cancel(){if(E.length)for(const N of E)N.cancel(),E.splice(E.indexOf(N),1);if(M.length)for(const N of M)N.cancel(),M.splice(M.indexOf(N),1)}}}(t,this.map._requestManager,this.map.getPixelRatio(),(h,d)=>{if(this._spriteRequest=null,h)this.fire(new c.ErrorEvent(h));else if(d)for(const m in d){this._spritesImagesIds[m]=[];const _=this._spritesImagesIds[m]?this._spritesImagesIds[m].filter(y=>!(y in d)):[];for(const y of _)this.imageManager.removeImage(y),this._changedImages[y]=!0;for(const y in d[m]){const b=m==="default"?y:`${m}:${y}`;this._spritesImagesIds[m].push(b),b in this.imageManager.images?this.imageManager.updateImage(b,d[m][y],!1):this.imageManager.addImage(b,d[m][y]),n&&(this._changedImages[b]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new c.Event("data",{dataType:"style"})),a&&a(h)})}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new c.Event("data",{dataType:"style"}))}_validateLayer(t){const n=this.sourceCaches[t.source];if(!n)return;const a=t.sourceLayer;if(!a)return;const h=n.getSource();(h.type==="geojson"||h.vectorLayerIds&&h.vectorLayerIds.indexOf(a)===-1)&&this.fire(new c.ErrorEvent(new Error(`Source layer "${a}" does not exist on source "${h.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(t){const n=[];for(const a of t){const h=this._layers[a];h.type!=="custom"&&n.push(h.serialize())}return n}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const n=this._changed;if(this._changed){const h=Object.keys(this._updatedLayers),d=Object.keys(this._removedLayers);(h.length||d.length)&&this._updateWorkerLayers(h,d);for(const m in this._updatedSources){const _=this._updatedSources[m];if(_==="reload")this._reloadSource(m);else{if(_!=="clear")throw new Error(`Invalid action ${_}`);this._clearSource(m)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const m in this._updatedPaintProps)this._layers[m].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const a={};for(const h in this.sourceCaches){const d=this.sourceCaches[h];a[h]=d.used,d.used=!1}for(const h of this._order){const d=this._layers[h];d.recalculate(t,this._availableImages),!d.isHidden(t.zoom)&&d.source&&(this.sourceCaches[d.source].used=!0)}for(const h in a){const d=this.sourceCaches[h];a[h]!==d.used&&d.fire(new c.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:h}))}this.light.recalculate(t),this.z=t.zoom,n&&this.fire(new c.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,n){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,n={}){if(this._checkLoaded(),t=n.transformStyle?n.transformStyle(this.serialize(),t):t,Is(this,c.validateStyle(t)))return!1;(t=c.clone$1(t)).layers=Wr(t.layers);const a=function(d,m){if(!d)return[{command:gt.setStyle,args:[m]}];let _=[];try{if(!Me(d.version,m.version))return[{command:gt.setStyle,args:[m]}];Me(d.center,m.center)||_.push({command:gt.setCenter,args:[m.center]}),Me(d.zoom,m.zoom)||_.push({command:gt.setZoom,args:[m.zoom]}),Me(d.bearing,m.bearing)||_.push({command:gt.setBearing,args:[m.bearing]}),Me(d.pitch,m.pitch)||_.push({command:gt.setPitch,args:[m.pitch]}),Me(d.sprite,m.sprite)||_.push({command:gt.setSprite,args:[m.sprite]}),Me(d.glyphs,m.glyphs)||_.push({command:gt.setGlyphs,args:[m.glyphs]}),Me(d.transition,m.transition)||_.push({command:gt.setTransition,args:[m.transition]}),Me(d.light,m.light)||_.push({command:gt.setLight,args:[m.light]});const y={},b=[];(function(E,M,D,B){let L;for(L in M=M||{},E=E||{})Object.prototype.hasOwnProperty.call(E,L)&&(Object.prototype.hasOwnProperty.call(M,L)||re(L,D,B));for(L in M)Object.prototype.hasOwnProperty.call(M,L)&&(Object.prototype.hasOwnProperty.call(E,L)?Me(E[L],M[L])||(E[L].type==="geojson"&&M[L].type==="geojson"&&R(E,M,L)?D.push({command:gt.setGeoJSONSourceData,args:[L,M[L].data]}):z(L,M,D,B)):mn(L,M,D))})(d.sources,m.sources,b,y);const S=[];d.layers&&d.layers.forEach(E=>{y[E.source]?_.push({command:gt.removeLayer,args:[E.id]}):S.push(E)}),_=_.concat(b),function(E,M,D){M=M||[];const B=(E=E||[]).map(Q),L=M.map(Q),N=E.reduce(V,{}),X=M.reduce(V,{}),Z=B.slice(),U=Object.create(null);let W,te,se,he,pe,Te,ye;for(W=0,te=0;W<B.length;W++)se=B[W],Object.prototype.hasOwnProperty.call(X,se)?te++:(D.push({command:gt.removeLayer,args:[se]}),Z.splice(Z.indexOf(se,te),1));for(W=0,te=0;W<L.length;W++)se=L[L.length-1-W],Z[Z.length-1-W]!==se&&(Object.prototype.hasOwnProperty.call(N,se)?(D.push({command:gt.removeLayer,args:[se]}),Z.splice(Z.lastIndexOf(se,Z.length-te),1)):te++,Te=Z[Z.length-W],D.push({command:gt.addLayer,args:[X[se],Te]}),Z.splice(Z.length-W,0,se),U[se]=!0);for(W=0;W<L.length;W++)if(se=L[W],he=N[se],pe=X[se],!U[se]&&!Me(he,pe))if(Me(he.source,pe.source)&&Me(he["source-layer"],pe["source-layer"])&&Me(he.type,pe.type)){for(ye in G(he.layout,pe.layout,D,se,null,gt.setLayoutProperty),G(he.paint,pe.paint,D,se,null,gt.setPaintProperty),Me(he.filter,pe.filter)||D.push({command:gt.setFilter,args:[se,pe.filter]}),Me(he.minzoom,pe.minzoom)&&Me(he.maxzoom,pe.maxzoom)||D.push({command:gt.setLayerZoomRange,args:[se,pe.minzoom,pe.maxzoom]}),he)Object.prototype.hasOwnProperty.call(he,ye)&&ye!=="layout"&&ye!=="paint"&&ye!=="filter"&&ye!=="metadata"&&ye!=="minzoom"&&ye!=="maxzoom"&&(ye.indexOf("paint.")===0?G(he[ye],pe[ye],D,se,ye.slice(6),gt.setPaintProperty):Me(he[ye],pe[ye])||D.push({command:gt.setLayerProperty,args:[se,ye,pe[ye]]}));for(ye in pe)Object.prototype.hasOwnProperty.call(pe,ye)&&!Object.prototype.hasOwnProperty.call(he,ye)&&ye!=="layout"&&ye!=="paint"&&ye!=="filter"&&ye!=="metadata"&&ye!=="minzoom"&&ye!=="maxzoom"&&(ye.indexOf("paint.")===0?G(he[ye],pe[ye],D,se,ye.slice(6),gt.setPaintProperty):Me(he[ye],pe[ye])||D.push({command:gt.setLayerProperty,args:[se,ye,pe[ye]]}))}else D.push({command:gt.removeLayer,args:[se]}),Te=Z[Z.lastIndexOf(se)+1],D.push({command:gt.addLayer,args:[pe,Te]})}(S,m.layers,_)}catch(y){console.warn("Unable to compute style diff:",y),_=[{command:gt.setStyle,args:[m]}]}return _}(this.serialize(),t).filter(d=>!(d.command in Yi));if(a.length===0)return!1;const h=a.filter(d=>!(d.command in Ao));if(h.length>0)throw new Error(`Unimplemented: ${h.map(d=>d.command).join(", ")}.`);return a.forEach(d=>{d.command!=="setTransition"&&this[d.command].apply(this,d.args)}),this.stylesheet=t,!0}addImage(t,n){if(this.getImage(t))return this.fire(new c.ErrorEvent(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(t,n){this.imageManager.updateImage(t,n)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new c.ErrorEvent(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new c.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,a={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(c.validateStyle.source,`sources.${t}`,n,null,a))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const h=this.sourceCaches[t]=new mi(t,n,this.dispatcher);h.style=this,h.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:h.serialize(),sourceId:t})),h.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(const a in this._layers)if(this._layers[a].source===t)return this.fire(new c.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${a}" is using it.`)));const n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new c.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,n){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const a=this.sourceCaches[t].getSource();if(a.type!=="geojson")throw new Error(`geojsonSource.type is ${a.type}, which is !== 'geojson`);a.setData(n),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,n,a={}){this._checkLoaded();const h=t.id;if(this.getLayer(h))return void this.fire(new c.ErrorEvent(new Error(`Layer "${h}" already exists on this map.`)));let d;if(t.type==="custom"){if(Is(this,c.validateCustomStyleLayer(t)))return;d=c.createStyleLayer(t)}else{if(typeof t.source=="object"&&(this.addSource(h,t.source),t=c.clone$1(t),t=c.extend(t,{source:h})),this._validate(c.validateStyle.layer,`layers.${h}`,t,{arrayIndex:-1},a))return;d=c.createStyleLayer(t),this._validateLayer(d),d.setEventedParent(this,{layer:{id:h}}),this._serializedLayers[d.id]=d.serialize()}const m=n?this._order.indexOf(n):this._order.length;if(n&&m===-1)this.fire(new c.ErrorEvent(new Error(`Cannot add layer "${h}" before non-existing layer "${n}".`)));else{if(this._order.splice(m,0,h),this._layerOrderChanged=!0,this._layers[h]=d,this._removedLayers[h]&&d.source&&d.type!=="custom"){const _=this._removedLayers[h];delete this._removedLayers[h],_.type!==d.type?this._updatedSources[d.source]="clear":(this._updatedSources[d.source]="reload",this.sourceCaches[d.source].pause())}this._updateLayer(d),d.onAdd&&d.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new c.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const a=this._order.indexOf(t);this._order.splice(a,1);const h=n?this._order.indexOf(n):this._order.length;n&&h===-1?this.fire(new c.ErrorEvent(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(h,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new c.ErrorEvent(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const a=this._order.indexOf(t);this._order.splice(a,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,a){this._checkLoaded();const h=this.getLayer(t);h?h.minzoom===n&&h.maxzoom===a||(n!=null&&(h.minzoom=n),a!=null&&(h.maxzoom=a),this._updateLayer(h)):this.fire(new c.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,a={}){this._checkLoaded();const h=this.getLayer(t);if(h){if(!Me(h.filter,n))return n==null?(h.filter=void 0,void this._updateLayer(h)):void(this._validate(c.validateStyle.filter,`layers.${h.id}.filter`,n,null,a)||(h.filter=c.clone$1(n),this._updateLayer(h)))}else this.fire(new c.ErrorEvent(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return c.clone$1(this.getLayer(t).filter)}setLayoutProperty(t,n,a,h={}){this._checkLoaded();const d=this.getLayer(t);d?Me(d.getLayoutProperty(n),a)||(d.setLayoutProperty(n,a,h),this._updateLayer(d)):this.fire(new c.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const a=this.getLayer(t);if(a)return a.getLayoutProperty(n);this.fire(new c.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,a,h={}){this._checkLoaded();const d=this.getLayer(t);d?Me(d.getPaintProperty(n),a)||(d.setPaintProperty(n,a,h)&&this._updateLayer(d),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new c.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const a=t.source,h=t.sourceLayer,d=this.sourceCaches[a];if(d===void 0)return void this.fire(new c.ErrorEvent(new Error(`The source '${a}' does not exist in the map's style.`)));const m=d.getSource().type;m==="geojson"&&h?this.fire(new c.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):m!=="vector"||h?(t.id===void 0&&this.fire(new c.ErrorEvent(new Error("The feature id parameter must be provided."))),d.setFeatureState(h,t.id,n)):this.fire(new c.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const a=t.source,h=this.sourceCaches[a];if(h===void 0)return void this.fire(new c.ErrorEvent(new Error(`The source '${a}' does not exist in the map's style.`)));const d=h.getSource().type,m=d==="vector"?t.sourceLayer:void 0;d!=="vector"||m?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new c.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):h.removeFeatureState(m,t.id,n):this.fire(new c.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,a=t.sourceLayer,h=this.sourceCaches[n];if(h!==void 0)return h.getSource().type!=="vector"||a?(t.id===void 0&&this.fire(new c.ErrorEvent(new Error("The feature id parameter must be provided."))),h.getFeatureState(a,t.id)):void this.fire(new c.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new c.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return c.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){return c.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:c.mapObject(this.sourceCaches,t=>t.serialize()),layers:this._serializeLayers(this._order)},t=>t!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0}_flattenAndSortRenderedFeatures(t){const n=m=>this._layers[m].type==="fill-extrusion",a={},h=[];for(let m=this._order.length-1;m>=0;m--){const _=this._order[m];if(n(_)){a[_]=m;for(const y of t){const b=y[_];if(b)for(const S of b)h.push(S)}}}h.sort((m,_)=>_.intersectionZ-m.intersectionZ);const d=[];for(let m=this._order.length-1;m>=0;m--){const _=this._order[m];if(n(_))for(let y=h.length-1;y>=0;y--){const b=h[y].feature;if(a[b.layer.id]<m)break;d.push(b),h.pop()}else for(const y of t){const b=y[_];if(b)for(const S of b)d.push(S.feature)}}return d}queryRenderedFeatures(t,n,a){n&&n.filter&&this._validate(c.validateStyle.filter,"queryRenderedFeatures.filter",n.filter,null,n);const h={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new c.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const m of n.layers){const _=this._layers[m];if(!_)return this.fire(new c.ErrorEvent(new Error(`The layer '${m}' does not exist in the map's style and cannot be queried for features.`))),[];h[_.source]=!0}}const d=[];n.availableImages=this._availableImages;for(const m in this.sourceCaches)n.layers&&!h[m]||d.push(jn(this.sourceCaches[m],this._layers,this._serializedLayers,t,n,a));return this.placement&&d.push(function(m,_,y,b,S,E,M){const D={},B=E.queryRenderedSymbols(b),L=[];for(const N of Object.keys(B).map(Number))L.push(M[N]);L.sort(dn);for(const N of L){const X=N.featureIndex.lookupSymbolFeatures(B[N.bucketInstanceId],_,N.bucketIndex,N.sourceLayerIndex,S.filter,S.layers,S.availableImages,m);for(const Z in X){const U=D[Z]=D[Z]||[],W=X[Z];W.sort((te,se)=>{const he=N.featureSortOrder;if(he){const pe=he.indexOf(te.featureIndex);return he.indexOf(se.featureIndex)-pe}return se.featureIndex-te.featureIndex});for(const te of W)U.push(te)}}for(const N in D)D[N].forEach(X=>{const Z=X.feature,U=y[m[N].source].getFeatureState(Z.layer["source-layer"],Z.id);Z.source=Z.layer.source,Z.layer["source-layer"]&&(Z.sourceLayer=Z.layer["source-layer"]),Z.state=U});return D}(this._layers,this._serializedLayers,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(d)}querySourceFeatures(t,n){n&&n.filter&&this._validate(c.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);const a=this.sourceCaches[t];return a?function(h,d){const m=h.getRenderableIds().map(b=>h.getTileByID(b)),_=[],y={};for(let b=0;b<m.length;b++){const S=m[b],E=S.tileID.canonical.key;y[E]||(y[E]=!0,S.querySourceFeatures(_,d))}return _}(a,n):[]}addSourceType(t,n,a){return di.getSourceType(t)?a(new Error(`A source type called "${t}" already exists.`)):(di.setSourceType(t,n),n.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:n.workerSourceURL},a):a(null,null))}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const a=this.light.getLight();let h=!1;for(const m in t)if(!Me(t[m],a[m])){h=!0;break}if(!h)return;const d={now:c.exported.now(),transition:c.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(d)}_validate(t,n,a,h,d={}){return(!d||d.validate!==!1)&&Is(this,t.call(c.validateStyle,c.extend({key:n,style:this.serialize(),value:a,styleSpec:c.spec},h)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),c.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this.sourceCaches){const n=this.sourceCaches[t];n.setEventedParent(null),n.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const n in this.sourceCaches)this.sourceCaches[n].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,n,a,h,d=!1){let m=!1,_=!1;const y={};for(const b of this._order){const S=this._layers[b];if(S.type!=="symbol")continue;if(!y[S.source]){const M=this.sourceCaches[S.source];y[S.source]=M.getRenderableIds(!0).map(D=>M.getTileByID(D)).sort((D,B)=>B.tileID.overscaledZ-D.tileID.overscaledZ||(D.tileID.isLessThan(B.tileID)?-1:1))}const E=this.crossTileSymbolIndex.addLayer(S,y[S.source],t.center.lng);m=m||E}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((d=d||this._layerOrderChanged||a===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(c.exported.now(),t.zoom))&&(this.pauseablePlacement=new ci(t,this.map.terrain,this._order,d,n,a,h,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(c.exported.now()),_=!0),m&&this.pauseablePlacement.placement.setStale()),_||m)for(const b of this._order){const S=this._layers[b];S.type==="symbol"&&this.placement.updateLayerOpacities(S,y[S.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(c.exported.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,n,a){this.imageManager.getImages(n.icons,a),this._updateTilesForChangedImages();const h=this.sourceCaches[n.source];h&&h.setDependencies(n.tileID.key,n.type,n.icons)}getGlyphs(t,n,a){this.glyphManager.getGlyphs(n.stacks,a);const h=this.sourceCaches[n.source];h&&h.setDependencies(n.tileID.key,n.type,[""])}getResource(t,n,a){return c.makeRequest(n,a)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,n={}){this._checkLoaded(),t&&this._validate(c.validateStyle.glyphs,"glyphs",t,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,n,a={},h){this._checkLoaded();const d=[{id:t,url:n}],m=[...Yt(this.stylesheet.sprite),...d];this._validate(c.validateStyle.sprite,"sprite",m,null,a)||(this.stylesheet.sprite=m,this._loadSprite(d,!0,h))}removeSprite(t){this._checkLoaded();const n=Yt(this.stylesheet.sprite);if(n.find(a=>a.id===t)){if(this._spritesImagesIds[t])for(const a of this._spritesImagesIds[t])this.imageManager.removeImage(a),this._changedImages[a]=!0;n.splice(n.findIndex(a=>a.id===t),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new c.Event("data",{dataType:"style"}))}else this.fire(new c.ErrorEvent(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return Yt(this.stylesheet.sprite)}setSprite(t,n={},a){this._checkLoaded(),t&&this._validate(c.validateStyle.sprite,"sprite",t,null,n)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,a):(this._unloadSprite(),a(null)))}}di.getSourceType=function(o){return Vr[o]},di.setSourceType=function(o,t){Vr[o]=t},di.registerForPluginStateChange=c.registerForPluginStateChange;var Zn=c.createLayout([{name:"a_pos",type:"Int16",components:2}]),_n="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";const Xn={prelude:Mt(`#ifdef GL_ES
3
3
  precision mediump float;
4
4
  #else
5
5
  #if !defined(lowp)
@@ -53,15 +53,15 @@ vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=frac
53
53
  #else
54
54
  return 0.0;
55
55
  #endif
56
- }`),background:Ct(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
56
+ }`),background:Mt(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
57
57
  #ifdef OVERDRAW_INSPECTOR
58
58
  gl_FragColor=vec4(1.0);
59
59
  #endif
60
- }`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:Ct(`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;
60
+ }`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:Mt(`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;
61
61
  #ifdef OVERDRAW_INSPECTOR
62
62
  gl_FragColor=vec4(1.0);
63
63
  #endif
64
- }`,"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:Ct(`varying vec3 v_data;varying float v_visibility;
64
+ }`,"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:Mt(`varying vec3 v_data;varying float v_visibility;
65
65
  #pragma mapbox: define highp vec4 color
66
66
  #pragma mapbox: define mediump float radius
67
67
  #pragma mapbox: define lowp float blur
@@ -97,7 +97,7 @@ void main(void) {
97
97
  #pragma mapbox: initialize highp vec4 stroke_color
98
98
  #pragma mapbox: initialize mediump float stroke_width
99
99
  #pragma mapbox: initialize lowp float stroke_opacity
100
- vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:Ct("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:Ct(`uniform highp float u_intensity;varying vec2 v_extrude;
100
+ vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:Mt("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:Mt(`uniform highp float u_intensity;varying vec2 v_extrude;
101
101
  #pragma mapbox: define highp float weight
102
102
  #define GAUSS_COEF 0.3989422804014327
103
103
  void main() {
@@ -114,11 +114,11 @@ const highp float ZERO=1.0/255.0/16.0;
114
114
  void main(void) {
115
115
  #pragma mapbox: initialize highp float weight
116
116
  #pragma mapbox: initialize mediump float radius
117
- vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`),heatmapTexture:Ct(`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;
117
+ vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`),heatmapTexture:Mt(`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;
118
118
  #ifdef OVERDRAW_INSPECTOR
119
119
  gl_FragColor=vec4(0.0);
120
120
  #endif
121
- }`,"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:Ct("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:Ct("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:Ct("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:Ct(`#pragma mapbox: define highp vec4 color
121
+ }`,"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:Mt("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:Mt("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:Mt("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:Mt(`#pragma mapbox: define highp vec4 color
122
122
  #pragma mapbox: define lowp float opacity
123
123
  void main() {
124
124
  #pragma mapbox: initialize highp vec4 color
@@ -133,7 +133,7 @@ gl_FragColor=vec4(1.0);
133
133
  void main() {
134
134
  #pragma mapbox: initialize highp vec4 color
135
135
  #pragma mapbox: initialize lowp float opacity
136
- gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:Ct(`varying vec2 v_pos;
136
+ gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:Mt(`varying vec2 v_pos;
137
137
  #pragma mapbox: define highp vec4 outline_color
138
138
  #pragma mapbox: define lowp float opacity
139
139
  void main() {
@@ -149,7 +149,7 @@ gl_FragColor=vec4(1.0);
149
149
  void main() {
150
150
  #pragma mapbox: initialize highp vec4 outline_color
151
151
  #pragma mapbox: initialize lowp float opacity
152
- gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:Ct(`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;
152
+ gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:Mt(`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;
153
153
  #pragma mapbox: define lowp float opacity
154
154
  #pragma mapbox: define lowp vec4 pattern_from
155
155
  #pragma mapbox: define lowp vec4 pattern_to
@@ -173,7 +173,7 @@ void main() {
173
173
  #pragma mapbox: initialize mediump vec4 pattern_to
174
174
  #pragma mapbox: initialize lowp float pixel_ratio_from
175
175
  #pragma mapbox: initialize lowp float pixel_ratio_to
176
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:Ct(`#ifdef GL_ES
176
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:Mt(`#ifdef GL_ES
177
177
  precision highp float;
178
178
  #endif
179
179
  uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
@@ -200,7 +200,7 @@ void main() {
200
200
  #pragma mapbox: initialize mediump vec4 pattern_to
201
201
  #pragma mapbox: initialize lowp float pixel_ratio_from
202
202
  #pragma mapbox: initialize lowp float pixel_ratio_to
203
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:Ct(`varying vec4 v_color;void main() {gl_FragColor=v_color;
203
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:Mt(`varying vec4 v_color;void main() {gl_FragColor=v_color;
204
204
  #ifdef OVERDRAW_INSPECTOR
205
205
  gl_FragColor=vec4(1.0);
206
206
  #endif
@@ -222,7 +222,7 @@ float baseDelta=10.0;float ele=get_elevation(a_centroid);
222
222
  #else
223
223
  float baseDelta=0.0;float ele=0.0;
224
224
  #endif
225
- base=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);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:Ct(`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;
225
+ base=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);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:Mt(`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;
226
226
  #pragma mapbox: define lowp float base
227
227
  #pragma mapbox: define lowp float height
228
228
  #pragma mapbox: define lowp vec4 pattern_from
@@ -266,20 +266,20 @@ float baseDelta=0.0;float ele=0.0;
266
266
  #endif
267
267
  base=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
268
268
  ? a_pos
269
- : 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:Ct(`#ifdef GL_ES
269
+ : 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:Mt(`#ifdef GL_ES
270
270
  precision highp float;
271
271
  #endif
272
272
  uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);
273
273
  #ifdef OVERDRAW_INSPECTOR
274
274
  gl_FragColor=vec4(1.0);
275
275
  #endif
276
- }`,"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:Ct(`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;
276
+ }`,"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:Mt(`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;
277
277
  #define PI 3.141592653589793
278
278
  void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;
279
279
  #ifdef OVERDRAW_INSPECTOR
280
280
  gl_FragColor=vec4(1.0);
281
281
  #endif
282
- }`,"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:Ct(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
282
+ }`,"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:Mt(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
283
283
  #pragma mapbox: define highp vec4 color
284
284
  #pragma mapbox: define lowp float blur
285
285
  #pragma mapbox: define lowp float opacity
@@ -313,7 +313,7 @@ v_gamma_scale=1.0;
313
313
  #else
314
314
  float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
315
315
  #endif
316
- v_width2=vec2(outset,inset);}`),lineGradient:Ct(`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;
316
+ v_width2=vec2(outset,inset);}`),lineGradient:Mt(`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;
317
317
  #pragma mapbox: define lowp float blur
318
318
  #pragma mapbox: define lowp float opacity
319
319
  void main() {
@@ -343,7 +343,7 @@ v_gamma_scale=1.0;
343
343
  #else
344
344
  float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
345
345
  #endif
346
- v_width2=vec2(outset,inset);}`),linePattern:Ct(`#ifdef GL_ES
346
+ v_width2=vec2(outset,inset);}`),linePattern:Mt(`#ifdef GL_ES
347
347
  precision highp float;
348
348
  #endif
349
349
  uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
@@ -395,7 +395,7 @@ v_gamma_scale=1.0;
395
395
  #else
396
396
  float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
397
397
  #endif
398
- v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:Ct(`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;
398
+ v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:Mt(`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;
399
399
  #pragma mapbox: define highp vec4 color
400
400
  #pragma mapbox: define lowp float blur
401
401
  #pragma mapbox: define lowp float opacity
@@ -436,11 +436,11 @@ v_gamma_scale=1.0;
436
436
  #else
437
437
  float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
438
438
  #endif
439
- v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:Ct(`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);
439
+ v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:Mt(`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);
440
440
  #ifdef OVERDRAW_INSPECTOR
441
441
  gl_FragColor=vec4(1.0);
442
442
  #endif
443
- }`,"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:Ct(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
443
+ }`,"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:Mt(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
444
444
  #pragma mapbox: define lowp float opacity
445
445
  void main() {
446
446
  #pragma mapbox: initialize lowp float opacity
@@ -454,7 +454,7 @@ void main() {
454
454
  #pragma mapbox: initialize lowp float opacity
455
455
  vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
456
456
  camera_to_anchor_distance/u_camera_to_center_distance :
457
- u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:Ct(`#define SDF_PX 8.0
457
+ u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:Mt(`#define SDF_PX 8.0
458
458
  uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;
459
459
  #pragma mapbox: define highp vec4 fill_color
460
460
  #pragma mapbox: define highp vec4 halo_color
@@ -485,7 +485,7 @@ void main() {
485
485
  #pragma mapbox: initialize lowp float halo_blur
486
486
  vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
487
487
  camera_to_anchor_distance/u_camera_to_center_distance :
488
- u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:Ct(`#define SDF_PX 8.0
488
+ u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:Mt(`#define SDF_PX 8.0
489
489
  #define SDF 1.0
490
490
  #define ICON 0.0
491
491
  uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;
@@ -522,7 +522,7 @@ void main() {
522
522
  #pragma mapbox: initialize lowp float halo_blur
523
523
  vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
524
524
  camera_to_anchor_distance/u_camera_to_center_distance :
525
- u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:Ct("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",gn),terrainDepth:Ct("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);}",gn),terrainCoords:Ct("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);}",gn)};function Ct(o,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,a=t.match(/attribute ([\w]+) ([\w]+)/g),h=o.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),p=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),m=p?p.concat(h):h,_={};return{fragmentSource:o=o.replace(n,(y,v,S,E,M)=>(_[M]=!0,v==="define"?`
525
+ u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:Mt("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",_n),terrainDepth:Mt("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);}",_n),terrainCoords:Mt("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);}",_n)};function Mt(o,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,a=t.match(/attribute ([\w]+) ([\w]+)/g),h=o.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),d=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),m=d?d.concat(h):h,_={};return{fragmentSource:o=o.replace(n,(y,b,S,E,M)=>(_[M]=!0,b==="define"?`
526
526
  #ifndef HAS_UNIFORM_u_${M}
527
527
  varying ${S} ${E} ${M};
528
528
  #else
@@ -532,7 +532,7 @@ uniform ${S} ${E} u_${M};
532
532
  #ifdef HAS_UNIFORM_u_${M}
533
533
  ${S} ${E} ${M} = u_${M};
534
534
  #endif
535
- `)),vertexSource:t=t.replace(n,(y,v,S,E,M)=>{const D=E==="float"?"vec2":"vec4",B=M.match(/color/)?"color":D;return _[M]?v==="define"?`
535
+ `)),vertexSource:t=t.replace(n,(y,b,S,E,M)=>{const D=E==="float"?"vec2":"vec4",B=M.match(/color/)?"color":D;return _[M]?b==="define"?`
536
536
  #ifndef HAS_UNIFORM_u_${M}
537
537
  uniform lowp float u_${M}_t;
538
538
  attribute ${S} ${D} a_${M};
@@ -552,7 +552,7 @@ uniform ${S} ${E} u_${M};
552
552
  #else
553
553
  ${S} ${E} ${M} = u_${M};
554
554
  #endif
555
- `:v==="define"?`
555
+ `:b==="define"?`
556
556
  #ifndef HAS_UNIFORM_u_${M}
557
557
  uniform lowp float u_${M}_t;
558
558
  attribute ${S} ${D} a_${M};
@@ -571,9 +571,9 @@ uniform ${S} ${E} u_${M};
571
571
  #else
572
572
  ${S} ${E} ${M} = u_${M};
573
573
  #endif
574
- `}),staticAttributes:a,staticUniforms:m}}class ua{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,n,a,h,p,m,_,y,v){this.context=t;let S=this.boundPaintVertexBuffers.length!==h.length;for(let E=0;!S&&E<h.length;E++)this.boundPaintVertexBuffers[E]!==h[E]&&(S=!0);t.extVertexArrayObject&&this.vao&&this.boundProgram===n&&this.boundLayoutVertexBuffer===a&&!S&&this.boundIndexBuffer===p&&this.boundVertexOffset===m&&this.boundDynamicVertexBuffer===_&&this.boundDynamicVertexBuffer2===y&&this.boundDynamicVertexBuffer3===v?(t.bindVertexArrayOES.set(this.vao),_&&_.bind(),p&&p.dynamicDraw&&p.bind(),y&&y.bind(),v&&v.bind()):this.freshBind(n,a,h,p,m,_,y,v)}freshBind(t,n,a,h,p,m,_,y){let v;const S=t.numAttributes,E=this.context,M=E.gl;if(E.extVertexArrayObject)this.vao&&this.destroy(),this.vao=E.extVertexArrayObject.createVertexArrayOES(),E.bindVertexArrayOES.set(this.vao),v=0,this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=a,this.boundIndexBuffer=h,this.boundVertexOffset=p,this.boundDynamicVertexBuffer=m,this.boundDynamicVertexBuffer2=_,this.boundDynamicVertexBuffer3=y;else{v=E.currentNumAttributes||0;for(let D=S;D<v;D++)M.disableVertexAttribArray(D)}n.enableAttributes(M,t);for(const D of a)D.enableAttributes(M,t);m&&m.enableAttributes(M,t),_&&_.enableAttributes(M,t),y&&y.enableAttributes(M,t),n.bind(),n.setVertexAttribPointers(M,t,p);for(const D of a)D.bind(),D.setVertexAttribPointers(M,t,p);m&&(m.bind(),m.setVertexAttribPointers(M,t,p)),h&&h.bind(),_&&(_.bind(),_.setVertexAttribPointers(M,t,p)),y&&(y.bind(),y.setVertexAttribPointers(M,t,p)),E.currentNumAttributes=S}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function pa(o){const t=[];for(let n=0;n<o.length;n++){if(o[n]===null)continue;const a=o[n].split(" ");t.push(a.pop())}return t}class Mo{constructor(t,n,a,h,p,m,_){const y=t.gl;this.program=y.createProgram();const v=pa(a.staticAttributes),S=h?h.getBinderAttributes():[],E=v.concat(S),M=Zn.prelude.staticUniforms?pa(Zn.prelude.staticUniforms):[],D=a.staticUniforms?pa(a.staticUniforms):[],B=h?h.getBinderUniforms():[],L=M.concat(D).concat(B),N=[];for(const he of L)N.indexOf(he)<0&&N.push(he);const X=h?h.defines():[];m&&X.push("#define OVERDRAW_INSPECTOR;"),_&&X.push("#define TERRAIN3D;");const q=X.concat(Zn.prelude.fragmentSource,a.fragmentSource).join(`
575
- `),U=X.concat(Zn.prelude.vertexSource,a.vertexSource).join(`
576
- `),W=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(W,q),y.compileShader(W),y.attachShader(this.program,W);const te=y.createShader(y.VERTEX_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(te,U),y.compileShader(te),y.attachShader(this.program,te),this.attributes={};const se={};this.numAttributes=E.length;for(let he=0;he<this.numAttributes;he++)E[he]&&(y.bindAttribLocation(this.program,he,E[he]),this.attributes[E[he]]=he);y.linkProgram(this.program),y.deleteShader(te),y.deleteShader(W);for(let he=0;he<N.length;he++){const de=N[he];if(de&&!se[de]){const Te=y.getUniformLocation(this.program,de);Te&&(se[de]=Te)}}this.fixedUniforms=p(t,se),this.terrainUniforms=((he,de)=>({u_depth:new c.Uniform1i(he,de.u_depth),u_terrain:new c.Uniform1i(he,de.u_terrain),u_terrain_dim:new c.Uniform1f(he,de.u_terrain_dim),u_terrain_matrix:new c.UniformMatrix4f(he,de.u_terrain_matrix),u_terrain_unpack:new c.Uniform4f(he,de.u_terrain_unpack),u_terrain_exaggeration:new c.Uniform1f(he,de.u_terrain_exaggeration)}))(t,se),this.binderUniforms=h?h.getUniforms(t,se):[]}draw(t,n,a,h,p,m,_,y,v,S,E,M,D,B,L,N,X,q){const U=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(a),t.setStencilMode(h),t.setColorMode(p),t.setCullFace(m),y){t.activeTexture.set(U.TEXTURE2),U.bindTexture(U.TEXTURE_2D,y.depthTexture),t.activeTexture.set(U.TEXTURE3),U.bindTexture(U.TEXTURE_2D,y.texture);for(const te in this.terrainUniforms)this.terrainUniforms[te].set(y[te])}for(const te in this.fixedUniforms)this.fixedUniforms[te].set(_[te]);L&&L.setUniforms(t,this.binderUniforms,D,{zoom:B});let W=0;switch(n){case U.LINES:W=2;break;case U.TRIANGLES:W=3;break;case U.LINE_STRIP:W=1}for(const te of M.get()){const se=te.vaos||(te.vaos={});(se[v]||(se[v]=new ua)).bind(t,this,S,L?L.getPaintVertexBuffers():[],E,te.vertexOffset,N,X,q),U.drawElements(n,te.primitiveLength*W,U.UNSIGNED_SHORT,te.primitiveOffset*W*2)}}}function Po(o,t,n){const a=1/st(n,1,t.transform.tileZoom),h=Math.pow(2,n.tileID.overscaledZ),p=n.tileSize*Math.pow(2,t.transform.tileZoom)/h,m=p*(n.tileID.canonical.x+n.tileID.wrap*h),_=p*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[a,o.fromScale,o.toScale],u_fade:o.t,u_pixel_coord_upper:[m>>16,_>>16],u_pixel_coord_lower:[65535&m,65535&_]}}const da=(o,t,n,a)=>{const h=t.style.light,p=h.properties.get("position"),m=[p.x,p.y,p.z],_=c.create$1();h.properties.get("anchor")==="viewport"&&c.fromRotation(_,-t.transform.angle),c.transformMat3(m,m,_);const y=h.properties.get("color");return{u_matrix:o,u_lightpos:m,u_lightintensity:h.properties.get("intensity"),u_lightcolor:[y.r,y.g,y.b],u_vertical_gradient:+n,u_opacity:a}},Wl=(o,t,n,a,h,p,m)=>c.extend(da(o,t,n,a),Po(p,t,m),{u_height_factor:-Math.pow(2,h.overscaledZ)/m.tileSize/8}),Ms=o=>({u_matrix:o}),ma=(o,t,n,a)=>c.extend(Ms(o),Po(n,t,a)),ko=(o,t)=>({u_matrix:o,u_world:t}),zo=(o,t,n,a,h)=>c.extend(ma(o,t,n,a),{u_world:h}),Lo=(o,t,n,a)=>{const h=o.transform;let p,m;if(a.paint.get("circle-pitch-alignment")==="map"){const _=st(n,1,h.zoom);p=!0,m=[_,_]}else p=!1,m=h.pixelsToGLUnits;return{u_camera_to_center_distance:h.cameraToCenterDistance,u_scale_with_map:+(a.paint.get("circle-pitch-scale")==="map"),u_matrix:o.translatePosMatrix(t.posMatrix,n,a.paint.get("circle-translate"),a.paint.get("circle-translate-anchor")),u_pitch_with_map:+p,u_device_pixel_ratio:o.pixelRatio,u_extrude_scale:m}},Hr=(o,t,n)=>{const a=st(n,1,t.zoom),h=Math.pow(2,t.zoom-n.tileID.overscaledZ),p=n.tileID.overscaleFactor();return{u_matrix:o,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:a,u_extrude_scale:[t.pixelsToGLUnits[0]/(a*h),t.pixelsToGLUnits[1]/(a*h)],u_overscale_factor:p}},Xn=(o,t,n=1)=>({u_matrix:o,u_color:t,u_overlay:0,u_overlay_scale:n}),_n=o=>({u_matrix:o}),Ps=(o,t,n,a)=>({u_matrix:o,u_extrude_scale:st(t,1,n),u_intensity:a});function ks(o,t){const n=Math.pow(2,t.canonical.z),a=t.canonical.y;return[new c.MercatorCoordinate(0,a/n).toLngLat().lat,new c.MercatorCoordinate(0,(a+1)/n).toLngLat().lat]}const Wn=(o,t,n,a)=>{const h=o.transform;return{u_matrix:qt(o,t,n,a),u_ratio:1/st(t,1,h.zoom),u_device_pixel_ratio:o.pixelRatio,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]]}},Do=(o,t,n,a,h)=>c.extend(Wn(o,t,n,h),{u_image:0,u_image_height:a}),fa=(o,t,n,a,h)=>{const p=o.transform,m=yn(t,p);return{u_matrix:qt(o,t,n,h),u_texsize:t.imageAtlasTexture.size,u_ratio:1/st(t,1,p.zoom),u_device_pixel_ratio:o.pixelRatio,u_image:0,u_scale:[m,a.fromScale,a.toScale],u_fade:a.t,u_units_to_pixels:[1/p.pixelsToGLUnits[0],1/p.pixelsToGLUnits[1]]}},zs=(o,t,n,a,h,p)=>{const m=o.lineAtlas,_=yn(t,o.transform),y=n.layout.get("line-cap")==="round",v=m.getDash(a.from,y),S=m.getDash(a.to,y),E=v.width*h.fromScale,M=S.width*h.toScale;return c.extend(Wn(o,t,n,p),{u_patternscale_a:[_/E,-v.height/2],u_patternscale_b:[_/M,-S.height/2],u_sdfgamma:m.width/(256*Math.min(E,M)*o.pixelRatio)/2,u_image:0,u_tex_y_a:v.y,u_tex_y_b:S.y,u_mix:h.t})};function yn(o,t){return 1/st(o,1,t.tileZoom)}function qt(o,t,n,a){return o.translatePosMatrix(a?a.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const Ls=(o,t,n,a,h)=>{return{u_matrix:o,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:a.mix,u_opacity:a.opacity*h.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:h.paint.get("raster-brightness-min"),u_brightness_high:h.paint.get("raster-brightness-max"),u_saturation_factor:(m=h.paint.get("raster-saturation"),m>0?1-1/(1.001-m):-m),u_contrast_factor:(p=h.paint.get("raster-contrast"),p>0?1/(1-p):1+p),u_spin_weights:Ro(h.paint.get("raster-hue-rotate"))};var p,m};function Ro(o){o*=Math.PI/180;const t=Math.sin(o),n=Math.cos(o);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const ga=(o,t,n,a,h,p,m,_,y,v)=>{const S=h.transform;return{u_is_size_zoom_constant:+(o==="constant"||o==="source"),u_is_size_feature_constant:+(o==="constant"||o==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:S.cameraToCenterDistance,u_pitch:S.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:S.width/S.height,u_fade_change:h.options.fadeDuration?h.symbolFadeChange:1,u_matrix:p,u_label_plane_matrix:m,u_coord_matrix:_,u_is_text:+y,u_pitch_with_map:+a,u_texsize:v,u_texture:0}},_a=(o,t,n,a,h,p,m,_,y,v,S)=>{const E=h.transform;return c.extend(ga(o,t,n,a,h,p,m,_,y,v),{u_gamma_scale:a?Math.cos(E._pitch)*E.cameraToCenterDistance:1,u_device_pixel_ratio:h.pixelRatio,u_is_halo:+S})},ya=(o,t,n,a,h,p,m,_,y,v)=>c.extend(_a(o,t,n,a,h,p,m,_,!0,y,!0),{u_texsize_icon:v,u_texture_icon:1}),Bo=(o,t,n)=>({u_matrix:o,u_opacity:t,u_color:n}),Hl=(o,t,n,a,h,p)=>c.extend(function(m,_,y,v){const S=y.imageManager.getPattern(m.from.toString()),E=y.imageManager.getPattern(m.to.toString()),{width:M,height:D}=y.imageManager.getPixelSize(),B=Math.pow(2,v.tileID.overscaledZ),L=v.tileSize*Math.pow(2,y.transform.tileZoom)/B,N=L*(v.tileID.canonical.x+v.tileID.wrap*B),X=L*v.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:S.tl,u_pattern_br_a:S.br,u_pattern_tl_b:E.tl,u_pattern_br_b:E.br,u_texsize:[M,D],u_mix:_.t,u_pattern_size_a:S.displaySize,u_pattern_size_b:E.displaySize,u_scale_a:_.fromScale,u_scale_b:_.toScale,u_tile_units_to_pixels:1/st(v,1,y.transform.tileZoom),u_pixel_coord_upper:[N>>16,X>>16],u_pixel_coord_lower:[65535&N,65535&X]}}(a,p,n,h),{u_matrix:o,u_opacity:t}),Kl={fillExtrusion:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_lightpos:new c.Uniform3f(o,t.u_lightpos),u_lightintensity:new c.Uniform1f(o,t.u_lightintensity),u_lightcolor:new c.Uniform3f(o,t.u_lightcolor),u_vertical_gradient:new c.Uniform1f(o,t.u_vertical_gradient),u_opacity:new c.Uniform1f(o,t.u_opacity)}),fillExtrusionPattern:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_lightpos:new c.Uniform3f(o,t.u_lightpos),u_lightintensity:new c.Uniform1f(o,t.u_lightintensity),u_lightcolor:new c.Uniform3f(o,t.u_lightcolor),u_vertical_gradient:new c.Uniform1f(o,t.u_vertical_gradient),u_height_factor:new c.Uniform1f(o,t.u_height_factor),u_image:new c.Uniform1i(o,t.u_image),u_texsize:new c.Uniform2f(o,t.u_texsize),u_pixel_coord_upper:new c.Uniform2f(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.Uniform2f(o,t.u_pixel_coord_lower),u_scale:new c.Uniform3f(o,t.u_scale),u_fade:new c.Uniform1f(o,t.u_fade),u_opacity:new c.Uniform1f(o,t.u_opacity)}),fill:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix)}),fillPattern:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_image:new c.Uniform1i(o,t.u_image),u_texsize:new c.Uniform2f(o,t.u_texsize),u_pixel_coord_upper:new c.Uniform2f(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.Uniform2f(o,t.u_pixel_coord_lower),u_scale:new c.Uniform3f(o,t.u_scale),u_fade:new c.Uniform1f(o,t.u_fade)}),fillOutline:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_world:new c.Uniform2f(o,t.u_world)}),fillOutlinePattern:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_world:new c.Uniform2f(o,t.u_world),u_image:new c.Uniform1i(o,t.u_image),u_texsize:new c.Uniform2f(o,t.u_texsize),u_pixel_coord_upper:new c.Uniform2f(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.Uniform2f(o,t.u_pixel_coord_lower),u_scale:new c.Uniform3f(o,t.u_scale),u_fade:new c.Uniform1f(o,t.u_fade)}),circle:(o,t)=>({u_camera_to_center_distance:new c.Uniform1f(o,t.u_camera_to_center_distance),u_scale_with_map:new c.Uniform1i(o,t.u_scale_with_map),u_pitch_with_map:new c.Uniform1i(o,t.u_pitch_with_map),u_extrude_scale:new c.Uniform2f(o,t.u_extrude_scale),u_device_pixel_ratio:new c.Uniform1f(o,t.u_device_pixel_ratio),u_matrix:new c.UniformMatrix4f(o,t.u_matrix)}),collisionBox:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_camera_to_center_distance:new c.Uniform1f(o,t.u_camera_to_center_distance),u_pixels_to_tile_units:new c.Uniform1f(o,t.u_pixels_to_tile_units),u_extrude_scale:new c.Uniform2f(o,t.u_extrude_scale),u_overscale_factor:new c.Uniform1f(o,t.u_overscale_factor)}),collisionCircle:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_inv_matrix:new c.UniformMatrix4f(o,t.u_inv_matrix),u_camera_to_center_distance:new c.Uniform1f(o,t.u_camera_to_center_distance),u_viewport_size:new c.Uniform2f(o,t.u_viewport_size)}),debug:(o,t)=>({u_color:new c.UniformColor(o,t.u_color),u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_overlay:new c.Uniform1i(o,t.u_overlay),u_overlay_scale:new c.Uniform1f(o,t.u_overlay_scale)}),clippingMask:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix)}),heatmap:(o,t)=>({u_extrude_scale:new c.Uniform1f(o,t.u_extrude_scale),u_intensity:new c.Uniform1f(o,t.u_intensity),u_matrix:new c.UniformMatrix4f(o,t.u_matrix)}),heatmapTexture:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_world:new c.Uniform2f(o,t.u_world),u_image:new c.Uniform1i(o,t.u_image),u_color_ramp:new c.Uniform1i(o,t.u_color_ramp),u_opacity:new c.Uniform1f(o,t.u_opacity)}),hillshade:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_image:new c.Uniform1i(o,t.u_image),u_latrange:new c.Uniform2f(o,t.u_latrange),u_light:new c.Uniform2f(o,t.u_light),u_shadow:new c.UniformColor(o,t.u_shadow),u_highlight:new c.UniformColor(o,t.u_highlight),u_accent:new c.UniformColor(o,t.u_accent)}),hillshadePrepare:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_image:new c.Uniform1i(o,t.u_image),u_dimension:new c.Uniform2f(o,t.u_dimension),u_zoom:new c.Uniform1f(o,t.u_zoom),u_unpack:new c.Uniform4f(o,t.u_unpack)}),line:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_ratio:new c.Uniform1f(o,t.u_ratio),u_device_pixel_ratio:new c.Uniform1f(o,t.u_device_pixel_ratio),u_units_to_pixels:new c.Uniform2f(o,t.u_units_to_pixels)}),lineGradient:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_ratio:new c.Uniform1f(o,t.u_ratio),u_device_pixel_ratio:new c.Uniform1f(o,t.u_device_pixel_ratio),u_units_to_pixels:new c.Uniform2f(o,t.u_units_to_pixels),u_image:new c.Uniform1i(o,t.u_image),u_image_height:new c.Uniform1f(o,t.u_image_height)}),linePattern:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_texsize:new c.Uniform2f(o,t.u_texsize),u_ratio:new c.Uniform1f(o,t.u_ratio),u_device_pixel_ratio:new c.Uniform1f(o,t.u_device_pixel_ratio),u_image:new c.Uniform1i(o,t.u_image),u_units_to_pixels:new c.Uniform2f(o,t.u_units_to_pixels),u_scale:new c.Uniform3f(o,t.u_scale),u_fade:new c.Uniform1f(o,t.u_fade)}),lineSDF:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_ratio:new c.Uniform1f(o,t.u_ratio),u_device_pixel_ratio:new c.Uniform1f(o,t.u_device_pixel_ratio),u_units_to_pixels:new c.Uniform2f(o,t.u_units_to_pixels),u_patternscale_a:new c.Uniform2f(o,t.u_patternscale_a),u_patternscale_b:new c.Uniform2f(o,t.u_patternscale_b),u_sdfgamma:new c.Uniform1f(o,t.u_sdfgamma),u_image:new c.Uniform1i(o,t.u_image),u_tex_y_a:new c.Uniform1f(o,t.u_tex_y_a),u_tex_y_b:new c.Uniform1f(o,t.u_tex_y_b),u_mix:new c.Uniform1f(o,t.u_mix)}),raster:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_tl_parent:new c.Uniform2f(o,t.u_tl_parent),u_scale_parent:new c.Uniform1f(o,t.u_scale_parent),u_buffer_scale:new c.Uniform1f(o,t.u_buffer_scale),u_fade_t:new c.Uniform1f(o,t.u_fade_t),u_opacity:new c.Uniform1f(o,t.u_opacity),u_image0:new c.Uniform1i(o,t.u_image0),u_image1:new c.Uniform1i(o,t.u_image1),u_brightness_low:new c.Uniform1f(o,t.u_brightness_low),u_brightness_high:new c.Uniform1f(o,t.u_brightness_high),u_saturation_factor:new c.Uniform1f(o,t.u_saturation_factor),u_contrast_factor:new c.Uniform1f(o,t.u_contrast_factor),u_spin_weights:new c.Uniform3f(o,t.u_spin_weights)}),symbolIcon:(o,t)=>({u_is_size_zoom_constant:new c.Uniform1i(o,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.Uniform1i(o,t.u_is_size_feature_constant),u_size_t:new c.Uniform1f(o,t.u_size_t),u_size:new c.Uniform1f(o,t.u_size),u_camera_to_center_distance:new c.Uniform1f(o,t.u_camera_to_center_distance),u_pitch:new c.Uniform1f(o,t.u_pitch),u_rotate_symbol:new c.Uniform1i(o,t.u_rotate_symbol),u_aspect_ratio:new c.Uniform1f(o,t.u_aspect_ratio),u_fade_change:new c.Uniform1f(o,t.u_fade_change),u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_label_plane_matrix:new c.UniformMatrix4f(o,t.u_label_plane_matrix),u_coord_matrix:new c.UniformMatrix4f(o,t.u_coord_matrix),u_is_text:new c.Uniform1i(o,t.u_is_text),u_pitch_with_map:new c.Uniform1i(o,t.u_pitch_with_map),u_texsize:new c.Uniform2f(o,t.u_texsize),u_texture:new c.Uniform1i(o,t.u_texture)}),symbolSDF:(o,t)=>({u_is_size_zoom_constant:new c.Uniform1i(o,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.Uniform1i(o,t.u_is_size_feature_constant),u_size_t:new c.Uniform1f(o,t.u_size_t),u_size:new c.Uniform1f(o,t.u_size),u_camera_to_center_distance:new c.Uniform1f(o,t.u_camera_to_center_distance),u_pitch:new c.Uniform1f(o,t.u_pitch),u_rotate_symbol:new c.Uniform1i(o,t.u_rotate_symbol),u_aspect_ratio:new c.Uniform1f(o,t.u_aspect_ratio),u_fade_change:new c.Uniform1f(o,t.u_fade_change),u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_label_plane_matrix:new c.UniformMatrix4f(o,t.u_label_plane_matrix),u_coord_matrix:new c.UniformMatrix4f(o,t.u_coord_matrix),u_is_text:new c.Uniform1i(o,t.u_is_text),u_pitch_with_map:new c.Uniform1i(o,t.u_pitch_with_map),u_texsize:new c.Uniform2f(o,t.u_texsize),u_texture:new c.Uniform1i(o,t.u_texture),u_gamma_scale:new c.Uniform1f(o,t.u_gamma_scale),u_device_pixel_ratio:new c.Uniform1f(o,t.u_device_pixel_ratio),u_is_halo:new c.Uniform1i(o,t.u_is_halo)}),symbolTextAndIcon:(o,t)=>({u_is_size_zoom_constant:new c.Uniform1i(o,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.Uniform1i(o,t.u_is_size_feature_constant),u_size_t:new c.Uniform1f(o,t.u_size_t),u_size:new c.Uniform1f(o,t.u_size),u_camera_to_center_distance:new c.Uniform1f(o,t.u_camera_to_center_distance),u_pitch:new c.Uniform1f(o,t.u_pitch),u_rotate_symbol:new c.Uniform1i(o,t.u_rotate_symbol),u_aspect_ratio:new c.Uniform1f(o,t.u_aspect_ratio),u_fade_change:new c.Uniform1f(o,t.u_fade_change),u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_label_plane_matrix:new c.UniformMatrix4f(o,t.u_label_plane_matrix),u_coord_matrix:new c.UniformMatrix4f(o,t.u_coord_matrix),u_is_text:new c.Uniform1i(o,t.u_is_text),u_pitch_with_map:new c.Uniform1i(o,t.u_pitch_with_map),u_texsize:new c.Uniform2f(o,t.u_texsize),u_texsize_icon:new c.Uniform2f(o,t.u_texsize_icon),u_texture:new c.Uniform1i(o,t.u_texture),u_texture_icon:new c.Uniform1i(o,t.u_texture_icon),u_gamma_scale:new c.Uniform1f(o,t.u_gamma_scale),u_device_pixel_ratio:new c.Uniform1f(o,t.u_device_pixel_ratio),u_is_halo:new c.Uniform1i(o,t.u_is_halo)}),background:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_opacity:new c.Uniform1f(o,t.u_opacity),u_color:new c.UniformColor(o,t.u_color)}),backgroundPattern:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_opacity:new c.Uniform1f(o,t.u_opacity),u_image:new c.Uniform1i(o,t.u_image),u_pattern_tl_a:new c.Uniform2f(o,t.u_pattern_tl_a),u_pattern_br_a:new c.Uniform2f(o,t.u_pattern_br_a),u_pattern_tl_b:new c.Uniform2f(o,t.u_pattern_tl_b),u_pattern_br_b:new c.Uniform2f(o,t.u_pattern_br_b),u_texsize:new c.Uniform2f(o,t.u_texsize),u_mix:new c.Uniform1f(o,t.u_mix),u_pattern_size_a:new c.Uniform2f(o,t.u_pattern_size_a),u_pattern_size_b:new c.Uniform2f(o,t.u_pattern_size_b),u_scale_a:new c.Uniform1f(o,t.u_scale_a),u_scale_b:new c.Uniform1f(o,t.u_scale_b),u_pixel_coord_upper:new c.Uniform2f(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.Uniform2f(o,t.u_pixel_coord_lower),u_tile_units_to_pixels:new c.Uniform1f(o,t.u_tile_units_to_pixels)}),terrain:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_texture:new c.Uniform1i(o,t.u_texture),u_ele_delta:new c.Uniform1f(o,t.u_ele_delta)}),terrainDepth:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_ele_delta:new c.Uniform1f(o,t.u_ele_delta)}),terrainCoords:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_texture:new c.Uniform1i(o,t.u_texture),u_terrain_coords_id:new c.Uniform1f(o,t.u_terrain_coords_id),u_ele_delta:new c.Uniform1f(o,t.u_ele_delta)})};class xa{constructor(t,n,a){this.context=t;const h=t.gl;this.buffer=h.createBuffer(),this.dynamicDraw=Boolean(a),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),h.bufferData(h.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?h.DYNAMIC_DRAW:h.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const n=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const va={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class ba{constructor(t,n,a,h){this.length=n.length,this.attributes=a,this.itemSize=n.bytesPerElement,this.dynamicDraw=h,this.context=t;const p=t.gl;this.buffer=p.createBuffer(),t.bindVertexBuffer.set(this.buffer),p.bufferData(p.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?p.DYNAMIC_DRAW:p.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let a=0;a<this.attributes.length;a++){const h=n.attributes[this.attributes[a].name];h!==void 0&&t.enableVertexAttribArray(h)}}setVertexAttribPointers(t,n,a){for(let h=0;h<this.attributes.length;h++){const p=this.attributes[h],m=n.attributes[p.name];m!==void 0&&t.vertexAttribPointer(m,p.components,t[va[p.type]],!1,this.itemSize,p.offset+this.itemSize*(a||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class xt{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Fo extends xt{getDefault(){return c.Color.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Oo extends xt{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Jl extends xt{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Hn extends xt{getDefault(){return[!0,!0,!0,!0]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Kn extends xt{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Uo extends xt{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class Vi extends xt{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const n=this.current;(t.func!==n.func||t.ref!==n.ref||t.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class wa extends xt{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Ds extends xt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=t,this.dirty=!1}}class Rs extends xt{getDefault(){return[0,1]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class Ta extends xt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=t,this.dirty=!1}}class Sa extends xt{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Bs extends xt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.BLEND):n.disable(n.BLEND),this.current=t,this.dirty=!1}}class Ea extends xt{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class Ia extends xt{getDefault(){return c.Color.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Fs extends xt{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Vo extends xt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=t,this.dirty=!1}}class No extends xt{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class xn extends xt{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class Yl extends xt{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Ql extends xt{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class ec extends xt{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class tc extends xt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class ic extends xt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class rc extends xt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class Aa extends xt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Os extends xt{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Ca extends xt{constructor(t){super(t),this.vao=t.extVertexArrayObject}getDefault(){return null}set(t){this.vao&&(t!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(t),this.current=t,this.dirty=!1)}}class Ma extends xt{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class vn extends xt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class $o extends xt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class Pa extends xt{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class ka extends Pa{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Kr extends Pa{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class jo{constructor(t,n,a,h){this.context=t,this.width=n,this.height=a;const p=t.gl,m=this.framebuffer=p.createFramebuffer();if(this.colorAttachment=new ka(t,m),h&&(this.depthAttachment=new Kr(t,m)),p.checkFramebufferStatus(p.FRAMEBUFFER)!==p.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const t=this.context.gl,n=this.colorAttachment.get();if(n&&t.deleteTexture(n),this.depthAttachment){const a=this.depthAttachment.get();a&&t.deleteRenderbuffer(a)}t.deleteFramebuffer(this.framebuffer)}}class Ut{constructor(t,n,a){this.blendFunction=t,this.blendColor=n,this.mask=a}}Ut.Replace=[1,0],Ut.disabled=new Ut(Ut.Replace,c.Color.transparent,[!1,!1,!1,!1]),Ut.unblended=new Ut(Ut.Replace,c.Color.transparent,[!0,!0,!0,!0]),Ut.alphaBlended=new Ut([1,771],c.Color.transparent,[!0,!0,!0,!0]);class bn{constructor(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new Fo(this),this.clearDepth=new Oo(this),this.clearStencil=new Jl(this),this.colorMask=new Hn(this),this.depthMask=new Kn(this),this.stencilMask=new Uo(this),this.stencilFunc=new Vi(this),this.stencilOp=new wa(this),this.stencilTest=new Ds(this),this.depthRange=new Rs(this),this.depthTest=new Ta(this),this.depthFunc=new Sa(this),this.blend=new Bs(this),this.blendFunc=new Ea(this),this.blendColor=new Ia(this),this.blendEquation=new Fs(this),this.cullFace=new Vo(this),this.cullFaceSide=new No(this),this.frontFace=new xn(this),this.program=new Yl(this),this.activeTexture=new Ql(this),this.viewport=new ec(this),this.bindFramebuffer=new tc(this),this.bindRenderbuffer=new ic(this),this.bindTexture=new rc(this),this.bindVertexBuffer=new Aa(this),this.bindElementBuffer=new Os(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new Ca(this),this.pixelStoreUnpack=new Ma(this),this.pixelStoreUnpackPremultiplyAlpha=new vn(this),this.pixelStoreUnpackFlipY=new $o(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=t.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(t.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE)}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.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,n){return new xa(this,t,n)}createVertexBuffer(t,n,a){return new ba(this,t,n,a)}createRenderbuffer(t,n,a){const h=this.gl,p=h.createRenderbuffer();return this.bindRenderbuffer.set(p),h.renderbufferStorage(h.RENDERBUFFER,t,n,a),this.bindRenderbuffer.set(null),p}createFramebuffer(t,n,a){return new jo(this,t,n,a)}clear({color:t,depth:n}){const a=this.gl;let h=0;t&&(h|=a.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(h|=a.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),a.clear(h)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){Me(t.blendFunction,Ut.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}class dt{constructor(t,n,a){this.func=t,this.mask=n,this.range=a}}dt.ReadOnly=!1,dt.ReadWrite=!0,dt.disabled=new dt(519,dt.ReadOnly,[0,1]);const Jn=7680;class tt{constructor(t,n,a,h,p,m){this.test=t,this.ref=n,this.mask=a,this.fail=h,this.depthFail=p,this.pass=m}}tt.disabled=new tt({func:519,mask:0},0,0,Jn,Jn,Jn);class kt{constructor(t,n,a){this.enable=t,this.mode=n,this.frontFace=a}}let Us;function za(o,t,n,a,h,p,m){const _=o.context,y=_.gl,v=o.useProgram("collisionBox"),S=[];let E=0,M=0;for(let U=0;U<a.length;U++){const W=a[U],te=t.getTile(W),se=te.getBucket(n);if(!se)continue;let he=W.posMatrix;h[0]===0&&h[1]===0||(he=o.translatePosMatrix(W.posMatrix,te,h,p));const de=m?se.textCollisionBox:se.iconCollisionBox,Te=se.collisionCircleArray;if(Te.length>0){const ye=c.create(),Ae=he;c.mul(ye,se.placementInvProjMatrix,o.transform.glCoordMatrix),c.mul(ye,ye,se.placementViewportMatrix),S.push({circleArray:Te,circleOffset:M,transform:Ae,invTransform:ye,coord:W}),E+=Te.length/4,M=E}de&&v.draw(_,y.LINES,dt.disabled,tt.disabled,o.colorModeForRenderPass(),kt.disabled,Hr(he,o.transform,te),o.style.map.terrain&&o.style.map.terrain.getTerrainData(W),n.id,de.layoutVertexBuffer,de.indexBuffer,de.segments,null,o.transform.zoom,null,null,de.collisionVertexBuffer)}if(!m||!S.length)return;const D=o.useProgram("collisionCircle"),B=new c.CollisionCircleLayoutArray;B.resize(4*E),B._trim();let L=0;for(const U of S)for(let W=0;W<U.circleArray.length/4;W++){const te=4*W,se=U.circleArray[te+0],he=U.circleArray[te+1],de=U.circleArray[te+2],Te=U.circleArray[te+3];B.emplace(L++,se,he,de,Te,0),B.emplace(L++,se,he,de,Te,1),B.emplace(L++,se,he,de,Te,2),B.emplace(L++,se,he,de,Te,3)}(!Us||Us.length<2*E)&&(Us=function(U){const W=2*U,te=new c.QuadTriangleArray;te.resize(W),te._trim();for(let se=0;se<W;se++){const he=6*se;te.uint16[he+0]=4*se+0,te.uint16[he+1]=4*se+1,te.uint16[he+2]=4*se+2,te.uint16[he+3]=4*se+2,te.uint16[he+4]=4*se+3,te.uint16[he+5]=4*se+0}return te}(E));const N=_.createIndexBuffer(Us,!0),X=_.createVertexBuffer(B,c.collisionCircleLayout.members,!0);for(const U of S){const W={u_matrix:U.transform,u_inv_matrix:U.invTransform,u_camera_to_center_distance:(q=o.transform).cameraToCenterDistance,u_viewport_size:[q.width,q.height]};D.draw(_,y.TRIANGLES,dt.disabled,tt.disabled,o.colorModeForRenderPass(),kt.disabled,W,o.style.map.terrain&&o.style.map.terrain.getTerrainData(U.coord),n.id,X,N,c.SegmentVector.simpleSegment(0,2*U.circleOffset,U.circleArray.length,U.circleArray.length/2),null,o.transform.zoom,null,null,null)}var q;X.destroy(),N.destroy()}kt.disabled=new kt(!1,1029,2305),kt.backCCW=new kt(!0,1029,2305);const Yn=c.identity(new Float32Array(16));function nc(o,t,n,a,h,p){const{horizontalAlign:m,verticalAlign:_}=c.getAnchorAlignment(o),y=-(m-.5)*t,v=-(_-.5)*n,S=c.evaluateVariableOffset(o,a);return new c.pointGeometry((y/h+S[0])*p,(v/h+S[1])*p)}function sc(o,t,n,a,h,p,m,_,y,v,S){const E=o.text.placedSymbolArray,M=o.text.dynamicLayoutVertexArray,D=o.icon.dynamicLayoutVertexArray,B={};M.clear();for(let L=0;L<E.length;L++){const N=E.get(L),X=N.hidden||!N.crossTileID||o.allowVerticalPlacement&&!N.placedOrientation?null:a[N.crossTileID];if(X){const q=new c.pointGeometry(N.anchorX,N.anchorY),U=Ce(q,n?m:p,S),W=at(h.cameraToCenterDistance,U.signedDistanceFromCamera);let te=c.evaluateSizeForFeature(o.textSizeData,y,N)*W/c.ONE_EM;n&&(te*=o.tilePixelRatio/_);const{width:se,height:he,anchor:de,textOffset:Te,textBoxScale:ye}=X,Ae=nc(de,se,he,Te,ye,te),Ge=n?Ce(q.add(Ae),p,S).point:U.point.add(t?Ae.rotate(-h.angle):Ae),rt=o.allowVerticalPlacement&&N.placedOrientation===c.WritingMode.vertical?Math.PI/2:0;for(let nt=0;nt<N.numGlyphs;nt++)c.addDynamicAttributes(M,Ge,rt);v&&N.associatedIconIndex>=0&&(B[N.associatedIconIndex]={shiftedAnchor:Ge,angle:rt})}else Xt(N.numGlyphs,M)}if(v){D.clear();const L=o.icon.placedSymbolArray;for(let N=0;N<L.length;N++){const X=L.get(N);if(X.hidden)Xt(X.numGlyphs,D);else{const q=B[N];if(q)for(let U=0;U<X.numGlyphs;U++)c.addDynamicAttributes(D,q.shiftedAnchor,q.angle);else Xt(X.numGlyphs,D)}}o.icon.dynamicLayoutVertexBuffer.updateData(D)}o.text.dynamicLayoutVertexBuffer.updateData(M)}function Go(o,t,n){return n.iconsInText&&t?"symbolTextAndIcon":o?"symbolSDF":"symbolIcon"}function qo(o,t,n,a,h,p,m,_,y,v,S,E){const M=o.context,D=M.gl,B=o.transform,L=_==="map",N=y==="map",X=_!=="viewport"&&n.layout.get("symbol-placement")!=="point",q=L&&!N&&!X,U=!n.layout.get("symbol-sort-key").isConstant();let W=!1;const te=o.depthModeForSublayer(0,dt.ReadOnly),se=n.layout.get("text-variable-anchor"),he=[];for(const de of a){const Te=t.getTile(de),ye=Te.getBucket(n);if(!ye)continue;const Ae=h?ye.text:ye.icon;if(!Ae||!Ae.segments.get().length||!Ae.hasVisibleVertices)continue;const Ge=Ae.programConfigurations.get(n.id),rt=h||ye.sdfIcons,nt=h?ye.textSizeData:ye.iconSizeData,He=N||B.pitch!==0,Mt=o.useProgram(Go(rt,h,ye),Ge),Tt=c.evaluateSizeForZoom(nt,B.zoom),mt=o.style.map.terrain&&o.style.map.terrain.getTerrainData(de);let yt,bt,Ei,xr,hr=[0,0],Nt=null;if(h)bt=Te.glyphAtlasTexture,Ei=D.LINEAR,yt=Te.glyphAtlasTexture.size,ye.iconsInText&&(hr=Te.imageAtlasTexture.size,Nt=Te.imageAtlasTexture,xr=He||o.options.rotating||o.options.zooming||nt.kind==="composite"||nt.kind==="camera"?D.LINEAR:D.NEAREST);else{const tr=n.layout.get("icon-size").constantOr(0)!==1||ye.iconsNeedLinear;bt=Te.imageAtlasTexture,Ei=rt||o.options.rotating||o.options.zooming||tr||He?D.LINEAR:D.NEAREST,yt=Te.imageAtlasTexture.size}const jr=st(Te,1,o.transform.zoom),Ii=Ie(de.posMatrix,N,L,o.transform,jr),Ai=Pe(de.posMatrix,N,L,o.transform,jr),Qr=se&&ye.hasTextData(),kn=n.layout.get("icon-text-fit")!=="none"&&Qr&&ye.hasIconData();if(X){const tr=o.style.map.terrain?(zn,Js)=>o.style.map.terrain.getElevation(de,zn,Js):null,ir=n.layout.get("text-rotation-alignment")==="map";xe(ye,de.posMatrix,o,h,Ii,Ai,N,v,ir,tr)}const Qt=o.translatePosMatrix(de.posMatrix,Te,p,m),$t=X||h&&se||kn?Yn:Ii,Et=o.translatePosMatrix(Ai,Te,p,m,!0),ci=rt&&n.paint.get(h?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Li;Li=rt?ye.iconsInText?ya(nt.kind,Tt,q,N,o,Qt,$t,Et,yt,hr):_a(nt.kind,Tt,q,N,o,Qt,$t,Et,h,yt,!0):ga(nt.kind,Tt,q,N,o,Qt,$t,Et,h,yt);const jt={program:Mt,buffers:Ae,uniformValues:Li,atlasTexture:bt,atlasTextureIcon:Nt,atlasInterpolation:Ei,atlasInterpolationIcon:xr,isSDF:rt,hasHalo:ci};if(U&&ye.canOverlap){W=!0;const tr=Ae.segments.get();for(const ir of tr)he.push({segments:new c.SegmentVector([ir]),sortKey:ir.sortKey,state:jt,terrainData:mt})}else he.push({segments:Ae.segments,sortKey:0,state:jt,terrainData:mt})}W&&he.sort((de,Te)=>de.sortKey-Te.sortKey);for(const de of he){const Te=de.state;if(M.activeTexture.set(D.TEXTURE0),Te.atlasTexture.bind(Te.atlasInterpolation,D.CLAMP_TO_EDGE),Te.atlasTextureIcon&&(M.activeTexture.set(D.TEXTURE1),Te.atlasTextureIcon&&Te.atlasTextureIcon.bind(Te.atlasInterpolationIcon,D.CLAMP_TO_EDGE)),Te.isSDF){const ye=Te.uniformValues;Te.hasHalo&&(ye.u_is_halo=1,Vs(Te.buffers,de.segments,n,o,Te.program,te,S,E,ye,de.terrainData)),ye.u_is_halo=0}Vs(Te.buffers,de.segments,n,o,Te.program,te,S,E,Te.uniformValues,de.terrainData)}}function Vs(o,t,n,a,h,p,m,_,y,v){const S=a.context;h.draw(S,S.gl.TRIANGLES,p,m,_,kt.disabled,y,v,n.id,o.layoutVertexBuffer,o.indexBuffer,t,n.paint,a.transform.zoom,o.programConfigurations.get(n.id),o.dynamicLayoutVertexBuffer,o.opacityVertexBuffer)}function Qn(o,t,n,a,h){if(!n||!a||!a.imageAtlas)return;const p=a.imageAtlas.patternPositions;let m=p[n.to.toString()],_=p[n.from.toString()];if(!m||!_){const y=h.getPaintProperty(t);m=p[y],_=p[y]}m&&_&&o.setConstantPatternPositions(m,_)}function es(o,t,n,a,h,p,m){const _=o.context.gl,y="fill-pattern",v=n.paint.get(y),S=v&&v.constantOr(1),E=n.getCrossfadeParameters();let M,D,B,L,N;m?(D=S&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",M=_.LINES):(D=S?"fillPattern":"fill",M=_.TRIANGLES);const X=v.constantOr(null);for(const q of a){const U=t.getTile(q);if(S&&!U.patternsLoaded())continue;const W=U.getBucket(n);if(!W)continue;const te=W.programConfigurations.get(n.id),se=o.useProgram(D,te),he=o.style.map.terrain&&o.style.map.terrain.getTerrainData(q);S&&(o.context.activeTexture.set(_.TEXTURE0),U.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),te.updatePaintBuffers(E)),Qn(te,y,X,U,n);const de=he?q:null,Te=o.translatePosMatrix(de?de.posMatrix:q.posMatrix,U,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(m){L=W.indexBuffer2,N=W.segments2;const ye=[_.drawingBufferWidth,_.drawingBufferHeight];B=D==="fillOutlinePattern"&&S?zo(Te,o,E,U,ye):ko(Te,ye)}else L=W.indexBuffer,N=W.segments,B=S?ma(Te,o,E,U):Ms(Te);se.draw(o.context,M,h,o.stencilModeForClipping(q),p,kt.disabled,B,he,n.id,W.layoutVertexBuffer,L,N,n.paint,o.transform.zoom,te)}}function ts(o,t,n,a,h,p,m){const _=o.context,y=_.gl,v="fill-extrusion-pattern",S=n.paint.get(v),E=S.constantOr(1),M=n.getCrossfadeParameters(),D=n.paint.get("fill-extrusion-opacity"),B=S.constantOr(null);for(const L of a){const N=t.getTile(L),X=N.getBucket(n);if(!X)continue;const q=o.style.map.terrain&&o.style.map.terrain.getTerrainData(L),U=X.programConfigurations.get(n.id),W=o.useProgram(E?"fillExtrusionPattern":"fillExtrusion",U);E&&(o.context.activeTexture.set(y.TEXTURE0),N.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),U.updatePaintBuffers(M)),Qn(U,v,B,N,n);const te=o.translatePosMatrix(L.posMatrix,N,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),se=n.paint.get("fill-extrusion-vertical-gradient"),he=E?Wl(te,o,se,D,L,M,N):da(te,o,se,D);W.draw(_,_.gl.TRIANGLES,h,p,m,kt.backCCW,he,q,n.id,X.layoutVertexBuffer,X.indexBuffer,X.segments,n.paint,o.transform.zoom,U,o.style.map.terrain&&X.centroidVertexBuffer)}}function La(o,t,n,a,h,p,m){const _=o.context,y=_.gl,v=n.fbo;if(!v)return;const S=o.useProgram("hillshade"),E=o.style.map.terrain&&o.style.map.terrain.getTerrainData(t);_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,v.colorAttachment.get()),S.draw(_,y.TRIANGLES,h,p,m,kt.disabled,((M,D,B,L)=>{const N=B.paint.get("hillshade-shadow-color"),X=B.paint.get("hillshade-highlight-color"),q=B.paint.get("hillshade-accent-color");let U=B.paint.get("hillshade-illumination-direction")*(Math.PI/180);B.paint.get("hillshade-illumination-anchor")==="viewport"&&(U-=M.transform.angle);const W=!M.options.moving;return{u_matrix:L?L.posMatrix:M.transform.calculatePosMatrix(D.tileID.toUnwrapped(),W),u_image:0,u_latrange:ks(0,D.tileID),u_light:[B.paint.get("hillshade-exaggeration"),U],u_shadow:N,u_highlight:X,u_accent:q}})(o,n,a,E?t:null),E,a.id,o.rasterBoundsBuffer,o.quadTriangleIndexBuffer,o.rasterBoundsSegments)}function Zo(o,t,n,a,h,p){const m=o.context,_=m.gl,y=t.dem;if(y&&y.data){const v=y.dim,S=y.stride,E=y.getPixels();if(m.activeTexture.set(_.TEXTURE1),m.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||o.getTileTexture(S),t.demTexture){const D=t.demTexture;D.update(E,{premultiply:!1}),D.bind(_.NEAREST,_.CLAMP_TO_EDGE)}else t.demTexture=new Dt(m,E,_.RGBA,{premultiply:!1}),t.demTexture.bind(_.NEAREST,_.CLAMP_TO_EDGE);m.activeTexture.set(_.TEXTURE0);let M=t.fbo;if(!M){const D=new Dt(m,{width:v,height:v,data:null},_.RGBA);D.bind(_.LINEAR,_.CLAMP_TO_EDGE),M=t.fbo=m.createFramebuffer(v,v,!0),M.colorAttachment.set(D.texture)}m.bindFramebuffer.set(M.framebuffer),m.viewport.set([0,0,v,v]),o.useProgram("hillshadePrepare").draw(m,_.TRIANGLES,a,h,p,kt.disabled,((D,B)=>{const L=B.stride,N=c.create();return c.ortho(N,0,c.EXTENT,-c.EXTENT,0,0,1),c.translate(N,N,[0,-c.EXTENT,0]),{u_matrix:N,u_image:1,u_dimension:[L,L],u_zoom:D.overscaledZ,u_unpack:B.getUnpackVector()}})(t.tileID,y),null,n.id,o.rasterBoundsBuffer,o.quadTriangleIndexBuffer,o.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function Ns(o,t,n,a,h,p){const m=a.paint.get("raster-fade-duration");if(!p&&m>0){const _=c.exported.now(),y=(_-o.timeAdded)/m,v=t?(_-t.timeAdded)/m:-1,S=n.getSource(),E=h.coveringZoomLevel({tileSize:S.tileSize,roundZoom:S.roundZoom}),M=!t||Math.abs(t.tileID.overscaledZ-E)>Math.abs(o.tileID.overscaledZ-E),D=M&&o.refreshedUponExpiration?1:c.clamp(M?y:1-v,0,1);return o.refreshedUponExpiration&&y>=1&&(o.refreshedUponExpiration=!1),t?{opacity:1,mix:1-D}:{opacity:D,mix:0}}return{opacity:1,mix:0}}const $s=new c.Color(1,0,0,1),er=new c.Color(0,1,0,1),Xo=new c.Color(0,0,1,1),Da=new c.Color(1,0,1,1),Wo=new c.Color(0,1,1,1);function Jr(o,t,n,a){wn(o,0,t+n/2,o.transform.width,n,a)}function is(o,t,n,a){wn(o,t-n/2,0,n,o.transform.height,a)}function wn(o,t,n,a,h,p){const m=o.context,_=m.gl;_.enable(_.SCISSOR_TEST),_.scissor(t*o.pixelRatio,n*o.pixelRatio,a*o.pixelRatio,h*o.pixelRatio),m.clear({color:p}),_.disable(_.SCISSOR_TEST)}function ac(o,t,n){const a=o.context,h=a.gl,p=n.posMatrix,m=o.useProgram("debug"),_=dt.disabled,y=tt.disabled,v=o.colorModeForRenderPass(),S="$debug",E=o.style.map.terrain&&o.style.map.terrain.getTerrainData(n);a.activeTexture.set(h.TEXTURE0),o.emptyTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE);const M=t.getTileByID(n.key).latestRawTileData,D=Math.floor((M&&M.byteLength||0)/1024),B=t.getTile(n).tileSize,L=512/Math.min(B,512)*(n.overscaledZ/o.transform.zoom)*.5;let N=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(N+=` => ${n.overscaledZ}`),function(X,q){X.initDebugOverlayCanvas();const U=X.debugOverlayCanvas,W=X.context.gl,te=X.debugOverlayCanvas.getContext("2d");te.clearRect(0,0,U.width,U.height),te.shadowColor="white",te.shadowBlur=2,te.lineWidth=1.5,te.strokeStyle="white",te.textBaseline="top",te.font="bold 36px Open Sans, sans-serif",te.fillText(q,5,5),te.strokeText(q,5,5),X.debugOverlayTexture.update(U),X.debugOverlayTexture.bind(W.LINEAR,W.CLAMP_TO_EDGE)}(o,`${N} ${D}kB`),m.draw(a,h.TRIANGLES,_,y,Ut.alphaBlended,kt.disabled,Xn(p,c.Color.transparent,L),null,S,o.debugBuffer,o.quadTriangleIndexBuffer,o.debugSegments),m.draw(a,h.LINE_STRIP,_,y,v,kt.disabled,Xn(p,c.Color.red),E,S,o.debugBuffer,o.tileBorderIndexBuffer,o.debugSegments)}function js(o,t,n){const a=o.context,h=a.gl,p=o.colorModeForRenderPass(),m=new dt(h.LEQUAL,dt.ReadWrite,o.depthRangeFor3D),_=o.useProgram("terrain"),y=t.getTerrainMesh();a.bindFramebuffer.set(null),a.viewport.set([0,0,o.width,o.height]);for(const v of n){const S=o.renderToTexture.getTexture(v),E=t.getTerrainData(v.tileID);a.activeTexture.set(h.TEXTURE0),h.bindTexture(h.TEXTURE_2D,S.texture);const M={u_matrix:o.transform.calculatePosMatrix(v.tileID.toUnwrapped()),u_texture:0,u_ele_delta:t.getMeshFrameDelta(o.transform.zoom)};_.draw(a,h.TRIANGLES,m,tt.disabled,p,kt.backCCW,M,E,"terrain",y.vertexBuffer,y.indexBuffer,y.segments)}}const Ho={symbol:function(o,t,n,a,h){if(o.renderPass!=="translucent")return;const p=tt.disabled,m=o.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(_,y,v,S,E,M,D){const B=y.transform,L=E==="map",N=M==="map";for(const X of _){const q=S.getTile(X),U=q.getBucket(v);if(!U||!U.text||!U.text.segments.get().length)continue;const W=c.evaluateSizeForZoom(U.textSizeData,B.zoom),te=st(q,1,y.transform.zoom),se=Ie(X.posMatrix,N,L,y.transform,te),he=v.layout.get("icon-text-fit")!=="none"&&U.hasIconData();if(W){const de=Math.pow(2,B.zoom-q.tileID.overscaledZ);sc(U,L,N,D,B,se,X.posMatrix,de,W,he,y.style.map.terrain?(Te,ye)=>y.style.map.terrain.getElevation(X,Te,ye):null)}}}(a,o,n,t,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),h),n.paint.get("icon-opacity").constantOr(1)!==0&&qo(o,t,n,a,!1,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),n.layout.get("icon-rotation-alignment"),n.layout.get("icon-pitch-alignment"),n.layout.get("icon-keep-upright"),p,m),n.paint.get("text-opacity").constantOr(1)!==0&&qo(o,t,n,a,!0,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.layout.get("text-keep-upright"),p,m),t.map.showCollisionBoxes&&(za(o,t,n,a,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),za(o,t,n,a,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(o,t,n,a){if(o.renderPass!=="translucent")return;const h=n.paint.get("circle-opacity"),p=n.paint.get("circle-stroke-width"),m=n.paint.get("circle-stroke-opacity"),_=!n.layout.get("circle-sort-key").isConstant();if(h.constantOr(1)===0&&(p.constantOr(1)===0||m.constantOr(1)===0))return;const y=o.context,v=y.gl,S=o.depthModeForSublayer(0,dt.ReadOnly),E=tt.disabled,M=o.colorModeForRenderPass(),D=[];for(let B=0;B<a.length;B++){const L=a[B],N=t.getTile(L),X=N.getBucket(n);if(!X)continue;const q=X.programConfigurations.get(n.id),U=o.useProgram("circle",q),W=X.layoutVertexBuffer,te=X.indexBuffer,se=o.style.map.terrain&&o.style.map.terrain.getTerrainData(L),he={programConfiguration:q,program:U,layoutVertexBuffer:W,indexBuffer:te,uniformValues:Lo(o,L,N,n),terrainData:se};if(_){const de=X.segments.get();for(const Te of de)D.push({segments:new c.SegmentVector([Te]),sortKey:Te.sortKey,state:he})}else D.push({segments:X.segments,sortKey:0,state:he})}_&&D.sort((B,L)=>B.sortKey-L.sortKey);for(const B of D){const{programConfiguration:L,program:N,layoutVertexBuffer:X,indexBuffer:q,uniformValues:U,terrainData:W}=B.state;N.draw(y,v.TRIANGLES,S,E,M,kt.disabled,U,W,n.id,X,q,B.segments,n.paint,o.transform.zoom,L)}},heatmap:function(o,t,n,a){if(n.paint.get("heatmap-opacity")!==0)if(o.renderPass==="offscreen"){const h=o.context,p=h.gl,m=tt.disabled,_=new Ut([p.ONE,p.ONE],c.Color.transparent,[!0,!0,!0,!0]);(function(y,v,S){const E=y.gl;y.activeTexture.set(E.TEXTURE1),y.viewport.set([0,0,v.width/4,v.height/4]);let M=S.heatmapFbo;if(M)E.bindTexture(E.TEXTURE_2D,M.colorAttachment.get()),y.bindFramebuffer.set(M.framebuffer);else{const D=E.createTexture();E.bindTexture(E.TEXTURE_2D,D),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_S,E.CLAMP_TO_EDGE),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_T,E.CLAMP_TO_EDGE),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_MIN_FILTER,E.LINEAR),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_MAG_FILTER,E.LINEAR),M=S.heatmapFbo=y.createFramebuffer(v.width/4,v.height/4,!1),function(B,L,N,X){const q=B.gl;q.texImage2D(q.TEXTURE_2D,0,q.RGBA,L.width/4,L.height/4,0,q.RGBA,B.extRenderToTextureHalfFloat?B.extTextureHalfFloat.HALF_FLOAT_OES:q.UNSIGNED_BYTE,null),X.colorAttachment.set(N)}(y,v,D,M)}})(h,o,n),h.clear({color:c.Color.transparent});for(let y=0;y<a.length;y++){const v=a[y];if(t.hasRenderableParent(v))continue;const S=t.getTile(v),E=S.getBucket(n);if(!E)continue;const M=E.programConfigurations.get(n.id),D=o.useProgram("heatmap",M),{zoom:B}=o.transform;D.draw(h,p.TRIANGLES,dt.disabled,m,_,kt.disabled,Ps(v.posMatrix,S,B,n.paint.get("heatmap-intensity")),null,n.id,E.layoutVertexBuffer,E.indexBuffer,E.segments,n.paint,o.transform.zoom,M)}h.viewport.set([0,0,o.width,o.height])}else o.renderPass==="translucent"&&(o.context.setColorMode(o.colorModeForRenderPass()),function(h,p){const m=h.context,_=m.gl,y=p.heatmapFbo;if(!y)return;m.activeTexture.set(_.TEXTURE0),_.bindTexture(_.TEXTURE_2D,y.colorAttachment.get()),m.activeTexture.set(_.TEXTURE1);let v=p.colorRampTexture;v||(v=p.colorRampTexture=new Dt(m,p.colorRamp,_.RGBA)),v.bind(_.LINEAR,_.CLAMP_TO_EDGE),h.useProgram("heatmapTexture").draw(m,_.TRIANGLES,dt.disabled,tt.disabled,h.colorModeForRenderPass(),kt.disabled,((S,E,M,D)=>{const B=c.create();c.ortho(B,0,S.width,S.height,0,0,1);const L=S.context.gl;return{u_matrix:B,u_world:[L.drawingBufferWidth,L.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:E.paint.get("heatmap-opacity")}})(h,p),null,p.id,h.viewportBuffer,h.quadTriangleIndexBuffer,h.viewportSegments,p.paint,h.transform.zoom)}(o,n))},line:function(o,t,n,a){if(o.renderPass!=="translucent")return;const h=n.paint.get("line-opacity"),p=n.paint.get("line-width");if(h.constantOr(1)===0||p.constantOr(1)===0)return;const m=o.depthModeForSublayer(0,dt.ReadOnly),_=o.colorModeForRenderPass(),y=n.paint.get("line-dasharray"),v=n.paint.get("line-pattern"),S=v.constantOr(1),E=n.paint.get("line-gradient"),M=n.getCrossfadeParameters(),D=S?"linePattern":y?"lineSDF":E?"lineGradient":"line",B=o.context,L=B.gl;let N=!0;for(const X of a){const q=t.getTile(X);if(S&&!q.patternsLoaded())continue;const U=q.getBucket(n);if(!U)continue;const W=U.programConfigurations.get(n.id),te=o.context.program.get(),se=o.useProgram(D,W),he=N||se.program!==te,de=o.style.map.terrain&&o.style.map.terrain.getTerrainData(X),Te=v.constantOr(null);if(Te&&q.imageAtlas){const Ge=q.imageAtlas,rt=Ge.patternPositions[Te.to.toString()],nt=Ge.patternPositions[Te.from.toString()];rt&&nt&&W.setConstantPatternPositions(rt,nt)}const ye=de?X:null,Ae=S?fa(o,q,n,M,ye):y?zs(o,q,n,y,M,ye):E?Do(o,q,n,U.lineClipsArray.length,ye):Wn(o,q,n,ye);if(S)B.activeTexture.set(L.TEXTURE0),q.imageAtlasTexture.bind(L.LINEAR,L.CLAMP_TO_EDGE),W.updatePaintBuffers(M);else if(y&&(he||o.lineAtlas.dirty))B.activeTexture.set(L.TEXTURE0),o.lineAtlas.bind(B);else if(E){const Ge=U.gradients[n.id];let rt=Ge.texture;if(n.gradientVersion!==Ge.version){let nt=256;if(n.stepInterpolant){const He=t.getSource().maxzoom,Mt=X.canonical.z===He?Math.ceil(1<<o.transform.maxZoom-X.canonical.z):1;nt=c.clamp(c.nextPowerOfTwo(U.maxLineLength/c.EXTENT*1024*Mt),256,B.maxTextureSize)}Ge.gradient=c.renderColorRamp({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:nt,image:Ge.gradient||void 0,clips:U.lineClipsArray}),Ge.texture?Ge.texture.update(Ge.gradient):Ge.texture=new Dt(B,Ge.gradient,L.RGBA),Ge.version=n.gradientVersion,rt=Ge.texture}B.activeTexture.set(L.TEXTURE0),rt.bind(n.stepInterpolant?L.NEAREST:L.LINEAR,L.CLAMP_TO_EDGE)}se.draw(B,L.TRIANGLES,m,o.stencilModeForClipping(X),_,kt.disabled,Ae,de,n.id,U.layoutVertexBuffer,U.indexBuffer,U.segments,n.paint,o.transform.zoom,W,U.layoutVertexBuffer2),N=!1}},fill:function(o,t,n,a){const h=n.paint.get("fill-color"),p=n.paint.get("fill-opacity");if(p.constantOr(1)===0)return;const m=o.colorModeForRenderPass(),_=n.paint.get("fill-pattern"),y=o.opaquePassEnabledForLayer()&&!_.constantOr(1)&&h.constantOr(c.Color.transparent).a===1&&p.constantOr(0)===1?"opaque":"translucent";if(o.renderPass===y){const v=o.depthModeForSublayer(1,o.renderPass==="opaque"?dt.ReadWrite:dt.ReadOnly);es(o,t,n,a,v,m,!1)}if(o.renderPass==="translucent"&&n.paint.get("fill-antialias")){const v=o.depthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,dt.ReadOnly);es(o,t,n,a,v,m,!0)}},"fill-extrusion":function(o,t,n,a){const h=n.paint.get("fill-extrusion-opacity");if(h!==0&&o.renderPass==="translucent"){const p=new dt(o.context.gl.LEQUAL,dt.ReadWrite,o.depthRangeFor3D);if(h!==1||n.paint.get("fill-extrusion-pattern").constantOr(1))ts(o,t,n,a,p,tt.disabled,Ut.disabled),ts(o,t,n,a,p,o.stencilModeFor3D(),o.colorModeForRenderPass());else{const m=o.colorModeForRenderPass();ts(o,t,n,a,p,tt.disabled,m)}}},hillshade:function(o,t,n,a){if(o.renderPass!=="offscreen"&&o.renderPass!=="translucent")return;const h=o.context,p=o.depthModeForSublayer(0,dt.ReadOnly),m=o.colorModeForRenderPass(),[_,y]=o.renderPass==="translucent"?o.stencilConfigForOverlap(a):[{},a];for(const v of y){const S=t.getTile(v);S.needsHillshadePrepare!==void 0&&S.needsHillshadePrepare&&o.renderPass==="offscreen"?Zo(o,S,n,p,tt.disabled,m):o.renderPass==="translucent"&&La(o,v,S,n,p,_[v.overscaledZ],m)}h.viewport.set([0,0,o.width,o.height])},raster:function(o,t,n,a){if(o.renderPass!=="translucent"||n.paint.get("raster-opacity")===0||!a.length)return;const h=o.context,p=h.gl,m=t.getSource(),_=o.useProgram("raster"),y=o.colorModeForRenderPass(),[v,S]=m instanceof ki?[{},a]:o.stencilConfigForOverlap(a),E=S[S.length-1].overscaledZ,M=!o.options.moving;for(const D of S){const B=o.depthModeForSublayer(D.overscaledZ-E,n.paint.get("raster-opacity")===1?dt.ReadWrite:dt.ReadOnly,p.LESS),L=t.getTile(D);L.registerFadeDuration(n.paint.get("raster-fade-duration"));const N=t.findLoadedParent(D,0),X=Ns(L,N,t,n,o.transform,o.style.map.terrain);let q,U;const W=n.paint.get("raster-resampling")==="nearest"?p.NEAREST:p.LINEAR;h.activeTexture.set(p.TEXTURE0),L.texture.bind(W,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),h.activeTexture.set(p.TEXTURE1),N?(N.texture.bind(W,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),q=Math.pow(2,N.tileID.overscaledZ-L.tileID.overscaledZ),U=[L.tileID.canonical.x*q%1,L.tileID.canonical.y*q%1]):L.texture.bind(W,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST);const te=o.style.map.terrain&&o.style.map.terrain.getTerrainData(D),se=te?D:null,he=se?se.posMatrix:o.transform.calculatePosMatrix(D.toUnwrapped(),M),de=Ls(he,U||[0,0],q||1,X,n);m instanceof ki?_.draw(h,p.TRIANGLES,B,tt.disabled,y,kt.disabled,de,te,n.id,m.boundsBuffer,o.quadTriangleIndexBuffer,m.boundsSegments):_.draw(h,p.TRIANGLES,B,v[D.overscaledZ],y,kt.disabled,de,te,n.id,o.rasterBoundsBuffer,o.quadTriangleIndexBuffer,o.rasterBoundsSegments)}},background:function(o,t,n,a){const h=n.paint.get("background-color"),p=n.paint.get("background-opacity");if(p===0)return;const m=o.context,_=m.gl,y=o.transform,v=y.tileSize,S=n.paint.get("background-pattern");if(o.isPatternMissing(S))return;const E=!S&&h.a===1&&p===1&&o.opaquePassEnabledForLayer()?"opaque":"translucent";if(o.renderPass!==E)return;const M=tt.disabled,D=o.depthModeForSublayer(0,E==="opaque"?dt.ReadWrite:dt.ReadOnly),B=o.colorModeForRenderPass(),L=o.useProgram(S?"backgroundPattern":"background"),N=a||y.coveringTiles({tileSize:v,terrain:o.style.map.terrain});S&&(m.activeTexture.set(_.TEXTURE0),o.imageManager.bind(o.context));const X=n.getCrossfadeParameters();for(const q of N){const U=a?q.posMatrix:o.transform.calculatePosMatrix(q.toUnwrapped()),W=S?Hl(U,p,o,S,{tileID:q,tileSize:v},X):Bo(U,p,h),te=o.style.map.terrain&&o.style.map.terrain.getTerrainData(q);L.draw(m,_.TRIANGLES,D,M,B,kt.disabled,W,te,n.id,o.tileExtentBuffer,o.quadTriangleIndexBuffer,o.tileExtentSegments)}},debug:function(o,t,n){for(let a=0;a<n.length;a++)ac(o,t,n[a])},custom:function(o,t,n){const a=o.context,h=n.implementation;if(o.renderPass==="offscreen"){const p=h.prerender;p&&(o.setCustomLayerDefaults(),a.setColorMode(o.colorModeForRenderPass()),p.call(h,a.gl,o.transform.customLayerMatrix()),a.setDirty(),o.setBaseState())}else if(o.renderPass==="translucent"){o.setCustomLayerDefaults(),a.setColorMode(o.colorModeForRenderPass()),a.setStencilMode(tt.disabled);const p=h.renderingMode==="3d"?new dt(o.context.gl.LEQUAL,dt.ReadWrite,o.depthRangeFor3D):o.depthModeForSublayer(0,dt.ReadOnly);a.setDepthMode(p),h.render(a.gl,o.transform.customLayerMatrix()),a.setDirty(),o.setBaseState(),a.bindFramebuffer.set(null)}}};class Ko{constructor(t,n){this.context=new bn(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.create(),renderTime:0},this.setup(),this.numSublayers=di.maxUnderzooming+di.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Ui,this.gpuTimers={}}resize(t,n,a){if(this.width=t*a,this.height=n*a,this.pixelRatio=a,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const h of this.style._order)this.style._layers[h].resize()}setup(){const t=this.context,n=new c.PosArray;n.emplaceBack(0,0),n.emplaceBack(c.EXTENT,0),n.emplaceBack(0,c.EXTENT),n.emplaceBack(c.EXTENT,c.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(n,qn.members),this.tileExtentSegments=c.SegmentVector.simpleSegment(0,0,4,2);const a=new c.PosArray;a.emplaceBack(0,0),a.emplaceBack(c.EXTENT,0),a.emplaceBack(0,c.EXTENT),a.emplaceBack(c.EXTENT,c.EXTENT),this.debugBuffer=t.createVertexBuffer(a,qn.members),this.debugSegments=c.SegmentVector.simpleSegment(0,0,4,5);const h=new c.RasterBoundsArray;h.emplaceBack(0,0,0,0),h.emplaceBack(c.EXTENT,0,c.EXTENT,0),h.emplaceBack(0,c.EXTENT,0,c.EXTENT),h.emplaceBack(c.EXTENT,c.EXTENT,c.EXTENT,c.EXTENT),this.rasterBoundsBuffer=t.createVertexBuffer(h,qr.members),this.rasterBoundsSegments=c.SegmentVector.simpleSegment(0,0,4,2);const p=new c.PosArray;p.emplaceBack(0,0),p.emplaceBack(1,0),p.emplaceBack(0,1),p.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(p,qn.members),this.viewportSegments=c.SegmentVector.simpleSegment(0,0,4,2);const m=new c.LineStripIndexArray;m.emplaceBack(0),m.emplaceBack(1),m.emplaceBack(3),m.emplaceBack(2),m.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(m);const _=new c.TriangleIndexArray;_.emplaceBack(0,1,2),_.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(_),this.emptyTexture=new Dt(t,{width:1,height:1,data:new Uint8Array([0,0,0,0])},t.gl.RGBA);const y=this.context.gl;this.stencilClearMode=new tt({func:y.ALWAYS,mask:0},0,255,y.ZERO,y.ZERO,y.ZERO)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const a=c.create();c.ortho(a,0,this.width,this.height,0,0,1),c.scale(a,a,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,dt.disabled,this.stencilClearMode,Ut.disabled,kt.disabled,_n(a),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n){if(this.currentStencilSource===t.source||!t.isTileClipped()||!n||!n.length)return;this.currentStencilSource=t.source;const a=this.context,h=a.gl;this.nextStencilID+n.length>256&&this.clearStencil(),a.setColorMode(Ut.disabled),a.setDepthMode(dt.disabled);const p=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const m of n){const _=this._tileClippingMaskIDs[m.key]=this.nextStencilID++,y=this.style.map.terrain&&this.style.map.terrain.getTerrainData(m);p.draw(a,h.TRIANGLES,dt.disabled,new tt({func:h.ALWAYS,mask:0},_,255,h.KEEP,h.KEEP,h.REPLACE),Ut.disabled,kt.disabled,_n(m.posMatrix),y,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new tt({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new tt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,a=t.sort((m,_)=>_.overscaledZ-m.overscaledZ),h=a[a.length-1].overscaledZ,p=a[0].overscaledZ-h+1;if(p>1){this.currentStencilSource=void 0,this.nextStencilID+p>256&&this.clearStencil();const m={};for(let _=0;_<p;_++)m[_+h]=new tt({func:n.GEQUAL,mask:255},_+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=p,[m,a]}return[{[h]:tt.disabled},a]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new Ut([t.CONSTANT_COLOR,t.ONE],new c.Color(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Ut.unblended:Ut.alphaBlended}depthModeForSublayer(t,n,a){if(!this.opaquePassEnabledForLayer())return dt.disabled;const h=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new dt(a||this.context.gl.LEQUAL,n,[h,h])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(c.exported.now()),this.imageManager.beginFrame();const a=this.style._order,h=this.style.sourceCaches;for(const y in h){const v=h[y];v.used&&v.prepare(this.context)}const p={},m={},_={};for(const y in h){const v=h[y];p[y]=v.getVisibleCoordinates(),m[y]=p[y].slice().reverse(),_[y]=v.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}if(this.renderToTexture){this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0;const y=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!c.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||y.length)&&(c.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(v,S){const E=v.context,M=E.gl,D=Ut.unblended,B=new dt(M.LEQUAL,dt.ReadWrite,[0,1]),L=S.getTerrainMesh(),N=S.sourceCache.getRenderableTiles(),X=v.useProgram("terrainDepth");E.bindFramebuffer.set(S.getFramebuffer("depth").framebuffer),E.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),E.clear({color:c.Color.transparent,depth:1});for(const q of N){const U=S.getTerrainData(q.tileID),W={u_matrix:v.transform.calculatePosMatrix(q.tileID.toUnwrapped()),u_ele_delta:S.getMeshFrameDelta(v.transform.zoom)};X.draw(E,M.TRIANGLES,B,tt.disabled,D,kt.backCCW,W,U,"terrain",L.vertexBuffer,L.indexBuffer,L.segments)}E.bindFramebuffer.set(null),E.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain),function(v,S){const E=v.context,M=E.gl,D=Ut.unblended,B=new dt(M.LEQUAL,dt.ReadWrite,[0,1]),L=S.getTerrainMesh(),N=S.getCoordsTexture(),X=S.sourceCache.getRenderableTiles(),q=v.useProgram("terrainCoords");E.bindFramebuffer.set(S.getFramebuffer("coords").framebuffer),E.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),E.clear({color:c.Color.transparent,depth:1}),S.coordsIndex=[];for(const U of X){const W=S.getTerrainData(U.tileID);E.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,N.texture);const te={u_matrix:v.transform.calculatePosMatrix(U.tileID.toUnwrapped()),u_terrain_coords_id:(255-S.coordsIndex.length)/255,u_texture:0,u_ele_delta:S.getMeshFrameDelta(v.transform.zoom)};q.draw(E,M.TRIANGLES,B,tt.disabled,D,kt.backCCW,te,W,"terrain",L.vertexBuffer,L.indexBuffer,L.segments),S.coordsIndex.push(U.tileID.key)}E.bindFramebuffer.set(null),E.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain))}this.renderPass="offscreen";for(const y of a){const v=this.style._layers[y];if(!v.hasOffscreenPass()||v.isHidden(this.transform.zoom))continue;const S=m[v.source];(v.type==="custom"||S.length)&&this.renderLayer(this,h[v.source],v,S)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?c.Color.black:c.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=a.length-1;this.currentLayer>=0;this.currentLayer--){const y=this.style._layers[a[this.currentLayer]],v=h[y.source],S=p[y.source];this._renderTileClippingMasks(y,S),this.renderLayer(this,v,y,S)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<a.length;this.currentLayer++){const y=this.style._layers[a[this.currentLayer]],v=h[y.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(y))continue;const S=(y.type==="symbol"?_:m)[y.source];this._renderTileClippingMasks(y,p[y.source]),this.renderLayer(this,v,y,S)}if(this.options.showTileBoundaries){const y=function(v,S){let E=null;const M=Object.values(v._layers).flatMap(N=>N.source&&!N.isHidden(S)?[v.sourceCaches[N.source]]:[]),D=M.filter(N=>N.getSource().type==="vector"),B=M.filter(N=>N.getSource().type!=="vector"),L=N=>{(!E||E.getSource().maxzoom<N.getSource().maxzoom)&&(E=N)};return D.forEach(N=>L(N)),E||B.forEach(N=>L(N)),E}(this.style,this.transform.zoom);y&&Ho.debug(this,y,y.getVisibleCoordinates())}this.options.showPadding&&function(y){const v=y.transform.padding;Jr(y,y.transform.height-(v.top||0),3,$s),Jr(y,v.bottom||0,3,er),is(y,v.left||0,3,Xo),is(y,y.transform.width-(v.right||0),3,Da);const S=y.transform.centerPoint;(function(E,M,D,B){wn(E,M-1,D-10,2,20,B),wn(E,M-10,D-1,20,2,B)})(y,S.x,y.transform.height-S.y,Wo)}(this),this.context.setDefault()}renderLayer(t,n,a,h){a.isHidden(this.transform.zoom)||(a.type==="background"||a.type==="custom"||(h||[]).length)&&(this.id=a.id,this.gpuTimingStart(a),Ho[a.type](t,n,a,h,this.style.placement.variableOffsets),this.gpuTimingEnd())}gpuTimingStart(t){if(!this.options.gpuTiming)return;const n=this.context.extTimerQuery;let a=this.gpuTimers[t.id];a||(a=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:n.createQueryEXT()}),a.calls++,n.beginQueryEXT(n.TIME_ELAPSED_EXT,a.query)}gpuTimingEnd(){if(!this.options.gpuTiming)return;const t=this.context.extTimerQuery;t.endQueryEXT(t.TIME_ELAPSED_EXT)}collectGpuTimers(){const t=this.gpuTimers;return this.gpuTimers={},t}queryGpuTimers(t){const n={};for(const a in t){const h=t[a],p=this.context.extTimerQuery,m=p.getQueryObjectEXT(h.query,p.QUERY_RESULT_EXT)/1e6;p.deleteQueryEXT(h.query),n[a]=m}return n}translatePosMatrix(t,n,a,h,p){if(!a[0]&&!a[1])return t;const m=p?h==="map"?this.transform.angle:0:h==="viewport"?-this.transform.angle:0;if(m){const v=Math.sin(m),S=Math.cos(m);a=[a[0]*S-a[1]*v,a[0]*v+a[1]*S]}const _=[p?a[0]:st(n,a[0],this.transform.zoom),p?a[1]:st(n,a[1],this.transform.zoom),0],y=new Float32Array(16);return c.translate(y,t,_),y}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const n=this.imageManager.getPattern(t.from.toString()),a=this.imageManager.getPattern(t.to.toString());return!n||!a}useProgram(t,n){this.cache=this.cache||{};const a=t+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[a]||(this.cache[a]=new Mo(this.context,t,Zn[t],n,Kl[t],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 t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Dt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class Tn{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,a){const h=Math.pow(2,a),p=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(_=>{const y=1/(_=c.transformMat4([],_,t))[3]/n*h;return c.mul$1(_,_,[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=c.sub([],p[_[0]],p[_[1]]),v=c.sub([],p[_[2]],p[_[1]]),S=c.normalize([],c.cross([],y,v)),E=-c.dot(S,p[_[1]]);return S.concat(E)});return new Tn(p,m)}}class Sn{constructor(t,n){this.min=t,this.max=n,this.center=c.scale$1([],c.add([],this.min,this.max),.5)}quadrant(t){const n=[t%2==0,t<2],a=c.clone$2(this.min),h=c.clone$2(this.max);for(let p=0;p<n.length;p++)a[p]=n[p]?this.min[p]:this.center[p],h[p]=n[p]?this.center[p]:this.max[p];return h[2]=this.max[2],new Sn(a,h)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersects(t){const n=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let a=!0;for(let h=0;h<t.planes.length;h++){const p=t.planes[h];let m=0;for(let _=0;_<n.length;_++)c.dot$1(p,n[_])>=0&&m++;if(m===0)return 0;m!==n.length&&(a=!1)}if(a)return 2;for(let h=0;h<3;h++){let p=Number.MAX_VALUE,m=-Number.MAX_VALUE;for(let _=0;_<t.points.length;_++){const y=t.points[_][h]-this.min[h];p=Math.min(p,y),m=Math.max(m,y)}if(m<0||p>this.max[h]-this.min[h])return 0}return 1}}class Gs{constructor(t=0,n=0,a=0,h=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(a)||a<0||isNaN(h)||h<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=a,this.right=h}interpolate(t,n,a){return n.top!=null&&t.top!=null&&(this.top=c.number(t.top,n.top,a)),n.bottom!=null&&t.bottom!=null&&(this.bottom=c.number(t.bottom,n.bottom,a)),n.left!=null&&t.left!=null&&(this.left=c.number(t.left,n.left,a)),n.right!=null&&t.right!=null&&(this.right=c.number(t.right,n.right,a)),this}getCenter(t,n){const a=c.clamp((this.left+t-this.right)/2,0,t),h=c.clamp((this.top+n-this.bottom)/2,0,n);return new c.pointGeometry(a,h)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Gs(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class qs{constructor(t,n,a,h,p){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=p===void 0||!!p,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=a??0,this._maxPitch=h??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new c.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Gs,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const t=new qs(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t._elevation=this._elevation,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._calcMatrices(),t}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new c.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-c.wrap(t,-180,180)*Math.PI/180;var a;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=(a=new c.ARRAY_TYPE(4),c.ARRAY_TYPE!=Float32Array&&(a[1]=0,a[2]=0),a[0]=1,a[3]=1,a),function(h,p,m){var _=p[0],y=p[1],v=p[2],S=p[3],E=Math.sin(m),M=Math.cos(m);h[0]=_*M+v*E,h[1]=y*M+S*E,h[2]=_*-E+v*M,h[3]=y*-E+S*M}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=c.clamp(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const n=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this.tileZoom=Math.max(0,Math.floor(n)),this.scale=this.zoomScale(n),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,a){this._unmodified=!1,this._edgeInsets.interpolate(t,n,a),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new c.UnwrappedTileID(0,t)];if(this._renderWorldCopies){const a=this.pointCoordinate(new c.pointGeometry(0,0)),h=this.pointCoordinate(new c.pointGeometry(this.width,0)),p=this.pointCoordinate(new c.pointGeometry(this.width,this.height)),m=this.pointCoordinate(new c.pointGeometry(0,this.height)),_=Math.floor(Math.min(a.x,h.x,p.x,m.x)),y=Math.floor(Math.max(a.x,h.x,p.x,m.x)),v=1;for(let S=_-v;S<=y+v;S++)S!==0&&n.push(new c.UnwrappedTileID(S,t))}return n}coveringTiles(t){var n,a;let h=this.coveringZoomLevel(t);const p=h;if(t.minzoom!==void 0&&h<t.minzoom)return[];t.maxzoom!==void 0&&h>t.maxzoom&&(h=t.maxzoom);const m=this.pointCoordinate(this.getCameraPoint()),_=c.MercatorCoordinate.fromLngLat(this.center),y=Math.pow(2,h),v=[y*m.x,y*m.y,0],S=[y*_.x,y*_.y,0],E=Tn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,h);let M=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(M=h);const D=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,B=U=>({aabb:new Sn([U*y,0,0],[(U+1)*y,y,0]),zoom:0,x:0,y:0,wrap:U,fullyVisible:!1}),L=[],N=[],X=h,q=t.reparseOverscaled?p:h;if(this._renderWorldCopies)for(let U=1;U<=3;U++)L.push(B(-U)),L.push(B(U));for(L.push(B(0));L.length>0;){const U=L.pop(),W=U.x,te=U.y;let se=U.fullyVisible;if(!se){const Ae=U.aabb.intersects(E);if(Ae===0)continue;se=Ae===2}const he=t.terrain?v:S,de=U.aabb.distanceX(he),Te=U.aabb.distanceY(he),ye=Math.max(Math.abs(de),Math.abs(Te));if(U.zoom===X||ye>D+(1<<X-U.zoom)-2&&U.zoom>=M){const Ae=X-U.zoom,Ge=v[0]-.5-(W<<Ae),rt=v[1]-.5-(te<<Ae);N.push({tileID:new c.OverscaledTileID(U.zoom===X?q:U.zoom,U.wrap,U.zoom,W,te),distanceSq:c.sqrLen([S[0]-.5-W,S[1]-.5-te]),tileDistanceToCamera:Math.sqrt(Ge*Ge+rt*rt)})}else for(let Ae=0;Ae<4;Ae++){const Ge=(W<<1)+Ae%2,rt=(te<<1)+(Ae>>1),nt=U.zoom+1;let He=U.aabb.quadrant(Ae);if(t.terrain){const Mt=new c.OverscaledTileID(nt,U.wrap,nt,Ge,rt),Tt=t.terrain.getMinMaxElevation(Mt),mt=(n=Tt.minElevation)!==null&&n!==void 0?n:this.elevation,yt=(a=Tt.maxElevation)!==null&&a!==void 0?a:this.elevation;He=new Sn([He.min[0],He.min[1],mt],[He.max[0],He.max[1],yt])}L.push({aabb:He,zoom:nt,x:Ge,y:rt,wrap:U.wrap,fullyVisible:se})}}return N.sort((U,W)=>U.distanceSq-W.distanceSq).map(U=>U.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const n=c.clamp(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new c.pointGeometry(c.mercatorXfromLng(t.lng)*this.worldSize,c.mercatorYfromLat(n)*this.worldSize)}unproject(t){return new c.MercatorCoordinate(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(t){this.freezeElevation||(this.elevation=t?this.getElevation(this._center,t):0)}getElevation(t,n){const a=c.MercatorCoordinate.fromLngLat(t),h=(1<<this.tileZoom)*c.EXTENT,p=a.x*h,m=a.y*h,_=Math.floor(p/c.EXTENT),y=Math.floor(m/c.EXTENT),v=new c.OverscaledTileID(this.tileZoom,0,this.tileZoom,_,y);return n.getElevation(v,p%c.EXTENT,m%c.EXTENT,c.EXTENT)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const n=this.pointLocation(this.centerPoint,t),a=this.getElevation(n,t);if(!(this.elevation-a))return;const h=this.getCameraPosition(),p=c.MercatorCoordinate.fromLngLat(h.lngLat,h.altitude),m=c.MercatorCoordinate.fromLngLat(n,a),_=p.x-m.x,y=p.y-m.y,v=p.z-m.z,S=Math.sqrt(_*_+y*y+v*v),E=this.scaleZoom(this.cameraToCenterDistance/S/this.tileSize);this._elevation=a,this._center=n,this.zoom=E}setLocationAtPoint(t,n){const a=this.pointCoordinate(n),h=this.pointCoordinate(this.centerPoint),p=this.locationCoordinate(t),m=new c.MercatorCoordinate(p.x-(a.x-h.x),p.y-(a.y-h.y));this.center=this.coordinateLocation(m),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,n){return n?this.coordinatePoint(this.locationCoordinate(t),this.getElevation(t,n),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,n){return this.coordinateLocation(this.pointCoordinate(t,n))}locationCoordinate(t){return c.MercatorCoordinate.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,n){if(n){const M=n.pointCoordinate(t);if(M!=null)return M}const a=[t.x,t.y,0,1],h=[t.x,t.y,1,1];c.transformMat4(a,a,this.pixelMatrixInverse),c.transformMat4(h,h,this.pixelMatrixInverse);const p=a[3],m=h[3],_=a[1]/p,y=h[1]/m,v=a[2]/p,S=h[2]/m,E=v===S?0:(0-v)/(S-v);return new c.MercatorCoordinate(c.number(a[0]/p,h[0]/m,E)/this.worldSize,c.number(_,y,E)/this.worldSize)}coordinatePoint(t,n=0,a=this.pixelMatrix){const h=[t.x*this.worldSize,t.y*this.worldSize,n,1];return c.transformMat4(h,h,a),new c.pointGeometry(h[0]/h[3],h[1]/h[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new c.LngLatBounds().extend(this.pointLocation(new c.pointGeometry(0,t))).extend(this.pointLocation(new c.pointGeometry(this.width,t))).extend(this.pointLocation(new c.pointGeometry(this.width,this.height))).extend(this.pointLocation(new c.pointGeometry(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new c.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(t,n=!1){const a=t.key,h=n?this._alignedPosMatrixCache:this._posMatrixCache;if(h[a])return h[a];const p=t.canonical,m=this.worldSize/this.zoomScale(p.z),_=p.x+Math.pow(2,p.z)*t.wrap,y=c.identity(new Float64Array(16));return c.translate(y,y,[_*m,p.y*m,0]),c.scale(y,y,[m/c.EXTENT,m/c.EXTENT,1]),c.multiply(y,n?this.alignedProjMatrix:this.projMatrix,y),h[a]=new Float32Array(y),h[a]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t,n,a,h,p=-90,m=90,_=-180,y=180;const v=this.size,S=this._unmodified;if(this.latRange){const D=this.latRange;p=c.mercatorYfromLat(D[1])*this.worldSize,m=c.mercatorYfromLat(D[0])*this.worldSize,t=m-p<v.y?v.y/(m-p):0}if(this.lngRange){const D=this.lngRange;_=c.wrap(c.mercatorXfromLng(D[0])*this.worldSize,0,this.worldSize),y=c.wrap(c.mercatorXfromLng(D[1])*this.worldSize,0,this.worldSize),y<_&&(y+=this.worldSize),n=y-_<v.x?v.x/(y-_):0}const E=this.point,M=Math.max(n||0,t||0);if(M)return this.center=this.unproject(new c.pointGeometry(n?(y+_)/2:E.x,t?(m+p)/2:E.y)),this.zoom+=this.scaleZoom(M),this._unmodified=S,void(this._constraining=!1);if(this.latRange){const D=E.y,B=v.y/2;D-B<p&&(h=p+B),D+B>m&&(h=m-B)}if(this.lngRange){const D=(_+y)/2,B=c.wrap(E.x,D-this.worldSize/2,D+this.worldSize/2),L=v.x/2;B-L<_&&(a=_+L),B+L>y&&(a=y-L)}a===void 0&&h===void 0||(this.center=this.unproject(new c.pointGeometry(a!==void 0?a:E.x,h!==void 0?h:E.y)).wrap()),this._unmodified=S,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,a=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=c.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let h=c.identity(new Float64Array(16));c.scale(h,h,[this.width/2,-this.height/2,1]),c.translate(h,h,[1,-1,0]),this.labelPlaneMatrix=h,h=c.identity(new Float64Array(16)),c.scale(h,h,[1,-1,1]),c.translate(h,h,[-1,-1,0]),c.scale(h,h,[2/this.width,2/this.height,1]),this.glCoordMatrix=h,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);const p=this._elevation<0?this.cameraToCenterDistance:this.cameraToSeaLevelDistance,m=Math.PI/2+this._pitch,_=this._fov*(.5+t.y/this.height),y=Math.sin(_)*p/Math.sin(c.clamp(Math.PI-m-_,.01,Math.PI-.01)),v=this.getHorizon(),S=2*Math.atan(v/this.cameraToCenterDistance)*(.5+t.y/(2*v)),E=Math.sin(S)*p/Math.sin(c.clamp(Math.PI-m-S,.01,Math.PI-.01)),M=Math.min(y,E),D=1.01*(Math.cos(Math.PI/2-this._pitch)*M+p),B=this.height/50;h=new Float64Array(16),c.perspective(h,this._fov,this.width/this.height,B,D),h[8]=2*-t.x/this.width,h[9]=2*t.y/this.height,c.scale(h,h,[1,-1,1]),c.translate(h,h,[0,0,-this.cameraToCenterDistance]),c.rotateX(h,h,this._pitch),c.rotateZ(h,h,this.angle),c.translate(h,h,[-n,-a,0]),this.mercatorMatrix=c.scale([],h,[this.worldSize,this.worldSize,this.worldSize]),c.scale(h,h,[1,1,this._pixelPerMeter]),this.pixelMatrix=c.multiply(new Float64Array(16),this.labelPlaneMatrix,h),c.translate(h,h,[0,0,-this.elevation]),this.projMatrix=h,this.invProjMatrix=c.invert([],h),this.pixelMatrix3D=c.multiply(new Float64Array(16),this.labelPlaneMatrix,h);const L=this.width%2/2,N=this.height%2/2,X=Math.cos(this.angle),q=Math.sin(this.angle),U=n-Math.round(n)+X*L+q*N,W=a-Math.round(a)+X*N+q*L,te=new Float64Array(h);if(c.translate(te,te,[U>.5?U-1:U,W>.5?W-1:W,0]),this.alignedProjMatrix=te,h=c.invert(new Float64Array(16),this.pixelMatrix),!h)throw new Error("failed to invert matrix");this.pixelMatrixInverse=h,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new c.pointGeometry(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return c.transformMat4(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new c.pointGeometry(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let a=n.x,h=n.y,p=n.x,m=n.y;for(const _ of t)a=Math.min(a,_.x),h=Math.min(h,_.y),p=Math.max(p,_.x),m=Math.max(m,_.y);return[new c.pointGeometry(a,h),new c.pointGeometry(p,h),new c.pointGeometry(p,m),new c.pointGeometry(a,m),new c.pointGeometry(a,h)]}}}class Zs{constructor(t){this._hashName=t&&encodeURIComponent(t),c.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(n,a){let h=!1,p=null;const m=()=>{p=null,h&&(n(),p=setTimeout(m,300),h=!1)};return()=>(h=!0,p||m(),p)}(this._updateHashUnthrottled.bind(this))}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){const n=this._map.getCenter(),a=Math.round(100*this._map.getZoom())/100,h=Math.ceil((a*Math.LN2+Math.log(512/360/.5))/Math.LN10),p=Math.pow(10,h),m=Math.round(n.lng*p)/p,_=Math.round(n.lat*p)/p,y=this._map.getBearing(),v=this._map.getPitch();let S="";if(S+=t?`/${m}/${_}/${a}`:`${a}/${_}/${m}`,(y||v)&&(S+="/"+Math.round(10*y)/10),v&&(S+=`/${Math.round(v)}`),this._hashName){const E=this._hashName;let M=!1;const D=window.location.hash.slice(1).split("&").map(B=>{const L=B.split("=")[0];return L===E?(M=!0,`${L}=${S}`):B}).filter(B=>B);return M||D.push(`${E}=${S}`),`#${D.join("&")}`}return`#${S}`}_getCurrentHash(){const t=window.location.hash.replace("#","");if(this._hashName){let n;return t.split("&").map(a=>a.split("=")).forEach(a=>{a[0]===this._hashName&&(n=a)}),(n&&n[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._getCurrentHash();if(t.length>=3&&!t.some(n=>isNaN(n))){const n=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:n,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){const t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t)}catch{}}}const En={linearity:.3,easing:c.bezier(0,0,.3,1)},Jo=c.extend({deceleration:2500,maxSpeed:1400},En),Yo=c.extend({deceleration:20,maxSpeed:1400},En),Qo=c.extend({deceleration:1e3,maxSpeed:360},En),el=c.extend({deceleration:1e3,maxSpeed:90},En);class tl{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:c.exported.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=c.exported.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new c.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:p}of this._inertiaBuffer)n.zoom+=p.zoomDelta||0,n.bearing+=p.bearingDelta||0,n.pitch+=p.pitchDelta||0,p.panDelta&&n.pan._add(p.panDelta),p.around&&(n.around=p.around),p.pinchAround&&(n.pinchAround=p.pinchAround);const a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,h={};if(n.pan.mag()){const p=rs(n.pan.mag(),a,c.extend({},Jo,t||{}));h.offset=n.pan.mult(p.amount/n.pan.mag()),h.center=this._map.transform.center,_r(h,p)}if(n.zoom){const p=rs(n.zoom,a,Yo);h.zoom=this._map.transform.zoom+p.amount,_r(h,p)}if(n.bearing){const p=rs(n.bearing,a,Qo);h.bearing=this._map.transform.bearing+c.clamp(p.amount,-179,179),_r(h,p)}if(n.pitch){const p=rs(n.pitch,a,el);h.pitch=this._map.transform.pitch+p.amount,_r(h,p)}if(h.zoom||h.bearing){const p=n.pinchAround===void 0?n.around:n.pinchAround;h.around=p?this._map.unproject(p):this._map.getCenter()}return this.clear(),c.extend(h,{noMoveStart:!0})}}function _r(o,t){(!o.duration||o.duration<t.duration)&&(o.duration=t.duration,o.easing=t.easing)}function rs(o,t,n){const{maxSpeed:a,linearity:h,deceleration:p}=n,m=c.clamp(o*h/(t/1e3),-a,a),_=Math.abs(m)/(p*h);return{easing:n.easing,duration:1e3*_,amount:m*(_/2)}}class Ni extends c.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a,h={}){const p=K.mousePos(n.getCanvasContainer(),a),m=n.unproject(p);super(t,c.extend({point:p,lngLat:m,originalEvent:a},h)),this._defaultPrevented=!1,this.target=n}}class ns extends c.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a){const h=t==="touchend"?a.changedTouches:a.touches,p=K.touchPos(n.getCanvasContainer(),h),m=p.map(y=>n.unproject(y)),_=p.reduce((y,v,S,E)=>y.add(v.div(E.length)),new c.pointGeometry(0,0));super(t,{points:p,point:_,lngLats:m,lngLat:n.unproject(_),originalEvent:a}),this._defaultPrevented=!1}}class il extends c.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a){super(t,{originalEvent:a}),this._defaultPrevented=!1}}class rl{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new il(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Ni(t.type,this._map,t))}mouseup(t){this._map.fire(new Ni(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Ni(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Ni(t.type,this._map,t))}mouseover(t){this._map.fire(new Ni(t.type,this._map,t))}mouseout(t){this._map.fire(new Ni(t.type,this._map,t))}touchstart(t){return this._firePreventable(new ns(t.type,this._map,t))}touchmove(t){this._map.fire(new ns(t.type,this._map,t))}touchend(t){this._map.fire(new ns(t.type,this._map,t))}touchcancel(t){this._map.fire(new ns(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class nl{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Ni(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ni("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Ni(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ss{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(K.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const a=n;if(this._lastPos.equals(a)||!this._box&&a.dist(this._startPos)<this._clickTolerance)return;const h=this._startPos;this._lastPos=a,this._box||(this._box=K.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const p=Math.min(h.x,a.x),m=Math.max(h.x,a.x),_=Math.min(h.y,a.y),y=Math.max(h.y,a.y);K.setTransform(this._box,`translate(${p}px,${_}px)`),this._box.style.width=m-p+"px",this._box.style.height=y-_+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const a=this._startPos,h=n;if(this.reset(),K.suppressClick(),a.x!==h.x||a.y!==h.y)return this._map.fire(new c.Event("boxzoomend",{originalEvent:t})),{cameraAnimation:p=>p.fitScreenCoordinates(a,h,this._map.getBearing(),{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(K.remove(this._box),this._box=null),K.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new c.Event(t,{originalEvent:n}))}}function Xs(o,t){if(o.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${o.length}, points ${t.length}`);const n={};for(let a=0;a<o.length;a++)n[o[a].identifier]=t[a];return n}class yr{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,a){(this.centroid||a.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),a.length===this.numTouches&&(this.centroid=function(h){const p=new c.pointGeometry(0,0);for(const m of h)p._add(m);return p.div(h.length)}(n),this.touches=Xs(a,n)))}touchmove(t,n,a){if(this.aborted||!this.centroid)return;const h=Xs(a,n);for(const p in this.touches){const m=h[p];(!m||m.dist(this.touches[p])>30)&&(this.aborted=!0)}}touchend(t,n,a){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),a.length===0){const h=!this.aborted&&this.centroid;if(this.reset(),h)return h}}}class or{constructor(t){this.singleTap=new yr(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,a){this.singleTap.touchstart(t,n,a)}touchmove(t,n,a){this.singleTap.touchmove(t,n,a)}touchend(t,n,a){const h=this.singleTap.touchend(t,n,a);if(h){const p=t.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(h)<30;if(p&&m||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=h,this.count===this.numTaps)return this.reset(),h}}}class sl{constructor(){this._zoomIn=new or({numTouches:1,numTaps:2}),this._zoomOut=new or({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,a){this._zoomIn.touchstart(t,n,a),this._zoomOut.touchstart(t,n,a)}touchmove(t,n,a){this._zoomIn.touchmove(t,n,a),this._zoomOut.touchmove(t,n,a)}touchend(t,n,a){const h=this._zoomIn.touchend(t,n,a),p=this._zoomOut.touchend(t,n,a);return h?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:m=>m.easeTo({duration:300,zoom:m.getZoom()+1,around:m.unproject(h)},{originalEvent:t})}):p?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:m=>m.easeTo({duration:300,zoom:m.getZoom()-1,around:m.unproject(p)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class $i{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const n=this._moveFunction(...t);if(n.bearingDelta||n.pitchDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(t,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=n.length?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,n){if(!this.isEnabled())return;const a=this._lastPoint;if(!a)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const h=n.length?n[0]:n;return!this._moved&&h.dist(a)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=h,this._move(a,h))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&K.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const as={0:1,2:2};class Ra{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const n=K.mouseButton(t);this._eventButton=n}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!function(n,a){const h=as[a];return n.buttons===void 0||(n.buttons&h)!==h}(t,this._eventButton)}isValidEndEvent(t){return K.mouseButton(t)===this._eventButton}}class al{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return t.targetTouches.length===1}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}const Ba=o=>{o.mousedown=o.dragStart,o.mousemoveWindow=o.dragMove,o.mouseup=o.dragEnd,o.contextmenu=function(t){t.preventDefault()}},Fa=({enable:o,clickTolerance:t,bearingDegreesPerPixelMoved:n=.8})=>{const a=new Ra({checkCorrectEvent:h=>K.mouseButton(h)===0&&h.ctrlKey||K.mouseButton(h)===2});return new $i({clickTolerance:t,move:(h,p)=>({bearingDelta:(p.x-h.x)*n}),moveStateManager:a,enable:o,assignEvents:Ba})},In=({enable:o,clickTolerance:t,pitchDegreesPerPixelMoved:n=-.5})=>{const a=new Ra({checkCorrectEvent:h=>K.mouseButton(h)===0&&h.ctrlKey||K.mouseButton(h)===2});return new $i({clickTolerance:t,move:(h,p)=>({pitchDelta:(p.y-h.y)*n}),moveStateManager:a,enable:o,assignEvents:Ba})};class $r{constructor(t,n){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new c.pointGeometry(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(t,n,a){return this._calculateTransform(t,n,a)}touchmove(t,n,a){if(this._map._cooperativeGestures&&(this._minTouches===2&&a.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,a.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(a.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,n,a)}touchend(t,n,a){this._calculateTransform(t,n,a),this._active&&a.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,a){a.length>0&&(this._active=!0);const h=Xs(a,n),p=new c.pointGeometry(0,0),m=new c.pointGeometry(0,0);let _=0;for(const v in h){const S=h[v],E=this._touches[v];E&&(p._add(S),m._add(S.sub(E)),_++,h[v]=S)}if(this._touches=h,_<this._minTouches||!m.mag())return;const y=m.div(_);return this._sum._add(y),this._sum.mag()<this._clickTolerance?void 0:{around:p.div(_),panDelta:y}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class $e{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(t){}_move(t,n,a){return{}}touchstart(t,n,a){this._firstTwoTouches||a.length<2||(this._firstTwoTouches=[a[0].identifier,a[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,a){if(!this._firstTwoTouches)return;t.preventDefault();const[h,p]=this._firstTwoTouches,m=os(a,n,h),_=os(a,n,p);if(!m||!_)return;const y=this._aroundCenter?null:m.add(_).div(2);return this._move([m,_],y,t)}touchend(t,n,a){if(!this._firstTwoTouches)return;const[h,p]=this._firstTwoTouches,m=os(a,n,h),_=os(a,n,p);m&&_||(this._active&&K.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function os(o,t,n){for(let a=0;a<o.length;a++)if(o[a].identifier===n)return t[a]}function An(o,t){return Math.log(o/t)/Math.LN2}class ls extends $e{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const a=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(An(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:An(this._distance,a),pinchAround:n}}}function Oa(o,t){return 180*o.angleWith(t)/Math.PI}class Oe extends $e{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,n){const a=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Oa(this._vector,a),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,a=Oa(t,this._startVector);return Math.abs(a)<n}}function cs(o){return Math.abs(o.y)>Math.abs(o.x)}class oc extends $e{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,a){super.touchstart(t,n,a),this._currentTouchCount=a.length}_start(t){this._lastPoints=t,cs(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,a){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const h=t[0].sub(this._lastPoints[0]),p=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(h,p,a.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(h.y+p.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,a){if(this._valid!==void 0)return this._valid;const h=t.mag()>=2,p=n.mag()>=2;if(!h&&!p)return;if(!h||!p)return this._firstMove===void 0&&(this._firstMove=a),a-this._firstMove<100&&void 0;const m=t.y>0==n.y>0;return cs(t)&&cs(n)&&m}}const lc={panStep:100,bearingStep:15,pitchStep:10};class Ua{constructor(){const t=lc;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,a=0,h=0,p=0,m=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?a=-1:(t.preventDefault(),p=-1);break;case 39:t.shiftKey?a=1:(t.preventDefault(),p=1);break;case 38:t.shiftKey?h=1:(t.preventDefault(),m=-1);break;case 40:t.shiftKey?h=-1:(t.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(a=0,h=0),{cameraAnimation:_=>{const y=_.getZoom();_.easeTo({duration:300,easeId:"keyboardHandler",easing:ol,zoom:n?Math.round(y)+n*(t.shiftKey?2:1):y,bearing:_.getBearing()+a*this._bearingStep,pitch:_.getPitch()+h*this._pitchStep,offset:[-p*this._panStep,-m*this._panStep],center:_.getCenter()},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function ol(o){return o*(2-o)}const Va=4.000244140625;class cc{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,c.bindAll(["_onTimeout"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!this._map._metaPress)return;t.preventDefault()}let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const a=c.exported.now(),h=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,n!==0&&n%Va==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":h>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(h*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=K.mousePos(this._el,t);this._around=c.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(n)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._map.transform;if(this._delta!==0){const _=this._type==="wheel"&&Math.abs(this._delta)>Va?this._wheelZoomRate:this._defaultZoomRate;let y=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&y!==0&&(y=1/y);const v=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(v*y))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,a=this._startZoom,h=this._easing;let p,m=!1;if(this._type==="wheel"&&a&&h){const _=Math.min((c.exported.now()-this._lastWheelEventTime)/200,1),y=h(_);p=c.number(a,n,y),_<1?this._frameId||(this._frameId=!0):m=!0}else p=n,m=!0;return this._active=!0,m&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!m,zoomDelta:p-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=c.ease;if(this._prevEase){const a=this._prevEase,h=(c.exported.now()-a.start)/a.duration,p=a.easing(h+.01)-a.easing(h),m=.27/Math.sqrt(p*p+1e-4)*.01,_=Math.sqrt(.0729-m*m);n=c.bezier(m,_,.25,1)}return this._prevEase={start:c.exported.now(),duration:t,easing:n},n}reset(){this._active=!1}}class hc{constructor(t,n){this._clickZoom=t,this._tapZoom=n}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Na{constructor(){this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:a=>{a.easeTo({duration:300,zoom:a.getZoom()+(t.shiftKey?-1:1),around:a.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class $a{constructor(){this._tap=new or({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(t,n,a){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?a.length>0&&(this._swipePoint=n[0],this._swipeTouch=a[0].identifier):this._tap.touchstart(t,n,a))}touchmove(t,n,a){if(this._tapTime){if(this._swipePoint){if(a[0].identifier!==this._swipeTouch)return;const h=n[0],p=h.y-this._swipePoint.y;return this._swipePoint=h,t.preventDefault(),this._active=!0,{zoomDelta:p/128}}}else this._tap.touchmove(t,n,a)}touchend(t,n,a){this._tapTime?this._swipePoint&&a.length===0&&this.reset():this._tap.touchend(t,n,a)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ja{constructor(t,n,a){this._el=t,this._mousePan=n,this._touchPan=a}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Ga{constructor(t,n,a){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,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 zi{constructor(t,n,a,h){this._el=t,this._touchZoom=n,this._touchRotate=a,this._tapDragZoom=h,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const lr=o=>o.zoom||o.drag||o.pitch||o.rotate;class ll extends c.Event{}function hs(o){return o.panDelta&&o.panDelta.mag()||o.zoomDelta||o.bearingDelta||o.pitchDelta}class qa{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new tl(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),c.bindAll(["handleEvent","handleWindowEvent"],this);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[h,p,m]of this._listeners)K.addEventListener(h,p,h===document?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(const[t,n,a]of this._listeners)K.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,a)}_addDefaultHandlers(t){const n=this._map,a=n.getCanvasContainer();this._add("mapEvent",new rl(n,t));const h=n.boxZoom=new ss(n,t);this._add("boxZoom",h);const p=new sl,m=new Na;n.doubleClickZoom=new hc(m,p),this._add("tapZoom",p),this._add("clickZoom",m);const _=new $a;this._add("tapDragZoom",_);const y=n.touchPitch=new oc(n);this._add("touchPitch",y);const v=Fa(t),S=In(t);n.dragRotate=new Ga(t,v,S),this._add("mouseRotate",v,["mousePitch"]),this._add("mousePitch",S,["mouseRotate"]);const E=(({enable:X,clickTolerance:q})=>{const U=new Ra({checkCorrectEvent:W=>K.mouseButton(W)===0&&!W.ctrlKey});return new $i({clickTolerance:q,move:(W,te)=>({around:te,panDelta:te.sub(W)}),activateOnStart:!0,moveStateManager:U,enable:X,assignEvents:Ba})})(t),M=new $r(t,n);n.dragPan=new ja(a,E,M),this._add("mousePan",E),this._add("touchPan",M,["touchZoom","touchRotate"]);const D=new Oe,B=new ls;n.touchZoomRotate=new zi(a,B,D,_),this._add("touchRotate",D,["touchPan","touchZoom"]),this._add("touchZoom",B,["touchPan","touchRotate"]);const L=n.scrollZoom=new cc(n,this);this._add("scrollZoom",L,["mousePan"]);const N=n.keyboard=new Ua;this._add("keyboard",N),this._add("blockableMapEvent",new nl(n));for(const X of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[X]&&n[X].enable(t[X])}_add(t,n,a){this._handlers.push({handlerName:t,handler:n,allowed:a}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(lr(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,n,a){for(const h in t)if(h!==a&&(!n||n.indexOf(h)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const n=[];for(const a of t)this._el.contains(a.target)&&n.push(a);return n}handleEvent(t,n){if(t.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const a=t.type==="renderFrame"?void 0:t,h={needsRenderFrame:!1},p={},m={},_=t.touches,y=_?this._getMapTouches(_):void 0,v=y?K.touchPos(this._el,y):K.mousePos(this._el,t);for(const{handlerName:M,handler:D,allowed:B}of this._handlers){if(!D.isEnabled())continue;let L;this._blockedByActive(m,B,M)?D.reset():D[n||t.type]&&(L=D[n||t.type](t,v,y),this.mergeHandlerResult(h,p,L,M,a),L&&L.needsRenderFrame&&this._triggerRenderFrame()),(L||D.isActive())&&(m[M]=D)}const S={};for(const M in this._previousActiveHandlers)m[M]||(S[M]=a);this._previousActiveHandlers=m,(Object.keys(S).length||hs(h))&&(this._changes.push([h,p,S]),this._triggerRenderFrame()),(Object.keys(m).length||hs(h))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:E}=h;E&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],E(this._map))}mergeHandlerResult(t,n,a,h,p){if(!a)return;c.extend(t,a);const m={handlerName:h,originalEvent:a.originalEvent||p};a.zoomDelta!==void 0&&(n.zoom=m),a.panDelta!==void 0&&(n.drag=m),a.pitchDelta!==void 0&&(n.pitch=m),a.bearingDelta!==void 0&&(n.rotate=m)}_applyChanges(){const t={},n={},a={};for(const[h,p,m]of this._changes)h.panDelta&&(t.panDelta=(t.panDelta||new c.pointGeometry(0,0))._add(h.panDelta)),h.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+h.zoomDelta),h.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+h.bearingDelta),h.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+h.pitchDelta),h.around!==void 0&&(t.around=h.around),h.pinchAround!==void 0&&(t.pinchAround=h.pinchAround),h.noInertia&&(t.noInertia=h.noInertia),c.extend(n,p),c.extend(a,m);this._updateMapTransform(t,n,a),this._changes=[]}_updateMapTransform(t,n,a){const h=this._map,p=h.transform,m=h.terrain;if(!(hs(t)||m&&this._terrainMovement))return this._fireEvents(n,a,!0);let{panDelta:_,zoomDelta:y,bearingDelta:v,pitchDelta:S,around:E,pinchAround:M}=t;M!==void 0&&(E=M),h._stop(!0),E=E||h.transform.centerPoint;const D=p.pointLocation(_?E.sub(_):E);v&&(p.bearing+=v),S&&(p.pitch+=S),y&&(p.zoom+=y),m?this._terrainMovement||!n.drag&&!n.zoom?n.drag&&this._terrainMovement?p.center=p.pointLocation(p.centerPoint.sub(_)):p.setLocationAtPoint(D,E):(this._terrainMovement=!0,p.freezeElevation=!0,p.setLocationAtPoint(D,E),this._map.once("moveend",()=>{p.freezeElevation=!1,this._terrainMovement=!1,p.recalculateZoom(h.terrain)})):p.setLocationAtPoint(D,E),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,a,!0)}_fireEvents(t,n,a){const h=lr(this._eventsInProgress),p=lr(t),m={};for(const S in t){const{originalEvent:E}=t[S];this._eventsInProgress[S]||(m[`${S}start`]=E),this._eventsInProgress[S]=t[S]}!h&&p&&this._fireEvent("movestart",p.originalEvent);for(const S in m)this._fireEvent(S,m[S]);p&&this._fireEvent("move",p.originalEvent);for(const S in t){const{originalEvent:E}=t[S];this._fireEvent(S,E)}const _={};let y;for(const S in this._eventsInProgress){const{handlerName:E,originalEvent:M}=this._eventsInProgress[S];this._handlersById[E].isActive()||(delete this._eventsInProgress[S],y=n[E]||M,_[`${S}end`]=y)}for(const S in _)this._fireEvent(S,_[S]);const v=lr(this._eventsInProgress);if(a&&(h||p)&&!v){this._updatingCamera=!0;const S=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),E=M=>M!==0&&-this._bearingSnap<M&&M<this._bearingSnap;S?(E(S.bearing||this._map.getBearing())&&(S.bearing=0),S.freezeElevation=!0,this._map.easeTo(S,{originalEvent:y})):(this._map.fire(new c.Event("moveend",{originalEvent:y})),E(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new c.Event(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new ll("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Za={extend:(o,...t)=>c.extend(o,...t),run(o){o()},logToElement(o,t=!1,n="log"){const a=window.document.getElementById(n);a&&(t&&(a.innerHTML=""),a.innerHTML+=`<br>${o}`)}};class cl extends c.Evented{constructor(t,n){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,c.bindAll(["_renderFrameCallback"],this)}getCenter(){return new c.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,a){return t=c.pointGeometry.convert(t).mult(-1),this.panTo(this.transform.center,c.extend({offset:t},n),a)}panTo(t,n,a){return this.easeTo(c.extend({center:t},n),a)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,a){return this.easeTo(c.extend({zoom:t},n),a)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,a){return this.easeTo(c.extend({bearing:t},n),a)}resetNorth(t,n){return this.rotateTo(0,c.extend({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(c.extend({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}cameraForBounds(t,n){t=c.LngLatBounds.convert(t);const a=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),a,n)}_cameraForBoxAndBearing(t,n,a,h){const p={top:0,bottom:0,right:0,left:0};if(typeof(h=c.extend({padding:p,offset:[0,0],maxZoom:this.transform.maxZoom},h)).padding=="number"){const te=h.padding;h.padding={top:te,bottom:te,right:te,left:te}}h.padding=c.extend(p,h.padding);const m=this.transform,_=m.padding,y=m.project(c.LngLat.convert(t)),v=m.project(c.LngLat.convert(n)),S=y.rotate(-a*Math.PI/180),E=v.rotate(-a*Math.PI/180),M=new c.pointGeometry(Math.max(S.x,E.x),Math.max(S.y,E.y)),D=new c.pointGeometry(Math.min(S.x,E.x),Math.min(S.y,E.y)),B=M.sub(D),L=(m.width-(_.left+_.right+h.padding.left+h.padding.right))/B.x,N=(m.height-(_.top+_.bottom+h.padding.top+h.padding.bottom))/B.y;if(N<0||L<0)return void c.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const X=Math.min(m.scaleZoom(m.scale*Math.min(L,N)),h.maxZoom),q=c.pointGeometry.convert(h.offset),U=new c.pointGeometry((h.padding.left-h.padding.right)/2,(h.padding.top-h.padding.bottom)/2).rotate(a*Math.PI/180),W=q.add(U).mult(m.scale/m.zoomScale(X));return{center:m.unproject(y.add(v).div(2).sub(W)),zoom:X,bearing:a}}fitBounds(t,n,a){return this._fitInternal(this.cameraForBounds(t,n),n,a)}fitScreenCoordinates(t,n,a,h,p){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(c.pointGeometry.convert(t)),this.transform.pointLocation(c.pointGeometry.convert(n)),a,h),h,p)}_fitInternal(t,n,a){return t?(delete(n=c.extend(t,n)).padding,n.linear?this.easeTo(n,a):this.flyTo(n,a)):this}jumpTo(t,n){this.stop();const a=this.transform;let h=!1,p=!1,m=!1;return"zoom"in t&&a.zoom!==+t.zoom&&(h=!0,a.zoom=+t.zoom),t.center!==void 0&&(a.center=c.LngLat.convert(t.center)),"bearing"in t&&a.bearing!==+t.bearing&&(p=!0,a.bearing=+t.bearing),"pitch"in t&&a.pitch!==+t.pitch&&(m=!0,a.pitch=+t.pitch),t.padding==null||a.isPaddingEqual(t.padding)||(a.padding=t.padding),this.fire(new c.Event("movestart",n)).fire(new c.Event("move",n)),h&&this.fire(new c.Event("zoomstart",n)).fire(new c.Event("zoom",n)).fire(new c.Event("zoomend",n)),p&&this.fire(new c.Event("rotatestart",n)).fire(new c.Event("rotate",n)).fire(new c.Event("rotateend",n)),m&&this.fire(new c.Event("pitchstart",n)).fire(new c.Event("pitch",n)).fire(new c.Event("pitchend",n)),this.fire(new c.Event("moveend",n))}calculateCameraOptionsFromTo(t,n,a,h=0){const p=c.MercatorCoordinate.fromLngLat(t,n),m=c.MercatorCoordinate.fromLngLat(a,h),_=m.x-p.x,y=m.y-p.y,v=m.z-p.z,S=Math.hypot(_,y,v);if(S===0)throw new Error("Can't calculate camera options with same From and To");const E=Math.hypot(_,y),M=this.transform.scaleZoom(this.transform.cameraToCenterDistance/S/this.transform.tileSize),D=180*Math.atan2(_,-y)/Math.PI;let B=180*Math.acos(E/S)/Math.PI;return B=v<0?90-B:90+B,{center:m.toLngLat(),zoom:M,pitch:B,bearing:D}}easeTo(t,n){this._stop(!1,t.easeId),((t=c.extend({offset:[0,0],duration:500,easing:c.ease},t)).animate===!1||!t.essential&&c.exported.prefersReducedMotion)&&(t.duration=0);const a=this.transform,h=this.getZoom(),p=this.getBearing(),m=this.getPitch(),_=this.getPadding(),y="zoom"in t?+t.zoom:h,v="bearing"in t?this._normalizeBearing(t.bearing,p):p,S="pitch"in t?+t.pitch:m,E="padding"in t?t.padding:a.padding,M=c.pointGeometry.convert(t.offset);let D=a.centerPoint.add(M);const B=a.pointLocation(D),L=c.LngLat.convert(t.center||B);this._normalizeCenter(L);const N=a.project(B),X=a.project(L).sub(N),q=a.zoomScale(y-h);let U,W;t.around&&(U=c.LngLat.convert(t.around),W=a.locationPoint(U));const te={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||y!==h,this._rotating=this._rotating||p!==v,this._pitching=this._pitching||S!==m,this._padding=!a.isPaddingEqual(E),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,te),this.terrain&&this._prepareElevation(L),this._ease(se=>{if(this._zooming&&(a.zoom=c.number(h,y,se)),this._rotating&&(a.bearing=c.number(p,v,se)),this._pitching&&(a.pitch=c.number(m,S,se)),this._padding&&(a.interpolatePadding(_,E,se),D=a.centerPoint.add(M)),this.terrain&&!t.freezeElevation&&this._updateElevation(se),U)a.setLocationAtPoint(U,W);else{const he=a.zoomScale(a.zoom-h),de=y>h?Math.min(2,q):Math.max(.5,q),Te=Math.pow(de,1-se),ye=a.unproject(N.add(X.mult(se*Te)).mult(he));a.setLocationAtPoint(a.renderWorldCopies?ye.wrap():ye,D)}this._fireMoveEvents(n)},se=>{this.terrain&&this._finalizeElevation(),this._afterEase(n,se)},t),this}_prepareEase(t,n,a={}){this._moving=!0,n||a.moving||this.fire(new c.Event("movestart",t)),this._zooming&&!a.zooming&&this.fire(new c.Event("zoomstart",t)),this._rotating&&!a.rotating&&this.fire(new c.Event("rotatestart",t)),this._pitching&&!a.pitching&&this.fire(new c.Event("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.transform.getElevation(t,this.terrain),this.transform.freezeElevation=!0}_updateElevation(t){const n=this.transform.getElevation(this._elevationCenter,this.terrain);if(t<1&&n!==this._elevationTarget){const a=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(a-(n-(a*t+this._elevationStart))/(1-t)),this._elevationTarget=n}this.transform.elevation=c.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this.transform.freezeElevation=!1,this.transform.recalculateZoom(this.terrain)}_fireMoveEvents(t){this.fire(new c.Event("move",t)),this._zooming&&this.fire(new c.Event("zoom",t)),this._rotating&&this.fire(new c.Event("rotate",t)),this._pitching&&this.fire(new c.Event("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const a=this._zooming,h=this._rotating,p=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,a&&this.fire(new c.Event("zoomend",t)),h&&this.fire(new c.Event("rotateend",t)),p&&this.fire(new c.Event("pitchend",t)),this.fire(new c.Event("moveend",t))}flyTo(t,n){if(!t.essential&&c.exported.prefersReducedMotion){const He=c.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(He,n)}this.stop(),t=c.extend({offset:[0,0],speed:1.2,curve:1.42,easing:c.ease},t);const a=this.transform,h=this.getZoom(),p=this.getBearing(),m=this.getPitch(),_=this.getPadding(),y="zoom"in t?c.clamp(+t.zoom,a.minZoom,a.maxZoom):h,v="bearing"in t?this._normalizeBearing(t.bearing,p):p,S="pitch"in t?+t.pitch:m,E="padding"in t?t.padding:a.padding,M=a.zoomScale(y-h),D=c.pointGeometry.convert(t.offset);let B=a.centerPoint.add(D);const L=a.pointLocation(B),N=c.LngLat.convert(t.center||L);this._normalizeCenter(N);const X=a.project(L),q=a.project(N).sub(X);let U=t.curve;const W=Math.max(a.width,a.height),te=W/M,se=q.mag();if("minZoom"in t){const He=c.clamp(Math.min(t.minZoom,h,y),a.minZoom,a.maxZoom),Mt=W/a.zoomScale(He-h);U=Math.sqrt(Mt/se*2)}const he=U*U;function de(He){const Mt=(te*te-W*W+(He?-1:1)*he*he*se*se)/(2*(He?te:W)*he*se);return Math.log(Math.sqrt(Mt*Mt+1)-Mt)}function Te(He){return(Math.exp(He)-Math.exp(-He))/2}function ye(He){return(Math.exp(He)+Math.exp(-He))/2}const Ae=de(0);let Ge=function(He){return ye(Ae)/ye(Ae+U*He)},rt=function(He){return W*((ye(Ae)*(Te(Mt=Ae+U*He)/ye(Mt))-Te(Ae))/he)/se;var Mt},nt=(de(1)-Ae)/U;if(Math.abs(se)<1e-6||!isFinite(nt)){if(Math.abs(W-te)<1e-6)return this.easeTo(t,n);const He=te<W?-1:1;nt=Math.abs(Math.log(te/W))/U,rt=function(){return 0},Ge=function(Mt){return Math.exp(He*U*Mt)}}return t.duration="duration"in t?+t.duration:1e3*nt/("screenSpeed"in t?+t.screenSpeed/U:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=p!==v,this._pitching=S!==m,this._padding=!a.isPaddingEqual(E),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(N),this._ease(He=>{const Mt=He*nt,Tt=1/Ge(Mt);a.zoom=He===1?y:h+a.scaleZoom(Tt),this._rotating&&(a.bearing=c.number(p,v,He)),this._pitching&&(a.pitch=c.number(m,S,He)),this._padding&&(a.interpolatePadding(_,E,He),B=a.centerPoint.add(D)),this.terrain&&!t.freezeElevation&&this._updateElevation(He);const mt=He===1?N:a.unproject(X.add(q.mult(rt(Mt))).mult(Tt));a.setLocationAtPoint(a.renderWorldCopies?mt.wrap():mt,B),this._fireMoveEvents(n)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(n)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const a=this._onEaseEnd;delete this._onEaseEnd,a.call(this,n)}if(!t){const a=this.handlers;a&&a.stop(!1)}return this}_ease(t,n,a){a.animate===!1||a.duration===0?(t(1),n()):(this._easeStart=c.exported.now(),this._easeOptions=a,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((c.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,n){t=c.wrap(t,-180,180);const a=Math.abs(t-n);return Math.abs(t-360-n)<a&&(t-=360),Math.abs(t+360-n)<a&&(t+=360),t}_normalizeCenter(t){const n=this.transform;if(!n.renderWorldCopies||n.lngRange)return;const a=t.lng-n.center.lng;t.lng+=a>180?-360:a<-180?360:0}}class ji{constructor(t={}){this.options=t,c.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=K.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=K.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=K.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(){K.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,n){const a=this._map._getUIString(`AttributionControl.${n}`);t.title=a,t.setAttribute("aria-label",a)}_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")))}_updateData(t){!t||t.sourceDataType!=="metadata"&&t.sourceDataType!=="visibility"&&t.dataType!=="style"&&t.type!=="terrain"||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(h=>typeof h!="string"?"":h)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const h=this._map.style.stylesheet;this.styleOwner=h.owner,this.styleId=h.id}const n=this._map.style.sourceCaches;for(const h in n){const p=n[h];if(p.used||p.usedForTerrain){const m=p.getSource();m.attribution&&t.indexOf(m.attribution)<0&&t.push(m.attribution)}}t=t.filter(h=>String(h).trim()),t.sort((h,p)=>h.length-p.length),t=t.filter((h,p)=>{for(let m=p+1;m<t.length;m++)if(t[m].indexOf(h)>=0)return!1;return!0});const a=t.join(" | ");a!==this._attribHTML&&(this._attribHTML=a,t.length?(this._innerContainer.innerHTML=a,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}_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"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")}}class Vt{constructor(t={}){this.options=t,c.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=K.create("div","maplibregl-ctrl");const n=K.create("a","maplibregl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){K.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){const t=this._container.children;if(t.length){const n=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&n.classList.add("maplibregl-compact"):n.classList.remove("maplibregl-compact")}}}class Ws{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,a=n?this._queue.concat(n):this._queue;for(const h of a)if(h.id===t)return void(h.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const a of n)if(!a.cancelled&&(a.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const Xa={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"};var hl=c.createLayout([{name:"a_pos3d",type:"Int16",components:3}]);class ul extends c.Evented{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];const a={};for(const h of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))a[h.key]=!0,this._renderableTilesKeys.push(h.key),this._tiles[h.key]||(h.posMatrix=new Float64Array(16),c.ortho(h.posMatrix,0,c.EXTENT,0,c.EXTENT,0,1),this._tiles[h.key]=new Tr(h,this.tileSize));for(const h in this._tiles)a[h]||delete this._tiles[h]}freeRtt(t){for(const n in this._tiles){const a=this._tiles[n];(!t||a.tileID.equals(t)||a.tileID.isChildOf(t)||t.isChildOf(a.tileID))&&(a.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const n={};for(const a of this._renderableTilesKeys){const h=this._tiles[a].tileID;if(h.canonical.equals(t.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16),c.ortho(p.posMatrix,0,c.EXTENT,0,c.EXTENT,0,1),n[a]=p}else if(h.canonical.isChildOf(t.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16);const m=h.canonical.z-t.canonical.z,_=h.canonical.x-(h.canonical.x>>m<<m),y=h.canonical.y-(h.canonical.y>>m<<m),v=c.EXTENT>>m;c.ortho(p.posMatrix,0,v,0,v,0,1),c.translate(p.posMatrix,p.posMatrix,[-_*v,-y*v,0]),n[a]=p}else if(t.canonical.isChildOf(h.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16);const m=t.canonical.z-h.canonical.z,_=t.canonical.x-(t.canonical.x>>m<<m),y=t.canonical.y-(t.canonical.y>>m<<m),v=c.EXTENT>>m;c.ortho(p.posMatrix,0,c.EXTENT,0,c.EXTENT,0,1),c.translate(p.posMatrix,p.posMatrix,[_*v,y*v,0]),c.scale(p.posMatrix,p.posMatrix,[1/2**m,1/2**m,0]),n[a]=p}}return n}getSourceTile(t,n){const a=this.sourceCache._source;let h=t.overscaledZ-this.deltaZoom;if(h>a.maxzoom&&(h=a.maxzoom),h<a.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(h).key);let p=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!p||!p.dem)&&n)for(;h>=a.minzoom&&(!p||!p.dem);)p=this.sourceCache.getTileByID(t.scaledTo(h--).key);return p}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(n=>n.timeAdded>=t)}}class pl{constructor(t,n,a){this.painter=t,this.sourceCache=new ul(n),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(t,n,a,h=c.EXTENT){if(!(n>=0&&n<h&&a>=0&&a<h))return 0;let p=0;const m=this.getTerrainData(t);if(m.tile&&m.tile.dem){const _=c.transformMat4$1([],[n/h*c.EXTENT,a/h*c.EXTENT],m.u_terrain_matrix),y=[_[0]*m.tile.dem.dim,_[1]*m.tile.dem.dim],v=[Math.floor(y[0]),Math.floor(y[1])],S=m.tile.dem.get(v[0],v[1]),E=m.tile.dem.get(v[0],v[1]+1),M=m.tile.dem.get(v[0]+1,v[1]),D=m.tile.dem.get(v[0]+1,v[1]+1);p=c.number(c.number(S,E,y[0]-v[0]),c.number(M,D,y[0]-v[0]),y[1]-v[1])}return p}getElevation(t,n,a,h=c.EXTENT){return this.getDEMElevation(t,n,a,h)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const h=this.painter.context,p=new c.RGBAImage({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Dt(h,p,h.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Dt(h,new c.RGBAImage({width:1,height:1}),h.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(h.gl.NEAREST,h.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=c.identity([])}const n=this.sourceCache.getSourceTile(t,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const h=this.painter.context;n.demTexture=this.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new Dt(h,n.dem.getPixels(),h.gl.RGBA,{premultiply:!1}),n.demTexture.bind(h.gl.NEAREST,h.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const a=n&&n+n.tileID.key+t.key;if(a&&!this._demMatrixCache[a]){const h=this.sourceCache.sourceCache._source.maxzoom;let p=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=h?p=t.canonical.z-h:c.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const m=t.canonical.x-(t.canonical.x>>p<<p),_=t.canonical.y-(t.canonical.y>>p<<p),y=c.fromScaling(new Float64Array(16),[1/(c.EXTENT<<p),1/(c.EXTENT<<p),0]);c.translate(y,y,[m*c.EXTENT,_*c.EXTENT,0]),this._demMatrixCache[t.key]={matrix:y,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:a?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:n&&n.dem&&n.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(n&&n.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getFramebuffer(t){const n=this.painter,a=n.width/devicePixelRatio,h=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===a&&this._fbo.height===h||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new Dt(n.context,{width:a,height:h,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new Dt(n.context,{width:a,height:h,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=n.context.createFramebuffer(a,h,!0),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,a,h))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let p=0,m=0;p<this._coordsTextureSize;p++)for(let _=0;_<this._coordsTextureSize;_++,m+=4)n[m+0]=255&_,n[m+1]=255&p,n[m+2]=_>>8<<4|p>>8,n[m+3]=0;const a=new c.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),h=new Dt(t,a,t.gl.RGBA,{premultiply:!1});return h.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=h,h}pointCoordinate(t){const n=new Uint8Array(4),a=this.painter.context,h=a.gl;a.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),h.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,h.RGBA,h.UNSIGNED_BYTE,n),a.bindFramebuffer.set(null);const p=n[0]+(n[2]>>4<<8),m=n[1]+((15&n[2])<<8),_=this.coordsIndex[255-n[3]],y=_&&this.sourceCache.getTileByID(_);if(!y)return null;const v=this._coordsTextureSize,S=(1<<y.tileID.canonical.z)*v;return new c.MercatorCoordinate((y.tileID.canonical.x*v+p)/S,(y.tileID.canonical.y*v+m)/S,this.getElevation(y.tileID,p,m,v))}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.painter.context,n=new c.Pos3dArray,a=new c.TriangleIndexArray,h=this.meshSize,p=c.EXTENT/h,m=h*h;for(let E=0;E<=h;E++)for(let M=0;M<=h;M++)n.emplaceBack(M*p,E*p,0);for(let E=0;E<m;E+=h+1)for(let M=0;M<h;M++)a.emplaceBack(M+E,h+M+E+1,h+M+E+2),a.emplaceBack(M+E,h+M+E+2,M+E+1);const _=n.length,y=_+2*(h+1);for(const E of[0,1])for(let M=0;M<=h;M++)for(const D of[0,1])n.emplaceBack(M*p,E*c.EXTENT,D);for(let E=0;E<2*h;E+=2)a.emplaceBack(y+E,y+E+1,y+E+3),a.emplaceBack(y+E,y+E+3,y+E+2),a.emplaceBack(_+E,_+E+3,_+E+1),a.emplaceBack(_+E,_+E+2,_+E+3);const v=n.length,S=v+2*(h+1);for(const E of[0,1])for(let M=0;M<=h;M++)for(const D of[0,1])n.emplaceBack(E*c.EXTENT,M*p,D);for(let E=0;E<2*h;E+=2)a.emplaceBack(v+E,v+E+1,v+E+3),a.emplaceBack(v+E,v+E+3,v+E+2),a.emplaceBack(S+E,S+E+3,S+E+1),a.emplaceBack(S+E,S+E+2,S+E+3);return this._mesh={indexBuffer:t.createIndexBuffer(a),vertexBuffer:t.createVertexBuffer(n,hl.members),segments:c.SegmentVector.simpleSegment(0,0,n.length,a.length)},this._mesh}getMeshFrameDelta(t){return 2*Math.PI*c.earthRadius/Math.pow(2,t)/5}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,a={minElevation:null,maxElevation:null};return n&&n.dem&&(a.minElevation=n.dem.min*this.exaggeration,a.maxElevation=n.dem.max*this.exaggeration),a}}class uc{constructor(t,n,a){this._context=t,this._size=n,this._tileSize=a,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const n=this._context.createFramebuffer(this._tileSize,this._tileSize,!0),a=new Dt(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),n.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_COMPONENT16,this._tileSize,this._tileSize)),n.colorAttachment.set(a.texture),{id:t,fbo:n,texture:a,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(n=>t.id!==n),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const n of this._recentlyUsed)if(!this._objects[n].inUse)return this._objects[n];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(t=>!t.inUse)===!1}}const Ti={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Hs{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new uc(t.context,30,n.sourceCache.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,n){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(a=>!t._layers[a].isHidden(n)),this._coordsDescendingInv={};for(const a in t.sourceCaches){this._coordsDescendingInv[a]={};const h=t.sourceCaches[a].getVisibleCoordinates();for(const p of h){const m=this.terrain.sourceCache.getTerrainCoords(p);for(const _ in m)this._coordsDescendingInv[a][_]||(this._coordsDescendingInv[a][_]=[]),this._coordsDescendingInv[a][_].push(m[_])}}this._coordsDescendingInvStr={};for(const a of t._order){const h=t._layers[a],p=h.source;if(Ti[h.type]&&!this._coordsDescendingInvStr[p]){this._coordsDescendingInvStr[p]={};for(const m in this._coordsDescendingInv[p])this._coordsDescendingInvStr[p][m]=this._coordsDescendingInv[p][m].map(_=>_.key).sort().join()}}for(const a of this._renderableTiles)for(const h in this._coordsDescendingInvStr){const p=this._coordsDescendingInvStr[h][a.tileID.key];p&&p!==a.rttCoords[h]&&(a.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const n=t.type,a=this.painter,h=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(Ti[n]&&(this._prevType&&Ti[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!h))return!0;if(Ti[this._prevType]||Ti[n]&&h){this._prevType=n;const p=this._stacks.length-1,m=this._stacks[p]||[];for(const _ of this._renderableTiles){if(this.pool.isFull()&&(js(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(_),_.rtt[p]){const v=this.pool.getObjectForId(_.rtt[p].id);if(v.stamp===_.rtt[p].stamp){this.pool.useObject(v);continue}}const y=this.pool.getOrCreateFreeObject();this.pool.useObject(y),this.pool.stampObject(y),_.rtt[p]={id:y.id,stamp:y.stamp},a.context.bindFramebuffer.set(y.fbo.framebuffer),a.context.clear({color:c.Color.transparent});for(let v=0;v<m.length;v++){const S=a.style._layers[m[v]],E=S.source?this._coordsDescendingInv[S.source][_.tileID.key]:[_.tileID];a.context.viewport.set([0,0,y.fbo.width,y.fbo.height]),a._renderTileClippingMasks(S,E),a.renderLayer(a,a.style.sourceCaches[S.source],S,E),S.source&&(_.rttCoords[S.source]=this._coordsDescendingInvStr[S.source][_.tileID.key])}}return js(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),Ti[n]}return!1}}const We=St,Qe={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,fadeDuration:300,crossSourceCollisions:!0},us=o=>{o.touchstart=o.dragStart,o.touchmoveWindow=o.dragMove,o.touchend=o.dragEnd},Wa={showCompass:!0,showZoom:!0,visualizePitch:!1};class Ha{constructor(t,n,a=!1){this._clickTolerance=10;const h=t.dragRotate._mouseRotate.getClickTolerance(),p=t.dragRotate._mousePitch.getClickTolerance();this.element=n,this.mouseRotate=Fa({clickTolerance:h,enable:!0}),this.touchRotate=(({enable:m,clickTolerance:_,bearingDegreesPerPixelMoved:y=.8})=>{const v=new al;return new $i({clickTolerance:_,move:(S,E)=>({bearingDelta:(E.x-S.x)*y}),moveStateManager:v,enable:m,assignEvents:us})})({clickTolerance:h,enable:!0}),this.map=t,a&&(this.mousePitch=In({clickTolerance:p,enable:!0}),this.touchPitch=(({enable:m,clickTolerance:_,pitchDegreesPerPixelMoved:y=-.5})=>{const v=new al;return new $i({clickTolerance:_,move:(S,E)=>({pitchDelta:(E.y-S.y)*y}),moveStateManager:v,enable:m,assignEvents:us})})({clickTolerance:p,enable:!0})),c.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),K.addEventListener(n,"mousedown",this.mousedown),K.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),K.addEventListener(n,"touchcancel",this.reset)}startMouse(t,n){this.mouseRotate.dragStart(t,n),this.mousePitch&&this.mousePitch.dragStart(t,n),K.disableDrag()}startTouch(t,n){this.touchRotate.dragStart(t,n),this.touchPitch&&this.touchPitch.dragStart(t,n),K.disableDrag()}moveMouse(t,n){const a=this.map,{bearingDelta:h}=this.mouseRotate.dragMove(t,n)||{};if(h&&a.setBearing(a.getBearing()+h),this.mousePitch){const{pitchDelta:p}=this.mousePitch.dragMove(t,n)||{};p&&a.setPitch(a.getPitch()+p)}}moveTouch(t,n){const a=this.map,{bearingDelta:h}=this.touchRotate.dragMove(t,n)||{};if(h&&a.setBearing(a.getBearing()+h),this.touchPitch){const{pitchDelta:p}=this.touchPitch.dragMove(t,n)||{};p&&a.setPitch(a.getPitch()+p)}}off(){const t=this.element;K.removeEventListener(t,"mousedown",this.mousedown),K.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),K.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),K.removeEventListener(window,"touchend",this.touchend),K.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){K.enableDrag(),K.removeEventListener(window,"mousemove",this.mousemove),K.removeEventListener(window,"mouseup",this.mouseup),K.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),K.removeEventListener(window,"touchend",this.touchend)}mousedown(t){this.startMouse(c.extend({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),K.mousePos(this.element,t)),K.addEventListener(window,"mousemove",this.mousemove),K.addEventListener(window,"mouseup",this.mouseup)}mousemove(t){this.moveMouse(t,K.mousePos(this.element,t))}mouseup(t){this.mouseRotate.dragEnd(t),this.mousePitch&&this.mousePitch.dragEnd(t),this.offTemp()}touchstart(t){t.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=K.touchPos(this.element,t.targetTouches)[0],this.startTouch(t,this._startPos),K.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),K.addEventListener(window,"touchend",this.touchend))}touchmove(t){t.targetTouches.length!==1?this.reset():(this._lastPos=K.touchPos(this.element,t.targetTouches)[0],this.moveTouch(t,this._lastPos))}touchend(t){t.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()}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()}}function Si(o,t,n){if(o=new c.LngLat(o.lng,o.lat),t){const a=new c.LngLat(o.lng-360,o.lat),h=new c.LngLat(o.lng+360,o.lat),p=n.locationPoint(o).distSqr(t);n.locationPoint(a).distSqr(t)<p?o=a:n.locationPoint(h).distSqr(t)<p&&(o=h)}for(;Math.abs(o.lng-n.center.lng)>180;){const a=n.locationPoint(o);if(a.x>=0&&a.y>=0&&a.x<=n.width&&a.y<=n.height)break;o.lng>n.center.lng?o.lng-=360:o.lng+=360}return o}const Cn={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 cr(o,t,n){const a=o.classList;for(const h in Cn)a.remove(`maplibregl-${n}-anchor-${h}`);a.add(`maplibregl-${n}-anchor-${t}`)}class Ka extends c.Evented{constructor(t,n){if(super(),(t instanceof HTMLElement||n)&&(t=c.extend({element:t},n)),c.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,t&&t.element)this._element=t.element,this._offset=c.pointGeometry.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=K.create("div"),this._element.setAttribute("aria-label","Map marker");const a=K.createNS("http://www.w3.org/2000/svg","svg"),h=41,p=27;a.setAttributeNS(null,"display","block"),a.setAttributeNS(null,"height",`${h}px`),a.setAttributeNS(null,"width",`${p}px`),a.setAttributeNS(null,"viewBox",`0 0 ${p} ${h}`);const m=K.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"stroke","none"),m.setAttributeNS(null,"stroke-width","1"),m.setAttributeNS(null,"fill","none"),m.setAttributeNS(null,"fill-rule","evenodd");const _=K.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"fill-rule","nonzero");const y=K.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(3.0, 29.0)"),y.setAttributeNS(null,"fill","#000000");const v=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const q of v){const U=K.createNS("http://www.w3.org/2000/svg","ellipse");U.setAttributeNS(null,"opacity","0.04"),U.setAttributeNS(null,"cx","10.5"),U.setAttributeNS(null,"cy","5.80029008"),U.setAttributeNS(null,"rx",q.rx),U.setAttributeNS(null,"ry",q.ry),y.appendChild(U)}const S=K.createNS("http://www.w3.org/2000/svg","g");S.setAttributeNS(null,"fill",this._color);const E=K.createNS("http://www.w3.org/2000/svg","path");E.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),S.appendChild(E);const M=K.createNS("http://www.w3.org/2000/svg","g");M.setAttributeNS(null,"opacity","0.25"),M.setAttributeNS(null,"fill","#000000");const D=K.createNS("http://www.w3.org/2000/svg","path");D.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"),M.appendChild(D);const B=K.createNS("http://www.w3.org/2000/svg","g");B.setAttributeNS(null,"transform","translate(6.0, 7.0)"),B.setAttributeNS(null,"fill","#FFFFFF");const L=K.createNS("http://www.w3.org/2000/svg","g");L.setAttributeNS(null,"transform","translate(8.0, 8.0)");const N=K.createNS("http://www.w3.org/2000/svg","circle");N.setAttributeNS(null,"fill","#000000"),N.setAttributeNS(null,"opacity","0.25"),N.setAttributeNS(null,"cx","5.5"),N.setAttributeNS(null,"cy","5.5"),N.setAttributeNS(null,"r","5.4999962");const X=K.createNS("http://www.w3.org/2000/svg","circle");X.setAttributeNS(null,"fill","#FFFFFF"),X.setAttributeNS(null,"cx","5.5"),X.setAttributeNS(null,"cy","5.5"),X.setAttributeNS(null,"r","5.4999962"),L.appendChild(N),L.appendChild(X),_.appendChild(y),_.appendChild(S),_.appendChild(M),_.appendChild(B),_.appendChild(L),a.appendChild(_),a.setAttributeNS(null,"height",h*this._scale+"px"),a.setAttributeNS(null,"width",p*this._scale+"px"),this._element.appendChild(a),this._offset=c.pointGeometry.convert(t&&t.offset||[0,-14])}this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",a=>{a.preventDefault()}),this._element.addEventListener("mousedown",a=>{a.preventDefault()}),cr(this._element,this._anchor,"marker"),this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),K.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=c.LngLat.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const h=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[h,-1*(38.1-13.5+h)],"bottom-right":[-h,-1*(38.1-13.5+h)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}_onKeyPress(t){const n=t.code,a=t.charCode||t.keyCode;n!=="Space"&&n!=="Enter"&&a!==32&&a!==13||this.togglePopup()}_onMapClick(t){const n=t.originalEvent.target,a=this._element;this._popup&&(n===a||a.contains(n))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}_update(t){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=Si(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let n="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?n=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(n=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let a="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?a="rotateX(0deg)":this._pitchAlignment==="map"&&(a=`rotateX(${this._map.getPitch()}deg)`),t&&t.type!=="moveend"||(this._pos=this._pos.round()),K.setTransform(this._element,`${Cn[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${a} ${n}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const h=this._map.unproject(this._pos),p=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=h.distanceTo(this._lngLat)>20*p?"0.2":"1.0",this._opacityTimeout=null},100))}getOffset(){return this._offset}setOffset(t){return this._offset=c.pointGeometry.convert(t),this._update(),this}_onMove(t){if(!this._isDragging){const n=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=n}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new c.Event("dragstart"))),this.fire(new c.Event("drag")))}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new c.Event("dragend")),this._state="inactive"}_addDragHandler(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.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))}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const Ks={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let zt,Wt=0,Mn=!1;const ps={maxWidth:100,unit:"metric"};function ds(o,t,n){const a=n&&n.maxWidth||100,h=o._container.clientHeight/2,p=o.unproject([0,h]),m=o.unproject([a,h]),_=p.distanceTo(m);if(n&&n.unit==="imperial"){const y=3.2808*_;y>5280?Yr(t,a,y/5280,o._getUIString("ScaleControl.Miles")):Yr(t,a,y,o._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?Yr(t,a,_/1852,o._getUIString("ScaleControl.NauticalMiles")):_>=1e3?Yr(t,a,_/1e3,o._getUIString("ScaleControl.Kilometers")):Yr(t,a,_,o._getUIString("ScaleControl.Meters"))}function Yr(o,t,n,a){const h=function(p){const m=Math.pow(10,`${Math.floor(p)}`.length-1);let _=p/m;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(y){const v=Math.pow(10,Math.ceil(-Math.log(y)/Math.LN10));return Math.round(y*v)/v}(_),m*_}(n);o.style.width=t*(h/n)+"px",o.innerHTML=`${h}&nbsp;${a}`}const Ja={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Ya=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Pn(o){if(o){if(typeof o=="number"){const t=Math.round(Math.sqrt(.5*Math.pow(o,2)));return{center:new c.pointGeometry(0,0),top:new c.pointGeometry(0,o),"top-left":new c.pointGeometry(t,t),"top-right":new c.pointGeometry(-t,t),bottom:new c.pointGeometry(0,-o),"bottom-left":new c.pointGeometry(t,-t),"bottom-right":new c.pointGeometry(-t,-t),left:new c.pointGeometry(o,0),right:new c.pointGeometry(-o,0)}}if(o instanceof c.pointGeometry||Array.isArray(o)){const t=c.pointGeometry.convert(o);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:c.pointGeometry.convert(o.center||[0,0]),top:c.pointGeometry.convert(o.top||[0,0]),"top-left":c.pointGeometry.convert(o["top-left"]||[0,0]),"top-right":c.pointGeometry.convert(o["top-right"]||[0,0]),bottom:c.pointGeometry.convert(o.bottom||[0,0]),"bottom-left":c.pointGeometry.convert(o["bottom-left"]||[0,0]),"bottom-right":c.pointGeometry.convert(o["bottom-right"]||[0,0]),left:c.pointGeometry.convert(o.left||[0,0]),right:c.pointGeometry.convert(o.right||[0,0])}}return Pn(new c.pointGeometry(0,0))}const Qa=St,ms={supported:ve,setRTLTextPlugin:c.setRTLTextPlugin,getRTLTextPluginStatus:c.getRTLTextPluginStatus,Map:class extends cl{constructor(o){var t;if(c.PerformanceUtils.mark(c.PerformanceMarkers.create),(o=c.extend({},Qe,o)).minZoom!=null&&o.maxZoom!=null&&o.minZoom>o.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(o.minPitch!=null&&o.maxPitch!=null&&o.minPitch>o.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(o.minPitch!=null&&o.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(o.maxPitch!=null&&o.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new qs(o.minZoom,o.maxZoom,o.minPitch,o.maxPitch,o.renderWorldCopies),{bearingSnap:o.bearingSnap}),this._interactive=o.interactive,this._cooperativeGestures=o.cooperativeGestures,this._maxTileCacheSize=o.maxTileCacheSize,this._failIfMajorPerformanceCaveat=o.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=o.preserveDrawingBuffer,this._antialias=o.antialias,this._trackResize=o.trackResize,this._bearingSnap=o.bearingSnap,this._refreshExpiredTiles=o.refreshExpiredTiles,this._fadeDuration=o.fadeDuration,this._crossSourceCollisions=o.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=o.collectResourceTiming,this._renderTaskQueue=new Ws,this._controls=[],this._mapId=c.uniqueId(),this._locale=c.extend({},Xa,o.locale),this._clickTolerance=o.clickTolerance,this._pixelRatio=(t=o.pixelRatio)!==null&&t!==void 0?t:devicePixelRatio,this._requestManager=new Ye(o.transformRequest),typeof o.container=="string"){if(this._container=document.getElementById(o.container),!this._container)throw new Error(`Container '${o.container}' not found.`)}else{if(!(o.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=o.container}o.maxBounds&&this.setMaxBounds(o.maxBounds),c.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),typeof window<"u"&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new qa(this,o),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=o.hash&&new Zs(typeof o.hash=="string"&&o.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch}),o.bounds&&(this.resize(),this.fitBounds(o.bounds,c.extend({},o.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=o.localIdeographFontFamily,o.style&&this.setStyle(o.style,{localIdeographFontFamily:o.localIdeographFontFamily}),o.attributionControl&&this.addControl(new ji({customAttribution:o.customAttribution})),o.maplibreLogo&&this.addControl(new Vt,o.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new c.Event(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new c.Event(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new c.Event("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(o,t){if(t===void 0&&(t=o.getDefaultPosition?o.getDefaultPosition():"top-right"),!o||!o.onAdd)return this.fire(new c.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=o.onAdd(this);this._controls.push(o);const a=this._controlPositions[t];return t.indexOf("bottom")!==-1?a.insertBefore(n,a.firstChild):a.appendChild(n),this}removeControl(o){if(!o||!o.onRemove)return this.fire(new c.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(o);return t>-1&&this._controls.splice(t,1),o.onRemove(this),this}hasControl(o){return this._controls.indexOf(o)>-1}calculateCameraOptionsFromTo(o,t,n,a){return a==null&&this.terrain&&(a=this.transform.getElevation(n,this.terrain)),super.calculateCameraOptionsFromTo(o,t,n,a)}resize(o){const t=this._containerDimensions(),n=t[0],a=t[1];this._resizeCanvas(n,a,this.getPixelRatio()),this.transform.resize(n,a),this.painter.resize(n,a,this.getPixelRatio());const h=!this._moving;return h&&(this.stop(),this.fire(new c.Event("movestart",o)).fire(new c.Event("move",o))),this.fire(new c.Event("resize",o)),h&&this.fire(new c.Event("moveend",o)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(o){const[t,n]=this._containerDimensions();this._pixelRatio=o,this._resizeCanvas(t,n,o),this.painter.resize(t,n,o)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(o){return this.transform.setMaxBounds(c.LngLatBounds.convert(o)),this._update()}setMinZoom(o){if((o=o??-2)>=-2&&o<=this.transform.maxZoom)return this.transform.minZoom=o,this._update(),this.getZoom()<o&&this.setZoom(o),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(o){if((o=o??22)>=this.transform.minZoom)return this.transform.maxZoom=o,this._update(),this.getZoom()>o&&this.setZoom(o),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(o){if((o=o??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(o>=0&&o<=this.transform.maxPitch)return this.transform.minPitch=o,this._update(),this.getPitch()<o&&this.setPitch(o),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(o){if((o=o??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(o>=this.transform.minPitch)return this.transform.maxPitch=o,this._update(),this.getPitch()>o&&this.setPitch(o),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(o){return this.transform.renderWorldCopies=o,this._update()}project(o){return this.transform.locationPoint(c.LngLat.convert(o),this.style&&this.terrain)}unproject(o){return this.transform.pointLocation(c.pointGeometry.convert(o),this.terrain)}isMoving(){return this._moving||this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers.isRotating()}_createDelegatedListener(o,t,n){if(o==="mouseenter"||o==="mouseover"){let a=!1;return{layer:t,listener:n,delegates:{mousemove:p=>{const m=this.getLayer(t)?this.queryRenderedFeatures(p.point,{layers:[t]}):[];m.length?a||(a=!0,n.call(this,new Ni(o,this,p.originalEvent,{features:m}))):a=!1},mouseout:()=>{a=!1}}}}if(o==="mouseleave"||o==="mouseout"){let a=!1;return{layer:t,listener:n,delegates:{mousemove:m=>{(this.getLayer(t)?this.queryRenderedFeatures(m.point,{layers:[t]}):[]).length?a=!0:a&&(a=!1,n.call(this,new Ni(o,this,m.originalEvent)))},mouseout:m=>{a&&(a=!1,n.call(this,new Ni(o,this,m.originalEvent)))}}}}{const a=h=>{const p=this.getLayer(t)?this.queryRenderedFeatures(h.point,{layers:[t]}):[];p.length&&(h.features=p,n.call(this,h),delete h.features)};return{layer:t,listener:n,delegates:{[o]:a}}}}on(o,t,n){if(n===void 0)return super.on(o,t);const a=this._createDelegatedListener(o,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[o]=this._delegatedListeners[o]||[],this._delegatedListeners[o].push(a);for(const h in a.delegates)this.on(h,a.delegates[h]);return this}once(o,t,n){if(n===void 0)return super.once(o,t);const a=this._createDelegatedListener(o,t,n);for(const h in a.delegates)this.once(h,a.delegates[h]);return this}off(o,t,n){return n===void 0?super.off(o,t):(this._delegatedListeners&&this._delegatedListeners[o]&&(a=>{const h=this._delegatedListeners[o];for(let p=0;p<h.length;p++){const m=h[p];if(m.layer===t&&m.listener===n){for(const _ in m.delegates)this.off(_,m.delegates[_]);return h.splice(p,1),this}}})(),this)}queryRenderedFeatures(o,t){if(!this.style)return[];let n;const a=o instanceof c.pointGeometry||Array.isArray(o),h=a?o:[[0,0],[this.transform.width,this.transform.height]];if(t=t||(a?{}:o)||{},h instanceof c.pointGeometry||typeof h[0]=="number")n=[c.pointGeometry.convert(h)];else{const p=c.pointGeometry.convert(h[0]),m=c.pointGeometry.convert(h[1]);n=[p,new c.pointGeometry(m.x,p.y),m,new c.pointGeometry(p.x,m.y),p]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(o,t){return this.style.querySourceFeatures(o,t)}setStyle(o,t){return(t=c.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&o?(this._diffStyle(o,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(o,t))}setTransformRequest(o){return this._requestManager.setTransformRequest(o),this}_getUIString(o){const t=this._locale[o];if(t==null)throw new Error(`Missing UI string '${o}'`);return t}_updateStyle(o,t){if(t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(o,t));const n=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove()),o?(this.style=new ui(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof o=="string"?this.style.loadURL(o,t,n):this.style.loadJSON(o,t,n),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new ui(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(o,t){if(typeof o=="string"){const n=this._requestManager.transformRequest(o,c.ResourceType.Style);c.getJSON(n,(a,h)=>{a?this.fire(new c.ErrorEvent(a)):h&&this._updateDiff(h,t)})}else typeof o=="object"&&this._updateDiff(o,t)}_updateDiff(o,t){try{this.style.setState(o,t)&&this._update(!0)}catch(n){c.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(o,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():c.warnOnce("There is no style added to the map.")}addSource(o,t){return this._lazyInitEmptyStyle(),this.style.addSource(o,t),this._update(!0)}isSourceLoaded(o){const t=this.style&&this.style.sourceCaches[o];if(t!==void 0)return t.loaded();this.fire(new c.ErrorEvent(new Error(`There is no source with ID '${o}'`)))}setTerrain(o){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),o){const t=this.style.sourceCaches[o.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${o.source}`);this.terrain=new pl(this.painter,t,o),this.painter.renderToTexture=new Hs(this.painter,this.terrain),this.transform.updateElevation(this.terrain),this._terrainDataCallback=n=>{n.dataType==="style"?this.terrain.sourceCache.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId===o.source&&this.transform.updateElevation(this.terrain),this.terrain.sourceCache.freeRtt(n.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.updateElevation(this.terrain);return this.fire(new c.Event("terrain",{terrain:o})),this}getTerrain(){return this.terrain&&this.terrain.options}areTilesLoaded(){const o=this.style&&this.style.sourceCaches;for(const t in o){const n=o[t]._tiles;for(const a in n){const h=n[a];if(h.state!=="loaded"&&h.state!=="errored")return!1}}return!0}addSourceType(o,t,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(o,t,n)}removeSource(o){return this.style.removeSource(o),this._update(!0)}getSource(o){return this.style.getSource(o)}addImage(o,t,{pixelRatio:n=1,sdf:a=!1,stretchX:h,stretchY:p,content:m}={}){if(this._lazyInitEmptyStyle(),t instanceof HTMLImageElement||c.isImageBitmap(t)){const{width:_,height:y,data:v}=c.exported.getImageData(t);this.style.addImage(o,{data:new c.RGBAImage({width:_,height:y},v),pixelRatio:n,stretchX:h,stretchY:p,content:m,sdf:a,version:0})}else{if(t.width===void 0||t.height===void 0)return this.fire(new c.ErrorEvent(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:_,height:y,data:v}=t,S=t;this.style.addImage(o,{data:new c.RGBAImage({width:_,height:y},new Uint8Array(v)),pixelRatio:n,stretchX:h,stretchY:p,content:m,sdf:a,version:0,userImage:S}),S.onAdd&&S.onAdd(this,o)}}}updateImage(o,t){const n=this.style.getImage(o);if(!n)return this.fire(new c.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const a=t instanceof HTMLImageElement||c.isImageBitmap(t)?c.exported.getImageData(t):t,{width:h,height:p,data:m}=a;if(h===void 0||p===void 0)return this.fire(new c.ErrorEvent(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(h!==n.data.width||p!==n.data.height)return this.fire(new c.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const _=!(t instanceof HTMLImageElement||c.isImageBitmap(t));n.data.replace(m,_),this.style.updateImage(o,n)}hasImage(o){return o?!!this.style.getImage(o):(this.fire(new c.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(o){this.style.removeImage(o)}loadImage(o,t){c.getImage(this._requestManager.transformRequest(o,c.ResourceType.Image),t)}listImages(){return this.style.listImages()}addLayer(o,t){return this._lazyInitEmptyStyle(),this.style.addLayer(o,t),this._update(!0)}moveLayer(o,t){return this.style.moveLayer(o,t),this._update(!0)}removeLayer(o){return this.style.removeLayer(o),this._update(!0)}getLayer(o){return this.style.getLayer(o)}setLayerZoomRange(o,t,n){return this.style.setLayerZoomRange(o,t,n),this._update(!0)}setFilter(o,t,n={}){return this.style.setFilter(o,t,n),this._update(!0)}getFilter(o){return this.style.getFilter(o)}setPaintProperty(o,t,n,a={}){return this.style.setPaintProperty(o,t,n,a),this._update(!0)}getPaintProperty(o,t){return this.style.getPaintProperty(o,t)}setLayoutProperty(o,t,n,a={}){return this.style.setLayoutProperty(o,t,n,a),this._update(!0)}getLayoutProperty(o,t){return this.style.getLayoutProperty(o,t)}setGlyphs(o,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(o,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(o,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(o,t,n,a=>{a||this._update(!0)}),this}removeSprite(o){return this._lazyInitEmptyStyle(),this.style.removeSprite(o),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(o,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(o,t,n=>{n||this._update(!0)}),this}setLight(o,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(o,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(o,t){return this.style.setFeatureState(o,t),this._update()}removeFeatureState(o,t){return this.style.removeFeatureState(o,t),this._update()}getFeatureState(o){return this.style.getFeatureState(o)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let o=0,t=0;return this._container&&(o=this._container.clientWidth||400,t=this._container.clientHeight||300),[o,t]}_setupContainer(){const o=this._container;o.classList.add("maplibregl-map");const t=this._canvasContainer=K.create("div","maplibregl-canvas-container",o);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=K.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const n=this._containerDimensions();this._resizeCanvas(n[0],n[1],this.getPixelRatio());const a=this._controlContainer=K.create("div","maplibregl-control-container",o),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(p=>{h[p]=K.create("div",`maplibregl-ctrl-${p} `,a)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){const o=this._container;this._metaPress=!1,this._cooperativeGesturesScreen=K.create("div","maplibregl-cooperative-gesture-screen",o);let t="Control",n=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(n=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use \u2318 + scroll to zoom the map",t="Meta"),this._cooperativeGesturesScreen.innerHTML=`
574
+ `}),staticAttributes:a,staticUniforms:m}}class ua{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,n,a,h,d,m,_,y,b){this.context=t;let S=this.boundPaintVertexBuffers.length!==h.length;for(let E=0;!S&&E<h.length;E++)this.boundPaintVertexBuffers[E]!==h[E]&&(S=!0);t.extVertexArrayObject&&this.vao&&this.boundProgram===n&&this.boundLayoutVertexBuffer===a&&!S&&this.boundIndexBuffer===d&&this.boundVertexOffset===m&&this.boundDynamicVertexBuffer===_&&this.boundDynamicVertexBuffer2===y&&this.boundDynamicVertexBuffer3===b?(t.bindVertexArrayOES.set(this.vao),_&&_.bind(),d&&d.dynamicDraw&&d.bind(),y&&y.bind(),b&&b.bind()):this.freshBind(n,a,h,d,m,_,y,b)}freshBind(t,n,a,h,d,m,_,y){let b;const S=t.numAttributes,E=this.context,M=E.gl;if(E.extVertexArrayObject)this.vao&&this.destroy(),this.vao=E.extVertexArrayObject.createVertexArrayOES(),E.bindVertexArrayOES.set(this.vao),b=0,this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=a,this.boundIndexBuffer=h,this.boundVertexOffset=d,this.boundDynamicVertexBuffer=m,this.boundDynamicVertexBuffer2=_,this.boundDynamicVertexBuffer3=y;else{b=E.currentNumAttributes||0;for(let D=S;D<b;D++)M.disableVertexAttribArray(D)}n.enableAttributes(M,t);for(const D of a)D.enableAttributes(M,t);m&&m.enableAttributes(M,t),_&&_.enableAttributes(M,t),y&&y.enableAttributes(M,t),n.bind(),n.setVertexAttribPointers(M,t,d);for(const D of a)D.bind(),D.setVertexAttribPointers(M,t,d);m&&(m.bind(),m.setVertexAttribPointers(M,t,d)),h&&h.bind(),_&&(_.bind(),_.setVertexAttribPointers(M,t,d)),y&&(y.bind(),y.setVertexAttribPointers(M,t,d)),E.currentNumAttributes=S}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function da(o){const t=[];for(let n=0;n<o.length;n++){if(o[n]===null)continue;const a=o[n].split(" ");t.push(a.pop())}return t}class Co{constructor(t,n,a,h,d,m,_){const y=t.gl;this.program=y.createProgram();const b=da(a.staticAttributes),S=h?h.getBinderAttributes():[],E=b.concat(S),M=Xn.prelude.staticUniforms?da(Xn.prelude.staticUniforms):[],D=a.staticUniforms?da(a.staticUniforms):[],B=h?h.getBinderUniforms():[],L=M.concat(D).concat(B),N=[];for(const he of L)N.indexOf(he)<0&&N.push(he);const X=h?h.defines():[];m&&X.push("#define OVERDRAW_INSPECTOR;"),_&&X.push("#define TERRAIN3D;");const Z=X.concat(Xn.prelude.fragmentSource,a.fragmentSource).join(`
575
+ `),U=X.concat(Xn.prelude.vertexSource,a.vertexSource).join(`
576
+ `),W=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(W,Z),y.compileShader(W),y.attachShader(this.program,W);const te=y.createShader(y.VERTEX_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(te,U),y.compileShader(te),y.attachShader(this.program,te),this.attributes={};const se={};this.numAttributes=E.length;for(let he=0;he<this.numAttributes;he++)E[he]&&(y.bindAttribLocation(this.program,he,E[he]),this.attributes[E[he]]=he);y.linkProgram(this.program),y.deleteShader(te),y.deleteShader(W);for(let he=0;he<N.length;he++){const pe=N[he];if(pe&&!se[pe]){const Te=y.getUniformLocation(this.program,pe);Te&&(se[pe]=Te)}}this.fixedUniforms=d(t,se),this.terrainUniforms=((he,pe)=>({u_depth:new c.Uniform1i(he,pe.u_depth),u_terrain:new c.Uniform1i(he,pe.u_terrain),u_terrain_dim:new c.Uniform1f(he,pe.u_terrain_dim),u_terrain_matrix:new c.UniformMatrix4f(he,pe.u_terrain_matrix),u_terrain_unpack:new c.Uniform4f(he,pe.u_terrain_unpack),u_terrain_exaggeration:new c.Uniform1f(he,pe.u_terrain_exaggeration)}))(t,se),this.binderUniforms=h?h.getUniforms(t,se):[]}draw(t,n,a,h,d,m,_,y,b,S,E,M,D,B,L,N,X,Z){const U=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(a),t.setStencilMode(h),t.setColorMode(d),t.setCullFace(m),y){t.activeTexture.set(U.TEXTURE2),U.bindTexture(U.TEXTURE_2D,y.depthTexture),t.activeTexture.set(U.TEXTURE3),U.bindTexture(U.TEXTURE_2D,y.texture);for(const te in this.terrainUniforms)this.terrainUniforms[te].set(y[te])}for(const te in this.fixedUniforms)this.fixedUniforms[te].set(_[te]);L&&L.setUniforms(t,this.binderUniforms,D,{zoom:B});let W=0;switch(n){case U.LINES:W=2;break;case U.TRIANGLES:W=3;break;case U.LINE_STRIP:W=1}for(const te of M.get()){const se=te.vaos||(te.vaos={});(se[b]||(se[b]=new ua)).bind(t,this,S,L?L.getPaintVertexBuffers():[],E,te.vertexOffset,N,X,Z),U.drawElements(n,te.primitiveLength*W,U.UNSIGNED_SHORT,te.primitiveOffset*W*2)}}}function Mo(o,t,n){const a=1/st(n,1,t.transform.tileZoom),h=Math.pow(2,n.tileID.overscaledZ),d=n.tileSize*Math.pow(2,t.transform.tileZoom)/h,m=d*(n.tileID.canonical.x+n.tileID.wrap*h),_=d*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[a,o.fromScale,o.toScale],u_fade:o.t,u_pixel_coord_upper:[m>>16,_>>16],u_pixel_coord_lower:[65535&m,65535&_]}}const pa=(o,t,n,a)=>{const h=t.style.light,d=h.properties.get("position"),m=[d.x,d.y,d.z],_=c.create$1();h.properties.get("anchor")==="viewport"&&c.fromRotation(_,-t.transform.angle),c.transformMat3(m,m,_);const y=h.properties.get("color");return{u_matrix:o,u_lightpos:m,u_lightintensity:h.properties.get("intensity"),u_lightcolor:[y.r,y.g,y.b],u_vertical_gradient:+n,u_opacity:a}},Hl=(o,t,n,a,h,d,m)=>c.extend(pa(o,t,n,a),Mo(d,t,m),{u_height_factor:-Math.pow(2,h.overscaledZ)/m.tileSize/8}),Cs=o=>({u_matrix:o}),ma=(o,t,n,a)=>c.extend(Cs(o),Mo(n,t,a)),Po=(o,t)=>({u_matrix:o,u_world:t}),ko=(o,t,n,a,h)=>c.extend(ma(o,t,n,a),{u_world:h}),zo=(o,t,n,a)=>{const h=o.transform;let d,m;if(a.paint.get("circle-pitch-alignment")==="map"){const _=st(n,1,h.zoom);d=!0,m=[_,_]}else d=!1,m=h.pixelsToGLUnits;return{u_camera_to_center_distance:h.cameraToCenterDistance,u_scale_with_map:+(a.paint.get("circle-pitch-scale")==="map"),u_matrix:o.translatePosMatrix(t.posMatrix,n,a.paint.get("circle-translate"),a.paint.get("circle-translate-anchor")),u_pitch_with_map:+d,u_device_pixel_ratio:o.pixelRatio,u_extrude_scale:m}},Hr=(o,t,n)=>{const a=st(n,1,t.zoom),h=Math.pow(2,t.zoom-n.tileID.overscaledZ),d=n.tileID.overscaleFactor();return{u_matrix:o,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:a,u_extrude_scale:[t.pixelsToGLUnits[0]/(a*h),t.pixelsToGLUnits[1]/(a*h)],u_overscale_factor:d}},Wn=(o,t,n=1)=>({u_matrix:o,u_color:t,u_overlay:0,u_overlay_scale:n}),yn=o=>({u_matrix:o}),Ms=(o,t,n,a)=>({u_matrix:o,u_extrude_scale:st(t,1,n),u_intensity:a});function Ps(o,t){const n=Math.pow(2,t.canonical.z),a=t.canonical.y;return[new c.MercatorCoordinate(0,a/n).toLngLat().lat,new c.MercatorCoordinate(0,(a+1)/n).toLngLat().lat]}const Hn=(o,t,n,a)=>{const h=o.transform;return{u_matrix:Zt(o,t,n,a),u_ratio:1/st(t,1,h.zoom),u_device_pixel_ratio:o.pixelRatio,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]]}},Lo=(o,t,n,a,h)=>c.extend(Hn(o,t,n,h),{u_image:0,u_image_height:a}),fa=(o,t,n,a,h)=>{const d=o.transform,m=xn(t,d);return{u_matrix:Zt(o,t,n,h),u_texsize:t.imageAtlasTexture.size,u_ratio:1/st(t,1,d.zoom),u_device_pixel_ratio:o.pixelRatio,u_image:0,u_scale:[m,a.fromScale,a.toScale],u_fade:a.t,u_units_to_pixels:[1/d.pixelsToGLUnits[0],1/d.pixelsToGLUnits[1]]}},ks=(o,t,n,a,h,d)=>{const m=o.lineAtlas,_=xn(t,o.transform),y=n.layout.get("line-cap")==="round",b=m.getDash(a.from,y),S=m.getDash(a.to,y),E=b.width*h.fromScale,M=S.width*h.toScale;return c.extend(Hn(o,t,n,d),{u_patternscale_a:[_/E,-b.height/2],u_patternscale_b:[_/M,-S.height/2],u_sdfgamma:m.width/(256*Math.min(E,M)*o.pixelRatio)/2,u_image:0,u_tex_y_a:b.y,u_tex_y_b:S.y,u_mix:h.t})};function xn(o,t){return 1/st(o,1,t.tileZoom)}function Zt(o,t,n,a){return o.translatePosMatrix(a?a.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const zs=(o,t,n,a,h)=>{return{u_matrix:o,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:a.mix,u_opacity:a.opacity*h.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:h.paint.get("raster-brightness-min"),u_brightness_high:h.paint.get("raster-brightness-max"),u_saturation_factor:(m=h.paint.get("raster-saturation"),m>0?1-1/(1.001-m):-m),u_contrast_factor:(d=h.paint.get("raster-contrast"),d>0?1/(1-d):1+d),u_spin_weights:Do(h.paint.get("raster-hue-rotate"))};var d,m};function Do(o){o*=Math.PI/180;const t=Math.sin(o),n=Math.cos(o);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const ga=(o,t,n,a,h,d,m,_,y,b)=>{const S=h.transform;return{u_is_size_zoom_constant:+(o==="constant"||o==="source"),u_is_size_feature_constant:+(o==="constant"||o==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:S.cameraToCenterDistance,u_pitch:S.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:S.width/S.height,u_fade_change:h.options.fadeDuration?h.symbolFadeChange:1,u_matrix:d,u_label_plane_matrix:m,u_coord_matrix:_,u_is_text:+y,u_pitch_with_map:+a,u_texsize:b,u_texture:0}},_a=(o,t,n,a,h,d,m,_,y,b,S)=>{const E=h.transform;return c.extend(ga(o,t,n,a,h,d,m,_,y,b),{u_gamma_scale:a?Math.cos(E._pitch)*E.cameraToCenterDistance:1,u_device_pixel_ratio:h.pixelRatio,u_is_halo:+S})},ya=(o,t,n,a,h,d,m,_,y,b)=>c.extend(_a(o,t,n,a,h,d,m,_,!0,y,!0),{u_texsize_icon:b,u_texture_icon:1}),Ro=(o,t,n)=>({u_matrix:o,u_opacity:t,u_color:n}),Kl=(o,t,n,a,h,d)=>c.extend(function(m,_,y,b){const S=y.imageManager.getPattern(m.from.toString()),E=y.imageManager.getPattern(m.to.toString()),{width:M,height:D}=y.imageManager.getPixelSize(),B=Math.pow(2,b.tileID.overscaledZ),L=b.tileSize*Math.pow(2,y.transform.tileZoom)/B,N=L*(b.tileID.canonical.x+b.tileID.wrap*B),X=L*b.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:S.tl,u_pattern_br_a:S.br,u_pattern_tl_b:E.tl,u_pattern_br_b:E.br,u_texsize:[M,D],u_mix:_.t,u_pattern_size_a:S.displaySize,u_pattern_size_b:E.displaySize,u_scale_a:_.fromScale,u_scale_b:_.toScale,u_tile_units_to_pixels:1/st(b,1,y.transform.tileZoom),u_pixel_coord_upper:[N>>16,X>>16],u_pixel_coord_lower:[65535&N,65535&X]}}(a,d,n,h),{u_matrix:o,u_opacity:t}),Jl={fillExtrusion:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_lightpos:new c.Uniform3f(o,t.u_lightpos),u_lightintensity:new c.Uniform1f(o,t.u_lightintensity),u_lightcolor:new c.Uniform3f(o,t.u_lightcolor),u_vertical_gradient:new c.Uniform1f(o,t.u_vertical_gradient),u_opacity:new c.Uniform1f(o,t.u_opacity)}),fillExtrusionPattern:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_lightpos:new c.Uniform3f(o,t.u_lightpos),u_lightintensity:new c.Uniform1f(o,t.u_lightintensity),u_lightcolor:new c.Uniform3f(o,t.u_lightcolor),u_vertical_gradient:new c.Uniform1f(o,t.u_vertical_gradient),u_height_factor:new c.Uniform1f(o,t.u_height_factor),u_image:new c.Uniform1i(o,t.u_image),u_texsize:new c.Uniform2f(o,t.u_texsize),u_pixel_coord_upper:new c.Uniform2f(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.Uniform2f(o,t.u_pixel_coord_lower),u_scale:new c.Uniform3f(o,t.u_scale),u_fade:new c.Uniform1f(o,t.u_fade),u_opacity:new c.Uniform1f(o,t.u_opacity)}),fill:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix)}),fillPattern:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_image:new c.Uniform1i(o,t.u_image),u_texsize:new c.Uniform2f(o,t.u_texsize),u_pixel_coord_upper:new c.Uniform2f(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.Uniform2f(o,t.u_pixel_coord_lower),u_scale:new c.Uniform3f(o,t.u_scale),u_fade:new c.Uniform1f(o,t.u_fade)}),fillOutline:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_world:new c.Uniform2f(o,t.u_world)}),fillOutlinePattern:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_world:new c.Uniform2f(o,t.u_world),u_image:new c.Uniform1i(o,t.u_image),u_texsize:new c.Uniform2f(o,t.u_texsize),u_pixel_coord_upper:new c.Uniform2f(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.Uniform2f(o,t.u_pixel_coord_lower),u_scale:new c.Uniform3f(o,t.u_scale),u_fade:new c.Uniform1f(o,t.u_fade)}),circle:(o,t)=>({u_camera_to_center_distance:new c.Uniform1f(o,t.u_camera_to_center_distance),u_scale_with_map:new c.Uniform1i(o,t.u_scale_with_map),u_pitch_with_map:new c.Uniform1i(o,t.u_pitch_with_map),u_extrude_scale:new c.Uniform2f(o,t.u_extrude_scale),u_device_pixel_ratio:new c.Uniform1f(o,t.u_device_pixel_ratio),u_matrix:new c.UniformMatrix4f(o,t.u_matrix)}),collisionBox:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_camera_to_center_distance:new c.Uniform1f(o,t.u_camera_to_center_distance),u_pixels_to_tile_units:new c.Uniform1f(o,t.u_pixels_to_tile_units),u_extrude_scale:new c.Uniform2f(o,t.u_extrude_scale),u_overscale_factor:new c.Uniform1f(o,t.u_overscale_factor)}),collisionCircle:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_inv_matrix:new c.UniformMatrix4f(o,t.u_inv_matrix),u_camera_to_center_distance:new c.Uniform1f(o,t.u_camera_to_center_distance),u_viewport_size:new c.Uniform2f(o,t.u_viewport_size)}),debug:(o,t)=>({u_color:new c.UniformColor(o,t.u_color),u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_overlay:new c.Uniform1i(o,t.u_overlay),u_overlay_scale:new c.Uniform1f(o,t.u_overlay_scale)}),clippingMask:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix)}),heatmap:(o,t)=>({u_extrude_scale:new c.Uniform1f(o,t.u_extrude_scale),u_intensity:new c.Uniform1f(o,t.u_intensity),u_matrix:new c.UniformMatrix4f(o,t.u_matrix)}),heatmapTexture:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_world:new c.Uniform2f(o,t.u_world),u_image:new c.Uniform1i(o,t.u_image),u_color_ramp:new c.Uniform1i(o,t.u_color_ramp),u_opacity:new c.Uniform1f(o,t.u_opacity)}),hillshade:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_image:new c.Uniform1i(o,t.u_image),u_latrange:new c.Uniform2f(o,t.u_latrange),u_light:new c.Uniform2f(o,t.u_light),u_shadow:new c.UniformColor(o,t.u_shadow),u_highlight:new c.UniformColor(o,t.u_highlight),u_accent:new c.UniformColor(o,t.u_accent)}),hillshadePrepare:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_image:new c.Uniform1i(o,t.u_image),u_dimension:new c.Uniform2f(o,t.u_dimension),u_zoom:new c.Uniform1f(o,t.u_zoom),u_unpack:new c.Uniform4f(o,t.u_unpack)}),line:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_ratio:new c.Uniform1f(o,t.u_ratio),u_device_pixel_ratio:new c.Uniform1f(o,t.u_device_pixel_ratio),u_units_to_pixels:new c.Uniform2f(o,t.u_units_to_pixels)}),lineGradient:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_ratio:new c.Uniform1f(o,t.u_ratio),u_device_pixel_ratio:new c.Uniform1f(o,t.u_device_pixel_ratio),u_units_to_pixels:new c.Uniform2f(o,t.u_units_to_pixels),u_image:new c.Uniform1i(o,t.u_image),u_image_height:new c.Uniform1f(o,t.u_image_height)}),linePattern:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_texsize:new c.Uniform2f(o,t.u_texsize),u_ratio:new c.Uniform1f(o,t.u_ratio),u_device_pixel_ratio:new c.Uniform1f(o,t.u_device_pixel_ratio),u_image:new c.Uniform1i(o,t.u_image),u_units_to_pixels:new c.Uniform2f(o,t.u_units_to_pixels),u_scale:new c.Uniform3f(o,t.u_scale),u_fade:new c.Uniform1f(o,t.u_fade)}),lineSDF:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_ratio:new c.Uniform1f(o,t.u_ratio),u_device_pixel_ratio:new c.Uniform1f(o,t.u_device_pixel_ratio),u_units_to_pixels:new c.Uniform2f(o,t.u_units_to_pixels),u_patternscale_a:new c.Uniform2f(o,t.u_patternscale_a),u_patternscale_b:new c.Uniform2f(o,t.u_patternscale_b),u_sdfgamma:new c.Uniform1f(o,t.u_sdfgamma),u_image:new c.Uniform1i(o,t.u_image),u_tex_y_a:new c.Uniform1f(o,t.u_tex_y_a),u_tex_y_b:new c.Uniform1f(o,t.u_tex_y_b),u_mix:new c.Uniform1f(o,t.u_mix)}),raster:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_tl_parent:new c.Uniform2f(o,t.u_tl_parent),u_scale_parent:new c.Uniform1f(o,t.u_scale_parent),u_buffer_scale:new c.Uniform1f(o,t.u_buffer_scale),u_fade_t:new c.Uniform1f(o,t.u_fade_t),u_opacity:new c.Uniform1f(o,t.u_opacity),u_image0:new c.Uniform1i(o,t.u_image0),u_image1:new c.Uniform1i(o,t.u_image1),u_brightness_low:new c.Uniform1f(o,t.u_brightness_low),u_brightness_high:new c.Uniform1f(o,t.u_brightness_high),u_saturation_factor:new c.Uniform1f(o,t.u_saturation_factor),u_contrast_factor:new c.Uniform1f(o,t.u_contrast_factor),u_spin_weights:new c.Uniform3f(o,t.u_spin_weights)}),symbolIcon:(o,t)=>({u_is_size_zoom_constant:new c.Uniform1i(o,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.Uniform1i(o,t.u_is_size_feature_constant),u_size_t:new c.Uniform1f(o,t.u_size_t),u_size:new c.Uniform1f(o,t.u_size),u_camera_to_center_distance:new c.Uniform1f(o,t.u_camera_to_center_distance),u_pitch:new c.Uniform1f(o,t.u_pitch),u_rotate_symbol:new c.Uniform1i(o,t.u_rotate_symbol),u_aspect_ratio:new c.Uniform1f(o,t.u_aspect_ratio),u_fade_change:new c.Uniform1f(o,t.u_fade_change),u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_label_plane_matrix:new c.UniformMatrix4f(o,t.u_label_plane_matrix),u_coord_matrix:new c.UniformMatrix4f(o,t.u_coord_matrix),u_is_text:new c.Uniform1i(o,t.u_is_text),u_pitch_with_map:new c.Uniform1i(o,t.u_pitch_with_map),u_texsize:new c.Uniform2f(o,t.u_texsize),u_texture:new c.Uniform1i(o,t.u_texture)}),symbolSDF:(o,t)=>({u_is_size_zoom_constant:new c.Uniform1i(o,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.Uniform1i(o,t.u_is_size_feature_constant),u_size_t:new c.Uniform1f(o,t.u_size_t),u_size:new c.Uniform1f(o,t.u_size),u_camera_to_center_distance:new c.Uniform1f(o,t.u_camera_to_center_distance),u_pitch:new c.Uniform1f(o,t.u_pitch),u_rotate_symbol:new c.Uniform1i(o,t.u_rotate_symbol),u_aspect_ratio:new c.Uniform1f(o,t.u_aspect_ratio),u_fade_change:new c.Uniform1f(o,t.u_fade_change),u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_label_plane_matrix:new c.UniformMatrix4f(o,t.u_label_plane_matrix),u_coord_matrix:new c.UniformMatrix4f(o,t.u_coord_matrix),u_is_text:new c.Uniform1i(o,t.u_is_text),u_pitch_with_map:new c.Uniform1i(o,t.u_pitch_with_map),u_texsize:new c.Uniform2f(o,t.u_texsize),u_texture:new c.Uniform1i(o,t.u_texture),u_gamma_scale:new c.Uniform1f(o,t.u_gamma_scale),u_device_pixel_ratio:new c.Uniform1f(o,t.u_device_pixel_ratio),u_is_halo:new c.Uniform1i(o,t.u_is_halo)}),symbolTextAndIcon:(o,t)=>({u_is_size_zoom_constant:new c.Uniform1i(o,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.Uniform1i(o,t.u_is_size_feature_constant),u_size_t:new c.Uniform1f(o,t.u_size_t),u_size:new c.Uniform1f(o,t.u_size),u_camera_to_center_distance:new c.Uniform1f(o,t.u_camera_to_center_distance),u_pitch:new c.Uniform1f(o,t.u_pitch),u_rotate_symbol:new c.Uniform1i(o,t.u_rotate_symbol),u_aspect_ratio:new c.Uniform1f(o,t.u_aspect_ratio),u_fade_change:new c.Uniform1f(o,t.u_fade_change),u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_label_plane_matrix:new c.UniformMatrix4f(o,t.u_label_plane_matrix),u_coord_matrix:new c.UniformMatrix4f(o,t.u_coord_matrix),u_is_text:new c.Uniform1i(o,t.u_is_text),u_pitch_with_map:new c.Uniform1i(o,t.u_pitch_with_map),u_texsize:new c.Uniform2f(o,t.u_texsize),u_texsize_icon:new c.Uniform2f(o,t.u_texsize_icon),u_texture:new c.Uniform1i(o,t.u_texture),u_texture_icon:new c.Uniform1i(o,t.u_texture_icon),u_gamma_scale:new c.Uniform1f(o,t.u_gamma_scale),u_device_pixel_ratio:new c.Uniform1f(o,t.u_device_pixel_ratio),u_is_halo:new c.Uniform1i(o,t.u_is_halo)}),background:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_opacity:new c.Uniform1f(o,t.u_opacity),u_color:new c.UniformColor(o,t.u_color)}),backgroundPattern:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_opacity:new c.Uniform1f(o,t.u_opacity),u_image:new c.Uniform1i(o,t.u_image),u_pattern_tl_a:new c.Uniform2f(o,t.u_pattern_tl_a),u_pattern_br_a:new c.Uniform2f(o,t.u_pattern_br_a),u_pattern_tl_b:new c.Uniform2f(o,t.u_pattern_tl_b),u_pattern_br_b:new c.Uniform2f(o,t.u_pattern_br_b),u_texsize:new c.Uniform2f(o,t.u_texsize),u_mix:new c.Uniform1f(o,t.u_mix),u_pattern_size_a:new c.Uniform2f(o,t.u_pattern_size_a),u_pattern_size_b:new c.Uniform2f(o,t.u_pattern_size_b),u_scale_a:new c.Uniform1f(o,t.u_scale_a),u_scale_b:new c.Uniform1f(o,t.u_scale_b),u_pixel_coord_upper:new c.Uniform2f(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.Uniform2f(o,t.u_pixel_coord_lower),u_tile_units_to_pixels:new c.Uniform1f(o,t.u_tile_units_to_pixels)}),terrain:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_texture:new c.Uniform1i(o,t.u_texture),u_ele_delta:new c.Uniform1f(o,t.u_ele_delta)}),terrainDepth:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_ele_delta:new c.Uniform1f(o,t.u_ele_delta)}),terrainCoords:(o,t)=>({u_matrix:new c.UniformMatrix4f(o,t.u_matrix),u_texture:new c.Uniform1i(o,t.u_texture),u_terrain_coords_id:new c.Uniform1f(o,t.u_terrain_coords_id),u_ele_delta:new c.Uniform1f(o,t.u_ele_delta)})};class xa{constructor(t,n,a){this.context=t;const h=t.gl;this.buffer=h.createBuffer(),this.dynamicDraw=Boolean(a),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),h.bufferData(h.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?h.DYNAMIC_DRAW:h.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const n=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const va={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class ba{constructor(t,n,a,h){this.length=n.length,this.attributes=a,this.itemSize=n.bytesPerElement,this.dynamicDraw=h,this.context=t;const d=t.gl;this.buffer=d.createBuffer(),t.bindVertexBuffer.set(this.buffer),d.bufferData(d.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?d.DYNAMIC_DRAW:d.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let a=0;a<this.attributes.length;a++){const h=n.attributes[this.attributes[a].name];h!==void 0&&t.enableVertexAttribArray(h)}}setVertexAttribPointers(t,n,a){for(let h=0;h<this.attributes.length;h++){const d=this.attributes[h],m=n.attributes[d.name];m!==void 0&&t.vertexAttribPointer(m,d.components,t[va[d.type]],!1,this.itemSize,d.offset+this.itemSize*(a||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class vt{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Bo extends vt{getDefault(){return c.Color.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Fo extends vt{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Yl extends vt{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Kn extends vt{getDefault(){return[!0,!0,!0,!0]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Jn extends vt{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Oo extends vt{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class Vi extends vt{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const n=this.current;(t.func!==n.func||t.ref!==n.ref||t.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class wa extends vt{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Ls extends vt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=t,this.dirty=!1}}class Ds extends vt{getDefault(){return[0,1]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class Ta extends vt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=t,this.dirty=!1}}class Sa extends vt{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Rs extends vt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.BLEND):n.disable(n.BLEND),this.current=t,this.dirty=!1}}class Ea extends vt{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class Ia extends vt{getDefault(){return c.Color.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Bs extends vt{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Uo extends vt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=t,this.dirty=!1}}class Vo extends vt{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class vn extends vt{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class Ql extends vt{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class ec extends vt{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class tc extends vt{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class ic extends vt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class rc extends vt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class nc extends vt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class Aa extends vt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Fs extends vt{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Ca extends vt{constructor(t){super(t),this.vao=t.extVertexArrayObject}getDefault(){return null}set(t){this.vao&&(t!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(t),this.current=t,this.dirty=!1)}}class Ma extends vt{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class bn extends vt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class No extends vt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class Pa extends vt{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class ka extends Pa{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Kr extends Pa{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class $o{constructor(t,n,a,h){this.context=t,this.width=n,this.height=a;const d=t.gl,m=this.framebuffer=d.createFramebuffer();if(this.colorAttachment=new ka(t,m),h&&(this.depthAttachment=new Kr(t,m)),d.checkFramebufferStatus(d.FRAMEBUFFER)!==d.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const t=this.context.gl,n=this.colorAttachment.get();if(n&&t.deleteTexture(n),this.depthAttachment){const a=this.depthAttachment.get();a&&t.deleteRenderbuffer(a)}t.deleteFramebuffer(this.framebuffer)}}class Vt{constructor(t,n,a){this.blendFunction=t,this.blendColor=n,this.mask=a}}Vt.Replace=[1,0],Vt.disabled=new Vt(Vt.Replace,c.Color.transparent,[!1,!1,!1,!1]),Vt.unblended=new Vt(Vt.Replace,c.Color.transparent,[!0,!0,!0,!0]),Vt.alphaBlended=new Vt([1,771],c.Color.transparent,[!0,!0,!0,!0]);class wn{constructor(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new Bo(this),this.clearDepth=new Fo(this),this.clearStencil=new Yl(this),this.colorMask=new Kn(this),this.depthMask=new Jn(this),this.stencilMask=new Oo(this),this.stencilFunc=new Vi(this),this.stencilOp=new wa(this),this.stencilTest=new Ls(this),this.depthRange=new Ds(this),this.depthTest=new Ta(this),this.depthFunc=new Sa(this),this.blend=new Rs(this),this.blendFunc=new Ea(this),this.blendColor=new Ia(this),this.blendEquation=new Bs(this),this.cullFace=new Uo(this),this.cullFaceSide=new Vo(this),this.frontFace=new vn(this),this.program=new Ql(this),this.activeTexture=new ec(this),this.viewport=new tc(this),this.bindFramebuffer=new ic(this),this.bindRenderbuffer=new rc(this),this.bindTexture=new nc(this),this.bindVertexBuffer=new Aa(this),this.bindElementBuffer=new Fs(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new Ca(this),this.pixelStoreUnpack=new Ma(this),this.pixelStoreUnpackPremultiplyAlpha=new bn(this),this.pixelStoreUnpackFlipY=new No(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=t.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(t.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE)}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.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,n){return new xa(this,t,n)}createVertexBuffer(t,n,a){return new ba(this,t,n,a)}createRenderbuffer(t,n,a){const h=this.gl,d=h.createRenderbuffer();return this.bindRenderbuffer.set(d),h.renderbufferStorage(h.RENDERBUFFER,t,n,a),this.bindRenderbuffer.set(null),d}createFramebuffer(t,n,a){return new $o(this,t,n,a)}clear({color:t,depth:n}){const a=this.gl;let h=0;t&&(h|=a.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(h|=a.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),a.clear(h)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){Me(t.blendFunction,Vt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}class mt{constructor(t,n,a){this.func=t,this.mask=n,this.range=a}}mt.ReadOnly=!1,mt.ReadWrite=!0,mt.disabled=new mt(519,mt.ReadOnly,[0,1]);const Yn=7680;class tt{constructor(t,n,a,h,d,m){this.test=t,this.ref=n,this.mask=a,this.fail=h,this.depthFail=d,this.pass=m}}tt.disabled=new tt({func:519,mask:0},0,0,Yn,Yn,Yn);class zt{constructor(t,n,a){this.enable=t,this.mode=n,this.frontFace=a}}let Os;function za(o,t,n,a,h,d,m){const _=o.context,y=_.gl,b=o.useProgram("collisionBox"),S=[];let E=0,M=0;for(let U=0;U<a.length;U++){const W=a[U],te=t.getTile(W),se=te.getBucket(n);if(!se)continue;let he=W.posMatrix;h[0]===0&&h[1]===0||(he=o.translatePosMatrix(W.posMatrix,te,h,d));const pe=m?se.textCollisionBox:se.iconCollisionBox,Te=se.collisionCircleArray;if(Te.length>0){const ye=c.create(),Ae=he;c.mul(ye,se.placementInvProjMatrix,o.transform.glCoordMatrix),c.mul(ye,ye,se.placementViewportMatrix),S.push({circleArray:Te,circleOffset:M,transform:Ae,invTransform:ye,coord:W}),E+=Te.length/4,M=E}pe&&b.draw(_,y.LINES,mt.disabled,tt.disabled,o.colorModeForRenderPass(),zt.disabled,Hr(he,o.transform,te),o.style.map.terrain&&o.style.map.terrain.getTerrainData(W),n.id,pe.layoutVertexBuffer,pe.indexBuffer,pe.segments,null,o.transform.zoom,null,null,pe.collisionVertexBuffer)}if(!m||!S.length)return;const D=o.useProgram("collisionCircle"),B=new c.CollisionCircleLayoutArray;B.resize(4*E),B._trim();let L=0;for(const U of S)for(let W=0;W<U.circleArray.length/4;W++){const te=4*W,se=U.circleArray[te+0],he=U.circleArray[te+1],pe=U.circleArray[te+2],Te=U.circleArray[te+3];B.emplace(L++,se,he,pe,Te,0),B.emplace(L++,se,he,pe,Te,1),B.emplace(L++,se,he,pe,Te,2),B.emplace(L++,se,he,pe,Te,3)}(!Os||Os.length<2*E)&&(Os=function(U){const W=2*U,te=new c.QuadTriangleArray;te.resize(W),te._trim();for(let se=0;se<W;se++){const he=6*se;te.uint16[he+0]=4*se+0,te.uint16[he+1]=4*se+1,te.uint16[he+2]=4*se+2,te.uint16[he+3]=4*se+2,te.uint16[he+4]=4*se+3,te.uint16[he+5]=4*se+0}return te}(E));const N=_.createIndexBuffer(Os,!0),X=_.createVertexBuffer(B,c.collisionCircleLayout.members,!0);for(const U of S){const W={u_matrix:U.transform,u_inv_matrix:U.invTransform,u_camera_to_center_distance:(Z=o.transform).cameraToCenterDistance,u_viewport_size:[Z.width,Z.height]};D.draw(_,y.TRIANGLES,mt.disabled,tt.disabled,o.colorModeForRenderPass(),zt.disabled,W,o.style.map.terrain&&o.style.map.terrain.getTerrainData(U.coord),n.id,X,N,c.SegmentVector.simpleSegment(0,2*U.circleOffset,U.circleArray.length,U.circleArray.length/2),null,o.transform.zoom,null,null,null)}var Z;X.destroy(),N.destroy()}zt.disabled=new zt(!1,1029,2305),zt.backCCW=new zt(!0,1029,2305);const Qn=c.identity(new Float32Array(16));function sc(o,t,n,a,h,d){const{horizontalAlign:m,verticalAlign:_}=c.getAnchorAlignment(o),y=-(m-.5)*t,b=-(_-.5)*n,S=c.evaluateVariableOffset(o,a);return new c.pointGeometry((y/h+S[0])*d,(b/h+S[1])*d)}function ac(o,t,n,a,h,d,m,_,y,b,S){const E=o.text.placedSymbolArray,M=o.text.dynamicLayoutVertexArray,D=o.icon.dynamicLayoutVertexArray,B={};M.clear();for(let L=0;L<E.length;L++){const N=E.get(L),X=N.hidden||!N.crossTileID||o.allowVerticalPlacement&&!N.placedOrientation?null:a[N.crossTileID];if(X){const Z=new c.pointGeometry(N.anchorX,N.anchorY),U=Ce(Z,n?m:d,S),W=at(h.cameraToCenterDistance,U.signedDistanceFromCamera);let te=c.evaluateSizeForFeature(o.textSizeData,y,N)*W/c.ONE_EM;n&&(te*=o.tilePixelRatio/_);const{width:se,height:he,anchor:pe,textOffset:Te,textBoxScale:ye}=X,Ae=sc(pe,se,he,Te,ye,te),je=n?Ce(Z.add(Ae),d,S).point:U.point.add(t?Ae.rotate(-h.angle):Ae),rt=o.allowVerticalPlacement&&N.placedOrientation===c.WritingMode.vertical?Math.PI/2:0;for(let nt=0;nt<N.numGlyphs;nt++)c.addDynamicAttributes(M,je,rt);b&&N.associatedIconIndex>=0&&(B[N.associatedIconIndex]={shiftedAnchor:je,angle:rt})}else Wt(N.numGlyphs,M)}if(b){D.clear();const L=o.icon.placedSymbolArray;for(let N=0;N<L.length;N++){const X=L.get(N);if(X.hidden)Wt(X.numGlyphs,D);else{const Z=B[N];if(Z)for(let U=0;U<X.numGlyphs;U++)c.addDynamicAttributes(D,Z.shiftedAnchor,Z.angle);else Wt(X.numGlyphs,D)}}o.icon.dynamicLayoutVertexBuffer.updateData(D)}o.text.dynamicLayoutVertexBuffer.updateData(M)}function Go(o,t,n){return n.iconsInText&&t?"symbolTextAndIcon":o?"symbolSDF":"symbolIcon"}function jo(o,t,n,a,h,d,m,_,y,b,S,E){const M=o.context,D=M.gl,B=o.transform,L=_==="map",N=y==="map",X=_!=="viewport"&&n.layout.get("symbol-placement")!=="point",Z=L&&!N&&!X,U=!n.layout.get("symbol-sort-key").isConstant();let W=!1;const te=o.depthModeForSublayer(0,mt.ReadOnly),se=n.layout.get("text-variable-anchor"),he=[];for(const pe of a){const Te=t.getTile(pe),ye=Te.getBucket(n);if(!ye)continue;const Ae=h?ye.text:ye.icon;if(!Ae||!Ae.segments.get().length||!Ae.hasVisibleVertices)continue;const je=Ae.programConfigurations.get(n.id),rt=h||ye.sdfIcons,nt=h?ye.textSizeData:ye.iconSizeData,He=N||B.pitch!==0,Pt=o.useProgram(Go(rt,h,ye),je),St=c.evaluateSizeForZoom(nt,B.zoom),ft=o.style.map.terrain&&o.style.map.terrain.getTerrainData(pe);let xt,wt,Ii,yr,hr=[0,0],$t=null;if(h)wt=Te.glyphAtlasTexture,Ii=D.LINEAR,xt=Te.glyphAtlasTexture.size,ye.iconsInText&&(hr=Te.imageAtlasTexture.size,$t=Te.imageAtlasTexture,yr=He||o.options.rotating||o.options.zooming||nt.kind==="composite"||nt.kind==="camera"?D.LINEAR:D.NEAREST);else{const er=n.layout.get("icon-size").constantOr(0)!==1||ye.iconsNeedLinear;wt=Te.imageAtlasTexture,Ii=rt||o.options.rotating||o.options.zooming||er||He?D.LINEAR:D.NEAREST,xt=Te.imageAtlasTexture.size}const Gr=st(Te,1,o.transform.zoom),Ai=Ie(pe.posMatrix,N,L,o.transform,Gr),Ci=Pe(pe.posMatrix,N,L,o.transform,Gr),Qr=se&&ye.hasTextData(),zn=n.layout.get("icon-text-fit")!=="none"&&Qr&&ye.hasIconData();if(X){const er=o.style.map.terrain?(Ln,Ks)=>o.style.map.terrain.getElevation(pe,Ln,Ks):null,tr=n.layout.get("text-rotation-alignment")==="map";xe(ye,pe.posMatrix,o,h,Ai,Ci,N,b,tr,er)}const ei=o.translatePosMatrix(pe.posMatrix,Te,d,m),Gt=X||h&&se||zn?Qn:Ai,It=o.translatePosMatrix(Ci,Te,d,m,!0),hi=rt&&n.paint.get(h?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Di;Di=rt?ye.iconsInText?ya(nt.kind,St,Z,N,o,ei,Gt,It,xt,hr):_a(nt.kind,St,Z,N,o,ei,Gt,It,h,xt,!0):ga(nt.kind,St,Z,N,o,ei,Gt,It,h,xt);const jt={program:Pt,buffers:Ae,uniformValues:Di,atlasTexture:wt,atlasTextureIcon:$t,atlasInterpolation:Ii,atlasInterpolationIcon:yr,isSDF:rt,hasHalo:hi};if(U&&ye.canOverlap){W=!0;const er=Ae.segments.get();for(const tr of er)he.push({segments:new c.SegmentVector([tr]),sortKey:tr.sortKey,state:jt,terrainData:ft})}else he.push({segments:Ae.segments,sortKey:0,state:jt,terrainData:ft})}W&&he.sort((pe,Te)=>pe.sortKey-Te.sortKey);for(const pe of he){const Te=pe.state;if(M.activeTexture.set(D.TEXTURE0),Te.atlasTexture.bind(Te.atlasInterpolation,D.CLAMP_TO_EDGE),Te.atlasTextureIcon&&(M.activeTexture.set(D.TEXTURE1),Te.atlasTextureIcon&&Te.atlasTextureIcon.bind(Te.atlasInterpolationIcon,D.CLAMP_TO_EDGE)),Te.isSDF){const ye=Te.uniformValues;Te.hasHalo&&(ye.u_is_halo=1,Us(Te.buffers,pe.segments,n,o,Te.program,te,S,E,ye,pe.terrainData)),ye.u_is_halo=0}Us(Te.buffers,pe.segments,n,o,Te.program,te,S,E,Te.uniformValues,pe.terrainData)}}function Us(o,t,n,a,h,d,m,_,y,b){const S=a.context;h.draw(S,S.gl.TRIANGLES,d,m,_,zt.disabled,y,b,n.id,o.layoutVertexBuffer,o.indexBuffer,t,n.paint,a.transform.zoom,o.programConfigurations.get(n.id),o.dynamicLayoutVertexBuffer,o.opacityVertexBuffer)}function es(o,t,n,a,h){if(!n||!a||!a.imageAtlas)return;const d=a.imageAtlas.patternPositions;let m=d[n.to.toString()],_=d[n.from.toString()];if(!m||!_){const y=h.getPaintProperty(t);m=d[y],_=d[y]}m&&_&&o.setConstantPatternPositions(m,_)}function ts(o,t,n,a,h,d,m){const _=o.context.gl,y="fill-pattern",b=n.paint.get(y),S=b&&b.constantOr(1),E=n.getCrossfadeParameters();let M,D,B,L,N;m?(D=S&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",M=_.LINES):(D=S?"fillPattern":"fill",M=_.TRIANGLES);const X=b.constantOr(null);for(const Z of a){const U=t.getTile(Z);if(S&&!U.patternsLoaded())continue;const W=U.getBucket(n);if(!W)continue;const te=W.programConfigurations.get(n.id),se=o.useProgram(D,te),he=o.style.map.terrain&&o.style.map.terrain.getTerrainData(Z);S&&(o.context.activeTexture.set(_.TEXTURE0),U.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),te.updatePaintBuffers(E)),es(te,y,X,U,n);const pe=he?Z:null,Te=o.translatePosMatrix(pe?pe.posMatrix:Z.posMatrix,U,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(m){L=W.indexBuffer2,N=W.segments2;const ye=[_.drawingBufferWidth,_.drawingBufferHeight];B=D==="fillOutlinePattern"&&S?ko(Te,o,E,U,ye):Po(Te,ye)}else L=W.indexBuffer,N=W.segments,B=S?ma(Te,o,E,U):Cs(Te);se.draw(o.context,M,h,o.stencilModeForClipping(Z),d,zt.disabled,B,he,n.id,W.layoutVertexBuffer,L,N,n.paint,o.transform.zoom,te)}}function is(o,t,n,a,h,d,m){const _=o.context,y=_.gl,b="fill-extrusion-pattern",S=n.paint.get(b),E=S.constantOr(1),M=n.getCrossfadeParameters(),D=n.paint.get("fill-extrusion-opacity"),B=S.constantOr(null);for(const L of a){const N=t.getTile(L),X=N.getBucket(n);if(!X)continue;const Z=o.style.map.terrain&&o.style.map.terrain.getTerrainData(L),U=X.programConfigurations.get(n.id),W=o.useProgram(E?"fillExtrusionPattern":"fillExtrusion",U);E&&(o.context.activeTexture.set(y.TEXTURE0),N.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),U.updatePaintBuffers(M)),es(U,b,B,N,n);const te=o.translatePosMatrix(L.posMatrix,N,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),se=n.paint.get("fill-extrusion-vertical-gradient"),he=E?Hl(te,o,se,D,L,M,N):pa(te,o,se,D);W.draw(_,_.gl.TRIANGLES,h,d,m,zt.backCCW,he,Z,n.id,X.layoutVertexBuffer,X.indexBuffer,X.segments,n.paint,o.transform.zoom,U,o.style.map.terrain&&X.centroidVertexBuffer)}}function La(o,t,n,a,h,d,m){const _=o.context,y=_.gl,b=n.fbo;if(!b)return;const S=o.useProgram("hillshade"),E=o.style.map.terrain&&o.style.map.terrain.getTerrainData(t);_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,b.colorAttachment.get()),S.draw(_,y.TRIANGLES,h,d,m,zt.disabled,((M,D,B,L)=>{const N=B.paint.get("hillshade-shadow-color"),X=B.paint.get("hillshade-highlight-color"),Z=B.paint.get("hillshade-accent-color");let U=B.paint.get("hillshade-illumination-direction")*(Math.PI/180);B.paint.get("hillshade-illumination-anchor")==="viewport"&&(U-=M.transform.angle);const W=!M.options.moving;return{u_matrix:L?L.posMatrix:M.transform.calculatePosMatrix(D.tileID.toUnwrapped(),W),u_image:0,u_latrange:Ps(0,D.tileID),u_light:[B.paint.get("hillshade-exaggeration"),U],u_shadow:N,u_highlight:X,u_accent:Z}})(o,n,a,E?t:null),E,a.id,o.rasterBoundsBuffer,o.quadTriangleIndexBuffer,o.rasterBoundsSegments)}function qo(o,t,n,a,h,d){const m=o.context,_=m.gl,y=t.dem;if(y&&y.data){const b=y.dim,S=y.stride,E=y.getPixels();if(m.activeTexture.set(_.TEXTURE1),m.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||o.getTileTexture(S),t.demTexture){const D=t.demTexture;D.update(E,{premultiply:!1}),D.bind(_.NEAREST,_.CLAMP_TO_EDGE)}else t.demTexture=new Rt(m,E,_.RGBA,{premultiply:!1}),t.demTexture.bind(_.NEAREST,_.CLAMP_TO_EDGE);m.activeTexture.set(_.TEXTURE0);let M=t.fbo;if(!M){const D=new Rt(m,{width:b,height:b,data:null},_.RGBA);D.bind(_.LINEAR,_.CLAMP_TO_EDGE),M=t.fbo=m.createFramebuffer(b,b,!0),M.colorAttachment.set(D.texture)}m.bindFramebuffer.set(M.framebuffer),m.viewport.set([0,0,b,b]),o.useProgram("hillshadePrepare").draw(m,_.TRIANGLES,a,h,d,zt.disabled,((D,B)=>{const L=B.stride,N=c.create();return c.ortho(N,0,c.EXTENT,-c.EXTENT,0,0,1),c.translate(N,N,[0,-c.EXTENT,0]),{u_matrix:N,u_image:1,u_dimension:[L,L],u_zoom:D.overscaledZ,u_unpack:B.getUnpackVector()}})(t.tileID,y),null,n.id,o.rasterBoundsBuffer,o.quadTriangleIndexBuffer,o.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function Vs(o,t,n,a,h,d){const m=a.paint.get("raster-fade-duration");if(!d&&m>0){const _=c.exported.now(),y=(_-o.timeAdded)/m,b=t?(_-t.timeAdded)/m:-1,S=n.getSource(),E=h.coveringZoomLevel({tileSize:S.tileSize,roundZoom:S.roundZoom}),M=!t||Math.abs(t.tileID.overscaledZ-E)>Math.abs(o.tileID.overscaledZ-E),D=M&&o.refreshedUponExpiration?1:c.clamp(M?y:1-b,0,1);return o.refreshedUponExpiration&&y>=1&&(o.refreshedUponExpiration=!1),t?{opacity:1,mix:1-D}:{opacity:D,mix:0}}return{opacity:1,mix:0}}const Ns=new c.Color(1,0,0,1),Qi=new c.Color(0,1,0,1),Zo=new c.Color(0,0,1,1),Da=new c.Color(1,0,1,1),Xo=new c.Color(0,1,1,1);function Jr(o,t,n,a){Tn(o,0,t+n/2,o.transform.width,n,a)}function rs(o,t,n,a){Tn(o,t-n/2,0,n,o.transform.height,a)}function Tn(o,t,n,a,h,d){const m=o.context,_=m.gl;_.enable(_.SCISSOR_TEST),_.scissor(t*o.pixelRatio,n*o.pixelRatio,a*o.pixelRatio,h*o.pixelRatio),m.clear({color:d}),_.disable(_.SCISSOR_TEST)}function oc(o,t,n){const a=o.context,h=a.gl,d=n.posMatrix,m=o.useProgram("debug"),_=mt.disabled,y=tt.disabled,b=o.colorModeForRenderPass(),S="$debug",E=o.style.map.terrain&&o.style.map.terrain.getTerrainData(n);a.activeTexture.set(h.TEXTURE0),o.emptyTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE);const M=t.getTileByID(n.key).latestRawTileData,D=Math.floor((M&&M.byteLength||0)/1024),B=t.getTile(n).tileSize,L=512/Math.min(B,512)*(n.overscaledZ/o.transform.zoom)*.5;let N=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(N+=` => ${n.overscaledZ}`),function(X,Z){X.initDebugOverlayCanvas();const U=X.debugOverlayCanvas,W=X.context.gl,te=X.debugOverlayCanvas.getContext("2d");te.clearRect(0,0,U.width,U.height),te.shadowColor="white",te.shadowBlur=2,te.lineWidth=1.5,te.strokeStyle="white",te.textBaseline="top",te.font="bold 36px Open Sans, sans-serif",te.fillText(Z,5,5),te.strokeText(Z,5,5),X.debugOverlayTexture.update(U),X.debugOverlayTexture.bind(W.LINEAR,W.CLAMP_TO_EDGE)}(o,`${N} ${D}kB`),m.draw(a,h.TRIANGLES,_,y,Vt.alphaBlended,zt.disabled,Wn(d,c.Color.transparent,L),null,S,o.debugBuffer,o.quadTriangleIndexBuffer,o.debugSegments),m.draw(a,h.LINE_STRIP,_,y,b,zt.disabled,Wn(d,c.Color.red),E,S,o.debugBuffer,o.tileBorderIndexBuffer,o.debugSegments)}function $s(o,t,n){const a=o.context,h=a.gl,d=o.colorModeForRenderPass(),m=new mt(h.LEQUAL,mt.ReadWrite,o.depthRangeFor3D),_=o.useProgram("terrain"),y=t.getTerrainMesh();a.bindFramebuffer.set(null),a.viewport.set([0,0,o.width,o.height]);for(const b of n){const S=o.renderToTexture.getTexture(b),E=t.getTerrainData(b.tileID);a.activeTexture.set(h.TEXTURE0),h.bindTexture(h.TEXTURE_2D,S.texture);const M={u_matrix:o.transform.calculatePosMatrix(b.tileID.toUnwrapped()),u_texture:0,u_ele_delta:t.getMeshFrameDelta(o.transform.zoom)};_.draw(a,h.TRIANGLES,m,tt.disabled,d,zt.backCCW,M,E,"terrain",y.vertexBuffer,y.indexBuffer,y.segments)}}const Wo={symbol:function(o,t,n,a,h){if(o.renderPass!=="translucent")return;const d=tt.disabled,m=o.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(_,y,b,S,E,M,D){const B=y.transform,L=E==="map",N=M==="map";for(const X of _){const Z=S.getTile(X),U=Z.getBucket(b);if(!U||!U.text||!U.text.segments.get().length)continue;const W=c.evaluateSizeForZoom(U.textSizeData,B.zoom),te=st(Z,1,y.transform.zoom),se=Ie(X.posMatrix,N,L,y.transform,te),he=b.layout.get("icon-text-fit")!=="none"&&U.hasIconData();if(W){const pe=Math.pow(2,B.zoom-Z.tileID.overscaledZ);ac(U,L,N,D,B,se,X.posMatrix,pe,W,he,y.style.map.terrain?(Te,ye)=>y.style.map.terrain.getElevation(X,Te,ye):null)}}}(a,o,n,t,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),h),n.paint.get("icon-opacity").constantOr(1)!==0&&jo(o,t,n,a,!1,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),n.layout.get("icon-rotation-alignment"),n.layout.get("icon-pitch-alignment"),n.layout.get("icon-keep-upright"),d,m),n.paint.get("text-opacity").constantOr(1)!==0&&jo(o,t,n,a,!0,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.layout.get("text-keep-upright"),d,m),t.map.showCollisionBoxes&&(za(o,t,n,a,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),za(o,t,n,a,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(o,t,n,a){if(o.renderPass!=="translucent")return;const h=n.paint.get("circle-opacity"),d=n.paint.get("circle-stroke-width"),m=n.paint.get("circle-stroke-opacity"),_=!n.layout.get("circle-sort-key").isConstant();if(h.constantOr(1)===0&&(d.constantOr(1)===0||m.constantOr(1)===0))return;const y=o.context,b=y.gl,S=o.depthModeForSublayer(0,mt.ReadOnly),E=tt.disabled,M=o.colorModeForRenderPass(),D=[];for(let B=0;B<a.length;B++){const L=a[B],N=t.getTile(L),X=N.getBucket(n);if(!X)continue;const Z=X.programConfigurations.get(n.id),U=o.useProgram("circle",Z),W=X.layoutVertexBuffer,te=X.indexBuffer,se=o.style.map.terrain&&o.style.map.terrain.getTerrainData(L),he={programConfiguration:Z,program:U,layoutVertexBuffer:W,indexBuffer:te,uniformValues:zo(o,L,N,n),terrainData:se};if(_){const pe=X.segments.get();for(const Te of pe)D.push({segments:new c.SegmentVector([Te]),sortKey:Te.sortKey,state:he})}else D.push({segments:X.segments,sortKey:0,state:he})}_&&D.sort((B,L)=>B.sortKey-L.sortKey);for(const B of D){const{programConfiguration:L,program:N,layoutVertexBuffer:X,indexBuffer:Z,uniformValues:U,terrainData:W}=B.state;N.draw(y,b.TRIANGLES,S,E,M,zt.disabled,U,W,n.id,X,Z,B.segments,n.paint,o.transform.zoom,L)}},heatmap:function(o,t,n,a){if(n.paint.get("heatmap-opacity")!==0)if(o.renderPass==="offscreen"){const h=o.context,d=h.gl,m=tt.disabled,_=new Vt([d.ONE,d.ONE],c.Color.transparent,[!0,!0,!0,!0]);(function(y,b,S){const E=y.gl;y.activeTexture.set(E.TEXTURE1),y.viewport.set([0,0,b.width/4,b.height/4]);let M=S.heatmapFbo;if(M)E.bindTexture(E.TEXTURE_2D,M.colorAttachment.get()),y.bindFramebuffer.set(M.framebuffer);else{const D=E.createTexture();E.bindTexture(E.TEXTURE_2D,D),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_S,E.CLAMP_TO_EDGE),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_T,E.CLAMP_TO_EDGE),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_MIN_FILTER,E.LINEAR),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_MAG_FILTER,E.LINEAR),M=S.heatmapFbo=y.createFramebuffer(b.width/4,b.height/4,!1),function(B,L,N,X){const Z=B.gl;Z.texImage2D(Z.TEXTURE_2D,0,Z.RGBA,L.width/4,L.height/4,0,Z.RGBA,B.extRenderToTextureHalfFloat?B.extTextureHalfFloat.HALF_FLOAT_OES:Z.UNSIGNED_BYTE,null),X.colorAttachment.set(N)}(y,b,D,M)}})(h,o,n),h.clear({color:c.Color.transparent});for(let y=0;y<a.length;y++){const b=a[y];if(t.hasRenderableParent(b))continue;const S=t.getTile(b),E=S.getBucket(n);if(!E)continue;const M=E.programConfigurations.get(n.id),D=o.useProgram("heatmap",M),{zoom:B}=o.transform;D.draw(h,d.TRIANGLES,mt.disabled,m,_,zt.disabled,Ms(b.posMatrix,S,B,n.paint.get("heatmap-intensity")),null,n.id,E.layoutVertexBuffer,E.indexBuffer,E.segments,n.paint,o.transform.zoom,M)}h.viewport.set([0,0,o.width,o.height])}else o.renderPass==="translucent"&&(o.context.setColorMode(o.colorModeForRenderPass()),function(h,d){const m=h.context,_=m.gl,y=d.heatmapFbo;if(!y)return;m.activeTexture.set(_.TEXTURE0),_.bindTexture(_.TEXTURE_2D,y.colorAttachment.get()),m.activeTexture.set(_.TEXTURE1);let b=d.colorRampTexture;b||(b=d.colorRampTexture=new Rt(m,d.colorRamp,_.RGBA)),b.bind(_.LINEAR,_.CLAMP_TO_EDGE),h.useProgram("heatmapTexture").draw(m,_.TRIANGLES,mt.disabled,tt.disabled,h.colorModeForRenderPass(),zt.disabled,((S,E,M,D)=>{const B=c.create();c.ortho(B,0,S.width,S.height,0,0,1);const L=S.context.gl;return{u_matrix:B,u_world:[L.drawingBufferWidth,L.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:E.paint.get("heatmap-opacity")}})(h,d),null,d.id,h.viewportBuffer,h.quadTriangleIndexBuffer,h.viewportSegments,d.paint,h.transform.zoom)}(o,n))},line:function(o,t,n,a){if(o.renderPass!=="translucent")return;const h=n.paint.get("line-opacity"),d=n.paint.get("line-width");if(h.constantOr(1)===0||d.constantOr(1)===0)return;const m=o.depthModeForSublayer(0,mt.ReadOnly),_=o.colorModeForRenderPass(),y=n.paint.get("line-dasharray"),b=n.paint.get("line-pattern"),S=b.constantOr(1),E=n.paint.get("line-gradient"),M=n.getCrossfadeParameters(),D=S?"linePattern":y?"lineSDF":E?"lineGradient":"line",B=o.context,L=B.gl;let N=!0;for(const X of a){const Z=t.getTile(X);if(S&&!Z.patternsLoaded())continue;const U=Z.getBucket(n);if(!U)continue;const W=U.programConfigurations.get(n.id),te=o.context.program.get(),se=o.useProgram(D,W),he=N||se.program!==te,pe=o.style.map.terrain&&o.style.map.terrain.getTerrainData(X),Te=b.constantOr(null);if(Te&&Z.imageAtlas){const je=Z.imageAtlas,rt=je.patternPositions[Te.to.toString()],nt=je.patternPositions[Te.from.toString()];rt&&nt&&W.setConstantPatternPositions(rt,nt)}const ye=pe?X:null,Ae=S?fa(o,Z,n,M,ye):y?ks(o,Z,n,y,M,ye):E?Lo(o,Z,n,U.lineClipsArray.length,ye):Hn(o,Z,n,ye);if(S)B.activeTexture.set(L.TEXTURE0),Z.imageAtlasTexture.bind(L.LINEAR,L.CLAMP_TO_EDGE),W.updatePaintBuffers(M);else if(y&&(he||o.lineAtlas.dirty))B.activeTexture.set(L.TEXTURE0),o.lineAtlas.bind(B);else if(E){const je=U.gradients[n.id];let rt=je.texture;if(n.gradientVersion!==je.version){let nt=256;if(n.stepInterpolant){const He=t.getSource().maxzoom,Pt=X.canonical.z===He?Math.ceil(1<<o.transform.maxZoom-X.canonical.z):1;nt=c.clamp(c.nextPowerOfTwo(U.maxLineLength/c.EXTENT*1024*Pt),256,B.maxTextureSize)}je.gradient=c.renderColorRamp({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:nt,image:je.gradient||void 0,clips:U.lineClipsArray}),je.texture?je.texture.update(je.gradient):je.texture=new Rt(B,je.gradient,L.RGBA),je.version=n.gradientVersion,rt=je.texture}B.activeTexture.set(L.TEXTURE0),rt.bind(n.stepInterpolant?L.NEAREST:L.LINEAR,L.CLAMP_TO_EDGE)}se.draw(B,L.TRIANGLES,m,o.stencilModeForClipping(X),_,zt.disabled,Ae,pe,n.id,U.layoutVertexBuffer,U.indexBuffer,U.segments,n.paint,o.transform.zoom,W,U.layoutVertexBuffer2),N=!1}},fill:function(o,t,n,a){const h=n.paint.get("fill-color"),d=n.paint.get("fill-opacity");if(d.constantOr(1)===0)return;const m=o.colorModeForRenderPass(),_=n.paint.get("fill-pattern"),y=o.opaquePassEnabledForLayer()&&!_.constantOr(1)&&h.constantOr(c.Color.transparent).a===1&&d.constantOr(0)===1?"opaque":"translucent";if(o.renderPass===y){const b=o.depthModeForSublayer(1,o.renderPass==="opaque"?mt.ReadWrite:mt.ReadOnly);ts(o,t,n,a,b,m,!1)}if(o.renderPass==="translucent"&&n.paint.get("fill-antialias")){const b=o.depthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,mt.ReadOnly);ts(o,t,n,a,b,m,!0)}},"fill-extrusion":function(o,t,n,a){const h=n.paint.get("fill-extrusion-opacity");if(h!==0&&o.renderPass==="translucent"){const d=new mt(o.context.gl.LEQUAL,mt.ReadWrite,o.depthRangeFor3D);if(h!==1||n.paint.get("fill-extrusion-pattern").constantOr(1))is(o,t,n,a,d,tt.disabled,Vt.disabled),is(o,t,n,a,d,o.stencilModeFor3D(),o.colorModeForRenderPass());else{const m=o.colorModeForRenderPass();is(o,t,n,a,d,tt.disabled,m)}}},hillshade:function(o,t,n,a){if(o.renderPass!=="offscreen"&&o.renderPass!=="translucent")return;const h=o.context,d=o.depthModeForSublayer(0,mt.ReadOnly),m=o.colorModeForRenderPass(),[_,y]=o.renderPass==="translucent"?o.stencilConfigForOverlap(a):[{},a];for(const b of y){const S=t.getTile(b);S.needsHillshadePrepare!==void 0&&S.needsHillshadePrepare&&o.renderPass==="offscreen"?qo(o,S,n,d,tt.disabled,m):o.renderPass==="translucent"&&La(o,b,S,n,d,_[b.overscaledZ],m)}h.viewport.set([0,0,o.width,o.height])},raster:function(o,t,n,a){if(o.renderPass!=="translucent"||n.paint.get("raster-opacity")===0||!a.length)return;const h=o.context,d=h.gl,m=t.getSource(),_=o.useProgram("raster"),y=o.colorModeForRenderPass(),[b,S]=m instanceof zi?[{},a]:o.stencilConfigForOverlap(a),E=S[S.length-1].overscaledZ,M=!o.options.moving;for(const D of S){const B=o.depthModeForSublayer(D.overscaledZ-E,n.paint.get("raster-opacity")===1?mt.ReadWrite:mt.ReadOnly,d.LESS),L=t.getTile(D);L.registerFadeDuration(n.paint.get("raster-fade-duration"));const N=t.findLoadedParent(D,0),X=Vs(L,N,t,n,o.transform,o.style.map.terrain);let Z,U;const W=n.paint.get("raster-resampling")==="nearest"?d.NEAREST:d.LINEAR;h.activeTexture.set(d.TEXTURE0),L.texture.bind(W,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),h.activeTexture.set(d.TEXTURE1),N?(N.texture.bind(W,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),Z=Math.pow(2,N.tileID.overscaledZ-L.tileID.overscaledZ),U=[L.tileID.canonical.x*Z%1,L.tileID.canonical.y*Z%1]):L.texture.bind(W,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST);const te=o.style.map.terrain&&o.style.map.terrain.getTerrainData(D),se=te?D:null,he=se?se.posMatrix:o.transform.calculatePosMatrix(D.toUnwrapped(),M),pe=zs(he,U||[0,0],Z||1,X,n);m instanceof zi?_.draw(h,d.TRIANGLES,B,tt.disabled,y,zt.disabled,pe,te,n.id,m.boundsBuffer,o.quadTriangleIndexBuffer,m.boundsSegments):_.draw(h,d.TRIANGLES,B,b[D.overscaledZ],y,zt.disabled,pe,te,n.id,o.rasterBoundsBuffer,o.quadTriangleIndexBuffer,o.rasterBoundsSegments)}},background:function(o,t,n,a){const h=n.paint.get("background-color"),d=n.paint.get("background-opacity");if(d===0)return;const m=o.context,_=m.gl,y=o.transform,b=y.tileSize,S=n.paint.get("background-pattern");if(o.isPatternMissing(S))return;const E=!S&&h.a===1&&d===1&&o.opaquePassEnabledForLayer()?"opaque":"translucent";if(o.renderPass!==E)return;const M=tt.disabled,D=o.depthModeForSublayer(0,E==="opaque"?mt.ReadWrite:mt.ReadOnly),B=o.colorModeForRenderPass(),L=o.useProgram(S?"backgroundPattern":"background"),N=a||y.coveringTiles({tileSize:b,terrain:o.style.map.terrain});S&&(m.activeTexture.set(_.TEXTURE0),o.imageManager.bind(o.context));const X=n.getCrossfadeParameters();for(const Z of N){const U=a?Z.posMatrix:o.transform.calculatePosMatrix(Z.toUnwrapped()),W=S?Kl(U,d,o,S,{tileID:Z,tileSize:b},X):Ro(U,d,h),te=o.style.map.terrain&&o.style.map.terrain.getTerrainData(Z);L.draw(m,_.TRIANGLES,D,M,B,zt.disabled,W,te,n.id,o.tileExtentBuffer,o.quadTriangleIndexBuffer,o.tileExtentSegments)}},debug:function(o,t,n){for(let a=0;a<n.length;a++)oc(o,t,n[a])},custom:function(o,t,n){const a=o.context,h=n.implementation;if(o.renderPass==="offscreen"){const d=h.prerender;d&&(o.setCustomLayerDefaults(),a.setColorMode(o.colorModeForRenderPass()),d.call(h,a.gl,o.transform.customLayerMatrix()),a.setDirty(),o.setBaseState())}else if(o.renderPass==="translucent"){o.setCustomLayerDefaults(),a.setColorMode(o.colorModeForRenderPass()),a.setStencilMode(tt.disabled);const d=h.renderingMode==="3d"?new mt(o.context.gl.LEQUAL,mt.ReadWrite,o.depthRangeFor3D):o.depthModeForSublayer(0,mt.ReadOnly);a.setDepthMode(d),h.render(a.gl,o.transform.customLayerMatrix()),a.setDirty(),o.setBaseState(),a.bindFramebuffer.set(null)}}};class Ho{constructor(t,n){this.context=new wn(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.create(),renderTime:0},this.setup(),this.numSublayers=mi.maxUnderzooming+mi.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Ui,this.gpuTimers={}}resize(t,n,a){if(this.width=t*a,this.height=n*a,this.pixelRatio=a,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const h of this.style._order)this.style._layers[h].resize()}setup(){const t=this.context,n=new c.PosArray;n.emplaceBack(0,0),n.emplaceBack(c.EXTENT,0),n.emplaceBack(0,c.EXTENT),n.emplaceBack(c.EXTENT,c.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(n,Zn.members),this.tileExtentSegments=c.SegmentVector.simpleSegment(0,0,4,2);const a=new c.PosArray;a.emplaceBack(0,0),a.emplaceBack(c.EXTENT,0),a.emplaceBack(0,c.EXTENT),a.emplaceBack(c.EXTENT,c.EXTENT),this.debugBuffer=t.createVertexBuffer(a,Zn.members),this.debugSegments=c.SegmentVector.simpleSegment(0,0,4,5);const h=new c.RasterBoundsArray;h.emplaceBack(0,0,0,0),h.emplaceBack(c.EXTENT,0,c.EXTENT,0),h.emplaceBack(0,c.EXTENT,0,c.EXTENT),h.emplaceBack(c.EXTENT,c.EXTENT,c.EXTENT,c.EXTENT),this.rasterBoundsBuffer=t.createVertexBuffer(h,qr.members),this.rasterBoundsSegments=c.SegmentVector.simpleSegment(0,0,4,2);const d=new c.PosArray;d.emplaceBack(0,0),d.emplaceBack(1,0),d.emplaceBack(0,1),d.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(d,Zn.members),this.viewportSegments=c.SegmentVector.simpleSegment(0,0,4,2);const m=new c.LineStripIndexArray;m.emplaceBack(0),m.emplaceBack(1),m.emplaceBack(3),m.emplaceBack(2),m.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(m);const _=new c.TriangleIndexArray;_.emplaceBack(0,1,2),_.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(_),this.emptyTexture=new Rt(t,{width:1,height:1,data:new Uint8Array([0,0,0,0])},t.gl.RGBA);const y=this.context.gl;this.stencilClearMode=new tt({func:y.ALWAYS,mask:0},0,255,y.ZERO,y.ZERO,y.ZERO)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const a=c.create();c.ortho(a,0,this.width,this.height,0,0,1),c.scale(a,a,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,mt.disabled,this.stencilClearMode,Vt.disabled,zt.disabled,yn(a),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n){if(this.currentStencilSource===t.source||!t.isTileClipped()||!n||!n.length)return;this.currentStencilSource=t.source;const a=this.context,h=a.gl;this.nextStencilID+n.length>256&&this.clearStencil(),a.setColorMode(Vt.disabled),a.setDepthMode(mt.disabled);const d=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const m of n){const _=this._tileClippingMaskIDs[m.key]=this.nextStencilID++,y=this.style.map.terrain&&this.style.map.terrain.getTerrainData(m);d.draw(a,h.TRIANGLES,mt.disabled,new tt({func:h.ALWAYS,mask:0},_,255,h.KEEP,h.KEEP,h.REPLACE),Vt.disabled,zt.disabled,yn(m.posMatrix),y,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new tt({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new tt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,a=t.sort((m,_)=>_.overscaledZ-m.overscaledZ),h=a[a.length-1].overscaledZ,d=a[0].overscaledZ-h+1;if(d>1){this.currentStencilSource=void 0,this.nextStencilID+d>256&&this.clearStencil();const m={};for(let _=0;_<d;_++)m[_+h]=new tt({func:n.GEQUAL,mask:255},_+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=d,[m,a]}return[{[h]:tt.disabled},a]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new Vt([t.CONSTANT_COLOR,t.ONE],new c.Color(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Vt.unblended:Vt.alphaBlended}depthModeForSublayer(t,n,a){if(!this.opaquePassEnabledForLayer())return mt.disabled;const h=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new mt(a||this.context.gl.LEQUAL,n,[h,h])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(c.exported.now()),this.imageManager.beginFrame();const a=this.style._order,h=this.style.sourceCaches;for(const y in h){const b=h[y];b.used&&b.prepare(this.context)}const d={},m={},_={};for(const y in h){const b=h[y];d[y]=b.getVisibleCoordinates(),m[y]=d[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}if(this.renderToTexture){this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0;const y=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!c.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||y.length)&&(c.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(b,S){const E=b.context,M=E.gl,D=Vt.unblended,B=new mt(M.LEQUAL,mt.ReadWrite,[0,1]),L=S.getTerrainMesh(),N=S.sourceCache.getRenderableTiles(),X=b.useProgram("terrainDepth");E.bindFramebuffer.set(S.getFramebuffer("depth").framebuffer),E.viewport.set([0,0,b.width/devicePixelRatio,b.height/devicePixelRatio]),E.clear({color:c.Color.transparent,depth:1});for(const Z of N){const U=S.getTerrainData(Z.tileID),W={u_matrix:b.transform.calculatePosMatrix(Z.tileID.toUnwrapped()),u_ele_delta:S.getMeshFrameDelta(b.transform.zoom)};X.draw(E,M.TRIANGLES,B,tt.disabled,D,zt.backCCW,W,U,"terrain",L.vertexBuffer,L.indexBuffer,L.segments)}E.bindFramebuffer.set(null),E.viewport.set([0,0,b.width,b.height])}(this,this.style.map.terrain),function(b,S){const E=b.context,M=E.gl,D=Vt.unblended,B=new mt(M.LEQUAL,mt.ReadWrite,[0,1]),L=S.getTerrainMesh(),N=S.getCoordsTexture(),X=S.sourceCache.getRenderableTiles(),Z=b.useProgram("terrainCoords");E.bindFramebuffer.set(S.getFramebuffer("coords").framebuffer),E.viewport.set([0,0,b.width/devicePixelRatio,b.height/devicePixelRatio]),E.clear({color:c.Color.transparent,depth:1}),S.coordsIndex=[];for(const U of X){const W=S.getTerrainData(U.tileID);E.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,N.texture);const te={u_matrix:b.transform.calculatePosMatrix(U.tileID.toUnwrapped()),u_terrain_coords_id:(255-S.coordsIndex.length)/255,u_texture:0,u_ele_delta:S.getMeshFrameDelta(b.transform.zoom)};Z.draw(E,M.TRIANGLES,B,tt.disabled,D,zt.backCCW,te,W,"terrain",L.vertexBuffer,L.indexBuffer,L.segments),S.coordsIndex.push(U.tileID.key)}E.bindFramebuffer.set(null),E.viewport.set([0,0,b.width,b.height])}(this,this.style.map.terrain))}this.renderPass="offscreen";for(const y of a){const b=this.style._layers[y];if(!b.hasOffscreenPass()||b.isHidden(this.transform.zoom))continue;const S=m[b.source];(b.type==="custom"||S.length)&&this.renderLayer(this,h[b.source],b,S)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?c.Color.black:c.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=a.length-1;this.currentLayer>=0;this.currentLayer--){const y=this.style._layers[a[this.currentLayer]],b=h[y.source],S=d[y.source];this._renderTileClippingMasks(y,S),this.renderLayer(this,b,y,S)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<a.length;this.currentLayer++){const y=this.style._layers[a[this.currentLayer]],b=h[y.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(y))continue;const S=(y.type==="symbol"?_:m)[y.source];this._renderTileClippingMasks(y,d[y.source]),this.renderLayer(this,b,y,S)}if(this.options.showTileBoundaries){const y=function(b,S){let E=null;const M=Object.values(b._layers).flatMap(N=>N.source&&!N.isHidden(S)?[b.sourceCaches[N.source]]:[]),D=M.filter(N=>N.getSource().type==="vector"),B=M.filter(N=>N.getSource().type!=="vector"),L=N=>{(!E||E.getSource().maxzoom<N.getSource().maxzoom)&&(E=N)};return D.forEach(N=>L(N)),E||B.forEach(N=>L(N)),E}(this.style,this.transform.zoom);y&&Wo.debug(this,y,y.getVisibleCoordinates())}this.options.showPadding&&function(y){const b=y.transform.padding;Jr(y,y.transform.height-(b.top||0),3,Ns),Jr(y,b.bottom||0,3,Qi),rs(y,b.left||0,3,Zo),rs(y,y.transform.width-(b.right||0),3,Da);const S=y.transform.centerPoint;(function(E,M,D,B){Tn(E,M-1,D-10,2,20,B),Tn(E,M-10,D-1,20,2,B)})(y,S.x,y.transform.height-S.y,Xo)}(this),this.context.setDefault()}renderLayer(t,n,a,h){a.isHidden(this.transform.zoom)||(a.type==="background"||a.type==="custom"||(h||[]).length)&&(this.id=a.id,this.gpuTimingStart(a),Wo[a.type](t,n,a,h,this.style.placement.variableOffsets),this.gpuTimingEnd())}gpuTimingStart(t){if(!this.options.gpuTiming)return;const n=this.context.extTimerQuery;let a=this.gpuTimers[t.id];a||(a=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:n.createQueryEXT()}),a.calls++,n.beginQueryEXT(n.TIME_ELAPSED_EXT,a.query)}gpuTimingEnd(){if(!this.options.gpuTiming)return;const t=this.context.extTimerQuery;t.endQueryEXT(t.TIME_ELAPSED_EXT)}collectGpuTimers(){const t=this.gpuTimers;return this.gpuTimers={},t}queryGpuTimers(t){const n={};for(const a in t){const h=t[a],d=this.context.extTimerQuery,m=d.getQueryObjectEXT(h.query,d.QUERY_RESULT_EXT)/1e6;d.deleteQueryEXT(h.query),n[a]=m}return n}translatePosMatrix(t,n,a,h,d){if(!a[0]&&!a[1])return t;const m=d?h==="map"?this.transform.angle:0:h==="viewport"?-this.transform.angle:0;if(m){const b=Math.sin(m),S=Math.cos(m);a=[a[0]*S-a[1]*b,a[0]*b+a[1]*S]}const _=[d?a[0]:st(n,a[0],this.transform.zoom),d?a[1]:st(n,a[1],this.transform.zoom),0],y=new Float32Array(16);return c.translate(y,t,_),y}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const n=this.imageManager.getPattern(t.from.toString()),a=this.imageManager.getPattern(t.to.toString());return!n||!a}useProgram(t,n){this.cache=this.cache||{};const a=t+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[a]||(this.cache[a]=new Co(this.context,t,Xn[t],n,Jl[t],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 t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Rt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class Sn{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,a){const h=Math.pow(2,a),d=[[-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/(_=c.transformMat4([],_,t))[3]/n*h;return c.mul$1(_,_,[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=c.sub([],d[_[0]],d[_[1]]),b=c.sub([],d[_[2]],d[_[1]]),S=c.normalize([],c.cross([],y,b)),E=-c.dot(S,d[_[1]]);return S.concat(E)});return new Sn(d,m)}}class En{constructor(t,n){this.min=t,this.max=n,this.center=c.scale$1([],c.add([],this.min,this.max),.5)}quadrant(t){const n=[t%2==0,t<2],a=c.clone$2(this.min),h=c.clone$2(this.max);for(let d=0;d<n.length;d++)a[d]=n[d]?this.min[d]:this.center[d],h[d]=n[d]?this.center[d]:this.max[d];return h[2]=this.max[2],new En(a,h)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersects(t){const n=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let a=!0;for(let h=0;h<t.planes.length;h++){const d=t.planes[h];let m=0;for(let _=0;_<n.length;_++)c.dot$1(d,n[_])>=0&&m++;if(m===0)return 0;m!==n.length&&(a=!1)}if(a)return 2;for(let h=0;h<3;h++){let d=Number.MAX_VALUE,m=-Number.MAX_VALUE;for(let _=0;_<t.points.length;_++){const y=t.points[_][h]-this.min[h];d=Math.min(d,y),m=Math.max(m,y)}if(m<0||d>this.max[h]-this.min[h])return 0}return 1}}class Gs{constructor(t=0,n=0,a=0,h=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(a)||a<0||isNaN(h)||h<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=a,this.right=h}interpolate(t,n,a){return n.top!=null&&t.top!=null&&(this.top=c.number(t.top,n.top,a)),n.bottom!=null&&t.bottom!=null&&(this.bottom=c.number(t.bottom,n.bottom,a)),n.left!=null&&t.left!=null&&(this.left=c.number(t.left,n.left,a)),n.right!=null&&t.right!=null&&(this.right=c.number(t.right,n.right,a)),this}getCenter(t,n){const a=c.clamp((this.left+t-this.right)/2,0,t),h=c.clamp((this.top+n-this.bottom)/2,0,n);return new c.pointGeometry(a,h)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Gs(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class js{constructor(t,n,a,h,d){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=d===void 0||!!d,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=a??0,this._maxPitch=h??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new c.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Gs,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const t=new js(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t._elevation=this._elevation,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._calcMatrices(),t}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new c.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-c.wrap(t,-180,180)*Math.PI/180;var a;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=(a=new c.ARRAY_TYPE(4),c.ARRAY_TYPE!=Float32Array&&(a[1]=0,a[2]=0),a[0]=1,a[3]=1,a),function(h,d,m){var _=d[0],y=d[1],b=d[2],S=d[3],E=Math.sin(m),M=Math.cos(m);h[0]=_*M+b*E,h[1]=y*M+S*E,h[2]=_*-E+b*M,h[3]=y*-E+S*M}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=c.clamp(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const n=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this.tileZoom=Math.max(0,Math.floor(n)),this.scale=this.zoomScale(n),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,a){this._unmodified=!1,this._edgeInsets.interpolate(t,n,a),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new c.UnwrappedTileID(0,t)];if(this._renderWorldCopies){const a=this.pointCoordinate(new c.pointGeometry(0,0)),h=this.pointCoordinate(new c.pointGeometry(this.width,0)),d=this.pointCoordinate(new c.pointGeometry(this.width,this.height)),m=this.pointCoordinate(new c.pointGeometry(0,this.height)),_=Math.floor(Math.min(a.x,h.x,d.x,m.x)),y=Math.floor(Math.max(a.x,h.x,d.x,m.x)),b=1;for(let S=_-b;S<=y+b;S++)S!==0&&n.push(new c.UnwrappedTileID(S,t))}return n}coveringTiles(t){var n,a;let h=this.coveringZoomLevel(t);const d=h;if(t.minzoom!==void 0&&h<t.minzoom)return[];t.maxzoom!==void 0&&h>t.maxzoom&&(h=t.maxzoom);const m=this.pointCoordinate(this.getCameraPoint()),_=c.MercatorCoordinate.fromLngLat(this.center),y=Math.pow(2,h),b=[y*m.x,y*m.y,0],S=[y*_.x,y*_.y,0],E=Sn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,h);let M=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(M=h);const D=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,B=U=>({aabb:new En([U*y,0,0],[(U+1)*y,y,0]),zoom:0,x:0,y:0,wrap:U,fullyVisible:!1}),L=[],N=[],X=h,Z=t.reparseOverscaled?d:h;if(this._renderWorldCopies)for(let U=1;U<=3;U++)L.push(B(-U)),L.push(B(U));for(L.push(B(0));L.length>0;){const U=L.pop(),W=U.x,te=U.y;let se=U.fullyVisible;if(!se){const Ae=U.aabb.intersects(E);if(Ae===0)continue;se=Ae===2}const he=t.terrain?b:S,pe=U.aabb.distanceX(he),Te=U.aabb.distanceY(he),ye=Math.max(Math.abs(pe),Math.abs(Te));if(U.zoom===X||ye>D+(1<<X-U.zoom)-2&&U.zoom>=M){const Ae=X-U.zoom,je=b[0]-.5-(W<<Ae),rt=b[1]-.5-(te<<Ae);N.push({tileID:new c.OverscaledTileID(U.zoom===X?Z:U.zoom,U.wrap,U.zoom,W,te),distanceSq:c.sqrLen([S[0]-.5-W,S[1]-.5-te]),tileDistanceToCamera:Math.sqrt(je*je+rt*rt)})}else for(let Ae=0;Ae<4;Ae++){const je=(W<<1)+Ae%2,rt=(te<<1)+(Ae>>1),nt=U.zoom+1;let He=U.aabb.quadrant(Ae);if(t.terrain){const Pt=new c.OverscaledTileID(nt,U.wrap,nt,je,rt),St=t.terrain.getMinMaxElevation(Pt),ft=(n=St.minElevation)!==null&&n!==void 0?n:this.elevation,xt=(a=St.maxElevation)!==null&&a!==void 0?a:this.elevation;He=new En([He.min[0],He.min[1],ft],[He.max[0],He.max[1],xt])}L.push({aabb:He,zoom:nt,x:je,y:rt,wrap:U.wrap,fullyVisible:se})}}return N.sort((U,W)=>U.distanceSq-W.distanceSq).map(U=>U.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const n=c.clamp(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new c.pointGeometry(c.mercatorXfromLng(t.lng)*this.worldSize,c.mercatorYfromLat(n)*this.worldSize)}unproject(t){return new c.MercatorCoordinate(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(t){this.freezeElevation||(this.elevation=t?this.getElevation(this._center,t):0)}getElevation(t,n){const a=c.MercatorCoordinate.fromLngLat(t),h=(1<<this.tileZoom)*c.EXTENT,d=a.x*h,m=a.y*h,_=Math.floor(d/c.EXTENT),y=Math.floor(m/c.EXTENT),b=new c.OverscaledTileID(this.tileZoom,0,this.tileZoom,_,y);return n.getElevation(b,d%c.EXTENT,m%c.EXTENT,c.EXTENT)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const n=this.pointLocation(this.centerPoint,t),a=this.getElevation(n,t);if(!(this.elevation-a))return;const h=this.getCameraPosition(),d=c.MercatorCoordinate.fromLngLat(h.lngLat,h.altitude),m=c.MercatorCoordinate.fromLngLat(n,a),_=d.x-m.x,y=d.y-m.y,b=d.z-m.z,S=Math.sqrt(_*_+y*y+b*b),E=this.scaleZoom(this.cameraToCenterDistance/S/this.tileSize);this._elevation=a,this._center=n,this.zoom=E}setLocationAtPoint(t,n){const a=this.pointCoordinate(n),h=this.pointCoordinate(this.centerPoint),d=this.locationCoordinate(t),m=new c.MercatorCoordinate(d.x-(a.x-h.x),d.y-(a.y-h.y));this.center=this.coordinateLocation(m),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,n){return n?this.coordinatePoint(this.locationCoordinate(t),this.getElevation(t,n),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,n){return this.coordinateLocation(this.pointCoordinate(t,n))}locationCoordinate(t){return c.MercatorCoordinate.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,n){if(n){const M=n.pointCoordinate(t);if(M!=null)return M}const a=[t.x,t.y,0,1],h=[t.x,t.y,1,1];c.transformMat4(a,a,this.pixelMatrixInverse),c.transformMat4(h,h,this.pixelMatrixInverse);const d=a[3],m=h[3],_=a[1]/d,y=h[1]/m,b=a[2]/d,S=h[2]/m,E=b===S?0:(0-b)/(S-b);return new c.MercatorCoordinate(c.number(a[0]/d,h[0]/m,E)/this.worldSize,c.number(_,y,E)/this.worldSize)}coordinatePoint(t,n=0,a=this.pixelMatrix){const h=[t.x*this.worldSize,t.y*this.worldSize,n,1];return c.transformMat4(h,h,a),new c.pointGeometry(h[0]/h[3],h[1]/h[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new c.LngLatBounds().extend(this.pointLocation(new c.pointGeometry(0,t))).extend(this.pointLocation(new c.pointGeometry(this.width,t))).extend(this.pointLocation(new c.pointGeometry(this.width,this.height))).extend(this.pointLocation(new c.pointGeometry(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new c.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(t,n=!1){const a=t.key,h=n?this._alignedPosMatrixCache:this._posMatrixCache;if(h[a])return h[a];const d=t.canonical,m=this.worldSize/this.zoomScale(d.z),_=d.x+Math.pow(2,d.z)*t.wrap,y=c.identity(new Float64Array(16));return c.translate(y,y,[_*m,d.y*m,0]),c.scale(y,y,[m/c.EXTENT,m/c.EXTENT,1]),c.multiply(y,n?this.alignedProjMatrix:this.projMatrix,y),h[a]=new Float32Array(y),h[a]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t,n,a,h,d=-90,m=90,_=-180,y=180;const b=this.size,S=this._unmodified;if(this.latRange){const D=this.latRange;d=c.mercatorYfromLat(D[1])*this.worldSize,m=c.mercatorYfromLat(D[0])*this.worldSize,t=m-d<b.y?b.y/(m-d):0}if(this.lngRange){const D=this.lngRange;_=c.wrap(c.mercatorXfromLng(D[0])*this.worldSize,0,this.worldSize),y=c.wrap(c.mercatorXfromLng(D[1])*this.worldSize,0,this.worldSize),y<_&&(y+=this.worldSize),n=y-_<b.x?b.x/(y-_):0}const E=this.point,M=Math.max(n||0,t||0);if(M)return this.center=this.unproject(new c.pointGeometry(n?(y+_)/2:E.x,t?(m+d)/2:E.y)),this.zoom+=this.scaleZoom(M),this._unmodified=S,void(this._constraining=!1);if(this.latRange){const D=E.y,B=b.y/2;D-B<d&&(h=d+B),D+B>m&&(h=m-B)}if(this.lngRange){const D=(_+y)/2,B=c.wrap(E.x,D-this.worldSize/2,D+this.worldSize/2),L=b.x/2;B-L<_&&(a=_+L),B+L>y&&(a=y-L)}a===void 0&&h===void 0||(this.center=this.unproject(new c.pointGeometry(a!==void 0?a:E.x,h!==void 0?h:E.y)).wrap()),this._unmodified=S,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,a=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=c.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let h=c.identity(new Float64Array(16));c.scale(h,h,[this.width/2,-this.height/2,1]),c.translate(h,h,[1,-1,0]),this.labelPlaneMatrix=h,h=c.identity(new Float64Array(16)),c.scale(h,h,[1,-1,1]),c.translate(h,h,[-1,-1,0]),c.scale(h,h,[2/this.width,2/this.height,1]),this.glCoordMatrix=h,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);const d=this._elevation<0?this.cameraToCenterDistance:this.cameraToSeaLevelDistance,m=Math.PI/2+this._pitch,_=this._fov*(.5+t.y/this.height),y=Math.sin(_)*d/Math.sin(c.clamp(Math.PI-m-_,.01,Math.PI-.01)),b=this.getHorizon(),S=2*Math.atan(b/this.cameraToCenterDistance)*(.5+t.y/(2*b)),E=Math.sin(S)*d/Math.sin(c.clamp(Math.PI-m-S,.01,Math.PI-.01)),M=Math.min(y,E),D=1.01*(Math.cos(Math.PI/2-this._pitch)*M+d),B=this.height/50;h=new Float64Array(16),c.perspective(h,this._fov,this.width/this.height,B,D),h[8]=2*-t.x/this.width,h[9]=2*t.y/this.height,c.scale(h,h,[1,-1,1]),c.translate(h,h,[0,0,-this.cameraToCenterDistance]),c.rotateX(h,h,this._pitch),c.rotateZ(h,h,this.angle),c.translate(h,h,[-n,-a,0]),this.mercatorMatrix=c.scale([],h,[this.worldSize,this.worldSize,this.worldSize]),c.scale(h,h,[1,1,this._pixelPerMeter]),this.pixelMatrix=c.multiply(new Float64Array(16),this.labelPlaneMatrix,h),c.translate(h,h,[0,0,-this.elevation]),this.projMatrix=h,this.invProjMatrix=c.invert([],h),this.pixelMatrix3D=c.multiply(new Float64Array(16),this.labelPlaneMatrix,h);const L=this.width%2/2,N=this.height%2/2,X=Math.cos(this.angle),Z=Math.sin(this.angle),U=n-Math.round(n)+X*L+Z*N,W=a-Math.round(a)+X*N+Z*L,te=new Float64Array(h);if(c.translate(te,te,[U>.5?U-1:U,W>.5?W-1:W,0]),this.alignedProjMatrix=te,h=c.invert(new Float64Array(16),this.pixelMatrix),!h)throw new Error("failed to invert matrix");this.pixelMatrixInverse=h,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new c.pointGeometry(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return c.transformMat4(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new c.pointGeometry(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let a=n.x,h=n.y,d=n.x,m=n.y;for(const _ of t)a=Math.min(a,_.x),h=Math.min(h,_.y),d=Math.max(d,_.x),m=Math.max(m,_.y);return[new c.pointGeometry(a,h),new c.pointGeometry(d,h),new c.pointGeometry(d,m),new c.pointGeometry(a,m),new c.pointGeometry(a,h)]}}}class qs{constructor(t){this._hashName=t&&encodeURIComponent(t),c.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(n,a){let h=!1,d=null;const m=()=>{d=null,h&&(n(),d=setTimeout(m,300),h=!1)};return()=>(h=!0,d||m(),d)}(this._updateHashUnthrottled.bind(this))}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){const n=this._map.getCenter(),a=Math.round(100*this._map.getZoom())/100,h=Math.ceil((a*Math.LN2+Math.log(512/360/.5))/Math.LN10),d=Math.pow(10,h),m=Math.round(n.lng*d)/d,_=Math.round(n.lat*d)/d,y=this._map.getBearing(),b=this._map.getPitch();let S="";if(S+=t?`/${m}/${_}/${a}`:`${a}/${_}/${m}`,(y||b)&&(S+="/"+Math.round(10*y)/10),b&&(S+=`/${Math.round(b)}`),this._hashName){const E=this._hashName;let M=!1;const D=window.location.hash.slice(1).split("&").map(B=>{const L=B.split("=")[0];return L===E?(M=!0,`${L}=${S}`):B}).filter(B=>B);return M||D.push(`${E}=${S}`),`#${D.join("&")}`}return`#${S}`}_getCurrentHash(){const t=window.location.hash.replace("#","");if(this._hashName){let n;return t.split("&").map(a=>a.split("=")).forEach(a=>{a[0]===this._hashName&&(n=a)}),(n&&n[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._getCurrentHash();if(t.length>=3&&!t.some(n=>isNaN(n))){const n=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:n,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){const t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t)}catch{}}}const In={linearity:.3,easing:c.bezier(0,0,.3,1)},Ko=c.extend({deceleration:2500,maxSpeed:1400},In),Jo=c.extend({deceleration:20,maxSpeed:1400},In),Yo=c.extend({deceleration:1e3,maxSpeed:360},In),Qo=c.extend({deceleration:1e3,maxSpeed:90},In);class el{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:c.exported.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=c.exported.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new c.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:d}of this._inertiaBuffer)n.zoom+=d.zoomDelta||0,n.bearing+=d.bearingDelta||0,n.pitch+=d.pitchDelta||0,d.panDelta&&n.pan._add(d.panDelta),d.around&&(n.around=d.around),d.pinchAround&&(n.pinchAround=d.pinchAround);const a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,h={};if(n.pan.mag()){const d=ns(n.pan.mag(),a,c.extend({},Ko,t||{}));h.offset=n.pan.mult(d.amount/n.pan.mag()),h.center=this._map.transform.center,gr(h,d)}if(n.zoom){const d=ns(n.zoom,a,Jo);h.zoom=this._map.transform.zoom+d.amount,gr(h,d)}if(n.bearing){const d=ns(n.bearing,a,Yo);h.bearing=this._map.transform.bearing+c.clamp(d.amount,-179,179),gr(h,d)}if(n.pitch){const d=ns(n.pitch,a,Qo);h.pitch=this._map.transform.pitch+d.amount,gr(h,d)}if(h.zoom||h.bearing){const d=n.pinchAround===void 0?n.around:n.pinchAround;h.around=d?this._map.unproject(d):this._map.getCenter()}return this.clear(),c.extend(h,{noMoveStart:!0})}}function gr(o,t){(!o.duration||o.duration<t.duration)&&(o.duration=t.duration,o.easing=t.easing)}function ns(o,t,n){const{maxSpeed:a,linearity:h,deceleration:d}=n,m=c.clamp(o*h/(t/1e3),-a,a),_=Math.abs(m)/(d*h);return{easing:n.easing,duration:1e3*_,amount:m*(_/2)}}class Ni extends c.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a,h={}){const d=K.mousePos(n.getCanvasContainer(),a),m=n.unproject(d);super(t,c.extend({point:d,lngLat:m,originalEvent:a},h)),this._defaultPrevented=!1,this.target=n}}class ss extends c.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a){const h=t==="touchend"?a.changedTouches:a.touches,d=K.touchPos(n.getCanvasContainer(),h),m=d.map(y=>n.unproject(y)),_=d.reduce((y,b,S,E)=>y.add(b.div(E.length)),new c.pointGeometry(0,0));super(t,{points:d,point:_,lngLats:m,lngLat:n.unproject(_),originalEvent:a}),this._defaultPrevented=!1}}class tl extends c.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a){super(t,{originalEvent:a}),this._defaultPrevented=!1}}class il{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new tl(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Ni(t.type,this._map,t))}mouseup(t){this._map.fire(new Ni(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Ni(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Ni(t.type,this._map,t))}mouseover(t){this._map.fire(new Ni(t.type,this._map,t))}mouseout(t){this._map.fire(new Ni(t.type,this._map,t))}touchstart(t){return this._firePreventable(new ss(t.type,this._map,t))}touchmove(t){this._map.fire(new ss(t.type,this._map,t))}touchend(t){this._map.fire(new ss(t.type,this._map,t))}touchcancel(t){this._map.fire(new ss(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class rl{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Ni(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ni("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Ni(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class as{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(K.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const a=n;if(this._lastPos.equals(a)||!this._box&&a.dist(this._startPos)<this._clickTolerance)return;const h=this._startPos;this._lastPos=a,this._box||(this._box=K.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const d=Math.min(h.x,a.x),m=Math.max(h.x,a.x),_=Math.min(h.y,a.y),y=Math.max(h.y,a.y);K.setTransform(this._box,`translate(${d}px,${_}px)`),this._box.style.width=m-d+"px",this._box.style.height=y-_+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const a=this._startPos,h=n;if(this.reset(),K.suppressClick(),a.x!==h.x||a.y!==h.y)return this._map.fire(new c.Event("boxzoomend",{originalEvent:t})),{cameraAnimation:d=>d.fitScreenCoordinates(a,h,this._map.getBearing(),{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(K.remove(this._box),this._box=null),K.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new c.Event(t,{originalEvent:n}))}}function Zs(o,t){if(o.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${o.length}, points ${t.length}`);const n={};for(let a=0;a<o.length;a++)n[o[a].identifier]=t[a];return n}class _r{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,a){(this.centroid||a.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),a.length===this.numTouches&&(this.centroid=function(h){const d=new c.pointGeometry(0,0);for(const m of h)d._add(m);return d.div(h.length)}(n),this.touches=Zs(a,n)))}touchmove(t,n,a){if(this.aborted||!this.centroid)return;const h=Zs(a,n);for(const d in this.touches){const m=h[d];(!m||m.dist(this.touches[d])>30)&&(this.aborted=!0)}}touchend(t,n,a){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),a.length===0){const h=!this.aborted&&this.centroid;if(this.reset(),h)return h}}}class or{constructor(t){this.singleTap=new _r(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,a){this.singleTap.touchstart(t,n,a)}touchmove(t,n,a){this.singleTap.touchmove(t,n,a)}touchend(t,n,a){const h=this.singleTap.touchend(t,n,a);if(h){const d=t.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(h)<30;if(d&&m||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=h,this.count===this.numTaps)return this.reset(),h}}}class nl{constructor(){this._zoomIn=new or({numTouches:1,numTaps:2}),this._zoomOut=new or({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,a){this._zoomIn.touchstart(t,n,a),this._zoomOut.touchstart(t,n,a)}touchmove(t,n,a){this._zoomIn.touchmove(t,n,a),this._zoomOut.touchmove(t,n,a)}touchend(t,n,a){const h=this._zoomIn.touchend(t,n,a),d=this._zoomOut.touchend(t,n,a);return h?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:m=>m.easeTo({duration:300,zoom:m.getZoom()+1,around:m.unproject(h)},{originalEvent:t})}):d?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:m=>m.easeTo({duration:300,zoom:m.getZoom()-1,around:m.unproject(d)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class $i{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const n=this._moveFunction(...t);if(n.bearingDelta||n.pitchDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(t,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=n.length?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,n){if(!this.isEnabled())return;const a=this._lastPoint;if(!a)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const h=n.length?n[0]:n;return!this._moved&&h.dist(a)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=h,this._move(a,h))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&K.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const os={0:1,2:2};class Ra{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const n=K.mouseButton(t);this._eventButton=n}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!function(n,a){const h=os[a];return n.buttons===void 0||(n.buttons&h)!==h}(t,this._eventButton)}isValidEndEvent(t){return K.mouseButton(t)===this._eventButton}}class sl{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return t.targetTouches.length===1}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}const Ba=o=>{o.mousedown=o.dragStart,o.mousemoveWindow=o.dragMove,o.mouseup=o.dragEnd,o.contextmenu=function(t){t.preventDefault()}},Fa=({enable:o,clickTolerance:t,bearingDegreesPerPixelMoved:n=.8})=>{const a=new Ra({checkCorrectEvent:h=>K.mouseButton(h)===0&&h.ctrlKey||K.mouseButton(h)===2});return new $i({clickTolerance:t,move:(h,d)=>({bearingDelta:(d.x-h.x)*n}),moveStateManager:a,enable:o,assignEvents:Ba})},An=({enable:o,clickTolerance:t,pitchDegreesPerPixelMoved:n=-.5})=>{const a=new Ra({checkCorrectEvent:h=>K.mouseButton(h)===0&&h.ctrlKey||K.mouseButton(h)===2});return new $i({clickTolerance:t,move:(h,d)=>({pitchDelta:(d.y-h.y)*n}),moveStateManager:a,enable:o,assignEvents:Ba})};class $r{constructor(t,n){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new c.pointGeometry(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(t,n,a){return this._calculateTransform(t,n,a)}touchmove(t,n,a){if(this._map._cooperativeGestures&&(this._minTouches===2&&a.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,a.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(a.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,n,a)}touchend(t,n,a){this._calculateTransform(t,n,a),this._active&&a.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,a){a.length>0&&(this._active=!0);const h=Zs(a,n),d=new c.pointGeometry(0,0),m=new c.pointGeometry(0,0);let _=0;for(const b in h){const S=h[b],E=this._touches[b];E&&(d._add(S),m._add(S.sub(E)),_++,h[b]=S)}if(this._touches=h,_<this._minTouches||!m.mag())return;const y=m.div(_);return this._sum._add(y),this._sum.mag()<this._clickTolerance?void 0:{around:d.div(_),panDelta:y}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class $e{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(t){}_move(t,n,a){return{}}touchstart(t,n,a){this._firstTwoTouches||a.length<2||(this._firstTwoTouches=[a[0].identifier,a[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,a){if(!this._firstTwoTouches)return;t.preventDefault();const[h,d]=this._firstTwoTouches,m=ls(a,n,h),_=ls(a,n,d);if(!m||!_)return;const y=this._aroundCenter?null:m.add(_).div(2);return this._move([m,_],y,t)}touchend(t,n,a){if(!this._firstTwoTouches)return;const[h,d]=this._firstTwoTouches,m=ls(a,n,h),_=ls(a,n,d);m&&_||(this._active&&K.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function ls(o,t,n){for(let a=0;a<o.length;a++)if(o[a].identifier===n)return t[a]}function Cn(o,t){return Math.log(o/t)/Math.LN2}class cs extends $e{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const a=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Cn(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Cn(this._distance,a),pinchAround:n}}}function Oa(o,t){return 180*o.angleWith(t)/Math.PI}class Oe extends $e{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,n){const a=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Oa(this._vector,a),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,a=Oa(t,this._startVector);return Math.abs(a)<n}}function hs(o){return Math.abs(o.y)>Math.abs(o.x)}class lc extends $e{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,a){super.touchstart(t,n,a),this._currentTouchCount=a.length}_start(t){this._lastPoints=t,hs(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,a){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const h=t[0].sub(this._lastPoints[0]),d=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(h,d,a.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(h.y+d.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,a){if(this._valid!==void 0)return this._valid;const h=t.mag()>=2,d=n.mag()>=2;if(!h&&!d)return;if(!h||!d)return this._firstMove===void 0&&(this._firstMove=a),a-this._firstMove<100&&void 0;const m=t.y>0==n.y>0;return hs(t)&&hs(n)&&m}}const cc={panStep:100,bearingStep:15,pitchStep:10};class Ua{constructor(){const t=cc;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,a=0,h=0,d=0,m=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?a=-1:(t.preventDefault(),d=-1);break;case 39:t.shiftKey?a=1:(t.preventDefault(),d=1);break;case 38:t.shiftKey?h=1:(t.preventDefault(),m=-1);break;case 40:t.shiftKey?h=-1:(t.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(a=0,h=0),{cameraAnimation:_=>{const y=_.getZoom();_.easeTo({duration:300,easeId:"keyboardHandler",easing:al,zoom:n?Math.round(y)+n*(t.shiftKey?2:1):y,bearing:_.getBearing()+a*this._bearingStep,pitch:_.getPitch()+h*this._pitchStep,offset:[-d*this._panStep,-m*this._panStep],center:_.getCenter()},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function al(o){return o*(2-o)}const Va=4.000244140625;class hc{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,c.bindAll(["_onTimeout"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!this._map._metaPress)return;t.preventDefault()}let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const a=c.exported.now(),h=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,n!==0&&n%Va==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":h>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(h*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=K.mousePos(this._el,t);this._around=c.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(n)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._map.transform;if(this._delta!==0){const _=this._type==="wheel"&&Math.abs(this._delta)>Va?this._wheelZoomRate:this._defaultZoomRate;let y=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&y!==0&&(y=1/y);const b=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(b*y))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,a=this._startZoom,h=this._easing;let d,m=!1;if(this._type==="wheel"&&a&&h){const _=Math.min((c.exported.now()-this._lastWheelEventTime)/200,1),y=h(_);d=c.number(a,n,y),_<1?this._frameId||(this._frameId=!0):m=!0}else d=n,m=!0;return this._active=!0,m&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!m,zoomDelta:d-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=c.ease;if(this._prevEase){const a=this._prevEase,h=(c.exported.now()-a.start)/a.duration,d=a.easing(h+.01)-a.easing(h),m=.27/Math.sqrt(d*d+1e-4)*.01,_=Math.sqrt(.0729-m*m);n=c.bezier(m,_,.25,1)}return this._prevEase={start:c.exported.now(),duration:t,easing:n},n}reset(){this._active=!1}}class uc{constructor(t,n){this._clickZoom=t,this._tapZoom=n}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Na{constructor(){this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:a=>{a.easeTo({duration:300,zoom:a.getZoom()+(t.shiftKey?-1:1),around:a.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class $a{constructor(){this._tap=new or({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(t,n,a){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?a.length>0&&(this._swipePoint=n[0],this._swipeTouch=a[0].identifier):this._tap.touchstart(t,n,a))}touchmove(t,n,a){if(this._tapTime){if(this._swipePoint){if(a[0].identifier!==this._swipeTouch)return;const h=n[0],d=h.y-this._swipePoint.y;return this._swipePoint=h,t.preventDefault(),this._active=!0,{zoomDelta:d/128}}}else this._tap.touchmove(t,n,a)}touchend(t,n,a){this._tapTime?this._swipePoint&&a.length===0&&this.reset():this._tap.touchend(t,n,a)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ga{constructor(t,n,a){this._el=t,this._mousePan=n,this._touchPan=a}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class ja{constructor(t,n,a){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,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 Li{constructor(t,n,a,h){this._el=t,this._touchZoom=n,this._touchRotate=a,this._tapDragZoom=h,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const lr=o=>o.zoom||o.drag||o.pitch||o.rotate;class ol extends c.Event{}function us(o){return o.panDelta&&o.panDelta.mag()||o.zoomDelta||o.bearingDelta||o.pitchDelta}class qa{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new el(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),c.bindAll(["handleEvent","handleWindowEvent"],this);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[h,d,m]of this._listeners)K.addEventListener(h,d,h===document?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(const[t,n,a]of this._listeners)K.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,a)}_addDefaultHandlers(t){const n=this._map,a=n.getCanvasContainer();this._add("mapEvent",new il(n,t));const h=n.boxZoom=new as(n,t);this._add("boxZoom",h);const d=new nl,m=new Na;n.doubleClickZoom=new uc(m,d),this._add("tapZoom",d),this._add("clickZoom",m);const _=new $a;this._add("tapDragZoom",_);const y=n.touchPitch=new lc(n);this._add("touchPitch",y);const b=Fa(t),S=An(t);n.dragRotate=new ja(t,b,S),this._add("mouseRotate",b,["mousePitch"]),this._add("mousePitch",S,["mouseRotate"]);const E=(({enable:X,clickTolerance:Z})=>{const U=new Ra({checkCorrectEvent:W=>K.mouseButton(W)===0&&!W.ctrlKey});return new $i({clickTolerance:Z,move:(W,te)=>({around:te,panDelta:te.sub(W)}),activateOnStart:!0,moveStateManager:U,enable:X,assignEvents:Ba})})(t),M=new $r(t,n);n.dragPan=new Ga(a,E,M),this._add("mousePan",E),this._add("touchPan",M,["touchZoom","touchRotate"]);const D=new Oe,B=new cs;n.touchZoomRotate=new Li(a,B,D,_),this._add("touchRotate",D,["touchPan","touchZoom"]),this._add("touchZoom",B,["touchPan","touchRotate"]);const L=n.scrollZoom=new hc(n,this);this._add("scrollZoom",L,["mousePan"]);const N=n.keyboard=new Ua;this._add("keyboard",N),this._add("blockableMapEvent",new rl(n));for(const X of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[X]&&n[X].enable(t[X])}_add(t,n,a){this._handlers.push({handlerName:t,handler:n,allowed:a}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(lr(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,n,a){for(const h in t)if(h!==a&&(!n||n.indexOf(h)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const n=[];for(const a of t)this._el.contains(a.target)&&n.push(a);return n}handleEvent(t,n){if(t.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const a=t.type==="renderFrame"?void 0:t,h={needsRenderFrame:!1},d={},m={},_=t.touches,y=_?this._getMapTouches(_):void 0,b=y?K.touchPos(this._el,y):K.mousePos(this._el,t);for(const{handlerName:M,handler:D,allowed:B}of this._handlers){if(!D.isEnabled())continue;let L;this._blockedByActive(m,B,M)?D.reset():D[n||t.type]&&(L=D[n||t.type](t,b,y),this.mergeHandlerResult(h,d,L,M,a),L&&L.needsRenderFrame&&this._triggerRenderFrame()),(L||D.isActive())&&(m[M]=D)}const S={};for(const M in this._previousActiveHandlers)m[M]||(S[M]=a);this._previousActiveHandlers=m,(Object.keys(S).length||us(h))&&(this._changes.push([h,d,S]),this._triggerRenderFrame()),(Object.keys(m).length||us(h))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:E}=h;E&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],E(this._map))}mergeHandlerResult(t,n,a,h,d){if(!a)return;c.extend(t,a);const m={handlerName:h,originalEvent:a.originalEvent||d};a.zoomDelta!==void 0&&(n.zoom=m),a.panDelta!==void 0&&(n.drag=m),a.pitchDelta!==void 0&&(n.pitch=m),a.bearingDelta!==void 0&&(n.rotate=m)}_applyChanges(){const t={},n={},a={};for(const[h,d,m]of this._changes)h.panDelta&&(t.panDelta=(t.panDelta||new c.pointGeometry(0,0))._add(h.panDelta)),h.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+h.zoomDelta),h.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+h.bearingDelta),h.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+h.pitchDelta),h.around!==void 0&&(t.around=h.around),h.pinchAround!==void 0&&(t.pinchAround=h.pinchAround),h.noInertia&&(t.noInertia=h.noInertia),c.extend(n,d),c.extend(a,m);this._updateMapTransform(t,n,a),this._changes=[]}_updateMapTransform(t,n,a){const h=this._map,d=h.transform,m=h.terrain;if(!(us(t)||m&&this._terrainMovement))return this._fireEvents(n,a,!0);let{panDelta:_,zoomDelta:y,bearingDelta:b,pitchDelta:S,around:E,pinchAround:M}=t;M!==void 0&&(E=M),h._stop(!0),E=E||h.transform.centerPoint;const D=d.pointLocation(_?E.sub(_):E);b&&(d.bearing+=b),S&&(d.pitch+=S),y&&(d.zoom+=y),m?this._terrainMovement||!n.drag&&!n.zoom?n.drag&&this._terrainMovement?d.center=d.pointLocation(d.centerPoint.sub(_)):d.setLocationAtPoint(D,E):(this._terrainMovement=!0,d.freezeElevation=!0,d.setLocationAtPoint(D,E),this._map.once("moveend",()=>{d.freezeElevation=!1,this._terrainMovement=!1,d.recalculateZoom(h.terrain)})):d.setLocationAtPoint(D,E),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,a,!0)}_fireEvents(t,n,a){const h=lr(this._eventsInProgress),d=lr(t),m={};for(const S in t){const{originalEvent:E}=t[S];this._eventsInProgress[S]||(m[`${S}start`]=E),this._eventsInProgress[S]=t[S]}!h&&d&&this._fireEvent("movestart",d.originalEvent);for(const S in m)this._fireEvent(S,m[S]);d&&this._fireEvent("move",d.originalEvent);for(const S in t){const{originalEvent:E}=t[S];this._fireEvent(S,E)}const _={};let y;for(const S in this._eventsInProgress){const{handlerName:E,originalEvent:M}=this._eventsInProgress[S];this._handlersById[E].isActive()||(delete this._eventsInProgress[S],y=n[E]||M,_[`${S}end`]=y)}for(const S in _)this._fireEvent(S,_[S]);const b=lr(this._eventsInProgress);if(a&&(h||d)&&!b){this._updatingCamera=!0;const S=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),E=M=>M!==0&&-this._bearingSnap<M&&M<this._bearingSnap;S?(E(S.bearing||this._map.getBearing())&&(S.bearing=0),S.freezeElevation=!0,this._map.easeTo(S,{originalEvent:y})):(this._map.fire(new c.Event("moveend",{originalEvent:y})),E(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new c.Event(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new ol("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Za={extend:(o,...t)=>c.extend(o,...t),run(o){o()},logToElement(o,t=!1,n="log"){const a=window.document.getElementById(n);a&&(t&&(a.innerHTML=""),a.innerHTML+=`<br>${o}`)}};class ll extends c.Evented{constructor(t,n){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,c.bindAll(["_renderFrameCallback"],this)}getCenter(){return new c.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,a){return t=c.pointGeometry.convert(t).mult(-1),this.panTo(this.transform.center,c.extend({offset:t},n),a)}panTo(t,n,a){return this.easeTo(c.extend({center:t},n),a)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,a){return this.easeTo(c.extend({zoom:t},n),a)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,a){return this.easeTo(c.extend({bearing:t},n),a)}resetNorth(t,n){return this.rotateTo(0,c.extend({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(c.extend({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}cameraForBounds(t,n){t=c.LngLatBounds.convert(t);const a=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),a,n)}_cameraForBoxAndBearing(t,n,a,h){const d={top:0,bottom:0,right:0,left:0};if(typeof(h=c.extend({padding:d,offset:[0,0],maxZoom:this.transform.maxZoom},h)).padding=="number"){const te=h.padding;h.padding={top:te,bottom:te,right:te,left:te}}h.padding=c.extend(d,h.padding);const m=this.transform,_=m.padding,y=m.project(c.LngLat.convert(t)),b=m.project(c.LngLat.convert(n)),S=y.rotate(-a*Math.PI/180),E=b.rotate(-a*Math.PI/180),M=new c.pointGeometry(Math.max(S.x,E.x),Math.max(S.y,E.y)),D=new c.pointGeometry(Math.min(S.x,E.x),Math.min(S.y,E.y)),B=M.sub(D),L=(m.width-(_.left+_.right+h.padding.left+h.padding.right))/B.x,N=(m.height-(_.top+_.bottom+h.padding.top+h.padding.bottom))/B.y;if(N<0||L<0)return void c.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const X=Math.min(m.scaleZoom(m.scale*Math.min(L,N)),h.maxZoom),Z=c.pointGeometry.convert(h.offset),U=new c.pointGeometry((h.padding.left-h.padding.right)/2,(h.padding.top-h.padding.bottom)/2).rotate(a*Math.PI/180),W=Z.add(U).mult(m.scale/m.zoomScale(X));return{center:m.unproject(y.add(b).div(2).sub(W)),zoom:X,bearing:a}}fitBounds(t,n,a){return this._fitInternal(this.cameraForBounds(t,n),n,a)}fitScreenCoordinates(t,n,a,h,d){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(c.pointGeometry.convert(t)),this.transform.pointLocation(c.pointGeometry.convert(n)),a,h),h,d)}_fitInternal(t,n,a){return t?(delete(n=c.extend(t,n)).padding,n.linear?this.easeTo(n,a):this.flyTo(n,a)):this}jumpTo(t,n){this.stop();const a=this.transform;let h=!1,d=!1,m=!1;return"zoom"in t&&a.zoom!==+t.zoom&&(h=!0,a.zoom=+t.zoom),t.center!==void 0&&(a.center=c.LngLat.convert(t.center)),"bearing"in t&&a.bearing!==+t.bearing&&(d=!0,a.bearing=+t.bearing),"pitch"in t&&a.pitch!==+t.pitch&&(m=!0,a.pitch=+t.pitch),t.padding==null||a.isPaddingEqual(t.padding)||(a.padding=t.padding),this.fire(new c.Event("movestart",n)).fire(new c.Event("move",n)),h&&this.fire(new c.Event("zoomstart",n)).fire(new c.Event("zoom",n)).fire(new c.Event("zoomend",n)),d&&this.fire(new c.Event("rotatestart",n)).fire(new c.Event("rotate",n)).fire(new c.Event("rotateend",n)),m&&this.fire(new c.Event("pitchstart",n)).fire(new c.Event("pitch",n)).fire(new c.Event("pitchend",n)),this.fire(new c.Event("moveend",n))}calculateCameraOptionsFromTo(t,n,a,h=0){const d=c.MercatorCoordinate.fromLngLat(t,n),m=c.MercatorCoordinate.fromLngLat(a,h),_=m.x-d.x,y=m.y-d.y,b=m.z-d.z,S=Math.hypot(_,y,b);if(S===0)throw new Error("Can't calculate camera options with same From and To");const E=Math.hypot(_,y),M=this.transform.scaleZoom(this.transform.cameraToCenterDistance/S/this.transform.tileSize),D=180*Math.atan2(_,-y)/Math.PI;let B=180*Math.acos(E/S)/Math.PI;return B=b<0?90-B:90+B,{center:m.toLngLat(),zoom:M,pitch:B,bearing:D}}easeTo(t,n){this._stop(!1,t.easeId),((t=c.extend({offset:[0,0],duration:500,easing:c.ease},t)).animate===!1||!t.essential&&c.exported.prefersReducedMotion)&&(t.duration=0);const a=this.transform,h=this.getZoom(),d=this.getBearing(),m=this.getPitch(),_=this.getPadding(),y="zoom"in t?+t.zoom:h,b="bearing"in t?this._normalizeBearing(t.bearing,d):d,S="pitch"in t?+t.pitch:m,E="padding"in t?t.padding:a.padding,M=c.pointGeometry.convert(t.offset);let D=a.centerPoint.add(M);const B=a.pointLocation(D),L=c.LngLat.convert(t.center||B);this._normalizeCenter(L);const N=a.project(B),X=a.project(L).sub(N),Z=a.zoomScale(y-h);let U,W;t.around&&(U=c.LngLat.convert(t.around),W=a.locationPoint(U));const te={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||y!==h,this._rotating=this._rotating||d!==b,this._pitching=this._pitching||S!==m,this._padding=!a.isPaddingEqual(E),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,te),this.terrain&&this._prepareElevation(L),this._ease(se=>{if(this._zooming&&(a.zoom=c.number(h,y,se)),this._rotating&&(a.bearing=c.number(d,b,se)),this._pitching&&(a.pitch=c.number(m,S,se)),this._padding&&(a.interpolatePadding(_,E,se),D=a.centerPoint.add(M)),this.terrain&&!t.freezeElevation&&this._updateElevation(se),U)a.setLocationAtPoint(U,W);else{const he=a.zoomScale(a.zoom-h),pe=y>h?Math.min(2,Z):Math.max(.5,Z),Te=Math.pow(pe,1-se),ye=a.unproject(N.add(X.mult(se*Te)).mult(he));a.setLocationAtPoint(a.renderWorldCopies?ye.wrap():ye,D)}this._fireMoveEvents(n)},se=>{this.terrain&&this._finalizeElevation(),this._afterEase(n,se)},t),this}_prepareEase(t,n,a={}){this._moving=!0,n||a.moving||this.fire(new c.Event("movestart",t)),this._zooming&&!a.zooming&&this.fire(new c.Event("zoomstart",t)),this._rotating&&!a.rotating&&this.fire(new c.Event("rotatestart",t)),this._pitching&&!a.pitching&&this.fire(new c.Event("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.transform.getElevation(t,this.terrain),this.transform.freezeElevation=!0}_updateElevation(t){const n=this.transform.getElevation(this._elevationCenter,this.terrain);if(t<1&&n!==this._elevationTarget){const a=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(a-(n-(a*t+this._elevationStart))/(1-t)),this._elevationTarget=n}this.transform.elevation=c.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this.transform.freezeElevation=!1,this.transform.recalculateZoom(this.terrain)}_fireMoveEvents(t){this.fire(new c.Event("move",t)),this._zooming&&this.fire(new c.Event("zoom",t)),this._rotating&&this.fire(new c.Event("rotate",t)),this._pitching&&this.fire(new c.Event("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const a=this._zooming,h=this._rotating,d=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,a&&this.fire(new c.Event("zoomend",t)),h&&this.fire(new c.Event("rotateend",t)),d&&this.fire(new c.Event("pitchend",t)),this.fire(new c.Event("moveend",t))}flyTo(t,n){if(!t.essential&&c.exported.prefersReducedMotion){const He=c.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(He,n)}this.stop(),t=c.extend({offset:[0,0],speed:1.2,curve:1.42,easing:c.ease},t);const a=this.transform,h=this.getZoom(),d=this.getBearing(),m=this.getPitch(),_=this.getPadding(),y="zoom"in t?c.clamp(+t.zoom,a.minZoom,a.maxZoom):h,b="bearing"in t?this._normalizeBearing(t.bearing,d):d,S="pitch"in t?+t.pitch:m,E="padding"in t?t.padding:a.padding,M=a.zoomScale(y-h),D=c.pointGeometry.convert(t.offset);let B=a.centerPoint.add(D);const L=a.pointLocation(B),N=c.LngLat.convert(t.center||L);this._normalizeCenter(N);const X=a.project(L),Z=a.project(N).sub(X);let U=t.curve;const W=Math.max(a.width,a.height),te=W/M,se=Z.mag();if("minZoom"in t){const He=c.clamp(Math.min(t.minZoom,h,y),a.minZoom,a.maxZoom),Pt=W/a.zoomScale(He-h);U=Math.sqrt(Pt/se*2)}const he=U*U;function pe(He){const Pt=(te*te-W*W+(He?-1:1)*he*he*se*se)/(2*(He?te:W)*he*se);return Math.log(Math.sqrt(Pt*Pt+1)-Pt)}function Te(He){return(Math.exp(He)-Math.exp(-He))/2}function ye(He){return(Math.exp(He)+Math.exp(-He))/2}const Ae=pe(0);let je=function(He){return ye(Ae)/ye(Ae+U*He)},rt=function(He){return W*((ye(Ae)*(Te(Pt=Ae+U*He)/ye(Pt))-Te(Ae))/he)/se;var Pt},nt=(pe(1)-Ae)/U;if(Math.abs(se)<1e-6||!isFinite(nt)){if(Math.abs(W-te)<1e-6)return this.easeTo(t,n);const He=te<W?-1:1;nt=Math.abs(Math.log(te/W))/U,rt=function(){return 0},je=function(Pt){return Math.exp(He*U*Pt)}}return t.duration="duration"in t?+t.duration:1e3*nt/("screenSpeed"in t?+t.screenSpeed/U:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=d!==b,this._pitching=S!==m,this._padding=!a.isPaddingEqual(E),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(N),this._ease(He=>{const Pt=He*nt,St=1/je(Pt);a.zoom=He===1?y:h+a.scaleZoom(St),this._rotating&&(a.bearing=c.number(d,b,He)),this._pitching&&(a.pitch=c.number(m,S,He)),this._padding&&(a.interpolatePadding(_,E,He),B=a.centerPoint.add(D)),this.terrain&&!t.freezeElevation&&this._updateElevation(He);const ft=He===1?N:a.unproject(X.add(Z.mult(rt(Pt))).mult(St));a.setLocationAtPoint(a.renderWorldCopies?ft.wrap():ft,B),this._fireMoveEvents(n)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(n)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const a=this._onEaseEnd;delete this._onEaseEnd,a.call(this,n)}if(!t){const a=this.handlers;a&&a.stop(!1)}return this}_ease(t,n,a){a.animate===!1||a.duration===0?(t(1),n()):(this._easeStart=c.exported.now(),this._easeOptions=a,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((c.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,n){t=c.wrap(t,-180,180);const a=Math.abs(t-n);return Math.abs(t-360-n)<a&&(t-=360),Math.abs(t+360-n)<a&&(t+=360),t}_normalizeCenter(t){const n=this.transform;if(!n.renderWorldCopies||n.lngRange)return;const a=t.lng-n.center.lng;t.lng+=a>180?-360:a<-180?360:0}}class Gi{constructor(t={}){this.options=t,c.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=K.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=K.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=K.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(){K.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,n){const a=this._map._getUIString(`AttributionControl.${n}`);t.title=a,t.setAttribute("aria-label",a)}_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")))}_updateData(t){!t||t.sourceDataType!=="metadata"&&t.sourceDataType!=="visibility"&&t.dataType!=="style"&&t.type!=="terrain"||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(h=>typeof h!="string"?"":h)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const h=this._map.style.stylesheet;this.styleOwner=h.owner,this.styleId=h.id}const n=this._map.style.sourceCaches;for(const h in n){const d=n[h];if(d.used||d.usedForTerrain){const m=d.getSource();m.attribution&&t.indexOf(m.attribution)<0&&t.push(m.attribution)}}t=t.filter(h=>String(h).trim()),t.sort((h,d)=>h.length-d.length),t=t.filter((h,d)=>{for(let m=d+1;m<t.length;m++)if(t[m].indexOf(h)>=0)return!1;return!0});const a=t.join(" | ");a!==this._attribHTML&&(this._attribHTML=a,t.length?(this._innerContainer.innerHTML=a,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}_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"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")}}class Nt{constructor(t={}){this.options=t,c.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=K.create("div","maplibregl-ctrl");const n=K.create("a","maplibregl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){K.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){const t=this._container.children;if(t.length){const n=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&n.classList.add("maplibregl-compact"):n.classList.remove("maplibregl-compact")}}}class Xs{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,a=n?this._queue.concat(n):this._queue;for(const h of a)if(h.id===t)return void(h.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const a of n)if(!a.cancelled&&(a.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const Xa={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"};var cl=c.createLayout([{name:"a_pos3d",type:"Int16",components:3}]);class hl extends c.Evented{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];const a={};for(const h of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))a[h.key]=!0,this._renderableTilesKeys.push(h.key),this._tiles[h.key]||(h.posMatrix=new Float64Array(16),c.ortho(h.posMatrix,0,c.EXTENT,0,c.EXTENT,0,1),this._tiles[h.key]=new Sr(h,this.tileSize));for(const h in this._tiles)a[h]||delete this._tiles[h]}freeRtt(t){for(const n in this._tiles){const a=this._tiles[n];(!t||a.tileID.equals(t)||a.tileID.isChildOf(t)||t.isChildOf(a.tileID))&&(a.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const n={};for(const a of this._renderableTilesKeys){const h=this._tiles[a].tileID;if(h.canonical.equals(t.canonical)){const d=t.clone();d.posMatrix=new Float64Array(16),c.ortho(d.posMatrix,0,c.EXTENT,0,c.EXTENT,0,1),n[a]=d}else if(h.canonical.isChildOf(t.canonical)){const d=t.clone();d.posMatrix=new Float64Array(16);const m=h.canonical.z-t.canonical.z,_=h.canonical.x-(h.canonical.x>>m<<m),y=h.canonical.y-(h.canonical.y>>m<<m),b=c.EXTENT>>m;c.ortho(d.posMatrix,0,b,0,b,0,1),c.translate(d.posMatrix,d.posMatrix,[-_*b,-y*b,0]),n[a]=d}else if(t.canonical.isChildOf(h.canonical)){const d=t.clone();d.posMatrix=new Float64Array(16);const m=t.canonical.z-h.canonical.z,_=t.canonical.x-(t.canonical.x>>m<<m),y=t.canonical.y-(t.canonical.y>>m<<m),b=c.EXTENT>>m;c.ortho(d.posMatrix,0,c.EXTENT,0,c.EXTENT,0,1),c.translate(d.posMatrix,d.posMatrix,[_*b,y*b,0]),c.scale(d.posMatrix,d.posMatrix,[1/2**m,1/2**m,0]),n[a]=d}}return n}getSourceTile(t,n){const a=this.sourceCache._source;let h=t.overscaledZ-this.deltaZoom;if(h>a.maxzoom&&(h=a.maxzoom),h<a.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(h).key);let d=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!d||!d.dem)&&n)for(;h>=a.minzoom&&(!d||!d.dem);)d=this.sourceCache.getTileByID(t.scaledTo(h--).key);return d}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(n=>n.timeAdded>=t)}}class ul{constructor(t,n,a){this.painter=t,this.sourceCache=new hl(n),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(t,n,a,h=c.EXTENT){if(!(n>=0&&n<h&&a>=0&&a<h))return 0;let d=0;const m=this.getTerrainData(t);if(m.tile&&m.tile.dem){const _=c.transformMat4$1([],[n/h*c.EXTENT,a/h*c.EXTENT],m.u_terrain_matrix),y=[_[0]*m.tile.dem.dim,_[1]*m.tile.dem.dim],b=[Math.floor(y[0]),Math.floor(y[1])],S=m.tile.dem.get(b[0],b[1]),E=m.tile.dem.get(b[0],b[1]+1),M=m.tile.dem.get(b[0]+1,b[1]),D=m.tile.dem.get(b[0]+1,b[1]+1);d=c.number(c.number(S,E,y[0]-b[0]),c.number(M,D,y[0]-b[0]),y[1]-b[1])}return d}getElevation(t,n,a,h=c.EXTENT){return this.getDEMElevation(t,n,a,h)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const h=this.painter.context,d=new c.RGBAImage({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Rt(h,d,h.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Rt(h,new c.RGBAImage({width:1,height:1}),h.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(h.gl.NEAREST,h.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=c.identity([])}const n=this.sourceCache.getSourceTile(t,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const h=this.painter.context;n.demTexture=this.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new Rt(h,n.dem.getPixels(),h.gl.RGBA,{premultiply:!1}),n.demTexture.bind(h.gl.NEAREST,h.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const a=n&&n+n.tileID.key+t.key;if(a&&!this._demMatrixCache[a]){const h=this.sourceCache.sourceCache._source.maxzoom;let d=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=h?d=t.canonical.z-h:c.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const m=t.canonical.x-(t.canonical.x>>d<<d),_=t.canonical.y-(t.canonical.y>>d<<d),y=c.fromScaling(new Float64Array(16),[1/(c.EXTENT<<d),1/(c.EXTENT<<d),0]);c.translate(y,y,[m*c.EXTENT,_*c.EXTENT,0]),this._demMatrixCache[t.key]={matrix:y,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:a?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:n&&n.dem&&n.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(n&&n.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getFramebuffer(t){const n=this.painter,a=n.width/devicePixelRatio,h=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===a&&this._fbo.height===h||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new Rt(n.context,{width:a,height:h,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new Rt(n.context,{width:a,height:h,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=n.context.createFramebuffer(a,h,!0),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,a,h))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let d=0,m=0;d<this._coordsTextureSize;d++)for(let _=0;_<this._coordsTextureSize;_++,m+=4)n[m+0]=255&_,n[m+1]=255&d,n[m+2]=_>>8<<4|d>>8,n[m+3]=0;const a=new c.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),h=new Rt(t,a,t.gl.RGBA,{premultiply:!1});return h.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=h,h}pointCoordinate(t){const n=new Uint8Array(4),a=this.painter.context,h=a.gl;a.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),h.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,h.RGBA,h.UNSIGNED_BYTE,n),a.bindFramebuffer.set(null);const d=n[0]+(n[2]>>4<<8),m=n[1]+((15&n[2])<<8),_=this.coordsIndex[255-n[3]],y=_&&this.sourceCache.getTileByID(_);if(!y)return null;const b=this._coordsTextureSize,S=(1<<y.tileID.canonical.z)*b;return new c.MercatorCoordinate((y.tileID.canonical.x*b+d)/S,(y.tileID.canonical.y*b+m)/S,this.getElevation(y.tileID,d,m,b))}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.painter.context,n=new c.Pos3dArray,a=new c.TriangleIndexArray,h=this.meshSize,d=c.EXTENT/h,m=h*h;for(let E=0;E<=h;E++)for(let M=0;M<=h;M++)n.emplaceBack(M*d,E*d,0);for(let E=0;E<m;E+=h+1)for(let M=0;M<h;M++)a.emplaceBack(M+E,h+M+E+1,h+M+E+2),a.emplaceBack(M+E,h+M+E+2,M+E+1);const _=n.length,y=_+2*(h+1);for(const E of[0,1])for(let M=0;M<=h;M++)for(const D of[0,1])n.emplaceBack(M*d,E*c.EXTENT,D);for(let E=0;E<2*h;E+=2)a.emplaceBack(y+E,y+E+1,y+E+3),a.emplaceBack(y+E,y+E+3,y+E+2),a.emplaceBack(_+E,_+E+3,_+E+1),a.emplaceBack(_+E,_+E+2,_+E+3);const b=n.length,S=b+2*(h+1);for(const E of[0,1])for(let M=0;M<=h;M++)for(const D of[0,1])n.emplaceBack(E*c.EXTENT,M*d,D);for(let E=0;E<2*h;E+=2)a.emplaceBack(b+E,b+E+1,b+E+3),a.emplaceBack(b+E,b+E+3,b+E+2),a.emplaceBack(S+E,S+E+3,S+E+1),a.emplaceBack(S+E,S+E+2,S+E+3);return this._mesh={indexBuffer:t.createIndexBuffer(a),vertexBuffer:t.createVertexBuffer(n,cl.members),segments:c.SegmentVector.simpleSegment(0,0,n.length,a.length)},this._mesh}getMeshFrameDelta(t){return 2*Math.PI*c.earthRadius/Math.pow(2,t)/5}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,a={minElevation:null,maxElevation:null};return n&&n.dem&&(a.minElevation=n.dem.min*this.exaggeration,a.maxElevation=n.dem.max*this.exaggeration),a}}class dc{constructor(t,n,a){this._context=t,this._size=n,this._tileSize=a,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const n=this._context.createFramebuffer(this._tileSize,this._tileSize,!0),a=new Rt(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),n.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_COMPONENT16,this._tileSize,this._tileSize)),n.colorAttachment.set(a.texture),{id:t,fbo:n,texture:a,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(n=>t.id!==n),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const n of this._recentlyUsed)if(!this._objects[n].inUse)return this._objects[n];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(t=>!t.inUse)===!1}}const Si={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Ws{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new dc(t.context,30,n.sourceCache.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,n){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(a=>!t._layers[a].isHidden(n)),this._coordsDescendingInv={};for(const a in t.sourceCaches){this._coordsDescendingInv[a]={};const h=t.sourceCaches[a].getVisibleCoordinates();for(const d of h){const m=this.terrain.sourceCache.getTerrainCoords(d);for(const _ in m)this._coordsDescendingInv[a][_]||(this._coordsDescendingInv[a][_]=[]),this._coordsDescendingInv[a][_].push(m[_])}}this._coordsDescendingInvStr={};for(const a of t._order){const h=t._layers[a],d=h.source;if(Si[h.type]&&!this._coordsDescendingInvStr[d]){this._coordsDescendingInvStr[d]={};for(const m in this._coordsDescendingInv[d])this._coordsDescendingInvStr[d][m]=this._coordsDescendingInv[d][m].map(_=>_.key).sort().join()}}for(const a of this._renderableTiles)for(const h in this._coordsDescendingInvStr){const d=this._coordsDescendingInvStr[h][a.tileID.key];d&&d!==a.rttCoords[h]&&(a.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const n=t.type,a=this.painter,h=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(Si[n]&&(this._prevType&&Si[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!h))return!0;if(Si[this._prevType]||Si[n]&&h){this._prevType=n;const d=this._stacks.length-1,m=this._stacks[d]||[];for(const _ of this._renderableTiles){if(this.pool.isFull()&&($s(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(_),_.rtt[d]){const b=this.pool.getObjectForId(_.rtt[d].id);if(b.stamp===_.rtt[d].stamp){this.pool.useObject(b);continue}}const y=this.pool.getOrCreateFreeObject();this.pool.useObject(y),this.pool.stampObject(y),_.rtt[d]={id:y.id,stamp:y.stamp},a.context.bindFramebuffer.set(y.fbo.framebuffer),a.context.clear({color:c.Color.transparent});for(let b=0;b<m.length;b++){const S=a.style._layers[m[b]],E=S.source?this._coordsDescendingInv[S.source][_.tileID.key]:[_.tileID];a.context.viewport.set([0,0,y.fbo.width,y.fbo.height]),a._renderTileClippingMasks(S,E),a.renderLayer(a,a.style.sourceCaches[S.source],S,E),S.source&&(_.rttCoords[S.source]=this._coordsDescendingInvStr[S.source][_.tileID.key])}}return $s(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),Si[n]}return!1}}const We=Et,Qe={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,fadeDuration:300,crossSourceCollisions:!0},ds=o=>{o.touchstart=o.dragStart,o.touchmoveWindow=o.dragMove,o.touchend=o.dragEnd},Wa={showCompass:!0,showZoom:!0,visualizePitch:!1};class Ha{constructor(t,n,a=!1){this._clickTolerance=10;const h=t.dragRotate._mouseRotate.getClickTolerance(),d=t.dragRotate._mousePitch.getClickTolerance();this.element=n,this.mouseRotate=Fa({clickTolerance:h,enable:!0}),this.touchRotate=(({enable:m,clickTolerance:_,bearingDegreesPerPixelMoved:y=.8})=>{const b=new sl;return new $i({clickTolerance:_,move:(S,E)=>({bearingDelta:(E.x-S.x)*y}),moveStateManager:b,enable:m,assignEvents:ds})})({clickTolerance:h,enable:!0}),this.map=t,a&&(this.mousePitch=An({clickTolerance:d,enable:!0}),this.touchPitch=(({enable:m,clickTolerance:_,pitchDegreesPerPixelMoved:y=-.5})=>{const b=new sl;return new $i({clickTolerance:_,move:(S,E)=>({pitchDelta:(E.y-S.y)*y}),moveStateManager:b,enable:m,assignEvents:ds})})({clickTolerance:d,enable:!0})),c.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),K.addEventListener(n,"mousedown",this.mousedown),K.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),K.addEventListener(n,"touchcancel",this.reset)}startMouse(t,n){this.mouseRotate.dragStart(t,n),this.mousePitch&&this.mousePitch.dragStart(t,n),K.disableDrag()}startTouch(t,n){this.touchRotate.dragStart(t,n),this.touchPitch&&this.touchPitch.dragStart(t,n),K.disableDrag()}moveMouse(t,n){const a=this.map,{bearingDelta:h}=this.mouseRotate.dragMove(t,n)||{};if(h&&a.setBearing(a.getBearing()+h),this.mousePitch){const{pitchDelta:d}=this.mousePitch.dragMove(t,n)||{};d&&a.setPitch(a.getPitch()+d)}}moveTouch(t,n){const a=this.map,{bearingDelta:h}=this.touchRotate.dragMove(t,n)||{};if(h&&a.setBearing(a.getBearing()+h),this.touchPitch){const{pitchDelta:d}=this.touchPitch.dragMove(t,n)||{};d&&a.setPitch(a.getPitch()+d)}}off(){const t=this.element;K.removeEventListener(t,"mousedown",this.mousedown),K.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),K.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),K.removeEventListener(window,"touchend",this.touchend),K.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){K.enableDrag(),K.removeEventListener(window,"mousemove",this.mousemove),K.removeEventListener(window,"mouseup",this.mouseup),K.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),K.removeEventListener(window,"touchend",this.touchend)}mousedown(t){this.startMouse(c.extend({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),K.mousePos(this.element,t)),K.addEventListener(window,"mousemove",this.mousemove),K.addEventListener(window,"mouseup",this.mouseup)}mousemove(t){this.moveMouse(t,K.mousePos(this.element,t))}mouseup(t){this.mouseRotate.dragEnd(t),this.mousePitch&&this.mousePitch.dragEnd(t),this.offTemp()}touchstart(t){t.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=K.touchPos(this.element,t.targetTouches)[0],this.startTouch(t,this._startPos),K.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),K.addEventListener(window,"touchend",this.touchend))}touchmove(t){t.targetTouches.length!==1?this.reset():(this._lastPos=K.touchPos(this.element,t.targetTouches)[0],this.moveTouch(t,this._lastPos))}touchend(t){t.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()}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()}}function Ei(o,t,n){if(o=new c.LngLat(o.lng,o.lat),t){const a=new c.LngLat(o.lng-360,o.lat),h=new c.LngLat(o.lng+360,o.lat),d=n.locationPoint(o).distSqr(t);n.locationPoint(a).distSqr(t)<d?o=a:n.locationPoint(h).distSqr(t)<d&&(o=h)}for(;Math.abs(o.lng-n.center.lng)>180;){const a=n.locationPoint(o);if(a.x>=0&&a.y>=0&&a.x<=n.width&&a.y<=n.height)break;o.lng>n.center.lng?o.lng-=360:o.lng+=360}return o}const Mn={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 cr(o,t,n){const a=o.classList;for(const h in Mn)a.remove(`maplibregl-${n}-anchor-${h}`);a.add(`maplibregl-${n}-anchor-${t}`)}class Ka extends c.Evented{constructor(t,n){if(super(),(t instanceof HTMLElement||n)&&(t=c.extend({element:t},n)),c.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,t&&t.element)this._element=t.element,this._offset=c.pointGeometry.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=K.create("div"),this._element.setAttribute("aria-label","Map marker");const a=K.createNS("http://www.w3.org/2000/svg","svg"),h=41,d=27;a.setAttributeNS(null,"display","block"),a.setAttributeNS(null,"height",`${h}px`),a.setAttributeNS(null,"width",`${d}px`),a.setAttributeNS(null,"viewBox",`0 0 ${d} ${h}`);const m=K.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"stroke","none"),m.setAttributeNS(null,"stroke-width","1"),m.setAttributeNS(null,"fill","none"),m.setAttributeNS(null,"fill-rule","evenodd");const _=K.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"fill-rule","nonzero");const y=K.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(3.0, 29.0)"),y.setAttributeNS(null,"fill","#000000");const b=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const Z of b){const U=K.createNS("http://www.w3.org/2000/svg","ellipse");U.setAttributeNS(null,"opacity","0.04"),U.setAttributeNS(null,"cx","10.5"),U.setAttributeNS(null,"cy","5.80029008"),U.setAttributeNS(null,"rx",Z.rx),U.setAttributeNS(null,"ry",Z.ry),y.appendChild(U)}const S=K.createNS("http://www.w3.org/2000/svg","g");S.setAttributeNS(null,"fill",this._color);const E=K.createNS("http://www.w3.org/2000/svg","path");E.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),S.appendChild(E);const M=K.createNS("http://www.w3.org/2000/svg","g");M.setAttributeNS(null,"opacity","0.25"),M.setAttributeNS(null,"fill","#000000");const D=K.createNS("http://www.w3.org/2000/svg","path");D.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"),M.appendChild(D);const B=K.createNS("http://www.w3.org/2000/svg","g");B.setAttributeNS(null,"transform","translate(6.0, 7.0)"),B.setAttributeNS(null,"fill","#FFFFFF");const L=K.createNS("http://www.w3.org/2000/svg","g");L.setAttributeNS(null,"transform","translate(8.0, 8.0)");const N=K.createNS("http://www.w3.org/2000/svg","circle");N.setAttributeNS(null,"fill","#000000"),N.setAttributeNS(null,"opacity","0.25"),N.setAttributeNS(null,"cx","5.5"),N.setAttributeNS(null,"cy","5.5"),N.setAttributeNS(null,"r","5.4999962");const X=K.createNS("http://www.w3.org/2000/svg","circle");X.setAttributeNS(null,"fill","#FFFFFF"),X.setAttributeNS(null,"cx","5.5"),X.setAttributeNS(null,"cy","5.5"),X.setAttributeNS(null,"r","5.4999962"),L.appendChild(N),L.appendChild(X),_.appendChild(y),_.appendChild(S),_.appendChild(M),_.appendChild(B),_.appendChild(L),a.appendChild(_),a.setAttributeNS(null,"height",h*this._scale+"px"),a.setAttributeNS(null,"width",d*this._scale+"px"),this._element.appendChild(a),this._offset=c.pointGeometry.convert(t&&t.offset||[0,-14])}this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",a=>{a.preventDefault()}),this._element.addEventListener("mousedown",a=>{a.preventDefault()}),cr(this._element,this._anchor,"marker"),this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),K.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=c.LngLat.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const h=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[h,-1*(38.1-13.5+h)],"bottom-right":[-h,-1*(38.1-13.5+h)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}_onKeyPress(t){const n=t.code,a=t.charCode||t.keyCode;n!=="Space"&&n!=="Enter"&&a!==32&&a!==13||this.togglePopup()}_onMapClick(t){const n=t.originalEvent.target,a=this._element;this._popup&&(n===a||a.contains(n))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}_update(t){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=Ei(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let n="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?n=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(n=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let a="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?a="rotateX(0deg)":this._pitchAlignment==="map"&&(a=`rotateX(${this._map.getPitch()}deg)`),t&&t.type!=="moveend"||(this._pos=this._pos.round()),K.setTransform(this._element,`${Mn[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${a} ${n}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const h=this._map.unproject(this._pos),d=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=h.distanceTo(this._lngLat)>20*d?"0.2":"1.0",this._opacityTimeout=null},100))}getOffset(){return this._offset}setOffset(t){return this._offset=c.pointGeometry.convert(t),this._update(),this}_onMove(t){if(!this._isDragging){const n=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=n}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new c.Event("dragstart"))),this.fire(new c.Event("drag")))}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new c.Event("dragend")),this._state="inactive"}_addDragHandler(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.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))}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const Hs={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Lt,Ht=0,Pn=!1;const ps={maxWidth:100,unit:"metric"};function ms(o,t,n){const a=n&&n.maxWidth||100,h=o._container.clientHeight/2,d=o.unproject([0,h]),m=o.unproject([a,h]),_=d.distanceTo(m);if(n&&n.unit==="imperial"){const y=3.2808*_;y>5280?Yr(t,a,y/5280,o._getUIString("ScaleControl.Miles")):Yr(t,a,y,o._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?Yr(t,a,_/1852,o._getUIString("ScaleControl.NauticalMiles")):_>=1e3?Yr(t,a,_/1e3,o._getUIString("ScaleControl.Kilometers")):Yr(t,a,_,o._getUIString("ScaleControl.Meters"))}function Yr(o,t,n,a){const h=function(d){const m=Math.pow(10,`${Math.floor(d)}`.length-1);let _=d/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*_}(n);o.style.width=t*(h/n)+"px",o.innerHTML=`${h}&nbsp;${a}`}const Ja={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Ya=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function kn(o){if(o){if(typeof o=="number"){const t=Math.round(Math.sqrt(.5*Math.pow(o,2)));return{center:new c.pointGeometry(0,0),top:new c.pointGeometry(0,o),"top-left":new c.pointGeometry(t,t),"top-right":new c.pointGeometry(-t,t),bottom:new c.pointGeometry(0,-o),"bottom-left":new c.pointGeometry(t,-t),"bottom-right":new c.pointGeometry(-t,-t),left:new c.pointGeometry(o,0),right:new c.pointGeometry(-o,0)}}if(o instanceof c.pointGeometry||Array.isArray(o)){const t=c.pointGeometry.convert(o);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:c.pointGeometry.convert(o.center||[0,0]),top:c.pointGeometry.convert(o.top||[0,0]),"top-left":c.pointGeometry.convert(o["top-left"]||[0,0]),"top-right":c.pointGeometry.convert(o["top-right"]||[0,0]),bottom:c.pointGeometry.convert(o.bottom||[0,0]),"bottom-left":c.pointGeometry.convert(o["bottom-left"]||[0,0]),"bottom-right":c.pointGeometry.convert(o["bottom-right"]||[0,0]),left:c.pointGeometry.convert(o.left||[0,0]),right:c.pointGeometry.convert(o.right||[0,0])}}return kn(new c.pointGeometry(0,0))}const Qa=Et,fs={supported:be,setRTLTextPlugin:c.setRTLTextPlugin,getRTLTextPluginStatus:c.getRTLTextPluginStatus,Map:class extends ll{constructor(o){var t;if(c.PerformanceUtils.mark(c.PerformanceMarkers.create),(o=c.extend({},Qe,o)).minZoom!=null&&o.maxZoom!=null&&o.minZoom>o.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(o.minPitch!=null&&o.maxPitch!=null&&o.minPitch>o.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(o.minPitch!=null&&o.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(o.maxPitch!=null&&o.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new js(o.minZoom,o.maxZoom,o.minPitch,o.maxPitch,o.renderWorldCopies),{bearingSnap:o.bearingSnap}),this._interactive=o.interactive,this._cooperativeGestures=o.cooperativeGestures,this._maxTileCacheSize=o.maxTileCacheSize,this._failIfMajorPerformanceCaveat=o.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=o.preserveDrawingBuffer,this._antialias=o.antialias,this._trackResize=o.trackResize,this._bearingSnap=o.bearingSnap,this._refreshExpiredTiles=o.refreshExpiredTiles,this._fadeDuration=o.fadeDuration,this._crossSourceCollisions=o.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=o.collectResourceTiming,this._renderTaskQueue=new Xs,this._controls=[],this._mapId=c.uniqueId(),this._locale=c.extend({},Xa,o.locale),this._clickTolerance=o.clickTolerance,this._pixelRatio=(t=o.pixelRatio)!==null&&t!==void 0?t:devicePixelRatio,this._requestManager=new Ye(o.transformRequest),typeof o.container=="string"){if(this._container=document.getElementById(o.container),!this._container)throw new Error(`Container '${o.container}' not found.`)}else{if(!(o.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=o.container}o.maxBounds&&this.setMaxBounds(o.maxBounds),c.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),typeof window<"u"&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new qa(this,o),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=o.hash&&new qs(typeof o.hash=="string"&&o.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch}),o.bounds&&(this.resize(),this.fitBounds(o.bounds,c.extend({},o.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=o.localIdeographFontFamily,o.style&&this.setStyle(o.style,{localIdeographFontFamily:o.localIdeographFontFamily}),o.attributionControl&&this.addControl(new Gi({customAttribution:o.customAttribution})),o.maplibreLogo&&this.addControl(new Nt,o.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new c.Event(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new c.Event(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new c.Event("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(o,t){if(t===void 0&&(t=o.getDefaultPosition?o.getDefaultPosition():"top-right"),!o||!o.onAdd)return this.fire(new c.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=o.onAdd(this);this._controls.push(o);const a=this._controlPositions[t];return t.indexOf("bottom")!==-1?a.insertBefore(n,a.firstChild):a.appendChild(n),this}removeControl(o){if(!o||!o.onRemove)return this.fire(new c.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(o);return t>-1&&this._controls.splice(t,1),o.onRemove(this),this}hasControl(o){return this._controls.indexOf(o)>-1}calculateCameraOptionsFromTo(o,t,n,a){return a==null&&this.terrain&&(a=this.transform.getElevation(n,this.terrain)),super.calculateCameraOptionsFromTo(o,t,n,a)}resize(o){const t=this._containerDimensions(),n=t[0],a=t[1];this._resizeCanvas(n,a,this.getPixelRatio()),this.transform.resize(n,a),this.painter.resize(n,a,this.getPixelRatio());const h=!this._moving;return h&&(this.stop(),this.fire(new c.Event("movestart",o)).fire(new c.Event("move",o))),this.fire(new c.Event("resize",o)),h&&this.fire(new c.Event("moveend",o)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(o){const[t,n]=this._containerDimensions();this._pixelRatio=o,this._resizeCanvas(t,n,o),this.painter.resize(t,n,o)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(o){return this.transform.setMaxBounds(c.LngLatBounds.convert(o)),this._update()}setMinZoom(o){if((o=o??-2)>=-2&&o<=this.transform.maxZoom)return this.transform.minZoom=o,this._update(),this.getZoom()<o&&this.setZoom(o),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(o){if((o=o??22)>=this.transform.minZoom)return this.transform.maxZoom=o,this._update(),this.getZoom()>o&&this.setZoom(o),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(o){if((o=o??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(o>=0&&o<=this.transform.maxPitch)return this.transform.minPitch=o,this._update(),this.getPitch()<o&&this.setPitch(o),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(o){if((o=o??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(o>=this.transform.minPitch)return this.transform.maxPitch=o,this._update(),this.getPitch()>o&&this.setPitch(o),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(o){return this.transform.renderWorldCopies=o,this._update()}project(o){return this.transform.locationPoint(c.LngLat.convert(o),this.style&&this.terrain)}unproject(o){return this.transform.pointLocation(c.pointGeometry.convert(o),this.terrain)}isMoving(){return this._moving||this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers.isRotating()}_createDelegatedListener(o,t,n){if(o==="mouseenter"||o==="mouseover"){let a=!1;return{layer:t,listener:n,delegates:{mousemove:d=>{const m=this.getLayer(t)?this.queryRenderedFeatures(d.point,{layers:[t]}):[];m.length?a||(a=!0,n.call(this,new Ni(o,this,d.originalEvent,{features:m}))):a=!1},mouseout:()=>{a=!1}}}}if(o==="mouseleave"||o==="mouseout"){let a=!1;return{layer:t,listener:n,delegates:{mousemove:m=>{(this.getLayer(t)?this.queryRenderedFeatures(m.point,{layers:[t]}):[]).length?a=!0:a&&(a=!1,n.call(this,new Ni(o,this,m.originalEvent)))},mouseout:m=>{a&&(a=!1,n.call(this,new Ni(o,this,m.originalEvent)))}}}}{const a=h=>{const d=this.getLayer(t)?this.queryRenderedFeatures(h.point,{layers:[t]}):[];d.length&&(h.features=d,n.call(this,h),delete h.features)};return{layer:t,listener:n,delegates:{[o]:a}}}}on(o,t,n){if(n===void 0)return super.on(o,t);const a=this._createDelegatedListener(o,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[o]=this._delegatedListeners[o]||[],this._delegatedListeners[o].push(a);for(const h in a.delegates)this.on(h,a.delegates[h]);return this}once(o,t,n){if(n===void 0)return super.once(o,t);const a=this._createDelegatedListener(o,t,n);for(const h in a.delegates)this.once(h,a.delegates[h]);return this}off(o,t,n){return n===void 0?super.off(o,t):(this._delegatedListeners&&this._delegatedListeners[o]&&(a=>{const h=this._delegatedListeners[o];for(let d=0;d<h.length;d++){const m=h[d];if(m.layer===t&&m.listener===n){for(const _ in m.delegates)this.off(_,m.delegates[_]);return h.splice(d,1),this}}})(),this)}queryRenderedFeatures(o,t){if(!this.style)return[];let n;const a=o instanceof c.pointGeometry||Array.isArray(o),h=a?o:[[0,0],[this.transform.width,this.transform.height]];if(t=t||(a?{}:o)||{},h instanceof c.pointGeometry||typeof h[0]=="number")n=[c.pointGeometry.convert(h)];else{const d=c.pointGeometry.convert(h[0]),m=c.pointGeometry.convert(h[1]);n=[d,new c.pointGeometry(m.x,d.y),m,new c.pointGeometry(d.x,m.y),d]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(o,t){return this.style.querySourceFeatures(o,t)}setStyle(o,t){return(t=c.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&o?(this._diffStyle(o,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(o,t))}setTransformRequest(o){return this._requestManager.setTransformRequest(o),this}_getUIString(o){const t=this._locale[o];if(t==null)throw new Error(`Missing UI string '${o}'`);return t}_updateStyle(o,t){if(t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(o,t));const n=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove()),o?(this.style=new di(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof o=="string"?this.style.loadURL(o,t,n):this.style.loadJSON(o,t,n),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new di(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(o,t){if(typeof o=="string"){const n=this._requestManager.transformRequest(o,c.ResourceType.Style);c.getJSON(n,(a,h)=>{a?this.fire(new c.ErrorEvent(a)):h&&this._updateDiff(h,t)})}else typeof o=="object"&&this._updateDiff(o,t)}_updateDiff(o,t){try{this.style.setState(o,t)&&this._update(!0)}catch(n){c.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(o,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():c.warnOnce("There is no style added to the map.")}addSource(o,t){return this._lazyInitEmptyStyle(),this.style.addSource(o,t),this._update(!0)}isSourceLoaded(o){const t=this.style&&this.style.sourceCaches[o];if(t!==void 0)return t.loaded();this.fire(new c.ErrorEvent(new Error(`There is no source with ID '${o}'`)))}setTerrain(o){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),o){const t=this.style.sourceCaches[o.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${o.source}`);this.terrain=new ul(this.painter,t,o),this.painter.renderToTexture=new Ws(this.painter,this.terrain),this.transform.updateElevation(this.terrain),this._terrainDataCallback=n=>{n.dataType==="style"?this.terrain.sourceCache.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId===o.source&&this.transform.updateElevation(this.terrain),this.terrain.sourceCache.freeRtt(n.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.updateElevation(this.terrain);return this.fire(new c.Event("terrain",{terrain:o})),this}getTerrain(){return this.terrain&&this.terrain.options}areTilesLoaded(){const o=this.style&&this.style.sourceCaches;for(const t in o){const n=o[t]._tiles;for(const a in n){const h=n[a];if(h.state!=="loaded"&&h.state!=="errored")return!1}}return!0}addSourceType(o,t,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(o,t,n)}removeSource(o){return this.style.removeSource(o),this._update(!0)}getSource(o){return this.style.getSource(o)}addImage(o,t,{pixelRatio:n=1,sdf:a=!1,stretchX:h,stretchY:d,content:m}={}){if(this._lazyInitEmptyStyle(),t instanceof HTMLImageElement||c.isImageBitmap(t)){const{width:_,height:y,data:b}=c.exported.getImageData(t);this.style.addImage(o,{data:new c.RGBAImage({width:_,height:y},b),pixelRatio:n,stretchX:h,stretchY:d,content:m,sdf:a,version:0})}else{if(t.width===void 0||t.height===void 0)return this.fire(new c.ErrorEvent(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:_,height:y,data:b}=t,S=t;this.style.addImage(o,{data:new c.RGBAImage({width:_,height:y},new Uint8Array(b)),pixelRatio:n,stretchX:h,stretchY:d,content:m,sdf:a,version:0,userImage:S}),S.onAdd&&S.onAdd(this,o)}}}updateImage(o,t){const n=this.style.getImage(o);if(!n)return this.fire(new c.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const a=t instanceof HTMLImageElement||c.isImageBitmap(t)?c.exported.getImageData(t):t,{width:h,height:d,data:m}=a;if(h===void 0||d===void 0)return this.fire(new c.ErrorEvent(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(h!==n.data.width||d!==n.data.height)return this.fire(new c.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const _=!(t instanceof HTMLImageElement||c.isImageBitmap(t));n.data.replace(m,_),this.style.updateImage(o,n)}hasImage(o){return o?!!this.style.getImage(o):(this.fire(new c.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(o){this.style.removeImage(o)}loadImage(o,t){c.getImage(this._requestManager.transformRequest(o,c.ResourceType.Image),t)}listImages(){return this.style.listImages()}addLayer(o,t){return this._lazyInitEmptyStyle(),this.style.addLayer(o,t),this._update(!0)}moveLayer(o,t){return this.style.moveLayer(o,t),this._update(!0)}removeLayer(o){return this.style.removeLayer(o),this._update(!0)}getLayer(o){return this.style.getLayer(o)}setLayerZoomRange(o,t,n){return this.style.setLayerZoomRange(o,t,n),this._update(!0)}setFilter(o,t,n={}){return this.style.setFilter(o,t,n),this._update(!0)}getFilter(o){return this.style.getFilter(o)}setPaintProperty(o,t,n,a={}){return this.style.setPaintProperty(o,t,n,a),this._update(!0)}getPaintProperty(o,t){return this.style.getPaintProperty(o,t)}setLayoutProperty(o,t,n,a={}){return this.style.setLayoutProperty(o,t,n,a),this._update(!0)}getLayoutProperty(o,t){return this.style.getLayoutProperty(o,t)}setGlyphs(o,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(o,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(o,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(o,t,n,a=>{a||this._update(!0)}),this}removeSprite(o){return this._lazyInitEmptyStyle(),this.style.removeSprite(o),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(o,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(o,t,n=>{n||this._update(!0)}),this}setLight(o,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(o,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(o,t){return this.style.setFeatureState(o,t),this._update()}removeFeatureState(o,t){return this.style.removeFeatureState(o,t),this._update()}getFeatureState(o){return this.style.getFeatureState(o)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let o=0,t=0;return this._container&&(o=this._container.clientWidth||400,t=this._container.clientHeight||300),[o,t]}_setupContainer(){const o=this._container;o.classList.add("maplibregl-map");const t=this._canvasContainer=K.create("div","maplibregl-canvas-container",o);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=K.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const n=this._containerDimensions();this._resizeCanvas(n[0],n[1],this.getPixelRatio());const a=this._controlContainer=K.create("div","maplibregl-control-container",o),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(d=>{h[d]=K.create("div",`maplibregl-ctrl-${d} `,a)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){const o=this._container;this._metaPress=!1,this._cooperativeGesturesScreen=K.create("div","maplibregl-cooperative-gesture-screen",o);let t="Control",n=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(n=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use \u2318 + scroll to zoom the map",t="Meta"),this._cooperativeGesturesScreen.innerHTML=`
577
577
  <div class="maplibregl-desktop-message">${n}</div>
578
578
  <div class="maplibregl-mobile-message">${typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}</div>
579
- `,document.addEventListener("keydown",a=>{a.key===t&&(this._metaPress=!0)}),document.addEventListener("keyup",a=>{a.key===t&&(this._metaPress=!1)}),this._canvasContainer.addEventListener("wheel",a=>{this._onCooperativeGesture(a,this._metaPress,1)},!1),this._canvasContainer.classList.remove("maplibregl-touch-drag-pan")}_resizeCanvas(o,t,n){this._canvas.width=n*o,this._canvas.height=n*t,this._canvas.style.width=`${o}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const o=c.extend({},ve.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1});let t=null;this._canvas.addEventListener("webglcontextcreationerror",a=>{t={requestedAttributes:o},a&&(t.statusMessage=a.statusMessage,t.type=a.type)},{once:!0});const n=this._canvas.getContext("webgl",o)||this._canvas.getContext("experimental-webgl",o);if(!n){const a="Failed to initialize WebGL";throw t?(t.message=a,new Error(JSON.stringify(t))):new Error(a)}this.painter=new Ko(n,this.transform),c.exported$1.testSupport(n)}_contextLost(o){o.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new c.Event("webglcontextlost",{originalEvent:o}))}_contextRestored(o){this._setupPainter(),this.resize(),this._update(),this.fire(new c.Event("webglcontextrestored",{originalEvent:o}))}_onMapScroll(o){if(o.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(o,t,n){return!t&&n<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(o){return this.style?(this._styleDirty=this._styleDirty||o,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(o){return this._update(),this._renderTaskQueue.add(o)}_cancelRenderFrame(o){this._renderTaskQueue.remove(o)}_render(o){let t,n=0;const a=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(t=a.createQueryEXT(),a.beginQueryEXT(a.TIME_ELAPSED_EXT,t),n=c.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(o),this._removed)return;let h=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const m=this.transform.zoom,_=c.exported.now();this.style.zoomHistory.update(m,_);const y=new c.EvaluationParameters(m,{now:_,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),v=y.crossFadingFactor();v===1&&v===this._crossFadingFactor||(h=!0,this._crossFadingFactor=v),this.style.update(y)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain&&this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.updateElevation(this.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new c.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.PerformanceUtils.mark(c.PerformanceMarkers.load),this.fire(new c.Event("load"))),this.style&&(this.style.hasTransitions()||h)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const m=c.exported.now()-n;a.endQueryEXT(a.TIME_ELAPSED_EXT,t),setTimeout(()=>{const _=a.getQueryObjectEXT(t,a.QUERY_RESULT_EXT)/1e6;a.deleteQueryEXT(t),this.fire(new c.Event("gpu-timing-frame",{cpuTime:m,gpuTime:_}))},50)}if(this.listens("gpu-timing-layer")){const m=this.painter.collectGpuTimers();setTimeout(()=>{const _=this.painter.queryGpuTimers(m);this.fire(new c.Event("gpu-timing-layer",{layerTimes:_}))},50)}const p=this._sourcesDirty||this._styleDirty||this._placementDirty;return p||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new c.Event("idle")),!this._loaded||this._fullyLoaded||p||(this._fullyLoaded=!0,c.PerformanceUtils.mark(c.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));const o=this.painter.context.gl.getExtension("WEBGL_lose_context");o&&o.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),K.remove(this._canvasContainer),K.remove(this._controlContainer),this._cooperativeGestures&&K.remove(this._cooperativeGesturesScreen),this._container.classList.remove("maplibregl-map"),c.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new c.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=c.exported.frame(o=>{c.PerformanceUtils.frame(o),this._frame=null,this._render(o)}))}_onWindowOnline(){this._update()}_onWindowResize(o){this._trackResize&&this.resize({originalEvent:o})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(o){this._showTileBoundaries!==o&&(this._showTileBoundaries=o,this._update())}get showPadding(){return!!this._showPadding}set showPadding(o){this._showPadding!==o&&(this._showPadding=o,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(o){this._showCollisionBoxes!==o&&(this._showCollisionBoxes=o,o?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(o){this._showOverdrawInspector!==o&&(this._showOverdrawInspector=o,this._update())}get repaint(){return!!this._repaint}set repaint(o){this._repaint!==o&&(this._repaint=o,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(o){this._vertices=o,this._update()}_setCacheLimits(o,t){c.setCacheLimits(o,t)}get version(){return We}getCameraTargetElevation(){return this.transform.elevation}},NavigationControl:class{constructor(o){this.options=c.extend({},Wa,o),this._container=K.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(c.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),K.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),K.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(c.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=K.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const o=this._map.getZoom(),t=o===this._map.getMaxZoom(),n=o===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){const o=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=o}onAdd(o){return this._map=o,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 Ha(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){K.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(o,t){const n=K.create("button",o,this._container);return n.type="button",n.addEventListener("click",t),n}_setButtonTitle(o,t){const n=this._map._getUIString(`NavigationControl.${t}`);o.title=n,o.setAttribute("aria-label",n)}},GeolocateControl:class extends c.Evented{constructor(o){super(),this.options=c.extend({},Ks,o),c.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(o){var t;return this._map=o,this._container=K.create("div","maplibregl-ctrl maplibregl-ctrl-group"),t=this._setupUI,zt!==void 0?t(zt):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(n=>{zt=n.state!=="denied",t(zt)}):(zt=!!window.navigator.geolocation,t(zt)),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(),K.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Wt=0,Mn=!1}_isOutOfMapMaxBounds(o){const t=this._map.getMaxBounds(),n=o.coords;return t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_onSuccess(o){if(this._map){if(this._isOutOfMapMaxBounds(o))return this._setErrorState(),this.fire(new c.Event("outofmaxbounds",o)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=o,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(o),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(o),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new c.Event("geolocate",o)),this._finish()}}_updateCamera(o){const t=new c.LngLat(o.coords.longitude,o.coords.latitude),n=o.coords.accuracy,a=this._map.getBearing(),h=c.extend({bearing:a},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(n),h,{geolocateSource:!0})}_updateMarker(o){if(o){const t=new c.LngLat(o.coords.longitude,o.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=o.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const o=this._map._container.clientHeight/2,t=this._map.unproject([0,o]),n=this._map.unproject([1,o]),a=t.distanceTo(n),h=Math.ceil(2*this._accuracy/a);this._circleElement.style.width=`${h}px`,this._circleElement.style.height=`${h}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(o){if(this._map){if(this.options.trackUserLocation)if(o.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 t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(o.code===3&&Mn)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.Event("error",o)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(o){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=K.create("button","maplibregl-ctrl-geolocate",this._container),K.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",o===!1){c.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=K.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ka(this._dotElement),this._circleElement=K.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ka({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",t=>{t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||t.originalEvent&&t.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new c.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return c.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new c.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Wt--,Mn=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new c.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new c.Event("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let o;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Wt++,Wt>1?(o={maximumAge:6e5,timeout:0},Mn=!0):(o=this.options.positionOptions,Mn=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,o)}}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)}},AttributionControl:ji,LogoControl:Vt,ScaleControl:class{constructor(o){this.options=c.extend({},ps,o),c.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){ds(this._map,this._container,this.options)}onAdd(o){return this._map=o,this._container=K.create("div","maplibregl-ctrl maplibregl-ctrl-scale",o.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){K.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(o){this.options.unit=o,ds(this._map,this._container,this.options)}},FullscreenControl:class{constructor(o={}){this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,o&&o.container&&(o.container instanceof HTMLElement?this._container=o.container:c.warnOnce("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(o){return this._map=o,this._container||(this._container=this._map.getContainer()),this._controlContainer=K.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){K.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const o=this._fullscreenButton=K.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);K.create("span","maplibregl-ctrl-icon",o).setAttribute("aria-hidden","true"),o.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const o=this._getTitle();this._fullscreenButton.setAttribute("aria-label",o),this._fullscreenButton.title=o}_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()}_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()}},TerrainControl:class{constructor(o){this.options=o,c.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(o){return this._map=o,this._container=K.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=K.create("button","maplibregl-ctrl-terrain",this._container),K.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(){K.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends c.Evented{constructor(o){super(),this.options=c.extend(Object.create(Ja),o),c.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(o){return this._map&&this.remove(),this._map=o,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new c.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&K.remove(this._content),this._container&&(K.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new c.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(o){return this._lngLat=c.LngLat.convert(o),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(o){return this.setDOMContent(document.createTextNode(o))}setHTML(o){const t=document.createDocumentFragment(),n=document.createElement("body");let a;for(n.innerHTML=o;a=n.firstChild,a;)t.appendChild(a);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(o){return this.options.maxWidth=o,this._update(),this}setDOMContent(o){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=K.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(o),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(o){this._container&&this._container.classList.add(o)}removeClassName(o){this._container&&this._container.classList.remove(o)}setOffset(o){return this.options.offset=o,this._update(),this}toggleClassName(o){if(this._container)return this._container.classList.toggle(o)}_createCloseButton(){this.options.closeButton&&(this._closeButton=K.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(o){this._update(o.point)}_onMouseMove(o){this._update(o.point)}_onDrag(o){this._update(o.point)}_update(o){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=K.create("div","maplibregl-popup",this._map.getContainer()),this._tip=K.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(p=>this._container.classList.add(p)),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Si(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!o))return;const t=this._pos=this._trackPointer&&o?o:this._map.project(this._lngLat);let n=this.options.anchor;const a=Pn(this.options.offset);if(!n){const p=this._container.offsetWidth,m=this._container.offsetHeight;let _;_=t.y+a.bottom.y<m?["top"]:t.y>this._map.transform.height-m?["bottom"]:[],t.x<p/2?_.push("left"):t.x>this._map.transform.width-p/2&&_.push("right"),n=_.length===0?"bottom":_.join("-")}const h=t.add(a[n]).round();K.setTransform(this._container,`${Cn[n]} translate(${h.x}px,${h.y}px)`),cr(this._container,n,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const o=this._container.querySelector(Ya);o&&o.focus()}_onClose(){this.remove()}},Marker:Ka,Style:ui,LngLat:c.LngLat,LngLatBounds:c.LngLatBounds,Point:c.pointGeometry,MercatorCoordinate:c.MercatorCoordinate,Evented:c.Evented,AJAXError:c.AJAXError,config:c.config,CanvasSource:Ur,GeoJSONSource:Or,ImageSource:ki,RasterDEMTileSource:sr,RasterTileSource:hn,VectorTileSource:cn,VideoSource:Zr,prewarm:function(){Xr().acquire(Ir)},clearPrewarmedResources:function(){const o=Oi;o&&(o.isPreloaded()&&o.numActive()===1?(o.release(Ir),Oi=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()"))},get version(){return Qa},get workerCount(){return ar.workerCount},set workerCount(o){ar.workerCount=o},get maxParallelImageRequests(){return c.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(o){c.config.MAX_PARALLEL_IMAGE_REQUESTS=o},clearStorage(o){c.clearTileCache(o)},workerUrl:"",addProtocol(o,t){c.config.REGISTERED_PROTOCOLS[o]=t},removeProtocol(o){delete c.config.REGISTERED_PROTOCOLS[o]}};return Za.extend(ms,{isSafari:c.isSafari,getPerformanceMetrics:c.PerformanceUtils.getPerformanceMetrics}),ms});var oe=ie;return oe})})(eh);var gr=vp(eh.exports);const th="3.7.4",bp=th,wp=typeof atob=="function",Tp=typeof btoa=="function",bs=typeof Buffer=="function",ih=typeof TextDecoder=="function"?new TextDecoder:void 0,rh=typeof TextEncoder=="function"?new TextEncoder:void 0,Sp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",la=Array.prototype.slice.call(Sp),yo=(C=>{let b={};return C.forEach((k,Z)=>b[k]=Z),b})(la),Ep=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,vi=String.fromCharCode.bind(String),nh=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):(C,b=k=>k)=>new Uint8Array(Array.prototype.slice.call(C,0).map(b)),sh=C=>C.replace(/=/g,"").replace(/[+\/]/g,b=>b=="+"?"-":"_"),ah=C=>C.replace(/[^A-Za-z0-9\+\/]/g,""),oh=C=>{let b,k,Z,ie,fe="";const oe=C.length%3;for(let c=0;c<C.length;){if((k=C.charCodeAt(c++))>255||(Z=C.charCodeAt(c++))>255||(ie=C.charCodeAt(c++))>255)throw new TypeError("invalid character found");b=k<<16|Z<<8|ie,fe+=la[b>>18&63]+la[b>>12&63]+la[b>>6&63]+la[b&63]}return oe?fe.slice(0,oe-3)+"===".substring(oe):fe},Rl=Tp?C=>btoa(C):bs?C=>Buffer.from(C,"binary").toString("base64"):oh,Bl=bs?C=>Buffer.from(C).toString("base64"):C=>{let k=[];for(let Z=0,ie=C.length;Z<ie;Z+=4096)k.push(vi.apply(null,C.subarray(Z,Z+4096)));return Rl(k.join(""))},xo=(C,b=!1)=>b?sh(Bl(C)):Bl(C),Ip=C=>{if(C.length<2){var b=C.charCodeAt(0);return b<128?C:b<2048?vi(192|b>>>6)+vi(128|b&63):vi(224|b>>>12&15)+vi(128|b>>>6&63)+vi(128|b&63)}else{var b=65536+(C.charCodeAt(0)-55296)*1024+(C.charCodeAt(1)-56320);return vi(240|b>>>18&7)+vi(128|b>>>12&63)+vi(128|b>>>6&63)+vi(128|b&63)}},Ap=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,lh=C=>C.replace(Ap,Ip),ch=bs?C=>Buffer.from(C,"utf8").toString("base64"):rh?C=>Bl(rh.encode(C)):C=>Rl(lh(C)),ws=(C,b=!1)=>b?sh(ch(C)):ch(C),hh=C=>ws(C,!0),Cp=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Mp=C=>{switch(C.length){case 4:var b=(7&C.charCodeAt(0))<<18|(63&C.charCodeAt(1))<<12|(63&C.charCodeAt(2))<<6|63&C.charCodeAt(3),k=b-65536;return vi((k>>>10)+55296)+vi((k&1023)+56320);case 3:return vi((15&C.charCodeAt(0))<<12|(63&C.charCodeAt(1))<<6|63&C.charCodeAt(2));default:return vi((31&C.charCodeAt(0))<<6|63&C.charCodeAt(1))}},uh=C=>C.replace(Cp,Mp),ph=C=>{if(C=C.replace(/\s+/g,""),!Ep.test(C))throw new TypeError("malformed base64.");C+="==".slice(2-(C.length&3));let b,k="",Z,ie;for(let fe=0;fe<C.length;)b=yo[C.charAt(fe++)]<<18|yo[C.charAt(fe++)]<<12|(Z=yo[C.charAt(fe++)])<<6|(ie=yo[C.charAt(fe++)]),k+=Z===64?vi(b>>16&255):ie===64?vi(b>>16&255,b>>8&255):vi(b>>16&255,b>>8&255,b&255);return k},Fl=wp?C=>atob(ah(C)):bs?C=>Buffer.from(C,"base64").toString("binary"):ph,dh=bs?C=>nh(Buffer.from(C,"base64")):C=>nh(Fl(C),b=>b.charCodeAt(0)),mh=C=>dh(fh(C)),Pp=bs?C=>Buffer.from(C,"base64").toString("utf8"):ih?C=>ih.decode(dh(C)):C=>uh(Fl(C)),fh=C=>ah(C.replace(/[-_]/g,b=>b=="-"?"+":"/")),Ol=C=>Pp(fh(C)),kp=C=>{if(typeof C!="string")return!1;const b=C.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(b)||!/[^\s0-9a-zA-Z\-_]/.test(b)},gh=C=>({value:C,enumerable:!1,writable:!0,configurable:!0}),_h=function(){const C=(b,k)=>Object.defineProperty(String.prototype,b,gh(k));C("fromBase64",function(){return Ol(this)}),C("toBase64",function(b){return ws(this,b)}),C("toBase64URI",function(){return ws(this,!0)}),C("toBase64URL",function(){return ws(this,!0)}),C("toUint8Array",function(){return mh(this)})},yh=function(){const C=(b,k)=>Object.defineProperty(Uint8Array.prototype,b,gh(k));C("toBase64",function(b){return xo(this,b)}),C("toBase64URI",function(){return xo(this,!0)}),C("toBase64URL",function(){return xo(this,!0)})},zp={version:th,VERSION:bp,atob:Fl,atobPolyfill:ph,btoa:Rl,btoaPolyfill:oh,fromBase64:Ol,toBase64:ws,encode:ws,encodeURI:hh,encodeURL:hh,utob:lh,btou:uh,decode:Ol,isValid:kp,fromUint8Array:xo,toUint8Array:mh,extendString:_h,extendUint8Array:yh,extendBuiltins:()=>{_h(),yh()}};let vo;const Lp=new Uint8Array(16);function Dp(){if(!vo&&(vo=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!vo))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return vo(Lp)}const bi=[];for(let C=0;C<256;++C)bi.push((C+256).toString(16).slice(1));function Rp(C,b=0){return(bi[C[b+0]]+bi[C[b+1]]+bi[C[b+2]]+bi[C[b+3]]+"-"+bi[C[b+4]]+bi[C[b+5]]+"-"+bi[C[b+6]]+bi[C[b+7]]+"-"+bi[C[b+8]]+bi[C[b+9]]+"-"+bi[C[b+10]]+bi[C[b+11]]+bi[C[b+12]]+bi[C[b+13]]+bi[C[b+14]]+bi[C[b+15]]).toLowerCase()}var xh={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Bp(C,b,k){if(xh.randomUUID&&!b&&!C)return xh.randomUUID();C=C||{};const Z=C.random||(C.rng||Dp)();if(Z[6]=Z[6]&15|64,Z[8]=Z[8]&63|128,b){k=k||0;for(let ie=0;ie<16;++ie)b[k+ie]=Z[ie];return b}return Rp(Z)}var Ul={exports:{}},Ts=typeof Reflect=="object"?Reflect:null,vh=Ts&&typeof Ts.apply=="function"?Ts.apply:function(b,k,Z){return Function.prototype.apply.call(b,k,Z)},bo;Ts&&typeof Ts.ownKeys=="function"?bo=Ts.ownKeys:Object.getOwnPropertySymbols?bo=function(b){return Object.getOwnPropertyNames(b).concat(Object.getOwnPropertySymbols(b))}:bo=function(b){return Object.getOwnPropertyNames(b)};function Fp(C){console&&console.warn&&console.warn(C)}var bh=Number.isNaN||function(b){return b!==b};function Lt(){Lt.init.call(this)}Ul.exports=Lt,Ul.exports.once=Np,Lt.EventEmitter=Lt,Lt.prototype._events=void 0,Lt.prototype._eventsCount=0,Lt.prototype._maxListeners=void 0;var wh=10;function wo(C){if(typeof C!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof C)}Object.defineProperty(Lt,"defaultMaxListeners",{enumerable:!0,get:function(){return wh},set:function(C){if(typeof C!="number"||C<0||bh(C))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+C+".");wh=C}}),Lt.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Lt.prototype.setMaxListeners=function(b){if(typeof b!="number"||b<0||bh(b))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+b+".");return this._maxListeners=b,this};function Th(C){return C._maxListeners===void 0?Lt.defaultMaxListeners:C._maxListeners}Lt.prototype.getMaxListeners=function(){return Th(this)},Lt.prototype.emit=function(b){for(var k=[],Z=1;Z<arguments.length;Z++)k.push(arguments[Z]);var ie=b==="error",fe=this._events;if(fe!==void 0)ie=ie&&fe.error===void 0;else if(!ie)return!1;if(ie){var oe;if(k.length>0&&(oe=k[0]),oe instanceof Error)throw oe;var c=new Error("Unhandled error."+(oe?" ("+oe.message+")":""));throw c.context=oe,c}var ve=fe[b];if(ve===void 0)return!1;if(typeof ve=="function")vh(ve,this,k);else for(var Ze=ve.length,lt=Ch(ve,Ze),Z=0;Z<Ze;++Z)vh(lt[Z],this,k);return!0};function Sh(C,b,k,Z){var ie,fe,oe;if(wo(k),fe=C._events,fe===void 0?(fe=C._events=Object.create(null),C._eventsCount=0):(fe.newListener!==void 0&&(C.emit("newListener",b,k.listener?k.listener:k),fe=C._events),oe=fe[b]),oe===void 0)oe=fe[b]=k,++C._eventsCount;else if(typeof oe=="function"?oe=fe[b]=Z?[k,oe]:[oe,k]:Z?oe.unshift(k):oe.push(k),ie=Th(C),ie>0&&oe.length>ie&&!oe.warned){oe.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+oe.length+" "+String(b)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=C,c.type=b,c.count=oe.length,Fp(c)}return C}Lt.prototype.addListener=function(b,k){return Sh(this,b,k,!1)},Lt.prototype.on=Lt.prototype.addListener,Lt.prototype.prependListener=function(b,k){return Sh(this,b,k,!0)};function Op(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Eh(C,b,k){var Z={fired:!1,wrapFn:void 0,target:C,type:b,listener:k},ie=Op.bind(Z);return ie.listener=k,Z.wrapFn=ie,ie}Lt.prototype.once=function(b,k){return wo(k),this.on(b,Eh(this,b,k)),this},Lt.prototype.prependOnceListener=function(b,k){return wo(k),this.prependListener(b,Eh(this,b,k)),this},Lt.prototype.removeListener=function(b,k){var Z,ie,fe,oe,c;if(wo(k),ie=this._events,ie===void 0)return this;if(Z=ie[b],Z===void 0)return this;if(Z===k||Z.listener===k)--this._eventsCount===0?this._events=Object.create(null):(delete ie[b],ie.removeListener&&this.emit("removeListener",b,Z.listener||k));else if(typeof Z!="function"){for(fe=-1,oe=Z.length-1;oe>=0;oe--)if(Z[oe]===k||Z[oe].listener===k){c=Z[oe].listener,fe=oe;break}if(fe<0)return this;fe===0?Z.shift():Up(Z,fe),Z.length===1&&(ie[b]=Z[0]),ie.removeListener!==void 0&&this.emit("removeListener",b,c||k)}return this},Lt.prototype.off=Lt.prototype.removeListener,Lt.prototype.removeAllListeners=function(b){var k,Z,ie;if(Z=this._events,Z===void 0)return this;if(Z.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):Z[b]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete Z[b]),this;if(arguments.length===0){var fe=Object.keys(Z),oe;for(ie=0;ie<fe.length;++ie)oe=fe[ie],oe!=="removeListener"&&this.removeAllListeners(oe);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(k=Z[b],typeof k=="function")this.removeListener(b,k);else if(k!==void 0)for(ie=k.length-1;ie>=0;ie--)this.removeListener(b,k[ie]);return this};function Ih(C,b,k){var Z=C._events;if(Z===void 0)return[];var ie=Z[b];return ie===void 0?[]:typeof ie=="function"?k?[ie.listener||ie]:[ie]:k?Vp(ie):Ch(ie,ie.length)}Lt.prototype.listeners=function(b){return Ih(this,b,!0)},Lt.prototype.rawListeners=function(b){return Ih(this,b,!1)},Lt.listenerCount=function(C,b){return typeof C.listenerCount=="function"?C.listenerCount(b):Ah.call(C,b)},Lt.prototype.listenerCount=Ah;function Ah(C){var b=this._events;if(b!==void 0){var k=b[C];if(typeof k=="function")return 1;if(k!==void 0)return k.length}return 0}Lt.prototype.eventNames=function(){return this._eventsCount>0?bo(this._events):[]};function Ch(C,b){for(var k=new Array(b),Z=0;Z<b;++Z)k[Z]=C[Z];return k}function Up(C,b){for(;b+1<C.length;b++)C[b]=C[b+1];C.pop()}function Vp(C){for(var b=new Array(C.length),k=0;k<b.length;++k)b[k]=C[k].listener||C[k];return b}function Np(C,b){return new Promise(function(k,Z){function ie(oe){C.removeListener(b,fe),Z(oe)}function fe(){typeof C.removeListener=="function"&&C.removeListener("error",ie),k([].slice.call(arguments))}Mh(C,b,fe,{once:!0}),b!=="error"&&$p(C,ie,{once:!0})})}function $p(C,b,k){typeof C.on=="function"&&Mh(C,"error",b,k)}function Mh(C,b,k,Z){if(typeof C.on=="function")Z.once?C.once(b,k):C.on(b,k);else if(typeof C.addEventListener=="function")C.addEventListener(b,function ie(fe){Z.once&&C.removeEventListener(b,ie),k(fe)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof C)}const zr={AUTO:"auto",LATIN:"latin",NON_LATIN:"nonlatin",LOCAL:"",ALBANIAN:"sq",AMHARIC:"am",ARABIC:"ar",ARMENIAN:"hy",AZERBAIJANI:"az",BASQUE:"eu",BELORUSSIAN:"be",BOSNIAN:"bs",BRETON:"br",BULGARIAN:"bg",CATALAN:"ca",CHINESE:"zh",CORSICAN:"co",CROATIAN:"hr",CZECH:"cs",DANISH:"da",DUTCH:"nl",ENGLISH:"en",ESPERANTO:"eo",ESTONIAN:"et",FINNISH:"fi",FRENCH:"fr",FRISIAN:"fy",GEORGIAN:"ka",GERMAN:"de",GREEK:"el",HEBREW:"he",HINDI:"hi",HUNGARIAN:"hu",ICELANDIC:"is",INDONESIAN:"id",IRISH:"ga",ITALIAN:"it",JAPANESE:"ja",JAPANESE_HIRAGANA:"ja-Hira",JAPANESE_KANA:"ja_kana",JAPANESE_LATIN:"ja_rm",JAPANESE_2018:"ja-Latn",KANNADA:"kn",KAZAKH:"kk",KOREAN:"ko",KOREAN_LATIN:"ko-Latn",KURDISH:"ku",ROMAN_LATIN:"la",LATVIAN:"lv",LITHUANIAN:"lt",LUXEMBOURGISH:"lb",MACEDONIAN:"mk",MALAYALAM:"ml",MALTESE:"mt",NORWEGIAN:"no",OCCITAN:"oc",POLISH:"pl",PORTUGUESE:"pt",ROMANIAN:"ro",ROMANSH:"rm",RUSSIAN:"ru",SCOTTISH_GAELIC:"gd",SERBIAN_CYRILLIC:"sr",SERBIAN_LATIN:"sr-Latn",SLOVAK:"sk",SLOVENE:"sl",SPANISH:"es",SWEDISH:"sv",TAMIL:"ta",TELUGU:"te",THAI:"th",TURKISH:"tr",UKRAINIAN:"uk",WELSH:"cy"},jp=new Set(Object.values(zr));function Ph(C){return jp.has(C)}const Gp=new Set(Object.values(zr));function Vl(){if(typeof navigator>"u")return Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];const C=Array.from(new Set(navigator.languages.map(b=>b.split("-")[0]))).filter(b=>Gp.has(b));return C.length?C[0]:zr.LATIN}function qp(){return typeof self<"u"?fetch.bind(self):typeof global<"u"&&global.fetch?global.fetch:null}class Zp{constructor(){this._apiKey="",this._fetch=qp()}set apiKey(b){this._apiKey=b}get apiKey(){return this._apiKey}set fetch(b){this._fetch=b}get fetch(){return this._fetch}}const Hi=new Zp,Ss={AUTO:"auto",ALBANIAN:"sq",ARABIC:"ar",ARMENIAN:"hy",AZERBAIJANI:"az",BELORUSSIAN:"be",BOSNIAN:"bs",BRETON:"br",BULGARIAN:"bg",CATALAN:"ca",CHINESE:"zh",CROATIAN:"hr",CZECH:"cs",DANISH:"da",DUTCH:"nl",ENGLISH:"en",ESPERANTO:"eo",ESTONIAN:"et",FINNISH:"fi",FRENCH:"fr",FRISIAN:"fy",GEORGIAN:"ka",GERMAN:"de",GREEK:"el",HEBREW:"he",HUNGARIAN:"hu",ICELANDIC:"is",IRISH:"ga",ITALIAN:"it",JAPANESE:"ja",KANNADA:"kn",KAZAKH:"kk",KOREAN:"ko",ROMAN_LATIN:"la",LATVIAN:"lv",LITHUANIAN:"lt",LUXEMBOURGISH:"lb",MACEDONIAN:"mk",MALTESE:"mt",NORWEGIAN:"no",POLISH:"pl",PORTUGUESE:"pt",ROMANIAN:"ro",ROMANSH:"rm",RUSSIAN:"ru",SCOTTISH_GAELIC:"gd",SERBIAN_CYRILLIC:"sr",SLOVAK:"sk",SLOVENE:"sl",SPANISH:"es",SWEDISH:"sv",THAI:"th",TURKISH:"tr",UKRAINIAN:"uk",WELSH:"cy"},Xp=new Set(Object.values(Ss));function kh(){if(typeof navigator>"u")return Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];const C=Array.from(new Set(navigator.languages.map(b=>b.split("-")[0]))).filter(b=>Xp.has(b));return C.length?C[0]:Ss.ENGLISH}var Wp=(C,b,k)=>new Promise((Z,ie)=>{var fe=ve=>{try{c(k.next(ve))}catch(Ze){ie(Ze)}},oe=ve=>{try{c(k.throw(ve))}catch(Ze){ie(Ze)}},c=ve=>ve.done?Z(ve.value):Promise.resolve(ve.value).then(fe,oe);c((k=k.apply(C,b)).next())});function Es(C){return Wp(this,arguments,function*(b,k={}){if(Hi.fetch===null)throw new Error("The fetch function was not found. If on NodeJS < 18 please specify the fetch function with config.fetch");if(new URL(b).searchParams.get("key").trim()==="")throw new Error("The MapTiler Cloud API key is missing. Set it in `config.apiKey` or get one for free at https://maptiler.com");return Hi.fetch(b,k)})}const Lr={maptilerApiURL:"https://api.maptiler.com/",mapStyle:"streets-v2"};Object.freeze(Lr);class On extends Error{constructor(b,k=""){super(`Call to enpoint ${b.url} failed with the status code ${b.status}. ${k}`),this.res=b}}var zh=(C,b,k)=>new Promise((Z,ie)=>{var fe=ve=>{try{c(k.next(ve))}catch(Ze){ie(Ze)}},oe=ve=>{try{c(k.throw(ve))}catch(Ze){ie(Ze)}},c=ve=>ve.done?Z(ve.value):Promise.resolve(ve.value).then(fe,oe);c((k=k.apply(C,b)).next())});const To={400:"Query too long / Invalid parameters",403:"Key is missing, invalid or restricted"};function Hp(C){return zh(this,arguments,function*(b,k={}){var Z;if(typeof b!="string"||b.trim().length===0)throw new Error("The query must be a non-empty string");const ie=new URL(`geocoding/${encodeURIComponent(b)}.json`,Lr.maptilerApiURL);if(ie.searchParams.set("key",(Z=k.apiKey)!=null?Z:Hi.apiKey),"bbox"in k&&ie.searchParams.set("bbox",k.bbox.join(",")),"proximity"in k&&ie.searchParams.set("proximity",k.proximity.join(",")),"language"in k){const ve=Array.from(new Set((Array.isArray(k.language)?k.language:[k.language]).map(Ze=>Ze===Ss.AUTO?kh():Ze))).join(",");ie.searchParams.set("language",ve)}const fe=ie.toString(),oe=yield Es(fe);if(!oe.ok)throw new On(oe,oe.status in To?To[oe.status]:"");return yield oe.json()})}function Kp(C){return zh(this,arguments,function*(b,k={}){var Z;if(!Array.isArray(b)||b.length<2)throw new Error("The position must be an array of form [lng, lat].");const ie=new URL(`geocoding/${b[0]},${b[1]}.json`,Lr.maptilerApiURL);if(ie.searchParams.set("key",(Z=k.apiKey)!=null?Z:Hi.apiKey),"language"in k){const ve=Array.from(new Set((Array.isArray(k.language)?k.language:[k.language]).map(Ze=>Ze===Ss.AUTO?kh():Ze))).join(",");ie.searchParams.set("language",ve)}const fe=ie.toString(),oe=yield Es(fe);if(!oe.ok)throw new On(oe,oe.status in To?To[oe.status]:"");return yield oe.json()})}const Jp={forward:Hp,reverse:Kp,language:Ss};var Yp=(C,b,k)=>new Promise((Z,ie)=>{var fe=ve=>{try{c(k.next(ve))}catch(Ze){ie(Ze)}},oe=ve=>{try{c(k.throw(ve))}catch(Ze){ie(Ze)}},c=ve=>ve.done?Z(ve.value):Promise.resolve(ve.value).then(fe,oe);c((k=k.apply(C,b)).next())});const Lh={403:"Key is missing, invalid or restricted"};function Qp(){return Yp(this,arguments,function*(C={}){var b;const k=new URL("geolocation/ip.json",Lr.maptilerApiURL);k.searchParams.set("key",(b=C.apiKey)!=null?b:Hi.apiKey);const Z=k.toString(),ie=yield Es(Z);if(!ie.ok)throw new On(ie,ie.status in Lh?Lh[ie.status]:"");return yield ie.json()})}const Nl={info:Qp};var Dh=(C,b,k)=>new Promise((Z,ie)=>{var fe=ve=>{try{c(k.next(ve))}catch(Ze){ie(Ze)}},oe=ve=>{try{c(k.throw(ve))}catch(Ze){ie(Ze)}},c=ve=>ve.done?Z(ve.value):Promise.resolve(ve.value).then(fe,oe);c((k=k.apply(C,b)).next())});const So={403:"Key is missing, invalid or restricted"};function ed(C){return Dh(this,arguments,function*(b,k={}){var Z;if(typeof b!="string"||b.trim().length===0)throw new Error("The query must be a non-empty string");const ie=new URL(`coordinates/search/${b}.json`,Lr.maptilerApiURL);ie.searchParams.set("key",(Z=k.apiKey)!=null?Z:Hi.apiKey),"limit"in k&&ie.searchParams.set("limit",k.limit.toString()),"transformations"in k&&ie.searchParams.set("transformations",k.transformations.toString()),"exports"in k&&ie.searchParams.set("exports",k.exports.toString());const fe=ie.toString(),oe=yield Es(fe);if(!oe.ok)throw new On(oe,oe.status in So?So[oe.status]:"");return yield oe.json()})}function td(C){return Dh(this,arguments,function*(b,k={}){var Z;const ie=(Array.isArray(b[0])?b:[b]).map(Ze=>`${Ze[0]},${Ze[1]}`).join(";"),fe=new URL(`coordinates/transform/${ie}.json`,Lr.maptilerApiURL);fe.searchParams.set("key",(Z=k.apiKey)!=null?Z:Hi.apiKey),"sourceCrs"in k&&fe.searchParams.set("s_srs",k.sourceCrs.toString()),"targetCrs"in k&&fe.searchParams.set("t_srs",k.targetCrs.toString()),"operations"in k&&fe.searchParams.set("ops",(Array.isArray(k.operations)?k.operations:[k.operations]).join("|"));const oe=fe.toString(),c=yield Es(oe);if(!c.ok)throw new On(c,c.status in So?So[c.status]:"");return yield c.json()})}const id={search:ed,transform:td};var rd=(C,b,k)=>new Promise((Z,ie)=>{var fe=ve=>{try{c(k.next(ve))}catch(Ze){ie(Ze)}},oe=ve=>{try{c(k.throw(ve))}catch(Ze){ie(Ze)}},c=ve=>ve.done?Z(ve.value):Promise.resolve(ve.value).then(fe,oe);c((k=k.apply(C,b)).next())});const Rh={403:"Key is missing, invalid or restricted"};function nd(C){return rd(this,arguments,function*(b,k={}){var Z;if(typeof b!="string"||b.trim().length===0)throw new Error("The data ID must be a non-empty string");const ie=new URL(`data/${encodeURIComponent(b)}/features.json`,Lr.maptilerApiURL);ie.searchParams.set("key",(Z=k.apiKey)!=null?Z:Hi.apiKey);const fe=ie.toString(),oe=yield Es(fe);if(!oe.ok)throw new On(oe,oe.status in Rh?Rh[oe.status]:"");return yield oe.json()})}const sd={get:nd};function Bh(C){const b=/^maptiler:\/\/(.*)/;let k;const Z=C.trim();let ie;return Z.startsWith("http://")||Z.startsWith("https://")?ie=Z:(k=b.exec(Z))!==null?ie=`https://api.maptiler.com/maps/${k[1]}/style.json`:ie=`https://api.maptiler.com/maps/${Z}/style.json`,ie}class Eo{constructor(b,k,Z,ie,fe,oe){this.name=b,this.variantType=k,this.id=Z,this.referenceStyle=ie,this.description=fe,this.imageURL=oe}getName(){return this.name}getFullName(){return`${this.referenceStyle.getName()} ${this.name}`}getType(){return this.variantType}getId(){return this.id}getDescription(){return this.description}getReferenceStyle(){return this.referenceStyle}hasVariant(b){return this.referenceStyle.hasVariant(b)}getVariant(b){return this.referenceStyle.getVariant(b)}getVariants(){return this.referenceStyle.getVariants().filter(b=>b!==this)}getImageURL(){return this.imageURL}getExpandedStyleURL(){return Bh(this.getId())}}class Io{constructor(b,k){this.name=b,this.id=k,this.variants={},this.orderedVariants=[]}getName(){return this.name}getId(){return this.id}addVariant(b){this.variants[b.getType()]=b,this.orderedVariants.push(b)}hasVariant(b){return b in this.variants}getVariant(b){return b in this.variants?this.variants[b]:this.orderedVariants[0]}getVariants(){return Object.values(this.variants)}getDefaultVariant(){return this.orderedVariants[0]}}const Ao=[{referenceStyleID:"STREETS",name:"Streets",description:"",variants:[{id:"streets-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"streets-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"streets-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"streets-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OUTDOOR",name:"Outdoor",description:"",variants:[{id:"outdoor-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"WINTER",name:"Winter",description:"",variants:[{id:"winter-v2",name:"Winter",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"SATELLITE",name:"Satellite",description:"",variants:[{id:"satellite",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"HYBRID",name:"Hybrid",description:"",variants:[{id:"hybrid",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"BASIC",name:"Basic",description:"",variants:[{id:"basic-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"basic-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"basic-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BRIGHT",name:"Bright",description:"",variants:[{id:"bright-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"bright-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"bright-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"bright-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OPENSTREETMAP",name:"OpenStreetMap",description:"",variants:[{id:"openstreetmap",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"TOPO",name:"Topo",description:"",variants:[{id:"topo-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"topo-v2-shiny",name:"Shiny",variantType:"SHINY",description:"",imageURL:""},{id:"topo-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""},{id:"topo-v2-topographique",name:"Topographique",variantType:"TOPOGRAPHIQUE",description:"",imageURL:""}]},{referenceStyleID:"VOYAGER",name:"Voyager",description:"",variants:[{id:"voyager-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"voyager-v2-darkmatter",name:"Darkmatter",variantType:"DARK",description:"",imageURL:""},{id:"voyager-v2-positron",name:"Positron",variantType:"LIGHT",description:"",imageURL:""},{id:"voyager-v2-vintage",name:"Vintage",variantType:"VINTAGE",description:"",imageURL:""}]},{referenceStyleID:"TONER",name:"Toner",description:"",variants:[{id:"toner-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"toner-v2-background",name:"Background",variantType:"BACKGROUND",description:"",imageURL:""},{id:"toner-v2-lite",name:"Lite",variantType:"LITE",description:"",imageURL:""},{id:"toner-v2-lines",name:"Lines",variantType:"LINES",description:"",imageURL:""}]},{referenceStyleID:"DATAVIZ",name:"Dataviz",description:"",variants:[{id:"dataviz",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"dataviz-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"dataviz-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"OCEAN",name:"Ocean",description:"",variants:[{id:"ocean",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]}];function ad(C){return new Proxy(C,{get(b,k,Z){return b.hasVariant(k)?b.getVariant(k):k.toString().toUpperCase()===k?C.getDefaultVariant():Reflect.get(b,k,Z)}})}function od(){const C={};for(let b=0;b<Ao.length;b+=1){const k=Ao[b],Z=ad(new Io(k.name,k.referenceStyleID));for(let ie=0;ie<k.variants.length;ie+=1){const fe=k.variants[ie],oe=new Eo(fe.name,fe.variantType,fe.id,Z,fe.description,fe.imageURL);Z.addVariant(oe)}C[k.referenceStyleID]=Z}return C}function $l(C){if(!C)return jl[Ao[0].referenceStyleID].getDefaultVariant().getId();if(typeof C=="string"||C instanceof String)return C.trim().toLowerCase();if(C instanceof Eo)return C.getId();if(C instanceof Io)return C.getDefaultVariant().getId()}const jl=od();function ld(C,b,k){let Z=b[0],ie=b[1],fe=k[0]-Z,oe=k[1]-ie;if(fe!==0||oe!==0){const c=((C[0]-Z)*fe+(C[1]-ie)*oe)/(fe*fe+oe*oe);c>1?(Z=k[0],ie=k[1]):c>0&&(Z+=fe*c,ie+=oe*c)}return fe=C[0]-Z,oe=C[1]-ie,fe*fe+oe*oe}function Gl(C,b,k,Z,ie){let fe=Z,oe;for(let c=b+1;c<k;c++){const ve=ld(C[c],C[b],C[k]);ve>fe&&(oe=c,fe=ve)}fe>Z&&(oe-b>1&&Gl(C,b,oe,Z,ie),ie.push(C[oe]),k-oe>1&&Gl(C,oe,k,Z,ie))}function cd(C,b){const k=C.length-1,Z=[C[0]];return Gl(C,0,k,b,Z),Z.push(C[k]),Z}function hd(C,b){if(C.length<=2)return C;const k=b!==void 0?b*b:1;return cd(C,k)}function ql(C,b=!0){let k=`${C[0]},${C[1]}`;return C.length===3&&b&&(k+=`,${C[2]}`),k}function Zl(C,b=3e3){let k=C.map(fe=>fe.join(",")).join("|"),Z=5e-6;const ie=1e-5;for(;k.length>b;)k=hd(C,Z).map(oe=>`${oe[0]},${oe[1]}`).join("|"),Z+=ie;return k}function ud(C,b,k={}){var Z,ie,fe,oe,c;const ve=$l(k.style),Ze=k.hiDPI?"@2x":"",lt=(Z=k.format)!=null?Z:"png";let St=~~((ie=k.width)!=null?ie:1024),Me=~~((fe=k.height)!=null?fe:1024);k.hiDPI&&(St=~~(St/2),Me=~~(Me/2));const K=new URL(`maps/${encodeURIComponent(ve)}/static/${C[0]},${C[1]},${b}/${St}x${Me}${Ze}.${lt}`,Lr.maptilerApiURL);if("attribution"in k&&K.searchParams.set("attribution",k.attribution.toString()),"markers"in k){let Ye="";const ti="markerIcon"in k;ti&&(Ye+=`icon:${k.markerIcon}|`),ti&&"markerAnchor"in k&&(Ye+=`anchor:${k.markerAnchor}|`),ti&&k.hiDPI&&(Ye+="scale:2|"),Ye+=(Array.isArray(k.markers[0])?k.markers:[k.markers]).map(Dt=>ql(Dt,!ti)).join("|"),K.searchParams.set("markers",Ye)}if("path"in k){let Ye="";Ye+=`fill:${(oe=k.pathFillColor)!=null?oe:"none"}|`,"pathStrokeColor"in k&&(Ye+=`stroke:${k.pathStrokeColor}|`),"pathWidth"in k&&(Ye+=`width:${(k.pathWidth/(k.hiDPI?2:1)).toString()}|`),Ye+=Zl(k.path),K.searchParams.set("path",Ye)}return K.searchParams.set("key",(c=k.apiKey)!=null?c:Hi.apiKey),K.toString()}function pd(C,b={}){var k,Z,ie,fe,oe;const c=$l(b.style),ve=b.hiDPI?"@2x":"",Ze=(k=b.format)!=null?k:"png";let lt=~~((Z=b.width)!=null?Z:1024),St=~~((ie=b.height)!=null?ie:1024);b.hiDPI&&(lt=~~(lt/2),St=~~(St/2));const Me=new URL(`maps/${encodeURIComponent(c)}/static/${C[0]},${C[1]},${C[2]},${C[3]}/${lt}x${St}${ve}.${Ze}`,Lr.maptilerApiURL);if("attribution"in b&&Me.searchParams.set("attribution",b.attribution.toString()),"padding"in b&&Me.searchParams.set("padding",b.padding.toString()),"markers"in b){let K="";const Ye="markerIcon"in b;Ye&&(K+=`icon:${b.markerIcon}|`),Ye&&"markerAnchor"in b&&(K+=`anchor:${b.markerAnchor}|`),Ye&&b.hiDPI&&(K+="scale:2|"),K+=(Array.isArray(b.markers[0])?b.markers:[b.markers]).map(Jt=>ql(Jt,!Ye)).join("|"),Me.searchParams.set("markers",K)}if("path"in b){let K="";K+=`fill:${(fe=b.pathFillColor)!=null?fe:"none"}|`,"pathStrokeColor"in b&&(K+=`stroke:${b.pathStrokeColor}|`),"pathWidth"in b&&(K+=`width:${(b.pathWidth/(b.hiDPI?2:1)).toString()}|`),K+=Zl(b.path),Me.searchParams.set("path",K)}return Me.searchParams.set("key",(oe=b.apiKey)!=null?oe:Hi.apiKey),Me.toString()}function dd(C={}){var b,k,Z,ie,fe;if(!("markers"in C)&&!("path"in C))throw new Error("Automatic static maps require markers and/or path to be created.");const oe=$l(C.style),c=C.hiDPI?"@2x":"",ve=(b=C.format)!=null?b:"png";let Ze=~~((k=C.width)!=null?k:1024),lt=~~((Z=C.height)!=null?Z:1024);C.hiDPI&&(Ze=~~(Ze/2),lt=~~(lt/2));const St=new URL(`maps/${encodeURIComponent(oe)}/static/auto/${Ze}x${lt}${c}.${ve}`,Lr.maptilerApiURL);if("attribution"in C&&St.searchParams.set("attribution",C.attribution.toString()),"padding"in C&&St.searchParams.set("padding",C.padding.toString()),"markers"in C){let Me="";const K="markerIcon"in C;K&&(Me+=`icon:${C.markerIcon}|`),K&&"markerAnchor"in C&&(Me+=`anchor:${C.markerAnchor}|`),K&&C.hiDPI&&(Me+="scale:2|"),Me+=(Array.isArray(C.markers[0])?C.markers:[C.markers]).map(ti=>ql(ti,!K)).join("|"),St.searchParams.set("markers",Me)}if("path"in C){let Me="";Me+=`fill:${(ie=C.pathFillColor)!=null?ie:"none"}|`,"pathStrokeColor"in C&&(Me+=`stroke:${C.pathStrokeColor}|`),"pathWidth"in C&&(Me+=`width:${(C.pathWidth/(C.hiDPI?2:1)).toString()}|`),Me+=Zl(C.path),St.searchParams.set("path",Me)}return St.searchParams.set("key",(fe=C.apiKey)!=null?fe:Hi.apiKey),St.toString()}const md={centered:ud,bounded:pd,automatic:dd};class Fh extends Ul.exports{constructor(){super(),this.primaryLanguage=zr.AUTO,this.secondaryLanguage=null,this.session=!0,this._unit="metric",this._apiKey=""}set unit(b){this._unit=b,this.emit("unit",b)}get unit(){return this._unit}set apiKey(b){this._apiKey=b,Hi.apiKey=b,this.emit("apiKey",b)}get apiKey(){return this._apiKey}set fetch(b){Hi.fetch=b}get fetch(){return Hi.fetch}}const Fi=new Fh,Ki={maptilerLogoURL:"https://api.maptiler.com/resources/logo.svg",maptilerURL:"https://www.maptiler.com/",maptilerApiHost:"api.maptiler.com",rtlPluginURL:"https://cdn.maptiler.com/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.min.js",primaryLanguage:zr.AUTO,secondaryLanguage:zr.LOCAL,terrainSourceURL:"https://api.maptiler.com/tiles/terrain-rgb-v2/tiles.json",terrainSourceId:"maptiler-terrain"};Object.freeze(Ki);class Xl extends gr.LogoControl{constructor(b={}){var k,Z;super(b),this.logoURL="",this.linkURL="",this.logoURL=(k=b.logoURL)!=null?k:Ki.maptilerLogoURL,this.linkURL=(Z=b.linkURL)!=null?Z:Ki.maptilerURL}onAdd(b){this._map=b,this._compact=this.options&&this.options.compact,this._container=window.document.createElement("div"),this._container.className="maplibregl-ctrl";const k=window.document.createElement("a");return k.style.backgroundRepeat="no-repeat",k.style.cursor="pointer",k.style.display="block",k.style.height="23px",k.style.margin="0 0 -4px -4px",k.style.overflow="hidden",k.style.width="88px",k.style.backgroundImage=`url(${this.logoURL})`,k.style.backgroundSize="100px 30px",k.style.width="100px",k.style.height="30px",k.target="_blank",k.rel="noopener nofollow",k.href=this.linkURL,k.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),k.setAttribute("rel","noopener nofollow"),this._container.appendChild(k),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}}function fd(){gr.getRTLTextPluginStatus()==="unavailable"&&gr.setRTLTextPlugin(Ki.rtlPluginURL,null,!0)}function gd(C,b){C.forEach(k=>{!b[k]||(b[k]=b[k].bind(b))})}function Un(C,b,k){const Z=window.document.createElement(C);return b!==void 0&&(Z.className=b),k&&k.appendChild(Z),Z}function _d(C){C.parentNode&&C.parentNode.removeChild(C)}function Oh(C){return C?typeof C=="string"||C instanceof String?!C.startsWith("http")&&C.toLowerCase().includes(".json")?C:Bh(C):C instanceof Eo?C.getExpandedStyleURL():C instanceof Io?C.getDefaultVariant().getExpandedStyleURL():C:jl[Ao[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL()}class Uh{constructor(){gd(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(b){return this._map=b,this._container=Un("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=Un("button","maplibregl-ctrl-terrain",this._container),Un("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(){_d(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.hasTerrain()?this._map.disableTerrain():this._map.enableTerrain(),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.hasTerrain()?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}}class yd extends gr.NavigationControl{constructor(){super({showCompass:!0,showZoom:!0,visualizePitch:!0}),this._compass.removeEventListener("click",this._compass.clickFunction),this._compass.addEventListener("click",b=>{this._map.getPitch()===0?this._map.easeTo({pitch:Math.min(this._map.getMaxPitch(),80)}):this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:b}):this._map.resetNorth({},{originalEvent:b})})}_createButton(b,k){const Z=super._createButton(b,k);return Z.clickFunction=k,Z}_rotateCompassArrow(){const b=this.options.visualizePitch?`scale(${Math.min(1.5,1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5))}) rotateX(${Math.min(70,this._map.transform.pitch)}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=b}}var xd=Object.defineProperty,vd=Object.defineProperties,bd=Object.getOwnPropertyDescriptors,Vh=Object.getOwnPropertySymbols,wd=Object.prototype.hasOwnProperty,Td=Object.prototype.propertyIsEnumerable,Nh=(C,b,k)=>b in C?xd(C,b,{enumerable:!0,configurable:!0,writable:!0,value:k}):C[b]=k,Sd=(C,b)=>{for(var k in b||(b={}))wd.call(b,k)&&Nh(C,k,b[k]);if(Vh)for(var k of Vh(b))Td.call(b,k)&&Nh(C,k,b[k]);return C},Ed=(C,b)=>vd(C,bd(b));const Id=gr.GeolocateControl,$h=gr.Marker,jh=gr.LngLat;class Gh extends Id{constructor(){super(...arguments),this.lastUpdatedCenter=new jh(0,0)}_updateCamera(b){const k=new jh(b.coords.longitude,b.coords.latitude),Z=b.coords.accuracy,ie=this._map.getBearing(),fe=Ed(Sd({bearing:ie},this.options.fitBoundsOptions),{linear:!0}),oe=this._map.getZoom();oe>this.options.fitBoundsOptions.maxZoom&&(fe.zoom=oe),this._map.fitBounds(k.toBounds(Z),fe,{geolocateSource:!0});let c=!1;const ve=()=>{c=!0};this._map.once("click",ve),this._map.once("dblclick",ve),this._map.once("dragstart",ve),this._map.once("mousedown",ve),this._map.once("touchstart",ve),this._map.once("wheel",ve),this._map.once("moveend",()=>{this._map.off("click",ve),this._map.off("dblclick",ve),this._map.off("dragstart",ve),this._map.off("mousedown",ve),this._map.off("touchstart",ve),this._map.off("wheel",ve),!c&&(this.lastUpdatedCenter=this._map.getCenter())})}_setupUI(b){if(this.lastUpdatedCenter=this._map.getCenter(),this._container.addEventListener("contextmenu",k=>k.preventDefault()),this._geolocateButton=Un("button","maplibregl-ctrl-geolocate",this._container),Un("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",b===!1){const k=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=k,this._geolocateButton.setAttribute("aria-label",k)}else{const k=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=k,this._geolocateButton.setAttribute("aria-label",k)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=Un("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new $h(this._dotElement),this._circleElement=Un("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new $h({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("move",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("moveend",k=>{const Z=k.originalEvent&&k.originalEvent.type==="resize",ie=this.lastUpdatedCenter.distanceTo(this._map.getCenter());!k.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!Z&&ie>1&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new Event("trackuserlocationend")))})}_updateCircleRadius(){if(this._watchState!=="BACKGROUND"&&this._watchState!=="ACTIVE_LOCK")return;const b=[this._lastKnownPosition.coords.longitude,this._lastKnownPosition.coords.latitude],k=this._map.project(b),Z=this._map.unproject([k.x,k.y]),ie=this._map.unproject([k.x+20,k.y]),fe=Z.distanceTo(ie)/20,oe=Math.ceil(2*this._accuracy/fe);this._circleElement.style.width=`${oe}px`,this._circleElement.style.height=`${oe}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}}var Ad=Object.defineProperty,Cd=Object.defineProperties,Md=Object.getOwnPropertyDescriptors,qh=Object.getOwnPropertySymbols,Pd=Object.prototype.hasOwnProperty,kd=Object.prototype.propertyIsEnumerable,Zh=(C,b,k)=>b in C?Ad(C,b,{enumerable:!0,configurable:!0,writable:!0,value:k}):C[b]=k,Xh=(C,b)=>{for(var k in b||(b={}))Pd.call(b,k)&&Zh(C,k,b[k]);if(qh)for(var k of qh(b))kd.call(b,k)&&Zh(C,k,b[k]);return C},Wh=(C,b)=>Cd(C,Md(b)),ca=(C,b,k)=>new Promise((Z,ie)=>{var fe=ve=>{try{c(k.next(ve))}catch(Ze){ie(Ze)}},oe=ve=>{try{c(k.throw(ve))}catch(Ze){ie(Ze)}},c=ve=>ve.done?Z(ve.value):Promise.resolve(ve.value).then(fe,oe);c((k=k.apply(C,b)).next())});const Hh=Bp(),Kh={POINT:"POINT",COUNTRY:"COUNTRY"};class zd extends gr.Map{constructor(b){var k;b.apiKey&&(Fi.apiKey=b.apiKey);const Z=Oh(b.style),ie=location.hash;Fi.apiKey||console.warn("MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!"),super(Wh(Xh({},b),{style:Z,maplibreLogo:!1,transformRequest:oe=>{let c=null;try{c=new URL(oe)}catch{return{url:oe,headers:{}}}return c.host===Ki.maptilerApiHost&&(c.searchParams.has("key")||c.searchParams.append("key",Fi.apiKey),Fi.session&&c.searchParams.append("mtsid",Hh)),{url:c.href,headers:{}}}})),this.languageShouldUpdate=!1,this.isStyleInitialized=!1,this.isTerrainEnabled=!1,this.terrainExaggeration=1,this.once("styledata",()=>ca(this,null,function*(){if(b.geolocate===!1||b.center||b.hash&&!!ie)return;try{if(b.geolocate===Kh.COUNTRY){yield this.fitToIpBounds();return}}catch(c){console.warn(c.message)}let oe=null;try{yield this.centerOnIpPoint(b.zoom),oe=this.getCameraHash()}catch(c){console.warn(c.message)}(yield navigator.permissions.query({name:"geolocation"})).state==="granted"&&navigator.geolocation.getCurrentPosition(c=>{oe===this.getCameraHash()&&this.easeTo({center:[c.coords.longitude,c.coords.latitude],zoom:b.zoom||12,duration:2e3})},null,{maximumAge:24*3600*1e3,timeout:5e3,enableHighAccuracy:!1})})),this.on("styledataloading",()=>{this.languageShouldUpdate=!!Fi.primaryLanguage||!!Fi.secondaryLanguage});let fe=!0;this.on("styledata",()=>{b.language&&fe?this.setPrimaryLanguage(b.language):Fi.primaryLanguage&&(this.languageShouldUpdate||!this.isStyleInitialized)&&this.setPrimaryLanguage(Fi.primaryLanguage),Fi.secondaryLanguage&&(this.languageShouldUpdate||!this.isStyleInitialized)&&this.setSecondaryLanguage(Fi.secondaryLanguage),this.languageShouldUpdate=!1,this.isStyleInitialized=!0,fe=!1}),this.on("styledata",()=>{this.getTerrain()===null&&this.isTerrainEnabled&&this.enableTerrain(this.terrainExaggeration)}),this.once("load",()=>ca(this,null,function*(){fd()})),this.once("load",()=>ca(this,null,function*(){let oe={logo:null};try{const c=Object.keys(this.style.sourceCaches).map(Ze=>this.getSource(Ze)).filter(Ze=>typeof Ze.url=="string"&&Ze.url.includes("tiles.json")),ve=new URL(c[0].url);ve.searchParams.has("key")||ve.searchParams.append("key",Fi.apiKey),oe=yield(yield fetch(ve.href)).json()}catch{}if("logo"in oe&&oe.logo){const c=oe.logo;this.addControl(new Xl({logoURL:c}),b.logoPosition),b.attributionControl===!1&&this.addControl(new gr.AttributionControl(b))}else b.maptilerLogo&&this.addControl(new Xl,b.logoPosition);if(b.scaleControl){const c=b.scaleControl===!0||b.scaleControl===void 0?"bottom-right":b.scaleControl,ve=new gr.ScaleControl({unit:Fi.unit});this.addControl(ve,c),Fi.on("unit",Ze=>{ve.setUnit(Ze)})}if(b.navigationControl!==!1){const c=b.navigationControl===!0||b.navigationControl===void 0?"top-right":b.navigationControl;this.addControl(new yd,c)}if(b.geolocateControl!==!1){const c=b.geolocateControl===!0||b.geolocateControl===void 0?"top-right":b.geolocateControl;this.addControl(new Gh({positionOptions:{enableHighAccuracy:!0,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!0,showAccuracyCircle:!0,showUserLocation:!0}),c)}if(b.terrainControl){const c=b.terrainControl===!0||b.terrainControl===void 0?"top-right":b.terrainControl;this.addControl(new Uh,c)}if(b.fullscreenControl){const c=b.fullscreenControl===!0||b.fullscreenControl===void 0?"top-right":b.fullscreenControl;this.addControl(new gr.FullscreenControl({}),c)}})),b.terrain&&this.enableTerrain((k=b.terrainExaggeration)!=null?k:this.terrainExaggeration)}setStyle(b,k){return super.setStyle(Oh(b),k)}setLanguage(b=Ki.primaryLanguage){if(b===zr.AUTO)return this.setLanguage(Vl());this.setPrimaryLanguage(b)}setPrimaryLanguage(b=Ki.primaryLanguage){!Ph(b)||this.onStyleReady(()=>{if(b===zr.AUTO)return this.setPrimaryLanguage(Vl());const k=this.getStyle().layers,Z=/^\s*{\s*name\s*(:\s*(\S*))?\s*}$/,ie=/^\s*name\s*(:\s*(\S*))?\s*$/,fe=/^\s*{\s*name\s*(:\s*(\S*))?\s*}(\s*){\s*name\s*(:\s*(\S*))?\s*}$/,oe=/^(.*)({\s*name\s*(:\s*(\S*))?\s*})(.*)$/,c=b?`name:${b}`:"name",ve=["case",["has",c],["get",c],["get","name:latin"]];for(let Ze=0;Ze<k.length;Ze+=1){const lt=k[Ze],St=lt.layout;if(!St||!St["text-field"])continue;const Me=this.getLayoutProperty(lt.id,"text-field");let K;if(Array.isArray(Me)&&Me.length>=2&&Me[0].trim().toLowerCase()==="concat"){const Ye=Me.slice();for(let ti=0;ti<Me.length;ti+=1){const Jt=Me[ti];if((typeof Jt=="string"||Jt instanceof String)&&Z.exec(Jt.toString())){Ye[ti]=ve;break}else if(Array.isArray(Jt)&&Jt.length>=2&&Jt[0].trim().toLowerCase()==="get"&&ie.exec(Jt[1].toString())){Ye[ti]=ve;break}else if(Array.isArray(Jt)&&Jt.length===4&&Jt[0].trim().toLowerCase()==="case"){Ye[ti]=ve;break}}this.setLayoutProperty(lt.id,"text-field",Ye)}else if(Array.isArray(Me)&&Me.length>=2&&Me[0].trim().toLowerCase()==="get"&&ie.exec(Me[1].toString())){const Ye=ve;this.setLayoutProperty(lt.id,"text-field",Ye)}else if((typeof Me=="string"||Me instanceof String)&&Z.exec(Me.toString())){const Ye=ve;this.setLayoutProperty(lt.id,"text-field",Ye)}else if(Array.isArray(Me)&&Me.length===4&&Me[0].trim().toLowerCase()==="case"){const Ye=ve;this.setLayoutProperty(lt.id,"text-field",Ye)}else if((typeof Me=="string"||Me instanceof String)&&(K=fe.exec(Me.toString()))!==null){const Ye=`{${c}}${K[3]}{name${K[4]||""}}`;this.setLayoutProperty(lt.id,"text-field",Ye)}else if((typeof Me=="string"||Me instanceof String)&&(K=oe.exec(Me.toString()))!==null){const Ye=`${K[1]}{${c}}${K[5]}`;this.setLayoutProperty(lt.id,"text-field",Ye)}}})}setSecondaryLanguage(b=Ki.secondaryLanguage){!Ph(b)||this.onStyleReady(()=>{if(b===zr.AUTO)return this.setSecondaryLanguage(Vl());const k=this.getStyle().layers,Z=/^\s*{\s*name\s*(:\s*(\S*))?\s*}$/,ie=/^\s*name\s*(:\s*(\S*))?\s*$/,fe=/^\s*{\s*name\s*(:\s*(\S*))?\s*}(\s*){\s*name\s*(:\s*(\S*))?\s*}$/;let oe;for(let c=0;c<k.length;c+=1){const ve=k[c],Ze=ve.layout;if(!Ze||!Ze["text-field"])continue;const lt=this.getLayoutProperty(ve.id,"text-field");let St;if(Array.isArray(lt)&&lt.length>=2&&lt[0].trim().toLowerCase()==="concat"){St=lt.slice();let Me=0;for(let K=0;K<lt.length;K+=1){const Ye=lt[K];if((typeof Ye=="string"||Ye instanceof String)&&Z.exec(Ye.toString())){if(Me===1){St[K]=`{name:${b}}`;break}Me+=1}else if(Array.isArray(Ye)&&Ye.length>=2&&Ye[0].trim().toLowerCase()==="get"&&ie.exec(Ye[1].toString())){if(Me===1){St[K][1]=`name:${b}`;break}Me+=1}else if(Array.isArray(Ye)&&Ye.length===4&&Ye[0].trim().toLowerCase()==="case"){if(Me===1){St[K]=["get",`name:${b}`];break}Me+=1}}this.setLayoutProperty(ve.id,"text-field",St)}else if((typeof lt=="string"||lt instanceof String)&&(oe=fe.exec(lt.toString()))!==null){const Me=b?`name:${b}`:"name";St=`{name${oe[1]||""}}${oe[3]}{${Me}}`,this.setLayoutProperty(ve.id,"text-field",St)}}})}getTerrainExaggeration(){return this.terrainExaggeration}hasTerrain(){return this.isTerrainEnabled}enableTerrain(b=this.terrainExaggeration){if(b<0){console.warn("Terrain exaggeration cannot be negative.");return}const k=this.getTerrain(),Z=()=>{this.isTerrainEnabled=!0,this.terrainExaggeration=b,this.addSource(Ki.terrainSourceId,{type:"raster-dem",url:Ki.terrainSourceURL}),this.setTerrain({source:Ki.terrainSourceId,exaggeration:b})};if(k){this.setTerrain(Wh(Xh({},k),{exaggeration:b}));return}this.loaded()||this.isTerrainEnabled?Z():this.once("load",()=>{this.getTerrain()&&this.getSource(Ki.terrainSourceId)||Z()})}disableTerrain(){this.isTerrainEnabled=!1,this.setTerrain(null),this.getSource(Ki.terrainSourceId)&&this.removeSource(Ki.terrainSourceId)}setTerrainExaggeration(b){this.enableTerrain(b)}onStyleReady(b){this.isStyleLoaded()?b():this.once("styledata",()=>{b()})}fitToIpBounds(){return ca(this,null,function*(){const b=yield Nl.info();this.fitBounds(b.country_bounds,{duration:0,padding:100})})}centerOnIpPoint(b){return ca(this,null,function*(){const k=yield Nl.info();this.jumpTo({center:[k.longitude,k.latitude],zoom:b||11})})}getCameraHash(){const b=new Float32Array(5),k=this.getCenter();return b[0]=k.lng,b[1]=k.lat,b[2]=this.getZoom(),b[3]=this.getPitch(),b[4]=this.getBearing(),zp.fromUint8Array(new Uint8Array(b.buffer))}getSdkConfig(){return Fi}getMaptilerSessionId(){return Hh}}class ha{constructor(b,k){this.x=b,this.y=k}_matMult(b){const k=b[0]*this.x+b[1]*this.y,Z=b[2]*this.x+b[3]*this.y;return this.x=k,this.y=Z,this}_add(b){return this.x+=b.x,this.y+=b.y,this}_sub(b){return this.x-=b.x,this.y-=b.y,this}_mult(b){return this.x*=b,this.y*=b,this}_div(b){return this.x/=b,this.y/=b,this}_multByPoint(b){return this.x*=b.x,this.y*=b.y,this}_divByPoint(b){return this.x/=b.x,this.y/=b.y,this}_unit(){return this._div(this.mag()),this}_perp(){const b=this.y;return this.y=this.x,this.x=-b,this}_rotate(b){const k=Math.cos(b),Z=Math.sin(b),ie=k*this.x-Z*this.y,fe=Z*this.x+k*this.y;return this.x=ie,this.y=fe,this}_rotateAround(b,k){const Z=Math.cos(b),ie=Math.sin(b),fe=k.x+Z*(this.x-k.x)-ie*(this.y-k.y),oe=k.y+ie*(this.x-k.x)+Z*(this.y-k.y);return this.x=fe,this.y=oe,this}_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}clone(){return new ha(this.x,this.y)}add(b){return this.clone()._add(b)}sub(b){return this.clone()._sub(b)}multByPoint(b){return this.clone()._multByPoint(b)}divByPoint(b){return this.clone()._divByPoint(b)}mult(b){return this.clone()._mult(b)}div(b){return this.clone()._div(b)}rotate(b){return this.clone()._rotate(b)}rotateAround(b,k){return this.clone()._rotateAround(b,k)}matMult(b){return this.clone()._matMult(b)}unit(){return this.clone()._unit()}perp(){return this.clone()._perp()}round(){return this.clone()._round()}mag(){return Math.sqrt(this.x*this.x+this.y*this.y)}equals(b){return this.x===b.x&&this.y===b.y}dist(b){return Math.sqrt(this.distSqr(b))}distSqr(b){const k=b.x-this.x,Z=b.y-this.y;return k*k+Z*Z}angle(){return Math.atan2(this.y,this.x)}angleTo(b){return Math.atan2(this.y-b.y,this.x-b.x)}angleWith(b){return this.angleWithSep(b.x,b.y)}angleWithSep(b,k){return Math.atan2(this.x*k-this.y*b,this.x*b+this.y*k)}static convert(b){return b instanceof ha?b:Array.isArray(b)?new ha(b[0],b[1]):b}}const{supported:Ld,setRTLTextPlugin:Dd,getRTLTextPluginStatus:Rd,NavigationControl:Bd,GeolocateControl:Fd,AttributionControl:Od,LogoControl:Ud,ScaleControl:Vd,FullscreenControl:Nd,TerrainControl:$d,Popup:jd,Marker:Gd,Style:qd,LngLat:Zd,LngLatBounds:Xd,MercatorCoordinate:Wd,Evented:Hd,AJAXError:Kd,CanvasSource:Jd,GeoJSONSource:Yd,ImageSource:Qd,RasterDEMTileSource:em,RasterTileSource:tm,VectorTileSource:im,VideoSource:rm,prewarm:nm,clearPrewarmedResources:sm,version:am,workerCount:om,maxParallelImageRequests:lm,clearStorage:cm,workerUrl:hm,addProtocol:um,removeProtocol:pm}=gr;Je.AJAXError=Kd,Je.AttributionControl=Od,Je.CanvasSource=Jd,Je.Evented=Hd,Je.FullscreenControl=Nd,Je.GeoJSONSource=Yd,Je.GeolocateControl=Fd,Je.GeolocationType=Kh,Je.ImageSource=Qd,Je.Language=zr,Je.LanguageGeocoding=Ss,Je.LngLat=Zd,Je.LngLatBounds=Xd,Je.LogoControl=Ud,Je.Map=zd,Je.MapStyle=jl,Je.MapStyleVariant=Eo,Je.MaptilerGeolocateControl=Gh,Je.MaptilerLogoControl=Xl,Je.MaptilerTerrainControl=Uh,Je.Marker=Gd,Je.MercatorCoordinate=Wd,Je.NavigationControl=Bd,Je.Point=ha,Je.Popup=jd,Je.RasterDEMTileSource=em,Je.RasterTileSource=tm,Je.ReferenceMapStyle=Io,Je.ScaleControl=Vd,Je.SdkConfig=Fh,Je.ServiceError=On,Je.Style=qd,Je.TerrainControl=$d,Je.VectorTileSource=im,Je.VideoSource=rm,Je.addProtocol=um,Je.clearPrewarmedResources=sm,Je.clearStorage=cm,Je.config=Fi,Je.coordinates=id,Je.data=sd,Je.geocoding=Jp,Je.geolocation=Nl,Je.getRTLTextPluginStatus=Rd,Je.maxParallelImageRequests=lm,Je.prewarm=nm,Je.removeProtocol=pm,Je.setRTLTextPlugin=Dd,Je.staticMaps=md,Je.supported=Ld,Je.version=am,Je.workerCount=om,Je.workerUrl=hm,Object.defineProperty(Je,"__esModule",{value:!0})});
579
+ `,document.addEventListener("keydown",a=>{a.key===t&&(this._metaPress=!0)}),document.addEventListener("keyup",a=>{a.key===t&&(this._metaPress=!1)}),this._canvasContainer.addEventListener("wheel",a=>{this._onCooperativeGesture(a,this._metaPress,1)},!1),this._canvasContainer.classList.remove("maplibregl-touch-drag-pan")}_resizeCanvas(o,t,n){this._canvas.width=n*o,this._canvas.height=n*t,this._canvas.style.width=`${o}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const o=c.extend({},be.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1});let t=null;this._canvas.addEventListener("webglcontextcreationerror",a=>{t={requestedAttributes:o},a&&(t.statusMessage=a.statusMessage,t.type=a.type)},{once:!0});const n=this._canvas.getContext("webgl",o)||this._canvas.getContext("experimental-webgl",o);if(!n){const a="Failed to initialize WebGL";throw t?(t.message=a,new Error(JSON.stringify(t))):new Error(a)}this.painter=new Ho(n,this.transform),c.exported$1.testSupport(n)}_contextLost(o){o.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new c.Event("webglcontextlost",{originalEvent:o}))}_contextRestored(o){this._setupPainter(),this.resize(),this._update(),this.fire(new c.Event("webglcontextrestored",{originalEvent:o}))}_onMapScroll(o){if(o.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(o,t,n){return!t&&n<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(o){return this.style?(this._styleDirty=this._styleDirty||o,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(o){return this._update(),this._renderTaskQueue.add(o)}_cancelRenderFrame(o){this._renderTaskQueue.remove(o)}_render(o){let t,n=0;const a=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(t=a.createQueryEXT(),a.beginQueryEXT(a.TIME_ELAPSED_EXT,t),n=c.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(o),this._removed)return;let h=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const m=this.transform.zoom,_=c.exported.now();this.style.zoomHistory.update(m,_);const y=new c.EvaluationParameters(m,{now:_,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),b=y.crossFadingFactor();b===1&&b===this._crossFadingFactor||(h=!0,this._crossFadingFactor=b),this.style.update(y)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain&&this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.updateElevation(this.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new c.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.PerformanceUtils.mark(c.PerformanceMarkers.load),this.fire(new c.Event("load"))),this.style&&(this.style.hasTransitions()||h)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const m=c.exported.now()-n;a.endQueryEXT(a.TIME_ELAPSED_EXT,t),setTimeout(()=>{const _=a.getQueryObjectEXT(t,a.QUERY_RESULT_EXT)/1e6;a.deleteQueryEXT(t),this.fire(new c.Event("gpu-timing-frame",{cpuTime:m,gpuTime:_}))},50)}if(this.listens("gpu-timing-layer")){const m=this.painter.collectGpuTimers();setTimeout(()=>{const _=this.painter.queryGpuTimers(m);this.fire(new c.Event("gpu-timing-layer",{layerTimes:_}))},50)}const d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new c.Event("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,c.PerformanceUtils.mark(c.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));const o=this.painter.context.gl.getExtension("WEBGL_lose_context");o&&o.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),K.remove(this._canvasContainer),K.remove(this._controlContainer),this._cooperativeGestures&&K.remove(this._cooperativeGesturesScreen),this._container.classList.remove("maplibregl-map"),c.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new c.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=c.exported.frame(o=>{c.PerformanceUtils.frame(o),this._frame=null,this._render(o)}))}_onWindowOnline(){this._update()}_onWindowResize(o){this._trackResize&&this.resize({originalEvent:o})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(o){this._showTileBoundaries!==o&&(this._showTileBoundaries=o,this._update())}get showPadding(){return!!this._showPadding}set showPadding(o){this._showPadding!==o&&(this._showPadding=o,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(o){this._showCollisionBoxes!==o&&(this._showCollisionBoxes=o,o?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(o){this._showOverdrawInspector!==o&&(this._showOverdrawInspector=o,this._update())}get repaint(){return!!this._repaint}set repaint(o){this._repaint!==o&&(this._repaint=o,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(o){this._vertices=o,this._update()}_setCacheLimits(o,t){c.setCacheLimits(o,t)}get version(){return We}getCameraTargetElevation(){return this.transform.elevation}},NavigationControl:class{constructor(o){this.options=c.extend({},Wa,o),this._container=K.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(c.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),K.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),K.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(c.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=K.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const o=this._map.getZoom(),t=o===this._map.getMaxZoom(),n=o===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){const o=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=o}onAdd(o){return this._map=o,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 Ha(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){K.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(o,t){const n=K.create("button",o,this._container);return n.type="button",n.addEventListener("click",t),n}_setButtonTitle(o,t){const n=this._map._getUIString(`NavigationControl.${t}`);o.title=n,o.setAttribute("aria-label",n)}},GeolocateControl:class extends c.Evented{constructor(o){super(),this.options=c.extend({},Hs,o),c.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(o){var t;return this._map=o,this._container=K.create("div","maplibregl-ctrl maplibregl-ctrl-group"),t=this._setupUI,Lt!==void 0?t(Lt):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(n=>{Lt=n.state!=="denied",t(Lt)}):(Lt=!!window.navigator.geolocation,t(Lt)),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(),K.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Ht=0,Pn=!1}_isOutOfMapMaxBounds(o){const t=this._map.getMaxBounds(),n=o.coords;return t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_onSuccess(o){if(this._map){if(this._isOutOfMapMaxBounds(o))return this._setErrorState(),this.fire(new c.Event("outofmaxbounds",o)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=o,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(o),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(o),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new c.Event("geolocate",o)),this._finish()}}_updateCamera(o){const t=new c.LngLat(o.coords.longitude,o.coords.latitude),n=o.coords.accuracy,a=this._map.getBearing(),h=c.extend({bearing:a},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(n),h,{geolocateSource:!0})}_updateMarker(o){if(o){const t=new c.LngLat(o.coords.longitude,o.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=o.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const o=this._map._container.clientHeight/2,t=this._map.unproject([0,o]),n=this._map.unproject([1,o]),a=t.distanceTo(n),h=Math.ceil(2*this._accuracy/a);this._circleElement.style.width=`${h}px`,this._circleElement.style.height=`${h}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(o){if(this._map){if(this.options.trackUserLocation)if(o.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 t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(o.code===3&&Pn)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.Event("error",o)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(o){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=K.create("button","maplibregl-ctrl-geolocate",this._container),K.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",o===!1){c.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=K.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ka(this._dotElement),this._circleElement=K.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ka({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",t=>{t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||t.originalEvent&&t.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new c.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return c.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new c.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Ht--,Pn=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new c.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new c.Event("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let o;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Ht++,Ht>1?(o={maximumAge:6e5,timeout:0},Pn=!0):(o=this.options.positionOptions,Pn=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,o)}}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)}},AttributionControl:Gi,LogoControl:Nt,ScaleControl:class{constructor(o){this.options=c.extend({},ps,o),c.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){ms(this._map,this._container,this.options)}onAdd(o){return this._map=o,this._container=K.create("div","maplibregl-ctrl maplibregl-ctrl-scale",o.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){K.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(o){this.options.unit=o,ms(this._map,this._container,this.options)}},FullscreenControl:class{constructor(o={}){this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,o&&o.container&&(o.container instanceof HTMLElement?this._container=o.container:c.warnOnce("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(o){return this._map=o,this._container||(this._container=this._map.getContainer()),this._controlContainer=K.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){K.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const o=this._fullscreenButton=K.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);K.create("span","maplibregl-ctrl-icon",o).setAttribute("aria-hidden","true"),o.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const o=this._getTitle();this._fullscreenButton.setAttribute("aria-label",o),this._fullscreenButton.title=o}_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()}_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()}},TerrainControl:class{constructor(o){this.options=o,c.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(o){return this._map=o,this._container=K.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=K.create("button","maplibregl-ctrl-terrain",this._container),K.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(){K.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends c.Evented{constructor(o){super(),this.options=c.extend(Object.create(Ja),o),c.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(o){return this._map&&this.remove(),this._map=o,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new c.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&K.remove(this._content),this._container&&(K.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new c.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(o){return this._lngLat=c.LngLat.convert(o),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(o){return this.setDOMContent(document.createTextNode(o))}setHTML(o){const t=document.createDocumentFragment(),n=document.createElement("body");let a;for(n.innerHTML=o;a=n.firstChild,a;)t.appendChild(a);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(o){return this.options.maxWidth=o,this._update(),this}setDOMContent(o){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=K.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(o),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(o){this._container&&this._container.classList.add(o)}removeClassName(o){this._container&&this._container.classList.remove(o)}setOffset(o){return this.options.offset=o,this._update(),this}toggleClassName(o){if(this._container)return this._container.classList.toggle(o)}_createCloseButton(){this.options.closeButton&&(this._closeButton=K.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(o){this._update(o.point)}_onMouseMove(o){this._update(o.point)}_onDrag(o){this._update(o.point)}_update(o){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=K.create("div","maplibregl-popup",this._map.getContainer()),this._tip=K.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(d=>this._container.classList.add(d)),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Ei(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!o))return;const t=this._pos=this._trackPointer&&o?o:this._map.project(this._lngLat);let n=this.options.anchor;const a=kn(this.options.offset);if(!n){const d=this._container.offsetWidth,m=this._container.offsetHeight;let _;_=t.y+a.bottom.y<m?["top"]:t.y>this._map.transform.height-m?["bottom"]:[],t.x<d/2?_.push("left"):t.x>this._map.transform.width-d/2&&_.push("right"),n=_.length===0?"bottom":_.join("-")}const h=t.add(a[n]).round();K.setTransform(this._container,`${Mn[n]} translate(${h.x}px,${h.y}px)`),cr(this._container,n,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const o=this._container.querySelector(Ya);o&&o.focus()}_onClose(){this.remove()}},Marker:Ka,Style:di,LngLat:c.LngLat,LngLatBounds:c.LngLatBounds,Point:c.pointGeometry,MercatorCoordinate:c.MercatorCoordinate,Evented:c.Evented,AJAXError:c.AJAXError,config:c.config,CanvasSource:Ur,GeoJSONSource:Or,ImageSource:zi,RasterDEMTileSource:sr,RasterTileSource:un,VectorTileSource:hn,VideoSource:Zr,prewarm:function(){Xr().acquire(Ar)},clearPrewarmedResources:function(){const o=Oi;o&&(o.isPreloaded()&&o.numActive()===1?(o.release(Ar),Oi=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()"))},get version(){return Qa},get workerCount(){return ar.workerCount},set workerCount(o){ar.workerCount=o},get maxParallelImageRequests(){return c.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(o){c.config.MAX_PARALLEL_IMAGE_REQUESTS=o},clearStorage(o){c.clearTileCache(o)},workerUrl:"",addProtocol(o,t){c.config.REGISTERED_PROTOCOLS[o]=t},removeProtocol(o){delete c.config.REGISTERED_PROTOCOLS[o]}};return Za.extend(fs,{isSafari:c.isSafari,getPerformanceMetrics:c.PerformanceUtils.getPerformanceMetrics}),fs});var oe=ie;return oe})})(th);var ut=Ad(th.exports);const ih="3.7.4",Cd=ih,Md=typeof atob=="function",Pd=typeof btoa=="function",ws=typeof Buffer=="function",rh=typeof TextDecoder=="function"?new TextDecoder:void 0,nh=typeof TextEncoder=="function"?new TextEncoder:void 0,kd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",oa=Array.prototype.slice.call(kd),yo=(I=>{let v={};return I.forEach((k,j)=>v[k]=j),v})(oa),zd=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,bi=String.fromCharCode.bind(String),sh=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):(I,v=k=>k)=>new Uint8Array(Array.prototype.slice.call(I,0).map(v)),ah=I=>I.replace(/=/g,"").replace(/[+\/]/g,v=>v=="+"?"-":"_"),oh=I=>I.replace(/[^A-Za-z0-9\+\/]/g,""),lh=I=>{let v,k,j,ie,me="";const oe=I.length%3;for(let c=0;c<I.length;){if((k=I.charCodeAt(c++))>255||(j=I.charCodeAt(c++))>255||(ie=I.charCodeAt(c++))>255)throw new TypeError("invalid character found");v=k<<16|j<<8|ie,me+=oa[v>>18&63]+oa[v>>12&63]+oa[v>>6&63]+oa[v&63]}return oe?me.slice(0,oe-3)+"===".substring(oe):me},Dl=Pd?I=>btoa(I):ws?I=>Buffer.from(I,"binary").toString("base64"):lh,Rl=ws?I=>Buffer.from(I).toString("base64"):I=>{let k=[];for(let j=0,ie=I.length;j<ie;j+=4096)k.push(bi.apply(null,I.subarray(j,j+4096)));return Dl(k.join(""))},xo=(I,v=!1)=>v?ah(Rl(I)):Rl(I),Ld=I=>{if(I.length<2){var v=I.charCodeAt(0);return v<128?I:v<2048?bi(192|v>>>6)+bi(128|v&63):bi(224|v>>>12&15)+bi(128|v>>>6&63)+bi(128|v&63)}else{var v=65536+(I.charCodeAt(0)-55296)*1024+(I.charCodeAt(1)-56320);return bi(240|v>>>18&7)+bi(128|v>>>12&63)+bi(128|v>>>6&63)+bi(128|v&63)}},Dd=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,ch=I=>I.replace(Dd,Ld),hh=ws?I=>Buffer.from(I,"utf8").toString("base64"):nh?I=>Rl(nh.encode(I)):I=>Dl(ch(I)),Ts=(I,v=!1)=>v?ah(hh(I)):hh(I),uh=I=>Ts(I,!0),Rd=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Bd=I=>{switch(I.length){case 4:var v=(7&I.charCodeAt(0))<<18|(63&I.charCodeAt(1))<<12|(63&I.charCodeAt(2))<<6|63&I.charCodeAt(3),k=v-65536;return bi((k>>>10)+55296)+bi((k&1023)+56320);case 3:return bi((15&I.charCodeAt(0))<<12|(63&I.charCodeAt(1))<<6|63&I.charCodeAt(2));default:return bi((31&I.charCodeAt(0))<<6|63&I.charCodeAt(1))}},dh=I=>I.replace(Rd,Bd),ph=I=>{if(I=I.replace(/\s+/g,""),!zd.test(I))throw new TypeError("malformed base64.");I+="==".slice(2-(I.length&3));let v,k="",j,ie;for(let me=0;me<I.length;)v=yo[I.charAt(me++)]<<18|yo[I.charAt(me++)]<<12|(j=yo[I.charAt(me++)])<<6|(ie=yo[I.charAt(me++)]),k+=j===64?bi(v>>16&255):ie===64?bi(v>>16&255,v>>8&255):bi(v>>16&255,v>>8&255,v&255);return k},Bl=Md?I=>atob(oh(I)):ws?I=>Buffer.from(I,"base64").toString("binary"):ph,mh=ws?I=>sh(Buffer.from(I,"base64")):I=>sh(Bl(I),v=>v.charCodeAt(0)),fh=I=>mh(gh(I)),Fd=ws?I=>Buffer.from(I,"base64").toString("utf8"):rh?I=>rh.decode(mh(I)):I=>dh(Bl(I)),gh=I=>oh(I.replace(/[-_]/g,v=>v=="-"?"+":"/")),Fl=I=>Fd(gh(I)),Od=I=>{if(typeof I!="string")return!1;const v=I.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(v)||!/[^\s0-9a-zA-Z\-_]/.test(v)},_h=I=>({value:I,enumerable:!1,writable:!0,configurable:!0}),yh=function(){const I=(v,k)=>Object.defineProperty(String.prototype,v,_h(k));I("fromBase64",function(){return Fl(this)}),I("toBase64",function(v){return Ts(this,v)}),I("toBase64URI",function(){return Ts(this,!0)}),I("toBase64URL",function(){return Ts(this,!0)}),I("toUint8Array",function(){return fh(this)})},xh=function(){const I=(v,k)=>Object.defineProperty(Uint8Array.prototype,v,_h(k));I("toBase64",function(v){return xo(this,v)}),I("toBase64URI",function(){return xo(this,!0)}),I("toBase64URL",function(){return xo(this,!0)})},Ud={version:ih,VERSION:Cd,atob:Bl,atobPolyfill:ph,btoa:Dl,btoaPolyfill:lh,fromBase64:Fl,toBase64:Ts,encode:Ts,encodeURI:uh,encodeURL:uh,utob:ch,btou:dh,decode:Fl,isValid:Od,fromUint8Array:xo,toUint8Array:fh,extendString:yh,extendUint8Array:xh,extendBuiltins:()=>{yh(),xh()}};let vo;const Vd=new Uint8Array(16);function Nd(){if(!vo&&(vo=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!vo))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return vo(Vd)}const wi=[];for(let I=0;I<256;++I)wi.push((I+256).toString(16).slice(1));function $d(I,v=0){return(wi[I[v+0]]+wi[I[v+1]]+wi[I[v+2]]+wi[I[v+3]]+"-"+wi[I[v+4]]+wi[I[v+5]]+"-"+wi[I[v+6]]+wi[I[v+7]]+"-"+wi[I[v+8]]+wi[I[v+9]]+"-"+wi[I[v+10]]+wi[I[v+11]]+wi[I[v+12]]+wi[I[v+13]]+wi[I[v+14]]+wi[I[v+15]]).toLowerCase()}var vh={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Gd(I,v,k){if(vh.randomUUID&&!v&&!I)return vh.randomUUID();I=I||{};const j=I.random||(I.rng||Nd)();if(j[6]=j[6]&15|64,j[8]=j[8]&63|128,v){k=k||0;for(let ie=0;ie<16;++ie)v[k+ie]=j[ie];return v}return $d(j)}var Ol={exports:{}},Ss=typeof Reflect=="object"?Reflect:null,bh=Ss&&typeof Ss.apply=="function"?Ss.apply:function(v,k,j){return Function.prototype.apply.call(v,k,j)},bo;Ss&&typeof Ss.ownKeys=="function"?bo=Ss.ownKeys:Object.getOwnPropertySymbols?bo=function(v){return Object.getOwnPropertyNames(v).concat(Object.getOwnPropertySymbols(v))}:bo=function(v){return Object.getOwnPropertyNames(v)};function jd(I){console&&console.warn&&console.warn(I)}var wh=Number.isNaN||function(v){return v!==v};function Dt(){Dt.init.call(this)}Ol.exports=Dt,Ol.exports.once=Wd,Dt.EventEmitter=Dt,Dt.prototype._events=void 0,Dt.prototype._eventsCount=0,Dt.prototype._maxListeners=void 0;var Th=10;function wo(I){if(typeof I!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof I)}Object.defineProperty(Dt,"defaultMaxListeners",{enumerable:!0,get:function(){return Th},set:function(I){if(typeof I!="number"||I<0||wh(I))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+I+".");Th=I}}),Dt.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Dt.prototype.setMaxListeners=function(v){if(typeof v!="number"||v<0||wh(v))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+v+".");return this._maxListeners=v,this};function Sh(I){return I._maxListeners===void 0?Dt.defaultMaxListeners:I._maxListeners}Dt.prototype.getMaxListeners=function(){return Sh(this)},Dt.prototype.emit=function(v){for(var k=[],j=1;j<arguments.length;j++)k.push(arguments[j]);var ie=v==="error",me=this._events;if(me!==void 0)ie=ie&&me.error===void 0;else if(!ie)return!1;if(ie){var oe;if(k.length>0&&(oe=k[0]),oe instanceof Error)throw oe;var c=new Error("Unhandled error."+(oe?" ("+oe.message+")":""));throw c.context=oe,c}var be=me[v];if(be===void 0)return!1;if(typeof be=="function")bh(be,this,k);else for(var Je=be.length,lt=Mh(be,Je),j=0;j<Je;++j)bh(lt[j],this,k);return!0};function Eh(I,v,k,j){var ie,me,oe;if(wo(k),me=I._events,me===void 0?(me=I._events=Object.create(null),I._eventsCount=0):(me.newListener!==void 0&&(I.emit("newListener",v,k.listener?k.listener:k),me=I._events),oe=me[v]),oe===void 0)oe=me[v]=k,++I._eventsCount;else if(typeof oe=="function"?oe=me[v]=j?[k,oe]:[oe,k]:j?oe.unshift(k):oe.push(k),ie=Sh(I),ie>0&&oe.length>ie&&!oe.warned){oe.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+oe.length+" "+String(v)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=I,c.type=v,c.count=oe.length,jd(c)}return I}Dt.prototype.addListener=function(v,k){return Eh(this,v,k,!1)},Dt.prototype.on=Dt.prototype.addListener,Dt.prototype.prependListener=function(v,k){return Eh(this,v,k,!0)};function qd(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Ih(I,v,k){var j={fired:!1,wrapFn:void 0,target:I,type:v,listener:k},ie=qd.bind(j);return ie.listener=k,j.wrapFn=ie,ie}Dt.prototype.once=function(v,k){return wo(k),this.on(v,Ih(this,v,k)),this},Dt.prototype.prependOnceListener=function(v,k){return wo(k),this.prependListener(v,Ih(this,v,k)),this},Dt.prototype.removeListener=function(v,k){var j,ie,me,oe,c;if(wo(k),ie=this._events,ie===void 0)return this;if(j=ie[v],j===void 0)return this;if(j===k||j.listener===k)--this._eventsCount===0?this._events=Object.create(null):(delete ie[v],ie.removeListener&&this.emit("removeListener",v,j.listener||k));else if(typeof j!="function"){for(me=-1,oe=j.length-1;oe>=0;oe--)if(j[oe]===k||j[oe].listener===k){c=j[oe].listener,me=oe;break}if(me<0)return this;me===0?j.shift():Zd(j,me),j.length===1&&(ie[v]=j[0]),ie.removeListener!==void 0&&this.emit("removeListener",v,c||k)}return this},Dt.prototype.off=Dt.prototype.removeListener,Dt.prototype.removeAllListeners=function(v){var k,j,ie;if(j=this._events,j===void 0)return this;if(j.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):j[v]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete j[v]),this;if(arguments.length===0){var me=Object.keys(j),oe;for(ie=0;ie<me.length;++ie)oe=me[ie],oe!=="removeListener"&&this.removeAllListeners(oe);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(k=j[v],typeof k=="function")this.removeListener(v,k);else if(k!==void 0)for(ie=k.length-1;ie>=0;ie--)this.removeListener(v,k[ie]);return this};function Ah(I,v,k){var j=I._events;if(j===void 0)return[];var ie=j[v];return ie===void 0?[]:typeof ie=="function"?k?[ie.listener||ie]:[ie]:k?Xd(ie):Mh(ie,ie.length)}Dt.prototype.listeners=function(v){return Ah(this,v,!0)},Dt.prototype.rawListeners=function(v){return Ah(this,v,!1)},Dt.listenerCount=function(I,v){return typeof I.listenerCount=="function"?I.listenerCount(v):Ch.call(I,v)},Dt.prototype.listenerCount=Ch;function Ch(I){var v=this._events;if(v!==void 0){var k=v[I];if(typeof k=="function")return 1;if(k!==void 0)return k.length}return 0}Dt.prototype.eventNames=function(){return this._eventsCount>0?bo(this._events):[]};function Mh(I,v){for(var k=new Array(v),j=0;j<v;++j)k[j]=I[j];return k}function Zd(I,v){for(;v+1<I.length;v++)I[v]=I[v+1];I.pop()}function Xd(I){for(var v=new Array(I.length),k=0;k<v.length;++k)v[k]=I[k].listener||I[k];return v}function Wd(I,v){return new Promise(function(k,j){function ie(oe){I.removeListener(v,me),j(oe)}function me(){typeof I.removeListener=="function"&&I.removeListener("error",ie),k([].slice.call(arguments))}Ph(I,v,me,{once:!0}),v!=="error"&&Hd(I,ie,{once:!0})})}function Hd(I,v,k){typeof I.on=="function"&&Ph(I,"error",v,k)}function Ph(I,v,k,j){if(typeof I.on=="function")j.once?I.once(v,k):I.on(v,k);else if(typeof I.addEventListener=="function")I.addEventListener(v,function ie(me){j.once&&I.removeEventListener(v,ie),k(me)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof I)}const Lr={AUTO:"auto",LATIN:"latin",NON_LATIN:"nonlatin",LOCAL:"",ALBANIAN:"sq",AMHARIC:"am",ARABIC:"ar",ARMENIAN:"hy",AZERBAIJANI:"az",BASQUE:"eu",BELORUSSIAN:"be",BOSNIAN:"bs",BRETON:"br",BULGARIAN:"bg",CATALAN:"ca",CHINESE:"zh",CORSICAN:"co",CROATIAN:"hr",CZECH:"cs",DANISH:"da",DUTCH:"nl",ENGLISH:"en",ESPERANTO:"eo",ESTONIAN:"et",FINNISH:"fi",FRENCH:"fr",FRISIAN:"fy",GEORGIAN:"ka",GERMAN:"de",GREEK:"el",HEBREW:"he",HINDI:"hi",HUNGARIAN:"hu",ICELANDIC:"is",INDONESIAN:"id",IRISH:"ga",ITALIAN:"it",JAPANESE:"ja",JAPANESE_HIRAGANA:"ja-Hira",JAPANESE_KANA:"ja_kana",JAPANESE_LATIN:"ja_rm",JAPANESE_2018:"ja-Latn",KANNADA:"kn",KAZAKH:"kk",KOREAN:"ko",KOREAN_LATIN:"ko-Latn",KURDISH:"ku",ROMAN_LATIN:"la",LATVIAN:"lv",LITHUANIAN:"lt",LUXEMBOURGISH:"lb",MACEDONIAN:"mk",MALAYALAM:"ml",MALTESE:"mt",NORWEGIAN:"no",OCCITAN:"oc",POLISH:"pl",PORTUGUESE:"pt",ROMANIAN:"ro",ROMANSH:"rm",RUSSIAN:"ru",SCOTTISH_GAELIC:"gd",SERBIAN_CYRILLIC:"sr",SERBIAN_LATIN:"sr-Latn",SLOVAK:"sk",SLOVENE:"sl",SPANISH:"es",SWEDISH:"sv",TAMIL:"ta",TELUGU:"te",THAI:"th",TURKISH:"tr",UKRAINIAN:"uk",WELSH:"cy"},Kd=new Set(Object.values(Lr));function kh(I){return Kd.has(I)}const Jd=new Set(Object.values(Lr));function Ul(){if(typeof navigator>"u")return Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];const I=Array.from(new Set(navigator.languages.map(v=>v.split("-")[0]))).filter(v=>Jd.has(v));return I.length?I[0]:Lr.LATIN}function Yd(){return typeof self<"u"?fetch.bind(self):typeof global<"u"&&global.fetch?global.fetch:null}class Qd{constructor(){this._apiKey="",this._fetch=Yd()}set apiKey(v){this._apiKey=v}get apiKey(){return this._apiKey}set fetch(v){this._fetch=v}get fetch(){return this._fetch}}const rr=new Qd,la={AUTO:"auto",ALBANIAN:"sq",ARABIC:"ar",ARMENIAN:"hy",AZERBAIJANI:"az",BELORUSSIAN:"be",BOSNIAN:"bs",BRETON:"br",BULGARIAN:"bg",CATALAN:"ca",CHINESE:"zh",CROATIAN:"hr",CZECH:"cs",DANISH:"da",DUTCH:"nl",ENGLISH:"en",ESPERANTO:"eo",ESTONIAN:"et",FINNISH:"fi",FRENCH:"fr",FRISIAN:"fy",GEORGIAN:"ka",GERMAN:"de",GREEK:"el",HEBREW:"he",HUNGARIAN:"hu",ICELANDIC:"is",IRISH:"ga",ITALIAN:"it",JAPANESE:"ja",KANNADA:"kn",KAZAKH:"kk",KOREAN:"ko",ROMAN_LATIN:"la",LATVIAN:"lv",LITHUANIAN:"lt",LUXEMBOURGISH:"lb",MACEDONIAN:"mk",MALTESE:"mt",NORWEGIAN:"no",POLISH:"pl",PORTUGUESE:"pt",ROMANIAN:"ro",ROMANSH:"rm",RUSSIAN:"ru",SCOTTISH_GAELIC:"gd",SERBIAN_CYRILLIC:"sr",SLOVAK:"sk",SLOVENE:"sl",SPANISH:"es",SWEDISH:"sv",THAI:"th",TURKISH:"tr",UKRAINIAN:"uk",WELSH:"cy"},ep=new Set(Object.values(la));function tp(){if(typeof navigator>"u")return Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];const I=Array.from(new Set(navigator.languages.map(v=>v.split("-")[0]))).filter(v=>ep.has(v));return I.length?I[0]:la.ENGLISH}var ip=(I,v,k)=>new Promise((j,ie)=>{var me=be=>{try{c(k.next(be))}catch(Je){ie(Je)}},oe=be=>{try{c(k.throw(be))}catch(Je){ie(Je)}},c=be=>be.done?j(be.value):Promise.resolve(be.value).then(me,oe);c((k=k.apply(I,v)).next())});function Un(I){return ip(this,arguments,function*(v,k={}){if(rr.fetch===null)throw new Error("The fetch function was not found. If on NodeJS < 18 please specify the fetch function with config.fetch");if(new URL(v).searchParams.get("key").trim()==="")throw new Error("The MapTiler Cloud API key is missing. Set it in `config.apiKey` or get one for free at https://maptiler.com");return rr.fetch(v,k)})}const br={maptilerApiURL:"https://api.maptiler.com/",mapStyle:"streets-v2"};Object.freeze(br);class on extends Error{constructor(v,k=""){super(`Call to enpoint ${v.url} failed with the status code ${v.status}. ${k}`),this.res=v}}var Vl=(I,v,k)=>new Promise((j,ie)=>{var me=be=>{try{c(k.next(be))}catch(Je){ie(Je)}},oe=be=>{try{c(k.throw(be))}catch(Je){ie(Je)}},c=be=>be.done?j(be.value):Promise.resolve(be.value).then(me,oe);c((k=k.apply(I,v)).next())});const Nl={400:"Query too long / Invalid parameters",403:"Key is missing, invalid or restricted"};function zh(I,v){if(v.language==null)return;const k=Array.from(new Set((Array.isArray(v.language)?v.language:[v.language]).map(j=>j===la.AUTO?tp():j))).join(",");I.set("language",k)}function Lh(I,v){var k;I.set("key",(k=v.apiKey)!=null?k:rr.apiKey),v.limit!=null&&I.set("limit",String(v.limit)),v.types!=null&&I.set("types",v.types.join(",")),zh(I,v)}function rp(I){return Vl(this,arguments,function*(v,k={}){var j;if(typeof v!="string"||v.trim().length===0)throw new Error("The query must be a non-empty string");const ie=new URL(`geocoding/${encodeURIComponent(v)}.json`,br.maptilerApiURL),{searchParams:me}=ie;Lh(me,k),k.bbox!=null&&me.set("bbox",k.bbox.join(",")),k.proximity!=null&&me.set("proximity",k.proximity.join(",")),k.country!=null&&me.set("country",k.country.join(",")),k.fuzzyMatch!=null&&me.set("fuzzyMatch",k.fuzzyMatch?"true":"false"),k.autocomplete!=null&&me.set("autocomplete",k.autocomplete?"true":"false");const oe=ie.toString(),c=yield Un(oe);if(!c.ok)throw new on(c,(j=Nl[c.status])!=null?j:"");return yield c.json()})}function np(I){return Vl(this,arguments,function*(v,k={}){var j;if(!Array.isArray(v)||v.length<2)throw new Error("The position must be an array of form [lng, lat].");const ie=new URL(`geocoding/${v[0]},${v[1]}.json`,br.maptilerApiURL);Lh(ie.searchParams,k);const me=ie.toString(),oe=yield Un(me);if(!oe.ok)throw new on(oe,(j=Nl[oe.status])!=null?j:"");return yield oe.json()})}function sp(I){return Vl(this,arguments,function*(v,k={}){var j;const ie=new URL(`geocoding/${v}.json`,br.maptilerApiURL);zh(ie.searchParams,k);const me=ie.toString(),oe=yield Un(me);if(!oe.ok)throw new on(oe,(j=Nl[oe.status])!=null?j:"");return yield oe.json()})}const ap={forward:rp,reverse:np,byId:sp,language:la};var op=(I,v,k)=>new Promise((j,ie)=>{var me=be=>{try{c(k.next(be))}catch(Je){ie(Je)}},oe=be=>{try{c(k.throw(be))}catch(Je){ie(Je)}},c=be=>be.done?j(be.value):Promise.resolve(be.value).then(me,oe);c((k=k.apply(I,v)).next())});const Dh={403:"Key is missing, invalid or restricted"};function lp(){return op(this,arguments,function*(I={}){var v;const k=new URL("geolocation/ip.json",br.maptilerApiURL);k.searchParams.set("key",(v=I.apiKey)!=null?v:rr.apiKey);const j=k.toString(),ie=yield Un(j);if(!ie.ok)throw new on(ie,ie.status in Dh?Dh[ie.status]:"");return yield ie.json()})}const $l={info:lp};var Rh=(I,v,k)=>new Promise((j,ie)=>{var me=be=>{try{c(k.next(be))}catch(Je){ie(Je)}},oe=be=>{try{c(k.throw(be))}catch(Je){ie(Je)}},c=be=>be.done?j(be.value):Promise.resolve(be.value).then(me,oe);c((k=k.apply(I,v)).next())});const To={403:"Key is missing, invalid or restricted"};function cp(I){return Rh(this,arguments,function*(v,k={}){var j;if(typeof v!="string"||v.trim().length===0)throw new Error("The query must be a non-empty string");const ie=new URL(`coordinates/search/${v}.json`,br.maptilerApiURL);ie.searchParams.set("key",(j=k.apiKey)!=null?j:rr.apiKey),"limit"in k&&ie.searchParams.set("limit",k.limit.toString()),"transformations"in k&&ie.searchParams.set("transformations",k.transformations.toString()),"exports"in k&&ie.searchParams.set("exports",k.exports.toString());const me=ie.toString(),oe=yield Un(me);if(!oe.ok)throw new on(oe,oe.status in To?To[oe.status]:"");return yield oe.json()})}function hp(I){return Rh(this,arguments,function*(v,k={}){var j;const ie=(Array.isArray(v[0])?v:[v]).map(Je=>`${Je[0]},${Je[1]}`).join(";"),me=new URL(`coordinates/transform/${ie}.json`,br.maptilerApiURL);me.searchParams.set("key",(j=k.apiKey)!=null?j:rr.apiKey),"sourceCrs"in k&&me.searchParams.set("s_srs",k.sourceCrs.toString()),"targetCrs"in k&&me.searchParams.set("t_srs",k.targetCrs.toString()),"operations"in k&&me.searchParams.set("ops",(Array.isArray(k.operations)?k.operations:[k.operations]).join("|"));const oe=me.toString(),c=yield Un(oe);if(!c.ok)throw new on(c,c.status in To?To[c.status]:"");return yield c.json()})}const up={search:cp,transform:hp};var dp=(I,v,k)=>new Promise((j,ie)=>{var me=be=>{try{c(k.next(be))}catch(Je){ie(Je)}},oe=be=>{try{c(k.throw(be))}catch(Je){ie(Je)}},c=be=>be.done?j(be.value):Promise.resolve(be.value).then(me,oe);c((k=k.apply(I,v)).next())});const Bh={403:"Key is missing, invalid or restricted"};function pp(I){return dp(this,arguments,function*(v,k={}){var j;if(typeof v!="string"||v.trim().length===0)throw new Error("The data ID must be a non-empty string");const ie=new URL(`data/${encodeURIComponent(v)}/features.json`,br.maptilerApiURL);ie.searchParams.set("key",(j=k.apiKey)!=null?j:rr.apiKey);const me=ie.toString(),oe=yield Un(me);if(!oe.ok)throw new on(oe,oe.status in Bh?Bh[oe.status]:"");return yield oe.json()})}const mp={get:pp};function Fh(I){const v=/^maptiler:\/\/(.*)/;let k;const j=I.trim();let ie;return j.startsWith("http://")||j.startsWith("https://")?ie=j:(k=v.exec(j))!==null?ie=`https://api.maptiler.com/maps/${k[1]}/style.json`:ie=`https://api.maptiler.com/maps/${j}/style.json`,ie}class So{constructor(v,k,j,ie,me,oe){this.name=v,this.variantType=k,this.id=j,this.referenceStyle=ie,this.description=me,this.imageURL=oe}getName(){return this.name}getFullName(){return`${this.referenceStyle.getName()} ${this.name}`}getType(){return this.variantType}getId(){return this.id}getDescription(){return this.description}getReferenceStyle(){return this.referenceStyle}hasVariant(v){return this.referenceStyle.hasVariant(v)}getVariant(v){return this.referenceStyle.getVariant(v)}getVariants(){return this.referenceStyle.getVariants().filter(v=>v!==this)}getImageURL(){return this.imageURL}getExpandedStyleURL(){return Fh(this.getId())}}class Eo{constructor(v,k){this.name=v,this.id=k,this.variants={},this.orderedVariants=[]}getName(){return this.name}getId(){return this.id}addVariant(v){this.variants[v.getType()]=v,this.orderedVariants.push(v)}hasVariant(v){return v in this.variants}getVariant(v){return v in this.variants?this.variants[v]:this.orderedVariants[0]}getVariants(){return Object.values(this.variants)}getDefaultVariant(){return this.orderedVariants[0]}}const Io=[{referenceStyleID:"STREETS",name:"Streets",description:"",variants:[{id:"streets-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"streets-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"streets-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"streets-v2-night",name:"Night",variantType:"NIGHT",description:"",imageURL:""},{id:"streets-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OUTDOOR",name:"Outdoor",description:"",variants:[{id:"outdoor-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"outdoor-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"WINTER",name:"Winter",description:"",variants:[{id:"winter-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"winter-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"SATELLITE",name:"Satellite",description:"",variants:[{id:"satellite",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"HYBRID",name:"Hybrid",description:"",variants:[{id:"hybrid",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"BASIC",name:"Basic",description:"",variants:[{id:"basic-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"basic-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"basic-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BRIGHT",name:"Bright",description:"",variants:[{id:"bright-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"bright-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"bright-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"bright-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OPENSTREETMAP",name:"OpenStreetMap",description:"",variants:[{id:"openstreetmap",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"TOPO",name:"Topo",description:"",variants:[{id:"topo-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"topo-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"topo-v2-shiny",name:"Shiny",variantType:"SHINY",description:"",imageURL:""},{id:"topo-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""},{id:"topo-v2-topographique",name:"Topographique",variantType:"TOPOGRAPHIQUE",description:"",imageURL:""}]},{referenceStyleID:"VOYAGER",name:"Voyager",description:"",variants:[{id:"voyager-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"voyager-v2-darkmatter",name:"Darkmatter",variantType:"DARK",description:"",imageURL:""},{id:"voyager-v2-positron",name:"Positron",variantType:"LIGHT",description:"",imageURL:""},{id:"voyager-v2-vintage",name:"Vintage",variantType:"VINTAGE",description:"",imageURL:""}]},{referenceStyleID:"TONER",name:"Toner",description:"",variants:[{id:"toner-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"toner-v2-background",name:"Background",variantType:"BACKGROUND",description:"",imageURL:""},{id:"toner-v2-lite",name:"Lite",variantType:"LITE",description:"",imageURL:""},{id:"toner-v2-lines",name:"Lines",variantType:"LINES",description:"",imageURL:""}]},{referenceStyleID:"DATAVIZ",name:"Dataviz",description:"",variants:[{id:"dataviz",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"dataviz-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"dataviz-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"OCEAN",name:"Ocean",description:"",variants:[{id:"ocean",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]}];function fp(I){return new Proxy(I,{get(v,k,j){return v.hasVariant(k)?v.getVariant(k):k.toString().toUpperCase()===k?I.getDefaultVariant():Reflect.get(v,k,j)}})}function gp(){const I={};for(let v=0;v<Io.length;v+=1){const k=Io[v],j=fp(new Eo(k.name,k.referenceStyleID));for(let ie=0;ie<k.variants.length;ie+=1){const me=k.variants[ie],oe=new So(me.name,me.variantType,me.id,j,me.description,me.imageURL);j.addVariant(oe)}I[k.referenceStyleID]=j}return I}function Gl(I){if(!I)return jl[Io[0].referenceStyleID].getDefaultVariant().getId();if(typeof I=="string"||I instanceof String)return I.trim().toLowerCase();if(I instanceof So)return I.getId();if(I instanceof Eo)return I.getDefaultVariant().getId()}const jl=gp();function _p(I,v,k){let j=v[0],ie=v[1],me=k[0]-j,oe=k[1]-ie;if(me!==0||oe!==0){const c=((I[0]-j)*me+(I[1]-ie)*oe)/(me*me+oe*oe);c>1?(j=k[0],ie=k[1]):c>0&&(j+=me*c,ie+=oe*c)}return me=I[0]-j,oe=I[1]-ie,me*me+oe*oe}function ql(I,v,k,j,ie){let me=j,oe;for(let c=v+1;c<k;c++){const be=_p(I[c],I[v],I[k]);be>me&&(oe=c,me=be)}me>j&&(oe-v>1&&ql(I,v,oe,j,ie),ie.push(I[oe]),k-oe>1&&ql(I,oe,k,j,ie))}function yp(I,v){const k=I.length-1,j=[I[0]];return ql(I,0,k,v,j),j.push(I[k]),j}function xp(I,v){if(I.length<=2)return I;const k=v!==void 0?v*v:1;return yp(I,k)}function Zl(I,v=!0){let k=`${I[0]},${I[1]}`;return I.length===3&&v&&(k+=`,${I[2]}`),k}function Xl(I,v=3e3){let k=I.map(me=>me.join(",")).join("|"),j=5e-6;const ie=1e-5;for(;k.length>v;)k=xp(I,j).map(oe=>`${oe[0]},${oe[1]}`).join("|"),j+=ie;return k}function vp(I,v,k={}){var j,ie,me,oe,c;const be=Gl(k.style),Je=k.hiDPI?"@2x":"",lt=(j=k.format)!=null?j:"png";let Et=~~((ie=k.width)!=null?ie:1024),Me=~~((me=k.height)!=null?me:1024);k.hiDPI&&(Et=~~(Et/2),Me=~~(Me/2));const K=new URL(`maps/${encodeURIComponent(be)}/static/${I[0]},${I[1]},${v}/${Et}x${Me}${Je}.${lt}`,br.maptilerApiURL);if("attribution"in k&&K.searchParams.set("attribution",k.attribution.toString()),"markers"in k){let Ye="";const ii="markerIcon"in k;ii&&(Ye+=`icon:${k.markerIcon}|`),ii&&"markerAnchor"in k&&(Ye+=`anchor:${k.markerAnchor}|`),ii&&k.hiDPI&&(Ye+="scale:2|"),Ye+=(Array.isArray(k.markers[0])?k.markers:[k.markers]).map(Rt=>Zl(Rt,!ii)).join("|"),K.searchParams.set("markers",Ye)}if("path"in k){let Ye="";Ye+=`fill:${(oe=k.pathFillColor)!=null?oe:"none"}|`,"pathStrokeColor"in k&&(Ye+=`stroke:${k.pathStrokeColor}|`),"pathWidth"in k&&(Ye+=`width:${(k.pathWidth/(k.hiDPI?2:1)).toString()}|`),Ye+=Xl(k.path),K.searchParams.set("path",Ye)}return K.searchParams.set("key",(c=k.apiKey)!=null?c:rr.apiKey),K.toString()}function bp(I,v={}){var k,j,ie,me,oe;const c=Gl(v.style),be=v.hiDPI?"@2x":"",Je=(k=v.format)!=null?k:"png";let lt=~~((j=v.width)!=null?j:1024),Et=~~((ie=v.height)!=null?ie:1024);v.hiDPI&&(lt=~~(lt/2),Et=~~(Et/2));const Me=new URL(`maps/${encodeURIComponent(c)}/static/${I[0]},${I[1]},${I[2]},${I[3]}/${lt}x${Et}${be}.${Je}`,br.maptilerApiURL);if("attribution"in v&&Me.searchParams.set("attribution",v.attribution.toString()),"padding"in v&&Me.searchParams.set("padding",v.padding.toString()),"markers"in v){let K="";const Ye="markerIcon"in v;Ye&&(K+=`icon:${v.markerIcon}|`),Ye&&"markerAnchor"in v&&(K+=`anchor:${v.markerAnchor}|`),Ye&&v.hiDPI&&(K+="scale:2|"),K+=(Array.isArray(v.markers[0])?v.markers:[v.markers]).map(Yt=>Zl(Yt,!Ye)).join("|"),Me.searchParams.set("markers",K)}if("path"in v){let K="";K+=`fill:${(me=v.pathFillColor)!=null?me:"none"}|`,"pathStrokeColor"in v&&(K+=`stroke:${v.pathStrokeColor}|`),"pathWidth"in v&&(K+=`width:${(v.pathWidth/(v.hiDPI?2:1)).toString()}|`),K+=Xl(v.path),Me.searchParams.set("path",K)}return Me.searchParams.set("key",(oe=v.apiKey)!=null?oe:rr.apiKey),Me.toString()}function wp(I={}){var v,k,j,ie,me;if(!("markers"in I)&&!("path"in I))throw new Error("Automatic static maps require markers and/or path to be created.");const oe=Gl(I.style),c=I.hiDPI?"@2x":"",be=(v=I.format)!=null?v:"png";let Je=~~((k=I.width)!=null?k:1024),lt=~~((j=I.height)!=null?j:1024);I.hiDPI&&(Je=~~(Je/2),lt=~~(lt/2));const Et=new URL(`maps/${encodeURIComponent(oe)}/static/auto/${Je}x${lt}${c}.${be}`,br.maptilerApiURL);if("attribution"in I&&Et.searchParams.set("attribution",I.attribution.toString()),"padding"in I&&Et.searchParams.set("padding",I.padding.toString()),"markers"in I){let Me="";const K="markerIcon"in I;K&&(Me+=`icon:${I.markerIcon}|`),K&&"markerAnchor"in I&&(Me+=`anchor:${I.markerAnchor}|`),K&&I.hiDPI&&(Me+="scale:2|"),Me+=(Array.isArray(I.markers[0])?I.markers:[I.markers]).map(ii=>Zl(ii,!K)).join("|"),Et.searchParams.set("markers",Me)}if("path"in I){let Me="";Me+=`fill:${(ie=I.pathFillColor)!=null?ie:"none"}|`,"pathStrokeColor"in I&&(Me+=`stroke:${I.pathStrokeColor}|`),"pathWidth"in I&&(Me+=`width:${(I.pathWidth/(I.hiDPI?2:1)).toString()}|`),Me+=Xl(I.path),Et.searchParams.set("path",Me)}return Et.searchParams.set("key",(me=I.apiKey)!=null?me:rr.apiKey),Et.toString()}const Tp={centered:vp,bounded:bp,automatic:wp};class Oh extends Ol.exports{constructor(){super(),this.primaryLanguage=Lr.AUTO,this.secondaryLanguage=null,this.session=!0,this._unit="metric",this._apiKey=""}set unit(v){this._unit=v,this.emit("unit",v)}get unit(){return this._unit}set apiKey(v){this._apiKey=v,rr.apiKey=v,this.emit("apiKey",v)}get apiKey(){return this._apiKey}set fetch(v){rr.fetch=v}get fetch(){return rr.fetch}}const wr=new Oh,Hi={maptilerLogoURL:"https://api.maptiler.com/resources/logo.svg",maptilerURL:"https://www.maptiler.com/",maptilerApiHost:"api.maptiler.com",rtlPluginURL:"https://cdn.maptiler.com/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.min.js",primaryLanguage:Lr.AUTO,secondaryLanguage:Lr.LOCAL,terrainSourceURL:"https://api.maptiler.com/tiles/terrain-rgb-v2/tiles.json",terrainSourceId:"maptiler-terrain"};Object.freeze(Hi);class Uh extends ut.LogoControl{onAdd(v){return super.onAdd(v)}}class Wl extends Uh{constructor(v={}){var k,j;super(v),this.logoURL="",this.linkURL="",this.logoURL=(k=v.logoURL)!=null?k:Hi.maptilerLogoURL,this.linkURL=(j=v.linkURL)!=null?j:Hi.maptilerURL}onAdd(v){this._map=v,this._compact=this.options&&this.options.compact,this._container=window.document.createElement("div"),this._container.className="maplibregl-ctrl";const k=window.document.createElement("a");return k.style.backgroundRepeat="no-repeat",k.style.cursor="pointer",k.style.display="block",k.style.height="23px",k.style.margin="0 0 -4px -4px",k.style.overflow="hidden",k.style.width="88px",k.style.backgroundImage=`url(${this.logoURL})`,k.style.backgroundSize="100px 30px",k.style.width="100px",k.style.height="30px",k.target="_blank",k.rel="noopener nofollow",k.href=this.linkURL,k.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),k.setAttribute("rel","noopener nofollow"),this._container.appendChild(k),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}}function Sp(){ut.getRTLTextPluginStatus()==="unavailable"&&ut.setRTLTextPlugin(Hi.rtlPluginURL,null,!0)}function Ep(I,v){I.forEach(k=>{!v[k]||(v[k]=v[k].bind(v))})}function Vn(I,v,k){const j=window.document.createElement(I);return v!==void 0&&(j.className=v),k&&k.appendChild(j),j}function Ip(I){I.parentNode&&I.parentNode.removeChild(I)}function Vh(I){return I?typeof I=="string"||I instanceof String?!I.startsWith("http")&&I.toLowerCase().includes(".json")?I:Fh(I):I instanceof So?I.getExpandedStyleURL():I instanceof Eo?I.getDefaultVariant().getExpandedStyleURL():I:jl[Io[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL()}class Nh{constructor(){Ep(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(v){return this._map=v,this._container=Vn("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=Vn("button","maplibregl-ctrl-terrain",this._container),Vn("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(){Ip(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.hasTerrain()?this._map.disableTerrain():this._map.enableTerrain(),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.hasTerrain()?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}}class $h extends ut.NavigationControl{onAdd(v){return super.onAdd(v)}}class Ap extends $h{constructor(){super({showCompass:!0,showZoom:!0,visualizePitch:!0}),this._compass.removeEventListener("click",this._compass.clickFunction),this._compass.addEventListener("click",v=>{this._map.getPitch()===0?this._map.easeTo({pitch:Math.min(this._map.getMaxPitch(),80)}):this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:v}):this._map.resetNorth({},{originalEvent:v})})}_createButton(v,k){const j=super._createButton(v,k);return j.clickFunction=k,j}_rotateCompassArrow(){const v=this.options.visualizePitch?`scale(${Math.min(1.5,1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5))}) rotateX(${Math.min(70,this._map.transform.pitch)}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=v}}class Gh extends ut.GeolocateControl{onAdd(v){return super.onAdd(v)}}var Cp=Object.defineProperty,Mp=Object.defineProperties,Pp=Object.getOwnPropertyDescriptors,jh=Object.getOwnPropertySymbols,kp=Object.prototype.hasOwnProperty,zp=Object.prototype.propertyIsEnumerable,qh=(I,v,k)=>v in I?Cp(I,v,{enumerable:!0,configurable:!0,writable:!0,value:k}):I[v]=k,Lp=(I,v)=>{for(var k in v||(v={}))kp.call(v,k)&&qh(I,k,v[k]);if(jh)for(var k of jh(v))zp.call(v,k)&&qh(I,k,v[k]);return I},Dp=(I,v)=>Mp(I,Pp(v));const Zh=ut.Marker,Xh=ut.LngLat;class Wh extends Gh{constructor(){super(...arguments),this.lastUpdatedCenter=new Xh(0,0)}_updateCamera(v){const k=new Xh(v.coords.longitude,v.coords.latitude),j=v.coords.accuracy,ie=this._map.getBearing(),me=Dp(Lp({bearing:ie},this.options.fitBoundsOptions),{linear:!0}),oe=this._map.getZoom();oe>this.options.fitBoundsOptions.maxZoom&&(me.zoom=oe),this._map.fitBounds(k.toBounds(j),me,{geolocateSource:!0});let c=!1;const be=()=>{c=!0};this._map.once("click",be),this._map.once("dblclick",be),this._map.once("dragstart",be),this._map.once("mousedown",be),this._map.once("touchstart",be),this._map.once("wheel",be),this._map.once("moveend",()=>{this._map.off("click",be),this._map.off("dblclick",be),this._map.off("dragstart",be),this._map.off("mousedown",be),this._map.off("touchstart",be),this._map.off("wheel",be),!c&&(this.lastUpdatedCenter=this._map.getCenter())})}_setupUI(v){if(this.lastUpdatedCenter=this._map.getCenter(),this._container.addEventListener("contextmenu",k=>k.preventDefault()),this._geolocateButton=Vn("button","maplibregl-ctrl-geolocate",this._container),Vn("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",v===!1){const k=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=k,this._geolocateButton.setAttribute("aria-label",k)}else{const k=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=k,this._geolocateButton.setAttribute("aria-label",k)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=Vn("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Zh(this._dotElement),this._circleElement=Vn("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Zh({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("move",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("moveend",k=>{const j=k.originalEvent&&k.originalEvent.type==="resize",ie=this.lastUpdatedCenter.distanceTo(this._map.getCenter());!k.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!j&&ie>1&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new Event("trackuserlocationend")))})}_updateCircleRadius(){if(this._watchState!=="BACKGROUND"&&this._watchState!=="ACTIVE_LOCK")return;const v=[this._lastKnownPosition.coords.longitude,this._lastKnownPosition.coords.latitude],k=this._map.project(v),j=this._map.unproject([k.x,k.y]),ie=this._map.unproject([k.x+20,k.y]),me=j.distanceTo(ie)/20,oe=Math.ceil(2*this._accuracy/me);this._circleElement.style.width=`${oe}px`,this._circleElement.style.height=`${oe}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}}class Hh extends ut.AttributionControl{onAdd(v){return super.onAdd(v)}}class Kh extends ut.ScaleControl{onAdd(v){return super.onAdd(v)}}class Jh extends ut.FullscreenControl{onAdd(v){return super.onAdd(v)}}var Rp=Object.defineProperty,Bp=Object.defineProperties,Fp=Object.getOwnPropertyDescriptors,Yh=Object.getOwnPropertySymbols,Op=Object.prototype.hasOwnProperty,Up=Object.prototype.propertyIsEnumerable,Qh=(I,v,k)=>v in I?Rp(I,v,{enumerable:!0,configurable:!0,writable:!0,value:k}):I[v]=k,eu=(I,v)=>{for(var k in v||(v={}))Op.call(v,k)&&Qh(I,k,v[k]);if(Yh)for(var k of Yh(v))Up.call(v,k)&&Qh(I,k,v[k]);return I},tu=(I,v)=>Bp(I,Fp(v)),ca=(I,v,k)=>new Promise((j,ie)=>{var me=be=>{try{c(k.next(be))}catch(Je){ie(Je)}},oe=be=>{try{c(k.throw(be))}catch(Je){ie(Je)}},c=be=>be.done?j(be.value):Promise.resolve(be.value).then(me,oe);c((k=k.apply(I,v)).next())});const iu=Gd(),ru={POINT:"POINT",COUNTRY:"COUNTRY"};class Vp extends ut.Map{constructor(v){var k,j;v.apiKey&&(wr.apiKey=v.apiKey);const ie=Vh(v.style),me=location.hash;wr.apiKey||console.warn("MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!"),super(tu(eu({},v),{style:ie,maplibreLogo:!1,transformRequest:oe=>{let c=null;try{c=new URL(oe)}catch{return{url:oe,headers:{}}}return c.host===Hi.maptilerApiHost&&(c.searchParams.has("key")||c.searchParams.append("key",wr.apiKey),wr.session&&c.searchParams.append("mtsid",iu)),{url:c.href,headers:{}}}})),this.isTerrainEnabled=!1,this.terrainExaggeration=1,this.primaryLanguage=null,this.secondaryLanguage=null,this.primaryLanguage=(k=v.language)!=null?k:wr.primaryLanguage,this.secondaryLanguage=wr.secondaryLanguage,this.once("styledata",()=>ca(this,null,function*(){if(!v.geolocate||v.center||v.hash&&!!me)return;try{if(v.geolocate===ru.COUNTRY){yield this.fitToIpBounds();return}}catch(c){console.warn(c.message)}let oe=null;try{yield this.centerOnIpPoint(v.zoom),oe=this.getCameraHash()}catch(c){console.warn(c.message)}(yield navigator.permissions.query({name:"geolocation"})).state==="granted"&&navigator.geolocation.getCurrentPosition(c=>{oe===this.getCameraHash()&&this.easeTo({center:[c.coords.longitude,c.coords.latitude],zoom:v.zoom||12,duration:2e3})},null,{maximumAge:24*3600*1e3,timeout:5e3,enableHighAccuracy:!1})})),this.on("styledata",()=>{this.setPrimaryLanguage(this.primaryLanguage),this.setSecondaryLanguage(this.secondaryLanguage)}),this.on("styledata",()=>{this.getTerrain()===null&&this.isTerrainEnabled&&this.enableTerrain(this.terrainExaggeration)}),this.once("load",()=>ca(this,null,function*(){Sp()})),this.once("load",()=>ca(this,null,function*(){let oe={logo:null};try{const c=Object.keys(this.style.sourceCaches).map(Je=>this.getSource(Je)).filter(Je=>typeof Je.url=="string"&&Je.url.includes("tiles.json")),be=new URL(c[0].url);be.searchParams.has("key")||be.searchParams.append("key",wr.apiKey),oe=yield(yield fetch(be.href)).json()}catch{}if("logo"in oe&&oe.logo){const c=oe.logo;this.addControl(new Wl({logoURL:c}),v.logoPosition),v.attributionControl===!1&&this.addControl(new Hh(v))}else v.maptilerLogo&&this.addControl(new Wl,v.logoPosition);if(v.scaleControl){const c=v.scaleControl===!0||v.scaleControl===void 0?"bottom-right":v.scaleControl,be=new Kh({unit:wr.unit});this.addControl(be,c),wr.on("unit",Je=>{be.setUnit(Je)})}if(v.navigationControl!==!1){const c=v.navigationControl===!0||v.navigationControl===void 0?"top-right":v.navigationControl;this.addControl(new Ap,c)}if(v.geolocateControl!==!1){const c=v.geolocateControl===!0||v.geolocateControl===void 0?"top-right":v.geolocateControl;this.addControl(new Wh({positionOptions:{enableHighAccuracy:!0,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!0,showAccuracyCircle:!0,showUserLocation:!0}),c)}if(v.terrainControl){const c=v.terrainControl===!0||v.terrainControl===void 0?"top-right":v.terrainControl;this.addControl(new Nh,c)}if(v.fullscreenControl){const c=v.fullscreenControl===!0||v.fullscreenControl===void 0?"top-right":v.fullscreenControl;this.addControl(new Jh({}),c)}})),v.terrain&&this.enableTerrain((j=v.terrainExaggeration)!=null?j:this.terrainExaggeration)}setStyle(v,k){return super.setStyle(Vh(v),k)}setLanguage(v=Hi.primaryLanguage){if(v===Lr.AUTO)return this.setLanguage(Ul());this.setPrimaryLanguage(v)}setPrimaryLanguage(v=Hi.primaryLanguage){!kh(v)||(this.primaryLanguage=v,this.onStyleReady(()=>{if(v===Lr.AUTO)return this.setPrimaryLanguage(Ul());const k=this.getStyle().layers,j=/^\s*{\s*name\s*(:\s*(\S*))?\s*}$/,ie=/^\s*name\s*(:\s*(\S*))?\s*$/,me=/^\s*{\s*name\s*(:\s*(\S*))?\s*}(\s*){\s*name\s*(:\s*(\S*))?\s*}$/,oe=/^(.*)({\s*name\s*(:\s*(\S*))?\s*})(.*)$/,c=v?`name:${v}`:"name",be=["case",["has",c],["get",c],["get","name:latin"]];for(let Je=0;Je<k.length;Je+=1){const lt=k[Je],Et=lt.layout;if(!Et||!Et["text-field"])continue;const Me=this.getLayoutProperty(lt.id,"text-field");let K;if(Array.isArray(Me)&&Me.length>=2&&Me[0].trim().toLowerCase()==="concat"){const Ye=Me.slice();for(let ii=0;ii<Me.length;ii+=1){const Yt=Me[ii];if((typeof Yt=="string"||Yt instanceof String)&&j.exec(Yt.toString())){Ye[ii]=be;break}else if(Array.isArray(Yt)&&Yt.length>=2&&Yt[0].trim().toLowerCase()==="get"&&ie.exec(Yt[1].toString())){Ye[ii]=be;break}else if(Array.isArray(Yt)&&Yt.length===4&&Yt[0].trim().toLowerCase()==="case"){Ye[ii]=be;break}}this.setLayoutProperty(lt.id,"text-field",Ye)}else if(Array.isArray(Me)&&Me.length>=2&&Me[0].trim().toLowerCase()==="get"&&ie.exec(Me[1].toString())){const Ye=be;this.setLayoutProperty(lt.id,"text-field",Ye)}else if((typeof Me=="string"||Me instanceof String)&&j.exec(Me.toString())){const Ye=be;this.setLayoutProperty(lt.id,"text-field",Ye)}else if(Array.isArray(Me)&&Me.length===4&&Me[0].trim().toLowerCase()==="case"){const Ye=be;this.setLayoutProperty(lt.id,"text-field",Ye)}else if((typeof Me=="string"||Me instanceof String)&&(K=me.exec(Me.toString()))!==null){const Ye=`{${c}}${K[3]}{name${K[4]||""}}`;this.setLayoutProperty(lt.id,"text-field",Ye)}else if((typeof Me=="string"||Me instanceof String)&&(K=oe.exec(Me.toString()))!==null){const Ye=`${K[1]}{${c}}${K[5]}`;this.setLayoutProperty(lt.id,"text-field",Ye)}}}))}setSecondaryLanguage(v=Hi.secondaryLanguage){!kh(v)||(this.secondaryLanguage=v,this.onStyleReady(()=>{if(v===Lr.AUTO)return this.setSecondaryLanguage(Ul());const k=this.getStyle().layers,j=/^\s*{\s*name\s*(:\s*(\S*))?\s*}$/,ie=/^\s*name\s*(:\s*(\S*))?\s*$/,me=/^\s*{\s*name\s*(:\s*(\S*))?\s*}(\s*){\s*name\s*(:\s*(\S*))?\s*}$/;let oe;for(let c=0;c<k.length;c+=1){const be=k[c],Je=be.layout;if(!Je||!Je["text-field"])continue;const lt=this.getLayoutProperty(be.id,"text-field");let Et;if(Array.isArray(lt)&&lt.length>=2&&lt[0].trim().toLowerCase()==="concat"){Et=lt.slice();let Me=0;for(let K=0;K<lt.length;K+=1){const Ye=lt[K];if((typeof Ye=="string"||Ye instanceof String)&&j.exec(Ye.toString())){if(Me===1){Et[K]=`{name:${v}}`;break}Me+=1}else if(Array.isArray(Ye)&&Ye.length>=2&&Ye[0].trim().toLowerCase()==="get"&&ie.exec(Ye[1].toString())){if(Me===1){Et[K][1]=`name:${v}`;break}Me+=1}else if(Array.isArray(Ye)&&Ye.length===4&&Ye[0].trim().toLowerCase()==="case"){if(Me===1){Et[K]=["get",`name:${v}`];break}Me+=1}}this.setLayoutProperty(be.id,"text-field",Et)}else if((typeof lt=="string"||lt instanceof String)&&(oe=me.exec(lt.toString()))!==null){const Me=v?`name:${v}`:"name";Et=`{name${oe[1]||""}}${oe[3]}{${Me}}`,this.setLayoutProperty(be.id,"text-field",Et)}}}))}getPrimaryLanguage(){return this.primaryLanguage}getSecondaryLanguage(){return this.secondaryLanguage}getTerrainExaggeration(){return this.terrainExaggeration}hasTerrain(){return this.isTerrainEnabled}enableTerrain(v=this.terrainExaggeration){if(v<0){console.warn("Terrain exaggeration cannot be negative.");return}const k=this.getTerrain(),j=()=>{this.isTerrainEnabled=!0,this.terrainExaggeration=v,this.addSource(Hi.terrainSourceId,{type:"raster-dem",url:Hi.terrainSourceURL}),this.setTerrain({source:Hi.terrainSourceId,exaggeration:v})};if(k){this.setTerrain(tu(eu({},k),{exaggeration:v}));return}this.loaded()||this.isTerrainEnabled?j():this.once("load",()=>{this.getTerrain()&&this.getSource(Hi.terrainSourceId)||j()})}disableTerrain(){this.isTerrainEnabled=!1,this.setTerrain(null),this.getSource(Hi.terrainSourceId)&&this.removeSource(Hi.terrainSourceId)}setTerrainExaggeration(v){this.enableTerrain(v)}onStyleReady(v){this.isStyleLoaded()?v():this.once("styledata",()=>{v()})}fitToIpBounds(){return ca(this,null,function*(){const v=yield $l.info();this.fitBounds(v.country_bounds,{duration:0,padding:100})})}centerOnIpPoint(v){return ca(this,null,function*(){const k=yield $l.info();this.jumpTo({center:[k.longitude,k.latitude],zoom:v||11})})}getCameraHash(){const v=new Float32Array(5),k=this.getCenter();return v[0]=k.lng,v[1]=k.lat,v[2]=this.getZoom(),v[3]=this.getPitch(),v[4]=this.getBearing(),Ud.fromUint8Array(new Uint8Array(v.buffer))}getSdkConfig(){return wr}getMaptilerSessionId(){return iu}}class Np extends ut.Marker{addTo(v){return super.addTo(v)}}class $p extends ut.Popup{addTo(v){return super.addTo(v)}}class Gp extends ut.Style{constructor(v,k={}){super(v,k)}}class jp extends ut.CanvasSource{onAdd(v){super.onAdd(v)}}class qp extends ut.GeoJSONSource{onAdd(v){super.onAdd(v)}}class Zp extends ut.ImageSource{onAdd(v){super.onAdd(v)}}class Xp extends ut.RasterTileSource{onAdd(v){super.onAdd(v)}}class Wp extends ut.RasterDEMTileSource{onAdd(v){super.onAdd(v)}}class Hp extends ut.VectorTileSource{onAdd(v){super.onAdd(v)}}class Kp extends ut.VideoSource{onAdd(v){super.onAdd(v)}}class Jp extends ut.TerrainControl{onAdd(v){return super.onAdd(v)}}class ha{constructor(v,k){this.x=v,this.y=k}_matMult(v){const k=v[0]*this.x+v[1]*this.y,j=v[2]*this.x+v[3]*this.y;return this.x=k,this.y=j,this}_add(v){return this.x+=v.x,this.y+=v.y,this}_sub(v){return this.x-=v.x,this.y-=v.y,this}_mult(v){return this.x*=v,this.y*=v,this}_div(v){return this.x/=v,this.y/=v,this}_multByPoint(v){return this.x*=v.x,this.y*=v.y,this}_divByPoint(v){return this.x/=v.x,this.y/=v.y,this}_unit(){return this._div(this.mag()),this}_perp(){const v=this.y;return this.y=this.x,this.x=-v,this}_rotate(v){const k=Math.cos(v),j=Math.sin(v),ie=k*this.x-j*this.y,me=j*this.x+k*this.y;return this.x=ie,this.y=me,this}_rotateAround(v,k){const j=Math.cos(v),ie=Math.sin(v),me=k.x+j*(this.x-k.x)-ie*(this.y-k.y),oe=k.y+ie*(this.x-k.x)+j*(this.y-k.y);return this.x=me,this.y=oe,this}_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}clone(){return new ha(this.x,this.y)}add(v){return this.clone()._add(v)}sub(v){return this.clone()._sub(v)}multByPoint(v){return this.clone()._multByPoint(v)}divByPoint(v){return this.clone()._divByPoint(v)}mult(v){return this.clone()._mult(v)}div(v){return this.clone()._div(v)}rotate(v){return this.clone()._rotate(v)}rotateAround(v,k){return this.clone()._rotateAround(v,k)}matMult(v){return this.clone()._matMult(v)}unit(){return this.clone()._unit()}perp(){return this.clone()._perp()}round(){return this.clone()._round()}mag(){return Math.sqrt(this.x*this.x+this.y*this.y)}equals(v){return this.x===v.x&&this.y===v.y}dist(v){return Math.sqrt(this.distSqr(v))}distSqr(v){const k=v.x-this.x,j=v.y-this.y;return k*k+j*j}angle(){return Math.atan2(this.y,this.x)}angleTo(v){return Math.atan2(this.y-v.y,this.x-v.x)}angleWith(v){return this.angleWithSep(v.x,v.y)}angleWithSep(v,k){return Math.atan2(this.x*k-this.y*v,this.x*v+this.y*k)}static convert(v){return v instanceof ha?v:Array.isArray(v)?new ha(v[0],v[1]):v}}const{supported:Yp,setRTLTextPlugin:Qp,getRTLTextPluginStatus:em,LngLat:tm,LngLatBounds:im,MercatorCoordinate:rm,Evented:nm,AJAXError:sm,prewarm:am,clearPrewarmedResources:om,version:lm,workerCount:cm,maxParallelImageRequests:hm,clearStorage:um,workerUrl:dm,addProtocol:pm,removeProtocol:mm}=ut,fm=ut.Map,gm=ut.Marker,_m=ut.Popup,ym=ut.Style,xm=ut.CanvasSource,vm=ut.GeoJSONSource,bm=ut.ImageSource,wm=ut.RasterTileSource,Tm=ut.RasterDEMTileSource,Sm=ut.VectorTileSource,Em=ut.VideoSource;ut.NavigationControl,ut.GeolocateControl,ut.AttributionControl,ut.LogoControl,ut.ScaleControl,ut.FullscreenControl,ut.TerrainControl,Ze.AJAXError=sm,Ze.AttributionControl=Hh,Ze.CanvasSource=jp,Ze.CanvasSourceMLGL=xm,Ze.Evented=nm,Ze.FullscreenControl=Jh,Ze.GeoJSONSource=qp,Ze.GeoJSONSourceMLGL=vm,Ze.GeolocateControl=Gh,Ze.GeolocationType=ru,Ze.ImageSource=Zp,Ze.ImageSourceMLGL=bm,Ze.Language=Lr,Ze.LanguageGeocoding=la,Ze.LngLat=tm,Ze.LngLatBounds=im,Ze.LogoControl=Uh,Ze.Map=Vp,Ze.MapMLGL=fm,Ze.MapStyle=jl,Ze.MapStyleVariant=So,Ze.MaptilerGeolocateControl=Wh,Ze.MaptilerLogoControl=Wl,Ze.MaptilerTerrainControl=Nh,Ze.Marker=Np,Ze.MarkerMLGL=gm,Ze.MercatorCoordinate=rm,Ze.NavigationControl=$h,Ze.Point=ha,Ze.Popup=$p,Ze.PopupMLGL=_m,Ze.RasterDEMTileSource=Wp,Ze.RasterDEMTileSourceMLGL=Tm,Ze.RasterTileSource=Xp,Ze.RasterTileSourceMLGL=wm,Ze.ReferenceMapStyle=Eo,Ze.ScaleControl=Kh,Ze.SdkConfig=Oh,Ze.ServiceError=on,Ze.Style=Gp,Ze.StyleMLGL=ym,Ze.TerrainControl=Jp,Ze.VectorTileSource=Hp,Ze.VectorTileSourceMLGL=Sm,Ze.VideoSource=Kp,Ze.VideoSourceMLGL=Em,Ze.addProtocol=pm,Ze.clearPrewarmedResources=om,Ze.clearStorage=um,Ze.config=wr,Ze.coordinates=up,Ze.data=mp,Ze.geocoding=ap,Ze.geolocation=$l,Ze.getRTLTextPluginStatus=em,Ze.maxParallelImageRequests=hm,Ze.prewarm=am,Ze.removeProtocol=mm,Ze.setRTLTextPlugin=Qp,Ze.staticMaps=Tp,Ze.supported=Yp,Ze.version=lm,Ze.workerCount=cm,Ze.workerUrl=dm,Object.defineProperty(Ze,"__esModule",{value:!0})});