@rcpch/imd-map 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/LICENSE +21 -0
- package/README.md +417 -0
- package/dist/index.d.ts +225 -0
- package/dist/index.esm.js +1571 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/umd/rcpch-imd-map.min.js +595 -0
- package/package.json +49 -0
|
@@ -0,0 +1,595 @@
|
|
|
1
|
+
"use strict";var RcpchImdMap=(()=>{var Kf=Object.create;var ec=Object.defineProperty;var Jf=Object.getOwnPropertyDescriptor;var Yf=Object.getOwnPropertyNames;var Qf=Object.getPrototypeOf,em=Object.prototype.hasOwnProperty;var tm=(R,X)=>()=>(X||R((X={exports:{}}).exports,X),X.exports),im=(R,X)=>{for(var re in X)ec(R,re,{get:X[re],enumerable:!0})},Id=(R,X,re,ce)=>{if(X&&typeof X=="object"||typeof X=="function")for(let I of Yf(X))!em.call(R,I)&&I!==re&&ec(R,I,{get:()=>X[I],enumerable:!(ce=Jf(X,I))||ce.enumerable});return R};var tc=(R,X,re)=>(re=R!=null?Kf(Qf(R)):{},Id(X||!R||!R.__esModule?ec(re,"default",{value:R,enumerable:!0}):re,R)),rm=R=>Id(ec({},"__esModule",{value:!0}),R);var Ha=tm((Ih,Ch)=>{"use strict";(function(R,X){typeof Ih=="object"&&typeof Ch<"u"?Ch.exports=X():typeof define=="function"&&define.amd?define(X):(R=typeof globalThis<"u"?globalThis:R||self,R.maplibregl=X())})(Ih,(function(){"use strict";var R={},X={};function re(I,p,Se){if(X[I]=Se,I==="index"){var Ce="var sharedModule = {}; ("+X.shared+")(sharedModule); ("+X.worker+")(sharedModule);",$e={};return X.shared($e),X.index(R,$e),typeof window<"u"&&R.setWorkerUrl(window.URL.createObjectURL(new Blob([Ce],{type:"text/javascript"}))),R}}re("shared",["exports"],(function(I){"use strict";function p(i,t,r,s){return new(r||(r=Promise))((function(l,u){function d(x){try{g(s.next(x))}catch(v){u(v)}}function f(x){try{g(s.throw(x))}catch(v){u(v)}}function g(x){var v;x.done?l(x.value):(v=x.value,v instanceof r?v:new r((function(w){w(v)}))).then(d,f)}g((s=s.apply(i,t||[])).next())}))}function Se(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}typeof SuppressedError=="function"&&SuppressedError;var Ce=$e;function $e(i,t){this.x=i,this.y=t}$e.prototype={clone:function(){return new $e(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,t){return this.clone()._rotateAround(i,t)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var t=i.x-this.x,r=i.y-this.y;return t*t+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,t){return Math.atan2(this.x*t-this.y*i,this.x*i+this.y*t)},_matMult:function(i){var t=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=t,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var t=Math.cos(i),r=Math.sin(i),s=r*this.x+t*this.y;return this.x=t*this.x-r*this.y,this.y=s,this},_rotateAround:function(i,t){var r=Math.cos(i),s=Math.sin(i),l=t.y+s*(this.x-t.x)+r*(this.y-t.y);return this.x=t.x+r*(this.x-t.x)-s*(this.y-t.y),this.y=l,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},$e.convert=function(i){return i instanceof $e?i:Array.isArray(i)?new $e(i[0],i[1]):i};var pe=Se(Ce),K=ht;function ht(i,t,r,s){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(s-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=t,this.p2x=r,this.p2y=s}ht.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,t){if(t===void 0&&(t=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,s=0;s<8;s++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)<t)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)<t));s++)i>l?d=r:f=r,r=.5*(f-d)+d;return r},solve:function(i,t){return this.sampleCurveY(this.solveCurveX(i,t))}};var Dt=Se(K);let Nt,Jt;function li(){return Nt==null&&(Nt=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Nt}function $i(){if(Jt==null&&(Jt=!1,li())){let t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let s=0;s<25;s++){let l=4*s;t.fillStyle=`rgb(${l},${l+1},${l+2})`,t.fillRect(s%5,Math.floor(s/5),1,1)}let r=t.getImageData(0,0,5,5).data;for(let s=0;s<100;s++)if(s%4!=3&&r[s]!==s){Jt=!0;break}}}return Jt||!1}function et(i,t,r,s){let l=new Dt(i,t,r,s);return u=>l.solve(u)}let He=et(.25,.1,.25,1);function Je(i,t,r){return Math.min(r,Math.max(t,i))}function Pt(i,t,r){let s=r-t,l=((i-t)%s+s)%s+t;return l===t?r:l}function Mt(i,...t){for(let r of t)for(let s in r)i[s]=r[s];return i}let Vt=1;function _t(i,t,r){let s={};for(let l in i)s[l]=t.call(this,i[l],l,i);return s}function yi(i,t,r){let s={};for(let l in i)t.call(this,i[l],l,i)&&(s[l]=i[l]);return s}function Ye(i){return Array.isArray(i)?i.map(Ye):typeof i=="object"&&i?_t(i,Ye):i}let Yt={};function ze(i){Yt[i]||(typeof console<"u"&&console.warn(i),Yt[i]=!0)}function tt(i,t,r){return(r.y-i.y)*(t.x-i.x)>(t.y-i.y)*(r.x-i.x)}function st(i){return typeof WorkerGlobalScope<"u"&&i!==void 0&&i instanceof WorkerGlobalScope}let Qt=null;function qt(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}let Qi="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function er(i,t,r,s,l){return p(this,void 0,void 0,(function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let u=new VideoFrame(i,{timestamp:0});try{let d=u?.format;if(!d||!d.startsWith("BGR")&&!d.startsWith("RGB"))throw new Error(`Unrecognized format ${d}`);let f=d.startsWith("BGR"),g=new Uint8ClampedArray(s*l*4);if(yield u.copyTo(g,(function(x,v,w,C,A){let k=4*Math.max(-v,0),z=(Math.max(0,w)-w)*C*4+k,O=4*C,j=Math.max(0,v),ie=Math.max(0,w);return{rect:{x:j,y:ie,width:Math.min(x.width,v+C)-j,height:Math.min(x.height,w+A)-ie},layout:[{offset:z,stride:O}]}})(i,t,r,s,l)),f)for(let x=0;x<g.length;x+=4){let v=g[x];g[x]=g[x+2],g[x+2]=v}return g}finally{u.close()}}))}let ci,Zt,tr="AbortError";function xn(){return new Error(tr)}let Or={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function yr(i){return Or.REGISTERED_PROTOCOLS[i.substring(0,i.indexOf("://"))]}let vn="global-dispatcher";class Di extends Error{constructor(t,r,s,l){super(`AJAXError: ${r} (${t}): ${s}`),this.status=t,this.statusText=r,this.url=s,this.body=l}}let ir=()=>st(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Yr=function(i,t){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){let s=yr(i.url);if(s)return s(i,t);if(st(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,targetMapId:vn},t)}if(!(/^file:/.test(r=i.url)||/^file:/.test(ir())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return(function(s,l){return p(this,void 0,void 0,(function*(){let u=new Request(s.url,{method:s.method||"GET",body:s.body,credentials:s.credentials,headers:s.headers,cache:s.cache,referrer:ir(),signal:l.signal});s.type!=="json"||u.headers.has("Accept")||u.headers.set("Accept","application/json");let d=yield fetch(u);if(!d.ok){let x=yield d.blob();throw new Di(d.status,d.statusText,s.url,x)}let f;f=s.type==="arrayBuffer"||s.type==="image"?d.arrayBuffer():s.type==="json"?d.json():d.text();let g=yield f;if(l.signal.aborted)throw xn();return{data:g,cacheControl:d.headers.get("Cache-Control"),expires:d.headers.get("Expires")}}))})(i,t);if(st(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,mustQueue:!0,targetMapId:vn},t)}var r;return(function(s,l){return new Promise(((u,d)=>{var f;let g=new XMLHttpRequest;g.open(s.method||"GET",s.url,!0),s.type!=="arrayBuffer"&&s.type!=="image"||(g.responseType="arraybuffer");for(let x in s.headers)g.setRequestHeader(x,s.headers[x]);s.type==="json"&&(g.responseType="text",!((f=s.headers)===null||f===void 0)&&f.Accept||g.setRequestHeader("Accept","application/json")),g.withCredentials=s.credentials==="include",g.onerror=()=>{d(new Error(g.statusText))},g.onload=()=>{if(!l.signal.aborted)if((g.status>=200&&g.status<300||g.status===0)&&g.response!==null){let x=g.response;if(s.type==="json")try{x=JSON.parse(g.response)}catch(v){return void d(v)}u({data:x,cacheControl:g.getResponseHeader("Cache-Control"),expires:g.getResponseHeader("Expires")})}else{let x=new Blob([g.response],{type:g.getResponseHeader("Content-Type")});d(new Di(g.status,g.statusText,s.url,x))}},l.signal.addEventListener("abort",(()=>{g.abort(),d(xn())})),g.send(s.body)}))})(i,t)};function Qr(i){if(!i||i.indexOf("://")<=0||i.indexOf("data:image/")===0||i.indexOf("blob:")===0)return!0;let t=new URL(i),r=window.location;return t.protocol===r.protocol&&t.host===r.host}function ls(i,t,r){r[i]&&r[i].indexOf(t)!==-1||(r[i]=r[i]||[],r[i].push(t))}function Er(i,t,r){if(r&&r[i]){let s=r[i].indexOf(t);s!==-1&&r[i].splice(s,1)}}class Nr{constructor(t,r={}){Mt(this,r),this.type=t}}class Vr extends Nr{constructor(t,r={}){super("error",Mt({error:t},r))}}class bn{on(t,r){return this._listeners=this._listeners||{},ls(t,r,this._listeners),this}off(t,r){return Er(t,r,this._listeners),Er(t,r,this._oneTimeListeners),this}once(t,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},ls(t,r,this._oneTimeListeners),this):new Promise((s=>this.once(t,s)))}fire(t,r){typeof t=="string"&&(t=new Nr(t,r||{}));let s=t.type;if(this.listens(s)){t.target=this;let l=this._listeners&&this._listeners[s]?this._listeners[s].slice():[];for(let f of l)f.call(this,t);let u=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(let f of u)Er(s,f,this._oneTimeListeners),f.call(this,t);let d=this._eventedParent;d&&(Mt(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(t))}else t instanceof Vr&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,r){return this._eventedParent=t,this._eventedParentData=r,this}}var oe={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};let en=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function cs(i,t){let r={};for(let s in i)s!=="ref"&&(r[s]=i[s]);return en.forEach((s=>{s in t&&(r[s]=t[s])})),r}function mt(i,t){if(Array.isArray(i)){if(!Array.isArray(t)||i.length!==t.length)return!1;for(let r=0;r<i.length;r++)if(!mt(i[r],t[r]))return!1;return!0}if(typeof i=="object"&&i!==null&&t!==null){if(typeof t!="object"||Object.keys(i).length!==Object.keys(t).length)return!1;for(let r in i)if(!mt(i[r],t[r]))return!1;return!0}return i===t}function Bt(i,t){i.push(t)}function hs(i,t,r){Bt(r,{command:"addSource",args:[i,t[i]]})}function Ur(i,t,r){Bt(t,{command:"removeSource",args:[i]}),r[i]=!0}function kr(i,t,r,s){Ur(i,r,s),hs(i,t,r)}function wn(i,t,r){let s;for(s in i[r])if(Object.prototype.hasOwnProperty.call(i[r],s)&&s!=="data"&&!mt(i[r][s],t[r][s]))return!1;for(s in t[r])if(Object.prototype.hasOwnProperty.call(t[r],s)&&s!=="data"&&!mt(i[r][s],t[r][s]))return!1;return!0}function qi(i,t,r,s,l,u){i=i||{},t=t||{};for(let d in i)Object.prototype.hasOwnProperty.call(i,d)&&(mt(i[d],t[d])||r.push({command:u,args:[s,d,t[d],l]}));for(let d in t)Object.prototype.hasOwnProperty.call(t,d)&&!Object.prototype.hasOwnProperty.call(i,d)&&(mt(i[d],t[d])||r.push({command:u,args:[s,d,t[d],l]}))}function us(i){return i.id}function ds(i,t){return i[t.id]=t,i}class ge{constructor(t,r,s,l){this.message=(t?`${t}: `:"")+s,l&&(this.identifier=l),r!=null&&r.__line__&&(this.line=r.__line__)}}function xr(i,...t){for(let r of t)for(let s in r)i[s]=r[s];return i}class xi extends Error{constructor(t,r){super(r),this.message=r,this.key=t}}class vr{constructor(t,r=[]){this.parent=t,this.bindings={};for(let[s,l]of r)this.bindings[s]=l}concat(t){return new vr(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}let jr={kind:"null"},ve={kind:"number"},it={kind:"string"},qe={kind:"boolean"},Ii={kind:"color"},rr={kind:"object"},Xe={kind:"value"},br={kind:"collator"},zr={kind:"formatted"},$r={kind:"padding"},wr={kind:"resolvedImage"},U={kind:"variableAnchorOffsetCollection"};function M(i,t){return{kind:"array",itemType:i,N:t}}function P(i){if(i.kind==="array"){let t=P(i.itemType);return typeof i.N=="number"?`array<${t}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${t}>`}return i.kind}let D=[jr,ve,it,qe,Ii,zr,rr,M(Xe),$r,wr,U];function N(i,t){if(t.kind==="error")return null;if(i.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!N(i.itemType,t.itemType))&&(typeof i.N!="number"||i.N===t.N))return null}else{if(i.kind===t.kind)return null;if(i.kind==="value"){for(let r of D)if(!N(r,t))return null}}return`Expected ${P(i)} but found ${P(t)} instead.`}function W(i,t){return t.some((r=>r.kind===i.kind))}function Y(i,t){return t.some((r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i))}function te(i,t){return i.kind==="array"&&t.kind==="array"?i.itemType.kind===t.itemType.kind&&typeof i.N=="number":i.kind===t.kind}let Z=.96422,le=.82521,de=4/29,se=6/29,_e=3*se*se,Ne=se*se*se,Ve=Math.PI/180,ut=180/Math.PI;function Ke(i){return(i%=360)<0&&(i+=360),i}function dt([i,t,r,s]){let l,u,d=Wt((.2225045*(i=ot(i))+.7168786*(t=ot(t))+.0606169*(r=ot(r)))/1);i===t&&t===r?l=u=d:(l=Wt((.4360747*i+.3850649*t+.1430804*r)/Z),u=Wt((.0139322*i+.0971045*t+.7141733*r)/le));let f=116*d-16;return[f<0?0:f,500*(l-d),200*(d-u),s]}function ot(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Wt(i){return i>Ne?Math.pow(i,1/3):i/_e+de}function Ft([i,t,r,s]){let l=(i+16)/116,u=isNaN(t)?l:l+t/500,d=isNaN(r)?l:l-r/200;return l=1*xt(l),u=Z*xt(u),d=le*xt(d),[rt(3.1338561*u-1.6168667*l-.4906146*d),rt(-.9787684*u+1.9161415*l+.033454*d),rt(.0719453*u-.2289914*l+1.4052427*d),s]}function rt(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function xt(i){return i>se?i*i*i:_e*(i-de)}function Rt(i){return parseInt(i.padEnd(2,i),16)/255}function ti(i,t){return si(t?i/100:i,0,1)}function si(i,t,r){return Math.min(Math.max(t,i),r)}function vi(i){return!i.some(Number.isNaN)}let Sn={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class vt{constructor(t,r,s,l=1,u=!0){this.r=t,this.g=r,this.b=s,this.a=l,u||(this.r*=l,this.g*=l,this.b*=l,l||this.overwriteGetter("rgb",[t,r,s,l]))}static parse(t){if(t instanceof vt)return t;if(typeof t!="string")return;let r=(function(s){if((s=s.toLowerCase().trim())==="transparent")return[0,0,0,0];let l=Sn[s];if(l){let[d,f,g]=l;return[d/255,f/255,g/255,1]}if(s.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(s)){let d=s.length<6?1:2,f=1;return[Rt(s.slice(f,f+=d)),Rt(s.slice(f,f+=d)),Rt(s.slice(f,f+=d)),Rt(s.slice(f,f+d)||"ff")]}if(s.startsWith("rgb")){let d=s.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){let[f,g,x,v,w,C,A,k,z,O,j,ie]=d,H=[v||" ",A||" ",O].join("");if(H===" "||H===" /"||H===",,"||H===",,,"){let ee=[x,C,z].join(""),ae=ee==="%%%"?100:ee===""?255:0;if(ae){let fe=[si(+g/ae,0,1),si(+w/ae,0,1),si(+k/ae,0,1),j?ti(+j,ie):1];if(vi(fe))return fe}}return}}let u=s.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(u){let[d,f,g,x,v,w,C,A,k]=u,z=[g||" ",v||" ",C].join("");if(z===" "||z===" /"||z===",,"||z===",,,"){let O=[+f,si(+x,0,100),si(+w,0,100),A?ti(+A,k):1];if(vi(O))return(function([j,ie,H,ee]){function ae(fe){let Me=(fe+j/30)%12,Ue=ie*Math.min(H,1-H);return H-Ue*Math.max(-1,Math.min(Me-3,9-Me,1))}return j=Ke(j),ie/=100,H/=100,[ae(0),ae(8),ae(4),ee]})(O)}}})(t);return r?new vt(...r,!1):void 0}get rgb(){let{r:t,g:r,b:s,a:l}=this,u=l||1/0;return this.overwriteGetter("rgb",[t/u,r/u,s/u,l])}get hcl(){return this.overwriteGetter("hcl",(function(t){let[r,s,l,u]=dt(t),d=Math.sqrt(s*s+l*l);return[Math.round(1e4*d)?Ke(Math.atan2(l,s)*ut):NaN,d,r,u]})(this.rgb))}get lab(){return this.overwriteGetter("lab",dt(this.rgb))}overwriteGetter(t,r){return Object.defineProperty(this,t,{value:r}),r}toString(){let[t,r,s,l]=this.rgb;return`rgba(${[t,r,s].map((u=>Math.round(255*u))).join(",")},${l})`}}vt.black=new vt(0,0,0,1),vt.white=new vt(1,1,1,1),vt.transparent=new vt(0,0,0,0),vt.red=new vt(1,0,0,1);class No{constructor(t,r,s){this.sensitivity=t?r?"variant":"case":r?"accent":"base",this.locale=s,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,r){return this.collator.compare(t,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Vo{constructor(t,r,s,l,u){this.text=t,this.image=r,this.scale=s,this.fontStack=l,this.textColor=u}}class Ri{constructor(t){this.sections=t}static fromString(t){return new Ri([new Vo(t,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some((t=>t.text.length!==0||t.image&&t.image.name.length!==0))}static factory(t){return t instanceof Ri?t:Ri.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map((t=>t.text)).join("")}}class Bi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Bi)return t;if(typeof t=="number")return new Bi([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(let r of t)if(typeof r!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new Bi(t)}}toString(){return JSON.stringify(this.values)}}let hc=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Zi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Zi)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let r=0;r<t.length;r+=2){let s=t[r],l=t[r+1];if(typeof s!="string"||!hc.has(s)||!Array.isArray(l)||l.length!==2||typeof l[0]!="number"||typeof l[1]!="number")return}return new Zi(t)}}toString(){return JSON.stringify(this.values)}}class Fi{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Fi({name:t,available:!1}):null}}function Tn(i,t,r,s){return typeof i=="number"&&i>=0&&i<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof r=="number"&&r>=0&&r<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[i,t,r,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[i,t,r,s]:[i,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function tn(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof vt||i instanceof No||i instanceof Ri||i instanceof Bi||i instanceof Zi||i instanceof Fi)return!0;if(Array.isArray(i)){for(let t of i)if(!tn(t))return!1;return!0}if(typeof i=="object"){for(let t in i)if(!tn(i[t]))return!1;return!0}return!1}function Xt(i){if(i===null)return jr;if(typeof i=="string")return it;if(typeof i=="boolean")return qe;if(typeof i=="number")return ve;if(i instanceof vt)return Ii;if(i instanceof No)return br;if(i instanceof Ri)return zr;if(i instanceof Bi)return $r;if(i instanceof Zi)return U;if(i instanceof Fi)return wr;if(Array.isArray(i)){let t=i.length,r;for(let s of i){let l=Xt(s);if(r){if(r===l)continue;r=Xe;break}r=l}return M(r||Xe,t)}return rr}function ps(i){let t=typeof i;return i===null?"":t==="string"||t==="number"||t==="boolean"?String(i):i instanceof vt||i instanceof Ri||i instanceof Bi||i instanceof Zi||i instanceof Fi?i.toString():JSON.stringify(i)}class nr{constructor(t,r){this.type=t,this.value=r}static parse(t,r){if(t.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!tn(t[1]))return r.error("invalid value");let s=t[1],l=Xt(s),u=r.expectedType;return l.kind!=="array"||l.N!==0||!u||u.kind!=="array"||typeof u.N=="number"&&u.N!==0||(l=u),new nr(l,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Gt{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}let Us={string:it,number:ve,boolean:qe,object:rr};class sr{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let s,l=1,u=t[0];if(u==="array"){let f,g;if(t.length>2){let x=t[1];if(typeof x!="string"||!(x in Us)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);f=Us[x],l++}else f=Xe;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return r.error('The length argument to "array" must be a positive integer literal',2);g=t[2],l++}s=M(f,g)}else{if(!Us[u])throw new Error(`Types doesn't contain name = ${u}`);s=Us[u]}let d=[];for(;l<t.length;l++){let f=r.parse(t[l],l,Xe);if(!f)return null;d.push(f)}return new sr(s,d)}evaluate(t){for(let r=0;r<this.args.length;r++){let s=this.args[r].evaluate(t);if(!N(this.type,Xt(s)))return s;if(r===this.args.length-1)throw new Gt(`Expected value to be of type ${P(this.type)}, but found ${P(Xt(s))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}let Uo={"to-boolean":qe,"to-color":Ii,"to-number":ve,"to-string":it};class or{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let s=t[0];if(!Uo[s])throw new Error(`Can't parse ${s} as it is not part of the known types`);if((s==="to-boolean"||s==="to-string")&&t.length!==2)return r.error("Expected one argument.");let l=Uo[s],u=[];for(let d=1;d<t.length;d++){let f=r.parse(t[d],d,Xe);if(!f)return null;u.push(f)}return new or(l,u)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let r,s;for(let l of this.args){if(r=l.evaluate(t),s=null,r instanceof vt)return r;if(typeof r=="string"){let u=t.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.`:Tn(r[0],r[1],r[2],r[3]),!s))return new vt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Gt(s||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(let s of this.args){r=s.evaluate(t);let l=Bi.parse(r);if(l)return l}throw new Gt(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(let s of this.args){r=s.evaluate(t);let l=Zi.parse(r);if(l)return l}throw new Gt(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(let s of this.args){if(r=s.evaluate(t),r===null)return 0;let l=Number(r);if(!isNaN(l))return l}throw new Gt(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return Ri.fromString(ps(this.args[0].evaluate(t)));case"resolvedImage":return Fi.fromString(ps(this.args[0].evaluate(t)));default:return ps(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}let uc=["Unknown","Point","LineString","Polygon"];class js{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?uc[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let r=this._parseColorCache[t];return r||(r=this._parseColorCache[t]=vt.parse(t)),r}}class rn{constructor(t,r,s=[],l,u=new vr,d=[]){this.registry=t,this.path=s,this.key=s.map((f=>`[${f}]`)).join(""),this.scope=u,this.errors=d,this.expectedType=l,this._isConstant=r}parse(t,r,s,l,u={}){return r?this.concat(r,s,l)._parse(t,u):this._parse(t,u)}_parse(t,r){function s(l,u,d){return d==="assert"?new sr(u,[l]):d==="coerce"?new or(u,[l]):l}if(t!==null&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"||(t=["literal",t]),Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let l=t[0];if(typeof l!="string")return this.error(`Expression name must be a string, but found ${typeof l} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let u=this.registry[l];if(u){let d=u.parse(t,this);if(!d)return null;if(this.expectedType){let f=this.expectedType,g=d.type;if(f.kind!=="string"&&f.kind!=="number"&&f.kind!=="boolean"&&f.kind!=="object"&&f.kind!=="array"||g.kind!=="value")if(f.kind!=="color"&&f.kind!=="formatted"&&f.kind!=="resolvedImage"||g.kind!=="value"&&g.kind!=="string")if(f.kind!=="padding"||g.kind!=="value"&&g.kind!=="number"&&g.kind!=="array")if(f.kind!=="variableAnchorOffsetCollection"||g.kind!=="value"&&g.kind!=="array"){if(this.checkSubtype(f,g))return null}else d=s(d,f,r.typeAnnotation||"coerce");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 nr)&&d.type.kind!=="resolvedImage"&&this._isConstant(d)){let f=new js;try{d=new nr(d.type,d.evaluate(f))}catch(g){return this.error(g.message),null}}return d}return this.error(`Unknown expression "${l}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(t===void 0?"'undefined' value invalid. Use null instead.":typeof t=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,r,s){let l=typeof t=="number"?this.path.concat(t):this.path,u=s?this.scope.concat(s):this.scope;return new rn(this.registry,this._isConstant,l,r||null,u,this.errors)}error(t,...r){let s=`${this.key}${r.map((l=>`[${l}]`)).join("")}`;this.errors.push(new xi(s,t))}checkSubtype(t,r){let s=N(t,r);return s&&this.error(s),s}}class qr{constructor(t,r){this.type=r.type,this.bindings=[].concat(t),this.result=r}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(let r of this.bindings)t(r[1]);t(this.result)}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);let s=[];for(let u=1;u<t.length-1;u+=2){let d=t[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);let f=r.parse(t[u+1],u+1);if(!f)return null;s.push([d,f])}let l=r.parse(t[t.length-1],t.length-1,r.expectedType,s);return l?new qr(s,l):null}outputDefined(){return this.result.outputDefined()}}class gt{constructor(t,r){this.type=r.type,this.name=t,this.boundExpression=r}static parse(t,r){if(t.length!==2||typeof t[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");let s=t[1];return r.scope.has(s)?new gt(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(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class jo{constructor(t,r,s){this.type=t,this.index=r,this.input=s}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let s=r.parse(t[1],1,ve),l=r.parse(t[2],2,M(r.expectedType||Xe));return s&&l?new jo(l.type.itemType,s,l):null}evaluate(t){let r=this.index.evaluate(t),s=this.input.evaluate(t);if(r<0)throw new Gt(`Array index out of bounds: ${r} < 0.`);if(r>=s.length)throw new Gt(`Array index out of bounds: ${r} > ${s.length-1}.`);if(r!==Math.floor(r))throw new Gt(`Array index must be an integer, but found ${r} instead.`);return s[r]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class $o{constructor(t,r){this.type=qe,this.needle=t,this.haystack=r}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let s=r.parse(t[1],1,Xe),l=r.parse(t[2],2,Xe);return s&&l?W(s.type,[qe,it,ve,jr,Xe])?new $o(s,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${P(s.type)} instead`):null}evaluate(t){let r=this.needle.evaluate(t),s=this.haystack.evaluate(t);if(!s)return!1;if(!Y(r,["boolean","string","number","null"]))throw new Gt(`Expected first argument to be of type boolean, string, number or null, but found ${P(Xt(r))} instead.`);if(!Y(s,["string","array"]))throw new Gt(`Expected second argument to be of type array or string, but found ${P(Xt(s))} instead.`);return s.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class In{constructor(t,r,s){this.type=ve,this.needle=t,this.haystack=r,this.fromIndex=s}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);let s=r.parse(t[1],1,Xe),l=r.parse(t[2],2,Xe);if(!s||!l)return null;if(!W(s.type,[qe,it,ve,jr,Xe]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${P(s.type)} instead`);if(t.length===4){let u=r.parse(t[3],3,ve);return u?new In(s,l,u):null}return new In(s,l)}evaluate(t){let r=this.needle.evaluate(t),s=this.haystack.evaluate(t);if(!Y(r,["boolean","string","number","null"]))throw new Gt(`Expected first argument to be of type boolean, string, number or null, but found ${P(Xt(r))} instead.`);let l;if(this.fromIndex&&(l=this.fromIndex.evaluate(t)),Y(s,["string"])){let u=s.indexOf(r,l);return u===-1?-1:[...s.slice(0,u)].length}if(Y(s,["array"]))return s.indexOf(r,l);throw new Gt(`Expected second argument to be of type array or string, but found ${P(Xt(s))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class qo{constructor(t,r,s,l,u,d){this.inputType=t,this.type=r,this.input=s,this.cases=l,this.outputs=u,this.otherwise=d}static parse(t,r){if(t.length<5)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return r.error("Expected an even number of arguments.");let s,l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);let u={},d=[];for(let x=2;x<t.length-1;x+=2){let v=t[x],w=t[x+1];Array.isArray(v)||(v=[v]);let C=r.concat(x);if(v.length===0)return C.error("Expected at least one branch label.");for(let k of v){if(typeof k!="number"&&typeof k!="string")return C.error("Branch labels must be numbers or strings.");if(typeof k=="number"&&Math.abs(k)>Number.MAX_SAFE_INTEGER)return C.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof k=="number"&&Math.floor(k)!==k)return C.error("Numeric branch labels must be integer values.");if(s){if(C.checkSubtype(s,Xt(k)))return null}else s=Xt(k);if(u[String(k)]!==void 0)return C.error("Branch labels must be unique.");u[String(k)]=d.length}let A=r.parse(w,x,l);if(!A)return null;l=l||A.type,d.push(A)}let f=r.parse(t[1],1,Xe);if(!f)return null;let g=r.parse(t[t.length-1],t.length-1,l);return g?f.type.kind!=="value"&&r.concat(1).checkSubtype(s,f.type)?null:new qo(s,l,f,u,d,g):null}evaluate(t){let r=this.input.evaluate(t);return(Xt(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}}class $s{constructor(t,r,s){this.type=t,this.branches=r,this.otherwise=s}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return r.error("Expected an odd number of arguments.");let s;r.expectedType&&r.expectedType.kind!=="value"&&(s=r.expectedType);let l=[];for(let d=1;d<t.length-1;d+=2){let f=r.parse(t[d],d,qe);if(!f)return null;let g=r.parse(t[d+1],d+1,s);if(!g)return null;l.push([f,g]),s=s||g.type}let u=r.parse(t[t.length-1],t.length-1,s);if(!u)return null;if(!s)throw new Error("Can't infer output type");return new $s(s,l,u)}evaluate(t){for(let[r,s]of this.branches)if(r.evaluate(t))return s.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(let[r,s]of this.branches)t(r),t(s);t(this.otherwise)}outputDefined(){return this.branches.every((([t,r])=>r.outputDefined()))&&this.otherwise.outputDefined()}}class fs{constructor(t,r,s,l){this.type=t,this.input=r,this.beginIndex=s,this.endIndex=l}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);let s=r.parse(t[1],1,Xe),l=r.parse(t[2],2,ve);if(!s||!l)return null;if(!W(s.type,[M(Xe),it,Xe]))return r.error(`Expected first argument to be of type array or string, but found ${P(s.type)} instead`);if(t.length===4){let u=r.parse(t[3],3,ve);return u?new fs(s.type,s,l,u):null}return new fs(s.type,s,l)}evaluate(t){let r=this.input.evaluate(t),s=this.beginIndex.evaluate(t),l;if(this.endIndex&&(l=this.endIndex.evaluate(t)),Y(r,["string"]))return[...r].slice(s,l).join("");if(Y(r,["array"]))return r.slice(s,l);throw new Gt(`Expected first argument to be of type array or string, but found ${P(Xt(r))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function qs(i,t){let r=i.length-1,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<=t){if(f===r||t<l)return f;u=f+1}else{if(!(s>t))throw new Gt("Input is not a number.");d=f-1}return 0}class Cn{constructor(t,r,s){this.type=t,this.input=r,this.labels=[],this.outputs=[];for(let[l,u]of s)this.labels.push(l),this.outputs.push(u)}static parse(t,r){if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");let s=r.parse(t[1],1,ve);if(!s)return null;let l=[],u=null;r.expectedType&&r.expectedType.kind!=="value"&&(u=r.expectedType);for(let d=1;d<t.length;d+=2){let f=d===1?-1/0:t[d],g=t[d+1],x=d,v=d+1;if(typeof f!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',x);if(l.length&&l[l.length-1][0]>=f)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',x);let w=r.parse(g,v,u);if(!w)return null;u=u||w.type,l.push([f,w])}return new Cn(u,s,l)}evaluate(t){let r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(t);let l=this.input.evaluate(t);if(l<=r[0])return s[0].evaluate(t);let u=r.length;return l>=r[u-1]?s[u-1].evaluate(t):s[qs(r,l)].evaluate(t)}eachChild(t){t(this.input);for(let r of this.outputs)t(r)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function Ya(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var dc=Qa;function Qa(i,t,r,s){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(s-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=t,this.p2x=r,this.p2y=s}Qa.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,t){if(t===void 0&&(t=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,s=0;s<8;s++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)<t)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)<t));s++)i>l?d=r:f=r,r=.5*(f-d)+d;return r},solve:function(i,t){return this.sampleCurveY(this.solveCurveX(i,t))}};var pc=Ya(dc);function nn(i,t,r){return i+r*(t-i)}function ms(i,t,r){return i.map(((s,l)=>nn(s,t[l],r)))}let Ci={number:nn,color:function(i,t,r,s="rgb"){switch(s){case"rgb":{let[l,u,d,f]=ms(i.rgb,t.rgb,r);return new vt(l,u,d,f,!1)}case"hcl":{let[l,u,d,f]=i.hcl,[g,x,v,w]=t.hcl,C,A;if(isNaN(l)||isNaN(g))isNaN(l)?isNaN(g)?C=NaN:(C=g,d!==1&&d!==0||(A=x)):(C=l,v!==1&&v!==0||(A=u));else{let ie=g-l;g>l&&ie>180?ie-=360:g<l&&l-g>180&&(ie+=360),C=l+r*ie}let[k,z,O,j]=(function([ie,H,ee,ae]){return ie=isNaN(ie)?0:ie*Ve,Ft([ee,Math.cos(ie)*H,Math.sin(ie)*H,ae])})([C,A??nn(u,x,r),nn(d,v,r),nn(f,w,r)]);return new vt(k,z,O,j,!1)}case"lab":{let[l,u,d,f]=Ft(ms(i.lab,t.lab,r));return new vt(l,u,d,f,!1)}}},array:ms,padding:function(i,t,r){return new Bi(ms(i.values,t.values,r))},variableAnchorOffsetCollection:function(i,t,r){let s=i.values,l=t.values;if(s.length!==l.length)throw new Gt(`Cannot interpolate values of different length. from: ${i.toString()}, to: ${t.toString()}`);let u=[];for(let d=0;d<s.length;d+=2){if(s[d]!==l[d])throw new Gt(`Cannot interpolate values containing mismatched anchors. from[${d}]: ${s[d]}, to[${d}]: ${l[d]}`);u.push(s[d]);let[f,g]=s[d+1],[x,v]=l[d+1];u.push([nn(f,x,r),nn(g,v,r)])}return new Zi(u)}};class Pi{constructor(t,r,s,l,u){this.type=t,this.operator=r,this.interpolation=s,this.input=l,this.labels=[],this.outputs=[];for(let[d,f]of u)this.labels.push(d),this.outputs.push(f)}static interpolationFactor(t,r,s,l){let u=0;if(t.name==="exponential")u=Zs(r,t.base,s,l);else if(t.name==="linear")u=Zs(r,1,s,l);else if(t.name==="cubic-bezier"){let d=t.controlPoints;u=new pc(d[0],d[1],d[2],d[3]).solve(Zs(r,1,s,l))}return u}static parse(t,r){let[s,l,u,...d]=t;if(!Array.isArray(l)||l.length===0)return r.error("Expected an interpolation type expression.",1);if(l[0]==="linear")l={name:"linear"};else if(l[0]==="exponential"){let 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);{let x=l.slice(1);if(x.length!==4||x.some((v=>typeof v!="number"||v<0||v>1)))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);l={name:"cubic-bezier",controlPoints:x}}}if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(u=r.parse(u,2,ve),!u)return null;let f=[],g=null;s==="interpolate-hcl"||s==="interpolate-lab"?g=Ii:r.expectedType&&r.expectedType.kind!=="value"&&(g=r.expectedType);for(let x=0;x<d.length;x+=2){let v=d[x],w=d[x+1],C=x+3,A=x+4;if(typeof v!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',C);if(f.length&&f[f.length-1][0]>=v)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',C);let k=r.parse(w,A,g);if(!k)return null;g=g||k.type,f.push([v,k])}return te(g,ve)||te(g,Ii)||te(g,$r)||te(g,U)||te(g,M(ve))?new Pi(g,s,l,u,f):r.error(`Type ${P(g)} is not interpolatable.`)}evaluate(t){let r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(t);let l=this.input.evaluate(t);if(l<=r[0])return s[0].evaluate(t);let u=r.length;if(l>=r[u-1])return s[u-1].evaluate(t);let d=qs(r,l),f=Pi.interpolationFactor(this.interpolation,l,r[d],r[d+1]),g=s[d].evaluate(t),x=s[d+1].evaluate(t);switch(this.operator){case"interpolate":return Ci[this.type.kind](g,x,f);case"interpolate-hcl":return Ci.color(g,x,f,"hcl");case"interpolate-lab":return Ci.color(g,x,f,"lab")}}eachChild(t){t(this.input);for(let r of this.outputs)t(r)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function Zs(i,t,r,s){let l=s-r,u=i-r;return l===0?0:t===1?u/l:(Math.pow(t,u)-1)/(Math.pow(t,l)-1)}class Gs{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expectected at least one argument.");let s=null,l=r.expectedType;l&&l.kind!=="value"&&(s=l);let u=[];for(let f of t.slice(1)){let 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");let d=l&&u.some((f=>N(l,f.type)));return new Gs(d?Xe:s,u)}evaluate(t){let r,s=null,l=0;for(let u of this.args)if(l++,s=u.evaluate(t),s&&s instanceof Fi&&!s.available&&(r||(r=s.name),s=null,l===this.args.length&&(s=r)),s!==null)break;return s}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}function Hs(i,t){return i==="=="||i==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function el(i,t,r,s){return s.compare(t,r)===0}function Pn(i,t,r){let s=i!=="=="&&i!=="!=";return class Cd{constructor(u,d,f){this.type=qe,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.");let f=u[0],g=d.parse(u[1],1,Xe);if(!g)return null;if(!Hs(f,g.type))return d.concat(1).error(`"${f}" comparisons are not supported for type '${P(g.type)}'.`);let x=d.parse(u[2],2,Xe);if(!x)return null;if(!Hs(f,x.type))return d.concat(2).error(`"${f}" comparisons are not supported for type '${P(x.type)}'.`);if(g.type.kind!==x.type.kind&&g.type.kind!=="value"&&x.type.kind!=="value")return d.error(`Cannot compare types '${P(g.type)}' and '${P(x.type)}'.`);s&&(g.type.kind==="value"&&x.type.kind!=="value"?g=new sr(x.type,[g]):g.type.kind!=="value"&&x.type.kind==="value"&&(x=new sr(g.type,[x])));let v=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(v=d.parse(u[3],3,br),!v)return null}return new Cd(g,x,v)}evaluate(u){let d=this.lhs.evaluate(u),f=this.rhs.evaluate(u);if(s&&this.hasUntypedArgument){let g=Xt(d),x=Xt(f);if(g.kind!==x.kind||g.kind!=="string"&&g.kind!=="number")throw new Gt(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${g.kind}, ${x.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){let g=Xt(d),x=Xt(f);if(g.kind!=="string"||x.kind!=="string")return t(u,d,f)}return this.collator?r(u,d,f,this.collator.evaluate(u)):t(u,d,f)}eachChild(u){u(this.lhs),u(this.rhs),this.collator&&u(this.collator)}outputDefined(){return!0}}}let fc=Pn("==",(function(i,t,r){return t===r}),el),tl=Pn("!=",(function(i,t,r){return t!==r}),(function(i,t,r,s){return!el(0,t,r,s)})),il=Pn("<",(function(i,t,r){return t<r}),(function(i,t,r,s){return s.compare(t,r)<0})),mc=Pn(">",(function(i,t,r){return t>r}),(function(i,t,r,s){return s.compare(t,r)>0})),gc=Pn("<=",(function(i,t,r){return t<=r}),(function(i,t,r,s){return s.compare(t,r)<=0})),rl=Pn(">=",(function(i,t,r){return t>=r}),(function(i,t,r,s){return s.compare(t,r)>=0}));class gs{constructor(t,r,s){this.type=br,this.locale=s,this.caseSensitive=t,this.diacriticSensitive=r}static parse(t,r){if(t.length!==2)return r.error("Expected one argument.");let s=t[1];if(typeof s!="object"||Array.isArray(s))return r.error("Collator options argument must be an object.");let l=r.parse(s["case-sensitive"]!==void 0&&s["case-sensitive"],1,qe);if(!l)return null;let u=r.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,qe);if(!u)return null;let d=null;return s.locale&&(d=r.parse(s.locale,1,it),!d)?null:new gs(l,u,d)}evaluate(t){return new No(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class Zo{constructor(t,r,s,l,u){this.type=it,this.number=t,this.locale=r,this.currency=s,this.minFractionDigits=l,this.maxFractionDigits=u}static parse(t,r){if(t.length!==3)return r.error("Expected two arguments.");let s=r.parse(t[1],1,ve);if(!s)return null;let l=t[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,it),!u))return null;let d=null;if(l.currency&&(d=r.parse(l.currency,1,it),!d))return null;let f=null;if(l["min-fraction-digits"]&&(f=r.parse(l["min-fraction-digits"],1,ve),!f))return null;let g=null;return l["max-fraction-digits"]&&(g=r.parse(l["max-fraction-digits"],1,ve),!g)?null:new Zo(s,u,d,f,g)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class Ws{constructor(t){this.type=zr,this.sections=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let s=t[1];if(!Array.isArray(s)&&typeof s=="object")return r.error("First argument must be an image or text section.");let l=[],u=!1;for(let d=1;d<=t.length-1;++d){let f=t[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,ve),!g))return null;let x=null;if(f["text-font"]&&(x=r.parse(f["text-font"],1,M(it)),!x))return null;let v=null;if(f["text-color"]&&(v=r.parse(f["text-color"],1,Ii),!v))return null;let w=l[l.length-1];w.scale=g,w.font=x,w.textColor=v}else{let g=r.parse(t[d],1,Xe);if(!g)return null;let 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 Ws(l)}evaluate(t){return new Ri(this.sections.map((r=>{let s=r.content.evaluate(t);return Xt(s)===wr?new Vo("",s,null,null,null):new Vo(ps(s),null,r.scale?r.scale.evaluate(t):null,r.font?r.font.evaluate(t).join(","):null,r.textColor?r.textColor.evaluate(t):null)})))}eachChild(t){for(let r of this.sections)t(r.content),r.scale&&t(r.scale),r.font&&t(r.font),r.textColor&&t(r.textColor)}outputDefined(){return!1}}class Go{constructor(t){this.type=wr,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected two arguments.");let s=r.parse(t[1],1,it);return s?new Go(s):r.error("No image name provided.")}evaluate(t){let r=this.input.evaluate(t),s=Fi.fromString(r);return s&&t.availableImages&&(s.available=t.availableImages.indexOf(r)>-1),s}eachChild(t){t(this.input)}outputDefined(){return!1}}class Ho{constructor(t){this.type=ve,this.input=t}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);let s=r.parse(t[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 ${P(s.type)} instead.`):new Ho(s):null}evaluate(t){let r=this.input.evaluate(t);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new Gt(`Expected value to be of type string or array, but found ${P(Xt(r))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}let Sr=8192;function _c(i,t){let 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,t.z);return[Math.round(r*l*Sr),Math.round(s*l*Sr)]}function Wo(i,t){let r=Math.pow(2,t.z);return[(l=(i[0]/Sr+t.x)/r,360*l-180),(s=(i[1]/Sr+t.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90)];var s,l}function sn(i,t){i[0]=Math.min(i[0],t[0]),i[1]=Math.min(i[1],t[1]),i[2]=Math.max(i[2],t[0]),i[3]=Math.max(i[3],t[1])}function Zr(i,t){return!(i[0]<=t[0]||i[2]>=t[2]||i[1]<=t[1]||i[3]>=t[3])}function yt(i,t,r){let s=i[0]-t[0],l=i[1]-t[1],u=i[0]-r[0],d=i[1]-r[1];return s*d-u*l==0&&s*u<=0&&l*d<=0}function Xs(i,t,r,s){return(l=[s[0]-r[0],s[1]-r[1]])[0]*(u=[t[0]-i[0],t[1]-i[1]])[1]-l[1]*u[0]!=0&&!(!sl(i,t,r,s)||!sl(r,s,i,t));var l,u}function yc(i,t,r){for(let s of r)for(let l=0;l<s.length-1;++l)if(Xs(i,t,s[l],s[l+1]))return!0;return!1}function Mn(i,t,r=!1){let s=!1;for(let f of t)for(let g=0;g<f.length-1;g++){if(yt(i,f[g],f[g+1]))return r;(u=f[g])[1]>(l=i)[1]!=(d=f[g+1])[1]>l[1]&&l[0]<(d[0]-u[0])*(l[1]-u[1])/(d[1]-u[1])+u[0]&&(s=!s)}var l,u,d;return s}function xc(i,t){for(let r of t)if(Mn(i,r))return!0;return!1}function nl(i,t){for(let r of i)if(!Mn(r,t))return!1;for(let r=0;r<i.length-1;++r)if(yc(i[r],i[r+1],t))return!1;return!0}function vc(i,t){for(let r of t)if(nl(i,r))return!0;return!1}function sl(i,t,r,s){let l=s[0]-r[0],u=s[1]-r[1],d=(i[0]-r[0])*u-l*(i[1]-r[1]),f=(t[0]-r[0])*u-l*(t[1]-r[1]);return d>0&&f<0||d<0&&f>0}function Xo(i,t,r){let s=[];for(let l=0;l<i.length;l++){let u=[];for(let d=0;d<i[l].length;d++){let f=_c(i[l][d],r);sn(t,f),u.push(f)}s.push(u)}return s}function ol(i,t,r){let s=[];for(let l=0;l<i.length;l++){let u=Xo(i[l],t,r);s.push(u)}return s}function al(i,t,r,s){if(i[0]<r[0]||i[0]>r[2]){let l=.5*s,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}sn(t,i)}function ll(i,t,r,s){let l=Math.pow(2,s.z)*Sr,u=[s.x*Sr,s.y*Sr],d=[];for(let f of i)for(let g of f){let x=[g.x+u[0],g.y+u[1]];al(x,t,r,l),d.push(x)}return d}function cl(i,t,r,s){let l=Math.pow(2,s.z)*Sr,u=[s.x*Sr,s.y*Sr],d=[];for(let g of i){let x=[];for(let v of g){let w=[v.x+u[0],v.y+u[1]];sn(t,w),x.push(w)}d.push(x)}if(t[2]-t[0]<=l/2){(f=t)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(let g of d)for(let x of g)al(x,t,r,l)}var f;return d}class on{constructor(t,r){this.type=qe,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(tn(t[1])){let s=t[1];if(s.type==="FeatureCollection"){let l=[];for(let u of s.features){let{type:d,coordinates:f}=u.geometry;d==="Polygon"&&l.push(f),d==="MultiPolygon"&&l.push(...f)}if(l.length)return new on(s,{type:"MultiPolygon",coordinates:l})}else if(s.type==="Feature"){let l=s.geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new on(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new on(s,s)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return(function(r,s){let 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"){let f=Xo(s.coordinates,u,d),g=ll(r.geometry(),l,u,d);if(!Zr(l,u))return!1;for(let x of g)if(!Mn(x,f))return!1}if(s.type==="MultiPolygon"){let f=ol(s.coordinates,u,d),g=ll(r.geometry(),l,u,d);if(!Zr(l,u))return!1;for(let x of g)if(!xc(x,f))return!1}return!0})(t,this.geometries);if(t.geometryType()==="LineString")return(function(r,s){let 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"){let f=Xo(s.coordinates,u,d),g=cl(r.geometry(),l,u,d);if(!Zr(l,u))return!1;for(let x of g)if(!nl(x,f))return!1}if(s.type==="MultiPolygon"){let f=ol(s.coordinates,u,d),g=cl(r.geometry(),l,u,d);if(!Zr(l,u))return!1;for(let x of g)if(!vc(x,f))return!1}return!0})(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let hl=class{constructor(i=[],t=((r,s)=>r<s?-1:r>s?1:0)){if(this.data=i,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(i){this.data.push(i),this._up(this.length++)}pop(){if(this.length===0)return;let i=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),i}peek(){return this.data[0]}_up(i){let{data:t,compare:r}=this,s=t[i];for(;i>0;){let l=i-1>>1,u=t[l];if(r(s,u)>=0)break;t[i]=u,i=l}t[i]=s}_down(i){let{data:t,compare:r}=this,s=this.length>>1,l=t[i];for(;i<s;){let u=1+(i<<1),d=u+1;if(d<this.length&&r(t[d],t[u])<0&&(u=d),r(t[u],l)>=0)break;t[i]=t[u],i=u}t[i]=l}};function bc(i,t,r,s,l){ul(i,t,r,s||i.length-1,l||wc)}function ul(i,t,r,s,l){for(;s>r;){if(s-r>600){var u=s-r+1,d=t-r+1,f=Math.log(u),g=.5*Math.exp(2*f/3),x=.5*Math.sqrt(f*g*(u-g)/u)*(d-u/2<0?-1:1);ul(i,t,Math.max(r,Math.floor(t-d*g/u+x)),Math.min(s,Math.floor(t+(u-d)*g/u+x)),l)}var v=i[t],w=r,C=s;for(_s(i,r,t),l(i[s],v)>0&&_s(i,r,s);w<C;){for(_s(i,w,C),w++,C--;l(i[w],v)<0;)w++;for(;l(i[C],v)>0;)C--}l(i[r],v)===0?_s(i,r,C):_s(i,++C,s),C<=t&&(r=C+1),t<=C&&(s=C-1)}}function _s(i,t,r){var s=i[t];i[t]=i[r],i[r]=s}function wc(i,t){return i<t?-1:i>t?1:0}function Ks(i,t){if(i.length<=1)return[i];let r=[],s,l;for(let u of i){let d=Tc(u);d!==0&&(u.area=Math.abs(d),l===void 0&&(l=d<0),l===d<0?(s&&r.push(s),s=[u]):s.push(u))}if(s&&r.push(s),t>1)for(let u=0;u<r.length;u++)r[u].length<=t||(bc(r[u],t,1,r[u].length-1,Sc),r[u]=r[u].slice(0,t));return r}function Sc(i,t){return t.area-i.area}function Tc(i){let t=0;for(let r,s,l=0,u=i.length,d=u-1;l<u;d=l++)r=i[l],s=i[d],t+=(s.x-r.x)*(r.y+s.y);return t}let dl=1/298.257223563,pl=dl*(2-dl),fl=Math.PI/180;class Ko{constructor(t){let r=6378.137*fl*1e3,s=Math.cos(t*fl),l=1/(1-pl*(1-s*s)),u=Math.sqrt(l);this.kx=r*u*s,this.ky=r*u*l*(1-pl)}distance(t,r){let s=this.wrap(t[0]-r[0])*this.kx,l=(t[1]-r[1])*this.ky;return Math.sqrt(s*s+l*l)}pointOnLine(t,r){let s,l,u,d,f=1/0;for(let g=0;g<t.length-1;g++){let x=t[g][0],v=t[g][1],w=this.wrap(t[g+1][0]-x)*this.kx,C=(t[g+1][1]-v)*this.ky,A=0;w===0&&C===0||(A=(this.wrap(r[0]-x)*this.kx*w+(r[1]-v)*this.ky*C)/(w*w+C*C),A>1?(x=t[g+1][0],v=t[g+1][1]):A>0&&(x+=w/this.kx*A,v+=C/this.ky*A)),w=this.wrap(r[0]-x)*this.kx,C=(r[1]-v)*this.ky;let k=w*w+C*C;k<f&&(f=k,s=x,l=v,u=g,d=A)}return{point:[s,l],index:u,t:Math.max(0,Math.min(1,d))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function ml(i,t){return t[0]-i[0]}function Js(i){return i[1]-i[0]+1}function Lr(i,t){return i[1]>=i[0]&&i[1]<t}function Jo(i,t){if(i[0]>i[1])return[null,null];let r=Js(i);if(t){if(r===2)return[i,null];let l=Math.floor(r/2);return[[i[0],i[0]+l],[i[0]+l,i[1]]]}if(r===1)return[i,null];let s=Math.floor(r/2)-1;return[[i[0],i[0]+s],[i[0]+s+1,i[1]]]}function Yo(i,t){if(!Lr(t,i.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let s=t[0];s<=t[1];++s)sn(r,i[s]);return r}function Qo(i){let t=[1/0,1/0,-1/0,-1/0];for(let r of i)for(let s of r)sn(t,s);return t}function Ys(i){return i[0]!==-1/0&&i[1]!==-1/0&&i[2]!==1/0&&i[3]!==1/0}function ea(i,t,r){if(!Ys(i)||!Ys(t))return NaN;let s=0,l=0;return i[2]<t[0]&&(s=t[0]-i[2]),i[0]>t[2]&&(s=i[0]-t[2]),i[1]>t[3]&&(l=i[1]-t[3]),i[3]<t[1]&&(l=t[1]-i[3]),r.distance([0,0],[s,l])}function an(i,t,r){let s=r.pointOnLine(t,i);return r.distance(i,s.point)}function ta(i,t,r,s,l){let u=Math.min(an(i,[r,s],l),an(t,[r,s],l)),d=Math.min(an(r,[i,t],l),an(s,[i,t],l));return Math.min(u,d)}function Ic(i,t,r,s,l){if(!Lr(t,i.length)||!Lr(s,r.length))return 1/0;let u=1/0;for(let d=t[0];d<t[1];++d){let f=i[d],g=i[d+1];for(let x=s[0];x<s[1];++x){let v=r[x],w=r[x+1];if(Xs(f,g,v,w))return 0;u=Math.min(u,ta(f,g,v,w,l))}}return u}function Ut(i,t,r,s,l){if(!Lr(t,i.length)||!Lr(s,r.length))return NaN;let u=1/0;for(let d=t[0];d<=t[1];++d)for(let f=s[0];f<=s[1];++f)if(u=Math.min(u,l.distance(i[d],r[f])),u===0)return u;return u}function Cc(i,t,r){if(Mn(i,t,!0))return 0;let s=1/0;for(let l of t){let u=l[0],d=l[l.length-1];if(u!==d&&(s=Math.min(s,an(i,[d,u],r)),s===0))return s;let f=r.pointOnLine(l,i);if(s=Math.min(s,r.distance(i,f.point)),s===0)return s}return s}function nt(i,t,r,s){if(!Lr(t,i.length))return NaN;for(let u=t[0];u<=t[1];++u)if(Mn(i[u],r,!0))return 0;let l=1/0;for(let u=t[0];u<t[1];++u){let d=i[u],f=i[u+1];for(let g of r)for(let x=0,v=g.length,w=v-1;x<v;w=x++){let C=g[w],A=g[x];if(Xs(d,f,C,A))return 0;l=Math.min(l,ta(d,f,C,A,s))}}return l}function Qs(i,t){for(let r of i)for(let s of r)if(Mn(s,t,!0))return!0;return!1}function It(i,t,r,s=1/0){let l=Qo(i),u=Qo(t);if(s!==1/0&&ea(l,u,r)>=s)return s;if(Zr(l,u)){if(Qs(i,t))return 0}else if(Qs(t,i))return 0;let d=1/0;for(let f of i)for(let g=0,x=f.length,v=x-1;g<x;v=g++){let w=f[v],C=f[g];for(let A of t)for(let k=0,z=A.length,O=z-1;k<z;O=k++){let j=A[O],ie=A[k];if(Xs(w,C,j,ie))return 0;d=Math.min(d,ta(w,C,j,ie,r))}}return d}function bt(i,t,r,s,l,u){if(!u)return;let d=ea(Yo(s,u),l,r);d<t&&i.push([d,u,[0,0]])}function ln(i,t,r,s,l,u,d){if(!u||!d)return;let f=ea(Yo(s,u),Yo(l,d),r);f<t&&i.push([f,u,d])}function ys(i,t,r,s,l=1/0){let u=Math.min(s.distance(i[0],r[0][0]),l);if(u===0)return u;let d=new hl([[0,[0,i.length-1],[0,0]]],ml),f=Qo(r);for(;d.length>0;){let g=d.pop();if(g[0]>=u)continue;let x=g[1],v=t?50:100;if(Js(x)<=v){if(!Lr(x,i.length))return NaN;if(t){let w=nt(i,x,r,s);if(isNaN(w)||w===0)return w;u=Math.min(u,w)}else for(let w=x[0];w<=x[1];++w){let C=Cc(i[w],r,s);if(u=Math.min(u,C),u===0)return 0}}else{let w=Jo(x,t);bt(d,u,s,i,f,w[0]),bt(d,u,s,i,f,w[1])}}return u}function xs(i,t,r,s,l,u=1/0){let d=Math.min(u,l.distance(i[0],r[0]));if(d===0)return d;let f=new hl([[0,[0,i.length-1],[0,r.length-1]]],ml);for(;f.length>0;){let g=f.pop();if(g[0]>=d)continue;let x=g[1],v=g[2],w=t?50:100,C=s?50:100;if(Js(x)<=w&&Js(v)<=C){if(!Lr(x,i.length)&&Lr(v,r.length))return NaN;let A;if(t&&s)A=Ic(i,x,r,v,l),d=Math.min(d,A);else if(t&&!s){let k=i.slice(x[0],x[1]+1);for(let z=v[0];z<=v[1];++z)if(A=an(r[z],k,l),d=Math.min(d,A),d===0)return d}else if(!t&&s){let k=r.slice(v[0],v[1]+1);for(let z=x[0];z<=x[1];++z)if(A=an(i[z],k,l),d=Math.min(d,A),d===0)return d}else A=Ut(i,x,r,v,l),d=Math.min(d,A)}else{let A=Jo(x,t),k=Jo(v,s);ln(f,d,l,i,r,A[0],k[0]),ln(f,d,l,i,r,A[0],k[1]),ln(f,d,l,i,r,A[1],k[0]),ln(f,d,l,i,r,A[1],k[1])}}return d}function ia(i){return i.type==="MultiPolygon"?i.coordinates.map((t=>({type:"Polygon",coordinates:t}))):i.type==="MultiLineString"?i.coordinates.map((t=>({type:"LineString",coordinates:t}))):i.type==="MultiPoint"?i.coordinates.map((t=>({type:"Point",coordinates:t}))):[i]}class cn{constructor(t,r){this.type=ve,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(tn(t[1])){let s=t[1];if(s.type==="FeatureCollection")return new cn(s,s.features.map((l=>ia(l.geometry))).flat());if(s.type==="Feature")return new cn(s,ia(s.geometry));if("type"in s&&"coordinates"in s)return new cn(s,ia(s))}return r.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return(function(r,s){let l=r.geometry(),u=l.flat().map((g=>Wo([g.x,g.y],r.canonical)));if(l.length===0)return NaN;let d=new Ko(u[0][1]),f=1/0;for(let g of s){switch(g.type){case"Point":f=Math.min(f,xs(u,!1,[g.coordinates],!1,d,f));break;case"LineString":f=Math.min(f,xs(u,!1,g.coordinates,!0,d,f));break;case"Polygon":f=Math.min(f,ys(u,!1,g.coordinates,d,f))}if(f===0)return f}return f})(t,this.geometries);if(t.geometryType()==="LineString")return(function(r,s){let l=r.geometry(),u=l.flat().map((g=>Wo([g.x,g.y],r.canonical)));if(l.length===0)return NaN;let d=new Ko(u[0][1]),f=1/0;for(let g of s){switch(g.type){case"Point":f=Math.min(f,xs(u,!0,[g.coordinates],!1,d,f));break;case"LineString":f=Math.min(f,xs(u,!0,g.coordinates,!0,d,f));break;case"Polygon":f=Math.min(f,ys(u,!0,g.coordinates,d,f))}if(f===0)return f}return f})(t,this.geometries);if(t.geometryType()==="Polygon")return(function(r,s){let l=r.geometry();if(l.length===0||l[0].length===0)return NaN;let u=Ks(l,0).map((g=>g.map((x=>x.map((v=>Wo([v.x,v.y],r.canonical))))))),d=new Ko(u[0][0][0][1]),f=1/0;for(let g of s)for(let x of u){switch(g.type){case"Point":f=Math.min(f,ys([g.coordinates],!1,x,d,f));break;case"LineString":f=Math.min(f,ys(g.coordinates,!0,x,d,f));break;case"Polygon":f=Math.min(f,It(x,g.coordinates,d,f))}if(f===0)return f}return f})(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}let An={"==":fc,"!=":tl,">":mc,"<":il,">=":rl,"<=":gc,array:sr,at:jo,boolean:sr,case:$s,coalesce:Gs,collator:gs,format:Ws,image:Go,in:$o,"index-of":In,interpolate:Pi,"interpolate-hcl":Pi,"interpolate-lab":Pi,length:Ho,let:qr,literal:nr,match:qo,number:sr,"number-format":Zo,object:sr,slice:fs,step:Cn,string:sr,"to-boolean":or,"to-color":or,"to-number":or,"to-string":or,var:gt,within:on,distance:cn};class Gi{constructor(t,r,s,l){this.name=t,this.type=r,this._evaluate=s,this.args=l}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,r){let s=t[0],l=Gi.definitions[s];if(!l)return r.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);let 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===t.length-1)),g=null;for(let[x,v]of f){g=new rn(r.registry,vs,r.path,null,r.scope);let w=[],C=!1;for(let A=1;A<t.length;A++){let k=t[A],z=Array.isArray(x)?x[A-1]:x.type,O=g.parse(k,1+w.length,z);if(!O){C=!0;break}w.push(O)}if(!C)if(Array.isArray(x)&&x.length!==w.length)g.error(`Expected ${x.length} arguments, but found ${w.length} instead.`);else{for(let A=0;A<w.length;A++){let k=Array.isArray(x)?x[A]:x.type,z=w[A];g.concat(A+1).checkSubtype(k,z.type)}if(g.errors.length===0)return new Gi(s,u,v,w)}}if(f.length===1)r.errors.push(...g.errors);else{let x=(f.length?f:d).map((([w])=>{return C=w,Array.isArray(C)?`(${C.map(P).join(", ")})`:`(${P(C.type)}...)`;var C})).join(" | "),v=[];for(let w=1;w<t.length;w++){let C=r.parse(t[w],1+v.length);if(!C)return null;v.push(P(C.type))}r.error(`Expected arguments of type ${x}, but found (${v.join(", ")}) instead.`)}return null}static register(t,r){Gi.definitions=r;for(let s in r)t[s]=Gi}}function ra(i,[t,r,s,l]){t=t.evaluate(i),r=r.evaluate(i),s=s.evaluate(i);let u=l?l.evaluate(i):1,d=Tn(t,r,s,u);if(d)throw new Gt(d);return new vt(t/255,r/255,s/255,u,!1)}function na(i,t){return i in t}function sa(i,t){let r=t[i];return r===void 0?null:r}function hn(i){return{type:i}}function vs(i){if(i instanceof gt)return vs(i.boundExpression);if(i instanceof Gi&&i.name==="error"||i instanceof gs||i instanceof on||i instanceof cn)return!1;let t=i instanceof or||i instanceof sr,r=!0;return i.eachChild((s=>{r=t?r&&vs(s):r&&s instanceof nr})),!!r&&bs(i)&&ws(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function bs(i){if(i instanceof Gi&&(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 on||i instanceof cn)return!1;let t=!0;return i.eachChild((r=>{t&&!bs(r)&&(t=!1)})),t}function En(i){if(i instanceof Gi&&i.name==="feature-state")return!1;let t=!0;return i.eachChild((r=>{t&&!En(r)&&(t=!1)})),t}function ws(i,t){if(i instanceof Gi&&t.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild((s=>{r&&!ws(s,t)&&(r=!1)})),r}function eo(i){return{result:"success",value:i}}function kn(i){return{result:"error",value:i}}function zn(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function gl(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function oa(i){return!!i.expression&&i.expression.interpolated}function pt(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function to(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Pc(i){return i}function _l(i,t){let r=t.type==="color",s=i.stops&&typeof i.stops[0][0]=="object",l=s||!(s||i.property!==void 0),u=i.type||(oa(t)?"exponential":"interval");if(r||t.type==="padding"){let v=r?vt.parse:Bi.parse;(i=xr({},i)).stops&&(i.stops=i.stops.map((w=>[w[0],v(w[1])]))),i.default=v(i.default?i.default:t.default)}if(i.colorSpace&&(d=i.colorSpace)!=="rgb"&&d!=="hcl"&&d!=="lab")throw new Error(`Unknown color space: "${i.colorSpace}"`);var d;let f,g,x;if(u==="exponential")f=xl;else if(u==="interval")f=io;else if(u==="categorical"){f=yl,g=Object.create(null);for(let v of i.stops)g[v[0]]=v[1];x=typeof i.stops[0][0]}else{if(u!=="identity")throw new Error(`Unknown function type "${u}"`);f=vl}if(s){let v={},w=[];for(let k=0;k<i.stops.length;k++){let z=i.stops[k],O=z[0].zoom;v[O]===void 0&&(v[O]={zoom:O,type:i.type,property:i.property,default:i.default,stops:[]},w.push(O)),v[O].stops.push([z[0].value,z[1]])}let C=[];for(let k of w)C.push([v[k].zoom,_l(v[k],t)]);let A={name:"linear"};return{kind:"composite",interpolationType:A,interpolationFactor:Pi.interpolationFactor.bind(void 0,A),zoomStops:C.map((k=>k[0])),evaluate:({zoom:k},z)=>xl({stops:C,base:i.base},t,k).evaluate(k,z)}}if(l){let v=u==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:v,interpolationFactor:Pi.interpolationFactor.bind(void 0,v),zoomStops:i.stops.map((w=>w[0])),evaluate:({zoom:w})=>f(i,t,w,g,x)}}return{kind:"source",evaluate(v,w){let C=w&&w.properties?w.properties[i.property]:void 0;return C===void 0?Ln(i.default,t.default):f(i,t,C,g,x)}}}function Ln(i,t,r){return i!==void 0?i:t!==void 0?t:r!==void 0?r:void 0}function yl(i,t,r,s,l){return Ln(typeof r===l?s[r]:void 0,i.default,t.default)}function io(i,t,r){if(pt(r)!=="number")return Ln(i.default,t.default);let 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];let l=qs(i.stops.map((u=>u[0])),r);return i.stops[l][1]}function xl(i,t,r){let s=i.base!==void 0?i.base:1;if(pt(r)!=="number")return Ln(i.default,t.default);let 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];let u=qs(i.stops.map((v=>v[0])),r),d=(function(v,w,C,A){let k=A-C,z=v-C;return k===0?0:w===1?z/k:(Math.pow(w,z)-1)/(Math.pow(w,k)-1)})(r,s,i.stops[u][0],i.stops[u+1][0]),f=i.stops[u][1],g=i.stops[u+1][1],x=Ci[t.type]||Pc;return typeof f.evaluate=="function"?{evaluate(...v){let w=f.evaluate.apply(void 0,v),C=g.evaluate.apply(void 0,v);if(w!==void 0&&C!==void 0)return x(w,C,d,i.colorSpace)}}:x(f,g,d,i.colorSpace)}function vl(i,t,r){switch(t.type){case"color":r=vt.parse(r);break;case"formatted":r=Ri.fromString(r.toString());break;case"resolvedImage":r=Fi.fromString(r.toString());break;case"padding":r=Bi.parse(r);break;default:pt(r)===t.type||t.type==="enum"&&t.values[r]||(r=void 0)}return Ln(r,i.default,t.default)}Gi.register(An,{error:[{kind:"error"},[it],(i,[t])=>{throw new Gt(t.evaluate(i))}],typeof:[it,[Xe],(i,[t])=>P(Xt(t.evaluate(i)))],"to-rgba":[M(ve,4),[Ii],(i,[t])=>{let[r,s,l,u]=t.evaluate(i).rgb;return[255*r,255*s,255*l,u]}],rgb:[Ii,[ve,ve,ve],ra],rgba:[Ii,[ve,ve,ve,ve],ra],has:{type:qe,overloads:[[[it],(i,[t])=>na(t.evaluate(i),i.properties())],[[it,rr],(i,[t,r])=>na(t.evaluate(i),r.evaluate(i))]]},get:{type:Xe,overloads:[[[it],(i,[t])=>sa(t.evaluate(i),i.properties())],[[it,rr],(i,[t,r])=>sa(t.evaluate(i),r.evaluate(i))]]},"feature-state":[Xe,[it],(i,[t])=>sa(t.evaluate(i),i.featureState||{})],properties:[rr,[],i=>i.properties()],"geometry-type":[it,[],i=>i.geometryType()],id:[Xe,[],i=>i.id()],zoom:[ve,[],i=>i.globals.zoom],"heatmap-density":[ve,[],i=>i.globals.heatmapDensity||0],"line-progress":[ve,[],i=>i.globals.lineProgress||0],accumulated:[Xe,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[ve,hn(ve),(i,t)=>{let r=0;for(let s of t)r+=s.evaluate(i);return r}],"*":[ve,hn(ve),(i,t)=>{let r=1;for(let s of t)r*=s.evaluate(i);return r}],"-":{type:ve,overloads:[[[ve,ve],(i,[t,r])=>t.evaluate(i)-r.evaluate(i)],[[ve],(i,[t])=>-t.evaluate(i)]]},"/":[ve,[ve,ve],(i,[t,r])=>t.evaluate(i)/r.evaluate(i)],"%":[ve,[ve,ve],(i,[t,r])=>t.evaluate(i)%r.evaluate(i)],ln2:[ve,[],()=>Math.LN2],pi:[ve,[],()=>Math.PI],e:[ve,[],()=>Math.E],"^":[ve,[ve,ve],(i,[t,r])=>Math.pow(t.evaluate(i),r.evaluate(i))],sqrt:[ve,[ve],(i,[t])=>Math.sqrt(t.evaluate(i))],log10:[ve,[ve],(i,[t])=>Math.log(t.evaluate(i))/Math.LN10],ln:[ve,[ve],(i,[t])=>Math.log(t.evaluate(i))],log2:[ve,[ve],(i,[t])=>Math.log(t.evaluate(i))/Math.LN2],sin:[ve,[ve],(i,[t])=>Math.sin(t.evaluate(i))],cos:[ve,[ve],(i,[t])=>Math.cos(t.evaluate(i))],tan:[ve,[ve],(i,[t])=>Math.tan(t.evaluate(i))],asin:[ve,[ve],(i,[t])=>Math.asin(t.evaluate(i))],acos:[ve,[ve],(i,[t])=>Math.acos(t.evaluate(i))],atan:[ve,[ve],(i,[t])=>Math.atan(t.evaluate(i))],min:[ve,hn(ve),(i,t)=>Math.min(...t.map((r=>r.evaluate(i))))],max:[ve,hn(ve),(i,t)=>Math.max(...t.map((r=>r.evaluate(i))))],abs:[ve,[ve],(i,[t])=>Math.abs(t.evaluate(i))],round:[ve,[ve],(i,[t])=>{let r=t.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[ve,[ve],(i,[t])=>Math.floor(t.evaluate(i))],ceil:[ve,[ve],(i,[t])=>Math.ceil(t.evaluate(i))],"filter-==":[qe,[it,Xe],(i,[t,r])=>i.properties()[t.value]===r.value],"filter-id-==":[qe,[Xe],(i,[t])=>i.id()===t.value],"filter-type-==":[qe,[it],(i,[t])=>i.geometryType()===t.value],"filter-<":[qe,[it,Xe],(i,[t,r])=>{let s=i.properties()[t.value],l=r.value;return typeof s==typeof l&&s<l}],"filter-id-<":[qe,[Xe],(i,[t])=>{let r=i.id(),s=t.value;return typeof r==typeof s&&r<s}],"filter->":[qe,[it,Xe],(i,[t,r])=>{let s=i.properties()[t.value],l=r.value;return typeof s==typeof l&&s>l}],"filter-id->":[qe,[Xe],(i,[t])=>{let r=i.id(),s=t.value;return typeof r==typeof s&&r>s}],"filter-<=":[qe,[it,Xe],(i,[t,r])=>{let s=i.properties()[t.value],l=r.value;return typeof s==typeof l&&s<=l}],"filter-id-<=":[qe,[Xe],(i,[t])=>{let r=i.id(),s=t.value;return typeof r==typeof s&&r<=s}],"filter->=":[qe,[it,Xe],(i,[t,r])=>{let s=i.properties()[t.value],l=r.value;return typeof s==typeof l&&s>=l}],"filter-id->=":[qe,[Xe],(i,[t])=>{let r=i.id(),s=t.value;return typeof r==typeof s&&r>=s}],"filter-has":[qe,[Xe],(i,[t])=>t.value in i.properties()],"filter-has-id":[qe,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[qe,[M(it)],(i,[t])=>t.value.indexOf(i.geometryType())>=0],"filter-id-in":[qe,[M(Xe)],(i,[t])=>t.value.indexOf(i.id())>=0],"filter-in-small":[qe,[it,M(Xe)],(i,[t,r])=>r.value.indexOf(i.properties()[t.value])>=0],"filter-in-large":[qe,[it,M(Xe)],(i,[t,r])=>(function(s,l,u,d){for(;u<=d;){let f=u+d>>1;if(l[f]===s)return!0;l[f]>s?d=f-1:u=f+1}return!1})(i.properties()[t.value],r.value,0,r.value.length-1)],all:{type:qe,overloads:[[[qe,qe],(i,[t,r])=>t.evaluate(i)&&r.evaluate(i)],[hn(qe),(i,t)=>{for(let r of t)if(!r.evaluate(i))return!1;return!0}]]},any:{type:qe,overloads:[[[qe,qe],(i,[t,r])=>t.evaluate(i)||r.evaluate(i)],[hn(qe),(i,t)=>{for(let r of t)if(r.evaluate(i))return!0;return!1}]]},"!":[qe,[qe],(i,[t])=>!t.evaluate(i)],"is-supported-script":[qe,[it],(i,[t])=>{let r=i.globals&&i.globals.isSupportedScript;return!r||r(t.evaluate(i))}],upcase:[it,[it],(i,[t])=>t.evaluate(i).toUpperCase()],downcase:[it,[it],(i,[t])=>t.evaluate(i).toLowerCase()],concat:[it,hn(Xe),(i,t)=>t.map((r=>ps(r.evaluate(i)))).join("")],"resolved-locale":[it,[br],(i,[t])=>t.evaluate(i).resolvedLocale()]});class ro{constructor(t,r){var s;this.expression=t,this._warningHistory={},this._evaluator=new js,this._defaultValue=r?(s=r).type==="color"&&to(s.default)?new vt(0,0,0,0):s.type==="color"?vt.parse(s.default)||null:s.type==="padding"?Bi.parse(s.default)||null:s.type==="variableAnchorOffsetCollection"?Zi.parse(s.default)||null:s.default===void 0?null:s.default:null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(t,r,s,l,u,d){return this._evaluator.globals=t,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(t,r,s,l,u,d){this._evaluator.globals=t,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{let 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 Gt(`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 no(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in An}function Dn(i,t){let r=new rn(An,vs,[],t?(function(l){let u={color:Ii,string:it,number:ve,enum:it,boolean:qe,formatted:zr,padding:$r,resolvedImage:wr,variableAnchorOffsetCollection:U};return l.type==="array"?M(u[l.value]||Xe,l.length):u[l.type]})(t):void 0),s=r.parse(i,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?eo(new ro(s,t)):kn(r.errors)}class Rn{constructor(t,r){this.kind=t,this._styleExpression=r,this.isStateDependent=t!=="constant"&&!En(r.expression)}evaluateWithoutErrorHandling(t,r,s,l,u,d){return this._styleExpression.evaluateWithoutErrorHandling(t,r,s,l,u,d)}evaluate(t,r,s,l,u,d){return this._styleExpression.evaluate(t,r,s,l,u,d)}}class Bn{constructor(t,r,s,l){this.kind=t,this.zoomStops=s,this._styleExpression=r,this.isStateDependent=t!=="camera"&&!En(r.expression),this.interpolationType=l}evaluateWithoutErrorHandling(t,r,s,l,u,d){return this._styleExpression.evaluateWithoutErrorHandling(t,r,s,l,u,d)}evaluate(t,r,s,l,u,d){return this._styleExpression.evaluate(t,r,s,l,u,d)}interpolationFactor(t,r,s){return this.interpolationType?Pi.interpolationFactor(this.interpolationType,t,r,s):0}}function aa(i,t){let r=Dn(i,t);if(r.result==="error")return r;let s=r.value.expression,l=bs(s);if(!l&&!zn(t))return kn([new xi("","data expressions not supported")]);let u=ws(s,["zoom"]);if(!u&&!gl(t))return kn([new xi("","zoom expressions not supported")]);let d=Ss(s);return d||u?d instanceof xi?kn([d]):d instanceof Pi&&!oa(t)?kn([new xi("",'"interpolate" expressions cannot be used with this property')]):eo(d?new Bn(l?"camera":"composite",r.value,d.labels,d instanceof Pi?d.interpolation:void 0):new Rn(l?"constant":"source",r.value)):kn([new xi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Fn{constructor(t,r){this._parameters=t,this._specification=r,xr(this,_l(this._parameters,this._specification))}static deserialize(t){return new Fn(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Ss(i){let t=null;if(i instanceof qr)t=Ss(i.result);else if(i instanceof Gs){for(let r of i.args)if(t=Ss(r),t)break}else(i instanceof Cn||i instanceof Pi)&&i.input instanceof Gi&&i.input.name==="zoom"&&(t=i);return t instanceof xi||i.eachChild((r=>{let s=Ss(r);s instanceof xi?t=s:!t&&s?t=new xi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&s&&t!==s&&(t=new xi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),t}function so(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(let t of i.slice(1))if(!so(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}let oo={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function la(i){if(i==null)return{filter:()=>!0,needGeometry:!1};so(i)||(i=ao(i));let t=Dn(i,oo);if(t.result==="error")throw new Error(t.value.map((r=>`${r.key}: ${r.message}`)).join(", "));return{filter:(r,s,l)=>t.value.evaluate(r,s,{},l),needGeometry:bl(i)}}function Mc(i,t){return i<t?-1:i>t?1:0}function bl(i){if(!Array.isArray(i))return!1;if(i[0]==="within"||i[0]==="distance")return!0;for(let t=1;t<i.length;t++)if(bl(i[t]))return!0;return!1}function ao(i){if(!i)return!0;let t=i[0];return i.length<=1?t!=="any":t==="=="?ca(i[1],i[2],"=="):t==="!="?hi(ca(i[1],i[2],"==")):t==="<"||t===">"||t==="<="||t===">="?ca(i[1],i[2],t):t==="any"?(r=i.slice(1),["any"].concat(r.map(ao))):t==="all"?["all"].concat(i.slice(1).map(ao)):t==="none"?["all"].concat(i.slice(1).map(ao).map(hi)):t==="in"?Ts(i[1],i.slice(2)):t==="!in"?hi(Ts(i[1],i.slice(2))):t==="has"?Is(i[1]):t!=="!has"||hi(Is(i[1]));var r}function ca(i,t,r){switch(i){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,i,t]}}function Ts(i,t){if(t.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some((r=>typeof r!=typeof t[0]))?["filter-in-large",i,["literal",t.sort(Mc)]]:["filter-in-small",i,["literal",t]]}}function Is(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function hi(i){return["!",i]}function un(i){let t=typeof i;if(t==="number"||t==="boolean"||t==="string"||i==null)return JSON.stringify(i);if(Array.isArray(i)){let l="[";for(let u of i)l+=`${un(u)},`;return`${l}]`}let r=Object.keys(i).sort(),s="{";for(let l=0;l<r.length;l++)s+=`${JSON.stringify(r[l])}:${un(i[r[l]])},`;return`${s}}`}function wl(i){let t="";for(let r of en)t+=`/${un(i[r])}`;return t}function Sl(i){let t=i.value;return t?[new ge(i.key,t,"constants have been deprecated as of v8")]:[]}function jt(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function ar(i){if(Array.isArray(i))return i.map(ar);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){let t={};for(let r in i)t[r]=ar(i[r]);return t}return jt(i)}function Oi(i){let t=i.key,r=i.value,s=i.valueSpec||{},l=i.objectElementValidators||{},u=i.style,d=i.styleSpec,f=i.validateSpec,g=[],x=pt(r);if(x!=="object")return[new ge(t,r,`object expected, ${x} found`)];for(let v in r){let w=v.split(".")[0],C=s[w]||s["*"],A;if(l[w])A=l[w];else if(s[w])A=f;else if(l["*"])A=l["*"];else{if(!s["*"]){g.push(new ge(t,r[v],`unknown property "${v}"`));continue}A=f}g=g.concat(A({key:(t&&`${t}.`)+v,value:r[v],valueSpec:C,style:u,styleSpec:d,object:r,objectKey:v,validateSpec:f},r))}for(let v in s)l[v]||s[v].required&&s[v].default===void 0&&r[v]===void 0&&g.push(new ge(t,r,`missing required property "${v}"`));return g}function Cs(i){let t=i.value,r=i.valueSpec,s=i.style,l=i.styleSpec,u=i.key,d=i.arrayElementValidator||i.validateSpec;if(pt(t)!=="array")return[new ge(u,t,`array expected, ${pt(t)} found`)];if(r.length&&t.length!==r.length)return[new ge(u,t,`array length ${r.length} expected, length ${t.length} found`)];if(r["min-length"]&&t.length<r["min-length"])return[new ge(u,t,`array length at least ${r["min-length"]} expected, length ${t.length} found`)];let f={type:r.value,values:r.values};l.$version<7&&(f.function=r.function),pt(r.value)==="object"&&(f=r.value);let g=[];for(let x=0;x<t.length;x++)g=g.concat(d({array:t,arrayIndex:x,value:t[x],valueSpec:f,validateSpec:i.validateSpec,style:s,styleSpec:l,key:`${u}[${x}]`}));return g}function ha(i){let t=i.key,r=i.value,s=i.valueSpec,l=pt(r);return l==="number"&&r!=r&&(l="NaN"),l!=="number"?[new ge(t,r,`number expected, ${l} found`)]:"minimum"in s&&r<s.minimum?[new ge(t,r,`${r} is less than the minimum value ${s.minimum}`)]:"maximum"in s&&r>s.maximum?[new ge(t,r,`${r} is greater than the maximum value ${s.maximum}`)]:[]}function lo(i){let t=i.valueSpec,r=jt(i.value.type),s,l,u,d={},f=r!=="categorical"&&i.value.property===void 0,g=!f,x=pt(i.value.stops)==="array"&&pt(i.value.stops[0])==="array"&&pt(i.value.stops[0][0])==="object",v=Oi({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 ge(A.key,A.value,'identity function may not have a "stops" property')];let k=[],z=A.value;return k=k.concat(Cs({key:A.key,value:z,valueSpec:A.valueSpec,validateSpec:A.validateSpec,style:A.style,styleSpec:A.styleSpec,arrayElementValidator:w})),pt(z)==="array"&&z.length===0&&k.push(new ge(A.key,z,"array must have at least one stop")),k},default:function(A){return A.validateSpec({key:A.key,value:A.value,valueSpec:t,validateSpec:A.validateSpec,style:A.style,styleSpec:A.styleSpec})}}});return r==="identity"&&f&&v.push(new ge(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||v.push(new ge(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!oa(i.valueSpec)&&v.push(new ge(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(g&&!zn(i.valueSpec)?v.push(new ge(i.key,i.value,"property functions not supported")):f&&!gl(i.valueSpec)&&v.push(new ge(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!x||i.value.property!==void 0||v.push(new ge(i.key,i.value,'"property" property is required')),v;function w(A){let k=[],z=A.value,O=A.key;if(pt(z)!=="array")return[new ge(O,z,`array expected, ${pt(z)} found`)];if(z.length!==2)return[new ge(O,z,`array length 2 expected, length ${z.length} found`)];if(x){if(pt(z[0])!=="object")return[new ge(O,z,`object expected, ${pt(z[0])} found`)];if(z[0].zoom===void 0)return[new ge(O,z,"object stop key must have zoom")];if(z[0].value===void 0)return[new ge(O,z,"object stop key must have value")];if(u&&u>jt(z[0].zoom))return[new ge(O,z[0].zoom,"stop zoom values must appear in ascending order")];jt(z[0].zoom)!==u&&(u=jt(z[0].zoom),l=void 0,d={}),k=k.concat(Oi({key:`${O}[0]`,value:z[0],valueSpec:{zoom:{}},validateSpec:A.validateSpec,style:A.style,styleSpec:A.styleSpec,objectElementValidators:{zoom:ha,value:C}}))}else k=k.concat(C({key:`${O}[0]`,value:z[0],valueSpec:{},validateSpec:A.validateSpec,style:A.style,styleSpec:A.styleSpec},z));return no(ar(z[1]))?k.concat([new ge(`${O}[1]`,z[1],"expressions are not allowed in function stops.")]):k.concat(A.validateSpec({key:`${O}[1]`,value:z[1],valueSpec:t,validateSpec:A.validateSpec,style:A.style,styleSpec:A.styleSpec}))}function C(A,k){let z=pt(A.value),O=jt(A.value),j=A.value!==null?A.value:k;if(s){if(z!==s)return[new ge(A.key,j,`${z} stop domain type must match previous stop domain type ${s}`)]}else s=z;if(z!=="number"&&z!=="string"&&z!=="boolean")return[new ge(A.key,j,"stop domain value must be a number, string, or boolean")];if(z!=="number"&&r!=="categorical"){let ie=`number expected, ${z} found`;return zn(t)&&r===void 0&&(ie+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new ge(A.key,j,ie)]}return r!=="categorical"||z!=="number"||isFinite(O)&&Math.floor(O)===O?r!=="categorical"&&z==="number"&&l!==void 0&&O<l?[new ge(A.key,j,"stop domain values must appear in ascending order")]:(l=O,r==="categorical"&&O in d?[new ge(A.key,j,"stop domain values must be unique")]:(d[O]=!0,[])):[new ge(A.key,j,`integer expected, found ${O}`)]}}function On(i){let t=(i.expressionContext==="property"?aa:Dn)(ar(i.value),i.valueSpec);if(t.result==="error")return t.value.map((s=>new ge(`${i.key}${s.key}`,i.value,s.message)));let r=t.value.expression||t.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new ge(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"&&!En(r))return[new ge(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!En(r))return[new ge(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!ws(r,["zoom","feature-state"]))return[new ge(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!bs(r))return[new ge(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Dr(i){let t=i.key,r=i.value,s=i.valueSpec,l=[];return Array.isArray(s.values)?s.values.indexOf(jt(r))===-1&&l.push(new ge(t,r,`expected one of [${s.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(s.values).indexOf(jt(r))===-1&&l.push(new ge(t,r,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(r)} found`)),l}function ua(i){return so(ar(i.value))?On(xr({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):co(i)}function co(i){let t=i.value,r=i.key;if(pt(t)!=="array")return[new ge(r,t,`array expected, ${pt(t)} found`)];let s=i.styleSpec,l,u=[];if(t.length<1)return[new ge(r,t,"filter array must have at least 1 element")];switch(u=u.concat(Dr({key:`${r}[0]`,value:t[0],valueSpec:s.filter_operator,style:i.style,styleSpec:i.styleSpec})),jt(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&jt(t[1])==="$type"&&u.push(new ge(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&u.push(new ge(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(l=pt(t[1]),l!=="string"&&u.push(new ge(`${r}[1]`,t[1],`string expected, ${l} found`)));for(let d=2;d<t.length;d++)l=pt(t[d]),jt(t[1])==="$type"?u=u.concat(Dr({key:`${r}[${d}]`,value:t[d],valueSpec:s.geometry_type,style:i.style,styleSpec:i.styleSpec})):l!=="string"&&l!=="number"&&l!=="boolean"&&u.push(new ge(`${r}[${d}]`,t[d],`string, number, or boolean expected, ${l} found`));break;case"any":case"all":case"none":for(let d=1;d<t.length;d++)u=u.concat(co({key:`${r}[${d}]`,value:t[d],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":l=pt(t[1]),t.length!==2?u.push(new ge(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):l!=="string"&&u.push(new ge(`${r}[1]`,t[1],`string expected, ${l} found`))}return u}function da(i,t){let r=i.key,s=i.validateSpec,l=i.style,u=i.styleSpec,d=i.value,f=i.objectKey,g=u[`${t}_${i.layerType}`];if(!g)return[];let x=f.match(/^(.*)-transition$/);if(t==="paint"&&x&&g[x[1]]&&g[x[1]].transition)return s({key:r,value:d,valueSpec:u.transition,style:l,styleSpec:u});let v=i.valueSpec||g[f];if(!v)return[new ge(r,d,`unknown property "${f}"`)];let w;if(pt(d)==="string"&&zn(v)&&!v.tokens&&(w=/^{([^}]+)}$/.exec(d)))return[new ge(r,d,`"${f}" does not support interpolation syntax
|
|
2
|
+
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(w[1])} }\`.`)];let C=[];return i.layerType==="symbol"&&(f==="text-field"&&l&&!l.glyphs&&C.push(new ge(r,d,'use of "text-field" requires a style "glyphs" property')),f==="text-font"&&to(ar(d))&&jt(d.type)==="identity"&&C.push(new ge(r,d,'"text-font" does not support identity functions'))),C.concat(s({key:i.key,value:d,valueSpec:v,style:l,styleSpec:u,expressionContext:"property",propertyType:t,propertyKey:f}))}function ho(i){return da(i,"paint")}function pa(i){return da(i,"layout")}function fa(i){let t=[],r=i.value,s=i.key,l=i.style,u=i.styleSpec;r.type||r.ref||t.push(new ge(s,r,'either "type" or "ref" is required'));let d=jt(r.type),f=jt(r.ref);if(r.id){let g=jt(r.id);for(let x=0;x<i.arrayIndex;x++){let v=l.layers[x];jt(v.id)===g&&t.push(new ge(s,r.id,`duplicate layer id "${r.id}", previously used at line ${v.id.__line__}`))}}if("ref"in r){let g;["type","source","source-layer","filter","layout"].forEach((x=>{x in r&&t.push(new ge(s,r[x],`"${x}" is prohibited for ref layers`))})),l.layers.forEach((x=>{jt(x.id)===f&&(g=x)})),g?g.ref?t.push(new ge(s,r.ref,"ref cannot reference another ref layer")):d=jt(g.type):t.push(new ge(s,r.ref,`ref layer "${f}" not found`))}else if(d!=="background")if(r.source){let g=l.sources&&l.sources[r.source],x=g&&jt(g.type);g?x==="vector"&&d==="raster"?t.push(new ge(s,r.source,`layer "${r.id}" requires a raster source`)):x!=="raster-dem"&&d==="hillshade"?t.push(new ge(s,r.source,`layer "${r.id}" requires a raster-dem source`)):x==="raster"&&d!=="raster"?t.push(new ge(s,r.source,`layer "${r.id}" requires a vector source`)):x!=="vector"||r["source-layer"]?x==="raster-dem"&&d!=="hillshade"?t.push(new ge(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||t.push(new ge(s,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new ge(s,r,`layer "${r.id}" must specify a "source-layer"`)):t.push(new ge(s,r.source,`source "${r.source}" not found`))}else t.push(new ge(s,r,'missing required property "source"'));return t=t.concat(Oi({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:ua,layout:g=>Oi({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":x=>pa(xr({layerType:d},x))}}),paint:g=>Oi({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":x=>ho(xr({layerType:d},x))}})}})),t}function dn(i){let t=i.value,r=i.key,s=pt(t);return s!=="string"?[new ge(r,t,`string expected, ${s} found`)]:[]}let uo={promoteId:function({key:i,value:t}){if(pt(t)==="string")return dn({key:i,value:t});{let r=[];for(let s in t)r.push(...dn({key:`${i}.${s}`,value:t[s]}));return r}}};function Ps(i){let t=i.value,r=i.key,s=i.styleSpec,l=i.style,u=i.validateSpec;if(!t.type)return[new ge(r,t,'"type" is required')];let d=jt(t.type),f;switch(d){case"vector":case"raster":return f=Oi({key:r,value:t,valueSpec:s[`source_${d.replace("-","_")}`],style:i.style,styleSpec:s,objectElementValidators:uo,validateSpec:u}),f;case"raster-dem":return f=(function(g){var x;let v=(x=g.sourceName)!==null&&x!==void 0?x:"",w=g.value,C=g.styleSpec,A=C.source_raster_dem,k=g.style,z=[],O=pt(w);if(w===void 0)return z;if(O!=="object")return z.push(new ge("source_raster_dem",w,`object expected, ${O} found`)),z;let j=jt(w.encoding)==="custom",ie=["redFactor","greenFactor","blueFactor","baseShift"],H=g.value.encoding?`"${g.value.encoding}"`:"Default";for(let ee in w)!j&&ie.includes(ee)?z.push(new ge(ee,w[ee],`In "${v}": "${ee}" is only valid when "encoding" is set to "custom". ${H} encoding found`)):A[ee]?z=z.concat(g.validateSpec({key:ee,value:w[ee],valueSpec:A[ee],validateSpec:g.validateSpec,style:k,styleSpec:C})):z.push(new ge(ee,w[ee],`unknown property "${ee}"`));return z})({sourceName:r,value:t,style:i.style,styleSpec:s,validateSpec:u}),f;case"geojson":if(f=Oi({key:r,value:t,valueSpec:s.source_geojson,style:l,styleSpec:s,validateSpec:u,objectElementValidators:uo}),t.cluster)for(let g in t.clusterProperties){let[x,v]=t.clusterProperties[g],w=typeof x=="string"?[x,["accumulated"],["get",g]]:x;f.push(...On({key:`${r}.${g}.map`,value:v,validateSpec:u,expressionContext:"cluster-map"})),f.push(...On({key:`${r}.${g}.reduce`,value:w,validateSpec:u,expressionContext:"cluster-reduce"}))}return f;case"video":return Oi({key:r,value:t,valueSpec:s.source_video,style:l,validateSpec:u,styleSpec:s});case"image":return Oi({key:r,value:t,valueSpec:s.source_image,style:l,validateSpec:u,styleSpec:s});case"canvas":return[new ge(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Dr({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:l,validateSpec:u,styleSpec:s})}}function ma(i){let t=i.value,r=i.styleSpec,s=r.light,l=i.style,u=[],d=pt(t);if(t===void 0)return u;if(d!=="object")return u=u.concat([new ge("light",t,`object expected, ${d} found`)]),u;for(let f in t){let g=f.match(/^(.*)-transition$/);u=u.concat(g&&s[g[1]]&&s[g[1]].transition?i.validateSpec({key:f,value:t[f],valueSpec:r.transition,validateSpec:i.validateSpec,style:l,styleSpec:r}):s[f]?i.validateSpec({key:f,value:t[f],valueSpec:s[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new ge(f,t[f],`unknown property "${f}"`)])}return u}function ga(i){let t=i.value,r=i.styleSpec,s=r.sky,l=i.style,u=pt(t);if(t===void 0)return[];if(u!=="object")return[new ge("sky",t,`object expected, ${u} found`)];let d=[];for(let f in t)d=d.concat(s[f]?i.validateSpec({key:f,value:t[f],valueSpec:s[f],style:l,styleSpec:r}):[new ge(f,t[f],`unknown property "${f}"`)]);return d}function _a(i){let t=i.value,r=i.styleSpec,s=r.terrain,l=i.style,u=[],d=pt(t);if(t===void 0)return u;if(d!=="object")return u=u.concat([new ge("terrain",t,`object expected, ${d} found`)]),u;for(let f in t)u=u.concat(s[f]?i.validateSpec({key:f,value:t[f],valueSpec:s[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new ge(f,t[f],`unknown property "${f}"`)]);return u}function ya(i){let t=[],r=i.value,s=i.key;if(Array.isArray(r)){let l=[],u=[];for(let d in r)r[d].id&&l.includes(r[d].id)&&t.push(new ge(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)&&t.push(new ge(s,r,`all the sprites' URLs must be unique, but ${r[d].url} is duplicated`)),u.push(r[d].url),t=t.concat(Oi({key:`${s}[${d}]`,value:r[d],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return t}return dn({key:s,value:r})}let po={"*":()=>[],array:Cs,boolean:function(i){let t=i.value,r=i.key,s=pt(t);return s!=="boolean"?[new ge(r,t,`boolean expected, ${s} found`)]:[]},number:ha,color:function(i){let t=i.key,r=i.value,s=pt(r);return s!=="string"?[new ge(t,r,`color expected, ${s} found`)]:vt.parse(String(r))?[]:[new ge(t,r,`color expected, "${r}" found`)]},constants:Sl,enum:Dr,filter:ua,function:lo,layer:fa,object:Oi,source:Ps,light:ma,sky:ga,terrain:_a,projection:function(i){let t=i.value,r=i.styleSpec,s=r.projection,l=i.style,u=pt(t);if(t===void 0)return[];if(u!=="object")return[new ge("projection",t,`object expected, ${u} found`)];let d=[];for(let f in t)d=d.concat(s[f]?i.validateSpec({key:f,value:t[f],valueSpec:s[f],style:l,styleSpec:r}):[new ge(f,t[f],`unknown property "${f}"`)]);return d},string:dn,formatted:function(i){return dn(i).length===0?[]:On(i)},resolvedImage:function(i){return dn(i).length===0?[]:On(i)},padding:function(i){let t=i.key,r=i.value;if(pt(r)==="array"){if(r.length<1||r.length>4)return[new ge(t,r,`padding requires 1 to 4 values; ${r.length} values found`)];let s={type:"number"},l=[];for(let u=0;u<r.length;u++)l=l.concat(i.validateSpec({key:`${t}[${u}]`,value:r[u],validateSpec:i.validateSpec,valueSpec:s}));return l}return ha({key:t,value:r,valueSpec:{}})},variableAnchorOffsetCollection:function(i){let t=i.key,r=i.value,s=pt(r),l=i.styleSpec;if(s!=="array"||r.length<1||r.length%2!=0)return[new ge(t,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let u=[];for(let d=0;d<r.length;d+=2)u=u.concat(Dr({key:`${t}[${d}]`,value:r[d],valueSpec:l.layout_symbol["text-anchor"]})),u=u.concat(Cs({key:`${t}[${d+1}]`,value:r[d+1],valueSpec:{length:2,value:"number"},validateSpec:i.validateSpec,style:i.style,styleSpec:l}));return u},sprite:ya};function Nn(i){let t=i.value,r=i.valueSpec,s=i.styleSpec;return i.validateSpec=Nn,r.expression&&to(jt(t))?lo(i):r.expression&&no(ar(t))?On(i):r.type&&po[r.type]?po[r.type](i):Oi(xr({},i,{valueSpec:r.type?s[r.type]:r}))}function Tl(i){let t=i.value,r=i.key,s=dn(i);return s.length||(t.indexOf("{fontstack}")===-1&&s.push(new ge(r,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&s.push(new ge(r,t,'"glyphs" url must include a "{range}" token'))),s}function Hi(i,t=oe){let r=[];return r=r.concat(Nn({key:"",value:i,valueSpec:t.$root,styleSpec:t,style:i,validateSpec:Nn,objectElementValidators:{glyphs:Tl,"*":()=>[]}})),i.constants&&(r=r.concat(Sl({key:"constants",value:i.constants,style:i,styleSpec:t,validateSpec:Nn}))),xa(r)}function Tr(i){return function(t){return i({...t,validateSpec:Nn})}}function xa(i){return[].concat(i).sort(((t,r)=>t.line-r.line))}function lr(i){return function(...t){return xa(i.apply(this,t))}}Hi.source=lr(Tr(Ps)),Hi.sprite=lr(Tr(ya)),Hi.glyphs=lr(Tr(Tl)),Hi.light=lr(Tr(ma)),Hi.sky=lr(Tr(ga)),Hi.terrain=lr(Tr(_a)),Hi.layer=lr(Tr(fa)),Hi.filter=lr(Tr(ua)),Hi.paintProperty=lr(Tr(ho)),Hi.layoutProperty=lr(Tr(pa));let pn=Hi,Ac=pn.light,Ec=pn.sky,Il=pn.paintProperty,Cl=pn.layoutProperty;function va(i,t){let r=!1;if(t&&t.length)for(let s of t)i.fire(new Vr(new Error(s.message))),r=!0;return r}class Vn{constructor(t,r,s){let l=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;let d=new Int32Array(this.arrayBuffer);t=d[0],this.d=(r=d[1])+2*(s=d[2]);for(let g=0;g<this.d*this.d;g++){let x=d[3+g],v=d[3+g+1];l.push(x===v?null:d.subarray(x,v))}let 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=t,this.padding=s,this.scale=r/t,this.uid=0;let u=s/r*t;this.min=-u,this.max=t+u}insert(t,r,s,l,u){this._forEachCell(r,s,l,u,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),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(t,r,s,l,u,d){this.cells[u].push(d)}query(t,r,s,l,u){let d=this.min,f=this.max;if(t<=d&&r<=d&&f<=s&&f<=l&&!u)return Array.prototype.slice.call(this.keys);{let g=[];return this._forEachCell(t,r,s,l,this._queryCell,g,{},u),g}}_queryCell(t,r,s,l,u,d,f,g){let x=this.cells[u];if(x!==null){let v=this.keys,w=this.bboxes;for(let C=0;C<x.length;C++){let A=x[C];if(f[A]===void 0){let k=4*A;(g?g(w[k+0],w[k+1],w[k+2],w[k+3]):t<=w[k+2]&&r<=w[k+3]&&s>=w[k+0]&&l>=w[k+1])?(f[A]=!0,d.push(v[A])):f[A]=!1}}}}_forEachCell(t,r,s,l,u,d,f,g){let x=this._convertToCellCoord(t),v=this._convertToCellCoord(r),w=this._convertToCellCoord(s),C=this._convertToCellCoord(l);for(let A=x;A<=w;A++)for(let k=v;k<=C;k++){let z=this.d*k+A;if((!g||g(this._convertFromCellCoord(A),this._convertFromCellCoord(k),this._convertFromCellCoord(A+1),this._convertFromCellCoord(k+1)))&&u.call(this,t,r,s,l,z,d,f,g))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let t=this.cells,r=3+this.cells.length+1+1,s=0;for(let d=0;d<this.cells.length;d++)s+=this.cells[d].length;let 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<t.length;d++){let f=t[d];l[3+d]=u,l.set(f,u),u+=f.length}return l[3+t.length]=u,l.set(this.keys,u),u+=this.keys.length,l[3+t.length+1]=u,l.set(this.bboxes,u),u+=this.bboxes.length,l.buffer}static serialize(t,r){let s=t.toArrayBuffer();return r&&r.push(s),{buffer:s}}static deserialize(t){return new Vn(t.buffer)}}let Wi={};function ke(i,t,r={}){if(Wi[i])throw new Error(`${i} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:i,writeable:!1}),Wi[i]={klass:t,omit:r.omit||[],shallow:r.shallow||[]}}ke("Object",Object),ke("TransferableGridIndex",Vn),ke("Color",vt),ke("Error",Error),ke("AJAXError",Di),ke("ResolvedImage",Fi),ke("StylePropertyFunction",Fn),ke("StyleExpression",ro,{omit:["_evaluator"]}),ke("ZoomDependentExpression",Bn),ke("ZoomConstantExpression",Rn),ke("CompoundExpression",Gi,{omit:["_evaluate"]});for(let i in An)An[i]._classRegistryKey||ke(`Expression_${i}`,An[i]);function fo(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function ba(i){return i.$name||i.constructor._classRegistryKey}function Pl(i){return!(function(t){if(t===null||typeof t!="object")return!1;let r=ba(t);return!(!r||r==="Object")})(i)&&(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||i instanceof Error||fo(i)||qt(i)||ArrayBuffer.isView(i)||i instanceof ImageData)}function Un(i,t){if(Pl(i))return(fo(i)||qt(i))&&t&&t.push(i),ArrayBuffer.isView(i)&&t&&t.push(i.buffer),i instanceof ImageData&&t&&t.push(i.data.buffer),i;if(Array.isArray(i)){let u=[];for(let d of i)u.push(Un(d,t));return u}if(typeof i!="object")throw new Error("can't serialize object of type "+typeof i);let r=ba(i);if(!r)throw new Error(`can't serialize object of unregistered class ${i.constructor.name}`);if(!Wi[r])throw new Error(`${r} is not registered.`);let{klass:s}=Wi[r],l=s.serialize?s.serialize(i,t):{};if(s.serialize){if(t&&l===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(let u in i){if(!i.hasOwnProperty(u)||Wi[r].omit.indexOf(u)>=0)continue;let d=i[u];l[u]=Wi[r].shallow.indexOf(u)>=0?d:Un(d,t)}i instanceof Error&&(l.message=i.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(l.$name=r),l}function jn(i){if(Pl(i))return i;if(Array.isArray(i))return i.map(jn);if(typeof i!="object")throw new Error("can't deserialize object of type "+typeof i);let t=ba(i)||"Object";if(!Wi[t])throw new Error(`can't deserialize unregistered class ${t}`);let{klass:r}=Wi[t];if(!r)throw new Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(i);let s=Object.create(r.prototype);for(let l of Object.keys(i)){if(l==="$name")continue;let u=i[l];s[l]=Wi[t].shallow.indexOf(l)>=0?u:jn(u)}return s}class wa{constructor(){this.first=!0}update(t,r){let s=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=s,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=s,!0):(this.lastFloorZoom>s?(this.lastIntegerZoom=s+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<s&&(this.lastIntegerZoom=s,this.lastIntegerZoomTime=r),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=s,!0))}}let lt={"Latin-1 Supplement":i=>i>=128&&i<=255,"Hangul Jamo":i=>i>=4352&&i<=4607,Khmer:i=>i>=6016&&i<=6143,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Katakana:i=>i>=12448&&i<=12543,Kanbun:i=>i>=12688&&i<=12703,"CJK Strokes":i=>i>=12736&&i<=12783,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"Private Use Area":i=>i>=57344&&i<=63743,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function Sa(i){for(let t of i)if(Ia(t.charCodeAt(0)))return!0;return!1}function kc(i){for(let t of i)if(!$n(t.charCodeAt(0)))return!1;return!0}function Ta(i){let t=i.map((r=>{try{return new RegExp(`\\p{sc=${r}}`,"u").source}catch{return null}})).filter((r=>r));return new RegExp(t.join("|"),"u")}let zc=Ta(["Arab","Dupl","Mong","Ougr","Syrc"]);function $n(i){return!zc.test(String.fromCodePoint(i))}let Ml=Ta(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function Ia(i){return!(i!==746&&i!==747&&(i<4352||!(lt["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||lt["CJK Compatibility"](i)||lt["CJK Strokes"](i)||!(!lt["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||lt["Enclosed CJK Letters and Months"](i)||lt["Ideographic Description Characters"](i)||lt.Kanbun(i)||lt.Katakana(i)&&i!==12540||!(!lt["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)||!(!lt["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||lt["Vertical Forms"](i)||lt["Yijing Hexagram Symbols"](i)||/\p{sc=Cans}/u.test(String.fromCodePoint(i))||/\p{sc=Hang}/u.test(String.fromCodePoint(i))||Ml.test(String.fromCodePoint(i)))))}function Al(i){return!(Ia(i)||(function(t){return!!(lt["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||lt["General Punctuation"](t)&&(t===8214||t===8224||t===8225||t===8240||t===8241||t===8251||t===8252||t===8258||t===8263||t===8264||t===8265||t===8273)||lt["Letterlike Symbols"](t)||lt["Number Forms"](t)||lt["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||t===9003||t>=9085&&t<=9114||t>=9150&&t<=9165||t===9167||t>=9169&&t<=9179||t>=9186&&t<=9215)||lt["Control Pictures"](t)&&t!==9251||lt["Optical Character Recognition"](t)||lt["Enclosed Alphanumerics"](t)||lt["Geometric Shapes"](t)||lt["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||lt["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||lt["CJK Symbols and Punctuation"](t)||lt.Katakana(t)||lt["Private Use Area"](t)||lt["CJK Compatibility Forms"](t)||lt["Small Form Variants"](t)||lt["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)})(i))}let Lc=Ta(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function Ca(i){return Lc.test(String.fromCodePoint(i))}function Dc(i,t){return!(!t&&Ca(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||lt.Khmer(i))}function Rc(i){for(let t of i)if(Ca(t.charCodeAt(0)))return!0;return!1}let Ni=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(i){this.pluginStatus=i.pluginStatus,this.pluginURL=i.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(i){this.applyArabicShaping=i.applyArabicShaping,this.processBidirectionalText=i.processBidirectionalText,this.processStyledBidirectionalText=i.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class At{constructor(t,r){this.zoom=t,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new wa,this.transition={})}isSupportedScript(t){return(function(r,s){for(let l of r)if(!Dc(l.charCodeAt(0),s))return!1;return!0})(t,Ni.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let t=this.zoom,r=t-Math.floor(t),s=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*s}:{fromScale:.5,toScale:1,t:1-(1-s)*r}}}class qn{constructor(t,r){this.property=t,this.value=r,this.expression=(function(s,l){if(to(s))return new Fn(s,l);if(no(s)){let u=aa(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=vt.parse(s):l.type!=="padding"||typeof s!="number"&&!Array.isArray(s)?l.type==="variableAnchorOffsetCollection"&&Array.isArray(s)&&(u=Zi.parse(s)):u=Bi.parse(s),{kind:"constant",evaluate:()=>u}}})(r===void 0?t.specification.default:r,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(t,r,s){return this.property.possiblyEvaluate(this,t,r,s)}}class mo{constructor(t){this.property=t,this.value=new qn(t,void 0)}transitioned(t,r){return new El(this.property,this.value,r,Mt({},t.transition,this.transition),t.now)}untransitioned(){return new El(this.property,this.value,null,{},0)}}class go{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return Ye(this._values[t].value.value)}setValue(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new mo(this._values[t].property)),this._values[t].value=new qn(this._values[t].property,r===null?void 0:Ye(r))}getTransition(t){return Ye(this._values[t].transition)}setTransition(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new mo(this._values[t].property)),this._values[t].transition=Ye(r)||void 0}serialize(){let t={};for(let r of Object.keys(this._values)){let s=this.getValue(r);s!==void 0&&(t[r]=s);let l=this.getTransition(r);l!==void 0&&(t[`${r}-transition`]=l)}return t}transitioned(t,r){let s=new Ms(this._properties);for(let l of Object.keys(this._values))s._values[l]=this._values[l].transitioned(t,r._values[l]);return s}untransitioned(){let t=new Ms(this._properties);for(let r of Object.keys(this._values))t._values[r]=this._values[r].untransitioned();return t}}class El{constructor(t,r,s,l,u){this.property=t,this.value=r,this.begin=u+l.delay||0,this.end=this.begin+l.duration||0,t.specification.transition&&(l.delay||l.duration)&&(this.prior=s)}possiblyEvaluate(t,r,s){let l=t.now||0,u=this.value.possiblyEvaluate(t,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(t,r,s);{let f=(l-this.begin)/(this.end-this.begin);return this.property.interpolate(d.possiblyEvaluate(t,r,s),u,(function(g){if(g<=0)return 0;if(g>=1)return 1;let x=g*g,v=x*g;return 4*(g<.5?v:3*(g-x)+v-.75)})(f))}}return u}}class Ms{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,r,s){let l=new Es(this._properties);for(let u of Object.keys(this._values))l._values[u]=this._values[u].possiblyEvaluate(t,r,s);return l}hasTransition(){for(let t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class As{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return this._values[t].value!==void 0}getValue(t){return Ye(this._values[t].value)}setValue(t,r){this._values[t]=new qn(this._values[t].property,r===null?void 0:Ye(r))}serialize(){let t={};for(let r of Object.keys(this._values)){let s=this.getValue(r);s!==void 0&&(t[r]=s)}return t}possiblyEvaluate(t,r,s){let l=new Es(this._properties);for(let u of Object.keys(this._values))l._values[u]=this._values[u].possiblyEvaluate(t,r,s);return l}}class Ir{constructor(t,r,s){this.property=t,this.value=r,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,r,s,l){return this.property.evaluate(this.value,this.parameters,t,r,s,l)}}class Es{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class De{constructor(t){this.specification=t}possiblyEvaluate(t,r){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(r)}interpolate(t,r,s){let l=Ci[this.specification.type];return l?l(t,r,s):t}}class je{constructor(t,r){this.specification=t,this.overrides=r}possiblyEvaluate(t,r,s,l){return new Ir(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(r,null,{},s,l)}:t.expression,r)}interpolate(t,r,s){if(t.value.kind!=="constant"||r.value.kind!=="constant")return t;if(t.value.value===void 0||r.value.value===void 0)return new Ir(this,{kind:"constant",value:void 0},t.parameters);let l=Ci[this.specification.type];if(l){let u=l(t.value.value,r.value.value,s);return new Ir(this,{kind:"constant",value:u},t.parameters)}return t}evaluate(t,r,s,l,u,d){return t.kind==="constant"?t.value:t.evaluate(r,s,l,u,d)}}class _o extends je{possiblyEvaluate(t,r,s,l){if(t.value===void 0)return new Ir(this,{kind:"constant",value:void 0},r);if(t.expression.kind==="constant"){let u=t.expression.evaluate(r,null,{},s,l),d=t.property.specification.type==="resolvedImage"&&typeof u!="string"?u.name:u,f=this._calculate(d,d,d,r);return new Ir(this,{kind:"constant",value:f},r)}if(t.expression.kind==="camera"){let u=this._calculate(t.expression.evaluate({zoom:r.zoom-1}),t.expression.evaluate({zoom:r.zoom}),t.expression.evaluate({zoom:r.zoom+1}),r);return new Ir(this,{kind:"constant",value:u},r)}return new Ir(this,t.expression,r)}evaluate(t,r,s,l,u,d){if(t.kind==="source"){let f=t.evaluate(r,s,l,u,d);return this._calculate(f,f,f,r)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(r.zoom)-1},s,l),t.evaluate({zoom:Math.floor(r.zoom)},s,l),t.evaluate({zoom:Math.floor(r.zoom)+1},s,l),r):t.value}_calculate(t,r,s,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:s,to:r}}interpolate(t){return t}}class yo{constructor(t){this.specification=t}possiblyEvaluate(t,r,s,l){if(t.value!==void 0){if(t.expression.kind==="constant"){let u=t.expression.evaluate(r,null,{},s,l);return this._calculate(u,u,u,r)}return this._calculate(t.expression.evaluate(new At(Math.floor(r.zoom-1),r)),t.expression.evaluate(new At(Math.floor(r.zoom),r)),t.expression.evaluate(new At(Math.floor(r.zoom+1),r)),r)}}_calculate(t,r,s,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:s,to:r}}interpolate(t){return t}}class Pa{constructor(t){this.specification=t}possiblyEvaluate(t,r,s,l){return!!t.expression.evaluate(r,null,{},s,l)}interpolate(){return!1}}class h{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let r in t){let s=t[r];s.specification.overridable&&this.overridableProperties.push(r);let l=this.defaultPropertyValues[r]=new qn(s,void 0),u=this.defaultTransitionablePropertyValues[r]=new mo(s);this.defaultTransitioningPropertyValues[r]=u.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=l.possiblyEvaluate({})}}}ke("DataDrivenProperty",je),ke("DataConstantProperty",De),ke("CrossFadedDataDrivenProperty",_o),ke("CrossFadedProperty",yo),ke("ColorRampProperty",Pa);let e="-transition";class n extends bn{constructor(t,r){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},t.type!=="custom"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),r.layout&&(this._unevaluatedLayout=new As(r.layout)),r.paint)){this._transitionablePaint=new go(r.paint);for(let s in t.paint)this.setPaintProperty(s,t.paint[s],{validate:!1});for(let s in t.layout)this.setLayoutProperty(s,t.layout[s],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Es(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,r,s={}){r!=null&&this._validate(Cl,`layers.${this.id}.layout.${t}`,t,r,s)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,r):this.visibility=r)}getPaintProperty(t){return t.endsWith(e)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,r,s={}){if(r!=null&&this._validate(Il,`layers.${this.id}.paint.${t}`,t,r,s))return!1;if(t.endsWith(e))return this._transitionablePaint.setTransition(t.slice(0,-11),r||void 0),!1;{let l=this._transitionablePaint._values[t],u=l.property.specification["property-type"]==="cross-faded-data-driven",d=l.value.isDataDriven(),f=l.value;this._transitionablePaint.setValue(t,r),this._handleSpecialPaintPropertyUpdate(t);let g=this._transitionablePaint._values[t].value;return g.isDataDriven()||d||u||this._handleOverridablePaintPropertyUpdate(t,f,g)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,r,s){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||this.visibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,r){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,r)}serialize(){let t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),yi(t,((r,s)=>!(r===void 0||s==="layout"&&!Object.keys(r).length||s==="paint"&&!Object.keys(r).length)))}_validate(t,r,s,l,u={}){return(!u||u.validate!==!1)&&va(this,t.call(pn,{key:r,layerType:this.type,objectKey:s,value:l,styleSpec:oe,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let t in this.paint._values){let r=this.paint.get(t);if(r instanceof Ir&&zn(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}let o={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class a{constructor(t,r){this._structArray=t,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class c{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,r){return t._trim(),r&&(t.isTransferred=!0,r.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){let r=Object.create(this.prototype);return r.arrayBuffer=t.arrayBuffer,r.length=t.length,r.capacity=t.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function m(i,t=1){let r=0,s=0;return{members:i.map((l=>{let u=o[l.type].BYTES_PER_ELEMENT,d=r=_(r,Math.max(t,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:_(r,Math.max(s,t)),alignment:t}}function _(i,t){return Math.ceil(i/t)*t}class y extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r){let s=this.length;return this.resize(s+1),this.emplace(s,t,r)}emplace(t,r,s){let l=2*t;return this.int16[l+0]=r,this.int16[l+1]=s,t}}y.prototype.bytesPerElement=4,ke("StructArrayLayout2i4",y);class b extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s){let l=this.length;return this.resize(l+1),this.emplace(l,t,r,s)}emplace(t,r,s,l){let u=3*t;return this.int16[u+0]=r,this.int16[u+1]=s,this.int16[u+2]=l,t}}b.prototype.bytesPerElement=6,ke("StructArrayLayout3i6",b);class S extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l){let u=this.length;return this.resize(u+1),this.emplace(u,t,r,s,l)}emplace(t,r,s,l,u){let d=4*t;return this.int16[d+0]=r,this.int16[d+1]=s,this.int16[d+2]=l,this.int16[d+3]=u,t}}S.prototype.bytesPerElement=8,ke("StructArrayLayout4i8",S);class T extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,u,d){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,s,l,u,d)}emplace(t,r,s,l,u,d,f){let g=6*t;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,t}}T.prototype.bytesPerElement=12,ke("StructArrayLayout2i4i12",T);class E extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,u,d){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,s,l,u,d)}emplace(t,r,s,l,u,d,f){let g=4*t,x=8*t;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,t}}E.prototype.bytesPerElement=8,ke("StructArrayLayout2i4ub8",E);class L extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r){let s=this.length;return this.resize(s+1),this.emplace(s,t,r)}emplace(t,r,s){let l=2*t;return this.float32[l+0]=r,this.float32[l+1]=s,t}}L.prototype.bytesPerElement=8,ke("StructArrayLayout2f8",L);class B extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,u,d,f,g,x,v){let w=this.length;return this.resize(w+1),this.emplace(w,t,r,s,l,u,d,f,g,x,v)}emplace(t,r,s,l,u,d,f,g,x,v,w){let C=10*t;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]=d,this.uint16[C+5]=f,this.uint16[C+6]=g,this.uint16[C+7]=x,this.uint16[C+8]=v,this.uint16[C+9]=w,t}}B.prototype.bytesPerElement=20,ke("StructArrayLayout10ui20",B);class V extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,u,d,f,g,x,v,w,C){let A=this.length;return this.resize(A+1),this.emplace(A,t,r,s,l,u,d,f,g,x,v,w,C)}emplace(t,r,s,l,u,d,f,g,x,v,w,C,A){let k=12*t;return this.int16[k+0]=r,this.int16[k+1]=s,this.int16[k+2]=l,this.int16[k+3]=u,this.uint16[k+4]=d,this.uint16[k+5]=f,this.uint16[k+6]=g,this.uint16[k+7]=x,this.int16[k+8]=v,this.int16[k+9]=w,this.int16[k+10]=C,this.int16[k+11]=A,t}}V.prototype.bytesPerElement=24,ke("StructArrayLayout4i4ui4i24",V);class $ extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,s){let l=this.length;return this.resize(l+1),this.emplace(l,t,r,s)}emplace(t,r,s,l){let u=3*t;return this.float32[u+0]=r,this.float32[u+1]=s,this.float32[u+2]=l,t}}$.prototype.bytesPerElement=12,ke("StructArrayLayout3f12",$);class q extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint32[1*t+0]=r,t}}q.prototype.bytesPerElement=4,ke("StructArrayLayout1ul4",q);class G extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,u,d,f,g,x){let v=this.length;return this.resize(v+1),this.emplace(v,t,r,s,l,u,d,f,g,x)}emplace(t,r,s,l,u,d,f,g,x,v){let w=10*t,C=5*t;return this.int16[w+0]=r,this.int16[w+1]=s,this.int16[w+2]=l,this.int16[w+3]=u,this.int16[w+4]=d,this.int16[w+5]=f,this.uint32[C+3]=g,this.uint16[w+8]=x,this.uint16[w+9]=v,t}}G.prototype.bytesPerElement=20,ke("StructArrayLayout6i1ul2ui20",G);class F extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,u,d){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,s,l,u,d)}emplace(t,r,s,l,u,d,f){let g=6*t;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,t}}F.prototype.bytesPerElement=12,ke("StructArrayLayout2i2i2i12",F);class J extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,u){let d=this.length;return this.resize(d+1),this.emplace(d,t,r,s,l,u)}emplace(t,r,s,l,u,d){let f=4*t,g=8*t;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,t}}J.prototype.bytesPerElement=16,ke("StructArrayLayout2f1f2i16",J);class Q extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,u,d){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,s,l,u,d)}emplace(t,r,s,l,u,d,f){let g=16*t,x=4*t,v=8*t;return this.uint8[g+0]=r,this.uint8[g+1]=s,this.float32[x+1]=l,this.float32[x+2]=u,this.int16[v+6]=d,this.int16[v+7]=f,t}}Q.prototype.bytesPerElement=16,ke("StructArrayLayout2ub2f2i16",Q);class ne extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,s){let l=this.length;return this.resize(l+1),this.emplace(l,t,r,s)}emplace(t,r,s,l){let u=3*t;return this.uint16[u+0]=r,this.uint16[u+1]=s,this.uint16[u+2]=l,t}}ne.prototype.bytesPerElement=6,ke("StructArrayLayout3ui6",ne);class ue extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,s,l,u,d,f,g,x,v,w,C,A,k,z,O,j){let ie=this.length;return this.resize(ie+1),this.emplace(ie,t,r,s,l,u,d,f,g,x,v,w,C,A,k,z,O,j)}emplace(t,r,s,l,u,d,f,g,x,v,w,C,A,k,z,O,j,ie){let H=24*t,ee=12*t,ae=48*t;return this.int16[H+0]=r,this.int16[H+1]=s,this.uint16[H+2]=l,this.uint16[H+3]=u,this.uint32[ee+2]=d,this.uint32[ee+3]=f,this.uint32[ee+4]=g,this.uint16[H+10]=x,this.uint16[H+11]=v,this.uint16[H+12]=w,this.float32[ee+7]=C,this.float32[ee+8]=A,this.uint8[ae+36]=k,this.uint8[ae+37]=z,this.uint8[ae+38]=O,this.uint32[ee+10]=j,this.int16[H+22]=ie,t}}ue.prototype.bytesPerElement=48,ke("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",ue);class me extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,s,l,u,d,f,g,x,v,w,C,A,k,z,O,j,ie,H,ee,ae,fe,Me,Ue,Ie,we,Fe,Le){let Ee=this.length;return this.resize(Ee+1),this.emplace(Ee,t,r,s,l,u,d,f,g,x,v,w,C,A,k,z,O,j,ie,H,ee,ae,fe,Me,Ue,Ie,we,Fe,Le)}emplace(t,r,s,l,u,d,f,g,x,v,w,C,A,k,z,O,j,ie,H,ee,ae,fe,Me,Ue,Ie,we,Fe,Le,Ee){let he=32*t,Oe=16*t;return this.int16[he+0]=r,this.int16[he+1]=s,this.int16[he+2]=l,this.int16[he+3]=u,this.int16[he+4]=d,this.int16[he+5]=f,this.int16[he+6]=g,this.int16[he+7]=x,this.uint16[he+8]=v,this.uint16[he+9]=w,this.uint16[he+10]=C,this.uint16[he+11]=A,this.uint16[he+12]=k,this.uint16[he+13]=z,this.uint16[he+14]=O,this.uint16[he+15]=j,this.uint16[he+16]=ie,this.uint16[he+17]=H,this.uint16[he+18]=ee,this.uint16[he+19]=ae,this.uint16[he+20]=fe,this.uint16[he+21]=Me,this.uint16[he+22]=Ue,this.uint32[Oe+12]=Ie,this.float32[Oe+13]=we,this.float32[Oe+14]=Fe,this.uint16[he+30]=Le,this.uint16[he+31]=Ee,t}}me.prototype.bytesPerElement=64,ke("StructArrayLayout8i15ui1ul2f2ui64",me);class Te extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.float32[1*t+0]=r,t}}Te.prototype.bytesPerElement=4,ke("StructArrayLayout1f4",Te);class Ae extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,s){let l=this.length;return this.resize(l+1),this.emplace(l,t,r,s)}emplace(t,r,s,l){let u=3*t;return this.uint16[6*t+0]=r,this.float32[u+1]=s,this.float32[u+2]=l,t}}Ae.prototype.bytesPerElement=12,ke("StructArrayLayout1ui2f12",Ae);class xe extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,s){let l=this.length;return this.resize(l+1),this.emplace(l,t,r,s)}emplace(t,r,s,l){let u=4*t;return this.uint32[2*t+0]=r,this.uint16[u+2]=s,this.uint16[u+3]=l,t}}xe.prototype.bytesPerElement=8,ke("StructArrayLayout1ul2ui8",xe);class ye extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r){let s=this.length;return this.resize(s+1),this.emplace(s,t,r)}emplace(t,r,s){let l=2*t;return this.uint16[l+0]=r,this.uint16[l+1]=s,t}}ye.prototype.bytesPerElement=4,ke("StructArrayLayout2ui4",ye);class Re extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint16[1*t+0]=r,t}}Re.prototype.bytesPerElement=2,ke("StructArrayLayout1ui2",Re);class We extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,s,l){let u=this.length;return this.resize(u+1),this.emplace(u,t,r,s,l)}emplace(t,r,s,l,u){let d=4*t;return this.float32[d+0]=r,this.float32[d+1]=s,this.float32[d+2]=l,this.float32[d+3]=u,t}}We.prototype.bytesPerElement=16,ke("StructArrayLayout4f16",We);class be extends a{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 pe(this.anchorPointX,this.anchorPointY)}}be.prototype.size=20;class Pe extends G{get(t){return new be(this,t)}}ke("CollisionBoxArray",Pe);class Ze extends a{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Ze.prototype.size=48;class Et extends ue{get(t){return new Ze(this,t)}}ke("PlacedSymbolArray",Et);class Qe extends a{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}Qe.prototype.size=64;class at extends me{get(t){return new Qe(this,t)}}ke("SymbolInstanceArray",at);class kt extends Te{getoffsetX(t){return this.float32[1*t+0]}}ke("GlyphOffsetArray",kt);class ui extends b{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}ke("SymbolLineVertexArray",ui);class cr extends a{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}cr.prototype.size=12;class zt extends Ae{get(t){return new cr(this,t)}}ke("TextAnchorOffsetArray",zt);class Mi extends a{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}Mi.prototype.size=8;class bi extends xe{get(t){return new Mi(this,t)}}ke("FeatureIndexArray",bi);class di extends y{}class wi extends y{}class Cr extends y{}class Zn extends T{}class xo extends E{}class Gn extends L{}class Xi extends B{}class vo extends V{}class Ma extends ${}class Ki extends q{}class Ji extends F{}class Gr extends Q{}class hr extends ne{}class oi extends ye{}let pi=m([{name:"a_pos",components:2,type:"Int16"}],4),{members:Vi}=pi;class ct{constructor(t=[]){this.segments=t}prepareSegment(t,r,s,l){let u=this.segments[this.segments.length-1];return t>ct.MAX_VERTEX_ARRAY_LENGTH&&ze(`Max vertices per segment is ${ct.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!u||u.vertexLength+t>ct.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(let t of this.segments)for(let r in t.vaos)t.vaos[r].destroy()}static simpleSegment(t,r,s,l){return new ct([{vertexOffset:t,primitiveOffset:r,vertexLength:s,primitiveLength:l,vaos:{},sortKey:0}])}}function fn(i,t){return 256*(i=Je(Math.floor(i),0,255))+Je(Math.floor(t),0,255)}ct.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,ke("SegmentVector",ct);let Hn=m([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Wn={exports:{}},kl={exports:{}};kl.exports=function(i,t){var r,s,l,u,d,f,g,x;for(s=i.length-(r=3&i.length),l=t,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 Bc=kl.exports,zl={exports:{}};zl.exports=function(i,t){for(var r,s=i.length,l=t^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 Hr=Bc,Ll=zl.exports;Wn.exports=Hr,Wn.exports.murmur3=Hr,Wn.exports.murmur2=Ll;var bo=Se(Wn.exports);class ks{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,r,s,l){this.ids.push(wo(t)),this.positions.push(r,s,l)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let r=wo(t),s=0,l=this.ids.length-1;for(;s<l;){let d=s+l>>1;this.ids[d]>=r?l=d:s=d+1}let 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(t,r){let s=new Float64Array(t.ids),l=new Uint32Array(t.positions);return So(s,l,0,s.length-1),r&&r.push(s.buffer,l.buffer),{ids:s,positions:l}}static deserialize(t){let r=new ks;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}}function wo(i){let t=+i;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:bo(String(i))}function So(i,t,r,s){for(;r<s;){let l=i[r+s>>1],u=r-1,d=s+1;for(;;){do u++;while(i[u]<l);do d--;while(i[d]>l);if(u>=d)break;Xn(i,u,d),Xn(t,3*u,3*d),Xn(t,3*u+1,3*d+1),Xn(t,3*u+2,3*d+2)}d-r<s-d?(So(i,t,r,d),r=d+1):(So(i,t,d+1,s),s=d)}}function Xn(i,t,r){let s=i[t];i[t]=i[r],i[r]=s}ke("FeaturePositionMap",ks);class zs{constructor(t,r){this.gl=t.gl,this.location=r}}class Dl extends zs{constructor(t,r){super(t,r),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class jh extends zs{constructor(t,r){super(t,r),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class $h extends zs{constructor(t,r){super(t,r),this.current=vt.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}let rp=new Float32Array(16);function Fc(i){return[fn(255*i.r,255*i.g),fn(255*i.b,255*i.a)]}class Aa{constructor(t,r,s){this.value=t,this.uniformNames=r.map((l=>`u_${l}`)),this.type=s}setUniform(t,r,s){t.set(s.constantOr(this.value))}getBinding(t,r,s){return this.type==="color"?new $h(t,r):new Dl(t,r)}}class To{constructor(t,r){this.uniformNames=r.map((s=>`u_${s}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=t.tlbr}setUniform(t,r,s,l){let 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&&t.set(u)}getBinding(t,r,s){return s.substr(0,9)==="u_pattern"?new jh(t,r):new Dl(t,r)}}class mn{constructor(t,r,s,l){this.expression=t,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(t,r,s,l,u){let d=this.paintVertexArray.length,f=this.expression.evaluate(new At(0),r,{},l,[],u);this.paintVertexArray.resize(t),this._setPaintValue(d,t,f)}updatePaintArray(t,r,s,l){let u=this.expression.evaluate({zoom:0},s,l);this._setPaintValue(t,r,u)}_setPaintValue(t,r,s){if(this.type==="color"){let l=Fc(s);for(let u=t;u<r;u++)this.paintVertexArray.emplace(u,l[0],l[1])}else{for(let l=t;l<r;l++)this.paintVertexArray.emplace(l,s);this.maxValue=Math.max(this.maxValue,Math.abs(s))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Rr{constructor(t,r,s,l,u,d){this.expression=t,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(t,r,s,l,u){let d=this.expression.evaluate(new At(this.zoom),r,{},l,[],u),f=this.expression.evaluate(new At(this.zoom+1),r,{},l,[],u),g=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(g,t,d,f)}updatePaintArray(t,r,s,l){let u=this.expression.evaluate({zoom:this.zoom},s,l),d=this.expression.evaluate({zoom:this.zoom+1},s,l);this._setPaintValue(t,r,u,d)}_setPaintValue(t,r,s,l){if(this.type==="color"){let u=Fc(s),d=Fc(l);for(let f=t;f<r;f++)this.paintVertexArray.emplace(f,u[0],u[1],d[0],d[1])}else{for(let u=t;u<r;u++)this.paintVertexArray.emplace(u,s,l);this.maxValue=Math.max(this.maxValue,Math.abs(s),Math.abs(l))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,r){let s=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,l=Je(this.expression.interpolationFactor(s,this.zoom,this.zoom+1),0,1);t.set(l)}getBinding(t,r,s){return new Dl(t,r)}}class Kn{constructor(t,r,s,l,u,d){this.expression=t,this.type=r,this.useIntegerZoom=s,this.zoom=l,this.layerId=d,this.zoomInPaintVertexArray=new u,this.zoomOutPaintVertexArray=new u}populatePaintArray(t,r,s){let l=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(l,t,r.patterns&&r.patterns[this.layerId],s)}updatePaintArray(t,r,s,l,u){this._setPaintValues(t,r,s.patterns&&s.patterns[this.layerId],u)}_setPaintValues(t,r,s,l){if(!l||!s)return;let{min:u,mid:d,max:f}=s,g=l[u],x=l[d],v=l[f];if(g&&x&&v)for(let w=t;w<r;w++)this.zoomInPaintVertexArray.emplace(w,x.tl[0],x.tl[1],x.br[0],x.br[1],g.tl[0],g.tl[1],g.br[0],g.br[1],x.pixelRatio,g.pixelRatio),this.zoomOutPaintVertexArray.emplace(w,x.tl[0],x.tl[1],x.br[0],x.br[1],v.tl[0],v.tl[1],v.br[0],v.br[1],x.pixelRatio,v.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,Hn.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,Hn.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class qh{constructor(t,r,s){this.binders={},this._buffers=[];let l=[];for(let u in t.paint._values){if(!s(u))continue;let d=t.paint.get(u);if(!(d instanceof Ir&&zn(d.property.specification)))continue;let f=np(u,t.type),g=d.value,x=d.property.specification.type,v=d.property.useIntegerZoom,w=d.property.specification["property-type"],C=w==="cross-faded"||w==="cross-faded-data-driven";if(g.kind==="constant")this.binders[u]=C?new To(g.value,f):new Aa(g.value,f,x),l.push(`/u_${u}`);else if(g.kind==="source"||C){let A=Zh(u,x,"source");this.binders[u]=C?new Kn(g,x,v,r,A,t.id):new mn(g,f,x,A),l.push(`/a_${u}`)}else{let A=Zh(u,x,"composite");this.binders[u]=new Rr(g,f,x,v,r,A),l.push(`/z_${u}`)}}this.cacheKey=l.sort().join("")}getMaxValue(t){let r=this.binders[t];return r instanceof mn||r instanceof Rr?r.maxValue:0}populatePaintArrays(t,r,s,l,u){for(let d in this.binders){let f=this.binders[d];(f instanceof mn||f instanceof Rr||f instanceof Kn)&&f.populatePaintArray(t,r,s,l,u)}}setConstantPatternPositions(t,r){for(let s in this.binders){let l=this.binders[s];l instanceof To&&l.setConstantPatternPositions(t,r)}}updatePaintArrays(t,r,s,l,u){let d=!1;for(let f in t){let g=r.getPositions(f);for(let x of g){let v=s.feature(x.index);for(let w in this.binders){let C=this.binders[w];if((C instanceof mn||C instanceof Rr||C instanceof Kn)&&C.expression.isStateDependent===!0){let A=l.paint.get(w);C.expression=A.value,C.updatePaintArray(x.start,x.end,v,t[f],u),d=!0}}}}return d}defines(){let t=[];for(let r in this.binders){let s=this.binders[r];(s instanceof Aa||s instanceof To)&&t.push(...s.uniformNames.map((l=>`#define HAS_UNIFORM_${l}`)))}return t}getBinderAttributes(){let t=[];for(let r in this.binders){let s=this.binders[r];if(s instanceof mn||s instanceof Rr)for(let l=0;l<s.paintVertexAttributes.length;l++)t.push(s.paintVertexAttributes[l].name);else if(s instanceof Kn)for(let l=0;l<Hn.members.length;l++)t.push(Hn.members[l].name)}return t}getBinderUniforms(){let t=[];for(let r in this.binders){let s=this.binders[r];if(s instanceof Aa||s instanceof To||s instanceof Rr)for(let l of s.uniformNames)t.push(l)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,r){let s=[];for(let l in this.binders){let u=this.binders[l];if(u instanceof Aa||u instanceof To||u instanceof Rr){for(let d of u.uniformNames)if(r[d]){let f=u.getBinding(t,r[d],d);s.push({name:d,property:l,binding:f})}}}return s}setUniforms(t,r,s,l){for(let{name:u,property:d,binding:f}of r)this.binders[d].setUniform(f,l,s.get(d),u)}updatePaintBuffers(t){this._buffers=[];for(let r in this.binders){let s=this.binders[r];if(t&&s instanceof Kn){let l=t.fromScale===2?s.zoomInPaintVertexBuffer:s.zoomOutPaintVertexBuffer;l&&this._buffers.push(l)}else(s instanceof mn||s instanceof Rr)&&s.paintVertexBuffer&&this._buffers.push(s.paintVertexBuffer)}}upload(t){for(let r in this.binders){let s=this.binders[r];(s instanceof mn||s instanceof Rr||s instanceof Kn)&&s.upload(t)}this.updatePaintBuffers()}destroy(){for(let t in this.binders){let r=this.binders[t];(r instanceof mn||r instanceof Rr||r instanceof Kn)&&r.destroy()}}}class Ls{constructor(t,r,s=(()=>!0)){this.programConfigurations={};for(let l of t)this.programConfigurations[l.id]=new qh(l,r,s);this.needsUpload=!1,this._featureMap=new ks,this._bufferOffset=0}populatePaintArrays(t,r,s,l,u,d){for(let f in this.programConfigurations)this.programConfigurations[f].populatePaintArrays(t,r,l,u,d);r.id!==void 0&&this._featureMap.add(r.id,s,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,r,s,l){for(let u of s)this.needsUpload=this.programConfigurations[u.id].updatePaintArrays(t,this._featureMap,r,u,l)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(let r in this.programConfigurations)this.programConfigurations[r].upload(t);this.needsUpload=!1}}destroy(){for(let t in this.programConfigurations)this.programConfigurations[t].destroy()}}function np(i,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[i]||[i.replace(`${t}-`,"").replace(/-/g,"_")]}function Zh(i,t,r){let s={color:{source:L,composite:We},number:{source:Te,composite:L}},l=(function(u){return{"line-pattern":{source:Xi,composite:Xi},"fill-pattern":{source:Xi,composite:Xi},"fill-extrusion-pattern":{source:Xi,composite:Xi}}[u]})(i);return l&&l[r]||s[t][r]}ke("ConstantBinder",Aa),ke("CrossFadedConstantBinder",To),ke("SourceExpressionBinder",mn),ke("CrossFadedCompositeBinder",Kn),ke("CompositeExpressionBinder",Rr),ke("ProgramConfiguration",qh,{omit:["_buffers"]}),ke("ProgramConfigurationSet",Ls);let Kt=8192,Oc=Math.pow(2,14)-1,Gh=-Oc-1;function Ds(i){let t=Kt/i.extent,r=i.loadGeometry();for(let s=0;s<r.length;s++){let l=r[s];for(let u=0;u<l.length;u++){let d=l[u],f=Math.round(d.x*t),g=Math.round(d.y*t);d.x=Je(f,Gh,Oc),d.y=Je(g,Gh,Oc),(f<d.x||f>d.x+1||g<d.y||g>d.y+1)&&ze("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Rs(i,t){return{type:i.type,id:i.id,properties:i.properties,geometry:t?Ds(i):[]}}function Rl(i,t,r,s,l){i.emplaceBack(2*t+(s+1)/2,2*r+(l+1)/2)}class Nc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((r=>r.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new wi,this.indexArray=new hr,this.segments=new ct,this.programConfigurations=new Ls(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((r=>r.isStateDependent())).map((r=>r.id))}populate(t,r,s){let l=this.layers[0],u=[],d=null,f=!1;l.type==="circle"&&(d=l.layout.get("circle-sort-key"),f=!d.isConstant());for(let{feature:g,id:x,index:v,sourceLayerIndex:w}of t){let C=this.layers[0]._featureFilter.needGeometry,A=Rs(g,C);if(!this.layers[0]._featureFilter.filter(new At(this.zoom),A,s))continue;let k=f?d.evaluate(A,{},s):void 0,z={id:x,properties:g.properties,type:g.type,sourceLayerIndex:w,index:v,geometry:C?A.geometry:Ds(g),patterns:{},sortKey:k};u.push(z)}f&&u.sort(((g,x)=>g.sortKey-x.sortKey));for(let g of u){let{geometry:x,index:v,sourceLayerIndex:w}=g,C=t[v].feature;this.addFeature(g,x,v,s),r.featureIndex.insert(C,x,v,w,this.index)}}update(t,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Vi),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,r,s,l){for(let u of r)for(let d of u){let f=d.x,g=d.y;if(f<0||f>=Kt||g<0||g>=Kt)continue;let x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),v=x.vertexLength;Rl(this.layoutVertexArray,f,g,-1,-1),Rl(this.layoutVertexArray,f,g,1,-1),Rl(this.layoutVertexArray,f,g,1,1),Rl(this.layoutVertexArray,f,g,-1,1),this.indexArray.emplaceBack(v,v+1,v+2),this.indexArray.emplaceBack(v,v+3,v+2),x.vertexLength+=4,x.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,s,{},l)}}function Hh(i,t){for(let r=0;r<i.length;r++)if(Io(t,i[r]))return!0;for(let r=0;r<t.length;r++)if(Io(i,t[r]))return!0;return!!Vc(i,t)}function sp(i,t,r){return!!Io(i,t)||!!Uc(t,i,r)}function Wh(i,t){if(i.length===1)return Kh(t,i[0]);for(let r=0;r<t.length;r++){let s=t[r];for(let l=0;l<s.length;l++)if(Io(i,s[l]))return!0}for(let r=0;r<i.length;r++)if(Kh(t,i[r]))return!0;for(let r=0;r<t.length;r++)if(Vc(i,t[r]))return!0;return!1}function op(i,t,r){if(i.length>1){if(Vc(i,t))return!0;for(let s=0;s<t.length;s++)if(Uc(t[s],i,r))return!0}for(let s=0;s<i.length;s++)if(Uc(i[s],t,r))return!0;return!1}function Vc(i,t){if(i.length===0||t.length===0)return!1;for(let r=0;r<i.length-1;r++){let s=i[r],l=i[r+1];for(let u=0;u<t.length-1;u++)if(ap(s,l,t[u],t[u+1]))return!0}return!1}function ap(i,t,r,s){return tt(i,r,s)!==tt(t,r,s)&&tt(i,t,r)!==tt(i,t,s)}function Uc(i,t,r){let s=r*r;if(t.length===1)return i.distSqr(t[0])<s;for(let l=1;l<t.length;l++)if(Xh(i,t[l-1],t[l])<s)return!0;return!1}function Xh(i,t,r){let s=t.distSqr(r);if(s===0)return i.distSqr(t);let l=((i.x-t.x)*(r.x-t.x)+(i.y-t.y)*(r.y-t.y))/s;return i.distSqr(l<0?t:l>1?r:r.sub(t)._mult(l)._add(t))}function Kh(i,t){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>t.y!=l.y>t.y&&t.x<(l.x-s.x)*(t.y-s.y)/(l.y-s.y)+s.x&&(u=!u)}return u}function Io(i,t){let r=!1;for(let s=0,l=i.length-1;s<i.length;l=s++){let u=i[s],d=i[l];u.y>t.y!=d.y>t.y&&t.x<(d.x-u.x)*(t.y-u.y)/(d.y-u.y)+u.x&&(r=!r)}return r}function lp(i,t,r){let s=r[0],l=r[2];if(i.x<s.x&&t.x<s.x||i.x>l.x&&t.x>l.x||i.y<s.y&&t.y<s.y||i.y>l.y&&t.y>l.y)return!1;let u=tt(i,t,r[0]);return u!==tt(i,t,r[1])||u!==tt(i,t,r[2])||u!==tt(i,t,r[3])}function Ea(i,t,r){let s=t.paint.get(i).value;return s.kind==="constant"?s.value:r.programConfigurations.get(t.id).getMaxValue(i)}function Bl(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function Fl(i,t,r,s,l){if(!t[0]&&!t[1])return i;let u=pe.convert(t)._mult(l);r==="viewport"&&u._rotate(-s);let d=[];for(let f=0;f<i.length;f++)d.push(i[f].sub(u));return d}let Jh,Yh;ke("CircleBucket",Nc,{omit:["layers"]});var cp={get paint(){return Yh=Yh||new h({"circle-radius":new je(oe.paint_circle["circle-radius"]),"circle-color":new je(oe.paint_circle["circle-color"]),"circle-blur":new je(oe.paint_circle["circle-blur"]),"circle-opacity":new je(oe.paint_circle["circle-opacity"]),"circle-translate":new De(oe.paint_circle["circle-translate"]),"circle-translate-anchor":new De(oe.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new De(oe.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new De(oe.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new je(oe.paint_circle["circle-stroke-width"]),"circle-stroke-color":new je(oe.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new je(oe.paint_circle["circle-stroke-opacity"])})},get layout(){return Jh=Jh||new h({"circle-sort-key":new je(oe.layout_circle["circle-sort-key"])})}},Ai=1e-6,Co=typeof Float32Array<"u"?Float32Array:Array;function jc(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 Qh(i,t,r){var s=t[0],l=t[1],u=t[2],d=t[3],f=t[4],g=t[5],x=t[6],v=t[7],w=t[8],C=t[9],A=t[10],k=t[11],z=t[12],O=t[13],j=t[14],ie=t[15],H=r[0],ee=r[1],ae=r[2],fe=r[3];return i[0]=H*s+ee*f+ae*w+fe*z,i[1]=H*l+ee*g+ae*C+fe*O,i[2]=H*u+ee*x+ae*A+fe*j,i[3]=H*d+ee*v+ae*k+fe*ie,i[4]=(H=r[4])*s+(ee=r[5])*f+(ae=r[6])*w+(fe=r[7])*z,i[5]=H*l+ee*g+ae*C+fe*O,i[6]=H*u+ee*x+ae*A+fe*j,i[7]=H*d+ee*v+ae*k+fe*ie,i[8]=(H=r[8])*s+(ee=r[9])*f+(ae=r[10])*w+(fe=r[11])*z,i[9]=H*l+ee*g+ae*C+fe*O,i[10]=H*u+ee*x+ae*A+fe*j,i[11]=H*d+ee*v+ae*k+fe*ie,i[12]=(H=r[12])*s+(ee=r[13])*f+(ae=r[14])*w+(fe=r[15])*z,i[13]=H*l+ee*g+ae*C+fe*O,i[14]=H*u+ee*x+ae*A+fe*j,i[15]=H*d+ee*v+ae*k+fe*ie,i}Math.hypot||(Math.hypot=function(){for(var i=0,t=arguments.length;t--;)i+=arguments[t]*arguments[t];return Math.sqrt(i)});var ka,hp=Qh;function Ol(i,t,r){var s=t[0],l=t[1],u=t[2],d=t[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}ka=new Co(4),Co!=Float32Array&&(ka[0]=0,ka[1]=0,ka[2]=0,ka[3]=0);class up extends n{constructor(t){super(t,cp)}createBucket(t){return new Nc(t)}queryRadius(t){let r=t;return Ea("circle-radius",this,r)+Ea("circle-stroke-width",this,r)+Bl(this.paint.get("circle-translate"))}queryIntersectsFeature(t,r,s,l,u,d,f,g){let x=Fl(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),d.angle,f),v=this.paint.get("circle-radius").evaluate(r,s)+this.paint.get("circle-stroke-width").evaluate(r,s),w=this.paint.get("circle-pitch-alignment")==="map",C=w?x:(function(k,z){return k.map((O=>eu(O,z)))})(x,g),A=w?v*f:v;for(let k of l)for(let z of k){let O=w?z:eu(z,g),j=A,ie=Ol([],[z.x,z.y,0,1],g);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?j*=ie[3]/d.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(j*=d.cameraToCenterDistance/ie[3]),sp(C,O,j))return!0}return!1}}function eu(i,t){let r=Ol([],[i.x,i.y,0,1],t);return new pe(r[0]/r[3],r[1]/r[3])}class tu extends Nc{}let iu;ke("HeatmapBucket",tu,{omit:["layers"]});var dp={get paint(){return iu=iu||new h({"heatmap-radius":new je(oe.paint_heatmap["heatmap-radius"]),"heatmap-weight":new je(oe.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new De(oe.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Pa(oe.paint_heatmap["heatmap-color"]),"heatmap-opacity":new De(oe.paint_heatmap["heatmap-opacity"])})}};function $c(i,{width:t,height:r},s,l){if(l){if(l instanceof Uint8ClampedArray)l=new Uint8Array(l.buffer);else if(l.length!==t*r*s)throw new RangeError(`mismatched image size. expected: ${l.length} but got: ${t*r*s}`)}else l=new Uint8Array(t*r*s);return i.width=t,i.height=r,i.data=l,i}function ru(i,{width:t,height:r},s){if(t===i.width&&r===i.height)return;let l=$c({},{width:t,height:r},s);qc(i,l,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,t),height:Math.min(i.height,r)},s),i.width=t,i.height=r,i.data=l.data}function qc(i,t,r,s,l,u){if(l.width===0||l.height===0)return t;if(l.width>i.width||l.height>i.height||r.x>i.width-l.width||r.y>i.height-l.height)throw new RangeError("out of range source coordinates for image copy");if(l.width>t.width||l.height>t.height||s.x>t.width-l.width||s.y>t.height-l.height)throw new RangeError("out of range destination coordinates for image copy");let d=i.data,f=t.data;if(d===f)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g<l.height;g++){let x=((r.y+g)*i.width+r.x)*u,v=((s.y+g)*t.width+s.x)*u;for(let w=0;w<l.width*u;w++)f[v+w]=d[x+w]}return t}class za{constructor(t,r){$c(this,t,1,r)}resize(t){ru(this,t,1)}clone(){return new za({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,s,l,u){qc(t,r,s,l,u,1)}}class ur{constructor(t,r){$c(this,t,4,r)}resize(t){ru(this,t,4)}replace(t,r){r?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new ur({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,s,l,u){qc(t,r,s,l,u,4)}}function nu(i){let t={},r=i.resolution||256,s=i.clips?i.clips.length:1,l=i.image||new ur({width:r,height:s});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);let u=(d,f,g)=>{t[i.evaluationKey]=g;let x=i.expression.evaluate(t);l.data[d+f+0]=Math.floor(255*x.r/x.a),l.data[d+f+1]=Math.floor(255*x.g/x.a),l.data[d+f+2]=Math.floor(255*x.b/x.a),l.data[d+f+3]=Math.floor(255*x.a)};if(i.clips)for(let d=0,f=0;d<s;++d,f+=4*r)for(let g=0,x=0;g<r;g++,x+=4){let v=g/(r-1),{start:w,end:C}=i.clips[d];u(f,x,w*(1-v)+C*v)}else for(let d=0,f=0;d<r;d++,f+=4)u(0,f,d/(r-1));return l}ke("AlphaImage",za),ke("RGBAImage",ur);let Zc="big-fb";class pp extends n{createBucket(t){return new tu(t)}constructor(t){super(t,dp),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=nu({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Zc)&&this.heatmapFbos.delete(Zc)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let su;var fp={get paint(){return su=su||new h({"hillshade-illumination-direction":new De(oe.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new De(oe.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new De(oe.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new De(oe.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new De(oe.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new De(oe.paint_hillshade["hillshade-accent-color"])})}};class mp extends n{constructor(t){super(t,fp)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}let gp=m([{name:"a_pos",components:2,type:"Int16"}],4),{members:_p}=gp;function ou(i,t,r=2){let s=t&&t.length,l=s?t[0]*r:i.length,u=au(i,0,l,r,!0),d=[];if(!u||u.next===u.prev)return d;let f,g,x;if(s&&(u=(function(v,w,C,A){let k=[];for(let z=0,O=w.length;z<O;z++){let j=au(v,w[z]*A,z<O-1?w[z+1]*A:v.length,A,!1);j===j.next&&(j.steiner=!0),k.push(Ip(j))}k.sort(wp);for(let z=0;z<k.length;z++)C=Sp(k[z],C);return C})(i,t,u,r)),i.length>80*r){f=1/0,g=1/0;let v=-1/0,w=-1/0;for(let C=r;C<l;C+=r){let A=i[C],k=i[C+1];A<f&&(f=A),k<g&&(g=k),A>v&&(v=A),k>w&&(w=k)}x=Math.max(v-f,w-g),x=x!==0?32767/x:0}return La(u,d,r,f,g,x,0),d}function au(i,t,r,s,l){let u;if(l===(function(d,f,g,x){let v=0;for(let w=f,C=g-x;w<g;w+=x)v+=(d[C]-d[w])*(d[w+1]+d[C+1]),C=w;return v})(i,t,r,s)>0)for(let d=t;d<r;d+=s)u=hu(d/s|0,i[d],i[d+1],u);else for(let d=r-s;d>=t;d-=s)u=hu(d/s|0,i[d],i[d+1],u);return u&&Nl(u,u.next)&&(Ra(u),u=u.next),u}function Bs(i,t){if(!i)return i;t||(t=i);let r,s=i;do if(r=!1,s.steiner||!Nl(s,s.next)&&Ht(s.prev,s,s.next)!==0)s=s.next;else{if(Ra(s),s=t=s.prev,s===s.next)break;r=!0}while(r||s!==t);return t}function La(i,t,r,s,l,u,d){if(!i)return;!d&&u&&(function(g,x,v,w){let C=g;do C.z===0&&(C.z=Gc(C.x,C.y,x,v,w)),C.prevZ=C.prev,C.nextZ=C.next,C=C.next;while(C!==g);C.prevZ.nextZ=null,C.prevZ=null,(function(A){let k,z=1;do{let O,j=A;A=null;let ie=null;for(k=0;j;){k++;let H=j,ee=0;for(let fe=0;fe<z&&(ee++,H=H.nextZ,H);fe++);let ae=z;for(;ee>0||ae>0&&H;)ee!==0&&(ae===0||!H||j.z<=H.z)?(O=j,j=j.nextZ,ee--):(O=H,H=H.nextZ,ae--),ie?ie.nextZ=O:A=O,O.prevZ=ie,ie=O;j=H}ie.nextZ=null,z*=2}while(k>1)})(C)})(i,s,l,u);let f=i;for(;i.prev!==i.next;){let g=i.prev,x=i.next;if(u?xp(i,s,l,u):yp(i))t.push(g.i,i.i,x.i),Ra(i),i=x.next,f=x.next;else if((i=x)===f){d?d===1?La(i=vp(Bs(i),t),t,r,s,l,u,2):d===2&&bp(i,t,r,s,l,u):La(Bs(i),t,r,s,l,u,1);break}}}function yp(i){let t=i.prev,r=i,s=i.next;if(Ht(t,r,s)>=0)return!1;let l=t.x,u=r.x,d=s.x,f=t.y,g=r.y,x=s.y,v=l<u?l<d?l:d:u<d?u:d,w=f<g?f<x?f:x:g<x?g:x,C=l>u?l>d?l:d:u>d?u:d,A=f>g?f>x?f:x:g>x?g:x,k=s.next;for(;k!==t;){if(k.x>=v&&k.x<=C&&k.y>=w&&k.y<=A&&Po(l,f,u,g,d,x,k.x,k.y)&&Ht(k.prev,k,k.next)>=0)return!1;k=k.next}return!0}function xp(i,t,r,s){let l=i.prev,u=i,d=i.next;if(Ht(l,u,d)>=0)return!1;let f=l.x,g=u.x,x=d.x,v=l.y,w=u.y,C=d.y,A=f<g?f<x?f:x:g<x?g:x,k=v<w?v<C?v:C:w<C?w:C,z=f>g?f>x?f:x:g>x?g:x,O=v>w?v>C?v:C:w>C?w:C,j=Gc(A,k,t,r,s),ie=Gc(z,O,t,r,s),H=i.prevZ,ee=i.nextZ;for(;H&&H.z>=j&&ee&&ee.z<=ie;){if(H.x>=A&&H.x<=z&&H.y>=k&&H.y<=O&&H!==l&&H!==d&&Po(f,v,g,w,x,C,H.x,H.y)&&Ht(H.prev,H,H.next)>=0||(H=H.prevZ,ee.x>=A&&ee.x<=z&&ee.y>=k&&ee.y<=O&&ee!==l&&ee!==d&&Po(f,v,g,w,x,C,ee.x,ee.y)&&Ht(ee.prev,ee,ee.next)>=0))return!1;ee=ee.nextZ}for(;H&&H.z>=j;){if(H.x>=A&&H.x<=z&&H.y>=k&&H.y<=O&&H!==l&&H!==d&&Po(f,v,g,w,x,C,H.x,H.y)&&Ht(H.prev,H,H.next)>=0)return!1;H=H.prevZ}for(;ee&&ee.z<=ie;){if(ee.x>=A&&ee.x<=z&&ee.y>=k&&ee.y<=O&&ee!==l&&ee!==d&&Po(f,v,g,w,x,C,ee.x,ee.y)&&Ht(ee.prev,ee,ee.next)>=0)return!1;ee=ee.nextZ}return!0}function vp(i,t){let r=i;do{let s=r.prev,l=r.next.next;!Nl(s,l)&&lu(s,r,r.next,l)&&Da(s,l)&&Da(l,s)&&(t.push(s.i,r.i,l.i),Ra(r),Ra(r.next),r=i=l),r=r.next}while(r!==i);return Bs(r)}function bp(i,t,r,s,l,u){let d=i;do{let f=d.next.next;for(;f!==d.prev;){if(d.i!==f.i&&Cp(d,f)){let g=cu(d,f);return d=Bs(d,d.next),g=Bs(g,g.next),La(d,t,r,s,l,u,0),void La(g,t,r,s,l,u,0)}f=f.next}d=d.next}while(d!==i)}function wp(i,t){return i.x-t.x}function Sp(i,t){let r=(function(l,u){let d=u,f=l.x,g=l.y,x,v=-1/0;do{if(g<=d.y&&g>=d.next.y&&d.next.y!==d.y){let z=d.x+(g-d.y)*(d.next.x-d.x)/(d.next.y-d.y);if(z<=f&&z>v&&(v=z,x=d.x<d.next.x?d:d.next,z===f))return x}d=d.next}while(d!==u);if(!x)return null;let w=x,C=x.x,A=x.y,k=1/0;d=x;do{if(f>=d.x&&d.x>=C&&f!==d.x&&Po(g<A?f:v,g,C,A,g<A?v:f,g,d.x,d.y)){let z=Math.abs(g-d.y)/(f-d.x);Da(d,l)&&(z<k||z===k&&(d.x>x.x||d.x===x.x&&Tp(x,d)))&&(x=d,k=z)}d=d.next}while(d!==w);return x})(i,t);if(!r)return t;let s=cu(r,i);return Bs(s,s.next),Bs(r,r.next)}function Tp(i,t){return Ht(i.prev,i,t.prev)<0&&Ht(t.next,i,i.next)<0}function Gc(i,t,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))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-s)*l|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Ip(i){let t=i,r=i;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==i);return r}function Po(i,t,r,s,l,u,d,f){return(l-d)*(t-f)>=(i-d)*(u-f)&&(i-d)*(s-f)>=(r-d)*(t-f)&&(r-d)*(u-f)>=(l-d)*(s-f)}function Cp(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!(function(r,s){let l=r;do{if(l.i!==r.i&&l.next.i!==r.i&&l.i!==s.i&&l.next.i!==s.i&&lu(l,l.next,r,s))return!0;l=l.next}while(l!==r);return!1})(i,t)&&(Da(i,t)&&Da(t,i)&&(function(r,s){let 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,t)&&(Ht(i.prev,i,t.prev)||Ht(i,t.prev,t))||Nl(i,t)&&Ht(i.prev,i,i.next)>0&&Ht(t.prev,t,t.next)>0)}function Ht(i,t,r){return(t.y-i.y)*(r.x-t.x)-(t.x-i.x)*(r.y-t.y)}function Nl(i,t){return i.x===t.x&&i.y===t.y}function lu(i,t,r,s){let l=Ul(Ht(i,t,r)),u=Ul(Ht(i,t,s)),d=Ul(Ht(r,s,i)),f=Ul(Ht(r,s,t));return l!==u&&d!==f||!(l!==0||!Vl(i,r,t))||!(u!==0||!Vl(i,s,t))||!(d!==0||!Vl(r,i,s))||!(f!==0||!Vl(r,t,s))}function Vl(i,t,r){return t.x<=Math.max(i.x,r.x)&&t.x>=Math.min(i.x,r.x)&&t.y<=Math.max(i.y,r.y)&&t.y>=Math.min(i.y,r.y)}function Ul(i){return i>0?1:i<0?-1:0}function Da(i,t){return Ht(i.prev,i,i.next)<0?Ht(i,t,i.next)>=0&&Ht(i,i.prev,t)>=0:Ht(i,t,i.prev)<0||Ht(i,i.next,t)<0}function cu(i,t){let r=Hc(i.i,i.x,i.y),s=Hc(t.i,t.x,t.y),l=i.next,u=t.prev;return i.next=t,t.prev=i,r.next=l,l.prev=r,s.next=r,r.prev=s,u.next=s,s.prev=u,s}function hu(i,t,r,s){let l=Hc(i,t,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 Ra(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 Hc(i,t,r){return{i,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Wc(i,t,r){let s=r.patternDependencies,l=!1;for(let u of t){let d=u.paint.get(`${i}-pattern`);d.isConstant()||(l=!0);let f=d.constantOr(null);f&&(l=!0,s[f.to]=!0,s[f.from]=!0)}return l}function Xc(i,t,r,s,l){let u=l.patternDependencies;for(let d of t){let 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),v=f.evaluate({zoom:s+1},r,{},l.availableImages);g=g&&g.name?g.name:g,x=x&&x.name?x.name:x,v=v&&v.name?v.name:v,u[g]=!0,u[x]=!0,u[v]=!0,r.patterns[d.id]={min:g,mid:x,max:v}}}return r}class Kc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((r=>r.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Cr,this.indexArray=new hr,this.indexArray2=new oi,this.programConfigurations=new Ls(t.layers,t.zoom),this.segments=new ct,this.segments2=new ct,this.stateDependentLayerIds=this.layers.filter((r=>r.isStateDependent())).map((r=>r.id))}populate(t,r,s){this.hasPattern=Wc("fill",this.layers,r);let l=this.layers[0].layout.get("fill-sort-key"),u=!l.isConstant(),d=[];for(let{feature:f,id:g,index:x,sourceLayerIndex:v}of t){let w=this.layers[0]._featureFilter.needGeometry,C=Rs(f,w);if(!this.layers[0]._featureFilter.filter(new At(this.zoom),C,s))continue;let A=u?l.evaluate(C,{},s,r.availableImages):void 0,k={id:g,properties:f.properties,type:f.type,sourceLayerIndex:v,index:x,geometry:w?C.geometry:Ds(f),patterns:{},sortKey:A};d.push(k)}u&&d.sort(((f,g)=>f.sortKey-g.sortKey));for(let f of d){let{geometry:g,index:x,sourceLayerIndex:v}=f;if(this.hasPattern){let w=Xc("fill",this.layers,f,this.zoom,r);this.patternFeatures.push(w)}else this.addFeature(f,g,x,s,{});r.featureIndex.insert(t[x].feature,g,x,v,this.index)}}update(t,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,s)}addFeatures(t,r,s){for(let 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(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,_p),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,r,s,l,u){for(let d of Ks(r,500)){let f=0;for(let A of d)f+=A.length;let g=this.segments.prepareSegment(f,this.layoutVertexArray,this.indexArray),x=g.vertexLength,v=[],w=[];for(let A of d){if(A.length===0)continue;A!==d[0]&&w.push(v.length/2);let k=this.segments2.prepareSegment(A.length,this.layoutVertexArray,this.indexArray2),z=k.vertexLength;this.layoutVertexArray.emplaceBack(A[0].x,A[0].y),this.indexArray2.emplaceBack(z+A.length-1,z),v.push(A[0].x),v.push(A[0].y);for(let O=1;O<A.length;O++)this.layoutVertexArray.emplaceBack(A[O].x,A[O].y),this.indexArray2.emplaceBack(z+O-1,z+O),v.push(A[O].x),v.push(A[O].y);k.vertexLength+=A.length,k.primitiveLength+=A.length}let C=ou(v,w);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,t,s,u,l)}}let uu,du;ke("FillBucket",Kc,{omit:["layers","patternFeatures"]});var Pp={get paint(){return du=du||new h({"fill-antialias":new De(oe.paint_fill["fill-antialias"]),"fill-opacity":new je(oe.paint_fill["fill-opacity"]),"fill-color":new je(oe.paint_fill["fill-color"]),"fill-outline-color":new je(oe.paint_fill["fill-outline-color"]),"fill-translate":new De(oe.paint_fill["fill-translate"]),"fill-translate-anchor":new De(oe.paint_fill["fill-translate-anchor"]),"fill-pattern":new _o(oe.paint_fill["fill-pattern"])})},get layout(){return uu=uu||new h({"fill-sort-key":new je(oe.layout_fill["fill-sort-key"])})}};class Mp extends n{constructor(t){super(t,Pp)}recalculate(t,r){super.recalculate(t,r);let s=this.paint._values["fill-outline-color"];s.value.kind==="constant"&&s.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new Kc(t)}queryRadius(){return Bl(this.paint.get("fill-translate"))}queryIntersectsFeature(t,r,s,l,u,d,f){return Wh(Fl(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),d.angle,f),l)}isTileClipped(){return!0}}let Ap=m([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Ep=m([{name:"a_centroid",components:2,type:"Int16"}],4),{members:kp}=Ap;var Jn={},zp=Ce,pu=Mo;function Mo(i,t,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(Lp,this,t)}function Lp(i,t,r){i==1?t.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,t):i==3?t.type=r.readVarint():i==4&&(t._geometry=r.pos)}function Dp(i){for(var t,r,s=0,l=0,u=i.length,d=u-1;l<u;d=l++)s+=((r=i[d]).x-(t=i[l]).x)*(t.y+r.y);return s}Mo.types=["Unknown","Point","LineString","Polygon"],Mo.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var t,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&&(t&&f.push(t),t=[]),t.push(new zp(u,d));else{if(s!==7)throw new Error("unknown command "+s);t&&t.push(t[0].clone())}}return t&&f.push(t),f},Mo.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var t=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<t;){if(s<=0){var v=i.readVarint();r=7&v,s=v>>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]},Mo.prototype.toGeoJSON=function(i,t,r){var s,l,u=this.extent*Math.pow(2,r),d=this.extent*i,f=this.extent*t,g=this.loadGeometry(),x=Mo.types[this.type];function v(A){for(var k=0;k<A.length;k++){var z=A[k];A[k]=[360*(z.x+d)/u-180,360/Math.PI*Math.atan(Math.exp((180-360*(z.y+f)/u)*Math.PI/180))-90]}}switch(this.type){case 1:var w=[];for(s=0;s<g.length;s++)w[s]=g[s][0];v(g=w);break;case 2:for(s=0;s<g.length;s++)v(g[s]);break;case 3:for(g=(function(A){var k=A.length;if(k<=1)return[A];for(var z,O,j=[],ie=0;ie<k;ie++){var H=Dp(A[ie]);H!==0&&(O===void 0&&(O=H<0),O===H<0?(z&&j.push(z),z=[A[ie]]):z.push(A[ie]))}return z&&j.push(z),j})(g),s=0;s<g.length;s++)for(l=0;l<g[s].length;l++)v(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 Rp=pu,fu=mu;function mu(i,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(Bp,this,t),this.length=this._features.length}function Bp(i,t,r){i===15?t.version=r.readVarint():i===1?t.name=r.readString():i===5?t.extent=r.readVarint():i===2?t._features.push(r.pos):i===3?t._keys.push(r.readString()):i===4&&t._values.push((function(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))}mu.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var t=this._pbf.readVarint()+this._pbf.pos;return new Rp(this._pbf,t,this.extent,this._keys,this._values)};var Fp=fu;function Op(i,t,r){if(i===3){var s=new Fp(r,r.readVarint()+r.pos);s.length&&(t[s.name]=s)}}Jn.VectorTile=function(i,t){this.layers=i.readFields(Op,{},t)},Jn.VectorTileFeature=pu,Jn.VectorTileLayer=fu;let Np=Jn.VectorTileFeature.types,Jc=Math.pow(2,13);function Ba(i,t,r,s,l,u,d,f){i.emplaceBack(t,r,2*Math.floor(s*Jc)+d,l*Jc*2,u*Jc*2,Math.round(f))}class Yc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((r=>r.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Zn,this.centroidVertexArray=new di,this.indexArray=new hr,this.programConfigurations=new Ls(t.layers,t.zoom),this.segments=new ct,this.stateDependentLayerIds=this.layers.filter((r=>r.isStateDependent())).map((r=>r.id))}populate(t,r,s){this.features=[],this.hasPattern=Wc("fill-extrusion",this.layers,r);for(let{feature:l,id:u,index:d,sourceLayerIndex:f}of t){let g=this.layers[0]._featureFilter.needGeometry,x=Rs(l,g);if(!this.layers[0]._featureFilter.filter(new At(this.zoom),x,s))continue;let v={id:u,sourceLayerIndex:f,index:d,geometry:g?x.geometry:Ds(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(Xc("fill-extrusion",this.layers,v,this.zoom,r)):this.addFeature(v,v.geometry,d,s,{}),r.featureIndex.insert(l,v.geometry,d,f,this.index,!0)}}addFeatures(t,r,s){for(let l of this.features){let{geometry:u}=l;this.addFeature(l,u,l.index,r,s)}}update(t,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,kp),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Ep.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,r,s,l,u){for(let d of Ks(r,500)){let f={x:0,y:0,vertexCount:0},g=0;for(let k of d)g+=k.length;let x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let k of d){if(k.length===0||Up(k))continue;let z=0;for(let O=0;O<k.length;O++){let j=k[O];if(O>=1){let ie=k[O-1];if(!Vp(j,ie)){x.vertexLength+4>ct.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let H=j.sub(ie)._perp()._unit(),ee=ie.dist(j);z+ee>32768&&(z=0),Ba(this.layoutVertexArray,j.x,j.y,H.x,H.y,0,0,z),Ba(this.layoutVertexArray,j.x,j.y,H.x,H.y,0,1,z),f.x+=2*j.x,f.y+=2*j.y,f.vertexCount+=2,z+=ee,Ba(this.layoutVertexArray,ie.x,ie.y,H.x,H.y,0,0,z),Ba(this.layoutVertexArray,ie.x,ie.y,H.x,H.y,0,1,z),f.x+=2*ie.x,f.y+=2*ie.y,f.vertexCount+=2;let ae=x.vertexLength;this.indexArray.emplaceBack(ae,ae+2,ae+1),this.indexArray.emplaceBack(ae+1,ae+2,ae+3),x.vertexLength+=4,x.primitiveLength+=2}}}}if(x.vertexLength+g>ct.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(g,this.layoutVertexArray,this.indexArray)),Np[t.type]!=="Polygon")continue;let v=[],w=[],C=x.vertexLength;for(let k of d)if(k.length!==0){k!==d[0]&&w.push(v.length/2);for(let z=0;z<k.length;z++){let O=k[z];Ba(this.layoutVertexArray,O.x,O.y,0,0,1,1,0),f.x+=O.x,f.y+=O.y,f.vertexCount+=1,v.push(O.x),v.push(O.y)}}let A=ou(v,w);for(let k=0;k<A.length;k+=3)this.indexArray.emplaceBack(C+A[k],C+A[k+2],C+A[k+1]);x.primitiveLength+=A.length/3,x.vertexLength+=g;for(let k=0;k<f.vertexCount;k++){let z=Math.floor(f.x/f.vertexCount),O=Math.floor(f.y/f.vertexCount);this.centroidVertexArray.emplaceBack(z,O)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,s,u,l)}}function Vp(i,t){return i.x===t.x&&(i.x<0||i.x>Kt)||i.y===t.y&&(i.y<0||i.y>Kt)}function Up(i){return i.every((t=>t.x<0))||i.every((t=>t.x>Kt))||i.every((t=>t.y<0))||i.every((t=>t.y>Kt))}let gu;ke("FillExtrusionBucket",Yc,{omit:["layers","features"]});var jp={get paint(){return gu=gu||new h({"fill-extrusion-opacity":new De(oe["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new je(oe["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new De(oe["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new De(oe["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new _o(oe["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new je(oe["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new je(oe["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new De(oe["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class $p extends n{constructor(t){super(t,jp)}createBucket(t){return new Yc(t)}queryRadius(){return Bl(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(t,r,s,l,u,d,f,g){let x=Fl(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),d.angle,f),v=this.paint.get("fill-extrusion-height").evaluate(r,s),w=this.paint.get("fill-extrusion-base").evaluate(r,s),C=(function(k,z,O,j){let ie=[];for(let H of k){let ee=[H.x,H.y,0,1];Ol(ee,ee,z),ie.push(new pe(ee[0]/ee[3],ee[1]/ee[3]))}return ie})(x,g),A=(function(k,z,O,j){let ie=[],H=[],ee=j[8]*z,ae=j[9]*z,fe=j[10]*z,Me=j[11]*z,Ue=j[8]*O,Ie=j[9]*O,we=j[10]*O,Fe=j[11]*O;for(let Le of k){let Ee=[],he=[];for(let Oe of Le){let Be=Oe.x,Ge=Oe.y,Tt=j[0]*Be+j[4]*Ge+j[12],St=j[1]*Be+j[5]*Ge+j[13],ii=j[2]*Be+j[6]*Ge+j[14],Pr=j[3]*Be+j[7]*Ge+j[15],mi=ii+fe,ri=Pr+Me,Ei=Tt+Ue,ki=St+Ie,zi=ii+we,$t=Pr+Fe,ni=new pe((Tt+ee)/ri,(St+ae)/ri);ni.z=mi/ri,Ee.push(ni);let Si=new pe(Ei/$t,ki/$t);Si.z=zi/$t,he.push(Si)}ie.push(Ee),H.push(he)}return[ie,H]})(l,w,v,g);return(function(k,z,O){let j=1/0;Wh(O,z)&&(j=_u(O,z[0]));for(let ie=0;ie<z.length;ie++){let H=z[ie],ee=k[ie];for(let ae=0;ae<H.length-1;ae++){let fe=H[ae],Me=[fe,H[ae+1],ee[ae+1],ee[ae],fe];Hh(O,Me)&&(j=Math.min(j,_u(O,Me)))}}return j!==1/0&&j})(A[0],A[1],C)}}function Fa(i,t){return i.x*t.x+i.y*t.y}function _u(i,t){if(i.length===1){let r=0,s=t[r++],l;for(;!l||s.equals(l);)if(l=t[r++],!l)return 1/0;for(;r<t.length;r++){let u=t[r],d=i[0],f=l.sub(s),g=u.sub(s),x=d.sub(s),v=Fa(f,f),w=Fa(f,g),C=Fa(g,g),A=Fa(x,f),k=Fa(x,g),z=v*C-w*w,O=(C*A-w*k)/z,j=(v*k-w*A)/z,ie=s.z*(1-O-j)+l.z*O+u.z*j;if(isFinite(ie))return ie}return 1/0}{let r=1/0;for(let s of t)r=Math.min(r,s.z);return r}}let qp=m([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Zp}=qp,Gp=m([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Hp}=Gp,Wp=Jn.VectorTileFeature.types,Xp=Math.cos(Math.PI/180*37.5),yu=Math.pow(2,14)/.5;class Qc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((r=>r.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((r=>{this.gradients[r.id]={}})),this.layoutVertexArray=new xo,this.layoutVertexArray2=new Gn,this.indexArray=new hr,this.programConfigurations=new Ls(t.layers,t.zoom),this.segments=new ct,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((r=>r.isStateDependent())).map((r=>r.id))}populate(t,r,s){this.hasPattern=Wc("line",this.layers,r);let l=this.layers[0].layout.get("line-sort-key"),u=!l.isConstant(),d=[];for(let{feature:f,id:g,index:x,sourceLayerIndex:v}of t){let w=this.layers[0]._featureFilter.needGeometry,C=Rs(f,w);if(!this.layers[0]._featureFilter.filter(new At(this.zoom),C,s))continue;let A=u?l.evaluate(C,{},s):void 0,k={id:g,properties:f.properties,type:f.type,sourceLayerIndex:v,index:x,geometry:w?C.geometry:Ds(f),patterns:{},sortKey:A};d.push(k)}u&&d.sort(((f,g)=>f.sortKey-g.sortKey));for(let f of d){let{geometry:g,index:x,sourceLayerIndex:v}=f;if(this.hasPattern){let w=Xc("line",this.layers,f,this.zoom,r);this.patternFeatures.push(w)}else this.addFeature(f,g,x,s,{});r.featureIndex.insert(t[x].feature,g,x,v,this.index)}}update(t,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,s)}addFeatures(t,r,s){for(let 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(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Hp)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Zp),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,r,s,l,u){let d=this.layers[0].layout,f=d.get("line-join").evaluate(t,{}),g=d.get("line-cap"),x=d.get("line-miter-limit"),v=d.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(let w of r)this.addLine(w,t,f,g,x,v);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,s,u,l)}addLine(t,r,s,l,u,d){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let j=0;j<t.length-1;j++)this.totalDistance+=t[j].dist(t[j+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let f=Wp[r.type]==="Polygon",g=t.length;for(;g>=2&&t[g-1].equals(t[g-2]);)g--;let x=0;for(;x<g-1&&t[x].equals(t[x+1]);)x++;if(g<(f?3:2))return;s==="bevel"&&(u=1.05);let v=this.overscaling<=16?15*Kt/(512*this.overscaling):0,w=this.segments.prepareSegment(10*g,this.layoutVertexArray,this.indexArray),C,A,k,z,O;this.e1=this.e2=-1,f&&(C=t[g-2],O=t[x].sub(C)._unit()._perp());for(let j=x;j<g;j++){if(k=j===g-1?f?t[x+1]:void 0:t[j+1],k&&t[j].equals(k))continue;O&&(z=O),C&&(A=C),C=t[j],O=k?k.sub(C)._unit()._perp():z,z=z||O;let ie=z.add(O);ie.x===0&&ie.y===0||ie._unit();let H=z.x*O.x+z.y*O.y,ee=ie.x*O.x+ie.y*O.y,ae=ee!==0?1/ee:1/0,fe=2*Math.sqrt(2-2*ee),Me=ee<Xp&&A&&k,Ue=z.x*O.y-z.y*O.x>0;if(Me&&j>x){let Fe=C.dist(A);if(Fe>2*v){let Le=C.sub(C.sub(A)._mult(v/Fe)._round());this.updateDistance(A,Le),this.addCurrentVertex(Le,z,0,0,w),A=Le}}let Ie=A&&k,we=Ie?s:f?"butt":l;if(Ie&&we==="round"&&(ae<d?we="miter":ae<=2&&(we="fakeround")),we==="miter"&&ae>u&&(we="bevel"),we==="bevel"&&(ae>2&&(we="flipbevel"),ae<u&&(we="miter")),A&&this.updateDistance(A,C),we==="miter")ie._mult(ae),this.addCurrentVertex(C,ie,0,0,w);else if(we==="flipbevel"){if(ae>100)ie=O.mult(-1);else{let Fe=ae*z.add(O).mag()/z.sub(O).mag();ie._perp()._mult(Fe*(Ue?-1:1))}this.addCurrentVertex(C,ie,0,0,w),this.addCurrentVertex(C,ie.mult(-1),0,0,w)}else if(we==="bevel"||we==="fakeround"){let Fe=-Math.sqrt(ae*ae-1),Le=Ue?Fe:0,Ee=Ue?0:Fe;if(A&&this.addCurrentVertex(C,z,Le,Ee,w),we==="fakeround"){let he=Math.round(180*fe/Math.PI/20);for(let Oe=1;Oe<he;Oe++){let Be=Oe/he;if(Be!==.5){let Tt=Be-.5;Be+=Be*Tt*(Be-1)*((1.0904+H*(H*(3.55645-1.43519*H)-3.2452))*Tt*Tt+(.848013+H*(.215638*H-1.06021)))}let Ge=O.sub(z)._mult(Be)._add(z)._unit()._mult(Ue?-1:1);this.addHalfVertex(C,Ge.x,Ge.y,!1,Ue,0,w)}}k&&this.addCurrentVertex(C,O,-Le,-Ee,w)}else if(we==="butt")this.addCurrentVertex(C,ie,0,0,w);else if(we==="square"){let Fe=A?1:-1;this.addCurrentVertex(C,ie,Fe,Fe,w)}else we==="round"&&(A&&(this.addCurrentVertex(C,z,0,0,w),this.addCurrentVertex(C,z,1,1,w,!0)),k&&(this.addCurrentVertex(C,O,-1,-1,w,!0),this.addCurrentVertex(C,O,0,0,w)));if(Me&&j<g-1){let Fe=C.dist(k);if(Fe>2*v){let Le=C.add(k.sub(C)._mult(v/Fe)._round());this.updateDistance(C,Le),this.addCurrentVertex(Le,O,0,0,w),C=Le}}}}addCurrentVertex(t,r,s,l,u,d=!1){let f=r.y*l-r.x,g=-r.y-r.x*l;this.addHalfVertex(t,r.x+r.y*s,r.y-r.x*s,d,!1,s,u),this.addHalfVertex(t,f,g,d,!0,-l,u),this.distance>yu/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,r,s,l,u,d))}addHalfVertex({x:t,y:r},s,l,u,d,f,g){let x=.5*(this.lineClips?this.scaledDistance*(yu-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<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);let v=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,v),g.primitiveLength++),d?this.e2=v:this.e1=v}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,r){this.distance+=t.dist(r),this.updateScaledDistance()}}let xu,vu;ke("LineBucket",Qc,{omit:["layers","patternFeatures"]});var bu={get paint(){return vu=vu||new h({"line-opacity":new je(oe.paint_line["line-opacity"]),"line-color":new je(oe.paint_line["line-color"]),"line-translate":new De(oe.paint_line["line-translate"]),"line-translate-anchor":new De(oe.paint_line["line-translate-anchor"]),"line-width":new je(oe.paint_line["line-width"]),"line-gap-width":new je(oe.paint_line["line-gap-width"]),"line-offset":new je(oe.paint_line["line-offset"]),"line-blur":new je(oe.paint_line["line-blur"]),"line-dasharray":new yo(oe.paint_line["line-dasharray"]),"line-pattern":new _o(oe.paint_line["line-pattern"]),"line-gradient":new Pa(oe.paint_line["line-gradient"])})},get layout(){return xu=xu||new h({"line-cap":new De(oe.layout_line["line-cap"]),"line-join":new je(oe.layout_line["line-join"]),"line-miter-limit":new De(oe.layout_line["line-miter-limit"]),"line-round-limit":new De(oe.layout_line["line-round-limit"]),"line-sort-key":new je(oe.layout_line["line-sort-key"])})}};class Kp extends je{possiblyEvaluate(t,r){return r=new At(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(t,r)}evaluate(t,r,s,l){return r=Mt({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(t,r,s,l)}}let jl;class Jp extends n{constructor(t){super(t,bu),this.gradientVersion=0,jl||(jl=new Kp(bu.paint.properties["line-width"].specification),jl.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){let r=this.gradientExpression();this.stepInterpolant=!!(function(s){return s._styleExpression!==void 0})(r)&&r._styleExpression.expression instanceof Cn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,r){super.recalculate(t,r),this.paint._values["line-floorwidth"]=jl.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Qc(t)}queryRadius(t){let r=t,s=wu(Ea("line-width",this,r),Ea("line-gap-width",this,r)),l=Ea("line-offset",this,r);return s/2+Math.abs(l)+Bl(this.paint.get("line-translate"))}queryIntersectsFeature(t,r,s,l,u,d,f){let g=Fl(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),d.angle,f),x=f/2*wu(this.paint.get("line-width").evaluate(r,s),this.paint.get("line-gap-width").evaluate(r,s)),v=this.paint.get("line-offset").evaluate(r,s);return v&&(l=(function(w,C){let A=[];for(let k=0;k<w.length;k++){let z=w[k],O=[];for(let j=0;j<z.length;j++){let ie=z[j-1],H=z[j],ee=z[j+1],ae=j===0?new pe(0,0):H.sub(ie)._unit()._perp(),fe=j===z.length-1?new pe(0,0):ee.sub(H)._unit()._perp(),Me=ae._add(fe)._unit(),Ue=Me.x*fe.x+Me.y*fe.y;Ue!==0&&Me._mult(1/Ue),O.push(Me._mult(C)._add(H))}A.push(O)}return A})(l,v*f)),(function(w,C,A){for(let k=0;k<C.length;k++){let z=C[k];if(w.length>=3){for(let O=0;O<z.length;O++)if(Io(w,z[O]))return!0}if(op(w,z,A))return!0}return!1})(g,l,x)}isTileClipped(){return!0}}function wu(i,t){return t>0?t+2*i:i}let Yp=m([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Qp=m([{name:"a_projected_pos",components:3,type:"Float32"}],4);m([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let ef=m([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);m([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);let Su=m([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),tf=m([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function rf(i,t,r){return i.sections.forEach((s=>{s.text=(function(l,u,d){let f=u.layout.get("text-transform").evaluate(d,{});return f==="uppercase"?l=l.toLocaleUpperCase():f==="lowercase"&&(l=l.toLocaleLowerCase()),Ni.applyArabicShaping&&(l=Ni.applyArabicShaping(l)),l})(s.text,t,r)})),i}m([{name:"triangle",components:3,type:"Uint16"}]),m([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),m([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),m([{type:"Float32",name:"offsetX"}]),m([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),m([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);let Oa={"!":"\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 ei=24,Tu=wt,Iu=function(i,t,r,s,l){var u,d,f=8*l-s-1,g=(1<<f)-1,x=g>>1,v=-7,w=r?l-1:0,C=r?-1:1,A=i[t+w];for(w+=C,u=A&(1<<-v)-1,A>>=-v,v+=f;v>0;u=256*u+i[t+w],w+=C,v-=8);for(d=u&(1<<-v)-1,u>>=-v,v+=s;v>0;d=256*d+i[t+w],w+=C,v-=8);if(u===0)u=1-x;else{if(u===g)return d?NaN:1/0*(A?-1:1);d+=Math.pow(2,s),u-=x}return(A?-1:1)*d*Math.pow(2,u-s)},Cu=function(i,t,r,s,l,u){var d,f,g,x=8*u-l-1,v=(1<<x)-1,w=v>>1,C=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=s?0:u-1,k=s?1:-1,z=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(f=isNaN(t)?1:0,d=v):(d=Math.floor(Math.log(t)/Math.LN2),t*(g=Math.pow(2,-d))<1&&(d--,g*=2),(t+=d+w>=1?C/g:C*Math.pow(2,1-w))*g>=2&&(d++,g/=2),d+w>=v?(f=0,d=v):d+w>=1?(f=(t*g-1)*Math.pow(2,l),d+=w):(f=t*Math.pow(2,w-1)*Math.pow(2,l),d=0));l>=8;i[r+A]=255&f,A+=k,f/=256,l-=8);for(d=d<<l|f,x+=l;x>0;i[r+A]=255&d,A+=k,d/=256,x-=8);i[r+A-k]|=128*z};function wt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}wt.Varint=0,wt.Fixed64=1,wt.Bytes=2,wt.Fixed32=5;var eh=4294967296,Pu=1/eh,Mu=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function gn(i){return i.type===wt.Bytes?i.readVarint()+i.pos:i.pos+1}function Ao(i,t,r){return r?4294967296*t+(i>>>0):4294967296*(t>>>0)+(i>>>0)}function Au(i,t,r){var s=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));r.realloc(s);for(var l=r.pos-1;l>=i;l--)r.buf[l+s]=r.buf[l]}function nf(i,t){for(var r=0;r<i.length;r++)t.writeVarint(i[r])}function sf(i,t){for(var r=0;r<i.length;r++)t.writeSVarint(i[r])}function of(i,t){for(var r=0;r<i.length;r++)t.writeFloat(i[r])}function af(i,t){for(var r=0;r<i.length;r++)t.writeDouble(i[r])}function lf(i,t){for(var r=0;r<i.length;r++)t.writeBoolean(i[r])}function cf(i,t){for(var r=0;r<i.length;r++)t.writeFixed32(i[r])}function hf(i,t){for(var r=0;r<i.length;r++)t.writeSFixed32(i[r])}function uf(i,t){for(var r=0;r<i.length;r++)t.writeFixed64(i[r])}function df(i,t){for(var r=0;r<i.length;r++)t.writeSFixed64(i[r])}function $l(i,t){return(i[t]|i[t+1]<<8|i[t+2]<<16)+16777216*i[t+3]}function Eo(i,t,r){i[r]=t,i[r+1]=t>>>8,i[r+2]=t>>>16,i[r+3]=t>>>24}function Eu(i,t){return(i[t]|i[t+1]<<8|i[t+2]<<16)+(i[t+3]<<24)}wt.prototype={destroy:function(){this.buf=null},readFields:function(i,t,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,t,this),this.pos===u&&this.skip(s)}return t},readMessage:function(i,t){return this.readFields(i,t,this.readVarint()+this.pos)},readFixed32:function(){var i=$l(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=Eu(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=$l(this.buf,this.pos)+$l(this.buf,this.pos+4)*eh;return this.pos+=8,i},readSFixed64:function(){var i=$l(this.buf,this.pos)+Eu(this.buf,this.pos+4)*eh;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 t,r,s=this.buf;return t=127&(r=s[this.pos++]),r<128?t:(t|=(127&(r=s[this.pos++]))<<7,r<128?t:(t|=(127&(r=s[this.pos++]))<<14,r<128?t:(t|=(127&(r=s[this.pos++]))<<21,r<128?t:(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 Ao(l,f,u);throw new Error("Expected varint not more than 10 bytes")})(t|=(15&(r=s[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var i=this.readVarint()+this.pos,t=this.pos;return this.pos=i,i-t>=12&&Mu?(function(r,s,l){return Mu.decode(r.subarray(s,l))})(this.buf,t,i):(function(r,s,l){for(var u="",d=s;d<l;){var f,g,x,v=r[d],w=null,C=v>239?4:v>223?3:v>191?2:1;if(d+C>l)break;C===1?v<128&&(w=v):C===2?(192&(f=r[d+1]))==128&&(w=(31&v)<<6|63&f)<=127&&(w=null):C===3?(g=r[d+2],(192&(f=r[d+1]))==128&&(192&g)==128&&((w=(15&v)<<12|(63&f)<<6|63&g)<=2047||w>=55296&&w<=57343)&&(w=null)):C===4&&(g=r[d+2],x=r[d+3],(192&(f=r[d+1]))==128&&(192&g)==128&&(192&x)==128&&((w=(15&v)<<18|(63&f)<<12|(63&g)<<6|63&x)<=65535||w>=1114112)&&(w=null)),w===null?(w=65533,C=1):w>65535&&(w-=65536,u+=String.fromCharCode(w>>>10&1023|55296),w=56320|1023&w),u+=String.fromCharCode(w),d+=C}return u})(this.buf,t,i)},readBytes:function(){var i=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,i);return this.pos=i,t},readPackedVarint:function(i,t){if(this.type!==wt.Bytes)return i.push(this.readVarint(t));var r=gn(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(t));return i},readPackedSVarint:function(i){if(this.type!==wt.Bytes)return i.push(this.readSVarint());var t=gn(this);for(i=i||[];this.pos<t;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==wt.Bytes)return i.push(this.readBoolean());var t=gn(this);for(i=i||[];this.pos<t;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==wt.Bytes)return i.push(this.readFloat());var t=gn(this);for(i=i||[];this.pos<t;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==wt.Bytes)return i.push(this.readDouble());var t=gn(this);for(i=i||[];this.pos<t;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==wt.Bytes)return i.push(this.readFixed32());var t=gn(this);for(i=i||[];this.pos<t;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==wt.Bytes)return i.push(this.readSFixed32());var t=gn(this);for(i=i||[];this.pos<t;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==wt.Bytes)return i.push(this.readFixed64());var t=gn(this);for(i=i||[];this.pos<t;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==wt.Bytes)return i.push(this.readSFixed64());var t=gn(this);for(i=i||[];this.pos<t;)i.push(this.readSFixed64());return i},skip:function(i){var t=7&i;if(t===wt.Varint)for(;this.buf[this.pos++]>127;);else if(t===wt.Bytes)this.pos=this.readVarint()+this.pos;else if(t===wt.Fixed32)this.pos+=4;else{if(t!==wt.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(i,t){this.writeVarint(i<<3|t)},realloc:function(i){for(var t=this.length||16;t<this.pos+i;)t*=2;if(t!==this.length){var r=new Uint8Array(t);r.set(this.buf),this.buf=r,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(i){this.realloc(4),Eo(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),Eo(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),Eo(this.buf,-1&i,this.pos),Eo(this.buf,Math.floor(i*Pu),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),Eo(this.buf,-1&i,this.pos),Eo(this.buf,Math.floor(i*Pu),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?(function(t,r){var s,l;if(t>=0?(s=t%4294967296|0,l=t/4294967296|0):(l=~(-t/4294967296),4294967295^(s=~(-t%4294967296))?s=s+1|0:(s=0,l=l+1|0)),t>=18446744073709552e3||t<-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(!!i)},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var t=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-t;r>=128&&Au(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Cu(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Cu(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var t=i.length;this.writeVarint(t),this.realloc(t);for(var r=0;r<t;r++)this.buf[this.pos++]=i[r]},writeRawMessage:function(i,t){this.pos++;var r=this.pos;i(t,this);var s=this.pos-r;s>=128&&Au(r,s,this),this.pos=r-1,this.writeVarint(s),this.pos+=s},writeMessage:function(i,t,r){this.writeTag(i,wt.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(i,t){t.length&&this.writeMessage(i,nf,t)},writePackedSVarint:function(i,t){t.length&&this.writeMessage(i,sf,t)},writePackedBoolean:function(i,t){t.length&&this.writeMessage(i,lf,t)},writePackedFloat:function(i,t){t.length&&this.writeMessage(i,of,t)},writePackedDouble:function(i,t){t.length&&this.writeMessage(i,af,t)},writePackedFixed32:function(i,t){t.length&&this.writeMessage(i,cf,t)},writePackedSFixed32:function(i,t){t.length&&this.writeMessage(i,hf,t)},writePackedFixed64:function(i,t){t.length&&this.writeMessage(i,uf,t)},writePackedSFixed64:function(i,t){t.length&&this.writeMessage(i,df,t)},writeBytesField:function(i,t){this.writeTag(i,wt.Bytes),this.writeBytes(t)},writeFixed32Field:function(i,t){this.writeTag(i,wt.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(i,t){this.writeTag(i,wt.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(i,t){this.writeTag(i,wt.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(i,t){this.writeTag(i,wt.Fixed64),this.writeSFixed64(t)},writeVarintField:function(i,t){this.writeTag(i,wt.Varint),this.writeVarint(t)},writeSVarintField:function(i,t){this.writeTag(i,wt.Varint),this.writeSVarint(t)},writeStringField:function(i,t){this.writeTag(i,wt.Bytes),this.writeString(t)},writeFloatField:function(i,t){this.writeTag(i,wt.Fixed32),this.writeFloat(t)},writeDoubleField:function(i,t){this.writeTag(i,wt.Fixed64),this.writeDouble(t)},writeBooleanField:function(i,t){this.writeVarintField(i,!!t)}};var th=Se(Tu);let ih=3;function pf(i,t,r){i===1&&r.readMessage(ff,t)}function ff(i,t,r){if(i===3){let{id:s,bitmap:l,width:u,height:d,left:f,top:g,advance:x}=r.readMessage(mf,{});t.push({id:s,bitmap:new za({width:u+2*ih,height:d+2*ih},l),metrics:{width:u,height:d,left:f,top:g,advance:x}})}}function mf(i,t,r){i===1?t.id=r.readVarint():i===2?t.bitmap=r.readBytes():i===3?t.width=r.readVarint():i===4?t.height=r.readVarint():i===5?t.left=r.readSVarint():i===6?t.top=r.readSVarint():i===7&&(t.advance=r.readVarint())}let ku=ih;function zu(i){let t=0,r=0;for(let d of i)t+=d.w*d.h,r=Math.max(r,d.w);i.sort(((d,f)=>f.h-d.h));let s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}],l=0,u=0;for(let d of i)for(let f=s.length-1;f>=0;f--){let 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){let 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:t/(l*u)||0}}let Ui=1;class rh{constructor(t,{pixelRatio:r,version:s,stretchX:l,stretchY:u,content:d,textFitWidth:f,textFitHeight:g}){this.paddedRect=t,this.pixelRatio=r,this.stretchX=l,this.stretchY=u,this.content=d,this.version=s,this.textFitWidth=f,this.textFitHeight=g}get tl(){return[this.paddedRect.x+Ui,this.paddedRect.y+Ui]}get br(){return[this.paddedRect.x+this.paddedRect.w-Ui,this.paddedRect.y+this.paddedRect.h-Ui]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*Ui)/this.pixelRatio,(this.paddedRect.h-2*Ui)/this.pixelRatio]}}class Lu{constructor(t,r){let s={},l={};this.haveRenderCallbacks=[];let u=[];this.addImages(t,s,u),this.addImages(r,l,u);let{w:d,h:f}=zu(u),g=new ur({width:d||1,height:f||1});for(let x in t){let v=t[x],w=s[x].paddedRect;ur.copy(v.data,g,{x:0,y:0},{x:w.x+Ui,y:w.y+Ui},v.data)}for(let x in r){let v=r[x],w=l[x].paddedRect,C=w.x+Ui,A=w.y+Ui,k=v.data.width,z=v.data.height;ur.copy(v.data,g,{x:0,y:0},{x:C,y:A},v.data),ur.copy(v.data,g,{x:0,y:z-1},{x:C,y:A-1},{width:k,height:1}),ur.copy(v.data,g,{x:0,y:0},{x:C,y:A+z},{width:k,height:1}),ur.copy(v.data,g,{x:k-1,y:0},{x:C-1,y:A},{width:1,height:z}),ur.copy(v.data,g,{x:0,y:0},{x:C+k,y:A},{width:1,height:z})}this.image=g,this.iconPositions=s,this.patternPositions=l}addImages(t,r,s){for(let l in t){let u=t[l],d={x:0,y:0,w:u.data.width+2*Ui,h:u.data.height+2*Ui};s.push(d),r[l]=new rh(d,u),u.hasRenderCallback&&this.haveRenderCallbacks.push(l)}}patchUpdatedImages(t,r){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let s in t.updatedImages)this.patchUpdatedImage(this.iconPositions[s],t.getImage(s),r),this.patchUpdatedImage(this.patternPositions[s],t.getImage(s),r)}patchUpdatedImage(t,r,s){if(!t||!r||t.version===r.version)return;t.version=r.version;let[l,u]=t.tl;s.update(r.data,void 0,{x:l,y:u})}}var Yn;ke("ImagePosition",rh),ke("ImageAtlas",Lu),I.ah=void 0,(Yn=I.ah||(I.ah={}))[Yn.none=0]="none",Yn[Yn.horizontal=1]="horizontal",Yn[Yn.vertical=2]="vertical",Yn[Yn.horizontalOnly=3]="horizontalOnly";let Na=-17;class Va{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,r){let s=new Va;return s.scale=t||1,s.fontStack=r,s}static forImage(t){let r=new Va;return r.imageName=t,r}}class ko{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,r){let s=new ko;for(let l=0;l<t.sections.length;l++){let u=t.sections[l];u.image?s.addImageSection(u):s.addTextSection(u,r)}return s}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=(function(t){let r="";for(let s=0;s<t.length;s++){let l=t.charCodeAt(s+1)||null,u=t.charCodeAt(s-1)||null;r+=l&&Al(l)&&!Oa[t[s+1]]||u&&Al(u)&&!Oa[t[s-1]]||!Oa[t[s]]?t[s]:Oa[t[s]]}return r})(this.text)}trim(){let t=0;for(let s=0;s<this.text.length&&Zl[this.text.charCodeAt(s)];s++)t++;let r=this.text.length;for(let s=this.text.length-1;s>=0&&s>=t&&Zl[this.text.charCodeAt(s)];s--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)}substring(t,r){let s=new ko;return s.text=this.text.substring(t,r),s.sectionIndex=this.sectionIndex.slice(t,r),s.sections=this.sections,s}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,r)=>Math.max(t,this.sections[r].scale)),0)}addTextSection(t,r){this.text+=t.text,this.sections.push(Va.forText(t.scale,t.fontStack||r));let s=this.sections.length-1;for(let l=0;l<t.text.length;++l)this.sectionIndex.push(s)}addImageSection(t){let r=t.image?t.image.name:"";if(r.length===0)return void ze("Can't add FormattedSection with an empty image.");let s=this.getNextImageSectionCharCode();s?(this.text+=String.fromCharCode(s),this.sections.push(Va.forImage(r)),this.sectionIndex.push(this.sections.length-1)):ze("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function ql(i,t,r,s,l,u,d,f,g,x,v,w,C,A,k){let z=ko.fromFeature(i,l),O;w===I.ah.vertical&&z.verticalizePunctuation();let{processBidirectionalText:j,processStyledBidirectionalText:ie}=Ni;if(j&&z.sections.length===1){O=[];let ae=j(z.toString(),nh(z,x,u,t,s,A));for(let fe of ae){let Me=new ko;Me.text=fe,Me.sections=z.sections;for(let Ue=0;Ue<fe.length;Ue++)Me.sectionIndex.push(0);O.push(Me)}}else if(ie){O=[];let ae=ie(z.text,z.sectionIndex,nh(z,x,u,t,s,A));for(let fe of ae){let Me=new ko;Me.text=fe[0],Me.sectionIndex=fe[1],Me.sections=z.sections,O.push(Me)}}else O=(function(ae,fe){let Me=[],Ue=ae.text,Ie=0;for(let we of fe)Me.push(ae.substring(Ie,we)),Ie=we;return Ie<Ue.length&&Me.push(ae.substring(Ie,Ue.length)),Me})(z,nh(z,x,u,t,s,A));let H=[],ee={positionedLines:H,text:z.toString(),top:v[1],bottom:v[1],left:v[0],right:v[0],writingMode:w,iconsInText:!1,verticalizable:!1};return(function(ae,fe,Me,Ue,Ie,we,Fe,Le,Ee,he,Oe,Be){let Ge=0,Tt=Na,St=0,ii=0,Pr=Le==="right"?1:Le==="left"?0:.5,mi=0;for(let $t of Ie){$t.trim();let ni=$t.getMaxScale(),Si=(ni-1)*ei,gi={positionedGlyphs:[],lineOffset:0};ae.positionedLines[mi]=gi;let Li=gi.positionedGlyphs,_i=0;if(!$t.length()){Tt+=we,++mi;continue}for(let ji=0;ji<$t.length();ji++){let ft=$t.getSection(ji),Ct=$t.getSectionIndex(ji),Lt=$t.getCharCode(ji),Yi=0,Ot=null,Ro=null,Xr=null,Kr=ei,Mr=!(Ee===I.ah.horizontal||!Oe&&!Ia(Lt)||Oe&&(Zl[Lt]||(ri=Lt,/\p{sc=Arab}/u.test(String.fromCodePoint(ri)))));if(ft.imageName){let fr=Ue[ft.imageName];if(!fr)continue;Xr=ft.imageName,ae.iconsInText=ae.iconsInText||!0,Ro=fr.paddedRect;let ai=fr.displaySize;ft.scale=ft.scale*ei/Be,Ot={width:ai[0],height:ai[1],left:Ui,top:-ku,advance:Mr?ai[1]:ai[0]},Yi=Si+(ei-ai[1]*ft.scale),Kr=Ot.advance;let _n=Mr?ai[0]*ft.scale-ei*ni:ai[1]*ft.scale-ei*ni;_n>0&&_n>_i&&(_i=_n)}else{let fr=Me[ft.fontStack],ai=fr&&fr[Lt];if(ai&&ai.rect)Ro=ai.rect,Ot=ai.metrics;else{let _n=fe[ft.fontStack],Ga=_n&&_n[Lt];if(!Ga)continue;Ot=Ga.metrics}Yi=(ni-ft.scale)*ei}Mr?(ae.verticalizable=!0,Li.push({glyph:Lt,imageName:Xr,x:Ge,y:Tt+Yi,vertical:Mr,scale:ft.scale,fontStack:ft.fontStack,sectionIndex:Ct,metrics:Ot,rect:Ro}),Ge+=Kr*ft.scale+he):(Li.push({glyph:Lt,imageName:Xr,x:Ge,y:Tt+Yi,vertical:Mr,scale:ft.scale,fontStack:ft.fontStack,sectionIndex:Ct,metrics:Ot,rect:Ro}),Ge+=Ot.advance*ft.scale+he)}Li.length!==0&&(St=Math.max(Ge-he,St),xf(Li,0,Li.length-1,Pr,_i)),Ge=0;let pr=we*ni+_i;gi.lineOffset=Math.max(_i,Si),Tt+=pr,ii=Math.max(pr,ii),++mi}var ri;let Ei=Tt-Na,{horizontalAlign:ki,verticalAlign:zi}=sh(Fe);(function($t,ni,Si,gi,Li,_i,pr,ji,ft){let Ct=(ni-Si)*Li,Lt=0;Lt=_i!==pr?-ji*gi-Na:(-gi*ft+.5)*pr;for(let Yi of $t)for(let Ot of Yi.positionedGlyphs)Ot.x+=Ct,Ot.y+=Lt})(ae.positionedLines,Pr,ki,zi,St,ii,we,Ei,Ie.length),ae.top+=-zi*Ei,ae.bottom=ae.top+Ei,ae.left+=-ki*St,ae.right=ae.left+St})(ee,t,r,s,O,d,f,g,w,x,C,k),!(function(ae){for(let fe of ae)if(fe.positionedGlyphs.length!==0)return!1;return!0})(H)&&ee}let Zl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},gf={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},_f={40:!0};function Du(i,t,r,s,l,u){if(t.imageName){let d=s[t.imageName];return d?d.displaySize[0]*t.scale*ei/u+l:0}{let d=r[t.fontStack],f=d&&d[i];return f?f.metrics.advance*t.scale+l:0}}function Ru(i,t,r,s){let l=Math.pow(i-t,2);return s?i<t?l/2:2*l:l+Math.abs(r)*r}function yf(i,t,r){let s=0;return i===10&&(s-=1e4),r&&(s+=150),i!==40&&i!==65288||(s+=50),t!==41&&t!==65289||(s+=50),s}function Bu(i,t,r,s,l,u){let d=null,f=Ru(t,r,l,u);for(let g of s){let x=Ru(t-g.x,r,l,u)+g.badness;x<=f&&(d=g,f=x)}return{index:i,x:t,priorBreak:d,badness:f}}function Fu(i){return i?Fu(i.priorBreak).concat(i.index):[]}function nh(i,t,r,s,l,u){if(!i)return[];let d=[],f=(function(w,C,A,k,z,O){let j=0;for(let ie=0;ie<w.length();ie++){let H=w.getSection(ie);j+=Du(w.getCharCode(ie),H,k,z,C,O)}return j/Math.max(1,Math.ceil(j/A))})(i,t,r,s,l,u),g=i.text.indexOf("\u200B")>=0,x=0;for(let w=0;w<i.length();w++){let C=i.getSection(w),A=i.getCharCode(w);if(Zl[A]||(x+=Du(A,C,s,l,t,u)),w<i.length()-1){let k=!((v=A)<11904)&&(!!lt["CJK Compatibility Forms"](v)||!!lt["CJK Compatibility"](v)||!!lt["CJK Strokes"](v)||!!lt["CJK Symbols and Punctuation"](v)||!!lt["Enclosed CJK Letters and Months"](v)||!!lt["Halfwidth and Fullwidth Forms"](v)||!!lt["Ideographic Description Characters"](v)||!!lt["Vertical Forms"](v)||Ml.test(String.fromCodePoint(v)));(gf[A]||k||C.imageName||w!==i.length()-2&&_f[i.getCharCode(w+1)])&&d.push(Bu(w+1,x,f,d,yf(A,i.getCharCode(w+1),k&&g),!1))}}var v;return Fu(Bu(i.length(),x,f,d,0,!0))}function sh(i){let t=.5,r=.5;switch(i){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(i){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:t,verticalAlign:r}}function xf(i,t,r,s,l){if(!s&&!l)return;let u=i[r],d=(i[r].x+u.metrics.advance*u.scale)*s;for(let f=t;f<=r;f++)i[f].x-=d,i[f].y+=l}function vf(i,t,r){let{horizontalAlign:s,verticalAlign:l}=sh(r),u=t[0]-i.displaySize[0]*s,d=t[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){var t,r;let s=i.left,l=i.top,u=i.right-s,d=i.bottom-l,f=(t=i.image.textFitWidth)!==null&&t!==void 0?t:"stretchOrShrink",g=(r=i.image.textFitHeight)!==null&&r!==void 0?r:"stretchOrShrink",x=(i.image.content[2]-i.image.content[0])/(i.image.content[3]-i.image.content[1]);if(g==="proportional"){if(f==="stretchOnly"&&u/d<x||f==="proportional"){let v=Math.ceil(d*x);s*=v/u,u=v}}else if(f==="proportional"&&g==="stretchOnly"&&x!==0&&u/d>x){let v=Math.ceil(u/x);l*=v/d,d=v}return{x1:s,y1:l,x2:s+u,y2:l+d}}function Nu(i,t,r,s,l,u){let d=i.image,f;if(d.content){let O=d.content,j=d.pixelRatio||1;f=[O[0]/j,O[1]/j,d.displaySize[0]-O[2]/j,d.displaySize[1]-O[3]/j]}let g=t.left*u,x=t.right*u,v,w,C,A;r==="width"||r==="both"?(A=l[0]+g-s[3],w=l[0]+x+s[1]):(A=l[0]+(g+x-d.displaySize[0])/2,w=A+d.displaySize[0]);let k=t.top*u,z=t.bottom*u;return r==="height"||r==="both"?(v=l[1]+k-s[0],C=l[1]+z+s[2]):(v=l[1]+(k+z-d.displaySize[1])/2,C=v+d.displaySize[1]),{image:d,top:v,right:w,bottom:C,left:A,collisionPadding:f}}let Ua=255,Wr=128,Qn=Ua*Wr;function Vu(i,t){let{expression:r}=t;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new At(i+1))};if(r.kind==="source")return{kind:"source"};{let{zoomStops:s,interpolationType:l}=r,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);let 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 At(f)),maxSize:r.evaluate(new At(g)),interpolationType:l}}}function oh(i,t,r){let s="never",l=i.get(t);return l?s=l:i.get(r)&&(s="always"),s}let bf=Jn.VectorTileFeature.types,wf=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Gl(i,t,r,s,l,u,d,f,g,x,v,w,C){let A=f?Math.min(Qn,Math.round(f[0])):0,k=f?Math.min(Qn,Math.round(f[1])):0;i.emplaceBack(t,r,Math.round(32*s),Math.round(32*l),u,d,(A<<1)+(g?1:0),k,16*x,16*v,256*w,256*C)}function ah(i,t,r){i.emplaceBack(t.x,t.y,r),i.emplaceBack(t.x,t.y,r),i.emplaceBack(t.x,t.y,r),i.emplaceBack(t.x,t.y,r)}function Sf(i){for(let t of i.sections)if(Rc(t.text))return!0;return!1}class lh{constructor(t){this.layoutVertexArray=new vo,this.indexArray=new hr,this.programConfigurations=t,this.segments=new ct,this.dynamicLayoutVertexArray=new Ma,this.opacityVertexArray=new Ki,this.hasVisibleVertices=!1,this.placedSymbolArray=new Et}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,r,s,l){this.isEmpty()||(s&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Yp.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Qp.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,wf,!0),this.opacityVertexBuffer.itemSize=1),(s||l)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}ke("SymbolBuffers",lh);class ch{constructor(t,r,s){this.layoutVertexArray=new t,this.layoutAttributes=r,this.indexArray=new s,this.segments=new ct,this.collisionVertexArray=new Gr}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,ef.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}ke("CollisionBuffers",ch);class zo{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((d=>d.id)),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=jc([]),this.placementViewportMatrix=jc([]);let r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Vu(this.zoom,r["text-size"]),this.iconSizeData=Vu(this.zoom,r["icon-size"]);let s=this.layers[0].layout,l=s.get("symbol-sort-key"),u=s.get("symbol-z-order");this.canOverlap=oh(s,"text-overlap","text-allow-overlap")!=="never"||oh(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=>I.ah[d]))),this.stateDependentLayerIds=this.layers.filter((d=>d.isStateDependent())).map((d=>d.id)),this.sourceID=t.sourceID}createArrays(){this.text=new lh(new Ls(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new lh(new Ls(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new kt,this.lineVertexArray=new ui,this.symbolInstances=new at,this.textAnchorOffsets=new zt}calculateGlyphDependencies(t,r,s,l,u){for(let d=0;d<t.length;d++)if(r[t.charCodeAt(d)]=!0,(s||l)&&u){let f=Oa[t.charAt(d)];f&&(r[f.charCodeAt(0)]=!0)}}populate(t,r,s){let 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 Ri&&!f.value.value.isEmpty()||f.value.value.toString().length>0)&&(d.value.kind!=="constant"||d.value.value.length>0),v=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,w=u.get("symbol-sort-key");if(this.features=[],!x&&!v)return;let C=r.iconDependencies,A=r.glyphDependencies,k=r.availableImages,z=new At(this.zoom);for(let{feature:O,id:j,index:ie,sourceLayerIndex:H}of t){let ee=l._featureFilter.needGeometry,ae=Rs(O,ee);if(!l._featureFilter.filter(z,ae,s))continue;let fe,Me;if(ee||(ae.geometry=Ds(O)),x){let Ie=l.getValueAndResolveTokens("text-field",ae,s,k),we=Ri.factory(Ie),Fe=this.hasRTLText=this.hasRTLText||Sf(we);(!Fe||Ni.getRTLTextPluginStatus()==="unavailable"||Fe&&Ni.isParsed())&&(fe=rf(we,l,ae))}if(v){let Ie=l.getValueAndResolveTokens("icon-image",ae,s,k);Me=Ie instanceof Fi?Ie:Fi.fromString(Ie)}if(!fe&&!Me)continue;let Ue=this.sortFeaturesByKey?w.evaluate(ae,{},s):void 0;if(this.features.push({id:j,text:fe,icon:Me,index:ie,sourceLayerIndex:H,geometry:ae.geometry,properties:O.properties,type:bf[O.type],sortKey:Ue}),Me&&(C[Me.name]=!0),fe){let Ie=d.evaluate(ae,{},s).join(","),we=u.get("text-rotation-alignment")!=="viewport"&&u.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(I.ah.vertical)>=0;for(let Fe of fe.sections)if(Fe.image)C[Fe.image.name]=!0;else{let Le=Sa(fe.toString()),Ee=Fe.fontStack||Ie,he=A[Ee]=A[Ee]||{};this.calculateGlyphDependencies(Fe.text,he,we,this.allowVerticalPlacement,Le)}}}u.get("symbol-placement")==="line"&&(this.features=(function(O){let j={},ie={},H=[],ee=0;function ae(Ie){H.push(O[Ie]),ee++}function fe(Ie,we,Fe){let Le=ie[Ie];return delete ie[Ie],ie[we]=Le,H[Le].geometry[0].pop(),H[Le].geometry[0]=H[Le].geometry[0].concat(Fe[0]),Le}function Me(Ie,we,Fe){let Le=j[we];return delete j[we],j[Ie]=Le,H[Le].geometry[0].shift(),H[Le].geometry[0]=Fe[0].concat(H[Le].geometry[0]),Le}function Ue(Ie,we,Fe){let Le=Fe?we[0][we[0].length-1]:we[0][0];return`${Ie}:${Le.x}:${Le.y}`}for(let Ie=0;Ie<O.length;Ie++){let we=O[Ie],Fe=we.geometry,Le=we.text?we.text.toString():null;if(!Le){ae(Ie);continue}let Ee=Ue(Le,Fe),he=Ue(Le,Fe,!0);if(Ee in ie&&he in j&&ie[Ee]!==j[he]){let Oe=Me(Ee,he,Fe),Be=fe(Ee,he,H[Oe].geometry);delete j[Ee],delete ie[he],ie[Ue(Le,H[Be].geometry,!0)]=Be,H[Oe].geometry=null}else Ee in ie?fe(Ee,he,Fe):he in j?Me(Ee,he,Fe):(ae(Ie),j[Ee]=ee-1,ie[he]=ee-1)}return H.filter((Ie=>Ie.geometry))})(this.features)),this.sortFeaturesByKey&&this.features.sort(((O,j)=>O.sortKey-j.sortKey))}update(t,r,s){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,r,this.layers,s),this.icon.programConfigurations.updatePaintArrays(t,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(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,r){let s=this.lineVertexArray.length;if(t.segment!==void 0){let l=t.dist(r[t.segment+1]),u=t.dist(r[t.segment]),d={};for(let f=t.segment+1;f<r.length;f++)d[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:l},f<r.length-1&&(l+=r[f+1].dist(r[f]));for(let f=t.segment||0;f>=0;f--)d[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:u},f>0&&(u+=r[f-1].dist(r[f]));for(let f=0;f<r.length;f++){let g=d[f];this.lineVertexArray.emplaceBack(g.x,g.y,g.tileUnitDistanceFromAnchor)}}return{lineStartIndex:s,lineLength:this.lineVertexArray.length-s}}addSymbols(t,r,s,l,u,d,f,g,x,v,w,C){let A=t.indexArray,k=t.layoutVertexArray,z=t.segments.prepareSegment(4*r.length,k,A,this.canOverlap?d.sortKey:void 0),O=this.glyphOffsetArray.length,j=z.vertexLength,ie=this.allowVerticalPlacement&&f===I.ah.vertical?Math.PI/2:0,H=d.text&&d.text.sections;for(let ee=0;ee<r.length;ee++){let{tl:ae,tr:fe,bl:Me,br:Ue,tex:Ie,pixelOffsetTL:we,pixelOffsetBR:Fe,minFontScaleX:Le,minFontScaleY:Ee,glyphOffset:he,isSDF:Oe,sectionIndex:Be}=r[ee],Ge=z.vertexLength,Tt=he[1];Gl(k,g.x,g.y,ae.x,Tt+ae.y,Ie.x,Ie.y,s,Oe,we.x,we.y,Le,Ee),Gl(k,g.x,g.y,fe.x,Tt+fe.y,Ie.x+Ie.w,Ie.y,s,Oe,Fe.x,we.y,Le,Ee),Gl(k,g.x,g.y,Me.x,Tt+Me.y,Ie.x,Ie.y+Ie.h,s,Oe,we.x,Fe.y,Le,Ee),Gl(k,g.x,g.y,Ue.x,Tt+Ue.y,Ie.x+Ie.w,Ie.y+Ie.h,s,Oe,Fe.x,Fe.y,Le,Ee),ah(t.dynamicLayoutVertexArray,g,ie),A.emplaceBack(Ge,Ge+1,Ge+2),A.emplaceBack(Ge+1,Ge+2,Ge+3),z.vertexLength+=4,z.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(he[0]),ee!==r.length-1&&Be===r[ee+1].sectionIndex||t.programConfigurations.populatePaintArrays(k.length,d,d.index,{},C,H&&H[Be])}t.placedSymbolArray.emplaceBack(g.x,g.y,O,this.glyphOffsetArray.length-O,j,x,v,g.segment,s?s[0]:0,s?s[1]:0,l[0],l[1],f,0,!1,0,w)}_addCollisionDebugVertex(t,r,s,l,u,d){return r.emplaceBack(0,0),t.emplaceBack(s.x,s.y,l,u,Math.round(d.x),Math.round(d.y))}addCollisionDebugVertices(t,r,s,l,u,d,f){let g=u.segments.prepareSegment(4,u.layoutVertexArray,u.indexArray),x=g.vertexLength,v=u.layoutVertexArray,w=u.collisionVertexArray,C=f.anchorX,A=f.anchorY;this._addCollisionDebugVertex(v,w,d,C,A,new pe(t,r)),this._addCollisionDebugVertex(v,w,d,C,A,new pe(s,r)),this._addCollisionDebugVertex(v,w,d,C,A,new pe(s,l)),this._addCollisionDebugVertex(v,w,d,C,A,new pe(t,l)),g.vertexLength+=4;let k=u.indexArray;k.emplaceBack(x,x+1),k.emplaceBack(x+1,x+2),k.emplaceBack(x+2,x+3),k.emplaceBack(x+3,x),g.primitiveLength+=4}addDebugCollisionBoxes(t,r,s,l){for(let u=t;u<r;u++){let 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 ch(Ji,Su.members,oi),this.iconCollisionBox=new ch(Ji,Su.members,oi);for(let t=0;t<this.symbolInstances.length;t++){let r=this.symbolInstances.get(t);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(t,r,s,l,u,d,f,g,x){let v={};for(let w=r;w<s;w++){let C=t.get(w);v.textBox={x1:C.x1,y1:C.y1,x2:C.x2,y2:C.y2,anchorPointX:C.anchorPointX,anchorPointY:C.anchorPointY},v.textFeatureIndex=C.featureIndex;break}for(let w=l;w<u;w++){let C=t.get(w);v.verticalTextBox={x1:C.x1,y1:C.y1,x2:C.x2,y2:C.y2,anchorPointX:C.anchorPointX,anchorPointY:C.anchorPointY},v.verticalTextFeatureIndex=C.featureIndex;break}for(let w=d;w<f;w++){let C=t.get(w);v.iconBox={x1:C.x1,y1:C.y1,x2:C.x2,y2:C.y2,anchorPointX:C.anchorPointX,anchorPointY:C.anchorPointY},v.iconFeatureIndex=C.featureIndex;break}for(let w=g;w<x;w++){let C=t.get(w);v.verticalIconBox={x1:C.x1,y1:C.y1,x2:C.x2,y2:C.y2,anchorPointX:C.anchorPointX,anchorPointY:C.anchorPointY},v.verticalIconFeatureIndex=C.featureIndex;break}return v}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){let s=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,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(t,r){let s=t.placedSymbolArray.get(r),l=s.vertexStartIndex+4*s.numGlyphs;for(let u=s.vertexStartIndex;u<l;u+=4)t.indexArray.emplaceBack(u,u+1,u+2),t.indexArray.emplaceBack(u+1,u+2,u+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let r=Math.sin(t),s=Math.cos(t),l=[],u=[],d=[];for(let f=0;f<this.symbolInstances.length;++f){d.push(f);let 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(t,r){let s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===r?s.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let r of this.symbolInstanceIndexes){let 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)}}}let Uu,ju;ke("SymbolBucket",zo,{omit:["layers","collisionBoxArray","features","compareText"]}),zo.MAX_GLYPHS=65535,zo.addDynamicAttributes=ah;var hh={get paint(){return ju=ju||new h({"icon-opacity":new je(oe.paint_symbol["icon-opacity"]),"icon-color":new je(oe.paint_symbol["icon-color"]),"icon-halo-color":new je(oe.paint_symbol["icon-halo-color"]),"icon-halo-width":new je(oe.paint_symbol["icon-halo-width"]),"icon-halo-blur":new je(oe.paint_symbol["icon-halo-blur"]),"icon-translate":new De(oe.paint_symbol["icon-translate"]),"icon-translate-anchor":new De(oe.paint_symbol["icon-translate-anchor"]),"text-opacity":new je(oe.paint_symbol["text-opacity"]),"text-color":new je(oe.paint_symbol["text-color"],{runtimeType:Ii,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new je(oe.paint_symbol["text-halo-color"]),"text-halo-width":new je(oe.paint_symbol["text-halo-width"]),"text-halo-blur":new je(oe.paint_symbol["text-halo-blur"]),"text-translate":new De(oe.paint_symbol["text-translate"]),"text-translate-anchor":new De(oe.paint_symbol["text-translate-anchor"])})},get layout(){return Uu=Uu||new h({"symbol-placement":new De(oe.layout_symbol["symbol-placement"]),"symbol-spacing":new De(oe.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new De(oe.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new je(oe.layout_symbol["symbol-sort-key"]),"symbol-z-order":new De(oe.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new De(oe.layout_symbol["icon-allow-overlap"]),"icon-overlap":new De(oe.layout_symbol["icon-overlap"]),"icon-ignore-placement":new De(oe.layout_symbol["icon-ignore-placement"]),"icon-optional":new De(oe.layout_symbol["icon-optional"]),"icon-rotation-alignment":new De(oe.layout_symbol["icon-rotation-alignment"]),"icon-size":new je(oe.layout_symbol["icon-size"]),"icon-text-fit":new De(oe.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new De(oe.layout_symbol["icon-text-fit-padding"]),"icon-image":new je(oe.layout_symbol["icon-image"]),"icon-rotate":new je(oe.layout_symbol["icon-rotate"]),"icon-padding":new je(oe.layout_symbol["icon-padding"]),"icon-keep-upright":new De(oe.layout_symbol["icon-keep-upright"]),"icon-offset":new je(oe.layout_symbol["icon-offset"]),"icon-anchor":new je(oe.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new De(oe.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new De(oe.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new De(oe.layout_symbol["text-rotation-alignment"]),"text-field":new je(oe.layout_symbol["text-field"]),"text-font":new je(oe.layout_symbol["text-font"]),"text-size":new je(oe.layout_symbol["text-size"]),"text-max-width":new je(oe.layout_symbol["text-max-width"]),"text-line-height":new De(oe.layout_symbol["text-line-height"]),"text-letter-spacing":new je(oe.layout_symbol["text-letter-spacing"]),"text-justify":new je(oe.layout_symbol["text-justify"]),"text-radial-offset":new je(oe.layout_symbol["text-radial-offset"]),"text-variable-anchor":new De(oe.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new je(oe.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new je(oe.layout_symbol["text-anchor"]),"text-max-angle":new De(oe.layout_symbol["text-max-angle"]),"text-writing-mode":new De(oe.layout_symbol["text-writing-mode"]),"text-rotate":new je(oe.layout_symbol["text-rotate"]),"text-padding":new De(oe.layout_symbol["text-padding"]),"text-keep-upright":new De(oe.layout_symbol["text-keep-upright"]),"text-transform":new je(oe.layout_symbol["text-transform"]),"text-offset":new je(oe.layout_symbol["text-offset"]),"text-allow-overlap":new De(oe.layout_symbol["text-allow-overlap"]),"text-overlap":new De(oe.layout_symbol["text-overlap"]),"text-ignore-placement":new De(oe.layout_symbol["text-ignore-placement"]),"text-optional":new De(oe.layout_symbol["text-optional"])})}};class $u{constructor(t){if(t.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:jr,this.defaultValue=t}evaluate(t){if(t.formattedSection){let r=this.defaultValue.property.overrides;if(r&&r.hasOverride(t.formattedSection))return r.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}ke("FormatSectionOverride",$u,{omit:["defaultValue"]});class Hl extends n{constructor(t){super(t,hh)}recalculate(t,r){if(super.recalculate(t,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){let s=this.layout.get("text-writing-mode");if(s){let l=[];for(let 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(t,r,s,l){let u=this.layout.get(t).evaluate(r,{},s,l),d=this._unevaluatedLayout._values[t];return d.isDataDriven()||no(d.value)||!u?u:(function(f,g){return g.replace(/{([^{}]+)}/g,((x,v)=>f&&v in f?String(f[v]):""))})(r.properties,u)}createBucket(t){return new zo(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let t of hh.paint.overridableProperties){if(!Hl.hasPaintOverride(this.layout,t))continue;let r=this.paint.get(t),s=new $u(r),l=new ro(s,r.property.specification),u=null;u=r.value.kind==="constant"||r.value.kind==="source"?new Rn("source",l):new Bn("composite",l,r.value.zoomStops),this.paint._values[t]=new Ir(r.property,u,r.parameters)}}_handleOverridablePaintPropertyUpdate(t,r,s){return!(!this.layout||r.isDataDriven()||s.isDataDriven())&&Hl.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,r){let s=t.get("text-field"),l=hh.paint.properties[r],u=!1,d=f=>{for(let g of f)if(l.overrides&&l.overrides.hasOverride(g))return void(u=!0)};if(s.value.kind==="constant"&&s.value.value instanceof Ri)d(s.value.value.sections);else if(s.value.kind==="source"){let f=x=>{u||(x instanceof nr&&Xt(x.value)===zr?d(x.value.sections):x instanceof Ws?d(x.sections):x.eachChild(f))},g=s.value;g._styleExpression&&f(g._styleExpression.expression)}return u}}let qu;var Tf={get paint(){return qu=qu||new h({"background-color":new De(oe.paint_background["background-color"]),"background-pattern":new yo(oe.paint_background["background-pattern"]),"background-opacity":new De(oe.paint_background["background-opacity"])})}};class If extends n{constructor(t){super(t,Tf)}}let Zu;var Cf={get paint(){return Zu=Zu||new h({"raster-opacity":new De(oe.paint_raster["raster-opacity"]),"raster-hue-rotate":new De(oe.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new De(oe.paint_raster["raster-brightness-min"]),"raster-brightness-max":new De(oe.paint_raster["raster-brightness-max"]),"raster-saturation":new De(oe.paint_raster["raster-saturation"]),"raster-contrast":new De(oe.paint_raster["raster-contrast"]),"raster-resampling":new De(oe.paint_raster["raster-resampling"]),"raster-fade-duration":new De(oe.paint_raster["raster-fade-duration"])})}};class Pf extends n{constructor(t){super(t,Cf)}}class Mf extends n{constructor(t){super(t,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=t}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class Af{constructor(t){this._methodToThrottle=t,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._methodToThrottle()}),0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}let uh=63710088e-1;class es{constructor(t,r){if(isNaN(t)||isNaN(r))throw new Error(`Invalid LngLat object: (${t}, ${r})`);if(this.lng=+t,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new es(Pt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){let r=Math.PI/180,s=this.lat*r,l=t.lat*r,u=Math.sin(s)*Math.sin(l)+Math.cos(s)*Math.cos(l)*Math.cos((t.lng-this.lng)*r);return uh*Math.acos(Math.min(u,1))}static convert(t){if(t instanceof es)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new es(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new es(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}let Gu=2*Math.PI*uh;function Hu(i){return Gu*Math.cos(i*Math.PI/180)}function Wu(i){return(180+i)/360}function Xu(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function Ku(i,t){return i/Hu(t)}function dh(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class ja{constructor(t,r,s=0){this.x=+t,this.y=+r,this.z=+s}static fromLngLat(t,r=0){let s=es.convert(t);return new ja(Wu(s.lng),Xu(s.lat),Ku(r,s.lat))}toLngLat(){return new es(360*this.x-180,dh(this.y))}toAltitude(){return this.z*Hu(dh(this.y))}meterInMercatorCoordinateUnits(){return 1/Gu*(t=dh(this.y),1/Math.cos(t*Math.PI/180));var t}}function Ju(i,t,r){var s=2*Math.PI*6378137/256/Math.pow(2,r);return[i*s-2*Math.PI*6378137/2,t*s-2*Math.PI*6378137/2]}class ph{constructor(t,r,s){if(!(function(l,u,d){return!(l<0||l>25||d<0||d>=Math.pow(2,l)||u<0||u>=Math.pow(2,l))})(t,r,s))throw new Error(`x=${r}, y=${s}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=r,this.y=s,this.key=$a(0,t,t,r,s)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,r,s){let l=(d=this.y,f=this.z,g=Ju(256*(u=this.x),256*(d=Math.pow(2,f)-d-1),f),x=Ju(256*(u+1),256*(d+1),f),g[0]+","+g[1]+","+x[0]+","+x[1]);var u,d,f,g,x;let v=(function(w,C,A){let k,z="";for(let O=w;O>0;O--)k=1<<O-1,z+=(C&k?1:0)+(A&k?2:0);return z})(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(s==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,v).replace(/{bbox-epsg-3857}/g,l)}isChildOf(t){let r=this.z-t.z;return r>0&&t.x===this.x>>r&&t.y===this.y>>r}getTilePoint(t){let r=Math.pow(2,this.z);return new pe((t.x*r-this.x)*Kt,(t.y*r-this.y)*Kt)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Yu{constructor(t,r){this.wrap=t,this.canonical=r,this.key=$a(t,r.z,r.z,r.x,r.y)}}class dr{constructor(t,r,s,l,u){if(t<s)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${s}`);this.overscaledZ=t,this.wrap=r,this.canonical=new ph(s,+l,+u),this.key=$a(r,t,s,l,u)}clone(){return new dr(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-t;return t>this.canonical.z?new dr(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new dr(t,this.wrap,t,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(t,r){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let s=this.canonical.z-t;return t>this.canonical.z?$a(this.wrap*+r,t,this.canonical.z,this.canonical.x,this.canonical.y):$a(this.wrap*+r,t,t,this.canonical.x>>s,this.canonical.y>>s)}isChildOf(t){if(t.wrap!==this.wrap)return!1;let r=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>r&&t.canonical.y===this.canonical.y>>r}children(t){if(this.overscaledZ>=t)return[new dr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let 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(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new dr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new dr(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Yu(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new ja(t.x-this.wrap,t.y))}}function $a(i,t,r,s,l){(i*=2)<0&&(i=-1*i-1);let u=1<<r;return(u*u*i+u*l+s).toString(36)+r.toString(36)+t.toString(36)}ke("CanonicalTileID",ph),ke("OverscaledTileID",dr,{omit:["posMatrix"]});class Qu{constructor(t,r,s,l=1,u=1,d=1,f=0){if(this.uid=t,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(s&&!["mapbox","terrarium","custom"].includes(s))return void ze(`"${s}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=r.height;let g=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),s){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=l,this.greenFactor=u,this.blueFactor=d,this.baseShift=f;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let x=0;x<g;x++)this.data[this._idx(-1,x)]=this.data[this._idx(0,x)],this.data[this._idx(g,x)]=this.data[this._idx(g-1,x)],this.data[this._idx(x,-1)]=this.data[this._idx(x,0)],this.data[this._idx(x,g)]=this.data[this._idx(x,g-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(g,-1)]=this.data[this._idx(g-1,0)],this.data[this._idx(-1,g)]=this.data[this._idx(0,g-1)],this.data[this._idx(g,g)]=this.data[this._idx(g-1,g-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let x=0;x<g;x++)for(let v=0;v<g;v++){let w=this.get(x,v);w>this.max&&(this.max=w),w<this.min&&(this.min=w)}}get(t,r){let s=new Uint8Array(this.data.buffer),l=4*this._idx(t,r);return this.unpack(s[l],s[l+1],s[l+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,r){if(t<-1||t>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(t+1)}unpack(t,r,s){return t*this.redFactor+r*this.greenFactor+s*this.blueFactor-this.baseShift}getPixels(){return new ur({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,r,s){if(this.dim!==t.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}let g=-r*this.dim,x=-s*this.dim;for(let v=d;v<f;v++)for(let w=l;w<u;w++)this.data[this._idx(w,v)]=t.data[this._idx(w+g,v+x)]}}ke("DEMData",Qu);class ed{constructor(t){this._stringToNumber={},this._numberToString=[];for(let r=0;r<t.length;r++){let s=t[r];this._stringToNumber[s]=r,this._numberToString[r]=s}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class td{constructor(t,r,s,l,u){this.type="Feature",this._vectorTileFeature=t,t._z=r,t._x=s,t._y=l,this.properties=t.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(t){this._geometry=t}toJSON(){let t={geometry:this.geometry};for(let r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(t[r]=this[r]);return t}}class id{constructor(t,r){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Vn(Kt,16,0),this.grid3D=new Vn(Kt,16,0),this.featureIndexArray=new bi,this.promoteId=r}insert(t,r,s,l,u,d){let f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,l,u);let g=d?this.grid3D:this.grid;for(let x=0;x<r.length;x++){let v=r[x],w=[1/0,1/0,-1/0,-1/0];for(let C=0;C<v.length;C++){let A=v[C];w[0]=Math.min(w[0],A.x),w[1]=Math.min(w[1],A.y),w[2]=Math.max(w[2],A.x),w[3]=Math.max(w[3],A.y)}w[0]<Kt&&w[1]<Kt&&w[2]>=0&&w[3]>=0&&g.insert(f,w[0],w[1],w[2],w[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Jn.VectorTile(new th(this.rawTileData)).layers,this.sourceLayerCoder=new ed(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,r,s,l){this.loadVTLayers();let u=t.params||{},d=Kt/t.tileSize/t.scale,f=la(u.filter),g=t.queryGeometry,x=t.queryPadding*d,v=nd(g),w=this.grid.query(v.minX-x,v.minY-x,v.maxX+x,v.maxY+x),C=nd(t.cameraQueryGeometry),A=this.grid3D.query(C.minX-x,C.minY-x,C.maxX+x,C.maxY+x,((O,j,ie,H)=>(function(ee,ae,fe,Me,Ue){for(let we of ee)if(ae<=we.x&&fe<=we.y&&Me>=we.x&&Ue>=we.y)return!0;let Ie=[new pe(ae,fe),new pe(ae,Ue),new pe(Me,Ue),new pe(Me,fe)];if(ee.length>2){for(let we of Ie)if(Io(ee,we))return!0}for(let we=0;we<ee.length-1;we++)if(lp(ee[we],ee[we+1],Ie))return!0;return!1})(t.cameraQueryGeometry,O-x,j-x,ie+x,H+x)));for(let O of A)w.push(O);w.sort(Ef);let k={},z;for(let O=0;O<w.length;O++){let j=w[O];if(j===z)continue;z=j;let ie=this.featureIndexArray.get(j),H=null;this.loadMatchingFeature(k,ie.bucketIndex,ie.sourceLayerIndex,ie.featureIndex,f,u.layers,u.availableImages,r,s,l,((ee,ae,fe)=>(H||(H=Ds(ee)),ae.queryIntersectsFeature(g,ee,fe,H,this.z,t.transform,d,t.pixelPosMatrix))))}return k}loadMatchingFeature(t,r,s,l,u,d,f,g,x,v,w){let C=this.bucketLayerIDs[r];if(d&&!(function(O,j){for(let ie=0;ie<O.length;ie++)if(j.indexOf(O[ie])>=0)return!0;return!1})(d,C))return;let A=this.sourceLayerCoder.decode(s),k=this.vtLayers[A].feature(l);if(u.needGeometry){let O=Rs(k,!0);if(!u.filter(new At(this.tileID.overscaledZ),O,this.tileID.canonical))return}else if(!u.filter(new At(this.tileID.overscaledZ),k))return;let z=this.getId(k,A);for(let O=0;O<C.length;O++){let j=C[O];if(d&&d.indexOf(j)<0)continue;let ie=g[j];if(!ie)continue;let H={};z&&v&&(H=v.getState(ie.sourceLayer||"_geojsonTileLayer",z));let ee=Mt({},x[j]);ee.paint=rd(ee.paint,ie.paint,k,H,f),ee.layout=rd(ee.layout,ie.layout,k,H,f);let ae=!w||w(k,ie,H);if(!ae)continue;let fe=new td(k,this.z,this.x,this.y,z);fe.layer=ee;let Me=t[j];Me===void 0&&(Me=t[j]=[]),Me.push({featureIndex:l,feature:fe,intersectionZ:ae})}}lookupSymbolFeatures(t,r,s,l,u,d,f,g){let x={};this.loadVTLayers();let v=la(u);for(let w of t)this.loadMatchingFeature(x,s,l,w,v,d,f,g,r);return x}hasLayer(t){for(let r of this.bucketLayerIDs)for(let s of r)if(t===s)return!0;return!1}getId(t,r){let s=t.id;return this.promoteId&&(s=t.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof s=="boolean"&&(s=Number(s))),s}}function rd(i,t,r,s,l){return _t(i,((u,d)=>{let f=t instanceof Es?t.get(d):null;return f&&f.evaluate?f.evaluate(r,s,l):f}))}function nd(i){let t=1/0,r=1/0,s=-1/0,l=-1/0;for(let u of i)t=Math.min(t,u.x),r=Math.min(r,u.y),s=Math.max(s,u.x),l=Math.max(l,u.y);return{minX:t,minY:r,maxX:s,maxY:l}}function Ef(i,t){return t-i}function sd(i,t,r,s,l){let u=[];for(let d=0;d<i.length;d++){let f=i[d],g;for(let x=0;x<f.length-1;x++){let v=f[x],w=f[x+1];v.x<t&&w.x<t||(v.x<t?v=new pe(t,v.y+(t-v.x)/(w.x-v.x)*(w.y-v.y))._round():w.x<t&&(w=new pe(t,v.y+(t-v.x)/(w.x-v.x)*(w.y-v.y))._round()),v.y<r&&w.y<r||(v.y<r?v=new pe(v.x+(r-v.y)/(w.y-v.y)*(w.x-v.x),r)._round():w.y<r&&(w=new pe(v.x+(r-v.y)/(w.y-v.y)*(w.x-v.x),r)._round()),v.x>=s&&w.x>=s||(v.x>=s?v=new pe(s,v.y+(s-v.x)/(w.x-v.x)*(w.y-v.y))._round():w.x>=s&&(w=new pe(s,v.y+(s-v.x)/(w.x-v.x)*(w.y-v.y))._round()),v.y>=l&&w.y>=l||(v.y>=l?v=new pe(v.x+(l-v.y)/(w.y-v.y)*(w.x-v.x),l)._round():w.y>=l&&(w=new pe(v.x+(l-v.y)/(w.y-v.y)*(w.x-v.x),l)._round()),g&&v.equals(g[g.length-1])||(g=[v],u.push(g)),g.push(w)))))}}return u}ke("FeatureIndex",id,{omit:["rawTileData","sourceLayerCoder"]});class ts extends pe{constructor(t,r,s,l){super(t,r),this.angle=s,l!==void 0&&(this.segment=l)}clone(){return new ts(this.x,this.y,this.angle,this.segment)}}function od(i,t,r,s,l){if(t.segment===void 0||r===0)return!0;let u=t,d=t.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++;let g=[],x=0;for(;f<r/2;){let v=i[d],w=i[d+1];if(!w)return!1;let C=i[d-1].angleTo(v)-v.angleTo(w);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;d++,f+=v.dist(w)}return!0}function ad(i){let t=0;for(let r=0;r<i.length-1;r++)t+=i[r].dist(i[r+1]);return t}function ld(i,t,r){return i?.6*t*r:0}function cd(i,t){return Math.max(i?i.right-i.left:0,t?t.right-t.left:0)}function kf(i,t,r,s,l,u){let d=ld(r,l,u),f=cd(r,s)*u,g=0,x=ad(i)/2;for(let v=0;v<i.length-1;v++){let w=i[v],C=i[v+1],A=w.dist(C);if(g+A>x){let k=(x-g)/A,z=Ci.number(w.x,C.x,k),O=Ci.number(w.y,C.y,k),j=new ts(z,O,C.angleTo(w),v);return j._round(),!d||od(i,j,f,d,t)?j:void 0}g+=A}}function zf(i,t,r,s,l,u,d,f,g){let x=ld(s,u,d),v=cd(s,l),w=v*d,C=i[0].x===0||i[0].x===g||i[0].y===0||i[0].y===g;return t-w<t/4&&(t=w+t/4),hd(i,C?t/2*f%t:(v/2+2*u)*d*f%t,t,x,r,w,C,!1,g)}function hd(i,t,r,s,l,u,d,f,g){let x=u/2,v=ad(i),w=0,C=t-r,A=[];for(let k=0;k<i.length-1;k++){let z=i[k],O=i[k+1],j=z.dist(O),ie=O.angleTo(z);for(;C+r<w+j;){C+=r;let H=(C-w)/j,ee=Ci.number(z.x,O.x,H),ae=Ci.number(z.y,O.y,H);if(ee>=0&&ee<g&&ae>=0&&ae<g&&C-x>=0&&C+x<=v){let fe=new ts(ee,ae,ie,k);fe._round(),s&&!od(i,fe,u,s,l)||A.push(fe)}}w+=j}return f||A.length||d||(A=hd(i,w/2,r,s,l,u,d,!0,g)),A}ke("Anchor",ts);let Lo=Ui;function ud(i,t,r,s){let l=[],u=i.image,d=u.pixelRatio,f=u.paddedRect.w-2*Lo,g=u.paddedRect.h-2*Lo,x={x1:i.left,y1:i.top,x2:i.right,y2:i.bottom},v=u.stretchX||[[0,f]],w=u.stretchY||[[0,g]],C=(he,Oe)=>he+Oe[1]-Oe[0],A=v.reduce(C,0),k=w.reduce(C,0),z=f-A,O=g-k,j=0,ie=A,H=0,ee=k,ae=0,fe=z,Me=0,Ue=O;if(u.content&&s){let he=u.content,Oe=he[2]-he[0],Be=he[3]-he[1];(u.textFitWidth||u.textFitHeight)&&(x=Ou(i)),j=Wl(v,0,he[0]),H=Wl(w,0,he[1]),ie=Wl(v,he[0],he[2]),ee=Wl(w,he[1],he[3]),ae=he[0]-j,Me=he[1]-H,fe=Oe-ie,Ue=Be-ee}let Ie=x.x1,we=x.y1,Fe=x.x2-Ie,Le=x.y2-we,Ee=(he,Oe,Be,Ge)=>{let Tt=Xl(he.stretch-j,ie,Fe,Ie),St=Kl(he.fixed-ae,fe,he.stretch,A),ii=Xl(Oe.stretch-H,ee,Le,we),Pr=Kl(Oe.fixed-Me,Ue,Oe.stretch,k),mi=Xl(Be.stretch-j,ie,Fe,Ie),ri=Kl(Be.fixed-ae,fe,Be.stretch,A),Ei=Xl(Ge.stretch-H,ee,Le,we),ki=Kl(Ge.fixed-Me,Ue,Ge.stretch,k),zi=new pe(Tt,ii),$t=new pe(mi,ii),ni=new pe(mi,Ei),Si=new pe(Tt,Ei),gi=new pe(St/d,Pr/d),Li=new pe(ri/d,ki/d),_i=t*Math.PI/180;if(_i){let ft=Math.sin(_i),Ct=Math.cos(_i),Lt=[Ct,-ft,ft,Ct];zi._matMult(Lt),$t._matMult(Lt),Si._matMult(Lt),ni._matMult(Lt)}let pr=he.stretch+he.fixed,ji=Oe.stretch+Oe.fixed;return{tl:zi,tr:$t,bl:Si,br:ni,tex:{x:u.paddedRect.x+Lo+pr,y:u.paddedRect.y+Lo+ji,w:Be.stretch+Be.fixed-pr,h:Ge.stretch+Ge.fixed-ji},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:gi,pixelOffsetBR:Li,minFontScaleX:fe/d/Fe,minFontScaleY:Ue/d/Le,isSDF:r}};if(s&&(u.stretchX||u.stretchY)){let he=dd(v,z,A),Oe=dd(w,O,k);for(let Be=0;Be<he.length-1;Be++){let Ge=he[Be],Tt=he[Be+1];for(let St=0;St<Oe.length-1;St++)l.push(Ee(Ge,Oe[St],Tt,Oe[St+1]))}}else l.push(Ee({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:f+1},{fixed:0,stretch:g+1}));return l}function Wl(i,t,r){let s=0;for(let l of i)s+=Math.max(t,Math.min(r,l[1]))-Math.max(t,Math.min(r,l[0]));return s}function dd(i,t,r){let s=[{fixed:-Lo,stretch:0}];for(let[l,u]of i){let 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:t+Lo,stretch:r}),s}function Xl(i,t,r,s){return i/t*r+s}function Kl(i,t,r,s){return i-t*r/s}class Jl{constructor(t,r,s,l,u,d,f,g,x,v){var w;if(this.boxStartIndex=t.length,x){let C=d.top,A=d.bottom,k=d.collisionPadding;k&&(C-=k[1],A+=k[3]);let z=A-C;z>0&&(z=Math.max(10,z),this.circleDiameter=z)}else{let C=!((w=d.image)===null||w===void 0)&&w.content&&(d.image.textFitWidth||d.image.textFitHeight)?Ou(d):{x1:d.left,y1:d.top,x2:d.right,y2:d.bottom};C.y1=C.y1*f-g[0],C.y2=C.y2*f+g[2],C.x1=C.x1*f-g[3],C.x2=C.x2*f+g[1];let A=d.collisionPadding;if(A&&(C.x1-=A[0]*f,C.y1-=A[1]*f,C.x2+=A[2]*f,C.y2+=A[3]*f),v){let k=new pe(C.x1,C.y1),z=new pe(C.x2,C.y1),O=new pe(C.x1,C.y2),j=new pe(C.x2,C.y2),ie=v*Math.PI/180;k._rotate(ie),z._rotate(ie),O._rotate(ie),j._rotate(ie),C.x1=Math.min(k.x,z.x,O.x,j.x),C.x2=Math.max(k.x,z.x,O.x,j.x),C.y1=Math.min(k.y,z.y,O.y,j.y),C.y2=Math.max(k.y,z.y,O.y,j.y)}t.emplaceBack(r.x,r.y,C.x1,C.y1,C.x2,C.y2,s,l,u)}this.boxEndIndex=t.length}}class Lf{constructor(t=[],r=((s,l)=>s<l?-1:s>l?1:0)){if(this.data=t,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(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;let t=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:r,compare:s}=this,l=r[t];for(;t>0;){let u=t-1>>1,d=r[u];if(s(l,d)>=0)break;r[t]=d,t=u}r[t]=l}_down(t){let{data:r,compare:s}=this,l=this.length>>1,u=r[t];for(;t<l;){let d=1+(t<<1),f=d+1;if(f<this.length&&s(r[f],r[d])<0&&(d=f),s(r[d],u)>=0)break;r[t]=r[d],t=d}r[t]=u}}function Df(i,t=1,r=!1){let s=1/0,l=1/0,u=-1/0,d=-1/0,f=i[0];for(let A=0;A<f.length;A++){let k=f[A];(!A||k.x<s)&&(s=k.x),(!A||k.y<l)&&(l=k.y),(!A||k.x>u)&&(u=k.x),(!A||k.y>d)&&(d=k.y)}let g=Math.min(u-s,d-l),x=g/2,v=new Lf([],Rf);if(g===0)return new pe(s,l);for(let A=s;A<u;A+=g)for(let k=l;k<d;k+=g)v.push(new Do(A+x,k+x,x,i));let w=(function(A){let k=0,z=0,O=0,j=A[0];for(let ie=0,H=j.length,ee=H-1;ie<H;ee=ie++){let ae=j[ie],fe=j[ee],Me=ae.x*fe.y-fe.x*ae.y;z+=(ae.x+fe.x)*Me,O+=(ae.y+fe.y)*Me,k+=3*Me}return new Do(z/k,O/k,0,A)})(i),C=v.length;for(;v.length;){let A=v.pop();(A.d>w.d||!w.d)&&(w=A,r&&console.log("found best %d after %d probes",Math.round(1e4*A.d)/1e4,C)),A.max-w.d<=t||(x=A.h/2,v.push(new Do(A.p.x-x,A.p.y-x,x,i)),v.push(new Do(A.p.x+x,A.p.y-x,x,i)),v.push(new Do(A.p.x-x,A.p.y+x,x,i)),v.push(new Do(A.p.x+x,A.p.y+x,x,i)),C+=4)}return r&&(console.log(`num probes: ${C}`),console.log(`best distance: ${w.d}`)),w.p}function Rf(i,t){return t.max-i.max}function Do(i,t,r,s){this.p=new pe(i,t),this.h=r,this.d=(function(l,u){let d=!1,f=1/0;for(let g=0;g<u.length;g++){let x=u[g];for(let v=0,w=x.length,C=w-1;v<w;C=v++){let A=x[v],k=x[C];A.y>l.y!=k.y>l.y&&l.x<(k.x-A.x)*(l.y-A.y)/(k.y-A.y)+A.x&&(d=!d),f=Math.min(f,Xh(l,A,k))}}return(d?1:-1)*Math.sqrt(f)})(this.p,s),this.max=this.d+this.h*Math.SQRT2}var fi;I.aq=void 0,(fi=I.aq||(I.aq={}))[fi.center=1]="center",fi[fi.left=2]="left",fi[fi.right=3]="right",fi[fi.top=4]="top",fi[fi.bottom=5]="bottom",fi[fi["top-left"]=6]="top-left",fi[fi["top-right"]=7]="top-right",fi[fi["bottom-left"]=8]="bottom-left",fi[fi["bottom-right"]=9]="bottom-right";let is=7,fh=Number.POSITIVE_INFINITY;function pd(i,t){return t[1]!==fh?(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-is;break;case"bottom-right":case"bottom-left":case"bottom":d=-l+is}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,t[0],t[1]):(function(r,s){let l=0,u=0;s<0&&(s=0);let d=s/Math.SQRT2;switch(r){case"top-right":case"top-left":u=d-is;break;case"bottom-right":case"bottom-left":u=-d+is;break;case"bottom":u=-s+is;break;case"top":u=s-is}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,t[0])}function fd(i,t,r){var s;let l=i.layout,u=(s=l.get("text-variable-anchor-offset"))===null||s===void 0?void 0:s.evaluate(t,{},r);if(u){let f=u.values,g=[];for(let x=0;x<f.length;x+=2){let v=g[x]=f[x],w=f[x+1].map((C=>C*ei));v.startsWith("top")?w[1]-=is:v.startsWith("bottom")&&(w[1]+=is),g[x+1]=w}return new Zi(g)}let d=l.get("text-variable-anchor");if(d){let f;f=i._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[l.get("text-radial-offset").evaluate(t,{},r)*ei,fh]:l.get("text-offset").evaluate(t,{},r).map((x=>x*ei));let g=[];for(let x of d)g.push(x,pd(x,f));return new Zi(g)}return null}function mh(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Bf(i,t,r,s,l,u,d,f,g,x,v){let w=u.textMaxSize.evaluate(t,{});w===void 0&&(w=d);let C=i.layers[0].layout,A=C.get("icon-offset").evaluate(t,{},v),k=gd(r.horizontal),z=d/24,O=i.tilePixelRatio*z,j=i.tilePixelRatio*w/24,ie=i.tilePixelRatio*f,H=i.tilePixelRatio*C.get("symbol-spacing"),ee=C.get("text-padding")*i.tilePixelRatio,ae=(function(he,Oe,Be,Ge=1){let Tt=he.get("icon-padding").evaluate(Oe,{},Be),St=Tt&&Tt.values;return[St[0]*Ge,St[1]*Ge,St[2]*Ge,St[3]*Ge]})(C,t,v,i.tilePixelRatio),fe=C.get("text-max-angle")/180*Math.PI,Me=C.get("text-rotation-alignment")!=="viewport"&&C.get("symbol-placement")!=="point",Ue=C.get("icon-rotation-alignment")==="map"&&C.get("symbol-placement")!=="point",Ie=C.get("symbol-placement"),we=H/2,Fe=C.get("icon-text-fit"),Le;s&&Fe!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Le=Nu(s,r.vertical,Fe,C.get("icon-text-fit-padding"),A,z)),k&&(s=Nu(s,k,Fe,C.get("icon-text-fit-padding"),A,z)));let Ee=(he,Oe)=>{Oe.x<0||Oe.x>=Kt||Oe.y<0||Oe.y>=Kt||(function(Be,Ge,Tt,St,ii,Pr,mi,ri,Ei,ki,zi,$t,ni,Si,gi,Li,_i,pr,ji,ft,Ct,Lt,Yi,Ot,Ro){let Xr=Be.addToLineVertexArray(Ge,Tt),Kr,Mr,fr,ai,_n=0,Ga=0,vd=0,bd=0,Sh=-1,Th=-1,yn={},wd=bo("");if(Be.allowVerticalPlacement&&St.vertical){let Ti=ri.layout.get("text-rotate").evaluate(Ct,{},Ot)+90;fr=new Jl(Ei,Ge,ki,zi,$t,St.vertical,ni,Si,gi,Ti),mi&&(ai=new Jl(Ei,Ge,ki,zi,$t,mi,_i,pr,gi,Ti))}if(ii){let Ti=ri.layout.get("icon-rotate").evaluate(Ct,{}),mr=ri.layout.get("icon-text-fit")!=="none",Fs=ud(ii,Ti,Yi,mr),Fr=mi?ud(mi,Ti,Yi,mr):void 0;Mr=new Jl(Ei,Ge,ki,zi,$t,ii,_i,pr,!1,Ti),_n=4*Fs.length;let Os=Be.iconSizeData,Jr=null;Os.kind==="source"?(Jr=[Wr*ri.layout.get("icon-size").evaluate(Ct,{})],Jr[0]>Qn&&ze(`${Be.layerIds[0]}: Value for "icon-size" is >= ${Ua}. Reduce your "icon-size".`)):Os.kind==="composite"&&(Jr=[Wr*Lt.compositeIconSizes[0].evaluate(Ct,{},Ot),Wr*Lt.compositeIconSizes[1].evaluate(Ct,{},Ot)],(Jr[0]>Qn||Jr[1]>Qn)&&ze(`${Be.layerIds[0]}: Value for "icon-size" is >= ${Ua}. Reduce your "icon-size".`)),Be.addSymbols(Be.icon,Fs,Jr,ft,ji,Ct,I.ah.none,Ge,Xr.lineStartIndex,Xr.lineLength,-1,Ot),Sh=Be.icon.placedSymbolArray.length-1,Fr&&(Ga=4*Fr.length,Be.addSymbols(Be.icon,Fr,Jr,ft,ji,Ct,I.ah.vertical,Ge,Xr.lineStartIndex,Xr.lineLength,-1,Ot),Th=Be.icon.placedSymbolArray.length-1)}let Sd=Object.keys(St.horizontal);for(let Ti of Sd){let mr=St.horizontal[Ti];if(!Kr){wd=bo(mr.text);let Fr=ri.layout.get("text-rotate").evaluate(Ct,{},Ot);Kr=new Jl(Ei,Ge,ki,zi,$t,mr,ni,Si,gi,Fr)}let Fs=mr.positionedLines.length===1;if(vd+=md(Be,Ge,mr,Pr,ri,gi,Ct,Li,Xr,St.vertical?I.ah.horizontal:I.ah.horizontalOnly,Fs?Sd:[Ti],yn,Sh,Lt,Ot),Fs)break}St.vertical&&(bd+=md(Be,Ge,St.vertical,Pr,ri,gi,Ct,Li,Xr,I.ah.vertical,["vertical"],yn,Th,Lt,Ot));let Nf=Kr?Kr.boxStartIndex:Be.collisionBoxArray.length,Vf=Kr?Kr.boxEndIndex:Be.collisionBoxArray.length,Uf=fr?fr.boxStartIndex:Be.collisionBoxArray.length,jf=fr?fr.boxEndIndex:Be.collisionBoxArray.length,$f=Mr?Mr.boxStartIndex:Be.collisionBoxArray.length,qf=Mr?Mr.boxEndIndex:Be.collisionBoxArray.length,Zf=ai?ai.boxStartIndex:Be.collisionBoxArray.length,Gf=ai?ai.boxEndIndex:Be.collisionBoxArray.length,Br=-1,Ql=(Ti,mr)=>Ti&&Ti.circleDiameter?Math.max(Ti.circleDiameter,mr):mr;Br=Ql(Kr,Br),Br=Ql(fr,Br),Br=Ql(Mr,Br),Br=Ql(ai,Br);let Td=Br>-1?1:0;Td&&(Br*=Ro/ei),Be.glyphOffsetArray.length>=zo.MAX_GLYPHS&&ze("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Ct.sortKey!==void 0&&Be.addToSortKeyRanges(Be.symbolInstances.length,Ct.sortKey);let Hf=fd(ri,Ct,Ot),[Wf,Xf]=(function(Ti,mr){let Fs=Ti.length,Fr=mr?.values;if(Fr?.length>0)for(let Os=0;Os<Fr.length;Os+=2){let Jr=Fr[Os+1];Ti.emplaceBack(I.aq[Fr[Os]],Jr[0],Jr[1])}return[Fs,Ti.length]})(Be.textAnchorOffsets,Hf);Be.symbolInstances.emplaceBack(Ge.x,Ge.y,yn.right>=0?yn.right:-1,yn.center>=0?yn.center:-1,yn.left>=0?yn.left:-1,yn.vertical||-1,Sh,Th,wd,Nf,Vf,Uf,jf,$f,qf,Zf,Gf,ki,vd,bd,_n,Ga,Td,0,ni,Br,Wf,Xf)})(i,Oe,he,r,s,l,Le,i.layers[0],i.collisionBoxArray,t.index,t.sourceLayerIndex,i.index,O,[ee,ee,ee,ee],Me,g,ie,ae,Ue,A,t,u,x,v,d)};if(Ie==="line")for(let he of sd(t.geometry,0,0,Kt,Kt)){let Oe=zf(he,H,fe,r.vertical||k,s,24,j,i.overscaling,Kt);for(let Be of Oe)k&&Ff(i,k.text,we,Be)||Ee(he,Be)}else if(Ie==="line-center"){for(let he of t.geometry)if(he.length>1){let Oe=kf(he,fe,r.vertical||k,s,24,j);Oe&&Ee(he,Oe)}}else if(t.type==="Polygon")for(let he of Ks(t.geometry,0)){let Oe=Df(he,16);Ee(he[0],new ts(Oe.x,Oe.y,0))}else if(t.type==="LineString")for(let he of t.geometry)Ee(he,new ts(he[0].x,he[0].y,0));else if(t.type==="Point")for(let he of t.geometry)for(let Oe of he)Ee([Oe],new ts(Oe.x,Oe.y,0))}function md(i,t,r,s,l,u,d,f,g,x,v,w,C,A,k){let z=(function(ie,H,ee,ae,fe,Me,Ue,Ie){let we=ae.layout.get("text-rotate").evaluate(Me,{})*Math.PI/180,Fe=[];for(let Le of H.positionedLines)for(let Ee of Le.positionedGlyphs){if(!Ee.rect)continue;let he=Ee.rect||{},Oe=ku+1,Be=!0,Ge=1,Tt=0,St=(fe||Ie)&&Ee.vertical,ii=Ee.metrics.advance*Ee.scale/2;if(Ie&&H.verticalizable&&(Tt=Le.lineOffset/2-(Ee.imageName?-(ei-Ee.metrics.width*Ee.scale)/2:(Ee.scale-1)*ei)),Ee.imageName){let ft=Ue[Ee.imageName];Be=ft.sdf,Ge=ft.pixelRatio,Oe=Ui/Ge}let Pr=fe?[Ee.x+ii,Ee.y]:[0,0],mi=fe?[0,0]:[Ee.x+ii+ee[0],Ee.y+ee[1]-Tt],ri=[0,0];St&&(ri=mi,mi=[0,0]);let Ei=Ee.metrics.isDoubleResolution?2:1,ki=(Ee.metrics.left-Oe)*Ee.scale-ii+mi[0],zi=(-Ee.metrics.top-Oe)*Ee.scale+mi[1],$t=ki+he.w/Ei*Ee.scale/Ge,ni=zi+he.h/Ei*Ee.scale/Ge,Si=new pe(ki,zi),gi=new pe($t,zi),Li=new pe(ki,ni),_i=new pe($t,ni);if(St){let ft=new pe(-ii,ii-Na),Ct=-Math.PI/2,Lt=ei/2-ii,Yi=new pe(5-Na-Lt,-(Ee.imageName?Lt:0)),Ot=new pe(...ri);Si._rotateAround(Ct,ft)._add(Yi)._add(Ot),gi._rotateAround(Ct,ft)._add(Yi)._add(Ot),Li._rotateAround(Ct,ft)._add(Yi)._add(Ot),_i._rotateAround(Ct,ft)._add(Yi)._add(Ot)}if(we){let ft=Math.sin(we),Ct=Math.cos(we),Lt=[Ct,-ft,ft,Ct];Si._matMult(Lt),gi._matMult(Lt),Li._matMult(Lt),_i._matMult(Lt)}let pr=new pe(0,0),ji=new pe(0,0);Fe.push({tl:Si,tr:gi,bl:Li,br:_i,tex:he,writingMode:H.writingMode,glyphOffset:Pr,sectionIndex:Ee.sectionIndex,isSDF:Be,pixelOffsetTL:pr,pixelOffsetBR:ji,minFontScaleX:0,minFontScaleY:0})}return Fe})(0,r,f,l,u,d,s,i.allowVerticalPlacement),O=i.textSizeData,j=null;O.kind==="source"?(j=[Wr*l.layout.get("text-size").evaluate(d,{})],j[0]>Qn&&ze(`${i.layerIds[0]}: Value for "text-size" is >= ${Ua}. Reduce your "text-size".`)):O.kind==="composite"&&(j=[Wr*A.compositeTextSizes[0].evaluate(d,{},k),Wr*A.compositeTextSizes[1].evaluate(d,{},k)],(j[0]>Qn||j[1]>Qn)&&ze(`${i.layerIds[0]}: Value for "text-size" is >= ${Ua}. Reduce your "text-size".`)),i.addSymbols(i.text,z,j,f,u,d,x,t,g.lineStartIndex,g.lineLength,C,k);for(let ie of v)w[ie]=i.text.placedSymbolArray.length-1;return 4*z.length}function gd(i){for(let t in i)return i[t];return null}function Ff(i,t,r,s){let l=i.compareText;if(t in l){let u=l[t];for(let d=u.length-1;d>=0;d--)if(s.dist(u[d])<r)return!0}else l[t]=[];return l[t].push(s),!1}let _d=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class gh{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[r,s]=new Uint8Array(t,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");let l=s>>4;if(l!==1)throw new Error(`Got v${l} data when expected v1.`);let u=_d[15&s];if(!u)throw new Error("Unrecognized array type.");let[d]=new Uint16Array(t,2,1),[f]=new Uint32Array(t,4,1);return new gh(f,d,u,t)}constructor(t,r=64,s=Float64Array,l){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=s,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;let u=_d.indexOf(this.ArrayType),d=2*t*this.ArrayType.BYTES_PER_ELEMENT,f=t*this.IndexArrayType.BYTES_PER_ELEMENT,g=(8-f%8)%8;if(u<0)throw new Error(`Unexpected typed array class: ${s}.`);l&&l instanceof ArrayBuffer?(this.data=l,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+f+g,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+d+f+g),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+f+g,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+u]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=t)}add(t,r){let s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=t,this.coords[this._pos++]=r,s}finish(){let t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return _h(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,r,s,l){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:u,coords:d,nodeSize:f}=this,g=[0,u.length-1,0],x=[];for(;g.length;){let v=g.pop()||0,w=g.pop()||0,C=g.pop()||0;if(w-C<=f){for(let O=C;O<=w;O++){let j=d[2*O],ie=d[2*O+1];j>=t&&j<=s&&ie>=r&&ie<=l&&x.push(u[O])}continue}let A=C+w>>1,k=d[2*A],z=d[2*A+1];k>=t&&k<=s&&z>=r&&z<=l&&x.push(u[A]),(v===0?t<=k:r<=z)&&(g.push(C),g.push(A-1),g.push(1-v)),(v===0?s>=k:l>=z)&&(g.push(A+1),g.push(w),g.push(1-v))}return x}within(t,r,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:l,coords:u,nodeSize:d}=this,f=[0,l.length-1,0],g=[],x=s*s;for(;f.length;){let v=f.pop()||0,w=f.pop()||0,C=f.pop()||0;if(w-C<=d){for(let O=C;O<=w;O++)xd(u[2*O],u[2*O+1],t,r)<=x&&g.push(l[O]);continue}let A=C+w>>1,k=u[2*A],z=u[2*A+1];xd(k,z,t,r)<=x&&g.push(l[A]),(v===0?t-s<=k:r-s<=z)&&(f.push(C),f.push(A-1),f.push(1-v)),(v===0?t+s>=k:r+s>=z)&&(f.push(A+1),f.push(w),f.push(1-v))}return g}}function _h(i,t,r,s,l,u){if(l-s<=r)return;let d=s+l>>1;yd(i,t,d,s,l,u),_h(i,t,r,s,d-1,1-u),_h(i,t,r,d+1,l,1-u)}function yd(i,t,r,s,l,u){for(;l>s;){if(l-s>600){let x=l-s+1,v=r-s+1,w=Math.log(x),C=.5*Math.exp(2*w/3),A=.5*Math.sqrt(w*C*(x-C)/x)*(v-x/2<0?-1:1);yd(i,t,r,Math.max(s,Math.floor(r-v*C/x+A)),Math.min(l,Math.floor(r+(x-v)*C/x+A)),u)}let d=t[2*r+u],f=s,g=l;for(qa(i,t,s,r),t[2*l+u]>d&&qa(i,t,s,l);f<g;){for(qa(i,t,f,g),f++,g--;t[2*f+u]<d;)f++;for(;t[2*g+u]>d;)g--}t[2*s+u]===d?qa(i,t,s,g):(g++,qa(i,t,g,l)),g<=r&&(s=g+1),r<=g&&(l=g-1)}}function qa(i,t,r,s){yh(i,r,s),yh(t,2*r,2*s),yh(t,2*r+1,2*s+1)}function yh(i,t,r){let s=i[t];i[t]=i[r],i[r]=s}function xd(i,t,r,s){let l=i-r,u=t-s;return l*l+u*u}var xh;I.bg=void 0,(xh=I.bg||(I.bg={})).create="create",xh.load="load",xh.fullLoad="fullLoad";let Yl=null,Za=[],vh=1e3/60,bh="loadTime",wh="fullLoadTime",Of={mark(i){performance.mark(i)},frame(i){let t=i;Yl!=null&&Za.push(t-Yl),Yl=t},clearMetrics(){Yl=null,Za=[],performance.clearMeasures(bh),performance.clearMeasures(wh);for(let i in I.bg)performance.clearMarks(I.bg[i])},getPerformanceMetrics(){performance.measure(bh,I.bg.create,I.bg.load),performance.measure(wh,I.bg.create,I.bg.fullLoad);let i=performance.getEntriesByName(bh)[0].duration,t=performance.getEntriesByName(wh)[0].duration,r=Za.length,s=1/(Za.reduce(((u,d)=>u+d),0)/r/1e3),l=Za.filter((u=>u>vh)).reduce(((u,d)=>u+(d-vh)/vh),0);return{loadTime:i,fullLoadTime:t,fps:s,percentDroppedFrames:l/(r+l)*100,totalFrames:r}}};I.$=class extends S{},I.A=Co,I.B=Ec,I.C=function(i){if(Qt==null){let t=i.navigator?i.navigator.userAgent:null;Qt=!!i.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Qt},I.D=De,I.E=bn,I.F=class{constructor(i,t){this.target=i,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Af((()=>this.process())),this.subscription=(function(r,s,l,u){return r.addEventListener(s,l,!1),{unsubscribe:()=>{r.removeEventListener(s,l,!1)}}})(this.target,"message",(r=>this.receive(r))),this.globalScope=st(self)?i:window}registerMessageHandler(i,t){this.messageHandlers[i]=t}sendAsync(i,t){return new Promise(((r,s)=>{let l=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[l]={resolve:r,reject:s},t&&t.signal.addEventListener("abort",(()=>{delete this.resolveRejects[l];let f={id:l,type:"<cancel>",origin:location.origin,targetMapId:i.targetMapId,sourceMapId:this.mapId};this.target.postMessage(f)}),{once:!0});let u=[],d=Object.assign(Object.assign({},i),{id:l,sourceMapId:this.mapId,origin:location.origin,data:Un(i.data,u)});this.target.postMessage(d,{transfer:u})}))}receive(i){let t=i.data,r=t.id;if(!(t.origin!=="file://"&&location.origin!=="file://"&&t.origin!=="resource://android"&&location.origin!=="resource://android"&&t.origin!==location.origin||t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type==="<cancel>"){delete this.tasks[r];let s=this.abortControllers[r];return delete this.abortControllers[r],void(s&&s.abort())}if(st(self)||t.mustQueue)return this.tasks[r]=t,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,t)}}process(){if(this.taskQueue.length===0)return;let i=this.taskQueue.shift(),t=this.tasks[i];delete this.tasks[i],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(i,t)}processTask(i,t){return p(this,void 0,void 0,(function*(){if(t.type==="<response>"){let l=this.resolveRejects[i];return delete this.resolveRejects[i],l?void(t.error?l.reject(jn(t.error)):l.resolve(jn(t.data))):void 0}if(!this.messageHandlers[t.type])return void this.completeTask(i,new Error(`Could not find a registered handler for ${t.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));let r=jn(t.data),s=new AbortController;this.abortControllers[i]=s;try{let l=yield this.messageHandlers[t.type](t.sourceMapId,r,s);this.completeTask(i,null,l)}catch(l){this.completeTask(i,l)}}))}completeTask(i,t,r){let s=[];delete this.abortControllers[i];let l={id:i,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?Un(t):null,data:Un(r,s)};this.target.postMessage(l,{transfer:s})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},I.G=vn,I.H=function(){var i=new Co(16);return Co!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},I.I=rh,I.J=function(i,t,r){var s,l,u,d,f,g,x,v,w,C,A,k,z=r[0],O=r[1],j=r[2];return t===i?(i[12]=t[0]*z+t[4]*O+t[8]*j+t[12],i[13]=t[1]*z+t[5]*O+t[9]*j+t[13],i[14]=t[2]*z+t[6]*O+t[10]*j+t[14],i[15]=t[3]*z+t[7]*O+t[11]*j+t[15]):(l=t[1],u=t[2],d=t[3],f=t[4],g=t[5],x=t[6],v=t[7],w=t[8],C=t[9],A=t[10],k=t[11],i[0]=s=t[0],i[1]=l,i[2]=u,i[3]=d,i[4]=f,i[5]=g,i[6]=x,i[7]=v,i[8]=w,i[9]=C,i[10]=A,i[11]=k,i[12]=s*z+f*O+w*j+t[12],i[13]=l*z+g*O+C*j+t[13],i[14]=u*z+x*O+A*j+t[14],i[15]=d*z+v*O+k*j+t[15]),i},I.K=function(i,t,r){var s=r[0],l=r[1],u=r[2];return i[0]=t[0]*s,i[1]=t[1]*s,i[2]=t[2]*s,i[3]=t[3]*s,i[4]=t[4]*l,i[5]=t[5]*l,i[6]=t[6]*l,i[7]=t[7]*l,i[8]=t[8]*u,i[9]=t[9]*u,i[10]=t[10]*u,i[11]=t[11]*u,i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15],i},I.L=Qh,I.M=function(i,t){let r={};for(let s=0;s<t.length;s++){let l=t[s];l in i&&(r[l]=i[l])}return r},I.N=es,I.O=Wu,I.P=pe,I.Q=Xu,I.R=ur,I.S=dr,I.T=go,I.U=li,I.V=$i,I.W=er,I.X=Kt,I.Y=m,I.Z=ja,I._=p,I.a=Or,I.a$=function(i,t){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],v=i[8],w=i[9],C=i[10],A=i[11],k=i[12],z=i[13],O=i[14],j=i[15],ie=t[0],H=t[1],ee=t[2],ae=t[3],fe=t[4],Me=t[5],Ue=t[6],Ie=t[7],we=t[8],Fe=t[9],Le=t[10],Ee=t[11],he=t[12],Oe=t[13],Be=t[14],Ge=t[15];return Math.abs(r-ie)<=Ai*Math.max(1,Math.abs(r),Math.abs(ie))&&Math.abs(s-H)<=Ai*Math.max(1,Math.abs(s),Math.abs(H))&&Math.abs(l-ee)<=Ai*Math.max(1,Math.abs(l),Math.abs(ee))&&Math.abs(u-ae)<=Ai*Math.max(1,Math.abs(u),Math.abs(ae))&&Math.abs(d-fe)<=Ai*Math.max(1,Math.abs(d),Math.abs(fe))&&Math.abs(f-Me)<=Ai*Math.max(1,Math.abs(f),Math.abs(Me))&&Math.abs(g-Ue)<=Ai*Math.max(1,Math.abs(g),Math.abs(Ue))&&Math.abs(x-Ie)<=Ai*Math.max(1,Math.abs(x),Math.abs(Ie))&&Math.abs(v-we)<=Ai*Math.max(1,Math.abs(v),Math.abs(we))&&Math.abs(w-Fe)<=Ai*Math.max(1,Math.abs(w),Math.abs(Fe))&&Math.abs(C-Le)<=Ai*Math.max(1,Math.abs(C),Math.abs(Le))&&Math.abs(A-Ee)<=Ai*Math.max(1,Math.abs(A),Math.abs(Ee))&&Math.abs(k-he)<=Ai*Math.max(1,Math.abs(k),Math.abs(he))&&Math.abs(z-Oe)<=Ai*Math.max(1,Math.abs(z),Math.abs(Oe))&&Math.abs(O-Be)<=Ai*Math.max(1,Math.abs(O),Math.abs(Be))&&Math.abs(j-Ge)<=Ai*Math.max(1,Math.abs(j),Math.abs(Ge))},I.a0=ct,I.a1=ph,I.a2=ge,I.a3=i=>{let t=window.document.createElement("video");return t.muted=!0,new Promise((r=>{t.onloadstart=()=>{r(t)};for(let s of i){let l=window.document.createElement("source");Qr(s)||(t.crossOrigin="Anonymous"),l.src=s,t.appendChild(l)}}))},I.a4=function(){return Vt++},I.a5=Pe,I.a6=zo,I.a7=la,I.a8=Rs,I.a9=td,I.aA=function(i){if(i.type==="custom")return new Mf(i);switch(i.type){case"background":return new If(i);case"circle":return new up(i);case"fill":return new Mp(i);case"fill-extrusion":return new $p(i);case"heatmap":return new pp(i);case"hillshade":return new mp(i);case"line":return new Jp(i);case"raster":return new Pf(i);case"symbol":return new Hl(i)}},I.aB=Ye,I.aC=function(i,t){if(!i)return[{command:"setStyle",args:[t]}];let r=[];try{if(!mt(i.version,t.version))return[{command:"setStyle",args:[t]}];mt(i.center,t.center)||r.push({command:"setCenter",args:[t.center]}),mt(i.zoom,t.zoom)||r.push({command:"setZoom",args:[t.zoom]}),mt(i.bearing,t.bearing)||r.push({command:"setBearing",args:[t.bearing]}),mt(i.pitch,t.pitch)||r.push({command:"setPitch",args:[t.pitch]}),mt(i.sprite,t.sprite)||r.push({command:"setSprite",args:[t.sprite]}),mt(i.glyphs,t.glyphs)||r.push({command:"setGlyphs",args:[t.glyphs]}),mt(i.transition,t.transition)||r.push({command:"setTransition",args:[t.transition]}),mt(i.light,t.light)||r.push({command:"setLight",args:[t.light]}),mt(i.terrain,t.terrain)||r.push({command:"setTerrain",args:[t.terrain]}),mt(i.sky,t.sky)||r.push({command:"setSky",args:[t.sky]}),mt(i.projection,t.projection)||r.push({command:"setProjection",args:[t.projection]});let s={},l=[];(function(d,f,g,x){let v;for(v in f=f||{},d=d||{})Object.prototype.hasOwnProperty.call(d,v)&&(Object.prototype.hasOwnProperty.call(f,v)||Ur(v,g,x));for(v in f)Object.prototype.hasOwnProperty.call(f,v)&&(Object.prototype.hasOwnProperty.call(d,v)?mt(d[v],f[v])||(d[v].type==="geojson"&&f[v].type==="geojson"&&wn(d,f,v)?Bt(g,{command:"setGeoJSONSourceData",args:[v,f[v].data]}):kr(v,f,g,x)):hs(v,f,g))})(i.sources,t.sources,l,s);let u=[];i.layers&&i.layers.forEach((d=>{"source"in d&&s[d.source]?r.push({command:"removeLayer",args:[d.id]}):u.push(d)})),r=r.concat(l),(function(d,f,g){f=f||[];let x=(d=d||[]).map(us),v=f.map(us),w=d.reduce(ds,{}),C=f.reduce(ds,{}),A=x.slice(),k=Object.create(null),z,O,j,ie,H;for(let ee=0,ae=0;ee<x.length;ee++)z=x[ee],Object.prototype.hasOwnProperty.call(C,z)?ae++:(Bt(g,{command:"removeLayer",args:[z]}),A.splice(A.indexOf(z,ae),1));for(let ee=0,ae=0;ee<v.length;ee++)z=v[v.length-1-ee],A[A.length-1-ee]!==z&&(Object.prototype.hasOwnProperty.call(w,z)?(Bt(g,{command:"removeLayer",args:[z]}),A.splice(A.lastIndexOf(z,A.length-ae),1)):ae++,ie=A[A.length-ee],Bt(g,{command:"addLayer",args:[C[z],ie]}),A.splice(A.length-ee,0,z),k[z]=!0);for(let ee=0;ee<v.length;ee++)if(z=v[ee],O=w[z],j=C[z],!k[z]&&!mt(O,j))if(mt(O.source,j.source)&&mt(O["source-layer"],j["source-layer"])&&mt(O.type,j.type)){for(H in qi(O.layout,j.layout,g,z,null,"setLayoutProperty"),qi(O.paint,j.paint,g,z,null,"setPaintProperty"),mt(O.filter,j.filter)||Bt(g,{command:"setFilter",args:[z,j.filter]}),mt(O.minzoom,j.minzoom)&&mt(O.maxzoom,j.maxzoom)||Bt(g,{command:"setLayerZoomRange",args:[z,j.minzoom,j.maxzoom]}),O)Object.prototype.hasOwnProperty.call(O,H)&&H!=="layout"&&H!=="paint"&&H!=="filter"&&H!=="metadata"&&H!=="minzoom"&&H!=="maxzoom"&&(H.indexOf("paint.")===0?qi(O[H],j[H],g,z,H.slice(6),"setPaintProperty"):mt(O[H],j[H])||Bt(g,{command:"setLayerProperty",args:[z,H,j[H]]}));for(H in j)Object.prototype.hasOwnProperty.call(j,H)&&!Object.prototype.hasOwnProperty.call(O,H)&&H!=="layout"&&H!=="paint"&&H!=="filter"&&H!=="metadata"&&H!=="minzoom"&&H!=="maxzoom"&&(H.indexOf("paint.")===0?qi(O[H],j[H],g,z,H.slice(6),"setPaintProperty"):mt(O[H],j[H])||Bt(g,{command:"setLayerProperty",args:[z,H,j[H]]}))}else Bt(g,{command:"removeLayer",args:[z]}),ie=A[A.lastIndexOf(z)+1],Bt(g,{command:"addLayer",args:[j,ie]})})(u,t.layers,r)}catch(s){console.warn("Unable to compute style diff:",s),r=[{command:"setStyle",args:[t]}]}return r},I.aD=function(i){let t=[],r=i.id;return r===void 0&&t.push({message:`layers.${r}: missing required property "id"`}),i.render===void 0&&t.push({message:`layers.${r}: missing required method "render"`}),i.renderingMode&&i.renderingMode!=="2d"&&i.renderingMode!=="3d"&&t.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),t},I.aE=function i(t,r){if(Array.isArray(t)){if(!Array.isArray(r)||t.length!==r.length)return!1;for(let s=0;s<t.length;s++)if(!i(t[s],r[s]))return!1;return!0}if(typeof t=="object"&&t!==null&&r!==null){if(typeof r!="object"||Object.keys(t).length!==Object.keys(r).length)return!1;for(let s in t)if(!i(t[s],r[s]))return!1;return!0}return t===r},I.aF=_t,I.aG=yi,I.aH=class extends zs{constructor(i,t){super(i,t),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},I.aI=Dl,I.aJ=class extends zs{constructor(i,t){super(i,t),this.current=rp}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let t=1;t<16;t++)if(i[t]!==this.current[t]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},I.aK=jh,I.aL=$h,I.aM=vt,I.aN=class extends zs{constructor(i,t){super(i,t),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},I.aO=class extends zs{constructor(i,t){super(i,t),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},I.aP=function(i,t,r,s,l,u,d){var f=1/(t-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]=(t+r)*f,i[13]=(l+s)*g,i[14]=(d+u)*x,i[15]=1,i},I.aQ=hp,I.aR=class extends J{},I.aS=tf,I.aT=class extends ne{},I.aU=Zc,I.aV=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},I.aW=nu,I.aX=di,I.aY=hr,I.aZ=class extends Re{},I.a_=function(i,t){return i[0]===t[0]&&i[1]===t[1]&&i[2]===t[2]&&i[3]===t[3]&&i[4]===t[4]&&i[5]===t[5]&&i[6]===t[6]&&i[7]===t[7]&&i[8]===t[8]&&i[9]===t[9]&&i[10]===t[10]&&i[11]===t[11]&&i[12]===t[12]&&i[13]===t[13]&&i[14]===t[14]&&i[15]===t[15]},I.aa=function(i){let t={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((r,s,l,u)=>{let d=l||u;return t[s]=!d||d.toLowerCase(),""})),t["max-age"]){let r=parseInt(t["max-age"],10);isNaN(r)?delete t["max-age"]:t["max-age"]=r}return t},I.ab=function(i,t){let r=[];for(let s in i)s in t||r.push(s);return r},I.ac=Je,I.ad=function(i,t,r){var s=Math.sin(r),l=Math.cos(r),u=t[0],d=t[1],f=t[2],g=t[3],x=t[4],v=t[5],w=t[6],C=t[7];return t!==i&&(i[8]=t[8],i[9]=t[9],i[10]=t[10],i[11]=t[11],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15]),i[0]=u*l+x*s,i[1]=d*l+v*s,i[2]=f*l+w*s,i[3]=g*l+C*s,i[4]=x*l-u*s,i[5]=v*l-d*s,i[6]=w*l-f*s,i[7]=C*l-g*s,i},I.ae=function(i){var t=new Co(16);return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],t},I.af=Ol,I.ag=function(i,t){let r=0,s=0;if(i.kind==="constant")s=i.layoutSize;else if(i.kind!=="source"){let{interpolationType:l,minZoom:u,maxZoom:d}=i,f=l?Je(Pi.interpolationFactor(l,t,u,d),0,1):0;i.kind==="camera"?s=Ci.number(i.minSize,i.maxSize,f):r=f}return{uSizeT:r,uSize:s}},I.ai=function(i,{uSize:t,uSizeT:r},{lowerSize:s,upperSize:l}){return i.kind==="source"?s/Wr:i.kind==="composite"?Ci.number(s/Wr,l/Wr,r):t},I.aj=ah,I.ak=function(i,t,r,s){let l=t.y-i.y,u=t.x-i.x,d=s.y-r.y,f=s.x-r.x,g=d*u-f*l;if(g===0)return null;let x=(f*(i.y-r.y)-d*(i.x-r.x))/g;return new pe(i.x+x*u,i.y+x*l)},I.al=sd,I.am=Hh,I.an=jc,I.ao=function(i){let t=1/0,r=1/0,s=-1/0,l=-1/0;for(let u of i)t=Math.min(t,u.x),r=Math.min(r,u.y),s=Math.max(s,u.x),l=Math.max(l,u.y);return[t,r,s,l]},I.ap=ei,I.ar=oh,I.as=function(i,t){var r=t[0],s=t[1],l=t[2],u=t[3],d=t[4],f=t[5],g=t[6],x=t[7],v=t[8],w=t[9],C=t[10],A=t[11],k=t[12],z=t[13],O=t[14],j=t[15],ie=r*f-s*d,H=r*g-l*d,ee=r*x-u*d,ae=s*g-l*f,fe=s*x-u*f,Me=l*x-u*g,Ue=v*z-w*k,Ie=v*O-C*k,we=v*j-A*k,Fe=w*O-C*z,Le=w*j-A*z,Ee=C*j-A*O,he=ie*Ee-H*Le+ee*Fe+ae*we-fe*Ie+Me*Ue;return he?(i[0]=(f*Ee-g*Le+x*Fe)*(he=1/he),i[1]=(l*Le-s*Ee-u*Fe)*he,i[2]=(z*Me-O*fe+j*ae)*he,i[3]=(C*fe-w*Me-A*ae)*he,i[4]=(g*we-d*Ee-x*Ie)*he,i[5]=(r*Ee-l*we+u*Ie)*he,i[6]=(O*ee-k*Me-j*H)*he,i[7]=(v*Me-C*ee+A*H)*he,i[8]=(d*Le-f*we+x*Ue)*he,i[9]=(s*we-r*Le-u*Ue)*he,i[10]=(k*fe-z*ee+j*ie)*he,i[11]=(w*ee-v*fe-A*ie)*he,i[12]=(f*Ie-d*Fe-g*Ue)*he,i[13]=(r*Fe-s*Ie+l*Ue)*he,i[14]=(z*H-k*ae-O*ie)*he,i[15]=(v*ae-w*H+C*ie)*he,i):null},I.at=mh,I.au=sh,I.av=gh,I.aw=function(){let i={},t=oe.$version;for(let r in oe.$root){let s=oe.$root[r];if(s.required){let l=null;l=r==="version"?t:s.type==="array"?[]:{},l!=null&&(i[r]=l)}}return i},I.ax=wa,I.ay=ir,I.az=function(i){i=i.slice();let t=Object.create(null);for(let r=0;r<i.length;r++)t[i[r].id]=i[r];for(let r=0;r<i.length;r++)"ref"in i[r]&&(i[r]=cs(i[r],t[i[r].ref]));return i},I.b=qt,I.b0=function(i,t){return i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[4]=t[4],i[5]=t[5],i[6]=t[6],i[7]=t[7],i[8]=t[8],i[9]=t[9],i[10]=t[10],i[11]=t[11],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15],i},I.b1=function(i,t,r){return i[0]=t[0]*r[0],i[1]=t[1]*r[1],i[2]=t[2]*r[2],i[3]=t[3]*r[3],i},I.b2=function(i,t){return i[0]*t[0]+i[1]*t[1]+i[2]*t[2]+i[3]*t[3]},I.b3=Pt,I.b4=Yu,I.b5=Ku,I.b6=function(i,t,r,s,l){var u,d=1/Math.tan(t/2);return i[0]=d/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=d,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,l!=null&&l!==1/0?(i[10]=(l+s)*(u=1/(s-l)),i[14]=2*l*s*u):(i[10]=-1,i[14]=-2*s),i},I.b7=function(i,t,r){var s=Math.sin(r),l=Math.cos(r),u=t[4],d=t[5],f=t[6],g=t[7],x=t[8],v=t[9],w=t[10],C=t[11];return t!==i&&(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15]),i[4]=u*l+x*s,i[5]=d*l+v*s,i[6]=f*l+w*s,i[7]=g*l+C*s,i[8]=x*l-u*s,i[9]=v*l-d*s,i[10]=w*l-f*s,i[11]=C*l-g*s,i},I.b8=et,I.b9=He,I.bA=Tu,I.bB=function(i){return i.message===tr},I.bC=Dn,I.bD=Ni,I.ba=function(i){return i*Math.PI/180},I.bb=function(i,t){let{x:r,y:s}=ja.fromLngLat(t);return!(i<0||i>25||s<0||s>=1||r<0||r>=1)},I.bc=function(i,t){return i[0]=t[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=t[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=t[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},I.bd=class extends b{},I.be=uh,I.bf=Of,I.bh=Di,I.bi=function(i,t){Or.REGISTERED_PROTOCOLS[i]=t},I.bj=function(i){delete Or.REGISTERED_PROTOCOLS[i]},I.bk=function(i,t){let r={};for(let l=0;l<i.length;l++){let u=t&&t[i[l].id]||wl(i[l]);t&&(t[i[l].id]=u);let d=r[u];d||(d=r[u]=[]),d.push(i[l])}let s=[];for(let l in r)s.push(r[l]);return s},I.bl=ke,I.bm=ed,I.bn=id,I.bo=Lu,I.bp=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=Kt/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;let t=i.bucket.layers[0],r=t.layout,s=t._unevaluatedLayout._values,l={layoutIconSize:s["icon-size"].possiblyEvaluate(new At(i.bucket.zoom+1),i.canonical),layoutTextSize:s["text-size"].possiblyEvaluate(new At(i.bucket.zoom+1),i.canonical),textMaxSize:s["text-size"].possiblyEvaluate(new At(18))};if(i.bucket.textSizeData.kind==="composite"){let{minZoom:x,maxZoom:v}=i.bucket.textSizeData;l.compositeTextSizes=[s["text-size"].possiblyEvaluate(new At(x),i.canonical),s["text-size"].possiblyEvaluate(new At(v),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){let{minZoom:x,maxZoom:v}=i.bucket.iconSizeData;l.compositeIconSizes=[s["icon-size"].possiblyEvaluate(new At(x),i.canonical),s["icon-size"].possiblyEvaluate(new At(v),i.canonical)]}let u=r.get("text-line-height")*ei,d=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",f=r.get("text-keep-upright"),g=r.get("text-size");for(let x of i.bucket.features){let v=r.get("text-font").evaluate(x,{},i.canonical).join(","),w=g.evaluate(x,{},i.canonical),C=l.layoutTextSize.evaluate(x,{},i.canonical),A=l.layoutIconSize.evaluate(x,{},i.canonical),k={horizontal:{},vertical:void 0},z=x.text,O,j=[0,0];if(z){let ee=z.toString(),ae=r.get("text-letter-spacing").evaluate(x,{},i.canonical)*ei,fe=kc(ee)?ae:0,Me=r.get("text-anchor").evaluate(x,{},i.canonical),Ue=fd(t,x,i.canonical);if(!Ue){let Le=r.get("text-radial-offset").evaluate(x,{},i.canonical);j=Le?pd(Me,[Le*ei,fh]):r.get("text-offset").evaluate(x,{},i.canonical).map((Ee=>Ee*ei))}let Ie=d?"center":r.get("text-justify").evaluate(x,{},i.canonical),we=r.get("symbol-placement")==="point"?r.get("text-max-width").evaluate(x,{},i.canonical)*ei:1/0,Fe=()=>{i.bucket.allowVerticalPlacement&&Sa(ee)&&(k.vertical=ql(z,i.glyphMap,i.glyphPositions,i.imagePositions,v,we,u,Me,"left",fe,j,I.ah.vertical,!0,C,w))};if(!d&&Ue){let Le=new Set;if(Ie==="auto")for(let he=0;he<Ue.values.length;he+=2)Le.add(mh(Ue.values[he]));else Le.add(Ie);let Ee=!1;for(let he of Le)if(!k.horizontal[he])if(Ee)k.horizontal[he]=k.horizontal[0];else{let Oe=ql(z,i.glyphMap,i.glyphPositions,i.imagePositions,v,we,u,"center",he,fe,j,I.ah.horizontal,!1,C,w);Oe&&(k.horizontal[he]=Oe,Ee=Oe.positionedLines.length===1)}Fe()}else{Ie==="auto"&&(Ie=mh(Me));let Le=ql(z,i.glyphMap,i.glyphPositions,i.imagePositions,v,we,u,Me,Ie,fe,j,I.ah.horizontal,!1,C,w);Le&&(k.horizontal[Ie]=Le),Fe(),Sa(ee)&&d&&f&&(k.vertical=ql(z,i.glyphMap,i.glyphPositions,i.imagePositions,v,we,u,Me,Ie,fe,j,I.ah.vertical,!1,C,w))}}let ie=!1;if(x.icon&&x.icon.name){let ee=i.imageMap[x.icon.name];ee&&(O=vf(i.imagePositions[x.icon.name],r.get("icon-offset").evaluate(x,{},i.canonical),r.get("icon-anchor").evaluate(x,{},i.canonical)),ie=!!ee.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=ie:i.bucket.sdfIcons!==ie&&ze("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(ee.pixelRatio!==i.bucket.pixelRatio||r.get("icon-rotate").constantOr(1)!==0)&&(i.bucket.iconsNeedLinear=!0))}let H=gd(k.horizontal)||k.vertical;i.bucket.iconsInText=!!H&&H.iconsInText,(H||O)&&Bf(i.bucket,x,k,O,i.imageMap,l,C,A,j,ie,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},I.bq=Qc,I.br=Kc,I.bs=Yc,I.bt=Jn,I.bu=th,I.bv=class{constructor(i){this._marks={start:[i.url,"start"].join("#"),end:[i.url,"end"].join("#"),measure:i.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let i=performance.getEntriesByName(this._marks.measure);return i.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),i=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),i}},I.bw=function(i,t,r,s,l){return p(this,void 0,void 0,(function*(){if($i())try{return yield er(i,t,r,s,l)}catch{}return(function(u,d,f,g,x){let v=u.width,w=u.height;ci&&Zt||(ci=new OffscreenCanvas(v,w),Zt=ci.getContext("2d",{willReadFrequently:!0})),ci.width=v,ci.height=w,Zt.drawImage(u,0,0,v,w);let C=Zt.getImageData(d,f,g,x);return Zt.clearRect(0,0,v,w),C.data})(i,t,r,s,l)}))},I.bx=Qu,I.by=Se,I.bz=Ce,I.c=xn,I.d=i=>p(void 0,void 0,void 0,(function*(){if(i.byteLength===0)return createImageBitmap(new ImageData(1,1));let t=new Blob([new Uint8Array(i)],{type:"image/png"});try{return createImageBitmap(t)}catch(r){throw new Error(`Could not load image because of ${r.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})),I.e=Mt,I.f=i=>new Promise(((t,r)=>{let s=new Image;s.onload=()=>{t(s),URL.revokeObjectURL(s.src),s.onload=null,window.requestAnimationFrame((()=>{s.src=Qi}))},s.onerror=()=>r(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));let l=new Blob([new Uint8Array(i)],{type:"image/png"});s.src=i.byteLength?URL.createObjectURL(l):Qi})),I.g=yr,I.h=(i,t)=>Yr(Mt(i,{type:"json"}),t),I.i=st,I.j=Vr,I.k=Nr,I.l=(i,t)=>Yr(Mt(i,{type:"arrayBuffer"}),t),I.m=Yr,I.n=function(i){return new th(i).readFields(pf,[])},I.o=za,I.p=zu,I.q=h,I.r=Ac,I.s=Qr,I.t=va,I.u=pn,I.v=oe,I.w=ze,I.x=function([i,t,r]){return t+=90,t*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(t)*Math.sin(r),y:i*Math.sin(t)*Math.sin(r),z:i*Math.cos(r)}},I.y=Ci,I.z=At})),re("worker",["./shared"],(function(I){"use strict";class p{constructor(M){this.keyCache={},M&&this.replace(M)}replace(M){this._layerConfigs={},this._layers={},this.update(M,[])}update(M,P){for(let N of M){this._layerConfigs[N.id]=N;let W=this._layers[N.id]=I.aA(N);W._featureFilter=I.a7(W.filter),this.keyCache[N.id]&&delete this.keyCache[N.id]}for(let N of P)delete this.keyCache[N],delete this._layerConfigs[N],delete this._layers[N];this.familiesBySource={};let D=I.bk(Object.values(this._layerConfigs),this.keyCache);for(let N of D){let W=N.map((se=>this._layers[se.id])),Y=W[0];if(Y.visibility==="none")continue;let te=Y.source||"",Z=this.familiesBySource[te];Z||(Z=this.familiesBySource[te]={});let le=Y.sourceLayer||"_geojsonTileLayer",de=Z[le];de||(de=Z[le]=[]),de.push(W)}}}class Se{constructor(M){let P={},D=[];for(let te in M){let Z=M[te],le=P[te]={};for(let de in Z){let se=Z[+de];if(!se||se.bitmap.width===0||se.bitmap.height===0)continue;let _e={x:0,y:0,w:se.bitmap.width+2,h:se.bitmap.height+2};D.push(_e),le[de]={rect:_e,metrics:se.metrics}}}let{w:N,h:W}=I.p(D),Y=new I.o({width:N||1,height:W||1});for(let te in M){let Z=M[te];for(let le in Z){let de=Z[+le];if(!de||de.bitmap.width===0||de.bitmap.height===0)continue;let se=P[te][le].rect;I.o.copy(de.bitmap,Y,{x:0,y:0},{x:se.x+1,y:se.y+1},de.bitmap)}}this.image=Y,this.positions=P}}I.bl("GlyphAtlas",Se);class Ce{constructor(M){this.tileID=new I.S(M.tileID.overscaledZ,M.tileID.wrap,M.tileID.canonical.z,M.tileID.canonical.x,M.tileID.canonical.y),this.uid=M.uid,this.zoom=M.zoom,this.pixelRatio=M.pixelRatio,this.tileSize=M.tileSize,this.source=M.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=M.showCollisionBoxes,this.collectResourceTiming=!!M.collectResourceTiming,this.returnDependencies=!!M.returnDependencies,this.promoteId=M.promoteId,this.inFlightDependencies=[]}parse(M,P,D,N){return I._(this,void 0,void 0,(function*(){this.status="parsing",this.data=M,this.collisionBoxArray=new I.a5;let W=new I.bm(Object.keys(M.layers).sort()),Y=new I.bn(this.tileID,this.promoteId);Y.bucketLayerIDs=[];let te={},Z={featureIndex:Y,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:D},le=P.familiesBySource[this.source];for(let rt in le){let xt=M.layers[rt];if(!xt)continue;xt.version===1&&I.w(`Vector tile source "${this.source}" layer "${rt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let Rt=W.encode(rt),ti=[];for(let si=0;si<xt.length;si++){let vi=xt.feature(si),Sn=Y.getId(vi,rt);ti.push({feature:vi,id:Sn,index:si,sourceLayerIndex:Rt})}for(let si of le[rt]){let vi=si[0];vi.source!==this.source&&I.w(`layer.source = ${vi.source} does not equal this.source = ${this.source}`),vi.minzoom&&this.zoom<Math.floor(vi.minzoom)||vi.maxzoom&&this.zoom>=vi.maxzoom||vi.visibility!=="none"&&($e(si,this.zoom,D),(te[vi.id]=vi.createBucket({index:Y.bucketLayerIDs.length,layers:si,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Rt,sourceID:this.source})).populate(ti,Z,this.tileID.canonical),Y.bucketLayerIDs.push(si.map((Sn=>Sn.id))))}}let de=I.aF(Z.glyphDependencies,(rt=>Object.keys(rt).map(Number)));this.inFlightDependencies.forEach((rt=>rt?.abort())),this.inFlightDependencies=[];let se=Promise.resolve({});if(Object.keys(de).length){let rt=new AbortController;this.inFlightDependencies.push(rt),se=N.sendAsync({type:"GG",data:{stacks:de,source:this.source,tileID:this.tileID,type:"glyphs"}},rt)}let _e=Object.keys(Z.iconDependencies),Ne=Promise.resolve({});if(_e.length){let rt=new AbortController;this.inFlightDependencies.push(rt),Ne=N.sendAsync({type:"GI",data:{icons:_e,source:this.source,tileID:this.tileID,type:"icons"}},rt)}let Ve=Object.keys(Z.patternDependencies),ut=Promise.resolve({});if(Ve.length){let rt=new AbortController;this.inFlightDependencies.push(rt),ut=N.sendAsync({type:"GI",data:{icons:Ve,source:this.source,tileID:this.tileID,type:"patterns"}},rt)}let[Ke,dt,ot]=yield Promise.all([se,Ne,ut]),Wt=new Se(Ke),Ft=new I.bo(dt,ot);for(let rt in te){let xt=te[rt];xt instanceof I.a6?($e(xt.layers,this.zoom,D),I.bp({bucket:xt,glyphMap:Ke,glyphPositions:Wt.positions,imageMap:dt,imagePositions:Ft.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):xt.hasPattern&&(xt instanceof I.bq||xt instanceof I.br||xt instanceof I.bs)&&($e(xt.layers,this.zoom,D),xt.addFeatures(Z,this.tileID.canonical,Ft.patternPositions))}return this.status="done",{buckets:Object.values(te).filter((rt=>!rt.isEmpty())),featureIndex:Y,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Wt.image,imageAtlas:Ft,glyphMap:this.returnDependencies?Ke:null,iconMap:this.returnDependencies?dt:null,glyphPositions:this.returnDependencies?Wt.positions:null}}))}}function $e(U,M,P){let D=new I.z(M);for(let N of U)N.recalculate(D,P)}class pe{constructor(M,P,D){this.actor=M,this.layerIndex=P,this.availableImages=D,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(M,P){return I._(this,void 0,void 0,(function*(){let D=yield I.l(M.request,P);try{return{vectorTile:new I.bt.VectorTile(new I.bu(D.data)),rawData:D.data,cacheControl:D.cacheControl,expires:D.expires}}catch(N){let W=new Uint8Array(D.data),Y=`Unable to parse the tile at ${M.request.url}, `;throw Y+=W[0]===31&&W[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${N.message}`,new Error(Y)}}))}loadTile(M){return I._(this,void 0,void 0,(function*(){let P=M.uid,D=!!(M&&M.request&&M.request.collectResourceTiming)&&new I.bv(M.request),N=new Ce(M);this.loading[P]=N;let W=new AbortController;N.abort=W;try{let Y=yield this.loadVectorTile(M,W);if(delete this.loading[P],!Y)return null;let te=Y.rawData,Z={};Y.expires&&(Z.expires=Y.expires),Y.cacheControl&&(Z.cacheControl=Y.cacheControl);let le={};if(D){let se=D.finish();se&&(le.resourceTiming=JSON.parse(JSON.stringify(se)))}N.vectorTile=Y.vectorTile;let de=N.parse(Y.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[P]=N,this.fetching[P]={rawTileData:te,cacheControl:Z,resourceTiming:le};try{let se=yield de;return I.e({rawTileData:te.slice(0)},se,Z,le)}finally{delete this.fetching[P]}}catch(Y){throw delete this.loading[P],N.status="done",this.loaded[P]=N,Y}}))}reloadTile(M){return I._(this,void 0,void 0,(function*(){let P=M.uid;if(!this.loaded||!this.loaded[P])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");let D=this.loaded[P];if(D.showCollisionBoxes=M.showCollisionBoxes,D.status==="parsing"){let N=yield D.parse(D.vectorTile,this.layerIndex,this.availableImages,this.actor),W;if(this.fetching[P]){let{rawTileData:Y,cacheControl:te,resourceTiming:Z}=this.fetching[P];delete this.fetching[P],W=I.e({rawTileData:Y.slice(0)},N,te,Z)}else W=N;return W}if(D.status==="done"&&D.vectorTile)return D.parse(D.vectorTile,this.layerIndex,this.availableImages,this.actor)}))}abortTile(M){return I._(this,void 0,void 0,(function*(){let P=this.loading,D=M.uid;P&&P[D]&&P[D].abort&&(P[D].abort.abort(),delete P[D])}))}removeTile(M){return I._(this,void 0,void 0,(function*(){this.loaded&&this.loaded[M.uid]&&delete this.loaded[M.uid]}))}}class K{constructor(){this.loaded={}}loadTile(M){return I._(this,void 0,void 0,(function*(){let{uid:P,encoding:D,rawImageData:N,redFactor:W,greenFactor:Y,blueFactor:te,baseShift:Z}=M,le=N.width+2,de=N.height+2,se=I.b(N)?new I.R({width:le,height:de},yield I.bw(N,-1,-1,le,de)):N,_e=new I.bx(P,se,D,W,Y,te,Z);return this.loaded=this.loaded||{},this.loaded[P]=_e,_e}))}removeTile(M){let P=this.loaded,D=M.uid;P&&P[D]&&delete P[D]}}function ht(U,M){if(U.length!==0){Dt(U[0],M);for(var P=1;P<U.length;P++)Dt(U[P],!M)}}function Dt(U,M){for(var P=0,D=0,N=0,W=U.length,Y=W-1;N<W;Y=N++){var te=(U[N][0]-U[Y][0])*(U[Y][1]+U[N][1]),Z=P+te;D+=Math.abs(P)>=Math.abs(te)?P-Z+te:te-Z+P,P=Z}P+D>=0!=!!M&&U.reverse()}var Nt=I.by((function U(M,P){var D,N=M&&M.type;if(N==="FeatureCollection")for(D=0;D<M.features.length;D++)U(M.features[D],P);else if(N==="GeometryCollection")for(D=0;D<M.geometries.length;D++)U(M.geometries[D],P);else if(N==="Feature")U(M.geometry,P);else if(N==="Polygon")ht(M.coordinates,P);else if(N==="MultiPolygon")for(D=0;D<M.coordinates.length;D++)ht(M.coordinates[D],P);return M}));let Jt=I.bt.VectorTileFeature.prototype.toGeoJSON;var li={exports:{}},$i=I.bz,et=I.bt.VectorTileFeature,He=Je;function Je(U,M){this.options=M||{},this.features=U,this.length=U.length}function Pt(U,M){this.id=typeof U.id=="number"?U.id:void 0,this.type=U.type,this.rawGeometry=U.type===1?[U.geometry]:U.geometry,this.properties=U.tags,this.extent=M||4096}Je.prototype.feature=function(U){return new Pt(this.features[U],this.options.extent)},Pt.prototype.loadGeometry=function(){var U=this.rawGeometry;this.geometry=[];for(var M=0;M<U.length;M++){for(var P=U[M],D=[],N=0;N<P.length;N++)D.push(new $i(P[N][0],P[N][1]));this.geometry.push(D)}return this.geometry},Pt.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var U=this.geometry,M=1/0,P=-1/0,D=1/0,N=-1/0,W=0;W<U.length;W++)for(var Y=U[W],te=0;te<Y.length;te++){var Z=Y[te];M=Math.min(M,Z.x),P=Math.max(P,Z.x),D=Math.min(D,Z.y),N=Math.max(N,Z.y)}return[M,D,P,N]},Pt.prototype.toGeoJSON=et.prototype.toGeoJSON;var Mt=I.bA,Vt=He;function _t(U){var M=new Mt;return(function(P,D){for(var N in P.layers)D.writeMessage(3,yi,P.layers[N])})(U,M),M.finish()}function yi(U,M){var P;M.writeVarintField(15,U.version||1),M.writeStringField(1,U.name||""),M.writeVarintField(5,U.extent||4096);var D={keys:[],values:[],keycache:{},valuecache:{}};for(P=0;P<U.length;P++)D.feature=U.feature(P),M.writeMessage(2,Ye,D);var N=D.keys;for(P=0;P<N.length;P++)M.writeStringField(3,N[P]);var W=D.values;for(P=0;P<W.length;P++)M.writeMessage(4,Qt,W[P])}function Ye(U,M){var P=U.feature;P.id!==void 0&&M.writeVarintField(1,P.id),M.writeMessage(2,Yt,U),M.writeVarintField(3,P.type),M.writeMessage(4,st,P)}function Yt(U,M){var P=U.feature,D=U.keys,N=U.values,W=U.keycache,Y=U.valuecache;for(var te in P.properties){var Z=P.properties[te],le=W[te];if(Z!==null){le===void 0&&(D.push(te),W[te]=le=D.length-1),M.writeVarint(le);var de=typeof Z;de!=="string"&&de!=="boolean"&&de!=="number"&&(Z=JSON.stringify(Z));var se=de+":"+Z,_e=Y[se];_e===void 0&&(N.push(Z),Y[se]=_e=N.length-1),M.writeVarint(_e)}}}function ze(U,M){return(M<<3)+(7&U)}function tt(U){return U<<1^U>>31}function st(U,M){for(var P=U.loadGeometry(),D=U.type,N=0,W=0,Y=P.length,te=0;te<Y;te++){var Z=P[te],le=1;D===1&&(le=Z.length),M.writeVarint(ze(1,le));for(var de=D===3?Z.length-1:Z.length,se=0;se<de;se++){se===1&&D!==1&&M.writeVarint(ze(2,de-1));var _e=Z[se].x-N,Ne=Z[se].y-W;M.writeVarint(tt(_e)),M.writeVarint(tt(Ne)),N+=_e,W+=Ne}D===3&&M.writeVarint(ze(7,1))}}function Qt(U,M){var P=typeof U;P==="string"?M.writeStringField(1,U):P==="boolean"?M.writeBooleanField(7,U):P==="number"&&(U%1!=0?M.writeDoubleField(3,U):U<0?M.writeSVarintField(6,U):M.writeVarintField(5,U))}li.exports=_t,li.exports.fromVectorTileJs=_t,li.exports.fromGeojsonVt=function(U,M){M=M||{};var P={};for(var D in U)P[D]=new Vt(U[D].features,M),P[D].name=D,P[D].version=M.version,P[D].extent=M.extent;return _t({layers:P})},li.exports.GeoJSONWrapper=Vt;var qt=I.by(li.exports);let Qi={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:U=>U},er=Math.fround||(ci=new Float32Array(1),U=>(ci[0]=+U,ci[0]));var ci;let Zt=3,tr=5,xn=6;class Or{constructor(M){this.options=Object.assign(Object.create(Qi),M),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(M){let{log:P,minZoom:D,maxZoom:N}=this.options;P&&console.time("total time");let W=`prepare ${M.length} points`;P&&console.time(W),this.points=M;let Y=[];for(let Z=0;Z<M.length;Z++){let le=M[Z];if(!le.geometry)continue;let[de,se]=le.geometry.coordinates,_e=er(Di(de)),Ne=er(ir(se));Y.push(_e,Ne,1/0,Z,-1,1),this.options.reduce&&Y.push(0)}let te=this.trees[N+1]=this._createTree(Y);P&&console.timeEnd(W);for(let Z=N;Z>=D;Z--){let le=+Date.now();te=this.trees[Z]=this._createTree(this._cluster(te,Z)),P&&console.log("z%d: %d clusters in %dms",Z,te.numItems,+Date.now()-le)}return P&&console.timeEnd("total time"),this}getClusters(M,P){let D=((M[0]+180)%360+360)%360-180,N=Math.max(-90,Math.min(90,M[1])),W=M[2]===180?180:((M[2]+180)%360+360)%360-180,Y=Math.max(-90,Math.min(90,M[3]));if(M[2]-M[0]>=360)D=-180,W=180;else if(D>W){let se=this.getClusters([D,N,180,Y],P),_e=this.getClusters([-180,N,W,Y],P);return se.concat(_e)}let te=this.trees[this._limitZoom(P)],Z=te.range(Di(D),ir(Y),Di(W),ir(N)),le=te.data,de=[];for(let se of Z){let _e=this.stride*se;de.push(le[_e+tr]>1?yr(le,_e,this.clusterProps):this.points[le[_e+Zt]])}return de}getChildren(M){let P=this._getOriginId(M),D=this._getOriginZoom(M),N="No cluster with the specified id.",W=this.trees[D];if(!W)throw new Error(N);let Y=W.data;if(P*this.stride>=Y.length)throw new Error(N);let te=this.options.radius/(this.options.extent*Math.pow(2,D-1)),Z=W.within(Y[P*this.stride],Y[P*this.stride+1],te),le=[];for(let de of Z){let se=de*this.stride;Y[se+4]===M&&le.push(Y[se+tr]>1?yr(Y,se,this.clusterProps):this.points[Y[se+Zt]])}if(le.length===0)throw new Error(N);return le}getLeaves(M,P,D){let N=[];return this._appendLeaves(N,M,P=P||10,D=D||0,0),N}getTile(M,P,D){let N=this.trees[this._limitZoom(M)],W=Math.pow(2,M),{extent:Y,radius:te}=this.options,Z=te/Y,le=(D-Z)/W,de=(D+1+Z)/W,se={features:[]};return this._addTileFeatures(N.range((P-Z)/W,le,(P+1+Z)/W,de),N.data,P,D,W,se),P===0&&this._addTileFeatures(N.range(1-Z/W,le,1,de),N.data,W,D,W,se),P===W-1&&this._addTileFeatures(N.range(0,le,Z/W,de),N.data,-1,D,W,se),se.features.length?se:null}getClusterExpansionZoom(M){let P=this._getOriginZoom(M)-1;for(;P<=this.options.maxZoom;){let D=this.getChildren(M);if(P++,D.length!==1)break;M=D[0].properties.cluster_id}return P}_appendLeaves(M,P,D,N,W){let Y=this.getChildren(P);for(let te of Y){let Z=te.properties;if(Z&&Z.cluster?W+Z.point_count<=N?W+=Z.point_count:W=this._appendLeaves(M,Z.cluster_id,D,N,W):W<N?W++:M.push(te),M.length===D)break}return W}_createTree(M){let P=new I.av(M.length/this.stride|0,this.options.nodeSize,Float32Array);for(let D=0;D<M.length;D+=this.stride)P.add(M[D],M[D+1]);return P.finish(),P.data=M,P}_addTileFeatures(M,P,D,N,W,Y){for(let te of M){let Z=te*this.stride,le=P[Z+tr]>1,de,se,_e;if(le)de=vn(P,Z,this.clusterProps),se=P[Z],_e=P[Z+1];else{let ut=this.points[P[Z+Zt]];de=ut.properties;let[Ke,dt]=ut.geometry.coordinates;se=Di(Ke),_e=ir(dt)}let Ne={type:1,geometry:[[Math.round(this.options.extent*(se*W-D)),Math.round(this.options.extent*(_e*W-N))]],tags:de},Ve;Ve=le||this.options.generateId?P[Z+Zt]:this.points[P[Z+Zt]].id,Ve!==void 0&&(Ne.id=Ve),Y.features.push(Ne)}}_limitZoom(M){return Math.max(this.options.minZoom,Math.min(Math.floor(+M),this.options.maxZoom+1))}_cluster(M,P){let{radius:D,extent:N,reduce:W,minPoints:Y}=this.options,te=D/(N*Math.pow(2,P)),Z=M.data,le=[],de=this.stride;for(let se=0;se<Z.length;se+=de){if(Z[se+2]<=P)continue;Z[se+2]=P;let _e=Z[se],Ne=Z[se+1],Ve=M.within(Z[se],Z[se+1],te),ut=Z[se+tr],Ke=ut;for(let dt of Ve){let ot=dt*de;Z[ot+2]>P&&(Ke+=Z[ot+tr])}if(Ke>ut&&Ke>=Y){let dt,ot=_e*ut,Wt=Ne*ut,Ft=-1,rt=((se/de|0)<<5)+(P+1)+this.points.length;for(let xt of Ve){let Rt=xt*de;if(Z[Rt+2]<=P)continue;Z[Rt+2]=P;let ti=Z[Rt+tr];ot+=Z[Rt]*ti,Wt+=Z[Rt+1]*ti,Z[Rt+4]=rt,W&&(dt||(dt=this._map(Z,se,!0),Ft=this.clusterProps.length,this.clusterProps.push(dt)),W(dt,this._map(Z,Rt)))}Z[se+4]=rt,le.push(ot/Ke,Wt/Ke,1/0,rt,-1,Ke),W&&le.push(Ft)}else{for(let dt=0;dt<de;dt++)le.push(Z[se+dt]);if(Ke>1)for(let dt of Ve){let ot=dt*de;if(!(Z[ot+2]<=P)){Z[ot+2]=P;for(let Wt=0;Wt<de;Wt++)le.push(Z[ot+Wt])}}}}return le}_getOriginId(M){return M-this.points.length>>5}_getOriginZoom(M){return(M-this.points.length)%32}_map(M,P,D){if(M[P+tr]>1){let Y=this.clusterProps[M[P+xn]];return D?Object.assign({},Y):Y}let N=this.points[M[P+Zt]].properties,W=this.options.map(N);return D&&W===N?Object.assign({},W):W}}function yr(U,M,P){return{type:"Feature",id:U[M+Zt],properties:vn(U,M,P),geometry:{type:"Point",coordinates:[(D=U[M],360*(D-.5)),Yr(U[M+1])]}};var D}function vn(U,M,P){let D=U[M+tr],N=D>=1e4?`${Math.round(D/1e3)}k`:D>=1e3?Math.round(D/100)/10+"k":D,W=U[M+xn],Y=W===-1?{}:Object.assign({},P[W]);return Object.assign(Y,{cluster:!0,cluster_id:U[M+Zt],point_count:D,point_count_abbreviated:N})}function Di(U){return U/360+.5}function ir(U){let M=Math.sin(U*Math.PI/180),P=.5-.25*Math.log((1+M)/(1-M))/Math.PI;return P<0?0:P>1?1:P}function Yr(U){let M=(180-360*U)*Math.PI/180;return 360*Math.atan(Math.exp(M))/Math.PI-90}function Qr(U,M,P,D){let N=D,W=M+(P-M>>1),Y,te=P-M,Z=U[M],le=U[M+1],de=U[P],se=U[P+1];for(let _e=M+3;_e<P;_e+=3){let Ne=ls(U[_e],U[_e+1],Z,le,de,se);if(Ne>N)Y=_e,N=Ne;else if(Ne===N){let Ve=Math.abs(_e-W);Ve<te&&(Y=_e,te=Ve)}}N>D&&(Y-M>3&&Qr(U,M,Y,D),U[Y+2]=N,P-Y>3&&Qr(U,Y,P,D))}function ls(U,M,P,D,N,W){let Y=N-P,te=W-D;if(Y!==0||te!==0){let Z=((U-P)*Y+(M-D)*te)/(Y*Y+te*te);Z>1?(P=N,D=W):Z>0&&(P+=Y*Z,D+=te*Z)}return Y=U-P,te=M-D,Y*Y+te*te}function Er(U,M,P,D){let N={id:U??null,type:M,geometry:P,tags:D,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(M==="Point"||M==="MultiPoint"||M==="LineString")Nr(N,P);else if(M==="Polygon")Nr(N,P[0]);else if(M==="MultiLineString")for(let W of P)Nr(N,W);else if(M==="MultiPolygon")for(let W of P)Nr(N,W[0]);return N}function Nr(U,M){for(let P=0;P<M.length;P+=3)U.minX=Math.min(U.minX,M[P]),U.minY=Math.min(U.minY,M[P+1]),U.maxX=Math.max(U.maxX,M[P]),U.maxY=Math.max(U.maxY,M[P+1])}function Vr(U,M,P,D){if(!M.geometry)return;let N=M.geometry.coordinates;if(N&&N.length===0)return;let W=M.geometry.type,Y=Math.pow(P.tolerance/((1<<P.maxZoom)*P.extent),2),te=[],Z=M.id;if(P.promoteId?Z=M.properties[P.promoteId]:P.generateId&&(Z=D||0),W==="Point")bn(N,te);else if(W==="MultiPoint")for(let le of N)bn(le,te);else if(W==="LineString")oe(N,te,Y,!1);else if(W==="MultiLineString"){if(P.lineMetrics){for(let le of N)te=[],oe(le,te,Y,!1),U.push(Er(Z,"LineString",te,M.properties));return}en(N,te,Y,!1)}else if(W==="Polygon")en(N,te,Y,!0);else{if(W!=="MultiPolygon"){if(W==="GeometryCollection"){for(let le of M.geometry.geometries)Vr(U,{id:Z,geometry:le,properties:M.properties},P,D);return}throw new Error("Input data is not a valid GeoJSON object.")}for(let le of N){let de=[];en(le,de,Y,!0),te.push(de)}}U.push(Er(Z,W,te,M.properties))}function bn(U,M){M.push(cs(U[0]),mt(U[1]),0)}function oe(U,M,P,D){let N,W,Y=0;for(let Z=0;Z<U.length;Z++){let le=cs(U[Z][0]),de=mt(U[Z][1]);M.push(le,de,0),Z>0&&(Y+=D?(N*de-le*W)/2:Math.sqrt(Math.pow(le-N,2)+Math.pow(de-W,2))),N=le,W=de}let te=M.length-3;M[2]=1,Qr(M,0,te,P),M[te+2]=1,M.size=Math.abs(Y),M.start=0,M.end=M.size}function en(U,M,P,D){for(let N=0;N<U.length;N++){let W=[];oe(U[N],W,P,D),M.push(W)}}function cs(U){return U/360+.5}function mt(U){let M=Math.sin(U*Math.PI/180),P=.5-.25*Math.log((1+M)/(1-M))/Math.PI;return P<0?0:P>1?1:P}function Bt(U,M,P,D,N,W,Y,te){if(D/=M,W>=(P/=M)&&Y<D)return U;if(Y<P||W>=D)return null;let Z=[];for(let le of U){let de=le.geometry,se=le.type,_e=N===0?le.minX:le.minY,Ne=N===0?le.maxX:le.maxY;if(_e>=P&&Ne<D){Z.push(le);continue}if(Ne<P||_e>=D)continue;let Ve=[];if(se==="Point"||se==="MultiPoint")hs(de,Ve,P,D,N);else if(se==="LineString")Ur(de,Ve,P,D,N,!1,te.lineMetrics);else if(se==="MultiLineString")wn(de,Ve,P,D,N,!1);else if(se==="Polygon")wn(de,Ve,P,D,N,!0);else if(se==="MultiPolygon")for(let ut of de){let Ke=[];wn(ut,Ke,P,D,N,!0),Ke.length&&Ve.push(Ke)}if(Ve.length){if(te.lineMetrics&&se==="LineString"){for(let ut of Ve)Z.push(Er(le.id,se,ut,le.tags));continue}se!=="LineString"&&se!=="MultiLineString"||(Ve.length===1?(se="LineString",Ve=Ve[0]):se="MultiLineString"),se!=="Point"&&se!=="MultiPoint"||(se=Ve.length===3?"Point":"MultiPoint"),Z.push(Er(le.id,se,Ve,le.tags))}}return Z.length?Z:null}function hs(U,M,P,D,N){for(let W=0;W<U.length;W+=3){let Y=U[W+N];Y>=P&&Y<=D&&qi(M,U[W],U[W+1],U[W+2])}}function Ur(U,M,P,D,N,W,Y){let te=kr(U),Z=N===0?us:ds,le,de,se=U.start;for(let Ke=0;Ke<U.length-3;Ke+=3){let dt=U[Ke],ot=U[Ke+1],Wt=U[Ke+2],Ft=U[Ke+3],rt=U[Ke+4],xt=N===0?dt:ot,Rt=N===0?Ft:rt,ti=!1;Y&&(le=Math.sqrt(Math.pow(dt-Ft,2)+Math.pow(ot-rt,2))),xt<P?Rt>P&&(de=Z(te,dt,ot,Ft,rt,P),Y&&(te.start=se+le*de)):xt>D?Rt<D&&(de=Z(te,dt,ot,Ft,rt,D),Y&&(te.start=se+le*de)):qi(te,dt,ot,Wt),Rt<P&&xt>=P&&(de=Z(te,dt,ot,Ft,rt,P),ti=!0),Rt>D&&xt<=D&&(de=Z(te,dt,ot,Ft,rt,D),ti=!0),!W&&ti&&(Y&&(te.end=se+le*de),M.push(te),te=kr(U)),Y&&(se+=le)}let _e=U.length-3,Ne=U[_e],Ve=U[_e+1],ut=N===0?Ne:Ve;ut>=P&&ut<=D&&qi(te,Ne,Ve,U[_e+2]),_e=te.length-3,W&&_e>=3&&(te[_e]!==te[0]||te[_e+1]!==te[1])&&qi(te,te[0],te[1],te[2]),te.length&&M.push(te)}function kr(U){let M=[];return M.size=U.size,M.start=U.start,M.end=U.end,M}function wn(U,M,P,D,N,W){for(let Y of U)Ur(Y,M,P,D,N,W,!1)}function qi(U,M,P,D){U.push(M,P,D)}function us(U,M,P,D,N,W){let Y=(W-M)/(D-M);return qi(U,W,P+(N-P)*Y,1),Y}function ds(U,M,P,D,N,W){let Y=(W-P)/(N-P);return qi(U,M+(D-M)*Y,W,1),Y}function ge(U,M){let P=[];for(let D=0;D<U.length;D++){let N=U[D],W=N.type,Y;if(W==="Point"||W==="MultiPoint"||W==="LineString")Y=xr(N.geometry,M);else if(W==="MultiLineString"||W==="Polygon"){Y=[];for(let te of N.geometry)Y.push(xr(te,M))}else if(W==="MultiPolygon"){Y=[];for(let te of N.geometry){let Z=[];for(let le of te)Z.push(xr(le,M));Y.push(Z)}}P.push(Er(N.id,W,Y,N.tags))}return P}function xr(U,M){let P=[];P.size=U.size,U.start!==void 0&&(P.start=U.start,P.end=U.end);for(let D=0;D<U.length;D+=3)P.push(U[D]+M,U[D+1],U[D+2]);return P}function xi(U,M){if(U.transformed)return U;let P=1<<U.z,D=U.x,N=U.y;for(let W of U.features){let Y=W.geometry,te=W.type;if(W.geometry=[],te===1)for(let Z=0;Z<Y.length;Z+=2)W.geometry.push(vr(Y[Z],Y[Z+1],M,P,D,N));else for(let Z=0;Z<Y.length;Z++){let le=[];for(let de=0;de<Y[Z].length;de+=2)le.push(vr(Y[Z][de],Y[Z][de+1],M,P,D,N));W.geometry.push(le)}}return U.transformed=!0,U}function vr(U,M,P,D,N,W){return[Math.round(P*(U*D-N)),Math.round(P*(M*D-W))]}function jr(U,M,P,D,N){let W=M===N.maxZoom?0:N.tolerance/((1<<M)*N.extent),Y={features:[],numPoints:0,numSimplified:0,numFeatures:U.length,source:null,x:P,y:D,z:M,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let te of U)ve(Y,te,W,N);return Y}function ve(U,M,P,D){let N=M.geometry,W=M.type,Y=[];if(U.minX=Math.min(U.minX,M.minX),U.minY=Math.min(U.minY,M.minY),U.maxX=Math.max(U.maxX,M.maxX),U.maxY=Math.max(U.maxY,M.maxY),W==="Point"||W==="MultiPoint")for(let te=0;te<N.length;te+=3)Y.push(N[te],N[te+1]),U.numPoints++,U.numSimplified++;else if(W==="LineString")it(Y,N,U,P,!1,!1);else if(W==="MultiLineString"||W==="Polygon")for(let te=0;te<N.length;te++)it(Y,N[te],U,P,W==="Polygon",te===0);else if(W==="MultiPolygon")for(let te=0;te<N.length;te++){let Z=N[te];for(let le=0;le<Z.length;le++)it(Y,Z[le],U,P,!0,le===0)}if(Y.length){let te=M.tags||null;if(W==="LineString"&&D.lineMetrics){te={};for(let le in M.tags)te[le]=M.tags[le];te.mapbox_clip_start=N.start/N.size,te.mapbox_clip_end=N.end/N.size}let Z={geometry:Y,type:W==="Polygon"||W==="MultiPolygon"?3:W==="LineString"||W==="MultiLineString"?2:1,tags:te};M.id!==null&&(Z.id=M.id),U.features.push(Z)}}function it(U,M,P,D,N,W){let Y=D*D;if(D>0&&M.size<(N?Y:D))return void(P.numPoints+=M.length/3);let te=[];for(let Z=0;Z<M.length;Z+=3)(D===0||M[Z+2]>Y)&&(P.numSimplified++,te.push(M[Z],M[Z+1])),P.numPoints++;N&&(function(Z,le){let de=0;for(let se=0,_e=Z.length,Ne=_e-2;se<_e;Ne=se,se+=2)de+=(Z[se]-Z[Ne])*(Z[se+1]+Z[Ne+1]);if(de>0===le)for(let se=0,_e=Z.length;se<_e/2;se+=2){let Ne=Z[se],Ve=Z[se+1];Z[se]=Z[_e-2-se],Z[se+1]=Z[_e-1-se],Z[_e-2-se]=Ne,Z[_e-1-se]=Ve}})(te,W),U.push(te)}let qe={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Ii{constructor(M,P){let D=(P=this.options=(function(W,Y){for(let te in Y)W[te]=Y[te];return W})(Object.create(qe),P)).debug;if(D&&console.time("preprocess data"),P.maxZoom<0||P.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(P.promoteId&&P.generateId)throw new Error("promoteId and generateId cannot be used together.");let N=(function(W,Y){let te=[];if(W.type==="FeatureCollection")for(let Z=0;Z<W.features.length;Z++)Vr(te,W.features[Z],Y,Z);else Vr(te,W.type==="Feature"?W:{geometry:W},Y);return te})(M,P);this.tiles={},this.tileCoords=[],D&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",P.indexMaxZoom,P.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),N=(function(W,Y){let te=Y.buffer/Y.extent,Z=W,le=Bt(W,1,-1-te,te,0,-1,2,Y),de=Bt(W,1,1-te,2+te,0,-1,2,Y);return(le||de)&&(Z=Bt(W,1,-te,1+te,0,-1,2,Y)||[],le&&(Z=ge(le,1).concat(Z)),de&&(Z=Z.concat(ge(de,-1)))),Z})(N,P),N.length&&this.splitTile(N,0,0,0),D&&(N.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(M,P,D,N,W,Y,te){let Z=[M,P,D,N],le=this.options,de=le.debug;for(;Z.length;){N=Z.pop(),D=Z.pop(),P=Z.pop(),M=Z.pop();let se=1<<P,_e=rr(P,D,N),Ne=this.tiles[_e];if(!Ne&&(de>1&&console.time("creation"),Ne=this.tiles[_e]=jr(M,P,D,N,le),this.tileCoords.push({z:P,x:D,y:N}),de)){de>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",P,D,N,Ne.numFeatures,Ne.numPoints,Ne.numSimplified),console.timeEnd("creation"));let ti=`z${P}`;this.stats[ti]=(this.stats[ti]||0)+1,this.total++}if(Ne.source=M,W==null){if(P===le.indexMaxZoom||Ne.numPoints<=le.indexMaxPoints)continue}else{if(P===le.maxZoom||P===W)continue;if(W!=null){let ti=W-P;if(D!==Y>>ti||N!==te>>ti)continue}}if(Ne.source=null,M.length===0)continue;de>1&&console.time("clipping");let Ve=.5*le.buffer/le.extent,ut=.5-Ve,Ke=.5+Ve,dt=1+Ve,ot=null,Wt=null,Ft=null,rt=null,xt=Bt(M,se,D-Ve,D+Ke,0,Ne.minX,Ne.maxX,le),Rt=Bt(M,se,D+ut,D+dt,0,Ne.minX,Ne.maxX,le);M=null,xt&&(ot=Bt(xt,se,N-Ve,N+Ke,1,Ne.minY,Ne.maxY,le),Wt=Bt(xt,se,N+ut,N+dt,1,Ne.minY,Ne.maxY,le),xt=null),Rt&&(Ft=Bt(Rt,se,N-Ve,N+Ke,1,Ne.minY,Ne.maxY,le),rt=Bt(Rt,se,N+ut,N+dt,1,Ne.minY,Ne.maxY,le),Rt=null),de>1&&console.timeEnd("clipping"),Z.push(ot||[],P+1,2*D,2*N),Z.push(Wt||[],P+1,2*D,2*N+1),Z.push(Ft||[],P+1,2*D+1,2*N),Z.push(rt||[],P+1,2*D+1,2*N+1)}}getTile(M,P,D){M=+M,P=+P,D=+D;let N=this.options,{extent:W,debug:Y}=N;if(M<0||M>24)return null;let te=1<<M,Z=rr(M,P=P+te&te-1,D);if(this.tiles[Z])return xi(this.tiles[Z],W);Y>1&&console.log("drilling down to z%d-%d-%d",M,P,D);let le,de=M,se=P,_e=D;for(;!le&&de>0;)de--,se>>=1,_e>>=1,le=this.tiles[rr(de,se,_e)];return le&&le.source?(Y>1&&(console.log("found parent tile z%d-%d-%d",de,se,_e),console.time("drilling down")),this.splitTile(le.source,de,se,_e,M,P,D),Y>1&&console.timeEnd("drilling down"),this.tiles[Z]?xi(this.tiles[Z],W):null):null}}function rr(U,M,P){return 32*((1<<U)*P+M)+U}function Xe(U,M){return M?U.properties[M]:U.id}function br(U,M){if(U==null)return!0;if(U.type==="Feature")return Xe(U,M)!=null;if(U.type==="FeatureCollection"){let P=new Set;for(let D of U.features){let N=Xe(D,M);if(N==null||P.has(N))return!1;P.add(N)}return!0}return!1}function zr(U,M){let P=new Map;if(U!=null)if(U.type==="Feature")P.set(Xe(U,M),U);else for(let D of U.features)P.set(Xe(D,M),D);return P}class $r extends pe{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(M,P){return I._(this,void 0,void 0,(function*(){let D=M.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");let N=this._geoJSONIndex.getTile(D.z,D.x,D.y);if(!N)return null;let W=new class{constructor(te){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=I.X,this.length=te.length,this._features=te}feature(te){return new class{constructor(Z){this._feature=Z,this.extent=I.X,this.type=Z.type,this.properties=Z.tags,"id"in Z&&!isNaN(Z.id)&&(this.id=parseInt(Z.id,10))}loadGeometry(){if(this._feature.type===1){let Z=[];for(let le of this._feature.geometry)Z.push([new I.P(le[0],le[1])]);return Z}{let Z=[];for(let le of this._feature.geometry){let de=[];for(let se of le)de.push(new I.P(se[0],se[1]));Z.push(de)}return Z}}toGeoJSON(Z,le,de){return Jt.call(this,Z,le,de)}}(this._features[te])}}(N.features),Y=qt(W);return Y.byteOffset===0&&Y.byteLength===Y.buffer.byteLength||(Y=new Uint8Array(Y)),{vectorTile:W,rawData:Y.buffer}}))}loadData(M){return I._(this,void 0,void 0,(function*(){var P;(P=this._pendingRequest)===null||P===void 0||P.abort();let D=!!(M&&M.request&&M.request.collectResourceTiming)&&new I.bv(M.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(M,this._pendingRequest),this._geoJSONIndex=M.cluster?new Or((function({superclusterOptions:Y,clusterProperties:te}){if(!te||!Y)return Y;let Z={},le={},de={accumulated:null,zoom:0},se={properties:null},_e=Object.keys(te);for(let Ne of _e){let[Ve,ut]=te[Ne],Ke=I.bC(ut),dt=I.bC(typeof Ve=="string"?[Ve,["accumulated"],["get",Ne]]:Ve);Z[Ne]=Ke.value,le[Ne]=dt.value}return Y.map=Ne=>{se.properties=Ne;let Ve={};for(let ut of _e)Ve[ut]=Z[ut].evaluate(de,se);return Ve},Y.reduce=(Ne,Ve)=>{se.properties=Ve;for(let ut of _e)de.accumulated=Ne[ut],Ne[ut]=le[ut].evaluate(de,se)},Y})(M)).load((yield this._pendingData).features):(N=yield this._pendingData,new Ii(N,M.geojsonVtOptions)),this.loaded={};let W={};if(D){let Y=D.finish();Y&&(W.resourceTiming={},W.resourceTiming[M.source]=JSON.parse(JSON.stringify(Y)))}return W}catch(W){if(delete this._pendingRequest,I.bB(W))return{abandoned:!0};throw W}var N}))}getData(){return I._(this,void 0,void 0,(function*(){return this._pendingData}))}reloadTile(M){let P=this.loaded;return P&&P[M.uid]?super.reloadTile(M):this.loadTile(M)}loadAndProcessGeoJSON(M,P){return I._(this,void 0,void 0,(function*(){let D=yield this.loadGeoJSON(M,P);if(delete this._pendingRequest,typeof D!="object")throw new Error(`Input data given to '${M.source}' is not a valid GeoJSON object.`);if(Nt(D,!0),M.filter){let N=I.bC(M.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(N.result==="error")throw new Error(N.value.map((Y=>`${Y.key}: ${Y.message}`)).join(", "));D={type:"FeatureCollection",features:D.features.filter((Y=>N.value.evaluate({zoom:0},Y)))}}return D}))}loadGeoJSON(M,P){return I._(this,void 0,void 0,(function*(){let{promoteId:D}=M;if(M.request){let N=yield I.h(M.request,P);return this._dataUpdateable=br(N.data,D)?zr(N.data,D):void 0,N.data}if(typeof M.data=="string")try{let N=JSON.parse(M.data);return this._dataUpdateable=br(N,D)?zr(N,D):void 0,N}catch{throw new Error(`Input data given to '${M.source}' is not a valid GeoJSON object.`)}if(!M.dataDiff)throw new Error(`Input data given to '${M.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${M.source}`);return(function(N,W,Y){var te,Z,le,de;if(W.removeAll&&N.clear(),W.remove)for(let se of W.remove)N.delete(se);if(W.add)for(let se of W.add){let _e=Xe(se,Y);_e!=null&&N.set(_e,se)}if(W.update)for(let se of W.update){let _e=N.get(se.id);if(_e==null)continue;let Ne=!se.removeAllProperties&&(((te=se.removeProperties)===null||te===void 0?void 0:te.length)>0||((Z=se.addOrUpdateProperties)===null||Z===void 0?void 0:Z.length)>0);if((se.newGeometry||se.removeAllProperties||Ne)&&(_e=Object.assign({},_e),N.set(se.id,_e),Ne&&(_e.properties=Object.assign({},_e.properties))),se.newGeometry&&(_e.geometry=se.newGeometry),se.removeAllProperties)_e.properties={};else if(((le=se.removeProperties)===null||le===void 0?void 0:le.length)>0)for(let Ve of se.removeProperties)Object.prototype.hasOwnProperty.call(_e.properties,Ve)&&delete _e.properties[Ve];if(((de=se.addOrUpdateProperties)===null||de===void 0?void 0:de.length)>0)for(let{key:Ve,value:ut}of se.addOrUpdateProperties)_e.properties[Ve]=ut}})(this._dataUpdateable,M.dataDiff,D),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}}))}removeSource(M){return I._(this,void 0,void 0,(function*(){this._pendingRequest&&this._pendingRequest.abort()}))}getClusterExpansionZoom(M){return this._geoJSONIndex.getClusterExpansionZoom(M.clusterId)}getClusterChildren(M){return this._geoJSONIndex.getChildren(M.clusterId)}getClusterLeaves(M){return this._geoJSONIndex.getLeaves(M.clusterId,M.limit,M.offset)}}class wr{constructor(M){this.self=M,this.actor=new I.F(M),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(P,D)=>{if(this.externalWorkerSourceTypes[P])throw new Error(`Worker source with name "${P}" already registered.`);this.externalWorkerSourceTypes[P]=D},this.self.addProtocol=I.bi,this.self.removeProtocol=I.bj,this.self.registerRTLTextPlugin=P=>{if(I.bD.isParsed())throw new Error("RTL text plugin already registered.");I.bD.setMethods(P)},this.actor.registerMessageHandler("LDT",((P,D)=>this._getDEMWorkerSource(P,D.source).loadTile(D))),this.actor.registerMessageHandler("RDT",((P,D)=>I._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(P,D.source).removeTile(D)})))),this.actor.registerMessageHandler("GCEZ",((P,D)=>I._(this,void 0,void 0,(function*(){return this._getWorkerSource(P,D.type,D.source).getClusterExpansionZoom(D)})))),this.actor.registerMessageHandler("GCC",((P,D)=>I._(this,void 0,void 0,(function*(){return this._getWorkerSource(P,D.type,D.source).getClusterChildren(D)})))),this.actor.registerMessageHandler("GCL",((P,D)=>I._(this,void 0,void 0,(function*(){return this._getWorkerSource(P,D.type,D.source).getClusterLeaves(D)})))),this.actor.registerMessageHandler("LD",((P,D)=>this._getWorkerSource(P,D.type,D.source).loadData(D))),this.actor.registerMessageHandler("GD",((P,D)=>this._getWorkerSource(P,D.type,D.source).getData())),this.actor.registerMessageHandler("LT",((P,D)=>this._getWorkerSource(P,D.type,D.source).loadTile(D))),this.actor.registerMessageHandler("RT",((P,D)=>this._getWorkerSource(P,D.type,D.source).reloadTile(D))),this.actor.registerMessageHandler("AT",((P,D)=>this._getWorkerSource(P,D.type,D.source).abortTile(D))),this.actor.registerMessageHandler("RMT",((P,D)=>this._getWorkerSource(P,D.type,D.source).removeTile(D))),this.actor.registerMessageHandler("RS",((P,D)=>I._(this,void 0,void 0,(function*(){if(!this.workerSources[P]||!this.workerSources[P][D.type]||!this.workerSources[P][D.type][D.source])return;let N=this.workerSources[P][D.type][D.source];delete this.workerSources[P][D.type][D.source],N.removeSource!==void 0&&N.removeSource(D)})))),this.actor.registerMessageHandler("RM",(P=>I._(this,void 0,void 0,(function*(){delete this.layerIndexes[P],delete this.availableImages[P],delete this.workerSources[P],delete this.demWorkerSources[P]})))),this.actor.registerMessageHandler("SR",((P,D)=>I._(this,void 0,void 0,(function*(){this.referrer=D})))),this.actor.registerMessageHandler("SRPS",((P,D)=>this._syncRTLPluginState(P,D))),this.actor.registerMessageHandler("IS",((P,D)=>I._(this,void 0,void 0,(function*(){this.self.importScripts(D)})))),this.actor.registerMessageHandler("SI",((P,D)=>this._setImages(P,D))),this.actor.registerMessageHandler("UL",((P,D)=>I._(this,void 0,void 0,(function*(){this._getLayerIndex(P).update(D.layers,D.removedIds)})))),this.actor.registerMessageHandler("SL",((P,D)=>I._(this,void 0,void 0,(function*(){this._getLayerIndex(P).replace(D)}))))}_setImages(M,P){return I._(this,void 0,void 0,(function*(){this.availableImages[M]=P;for(let D in this.workerSources[M]){let N=this.workerSources[M][D];for(let W in N)N[W].availableImages=P}}))}_syncRTLPluginState(M,P){return I._(this,void 0,void 0,(function*(){if(I.bD.isParsed())return I.bD.getState();if(P.pluginStatus!=="loading")return I.bD.setState(P),P;let D=P.pluginURL;if(this.self.importScripts(D),I.bD.isParsed()){let N={pluginStatus:"loaded",pluginURL:D};return I.bD.setState(N),N}throw I.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${D}`)}))}_getAvailableImages(M){let P=this.availableImages[M];return P||(P=[]),P}_getLayerIndex(M){let P=this.layerIndexes[M];return P||(P=this.layerIndexes[M]=new p),P}_getWorkerSource(M,P,D){if(this.workerSources[M]||(this.workerSources[M]={}),this.workerSources[M][P]||(this.workerSources[M][P]={}),!this.workerSources[M][P][D]){let N={sendAsync:(W,Y)=>(W.targetMapId=M,this.actor.sendAsync(W,Y))};switch(P){case"vector":this.workerSources[M][P][D]=new pe(N,this._getLayerIndex(M),this._getAvailableImages(M));break;case"geojson":this.workerSources[M][P][D]=new $r(N,this._getLayerIndex(M),this._getAvailableImages(M));break;default:this.workerSources[M][P][D]=new this.externalWorkerSourceTypes[P](N,this._getLayerIndex(M),this._getAvailableImages(M))}}return this.workerSources[M][P][D]}_getDEMWorkerSource(M,P){return this.demWorkerSources[M]||(this.demWorkerSources[M]={}),this.demWorkerSources[M][P]||(this.demWorkerSources[M][P]=new K),this.demWorkerSources[M][P]}}return I.i(self)&&(self.worker=new wr(self)),wr})),re("index",["exports","./shared"],(function(I,p){"use strict";var Se="4.7.1";let Ce,$e,pe={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:h=>new Promise(((e,n)=>{let o=requestAnimationFrame(e);h.signal.addEventListener("abort",(()=>{cancelAnimationFrame(o),n(p.c())}))})),getImageData(h,e=0){return this.getImageCanvasContext(h).getImageData(-e,-e,h.width+2*e,h.height+2*e)},getImageCanvasContext(h){let e=window.document.createElement("canvas"),n=e.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return e.width=h.width,e.height=h.height,n.drawImage(h,0,0,h.width,h.height),n},resolveURL:h=>(Ce||(Ce=document.createElement("a")),Ce.href=h,Ce.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&($e==null&&($e=matchMedia("(prefers-reduced-motion: reduce)")),$e.matches)}};class K{static testProp(e){if(!K.docStyle)return e[0];for(let n=0;n<e.length;n++)if(e[n]in K.docStyle)return e[n];return e[0]}static create(e,n,o){let a=window.document.createElement(e);return n!==void 0&&(a.className=n),o&&o.appendChild(a),a}static createNS(e,n){return window.document.createElementNS(e,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(e,n){e.style[K.transformProp]=n}static addEventListener(e,n,o,a={}){e.addEventListener(n,o,"passive"in a?a:a.capture)}static removeEventListener(e,n,o,a={}){e.removeEventListener(n,o,"passive"in a?a:a.capture)}static suppressClickInternal(e){e.preventDefault(),e.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 getScale(e){let n=e.getBoundingClientRect();return{x:n.width/e.offsetWidth||1,y:n.height/e.offsetHeight||1,boundingClientRect:n}}static getPoint(e,n,o){let a=n.boundingClientRect;return new p.P((o.clientX-a.left)/n.x-e.clientLeft,(o.clientY-a.top)/n.y-e.clientTop)}static mousePos(e,n){let o=K.getScale(e);return K.getPoint(e,o,n)}static touchPos(e,n){let o=[],a=K.getScale(e);for(let c=0;c<n.length;c++)o.push(K.getPoint(e,a,n[c]));return o}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}}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"]);let ht={supported:!1,testSupport:function(h){!Jt&&Nt&&(li?$i(h):Dt=h)}},Dt,Nt,Jt=!1,li=!1;function $i(h){let e=h.createTexture();h.bindTexture(h.TEXTURE_2D,e);try{if(h.texImage2D(h.TEXTURE_2D,0,h.RGBA,h.RGBA,h.UNSIGNED_BYTE,Nt),h.isContextLost())return;ht.supported=!0}catch{}h.deleteTexture(e),Jt=!0}var et;typeof document<"u"&&(Nt=document.createElement("img"),Nt.onload=()=>{Dt&&$i(Dt),Dt=null,li=!0},Nt.onerror=()=>{Jt=!0,Dt=null},Nt.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),(function(h){let e,n,o,a;h.resetRequestQueue=()=>{e=[],n=0,o=0,a={}},h.addThrottleControl=y=>{let b=o++;return a[b]=y,b},h.removeThrottleControl=y=>{delete a[y],m()},h.getImage=(y,b,S=!0)=>new Promise(((T,E)=>{ht.supported&&(y.headers||(y.headers={}),y.headers.accept="image/webp,*/*"),p.e(y,{type:"image"}),e.push({abortController:b,requestParameters:y,supportImageRefresh:S,state:"queued",onError:L=>{E(L)},onSuccess:L=>{T(L)}}),m()}));let c=y=>p._(this,void 0,void 0,(function*(){y.state="running";let{requestParameters:b,supportImageRefresh:S,onError:T,onSuccess:E,abortController:L}=y,B=S===!1&&!p.i(self)&&!p.g(b.url)&&(!b.headers||Object.keys(b.headers).reduce(((q,G)=>q&&G==="accept"),!0));n++;let V=B?_(b,L):p.m(b,L);try{let q=yield V;delete y.abortController,y.state="completed",q.data instanceof HTMLImageElement||p.b(q.data)?E(q):q.data&&E({data:yield($=q.data,typeof createImageBitmap=="function"?p.d($):p.f($)),cacheControl:q.cacheControl,expires:q.expires})}catch(q){delete y.abortController,T(q)}finally{n--,m()}var $})),m=()=>{let y=(()=>{for(let b of Object.keys(a))if(a[b]())return!0;return!1})()?p.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:p.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let b=n;b<y&&e.length>0;b++){let S=e.shift();S.abortController.signal.aborted?b--:c(S)}},_=(y,b)=>new Promise(((S,T)=>{let E=new Image,L=y.url,B=y.credentials;B&&B==="include"?E.crossOrigin="use-credentials":(B&&B==="same-origin"||!p.s(L))&&(E.crossOrigin="anonymous"),b.signal.addEventListener("abort",(()=>{E.src="",T(p.c())})),E.fetchPriority="high",E.onload=()=>{E.onerror=E.onload=null,S({data:E})},E.onerror=()=>{E.onerror=E.onload=null,b.signal.aborted||T(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."))},E.src=L}))})(et||(et={})),et.resetRequestQueue();class He{constructor(e){this._transformRequestFn=e}transformRequest(e,n){return this._transformRequestFn&&this._transformRequestFn(e,n)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function Je(h){var e=new p.A(3);return e[0]=h[0],e[1]=h[1],e[2]=h[2],e}var Pt,Mt=function(h,e,n){return h[0]=e[0]-n[0],h[1]=e[1]-n[1],h[2]=e[2]-n[2],h};Pt=new p.A(3),p.A!=Float32Array&&(Pt[0]=0,Pt[1]=0,Pt[2]=0);var Vt=function(h){var e=h[0],n=h[1];return e*e+n*n};function _t(h){let e=[];if(typeof h=="string")e.push({id:"default",url:h});else if(h&&h.length>0){let n=[];for(let{id:o,url:a}of h){let c=`${o}${a}`;n.indexOf(c)===-1&&(n.push(c),e.push({id:o,url:a}))}}return e}function yi(h,e,n){let o=h.split("?");return o[0]+=`${e}${n}`,o.join("?")}(function(){var h=new p.A(2);p.A!=Float32Array&&(h[0]=0,h[1]=0)})();class Ye{constructor(e,n,o,a){this.context=e,this.format=o,this.texture=e.gl.createTexture(),this.update(n,a)}update(e,n,o){let{width:a,height:c}=e,m=!(this.size&&this.size[0]===a&&this.size[1]===c||o),{context:_}=this,{gl:y}=_;if(this.useMipmap=!!(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=[a,c],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||p.b(e)?y.texImage2D(y.TEXTURE_2D,0,this.format,this.format,y.UNSIGNED_BYTE,e):y.texImage2D(y.TEXTURE_2D,0,this.format,a,c,0,this.format,y.UNSIGNED_BYTE,e.data);else{let{x:b,y:S}=o||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||p.b(e)?y.texSubImage2D(y.TEXTURE_2D,0,b,S,y.RGBA,y.UNSIGNED_BYTE,e):y.texSubImage2D(y.TEXTURE_2D,0,b,S,a,c,y.RGBA,y.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&y.generateMipmap(y.TEXTURE_2D)}bind(e,n,o){let{context:a}=this,{gl:c}=a;c.bindTexture(c.TEXTURE_2D,this.texture),o!==c.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(o=c.LINEAR),e!==this.filter&&(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,e),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,o||e),this.filter=e),n!==this.wrap&&(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,n),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,n),this.wrap=n)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function Yt(h){let{userImage:e}=h;return!!(e&&e.render&&e.render())&&(h.data.replace(new Uint8Array(e.data.buffer)),!0)}class ze extends p.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new p.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:n,promiseResolve:o}of this.requestors)o(this._getImagesForIds(n));this.requestors=[]}}getImage(e){let n=this.images[e];if(n&&!n.data&&n.spriteData){let o=n.spriteData;n.data=new p.R({width:o.width,height:o.height},o.context.getImageData(o.x,o.y,o.width,o.height).data),n.spriteData=null}return n}addImage(e,n){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,n)&&(this.images[e]=n)}_validate(e,n){let o=!0,a=n.data||n.spriteData;return this._validateStretch(n.stretchX,a&&a.width)||(this.fire(new p.j(new Error(`Image "${e}" has invalid "stretchX" value`))),o=!1),this._validateStretch(n.stretchY,a&&a.height)||(this.fire(new p.j(new Error(`Image "${e}" has invalid "stretchY" value`))),o=!1),this._validateContent(n.content,n)||(this.fire(new p.j(new Error(`Image "${e}" has invalid "content" value`))),o=!1),o}_validateStretch(e,n){if(!e)return!0;let o=0;for(let a of e){if(a[0]<o||a[1]<a[0]||n<a[1])return!1;o=a[1]}return!0}_validateContent(e,n){if(!e)return!0;if(e.length!==4)return!1;let o=n.spriteData,a=o&&o.width||n.data.width,c=o&&o.height||n.data.height;return!(e[0]<0||a<e[0]||e[1]<0||c<e[1]||e[2]<0||a<e[2]||e[3]<0||c<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,n,o=!0){let a=this.getImage(e);if(o&&(a.data.width!==n.data.width||a.data.height!==n.data.height))throw new Error(`size mismatch between old image (${a.data.width}x${a.data.height}) and new image (${n.data.width}x${n.data.height}).`);n.version=a.version+1,this.images[e]=n,this.updatedImages[e]=!0}removeImage(e){let n=this.images[e];delete this.images[e],delete this.patterns[e],n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise(((n,o)=>{let a=!0;if(!this.isLoaded())for(let c of e)this.images[c]||(a=!1);this.isLoaded()||a?n(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:n})}))}_getImagesForIds(e){let n={};for(let o of e){let a=this.getImage(o);a||(this.fire(new p.k("styleimagemissing",{id:o})),a=this.getImage(o)),a?n[o]={data:a.data.clone(),pixelRatio:a.pixelRatio,sdf:a.sdf,version:a.version,stretchX:a.stretchX,stretchY:a.stretchY,content:a.content,textFitWidth:a.textFitWidth,textFitHeight:a.textFitHeight,hasRenderCallback:!!(a.userImage&&a.userImage.render)}:p.w(`Image "${o}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return n}getPixelSize(){let{width:e,height:n}=this.atlasImage;return{width:e,height:n}}getPattern(e){let n=this.patterns[e],o=this.getImage(e);if(!o)return null;if(n&&n.position.version===o.version)return n.position;if(n)n.position.version=o.version;else{let a={w:o.data.width+2,h:o.data.height+2,x:0,y:0},c=new p.I(a,o);this.patterns[e]={bin:a,position:c}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){let n=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Ye(e,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let c in this.patterns)e.push(this.patterns[c].bin);let{w:n,h:o}=p.p(e),a=this.atlasImage;a.resize({width:n||1,height:o||1});for(let c in this.patterns){let{bin:m}=this.patterns[c],_=m.x+1,y=m.y+1,b=this.getImage(c).data,S=b.width,T=b.height;p.R.copy(b,a,{x:0,y:0},{x:_,y},{width:S,height:T}),p.R.copy(b,a,{x:0,y:T-1},{x:_,y:y-1},{width:S,height:1}),p.R.copy(b,a,{x:0,y:0},{x:_,y:y+T},{width:S,height:1}),p.R.copy(b,a,{x:S-1,y:0},{x:_-1,y},{width:1,height:T}),p.R.copy(b,a,{x:0,y:0},{x:_+S,y},{width:1,height:T})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let n of e){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;let o=this.getImage(n);o||p.w(`Image with ID: "${n}" was not found`),Yt(o)&&this.updateImage(n,o)}}}let tt=1e20;function st(h,e,n,o,a,c,m,_,y){for(let b=e;b<e+o;b++)Qt(h,n*c+b,c,a,m,_,y);for(let b=n;b<n+a;b++)Qt(h,b*c+e,1,o,m,_,y)}function Qt(h,e,n,o,a,c,m){c[0]=0,m[0]=-tt,m[1]=tt,a[0]=h[e];for(let _=1,y=0,b=0;_<o;_++){a[_]=h[e+_*n];let S=_*_;do{let T=c[y];b=(a[_]-a[T]+S-T*T)/(_-T)/2}while(b<=m[y]&&--y>-1);y++,c[y]=_,m[y]=b,m[y+1]=tt}for(let _=0,y=0;_<o;_++){for(;m[y+1]<_;)y++;let b=c[y],S=_-b;h[e+_*n]=a[b]+S*S}}class qt{constructor(e,n){this.requestManager=e,this.localIdeographFontFamily=n,this.entries={}}setURL(e){this.url=e}getGlyphs(e){return p._(this,void 0,void 0,(function*(){let n=[];for(let c in e)for(let m of e[c])n.push(this._getAndCacheGlyphsPromise(c,m));let o=yield Promise.all(n),a={};for(let{stack:c,id:m,glyph:_}of o)a[c]||(a[c]={}),a[c][m]=_&&{id:_.id,bitmap:_.bitmap.clone(),metrics:_.metrics};return a}))}_getAndCacheGlyphsPromise(e,n){return p._(this,void 0,void 0,(function*(){let o=this.entries[e];o||(o=this.entries[e]={glyphs:{},requests:{},ranges:{}});let a=o.glyphs[n];if(a!==void 0)return{stack:e,id:n,glyph:a};if(a=this._tinySDF(o,e,n),a)return o.glyphs[n]=a,{stack:e,id:n,glyph:a};let c=Math.floor(n/256);if(256*c>65535)throw new Error("glyphs > 65535 not supported");if(o.ranges[c])return{stack:e,id:n,glyph:a};if(!this.url)throw new Error("glyphsUrl is not set");if(!o.requests[c]){let _=qt.loadGlyphRange(e,c,this.url,this.requestManager);o.requests[c]=_}let m=yield o.requests[c];for(let _ in m)this._doesCharSupportLocalGlyph(+_)||(o.glyphs[+_]=m[+_]);return o.ranges[c]=!0,{stack:e,id:n,glyph:m[n]||null}}))}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&/\p{Ideo}|\p{sc=Hang}|\p{sc=Hira}|\p{sc=Kana}/u.test(String.fromCodePoint(e))}_tinySDF(e,n,o){let a=this.localIdeographFontFamily;if(!a||!this._doesCharSupportLocalGlyph(o))return;let c=e.tinySDF;if(!c){let _="400";/bold/i.test(n)?_="900":/medium/i.test(n)?_="500":/light/i.test(n)&&(_="200"),c=e.tinySDF=new qt.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:a,fontWeight:_})}let m=c.draw(String.fromCharCode(o));return{id:o,bitmap:new p.o({width:m.width||60,height:m.height||60},m.data),metrics:{width:m.glyphWidth/2||24,height:m.glyphHeight/2||24,left:m.glyphLeft/2+.5||0,top:m.glyphTop/2-27.5||-8,advance:m.glyphAdvance/2||24,isDoubleResolution:!0}}}}qt.loadGlyphRange=function(h,e,n,o){return p._(this,void 0,void 0,(function*(){let a=256*e,c=a+255,m=o.transformRequest(n.replace("{fontstack}",h).replace("{range}",`${a}-${c}`),"Glyphs"),_=yield p.l(m,new AbortController);if(!_||!_.data)throw new Error(`Could not load glyph range. range: ${e}, ${a}-${c}`);let y={};for(let b of p.n(_.data))y[b.id]=b;return y}))},qt.TinySDF=class{constructor({fontSize:h=24,buffer:e=3,radius:n=8,cutoff:o=.25,fontFamily:a="sans-serif",fontWeight:c="normal",fontStyle:m="normal"}={}){this.buffer=e,this.cutoff=o,this.radius=n;let _=this.size=h+4*e,y=this._createCanvas(_),b=this.ctx=y.getContext("2d",{willReadFrequently:!0});b.font=`${m} ${c} ${h}px ${a}`,b.textBaseline="alphabetic",b.textAlign="left",b.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_createCanvas(h){let e=document.createElement("canvas");return e.width=e.height=h,e}draw(h){let{width:e,actualBoundingBoxAscent:n,actualBoundingBoxDescent:o,actualBoundingBoxLeft:a,actualBoundingBoxRight:c}=this.ctx.measureText(h),m=Math.ceil(n),_=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(c-a))),y=Math.min(this.size-this.buffer,m+Math.ceil(o)),b=_+2*this.buffer,S=y+2*this.buffer,T=Math.max(b*S,0),E=new Uint8ClampedArray(T),L={data:E,width:b,height:S,glyphWidth:_,glyphHeight:y,glyphTop:m,glyphLeft:0,glyphAdvance:e};if(_===0||y===0)return L;let{ctx:B,buffer:V,gridInner:$,gridOuter:q}=this;B.clearRect(V,V,_,y),B.fillText(h,V,V+m);let G=B.getImageData(V,V,_,y);q.fill(tt,0,T),$.fill(0,0,T);for(let F=0;F<y;F++)for(let J=0;J<_;J++){let Q=G.data[4*(F*_+J)+3]/255;if(Q===0)continue;let ne=(F+V)*b+J+V;if(Q===1)q[ne]=0,$[ne]=tt;else{let ue=.5-Q;q[ne]=ue>0?ue*ue:0,$[ne]=ue<0?ue*ue:0}}st(q,0,0,b,S,b,this.f,this.v,this.z),st($,V,V,_,y,b,this.f,this.v,this.z);for(let F=0;F<T;F++){let J=Math.sqrt(q[F])-Math.sqrt($[F]);E[F]=Math.round(255-255*(J/this.radius+this.cutoff))}return L}};class Qi{constructor(){this.specification=p.v.light.position}possiblyEvaluate(e,n){return p.x(e.expression.evaluate(n))}interpolate(e,n,o){return{x:p.y.number(e.x,n.x,o),y:p.y.number(e.y,n.y,o),z:p.y.number(e.z,n.z,o)}}}let er;class ci extends p.E{constructor(e){super(),er=er||new p.q({anchor:new p.D(p.v.light.anchor),position:new Qi,color:new p.D(p.v.light.color),intensity:new p.D(p.v.light.intensity)}),this._transitionable=new p.T(er),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,n={}){if(!this._validate(p.r,e,n))for(let o in e){let a=e[o];o.endsWith("-transition")?this._transitionable.setTransition(o.slice(0,-11),a):this._transitionable.setValue(o,a)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,n,o){return(!o||o.validate!==!1)&&p.t(this,e.call(p.u,{value:n,style:{glyphs:!0,sprite:!0},styleSpec:p.v}))}}let Zt=new p.q({"sky-color":new p.D(p.v.sky["sky-color"]),"horizon-color":new p.D(p.v.sky["horizon-color"]),"fog-color":new p.D(p.v.sky["fog-color"]),"fog-ground-blend":new p.D(p.v.sky["fog-ground-blend"]),"horizon-fog-blend":new p.D(p.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new p.D(p.v.sky["sky-horizon-blend"]),"atmosphere-blend":new p.D(p.v.sky["atmosphere-blend"])});class tr extends p.E{constructor(e){super(),this._transitionable=new p.T(Zt),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new p.z(0))}setSky(e,n={}){if(!this._validate(p.B,e,n)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(let o in e){let a=e[o];o.endsWith("-transition")?this._transitionable.setTransition(o.slice(0,-11),a):this._transitionable.setValue(o,a)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,n,o={}){return o?.validate!==!1&&p.t(this,e.call(p.u,p.e({value:n,style:{glyphs:!0,sprite:!0},styleSpec:p.v})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class xn{constructor(e,n){this.width=e,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,n){let o=e.join(",")+String(n);return this.dashEntry[o]||(this.dashEntry[o]=this.addDash(e,n)),this.dashEntry[o]}getDashRanges(e,n,o){let a=[],c=e.length%2==1?-e[e.length-1]*o:0,m=e[0]*o,_=!0;a.push({left:c,right:m,isDash:_,zeroLength:e[0]===0});let y=e[0];for(let b=1;b<e.length;b++){_=!_;let S=e[b];c=y*o,y+=S,m=y*o,a.push({left:c,right:m,isDash:_,zeroLength:S===0})}return a}addRoundDash(e,n,o){let a=n/2;for(let c=-o;c<=o;c++){let m=this.width*(this.nextRow+o+c),_=0,y=e[_];for(let b=0;b<this.width;b++){b/y.right>1&&(y=e[++_]);let S=Math.abs(b-y.left),T=Math.abs(b-y.right),E=Math.min(S,T),L,B=c/o*(a+1);if(y.isDash){let V=a-Math.abs(B);L=Math.sqrt(E*E+V*V)}else L=a-Math.sqrt(E*E+B*B);this.data[m+b]=Math.max(0,Math.min(255,L+128))}}}addRegularDash(e){for(let _=e.length-1;_>=0;--_){let y=e[_],b=e[_+1];y.zeroLength?e.splice(_,1):b&&b.isDash===y.isDash&&(b.left=y.left,e.splice(_,1))}let n=e[0],o=e[e.length-1];n.isDash===o.isDash&&(n.left=o.left-this.width,o.right=n.right+this.width);let a=this.width*this.nextRow,c=0,m=e[c];for(let _=0;_<this.width;_++){_/m.right>1&&(m=e[++c]);let y=Math.abs(_-m.left),b=Math.abs(_-m.right),S=Math.min(y,b);this.data[a+_]=Math.max(0,Math.min(255,(m.isDash?S:-S)+128))}}addDash(e,n){let o=n?7:0,a=2*o+1;if(this.nextRow+a>this.height)return p.w("LineAtlas out of space"),null;let c=0;for(let _=0;_<e.length;_++)c+=e[_];if(c!==0){let _=this.width/c,y=this.getDashRanges(e,this.width,_);n?this.addRoundDash(y,_,o):this.addRegularDash(y)}let m={y:(this.nextRow+o+.5)/this.height,height:2*o/this.height,width:c};return this.nextRow+=a,this.dirty=!0,m}bind(e){let n=e.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))}}let Or="maplibre_preloaded_worker_pool";class yr{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<yr.workerCount;)this.workers.push(new Worker(p.a.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach((n=>{n.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[Or]}numActive(){return Object.keys(this.active).length}}let vn=Math.floor(pe.hardwareConcurrency/2),Di,ir;function Yr(){return Di||(Di=new yr),Di}yr.workerCount=p.C(globalThis)?Math.max(Math.min(vn,3),1):1;class Qr{constructor(e,n){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=n;let o=this.workerPool.acquire(n);for(let a=0;a<o.length;a++){let c=new p.F(o[a],n);c.name=`Worker ${a}`,this.actors.push(c)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,n){let o=[];for(let a of this.actors)o.push(a.sendAsync({type:e,data:n}));return Promise.all(o)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach((n=>{n.remove()})),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,n){for(let o of this.actors)o.registerMessageHandler(e,n)}}function ls(){return ir||(ir=new Qr(Yr(),p.G),ir.registerMessageHandler("GR",((h,e,n)=>p.m(e,n)))),ir}function Er(h,e){let n=p.H();return p.J(n,n,[1,1,0]),p.K(n,n,[.5*h.width,.5*h.height,1]),p.L(n,n,h.calculatePosMatrix(e.toUnwrapped()))}function Nr(h,e,n,o,a,c){let m=(function(T,E,L){if(T)for(let B of T){let V=E[B];if(V&&V.source===L&&V.type==="fill-extrusion")return!0}else for(let B in E){let V=E[B];if(V.source===L&&V.type==="fill-extrusion")return!0}return!1})(a&&a.layers,e,h.id),_=c.maxPitchScaleFactor(),y=h.tilesIn(o,_,m);y.sort(Vr);let b=[];for(let T of y)b.push({wrappedTileID:T.tileID.wrapped().key,queryResults:T.tile.queryRenderedFeatures(e,n,h._state,T.queryGeometry,T.cameraQueryGeometry,T.scale,a,c,_,Er(h.transform,T.tileID))});let S=(function(T){let E={},L={};for(let B of T){let V=B.queryResults,$=B.wrappedTileID,q=L[$]=L[$]||{};for(let G in V){let F=V[G],J=q[G]=q[G]||{},Q=E[G]=E[G]||[];for(let ne of F)J[ne.featureIndex]||(J[ne.featureIndex]=!0,Q.push(ne))}}return E})(b);for(let T in S)S[T].forEach((E=>{let L=E.feature,B=h.getFeatureState(L.layer["source-layer"],L.id);L.source=L.layer.source,L.layer["source-layer"]&&(L.sourceLayer=L.layer["source-layer"]),L.state=B}));return S}function Vr(h,e){let n=h.tileID,o=e.tileID;return n.overscaledZ-o.overscaledZ||n.canonical.y-o.canonical.y||n.wrap-o.wrap||n.canonical.x-o.canonical.x}function bn(h,e,n){return p._(this,void 0,void 0,(function*(){let o=h;if(h.url?o=(yield p.h(e.transformRequest(h.url,"Source"),n)).data:yield pe.frameAsync(n),!o)return null;let a=p.M(p.e(o,h),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in o&&o.vector_layers&&(a.vectorLayerIds=o.vector_layers.map((c=>c.id))),a}))}class oe{constructor(e,n){e&&(n?this.setSouthWest(e).setNorthEast(n):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof p.N?new p.N(e.lng,e.lat):p.N.convert(e),this}setSouthWest(e){return this._sw=e instanceof p.N?new p.N(e.lng,e.lat):p.N.convert(e),this}extend(e){let n=this._sw,o=this._ne,a,c;if(e instanceof p.N)a=e,c=e;else{if(!(e instanceof oe))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(oe.convert(e)):this.extend(p.N.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(p.N.convert(e)):this;if(a=e._sw,c=e._ne,!a||!c)return this}return n||o?(n.lng=Math.min(a.lng,n.lng),n.lat=Math.min(a.lat,n.lat),o.lng=Math.max(c.lng,o.lng),o.lat=Math.max(c.lat,o.lat)):(this._sw=new p.N(a.lng,a.lat),this._ne=new p.N(c.lng,c.lat)),this}getCenter(){return new p.N((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new p.N(this.getWest(),this.getNorth())}getSouthEast(){return new p.N(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){let{lng:n,lat:o}=p.N.convert(e),a=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=o&&o<=this._ne.lat&&a}static convert(e){return e instanceof oe?e:e&&new oe(e)}static fromLngLat(e,n=0){let o=360*n/40075017,a=o/Math.cos(Math.PI/180*e.lat);return new oe(new p.N(e.lng-a,e.lat-o),new p.N(e.lng+a,e.lat+o))}adjustAntiMeridian(){let e=new p.N(this._sw.lng,this._sw.lat),n=new p.N(this._ne.lng,this._ne.lat);return new oe(e,e.lng>n.lng?new p.N(n.lng+360,n.lat):n)}}class en{constructor(e,n,o){this.bounds=oe.convert(this.validateBounds(e)),this.minzoom=n||0,this.maxzoom=o||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){let n=Math.pow(2,e.z),o=Math.floor(p.O(this.bounds.getWest())*n),a=Math.floor(p.Q(this.bounds.getNorth())*n),c=Math.ceil(p.O(this.bounds.getEast())*n),m=Math.ceil(p.Q(this.bounds.getSouth())*n);return e.x>=o&&e.x<c&&e.y>=a&&e.y<m}}class cs extends p.E{constructor(e,n,o,a){if(super(),this.id=e,this.dispatcher=o,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,p.e(this,p.M(n,["url","scheme","tileSize","promoteId"])),this._options=p.e({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(a)}load(){return p._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new p.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let e=yield bn(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(p.e(this,e),e.bounds&&(this.tileBounds=new en(e.bounds,this.minzoom,this.maxzoom)),this.fire(new p.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new p.k("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new p.j(e))}}))}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load()}setTiles(e){return this.setSourceProperty((()=>{this._options.tiles=e})),this}setUrl(e){return this.setSourceProperty((()=>{this.url=e,this._options.url=e})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return p.e({},this._options)}loadTile(e){return p._(this,void 0,void 0,(function*(){let n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),o={request:this.map._requestManager.transformRequest(n,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};o.request.collectResourceTiming=this._collectResourceTiming;let a="RT";if(e.actor&&e.state!=="expired"){if(e.state==="loading")return new Promise(((c,m)=>{e.reloadPromise={resolve:c,reject:m}}))}else e.actor=this.dispatcher.getActor(),a="LT";e.abortController=new AbortController;try{let c=yield e.actor.sendAsync({type:a,data:o},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,c)}catch(c){if(delete e.abortController,e.aborted)return;if(c&&c.status!==404)throw c;this._afterTileLoadWorkerResponse(e,null)}}))}_afterTileLoadWorkerResponse(e,n){if(n&&n.resourceTiming&&(e.resourceTiming=n.resourceTiming),n&&this.map._refreshExpiredTiles&&e.setExpiryData(n),e.loadVectorData(n,this.map.painter),e.reloadPromise){let o=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(o.resolve).catch(o.reject)}}abortTile(e){return p._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}}))}))}unloadTile(e){return p._(this,void 0,void 0,(function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))}))}hasTransition(){return!1}}class mt extends p.E{constructor(e,n,o,a){super(),this.id=e,this.dispatcher=o,this.setEventedParent(a),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=p.e({type:"raster"},n),p.e(this,p.M(n,["url","scheme","tileSize"]))}load(){return p._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new p.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let e=yield bn(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,e&&(p.e(this,e),e.bounds&&(this.tileBounds=new en(e.bounds,this.minzoom,this.maxzoom)),this.fire(new p.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new p.k("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new p.j(e))}}))}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load()}setTiles(e){return this.setSourceProperty((()=>{this._options.tiles=e})),this}setUrl(e){return this.setSourceProperty((()=>{this.url=e,this._options.url=e})),this}serialize(){return p.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return p._(this,void 0,void 0,(function*(){let n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{let o=yield et.getImage(this.map._requestManager.transformRequest(n,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(o&&o.data){this.map._refreshExpiredTiles&&o.cacheControl&&o.expires&&e.setExpiryData({cacheControl:o.cacheControl,expires:o.expires});let a=this.map.painter.context,c=a.gl,m=o.data;e.texture=this.map.painter.getTileTexture(m.width),e.texture?e.texture.update(m,{useMipmap:!0}):(e.texture=new Ye(a,m,c.RGBA,{useMipmap:!0}),e.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE,c.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(o){if(delete e.abortController,e.aborted)e.state="unloaded";else if(o)throw e.state="errored",o}}))}abortTile(e){return p._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)}))}unloadTile(e){return p._(this,void 0,void 0,(function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)}))}hasTransition(){return!1}}class Bt extends mt{constructor(e,n,o,a){super(e,n,o,a),this.type="raster-dem",this.maxzoom=22,this._options=p.e({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox",this.redFactor=n.redFactor,this.greenFactor=n.greenFactor,this.blueFactor=n.blueFactor,this.baseShift=n.baseShift}loadTile(e){return p._(this,void 0,void 0,(function*(){let n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),o=this.map._requestManager.transformRequest(n,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let a=yield et.getImage(o,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(a&&a.data){let c=a.data;this.map._refreshExpiredTiles&&a.cacheControl&&a.expires&&e.setExpiryData({cacheControl:a.cacheControl,expires:a.expires});let m=p.b(c)&&p.U()?c:yield this.readImageNow(c),_={type:this.type,uid:e.uid,source:this.id,rawImageData:m,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();let y=yield e.actor.sendAsync({type:"LDT",data:_});e.dem=y,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(a){if(delete e.abortController,e.aborted)e.state="unloaded";else if(a)throw e.state="errored",a}}))}readImageNow(e){return p._(this,void 0,void 0,(function*(){if(typeof VideoFrame<"u"&&p.V()){let n=e.width+2,o=e.height+2;try{return new p.R({width:n,height:o},yield p.W(e,-1,-1,n,o))}catch{}}return pe.getImageData(e,1)}))}_getNeighboringTiles(e){let n=e.canonical,o=Math.pow(2,n.z),a=(n.x-1+o)%o,c=n.x===0?e.wrap-1:e.wrap,m=(n.x+1+o)%o,_=n.x+1===o?e.wrap+1:e.wrap,y={};return y[new p.S(e.overscaledZ,c,n.z,a,n.y).key]={backfilled:!1},y[new p.S(e.overscaledZ,_,n.z,m,n.y).key]={backfilled:!1},n.y>0&&(y[new p.S(e.overscaledZ,c,n.z,a,n.y-1).key]={backfilled:!1},y[new p.S(e.overscaledZ,e.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},y[new p.S(e.overscaledZ,_,n.z,m,n.y-1).key]={backfilled:!1}),n.y+1<o&&(y[new p.S(e.overscaledZ,c,n.z,a,n.y+1).key]={backfilled:!1},y[new p.S(e.overscaledZ,e.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},y[new p.S(e.overscaledZ,_,n.z,m,n.y+1).key]={backfilled:!1}),y}unloadTile(e){return p._(this,void 0,void 0,(function*(){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&(yield e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}}))}))}}class hs extends p.E{constructor(e,n,o,a){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=o.getActor(),this.setEventedParent(a),this._data=n.data,this._options=p.e({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;let c=p.X/this.tileSize;n.clusterMaxZoom!==void 0&&this.maxzoom<=n.clusterMaxZoom&&p.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${n.clusterMaxZoom}".`),this.workerOptions=p.e({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*c,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*c,extent:p.X,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:n.clusterMaxZoom!==void 0?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:p.X,radius:(n.clusterRadius||50)*c,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}load(){return p._(this,void 0,void 0,(function*(){yield this._updateWorkerData()}))}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}getData(){return p._(this,void 0,void 0,(function*(){let e=p.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:e})}))}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=e.clusterRadius),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=e.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,n,o){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:n,offset:o}})}_updateWorkerData(e){return p._(this,void 0,void 0,(function*(){let n=p.e({type:this.type},this.workerOptions);e?n.dataDiff=e:typeof this._data=="string"?(n.request=this.map._requestManager.transformRequest(pe.resolveURL(this._data),"Source"),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new p.k("dataloading",{dataType:"source"}));try{let o=yield this.actor.sendAsync({type:"LD",data:n});if(this._pendingLoads--,this._removed||o.abandoned)return void this.fire(new p.k("dataabort",{dataType:"source"}));let a=null;o.resourceTiming&&o.resourceTiming[this.id]&&(a=o.resourceTiming[this.id].slice(0));let c={dataType:"source"};this._collectResourceTiming&&a&&a.length>0&&p.e(c,{resourceTiming:a}),this.fire(new p.k("data",Object.assign(Object.assign({},c),{sourceDataType:"metadata"}))),this.fire(new p.k("data",Object.assign(Object.assign({},c),{sourceDataType:"content"})))}catch(o){if(this._pendingLoads--,this._removed)return void this.fire(new p.k("dataabort",{dataType:"source"}));this.fire(new p.j(o))}}))}loaded(){return this._pendingLoads===0}loadTile(e){return p._(this,void 0,void 0,(function*(){let n=e.actor?"RT":"LT";e.actor=this.actor;let o={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};e.abortController=new AbortController;let a=yield this.actor.sendAsync({type:n,data:o},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(a,this.map.painter,n==="RT")}))}abortTile(e){return p._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}))}unloadTile(e){return p._(this,void 0,void 0,(function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}))}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return p.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Ur=p.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class kr extends p.E{constructor(e,n,o,a){super(),this.id=e,this.dispatcher=o,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(a),this.options=n}load(e){return p._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new p.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let n=yield et.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,n&&n.data&&(this.image=n.data,e&&(this.coordinates=e),this._finishLoading())}catch(n){this._request=null,this._loaded=!0,this.fire(new p.j(n))}}))}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally((()=>{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new p.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;let n=e.map(p.Z.fromLngLat);this.tileID=(function(a){let c=1/0,m=1/0,_=-1/0,y=-1/0;for(let E of a)c=Math.min(c,E.x),m=Math.min(m,E.y),_=Math.max(_,E.x),y=Math.max(y,E.y);let b=Math.max(_-c,y-m),S=Math.max(0,Math.floor(-Math.log(b)/Math.LN2)),T=Math.pow(2,S);return new p.a1(S,Math.floor((c+_)/2*T),Math.floor((m+y)/2*T))})(n),this.minzoom=this.maxzoom=this.tileID.z;let o=n.map((a=>this.tileID.getTilePoint(a)._round()));return this._boundsArray=new p.$,this._boundsArray.emplaceBack(o[0].x,o[0].y,0,0),this._boundsArray.emplaceBack(o[1].x,o[1].y,p.X,0),this._boundsArray.emplaceBack(o[3].x,o[3].y,0,p.X),this._boundsArray.emplaceBack(o[2].x,o[2].y,p.X,p.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new p.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let e=this.map.painter.context,n=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Ur.members)),this.boundsSegments||(this.boundsSegments=p.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Ye(e,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let o=!1;for(let a in this.tiles){let c=this.tiles[a];c.state!=="loaded"&&(c.state="loaded",c.texture=this.texture,o=!0)}o&&this.fire(new p.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return p._(this,void 0,void 0,(function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"}))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class wn extends kr{constructor(e,n,o,a){super(e,n,o,a),this.roundZoom=!0,this.type="video",this.options=n}load(){return p._(this,void 0,void 0,(function*(){this._loaded=!1;let e=this.options;this.urls=[];for(let n of e.urls)this.urls.push(this.map._requestManager.transformRequest(n,"Source").url);try{let n=yield p.a3(this.urls);if(this._loaded=!0,!n)return;this.video=n,this.video.loop=!0,this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading()}catch(n){this.fire(new p.j(n))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let n=this.video.seekable;e<n.start(0)||e>n.end(0)?this.fire(new p.j(new p.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let e=this.map.painter.context,n=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Ur.members)),this.boundsSegments||(this.boundsSegments=p.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new Ye(e,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let o=!1;for(let a in this.tiles){let c=this.tiles[a];c.state!=="loaded"&&(c.state="loaded",c.texture=this.texture,o=!0)}o&&this.fire(new p.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class qi extends kr{constructor(e,n,o,a){super(e,n,o,a),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some((c=>!Array.isArray(c)||c.length!==2||c.some((m=>typeof m!="number"))))||this.fire(new p.j(new p.a2(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new p.j(new p.a2(`sources.${e}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new p.j(new p.a2(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new p.j(new p.a2(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new p.j(new p.a2(`sources.${e}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){return p._(this,void 0,void 0,(function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new p.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}))}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let n=this.map.painter.context,o=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,Ur.members)),this.boundsSegments||(this.boundsSegments=p.a0.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Ye(n,this.canvas,o.RGBA,{premultiply:!0});let a=!1;for(let c in this.tiles){let m=this.tiles[c];m.state!=="loaded"&&(m.state="loaded",m.texture=this.texture,a=!0)}a&&this.fire(new p.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}let us={},ds=h=>{switch(h){case"geojson":return hs;case"image":return kr;case"raster":return mt;case"raster-dem":return Bt;case"vector":return cs;case"video":return wn;case"canvas":return qi}return us[h]},ge="RTLPluginLoaded";class xr extends p.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=ls()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch((n=>{throw this.status="error",n}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return p._(this,arguments,void 0,(function*(n,o=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=pe.resolveURL(n),!this.url)throw new Error(`requested url ${n} is invalid`);if(this.status==="unavailable"){if(!o)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()}))}_requestImport(){return p._(this,void 0,void 0,(function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new p.k(ge))}))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let xi=null;function vr(){return xi||(xi=new xr),xi}class jr{constructor(e,n){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=p.a4(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){let n=e+this.timeAdded;n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,n,o){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=(function(a,c){let m={};if(!c)return m;for(let _ of a){let y=_.layerIds.map((b=>c.getLayer(b))).filter(Boolean);if(y.length!==0){_.layers=y,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map((b=>y.filter((S=>S.id===b))[0])));for(let b of y)m[b.id]=_}}return m})(e.buckets,n.style),this.hasSymbolBuckets=!1;for(let a in this.buckets){let c=this.buckets[a];if(c instanceof p.a6){if(this.hasSymbolBuckets=!0,!o)break;c.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let a in this.buckets){let c=this.buckets[a];if(c instanceof p.a6&&c.hasRTLText){this.hasRTLText=!0,vr().lazyLoad();break}}this.queryPadding=0;for(let a in this.buckets){let c=this.buckets[a];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(a).queryRadius(c))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new p.a5}unloadVectorData(){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(let o in this.buckets){let a=this.buckets[o];a.uploadPending()&&a.upload(e)}let n=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Ye(e,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Ye(e,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,n,o,a,c,m,_,y,b,S){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:a,cameraQueryGeometry:c,scale:m,tileSize:this.tileSize,pixelPosMatrix:S,transform:y,params:_,queryPadding:this.queryPadding*b},e,n,o):{}}querySourceFeatures(e,n){let o=this.latestFeatureIndex;if(!o||!o.rawTileData)return;let a=o.loadVTLayers(),c=n&&n.sourceLayer?n.sourceLayer:"",m=a._geojsonTileLayer||a[c];if(!m)return;let _=p.a7(n&&n.filter),{z:y,x:b,y:S}=this.tileID.canonical,T={z:y,x:b,y:S};for(let E=0;E<m.length;E++){let L=m.feature(E);if(_.needGeometry){let $=p.a8(L,!0);if(!_.filter(new p.z(this.tileID.overscaledZ),$,this.tileID.canonical))continue}else if(!_.filter(new p.z(this.tileID.overscaledZ),L))continue;let B=o.getId(L,c),V=new p.a9(L,y,b,S,B);V.tile=T,e.push(V)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let n=this.expirationTime;if(e.cacheControl){let o=p.aa(e.cacheControl);o["max-age"]&&(this.expirationTime=Date.now()+1e3*o["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let o=Date.now(),a=!1;if(this.expirationTime>o)a=!1;else if(n)if(this.expirationTime<n)a=!0;else{let c=this.expirationTime-n;c?this.expirationTime=o+Math.max(c,3e4):a=!0}else a=!0;a?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(e,n){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;let o=this.latestFeatureIndex.loadVTLayers();for(let a in this.buckets){if(!n.style.hasLayer(a))continue;let c=this.buckets[a],m=c.layers[0].sourceLayer||"_geojsonTileLayer",_=o[m],y=e[m];if(!_||!y||Object.keys(y).length===0)continue;c.update(y,_,this.imageAtlas&&this.imageAtlas.patternPositions||{});let b=n&&n.style&&n.style.getLayer(a);b&&(this.queryPadding=Math.max(this.queryPadding,b.queryRadius(c)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<pe.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=pe.now()+e}setDependencies(e,n){let o={};for(let a of n)o[a]=!0;this.dependencies[e]=o}hasDependency(e,n){for(let o of e){let a=this.dependencies[o];if(a){for(let c of n)if(a[c])return!0}}return!1}}class ve{constructor(e,n){this.max=e,this.onRemove=n,this.reset()}reset(){for(let e in this.data)for(let n of this.data[e])n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value);return this.data={},this.order=[],this}add(e,n,o){let a=e.wrapped().key;this.data[a]===void 0&&(this.data[a]=[]);let c={value:n,timeout:void 0};if(o!==void 0&&(c.timeout=setTimeout((()=>{this.remove(e,c)}),o)),this.data[a].push(c),this.order.push(a),this.order.length>this.max){let m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let n=this.data[e].shift();return n.timeout&&clearTimeout(n.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),n.value}getByKey(e){let n=this.data[e];return n?n[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,n){if(!this.has(e))return this;let o=e.wrapped().key,a=n===void 0?0:this.data[o].indexOf(n),c=this.data[o][a];return this.data[o].splice(a,1),c.timeout&&clearTimeout(c.timeout),this.data[o].length===0&&delete this.data[o],this.onRemove(c.value),this.order.splice(this.order.indexOf(o),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(e){let n=[];for(let o in this.data)for(let a of this.data[o])e(a.value)||n.push(a);for(let o of n)this.remove(o.value.tileID,o)}}class it{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,n,o){let a=String(n);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][a]=this.stateChanges[e][a]||{},p.e(this.stateChanges[e][a],o),this.deletedStates[e]===null){this.deletedStates[e]={};for(let c in this.state[e])c!==a&&(this.deletedStates[e][c]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][a]===null){this.deletedStates[e][a]={};for(let c in this.state[e][a])o[c]||(this.deletedStates[e][a][c]=null)}else for(let c in o)this.deletedStates[e]&&this.deletedStates[e][a]&&this.deletedStates[e][a][c]===null&&delete this.deletedStates[e][a][c]}removeFeatureState(e,n,o){if(this.deletedStates[e]===null)return;let a=String(n);if(this.deletedStates[e]=this.deletedStates[e]||{},o&&n!==void 0)this.deletedStates[e][a]!==null&&(this.deletedStates[e][a]=this.deletedStates[e][a]||{},this.deletedStates[e][a][o]=null);else if(n!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][a])for(o in this.deletedStates[e][a]={},this.stateChanges[e][a])this.deletedStates[e][a][o]=null;else this.deletedStates[e][a]=null;else this.deletedStates[e]=null}getState(e,n){let o=String(n),a=p.e({},(this.state[e]||{})[o],(this.stateChanges[e]||{})[o]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let c=this.deletedStates[e][n];if(c===null)return{};for(let m in c)delete a[m]}return a}initializeTileState(e,n){e.setFeatureState(this.state,n)}coalesceChanges(e,n){let o={};for(let a in this.stateChanges){this.state[a]=this.state[a]||{};let c={};for(let m in this.stateChanges[a])this.state[a][m]||(this.state[a][m]={}),p.e(this.state[a][m],this.stateChanges[a][m]),c[m]=this.state[a][m];o[a]=c}for(let a in this.deletedStates){this.state[a]=this.state[a]||{};let c={};if(this.deletedStates[a]===null)for(let m in this.state[a])c[m]={},this.state[a][m]={};else for(let m in this.deletedStates[a]){if(this.deletedStates[a][m]===null)this.state[a][m]={};else for(let _ of Object.keys(this.deletedStates[a][m]))delete this.state[a][m][_];c[m]=this.state[a][m]}o[a]=o[a]||{},p.e(o[a],c)}if(this.stateChanges={},this.deletedStates={},Object.keys(o).length!==0)for(let a in e)e[a].setFeatureState(o,n)}}class qe extends p.E{constructor(e,n,o){super(),this.id=e,this.dispatcher=o,this.on("data",(a=>this._dataHandler(a))),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((a,c,m,_)=>{let y=new(ds(c.type))(a,c,m,_);if(y.id!==a)throw new Error(`Expected Source id to be ${a} instead of ${y.id}`);return y})(e,n,o,this),this._tiles={},this._cache=new ve(0,(a=>this._unloadTile(a))),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new it,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(let e in this._tiles){let n=this._tiles[e];if(n.state!=="loaded"&&n.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,n,o){return p._(this,void 0,void 0,(function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,n,o)}catch(a){e.state="errored",a.status!==404?this._source.fire(new p.j(a,{tile:e})):this.update(this.transform,this.terrain)}}))}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new p.k("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(let n in this._tiles){let o=this._tiles[n];o.upload(e),o.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map((e=>e.tileID)).sort(Ii).map((e=>e.key))}getRenderableIds(e){let n=[];for(let o in this._tiles)this._isIdRenderable(o,e)&&n.push(this._tiles[o]);return e?n.sort(((o,a)=>{let c=o.tileID,m=a.tileID,_=new p.P(c.canonical.x,c.canonical.y)._rotate(this.transform.angle),y=new p.P(m.canonical.x,m.canonical.y)._rotate(this.transform.angle);return c.overscaledZ-m.overscaledZ||y.y-_.y||y.x-_.x})).map((o=>o.tileID.key)):n.map((o=>o.tileID)).sort(Ii).map((o=>o.key))}hasRenderableParent(e){let n=this.findLoadedParent(e,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(e,n){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(n||!this._tiles[e].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(let e in this._tiles)this._tiles[e].state!=="errored"&&this._reloadTile(e,"reloading")}}_reloadTile(e,n){return p._(this,void 0,void 0,(function*(){let o=this._tiles[e];o&&(o.state!=="loading"&&(o.state=n),yield this._loadTile(o,e,n))}))}_tileLoaded(e,n,o){e.timeAdded=pe.now(),o==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(n,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new p.k("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){let n=this.getRenderableIds();for(let a=0;a<n.length;a++){let c=n[a];if(e.neighboringTiles&&e.neighboringTiles[c]){let m=this.getTileByID(c);o(e,m),o(m,e)}}function o(a,c){a.needsHillshadePrepare=!0,a.needsTerrainPrepare=!0;let m=c.tileID.canonical.x-a.tileID.canonical.x,_=c.tileID.canonical.y-a.tileID.canonical.y,y=Math.pow(2,a.tileID.canonical.z),b=c.tileID.key;m===0&&_===0||Math.abs(_)>1||(Math.abs(m)>1&&(Math.abs(m+y)===1?m+=y:Math.abs(m-y)===1&&(m-=y)),c.dem&&a.dem&&(a.dem.backfillBorder(c.dem,m,_),a.neighboringTiles&&a.neighboringTiles[b]&&(a.neighboringTiles[b].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,n,o,a){for(let c in this._tiles){let m=this._tiles[c];if(a[c]||!m.hasData()||m.tileID.overscaledZ<=n||m.tileID.overscaledZ>o)continue;let _=m.tileID;for(;m&&m.tileID.overscaledZ>n+1;){let 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),e[y.key]){a[_.key]=_;break}}}findLoadedParent(e,n){if(e.key in this._loadedParentTiles){let o=this._loadedParentTiles[e.key];return o&&o.tileID.overscaledZ>=n?o:null}for(let o=e.overscaledZ-1;o>=n;o--){let a=e.scaledTo(o),c=this._getLoadedTile(a);if(c)return c}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){let n=this._tiles[e.key];return n&&n.hasData()?n:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){let n=Math.ceil(e.width/this._source.tileSize)+1,o=Math.ceil(e.height/this._source.tileSize)+1,a=Math.floor(n*o*(this._maxTileCacheZoomLevels===null?p.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),c=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,a):a;this._cache.setMaxSize(c)}handleWrapJump(e){let n=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,n){let o={};for(let a in this._tiles){let c=this._tiles[a];c.tileID=c.tileID.unwrapTo(c.tileID.wrap+n),o[c.tileID.key]=c}this._tiles=o;for(let a in this._timers)clearTimeout(this._timers[a]),delete this._timers[a];for(let a in this._tiles)this._setTileReloadTimer(a,this._tiles[a])}}_updateCoveredAndRetainedTiles(e,n,o,a,c,m){let _={},y={},b=Object.keys(e),S=pe.now();for(let T of b){let E=e[T],L=this._tiles[T];if(!L||L.fadeEndTime!==0&&L.fadeEndTime<=S)continue;let B=this.findLoadedParent(E,n),V=this.findLoadedSibling(E),$=B||V||null;$&&(this._addTile($.tileID),_[$.tileID.key]=$.tileID),y[T]=E}this._retainLoadedChildren(y,a,o,e);for(let T in _)e[T]||(this._coveredTiles[T]=!0,e[T]=_[T]);if(m){let T={},E={};for(let L of c)this._tiles[L.key].hasData()?T[L.key]=L:E[L.key]=L;for(let L in E){let B=E[L].children(this._source.maxzoom);this._tiles[B[0].key]&&this._tiles[B[1].key]&&this._tiles[B[2].key]&&this._tiles[B[3].key]&&(T[B[0].key]=e[B[0].key]=B[0],T[B[1].key]=e[B[1].key]=B[1],T[B[2].key]=e[B[2].key]=B[2],T[B[3].key]=e[B[3].key]=B[3],delete E[L])}for(let L in E){let B=E[L],V=this.findLoadedParent(B,this._source.minzoom),$=this.findLoadedSibling(B),q=V||$||null;if(q){T[q.tileID.key]=e[q.tileID.key]=q.tileID;for(let G in T)T[G].isChildOf(q.tileID)&&delete T[G]}}for(let L in this._tiles)T[L]||(this._coveredTiles[L]=!0)}}update(e,n){if(!this._sourceLoaded||this._paused)return;let o;this.transform=e,this.terrain=n,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?o=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((S=>new p.S(S.canonical.z,S.wrap,S.canonical.z,S.canonical.x,S.canonical.y))):(o=e.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n}),this._source.hasTile&&(o=o.filter((S=>this._source.hasTile(S))))):o=[];let a=e.coveringZoomLevel(this._source),c=Math.max(a-qe.maxOverzooming,this._source.minzoom),m=Math.max(a+qe.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let S={};for(let T of o)if(T.canonical.z>this._source.minzoom){let E=T.scaledTo(T.canonical.z-1);S[E.key]=E;let L=T.scaledTo(Math.max(this._source.minzoom,Math.min(T.canonical.z,5)));S[L.key]=L}o=o.concat(Object.values(S))}let _=o.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,_&&this.fire(new p.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let y=this._updateRetainedTiles(o,a);rr(this._source.type)&&this._updateCoveredAndRetainedTiles(y,c,m,a,o,n);for(let S in y)this._tiles[S].clearFadeHold();let b=p.ab(this._tiles,y);for(let S of b){let T=this._tiles[S];T.hasSymbolBuckets&&!T.holdingForFade()?T.setHoldDuration(this.map._fadeDuration):T.hasSymbolBuckets&&!T.symbolFadeFinished()||this._removeTile(S)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(let e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,n){var o;let a={},c={},m=Math.max(n-qe.maxOverzooming,this._source.minzoom),_=Math.max(n+qe.maxUnderzooming,this._source.minzoom),y={};for(let b of e){let S=this._addTile(b);a[b.key]=b,S.hasData()||n<this._source.maxzoom&&(y[b.key]=b)}this._retainLoadedChildren(y,n,_,a);for(let b of e){let S=this._tiles[b.key];if(S.hasData())continue;if(n+1>this._source.maxzoom){let E=b.children(this._source.maxzoom)[0],L=this.getTile(E);if(L&&L.hasData()){a[E.key]=E;continue}}else{let E=b.children(this._source.maxzoom);if(a[E[0].key]&&a[E[1].key]&&a[E[2].key]&&a[E[3].key])continue}let T=S.wasRequested();for(let E=b.overscaledZ-1;E>=m;--E){let L=b.scaledTo(E);if(c[L.key])break;if(c[L.key]=!0,S=this.getTile(L),!S&&T&&(S=this._addTile(L)),S){let B=S.hasData();if((B||!(!((o=this.map)===null||o===void 0)&&o.cancelPendingTileRequestsWhileZooming)||T)&&(a[L.key]=L),T=S.wasRequested(),B)break}}}return a}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let e in this._tiles){let n=[],o,a=this._tiles[e].tileID;for(;a.overscaledZ>0;){if(a.key in this._loadedParentTiles){o=this._loadedParentTiles[a.key];break}n.push(a.key);let c=a.scaledTo(a.overscaledZ-1);if(o=this._getLoadedTile(c),o)break;a=c}for(let c of n)this._loadedParentTiles[c]=o}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(let e in this._tiles){let n=this._tiles[e].tileID,o=this._getLoadedTile(n);this._loadedSiblingTiles[n.key]=o}}_addTile(e){let n=this._tiles[e.key];if(n)return n;n=this._cache.getAndRemove(e),n&&(this._setTileReloadTimer(e.key,n),n.tileID=e,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,n)));let o=n;return n||(n=new jr(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(n,e.key,n.state)),n.uses++,this._tiles[e.key]=n,o||this._source.fire(new p.k("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(e,n){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);let o=n.getExpiryTimeout();o&&(this._timers[e]=setTimeout((()=>{this._reloadTile(e,"expired"),delete this._timers[e]}),o))}_removeTile(e){let n=this._tiles[e];n&&(n.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}_dataHandler(e){let n=e.sourceDataType;e.dataType==="source"&&n==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&n==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,n,o){let a=[],c=this.transform;if(!c)return a;let m=o?c.getCameraQueryGeometry(e):e,_=e.map((B=>c.pointCoordinate(B,this.terrain))),y=m.map((B=>c.pointCoordinate(B,this.terrain))),b=this.getIds(),S=1/0,T=1/0,E=-1/0,L=-1/0;for(let B of y)S=Math.min(S,B.x),T=Math.min(T,B.y),E=Math.max(E,B.x),L=Math.max(L,B.y);for(let B=0;B<b.length;B++){let V=this._tiles[b[B]];if(V.holdingForFade())continue;let $=V.tileID,q=Math.pow(2,c.zoom-V.tileID.overscaledZ),G=n*V.queryPadding*p.X/V.tileSize/q,F=[$.getTilePoint(new p.Z(S,T)),$.getTilePoint(new p.Z(E,L))];if(F[0].x-G<p.X&&F[0].y-G<p.X&&F[1].x+G>=0&&F[1].y+G>=0){let J=_.map((ne=>$.getTilePoint(ne))),Q=y.map((ne=>$.getTilePoint(ne)));a.push({tile:V,tileID:$,queryGeometry:J,cameraQueryGeometry:Q,scale:q})}}return a}getVisibleCoordinates(e){let n=this.getRenderableIds(e).map((o=>this._tiles[o].tileID));for(let o of n)o.posMatrix=this.transform.calculatePosMatrix(o.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(rr(this._source.type)){let e=pe.now();for(let n in this._tiles)if(this._tiles[n].fadeEndTime>=e)return!0}return!1}setFeatureState(e,n,o){this._state.updateState(e=e||"_geojsonTileLayer",n,o)}removeFeatureState(e,n,o){this._state.removeFeatureState(e=e||"_geojsonTileLayer",n,o)}getFeatureState(e,n){return this._state.getState(e=e||"_geojsonTileLayer",n)}setDependencies(e,n,o){let a=this._tiles[e];a&&a.setDependencies(n,o)}reloadTilesForDependencies(e,n){for(let o in this._tiles)this._tiles[o].hasDependency(e,n)&&this._reloadTile(o,"reloading");this._cache.filter((o=>!o.hasDependency(e,n)))}}function Ii(h,e){let n=Math.abs(2*h.wrap)-+(h.wrap<0),o=Math.abs(2*e.wrap)-+(e.wrap<0);return h.overscaledZ-e.overscaledZ||o-n||e.canonical.y-h.canonical.y||e.canonical.x-h.canonical.x}function rr(h){return h==="raster"||h==="image"||h==="video"}qe.maxOverzooming=10,qe.maxUnderzooming=3;class Xe{constructor(e,n){this.reset(e,n)}reset(e,n){this.points=e||[],this._distances=[0];for(let o=1;o<this.points.length;o++)this._distances[o]=this._distances[o-1]+this.points[o].dist(this.points[o-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(this.points.length===1)return this.points[0];e=p.ac(e,0,1);let n=1,o=this._distances[n],a=e*this.paddedLength+this.padding;for(;o<a&&n<this._distances.length;)o=this._distances[++n];let c=n-1,m=this._distances[c],_=o-m,y=_>0?(a-m)/_:0;return this.points[c].mult(1-y).add(this.points[n].mult(y))}}function br(h,e){let n=!0;return h==="always"||h!=="never"&&e!=="never"||(n=!1),n}class zr{constructor(e,n,o){let a=this.boxCells=[],c=this.circleCells=[];this.xCellCount=Math.ceil(e/o),this.yCellCount=Math.ceil(n/o);for(let m=0;m<this.xCellCount*this.yCellCount;m++)a.push([]),c.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=n,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,n,o,a,c){this._forEachCell(n,o,a,c,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(n),this.bboxes.push(o),this.bboxes.push(a),this.bboxes.push(c)}insertCircle(e,n,o,a){this._forEachCell(n-a,o-a,n+a,o+a,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(n),this.circles.push(o),this.circles.push(a)}_insertBoxCell(e,n,o,a,c,m){this.boxCells[c].push(m)}_insertCircleCell(e,n,o,a,c,m){this.circleCells[c].push(m)}_query(e,n,o,a,c,m,_){if(o<0||e>this.width||a<0||n>this.height)return[];let y=[];if(e<=0&&n<=0&&this.width<=o&&this.height<=a){if(c)return[{key:null,x1:e,y1:n,x2:o,y2:a}];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++){let S=this.circles[3*b],T=this.circles[3*b+1],E=this.circles[3*b+2];y.push({key:this.circleKeys[b],x1:S-E,y1:T-E,x2:S+E,y2:T+E})}}else this._forEachCell(e,n,o,a,this._queryCell,y,{hitTest:c,overlapMode:m,seenUids:{box:{},circle:{}}},_);return y}query(e,n,o,a){return this._query(e,n,o,a,!1,null)}hitTest(e,n,o,a,c,m){return this._query(e,n,o,a,!0,c,m).length>0}hitTestCircle(e,n,o,a,c){let m=e-o,_=e+o,y=n-o,b=n+o;if(_<0||m>this.width||b<0||y>this.height)return!1;let S=[];return this._forEachCell(m,y,_,b,this._queryCellCircle,S,{hitTest:!0,overlapMode:a,circle:{x:e,y:n,radius:o},seenUids:{box:{},circle:{}}},c),S.length>0}_queryCell(e,n,o,a,c,m,_,y){let{seenUids:b,hitTest:S,overlapMode:T}=_,E=this.boxCells[c];if(E!==null){let B=this.bboxes;for(let V of E)if(!b.box[V]){b.box[V]=!0;let $=4*V,q=this.boxKeys[V];if(e<=B[$+2]&&n<=B[$+3]&&o>=B[$+0]&&a>=B[$+1]&&(!y||y(q))&&(!S||!br(T,q.overlapMode))&&(m.push({key:q,x1:B[$],y1:B[$+1],x2:B[$+2],y2:B[$+3]}),S))return!0}}let L=this.circleCells[c];if(L!==null){let B=this.circles;for(let V of L)if(!b.circle[V]){b.circle[V]=!0;let $=3*V,q=this.circleKeys[V];if(this._circleAndRectCollide(B[$],B[$+1],B[$+2],e,n,o,a)&&(!y||y(q))&&(!S||!br(T,q.overlapMode))){let G=B[$],F=B[$+1],J=B[$+2];if(m.push({key:q,x1:G-J,y1:F-J,x2:G+J,y2:F+J}),S)return!0}}}return!1}_queryCellCircle(e,n,o,a,c,m,_,y){let{circle:b,seenUids:S,overlapMode:T}=_,E=this.boxCells[c];if(E!==null){let B=this.bboxes;for(let V of E)if(!S.box[V]){S.box[V]=!0;let $=4*V,q=this.boxKeys[V];if(this._circleAndRectCollide(b.x,b.y,b.radius,B[$+0],B[$+1],B[$+2],B[$+3])&&(!y||y(q))&&!br(T,q.overlapMode))return m.push(!0),!0}}let L=this.circleCells[c];if(L!==null){let B=this.circles;for(let V of L)if(!S.circle[V]){S.circle[V]=!0;let $=3*V,q=this.circleKeys[V];if(this._circlesCollide(B[$],B[$+1],B[$+2],b.x,b.y,b.radius)&&(!y||y(q))&&!br(T,q.overlapMode))return m.push(!0),!0}}}_forEachCell(e,n,o,a,c,m,_,y){let b=this._convertToXCellCoord(e),S=this._convertToYCellCoord(n),T=this._convertToXCellCoord(o),E=this._convertToYCellCoord(a);for(let L=b;L<=T;L++)for(let B=S;B<=E;B++)if(c.call(this,e,n,o,a,this.xCellCount*B+L,m,_,y))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,n,o,a,c,m){let _=a-e,y=c-n,b=o+m;return b*b>_*_+y*y}_circleAndRectCollide(e,n,o,a,c,m,_){let y=(m-a)/2,b=Math.abs(e-(a+y));if(b>y+o)return!1;let S=(_-c)/2,T=Math.abs(n-(c+S));if(T>S+o)return!1;if(b<=y||T<=S)return!0;let E=b-y,L=T-S;return E*E+L*L<=o*o}}function $r(h,e,n,o,a){let c=p.H();return e?(p.K(c,c,[1/a,1/a,1]),n||p.ad(c,c,o.angle)):p.L(c,o.labelPlaneMatrix,h),c}function wr(h,e,n,o,a){if(e){let c=p.ae(h);return p.K(c,c,[a,a,1]),n||p.ad(c,c,-o.angle),c}return o.glCoordMatrix}function U(h,e,n,o){let a;o?(a=[h,e,o(h,e),1],p.af(a,a,n)):(a=[h,e,0,1],ut(a,a,n));let c=a[3];return{point:new p.P(a[0]/c,a[1]/c),signedDistanceFromCamera:c,isOccluded:!1}}function M(h,e){return .5+h/e*.5}function P(h,e){return h.x>=-e[0]&&h.x<=e[0]&&h.y>=-e[1]&&h.y<=e[1]}function D(h,e,n,o,a,c,m,_,y,b,S,T,E,L,B){let V=o?h.textSizeData:h.iconSizeData,$=p.ag(V,n.transform.zoom),q=[256/n.width*2+1,256/n.height*2+1],G=o?h.text.dynamicLayoutVertexArray:h.icon.dynamicLayoutVertexArray;G.clear();let F=h.lineVertexArray,J=o?h.text.placedSymbolArray:h.icon.placedSymbolArray,Q=n.transform.width/n.transform.height,ne=!1;for(let ue=0;ue<J.length;ue++){let me=J.get(ue);if(me.hidden||me.writingMode===p.ah.vertical&&!ne){Ve(me.numGlyphs,G);continue}ne=!1;let Te=U(me.anchorX,me.anchorY,e,B);if(!P(Te.point,q)){Ve(me.numGlyphs,G);continue}let Ae=M(n.transform.cameraToCenterDistance,Te.signedDistanceFromCamera),xe=p.ai(V,$,me),ye=m?xe/Ae:xe*Ae,Re={getElevation:B,labelPlaneMatrix:a,lineVertexArray:F,pitchWithMap:m,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:b,tileAnchorPoint:new p.P(me.anchorX,me.anchorY),unwrappedTileID:S,width:T,height:E,translation:L},We=Y(Re,me,ye,!1,_,e,c,h.glyphOffsetArray,G,Q,y);ne=We.useVertical,(We.notEnoughRoom||ne||We.needsFlipping&&Y(Re,me,ye,!0,_,e,c,h.glyphOffsetArray,G,Q,y).notEnoughRoom)&&Ve(me.numGlyphs,G)}o?h.text.dynamicLayoutVertexBuffer.updateData(G):h.icon.dynamicLayoutVertexBuffer.updateData(G)}function N(h,e,n,o,a,c,m,_){let y=c.glyphStartIndex+c.numGlyphs,b=c.lineStartIndex,S=c.lineStartIndex+c.lineLength,T=e.getoffsetX(c.glyphStartIndex),E=e.getoffsetX(y-1),L=_e(h*T,n,o,a,c.segment,b,S,_,m);if(!L)return null;let B=_e(h*E,n,o,a,c.segment,b,S,_,m);return B?_.projectionCache.anyProjectionOccluded?null:{first:L,last:B}:null}function W(h,e,n,o){return h===p.ah.horizontal&&Math.abs(n.y-e.y)>Math.abs(n.x-e.x)*o?{useVertical:!0}:(h===p.ah.vertical?e.y<n.y:e.x>n.x)?{needsFlipping:!0}:null}function Y(h,e,n,o,a,c,m,_,y,b,S){let T=n/24,E=e.lineOffsetX*T,L=e.lineOffsetY*T,B;if(e.numGlyphs>1){let V=e.glyphStartIndex+e.numGlyphs,$=e.lineStartIndex,q=e.lineStartIndex+e.lineLength,G=N(T,_,E,L,o,e,S,h);if(!G)return{notEnoughRoom:!0};let F=U(G.first.point.x,G.first.point.y,m,h.getElevation).point,J=U(G.last.point.x,G.last.point.y,m,h.getElevation).point;if(a&&!o){let Q=W(e.writingMode,F,J,b);if(Q)return Q}B=[G.first];for(let Q=e.glyphStartIndex+1;Q<V-1;Q++)B.push(_e(T*_.getoffsetX(Q),E,L,o,e.segment,$,q,h,S));B.push(G.last)}else{if(a&&!o){let $=U(h.tileAnchorPoint.x,h.tileAnchorPoint.y,c,h.getElevation).point,q=e.lineStartIndex+e.segment+1,G=new p.P(h.lineVertexArray.getx(q),h.lineVertexArray.gety(q)),F=U(G.x,G.y,c,h.getElevation),J=F.signedDistanceFromCamera>0?F.point:(function(ne,ue,me,Te,Ae,xe){return te(ne,ue,me,1,Ae,xe)})(h.tileAnchorPoint,G,$,0,c,h),Q=W(e.writingMode,$,J,b);if(Q)return Q}let V=_e(T*_.getoffsetX(e.glyphStartIndex),E,L,o,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,h,S);if(!V||h.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};B=[V]}for(let V of B)p.aj(y,V.point,V.angle);return{}}function te(h,e,n,o,a,c){let m=h.add(h.sub(e)._unit()),_=a!==void 0?U(m.x,m.y,a,c.getElevation).point:le(m.x,m.y,c).point,y=n.sub(_);return n.add(y._mult(o/y.mag()))}function Z(h,e,n){let o=e.projectionCache;if(o.projections[h])return o.projections[h];let a=new p.P(e.lineVertexArray.getx(h),e.lineVertexArray.gety(h)),c=le(a.x,a.y,e);if(c.signedDistanceFromCamera>0)return o.projections[h]=c.point,o.anyProjectionOccluded=o.anyProjectionOccluded||c.isOccluded,c.point;let m=h-n.direction;return(function(_,y,b,S,T){return te(_,y,b,S,void 0,T)})(n.distanceFromAnchor===0?e.tileAnchorPoint:new p.P(e.lineVertexArray.getx(m),e.lineVertexArray.gety(m)),a,n.previousVertex,n.absOffsetX-n.distanceFromAnchor+1,e)}function le(h,e,n){let o=h+n.translation[0],a=e+n.translation[1],c;return!n.pitchWithMap&&n.projection.useSpecialProjectionForSymbols?(c=n.projection.projectTileCoordinates(o,a,n.unwrappedTileID,n.getElevation),c.point.x=(.5*c.point.x+.5)*n.width,c.point.y=(.5*-c.point.y+.5)*n.height):(c=U(o,a,n.labelPlaneMatrix,n.getElevation),c.isOccluded=!1),c}function de(h,e,n){return h._unit()._perp()._mult(e*n)}function se(h,e,n,o,a,c,m,_,y){if(_.projectionCache.offsets[h])return _.projectionCache.offsets[h];let b=n.add(e);if(h+y.direction<o||h+y.direction>=a)return _.projectionCache.offsets[h]=b,b;let S=Z(h+y.direction,_,y),T=de(S.sub(n),m,y.direction),E=n.add(T),L=S.add(T);return _.projectionCache.offsets[h]=p.ak(c,b,E,L)||b,_.projectionCache.offsets[h]}function _e(h,e,n,o,a,c,m,_,y){let b=o?h-e:h+e,S=b>0?1:-1,T=0;o&&(S*=-1,T=Math.PI),S<0&&(T+=Math.PI);let E,L=S>0?c+a:c+a+1;_.projectionCache.cachedAnchorPoint?E=_.projectionCache.cachedAnchorPoint:(E=le(_.tileAnchorPoint.x,_.tileAnchorPoint.y,_).point,_.projectionCache.cachedAnchorPoint=E);let B,V,$=E,q=E,G=0,F=0,J=Math.abs(b),Q=[],ne;for(;G+F<=J;){if(L+=S,L<c||L>=m)return null;G+=F,q=$,V=B;let Te={absOffsetX:J,direction:S,distanceFromAnchor:G,previousVertex:q};if($=Z(L,_,Te),n===0)Q.push(q),ne=$.sub(q);else{let Ae,xe=$.sub(q);Ae=xe.mag()===0?de(Z(L+S,_,Te).sub($),n,S):de(xe,n,S),V||(V=q.add(Ae)),B=se(L,Ae,$,c,m,V,n,_,Te),Q.push(V),ne=B.sub(V)}F=ne.mag()}let ue=ne._mult((J-G)/F)._add(V||q),me=T+Math.atan2($.y-q.y,$.x-q.x);return Q.push(ue),{point:ue,angle:y?me:0,path:Q}}let Ne=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ve(h,e){for(let n=0;n<h;n++){let o=e.length;e.resize(o+4),e.float32.set(Ne,3*o)}}function ut(h,e,n){let o=e[0],a=e[1];return h[0]=n[0]*o+n[4]*a+n[12],h[1]=n[1]*o+n[5]*a+n[13],h[3]=n[3]*o+n[7]*a+n[15],h}let Ke=100;class dt{constructor(e,n,o=new zr(e.width+200,e.height+200,25),a=new zr(e.width+200,e.height+200,25)){this.transform=e,this.mapProjection=n,this.grid=o,this.ignoredGrid=a,this.pitchFactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+Ke,this.screenBottomBoundary=e.height+Ke,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,n,o,a,c,m,_,y,b,S,T){let E=e.anchorPointX+y[0],L=e.anchorPointY+y[1],B=this.projectAndGetPerspectiveRatio(a,E,L,c,S),V=o*B.perspectiveRatio,$;if(m||_)$=this._projectCollisionBox(e,V,a,c,m,_,y,B,S,T);else{let Q=B.point.x+(T?T.x*V:0),ne=B.point.y+(T?T.y*V:0);$={allPointsOccluded:!1,box:[Q+e.x1*V,ne+e.y1*V,Q+e.x2*V,ne+e.y2*V]}}let[q,G,F,J]=$.box;return this.mapProjection.useSpecialProjectionForSymbols&&(m?$.allPointsOccluded:this.mapProjection.isOccluded(E,L,c))||B.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid(q,G,F,J)||n!=="always"&&this.grid.hitTest(q,G,F,J,n,b)?{box:[q,G,F,J],placeable:!1,offscreen:!1}:{box:[q,G,F,J],placeable:!0,offscreen:this.isOffscreen(q,G,F,J)}}placeCollisionCircles(e,n,o,a,c,m,_,y,b,S,T,E,L,B,V,$){let q=[],G=new p.P(n.anchorX,n.anchorY),F=this.getPerspectiveRatio(m,G.x,G.y,_,$),J=(T?c/F:c*F)/p.ap,Q={getElevation:$,labelPlaneMatrix:y,lineVertexArray:o,pitchWithMap:T,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:G,unwrappedTileID:_,width:this.transform.width,height:this.transform.height,translation:V},ne=N(J,a,n.lineOffsetX*J,n.lineOffsetY*J,!1,n,!1,Q),ue=!1,me=!1,Te=!0;if(ne){let Ae=.5*L*F+B,xe=new p.P(-100,-100),ye=new p.P(this.screenRightBoundary,this.screenBottomBoundary),Re=new Xe,We=ne.first,be=ne.last,Pe=[];for(let Qe=We.path.length-1;Qe>=1;Qe--)Pe.push(We.path[Qe]);for(let Qe=1;Qe<be.path.length;Qe++)Pe.push(be.path[Qe]);let Ze=2.5*Ae;if(b){let Qe=this.projectPathToScreenSpace(Pe,Q,b);Pe=Qe.some((at=>at.signedDistanceFromCamera<=0))?[]:Qe.map((at=>at.point))}let Et=[];if(Pe.length>0){let Qe=Pe[0].clone(),at=Pe[0].clone();for(let kt=1;kt<Pe.length;kt++)Qe.x=Math.min(Qe.x,Pe[kt].x),Qe.y=Math.min(Qe.y,Pe[kt].y),at.x=Math.max(at.x,Pe[kt].x),at.y=Math.max(at.y,Pe[kt].y);Et=Qe.x>=xe.x&&at.x<=ye.x&&Qe.y>=xe.y&&at.y<=ye.y?[Pe]:at.x<xe.x||Qe.x>ye.x||at.y<xe.y||Qe.y>ye.y?[]:p.al([Pe],xe.x,xe.y,ye.x,ye.y)}for(let Qe of Et){Re.reset(Qe,.25*Ae);let at=0;at=Re.length<=.5*Ae?1:Math.ceil(Re.paddedLength/Ze)+1;for(let kt=0;kt<at;kt++){let ui=kt/Math.max(at-1,1),cr=Re.lerp(ui),zt=cr.x+Ke,Mi=cr.y+Ke;q.push(zt,Mi,Ae,0);let bi=zt-Ae,di=Mi-Ae,wi=zt+Ae,Cr=Mi+Ae;if(Te=Te&&this.isOffscreen(bi,di,wi,Cr),me=me||this.isInsideGrid(bi,di,wi,Cr),e!=="always"&&this.grid.hitTestCircle(zt,Mi,Ae,e,E)&&(ue=!0,!S))return{circles:[],offscreen:!1,collisionDetected:ue}}}}return{circles:!S&&ue||!me||F<this.perspectiveRatioCutoff?[]:q,offscreen:Te,collisionDetected:ue}}projectPathToScreenSpace(e,n,o){return e.map((a=>U(a.x,a.y,o,n.getElevation)))}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let n=[],o=1/0,a=1/0,c=-1/0,m=-1/0;for(let S of e){let T=new p.P(S.x+Ke,S.y+Ke);o=Math.min(o,T.x),a=Math.min(a,T.y),c=Math.max(c,T.x),m=Math.max(m,T.y),n.push(T)}let _=this.grid.query(o,a,c,m).concat(this.ignoredGrid.query(o,a,c,m)),y={},b={};for(let S of _){let T=S.key;if(y[T.bucketInstanceId]===void 0&&(y[T.bucketInstanceId]={}),y[T.bucketInstanceId][T.featureIndex])continue;let E=[new p.P(S.x1,S.y1),new p.P(S.x2,S.y1),new p.P(S.x2,S.y2),new p.P(S.x1,S.y2)];p.am(n,E)&&(y[T.bucketInstanceId][T.featureIndex]=!0,b[T.bucketInstanceId]===void 0&&(b[T.bucketInstanceId]=[]),b[T.bucketInstanceId].push(T.featureIndex))}return b}insertCollisionBox(e,n,o,a,c,m){(o?this.ignoredGrid:this.grid).insert({bucketInstanceId:a,featureIndex:c,collisionGroupID:m,overlapMode:n},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,n,o,a,c,m){let _=o?this.ignoredGrid:this.grid,y={bucketInstanceId:a,featureIndex:c,collisionGroupID:m,overlapMode:n};for(let b=0;b<e.length;b+=4)_.insertCircle(y,e[b],e[b+1],e[b+2])}projectAndGetPerspectiveRatio(e,n,o,a,c){let m;c?(m=[n,o,c(n,o),1],p.af(m,m,e)):(m=[n,o,0,1],ut(m,m,e));let _=m[3];return{point:new p.P((m[0]/_+1)/2*this.transform.width+Ke,(-m[1]/_+1)/2*this.transform.height+Ke),perspectiveRatio:.5+this.transform.cameraToCenterDistance/_*.5,isOccluded:!1,signedDistanceFromCamera:_}}getPerspectiveRatio(e,n,o,a,c){let m=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(n,o,a,c):U(n,o,e,c);return .5+this.transform.cameraToCenterDistance/m.signedDistanceFromCamera*.5}isOffscreen(e,n,o,a){return o<Ke||e>=this.screenRightBoundary||a<Ke||n>this.screenBottomBoundary}isInsideGrid(e,n,o,a){return o>=0&&e<this.gridRightBoundary&&a>=0&&n<this.gridBottomBoundary}getViewportMatrix(){let e=p.an([]);return p.J(e,e,[-100,-100,0]),e}_projectCollisionBox(e,n,o,a,c,m,_,y,b,S){let T=new p.P(1,0),E=new p.P(0,1),L=new p.P(e.anchorPointX+_[0],e.anchorPointY+_[1]);if(m&&!c){let Te=this.projectAndGetPerspectiveRatio(o,L.x+1,L.y,a,b).point.sub(y.point).unit(),Ae=Math.atan(Te.y/Te.x)+(Te.x<0?Math.PI:0),xe=Math.sin(Ae),ye=Math.cos(Ae);T=new p.P(ye,xe),E=new p.P(-xe,ye)}else if(!m&&c){let Te=-this.transform.angle,Ae=Math.sin(Te),xe=Math.cos(Te);T=new p.P(xe,Ae),E=new p.P(-Ae,xe)}let B=y.point,V=n;if(c){B=L;let Te=this.transform.zoom-Math.floor(this.transform.zoom);V=Math.pow(2,-Te),V*=this.mapProjection.getPitchedTextCorrection(this.transform,L,a),S||(V*=p.ac(.5+y.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))}S&&(B=B.add(T.mult(S.x*V)).add(E.mult(S.y*V)));let $=e.x1*V,q=e.x2*V,G=($+q)/2,F=e.y1*V,J=e.y2*V,Q=(F+J)/2,ne=[{offsetX:$,offsetY:F},{offsetX:G,offsetY:F},{offsetX:q,offsetY:F},{offsetX:q,offsetY:Q},{offsetX:q,offsetY:J},{offsetX:G,offsetY:J},{offsetX:$,offsetY:J},{offsetX:$,offsetY:Q}],ue=[];for(let{offsetX:Te,offsetY:Ae}of ne)ue.push(new p.P(B.x+T.x*Te+E.x*Ae,B.y+T.y*Te+E.y*Ae));let me=!1;if(c){let Te=ue.map((Ae=>this.projectAndGetPerspectiveRatio(o,Ae.x,Ae.y,a,b)));me=Te.some((Ae=>!Ae.isOccluded)),ue=Te.map((Ae=>Ae.point))}else me=!0;return{box:p.ao(ue),allPointsOccluded:!me}}}function ot(h,e,n){return e*(p.X/(h.tileSize*Math.pow(2,n-h.tileID.overscaledZ)))}class Wt{constructor(e,n,o,a){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?n:-n))):a&&o?1:0,this.placed=o}isHidden(){return this.opacity===0&&!this.placed}}class Ft{constructor(e,n,o,a,c){this.text=new Wt(e?e.text:null,n,o,c),this.icon=new Wt(e?e.icon:null,n,a,c)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class rt{constructor(e,n,o){this.text=e,this.icon=n,this.skipFade=o}}class xt{constructor(){this.invProjMatrix=p.H(),this.viewportMatrix=p.H(),this.circles=[]}}class Rt{constructor(e,n,o,a,c){this.bucketInstanceId=e,this.featureIndex=n,this.sourceLayerIndex=o,this.bucketIndex=a,this.tileID=c}}class ti{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let n=++this.maxGroupID;this.collisionGroups[e]={ID:n,predicate:o=>o.collisionGroupID===n}}return this.collisionGroups[e]}}function si(h,e,n,o,a){let{horizontalAlign:c,verticalAlign:m}=p.au(h);return new p.P(-(c-.5)*e+o[0]*a,-(m-.5)*n+o[1]*a)}class vi{constructor(e,n,o,a,c,m){this.transform=e.clone(),this.terrain=o,this.collisionIndex=new dt(this.transform,n),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new ti(c),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=m,m&&(m.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){let n=this.terrain;return n?(o,a)=>n.getElevation(e,o,a):null}getBucketParts(e,n,o,a){let c=o.getBucket(n),m=o.latestFeatureIndex;if(!c||!m||n.id!==c.layerIds[0])return;let _=o.collisionBoxArray,y=c.layers[0].layout,b=c.layers[0].paint,S=Math.pow(2,this.transform.zoom-o.tileID.overscaledZ),T=o.tileSize/p.X,E=o.tileID.toUnwrapped(),L=this.transform.calculatePosMatrix(E),B=y.get("text-pitch-alignment")==="map",V=y.get("text-rotation-alignment")==="map",$=ot(o,1,this.transform.zoom),q=this.collisionIndex.mapProjection.translatePosition(this.transform,o,b.get("text-translate"),b.get("text-translate-anchor")),G=this.collisionIndex.mapProjection.translatePosition(this.transform,o,b.get("icon-translate"),b.get("icon-translate-anchor")),F=$r(L,B,V,this.transform,$),J=null;if(B){let ne=wr(L,B,V,this.transform,$);J=p.L([],this.transform.labelPlaneMatrix,ne)}this.retainedQueryData[c.bucketInstanceId]=new Rt(c.bucketInstanceId,m,c.sourceLayerIndex,c.index,o.tileID);let Q={bucket:c,layout:y,translationText:q,translationIcon:G,posMatrix:L,unwrappedTileID:E,textLabelPlaneMatrix:F,labelToScreenMatrix:J,scale:S,textPixelRatio:T,holdingForFade:o.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:p.ag(c.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(c.sourceID)};if(a)for(let ne of c.sortKeyRanges){let{sortKey:ue,symbolInstanceStart:me,symbolInstanceEnd:Te}=ne;e.push({sortKey:ue,symbolInstanceStart:me,symbolInstanceEnd:Te,parameters:Q})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:c.symbolInstances.length,parameters:Q})}attemptAnchorPlacement(e,n,o,a,c,m,_,y,b,S,T,E,L,B,V,$,q,G,F){let J=p.aq[e.textAnchor],Q=[e.textOffset0,e.textOffset1],ne=si(J,o,a,Q,c),ue=this.collisionIndex.placeCollisionBox(n,E,y,b,S,_,m,$,T.predicate,F,ne);if((!G||this.collisionIndex.placeCollisionBox(G,E,y,b,S,_,m,q,T.predicate,F,ne).placeable)&&ue.placeable){let me;if(this.prevPlacement&&this.prevPlacement.variableOffsets[L.crossTileID]&&this.prevPlacement.placements[L.crossTileID]&&this.prevPlacement.placements[L.crossTileID].text&&(me=this.prevPlacement.variableOffsets[L.crossTileID].anchor),L.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[L.crossTileID]={textOffset:Q,width:o,height:a,anchor:J,textBoxScale:c,prevAnchor:me},this.markUsedJustification(B,J,L,V),B.allowVerticalPlacement&&(this.markUsedOrientation(B,V,L),this.placedOrientations[L.crossTileID]=V),{shift:ne,placedGlyphBoxes:ue}}}placeLayerBucketPart(e,n,o){let{bucket:a,layout:c,translationText:m,translationIcon:_,posMatrix:y,unwrappedTileID:b,textLabelPlaneMatrix:S,labelToScreenMatrix:T,textPixelRatio:E,holdingForFade:L,collisionBoxArray:B,partiallyEvaluatedTextSize:V,collisionGroup:$}=e.parameters,q=c.get("text-optional"),G=c.get("icon-optional"),F=p.ar(c,"text-overlap","text-allow-overlap"),J=F==="always",Q=p.ar(c,"icon-overlap","icon-allow-overlap"),ne=Q==="always",ue=c.get("text-rotation-alignment")==="map",me=c.get("text-pitch-alignment")==="map",Te=c.get("icon-text-fit")!=="none",Ae=c.get("symbol-z-order")==="viewport-y",xe=J&&(ne||!a.hasIconData()||G),ye=ne&&(J||!a.hasTextData()||q);!a.collisionArrays&&B&&a.deserializeCollisionBoxes(B);let Re=this._getTerrainElevationFunc(this.retainedQueryData[a.bucketInstanceId].tileID),We=(be,Pe,Ze)=>{var Et,Qe;if(n[be.crossTileID])return;if(L)return void(this.placements[be.crossTileID]=new rt(!1,!1,!1));let at=!1,kt=!1,ui=!0,cr=null,zt={box:null,placeable:!1,offscreen:null},Mi={box:null,placeable:!1,offscreen:null},bi=null,di=null,wi=null,Cr=0,Zn=0,xo=0;Pe.textFeatureIndex?Cr=Pe.textFeatureIndex:be.useRuntimeCollisionCircles&&(Cr=be.featureIndex),Pe.verticalTextFeatureIndex&&(Zn=Pe.verticalTextFeatureIndex);let Gn=Pe.textBox;if(Gn){let Ki=oi=>{let pi=p.ah.horizontal;if(a.allowVerticalPlacement&&!oi&&this.prevPlacement){let Vi=this.prevPlacement.placedOrientations[be.crossTileID];Vi&&(this.placedOrientations[be.crossTileID]=Vi,pi=Vi,this.markUsedOrientation(a,pi,be))}return pi},Ji=(oi,pi)=>{if(a.allowVerticalPlacement&&be.numVerticalGlyphVertices>0&&Pe.verticalTextBox){for(let Vi of a.writingModes)if(Vi===p.ah.vertical?(zt=pi(),Mi=zt):zt=oi(),zt&&zt.placeable)break}else zt=oi()},Gr=be.textAnchorOffsetStartIndex,hr=be.textAnchorOffsetEndIndex;if(hr===Gr){let oi=(pi,Vi)=>{let ct=this.collisionIndex.placeCollisionBox(pi,F,E,y,b,me,ue,m,$.predicate,Re);return ct&&ct.placeable&&(this.markUsedOrientation(a,Vi,be),this.placedOrientations[be.crossTileID]=Vi),ct};Ji((()=>oi(Gn,p.ah.horizontal)),(()=>{let pi=Pe.verticalTextBox;return a.allowVerticalPlacement&&be.numVerticalGlyphVertices>0&&pi?oi(pi,p.ah.vertical):{box:null,offscreen:null}})),Ki(zt&&zt.placeable)}else{let oi=p.aq[(Qe=(Et=this.prevPlacement)===null||Et===void 0?void 0:Et.variableOffsets[be.crossTileID])===null||Qe===void 0?void 0:Qe.anchor],pi=(ct,fn,Hn)=>{let Wn=ct.x2-ct.x1,kl=ct.y2-ct.y1,Bc=be.textBoxScale,zl=Te&&Q==="never"?fn:null,Hr=null,Ll=F==="never"?1:2,bo="never";oi&&Ll++;for(let ks=0;ks<Ll;ks++){for(let wo=Gr;wo<hr;wo++){let So=a.textAnchorOffsets.get(wo);if(oi&&So.textAnchor!==oi)continue;let Xn=this.attemptAnchorPlacement(So,ct,Wn,kl,Bc,ue,me,E,y,b,$,bo,be,a,Hn,m,_,zl,Re);if(Xn&&(Hr=Xn.placedGlyphBoxes,Hr&&Hr.placeable))return at=!0,cr=Xn.shift,Hr}oi?oi=null:bo=F}return o&&!Hr&&(Hr={box:this.collisionIndex.placeCollisionBox(Gn,"always",E,y,b,me,ue,m,$.predicate,Re,new p.P(0,0)).box,offscreen:!1,placeable:!1}),Hr};Ji((()=>pi(Gn,Pe.iconBox,p.ah.horizontal)),(()=>{let ct=Pe.verticalTextBox;return a.allowVerticalPlacement&&(!zt||!zt.placeable)&&be.numVerticalGlyphVertices>0&&ct?pi(ct,Pe.verticalIconBox,p.ah.vertical):{box:null,occluded:!0,offscreen:null}})),zt&&(at=zt.placeable,ui=zt.offscreen);let Vi=Ki(zt&&zt.placeable);if(!at&&this.prevPlacement){let ct=this.prevPlacement.variableOffsets[be.crossTileID];ct&&(this.variableOffsets[be.crossTileID]=ct,this.markUsedJustification(a,ct.anchor,be,Vi))}}}if(bi=zt,at=bi&&bi.placeable,ui=bi&&bi.offscreen,be.useRuntimeCollisionCircles){let Ki=a.text.placedSymbolArray.get(be.centerJustifiedTextSymbolIndex),Ji=p.ai(a.textSizeData,V,Ki),Gr=c.get("text-padding");di=this.collisionIndex.placeCollisionCircles(F,Ki,a.lineVertexArray,a.glyphOffsetArray,Ji,y,b,S,T,o,me,$.predicate,be.collisionCircleDiameter,Gr,m,Re),di.circles.length&&di.collisionDetected&&!o&&p.w("Collisions detected, but collision boxes are not shown"),at=J||di.circles.length>0&&!di.collisionDetected,ui=ui&&di.offscreen}if(Pe.iconFeatureIndex&&(xo=Pe.iconFeatureIndex),Pe.iconBox){let Ki=Ji=>this.collisionIndex.placeCollisionBox(Ji,Q,E,y,b,me,ue,_,$.predicate,Re,Te&&cr?cr:void 0);Mi&&Mi.placeable&&Pe.verticalIconBox?(wi=Ki(Pe.verticalIconBox),kt=wi.placeable):(wi=Ki(Pe.iconBox),kt=wi.placeable),ui=ui&&wi.offscreen}let Xi=q||be.numHorizontalGlyphVertices===0&&be.numVerticalGlyphVertices===0,vo=G||be.numIconVertices===0;Xi||vo?vo?Xi||(kt=kt&&at):at=kt&&at:kt=at=kt&&at;let Ma=kt&&wi.placeable;if(at&&bi.placeable&&this.collisionIndex.insertCollisionBox(bi.box,F,c.get("text-ignore-placement"),a.bucketInstanceId,Mi&&Mi.placeable&&Zn?Zn:Cr,$.ID),Ma&&this.collisionIndex.insertCollisionBox(wi.box,Q,c.get("icon-ignore-placement"),a.bucketInstanceId,xo,$.ID),di&&at&&this.collisionIndex.insertCollisionCircles(di.circles,F,c.get("text-ignore-placement"),a.bucketInstanceId,Cr,$.ID),o&&this.storeCollisionData(a.bucketInstanceId,Ze,Pe,bi,wi,di),be.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(a.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[be.crossTileID]=new rt(at||xe,kt||ye,ui||a.justReloaded),n[be.crossTileID]=!0};if(Ae){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");let be=a.getSortedSymbolIndexes(this.transform.angle);for(let Pe=be.length-1;Pe>=0;--Pe){let Ze=be[Pe];We(a.symbolInstances.get(Ze),a.collisionArrays[Ze],Ze)}}else for(let be=e.symbolInstanceStart;be<e.symbolInstanceEnd;be++)We(a.symbolInstances.get(be),a.collisionArrays[be],be);if(o&&a.bucketInstanceId in this.collisionCircleArrays){let be=this.collisionCircleArrays[a.bucketInstanceId];p.as(be.invProjMatrix,y),be.viewportMatrix=this.collisionIndex.getViewportMatrix()}a.justReloaded=!1}storeCollisionData(e,n,o,a,c,m){if(o.textBox||o.iconBox){let _,y;this.collisionBoxArrays.has(e)?_=this.collisionBoxArrays.get(e):(_=new Map,this.collisionBoxArrays.set(e,_)),_.has(n)?y=_.get(n):(y={text:null,icon:null},_.set(n,y)),o.textBox&&(y.text=a.box),o.iconBox&&(y.icon=c.box)}if(m){let _=this.collisionCircleArrays[e];_===void 0&&(_=this.collisionCircleArrays[e]=new xt);for(let y=0;y<m.circles.length;y+=4)_.circles.push(m.circles[y+0]),_.circles.push(m.circles[y+1]),_.circles.push(m.circles[y+2]),_.circles.push(m.collisionDetected?1:0)}}markUsedJustification(e,n,o,a){let c;c=a===p.ah.vertical?o.verticalPlacedTextSymbolIndex:{left:o.leftJustifiedTextSymbolIndex,center:o.centerJustifiedTextSymbolIndex,right:o.rightJustifiedTextSymbolIndex}[p.at(n)];let m=[o.leftJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.rightJustifiedTextSymbolIndex,o.verticalPlacedTextSymbolIndex];for(let _ of m)_>=0&&(e.text.placedSymbolArray.get(_).crossTileID=c>=0&&_!==c?0:o.crossTileID)}markUsedOrientation(e,n,o){let a=n===p.ah.horizontal||n===p.ah.horizontalOnly?n:0,c=n===p.ah.vertical?n:0,m=[o.leftJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.rightJustifiedTextSymbolIndex];for(let _ of m)e.text.placedSymbolArray.get(_).placedOrientation=a;o.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(o.verticalPlacedTextSymbolIndex).placedOrientation=c)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let n=this.prevPlacement,o=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;let a=n?n.symbolFadeChange(e):1,c=n?n.opacities:{},m=n?n.variableOffsets:{},_=n?n.placedOrientations:{};for(let y in this.placements){let b=this.placements[y],S=c[y];S?(this.opacities[y]=new Ft(S,a,b.text,b.icon),o=o||b.text!==S.text.placed||b.icon!==S.icon.placed):(this.opacities[y]=new Ft(null,a,b.text,b.icon,b.skipFade),o=o||b.text||b.icon)}for(let y in c){let b=c[y];if(!this.opacities[y]){let S=new Ft(b,a,!1,!1);S.isHidden()||(this.opacities[y]=S,o=o||b.text.placed||b.icon.placed)}}for(let y in m)this.variableOffsets[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.variableOffsets[y]=m[y]);for(let 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");o?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:e)}updateLayerOpacities(e,n){let o={};for(let a of n){let c=a.getBucket(e);c&&a.latestFeatureIndex&&e.id===c.layerIds[0]&&this.updateBucketOpacities(c,a.tileID,o,a.collisionBoxArray)}}updateBucketOpacities(e,n,o,a){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let c=e.layers[0],m=c.layout,_=new Ft(null,0,!1,!1,!0),y=m.get("text-allow-overlap"),b=m.get("icon-allow-overlap"),S=c._unevaluatedLayout.hasValue("text-variable-anchor")||c._unevaluatedLayout.hasValue("text-variable-anchor-offset"),T=m.get("text-rotation-alignment")==="map",E=m.get("text-pitch-alignment")==="map",L=m.get("icon-text-fit")!=="none",B=new Ft(null,0,y&&(b||!e.hasIconData()||m.get("icon-optional")),b&&(y||!e.hasTextData()||m.get("text-optional")),!0);!e.collisionArrays&&a&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(a);let V=(q,G,F)=>{for(let J=0;J<G/4;J++)q.opacityVertexArray.emplaceBack(F);q.hasVisibleVertices=q.hasVisibleVertices||F!==Tn},$=this.collisionBoxArrays.get(e.bucketInstanceId);for(let q=0;q<e.symbolInstances.length;q++){let G=e.symbolInstances.get(q),{numHorizontalGlyphVertices:F,numVerticalGlyphVertices:J,crossTileID:Q}=G,ne=this.opacities[Q];o[Q]?ne=_:ne||(ne=B,this.opacities[Q]=ne),o[Q]=!0;let ue=G.numIconVertices>0,me=this.placedOrientations[G.crossTileID],Te=me===p.ah.vertical,Ae=me===p.ah.horizontal||me===p.ah.horizontalOnly;if(F>0||J>0){let ye=Fi(ne.text);V(e.text,F,Te?Tn:ye),V(e.text,J,Ae?Tn:ye);let Re=ne.text.isHidden();[G.rightJustifiedTextSymbolIndex,G.centerJustifiedTextSymbolIndex,G.leftJustifiedTextSymbolIndex].forEach((Pe=>{Pe>=0&&(e.text.placedSymbolArray.get(Pe).hidden=Re||Te?1:0)})),G.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(G.verticalPlacedTextSymbolIndex).hidden=Re||Ae?1:0);let We=this.variableOffsets[G.crossTileID];We&&this.markUsedJustification(e,We.anchor,G,me);let be=this.placedOrientations[G.crossTileID];be&&(this.markUsedJustification(e,"left",G,be),this.markUsedOrientation(e,be,G))}if(ue){let ye=Fi(ne.icon),Re=!(L&&G.verticalPlacedIconSymbolIndex&&Te);G.placedIconSymbolIndex>=0&&(V(e.icon,G.numIconVertices,Re?ye:Tn),e.icon.placedSymbolArray.get(G.placedIconSymbolIndex).hidden=ne.icon.isHidden()),G.verticalPlacedIconSymbolIndex>=0&&(V(e.icon,G.numVerticalIconVertices,Re?Tn:ye),e.icon.placedSymbolArray.get(G.verticalPlacedIconSymbolIndex).hidden=ne.icon.isHidden())}let xe=$&&$.has(q)?$.get(q):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let ye=e.collisionArrays[q];if(ye){let Re=new p.P(0,0);if(ye.textBox||ye.verticalTextBox){let We=!0;if(S){let be=this.variableOffsets[Q];be?(Re=si(be.anchor,be.width,be.height,be.textOffset,be.textBoxScale),T&&Re._rotate(E?this.transform.angle:-this.transform.angle)):We=!1}if(ye.textBox||ye.verticalTextBox){let be;ye.textBox&&(be=Te),ye.verticalTextBox&&(be=Ae),Sn(e.textCollisionBox.collisionVertexArray,ne.text.placed,!We||be,xe.text,Re.x,Re.y)}}if(ye.iconBox||ye.verticalIconBox){let We=!!(!Ae&&ye.verticalIconBox),be;ye.iconBox&&(be=We),ye.verticalIconBox&&(be=!We),Sn(e.iconCollisionBox.collisionVertexArray,ne.icon.placed,be,xe.icon,L?Re.x:0,L?Re.y:0)}}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);if(e.bucketInstanceId in this.collisionCircleArrays){let q=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=q.invProjMatrix,e.placementViewportMatrix=q.viewportMatrix,e.collisionCircleArray=q.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,n){let o=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*o>e}setStale(){this.stale=!0}}function Sn(h,e,n,o,a,c){o&&o.length!==0||(o=[0,0,0,0]);let m=o[0]-Ke,_=o[1]-Ke,y=o[2]-Ke,b=o[3]-Ke;h.emplaceBack(e?1:0,n?1:0,a||0,c||0,m,_),h.emplaceBack(e?1:0,n?1:0,a||0,c||0,y,_),h.emplaceBack(e?1:0,n?1:0,a||0,c||0,y,b),h.emplaceBack(e?1:0,n?1:0,a||0,c||0,m,b)}let vt=Math.pow(2,25),No=Math.pow(2,24),Vo=Math.pow(2,17),Ri=Math.pow(2,16),Bi=Math.pow(2,9),hc=Math.pow(2,8),Zi=Math.pow(2,1);function Fi(h){if(h.opacity===0&&!h.placed)return 0;if(h.opacity===1&&h.placed)return 4294967295;let e=h.placed?1:0,n=Math.floor(127*h.opacity);return n*vt+e*No+n*Vo+e*Ri+n*Bi+e*hc+n*Zi+e}let Tn=0;function tn(){return{isOccluded:(h,e,n)=>!1,getPitchedTextCorrection:(h,e,n)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(h,e,n,o){throw new Error("Not implemented.")},translatePosition:(h,e,n,o)=>(function(a,c,m,_,y=!1){if(!m[0]&&!m[1])return[0,0];let b=y?_==="map"?a.angle:0:_==="viewport"?-a.angle:0;if(b){let S=Math.sin(b),T=Math.cos(b);m=[m[0]*T-m[1]*S,m[0]*S+m[1]*T]}return[y?m[0]:ot(c,m[0],a.zoom),y?m[1]:ot(c,m[1],a.zoom)]})(h,e,n,o),getCircleRadiusCorrection:h=>1}}class Xt{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,n,o,a,c){let m=this._bucketParts;for(;this._currentTileIndex<e.length;)if(n.getBucketParts(m,a,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,c())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,m.sort(((_,y)=>_.sortKey-y.sortKey)));this._currentPartIndex<m.length;)if(n.placeLayerBucketPart(m[this._currentPartIndex],this._seenCrossTileIDs,o),this._currentPartIndex++,c())return!0;return!1}}class ps{constructor(e,n,o,a,c,m,_,y){this.placement=new vi(e,tn(),n,m,_,y),this._currentPlacementIndex=o.length-1,this._forceFullPlacement=a,this._showCollisionBoxes=c,this._done=!1}isDone(){return this._done}continuePlacement(e,n,o){let a=pe.now(),c=()=>!this._forceFullPlacement&&pe.now()-a>2;for(;this._currentPlacementIndex>=0;){let m=n[e[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(m.type==="symbol"&&(!m.minzoom||m.minzoom<=_)&&(!m.maxzoom||m.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new Xt(m)),this._inProgressLayer.continuePlacement(o[m.source],this.placement,this._showCollisionBoxes,m,c))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}let nr=512/p.X/2;class Gt{constructor(e,n,o){this.tileID=e,this.bucketInstanceId=o,this._symbolsByKey={};let a=new Map;for(let c=0;c<n.length;c++){let m=n.get(c),_=m.key,y=a.get(_);y?y.push(m):a.set(_,[m])}for(let[c,m]of a){let _={positions:m.map((y=>({x:Math.floor(y.anchorX*nr),y:Math.floor(y.anchorY*nr)}))),crossTileIDs:m.map((y=>y.crossTileID))};if(_.positions.length>128){let y=new p.av(_.positions.length,16,Uint16Array);for(let{x:b,y:S}of _.positions)y.add(b,S);y.finish(),delete _.positions,_.index=y}this._symbolsByKey[c]=_}}getScaledCoordinates(e,n){let{x:o,y:a,z:c}=this.tileID.canonical,{x:m,y:_,z:y}=n.canonical,b=nr/Math.pow(2,y-c),S=(_*p.X+e.anchorY)*b,T=a*p.X*nr;return{x:Math.floor((m*p.X+e.anchorX)*b-o*p.X*nr),y:Math.floor(S-T)}}findMatches(e,n,o){let a=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let c=0;c<e.length;c++){let m=e.get(c);if(m.crossTileID)continue;let _=this._symbolsByKey[m.key];if(!_)continue;let y=this.getScaledCoordinates(m,n);if(_.index){let b=_.index.range(y.x-a,y.y-a,y.x+a,y.y+a).sort();for(let S of b){let T=_.crossTileIDs[S];if(!o[T]){o[T]=!0,m.crossTileID=T;break}}}else if(_.positions)for(let b=0;b<_.positions.length;b++){let S=_.positions[b],T=_.crossTileIDs[b];if(Math.abs(S.x-y.x)<=a&&Math.abs(S.y-y.y)<=a&&!o[T]){o[T]=!0,m.crossTileID=T;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:e})=>e))}}class Us{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class sr{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let n=Math.round((e-this.lng)/360);if(n!==0)for(let o in this.indexes){let a=this.indexes[o],c={};for(let m in a){let _=a[m];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+n),c[_.tileID.key]=_}this.indexes[o]=c}this.lng=e}addBucket(e,n,o){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let c=0;c<n.symbolInstances.length;c++)n.symbolInstances.get(c).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});let a=this.usedCrossTileIDs[e.overscaledZ];for(let c in this.indexes){let m=this.indexes[c];if(Number(c)>e.overscaledZ)for(let _ in m){let y=m[_];y.tileID.isChildOf(e)&&y.findMatches(n.symbolInstances,e,a)}else{let _=m[e.scaledTo(Number(c)).key];_&&_.findMatches(n.symbolInstances,e,a)}}for(let c=0;c<n.symbolInstances.length;c++){let m=n.symbolInstances.get(c);m.crossTileID||(m.crossTileID=o.generate(),a[m.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new Gt(e,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(e,n){for(let o of n.getCrossTileIDsLists())for(let a of o)delete this.usedCrossTileIDs[e][a]}removeStaleBuckets(e){let n=!1;for(let o in this.indexes){let a=this.indexes[o];for(let c in a)e[a[c].bucketInstanceId]||(this.removeBucketCrossTileIDs(o,a[c]),delete a[c],n=!0)}return n}}class Uo{constructor(){this.layerIndexes={},this.crossTileIDs=new Us,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,n,o){let a=this.layerIndexes[e.id];a===void 0&&(a=this.layerIndexes[e.id]=new sr);let c=!1,m={};a.handleWrapJump(o);for(let _ of n){let y=_.getBucket(e);y&&e.id===y.layerIds[0]&&(y.bucketInstanceId||(y.bucketInstanceId=++this.maxBucketInstanceId),a.addBucket(_.tileID,y,this.crossTileIDs)&&(c=!0),m[y.bucketInstanceId]=!0)}return a.removeStaleBuckets(m)&&(c=!0),c}pruneUnusedLayers(e){let n={};e.forEach((o=>{n[o]=!0}));for(let o in this.layerIndexes)n[o]||delete this.layerIndexes[o]}}let or=(h,e)=>p.t(h,e&&e.filter((n=>n.identifier!=="source.canvas"))),uc=p.aw();class js extends p.E{constructor(e,n={}){super(),this._rtlPluginLoaded=()=>{for(let o in this.sourceCaches){let a=this.sourceCaches[o].getSource().type;a!=="vector"&&a!=="geojson"||this.sourceCaches[o].reload()}},this.map=e,this.dispatcher=new Qr(Yr(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",((o,a)=>this.getGlyphs(o,a))),this.dispatcher.registerMessageHandler("GI",((o,a)=>this.getImages(o,a))),this.imageManager=new ze,this.imageManager.setEventedParent(this),this.glyphManager=new qt(e._requestManager,n.localIdeographFontFamily),this.lineAtlas=new xn(256,512),this.crossTileSymbolIndex=new Uo,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new p.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",p.ay()),vr().on(ge,this._rtlPluginLoaded),this.on("data",(o=>{if(o.dataType!=="source"||o.sourceDataType!=="metadata")return;let a=this.sourceCaches[o.sourceId];if(!a)return;let c=a.getSource();if(c&&c.vectorLayerIds)for(let m in this._layers){let _=this._layers[m];_.source===c.id&&this._validateLayer(_)}}))}loadURL(e,n={},o){this.fire(new p.k("dataloading",{dataType:"style"})),n.validate=typeof n.validate!="boolean"||n.validate;let a=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;let c=this._loadStyleRequest;p.h(a,this._loadStyleRequest).then((m=>{this._loadStyleRequest=null,this._load(m.data,n,o)})).catch((m=>{this._loadStyleRequest=null,m&&!c.signal.aborted&&this.fire(new p.j(m))}))}loadJSON(e,n={},o){this.fire(new p.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,pe.frameAsync(this._frameRequest).then((()=>{this._frameRequest=null,n.validate=n.validate!==!1,this._load(e,n,o)})).catch((()=>{}))}loadEmpty(){this.fire(new p.k("dataloading",{dataType:"style"})),this._load(uc,{validate:!1})}_load(e,n,o){var a;let c=n.transformStyle?n.transformStyle(o,e):e;if(!n.validate||!or(this,p.u(c))){this._loaded=!0,this.stylesheet=c;for(let m in c.sources)this.addSource(m,c.sources[m],{validate:!1});c.sprite?this._loadSprite(c.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(c.glyphs),this._createLayers(),this.light=new ci(this.stylesheet.light),this.sky=new tr(this.stylesheet.sky),this.map.setTerrain((a=this.stylesheet.terrain)!==null&&a!==void 0?a:null),this.fire(new p.k("data",{dataType:"style"})),this.fire(new p.k("style.load"))}}_createLayers(){let e=p.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",e),this._order=e.map((n=>n.id)),this._layers={},this._serializedLayers=null;for(let n of e){let o=p.aA(n);o.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=o}}_loadSprite(e,n=!1,o=void 0){let a;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,(function(c,m,_,y){return p._(this,void 0,void 0,(function*(){let b=_t(c),S=_>1?"@2x":"",T={},E={};for(let{id:L,url:B}of b){let V=m.transformRequest(yi(B,S,".json"),"SpriteJSON");T[L]=p.h(V,y);let $=m.transformRequest(yi(B,S,".png"),"SpriteImage");E[L]=et.getImage($,y)}return yield Promise.all([...Object.values(T),...Object.values(E)]),(function(L,B){return p._(this,void 0,void 0,(function*(){let V={};for(let $ in L){V[$]={};let q=pe.getImageCanvasContext((yield B[$]).data),G=(yield L[$]).data;for(let F in G){let{width:J,height:Q,x:ne,y:ue,sdf:me,pixelRatio:Te,stretchX:Ae,stretchY:xe,content:ye,textFitWidth:Re,textFitHeight:We}=G[F];V[$][F]={data:null,pixelRatio:Te,sdf:me,stretchX:Ae,stretchY:xe,content:ye,textFitWidth:Re,textFitHeight:We,spriteData:{width:J,height:Q,x:ne,y:ue,context:q}}}}return V}))})(T,E)}))})(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((c=>{if(this._spriteRequest=null,c)for(let m in c){this._spritesImagesIds[m]=[];let _=this._spritesImagesIds[m]?this._spritesImagesIds[m].filter((y=>!(y in c))):[];for(let y of _)this.imageManager.removeImage(y),this._changedImages[y]=!0;for(let y in c[m]){let b=m==="default"?y:`${m}:${y}`;this._spritesImagesIds[m].push(b),b in this.imageManager.images?this.imageManager.updateImage(b,c[m][y],!1):this.imageManager.addImage(b,c[m][y]),n&&(this._changedImages[b]=!0)}}})).catch((c=>{this._spriteRequest=null,a=c,this.fire(new p.j(a))})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.k("data",{dataType:"style"})),o&&o(a)}))}_unloadSprite(){for(let e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.k("data",{dataType:"style"}))}_validateLayer(e){let n=this.sourceCaches[e.source];if(!n)return;let o=e.sourceLayer;if(!o)return;let a=n.getSource();(a.type==="geojson"||a.vectorLayerIds&&a.vectorLayerIds.indexOf(o)===-1)&&this.fire(new p.j(new Error(`Source layer "${o}" does not exist on source "${a.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,n=!1){let o=this._serializedAllLayers();if(!e||e.length===0)return Object.values(n?p.aB(o):o);let a=[];for(let c of e)if(o[c]){let m=n?p.aB(o[c]):o[c];a.push(m)}return a}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};let n=Object.keys(this._layers);for(let o of n){let a=this._layers[o];a.type!=="custom"&&(e[o]=a.serialize())}return e}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(let e in this.sourceCaches)if(this.sourceCaches[e].hasTransition())return!0;for(let e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;let n=this._changed;if(n){let a=Object.keys(this._updatedLayers),c=Object.keys(this._removedLayers);(a.length||c.length)&&this._updateWorkerLayers(a,c);for(let m in this._updatedSources){let _=this._updatedSources[m];if(_==="reload")this._reloadSource(m);else{if(_!=="clear")throw new Error(`Invalid action ${_}`);this._clearSource(m)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let m in this._updatedPaintProps)this._layers[m].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}let o={};for(let a in this.sourceCaches){let c=this.sourceCaches[a];o[a]=c.used,c.used=!1}for(let a of this._order){let c=this._layers[a];c.recalculate(e,this._availableImages),!c.isHidden(e.zoom)&&c.source&&(this.sourceCaches[c.source].used=!0)}for(let a in o){let c=this.sourceCaches[a];!!o[a]!=!!c.used&&c.fire(new p.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:a}))}this.light.recalculate(e),this.sky.recalculate(e),this.z=e.zoom,n&&this.fire(new p.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,n){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,n={}){var o;this._checkLoaded();let a=this.serialize();if(e=n.transformStyle?n.transformStyle(a,e):e,((o=n.validate)===null||o===void 0||o)&&or(this,p.u(e)))return!1;(e=p.aB(e)).layers=p.az(e.layers);let c=p.aC(a,e),m=this._getOperationsToPerform(c);if(m.unimplemented.length>0)throw new Error(`Unimplemented: ${m.unimplemented.join(", ")}.`);if(m.operations.length===0)return!1;for(let _ of m.operations)_();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){let n=[],o=[];for(let a of e)switch(a.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":n.push((()=>this.addLayer.apply(this,a.args)));break;case"removeLayer":n.push((()=>this.removeLayer.apply(this,a.args)));break;case"setPaintProperty":n.push((()=>this.setPaintProperty.apply(this,a.args)));break;case"setLayoutProperty":n.push((()=>this.setLayoutProperty.apply(this,a.args)));break;case"setFilter":n.push((()=>this.setFilter.apply(this,a.args)));break;case"addSource":n.push((()=>this.addSource.apply(this,a.args)));break;case"removeSource":n.push((()=>this.removeSource.apply(this,a.args)));break;case"setLayerZoomRange":n.push((()=>this.setLayerZoomRange.apply(this,a.args)));break;case"setLight":n.push((()=>this.setLight.apply(this,a.args)));break;case"setGeoJSONSourceData":n.push((()=>this.setGeoJSONSourceData.apply(this,a.args)));break;case"setGlyphs":n.push((()=>this.setGlyphs.apply(this,a.args)));break;case"setSprite":n.push((()=>this.setSprite.apply(this,a.args)));break;case"setSky":n.push((()=>this.setSky.apply(this,a.args)));break;case"setTerrain":n.push((()=>this.map.setTerrain.apply(this,a.args)));break;case"setTransition":n.push((()=>{}));break;default:o.push(a.command)}return{operations:n,unimplemented:o}}addImage(e,n){if(this.getImage(e))return this.fire(new p.j(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,n),this._afterImageUpdated(e)}updateImage(e,n){this.imageManager.updateImage(e,n)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new p.j(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,n,o={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw new Error(`Source "${e}" 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(p.u.source,`sources.${e}`,n,null,o))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);let a=this.sourceCaches[e]=new qe(e,n,this.dispatcher);a.style=this,a.setEventedParent(this,(()=>({isSourceLoaded:a.loaded(),source:a.serialize(),sourceId:e}))),a.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID");for(let o in this._layers)if(this._layers[o].source===e)return this.fire(new p.j(new Error(`Source "${e}" cannot be removed while layer "${o}" is using it.`)));let n=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],n.fire(new p.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,n){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error(`There is no source with this ID=${e}`);let o=this.sourceCaches[e].getSource();if(o.type!=="geojson")throw new Error(`geojsonSource.type is ${o.type}, which is !== 'geojson`);o.setData(n),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,n,o={}){this._checkLoaded();let a=e.id;if(this.getLayer(a))return void this.fire(new p.j(new Error(`Layer "${a}" already exists on this map.`)));let c;if(e.type==="custom"){if(or(this,p.aD(e)))return;c=p.aA(e)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(a,e.source),e=p.aB(e),e=p.e(e,{source:a})),this._validate(p.u.layer,`layers.${a}`,e,{arrayIndex:-1},o))return;c=p.aA(e),this._validateLayer(c),c.setEventedParent(this,{layer:{id:a}})}let m=n?this._order.indexOf(n):this._order.length;if(n&&m===-1)this.fire(new p.j(new Error(`Cannot add layer "${a}" before non-existing layer "${n}".`)));else{if(this._order.splice(m,0,a),this._layerOrderChanged=!0,this._layers[a]=c,this._removedLayers[a]&&c.source&&c.type!=="custom"){let _=this._removedLayers[a];delete this._removedLayers[a],_.type!==c.type?this._updatedSources[c.source]="clear":(this._updatedSources[c.source]="reload",this.sourceCaches[c.source].pause())}this._updateLayer(c),c.onAdd&&c.onAdd(this.map)}}moveLayer(e,n){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new p.j(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===n)return;let o=this._order.indexOf(e);this._order.splice(o,1);let a=n?this._order.indexOf(n):this._order.length;n&&a===-1?this.fire(new p.j(new Error(`Cannot move layer "${e}" before non-existing layer "${n}".`))):(this._order.splice(a,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();let n=this._layers[e];if(!n)return void this.fire(new p.j(new Error(`Cannot remove non-existing layer "${e}".`)));n.setEventedParent(null);let o=this._order.indexOf(e);this._order.splice(o,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=n,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],n.onRemove&&n.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,n,o){this._checkLoaded();let a=this.getLayer(e);a?a.minzoom===n&&a.maxzoom===o||(n!=null&&(a.minzoom=n),o!=null&&(a.maxzoom=o),this._updateLayer(a)):this.fire(new p.j(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,n,o={}){this._checkLoaded();let a=this.getLayer(e);if(a){if(!p.aE(a.filter,n))return n==null?(a.filter=void 0,void this._updateLayer(a)):void(this._validate(p.u.filter,`layers.${a.id}.filter`,n,null,o)||(a.filter=p.aB(n),this._updateLayer(a)))}else this.fire(new p.j(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return p.aB(this.getLayer(e).filter)}setLayoutProperty(e,n,o,a={}){this._checkLoaded();let c=this.getLayer(e);c?p.aE(c.getLayoutProperty(n),o)||(c.setLayoutProperty(n,o,a),this._updateLayer(c)):this.fire(new p.j(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,n){let o=this.getLayer(e);if(o)return o.getLayoutProperty(n);this.fire(new p.j(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,n,o,a={}){this._checkLoaded();let c=this.getLayer(e);c?p.aE(c.getPaintProperty(n),o)||(c.setPaintProperty(n,o,a)&&this._updateLayer(c),this._changed=!0,this._updatedPaintProps[e]=!0,this._serializedLayers=null):this.fire(new p.j(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(e,n){return this.getLayer(e).getPaintProperty(n)}setFeatureState(e,n){this._checkLoaded();let o=e.source,a=e.sourceLayer,c=this.sourceCaches[o];if(c===void 0)return void this.fire(new p.j(new Error(`The source '${o}' does not exist in the map's style.`)));let m=c.getSource().type;m==="geojson"&&a?this.fire(new p.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):m!=="vector"||a?(e.id===void 0&&this.fire(new p.j(new Error("The feature id parameter must be provided."))),c.setFeatureState(a,e.id,n)):this.fire(new p.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,n){this._checkLoaded();let o=e.source,a=this.sourceCaches[o];if(a===void 0)return void this.fire(new p.j(new Error(`The source '${o}' does not exist in the map's style.`)));let c=a.getSource().type,m=c==="vector"?e.sourceLayer:void 0;c!=="vector"||m?n&&typeof e.id!="string"&&typeof e.id!="number"?this.fire(new p.j(new Error("A feature id is required to remove its specific state property."))):a.removeFeatureState(m,e.id,n):this.fire(new p.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();let n=e.source,o=e.sourceLayer,a=this.sourceCaches[n];if(a!==void 0)return a.getSource().type!=="vector"||o?(e.id===void 0&&this.fire(new p.j(new Error("The feature id parameter must be provided."))),a.getFeatureState(o,e.id)):void this.fire(new p.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new p.j(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return p.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let e=p.aF(this.sourceCaches,(c=>c.serialize())),n=this._serializeByIds(this._order,!0),o=this.map.getTerrain()||void 0,a=this.stylesheet;return p.aG({version:a.version,name:a.name,metadata:a.metadata,light:a.light,sky:a.sky,center:a.center,zoom:a.zoom,bearing:a.bearing,pitch:a.pitch,sprite:a.sprite,glyphs:a.glyphs,transition:a.transition,sources:e,layers:n,terrain:o},(c=>c!==void 0))}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.sourceCaches[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){let n=m=>this._layers[m].type==="fill-extrusion",o={},a=[];for(let m=this._order.length-1;m>=0;m--){let _=this._order[m];if(n(_)){o[_]=m;for(let y of e){let b=y[_];if(b)for(let S of b)a.push(S)}}}a.sort(((m,_)=>_.intersectionZ-m.intersectionZ));let c=[];for(let m=this._order.length-1;m>=0;m--){let _=this._order[m];if(n(_))for(let y=a.length-1;y>=0;y--){let b=a[y].feature;if(o[b.layer.id]<m)break;c.push(b),a.pop()}else for(let y of e){let b=y[_];if(b)for(let S of b)c.push(S.feature)}}return c}queryRenderedFeatures(e,n,o){n&&n.filter&&this._validate(p.u.filter,"queryRenderedFeatures.filter",n.filter,null,n);let a={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new p.j(new Error("parameters.layers must be an Array."))),[];for(let _ of n.layers){let y=this._layers[_];if(!y)return this.fire(new p.j(new Error(`The layer '${_}' does not exist in the map's style and cannot be queried for features.`))),[];a[y.source]=!0}}let c=[];n.availableImages=this._availableImages;let m=this._serializedAllLayers();for(let _ in this.sourceCaches)n.layers&&!a[_]||c.push(Nr(this.sourceCaches[_],this._layers,m,e,n,o));return this.placement&&c.push((function(_,y,b,S,T,E,L){let B={},V=E.queryRenderedSymbols(S),$=[];for(let q of Object.keys(V).map(Number))$.push(L[q]);$.sort(Vr);for(let q of $){let G=q.featureIndex.lookupSymbolFeatures(V[q.bucketInstanceId],y,q.bucketIndex,q.sourceLayerIndex,T.filter,T.layers,T.availableImages,_);for(let F in G){let J=B[F]=B[F]||[],Q=G[F];Q.sort(((ne,ue)=>{let me=q.featureSortOrder;if(me){let Te=me.indexOf(ne.featureIndex);return me.indexOf(ue.featureIndex)-Te}return ue.featureIndex-ne.featureIndex}));for(let ne of Q)J.push(ne)}}for(let q in B)B[q].forEach((G=>{let F=G.feature,J=b[_[q].source].getFeatureState(F.layer["source-layer"],F.id);F.source=F.layer.source,F.layer["source-layer"]&&(F.sourceLayer=F.layer["source-layer"]),F.state=J}));return B})(this._layers,m,this.sourceCaches,e,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(c)}querySourceFeatures(e,n){n&&n.filter&&this._validate(p.u.filter,"querySourceFeatures.filter",n.filter,null,n);let o=this.sourceCaches[e];return o?(function(a,c){let m=a.getRenderableIds().map((b=>a.getTileByID(b))),_=[],y={};for(let b=0;b<m.length;b++){let S=m[b],T=S.tileID.canonical.key;y[T]||(y[T]=!0,S.querySourceFeatures(_,c))}return _})(o,n):[]}getLight(){return this.light.getLight()}setLight(e,n={}){this._checkLoaded();let o=this.light.getLight(),a=!1;for(let m in e)if(!p.aE(e[m],o[m])){a=!0;break}if(!a)return;let c={now:pe.now(),transition:p.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,n),this.light.updateTransitions(c)}getSky(){var e;return(e=this.stylesheet)===null||e===void 0?void 0:e.sky}setSky(e,n={}){let o=this.getSky(),a=!1;if(!e&&!o)return;if(e&&!o)a=!0;else if(!e&&o)a=!0;else for(let m in e)if(!p.aE(e[m],o[m])){a=!0;break}if(!a)return;let c={now:pe.now(),transition:p.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,n),this.sky.updateTransitions(c)}_validate(e,n,o,a,c={}){return(!c||c.validate!==!1)&&or(this,e.call(p.u,p.e({key:n,style:this.serialize(),value:o,styleSpec:p.v},a)))}_remove(e=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),vr().off(ge,this._rtlPluginLoaded);for(let n in this._layers)this._layers[n].setEventedParent(null);for(let n in this.sourceCaches){let o=this.sourceCaches[n];o.setEventedParent(null),o.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.sourceCaches[e].clearTiles()}_reloadSource(e){this.sourceCaches[e].resume(),this.sourceCaches[e].reload()}_updateSources(e){for(let n in this.sourceCaches)this.sourceCaches[n].update(e,this.map.terrain)}_generateCollisionBoxes(){for(let e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(e,n,o,a,c=!1){let m=!1,_=!1,y={};for(let b of this._order){let S=this._layers[b];if(S.type!=="symbol")continue;if(!y[S.source]){let E=this.sourceCaches[S.source];y[S.source]=E.getRenderableIds(!0).map((L=>E.getTileByID(L))).sort(((L,B)=>B.tileID.overscaledZ-L.tileID.overscaledZ||(L.tileID.isLessThan(B.tileID)?-1:1)))}let T=this.crossTileSymbolIndex.addLayer(S,y[S.source],e.center.lng);m=m||T}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((c=c||this._layerOrderChanged||o===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(pe.now(),e.zoom))&&(this.pauseablePlacement=new ps(e,this.map.terrain,this._order,c,n,o,a,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,y),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(pe.now()),_=!0),m&&this.pauseablePlacement.placement.setStale()),_||m)for(let b of this._order){let S=this._layers[b];S.type==="symbol"&&this.placement.updateLayerOpacities(S,y[S.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(pe.now())}_releaseSymbolFadeTiles(){for(let e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,n){return p._(this,void 0,void 0,(function*(){let o=yield this.imageManager.getImages(n.icons);this._updateTilesForChangedImages();let a=this.sourceCaches[n.source];return a&&a.setDependencies(n.tileID.key,n.type,n.icons),o}))}getGlyphs(e,n){return p._(this,void 0,void 0,(function*(){let o=yield this.glyphManager.getGlyphs(n.stacks),a=this.sourceCaches[n.source];return a&&a.setDependencies(n.tileID.key,n.type,[""]),o}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,n={}){this._checkLoaded(),e&&this._validate(p.u.glyphs,"glyphs",e,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,n,o={},a){this._checkLoaded();let c=[{id:e,url:n}],m=[..._t(this.stylesheet.sprite),...c];this._validate(p.u.sprite,"sprite",m,null,o)||(this.stylesheet.sprite=m,this._loadSprite(c,!0,a))}removeSprite(e){this._checkLoaded();let n=_t(this.stylesheet.sprite);if(n.find((o=>o.id===e))){if(this._spritesImagesIds[e])for(let o of this._spritesImagesIds[e])this.imageManager.removeImage(o),this._changedImages[o]=!0;n.splice(n.findIndex((o=>o.id===e)),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.k("data",{dataType:"style"}))}else this.fire(new p.j(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return _t(this.stylesheet.sprite)}setSprite(e,n={},o){this._checkLoaded(),e&&this._validate(p.u.sprite,"sprite",e,null,n)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,o):(this._unloadSprite(),o&&o(null)))}}var rn=p.Y([{name:"a_pos",type:"Int16",components:2}]);let qr={prelude:gt(`#ifdef GL_ES
|
|
3
|
+
precision mediump float;
|
|
4
|
+
#else
|
|
5
|
+
#if !defined(lowp)
|
|
6
|
+
#define lowp
|
|
7
|
+
#endif
|
|
8
|
+
#if !defined(mediump)
|
|
9
|
+
#define mediump
|
|
10
|
+
#endif
|
|
11
|
+
#if !defined(highp)
|
|
12
|
+
#define highp
|
|
13
|
+
#endif
|
|
14
|
+
#endif
|
|
15
|
+
`,`#ifdef GL_ES
|
|
16
|
+
precision highp float;
|
|
17
|
+
#else
|
|
18
|
+
#if !defined(lowp)
|
|
19
|
+
#define lowp
|
|
20
|
+
#endif
|
|
21
|
+
#if !defined(mediump)
|
|
22
|
+
#define mediump
|
|
23
|
+
#endif
|
|
24
|
+
#if !defined(highp)
|
|
25
|
+
#define highp
|
|
26
|
+
#endif
|
|
27
|
+
#endif
|
|
28
|
+
vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
|
|
29
|
+
);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}
|
|
30
|
+
#ifdef TERRAIN3D
|
|
31
|
+
uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;
|
|
32
|
+
#endif
|
|
33
|
+
const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {
|
|
34
|
+
#ifdef TERRAIN3D
|
|
35
|
+
highp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
|
|
36
|
+
#else
|
|
37
|
+
return 1.0;
|
|
38
|
+
#endif
|
|
39
|
+
}float calculate_visibility(vec4 pos) {
|
|
40
|
+
#ifdef TERRAIN3D
|
|
41
|
+
vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;
|
|
42
|
+
#else
|
|
43
|
+
return 1.0;
|
|
44
|
+
#endif
|
|
45
|
+
}float ele(vec2 pos) {
|
|
46
|
+
#ifdef TERRAIN3D
|
|
47
|
+
vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
|
|
48
|
+
#else
|
|
49
|
+
return 0.0;
|
|
50
|
+
#endif
|
|
51
|
+
}float get_elevation(vec2 pos) {
|
|
52
|
+
#ifdef TERRAIN3D
|
|
53
|
+
vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;
|
|
54
|
+
#else
|
|
55
|
+
return 0.0;
|
|
56
|
+
#endif
|
|
57
|
+
}`),background:gt(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
|
|
58
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
59
|
+
gl_FragColor=vec4(1.0);
|
|
60
|
+
#endif
|
|
61
|
+
}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:gt(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;
|
|
62
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
63
|
+
gl_FragColor=vec4(1.0);
|
|
64
|
+
#endif
|
|
65
|
+
}`,"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:gt(`varying vec3 v_data;varying float v_visibility;
|
|
66
|
+
#pragma mapbox: define highp vec4 color
|
|
67
|
+
#pragma mapbox: define mediump float radius
|
|
68
|
+
#pragma mapbox: define lowp float blur
|
|
69
|
+
#pragma mapbox: define lowp float opacity
|
|
70
|
+
#pragma mapbox: define highp vec4 stroke_color
|
|
71
|
+
#pragma mapbox: define mediump float stroke_width
|
|
72
|
+
#pragma mapbox: define lowp float stroke_opacity
|
|
73
|
+
void main() {
|
|
74
|
+
#pragma mapbox: initialize highp vec4 color
|
|
75
|
+
#pragma mapbox: initialize mediump float radius
|
|
76
|
+
#pragma mapbox: initialize lowp float blur
|
|
77
|
+
#pragma mapbox: initialize lowp float opacity
|
|
78
|
+
#pragma mapbox: initialize highp vec4 stroke_color
|
|
79
|
+
#pragma mapbox: initialize mediump float stroke_width
|
|
80
|
+
#pragma mapbox: initialize lowp float stroke_opacity
|
|
81
|
+
vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);
|
|
82
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
83
|
+
gl_FragColor=vec4(1.0);
|
|
84
|
+
#endif
|
|
85
|
+
}`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;
|
|
86
|
+
#pragma mapbox: define highp vec4 color
|
|
87
|
+
#pragma mapbox: define mediump float radius
|
|
88
|
+
#pragma mapbox: define lowp float blur
|
|
89
|
+
#pragma mapbox: define lowp float opacity
|
|
90
|
+
#pragma mapbox: define highp vec4 stroke_color
|
|
91
|
+
#pragma mapbox: define mediump float stroke_width
|
|
92
|
+
#pragma mapbox: define lowp float stroke_opacity
|
|
93
|
+
void main(void) {
|
|
94
|
+
#pragma mapbox: initialize highp vec4 color
|
|
95
|
+
#pragma mapbox: initialize mediump float radius
|
|
96
|
+
#pragma mapbox: initialize lowp float blur
|
|
97
|
+
#pragma mapbox: initialize lowp float opacity
|
|
98
|
+
#pragma mapbox: initialize highp vec4 stroke_color
|
|
99
|
+
#pragma mapbox: initialize mediump float stroke_width
|
|
100
|
+
#pragma mapbox: initialize lowp float stroke_opacity
|
|
101
|
+
vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:gt("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:gt(`uniform highp float u_intensity;varying vec2 v_extrude;
|
|
102
|
+
#pragma mapbox: define highp float weight
|
|
103
|
+
#define GAUSS_COEF 0.3989422804014327
|
|
104
|
+
void main() {
|
|
105
|
+
#pragma mapbox: initialize highp float weight
|
|
106
|
+
float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);
|
|
107
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
108
|
+
gl_FragColor=vec4(1.0);
|
|
109
|
+
#endif
|
|
110
|
+
}`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;
|
|
111
|
+
#pragma mapbox: define highp float weight
|
|
112
|
+
#pragma mapbox: define mediump float radius
|
|
113
|
+
const highp float ZERO=1.0/255.0/16.0;
|
|
114
|
+
#define GAUSS_COEF 0.3989422804014327
|
|
115
|
+
void main(void) {
|
|
116
|
+
#pragma mapbox: initialize highp float weight
|
|
117
|
+
#pragma mapbox: initialize mediump float radius
|
|
118
|
+
vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,get_elevation(floor(a_pos*0.5)),1);gl_Position=u_matrix*pos;}`),heatmapTexture:gt(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;
|
|
119
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
120
|
+
gl_FragColor=vec4(0.0);
|
|
121
|
+
#endif
|
|
122
|
+
}`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:gt("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_anchor_pos;attribute vec2 a_placed;attribute vec2 a_box_real;uniform mat4 u_matrix;uniform vec2 u_pixel_extrude_scale;varying float v_placed;varying float v_notUsed;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:gt("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:gt("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:gt(`#pragma mapbox: define highp vec4 color
|
|
123
|
+
#pragma mapbox: define lowp float opacity
|
|
124
|
+
void main() {
|
|
125
|
+
#pragma mapbox: initialize highp vec4 color
|
|
126
|
+
#pragma mapbox: initialize lowp float opacity
|
|
127
|
+
gl_FragColor=color*opacity;
|
|
128
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
129
|
+
gl_FragColor=vec4(1.0);
|
|
130
|
+
#endif
|
|
131
|
+
}`,`attribute vec2 a_pos;uniform mat4 u_matrix;
|
|
132
|
+
#pragma mapbox: define highp vec4 color
|
|
133
|
+
#pragma mapbox: define lowp float opacity
|
|
134
|
+
void main() {
|
|
135
|
+
#pragma mapbox: initialize highp vec4 color
|
|
136
|
+
#pragma mapbox: initialize lowp float opacity
|
|
137
|
+
gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:gt(`varying vec2 v_pos;
|
|
138
|
+
#pragma mapbox: define highp vec4 outline_color
|
|
139
|
+
#pragma mapbox: define lowp float opacity
|
|
140
|
+
void main() {
|
|
141
|
+
#pragma mapbox: initialize highp vec4 outline_color
|
|
142
|
+
#pragma mapbox: initialize lowp float opacity
|
|
143
|
+
float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);
|
|
144
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
145
|
+
gl_FragColor=vec4(1.0);
|
|
146
|
+
#endif
|
|
147
|
+
}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
|
|
148
|
+
#pragma mapbox: define highp vec4 outline_color
|
|
149
|
+
#pragma mapbox: define lowp float opacity
|
|
150
|
+
void main() {
|
|
151
|
+
#pragma mapbox: initialize highp vec4 outline_color
|
|
152
|
+
#pragma mapbox: initialize lowp float opacity
|
|
153
|
+
gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:gt(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
|
|
154
|
+
#pragma mapbox: define lowp float opacity
|
|
155
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
156
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
157
|
+
void main() {
|
|
158
|
+
#pragma mapbox: initialize lowp float opacity
|
|
159
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
160
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
161
|
+
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;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;
|
|
162
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
163
|
+
gl_FragColor=vec4(1.0);
|
|
164
|
+
#endif
|
|
165
|
+
}`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
|
|
166
|
+
#pragma mapbox: define lowp float opacity
|
|
167
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
168
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
169
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
170
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
171
|
+
void main() {
|
|
172
|
+
#pragma mapbox: initialize lowp float opacity
|
|
173
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
174
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
175
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
176
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
177
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:gt(`#ifdef GL_ES
|
|
178
|
+
precision highp float;
|
|
179
|
+
#endif
|
|
180
|
+
uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
|
|
181
|
+
#pragma mapbox: define lowp float opacity
|
|
182
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
183
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
184
|
+
void main() {
|
|
185
|
+
#pragma mapbox: initialize lowp float opacity
|
|
186
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
187
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
188
|
+
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;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;
|
|
189
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
190
|
+
gl_FragColor=vec4(1.0);
|
|
191
|
+
#endif
|
|
192
|
+
}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;
|
|
193
|
+
#pragma mapbox: define lowp float opacity
|
|
194
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
195
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
196
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
197
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
198
|
+
void main() {
|
|
199
|
+
#pragma mapbox: initialize lowp float opacity
|
|
200
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
201
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
202
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
203
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
204
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:gt(`varying vec4 v_color;void main() {gl_FragColor=v_color;
|
|
205
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
206
|
+
gl_FragColor=vec4(1.0);
|
|
207
|
+
#endif
|
|
208
|
+
}`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
|
|
209
|
+
#ifdef TERRAIN3D
|
|
210
|
+
attribute vec2 a_centroid;
|
|
211
|
+
#endif
|
|
212
|
+
varying vec4 v_color;
|
|
213
|
+
#pragma mapbox: define highp float base
|
|
214
|
+
#pragma mapbox: define highp float height
|
|
215
|
+
#pragma mapbox: define highp vec4 color
|
|
216
|
+
void main() {
|
|
217
|
+
#pragma mapbox: initialize highp float base
|
|
218
|
+
#pragma mapbox: initialize highp float height
|
|
219
|
+
#pragma mapbox: initialize highp vec4 color
|
|
220
|
+
vec3 normal=a_normal_ed.xyz;
|
|
221
|
+
#ifdef TERRAIN3D
|
|
222
|
+
float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
|
|
223
|
+
#else
|
|
224
|
+
float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
|
|
225
|
+
#endif
|
|
226
|
+
base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:gt(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
|
|
227
|
+
#pragma mapbox: define lowp float base
|
|
228
|
+
#pragma mapbox: define lowp float height
|
|
229
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
230
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
231
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
232
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
233
|
+
void main() {
|
|
234
|
+
#pragma mapbox: initialize lowp float base
|
|
235
|
+
#pragma mapbox: initialize lowp float height
|
|
236
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
237
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
238
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
239
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
240
|
+
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;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;
|
|
241
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
242
|
+
gl_FragColor=vec4(1.0);
|
|
243
|
+
#endif
|
|
244
|
+
}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
|
|
245
|
+
#ifdef TERRAIN3D
|
|
246
|
+
attribute vec2 a_centroid;
|
|
247
|
+
#endif
|
|
248
|
+
varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
|
|
249
|
+
#pragma mapbox: define lowp float base
|
|
250
|
+
#pragma mapbox: define lowp float height
|
|
251
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
252
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
253
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
254
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
255
|
+
void main() {
|
|
256
|
+
#pragma mapbox: initialize lowp float base
|
|
257
|
+
#pragma mapbox: initialize lowp float height
|
|
258
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
259
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
260
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
261
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
262
|
+
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;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;
|
|
263
|
+
#ifdef TERRAIN3D
|
|
264
|
+
float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
|
|
265
|
+
#else
|
|
266
|
+
float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
|
|
267
|
+
#endif
|
|
268
|
+
base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
|
|
269
|
+
? a_pos
|
|
270
|
+
: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:gt(`#ifdef GL_ES
|
|
271
|
+
precision highp float;
|
|
272
|
+
#endif
|
|
273
|
+
uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);
|
|
274
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
275
|
+
gl_FragColor=vec4(1.0);
|
|
276
|
+
#endif
|
|
277
|
+
}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:gt(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
|
|
278
|
+
#define PI 3.141592653589793
|
|
279
|
+
void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;
|
|
280
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
281
|
+
gl_FragColor=vec4(1.0);
|
|
282
|
+
#endif
|
|
283
|
+
}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:gt(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
|
|
284
|
+
#pragma mapbox: define highp vec4 color
|
|
285
|
+
#pragma mapbox: define lowp float blur
|
|
286
|
+
#pragma mapbox: define lowp float opacity
|
|
287
|
+
void main() {
|
|
288
|
+
#pragma mapbox: initialize highp vec4 color
|
|
289
|
+
#pragma mapbox: initialize lowp float blur
|
|
290
|
+
#pragma mapbox: initialize lowp float opacity
|
|
291
|
+
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);
|
|
292
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
293
|
+
gl_FragColor=vec4(1.0);
|
|
294
|
+
#endif
|
|
295
|
+
}`,`
|
|
296
|
+
#define scale 0.015873016
|
|
297
|
+
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;
|
|
298
|
+
#pragma mapbox: define highp vec4 color
|
|
299
|
+
#pragma mapbox: define lowp float blur
|
|
300
|
+
#pragma mapbox: define lowp float opacity
|
|
301
|
+
#pragma mapbox: define mediump float gapwidth
|
|
302
|
+
#pragma mapbox: define lowp float offset
|
|
303
|
+
#pragma mapbox: define mediump float width
|
|
304
|
+
void main() {
|
|
305
|
+
#pragma mapbox: initialize highp vec4 color
|
|
306
|
+
#pragma mapbox: initialize lowp float blur
|
|
307
|
+
#pragma mapbox: initialize lowp float opacity
|
|
308
|
+
#pragma mapbox: initialize mediump float gapwidth
|
|
309
|
+
#pragma mapbox: initialize lowp float offset
|
|
310
|
+
#pragma mapbox: initialize mediump float width
|
|
311
|
+
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
|
|
312
|
+
#ifdef TERRAIN3D
|
|
313
|
+
v_gamma_scale=1.0;
|
|
314
|
+
#else
|
|
315
|
+
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
316
|
+
#endif
|
|
317
|
+
v_width2=vec2(outset,inset);}`),lineGradient:gt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;
|
|
318
|
+
#pragma mapbox: define lowp float blur
|
|
319
|
+
#pragma mapbox: define lowp float opacity
|
|
320
|
+
void main() {
|
|
321
|
+
#pragma mapbox: initialize lowp float blur
|
|
322
|
+
#pragma mapbox: initialize lowp float opacity
|
|
323
|
+
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);
|
|
324
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
325
|
+
gl_FragColor=vec4(1.0);
|
|
326
|
+
#endif
|
|
327
|
+
}`,`
|
|
328
|
+
#define scale 0.015873016
|
|
329
|
+
attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;
|
|
330
|
+
#pragma mapbox: define lowp float blur
|
|
331
|
+
#pragma mapbox: define lowp float opacity
|
|
332
|
+
#pragma mapbox: define mediump float gapwidth
|
|
333
|
+
#pragma mapbox: define lowp float offset
|
|
334
|
+
#pragma mapbox: define mediump float width
|
|
335
|
+
void main() {
|
|
336
|
+
#pragma mapbox: initialize lowp float blur
|
|
337
|
+
#pragma mapbox: initialize lowp float opacity
|
|
338
|
+
#pragma mapbox: initialize mediump float gapwidth
|
|
339
|
+
#pragma mapbox: initialize lowp float offset
|
|
340
|
+
#pragma mapbox: initialize mediump float width
|
|
341
|
+
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
|
|
342
|
+
#ifdef TERRAIN3D
|
|
343
|
+
v_gamma_scale=1.0;
|
|
344
|
+
#else
|
|
345
|
+
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
346
|
+
#endif
|
|
347
|
+
v_width2=vec2(outset,inset);}`),linePattern:gt(`#ifdef GL_ES
|
|
348
|
+
precision highp float;
|
|
349
|
+
#endif
|
|
350
|
+
uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
|
|
351
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
352
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
353
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
354
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
355
|
+
#pragma mapbox: define lowp float blur
|
|
356
|
+
#pragma mapbox: define lowp float opacity
|
|
357
|
+
void main() {
|
|
358
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
359
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
360
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
361
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
362
|
+
#pragma mapbox: initialize lowp float blur
|
|
363
|
+
#pragma mapbox: initialize lowp float opacity
|
|
364
|
+
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;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;
|
|
365
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
366
|
+
gl_FragColor=vec4(1.0);
|
|
367
|
+
#endif
|
|
368
|
+
}`,`
|
|
369
|
+
#define scale 0.015873016
|
|
370
|
+
#define LINE_DISTANCE_SCALE 2.0
|
|
371
|
+
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
|
|
372
|
+
#pragma mapbox: define lowp float blur
|
|
373
|
+
#pragma mapbox: define lowp float opacity
|
|
374
|
+
#pragma mapbox: define lowp float offset
|
|
375
|
+
#pragma mapbox: define mediump float gapwidth
|
|
376
|
+
#pragma mapbox: define mediump float width
|
|
377
|
+
#pragma mapbox: define lowp float floorwidth
|
|
378
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
379
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
380
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
381
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
382
|
+
void main() {
|
|
383
|
+
#pragma mapbox: initialize lowp float blur
|
|
384
|
+
#pragma mapbox: initialize lowp float opacity
|
|
385
|
+
#pragma mapbox: initialize lowp float offset
|
|
386
|
+
#pragma mapbox: initialize mediump float gapwidth
|
|
387
|
+
#pragma mapbox: initialize mediump float width
|
|
388
|
+
#pragma mapbox: initialize lowp float floorwidth
|
|
389
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
390
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
391
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
392
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
393
|
+
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
|
|
394
|
+
#ifdef TERRAIN3D
|
|
395
|
+
v_gamma_scale=1.0;
|
|
396
|
+
#else
|
|
397
|
+
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
398
|
+
#endif
|
|
399
|
+
v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:gt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
|
|
400
|
+
#pragma mapbox: define highp vec4 color
|
|
401
|
+
#pragma mapbox: define lowp float blur
|
|
402
|
+
#pragma mapbox: define lowp float opacity
|
|
403
|
+
#pragma mapbox: define mediump float width
|
|
404
|
+
#pragma mapbox: define lowp float floorwidth
|
|
405
|
+
void main() {
|
|
406
|
+
#pragma mapbox: initialize highp vec4 color
|
|
407
|
+
#pragma mapbox: initialize lowp float blur
|
|
408
|
+
#pragma mapbox: initialize lowp float opacity
|
|
409
|
+
#pragma mapbox: initialize mediump float width
|
|
410
|
+
#pragma mapbox: initialize lowp float floorwidth
|
|
411
|
+
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);
|
|
412
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
413
|
+
gl_FragColor=vec4(1.0);
|
|
414
|
+
#endif
|
|
415
|
+
}`,`
|
|
416
|
+
#define scale 0.015873016
|
|
417
|
+
#define LINE_DISTANCE_SCALE 2.0
|
|
418
|
+
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
|
|
419
|
+
#pragma mapbox: define highp vec4 color
|
|
420
|
+
#pragma mapbox: define lowp float blur
|
|
421
|
+
#pragma mapbox: define lowp float opacity
|
|
422
|
+
#pragma mapbox: define mediump float gapwidth
|
|
423
|
+
#pragma mapbox: define lowp float offset
|
|
424
|
+
#pragma mapbox: define mediump float width
|
|
425
|
+
#pragma mapbox: define lowp float floorwidth
|
|
426
|
+
void main() {
|
|
427
|
+
#pragma mapbox: initialize highp vec4 color
|
|
428
|
+
#pragma mapbox: initialize lowp float blur
|
|
429
|
+
#pragma mapbox: initialize lowp float opacity
|
|
430
|
+
#pragma mapbox: initialize mediump float gapwidth
|
|
431
|
+
#pragma mapbox: initialize lowp float offset
|
|
432
|
+
#pragma mapbox: initialize mediump float width
|
|
433
|
+
#pragma mapbox: initialize lowp float floorwidth
|
|
434
|
+
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
|
|
435
|
+
#ifdef TERRAIN3D
|
|
436
|
+
v_gamma_scale=1.0;
|
|
437
|
+
#else
|
|
438
|
+
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
439
|
+
#endif
|
|
440
|
+
v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:gt(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
|
|
441
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
442
|
+
gl_FragColor=vec4(1.0);
|
|
443
|
+
#endif
|
|
444
|
+
}`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:gt(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
|
|
445
|
+
#pragma mapbox: define lowp float opacity
|
|
446
|
+
void main() {
|
|
447
|
+
#pragma mapbox: initialize lowp float opacity
|
|
448
|
+
lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
|
|
449
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
450
|
+
gl_FragColor=vec4(1.0);
|
|
451
|
+
#endif
|
|
452
|
+
}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_tex;varying float v_fade_opacity;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
|
|
453
|
+
#pragma mapbox: define lowp float opacity
|
|
454
|
+
void main() {
|
|
455
|
+
#pragma mapbox: initialize lowp float opacity
|
|
456
|
+
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
457
|
+
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
458
|
+
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:gt(`#define SDF_PX 8.0
|
|
459
|
+
uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;
|
|
460
|
+
#pragma mapbox: define highp vec4 fill_color
|
|
461
|
+
#pragma mapbox: define highp vec4 halo_color
|
|
462
|
+
#pragma mapbox: define lowp float opacity
|
|
463
|
+
#pragma mapbox: define lowp float halo_width
|
|
464
|
+
#pragma mapbox: define lowp float halo_blur
|
|
465
|
+
void main() {
|
|
466
|
+
#pragma mapbox: initialize highp vec4 fill_color
|
|
467
|
+
#pragma mapbox: initialize highp vec4 halo_color
|
|
468
|
+
#pragma mapbox: initialize lowp float opacity
|
|
469
|
+
#pragma mapbox: initialize lowp float halo_width
|
|
470
|
+
#pragma mapbox: initialize lowp float halo_blur
|
|
471
|
+
float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity);
|
|
472
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
473
|
+
gl_FragColor=vec4(1.0);
|
|
474
|
+
#endif
|
|
475
|
+
}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_data0;varying vec3 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
|
|
476
|
+
#pragma mapbox: define highp vec4 fill_color
|
|
477
|
+
#pragma mapbox: define highp vec4 halo_color
|
|
478
|
+
#pragma mapbox: define lowp float opacity
|
|
479
|
+
#pragma mapbox: define lowp float halo_width
|
|
480
|
+
#pragma mapbox: define lowp float halo_blur
|
|
481
|
+
void main() {
|
|
482
|
+
#pragma mapbox: initialize highp vec4 fill_color
|
|
483
|
+
#pragma mapbox: initialize highp vec4 halo_color
|
|
484
|
+
#pragma mapbox: initialize lowp float opacity
|
|
485
|
+
#pragma mapbox: initialize lowp float halo_width
|
|
486
|
+
#pragma mapbox: initialize lowp float halo_blur
|
|
487
|
+
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
488
|
+
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
489
|
+
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:gt(`#define SDF_PX 8.0
|
|
490
|
+
#define SDF 1.0
|
|
491
|
+
#define ICON 0.0
|
|
492
|
+
uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;
|
|
493
|
+
#pragma mapbox: define highp vec4 fill_color
|
|
494
|
+
#pragma mapbox: define highp vec4 halo_color
|
|
495
|
+
#pragma mapbox: define lowp float opacity
|
|
496
|
+
#pragma mapbox: define lowp float halo_width
|
|
497
|
+
#pragma mapbox: define lowp float halo_blur
|
|
498
|
+
void main() {
|
|
499
|
+
#pragma mapbox: initialize highp vec4 fill_color
|
|
500
|
+
#pragma mapbox: initialize highp vec4 halo_color
|
|
501
|
+
#pragma mapbox: initialize lowp float opacity
|
|
502
|
+
#pragma mapbox: initialize lowp float halo_width
|
|
503
|
+
#pragma mapbox: initialize lowp float halo_blur
|
|
504
|
+
float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;
|
|
505
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
506
|
+
gl_FragColor=vec4(1.0);
|
|
507
|
+
#endif
|
|
508
|
+
return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
|
|
509
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
510
|
+
gl_FragColor=vec4(1.0);
|
|
511
|
+
#endif
|
|
512
|
+
}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec4 v_data0;varying vec4 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
|
|
513
|
+
#pragma mapbox: define highp vec4 fill_color
|
|
514
|
+
#pragma mapbox: define highp vec4 halo_color
|
|
515
|
+
#pragma mapbox: define lowp float opacity
|
|
516
|
+
#pragma mapbox: define lowp float halo_width
|
|
517
|
+
#pragma mapbox: define lowp float halo_blur
|
|
518
|
+
void main() {
|
|
519
|
+
#pragma mapbox: initialize highp vec4 fill_color
|
|
520
|
+
#pragma mapbox: initialize highp vec4 halo_color
|
|
521
|
+
#pragma mapbox: initialize lowp float opacity
|
|
522
|
+
#pragma mapbox: initialize lowp float halo_width
|
|
523
|
+
#pragma mapbox: initialize lowp float halo_blur
|
|
524
|
+
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
525
|
+
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
526
|
+
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:gt("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;varying vec2 v_texture_pos;varying float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture2D(u_texture,v_texture_pos);if (v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);gl_FragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {gl_FragColor=surface_color;}}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform mat4 u_fog_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:gt("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:gt("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);}"),sky:gt("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform float u_horizon;uniform float u_sky_horizon_blend;void main() {float y=gl_FragCoord.y;if (y > u_horizon) {float blend=y-u_horizon;if (blend < u_sky_horizon_blend) {gl_FragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {gl_FragColor=u_sky_color;}}}","attribute vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function gt(h,e){let n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,o=e.match(/attribute ([\w]+) ([\w]+)/g),a=h.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),c=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),m=c?c.concat(a):a,_={};return{fragmentSource:h=h.replace(n,((y,b,S,T,E)=>(_[E]=!0,b==="define"?`
|
|
527
|
+
#ifndef HAS_UNIFORM_u_${E}
|
|
528
|
+
varying ${S} ${T} ${E};
|
|
529
|
+
#else
|
|
530
|
+
uniform ${S} ${T} u_${E};
|
|
531
|
+
#endif
|
|
532
|
+
`:`
|
|
533
|
+
#ifdef HAS_UNIFORM_u_${E}
|
|
534
|
+
${S} ${T} ${E} = u_${E};
|
|
535
|
+
#endif
|
|
536
|
+
`))),vertexSource:e=e.replace(n,((y,b,S,T,E)=>{let L=T==="float"?"vec2":"vec4",B=E.match(/color/)?"color":L;return _[E]?b==="define"?`
|
|
537
|
+
#ifndef HAS_UNIFORM_u_${E}
|
|
538
|
+
uniform lowp float u_${E}_t;
|
|
539
|
+
attribute ${S} ${L} a_${E};
|
|
540
|
+
varying ${S} ${T} ${E};
|
|
541
|
+
#else
|
|
542
|
+
uniform ${S} ${T} u_${E};
|
|
543
|
+
#endif
|
|
544
|
+
`:B==="vec4"?`
|
|
545
|
+
#ifndef HAS_UNIFORM_u_${E}
|
|
546
|
+
${E} = a_${E};
|
|
547
|
+
#else
|
|
548
|
+
${S} ${T} ${E} = u_${E};
|
|
549
|
+
#endif
|
|
550
|
+
`:`
|
|
551
|
+
#ifndef HAS_UNIFORM_u_${E}
|
|
552
|
+
${E} = unpack_mix_${B}(a_${E}, u_${E}_t);
|
|
553
|
+
#else
|
|
554
|
+
${S} ${T} ${E} = u_${E};
|
|
555
|
+
#endif
|
|
556
|
+
`:b==="define"?`
|
|
557
|
+
#ifndef HAS_UNIFORM_u_${E}
|
|
558
|
+
uniform lowp float u_${E}_t;
|
|
559
|
+
attribute ${S} ${L} a_${E};
|
|
560
|
+
#else
|
|
561
|
+
uniform ${S} ${T} u_${E};
|
|
562
|
+
#endif
|
|
563
|
+
`:B==="vec4"?`
|
|
564
|
+
#ifndef HAS_UNIFORM_u_${E}
|
|
565
|
+
${S} ${T} ${E} = a_${E};
|
|
566
|
+
#else
|
|
567
|
+
${S} ${T} ${E} = u_${E};
|
|
568
|
+
#endif
|
|
569
|
+
`:`
|
|
570
|
+
#ifndef HAS_UNIFORM_u_${E}
|
|
571
|
+
${S} ${T} ${E} = unpack_mix_${B}(a_${E}, u_${E}_t);
|
|
572
|
+
#else
|
|
573
|
+
${S} ${T} ${E} = u_${E};
|
|
574
|
+
#endif
|
|
575
|
+
`})),staticAttributes:o,staticUniforms:m}}class jo{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,n,o,a,c,m,_,y,b){this.context=e;let S=this.boundPaintVertexBuffers.length!==a.length;for(let T=0;!S&&T<a.length;T++)this.boundPaintVertexBuffers[T]!==a[T]&&(S=!0);!this.vao||this.boundProgram!==n||this.boundLayoutVertexBuffer!==o||S||this.boundIndexBuffer!==c||this.boundVertexOffset!==m||this.boundDynamicVertexBuffer!==_||this.boundDynamicVertexBuffer2!==y||this.boundDynamicVertexBuffer3!==b?this.freshBind(n,o,a,c,m,_,y,b):(e.bindVertexArray.set(this.vao),_&&_.bind(),c&&c.dynamicDraw&&c.bind(),y&&y.bind(),b&&b.bind())}freshBind(e,n,o,a,c,m,_,y){let b=e.numAttributes,S=this.context,T=S.gl;this.vao&&this.destroy(),this.vao=S.createVertexArray(),S.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=o,this.boundIndexBuffer=a,this.boundVertexOffset=c,this.boundDynamicVertexBuffer=m,this.boundDynamicVertexBuffer2=_,this.boundDynamicVertexBuffer3=y,n.enableAttributes(T,e);for(let E of o)E.enableAttributes(T,e);m&&m.enableAttributes(T,e),_&&_.enableAttributes(T,e),y&&y.enableAttributes(T,e),n.bind(),n.setVertexAttribPointers(T,e,c);for(let E of o)E.bind(),E.setVertexAttribPointers(T,e,c);m&&(m.bind(),m.setVertexAttribPointers(T,e,c)),a&&a.bind(),_&&(_.bind(),_.setVertexAttribPointers(T,e,c)),y&&(y.bind(),y.setVertexAttribPointers(T,e,c)),S.currentNumAttributes=b}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}let $o=(h,e,n,o,a)=>({u_matrix:h,u_texture:0,u_ele_delta:e,u_fog_matrix:n,u_fog_color:o?o.properties.get("fog-color"):p.aM.white,u_fog_ground_blend:o?o.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:o?o.calculateFogBlendOpacity(a):0,u_horizon_color:o?o.properties.get("horizon-color"):p.aM.white,u_horizon_fog_blend:o?o.properties.get("horizon-fog-blend"):1});function In(h){let e=[];for(let n=0;n<h.length;n++){if(h[n]===null)continue;let o=h[n].split(" ");e.push(o.pop())}return e}class qo{constructor(e,n,o,a,c,m){let _=e.gl;this.program=_.createProgram();let y=In(n.staticAttributes),b=o?o.getBinderAttributes():[],S=y.concat(b),T=qr.prelude.staticUniforms?In(qr.prelude.staticUniforms):[],E=n.staticUniforms?In(n.staticUniforms):[],L=o?o.getBinderUniforms():[],B=T.concat(E).concat(L),V=[];for(let ne of B)V.indexOf(ne)<0&&V.push(ne);let $=o?o.defines():[];c&&$.push("#define OVERDRAW_INSPECTOR;"),m&&$.push("#define TERRAIN3D;");let q=$.concat(qr.prelude.fragmentSource,n.fragmentSource).join(`
|
|
576
|
+
`),G=$.concat(qr.prelude.vertexSource,n.vertexSource).join(`
|
|
577
|
+
`),F=_.createShader(_.FRAGMENT_SHADER);if(_.isContextLost())return void(this.failedToCreate=!0);if(_.shaderSource(F,q),_.compileShader(F),!_.getShaderParameter(F,_.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${_.getShaderInfoLog(F)}`);_.attachShader(this.program,F);let J=_.createShader(_.VERTEX_SHADER);if(_.isContextLost())return void(this.failedToCreate=!0);if(_.shaderSource(J,G),_.compileShader(J),!_.getShaderParameter(J,_.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${_.getShaderInfoLog(J)}`);_.attachShader(this.program,J),this.attributes={};let Q={};this.numAttributes=S.length;for(let ne=0;ne<this.numAttributes;ne++)S[ne]&&(_.bindAttribLocation(this.program,ne,S[ne]),this.attributes[S[ne]]=ne);if(_.linkProgram(this.program),!_.getProgramParameter(this.program,_.LINK_STATUS))throw new Error(`Program failed to link: ${_.getProgramInfoLog(this.program)}`);_.deleteShader(J),_.deleteShader(F);for(let ne=0;ne<V.length;ne++){let ue=V[ne];if(ue&&!Q[ue]){let me=_.getUniformLocation(this.program,ue);me&&(Q[ue]=me)}}this.fixedUniforms=a(e,Q),this.terrainUniforms=((ne,ue)=>({u_depth:new p.aH(ne,ue.u_depth),u_terrain:new p.aH(ne,ue.u_terrain),u_terrain_dim:new p.aI(ne,ue.u_terrain_dim),u_terrain_matrix:new p.aJ(ne,ue.u_terrain_matrix),u_terrain_unpack:new p.aK(ne,ue.u_terrain_unpack),u_terrain_exaggeration:new p.aI(ne,ue.u_terrain_exaggeration)}))(e,Q),this.binderUniforms=o?o.getUniforms(e,Q):[]}draw(e,n,o,a,c,m,_,y,b,S,T,E,L,B,V,$,q,G){let F=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(o),e.setStencilMode(a),e.setColorMode(c),e.setCullFace(m),y){e.activeTexture.set(F.TEXTURE2),F.bindTexture(F.TEXTURE_2D,y.depthTexture),e.activeTexture.set(F.TEXTURE3),F.bindTexture(F.TEXTURE_2D,y.texture);for(let Q in this.terrainUniforms)this.terrainUniforms[Q].set(y[Q])}for(let Q in this.fixedUniforms)this.fixedUniforms[Q].set(_[Q]);V&&V.setUniforms(e,this.binderUniforms,L,{zoom:B});let J=0;switch(n){case F.LINES:J=2;break;case F.TRIANGLES:J=3;break;case F.LINE_STRIP:J=1}for(let Q of E.get()){let ne=Q.vaos||(Q.vaos={});(ne[b]||(ne[b]=new jo)).bind(e,this,S,V?V.getPaintVertexBuffers():[],T,Q.vertexOffset,$,q,G),F.drawElements(n,Q.primitiveLength*J,F.UNSIGNED_SHORT,Q.primitiveOffset*J*2)}}}function $s(h,e,n){let o=1/ot(n,1,e.transform.tileZoom),a=Math.pow(2,n.tileID.overscaledZ),c=n.tileSize*Math.pow(2,e.transform.tileZoom)/a,m=c*(n.tileID.canonical.x+n.tileID.wrap*a),_=c*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[o,h.fromScale,h.toScale],u_fade:h.t,u_pixel_coord_upper:[m>>16,_>>16],u_pixel_coord_lower:[65535&m,65535&_]}}let fs=(h,e,n,o)=>{let a=e.style.light,c=a.properties.get("position"),m=[c.x,c.y,c.z],_=(function(){var b=new p.A(9);return p.A!=Float32Array&&(b[1]=0,b[2]=0,b[3]=0,b[5]=0,b[6]=0,b[7]=0),b[0]=1,b[4]=1,b[8]=1,b})();a.properties.get("anchor")==="viewport"&&(function(b,S){var T=Math.sin(S),E=Math.cos(S);b[0]=E,b[1]=T,b[2]=0,b[3]=-T,b[4]=E,b[5]=0,b[6]=0,b[7]=0,b[8]=1})(_,-e.transform.angle),(function(b,S,T){var E=S[0],L=S[1],B=S[2];b[0]=E*T[0]+L*T[3]+B*T[6],b[1]=E*T[1]+L*T[4]+B*T[7],b[2]=E*T[2]+L*T[5]+B*T[8]})(m,m,_);let y=a.properties.get("color");return{u_matrix:h,u_lightpos:m,u_lightintensity:a.properties.get("intensity"),u_lightcolor:[y.r,y.g,y.b],u_vertical_gradient:+n,u_opacity:o}},qs=(h,e,n,o,a,c,m)=>p.e(fs(h,e,n,o),$s(c,e,m),{u_height_factor:-Math.pow(2,a.overscaledZ)/m.tileSize/8}),Cn=h=>({u_matrix:h}),Ya=(h,e,n,o)=>p.e(Cn(h),$s(n,e,o)),dc=(h,e)=>({u_matrix:h,u_world:e}),Qa=(h,e,n,o,a)=>p.e(Ya(h,e,n,o),{u_world:a}),pc=(h,e,n,o)=>{let a=h.transform,c,m;if(o.paint.get("circle-pitch-alignment")==="map"){let _=ot(n,1,a.zoom);c=!0,m=[_,_]}else c=!1,m=a.pixelsToGLUnits;return{u_camera_to_center_distance:a.cameraToCenterDistance,u_scale_with_map:+(o.paint.get("circle-pitch-scale")==="map"),u_matrix:h.translatePosMatrix(e.posMatrix,n,o.paint.get("circle-translate"),o.paint.get("circle-translate-anchor")),u_pitch_with_map:+c,u_device_pixel_ratio:h.pixelRatio,u_extrude_scale:m}},nn=(h,e,n)=>({u_matrix:h,u_inv_matrix:e,u_camera_to_center_distance:n.cameraToCenterDistance,u_viewport_size:[n.width,n.height]}),ms=(h,e,n=1)=>({u_matrix:h,u_color:e,u_overlay:0,u_overlay_scale:n}),Ci=h=>({u_matrix:h}),Pi=(h,e,n,o)=>({u_matrix:h,u_extrude_scale:ot(e,1,n),u_intensity:o}),Zs=(h,e,n,o)=>{let a=p.H();p.aP(a,0,h.width,h.height,0,0,1);let c=h.context.gl;return{u_matrix:a,u_world:[c.drawingBufferWidth,c.drawingBufferHeight],u_image:n,u_color_ramp:o,u_opacity:e.paint.get("heatmap-opacity")}};function Gs(h,e){let n=Math.pow(2,e.canonical.z),o=e.canonical.y;return[new p.Z(0,o/n).toLngLat().lat,new p.Z(0,(o+1)/n).toLngLat().lat]}let Hs=(h,e,n,o)=>{let a=h.transform;return{u_matrix:il(h,e,n,o),u_ratio:1/ot(e,1,a.zoom),u_device_pixel_ratio:h.pixelRatio,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},el=(h,e,n,o,a)=>p.e(Hs(h,e,n,a),{u_image:0,u_image_height:o}),Pn=(h,e,n,o,a)=>{let c=h.transform,m=tl(e,c);return{u_matrix:il(h,e,n,a),u_texsize:e.imageAtlasTexture.size,u_ratio:1/ot(e,1,c.zoom),u_device_pixel_ratio:h.pixelRatio,u_image:0,u_scale:[m,o.fromScale,o.toScale],u_fade:o.t,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]]}},fc=(h,e,n,o,a,c)=>{let m=h.lineAtlas,_=tl(e,h.transform),y=n.layout.get("line-cap")==="round",b=m.getDash(o.from,y),S=m.getDash(o.to,y),T=b.width*a.fromScale,E=S.width*a.toScale;return p.e(Hs(h,e,n,c),{u_patternscale_a:[_/T,-b.height/2],u_patternscale_b:[_/E,-S.height/2],u_sdfgamma:m.width/(256*Math.min(T,E)*h.pixelRatio)/2,u_image:0,u_tex_y_a:b.y,u_tex_y_b:S.y,u_mix:a.t})};function tl(h,e){return 1/ot(h,1,e.tileZoom)}function il(h,e,n,o){return h.translatePosMatrix(o?o.posMatrix:e.tileID.posMatrix,e,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}let mc=(h,e,n,o,a)=>{return{u_matrix:h,u_tl_parent:e,u_scale_parent:n,u_buffer_scale:1,u_fade_t:o.mix,u_opacity:o.opacity*a.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:a.paint.get("raster-brightness-min"),u_brightness_high:a.paint.get("raster-brightness-max"),u_saturation_factor:(m=a.paint.get("raster-saturation"),m>0?1-1/(1.001-m):-m),u_contrast_factor:(c=a.paint.get("raster-contrast"),c>0?1/(1-c):1+c),u_spin_weights:gc(a.paint.get("raster-hue-rotate"))};var c,m};function gc(h){h*=Math.PI/180;let e=Math.sin(h),n=Math.cos(h);return[(2*n+1)/3,(-Math.sqrt(3)*e-n+1)/3,(Math.sqrt(3)*e-n+1)/3]}let rl=(h,e,n,o,a,c,m,_,y,b,S,T,E,L)=>{let B=m.transform;return{u_is_size_zoom_constant:+(h==="constant"||h==="source"),u_is_size_feature_constant:+(h==="constant"||h==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:B.cameraToCenterDistance,u_pitch:B.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:B.width/B.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_matrix:_,u_label_plane_matrix:y,u_coord_matrix:b,u_is_text:+T,u_pitch_with_map:+o,u_is_along_line:a,u_is_variable_anchor:c,u_texsize:E,u_texture:0,u_translation:S,u_pitched_scale:L}},gs=(h,e,n,o,a,c,m,_,y,b,S,T,E,L,B)=>{let V=m.transform;return p.e(rl(h,e,n,o,a,c,m,_,y,b,S,T,E,B),{u_gamma_scale:o?Math.cos(V._pitch)*V.cameraToCenterDistance:1,u_device_pixel_ratio:m.pixelRatio,u_is_halo:+L})},Zo=(h,e,n,o,a,c,m,_,y,b,S,T,E,L)=>p.e(gs(h,e,n,o,a,c,m,_,y,b,S,!0,T,!0,L),{u_texsize_icon:E,u_texture_icon:1}),Ws=(h,e,n)=>({u_matrix:h,u_opacity:e,u_color:n}),Go=(h,e,n,o,a,c)=>p.e((function(m,_,y,b){let S=y.imageManager.getPattern(m.from.toString()),T=y.imageManager.getPattern(m.to.toString()),{width:E,height:L}=y.imageManager.getPixelSize(),B=Math.pow(2,b.tileID.overscaledZ),V=b.tileSize*Math.pow(2,y.transform.tileZoom)/B,$=V*(b.tileID.canonical.x+b.tileID.wrap*B),q=V*b.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:S.tl,u_pattern_br_a:S.br,u_pattern_tl_b:T.tl,u_pattern_br_b:T.br,u_texsize:[E,L],u_mix:_.t,u_pattern_size_a:S.displaySize,u_pattern_size_b:T.displaySize,u_scale_a:_.fromScale,u_scale_b:_.toScale,u_tile_units_to_pixels:1/ot(b,1,y.transform.tileZoom),u_pixel_coord_upper:[$>>16,q>>16],u_pixel_coord_lower:[65535&$,65535&q]}})(o,c,n,a),{u_matrix:h,u_opacity:e}),Ho={fillExtrusion:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_lightpos:new p.aN(h,e.u_lightpos),u_lightintensity:new p.aI(h,e.u_lightintensity),u_lightcolor:new p.aN(h,e.u_lightcolor),u_vertical_gradient:new p.aI(h,e.u_vertical_gradient),u_opacity:new p.aI(h,e.u_opacity)}),fillExtrusionPattern:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_lightpos:new p.aN(h,e.u_lightpos),u_lightintensity:new p.aI(h,e.u_lightintensity),u_lightcolor:new p.aN(h,e.u_lightcolor),u_vertical_gradient:new p.aI(h,e.u_vertical_gradient),u_height_factor:new p.aI(h,e.u_height_factor),u_image:new p.aH(h,e.u_image),u_texsize:new p.aO(h,e.u_texsize),u_pixel_coord_upper:new p.aO(h,e.u_pixel_coord_upper),u_pixel_coord_lower:new p.aO(h,e.u_pixel_coord_lower),u_scale:new p.aN(h,e.u_scale),u_fade:new p.aI(h,e.u_fade),u_opacity:new p.aI(h,e.u_opacity)}),fill:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix)}),fillPattern:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_image:new p.aH(h,e.u_image),u_texsize:new p.aO(h,e.u_texsize),u_pixel_coord_upper:new p.aO(h,e.u_pixel_coord_upper),u_pixel_coord_lower:new p.aO(h,e.u_pixel_coord_lower),u_scale:new p.aN(h,e.u_scale),u_fade:new p.aI(h,e.u_fade)}),fillOutline:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_world:new p.aO(h,e.u_world)}),fillOutlinePattern:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_world:new p.aO(h,e.u_world),u_image:new p.aH(h,e.u_image),u_texsize:new p.aO(h,e.u_texsize),u_pixel_coord_upper:new p.aO(h,e.u_pixel_coord_upper),u_pixel_coord_lower:new p.aO(h,e.u_pixel_coord_lower),u_scale:new p.aN(h,e.u_scale),u_fade:new p.aI(h,e.u_fade)}),circle:(h,e)=>({u_camera_to_center_distance:new p.aI(h,e.u_camera_to_center_distance),u_scale_with_map:new p.aH(h,e.u_scale_with_map),u_pitch_with_map:new p.aH(h,e.u_pitch_with_map),u_extrude_scale:new p.aO(h,e.u_extrude_scale),u_device_pixel_ratio:new p.aI(h,e.u_device_pixel_ratio),u_matrix:new p.aJ(h,e.u_matrix)}),collisionBox:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_pixel_extrude_scale:new p.aO(h,e.u_pixel_extrude_scale)}),collisionCircle:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_inv_matrix:new p.aJ(h,e.u_inv_matrix),u_camera_to_center_distance:new p.aI(h,e.u_camera_to_center_distance),u_viewport_size:new p.aO(h,e.u_viewport_size)}),debug:(h,e)=>({u_color:new p.aL(h,e.u_color),u_matrix:new p.aJ(h,e.u_matrix),u_overlay:new p.aH(h,e.u_overlay),u_overlay_scale:new p.aI(h,e.u_overlay_scale)}),clippingMask:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix)}),heatmap:(h,e)=>({u_extrude_scale:new p.aI(h,e.u_extrude_scale),u_intensity:new p.aI(h,e.u_intensity),u_matrix:new p.aJ(h,e.u_matrix)}),heatmapTexture:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_world:new p.aO(h,e.u_world),u_image:new p.aH(h,e.u_image),u_color_ramp:new p.aH(h,e.u_color_ramp),u_opacity:new p.aI(h,e.u_opacity)}),hillshade:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_image:new p.aH(h,e.u_image),u_latrange:new p.aO(h,e.u_latrange),u_light:new p.aO(h,e.u_light),u_shadow:new p.aL(h,e.u_shadow),u_highlight:new p.aL(h,e.u_highlight),u_accent:new p.aL(h,e.u_accent)}),hillshadePrepare:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_image:new p.aH(h,e.u_image),u_dimension:new p.aO(h,e.u_dimension),u_zoom:new p.aI(h,e.u_zoom),u_unpack:new p.aK(h,e.u_unpack)}),line:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_ratio:new p.aI(h,e.u_ratio),u_device_pixel_ratio:new p.aI(h,e.u_device_pixel_ratio),u_units_to_pixels:new p.aO(h,e.u_units_to_pixels)}),lineGradient:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_ratio:new p.aI(h,e.u_ratio),u_device_pixel_ratio:new p.aI(h,e.u_device_pixel_ratio),u_units_to_pixels:new p.aO(h,e.u_units_to_pixels),u_image:new p.aH(h,e.u_image),u_image_height:new p.aI(h,e.u_image_height)}),linePattern:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_texsize:new p.aO(h,e.u_texsize),u_ratio:new p.aI(h,e.u_ratio),u_device_pixel_ratio:new p.aI(h,e.u_device_pixel_ratio),u_image:new p.aH(h,e.u_image),u_units_to_pixels:new p.aO(h,e.u_units_to_pixels),u_scale:new p.aN(h,e.u_scale),u_fade:new p.aI(h,e.u_fade)}),lineSDF:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_ratio:new p.aI(h,e.u_ratio),u_device_pixel_ratio:new p.aI(h,e.u_device_pixel_ratio),u_units_to_pixels:new p.aO(h,e.u_units_to_pixels),u_patternscale_a:new p.aO(h,e.u_patternscale_a),u_patternscale_b:new p.aO(h,e.u_patternscale_b),u_sdfgamma:new p.aI(h,e.u_sdfgamma),u_image:new p.aH(h,e.u_image),u_tex_y_a:new p.aI(h,e.u_tex_y_a),u_tex_y_b:new p.aI(h,e.u_tex_y_b),u_mix:new p.aI(h,e.u_mix)}),raster:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_tl_parent:new p.aO(h,e.u_tl_parent),u_scale_parent:new p.aI(h,e.u_scale_parent),u_buffer_scale:new p.aI(h,e.u_buffer_scale),u_fade_t:new p.aI(h,e.u_fade_t),u_opacity:new p.aI(h,e.u_opacity),u_image0:new p.aH(h,e.u_image0),u_image1:new p.aH(h,e.u_image1),u_brightness_low:new p.aI(h,e.u_brightness_low),u_brightness_high:new p.aI(h,e.u_brightness_high),u_saturation_factor:new p.aI(h,e.u_saturation_factor),u_contrast_factor:new p.aI(h,e.u_contrast_factor),u_spin_weights:new p.aN(h,e.u_spin_weights)}),symbolIcon:(h,e)=>({u_is_size_zoom_constant:new p.aH(h,e.u_is_size_zoom_constant),u_is_size_feature_constant:new p.aH(h,e.u_is_size_feature_constant),u_size_t:new p.aI(h,e.u_size_t),u_size:new p.aI(h,e.u_size),u_camera_to_center_distance:new p.aI(h,e.u_camera_to_center_distance),u_pitch:new p.aI(h,e.u_pitch),u_rotate_symbol:new p.aH(h,e.u_rotate_symbol),u_aspect_ratio:new p.aI(h,e.u_aspect_ratio),u_fade_change:new p.aI(h,e.u_fade_change),u_matrix:new p.aJ(h,e.u_matrix),u_label_plane_matrix:new p.aJ(h,e.u_label_plane_matrix),u_coord_matrix:new p.aJ(h,e.u_coord_matrix),u_is_text:new p.aH(h,e.u_is_text),u_pitch_with_map:new p.aH(h,e.u_pitch_with_map),u_is_along_line:new p.aH(h,e.u_is_along_line),u_is_variable_anchor:new p.aH(h,e.u_is_variable_anchor),u_texsize:new p.aO(h,e.u_texsize),u_texture:new p.aH(h,e.u_texture),u_translation:new p.aO(h,e.u_translation),u_pitched_scale:new p.aI(h,e.u_pitched_scale)}),symbolSDF:(h,e)=>({u_is_size_zoom_constant:new p.aH(h,e.u_is_size_zoom_constant),u_is_size_feature_constant:new p.aH(h,e.u_is_size_feature_constant),u_size_t:new p.aI(h,e.u_size_t),u_size:new p.aI(h,e.u_size),u_camera_to_center_distance:new p.aI(h,e.u_camera_to_center_distance),u_pitch:new p.aI(h,e.u_pitch),u_rotate_symbol:new p.aH(h,e.u_rotate_symbol),u_aspect_ratio:new p.aI(h,e.u_aspect_ratio),u_fade_change:new p.aI(h,e.u_fade_change),u_matrix:new p.aJ(h,e.u_matrix),u_label_plane_matrix:new p.aJ(h,e.u_label_plane_matrix),u_coord_matrix:new p.aJ(h,e.u_coord_matrix),u_is_text:new p.aH(h,e.u_is_text),u_pitch_with_map:new p.aH(h,e.u_pitch_with_map),u_is_along_line:new p.aH(h,e.u_is_along_line),u_is_variable_anchor:new p.aH(h,e.u_is_variable_anchor),u_texsize:new p.aO(h,e.u_texsize),u_texture:new p.aH(h,e.u_texture),u_gamma_scale:new p.aI(h,e.u_gamma_scale),u_device_pixel_ratio:new p.aI(h,e.u_device_pixel_ratio),u_is_halo:new p.aH(h,e.u_is_halo),u_translation:new p.aO(h,e.u_translation),u_pitched_scale:new p.aI(h,e.u_pitched_scale)}),symbolTextAndIcon:(h,e)=>({u_is_size_zoom_constant:new p.aH(h,e.u_is_size_zoom_constant),u_is_size_feature_constant:new p.aH(h,e.u_is_size_feature_constant),u_size_t:new p.aI(h,e.u_size_t),u_size:new p.aI(h,e.u_size),u_camera_to_center_distance:new p.aI(h,e.u_camera_to_center_distance),u_pitch:new p.aI(h,e.u_pitch),u_rotate_symbol:new p.aH(h,e.u_rotate_symbol),u_aspect_ratio:new p.aI(h,e.u_aspect_ratio),u_fade_change:new p.aI(h,e.u_fade_change),u_matrix:new p.aJ(h,e.u_matrix),u_label_plane_matrix:new p.aJ(h,e.u_label_plane_matrix),u_coord_matrix:new p.aJ(h,e.u_coord_matrix),u_is_text:new p.aH(h,e.u_is_text),u_pitch_with_map:new p.aH(h,e.u_pitch_with_map),u_is_along_line:new p.aH(h,e.u_is_along_line),u_is_variable_anchor:new p.aH(h,e.u_is_variable_anchor),u_texsize:new p.aO(h,e.u_texsize),u_texsize_icon:new p.aO(h,e.u_texsize_icon),u_texture:new p.aH(h,e.u_texture),u_texture_icon:new p.aH(h,e.u_texture_icon),u_gamma_scale:new p.aI(h,e.u_gamma_scale),u_device_pixel_ratio:new p.aI(h,e.u_device_pixel_ratio),u_is_halo:new p.aH(h,e.u_is_halo),u_translation:new p.aO(h,e.u_translation),u_pitched_scale:new p.aI(h,e.u_pitched_scale)}),background:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_opacity:new p.aI(h,e.u_opacity),u_color:new p.aL(h,e.u_color)}),backgroundPattern:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_opacity:new p.aI(h,e.u_opacity),u_image:new p.aH(h,e.u_image),u_pattern_tl_a:new p.aO(h,e.u_pattern_tl_a),u_pattern_br_a:new p.aO(h,e.u_pattern_br_a),u_pattern_tl_b:new p.aO(h,e.u_pattern_tl_b),u_pattern_br_b:new p.aO(h,e.u_pattern_br_b),u_texsize:new p.aO(h,e.u_texsize),u_mix:new p.aI(h,e.u_mix),u_pattern_size_a:new p.aO(h,e.u_pattern_size_a),u_pattern_size_b:new p.aO(h,e.u_pattern_size_b),u_scale_a:new p.aI(h,e.u_scale_a),u_scale_b:new p.aI(h,e.u_scale_b),u_pixel_coord_upper:new p.aO(h,e.u_pixel_coord_upper),u_pixel_coord_lower:new p.aO(h,e.u_pixel_coord_lower),u_tile_units_to_pixels:new p.aI(h,e.u_tile_units_to_pixels)}),terrain:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_texture:new p.aH(h,e.u_texture),u_ele_delta:new p.aI(h,e.u_ele_delta),u_fog_matrix:new p.aJ(h,e.u_fog_matrix),u_fog_color:new p.aL(h,e.u_fog_color),u_fog_ground_blend:new p.aI(h,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new p.aI(h,e.u_fog_ground_blend_opacity),u_horizon_color:new p.aL(h,e.u_horizon_color),u_horizon_fog_blend:new p.aI(h,e.u_horizon_fog_blend)}),terrainDepth:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_ele_delta:new p.aI(h,e.u_ele_delta)}),terrainCoords:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_texture:new p.aH(h,e.u_texture),u_terrain_coords_id:new p.aI(h,e.u_terrain_coords_id),u_ele_delta:new p.aI(h,e.u_ele_delta)}),sky:(h,e)=>({u_sky_color:new p.aL(h,e.u_sky_color),u_horizon_color:new p.aL(h,e.u_horizon_color),u_horizon:new p.aI(h,e.u_horizon),u_sky_horizon_blend:new p.aI(h,e.u_sky_horizon_blend)})};class Sr{constructor(e,n,o){this.context=e;let a=e.gl;this.buffer=a.createBuffer(),this.dynamicDraw=!!o,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let 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,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let _c={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Wo{constructor(e,n,o,a){this.length=n.length,this.attributes=o,this.itemSize=n.bytesPerElement,this.dynamicDraw=a,this.context=e;let c=e.gl;this.buffer=c.createBuffer(),e.bindVertexBuffer.set(this.buffer),c.bufferData(c.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?c.DYNAMIC_DRAW:c.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);let n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,n){for(let o=0;o<this.attributes.length;o++){let a=n.attributes[this.attributes[o].name];a!==void 0&&e.enableVertexAttribArray(a)}}setVertexAttribPointers(e,n,o){for(let a=0;a<this.attributes.length;a++){let c=this.attributes[a],m=n.attributes[c.name];m!==void 0&&e.vertexAttribPointer(m,c.components,e[_c[c.type]],!1,this.itemSize,c.offset+this.itemSize*(o||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let sn=new WeakMap;function Zr(h){var e;if(sn.has(h))return sn.get(h);{let n=(e=h.getParameter(h.VERSION))===null||e===void 0?void 0:e.startsWith("WebGL 2.0");return sn.set(h,n),n}}class yt{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Xs extends yt{getDefault(){return p.aM.transparent}set(e){let n=this.current;(e.r!==n.r||e.g!==n.g||e.b!==n.b||e.a!==n.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class yc extends yt{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class Mn extends yt{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class xc extends yt{getDefault(){return[!0,!0,!0,!0]}set(e){let n=this.current;(e[0]!==n[0]||e[1]!==n[1]||e[2]!==n[2]||e[3]!==n[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class nl extends yt{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class vc extends yt{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class sl extends yt{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let n=this.current;(e.func!==n.func||e.ref!==n.ref||e.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class Xo extends yt{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let n=this.current;(e[0]!==n[0]||e[1]!==n[1]||e[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class ol extends yt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;e?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=e,this.dirty=!1}}class al extends yt{getDefault(){return[0,1]}set(e){let n=this.current;(e[0]!==n[0]||e[1]!==n[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class ll extends yt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;e?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=e,this.dirty=!1}}class cl extends yt{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class on extends yt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;e?n.enable(n.BLEND):n.disable(n.BLEND),this.current=e,this.dirty=!1}}class hl extends yt{getDefault(){let e=this.gl;return[e.ONE,e.ZERO]}set(e){let n=this.current;(e[0]!==n[0]||e[1]!==n[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}class bc extends yt{getDefault(){return p.aM.transparent}set(e){let n=this.current;(e.r!==n.r||e.g!==n.g||e.b!==n.b||e.a!==n.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class ul extends yt{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class _s extends yt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;e?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=e,this.dirty=!1}}class wc extends yt{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class Ks extends yt{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class Sc extends yt{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class Tc extends yt{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class dl extends yt{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let n=this.current;(e[0]!==n[0]||e[1]!==n[1]||e[2]!==n[2]||e[3]!==n[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class pl extends yt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class fl extends yt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Ko extends yt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;n.bindTexture(n.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class ml extends yt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Js extends yt{getDefault(){return null}set(e){let n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Lr extends yt{getDefault(){return null}set(e){var n;if(e===this.current&&!this.dirty)return;let o=this.gl;Zr(o)?o.bindVertexArray(e):(n=o.getExtension("OES_vertex_array_object"))===null||n===void 0||n.bindVertexArrayOES(e),this.current=e,this.dirty=!1}}class Jo extends yt{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class Yo extends yt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class Qo extends yt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class Ys extends yt{constructor(e,n){super(e),this.context=e,this.parent=n}getDefault(){return null}}class ea extends Ys{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class an extends Ys{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class ta extends Ys{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Ic{constructor(e,n,o,a,c){this.context=e,this.width=n,this.height=o;let m=e.gl,_=this.framebuffer=m.createFramebuffer();if(this.colorAttachment=new ea(e,_),a)this.depthAttachment=c?new ta(e,_):new an(e,_);else if(c)throw new Error("Stencil cannot be set without depth");if(m.checkFramebufferStatus(m.FRAMEBUFFER)!==m.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){let e=this.context.gl,n=this.colorAttachment.get();if(n&&e.deleteTexture(n),this.depthAttachment){let o=this.depthAttachment.get();o&&e.deleteRenderbuffer(o)}e.deleteFramebuffer(this.framebuffer)}}class Ut{constructor(e,n,o){this.blendFunction=e,this.blendColor=n,this.mask=o}}Ut.Replace=[1,0],Ut.disabled=new Ut(Ut.Replace,p.aM.transparent,[!1,!1,!1,!1]),Ut.unblended=new Ut(Ut.Replace,p.aM.transparent,[!0,!0,!0,!0]),Ut.alphaBlended=new Ut([1,771],p.aM.transparent,[!0,!0,!0,!0]);class Cc{constructor(e){var n,o;if(this.gl=e,this.clearColor=new Xs(this),this.clearDepth=new yc(this),this.clearStencil=new Mn(this),this.colorMask=new xc(this),this.depthMask=new nl(this),this.stencilMask=new vc(this),this.stencilFunc=new sl(this),this.stencilOp=new Xo(this),this.stencilTest=new ol(this),this.depthRange=new al(this),this.depthTest=new ll(this),this.depthFunc=new cl(this),this.blend=new on(this),this.blendFunc=new hl(this),this.blendColor=new bc(this),this.blendEquation=new ul(this),this.cullFace=new _s(this),this.cullFaceSide=new wc(this),this.frontFace=new Ks(this),this.program=new Sc(this),this.activeTexture=new Tc(this),this.viewport=new dl(this),this.bindFramebuffer=new pl(this),this.bindRenderbuffer=new fl(this),this.bindTexture=new Ko(this),this.bindVertexBuffer=new ml(this),this.bindElementBuffer=new Js(this),this.bindVertexArray=new Lr(this),this.pixelStoreUnpack=new Jo(this),this.pixelStoreUnpackPremultiplyAlpha=new Yo(this),this.pixelStoreUnpackFlipY=new Qo(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),Zr(e)){this.HALF_FLOAT=e.HALF_FLOAT;let a=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(n=e.RGBA16F)!==null&&n!==void 0?n:a?.RGBA16F_EXT,this.RGB16F=(o=e.RGB16F)!==null&&o!==void 0?o:a?.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");let a=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=a?.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,n){return new Sr(this,e,n)}createVertexBuffer(e,n,o){return new Wo(this,e,n,o)}createRenderbuffer(e,n,o){let a=this.gl,c=a.createRenderbuffer();return this.bindRenderbuffer.set(c),a.renderbufferStorage(a.RENDERBUFFER,e,n,o),this.bindRenderbuffer.set(null),c}createFramebuffer(e,n,o,a){return new Ic(this,e,n,o,a)}clear({color:e,depth:n,stencil:o}){let a=this.gl,c=0;e&&(c|=a.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(c|=a.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),o!==void 0&&(c|=a.STENCIL_BUFFER_BIT,this.clearStencil.set(o),this.stencilMask.set(255)),a.clear(c)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){p.aE(e.blendFunction,Ut.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var e;return Zr(this.gl)?this.gl.createVertexArray():(e=this.gl.getExtension("OES_vertex_array_object"))===null||e===void 0?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var n;return Zr(this.gl)?this.gl.deleteVertexArray(e):(n=this.gl.getExtension("OES_vertex_array_object"))===null||n===void 0?void 0:n.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}}class nt{constructor(e,n,o){this.func=e,this.mask=n,this.range=o}}nt.ReadOnly=!1,nt.ReadWrite=!0,nt.disabled=new nt(519,nt.ReadOnly,[0,1]);let Qs=7680;class It{constructor(e,n,o,a,c,m){this.test=e,this.ref=n,this.mask=o,this.fail=a,this.depthFail=c,this.pass=m}}It.disabled=new It({func:519,mask:0},0,0,Qs,Qs,Qs);class bt{constructor(e,n,o){this.enable=e,this.mode=n,this.frontFace=o}}let ln;function ys(h,e,n,o,a){let c=h.context,m=c.gl,_=h.useProgram("collisionBox"),y=[],b=0,S=0;for(let q=0;q<o.length;q++){let G=o[q],F=e.getTile(G).getBucket(n);if(!F)continue;let J=a?F.textCollisionBox:F.iconCollisionBox,Q=F.collisionCircleArray;if(Q.length>0){let ne=p.H();p.aQ(ne,F.placementInvProjMatrix,h.transform.glCoordMatrix),p.aQ(ne,ne,F.placementViewportMatrix),y.push({circleArray:Q,circleOffset:S,transform:G.posMatrix,invTransform:ne,coord:G}),b+=Q.length/4,S=b}J&&_.draw(c,m.LINES,nt.disabled,It.disabled,h.colorModeForRenderPass(),bt.disabled,{u_matrix:G.posMatrix,u_pixel_extrude_scale:[1/(T=h.transform).width,1/T.height]},h.style.map.terrain&&h.style.map.terrain.getTerrainData(G),n.id,J.layoutVertexBuffer,J.indexBuffer,J.segments,null,h.transform.zoom,null,null,J.collisionVertexBuffer)}var T;if(!a||!y.length)return;let E=h.useProgram("collisionCircle"),L=new p.aR;L.resize(4*b),L._trim();let B=0;for(let q of y)for(let G=0;G<q.circleArray.length/4;G++){let F=4*G,J=q.circleArray[F+0],Q=q.circleArray[F+1],ne=q.circleArray[F+2],ue=q.circleArray[F+3];L.emplace(B++,J,Q,ne,ue,0),L.emplace(B++,J,Q,ne,ue,1),L.emplace(B++,J,Q,ne,ue,2),L.emplace(B++,J,Q,ne,ue,3)}(!ln||ln.length<2*b)&&(ln=(function(q){let G=2*q,F=new p.aT;F.resize(G),F._trim();for(let J=0;J<G;J++){let Q=6*J;F.uint16[Q+0]=4*J+0,F.uint16[Q+1]=4*J+1,F.uint16[Q+2]=4*J+2,F.uint16[Q+3]=4*J+2,F.uint16[Q+4]=4*J+3,F.uint16[Q+5]=4*J+0}return F})(b));let V=c.createIndexBuffer(ln,!0),$=c.createVertexBuffer(L,p.aS.members,!0);for(let q of y){let G=nn(q.transform,q.invTransform,h.transform);E.draw(c,m.TRIANGLES,nt.disabled,It.disabled,h.colorModeForRenderPass(),bt.disabled,G,h.style.map.terrain&&h.style.map.terrain.getTerrainData(q.coord),n.id,$,V,p.a0.simpleSegment(0,2*q.circleOffset,q.circleArray.length,q.circleArray.length/2),null,h.transform.zoom,null,null,null)}$.destroy(),V.destroy()}bt.disabled=new bt(!1,1029,2305),bt.backCCW=new bt(!0,1029,2305);let xs=p.an(new Float32Array(16));function ia(h,e,n,o,a,c){let{horizontalAlign:m,verticalAlign:_}=p.au(h);return new p.P((-(m-.5)*e/a+o[0])*c,(-(_-.5)*n/a+o[1])*c)}function cn(h,e,n,o,a,c){let m=e.tileAnchorPoint.add(new p.P(e.translation[0],e.translation[1]));if(e.pitchWithMap){let _=o.mult(c);n||(_=_.rotate(-a));let y=m.add(_);return U(y.x,y.y,e.labelPlaneMatrix,e.getElevation).point}if(n){let _=le(e.tileAnchorPoint.x+1,e.tileAnchorPoint.y,e).point.sub(h),y=Math.atan(_.y/_.x)+(_.x<0?Math.PI:0);return h.add(o.rotate(y))}return h.add(o)}function An(h,e,n,o,a,c,m,_,y,b,S,T,E,L){let B=h.text.placedSymbolArray,V=h.text.dynamicLayoutVertexArray,$=h.icon.dynamicLayoutVertexArray,q={};V.clear();for(let G=0;G<B.length;G++){let F=B.get(G),J=F.hidden||!F.crossTileID||h.allowVerticalPlacement&&!F.placedOrientation?null:o[F.crossTileID];if(J){let Q=new p.P(F.anchorX,F.anchorY),ne={getElevation:L,width:a.width,height:a.height,labelPlaneMatrix:c,lineVertexArray:null,pitchWithMap:n,projection:S,projectionCache:null,tileAnchorPoint:Q,translation:T,unwrappedTileID:E},ue=n?U(Q.x,Q.y,m,L):le(Q.x,Q.y,ne),me=M(a.cameraToCenterDistance,ue.signedDistanceFromCamera),Te=p.ai(h.textSizeData,y,F)*me/p.ap;n&&(Te*=h.tilePixelRatio/_);let{width:Ae,height:xe,anchor:ye,textOffset:Re,textBoxScale:We}=J,be=ia(ye,Ae,xe,Re,We,Te),Pe=S.getPitchedTextCorrection(a,Q.add(new p.P(T[0],T[1])),E),Ze=cn(ue.point,ne,e,be,a.angle,Pe),Et=h.allowVerticalPlacement&&F.placedOrientation===p.ah.vertical?Math.PI/2:0;for(let Qe=0;Qe<F.numGlyphs;Qe++)p.aj(V,Ze,Et);b&&F.associatedIconIndex>=0&&(q[F.associatedIconIndex]={shiftedAnchor:Ze,angle:Et})}else Ve(F.numGlyphs,V)}if(b){$.clear();let G=h.icon.placedSymbolArray;for(let F=0;F<G.length;F++){let J=G.get(F);if(J.hidden)Ve(J.numGlyphs,$);else{let Q=q[F];if(Q)for(let ne=0;ne<J.numGlyphs;ne++)p.aj($,Q.shiftedAnchor,Q.angle);else Ve(J.numGlyphs,$)}}h.icon.dynamicLayoutVertexBuffer.updateData($)}h.text.dynamicLayoutVertexBuffer.updateData(V)}function Gi(h,e,n){return n.iconsInText&&e?"symbolTextAndIcon":h?"symbolSDF":"symbolIcon"}function ra(h,e,n,o,a,c,m,_,y,b,S,T){let E=h.context,L=E.gl,B=h.transform,V=tn(),$=_==="map",q=y==="map",G=_!=="viewport"&&n.layout.get("symbol-placement")!=="point",F=$&&!q&&!G,J=!q&&G,Q=!n.layout.get("symbol-sort-key").isConstant(),ne=!1,ue=h.depthModeForSublayer(0,nt.ReadOnly),me=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Te=[],Ae=V.getCircleRadiusCorrection(B);for(let xe of o){let ye=e.getTile(xe),Re=ye.getBucket(n);if(!Re)continue;let We=a?Re.text:Re.icon;if(!We||!We.segments.get().length||!We.hasVisibleVertices)continue;let be=We.programConfigurations.get(n.id),Pe=a||Re.sdfIcons,Ze=a?Re.textSizeData:Re.iconSizeData,Et=q||B.pitch!==0,Qe=h.useProgram(Gi(Pe,a,Re),be),at=p.ag(Ze,B.zoom),kt=h.style.map.terrain&&h.style.map.terrain.getTerrainData(xe),ui,cr,zt,Mi,bi=[0,0],di=null;if(a)cr=ye.glyphAtlasTexture,zt=L.LINEAR,ui=ye.glyphAtlasTexture.size,Re.iconsInText&&(bi=ye.imageAtlasTexture.size,di=ye.imageAtlasTexture,Mi=Et||h.options.rotating||h.options.zooming||Ze.kind==="composite"||Ze.kind==="camera"?L.LINEAR:L.NEAREST);else{let ct=n.layout.get("icon-size").constantOr(0)!==1||Re.iconsNeedLinear;cr=ye.imageAtlasTexture,zt=Pe||h.options.rotating||h.options.zooming||ct||Et?L.LINEAR:L.NEAREST,ui=ye.imageAtlasTexture.size}let wi=ot(ye,1,h.transform.zoom),Cr=J?xe.posMatrix:xs,Zn=$r(Cr,q,$,h.transform,wi),xo=wr(Cr,q,$,h.transform,wi),Gn=wr(xe.posMatrix,q,$,h.transform,wi),Xi=V.translatePosition(h.transform,ye,c,m),vo=me&&Re.hasTextData(),Ma=n.layout.get("icon-text-fit")!=="none"&&vo&&Re.hasIconData();if(G){let ct=h.style.map.terrain?(Hn,Wn)=>h.style.map.terrain.getElevation(xe,Hn,Wn):null,fn=n.layout.get("text-rotation-alignment")==="map";D(Re,xe.posMatrix,h,a,Zn,Gn,q,b,fn,V,xe.toUnwrapped(),B.width,B.height,Xi,ct)}let Ki=xe.posMatrix,Ji=a&&me||Ma,Gr=G||Ji?xs:Zn,hr=xo,oi=Pe&&n.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1)!==0,pi;pi=Pe?Re.iconsInText?Zo(Ze.kind,at,F,q,G,Ji,h,Ki,Gr,hr,Xi,ui,bi,Ae):gs(Ze.kind,at,F,q,G,Ji,h,Ki,Gr,hr,Xi,a,ui,!0,Ae):rl(Ze.kind,at,F,q,G,Ji,h,Ki,Gr,hr,Xi,a,ui,Ae);let Vi={program:Qe,buffers:We,uniformValues:pi,atlasTexture:cr,atlasTextureIcon:di,atlasInterpolation:zt,atlasInterpolationIcon:Mi,isSDF:Pe,hasHalo:oi};if(Q&&Re.canOverlap){ne=!0;let ct=We.segments.get();for(let fn of ct)Te.push({segments:new p.a0([fn]),sortKey:fn.sortKey,state:Vi,terrainData:kt})}else Te.push({segments:We.segments,sortKey:0,state:Vi,terrainData:kt})}ne&&Te.sort(((xe,ye)=>xe.sortKey-ye.sortKey));for(let xe of Te){let ye=xe.state;if(E.activeTexture.set(L.TEXTURE0),ye.atlasTexture.bind(ye.atlasInterpolation,L.CLAMP_TO_EDGE),ye.atlasTextureIcon&&(E.activeTexture.set(L.TEXTURE1),ye.atlasTextureIcon&&ye.atlasTextureIcon.bind(ye.atlasInterpolationIcon,L.CLAMP_TO_EDGE)),ye.isSDF){let Re=ye.uniformValues;ye.hasHalo&&(Re.u_is_halo=1,na(ye.buffers,xe.segments,n,h,ye.program,ue,S,T,Re,xe.terrainData)),Re.u_is_halo=0}na(ye.buffers,xe.segments,n,h,ye.program,ue,S,T,ye.uniformValues,xe.terrainData)}}function na(h,e,n,o,a,c,m,_,y,b){let S=o.context;a.draw(S,S.gl.TRIANGLES,c,m,_,bt.disabled,y,b,n.id,h.layoutVertexBuffer,h.indexBuffer,e,n.paint,o.transform.zoom,h.programConfigurations.get(n.id),h.dynamicLayoutVertexBuffer,h.opacityVertexBuffer)}function sa(h,e,n,o){let a=h.context,c=a.gl,m=It.disabled,_=new Ut([c.ONE,c.ONE],p.aM.transparent,[!0,!0,!0,!0]),y=e.getBucket(n);if(!y)return;let b=o.key,S=n.heatmapFbos.get(b);S||(S=vs(a,e.tileSize,e.tileSize),n.heatmapFbos.set(b,S)),a.bindFramebuffer.set(S.framebuffer),a.viewport.set([0,0,e.tileSize,e.tileSize]),a.clear({color:p.aM.transparent});let T=y.programConfigurations.get(n.id),E=h.useProgram("heatmap",T),L=h.style.map.terrain.getTerrainData(o);E.draw(a,c.TRIANGLES,nt.disabled,m,_,bt.disabled,Pi(o.posMatrix,e,h.transform.zoom,n.paint.get("heatmap-intensity")),L,n.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,n.paint,h.transform.zoom,T)}function hn(h,e,n){let o=h.context,a=o.gl;o.setColorMode(h.colorModeForRenderPass());let c=bs(o,e),m=n.key,_=e.heatmapFbos.get(m);_&&(o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,_.colorAttachment.get()),o.activeTexture.set(a.TEXTURE1),c.bind(a.LINEAR,a.CLAMP_TO_EDGE),h.useProgram("heatmapTexture").draw(o,a.TRIANGLES,nt.disabled,It.disabled,h.colorModeForRenderPass(),bt.disabled,Zs(h,e,0,1),null,e.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments,e.paint,h.transform.zoom),_.destroy(),e.heatmapFbos.delete(m))}function vs(h,e,n){var o,a;let c=h.gl,m=c.createTexture();c.bindTexture(c.TEXTURE_2D,m),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.LINEAR),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.LINEAR);let _=(o=h.HALF_FLOAT)!==null&&o!==void 0?o:c.UNSIGNED_BYTE,y=(a=h.RGBA16F)!==null&&a!==void 0?a:c.RGBA;c.texImage2D(c.TEXTURE_2D,0,y,e,n,0,c.RGBA,_,null);let b=h.createFramebuffer(e,n,!1,!1);return b.colorAttachment.set(m),b}function bs(h,e){return e.colorRampTexture||(e.colorRampTexture=new Ye(h,e.colorRamp,h.gl.RGBA)),e.colorRampTexture}function En(h,e,n,o,a){if(!n||!o||!o.imageAtlas)return;let c=o.imageAtlas.patternPositions,m=c[n.to.toString()],_=c[n.from.toString()];if(!m&&_&&(m=_),!_&&m&&(_=m),!m||!_){let y=a.getPaintProperty(e);m=c[y],_=c[y]}m&&_&&h.setConstantPatternPositions(m,_)}function ws(h,e,n,o,a,c,m){let _=h.context.gl,y="fill-pattern",b=n.paint.get(y),S=b&&b.constantOr(1),T=n.getCrossfadeParameters(),E,L,B,V,$;m?(L=S&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",E=_.LINES):(L=S?"fillPattern":"fill",E=_.TRIANGLES);let q=b.constantOr(null);for(let G of o){let F=e.getTile(G);if(S&&!F.patternsLoaded())continue;let J=F.getBucket(n);if(!J)continue;let Q=J.programConfigurations.get(n.id),ne=h.useProgram(L,Q),ue=h.style.map.terrain&&h.style.map.terrain.getTerrainData(G);S&&(h.context.activeTexture.set(_.TEXTURE0),F.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),Q.updatePaintBuffers(T)),En(Q,y,q,F,n);let me=ue?G:null,Te=h.translatePosMatrix(me?me.posMatrix:G.posMatrix,F,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(m){V=J.indexBuffer2,$=J.segments2;let Ae=[_.drawingBufferWidth,_.drawingBufferHeight];B=L==="fillOutlinePattern"&&S?Qa(Te,h,T,F,Ae):dc(Te,Ae)}else V=J.indexBuffer,$=J.segments,B=S?Ya(Te,h,T,F):Cn(Te);ne.draw(h.context,E,a,h.stencilModeForClipping(G),c,bt.disabled,B,ue,n.id,J.layoutVertexBuffer,V,$,n.paint,h.transform.zoom,Q)}}function eo(h,e,n,o,a,c,m){let _=h.context,y=_.gl,b="fill-extrusion-pattern",S=n.paint.get(b),T=S.constantOr(1),E=n.getCrossfadeParameters(),L=n.paint.get("fill-extrusion-opacity"),B=S.constantOr(null);for(let V of o){let $=e.getTile(V),q=$.getBucket(n);if(!q)continue;let G=h.style.map.terrain&&h.style.map.terrain.getTerrainData(V),F=q.programConfigurations.get(n.id),J=h.useProgram(T?"fillExtrusionPattern":"fillExtrusion",F);T&&(h.context.activeTexture.set(y.TEXTURE0),$.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),F.updatePaintBuffers(E)),En(F,b,B,$,n);let Q=h.translatePosMatrix(V.posMatrix,$,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),ne=n.paint.get("fill-extrusion-vertical-gradient"),ue=T?qs(Q,h,ne,L,V,E,$):fs(Q,h,ne,L);J.draw(_,_.gl.TRIANGLES,a,c,m,bt.backCCW,ue,G,n.id,q.layoutVertexBuffer,q.indexBuffer,q.segments,n.paint,h.transform.zoom,F,h.style.map.terrain&&q.centroidVertexBuffer)}}function kn(h,e,n,o,a,c,m){let _=h.context,y=_.gl,b=n.fbo;if(!b)return;let S=h.useProgram("hillshade"),T=h.style.map.terrain&&h.style.map.terrain.getTerrainData(e);_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,b.colorAttachment.get()),S.draw(_,y.TRIANGLES,a,c,m,bt.disabled,((E,L,B,V)=>{let $=B.paint.get("hillshade-shadow-color"),q=B.paint.get("hillshade-highlight-color"),G=B.paint.get("hillshade-accent-color"),F=B.paint.get("hillshade-illumination-direction")*(Math.PI/180);B.paint.get("hillshade-illumination-anchor")==="viewport"&&(F-=E.transform.angle);let J=!E.options.moving;return{u_matrix:V?V.posMatrix:E.transform.calculatePosMatrix(L.tileID.toUnwrapped(),J),u_image:0,u_latrange:Gs(0,L.tileID),u_light:[B.paint.get("hillshade-exaggeration"),F],u_shadow:$,u_highlight:q,u_accent:G}})(h,n,o,T?e:null),T,o.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments)}function zn(h,e,n,o,a,c){let m=h.context,_=m.gl,y=e.dem;if(y&&y.data){let b=y.dim,S=y.stride,T=y.getPixels();if(m.activeTexture.set(_.TEXTURE1),m.pixelStoreUnpackPremultiplyAlpha.set(!1),e.demTexture=e.demTexture||h.getTileTexture(S),e.demTexture){let L=e.demTexture;L.update(T,{premultiply:!1}),L.bind(_.NEAREST,_.CLAMP_TO_EDGE)}else e.demTexture=new Ye(m,T,_.RGBA,{premultiply:!1}),e.demTexture.bind(_.NEAREST,_.CLAMP_TO_EDGE);m.activeTexture.set(_.TEXTURE0);let E=e.fbo;if(!E){let L=new Ye(m,{width:b,height:b,data:null},_.RGBA);L.bind(_.LINEAR,_.CLAMP_TO_EDGE),E=e.fbo=m.createFramebuffer(b,b,!0,!1),E.colorAttachment.set(L.texture)}m.bindFramebuffer.set(E.framebuffer),m.viewport.set([0,0,b,b]),h.useProgram("hillshadePrepare").draw(m,_.TRIANGLES,o,a,c,bt.disabled,((L,B)=>{let V=B.stride,$=p.H();return p.aP($,0,p.X,-p.X,0,0,1),p.J($,$,[0,-p.X,0]),{u_matrix:$,u_image:1,u_dimension:[V,V],u_zoom:L.overscaledZ,u_unpack:B.getUnpackVector()}})(e.tileID,y),null,n.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments),e.needsHillshadePrepare=!1}}function gl(h,e,n,o,a,c){let m=o.paint.get("raster-fade-duration");if(!c&&m>0){let _=pe.now(),y=(_-h.timeAdded)/m,b=e?(_-e.timeAdded)/m:-1,S=n.getSource(),T=a.coveringZoomLevel({tileSize:S.tileSize,roundZoom:S.roundZoom}),E=!e||Math.abs(e.tileID.overscaledZ-T)>Math.abs(h.tileID.overscaledZ-T),L=E&&h.refreshedUponExpiration?1:p.ac(E?y:1-b,0,1);return h.refreshedUponExpiration&&y>=1&&(h.refreshedUponExpiration=!1),e?{opacity:1,mix:1-L}:{opacity:L,mix:0}}return{opacity:1,mix:0}}let oa=new p.aM(1,0,0,1),pt=new p.aM(0,1,0,1),to=new p.aM(0,0,1,1),Pc=new p.aM(1,0,1,1),_l=new p.aM(0,1,1,1);function Ln(h,e,n,o){io(h,0,e+n/2,h.transform.width,n,o)}function yl(h,e,n,o){io(h,e-n/2,0,n,h.transform.height,o)}function io(h,e,n,o,a,c){let m=h.context,_=m.gl;_.enable(_.SCISSOR_TEST),_.scissor(e*h.pixelRatio,n*h.pixelRatio,o*h.pixelRatio,a*h.pixelRatio),m.clear({color:c}),_.disable(_.SCISSOR_TEST)}function xl(h,e,n){let o=h.context,a=o.gl,c=n.posMatrix,m=h.useProgram("debug"),_=nt.disabled,y=It.disabled,b=h.colorModeForRenderPass(),S="$debug",T=h.style.map.terrain&&h.style.map.terrain.getTerrainData(n);o.activeTexture.set(a.TEXTURE0);let E=e.getTileByID(n.key).latestRawTileData,L=Math.floor((E&&E.byteLength||0)/1024),B=e.getTile(n).tileSize,V=512/Math.min(B,512)*(n.overscaledZ/h.transform.zoom)*.5,$=n.canonical.toString();n.overscaledZ!==n.canonical.z&&($+=` => ${n.overscaledZ}`),(function(q,G){q.initDebugOverlayCanvas();let F=q.debugOverlayCanvas,J=q.context.gl,Q=q.debugOverlayCanvas.getContext("2d");Q.clearRect(0,0,F.width,F.height),Q.shadowColor="white",Q.shadowBlur=2,Q.lineWidth=1.5,Q.strokeStyle="white",Q.textBaseline="top",Q.font="bold 36px Open Sans, sans-serif",Q.fillText(G,5,5),Q.strokeText(G,5,5),q.debugOverlayTexture.update(F),q.debugOverlayTexture.bind(J.LINEAR,J.CLAMP_TO_EDGE)})(h,`${$} ${L}kB`),m.draw(o,a.TRIANGLES,_,y,Ut.alphaBlended,bt.disabled,ms(c,p.aM.transparent,V),null,S,h.debugBuffer,h.quadTriangleIndexBuffer,h.debugSegments),m.draw(o,a.LINE_STRIP,_,y,b,bt.disabled,ms(c,p.aM.red),T,S,h.debugBuffer,h.tileBorderIndexBuffer,h.debugSegments)}function vl(h,e,n){let o=h.context,a=o.gl,c=h.colorModeForRenderPass(),m=new nt(a.LEQUAL,nt.ReadWrite,h.depthRangeFor3D),_=h.useProgram("terrain"),y=e.getTerrainMesh();o.bindFramebuffer.set(null),o.viewport.set([0,0,h.width,h.height]);for(let b of n){let S=h.renderToTexture.getTexture(b),T=e.getTerrainData(b.tileID);o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,S.texture);let E=h.transform.calculatePosMatrix(b.tileID.toUnwrapped()),L=e.getMeshFrameDelta(h.transform.zoom),B=h.transform.calculateFogMatrix(b.tileID.toUnwrapped()),V=$o(E,L,B,h.style.sky,h.transform.pitch);_.draw(o,a.TRIANGLES,m,It.disabled,c,bt.backCCW,V,T,"terrain",y.vertexBuffer,y.indexBuffer,y.segments)}}class ro{constructor(e,n,o){this.vertexBuffer=e,this.indexBuffer=n,this.segments=o}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class no{constructor(e,n){this.context=new Cc(e),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:p.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=qe.maxUnderzooming+qe.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Uo}resize(e,n,o){if(this.width=Math.floor(e*o),this.height=Math.floor(n*o),this.pixelRatio=o,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let a of this.style._order)this.style._layers[a].resize()}setup(){let e=this.context,n=new p.aX;n.emplaceBack(0,0),n.emplaceBack(p.X,0),n.emplaceBack(0,p.X),n.emplaceBack(p.X,p.X),this.tileExtentBuffer=e.createVertexBuffer(n,rn.members),this.tileExtentSegments=p.a0.simpleSegment(0,0,4,2);let o=new p.aX;o.emplaceBack(0,0),o.emplaceBack(p.X,0),o.emplaceBack(0,p.X),o.emplaceBack(p.X,p.X),this.debugBuffer=e.createVertexBuffer(o,rn.members),this.debugSegments=p.a0.simpleSegment(0,0,4,5);let a=new p.$;a.emplaceBack(0,0,0,0),a.emplaceBack(p.X,0,p.X,0),a.emplaceBack(0,p.X,0,p.X),a.emplaceBack(p.X,p.X,p.X,p.X),this.rasterBoundsBuffer=e.createVertexBuffer(a,Ur.members),this.rasterBoundsSegments=p.a0.simpleSegment(0,0,4,2);let c=new p.aX;c.emplaceBack(0,0),c.emplaceBack(1,0),c.emplaceBack(0,1),c.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(c,rn.members),this.viewportSegments=p.a0.simpleSegment(0,0,4,2);let m=new p.aZ;m.emplaceBack(0),m.emplaceBack(1),m.emplaceBack(3),m.emplaceBack(2),m.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(m);let _=new p.aY;_.emplaceBack(0,1,2),_.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(_);let y=this.context.gl;this.stencilClearMode=new It({func:y.ALWAYS,mask:0},0,255,y.ZERO,y.ZERO,y.ZERO)}clearStencil(){let e=this.context,n=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let o=p.H();p.aP(o,0,this.width,this.height,0,0,1),p.K(o,o,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,n.TRIANGLES,nt.disabled,this.stencilClearMode,Ut.disabled,bt.disabled,Ci(o),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,n){if(this.currentStencilSource===e.source||!e.isTileClipped()||!n||!n.length)return;this.currentStencilSource=e.source;let o=this.context,a=o.gl;this.nextStencilID+n.length>256&&this.clearStencil(),o.setColorMode(Ut.disabled),o.setDepthMode(nt.disabled);let c=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(let m of n){let _=this._tileClippingMaskIDs[m.key]=this.nextStencilID++,y=this.style.map.terrain&&this.style.map.terrain.getTerrainData(m);c.draw(o,a.TRIANGLES,nt.disabled,new It({func:a.ALWAYS,mask:0},_,255,a.KEEP,a.KEEP,a.REPLACE),Ut.disabled,bt.disabled,Ci(m.posMatrix),y,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,n=this.context.gl;return new It({func:n.NOTEQUAL,mask:255},e,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(e){let n=this.context.gl;return new It({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(e){let n=this.context.gl,o=e.sort(((m,_)=>_.overscaledZ-m.overscaledZ)),a=o[o.length-1].overscaledZ,c=o[0].overscaledZ-a+1;if(c>1){this.currentStencilSource=void 0,this.nextStencilID+c>256&&this.clearStencil();let m={};for(let _=0;_<c;_++)m[_+a]=new It({func:n.GEQUAL,mask:255},_+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=c,[m,o]}return[{[a]:It.disabled},o]}colorModeForRenderPass(){let e=this.context.gl;return this._showOverdrawInspector?new Ut([e.CONSTANT_COLOR,e.ONE],new p.aM(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Ut.unblended:Ut.alphaBlended}depthModeForSublayer(e,n,o){if(!this.opaquePassEnabledForLayer())return nt.disabled;let a=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new nt(o||this.context.gl.LEQUAL,n,[a,a])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,n){this.style=e,this.options=n,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(pe.now()),this.imageManager.beginFrame();let o=this.style._order,a=this.style.sourceCaches,c={},m={},_={};for(let y in a){let b=a[y];b.used&&b.prepare(this.context),c[y]=b.getVisibleCoordinates(),m[y]=c[y].slice().reverse(),_[y]=b.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let y=0;y<o.length;y++)if(this.style._layers[o[y]].is3D()){this.opaquePassCutoff=y;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(let y of o){let b=this.style._layers[y];if(!b.hasOffscreenPass()||b.isHidden(this.transform.zoom))continue;let S=m[b.source];(b.type==="custom"||S.length)&&this.renderLayer(this,a[b.source],b,S)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?p.aM.black:p.aM.transparent,depth:1}),this.clearStencil(),this.style.sky&&(function(y,b){let S=y.context,T=S.gl,E=((q,G,F)=>({u_sky_color:q.properties.get("sky-color"),u_horizon_color:q.properties.get("horizon-color"),u_horizon:(G.height/2+G.getHorizon())*F,u_sky_horizon_blend:q.properties.get("sky-horizon-blend")*G.height/2*F}))(b,y.style.map.transform,y.pixelRatio),L=new nt(T.LEQUAL,nt.ReadWrite,[0,1]),B=It.disabled,V=y.colorModeForRenderPass(),$=y.useProgram("sky");if(!b.mesh){let q=new p.aX;q.emplaceBack(-1,-1),q.emplaceBack(1,-1),q.emplaceBack(1,1),q.emplaceBack(-1,1);let G=new p.aY;G.emplaceBack(0,1,2),G.emplaceBack(0,2,3),b.mesh=new ro(S.createVertexBuffer(q,rn.members),S.createIndexBuffer(G),p.a0.simpleSegment(0,0,q.length,G.length))}$.draw(S,T.TRIANGLES,L,B,V,bt.disabled,E,void 0,"sky",b.mesh.vertexBuffer,b.mesh.indexBuffer,b.mesh.segments)})(this,this.style.sky),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=o.length-1;this.currentLayer>=0;this.currentLayer--){let y=this.style._layers[o[this.currentLayer]],b=a[y.source],S=c[y.source];this._renderTileClippingMasks(y,S),this.renderLayer(this,b,y,S)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<o.length;this.currentLayer++){let y=this.style._layers[o[this.currentLayer]],b=a[y.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(y))continue;let S=(y.type==="symbol"?_:m)[y.source];this._renderTileClippingMasks(y,c[y.source]),this.renderLayer(this,b,y,S)}if(this.options.showTileBoundaries){let y=(function(b,S){let T=null,E=Object.values(b._layers).flatMap(($=>$.source&&!$.isHidden(S)?[b.sourceCaches[$.source]]:[])),L=E.filter(($=>$.getSource().type==="vector")),B=E.filter(($=>$.getSource().type!=="vector")),V=$=>{(!T||T.getSource().maxzoom<$.getSource().maxzoom)&&(T=$)};return L.forEach(($=>V($))),T||B.forEach(($=>V($))),T})(this.style,this.transform.zoom);y&&(function(b,S,T){for(let E=0;E<T.length;E++)xl(b,S,T[E])})(this,y,y.getVisibleCoordinates())}this.options.showPadding&&(function(y){let b=y.transform.padding;Ln(y,y.transform.height-(b.top||0),3,oa),Ln(y,b.bottom||0,3,pt),yl(y,b.left||0,3,to),yl(y,y.transform.width-(b.right||0),3,Pc);let S=y.transform.centerPoint;(function(T,E,L,B){io(T,E-1,L-10,2,20,B),io(T,E-10,L-1,20,2,B)})(y,S.x,y.transform.height-S.y,_l)})(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;let n=this.terrainFacilitator.matrix,o=this.transform.modelViewProjectionMatrix,a=this.terrainFacilitator.dirty;a||(a=e?!p.a_(n,o):!p.a$(n,o)),a||(a=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),a&&(p.b0(n,o),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,(function(c,m){let _=c.context,y=_.gl,b=Ut.unblended,S=new nt(y.LEQUAL,nt.ReadWrite,[0,1]),T=m.getTerrainMesh(),E=m.sourceCache.getRenderableTiles(),L=c.useProgram("terrainDepth");_.bindFramebuffer.set(m.getFramebuffer("depth").framebuffer),_.viewport.set([0,0,c.width/devicePixelRatio,c.height/devicePixelRatio]),_.clear({color:p.aM.transparent,depth:1});for(let B of E){let V=m.getTerrainData(B.tileID),$={u_matrix:c.transform.calculatePosMatrix(B.tileID.toUnwrapped()),u_ele_delta:m.getMeshFrameDelta(c.transform.zoom)};L.draw(_,y.TRIANGLES,S,It.disabled,b,bt.backCCW,$,V,"terrain",T.vertexBuffer,T.indexBuffer,T.segments)}_.bindFramebuffer.set(null),_.viewport.set([0,0,c.width,c.height])})(this,this.style.map.terrain),(function(c,m){let _=c.context,y=_.gl,b=Ut.unblended,S=new nt(y.LEQUAL,nt.ReadWrite,[0,1]),T=m.getTerrainMesh(),E=m.getCoordsTexture(),L=m.sourceCache.getRenderableTiles(),B=c.useProgram("terrainCoords");_.bindFramebuffer.set(m.getFramebuffer("coords").framebuffer),_.viewport.set([0,0,c.width/devicePixelRatio,c.height/devicePixelRatio]),_.clear({color:p.aM.transparent,depth:1}),m.coordsIndex=[];for(let V of L){let $=m.getTerrainData(V.tileID);_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,E.texture);let q={u_matrix:c.transform.calculatePosMatrix(V.tileID.toUnwrapped()),u_terrain_coords_id:(255-m.coordsIndex.length)/255,u_texture:0,u_ele_delta:m.getMeshFrameDelta(c.transform.zoom)};B.draw(_,y.TRIANGLES,S,It.disabled,b,bt.backCCW,q,$,"terrain",T.vertexBuffer,T.indexBuffer,T.segments),m.coordsIndex.push(V.tileID.key)}_.bindFramebuffer.set(null),_.viewport.set([0,0,c.width,c.height])})(this,this.style.map.terrain))}renderLayer(e,n,o,a){if(!o.isHidden(this.transform.zoom)&&(o.type==="background"||o.type==="custom"||(a||[]).length))switch(this.id=o.id,o.type){case"symbol":(function(c,m,_,y,b){if(c.renderPass!=="translucent")return;let S=It.disabled,T=c.colorModeForRenderPass();(_._unevaluatedLayout.hasValue("text-variable-anchor")||_._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&(function(E,L,B,V,$,q,G,F,J){let Q=L.transform,ne=tn(),ue=$==="map",me=q==="map";for(let Te of E){let Ae=V.getTile(Te),xe=Ae.getBucket(B);if(!xe||!xe.text||!xe.text.segments.get().length)continue;let ye=p.ag(xe.textSizeData,Q.zoom),Re=ot(Ae,1,L.transform.zoom),We=$r(Te.posMatrix,me,ue,L.transform,Re),be=B.layout.get("icon-text-fit")!=="none"&&xe.hasIconData();if(ye){let Pe=Math.pow(2,Q.zoom-Ae.tileID.overscaledZ),Ze=L.style.map.terrain?(Qe,at)=>L.style.map.terrain.getElevation(Te,Qe,at):null,Et=ne.translatePosition(Q,Ae,G,F);An(xe,ue,me,J,Q,We,Te.posMatrix,Pe,ye,be,ne,Et,Te.toUnwrapped(),Ze)}}})(y,c,_,m,_.layout.get("text-rotation-alignment"),_.layout.get("text-pitch-alignment"),_.paint.get("text-translate"),_.paint.get("text-translate-anchor"),b),_.paint.get("icon-opacity").constantOr(1)!==0&&ra(c,m,_,y,!1,_.paint.get("icon-translate"),_.paint.get("icon-translate-anchor"),_.layout.get("icon-rotation-alignment"),_.layout.get("icon-pitch-alignment"),_.layout.get("icon-keep-upright"),S,T),_.paint.get("text-opacity").constantOr(1)!==0&&ra(c,m,_,y,!0,_.paint.get("text-translate"),_.paint.get("text-translate-anchor"),_.layout.get("text-rotation-alignment"),_.layout.get("text-pitch-alignment"),_.layout.get("text-keep-upright"),S,T),m.map.showCollisionBoxes&&(ys(c,m,_,y,!0),ys(c,m,_,y,!1))})(e,n,o,a,this.style.placement.variableOffsets);break;case"circle":(function(c,m,_,y){if(c.renderPass!=="translucent")return;let b=_.paint.get("circle-opacity"),S=_.paint.get("circle-stroke-width"),T=_.paint.get("circle-stroke-opacity"),E=!_.layout.get("circle-sort-key").isConstant();if(b.constantOr(1)===0&&(S.constantOr(1)===0||T.constantOr(1)===0))return;let L=c.context,B=L.gl,V=c.depthModeForSublayer(0,nt.ReadOnly),$=It.disabled,q=c.colorModeForRenderPass(),G=[];for(let F=0;F<y.length;F++){let J=y[F],Q=m.getTile(J),ne=Q.getBucket(_);if(!ne)continue;let ue=ne.programConfigurations.get(_.id),me=c.useProgram("circle",ue),Te=ne.layoutVertexBuffer,Ae=ne.indexBuffer,xe=c.style.map.terrain&&c.style.map.terrain.getTerrainData(J),ye={programConfiguration:ue,program:me,layoutVertexBuffer:Te,indexBuffer:Ae,uniformValues:pc(c,J,Q,_),terrainData:xe};if(E){let Re=ne.segments.get();for(let We of Re)G.push({segments:new p.a0([We]),sortKey:We.sortKey,state:ye})}else G.push({segments:ne.segments,sortKey:0,state:ye})}E&&G.sort(((F,J)=>F.sortKey-J.sortKey));for(let F of G){let{programConfiguration:J,program:Q,layoutVertexBuffer:ne,indexBuffer:ue,uniformValues:me,terrainData:Te}=F.state;Q.draw(L,B.TRIANGLES,V,$,q,bt.disabled,me,Te,_.id,ne,ue,F.segments,_.paint,c.transform.zoom,J)}})(e,n,o,a);break;case"heatmap":(function(c,m,_,y){if(_.paint.get("heatmap-opacity")===0)return;let b=c.context;if(c.style.map.terrain){for(let S of y){let T=m.getTile(S);m.hasRenderableParent(S)||(c.renderPass==="offscreen"?sa(c,T,_,S):c.renderPass==="translucent"&&hn(c,_,S))}b.viewport.set([0,0,c.width,c.height])}else c.renderPass==="offscreen"?(function(S,T,E,L){let B=S.context,V=B.gl,$=It.disabled,q=new Ut([V.ONE,V.ONE],p.aM.transparent,[!0,!0,!0,!0]);(function(G,F,J){let Q=G.gl;G.activeTexture.set(Q.TEXTURE1),G.viewport.set([0,0,F.width/4,F.height/4]);let ne=J.heatmapFbos.get(p.aU);ne?(Q.bindTexture(Q.TEXTURE_2D,ne.colorAttachment.get()),G.bindFramebuffer.set(ne.framebuffer)):(ne=vs(G,F.width/4,F.height/4),J.heatmapFbos.set(p.aU,ne))})(B,S,E),B.clear({color:p.aM.transparent});for(let G=0;G<L.length;G++){let F=L[G];if(T.hasRenderableParent(F))continue;let J=T.getTile(F),Q=J.getBucket(E);if(!Q)continue;let ne=Q.programConfigurations.get(E.id),ue=S.useProgram("heatmap",ne),{zoom:me}=S.transform;ue.draw(B,V.TRIANGLES,nt.disabled,$,q,bt.disabled,Pi(F.posMatrix,J,me,E.paint.get("heatmap-intensity")),null,E.id,Q.layoutVertexBuffer,Q.indexBuffer,Q.segments,E.paint,S.transform.zoom,ne)}B.viewport.set([0,0,S.width,S.height])})(c,m,_,y):c.renderPass==="translucent"&&(function(S,T){let E=S.context,L=E.gl;E.setColorMode(S.colorModeForRenderPass());let B=T.heatmapFbos.get(p.aU);B&&(E.activeTexture.set(L.TEXTURE0),L.bindTexture(L.TEXTURE_2D,B.colorAttachment.get()),E.activeTexture.set(L.TEXTURE1),bs(E,T).bind(L.LINEAR,L.CLAMP_TO_EDGE),S.useProgram("heatmapTexture").draw(E,L.TRIANGLES,nt.disabled,It.disabled,S.colorModeForRenderPass(),bt.disabled,Zs(S,T,0,1),null,T.id,S.viewportBuffer,S.quadTriangleIndexBuffer,S.viewportSegments,T.paint,S.transform.zoom))})(c,_)})(e,n,o,a);break;case"line":(function(c,m,_,y){if(c.renderPass!=="translucent")return;let b=_.paint.get("line-opacity"),S=_.paint.get("line-width");if(b.constantOr(1)===0||S.constantOr(1)===0)return;let T=c.depthModeForSublayer(0,nt.ReadOnly),E=c.colorModeForRenderPass(),L=_.paint.get("line-dasharray"),B=_.paint.get("line-pattern"),V=B.constantOr(1),$=_.paint.get("line-gradient"),q=_.getCrossfadeParameters(),G=V?"linePattern":L?"lineSDF":$?"lineGradient":"line",F=c.context,J=F.gl,Q=!0;for(let ne of y){let ue=m.getTile(ne);if(V&&!ue.patternsLoaded())continue;let me=ue.getBucket(_);if(!me)continue;let Te=me.programConfigurations.get(_.id),Ae=c.context.program.get(),xe=c.useProgram(G,Te),ye=Q||xe.program!==Ae,Re=c.style.map.terrain&&c.style.map.terrain.getTerrainData(ne),We=B.constantOr(null);if(We&&ue.imageAtlas){let Ze=ue.imageAtlas,Et=Ze.patternPositions[We.to.toString()],Qe=Ze.patternPositions[We.from.toString()];Et&&Qe&&Te.setConstantPatternPositions(Et,Qe)}let be=Re?ne:null,Pe=V?Pn(c,ue,_,q,be):L?fc(c,ue,_,L,q,be):$?el(c,ue,_,me.lineClipsArray.length,be):Hs(c,ue,_,be);if(V)F.activeTexture.set(J.TEXTURE0),ue.imageAtlasTexture.bind(J.LINEAR,J.CLAMP_TO_EDGE),Te.updatePaintBuffers(q);else if(L&&(ye||c.lineAtlas.dirty))F.activeTexture.set(J.TEXTURE0),c.lineAtlas.bind(F);else if($){let Ze=me.gradients[_.id],Et=Ze.texture;if(_.gradientVersion!==Ze.version){let Qe=256;if(_.stepInterpolant){let at=m.getSource().maxzoom,kt=ne.canonical.z===at?Math.ceil(1<<c.transform.maxZoom-ne.canonical.z):1;Qe=p.ac(p.aV(me.maxLineLength/p.X*1024*kt),256,F.maxTextureSize)}Ze.gradient=p.aW({expression:_.gradientExpression(),evaluationKey:"lineProgress",resolution:Qe,image:Ze.gradient||void 0,clips:me.lineClipsArray}),Ze.texture?Ze.texture.update(Ze.gradient):Ze.texture=new Ye(F,Ze.gradient,J.RGBA),Ze.version=_.gradientVersion,Et=Ze.texture}F.activeTexture.set(J.TEXTURE0),Et.bind(_.stepInterpolant?J.NEAREST:J.LINEAR,J.CLAMP_TO_EDGE)}xe.draw(F,J.TRIANGLES,T,c.stencilModeForClipping(ne),E,bt.disabled,Pe,Re,_.id,me.layoutVertexBuffer,me.indexBuffer,me.segments,_.paint,c.transform.zoom,Te,me.layoutVertexBuffer2),Q=!1}})(e,n,o,a);break;case"fill":(function(c,m,_,y){let b=_.paint.get("fill-color"),S=_.paint.get("fill-opacity");if(S.constantOr(1)===0)return;let T=c.colorModeForRenderPass(),E=_.paint.get("fill-pattern"),L=c.opaquePassEnabledForLayer()&&!E.constantOr(1)&&b.constantOr(p.aM.transparent).a===1&&S.constantOr(0)===1?"opaque":"translucent";if(c.renderPass===L){let B=c.depthModeForSublayer(1,c.renderPass==="opaque"?nt.ReadWrite:nt.ReadOnly);ws(c,m,_,y,B,T,!1)}if(c.renderPass==="translucent"&&_.paint.get("fill-antialias")){let B=c.depthModeForSublayer(_.getPaintProperty("fill-outline-color")?2:0,nt.ReadOnly);ws(c,m,_,y,B,T,!0)}})(e,n,o,a);break;case"fill-extrusion":(function(c,m,_,y){let b=_.paint.get("fill-extrusion-opacity");if(b!==0&&c.renderPass==="translucent"){let S=new nt(c.context.gl.LEQUAL,nt.ReadWrite,c.depthRangeFor3D);if(b!==1||_.paint.get("fill-extrusion-pattern").constantOr(1))eo(c,m,_,y,S,It.disabled,Ut.disabled),eo(c,m,_,y,S,c.stencilModeFor3D(),c.colorModeForRenderPass());else{let T=c.colorModeForRenderPass();eo(c,m,_,y,S,It.disabled,T)}}})(e,n,o,a);break;case"hillshade":(function(c,m,_,y){if(c.renderPass!=="offscreen"&&c.renderPass!=="translucent")return;let b=c.context,S=c.depthModeForSublayer(0,nt.ReadOnly),T=c.colorModeForRenderPass(),[E,L]=c.renderPass==="translucent"?c.stencilConfigForOverlap(y):[{},y];for(let B of L){let V=m.getTile(B);V.needsHillshadePrepare!==void 0&&V.needsHillshadePrepare&&c.renderPass==="offscreen"?zn(c,V,_,S,It.disabled,T):c.renderPass==="translucent"&&kn(c,B,V,_,S,E[B.overscaledZ],T)}b.viewport.set([0,0,c.width,c.height])})(e,n,o,a);break;case"raster":(function(c,m,_,y){if(c.renderPass!=="translucent"||_.paint.get("raster-opacity")===0||!y.length)return;let b=c.context,S=b.gl,T=m.getSource(),E=c.useProgram("raster"),L=c.colorModeForRenderPass(),[B,V]=T instanceof kr?[{},y]:c.stencilConfigForOverlap(y),$=V[V.length-1].overscaledZ,q=!c.options.moving;for(let G of V){let F=c.depthModeForSublayer(G.overscaledZ-$,_.paint.get("raster-opacity")===1?nt.ReadWrite:nt.ReadOnly,S.LESS),J=m.getTile(G);J.registerFadeDuration(_.paint.get("raster-fade-duration"));let Q=m.findLoadedParent(G,0),ne=m.findLoadedSibling(G),ue=gl(J,Q||ne||null,m,_,c.transform,c.style.map.terrain),me,Te,Ae=_.paint.get("raster-resampling")==="nearest"?S.NEAREST:S.LINEAR;b.activeTexture.set(S.TEXTURE0),J.texture.bind(Ae,S.CLAMP_TO_EDGE,S.LINEAR_MIPMAP_NEAREST),b.activeTexture.set(S.TEXTURE1),Q?(Q.texture.bind(Ae,S.CLAMP_TO_EDGE,S.LINEAR_MIPMAP_NEAREST),me=Math.pow(2,Q.tileID.overscaledZ-J.tileID.overscaledZ),Te=[J.tileID.canonical.x*me%1,J.tileID.canonical.y*me%1]):J.texture.bind(Ae,S.CLAMP_TO_EDGE,S.LINEAR_MIPMAP_NEAREST),J.texture.useMipmap&&b.extTextureFilterAnisotropic&&c.transform.pitch>20&&S.texParameterf(S.TEXTURE_2D,b.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,b.extTextureFilterAnisotropicMax);let xe=c.style.map.terrain&&c.style.map.terrain.getTerrainData(G),ye=xe?G:null,Re=ye?ye.posMatrix:c.transform.calculatePosMatrix(G.toUnwrapped(),q),We=mc(Re,Te||[0,0],me||1,ue,_);T instanceof kr?E.draw(b,S.TRIANGLES,F,It.disabled,L,bt.disabled,We,xe,_.id,T.boundsBuffer,c.quadTriangleIndexBuffer,T.boundsSegments):E.draw(b,S.TRIANGLES,F,B[G.overscaledZ],L,bt.disabled,We,xe,_.id,c.rasterBoundsBuffer,c.quadTriangleIndexBuffer,c.rasterBoundsSegments)}})(e,n,o,a);break;case"background":(function(c,m,_,y){let b=_.paint.get("background-color"),S=_.paint.get("background-opacity");if(S===0)return;let T=c.context,E=T.gl,L=c.transform,B=L.tileSize,V=_.paint.get("background-pattern");if(c.isPatternMissing(V))return;let $=!V&&b.a===1&&S===1&&c.opaquePassEnabledForLayer()?"opaque":"translucent";if(c.renderPass!==$)return;let q=It.disabled,G=c.depthModeForSublayer(0,$==="opaque"?nt.ReadWrite:nt.ReadOnly),F=c.colorModeForRenderPass(),J=c.useProgram(V?"backgroundPattern":"background"),Q=y||L.coveringTiles({tileSize:B,terrain:c.style.map.terrain});V&&(T.activeTexture.set(E.TEXTURE0),c.imageManager.bind(c.context));let ne=_.getCrossfadeParameters();for(let ue of Q){let me=y?ue.posMatrix:c.transform.calculatePosMatrix(ue.toUnwrapped()),Te=V?Go(me,S,c,V,{tileID:ue,tileSize:B},ne):Ws(me,S,b),Ae=c.style.map.terrain&&c.style.map.terrain.getTerrainData(ue);J.draw(T,E.TRIANGLES,G,q,F,bt.disabled,Te,Ae,_.id,c.tileExtentBuffer,c.quadTriangleIndexBuffer,c.tileExtentSegments)}})(e,0,o,a);break;case"custom":(function(c,m,_){let y=c.context,b=_.implementation;if(c.renderPass==="offscreen"){let S=b.prerender;S&&(c.setCustomLayerDefaults(),y.setColorMode(c.colorModeForRenderPass()),S.call(b,y.gl,c.transform.customLayerMatrix()),y.setDirty(),c.setBaseState())}else if(c.renderPass==="translucent"){c.setCustomLayerDefaults(),y.setColorMode(c.colorModeForRenderPass()),y.setStencilMode(It.disabled);let S=b.renderingMode==="3d"?new nt(c.context.gl.LEQUAL,nt.ReadWrite,c.depthRangeFor3D):c.depthModeForSublayer(0,nt.ReadOnly);y.setDepthMode(S),b.render(y.gl,c.transform.customLayerMatrix(),{farZ:c.transform.farZ,nearZ:c.transform.nearZ,fov:c.transform._fov,modelViewProjectionMatrix:c.transform.modelViewProjectionMatrix,projectionMatrix:c.transform.projectionMatrix}),y.setDirty(),c.setBaseState(),y.bindFramebuffer.set(null)}})(e,0,o)}}translatePosMatrix(e,n,o,a,c){if(!o[0]&&!o[1])return e;let m=c?a==="map"?this.transform.angle:0:a==="viewport"?-this.transform.angle:0;if(m){let b=Math.sin(m),S=Math.cos(m);o=[o[0]*S-o[1]*b,o[0]*b+o[1]*S]}let _=[c?o[0]:ot(n,o[0],this.transform.zoom),c?o[1]:ot(n,o[1],this.transform.zoom),0],y=new Float32Array(16);return p.J(y,e,_),y}saveTileTexture(e){let n=this._tileTextures[e.size[0]];n?n.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){let n=this._tileTextures[e];return n&&n.length>0?n.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let n=this.imageManager.getPattern(e.from.toString()),o=this.imageManager.getPattern(e.to.toString());return!n||!o}useProgram(e,n){this.cache=this.cache||{};let o=e+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[o]||(this.cache[o]=new qo(this.context,qr[e],n,Ho[e],this._showOverdrawInspector,this.style.map.terrain)),this.cache[o]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Ye(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){let{drawingBufferWidth:e,drawingBufferHeight:n}=this.context.gl;return this.width!==e||this.height!==n}}class Dn{constructor(e,n){this.points=e,this.planes=n}static fromInvProjectionMatrix(e,n,o){let a=Math.pow(2,o),c=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((_=>{let y=1/(_=p.af([],_,e))[3]/n*a;return p.b1(_,_,[y,y,1/_[3],y])})),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((_=>{let y=(function(E,L){var B=L[0],V=L[1],$=L[2],q=B*B+V*V+$*$;return q>0&&(q=1/Math.sqrt(q)),E[0]=L[0]*q,E[1]=L[1]*q,E[2]=L[2]*q,E})([],(function(E,L,B){var V=L[0],$=L[1],q=L[2],G=B[0],F=B[1],J=B[2];return E[0]=$*J-q*F,E[1]=q*G-V*J,E[2]=V*F-$*G,E})([],Mt([],c[_[0]],c[_[1]]),Mt([],c[_[2]],c[_[1]]))),b=-((S=y)[0]*(T=c[_[1]])[0]+S[1]*T[1]+S[2]*T[2]);var S,T;return y.concat(b)}));return new Dn(c,m)}}class Rn{constructor(e,n){this.min=e,this.max=n,this.center=(function(o,a,c){return o[0]=.5*a[0],o[1]=.5*a[1],o[2]=.5*a[2],o})([],(function(o,a,c){return o[0]=a[0]+c[0],o[1]=a[1]+c[1],o[2]=a[2]+c[2],o})([],this.min,this.max))}quadrant(e){let n=[e%2==0,e<2],o=Je(this.min),a=Je(this.max);for(let c=0;c<n.length;c++)o[c]=n[c]?this.min[c]:this.center[c],a[c]=n[c]?this.center[c]:this.max[c];return a[2]=this.max[2],new Rn(o,a)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersects(e){let 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]],o=!0;for(let a=0;a<e.planes.length;a++){let c=e.planes[a],m=0;for(let _=0;_<n.length;_++)p.b2(c,n[_])>=0&&m++;if(m===0)return 0;m!==n.length&&(o=!1)}if(o)return 2;for(let a=0;a<3;a++){let c=Number.MAX_VALUE,m=-Number.MAX_VALUE;for(let _=0;_<e.points.length;_++){let y=e.points[_][a]-this.min[a];c=Math.min(c,y),m=Math.max(m,y)}if(m<0||c>this.max[a]-this.min[a])return 0}return 1}}class Bn{constructor(e=0,n=0,o=0,a=0){if(isNaN(e)||e<0||isNaN(n)||n<0||isNaN(o)||o<0||isNaN(a)||a<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=n,this.left=o,this.right=a}interpolate(e,n,o){return n.top!=null&&e.top!=null&&(this.top=p.y.number(e.top,n.top,o)),n.bottom!=null&&e.bottom!=null&&(this.bottom=p.y.number(e.bottom,n.bottom,o)),n.left!=null&&e.left!=null&&(this.left=p.y.number(e.left,n.left,o)),n.right!=null&&e.right!=null&&(this.right=p.y.number(e.right,n.right,o)),this}getCenter(e,n){let o=p.ac((this.left+e-this.right)/2,0,e),a=p.ac((this.top+n-this.bottom)/2,0,n);return new p.P(o,a)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new Bn(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}let aa=85.051129;class Fn{constructor(e,n,o,a,c){this.tileSize=512,this._renderWorldCopies=c===void 0||!!c,this._minZoom=e||0,this._maxZoom=n||22,this._minPitch=o??0,this._maxPitch=a??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new p.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Bn,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){let e=new Fn(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return e.apply(this),e}apply(e){this.tileSize=e.tileSize,this.latRange=e.latRange,this.lngRange=e.lngRange,this.width=e.width,this.height=e.height,this._center=e._center,this._elevation=e._elevation,this.minElevationForCurrentTile=e.minElevationForCurrentTile,this.zoom=e.zoom,this.angle=e.angle,this._fov=e._fov,this._pitch=e._pitch,this._unmodified=e._unmodified,this._edgeInsets=e._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new p.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){let n=-p.b3(e,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=(function(){var o=new p.A(4);return p.A!=Float32Array&&(o[1]=0,o[2]=0),o[0]=1,o[3]=1,o})(),(function(o,a,c){var m=a[0],_=a[1],y=a[2],b=a[3],S=Math.sin(c),T=Math.cos(c);o[0]=m*T+y*S,o[1]=_*T+b*S,o[2]=m*-S+y*T,o[3]=_*-S+b*T})(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){let n=p.ac(e,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(e){e=Math.max(.01,Math.min(60,e)),this._fov!==e&&(this._unmodified=!1,this._fov=e/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(e){let n=Math.min(Math.max(e,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(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,n,o){this._unmodified=!1,this._edgeInsets.interpolate(e,n,o),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){let n=(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(e){let n=[new p.b4(0,e)];if(this._renderWorldCopies){let o=this.pointCoordinate(new p.P(0,0)),a=this.pointCoordinate(new p.P(this.width,0)),c=this.pointCoordinate(new p.P(this.width,this.height)),m=this.pointCoordinate(new p.P(0,this.height)),_=Math.floor(Math.min(o.x,a.x,c.x,m.x)),y=Math.floor(Math.max(o.x,a.x,c.x,m.x)),b=1;for(let S=_-b;S<=y+b;S++)S!==0&&n.push(new p.b4(S,e))}return n}coveringTiles(e){var n,o;let a=this.coveringZoomLevel(e),c=a;if(e.minzoom!==void 0&&a<e.minzoom)return[];e.maxzoom!==void 0&&a>e.maxzoom&&(a=e.maxzoom);let m=this.pointCoordinate(this.getCameraPoint()),_=p.Z.fromLngLat(this.center),y=Math.pow(2,a),b=[y*m.x,y*m.y,0],S=[y*_.x,y*_.y,0],T=Dn.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,a),E=e.minzoom||0;!e.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(E=a);let L=e.terrain?2/Math.min(this.tileSize,e.tileSize)*this.tileSize:3,B=F=>({aabb:new Rn([F*y,0,0],[(F+1)*y,y,0]),zoom:0,x:0,y:0,wrap:F,fullyVisible:!1}),V=[],$=[],q=a,G=e.reparseOverscaled?c:a;if(this._renderWorldCopies)for(let F=1;F<=3;F++)V.push(B(-F)),V.push(B(F));for(V.push(B(0));V.length>0;){let F=V.pop(),J=F.x,Q=F.y,ne=F.fullyVisible;if(!ne){let xe=F.aabb.intersects(T);if(xe===0)continue;ne=xe===2}let ue=e.terrain?b:S,me=F.aabb.distanceX(ue),Te=F.aabb.distanceY(ue),Ae=Math.max(Math.abs(me),Math.abs(Te));if(F.zoom===q||Ae>L+(1<<q-F.zoom)-2&&F.zoom>=E){let xe=q-F.zoom,ye=b[0]-.5-(J<<xe),Re=b[1]-.5-(Q<<xe);$.push({tileID:new p.S(F.zoom===q?G:F.zoom,F.wrap,F.zoom,J,Q),distanceSq:Vt([S[0]-.5-J,S[1]-.5-Q]),tileDistanceToCamera:Math.sqrt(ye*ye+Re*Re)})}else for(let xe=0;xe<4;xe++){let ye=(J<<1)+xe%2,Re=(Q<<1)+(xe>>1),We=F.zoom+1,be=F.aabb.quadrant(xe);if(e.terrain){let Pe=new p.S(We,F.wrap,We,ye,Re),Ze=e.terrain.getMinMaxElevation(Pe),Et=(n=Ze.minElevation)!==null&&n!==void 0?n:this.elevation,Qe=(o=Ze.maxElevation)!==null&&o!==void 0?o:this.elevation;be=new Rn([be.min[0],be.min[1],Et],[be.max[0],be.max[1],Qe])}V.push({aabb:be,zoom:We,x:ye,y:Re,wrap:F.wrap,fullyVisible:ne})}}return $.sort(((F,J)=>F.distanceSq-J.distanceSq)).map((F=>F.tileID))}resize(e,n){this.width=e,this.height=n,this.pixelsToGLUnits=[2/e,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(e){let n=p.ac(e.lat,-85.051129,aa);return new p.P(p.O(e.lng)*this.worldSize,p.Q(n)*this.worldSize)}unproject(e){return new p.Z(e.x/this.worldSize,e.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(e){let n=this.elevation,o=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,a=this.pointLocation(this.centerPoint,e),c=e.getElevationForLngLatZoom(a,this.tileZoom);if(!(this.elevation-c))return;let m=o+n-c,_=Math.cos(this._pitch)*this.cameraToCenterDistance/m/p.b5(1,a.lat),y=this.scaleZoom(_/this.tileSize);this._elevation=c,this._center=a,this.zoom=y}setLocationAtPoint(e,n){let o=this.pointCoordinate(n),a=this.pointCoordinate(this.centerPoint),c=this.locationCoordinate(e),m=new p.Z(c.x-(o.x-a.x),c.y-(o.y-a.y));this.center=this.coordinateLocation(m),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(e,n){return n?this.coordinatePoint(this.locationCoordinate(e),n.getElevationForLngLatZoom(e,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(e))}pointLocation(e,n){return this.coordinateLocation(this.pointCoordinate(e,n))}locationCoordinate(e){return p.Z.fromLngLat(e)}coordinateLocation(e){return e&&e.toLngLat()}pointCoordinate(e,n){if(n){let E=n.pointCoordinate(e);if(E!=null)return E}let o=[e.x,e.y,0,1],a=[e.x,e.y,1,1];p.af(o,o,this.pixelMatrixInverse),p.af(a,a,this.pixelMatrixInverse);let c=o[3],m=a[3],_=o[1]/c,y=a[1]/m,b=o[2]/c,S=a[2]/m,T=b===S?0:(0-b)/(S-b);return new p.Z(p.y.number(o[0]/c,a[0]/m,T)/this.worldSize,p.y.number(_,y,T)/this.worldSize)}coordinatePoint(e,n=0,o=this.pixelMatrix){let a=[e.x*this.worldSize,e.y*this.worldSize,n,1];return p.af(a,a,o),new p.P(a[0]/a[3],a[1]/a[3])}getBounds(){let e=Math.max(0,this.height/2-this.getHorizon());return new oe().extend(this.pointLocation(new p.P(0,e))).extend(this.pointLocation(new p.P(this.width,e))).extend(this.pointLocation(new p.P(this.width,this.height))).extend(this.pointLocation(new p.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new oe([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(e){e?(this.lngRange=[e.getWest(),e.getEast()],this.latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,aa])}calculateTileMatrix(e){let n=e.canonical,o=this.worldSize/this.zoomScale(n.z),a=n.x+Math.pow(2,n.z)*e.wrap,c=p.an(new Float64Array(16));return p.J(c,c,[a*o,n.y*o,0]),p.K(c,c,[o/p.X,o/p.X,1]),c}calculatePosMatrix(e,n=!1){let o=e.key,a=n?this._alignedPosMatrixCache:this._posMatrixCache;if(a[o])return a[o];let c=this.calculateTileMatrix(e);return p.L(c,n?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,c),a[o]=new Float32Array(c),a[o]}calculateFogMatrix(e){let n=e.key,o=this._fogMatrixCache;if(o[n])return o[n];let a=this.calculateTileMatrix(e);return p.L(a,this.fogMatrix,a),o[n]=new Float32Array(a),o[n]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(e,n){n=p.ac(+n,this.minZoom,this.maxZoom);let o={center:new p.N(e.lng,e.lat),zoom:n},a=this.lngRange;if(!this._renderWorldCopies&&a===null){let F=179.9999999999;a=[-F,F]}let c=this.tileSize*this.zoomScale(o.zoom),m=0,_=c,y=0,b=c,S=0,T=0,{x:E,y:L}=this.size;if(this.latRange){let F=this.latRange;m=p.Q(F[1])*c,_=p.Q(F[0])*c,_-m<L&&(S=L/(_-m))}a&&(y=p.b3(p.O(a[0])*c,0,c),b=p.b3(p.O(a[1])*c,0,c),b<y&&(b+=c),b-y<E&&(T=E/(b-y)));let{x:B,y:V}=this.project.call({worldSize:c},e),$,q,G=Math.max(T||0,S||0);if(G){let F=new p.P(T?(b+y)/2:B,S?(_+m)/2:V);return o.center=this.unproject.call({worldSize:c},F).wrap(),o.zoom+=this.scaleZoom(G),o}if(this.latRange){let F=L/2;V-F<m&&(q=m+F),V+F>_&&(q=_-F)}if(a){let F=(y+b)/2,J=B;this._renderWorldCopies&&(J=p.b3(B,F-c/2,F+c/2));let Q=E/2;J-Q<y&&($=y+Q),J+Q>b&&($=b-Q)}if($!==void 0||q!==void 0){let F=new p.P($??B,q??V);o.center=this.unproject.call({worldSize:c},F).wrap()}return o}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let e=this._unmodified,{center:n,zoom:o}=this.getConstrained(this.center,this.zoom);this.center=n,this.zoom=o,this._unmodified=e,this._constraining=!1}_calcMatrices(){if(!this.height)return;let e=this.centerOffset,n=this.point.x,o=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=p.b5(1,this.center.lat)*this.worldSize;let a=p.an(new Float64Array(16));p.K(a,a,[this.width/2,-this.height/2,1]),p.J(a,a,[1,-1,0]),this.labelPlaneMatrix=a,a=p.an(new Float64Array(16)),p.K(a,a,[1,-1,1]),p.J(a,a,[-1,-1,0]),p.K(a,a,[2/this.width,2/this.height,1]),this.glCoordMatrix=a;let c=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),m=Math.min(this.elevation,this.minElevationForCurrentTile),_=c-m*this._pixelPerMeter/Math.cos(this._pitch),y=m<0?_:c,b=Math.PI/2+this._pitch,S=this._fov*(.5+e.y/this.height),T=Math.sin(S)*y/Math.sin(p.ac(Math.PI-b-S,.01,Math.PI-.01)),E=this.getHorizon(),L=2*Math.atan(E/this.cameraToCenterDistance)*(.5+e.y/(2*E)),B=Math.sin(L)*y/Math.sin(p.ac(Math.PI-b-L,.01,Math.PI-.01)),V=Math.min(T,B);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*V+y),this.nearZ=this.height/50,a=new Float64Array(16),p.b6(a,this._fov,this.width/this.height,this.nearZ,this.farZ),a[8]=2*-e.x/this.width,a[9]=2*e.y/this.height,this.projectionMatrix=p.ae(a),p.K(a,a,[1,-1,1]),p.J(a,a,[0,0,-this.cameraToCenterDistance]),p.b7(a,a,this._pitch),p.ad(a,a,this.angle),p.J(a,a,[-n,-o,0]),this.mercatorMatrix=p.K([],a,[this.worldSize,this.worldSize,this.worldSize]),p.K(a,a,[1,1,this._pixelPerMeter]),this.pixelMatrix=p.L(new Float64Array(16),this.labelPlaneMatrix,a),p.J(a,a,[0,0,-this.elevation]),this.modelViewProjectionMatrix=a,this.invModelViewProjectionMatrix=p.as([],a),this.fogMatrix=new Float64Array(16),p.b6(this.fogMatrix,this._fov,this.width/this.height,c,this.farZ),this.fogMatrix[8]=2*-e.x/this.width,this.fogMatrix[9]=2*e.y/this.height,p.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),p.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),p.b7(this.fogMatrix,this.fogMatrix,this._pitch),p.ad(this.fogMatrix,this.fogMatrix,this.angle),p.J(this.fogMatrix,this.fogMatrix,[-n,-o,0]),p.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),p.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=p.L(new Float64Array(16),this.labelPlaneMatrix,a);let $=this.width%2/2,q=this.height%2/2,G=Math.cos(this.angle),F=Math.sin(this.angle),J=n-Math.round(n)+G*$+F*q,Q=o-Math.round(o)+G*q+F*$,ne=new Float64Array(a);if(p.J(ne,ne,[J>.5?J-1:J,Q>.5?Q-1:Q,0]),this.alignedModelViewProjectionMatrix=ne,a=p.as(new Float64Array(16),this.pixelMatrix),!a)throw new Error("failed to invert matrix");this.pixelMatrixInverse=a,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;let e=this.pointCoordinate(new p.P(0,0)),n=[e.x*this.worldSize,e.y*this.worldSize,0,1];return p.af(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){let e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new p.P(0,e))}getCameraQueryGeometry(e){let n=this.getCameraPoint();if(e.length===1)return[e[0],n];{let o=n.x,a=n.y,c=n.x,m=n.y;for(let _ of e)o=Math.min(o,_.x),a=Math.min(a,_.y),c=Math.max(c,_.x),m=Math.max(m,_.y);return[new p.P(o,a),new p.P(c,a),new p.P(c,m),new p.P(o,m),new p.P(o,a)]}}lngLatToCameraDepth(e,n){let o=this.locationCoordinate(e),a=[o.x*this.worldSize,o.y*this.worldSize,n,1];return p.af(a,a,this.modelViewProjectionMatrix),a[2]/a[3]}}function Ss(h,e){let n,o=!1,a=null,c=null,m=()=>{a=null,o&&(h.apply(c,n),a=setTimeout(m,e),o=!1)};return(..._)=>(o=!0,c=this,n=_,a||m(),a)}class so{constructor(e){this._getCurrentHash=()=>{let n=window.location.hash.replace("#","");if(this._hashName){let o;return n.split("&").map((a=>a.split("="))).forEach((a=>{a[0]===this._hashName&&(o=a)})),(o&&o[1]||"").split("/")}return n.split("/")},this._onHashChange=()=>{let n=this._getCurrentHash();if(n.length>=3&&!n.some((o=>isNaN(o)))){let o=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(n[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+n[2],+n[1]],zoom:+n[0],bearing:o,pitch:+(n[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{let n=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,n)},this._removeHash=()=>{let n=this._getCurrentHash();if(n.length===0)return;let o=n.join("/"),a=o;a.split("&").length>0&&(a=a.split("&")[0]),this._hashName&&(a=`${this._hashName}=${o}`);let c=window.location.hash.replace(a,"");c.startsWith("#&")?c=c.slice(0,1)+c.slice(2):c==="#"&&(c="");let m=window.location.href.replace(/(#.+)?$/,c);m=m.replace("&&","&"),window.history.replaceState(window.history.state,null,m)},this._updateHash=Ss(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){let n=this._map.getCenter(),o=Math.round(100*this._map.getZoom())/100,a=Math.ceil((o*Math.LN2+Math.log(512/360/.5))/Math.LN10),c=Math.pow(10,a),m=Math.round(n.lng*c)/c,_=Math.round(n.lat*c)/c,y=this._map.getBearing(),b=this._map.getPitch(),S="";if(S+=e?`/${m}/${_}/${o}`:`${o}/${_}/${m}`,(y||b)&&(S+="/"+Math.round(10*y)/10),b&&(S+=`/${Math.round(b)}`),this._hashName){let T=this._hashName,E=!1,L=window.location.hash.slice(1).split("&").map((B=>{let V=B.split("=")[0];return V===T?(E=!0,`${V}=${S}`):B})).filter((B=>B));return E||L.push(`${T}=${S}`),`#${L.join("&")}`}return`#${S}`}}let oo={linearity:.3,easing:p.b8(0,0,.3,1)},la=p.e({deceleration:2500,maxSpeed:1400},oo),Mc=p.e({deceleration:20,maxSpeed:1400},oo),bl=p.e({deceleration:1e3,maxSpeed:360},oo),ao=p.e({deceleration:1e3,maxSpeed:90},oo);class ca{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:pe.now(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,n=pe.now();for(;e.length>0&&n-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let n={zoom:0,bearing:0,pitch:0,pan:new p.P(0,0),pinchAround:void 0,around:void 0};for(let{settings:c}of this._inertiaBuffer)n.zoom+=c.zoomDelta||0,n.bearing+=c.bearingDelta||0,n.pitch+=c.pitchDelta||0,c.panDelta&&n.pan._add(c.panDelta),c.around&&(n.around=c.around),c.pinchAround&&(n.pinchAround=c.pinchAround);let o=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,a={};if(n.pan.mag()){let c=Is(n.pan.mag(),o,p.e({},la,e||{}));a.offset=n.pan.mult(c.amount/n.pan.mag()),a.center=this._map.transform.center,Ts(a,c)}if(n.zoom){let c=Is(n.zoom,o,Mc);a.zoom=this._map.transform.zoom+c.amount,Ts(a,c)}if(n.bearing){let c=Is(n.bearing,o,bl);a.bearing=this._map.transform.bearing+p.ac(c.amount,-179,179),Ts(a,c)}if(n.pitch){let c=Is(n.pitch,o,ao);a.pitch=this._map.transform.pitch+c.amount,Ts(a,c)}if(a.zoom||a.bearing){let c=n.pinchAround===void 0?n.around:n.pinchAround;a.around=c?this._map.unproject(c):this._map.getCenter()}return this.clear(),p.e(a,{noMoveStart:!0})}}function Ts(h,e){(!h.duration||h.duration<e.duration)&&(h.duration=e.duration,h.easing=e.easing)}function Is(h,e,n){let{maxSpeed:o,linearity:a,deceleration:c}=n,m=p.ac(h*a/(e/1e3),-o,o),_=Math.abs(m)/(c*a);return{easing:n.easing,duration:1e3*_,amount:m*(_/2)}}class hi extends p.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,n,o,a={}){let c=K.mousePos(n.getCanvas(),o),m=n.unproject(c);super(e,p.e({point:c,lngLat:m,originalEvent:o},a)),this._defaultPrevented=!1,this.target=n}}class un extends p.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,n,o){let a=e==="touchend"?o.changedTouches:o.touches,c=K.touchPos(n.getCanvasContainer(),a),m=c.map((y=>n.unproject(y))),_=c.reduce(((y,b,S,T)=>y.add(b.div(T.length))),new p.P(0,0));super(e,{points:c,point:_,lngLats:m,lngLat:n.unproject(_),originalEvent:o}),this._defaultPrevented=!1}}class wl extends p.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,n,o){super(e,{originalEvent:o}),this._defaultPrevented=!1}}class Sl{constructor(e,n){this._map=e,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new wl(e.type,this._map,e))}mousedown(e,n){return this._mousedownPos=n,this._firePreventable(new hi(e.type,this._map,e))}mouseup(e){this._map.fire(new hi(e.type,this._map,e))}click(e,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new hi(e.type,this._map,e))}dblclick(e){return this._firePreventable(new hi(e.type,this._map,e))}mouseover(e){this._map.fire(new hi(e.type,this._map,e))}mouseout(e){this._map.fire(new hi(e.type,this._map,e))}touchstart(e){return this._firePreventable(new un(e.type,this._map,e))}touchmove(e){this._map.fire(new un(e.type,this._map,e))}touchend(e){this._map.fire(new un(e.type,this._map,e))}touchcancel(e){this._map.fire(new un(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class jt{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new hi(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new hi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new hi(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ar{constructor(e){this._map=e}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.pointLocation(p.P.convert(e),this._map.terrain)}}class Oi{constructor(e,n){this._map=e,this._tr=new ar(e),this._el=e.getCanvasContainer(),this._container=e.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(e,n){this.isEnabled()&&e.shiftKey&&e.button===0&&(K.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(e,n){if(!this._active)return;let o=n;if(this._lastPos.equals(o)||!this._box&&o.dist(this._startPos)<this._clickTolerance)return;let a=this._startPos;this._lastPos=o,this._box||(this._box=K.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));let c=Math.min(a.x,o.x),m=Math.max(a.x,o.x),_=Math.min(a.y,o.y),y=Math.max(a.y,o.y);K.setTransform(this._box,`translate(${c}px,${_}px)`),this._box.style.width=m-c+"px",this._box.style.height=y-_+"px"}mouseupWindow(e,n){if(!this._active||e.button!==0)return;let o=this._startPos,a=n;if(this.reset(),K.suppressClick(),o.x!==a.x||o.y!==a.y)return this._map.fire(new p.k("boxzoomend",{originalEvent:e})),{cameraAnimation:c=>c.fitScreenCoordinates(o,a,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(K.remove(this._box),this._box=null),K.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,n){return this._map.fire(new p.k(e,{originalEvent:n}))}}function Cs(h,e){if(h.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${h.length}, points ${e.length}`);let n={};for(let o=0;o<h.length;o++)n[h[o].identifier]=e[o];return n}class ha{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,n,o){(this.centroid||o.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),o.length===this.numTouches&&(this.centroid=(function(a){let c=new p.P(0,0);for(let m of a)c._add(m);return c.div(a.length)})(n),this.touches=Cs(o,n)))}touchmove(e,n,o){if(this.aborted||!this.centroid)return;let a=Cs(o,n);for(let c in this.touches){let m=a[c];(!m||m.dist(this.touches[c])>30)&&(this.aborted=!0)}}touchend(e,n,o){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),o.length===0){let a=!this.aborted&&this.centroid;if(this.reset(),a)return a}}}class lo{constructor(e){this.singleTap=new ha(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,n,o){this.singleTap.touchstart(e,n,o)}touchmove(e,n,o){this.singleTap.touchmove(e,n,o)}touchend(e,n,o){let a=this.singleTap.touchend(e,n,o);if(a){let c=e.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(a)<30;if(c&&m||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=a,this.count===this.numTaps)return this.reset(),a}}}class On{constructor(e){this._tr=new ar(e),this._zoomIn=new lo({numTouches:1,numTaps:2}),this._zoomOut=new lo({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,n,o){this._zoomIn.touchstart(e,n,o),this._zoomOut.touchstart(e,n,o)}touchmove(e,n,o){this._zoomIn.touchmove(e,n,o),this._zoomOut.touchmove(e,n,o)}touchend(e,n,o){let a=this._zoomIn.touchend(e,n,o),c=this._zoomOut.touchend(e,n,o),m=this._tr;return a?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:m.zoom+1,around:m.unproject(a)},{originalEvent:e})}):c?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:m.zoom-1,around:m.unproject(c)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Dr{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){let n=this._moveFunction(...e);if(n.bearingDelta||n.pitchDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(e,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=n.length?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,n){if(!this.isEnabled())return;let o=this._lastPoint;if(!o)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);let a=n.length?n[0]:n;return!this._moved&&a.dist(o)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=a,this._move(o,a))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&K.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}let ua={0:1,2:2};class co{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){let n=K.mouseButton(e);this._eventButton=n}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!(function(n,o){let a=ua[o];return n.buttons===void 0||(n.buttons&a)!==a})(e,this._eventButton)}isValidEndEvent(e){return K.mouseButton(e)===this._eventButton}}class da{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}}let ho=h=>{h.mousedown=h.dragStart,h.mousemoveWindow=h.dragMove,h.mouseup=h.dragEnd,h.contextmenu=e=>{e.preventDefault()}},pa=({enable:h,clickTolerance:e,bearingDegreesPerPixelMoved:n=.8})=>{let o=new co({checkCorrectEvent:a=>K.mouseButton(a)===0&&a.ctrlKey||K.mouseButton(a)===2});return new Dr({clickTolerance:e,move:(a,c)=>({bearingDelta:(c.x-a.x)*n}),moveStateManager:o,enable:h,assignEvents:ho})},fa=({enable:h,clickTolerance:e,pitchDegreesPerPixelMoved:n=-.5})=>{let o=new co({checkCorrectEvent:a=>K.mouseButton(a)===0&&a.ctrlKey||K.mouseButton(a)===2});return new Dr({clickTolerance:e,move:(a,c)=>({pitchDelta:(c.y-a.y)*n}),moveStateManager:o,enable:h,assignEvents:ho})};class dn{constructor(e,n){this._clickTolerance=e.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new p.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,n,o){return this._calculateTransform(e,n,o)}touchmove(e,n,o){if(this._active){if(!this._shouldBePrevented(o.length))return e.preventDefault(),this._calculateTransform(e,n,o);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,n,o){this._calculateTransform(e,n,o),this._active&&this._shouldBePrevented(o.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,n,o){o.length>0&&(this._active=!0);let a=Cs(o,n),c=new p.P(0,0),m=new p.P(0,0),_=0;for(let b in a){let S=a[b],T=this._touches[b];T&&(c._add(S),m._add(S.sub(T)),_++,a[b]=S)}if(this._touches=a,this._shouldBePrevented(_)||!m.mag())return;let y=m.div(_);return this._sum._add(y),this._sum.mag()<this._clickTolerance?void 0:{around:c.div(_),panDelta:y}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class uo{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,n,o){this._firstTwoTouches||o.length<2||(this._firstTwoTouches=[o[0].identifier,o[1].identifier],this._start([n[0],n[1]]))}touchmove(e,n,o){if(!this._firstTwoTouches)return;e.preventDefault();let[a,c]=this._firstTwoTouches,m=Ps(o,n,a),_=Ps(o,n,c);if(!m||!_)return;let y=this._aroundCenter?null:m.add(_).div(2);return this._move([m,_],y,e)}touchend(e,n,o){if(!this._firstTwoTouches)return;let[a,c]=this._firstTwoTouches,m=Ps(o,n,a),_=Ps(o,n,c);m&&_||(this._active&&K.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Ps(h,e,n){for(let o=0;o<h.length;o++)if(h[o].identifier===n)return e[o]}function ma(h,e){return Math.log(h/e)/Math.LN2}class ga extends uo{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,n){let o=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(ma(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:ma(this._distance,o),pinchAround:n}}}function _a(h,e){return 180*h.angleWith(e)/Math.PI}class ya extends uo{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,n,o){let a=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:_a(this._vector,a),pinchAround:n}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let n=25/(Math.PI*this._minDiameter)*360,o=_a(e,this._startVector);return Math.abs(o)<n}}function po(h){return Math.abs(h.y)>Math.abs(h.x)}class Nn extends uo{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,n,o){super.touchstart(e,n,o),this._currentTouchCount=o.length}_start(e){this._lastPoints=e,po(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,n,o){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let a=e[0].sub(this._lastPoints[0]),c=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(a,c,o.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(a.y+c.y)/2*-.5}):void 0}gestureBeginsVertically(e,n,o){if(this._valid!==void 0)return this._valid;let a=e.mag()>=2,c=n.mag()>=2;if(!a&&!c)return;if(!a||!c)return this._firstMove===void 0&&(this._firstMove=o),o-this._firstMove<100&&void 0;let m=e.y>0==n.y>0;return po(e)&&po(n)&&m}}let Tl={panStep:100,bearingStep:15,pitchStep:10};class Hi{constructor(e){this._tr=new ar(e);let n=Tl;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let n=0,o=0,a=0,c=0,m=0;switch(e.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:e.shiftKey?o=-1:(e.preventDefault(),c=-1);break;case 39:e.shiftKey?o=1:(e.preventDefault(),c=1);break;case 38:e.shiftKey?a=1:(e.preventDefault(),m=-1);break;case 40:e.shiftKey?a=-1:(e.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(o=0,a=0),{cameraAnimation:_=>{let y=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:Tr,zoom:n?Math.round(y.zoom)+n*(e.shiftKey?2:1):y.zoom,bearing:y.bearing+o*this._bearingStep,pitch:y.pitch+a*this._pitchStep,offset:[-c*this._panStep,-m*this._panStep],center:y.center},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Tr(h){return h*(2-h)}let xa=4.000244140625;class lr{constructor(e,n){this._onTimeout=o=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(o)},this._map=e,this._tr=new ar(e),this._triggerRenderFrame=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let n=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,o=pe.now(),a=o-(this._lastWheelEventTime||0);this._lastWheelEventTime=o,n!==0&&n%xa==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":a>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(a*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),e.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=e,this._delta-=n,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let n=K.mousePos(this._map.getCanvas(),e),o=this._tr;this._around=n.y>o.transform.height/2-o.transform.getHorizon()?p.N.convert(this._aroundCenter?o.center:o.unproject(n)):p.N.convert(o.center),this._aroundPoint=o.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let e=this._tr.transform;if(this._delta!==0){let y=this._type==="wheel"&&Math.abs(this._delta)>xa?this._wheelZoomRate:this._defaultZoomRate,b=2/(1+Math.exp(-Math.abs(this._delta*y)));this._delta<0&&b!==0&&(b=1/b);let S=typeof this._targetZoom=="number"?e.zoomScale(this._targetZoom):e.scale;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(S*b))),this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let n=typeof this._targetZoom=="number"?this._targetZoom:e.zoom,o=this._startZoom,a=this._easing,c,m=!1,_=pe.now()-this._lastWheelEventTime;if(this._type==="wheel"&&o&&a&&_){let y=Math.min(_/200,1),b=a(y);c=p.y.number(o,n,b),y<1?this._frameId||(this._frameId=!0):m=!0}else c=n,m=!0;return this._active=!0,m&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!m,zoomDelta:c-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let n=p.b9;if(this._prevEase){let o=this._prevEase,a=(pe.now()-o.start)/o.duration,c=o.easing(a+.01)-o.easing(a),m=.27/Math.sqrt(c*c+1e-4)*.01,_=Math.sqrt(.0729-m*m);n=p.b8(m,_,.25,1)}return this._prevEase={start:pe.now(),duration:e,easing:n},n}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class pn{constructor(e,n){this._clickZoom=e,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 Ac{constructor(e){this._tr=new ar(e),this.reset()}reset(){this._active=!1}dblclick(e,n){return e.preventDefault(),{cameraAnimation:o=>{o.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(n)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ec{constructor(){this._tap=new lo({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,n,o){if(!this._swipePoint)if(this._tapTime){let a=n[0],c=e.timeStamp-this._tapTime<500,m=this._tapPoint.dist(a)<30;c&&m?o.length>0&&(this._swipePoint=a,this._swipeTouch=o[0].identifier):this.reset()}else this._tap.touchstart(e,n,o)}touchmove(e,n,o){if(this._tapTime){if(this._swipePoint){if(o[0].identifier!==this._swipeTouch)return;let a=n[0],c=a.y-this._swipePoint.y;return this._swipePoint=a,e.preventDefault(),this._active=!0,{zoomDelta:c/128}}}else this._tap.touchmove(e,n,o)}touchend(e,n,o){if(this._tapTime)this._swipePoint&&o.length===0&&this.reset();else{let a=this._tap.touchend(e,n,o);a&&(this._tapTime=e.timeStamp,this._tapPoint=a)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Il{constructor(e,n,o){this._el=e,this._mousePan=n,this._touchPan=o}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Cl{constructor(e,n,o){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=n,this._mousePitch=o}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class va{constructor(e,n,o,a){this._el=e,this._touchZoom=n,this._touchRotate=o,this._tapDragZoom=a,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class Vn{constructor(e,n){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=n,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=K.create("div","maplibregl-cooperative-gesture-screen",e);let n=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(n=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let o=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),a=document.createElement("div");a.className="maplibregl-desktop-message",a.textContent=n,this._container.appendChild(a);let c=document.createElement("div");c.className="maplibregl-mobile-message",c.textContent=o,this._container.appendChild(c),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(K.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,n){this._enabled&&(this._map.fire(new p.k("cooperativegestureprevented",{gestureType:e,originalEvent:n})),this._container.classList.add("maplibregl-show"),setTimeout((()=>{this._container.classList.remove("maplibregl-show")}),100))}}let Wi=h=>h.zoom||h.drag||h.pitch||h.rotate;class ke extends p.k{}function fo(h){return h.panDelta&&h.panDelta.mag()||h.zoomDelta||h.bearingDelta||h.pitchDelta}class ba{constructor(e,n){this.handleWindowEvent=a=>{this.handleEvent(a,`${a.type}Window`)},this.handleEvent=(a,c)=>{if(a.type==="blur")return void this.stop(!0);this._updatingCamera=!0;let m=a.type==="renderFrame"?void 0:a,_={needsRenderFrame:!1},y={},b={},S=a.touches,T=S?this._getMapTouches(S):void 0,E=T?K.touchPos(this._map.getCanvas(),T):K.mousePos(this._map.getCanvas(),a);for(let{handlerName:V,handler:$,allowed:q}of this._handlers){if(!$.isEnabled())continue;let G;this._blockedByActive(b,q,V)?$.reset():$[c||a.type]&&(G=$[c||a.type](a,E,T),this.mergeHandlerResult(_,y,G,V,m),G&&G.needsRenderFrame&&this._triggerRenderFrame()),(G||$.isActive())&&(b[V]=$)}let L={};for(let V in this._previousActiveHandlers)b[V]||(L[V]=m);this._previousActiveHandlers=b,(Object.keys(L).length||fo(_))&&(this._changes.push([_,y,L]),this._triggerRenderFrame()),(Object.keys(b).length||fo(_))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:B}=_;B&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],B(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ca(e),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);let o=this._el;this._listeners=[[o,"touchstart",{passive:!0}],[o,"touchmove",{passive:!1}],[o,"touchend",void 0],[o,"touchcancel",void 0],[o,"mousedown",void 0],[o,"mousemove",void 0],[o,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[o,"mouseover",void 0],[o,"mouseout",void 0],[o,"dblclick",void 0],[o,"click",void 0],[o,"keydown",{capture:!1}],[o,"keyup",void 0],[o,"wheel",{passive:!1}],[o,"contextmenu",void 0],[window,"blur",void 0]];for(let[a,c,m]of this._listeners)K.addEventListener(a,c,a===document?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(let[e,n,o]of this._listeners)K.removeEventListener(e,n,e===document?this.handleWindowEvent:this.handleEvent,o)}_addDefaultHandlers(e){let n=this._map,o=n.getCanvasContainer();this._add("mapEvent",new Sl(n,e));let a=n.boxZoom=new Oi(n,e);this._add("boxZoom",a),e.interactive&&e.boxZoom&&a.enable();let c=n.cooperativeGestures=new Vn(n,e.cooperativeGestures);this._add("cooperativeGestures",c),e.cooperativeGestures&&c.enable();let m=new On(n),_=new Ac(n);n.doubleClickZoom=new pn(_,m),this._add("tapZoom",m),this._add("clickZoom",_),e.interactive&&e.doubleClickZoom&&n.doubleClickZoom.enable();let y=new Ec;this._add("tapDragZoom",y);let b=n.touchPitch=new Nn(n);this._add("touchPitch",b),e.interactive&&e.touchPitch&&n.touchPitch.enable(e.touchPitch);let S=pa(e),T=fa(e);n.dragRotate=new Cl(e,S,T),this._add("mouseRotate",S,["mousePitch"]),this._add("mousePitch",T,["mouseRotate"]),e.interactive&&e.dragRotate&&n.dragRotate.enable();let E=(({enable:G,clickTolerance:F})=>{let J=new co({checkCorrectEvent:Q=>K.mouseButton(Q)===0&&!Q.ctrlKey});return new Dr({clickTolerance:F,move:(Q,ne)=>({around:ne,panDelta:ne.sub(Q)}),activateOnStart:!0,moveStateManager:J,enable:G,assignEvents:ho})})(e),L=new dn(e,n);n.dragPan=new Il(o,E,L),this._add("mousePan",E),this._add("touchPan",L,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&n.dragPan.enable(e.dragPan);let B=new ya,V=new ga;n.touchZoomRotate=new va(o,V,B,y),this._add("touchRotate",B,["touchPan","touchZoom"]),this._add("touchZoom",V,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&n.touchZoomRotate.enable(e.touchZoomRotate);let $=n.scrollZoom=new lr(n,(()=>this._triggerRenderFrame()));this._add("scrollZoom",$,["mousePan"]),e.interactive&&e.scrollZoom&&n.scrollZoom.enable(e.scrollZoom);let q=n.keyboard=new Hi(n);this._add("keyboard",q),e.interactive&&e.keyboard&&n.keyboard.enable(),this._add("blockableMapEvent",new jt(n))}_add(e,n,o){this._handlers.push({handlerName:e,handler:n,allowed:o}),this._handlersById[e]=n}stop(e){if(!this._updatingCamera){for(let{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Wi(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,n,o){for(let a in e)if(a!==o&&(!n||n.indexOf(a)<0))return!0;return!1}_getMapTouches(e){let n=[];for(let o of e)this._el.contains(o.target)&&n.push(o);return n}mergeHandlerResult(e,n,o,a,c){if(!o)return;p.e(e,o);let m={handlerName:a,originalEvent:o.originalEvent||c};o.zoomDelta!==void 0&&(n.zoom=m),o.panDelta!==void 0&&(n.drag=m),o.pitchDelta!==void 0&&(n.pitch=m),o.bearingDelta!==void 0&&(n.rotate=m)}_applyChanges(){let e={},n={},o={};for(let[a,c,m]of this._changes)a.panDelta&&(e.panDelta=(e.panDelta||new p.P(0,0))._add(a.panDelta)),a.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+a.zoomDelta),a.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+a.bearingDelta),a.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+a.pitchDelta),a.around!==void 0&&(e.around=a.around),a.pinchAround!==void 0&&(e.pinchAround=a.pinchAround),a.noInertia&&(e.noInertia=a.noInertia),p.e(n,c),p.e(o,m);this._updateMapTransform(e,n,o),this._changes=[]}_updateMapTransform(e,n,o){let a=this._map,c=a._getTransformForUpdate(),m=a.terrain;if(!(fo(e)||m&&this._terrainMovement))return this._fireEvents(n,o,!0);let{panDelta:_,zoomDelta:y,bearingDelta:b,pitchDelta:S,around:T,pinchAround:E}=e;E!==void 0&&(T=E),a._stop(!0),T=T||a.transform.centerPoint;let L=c.pointLocation(_?T.sub(_):T);b&&(c.bearing+=b),S&&(c.pitch+=S),y&&(c.zoom+=y),m?this._terrainMovement||!n.drag&&!n.zoom?n.drag&&this._terrainMovement?c.center=c.pointLocation(c.centerPoint.sub(_)):c.setLocationAtPoint(L,T):(this._terrainMovement=!0,this._map._elevationFreeze=!0,c.setLocationAtPoint(L,T)):c.setLocationAtPoint(L,T),a._applyUpdatedTransform(c),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(n,o,!0)}_fireEvents(e,n,o){let a=Wi(this._eventsInProgress),c=Wi(e),m={};for(let T in e){let{originalEvent:E}=e[T];this._eventsInProgress[T]||(m[`${T}start`]=E),this._eventsInProgress[T]=e[T]}!a&&c&&this._fireEvent("movestart",c.originalEvent);for(let T in m)this._fireEvent(T,m[T]);c&&this._fireEvent("move",c.originalEvent);for(let T in e){let{originalEvent:E}=e[T];this._fireEvent(T,E)}let _={},y;for(let T in this._eventsInProgress){let{handlerName:E,originalEvent:L}=this._eventsInProgress[T];this._handlersById[E].isActive()||(delete this._eventsInProgress[T],y=n[E]||L,_[`${T}end`]=y)}for(let T in _)this._fireEvent(T,_[T]);let b=Wi(this._eventsInProgress),S=(a||c)&&!b;if(S&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;let T=this._map._getTransformForUpdate();T.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(T)}if(o&&S){this._updatingCamera=!0;let T=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),E=L=>L!==0&&-this._bearingSnap<L&&L<this._bearingSnap;!T||!T.essential&&pe.prefersReducedMotion?(this._map.fire(new p.k("moveend",{originalEvent:y})),E(this._map.getBearing())&&this._map.resetNorth()):(E(T.bearing||this._map.getBearing())&&(T.bearing=0),T.freezeElevation=!0,this._map.easeTo(T,{originalEvent:y})),this._updatingCamera=!1}}_fireEvent(e,n){this._map.fire(new p.k(e,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((e=>{delete this._frameId,this.handleEvent(new ke("renderFrame",{timeStamp:e})),this._applyChanges()}))}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Pl extends p.E{constructor(e,n){super(),this._renderFrameCallback=()=>{let o=Math.min((pe.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(o)),o<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=n.bearingSnap,this.on("moveend",(()=>{delete this._requestedCameraState}))}getCenter(){return new p.N(this.transform.center.lng,this.transform.center.lat)}setCenter(e,n){return this.jumpTo({center:e},n)}panBy(e,n,o){return e=p.P.convert(e).mult(-1),this.panTo(this.transform.center,p.e({offset:e},n),o)}panTo(e,n,o){return this.easeTo(p.e({center:e},n),o)}getZoom(){return this.transform.zoom}setZoom(e,n){return this.jumpTo({zoom:e},n),this}zoomTo(e,n,o){return this.easeTo(p.e({zoom:e},n),o)}zoomIn(e,n){return this.zoomTo(this.getZoom()+1,e,n),this}zoomOut(e,n){return this.zoomTo(this.getZoom()-1,e,n),this}getBearing(){return this.transform.bearing}setBearing(e,n){return this.jumpTo({bearing:e},n),this}getPadding(){return this.transform.padding}setPadding(e,n){return this.jumpTo({padding:e},n),this}rotateTo(e,n,o){return this.easeTo(p.e({bearing:e},n),o)}resetNorth(e,n){return this.rotateTo(0,p.e({duration:1e3},e),n),this}resetNorthPitch(e,n){return this.easeTo(p.e({bearing:0,pitch:0,duration:1e3},e),n),this}snapToNorth(e,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,n):this}getPitch(){return this.transform.pitch}setPitch(e,n){return this.jumpTo({pitch:e},n),this}cameraForBounds(e,n){e=oe.convert(e).adjustAntiMeridian();let o=n&&n.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),o,n)}_cameraForBoxAndBearing(e,n,o,a){let c={top:0,bottom:0,right:0,left:0};if(typeof(a=p.e({padding:c,offset:[0,0],maxZoom:this.transform.maxZoom},a)).padding=="number"){let xe=a.padding;a.padding={top:xe,bottom:xe,right:xe,left:xe}}a.padding=p.e(c,a.padding);let m=this.transform,_=m.padding,y=new oe(e,n),b=m.project(y.getNorthWest()),S=m.project(y.getNorthEast()),T=m.project(y.getSouthEast()),E=m.project(y.getSouthWest()),L=p.ba(-o),B=b.rotate(L),V=S.rotate(L),$=T.rotate(L),q=E.rotate(L),G=new p.P(Math.max(B.x,V.x,q.x,$.x),Math.max(B.y,V.y,q.y,$.y)),F=new p.P(Math.min(B.x,V.x,q.x,$.x),Math.min(B.y,V.y,q.y,$.y)),J=G.sub(F),Q=(m.width-(_.left+_.right+a.padding.left+a.padding.right))/J.x,ne=(m.height-(_.top+_.bottom+a.padding.top+a.padding.bottom))/J.y;if(ne<0||Q<0)return void p.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");let ue=Math.min(m.scaleZoom(m.scale*Math.min(Q,ne)),a.maxZoom),me=p.P.convert(a.offset),Te=new p.P((a.padding.left-a.padding.right)/2,(a.padding.top-a.padding.bottom)/2).rotate(p.ba(o)),Ae=me.add(Te).mult(m.scale/m.zoomScale(ue));return{center:m.unproject(b.add(T).div(2).sub(Ae)),zoom:ue,bearing:o}}fitBounds(e,n,o){return this._fitInternal(this.cameraForBounds(e,n),n,o)}fitScreenCoordinates(e,n,o,a,c){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(p.P.convert(e)),this.transform.pointLocation(p.P.convert(n)),o,a),a,c)}_fitInternal(e,n,o){return e?(delete(n=p.e(e,n)).padding,n.linear?this.easeTo(n,o):this.flyTo(n,o)):this}jumpTo(e,n){this.stop();let o=this._getTransformForUpdate(),a=!1,c=!1,m=!1;return"zoom"in e&&o.zoom!==+e.zoom&&(a=!0,o.zoom=+e.zoom),e.center!==void 0&&(o.center=p.N.convert(e.center)),"bearing"in e&&o.bearing!==+e.bearing&&(c=!0,o.bearing=+e.bearing),"pitch"in e&&o.pitch!==+e.pitch&&(m=!0,o.pitch=+e.pitch),e.padding==null||o.isPaddingEqual(e.padding)||(o.padding=e.padding),this._applyUpdatedTransform(o),this.fire(new p.k("movestart",n)).fire(new p.k("move",n)),a&&this.fire(new p.k("zoomstart",n)).fire(new p.k("zoom",n)).fire(new p.k("zoomend",n)),c&&this.fire(new p.k("rotatestart",n)).fire(new p.k("rotate",n)).fire(new p.k("rotateend",n)),m&&this.fire(new p.k("pitchstart",n)).fire(new p.k("pitch",n)).fire(new p.k("pitchend",n)),this.fire(new p.k("moveend",n))}calculateCameraOptionsFromTo(e,n,o,a=0){let c=p.Z.fromLngLat(e,n),m=p.Z.fromLngLat(o,a),_=m.x-c.x,y=m.y-c.y,b=m.z-c.z,S=Math.hypot(_,y,b);if(S===0)throw new Error("Can't calculate camera options with same From and To");let T=Math.hypot(_,y),E=this.transform.scaleZoom(this.transform.cameraToCenterDistance/S/this.transform.tileSize),L=180*Math.atan2(_,-y)/Math.PI,B=180*Math.acos(T/S)/Math.PI;return B=b<0?90-B:90+B,{center:m.toLngLat(),zoom:E,pitch:B,bearing:L}}easeTo(e,n){var o;this._stop(!1,e.easeId),((e=p.e({offset:[0,0],duration:500,easing:p.b9},e)).animate===!1||!e.essential&&pe.prefersReducedMotion)&&(e.duration=0);let a=this._getTransformForUpdate(),c=a.zoom,m=a.bearing,_=a.pitch,y=a.padding,b="bearing"in e?this._normalizeBearing(e.bearing,m):m,S="pitch"in e?+e.pitch:_,T="padding"in e?e.padding:a.padding,E=p.P.convert(e.offset),L=a.centerPoint.add(E),B=a.pointLocation(L),{center:V,zoom:$}=a.getConstrained(p.N.convert(e.center||B),(o=e.zoom)!==null&&o!==void 0?o:c);this._normalizeCenter(V,a);let q=a.project(B),G=a.project(V).sub(q),F=a.zoomScale($-c),J,Q;e.around&&(J=p.N.convert(e.around),Q=a.locationPoint(J));let ne={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||$!==c,this._rotating=this._rotating||m!==b,this._pitching=this._pitching||S!==_,this._padding=!a.isPaddingEqual(T),this._easeId=e.easeId,this._prepareEase(n,e.noMoveStart,ne),this.terrain&&this._prepareElevation(V),this._ease((ue=>{if(this._zooming&&(a.zoom=p.y.number(c,$,ue)),this._rotating&&(a.bearing=p.y.number(m,b,ue)),this._pitching&&(a.pitch=p.y.number(_,S,ue)),this._padding&&(a.interpolatePadding(y,T,ue),L=a.centerPoint.add(E)),this.terrain&&!e.freezeElevation&&this._updateElevation(ue),J)a.setLocationAtPoint(J,Q);else{let me=a.zoomScale(a.zoom-c),Te=$>c?Math.min(2,F):Math.max(.5,F),Ae=Math.pow(Te,1-ue),xe=a.unproject(q.add(G.mult(ue*Ae)).mult(me));a.setLocationAtPoint(a.renderWorldCopies?xe.wrap():xe,L)}this._applyUpdatedTransform(a),this._fireMoveEvents(n)}),(ue=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(n,ue)}),e),this}_prepareEase(e,n,o={}){this._moving=!0,n||o.moving||this.fire(new p.k("movestart",e)),this._zooming&&!o.zooming&&this.fire(new p.k("zoomstart",e)),this._rotating&&!o.rotating&&this.fire(new p.k("rotatestart",e)),this._pitching&&!o.pitching&&this.fire(new p.k("pitchstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);let n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&n!==this._elevationTarget){let o=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(o-(n-(o*e+this._elevationStart))/(1-e)),this._elevationTarget=n}this.transform.elevation=p.y.number(this._elevationStart,this._elevationTarget,e)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){let n=e.getCameraPosition(),o=this.terrain.getElevationForLngLatZoom(n.lngLat,e.zoom);if(n.altitude<o){let a=this.calculateCameraOptionsFromTo(n.lngLat,o,e.center,e.elevation);return{pitch:a.pitch,zoom:a.zoom}}return{}}_applyUpdatedTransform(e){let n=[];if(this.terrain&&n.push((a=>this._elevateCameraIfInsideTerrain(a))),this.transformCameraUpdate&&n.push((a=>this.transformCameraUpdate(a))),!n.length)return;let o=e.clone();for(let a of n){let c=o.clone(),{center:m,zoom:_,pitch:y,bearing:b,elevation:S}=a(c);m&&(c.center=m),_!==void 0&&(c.zoom=_),y!==void 0&&(c.pitch=y),b!==void 0&&(c.bearing=b),S!==void 0&&(c.elevation=S),o.apply(c)}this.transform.apply(o)}_fireMoveEvents(e){this.fire(new p.k("move",e)),this._zooming&&this.fire(new p.k("zoom",e)),this._rotating&&this.fire(new p.k("rotate",e)),this._pitching&&this.fire(new p.k("pitch",e))}_afterEase(e,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;let o=this._zooming,a=this._rotating,c=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,o&&this.fire(new p.k("zoomend",e)),a&&this.fire(new p.k("rotateend",e)),c&&this.fire(new p.k("pitchend",e)),this.fire(new p.k("moveend",e))}flyTo(e,n){var o;if(!e.essential&&pe.prefersReducedMotion){let Pe=p.M(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Pe,n)}this.stop(),e=p.e({offset:[0,0],speed:1.2,curve:1.42,easing:p.b9},e);let a=this._getTransformForUpdate(),c=a.zoom,m=a.bearing,_=a.pitch,y=a.padding,b="bearing"in e?this._normalizeBearing(e.bearing,m):m,S="pitch"in e?+e.pitch:_,T="padding"in e?e.padding:a.padding,E=p.P.convert(e.offset),L=a.centerPoint.add(E),B=a.pointLocation(L),{center:V,zoom:$}=a.getConstrained(p.N.convert(e.center||B),(o=e.zoom)!==null&&o!==void 0?o:c);this._normalizeCenter(V,a);let q=a.zoomScale($-c),G=a.project(B),F=a.project(V).sub(G),J=e.curve,Q=Math.max(a.width,a.height),ne=Q/q,ue=F.mag();if("minZoom"in e){let Pe=p.ac(Math.min(e.minZoom,c,$),a.minZoom,a.maxZoom),Ze=Q/a.zoomScale(Pe-c);J=Math.sqrt(Ze/ue*2)}let me=J*J;function Te(Pe){let Ze=(ne*ne-Q*Q+(Pe?-1:1)*me*me*ue*ue)/(2*(Pe?ne:Q)*me*ue);return Math.log(Math.sqrt(Ze*Ze+1)-Ze)}function Ae(Pe){return(Math.exp(Pe)-Math.exp(-Pe))/2}function xe(Pe){return(Math.exp(Pe)+Math.exp(-Pe))/2}let ye=Te(!1),Re=function(Pe){return xe(ye)/xe(ye+J*Pe)},We=function(Pe){return Q*((xe(ye)*(Ae(Ze=ye+J*Pe)/xe(Ze))-Ae(ye))/me)/ue;var Ze},be=(Te(!0)-ye)/J;if(Math.abs(ue)<1e-6||!isFinite(be)){if(Math.abs(Q-ne)<1e-6)return this.easeTo(e,n);let Pe=ne<Q?-1:1;be=Math.abs(Math.log(ne/Q))/J,We=()=>0,Re=Ze=>Math.exp(Pe*J*Ze)}return e.duration="duration"in e?+e.duration:1e3*be/("screenSpeed"in e?+e.screenSpeed/J:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=m!==b,this._pitching=S!==_,this._padding=!a.isPaddingEqual(T),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(V),this._ease((Pe=>{let Ze=Pe*be,Et=1/Re(Ze);a.zoom=Pe===1?$:c+a.scaleZoom(Et),this._rotating&&(a.bearing=p.y.number(m,b,Pe)),this._pitching&&(a.pitch=p.y.number(_,S,Pe)),this._padding&&(a.interpolatePadding(y,T,Pe),L=a.centerPoint.add(E)),this.terrain&&!e.freezeElevation&&this._updateElevation(Pe);let Qe=Pe===1?V:a.unproject(G.add(F.mult(We(Ze))).mult(Et));a.setLocationAtPoint(a.renderWorldCopies?Qe.wrap():Qe,L),this._applyUpdatedTransform(a),this._fireMoveEvents(n)}),(()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(n)}),e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,n){var o;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let a=this._onEaseEnd;delete this._onEaseEnd,a.call(this,n)}return e||(o=this.handlers)===null||o===void 0||o.stop(!1),this}_ease(e,n,o){o.animate===!1||o.duration===0?(e(1),n()):(this._easeStart=pe.now(),this._easeOptions=o,this._onEaseFrame=e,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,n){e=p.b3(e,-180,180);let o=Math.abs(e-n);return Math.abs(e-360-n)<o&&(e-=360),Math.abs(e+360-n)<o&&(e+=360),e}_normalizeCenter(e,n){if(!n.renderWorldCopies||n.lngRange)return;let o=e.lng-n.center.lng;e.lng+=o>180?-360:o<-180?360:0}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(p.N.convert(e),this.transform.tileZoom)-this.transform.elevation:null}}let Un={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class jn{constructor(e=Un){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=n=>{!n||n.sourceDataType!=="metadata"&&n.sourceDataType!=="visibility"&&n.dataType!=="style"&&n.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=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(e,n){let o=this._map._getUIString(`AttributionControl.${n}`);e.title=o,e.setAttribute("aria-label",o)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map((a=>typeof a!="string"?"":a))):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let a=this._map.style.stylesheet;this.styleOwner=a.owner,this.styleId=a.id}let n=this._map.style.sourceCaches;for(let a in n){let c=n[a];if(c.used||c.usedForTerrain){let m=c.getSource();m.attribution&&e.indexOf(m.attribution)<0&&e.push(m.attribution)}}e=e.filter((a=>String(a).trim())),e.sort(((a,c)=>a.length-c.length)),e=e.filter(((a,c)=>{for(let m=c+1;m<e.length;m++)if(e[m].indexOf(a)>=0)return!1;return!0}));let o=e.join(" | ");o!==this._attribHTML&&(this._attribHTML=o,e.length?(this._innerContainer.innerHTML=o,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class wa{constructor(e={}){this._updateCompact=()=>{let n=this._container.children;if(n.length){let o=n[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&o.classList.add("maplibregl-compact"):o.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=K.create("div","maplibregl-ctrl");let 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}}class lt{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let n=++this._id;return this._queue.push({callback:e,id:n,cancelled:!1}),n}remove(e){let n=this._currentlyRunning,o=n?this._queue.concat(n):this._queue;for(let a of o)if(a.id===e)return void(a.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");let n=this._currentlyRunning=this._queue;this._queue=[];for(let o of n)if(!o.cancelled&&(o.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Sa=p.Y([{name:"a_pos3d",type:"Int16",components:3}]);class kc extends p.E{constructor(e){super(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,e.usedForTerrain=!0,e.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,n){this.sourceCache.update(e,n),this._renderableTilesKeys=[];let o={};for(let a of e.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))o[a.key]=!0,this._renderableTilesKeys.push(a.key),this._tiles[a.key]||(a.posMatrix=new Float64Array(16),p.aP(a.posMatrix,0,p.X,0,p.X,0,1),this._tiles[a.key]=new jr(a,this.tileSize));for(let a in this._tiles)o[a]||delete this._tiles[a]}freeRtt(e){for(let n in this._tiles){let o=this._tiles[n];(!e||o.tileID.equals(e)||o.tileID.isChildOf(e)||e.isChildOf(o.tileID))&&(o.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((e=>this.getTileByID(e)))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e){let n={};for(let o of this._renderableTilesKeys){let a=this._tiles[o].tileID;if(a.canonical.equals(e.canonical)){let c=e.clone();c.posMatrix=new Float64Array(16),p.aP(c.posMatrix,0,p.X,0,p.X,0,1),n[o]=c}else if(a.canonical.isChildOf(e.canonical)){let c=e.clone();c.posMatrix=new Float64Array(16);let m=a.canonical.z-e.canonical.z,_=a.canonical.x-(a.canonical.x>>m<<m),y=a.canonical.y-(a.canonical.y>>m<<m),b=p.X>>m;p.aP(c.posMatrix,0,b,0,b,0,1),p.J(c.posMatrix,c.posMatrix,[-_*b,-y*b,0]),n[o]=c}else if(e.canonical.isChildOf(a.canonical)){let c=e.clone();c.posMatrix=new Float64Array(16);let m=e.canonical.z-a.canonical.z,_=e.canonical.x-(e.canonical.x>>m<<m),y=e.canonical.y-(e.canonical.y>>m<<m),b=p.X>>m;p.aP(c.posMatrix,0,p.X,0,p.X,0,1),p.J(c.posMatrix,c.posMatrix,[_*b,y*b,0]),p.K(c.posMatrix,c.posMatrix,[1/2**m,1/2**m,0]),n[o]=c}}return n}getSourceTile(e,n){let o=this.sourceCache._source,a=e.overscaledZ-this.deltaZoom;if(a>o.maxzoom&&(a=o.maxzoom),a<o.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(a).key);let c=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!c||!c.dem)&&n)for(;a>=o.minzoom&&(!c||!c.dem);)c=this.sourceCache.getTileByID(e.scaledTo(a--).key);return c}tilesAfterTime(e=Date.now()){return Object.values(this._tiles).filter((n=>n.timeAdded>=e))}}class Ta{constructor(e,n,o){this.painter=e,this.sourceCache=new kc(n),this.options=o,this.exaggeration=typeof o.exaggeration=="number"?o.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,n,o,a=p.X){var c;if(!(n>=0&&n<a&&o>=0&&o<a))return 0;let m=this.getTerrainData(e),_=(c=m.tile)===null||c===void 0?void 0:c.dem;if(!_)return 0;let y=(function(B,V,$){var q=V[0],G=V[1];return B[0]=$[0]*q+$[4]*G+$[12],B[1]=$[1]*q+$[5]*G+$[13],B})([],[n/a*p.X,o/a*p.X],m.u_terrain_matrix),b=[y[0]*_.dim,y[1]*_.dim],S=Math.floor(b[0]),T=Math.floor(b[1]),E=b[0]-S,L=b[1]-T;return _.get(S,T)*(1-E)*(1-L)+_.get(S+1,T)*E*(1-L)+_.get(S,T+1)*(1-E)*L+_.get(S+1,T+1)*E*L}getElevationForLngLatZoom(e,n){if(!p.bb(n,e.wrap()))return 0;let{tileID:o,mercatorX:a,mercatorY:c}=this._getOverscaledTileIDFromLngLatZoom(e,n);return this.getElevation(o,a%p.X,c%p.X,p.X)}getElevation(e,n,o,a=p.X){return this.getDEMElevation(e,n,o,a)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){let a=this.painter.context,c=new p.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Ye(a,c,a.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Ye(a,new p.R({width:1,height:1}),a.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(a.gl.NEAREST,a.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=p.an([])}let n=this.sourceCache.getSourceTile(e,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){let a=this.painter.context;n.demTexture=this.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new Ye(a,n.dem.getPixels(),a.gl.RGBA,{premultiply:!1}),n.demTexture.bind(a.gl.NEAREST,a.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}let o=n&&n+n.tileID.key+e.key;if(o&&!this._demMatrixCache[o]){let a=this.sourceCache.sourceCache._source.maxzoom,c=e.canonical.z-n.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=a?c=e.canonical.z-a:p.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let m=e.canonical.x-(e.canonical.x>>c<<c),_=e.canonical.y-(e.canonical.y>>c<<c),y=p.bc(new Float64Array(16),[1/(p.X<<c),1/(p.X<<c),0]);p.J(y,y,[m*p.X,_*p.X,0]),this._demMatrixCache[e.key]={matrix:y,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:o?this._demMatrixCache[e.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(e){let n=this.painter,o=n.width/devicePixelRatio,a=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===o&&this._fbo.height===a||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new Ye(n.context,{width:o,height:a,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new Ye(n.context,{width:o,height:a,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=n.context.createFramebuffer(o,a,!0,!1),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,o,a))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){let e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;let n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let c=0,m=0;c<this._coordsTextureSize;c++)for(let _=0;_<this._coordsTextureSize;_++,m+=4)n[m+0]=255&_,n[m+1]=255&c,n[m+2]=_>>8<<4|c>>8,n[m+3]=0;let o=new p.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),a=new Ye(e,o,e.gl.RGBA,{premultiply:!1});return a.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=a,a}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);let n=new Uint8Array(4),o=this.painter.context,a=o.gl,c=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),m=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),_=Math.round(this.painter.height/devicePixelRatio);o.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),a.readPixels(c,_-m-1,1,1,a.RGBA,a.UNSIGNED_BYTE,n),o.bindFramebuffer.set(null);let y=n[0]+(n[2]>>4<<8),b=n[1]+((15&n[2])<<8),S=this.coordsIndex[255-n[3]],T=S&&this.sourceCache.getTileByID(S);if(!T)return null;let E=this._coordsTextureSize,L=(1<<T.tileID.canonical.z)*E;return new p.Z((T.tileID.canonical.x*E+y)/L+T.tileID.wrap,(T.tileID.canonical.y*E+b)/L,this.getElevation(T.tileID,y,b,E))}depthAtPoint(e){let n=new Uint8Array(4),o=this.painter.context,a=o.gl;return o.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),a.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,a.RGBA,a.UNSIGNED_BYTE,n),o.bindFramebuffer.set(null),(n[0]/16777216+n[1]/65536+n[2]/256+n[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;let e=this.painter.context,n=new p.bd,o=new p.aY,a=this.meshSize,c=p.X/a,m=a*a;for(let T=0;T<=a;T++)for(let E=0;E<=a;E++)n.emplaceBack(E*c,T*c,0);for(let T=0;T<m;T+=a+1)for(let E=0;E<a;E++)o.emplaceBack(E+T,a+E+T+1,a+E+T+2),o.emplaceBack(E+T,a+E+T+2,E+T+1);let _=n.length,y=_+2*(a+1);for(let T of[0,1])for(let E=0;E<=a;E++)for(let L of[0,1])n.emplaceBack(E*c,T*p.X,L);for(let T=0;T<2*a;T+=2)o.emplaceBack(y+T,y+T+1,y+T+3),o.emplaceBack(y+T,y+T+3,y+T+2),o.emplaceBack(_+T,_+T+3,_+T+1),o.emplaceBack(_+T,_+T+2,_+T+3);let b=n.length,S=b+2*(a+1);for(let T of[0,1])for(let E=0;E<=a;E++)for(let L of[0,1])n.emplaceBack(T*p.X,E*c,L);for(let T=0;T<2*a;T+=2)o.emplaceBack(b+T,b+T+1,b+T+3),o.emplaceBack(b+T,b+T+3,b+T+2),o.emplaceBack(S+T,S+T+3,S+T+1),o.emplaceBack(S+T,S+T+2,S+T+3);return this._mesh=new ro(e.createVertexBuffer(n,Sa.members),e.createIndexBuffer(o),p.a0.simpleSegment(0,0,n.length,o.length)),this._mesh}getMeshFrameDelta(e){return 2*Math.PI*p.be/Math.pow(2,e)/5}getMinTileElevationForLngLatZoom(e,n){var o;let{tileID:a}=this._getOverscaledTileIDFromLngLatZoom(e,n);return(o=this.getMinMaxElevation(a).minElevation)!==null&&o!==void 0?o:0}getMinMaxElevation(e){let n=this.getTerrainData(e).tile,o={minElevation:null,maxElevation:null};return n&&n.dem&&(o.minElevation=n.dem.min*this.exaggeration,o.maxElevation=n.dem.max*this.exaggeration),o}_getOverscaledTileIDFromLngLatZoom(e,n){let o=p.Z.fromLngLat(e.wrap()),a=(1<<n)*p.X,c=o.x*a,m=o.y*a,_=Math.floor(c/p.X),y=Math.floor(m/p.X);return{tileID:new p.S(n,0,n,_,y),mercatorX:c,mercatorY:m}}}class zc{constructor(e,n,o){this._context=e,this._size=n,this._tileSize=o,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(let e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){let n=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),o=new Ye(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return o.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),n.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),n.colorAttachment.set(o.texture),{id:e,fbo:n,texture:o,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((n=>e.id!==n)),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(let 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!");let e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(let e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length<this._size)&&this._objects.some((e=>!e.inUse))===!1}}let $n={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Ml{constructor(e,n){this.painter=e,this.terrain=n,this.pool=new zc(e.context,30,n.sourceCache.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,n){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter((o=>!e._layers[o].isHidden(n))),this._coordsDescendingInv={};for(let o in e.sourceCaches){this._coordsDescendingInv[o]={};let a=e.sourceCaches[o].getVisibleCoordinates();for(let c of a){let m=this.terrain.sourceCache.getTerrainCoords(c);for(let _ in m)this._coordsDescendingInv[o][_]||(this._coordsDescendingInv[o][_]=[]),this._coordsDescendingInv[o][_].push(m[_])}}this._coordsDescendingInvStr={};for(let o of e._order){let a=e._layers[o],c=a.source;if($n[a.type]&&!this._coordsDescendingInvStr[c]){this._coordsDescendingInvStr[c]={};for(let m in this._coordsDescendingInv[c])this._coordsDescendingInvStr[c][m]=this._coordsDescendingInv[c][m].map((_=>_.key)).sort().join()}}for(let o of this._renderableTiles)for(let a in this._coordsDescendingInvStr){let c=this._coordsDescendingInvStr[a][o.tileID.key];c&&c!==o.rttCoords[a]&&(o.rtt=[])}}renderLayer(e){if(e.isHidden(this.painter.transform.zoom))return!1;let n=e.type,o=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if($n[n]&&(this._prevType&&$n[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(e.id),!a))return!0;if($n[this._prevType]||$n[n]&&a){this._prevType=n;let c=this._stacks.length-1,m=this._stacks[c]||[];for(let _ of this._renderableTiles){if(this.pool.isFull()&&(vl(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(_),_.rtt[c]){let b=this.pool.getObjectForId(_.rtt[c].id);if(b.stamp===_.rtt[c].stamp){this.pool.useObject(b);continue}}let y=this.pool.getOrCreateFreeObject();this.pool.useObject(y),this.pool.stampObject(y),_.rtt[c]={id:y.id,stamp:y.stamp},o.context.bindFramebuffer.set(y.fbo.framebuffer),o.context.clear({color:p.aM.transparent,stencil:0}),o.currentStencilSource=void 0;for(let b=0;b<m.length;b++){let S=o.style._layers[m[b]],T=S.source?this._coordsDescendingInv[S.source][_.tileID.key]:[_.tileID];o.context.viewport.set([0,0,y.fbo.width,y.fbo.height]),o._renderTileClippingMasks(S,T),o.renderLayer(o,o.style.sourceCaches[S.source],S,T),S.source&&(_.rttCoords[S.source]=this._coordsDescendingInvStr[S.source][_.tileID.key])}}return vl(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),$n[n]}return!1}}let Ia={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use \u2318 + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},Al=Se,Lc={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Un,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,refreshExpiredTiles:!0,scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],zoom:0,bearing:0,pitch:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:p.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0},Ca=h=>{h.touchstart=h.dragStart,h.touchmoveWindow=h.dragMove,h.touchend=h.dragEnd},Dc={showCompass:!0,showZoom:!0,visualizePitch:!1};class Rc{constructor(e,n,o=!1){this.mousedown=m=>{this.startMouse(p.e({},m,{ctrlKey:!0,preventDefault:()=>m.preventDefault()}),K.mousePos(this.element,m)),K.addEventListener(window,"mousemove",this.mousemove),K.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=m=>{this.moveMouse(m,K.mousePos(this.element,m))},this.mouseup=m=>{this.mouseRotate.dragEnd(m),this.mousePitch&&this.mousePitch.dragEnd(m),this.offTemp()},this.touchstart=m=>{m.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=K.touchPos(this.element,m.targetTouches)[0],this.startTouch(m,this._startPos),K.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),K.addEventListener(window,"touchend",this.touchend))},this.touchmove=m=>{m.targetTouches.length!==1?this.reset():(this._lastPos=K.touchPos(this.element,m.targetTouches)[0],this.moveTouch(m,this._lastPos))},this.touchend=m=>{m.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;let a=e.dragRotate._mouseRotate.getClickTolerance(),c=e.dragRotate._mousePitch.getClickTolerance();this.element=n,this.mouseRotate=pa({clickTolerance:a,enable:!0}),this.touchRotate=(({enable:m,clickTolerance:_,bearingDegreesPerPixelMoved:y=.8})=>{let b=new da;return new Dr({clickTolerance:_,move:(S,T)=>({bearingDelta:(T.x-S.x)*y}),moveStateManager:b,enable:m,assignEvents:Ca})})({clickTolerance:a,enable:!0}),this.map=e,o&&(this.mousePitch=fa({clickTolerance:c,enable:!0}),this.touchPitch=(({enable:m,clickTolerance:_,pitchDegreesPerPixelMoved:y=-.5})=>{let b=new da;return new Dr({clickTolerance:_,move:(S,T)=>({pitchDelta:(T.y-S.y)*y}),moveStateManager:b,enable:m,assignEvents:Ca})})({clickTolerance:c,enable:!0})),K.addEventListener(n,"mousedown",this.mousedown),K.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),K.addEventListener(n,"touchcancel",this.reset)}startMouse(e,n){this.mouseRotate.dragStart(e,n),this.mousePitch&&this.mousePitch.dragStart(e,n),K.disableDrag()}startTouch(e,n){this.touchRotate.dragStart(e,n),this.touchPitch&&this.touchPitch.dragStart(e,n),K.disableDrag()}moveMouse(e,n){let o=this.map,{bearingDelta:a}=this.mouseRotate.dragMove(e,n)||{};if(a&&o.setBearing(o.getBearing()+a),this.mousePitch){let{pitchDelta:c}=this.mousePitch.dragMove(e,n)||{};c&&o.setPitch(o.getPitch()+c)}}moveTouch(e,n){let o=this.map,{bearingDelta:a}=this.touchRotate.dragMove(e,n)||{};if(a&&o.setBearing(o.getBearing()+a),this.touchPitch){let{pitchDelta:c}=this.touchPitch.dragMove(e,n)||{};c&&o.setPitch(o.getPitch()+c)}}off(){let e=this.element;K.removeEventListener(e,"mousedown",this.mousedown),K.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),K.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),K.removeEventListener(window,"touchend",this.touchend),K.removeEventListener(e,"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)}}let Ni;function At(h,e,n){let o=new p.N(h.lng,h.lat);if(h=new p.N(h.lng,h.lat),e){let a=new p.N(h.lng-360,h.lat),c=new p.N(h.lng+360,h.lat),m=n.locationPoint(h).distSqr(e);n.locationPoint(a).distSqr(e)<m?h=a:n.locationPoint(c).distSqr(e)<m&&(h=c)}for(;Math.abs(h.lng-n.center.lng)>180;){let a=n.locationPoint(h);if(a.x>=0&&a.y>=0&&a.x<=n.width&&a.y<=n.height)break;h.lng>n.center.lng?h.lng-=360:h.lng+=360}return h.lng!==o.lng&&n.locationPoint(h).y>n.height/2-n.getHorizon()?h:o}let qn={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 mo(h,e,n){let o=h.classList;for(let a in qn)o.remove(`maplibregl-${n}-anchor-${a}`);o.add(`maplibregl-${n}-anchor-${e}`)}class go extends p.E{constructor(e){if(super(),this._onKeyPress=n=>{let o=n.code,a=n.charCode||n.keyCode;o!=="Space"&&o!=="Enter"&&a!==32&&a!==13||this.togglePopup()},this._onMapClick=n=>{let o=n.originalEvent.target,a=this._element;this._popup&&(o===a||a.contains(o))&&this.togglePopup()},this._update=n=>{var o;if(!this._map)return;let a=this._map.loaded()&&!this._map.isMoving();(n?.type==="terrain"||n?.type==="render"&&!a)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?At(this._lngLat,this._flatPos,this._map.transform):(o=this._lngLat)===null||o===void 0?void 0:o.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let c="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?c=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(c=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let m="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?m="rotateX(0deg)":this._pitchAlignment==="map"&&(m=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||n&&n.type!=="moveend"||(this._pos=this._pos.round()),K.setTransform(this._element,`${qn[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${m} ${c}`),pe.frameAsync(new AbortController).then((()=>{this._updateOpacity(n&&n.type==="moveend")})).catch((()=>{}))},this._onMove=n=>{if(!this._isDragging){let o=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=o}this._isDragging&&(this._pos=n.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new p.k("dragstart"))),this.fire(new p.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new p.k("dragend")),this._state="inactive"},this._addDragHandler=n=>{this._element.contains(n.originalEvent.target)&&(n.preventDefault(),this._positionDelta=n.point.sub(this._pos).add(this._offset),this._pointerdownPos=n.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(e?.opacity,e?.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=p.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=K.create("div");let n=K.createNS("http://www.w3.org/2000/svg","svg"),o=41,a=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${o}px`),n.setAttributeNS(null,"width",`${a}px`),n.setAttributeNS(null,"viewBox",`0 0 ${a} ${o}`);let c=K.createNS("http://www.w3.org/2000/svg","g");c.setAttributeNS(null,"stroke","none"),c.setAttributeNS(null,"stroke-width","1"),c.setAttributeNS(null,"fill","none"),c.setAttributeNS(null,"fill-rule","evenodd");let m=K.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"fill-rule","nonzero");let _=K.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");let y=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(let q of y){let G=K.createNS("http://www.w3.org/2000/svg","ellipse");G.setAttributeNS(null,"opacity","0.04"),G.setAttributeNS(null,"cx","10.5"),G.setAttributeNS(null,"cy","5.80029008"),G.setAttributeNS(null,"rx",q.rx),G.setAttributeNS(null,"ry",q.ry),_.appendChild(G)}let b=K.createNS("http://www.w3.org/2000/svg","g");b.setAttributeNS(null,"fill",this._color);let S=K.createNS("http://www.w3.org/2000/svg","path");S.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),b.appendChild(S);let T=K.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"opacity","0.25"),T.setAttributeNS(null,"fill","#000000");let E=K.createNS("http://www.w3.org/2000/svg","path");E.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"),T.appendChild(E);let L=K.createNS("http://www.w3.org/2000/svg","g");L.setAttributeNS(null,"transform","translate(6.0, 7.0)"),L.setAttributeNS(null,"fill","#FFFFFF");let B=K.createNS("http://www.w3.org/2000/svg","g");B.setAttributeNS(null,"transform","translate(8.0, 8.0)");let V=K.createNS("http://www.w3.org/2000/svg","circle");V.setAttributeNS(null,"fill","#000000"),V.setAttributeNS(null,"opacity","0.25"),V.setAttributeNS(null,"cx","5.5"),V.setAttributeNS(null,"cy","5.5"),V.setAttributeNS(null,"r","5.4999962");let $=K.createNS("http://www.w3.org/2000/svg","circle");$.setAttributeNS(null,"fill","#FFFFFF"),$.setAttributeNS(null,"cx","5.5"),$.setAttributeNS(null,"cy","5.5"),$.setAttributeNS(null,"r","5.4999962"),B.appendChild(V),B.appendChild($),m.appendChild(_),m.appendChild(b),m.appendChild(T),m.appendChild(L),m.appendChild(B),n.appendChild(m),n.setAttributeNS(null,"height",o*this._scale+"px"),n.setAttributeNS(null,"width",a*this._scale+"px"),this._element.appendChild(n),this._offset=p.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(n=>{n.preventDefault()})),this._element.addEventListener("mousedown",(n=>{n.preventDefault()})),mo(this._element,this._anchor,"marker"),e&&e.className)for(let n of e.className.split(" "))this._element.classList.add(n);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),K.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=p.N.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){let a=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[a,-1*(38.1-13.5+a)],"bottom-right":[-a,-1*(38.1-13.5+a)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){let e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var n,o;if(!(!((n=this._map)===null||n===void 0)&&n.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout((()=>{this._opacityTimeout=null}),100)}let a=this._map,c=a.terrain.depthAtPoint(this._pos),m=a.terrain.getElevationForLngLatZoom(this._lngLat,a.transform.tileZoom);if(a.transform.lngLatToCameraDepth(this._lngLat,m)-c<.006)return void(this._element.style.opacity=this._opacity);let _=-this._offset.y/a.transform._pixelPerMeter,y=Math.sin(a.getPitch()*Math.PI/180)*_,b=a.terrain.depthAtPoint(new p.P(this._pos.x,this._pos.y-this._offset.y)),S=a.transform.lngLatToCameraDepth(this._lngLat,m+y)-b>.006;!((o=this._popup)===null||o===void 0)&&o.isOpen()&&S&&this._popup.remove(),this._element.style.opacity=S?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=p.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,n){return e===void 0&&n===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),n!==void 0&&(this._opacityWhenCovered=n),this._map&&this._updateOpacity(!0),this}}let El={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},Ms=0,As=!1,Ir={maxWidth:100,unit:"metric"};function Es(h,e,n){let o=n&&n.maxWidth||100,a=h._container.clientHeight/2,c=h.unproject([0,a]),m=h.unproject([o,a]),_=c.distanceTo(m);if(n&&n.unit==="imperial"){let y=3.2808*_;y>5280?De(e,o,y/5280,h._getUIString("ScaleControl.Miles")):De(e,o,y,h._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?De(e,o,_/1852,h._getUIString("ScaleControl.NauticalMiles")):_>=1e3?De(e,o,_/1e3,h._getUIString("ScaleControl.Kilometers")):De(e,o,_,h._getUIString("ScaleControl.Meters"))}function De(h,e,n,o){let a=(function(c){let m=Math.pow(10,`${Math.floor(c)}`.length-1),_=c/m;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:(function(y){let b=Math.pow(10,Math.ceil(-Math.log(y)/Math.LN10));return Math.round(y*b)/b})(_),m*_})(n);h.style.width=e*(a/n)+"px",h.innerHTML=`${a} ${o}`}let je={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},_o=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function yo(h){if(h){if(typeof h=="number"){let e=Math.round(Math.abs(h)/Math.SQRT2);return{center:new p.P(0,0),top:new p.P(0,h),"top-left":new p.P(e,e),"top-right":new p.P(-e,e),bottom:new p.P(0,-h),"bottom-left":new p.P(e,-e),"bottom-right":new p.P(-e,-e),left:new p.P(h,0),right:new p.P(-h,0)}}if(h instanceof p.P||Array.isArray(h)){let e=p.P.convert(h);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:p.P.convert(h.center||[0,0]),top:p.P.convert(h.top||[0,0]),"top-left":p.P.convert(h["top-left"]||[0,0]),"top-right":p.P.convert(h["top-right"]||[0,0]),bottom:p.P.convert(h.bottom||[0,0]),"bottom-left":p.P.convert(h["bottom-left"]||[0,0]),"bottom-right":p.P.convert(h["bottom-right"]||[0,0]),left:p.P.convert(h.left||[0,0]),right:p.P.convert(h.right||[0,0])}}return yo(new p.P(0,0))}let Pa=Se;I.AJAXError=p.bh,I.Evented=p.E,I.LngLat=p.N,I.MercatorCoordinate=p.Z,I.Point=p.P,I.addProtocol=p.bi,I.config=p.a,I.removeProtocol=p.bj,I.AttributionControl=jn,I.BoxZoomHandler=Oi,I.CanvasSource=qi,I.CooperativeGesturesHandler=Vn,I.DoubleClickZoomHandler=pn,I.DragPanHandler=Il,I.DragRotateHandler=Cl,I.EdgeInsets=Bn,I.FullscreenControl=class extends p.E{constructor(h={}){super(),this._onFullscreenChange=()=>{var e;let n=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((e=n?.shadowRoot)===null||e===void 0)&&e.fullscreenElement;)n=n.shadowRoot.fullscreenElement;n===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,h&&h.container&&(h.container instanceof HTMLElement?this._container=h.container:p.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(h){return this._map=h,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(){let h=this._fullscreenButton=K.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);K.create("span","maplibregl-ctrl-icon",h).setAttribute("aria-hidden","true"),h.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let h=this._getTitle();this._fullscreenButton.setAttribute("aria-label",h),this._fullscreenButton.title=h}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new p.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new p.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},I.GeoJSONSource=hs,I.GeolocateControl=class extends p.E{constructor(h){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new p.k("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(e),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new p.k("geolocate",e)),this._finish()}},this._updateCamera=e=>{let n=new p.N(e.coords.longitude,e.coords.latitude),o=e.coords.accuracy,a=this._map.getBearing(),c=p.e({bearing:a},this.options.fitBoundsOptions),m=oe.fromLngLat(n,o);this._map.fitBounds(m,c,{geolocateSource:!0})},this._updateMarker=e=>{if(e){let n=new p.N(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=e=>{if(this._map){if(this.options.trackUserLocation)if(e.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&As)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new p.k("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this._geolocateButton=K.create("button","maplibregl-ctrl-geolocate",this._container),K.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(e===!1){p.w("Geolocation support is not available so the GeolocateControl will be disabled.");let n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}else{let n=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=K.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new go({element:this._dotElement}),this._circleElement=K.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new go({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",(()=>this.trigger())),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(n=>{n.geolocateSource||this._watchState!=="ACTIVE_LOCK"||n.originalEvent&&n.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new p.k("trackuserlocationend")),this.fire(new p.k("userlocationlostfocus")))}))}},this.options=p.e({},El,h)}onAdd(h){return this._map=h,this._container=K.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),(function(){return p._(this,arguments,void 0,(function*(e=!1){if(Ni!==void 0&&!e)return Ni;if(window.navigator.permissions===void 0)return Ni=!!window.navigator.geolocation,Ni;try{Ni=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Ni=!!window.navigator.geolocation}return Ni}))})().then((e=>this._finishSetupUI(e))),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),K.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Ms=0,As=!1}_isOutOfMapMaxBounds(h){let e=this._map.getMaxBounds(),n=h.coords;return e&&(n.longitude<e.getWest()||n.longitude>e.getEast()||n.latitude<e.getSouth()||n.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){let h=this._map.getBounds(),e=h.getSouthEast(),n=h.getNorthEast(),o=e.distanceTo(n),a=Math.ceil(this._accuracy/(o/this._map._container.clientHeight)*2);this._circleElement.style.width=`${a}px`,this._circleElement.style.height=`${a}px`}trigger(){if(!this._setup)return p.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new p.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Ms--,As=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new p.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new p.k("trackuserlocationstart")),this.fire(new p.k("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let h;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Ms++,Ms>1?(h={maximumAge:6e5,timeout:0},As=!0):(h=this.options.positionOptions,As=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,h)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},I.Hash=so,I.ImageSource=kr,I.KeyboardHandler=Hi,I.LngLatBounds=oe,I.LogoControl=wa,I.Map=class extends Pl{constructor(h){p.bf.mark(p.bg.create);let e=Object.assign(Object.assign({},Lc),h);if(e.minZoom!=null&&e.maxZoom!=null&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(e.minPitch!=null&&e.maxPitch!=null&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(e.minPitch!=null&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(e.maxPitch!=null&&e.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Fn(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies),{bearingSnap:e.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new lt,this._controls=[],this._mapId=p.a4(),this._contextLost=n=>{n.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new p.k("webglcontextlost",{originalEvent:n}))},this._contextRestored=n=>{this._setupPainter(),this.resize(),this._update(),this.fire(new p.k("webglcontextrestored",{originalEvent:n}))},this._onMapScroll=n=>{if(n.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._maxTileCacheZoomLevels=e.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=e.preserveDrawingBuffer===!0,this._antialias=e.antialias===!0,this._trackResize=e.trackResize===!0,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles===!0,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions===!0,this._collectResourceTiming=e.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Ia),e.locale),this._clickTolerance=e.clickTolerance,this._overridePixelRatio=e.pixelRatio,this._maxCanvasSize=e.maxCanvasSize,this.transformCameraUpdate=e.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=e.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=et.addThrottleControl((()=>this.isMoving())),this._requestManager=new He(e.transformRequest),typeof e.container=="string"){if(this._container=document.getElementById(e.container),!this._container)throw new Error(`Container '${e.container}' not found.`)}else{if(!(e.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",(()=>this._update(!1))).on("moveend",(()=>this._update(!1))).on("zoom",(()=>this._update(!0))).on("terrain",(()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)})).once("idle",(()=>{this._idleTriggered=!0})),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let n=!1,o=Ss((a=>{this._trackResize&&!this._removed&&(this.resize(a),this.redraw())}),50);this._resizeObserver=new ResizeObserver((a=>{n?o(a):n=!0})),this._resizeObserver.observe(this._container)}this.handlers=new ba(this,e),this._hash=e.hash&&new so(typeof e.hash=="string"&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,p.e({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,this._validateStyle=e.validateStyle,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new jn(typeof e.attributionControl=="boolean"?void 0:e.attributionControl)),e.maplibreLogo&&this.addControl(new wa,e.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 p.k(`${n.dataType}data`,n))})),this.on("dataloading",(n=>{this.fire(new p.k(`${n.dataType}dataloading`,n))})),this.on("dataabort",(n=>{this.fire(new p.k("sourcedataabort",n))}))}_getMapId(){return this._mapId}addControl(h,e){if(e===void 0&&(e=h.getDefaultPosition?h.getDefaultPosition():"top-right"),!h||!h.onAdd)return this.fire(new p.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let n=h.onAdd(this);this._controls.push(h);let o=this._controlPositions[e];return e.indexOf("bottom")!==-1?o.insertBefore(n,o.firstChild):o.appendChild(n),this}removeControl(h){if(!h||!h.onRemove)return this.fire(new p.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let e=this._controls.indexOf(h);return e>-1&&this._controls.splice(e,1),h.onRemove(this),this}hasControl(h){return this._controls.indexOf(h)>-1}calculateCameraOptionsFromTo(h,e,n,o){return o==null&&this.terrain&&(o=this.terrain.getElevationForLngLatZoom(n,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(h,e,n,o)}resize(h){var e;let n=this._containerDimensions(),o=n[0],a=n[1],c=this._getClampedPixelRatio(o,a);if(this._resizeCanvas(o,a,c),this.painter.resize(o,a,c),this.painter.overLimit()){let _=this.painter.context.gl;this._maxCanvasSize=[_.drawingBufferWidth,_.drawingBufferHeight];let y=this._getClampedPixelRatio(o,a);this._resizeCanvas(o,a,y),this.painter.resize(o,a,y)}this.transform.resize(o,a),(e=this._requestedCameraState)===null||e===void 0||e.resize(o,a);let m=!this._moving;return m&&(this.stop(),this.fire(new p.k("movestart",h)).fire(new p.k("move",h))),this.fire(new p.k("resize",h)),m&&this.fire(new p.k("moveend",h)),this}_getClampedPixelRatio(h,e){let{0:n,1:o}=this._maxCanvasSize,a=this.getPixelRatio(),c=h*a,m=e*a;return Math.min(c>n?n/c:1,m>o?o/m:1)*a}getPixelRatio(){var h;return(h=this._overridePixelRatio)!==null&&h!==void 0?h:devicePixelRatio}setPixelRatio(h){this._overridePixelRatio=h,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(h){return this.transform.setMaxBounds(oe.convert(h)),this._update()}setMinZoom(h){if((h=h??-2)>=-2&&h<=this.transform.maxZoom)return this.transform.minZoom=h,this._update(),this.getZoom()<h&&this.setZoom(h),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(h){if((h=h??22)>=this.transform.minZoom)return this.transform.maxZoom=h,this._update(),this.getZoom()>h&&this.setZoom(h),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(h){if((h=h??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(h>=0&&h<=this.transform.maxPitch)return this.transform.minPitch=h,this._update(),this.getPitch()<h&&this.setPitch(h),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(h){if((h=h??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(h>=this.transform.minPitch)return this.transform.maxPitch=h,this._update(),this.getPitch()>h&&this.setPitch(h),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(h){return this.transform.renderWorldCopies=h,this._update()}project(h){return this.transform.locationPoint(p.N.convert(h),this.style&&this.terrain)}unproject(h){return this.transform.pointLocation(p.P.convert(h),this.terrain)}isMoving(){var h;return this._moving||((h=this.handlers)===null||h===void 0?void 0:h.isMoving())}isZooming(){var h;return this._zooming||((h=this.handlers)===null||h===void 0?void 0:h.isZooming())}isRotating(){var h;return this._rotating||((h=this.handlers)===null||h===void 0?void 0:h.isRotating())}_createDelegatedListener(h,e,n){if(h==="mouseenter"||h==="mouseover"){let o=!1;return{layers:e,listener:n,delegates:{mousemove:c=>{let m=e.filter((y=>this.getLayer(y))),_=m.length!==0?this.queryRenderedFeatures(c.point,{layers:m}):[];_.length?o||(o=!0,n.call(this,new hi(h,this,c.originalEvent,{features:_}))):o=!1},mouseout:()=>{o=!1}}}}if(h==="mouseleave"||h==="mouseout"){let o=!1;return{layers:e,listener:n,delegates:{mousemove:m=>{let _=e.filter((y=>this.getLayer(y)));(_.length!==0?this.queryRenderedFeatures(m.point,{layers:_}):[]).length?o=!0:o&&(o=!1,n.call(this,new hi(h,this,m.originalEvent)))},mouseout:m=>{o&&(o=!1,n.call(this,new hi(h,this,m.originalEvent)))}}}}{let o=a=>{let c=e.filter((_=>this.getLayer(_))),m=c.length!==0?this.queryRenderedFeatures(a.point,{layers:c}):[];m.length&&(a.features=m,n.call(this,a),delete a.features)};return{layers:e,listener:n,delegates:{[h]:o}}}}_saveDelegatedListener(h,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[h]=this._delegatedListeners[h]||[],this._delegatedListeners[h].push(e)}_removeDelegatedListener(h,e,n){if(!this._delegatedListeners||!this._delegatedListeners[h])return;let o=this._delegatedListeners[h];for(let a=0;a<o.length;a++){let c=o[a];if(c.listener===n&&c.layers.length===e.length&&c.layers.every((m=>e.includes(m)))){for(let m in c.delegates)this.off(m,c.delegates[m]);return void o.splice(a,1)}}}on(h,e,n){if(n===void 0)return super.on(h,e);let o=this._createDelegatedListener(h,typeof e=="string"?[e]:e,n);this._saveDelegatedListener(h,o);for(let a in o.delegates)this.on(a,o.delegates[a]);return this}once(h,e,n){if(n===void 0)return super.once(h,e);let o=typeof e=="string"?[e]:e,a=this._createDelegatedListener(h,o,n);for(let c in a.delegates){let m=a.delegates[c];a.delegates[c]=(..._)=>{this._removeDelegatedListener(h,o,n),m(..._)}}this._saveDelegatedListener(h,a);for(let c in a.delegates)this.once(c,a.delegates[c]);return this}off(h,e,n){return n===void 0?super.off(h,e):(this._removeDelegatedListener(h,typeof e=="string"?[e]:e,n),this)}queryRenderedFeatures(h,e){if(!this.style)return[];let n,o=h instanceof p.P||Array.isArray(h),a=o?h:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(o?{}:h)||{},a instanceof p.P||typeof a[0]=="number")n=[p.P.convert(a)];else{let c=p.P.convert(a[0]),m=p.P.convert(a[1]);n=[c,new p.P(m.x,c.y),m,new p.P(c.x,m.y),c]}return this.style.queryRenderedFeatures(n,e,this.transform)}querySourceFeatures(h,e){return this.style.querySourceFeatures(h,e)}setStyle(h,e){return(e=p.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&h?(this._diffStyle(h,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(h,e))}setTransformRequest(h){return this._requestManager.setTransformRequest(h),this}_getUIString(h){let e=this._locale[h];if(e==null)throw new Error(`Missing UI string '${h}'`);return e}_updateStyle(h,e){if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(h,e)));let n=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!h)),h?(this.style=new js(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof h=="string"?this.style.loadURL(h,e,n):this.style.loadJSON(h,e,n),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new js(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(h,e){if(typeof h=="string"){let n=this._requestManager.transformRequest(h,"Style");p.h(n,new AbortController).then((o=>{this._updateDiff(o.data,e)})).catch((o=>{o&&this.fire(new p.j(o))}))}else typeof h=="object"&&this._updateDiff(h,e)}_updateDiff(h,e){try{this.style.setState(h,e)&&this._update(!0)}catch(n){p.w(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(h,e)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():p.w("There is no style added to the map.")}addSource(h,e){return this._lazyInitEmptyStyle(),this.style.addSource(h,e),this._update(!0)}isSourceLoaded(h){let e=this.style&&this.style.sourceCaches[h];if(e!==void 0)return e.loaded();this.fire(new p.j(new Error(`There is no source with ID '${h}'`)))}setTerrain(h){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),h){let e=this.style.sourceCaches[h.source];if(!e)throw new Error(`cannot load terrain, because there exists no source with ID: ${h.source}`);this.terrain===null&&e.reload();for(let n in this.style._layers){let o=this.style._layers[n];o.type==="hillshade"&&o.source===h.source&&p.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Ta(this.painter,e,h),this.painter.renderToTexture=new Ml(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=n=>{n.dataType==="style"?this.terrain.sourceCache.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId!==h.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(n.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new p.k("terrain",{terrain:h})),this}getTerrain(){var h,e;return(e=(h=this.terrain)===null||h===void 0?void 0:h.options)!==null&&e!==void 0?e:null}areTilesLoaded(){let h=this.style&&this.style.sourceCaches;for(let e in h){let n=h[e]._tiles;for(let o in n){let a=n[o];if(a.state!=="loaded"&&a.state!=="errored")return!1}}return!0}removeSource(h){return this.style.removeSource(h),this._update(!0)}getSource(h){return this.style.getSource(h)}addImage(h,e,n={}){let{pixelRatio:o=1,sdf:a=!1,stretchX:c,stretchY:m,content:_,textFitWidth:y,textFitHeight:b}=n;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||p.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new p.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{let{width:S,height:T,data:E}=e,L=e;return this.style.addImage(h,{data:new p.R({width:S,height:T},new Uint8Array(E)),pixelRatio:o,stretchX:c,stretchY:m,content:_,textFitWidth:y,textFitHeight:b,sdf:a,version:0,userImage:L}),L.onAdd&&L.onAdd(this,h),this}}{let{width:S,height:T,data:E}=pe.getImageData(e);this.style.addImage(h,{data:new p.R({width:S,height:T},E),pixelRatio:o,stretchX:c,stretchY:m,content:_,textFitWidth:y,textFitHeight:b,sdf:a,version:0})}}updateImage(h,e){let n=this.style.getImage(h);if(!n)return this.fire(new p.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let o=e instanceof HTMLImageElement||p.b(e)?pe.getImageData(e):e,{width:a,height:c,data:m}=o;if(a===void 0||c===void 0)return this.fire(new p.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(a!==n.data.width||c!==n.data.height)return this.fire(new p.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));let _=!(e instanceof HTMLImageElement||p.b(e));return n.data.replace(m,_),this.style.updateImage(h,n),this}getImage(h){return this.style.getImage(h)}hasImage(h){return h?!!this.style.getImage(h):(this.fire(new p.j(new Error("Missing required image id"))),!1)}removeImage(h){this.style.removeImage(h)}loadImage(h){return et.getImage(this._requestManager.transformRequest(h,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(h,e){return this._lazyInitEmptyStyle(),this.style.addLayer(h,e),this._update(!0)}moveLayer(h,e){return this.style.moveLayer(h,e),this._update(!0)}removeLayer(h){return this.style.removeLayer(h),this._update(!0)}getLayer(h){return this.style.getLayer(h)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(h,e,n){return this.style.setLayerZoomRange(h,e,n),this._update(!0)}setFilter(h,e,n={}){return this.style.setFilter(h,e,n),this._update(!0)}getFilter(h){return this.style.getFilter(h)}setPaintProperty(h,e,n,o={}){return this.style.setPaintProperty(h,e,n,o),this._update(!0)}getPaintProperty(h,e){return this.style.getPaintProperty(h,e)}setLayoutProperty(h,e,n,o={}){return this.style.setLayoutProperty(h,e,n,o),this._update(!0)}getLayoutProperty(h,e){return this.style.getLayoutProperty(h,e)}setGlyphs(h,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(h,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(h,e,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(h,e,n,(o=>{o||this._update(!0)})),this}removeSprite(h){return this._lazyInitEmptyStyle(),this.style.removeSprite(h),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(h,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(h,e,(n=>{n||this._update(!0)})),this}setLight(h,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(h,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(h){return this._lazyInitEmptyStyle(),this.style.setSky(h),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(h,e){return this.style.setFeatureState(h,e),this._update()}removeFeatureState(h,e){return this.style.removeFeatureState(h,e),this._update()}getFeatureState(h){return this.style.getFeatureState(h)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let h=0,e=0;return this._container&&(h=this._container.clientWidth||400,e=this._container.clientHeight||300),[h,e]}_setupContainer(){let h=this._container;h.classList.add("maplibregl-map");let e=this._canvasContainer=K.create("div","maplibregl-canvas-container",h);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=K.create("canvas","maplibregl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");let n=this._containerDimensions(),o=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],o);let a=this._controlContainer=K.create("div","maplibregl-control-container",h),c=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((m=>{c[m]=K.create("div",`maplibregl-ctrl-${m} `,a)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(h,e,n){this._canvas.width=Math.floor(n*h),this._canvas.height=Math.floor(n*e),this._canvas.style.width=`${h}px`,this._canvas.style.height=`${e}px`}_setupPainter(){let h={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1},e=null;this._canvas.addEventListener("webglcontextcreationerror",(o=>{e={requestedAttributes:h},o&&(e.statusMessage=o.statusMessage,e.type=o.type)}),{once:!0});let n=this._canvas.getContext("webgl2",h)||this._canvas.getContext("webgl",h);if(!n){let o="Failed to initialize WebGL";throw e?(e.message=o,new Error(JSON.stringify(e))):new Error(o)}this.painter=new no(n,this.transform),ht.testSupport(n)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(h){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||h,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(h){return this._update(),this._renderTaskQueue.add(h)}_cancelRenderFrame(h){this._renderTaskQueue.remove(h)}_render(h){let e=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(h),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let a=this.transform.zoom,c=pe.now();this.style.zoomHistory.update(a,c);let m=new p.z(a,{now:c,fadeDuration:e,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),_=m.crossFadingFactor();_===1&&_===this._crossFadingFactor||(n=!0,this._crossFadingFactor=_),this.style.update(m)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,e,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:e,showPadding:this.showPadding}),this.fire(new p.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,p.bf.mark(p.bg.load),this.fire(new p.k("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let o=this._sourcesDirty||this._styleDirty||this._placementDirty;return o||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new p.k("idle")),!this._loaded||this._fullyLoaded||o||(this._fullyLoaded=!0,p.bf.mark(p.bg.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var h;this._hash&&this._hash.remove();for(let n of this._controls)n.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),et.removeThrottleControl(this._imageQueueHandle),(h=this._resizeObserver)===null||h===void 0||h.disconnect();let e=this.painter.context.gl.getExtension("WEBGL_lose_context");e?.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),K.remove(this._canvasContainer),K.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),p.bf.clearMetrics(),this._removed=!0,this.fire(new p.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,pe.frameAsync(this._frameRequest).then((h=>{p.bf.frame(h),this._frameRequest=null,this._render(h)})).catch((()=>{})))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(h){this._showTileBoundaries!==h&&(this._showTileBoundaries=h,this._update())}get showPadding(){return!!this._showPadding}set showPadding(h){this._showPadding!==h&&(this._showPadding=h,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(h){this._showCollisionBoxes!==h&&(this._showCollisionBoxes=h,h?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(h){this._showOverdrawInspector!==h&&(this._showOverdrawInspector=h,this._update())}get repaint(){return!!this._repaint}set repaint(h){this._repaint!==h&&(this._repaint=h,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(h){this._vertices=h,this._update()}get version(){return Al}getCameraTargetElevation(){return this.transform.elevation}},I.MapMouseEvent=hi,I.MapTouchEvent=un,I.MapWheelEvent=wl,I.Marker=go,I.NavigationControl=class{constructor(h){this._updateZoomButtons=()=>{let e=this._map.getZoom(),n=e===this._map.getMaxZoom(),o=e===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=o,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",o.toString())},this._rotateCompassArrow=()=>{let e=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=e},this._setButtonTitle=(e,n)=>{let o=this._map._getUIString(`NavigationControl.${n}`);e.title=o,e.setAttribute("aria-label",o)},this.options=p.e({},Dc,h),this._container=K.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(e=>this._map.zoomIn({},{originalEvent:e}))),K.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(e=>this._map.zoomOut({},{originalEvent:e}))),K.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})})),this._compassIcon=K.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(h){return this._map=h,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Rc(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(h,e){let n=K.create("button",h,this._container);return n.type="button",n.addEventListener("click",e),n}},I.Popup=class extends p.E{constructor(h){super(),this.remove=()=>(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),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new p.k("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{var n;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(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)for(let _ of this.options.className.split(" "))this._container.classList.add(_);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?At(this._lngLat,this._flatPos,this._map.transform):(n=this._lngLat)===null||n===void 0?void 0:n.wrap(),this._trackPointer&&!e)return;let o=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationPoint(this._lngLat));let a=this.options.anchor,c=yo(this.options.offset);if(!a){let _=this._container.offsetWidth,y=this._container.offsetHeight,b;b=o.y+c.bottom.y<y?["top"]:o.y>this._map.transform.height-y?["bottom"]:[],o.x<_/2?b.push("left"):o.x>this._map.transform.width-_/2&&b.push("right"),a=b.length===0?"bottom":b.join("-")}let m=o.add(c[a]);this.options.subpixelPositioning||(m=m.round()),K.setTransform(this._container,`${qn[a]} translate(${m.x}px,${m.y}px)`),mo(this._container,a,"popup")},this._onClose=()=>{this.remove()},this.options=p.e(Object.create(je),h)}addTo(h){return this._map&&this.remove(),this._map=h,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new p.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(h){return this._lngLat=p.N.convert(h),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(h){return this.setDOMContent(document.createTextNode(h))}setHTML(h){let e=document.createDocumentFragment(),n=document.createElement("body"),o;for(n.innerHTML=h;o=n.firstChild,o;)e.appendChild(o);return this.setDOMContent(e)}getMaxWidth(){var h;return(h=this._container)===null||h===void 0?void 0:h.style.maxWidth}setMaxWidth(h){return this.options.maxWidth=h,this._update(),this}setDOMContent(h){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=K.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(h),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(h){return this._container&&this._container.classList.add(h),this}removeClassName(h){return this._container&&this._container.classList.remove(h),this}setOffset(h){return this.options.offset=h,this._update(),this}toggleClassName(h){if(this._container)return this._container.classList.toggle(h)}setSubpixelPositioning(h){this.options.subpixelPositioning=h}_createCloseButton(){this.options.closeButton&&(this._closeButton=K.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let h=this._container.querySelector(_o);h&&h.focus()}},I.RasterDEMTileSource=Bt,I.RasterTileSource=mt,I.ScaleControl=class{constructor(h){this._onMove=()=>{Es(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,Es(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Ir),h)}getDefaultPosition(){return"bottom-left"}onAdd(h){return this._map=h,this._container=K.create("div","maplibregl-ctrl maplibregl-ctrl-scale",h.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}},I.ScrollZoomHandler=lr,I.Style=js,I.TerrainControl=class{constructor(h){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=h}onAdd(h){return this._map=h,this._container=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}},I.TwoFingersTouchPitchHandler=Nn,I.TwoFingersTouchRotateHandler=ya,I.TwoFingersTouchZoomHandler=ga,I.TwoFingersTouchZoomRotateHandler=va,I.VectorTileSource=cs,I.VideoSource=wn,I.addSourceType=(h,e)=>p._(void 0,void 0,void 0,(function*(){if(ds(h))throw new Error(`A source type called "${h}" already exists.`);((n,o)=>{us[n]=o})(h,e)})),I.clearPrewarmedResources=function(){let h=Di;h&&(h.isPreloaded()&&h.numActive()===1?(h.release(Or),Di=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},I.getMaxParallelImageRequests=function(){return p.a.MAX_PARALLEL_IMAGE_REQUESTS},I.getRTLTextPluginStatus=function(){return vr().getRTLTextPluginStatus()},I.getVersion=function(){return Pa},I.getWorkerCount=function(){return yr.workerCount},I.getWorkerUrl=function(){return p.a.WORKER_URL},I.importScriptInWorkers=function(h){return ls().broadcast("IS",h)},I.prewarm=function(){Yr().acquire(Or)},I.setMaxParallelImageRequests=function(h){p.a.MAX_PARALLEL_IMAGE_REQUESTS=h},I.setRTLTextPlugin=function(h,e){return vr().setRTLTextPlugin(h,e)},I.setWorkerCount=function(h){yr.workerCount=h},I.setWorkerUrl=function(h){p.a.WORKER_URL=h}}));var ce=R;return ce}))});var Bm={};im(Bm,{createImdMap:()=>ip});var Oo=tc(Ha(),1);function Wa(R,X){switch(R){case"all":return"2011";case"england":return X;case"wales":case"scotland":case"northern_ireland":return"2011";default:return"2011"}}function Ph(R,X){return Wa(R,X)!==X}var rs=[{tier:"z0_4",minzoom:0,maxzoom:5},{tier:"z5_7",minzoom:5,maxzoom:8},{tier:"z8_10",minzoom:8,maxzoom:24}];function Xa(R,X){return`public.uk_master_${R}_${X}`}function Bo(R,X){return`${R.replace(/\/$/,"")}/${X}/{z}/{x}/{y}.pbf`}function Mh(R){return R==="all"?null:["==",["get","nation"],R]}function Pd(R="all",X="2021"){return{nation:R,era:X,effectiveEra:Wa(R,X),hasPatients:!1,hasLeadCentre:!1,overlays:{localAuthority:!1,nhser:!1,icb:!1,lhb:!1}}}var Ka=tc(Ha(),1);function ic(R){return`rcpch-imd-${R}`}var ug=rs.map(R=>ic(R.tier)),ns="rcpch-imd-patients",ss="rcpch-imd-lead-centre";function Ah(R,X,re){for(let{tier:ce}of rs){let I=ic(ce),p=Xa(re,ce),Se=Bo(X,p),Ce=R.getSource(I);Ce instanceof Ka.VectorTileSource?Ce.setTiles([Se]):(Ce&&R.removeSource(I),R.addSource(I,{type:"vector",tiles:[Se],minzoom:0,maxzoom:14}))}}function Eh(R,X){let re={type:"FeatureCollection",features:X},ce=R.getSource(ns);ce instanceof Ka.GeoJSONSource?ce.setData(re):(ce&&R.removeSource(ns),R.addSource(ns,{type:"geojson",data:re}))}function kh(R,X){let re={type:"FeatureCollection",features:X?[X]:[]},ce=R.getSource(ss);ce instanceof Ka.GeoJSONSource?ce.setData(re):(ce&&R.removeSource(ss),R.addSource(ss,{type:"geojson",data:re}))}var Ns="#0d0d58",Md="#e00087";var nm="#41b6e6",sm="#3d3d3d",os={england:"#d7191c",wales:"#1a9641",scotland:"#2b83ba",northern_ireland:"#7f7f7f",all:"#d7191c"};function rc(R,X,re){return Math.min(re,Math.max(X,R))}function om(R){let X=R.trim();if(/^#[0-9a-fA-F]{6}$/.test(X))return X;if(/^#[0-9a-fA-F]{3}$/.test(X)){let re=X[1],ce=X[2],I=X[3];return`#${re}${re}${ce}${ce}${I}${I}`}return null}function am(R){let X=om(R);if(!X)return null;let re=parseInt(X.slice(1),16);return{r:re>>16&255,g:re>>8&255,b:re&255}}function lm(R,X,re){let ce=rc(Math.round(R),0,255).toString(16).padStart(2,"0"),I=rc(Math.round(X),0,255).toString(16).padStart(2,"0"),p=rc(Math.round(re),0,255).toString(16).padStart(2,"0");return`#${ce}${I}${p}`}function cm(R,X,re){let ce=R/255,I=X/255,p=re/255,Se=Math.max(ce,I,p),Ce=Math.min(ce,I,p),$e=0,pe=(Se+Ce)/2,K=Se-Ce;if(K!==0)switch(Se){case ce:$e=((I-p)/K+(I<p?6:0))/6;break;case I:$e=((p-ce)/K+2)/6;break;default:$e=((ce-I)/K+4)/6;break}let ht=K===0?0:K/(1-Math.abs(2*pe-1));return{h:$e,s:ht,l:pe}}function hm(R,X,re){let ce=(1-Math.abs(2*re-1))*X,I=R*6,p=ce*(1-Math.abs(I%2-1)),Se=0,Ce=0,$e=0;I>=0&&I<1?(Se=ce,Ce=p,$e=0):I<2?(Se=p,Ce=ce,$e=0):I<3?(Se=0,Ce=ce,$e=p):I<4?(Se=0,Ce=p,$e=ce):I<5?(Se=p,Ce=0,$e=ce):(Se=ce,Ce=0,$e=p);let pe=re-ce/2;return{r:(Se+pe)*255,g:(Ce+pe)*255,b:($e+pe)*255}}function nc(R){let X=am(R);if(!X)return Array(10).fill("#cccccc");let{h:re,s:ce,l:I}=cm(X.r,X.g,X.b),p=10,Se=.34,Ce=(p-1)/2;return Array.from({length:p},($e,pe)=>{let K=(pe-Ce)/Ce,ht=rc(I+K*Se,.08,.92),{r:Dt,g:Nt,b:Jt}=hm(re,ce,ht);return lm(Dt,Nt,Jt)})}var zh={choropleth:{decileColorsByNation:{},baseColorByNation:{england:os.england,wales:os.wales,scotland:os.scotland,northern_ireland:os.northern_ireland},fallbackDecileColors:nc(os.england),fillOpacity:.7,borderColor:"#ffffff",borderWidth:.5,hoverBorderColor:Ns,hoverBorderWidth:2},boundaries:{localAuthorityColor:Ns,localAuthorityWidth:1,nhserColor:Md,nhserWidth:1.5,icbColor:sm,icbWidth:1,lhbColor:nm,lhbWidth:1},patients:{circleColor:Ns,circleRadius:5,circleStrokeColor:"#ffffff",circleStrokeWidth:1,circleOpacity:.8,colorByGroup:{}},leadCentre:{color:Md,radius:10,strokeColor:"#ffffff",strokeWidth:2},tooltip:{backgroundColor:Ns,textColor:"#ffffff",borderColor:Ns,borderRadius:4,areaLabel:"Area",decileLabel:"IMD decile",nationLabel:"Nation",patientLabel:"Patient",leadCentreLabel:"Lead centre",patientTooltipText:"{{patientLabel}}",leadCentreTooltipText:"{{leadCentreLabel}}: {{label}}"},legend:{backgroundColor:"#ffffff",textColor:Ns,borderColor:"#d8dde6",borderRadius:8,fontSize:13,fontFamily:"system-ui, -apple-system, Segoe UI, Roboto, sans-serif",width:220,boxShadow:"0 6px 18px rgba(0, 0, 0, 0.12)",toggleOnColor:Ns,toggleOffColor:"#6b7280"}};function Lh(R,X){return X?{choropleth:{...R.choropleth,...X.choropleth},boundaries:{...R.boundaries,...X.boundaries},patients:{...R.patients,...X.patients},leadCentre:{...R.leadCentre,...X.leadCentre},tooltip:{...R.tooltip,...X.tooltip},legend:{...R.legend,...X.legend}}:R}function Fo(R,X){let ce=(X.choropleth.decileColorsByNation??{})[R];if(ce&&ce.length===10)return ce;let p=(X.choropleth.baseColorByNation??{})[R];if(p)return nc(p);let Se=os[R]??os.england;return nc(Se)??X.choropleth.fallbackDecileColors??nc(os.england)}function Ja(R){return`rcpch-imd-fill-${R}`}function sc(R){return`rcpch-imd-line-${R}`}var Dh=rs.flatMap(R=>[Ja(R.tier),sc(R.tier)]),gr="rcpch-imd-patients",Ar="rcpch-imd-lead-centre",Ed=Ja("z8_10");function Ad(R){let X=R[0]??"#cccccc";return["step",["get","imd_decile"],X,2,R[1]??X,3,R[2]??X,4,R[3]??X,5,R[4]??X,6,R[5]??X,7,R[6]??X,8,R[7]??X,9,R[8]??X,10,R[9]??X]}function kd(R,X){if(R!=="all")return Ad(Fo(R,X));let re=["england","wales","scotland","northern_ireland"].flatMap(ce=>[ce,Ad(Fo(ce,X))]);return["match",["get","nation"],...re,Fo("england",X)[0]??"#cccccc"]}function um(R){for(let X of R.getStyle().layers??[])if(X.type==="symbol")return X.id}function dm(R){let X=R.patients.circleColor??"#0d0d58",re=R.patients.colorByGroup??{},ce=Object.entries(re).filter(([I,p])=>I&&p);return ce.length?["match",["coalesce",["to-string",["get","group"]],""],...ce.flatMap(([I,p])=>[I,p]),X]:X}function Rh(R,X,re,ce){Bh(R);let I=Mh(X),p=I?{filter:I}:{},Se=um(R);for(let{tier:Ce,minzoom:$e,maxzoom:pe}of rs){let K=ic(Ce),ht=Xa(re,Ce),Dt=kd(X,ce);R.addLayer({id:Ja(Ce),type:"fill",source:K,"source-layer":ht,minzoom:$e,maxzoom:pe,...p,paint:{"fill-color":Dt,"fill-opacity":ce.choropleth.fillOpacity??.7}},Se),R.addLayer({id:sc(Ce),type:"line",source:K,"source-layer":ht,minzoom:$e,maxzoom:pe,...p,paint:{"line-color":ce.choropleth.borderColor??"#ffffff","line-width":ce.choropleth.borderWidth??.5}},Se)}}function Bh(R){for(let X of Dh)R.getLayer(X)&&R.removeLayer(X)}function zd(R,X,re){let ce=kd(X,re);for(let{tier:I}of rs){let p=Ja(I),Se=sc(I);R.getLayer(p)&&(R.setPaintProperty(p,"fill-color",ce),R.setPaintProperty(p,"fill-opacity",re.choropleth.fillOpacity??.7),R.setPaintProperty(Se,"line-color",re.choropleth.borderColor??"#ffffff"),R.setPaintProperty(Se,"line-width",re.choropleth.borderWidth??.5))}}function Ld(R,X,re){let ce=Mh(X);for(let{tier:I}of rs){let p=Ja(I),Se=sc(I);if(!R.getLayer(p))continue;let Ce=Xa(re,I);R.setFilter(p,ce),R.setFilter(Se,ce)}}function oc(R,X){let re=X.patients,ce=dm(X);R.getLayer(gr)?(R.setPaintProperty(gr,"circle-color",ce),R.setPaintProperty(gr,"circle-radius",re.circleRadius??5),R.setPaintProperty(gr,"circle-stroke-color",re.circleStrokeColor??"#ffffff"),R.setPaintProperty(gr,"circle-stroke-width",re.circleStrokeWidth??1),R.setPaintProperty(gr,"circle-opacity",re.circleOpacity??.8)):R.addLayer({id:gr,type:"circle",source:ns,paint:{"circle-color":ce,"circle-radius":re.circleRadius??5,"circle-stroke-color":re.circleStrokeColor??"#ffffff","circle-stroke-width":re.circleStrokeWidth??1,"circle-opacity":re.circleOpacity??.8}})}function Dd(R){R.getLayer(gr)&&R.removeLayer(gr)}function ac(R,X){let re=X.leadCentre;R.getLayer(Ar)?(R.setPaintProperty(Ar,"circle-color",re.color??"#e00087"),R.setPaintProperty(Ar,"circle-radius",re.radius??10),R.setPaintProperty(Ar,"circle-stroke-color",re.strokeColor??"#ffffff"),R.setPaintProperty(Ar,"circle-stroke-width",re.strokeWidth??2)):R.addLayer({id:Ar,type:"circle",source:ss,paint:{"circle-color":re.color??"#e00087","circle-radius":re.radius??10,"circle-stroke-color":re.strokeColor??"#ffffff","circle-stroke-width":re.strokeWidth??2}})}function Rd(R){R.getLayer(Ar)&&R.removeLayer(Ar)}var pm={code:["code","lsoa_code","LSOA11CD","lsoa11cd","LSOA21CD","lsoa21cd"],area_name:["area_name","LSOA11NM","lsoa11nm","LSOA21NM","lsoa21nm","name"],imd_decile:["imd_decile","IMD_Decile","IMDDecile","decile","imd_rank_decile"],imd_rank:["imd_rank","IMD_Rank","rank"],imd_year:["imd_year","IMD_Year"],nation:["nation","Nation","country","Country"],year:["year","Year"],la_code:["la_code","LAD_code","lad_code"],la_name:["la_name","LAD_name","lad_name"],nhser_code:["nhser_code","NHSER_code"],nhser_name:["nhser_name","NHSER_name"],icb_code:["icb_code","ICB_code"],icb_name:["icb_name","ICB_name"],lhb_code:["lhb_code","LHB_code"],lhb_name:["lhb_name","LHB_name"]};function _r(R,X){if(!R)return;if(X in R)return R[X];let re=pm[X];if(re){for(let I of re)if(I in R)return R[I]}let ce=X.toLowerCase();for(let[I,p]of Object.entries(R))if(I.toLowerCase()===ce)return p}function Fd(R,X){return R.replace(/{{\s*([a-zA-Z0-9_]+)\s*}}/g,(re,ce)=>{let I=X[ce];return I==null?"":String(I)})}function fm(R,X){let re=X.tooltip,ce=_r(R,"area_name")??"Unknown area",I=_r(R,"imd_decile")??"\u2013",p=_r(R,"nation")??"\u2013",Se=_r(R,"year")??"\u2013",Ce=_r(R,"imd_year")??"\u2013",$e=re.backgroundColor??"#0d0d58",pe=re.textColor??"#ffffff",K=re.borderRadius??4;return`<div style="background:${$e};color:${pe};padding:8px 12px;border-radius:${K}px;font-size:13px;line-height:1.6;font-family:sans-serif;">
|
|
578
|
+
<strong style="display:block;margin-bottom:2px;">${String(ce)}</strong>
|
|
579
|
+
<span>LSOA year: ${String(Se)}</span><br/>
|
|
580
|
+
<span>${re.decileLabel??"IMD decile"}: <strong>${String(I)}</strong></span><br/>
|
|
581
|
+
<span>IMD year: ${String(Ce)}</span><br/>
|
|
582
|
+
<span>${re.nationLabel??"Nation"}: ${String(p)}</span>
|
|
583
|
+
</div>`}function mm(R,X){let re=X.tooltip,ce=_r(R,"id")??"",I=_r(R,"group")??"",p=re.backgroundColor??"#0d0d58",Se=re.textColor??"#ffffff",Ce=re.borderRadius??4,$e=re.patientLabel??"Patient",pe=re.patientTooltipText??"{{patientLabel}}",K={...R??{},patientLabel:$e,id:ce,group:I},ht=Fd(pe,K);return`<div style="background:${p};color:${Se};padding:8px 12px;border-radius:${Ce}px;font-size:13px;line-height:1.6;font-family:sans-serif;">
|
|
584
|
+
<span>${ht}</span>
|
|
585
|
+
</div>`}function gm(R,X){let re=X.tooltip,ce=_r(R,"label")??"Lead centre",I=re.backgroundColor??"#0d0d58",p=re.textColor??"#ffffff",Se=re.borderRadius??4,Ce=re.leadCentreLabel??"Lead centre",$e=Fd(re.leadCentreTooltipText??"{{leadCentreLabel}}: {{label}}",{leadCentreLabel:Ce,label:ce});return`<div style="background:${I};color:${p};padding:8px 12px;border-radius:${Se}px;font-size:13px;line-height:1.6;font-family:sans-serif;">
|
|
586
|
+
<span>${$e}</span>
|
|
587
|
+
</div>`}function Bd(R){let X=R.properties??{},re=_r(X,"imd_decile");return{lsoaCode:String(_r(X,"code")??""),lsoaName:String(_r(X,"area_name")??""),imdDecile:typeof re=="number"?re:void 0,nation:String(_r(X,"nation")??""),rawProperties:X}}function Od(R,X,re,ce){let I=Dh.filter(p=>p.startsWith("rcpch-imd-fill-"));for(let p of I)R.on("mousemove",p,Se=>{let Ce=R.queryRenderedFeatures(Se.point,{layers:[p]});if(!Ce.length)return;R.getCanvas().style.cursor="pointer";let $e=Ce[0];X.setLngLat(Se.lngLat).setHTML(fm($e.properties,re)).addTo(R),ce.onAreaHover?.(Bd($e))}),R.on("mouseleave",p,()=>{R.getCanvas().style.cursor="",X.remove()}),R.on("click",p,Se=>{let Ce=R.queryRenderedFeatures(Se.point,{layers:[p]});Ce.length&&ce.onAreaClick?.(Bd(Ce[0]))})}function Fh(R,X,re){R.on("mousemove",gr,ce=>{let I=R.queryRenderedFeatures(ce.point,{layers:[gr]});if(!I.length)return;let p=I[0];R.getCanvas().style.cursor="pointer",X.setLngLat(ce.lngLat).setHTML(mm(p.properties,re)).addTo(R)}),R.on("mouseleave",gr,()=>{R.getCanvas().style.cursor="",X.remove()})}function Oh(R,X,re){R.on("mousemove",Ar,ce=>{let I=R.queryRenderedFeatures(ce.point,{layers:[Ar]});if(!I.length)return;let p=I[0];R.getCanvas().style.cursor="pointer",X.setLngLat(ce.lngLat).setHTML(gm(p.properties,re)).addTo(R)}),R.on("mouseleave",Ar,()=>{R.getCanvas().style.cursor="",X.remove()})}function Nh(R,X){let re=[];return(typeof R!="number"||isNaN(R)||R<-90||R>90)&&re.push(`Invalid latitude: ${String(R)}. Must be a number between -90 and 90.`),(typeof X!="number"||isNaN(X)||X<-180||X>180)&&re.push(`Invalid longitude: ${String(X)}. Must be a number between -180 and 180.`),{valid:re.length===0,errors:re}}var lc={minLat:49.5,maxLat:61.5,minLon:-8.7,maxLon:2.1};function _m(R,X){return R>=lc.minLat&&R<=lc.maxLat&&X>=lc.minLon&&X<=lc.maxLon}function Nd(R){if(!R||typeof R!="object")return{point:null,errors:["Record is not an object."]};let X=R,re=X.lat??X.latitude??X.LAT,ce=X.lon??X.lng??X.longitude??X.LON,{valid:I,errors:p}=Nh(re,ce);if(!I)return{point:null,errors:p};if(!_m(re,ce))return{point:null,errors:[`Point (${String(re)}, ${String(ce)}) is outside UK bounds and will be skipped.`]};let Se=new Set(["lat","lon","id","weight","group","latitude","longitude","lng","LAT","LON"]);return{point:{lat:re,lon:ce,id:X.id!==void 0?String(X.id):void 0,weight:typeof X.weight=="number"?X.weight:void 0,group:typeof X.group=="string"?X.group:void 0,properties:Object.fromEntries(Object.entries(X).filter(([$e])=>!Se.has($e)))},errors:[]}}function ym(R){return typeof R=="object"&&R!==null&&R.type==="FeatureCollection"&&Array.isArray(R.features)}function xm(R){return typeof R=="object"&&R!==null&&R.type==="Feature"}function Vd(R,X){let re=[],ce=[],I=X?.strict===!0,p;if(ym(R))p=R.features.map(Se=>({lat:Se.geometry.coordinates[1],lon:Se.geometry.coordinates[0],...Se.properties}));else if(Array.isArray(R))p=R.map(Se=>xm(Se)?{lat:Se.geometry.coordinates[1],lon:Se.geometry.coordinates[0],...Se.properties}:Se);else{if(I)throw new Error("[rcpch-imd-map] PatientInput must be an array or GeoJSON FeatureCollection.");return ce.push({code:"INVALID_INPUT",message:"PatientInput must be an array or GeoJSON FeatureCollection."}),{features:re,warnings:ce}}for(let Se=0;Se<p.length;Se++){let{point:Ce,errors:$e}=Nd(p[Se]);if(!Ce){if(I)throw new Error(`[rcpch-imd-map] Patient record at index ${Se} is invalid: ${$e.join("; ")}`);ce.push({code:"INVALID_PATIENT_POINT",message:`Patient record at index ${Se} is invalid and will be skipped: ${$e.join("; ")}`,details:{index:Se,errors:$e}});continue}for(let pe of $e)ce.push({code:"PATIENT_POINT_WARNING",message:pe,details:{index:Se}});re.push({type:"Feature",geometry:{type:"Point",coordinates:[Ce.lon,Ce.lat]},properties:{id:Ce.id??`patient-${Se}`,weight:Ce.weight??1,group:Ce.group??null,...Ce.properties}})}return{features:re,warnings:ce}}function Ud(R){if(!R||typeof R!="object")return null;let X,re,ce="Lead centre";if(R.type==="Feature"&&R.geometry?.type==="Point")[re,X]=R.geometry.coordinates,ce=R.properties?.label??ce;else{let p=R;X=p.lat??p.latitude,re=p.lon??p.lng??p.longitude,ce=p.label??ce}let{valid:I}=Nh(X,re);return I?{type:"Feature",geometry:{type:"Point",coordinates:[re,X]},properties:{label:ce}}:null}var jd=tc(Ha(),1);var cc="rcpch-imd-la-overlay",Vs="rcpch-imd-la-overlay-line",vm="public.la_tiles",bm="public.la_tiles";function $d(R,X,re){let ce=Bo(X,vm),I=R.getSource(cc);if(I instanceof jd.VectorTileSource?I.setTiles([ce]):(I&&R.removeSource(cc),R.addSource(cc,{type:"vector",tiles:[ce],minzoom:0,maxzoom:14})),R.getLayer(Vs)){R.setPaintProperty(Vs,"line-color",re.boundaries.localAuthorityColor??"#0d0d58"),R.setPaintProperty(Vs,"line-width",re.boundaries.localAuthorityWidth??1),R.setLayoutProperty(Vs,"visibility","visible");return}R.addLayer({id:Vs,type:"line",source:cc,"source-layer":bm,paint:{"line-color":re.boundaries.localAuthorityColor??"#0d0d58","line-width":re.boundaries.localAuthorityWidth??1},layout:{visibility:"visible"}})}function qd(R){R.getLayer(Vs)&&R.setLayoutProperty(Vs,"visibility","none")}var Zd=tc(Ha(),1);var wm="rcpch-imd-nhser-overlay",Gd="rcpch-imd-nhser-overlay-line",Sm="rcpch-imd-icb-overlay",Hd="rcpch-imd-icb-overlay-line",Tm="rcpch-imd-lhb-overlay",Wd="rcpch-imd-lhb-overlay-line",Im="public.nhser_tiles_2021",Cm="public.nhser_tiles_2021",Pm="public.icb_tiles_2023",Mm="public.icb_tiles_2023",Am="public.lhb_tiles_2022",Em="public.lhb_tiles_2022";function Vh(R,X,re){let ce=Bo(X,re.fullTableName),I=R.getSource(re.sourceId);if(I instanceof Zd.VectorTileSource?I.setTiles([ce]):(I&&R.removeSource(re.sourceId),R.addSource(re.sourceId,{type:"vector",tiles:[ce],minzoom:0,maxzoom:14})),R.getLayer(re.layerId)){R.setPaintProperty(re.layerId,"line-color",re.lineColor),R.setPaintProperty(re.layerId,"line-width",re.lineWidth),R.setLayoutProperty(re.layerId,"visibility","visible");return}R.addLayer({id:re.layerId,type:"line",source:re.sourceId,"source-layer":re.sourceLayer,paint:{"line-color":re.lineColor,"line-width":re.lineWidth},layout:{visibility:"visible"}})}function Xd(R,X,re){Vh(R,X,{sourceId:wm,layerId:Gd,fullTableName:Im,sourceLayer:Cm,lineColor:re.boundaries.nhserColor??"#e00087",lineWidth:re.boundaries.nhserWidth??1.5})}function Kd(R,X,re){Vh(R,X,{sourceId:Sm,layerId:Hd,fullTableName:Pm,sourceLayer:Mm,lineColor:re.boundaries.icbColor??"#57c7f2",lineWidth:re.boundaries.icbWidth??1})}function Jd(R,X,re){Vh(R,X,{sourceId:Tm,layerId:Wd,fullTableName:Am,sourceLayer:Em,lineColor:re.boundaries.lhbColor??"#57c7f2",lineWidth:re.boundaries.lhbWidth??1})}function Uh(R,X){R.getLayer(X)&&R.setLayoutProperty(X,"visibility","none")}function Yd(R){Uh(R,Gd)}function Qd(R){Uh(R,Hd)}function ep(R){Uh(R,Wd)}function km(R,X){let re=R.nation,ce=re==="all"||re==="england",I=re==="all"||re==="england",p=re==="all"||re==="wales";return[{key:"nhser",label:"NHS England regions",isVisible:X.nhser,isEnabled:ce,isActive:R.overlays.nhser,disabledNote:"England only"},{key:"icb",label:"ICBs",isVisible:X.icb,isEnabled:I,isActive:R.overlays.icb,disabledNote:"England only"},{key:"localAuthority",label:"Local authorities",isVisible:X.localAuthority,isEnabled:!0,isActive:R.overlays.localAuthority},{key:"lhb",label:"Local health boards",isVisible:X.lhb,isEnabled:p,isActive:R.overlays.lhb,disabledNote:"Wales only"}].filter(Ce=>Ce.isVisible)}function zm(R,X){switch(R.style.top="",R.style.right="",R.style.bottom="",R.style.left="",X){case"top-left":R.style.top="12px",R.style.left="12px";break;case"bottom-left":R.style.bottom="12px",R.style.left="12px";break;case"bottom-right":R.style.bottom="12px",R.style.right="12px";break;default:R.style.top="12px",R.style.right="12px";break}}function tp(R){window.getComputedStyle(R.container).position==="static"&&(R.container.style.position="relative");let re=R.state,ce=R.style,I=R.collapsed,p=document.createElement("div");p.setAttribute("data-rcpch-legend","true"),p.style.position="absolute",p.style.zIndex="5",p.style.pointerEvents="auto",zm(p,R.position);let Se=document.createElement("div"),Ce=document.createElement("button"),$e=document.createElement("span"),pe=document.createElement("span"),K=document.createElement("div"),ht=document.createElement("div");Ce.type="button",Ce.setAttribute("aria-expanded",String(!I)),$e.textContent=R.title,pe.textContent=I?"+":"-",Ce.appendChild($e),Ce.appendChild(pe),Se.appendChild(Ce),Se.appendChild(K),Se.appendChild(ht),p.appendChild(Se),R.container.appendChild(p);function Dt(){let et=ce.legend,He=et?.backgroundColor??"#ffffff",Je=et?.textColor??"#0d0d58",Pt=et?.borderColor??"#d8dde6",Mt=et?.borderRadius??8,Vt=et?.fontSize??13,_t=et?.fontFamily??"system-ui, -apple-system, Segoe UI, Roboto, sans-serif",yi=et?.width??220,Ye=et?.boxShadow??"0 6px 18px rgba(0, 0, 0, 0.12)";Se.style.background=He,Se.style.color=Je,Se.style.border=`1px solid ${Pt}`,Se.style.borderRadius=`${Mt}px`,Se.style.width=`${yi}px`,Se.style.boxShadow=Ye,Se.style.overflow="hidden",Ce.style.width="100%",Ce.style.border="0",Ce.style.background="transparent",Ce.style.color=Je,Ce.style.display="flex",Ce.style.alignItems="center",Ce.style.justifyContent="space-between",Ce.style.padding="10px 12px",Ce.style.cursor="pointer",Ce.style.fontWeight="600",Ce.style.fontSize=`${Vt}px`,Ce.style.fontFamily=_t,Ce.style.textAlign="left",K.style.padding="0 12px 10px",K.style.display=I?"none":"block",K.style.fontFamily=_t,K.style.fontSize=`${Vt}px`,ht.style.padding="0 12px 10px",ht.style.display=I?"none":"block",ht.style.fontFamily=_t,ht.style.fontSize=`${Math.max(Vt-1,11)}px`,ht.style.borderTop=`1px solid ${Pt}`}function Nt(){K.innerHTML="",ht.innerHTML="";let et=km(re,R.visibility);if(!et.length){p.style.display="none";return}p.style.display="";for(let He of et){let Je=document.createElement("button"),Pt=document.createElement("span"),Mt=document.createElement("span"),Vt=document.createElement("span");if(Je.type="button",Je.style.width="100%",Je.style.border="0",Je.style.background="transparent",Je.style.color=ce.legend?.textColor??"#0d0d58",Je.style.display="flex",Je.style.alignItems="center",Je.style.gap="8px",Je.style.padding="6px 0",Je.style.cursor=He.isEnabled?"pointer":"not-allowed",Je.style.textAlign="left",Je.style.opacity=He.isEnabled?He.isActive?"1":"0.75":"0.5",Pt.style.width="10px",Pt.style.height="10px",Pt.style.borderRadius="999px",Pt.style.flex="0 0 10px",Pt.style.background=He.isActive?ce.legend?.toggleOnColor??"#0d0d58":ce.legend?.toggleOffColor??"#6b7280",Vt.style.display="flex",Vt.style.flexDirection="column",Vt.style.gap="1px",Mt.textContent=He.label,Vt.appendChild(Mt),!He.isEnabled&&He.disabledNote){let _t=document.createElement("span");_t.textContent=He.disabledNote,_t.style.fontSize="11px",_t.style.opacity="0.9",Vt.appendChild(_t)}Je.setAttribute("aria-pressed",String(He.isActive)),Je.setAttribute("aria-disabled",String(!He.isEnabled)),Je.disabled=!He.isEnabled,Je.setAttribute("title",!He.isEnabled&&He.disabledNote?`${He.label} (${He.disabledNote})`:He.isActive?`Hide ${He.label}`:`Show ${He.label}`),Je.addEventListener("click",()=>{He.isEnabled&&R.onToggle(He.key,!He.isActive)}),Je.appendChild(Pt),Je.appendChild(Vt),K.appendChild(Je)}Jt(et)}function Jt(et){let He=document.createElement("div");He.textContent="Key",He.style.paddingTop="8px",He.style.paddingBottom="6px",He.style.fontWeight="600",ht.appendChild(He);for(let Ye of et){let Yt=document.createElement("div"),ze=document.createElement("span"),tt=document.createElement("span");Yt.style.display="flex",Yt.style.alignItems="center",Yt.style.gap="8px",Yt.style.padding="2px 0",ze.style.display="inline-block",ze.style.width="18px",ze.style.height="0",ze.style.borderTopWidth=`${Math.max($i(Ye.key,ce),2)}px`,ze.style.borderTopStyle="solid",ze.style.borderTopColor=li(Ye.key,ce),tt.textContent=Ye.label,Yt.appendChild(ze),Yt.appendChild(tt),ht.appendChild(Yt)}let Je=document.createElement("div");Je.style.paddingTop="8px";let Pt=document.createElement("div");Pt.textContent="IMD decile (1 most deprived, 10 least deprived)",Pt.style.paddingBottom="4px",ht.appendChild(Pt);let Mt=document.createElement("div");Mt.style.display="grid",Mt.style.gridTemplateColumns="repeat(10, minmax(0, 1fr))",Mt.style.gap="2px";let Vt=Fo(re.nation,ce);for(let Ye=0;Ye<10;Ye++){let Yt=document.createElement("span");Yt.style.height="8px",Yt.style.background=Vt[Ye]??Vt[0]??"#cccccc",Yt.style.display="inline-block",Yt.title=`Decile ${Ye+1}`,Mt.appendChild(Yt)}let _t=document.createElement("div");_t.style.display="flex",_t.style.justifyContent="space-between",_t.style.paddingTop="2px",_t.textContent="1";let yi=document.createElement("span");yi.textContent="10",_t.appendChild(yi),Je.appendChild(Mt),Je.appendChild(_t),ht.appendChild(Je)}function li(et,He){return et==="localAuthority"?He.boundaries.localAuthorityColor??"#0d0d58":et==="nhser"?He.boundaries.nhserColor??"#e00087":et==="icb"?He.boundaries.icbColor??"#57c7f2":He.boundaries.lhbColor??"#57c7f2"}function $i(et,He){return et==="localAuthority"?He.boundaries.localAuthorityWidth??1:et==="nhser"?He.boundaries.nhserWidth??1.5:et==="icb"?He.boundaries.icbWidth??1:He.boundaries.lhbWidth??1}return Ce.addEventListener("click",()=>{I=!I,Ce.setAttribute("aria-expanded",String(!I)),pe.textContent=I?"+":"-",K.style.display=I?"none":"block",ht.style.display=I?"none":"block"}),Dt(),Nt(),{update(et,He){re=et,ce=He,Dt(),Nt()},destroy(){p.remove()}}}var Lm=!1;var as={debug(R,...X){Lm&&console.debug(`[rcpch-imd-map] ${R}`,...X)},info(R,...X){console.info(`[rcpch-imd-map] ${R}`,...X)},warn(R,...X){console.warn(`[rcpch-imd-map] ${R}`,...X)},error(R,...X){console.error(`[rcpch-imd-map] ${R}`,...X)}};var Dm=[-2.5,54],Rm=5;function ip(R){let X=typeof R.container=="string"?document.getElementById(R.container):R.container;if(!X)throw new Error(`[rcpch-imd-map] Container not found: "${String(R.container)}". Ensure the element exists in the DOM before calling createImdMap.`);let re=R.tilesBaseUrl??"";re||as.warn("No tilesBaseUrl provided. Choropleth tiles will not load.");let ce=Lh(zh,R.style),I=Pd(R.initialNation??"all",R.initialEra??"2021");R.enableLocalAuthorityOverlay&&(I={...I,overlays:{...I.overlays,localAuthority:!0}}),R.enableHealthOverlays&&(I={...I,overlays:{...I.overlays,nhser:!0,icb:!0,lhb:!0}});let p=R.showLegend??!0,Se=R.legendPosition??"top-right",Ce=R.legendCollapsed??!1,$e=R.legendTitle??"Map layers",pe={localAuthority:R.showLegendLocalAuthority??!0,nhser:R.showLegendNhser??!0,icb:R.showLegendIcb??!0,lhb:R.showLegendLhb??!0};if(R.initialNation&&R.initialEra&&Ph(R.initialNation,R.initialEra)){let ze={code:"ERA_OVERRIDE",message:`Era '${R.initialEra}' is not supported for nation '${R.initialNation}'. Effective era will be '${I.effectiveEra}'.`};as.warn(ze.message),R.onWarning?.(ze)}let K=new Oo.Map({container:X,style:R.mapStyleUrl??"https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",center:R.center??Dm,zoom:R.zoom??Rm,attributionControl:!1});K.addControl(new Oo.AttributionControl({compact:!0}));let ht=new Oo.Popup({closeButton:!1,closeOnClick:!1}),Dt=!1,Nt=null,Jt=null,li=null,$i=!1,et=!1,He=null,Je=[];function Pt(){return[...He?[He]:[],...Je]}function Mt(ze,tt){let st=Pt();if(!st.length){as.warn("No patient or lead centre data to fit to.");return}if(st.length===1){let[ci,Zt]=st[0];K.flyTo({center:[ci,Zt],zoom:ze??6});return}let Qt=st[0][0],qt=st[0][1],Qi=st[0][0],er=st[0][1];for(let[ci,Zt]of st)ci<Qt&&(Qt=ci),Zt<qt&&(qt=Zt),ci>Qi&&(Qi=ci),Zt>er&&(er=Zt);K.fitBounds([[Qt,qt],[Qi,er]],{padding:tt??50,maxZoom:ze})}function Vt(){if(!Dt||!re)return;let ze=I.nation,tt=ze==="all"||ze==="england",st=ze==="all"||ze==="england",Qt=ze==="all"||ze==="wales";I.overlays.localAuthority?$d(K,re,ce):qd(K),I.overlays.nhser&&tt?Xd(K,re,ce):Yd(K),I.overlays.icb&&st?Kd(K,re,ce):Qd(K),I.overlays.lhb&&Qt?Jd(K,re,ce):ep(K)}function _t(ze){I={...I,overlays:{...I.overlays,...ze}},Vt(),yi?.update(I,ce)}let yi=null;p&&(yi=tp({container:X,position:Se,title:$e,collapsed:Ce,style:ce,state:I,visibility:pe,onToggle:(ze,tt)=>{ze==="localAuthority"?_t({localAuthority:tt}):ze==="nhser"?_t({nhser:tt}):ze==="icb"?_t({icb:tt}):ze==="lhb"&&_t({lhb:tt})}})),as.debug(`tilesBaseUrl resolved to: "${re}"`),K.on("load",()=>{if(Dt=!0,re&&(Ah(K,re,I.effectiveEra),Rh(K,I.nation,I.effectiveEra,ce)),Vt(),Od(K,ht,ce,R),Nt&&(Je=Nt.map(ze=>ze.geometry.coordinates),Eh(K,Nt),oc(K,ce),$i||(Fh(K,ht,ce),$i=!0),I={...I,hasPatients:!0},Nt=null),Jt&&(He=Jt.geometry.coordinates,kh(K,Jt),ac(K,ce),et||(Oh(K,ht,ce),et=!0),I={...I,hasLeadCentre:!0},Jt=null),li){let{zoom:ze,padding:tt}=li;K.once("idle",()=>{Mt(ze,tt)}),li=null}});function Ye(ze,tt){let st=Wa(ze,tt);if(Ph(ze,tt)){let Qi={code:"ERA_OVERRIDE",message:`Era '${tt}' overridden to '${st}' for nation '${ze}'.`};as.warn(Qi.message),R.onWarning?.(Qi)}let Qt=st!==I.effectiveEra,qt=ze!==I.nation;I={...I,nation:ze,era:tt,effectiveEra:st},Dt&&re&&(Qt?(Bh(K),Ah(K,re,st),Rh(K,ze,st,ce)):qt&&Ld(K,ze,st)),R.onViewChange?.({nation:ze,era:tt,effectiveEra:st})}return{setView({nation:ze,era:tt}={}){Ye(ze??I.nation,tt??I.era)},setNation(ze){Ye(ze,I.era)},setEra(ze){Ye(I.nation,ze)},setStyle(ze){ce=Lh(zh,ze),Dt&&(zd(K,I.nation,ce),Vt(),I.hasPatients&&oc(K,ce),I.hasLeadCentre&&ac(K,ce),yi?.update(I,ce))},setOverlayVisibility(ze){_t(ze)},setPatients(ze,tt){let{features:st,warnings:Qt}=Vd(ze,{strict:tt?.strict});Je=st.map(qt=>qt.geometry.coordinates);for(let qt of Qt)as.warn(qt.message),R.onWarning?.(qt);if(!Dt){Nt=st;return}Eh(K,st),oc(K,ce),$i||(Fh(K,ht,ce),$i=!0),I={...I,hasPatients:!0}},clearPatients(){Nt=null,Je=[],Dt&&(Dd(K),K.getSource(ns)&&K.removeSource(ns),I={...I,hasPatients:!1})},setLeadCentre(ze,tt){let st=Ud(ze);if(!st){let Qt={code:"INVALID_LEAD_CENTRE",message:"Lead centre data could not be resolved to valid coordinates."};as.warn(Qt.message),R.onWarning?.(Qt);return}if(!Dt){Jt=st;return}He=st.geometry.coordinates,kh(K,st),ac(K,ce),et||(Oh(K,ht,ce),et=!0),I={...I,hasLeadCentre:!0}},clearLeadCentre(){Jt=null,He=null,Dt&&(Rd(K),K.getSource(ss)&&K.removeSource(ss),I={...I,hasLeadCentre:!1})},getState(){return{...I}},resize(){K.resize()},fitToData(ze){let tt=ze?.zoom,st=ze?.padding;if(!Dt){li={zoom:tt,padding:st};return}Mt(tt,st)},destroy(){ht.remove(),yi?.destroy(),K.remove()}}}return rm(Bm);})();
|
|
588
|
+
/*! Bundled license information:
|
|
589
|
+
|
|
590
|
+
maplibre-gl/dist/maplibre-gl.js:
|
|
591
|
+
(**
|
|
592
|
+
* MapLibre GL JS
|
|
593
|
+
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.7.1/LICENSE.txt
|
|
594
|
+
*)
|
|
595
|
+
*/
|